@spare-technologies/spare-link 0.1.0-beta.0 → 1.0.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 +119 -81
- package/lib/commonjs/core/models/payment-return-params.js +245 -20
- package/lib/commonjs/core/models/payment-return-params.js.map +1 -1
- package/lib/commonjs/core/models/pending-session-record.js +2 -0
- package/lib/commonjs/core/models/pending-session-record.js.map +1 -0
- package/lib/commonjs/core/services/hosted-flow-controller.js +333 -0
- package/lib/commonjs/core/services/hosted-flow-controller.js.map +1 -0
- package/lib/commonjs/core/services/hosted-flow-state.js +96 -0
- package/lib/commonjs/core/services/hosted-flow-state.js.map +1 -0
- package/lib/commonjs/index.js +42 -164
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/internal/hosted/bridge-message.js +107 -0
- package/lib/commonjs/internal/hosted/bridge-message.js.map +1 -0
- package/lib/commonjs/internal/hosted/hosted-url.js +41 -0
- package/lib/commonjs/internal/hosted/hosted-url.js.map +1 -0
- package/lib/commonjs/internal/index.js +0 -7
- package/lib/commonjs/internal/index.js.map +1 -1
- package/lib/commonjs/internal/redact-uri.js +59 -15
- package/lib/commonjs/internal/redact-uri.js.map +1 -1
- package/lib/commonjs/internal/secure-store-pending-session-store.js +20 -25
- package/lib/commonjs/internal/secure-store-pending-session-store.js.map +1 -1
- package/lib/commonjs/internal/url-parts.js +145 -0
- package/lib/commonjs/internal/url-parts.js.map +1 -0
- package/lib/commonjs/public/index.js +0 -37
- package/lib/commonjs/public/index.js.map +1 -1
- package/lib/commonjs/public/payment-result.js +16 -4
- package/lib/commonjs/public/payment-result.js.map +1 -1
- package/lib/commonjs/public/recovery-result.js +7 -18
- package/lib/commonjs/public/recovery-result.js.map +1 -1
- package/lib/commonjs/public/spare-link-config.js +41 -16
- package/lib/commonjs/public/spare-link-config.js.map +1 -1
- package/lib/commonjs/public/spare-link-event.js +27 -33
- package/lib/commonjs/public/spare-link-event.js.map +1 -1
- package/lib/commonjs/public/spare-link-instance.js +67 -77
- package/lib/commonjs/public/spare-link-instance.js.map +1 -1
- package/lib/commonjs/public/spare-link-session.js +2 -9
- package/lib/commonjs/public/spare-link-session.js.map +1 -1
- package/lib/commonjs/public/spare-link.js +0 -12
- package/lib/commonjs/public/spare-link.js.map +1 -1
- package/lib/commonjs/ui/hooks/{use-payment-flow-state.js → use-hosted-flow-state.js} +4 -4
- package/lib/commonjs/ui/hooks/use-hosted-flow-state.js.map +1 -0
- package/lib/commonjs/ui/hosted/hosted-payment-page.js +177 -0
- package/lib/commonjs/ui/hosted/hosted-payment-page.js.map +1 -0
- package/lib/commonjs/ui/hosted/hosted-payment-webview.js +168 -0
- package/lib/commonjs/ui/hosted/hosted-payment-webview.js.map +1 -0
- package/lib/commonjs/ui/screens/index.js +3 -17
- package/lib/commonjs/ui/screens/index.js.map +1 -1
- package/lib/commonjs/ui/screens/page-unavailable-screen.js +101 -0
- package/lib/commonjs/ui/screens/page-unavailable-screen.js.map +1 -0
- package/lib/commonjs/ui/spare-link-host.js +220 -234
- package/lib/commonjs/ui/spare-link-host.js.map +1 -1
- package/lib/commonjs/ui/widgets/index.js +3 -10
- package/lib/commonjs/ui/widgets/index.js.map +1 -1
- package/lib/commonjs/version.js +7 -5
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/core/models/payment-return-params.js +235 -20
- package/lib/module/core/models/payment-return-params.js.map +1 -1
- package/lib/module/core/models/pending-session-record.js +2 -0
- package/lib/module/core/models/pending-session-record.js.map +1 -0
- package/lib/module/core/services/hosted-flow-controller.js +328 -0
- package/lib/module/core/services/hosted-flow-controller.js.map +1 -0
- package/lib/module/core/services/hosted-flow-state.js +91 -0
- package/lib/module/core/services/hosted-flow-state.js.map +1 -0
- package/lib/module/index.js +8 -22
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal/hosted/bridge-message.js +104 -0
- package/lib/module/internal/hosted/bridge-message.js.map +1 -0
- package/lib/module/internal/hosted/hosted-url.js +36 -0
- package/lib/module/internal/hosted/hosted-url.js.map +1 -0
- package/lib/module/internal/index.js +0 -1
- package/lib/module/internal/index.js.map +1 -1
- package/lib/module/internal/redact-uri.js +59 -15
- package/lib/module/internal/redact-uri.js.map +1 -1
- package/lib/module/internal/secure-store-pending-session-store.js +20 -25
- package/lib/module/internal/secure-store-pending-session-store.js.map +1 -1
- package/lib/module/internal/url-parts.js +139 -0
- package/lib/module/internal/url-parts.js.map +1 -0
- package/lib/module/public/index.js +2 -3
- package/lib/module/public/index.js.map +1 -1
- package/lib/module/public/payment-result.js +16 -4
- package/lib/module/public/payment-result.js.map +1 -1
- package/lib/module/public/recovery-result.js +7 -17
- package/lib/module/public/recovery-result.js.map +1 -1
- package/lib/module/public/spare-link-config.js +42 -15
- package/lib/module/public/spare-link-config.js.map +1 -1
- package/lib/module/public/spare-link-event.js +27 -33
- package/lib/module/public/spare-link-event.js.map +1 -1
- package/lib/module/public/spare-link-instance.js +68 -72
- package/lib/module/public/spare-link-instance.js.map +1 -1
- package/lib/module/public/spare-link-session.js +2 -9
- package/lib/module/public/spare-link-session.js.map +1 -1
- package/lib/module/public/spare-link.js +1 -1
- package/lib/module/public/spare-link.js.map +1 -1
- package/lib/module/ui/hooks/{use-payment-flow-state.js → use-hosted-flow-state.js} +3 -3
- package/lib/module/ui/hooks/use-hosted-flow-state.js.map +1 -0
- package/lib/module/ui/hosted/hosted-payment-page.js +175 -0
- package/lib/module/ui/hosted/hosted-payment-page.js.map +1 -0
- package/lib/module/ui/hosted/hosted-payment-webview.js +163 -0
- package/lib/module/ui/hosted/hosted-payment-webview.js.map +1 -0
- package/lib/module/ui/screens/index.js +1 -3
- package/lib/module/ui/screens/index.js.map +1 -1
- package/lib/module/ui/screens/page-unavailable-screen.js +97 -0
- package/lib/module/ui/screens/page-unavailable-screen.js.map +1 -0
- package/lib/module/ui/spare-link-host.js +221 -236
- package/lib/module/ui/spare-link-host.js.map +1 -1
- package/lib/module/ui/widgets/index.js +1 -2
- package/lib/module/ui/widgets/index.js.map +1 -1
- package/lib/module/version.js +7 -5
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/commonjs/core/models/index.d.ts +1 -123
- package/lib/typescript/commonjs/core/models/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/core/models/payment-return-params.d.ts +91 -8
- package/lib/typescript/commonjs/core/models/payment-return-params.d.ts.map +1 -1
- package/lib/typescript/commonjs/core/models/pending-session-record.d.ts +11 -0
- package/lib/typescript/commonjs/core/models/pending-session-record.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/services/hosted-flow-controller.d.ts +119 -0
- package/lib/typescript/commonjs/core/services/hosted-flow-controller.d.ts.map +1 -0
- package/lib/typescript/commonjs/core/services/hosted-flow-state.d.ts +75 -0
- package/lib/typescript/commonjs/core/services/hosted-flow-state.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +5 -14
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/internal/hosted/bridge-message.d.ts +44 -0
- package/lib/typescript/commonjs/internal/hosted/bridge-message.d.ts.map +1 -0
- package/lib/typescript/commonjs/internal/hosted/hosted-url.d.ts +30 -0
- package/lib/typescript/commonjs/internal/hosted/hosted-url.d.ts.map +1 -0
- package/lib/typescript/commonjs/internal/index.d.ts +0 -1
- package/lib/typescript/commonjs/internal/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/internal/redact-uri.d.ts +21 -1
- package/lib/typescript/commonjs/internal/redact-uri.d.ts.map +1 -1
- package/lib/typescript/commonjs/internal/secure-store-pending-session-store.d.ts +3 -2
- package/lib/typescript/commonjs/internal/secure-store-pending-session-store.d.ts.map +1 -1
- package/lib/typescript/commonjs/internal/url-parts.d.ts +46 -0
- package/lib/typescript/commonjs/internal/url-parts.d.ts.map +1 -0
- package/lib/typescript/commonjs/public/index.d.ts +4 -6
- package/lib/typescript/commonjs/public/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/public/payment-result.d.ts +50 -12
- package/lib/typescript/commonjs/public/payment-result.d.ts.map +1 -1
- package/lib/typescript/commonjs/public/recovery-result.d.ts +11 -20
- package/lib/typescript/commonjs/public/recovery-result.d.ts.map +1 -1
- package/lib/typescript/commonjs/public/spare-link-config.d.ts +13 -31
- package/lib/typescript/commonjs/public/spare-link-config.d.ts.map +1 -1
- package/lib/typescript/commonjs/public/spare-link-event.d.ts +29 -31
- package/lib/typescript/commonjs/public/spare-link-event.d.ts.map +1 -1
- package/lib/typescript/commonjs/public/spare-link-host-api.d.ts +1 -12
- package/lib/typescript/commonjs/public/spare-link-host-api.d.ts.map +1 -1
- package/lib/typescript/commonjs/public/spare-link-instance.d.ts +26 -20
- package/lib/typescript/commonjs/public/spare-link-instance.d.ts.map +1 -1
- package/lib/typescript/commonjs/public/spare-link-session.d.ts +3 -8
- package/lib/typescript/commonjs/public/spare-link-session.d.ts.map +1 -1
- package/lib/typescript/commonjs/public/spare-link.d.ts +1 -1
- package/lib/typescript/commonjs/public/spare-link.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/use-hosted-flow-state.d.ts +9 -0
- package/lib/typescript/commonjs/ui/hooks/use-hosted-flow-state.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/hosted/hosted-payment-page.d.ts +17 -0
- package/lib/typescript/commonjs/ui/hosted/hosted-payment-page.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/hosted/hosted-payment-webview.d.ts +43 -0
- package/lib/typescript/commonjs/ui/hosted/hosted-payment-webview.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/index.d.ts +1 -3
- package/lib/typescript/commonjs/ui/screens/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/page-unavailable-screen.d.ts +18 -0
- package/lib/typescript/commonjs/ui/screens/page-unavailable-screen.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/spare-link-host.d.ts +4 -5
- package/lib/typescript/commonjs/ui/spare-link-host.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/widgets/index.d.ts +1 -2
- package/lib/typescript/commonjs/ui/widgets/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/version.d.ts +7 -5
- package/lib/typescript/commonjs/version.d.ts.map +1 -1
- package/lib/typescript/module/core/models/index.d.ts +1 -123
- package/lib/typescript/module/core/models/index.d.ts.map +1 -1
- package/lib/typescript/module/core/models/payment-return-params.d.ts +91 -8
- package/lib/typescript/module/core/models/payment-return-params.d.ts.map +1 -1
- package/lib/typescript/module/core/models/pending-session-record.d.ts +11 -0
- package/lib/typescript/module/core/models/pending-session-record.d.ts.map +1 -0
- package/lib/typescript/module/core/services/hosted-flow-controller.d.ts +119 -0
- package/lib/typescript/module/core/services/hosted-flow-controller.d.ts.map +1 -0
- package/lib/typescript/module/core/services/hosted-flow-state.d.ts +75 -0
- package/lib/typescript/module/core/services/hosted-flow-state.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +5 -14
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/internal/hosted/bridge-message.d.ts +44 -0
- package/lib/typescript/module/internal/hosted/bridge-message.d.ts.map +1 -0
- package/lib/typescript/module/internal/hosted/hosted-url.d.ts +30 -0
- package/lib/typescript/module/internal/hosted/hosted-url.d.ts.map +1 -0
- package/lib/typescript/module/internal/index.d.ts +0 -1
- package/lib/typescript/module/internal/index.d.ts.map +1 -1
- package/lib/typescript/module/internal/redact-uri.d.ts +21 -1
- package/lib/typescript/module/internal/redact-uri.d.ts.map +1 -1
- package/lib/typescript/module/internal/secure-store-pending-session-store.d.ts +3 -2
- package/lib/typescript/module/internal/secure-store-pending-session-store.d.ts.map +1 -1
- package/lib/typescript/module/internal/url-parts.d.ts +46 -0
- package/lib/typescript/module/internal/url-parts.d.ts.map +1 -0
- package/lib/typescript/module/public/index.d.ts +4 -6
- package/lib/typescript/module/public/index.d.ts.map +1 -1
- package/lib/typescript/module/public/payment-result.d.ts +50 -12
- package/lib/typescript/module/public/payment-result.d.ts.map +1 -1
- package/lib/typescript/module/public/recovery-result.d.ts +11 -20
- package/lib/typescript/module/public/recovery-result.d.ts.map +1 -1
- package/lib/typescript/module/public/spare-link-config.d.ts +13 -31
- package/lib/typescript/module/public/spare-link-config.d.ts.map +1 -1
- package/lib/typescript/module/public/spare-link-event.d.ts +29 -31
- package/lib/typescript/module/public/spare-link-event.d.ts.map +1 -1
- package/lib/typescript/module/public/spare-link-host-api.d.ts +1 -12
- package/lib/typescript/module/public/spare-link-host-api.d.ts.map +1 -1
- package/lib/typescript/module/public/spare-link-instance.d.ts +26 -20
- package/lib/typescript/module/public/spare-link-instance.d.ts.map +1 -1
- package/lib/typescript/module/public/spare-link-session.d.ts +3 -8
- package/lib/typescript/module/public/spare-link-session.d.ts.map +1 -1
- package/lib/typescript/module/public/spare-link.d.ts +1 -1
- package/lib/typescript/module/public/spare-link.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/use-hosted-flow-state.d.ts +9 -0
- package/lib/typescript/module/ui/hooks/use-hosted-flow-state.d.ts.map +1 -0
- package/lib/typescript/module/ui/hosted/hosted-payment-page.d.ts +17 -0
- package/lib/typescript/module/ui/hosted/hosted-payment-page.d.ts.map +1 -0
- package/lib/typescript/module/ui/hosted/hosted-payment-webview.d.ts +43 -0
- package/lib/typescript/module/ui/hosted/hosted-payment-webview.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/index.d.ts +1 -3
- package/lib/typescript/module/ui/screens/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/page-unavailable-screen.d.ts +18 -0
- package/lib/typescript/module/ui/screens/page-unavailable-screen.d.ts.map +1 -0
- package/lib/typescript/module/ui/spare-link-host.d.ts +4 -5
- package/lib/typescript/module/ui/spare-link-host.d.ts.map +1 -1
- package/lib/typescript/module/ui/widgets/index.d.ts +1 -2
- package/lib/typescript/module/ui/widgets/index.d.ts.map +1 -1
- package/lib/typescript/module/version.d.ts +7 -5
- package/lib/typescript/module/version.d.ts.map +1 -1
- package/package.json +24 -23
- package/plugins/with-spare-link.js +6 -26
- package/src/core/models/index.ts +1 -139
- package/src/core/models/payment-return-params.ts +269 -21
- package/src/core/models/pending-session-record.ts +10 -0
- package/src/core/services/hosted-flow-controller.ts +374 -0
- package/src/core/services/hosted-flow-state.ts +123 -0
- package/src/index.ts +20 -89
- package/src/internal/hosted/bridge-message.ts +106 -0
- package/src/internal/hosted/hosted-url.ts +33 -0
- package/src/internal/index.ts +0 -1
- package/src/internal/redact-uri.ts +69 -15
- package/src/internal/secure-store-pending-session-store.ts +28 -49
- package/src/internal/url-parts.ts +134 -0
- package/src/public/index.ts +2 -24
- package/src/public/payment-result.ts +50 -12
- package/src/public/recovery-result.ts +16 -25
- package/src/public/spare-link-config.ts +56 -43
- package/src/public/spare-link-event.ts +33 -42
- package/src/public/spare-link-host-api.ts +1 -14
- package/src/public/spare-link-instance.ts +57 -65
- package/src/public/spare-link-session.ts +4 -16
- package/src/public/spare-link.ts +1 -1
- package/src/ui/hooks/use-hosted-flow-state.ts +16 -0
- package/src/ui/hosted/hosted-payment-page.tsx +178 -0
- package/src/ui/hosted/hosted-payment-webview.tsx +164 -0
- package/src/ui/screens/index.ts +4 -6
- package/src/ui/screens/page-unavailable-screen.tsx +94 -0
- package/src/ui/spare-link-host.tsx +227 -247
- package/src/ui/widgets/index.ts +1 -2
- package/src/version.ts +7 -5
- package/CHANGELOG.md +0 -66
- package/lib/commonjs/core/client/link-api-client.js +0 -297
- package/lib/commonjs/core/client/link-api-client.js.map +0 -1
- package/lib/commonjs/core/errors/payment-api-error.js +0 -35
- package/lib/commonjs/core/errors/payment-api-error.js.map +0 -1
- package/lib/commonjs/core/models/link-session-status.js +0 -14
- package/lib/commonjs/core/models/link-session-status.js.map +0 -1
- package/lib/commonjs/core/models/payment-type.js +0 -45
- package/lib/commonjs/core/models/payment-type.js.map +0 -1
- package/lib/commonjs/core/models/wire-mappers.js +0 -277
- package/lib/commonjs/core/models/wire-mappers.js.map +0 -1
- package/lib/commonjs/core/services/consent-presenter.js +0 -150
- package/lib/commonjs/core/services/consent-presenter.js.map +0 -1
- package/lib/commonjs/core/services/execute-resume-if-needed.js +0 -216
- package/lib/commonjs/core/services/execute-resume-if-needed.js.map +0 -1
- package/lib/commonjs/core/services/multi-payment-rules-presenter.js +0 -151
- package/lib/commonjs/core/services/multi-payment-rules-presenter.js.map +0 -1
- package/lib/commonjs/core/services/payment-flow-controller.js +0 -547
- package/lib/commonjs/core/services/payment-flow-controller.js.map +0 -1
- package/lib/commonjs/core/services/payment-flow-state.js +0 -110
- package/lib/commonjs/core/services/payment-flow-state.js.map +0 -1
- package/lib/commonjs/core/services/payment-result-mapper.js +0 -49
- package/lib/commonjs/core/services/payment-result-mapper.js.map +0 -1
- package/lib/commonjs/core/services/presentation-utils.js +0 -11
- package/lib/commonjs/core/services/presentation-utils.js.map +0 -1
- package/lib/commonjs/core/services/redirect-buffer.js +0 -40
- package/lib/commonjs/core/services/redirect-buffer.js.map +0 -1
- package/lib/commonjs/core/services/user-friendly-messages.js +0 -46
- package/lib/commonjs/core/services/user-friendly-messages.js.map +0 -1
- package/lib/commonjs/internal/telemetry-collector.js +0 -80
- package/lib/commonjs/internal/telemetry-collector.js.map +0 -1
- package/lib/commonjs/public/constants.js +0 -21
- package/lib/commonjs/public/constants.js.map +0 -1
- package/lib/commonjs/public/spare-link-callbacks.js +0 -6
- package/lib/commonjs/public/spare-link-callbacks.js.map +0 -1
- package/lib/commonjs/ui/consent/charge-bearer-display.js +0 -99
- package/lib/commonjs/ui/consent/charge-bearer-display.js.map +0 -1
- package/lib/commonjs/ui/consent/consent-accordion.js +0 -94
- package/lib/commonjs/ui/consent/consent-accordion.js.map +0 -1
- package/lib/commonjs/ui/consent/consent-summary-section.js +0 -27
- package/lib/commonjs/ui/consent/consent-summary-section.js.map +0 -1
- package/lib/commonjs/ui/consent/cop-information.js +0 -168
- package/lib/commonjs/ui/consent/cop-information.js.map +0 -1
- package/lib/commonjs/ui/consent/international-payment-summary.js +0 -98
- package/lib/commonjs/ui/consent/international-payment-summary.js.map +0 -1
- package/lib/commonjs/ui/consent/label-value-rows.js +0 -59
- package/lib/commonjs/ui/consent/label-value-rows.js.map +0 -1
- package/lib/commonjs/ui/consent/multi-payment-rules-list.js +0 -130
- package/lib/commonjs/ui/consent/multi-payment-rules-list.js.map +0 -1
- package/lib/commonjs/ui/consent/multi-payment-summary.js +0 -99
- package/lib/commonjs/ui/consent/multi-payment-summary.js.map +0 -1
- package/lib/commonjs/ui/consent/single-payment-summary.js +0 -158
- package/lib/commonjs/ui/consent/single-payment-summary.js.map +0 -1
- package/lib/commonjs/ui/consent/terms-link.js +0 -35
- package/lib/commonjs/ui/consent/terms-link.js.map +0 -1
- package/lib/commonjs/ui/hooks/use-payment-flow-state.js.map +0 -1
- package/lib/commonjs/ui/payment-flow-page.js +0 -235
- package/lib/commonjs/ui/payment-flow-page.js.map +0 -1
- package/lib/commonjs/ui/screens/bank-selection-screen.js +0 -215
- package/lib/commonjs/ui/screens/bank-selection-screen.js.map +0 -1
- package/lib/commonjs/ui/screens/consent-details-screen.js +0 -124
- package/lib/commonjs/ui/screens/consent-details-screen.js.map +0 -1
- package/lib/commonjs/ui/screens/mandate-setup-success-screen.js +0 -79
- package/lib/commonjs/ui/screens/mandate-setup-success-screen.js.map +0 -1
- package/lib/commonjs/ui/widgets/layout-w-header.js +0 -106
- package/lib/commonjs/ui/widgets/layout-w-header.js.map +0 -1
- package/lib/commonjs/ui/widgets/stepper.js +0 -124
- package/lib/commonjs/ui/widgets/stepper.js.map +0 -1
- package/lib/module/core/client/link-api-client.js +0 -292
- package/lib/module/core/client/link-api-client.js.map +0 -1
- package/lib/module/core/errors/payment-api-error.js +0 -29
- package/lib/module/core/errors/payment-api-error.js.map +0 -1
- package/lib/module/core/models/link-session-status.js +0 -10
- package/lib/module/core/models/link-session-status.js.map +0 -1
- package/lib/module/core/models/payment-type.js +0 -36
- package/lib/module/core/models/payment-type.js.map +0 -1
- package/lib/module/core/models/wire-mappers.js +0 -263
- package/lib/module/core/models/wire-mappers.js.map +0 -1
- package/lib/module/core/services/consent-presenter.js +0 -140
- package/lib/module/core/services/consent-presenter.js.map +0 -1
- package/lib/module/core/services/execute-resume-if-needed.js +0 -211
- package/lib/module/core/services/execute-resume-if-needed.js.map +0 -1
- package/lib/module/core/services/multi-payment-rules-presenter.js +0 -146
- package/lib/module/core/services/multi-payment-rules-presenter.js.map +0 -1
- package/lib/module/core/services/payment-flow-controller.js +0 -544
- package/lib/module/core/services/payment-flow-controller.js.map +0 -1
- package/lib/module/core/services/payment-flow-state.js +0 -106
- package/lib/module/core/services/payment-flow-state.js.map +0 -1
- package/lib/module/core/services/payment-result-mapper.js +0 -45
- package/lib/module/core/services/payment-result-mapper.js.map +0 -1
- package/lib/module/core/services/presentation-utils.js +0 -7
- package/lib/module/core/services/presentation-utils.js.map +0 -1
- package/lib/module/core/services/redirect-buffer.js +0 -33
- package/lib/module/core/services/redirect-buffer.js.map +0 -1
- package/lib/module/core/services/user-friendly-messages.js +0 -42
- package/lib/module/core/services/user-friendly-messages.js.map +0 -1
- package/lib/module/internal/telemetry-collector.js +0 -75
- package/lib/module/internal/telemetry-collector.js.map +0 -1
- package/lib/module/public/constants.js +0 -17
- package/lib/module/public/constants.js.map +0 -1
- package/lib/module/public/spare-link-callbacks.js +0 -4
- package/lib/module/public/spare-link-callbacks.js.map +0 -1
- package/lib/module/ui/consent/charge-bearer-display.js +0 -95
- package/lib/module/ui/consent/charge-bearer-display.js.map +0 -1
- package/lib/module/ui/consent/consent-accordion.js +0 -90
- package/lib/module/ui/consent/consent-accordion.js.map +0 -1
- package/lib/module/ui/consent/consent-summary-section.js +0 -23
- package/lib/module/ui/consent/consent-summary-section.js.map +0 -1
- package/lib/module/ui/consent/cop-information.js +0 -165
- package/lib/module/ui/consent/cop-information.js.map +0 -1
- package/lib/module/ui/consent/international-payment-summary.js +0 -94
- package/lib/module/ui/consent/international-payment-summary.js.map +0 -1
- package/lib/module/ui/consent/label-value-rows.js +0 -55
- package/lib/module/ui/consent/label-value-rows.js.map +0 -1
- package/lib/module/ui/consent/multi-payment-rules-list.js +0 -125
- package/lib/module/ui/consent/multi-payment-rules-list.js.map +0 -1
- package/lib/module/ui/consent/multi-payment-summary.js +0 -95
- package/lib/module/ui/consent/multi-payment-summary.js.map +0 -1
- package/lib/module/ui/consent/single-payment-summary.js +0 -154
- package/lib/module/ui/consent/single-payment-summary.js.map +0 -1
- package/lib/module/ui/consent/terms-link.js +0 -31
- package/lib/module/ui/consent/terms-link.js.map +0 -1
- package/lib/module/ui/hooks/use-payment-flow-state.js.map +0 -1
- package/lib/module/ui/payment-flow-page.js +0 -232
- package/lib/module/ui/payment-flow-page.js.map +0 -1
- package/lib/module/ui/screens/bank-selection-screen.js +0 -211
- package/lib/module/ui/screens/bank-selection-screen.js.map +0 -1
- package/lib/module/ui/screens/consent-details-screen.js +0 -120
- package/lib/module/ui/screens/consent-details-screen.js.map +0 -1
- package/lib/module/ui/screens/mandate-setup-success-screen.js +0 -75
- package/lib/module/ui/screens/mandate-setup-success-screen.js.map +0 -1
- package/lib/module/ui/widgets/layout-w-header.js +0 -102
- package/lib/module/ui/widgets/layout-w-header.js.map +0 -1
- package/lib/module/ui/widgets/stepper.js +0 -120
- package/lib/module/ui/widgets/stepper.js.map +0 -1
- package/lib/typescript/commonjs/core/client/link-api-client.d.ts +0 -70
- package/lib/typescript/commonjs/core/client/link-api-client.d.ts.map +0 -1
- package/lib/typescript/commonjs/core/errors/payment-api-error.d.ts +0 -15
- package/lib/typescript/commonjs/core/errors/payment-api-error.d.ts.map +0 -1
- package/lib/typescript/commonjs/core/models/link-session-status.d.ts +0 -6
- package/lib/typescript/commonjs/core/models/link-session-status.d.ts.map +0 -1
- package/lib/typescript/commonjs/core/models/payment-type.d.ts +0 -18
- package/lib/typescript/commonjs/core/models/payment-type.d.ts.map +0 -1
- package/lib/typescript/commonjs/core/models/wire-mappers.d.ts +0 -19
- package/lib/typescript/commonjs/core/models/wire-mappers.d.ts.map +0 -1
- package/lib/typescript/commonjs/core/services/consent-presenter.d.ts +0 -67
- package/lib/typescript/commonjs/core/services/consent-presenter.d.ts.map +0 -1
- package/lib/typescript/commonjs/core/services/execute-resume-if-needed.d.ts +0 -32
- package/lib/typescript/commonjs/core/services/execute-resume-if-needed.d.ts.map +0 -1
- package/lib/typescript/commonjs/core/services/multi-payment-rules-presenter.d.ts +0 -9
- package/lib/typescript/commonjs/core/services/multi-payment-rules-presenter.d.ts.map +0 -1
- package/lib/typescript/commonjs/core/services/payment-flow-controller.d.ts +0 -146
- package/lib/typescript/commonjs/core/services/payment-flow-controller.d.ts.map +0 -1
- package/lib/typescript/commonjs/core/services/payment-flow-state.d.ts +0 -64
- package/lib/typescript/commonjs/core/services/payment-flow-state.d.ts.map +0 -1
- package/lib/typescript/commonjs/core/services/payment-result-mapper.d.ts +0 -5
- package/lib/typescript/commonjs/core/services/payment-result-mapper.d.ts.map +0 -1
- package/lib/typescript/commonjs/core/services/presentation-utils.d.ts +0 -5
- package/lib/typescript/commonjs/core/services/presentation-utils.d.ts.map +0 -1
- package/lib/typescript/commonjs/core/services/redirect-buffer.d.ts +0 -6
- package/lib/typescript/commonjs/core/services/redirect-buffer.d.ts.map +0 -1
- package/lib/typescript/commonjs/core/services/user-friendly-messages.d.ts +0 -6
- package/lib/typescript/commonjs/core/services/user-friendly-messages.d.ts.map +0 -1
- package/lib/typescript/commonjs/internal/telemetry-collector.d.ts +0 -2
- package/lib/typescript/commonjs/internal/telemetry-collector.d.ts.map +0 -1
- package/lib/typescript/commonjs/public/constants.d.ts +0 -12
- package/lib/typescript/commonjs/public/constants.d.ts.map +0 -1
- package/lib/typescript/commonjs/public/spare-link-callbacks.d.ts +0 -14
- package/lib/typescript/commonjs/public/spare-link-callbacks.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/consent/charge-bearer-display.d.ts +0 -5
- package/lib/typescript/commonjs/ui/consent/charge-bearer-display.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/consent/consent-accordion.d.ts +0 -10
- package/lib/typescript/commonjs/ui/consent/consent-accordion.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/consent/consent-summary-section.d.ts +0 -6
- package/lib/typescript/commonjs/ui/consent/consent-summary-section.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/consent/cop-information.d.ts +0 -6
- package/lib/typescript/commonjs/ui/consent/cop-information.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/consent/international-payment-summary.d.ts +0 -6
- package/lib/typescript/commonjs/ui/consent/international-payment-summary.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/consent/label-value-rows.d.ts +0 -10
- package/lib/typescript/commonjs/ui/consent/label-value-rows.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/consent/multi-payment-rules-list.d.ts +0 -15
- package/lib/typescript/commonjs/ui/consent/multi-payment-rules-list.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/consent/multi-payment-summary.d.ts +0 -6
- package/lib/typescript/commonjs/ui/consent/multi-payment-summary.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/consent/single-payment-summary.d.ts +0 -6
- package/lib/typescript/commonjs/ui/consent/single-payment-summary.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/consent/terms-link.d.ts +0 -2
- package/lib/typescript/commonjs/ui/consent/terms-link.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/hooks/use-payment-flow-state.d.ts +0 -9
- package/lib/typescript/commonjs/ui/hooks/use-payment-flow-state.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/payment-flow-page.d.ts +0 -20
- package/lib/typescript/commonjs/ui/payment-flow-page.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/screens/bank-selection-screen.d.ts +0 -15
- package/lib/typescript/commonjs/ui/screens/bank-selection-screen.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/screens/consent-details-screen.d.ts +0 -13
- package/lib/typescript/commonjs/ui/screens/consent-details-screen.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/screens/mandate-setup-success-screen.d.ts +0 -10
- package/lib/typescript/commonjs/ui/screens/mandate-setup-success-screen.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/widgets/layout-w-header.d.ts +0 -20
- package/lib/typescript/commonjs/ui/widgets/layout-w-header.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/widgets/stepper.d.ts +0 -15
- package/lib/typescript/commonjs/ui/widgets/stepper.d.ts.map +0 -1
- package/lib/typescript/module/core/client/link-api-client.d.ts +0 -70
- package/lib/typescript/module/core/client/link-api-client.d.ts.map +0 -1
- package/lib/typescript/module/core/errors/payment-api-error.d.ts +0 -15
- package/lib/typescript/module/core/errors/payment-api-error.d.ts.map +0 -1
- package/lib/typescript/module/core/models/link-session-status.d.ts +0 -6
- package/lib/typescript/module/core/models/link-session-status.d.ts.map +0 -1
- package/lib/typescript/module/core/models/payment-type.d.ts +0 -18
- package/lib/typescript/module/core/models/payment-type.d.ts.map +0 -1
- package/lib/typescript/module/core/models/wire-mappers.d.ts +0 -19
- package/lib/typescript/module/core/models/wire-mappers.d.ts.map +0 -1
- package/lib/typescript/module/core/services/consent-presenter.d.ts +0 -67
- package/lib/typescript/module/core/services/consent-presenter.d.ts.map +0 -1
- package/lib/typescript/module/core/services/execute-resume-if-needed.d.ts +0 -32
- package/lib/typescript/module/core/services/execute-resume-if-needed.d.ts.map +0 -1
- package/lib/typescript/module/core/services/multi-payment-rules-presenter.d.ts +0 -9
- package/lib/typescript/module/core/services/multi-payment-rules-presenter.d.ts.map +0 -1
- package/lib/typescript/module/core/services/payment-flow-controller.d.ts +0 -146
- package/lib/typescript/module/core/services/payment-flow-controller.d.ts.map +0 -1
- package/lib/typescript/module/core/services/payment-flow-state.d.ts +0 -64
- package/lib/typescript/module/core/services/payment-flow-state.d.ts.map +0 -1
- package/lib/typescript/module/core/services/payment-result-mapper.d.ts +0 -5
- package/lib/typescript/module/core/services/payment-result-mapper.d.ts.map +0 -1
- package/lib/typescript/module/core/services/presentation-utils.d.ts +0 -5
- package/lib/typescript/module/core/services/presentation-utils.d.ts.map +0 -1
- package/lib/typescript/module/core/services/redirect-buffer.d.ts +0 -6
- package/lib/typescript/module/core/services/redirect-buffer.d.ts.map +0 -1
- package/lib/typescript/module/core/services/user-friendly-messages.d.ts +0 -6
- package/lib/typescript/module/core/services/user-friendly-messages.d.ts.map +0 -1
- package/lib/typescript/module/internal/telemetry-collector.d.ts +0 -2
- package/lib/typescript/module/internal/telemetry-collector.d.ts.map +0 -1
- package/lib/typescript/module/public/constants.d.ts +0 -12
- package/lib/typescript/module/public/constants.d.ts.map +0 -1
- package/lib/typescript/module/public/spare-link-callbacks.d.ts +0 -14
- package/lib/typescript/module/public/spare-link-callbacks.d.ts.map +0 -1
- package/lib/typescript/module/ui/consent/charge-bearer-display.d.ts +0 -5
- package/lib/typescript/module/ui/consent/charge-bearer-display.d.ts.map +0 -1
- package/lib/typescript/module/ui/consent/consent-accordion.d.ts +0 -10
- package/lib/typescript/module/ui/consent/consent-accordion.d.ts.map +0 -1
- package/lib/typescript/module/ui/consent/consent-summary-section.d.ts +0 -6
- package/lib/typescript/module/ui/consent/consent-summary-section.d.ts.map +0 -1
- package/lib/typescript/module/ui/consent/cop-information.d.ts +0 -6
- package/lib/typescript/module/ui/consent/cop-information.d.ts.map +0 -1
- package/lib/typescript/module/ui/consent/international-payment-summary.d.ts +0 -6
- package/lib/typescript/module/ui/consent/international-payment-summary.d.ts.map +0 -1
- package/lib/typescript/module/ui/consent/label-value-rows.d.ts +0 -10
- package/lib/typescript/module/ui/consent/label-value-rows.d.ts.map +0 -1
- package/lib/typescript/module/ui/consent/multi-payment-rules-list.d.ts +0 -15
- package/lib/typescript/module/ui/consent/multi-payment-rules-list.d.ts.map +0 -1
- package/lib/typescript/module/ui/consent/multi-payment-summary.d.ts +0 -6
- package/lib/typescript/module/ui/consent/multi-payment-summary.d.ts.map +0 -1
- package/lib/typescript/module/ui/consent/single-payment-summary.d.ts +0 -6
- package/lib/typescript/module/ui/consent/single-payment-summary.d.ts.map +0 -1
- package/lib/typescript/module/ui/consent/terms-link.d.ts +0 -2
- package/lib/typescript/module/ui/consent/terms-link.d.ts.map +0 -1
- package/lib/typescript/module/ui/hooks/use-payment-flow-state.d.ts +0 -9
- package/lib/typescript/module/ui/hooks/use-payment-flow-state.d.ts.map +0 -1
- package/lib/typescript/module/ui/payment-flow-page.d.ts +0 -20
- package/lib/typescript/module/ui/payment-flow-page.d.ts.map +0 -1
- package/lib/typescript/module/ui/screens/bank-selection-screen.d.ts +0 -15
- package/lib/typescript/module/ui/screens/bank-selection-screen.d.ts.map +0 -1
- package/lib/typescript/module/ui/screens/consent-details-screen.d.ts +0 -13
- package/lib/typescript/module/ui/screens/consent-details-screen.d.ts.map +0 -1
- package/lib/typescript/module/ui/screens/mandate-setup-success-screen.d.ts +0 -10
- package/lib/typescript/module/ui/screens/mandate-setup-success-screen.d.ts.map +0 -1
- package/lib/typescript/module/ui/widgets/layout-w-header.d.ts +0 -20
- package/lib/typescript/module/ui/widgets/layout-w-header.d.ts.map +0 -1
- package/lib/typescript/module/ui/widgets/stepper.d.ts +0 -15
- package/lib/typescript/module/ui/widgets/stepper.d.ts.map +0 -1
- package/src/core/client/link-api-client.ts +0 -414
- package/src/core/errors/payment-api-error.ts +0 -35
- package/src/core/models/link-session-status.ts +0 -7
- package/src/core/models/payment-type.ts +0 -54
- package/src/core/models/wire-mappers.ts +0 -315
- package/src/core/services/consent-presenter.ts +0 -213
- package/src/core/services/execute-resume-if-needed.ts +0 -243
- package/src/core/services/multi-payment-rules-presenter.ts +0 -158
- package/src/core/services/payment-flow-controller.ts +0 -607
- package/src/core/services/payment-flow-state.ts +0 -124
- package/src/core/services/payment-result-mapper.ts +0 -41
- package/src/core/services/presentation-utils.ts +0 -4
- package/src/core/services/redirect-buffer.ts +0 -34
- package/src/core/services/user-friendly-messages.ts +0 -39
- package/src/internal/telemetry-collector.ts +0 -90
- package/src/public/constants.ts +0 -14
- package/src/public/spare-link-callbacks.ts +0 -20
- package/src/ui/consent/charge-bearer-display.tsx +0 -68
- package/src/ui/consent/consent-accordion.tsx +0 -89
- package/src/ui/consent/consent-summary-section.tsx +0 -19
- package/src/ui/consent/cop-information.tsx +0 -121
- package/src/ui/consent/international-payment-summary.tsx +0 -83
- package/src/ui/consent/label-value-rows.tsx +0 -50
- package/src/ui/consent/multi-payment-rules-list.tsx +0 -138
- package/src/ui/consent/multi-payment-summary.tsx +0 -82
- package/src/ui/consent/single-payment-summary.tsx +0 -123
- package/src/ui/consent/terms-link.tsx +0 -27
- package/src/ui/hooks/use-payment-flow-state.ts +0 -16
- package/src/ui/payment-flow-page.tsx +0 -254
- package/src/ui/screens/bank-selection-screen.tsx +0 -209
- package/src/ui/screens/consent-details-screen.tsx +0 -106
- package/src/ui/screens/mandate-setup-success-screen.tsx +0 -72
- package/src/ui/widgets/layout-w-header.tsx +0 -89
- package/src/ui/widgets/stepper.tsx +0 -126
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.MAX_RECOVERABLE_AGE_MS = void 0;
|
|
7
|
-
exports.executeResumeIfNeeded = executeResumeIfNeeded;
|
|
8
|
-
var _constants = require("../../public/constants.js");
|
|
9
|
-
var _paymentResult = require("../../public/payment-result.js");
|
|
10
|
-
var _spareLinkConfig = require("../../public/spare-link-config.js");
|
|
11
|
-
var _linkApiClient = require("../client/link-api-client.js");
|
|
12
|
-
var _paymentFlowController = require("./payment-flow-controller.js");
|
|
13
|
-
var _paymentResultMapper = require("./payment-result-mapper.js");
|
|
14
|
-
var _redirectBuffer = require("./redirect-buffer.js");
|
|
15
|
-
const MAX_RECOVERABLE_AGE_MS = exports.MAX_RECOVERABLE_AGE_MS = 30 * 60 * 1000;
|
|
16
|
-
function merchantRefFromUri(uri) {
|
|
17
|
-
try {
|
|
18
|
-
const value = new URL(uri).searchParams.get('merchantRef');
|
|
19
|
-
return value && value.length > 0 ? value : undefined;
|
|
20
|
-
} catch {
|
|
21
|
-
return undefined;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Requires a positive `merchantRef` bind between the buffered URI and the
|
|
27
|
-
* pending record — if either side lacks one we can't confirm the URI belongs
|
|
28
|
-
* to this session, so it must not be applied (a stale/unbound URI could
|
|
29
|
-
* otherwise attach to the wrong pending session).
|
|
30
|
-
*/
|
|
31
|
-
function bufferedUriMatchesRecord(uri, record) {
|
|
32
|
-
const uriMerchantRef = merchantRefFromUri(uri);
|
|
33
|
-
if (!record.merchantRef || !uriMerchantRef) return false;
|
|
34
|
-
return record.merchantRef === uriMerchantRef;
|
|
35
|
-
}
|
|
36
|
-
function createResumeApiClient(config) {
|
|
37
|
-
return new _linkApiClient.LinkApiClient({
|
|
38
|
-
baseUrl: config.baseUrl ?? (0, _spareLinkConfig.defaultBaseUrlFor)(config.environment),
|
|
39
|
-
tenant: (0, _spareLinkConfig.tenantCountryCode)(config.tenant),
|
|
40
|
-
...(config.fetch ? {
|
|
41
|
-
fetch: config.fetch
|
|
42
|
-
} : {}),
|
|
43
|
-
...(config.requestTimeoutMs !== undefined ? {
|
|
44
|
-
requestTimeoutMs: config.requestTimeoutMs
|
|
45
|
-
} : {})
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
function createRecoveryController(record, config, store, callbacks) {
|
|
49
|
-
return new _paymentFlowController.PaymentFlowController({
|
|
50
|
-
sessionToken: record.sessionId,
|
|
51
|
-
environment: config.environment,
|
|
52
|
-
apiClient: createResumeApiClient(config),
|
|
53
|
-
pendingSessionStore: store,
|
|
54
|
-
...(callbacks?.onEvent ? {
|
|
55
|
-
onEvent: callbacks.onEvent
|
|
56
|
-
} : {})
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
async function terminalFromBufferedUri(record, config, store, bufferedUri, callbacks) {
|
|
60
|
-
const controller = createRecoveryController(record, config, store, callbacks);
|
|
61
|
-
try {
|
|
62
|
-
controller.handleCallback(bufferedUri);
|
|
63
|
-
const result = (0, _paymentResultMapper.paymentResultFromFlowState)(controller.state, record.sessionId, record.selectedBankId);
|
|
64
|
-
if (result && (controller.state.phase === 'succeeded' || controller.state.phase === 'failed' || controller.state.phase === 'cancelled')) {
|
|
65
|
-
await store.clear();
|
|
66
|
-
return result;
|
|
67
|
-
}
|
|
68
|
-
return null;
|
|
69
|
-
} finally {
|
|
70
|
-
controller.dispose();
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Cold-start recovery orchestrator — mirrors Flutter `SpareLink.resumeIfNeeded`.
|
|
76
|
-
* Returns a terminal {@link PaymentResult}, `null` when nothing to do / still
|
|
77
|
-
* pending, and opens the recovery UI via `openRecoveryFlow` for non-terminal
|
|
78
|
-
* sessions that need user-visible awaiting state.
|
|
79
|
-
*/
|
|
80
|
-
async function executeResumeIfNeeded(args, deps) {
|
|
81
|
-
const {
|
|
82
|
-
pendingSessionStore: store
|
|
83
|
-
} = deps;
|
|
84
|
-
const now = deps.now ?? (() => Date.now());
|
|
85
|
-
if (deps.isFlowActive()) return null;
|
|
86
|
-
let record;
|
|
87
|
-
try {
|
|
88
|
-
record = await store.load();
|
|
89
|
-
} catch {
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
if (!record) return null;
|
|
93
|
-
if (record.consentAt !== undefined && now() - record.consentAt > MAX_RECOVERABLE_AGE_MS) {
|
|
94
|
-
await store.clear();
|
|
95
|
-
return (0, _paymentResult.paymentFailed)({
|
|
96
|
-
linkToken: record.sessionId,
|
|
97
|
-
errorCode: 'session_expired',
|
|
98
|
-
message: 'Pending session is older than the recovery window.',
|
|
99
|
-
resolvedAtMs: now()
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
if (record.recoveryAttempts >= _constants.kMaxRecoveryAttempts) {
|
|
103
|
-
await store.clear();
|
|
104
|
-
return (0, _paymentResult.paymentFailed)({
|
|
105
|
-
linkToken: record.sessionId,
|
|
106
|
-
errorCode: 'recovery_exhausted',
|
|
107
|
-
message: 'Maximum recovery attempts reached.',
|
|
108
|
-
resolvedAtMs: now()
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// Peek first — only consume the buffered URI once we've positively bound it
|
|
113
|
-
// to this record. On mismatch, leave it alone so a genuinely-matching
|
|
114
|
-
// session (checked on a later resume attempt) can still claim it.
|
|
115
|
-
const bufferedUri = (0, _redirectBuffer.peekBufferedRedirect)();
|
|
116
|
-
if (bufferedUri && bufferedUriMatchesRecord(bufferedUri, record)) {
|
|
117
|
-
(0, _redirectBuffer.consumeBufferedRedirect)();
|
|
118
|
-
return terminalFromBufferedUri(record, args.config, store, bufferedUri, args.callbacks);
|
|
119
|
-
}
|
|
120
|
-
const apiClient = createResumeApiClient(args.config);
|
|
121
|
-
try {
|
|
122
|
-
const status = await apiClient.getStatus(record.sessionId);
|
|
123
|
-
await store.save({
|
|
124
|
-
...record,
|
|
125
|
-
recoveryAttempts: record.recoveryAttempts + 1
|
|
126
|
-
});
|
|
127
|
-
switch (status.status) {
|
|
128
|
-
case 'completed':
|
|
129
|
-
await store.clear();
|
|
130
|
-
return (0, _paymentResult.paymentSuccess)({
|
|
131
|
-
linkToken: record.sessionId,
|
|
132
|
-
bankId: record.selectedBankId,
|
|
133
|
-
...(status.linkSessionId ? {
|
|
134
|
-
linkSessionId: status.linkSessionId
|
|
135
|
-
} : {}),
|
|
136
|
-
resolvedAtMs: now()
|
|
137
|
-
});
|
|
138
|
-
case 'failed':
|
|
139
|
-
await store.clear();
|
|
140
|
-
return (0, _paymentResult.paymentFailed)({
|
|
141
|
-
linkToken: record.sessionId,
|
|
142
|
-
errorCode: status.failureCode ?? 'session_failed',
|
|
143
|
-
resolvedAtMs: now()
|
|
144
|
-
});
|
|
145
|
-
case 'cancelled':
|
|
146
|
-
await store.clear();
|
|
147
|
-
return (0, _paymentResult.paymentCancelled)({
|
|
148
|
-
linkToken: record.sessionId,
|
|
149
|
-
bankId: record.selectedBankId,
|
|
150
|
-
resolvedAtMs: now()
|
|
151
|
-
});
|
|
152
|
-
case 'expired':
|
|
153
|
-
await store.clear();
|
|
154
|
-
return (0, _paymentResult.paymentFailed)({
|
|
155
|
-
linkToken: record.sessionId,
|
|
156
|
-
errorCode: 'session_expired',
|
|
157
|
-
resolvedAtMs: now()
|
|
158
|
-
});
|
|
159
|
-
default:
|
|
160
|
-
{
|
|
161
|
-
const controller = createRecoveryController(record, args.config, store, args.callbacks);
|
|
162
|
-
// Hydrate so `state.session` (payment type, mandate details) is
|
|
163
|
-
// available to the recovery UI and threaded into the terminal
|
|
164
|
-
// PaymentResult — without this, resume paths skip the mandate
|
|
165
|
-
// setup-success screen and drop `paymentType` on success.
|
|
166
|
-
await controller.hydrate().catch(() => {
|
|
167
|
-
/* best-effort — recovery still proceeds without session details */
|
|
168
|
-
});
|
|
169
|
-
controller.setAwaitingCallbackState({
|
|
170
|
-
providerName: record.selectedBankId
|
|
171
|
-
});
|
|
172
|
-
deps.openRecoveryFlow({
|
|
173
|
-
controller,
|
|
174
|
-
config: {
|
|
175
|
-
...args.config,
|
|
176
|
-
linkToken: record.sessionId
|
|
177
|
-
},
|
|
178
|
-
...(args.callbacks ? {
|
|
179
|
-
callbacks: args.callbacks
|
|
180
|
-
} : {})
|
|
181
|
-
});
|
|
182
|
-
return null;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
} catch {
|
|
186
|
-
const controller = createRecoveryController(record, args.config, store, args.callbacks);
|
|
187
|
-
await controller.hydrate().catch(() => {
|
|
188
|
-
/* best-effort — recovery still proceeds without session details */
|
|
189
|
-
});
|
|
190
|
-
controller.setAwaitingCallbackState({
|
|
191
|
-
providerName: record.selectedBankId
|
|
192
|
-
});
|
|
193
|
-
try {
|
|
194
|
-
await store.save({
|
|
195
|
-
...record,
|
|
196
|
-
recoveryAttempts: record.recoveryAttempts + 1
|
|
197
|
-
});
|
|
198
|
-
} catch {
|
|
199
|
-
/* swallow */
|
|
200
|
-
}
|
|
201
|
-
deps.openRecoveryFlow({
|
|
202
|
-
controller,
|
|
203
|
-
config: {
|
|
204
|
-
...args.config,
|
|
205
|
-
linkToken: record.sessionId
|
|
206
|
-
},
|
|
207
|
-
...(args.callbacks ? {
|
|
208
|
-
callbacks: args.callbacks
|
|
209
|
-
} : {})
|
|
210
|
-
});
|
|
211
|
-
return null;
|
|
212
|
-
} finally {
|
|
213
|
-
apiClient.dispose();
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
//# sourceMappingURL=execute-resume-if-needed.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_constants","require","_paymentResult","_spareLinkConfig","_linkApiClient","_paymentFlowController","_paymentResultMapper","_redirectBuffer","MAX_RECOVERABLE_AGE_MS","exports","merchantRefFromUri","uri","value","URL","searchParams","get","length","undefined","bufferedUriMatchesRecord","record","uriMerchantRef","merchantRef","createResumeApiClient","config","LinkApiClient","baseUrl","defaultBaseUrlFor","environment","tenant","tenantCountryCode","fetch","requestTimeoutMs","createRecoveryController","store","callbacks","PaymentFlowController","sessionToken","sessionId","apiClient","pendingSessionStore","onEvent","terminalFromBufferedUri","bufferedUri","controller","handleCallback","result","paymentResultFromFlowState","state","selectedBankId","phase","clear","dispose","executeResumeIfNeeded","args","deps","now","Date","isFlowActive","load","consentAt","paymentFailed","linkToken","errorCode","message","resolvedAtMs","recoveryAttempts","kMaxRecoveryAttempts","peekBufferedRedirect","consumeBufferedRedirect","status","getStatus","save","paymentSuccess","bankId","linkSessionId","failureCode","paymentCancelled","hydrate","catch","setAwaitingCallbackState","providerName","openRecoveryFlow"],"sourceRoot":"../../../../src","sources":["core/services/execute-resume-if-needed.ts"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AAEA,IAAAE,gBAAA,GAAAF,OAAA;AAKA,IAAAG,cAAA,GAAAH,OAAA;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sC,IAAI,CAAC;QACf,GAAGpD,MAAM;QACT8C,gBAAgB,EAAE9C,MAAM,CAAC8C,gBAAgB,GAAG;MAC9C,CAAC,CAAC;IACJ,CAAC,CAAC,MAAM;MACN;IAAA;IAEFX,IAAI,CAAC2B,gBAAgB,CAAC;MACpBtC,UAAU;MACVpB,MAAM,EAAE;QAAE,GAAG8B,IAAI,CAAC9B,MAAM;QAAEsC,SAAS,EAAE1C,MAAM,CAACkB;MAAU,CAAC;MACvD,IAAIgB,IAAI,CAACnB,SAAS,GAAG;QAAEA,SAAS,EAAEmB,IAAI,CAACnB;MAAU,CAAC,GAAG,CAAC,CAAC;IACzD,CAAC,CAAC;IACF,OAAO,IAAI;EACb,CAAC,SAAS;IACRI,SAAS,CAACa,OAAO,CAAC,CAAC;EACrB;AACF","ignoreList":[]}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.buildMultiPaymentRules = buildMultiPaymentRules;
|
|
7
|
-
exports.rulesSectionTitle = rulesSectionTitle;
|
|
8
|
-
var _paymentType = require("../models/payment-type.js");
|
|
9
|
-
var _presentationUtils = require("./presentation-utils.js");
|
|
10
|
-
function present(value, fallback = '—') {
|
|
11
|
-
const v = value?.trim();
|
|
12
|
-
return v ? v : fallback;
|
|
13
|
-
}
|
|
14
|
-
function presentInt(value, fallback = '—') {
|
|
15
|
-
if (value === undefined) return fallback;
|
|
16
|
-
return String(value);
|
|
17
|
-
}
|
|
18
|
-
function formatDate(raw) {
|
|
19
|
-
if (!raw?.trim()) return '—';
|
|
20
|
-
const parsed = new Date(raw.trim());
|
|
21
|
-
if (Number.isNaN(parsed.getTime())) return raw.trim();
|
|
22
|
-
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
23
|
-
const day = String(parsed.getUTCDate()).padStart(2, '0');
|
|
24
|
-
const month = months[parsed.getUTCMonth()];
|
|
25
|
-
return `${day} ${month} ${parsed.getUTCFullYear()}`;
|
|
26
|
-
}
|
|
27
|
-
function definedSchedule(type, instructions) {
|
|
28
|
-
const isFixed = type === _paymentType.PaymentType.fixedDefinedSchedule;
|
|
29
|
-
const amountLabel = isFixed ? 'Amount' : 'Max Amount';
|
|
30
|
-
const schedule = instructions.paymentSchedule ?? [];
|
|
31
|
-
const rows = [];
|
|
32
|
-
for (const entry of schedule) {
|
|
33
|
-
const amountDto = isFixed ? entry.amount : entry.maxAmount;
|
|
34
|
-
rows.push({
|
|
35
|
-
label: amountLabel,
|
|
36
|
-
value: (0, _presentationUtils.formatAmount)(amountDto)
|
|
37
|
-
});
|
|
38
|
-
rows.push({
|
|
39
|
-
label: 'Date',
|
|
40
|
-
value: formatDate(entry.paymentExecutionDate)
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
return rows;
|
|
44
|
-
}
|
|
45
|
-
function periodicSchedule(type, instructions) {
|
|
46
|
-
const isFixed = type === _paymentType.PaymentType.fixedPeriodicSchedule;
|
|
47
|
-
const periodic = instructions.periodicSchedule;
|
|
48
|
-
const amountDto = isFixed ? periodic?.amount : periodic?.maxAmount;
|
|
49
|
-
const amountLabel = isFixed ? 'Amount' : 'Max per Payment';
|
|
50
|
-
const rows = [{
|
|
51
|
-
label: amountLabel,
|
|
52
|
-
value: (0, _presentationUtils.formatAmount)(amountDto)
|
|
53
|
-
}, {
|
|
54
|
-
label: 'First Payment Date',
|
|
55
|
-
value: formatDate(periodic?.startDate)
|
|
56
|
-
}, {
|
|
57
|
-
label: 'Payment repeats every',
|
|
58
|
-
value: present(periodic?.frequency)
|
|
59
|
-
}, {
|
|
60
|
-
label: 'Stop payment on',
|
|
61
|
-
value: formatDate(periodic?.endDate)
|
|
62
|
-
}, {
|
|
63
|
-
label: 'Total number of payments',
|
|
64
|
-
value: presentInt(instructions.maxCumulativeNumberOfPayments)
|
|
65
|
-
}];
|
|
66
|
-
if (!isFixed) {
|
|
67
|
-
rows.push({
|
|
68
|
-
label: 'Total Value Allowed',
|
|
69
|
-
value: (0, _presentationUtils.formatAmount)(instructions.maxCumulativeAmount)
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
return rows;
|
|
73
|
-
}
|
|
74
|
-
function fixedOnDemand(instructions) {
|
|
75
|
-
const periodic = instructions.periodicSchedule;
|
|
76
|
-
const frequency = periodic?.frequency;
|
|
77
|
-
return [{
|
|
78
|
-
label: 'Amount',
|
|
79
|
-
value: (0, _presentationUtils.formatAmount)(periodic?.amount)
|
|
80
|
-
}, {
|
|
81
|
-
label: 'Total number of payments allowed',
|
|
82
|
-
value: presentInt(instructions.maxCumulativeNumberOfPayments)
|
|
83
|
-
}, {
|
|
84
|
-
label: 'Total Value Allowed',
|
|
85
|
-
value: (0, _presentationUtils.formatAmount)(instructions.maxCumulativeAmount)
|
|
86
|
-
}, {
|
|
87
|
-
label: 'Limits Every',
|
|
88
|
-
value: present(frequency)
|
|
89
|
-
}, {
|
|
90
|
-
label: `Max Value per ${present(frequency)}`,
|
|
91
|
-
value: (0, _presentationUtils.formatAmount)(periodic?.controls?.maxCumulativeAmountPerPeriod)
|
|
92
|
-
}, {
|
|
93
|
-
label: `Max Payments per ${present(frequency)}`,
|
|
94
|
-
value: presentInt(periodic?.controls?.maxCumulativeNumberOfPaymentsPerPeriod)
|
|
95
|
-
}, {
|
|
96
|
-
label: 'Expiry Date',
|
|
97
|
-
value: formatDate(periodic?.endDate)
|
|
98
|
-
}];
|
|
99
|
-
}
|
|
100
|
-
function variableOnDemand(instructions) {
|
|
101
|
-
const periodic = instructions.periodicSchedule;
|
|
102
|
-
const frequency = periodic?.frequency;
|
|
103
|
-
return [{
|
|
104
|
-
label: 'First Payment Date',
|
|
105
|
-
value: formatDate(periodic?.startDate)
|
|
106
|
-
}, {
|
|
107
|
-
label: 'Expiry Date',
|
|
108
|
-
value: formatDate(periodic?.endDate)
|
|
109
|
-
}, {
|
|
110
|
-
label: 'Max per Payment',
|
|
111
|
-
value: (0, _presentationUtils.formatAmount)(periodic?.maxAmount)
|
|
112
|
-
}, {
|
|
113
|
-
label: 'Total number of payments allowed',
|
|
114
|
-
value: presentInt(instructions.maxCumulativeNumberOfPayments)
|
|
115
|
-
}, {
|
|
116
|
-
label: 'Total Value Allowed',
|
|
117
|
-
value: (0, _presentationUtils.formatAmount)(instructions.maxCumulativeAmount)
|
|
118
|
-
}, {
|
|
119
|
-
label: 'Limits Every',
|
|
120
|
-
value: present(frequency)
|
|
121
|
-
}, {
|
|
122
|
-
label: `Max Value per ${present(frequency)}`,
|
|
123
|
-
value: (0, _presentationUtils.formatAmount)(periodic?.controls?.maxCumulativeAmountPerPeriod)
|
|
124
|
-
}, {
|
|
125
|
-
label: `Max Payments per ${present(frequency)}`,
|
|
126
|
-
value: presentInt(periodic?.controls?.maxCumulativeNumberOfPaymentsPerPeriod)
|
|
127
|
-
}];
|
|
128
|
-
}
|
|
129
|
-
function buildMultiPaymentRules(type, instructions) {
|
|
130
|
-
switch (type) {
|
|
131
|
-
case _paymentType.PaymentType.fixedDefinedSchedule:
|
|
132
|
-
case _paymentType.PaymentType.variableDefinedSchedule:
|
|
133
|
-
return definedSchedule(type, instructions);
|
|
134
|
-
case _paymentType.PaymentType.fixedPeriodicSchedule:
|
|
135
|
-
case _paymentType.PaymentType.variablePeriodicSchedule:
|
|
136
|
-
return periodicSchedule(type, instructions);
|
|
137
|
-
case _paymentType.PaymentType.fixedOnDemand:
|
|
138
|
-
return fixedOnDemand(instructions);
|
|
139
|
-
case _paymentType.PaymentType.variableOnDemand:
|
|
140
|
-
return variableOnDemand(instructions);
|
|
141
|
-
default:
|
|
142
|
-
return [];
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
function rulesSectionTitle(type) {
|
|
146
|
-
if (type === _paymentType.PaymentType.fixedDefinedSchedule || type === _paymentType.PaymentType.variableDefinedSchedule) {
|
|
147
|
-
return 'Payment schedule';
|
|
148
|
-
}
|
|
149
|
-
return 'Payment rules';
|
|
150
|
-
}
|
|
151
|
-
//# sourceMappingURL=multi-payment-rules-presenter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_paymentType","require","_presentationUtils","present","value","fallback","v","trim","presentInt","undefined","String","formatDate","raw","parsed","Date","Number","isNaN","getTime","months","day","getUTCDate","padStart","month","getUTCMonth","getUTCFullYear","definedSchedule","type","instructions","isFixed","PaymentType","fixedDefinedSchedule","amountLabel","schedule","paymentSchedule","rows","entry","amountDto","amount","maxAmount","push","label","formatAmount","paymentExecutionDate","periodicSchedule","fixedPeriodicSchedule","periodic","startDate","frequency","endDate","maxCumulativeNumberOfPayments","maxCumulativeAmount","fixedOnDemand","controls","maxCumulativeAmountPerPeriod","maxCumulativeNumberOfPaymentsPerPeriod","variableOnDemand","buildMultiPaymentRules","variableDefinedSchedule","variablePeriodicSchedule","rulesSectionTitle"],"sourceRoot":"../../../../src","sources":["core/services/multi-payment-rules-presenter.ts"],"mappings":";;;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAOA,SAASE,OAAOA,CAACC,KAAyB,EAAEC,QAAQ,GAAG,GAAG,EAAU;EAClE,MAAMC,CAAC,GAAGF,KAAK,EAAEG,IAAI,CAAC,CAAC;EACvB,OAAOD,CAAC,GAAGA,CAAC,GAAGD,QAAQ;AACzB;AAEA,SAASG,UAAUA,CAACJ,KAAyB,EAAEC,QAAQ,GAAG,GAAG,EAAU;EACrE,IAAID,KAAK,KAAKK,SAAS,EAAE,OAAOJ,QAAQ;EACxC,OAAOK,MAAM,CAACN,KAAK,CAAC;AACtB;AAEA,SAASO,UAAUA,CAACC,GAAuB,EAAU;EACnD,IAAI,CAACA,GAAG,EAAEL,IAAI,CAAC,CAAC,EAAE,OAAO,GAAG;EAC5B,MAAMM,MAAM,GAAG,IAAIC,IAAI,CAACF,GA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