@spare-technologies/spare-link 0.1.0-beta.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.
Files changed (648) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/LICENSE +21 -0
  3. package/README.md +173 -0
  4. package/assets/fonts/MetroSans-Bold.otf +0 -0
  5. package/assets/fonts/MetroSans-Light.otf +0 -0
  6. package/assets/fonts/MetroSans-Medium.otf +0 -0
  7. package/assets/fonts/MetroSans-Regular.otf +0 -0
  8. package/assets/fonts/MetroSans-SemiBold.otf +0 -0
  9. package/assets/images/altareq_logo_mini.png +0 -0
  10. package/assets/images/altareq_logo_transparent_bg.png +0 -0
  11. package/assets/images/altareq_logo_white_bg.png +0 -0
  12. package/assets/images/spare_logo.png +0 -0
  13. package/lib/commonjs/core/client/link-api-client.js +297 -0
  14. package/lib/commonjs/core/client/link-api-client.js.map +1 -0
  15. package/lib/commonjs/core/errors/payment-api-error.js +35 -0
  16. package/lib/commonjs/core/errors/payment-api-error.js.map +1 -0
  17. package/lib/commonjs/core/models/index.js +2 -0
  18. package/lib/commonjs/core/models/index.js.map +1 -0
  19. package/lib/commonjs/core/models/link-session-status.js +14 -0
  20. package/lib/commonjs/core/models/link-session-status.js.map +1 -0
  21. package/lib/commonjs/core/models/payment-return-params.js +42 -0
  22. package/lib/commonjs/core/models/payment-return-params.js.map +1 -0
  23. package/lib/commonjs/core/models/payment-type.js +45 -0
  24. package/lib/commonjs/core/models/payment-type.js.map +1 -0
  25. package/lib/commonjs/core/models/wire-mappers.js +277 -0
  26. package/lib/commonjs/core/models/wire-mappers.js.map +1 -0
  27. package/lib/commonjs/core/services/consent-presenter.js +150 -0
  28. package/lib/commonjs/core/services/consent-presenter.js.map +1 -0
  29. package/lib/commonjs/core/services/execute-resume-if-needed.js +216 -0
  30. package/lib/commonjs/core/services/execute-resume-if-needed.js.map +1 -0
  31. package/lib/commonjs/core/services/multi-payment-rules-presenter.js +151 -0
  32. package/lib/commonjs/core/services/multi-payment-rules-presenter.js.map +1 -0
  33. package/lib/commonjs/core/services/payment-flow-controller.js +547 -0
  34. package/lib/commonjs/core/services/payment-flow-controller.js.map +1 -0
  35. package/lib/commonjs/core/services/payment-flow-state.js +110 -0
  36. package/lib/commonjs/core/services/payment-flow-state.js.map +1 -0
  37. package/lib/commonjs/core/services/payment-result-mapper.js +49 -0
  38. package/lib/commonjs/core/services/payment-result-mapper.js.map +1 -0
  39. package/lib/commonjs/core/services/pending-session-store.js +6 -0
  40. package/lib/commonjs/core/services/pending-session-store.js.map +1 -0
  41. package/lib/commonjs/core/services/presentation-utils.js +11 -0
  42. package/lib/commonjs/core/services/presentation-utils.js.map +1 -0
  43. package/lib/commonjs/core/services/redirect-buffer.js +40 -0
  44. package/lib/commonjs/core/services/redirect-buffer.js.map +1 -0
  45. package/lib/commonjs/core/services/user-friendly-messages.js +46 -0
  46. package/lib/commonjs/core/services/user-friendly-messages.js.map +1 -0
  47. package/lib/commonjs/index.js +294 -0
  48. package/lib/commonjs/index.js.map +1 -0
  49. package/lib/commonjs/internal/bank-redirect.js +53 -0
  50. package/lib/commonjs/internal/bank-redirect.js.map +1 -0
  51. package/lib/commonjs/internal/deep-link-listener.js +39 -0
  52. package/lib/commonjs/internal/deep-link-listener.js.map +1 -0
  53. package/lib/commonjs/internal/event-emitter.js +36 -0
  54. package/lib/commonjs/internal/event-emitter.js.map +1 -0
  55. package/lib/commonjs/internal/index.js +34 -0
  56. package/lib/commonjs/internal/index.js.map +1 -0
  57. package/lib/commonjs/internal/logger.js +67 -0
  58. package/lib/commonjs/internal/logger.js.map +1 -0
  59. package/lib/commonjs/internal/redact-uri.js +25 -0
  60. package/lib/commonjs/internal/redact-uri.js.map +1 -0
  61. package/lib/commonjs/internal/secure-store-pending-session-store.js +92 -0
  62. package/lib/commonjs/internal/secure-store-pending-session-store.js.map +1 -0
  63. package/lib/commonjs/internal/telemetry-collector.js +80 -0
  64. package/lib/commonjs/internal/telemetry-collector.js.map +1 -0
  65. package/lib/commonjs/package.json +1 -0
  66. package/lib/commonjs/public/constants.js +21 -0
  67. package/lib/commonjs/public/constants.js.map +1 -0
  68. package/lib/commonjs/public/index.js +152 -0
  69. package/lib/commonjs/public/index.js.map +1 -0
  70. package/lib/commonjs/public/payment-result.js +48 -0
  71. package/lib/commonjs/public/payment-result.js.map +1 -0
  72. package/lib/commonjs/public/recovery-result.js +40 -0
  73. package/lib/commonjs/public/recovery-result.js.map +1 -0
  74. package/lib/commonjs/public/spare-link-callbacks.js +6 -0
  75. package/lib/commonjs/public/spare-link-callbacks.js.map +1 -0
  76. package/lib/commonjs/public/spare-link-config.js +62 -0
  77. package/lib/commonjs/public/spare-link-config.js.map +1 -0
  78. package/lib/commonjs/public/spare-link-event.js +120 -0
  79. package/lib/commonjs/public/spare-link-event.js.map +1 -0
  80. package/lib/commonjs/public/spare-link-host-api.js +6 -0
  81. package/lib/commonjs/public/spare-link-host-api.js.map +1 -0
  82. package/lib/commonjs/public/spare-link-instance.js +285 -0
  83. package/lib/commonjs/public/spare-link-instance.js.map +1 -0
  84. package/lib/commonjs/public/spare-link-session.js +26 -0
  85. package/lib/commonjs/public/spare-link-session.js.map +1 -0
  86. package/lib/commonjs/public/spare-link.js +31 -0
  87. package/lib/commonjs/public/spare-link.js.map +1 -0
  88. package/lib/commonjs/ui/consent/charge-bearer-display.js +99 -0
  89. package/lib/commonjs/ui/consent/charge-bearer-display.js.map +1 -0
  90. package/lib/commonjs/ui/consent/consent-accordion.js +94 -0
  91. package/lib/commonjs/ui/consent/consent-accordion.js.map +1 -0
  92. package/lib/commonjs/ui/consent/consent-summary-section.js +27 -0
  93. package/lib/commonjs/ui/consent/consent-summary-section.js.map +1 -0
  94. package/lib/commonjs/ui/consent/cop-information.js +168 -0
  95. package/lib/commonjs/ui/consent/cop-information.js.map +1 -0
  96. package/lib/commonjs/ui/consent/international-payment-summary.js +98 -0
  97. package/lib/commonjs/ui/consent/international-payment-summary.js.map +1 -0
  98. package/lib/commonjs/ui/consent/label-value-rows.js +59 -0
  99. package/lib/commonjs/ui/consent/label-value-rows.js.map +1 -0
  100. package/lib/commonjs/ui/consent/multi-payment-rules-list.js +130 -0
  101. package/lib/commonjs/ui/consent/multi-payment-rules-list.js.map +1 -0
  102. package/lib/commonjs/ui/consent/multi-payment-summary.js +99 -0
  103. package/lib/commonjs/ui/consent/multi-payment-summary.js.map +1 -0
  104. package/lib/commonjs/ui/consent/single-payment-summary.js +158 -0
  105. package/lib/commonjs/ui/consent/single-payment-summary.js.map +1 -0
  106. package/lib/commonjs/ui/consent/terms-link.js +35 -0
  107. package/lib/commonjs/ui/consent/terms-link.js.map +1 -0
  108. package/lib/commonjs/ui/hooks/use-payment-flow-state.js +16 -0
  109. package/lib/commonjs/ui/hooks/use-payment-flow-state.js.map +1 -0
  110. package/lib/commonjs/ui/payment-flow-page.js +235 -0
  111. package/lib/commonjs/ui/payment-flow-page.js.map +1 -0
  112. package/lib/commonjs/ui/screens/bank-selection-screen.js +215 -0
  113. package/lib/commonjs/ui/screens/bank-selection-screen.js.map +1 -0
  114. package/lib/commonjs/ui/screens/consent-details-screen.js +124 -0
  115. package/lib/commonjs/ui/screens/consent-details-screen.js.map +1 -0
  116. package/lib/commonjs/ui/screens/index.js +48 -0
  117. package/lib/commonjs/ui/screens/index.js.map +1 -0
  118. package/lib/commonjs/ui/screens/mandate-setup-success-screen.js +79 -0
  119. package/lib/commonjs/ui/screens/mandate-setup-success-screen.js.map +1 -0
  120. package/lib/commonjs/ui/screens/redirect-handoff-screen.js +42 -0
  121. package/lib/commonjs/ui/screens/redirect-handoff-screen.js.map +1 -0
  122. package/lib/commonjs/ui/screens/result-screen.js +83 -0
  123. package/lib/commonjs/ui/screens/result-screen.js.map +1 -0
  124. package/lib/commonjs/ui/screens/resume-processing-screen.js +109 -0
  125. package/lib/commonjs/ui/screens/resume-processing-screen.js.map +1 -0
  126. package/lib/commonjs/ui/spare-link-host.js +354 -0
  127. package/lib/commonjs/ui/spare-link-host.js.map +1 -0
  128. package/lib/commonjs/ui/theme/assets.js +20 -0
  129. package/lib/commonjs/ui/theme/assets.js.map +1 -0
  130. package/lib/commonjs/ui/theme/colors.js +36 -0
  131. package/lib/commonjs/ui/theme/colors.js.map +1 -0
  132. package/lib/commonjs/ui/theme/fonts.js +29 -0
  133. package/lib/commonjs/ui/theme/fonts.js.map +1 -0
  134. package/lib/commonjs/ui/theme/index.js +53 -0
  135. package/lib/commonjs/ui/theme/index.js.map +1 -0
  136. package/lib/commonjs/ui/theme/typography.js +76 -0
  137. package/lib/commonjs/ui/theme/typography.js.map +1 -0
  138. package/lib/commonjs/ui/widgets/footer.js +144 -0
  139. package/lib/commonjs/ui/widgets/footer.js.map +1 -0
  140. package/lib/commonjs/ui/widgets/gradient-spinner.js +172 -0
  141. package/lib/commonjs/ui/widgets/gradient-spinner.js.map +1 -0
  142. package/lib/commonjs/ui/widgets/handoff-screen-layout.js +77 -0
  143. package/lib/commonjs/ui/widgets/handoff-screen-layout.js.map +1 -0
  144. package/lib/commonjs/ui/widgets/index.js +41 -0
  145. package/lib/commonjs/ui/widgets/index.js.map +1 -0
  146. package/lib/commonjs/ui/widgets/layout-w-header.js +106 -0
  147. package/lib/commonjs/ui/widgets/layout-w-header.js.map +1 -0
  148. package/lib/commonjs/ui/widgets/modal-dismiss-button.js +47 -0
  149. package/lib/commonjs/ui/widgets/modal-dismiss-button.js.map +1 -0
  150. package/lib/commonjs/ui/widgets/stepper.js +124 -0
  151. package/lib/commonjs/ui/widgets/stepper.js.map +1 -0
  152. package/lib/commonjs/version.js +14 -0
  153. package/lib/commonjs/version.js.map +1 -0
  154. package/lib/module/core/client/link-api-client.js +292 -0
  155. package/lib/module/core/client/link-api-client.js.map +1 -0
  156. package/lib/module/core/errors/payment-api-error.js +29 -0
  157. package/lib/module/core/errors/payment-api-error.js.map +1 -0
  158. package/lib/module/core/models/index.js +2 -0
  159. package/lib/module/core/models/index.js.map +1 -0
  160. package/lib/module/core/models/link-session-status.js +10 -0
  161. package/lib/module/core/models/link-session-status.js.map +1 -0
  162. package/lib/module/core/models/payment-return-params.js +37 -0
  163. package/lib/module/core/models/payment-return-params.js.map +1 -0
  164. package/lib/module/core/models/payment-type.js +36 -0
  165. package/lib/module/core/models/payment-type.js.map +1 -0
  166. package/lib/module/core/models/wire-mappers.js +263 -0
  167. package/lib/module/core/models/wire-mappers.js.map +1 -0
  168. package/lib/module/core/services/consent-presenter.js +140 -0
  169. package/lib/module/core/services/consent-presenter.js.map +1 -0
  170. package/lib/module/core/services/execute-resume-if-needed.js +211 -0
  171. package/lib/module/core/services/execute-resume-if-needed.js.map +1 -0
  172. package/lib/module/core/services/multi-payment-rules-presenter.js +146 -0
  173. package/lib/module/core/services/multi-payment-rules-presenter.js.map +1 -0
  174. package/lib/module/core/services/payment-flow-controller.js +544 -0
  175. package/lib/module/core/services/payment-flow-controller.js.map +1 -0
  176. package/lib/module/core/services/payment-flow-state.js +106 -0
  177. package/lib/module/core/services/payment-flow-state.js.map +1 -0
  178. package/lib/module/core/services/payment-result-mapper.js +45 -0
  179. package/lib/module/core/services/payment-result-mapper.js.map +1 -0
  180. package/lib/module/core/services/pending-session-store.js +4 -0
  181. package/lib/module/core/services/pending-session-store.js.map +1 -0
  182. package/lib/module/core/services/presentation-utils.js +7 -0
  183. package/lib/module/core/services/presentation-utils.js.map +1 -0
  184. package/lib/module/core/services/redirect-buffer.js +33 -0
  185. package/lib/module/core/services/redirect-buffer.js.map +1 -0
  186. package/lib/module/core/services/user-friendly-messages.js +42 -0
  187. package/lib/module/core/services/user-friendly-messages.js.map +1 -0
  188. package/lib/module/index.js +40 -0
  189. package/lib/module/index.js.map +1 -0
  190. package/lib/module/internal/bank-redirect.js +49 -0
  191. package/lib/module/internal/bank-redirect.js.map +1 -0
  192. package/lib/module/internal/deep-link-listener.js +34 -0
  193. package/lib/module/internal/deep-link-listener.js.map +1 -0
  194. package/lib/module/internal/event-emitter.js +32 -0
  195. package/lib/module/internal/event-emitter.js.map +1 -0
  196. package/lib/module/internal/index.js +7 -0
  197. package/lib/module/internal/index.js.map +1 -0
  198. package/lib/module/internal/logger.js +61 -0
  199. package/lib/module/internal/logger.js.map +1 -0
  200. package/lib/module/internal/redact-uri.js +21 -0
  201. package/lib/module/internal/redact-uri.js.map +1 -0
  202. package/lib/module/internal/secure-store-pending-session-store.js +88 -0
  203. package/lib/module/internal/secure-store-pending-session-store.js.map +1 -0
  204. package/lib/module/internal/telemetry-collector.js +75 -0
  205. package/lib/module/internal/telemetry-collector.js.map +1 -0
  206. package/lib/module/package.json +1 -0
  207. package/lib/module/public/constants.js +17 -0
  208. package/lib/module/public/constants.js.map +1 -0
  209. package/lib/module/public/index.js +11 -0
  210. package/lib/module/public/index.js.map +1 -0
  211. package/lib/module/public/payment-result.js +41 -0
  212. package/lib/module/public/payment-result.js.map +1 -0
  213. package/lib/module/public/recovery-result.js +34 -0
  214. package/lib/module/public/recovery-result.js.map +1 -0
  215. package/lib/module/public/spare-link-callbacks.js +4 -0
  216. package/lib/module/public/spare-link-callbacks.js.map +1 -0
  217. package/lib/module/public/spare-link-config.js +54 -0
  218. package/lib/module/public/spare-link-config.js.map +1 -0
  219. package/lib/module/public/spare-link-event.js +115 -0
  220. package/lib/module/public/spare-link-event.js.map +1 -0
  221. package/lib/module/public/spare-link-host-api.js +4 -0
  222. package/lib/module/public/spare-link-host-api.js.map +1 -0
  223. package/lib/module/public/spare-link-instance.js +273 -0
  224. package/lib/module/public/spare-link-instance.js.map +1 -0
  225. package/lib/module/public/spare-link-session.js +21 -0
  226. package/lib/module/public/spare-link-session.js.map +1 -0
  227. package/lib/module/public/spare-link.js +4 -0
  228. package/lib/module/public/spare-link.js.map +1 -0
  229. package/lib/module/ui/consent/charge-bearer-display.js +95 -0
  230. package/lib/module/ui/consent/charge-bearer-display.js.map +1 -0
  231. package/lib/module/ui/consent/consent-accordion.js +90 -0
  232. package/lib/module/ui/consent/consent-accordion.js.map +1 -0
  233. package/lib/module/ui/consent/consent-summary-section.js +23 -0
  234. package/lib/module/ui/consent/consent-summary-section.js.map +1 -0
  235. package/lib/module/ui/consent/cop-information.js +165 -0
  236. package/lib/module/ui/consent/cop-information.js.map +1 -0
  237. package/lib/module/ui/consent/international-payment-summary.js +94 -0
  238. package/lib/module/ui/consent/international-payment-summary.js.map +1 -0
  239. package/lib/module/ui/consent/label-value-rows.js +55 -0
  240. package/lib/module/ui/consent/label-value-rows.js.map +1 -0
  241. package/lib/module/ui/consent/multi-payment-rules-list.js +125 -0
  242. package/lib/module/ui/consent/multi-payment-rules-list.js.map +1 -0
  243. package/lib/module/ui/consent/multi-payment-summary.js +95 -0
  244. package/lib/module/ui/consent/multi-payment-summary.js.map +1 -0
  245. package/lib/module/ui/consent/single-payment-summary.js +154 -0
  246. package/lib/module/ui/consent/single-payment-summary.js.map +1 -0
  247. package/lib/module/ui/consent/terms-link.js +31 -0
  248. package/lib/module/ui/consent/terms-link.js.map +1 -0
  249. package/lib/module/ui/hooks/use-payment-flow-state.js +12 -0
  250. package/lib/module/ui/hooks/use-payment-flow-state.js.map +1 -0
  251. package/lib/module/ui/payment-flow-page.js +232 -0
  252. package/lib/module/ui/payment-flow-page.js.map +1 -0
  253. package/lib/module/ui/screens/bank-selection-screen.js +211 -0
  254. package/lib/module/ui/screens/bank-selection-screen.js.map +1 -0
  255. package/lib/module/ui/screens/consent-details-screen.js +120 -0
  256. package/lib/module/ui/screens/consent-details-screen.js.map +1 -0
  257. package/lib/module/ui/screens/index.js +9 -0
  258. package/lib/module/ui/screens/index.js.map +1 -0
  259. package/lib/module/ui/screens/mandate-setup-success-screen.js +75 -0
  260. package/lib/module/ui/screens/mandate-setup-success-screen.js.map +1 -0
  261. package/lib/module/ui/screens/redirect-handoff-screen.js +39 -0
  262. package/lib/module/ui/screens/redirect-handoff-screen.js.map +1 -0
  263. package/lib/module/ui/screens/result-screen.js +79 -0
  264. package/lib/module/ui/screens/result-screen.js.map +1 -0
  265. package/lib/module/ui/screens/resume-processing-screen.js +105 -0
  266. package/lib/module/ui/screens/resume-processing-screen.js.map +1 -0
  267. package/lib/module/ui/spare-link-host.js +350 -0
  268. package/lib/module/ui/spare-link-host.js.map +1 -0
  269. package/lib/module/ui/theme/assets.js +16 -0
  270. package/lib/module/ui/theme/assets.js.map +1 -0
  271. package/lib/module/ui/theme/colors.js +32 -0
  272. package/lib/module/ui/theme/colors.js.map +1 -0
  273. package/lib/module/ui/theme/fonts.js +23 -0
  274. package/lib/module/ui/theme/fonts.js.map +1 -0
  275. package/lib/module/ui/theme/index.js +13 -0
  276. package/lib/module/ui/theme/index.js.map +1 -0
  277. package/lib/module/ui/theme/typography.js +49 -0
  278. package/lib/module/ui/theme/typography.js.map +1 -0
  279. package/lib/module/ui/widgets/footer.js +140 -0
  280. package/lib/module/ui/widgets/footer.js.map +1 -0
  281. package/lib/module/ui/widgets/gradient-spinner.js +168 -0
  282. package/lib/module/ui/widgets/gradient-spinner.js.map +1 -0
  283. package/lib/module/ui/widgets/handoff-screen-layout.js +73 -0
  284. package/lib/module/ui/widgets/handoff-screen-layout.js.map +1 -0
  285. package/lib/module/ui/widgets/index.js +8 -0
  286. package/lib/module/ui/widgets/index.js.map +1 -0
  287. package/lib/module/ui/widgets/layout-w-header.js +102 -0
  288. package/lib/module/ui/widgets/layout-w-header.js.map +1 -0
  289. package/lib/module/ui/widgets/modal-dismiss-button.js +43 -0
  290. package/lib/module/ui/widgets/modal-dismiss-button.js.map +1 -0
  291. package/lib/module/ui/widgets/stepper.js +120 -0
  292. package/lib/module/ui/widgets/stepper.js.map +1 -0
  293. package/lib/module/version.js +10 -0
  294. package/lib/module/version.js.map +1 -0
  295. package/lib/typescript/commonjs/core/client/link-api-client.d.ts +70 -0
  296. package/lib/typescript/commonjs/core/client/link-api-client.d.ts.map +1 -0
  297. package/lib/typescript/commonjs/core/errors/payment-api-error.d.ts +15 -0
  298. package/lib/typescript/commonjs/core/errors/payment-api-error.d.ts.map +1 -0
  299. package/lib/typescript/commonjs/core/models/index.d.ts +124 -0
  300. package/lib/typescript/commonjs/core/models/index.d.ts.map +1 -0
  301. package/lib/typescript/commonjs/core/models/link-session-status.d.ts +6 -0
  302. package/lib/typescript/commonjs/core/models/link-session-status.d.ts.map +1 -0
  303. package/lib/typescript/commonjs/core/models/payment-return-params.d.ts +15 -0
  304. package/lib/typescript/commonjs/core/models/payment-return-params.d.ts.map +1 -0
  305. package/lib/typescript/commonjs/core/models/payment-type.d.ts +18 -0
  306. package/lib/typescript/commonjs/core/models/payment-type.d.ts.map +1 -0
  307. package/lib/typescript/commonjs/core/models/wire-mappers.d.ts +19 -0
  308. package/lib/typescript/commonjs/core/models/wire-mappers.d.ts.map +1 -0
  309. package/lib/typescript/commonjs/core/services/consent-presenter.d.ts +67 -0
  310. package/lib/typescript/commonjs/core/services/consent-presenter.d.ts.map +1 -0
  311. package/lib/typescript/commonjs/core/services/execute-resume-if-needed.d.ts +32 -0
  312. package/lib/typescript/commonjs/core/services/execute-resume-if-needed.d.ts.map +1 -0
  313. package/lib/typescript/commonjs/core/services/multi-payment-rules-presenter.d.ts +9 -0
  314. package/lib/typescript/commonjs/core/services/multi-payment-rules-presenter.d.ts.map +1 -0
  315. package/lib/typescript/commonjs/core/services/payment-flow-controller.d.ts +146 -0
  316. package/lib/typescript/commonjs/core/services/payment-flow-controller.d.ts.map +1 -0
  317. package/lib/typescript/commonjs/core/services/payment-flow-state.d.ts +64 -0
  318. package/lib/typescript/commonjs/core/services/payment-flow-state.d.ts.map +1 -0
  319. package/lib/typescript/commonjs/core/services/payment-result-mapper.d.ts +5 -0
  320. package/lib/typescript/commonjs/core/services/payment-result-mapper.d.ts.map +1 -0
  321. package/lib/typescript/commonjs/core/services/pending-session-store.d.ts +12 -0
  322. package/lib/typescript/commonjs/core/services/pending-session-store.d.ts.map +1 -0
  323. package/lib/typescript/commonjs/core/services/presentation-utils.d.ts +5 -0
  324. package/lib/typescript/commonjs/core/services/presentation-utils.d.ts.map +1 -0
  325. package/lib/typescript/commonjs/core/services/redirect-buffer.d.ts +6 -0
  326. package/lib/typescript/commonjs/core/services/redirect-buffer.d.ts.map +1 -0
  327. package/lib/typescript/commonjs/core/services/user-friendly-messages.d.ts +6 -0
  328. package/lib/typescript/commonjs/core/services/user-friendly-messages.d.ts.map +1 -0
  329. package/lib/typescript/commonjs/index.d.ts +19 -0
  330. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  331. package/lib/typescript/commonjs/internal/bank-redirect.d.ts +6 -0
  332. package/lib/typescript/commonjs/internal/bank-redirect.d.ts.map +1 -0
  333. package/lib/typescript/commonjs/internal/deep-link-listener.d.ts +3 -0
  334. package/lib/typescript/commonjs/internal/deep-link-listener.d.ts.map +1 -0
  335. package/lib/typescript/commonjs/internal/event-emitter.d.ts +13 -0
  336. package/lib/typescript/commonjs/internal/event-emitter.d.ts.map +1 -0
  337. package/lib/typescript/commonjs/internal/index.d.ts +5 -0
  338. package/lib/typescript/commonjs/internal/index.d.ts.map +1 -0
  339. package/lib/typescript/commonjs/internal/logger.d.ts +23 -0
  340. package/lib/typescript/commonjs/internal/logger.d.ts.map +1 -0
  341. package/lib/typescript/commonjs/internal/redact-uri.d.ts +3 -0
  342. package/lib/typescript/commonjs/internal/redact-uri.d.ts.map +1 -0
  343. package/lib/typescript/commonjs/internal/secure-store-pending-session-store.d.ts +33 -0
  344. package/lib/typescript/commonjs/internal/secure-store-pending-session-store.d.ts.map +1 -0
  345. package/lib/typescript/commonjs/internal/telemetry-collector.d.ts +2 -0
  346. package/lib/typescript/commonjs/internal/telemetry-collector.d.ts.map +1 -0
  347. package/lib/typescript/commonjs/package.json +1 -0
  348. package/lib/typescript/commonjs/public/constants.d.ts +12 -0
  349. package/lib/typescript/commonjs/public/constants.d.ts.map +1 -0
  350. package/lib/typescript/commonjs/public/index.d.ts +11 -0
  351. package/lib/typescript/commonjs/public/index.d.ts.map +1 -0
  352. package/lib/typescript/commonjs/public/payment-result.d.ts +43 -0
  353. package/lib/typescript/commonjs/public/payment-result.d.ts.map +1 -0
  354. package/lib/typescript/commonjs/public/recovery-result.d.ts +36 -0
  355. package/lib/typescript/commonjs/public/recovery-result.d.ts.map +1 -0
  356. package/lib/typescript/commonjs/public/spare-link-callbacks.d.ts +14 -0
  357. package/lib/typescript/commonjs/public/spare-link-callbacks.d.ts.map +1 -0
  358. package/lib/typescript/commonjs/public/spare-link-config.d.ts +49 -0
  359. package/lib/typescript/commonjs/public/spare-link-config.d.ts.map +1 -0
  360. package/lib/typescript/commonjs/public/spare-link-event.d.ts +90 -0
  361. package/lib/typescript/commonjs/public/spare-link-event.d.ts.map +1 -0
  362. package/lib/typescript/commonjs/public/spare-link-host-api.d.ts +29 -0
  363. package/lib/typescript/commonjs/public/spare-link-host-api.d.ts.map +1 -0
  364. package/lib/typescript/commonjs/public/spare-link-instance.d.ts +89 -0
  365. package/lib/typescript/commonjs/public/spare-link-instance.d.ts.map +1 -0
  366. package/lib/typescript/commonjs/public/spare-link-session.d.ts +20 -0
  367. package/lib/typescript/commonjs/public/spare-link-session.d.ts.map +1 -0
  368. package/lib/typescript/commonjs/public/spare-link.d.ts +3 -0
  369. package/lib/typescript/commonjs/public/spare-link.d.ts.map +1 -0
  370. package/lib/typescript/commonjs/ui/consent/charge-bearer-display.d.ts +5 -0
  371. package/lib/typescript/commonjs/ui/consent/charge-bearer-display.d.ts.map +1 -0
  372. package/lib/typescript/commonjs/ui/consent/consent-accordion.d.ts +10 -0
  373. package/lib/typescript/commonjs/ui/consent/consent-accordion.d.ts.map +1 -0
  374. package/lib/typescript/commonjs/ui/consent/consent-summary-section.d.ts +6 -0
  375. package/lib/typescript/commonjs/ui/consent/consent-summary-section.d.ts.map +1 -0
  376. package/lib/typescript/commonjs/ui/consent/cop-information.d.ts +6 -0
  377. package/lib/typescript/commonjs/ui/consent/cop-information.d.ts.map +1 -0
  378. package/lib/typescript/commonjs/ui/consent/international-payment-summary.d.ts +6 -0
  379. package/lib/typescript/commonjs/ui/consent/international-payment-summary.d.ts.map +1 -0
  380. package/lib/typescript/commonjs/ui/consent/label-value-rows.d.ts +10 -0
  381. package/lib/typescript/commonjs/ui/consent/label-value-rows.d.ts.map +1 -0
  382. package/lib/typescript/commonjs/ui/consent/multi-payment-rules-list.d.ts +15 -0
  383. package/lib/typescript/commonjs/ui/consent/multi-payment-rules-list.d.ts.map +1 -0
  384. package/lib/typescript/commonjs/ui/consent/multi-payment-summary.d.ts +6 -0
  385. package/lib/typescript/commonjs/ui/consent/multi-payment-summary.d.ts.map +1 -0
  386. package/lib/typescript/commonjs/ui/consent/single-payment-summary.d.ts +6 -0
  387. package/lib/typescript/commonjs/ui/consent/single-payment-summary.d.ts.map +1 -0
  388. package/lib/typescript/commonjs/ui/consent/terms-link.d.ts +2 -0
  389. package/lib/typescript/commonjs/ui/consent/terms-link.d.ts.map +1 -0
  390. package/lib/typescript/commonjs/ui/hooks/use-payment-flow-state.d.ts +9 -0
  391. package/lib/typescript/commonjs/ui/hooks/use-payment-flow-state.d.ts.map +1 -0
  392. package/lib/typescript/commonjs/ui/payment-flow-page.d.ts +20 -0
  393. package/lib/typescript/commonjs/ui/payment-flow-page.d.ts.map +1 -0
  394. package/lib/typescript/commonjs/ui/screens/bank-selection-screen.d.ts +15 -0
  395. package/lib/typescript/commonjs/ui/screens/bank-selection-screen.d.ts.map +1 -0
  396. package/lib/typescript/commonjs/ui/screens/consent-details-screen.d.ts +13 -0
  397. package/lib/typescript/commonjs/ui/screens/consent-details-screen.d.ts.map +1 -0
  398. package/lib/typescript/commonjs/ui/screens/index.d.ts +7 -0
  399. package/lib/typescript/commonjs/ui/screens/index.d.ts.map +1 -0
  400. package/lib/typescript/commonjs/ui/screens/mandate-setup-success-screen.d.ts +10 -0
  401. package/lib/typescript/commonjs/ui/screens/mandate-setup-success-screen.d.ts.map +1 -0
  402. package/lib/typescript/commonjs/ui/screens/redirect-handoff-screen.d.ts +3 -0
  403. package/lib/typescript/commonjs/ui/screens/redirect-handoff-screen.d.ts.map +1 -0
  404. package/lib/typescript/commonjs/ui/screens/result-screen.d.ts +7 -0
  405. package/lib/typescript/commonjs/ui/screens/result-screen.d.ts.map +1 -0
  406. package/lib/typescript/commonjs/ui/screens/resume-processing-screen.d.ts +10 -0
  407. package/lib/typescript/commonjs/ui/screens/resume-processing-screen.d.ts.map +1 -0
  408. package/lib/typescript/commonjs/ui/spare-link-host.d.ts +23 -0
  409. package/lib/typescript/commonjs/ui/spare-link-host.d.ts.map +1 -0
  410. package/lib/typescript/commonjs/ui/theme/assets.d.ts +15 -0
  411. package/lib/typescript/commonjs/ui/theme/assets.d.ts.map +1 -0
  412. package/lib/typescript/commonjs/ui/theme/colors.d.ts +31 -0
  413. package/lib/typescript/commonjs/ui/theme/colors.d.ts.map +1 -0
  414. package/lib/typescript/commonjs/ui/theme/fonts.d.ts +12 -0
  415. package/lib/typescript/commonjs/ui/theme/fonts.d.ts.map +1 -0
  416. package/lib/typescript/commonjs/ui/theme/index.d.ts +11 -0
  417. package/lib/typescript/commonjs/ui/theme/index.d.ts.map +1 -0
  418. package/lib/typescript/commonjs/ui/theme/typography.d.ts +12 -0
  419. package/lib/typescript/commonjs/ui/theme/typography.d.ts.map +1 -0
  420. package/lib/typescript/commonjs/ui/widgets/footer.d.ts +23 -0
  421. package/lib/typescript/commonjs/ui/widgets/footer.d.ts.map +1 -0
  422. package/lib/typescript/commonjs/ui/widgets/gradient-spinner.d.ts +13 -0
  423. package/lib/typescript/commonjs/ui/widgets/gradient-spinner.d.ts.map +1 -0
  424. package/lib/typescript/commonjs/ui/widgets/handoff-screen-layout.d.ts +11 -0
  425. package/lib/typescript/commonjs/ui/widgets/handoff-screen-layout.d.ts.map +1 -0
  426. package/lib/typescript/commonjs/ui/widgets/index.d.ts +6 -0
  427. package/lib/typescript/commonjs/ui/widgets/index.d.ts.map +1 -0
  428. package/lib/typescript/commonjs/ui/widgets/layout-w-header.d.ts +20 -0
  429. package/lib/typescript/commonjs/ui/widgets/layout-w-header.d.ts.map +1 -0
  430. package/lib/typescript/commonjs/ui/widgets/modal-dismiss-button.d.ts +6 -0
  431. package/lib/typescript/commonjs/ui/widgets/modal-dismiss-button.d.ts.map +1 -0
  432. package/lib/typescript/commonjs/ui/widgets/stepper.d.ts +15 -0
  433. package/lib/typescript/commonjs/ui/widgets/stepper.d.ts.map +1 -0
  434. package/lib/typescript/commonjs/version.d.ts +8 -0
  435. package/lib/typescript/commonjs/version.d.ts.map +1 -0
  436. package/lib/typescript/module/core/client/link-api-client.d.ts +70 -0
  437. package/lib/typescript/module/core/client/link-api-client.d.ts.map +1 -0
  438. package/lib/typescript/module/core/errors/payment-api-error.d.ts +15 -0
  439. package/lib/typescript/module/core/errors/payment-api-error.d.ts.map +1 -0
  440. package/lib/typescript/module/core/models/index.d.ts +124 -0
  441. package/lib/typescript/module/core/models/index.d.ts.map +1 -0
  442. package/lib/typescript/module/core/models/link-session-status.d.ts +6 -0
  443. package/lib/typescript/module/core/models/link-session-status.d.ts.map +1 -0
  444. package/lib/typescript/module/core/models/payment-return-params.d.ts +15 -0
  445. package/lib/typescript/module/core/models/payment-return-params.d.ts.map +1 -0
  446. package/lib/typescript/module/core/models/payment-type.d.ts +18 -0
  447. package/lib/typescript/module/core/models/payment-type.d.ts.map +1 -0
  448. package/lib/typescript/module/core/models/wire-mappers.d.ts +19 -0
  449. package/lib/typescript/module/core/models/wire-mappers.d.ts.map +1 -0
  450. package/lib/typescript/module/core/services/consent-presenter.d.ts +67 -0
  451. package/lib/typescript/module/core/services/consent-presenter.d.ts.map +1 -0
  452. package/lib/typescript/module/core/services/execute-resume-if-needed.d.ts +32 -0
  453. package/lib/typescript/module/core/services/execute-resume-if-needed.d.ts.map +1 -0
  454. package/lib/typescript/module/core/services/multi-payment-rules-presenter.d.ts +9 -0
  455. package/lib/typescript/module/core/services/multi-payment-rules-presenter.d.ts.map +1 -0
  456. package/lib/typescript/module/core/services/payment-flow-controller.d.ts +146 -0
  457. package/lib/typescript/module/core/services/payment-flow-controller.d.ts.map +1 -0
  458. package/lib/typescript/module/core/services/payment-flow-state.d.ts +64 -0
  459. package/lib/typescript/module/core/services/payment-flow-state.d.ts.map +1 -0
  460. package/lib/typescript/module/core/services/payment-result-mapper.d.ts +5 -0
  461. package/lib/typescript/module/core/services/payment-result-mapper.d.ts.map +1 -0
  462. package/lib/typescript/module/core/services/pending-session-store.d.ts +12 -0
  463. package/lib/typescript/module/core/services/pending-session-store.d.ts.map +1 -0
  464. package/lib/typescript/module/core/services/presentation-utils.d.ts +5 -0
  465. package/lib/typescript/module/core/services/presentation-utils.d.ts.map +1 -0
  466. package/lib/typescript/module/core/services/redirect-buffer.d.ts +6 -0
  467. package/lib/typescript/module/core/services/redirect-buffer.d.ts.map +1 -0
  468. package/lib/typescript/module/core/services/user-friendly-messages.d.ts +6 -0
  469. package/lib/typescript/module/core/services/user-friendly-messages.d.ts.map +1 -0
  470. package/lib/typescript/module/index.d.ts +19 -0
  471. package/lib/typescript/module/index.d.ts.map +1 -0
  472. package/lib/typescript/module/internal/bank-redirect.d.ts +6 -0
  473. package/lib/typescript/module/internal/bank-redirect.d.ts.map +1 -0
  474. package/lib/typescript/module/internal/deep-link-listener.d.ts +3 -0
  475. package/lib/typescript/module/internal/deep-link-listener.d.ts.map +1 -0
  476. package/lib/typescript/module/internal/event-emitter.d.ts +13 -0
  477. package/lib/typescript/module/internal/event-emitter.d.ts.map +1 -0
  478. package/lib/typescript/module/internal/index.d.ts +5 -0
  479. package/lib/typescript/module/internal/index.d.ts.map +1 -0
  480. package/lib/typescript/module/internal/logger.d.ts +23 -0
  481. package/lib/typescript/module/internal/logger.d.ts.map +1 -0
  482. package/lib/typescript/module/internal/redact-uri.d.ts +3 -0
  483. package/lib/typescript/module/internal/redact-uri.d.ts.map +1 -0
  484. package/lib/typescript/module/internal/secure-store-pending-session-store.d.ts +33 -0
  485. package/lib/typescript/module/internal/secure-store-pending-session-store.d.ts.map +1 -0
  486. package/lib/typescript/module/internal/telemetry-collector.d.ts +2 -0
  487. package/lib/typescript/module/internal/telemetry-collector.d.ts.map +1 -0
  488. package/lib/typescript/module/package.json +1 -0
  489. package/lib/typescript/module/public/constants.d.ts +12 -0
  490. package/lib/typescript/module/public/constants.d.ts.map +1 -0
  491. package/lib/typescript/module/public/index.d.ts +11 -0
  492. package/lib/typescript/module/public/index.d.ts.map +1 -0
  493. package/lib/typescript/module/public/payment-result.d.ts +43 -0
  494. package/lib/typescript/module/public/payment-result.d.ts.map +1 -0
  495. package/lib/typescript/module/public/recovery-result.d.ts +36 -0
  496. package/lib/typescript/module/public/recovery-result.d.ts.map +1 -0
  497. package/lib/typescript/module/public/spare-link-callbacks.d.ts +14 -0
  498. package/lib/typescript/module/public/spare-link-callbacks.d.ts.map +1 -0
  499. package/lib/typescript/module/public/spare-link-config.d.ts +49 -0
  500. package/lib/typescript/module/public/spare-link-config.d.ts.map +1 -0
  501. package/lib/typescript/module/public/spare-link-event.d.ts +90 -0
  502. package/lib/typescript/module/public/spare-link-event.d.ts.map +1 -0
  503. package/lib/typescript/module/public/spare-link-host-api.d.ts +29 -0
  504. package/lib/typescript/module/public/spare-link-host-api.d.ts.map +1 -0
  505. package/lib/typescript/module/public/spare-link-instance.d.ts +89 -0
  506. package/lib/typescript/module/public/spare-link-instance.d.ts.map +1 -0
  507. package/lib/typescript/module/public/spare-link-session.d.ts +20 -0
  508. package/lib/typescript/module/public/spare-link-session.d.ts.map +1 -0
  509. package/lib/typescript/module/public/spare-link.d.ts +3 -0
  510. package/lib/typescript/module/public/spare-link.d.ts.map +1 -0
  511. package/lib/typescript/module/ui/consent/charge-bearer-display.d.ts +5 -0
  512. package/lib/typescript/module/ui/consent/charge-bearer-display.d.ts.map +1 -0
  513. package/lib/typescript/module/ui/consent/consent-accordion.d.ts +10 -0
  514. package/lib/typescript/module/ui/consent/consent-accordion.d.ts.map +1 -0
  515. package/lib/typescript/module/ui/consent/consent-summary-section.d.ts +6 -0
  516. package/lib/typescript/module/ui/consent/consent-summary-section.d.ts.map +1 -0
  517. package/lib/typescript/module/ui/consent/cop-information.d.ts +6 -0
  518. package/lib/typescript/module/ui/consent/cop-information.d.ts.map +1 -0
  519. package/lib/typescript/module/ui/consent/international-payment-summary.d.ts +6 -0
  520. package/lib/typescript/module/ui/consent/international-payment-summary.d.ts.map +1 -0
  521. package/lib/typescript/module/ui/consent/label-value-rows.d.ts +10 -0
  522. package/lib/typescript/module/ui/consent/label-value-rows.d.ts.map +1 -0
  523. package/lib/typescript/module/ui/consent/multi-payment-rules-list.d.ts +15 -0
  524. package/lib/typescript/module/ui/consent/multi-payment-rules-list.d.ts.map +1 -0
  525. package/lib/typescript/module/ui/consent/multi-payment-summary.d.ts +6 -0
  526. package/lib/typescript/module/ui/consent/multi-payment-summary.d.ts.map +1 -0
  527. package/lib/typescript/module/ui/consent/single-payment-summary.d.ts +6 -0
  528. package/lib/typescript/module/ui/consent/single-payment-summary.d.ts.map +1 -0
  529. package/lib/typescript/module/ui/consent/terms-link.d.ts +2 -0
  530. package/lib/typescript/module/ui/consent/terms-link.d.ts.map +1 -0
  531. package/lib/typescript/module/ui/hooks/use-payment-flow-state.d.ts +9 -0
  532. package/lib/typescript/module/ui/hooks/use-payment-flow-state.d.ts.map +1 -0
  533. package/lib/typescript/module/ui/payment-flow-page.d.ts +20 -0
  534. package/lib/typescript/module/ui/payment-flow-page.d.ts.map +1 -0
  535. package/lib/typescript/module/ui/screens/bank-selection-screen.d.ts +15 -0
  536. package/lib/typescript/module/ui/screens/bank-selection-screen.d.ts.map +1 -0
  537. package/lib/typescript/module/ui/screens/consent-details-screen.d.ts +13 -0
  538. package/lib/typescript/module/ui/screens/consent-details-screen.d.ts.map +1 -0
  539. package/lib/typescript/module/ui/screens/index.d.ts +7 -0
  540. package/lib/typescript/module/ui/screens/index.d.ts.map +1 -0
  541. package/lib/typescript/module/ui/screens/mandate-setup-success-screen.d.ts +10 -0
  542. package/lib/typescript/module/ui/screens/mandate-setup-success-screen.d.ts.map +1 -0
  543. package/lib/typescript/module/ui/screens/redirect-handoff-screen.d.ts +3 -0
  544. package/lib/typescript/module/ui/screens/redirect-handoff-screen.d.ts.map +1 -0
  545. package/lib/typescript/module/ui/screens/result-screen.d.ts +7 -0
  546. package/lib/typescript/module/ui/screens/result-screen.d.ts.map +1 -0
  547. package/lib/typescript/module/ui/screens/resume-processing-screen.d.ts +10 -0
  548. package/lib/typescript/module/ui/screens/resume-processing-screen.d.ts.map +1 -0
  549. package/lib/typescript/module/ui/spare-link-host.d.ts +23 -0
  550. package/lib/typescript/module/ui/spare-link-host.d.ts.map +1 -0
  551. package/lib/typescript/module/ui/theme/assets.d.ts +15 -0
  552. package/lib/typescript/module/ui/theme/assets.d.ts.map +1 -0
  553. package/lib/typescript/module/ui/theme/colors.d.ts +31 -0
  554. package/lib/typescript/module/ui/theme/colors.d.ts.map +1 -0
  555. package/lib/typescript/module/ui/theme/fonts.d.ts +12 -0
  556. package/lib/typescript/module/ui/theme/fonts.d.ts.map +1 -0
  557. package/lib/typescript/module/ui/theme/index.d.ts +11 -0
  558. package/lib/typescript/module/ui/theme/index.d.ts.map +1 -0
  559. package/lib/typescript/module/ui/theme/typography.d.ts +12 -0
  560. package/lib/typescript/module/ui/theme/typography.d.ts.map +1 -0
  561. package/lib/typescript/module/ui/widgets/footer.d.ts +23 -0
  562. package/lib/typescript/module/ui/widgets/footer.d.ts.map +1 -0
  563. package/lib/typescript/module/ui/widgets/gradient-spinner.d.ts +13 -0
  564. package/lib/typescript/module/ui/widgets/gradient-spinner.d.ts.map +1 -0
  565. package/lib/typescript/module/ui/widgets/handoff-screen-layout.d.ts +11 -0
  566. package/lib/typescript/module/ui/widgets/handoff-screen-layout.d.ts.map +1 -0
  567. package/lib/typescript/module/ui/widgets/index.d.ts +6 -0
  568. package/lib/typescript/module/ui/widgets/index.d.ts.map +1 -0
  569. package/lib/typescript/module/ui/widgets/layout-w-header.d.ts +20 -0
  570. package/lib/typescript/module/ui/widgets/layout-w-header.d.ts.map +1 -0
  571. package/lib/typescript/module/ui/widgets/modal-dismiss-button.d.ts +6 -0
  572. package/lib/typescript/module/ui/widgets/modal-dismiss-button.d.ts.map +1 -0
  573. package/lib/typescript/module/ui/widgets/stepper.d.ts +15 -0
  574. package/lib/typescript/module/ui/widgets/stepper.d.ts.map +1 -0
  575. package/lib/typescript/module/version.d.ts +8 -0
  576. package/lib/typescript/module/version.d.ts.map +1 -0
  577. package/package.json +124 -0
  578. package/plugins/with-spare-link.js +98 -0
  579. package/src/core/client/link-api-client.ts +414 -0
  580. package/src/core/errors/payment-api-error.ts +35 -0
  581. package/src/core/models/index.ts +139 -0
  582. package/src/core/models/link-session-status.ts +7 -0
  583. package/src/core/models/payment-return-params.ts +34 -0
  584. package/src/core/models/payment-type.ts +54 -0
  585. package/src/core/models/wire-mappers.ts +315 -0
  586. package/src/core/services/consent-presenter.ts +213 -0
  587. package/src/core/services/execute-resume-if-needed.ts +243 -0
  588. package/src/core/services/multi-payment-rules-presenter.ts +158 -0
  589. package/src/core/services/payment-flow-controller.ts +607 -0
  590. package/src/core/services/payment-flow-state.ts +124 -0
  591. package/src/core/services/payment-result-mapper.ts +41 -0
  592. package/src/core/services/pending-session-store.ts +12 -0
  593. package/src/core/services/presentation-utils.ts +4 -0
  594. package/src/core/services/redirect-buffer.ts +34 -0
  595. package/src/core/services/user-friendly-messages.ts +39 -0
  596. package/src/index.ts +115 -0
  597. package/src/internal/bank-redirect.ts +61 -0
  598. package/src/internal/deep-link-listener.ts +31 -0
  599. package/src/internal/event-emitter.ts +42 -0
  600. package/src/internal/index.ts +4 -0
  601. package/src/internal/logger.ts +81 -0
  602. package/src/internal/redact-uri.ts +18 -0
  603. package/src/internal/secure-store-pending-session-store.ts +131 -0
  604. package/src/internal/telemetry-collector.ts +90 -0
  605. package/src/public/constants.ts +14 -0
  606. package/src/public/index.ts +80 -0
  607. package/src/public/payment-result.ts +61 -0
  608. package/src/public/recovery-result.ts +49 -0
  609. package/src/public/spare-link-callbacks.ts +20 -0
  610. package/src/public/spare-link-config.ts +87 -0
  611. package/src/public/spare-link-event.ts +146 -0
  612. package/src/public/spare-link-host-api.ts +28 -0
  613. package/src/public/spare-link-instance.ts +289 -0
  614. package/src/public/spare-link-session.ts +28 -0
  615. package/src/public/spare-link.ts +2 -0
  616. package/src/ui/consent/charge-bearer-display.tsx +68 -0
  617. package/src/ui/consent/consent-accordion.tsx +89 -0
  618. package/src/ui/consent/consent-summary-section.tsx +19 -0
  619. package/src/ui/consent/cop-information.tsx +121 -0
  620. package/src/ui/consent/international-payment-summary.tsx +83 -0
  621. package/src/ui/consent/label-value-rows.tsx +50 -0
  622. package/src/ui/consent/multi-payment-rules-list.tsx +138 -0
  623. package/src/ui/consent/multi-payment-summary.tsx +82 -0
  624. package/src/ui/consent/single-payment-summary.tsx +123 -0
  625. package/src/ui/consent/terms-link.tsx +27 -0
  626. package/src/ui/hooks/use-payment-flow-state.ts +16 -0
  627. package/src/ui/payment-flow-page.tsx +254 -0
  628. package/src/ui/screens/bank-selection-screen.tsx +209 -0
  629. package/src/ui/screens/consent-details-screen.tsx +106 -0
  630. package/src/ui/screens/index.ts +12 -0
  631. package/src/ui/screens/mandate-setup-success-screen.tsx +72 -0
  632. package/src/ui/screens/redirect-handoff-screen.tsx +33 -0
  633. package/src/ui/screens/result-screen.tsx +71 -0
  634. package/src/ui/screens/resume-processing-screen.tsx +111 -0
  635. package/src/ui/spare-link-host.tsx +394 -0
  636. package/src/ui/theme/assets.ts +17 -0
  637. package/src/ui/theme/colors.ts +32 -0
  638. package/src/ui/theme/fonts.ts +25 -0
  639. package/src/ui/theme/index.ts +11 -0
  640. package/src/ui/theme/typography.ts +47 -0
  641. package/src/ui/widgets/footer.tsx +138 -0
  642. package/src/ui/widgets/gradient-spinner.tsx +156 -0
  643. package/src/ui/widgets/handoff-screen-layout.tsx +70 -0
  644. package/src/ui/widgets/index.ts +5 -0
  645. package/src/ui/widgets/layout-w-header.tsx +89 -0
  646. package/src/ui/widgets/modal-dismiss-button.tsx +44 -0
  647. package/src/ui/widgets/stepper.tsx +126 -0
  648. package/src/version.ts +7 -0
@@ -0,0 +1,547 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.PaymentFlowController = void 0;
7
+ var _logger = require("../../internal/logger.js");
8
+ var _redactUri = require("../../internal/redact-uri.js");
9
+ var _constants = require("../../public/constants.js");
10
+ var _paymentApiError = require("../errors/payment-api-error.js");
11
+ var _linkSessionStatus = require("../models/link-session-status.js");
12
+ var _paymentReturnParams = require("../models/payment-return-params.js");
13
+ var _paymentType = require("../models/payment-type.js");
14
+ var _paymentFlowState = require("./payment-flow-state.js");
15
+ /** Simple string tag for internal controller callbacks — not the public SpareLinkEvent. */
16
+
17
+ /** Minimum surface required from a `Clock` injected for testability. */
18
+
19
+ const REAL_CLOCK = {
20
+ now: () => Date.now()
21
+ };
22
+
23
+ /**
24
+ * Number of consecutive `pollStatus` transport failures we tolerate before
25
+ * giving up and transitioning to `failed('network_error')`. Bounds the request
26
+ * volume against a flaky network during the 5-minute awaiting-callback window.
27
+ */
28
+ const POLL_STATUS_MAX_CONSECUTIVE_FAILURES = 5;
29
+ const log = (0, _logger.createLogger)('PaymentFlowController');
30
+ const TERMINAL_PHASES = new Set(['succeeded', 'failed', 'cancelled']);
31
+ function isTerminal(phase) {
32
+ return TERMINAL_PHASES.has(phase);
33
+ }
34
+
35
+ /**
36
+ * Drives the payment flow state machine. Exposes a `subscribe`/`unsubscribe`
37
+ * API so React's `useSyncExternalStore` can bridge to a hook.
38
+ *
39
+ * `subscribe` fires the listener synchronously with the current state so new
40
+ * subscribers don't miss the initial snapshot.
41
+ */
42
+ class PaymentFlowController {
43
+ _state = _paymentFlowState.PaymentFlowStates.idle();
44
+ _listeners = new Set();
45
+
46
+ /** Last provider the user selected — retained so success/awaiting states that
47
+ * arrive without it (poll/callback) can still report `bankId`. */
48
+
49
+ _disposed = false;
50
+ /** Re-entrance guard — second `hydrate()` returns the in-flight promise. */
51
+
52
+ /** Consecutive `pollStatus` transport failures since the last successful response. */
53
+ _pollStatusConsecutiveFailures = 0;
54
+ constructor(opts) {
55
+ this.sessionToken = opts.sessionToken;
56
+ this.apiClient = opts.apiClient;
57
+ if (opts.pendingSessionStore) this.pendingSessionStore = opts.pendingSessionStore;
58
+ this.awaitingCallbackTimeoutMs = opts.awaitingCallbackTimeoutMs ?? _constants.DEFAULT_AWAITING_CALLBACK_TIMEOUT_MS;
59
+ this.environment = opts.environment ?? 'production';
60
+ this.awaitingCallbackPollMs = opts.awaitingCallbackPollMs ?? _constants.DEFAULT_AWAITING_CALLBACK_POLL_MS;
61
+ this.clock = opts.clock ?? REAL_CLOCK;
62
+ if (opts.collectTelemetry) this.collectTelemetry = opts.collectTelemetry;
63
+ this.uuid = opts.uuid ?? fallbackUuid;
64
+ if (opts.onEvent) this.onEventCallback = opts.onEvent;
65
+ }
66
+
67
+ // ---- Subscription API ----------------------------------------------------
68
+
69
+ get state() {
70
+ return this._state;
71
+ }
72
+ get awaitingCallbackStartedAtMs() {
73
+ return this._awaitingCallbackStartedAtMs;
74
+ }
75
+
76
+ /**
77
+ * Register a listener. The listener is invoked synchronously with the
78
+ * current state so new subscribers have the initial snapshot, then again
79
+ * on every subsequent change.
80
+ */
81
+ subscribe(listener) {
82
+ this._listeners.add(listener);
83
+ try {
84
+ listener(this._state);
85
+ } catch {
86
+ // swallow — listener bugs never break the controller
87
+ }
88
+ return () => {
89
+ this._listeners.delete(listener);
90
+ };
91
+ }
92
+ setState(next) {
93
+ if (this._disposed) return;
94
+ this._state = next;
95
+ if (isTerminal(next.phase)) {
96
+ this.cancelCallbackTimeout();
97
+ this._consentIdempotencyKey = undefined;
98
+ }
99
+ for (const l of this._listeners) {
100
+ try {
101
+ l(next);
102
+ } catch {
103
+ // listener exceptions never break the controller
104
+ }
105
+ }
106
+ }
107
+ fireEvent(event) {
108
+ try {
109
+ this.onEventCallback?.(event);
110
+ } catch {
111
+ // swallow integrator errors
112
+ }
113
+ }
114
+
115
+ // ---- Timers --------------------------------------------------------------
116
+
117
+ cancelCallbackTimeout() {
118
+ if (this._callbackTimer) {
119
+ clearTimeout(this._callbackTimer);
120
+ this._callbackTimer = undefined;
121
+ }
122
+ }
123
+ startCallbackTimeout() {
124
+ this.cancelCallbackTimeout();
125
+ this._callbackTimer = setTimeout(() => {
126
+ if (this._state.phase !== 'awaitingCallback') return;
127
+ void this.reportError('session_timeout');
128
+ }, this.awaitingCallbackTimeoutMs);
129
+ }
130
+
131
+ // ---- Phase transitions ---------------------------------------------------
132
+
133
+ /**
134
+ * `GET /link` + `GET /link/providers`, then transitions to bankSelection.
135
+ * Re-entrant: a second concurrent call returns the in-flight promise instead
136
+ * of firing duplicate requests.
137
+ */
138
+ hydrate() {
139
+ if (this._disposed) return Promise.resolve();
140
+ if (this._hydratePromise) return this._hydratePromise;
141
+ this._hydratePromise = this._doHydrate().finally(() => {
142
+ this._hydratePromise = undefined;
143
+ });
144
+ return this._hydratePromise;
145
+ }
146
+ async _doHydrate() {
147
+ log.info('hydrate: starting session hydration');
148
+ this.setState(_paymentFlowState.PaymentFlowStates.hydrating());
149
+ try {
150
+ const [session, providers] = await Promise.all([this.apiClient.getSession(this.sessionToken), this.apiClient.getProviders(this.sessionToken)]);
151
+ log.info(`hydrate: loaded session with ${providers.length} provider(s)`);
152
+ this.setState(_paymentFlowState.PaymentFlowStates.bankSelection({
153
+ session,
154
+ providers
155
+ }));
156
+ this.fireEvent('sessionLoaded');
157
+ } catch (err) {
158
+ log.severe(`hydrate: failed — ${err instanceof Error ? err.message : String(err)}`);
159
+ const code = (0, _paymentApiError.isPaymentApiError)(err) ? err.code : 'hydration_error';
160
+ const message = err instanceof Error ? err.message : String(err);
161
+ this.setState(_paymentFlowState.PaymentFlowStates.failed({
162
+ errorCode: code,
163
+ errorMessage: message
164
+ }));
165
+ throw err;
166
+ }
167
+ }
168
+
169
+ /** Move bankSelection → consentDetails. */
170
+ selectBank(bankId) {
171
+ log.info(`selectBank: bankId=${bankId}`);
172
+ const current = this._state;
173
+ const session = current.session;
174
+ if (!session) {
175
+ throw new Error('Cannot select bank before session is loaded.');
176
+ }
177
+ const provider = current.providers.find(p => p.id === bankId);
178
+ if (!provider) {
179
+ log.severe(`selectBank: unknown bankId=${bankId}`);
180
+ throw new Error(`Unknown bank id: ${bankId}`);
181
+ }
182
+ // Retained so success states reached via poll/callback (which don't carry
183
+ // the provider) still resolve a `bankId` in the PaymentResult.
184
+ this._selectedProvider = provider;
185
+ const willLoadCop = this.shouldPerformCop(session);
186
+ this.setState(_paymentFlowState.PaymentFlowStates.consentDetails({
187
+ session,
188
+ selectedProvider: provider,
189
+ isCopLoading: willLoadCop,
190
+ copApplicable: willLoadCop
191
+ }));
192
+ if (willLoadCop) {
193
+ this.loadCopInBackground(session, provider);
194
+ }
195
+ }
196
+
197
+ /**
198
+ * Best-effort Confirmation-of-Payee fetch — never blocks {@link selectBank}
199
+ * or fails the flow. Mirrors the Flutter controller: gated to UAE + un-verified
200
+ * sessions, and the result is merged into the consentDetails state only if the
201
+ * user is still on that screen for the same provider. Ported from
202
+ * `payment_flow_controller.dart:_loadCopInBackground`.
203
+ */
204
+ loadCopInBackground(session, provider) {
205
+ void (async () => {
206
+ const cop = await this.getCoP(provider.id);
207
+ if (this._state.phase !== 'consentDetails') return;
208
+ if (this._state.selectedProvider?.id !== provider.id) return;
209
+ this.setState(_paymentFlowState.PaymentFlowStates.consentDetails({
210
+ session,
211
+ selectedProvider: provider,
212
+ ...(cop ? {
213
+ copResponse: cop
214
+ } : {}),
215
+ isCopLoading: false,
216
+ copApplicable: true
217
+ }));
218
+ })();
219
+ }
220
+ shouldPerformCop(session) {
221
+ if (this.apiClient.tenantHeader !== 'UAE') return false;
222
+ if (session.request.isCopVerified === true) return false;
223
+ if (!(0, _paymentType.supportsConfirmationOfPayee)(session.request)) return false;
224
+ return true;
225
+ }
226
+
227
+ /** `POST /link/consent`, persists pending record, transitions to redirecting. */
228
+ async confirmConsent() {
229
+ log.info('confirmConsent: posting consent');
230
+ const selectedProvider = this._state.selectedProvider;
231
+ if (!selectedProvider) {
232
+ log.severe('confirmConsent: no provider selected');
233
+ throw new Error('Cannot confirm consent without a selected provider.');
234
+ }
235
+ this.fireEvent('consentStarted');
236
+ if (!this._consentIdempotencyKey) {
237
+ this._consentIdempotencyKey = this.uuid();
238
+ }
239
+
240
+ // Best-effort telemetry before posting consent.
241
+ await this.postTelemetryAutomatic();
242
+ let consent;
243
+ try {
244
+ consent = await this.apiClient.postConsent({
245
+ linkToken: this.sessionToken,
246
+ bankId: selectedProvider.id,
247
+ idempotencyKey: this._consentIdempotencyKey
248
+ });
249
+ } catch (err) {
250
+ // Without this the flow would be stranded in `consentDetails` with no
251
+ // terminal state — the caller's catch assumes we already transitioned.
252
+ const code = (0, _paymentApiError.isPaymentApiError)(err) ? err.code : 'consent_failed';
253
+ const message = err instanceof Error ? err.message : String(err);
254
+ this.setState(_paymentFlowState.PaymentFlowStates.failed({
255
+ errorCode: code,
256
+ errorMessage: message
257
+ }));
258
+ void this.patchTokenBestEffort('error', code);
259
+ throw err;
260
+ }
261
+ if (this.pendingSessionStore) {
262
+ try {
263
+ const merchantRef = this._state.session?.request?.merchantReference;
264
+ await this.pendingSessionStore.save({
265
+ sessionId: this.sessionToken,
266
+ selectedBankId: selectedProvider.id,
267
+ authorizationUrl: consent.redirectUrl,
268
+ consentAt: this.clock.now(),
269
+ recoveryAttempts: 0,
270
+ ...(merchantRef ? {
271
+ merchantRef
272
+ } : {})
273
+ });
274
+ } catch {
275
+ log.warning('confirmConsent: store.save() failed — continuing');
276
+ // store failures should not block the flow
277
+ }
278
+ }
279
+ log.info('confirmConsent: → redirecting');
280
+ this.setState(_paymentFlowState.PaymentFlowStates.redirecting({
281
+ consent,
282
+ selectedProvider
283
+ }));
284
+ }
285
+
286
+ /**
287
+ * Parses a callback URI and transitions to succeeded / failed. Accepts either
288
+ * a `URL` instance or a string. A malformed URI resolves to
289
+ * `failed('invalid_callback')` instead of throwing.
290
+ */
291
+ handleCallback(uri) {
292
+ log.info(`handleCallback: received URI=${(0, _redactUri.redactPaymentReturnUri)(typeof uri === 'string' ? uri : uri.toString())}`);
293
+ // Deep-link callbacks are commonly re-delivered (cold start + warm
294
+ // foreground). Once the flow is terminal, ignore further callbacks so we
295
+ // never re-transition and re-fire terminal callbacks.
296
+ if (isTerminal(this._state.phase)) return;
297
+ let url;
298
+ if (typeof uri === 'string') {
299
+ try {
300
+ url = new URL(uri);
301
+ } catch {
302
+ this.setState(_paymentFlowState.PaymentFlowStates.failed({
303
+ errorCode: 'invalid_callback',
304
+ errorMessage: 'The callback URI could not be parsed.'
305
+ }));
306
+ return;
307
+ }
308
+ } else {
309
+ url = uri;
310
+ }
311
+ this.fireEvent('bankCallbackReceived');
312
+ const params = url.searchParams;
313
+
314
+ // Prefer the new `error_code` query param over legacy `error`. Also accept
315
+ // `status=failure` with no other code as `authorize_failed`.
316
+ const error = (0, _paymentReturnParams.extractPaymentReturnErrorCode)(params);
317
+ if (error) {
318
+ const description = params.get('error_description') ?? undefined;
319
+ this.setState(_paymentFlowState.PaymentFlowStates.failed({
320
+ errorCode: error,
321
+ ...(description ? {
322
+ errorMessage: description
323
+ } : {})
324
+ }));
325
+ return;
326
+ }
327
+ const exchangeCode = params.get('exchange_code') ?? undefined;
328
+ const linkSessionId = params.get('session_id') ?? undefined;
329
+ const merchantRef = params.get('merchantRef') ?? undefined;
330
+ if (exchangeCode) {
331
+ this.setState(_paymentFlowState.PaymentFlowStates.succeeded({
332
+ exchangeCode,
333
+ ...(linkSessionId ? {
334
+ linkSessionId
335
+ } : {}),
336
+ ...(merchantRef ? {
337
+ merchantRef
338
+ } : {}),
339
+ ...(this._selectedProvider ? {
340
+ selectedProvider: this._selectedProvider
341
+ } : {}),
342
+ ...(this._state.session ? {
343
+ session: this._state.session
344
+ } : {})
345
+ }));
346
+ return;
347
+ }
348
+ this.setState(_paymentFlowState.PaymentFlowStates.failed({
349
+ errorCode: 'invalid_callback',
350
+ errorMessage: 'The callback URI is missing required parameters.'
351
+ }));
352
+ }
353
+
354
+ /** Best-effort cancel — PATCH /link with action=cancel, then transitions to cancelled. */
355
+ async cancel() {
356
+ log.info('cancel: user cancelled the payment flow');
357
+ await this.patchTokenBestEffort('cancel');
358
+ this.setState(_paymentFlowState.PaymentFlowStates.cancelled());
359
+ }
360
+
361
+ /** Best-effort error report — sets failed state immediately, PATCH is fire-and-forget. */
362
+ async reportError(code) {
363
+ log.severe(`reportError: reporting error code=${code}`);
364
+ this.setState(_paymentFlowState.PaymentFlowStates.failed({
365
+ errorCode: code
366
+ }));
367
+ // Fire-and-forget; we already transitioned.
368
+ void this.patchTokenBestEffort('error', code);
369
+ }
370
+ async patchTokenBestEffort(action, errorCode) {
371
+ try {
372
+ await this.apiClient.patchToken({
373
+ linkToken: this.sessionToken,
374
+ action,
375
+ ...(errorCode ? {
376
+ errorCode
377
+ } : {})
378
+ });
379
+ } catch {
380
+ // swallow — PATCH is best-effort
381
+ }
382
+ }
383
+
384
+ /**
385
+ * UI calls this after handing off to the bank — starts the 5-minute timeout
386
+ * and pins the awaiting-callback start time.
387
+ */
388
+ setAwaitingCallbackState(args = {}) {
389
+ this._awaitingCallbackStartedAtMs ??= this.clock.now();
390
+ this.setState(_paymentFlowState.PaymentFlowStates.awaitingCallback({
391
+ ...(args.providerName ? {
392
+ providerName: args.providerName
393
+ } : {}),
394
+ ...(this._state.session ? {
395
+ session: this._state.session
396
+ } : {}),
397
+ ...(this._selectedProvider ? {
398
+ selectedProvider: this._selectedProvider
399
+ } : {})
400
+ }));
401
+ this.startCallbackTimeout();
402
+ }
403
+
404
+ /**
405
+ * Best-effort status polling. Transitions to a terminal state on
406
+ * `completed | failed | cancelled | expired`; otherwise leaves the flow in
407
+ * the current phase. After {@link POLL_STATUS_MAX_CONSECUTIVE_FAILURES}
408
+ * consecutive transport failures the controller gives up with
409
+ * `failed('network_error')` to stop hammering an unreachable backend.
410
+ */
411
+ async pollStatus() {
412
+ // A status response can land after a bank callback or the timeout has
413
+ // already resolved the flow; never overwrite a terminal state.
414
+ if (isTerminal(this._state.phase)) return;
415
+ try {
416
+ const status = await this.apiClient.getStatus(this.sessionToken);
417
+ this._pollStatusConsecutiveFailures = 0;
418
+ // Re-check: the await above yields, so a terminal callback may have
419
+ // arrived while the request was in flight.
420
+ if (isTerminal(this._state.phase)) return;
421
+ switch (status.status) {
422
+ case 'completed':
423
+ this.setState(_paymentFlowState.PaymentFlowStates.succeeded({
424
+ ...(status.linkSessionId ? {
425
+ linkSessionId: status.linkSessionId
426
+ } : {}),
427
+ ...(this._selectedProvider ? {
428
+ selectedProvider: this._selectedProvider
429
+ } : {}),
430
+ ...(this._state.session ? {
431
+ session: this._state.session
432
+ } : {})
433
+ }));
434
+ return;
435
+ case 'failed':
436
+ this.setState(_paymentFlowState.PaymentFlowStates.failed({
437
+ errorCode: status.failureCode ?? 'session_failed'
438
+ }));
439
+ return;
440
+ case 'cancelled':
441
+ this.setState(_paymentFlowState.PaymentFlowStates.cancelled());
442
+ return;
443
+ case 'expired':
444
+ this.setState(_paymentFlowState.PaymentFlowStates.failed({
445
+ errorCode: 'session_expired'
446
+ }));
447
+ return;
448
+ default:
449
+ // Non-terminal. In sandbox, only treat `callback_received` as success —
450
+ // the bank has actually returned. `redirected` means consent was posted
451
+ // but the user may not have authorized yet; auto-success there caused
452
+ // false positives on cold-start recovery.
453
+ if (this.environment === 'sandbox' && this._state.phase === 'awaitingCallback' && (0, _linkSessionStatus.isBankCallbackReceivedStatus)(status.status)) {
454
+ this.setState(_paymentFlowState.PaymentFlowStates.succeeded({
455
+ ...(status.linkSessionId ? {
456
+ linkSessionId: status.linkSessionId
457
+ } : {}),
458
+ ...(this._selectedProvider ? {
459
+ selectedProvider: this._selectedProvider
460
+ } : {}),
461
+ ...(this._state.session ? {
462
+ session: this._state.session
463
+ } : {})
464
+ }));
465
+ }
466
+ return;
467
+ }
468
+ } catch {
469
+ this._pollStatusConsecutiveFailures += 1;
470
+ log.warning(`pollStatus: failed (${this._pollStatusConsecutiveFailures}/${POLL_STATUS_MAX_CONSECUTIVE_FAILURES})`);
471
+ if (this._pollStatusConsecutiveFailures >= POLL_STATUS_MAX_CONSECUTIVE_FAILURES) {
472
+ if (isTerminal(this._state.phase) || this._state.phase !== 'awaitingCallback') return;
473
+ this.setState(_paymentFlowState.PaymentFlowStates.failed({
474
+ errorCode: 'network_error',
475
+ errorMessage: 'Unable to reach the Spare backend after multiple attempts.'
476
+ }));
477
+ }
478
+ }
479
+ }
480
+
481
+ /** Best-effort telemetry — never throws, never changes state. */
482
+ async postTelemetry(payload) {
483
+ try {
484
+ await this.apiClient.postTelemetry({
485
+ linkToken: this.sessionToken,
486
+ payload
487
+ });
488
+ } catch (err) {
489
+ log.warning(`postTelemetry: best-effort telemetry failed — ${err instanceof Error ? err.message : String(err)}`);
490
+ }
491
+ }
492
+
493
+ /** Best-effort CoP — returns result or null on failure. */
494
+ async getCoP(providerId) {
495
+ try {
496
+ return await this.apiClient.getConfirmPayee(this.sessionToken, providerId);
497
+ } catch {
498
+ return null;
499
+ }
500
+ }
501
+ async postTelemetryAutomatic() {
502
+ if (!this.collectTelemetry) return;
503
+ log.fine('postTelemetryAutomatic: collecting and posting device telemetry');
504
+ try {
505
+ const payload = await this.collectTelemetry();
506
+ await this.apiClient.postTelemetry({
507
+ linkToken: this.sessionToken,
508
+ payload
509
+ });
510
+ } catch (err) {
511
+ log.warning(`postTelemetryAutomatic: failed — ${err instanceof Error ? err.message : String(err)}`);
512
+ }
513
+ }
514
+
515
+ /** Returns the active providers list — convenience for the UI layer. */
516
+ get providers() {
517
+ return this._state.providers;
518
+ }
519
+
520
+ /** Returns the active session, if any. */
521
+ get session() {
522
+ return this._state.session;
523
+ }
524
+
525
+ /**
526
+ * Releases resources: cancels timers, clears listeners, and aborts the
527
+ * underlying API client's in-flight fetches. Idempotent.
528
+ */
529
+ dispose() {
530
+ if (this._disposed) return;
531
+ log.info('dispose: releasing apiClient');
532
+ this._disposed = true;
533
+ this.cancelCallbackTimeout();
534
+ this._listeners.clear();
535
+ this.apiClient.dispose();
536
+ }
537
+ }
538
+ exports.PaymentFlowController = PaymentFlowController;
539
+ function fallbackUuid() {
540
+ const bytes = new Uint8Array(16);
541
+ for (let i = 0; i < 16; i += 1) bytes[i] = Math.floor(Math.random() * 256);
542
+ bytes[6] = (bytes[6] ?? 0) & 0x0f | 0x40;
543
+ bytes[8] = (bytes[8] ?? 0) & 0x3f | 0x80;
544
+ const hex = Array.from(bytes, b => b.toString(16).padStart(2, '0')).join('');
545
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20, 32)}`;
546
+ }
547
+ //# sourceMappingURL=payment-flow-controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_logger","require","_redactUri","_constants","_paymentApiError","_linkSessionStatus","_paymentReturnParams","_paymentType","_paymentFlowState","REAL_CLOCK","now","Date","POLL_STATUS_MAX_CONSECUTIVE_FAILURES","log","createLogger","TERMINAL_PHASES","Set","isTerminal","phase","has","PaymentFlowController","_state","PaymentFlowStates","idle","_listeners","_disposed","_pollStatusConsecutiveFailures","constructor","opts","sessionToken","apiClient","pendingSessionStore","awaitingCallbackTimeoutMs","DEFAULT_AWAITING_CALLBACK_TIMEOUT_MS","environment","awaitingCallbackPollMs","DEFAULT_AWAITING_CALLBACK_POLL_MS","clock","collectTelemetry","uuid","fallbackUuid","onEvent","onEventCallback","state","awaitingCallbackStartedAtMs","_awaitingCallbackStartedAtMs","subscribe","listener","add","delete","setState","next","cancelCallbackTimeout","_consentIdempotencyKey","undefined","l","fireEvent","event","_callbackTimer","clearTimeout","startCallbackTimeout","setTimeout","reportError","hydrate","Promise","resolve","_hydratePromise","_doHydrate","finally","info","hydrating","session","providers","all","getSession","getProviders","length","bankSelection","err","severe","Error","message","String","code","isPaymentApiError","failed","errorCode","errorMessage","selectBank","bankId","current","provider","find","p","id","_selectedProvider","willLoadCop","shouldPerformCop","consentDetails","selectedProvider","isCopLoading","copApplicable","loadCopInBackground","cop","getCoP","copResponse","tenantHeader","request","isCopVerified","supportsConfirmationOfPayee","confirmConsent","postTelemetryAutomatic","consent","postConsent","linkToken","idempotencyKey","patchTokenBestEffort","merchantRef","merchantReference","save","sessionId","selectedBankId","authorizationUrl","redirectUrl","consentAt","recoveryAttempts","warning","redirecting","handleCallback","uri","redactPaymentReturnUri","toString","url","URL","params","searchParams","error","extractPaymentReturnErrorCode","description","get","exchangeCode","linkSessionId","succeeded","cancel","cancelled","action","patchToken","setAwaitingCallbackState","args","awaitingCallback","providerName","pollStatus","status","getStatus","failureCode","isBankCallbackReceivedStatus","postTelemetry","payload","providerId","getConfirmPayee","fine","dispose","clear","exports","bytes","Uint8Array","i","Math","floor","random","hex","Array","from","b","padStart","join","slice"],"sourceRoot":"../../../../src","sources":["core/services/payment-flow-controller.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAiBA,IAAAG,gBAAA,GAAAH,OAAA;AAEA,IAAAI,kBAAA,GAAAJ,OAAA;AACA,IAAAK,oBAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,iBAAA,GAAAP,OAAA;AAjBA;;AAwBA;;AAKA,MAAMQ,UAAiB,GAAG;EAAEC,GAAG,EAAEA,CAAA,KAAMC,IAAI,CAACD,GAAG,CAAC;AAAE,CAAC;;AAEnD;AACA;AACA;AACA;AACA;AACA,MAAME,oCAAoC,GAAG,CAAC;AAC9C,MAAMC,GAAG,GAAG,IAAAC,oBAAY,EAAC,uBAAuB,CAAC;AAgCjD,MAAMC,eAAe,GAAG,IAAIC,GAAG,CAAmB,CAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;AAEvF,SAASC,UAAUA,CAACC,KAAuB,EAAW;EACpD,OAAOH,eAAe,CAACI,GAAG,CAACD,KAAK,CAAC;AACnC;;AAEA;AACA;AACA;AAC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AAG,CAACM,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,IAAIN,GAAG,CAACM,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,IAAIN,GAAG,CAACM,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,IAAIN,GAAG,CAACM,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE;AAChH","ignoreList":[]}
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.PaymentFlowStates = void 0;
7
+ /** Phases the payment flow controller transitions through. */
8
+
9
+ const EMPTY_PROVIDERS = [];
10
+ const PaymentFlowStates = exports.PaymentFlowStates = {
11
+ idle() {
12
+ return {
13
+ phase: 'idle',
14
+ providers: EMPTY_PROVIDERS
15
+ };
16
+ },
17
+ hydrating() {
18
+ return {
19
+ phase: 'hydrating',
20
+ providers: EMPTY_PROVIDERS
21
+ };
22
+ },
23
+ bankSelection(args) {
24
+ return {
25
+ phase: 'bankSelection',
26
+ session: args.session,
27
+ providers: args.providers
28
+ };
29
+ },
30
+ consentDetails(args) {
31
+ return {
32
+ phase: 'consentDetails',
33
+ session: args.session,
34
+ providers: EMPTY_PROVIDERS,
35
+ selectedProvider: args.selectedProvider,
36
+ ...(args.copResponse ? {
37
+ copResponse: args.copResponse
38
+ } : {}),
39
+ ...(args.isCopLoading !== undefined ? {
40
+ isCopLoading: args.isCopLoading
41
+ } : {}),
42
+ ...(args.copApplicable !== undefined ? {
43
+ copApplicable: args.copApplicable
44
+ } : {})
45
+ };
46
+ },
47
+ redirecting(args) {
48
+ return {
49
+ phase: 'redirecting',
50
+ providers: EMPTY_PROVIDERS,
51
+ consent: args.consent,
52
+ ...(args.selectedProvider ? {
53
+ selectedProvider: args.selectedProvider
54
+ } : {})
55
+ };
56
+ },
57
+ awaitingCallback(args) {
58
+ return {
59
+ phase: 'awaitingCallback',
60
+ providers: EMPTY_PROVIDERS,
61
+ ...(args.providerName ? {
62
+ providerName: args.providerName
63
+ } : {}),
64
+ ...(args.session ? {
65
+ session: args.session
66
+ } : {}),
67
+ ...(args.selectedProvider ? {
68
+ selectedProvider: args.selectedProvider
69
+ } : {})
70
+ };
71
+ },
72
+ succeeded(args) {
73
+ return {
74
+ phase: 'succeeded',
75
+ providers: EMPTY_PROVIDERS,
76
+ ...(args.exchangeCode ? {
77
+ exchangeCode: args.exchangeCode
78
+ } : {}),
79
+ ...(args.linkSessionId ? {
80
+ linkSessionId: args.linkSessionId
81
+ } : {}),
82
+ ...(args.merchantRef ? {
83
+ merchantRef: args.merchantRef
84
+ } : {}),
85
+ ...(args.selectedProvider ? {
86
+ selectedProvider: args.selectedProvider
87
+ } : {}),
88
+ ...(args.session ? {
89
+ session: args.session
90
+ } : {})
91
+ };
92
+ },
93
+ failed(args) {
94
+ return {
95
+ phase: 'failed',
96
+ providers: EMPTY_PROVIDERS,
97
+ errorCode: args.errorCode,
98
+ ...(args.errorMessage ? {
99
+ errorMessage: args.errorMessage
100
+ } : {})
101
+ };
102
+ },
103
+ cancelled() {
104
+ return {
105
+ phase: 'cancelled',
106
+ providers: EMPTY_PROVIDERS
107
+ };
108
+ }
109
+ };
110
+ //# sourceMappingURL=payment-flow-state.js.map