@adonis-agora/payments-dashboard 0.5.2 → 1.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/README.md +10 -9
- package/dist/spa/assets/{index-DtMpe2lE.js → index-DeVNvGyC.js} +4 -4
- package/dist/spa/assets/index-DeVNvGyC.js.map +1 -0
- package/dist/spa/assets/index-ZuYF2tz5.css +2 -0
- package/dist/spa/index.html +2 -2
- package/package.json +9 -13
- package/dist/spa/assets/index-D6oPV1WS.css +0 -2
- package/dist/spa/assets/index-DtMpe2lE.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @adonis-agora/payments-dashboard
|
|
2
2
|
|
|
3
|
+
## 1.0.0-rc.1
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#222](https://github.com/DavideCarvalho/adonis-agora-payments/pull/222) [`b57fa20`](https://github.com/DavideCarvalho/adonis-agora-payments/commit/b57fa209cf7da05b6c26eebb8ced5341d85eaa67) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Dashboard `authorize` adopts the shared Agora console contract, and the console behaves like every other Agora console.
|
|
8
|
+
|
|
9
|
+
- `authorize` takes an inline function, an authorizer class (built through the container, so `@inject()` works), or a lazy import `() => import('#policies/console_access')`. An authorizer may answer `{ redirectTo }`: a `302` for page navigations, `401 { error: 'unauthenticated', redirectTo }` for API calls. A throw is a `403`.
|
|
10
|
+
- With `authorize` omitted the console is open outside production and answers every request with `403` in production, and the app logs one warning at boot: ``[@adonis-agora/payments] console has no `authorize` configured: it is open outside production and denies every request in production. Set `authorize` in config/payments_dashboard.ts.``
|
|
11
|
+
- `PAYMENTS_DASHBOARD_TOKEN` is removed, with the `x-payments-token` header and the `?token=` query param, and `defaultAuthorize` is no longer exported. For token access use the new `authorizeByToken({ token: env.get('CONSOLE_TOKEN') })`, which checks `Authorization: Bearer <token>` in constant time and answers `401` otherwise. An empty token throws when the config loads.
|
|
12
|
+
- API denials from `authorize` answer `{ error: 'forbidden' }` (`403`) or `{ error: 'unauthenticated' }` (`401`, was `'unauthorized'`).
|
|
13
|
+
- `dashboardAuth` is removed, with no alias: the built-in login page, `GET|POST <path>/login`, `POST <path>/session`, `GET <path>/logout`, the signed session cookie and its `login`/`session` hooks, and the exports `resolveDashboardAuth`, `performLogin`, `performSession`, `readSession`, `sanitizeReturnTo`, `SESSION_COOKIE_NAME`, `signSessionCookie`, `verifySessionCookie`, `renderLoginPage` and the types `DashboardAuthOptions`, `ResolvedDashboardAuth`, `AuthMode`, `LoginHook`, `LoginOutcome`, `SessionHook`, `SessionOutcome`, `DashboardSession`, `DashboardSessionUser`, `SignOptions`, `VerifyOptions`, `InjectedAuth`. Sign-in is your app's own: gate the console in `authorize` and return `{ redirectTo: '/login' }` for a signed-out visitor. `ResolvedPaymentsDashboardConfig` has no `dashboardAuth`, and the injected page config no `auth`.
|
|
14
|
+
- The console UI has no Sign out link. On a `401` from its API it follows the body's `redirectTo`, or reloads the console page so the server answers the navigation.
|
|
15
|
+
- Refunds and dispute resolutions are recorded against the app's signed-in user (`ctx.auth.user`'s `email`, `name` or `id`), `bearer` for a token caller, else unattributed.
|
|
16
|
+
- The access-denied page drops the `session-required` reason; `loginHref` is only what you pass in `accessDenied`.
|
|
17
|
+
|
|
18
|
+
Exported from `@adonis-agora/payments/dashboard`: `ConsoleAuthorize`, `ConsoleAuthorizer`, `ConsoleAuthorizerClass`, `ConsoleAuthorizeResult`, `resolveConsoleAuthorize`, `authorizeByToken`. `ResolvedPaymentsDashboardConfig['authorize']` is now `ConsoleAuthorize | null`. The payments client endpoint (`config/payments_client.ts`) and payment-driver tokens are unchanged.
|
|
19
|
+
|
|
20
|
+
## 1.0.0-rc.0
|
|
21
|
+
|
|
22
|
+
### Major Changes
|
|
23
|
+
|
|
24
|
+
- [#220](https://github.com/DavideCarvalho/adonis-agora-payments/pull/220) [`198495f`](https://github.com/DavideCarvalho/adonis-agora-payments/commit/198495f227b18603e0082687d1d7b116eccac4f5) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - 1.0. The 0.x aliases are removed. See "Migrating to 1.0" in the docs.
|
|
25
|
+
|
|
26
|
+
- `@adonis-agora/payments`: `Payment.pixQrCode` is removed. Use `Payment.pixQrCodeImage`.
|
|
27
|
+
- `@adonis-agora/payments`: `Payment.pixCopiaECola` and `CheckoutSession.pixCopiaECola` are removed. Use `pixCode`. No driver sets the old names any more.
|
|
28
|
+
- `@adonis-agora/payments`: the `billing.durable` config option is removed. Use `billing.dispatcher` (`true` → `'durable'`, `false` → `'in-process'`). A config that still sets `durable` fails at boot with a message naming the replacement. The `configure` stub now writes `dispatcher: 'auto'`.
|
|
29
|
+
- `@adonis-agora/payments`: the payments client endpoint's default `authorize`/`owner` read only `ctx.auth.user`; the `ctx.auth.getUser()` probe (old authkit-client) is removed. Pass your own `authorize`/`owner` for any other auth shape.
|
|
30
|
+
- `@adonis-agora/payments`: `PROVIDER_SCAN_CAP` is no longer exported from `@adonis-agora/payments/dashboard`.
|
|
31
|
+
- `@adonis-agora/payments-dashboard`: the SPA no longer reads the `window.__PAYMENTS_BASE__` / `__PAYMENTS_API__` / `__PAYMENTS_CURRENCY__` / `__PAYMENTS_AUTH__` globals; config comes only from the provider's JSON data block. Without a block it falls back to `/payments`, the server's default mount (was `/payments-dashboard`).
|
|
32
|
+
- `@adonis-agora/payments-dashboard`: the `react` / `react-dom` peers are dropped. The console ships prebuilt with React bundled.
|
|
33
|
+
- The optional `@adonis-agora/durable` peer is widened to `>=0.1.0 <2.0.0 || >=1.0.0-rc.0 <2.0.0`.
|
|
34
|
+
- All packages require Node `>=24` (tested on 24 and 26).
|
|
35
|
+
|
|
3
36
|
## 0.5.2
|
|
4
37
|
|
|
5
38
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -39,18 +39,20 @@ import { defineConfig } from '@adonis-agora/payments/dashboard'
|
|
|
39
39
|
|
|
40
40
|
export default defineConfig({
|
|
41
41
|
enabled: true, // false => no routes are registered at all
|
|
42
|
-
path: '/payments
|
|
42
|
+
path: '/payments', // the SPA mounts here; the JSON API at <path>/api
|
|
43
43
|
currency: 'BRL', // how the edge formats the integer cents it receives
|
|
44
44
|
})
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
-
**
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
**Without `authorize` the console is open outside production and answers `403` to every request in
|
|
48
|
+
production** (with a warning at boot). Set `authorize` to your own guard: an inline
|
|
49
|
+
function, an authorizer class (built through the container, so `@inject()` works), or a lazy import
|
|
50
|
+
`() => import('#policies/console_access')`. It answers `true`/`false`,
|
|
50
51
|
`{ allowed, reason?: 'unauthenticated' | 'forbidden' }` (`401` for `unauthenticated`, `403` for any
|
|
51
|
-
other denial or a throw)
|
|
52
|
-
`
|
|
53
|
-
|
|
52
|
+
other denial or a throw) or `{ redirectTo }`. For machine access use
|
|
53
|
+
`authorizeByToken({ token: env.get('CONSOLE_TOKEN') })` (bearer header only). Sign-in is your app's
|
|
54
|
+
own: return `{ redirectTo: '/login' }` for a signed-out visitor. When an API call answers `401`, the
|
|
55
|
+
console follows its `redirectTo`, or reloads so the server answers the navigation.
|
|
54
56
|
|
|
55
57
|
## URLs
|
|
56
58
|
|
|
@@ -65,8 +67,7 @@ wider than the viewport.
|
|
|
65
67
|
|
|
66
68
|
The provider hands the SPA its config as a `<script type="application/json">` data block, never an
|
|
67
69
|
executable inline script, so `script-src 'self'` (with or without a nonce) is all the console needs.
|
|
68
|
-
|
|
69
|
-
escape hatch, consulted only when the block is absent.
|
|
70
|
+
That block is the only way the SPA learns its mount, API base and currency.
|
|
70
71
|
|
|
71
72
|
## Money
|
|
72
73
|
|