@molecule/app-legal-pages-react 1.0.1 → 1.1.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/README.md +25 -2
- package/dist/LegalContentPage.d.ts.map +1 -1
- package/dist/LegalContentPage.js +16 -1
- package/dist/LegalModalLinks.d.ts.map +1 -1
- package/dist/LegalModalLinks.js +19 -2
- package/dist/PlanUpdatedPage.d.ts +18 -1
- package/dist/PlanUpdatedPage.d.ts.map +1 -1
- package/dist/PlanUpdatedPage.js +16 -3
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-
|
|
6
|
+
Generated: 2026-09-18T06:40:00.880Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-legal-pages-react
|
|
@@ -212,6 +212,16 @@ interface PlanUpdatedPageProps {
|
|
|
212
212
|
actionDefault?: string
|
|
213
213
|
/** Href the action button navigates to. Defaults to `/`. */
|
|
214
214
|
actionHref?: string
|
|
215
|
+
/**
|
|
216
|
+
* Provider name to verify the purchase with when the return URL carries no
|
|
217
|
+
* `provider` parameter. Verification is skipped when neither names one.
|
|
218
|
+
*/
|
|
219
|
+
provider?: string
|
|
220
|
+
/**
|
|
221
|
+
* Set `false` to render the confirmation without verifying the purchase —
|
|
222
|
+
* only for apps that grant the plan some other way.
|
|
223
|
+
*/
|
|
224
|
+
verify?: boolean
|
|
215
225
|
}
|
|
216
226
|
```
|
|
217
227
|
|
|
@@ -414,6 +424,13 @@ Waits for auth state to initialize, then shows a two-line confirmation
|
|
|
414
424
|
with a single return-home action. i18n keys are configurable so apps
|
|
415
425
|
can match their existing locale shape.
|
|
416
426
|
|
|
427
|
+
This is also where a hosted checkout's purchase is CONFIRMED: the provider
|
|
428
|
+
returns the buyer here with the payment id in the query, and
|
|
429
|
+
`useVerifyPaymentReturn` posts it to
|
|
430
|
+
`/users/:id/verify-payment/:provider` from the app origin, where the
|
|
431
|
+
session cookie applies. The page shows a spinner while that is in flight and
|
|
432
|
+
a retry if it fails, so a failed confirmation never reads as a thank-you.
|
|
433
|
+
|
|
417
434
|
```typescript
|
|
418
435
|
function PlanUpdatedPage({
|
|
419
436
|
messageKey = 'planUpdated.message',
|
|
@@ -423,6 +440,8 @@ function PlanUpdatedPage({
|
|
|
423
440
|
actionKey = 'planUpdated.returnHome',
|
|
424
441
|
actionDefault = 'Return to Home',
|
|
425
442
|
actionHref = '/',
|
|
443
|
+
provider,
|
|
444
|
+
verify = true,
|
|
426
445
|
}?: PlanUpdatedPageProps): JSX.Element
|
|
427
446
|
```
|
|
428
447
|
|
|
@@ -494,7 +513,7 @@ function useLegalModals({ appName, loadContent }?: UseLegalModalsOptions): Legal
|
|
|
494
513
|
|
|
495
514
|
Peer dependencies:
|
|
496
515
|
|
|
497
|
-
- `@molecule/app-react` ^1.0
|
|
516
|
+
- `@molecule/app-react` ^1.1.0
|
|
498
517
|
- `@molecule/app-ui` ^1.0.1
|
|
499
518
|
- `@molecule/app-ui-react` ^1.0.1
|
|
500
519
|
- `react` ^18.0.0 || ^19.0.0
|
|
@@ -508,6 +527,10 @@ Peer dependencies:
|
|
|
508
527
|
- `react`
|
|
509
528
|
- `react-router`
|
|
510
529
|
|
|
530
|
+
- **`appName` is HTML-escaped before interpolation.** The legal bodies are
|
|
531
|
+
rendered as HTML (`dangerouslySetInnerHTML`); an `appName` carrying
|
|
532
|
+
markup is escaped to inert entities first, so it can never execute
|
|
533
|
+
inside the legal content.
|
|
511
534
|
- `LegalContentPage` / `useLegalModals` render bonded HTML that defaults to an
|
|
512
535
|
EMPTY string until the locale module is registered — pass your app's
|
|
513
536
|
`loadContent` (from `src/config.ts`, re-exporting
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LegalContentPage.d.ts","sourceRoot":"","sources":["../src/LegalContentPage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,SAAS,EAAuB,MAAM,OAAO,CAAA;AAOrE,+DAA+D;AAC/D,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,OAAO,CAAA;AAiB3C;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,sCAAsC;IACtC,IAAI,EAAE,SAAS,CAAA;IACf,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,eAAe,GAAG,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IAC/E,4DAA4D;IAC5D,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,uDAAuD;IACvD,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,yEAAyE;IACzE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,iDAAiD;IACjD,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;
|
|
1
|
+
{"version":3,"file":"LegalContentPage.d.ts","sourceRoot":"","sources":["../src/LegalContentPage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,SAAS,EAAuB,MAAM,OAAO,CAAA;AAOrE,+DAA+D;AAC/D,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,OAAO,CAAA;AAiB3C;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,sCAAsC;IACtC,IAAI,EAAE,SAAS,CAAA;IACf,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,eAAe,GAAG,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IAC/E,4DAA4D;IAC5D,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,uDAAuD;IACvD,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,yEAAyE;IACzE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,iDAAiD;IACjD,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAiBD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,OAAO,EACP,WAAW,EACX,MAAM,EACN,MAAM,EACN,UAAwB,EACxB,cAAwB,GACzB,EAAE,qBAAqB,GAAG,GAAG,CAAC,OAAO,CAiCrC"}
|
package/dist/LegalContentPage.js
CHANGED
|
@@ -15,6 +15,19 @@ const MODULE = {
|
|
|
15
15
|
privacy: 'privacyPolicy',
|
|
16
16
|
terms: 'termsOfService',
|
|
17
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* HTML-escapes an interpolation value before it enters a translation whose
|
|
20
|
+
* result is rendered as HTML (`dangerouslySetInnerHTML`). React escapes
|
|
21
|
+
* text children automatically but NOT values interpolated into HTML
|
|
22
|
+
* strings — an `appName` containing markup would otherwise execute inside
|
|
23
|
+
* the legal content.
|
|
24
|
+
*/
|
|
25
|
+
const escapeHtml = (value) => value
|
|
26
|
+
.replaceAll('&', '&')
|
|
27
|
+
.replaceAll('<', '<')
|
|
28
|
+
.replaceAll('>', '>')
|
|
29
|
+
.replaceAll('"', '"')
|
|
30
|
+
.replaceAll("'", ''');
|
|
18
31
|
/**
|
|
19
32
|
* Standalone Privacy / Terms page that renders the **same** bonded legal
|
|
20
33
|
* HTML the footer modal shows (`content.privacyPolicy` /
|
|
@@ -46,6 +59,8 @@ export function LegalContentPage({ kind, appName, loadContent, header, footer, e
|
|
|
46
59
|
cancelled = true;
|
|
47
60
|
};
|
|
48
61
|
}, [loadContent, kind]);
|
|
49
|
-
const html = t(CONTENT_KEY[kind], appName ? { appName } : {}, {
|
|
62
|
+
const html = t(CONTENT_KEY[kind], appName ? { appName: escapeHtml(appName) } : {}, {
|
|
63
|
+
defaultValue: '',
|
|
64
|
+
});
|
|
50
65
|
return (_jsx(ContentPageShell, { dataMolId: `page-${kind}`, header: header, footer: footer, eyebrow: t(eyebrowKey, {}, { defaultValue: eyebrowDefault }), title: t(TITLE[kind].key, {}, { defaultValue: TITLE[kind].def }), children: _jsx("div", { className: cm.prose, dangerouslySetInnerHTML: { __html: html } }) }));
|
|
51
66
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LegalModalLinks.d.ts","sourceRoot":"","sources":["../src/LegalModalLinks.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAA;AAM1D,2DAA2D;AAC3D,MAAM,WAAW,qBAAqB;IACpC,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,eAAe,GAAG,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;CAChF;AAED,yDAAyD;AACzD,MAAM,WAAW,cAAc;IAC7B,2DAA2D;IAC3D,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAChC,6DAA6D;IAC7D,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9B,qEAAqE;IACrE,MAAM,EAAE,GAAG,CAAC,OAAO,CAAA;CACpB;
|
|
1
|
+
{"version":3,"file":"LegalModalLinks.d.ts","sourceRoot":"","sources":["../src/LegalModalLinks.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAA;AAM1D,2DAA2D;AAC3D,MAAM,WAAW,qBAAqB;IACpC,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,eAAe,GAAG,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;CAChF;AAED,yDAAyD;AACzD,MAAM,WAAW,cAAc;IAC7B,2DAA2D;IAC3D,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAChC,6DAA6D;IAC7D,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9B,qEAAqE;IACrE,MAAM,EAAE,GAAG,CAAC,OAAO,CAAA;CACpB;AAiBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,WAAW,GACZ,GAAE,qBAA0B,GAAG,cAAc,CAmD7C;AAED,yCAAyC;AACzC,MAAM,WAAW,oBAAqB,SAAQ,qBAAqB;IACjE,oFAAoF;IACpF,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,mDAAmD;IACnD,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAA;IACnC,4EAA4E;IAC5E,YAAY,CAAC,EAAE,SAAS,CAAA;IACxB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,SAAS,CAAA;CACvB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,EAC9B,aAAa,EACb,IAAa,EACb,YAAY,EACZ,UAAU,EACV,GAAG,IAAI,EACR,EAAE,oBAAoB,GAAG,GAAG,CAAC,OAAO,CAkBpC"}
|
package/dist/LegalModalLinks.js
CHANGED
|
@@ -3,6 +3,19 @@ import { useState } from 'react';
|
|
|
3
3
|
import { useTranslation } from '@molecule/app-react';
|
|
4
4
|
import { getClassMap } from '@molecule/app-ui';
|
|
5
5
|
import { Modal } from '@molecule/app-ui-react';
|
|
6
|
+
/**
|
|
7
|
+
* HTML-escapes an interpolation value before it enters a translation whose
|
|
8
|
+
* result is rendered as HTML (`dangerouslySetInnerHTML`). React escapes
|
|
9
|
+
* text children automatically but NOT values interpolated into HTML
|
|
10
|
+
* strings — an `appName` containing markup would otherwise execute inside
|
|
11
|
+
* the legal content.
|
|
12
|
+
*/
|
|
13
|
+
const escapeHtml = (value) => value
|
|
14
|
+
.replaceAll('&', '&')
|
|
15
|
+
.replaceAll('<', '<')
|
|
16
|
+
.replaceAll('>', '>')
|
|
17
|
+
.replaceAll('"', '"')
|
|
18
|
+
.replaceAll("'", ''');
|
|
6
19
|
/**
|
|
7
20
|
* Headless hook powering in-place Privacy/Terms modals. Use it when the
|
|
8
21
|
* triggers live in different parts of a bespoke footer (or a signup
|
|
@@ -32,9 +45,13 @@ export function useLegalModals({ appName, loadContent, } = {}) {
|
|
|
32
45
|
setTermsOpen(true);
|
|
33
46
|
};
|
|
34
47
|
const modals = (_jsxs(_Fragment, { children: [_jsx(Modal, { open: privacyOpen, onClose: () => setPrivacyOpen(false), title: t('footer.privacyPolicy', {}, { defaultValue: 'Privacy Policy' }), size: "lg", children: _jsx("div", { className: cm.prose, dangerouslySetInnerHTML: {
|
|
35
|
-
__html: t('content.privacyPolicy', appName ? { appName } : {}, {
|
|
48
|
+
__html: t('content.privacyPolicy', appName ? { appName: escapeHtml(appName) } : {}, {
|
|
49
|
+
defaultValue: '',
|
|
50
|
+
}),
|
|
36
51
|
} }) }), _jsx(Modal, { open: termsOpen, onClose: () => setTermsOpen(false), title: t('footer.termsOfService', {}, { defaultValue: 'Terms of Service' }), size: "lg", children: _jsx("div", { className: cm.prose, dangerouslySetInnerHTML: {
|
|
37
|
-
__html: t('content.termsOfService', appName ? { appName } : {}, {
|
|
52
|
+
__html: t('content.termsOfService', appName ? { appName: escapeHtml(appName) } : {}, {
|
|
53
|
+
defaultValue: '',
|
|
54
|
+
}),
|
|
38
55
|
} }) })] }));
|
|
39
56
|
return { openPrivacy, openTerms, modals };
|
|
40
57
|
}
|
|
@@ -15,6 +15,16 @@ export interface PlanUpdatedPageProps {
|
|
|
15
15
|
actionDefault?: string;
|
|
16
16
|
/** Href the action button navigates to. Defaults to `/`. */
|
|
17
17
|
actionHref?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Provider name to verify the purchase with when the return URL carries no
|
|
20
|
+
* `provider` parameter. Verification is skipped when neither names one.
|
|
21
|
+
*/
|
|
22
|
+
provider?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Set `false` to render the confirmation without verifying the purchase —
|
|
25
|
+
* only for apps that grant the plan some other way.
|
|
26
|
+
*/
|
|
27
|
+
verify?: boolean;
|
|
18
28
|
}
|
|
19
29
|
/**
|
|
20
30
|
* "Plan updated" confirmation screen.
|
|
@@ -22,7 +32,14 @@ export interface PlanUpdatedPageProps {
|
|
|
22
32
|
* Waits for auth state to initialize, then shows a two-line confirmation
|
|
23
33
|
* with a single return-home action. i18n keys are configurable so apps
|
|
24
34
|
* can match their existing locale shape.
|
|
35
|
+
*
|
|
36
|
+
* This is also where a hosted checkout's purchase is CONFIRMED: the provider
|
|
37
|
+
* returns the buyer here with the payment id in the query, and
|
|
38
|
+
* `useVerifyPaymentReturn` posts it to
|
|
39
|
+
* `/users/:id/verify-payment/:provider` from the app origin, where the
|
|
40
|
+
* session cookie applies. The page shows a spinner while that is in flight and
|
|
41
|
+
* a retry if it fails, so a failed confirmation never reads as a thank-you.
|
|
25
42
|
* @param props - Component props (see {@link PlanUpdatedPageProps}).
|
|
26
43
|
*/
|
|
27
|
-
export declare function PlanUpdatedPage({ messageKey, messageDefault, thankYouKey, thankYouDefault, actionKey, actionDefault, actionHref, }?: PlanUpdatedPageProps): JSX.Element;
|
|
44
|
+
export declare function PlanUpdatedPage({ messageKey, messageDefault, thankYouKey, thankYouDefault, actionKey, actionDefault, actionHref, provider, verify, }?: PlanUpdatedPageProps): JSX.Element;
|
|
28
45
|
//# sourceMappingURL=PlanUpdatedPage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlanUpdatedPage.d.ts","sourceRoot":"","sources":["../src/PlanUpdatedPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAOhC,yCAAyC;AACzC,MAAM,WAAW,oBAAoB;IACnC,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,+CAA+C;IAC/C,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,sDAAsD;IACtD,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,oDAAoD;IACpD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"PlanUpdatedPage.d.ts","sourceRoot":"","sources":["../src/PlanUpdatedPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAOhC,yCAAyC;AACzC,MAAM,WAAW,oBAAoB;IACnC,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,+CAA+C;IAC/C,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,sDAAsD;IACtD,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,oDAAoD;IACpD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,EAC9B,UAAkC,EAClC,cAA8C,EAC9C,WAAoC,EACpC,eAA8B,EAC9B,SAAoC,EACpC,aAAgC,EAChC,UAAgB,EAChB,QAAQ,EACR,MAAa,GACd,GAAE,oBAAyB,GAAG,GAAG,CAAC,OAAO,CA6CzC"}
|
package/dist/PlanUpdatedPage.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Link } from 'react-router';
|
|
3
|
-
import { useAuth, useTranslation } from '@molecule/app-react';
|
|
3
|
+
import { useAuth, useTranslation, useVerifyPaymentReturn } from '@molecule/app-react';
|
|
4
4
|
import { getClassMap } from '@molecule/app-ui';
|
|
5
5
|
import { Button, Flex, Spinner } from '@molecule/app-ui-react';
|
|
6
6
|
/**
|
|
@@ -9,14 +9,27 @@ import { Button, Flex, Spinner } from '@molecule/app-ui-react';
|
|
|
9
9
|
* Waits for auth state to initialize, then shows a two-line confirmation
|
|
10
10
|
* with a single return-home action. i18n keys are configurable so apps
|
|
11
11
|
* can match their existing locale shape.
|
|
12
|
+
*
|
|
13
|
+
* This is also where a hosted checkout's purchase is CONFIRMED: the provider
|
|
14
|
+
* returns the buyer here with the payment id in the query, and
|
|
15
|
+
* `useVerifyPaymentReturn` posts it to
|
|
16
|
+
* `/users/:id/verify-payment/:provider` from the app origin, where the
|
|
17
|
+
* session cookie applies. The page shows a spinner while that is in flight and
|
|
18
|
+
* a retry if it fails, so a failed confirmation never reads as a thank-you.
|
|
12
19
|
* @param props - Component props (see {@link PlanUpdatedPageProps}).
|
|
13
20
|
*/
|
|
14
|
-
export function PlanUpdatedPage({ messageKey = 'planUpdated.message', messageDefault = 'Your plan has been updated.', thankYouKey = 'planUpdated.thankYou', thankYouDefault = 'Thank you!', actionKey = 'planUpdated.returnHome', actionDefault = 'Return to Home', actionHref = '/', } = {}) {
|
|
21
|
+
export function PlanUpdatedPage({ messageKey = 'planUpdated.message', messageDefault = 'Your plan has been updated.', thankYouKey = 'planUpdated.thankYou', thankYouDefault = 'Thank you!', actionKey = 'planUpdated.returnHome', actionDefault = 'Return to Home', actionHref = '/', provider, verify = true, } = {}) {
|
|
15
22
|
const cm = getClassMap();
|
|
16
23
|
const { t } = useTranslation();
|
|
17
24
|
const { state } = useAuth();
|
|
18
|
-
|
|
25
|
+
const verification = useVerifyPaymentReturn({ provider, enabled: verify });
|
|
26
|
+
if (!state.initialized || verification.status === 'verifying') {
|
|
19
27
|
return (_jsx(Flex, { align: "center", justify: "center", className: cm.sp('py', 12), children: _jsx(Spinner, {}) }));
|
|
20
28
|
}
|
|
29
|
+
if (verification.status === 'failed') {
|
|
30
|
+
return (_jsxs("main", { "data-mol-id": "page-plan-updated", className: cm.cn(cm.textCenter, cm.sp('py', 12)), children: [_jsx("h2", { className: cm.cn(cm.textSize('2xl'), cm.fontWeight('bold'), cm.sp('mb', 8)), "data-mol-id": "plan-updated-error", children: t('planUpdated.verifyFailed', undefined, {
|
|
31
|
+
defaultValue: 'We could not confirm your payment yet.',
|
|
32
|
+
}) }), _jsx(Button, { onClick: verification.retry, "data-mol-id": "plan-updated-retry", children: t('planUpdated.retry', undefined, { defaultValue: 'Try again' }) })] }));
|
|
33
|
+
}
|
|
21
34
|
return (_jsxs("main", { "data-mol-id": "page-plan-updated", className: cm.cn(cm.textCenter, cm.sp('py', 12)), children: [_jsx("h2", { className: cm.cn(cm.textSize('2xl'), cm.fontWeight('bold'), cm.sp('mb', 2)), children: t(messageKey, {}, { defaultValue: messageDefault }) }), _jsx("h2", { className: cm.cn(cm.textSize('2xl'), cm.fontWeight('bold'), cm.sp('mb', 8)), children: t(thankYouKey, {}, { defaultValue: thankYouDefault }) }), _jsx(Link, { to: actionHref, children: _jsx(Button, { children: t(actionKey, {}, { defaultValue: actionDefault }) }) })] }));
|
|
22
35
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
* `<LegalPageLayout>`, `<LegalPageSection>`.
|
|
15
15
|
*
|
|
16
16
|
* @remarks
|
|
17
|
+
* - **`appName` is HTML-escaped before interpolation.** The legal bodies are
|
|
18
|
+
* rendered as HTML (`dangerouslySetInnerHTML`); an `appName` carrying
|
|
19
|
+
* markup is escaped to inert entities first, so it can never execute
|
|
20
|
+
* inside the legal content.
|
|
17
21
|
* - `LegalContentPage` / `useLegalModals` render bonded HTML that defaults to an
|
|
18
22
|
* EMPTY string until the locale module is registered — pass your app's
|
|
19
23
|
* `loadContent` (from `src/config.ts`, re-exporting
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAEH,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
* `<LegalPageLayout>`, `<LegalPageSection>`.
|
|
15
15
|
*
|
|
16
16
|
* @remarks
|
|
17
|
+
* - **`appName` is HTML-escaped before interpolation.** The legal bodies are
|
|
18
|
+
* rendered as HTML (`dangerouslySetInnerHTML`); an `appName` carrying
|
|
19
|
+
* markup is escaped to inert entities first, so it can never execute
|
|
20
|
+
* inside the legal content.
|
|
17
21
|
* - `LegalContentPage` / `useLegalModals` render bonded HTML that defaults to an
|
|
18
22
|
* EMPTY string until the locale module is registered — pass your app's
|
|
19
23
|
* `loadContent` (from `src/config.ts`, re-exporting
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-legal-pages-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "React page scaffolds for Terms, Privacy, and PlanUpdated (i18n-driven, customizable keys)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -33,15 +33,15 @@
|
|
|
33
33
|
"directory": "packages/app/features/legal-pages-react"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@molecule/app-react": "^1.0
|
|
36
|
+
"@molecule/app-react": "^1.1.0",
|
|
37
37
|
"@molecule/app-ui": "^1.0.1",
|
|
38
38
|
"@molecule/app-ui-react": "^1.0.1",
|
|
39
39
|
"react": "^18.0.0 || ^19.0.0",
|
|
40
40
|
"react-router": "^7.0.0 || ^8.0.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@molecule/app-react": "1.0
|
|
44
|
-
"@molecule/app-ui": "1.0
|
|
43
|
+
"@molecule/app-react": "1.5.0",
|
|
44
|
+
"@molecule/app-ui": "1.1.0",
|
|
45
45
|
"@molecule/app-ui-react": "1.0.1",
|
|
46
46
|
"@types/node": "26.1.2",
|
|
47
47
|
"@types/react": "19.2.17",
|
|
@@ -50,6 +50,6 @@
|
|
|
50
50
|
"react-dom": "19.2.8",
|
|
51
51
|
"react-router": "8.3.0",
|
|
52
52
|
"typescript": "6.0.3",
|
|
53
|
-
"vitest": "4.1.
|
|
53
|
+
"vitest": "4.1.11"
|
|
54
54
|
}
|
|
55
55
|
}
|