@adyen/adyen-web 6.0.0-alpha.5 → 6.0.0-alpha.6

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 (420) hide show
  1. package/dist/cjs/adyen.css +10 -9
  2. package/dist/cjs/adyen.css.map +1 -1
  3. package/dist/cjs/index.cjs +2 -2
  4. package/dist/cjs/index.cjs.map +1 -1
  5. package/dist/cjs/index.d.cts +33 -29
  6. package/dist/es/adyen.css +10 -9
  7. package/dist/es/adyen.css.map +1 -1
  8. package/dist/es/components/Address/Address.js +1 -1
  9. package/dist/es/components/Address/Address.js.map +1 -1
  10. package/dist/es/components/BacsDD/components/BacsInput.js +1 -1
  11. package/dist/es/components/BacsDD/components/BacsInput.js.map +1 -1
  12. package/dist/es/components/Blik/components/BlikInput.js +1 -1
  13. package/dist/es/components/Blik/components/BlikInput.js.map +1 -1
  14. package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
  15. package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
  16. package/dist/es/components/CashAppPay/CashAppPay.js +1 -1
  17. package/dist/es/components/CashAppPay/CashAppPay.js.map +1 -1
  18. package/dist/es/components/CashAppPay/components/CashAppComponent.js +1 -1
  19. package/dist/es/components/CashAppPay/components/CashAppComponent.js.map +1 -1
  20. package/dist/es/components/Dropin/components/PaymentMethod/InstantPaymentMethods.js.map +1 -1
  21. package/dist/es/components/GooglePay/components/GooglePayButton.js +1 -1
  22. package/dist/es/components/GooglePay/components/GooglePayButton.js.map +1 -1
  23. package/dist/es/components/GooglePay/defaultProps.js +1 -1
  24. package/dist/es/components/GooglePay/defaultProps.js.map +1 -1
  25. package/dist/es/components/PersonalDetails/PersonalDetails.js +1 -1
  26. package/dist/es/components/PersonalDetails/PersonalDetails.js.map +1 -1
  27. package/dist/es/components/internal/Address/Address.js +1 -1
  28. package/dist/es/components/internal/Address/Address.js.map +1 -1
  29. package/dist/es/components/internal/ClickToPay/components/CtPCards/CtPCards.js +1 -1
  30. package/dist/es/components/internal/ClickToPay/components/CtPCards/CtPCards.js.map +1 -1
  31. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLogin.js +1 -1
  32. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLogin.js.map +1 -1
  33. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePassword.js +1 -1
  34. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePassword.js.map +1 -1
  35. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js +1 -1
  36. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js.map +1 -1
  37. package/dist/es/components/internal/ClickToPay/services/sdks/AbstractSrcInitiator.js.map +1 -1
  38. package/dist/es/components/internal/ClickToPay/services/sdks/MastercardSdk.js.map +1 -1
  39. package/dist/es/components/internal/ClickToPay/services/sdks/VisaSdk.js.map +1 -1
  40. package/dist/es/components/internal/ClickToPay/services/utils.js +1 -1
  41. package/dist/es/components/internal/ClickToPay/services/utils.js.map +1 -1
  42. package/dist/es/components/internal/CompanyDetails/CompanyDetails.js +1 -1
  43. package/dist/es/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
  44. package/dist/es/components/internal/FormFields/Field/Field.js +1 -1
  45. package/dist/es/components/internal/FormFields/Field/Field.js.map +1 -1
  46. package/dist/es/components/internal/FormFields/InputBase.js.map +1 -1
  47. package/dist/es/components/internal/FormFields/Select/components/SelectListItem.js +1 -1
  48. package/dist/es/components/internal/FormFields/Select/components/SelectListItem.js.map +1 -1
  49. package/dist/es/components/internal/Icon/constants.js +2 -0
  50. package/dist/es/components/internal/Icon/constants.js.map +1 -0
  51. package/dist/es/components/internal/OpenInvoice/OpenInvoice.js +1 -1
  52. package/dist/es/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  53. package/dist/es/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js +2 -0
  54. package/dist/es/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -0
  55. package/dist/es/components/internal/QRLoader/QRLoader.js +1 -1
  56. package/dist/es/components/internal/QRLoader/QRLoader.js.map +1 -1
  57. package/dist/es/components/internal/SecuredFields/lib/constants.js +1 -1
  58. package/dist/es/components/internal/SecuredFields/lib/constants.js.map +1 -1
  59. package/dist/es/components/internal/UIElement/UIElement.js +1 -1
  60. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  61. package/dist/es/components/internal/Voucher/Voucher.js +1 -1
  62. package/dist/es/components/internal/Voucher/Voucher.js.map +1 -1
  63. package/dist/es/core/Analytics/Analytics.js +1 -1
  64. package/dist/es/core/Analytics/Analytics.js.map +1 -1
  65. package/dist/es/core/Analytics/constants.js +1 -1
  66. package/dist/es/core/Analytics/constants.js.map +1 -1
  67. package/dist/es/core/Analytics/utils.js.map +1 -1
  68. package/dist/es/core/Context/Resources.js +1 -1
  69. package/dist/es/core/Context/Resources.js.map +1 -1
  70. package/dist/es/core/Environment/Environment.js +1 -1
  71. package/dist/es/core/Environment/Environment.js.map +1 -1
  72. package/dist/es/core/Environment/constants.js +2 -0
  73. package/dist/es/core/Environment/constants.js.map +1 -0
  74. package/dist/es/core/Errors/SRMessages.js +1 -1
  75. package/dist/es/core/Errors/SRMessages.js.map +1 -1
  76. package/dist/es/core/Errors/SRPanel.js +1 -1
  77. package/dist/es/core/Errors/SRPanel.js.map +1 -1
  78. package/dist/es/core/Services/analytics/collect-id.js +1 -1
  79. package/dist/es/core/Services/analytics/collect-id.js.map +1 -1
  80. package/dist/es/core/Services/analytics/log-event.js +1 -1
  81. package/dist/es/core/Services/get-translations.js +1 -1
  82. package/dist/es/core/Services/get-translations.js.map +1 -1
  83. package/dist/es/core/core.defaultProps.js +1 -1
  84. package/dist/es/core/core.defaultProps.js.map +1 -1
  85. package/dist/es/core/core.js +1 -1
  86. package/dist/es/core/core.js.map +1 -1
  87. package/dist/es/core/utils.js +1 -1
  88. package/dist/es/core/utils.js.map +1 -1
  89. package/dist/es/external/preact/dist/preact.js +1 -1
  90. package/dist/es/external/preact/dist/preact.js.map +1 -1
  91. package/dist/es/external/preact/hooks/dist/hooks.js +1 -1
  92. package/dist/es/external/preact/hooks/dist/hooks.js.map +1 -1
  93. package/dist/es/index.d.ts +33 -29
  94. package/dist/es/utils/arrayUtils.js +1 -1
  95. package/dist/es/utils/arrayUtils.js.map +1 -1
  96. package/dist/es/utils/useForm/useForm.js +1 -1
  97. package/dist/es/utils/validator-utils.js +1 -1
  98. package/dist/es/utils/validator-utils.js.map +1 -1
  99. package/dist/es-legacy/adyen.css +10 -9
  100. package/dist/es-legacy/adyen.css.map +1 -1
  101. package/dist/es-legacy/components/ANCV/ANCV.js +1 -1
  102. package/dist/es-legacy/components/ANCV/ANCV.js.map +1 -1
  103. package/dist/es-legacy/components/Ach/Ach.js +1 -1
  104. package/dist/es-legacy/components/Ach/Ach.js.map +1 -1
  105. package/dist/es-legacy/components/Ach/components/AchInput/AchInput.js +1 -1
  106. package/dist/es-legacy/components/Ach/components/AchInput/AchInput.js.map +1 -1
  107. package/dist/es-legacy/components/Address/Address.js +1 -1
  108. package/dist/es-legacy/components/Address/Address.js.map +1 -1
  109. package/dist/es-legacy/components/Affirm/Affirm.js +1 -1
  110. package/dist/es-legacy/components/Affirm/Affirm.js.map +1 -1
  111. package/dist/es-legacy/components/AfterPay/AfterPay.js +1 -1
  112. package/dist/es-legacy/components/AfterPay/AfterPay.js.map +1 -1
  113. package/dist/es-legacy/components/AfterPay/AfterPayB2B.js +1 -1
  114. package/dist/es-legacy/components/AfterPay/AfterPayB2B.js.map +1 -1
  115. package/dist/es-legacy/components/AmazonPay/AmazonPay.js +1 -1
  116. package/dist/es-legacy/components/AmazonPay/AmazonPay.js.map +1 -1
  117. package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js +1 -1
  118. package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
  119. package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js +1 -1
  120. package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
  121. package/dist/es-legacy/components/AmazonPay/utils.js +1 -1
  122. package/dist/es-legacy/components/AmazonPay/utils.js.map +1 -1
  123. package/dist/es-legacy/components/ApplePay/ApplePay.js +1 -1
  124. package/dist/es-legacy/components/ApplePay/ApplePay.js.map +1 -1
  125. package/dist/es-legacy/components/Atome/Atome.js +1 -1
  126. package/dist/es-legacy/components/Atome/Atome.js.map +1 -1
  127. package/dist/es-legacy/components/Atome/config.js +1 -1
  128. package/dist/es-legacy/components/Atome/config.js.map +1 -1
  129. package/dist/es-legacy/components/BacsDD/BacsDD.js +1 -1
  130. package/dist/es-legacy/components/BacsDD/BacsDD.js.map +1 -1
  131. package/dist/es-legacy/components/BacsDD/components/BacsInput.js +1 -1
  132. package/dist/es-legacy/components/BacsDD/components/BacsInput.js.map +1 -1
  133. package/dist/es-legacy/components/BankTransfer/BankTransfer.js +1 -1
  134. package/dist/es-legacy/components/BankTransfer/BankTransfer.js.map +1 -1
  135. package/dist/es-legacy/components/BillDesk/BillDeskOnline.js +1 -1
  136. package/dist/es-legacy/components/BillDesk/BillDeskOnline.js.map +1 -1
  137. package/dist/es-legacy/components/BillDesk/BillDeskWallet.js +1 -1
  138. package/dist/es-legacy/components/BillDesk/BillDeskWallet.js.map +1 -1
  139. package/dist/es-legacy/components/Blik/Blik.js +1 -1
  140. package/dist/es-legacy/components/Blik/Blik.js.map +1 -1
  141. package/dist/es-legacy/components/Blik/components/BlikInput.js +1 -1
  142. package/dist/es-legacy/components/Blik/components/BlikInput.js.map +1 -1
  143. package/dist/es-legacy/components/Boleto/Boleto.js +1 -1
  144. package/dist/es-legacy/components/Boleto/Boleto.js.map +1 -1
  145. package/dist/es-legacy/components/Boleto/components/BoletoInput/BoletoInput.js +1 -1
  146. package/dist/es-legacy/components/Boleto/components/BoletoInput/BoletoInput.js.map +1 -1
  147. package/dist/es-legacy/components/Card/Bancontact.js +1 -1
  148. package/dist/es-legacy/components/Card/Bancontact.js.map +1 -1
  149. package/dist/es-legacy/components/Card/Card.js +1 -1
  150. package/dist/es-legacy/components/Card/Card.js.map +1 -1
  151. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
  152. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
  153. package/dist/es-legacy/components/Card/components/CardInput/components/IframeLabelAlternative.js +1 -1
  154. package/dist/es-legacy/components/Card/components/CardInput/components/IframeLabelAlternative.js.map +1 -1
  155. package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFields.js +1 -1
  156. package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFields.js.map +1 -1
  157. package/dist/es-legacy/components/CashAppPay/CashAppPay.js +1 -1
  158. package/dist/es-legacy/components/CashAppPay/CashAppPay.js.map +1 -1
  159. package/dist/es-legacy/components/CashAppPay/components/CashAppComponent.js +1 -1
  160. package/dist/es-legacy/components/CashAppPay/components/CashAppComponent.js.map +1 -1
  161. package/dist/es-legacy/components/ClickToPay/ClickToPay.js +1 -1
  162. package/dist/es-legacy/components/ClickToPay/ClickToPay.js.map +1 -1
  163. package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
  164. package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
  165. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  166. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  167. package/dist/es-legacy/components/Doku/Doku.js +1 -1
  168. package/dist/es-legacy/components/Doku/Doku.js.map +1 -1
  169. package/dist/es-legacy/components/Donation/Donation.js +1 -1
  170. package/dist/es-legacy/components/Donation/Donation.js.map +1 -1
  171. package/dist/es-legacy/components/Donation/components/DonationComponent.js +1 -1
  172. package/dist/es-legacy/components/Donation/components/DonationComponent.js.map +1 -1
  173. package/dist/es-legacy/components/Dragonpay/Dragonpay.js +1 -1
  174. package/dist/es-legacy/components/Dragonpay/Dragonpay.js.map +1 -1
  175. package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js +1 -1
  176. package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js.map +1 -1
  177. package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
  178. package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
  179. package/dist/es-legacy/components/Dropin/components/DropinComponent.js +1 -1
  180. package/dist/es-legacy/components/Dropin/components/DropinComponent.js.map +1 -1
  181. package/dist/es-legacy/components/Dropin/components/PaymentMethod/InstantPaymentMethods.js.map +1 -1
  182. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  183. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  184. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js +1 -1
  185. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js.map +1 -1
  186. package/dist/es-legacy/components/Dropin/elements/createInstantPaymentElements.js +1 -1
  187. package/dist/es-legacy/components/Dropin/elements/createInstantPaymentElements.js.map +1 -1
  188. package/dist/es-legacy/components/Dropin/elements/createStoredElements.js +1 -1
  189. package/dist/es-legacy/components/Dropin/elements/createStoredElements.js.map +1 -1
  190. package/dist/es-legacy/components/EPS/index.js +1 -1
  191. package/dist/es-legacy/components/EPS/index.js.map +1 -1
  192. package/dist/es-legacy/components/Econtext/Econtext.js +1 -1
  193. package/dist/es-legacy/components/Econtext/Econtext.js.map +1 -1
  194. package/dist/es-legacy/components/FacilyPay/FacilyPay10x.js +1 -1
  195. package/dist/es-legacy/components/FacilyPay/FacilyPay10x.js.map +1 -1
  196. package/dist/es-legacy/components/FacilyPay/FacilyPay12x.js +1 -1
  197. package/dist/es-legacy/components/FacilyPay/FacilyPay12x.js.map +1 -1
  198. package/dist/es-legacy/components/FacilyPay/FacilyPay3x.js +1 -1
  199. package/dist/es-legacy/components/FacilyPay/FacilyPay3x.js.map +1 -1
  200. package/dist/es-legacy/components/FacilyPay/FacilyPay4x.js +1 -1
  201. package/dist/es-legacy/components/FacilyPay/FacilyPay4x.js.map +1 -1
  202. package/dist/es-legacy/components/FacilyPay/FacilyPay6x.js +1 -1
  203. package/dist/es-legacy/components/FacilyPay/FacilyPay6x.js.map +1 -1
  204. package/dist/es-legacy/components/Giftcard/Giftcard.js +1 -1
  205. package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
  206. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js +1 -1
  207. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  208. package/dist/es-legacy/components/Giftcard/components/GiftcardFields.js +1 -1
  209. package/dist/es-legacy/components/Giftcard/components/GiftcardFields.js.map +1 -1
  210. package/dist/es-legacy/components/Giropay/Giropay.js +1 -1
  211. package/dist/es-legacy/components/Giropay/Giropay.js.map +1 -1
  212. package/dist/es-legacy/components/GooglePay/GooglePay.js +1 -1
  213. package/dist/es-legacy/components/GooglePay/GooglePay.js.map +1 -1
  214. package/dist/es-legacy/components/GooglePay/components/GooglePayButton.js +1 -1
  215. package/dist/es-legacy/components/GooglePay/components/GooglePayButton.js.map +1 -1
  216. package/dist/es-legacy/components/GooglePay/defaultProps.js +1 -1
  217. package/dist/es-legacy/components/GooglePay/defaultProps.js.map +1 -1
  218. package/dist/es-legacy/components/Klarna/KlarnaPayments.js +1 -1
  219. package/dist/es-legacy/components/Klarna/KlarnaPayments.js.map +1 -1
  220. package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js +1 -1
  221. package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js.map +1 -1
  222. package/dist/es-legacy/components/MBWay/MBWay.js +1 -1
  223. package/dist/es-legacy/components/MBWay/MBWay.js.map +1 -1
  224. package/dist/es-legacy/components/MBWay/components/MBWayInput/MBWayInput.js +1 -1
  225. package/dist/es-legacy/components/MBWay/components/MBWayInput/MBWayInput.js.map +1 -1
  226. package/dist/es-legacy/components/MealVoucherFR/MealVoucherFR.js +1 -1
  227. package/dist/es-legacy/components/MealVoucherFR/MealVoucherFR.js.map +1 -1
  228. package/dist/es-legacy/components/MealVoucherFR/components/MealVoucherFields.js +1 -1
  229. package/dist/es-legacy/components/MealVoucherFR/components/MealVoucherFields.js.map +1 -1
  230. package/dist/es-legacy/components/Multibanco/Multibanco.js +1 -1
  231. package/dist/es-legacy/components/Multibanco/Multibanco.js.map +1 -1
  232. package/dist/es-legacy/components/OnlineBankingCZ/index.js +1 -1
  233. package/dist/es-legacy/components/OnlineBankingCZ/index.js.map +1 -1
  234. package/dist/es-legacy/components/OnlineBankingIN/index.js +1 -1
  235. package/dist/es-legacy/components/OnlineBankingIN/index.js.map +1 -1
  236. package/dist/es-legacy/components/OnlineBankingPL/OnlineBankingPL.js +1 -1
  237. package/dist/es-legacy/components/OnlineBankingPL/OnlineBankingPL.js.map +1 -1
  238. package/dist/es-legacy/components/OnlineBankingSK/index.js +1 -1
  239. package/dist/es-legacy/components/OnlineBankingSK/index.js.map +1 -1
  240. package/dist/es-legacy/components/Oxxo/Oxxo.js +1 -1
  241. package/dist/es-legacy/components/Oxxo/Oxxo.js.map +1 -1
  242. package/dist/es-legacy/components/PayByBank/PayByBank.js +1 -1
  243. package/dist/es-legacy/components/PayByBank/PayByBank.js.map +1 -1
  244. package/dist/es-legacy/components/PayPal/Paypal.js +1 -1
  245. package/dist/es-legacy/components/PayPal/Paypal.js.map +1 -1
  246. package/dist/es-legacy/components/PayPal/components/PaypalButtons.js +1 -1
  247. package/dist/es-legacy/components/PayPal/components/PaypalButtons.js.map +1 -1
  248. package/dist/es-legacy/components/PayPal/components/PaypalComponent.js +1 -1
  249. package/dist/es-legacy/components/PayPal/components/PaypalComponent.js.map +1 -1
  250. package/dist/es-legacy/components/PayPal/utils/get-paypal-settings.js +1 -1
  251. package/dist/es-legacy/components/PayPal/utils/get-paypal-settings.js.map +1 -1
  252. package/dist/es-legacy/components/PayU/PayuCashcard.js +1 -1
  253. package/dist/es-legacy/components/PayU/PayuCashcard.js.map +1 -1
  254. package/dist/es-legacy/components/PayU/PayuNetBanking.js +1 -1
  255. package/dist/es-legacy/components/PayU/PayuNetBanking.js.map +1 -1
  256. package/dist/es-legacy/components/PersonalDetails/PersonalDetails.js +1 -1
  257. package/dist/es-legacy/components/PersonalDetails/PersonalDetails.js.map +1 -1
  258. package/dist/es-legacy/components/Pix/Pix.js +1 -1
  259. package/dist/es-legacy/components/Pix/Pix.js.map +1 -1
  260. package/dist/es-legacy/components/RatePay/RatePay.js +1 -1
  261. package/dist/es-legacy/components/RatePay/RatePay.js.map +1 -1
  262. package/dist/es-legacy/components/RatePay/RatePayDirectDebit.js +1 -1
  263. package/dist/es-legacy/components/RatePay/RatePayDirectDebit.js.map +1 -1
  264. package/dist/es-legacy/components/Redirect/Redirect.js +1 -1
  265. package/dist/es-legacy/components/Redirect/Redirect.js.map +1 -1
  266. package/dist/es-legacy/components/Riverty/Riverty.js +1 -1
  267. package/dist/es-legacy/components/Riverty/Riverty.js.map +1 -1
  268. package/dist/es-legacy/components/Sepa/Sepa.js +1 -1
  269. package/dist/es-legacy/components/Sepa/Sepa.js.map +1 -1
  270. package/dist/es-legacy/components/ThreeDS2/ThreeDS2Challenge.js +1 -1
  271. package/dist/es-legacy/components/ThreeDS2/ThreeDS2Challenge.js.map +1 -1
  272. package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js +1 -1
  273. package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  274. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  275. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  276. package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js +1 -1
  277. package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
  278. package/dist/es-legacy/components/Trustly/Trustly.js +1 -1
  279. package/dist/es-legacy/components/Trustly/Trustly.js.map +1 -1
  280. package/dist/es-legacy/components/Twint/Twint.js +1 -1
  281. package/dist/es-legacy/components/Twint/Twint.js.map +1 -1
  282. package/dist/es-legacy/components/UPI/UPI.js +1 -1
  283. package/dist/es-legacy/components/UPI/UPI.js.map +1 -1
  284. package/dist/es-legacy/components/WalletIN/index.js +1 -1
  285. package/dist/es-legacy/components/WalletIN/index.js.map +1 -1
  286. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
  287. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  288. package/dist/es-legacy/components/helpers/OpenInvoiceContainer/OpenInvoiceContainer.js +1 -1
  289. package/dist/es-legacy/components/helpers/OpenInvoiceContainer/OpenInvoiceContainer.js.map +1 -1
  290. package/dist/es-legacy/components/helpers/QRLoaderContainer/QRLoaderContainer.js +1 -1
  291. package/dist/es-legacy/components/helpers/QRLoaderContainer/QRLoaderContainer.js.map +1 -1
  292. package/dist/es-legacy/components/internal/Address/Address.js +1 -1
  293. package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
  294. package/dist/es-legacy/components/internal/Address/components/CountryField.js +1 -1
  295. package/dist/es-legacy/components/internal/Address/components/CountryField.js.map +1 -1
  296. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
  297. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
  298. package/dist/es-legacy/components/internal/ClickToPay/components/CtPCards/CtPCards.js +1 -1
  299. package/dist/es-legacy/components/internal/ClickToPay/components/CtPCards/CtPCards.js.map +1 -1
  300. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLogin.js +1 -1
  301. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLogin.js.map +1 -1
  302. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePassword.js +1 -1
  303. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePassword.js.map +1 -1
  304. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js +1 -1
  305. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js.map +1 -1
  306. package/dist/es-legacy/components/internal/ClickToPay/services/ClickToPayService.js +1 -1
  307. package/dist/es-legacy/components/internal/ClickToPay/services/ClickToPayService.js.map +1 -1
  308. package/dist/es-legacy/components/internal/ClickToPay/services/sdks/AbstractSrcInitiator.js.map +1 -1
  309. package/dist/es-legacy/components/internal/ClickToPay/services/sdks/MastercardSdk.js +1 -1
  310. package/dist/es-legacy/components/internal/ClickToPay/services/sdks/MastercardSdk.js.map +1 -1
  311. package/dist/es-legacy/components/internal/ClickToPay/services/sdks/VisaSdk.js +1 -1
  312. package/dist/es-legacy/components/internal/ClickToPay/services/sdks/VisaSdk.js.map +1 -1
  313. package/dist/es-legacy/components/internal/ClickToPay/services/utils.js +1 -1
  314. package/dist/es-legacy/components/internal/ClickToPay/services/utils.js.map +1 -1
  315. package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js +1 -1
  316. package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
  317. package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js +1 -1
  318. package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js.map +1 -1
  319. package/dist/es-legacy/components/internal/FormFields/Field/Field.js +1 -1
  320. package/dist/es-legacy/components/internal/FormFields/Field/Field.js.map +1 -1
  321. package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
  322. package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
  323. package/dist/es-legacy/components/internal/FormFields/InputDate/InputDate.js +1 -1
  324. package/dist/es-legacy/components/internal/FormFields/InputDate/InputDate.js.map +1 -1
  325. package/dist/es-legacy/components/internal/FormFields/InputEmail.js +1 -1
  326. package/dist/es-legacy/components/internal/FormFields/InputEmail.js.map +1 -1
  327. package/dist/es-legacy/components/internal/FormFields/InputTelephone.js +1 -1
  328. package/dist/es-legacy/components/internal/FormFields/InputTelephone.js.map +1 -1
  329. package/dist/es-legacy/components/internal/FormFields/InputText.js +1 -1
  330. package/dist/es-legacy/components/internal/FormFields/InputText.js.map +1 -1
  331. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js +1 -1
  332. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
  333. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js +1 -1
  334. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js.map +1 -1
  335. package/dist/es-legacy/components/internal/IbanInput/IbanInput.js +1 -1
  336. package/dist/es-legacy/components/internal/IbanInput/IbanInput.js.map +1 -1
  337. package/dist/es-legacy/components/internal/Icon/constants.js +2 -0
  338. package/dist/es-legacy/components/internal/Icon/constants.js.map +1 -0
  339. package/dist/es-legacy/components/internal/Img/Img.js +1 -1
  340. package/dist/es-legacy/components/internal/Img/Img.js.map +1 -1
  341. package/dist/es-legacy/components/internal/IssuerList/IssuerButtonGroup/IssuerButtonGroup.js +1 -1
  342. package/dist/es-legacy/components/internal/IssuerList/IssuerButtonGroup/IssuerButtonGroup.js.map +1 -1
  343. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js +1 -1
  344. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  345. package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js +2 -0
  346. package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -0
  347. package/dist/es-legacy/components/internal/PayButton/PayButton.js +1 -1
  348. package/dist/es-legacy/components/internal/PayButton/PayButton.js.map +1 -1
  349. package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js +1 -1
  350. package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
  351. package/dist/es-legacy/components/internal/PhoneInput/PhoneInput.js +1 -1
  352. package/dist/es-legacy/components/internal/PhoneInput/PhoneInput.js.map +1 -1
  353. package/dist/es-legacy/components/internal/QRLoader/QRLoader.js +1 -1
  354. package/dist/es-legacy/components/internal/QRLoader/QRLoader.js.map +1 -1
  355. package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js +1 -1
  356. package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js.map +1 -1
  357. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  358. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  359. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
  360. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
  361. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js +1 -1
  362. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js.map +1 -1
  363. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js +1 -1
  364. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js.map +1 -1
  365. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  366. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  367. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/utils/processAriaConfig.js +1 -1
  368. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/utils/processAriaConfig.js.map +1 -1
  369. package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
  370. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  371. package/dist/es-legacy/components/internal/Voucher/Voucher.js +1 -1
  372. package/dist/es-legacy/components/internal/Voucher/Voucher.js.map +1 -1
  373. package/dist/es-legacy/core/Analytics/Analytics.js +1 -1
  374. package/dist/es-legacy/core/Analytics/Analytics.js.map +1 -1
  375. package/dist/es-legacy/core/Analytics/constants.js +1 -1
  376. package/dist/es-legacy/core/Analytics/constants.js.map +1 -1
  377. package/dist/es-legacy/core/Analytics/utils.js.map +1 -1
  378. package/dist/es-legacy/core/Context/Resources.js +1 -1
  379. package/dist/es-legacy/core/Context/Resources.js.map +1 -1
  380. package/dist/es-legacy/core/Environment/Environment.js +1 -1
  381. package/dist/es-legacy/core/Environment/Environment.js.map +1 -1
  382. package/dist/es-legacy/core/Environment/constants.js +2 -0
  383. package/dist/es-legacy/core/Environment/constants.js.map +1 -0
  384. package/dist/es-legacy/core/Errors/SRPanel.js +1 -1
  385. package/dist/es-legacy/core/Errors/SRPanel.js.map +1 -1
  386. package/dist/es-legacy/core/ProcessResponse/PaymentAction/actionTypes.js +1 -1
  387. package/dist/es-legacy/core/ProcessResponse/PaymentAction/actionTypes.js.map +1 -1
  388. package/dist/es-legacy/core/ProcessResponse/PaymentMethods/utils.js +1 -1
  389. package/dist/es-legacy/core/ProcessResponse/PaymentMethods/utils.js.map +1 -1
  390. package/dist/es-legacy/core/ProcessResponse/process-response.js +1 -1
  391. package/dist/es-legacy/core/ProcessResponse/process-response.js.map +1 -1
  392. package/dist/es-legacy/core/RiskModule/RiskModule.js +1 -1
  393. package/dist/es-legacy/core/RiskModule/RiskModule.js.map +1 -1
  394. package/dist/es-legacy/core/Services/analytics/collect-id.js +1 -1
  395. package/dist/es-legacy/core/Services/analytics/collect-id.js.map +1 -1
  396. package/dist/es-legacy/core/Services/analytics/log-event.js +1 -1
  397. package/dist/es-legacy/core/Services/get-translations.js +1 -1
  398. package/dist/es-legacy/core/Services/get-translations.js.map +1 -1
  399. package/dist/es-legacy/core/Services/http.js +1 -1
  400. package/dist/es-legacy/core/Services/http.js.map +1 -1
  401. package/dist/es-legacy/core/core.defaultProps.js +1 -1
  402. package/dist/es-legacy/core/core.defaultProps.js.map +1 -1
  403. package/dist/es-legacy/core/core.js +1 -1
  404. package/dist/es-legacy/core/core.js.map +1 -1
  405. package/dist/es-legacy/core/core.registry.js +1 -1
  406. package/dist/es-legacy/core/core.registry.js.map +1 -1
  407. package/dist/es-legacy/core/utils.js +1 -1
  408. package/dist/es-legacy/core/utils.js.map +1 -1
  409. package/dist/es-legacy/external/preact/dist/preact.js +1 -1
  410. package/dist/es-legacy/external/preact/dist/preact.js.map +1 -1
  411. package/dist/es-legacy/external/preact/hooks/dist/hooks.js +1 -1
  412. package/dist/es-legacy/external/preact/hooks/dist/hooks.js.map +1 -1
  413. package/dist/es-legacy/utils/arrayUtils.js +1 -1
  414. package/dist/es-legacy/utils/arrayUtils.js.map +1 -1
  415. package/dist/es-legacy/utils/useForm/reducer.js +1 -1
  416. package/dist/es-legacy/utils/useForm/reducer.js.map +1 -1
  417. package/dist/es-legacy/utils/useForm/useForm.js +1 -1
  418. package/dist/es-legacy/utils/validator-utils.js +1 -1
  419. package/dist/es-legacy/utils/validator-utils.js.map +1 -1
  420. package/package.json +146 -148
@@ -1 +1 @@
1
- {"version":3,"file":"CashAppComponent.js","sources":["../../../../../src/components/CashAppPay/components/CashAppComponent.tsx"],"sourcesContent":["import { h, RefObject } from 'preact';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport Spinner from '../../internal/Spinner';\nimport { CashAppPayEvents, ICashAppService } from '../services/types';\nimport { CashAppPayEventData } from '../types';\nimport StoreDetails from '../../internal/StoreDetails';\nimport './CashAppComponent.scss';\nimport { UIElementStatus } from '../../internal/UIElement/types';\n\ninterface CashAppComponentProps {\n enableStoreDetails?: boolean;\n cashAppService: ICashAppService;\n onClick(): void;\n onChangeStoreDetails(data: any): void;\n onAuthorize(payEventData: CashAppPayEventData): void;\n onError(error: AdyenCheckoutError): void;\n ref(ref: RefObject<typeof CashAppComponent>): void;\n}\n\nexport function CashAppComponent({\n enableStoreDetails,\n cashAppService,\n onClick,\n onChangeStoreDetails,\n onAuthorize,\n onError\n}: CashAppComponentProps): h.JSX.Element {\n const cashAppRef = useRef<HTMLDivElement>(null);\n const [status, setStatus] = useState<UIElementStatus>('loading');\n const subscriptions = useRef<Function[]>([]);\n const [storePaymentMethod, setStorePaymentMethod] = useState<boolean>(false);\n\n this.setStatus = setStatus;\n\n const initializeCashAppSdk = useCallback(async () => {\n try {\n await cashAppService.initialize();\n\n subscriptions.current = [\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerDismissed, () => {\n onError(new AdyenCheckoutError('CANCEL', 'Customer dismissed the modal'));\n }),\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerRequestDeclined, async () => {\n onError(new AdyenCheckoutError('ERROR', 'Payment declined by CashAppPay'));\n await cashAppService.restart();\n await cashAppService.renderButton(cashAppRef.current);\n }),\n\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerRequestApproved, ({ customerProfile, grants }) => {\n const cashAppPaymentData: CashAppPayEventData = {\n ...(customerProfile?.id && { customerId: customerProfile.id }),\n ...(customerProfile?.cashtag && { cashTag: customerProfile.cashtag }),\n ...(grants?.payment?.grantId && { grantId: grants.payment.grantId }),\n ...(grants?.onFile?.grantId && { onFileGrantId: grants.onFile.grantId })\n };\n\n onAuthorize(cashAppPaymentData);\n }),\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerRequestFailed, () => {\n onError(new AdyenCheckoutError('ERROR', 'Customer request failed'));\n })\n ];\n\n await cashAppService.renderButton(cashAppRef.current);\n\n setStatus('ready');\n } catch (error) {\n onError(error);\n }\n }, [cashAppService, onError, onAuthorize]);\n\n useEffect(() => {\n if (enableStoreDetails) {\n cashAppService.setStorePaymentMethod(storePaymentMethod);\n onChangeStoreDetails(storePaymentMethod);\n }\n }, [enableStoreDetails, storePaymentMethod]);\n\n useEffect(() => {\n initializeCashAppSdk();\n return () => {\n cashAppService.restart();\n subscriptions.current.forEach(unsubscribeFn => unsubscribeFn());\n };\n }, [cashAppService, initializeCashAppSdk]);\n\n return (\n <div className=\"adyen-checkout__cashapp\" aria-live=\"polite\" aria-busy={status === 'loading'}>\n {status === 'loading' && <Spinner />}\n {status !== 'loading' && enableStoreDetails && <StoreDetails storeDetails={storePaymentMethod} onChange={setStorePaymentMethod} />}\n\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}\n <div onClick={onClick} className={'adyen-checkout__cashapp-button'} ref={cashAppRef}></div>\n </div>\n );\n}\n"],"names":["CashAppComponent","enableStoreDetails","cashAppService","onClick","onChangeStoreDetails","onAuthorize","onError","cashAppRef","useRef","status","setStatus","useState","subscriptions","storePaymentMethod","setStorePaymentMethod","this","initializeCashAppSdk","useCallback","async","initialize","current","subscribeToEvent","CashAppPayEvents","CustomerDismissed","AdyenCheckoutError","CustomerRequestDeclined","restart","renderButton","CustomerRequestApproved","customerProfile","grants","cashAppPaymentData","id","customerId","cashtag","cashTag","payment","grantId","onFile","onFileGrantId","CustomerRequestFailed","error","useEffect","forEach","unsubscribeFn","h","div","className","aria-live","aria-busy","Spinner","StoreDetails","storeDetails","onChange","ref"],"mappings":"0ZAoBO,SAASA,GAAiBC,mBAC7BA,EAAkBC,eAClBA,EAAcC,QACdA,EAAOC,qBACPA,EAAoBC,YACpBA,EAAWC,QACXA,IAEA,MAAMC,EAAaC,EAAuB,OACnCC,EAAQC,GAAaC,EAA0B,WAChDC,EAAgBJ,EAAmB,KAClCK,EAAoBC,GAAyBH,GAAkB,GAEtEI,KAAKL,UAAYA,EAEjB,MAAMM,EAAuBC,GAAYC,UACrC,UACUhB,EAAeiB,aAErBP,EAAcQ,QAAU,CACpBlB,EAAemB,iBAAiBC,EAAiBC,mBAAmB,KAChEjB,EAAQ,IAAIkB,EAAmB,SAAU,gCAAA,IAE7CtB,EAAemB,iBAAiBC,EAAiBG,yBAAyBP,UACtEZ,EAAQ,IAAIkB,EAAmB,QAAS,yCAClCtB,EAAewB,gBACfxB,EAAeyB,aAAapB,EAAWa,QAAO,IAGxDlB,EAAemB,iBAAiBC,EAAiBM,yBAAyB,EAAGC,kBAAiBC,aAC1F,MAAMC,EAA0C,IACxCF,GAAiBG,IAAM,CAAEC,WAAYJ,EAAgBG,OACrDH,GAAiBK,SAAW,CAAEC,QAASN,EAAgBK,YACvDJ,GAAQM,SAASC,SAAW,CAAEA,QAASP,EAAOM,QAAQC,YACtDP,GAAQQ,QAAQD,SAAW,CAAEE,cAAeT,EAAOQ,OAAOD,UAGlEhC,EAAY0B,EAAAA,IAEhB7B,EAAemB,iBAAiBC,EAAiBkB,uBAAuB,KACpElC,EAAQ,IAAIkB,EAAmB,QAAS,2BAAA,WAI1CtB,EAAeyB,aAAapB,EAAWa,SAE7CV,EAAU,QACd,CAAE,MAAO+B,GACLnC,EAAQmC,EACZ,IACD,CAACvC,EAAgBI,EAASD,IAiB7B,OAfAqC,GAAU,KACFzC,IACAC,EAAeY,sBAAsBD,GACrCT,EAAqBS,GACzB,GACD,CAACZ,EAAoBY,IAExB6B,GAAU,KACN1B,IACO,KACHd,EAAewB,UACfd,EAAcQ,QAAQuB,SAAQC,GAAiBA,KAAAA,IAEpD,CAAC1C,EAAgBc,IAGhB6B,EAACC,MAAAA,CAAIC,UAAU,0BAA0BC,YAAU,SAASC,YAAsB,YAAXxC,GACvD,YAAXA,GAAwBoC,EAACK,EAAAA,MACd,YAAXzC,GAAwBR,GAAsB4C,EAACM,EAAAA,CAAaC,aAAcvC,EAAoBwC,SAAUvC,IAGzG+B,EAACC,MAAAA,CAAI3C,QAASA,EAAS4C,UAAW,iCAAkCO,IAAK/C,IAGrF"}
1
+ {"version":3,"file":"CashAppComponent.js","sources":["../../../../../src/components/CashAppPay/components/CashAppComponent.tsx"],"sourcesContent":["import { h, RefObject } from 'preact';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport Spinner from '../../internal/Spinner';\nimport { CashAppPayEvents, ICashAppService } from '../services/types';\nimport { CashAppPayEventData } from '../types';\nimport StoreDetails from '../../internal/StoreDetails';\nimport './CashAppComponent.scss';\nimport { UIElementStatus } from '../../internal/UIElement/types';\n\ninterface CashAppComponentProps {\n enableStoreDetails?: boolean;\n cashAppService: ICashAppService;\n onClick(): void;\n onChangeStoreDetails(data: any): void;\n onAuthorize(payEventData: CashAppPayEventData): void;\n onError(error: AdyenCheckoutError): void;\n ref(ref: RefObject<typeof CashAppComponent>): void;\n}\n\nexport function CashAppComponent({\n enableStoreDetails,\n cashAppService,\n onClick,\n onChangeStoreDetails,\n onAuthorize,\n onError\n}: CashAppComponentProps): h.JSX.Element {\n const cashAppRef = useRef<HTMLDivElement>(null);\n const [status, setStatus] = useState<UIElementStatus>('loading');\n const subscriptions = useRef<Function[]>([]);\n const [storePaymentMethod, setStorePaymentMethod] = useState<boolean>(false);\n\n this.setStatus = setStatus;\n\n const initializeCashAppSdk = useCallback(async () => {\n try {\n await cashAppService.initialize();\n\n subscriptions.current = [\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerDismissed, () => {\n onError(new AdyenCheckoutError('CANCEL', 'Customer dismissed the modal'));\n }),\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerRequestDeclined, async () => {\n onError(new AdyenCheckoutError('ERROR', 'Payment declined by CashAppPay'));\n await cashAppService.restart();\n await cashAppService.renderButton(cashAppRef.current);\n }),\n\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerRequestApproved, ({ customerProfile, grants }) => {\n const cashAppPaymentData: CashAppPayEventData = {\n ...(customerProfile?.id && { customerId: customerProfile.id }),\n ...(customerProfile?.cashtag && { cashTag: customerProfile.cashtag }),\n ...(grants?.payment?.grantId && { grantId: grants.payment.grantId }),\n ...(grants?.onFile?.grantId && { onFileGrantId: grants.onFile.grantId })\n };\n\n onAuthorize(cashAppPaymentData);\n }),\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerRequestFailed, () => {\n onError(new AdyenCheckoutError('ERROR', 'Customer request failed'));\n })\n ];\n\n await cashAppService.renderButton(cashAppRef.current);\n\n setStatus('ready');\n } catch (error) {\n if (error instanceof AdyenCheckoutError) onError(error);\n else onError(new AdyenCheckoutError('ERROR', 'Error when initializing CashAppPay', { cause: error }));\n }\n }, [cashAppService, onError, onAuthorize]);\n\n useEffect(() => {\n if (enableStoreDetails) {\n cashAppService.setStorePaymentMethod(storePaymentMethod);\n onChangeStoreDetails(storePaymentMethod);\n }\n }, [enableStoreDetails, storePaymentMethod]);\n\n useEffect(() => {\n initializeCashAppSdk();\n return () => {\n cashAppService.restart();\n subscriptions.current.forEach(unsubscribeFn => unsubscribeFn());\n };\n }, [cashAppService, initializeCashAppSdk]);\n\n return (\n <div className=\"adyen-checkout__cashapp\" aria-live=\"polite\" aria-busy={status === 'loading'}>\n {status === 'loading' && <Spinner />}\n {status !== 'loading' && enableStoreDetails && <StoreDetails storeDetails={storePaymentMethod} onChange={setStorePaymentMethod} />}\n\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}\n <div onClick={onClick} className={'adyen-checkout__cashapp-button'} ref={cashAppRef}></div>\n </div>\n );\n}\n"],"names":["CashAppComponent","enableStoreDetails","cashAppService","onClick","onChangeStoreDetails","onAuthorize","onError","cashAppRef","useRef","status","setStatus","useState","subscriptions","storePaymentMethod","setStorePaymentMethod","this","initializeCashAppSdk","useCallback","async","initialize","current","subscribeToEvent","CashAppPayEvents","CustomerDismissed","AdyenCheckoutError","CustomerRequestDeclined","restart","renderButton","CustomerRequestApproved","customerProfile","grants","cashAppPaymentData","id","customerId","cashtag","cashTag","payment","grantId","onFile","onFileGrantId","CustomerRequestFailed","error","cause","useEffect","forEach","unsubscribeFn","h","div","className","aria-live","aria-busy","Spinner","StoreDetails","storeDetails","onChange","ref"],"mappings":"0ZAoBO,SAASA,GAAiBC,mBAC7BA,EAAkBC,eAClBA,EAAcC,QACdA,EAAOC,qBACPA,EAAoBC,YACpBA,EAAWC,QACXA,IAEA,MAAMC,EAAaC,EAAuB,OACnCC,EAAQC,GAAaC,EAA0B,WAChDC,EAAgBJ,EAAmB,KAClCK,EAAoBC,GAAyBH,GAAkB,GAEtEI,KAAKL,UAAYA,EAEjB,MAAMM,EAAuBC,GAAYC,UACrC,UACUhB,EAAeiB,aAErBP,EAAcQ,QAAU,CACpBlB,EAAemB,iBAAiBC,EAAiBC,mBAAmB,KAChEjB,EAAQ,IAAIkB,EAAmB,SAAU,gCAAA,IAE7CtB,EAAemB,iBAAiBC,EAAiBG,yBAAyBP,UACtEZ,EAAQ,IAAIkB,EAAmB,QAAS,yCAClCtB,EAAewB,gBACfxB,EAAeyB,aAAapB,EAAWa,QAAO,IAGxDlB,EAAemB,iBAAiBC,EAAiBM,yBAAyB,EAAGC,kBAAiBC,aAC1F,MAAMC,EAA0C,IACxCF,GAAiBG,IAAM,CAAEC,WAAYJ,EAAgBG,OACrDH,GAAiBK,SAAW,CAAEC,QAASN,EAAgBK,YACvDJ,GAAQM,SAASC,SAAW,CAAEA,QAASP,EAAOM,QAAQC,YACtDP,GAAQQ,QAAQD,SAAW,CAAEE,cAAeT,EAAOQ,OAAOD,UAGlEhC,EAAY0B,EAAAA,IAEhB7B,EAAemB,iBAAiBC,EAAiBkB,uBAAuB,KACpElC,EAAQ,IAAIkB,EAAmB,QAAS,2BAAA,WAI1CtB,EAAeyB,aAAapB,EAAWa,SAE7CV,EAAU,QACd,CAAE,MAAO+B,GACoCnC,EAArCmC,aAAiBjB,EAA4BiB,EACpC,IAAIjB,EAAmB,QAAS,qCAAsC,CAAEkB,MAAOD,IAChG,IACD,CAACvC,EAAgBI,EAASD,IAiB7B,OAfAsC,GAAU,KACF1C,IACAC,EAAeY,sBAAsBD,GACrCT,EAAqBS,GACzB,GACD,CAACZ,EAAoBY,IAExB8B,GAAU,KACN3B,IACO,KACHd,EAAewB,UACfd,EAAcQ,QAAQwB,SAAQC,GAAiBA,KAAAA,IAEpD,CAAC3C,EAAgBc,IAGhB8B,EAACC,MAAAA,CAAIC,UAAU,0BAA0BC,YAAU,SAASC,YAAsB,YAAXzC,GACvD,YAAXA,GAAwBqC,EAACK,EAAAA,MACd,YAAX1C,GAAwBR,GAAsB6C,EAACM,EAAAA,CAAaC,aAAcxC,EAAoByC,SAAUxC,IAGzGgC,EAACC,MAAAA,CAAI5C,QAASA,EAAS6C,UAAW,iCAAkCO,IAAKhD,IAGrF"}
@@ -1 +1 @@
1
- {"version":3,"file":"InstantPaymentMethods.js","sources":["../../../../../../src/components/Dropin/components/PaymentMethod/InstantPaymentMethods.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport UIElement from '../../../internal/UIElement/UIElement';\n\ninterface InstantPaymentMethodsProps {\n paymentMethods: UIElement[];\n}\n\nfunction InstantPaymentMethods({ paymentMethods }: InstantPaymentMethodsProps) {\n return (\n <Fragment>\n <ul className=\"adyen-checkout__instant-payment-methods-list\">\n {paymentMethods.map(pm => (\n <li key={pm.type}>{pm.render()}</li>\n ))}\n </ul>\n </Fragment>\n );\n}\n\nexport default InstantPaymentMethods;\n"],"names":["InstantPaymentMethods","paymentMethods","h","Fragment","ul","className","map","pm","li","key","type","render"],"mappings":"yFAOA,SAASA,GAAsBC,eAAEA,IAC7B,OACIC,EAACC,OACGD,EAACE,KAAAA,CAAGC,UAAU,gDACTJ,EAAeK,KAAIC,GAChBL,EAACM,KAAAA,CAAGC,IAAKF,EAAGG,MAAOH,EAAGI,aAK1C"}
1
+ {"version":3,"file":"InstantPaymentMethods.js","sources":["../../../../../../src/components/Dropin/components/PaymentMethod/InstantPaymentMethods.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport UIElement from '../../../internal/UIElement/UIElement';\nimport './InstantPaymentMethods.scss';\n\ninterface InstantPaymentMethodsProps {\n paymentMethods: UIElement[];\n}\n\nfunction InstantPaymentMethods({ paymentMethods }: InstantPaymentMethodsProps) {\n return (\n <Fragment>\n <ul className=\"adyen-checkout__instant-payment-methods-list\">\n {paymentMethods.map(pm => (\n <li key={pm.type}>{pm.render()}</li>\n ))}\n </ul>\n </Fragment>\n );\n}\n\nexport default InstantPaymentMethods;\n"],"names":["InstantPaymentMethods","paymentMethods","h","Fragment","ul","className","map","pm","li","key","type","render"],"mappings":"yFAQA,SAASA,GAAsBC,eAAEA,IAC7B,OACIC,EAACC,OACGD,EAACE,KAAAA,CAAGC,UAAU,gDACTJ,EAAeK,KAAIC,GAChBL,EAACM,KAAAA,CAAGC,IAAKF,EAAGG,MAAOH,EAAGI,aAK1C"}
@@ -1,2 +1,2 @@
1
- import{Component as t,createElement as e}from"../../../external/preact/dist/preact.js";class o extends t{paywithgoogleWrapper;static defaultProps={buttonColor:"default",buttonType:"long",buttonSizeMode:"static"};clicked=!1;handleClick=t=>{t.preventDefault(),t.stopPropagation(),this.clicked||(this.props.onClick(t),this.clicked=!0,setTimeout((()=>{this.clicked=!1}),300))};componentDidMount(){const{buttonColor:t,buttonType:e,buttonLocale:o,buttonSizeMode:n,buttonRootNode:a,paymentsClient:i}=this.props;i.then((i=>i.createButton({onClick:this.handleClick,buttonType:e,buttonColor:t,buttonLocale:o,buttonSizeMode:n,buttonRootNode:a}))).then((t=>{this.paywithgoogleWrapper.appendChild(t)}))}render(){return e("span",{className:"adyen-checkout__paywithgoogle",ref:t=>{this.paywithgoogleWrapper=t}})}}export{o as default};
1
+ import{createElement as t}from"../../../external/preact/dist/preact.js";import{useRef as o,useEffect as e}from"../../../external/preact/hooks/dist/hooks.js";const n=n=>{const a=o(void 0);return e((()=>{const{onClick:t,buttonColor:o,buttonType:e,buttonLocale:u,buttonSizeMode:r,buttonRootNode:c,paymentsClient:s}=n;s.then((n=>n.createButton({onClick:t,buttonType:e,buttonColor:o,buttonLocale:u,buttonSizeMode:r,buttonRootNode:c}))).then((t=>{a.current&&a.current.appendChild(t)}))}),[n.buttonColor,n.buttonType,n.buttonLocale,n.buttonSizeMode,n.buttonRootNode,n.paymentsClient]),t("div",{"data-testid":"googlepay-button-container",className:"adyen-checkout__paywithgoogle",ref:a})};export{n as default};
2
2
  //# sourceMappingURL=GooglePayButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GooglePayButton.js","sources":["../../../../../src/components/GooglePay/components/GooglePayButton.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport './GooglePayButton.scss';\n\ninterface GooglePayButtonProps {\n buttonColor: google.payments.api.ButtonColor;\n buttonType: google.payments.api.ButtonType;\n buttonSizeMode: google.payments.api.ButtonSizeMode;\n buttonLocale: string;\n buttonRootNode?: HTMLDocument | ShadowRoot;\n paymentsClient: Promise<google.payments.api.PaymentsClient>;\n onClick: (e: Event) => void;\n}\n\nclass GooglePayButton extends Component<GooglePayButtonProps> {\n public paywithgoogleWrapper;\n\n public static defaultProps = {\n buttonColor: 'default', // default (black), black, white\n buttonType: 'long', // long, short\n buttonSizeMode: 'static' // long, short\n };\n private clicked = false;\n\n private handleClick = e => {\n e.preventDefault();\n e.stopPropagation();\n\n if (!this.clicked) {\n this.props.onClick(e);\n this.clicked = true;\n\n setTimeout(() => {\n this.clicked = false;\n }, 300);\n }\n };\n\n componentDidMount() {\n const { buttonColor, buttonType, buttonLocale, buttonSizeMode, buttonRootNode, paymentsClient } = this.props;\n\n paymentsClient\n .then(client =>\n client.createButton({\n onClick: this.handleClick,\n buttonType,\n buttonColor,\n buttonLocale,\n buttonSizeMode,\n buttonRootNode\n })\n )\n .then(googlePayButton => {\n this.paywithgoogleWrapper.appendChild(googlePayButton);\n });\n }\n\n render() {\n return (\n <span\n className={'adyen-checkout__paywithgoogle'}\n ref={ref => {\n this.paywithgoogleWrapper = ref;\n }}\n />\n );\n }\n}\n\nexport default GooglePayButton;\n"],"names":["GooglePayButton","Component","paywithgoogleWrapper","static","buttonColor","buttonType","buttonSizeMode","clicked","handleClick","e","preventDefault","stopPropagation","this","props","onClick","setTimeout","componentDidMount","buttonLocale","buttonRootNode","paymentsClient","then","client","createButton","googlePayButton","appendChild","render","h","span","className","ref"],"mappings":"uFAaA,MAAMA,UAAwBC,EACnBC,qBAEPC,oBAA6B,CACzBC,YAAa,UACbC,WAAY,OACZC,eAAgB,UAEZC,SAAU,EAEVC,YAAcC,IAClBA,EAAEC,iBACFD,EAAEE,kBAEGC,KAAKL,UACNK,KAAKC,MAAMC,QAAQL,GACnBG,KAAKL,SAAU,EAEfQ,YAAW,KACPH,KAAKL,SAAU,CAAA,GAChB,KACP,EAGJS,iBAAAA,GACI,MAAMZ,YAAEA,EAAWC,WAAEA,EAAUY,aAAEA,EAAYX,eAAEA,EAAcY,eAAEA,EAAcC,eAAEA,GAAmBP,KAAKC,MAEvGM,EACKC,MAAKC,GACFA,EAAOC,aAAa,CAChBR,QAASF,KAAKJ,YACdH,aACAD,cACAa,eACAX,iBACAY,qBAGPE,MAAKG,IACFX,KAAKV,qBAAqBsB,YAAYD,EAAAA,GAElD,CAEAE,MAAAA,GACI,OACIC,EAACC,OAAAA,CACGC,UAAW,gCACXC,IAAKA,IACDjB,KAAKV,qBAAuB2B,CAAAA,GAI5C"}
1
+ {"version":3,"file":"GooglePayButton.js","sources":["../../../../../src/components/GooglePay/components/GooglePayButton.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useRef } from 'preact/hooks';\nimport './GooglePayButton.scss';\n\ninterface GooglePayButtonProps {\n buttonColor: google.payments.api.ButtonColor;\n buttonType: google.payments.api.ButtonType;\n buttonSizeMode: google.payments.api.ButtonSizeMode;\n buttonLocale: string;\n buttonRootNode?: HTMLDocument | ShadowRoot;\n paymentsClient: Promise<google.payments.api.PaymentsClient>;\n onClick: (e: Event) => void;\n}\n\nconst GooglePayButton = (props: GooglePayButtonProps) => {\n const googlePayWrapperRef = useRef<HTMLDivElement | undefined>(undefined);\n\n useEffect(() => {\n const { onClick, buttonColor, buttonType, buttonLocale, buttonSizeMode, buttonRootNode, paymentsClient } = props;\n\n paymentsClient\n .then(client =>\n client.createButton({\n onClick,\n buttonType,\n buttonColor,\n buttonLocale,\n buttonSizeMode,\n buttonRootNode\n })\n )\n .then(googlePayButton => {\n if (googlePayWrapperRef.current) {\n googlePayWrapperRef.current.appendChild(googlePayButton);\n }\n });\n }, [props.buttonColor, props.buttonType, props.buttonLocale, props.buttonSizeMode, props.buttonRootNode, props.paymentsClient]);\n\n return <div data-testid=\"googlepay-button-container\" className={'adyen-checkout__paywithgoogle'} ref={googlePayWrapperRef} />;\n};\n\nexport default GooglePayButton;\n"],"names":["GooglePayButton","props","googlePayWrapperRef","useRef","undefined","useEffect","onClick","buttonColor","buttonType","buttonLocale","buttonSizeMode","buttonRootNode","paymentsClient","then","client","createButton","googlePayButton","current","appendChild","h","div","data-testid","className","ref"],"mappings":"6JAcA,MAAMA,EAAmBC,IACrB,MAAMC,EAAsBC,OAAmCC,GAuB/D,OArBAC,GAAU,KACN,MAAMC,QAAEA,EAAOC,YAAEA,EAAWC,WAAEA,EAAUC,aAAEA,EAAYC,eAAEA,EAAcC,eAAEA,EAAcC,eAAEA,GAAmBX,EAE3GW,EACKC,MAAKC,GACFA,EAAOC,aAAa,CAChBT,UACAE,aACAD,cACAE,eACAC,iBACAC,qBAGPE,MAAKG,IACEd,EAAoBe,SACpBf,EAAoBe,QAAQC,YAAYF,EAC5C,GACJ,GACL,CAACf,EAAMM,YAAaN,EAAMO,WAAYP,EAAMQ,aAAcR,EAAMS,eAAgBT,EAAMU,eAAgBV,EAAMW,iBAExGO,EAACC,MAAAA,CAAIC,cAAY,6BAA6BC,UAAW,gCAAiCC,IAAKrB"}
@@ -1,2 +1,2 @@
1
- const e={isExpress:!1,existingPaymentMethodRequired:!1,buttonColor:"default",buttonType:"long",buttonSizeMode:void 0,configuration:{gatewayMerchantId:"",merchantId:"",merchantName:""},amount:{value:0,currency:"USD"},totalPriceStatus:"FINAL",onClick:e=>e(),allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:["AMEX","DISCOVER","JCB","MASTERCARD","VISA"],allowCreditCards:!0,allowPrepaidCards:!0,billingAddressRequired:!1,billingAddressParameters:void 0,assuranceDetailsRequired:!1,emailRequired:!1,shippingAddressRequired:!1,shippingAddressParameters:void 0,shippingOptionRequired:!1,shippingOptionParameters:void 0,callbackIntents:[]};export{e as default};
1
+ const e={isExpress:!1,existingPaymentMethodRequired:!1,buttonColor:"default",buttonType:"buy",buttonSizeMode:"fill",configuration:{gatewayMerchantId:"",merchantId:"",merchantName:""},amount:{value:0,currency:"USD"},totalPriceStatus:"FINAL",onClick:e=>e(),allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:["AMEX","DISCOVER","JCB","MASTERCARD","VISA"],allowCreditCards:!0,allowPrepaidCards:!0,billingAddressRequired:!1,billingAddressParameters:void 0,assuranceDetailsRequired:!1,emailRequired:!1,shippingAddressRequired:!1,shippingAddressParameters:void 0,shippingOptionRequired:!1,shippingOptionParameters:void 0,callbackIntents:[]};export{e as default};
2
2
  //# sourceMappingURL=defaultProps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"defaultProps.js","sources":["../../../../src/components/GooglePay/defaultProps.ts"],"sourcesContent":["import { GooglePayConfiguration } from './types';\n\nconst defaultProps: GooglePayConfiguration = {\n isExpress: false,\n\n // isReadyToPayRequest\n existingPaymentMethodRequired: false,\n\n // ButtonOptions\n // https://developers.google.com/pay/api/web/reference/object#ButtonOptions\n buttonColor: 'default' as google.payments.api.ButtonColor, // default/black/white\n buttonType: 'long' as google.payments.api.ButtonType, // long/short\n buttonSizeMode: undefined,\n\n // PaymentDataRequest\n configuration: {\n // Adyen's merchant account\n gatewayMerchantId: '', // E.g TestMerchant\n\n // https://developers.google.com/pay/api/web/reference/object#MerchantInfo\n merchantId: '', // E.g 039484839309\n merchantName: '' // E.g Example Merchant,\n },\n\n // Payment\n amount: {\n value: 0,\n currency: 'USD'\n },\n\n totalPriceStatus: 'FINAL' as google.payments.api.TotalPriceStatus,\n\n // Callbacks\n onClick: resolve => resolve(),\n\n // CardParameters\n // https://developers.google.com/pay/api/web/reference/object#CardParameters\n allowedAuthMethods: ['PAN_ONLY', 'CRYPTOGRAM_3DS'] as google.payments.api.CardAuthMethod[],\n allowedCardNetworks: ['AMEX', 'DISCOVER', 'JCB', 'MASTERCARD', 'VISA'] as google.payments.api.CardNetwork[],\n allowCreditCards: true, // Set to false if you don't support credit cards.\n allowPrepaidCards: true, // Set to false if you don't support prepaid cards.\n billingAddressRequired: false, // A billing address should only be requested if it's required to process the transaction.\n billingAddressParameters: undefined, // The expected fields returned if billingAddressRequired is set to true.\n assuranceDetailsRequired: false, // https://developers.google.com/pay/api/web/reference/response-objects#assurance-details-specifications\n\n emailRequired: false,\n shippingAddressRequired: false,\n shippingAddressParameters: undefined, // https://developers.google.com/pay/api/web/reference/object#ShippingAddressParameters\n shippingOptionRequired: false,\n shippingOptionParameters: undefined,\n callbackIntents: []\n};\n\nexport default defaultProps;\n"],"names":["defaultProps","isExpress","existingPaymentMethodRequired","buttonColor","buttonType","buttonSizeMode","undefined","configuration","gatewayMerchantId","merchantId","merchantName","amount","value","currency","totalPriceStatus","onClick","resolve","allowedAuthMethods","allowedCardNetworks","allowCreditCards","allowPrepaidCards","billingAddressRequired","billingAddressParameters","assuranceDetailsRequired","emailRequired","shippingAddressRequired","shippingAddressParameters","shippingOptionRequired","shippingOptionParameters","callbackIntents"],"mappings":"AAEA,MAAMA,EAAuC,CACzCC,WAAW,EAGXC,+BAA+B,EAI/BC,YAAa,UACbC,WAAY,OACZC,oBAAgBC,EAGhBC,cAAe,CAEXC,kBAAmB,GAGnBC,WAAY,GACZC,aAAc,IAIlBC,OAAQ,CACJC,MAAO,EACPC,SAAU,OAGdC,iBAAkB,QAGlBC,QAASC,GAAWA,IAIpBC,mBAAoB,CAAC,WAAY,kBACjCC,oBAAqB,CAAC,OAAQ,WAAY,MAAO,aAAc,QAC/DC,kBAAkB,EAClBC,mBAAmB,EACnBC,wBAAwB,EACxBC,8BAA0BhB,EAC1BiB,0BAA0B,EAE1BC,eAAe,EACfC,yBAAyB,EACzBC,+BAA2BpB,EAC3BqB,wBAAwB,EACxBC,8BAA0BtB,EAC1BuB,gBAAiB"}
1
+ {"version":3,"file":"defaultProps.js","sources":["../../../../src/components/GooglePay/defaultProps.ts"],"sourcesContent":["import { GooglePayConfiguration } from './types';\n\nconst defaultProps: GooglePayConfiguration = {\n isExpress: false,\n\n // isReadyToPayRequest\n existingPaymentMethodRequired: false,\n\n // ButtonOptions\n // https://developers.google.com/pay/api/web/reference/object#ButtonOptions\n buttonColor: 'default',\n buttonType: 'buy',\n buttonSizeMode: 'fill',\n\n // PaymentDataRequest\n configuration: {\n // Adyen's merchant account\n gatewayMerchantId: '', // E.g TestMerchant\n\n // https://developers.google.com/pay/api/web/reference/object#MerchantInfo\n merchantId: '', // E.g 039484839309\n merchantName: '' // E.g Example Merchant,\n },\n\n // Payment\n amount: {\n value: 0,\n currency: 'USD'\n },\n\n totalPriceStatus: 'FINAL',\n\n // Callbacks\n onClick: resolve => resolve(),\n\n // CardParameters\n // https://developers.google.com/pay/api/web/reference/object#CardParameters\n allowedAuthMethods: ['PAN_ONLY', 'CRYPTOGRAM_3DS'] as google.payments.api.CardAuthMethod[],\n allowedCardNetworks: ['AMEX', 'DISCOVER', 'JCB', 'MASTERCARD', 'VISA'] as google.payments.api.CardNetwork[],\n allowCreditCards: true, // Set to false if you don't support credit cards.\n allowPrepaidCards: true, // Set to false if you don't support prepaid cards.\n billingAddressRequired: false, // A billing address should only be requested if it's required to process the transaction.\n billingAddressParameters: undefined, // The expected fields returned if billingAddressRequired is set to true.\n assuranceDetailsRequired: false, // https://developers.google.com/pay/api/web/reference/response-objects#assurance-details-specifications\n\n emailRequired: false,\n shippingAddressRequired: false,\n shippingAddressParameters: undefined, // https://developers.google.com/pay/api/web/reference/object#ShippingAddressParameters\n shippingOptionRequired: false,\n shippingOptionParameters: undefined,\n callbackIntents: []\n};\n\nexport default defaultProps;\n"],"names":["defaultProps","isExpress","existingPaymentMethodRequired","buttonColor","buttonType","buttonSizeMode","configuration","gatewayMerchantId","merchantId","merchantName","amount","value","currency","totalPriceStatus","onClick","resolve","allowedAuthMethods","allowedCardNetworks","allowCreditCards","allowPrepaidCards","billingAddressRequired","billingAddressParameters","undefined","assuranceDetailsRequired","emailRequired","shippingAddressRequired","shippingAddressParameters","shippingOptionRequired","shippingOptionParameters","callbackIntents"],"mappings":"AAEA,MAAMA,EAAuC,CACzCC,WAAW,EAGXC,+BAA+B,EAI/BC,YAAa,UACbC,WAAY,MACZC,eAAgB,OAGhBC,cAAe,CAEXC,kBAAmB,GAGnBC,WAAY,GACZC,aAAc,IAIlBC,OAAQ,CACJC,MAAO,EACPC,SAAU,OAGdC,iBAAkB,QAGlBC,QAASC,GAAWA,IAIpBC,mBAAoB,CAAC,WAAY,kBACjCC,oBAAqB,CAAC,OAAQ,WAAY,MAAO,aAAc,QAC/DC,kBAAkB,EAClBC,mBAAmB,EACnBC,wBAAwB,EACxBC,8BAA0BC,EAC1BC,0BAA0B,EAE1BC,eAAe,EACfC,yBAAyB,EACzBC,+BAA2BJ,EAC3BK,wBAAwB,EACxBC,8BAA0BN,EAC1BO,gBAAiB"}
@@ -1,2 +1,2 @@
1
- import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import r from"../internal/PersonalDetails/PersonalDetails.js";import{CoreProvider as s}from"../../core/Context/CoreProvider.js";import{TxVariants as o}from"../tx-variants.js";import n from"../internal/FormInstruction/FormInstruction.js";class i extends e{static type=o.personal_details;static defaultProps={showFormInstruction:!0};get data(){return this.state.data}get isValid(){return!!this.state.isValid}render(){return t(s,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},this.props.showFormInstruction&&t(n,null),t(r,{setComponentRef:this.setComponentRef,...this.props,onChange:this.setState,...!1}))}}export{i as PersonalDetailsElement,i as default};
1
+ import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import r from"../internal/PersonalDetails/PersonalDetails.js";import{CoreProvider as s}from"../../core/Context/CoreProvider.js";import{TxVariants as o}from"../tx-variants.js";import n from"../internal/FormInstruction/FormInstruction.js";class i extends e{static type=o.personal_details;static defaultProps={showFormInstruction:!0};get data(){return this.state.data}get isValid(){return!!this.state.isValid}render(){return t(s,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},this.props.showFormInstruction&&t(n,null),t(r,{setComponentRef:this.setComponentRef,...this.props,onChange:this.setState}))}}export{i as PersonalDetailsElement,i as default};
2
2
  //# sourceMappingURL=PersonalDetails.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PersonalDetails.js","sources":["../../../../src/components/PersonalDetails/PersonalDetails.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport PersonalDetails from '../internal/PersonalDetails';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport { TxVariants } from '../tx-variants';\nimport FormInstruction from '../internal/FormInstruction';\nimport { UIElementProps } from '../internal/UIElement/types';\n\ninterface PersonalDetailsConfiguration extends UIElementProps {\n showFormInstruction?: boolean;\n}\n\nexport class PersonalDetailsElement extends UIElement<PersonalDetailsConfiguration> {\n public static type = TxVariants.personal_details;\n\n protected static defaultProps = {\n showFormInstruction: true\n };\n\n get data() {\n return this.state.data;\n }\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n {this.props.showFormInstruction && <FormInstruction />}\n <PersonalDetails\n setComponentRef={this.setComponentRef}\n {...this.props}\n onChange={this.setState}\n {...(process.env.NODE_ENV !== 'production' && { payButton: this.payButton })}\n />\n </CoreProvider>\n );\n }\n}\n\nexport default PersonalDetailsElement;\n"],"names":["PersonalDetailsElement","UIElement","static","TxVariants","personal_details","showFormInstruction","data","this","state","isValid","render","h","CoreProvider","i18n","props","loadingContext","resources","FormInstruction","PersonalDetails","setComponentRef","onChange","setState"],"mappings":"iXAYO,MAAMA,UAA+BC,EACxCC,YAAqBC,EAAWC,iBAEhCF,oBAAgC,CAC5BG,qBAAqB,GAGzB,QAAIC,GACA,OAAOC,KAAKC,MAAMF,IACtB,CAEA,WAAIG,GACA,QAASF,KAAKC,MAAMC,OACxB,CAEAC,MAAAA,GACI,OACIC,EAACC,EAAAA,CAAaC,KAAMN,KAAKO,MAAMD,KAAME,eAAgBR,KAAKO,MAAMC,eAAgBC,UAAWT,KAAKS,WAC3FT,KAAKO,MAAMT,qBAAuBM,EAACM,QACpCN,EAACO,EAAAA,CACGC,gBAAiBZ,KAAKY,mBAClBZ,KAAKO,MACTM,SAAUb,KAAKc,aACV,IAIrB"}
1
+ {"version":3,"file":"PersonalDetails.js","sources":["../../../../src/components/PersonalDetails/PersonalDetails.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport PersonalDetails from '../internal/PersonalDetails';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport { TxVariants } from '../tx-variants';\nimport FormInstruction from '../internal/FormInstruction';\nimport { UIElementProps } from '../internal/UIElement/types';\n\ninterface PersonalDetailsConfiguration extends UIElementProps {\n showFormInstruction?: boolean;\n}\n\nexport class PersonalDetailsElement extends UIElement<PersonalDetailsConfiguration> {\n public static type = TxVariants.personal_details;\n\n protected static defaultProps = {\n showFormInstruction: true\n };\n\n get data() {\n return this.state.data;\n }\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n {this.props.showFormInstruction && <FormInstruction />}\n <PersonalDetails\n setComponentRef={this.setComponentRef}\n {...this.props}\n onChange={this.setState}\n {...(process.env.NODE_ENV !== 'production' && { payButton: this.payButton })}\n />\n </CoreProvider>\n );\n }\n}\n\nexport default PersonalDetailsElement;\n"],"names":["PersonalDetailsElement","UIElement","static","TxVariants","personal_details","showFormInstruction","data","this","state","isValid","render","h","CoreProvider","i18n","props","loadingContext","resources","FormInstruction","PersonalDetails","setComponentRef","onChange","setState"],"mappings":"iXAYO,MAAMA,UAA+BC,EACxCC,YAAqBC,EAAWC,iBAEhCF,oBAAgC,CAC5BG,qBAAqB,GAGzB,QAAIC,GACA,OAAOC,KAAKC,MAAMF,IACtB,CAEA,WAAIG,GACA,QAASF,KAAKC,MAAMC,OACxB,CAEAC,MAAAA,GACI,OACIC,EAACC,EAAAA,CAAaC,KAAMN,KAAKO,MAAMD,KAAME,eAAgBR,KAAKO,MAAMC,eAAgBC,UAAWT,KAAKS,WAC3FT,KAAKO,MAAMT,qBAAuBM,EAACM,QACpCN,EAACO,EAAAA,CACGC,gBAAiBZ,KAAKY,mBAClBZ,KAAKO,MACTM,SAAUb,KAAKc,WAK/B"}
@@ -1,2 +1,2 @@
1
- import{createElement as e,Fragment as t}from"../../../external/preact/dist/preact.js";import{useRef as s,useMemo as o,useState as r,useCallback as a,useEffect as n}from"../../../external/preact/hooks/dist/hooks.js";import i from"../FormFields/Fieldset/Fieldset.js";import l from"./components/ReadOnlyAddress.js";import{getAddressValidationRules as d}from"./validate.js";import{addressFormatters as c,countrySpecificFormatters as u}from"./validate.formats.js";import m from"./components/FieldContainer.js";import p from"../../../utils/useForm/useForm.js";import f from"./Specifications.js";import{FALLBACK_VALUE as y,ADDRESS_SCHEMA as F}from"./constants.js";import{getMaxLengthByFieldAndCountry as h}from"../../../utils/validator-utils.js";import{useCoreContext as C}from"../../../core/Context/CoreProvider.js";import g from"./components/AddressSearch.js";function A(A){const{i18n:v}=C(),{label:b="",requiredFields:j,visibility:x,iOSFocusedField:S=null,showContextualElement:k}=A,M=s({});Object.keys(M.current).length||A.setComponentRef?.(M.current);const O=o((()=>new f(A.specifications)),[A.specifications]),w=O.getAddressSchemaForCountryFlat(A.countryCode).filter((e=>j.includes(e))),[D,E]=r(!1),[B,N]=r(!1),[P,L]=r(""),R=!!A.onAddressLookup,V=!A.onAddressLookup||(D||B),{data:q,errors:H,valid:T,isValid:_,handleChangeFor:I,triggerValidation:$,setData:z}=p({schema:w,defaultData:A.data,rules:{...d(O),...A.validationRules},formatters:c}),G=a((e=>{F.forEach((t=>{const s=e[t];null!=s&&z(t,String(s))})),$(),E(!0)}),[E,$,z]),J=a((()=>{N(!0)}),[]);M.current.showValidation=()=>{$(),L(!R||V||_?"":v.get("address.errors.incomplete"))};const K=w.filter((e=>!S||e===S));if(n((()=>{const e=O.countryHasDataset(q.country)?"":y,t={...q,stateOrProvince:e};j.forEach((e=>{I(e,"input")(t[e]??"")})),t.postalCode&&I("postalCode","blur")(q.postalCode)}),[q.country]),n((()=>{const e=j.includes("stateOrProvince"),t=q.country&&O.countryHasDataset(q.country),s=e&&t,o=q.stateOrProvince||(s?"":y);I("stateOrProvince","input")(o)}),[]),n((()=>{const e=O.getOptionalFieldsForCountry(q.country),t=F.reduce(((t,s)=>{const o=e.includes(s),r=j.includes(s),a=q[s],n=A.data[s],i=o&&!a||!r?r||a||!n?y:n:a;return i?.length&&(t[s]=i),t}),{});A.onChange({data:t,valid:T,errors:H,isValid:_})}),[q,T,H,_]),"hidden"===x)return null;if("readOnly"===x)return e(l,{data:q,label:b});const Q=(t,{classNameModifiers:s=[]})=>j.includes(t)?e(m,{key:t,allowedCountries:A.allowedCountries,classNameModifiers:[...s,t],data:q,errors:H,valid:T,fieldName:t,onInput:I(t,"input"),onBlur:I(t,"blur"),onDropdownChange:I(t,"blur"),specifications:O,maxLength:h(u,t,q.country,!0),trimOnBlur:!0,disabled:!K.includes(t),onFieldFocusAnalytics:A.onFieldFocusAnalytics,onFieldBlurAnalytics:A.onFieldBlurAnalytics}):null,U=O.getAddressSchemaForCountry(q.country);return e(t,null,e(i,{classNameModifiers:[b||"address"],label:b},R&&e(g,{onAddressLookup:A.onAddressLookup,onAddressSelected:A.onAddressSelected,onSelect:G,onManualAddress:J,externalErrorMessage:P,hideManualButton:V,showContextualElement:k,contextualText:v.get("address.search.contextualText"),addressSearchDebounceMs:A.addressSearchDebounceMs}),V&&e(t,null,U.map((t=>t instanceof Array?e("div",{className:"adyen-checkout__field-group"},t.map((([e,t])=>Q(e,{classNameModifiers:[`col-${t}`]})))):Q(t,{}))))))}A.defaultProps={countryCode:null,validationRules:null,data:{},onChange:()=>{},visibility:"editable",requiredFields:F,specifications:{},onFieldFocusAnalytics:()=>{},onFieldBlurAnalytics:()=>{}};export{A as default};
1
+ import{createElement as e,Fragment as t}from"../../../external/preact/dist/preact.js";import{useRef as s,useMemo as o,useState as r,useCallback as a,useEffect as n}from"../../../external/preact/hooks/dist/hooks.js";import i from"../FormFields/Fieldset/Fieldset.js";import l from"./components/ReadOnlyAddress.js";import{getAddressValidationRules as d}from"./validate.js";import{addressFormatters as c,countrySpecificFormatters as u}from"./validate.formats.js";import m from"./components/FieldContainer.js";import p from"../../../utils/useForm/useForm.js";import f from"./Specifications.js";import{FALLBACK_VALUE as y,ADDRESS_SCHEMA as F}from"./constants.js";import{getMaxLengthByFieldAndCountry as h}from"../../../utils/validator-utils.js";import{useCoreContext as C}from"../../../core/Context/CoreProvider.js";import g from"./components/AddressSearch.js";function A(A){const{i18n:v}=C(),{label:b="",requiredFields:j,visibility:x,iOSFocusedField:S=null,showContextualElement:k}=A,M=s({});Object.keys(M.current).length||A.setComponentRef?.(M.current);const O=o((()=>new f(A.specifications)),[A.specifications]),w=O.getAddressSchemaForCountryFlat(A.countryCode).filter((e=>j.includes(e))),[D,E]=r(!1),[B,N]=r(!1),[P,L]=r(""),R=!!A.onAddressLookup,V=!A.onAddressLookup||(D||B),{data:q,errors:H,valid:T,isValid:_,handleChangeFor:I,triggerValidation:$,setData:z}=p({schema:w,defaultData:A.data,rules:{...d(O),...A.validationRules},formatters:c}),G=a((e=>{F.forEach((t=>{const s=e[t];null!=s&&z(t,String(s))})),$(),E(!0)}),[E,$,z]),J=a((()=>{N(!0)}),[]);M.current.showValidation=()=>{$(),L(!R||V||_?"":v.get("address.errors.incomplete"))};const K=w.filter((e=>!S||e===S));if(n((()=>{const e=O.countryHasDataset(q.country)?"":y,t={...q,stateOrProvince:e};j.forEach((e=>{I(e,"input")(t[e]??"")})),t.postalCode&&I("postalCode","blur")(q.postalCode)}),[q.country]),n((()=>{const e=j.includes("stateOrProvince"),t=q.country&&O.countryHasDataset(q.country),s=e&&t,o=q.stateOrProvince||(s?"":y);I("stateOrProvince","input")(o)}),[]),n((()=>{const e=O.getOptionalFieldsForCountry(q.country),t=F.reduce(((t,s)=>{const o=e.includes(s),r=j.includes(s),a=q[s],n=A.data[s],i=o&&!a||!r?r||a||!n?y:n:a;return i?.length&&(t[s]=i),t}),{});A.onChange({data:t,valid:T,errors:H,isValid:_})}),[q,T,H,_]),"hidden"===x)return null;if("readOnly"===x)return e(l,{data:q,label:b});const Q=(t,{classNameModifiers:s=[]})=>j.includes(t)?e(m,{key:t,allowedCountries:A.allowedCountries,classNameModifiers:[...s,t],data:q,errors:H,valid:T,fieldName:t,onInput:I(t,"input"),onBlur:I(t,"blur"),onDropdownChange:I(t,"blur"),specifications:O,maxLength:h(u,t,q.country),trimOnBlur:!0,disabled:!K.includes(t),onFieldFocusAnalytics:A.onFieldFocusAnalytics,onFieldBlurAnalytics:A.onFieldBlurAnalytics}):null,U=O.getAddressSchemaForCountry(q.country);return e(t,null,e(i,{classNameModifiers:[b||"address"],label:b},R&&e(g,{onAddressLookup:A.onAddressLookup,onAddressSelected:A.onAddressSelected,onSelect:G,onManualAddress:J,externalErrorMessage:P,hideManualButton:V,showContextualElement:k,contextualText:v.get("address.search.contextualText"),addressSearchDebounceMs:A.addressSearchDebounceMs}),V&&e(t,null,U.map((t=>t instanceof Array?e("div",{className:"adyen-checkout__field-group"},t.map((([e,t])=>Q(e,{classNameModifiers:[`col-${t}`]})))):Q(t,{}))))))}A.defaultProps={countryCode:null,validationRules:null,data:{},onChange:()=>{},visibility:"editable",requiredFields:F,specifications:{},onFieldFocusAnalytics:()=>{},onFieldBlurAnalytics:()=>{}};export{A as default};
2
2
  //# sourceMappingURL=Address.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Address.js","sources":["../../../../../src/components/internal/Address/Address.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'preact/hooks';\nimport Fieldset from '../FormFields/Fieldset';\nimport ReadOnlyAddress from './components/ReadOnlyAddress';\nimport { getAddressValidationRules } from './validate';\nimport { addressFormatters, countrySpecificFormatters } from './validate.formats';\nimport { AddressProps } from './types';\nimport { AddressData } from '../../../types/global-types';\nimport FieldContainer from './components/FieldContainer';\nimport useForm from '../../../utils/useForm';\nimport Specifications from './Specifications';\nimport { ADDRESS_SCHEMA, FALLBACK_VALUE } from './constants';\nimport { getMaxLengthByFieldAndCountry } from '../../../utils/validator-utils';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport AddressSearch from './components/AddressSearch';\nimport { ComponentMethodsRef } from '../UIElement/types';\n\nexport default function Address(props: AddressProps) {\n const { i18n } = useCoreContext();\n\n const { label = '', requiredFields, visibility, iOSFocusedField = null, showContextualElement } = props;\n\n /** An object by which to expose 'public' members to the parent UIElement */\n const addressRef = useRef<ComponentMethodsRef>({});\n // Just call once\n if (!Object.keys(addressRef.current).length) {\n props.setComponentRef?.(addressRef.current);\n }\n\n const specifications = useMemo(() => new Specifications(props.specifications), [props.specifications]);\n\n const requiredFieldsSchema = specifications.getAddressSchemaForCountryFlat(props.countryCode).filter(field => requiredFields.includes(field));\n\n const [hasSelectedAddress, setHasSelectedAddress] = useState(false);\n\n const [useManualAddress, setUseManualAddress] = useState(false);\n\n const [searchErrorMessage, setSearchErrorMessage] = useState('');\n\n const showAddressSearch = !!props.onAddressLookup;\n\n const showAddressFields = props.onAddressLookup ? hasSelectedAddress || useManualAddress : true;\n\n const { data, errors, valid, isValid, handleChangeFor, triggerValidation, setData } = useForm<AddressData>({\n schema: requiredFieldsSchema,\n defaultData: props.data,\n // Ensure any passed validation rules are merged with the default ones\n rules: { ...getAddressValidationRules(specifications), ...props.validationRules },\n formatters: addressFormatters\n });\n\n const setSearchData = useCallback(\n (selectedAddress: AddressData) => {\n const propsKeysToProcess = ADDRESS_SCHEMA;\n propsKeysToProcess.forEach(propKey => {\n // Make sure the data provided by the merchant is always strings\n const providedValue = selectedAddress[propKey];\n if (providedValue === null || providedValue === undefined) return;\n // Cast everything to string\n setData(propKey, String(providedValue));\n });\n triggerValidation();\n setHasSelectedAddress(true);\n },\n [setHasSelectedAddress, triggerValidation, setData]\n );\n\n const onManualAddress = useCallback(() => {\n setUseManualAddress(true);\n }, []);\n\n // Expose method expected by (parent) Address.tsx\n addressRef.current.showValidation = () => {\n triggerValidation();\n if (showAddressSearch && !showAddressFields && !isValid) {\n setSearchErrorMessage(i18n.get('address.errors.incomplete'));\n } else {\n setSearchErrorMessage('');\n }\n };\n\n /**\n * For iOS: iOSFocusedField is the name of the element calling for other elements to be disabled\n * - so if it is set (meaning we are in iOS *and* an input has been focussed) only enable the field that corresponds to this element\n */\n const enabledFields: string[] = requiredFieldsSchema.filter(item => {\n return !iOSFocusedField ? true : item === iOSFocusedField;\n });\n\n /**\n * Effect that:\n * - Resets validation for all fields by triggering handleChangeFor(fieldName, 'input')\n * - Applies validation on postalCode field in case it has any value\n */\n useEffect((): void => {\n const stateOrProvince = specifications.countryHasDataset(data.country) ? '' : FALLBACK_VALUE;\n const newData = { ...data, stateOrProvince };\n\n requiredFields.forEach(fieldName => {\n handleChangeFor(fieldName, 'input')(newData[fieldName] ?? '');\n });\n\n if (newData.postalCode) {\n handleChangeFor('postalCode', 'blur')(data.postalCode);\n }\n }, [data.country]);\n\n /**\n * Set the value of 'stateOrProvince' during the initial render if\n * property is provided during the creation of the payment method\n */\n useEffect((): void => {\n const stateFieldIsRequired = requiredFields.includes('stateOrProvince');\n const countryHasStatesDataset = data.country && specifications.countryHasDataset(data.country);\n const addressShouldHaveState = stateFieldIsRequired && countryHasStatesDataset;\n const stateOrProvince = data.stateOrProvince || (addressShouldHaveState ? '' : FALLBACK_VALUE);\n\n handleChangeFor('stateOrProvince', 'input')(stateOrProvince);\n }, []);\n\n useEffect((): void => {\n const optionalFields = specifications.getOptionalFieldsForCountry(data.country);\n const processedData = ADDRESS_SCHEMA.reduce((acc, cur) => {\n const isOptional = optionalFields.includes(cur);\n const isRequired = requiredFields.includes(cur);\n const newValue = data[cur];\n const initialValue = props.data[cur];\n // recover default data values which are not requiredFields, or prefill with 'N/A'\n const fallbackValue = !isRequired && !newValue && !!initialValue ? initialValue : FALLBACK_VALUE;\n const value = (isOptional && !newValue) || !isRequired ? fallbackValue : newValue;\n if (value?.length) acc[cur] = value;\n return acc;\n }, {});\n\n props.onChange({ data: processedData, valid, errors, isValid });\n }, [data, valid, errors, isValid]);\n\n if (visibility === 'hidden') return null;\n if (visibility === 'readOnly') return <ReadOnlyAddress data={data} label={label} />;\n\n const getComponent = (fieldName: string, { classNameModifiers = [] }) => {\n if (!requiredFields.includes(fieldName)) return null;\n\n return (\n <FieldContainer\n key={fieldName}\n allowedCountries={props.allowedCountries}\n classNameModifiers={[...classNameModifiers, fieldName]}\n data={data}\n errors={errors}\n valid={valid}\n fieldName={fieldName}\n onInput={handleChangeFor(fieldName, 'input')}\n onBlur={handleChangeFor(fieldName, 'blur')}\n onDropdownChange={handleChangeFor(fieldName, 'blur')}\n specifications={specifications}\n maxLength={getMaxLengthByFieldAndCountry(countrySpecificFormatters, fieldName, data.country, true)}\n trimOnBlur={true}\n disabled={!enabledFields.includes(fieldName)}\n onFieldFocusAnalytics={props.onFieldFocusAnalytics}\n onFieldBlurAnalytics={props.onFieldBlurAnalytics}\n />\n );\n };\n\n const getWrapper = group => (\n <div className=\"adyen-checkout__field-group\">\n {group.map(([field, size]) => getComponent(field, { classNameModifiers: [`col-${size}`] }))}\n </div>\n );\n\n const addressSchema = specifications.getAddressSchemaForCountry(data.country);\n\n return (\n <Fragment>\n <Fieldset classNameModifiers={[label || 'address']} label={label}>\n {showAddressSearch && (\n <AddressSearch\n onAddressLookup={props.onAddressLookup}\n onAddressSelected={props.onAddressSelected}\n onSelect={setSearchData}\n onManualAddress={onManualAddress}\n externalErrorMessage={searchErrorMessage}\n hideManualButton={showAddressFields}\n showContextualElement={showContextualElement}\n contextualText={i18n.get('address.search.contextualText')}\n addressSearchDebounceMs={props.addressSearchDebounceMs}\n />\n )}\n {showAddressFields && (\n <Fragment>{addressSchema.map(field => (field instanceof Array ? getWrapper(field) : getComponent(field, {})))}</Fragment>\n )}\n </Fieldset>\n </Fragment>\n );\n}\n\nAddress.defaultProps = {\n countryCode: null,\n validationRules: null,\n data: {},\n onChange: () => {},\n visibility: 'editable',\n requiredFields: ADDRESS_SCHEMA,\n specifications: {},\n onFieldFocusAnalytics: () => {},\n onFieldBlurAnalytics: () => {}\n};\n"],"names":["Address","props","i18n","useCoreContext","label","requiredFields","visibility","iOSFocusedField","showContextualElement","addressRef","useRef","Object","keys","current","length","setComponentRef","specifications","useMemo","Specifications","requiredFieldsSchema","getAddressSchemaForCountryFlat","countryCode","filter","field","includes","hasSelectedAddress","setHasSelectedAddress","useState","useManualAddress","setUseManualAddress","searchErrorMessage","setSearchErrorMessage","showAddressSearch","onAddressLookup","showAddressFields","data","errors","valid","isValid","handleChangeFor","triggerValidation","setData","useForm","schema","defaultData","rules","getAddressValidationRules","validationRules","formatters","addressFormatters","setSearchData","useCallback","selectedAddress","ADDRESS_SCHEMA","forEach","propKey","providedValue","String","onManualAddress","showValidation","get","enabledFields","item","useEffect","stateOrProvince","countryHasDataset","country","FALLBACK_VALUE","newData","fieldName","postalCode","stateFieldIsRequired","countryHasStatesDataset","addressShouldHaveState","optionalFields","getOptionalFieldsForCountry","processedData","reduce","acc","cur","isOptional","isRequired","newValue","initialValue","value","onChange","h","ReadOnlyAddress","getComponent","classNameModifiers","FieldContainer","key","allowedCountries","onInput","onBlur","onDropdownChange","maxLength","getMaxLengthByFieldAndCountry","countrySpecificFormatters","trimOnBlur","disabled","onFieldFocusAnalytics","onFieldBlurAnalytics","addressSchema","getAddressSchemaForCountry","Fragment","Fieldset","AddressSearch","onAddressSelected","onSelect","externalErrorMessage","hideManualButton","contextualText","addressSearchDebounceMs","map","Array","div","className","size","defaultProps"],"mappings":"u1BAiBe,SAASA,EAAQC,GAC5B,MAAMC,KAAEA,GAASC,KAEXC,MAAEA,EAAQ,GAAEC,eAAEA,EAAcC,WAAEA,EAAUC,gBAAEA,EAAkB,KAAIC,sBAAEA,GAA0BP,EAG5FQ,EAAaC,EAA4B,CAAA,GAE1CC,OAAOC,KAAKH,EAAWI,SAASC,QACjCb,EAAMc,kBAAkBN,EAAWI,SAGvC,MAAMG,EAAiBC,GAAQ,IAAM,IAAIC,EAAejB,EAAMe,iBAAiB,CAACf,EAAMe,iBAEhFG,EAAuBH,EAAeI,+BAA+BnB,EAAMoB,aAAaC,QAAOC,GAASlB,EAAemB,SAASD,MAE/HE,EAAoBC,GAAyBC,GAAS,IAEtDC,EAAkBC,GAAuBF,GAAS,IAElDG,EAAoBC,GAAyBJ,EAAS,IAEvDK,IAAsB/B,EAAMgC,gBAE5BC,GAAoBjC,EAAMgC,kBAAkBR,GAAsBG,IAElEO,KAAEA,EAAIC,OAAEA,EAAMC,MAAEA,EAAKC,QAAEA,EAAOC,gBAAEA,EAAeC,kBAAEA,EAAiBC,QAAEA,GAAYC,EAAqB,CACvGC,OAAQxB,EACRyB,YAAa3C,EAAMkC,KAEnBU,MAAO,IAAKC,EAA0B9B,MAAoBf,EAAM8C,iBAChEC,WAAYC,IAGVC,EAAgBC,GACjBC,IAC8BC,EACRC,SAAQC,IAEvB,MAAMC,EAAgBJ,EAAgBG,GAClCC,SAEJf,EAAQc,EAASE,OAAOD,GAAAA,IAE5BhB,IACAd,GAAsB,EAAA,GAE1B,CAACA,EAAuBc,EAAmBC,IAGzCiB,EAAkBP,GAAY,KAChCtB,GAAoB,EAAA,GACrB,IAGHpB,EAAWI,QAAQ8C,eAAiB,KAChCnB,IAIIT,GAHAC,GAAsBE,GAAsBI,EAGtB,GAFApC,EAAK0D,IAAI,6BAGnC,EAOJ,MAAMC,EAA0B1C,EAAqBG,QAAOwC,IAChDvD,GAAyBuD,IAASvD,IAmD9C,GA3CAwD,GAAU,KACN,MAAMC,EAAkBhD,EAAeiD,kBAAkB9B,EAAK+B,SAAW,GAAKC,EACxEC,EAAU,IAAKjC,EAAM6B,mBAE3B3D,EAAeiD,SAAQe,IACnB9B,EAAgB8B,EAAW,QAA3B9B,CAAoC6B,EAAQC,IAAc,GAAA,IAG1DD,EAAQE,YACR/B,EAAgB,aAAc,OAA9BA,CAAsCJ,EAAKmC,WAC/C,GACD,CAACnC,EAAK+B,UAMTH,GAAU,KACN,MAAMQ,EAAuBlE,EAAemB,SAAS,mBAC/CgD,EAA0BrC,EAAK+B,SAAWlD,EAAeiD,kBAAkB9B,EAAK+B,SAChFO,EAAyBF,GAAwBC,EACjDR,EAAkB7B,EAAK6B,kBAAoBS,EAAyB,GAAKN,GAE/E5B,EAAgB,kBAAmB,QAAnCA,CAA4CyB,EAAAA,GAC7C,IAEHD,GAAU,KACN,MAAMW,EAAiB1D,EAAe2D,4BAA4BxC,EAAK+B,SACjEU,EAAgBvB,EAAewB,QAAO,CAACC,EAAKC,KAC9C,MAAMC,EAAaN,EAAelD,SAASuD,GACrCE,EAAa5E,EAAemB,SAASuD,GACrCG,EAAW/C,EAAK4C,GAChBI,EAAelF,EAAMkC,KAAK4C,GAG1BK,EAAQJ,IAAgBE,IAAcD,EADrBA,GAAeC,IAAcC,EAA8BhB,EAAfgB,EACMD,EAEzE,OADIE,GAAOtE,SAAQgE,EAAIC,GAAOK,GACvBN,CAAAA,GACR,CAAC,GAEJ7E,EAAMoF,SAAS,CAAElD,KAAMyC,EAAevC,QAAOD,SAAQE,WAAQ,GAC9D,CAACH,EAAME,EAAOD,EAAQE,IAEN,WAAfhC,EAAyB,OAAO,KACpC,GAAmB,aAAfA,EAA2B,OAAOgF,EAACC,EAAAA,CAAgBpD,KAAMA,EAAM/B,MAAOA,IAE1E,MAAMoF,EAAe,CAACnB,GAAqBoB,qBAAqB,MACvDpF,EAAemB,SAAS6C,GAGzBiB,EAACI,EAAAA,CACGC,IAAKtB,EACLuB,iBAAkB3F,EAAM2F,iBACxBH,mBAAoB,IAAIA,EAAoBpB,GAC5ClC,KAAMA,EACNC,OAAQA,EACRC,MAAOA,EACPgC,UAAWA,EACXwB,QAAStD,EAAgB8B,EAAW,SACpCyB,OAAQvD,EAAgB8B,EAAW,QACnC0B,iBAAkBxD,EAAgB8B,EAAW,QAC7CrD,eAAgBA,EAChBgF,UAAWC,EAA8BC,EAA2B7B,EAAWlC,EAAK+B,SAAS,GAC7FiC,YAAY,EACZC,UAAWvC,EAAcrC,SAAS6C,GAClCgC,sBAAuBpG,EAAMoG,sBAC7BC,qBAAsBrG,EAAMqG,uBAnBY,KA8B9CC,EAAgBvF,EAAewF,2BAA2BrE,EAAK+B,SAErE,OACIoB,EAACmB,OACGnB,EAACoB,EAAAA,CAASjB,mBAAoB,CAACrF,GAAS,WAAYA,MAAOA,GACtD4B,GACGsD,EAACqB,EAAAA,CACG1E,gBAAiBhC,EAAMgC,gBACvB2E,kBAAmB3G,EAAM2G,kBACzBC,SAAU3D,EACVQ,gBAAiBA,EACjBoD,qBAAsBhF,EACtBiF,iBAAkB7E,EAClB1B,sBAAuBA,EACvBwG,eAAgB9G,EAAK0D,IAAI,iCACzBqD,wBAAyBhH,EAAMgH,0BAGtC/E,GACGoD,EAACmB,EAAAA,KAAUF,EAAcW,KAAI3F,GAAUA,aAAiB4F,MAxBpE7B,EAAC8B,MAAAA,CAAIC,UAAU,+BAwBwE9F,EAvB5E2F,KAAI,EAAE3F,EAAO+F,KAAU9B,EAAajE,EAAO,CAAEkE,mBAAoB,CAAC,OAAO6B,UAuBY9B,EAAajE,EAAO,QAK5H,CAEAvB,EAAQuH,aAAe,CACnBlG,YAAa,KACb0B,gBAAiB,KACjBZ,KAAM,CAAC,EACPkD,SAAU,OACV/E,WAAY,WACZD,eAAgBgD,EAChBrC,eAAgB,CAAC,EACjBqF,sBAAuB,OACvBC,qBAAsB"}
1
+ {"version":3,"file":"Address.js","sources":["../../../../../src/components/internal/Address/Address.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'preact/hooks';\nimport Fieldset from '../FormFields/Fieldset';\nimport ReadOnlyAddress from './components/ReadOnlyAddress';\nimport { getAddressValidationRules } from './validate';\nimport { addressFormatters, countrySpecificFormatters } from './validate.formats';\nimport { AddressProps } from './types';\nimport { AddressData } from '../../../types/global-types';\nimport FieldContainer from './components/FieldContainer';\nimport useForm from '../../../utils/useForm';\nimport Specifications from './Specifications';\nimport { ADDRESS_SCHEMA, FALLBACK_VALUE } from './constants';\nimport { getMaxLengthByFieldAndCountry } from '../../../utils/validator-utils';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport AddressSearch from './components/AddressSearch';\nimport { ComponentMethodsRef } from '../UIElement/types';\n\nexport default function Address(props: AddressProps) {\n const { i18n } = useCoreContext();\n\n const { label = '', requiredFields, visibility, iOSFocusedField = null, showContextualElement } = props;\n\n /** An object by which to expose 'public' members to the parent UIElement */\n const addressRef = useRef<ComponentMethodsRef>({});\n // Just call once\n if (!Object.keys(addressRef.current).length) {\n props.setComponentRef?.(addressRef.current);\n }\n\n const specifications = useMemo(() => new Specifications(props.specifications), [props.specifications]);\n\n const requiredFieldsSchema = specifications.getAddressSchemaForCountryFlat(props.countryCode).filter(field => requiredFields.includes(field));\n\n const [hasSelectedAddress, setHasSelectedAddress] = useState(false);\n\n const [useManualAddress, setUseManualAddress] = useState(false);\n\n const [searchErrorMessage, setSearchErrorMessage] = useState('');\n\n const showAddressSearch = !!props.onAddressLookup;\n\n const showAddressFields = props.onAddressLookup ? hasSelectedAddress || useManualAddress : true;\n\n const { data, errors, valid, isValid, handleChangeFor, triggerValidation, setData } = useForm<AddressData>({\n schema: requiredFieldsSchema,\n defaultData: props.data,\n // Ensure any passed validation rules are merged with the default ones\n rules: { ...getAddressValidationRules(specifications), ...props.validationRules },\n formatters: addressFormatters\n });\n\n const setSearchData = useCallback(\n (selectedAddress: AddressData) => {\n const propsKeysToProcess = ADDRESS_SCHEMA;\n propsKeysToProcess.forEach(propKey => {\n // Make sure the data provided by the merchant is always strings\n const providedValue = selectedAddress[propKey];\n if (providedValue === null || providedValue === undefined) return;\n // Cast everything to string\n setData(propKey, String(providedValue));\n });\n triggerValidation();\n setHasSelectedAddress(true);\n },\n [setHasSelectedAddress, triggerValidation, setData]\n );\n\n const onManualAddress = useCallback(() => {\n setUseManualAddress(true);\n }, []);\n\n // Expose method expected by (parent) Address.tsx\n addressRef.current.showValidation = () => {\n triggerValidation();\n if (showAddressSearch && !showAddressFields && !isValid) {\n setSearchErrorMessage(i18n.get('address.errors.incomplete'));\n } else {\n setSearchErrorMessage('');\n }\n };\n\n /**\n * For iOS: iOSFocusedField is the name of the element calling for other elements to be disabled\n * - so if it is set (meaning we are in iOS *and* an input has been focussed) only enable the field that corresponds to this element\n */\n const enabledFields: string[] = requiredFieldsSchema.filter(item => {\n return !iOSFocusedField ? true : item === iOSFocusedField;\n });\n\n /**\n * Effect that:\n * - Resets validation for all fields by triggering handleChangeFor(fieldName, 'input')\n * - Applies validation on postalCode field in case it has any value\n */\n useEffect((): void => {\n const stateOrProvince = specifications.countryHasDataset(data.country) ? '' : FALLBACK_VALUE;\n const newData = { ...data, stateOrProvince };\n\n requiredFields.forEach(fieldName => {\n handleChangeFor(fieldName, 'input')(newData[fieldName] ?? '');\n });\n\n if (newData.postalCode) {\n handleChangeFor('postalCode', 'blur')(data.postalCode);\n }\n }, [data.country]);\n\n /**\n * Set the value of 'stateOrProvince' during the initial render if\n * property is provided during the creation of the payment method\n */\n useEffect((): void => {\n const stateFieldIsRequired = requiredFields.includes('stateOrProvince');\n const countryHasStatesDataset = data.country && specifications.countryHasDataset(data.country);\n const addressShouldHaveState = stateFieldIsRequired && countryHasStatesDataset;\n const stateOrProvince = data.stateOrProvince || (addressShouldHaveState ? '' : FALLBACK_VALUE);\n\n handleChangeFor('stateOrProvince', 'input')(stateOrProvince);\n }, []);\n\n useEffect((): void => {\n const optionalFields = specifications.getOptionalFieldsForCountry(data.country);\n const processedData = ADDRESS_SCHEMA.reduce((acc, cur) => {\n const isOptional = optionalFields.includes(cur);\n const isRequired = requiredFields.includes(cur);\n const newValue = data[cur];\n const initialValue = props.data[cur];\n // recover default data values which are not requiredFields, or prefill with 'N/A'\n const fallbackValue = !isRequired && !newValue && !!initialValue ? initialValue : FALLBACK_VALUE;\n const value = (isOptional && !newValue) || !isRequired ? fallbackValue : newValue;\n if (value?.length) acc[cur] = value;\n return acc;\n }, {});\n\n props.onChange({ data: processedData, valid, errors, isValid });\n }, [data, valid, errors, isValid]);\n\n if (visibility === 'hidden') return null;\n if (visibility === 'readOnly') return <ReadOnlyAddress data={data} label={label} />;\n\n const getComponent = (fieldName: string, { classNameModifiers = [] }) => {\n if (!requiredFields.includes(fieldName)) return null;\n\n return (\n <FieldContainer\n key={fieldName}\n allowedCountries={props.allowedCountries}\n classNameModifiers={[...classNameModifiers, fieldName]}\n data={data}\n errors={errors}\n valid={valid}\n fieldName={fieldName}\n onInput={handleChangeFor(fieldName, 'input')}\n onBlur={handleChangeFor(fieldName, 'blur')}\n onDropdownChange={handleChangeFor(fieldName, 'blur')}\n specifications={specifications}\n maxLength={getMaxLengthByFieldAndCountry(countrySpecificFormatters, fieldName, data.country, true)}\n trimOnBlur={true}\n disabled={!enabledFields.includes(fieldName)}\n onFieldFocusAnalytics={props.onFieldFocusAnalytics}\n onFieldBlurAnalytics={props.onFieldBlurAnalytics}\n />\n );\n };\n\n const getWrapper = group => (\n <div className=\"adyen-checkout__field-group\">\n {group.map(([field, size]) => getComponent(field, { classNameModifiers: [`col-${size}`] }))}\n </div>\n );\n\n const addressSchema = specifications.getAddressSchemaForCountry(data.country);\n\n return (\n <Fragment>\n <Fieldset classNameModifiers={[label || 'address']} label={label}>\n {showAddressSearch && (\n <AddressSearch\n onAddressLookup={props.onAddressLookup}\n onAddressSelected={props.onAddressSelected}\n onSelect={setSearchData}\n onManualAddress={onManualAddress}\n externalErrorMessage={searchErrorMessage}\n hideManualButton={showAddressFields}\n showContextualElement={showContextualElement}\n contextualText={i18n.get('address.search.contextualText')}\n addressSearchDebounceMs={props.addressSearchDebounceMs}\n />\n )}\n {showAddressFields && (\n <Fragment>{addressSchema.map(field => (field instanceof Array ? getWrapper(field) : getComponent(field, {})))}</Fragment>\n )}\n </Fieldset>\n </Fragment>\n );\n}\n\nAddress.defaultProps = {\n countryCode: null,\n validationRules: null,\n data: {},\n onChange: () => {},\n visibility: 'editable',\n requiredFields: ADDRESS_SCHEMA,\n specifications: {},\n onFieldFocusAnalytics: () => {},\n onFieldBlurAnalytics: () => {}\n};\n"],"names":["Address","props","i18n","useCoreContext","label","requiredFields","visibility","iOSFocusedField","showContextualElement","addressRef","useRef","Object","keys","current","length","setComponentRef","specifications","useMemo","Specifications","requiredFieldsSchema","getAddressSchemaForCountryFlat","countryCode","filter","field","includes","hasSelectedAddress","setHasSelectedAddress","useState","useManualAddress","setUseManualAddress","searchErrorMessage","setSearchErrorMessage","showAddressSearch","onAddressLookup","showAddressFields","data","errors","valid","isValid","handleChangeFor","triggerValidation","setData","useForm","schema","defaultData","rules","getAddressValidationRules","validationRules","formatters","addressFormatters","setSearchData","useCallback","selectedAddress","ADDRESS_SCHEMA","forEach","propKey","providedValue","String","onManualAddress","showValidation","get","enabledFields","item","useEffect","stateOrProvince","countryHasDataset","country","FALLBACK_VALUE","newData","fieldName","postalCode","stateFieldIsRequired","countryHasStatesDataset","addressShouldHaveState","optionalFields","getOptionalFieldsForCountry","processedData","reduce","acc","cur","isOptional","isRequired","newValue","initialValue","value","onChange","h","ReadOnlyAddress","getComponent","classNameModifiers","FieldContainer","key","allowedCountries","onInput","onBlur","onDropdownChange","maxLength","getMaxLengthByFieldAndCountry","countrySpecificFormatters","trimOnBlur","disabled","onFieldFocusAnalytics","onFieldBlurAnalytics","addressSchema","getAddressSchemaForCountry","Fragment","Fieldset","AddressSearch","onAddressSelected","onSelect","externalErrorMessage","hideManualButton","contextualText","addressSearchDebounceMs","map","Array","div","className","size","defaultProps"],"mappings":"u1BAiBe,SAASA,EAAQC,GAC5B,MAAMC,KAAEA,GAASC,KAEXC,MAAEA,EAAQ,GAAEC,eAAEA,EAAcC,WAAEA,EAAUC,gBAAEA,EAAkB,KAAIC,sBAAEA,GAA0BP,EAG5FQ,EAAaC,EAA4B,CAAA,GAE1CC,OAAOC,KAAKH,EAAWI,SAASC,QACjCb,EAAMc,kBAAkBN,EAAWI,SAGvC,MAAMG,EAAiBC,GAAQ,IAAM,IAAIC,EAAejB,EAAMe,iBAAiB,CAACf,EAAMe,iBAEhFG,EAAuBH,EAAeI,+BAA+BnB,EAAMoB,aAAaC,QAAOC,GAASlB,EAAemB,SAASD,MAE/HE,EAAoBC,GAAyBC,GAAS,IAEtDC,EAAkBC,GAAuBF,GAAS,IAElDG,EAAoBC,GAAyBJ,EAAS,IAEvDK,IAAsB/B,EAAMgC,gBAE5BC,GAAoBjC,EAAMgC,kBAAkBR,GAAsBG,IAElEO,KAAEA,EAAIC,OAAEA,EAAMC,MAAEA,EAAKC,QAAEA,EAAOC,gBAAEA,EAAeC,kBAAEA,EAAiBC,QAAEA,GAAYC,EAAqB,CACvGC,OAAQxB,EACRyB,YAAa3C,EAAMkC,KAEnBU,MAAO,IAAKC,EAA0B9B,MAAoBf,EAAM8C,iBAChEC,WAAYC,IAGVC,EAAgBC,GACjBC,IAC8BC,EACRC,SAAQC,IAEvB,MAAMC,EAAgBJ,EAAgBG,GAClCC,SAEJf,EAAQc,EAASE,OAAOD,GAAAA,IAE5BhB,IACAd,GAAsB,EAAA,GAE1B,CAACA,EAAuBc,EAAmBC,IAGzCiB,EAAkBP,GAAY,KAChCtB,GAAoB,EAAA,GACrB,IAGHpB,EAAWI,QAAQ8C,eAAiB,KAChCnB,IAIIT,GAHAC,GAAsBE,GAAsBI,EAGtB,GAFApC,EAAK0D,IAAI,6BAGnC,EAOJ,MAAMC,EAA0B1C,EAAqBG,QAAOwC,IAChDvD,GAAyBuD,IAASvD,IAmD9C,GA3CAwD,GAAU,KACN,MAAMC,EAAkBhD,EAAeiD,kBAAkB9B,EAAK+B,SAAW,GAAKC,EACxEC,EAAU,IAAKjC,EAAM6B,mBAE3B3D,EAAeiD,SAAQe,IACnB9B,EAAgB8B,EAAW,QAA3B9B,CAAoC6B,EAAQC,IAAc,GAAA,IAG1DD,EAAQE,YACR/B,EAAgB,aAAc,OAA9BA,CAAsCJ,EAAKmC,WAC/C,GACD,CAACnC,EAAK+B,UAMTH,GAAU,KACN,MAAMQ,EAAuBlE,EAAemB,SAAS,mBAC/CgD,EAA0BrC,EAAK+B,SAAWlD,EAAeiD,kBAAkB9B,EAAK+B,SAChFO,EAAyBF,GAAwBC,EACjDR,EAAkB7B,EAAK6B,kBAAoBS,EAAyB,GAAKN,GAE/E5B,EAAgB,kBAAmB,QAAnCA,CAA4CyB,EAAAA,GAC7C,IAEHD,GAAU,KACN,MAAMW,EAAiB1D,EAAe2D,4BAA4BxC,EAAK+B,SACjEU,EAAgBvB,EAAewB,QAAO,CAACC,EAAKC,KAC9C,MAAMC,EAAaN,EAAelD,SAASuD,GACrCE,EAAa5E,EAAemB,SAASuD,GACrCG,EAAW/C,EAAK4C,GAChBI,EAAelF,EAAMkC,KAAK4C,GAG1BK,EAAQJ,IAAgBE,IAAcD,EADrBA,GAAeC,IAAcC,EAA8BhB,EAAfgB,EACMD,EAEzE,OADIE,GAAOtE,SAAQgE,EAAIC,GAAOK,GACvBN,CAAAA,GACR,CAAC,GAEJ7E,EAAMoF,SAAS,CAAElD,KAAMyC,EAAevC,QAAOD,SAAQE,WAAQ,GAC9D,CAACH,EAAME,EAAOD,EAAQE,IAEN,WAAfhC,EAAyB,OAAO,KACpC,GAAmB,aAAfA,EAA2B,OAAOgF,EAACC,EAAAA,CAAgBpD,KAAMA,EAAM/B,MAAOA,IAE1E,MAAMoF,EAAe,CAACnB,GAAqBoB,qBAAqB,MACvDpF,EAAemB,SAAS6C,GAGzBiB,EAACI,EAAAA,CACGC,IAAKtB,EACLuB,iBAAkB3F,EAAM2F,iBACxBH,mBAAoB,IAAIA,EAAoBpB,GAC5ClC,KAAMA,EACNC,OAAQA,EACRC,MAAOA,EACPgC,UAAWA,EACXwB,QAAStD,EAAgB8B,EAAW,SACpCyB,OAAQvD,EAAgB8B,EAAW,QACnC0B,iBAAkBxD,EAAgB8B,EAAW,QAC7CrD,eAAgBA,EAChBgF,UAAWC,EAA8BC,EAA2B7B,EAAWlC,EAAK+B,SACpFiC,YAAY,EACZC,UAAWvC,EAAcrC,SAAS6C,GAClCgC,sBAAuBpG,EAAMoG,sBAC7BC,qBAAsBrG,EAAMqG,uBAnBY,KA8B9CC,EAAgBvF,EAAewF,2BAA2BrE,EAAK+B,SAErE,OACIoB,EAACmB,OACGnB,EAACoB,EAAAA,CAASjB,mBAAoB,CAACrF,GAAS,WAAYA,MAAOA,GACtD4B,GACGsD,EAACqB,EAAAA,CACG1E,gBAAiBhC,EAAMgC,gBACvB2E,kBAAmB3G,EAAM2G,kBACzBC,SAAU3D,EACVQ,gBAAiBA,EACjBoD,qBAAsBhF,EACtBiF,iBAAkB7E,EAClB1B,sBAAuBA,EACvBwG,eAAgB9G,EAAK0D,IAAI,iCACzBqD,wBAAyBhH,EAAMgH,0BAGtC/E,GACGoD,EAACmB,EAAAA,KAAUF,EAAcW,KAAI3F,GAAUA,aAAiB4F,MAxBpE7B,EAAC8B,MAAAA,CAAIC,UAAU,+BAwBwE9F,EAvB5E2F,KAAI,EAAE3F,EAAO+F,KAAU9B,EAAajE,EAAO,CAAEkE,mBAAoB,CAAC,OAAO6B,UAuBY9B,EAAajE,EAAO,QAK5H,CAEAvB,EAAQuH,aAAe,CACnBlG,YAAa,KACb0B,gBAAiB,KACjBZ,KAAM,CAAC,EACPkD,SAAU,OACV/E,WAAY,WACZD,eAAgBgD,EAChBrC,eAAgB,CAAC,EACjBqF,sBAAuB,OACvBC,qBAAsB"}
@@ -1,2 +1,2 @@
1
- import{createElement as t,Fragment as e}from"../../../../../external/preact/dist/preact.js";import{useState as r,useEffect as o,useCallback as s}from"../../../../../external/preact/hooks/dist/hooks.js";import a from"../../context/useClickToPayContext.js";import n from"./CtPSingleCard/CtPSingleCard.js";import i from"../../../PayButton/PayButton.js";import{amountLabel as c}from"../../../PayButton/utils.js";import l from"./CtPCardsList/CtPCardsList.js";import m from"../../services/sdks/SrciError.js";import u from"../CtPSection/CtPSection.js";import{CTP_IFRAME_NAME as d}from"../../services/utils.js";import p from"../../../IFrame/Iframe.js";import f from"../../../../../core/Context/useImage.js";import{useCoreContext as g}from"../../../../../core/Context/CoreProvider.js";import C from"../../../../../utils/isMobile.js";function h(t,e){if(!t)return null;const r=e.get(`ctp.errors.${t}`);return r.includes("ctp.errors")?e.get("ctp.errors.UNKNOWN_ERROR"):r}function y(t,e,r){return r?C()?null:t.get("payButton.with",{values:{value:c(t,e),maskedData:`•••• ${r?.panLastFour}`}}):t.get("payButton")}const P=({onDisplayCardComponent:c})=>{const{i18n:C}=g(),P=f(),{amount:j,cards:k,checkout:S,isCtpPrimaryPaymentMethod:x,status:b,onSubmit:v,onSetStatus:E,onError:B}=a(),[M,N]=r(k.find((t=>!t.isExpired))||k[0]),[$,w]=r(null),F=k.every((t=>t.isExpired)),[R,_]=r(!1);o((()=>{(0===k.length||F)&&c?.()}),[c,F,k]);const D=s((async()=>{if(M)try{_(!0),w(null),E("loading");const t=await S(M);v(t)}catch(t){t instanceof m&&(w(t?.reason),console.warn(`CtP - Checkout: Reason: ${t?.reason} / Source: ${t?.source} / Scheme: ${t?.scheme}`)),_(!1),B(t)}}),[S,M]),I=s((t=>{N(t)}),[]),L=R&&"loading"===b&&M?.isDcfPopupEmbedded,T="loading"!==b||!L;return t(e,null,t(p,{name:d,height:"380",width:"100%",classNameModifiers:[L?"":"hidden"]}),T&&t(e,null,t(u.Title,null,C.get("ctp.cards.title")),t(u.Text,null,C.get("ctp.cards.subtitle")),0===k.length&&t("div",{className:"adyen-checkout-ctp__empty-cards"},C.get("ctp.emptyProfile.message")),1===k.length&&t(n,{card:k[0],errorMessage:h($,C)}),k.length>1&&t(l,{cardSelected:M,cards:k,onChangeCard:I,errorMessage:h($,C)}),t(i,{disabled:F,amount:j,label:y(C,j,M),status:b,variant:x?"primary":"secondary",icon:0!==k.length&&P({imageFolder:"components/"})(x?"lock":"lock_black"),onClick:D})))};export{P as default};
1
+ import{createElement as t,Fragment as e}from"../../../../../external/preact/dist/preact.js";import{useState as r,useEffect as o,useCallback as s}from"../../../../../external/preact/hooks/dist/hooks.js";import a from"../../context/useClickToPayContext.js";import n from"./CtPSingleCard/CtPSingleCard.js";import i from"../../../PayButton/PayButton.js";import{amountLabel as c}from"../../../PayButton/utils.js";import l from"./CtPCardsList/CtPCardsList.js";import m from"../../services/sdks/SrciError.js";import u from"../CtPSection/CtPSection.js";import{CTP_IFRAME_NAME as d}from"../../services/utils.js";import p from"../../../IFrame/Iframe.js";import f from"../../../../../core/Context/useImage.js";import{useCoreContext as g}from"../../../../../core/Context/CoreProvider.js";import C from"../../../../../utils/isMobile.js";import h from"../../../../../core/Errors/AdyenCheckoutError.js";import{PREFIX as y}from"../../../Icon/constants.js";function P(t,e){if(!t)return null;const r=e.get(`ctp.errors.${t}`);return r.includes("ctp.errors")?e.get("ctp.errors.UNKNOWN_ERROR"):r}function j(t,e,r){return r?C()?null:t.get("payButton.with",{values:{value:c(t,e),maskedData:`•••• ${r?.panLastFour}`}}):t.get("payButton")}const k=({onDisplayCardComponent:c})=>{const{i18n:C}=g(),k=f(),{amount:E,cards:S,checkout:x,isCtpPrimaryPaymentMethod:b,status:v,onSubmit:R,onSetStatus:$,onError:w}=a(),[B,M]=r(S.find((t=>!t.isExpired))||S[0]),[N,F]=r(null),I=S.every((t=>t.isExpired)),[T,_]=r(!1);o((()=>{(0===S.length||I)&&c?.()}),[c,I,S]);const D=s((async()=>{if(B)try{_(!0),F(null),$("loading");const t=await x(B);R(t)}catch(t){t instanceof m&&(F(t?.reason),console.warn(`CtP - Checkout: Reason: ${t?.reason} / Source: ${t?.source} / Scheme: ${t?.scheme}`)),_(!1),w(t instanceof h?t:new h("ERROR","Error during ClickToPay checkout",{cause:t}))}}),[x,B]),L=s((t=>{M(t)}),[]),O=T&&"loading"===v&&B?.isDcfPopupEmbedded,A="loading"!==v||!O;return t(e,null,t(p,{name:d,height:"380",width:"100%",classNameModifiers:[O?"":"hidden"]}),A&&t(e,null,t(u.Title,null,C.get("ctp.cards.title")),t(u.Text,null,C.get("ctp.cards.subtitle")),0===S.length&&t("div",{className:"adyen-checkout-ctp__empty-cards"},C.get("ctp.emptyProfile.message")),1===S.length&&t(n,{card:S[0],errorMessage:P(N,C)}),S.length>1&&t(l,{cardSelected:B,cards:S,onChangeCard:L,errorMessage:P(N,C)}),t(i,{disabled:I,amount:E,label:j(C,E,B),status:v,variant:b?"primary":"secondary",icon:0!==S.length&&k({imageFolder:"components/"})(b?`${y}lock`:`${y}lock_black`),onClick:D})))};export{k as default};
2
2
  //# sourceMappingURL=CtPCards.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CtPCards.js","sources":["../../../../../../../src/components/internal/ClickToPay/components/CtPCards/CtPCards.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useCallback, useEffect, useState } from 'preact/hooks';\nimport useClickToPayContext from '../../context/useClickToPayContext';\nimport CtPSingleCard from './CtPSingleCard/CtPSingleCard';\nimport PayButton from '../../../PayButton';\nimport { amountLabel } from '../../../PayButton/utils';\nimport CtPCardsList from './CtPCardsList';\nimport ShopperCard from '../../models/ShopperCard';\nimport SrciError from '../../services/sdks/SrciError';\nimport CtPSection from '../CtPSection';\nimport { CTP_IFRAME_NAME } from '../../services/utils';\nimport Iframe from '../../../../internal/IFrame';\nimport useImage from '../../../../../core/Context/useImage';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport isMobile from '../../../../../utils/isMobile';\nimport Language from '../../../../../language';\nimport { PaymentAmount } from '../../../../../types/global-types';\nimport './CtPCards.scss';\n\ntype CtPCardsProps = {\n onDisplayCardComponent?(): void;\n};\n\nfunction getErrorLabel(errorCode: string, i18n: Language): string {\n if (!errorCode) return null;\n\n const errorLabel = i18n.get(`ctp.errors.${errorCode}`);\n if (errorLabel.includes('ctp.errors')) return i18n.get(`ctp.errors.UNKNOWN_ERROR`);\n return errorLabel;\n}\n\nfunction getPayButtonLabel(i18n: Language, amount: PaymentAmount, checkoutCard?: ShopperCard): string | null {\n if (!checkoutCard) return i18n.get('payButton');\n if (!isMobile())\n return i18n.get('payButton.with', {\n values: { value: amountLabel(i18n, amount), maskedData: `•••• ${checkoutCard?.panLastFour}` }\n });\n return null;\n}\n\nconst CtPCards = ({ onDisplayCardComponent }: CtPCardsProps) => {\n const { i18n } = useCoreContext();\n const getImage = useImage();\n const { amount, cards, checkout, isCtpPrimaryPaymentMethod, status, onSubmit, onSetStatus, onError } = useClickToPayContext();\n const [checkoutCard, setCheckoutCard] = useState<ShopperCard | undefined>(cards.find(card => !card.isExpired) || cards[0]);\n const [errorCode, setErrorCode] = useState<string>(null);\n const isEveryCardExpired = cards.every(card => card.isExpired);\n const [isShopperCheckingOutWithCtp, setIsShopperCheckingOutWithCtp] = useState<boolean>(false);\n\n useEffect(() => {\n if (cards.length === 0 || isEveryCardExpired) {\n onDisplayCardComponent?.();\n }\n }, [onDisplayCardComponent, isEveryCardExpired, cards]);\n\n const doCheckout = useCallback(async () => {\n if (!checkoutCard) return;\n\n try {\n setIsShopperCheckingOutWithCtp(true);\n setErrorCode(null);\n onSetStatus('loading');\n const payload = await checkout(checkoutCard);\n onSubmit(payload);\n } catch (error) {\n if (error instanceof SrciError) {\n setErrorCode(error?.reason);\n console.warn(`CtP - Checkout: Reason: ${error?.reason} / Source: ${error?.source} / Scheme: ${error?.scheme}`);\n }\n setIsShopperCheckingOutWithCtp(false);\n onError(error);\n }\n }, [checkout, checkoutCard]);\n\n const handleOnChangeCard = useCallback((card: ShopperCard) => {\n setCheckoutCard(card);\n }, []);\n\n /**\n * If shopper submits the payment using the default Card component while CtP is rendered, the status here will be updated\n * and that can potentially display an iframe.\n *\n * Therefore, we use the flag 'isShopperCheckingOutWithCtp' to flag that the iframe should be displayed only in case the\n * Shopper is checking out with Click to Pay.\n */\n const displayNetworkDcf = isShopperCheckingOutWithCtp && status === 'loading' && checkoutCard?.isDcfPopupEmbedded;\n const displayCardCheckoutView = status !== 'loading' || !displayNetworkDcf;\n\n return (\n <Fragment>\n <Iframe name={CTP_IFRAME_NAME} height=\"380\" width=\"100%\" classNameModifiers={[displayNetworkDcf ? '' : 'hidden']} />\n\n {displayCardCheckoutView && (\n <Fragment>\n <CtPSection.Title>{i18n.get('ctp.cards.title')}</CtPSection.Title>\n <CtPSection.Text>{i18n.get('ctp.cards.subtitle')}</CtPSection.Text>\n\n {cards.length === 0 && <div className=\"adyen-checkout-ctp__empty-cards\">{i18n.get('ctp.emptyProfile.message')}</div>}\n {cards.length === 1 && <CtPSingleCard card={cards[0]} errorMessage={getErrorLabel(errorCode, i18n)} />}\n {cards.length > 1 && (\n <CtPCardsList\n cardSelected={checkoutCard}\n cards={cards}\n onChangeCard={handleOnChangeCard}\n errorMessage={getErrorLabel(errorCode, i18n)}\n />\n )}\n\n <PayButton\n disabled={isEveryCardExpired}\n amount={amount}\n label={getPayButtonLabel(i18n, amount, checkoutCard)}\n status={status}\n variant={isCtpPrimaryPaymentMethod ? 'primary' : 'secondary'}\n icon={cards.length !== 0 && getImage({ imageFolder: 'components/' })(isCtpPrimaryPaymentMethod ? 'lock' : 'lock_black')}\n onClick={doCheckout}\n />\n </Fragment>\n )}\n </Fragment>\n );\n};\n\nexport default CtPCards;\n"],"names":["getErrorLabel","errorCode","i18n","errorLabel","get","includes","getPayButtonLabel","amount","checkoutCard","isMobile","values","value","amountLabel","maskedData","panLastFour","CtPCards","onDisplayCardComponent","useCoreContext","getImage","useImage","cards","checkout","isCtpPrimaryPaymentMethod","status","onSubmit","onSetStatus","onError","useClickToPayContext","setCheckoutCard","useState","find","card","isExpired","setErrorCode","isEveryCardExpired","every","isShopperCheckingOutWithCtp","setIsShopperCheckingOutWithCtp","useEffect","length","doCheckout","useCallback","async","payload","error","SrciError","reason","console","warn","source","scheme","handleOnChangeCard","displayNetworkDcf","isDcfPopupEmbedded","displayCardCheckoutView","h","Fragment","Iframe","name","CTP_IFRAME_NAME","height","width","classNameModifiers","CtPSection","Title","Text","div","className","CtPSingleCard","errorMessage","CtPCardsList","cardSelected","onChangeCard","PayButton","disabled","label","variant","icon","imageFolder","onClick"],"mappings":"wzBAuBA,SAASA,EAAcC,EAAmBC,GACtC,IAAKD,EAAW,OAAO,KAEvB,MAAME,EAAaD,EAAKE,IAAI,cAAcH,KAC1C,OAAIE,EAAWE,SAAS,cAAsBH,EAAKE,IAAI,4BAChDD,CACX,CAEA,SAASG,EAAkBJ,EAAgBK,EAAuBC,GAC9D,OAAKA,EACAC,IAIE,KAHIP,EAAKE,IAAI,iBAAkB,CAC9BM,OAAQ,CAAEC,MAAOC,EAAYV,EAAMK,GAASM,WAAY,QAAQL,GAAcM,iBAH5DZ,EAAKE,IAAI,YAMvC,CAEA,MAAMW,EAAW,EAAGC,6BAChB,MAAMd,KAAEA,GAASe,IACXC,EAAWC,KACXZ,OAAEA,EAAMa,MAAEA,EAAKC,SAAEA,EAAQC,0BAAEA,EAAyBC,OAAEA,EAAMC,SAAEA,EAAQC,YAAEA,EAAWC,QAAEA,GAAYC,KAChGnB,EAAcoB,GAAmBC,EAAkCT,EAAMU,MAAKC,IAASA,EAAKC,aAAcZ,EAAM,KAChHnB,EAAWgC,GAAgBJ,EAAiB,MAC7CK,EAAqBd,EAAMe,OAAMJ,GAAQA,EAAKC,aAC7CI,EAA6BC,GAAkCR,GAAkB,GAExFS,GAAU,MACe,IAAjBlB,EAAMmB,QAAgBL,IACtBlB,KACJ,GACD,CAACA,EAAwBkB,EAAoBd,IAEhD,MAAMoB,EAAaC,GAAYC,UAC3B,GAAKlC,EAEL,IACI6B,GAA+B,GAC/BJ,EAAa,MACbR,EAAY,WACZ,MAAMkB,QAAgBtB,EAASb,GAC/BgB,EAASmB,EACb,CAAE,MAAOC,GACDA,aAAiBC,IACjBZ,EAAaW,GAAOE,QACpBC,QAAQC,KAAK,2BAA2BJ,GAAOE,oBAAoBF,GAAOK,oBAAoBL,GAAOM,WAEzGb,GAA+B,GAC/BX,EAAQkB,EACZ,IACD,CAACvB,EAAUb,IAER2C,EAAqBV,GAAaV,IACpCH,EAAgBG,EAAAA,GACjB,IASGqB,EAAoBhB,GAA0C,YAAXb,GAAwBf,GAAc6C,mBACzFC,EAAqC,YAAX/B,IAAyB6B,EAEzD,OACIG,EAACC,OACGD,EAACE,EAAAA,CAAOC,KAAMC,EAAiBC,OAAO,MAAMC,MAAM,OAAOC,mBAAoB,CAACV,EAAoB,GAAK,YAEtGE,GACGC,EAACC,OACGD,EAACQ,EAAWC,MAAO9D,KAAAA,EAAKE,IAAI,oBAC5BmD,EAACQ,EAAWE,KAAI,KAAE/D,EAAKE,IAAI,uBAET,IAAjBgB,EAAMmB,QAAgBgB,EAACW,MAAAA,CAAIC,UAAU,mCAAmCjE,EAAKE,IAAI,6BAChE,IAAjBgB,EAAMmB,QAAgBgB,EAACa,EAAAA,CAAcrC,KAAMX,EAAM,GAAIiD,aAAcrE,EAAcC,EAAWC,KAC5FkB,EAAMmB,OAAS,GACZgB,EAACe,EAAAA,CACGC,aAAc/D,EACdY,MAAOA,EACPoD,aAAcrB,EACdkB,aAAcrE,EAAcC,EAAWC,KAI/CqD,EAACkB,EAAAA,CACGC,SAAUxC,EACV3B,OAAQA,EACRoE,MAAOrE,EAAkBJ,EAAMK,EAAQC,GACvCe,OAAQA,EACRqD,QAAStD,EAA4B,UAAY,YACjDuD,KAAuB,IAAjBzD,EAAMmB,QAAgBrB,EAAS,CAAE4D,YAAa,eAAxB5D,CAAyCI,EAA4B,OAAS,cAC1GyD,QAASvC"}
1
+ {"version":3,"file":"CtPCards.js","sources":["../../../../../../../src/components/internal/ClickToPay/components/CtPCards/CtPCards.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useCallback, useEffect, useState } from 'preact/hooks';\nimport useClickToPayContext from '../../context/useClickToPayContext';\nimport CtPSingleCard from './CtPSingleCard/CtPSingleCard';\nimport PayButton from '../../../PayButton';\nimport { amountLabel } from '../../../PayButton/utils';\nimport CtPCardsList from './CtPCardsList';\nimport ShopperCard from '../../models/ShopperCard';\nimport SrciError from '../../services/sdks/SrciError';\nimport CtPSection from '../CtPSection';\nimport { CTP_IFRAME_NAME } from '../../services/utils';\nimport Iframe from '../../../../internal/IFrame';\nimport useImage from '../../../../../core/Context/useImage';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport isMobile from '../../../../../utils/isMobile';\nimport Language from '../../../../../language';\nimport { PaymentAmount } from '../../../../../types/global-types';\nimport './CtPCards.scss';\nimport AdyenCheckoutError from '../../../../../core/Errors/AdyenCheckoutError';\nimport { PREFIX } from '../../../Icon/constants';\n\n\ntype CtPCardsProps = {\n onDisplayCardComponent?(): void;\n};\n\nfunction getErrorLabel(errorCode: string, i18n: Language): string {\n if (!errorCode) return null;\n\n const errorLabel = i18n.get(`ctp.errors.${errorCode}`);\n if (errorLabel.includes('ctp.errors')) return i18n.get(`ctp.errors.UNKNOWN_ERROR`);\n return errorLabel;\n}\n\nfunction getPayButtonLabel(i18n: Language, amount: PaymentAmount, checkoutCard?: ShopperCard): string | null {\n if (!checkoutCard) return i18n.get('payButton');\n if (!isMobile())\n return i18n.get('payButton.with', {\n values: { value: amountLabel(i18n, amount), maskedData: `•••• ${checkoutCard?.panLastFour}` }\n });\n return null;\n}\n\nconst CtPCards = ({ onDisplayCardComponent }: CtPCardsProps) => {\n const { i18n } = useCoreContext();\n const getImage = useImage();\n const { amount, cards, checkout, isCtpPrimaryPaymentMethod, status, onSubmit, onSetStatus, onError } = useClickToPayContext();\n const [checkoutCard, setCheckoutCard] = useState<ShopperCard | undefined>(cards.find(card => !card.isExpired) || cards[0]);\n const [errorCode, setErrorCode] = useState<string>(null);\n const isEveryCardExpired = cards.every(card => card.isExpired);\n const [isShopperCheckingOutWithCtp, setIsShopperCheckingOutWithCtp] = useState<boolean>(false);\n\n useEffect(() => {\n if (cards.length === 0 || isEveryCardExpired) {\n onDisplayCardComponent?.();\n }\n }, [onDisplayCardComponent, isEveryCardExpired, cards]);\n\n const doCheckout = useCallback(async () => {\n if (!checkoutCard) return;\n\n try {\n setIsShopperCheckingOutWithCtp(true);\n setErrorCode(null);\n onSetStatus('loading');\n const payload = await checkout(checkoutCard);\n onSubmit(payload);\n } catch (error: unknown) {\n if (error instanceof SrciError) {\n setErrorCode(error?.reason);\n console.warn(`CtP - Checkout: Reason: ${error?.reason} / Source: ${error?.source} / Scheme: ${error?.scheme}`);\n }\n setIsShopperCheckingOutWithCtp(false);\n\n if (error instanceof AdyenCheckoutError) onError(error);\n else onError(new AdyenCheckoutError('ERROR', 'Error during ClickToPay checkout', { cause: error }));\n }\n }, [checkout, checkoutCard]);\n\n const handleOnChangeCard = useCallback((card: ShopperCard) => {\n setCheckoutCard(card);\n }, []);\n\n /**\n * If shopper submits the payment using the default Card component while CtP is rendered, the status here will be updated\n * and that can potentially display an iframe.\n *\n * Therefore, we use the flag 'isShopperCheckingOutWithCtp' to flag that the iframe should be displayed only in case the\n * Shopper is checking out with Click to Pay.\n */\n const displayNetworkDcf = isShopperCheckingOutWithCtp && status === 'loading' && checkoutCard?.isDcfPopupEmbedded;\n const displayCardCheckoutView = status !== 'loading' || !displayNetworkDcf;\n\n return (\n <Fragment>\n <Iframe name={CTP_IFRAME_NAME} height=\"380\" width=\"100%\" classNameModifiers={[displayNetworkDcf ? '' : 'hidden']} />\n\n {displayCardCheckoutView && (\n <Fragment>\n <CtPSection.Title>{i18n.get('ctp.cards.title')}</CtPSection.Title>\n <CtPSection.Text>{i18n.get('ctp.cards.subtitle')}</CtPSection.Text>\n\n {cards.length === 0 && <div className=\"adyen-checkout-ctp__empty-cards\">{i18n.get('ctp.emptyProfile.message')}</div>}\n {cards.length === 1 && <CtPSingleCard card={cards[0]} errorMessage={getErrorLabel(errorCode, i18n)} />}\n {cards.length > 1 && (\n <CtPCardsList\n cardSelected={checkoutCard}\n cards={cards}\n onChangeCard={handleOnChangeCard}\n errorMessage={getErrorLabel(errorCode, i18n)}\n />\n )}\n\n <PayButton\n disabled={isEveryCardExpired}\n amount={amount}\n label={getPayButtonLabel(i18n, amount, checkoutCard)}\n status={status}\n variant={isCtpPrimaryPaymentMethod ? 'primary' : 'secondary'}\n icon={\n cards.length !== 0 &&\n getImage({ imageFolder: 'components/' })(isCtpPrimaryPaymentMethod ? `${PREFIX}lock` : `${PREFIX}lock_black`)\n }\n onClick={doCheckout}\n />\n </Fragment>\n )}\n </Fragment>\n );\n};\n\nexport default CtPCards;\n"],"names":["getErrorLabel","errorCode","i18n","errorLabel","get","includes","getPayButtonLabel","amount","checkoutCard","isMobile","values","value","amountLabel","maskedData","panLastFour","CtPCards","onDisplayCardComponent","useCoreContext","getImage","useImage","cards","checkout","isCtpPrimaryPaymentMethod","status","onSubmit","onSetStatus","onError","useClickToPayContext","setCheckoutCard","useState","find","card","isExpired","setErrorCode","isEveryCardExpired","every","isShopperCheckingOutWithCtp","setIsShopperCheckingOutWithCtp","useEffect","length","doCheckout","useCallback","async","payload","error","SrciError","reason","console","warn","source","scheme","AdyenCheckoutError","cause","handleOnChangeCard","displayNetworkDcf","isDcfPopupEmbedded","displayCardCheckoutView","h","Fragment","Iframe","name","CTP_IFRAME_NAME","height","width","classNameModifiers","CtPSection","Title","Text","div","className","CtPSingleCard","errorMessage","CtPCardsList","cardSelected","onChangeCard","PayButton","disabled","label","variant","icon","imageFolder","PREFIX","onClick"],"mappings":"46BA0BA,SAASA,EAAcC,EAAmBC,GACtC,IAAKD,EAAW,OAAO,KAEvB,MAAME,EAAaD,EAAKE,IAAI,cAAcH,KAC1C,OAAIE,EAAWE,SAAS,cAAsBH,EAAKE,IAAI,4BAChDD,CACX,CAEA,SAASG,EAAkBJ,EAAgBK,EAAuBC,GAC9D,OAAKA,EACAC,IAIE,KAHIP,EAAKE,IAAI,iBAAkB,CAC9BM,OAAQ,CAAEC,MAAOC,EAAYV,EAAMK,GAASM,WAAY,QAAQL,GAAcM,iBAH5DZ,EAAKE,IAAI,YAMvC,CAEA,MAAMW,EAAW,EAAGC,6BAChB,MAAMd,KAAEA,GAASe,IACXC,EAAWC,KACXZ,OAAEA,EAAMa,MAAEA,EAAKC,SAAEA,EAAQC,0BAAEA,EAAyBC,OAAEA,EAAMC,SAAEA,EAAQC,YAAEA,EAAWC,QAAEA,GAAYC,KAChGnB,EAAcoB,GAAmBC,EAAkCT,EAAMU,MAAKC,IAASA,EAAKC,aAAcZ,EAAM,KAChHnB,EAAWgC,GAAgBJ,EAAiB,MAC7CK,EAAqBd,EAAMe,OAAMJ,GAAQA,EAAKC,aAC7CI,EAA6BC,GAAkCR,GAAkB,GAExFS,GAAU,MACe,IAAjBlB,EAAMmB,QAAgBL,IACtBlB,KACJ,GACD,CAACA,EAAwBkB,EAAoBd,IAEhD,MAAMoB,EAAaC,GAAYC,UAC3B,GAAKlC,EAEL,IACI6B,GAA+B,GAC/BJ,EAAa,MACbR,EAAY,WACZ,MAAMkB,QAAgBtB,EAASb,GAC/BgB,EAASmB,EACb,CAAE,MAAOC,GACDA,aAAiBC,IACjBZ,EAAaW,GAAOE,QACpBC,QAAQC,KAAK,2BAA2BJ,GAAOE,oBAAoBF,GAAOK,oBAAoBL,GAAOM,WAEzGb,GAA+B,GAEUX,EAArCkB,aAAiBO,EAA4BP,EACpC,IAAIO,EAAmB,QAAS,mCAAoC,CAAEC,MAAOR,IAC9F,IACD,CAACvB,EAAUb,IAER6C,EAAqBZ,GAAaV,IACpCH,EAAgBG,EAAAA,GACjB,IASGuB,EAAoBlB,GAA0C,YAAXb,GAAwBf,GAAc+C,mBACzFC,EAAqC,YAAXjC,IAAyB+B,EAEzD,OACIG,EAACC,OACGD,EAACE,EAAAA,CAAOC,KAAMC,EAAiBC,OAAO,MAAMC,MAAM,OAAOC,mBAAoB,CAACV,EAAoB,GAAK,YAEtGE,GACGC,EAACC,OACGD,EAACQ,EAAWC,MAAOhE,KAAAA,EAAKE,IAAI,oBAC5BqD,EAACQ,EAAWE,KAAI,KAAEjE,EAAKE,IAAI,uBAET,IAAjBgB,EAAMmB,QAAgBkB,EAACW,MAAAA,CAAIC,UAAU,mCAAmCnE,EAAKE,IAAI,6BAChE,IAAjBgB,EAAMmB,QAAgBkB,EAACa,EAAAA,CAAcvC,KAAMX,EAAM,GAAImD,aAAcvE,EAAcC,EAAWC,KAC5FkB,EAAMmB,OAAS,GACZkB,EAACe,EAAAA,CACGC,aAAcjE,EACdY,MAAOA,EACPsD,aAAcrB,EACdkB,aAAcvE,EAAcC,EAAWC,KAI/CuD,EAACkB,EAAAA,CACGC,SAAU1C,EACV3B,OAAQA,EACRsE,MAAOvE,EAAkBJ,EAAMK,EAAQC,GACvCe,OAAQA,EACRuD,QAASxD,EAA4B,UAAY,YACjDyD,KACqB,IAAjB3D,EAAMmB,QACNrB,EAAS,CAAE8D,YAAa,eAAxB9D,CAAyCI,EAA4B,GAAG2D,QAAe,GAAGA,eAE9FC,QAAS1C"}
@@ -1,2 +1,2 @@
1
- import{createElement as t,Fragment as o}from"../../../../../external/preact/dist/preact.js";import{useState as r,useCallback as e}from"../../../../../external/preact/hooks/dist/hooks.js";import n from"../../../Button/Button.js";import s from"../../context/useClickToPayContext.js";import i from"./CtPLoginInput.js";import{CtPInfo as a}from"../CtPInfo/CtPInfo.js";import l from"../CtPSection/CtPSection.js";import p from"../../services/sdks/SrciError.js";import{useCoreContext as m}from"../../../../../core/Context/CoreProvider.js";import c from"../../errors/TimeoutError.js";const d=()=>{const{i18n:d}=m(),{isCtpPrimaryPaymentMethod:u,setIsCtpPrimaryPaymentMethod:f,verifyIfShopperIsEnrolled:g,startIdentityValidation:C}=s(),[P,h]=r(null),[y,j]=r(!1),[I,S]=r(null),[x,E]=r(!1),[k,v]=r(null),T=e((t=>{v(t)}),[]),b=e((({data:t,isValid:o})=>{h(t.shopperLogin),j(o),t?.shopperLogin?.length>0&&f(!0)}),[]),w=e((async()=>{if(S(null),y){E(!0);try{const{isEnrolled:t}=await g({shopperEmail:P});t?await C():(S("NOT_FOUND"),E(!1))}catch(t){t instanceof p&&console.warn(`CtP - Login error: ${t.toString()}`),t instanceof c&&console.warn(t.toString()),S(t?.reason),E(!1)}}else k.validateInput()}),[g,C,P,y,k]);return t(o,null,t(l.Title,{endAdornment:t(a,null)},d.get("ctp.login.title")),t(l.Text,null,d.get("ctp.login.subtitle")),t(i,{onChange:b,onSetInputHandlers:T,disabled:x,errorMessage:I&&d.get(`ctp.errors.${I}`),onPressEnter:w}),t(n,{label:d.get("continue"),variant:u?"primary":"secondary",status:x&&"loading",onClick:()=>{w()}}))};export{d as default};
1
+ import{createElement as t,Fragment as r}from"../../../../../external/preact/dist/preact.js";import{useState as o,useCallback as e}from"../../../../../external/preact/hooks/dist/hooks.js";import n from"../../../Button/Button.js";import s from"../../context/useClickToPayContext.js";import i from"./CtPLoginInput.js";import{CtPInfo as a}from"../CtPInfo/CtPInfo.js";import l from"../CtPSection/CtPSection.js";import m from"../../services/sdks/SrciError.js";import{useCoreContext as p}from"../../../../../core/Context/CoreProvider.js";import c from"../../errors/TimeoutError.js";import{isSrciError as u}from"../../services/utils.js";const d=()=>{const{i18n:d}=p(),{isCtpPrimaryPaymentMethod:f,setIsCtpPrimaryPaymentMethod:g,verifyIfShopperIsEnrolled:C,startIdentityValidation:P}=s(),[h,j]=o(null),[y,I]=o(!1),[S,x]=o(null),[E,k]=o(!1),[v,T]=o(null),b=e((t=>{T(t)}),[]),w=e((({data:t,isValid:r})=>{j(t.shopperLogin),I(r),t?.shopperLogin?.length>0&&g(!0)}),[]),L=e((async()=>{if(x(null),y){k(!0);try{const{isEnrolled:t}=await C({shopperEmail:h});t?await P():(x("NOT_FOUND"),k(!1))}catch(t){t instanceof m&&console.warn(`CtP - Login error: ${t.toString()}`),t instanceof c&&console.warn(t.toString()),u(t)?x(t?.reason):console.error(t),k(!1)}}else v.validateInput()}),[C,P,h,y,v]);return t(r,null,t(l.Title,{endAdornment:t(a,null)},d.get("ctp.login.title")),t(l.Text,null,d.get("ctp.login.subtitle")),t(i,{onChange:w,onSetInputHandlers:b,disabled:E,errorMessage:S&&d.get(`ctp.errors.${S}`),onPressEnter:L}),t(n,{label:d.get("continue"),variant:f?"primary":"secondary",status:E&&"loading",onClick:()=>{L()}}))};export{d as default};
2
2
  //# sourceMappingURL=CtPLogin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CtPLogin.js","sources":["../../../../../../../src/components/internal/ClickToPay/components/CtPLogin/CtPLogin.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useCallback, useState } from 'preact/hooks';\nimport Button from '../../../Button';\nimport useClickToPayContext from '../../context/useClickToPayContext';\nimport CtPLoginInput, { CtPLoginInputHandlers } from './CtPLoginInput';\nimport { CtPInfo } from '../CtPInfo';\nimport CtPSection from '../CtPSection';\nimport SrciError from '../../services/sdks/SrciError';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport './CtPLogin.scss';\nimport TimeoutError from '../../errors/TimeoutError';\n\nconst CtPLogin = (): h.JSX.Element => {\n const { i18n } = useCoreContext();\n const { isCtpPrimaryPaymentMethod, setIsCtpPrimaryPaymentMethod, verifyIfShopperIsEnrolled, startIdentityValidation } = useClickToPayContext();\n const [shopperLogin, setShopperLogin] = useState<string>(null);\n const [isValid, setIsValid] = useState<boolean>(false);\n const [errorCode, setErrorCode] = useState<string>(null);\n const [isLoggingIn, setIsLoggingIn] = useState<boolean>(false);\n const [loginInputHandlers, setLoginInputHandlers] = useState<CtPLoginInputHandlers>(null);\n\n const onSetLoginInputHandlers = useCallback((handlers: CtPLoginInputHandlers) => {\n setLoginInputHandlers(handlers);\n }, []);\n\n const handleOnLoginChange = useCallback(({ data, isValid }) => {\n setShopperLogin(data.shopperLogin);\n setIsValid(isValid);\n\n // As soon as the Shopper interacts with input, the CtP becomes the primary PM\n if (data?.shopperLogin?.length > 0) {\n setIsCtpPrimaryPaymentMethod(true);\n }\n }, []);\n\n const handleOnLoginButtonClick = useCallback(async () => {\n setErrorCode(null);\n\n if (!isValid) {\n loginInputHandlers.validateInput();\n return;\n }\n\n setIsLoggingIn(true);\n\n try {\n const { isEnrolled } = await verifyIfShopperIsEnrolled({ shopperEmail: shopperLogin });\n if (isEnrolled) {\n await startIdentityValidation();\n } else {\n setErrorCode('NOT_FOUND');\n setIsLoggingIn(false);\n }\n } catch (error) {\n if (error instanceof SrciError) console.warn(`CtP - Login error: ${error.toString()}`);\n if (error instanceof TimeoutError) console.warn(error.toString());\n setErrorCode(error?.reason);\n setIsLoggingIn(false);\n }\n }, [verifyIfShopperIsEnrolled, startIdentityValidation, shopperLogin, isValid, loginInputHandlers]);\n\n return (\n <Fragment>\n <CtPSection.Title endAdornment={<CtPInfo />}>{i18n.get('ctp.login.title')}</CtPSection.Title>\n\n <CtPSection.Text>{i18n.get('ctp.login.subtitle')}</CtPSection.Text>\n\n <CtPLoginInput\n onChange={handleOnLoginChange}\n onSetInputHandlers={onSetLoginInputHandlers}\n disabled={isLoggingIn}\n errorMessage={errorCode && i18n.get(`ctp.errors.${errorCode}`)}\n onPressEnter={handleOnLoginButtonClick}\n />\n\n <Button\n label={i18n.get('continue')}\n variant={isCtpPrimaryPaymentMethod ? 'primary' : 'secondary'}\n status={isLoggingIn && 'loading'}\n onClick={() => {\n void handleOnLoginButtonClick();\n }}\n />\n </Fragment>\n );\n};\n\nexport default CtPLogin;\n"],"names":["CtPLogin","i18n","useCoreContext","isCtpPrimaryPaymentMethod","setIsCtpPrimaryPaymentMethod","verifyIfShopperIsEnrolled","startIdentityValidation","useClickToPayContext","shopperLogin","setShopperLogin","useState","isValid","setIsValid","errorCode","setErrorCode","isLoggingIn","setIsLoggingIn","loginInputHandlers","setLoginInputHandlers","onSetLoginInputHandlers","useCallback","handlers","handleOnLoginChange","data","length","handleOnLoginButtonClick","async","isEnrolled","shopperEmail","error","SrciError","console","warn","toString","TimeoutError","reason","validateInput","h","Fragment","CtPSection","Title","endAdornment","CtPInfo","get","Text","CtPLoginInput","onChange","onSetInputHandlers","disabled","errorMessage","onPressEnter","Button","label","variant","status","onClick"],"mappings":"+jBAYA,MAAMA,EAAW,KACb,MAAMC,KAAEA,GAASC,KACXC,0BAAEA,EAAyBC,6BAAEA,EAA4BC,0BAAEA,EAAyBC,wBAAEA,GAA4BC,KACjHC,EAAcC,GAAmBC,EAAiB,OAClDC,EAASC,GAAcF,GAAkB,IACzCG,EAAWC,GAAgBJ,EAAiB,OAC5CK,EAAaC,GAAkBN,GAAkB,IACjDO,EAAoBC,GAAyBR,EAAgC,MAE9ES,EAA0BC,GAAaC,IACzCH,EAAsBG,EAAAA,GACvB,IAEGC,EAAsBF,GAAY,EAAGG,OAAMZ,cAC7CF,EAAgBc,EAAKf,cACrBI,EAAWD,GAGPY,GAAMf,cAAcgB,OAAS,GAC7BpB,GAA6B,EACjC,GACD,IAEGqB,EAA2BL,GAAYM,UAGzC,GAFAZ,EAAa,MAERH,EAAL,CAKAK,GAAe,GAEf,IACI,MAAMW,WAAEA,SAAqBtB,EAA0B,CAAEuB,aAAcpB,IACnEmB,QACMrB,KAENQ,EAAa,aACbE,GAAe,GAEvB,CAAE,MAAOa,GACDA,aAAiBC,GAAWC,QAAQC,KAAK,sBAAsBH,EAAMI,cACrEJ,aAAiBK,GAAcH,QAAQC,KAAKH,EAAMI,YACtDnB,EAAae,GAAOM,QACpBnB,GAAe,EACnB,CAjBA,MAFIC,EAAmBmB,eAmBvB,GACD,CAAC/B,EAA2BC,EAAyBE,EAAcG,EAASM,IAE/E,OACIoB,EAACC,EAAAA,KACGD,EAACE,EAAWC,MAAK,CAACC,aAAcJ,EAACK,EAAAA,OAAazC,EAAK0C,IAAI,oBAEvDN,EAACE,EAAWK,KAAI,KAAE3C,EAAK0C,IAAI,uBAE3BN,EAACQ,EAAAA,CACGC,SAAUxB,EACVyB,mBAAoB5B,EACpB6B,SAAUjC,EACVkC,aAAcpC,GAAaZ,EAAK0C,IAAI,cAAc9B,KAClDqC,aAAczB,IAGlBY,EAACc,EAAAA,CACGC,MAAOnD,EAAK0C,IAAI,YAChBU,QAASlD,EAA4B,UAAY,YACjDmD,OAAQvC,GAAe,UACvBwC,QAAS,KACA9B,GAAAA"}
1
+ {"version":3,"file":"CtPLogin.js","sources":["../../../../../../../src/components/internal/ClickToPay/components/CtPLogin/CtPLogin.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useCallback, useState } from 'preact/hooks';\nimport Button from '../../../Button';\nimport useClickToPayContext from '../../context/useClickToPayContext';\nimport CtPLoginInput, { CtPLoginInputHandlers } from './CtPLoginInput';\nimport { CtPInfo } from '../CtPInfo';\nimport CtPSection from '../CtPSection';\nimport SrciError from '../../services/sdks/SrciError';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport './CtPLogin.scss';\nimport TimeoutError from '../../errors/TimeoutError';\nimport { isSrciError } from '../../services/utils';\n\nconst CtPLogin = (): h.JSX.Element => {\n const { i18n } = useCoreContext();\n const { isCtpPrimaryPaymentMethod, setIsCtpPrimaryPaymentMethod, verifyIfShopperIsEnrolled, startIdentityValidation } = useClickToPayContext();\n const [shopperLogin, setShopperLogin] = useState<string>(null);\n const [isValid, setIsValid] = useState<boolean>(false);\n const [errorCode, setErrorCode] = useState<string>(null);\n const [isLoggingIn, setIsLoggingIn] = useState<boolean>(false);\n const [loginInputHandlers, setLoginInputHandlers] = useState<CtPLoginInputHandlers>(null);\n\n const onSetLoginInputHandlers = useCallback((handlers: CtPLoginInputHandlers) => {\n setLoginInputHandlers(handlers);\n }, []);\n\n const handleOnLoginChange = useCallback(({ data, isValid }) => {\n setShopperLogin(data.shopperLogin);\n setIsValid(isValid);\n\n // As soon as the Shopper interacts with input, the CtP becomes the primary PM\n if (data?.shopperLogin?.length > 0) {\n setIsCtpPrimaryPaymentMethod(true);\n }\n }, []);\n\n const handleOnLoginButtonClick = useCallback(async () => {\n setErrorCode(null);\n\n if (!isValid) {\n loginInputHandlers.validateInput();\n return;\n }\n\n setIsLoggingIn(true);\n\n try {\n const { isEnrolled } = await verifyIfShopperIsEnrolled({ shopperEmail: shopperLogin });\n if (isEnrolled) {\n await startIdentityValidation();\n } else {\n setErrorCode('NOT_FOUND');\n setIsLoggingIn(false);\n }\n } catch (error: unknown) {\n if (error instanceof SrciError) console.warn(`CtP - Login error: ${error.toString()}`);\n if (error instanceof TimeoutError) console.warn(error.toString());\n if (isSrciError(error)) setErrorCode(error?.reason);\n else console.error(error);\n\n setIsLoggingIn(false);\n }\n }, [verifyIfShopperIsEnrolled, startIdentityValidation, shopperLogin, isValid, loginInputHandlers]);\n\n return (\n <Fragment>\n <CtPSection.Title endAdornment={<CtPInfo />}>{i18n.get('ctp.login.title')}</CtPSection.Title>\n\n <CtPSection.Text>{i18n.get('ctp.login.subtitle')}</CtPSection.Text>\n\n <CtPLoginInput\n onChange={handleOnLoginChange}\n onSetInputHandlers={onSetLoginInputHandlers}\n disabled={isLoggingIn}\n errorMessage={errorCode && i18n.get(`ctp.errors.${errorCode}`)}\n onPressEnter={handleOnLoginButtonClick}\n />\n\n <Button\n label={i18n.get('continue')}\n variant={isCtpPrimaryPaymentMethod ? 'primary' : 'secondary'}\n status={isLoggingIn && 'loading'}\n onClick={() => {\n void handleOnLoginButtonClick();\n }}\n />\n </Fragment>\n );\n};\n\nexport default CtPLogin;\n"],"names":["CtPLogin","i18n","useCoreContext","isCtpPrimaryPaymentMethod","setIsCtpPrimaryPaymentMethod","verifyIfShopperIsEnrolled","startIdentityValidation","useClickToPayContext","shopperLogin","setShopperLogin","useState","isValid","setIsValid","errorCode","setErrorCode","isLoggingIn","setIsLoggingIn","loginInputHandlers","setLoginInputHandlers","onSetLoginInputHandlers","useCallback","handlers","handleOnLoginChange","data","length","handleOnLoginButtonClick","async","isEnrolled","shopperEmail","error","SrciError","console","warn","toString","TimeoutError","isSrciError","reason","validateInput","h","Fragment","CtPSection","Title","endAdornment","CtPInfo","get","Text","CtPLoginInput","onChange","onSetInputHandlers","disabled","errorMessage","onPressEnter","Button","label","variant","status","onClick"],"mappings":"qnBAaA,MAAMA,EAAW,KACb,MAAMC,KAAEA,GAASC,KACXC,0BAAEA,EAAyBC,6BAAEA,EAA4BC,0BAAEA,EAAyBC,wBAAEA,GAA4BC,KACjHC,EAAcC,GAAmBC,EAAiB,OAClDC,EAASC,GAAcF,GAAkB,IACzCG,EAAWC,GAAgBJ,EAAiB,OAC5CK,EAAaC,GAAkBN,GAAkB,IACjDO,EAAoBC,GAAyBR,EAAgC,MAE9ES,EAA0BC,GAAaC,IACzCH,EAAsBG,EAAAA,GACvB,IAEGC,EAAsBF,GAAY,EAAGG,OAAMZ,cAC7CF,EAAgBc,EAAKf,cACrBI,EAAWD,GAGPY,GAAMf,cAAcgB,OAAS,GAC7BpB,GAA6B,EACjC,GACD,IAEGqB,EAA2BL,GAAYM,UAGzC,GAFAZ,EAAa,MAERH,EAAL,CAKAK,GAAe,GAEf,IACI,MAAMW,WAAEA,SAAqBtB,EAA0B,CAAEuB,aAAcpB,IACnEmB,QACMrB,KAENQ,EAAa,aACbE,GAAe,GAEvB,CAAE,MAAOa,GACDA,aAAiBC,GAAWC,QAAQC,KAAK,sBAAsBH,EAAMI,cACrEJ,aAAiBK,GAAcH,QAAQC,KAAKH,EAAMI,YAClDE,EAAYN,GAAQf,EAAae,GAAOO,QACvCL,QAAQF,MAAMA,GAEnBb,GAAe,EACnB,CAnBA,MAFIC,EAAmBoB,eAqBvB,GACD,CAAChC,EAA2BC,EAAyBE,EAAcG,EAASM,IAE/E,OACIqB,EAACC,EAAAA,KACGD,EAACE,EAAWC,MAAK,CAACC,aAAcJ,EAACK,EAAAA,OAAa1C,EAAK2C,IAAI,oBAEvDN,EAACE,EAAWK,KAAI,KAAE5C,EAAK2C,IAAI,uBAE3BN,EAACQ,EAAAA,CACGC,SAAUzB,EACV0B,mBAAoB7B,EACpB8B,SAAUlC,EACVmC,aAAcrC,GAAaZ,EAAK2C,IAAI,cAAc/B,KAClDsC,aAAc1B,IAGlBa,EAACc,EAAAA,CACGC,MAAOpD,EAAK2C,IAAI,YAChBU,QAASnD,EAA4B,UAAY,YACjDoD,OAAQxC,GAAe,UACvByC,QAAS,KACA/B,GAAAA"}
@@ -1,2 +1,2 @@
1
- import{createElement as t,Fragment as e}from"../../../../../external/preact/dist/preact.js";import{useState as o,useCallback as n}from"../../../../../external/preact/hooks/dist/hooks.js";import a from"../../../Button/Button.js";import s from"../../context/useClickToPayContext.js";import r from"./CtPOneTimePasswordInput/CtPOneTimePasswordInput.js";import{CtPInfo as i}from"../CtPInfo/CtPInfo.js";import l from"../CtPSection/CtPSection.js";import{useCoreContext as p}from"../../../../../core/Context/CoreProvider.js";import d from"./CtPSaveCookiesCheckbox/CtPSaveCookiesCheckbox.js";const c=({onDisplayCardComponent:c})=>{const{i18n:m}=p(),{finishIdentityValidation:C,otpMaskedContact:u,otpNetwork:P,isCtpPrimaryPaymentMethod:f}=s(),[h,k]=o(null),[g,y]=o(!1),[j,x]=o(!1),[I,b]=o(null),[S,T]=o(null),[v,w]=o(!1),B=n((t=>{T(t)}),[]),E=n((({data:t,isValid:e})=>{k(t.otp),y(e)}),[]),O=n((()=>{b(null)}),[]),A=n((async()=>{if(b(null),g){x(!0);try{await C(h)}catch(t){b(t?.reason),x(!1),"ACCT_INACCESSIBLE"===t?.reason&&(w(!0),c?.())}}else S.validateInput()}),[h,g,S,c]),M=m.get("ctp.otp.subtitle").split("%@");return t(e,null,t(l.Title,{endAdornment:t(i,null)},m.get("ctp.otp.title")),t(l.Text,null,M[0]," ",P," ",M[1],t("span",{className:"adyen-checkout-ctp__otp-subtitle--highlighted"},u),M[2]),t(r,{hideResendOtpButton:v,onChange:E,onSetInputHandlers:B,disabled:j,errorMessage:I&&m.get(`ctp.errors.${I}`),onPressEnter:A,onResendCode:O,isValidatingOtp:j}),t(d,null),t(a,{disabled:v,label:m.get("continue"),variant:f?"primary":"secondary",onClick:A,status:j&&"loading"}))};export{c as default};
1
+ import{createElement as t,Fragment as e}from"../../../../../external/preact/dist/preact.js";import{useState as o,useCallback as n}from"../../../../../external/preact/hooks/dist/hooks.js";import s from"../../../Button/Button.js";import r from"../../context/useClickToPayContext.js";import a from"./CtPOneTimePasswordInput/CtPOneTimePasswordInput.js";import{CtPInfo as i}from"../CtPInfo/CtPInfo.js";import l from"../CtPSection/CtPSection.js";import{useCoreContext as p}from"../../../../../core/Context/CoreProvider.js";import d from"./CtPSaveCookiesCheckbox/CtPSaveCookiesCheckbox.js";import{isSrciError as m}from"../../services/utils.js";const c=({onDisplayCardComponent:c})=>{const{i18n:u}=p(),{finishIdentityValidation:C,otpMaskedContact:f,otpNetwork:P,isCtpPrimaryPaymentMethod:h}=r(),[k,g]=o(null),[j,y]=o(!1),[x,I]=o(!1),[b,S]=o(null),[v,T]=o(null),[w,B]=o(!1),E=n((t=>{T(t)}),[]),O=n((({data:t,isValid:e})=>{g(t.otp),y(e)}),[]),A=n((()=>{S(null)}),[]),M=n((async()=>{if(S(null),j){I(!0);try{await C(k)}catch(t){if(!m(t))return void I(!1);S(t?.reason),I(!1),"ACCT_INACCESSIBLE"===t?.reason&&(B(!0),c?.())}}else v.validateInput()}),[k,j,v,c]),N=u.get("ctp.otp.subtitle").split("%@");return t(e,null,t(l.Title,{endAdornment:t(i,null)},u.get("ctp.otp.title")),t(l.Text,null,N[0]," ",P," ",N[1],t("span",{className:"adyen-checkout-ctp__otp-subtitle--highlighted"},f),N[2]),t(a,{hideResendOtpButton:w,onChange:O,onSetInputHandlers:E,disabled:x,errorMessage:b&&u.get(`ctp.errors.${b}`),onPressEnter:M,onResendCode:A,isValidatingOtp:x}),t(d,null),t(s,{disabled:w,label:u.get("continue"),variant:h?"primary":"secondary",onClick:M,status:x&&"loading"}))};export{c as default};
2
2
  //# sourceMappingURL=CtPOneTimePassword.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CtPOneTimePassword.js","sources":["../../../../../../../src/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePassword.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useCallback, useState } from 'preact/hooks';\nimport Button from '../../../Button';\nimport useClickToPayContext from '../../context/useClickToPayContext';\nimport CtPOneTimePasswordInput from './CtPOneTimePasswordInput';\nimport { CtPOneTimePasswordInputHandlers } from './CtPOneTimePasswordInput/CtPOneTimePasswordInput';\nimport { CtPInfo } from '../CtPInfo';\nimport CtPSection from '../CtPSection';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport './CtPOneTimePassword.scss';\nimport CtPSaveCookiesCheckbox from './CtPSaveCookiesCheckbox';\n\ntype CtPOneTimePasswordProps = {\n onDisplayCardComponent?(): void;\n};\nconst CtPOneTimePassword = ({ onDisplayCardComponent }: CtPOneTimePasswordProps): h.JSX.Element => {\n const { i18n } = useCoreContext();\n const { finishIdentityValidation, otpMaskedContact, otpNetwork, isCtpPrimaryPaymentMethod } = useClickToPayContext();\n const [otp, setOtp] = useState<string>(null);\n const [isValid, setIsValid] = useState<boolean>(false);\n const [isValidatingOtp, setIsValidatingOtp] = useState<boolean>(false);\n const [errorCode, setErrorCode] = useState<string>(null);\n const [otpInputHandlers, setOtpInputHandlers] = useState<CtPOneTimePasswordInputHandlers>(null);\n const [isAccountLocked, setIsAccountLocked] = useState<boolean>(false);\n\n const onSetOtpInputHandlers = useCallback((handlers: CtPOneTimePasswordInputHandlers) => {\n setOtpInputHandlers(handlers);\n }, []);\n\n const onChangeOtpInput = useCallback(({ data, isValid }) => {\n setOtp(data.otp);\n setIsValid(isValid);\n }, []);\n\n const onResendCode = useCallback(() => {\n setErrorCode(null);\n }, []);\n\n const onSubmitPassword = useCallback(async () => {\n setErrorCode(null);\n\n if (!isValid) {\n otpInputHandlers.validateInput();\n return;\n }\n\n setIsValidatingOtp(true);\n\n try {\n await finishIdentityValidation(otp);\n } catch (error) {\n setErrorCode(error?.reason);\n setIsValidatingOtp(false);\n\n if (error?.reason === 'ACCT_INACCESSIBLE') {\n setIsAccountLocked(true);\n onDisplayCardComponent?.();\n }\n }\n }, [otp, isValid, otpInputHandlers, onDisplayCardComponent]);\n\n const subtitleParts = i18n.get('ctp.otp.subtitle').split('%@');\n\n return (\n <Fragment>\n <CtPSection.Title endAdornment={<CtPInfo />}>{i18n.get('ctp.otp.title')}</CtPSection.Title>\n\n <CtPSection.Text>\n {subtitleParts[0]} {otpNetwork} {subtitleParts[1]}\n <span className=\"adyen-checkout-ctp__otp-subtitle--highlighted\">{otpMaskedContact}</span>\n {subtitleParts[2]}\n </CtPSection.Text>\n\n <CtPOneTimePasswordInput\n hideResendOtpButton={isAccountLocked}\n onChange={onChangeOtpInput}\n onSetInputHandlers={onSetOtpInputHandlers}\n disabled={isValidatingOtp}\n errorMessage={errorCode && i18n.get(`ctp.errors.${errorCode}`)}\n onPressEnter={onSubmitPassword}\n onResendCode={onResendCode}\n isValidatingOtp={isValidatingOtp}\n />\n\n <CtPSaveCookiesCheckbox />\n\n <Button\n disabled={isAccountLocked}\n label={i18n.get('continue')}\n variant={isCtpPrimaryPaymentMethod ? 'primary' : 'secondary'}\n onClick={onSubmitPassword}\n status={isValidatingOtp && 'loading'}\n />\n </Fragment>\n );\n};\n\nexport default CtPOneTimePassword;\n"],"names":["CtPOneTimePassword","onDisplayCardComponent","i18n","useCoreContext","finishIdentityValidation","otpMaskedContact","otpNetwork","isCtpPrimaryPaymentMethod","useClickToPayContext","otp","setOtp","useState","isValid","setIsValid","isValidatingOtp","setIsValidatingOtp","errorCode","setErrorCode","otpInputHandlers","setOtpInputHandlers","isAccountLocked","setIsAccountLocked","onSetOtpInputHandlers","useCallback","handlers","onChangeOtpInput","data","onResendCode","onSubmitPassword","async","error","reason","validateInput","subtitleParts","get","split","h","Fragment","CtPSection","Title","endAdornment","CtPInfo","Text","span","className","CtPOneTimePasswordInput","hideResendOtpButton","onChange","onSetInputHandlers","disabled","errorMessage","onPressEnter","CtPSaveCookiesCheckbox","Button","label","variant","onClick","status"],"mappings":"ukBAeA,MAAMA,EAAqB,EAAGC,6BAC1B,MAAMC,KAAEA,GAASC,KACXC,yBAAEA,EAAwBC,iBAAEA,EAAgBC,WAAEA,EAAUC,0BAAEA,GAA8BC,KACvFC,EAAKC,GAAUC,EAAiB,OAChCC,EAASC,GAAcF,GAAkB,IACzCG,EAAiBC,GAAsBJ,GAAkB,IACzDK,EAAWC,GAAgBN,EAAiB,OAC5CO,EAAkBC,GAAuBR,EAA0C,OACnFS,EAAiBC,GAAsBV,GAAkB,GAE1DW,EAAwBC,GAAaC,IACvCL,EAAoBK,EAAAA,GACrB,IAEGC,EAAmBF,GAAY,EAAGG,OAAMd,cAC1CF,EAAOgB,EAAKjB,KACZI,EAAWD,EAAAA,GACZ,IAEGe,EAAeJ,GAAY,KAC7BN,EAAa,KAAA,GACd,IAEGW,EAAmBL,GAAYM,UAGjC,GAFAZ,EAAa,MAERL,EAAL,CAKAG,GAAmB,GAEnB,UACUX,EAAyBK,EACnC,CAAE,MAAOqB,GACLb,EAAaa,GAAOC,QACpBhB,GAAmB,GAEG,sBAAlBe,GAAOC,SACPV,GAAmB,GACnBpB,MAER,CAdA,MAFIiB,EAAiBc,eAgBrB,GACD,CAACvB,EAAKG,EAASM,EAAkBjB,IAE9BgC,EAAgB/B,EAAKgC,IAAI,oBAAoBC,MAAM,MAEzD,OACIC,EAACC,EAAAA,KACGD,EAACE,EAAWC,MAAK,CAACC,aAAcJ,EAACK,EAAAA,OAAavC,EAAKgC,IAAI,kBAEvDE,EAACE,EAAWI,UACPT,EAAc,GAAG,IAAE3B,EAAW,IAAE2B,EAAc,GAC/CG,EAACO,OAAAA,CAAKC,UAAU,iDAAiDvC,GAChE4B,EAAc,IAGnBG,EAACS,EAAAA,CACGC,oBAAqB1B,EACrB2B,SAAUtB,EACVuB,mBAAoB1B,EACpB2B,SAAUnC,EACVoC,aAAclC,GAAad,EAAKgC,IAAI,cAAclB,KAClDmC,aAAcvB,EACdD,aAAcA,EACdb,gBAAiBA,IAGrBsB,EAACgB,QAEDhB,EAACiB,EAAAA,CACGJ,SAAU7B,EACVkC,MAAOpD,EAAKgC,IAAI,YAChBqB,QAAShD,EAA4B,UAAY,YACjDiD,QAAS5B,EACT6B,OAAQ3C,GAAmB"}
1
+ {"version":3,"file":"CtPOneTimePassword.js","sources":["../../../../../../../src/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePassword.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useCallback, useState } from 'preact/hooks';\nimport Button from '../../../Button';\nimport useClickToPayContext from '../../context/useClickToPayContext';\nimport CtPOneTimePasswordInput from './CtPOneTimePasswordInput';\nimport { CtPOneTimePasswordInputHandlers } from './CtPOneTimePasswordInput/CtPOneTimePasswordInput';\nimport { CtPInfo } from '../CtPInfo';\nimport CtPSection from '../CtPSection';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport './CtPOneTimePassword.scss';\nimport CtPSaveCookiesCheckbox from './CtPSaveCookiesCheckbox';\nimport { isSrciError } from '../../services/utils';\n\ntype CtPOneTimePasswordProps = {\n onDisplayCardComponent?(): void;\n};\nconst CtPOneTimePassword = ({ onDisplayCardComponent }: CtPOneTimePasswordProps): h.JSX.Element => {\n const { i18n } = useCoreContext();\n const { finishIdentityValidation, otpMaskedContact, otpNetwork, isCtpPrimaryPaymentMethod } = useClickToPayContext();\n const [otp, setOtp] = useState<string>(null);\n const [isValid, setIsValid] = useState<boolean>(false);\n const [isValidatingOtp, setIsValidatingOtp] = useState<boolean>(false);\n const [errorCode, setErrorCode] = useState<string>(null);\n const [otpInputHandlers, setOtpInputHandlers] = useState<CtPOneTimePasswordInputHandlers>(null);\n const [isAccountLocked, setIsAccountLocked] = useState<boolean>(false);\n\n const onSetOtpInputHandlers = useCallback((handlers: CtPOneTimePasswordInputHandlers) => {\n setOtpInputHandlers(handlers);\n }, []);\n\n const onChangeOtpInput = useCallback(({ data, isValid }) => {\n setOtp(data.otp);\n setIsValid(isValid);\n }, []);\n\n const onResendCode = useCallback(() => {\n setErrorCode(null);\n }, []);\n\n const onSubmitPassword = useCallback(async () => {\n setErrorCode(null);\n\n if (!isValid) {\n otpInputHandlers.validateInput();\n return;\n }\n\n setIsValidatingOtp(true);\n\n try {\n await finishIdentityValidation(otp);\n } catch (error: unknown) {\n if (!isSrciError(error)) {\n setIsValidatingOtp(false);\n return;\n }\n\n setErrorCode(error?.reason);\n setIsValidatingOtp(false);\n\n if (error?.reason === 'ACCT_INACCESSIBLE') {\n setIsAccountLocked(true);\n onDisplayCardComponent?.();\n }\n }\n }, [otp, isValid, otpInputHandlers, onDisplayCardComponent]);\n\n const subtitleParts = i18n.get('ctp.otp.subtitle').split('%@');\n\n return (\n <Fragment>\n <CtPSection.Title endAdornment={<CtPInfo />}>{i18n.get('ctp.otp.title')}</CtPSection.Title>\n\n <CtPSection.Text>\n {subtitleParts[0]} {otpNetwork} {subtitleParts[1]}\n <span className=\"adyen-checkout-ctp__otp-subtitle--highlighted\">{otpMaskedContact}</span>\n {subtitleParts[2]}\n </CtPSection.Text>\n\n <CtPOneTimePasswordInput\n hideResendOtpButton={isAccountLocked}\n onChange={onChangeOtpInput}\n onSetInputHandlers={onSetOtpInputHandlers}\n disabled={isValidatingOtp}\n errorMessage={errorCode && i18n.get(`ctp.errors.${errorCode}`)}\n onPressEnter={onSubmitPassword}\n onResendCode={onResendCode}\n isValidatingOtp={isValidatingOtp}\n />\n\n <CtPSaveCookiesCheckbox />\n\n <Button\n disabled={isAccountLocked}\n label={i18n.get('continue')}\n variant={isCtpPrimaryPaymentMethod ? 'primary' : 'secondary'}\n onClick={onSubmitPassword}\n status={isValidatingOtp && 'loading'}\n />\n </Fragment>\n );\n};\n\nexport default CtPOneTimePassword;\n"],"names":["CtPOneTimePassword","onDisplayCardComponent","i18n","useCoreContext","finishIdentityValidation","otpMaskedContact","otpNetwork","isCtpPrimaryPaymentMethod","useClickToPayContext","otp","setOtp","useState","isValid","setIsValid","isValidatingOtp","setIsValidatingOtp","errorCode","setErrorCode","otpInputHandlers","setOtpInputHandlers","isAccountLocked","setIsAccountLocked","onSetOtpInputHandlers","useCallback","handlers","onChangeOtpInput","data","onResendCode","onSubmitPassword","async","error","isSrciError","reason","validateInput","subtitleParts","get","split","h","Fragment","CtPSection","Title","endAdornment","CtPInfo","Text","span","className","CtPOneTimePasswordInput","hideResendOtpButton","onChange","onSetInputHandlers","disabled","errorMessage","onPressEnter","CtPSaveCookiesCheckbox","Button","label","variant","onClick","status"],"mappings":"6nBAgBA,MAAMA,EAAqB,EAAGC,6BAC1B,MAAMC,KAAEA,GAASC,KACXC,yBAAEA,EAAwBC,iBAAEA,EAAgBC,WAAEA,EAAUC,0BAAEA,GAA8BC,KACvFC,EAAKC,GAAUC,EAAiB,OAChCC,EAASC,GAAcF,GAAkB,IACzCG,EAAiBC,GAAsBJ,GAAkB,IACzDK,EAAWC,GAAgBN,EAAiB,OAC5CO,EAAkBC,GAAuBR,EAA0C,OACnFS,EAAiBC,GAAsBV,GAAkB,GAE1DW,EAAwBC,GAAaC,IACvCL,EAAoBK,EAAAA,GACrB,IAEGC,EAAmBF,GAAY,EAAGG,OAAMd,cAC1CF,EAAOgB,EAAKjB,KACZI,EAAWD,EAAAA,GACZ,IAEGe,EAAeJ,GAAY,KAC7BN,EAAa,KAAA,GACd,IAEGW,EAAmBL,GAAYM,UAGjC,GAFAZ,EAAa,MAERL,EAAL,CAKAG,GAAmB,GAEnB,UACUX,EAAyBK,EACnC,CAAE,MAAOqB,GACL,IAAKC,EAAYD,GAEb,YADAf,GAAmB,GAIvBE,EAAaa,GAAOE,QACpBjB,GAAmB,GAEG,sBAAlBe,GAAOE,SACPX,GAAmB,GACnBpB,MAER,CAnBA,MAFIiB,EAAiBe,eAqBrB,GACD,CAACxB,EAAKG,EAASM,EAAkBjB,IAE9BiC,EAAgBhC,EAAKiC,IAAI,oBAAoBC,MAAM,MAEzD,OACIC,EAACC,EAAAA,KACGD,EAACE,EAAWC,MAAK,CAACC,aAAcJ,EAACK,EAAAA,OAAaxC,EAAKiC,IAAI,kBAEvDE,EAACE,EAAWI,UACPT,EAAc,GAAG,IAAE5B,EAAW,IAAE4B,EAAc,GAC/CG,EAACO,OAAAA,CAAKC,UAAU,iDAAiDxC,GAChE6B,EAAc,IAGnBG,EAACS,EAAAA,CACGC,oBAAqB3B,EACrB4B,SAAUvB,EACVwB,mBAAoB3B,EACpB4B,SAAUpC,EACVqC,aAAcnC,GAAad,EAAKiC,IAAI,cAAcnB,KAClDoC,aAAcxB,EACdD,aAAcA,EACdb,gBAAiBA,IAGrBuB,EAACgB,QAEDhB,EAACiB,EAAAA,CACGJ,SAAU9B,EACVmC,MAAOrD,EAAKiC,IAAI,YAChBqB,QAASjD,EAA4B,UAAY,YACjDkD,QAAS7B,EACT8B,OAAQ5C,GAAmB"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../../external/preact/dist/preact.js";import{useState as t,useEffect as o,useCallback as c}from"../../../../../../external/preact/hooks/dist/hooks.js";import s from"../../../context/useClickToPayContext.js";import a from"../../../../../../external/classnames/index.js";import{useCoreContext as r}from"../../../../../../core/Context/CoreProvider.js";import n from"../../../../Icon/Icon.js";const d=({onError:d,onResendCode:i,disabled:l})=>{const[p,m]=t(null),[u,k]=t(!1),{i18n:h}=r(),{startIdentityValidation:f}=s();o((()=>{let e=null;return p>0&&(e=setTimeout((()=>m(p-1)),1e3)),()=>clearTimeout(e)}),[p]),o((()=>{let e=null;return u&&(e=setTimeout((()=>{k(!1),m(60)}),2e3)),()=>clearTimeout(e)}),[u]);const y=c((async e=>{e.preventDefault();try{i(),k(!0),await f()}catch(e){d(e.reason),m(0),k(!1)}}),[f,d,i]);return u?e("div",{className:"adyen-checkout-ctp__otp-resend-code--confirmation"},h.get("ctp.otp.codeResent"),e(n,{type:"checkmark",height:14,width:14})):p>0?e("div",{className:"adyen-checkout-ctp__otp-resend-code--disabled"},h.get("ctp.otp.resendCode")," -"," ",e("span",{className:"adyen-checkout-ctp__otp-resend-code-counter"}," ",p>0&&`${p}s`," ")):e("div",{role:"link",tabIndex:0,className:a("adyen-checkout-ctp__otp-resend-code",{"adyen-checkout-ctp__otp-resend-code--disabled":l}),onClick:y},h.get("ctp.otp.resendCode"))};export{d as default};
1
+ import{createElement as e}from"../../../../../../external/preact/dist/preact.js";import{useState as t,useEffect as o,useCallback as r}from"../../../../../../external/preact/hooks/dist/hooks.js";import s from"../../../context/useClickToPayContext.js";import c from"../../../../../../external/classnames/index.js";import{useCoreContext as n}from"../../../../../../core/Context/CoreProvider.js";import a from"../../../../Icon/Icon.js";import{isSrciError as d}from"../../../services/utils.js";import{PREFIX as i}from"../../../../Icon/constants.js";const l=({onError:l,onResendCode:p,disabled:m})=>{const[u,f]=t(null),[k,h]=t(!1),{i18n:y}=n(),{startIdentityValidation:_}=s();o((()=>{let e=null;return u>0&&(e=setTimeout((()=>f(u-1)),1e3)),()=>clearTimeout(e)}),[u]),o((()=>{let e=null;return k&&(e=setTimeout((()=>{h(!1),f(60)}),2e3)),()=>clearTimeout(e)}),[k]);const x=r((async e=>{e.preventDefault();try{p(),h(!0),await _()}catch(e){if(f(0),h(!1),!d(e))return void console.error(e);l(e.reason)}}),[_,l,p]);return k?e("div",{className:"adyen-checkout-ctp__otp-resend-code--confirmation"},y.get("ctp.otp.codeResent"),e(a,{type:`${i}checkmark`,height:14,width:14})):u>0?e("div",{className:"adyen-checkout-ctp__otp-resend-code--disabled"},y.get("ctp.otp.resendCode")," -"," ",e("span",{className:"adyen-checkout-ctp__otp-resend-code-counter"}," ",u>0&&`${u}s`," ")):e("div",{role:"link",tabIndex:0,className:c("adyen-checkout-ctp__otp-resend-code",{"adyen-checkout-ctp__otp-resend-code--disabled":m}),onClick:x},y.get("ctp.otp.resendCode"))};export{l as default};
2
2
  //# sourceMappingURL=CtPResendOtpLink.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CtPResendOtpLink.js","sources":["../../../../../../../../src/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback, useEffect, useState } from 'preact/hooks';\nimport useClickToPayContext from '../../../context/useClickToPayContext';\nimport classnames from 'classnames';\nimport { useCoreContext } from '../../../../../../core/Context/CoreProvider';\nimport Icon from '../../../../Icon';\n\nconst CONFIRMATION_SHOWING_TIME = 2000;\n\ninterface CtPResendOtpLinkProps {\n onError(errorCode: string): void;\n onResendCode(): void;\n disabled: boolean;\n}\n\nconst CtPResendOtpLink = ({ onError, onResendCode, disabled }: CtPResendOtpLinkProps): h.JSX.Element => {\n const [counter, setCounter] = useState<number>(null);\n const [showConfirmation, setShowConfirmation] = useState<boolean>(false);\n const { i18n } = useCoreContext();\n const { startIdentityValidation } = useClickToPayContext();\n\n useEffect(() => {\n let timeout = null;\n if (counter > 0) {\n timeout = setTimeout(() => setCounter(counter - 1), 1000);\n }\n return () => clearTimeout(timeout);\n }, [counter]);\n\n useEffect(() => {\n let timeout = null;\n\n if (showConfirmation) {\n timeout = setTimeout(() => {\n setShowConfirmation(false);\n setCounter(60);\n }, CONFIRMATION_SHOWING_TIME);\n }\n return () => clearTimeout(timeout);\n }, [showConfirmation]);\n\n const handleResendCodeClick = useCallback(\n async event => {\n event.preventDefault();\n\n try {\n onResendCode();\n setShowConfirmation(true);\n await startIdentityValidation();\n } catch (error) {\n onError(error.reason);\n setCounter(0);\n setShowConfirmation(false);\n }\n },\n [startIdentityValidation, onError, onResendCode]\n );\n\n if (showConfirmation) {\n return (\n <div className=\"adyen-checkout-ctp__otp-resend-code--confirmation\">\n {i18n.get('ctp.otp.codeResent')}\n <Icon type=\"checkmark\" height={14} width={14} />\n </div>\n );\n }\n\n if (counter > 0) {\n return (\n <div className=\"adyen-checkout-ctp__otp-resend-code--disabled\">\n {i18n.get('ctp.otp.resendCode')} -{' '}\n <span className=\"adyen-checkout-ctp__otp-resend-code-counter\"> {counter > 0 && `${counter}s`} </span>\n </div>\n );\n }\n\n return (\n <div\n role=\"link\"\n tabIndex={0}\n className={classnames('adyen-checkout-ctp__otp-resend-code', { 'adyen-checkout-ctp__otp-resend-code--disabled': disabled })}\n onClick={handleResendCodeClick}\n >\n {i18n.get('ctp.otp.resendCode')}\n </div>\n );\n};\n\nexport default CtPResendOtpLink;\n"],"names":["CtPResendOtpLink","onError","onResendCode","disabled","counter","setCounter","useState","showConfirmation","setShowConfirmation","i18n","useCoreContext","startIdentityValidation","useClickToPayContext","useEffect","timeout","setTimeout","clearTimeout","handleResendCodeClick","useCallback","async","event","preventDefault","error","reason","h","div","className","get","Icon","type","height","width","span","role","tabIndex","classnames","onClick"],"mappings":"gbAOA,MAQMA,EAAmB,EAAGC,UAASC,eAAcC,eAC/C,MAAOC,EAASC,GAAcC,EAAiB,OACxCC,EAAkBC,GAAuBF,GAAkB,IAC5DG,KAAEA,GAASC,KACXC,wBAAEA,GAA4BC,IAEpCC,GAAU,KACN,IAAIC,EAAU,KAId,OAHIV,EAAU,IACVU,EAAUC,YAAW,IAAMV,EAAWD,EAAU,IAAI,MAEjD,IAAMY,aAAaF,EAAAA,GAC3B,CAACV,IAEJS,GAAU,KACN,IAAIC,EAAU,KAQd,OANIP,IACAO,EAAUC,YAAW,KACjBP,GAAoB,GACpBH,EAAW,GAAA,GA5BO,MA+BnB,IAAMW,aAAaF,EAAAA,GAC3B,CAACP,IAEJ,MAAMU,EAAwBC,GAC1BC,MAAMC,IACFA,EAAMC,iBAEN,IACInB,IACAM,GAAoB,SACdG,GACV,CAAE,MAAOW,GACLrB,EAAQqB,EAAMC,QACdlB,EAAW,GACXG,GAAoB,EACxB,IAEJ,CAACG,EAAyBV,EAASC,IAGvC,OAAIK,EAEIiB,EAACC,MAAAA,CAAIC,UAAU,qDACVjB,EAAKkB,IAAI,sBACVH,EAACI,EAAAA,CAAKC,KAAK,YAAYC,OAAQ,GAAIC,MAAO,MAKlD3B,EAAU,EAENoB,EAACC,MAAAA,CAAIC,UAAU,iDACVjB,EAAKkB,IAAI,sBAAsB,KAAG,IACnCH,EAACQ,OAAAA,CAAKN,UAAU,+CAA8C,IAAEtB,EAAU,GAAK,GAAGA,KAAW,MAMrGoB,EAACC,MAAAA,CACGQ,KAAK,OACLC,SAAU,EACVR,UAAWS,EAAW,sCAAuC,CAAE,gDAAiDhC,IAChHiC,QAASnB,GAERR,EAAKkB,IAAI,sBAAA"}
1
+ {"version":3,"file":"CtPResendOtpLink.js","sources":["../../../../../../../../src/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback, useEffect, useState } from 'preact/hooks';\nimport useClickToPayContext from '../../../context/useClickToPayContext';\nimport classnames from 'classnames';\nimport { useCoreContext } from '../../../../../../core/Context/CoreProvider';\nimport Icon from '../../../../Icon';\nimport { isSrciError } from '../../../services/utils';\nimport { PREFIX } from '../../../../Icon/constants';\n\n\nconst CONFIRMATION_SHOWING_TIME = 2000;\n\ninterface CtPResendOtpLinkProps {\n onError(errorCode: string): void;\n onResendCode(): void;\n disabled: boolean;\n}\n\nconst CtPResendOtpLink = ({ onError, onResendCode, disabled }: CtPResendOtpLinkProps): h.JSX.Element => {\n const [counter, setCounter] = useState<number>(null);\n const [showConfirmation, setShowConfirmation] = useState<boolean>(false);\n const { i18n } = useCoreContext();\n const { startIdentityValidation } = useClickToPayContext();\n\n useEffect(() => {\n let timeout = null;\n if (counter > 0) {\n timeout = setTimeout(() => setCounter(counter - 1), 1000);\n }\n return () => clearTimeout(timeout);\n }, [counter]);\n\n useEffect(() => {\n let timeout = null;\n\n if (showConfirmation) {\n timeout = setTimeout(() => {\n setShowConfirmation(false);\n setCounter(60);\n }, CONFIRMATION_SHOWING_TIME);\n }\n return () => clearTimeout(timeout);\n }, [showConfirmation]);\n\n const handleResendCodeClick = useCallback(\n async event => {\n event.preventDefault();\n\n try {\n onResendCode();\n setShowConfirmation(true);\n await startIdentityValidation();\n } catch (error: unknown) {\n setCounter(0);\n setShowConfirmation(false);\n\n if (!isSrciError(error)) {\n console.error(error);\n return;\n }\n\n onError(error.reason);\n }\n },\n [startIdentityValidation, onError, onResendCode]\n );\n\n if (showConfirmation) {\n return (\n <div className=\"adyen-checkout-ctp__otp-resend-code--confirmation\">\n {i18n.get('ctp.otp.codeResent')}\n <Icon type={`${PREFIX}checkmark`} height={14} width={14} />\n </div>\n );\n }\n\n if (counter > 0) {\n return (\n <div className=\"adyen-checkout-ctp__otp-resend-code--disabled\">\n {i18n.get('ctp.otp.resendCode')} -{' '}\n <span className=\"adyen-checkout-ctp__otp-resend-code-counter\"> {counter > 0 && `${counter}s`} </span>\n </div>\n );\n }\n\n return (\n <div\n role=\"link\"\n tabIndex={0}\n className={classnames('adyen-checkout-ctp__otp-resend-code', { 'adyen-checkout-ctp__otp-resend-code--disabled': disabled })}\n onClick={handleResendCodeClick}\n >\n {i18n.get('ctp.otp.resendCode')}\n </div>\n );\n};\n\nexport default CtPResendOtpLink;\n"],"names":["CtPResendOtpLink","onError","onResendCode","disabled","counter","setCounter","useState","showConfirmation","setShowConfirmation","i18n","useCoreContext","startIdentityValidation","useClickToPayContext","useEffect","timeout","setTimeout","clearTimeout","handleResendCodeClick","useCallback","async","event","preventDefault","error","isSrciError","console","reason","h","div","className","get","Icon","type","PREFIX","height","width","span","role","tabIndex","classnames","onClick"],"mappings":"giBAUA,MAQMA,EAAmB,EAAGC,UAASC,eAAcC,eAC/C,MAAOC,EAASC,GAAcC,EAAiB,OACxCC,EAAkBC,GAAuBF,GAAkB,IAC5DG,KAAEA,GAASC,KACXC,wBAAEA,GAA4BC,IAEpCC,GAAU,KACN,IAAIC,EAAU,KAId,OAHIV,EAAU,IACVU,EAAUC,YAAW,IAAMV,EAAWD,EAAU,IAAI,MAEjD,IAAMY,aAAaF,EAAAA,GAC3B,CAACV,IAEJS,GAAU,KACN,IAAIC,EAAU,KAQd,OANIP,IACAO,EAAUC,YAAW,KACjBP,GAAoB,GACpBH,EAAW,GAAA,GA5BO,MA+BnB,IAAMW,aAAaF,EAAAA,GAC3B,CAACP,IAEJ,MAAMU,EAAwBC,GAC1BC,MAAMC,IACFA,EAAMC,iBAEN,IACInB,IACAM,GAAoB,SACdG,GACV,CAAE,MAAOW,GAIL,GAHAjB,EAAW,GACXG,GAAoB,IAEfe,EAAYD,GAEb,YADAE,QAAQF,MAAMA,GAIlBrB,EAAQqB,EAAMG,OAClB,IAEJ,CAACd,EAAyBV,EAASC,IAGvC,OAAIK,EAEImB,EAACC,MAAAA,CAAIC,UAAU,qDACVnB,EAAKoB,IAAI,sBACVH,EAACI,EAAAA,CAAKC,KAAM,GAAGC,aAAmBC,OAAQ,GAAIC,MAAO,MAK7D9B,EAAU,EAENsB,EAACC,MAAAA,CAAIC,UAAU,iDACVnB,EAAKoB,IAAI,sBAAsB,KAAG,IACnCH,EAACS,OAAAA,CAAKP,UAAU,+CAA8C,IAAExB,EAAU,GAAK,GAAGA,KAAW,MAMrGsB,EAACC,MAAAA,CACGS,KAAK,OACLC,SAAU,EACVT,UAAWU,EAAW,sCAAuC,CAAE,gDAAiDnC,IAChHoC,QAAStB,GAERR,EAAKoB,IAAI,sBAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"AbstractSrcInitiator.js","sources":["../../../../../../../src/components/internal/ClickToPay/services/sdks/AbstractSrcInitiator.ts"],"sourcesContent":["import {\n CustomSdkConfiguration,\n SrcCheckoutParams,\n SrciCheckoutResponse,\n SrciCompleteIdentityValidationResponse,\n SrcIdentityLookupParams,\n SrciIdentityLookupResponse,\n SrciInitiateIdentityValidationResponse,\n SrciIsRecognizedResponse,\n SrcInitParams,\n SrcProfile\n} from './types';\nimport SrciError from './SrciError';\nimport { ClickToPayScheme } from '../../types';\nimport Script from '../../../../../utils/Script';\n\nexport interface ISrcInitiator {\n schemeName: ClickToPayScheme;\n // Loading 3rd party library\n loadSdkScript(): Promise<void>;\n removeSdkScript(): void;\n // SRCi specification methods\n init(params: SrcInitParams, srciTransactionId: string): Promise<void>;\n isRecognized(): Promise<SrciIsRecognizedResponse>;\n identityLookup(params: SrcIdentityLookupParams): Promise<SrciIdentityLookupResponse>;\n initiateIdentityValidation(): Promise<SrciInitiateIdentityValidationResponse>;\n completeIdentityValidation(validationData: string): Promise<SrciCompleteIdentityValidationResponse>;\n getSrcProfile(idTokens: string[]): Promise<SrcProfile>;\n checkout(params: SrcCheckoutParams): Promise<SrciCheckoutResponse>;\n unbindAppInstance(): Promise<void>;\n}\n\nexport default abstract class AbstractSrcInitiator implements ISrcInitiator {\n public schemeSdk: any;\n public abstract readonly schemeName: ClickToPayScheme;\n\n protected readonly customSdkConfiguration: CustomSdkConfiguration;\n\n private readonly sdkUrl: string;\n private scriptElement: Script | null = null;\n\n protected constructor(sdkUrl: string, customSdkConfiguration: CustomSdkConfiguration) {\n if (!sdkUrl) throw Error('AbstractSrcInitiator: Invalid SDK URL');\n\n this.sdkUrl = sdkUrl;\n this.customSdkConfiguration = customSdkConfiguration;\n }\n\n public async loadSdkScript(): Promise<void> {\n if (!this.isSdkIsAvailableOnWindow()) {\n this.scriptElement = new Script(this.sdkUrl);\n await this.scriptElement.load();\n }\n this.assignSdkReference();\n }\n\n public removeSdkScript(): void {\n this.scriptElement.remove();\n }\n\n /**\n * Verifies if SDK is already loaded on the window object.\n * Example: Merchant can preload the SDK to speed up the loading time\n */\n protected abstract isSdkIsAvailableOnWindow(): boolean;\n\n /**\n * Assign SchemeSDK object to 'schemeSdk' property.\n * Each scheme creates its own object reference on 'window' using different naming,\n * therefore this method should be implemented by the subclass to assign the property\n * accordingly\n */\n protected abstract assignSdkReference(): void;\n\n /**\n * Initializes the app with common state. The init method must be called before any other methods.\n */\n public abstract init(params: SrcInitParams, srciTransactionId: string): Promise<void>;\n\n /**\n * This method performs checkout using the specified card. If successful, the\n * response contains summary checkout information.\n */\n public async checkout(params: SrcCheckoutParams): Promise<SrciCheckoutResponse> {\n try {\n const checkoutResponse = await this.schemeSdk.checkout(params);\n return checkoutResponse;\n } catch (error) {\n const srciError = new SrciError(error, 'checkout', this.schemeName);\n throw srciError;\n }\n }\n\n /**\n * This method disassociates the Consumer application / Consumer Device from the Consumer’s SRC Profile.\n */\n public async unbindAppInstance(): Promise<void> {\n try {\n await this.schemeSdk.unbindAppInstance();\n } catch (error) {\n const srciError = new SrciError(error, 'unbindAppInstance', this.schemeName);\n throw srciError;\n }\n }\n\n /**\n * Determines whether the consumer is recognized, e.g. by detecting the presence of a local cookie in\n * the browser environment.\n */\n public async isRecognized(): Promise<SrciIsRecognizedResponse> {\n try {\n const isRecognizedResponse = await this.schemeSdk.isRecognized();\n return isRecognizedResponse;\n } catch (error) {\n const srciError = new SrciError(error, 'isRecognized', this.schemeName);\n throw srciError;\n }\n }\n\n /**\n * Sends a validation code to the specified consumer.\n * This method sends a one-time password (OTP) to the consumer to start validation\n */\n public async initiateIdentityValidation(): Promise<SrciInitiateIdentityValidationResponse> {\n try {\n const identityValidationResponse = await this.schemeSdk.initiateIdentityValidation();\n return identityValidationResponse;\n } catch (error) {\n const srciError = new SrciError(error, 'initiateIdentityValidation', this.schemeName);\n throw srciError;\n }\n }\n\n /**\n * Obtains the masked card and other account profile data associated with the userId.\n */\n public async getSrcProfile(idTokens: string[]): Promise<SrcProfile> {\n try {\n const getSrcProfileResponse = await this.schemeSdk.getSrcProfile({ idTokens });\n return getSrcProfileResponse;\n } catch (error) {\n const srciError = new SrciError(error, 'getSrcProfile', this.schemeName);\n throw srciError;\n }\n }\n\n /**\n * Obtains the user account associated with the consumer’s identity (an email address or phone\n * number).\n */\n public abstract identityLookup(params: SrcIdentityLookupParams): Promise<SrciIdentityLookupResponse>;\n\n /**\n * This method completes the identity validation by receiving the one-time password (OTP) sent to the\n * consumer to start validation.\n */\n public abstract completeIdentityValidation(otp: string): Promise<SrciCompleteIdentityValidationResponse>;\n}\n"],"names":["AbstractSrcInitiator","schemeSdk","customSdkConfiguration","sdkUrl","scriptElement","constructor","Error","this","loadSdkScript","isSdkIsAvailableOnWindow","Script","load","assignSdkReference","removeSdkScript","remove","checkout","params","error","SrciError","schemeName","unbindAppInstance","isRecognized","initiateIdentityValidation","getSrcProfile","idTokens"],"mappings":"4EAgCe,MAAeA,EACnBC,UAGYC,uBAEFC,OACTC,cAA+B,KAEvC,WAAAC,CAAsBF,EAAgBD,GAClC,IAAKC,EAAQ,MAAMG,MAAM,yCAEzBC,KAAKJ,OAASA,EACdI,KAAKL,uBAAyBA,CAClC,CAEA,mBAAaM,GACJD,KAAKE,6BACNF,KAAKH,cAAgB,IAAIM,EAAOH,KAAKJ,cAC/BI,KAAKH,cAAcO,QAE7BJ,KAAKK,oBACT,CAEOC,eAAAA,GACHN,KAAKH,cAAcU,QACvB,CAyBA,cAAaC,CAASC,GAClB,IAEI,aAD+BT,KAAKN,UAAUc,SAASC,EAE3D,CAAE,MAAOC,GAEL,MADkB,IAAIC,EAAUD,EAAO,WAAYV,KAAKY,WAE5D,CACJ,CAKA,uBAAaC,GACT,UACUb,KAAKN,UAAUmB,mBACzB,CAAE,MAAOH,GAEL,MADkB,IAAIC,EAAUD,EAAO,oBAAqBV,KAAKY,WAErE,CACJ,CAMA,kBAAaE,GACT,IAEI,aADmCd,KAAKN,UAAUoB,cAEtD,CAAE,MAAOJ,GAEL,MADkB,IAAIC,EAAUD,EAAO,eAAgBV,KAAKY,WAEhE,CACJ,CAMA,gCAAaG,GACT,IAEI,aADyCf,KAAKN,UAAUqB,4BAE5D,CAAE,MAAOL,GAEL,MADkB,IAAIC,EAAUD,EAAO,6BAA8BV,KAAKY,WAE9E,CACJ,CAKA,mBAAaI,CAAcC,GACvB,IAEI,aADoCjB,KAAKN,UAAUsB,cAAc,CAAEC,YAEvE,CAAE,MAAOP,GAEL,MADkB,IAAIC,EAAUD,EAAO,gBAAiBV,KAAKY,WAEjE,CACJ"}
1
+ {"version":3,"file":"AbstractSrcInitiator.js","sources":["../../../../../../../src/components/internal/ClickToPay/services/sdks/AbstractSrcInitiator.ts"],"sourcesContent":["import {\n CustomSdkConfiguration,\n SrcCheckoutParams,\n SrciCheckoutResponse,\n SrciCompleteIdentityValidationResponse,\n SrcIdentityLookupParams,\n SrciIdentityLookupResponse,\n SrciInitiateIdentityValidationResponse,\n SrciIsRecognizedResponse,\n SrcInitParams,\n SrcProfile\n} from './types';\nimport SrciError, { MastercardError, VisaError } from './SrciError';\nimport { ClickToPayScheme } from '../../types';\nimport Script from '../../../../../utils/Script';\n\nexport interface ISrcInitiator {\n schemeName: ClickToPayScheme;\n // Loading 3rd party library\n loadSdkScript(): Promise<void>;\n removeSdkScript(): void;\n // SRCi specification methods\n init(params: SrcInitParams, srciTransactionId: string): Promise<void>;\n isRecognized(): Promise<SrciIsRecognizedResponse>;\n identityLookup(params: SrcIdentityLookupParams): Promise<SrciIdentityLookupResponse>;\n initiateIdentityValidation(): Promise<SrciInitiateIdentityValidationResponse>;\n completeIdentityValidation(validationData: string): Promise<SrciCompleteIdentityValidationResponse>;\n getSrcProfile(idTokens: string[]): Promise<SrcProfile>;\n checkout(params: SrcCheckoutParams): Promise<SrciCheckoutResponse>;\n unbindAppInstance(): Promise<void>;\n}\n\nexport default abstract class AbstractSrcInitiator implements ISrcInitiator {\n public schemeSdk: any;\n public abstract readonly schemeName: ClickToPayScheme;\n\n protected readonly customSdkConfiguration: CustomSdkConfiguration;\n\n private readonly sdkUrl: string;\n private scriptElement: Script | null = null;\n\n protected constructor(sdkUrl: string, customSdkConfiguration: CustomSdkConfiguration) {\n if (!sdkUrl) throw Error('AbstractSrcInitiator: Invalid SDK URL');\n\n this.sdkUrl = sdkUrl;\n this.customSdkConfiguration = customSdkConfiguration;\n }\n\n public async loadSdkScript(): Promise<void> {\n if (!this.isSdkIsAvailableOnWindow()) {\n this.scriptElement = new Script(this.sdkUrl);\n await this.scriptElement.load();\n }\n this.assignSdkReference();\n }\n\n public removeSdkScript(): void {\n this.scriptElement.remove();\n }\n\n /**\n * Verifies if SDK is already loaded on the window object.\n * Example: Merchant can preload the SDK to speed up the loading time\n */\n protected abstract isSdkIsAvailableOnWindow(): boolean;\n\n /**\n * Assign SchemeSDK object to 'schemeSdk' property.\n * Each scheme creates its own object reference on 'window' using different naming,\n * therefore this method should be implemented by the subclass to assign the property\n * accordingly\n */\n protected abstract assignSdkReference(): void;\n\n /**\n * Initializes the app with common state. The init method must be called before any other methods.\n */\n public abstract init(params: SrcInitParams, srciTransactionId: string): Promise<void>;\n\n /**\n * This method performs checkout using the specified card. If successful, the\n * response contains summary checkout information.\n */\n public async checkout(params: SrcCheckoutParams): Promise<SrciCheckoutResponse> {\n try {\n const checkoutResponse = await this.schemeSdk.checkout(params);\n return checkoutResponse;\n } catch (error) {\n const srciError = new SrciError(error as VisaError | MastercardError, 'checkout', this.schemeName);\n throw srciError;\n }\n }\n\n /**\n * This method disassociates the Consumer application / Consumer Device from the Consumer’s SRC Profile.\n */\n public async unbindAppInstance(): Promise<void> {\n try {\n await this.schemeSdk.unbindAppInstance();\n } catch (error) {\n const srciError = new SrciError(error as VisaError | MastercardError, 'unbindAppInstance', this.schemeName);\n throw srciError;\n }\n }\n\n /**\n * Determines whether the consumer is recognized, e.g. by detecting the presence of a local cookie in\n * the browser environment.\n */\n public async isRecognized(): Promise<SrciIsRecognizedResponse> {\n try {\n const isRecognizedResponse = await this.schemeSdk.isRecognized();\n return isRecognizedResponse;\n } catch (error) {\n const srciError = new SrciError(error as VisaError | MastercardError, 'isRecognized', this.schemeName);\n throw srciError;\n }\n }\n\n /**\n * Sends a validation code to the specified consumer.\n * This method sends a one-time password (OTP) to the consumer to start validation\n */\n public async initiateIdentityValidation(): Promise<SrciInitiateIdentityValidationResponse> {\n try {\n const identityValidationResponse = await this.schemeSdk.initiateIdentityValidation();\n return identityValidationResponse;\n } catch (error) {\n const srciError = new SrciError(error as VisaError | MastercardError, 'initiateIdentityValidation', this.schemeName);\n throw srciError;\n }\n }\n\n /**\n * Obtains the masked card and other account profile data associated with the userId.\n */\n public async getSrcProfile(idTokens: string[]): Promise<SrcProfile> {\n try {\n const getSrcProfileResponse = await this.schemeSdk.getSrcProfile({ idTokens });\n return getSrcProfileResponse;\n } catch (error) {\n const srciError = new SrciError(error as VisaError | MastercardError, 'getSrcProfile', this.schemeName);\n throw srciError;\n }\n }\n\n /**\n * Obtains the user account associated with the consumer’s identity (an email address or phone\n * number).\n */\n public abstract identityLookup(params: SrcIdentityLookupParams): Promise<SrciIdentityLookupResponse>;\n\n /**\n * This method completes the identity validation by receiving the one-time password (OTP) sent to the\n * consumer to start validation.\n */\n public abstract completeIdentityValidation(otp: string): Promise<SrciCompleteIdentityValidationResponse>;\n}\n"],"names":["AbstractSrcInitiator","schemeSdk","customSdkConfiguration","sdkUrl","scriptElement","constructor","Error","this","loadSdkScript","isSdkIsAvailableOnWindow","Script","load","assignSdkReference","removeSdkScript","remove","checkout","params","error","SrciError","schemeName","unbindAppInstance","isRecognized","initiateIdentityValidation","getSrcProfile","idTokens"],"mappings":"4EAgCe,MAAeA,EACnBC,UAGYC,uBAEFC,OACTC,cAA+B,KAEvC,WAAAC,CAAsBF,EAAgBD,GAClC,IAAKC,EAAQ,MAAMG,MAAM,yCAEzBC,KAAKJ,OAASA,EACdI,KAAKL,uBAAyBA,CAClC,CAEA,mBAAaM,GACJD,KAAKE,6BACNF,KAAKH,cAAgB,IAAIM,EAAOH,KAAKJ,cAC/BI,KAAKH,cAAcO,QAE7BJ,KAAKK,oBACT,CAEOC,eAAAA,GACHN,KAAKH,cAAcU,QACvB,CAyBA,cAAaC,CAASC,GAClB,IAEI,aAD+BT,KAAKN,UAAUc,SAASC,EAE3D,CAAE,MAAOC,GAEL,MADkB,IAAIC,EAAUD,EAAsC,WAAYV,KAAKY,WAE3F,CACJ,CAKA,uBAAaC,GACT,UACUb,KAAKN,UAAUmB,mBACzB,CAAE,MAAOH,GAEL,MADkB,IAAIC,EAAUD,EAAsC,oBAAqBV,KAAKY,WAEpG,CACJ,CAMA,kBAAaE,GACT,IAEI,aADmCd,KAAKN,UAAUoB,cAEtD,CAAE,MAAOJ,GAEL,MADkB,IAAIC,EAAUD,EAAsC,eAAgBV,KAAKY,WAE/F,CACJ,CAMA,gCAAaG,GACT,IAEI,aADyCf,KAAKN,UAAUqB,4BAE5D,CAAE,MAAOL,GAEL,MADkB,IAAIC,EAAUD,EAAsC,6BAA8BV,KAAKY,WAE7G,CACJ,CAKA,mBAAaI,CAAcC,GACvB,IAEI,aADoCjB,KAAKN,UAAUsB,cAAc,CAAEC,YAEvE,CAAE,MAAOP,GAEL,MADkB,IAAIC,EAAUD,EAAsC,gBAAiBV,KAAKY,WAEhG,CACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"MastercardSdk.js","sources":["../../../../../../../src/components/internal/ClickToPay/services/sdks/MastercardSdk.ts"],"sourcesContent":["import { getMastercardSettings, MC_SDK_PROD, MC_SDK_TEST } from './config';\nimport AbstractSrcInitiator from './AbstractSrcInitiator';\nimport SrciError from './SrciError';\nimport {\n CustomSdkConfiguration,\n SrciCompleteIdentityValidationResponse,\n SrcIdentityLookupParams,\n SrciIdentityLookupResponse,\n SrcInitParams\n} from './types';\n\nconst IdentityTypeMap = {\n email: 'EMAIL_ADDRESS',\n telephoneNumber: 'MOBILE_PHONE_NUMBER'\n};\n\nclass MastercardSdk extends AbstractSrcInitiator {\n public readonly schemeName = 'mc';\n\n constructor(environment: string, customSdkConfig: CustomSdkConfiguration) {\n super(environment.toLowerCase().includes('live') ? MC_SDK_PROD : MC_SDK_TEST, customSdkConfig);\n }\n\n protected isSdkIsAvailableOnWindow(): boolean {\n // @ts-ignore SRCSDK_MASTERCARD is created by the MC sdk\n if (window.SRCSDK_MASTERCARD) return true;\n return false;\n }\n\n protected assignSdkReference(): void {\n // @ts-ignore SRCSDK_MASTERCARD is created by the MC sdk\n this.schemeSdk = window.SRCSDK_MASTERCARD;\n }\n\n public async init(params: SrcInitParams, srciTransactionId: string): Promise<void> {\n try {\n const sdkProps = {\n ...params,\n ...getMastercardSettings(this.customSdkConfiguration),\n srciTransactionId\n };\n await this.schemeSdk.init(sdkProps);\n } catch (err) {\n const srciError = new SrciError(err, 'init', this.schemeName);\n throw srciError;\n }\n }\n\n public async identityLookup({ identityValue, type }: SrcIdentityLookupParams): Promise<SrciIdentityLookupResponse> {\n try {\n const consumerIdentity = {\n identityValue,\n identityType: IdentityTypeMap[type]\n };\n\n const response = await this.schemeSdk.identityLookup({ consumerIdentity });\n return response;\n } catch (err) {\n const srciError = new SrciError(err, 'identityLookup', this.schemeName);\n throw srciError;\n }\n }\n\n public async completeIdentityValidation(otp: string): Promise<SrciCompleteIdentityValidationResponse> {\n try {\n const response = await this.schemeSdk.completeIdentityValidation({ validationData: otp });\n return response;\n } catch (err) {\n const srciError = new SrciError(err, 'completeIdentityValidation', this.schemeName);\n throw srciError;\n }\n }\n}\n\nexport default MastercardSdk;\n"],"names":["IdentityTypeMap","email","telephoneNumber","MastercardSdk","AbstractSrcInitiator","schemeName","constructor","environment","customSdkConfig","super","toLowerCase","includes","MC_SDK_PROD","MC_SDK_TEST","isSdkIsAvailableOnWindow","window","SRCSDK_MASTERCARD","assignSdkReference","this","schemeSdk","init","params","srciTransactionId","sdkProps","getMastercardSettings","customSdkConfiguration","err","SrciError","identityLookup","identityValue","type","consumerIdentity","identityType","completeIdentityValidation","otp","validationData"],"mappings":"6JAWA,MAAMA,EAAkB,CACpBC,MAAO,gBACPC,gBAAiB,uBAGrB,MAAMC,UAAsBC,EACRC,WAAa,KAE7BC,WAAAA,CAAYC,EAAqBC,GAC7BC,MAAMF,EAAYG,cAAcC,SAAS,QAAUC,EAAcC,EAAaL,EAClF,CAEUM,wBAAAA,GAEN,QAAIC,OAAOC,iBAEf,CAEUC,kBAAAA,GAENC,KAAKC,UAAYJ,OAAOC,iBAC5B,CAEA,UAAaI,CAAKC,EAAuBC,GACrC,IACI,MAAMC,EAAW,IACVF,KACAG,EAAsBN,KAAKO,wBAC9BH,2BAEEJ,KAAKC,UAAUC,KAAKG,EAC9B,CAAE,MAAOG,GAEL,MADkB,IAAIC,EAAUD,EAAK,OAAQR,KAAKb,WAEtD,CACJ,CAEA,oBAAauB,EAAeC,cAAEA,EAAaC,KAAEA,IACzC,IACI,MAAMC,EAAmB,CACrBF,gBACAG,aAAchC,EAAgB8B,IAIlC,aADuBZ,KAAKC,UAAUS,eAAe,CAAEG,oBAE3D,CAAE,MAAOL,GAEL,MADkB,IAAIC,EAAUD,EAAK,iBAAkBR,KAAKb,WAEhE,CACJ,CAEA,gCAAa4B,CAA2BC,GACpC,IAEI,aADuBhB,KAAKC,UAAUc,2BAA2B,CAAEE,eAAgBD,GAEvF,CAAE,MAAOR,GAEL,MADkB,IAAIC,EAAUD,EAAK,6BAA8BR,KAAKb,WAE5E,CACJ"}
1
+ {"version":3,"file":"MastercardSdk.js","sources":["../../../../../../../src/components/internal/ClickToPay/services/sdks/MastercardSdk.ts"],"sourcesContent":["import { getMastercardSettings, MC_SDK_PROD, MC_SDK_TEST } from './config';\nimport AbstractSrcInitiator from './AbstractSrcInitiator';\nimport SrciError, { MastercardError, VisaError } from './SrciError';\nimport {\n CustomSdkConfiguration,\n SrciCompleteIdentityValidationResponse,\n SrcIdentityLookupParams,\n SrciIdentityLookupResponse,\n SrcInitParams\n} from './types';\n\nconst IdentityTypeMap = {\n email: 'EMAIL_ADDRESS',\n telephoneNumber: 'MOBILE_PHONE_NUMBER'\n};\n\nclass MastercardSdk extends AbstractSrcInitiator {\n public readonly schemeName = 'mc';\n\n constructor(environment: string, customSdkConfig: CustomSdkConfiguration) {\n super(environment.toLowerCase().includes('live') ? MC_SDK_PROD : MC_SDK_TEST, customSdkConfig);\n }\n\n protected isSdkIsAvailableOnWindow(): boolean {\n // @ts-ignore SRCSDK_MASTERCARD is created by the MC sdk\n if (window.SRCSDK_MASTERCARD) return true;\n return false;\n }\n\n protected assignSdkReference(): void {\n // @ts-ignore SRCSDK_MASTERCARD is created by the MC sdk\n this.schemeSdk = window.SRCSDK_MASTERCARD;\n }\n\n public async init(params: SrcInitParams, srciTransactionId: string): Promise<void> {\n try {\n const sdkProps = {\n ...params,\n ...getMastercardSettings(this.customSdkConfiguration),\n srciTransactionId\n };\n await this.schemeSdk.init(sdkProps);\n } catch (err) {\n const srciError = new SrciError(err as VisaError | MastercardError, 'init', this.schemeName);\n throw srciError;\n }\n }\n\n public async identityLookup({ identityValue, type }: SrcIdentityLookupParams): Promise<SrciIdentityLookupResponse> {\n try {\n const consumerIdentity = {\n identityValue,\n identityType: IdentityTypeMap[type]\n };\n\n const response = await this.schemeSdk.identityLookup({ consumerIdentity });\n return response;\n } catch (err) {\n const srciError = new SrciError(err as VisaError | MastercardError, 'identityLookup', this.schemeName);\n throw srciError;\n }\n }\n\n public async completeIdentityValidation(otp: string): Promise<SrciCompleteIdentityValidationResponse> {\n try {\n const response = await this.schemeSdk.completeIdentityValidation({ validationData: otp });\n return response;\n } catch (err) {\n const srciError = new SrciError(err as VisaError | MastercardError, 'completeIdentityValidation', this.schemeName);\n throw srciError;\n }\n }\n}\n\nexport default MastercardSdk;\n"],"names":["IdentityTypeMap","email","telephoneNumber","MastercardSdk","AbstractSrcInitiator","schemeName","constructor","environment","customSdkConfig","super","toLowerCase","includes","MC_SDK_PROD","MC_SDK_TEST","isSdkIsAvailableOnWindow","window","SRCSDK_MASTERCARD","assignSdkReference","this","schemeSdk","init","params","srciTransactionId","sdkProps","getMastercardSettings","customSdkConfiguration","err","SrciError","identityLookup","identityValue","type","consumerIdentity","identityType","completeIdentityValidation","otp","validationData"],"mappings":"6JAWA,MAAMA,EAAkB,CACpBC,MAAO,gBACPC,gBAAiB,uBAGrB,MAAMC,UAAsBC,EACRC,WAAa,KAE7BC,WAAAA,CAAYC,EAAqBC,GAC7BC,MAAMF,EAAYG,cAAcC,SAAS,QAAUC,EAAcC,EAAaL,EAClF,CAEUM,wBAAAA,GAEN,QAAIC,OAAOC,iBAEf,CAEUC,kBAAAA,GAENC,KAAKC,UAAYJ,OAAOC,iBAC5B,CAEA,UAAaI,CAAKC,EAAuBC,GACrC,IACI,MAAMC,EAAW,IACVF,KACAG,EAAsBN,KAAKO,wBAC9BH,2BAEEJ,KAAKC,UAAUC,KAAKG,EAC9B,CAAE,MAAOG,GAEL,MADkB,IAAIC,EAAUD,EAAoC,OAAQR,KAAKb,WAErF,CACJ,CAEA,oBAAauB,EAAeC,cAAEA,EAAaC,KAAEA,IACzC,IACI,MAAMC,EAAmB,CACrBF,gBACAG,aAAchC,EAAgB8B,IAIlC,aADuBZ,KAAKC,UAAUS,eAAe,CAAEG,oBAE3D,CAAE,MAAOL,GAEL,MADkB,IAAIC,EAAUD,EAAoC,iBAAkBR,KAAKb,WAE/F,CACJ,CAEA,gCAAa4B,CAA2BC,GACpC,IAEI,aADuBhB,KAAKC,UAAUc,2BAA2B,CAAEE,eAAgBD,GAEvF,CAAE,MAAOR,GAEL,MADkB,IAAIC,EAAUD,EAAoC,6BAA8BR,KAAKb,WAE3G,CACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"VisaSdk.js","sources":["../../../../../../../src/components/internal/ClickToPay/services/sdks/VisaSdk.ts"],"sourcesContent":["import { getVisaSetttings, VISA_SDK_PROD, VISA_SDK_TEST } from './config';\nimport AbstractSrcInitiator from './AbstractSrcInitiator';\nimport SrciError from './SrciError';\nimport {\n CustomSdkConfiguration,\n SrciCompleteIdentityValidationResponse,\n SrcIdentityLookupParams,\n SrciIdentityLookupResponse,\n SrcInitParams\n} from './types';\n\nconst IdentityTypeMap = {\n email: 'EMAIL',\n telephoneNumber: 'MOBILE_NUMBER'\n};\n\nclass VisaSdk extends AbstractSrcInitiator {\n public readonly schemeName = 'visa';\n\n constructor(environment: string, customSdkConfig: CustomSdkConfiguration) {\n super(environment.toLowerCase().includes('live') ? VISA_SDK_PROD : VISA_SDK_TEST, customSdkConfig);\n }\n\n protected isSdkIsAvailableOnWindow(): boolean {\n // @ts-ignore vAdapters is created by the VISA sdk\n if (window.vAdapters?.VisaSRCI) return true;\n return false;\n }\n\n protected assignSdkReference(): void {\n // @ts-ignore vAdapters is created by the VISA sdk\n this.schemeSdk = new window.vAdapters.VisaSRCI();\n }\n\n public async init(params: SrcInitParams, srciTransactionId: string): Promise<void> {\n try {\n const sdkProps = {\n ...params,\n ...getVisaSetttings(this.customSdkConfiguration),\n srciTransactionId\n };\n\n await this.schemeSdk.init(sdkProps);\n } catch (err) {\n const srciError = new SrciError(err, 'init', this.schemeName);\n throw srciError;\n }\n }\n\n public async identityLookup({ identityValue, type }: SrcIdentityLookupParams): Promise<SrciIdentityLookupResponse> {\n try {\n const consumerIdentity = {\n identityValue,\n type: IdentityTypeMap[type]\n };\n\n const response = await this.schemeSdk.identityLookup(consumerIdentity);\n return response;\n } catch (err) {\n const srciError = new SrciError(err, 'identityLookup', this.schemeName);\n throw srciError;\n }\n }\n\n public async completeIdentityValidation(otp: string): Promise<SrciCompleteIdentityValidationResponse> {\n try {\n const response = await this.schemeSdk.completeIdentityValidation(otp);\n return response;\n } catch (err) {\n const srciError = new SrciError(err, 'completeIdentityValidation', this.schemeName);\n throw srciError;\n }\n }\n}\n\nexport default VisaSdk;\n"],"names":["IdentityTypeMap","email","telephoneNumber","VisaSdk","AbstractSrcInitiator","schemeName","constructor","environment","customSdkConfig","super","toLowerCase","includes","VISA_SDK_PROD","VISA_SDK_TEST","isSdkIsAvailableOnWindow","window","vAdapters","VisaSRCI","assignSdkReference","this","schemeSdk","init","params","srciTransactionId","sdkProps","getVisaSetttings","customSdkConfiguration","err","SrciError","identityLookup","identityValue","type","consumerIdentity","completeIdentityValidation","otp"],"mappings":"4JAWA,MAAMA,EAAkB,CACpBC,MAAO,QACPC,gBAAiB,iBAGrB,MAAMC,UAAgBC,EACFC,WAAa,OAE7BC,WAAAA,CAAYC,EAAqBC,GAC7BC,MAAMF,EAAYG,cAAcC,SAAS,QAAUC,EAAgBC,EAAeL,EACtF,CAEUM,wBAAAA,GAEN,QAAIC,OAAOC,WAAWC,QAE1B,CAEUC,kBAAAA,GAENC,KAAKC,UAAY,IAAIL,OAAOC,UAAUC,QAC1C,CAEA,UAAaI,CAAKC,EAAuBC,GACrC,IACI,MAAMC,EAAW,IACVF,KACAG,EAAiBN,KAAKO,wBACzBH,2BAGEJ,KAAKC,UAAUC,KAAKG,EAC9B,CAAE,MAAOG,GAEL,MADkB,IAAIC,EAAUD,EAAK,OAAQR,KAAKd,WAEtD,CACJ,CAEA,oBAAawB,EAAeC,cAAEA,EAAaC,KAAEA,IACzC,IACI,MAAMC,EAAmB,CACrBF,gBACAC,KAAM/B,EAAgB+B,IAI1B,aADuBZ,KAAKC,UAAUS,eAAeG,EAEzD,CAAE,MAAOL,GAEL,MADkB,IAAIC,EAAUD,EAAK,iBAAkBR,KAAKd,WAEhE,CACJ,CAEA,gCAAa4B,CAA2BC,GACpC,IAEI,aADuBf,KAAKC,UAAUa,2BAA2BC,EAErE,CAAE,MAAOP,GAEL,MADkB,IAAIC,EAAUD,EAAK,6BAA8BR,KAAKd,WAE5E,CACJ"}
1
+ {"version":3,"file":"VisaSdk.js","sources":["../../../../../../../src/components/internal/ClickToPay/services/sdks/VisaSdk.ts"],"sourcesContent":["import { getVisaSetttings, VISA_SDK_PROD, VISA_SDK_TEST } from './config';\nimport AbstractSrcInitiator from './AbstractSrcInitiator';\nimport SrciError, { MastercardError, VisaError } from './SrciError';\nimport type {\n CustomSdkConfiguration,\n SrciCompleteIdentityValidationResponse,\n SrcIdentityLookupParams,\n SrciIdentityLookupResponse,\n SrcInitParams\n} from './types';\n\nconst IdentityTypeMap = {\n email: 'EMAIL',\n telephoneNumber: 'MOBILE_NUMBER'\n};\n\nclass VisaSdk extends AbstractSrcInitiator {\n public readonly schemeName = 'visa';\n\n constructor(environment: string, customSdkConfig: CustomSdkConfiguration) {\n super(environment.toLowerCase().includes('live') ? VISA_SDK_PROD : VISA_SDK_TEST, customSdkConfig);\n }\n\n protected isSdkIsAvailableOnWindow(): boolean {\n // @ts-ignore vAdapters is created by the VISA sdk\n if (window.vAdapters?.VisaSRCI) return true;\n return false;\n }\n\n protected assignSdkReference(): void {\n // @ts-ignore vAdapters is created by the VISA sdk\n this.schemeSdk = new window.vAdapters.VisaSRCI();\n }\n\n public async init(params: SrcInitParams, srciTransactionId: string): Promise<void> {\n try {\n const sdkProps = {\n ...params,\n ...getVisaSetttings(this.customSdkConfiguration),\n srciTransactionId\n };\n\n await this.schemeSdk.init(sdkProps);\n } catch (err) {\n const srciError = new SrciError(err as VisaError | MastercardError, 'init', this.schemeName);\n throw srciError;\n }\n }\n\n public async identityLookup({ identityValue, type }: SrcIdentityLookupParams): Promise<SrciIdentityLookupResponse> {\n try {\n const consumerIdentity = {\n identityValue,\n type: IdentityTypeMap[type]\n };\n\n const response = await this.schemeSdk.identityLookup(consumerIdentity);\n return response;\n } catch (err) {\n const srciError = new SrciError(err as VisaError | MastercardError, 'identityLookup', this.schemeName);\n throw srciError;\n }\n }\n\n public async completeIdentityValidation(otp: string): Promise<SrciCompleteIdentityValidationResponse> {\n try {\n const response = await this.schemeSdk.completeIdentityValidation(otp);\n return response;\n } catch (err: unknown) {\n const srciError = new SrciError(err as VisaError | MastercardError, 'completeIdentityValidation', this.schemeName);\n throw srciError;\n }\n }\n}\n\nexport default VisaSdk;\n"],"names":["IdentityTypeMap","email","telephoneNumber","VisaSdk","AbstractSrcInitiator","schemeName","constructor","environment","customSdkConfig","super","toLowerCase","includes","VISA_SDK_PROD","VISA_SDK_TEST","isSdkIsAvailableOnWindow","window","vAdapters","VisaSRCI","assignSdkReference","this","schemeSdk","init","params","srciTransactionId","sdkProps","getVisaSetttings","customSdkConfiguration","err","SrciError","identityLookup","identityValue","type","consumerIdentity","completeIdentityValidation","otp"],"mappings":"4JAWA,MAAMA,EAAkB,CACpBC,MAAO,QACPC,gBAAiB,iBAGrB,MAAMC,UAAgBC,EACFC,WAAa,OAE7BC,WAAAA,CAAYC,EAAqBC,GAC7BC,MAAMF,EAAYG,cAAcC,SAAS,QAAUC,EAAgBC,EAAeL,EACtF,CAEUM,wBAAAA,GAEN,QAAIC,OAAOC,WAAWC,QAE1B,CAEUC,kBAAAA,GAENC,KAAKC,UAAY,IAAIL,OAAOC,UAAUC,QAC1C,CAEA,UAAaI,CAAKC,EAAuBC,GACrC,IACI,MAAMC,EAAW,IACVF,KACAG,EAAiBN,KAAKO,wBACzBH,2BAGEJ,KAAKC,UAAUC,KAAKG,EAC9B,CAAE,MAAOG,GAEL,MADkB,IAAIC,EAAUD,EAAoC,OAAQR,KAAKd,WAErF,CACJ,CAEA,oBAAawB,EAAeC,cAAEA,EAAaC,KAAEA,IACzC,IACI,MAAMC,EAAmB,CACrBF,gBACAC,KAAM/B,EAAgB+B,IAI1B,aADuBZ,KAAKC,UAAUS,eAAeG,EAEzD,CAAE,MAAOL,GAEL,MADkB,IAAIC,EAAUD,EAAoC,iBAAkBR,KAAKd,WAE/F,CACJ,CAEA,gCAAa4B,CAA2BC,GACpC,IAEI,aADuBf,KAAKC,UAAUa,2BAA2BC,EAErE,CAAE,MAAOP,GAEL,MADkB,IAAIC,EAAUD,EAAoC,6BAA8BR,KAAKd,WAE3G,CACJ"}