@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,544 @@
1
+ "use strict";
2
+
3
+ import { createLogger } from "../../internal/logger.js";
4
+ import { redactPaymentReturnUri } from "../../internal/redact-uri.js";
5
+ import { DEFAULT_AWAITING_CALLBACK_POLL_MS, DEFAULT_AWAITING_CALLBACK_TIMEOUT_MS } from "../../public/constants.js";
6
+
7
+ /** Simple string tag for internal controller callbacks — not the public SpareLinkEvent. */
8
+
9
+ import { isPaymentApiError } from "../errors/payment-api-error.js";
10
+ import { isBankCallbackReceivedStatus } from "../models/link-session-status.js";
11
+ import { extractPaymentReturnErrorCode } from "../models/payment-return-params.js";
12
+ import { supportsConfirmationOfPayee } from "../models/payment-type.js";
13
+ import { PaymentFlowStates } from "./payment-flow-state.js";
14
+
15
+ /** Minimum surface required from a `Clock` injected for testability. */
16
+
17
+ const REAL_CLOCK = {
18
+ now: () => Date.now()
19
+ };
20
+
21
+ /**
22
+ * Number of consecutive `pollStatus` transport failures we tolerate before
23
+ * giving up and transitioning to `failed('network_error')`. Bounds the request
24
+ * volume against a flaky network during the 5-minute awaiting-callback window.
25
+ */
26
+ const POLL_STATUS_MAX_CONSECUTIVE_FAILURES = 5;
27
+ const log = createLogger('PaymentFlowController');
28
+ const TERMINAL_PHASES = new Set(['succeeded', 'failed', 'cancelled']);
29
+ function isTerminal(phase) {
30
+ return TERMINAL_PHASES.has(phase);
31
+ }
32
+
33
+ /**
34
+ * Drives the payment flow state machine. Exposes a `subscribe`/`unsubscribe`
35
+ * API so React's `useSyncExternalStore` can bridge to a hook.
36
+ *
37
+ * `subscribe` fires the listener synchronously with the current state so new
38
+ * subscribers don't miss the initial snapshot.
39
+ */
40
+ export class PaymentFlowController {
41
+ _state = PaymentFlowStates.idle();
42
+ _listeners = new Set();
43
+
44
+ /** Last provider the user selected — retained so success/awaiting states that
45
+ * arrive without it (poll/callback) can still report `bankId`. */
46
+
47
+ _disposed = false;
48
+ /** Re-entrance guard — second `hydrate()` returns the in-flight promise. */
49
+
50
+ /** Consecutive `pollStatus` transport failures since the last successful response. */
51
+ _pollStatusConsecutiveFailures = 0;
52
+ constructor(opts) {
53
+ this.sessionToken = opts.sessionToken;
54
+ this.apiClient = opts.apiClient;
55
+ if (opts.pendingSessionStore) this.pendingSessionStore = opts.pendingSessionStore;
56
+ this.awaitingCallbackTimeoutMs = opts.awaitingCallbackTimeoutMs ?? DEFAULT_AWAITING_CALLBACK_TIMEOUT_MS;
57
+ this.environment = opts.environment ?? 'production';
58
+ this.awaitingCallbackPollMs = opts.awaitingCallbackPollMs ?? DEFAULT_AWAITING_CALLBACK_POLL_MS;
59
+ this.clock = opts.clock ?? REAL_CLOCK;
60
+ if (opts.collectTelemetry) this.collectTelemetry = opts.collectTelemetry;
61
+ this.uuid = opts.uuid ?? fallbackUuid;
62
+ if (opts.onEvent) this.onEventCallback = opts.onEvent;
63
+ }
64
+
65
+ // ---- Subscription API ----------------------------------------------------
66
+
67
+ get state() {
68
+ return this._state;
69
+ }
70
+ get awaitingCallbackStartedAtMs() {
71
+ return this._awaitingCallbackStartedAtMs;
72
+ }
73
+
74
+ /**
75
+ * Register a listener. The listener is invoked synchronously with the
76
+ * current state so new subscribers have the initial snapshot, then again
77
+ * on every subsequent change.
78
+ */
79
+ subscribe(listener) {
80
+ this._listeners.add(listener);
81
+ try {
82
+ listener(this._state);
83
+ } catch {
84
+ // swallow — listener bugs never break the controller
85
+ }
86
+ return () => {
87
+ this._listeners.delete(listener);
88
+ };
89
+ }
90
+ setState(next) {
91
+ if (this._disposed) return;
92
+ this._state = next;
93
+ if (isTerminal(next.phase)) {
94
+ this.cancelCallbackTimeout();
95
+ this._consentIdempotencyKey = undefined;
96
+ }
97
+ for (const l of this._listeners) {
98
+ try {
99
+ l(next);
100
+ } catch {
101
+ // listener exceptions never break the controller
102
+ }
103
+ }
104
+ }
105
+ fireEvent(event) {
106
+ try {
107
+ this.onEventCallback?.(event);
108
+ } catch {
109
+ // swallow integrator errors
110
+ }
111
+ }
112
+
113
+ // ---- Timers --------------------------------------------------------------
114
+
115
+ cancelCallbackTimeout() {
116
+ if (this._callbackTimer) {
117
+ clearTimeout(this._callbackTimer);
118
+ this._callbackTimer = undefined;
119
+ }
120
+ }
121
+ startCallbackTimeout() {
122
+ this.cancelCallbackTimeout();
123
+ this._callbackTimer = setTimeout(() => {
124
+ if (this._state.phase !== 'awaitingCallback') return;
125
+ void this.reportError('session_timeout');
126
+ }, this.awaitingCallbackTimeoutMs);
127
+ }
128
+
129
+ // ---- Phase transitions ---------------------------------------------------
130
+
131
+ /**
132
+ * `GET /link` + `GET /link/providers`, then transitions to bankSelection.
133
+ * Re-entrant: a second concurrent call returns the in-flight promise instead
134
+ * of firing duplicate requests.
135
+ */
136
+ hydrate() {
137
+ if (this._disposed) return Promise.resolve();
138
+ if (this._hydratePromise) return this._hydratePromise;
139
+ this._hydratePromise = this._doHydrate().finally(() => {
140
+ this._hydratePromise = undefined;
141
+ });
142
+ return this._hydratePromise;
143
+ }
144
+ async _doHydrate() {
145
+ log.info('hydrate: starting session hydration');
146
+ this.setState(PaymentFlowStates.hydrating());
147
+ try {
148
+ const [session, providers] = await Promise.all([this.apiClient.getSession(this.sessionToken), this.apiClient.getProviders(this.sessionToken)]);
149
+ log.info(`hydrate: loaded session with ${providers.length} provider(s)`);
150
+ this.setState(PaymentFlowStates.bankSelection({
151
+ session,
152
+ providers
153
+ }));
154
+ this.fireEvent('sessionLoaded');
155
+ } catch (err) {
156
+ log.severe(`hydrate: failed — ${err instanceof Error ? err.message : String(err)}`);
157
+ const code = isPaymentApiError(err) ? err.code : 'hydration_error';
158
+ const message = err instanceof Error ? err.message : String(err);
159
+ this.setState(PaymentFlowStates.failed({
160
+ errorCode: code,
161
+ errorMessage: message
162
+ }));
163
+ throw err;
164
+ }
165
+ }
166
+
167
+ /** Move bankSelection → consentDetails. */
168
+ selectBank(bankId) {
169
+ log.info(`selectBank: bankId=${bankId}`);
170
+ const current = this._state;
171
+ const session = current.session;
172
+ if (!session) {
173
+ throw new Error('Cannot select bank before session is loaded.');
174
+ }
175
+ const provider = current.providers.find(p => p.id === bankId);
176
+ if (!provider) {
177
+ log.severe(`selectBank: unknown bankId=${bankId}`);
178
+ throw new Error(`Unknown bank id: ${bankId}`);
179
+ }
180
+ // Retained so success states reached via poll/callback (which don't carry
181
+ // the provider) still resolve a `bankId` in the PaymentResult.
182
+ this._selectedProvider = provider;
183
+ const willLoadCop = this.shouldPerformCop(session);
184
+ this.setState(PaymentFlowStates.consentDetails({
185
+ session,
186
+ selectedProvider: provider,
187
+ isCopLoading: willLoadCop,
188
+ copApplicable: willLoadCop
189
+ }));
190
+ if (willLoadCop) {
191
+ this.loadCopInBackground(session, provider);
192
+ }
193
+ }
194
+
195
+ /**
196
+ * Best-effort Confirmation-of-Payee fetch — never blocks {@link selectBank}
197
+ * or fails the flow. Mirrors the Flutter controller: gated to UAE + un-verified
198
+ * sessions, and the result is merged into the consentDetails state only if the
199
+ * user is still on that screen for the same provider. Ported from
200
+ * `payment_flow_controller.dart:_loadCopInBackground`.
201
+ */
202
+ loadCopInBackground(session, provider) {
203
+ void (async () => {
204
+ const cop = await this.getCoP(provider.id);
205
+ if (this._state.phase !== 'consentDetails') return;
206
+ if (this._state.selectedProvider?.id !== provider.id) return;
207
+ this.setState(PaymentFlowStates.consentDetails({
208
+ session,
209
+ selectedProvider: provider,
210
+ ...(cop ? {
211
+ copResponse: cop
212
+ } : {}),
213
+ isCopLoading: false,
214
+ copApplicable: true
215
+ }));
216
+ })();
217
+ }
218
+ shouldPerformCop(session) {
219
+ if (this.apiClient.tenantHeader !== 'UAE') return false;
220
+ if (session.request.isCopVerified === true) return false;
221
+ if (!supportsConfirmationOfPayee(session.request)) return false;
222
+ return true;
223
+ }
224
+
225
+ /** `POST /link/consent`, persists pending record, transitions to redirecting. */
226
+ async confirmConsent() {
227
+ log.info('confirmConsent: posting consent');
228
+ const selectedProvider = this._state.selectedProvider;
229
+ if (!selectedProvider) {
230
+ log.severe('confirmConsent: no provider selected');
231
+ throw new Error('Cannot confirm consent without a selected provider.');
232
+ }
233
+ this.fireEvent('consentStarted');
234
+ if (!this._consentIdempotencyKey) {
235
+ this._consentIdempotencyKey = this.uuid();
236
+ }
237
+
238
+ // Best-effort telemetry before posting consent.
239
+ await this.postTelemetryAutomatic();
240
+ let consent;
241
+ try {
242
+ consent = await this.apiClient.postConsent({
243
+ linkToken: this.sessionToken,
244
+ bankId: selectedProvider.id,
245
+ idempotencyKey: this._consentIdempotencyKey
246
+ });
247
+ } catch (err) {
248
+ // Without this the flow would be stranded in `consentDetails` with no
249
+ // terminal state — the caller's catch assumes we already transitioned.
250
+ const code = isPaymentApiError(err) ? err.code : 'consent_failed';
251
+ const message = err instanceof Error ? err.message : String(err);
252
+ this.setState(PaymentFlowStates.failed({
253
+ errorCode: code,
254
+ errorMessage: message
255
+ }));
256
+ void this.patchTokenBestEffort('error', code);
257
+ throw err;
258
+ }
259
+ if (this.pendingSessionStore) {
260
+ try {
261
+ const merchantRef = this._state.session?.request?.merchantReference;
262
+ await this.pendingSessionStore.save({
263
+ sessionId: this.sessionToken,
264
+ selectedBankId: selectedProvider.id,
265
+ authorizationUrl: consent.redirectUrl,
266
+ consentAt: this.clock.now(),
267
+ recoveryAttempts: 0,
268
+ ...(merchantRef ? {
269
+ merchantRef
270
+ } : {})
271
+ });
272
+ } catch {
273
+ log.warning('confirmConsent: store.save() failed — continuing');
274
+ // store failures should not block the flow
275
+ }
276
+ }
277
+ log.info('confirmConsent: → redirecting');
278
+ this.setState(PaymentFlowStates.redirecting({
279
+ consent,
280
+ selectedProvider
281
+ }));
282
+ }
283
+
284
+ /**
285
+ * Parses a callback URI and transitions to succeeded / failed. Accepts either
286
+ * a `URL` instance or a string. A malformed URI resolves to
287
+ * `failed('invalid_callback')` instead of throwing.
288
+ */
289
+ handleCallback(uri) {
290
+ log.info(`handleCallback: received URI=${redactPaymentReturnUri(typeof uri === 'string' ? uri : uri.toString())}`);
291
+ // Deep-link callbacks are commonly re-delivered (cold start + warm
292
+ // foreground). Once the flow is terminal, ignore further callbacks so we
293
+ // never re-transition and re-fire terminal callbacks.
294
+ if (isTerminal(this._state.phase)) return;
295
+ let url;
296
+ if (typeof uri === 'string') {
297
+ try {
298
+ url = new URL(uri);
299
+ } catch {
300
+ this.setState(PaymentFlowStates.failed({
301
+ errorCode: 'invalid_callback',
302
+ errorMessage: 'The callback URI could not be parsed.'
303
+ }));
304
+ return;
305
+ }
306
+ } else {
307
+ url = uri;
308
+ }
309
+ this.fireEvent('bankCallbackReceived');
310
+ const params = url.searchParams;
311
+
312
+ // Prefer the new `error_code` query param over legacy `error`. Also accept
313
+ // `status=failure` with no other code as `authorize_failed`.
314
+ const error = extractPaymentReturnErrorCode(params);
315
+ if (error) {
316
+ const description = params.get('error_description') ?? undefined;
317
+ this.setState(PaymentFlowStates.failed({
318
+ errorCode: error,
319
+ ...(description ? {
320
+ errorMessage: description
321
+ } : {})
322
+ }));
323
+ return;
324
+ }
325
+ const exchangeCode = params.get('exchange_code') ?? undefined;
326
+ const linkSessionId = params.get('session_id') ?? undefined;
327
+ const merchantRef = params.get('merchantRef') ?? undefined;
328
+ if (exchangeCode) {
329
+ this.setState(PaymentFlowStates.succeeded({
330
+ exchangeCode,
331
+ ...(linkSessionId ? {
332
+ linkSessionId
333
+ } : {}),
334
+ ...(merchantRef ? {
335
+ merchantRef
336
+ } : {}),
337
+ ...(this._selectedProvider ? {
338
+ selectedProvider: this._selectedProvider
339
+ } : {}),
340
+ ...(this._state.session ? {
341
+ session: this._state.session
342
+ } : {})
343
+ }));
344
+ return;
345
+ }
346
+ this.setState(PaymentFlowStates.failed({
347
+ errorCode: 'invalid_callback',
348
+ errorMessage: 'The callback URI is missing required parameters.'
349
+ }));
350
+ }
351
+
352
+ /** Best-effort cancel — PATCH /link with action=cancel, then transitions to cancelled. */
353
+ async cancel() {
354
+ log.info('cancel: user cancelled the payment flow');
355
+ await this.patchTokenBestEffort('cancel');
356
+ this.setState(PaymentFlowStates.cancelled());
357
+ }
358
+
359
+ /** Best-effort error report — sets failed state immediately, PATCH is fire-and-forget. */
360
+ async reportError(code) {
361
+ log.severe(`reportError: reporting error code=${code}`);
362
+ this.setState(PaymentFlowStates.failed({
363
+ errorCode: code
364
+ }));
365
+ // Fire-and-forget; we already transitioned.
366
+ void this.patchTokenBestEffort('error', code);
367
+ }
368
+ async patchTokenBestEffort(action, errorCode) {
369
+ try {
370
+ await this.apiClient.patchToken({
371
+ linkToken: this.sessionToken,
372
+ action,
373
+ ...(errorCode ? {
374
+ errorCode
375
+ } : {})
376
+ });
377
+ } catch {
378
+ // swallow — PATCH is best-effort
379
+ }
380
+ }
381
+
382
+ /**
383
+ * UI calls this after handing off to the bank — starts the 5-minute timeout
384
+ * and pins the awaiting-callback start time.
385
+ */
386
+ setAwaitingCallbackState(args = {}) {
387
+ this._awaitingCallbackStartedAtMs ??= this.clock.now();
388
+ this.setState(PaymentFlowStates.awaitingCallback({
389
+ ...(args.providerName ? {
390
+ providerName: args.providerName
391
+ } : {}),
392
+ ...(this._state.session ? {
393
+ session: this._state.session
394
+ } : {}),
395
+ ...(this._selectedProvider ? {
396
+ selectedProvider: this._selectedProvider
397
+ } : {})
398
+ }));
399
+ this.startCallbackTimeout();
400
+ }
401
+
402
+ /**
403
+ * Best-effort status polling. Transitions to a terminal state on
404
+ * `completed | failed | cancelled | expired`; otherwise leaves the flow in
405
+ * the current phase. After {@link POLL_STATUS_MAX_CONSECUTIVE_FAILURES}
406
+ * consecutive transport failures the controller gives up with
407
+ * `failed('network_error')` to stop hammering an unreachable backend.
408
+ */
409
+ async pollStatus() {
410
+ // A status response can land after a bank callback or the timeout has
411
+ // already resolved the flow; never overwrite a terminal state.
412
+ if (isTerminal(this._state.phase)) return;
413
+ try {
414
+ const status = await this.apiClient.getStatus(this.sessionToken);
415
+ this._pollStatusConsecutiveFailures = 0;
416
+ // Re-check: the await above yields, so a terminal callback may have
417
+ // arrived while the request was in flight.
418
+ if (isTerminal(this._state.phase)) return;
419
+ switch (status.status) {
420
+ case 'completed':
421
+ this.setState(PaymentFlowStates.succeeded({
422
+ ...(status.linkSessionId ? {
423
+ linkSessionId: status.linkSessionId
424
+ } : {}),
425
+ ...(this._selectedProvider ? {
426
+ selectedProvider: this._selectedProvider
427
+ } : {}),
428
+ ...(this._state.session ? {
429
+ session: this._state.session
430
+ } : {})
431
+ }));
432
+ return;
433
+ case 'failed':
434
+ this.setState(PaymentFlowStates.failed({
435
+ errorCode: status.failureCode ?? 'session_failed'
436
+ }));
437
+ return;
438
+ case 'cancelled':
439
+ this.setState(PaymentFlowStates.cancelled());
440
+ return;
441
+ case 'expired':
442
+ this.setState(PaymentFlowStates.failed({
443
+ errorCode: 'session_expired'
444
+ }));
445
+ return;
446
+ default:
447
+ // Non-terminal. In sandbox, only treat `callback_received` as success —
448
+ // the bank has actually returned. `redirected` means consent was posted
449
+ // but the user may not have authorized yet; auto-success there caused
450
+ // false positives on cold-start recovery.
451
+ if (this.environment === 'sandbox' && this._state.phase === 'awaitingCallback' && isBankCallbackReceivedStatus(status.status)) {
452
+ this.setState(PaymentFlowStates.succeeded({
453
+ ...(status.linkSessionId ? {
454
+ linkSessionId: status.linkSessionId
455
+ } : {}),
456
+ ...(this._selectedProvider ? {
457
+ selectedProvider: this._selectedProvider
458
+ } : {}),
459
+ ...(this._state.session ? {
460
+ session: this._state.session
461
+ } : {})
462
+ }));
463
+ }
464
+ return;
465
+ }
466
+ } catch {
467
+ this._pollStatusConsecutiveFailures += 1;
468
+ log.warning(`pollStatus: failed (${this._pollStatusConsecutiveFailures}/${POLL_STATUS_MAX_CONSECUTIVE_FAILURES})`);
469
+ if (this._pollStatusConsecutiveFailures >= POLL_STATUS_MAX_CONSECUTIVE_FAILURES) {
470
+ if (isTerminal(this._state.phase) || this._state.phase !== 'awaitingCallback') return;
471
+ this.setState(PaymentFlowStates.failed({
472
+ errorCode: 'network_error',
473
+ errorMessage: 'Unable to reach the Spare backend after multiple attempts.'
474
+ }));
475
+ }
476
+ }
477
+ }
478
+
479
+ /** Best-effort telemetry — never throws, never changes state. */
480
+ async postTelemetry(payload) {
481
+ try {
482
+ await this.apiClient.postTelemetry({
483
+ linkToken: this.sessionToken,
484
+ payload
485
+ });
486
+ } catch (err) {
487
+ log.warning(`postTelemetry: best-effort telemetry failed — ${err instanceof Error ? err.message : String(err)}`);
488
+ }
489
+ }
490
+
491
+ /** Best-effort CoP — returns result or null on failure. */
492
+ async getCoP(providerId) {
493
+ try {
494
+ return await this.apiClient.getConfirmPayee(this.sessionToken, providerId);
495
+ } catch {
496
+ return null;
497
+ }
498
+ }
499
+ async postTelemetryAutomatic() {
500
+ if (!this.collectTelemetry) return;
501
+ log.fine('postTelemetryAutomatic: collecting and posting device telemetry');
502
+ try {
503
+ const payload = await this.collectTelemetry();
504
+ await this.apiClient.postTelemetry({
505
+ linkToken: this.sessionToken,
506
+ payload
507
+ });
508
+ } catch (err) {
509
+ log.warning(`postTelemetryAutomatic: failed — ${err instanceof Error ? err.message : String(err)}`);
510
+ }
511
+ }
512
+
513
+ /** Returns the active providers list — convenience for the UI layer. */
514
+ get providers() {
515
+ return this._state.providers;
516
+ }
517
+
518
+ /** Returns the active session, if any. */
519
+ get session() {
520
+ return this._state.session;
521
+ }
522
+
523
+ /**
524
+ * Releases resources: cancels timers, clears listeners, and aborts the
525
+ * underlying API client's in-flight fetches. Idempotent.
526
+ */
527
+ dispose() {
528
+ if (this._disposed) return;
529
+ log.info('dispose: releasing apiClient');
530
+ this._disposed = true;
531
+ this.cancelCallbackTimeout();
532
+ this._listeners.clear();
533
+ this.apiClient.dispose();
534
+ }
535
+ }
536
+ function fallbackUuid() {
537
+ const bytes = new Uint8Array(16);
538
+ for (let i = 0; i < 16; i += 1) bytes[i] = Math.floor(Math.random() * 256);
539
+ bytes[6] = (bytes[6] ?? 0) & 0x0f | 0x40;
540
+ bytes[8] = (bytes[8] ?? 0) & 0x3f | 0x80;
541
+ const hex = Array.from(bytes, b => b.toString(16).padStart(2, '0')).join('');
542
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20, 32)}`;
543
+ }
544
+ //# sourceMappingURL=payment-flow-controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createLogger","redactPaymentReturnUri","DEFAULT_AWAITING_CALLBACK_POLL_MS","DEFAULT_AWAITING_CALLBACK_TIMEOUT_MS","isPaymentApiError","isBankCallbackReceivedStatus","extractPaymentReturnErrorCode","supportsConfirmationOfPayee","PaymentFlowStates","REAL_CLOCK","now","Date","POLL_STATUS_MAX_CONSECUTIVE_FAILURES","log","TERMINAL_PHASES","Set","isTerminal","phase","has","PaymentFlowController","_state","idle","_listeners","_disposed","_pollStatusConsecutiveFailures","constructor","opts","sessionToken","apiClient","pendingSessionStore","awaitingCallbackTimeoutMs","environment","awaitingCallbackPollMs","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","failed","errorCode","errorMessage","selectBank","bankId","current","provider","find","p","id","_selectedProvider","willLoadCop","shouldPerformCop","consentDetails","selectedProvider","isCopLoading","copApplicable","loadCopInBackground","cop","getCoP","copResponse","tenantHeader","request","isCopVerified","confirmConsent","postTelemetryAutomatic","consent","postConsent","linkToken","idempotencyKey","patchTokenBestEffort","merchantRef","merchantReference","save","sessionId","selectedBankId","authorizationUrl","redirectUrl","consentAt","recoveryAttempts","warning","redirecting","handleCallback","uri","toString","url","URL","params","searchParams","error","description","get","exchangeCode","linkSessionId","succeeded","cancel","cancelled","action","patchToken","setAwaitingCallbackState","args","awaitingCallback","providerName","pollStatus","status","getStatus","failureCode","postTelemetry","payload","providerId","getConfirmPayee","fine","dispose","clear","bytes","Uint8Array","i","Math","floor","random","hex","Array","from","b","padStart","join","slice"],"sourceRoot":"../../../../src","sources":["core/services/payment-flow-controller.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,0BAAuB;AACpD,SAASC,sBAAsB,QAAQ,8BAA2B;AAClE,SACEC,iCAAiC,EACjCC,oCAAoC,QAC/B,2BAAwB;;AAE/B;;AAYA,SAASC,iBAAiB,QAAQ,gCAA6B;AAE/D,SAASC,4BAA4B,QAAQ,kCAA+B;AAC5E,SAASC,6BAA6B,QAAQ,oCAAiC;AAC/E,SAASC,2BAA2B,QAAQ,2BAAwB;AACpE,SAGEC,iBAAiB,QACZ,yBAAsB;;AAG7B;;AAKA,MAAMC,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,GAAGb,YAAY,CAAC,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;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,qBAAqB,CAAC;EAazBC,MAAM,GAAqBZ,iBAAiB,CAACa,IAAI,CAAC,CAAC;EACnDC,UAAU,GAAG,IAAIP,GAAG,CAAW,CAAC;;EAIxC;AACF;;EAEUQ,SAAS,GAAG,KAAK;EACzB;;EAEA;EACQC,8BAA8B,GAAG,CAAC;EAE1CC,WAAWA,CAACC,IAAkC,EAAE;IAC9C,IAAI,CAACC,YAAY,GAAGD,IAAI,CAACC,YAAY;IACrC,IAAI,CAACC,SAAS,GAAGF,IAAI,CAACE,S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AAC7H,SAAS,CAAC4H,OAAO,CAAC,CAAC;EAC1B;AACF;AAEA,SAASpH,YAAYA,CAAA,EAAW;EAC9B,MAAMsH,KAAK,GAAG,IAAIC,UAAU,CAAC,EAAE,CAAC;EAChC,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG,EAAE,EAAEA,CAAC,IAAI,CAAC,EAAEF,KAAK,CAACE,CAAC,CAAC,GAAGC,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,MAAM,CAAC,CAAC,GAAG,GAAG,CAAC;EAC1EL,KAAK,CAAC,CAAC,CAAC,GAAI,CAACA,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,GAAI,IAAI;EAC1CA,KAAK,CAAC,CAAC,CAAC,GAAI,CAACA,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,GAAI,IAAI;EAC1C,MAAMM,GAAG,GAAGC,KAAK,CAACC,IAAI,CAACR,KAAK,EAAGS,CAAC,IAAKA,CAAC,CAACvC,QAAQ,CAAC,EAAE,CAAC,CAACwC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAACC,IAAI,CAAC,EAAE,CAAC;EAC9E,OAAO,GAAGL,GAAG,CAACM,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAIN,GAAG,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,106 @@
1
+ "use strict";
2
+
3
+ /** Phases the payment flow controller transitions through. */
4
+
5
+ const EMPTY_PROVIDERS = [];
6
+ export const PaymentFlowStates = {
7
+ idle() {
8
+ return {
9
+ phase: 'idle',
10
+ providers: EMPTY_PROVIDERS
11
+ };
12
+ },
13
+ hydrating() {
14
+ return {
15
+ phase: 'hydrating',
16
+ providers: EMPTY_PROVIDERS
17
+ };
18
+ },
19
+ bankSelection(args) {
20
+ return {
21
+ phase: 'bankSelection',
22
+ session: args.session,
23
+ providers: args.providers
24
+ };
25
+ },
26
+ consentDetails(args) {
27
+ return {
28
+ phase: 'consentDetails',
29
+ session: args.session,
30
+ providers: EMPTY_PROVIDERS,
31
+ selectedProvider: args.selectedProvider,
32
+ ...(args.copResponse ? {
33
+ copResponse: args.copResponse
34
+ } : {}),
35
+ ...(args.isCopLoading !== undefined ? {
36
+ isCopLoading: args.isCopLoading
37
+ } : {}),
38
+ ...(args.copApplicable !== undefined ? {
39
+ copApplicable: args.copApplicable
40
+ } : {})
41
+ };
42
+ },
43
+ redirecting(args) {
44
+ return {
45
+ phase: 'redirecting',
46
+ providers: EMPTY_PROVIDERS,
47
+ consent: args.consent,
48
+ ...(args.selectedProvider ? {
49
+ selectedProvider: args.selectedProvider
50
+ } : {})
51
+ };
52
+ },
53
+ awaitingCallback(args) {
54
+ return {
55
+ phase: 'awaitingCallback',
56
+ providers: EMPTY_PROVIDERS,
57
+ ...(args.providerName ? {
58
+ providerName: args.providerName
59
+ } : {}),
60
+ ...(args.session ? {
61
+ session: args.session
62
+ } : {}),
63
+ ...(args.selectedProvider ? {
64
+ selectedProvider: args.selectedProvider
65
+ } : {})
66
+ };
67
+ },
68
+ succeeded(args) {
69
+ return {
70
+ phase: 'succeeded',
71
+ providers: EMPTY_PROVIDERS,
72
+ ...(args.exchangeCode ? {
73
+ exchangeCode: args.exchangeCode
74
+ } : {}),
75
+ ...(args.linkSessionId ? {
76
+ linkSessionId: args.linkSessionId
77
+ } : {}),
78
+ ...(args.merchantRef ? {
79
+ merchantRef: args.merchantRef
80
+ } : {}),
81
+ ...(args.selectedProvider ? {
82
+ selectedProvider: args.selectedProvider
83
+ } : {}),
84
+ ...(args.session ? {
85
+ session: args.session
86
+ } : {})
87
+ };
88
+ },
89
+ failed(args) {
90
+ return {
91
+ phase: 'failed',
92
+ providers: EMPTY_PROVIDERS,
93
+ errorCode: args.errorCode,
94
+ ...(args.errorMessage ? {
95
+ errorMessage: args.errorMessage
96
+ } : {})
97
+ };
98
+ },
99
+ cancelled() {
100
+ return {
101
+ phase: 'cancelled',
102
+ providers: EMPTY_PROVIDERS
103
+ };
104
+ }
105
+ };
106
+ //# sourceMappingURL=payment-flow-state.js.map