@frankieone/one-sdk 1.9.42 → 1.10.0-rc

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/dist/commit.txt +1 -1
  2. package/dist/esm/modules/biometrics/vendors/Daon/index.d.ts +1 -1
  3. package/dist/esm/modules/biometrics/vendors/Onfido/onfido.init.d.ts +3 -1
  4. package/dist/esm/modules/biometrics/vendors/Onfido/onfido.init.d.ts.map +1 -1
  5. package/dist/esm/modules/biometrics/vendors/Onfido/onfido.init.js +15 -2
  6. package/dist/esm/modules/biometrics/vendors/Onfido/onfido.init.js.map +1 -1
  7. package/dist/esm/modules/biometrics/vendors/Onfido/onfidoLegacy.init.d.ts +3 -1
  8. package/dist/esm/modules/biometrics/vendors/Onfido/onfidoLegacy.init.d.ts.map +1 -1
  9. package/dist/esm/modules/biometrics/vendors/Onfido/onfidoLegacy.init.js +15 -2
  10. package/dist/esm/modules/biometrics/vendors/Onfido/onfidoLegacy.init.js.map +1 -1
  11. package/dist/esm/modules/biometrics/vendors/Onfido/shared.d.ts +7 -0
  12. package/dist/esm/modules/biometrics/vendors/Onfido/shared.d.ts.map +1 -1
  13. package/dist/esm/modules/biometrics/vendors/Onfido/shared.js +20 -5
  14. package/dist/esm/modules/biometrics/vendors/Onfido/shared.js.map +1 -1
  15. package/dist/esm/modules/common/shared/utils/fetchCheckProcessingStatus.d.ts.map +1 -1
  16. package/dist/esm/modules/common/shared/utils/fetchCheckProcessingStatus.js +6 -2
  17. package/dist/esm/modules/common/shared/utils/fetchCheckProcessingStatus.js.map +1 -1
  18. package/dist/esm/modules/common/vendors/common/iframeUtils/createIframe.d.ts.map +1 -1
  19. package/dist/esm/modules/common/vendors/common/iframeUtils/createIframe.js +5 -2
  20. package/dist/esm/modules/common/vendors/common/iframeUtils/createIframe.js.map +1 -1
  21. package/dist/esm/modules/common/vendors/common/iframeUtils/createIframeEventListener.d.ts +11 -0
  22. package/dist/esm/modules/common/vendors/common/iframeUtils/createIframeEventListener.d.ts.map +1 -1
  23. package/dist/esm/modules/common/vendors/common/iframeUtils/createIframeEventListener.js +1 -0
  24. package/dist/esm/modules/common/vendors/common/iframeUtils/createIframeEventListener.js.map +1 -1
  25. package/dist/esm/modules/common/vendors/daon/mapMessageToEvent.d.ts.map +1 -1
  26. package/dist/esm/modules/common/vendors/daon/mapMessageToEvent.js +18 -3
  27. package/dist/esm/modules/common/vendors/daon/mapMessageToEvent.js.map +1 -1
  28. package/dist/esm/modules/form/vendors/react/components/base/FrankieLoader/FrankieLoader.d.ts.map +1 -1
  29. package/dist/esm/modules/form/vendors/react/components/base/FrankieLoader/FrankieLoader.js +1 -1
  30. package/dist/esm/modules/form/vendors/react/components/base/FrankieLoader/FrankieLoader.js.map +1 -1
  31. package/dist/esm/modules/form/vendors/react/components/view/Progress/Progress.d.ts.map +1 -1
  32. package/dist/esm/modules/form/vendors/react/components/view/Progress/Progress.js +1 -1
  33. package/dist/esm/modules/form/vendors/react/components/view/Progress/Progress.js.map +1 -1
  34. package/dist/esm/modules/form/vendors/react/features/PersonalDetails/personalDetails.config.d.ts +585 -585
  35. package/dist/esm/modules/form/vendors/react/features/PersonalDetails/personalDetails.config.d.ts.map +1 -1
  36. package/dist/esm/modules/form/vendors/react/index.js +15 -0
  37. package/dist/esm/modules/form/vendors/react/index.js.map +1 -1
  38. package/dist/esm/modules/frankie-client/clients/F2/IDVClientF2.d.ts +4 -4
  39. package/dist/esm/modules/frankie-client/clients/F2/IDVClientF2.d.ts.map +1 -1
  40. package/dist/esm/modules/frankie-client/clients/F2/IDVClientF2.js.map +1 -1
  41. package/dist/esm/modules/frankie-client/clients/IDVClient.d.ts +4 -4
  42. package/dist/esm/modules/frankie-client/clients/IDVClient.d.ts.map +1 -1
  43. package/dist/esm/modules/frankie-client/clients/IDVClient.js.map +1 -1
  44. package/dist/esm/modules/idv/actions/mount.d.ts +9 -0
  45. package/dist/esm/modules/idv/actions/mount.d.ts.map +1 -1
  46. package/dist/esm/modules/idv/actions/mount.js +3 -1
  47. package/dist/esm/modules/idv/actions/mount.js.map +1 -1
  48. package/dist/esm/modules/idv/index.d.ts.map +1 -1
  49. package/dist/esm/modules/idv/index.js +17 -2
  50. package/dist/esm/modules/idv/index.js.map +1 -1
  51. package/dist/esm/modules/idv/vendors/Daon/index.d.ts +1 -1
  52. package/dist/esm/modules/idv/vendors/Incode/index.d.ts +1 -1
  53. package/dist/esm/modules/idv/vendors/Mastercard/index.d.ts +1 -1
  54. package/dist/esm/modules/idv/vendors/OcrLabs/index.d.ts +1 -1
  55. package/dist/esm/modules/idv/vendors/Onfido/index.d.ts +1 -1
  56. package/dist/esm/modules/idv/vendors/Onfido/index.d.ts.map +1 -1
  57. package/dist/esm/modules/idv/vendors/Onfido/index.js +20 -2
  58. package/dist/esm/modules/idv/vendors/Onfido/index.js.map +1 -1
  59. package/dist/esm/modules/idv/vendors/Onfido/index.useOneStep.d.ts +3 -1
  60. package/dist/esm/modules/idv/vendors/Onfido/index.useOneStep.d.ts.map +1 -1
  61. package/dist/esm/modules/idv/vendors/Onfido/index.useOneStep.js +15 -2
  62. package/dist/esm/modules/idv/vendors/Onfido/index.useOneStep.js.map +1 -1
  63. package/dist/esm/modules/idv/vendors/Sumsub/index.d.ts +1 -1
  64. package/dist/esm/modules/idv/vendors/Truuth/index.d.ts +1 -1
  65. package/dist/esm/modules/idv/vendors/Truuth/index.d.ts.map +1 -1
  66. package/dist/esm/modules/idv/vendors/Truuth/index.js +13 -1
  67. package/dist/esm/modules/idv/vendors/Truuth/index.js.map +1 -1
  68. package/dist/esm/modules/idv/vendors/common/iframeUtils/defineIframeIDVWrapper.d.ts +1 -1
  69. package/dist/esm/modules/idv/vendors/common/iframeUtils/defineIframeIDVWrapper.d.ts.map +1 -1
  70. package/dist/esm/modules/idv/vendors/common/iframeUtils/defineIframeIDVWrapper.js +19 -1
  71. package/dist/esm/modules/idv/vendors/common/iframeUtils/defineIframeIDVWrapper.js.map +1 -1
  72. package/dist/esm/modules/index.d.ts +2 -0
  73. package/dist/esm/modules/index.d.ts.map +1 -1
  74. package/dist/esm/modules/index.js +1 -0
  75. package/dist/esm/modules/index.js.map +1 -1
  76. package/dist/esm/modules/journey/classify/classify.d.ts +8 -0
  77. package/dist/esm/modules/journey/classify/classify.d.ts.map +1 -0
  78. package/dist/esm/modules/journey/classify/classify.js +105 -0
  79. package/dist/esm/modules/journey/classify/classify.js.map +1 -0
  80. package/dist/esm/modules/journey/classify/transportError.d.ts +24 -0
  81. package/dist/esm/modules/journey/classify/transportError.d.ts.map +1 -0
  82. package/dist/esm/modules/journey/classify/transportError.js +35 -0
  83. package/dist/esm/modules/journey/classify/transportError.js.map +1 -0
  84. package/dist/esm/modules/journey/classify/v1Status.d.ts +24 -0
  85. package/dist/esm/modules/journey/classify/v1Status.d.ts.map +1 -0
  86. package/dist/esm/modules/journey/classify/v1Status.js +43 -0
  87. package/dist/esm/modules/journey/classify/v1Status.js.map +1 -0
  88. package/dist/esm/modules/journey/flows/ekycFlow.d.ts +38 -0
  89. package/dist/esm/modules/journey/flows/ekycFlow.d.ts.map +1 -0
  90. package/dist/esm/modules/journey/flows/ekycFlow.js +179 -0
  91. package/dist/esm/modules/journey/flows/ekycFlow.js.map +1 -0
  92. package/dist/esm/modules/journey/flows/idvFlow.d.ts +32 -0
  93. package/dist/esm/modules/journey/flows/idvFlow.d.ts.map +1 -0
  94. package/dist/esm/modules/journey/flows/idvFlow.js +509 -0
  95. package/dist/esm/modules/journey/flows/idvFlow.js.map +1 -0
  96. package/dist/esm/modules/journey/flows/ocrFlow.d.ts +27 -0
  97. package/dist/esm/modules/journey/flows/ocrFlow.d.ts.map +1 -0
  98. package/dist/esm/modules/journey/flows/ocrFlow.js +434 -0
  99. package/dist/esm/modules/journey/flows/ocrFlow.js.map +1 -0
  100. package/dist/esm/modules/journey/flows/screenSequence.d.ts +127 -0
  101. package/dist/esm/modules/journey/flows/screenSequence.d.ts.map +1 -0
  102. package/dist/esm/modules/journey/flows/screenSequence.js +418 -0
  103. package/dist/esm/modules/journey/flows/screenSequence.js.map +1 -0
  104. package/dist/esm/modules/journey/flows/submitAndClassify.d.ts +32 -0
  105. package/dist/esm/modules/journey/flows/submitAndClassify.d.ts.map +1 -0
  106. package/dist/esm/modules/journey/flows/submitAndClassify.js +101 -0
  107. package/dist/esm/modules/journey/flows/submitAndClassify.js.map +1 -0
  108. package/dist/esm/modules/journey/index.d.ts +34 -0
  109. package/dist/esm/modules/journey/index.d.ts.map +1 -0
  110. package/dist/esm/modules/journey/index.js +183 -0
  111. package/dist/esm/modules/journey/index.js.map +1 -0
  112. package/dist/esm/modules/journey/journeyHandle.d.ts +35 -0
  113. package/dist/esm/modules/journey/journeyHandle.d.ts.map +1 -0
  114. package/dist/esm/modules/journey/journeyHandle.js +130 -0
  115. package/dist/esm/modules/journey/journeyHandle.js.map +1 -0
  116. package/dist/esm/modules/journey/screens/ctaConfig.d.ts +2 -0
  117. package/dist/esm/modules/journey/screens/ctaConfig.d.ts.map +1 -0
  118. package/dist/esm/modules/journey/screens/ctaConfig.js +23 -0
  119. package/dist/esm/modules/journey/screens/ctaConfig.js.map +1 -0
  120. package/dist/esm/modules/journey/screens/resultScreen.d.ts +21 -0
  121. package/dist/esm/modules/journey/screens/resultScreen.d.ts.map +1 -0
  122. package/dist/esm/modules/journey/screens/resultScreen.js +108 -0
  123. package/dist/esm/modules/journey/screens/resultScreen.js.map +1 -0
  124. package/dist/esm/modules/journey/simulate/fixtures.d.ts +9 -0
  125. package/dist/esm/modules/journey/simulate/fixtures.d.ts.map +1 -0
  126. package/dist/esm/modules/journey/simulate/fixtures.js +41 -0
  127. package/dist/esm/modules/journey/simulate/fixtures.js.map +1 -0
  128. package/dist/esm/modules/journey/steps/firstPaint.d.ts +43 -0
  129. package/dist/esm/modules/journey/steps/firstPaint.d.ts.map +1 -0
  130. package/dist/esm/modules/journey/steps/firstPaint.js +28 -0
  131. package/dist/esm/modules/journey/steps/firstPaint.js.map +1 -0
  132. package/dist/esm/modules/journey/steps/stepMachine.d.ts +52 -0
  133. package/dist/esm/modules/journey/steps/stepMachine.d.ts.map +1 -0
  134. package/dist/esm/modules/journey/steps/stepMachine.js +90 -0
  135. package/dist/esm/modules/journey/steps/stepMachine.js.map +1 -0
  136. package/dist/esm/modules/journey/steps/stepTable.d.ts +234 -0
  137. package/dist/esm/modules/journey/steps/stepTable.d.ts.map +1 -0
  138. package/dist/esm/modules/journey/steps/stepTable.js +241 -0
  139. package/dist/esm/modules/journey/steps/stepTable.js.map +1 -0
  140. package/dist/esm/modules/journey/theme/applyTheme.d.ts +17 -0
  141. package/dist/esm/modules/journey/theme/applyTheme.d.ts.map +1 -0
  142. package/dist/esm/modules/journey/theme/applyTheme.js +49 -0
  143. package/dist/esm/modules/journey/theme/applyTheme.js.map +1 -0
  144. package/dist/esm/modules/journey/types/classification.d.ts +10 -0
  145. package/dist/esm/modules/journey/types/classification.d.ts.map +1 -0
  146. package/dist/esm/modules/journey/types/classification.js +2 -0
  147. package/dist/esm/modules/journey/types/classification.js.map +1 -0
  148. package/dist/esm/modules/journey/types/classifierInput.d.ts +45 -0
  149. package/dist/esm/modules/journey/types/classifierInput.d.ts.map +1 -0
  150. package/dist/esm/modules/journey/types/classifierInput.js +2 -0
  151. package/dist/esm/modules/journey/types/classifierInput.js.map +1 -0
  152. package/dist/esm/modules/journey/types/contract.d.ts +60 -0
  153. package/dist/esm/modules/journey/types/contract.d.ts.map +1 -0
  154. package/dist/esm/modules/journey/types/contract.js +7 -0
  155. package/dist/esm/modules/journey/types/contract.js.map +1 -0
  156. package/dist/esm/modules/journey/types/resultConfig.d.ts +23 -0
  157. package/dist/esm/modules/journey/types/resultConfig.d.ts.map +1 -0
  158. package/dist/esm/modules/journey/types/resultConfig.js +2 -0
  159. package/dist/esm/modules/journey/types/resultConfig.js.map +1 -0
  160. package/dist/esm/modules/meta.json +1 -1
  161. package/dist/esm/modules/ocr/vendors/Daon/index.d.ts +1 -1
  162. package/dist/esm/modules/ocr/vendors/Onfido/onfido.init.d.ts +3 -1
  163. package/dist/esm/modules/ocr/vendors/Onfido/onfido.init.d.ts.map +1 -1
  164. package/dist/esm/modules/ocr/vendors/Onfido/onfido.init.js +15 -2
  165. package/dist/esm/modules/ocr/vendors/Onfido/onfido.init.js.map +1 -1
  166. package/dist/esm/modules/ocr/vendors/Onfido/onfidoLegacy.init.d.ts +3 -1
  167. package/dist/esm/modules/ocr/vendors/Onfido/onfidoLegacy.init.d.ts.map +1 -1
  168. package/dist/esm/modules/ocr/vendors/Onfido/onfidoLegacy.init.js +15 -2
  169. package/dist/esm/modules/ocr/vendors/Onfido/onfidoLegacy.init.js.map +1 -1
  170. package/dist/esm/modules/ocr/vendors/Onfido/shared.d.ts +17 -0
  171. package/dist/esm/modules/ocr/vendors/Onfido/shared.d.ts.map +1 -1
  172. package/dist/esm/modules/ocr/vendors/Onfido/shared.js +33 -5
  173. package/dist/esm/modules/ocr/vendors/Onfido/shared.js.map +1 -1
  174. package/dist/esm/modules/sdk/index.d.ts.map +1 -1
  175. package/dist/esm/modules/sdk/index.js +5 -1
  176. package/dist/esm/modules/sdk/index.js.map +1 -1
  177. package/dist/esm/modules/sdk/types/globalEvents.d.ts +13 -0
  178. package/dist/esm/modules/sdk/types/globalEvents.d.ts.map +1 -1
  179. package/dist/esm/modules/sdk/types/oneSDK.d.ts +1 -0
  180. package/dist/esm/modules/sdk/types/oneSDK.d.ts.map +1 -1
  181. package/dist/esm/styles/f1-style.css +1 -1
  182. package/dist/release.txt +1 -1
  183. package/dist/version.txt +1 -1
  184. package/package.json +1 -1
@@ -0,0 +1,183 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { OneSDKError } from '../common/index.js';
11
+ import { mkEkycStepRunner } from './flows/ekycFlow.js';
12
+ import { mkIdvStepRunner } from './flows/idvFlow.js';
13
+ import { mkOcrStepRunner } from './flows/ocrFlow.js';
14
+ import { mkJourneyHandle } from './journeyHandle.js';
15
+ import { mkResultScreen } from './screens/resultScreen.js';
16
+ import { resolveSimulation } from './simulate/fixtures.js';
17
+ import { mkFirstPaintSignal } from './steps/firstPaint.js';
18
+ import { mkStepMachine } from './steps/stepMachine.js';
19
+ import { applyTheme } from './theme/applyTheme.js';
20
+ import { JourneyName } from './types/contract.js';
21
+ /** one step-runner factory per shipped journey — keeps `mkJourney` from growing a branch per flow */
22
+ const STEP_RUNNER_FACTORY = {
23
+ [JourneyName.IDV]: mkIdvStepRunner,
24
+ [JourneyName.OCR]: mkOcrStepRunner,
25
+ [JourneyName.EKYC]: mkEkycStepRunner,
26
+ };
27
+ /**
28
+ * Read the pointers at settlement, not at construction. A brand new applicant
29
+ * has no `entityId` until `search()`/`submit()` has run, so a snapshot taken
30
+ * when the handle is built reports `null` for every first-time journey. Guarded
31
+ * because `finalise()` runs on the settlement path — spec D9 requires it never
32
+ * to throw.
33
+ */
34
+ const resolveRef = (oneSdk) => {
35
+ var _a;
36
+ try {
37
+ return {
38
+ entityId: (_a = oneSdk.individual().access('entityId').getValue()) !== null && _a !== void 0 ? _a : null,
39
+ };
40
+ }
41
+ catch (_b) {
42
+ return { entityId: null };
43
+ }
44
+ };
45
+ /**
46
+ * The element the journey mounts into, and whether the journey owns it.
47
+ *
48
+ * A container that was passed in is dedicated to the journey by the act of
49
+ * passing it, so the journey mounts straight into it and empties it on
50
+ * teardown. No wrapper of its own in that case, deliberately: the form vendor
51
+ * prepends an internal mount element styled `height: 100%`
52
+ * (`form/vendors/react/index.tsx`'s `attachStyles`, `styles.const.tsx`), so an
53
+ * extra journey-owned box between the host's element and that one would make
54
+ * the `100%` resolve against an auto-height parent and silently collapse the
55
+ * layout of every integration that sizes its container.
56
+ *
57
+ * With no container there is nothing dedicated. The default is
58
+ * `document.body`, which the journey must NOT empty — a `stop()` on a route
59
+ * change, a Cancel button or an unmount would take the host's whole page with
60
+ * it (FDEL-53225 QA bug 1). So it appends one node of its own and removes only
61
+ * that. Nothing else in the journey needs to know which case it is: everything
62
+ * downstream reads `config.container`, including `removeVendorFrames`, whose
63
+ * `querySelectorAll('iframe')` still finds the vendor frame either way.
64
+ */
65
+ const resolveMount = (provided) => {
66
+ if (provided)
67
+ return { container: provided };
68
+ const owned = document.createElement('div');
69
+ owned.setAttribute('data-onesdk-journey', '');
70
+ document.body.appendChild(owned);
71
+ return { container: owned, owned };
72
+ };
73
+ export const mkJourney = (deps) => (name, options) => {
74
+ var _a, _b, _c;
75
+ // JOURNEY:READY telemetry's `elapsedMs` is measured from here, the
76
+ // earliest possible point — before validation, theme, or screen work
77
+ const startedAt = Date.now();
78
+ // Widened once, here: `OptionsFor` narrows the CALLER's surface, and
79
+ // everything below this line is flow-agnostic — it reads `config` the same
80
+ // way whichever journey it is building. The narrowing exists to stop a host
81
+ // passing an option their flow will ignore, not to change what runs.
82
+ const opts = options;
83
+ if (!Object.values(JourneyName).includes(name)) {
84
+ throw new OneSDKError(`E_FLOW_NOT_SUPPORTED: '${name}' is not a supported journey. Supported: ${Object.values(JourneyName).join(', ')}`, { code: 'E_FLOW_NOT_SUPPORTED' });
85
+ }
86
+ // A cast such as `document.querySelector(...) as HTMLElement` defeats the
87
+ // compile-time `HTMLElement` contract and can hand us a runtime `null`.
88
+ // Reject that up front — before any theme, screen or step-runner work
89
+ // starts — rather than letting it surface deep inside `applyTheme`.
90
+ const providedContainer = opts === null || opts === void 0 ? void 0 : opts.container;
91
+ if (providedContainer === null) {
92
+ throw new OneSDKError("E_CONTAINER_NOT_FOUND: journey() received a null 'container'. Pass a valid " +
93
+ "HTMLElement, or omit 'container' to mount against document.body.", { code: 'E_CONTAINER_NOT_FOUND' });
94
+ }
95
+ const mount = resolveMount(providedContainer !== null && providedContainer !== void 0 ? providedContainer : undefined);
96
+ const config = opts
97
+ ? Object.assign(Object.assign({}, opts), { container: mount.container }) : { container: mount.container };
98
+ const { oneSdk } = deps;
99
+ const revertTheme = config.style
100
+ ? applyTheme({ container: config.container, tokens: config.style })
101
+ : undefined;
102
+ // `style.logo` is the customer-facing shape; `applyTheme` deliberately
103
+ // ignores `tokens.logo` since a logo isn't a CSS concern. Forward it into
104
+ // the config the screens read `logo` from, with `style.logo` winning
105
+ // over a top-level `config.logo`.
106
+ const logo = (_b = (_a = config.style) === null || _a === void 0 ? void 0 : _a.logo) !== null && _b !== void 0 ? _b : config.logo;
107
+ // One machine per journey: every listener the flow attaches, every screen
108
+ // it mounts and every timer it opens is registered here, and `teardown()`
109
+ // releases all of them in one place (`steps/stepMachine.ts`).
110
+ const machine = mkStepMachine();
111
+ const screen = mkResultScreen({
112
+ oneSdk,
113
+ config: {
114
+ container: config.container,
115
+ logo,
116
+ withResult: config.withResult,
117
+ result: config.result,
118
+ },
119
+ machine,
120
+ });
121
+ // A simulated journey never mounts a real screen (`resolveSimulation`
122
+ // settles from a fixture), so there is no "first screen" to signal —
123
+ // `journey_ready` only applies to a real run.
124
+ const stepRunner = config.simulate
125
+ ? undefined
126
+ : STEP_RUNNER_FACTORY[name]({
127
+ oneSdk,
128
+ config: Object.assign(Object.assign({}, config), { logo }),
129
+ machine,
130
+ firstPaint: mkFirstPaintSignal({
131
+ oneSdk,
132
+ flow: name,
133
+ machine,
134
+ startedAt,
135
+ }),
136
+ });
137
+ const runStep = stepRunner
138
+ ? stepRunner.run
139
+ : () => __awaiter(void 0, void 0, void 0, function* () { return resolveSimulation(config.simulate); });
140
+ return mkJourneyHandle({
141
+ runStep,
142
+ options: {
143
+ flow: name,
144
+ // 1 main attempt + 2 data-correction retries, across every flow
145
+ maxAttempts: (_c = config.maxAttempts) !== null && _c !== void 0 ? _c : 3,
146
+ ref: () => resolveRef(oneSdk),
147
+ // The container is emptied first, every ending, before our own card
148
+ // mounts. No vendor event means "my UI is gone" — `results` only says
149
+ // the check came back — so the journey clears the element it owns
150
+ // rather than racing whatever teardown the vendor does on its own
151
+ // clock, or trusting an `unmount()` most wrappers never implement
152
+ // (FDEL-53993 QA B10). Terminal settlement is the safe place for it:
153
+ // the flows cache and reuse their vendor instance across attempts, and
154
+ // a retry never reaches here.
155
+ onTerminal: (result) => {
156
+ stepRunner === null || stepRunner === void 0 ? void 0 : stepRunner.clearForTerminalScreen();
157
+ return screen.present(result);
158
+ },
159
+ // Nothing is left on screen when the host owns the ending, so hand the
160
+ // container back as part of settlement rather than making every
161
+ // capture-only host remember to call `destroy()`.
162
+ cleanupOnSettle: config.withResult === false,
163
+ // spec §9.1 — teardown leaves no screens, no vendor iframe and no
164
+ // journey-owned instances behind. `idv.unmount()` does real work since
165
+ // FDEL-53728, and `onTerminal` above has already called it on any
166
+ // journey that settled; this stays because teardown also has to cover
167
+ // the endings that never settle — `stop()`/`destroy()` mid-capture.
168
+ // Which of the two removals applies is `resolveMount`'s call: a node
169
+ // the journey created goes away whole, a container the host dedicated
170
+ // to us is emptied.
171
+ onCleanup: () => {
172
+ machine.teardown();
173
+ revertTheme === null || revertTheme === void 0 ? void 0 : revertTheme();
174
+ if (mount.owned) {
175
+ mount.owned.remove();
176
+ return;
177
+ }
178
+ config.container.innerHTML = '';
179
+ },
180
+ },
181
+ });
182
+ };
183
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../modules/journey/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;A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AAC,CAAA,GAAA,CAAC;IAE7D,OAAO,eAAe,CAAC;QACrB,OAAO;QACP,OAAO,EAAE;YACP,IAAI,EAAE,IAAI;YACV,gEAAgE;YAChE,WAAW,EAAE,MAAA,MAAM,CAAC,WAAW,mCAAI,CAAC;YACpC,GAAG,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;YAC7B,oEAAoE;YACpE,sEAAsE;YACtE,kEAAkE;YAClE,kEAAkE;YAClE,kEAAkE;YAClE,qEAAqE;YACrE,uEAAuE;YACvE,8BAA8B;YAC9B,UAAU,EAAE,CAAC,MAAM,EAAE,EAAE;gBACrB,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,sBAAsB,EAAE,CAAC;gBACrC,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAChC,CAAC;YACD,uEAAuE;YACvE,gEAAgE;YAChE,kDAAkD;YAClD,eAAe,EAAE,MAAM,CAAC,UAAU,KAAK,KAAK;YAC5C,kEAAkE;YAClE,uEAAuE;YACvE,kEAAkE;YAClE,sEAAsE;YACtE,oEAAoE;YACpE,qEAAqE;YACrE,sEAAsE;YACtE,oBAAoB;YACpB,SAAS,EAAE,GAAG,EAAE;gBACd,OAAO,CAAC,QAAQ,EAAE,CAAC;gBACnB,WAAW,aAAX,WAAW,uBAAX,WAAW,EAAI,CAAC;gBAChB,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;oBAChB,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;oBACrB,OAAO;gBACT,CAAC;gBACD,MAAM,CAAC,SAAS,CAAC,SAAS,GAAG,EAAE,CAAC;YAClC,CAAC;SACF;KACF,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -0,0 +1,35 @@
1
+ import type { ClassifierInput } from './types/classifierInput';
2
+ import type { JourneyName, JourneyRef, JourneyResult } from './types/contract';
3
+ export type StepRunner = (attempt: number) => Promise<ClassifierInput>;
4
+ export type HandleOptions = {
5
+ flow: JourneyName;
6
+ maxAttempts: number;
7
+ /**
8
+ * Resolved at settlement, not at construction: a new applicant has no
9
+ * `entityId` until search/submit has run, so snapshotting it when the handle
10
+ * is built reports `null` for every first-time journey.
11
+ */
12
+ ref: () => JourneyRef;
13
+ onTerminal?: (result: JourneyResult) => Promise<void> | void;
14
+ onCleanup?: () => void;
15
+ /**
16
+ * Empty the container as part of settlement instead of waiting for the host
17
+ * to call `destroy()`. Set when there is no terminal screen to leave on
18
+ * screen (`withResult: false`), so `await start()` resolves with a container
19
+ * the host can immediately reuse.
20
+ *
21
+ * Never set alongside a terminal screen: you cannot auto-empty a container
22
+ * whose current job is showing one.
23
+ */
24
+ cleanupOnSettle?: boolean;
25
+ };
26
+ export type JourneyHandle = {
27
+ start: () => Promise<JourneyResult>;
28
+ stop: () => void;
29
+ destroy: () => void;
30
+ };
31
+ export declare const mkJourneyHandle: (deps: {
32
+ runStep: StepRunner;
33
+ options: HandleOptions;
34
+ }) => JourneyHandle;
35
+ //# sourceMappingURL=journeyHandle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"journeyHandle.d.ts","sourceRoot":"","sources":["../../../../modules/journey/journeyHandle.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE/E,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;AAEvE,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,WAAW,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,GAAG,EAAE,MAAM,UAAU,CAAC;IACtB,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC7D,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB;;;;;;;;OAQG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,CAAC;IACpC,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAMF,eAAO,MAAM,eAAe,SAAU;IACpC,OAAO,EAAE,UAAU,CAAC;IACpB,OAAO,EAAE,aAAa,CAAC;CACxB,KAAG,aA6IH,CAAC"}
@@ -0,0 +1,130 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { classify } from './classify/classify.js';
11
+ const STOPPED = { alerts: [], signal: 'user_exited' };
12
+ export const mkJourneyHandle = (deps) => {
13
+ const { runStep, options } = deps;
14
+ let settled;
15
+ let resolveStopped;
16
+ let stopped = false;
17
+ let cleaned = false;
18
+ /** 0-based index handed to the step runner */
19
+ let attempt = 0;
20
+ /** spec §4 — attempts actually made, not retries; 0 until the first one starts */
21
+ let attemptsUsed = 0;
22
+ const finalise = (classification, used) => (Object.assign(Object.assign({}, classification), { flow: options.flow, attempts: { used, max: options.maxAttempts }, finishedAt: new Date().toISOString(), ref: options.ref() }));
23
+ const stoppedResult = () => finalise(classify(STOPPED), attemptsUsed);
24
+ const cleanup = () => {
25
+ var _a;
26
+ if (cleaned)
27
+ return;
28
+ cleaned = true;
29
+ (_a = options.onCleanup) === null || _a === void 0 ? void 0 : _a.call(options);
30
+ };
31
+ /** spec D10 — carry the check result onto decision outcomes only */
32
+ const withCheck = (result, input) => {
33
+ const carries = result.outcome === 'success' ||
34
+ result.outcome === 'pending' ||
35
+ result.outcome === 'declined';
36
+ if (!carries || !input.checkResult)
37
+ return result;
38
+ return Object.assign(Object.assign({}, result), { checkResult: input.checkResult });
39
+ };
40
+ const loop = () => __awaiter(void 0, void 0, void 0, function* () {
41
+ // eslint-disable-next-line no-constant-condition
42
+ while (true) {
43
+ if (stopped)
44
+ return stoppedResult();
45
+ attemptsUsed = attempt + 1;
46
+ const input = yield runStep(attempt);
47
+ // spec §9.1 — `stop()` cancels the loop; without this the next attempt
48
+ // would mount screens over an already-settled, already-torn-down journey.
49
+ if (stopped)
50
+ return stoppedResult();
51
+ const classification = classify(input);
52
+ if (classification.outcome !== 'retry') {
53
+ return withCheck(finalise(classification, attemptsUsed), input);
54
+ }
55
+ if (attemptsUsed >= options.maxAttempts) {
56
+ return withCheck(finalise({ outcome: 'declined', reason: 'attempts_exhausted' }, attemptsUsed), input);
57
+ }
58
+ attempt += 1;
59
+ }
60
+ });
61
+ const settleRace = () => __awaiter(void 0, void 0, void 0, function* () {
62
+ if (stopped)
63
+ return stoppedResult();
64
+ const wasStopped = new Promise((resolve) => {
65
+ resolveStopped = resolve;
66
+ });
67
+ const ran = loop().catch((error) => finalise(classify({
68
+ alerts: [],
69
+ signal: 'unmapped_status',
70
+ errorDetail: { code: 'internal', message: error.message },
71
+ }), attemptsUsed));
72
+ return Promise.race([ran, wasStopped]);
73
+ });
74
+ const guarded = () => __awaiter(void 0, void 0, void 0, function* () {
75
+ var _a;
76
+ const result = yield settleRace();
77
+ try {
78
+ yield ((_a = options.onTerminal) === null || _a === void 0 ? void 0 : _a.call(options, result));
79
+ }
80
+ catch (_b) {
81
+ // spec D9 — once running, every ending resolves. A host `onTerminal`
82
+ // (or a result screen) that throws must not reject a journey that ran.
83
+ }
84
+ try {
85
+ // After `onTerminal`, never before: with a result screen this would tear
86
+ // down the very thing it just mounted. `cleanup()` is idempotent, so a
87
+ // host that also calls `destroy()` is unharmed. Guarded separately from
88
+ // `onTerminal` so that neither one failing can suppress the other — a
89
+ // throwing host callback must still hand the container back, and a
90
+ // throwing teardown must still let `start()` resolve.
91
+ if (options.cleanupOnSettle)
92
+ cleanup();
93
+ }
94
+ catch (_c) {
95
+ // spec D9 again: `onCleanup` does `revertTheme?.()` and empties the
96
+ // container, neither of which is internally guarded.
97
+ }
98
+ return result;
99
+ });
100
+ /**
101
+ * End the journey without a decision. Both `stop()` and `destroy()` route
102
+ * through here: tearing a journey down while a step is in flight leaves that
103
+ * step unable to settle (its screens and vendor flow are gone), so the race
104
+ * has to be resolved here or the caller's `await start()` would hang — the
105
+ * one thing the contract promises never happens. `abandoned / user_exited` is
106
+ * the honest outcome: nothing was decided, and the host walked away.
107
+ */
108
+ const abandon = () => {
109
+ if (stopped)
110
+ return;
111
+ stopped = true;
112
+ resolveStopped === null || resolveStopped === void 0 ? void 0 : resolveStopped(stoppedResult());
113
+ };
114
+ return {
115
+ start: () => {
116
+ settled !== null && settled !== void 0 ? settled : (settled = guarded());
117
+ return settled;
118
+ },
119
+ /** spec §9.1 — `stop()` implies cleanup, and actually stops the loop */
120
+ stop: () => {
121
+ abandon();
122
+ cleanup();
123
+ },
124
+ destroy: () => {
125
+ abandon();
126
+ cleanup();
127
+ },
128
+ };
129
+ };
130
+ //# sourceMappingURL=journeyHandle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"journeyHandle.js","sourceRoot":"","sources":["../../../../modules/journey/journeyHandle.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAqC/C,MAAM,OAAO,GAAoB,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;AAIvE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAG/B,EAAiB,E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2 @@
1
+ export declare const hostCtaKeysOnly: (cta: Record<string, unknown>) => Record<string, unknown>;
2
+ //# sourceMappingURL=ctaConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ctaConfig.d.ts","sourceRoot":"","sources":["../../../../../modules/journey/screens/ctaConfig.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,eAAe,QACrB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC3B,MAAM,CAAC,MAAM,EAAE,OAAO,CAGtB,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The CTA keys a host may set, and the only ones forwarded to the form.
3
+ *
4
+ * An allowlist rather than a denylist, because `Result.tsx` spreads the whole
5
+ * `cta` object onto `FrankieFormButton` AFTER the component's own props — so
6
+ * every prop that component has now, or gains later, is reachable from host
7
+ * config. Three of them break settlement outright:
8
+ *
9
+ * - `onClick` replaces `handleSubmit`, which is the only thing that emits the
10
+ * event a CTA screen's step completes on
11
+ * - `visible: false` removes the button
12
+ * - `disabled: true` renders one that cannot be clicked
13
+ *
14
+ * On PARTIAL — whose step completes on that click alone, with no timeout,
15
+ * because it is human-gated — any of the three means `await start()` never
16
+ * settles, with the card still on screen. On a terminal card with a host CTA
17
+ * the same is true, since a CTA moves settlement to the click.
18
+ *
19
+ * `hidden` is journey-owned on both paths and is set by the caller, not here.
20
+ */
21
+ const HOST_CTA_KEYS = ['label', 'icon', 'style', 'inline'];
22
+ export const hostCtaKeysOnly = (cta) => Object.fromEntries(Object.entries(cta).filter(([key]) => HOST_CTA_KEYS.includes(key)));
23
+ //# sourceMappingURL=ctaConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ctaConfig.js","sourceRoot":"","sources":["../../../../../modules/journey/screens/ctaConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAE3D,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,GAA4B,EACH,EAAE,CAC3B,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CACnE,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { OneSdkContext } from '../../sdk/types/oneSDK';
2
+ import type { StepMachine } from '../steps/stepMachine';
3
+ import type { JourneyResult } from '../types/contract';
4
+ import type { JourneyResultConfig, JourneyTerminalState } from '../types/resultConfig';
5
+ /** spec §7 — outcome to screen. undefined means "render nothing". */
6
+ export declare const screenStateFor: (result: JourneyResult) => JourneyTerminalState | undefined;
7
+ type ResultScreenDeps = {
8
+ oneSdk: OneSdkContext;
9
+ config: {
10
+ container: HTMLElement;
11
+ logo?: string;
12
+ withResult?: boolean;
13
+ result?: JourneyResultConfig;
14
+ };
15
+ machine: StepMachine;
16
+ };
17
+ export declare const mkResultScreen: (deps: ResultScreenDeps) => {
18
+ present: (result: JourneyResult) => Promise<void>;
19
+ };
20
+ export {};
21
+ //# sourceMappingURL=resultScreen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resultScreen.d.ts","sourceRoot":"","sources":["../../../../../modules/journey/screens/resultScreen.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAM9D,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,uBAAuB,CAAC;AAK/B,qEAAqE;AACrE,eAAO,MAAM,cAAc,WACjB,aAAa,KACpB,oBAAoB,GAAG,SAWzB,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACtB,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,EAAE;QACN,SAAS,EAAE,WAAW,CAAC;QACvB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,MAAM,CAAC,EAAE,mBAAmB,CAAC;KAC9B,CAAC;IACF,OAAO,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,cAAc,SAAU,gBAAgB;sBAiBpB,aAAa,KAAG,OAAO,CAAC,IAAI,CAAC;CAsD7D,CAAC"}
@@ -0,0 +1,108 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __rest = (this && this.__rest) || function (s, e) {
11
+ var t = {};
12
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
13
+ t[p] = s[p];
14
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
15
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
16
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
17
+ t[p[i]] = s[p[i]];
18
+ }
19
+ return t;
20
+ };
21
+ import { RESULT_STATE } from '../../form/vendors/react/appConfig.type.js';
22
+ import { RESULT_CTA_EVENT } from '../steps/stepTable.js';
23
+ import { hostCtaKeysOnly } from './ctaConfig.js';
24
+ const VENDOR_ERRORS = ['vendor_load_failed', 'vendor_offline'];
25
+ const TIMEOUT_ERRORS = ['session_expired', 'workflow_timeout'];
26
+ /** spec §7 — outcome to screen. undefined means "render nothing". */
27
+ export const screenStateFor = (result) => {
28
+ // `captured` renders the same SUCCESS card as a real verification: the
29
+ // journey did everything it was asked to do. Its copy is the stock success
30
+ // copy until FDEL-53994 lands per-state `result` config a host can override.
31
+ if (result.outcome === 'success')
32
+ return RESULT_STATE.SUCCESS;
33
+ if (result.outcome === 'pending')
34
+ return RESULT_STATE.PENDING;
35
+ if (result.outcome === 'declined')
36
+ return RESULT_STATE.FAIL;
37
+ if (result.outcome === 'abandoned')
38
+ return undefined;
39
+ if (VENDOR_ERRORS.includes(result.reason))
40
+ return RESULT_STATE.PROVIDER_ERROR;
41
+ if (TIMEOUT_ERRORS.includes(result.reason))
42
+ return RESULT_STATE.TIMEOUT;
43
+ return RESULT_STATE.FAIL;
44
+ };
45
+ export const mkResultScreen = (deps) => {
46
+ const { oneSdk, config, machine } = deps;
47
+ /**
48
+ * The terminal step, and the one whose completion is not an event at all —
49
+ * which is exactly what the table's RESULT row says (`steps/stepTable.ts`):
50
+ *
51
+ * 1. Non-interactive by default, so the journey settles once the terminal
52
+ * screen has rendered — that is `mount()` settling. There is no timer: the
53
+ * RESULT screen emits nothing on render, so waiting for an event that
54
+ * never comes and then giving up after N seconds was measuring nothing.
55
+ * 2. When the host configures a CTA, settlement moves to the CTA click, the
56
+ * one event the screen genuinely emits, taken from `RESULT_CTA_EVENT`. A
57
+ * mount failure still completes it — no click can follow a screen that
58
+ * never rendered — and so does `destroy()`, through the machine's single
59
+ * teardown, so a configured CTA can no longer leave `start()` hanging.
60
+ */
61
+ const present = (result) => __awaiter(void 0, void 0, void 0, function* () {
62
+ // The host owns the ending. Checked before `screenStateFor` so nothing is
63
+ // computed for a screen that will not be built, and so suppression is
64
+ // unconditional — an error outcome is suppressed exactly like a success.
65
+ if (config.withResult === false)
66
+ return;
67
+ const state = screenStateFor(result);
68
+ if (!state)
69
+ return;
70
+ yield machine.run('RESULT', (attach) => {
71
+ var _a, _b;
72
+ // The host's own config for whichever card this outcome produced,
73
+ // spread BEFORE `state`: the outcome decides which card renders and a
74
+ // host must not be able to show the success card for a decline. This is
75
+ // the one place the journey does not let host config win, and it is why
76
+ // the spread order here differs from `presentReview`'s.
77
+ const hostState = (_b = (_a = config.result) === null || _a === void 0 ? void 0 : _a[state]) !== null && _b !== void 0 ? _b : {};
78
+ const { cta: hostCta } = hostState, hostConfig = __rest(hostState, ["cta"]);
79
+ const cta = hostCta;
80
+ const screen = oneSdk.component('form', Object.assign(Object.assign({ name: 'RESULT', mode: 'individual', type: 'manual' }, hostConfig), { state, logo: config.logo ? { src: config.logo } : undefined,
81
+ // spec D5: non-interactive unless the host asked for a CTA on THIS
82
+ // state. Passing `{ hidden: true }` rather than nothing is deliberate:
83
+ // the form's merge is a shallow spread, so omitting `cta` would let
84
+ // `resultInfoMapping`'s per-state defaults through — a "Done" on every
85
+ // ending, and a "Retry" on PROVIDER_ERROR that retries nothing.
86
+ cta: cta
87
+ ? Object.assign(Object.assign({}, hostCtaKeysOnly(cta)), { hidden: false }) : { hidden: true } }));
88
+ machine.release(() => screen.unmount());
89
+ // Listener attached before mounting so a fast CTA cannot be missed. The
90
+ // form component types `on` per screen/event key while the table hands it
91
+ // a `string`, so the emitter is cast once, here, at the boundary.
92
+ if (cta) {
93
+ attach(screen, [RESULT_CTA_EVENT[state]]);
94
+ }
95
+ // `Promise.resolve(...)` guards against test doubles whose `mount()`
96
+ // returns a non-promise value. The mount promise is not handed back to
97
+ // the machine: a RESULT screen that fails to render completes the step,
98
+ // it does not fail it — the journey has already been decided.
99
+ void Promise.resolve(screen.mount(config.container)).then(() => {
100
+ if (!cta)
101
+ machine.complete('RESULT');
102
+ }, () => machine.complete('RESULT'));
103
+ return undefined;
104
+ });
105
+ });
106
+ return { present };
107
+ };
108
+ //# sourceMappingURL=resultScreen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resultScreen.js","sourceRoot":"","sources":["../../../../../modules/journey/screens/resultScreen.ts"],"names":[],"mappings":";;;;;;;;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B,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACtE,CAAC;YACD,qEAAqE;YACrE,uEAAuE;YACvE,wEAAwE;YACxE,8DAA8D;YAC9D,KAAK,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CACvD,GAAG,EAAE;gBACH,IAAI,CAAC,GAAG;oBAAE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACvC,CAAC,EACD,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CACjC,CAAC;YACF,OAAO,SAAS,CAAC;QACnB,CAAC,CAAC,CAAC;IACL,CAAC,CAAA,CAAC;IAEF,OAAO,EAAE,OAAO,EAAE,CAAC;AACrB,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { ClassifierInput } from '../types/classifierInput';
2
+ /**
3
+ * spec §9.6 — the reason code as an input. Each fixture is the engine state
4
+ * that genuinely produces its key, fed through the real classifier.
5
+ * A reason with no fixture here is unreachable and must not be in the contract.
6
+ */
7
+ export declare const SIMULATIONS: Record<string, ClassifierInput>;
8
+ export declare const resolveSimulation: (key: string) => ClassifierInput;
9
+ //# sourceMappingURL=fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../../../modules/journey/simulate/fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CA+BvD,CAAC;AAEF,eAAO,MAAM,iBAAiB,QAAS,MAAM,KAAG,eAQ/C,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * spec §9.6 — the reason code as an input. Each fixture is the engine state
3
+ * that genuinely produces its key, fed through the real classifier.
4
+ * A reason with no fixture here is unreachable and must not be in the contract.
5
+ */
6
+ export const SIMULATIONS = {
7
+ 'success/verified': { statusType: 'passed', alerts: [] },
8
+ 'success/verified_manually': { statusType: 'pass_manual', alerts: [] },
9
+ 'success/captured': { alerts: [], signal: 'captured' },
10
+ 'pending/manual_review': { statusType: 'refer', alerts: [] },
11
+ 'pending/awaiting_checks': { statusType: 'unchecked', alerts: [] },
12
+ 'pending/processing_timeout': { alerts: [], signal: 'processing_timeout' },
13
+ 'declined/checks_failed': { statusType: 'failed', alerts: [] },
14
+ 'declined/declined_manually': { statusType: 'fail_manual', alerts: [] },
15
+ 'declined/duplicate': { statusType: 'refer', alerts: ['duplicate'] },
16
+ 'declined/blocklisted': { statusType: 'refer', alerts: ['blacklist'] },
17
+ 'declined/fraud': { statusType: 'refer', alerts: ['fraud'] },
18
+ 'declined/profile_archived': { statusType: 'archived', alerts: [] },
19
+ 'declined/profile_inactive': { statusType: 'inactive', alerts: [] },
20
+ // spec §3.9 — only via DELETE /v2/profiles/{id} or a cascading entity purge
21
+ 'declined/profile_deleted': { alerts: [], profileState: 'DELETED' },
22
+ 'abandoned/session_interrupted': {
23
+ alerts: [],
24
+ signal: 'session_interrupted',
25
+ },
26
+ 'abandoned/user_exited': { alerts: [], signal: 'user_exited' },
27
+ 'error/vendor_load_failed': { alerts: [], signal: 'vendor_load_failed' },
28
+ 'error/vendor_offline': { alerts: [], retryPage: 'PROVIDER_ERROR' },
29
+ 'error/network': { alerts: [], signal: 'network' },
30
+ 'error/session_expired': { alerts: [], signal: 'session_expired' },
31
+ 'error/submit_failed': { alerts: [], signal: 'submit_failed' },
32
+ 'error/internal': { alerts: ['500'] },
33
+ };
34
+ export const resolveSimulation = (key) => {
35
+ const found = SIMULATIONS[key];
36
+ if (!found) {
37
+ throw new Error(`Unknown simulation '${key}'. Available: ${Object.keys(SIMULATIONS).join(', ')}`);
38
+ }
39
+ return found;
40
+ };
41
+ //# sourceMappingURL=fixtures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixtures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