@adyen/adyen-web 6.4.0 → 6.5.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 (333) hide show
  1. package/README.md +16 -5
  2. package/dist/cjs/adyen.css +7 -3
  3. package/dist/cjs/adyen.css.map +1 -1
  4. package/dist/cjs/index.cjs +2 -2
  5. package/dist/cjs/index.cjs.map +1 -1
  6. package/dist/cjs/index.d.cts +27 -19
  7. package/dist/es/adyen.css +7 -3
  8. package/dist/es/adyen.css.map +1 -1
  9. package/dist/es/components/ANCV/ANCV.js +1 -1
  10. package/dist/es/components/ANCV/ANCV.js.map +1 -1
  11. package/dist/es/components/Ach/Ach.js +1 -1
  12. package/dist/es/components/Ach/Ach.js.map +1 -1
  13. package/dist/es/components/Address/Address.js +1 -1
  14. package/dist/es/components/Address/Address.js.map +1 -1
  15. package/dist/es/components/Affirm/Affirm.js +1 -1
  16. package/dist/es/components/Affirm/Affirm.js.map +1 -1
  17. package/dist/es/components/AfterPay/AfterPay.js +1 -1
  18. package/dist/es/components/AfterPay/AfterPay.js.map +1 -1
  19. package/dist/es/components/AfterPay/AfterPayB2B.js +1 -1
  20. package/dist/es/components/AfterPay/AfterPayB2B.js.map +1 -1
  21. package/dist/es/components/AmazonPay/AmazonPay.js +1 -1
  22. package/dist/es/components/AmazonPay/AmazonPay.js.map +1 -1
  23. package/dist/es/components/ApplePay/ApplePay.js +1 -1
  24. package/dist/es/components/ApplePay/ApplePay.js.map +1 -1
  25. package/dist/es/components/ApplePay/ApplePayService.js +1 -1
  26. package/dist/es/components/ApplePay/ApplePayService.js.map +1 -1
  27. package/dist/es/components/ApplePay/components/ApplePayButton.js +1 -1
  28. package/dist/es/components/ApplePay/components/ApplePayButton.js.map +1 -1
  29. package/dist/es/components/Atome/Atome.js +1 -1
  30. package/dist/es/components/Atome/Atome.js.map +1 -1
  31. package/dist/es/components/BacsDD/BacsDD.js +1 -1
  32. package/dist/es/components/BacsDD/BacsDD.js.map +1 -1
  33. package/dist/es/components/BankTransfer/BankTransfer.js +1 -1
  34. package/dist/es/components/BankTransfer/BankTransfer.js.map +1 -1
  35. package/dist/es/components/BcmcMobile/BcmcMobile.js +1 -1
  36. package/dist/es/components/BcmcMobile/BcmcMobile.js.map +1 -1
  37. package/dist/es/components/BillDesk/BillDeskOnline.js +1 -1
  38. package/dist/es/components/BillDesk/BillDeskOnline.js.map +1 -1
  39. package/dist/es/components/BillDesk/BillDeskWallet.js +1 -1
  40. package/dist/es/components/BillDesk/BillDeskWallet.js.map +1 -1
  41. package/dist/es/components/Blik/Blik.js +1 -1
  42. package/dist/es/components/Blik/Blik.js.map +1 -1
  43. package/dist/es/components/Boleto/Boleto.js +1 -1
  44. package/dist/es/components/Boleto/Boleto.js.map +1 -1
  45. package/dist/es/components/Card/Bancontact.js +1 -1
  46. package/dist/es/components/Card/Bancontact.js.map +1 -1
  47. package/dist/es/components/Card/Card.js +1 -1
  48. package/dist/es/components/Card/Card.js.map +1 -1
  49. package/dist/es/components/CashAppPay/CashAppPay.js +1 -1
  50. package/dist/es/components/CashAppPay/CashAppPay.js.map +1 -1
  51. package/dist/es/components/CashAppPay/services/CashAppService.js +1 -1
  52. package/dist/es/components/CashAppPay/services/CashAppService.js.map +1 -1
  53. package/dist/es/components/ClickToPay/ClickToPay.js +1 -1
  54. package/dist/es/components/ClickToPay/ClickToPay.js.map +1 -1
  55. package/dist/es/components/CustomCard/CustomCard.js +1 -1
  56. package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
  57. package/dist/es/components/Doku/Doku.js +1 -1
  58. package/dist/es/components/Doku/Doku.js.map +1 -1
  59. package/dist/es/components/Donation/Donation.js +1 -1
  60. package/dist/es/components/Donation/Donation.js.map +1 -1
  61. package/dist/es/components/Dotpay/index.js +1 -1
  62. package/dist/es/components/Dotpay/index.js.map +1 -1
  63. package/dist/es/components/Dragonpay/Dragonpay.js +1 -1
  64. package/dist/es/components/Dragonpay/Dragonpay.js.map +1 -1
  65. package/dist/es/components/Dropin/Dropin.js +1 -1
  66. package/dist/es/components/Dropin/Dropin.js.map +1 -1
  67. package/dist/es/components/Dropin/components/DropinComponent.js +1 -1
  68. package/dist/es/components/Dropin/components/DropinComponent.js.map +1 -1
  69. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  70. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  71. package/dist/es/components/DuitNow/DuitNow.js +1 -1
  72. package/dist/es/components/DuitNow/DuitNow.js.map +1 -1
  73. package/dist/es/components/EPS/index.js +1 -1
  74. package/dist/es/components/EPS/index.js.map +1 -1
  75. package/dist/es/components/Econtext/Econtext.js +1 -1
  76. package/dist/es/components/Econtext/Econtext.js.map +1 -1
  77. package/dist/es/components/FacilyPay/FacilyPay10x.js +1 -1
  78. package/dist/es/components/FacilyPay/FacilyPay10x.js.map +1 -1
  79. package/dist/es/components/FacilyPay/FacilyPay12x.js +1 -1
  80. package/dist/es/components/FacilyPay/FacilyPay12x.js.map +1 -1
  81. package/dist/es/components/FacilyPay/FacilyPay3x.js +1 -1
  82. package/dist/es/components/FacilyPay/FacilyPay3x.js.map +1 -1
  83. package/dist/es/components/FacilyPay/FacilyPay4x.js +1 -1
  84. package/dist/es/components/FacilyPay/FacilyPay4x.js.map +1 -1
  85. package/dist/es/components/FacilyPay/FacilyPay6x.js +1 -1
  86. package/dist/es/components/FacilyPay/FacilyPay6x.js.map +1 -1
  87. package/dist/es/components/Giftcard/Giftcard.js +1 -1
  88. package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
  89. package/dist/es/components/Giftcard/components/GiftcardComponent.js +1 -1
  90. package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  91. package/dist/es/components/Giropay/Giropay.js +1 -1
  92. package/dist/es/components/Giropay/Giropay.js.map +1 -1
  93. package/dist/es/components/GooglePay/GooglePay.js +1 -1
  94. package/dist/es/components/GooglePay/GooglePay.js.map +1 -1
  95. package/dist/es/components/GooglePay/GooglePayService.js +1 -1
  96. package/dist/es/components/GooglePay/GooglePayService.js.map +1 -1
  97. package/dist/es/components/Klarna/KlarnaPayments.js +1 -1
  98. package/dist/es/components/Klarna/KlarnaPayments.js.map +1 -1
  99. package/dist/es/components/MBWay/MBWay.js +1 -1
  100. package/dist/es/components/MBWay/MBWay.js.map +1 -1
  101. package/dist/es/components/MealVoucherFR/MealVoucherFR.js +1 -1
  102. package/dist/es/components/MealVoucherFR/MealVoucherFR.js.map +1 -1
  103. package/dist/es/components/MolPayEBanking/MolPayEBankingMY.js +1 -1
  104. package/dist/es/components/MolPayEBanking/MolPayEBankingMY.js.map +1 -1
  105. package/dist/es/components/MolPayEBanking/MolPayEBankingTH.js +1 -1
  106. package/dist/es/components/MolPayEBanking/MolPayEBankingTH.js.map +1 -1
  107. package/dist/es/components/MolPayEBanking/MolPayEBankingVN.js +1 -1
  108. package/dist/es/components/MolPayEBanking/MolPayEBankingVN.js.map +1 -1
  109. package/dist/es/components/Multibanco/Multibanco.js +1 -1
  110. package/dist/es/components/Multibanco/Multibanco.js.map +1 -1
  111. package/dist/es/components/OnlineBankingCZ/index.js +1 -1
  112. package/dist/es/components/OnlineBankingCZ/index.js.map +1 -1
  113. package/dist/es/components/OnlineBankingFI/OnlineBankingFI.js +1 -1
  114. package/dist/es/components/OnlineBankingFI/OnlineBankingFI.js.map +1 -1
  115. package/dist/es/components/OnlineBankingIN/index.js +1 -1
  116. package/dist/es/components/OnlineBankingIN/index.js.map +1 -1
  117. package/dist/es/components/OnlineBankingPL/OnlineBankingPL.js +1 -1
  118. package/dist/es/components/OnlineBankingPL/OnlineBankingPL.js.map +1 -1
  119. package/dist/es/components/OnlineBankingSK/index.js +1 -1
  120. package/dist/es/components/OnlineBankingSK/index.js.map +1 -1
  121. package/dist/es/components/Oxxo/Oxxo.js +1 -1
  122. package/dist/es/components/Oxxo/Oxxo.js.map +1 -1
  123. package/dist/es/components/PayByBank/PayByBank.js +1 -1
  124. package/dist/es/components/PayByBank/PayByBank.js.map +1 -1
  125. package/dist/es/components/PayByBankUS/PayByBankUS.js +1 -1
  126. package/dist/es/components/PayByBankUS/PayByBankUS.js.map +1 -1
  127. package/dist/es/components/PayMe/PayMe.js +1 -1
  128. package/dist/es/components/PayMe/PayMe.js.map +1 -1
  129. package/dist/es/components/PayMe/components/PayMeInstructions.js +2 -0
  130. package/dist/es/components/PayMe/components/PayMeInstructions.js.map +1 -0
  131. package/dist/es/components/PayMe/components/PayMeIntroduction.js +2 -0
  132. package/dist/es/components/PayMe/components/PayMeIntroduction.js.map +1 -0
  133. package/dist/es/components/PayNow/PayNow.js +1 -1
  134. package/dist/es/components/PayNow/PayNow.js.map +1 -1
  135. package/dist/es/components/PayNow/components/PayNowInstructions.js +2 -0
  136. package/dist/es/components/PayNow/components/PayNowInstructions.js.map +1 -0
  137. package/dist/es/components/PayNow/components/PayNowIntroduction.js +2 -0
  138. package/dist/es/components/PayNow/components/PayNowIntroduction.js.map +1 -0
  139. package/dist/es/components/PayPal/Paypal.js +1 -1
  140. package/dist/es/components/PayPal/Paypal.js.map +1 -1
  141. package/dist/es/components/PayU/PayuCashcard.js +1 -1
  142. package/dist/es/components/PayU/PayuCashcard.js.map +1 -1
  143. package/dist/es/components/PayU/PayuNetBanking.js +1 -1
  144. package/dist/es/components/PayU/PayuNetBanking.js.map +1 -1
  145. package/dist/es/components/PersonalDetails/PersonalDetails.js +1 -1
  146. package/dist/es/components/PersonalDetails/PersonalDetails.js.map +1 -1
  147. package/dist/es/components/Pix/Pix.js +1 -1
  148. package/dist/es/components/Pix/Pix.js.map +1 -1
  149. package/dist/es/components/PromptPay/PromptPay.js +1 -1
  150. package/dist/es/components/PromptPay/PromptPay.js.map +1 -1
  151. package/dist/es/components/RatePay/RatePay.js +1 -1
  152. package/dist/es/components/RatePay/RatePay.js.map +1 -1
  153. package/dist/es/components/RatePay/RatePayDirectDebit.js +1 -1
  154. package/dist/es/components/RatePay/RatePayDirectDebit.js.map +1 -1
  155. package/dist/es/components/Redirect/Redirect.js +1 -1
  156. package/dist/es/components/Redirect/Redirect.js.map +1 -1
  157. package/dist/es/components/Redirect/components/RedirectShopper/RedirectShopper.js +1 -1
  158. package/dist/es/components/Redirect/components/RedirectShopper/RedirectShopper.js.map +1 -1
  159. package/dist/es/components/Riverty/Riverty.js +1 -1
  160. package/dist/es/components/Riverty/Riverty.js.map +1 -1
  161. package/dist/es/components/Sepa/Sepa.js +1 -1
  162. package/dist/es/components/Sepa/Sepa.js.map +1 -1
  163. package/dist/es/components/Swish/Swish.js +1 -1
  164. package/dist/es/components/Swish/Swish.js.map +1 -1
  165. package/dist/es/components/ThreeDS2/ThreeDS2Challenge.js +1 -1
  166. package/dist/es/components/ThreeDS2/ThreeDS2Challenge.js.map +1 -1
  167. package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js +1 -1
  168. package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  169. package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js +1 -1
  170. package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  171. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  172. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  173. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.js +1 -1
  174. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.js.map +1 -1
  175. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js +1 -1
  176. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
  177. package/dist/es/components/ThreeDS2/components/Form/ThreeDS2Form.js +1 -1
  178. package/dist/es/components/ThreeDS2/components/Form/ThreeDS2Form.js.map +1 -1
  179. package/dist/es/components/Trustly/Trustly.js +1 -1
  180. package/dist/es/components/Trustly/Trustly.js.map +1 -1
  181. package/dist/es/components/Twint/Twint.js +1 -1
  182. package/dist/es/components/Twint/Twint.js.map +1 -1
  183. package/dist/es/components/UPI/UPI.js +1 -1
  184. package/dist/es/components/UPI/UPI.js.map +1 -1
  185. package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
  186. package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
  187. package/dist/es/components/Vipps/Vipps.js +1 -1
  188. package/dist/es/components/Vipps/Vipps.js.map +1 -1
  189. package/dist/es/components/WalletIN/index.js +1 -1
  190. package/dist/es/components/WalletIN/index.js.map +1 -1
  191. package/dist/es/components/WeChat/WeChat.js +1 -1
  192. package/dist/es/components/WeChat/WeChat.js.map +1 -1
  193. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
  194. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  195. package/dist/es/components/helpers/OpenInvoiceContainer/OpenInvoiceContainer.js +1 -1
  196. package/dist/es/components/helpers/OpenInvoiceContainer/OpenInvoiceContainer.js.map +1 -1
  197. package/dist/es/components/helpers/QRLoaderContainer/QRLoaderContainer.js +1 -1
  198. package/dist/es/components/helpers/QRLoaderContainer/QRLoaderContainer.js.map +1 -1
  199. package/dist/es/components/internal/Address/Address.js +1 -1
  200. package/dist/es/components/internal/Address/Address.js.map +1 -1
  201. package/dist/es/components/internal/Address/Specifications.js +1 -1
  202. package/dist/es/components/internal/Address/Specifications.js.map +1 -1
  203. package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
  204. package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
  205. package/dist/es/components/internal/Button/Button.js +1 -1
  206. package/dist/es/components/internal/Button/Button.js.map +1 -1
  207. package/dist/es/components/internal/ClickToPay/errors/TimeoutError.js +1 -1
  208. package/dist/es/components/internal/ClickToPay/errors/TimeoutError.js.map +1 -1
  209. package/dist/es/components/internal/ClickToPay/models/ShopperCard.js +1 -1
  210. package/dist/es/components/internal/ClickToPay/models/ShopperCard.js.map +1 -1
  211. package/dist/es/components/internal/ClickToPay/services/ClickToPayService.js +1 -1
  212. package/dist/es/components/internal/ClickToPay/services/ClickToPayService.js.map +1 -1
  213. package/dist/es/components/internal/ClickToPay/services/sdks/AbstractSrcInitiator.js +1 -1
  214. package/dist/es/components/internal/ClickToPay/services/sdks/AbstractSrcInitiator.js.map +1 -1
  215. package/dist/es/components/internal/ClickToPay/services/sdks/MastercardSdk.js +1 -1
  216. package/dist/es/components/internal/ClickToPay/services/sdks/MastercardSdk.js.map +1 -1
  217. package/dist/es/components/internal/ClickToPay/services/sdks/SrcSdkLoader.js +1 -1
  218. package/dist/es/components/internal/ClickToPay/services/sdks/SrcSdkLoader.js.map +1 -1
  219. package/dist/es/components/internal/ClickToPay/services/sdks/SrciError.js +1 -1
  220. package/dist/es/components/internal/ClickToPay/services/sdks/SrciError.js.map +1 -1
  221. package/dist/es/components/internal/ClickToPay/services/sdks/VisaSdk.js +1 -1
  222. package/dist/es/components/internal/ClickToPay/services/sdks/VisaSdk.js.map +1 -1
  223. package/dist/es/components/internal/Countdown/CountdownA11yReporter.js +1 -1
  224. package/dist/es/components/internal/Countdown/CountdownA11yReporter.js.map +1 -1
  225. package/dist/es/components/internal/FormFields/ConsentCheckbox/ConsentCheckbox.js +1 -1
  226. package/dist/es/components/internal/FormFields/ConsentCheckbox/ConsentCheckbox.js.map +1 -1
  227. package/dist/es/components/internal/IFrame/Iframe.js +1 -1
  228. package/dist/es/components/internal/IFrame/Iframe.js.map +1 -1
  229. package/dist/es/components/internal/IbanInput/IbanInput.js +1 -1
  230. package/dist/es/components/internal/IbanInput/IbanInput.js.map +1 -1
  231. package/dist/es/components/internal/QRLoader/QRLoader.js +1 -1
  232. package/dist/es/components/internal/QRLoader/QRLoader.js.map +1 -1
  233. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  234. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  235. package/dist/es/components/internal/SecuredFields/lib/CSF/AbstractCSF.js +1 -1
  236. package/dist/es/components/internal/SecuredFields/lib/CSF/AbstractCSF.js.map +1 -1
  237. package/dist/es/components/internal/SecuredFields/lib/CSF/CSF.js +1 -1
  238. package/dist/es/components/internal/SecuredFields/lib/CSF/CSF.js.map +1 -1
  239. package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
  240. package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  241. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  242. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  243. package/dist/es/components/internal/Timeline/Timeline.js +2 -0
  244. package/dist/es/components/internal/Timeline/Timeline.js.map +1 -0
  245. package/dist/es/components/internal/Timeline/TimelineWrapper.js +2 -0
  246. package/dist/es/components/internal/Timeline/TimelineWrapper.js.map +1 -0
  247. package/dist/es/components/internal/UIElement/UIElement.js +1 -1
  248. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  249. package/dist/es/core/CheckoutSession/CheckoutSession.js +1 -1
  250. package/dist/es/core/CheckoutSession/CheckoutSession.js.map +1 -1
  251. package/dist/es/core/Context/Resources.js +1 -1
  252. package/dist/es/core/Context/Resources.js.map +1 -1
  253. package/dist/es/core/Errors/AdyenCheckoutError.js +1 -1
  254. package/dist/es/core/Errors/AdyenCheckoutError.js.map +1 -1
  255. package/dist/es/core/Errors/SRPanel.js +1 -1
  256. package/dist/es/core/Errors/SRPanel.js.map +1 -1
  257. package/dist/es/core/ProcessResponse/PaymentMethods/PaymentMethods.js +1 -1
  258. package/dist/es/core/ProcessResponse/PaymentMethods/PaymentMethods.js.map +1 -1
  259. package/dist/es/core/RiskModule/RiskModule.js +1 -1
  260. package/dist/es/core/RiskModule/RiskModule.js.map +1 -1
  261. package/dist/es/core/RiskModule/components/DeviceFingerprint/DeviceFingerprint.js +1 -1
  262. package/dist/es/core/RiskModule/components/DeviceFingerprint/DeviceFingerprint.js.map +1 -1
  263. package/dist/es/core/RiskModule/components/DeviceFingerprint/GetDeviceFingerprint.js +1 -1
  264. package/dist/es/core/RiskModule/components/DeviceFingerprint/GetDeviceFingerprint.js.map +1 -1
  265. package/dist/es/core/Services/analytics/collect-id.js +1 -1
  266. package/dist/es/core/core.js +1 -1
  267. package/dist/es/core/core.js.map +1 -1
  268. package/dist/es/core/core.registry.js +1 -1
  269. package/dist/es/core/core.registry.js.map +1 -1
  270. package/dist/es/index.d.ts +27 -19
  271. package/dist/es/language/Language.js +1 -1
  272. package/dist/es/language/Language.js.map +1 -1
  273. package/dist/es/utils/Script.js +1 -1
  274. package/dist/es/utils/Script.js.map +1 -1
  275. package/dist/es/utils/Storage.js +1 -1
  276. package/dist/es/utils/Storage.js.map +1 -1
  277. package/dist/es/utils/Validator/ValidationRuleResult.js +1 -1
  278. package/dist/es/utils/Validator/ValidationRuleResult.js.map +1 -1
  279. package/dist/es/utils/Validator/Validator.js +1 -1
  280. package/dist/es/utils/Validator/Validator.js.map +1 -1
  281. package/dist/es/utils/constants/currency-decimals.js +1 -1
  282. package/dist/es/utils/constants/currency-decimals.js.map +1 -1
  283. package/dist/es/utils/constants/currency-minor-units.js.map +1 -1
  284. package/dist/es/utils/useForm/reducer.js +1 -1
  285. package/dist/es/utils/useForm/reducer.js.map +1 -1
  286. package/dist/es/utils/useForm/useForm.js +1 -1
  287. package/dist/es/utils/useForm/useForm.js.map +1 -1
  288. package/dist/es/utils/useIsMobile.js +2 -0
  289. package/dist/es/utils/useIsMobile.js.map +1 -0
  290. package/dist/es-legacy/adyen.css +7 -3
  291. package/dist/es-legacy/adyen.css.map +1 -1
  292. package/dist/es-legacy/components/BcmcMobile/BcmcMobile.js +1 -1
  293. package/dist/es-legacy/components/BcmcMobile/BcmcMobile.js.map +1 -1
  294. package/dist/es-legacy/components/PayMe/PayMe.js +1 -1
  295. package/dist/es-legacy/components/PayMe/PayMe.js.map +1 -1
  296. package/dist/es-legacy/components/PayMe/components/PayMeInstructions.js +2 -0
  297. package/dist/es-legacy/components/PayMe/components/PayMeInstructions.js.map +1 -0
  298. package/dist/es-legacy/components/PayMe/components/PayMeIntroduction.js +2 -0
  299. package/dist/es-legacy/components/PayMe/components/PayMeIntroduction.js.map +1 -0
  300. package/dist/es-legacy/components/PayNow/PayNow.js +1 -1
  301. package/dist/es-legacy/components/PayNow/PayNow.js.map +1 -1
  302. package/dist/es-legacy/components/PayNow/components/PayNowInstructions.js +2 -0
  303. package/dist/es-legacy/components/PayNow/components/PayNowInstructions.js.map +1 -0
  304. package/dist/es-legacy/components/PayNow/components/PayNowIntroduction.js +2 -0
  305. package/dist/es-legacy/components/PayNow/components/PayNowIntroduction.js.map +1 -0
  306. package/dist/es-legacy/components/Swish/Swish.js.map +1 -1
  307. package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
  308. package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
  309. package/dist/es-legacy/components/internal/Address/Address.js +1 -1
  310. package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
  311. package/dist/es-legacy/components/internal/QRLoader/QRLoader.js +1 -1
  312. package/dist/es-legacy/components/internal/QRLoader/QRLoader.js.map +1 -1
  313. package/dist/es-legacy/components/internal/Timeline/Timeline.js +2 -0
  314. package/dist/es-legacy/components/internal/Timeline/Timeline.js.map +1 -0
  315. package/dist/es-legacy/components/internal/Timeline/TimelineWrapper.js +2 -0
  316. package/dist/es-legacy/components/internal/Timeline/TimelineWrapper.js.map +1 -0
  317. package/dist/es-legacy/core/Services/analytics/collect-id.js +1 -1
  318. package/dist/es-legacy/core/core.js +1 -1
  319. package/dist/es-legacy/utils/constants/currency-decimals.js +1 -1
  320. package/dist/es-legacy/utils/constants/currency-decimals.js.map +1 -1
  321. package/dist/es-legacy/utils/constants/currency-minor-units.js.map +1 -1
  322. package/dist/es-legacy/utils/useForm/reducer.js +1 -1
  323. package/dist/es-legacy/utils/useForm/reducer.js.map +1 -1
  324. package/dist/es-legacy/utils/useForm/useForm.js +1 -1
  325. package/dist/es-legacy/utils/useForm/useForm.js.map +1 -1
  326. package/dist/es-legacy/utils/useIsMobile.js +2 -0
  327. package/dist/es-legacy/utils/useIsMobile.js.map +1 -0
  328. package/package.json +4 -2
  329. package/styles/adyen.css +7 -3
  330. package/dist/es/components/PayMe/Instructions.js +0 -2
  331. package/dist/es/components/PayMe/Instructions.js.map +0 -1
  332. package/dist/es-legacy/components/PayMe/Instructions.js +0 -2
  333. package/dist/es-legacy/components/PayMe/Instructions.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{Language as t}from"../language/Language.js";import o from"./RiskModule/RiskModule.js";import s from"./ProcessResponse/PaymentMethods/PaymentMethods.js";import{getComponentForAction as e}from"./ProcessResponse/PaymentAction/PaymentAction.js";import i from"./Analytics/Analytics.js";import{assertConfigurationPropertiesAreValid as n,processGlobalOptions as a}from"./utils.js";import r from"./CheckoutSession/CheckoutSession.js";import{hasOwnProperty as h}from"../utils/hasOwnProperty.js";import{Resources as l}from"./Context/Resources.js";import{SRPanel as c}from"./Errors/SRPanel.js";import p from"./core.registry.js";import{sanitizeResponse as m,verifyPaymentDidNotFail as d,cleanupFinalResult as u}from"../components/internal/UIElement/utils.js";import y,{IMPLEMENTATION_ERROR as g}from"./Errors/AdyenCheckoutError.js";import{ANALYTICS_ACTION_STR as f}from"./Analytics/constants.js";import{THREEDS2_FULL as C}from"../components/ThreeDS2/constants.js";import{DEFAULT_LOCALE as w}from"../language/constants.js";import j from"./Services/get-translations.js";import{defaultProps as E}from"./core.defaultProps.js";import{formatLocale as v,formatCustomTranslations as A}from"../language/utils.js";import{resolveEnvironments as b}from"./Environment/Environment.js";class P{session;paymentMethodsResponse;modules;options;analyticsContext;loadingContext;cdnImagesUrl;cdnTranslationsUrl;components=[];static metadata={version:"6.4.0",bundleType:"esm"};static registry=p;static setBundleType(t){P.metadata.bundleType=t}static register(...t){p.add(...t)}register(...t){p.add(...t)}getComponent(t){return p.getComponent(t)}constructor(t){n(t),this.createFromAction=this.createFromAction.bind(this),this.setOptions({...E,...t});const{apiUrl:o,analyticsUrl:s,cdnImagesUrl:e,cdnTranslationsUrl:i}=b(this.options.environment,this.options._environmentUrls);this.loadingContext=o,this.analyticsContext=s,this.cdnImagesUrl=e,this.cdnTranslationsUrl=i,this.session=this.options.session&&new r(this.options.session,this.options.clientKey,this.loadingContext);const a=this.options.clientKey?.substring(0,4);if(("test"===a||"live"===a)&&!this.loadingContext.includes(a))throw new y("IMPLEMENTATION_ERROR",`Error: you are using a ${a} clientKey against the ${this.options._environmentUrls?.api||this.options.environment} environment`);"pub."===a&&console.debug(`The value you are passing as your "clientKey" looks like an originKey (${this.options.clientKey?.substring(0,12)}..). Although this is supported it is not the recommended way to integrate. To generate a clientKey, see the documentation (https://docs.adyen.com/development-resources/client-side-authentication/migrate-from-origin-key-to-client-key/) for more details.`),this.options.exposeLibraryMetadata&&(window.AdyenWebMetadata=P.metadata)}async initialize(){return await this.initializeCore(),this.validateCoreConfiguration(),await this.createCoreModules(),this}async initializeCore(){return this.session?this.session.setupSession(this.options).then((t=>{const{amount:o,shopperLocale:s,countryCode:e,paymentMethods:i,...n}=t;return this.setOptions({...n,amount:this.options.order?this.options.order.remainingAmount:o,locale:this.options.locale||s,countryCode:this.options.countryCode||e}),this.createPaymentMethodsList(i),this})).catch((t=>(this.options.onError&&this.options.onError(t),Promise.reject(t)))):(this.createPaymentMethodsList(),Promise.resolve(this))}async fetchLocaleTranslations(){try{return await j(this.cdnTranslationsUrl,P.metadata.version,this.options.locale)}catch(t){t instanceof y?this.options.onError?.(t):this.options.onError?.(new y("ERROR","Failed to fetch translation",{cause:t}))}}validateCoreConfiguration(){if(this.options.paymentMethodsConfiguration&&console.warn('WARNING: "paymentMethodsConfiguration" is supported only by Drop-in.'),!this.options.countryCode)throw new y(g,"You must specify a countryCode when initializing checkout.");this.options.locale||this.setOptions({locale:w}),this.options.locale=v(this.options.locale),this.options.translations=A(this.options.translations)}submitDetails(t){let o=null;this.options.onAdditionalDetails&&(o=new Promise(((o,s)=>{this.options.onAdditionalDetails({data:t},void 0,{resolve:o,reject:s})}))),this.session&&(o=this.session.submitDetails(t).catch((t=>(this.options.onError?.(t),Promise.reject(t))))),o?o.then(m).then(d).then((t=>{u(t),this.options.onPaymentCompleted?.(t)})).catch((t=>{u(t),this.options.onPaymentFailed?.(t)})):this.options.onError?.(new y("IMPLEMENTATION_ERROR",'It can not submit the details. The callback "onAdditionalDetails" or the Session is not setup correctly.'))}createFromAction(t,o={}){if(!t||!t.type){if(h(t,"action")&&h(t,"resultCode"))throw new Error('createFromAction::Invalid Action - the passed action object itself has an "action" property and a "resultCode": have you passed in the whole response object by mistake?');throw new Error('createFromAction::Invalid Action - the passed action object does not have a "type" property')}if(t.type){const s=t.type===C?`${t.type}${t.subtype}`:t.paymentMethodType;this.modules.analytics.sendAnalytics(s,{type:f,subtype:t.type,message:`${s} action was handled by the SDK`});const i={...this.getCorePropsForComponent(),...o};return e(this,p,t,i)}return this.handleCreateError()}update=(t={})=>(this.setOptions(t),this.initialize().then((()=>(this.components.forEach((o=>{const s={...t,...this.session&&{session:this.session}};o.update(s)})),this))));remove=t=>(this.components=this.components.filter((o=>o._id!==t._id)),t.unmount(),this);setOptions=t=>{this.options={...this.options,...t,locale:t?.locale||this.options?.locale}};getCorePropsForComponent(){return{...a(this.options),core:this,i18n:this.modules.i18n,modules:this.modules,session:this.session,loadingContext:this.loadingContext,cdnContext:this.cdnImagesUrl,createFromAction:this.createFromAction}}storeElementReference(t){t&&this.components.push(t)}handleCreateError(t){const o=t?`${t?.name??"The passed payment method"} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(t)}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`:"No Payment Method component was passed";throw new Error(o)}createPaymentMethodsList(t){this.paymentMethodsResponse=new s(this.options.paymentMethodsResponse||t,this.options)}async createCoreModules(){if(this.modules)return;const s=await this.fetchLocaleTranslations();this.modules=Object.freeze({risk:new o(this,{...this.options,loadingContext:this.loadingContext}),analytics:i({loadingContext:this.loadingContext,analyticsContext:this.analyticsContext,clientKey:this.options.clientKey,locale:this.options.locale,analytics:this.options.analytics,amount:this.options.amount,bundleType:P.metadata.bundleType}),resources:new l(this.cdnImagesUrl),i18n:new t({locale:this.options.locale,translations:s,customTranslations:this.options.translations}),srPanel:new c(this,{...this.options.srConfig})})}}export{P as default};
1
+ import{Language as t}from"../language/Language.js";import o from"./RiskModule/RiskModule.js";import s from"./ProcessResponse/PaymentMethods/PaymentMethods.js";import{getComponentForAction as e}from"./ProcessResponse/PaymentAction/PaymentAction.js";import i from"./Analytics/Analytics.js";import{processGlobalOptions as n,assertConfigurationPropertiesAreValid as a}from"./utils.js";import r from"./CheckoutSession/CheckoutSession.js";import{hasOwnProperty as h}from"../utils/hasOwnProperty.js";import{Resources as l}from"./Context/Resources.js";import{SRPanel as c}from"./Errors/SRPanel.js";import p from"./core.registry.js";import{sanitizeResponse as m,verifyPaymentDidNotFail as d,cleanupFinalResult as u}from"../components/internal/UIElement/utils.js";import y,{IMPLEMENTATION_ERROR as g}from"./Errors/AdyenCheckoutError.js";import{ANALYTICS_ACTION_STR as f}from"./Analytics/constants.js";import{THREEDS2_FULL as C}from"../components/ThreeDS2/constants.js";import{DEFAULT_LOCALE as w}from"../language/constants.js";import v from"./Services/get-translations.js";import{defaultProps as b}from"./core.defaultProps.js";import{formatLocale as j,formatCustomTranslations as E}from"../language/utils.js";import{resolveEnvironments as A}from"./Environment/Environment.js";function P(t,o,s){return o in t?Object.defineProperty(t,o,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[o]=s,t}class M{static setBundleType(t){M.metadata.bundleType=t}static register(...t){p.add(...t)}register(...t){p.add(...t)}getComponent(t){return p.getComponent(t)}async initialize(){return await this.initializeCore(),this.validateCoreConfiguration(),await this.createCoreModules(),this}async initializeCore(){return this.session?this.session.setupSession(this.options).then((t=>{const{amount:o,shopperLocale:s,countryCode:e,paymentMethods:i,...n}=t;return this.setOptions({...n,amount:this.options.order?this.options.order.remainingAmount:o,locale:this.options.locale||s,countryCode:this.options.countryCode||e}),this.createPaymentMethodsList(i),this})).catch((t=>(this.options.onError&&this.options.onError(t),Promise.reject(t)))):(this.createPaymentMethodsList(),Promise.resolve(this))}async fetchLocaleTranslations(){try{return await v(this.cdnTranslationsUrl,M.metadata.version,this.options.locale)}catch(t){t instanceof y?this.options.onError?.(t):this.options.onError?.(new y("ERROR","Failed to fetch translation",{cause:t}))}}validateCoreConfiguration(){if(this.options.paymentMethodsConfiguration&&console.warn('WARNING: "paymentMethodsConfiguration" is supported only by Drop-in.'),!this.options.countryCode)throw new y(g,"You must specify a countryCode when initializing checkout.");this.options.locale||this.setOptions({locale:w}),this.options.locale=j(this.options.locale),this.options.translations=E(this.options.translations)}submitDetails(t){let o=null;this.options.onAdditionalDetails&&(o=new Promise(((o,s)=>{this.options.onAdditionalDetails({data:t},void 0,{resolve:o,reject:s})}))),this.session&&(o=this.session.submitDetails(t).catch((t=>(this.options.onError?.(t),Promise.reject(t))))),o?o.then(m).then(d).then((t=>{u(t),this.options.onPaymentCompleted?.(t)})).catch((t=>{u(t),this.options.onPaymentFailed?.(t)})):this.options.onError?.(new y("IMPLEMENTATION_ERROR",'It can not submit the details. The callback "onAdditionalDetails" or the Session is not setup correctly.'))}createFromAction(t,o={}){if(!t||!t.type){if(h(t,"action")&&h(t,"resultCode"))throw new Error('createFromAction::Invalid Action - the passed action object itself has an "action" property and a "resultCode": have you passed in the whole response object by mistake?');throw new Error('createFromAction::Invalid Action - the passed action object does not have a "type" property')}if(t.type){const s=t.type===C?`${t.type}${t.subtype}`:t.paymentMethodType;this.modules.analytics.sendAnalytics(s,{type:f,subtype:t.type,message:`${s} action was handled by the SDK`});const i={...this.getCorePropsForComponent(),...o};return e(this,p,t,i)}return this.handleCreateError()}getCorePropsForComponent(){return{...n(this.options),core:this,i18n:this.modules.i18n,modules:this.modules,session:this.session,loadingContext:this.loadingContext,cdnContext:this.cdnImagesUrl,createFromAction:this.createFromAction}}storeElementReference(t){t&&this.components.push(t)}handleCreateError(t){const o=t?`${t?.name??"The passed payment method"} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(t)}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`:"No Payment Method component was passed";throw new Error(o)}createPaymentMethodsList(t){this.paymentMethodsResponse=new s(this.options.paymentMethodsResponse||t,this.options)}async createCoreModules(){if(this.modules)return;const s=await this.fetchLocaleTranslations();this.modules=Object.freeze({risk:new o(this,{...this.options,loadingContext:this.loadingContext}),analytics:i({loadingContext:this.loadingContext,analyticsContext:this.analyticsContext,clientKey:this.options.clientKey,locale:this.options.locale,analytics:this.options.analytics,amount:this.options.amount,bundleType:M.metadata.bundleType}),resources:new l(this.cdnImagesUrl),i18n:new t({locale:this.options.locale,translations:s,customTranslations:this.options.translations}),srPanel:new c(this,{...this.options.srConfig})})}constructor(t){P(this,"session",void 0),P(this,"paymentMethodsResponse",void 0),P(this,"modules",void 0),P(this,"options",void 0),P(this,"analyticsContext",void 0),P(this,"loadingContext",void 0),P(this,"cdnImagesUrl",void 0),P(this,"cdnTranslationsUrl",void 0),P(this,"components",[]),P(this,"update",((t={})=>(this.setOptions(t),this.initialize().then((()=>(this.components.forEach((o=>{const s={...t,...this.session&&{session:this.session}};o.update(s)})),this)))))),P(this,"remove",(t=>(this.components=this.components.filter((o=>o._id!==t._id)),t.unmount(),this))),P(this,"setOptions",(t=>{this.options={...this.options,...t,locale:t?.locale||this.options?.locale}})),a(t),this.createFromAction=this.createFromAction.bind(this),this.setOptions({...b,...t});const{apiUrl:o,analyticsUrl:s,cdnImagesUrl:e,cdnTranslationsUrl:i}=A(this.options.environment,this.options._environmentUrls);this.loadingContext=o,this.analyticsContext=s,this.cdnImagesUrl=e,this.cdnTranslationsUrl=i,this.session=this.options.session&&new r(this.options.session,this.options.clientKey,this.loadingContext);const n=this.options.clientKey?.substring(0,4);if(("test"===n||"live"===n)&&!this.loadingContext.includes(n))throw new y("IMPLEMENTATION_ERROR",`Error: you are using a ${n} clientKey against the ${this.options._environmentUrls?.api||this.options.environment} environment`);"pub."===n&&console.debug(`The value you are passing as your "clientKey" looks like an originKey (${this.options.clientKey?.substring(0,12)}..). Although this is supported it is not the recommended way to integrate. To generate a clientKey, see the documentation (https://docs.adyen.com/development-resources/client-side-authentication/migrate-from-origin-key-to-client-key/) for more details.`),this.options.exposeLibraryMetadata&&(window.AdyenWebMetadata=M.metadata)}}P(M,"metadata",{version:"6.5.0",bundleType:"esm"}),P(M,"registry",p);export{M as default};
2
2
  //# sourceMappingURL=core.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"core.js","sources":["../../../src/core/core.ts"],"sourcesContent":["import Language from '../language';\nimport UIElement from '../components/internal/UIElement/UIElement';\nimport RiskModule from './RiskModule';\nimport PaymentMethods from './ProcessResponse/PaymentMethods';\nimport getComponentForAction from './ProcessResponse/PaymentAction';\nimport Analytics from './Analytics';\nimport { assertConfigurationPropertiesAreValid, processGlobalOptions } from './utils';\nimport Session from './CheckoutSession';\nimport { hasOwnProperty } from '../utils/hasOwnProperty';\nimport { Resources } from './Context/Resources';\nimport { SRPanel } from './Errors/SRPanel';\nimport registry, { NewableComponent } from './core.registry';\nimport { cleanupFinalResult, sanitizeResponse, verifyPaymentDidNotFail } from '../components/internal/UIElement/utils';\nimport AdyenCheckoutError, { IMPLEMENTATION_ERROR } from './Errors/AdyenCheckoutError';\nimport { ANALYTICS_ACTION_STR } from './Analytics/constants';\nimport { THREEDS2_FULL } from '../components/ThreeDS2/constants';\nimport { DEFAULT_LOCALE } from '../language/constants';\nimport getTranslations from './Services/get-translations';\nimport { defaultProps } from './core.defaultProps';\nimport { formatCustomTranslations, formatLocale } from '../language/utils';\nimport { resolveEnvironments } from './Environment';\n\nimport type { AnalyticsModule, PaymentAction, PaymentResponseData } from '../types/global-types';\nimport type { CoreConfiguration, ICore, AdditionalDetailsData } from './types';\nimport type { Translations } from '../language/types';\nimport type { UIElementProps } from '../components/internal/UIElement/types';\n\nclass Core implements ICore {\n public session?: Session;\n public paymentMethodsResponse: PaymentMethods;\n public modules: Readonly<{\n risk: RiskModule;\n analytics: AnalyticsModule;\n resources: Resources;\n i18n: Language;\n srPanel: SRPanel;\n }>;\n public options: CoreConfiguration;\n\n public analyticsContext: string;\n public loadingContext: string;\n public cdnImagesUrl: string;\n public cdnTranslationsUrl: string;\n\n private components: UIElement[] = [];\n\n public static readonly metadata = {\n version: process.env.VERSION,\n bundleType: process.env.BUNDLE_TYPE\n };\n\n public static registry = registry;\n\n public static setBundleType(type: string): void {\n Core.metadata.bundleType = type;\n }\n\n public static register(...items: NewableComponent[]) {\n registry.add(...items);\n }\n\n /**\n * Used internally by the PaymentMethod components to auto-register themselves\n * @internal\n */\n public register(...items: NewableComponent[]) {\n registry.add(...items);\n }\n\n public getComponent(txVariant: string) {\n return registry.getComponent(txVariant);\n }\n\n constructor(props: CoreConfiguration) {\n assertConfigurationPropertiesAreValid(props);\n\n this.createFromAction = this.createFromAction.bind(this);\n\n this.setOptions({ ...defaultProps, ...props });\n\n const { apiUrl, analyticsUrl, cdnImagesUrl, cdnTranslationsUrl } = resolveEnvironments(\n this.options.environment,\n this.options._environmentUrls\n );\n\n this.loadingContext = apiUrl;\n this.analyticsContext = analyticsUrl;\n this.cdnImagesUrl = cdnImagesUrl;\n this.cdnTranslationsUrl = cdnTranslationsUrl;\n\n this.session = this.options.session && new Session(this.options.session, this.options.clientKey, this.loadingContext);\n\n const clientKeyType = this.options.clientKey?.substring(0, 4);\n if ((clientKeyType === 'test' || clientKeyType === 'live') && !this.loadingContext.includes(clientKeyType)) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Error: you are using a ${clientKeyType} clientKey against the ${this.options._environmentUrls?.api || this.options.environment} environment`\n );\n }\n if (clientKeyType === 'pub.') {\n console.debug(\n `The value you are passing as your \"clientKey\" looks like an originKey (${this.options.clientKey?.substring(0, 12)}..). Although this is supported it is not the recommended way to integrate. To generate a clientKey, see the documentation (https://docs.adyen.com/development-resources/client-side-authentication/migrate-from-origin-key-to-client-key/) for more details.`\n );\n }\n\n if (this.options.exposeLibraryMetadata) {\n window['AdyenWebMetadata'] = Core.metadata;\n }\n }\n\n public async initialize(): Promise<this> {\n await this.initializeCore();\n this.validateCoreConfiguration();\n await this.createCoreModules();\n return this;\n }\n\n private async initializeCore(): Promise<this> {\n if (this.session) {\n return this.session\n .setupSession(this.options)\n .then(sessionResponse => {\n const { amount, shopperLocale, countryCode, paymentMethods, ...rest } = sessionResponse;\n\n this.setOptions({\n ...rest,\n amount: this.options.order ? this.options.order.remainingAmount : amount,\n locale: this.options.locale || shopperLocale,\n countryCode: this.options.countryCode || countryCode\n });\n\n this.createPaymentMethodsList(paymentMethods);\n\n return this;\n })\n .catch(error => {\n if (this.options.onError) this.options.onError(error);\n return Promise.reject(error);\n });\n }\n\n this.createPaymentMethodsList();\n return Promise.resolve(this);\n }\n\n private async fetchLocaleTranslations(): Promise<Translations> {\n try {\n return await getTranslations(this.cdnTranslationsUrl, Core.metadata.version, this.options.locale);\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) this.options.onError?.(error);\n else this.options.onError?.(new AdyenCheckoutError('ERROR', 'Failed to fetch translation', { cause: error }));\n }\n }\n\n private validateCoreConfiguration(): void {\n // @ts-ignore This property does not exist, although merchants might be using when migrating from v5 to v6\n if (this.options.paymentMethodsConfiguration) {\n console.warn('WARNING: \"paymentMethodsConfiguration\" is supported only by Drop-in.');\n }\n\n if (!this.options.countryCode) {\n throw new AdyenCheckoutError(IMPLEMENTATION_ERROR, 'You must specify a countryCode when initializing checkout.');\n }\n\n if (!this.options.locale) {\n this.setOptions({ locale: DEFAULT_LOCALE });\n }\n\n this.options.locale = formatLocale(this.options.locale);\n this.options.translations = formatCustomTranslations(this.options.translations);\n }\n\n /**\n * Method used when handling redirects. It submits details using 'onAdditionalDetails' or the Sessions flow if available.\n *\n * @public\n * @see {https://docs.adyen.com/online-payments/build-your-integration/?platform=Web&integration=Components&version=5.55.1#handle-the-redirect}\n * @param details - Details object containing the redirectResult\n */\n public submitDetails(details: AdditionalDetailsData['data']): void {\n let promise = null;\n\n if (this.options.onAdditionalDetails) {\n promise = new Promise((resolve, reject) => {\n this.options.onAdditionalDetails({ data: details }, undefined, { resolve, reject });\n });\n }\n\n if (this.session) {\n promise = this.session.submitDetails(details).catch(error => {\n this.options.onError?.(error);\n return Promise.reject(error);\n });\n }\n\n if (!promise) {\n this.options.onError?.(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not submit the details. The callback \"onAdditionalDetails\" or the Session is not setup correctly.'\n )\n );\n return;\n }\n\n promise\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then((response: PaymentResponseData) => {\n cleanupFinalResult(response);\n this.options.onPaymentCompleted?.(response);\n })\n .catch((response: PaymentResponseData) => {\n cleanupFinalResult(response);\n this.options.onPaymentFailed?.(response);\n });\n }\n\n /**\n * Instantiates a new element component ready to be mounted from an action object\n *\n * @param action - action defining the component with the component data\n * @param options - options that will be merged to the global Checkout props\n * @returns new UIElement\n */\n public createFromAction(action: PaymentAction, options = {}): UIElement {\n if (!action || !action.type) {\n if (hasOwnProperty(action, 'action') && hasOwnProperty(action, 'resultCode')) {\n throw new Error(\n 'createFromAction::Invalid Action - the passed action object itself has an \"action\" property and ' +\n 'a \"resultCode\": have you passed in the whole response object by mistake?'\n );\n }\n throw new Error('createFromAction::Invalid Action - the passed action object does not have a \"type\" property');\n }\n\n if (action.type) {\n // 'threeDS2' OR 'qrCode', 'voucher', 'redirect', 'await', 'bankTransfer`\n const component = action.type === THREEDS2_FULL ? `${action.type}${action.subtype}` : action.paymentMethodType;\n\n this.modules.analytics.sendAnalytics(component, {\n type: ANALYTICS_ACTION_STR,\n subtype: action.type,\n message: `${component} action was handled by the SDK`\n });\n\n const props = {\n ...this.getCorePropsForComponent(),\n ...options\n };\n\n return getComponentForAction(this, registry, action, props);\n }\n\n return this.handleCreateError();\n }\n\n /**\n * Updates global configurations, resets the internal state and remounts each element.\n *\n * @param options - props to update\n * @returns this - the element instance\n */\n public update = (options: Partial<CoreConfiguration> = {}): Promise<this> => {\n this.setOptions(options);\n\n return this.initialize().then(() => {\n this.components.forEach(component => {\n // We update only with the new options that have been received\n const newProps: Partial<UIElementProps> = {\n ...options,\n ...(this.session && { session: this.session })\n };\n component.update(newProps);\n });\n return this;\n });\n };\n\n /**\n * Remove the reference of a component\n * @param component - reference to the component to be removed\n * @returns this - the element instance\n * // TODO: Do we need this?\n */\n public remove = (component): this => {\n this.components = this.components.filter(c => c._id !== component._id);\n component.unmount();\n\n return this;\n };\n\n /**\n * @internal\n * Create or update the config object passed when AdyenCheckout is initialised (environment, clientKey, etc...)\n */\n private setOptions = (options: CoreConfiguration): void => {\n this.options = {\n ...this.options,\n ...options,\n locale: options?.locale || this.options?.locale\n };\n };\n\n /**\n * @internal\n * @returns props for a new UIElement\n */\n public getCorePropsForComponent(): any {\n const globalOptions = processGlobalOptions(this.options);\n\n return {\n ...globalOptions,\n core: this,\n i18n: this.modules.i18n,\n modules: this.modules,\n session: this.session,\n loadingContext: this.loadingContext,\n cdnContext: this.cdnImagesUrl,\n createFromAction: this.createFromAction\n };\n }\n\n public storeElementReference(element: UIElement) {\n if (element) {\n this.components.push(element);\n }\n }\n\n /**\n * @internal\n */\n private handleCreateError(paymentMethod?): never {\n const paymentMethodName = paymentMethod?.name ?? 'The passed payment method';\n const errorMessage = paymentMethod\n ? `${paymentMethodName} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(\n paymentMethod\n )}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`\n : 'No Payment Method component was passed';\n\n throw new Error(errorMessage);\n }\n\n private createPaymentMethodsList(paymentMethodsResponse?: PaymentMethods): void {\n this.paymentMethodsResponse = new PaymentMethods(this.options.paymentMethodsResponse || paymentMethodsResponse, this.options);\n }\n\n private async createCoreModules(): Promise<void> {\n if (this.modules) {\n if (process.env.NODE_ENV === 'development') {\n console.warn('Core: Core modules are already created.');\n }\n return;\n }\n\n const translations = await this.fetchLocaleTranslations();\n\n this.modules = Object.freeze({\n risk: new RiskModule(this, { ...this.options, loadingContext: this.loadingContext }),\n analytics: Analytics({\n loadingContext: this.loadingContext,\n analyticsContext: this.analyticsContext,\n clientKey: this.options.clientKey,\n locale: this.options.locale,\n analytics: this.options.analytics,\n amount: this.options.amount,\n bundleType: Core.metadata.bundleType\n }),\n resources: new Resources(this.cdnImagesUrl),\n i18n: new Language({\n locale: this.options.locale,\n translations,\n customTranslations: this.options.translations\n }),\n srPanel: new SRPanel(this, { ...this.options.srConfig })\n });\n }\n}\n\nexport default Core;\n"],"names":["Core","session","paymentMethodsResponse","modules","options","analyticsContext","loadingContext","cdnImagesUrl","cdnTranslationsUrl","components","static","version","bundleType","registry","setBundleType","type","metadata","register","items","add","getComponent","txVariant","constructor","props","assertConfigurationPropertiesAreValid","this","createFromAction","bind","setOptions","defaultProps","apiUrl","analyticsUrl","resolveEnvironments","environment","_environmentUrls","Session","clientKey","clientKeyType","substring","includes","AdyenCheckoutError","api","console","debug","exposeLibraryMetadata","window","initialize","initializeCore","validateCoreConfiguration","createCoreModules","setupSession","then","sessionResponse","amount","shopperLocale","countryCode","paymentMethods","rest","order","remainingAmount","locale","createPaymentMethodsList","catch","error","onError","Promise","reject","resolve","fetchLocaleTranslations","getTranslations","cause","paymentMethodsConfiguration","warn","IMPLEMENTATION_ERROR","DEFAULT_LOCALE","formatLocale","translations","formatCustomTranslations","submitDetails","details","promise","onAdditionalDetails","data","undefined","sanitizeResponse","verifyPaymentDidNotFail","response","cleanupFinalResult","onPaymentCompleted","onPaymentFailed","action","hasOwnProperty","Error","component","THREEDS2_FULL","subtype","paymentMethodType","analytics","sendAnalytics","ANALYTICS_ACTION_STR","message","getCorePropsForComponent","getComponentForAction","handleCreateError","update","forEach","newProps","remove","filter","c","_id","unmount","processGlobalOptions","core","i18n","cdnContext","storeElementReference","element","push","paymentMethod","errorMessage","name","JSON","stringify","PaymentMethods","Object","freeze","risk","RiskModule","Analytics","resources","Resources","Language","customTranslations","srPanel","SRPanel","srConfig"],"mappings":"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"}
1
+ {"version":3,"file":"core.js","sources":["../../../src/core/core.ts"],"sourcesContent":["import Language from '../language';\nimport UIElement from '../components/internal/UIElement/UIElement';\nimport RiskModule from './RiskModule';\nimport PaymentMethods from './ProcessResponse/PaymentMethods';\nimport getComponentForAction from './ProcessResponse/PaymentAction';\nimport Analytics from './Analytics';\nimport { assertConfigurationPropertiesAreValid, processGlobalOptions } from './utils';\nimport Session from './CheckoutSession';\nimport { hasOwnProperty } from '../utils/hasOwnProperty';\nimport { Resources } from './Context/Resources';\nimport { SRPanel } from './Errors/SRPanel';\nimport registry, { NewableComponent } from './core.registry';\nimport { cleanupFinalResult, sanitizeResponse, verifyPaymentDidNotFail } from '../components/internal/UIElement/utils';\nimport AdyenCheckoutError, { IMPLEMENTATION_ERROR } from './Errors/AdyenCheckoutError';\nimport { ANALYTICS_ACTION_STR } from './Analytics/constants';\nimport { THREEDS2_FULL } from '../components/ThreeDS2/constants';\nimport { DEFAULT_LOCALE } from '../language/constants';\nimport getTranslations from './Services/get-translations';\nimport { defaultProps } from './core.defaultProps';\nimport { formatCustomTranslations, formatLocale } from '../language/utils';\nimport { resolveEnvironments } from './Environment';\n\nimport type { AnalyticsModule, PaymentAction, PaymentResponseData } from '../types/global-types';\nimport type { CoreConfiguration, ICore, AdditionalDetailsData } from './types';\nimport type { Translations } from '../language/types';\nimport type { UIElementProps } from '../components/internal/UIElement/types';\n\nclass Core implements ICore {\n public session?: Session;\n public paymentMethodsResponse: PaymentMethods;\n public modules: Readonly<{\n risk: RiskModule;\n analytics: AnalyticsModule;\n resources: Resources;\n i18n: Language;\n srPanel: SRPanel;\n }>;\n public options: CoreConfiguration;\n\n public analyticsContext: string;\n public loadingContext: string;\n public cdnImagesUrl: string;\n public cdnTranslationsUrl: string;\n\n private components: UIElement[] = [];\n\n public static readonly metadata = {\n version: process.env.VERSION,\n bundleType: process.env.BUNDLE_TYPE\n };\n\n public static registry = registry;\n\n public static setBundleType(type: string): void {\n Core.metadata.bundleType = type;\n }\n\n public static register(...items: NewableComponent[]) {\n registry.add(...items);\n }\n\n /**\n * Used internally by the PaymentMethod components to auto-register themselves\n * @internal\n */\n public register(...items: NewableComponent[]) {\n registry.add(...items);\n }\n\n public getComponent(txVariant: string) {\n return registry.getComponent(txVariant);\n }\n\n constructor(props: CoreConfiguration) {\n assertConfigurationPropertiesAreValid(props);\n\n this.createFromAction = this.createFromAction.bind(this);\n\n this.setOptions({ ...defaultProps, ...props });\n\n const { apiUrl, analyticsUrl, cdnImagesUrl, cdnTranslationsUrl } = resolveEnvironments(\n this.options.environment,\n this.options._environmentUrls\n );\n\n this.loadingContext = apiUrl;\n this.analyticsContext = analyticsUrl;\n this.cdnImagesUrl = cdnImagesUrl;\n this.cdnTranslationsUrl = cdnTranslationsUrl;\n\n this.session = this.options.session && new Session(this.options.session, this.options.clientKey, this.loadingContext);\n\n const clientKeyType = this.options.clientKey?.substring(0, 4);\n if ((clientKeyType === 'test' || clientKeyType === 'live') && !this.loadingContext.includes(clientKeyType)) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Error: you are using a ${clientKeyType} clientKey against the ${this.options._environmentUrls?.api || this.options.environment} environment`\n );\n }\n if (clientKeyType === 'pub.') {\n console.debug(\n `The value you are passing as your \"clientKey\" looks like an originKey (${this.options.clientKey?.substring(0, 12)}..). Although this is supported it is not the recommended way to integrate. To generate a clientKey, see the documentation (https://docs.adyen.com/development-resources/client-side-authentication/migrate-from-origin-key-to-client-key/) for more details.`\n );\n }\n\n if (this.options.exposeLibraryMetadata) {\n window['AdyenWebMetadata'] = Core.metadata;\n }\n }\n\n public async initialize(): Promise<this> {\n await this.initializeCore();\n this.validateCoreConfiguration();\n await this.createCoreModules();\n return this;\n }\n\n private async initializeCore(): Promise<this> {\n if (this.session) {\n return this.session\n .setupSession(this.options)\n .then(sessionResponse => {\n const { amount, shopperLocale, countryCode, paymentMethods, ...rest } = sessionResponse;\n\n this.setOptions({\n ...rest,\n amount: this.options.order ? this.options.order.remainingAmount : amount,\n locale: this.options.locale || shopperLocale,\n countryCode: this.options.countryCode || countryCode\n });\n\n this.createPaymentMethodsList(paymentMethods);\n\n return this;\n })\n .catch(error => {\n if (this.options.onError) this.options.onError(error);\n return Promise.reject(error);\n });\n }\n\n this.createPaymentMethodsList();\n return Promise.resolve(this);\n }\n\n private async fetchLocaleTranslations(): Promise<Translations> {\n try {\n return await getTranslations(this.cdnTranslationsUrl, Core.metadata.version, this.options.locale);\n } catch (error: unknown) {\n if (error instanceof AdyenCheckoutError) this.options.onError?.(error);\n else this.options.onError?.(new AdyenCheckoutError('ERROR', 'Failed to fetch translation', { cause: error }));\n }\n }\n\n private validateCoreConfiguration(): void {\n // @ts-ignore This property does not exist, although merchants might be using when migrating from v5 to v6\n if (this.options.paymentMethodsConfiguration) {\n console.warn('WARNING: \"paymentMethodsConfiguration\" is supported only by Drop-in.');\n }\n\n if (!this.options.countryCode) {\n throw new AdyenCheckoutError(IMPLEMENTATION_ERROR, 'You must specify a countryCode when initializing checkout.');\n }\n\n if (!this.options.locale) {\n this.setOptions({ locale: DEFAULT_LOCALE });\n }\n\n this.options.locale = formatLocale(this.options.locale);\n this.options.translations = formatCustomTranslations(this.options.translations);\n }\n\n /**\n * Method used when handling redirects. It submits details using 'onAdditionalDetails' or the Sessions flow if available.\n *\n * @public\n * @see {https://docs.adyen.com/online-payments/build-your-integration/?platform=Web&integration=Components&version=5.55.1#handle-the-redirect}\n * @param details - Details object containing the redirectResult\n */\n public submitDetails(details: AdditionalDetailsData['data']): void {\n let promise = null;\n\n if (this.options.onAdditionalDetails) {\n promise = new Promise((resolve, reject) => {\n this.options.onAdditionalDetails({ data: details }, undefined, { resolve, reject });\n });\n }\n\n if (this.session) {\n promise = this.session.submitDetails(details).catch(error => {\n this.options.onError?.(error);\n return Promise.reject(error);\n });\n }\n\n if (!promise) {\n this.options.onError?.(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not submit the details. The callback \"onAdditionalDetails\" or the Session is not setup correctly.'\n )\n );\n return;\n }\n\n promise\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then((response: PaymentResponseData) => {\n cleanupFinalResult(response);\n this.options.onPaymentCompleted?.(response);\n })\n .catch((response: PaymentResponseData) => {\n cleanupFinalResult(response);\n this.options.onPaymentFailed?.(response);\n });\n }\n\n /**\n * Instantiates a new element component ready to be mounted from an action object\n *\n * @param action - action defining the component with the component data\n * @param options - options that will be merged to the global Checkout props\n * @returns new UIElement\n */\n public createFromAction(action: PaymentAction, options = {}): UIElement {\n if (!action || !action.type) {\n if (hasOwnProperty(action, 'action') && hasOwnProperty(action, 'resultCode')) {\n throw new Error(\n 'createFromAction::Invalid Action - the passed action object itself has an \"action\" property and ' +\n 'a \"resultCode\": have you passed in the whole response object by mistake?'\n );\n }\n throw new Error('createFromAction::Invalid Action - the passed action object does not have a \"type\" property');\n }\n\n if (action.type) {\n // 'threeDS2' OR 'qrCode', 'voucher', 'redirect', 'await', 'bankTransfer`\n const component = action.type === THREEDS2_FULL ? `${action.type}${action.subtype}` : action.paymentMethodType;\n\n this.modules.analytics.sendAnalytics(component, {\n type: ANALYTICS_ACTION_STR,\n subtype: action.type,\n message: `${component} action was handled by the SDK`\n });\n\n const props = {\n ...this.getCorePropsForComponent(),\n ...options\n };\n\n return getComponentForAction(this, registry, action, props);\n }\n\n return this.handleCreateError();\n }\n\n /**\n * Updates global configurations, resets the internal state and remounts each element.\n *\n * @param options - props to update\n * @returns this - the element instance\n */\n public update = (options: Partial<CoreConfiguration> = {}): Promise<this> => {\n this.setOptions(options);\n\n return this.initialize().then(() => {\n this.components.forEach(component => {\n // We update only with the new options that have been received\n const newProps: Partial<UIElementProps> = {\n ...options,\n ...(this.session && { session: this.session })\n };\n component.update(newProps);\n });\n return this;\n });\n };\n\n /**\n * Remove the reference of a component\n * @param component - reference to the component to be removed\n * @returns this - the element instance\n * // TODO: Do we need this?\n */\n public remove = (component): this => {\n this.components = this.components.filter(c => c._id !== component._id);\n component.unmount();\n\n return this;\n };\n\n /**\n * @internal\n * Create or update the config object passed when AdyenCheckout is initialised (environment, clientKey, etc...)\n */\n private setOptions = (options: CoreConfiguration): void => {\n this.options = {\n ...this.options,\n ...options,\n locale: options?.locale || this.options?.locale\n };\n };\n\n /**\n * @internal\n * @returns props for a new UIElement\n */\n public getCorePropsForComponent(): any {\n const globalOptions = processGlobalOptions(this.options);\n\n return {\n ...globalOptions,\n core: this,\n i18n: this.modules.i18n,\n modules: this.modules,\n session: this.session,\n loadingContext: this.loadingContext,\n cdnContext: this.cdnImagesUrl,\n createFromAction: this.createFromAction\n };\n }\n\n public storeElementReference(element: UIElement) {\n if (element) {\n this.components.push(element);\n }\n }\n\n /**\n * @internal\n */\n private handleCreateError(paymentMethod?): never {\n const paymentMethodName = paymentMethod?.name ?? 'The passed payment method';\n const errorMessage = paymentMethod\n ? `${paymentMethodName} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(\n paymentMethod\n )}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`\n : 'No Payment Method component was passed';\n\n throw new Error(errorMessage);\n }\n\n private createPaymentMethodsList(paymentMethodsResponse?: PaymentMethods): void {\n this.paymentMethodsResponse = new PaymentMethods(this.options.paymentMethodsResponse || paymentMethodsResponse, this.options);\n }\n\n private async createCoreModules(): Promise<void> {\n if (this.modules) {\n if (process.env.NODE_ENV === 'development') {\n console.warn('Core: Core modules are already created.');\n }\n return;\n }\n\n const translations = await this.fetchLocaleTranslations();\n\n this.modules = Object.freeze({\n risk: new RiskModule(this, { ...this.options, loadingContext: this.loadingContext }),\n analytics: Analytics({\n loadingContext: this.loadingContext,\n analyticsContext: this.analyticsContext,\n clientKey: this.options.clientKey,\n locale: this.options.locale,\n analytics: this.options.analytics,\n amount: this.options.amount,\n bundleType: Core.metadata.bundleType\n }),\n resources: new Resources(this.cdnImagesUrl),\n i18n: new Language({\n locale: this.options.locale,\n translations,\n customTranslations: this.options.translations\n }),\n srPanel: new SRPanel(this, { ...this.options.srConfig })\n });\n }\n}\n\nexport default Core;\n"],"names":["Core","setBundleType","type","metadata","bundleType","register","items","registry","add","getComponent","txVariant","initialize","this","initializeCore","validateCoreConfiguration","createCoreModules","session","setupSession","options","then","sessionResponse","amount","shopperLocale","countryCode","paymentMethods","rest","setOptions","order","remainingAmount","locale","createPaymentMethodsList","catch","error","onError","Promise","reject","resolve","fetchLocaleTranslations","getTranslations","cdnTranslationsUrl","version","AdyenCheckoutError","cause","paymentMethodsConfiguration","console","warn","IMPLEMENTATION_ERROR","DEFAULT_LOCALE","formatLocale","translations","formatCustomTranslations","submitDetails","details","promise","onAdditionalDetails","data","undefined","sanitizeResponse","verifyPaymentDidNotFail","response","cleanupFinalResult","onPaymentCompleted","onPaymentFailed","createFromAction","action","hasOwnProperty","Error","component","THREEDS2_FULL","subtype","paymentMethodType","modules","analytics","sendAnalytics","ANALYTICS_ACTION_STR","message","props","getCorePropsForComponent","getComponentForAction","handleCreateError","processGlobalOptions","core","i18n","loadingContext","cdnContext","cdnImagesUrl","storeElementReference","element","components","push","paymentMethod","errorMessage","name","JSON","stringify","paymentMethodsResponse","PaymentMethods","Object","freeze","risk","RiskModule","Analytics","analyticsContext","clientKey","resources","Resources","Language","customTranslations","srPanel","SRPanel","srConfig","constructor","_define_property","update","forEach","newProps","remove","filter","c","_id","unmount","assertConfigurationPropertiesAreValid","bind","defaultProps","apiUrl","analyticsUrl","resolveEnvironments","environment","_environmentUrls","Session","clientKeyType","substring","includes","api","debug","exposeLibraryMetadata","window"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- import e from"../components/ThreeDS2/ThreeDS2Challenge.js";import t from"../components/ThreeDS2/ThreeDS2DeviceFingerprint.js";import r from"../components/Redirect/Redirect.js";import{TxVariants as n}from"../components/tx-variants.js";const o={[n.redirect]:r,[n.threeDS2Challenge]:e,[n.threeDS2DeviceFingerprint]:t};var s=new class{componentsMap=o;supportedTxVariants=new Set(Object.values(n));add(...e){this.componentsMap={...this.componentsMap,...this.createComponentsMap(e)}}getComponent(e){const t=this.componentsMap[e];return t||(this.supportedTxVariants.has(e)?void 0:r)}createComponentsMap(e){return e.reduce(((e,t)=>{var r;if(!("string"==typeof(r=t).type&&!!r.type))return console.error("CoreRegistry: Attempt to register Class failed. The Class is not a valid UIElement"),e;if("dropin"===t.type)return e;return[t.type,...t.txVariants].filter((e=>e)).forEach((r=>{e={...e,[r]:t}})),e}),{})}};export{s as default};
1
+ import e from"../components/ThreeDS2/ThreeDS2Challenge.js";import t from"../components/ThreeDS2/ThreeDS2DeviceFingerprint.js";import r from"../components/Redirect/Redirect.js";import{TxVariants as n}from"../components/tx-variants.js";function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const s={[n.redirect]:r,[n.threeDS2Challenge]:e,[n.threeDS2DeviceFingerprint]:t};var i=new class{add(...e){this.componentsMap={...this.componentsMap,...this.createComponentsMap(e)}}getComponent(e){const t=this.componentsMap[e];return t||(this.supportedTxVariants.has(e)?void 0:r)}createComponentsMap(e){return e.reduce(((e,t)=>{var r;if(!("string"==typeof(r=t).type&&!!r.type))return console.error("CoreRegistry: Attempt to register Class failed. The Class is not a valid UIElement"),e;if("dropin"===t.type)return e;return[t.type,...t.txVariants].filter((e=>e)).forEach((r=>{e={...e,[r]:t}})),e}),{})}constructor(){o(this,"componentsMap",s),o(this,"supportedTxVariants",new Set(Object.values(n)))}};export{i as default};
2
2
  //# sourceMappingURL=core.registry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"core.registry.js","sources":["../../../src/core/core.registry.ts"],"sourcesContent":["import UIElement from '../components/internal/UIElement/UIElement';\nimport ThreeDS2Challenge from '../components/ThreeDS2/ThreeDS2Challenge';\nimport ThreeDS2DeviceFingerprint from '../components/ThreeDS2/ThreeDS2DeviceFingerprint';\nimport Redirect from '../components/Redirect';\nimport { TxVariants } from '../components/tx-variants';\nimport type { ICore } from './types';\n\nfunction assertClassHasType(Class: any): Class is typeof UIElement {\n const hasValidType = typeof Class.type === 'string' && !!Class.type;\n return hasValidType;\n}\n\nexport type NewableComponent = new (checkout: ICore, props?) => UIElement;\n\nexport interface IRegistry {\n add(...items: NewableComponent[]): void;\n getComponent(type: string): NewableComponent | undefined;\n}\n\nconst defaultComponents = {\n [TxVariants.redirect]: Redirect,\n [TxVariants.threeDS2Challenge]: ThreeDS2Challenge,\n [TxVariants.threeDS2DeviceFingerprint]: ThreeDS2DeviceFingerprint\n};\n\nclass Registry implements IRegistry {\n public componentsMap: Record<string, NewableComponent> = defaultComponents;\n\n public supportedTxVariants: Set<string> = new Set(Object.values(TxVariants));\n\n public add(...items: NewableComponent[]) {\n this.componentsMap = {\n ...this.componentsMap,\n ...this.createComponentsMap(items)\n };\n }\n\n public getComponent(type: string): NewableComponent | undefined {\n const Component = this.componentsMap[type];\n if (Component) {\n return Component;\n }\n\n if (this.supportedTxVariants.has(type)) {\n return;\n }\n\n return Redirect;\n }\n\n public createComponentsMap(components: NewableComponent[]) {\n const componentsMap = components.reduce((memo, component) => {\n const isValid = assertClassHasType(component);\n\n if (!isValid) {\n console.error('CoreRegistry: Attempt to register Class failed. The Class is not a valid UIElement');\n return memo;\n }\n if (component.type === 'dropin') {\n return memo;\n }\n\n const supportedTxVariants = [component.type, ...component.txVariants].filter(txVariant => txVariant);\n\n supportedTxVariants.forEach(txVariant => {\n memo = {\n ...memo,\n [txVariant]: component\n };\n });\n\n return memo;\n }, {});\n\n return componentsMap;\n }\n}\n\nexport default new Registry();\n"],"names":["defaultComponents","TxVariants","redirect","Redirect","threeDS2Challenge","ThreeDS2Challenge","threeDS2DeviceFingerprint","ThreeDS2DeviceFingerprint","registry","componentsMap","supportedTxVariants","Set","Object","values","add","items","this","createComponentsMap","getComponent","type","Component","has","components","reduce","memo","component","Class","console","error","txVariants","filter","txVariant","forEach"],"mappings":"0OAmBA,MAAMA,EAAoB,CACtB,CAACC,EAAWC,UAAWC,EACvB,CAACF,EAAWG,mBAAoBC,EAChC,CAACJ,EAAWK,2BAA4BC,GAwD5C,IAAeC,EAAA,IArDf,MACWC,cAAkDT,EAElDU,oBAAmC,IAAIC,IAAIC,OAAOC,OAAOZ,IAEzDa,GAAAA,IAAOC,GACVC,KAAKP,cAAgB,IACdO,KAAKP,iBACLO,KAAKC,oBAAoBF,GAEpC,CAEOG,YAAAA,CAAaC,GAChB,MAAMC,EAAYJ,KAAKP,cAAcU,GACrC,OAAIC,IAIAJ,KAAKN,oBAAoBW,IAAIF,QAAjC,EAIOhB,EACX,CAEOc,mBAAAA,CAAoBK,GAwBvB,OAvBsBA,EAAWC,QAAO,CAACC,EAAMC,KA5CvD,IAA4BC,EA+ChB,KA9CmC,iBADnBA,EA6CmBD,GA5CTN,QAAuBO,EAAMP,MAgDnD,OADAQ,QAAQC,MAAM,sFACPJ,EAEX,GAAuB,WAAnBC,EAAUN,KACV,OAAOK,EAYX,MAT4B,CAACC,EAAUN,QAASM,EAAUI,YAAYC,QAAOC,GAAaA,IAEtEC,SAAQD,IACxBP,EAAO,IACAA,EACHO,CAACA,GAAYN,EACjB,IAGGD,CAAAA,GACR,CAAC,EAGR"}
1
+ {"version":3,"file":"core.registry.js","sources":["../../../src/core/core.registry.ts"],"sourcesContent":["import UIElement from '../components/internal/UIElement/UIElement';\nimport ThreeDS2Challenge from '../components/ThreeDS2/ThreeDS2Challenge';\nimport ThreeDS2DeviceFingerprint from '../components/ThreeDS2/ThreeDS2DeviceFingerprint';\nimport Redirect from '../components/Redirect';\nimport { TxVariants } from '../components/tx-variants';\nimport type { ICore } from './types';\n\nfunction assertClassHasType(Class: any): Class is typeof UIElement {\n const hasValidType = typeof Class.type === 'string' && !!Class.type;\n return hasValidType;\n}\n\nexport type NewableComponent = new (checkout: ICore, props?) => UIElement;\n\nexport interface IRegistry {\n add(...items: NewableComponent[]): void;\n getComponent(type: string): NewableComponent | undefined;\n}\n\nconst defaultComponents = {\n [TxVariants.redirect]: Redirect,\n [TxVariants.threeDS2Challenge]: ThreeDS2Challenge,\n [TxVariants.threeDS2DeviceFingerprint]: ThreeDS2DeviceFingerprint\n};\n\nclass Registry implements IRegistry {\n public componentsMap: Record<string, NewableComponent> = defaultComponents;\n\n public supportedTxVariants: Set<string> = new Set(Object.values(TxVariants));\n\n public add(...items: NewableComponent[]) {\n this.componentsMap = {\n ...this.componentsMap,\n ...this.createComponentsMap(items)\n };\n }\n\n public getComponent(type: string): NewableComponent | undefined {\n const Component = this.componentsMap[type];\n if (Component) {\n return Component;\n }\n\n if (this.supportedTxVariants.has(type)) {\n return;\n }\n\n return Redirect;\n }\n\n public createComponentsMap(components: NewableComponent[]) {\n const componentsMap = components.reduce((memo, component) => {\n const isValid = assertClassHasType(component);\n\n if (!isValid) {\n console.error('CoreRegistry: Attempt to register Class failed. The Class is not a valid UIElement');\n return memo;\n }\n if (component.type === 'dropin') {\n return memo;\n }\n\n const supportedTxVariants = [component.type, ...component.txVariants].filter(txVariant => txVariant);\n\n supportedTxVariants.forEach(txVariant => {\n memo = {\n ...memo,\n [txVariant]: component\n };\n });\n\n return memo;\n }, {});\n\n return componentsMap;\n }\n}\n\nexport default new Registry();\n"],"names":["defaultComponents","TxVariants","redirect","Redirect","threeDS2Challenge","ThreeDS2Challenge","threeDS2DeviceFingerprint","ThreeDS2DeviceFingerprint","registry","add","items","this","componentsMap","createComponentsMap","getComponent","type","Component","supportedTxVariants","has","components","reduce","memo","component","Class","console","error","txVariants","filter","txVariant","forEach","_define_property","Set","Object","values"],"mappings":"kWAmBA,MAAMA,EAAoB,CACtB,CAACC,EAAWC,UAAWC,EACvB,CAACF,EAAWG,mBAAoBC,EAChC,CAACJ,EAAWK,2BAA4BC,GAwD5C,IAAeC,EAAA,IArDf,MAKWC,GAAAA,IAAOC,GACVC,KAAKC,cAAgB,IACdD,KAAKC,iBACLD,KAAKE,oBAAoBH,GAEpC,CAEOI,YAAAA,CAAaC,GAChB,MAAMC,EAAYL,KAAKC,cAAcG,GACrC,OAAIC,IAIAL,KAAKM,oBAAoBC,IAAIH,QAAjC,EAIOZ,EACX,CAEOU,mBAAAA,CAAoBM,GAwBvB,OAvBsBA,EAAWC,QAAO,CAACC,EAAMC,KA5CvD,IAA4BC,EA+ChB,KA9CmC,iBADnBA,EA6CmBD,GA5CTP,QAAuBQ,EAAMR,MAgDnD,OADAS,QAAQC,MAAM,sFACPJ,EAEX,GAAuB,WAAnBC,EAAUP,KACV,OAAOM,EAYX,MAT4B,CAACC,EAAUP,QAASO,EAAUI,YAAYC,QAAOC,GAAaA,IAEtEC,SAAQD,IACxBP,EAAO,IACAA,EACHO,CAACA,GAAYN,EACjB,IAGGD,CAAAA,GACR,CAAC,EAGR,eAjDAS,EAAAnB,KAAOC,gBAAkDZ,GAEzD8B,EAAAnB,KAAOM,sBAAmC,IAAIc,IAAIC,OAAOC,OAAOhC"}
@@ -2794,12 +2794,13 @@ interface QRLoaderConfiguration extends UIElementProps {
2794
2794
  brandLogo?: string;
2795
2795
  buttonLabel?: string;
2796
2796
  qrCodeImage?: string;
2797
+ qrCodeData?: string;
2797
2798
  paymentData?: string;
2798
- introduction?: string;
2799
2799
  redirectIntroduction?: string;
2800
2800
  timeToPay?: string;
2801
- instructions?: string | (() => h.JSX.Element);
2802
2801
  copyBtn?: boolean;
2802
+ introduction?: string | (() => h.JSX.Element);
2803
+ instructions?: string | (() => h.JSX.Element);
2803
2804
  }
2804
2805
 
2805
2806
  interface PixConfiguration extends QRLoaderConfiguration {
@@ -3689,12 +3690,13 @@ declare class WeChatPayElement extends QRLoaderContainer {
3689
3690
  brandLogo?: string;
3690
3691
  buttonLabel?: string;
3691
3692
  qrCodeImage?: string;
3693
+ qrCodeData?: string;
3692
3694
  paymentData?: string;
3693
- introduction?: string;
3694
3695
  redirectIntroduction?: string;
3695
3696
  timeToPay?: string;
3696
- instructions?: string | (() => preact.JSX.Element);
3697
3697
  copyBtn?: boolean;
3698
+ introduction?: string | (() => preact.JSX.Element);
3699
+ instructions?: string | (() => preact.JSX.Element);
3698
3700
  order?: Order;
3699
3701
  modules?: {
3700
3702
  srPanel?: SRPanel;
@@ -3758,12 +3760,13 @@ declare class PayNowElement extends QRLoaderContainer {
3758
3760
  brandLogo?: string;
3759
3761
  buttonLabel?: string;
3760
3762
  qrCodeImage?: string;
3763
+ qrCodeData?: string;
3761
3764
  paymentData?: string;
3762
- introduction?: string;
3763
3765
  redirectIntroduction?: string;
3764
- timeToPay?: string;
3765
- instructions?: string | (() => preact.JSX.Element);
3766
+ timeToPay: string;
3766
3767
  copyBtn?: boolean;
3768
+ introduction: string | (() => preact.JSX.Element);
3769
+ instructions: string | (() => preact.JSX.Element);
3767
3770
  order?: Order;
3768
3771
  modules?: {
3769
3772
  srPanel?: SRPanel;
@@ -3826,14 +3829,15 @@ declare class BCMCMobileElement extends QRLoaderContainer {
3826
3829
  countdownTime: number;
3827
3830
  type?: string;
3828
3831
  brandLogo?: string;
3829
- buttonLabel: string;
3832
+ buttonLabel?: string;
3830
3833
  qrCodeImage?: string;
3834
+ qrCodeData?: string;
3831
3835
  paymentData?: string;
3832
- introduction?: string;
3833
3836
  redirectIntroduction?: string;
3834
- timeToPay?: string;
3835
- instructions?: string | (() => preact.JSX.Element);
3837
+ timeToPay: string;
3836
3838
  copyBtn?: boolean;
3839
+ introduction?: string | (() => preact.JSX.Element);
3840
+ instructions?: string | (() => preact.JSX.Element);
3837
3841
  order?: Order;
3838
3842
  modules?: {
3839
3843
  srPanel?: SRPanel;
@@ -4100,12 +4104,13 @@ declare class SwishElement extends QRLoaderContainer {
4100
4104
  brandLogo?: string;
4101
4105
  buttonLabel?: string;
4102
4106
  qrCodeImage?: string;
4107
+ qrCodeData?: string;
4103
4108
  paymentData?: string;
4104
- introduction?: string;
4105
4109
  redirectIntroduction?: string;
4106
4110
  timeToPay?: string;
4107
- instructions: string | (() => preact.JSX.Element);
4108
4111
  copyBtn?: boolean;
4112
+ introduction?: string | (() => preact.JSX.Element);
4113
+ instructions: string | (() => preact.JSX.Element);
4109
4114
  order?: Order;
4110
4115
  modules?: {
4111
4116
  srPanel?: SRPanel;
@@ -4560,12 +4565,13 @@ declare class PromptPayElement extends QRLoaderContainer {
4560
4565
  brandLogo?: string;
4561
4566
  buttonLabel?: string;
4562
4567
  qrCodeImage?: string;
4568
+ qrCodeData?: string;
4563
4569
  paymentData?: string;
4564
- introduction?: string;
4565
4570
  redirectIntroduction?: string;
4566
4571
  timeToPay?: string;
4567
- instructions?: string | (() => preact.JSX.Element);
4568
4572
  copyBtn?: boolean;
4573
+ introduction?: string | (() => preact.JSX.Element);
4574
+ instructions?: string | (() => preact.JSX.Element);
4569
4575
  order?: Order;
4570
4576
  modules?: {
4571
4577
  srPanel?: SRPanel;
@@ -4629,12 +4635,13 @@ declare class DuitNowElement extends QRLoaderContainer {
4629
4635
  brandLogo?: string;
4630
4636
  buttonLabel?: string;
4631
4637
  qrCodeImage?: string;
4638
+ qrCodeData?: string;
4632
4639
  paymentData?: string;
4633
- introduction?: string;
4634
4640
  redirectIntroduction?: string;
4635
4641
  timeToPay?: string;
4636
- instructions?: string | (() => preact.JSX.Element);
4637
4642
  copyBtn?: boolean;
4643
+ introduction?: string | (() => preact.JSX.Element);
4644
+ instructions?: string | (() => preact.JSX.Element);
4638
4645
  order?: Order;
4639
4646
  modules?: {
4640
4647
  srPanel?: SRPanel;
@@ -6000,12 +6007,13 @@ declare class PayMeElement extends QRLoaderContainer {
6000
6007
  brandLogo?: string;
6001
6008
  buttonLabel: string;
6002
6009
  qrCodeImage?: string;
6010
+ qrCodeData?: string;
6003
6011
  paymentData?: string;
6004
- introduction: string;
6005
6012
  redirectIntroduction: string;
6006
6013
  timeToPay: string;
6007
- instructions: string | (() => preact.JSX.Element);
6008
6014
  copyBtn?: boolean;
6015
+ introduction: string | (() => preact.JSX.Element);
6016
+ instructions: string | (() => preact.JSX.Element);
6009
6017
  order?: Order;
6010
6018
  modules?: {
6011
6019
  srPanel?: SRPanel;
@@ -1,2 +1,2 @@
1
- import{getTranslation as t}from"./utils.js";import{getLocalisedAmount as o}from"../utils/amount-util.js";import i from"../core/Errors/AdyenCheckoutError.js";class a{locale;languageCode;translations;customTranslations;timeFormatOptions={hour:"numeric",minute:"numeric"};timeAndDateFormatOptions={year:"numeric",month:"2-digit",day:"2-digit",...this.timeFormatOptions};timeAndDateFormatter;constructor(t){const{locale:o,translations:a,customTranslations:e}=t;if(!o)throw new i("IMPLEMENTATION_ERROR",'Language: "locale" property is not defined');this.locale=o,this.languageCode=this.locale.split("-")[0],this.customTranslations=e||{},this.timeAndDateFormatter=Intl.DateTimeFormat(this.locale,this.timeAndDateFormatOptions),this.translations={...a,...!!this.customTranslations[this.locale]&&this.customTranslations[this.locale]}}get(o,i){const a=t(this.translations,o,i);return null!==a?a:o}amount(t,i,a){return o(t,this.locale,i,a)}date(t,o={}){if(void 0===t)return"";const i={year:"numeric",month:"2-digit",day:"2-digit",...o};return new Date(t).toLocaleDateString(this.locale,i)}dateTime(t){return void 0===t?"":this.timeAndDateFormatter.format(new Date(t))}}export{a as Language,a as default};
1
+ import{getTranslation as t}from"./utils.js";import{getLocalisedAmount as i}from"../utils/amount-util.js";import o from"../core/Errors/AdyenCheckoutError.js";function e(t,i,o){return i in t?Object.defineProperty(t,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[i]=o,t}class a{get(i,o){const e=t(this.translations,i,o);return null!==e?e:i}amount(t,o,e){return i(t,this.locale,o,e)}date(t,i={}){if(void 0===t)return"";const o={year:"numeric",month:"2-digit",day:"2-digit",...i};return new Date(t).toLocaleDateString(this.locale,o)}dateTime(t){return void 0===t?"":this.timeAndDateFormatter.format(new Date(t))}constructor(t){e(this,"locale",void 0),e(this,"languageCode",void 0),e(this,"translations",void 0),e(this,"customTranslations",void 0),e(this,"timeFormatOptions",{hour:"numeric",minute:"numeric"}),e(this,"timeAndDateFormatOptions",{year:"numeric",month:"2-digit",day:"2-digit",...this.timeFormatOptions}),e(this,"timeAndDateFormatter",void 0);const{locale:i,translations:a,customTranslations:s}=t;if(!i)throw new o("IMPLEMENTATION_ERROR",'Language: "locale" property is not defined');this.locale=i,this.languageCode=this.locale.split("-")[0],this.customTranslations=s||{},this.timeAndDateFormatter=Intl.DateTimeFormat(this.locale,this.timeAndDateFormatOptions),this.translations={...a,...!!this.customTranslations[this.locale]&&this.customTranslations[this.locale]}}}export{a as Language,a as default};
2
2
  //# sourceMappingURL=Language.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Language.js","sources":["../../../src/language/Language.ts"],"sourcesContent":["import { getTranslation } from './utils';\nimport { getLocalisedAmount } from '../utils/amount-util';\nimport AdyenCheckoutError from '../core/Errors/AdyenCheckoutError';\nimport type { CustomTranslations, LanguageOptions, Translations } from './types';\n\nexport class Language {\n public readonly locale: string;\n public readonly languageCode: string;\n\n private readonly translations: Translations;\n private readonly customTranslations: CustomTranslations;\n\n public readonly timeFormatOptions: Intl.DateTimeFormatOptions = {\n hour: 'numeric',\n minute: 'numeric'\n };\n public readonly timeAndDateFormatOptions: Intl.DateTimeFormatOptions = {\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n ...this.timeFormatOptions\n };\n public readonly timeAndDateFormatter: Intl.DateTimeFormat;\n\n constructor(props: LanguageOptions) {\n const { locale, translations, customTranslations } = props;\n\n if (!locale) {\n throw new AdyenCheckoutError('IMPLEMENTATION_ERROR', 'Language: \"locale\" property is not defined');\n }\n\n this.locale = locale;\n this.languageCode = this.locale.split('-')[0];\n this.customTranslations = customTranslations || {};\n\n this.timeAndDateFormatter = Intl.DateTimeFormat(this.locale, this.timeAndDateFormatOptions);\n\n this.translations = {\n ...translations,\n ...(!!this.customTranslations[this.locale] && this.customTranslations[this.locale])\n };\n }\n\n /**\n * Returns a translated string from a key in the current {@link Language.locale}\n * @param key - Translation key\n * @param options - Translation options\n * @returns Translated string\n */\n public get(key: string, options?): string {\n const translation = getTranslation(this.translations, key, options);\n if (translation !== null) {\n return translation;\n }\n\n return key;\n }\n\n /**\n * Returns a localized string for an amount\n * @param amount - Amount to be converted\n * @param currencyCode - Currency code of the amount\n * @param options - Options for String.prototype.toLocaleString\n */\n public amount(amount: number, currencyCode: string, options?: object): string {\n return getLocalisedAmount(amount, this.locale, currencyCode, options);\n }\n\n /**\n * Returns a localized string for a date\n * @param date - Date to be localized\n * @param options - Options for {@link Date.toLocaleDateString}\n */\n public date(date: string, options: object = {}) {\n if (date === undefined) return '';\n const dateOptions: Intl.DateTimeFormatOptions = { year: 'numeric', month: '2-digit', day: '2-digit', ...options };\n return new Date(date).toLocaleDateString(this.locale, dateOptions);\n }\n\n /**\n * Returns a localized string for a date and time\n * @param date - Date to be localized\n */\n public dateTime(date: string) {\n if (date === undefined) return '';\n return this.timeAndDateFormatter.format(new Date(date));\n }\n}\n\nexport default Language;\n"],"names":["Language","locale","languageCode","translations","customTranslations","timeFormatOptions","hour","minute","timeAndDateFormatOptions","year","month","day","this","timeAndDateFormatter","constructor","props","AdyenCheckoutError","split","Intl","DateTimeFormat","get","key","options","translation","getTranslation","amount","currencyCode","getLocalisedAmount","date","undefined","dateOptions","Date","toLocaleDateString","dateTime","format"],"mappings":"6JAKO,MAAMA,EACOC,OACAC,aAECC,aACAC,mBAEDC,kBAAgD,CAC5DC,KAAM,UACNC,OAAQ,WAEIC,yBAAuD,CACnEC,KAAM,UACNC,MAAO,UACPC,IAAK,aACFC,KAAKP,mBAEIQ,qBAEhBC,WAAAA,CAAYC,GACR,MAAMd,OAAEA,EAAME,aAAEA,EAAYC,mBAAEA,GAAuBW,EAErD,IAAKd,EACD,MAAM,IAAIe,EAAmB,uBAAwB,8CAGzDJ,KAAKX,OAASA,EACdW,KAAKV,aAAeU,KAAKX,OAAOgB,MAAM,KAAK,GAC3CL,KAAKR,mBAAqBA,GAAsB,GAEhDQ,KAAKC,qBAAuBK,KAAKC,eAAeP,KAAKX,OAAQW,KAAKJ,0BAElEI,KAAKT,aAAe,IACbA,OACGS,KAAKR,mBAAmBQ,KAAKX,SAAWW,KAAKR,mBAAmBQ,KAAKX,QAEnF,CAQA,GAAAmB,CAAWC,EAAaC,GACpB,MAAMC,EAAcC,EAAeZ,KAAKT,aAAckB,EAAKC,GAC3D,OAAoB,OAAhBC,EACOA,EAGJF,CACX,CAQA,MAAAI,CAAcA,EAAgBC,EAAsBJ,GAChD,OAAOK,EAAmBF,EAAQb,KAAKX,OAAQyB,EAAcJ,EACjE,CAOA,IAAAM,CAAYA,EAAcN,EAAkB,IACxC,QAAaO,IAATD,EAAoB,MAAO,GAC/B,MAAME,EAA0C,CAAErB,KAAM,UAAWC,MAAO,UAAWC,IAAK,aAAcW,GACxG,OAAO,IAAIS,KAAKH,GAAMI,mBAAmBpB,KAAKX,OAAQ6B,EAC1D,CAMOG,QAAAA,CAASL,GACZ,YAAaC,IAATD,EAA2B,GACxBhB,KAAKC,qBAAqBqB,OAAO,IAAIH,KAAKH,GACrD"}
1
+ {"version":3,"file":"Language.js","sources":["../../../src/language/Language.ts"],"sourcesContent":["import { getTranslation } from './utils';\nimport { getLocalisedAmount } from '../utils/amount-util';\nimport AdyenCheckoutError from '../core/Errors/AdyenCheckoutError';\nimport type { CustomTranslations, LanguageOptions, Translations } from './types';\n\nexport class Language {\n public readonly locale: string;\n public readonly languageCode: string;\n\n private readonly translations: Translations;\n private readonly customTranslations: CustomTranslations;\n\n public readonly timeFormatOptions: Intl.DateTimeFormatOptions = {\n hour: 'numeric',\n minute: 'numeric'\n };\n public readonly timeAndDateFormatOptions: Intl.DateTimeFormatOptions = {\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n ...this.timeFormatOptions\n };\n public readonly timeAndDateFormatter: Intl.DateTimeFormat;\n\n constructor(props: LanguageOptions) {\n const { locale, translations, customTranslations } = props;\n\n if (!locale) {\n throw new AdyenCheckoutError('IMPLEMENTATION_ERROR', 'Language: \"locale\" property is not defined');\n }\n\n this.locale = locale;\n this.languageCode = this.locale.split('-')[0];\n this.customTranslations = customTranslations || {};\n\n this.timeAndDateFormatter = Intl.DateTimeFormat(this.locale, this.timeAndDateFormatOptions);\n\n this.translations = {\n ...translations,\n ...(!!this.customTranslations[this.locale] && this.customTranslations[this.locale])\n };\n }\n\n /**\n * Returns a translated string from a key in the current {@link Language.locale}\n * @param key - Translation key\n * @param options - Translation options\n * @returns Translated string\n */\n public get(key: string, options?): string {\n const translation = getTranslation(this.translations, key, options);\n if (translation !== null) {\n return translation;\n }\n\n return key;\n }\n\n /**\n * Returns a localized string for an amount\n * @param amount - Amount to be converted\n * @param currencyCode - Currency code of the amount\n * @param options - Options for String.prototype.toLocaleString\n */\n public amount(amount: number, currencyCode: string, options?: object): string {\n return getLocalisedAmount(amount, this.locale, currencyCode, options);\n }\n\n /**\n * Returns a localized string for a date\n * @param date - Date to be localized\n * @param options - Options for {@link Date.toLocaleDateString}\n */\n public date(date: string, options: object = {}) {\n if (date === undefined) return '';\n const dateOptions: Intl.DateTimeFormatOptions = { year: 'numeric', month: '2-digit', day: '2-digit', ...options };\n return new Date(date).toLocaleDateString(this.locale, dateOptions);\n }\n\n /**\n * Returns a localized string for a date and time\n * @param date - Date to be localized\n */\n public dateTime(date: string) {\n if (date === undefined) return '';\n return this.timeAndDateFormatter.format(new Date(date));\n }\n}\n\nexport default Language;\n"],"names":["Language","get","key","options","translation","getTranslation","this","translations","amount","currencyCode","getLocalisedAmount","locale","date","undefined","dateOptions","year","month","day","Date","toLocaleDateString","dateTime","timeAndDateFormatter","format","constructor","props","_define_property","languageCode","customTranslations","timeFormatOptions","hour","minute","timeAndDateFormatOptions","AdyenCheckoutError","split","Intl","DateTimeFormat"],"mappings":"qRAKO,MAAMA,EA4CT,GAAAC,CAAWC,EAAaC,GACpB,MAAMC,EAAcC,EAAeC,KAAKC,aAAcL,EAAKC,GAC3D,OAAoB,OAAhBC,EACOA,EAGJF,CACX,CAQA,MAAAM,CAAcA,EAAgBC,EAAsBN,GAChD,OAAOO,EAAmBF,EAAQF,KAAKK,OAAQF,EAAcN,EACjE,CAOA,IAAAS,CAAYA,EAAcT,EAAkB,IACxC,QAAaU,IAATD,EAAoB,MAAO,GAC/B,MAAME,EAA0C,CAAEC,KAAM,UAAWC,MAAO,UAAWC,IAAK,aAAcd,GACxG,OAAO,IAAIe,KAAKN,GAAMO,mBAAmBb,KAAKK,OAAQG,EAC1D,CAMOM,QAAAA,CAASR,GACZ,YAAaC,IAATD,EAA2B,GACxBN,KAAKe,qBAAqBC,OAAO,IAAIJ,KAAKN,GACrD,CA9DAW,WAAAA,CAAYC,GAlBZC,EAAAnB,KAAgBK,cAAhB,GACAc,EAAAnB,KAAgBoB,oBAAhB,GAEAD,EAAAnB,KAAiBC,oBAAjB,GACAkB,EAAAnB,KAAiBqB,0BAAjB,GAEAF,EAAAnB,KAAgBsB,oBAAgD,CAC5DC,KAAM,UACNC,OAAQ,YAEZL,EAAAnB,KAAgByB,2BAAuD,CACnEhB,KAAM,UACNC,MAAO,UACPC,IAAK,aACFX,KAAKsB,oBAEZH,EAAAnB,KAAgBe,4BAAhB,GAGI,MAAMV,OAAEA,EAAMJ,aAAEA,EAAYoB,mBAAEA,GAAuBH,EAErD,IAAKb,EACD,MAAM,IAAIqB,EAAmB,uBAAwB,8CAGzD1B,KAAKK,OAASA,EACdL,KAAKoB,aAAepB,KAAKK,OAAOsB,MAAM,KAAK,GAC3C3B,KAAKqB,mBAAqBA,GAAsB,GAEhDrB,KAAKe,qBAAuBa,KAAKC,eAAe7B,KAAKK,OAAQL,KAAKyB,0BAElEzB,KAAKC,aAAe,IACbA,OACGD,KAAKqB,mBAAmBrB,KAAKK,SAAWL,KAAKqB,mBAAmBrB,KAAKK,QAEnF"}
@@ -1,2 +1,2 @@
1
- import t from"../core/Errors/AdyenCheckoutError.js";class s{src;node;attributes;dataAttributes;isScriptLoadCalled=!1;script;constructor(t,s="body",i={},r={}){this.src=t,this.node=s,this.attributes=i,this.dataAttributes=r}load=()=>{if(!this.isScriptLoadCalled)return new Promise(((s,i)=>{const r=()=>{this.script.setAttribute("data-script-loaded","true"),s()},e=s=>{this.remove(),i(new t("SCRIPT_ERROR",`Unable to load script ${this.src}. Message: ${s.message}`,{cause:s.error}))};this.isScriptLoadCalled=!0;const c=document.querySelector(this.node);if(this.script=c.querySelector(`script[src="${this.src}"]`),this.script&&this.script.getAttribute("data-script-loaded"))s();else{if(this.script)return this.script.addEventListener("load",r),void this.script.addEventListener("error",e);this.script=document.createElement("script"),Object.assign(this.script,this.attributes),Object.assign(this.script.dataset,this.dataAttributes),this.script.src=this.src,this.script.async=!0,this.script.addEventListener("load",r),this.script.addEventListener("error",e),c.appendChild(this.script)}}))};remove=()=>this.script.parentNode&&this.script.parentNode.removeChild(this.script)}export{s as default};
1
+ import t from"../core/Errors/AdyenCheckoutError.js";function s(t,s,i){return s in t?Object.defineProperty(t,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[s]=i,t}class i{constructor(i,r="body",e={},c={}){s(this,"src",void 0),s(this,"node",void 0),s(this,"attributes",void 0),s(this,"dataAttributes",void 0),s(this,"isScriptLoadCalled",!1),s(this,"script",void 0),s(this,"load",(()=>{if(!this.isScriptLoadCalled)return new Promise(((s,i)=>{const r=()=>{this.script.setAttribute("data-script-loaded","true"),s()},e=s=>{this.remove(),i(new t("SCRIPT_ERROR",`Unable to load script ${this.src}. Message: ${s.message}`,{cause:s.error}))};this.isScriptLoadCalled=!0;const c=document.querySelector(this.node);if(this.script=c.querySelector(`script[src="${this.src}"]`),this.script&&this.script.getAttribute("data-script-loaded"))s();else{if(this.script)return this.script.addEventListener("load",r),void this.script.addEventListener("error",e);this.script=document.createElement("script"),Object.assign(this.script,this.attributes),Object.assign(this.script.dataset,this.dataAttributes),this.script.src=this.src,this.script.async=!0,this.script.addEventListener("load",r),this.script.addEventListener("error",e),c.appendChild(this.script)}}))})),s(this,"remove",(()=>this.script.parentNode&&this.script.parentNode.removeChild(this.script))),this.src=i,this.node=r,this.attributes=e,this.dataAttributes=c}}export{i as default};
2
2
  //# sourceMappingURL=Script.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Script.js","sources":["../../../src/utils/Script.ts"],"sourcesContent":["import AdyenCheckoutError from '../core/Errors/AdyenCheckoutError';\n\ninterface IScript {\n load(): Promise<any>;\n remove(): HTMLScriptElement;\n}\n\n/**\n * Creates a script element from a certain source in the passed node selector.\n * If no selector is passed it will add the script element in the body.\n *\n * @example\n * ```\n * const script = new Script('https://example.com/script.js', '.container');\n * script.load().then(doSomething);\n *\n * // To clean up just call the remove method\n * script.remove();\n * ```\n */\nclass Script implements IScript {\n private readonly src: string;\n private readonly node: string;\n private readonly attributes: Partial<HTMLScriptElement>;\n private readonly dataAttributes: Record<string, string | undefined>;\n\n private isScriptLoadCalled = false;\n private script: HTMLScriptElement;\n\n constructor(src, node = 'body', attributes: Partial<HTMLScriptElement> = {}, dataAttributes: Record<string, string | undefined> = {}) {\n this.src = src;\n this.node = node;\n this.attributes = attributes;\n this.dataAttributes = dataAttributes;\n }\n\n public load = (): Promise<void> => {\n if (this.isScriptLoadCalled) {\n if (process.env.NODE_ENV === 'development') console.warn(`[Warning] script.load called more than once for ${this.src}`);\n return;\n }\n\n return new Promise((resolve, reject) => {\n const handleOnLoad = () => {\n this.script.setAttribute('data-script-loaded', 'true');\n resolve();\n };\n\n const handleOnError = (errorEvent: ErrorEvent) => {\n this.remove();\n reject(\n new AdyenCheckoutError('SCRIPT_ERROR', `Unable to load script ${this.src}. Message: ${errorEvent.message}`, {\n cause: errorEvent.error\n })\n );\n };\n\n this.isScriptLoadCalled = true;\n\n const scriptContainer: Element = document.querySelector(this.node);\n this.script = scriptContainer.querySelector(`script[src=\"${this.src}\"]`);\n\n // Script element exists in the browser and is already loaded\n if (this.script && this.script.getAttribute('data-script-loaded')) {\n resolve();\n return;\n } else if (this.script) {\n // Script element exists in the browser, but it is not loaded yet\n // Use-case: Multiple PayPal standalone components being loaded in different parts of the screen.\n this.script.addEventListener('load', handleOnLoad);\n this.script.addEventListener('error', handleOnError);\n return;\n }\n\n // Script element doesn't exist in the browser, so we create it and append to the DOM tree\n this.script = document.createElement('script');\n Object.assign(this.script, this.attributes);\n Object.assign(this.script.dataset, this.dataAttributes);\n\n this.script.src = this.src;\n this.script.async = true;\n\n this.script.addEventListener('load', handleOnLoad);\n this.script.addEventListener('error', handleOnError);\n\n scriptContainer.appendChild(this.script);\n });\n };\n\n public remove = (): HTMLScriptElement => {\n return this.script.parentNode && this.script.parentNode.removeChild(this.script);\n };\n}\n\nexport default Script;\n"],"names":["Script","src","node","attributes","dataAttributes","isScriptLoadCalled","script","constructor","this","load","Promise","resolve","reject","handleOnLoad","setAttribute","handleOnError","errorEvent","remove","AdyenCheckoutError","message","cause","error","scriptContainer","document","querySelector","getAttribute","addEventListener","createElement","Object","assign","dataset","async","appendChild","parentNode","removeChild"],"mappings":"oDAoBA,MAAMA,EACeC,IACAC,KACAC,WACAC,eAETC,oBAAqB,EACrBC,OAERC,WAAAA,CAAYN,EAAKC,EAAO,OAAQC,EAAyC,CAAE,EAAEC,EAAqD,IAC9HI,KAAKP,IAAMA,EACXO,KAAKN,KAAOA,EACZM,KAAKL,WAAaA,EAClBK,KAAKJ,eAAiBA,CAC1B,CAEOK,KAAO,KACV,IAAID,KAAKH,mBAKT,OAAO,IAAIK,SAAQ,CAACC,EAASC,KACzB,MAAMC,EAAe,KACjBL,KAAKF,OAAOQ,aAAa,qBAAsB,QAC/CH,GAAAA,EAGEI,EAAiBC,IACnBR,KAAKS,SACLL,EACI,IAAIM,EAAmB,eAAgB,yBAAyBV,KAAKP,iBAAiBe,EAAWG,UAAW,CACxGC,MAAOJ,EAAWK,QACtB,EAIRb,KAAKH,oBAAqB,EAE1B,MAAMiB,EAA2BC,SAASC,cAAchB,KAAKN,MAI7D,GAHAM,KAAKF,OAASgB,EAAgBE,cAAc,eAAehB,KAAKP,SAG5DO,KAAKF,QAAUE,KAAKF,OAAOmB,aAAa,sBACxCd,QADJ,CAGO,GAAIH,KAAKF,OAKZ,OAFAE,KAAKF,OAAOoB,iBAAiB,OAAQb,QACrCL,KAAKF,OAAOoB,iBAAiB,QAASX,GAK1CP,KAAKF,OAASiB,SAASI,cAAc,UACrCC,OAAOC,OAAOrB,KAAKF,OAAQE,KAAKL,YAChCyB,OAAOC,OAAOrB,KAAKF,OAAOwB,QAAStB,KAAKJ,gBAExCI,KAAKF,OAAOL,IAAMO,KAAKP,IACvBO,KAAKF,OAAOyB,OAAQ,EAEpBvB,KAAKF,OAAOoB,iBAAiB,OAAQb,GACrCL,KAAKF,OAAOoB,iBAAiB,QAASX,GAEtCO,EAAgBU,YAAYxB,KAAKF,OAbjC,CAauC,GAC3C,EAGGW,OAAS,IACLT,KAAKF,OAAO2B,YAAczB,KAAKF,OAAO2B,WAAWC,YAAY1B,KAAKF"}
1
+ {"version":3,"file":"Script.js","sources":["../../../src/utils/Script.ts"],"sourcesContent":["import AdyenCheckoutError from '../core/Errors/AdyenCheckoutError';\n\ninterface IScript {\n load(): Promise<any>;\n remove(): HTMLScriptElement;\n}\n\n/**\n * Creates a script element from a certain source in the passed node selector.\n * If no selector is passed it will add the script element in the body.\n *\n * @example\n * ```\n * const script = new Script('https://example.com/script.js', '.container');\n * script.load().then(doSomething);\n *\n * // To clean up just call the remove method\n * script.remove();\n * ```\n */\nclass Script implements IScript {\n private readonly src: string;\n private readonly node: string;\n private readonly attributes: Partial<HTMLScriptElement>;\n private readonly dataAttributes: Record<string, string | undefined>;\n\n private isScriptLoadCalled = false;\n private script: HTMLScriptElement;\n\n constructor(src, node = 'body', attributes: Partial<HTMLScriptElement> = {}, dataAttributes: Record<string, string | undefined> = {}) {\n this.src = src;\n this.node = node;\n this.attributes = attributes;\n this.dataAttributes = dataAttributes;\n }\n\n public load = (): Promise<void> => {\n if (this.isScriptLoadCalled) {\n if (process.env.NODE_ENV === 'development') console.warn(`[Warning] script.load called more than once for ${this.src}`);\n return;\n }\n\n return new Promise((resolve, reject) => {\n const handleOnLoad = () => {\n this.script.setAttribute('data-script-loaded', 'true');\n resolve();\n };\n\n const handleOnError = (errorEvent: ErrorEvent) => {\n this.remove();\n reject(\n new AdyenCheckoutError('SCRIPT_ERROR', `Unable to load script ${this.src}. Message: ${errorEvent.message}`, {\n cause: errorEvent.error\n })\n );\n };\n\n this.isScriptLoadCalled = true;\n\n const scriptContainer: Element = document.querySelector(this.node);\n this.script = scriptContainer.querySelector(`script[src=\"${this.src}\"]`);\n\n // Script element exists in the browser and is already loaded\n if (this.script && this.script.getAttribute('data-script-loaded')) {\n resolve();\n return;\n } else if (this.script) {\n // Script element exists in the browser, but it is not loaded yet\n // Use-case: Multiple PayPal standalone components being loaded in different parts of the screen.\n this.script.addEventListener('load', handleOnLoad);\n this.script.addEventListener('error', handleOnError);\n return;\n }\n\n // Script element doesn't exist in the browser, so we create it and append to the DOM tree\n this.script = document.createElement('script');\n Object.assign(this.script, this.attributes);\n Object.assign(this.script.dataset, this.dataAttributes);\n\n this.script.src = this.src;\n this.script.async = true;\n\n this.script.addEventListener('load', handleOnLoad);\n this.script.addEventListener('error', handleOnError);\n\n scriptContainer.appendChild(this.script);\n });\n };\n\n public remove = (): HTMLScriptElement => {\n return this.script.parentNode && this.script.parentNode.removeChild(this.script);\n };\n}\n\nexport default Script;\n"],"names":["Script","constructor","src","node","attributes","dataAttributes","_define_property","this","isScriptLoadCalled","script","load","Promise","resolve","reject","handleOnLoad","setAttribute","handleOnError","errorEvent","remove","AdyenCheckoutError","message","cause","error","scriptContainer","document","querySelector","getAttribute","addEventListener","createElement","Object","assign","dataset","async","appendChild","parentNode","removeChild"],"mappings":"4KAoBA,MAAMA,EASFC,WAAAA,CAAYC,EAAKC,EAAO,OAAQC,EAAyC,CAAE,EAAEC,EAAqD,IARlIC,EAAAC,KAAiBL,WAAjB,GACAI,EAAAC,KAAiBJ,YAAjB,GACAG,EAAAC,KAAiBH,kBAAjB,GACAE,EAAAC,KAAiBF,sBAAjB,GAEAC,EAAAC,KAAQC,sBAAqB,GAC7BF,EAAAC,KAAQE,cAAR,GASAH,EAAAC,KAAOG,QAAO,KACV,IAAIH,KAAKC,mBAKT,OAAO,IAAIG,SAAQ,CAACC,EAASC,KACzB,MAAMC,EAAe,KACjBP,KAAKE,OAAOM,aAAa,qBAAsB,QAC/CH,GAAAA,EAGEI,EAAiBC,IACnBV,KAAKW,SACLL,EACI,IAAIM,EAAmB,eAAgB,yBAAyBZ,KAAKL,iBAAiBe,EAAWG,UAAW,CACxGC,MAAOJ,EAAWK,QACtB,EAIRf,KAAKC,oBAAqB,EAE1B,MAAMe,EAA2BC,SAASC,cAAclB,KAAKJ,MAI7D,GAHAI,KAAKE,OAASc,EAAgBE,cAAc,eAAelB,KAAKL,SAG5DK,KAAKE,QAAUF,KAAKE,OAAOiB,aAAa,sBACxCd,QADJ,CAGO,GAAIL,KAAKE,OAKZ,OAFAF,KAAKE,OAAOkB,iBAAiB,OAAQb,QACrCP,KAAKE,OAAOkB,iBAAiB,QAASX,GAK1CT,KAAKE,OAASe,SAASI,cAAc,UACrCC,OAAOC,OAAOvB,KAAKE,OAAQF,KAAKH,YAChCyB,OAAOC,OAAOvB,KAAKE,OAAOsB,QAASxB,KAAKF,gBAExCE,KAAKE,OAAOP,IAAMK,KAAKL,IACvBK,KAAKE,OAAOuB,OAAQ,EAEpBzB,KAAKE,OAAOkB,iBAAiB,OAAQb,GACrCP,KAAKE,OAAOkB,iBAAiB,QAASX,GAEtCO,EAAgBU,YAAY1B,KAAKE,OAbjC,CAauC,GAC3C,IAGJH,EAAAC,KAAOW,UAAS,IACLX,KAAKE,OAAOyB,YAAc3B,KAAKE,OAAOyB,WAAWC,YAAY5B,KAAKE,UA5DzEF,KAAKL,IAAMA,EACXK,KAAKJ,KAAOA,EACZI,KAAKH,WAAaA,EAClBG,KAAKF,eAAiBA,CAC1B"}
@@ -1,2 +1,2 @@
1
- class t{storage;constructor(){this.storage={}}get length(){return Object.keys(this.storage).length}key(t){return Object.keys(this.storage)[t]}getItem(t){return this.storage[t]||null}setItem(t,e){return this.storage[t]=e}removeItem(t){delete this.storage[t]}clear(){this.storage={}}}class e{prefix="adyen-checkout__";key;storage;constructor(e,r){try{if(this.storage=r?window[r]:window.localStorage,!this.storage)throw new Error("storage does not exist")}catch(e){this.storage=new t}this.key=this.prefix+e}get(){try{return JSON.parse(this.storage.getItem(this.key))}catch(t){return null}}set(t){this.storage.setItem(this.key,JSON.stringify(t))}remove(){this.storage.removeItem(this.key)}clear(){this.storage.clear()}keyByIndex(t){return this.storage.key(t)}get length(){return this.storage.length}}export{e as default};
1
+ function t(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class e{get length(){return Object.keys(this.storage).length}key(t){return Object.keys(this.storage)[t]}getItem(t){return this.storage[t]||null}setItem(t,e){return this.storage[t]=e}removeItem(t){delete this.storage[t]}clear(){this.storage={}}constructor(){t(this,"storage",void 0),this.storage={}}}class r{get(){try{return JSON.parse(this.storage.getItem(this.key))}catch(t){return null}}set(t){this.storage.setItem(this.key,JSON.stringify(t))}remove(){this.storage.removeItem(this.key)}clear(){this.storage.clear()}keyByIndex(t){return this.storage.key(t)}get length(){return this.storage.length}constructor(r,s){t(this,"prefix","adyen-checkout__"),t(this,"key",void 0),t(this,"storage",void 0);try{if(this.storage=s?window[s]:window.localStorage,!this.storage)throw new Error("storage does not exist")}catch(t){this.storage=new e}this.key=this.prefix+r}}export{r as default};
2
2
  //# sourceMappingURL=Storage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Storage.js","sources":["../../../src/utils/Storage.ts"],"sourcesContent":["class NonPersistentStorage {\n private storage;\n\n constructor() {\n this.storage = {};\n }\n\n get length() {\n return Object.keys(this.storage).length;\n }\n\n key(index) {\n return Object.keys(this.storage)[index];\n }\n getItem(keyName) {\n return this.storage[keyName] || null;\n }\n setItem(keyName, keyValue) {\n return (this.storage[keyName] = keyValue);\n }\n removeItem(keyName) {\n delete this.storage[keyName];\n }\n clear() {\n this.storage = {};\n }\n}\n\nclass Storage<T> {\n private readonly prefix = 'adyen-checkout__';\n private readonly key: string;\n private storage: globalThis.Storage | NonPersistentStorage;\n\n constructor(key: string, storageType: 'sessionStorage' | 'localStorage') {\n try {\n this.storage = storageType ? window[storageType] : window.localStorage;\n if (!this.storage) {\n throw new Error('storage does not exist');\n }\n } catch (e) {\n this.storage = new NonPersistentStorage();\n }\n this.key = this.prefix + key;\n }\n\n public get(): T {\n try {\n return JSON.parse(this.storage.getItem(this.key));\n } catch (err) {\n return null;\n }\n }\n\n public set(value: T) {\n this.storage.setItem(this.key, JSON.stringify(value));\n }\n\n public remove() {\n this.storage.removeItem(this.key);\n }\n\n public clear() {\n this.storage.clear();\n }\n\n public keyByIndex(index) {\n return this.storage.key(index);\n }\n\n get length() {\n return this.storage.length;\n }\n}\n\nexport default Storage;\n"],"names":["NonPersistentStorage","storage","constructor","this","length","Object","keys","key","index","getItem","keyName","setItem","keyValue","removeItem","clear","Storage","prefix","storageType","window","localStorage","Error","e","get","JSON","parse","err","set","value","stringify","remove","keyByIndex"],"mappings":"AAAA,MAAMA,EACMC,QAERC,WAAAA,GACIC,KAAKF,QAAU,EACnB,CAEA,UAAIG,GACA,OAAOC,OAAOC,KAAKH,KAAKF,SAASG,MACrC,CAEAG,GAAAA,CAAIC,GACA,OAAOH,OAAOC,KAAKH,KAAKF,SAASO,EACrC,CACAC,OAAAA,CAAQC,GACJ,OAAOP,KAAKF,QAAQS,IAAY,IACpC,CACAC,OAAAA,CAAQD,EAASE,GACb,OAAQT,KAAKF,QAAQS,GAAWE,CACpC,CACAC,UAAAA,CAAWH,UACAP,KAAKF,QAAQS,EACxB,CACAI,KAAAA,GACIX,KAAKF,QAAU,EACnB,EAGJ,MAAMc,EACeC,OAAS,mBACTT,IACTN,QAERC,WAAAA,CAAYK,EAAaU,GACrB,IAEI,GADAd,KAAKF,QAAUgB,EAAcC,OAAOD,GAAeC,OAAOC,cACrDhB,KAAKF,QACN,MAAM,IAAImB,MAAM,yBAExB,CAAE,MAAOC,GACLlB,KAAKF,QAAU,IAAID,CACvB,CACAG,KAAKI,IAAMJ,KAAKa,OAAST,CAC7B,CAEOe,GAAAA,GACH,IACI,OAAOC,KAAKC,MAAMrB,KAAKF,QAAQQ,QAAQN,KAAKI,KAChD,CAAE,MAAOkB,GACL,OAAO,IACX,CACJ,CAEOC,GAAAA,CAAIC,GACPxB,KAAKF,QAAQU,QAAQR,KAAKI,IAAKgB,KAAKK,UAAUD,GAClD,CAEOE,MAAAA,GACH1B,KAAKF,QAAQY,WAAWV,KAAKI,IACjC,CAEOO,KAAAA,GACHX,KAAKF,QAAQa,OACjB,CAEOgB,UAAAA,CAAWtB,GACd,OAAOL,KAAKF,QAAQM,IAAIC,EAC5B,CAEA,UAAIJ,GACA,OAAOD,KAAKF,QAAQG,MACxB"}
1
+ {"version":3,"file":"Storage.js","sources":["../../../src/utils/Storage.ts"],"sourcesContent":["class NonPersistentStorage {\n private storage;\n\n constructor() {\n this.storage = {};\n }\n\n get length() {\n return Object.keys(this.storage).length;\n }\n\n key(index) {\n return Object.keys(this.storage)[index];\n }\n getItem(keyName) {\n return this.storage[keyName] || null;\n }\n setItem(keyName, keyValue) {\n return (this.storage[keyName] = keyValue);\n }\n removeItem(keyName) {\n delete this.storage[keyName];\n }\n clear() {\n this.storage = {};\n }\n}\n\nclass Storage<T> {\n private readonly prefix = 'adyen-checkout__';\n private readonly key: string;\n private storage: globalThis.Storage | NonPersistentStorage;\n\n constructor(key: string, storageType: 'sessionStorage' | 'localStorage') {\n try {\n this.storage = storageType ? window[storageType] : window.localStorage;\n if (!this.storage) {\n throw new Error('storage does not exist');\n }\n } catch (e) {\n this.storage = new NonPersistentStorage();\n }\n this.key = this.prefix + key;\n }\n\n public get(): T {\n try {\n return JSON.parse(this.storage.getItem(this.key));\n } catch (err) {\n return null;\n }\n }\n\n public set(value: T) {\n this.storage.setItem(this.key, JSON.stringify(value));\n }\n\n public remove() {\n this.storage.removeItem(this.key);\n }\n\n public clear() {\n this.storage.clear();\n }\n\n public keyByIndex(index) {\n return this.storage.key(index);\n }\n\n get length() {\n return this.storage.length;\n }\n}\n\nexport default Storage;\n"],"names":["NonPersistentStorage","length","Object","keys","this","storage","key","index","getItem","keyName","setItem","keyValue","removeItem","clear","constructor","_define_property","Storage","get","JSON","parse","err","set","value","stringify","remove","keyByIndex","storageType","prefix","window","localStorage","Error","e"],"mappings":"wHAAA,MAAMA,EAOF,UAAIC,GACA,OAAOC,OAAOC,KAAKC,KAAKC,SAASJ,MACrC,CAEAK,GAAAA,CAAIC,GACA,OAAOL,OAAOC,KAAKC,KAAKC,SAASE,EACrC,CACAC,OAAAA,CAAQC,GACJ,OAAOL,KAAKC,QAAQI,IAAY,IACpC,CACAC,OAAAA,CAAQD,EAASE,GACb,OAAQP,KAAKC,QAAQI,GAAWE,CACpC,CACAC,UAAAA,CAAWH,UACAL,KAAKC,QAAQI,EACxB,CACAI,KAAAA,GACIT,KAAKC,QAAU,EACnB,CAtBAS,WAAAA,GAFAC,EAAAX,KAAQC,eAAR,GAGID,KAAKC,QAAU,EACnB,EAuBJ,MAAMW,EAiBKC,GAAAA,GACH,IACI,OAAOC,KAAKC,MAAMf,KAAKC,QAAQG,QAAQJ,KAAKE,KAChD,CAAE,MAAOc,GACL,OAAO,IACX,CACJ,CAEOC,GAAAA,CAAIC,GACPlB,KAAKC,QAAQK,QAAQN,KAAKE,IAAKY,KAAKK,UAAUD,GAClD,CAEOE,MAAAA,GACHpB,KAAKC,QAAQO,WAAWR,KAAKE,IACjC,CAEOO,KAAAA,GACHT,KAAKC,QAAQQ,OACjB,CAEOY,UAAAA,CAAWlB,GACd,OAAOH,KAAKC,QAAQC,IAAIC,EAC5B,CAEA,UAAIN,GACA,OAAOG,KAAKC,QAAQJ,MACxB,CAtCAa,WAAAA,CAAYR,EAAaoB,GAJzBX,EAAAX,KAAiBuB,SAAS,oBAC1BZ,EAAAX,KAAiBE,WAAjB,GACAS,EAAAX,KAAQC,eAAR,GAGI,IAEI,GADAD,KAAKC,QAAUqB,EAAcE,OAAOF,GAAeE,OAAOC,cACrDzB,KAAKC,QACN,MAAM,IAAIyB,MAAM,yBAExB,CAAE,MAAOC,GACL3B,KAAKC,QAAU,IAAIL,CACvB,CACAI,KAAKE,IAAMF,KAAKuB,OAASrB,CAC7B"}
@@ -1,2 +1,2 @@
1
- class s{shouldValidate;isValid;errorMessage;constructor(s,i,a,e){this.shouldValidate=s.modes.includes(a),this.isValid=s.validate(i,e),this.errorMessage=s.errorMessage}hasError(s=!1){return s?!this.isValid&&this.shouldValidate:null!=this.isValid&&!this.isValid&&this.shouldValidate}}export{s as ValidationRuleResult};
1
+ function i(i,s,e){return s in i?Object.defineProperty(i,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[s]=e,i}class s{hasError(i=!1){return i?!this.isValid&&this.shouldValidate:null!=this.isValid&&!this.isValid&&this.shouldValidate}constructor(s,e,t,a){i(this,"shouldValidate",void 0),i(this,"isValid",void 0),i(this,"errorMessage",void 0),this.shouldValidate=s.modes.includes(t),this.isValid=s.validate(e,a),this.errorMessage=s.errorMessage}}export{s as ValidationRuleResult};
2
2
  //# sourceMappingURL=ValidationRuleResult.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ValidationRuleResult.js","sources":["../../../../src/utils/Validator/ValidationRuleResult.ts"],"sourcesContent":["import { ErrorMessageObject } from './types';\n\n/**\n * Holds the result of a validation\n */\nexport class ValidationRuleResult {\n private readonly shouldValidate: boolean;\n public isValid: boolean;\n public errorMessage: string | ErrorMessageObject;\n\n constructor(rule, value, mode, context) {\n this.shouldValidate = rule.modes.includes(mode);\n this.isValid = rule.validate(value, context);\n this.errorMessage = rule.errorMessage;\n }\n\n /**\n * Whether the validation is considered an error.\n * A field is only considered to be an error if the validation rule applies to the current mode i.e. 'blur' or 'input'.\n * Also, if a validation function returns a null value e.g. when the field is empty, then the field will not be considered to be in error\n * unless the whole form is being validated\n */\n hasError(isValidatingForm = false): boolean {\n return isValidatingForm ? !this.isValid && this.shouldValidate : this.isValid != null && !this.isValid && this.shouldValidate;\n }\n}\n"],"names":["ValidationRuleResult","shouldValidate","isValid","errorMessage","constructor","rule","value","mode","context","this","modes","includes","validate","hasError","isValidatingForm"],"mappings":"AAKO,MAAMA,EACQC,eACVC,QACAC,aAEPC,WAAAA,CAAYC,EAAMC,EAAOC,EAAMC,GAC3BC,KAAKR,eAAiBI,EAAKK,MAAMC,SAASJ,GAC1CE,KAAKP,QAAUG,EAAKO,SAASN,EAAOE,GACpCC,KAAKN,aAAeE,EAAKF,YAC7B,CAQAU,QAAAA,CAASC,GAAmB,GACxB,OAAOA,GAAoBL,KAAKP,SAAWO,KAAKR,eAAiC,MAAhBQ,KAAKP,UAAoBO,KAAKP,SAAWO,KAAKR,cACnH"}
1
+ {"version":3,"file":"ValidationRuleResult.js","sources":["../../../../src/utils/Validator/ValidationRuleResult.ts"],"sourcesContent":["import { ErrorMessageObject } from './types';\n\n/**\n * Holds the result of a validation\n */\nexport class ValidationRuleResult {\n private readonly shouldValidate: boolean;\n public isValid: boolean;\n public errorMessage: string | ErrorMessageObject;\n\n constructor(rule, value, mode, context) {\n this.shouldValidate = rule.modes.includes(mode);\n this.isValid = rule.validate(value, context);\n this.errorMessage = rule.errorMessage;\n }\n\n /**\n * Whether the validation is considered an error.\n * A field is only considered to be an error if the validation rule applies to the current mode i.e. 'blur' or 'input'.\n * Also, if a validation function returns a null value e.g. when the field is empty, then the field will not be considered to be in error\n * unless the whole form is being validated\n */\n hasError(isValidatingForm = false): boolean {\n return isValidatingForm ? !this.isValid && this.shouldValidate : this.isValid != null && !this.isValid && this.shouldValidate;\n }\n}\n"],"names":["ValidationRuleResult","hasError","isValidatingForm","this","isValid","shouldValidate","constructor","rule","value","mode","context","_define_property","errorMessage","modes","includes","validate"],"mappings":"wHAKO,MAAMA,EAiBTC,QAAAA,CAASC,GAAmB,GACxB,OAAOA,GAAoBC,KAAKC,SAAWD,KAAKE,eAAiC,MAAhBF,KAAKC,UAAoBD,KAAKC,SAAWD,KAAKE,cACnH,CAdAC,WAAAA,CAAYC,EAAMC,EAAOC,EAAMC,GAJ/BC,EAAAR,KAAiBE,sBAAjB,GACAM,EAAAR,KAAOC,eAAP,GACAO,EAAAR,KAAOS,oBAAP,GAGIT,KAAKE,eAAiBE,EAAKM,MAAMC,SAASL,GAC1CN,KAAKC,QAAUG,EAAKQ,SAASP,EAAOE,GACpCP,KAAKS,aAAeL,EAAKK,YAC7B"}
@@ -1,2 +1,2 @@
1
- import{ValidationRuleResult as r}from"./ValidationRuleResult.js";class t{validationResults;constructor(r){this.validationResults=r}get isValid(){return this.validationResults.reduce(((r,t)=>r&&t.isValid),!0)}hasError(r=!1){return Boolean(this.getError(r))}getError(r=!1){return this.validationResults.find((t=>t.hasError(r)))}getAllErrors(){return this.validationResults.filter((r=>r.hasError()))}}class s{rules={default:{validate:()=>!0,modes:["blur","input"]}};constructor(r){this.setRules(r)}setRules(r){this.rules={...this.rules,...r}}getRulesFor(r){let t=this.rules[r]??this.rules.default;return Array.isArray(t)||(t=[t]),t}validate({key:s,value:e,mode:l="blur"},i){const a=this.getRulesFor(s).map((t=>new r(t,e,l,i)));return new t(a)}}export{s as default};
1
+ import{ValidationRuleResult as r}from"./ValidationRuleResult.js";function t(r,t,e){return t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}class e{get isValid(){return this.validationResults.reduce(((r,t)=>r&&t.isValid),!0)}hasError(r=!1){return Boolean(this.getError(r))}getError(r=!1){return this.validationResults.find((t=>t.hasError(r)))}getAllErrors(){return this.validationResults.filter((r=>r.hasError()))}constructor(r){t(this,"validationResults",void 0),this.validationResults=r}}class s{setRules(r){this.rules={...this.rules,...r}}getRulesFor(r){let t=this.rules[r]??this.rules.default;return Array.isArray(t)||(t=[t]),t}validate({key:t,value:s,mode:l="blur"},i){const u=this.getRulesFor(t).map((t=>new r(t,s,l,i)));return new e(u)}constructor(r){t(this,"rules",{default:{validate:()=>!0,modes:["blur","input"]}}),this.setRules(r)}}export{s as default};
2
2
  //# sourceMappingURL=Validator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Validator.js","sources":["../../../../src/utils/Validator/Validator.ts"],"sourcesContent":["import { ValidatorRules, ValidatorRule, FieldContext, FieldData } from './types';\nimport { ValidationRuleResult } from './ValidationRuleResult';\n\nclass ValidationResult {\n private validationResults: ValidationRuleResult[];\n\n constructor(results: ValidationRuleResult[]) {\n this.validationResults = results;\n }\n\n /** Checks if all validation rules have passed */\n get isValid(): boolean {\n return this.validationResults.reduce((acc, result) => acc && result.isValid, true);\n }\n\n /** Checks if any validation rule returned an error */\n hasError(isValidatingForm = false): boolean {\n return Boolean(this.getError(isValidatingForm));\n }\n\n /** Returns the first validation result that returned an error */\n getError(isValidatingForm = false) {\n return this.validationResults.find(result => result.hasError(isValidatingForm));\n }\n\n /** Returns all validation results that returned an error */\n getAllErrors() {\n return this.validationResults.filter(result => result.hasError());\n }\n}\n\nclass Validator {\n public rules: ValidatorRules = {\n default: {\n validate: () => true,\n modes: ['blur', 'input']\n }\n };\n\n constructor(rules) {\n this.setRules(rules);\n }\n\n setRules(newRules) {\n this.rules = {\n ...this.rules,\n ...newRules\n };\n }\n\n /**\n * Get all validation rules for a field\n */\n private getRulesFor(field: string): ValidatorRule[] {\n let fieldRules: ValidatorRule | ValidatorRule[] = this.rules[field] ?? this.rules['default'];\n\n if (!Array.isArray(fieldRules)) {\n fieldRules = [fieldRules];\n }\n\n return fieldRules;\n }\n\n /**\n * Validates a field\n */\n validate({ key, value, mode = 'blur' }: FieldData, context?: FieldContext) {\n const fieldRules = this.getRulesFor(key);\n const validationRulesResult = fieldRules.map(rule => new ValidationRuleResult(rule, value, mode, context));\n\n return new ValidationResult(validationRulesResult);\n }\n}\n\nexport default Validator;\n"],"names":["ValidationResult","validationResults","constructor","results","this","isValid","reduce","acc","result","hasError","isValidatingForm","Boolean","getError","find","getAllErrors","filter","Validator","rules","default","validate","modes","setRules","newRules","getRulesFor","field","fieldRules","Array","isArray","key","value","mode","context","validationRulesResult","map","rule","ValidationRuleResult"],"mappings":"iEAGA,MAAMA,EACMC,kBAERC,WAAAA,CAAYC,GACRC,KAAKH,kBAAoBE,CAC7B,CAGA,WAAIE,GACA,OAAOD,KAAKH,kBAAkBK,QAAO,CAACC,EAAKC,IAAWD,GAAOC,EAAOH,UAAS,EACjF,CAGAI,QAAAA,CAASC,GAAmB,GACxB,OAAOC,QAAQP,KAAKQ,SAASF,GACjC,CAGAE,QAAAA,CAASF,GAAmB,GACxB,OAAON,KAAKH,kBAAkBY,MAAKL,GAAUA,EAAOC,SAASC,IACjE,CAGAI,YAAAA,GACI,OAAOV,KAAKH,kBAAkBc,QAAOP,GAAUA,EAAOC,YAC1D,EAGJ,MAAMO,EACKC,MAAwB,CAC3BC,QAAS,CACLC,SAAU,KAAM,EAChBC,MAAO,CAAC,OAAQ,WAIxBlB,WAAAA,CAAYe,GACRb,KAAKiB,SAASJ,EAClB,CAEAI,QAAAA,CAASC,GACLlB,KAAKa,MAAQ,IACNb,KAAKa,SACLK,EAEX,CAKQC,WAAAA,CAAYC,GAChB,IAAIC,EAA8CrB,KAAKa,MAAMO,IAAUpB,KAAKa,MAAgB,QAM5F,OAJKS,MAAMC,QAAQF,KACfA,EAAa,CAACA,IAGXA,CACX,CAKAN,QAAAA,EAASS,IAAEA,EAAGC,MAAEA,EAAKC,KAAEA,EAAO,QAAqBC,GAC/C,MACMC,EADa5B,KAAKmB,YAAYK,GACKK,KAAIC,GAAQ,IAAIC,EAAqBD,EAAML,EAAOC,EAAMC,KAEjG,OAAO,IAAI/B,EAAiBgC,EAChC"}
1
+ {"version":3,"file":"Validator.js","sources":["../../../../src/utils/Validator/Validator.ts"],"sourcesContent":["import { ValidatorRules, ValidatorRule, FieldContext, FieldData } from './types';\nimport { ValidationRuleResult } from './ValidationRuleResult';\n\nclass ValidationResult {\n private validationResults: ValidationRuleResult[];\n\n constructor(results: ValidationRuleResult[]) {\n this.validationResults = results;\n }\n\n /** Checks if all validation rules have passed */\n get isValid(): boolean {\n return this.validationResults.reduce((acc, result) => acc && result.isValid, true);\n }\n\n /** Checks if any validation rule returned an error */\n hasError(isValidatingForm = false): boolean {\n return Boolean(this.getError(isValidatingForm));\n }\n\n /** Returns the first validation result that returned an error */\n getError(isValidatingForm = false) {\n return this.validationResults.find(result => result.hasError(isValidatingForm));\n }\n\n /** Returns all validation results that returned an error */\n getAllErrors() {\n return this.validationResults.filter(result => result.hasError());\n }\n}\n\nclass Validator {\n public rules: ValidatorRules = {\n default: {\n validate: () => true,\n modes: ['blur', 'input']\n }\n };\n\n constructor(rules) {\n this.setRules(rules);\n }\n\n setRules(newRules) {\n this.rules = {\n ...this.rules,\n ...newRules\n };\n }\n\n /**\n * Get all validation rules for a field\n */\n private getRulesFor(field: string): ValidatorRule[] {\n let fieldRules: ValidatorRule | ValidatorRule[] = this.rules[field] ?? this.rules['default'];\n\n if (!Array.isArray(fieldRules)) {\n fieldRules = [fieldRules];\n }\n\n return fieldRules;\n }\n\n /**\n * Validates a field\n */\n validate({ key, value, mode = 'blur' }: FieldData, context?: FieldContext) {\n const fieldRules = this.getRulesFor(key);\n const validationRulesResult = fieldRules.map(rule => new ValidationRuleResult(rule, value, mode, context));\n\n return new ValidationResult(validationRulesResult);\n }\n}\n\nexport default Validator;\n"],"names":["ValidationResult","isValid","this","validationResults","reduce","acc","result","hasError","isValidatingForm","Boolean","getError","find","getAllErrors","filter","constructor","results","_define_property","Validator","setRules","newRules","rules","getRulesFor","field","fieldRules","Array","isArray","validate","key","value","mode","context","validationRulesResult","map","rule","ValidationRuleResult","default","modes"],"mappings":"yLAGA,MAAMA,EAQF,WAAIC,GACA,OAAOC,KAAKC,kBAAkBC,QAAO,CAACC,EAAKC,IAAWD,GAAOC,EAAOL,UAAS,EACjF,CAGAM,QAAAA,CAASC,GAAmB,GACxB,OAAOC,QAAQP,KAAKQ,SAASF,GACjC,CAGAE,QAAAA,CAASF,GAAmB,GACxB,OAAON,KAAKC,kBAAkBQ,MAAKL,GAAUA,EAAOC,SAASC,IACjE,CAGAI,YAAAA,GACI,OAAOV,KAAKC,kBAAkBU,QAAOP,GAAUA,EAAOC,YAC1D,CAtBAO,WAAAA,CAAYC,GAFZC,EAAAd,KAAQC,yBAAR,GAGID,KAAKC,kBAAoBY,CAC7B,EAuBJ,MAAME,EAYFC,QAAAA,CAASC,GACLjB,KAAKkB,MAAQ,IACNlB,KAAKkB,SACLD,EAEX,CAKQE,WAAAA,CAAYC,GAChB,IAAIC,EAA8CrB,KAAKkB,MAAME,IAAUpB,KAAKkB,MAAgB,QAM5F,OAJKI,MAAMC,QAAQF,KACfA,EAAa,CAACA,IAGXA,CACX,CAKAG,QAAAA,EAASC,IAAEA,EAAGC,MAAEA,EAAKC,KAAEA,EAAO,QAAqBC,GAC/C,MACMC,EADa7B,KAAKmB,YAAYM,GACKK,KAAIC,GAAQ,IAAIC,EAAqBD,EAAML,EAAOC,EAAMC,KAEjG,OAAO,IAAI9B,EAAiB+B,EAChC,CAhCAjB,WAAAA,CAAYM,GAPZJ,EAAAd,KAAOkB,QAAwB,CAC3Be,QAAS,CACLT,SAAU,KAAM,EAChBU,MAAO,CAAC,OAAQ,YAKpBlC,KAAKgB,SAASE,EAClB"}
@@ -1,2 +1,2 @@
1
- const e={IDR:1,JPY:1,KRW:1,VND:1,BYR:1,CVE:1,DJF:1,GHC:1,GNF:1,KMF:1,ISK:1,PYG:1,RWF:1,UGX:1,VUV:1,XAF:1,XOF:1,XPF:1,MRO:10,BHD:1e3,IQD:1e3,JOD:1e3,KWD:1e3,OMR:1e3,LYD:1e3,TND:1e3};export{e as default};
1
+ const e={IDR:1,JPY:1,KRW:1,VND:1,BYR:1,CVE:1,DJF:1,GHC:1,GNF:1,KMF:1,PYG:1,RWF:1,UGX:1,VUV:1,XAF:1,XOF:1,XPF:1,MRO:10,BHD:1e3,IQD:1e3,JOD:1e3,KWD:1e3,OMR:1e3,LYD:1e3,TND:1e3};export{e as default};
2
2
  //# sourceMappingURL=currency-decimals.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"currency-decimals.js","sources":["../../../../src/utils/constants/currency-decimals.ts"],"sourcesContent":["const CURRENCY_DECIMALS = {\n // ZERO_DECIMAL_CURRENCIES\n IDR: 1,\n JPY: 1,\n KRW: 1,\n VND: 1,\n BYR: 1,\n CVE: 1,\n DJF: 1,\n GHC: 1,\n GNF: 1,\n KMF: 1,\n ISK: 1,\n PYG: 1,\n RWF: 1,\n UGX: 1,\n VUV: 1,\n XAF: 1,\n XOF: 1,\n XPF: 1,\n\n // ONE_DECIMAL_CURRENCIES\n MRO: 10,\n\n // THREE_DECIMAL_CURRENCIES\n BHD: 1000,\n IQD: 1000,\n JOD: 1000,\n KWD: 1000,\n OMR: 1000,\n LYD: 1000,\n TND: 1000\n};\n\nexport default CURRENCY_DECIMALS;\n"],"names":["CURRENCY_DECIMALS","IDR","JPY","KRW","VND","BYR","CVE","DJF","GHC","GNF","KMF","ISK","PYG","RWF","UGX","VUV","XAF","XOF","XPF","MRO","BHD","IQD","JOD","KWD","OMR","LYD","TND"],"mappings":"AAAA,MAAMA,EAAoB,CAEtBC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EAGLC,IAAK,GAGLC,IAAK,IACLC,IAAK,IACLC,IAAK,IACLC,IAAK,IACLC,IAAK,IACLC,IAAK,IACLC,IAAK"}
1
+ {"version":3,"file":"currency-decimals.js","sources":["../../../../src/utils/constants/currency-decimals.ts"],"sourcesContent":["const CURRENCY_DECIMALS = {\n // ZERO_DECIMAL_CURRENCIES\n IDR: 1,\n JPY: 1,\n KRW: 1,\n VND: 1,\n BYR: 1,\n CVE: 1,\n DJF: 1,\n GHC: 1,\n GNF: 1,\n KMF: 1,\n PYG: 1,\n RWF: 1,\n UGX: 1,\n VUV: 1,\n XAF: 1,\n XOF: 1,\n XPF: 1,\n\n // ONE_DECIMAL_CURRENCIES\n MRO: 10,\n\n // THREE_DECIMAL_CURRENCIES\n BHD: 1000,\n IQD: 1000,\n JOD: 1000,\n KWD: 1000,\n OMR: 1000,\n LYD: 1000,\n TND: 1000\n};\n\nexport default CURRENCY_DECIMALS;\n"],"names":["CURRENCY_DECIMALS","IDR","JPY","KRW","VND","BYR","CVE","DJF","GHC","GNF","KMF","PYG","RWF","UGX","VUV","XAF","XOF","XPF","MRO","BHD","IQD","JOD","KWD","OMR","LYD","TND"],"mappings":"AAAA,MAAMA,EAAoB,CAEtBC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EAGLC,IAAK,GAGLC,IAAK,IACLC,IAAK,IACLC,IAAK,IACLC,IAAK,IACLC,IAAK,IACLC,IAAK,IACLC,IAAK"}
@@ -1 +1 @@
1
- {"version":3,"file":"currency-minor-units.js","sources":["../../../../src/utils/constants/currency-minor-units.ts"],"sourcesContent":["/** Work around solution until chromium bug is fixed https://bugs.chromium.org/p/chromium/issues/detail?id=1381996\n * We need to hardcode minimumFractionDigits for the following currencies\n */\nexport const currencyMinorUnitsConfig = {\n RSD: { minimumFractionDigits: 2 },\n AFN: { minimumFractionDigits: 2 },\n ALL: { minimumFractionDigits: 2 },\n IRR: { minimumFractionDigits: 2 },\n LAK: { minimumFractionDigits: 2 },\n LBP: { minimumFractionDigits: 2 },\n MMK: { minimumFractionDigits: 2 },\n SOS: { minimumFractionDigits: 2 },\n SYP: { minimumFractionDigits: 2 },\n YER: { minimumFractionDigits: 2 },\n IQD: { minimumFractionDigits: 3 }\n};\n"],"names":["currencyMinorUnitsConfig","RSD","minimumFractionDigits","AFN","ALL","IRR","LAK","LBP","MMK","SOS","SYP","YER","IQD"],"mappings":"MAGaA,EAA2B,CACpCC,IAAK,CAAEC,sBAAuB,GAC9BC,IAAK,CAAED,sBAAuB,GAC9BE,IAAK,CAAEF,sBAAuB,GAC9BG,IAAK,CAAEH,sBAAuB,GAC9BI,IAAK,CAAEJ,sBAAuB,GAC9BK,IAAK,CAAEL,sBAAuB,GAC9BM,IAAK,CAAEN,sBAAuB,GAC9BO,IAAK,CAAEP,sBAAuB,GAC9BQ,IAAK,CAAER,sBAAuB,GAC9BS,IAAK,CAAET,sBAAuB,GAC9BU,IAAK,CAAEV,sBAAuB"}
1
+ {"version":3,"file":"currency-minor-units.js","sources":["../../../../src/utils/constants/currency-minor-units.ts"],"sourcesContent":["/** Work around solution until chromium bug is fixed https://bugs.chromium.org/p/chromium/issues/detail?id=1381996\n * We need to hardcode minimumFractionDigits for the following currencies in order to force them to have 2 decimal places and\n * not be rounded up to a major unit\n */\nexport const currencyMinorUnitsConfig = {\n RSD: { minimumFractionDigits: 2 },\n AFN: { minimumFractionDigits: 2 },\n ALL: { minimumFractionDigits: 2 },\n IRR: { minimumFractionDigits: 2 },\n LAK: { minimumFractionDigits: 2 },\n LBP: { minimumFractionDigits: 2 },\n MMK: { minimumFractionDigits: 2 },\n SOS: { minimumFractionDigits: 2 },\n SYP: { minimumFractionDigits: 2 },\n YER: { minimumFractionDigits: 2 },\n IQD: { minimumFractionDigits: 3 }\n};\n"],"names":["currencyMinorUnitsConfig","RSD","minimumFractionDigits","AFN","ALL","IRR","LAK","LBP","MMK","SOS","SYP","YER","IQD"],"mappings":"MAIaA,EAA2B,CACpCC,IAAK,CAAEC,sBAAuB,GAC9BC,IAAK,CAAED,sBAAuB,GAC9BE,IAAK,CAAEF,sBAAuB,GAC9BG,IAAK,CAAEH,sBAAuB,GAC9BI,IAAK,CAAEJ,sBAAuB,GAC9BK,IAAK,CAAEL,sBAAuB,GAC9BM,IAAK,CAAEN,sBAAuB,GAC9BO,IAAK,CAAEP,sBAAuB,GAC9BQ,IAAK,CAAER,sBAAuB,GAC9BS,IAAK,CAAET,sBAAuB,GAC9BU,IAAK,CAAEV,sBAAuB"}
@@ -1,2 +1,2 @@
1
- const r=(r,e)=>Object.keys(r).filter((r=>!e.includes(r))).reduce(((e,a)=>(e[a]=r[a],e)),{}),e=(r,e,a,l,d)=>e.reduce(((r,e)=>({...r,[e]:r[e]??d?.[e]??l?.[e]??a})),r);function a({schema:r,defaultData:e,processField:a,fieldProblems:l}){const d=r=>{if(void 0===e[r])return{valid:!1,errors:null,data:null,fieldProblems:l?.[r]??null};const[d,s]=a({key:r,value:e[r],mode:"blur"},{state:{data:e}});return{valid:s.isValid&&!l?.[r]||!1,errors:s.hasError()?s.getError():null,data:d,fieldProblems:l?.[r]??null}},s=r.reduce(((r,e)=>{const{valid:a,errors:l,data:s,fieldProblems:o}=d(e);return{valid:{...r.valid,[e]:a},errors:{...r.errors,[e]:l},data:{...r.data,[e]:s},fieldProblems:{...r.fieldProblems,[e]:o}}}),{data:{},valid:{},errors:{},fieldProblems:{}});return{schema:r,data:s.data,valid:s.valid,errors:s.errors,fieldProblems:s.fieldProblems}}function l(l){return function(d,{type:s,key:o,value:t,mode:i,schema:c,defaultData:u,formValue:n,selectedSchema:m,fieldProblems:v}){const f=m||d.schema;switch(s){case"setData":return{...d,data:{...d.data,[o]:t}};case"setValid":return{...d,valid:{...d.valid,[o]:t}};case"setErrors":return{...d,errors:{...d.errors,[o]:t}};case"setFieldProblems":return d?.schema?.reduce(((r,e)=>({...r,fieldProblems:{...d.fieldProblems,[e]:v?.[e]??null},valid:{...d.valid,[e]:d.valid?.[e]&&!v[e]}})),d)??d;case"updateField":{const[r,e]=l({key:o,value:t,mode:i},{state:d}),a=d.data[o],s={...d.fieldProblems};return a!==r&&(s[o]=null),{...d,data:{...d.data,[o]:r},errors:{...d.errors,[o]:e.hasError()?e.getError():null},valid:{...d.valid,[o]:e.isValid&&!s[o]||!1},fieldProblems:s}}case"mergeForm":{const r={...d,data:{...d.data,...n.data},errors:{...d.errors,...n.errors},valid:{...d.valid,...n.valid},fieldProblems:{...d.fieldProblems,...n.fieldProblems}};return r.valid&&(r.isValid=Object.values(r.valid).every((r=>r))),r}case"setSchema":{const s=a({schema:c,defaultData:u,processField:l,fieldProblems:v}),o=d.schema.filter((r=>!c.includes(r))),t=c.filter((r=>!d.schema.includes(r))),i={data:r(d.data,t),errors:r(d.errors,t),valid:r(d.valid,t)},n=e(r(d.data,o),t,null,s.data,d.local?.data),m=e(r(d.valid,o),t,!1,s.valid,d.local?.valid),f=e(r(d.errors,o),t,null,s.errors,d.local?.errors);return{...d,schema:c,data:n,valid:m,errors:f,local:i}}case"validateForm":{const r=f.reduce(((r,e)=>{const[,a]=l({key:e,value:d.data[e],mode:"blur"},{state:d});return{valid:{...r.valid,[e]:a.isValid&&!d.fieldProblems[e]||!1},errors:{...r.errors,[e]:a.hasError(!0)?a.getError(!0):null}}}),{valid:d.valid,errors:d.errors});return{...d,valid:r.valid,errors:r.errors}}default:throw new Error("Undefined useForm action")}}}export{l as getReducer,a as init};
1
+ const r=(r,e)=>Object.keys(r).filter((r=>!e.includes(r))).reduce(((e,a)=>(e[a]=r[a],e)),{}),e=(r,e,a,l,d)=>e.reduce(((r,e)=>({...r,[e]:r[e]??d?.[e]??l?.[e]??a})),r);function a({schema:r,defaultData:e,processField:a,fieldProblems:l}){const d=r=>{if(void 0===e[r])return{valid:!1,errors:null,data:null,fieldProblems:l?.[r]??null};const[d,s]=a({key:r,value:e[r],mode:"blur"},{state:{data:e}});return{valid:s.isValid&&!l?.[r]||!1,errors:s.hasError()?s.getError():null,data:d,fieldProblems:l?.[r]??null}},s=r.reduce(((r,e)=>{const{valid:a,errors:l,data:s,fieldProblems:t}=d(e);return{valid:{...r.valid,[e]:a},errors:{...r.errors,[e]:l},data:{...r.data,[e]:s},fieldProblems:{...r.fieldProblems,[e]:t}}}),{data:{},valid:{},errors:{},fieldProblems:{}});return{schema:r,data:s.data,valid:s.valid,errors:s.errors,fieldProblems:s.fieldProblems}}function l(l){return function(d,{type:s,key:t,value:o,mode:i,schema:c,defaultData:u,formValue:n,selectedSchema:m,fieldProblems:v,data:f}){const b=m||d.schema;switch(s){case"setData":return{...d,data:{...d.data,[t]:o}};case"mergeData":return{...d,data:{...d.data,...f}};case"setValid":return{...d,valid:{...d.valid,[t]:o}};case"setErrors":return{...d,errors:{...d.errors,[t]:o}};case"setFieldProblems":return d?.schema?.reduce(((r,e)=>({...r,fieldProblems:{...d.fieldProblems,[e]:v?.[e]??null},valid:{...d.valid,[e]:d.valid?.[e]&&!v[e]}})),d)??d;case"updateField":{const[r,e]=l({key:t,value:o,mode:i},{state:d}),a=d.data[t],s={...d.fieldProblems};return a!==r&&(s[t]=null),{...d,data:{...d.data,[t]:r},errors:{...d.errors,[t]:e.hasError()?e.getError():null},valid:{...d.valid,[t]:e.isValid&&!s[t]||!1},fieldProblems:s}}case"mergeForm":{const r={...d,data:{...d.data,...n.data},errors:{...d.errors,...n.errors},valid:{...d.valid,...n.valid},fieldProblems:{...d.fieldProblems,...n.fieldProblems}};return r.valid&&(r.isValid=Object.values(r.valid).every((r=>r))),r}case"setSchema":{const s=a({schema:c,defaultData:u,processField:l,fieldProblems:v}),t=d.schema.filter((r=>!c.includes(r))),o=c.filter((r=>!d.schema.includes(r))),i={data:r(d.data,o),errors:r(d.errors,o),valid:r(d.valid,o)},n=e(r(d.data,t),o,null,s.data,d.local?.data),m=e(r(d.valid,t),o,!1,s.valid,d.local?.valid),f=e(r(d.errors,t),o,null,s.errors,d.local?.errors);return{...d,schema:c,data:n,valid:m,errors:f,local:i}}case"validateForm":{const r=b.reduce(((r,e)=>{const[,a]=l({key:e,value:d.data[e],mode:"blur"},{state:d});return{valid:{...r.valid,[e]:a.isValid&&!d.fieldProblems[e]||!1},errors:{...r.errors,[e]:a.hasError(!0)?a.getError(!0):null}}}),{valid:d.valid,errors:d.errors});return{...d,valid:r.valid,errors:r.errors}}default:throw new Error("Undefined useForm action")}}}export{l as getReducer,a as init};
2
2
  //# sourceMappingURL=reducer.js.map