@adonis-agora/payments 0.4.0 → 0.5.0

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.
Files changed (33) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/dist/assets/spa/assets/index-BQtKssQN.js +10 -0
  3. package/dist/assets/spa/assets/index-BQtKssQN.js.map +1 -0
  4. package/dist/assets/spa/assets/index-BqeSOw2s.css +2 -0
  5. package/dist/assets/spa/index.html +8 -2
  6. package/dist/providers/dashboard_provider.d.ts +12 -3
  7. package/dist/providers/dashboard_provider.d.ts.map +1 -1
  8. package/dist/providers/dashboard_provider.js +96 -13
  9. package/dist/providers/dashboard_provider.js.map +1 -1
  10. package/dist/src/dashboard/access_denied_page.d.ts +102 -0
  11. package/dist/src/dashboard/access_denied_page.d.ts.map +1 -0
  12. package/dist/src/dashboard/access_denied_page.js +266 -0
  13. package/dist/src/dashboard/access_denied_page.js.map +1 -0
  14. package/dist/src/dashboard/define_config.d.ts +26 -0
  15. package/dist/src/dashboard/define_config.d.ts.map +1 -1
  16. package/dist/src/dashboard/define_config.js +1 -0
  17. package/dist/src/dashboard/define_config.js.map +1 -1
  18. package/dist/src/dashboard/index.d.ts +5 -2
  19. package/dist/src/dashboard/index.d.ts.map +1 -1
  20. package/dist/src/dashboard/index.js +3 -1
  21. package/dist/src/dashboard/index.js.map +1 -1
  22. package/dist/src/dashboard/login_page.d.ts +22 -9
  23. package/dist/src/dashboard/login_page.d.ts.map +1 -1
  24. package/dist/src/dashboard/login_page.js +29 -41
  25. package/dist/src/dashboard/login_page.js.map +1 -1
  26. package/dist/src/dashboard/spa.d.ts +37 -7
  27. package/dist/src/dashboard/spa.d.ts.map +1 -1
  28. package/dist/src/dashboard/spa.js +28 -15
  29. package/dist/src/dashboard/spa.js.map +1 -1
  30. package/package.json +2 -2
  31. package/dist/assets/spa/assets/index-B7rU8eIL.css +0 -2
  32. package/dist/assets/spa/assets/index-BcM2VH5k.js +0 -10
  33. package/dist/assets/spa/assets/index-BcM2VH5k.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,62 @@
1
1
  # @adonis-agora/payments
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#18](https://github.com/DavideCarvalho/adonis-agora-payments/pull/18) [`7513756`](https://github.com/DavideCarvalho/adonis-agora-payments/commit/7513756cc6e85cf2b7763737da27bb7599d03878) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Dashboard: a refused page navigation now gets a real page instead of `{"error":"forbidden"}`.
8
+
9
+ Opening the console without permission used to answer the browser with the same JSON the API
10
+ gets. It now serves a built-in access-denied page in the console's own visual language — the
11
+ status, a sentence explaining the refusal, a "Back to app" link and, when `dashboardAuth.login`
12
+ is configured, a "Sign in" button. The Mode-A-only "Open this console from your application."
13
+ notice uses the same page. API requests are unchanged (the SPA still relies on their JSON), and
14
+ an `authorize` hook that redirects still wins.
15
+
16
+ The page carries no inline `<script>`, so a nonce'd `script-src` CSP cannot break it; its inline
17
+ `<style>` takes `@adonisjs/shield`'s request nonce when one exists.
18
+
19
+ New `accessDenied` option on `config/payments_dashboard.ts` to customise it — an object
20
+ (`brand`, `title`, `message`, `homeHref`, `loginHref`, `accent`, labels) to tweak the built-in
21
+ page, or a function `(info, ctx) => html | void` to render it yourself or redirect.
22
+
23
+ Also: the built-in `dashboardAuth` login page no longer dies under a nonce'd CSP. It is now a real
24
+ HTML form that works without JavaScript — a form submit is answered with a redirect (to the page
25
+ the operator came from, or back to the form with the error shown) while the page's own `fetch`
26
+ keeps getting JSON — and its inline script/style carry `@adonisjs/shield`'s request nonce.
27
+ `renderLoginPage` takes an optional `{ nonce, error, returnTo }`.
28
+
29
+ ## 0.4.1
30
+
31
+ ### Patch Changes
32
+
33
+ - [#14](https://github.com/DavideCarvalho/adonis-agora-payments/pull/14) [`3a885c4`](https://github.com/DavideCarvalho/adonis-agora-payments/commit/3a885c478dec80ca1b112e318ec3890b6a1bd77c) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Dashboard: survives a strict CSP, fits on a phone, has URLs, and no longer links to a 404.
34
+
35
+ - **Every API request 404 under a nonce CSP — fixed.** The provider used to hand the SPA its
36
+ mount/API base as an inline `<script>` setting `window.__PAYMENTS_*__`. A host with
37
+ `script-src 'self' 'nonce-…'` (`@adonisjs/shield`'s `@nonce`) drops that script silently; the SPA
38
+ then fell back to `/payments-dashboard/api` and every request from a console that rendered fine
39
+ answered 404. The config now travels as a `<script type="application/json">` data block, which
40
+ is never executed and so cannot be refused. Nothing to change on the host. The globals are still
41
+ honoured as a fallback for tests/embedding.
42
+
43
+ - **Hash routes.** The current screen lives in the URL fragment (`#/webhooks`,
44
+ `#/webhooks?status=failed`, `#/payments?customer=cus_…`, `#/payments/<gatewayId>` for one payment
45
+ open in full), so the back button works, a reload comes back to the same screen, and a view can be
46
+ pasted into a ticket. The health panel's buttons write the same hashes they used to set in state.
47
+ A fragment rather than a path because the provider deliberately registers no SPA catch-all.
48
+ - **Mobile.** Every pill row (the tab bar, the status filters) scrolls sideways instead of pushing
49
+ the page wider than the viewport; the detail and confirm dialogs no longer overflow on a long
50
+ gateway id; tighter page padding under `sm`.
51
+ - **Sign out only where it can work.** The config block now carries the auth surface
52
+ (`auth: { modes } | null`), and the SPA shows the Sign out link only
53
+ when `dashboardAuth` is configured — that is the only configuration that registers
54
+ `<path>/logout`; on every other deployment the link was a 404 one click away.
55
+ - **Favicon.** Inline SVG icon, so the browser's automatic `/favicon.ico` probe stops 404ing in the
56
+ host app's log.
57
+
58
+ `renderIndexHtml` gains an optional fifth argument (`InjectedAuth`) and now emits the JSON block instead of the globals; `CONFIG_ELEMENT_ID`/`InjectedConfig` are exported. Existing callers are unaffected.
59
+
3
60
  ## 0.4.0
4
61
 
5
62
  ### Minor Changes