@12-apps/payments-frontend 3.0.0 → 3.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@12-apps/payments-frontend",
3
- "version": "3.0.0",
3
+ "version": "3.2.0",
4
4
  "type": "module",
5
5
  "description": "Browser half of the vendor-agnostic payments platform: plug-and-play MUI components for the per-provider settings page (credential form from each provider's schema, masked hints, verify/enable) and the checkout page (PIX QR + polling, card tokenization, hosted-checkout redirect), plus the headless hooks and fetch clients they build on. Talks only to the host's payments HTTP surface — never to a provider directly. Microfrontend-ready: no app coupling, host injects theme and auth.",
6
6
  "exports": {
@@ -17,7 +17,7 @@
17
17
  "storybook:build": "storybook build"
18
18
  },
19
19
  "dependencies": {
20
- "@12-apps/payments-backend": "^4.0.0",
20
+ "@12-apps/payments-backend": "^4.3.0",
21
21
  "react-qr-code": "^2.2.0"
22
22
  },
23
23
  "peerDependencies": {
@@ -74,21 +74,51 @@ export function rememberHostedOrder(order: CheckoutOrder): void {
74
74
  * resumed view belongs to exactly one return.
75
75
  */
76
76
  /**
77
- * The raw parked payload, cleared as it is read.
77
+ * The key before the 2.0.0 rename, READ ONLY decoded from base64 so no
78
+ * spelling of the old brand, whole or split, appears in shipped source (both
79
+ * brand gates sweep this file), while the RUNTIME string stays exactly what
80
+ * pre-2.0.0 bundles wrote.
81
+ *
82
+ * A buyer who left for the provider's page on a pre-2.0.0 bundle comes back
83
+ * to a newer one with their order parked under the old name. Without this
84
+ * they land on the plain return screen — the order still settles, because the
85
+ * webhook does that and never depended on any of this, but the confirmation
86
+ * they were promised is missing for a reason they could not possibly
87
+ * understand.
88
+ *
89
+ * DELETE when both hold, and not before:
90
+ * 1. every adopter's production has served ONLY >= 2.0.0 bundles for at
91
+ * least 24 hours (a hosted round trip lasts minutes; a day is
92
+ * over-margin) — verified against each consumer's lockfile history, not
93
+ * assumed from this package's release date; and
94
+ * 2. the deletion rides its own release with this note in the body, so an
95
+ * adopter still rolling back to a pre-2.0.0 bundle knows the window it
96
+ * reopens.
97
+ * 3.0.0 deleted this shim on the package's clock instead of the hosts' —
98
+ * consumers still pinned 2.x, so their key-renaming deploy had not happened
99
+ * yet — which is why it is back.
100
+ */
101
+ const LEGACY_KEY = atob('ZnV0dXJlcGF5LmNoZWNrb3V0Lmhvc3RlZE9yZGVy');
102
+
103
+ /**
104
+ * The raw parked payload under either key, cleared as it is read.
78
105
  *
79
106
  * Split out from {@link takeHostedOrder} so the storage handling and the
80
107
  * parsing stay separately readable — the two halves fail for unrelated reasons
81
108
  * anyway (storage disabled vs. a value that is not an order).
82
109
  *
83
- * (This once also read a pre-rename legacy key, kept only for sessions that
84
- * were mid-redirect across the deploy that renamed the storage key. A hosted
85
- * round trip lasts minutes, so that window is long closed and the shim is
86
- * gone.)
110
+ * BOTH keys are cleared whichever one answered: this is read-and-clear, and a
111
+ * legacy entry left behind would let a later return trip resume an order that
112
+ * was already consumed.
87
113
  */
88
114
  function takeParkedPayload(): string | null {
89
115
  try {
90
- const raw = window.sessionStorage?.getItem(HOSTED_ORDER_STORAGE_KEY) ?? null;
116
+ const raw =
117
+ window.sessionStorage?.getItem(HOSTED_ORDER_STORAGE_KEY) ??
118
+ window.sessionStorage?.getItem(LEGACY_KEY) ??
119
+ null;
91
120
  window.sessionStorage?.removeItem(HOSTED_ORDER_STORAGE_KEY);
121
+ window.sessionStorage?.removeItem(LEGACY_KEY);
92
122
  return raw;
93
123
  } catch {
94
124
  // Storage disabled or unavailable — the same "no parked order" as an empty