@molecule/app-legal-pages-react 1.0.1 → 1.1.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/README.md +20 -1
- package/dist/PlanUpdatedPage.d.ts +18 -1
- package/dist/PlanUpdatedPage.d.ts.map +1 -1
- package/dist/PlanUpdatedPage.js +16 -3
- package/package.json +4 -4
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-08-
|
|
6
|
+
Generated: 2026-08-15T19:34:34.396Z
|
|
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
|
|
|
@@ -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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-legal-pages-react",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
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.1.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",
|