@adyen/adyen-web 6.1.1 → 6.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/dist/cjs/adyen.css +1 -0
  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 +58 -7
  6. package/dist/es/adyen.css +1 -0
  7. package/dist/es/adyen.css.map +1 -1
  8. package/dist/es/components/ApplePay/ApplePayService.js +1 -1
  9. package/dist/es/components/ApplePay/ApplePayService.js.map +1 -1
  10. package/dist/es/components/Card/Card.js +1 -1
  11. package/dist/es/components/Card/Card.js.map +1 -1
  12. package/dist/es/components/Card/components/CardInput/defaultProps.js +1 -1
  13. package/dist/es/components/Card/components/CardInput/defaultProps.js.map +1 -1
  14. package/dist/es/components/Card/components/ClickToPayHolder.js +1 -1
  15. package/dist/es/components/Card/components/ClickToPayHolder.js.map +1 -1
  16. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodBrands/PaymentMethodBrands.js +1 -1
  17. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodBrands/PaymentMethodBrands.js.map +1 -1
  18. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  19. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  20. package/dist/es/components/Dropin/elements/createElements.js +1 -1
  21. package/dist/es/components/Dropin/elements/createElements.js.map +1 -1
  22. package/dist/es/components/Dropin/elements/filters.js +1 -1
  23. package/dist/es/components/Dropin/elements/filters.js.map +1 -1
  24. package/dist/es/components/PayByBankUS/PayByBankUS.js +2 -0
  25. package/dist/es/components/PayByBankUS/PayByBankUS.js.map +1 -0
  26. package/dist/es/components/components-name-map.js +1 -1
  27. package/dist/es/components/components-name-map.js.map +1 -1
  28. package/dist/es/components/index.js +1 -1
  29. package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
  30. package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
  31. package/dist/es/components/internal/Button/Button.js +1 -1
  32. package/dist/es/components/internal/Button/Button.js.map +1 -1
  33. package/dist/es/components/internal/ClickToPay/ClickToPayComponent.js +1 -1
  34. package/dist/es/components/internal/ClickToPay/ClickToPayComponent.js.map +1 -1
  35. package/dist/es/components/internal/ClickToPay/components/CtPCards/CtPCards.js +1 -1
  36. package/dist/es/components/internal/ClickToPay/components/CtPCards/CtPCards.js.map +1 -1
  37. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLogin.js +1 -1
  38. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLogin.js.map +1 -1
  39. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js +1 -1
  40. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js.map +1 -1
  41. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePassword.js +1 -1
  42. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePassword.js.map +1 -1
  43. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js +1 -1
  44. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js.map +1 -1
  45. package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPSection.js +1 -1
  46. package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPSection.js.map +1 -1
  47. package/dist/es/components/internal/ClickToPay/errors/TimeoutError.js +1 -1
  48. package/dist/es/components/internal/ClickToPay/errors/TimeoutError.js.map +1 -1
  49. package/dist/es/components/internal/ClickToPay/services/ClickToPayService.js +1 -1
  50. package/dist/es/components/internal/ClickToPay/services/ClickToPayService.js.map +1 -1
  51. package/dist/es/components/internal/ClickToPay/services/execute-with-timeout.js +2 -0
  52. package/dist/es/components/internal/ClickToPay/services/execute-with-timeout.js.map +1 -0
  53. package/dist/es/components/internal/FormFields/InputBase.js.map +1 -1
  54. package/dist/es/components/tx-variants.js +1 -1
  55. package/dist/es/components/tx-variants.js.map +1 -1
  56. package/dist/es/core/Analytics/Analytics.js +1 -1
  57. package/dist/es/core/Analytics/Analytics.js.map +1 -1
  58. package/dist/es/core/Analytics/constants.js +1 -1
  59. package/dist/es/core/Analytics/constants.js.map +1 -1
  60. package/dist/es/core/Analytics/utils.js +1 -1
  61. package/dist/es/core/Analytics/utils.js.map +1 -1
  62. package/dist/es/core/CheckoutSession/CheckoutSession.js +1 -1
  63. package/dist/es/core/CheckoutSession/CheckoutSession.js.map +1 -1
  64. package/dist/es/core/Context/CoreProvider.js +1 -1
  65. package/dist/es/core/Context/CoreProvider.js.map +1 -1
  66. package/dist/es/core/ProcessResponse/PaymentMethods/filters.js +1 -1
  67. package/dist/es/core/ProcessResponse/PaymentMethods/filters.js.map +1 -1
  68. package/dist/es/core/Services/analytics/collect-id.js +1 -1
  69. package/dist/es/core/Services/sessions/setup-session.js +1 -1
  70. package/dist/es/core/Services/sessions/setup-session.js.map +1 -1
  71. package/dist/es/core/core.js +1 -1
  72. package/dist/es/index.d.ts +58 -7
  73. package/dist/es/index.js +1 -1
  74. package/dist/es/utils/listenerUtils.js +1 -1
  75. package/dist/es/utils/listenerUtils.js.map +1 -1
  76. package/dist/es-legacy/adyen.css +1 -0
  77. package/dist/es-legacy/adyen.css.map +1 -1
  78. package/dist/es-legacy/components/ApplePay/ApplePayService.js +1 -1
  79. package/dist/es-legacy/components/ApplePay/ApplePayService.js.map +1 -1
  80. package/dist/es-legacy/components/Card/Card.js +1 -1
  81. package/dist/es-legacy/components/Card/Card.js.map +1 -1
  82. package/dist/es-legacy/components/Card/components/CardInput/defaultProps.js +1 -1
  83. package/dist/es-legacy/components/Card/components/CardInput/defaultProps.js.map +1 -1
  84. package/dist/es-legacy/components/Card/components/ClickToPayHolder.js +1 -1
  85. package/dist/es-legacy/components/Card/components/ClickToPayHolder.js.map +1 -1
  86. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodBrands/PaymentMethodBrands.js +1 -1
  87. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodBrands/PaymentMethodBrands.js.map +1 -1
  88. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  89. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  90. package/dist/es-legacy/components/Dropin/elements/createElements.js +1 -1
  91. package/dist/es-legacy/components/Dropin/elements/createElements.js.map +1 -1
  92. package/dist/es-legacy/components/Dropin/elements/filters.js +1 -1
  93. package/dist/es-legacy/components/Dropin/elements/filters.js.map +1 -1
  94. package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js +2 -0
  95. package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js.map +1 -0
  96. package/dist/es-legacy/components/components-name-map.js +1 -1
  97. package/dist/es-legacy/components/components-name-map.js.map +1 -1
  98. package/dist/es-legacy/components/index.js +1 -1
  99. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
  100. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
  101. package/dist/es-legacy/components/internal/Button/Button.js +1 -1
  102. package/dist/es-legacy/components/internal/Button/Button.js.map +1 -1
  103. package/dist/es-legacy/components/internal/ClickToPay/ClickToPayComponent.js +1 -1
  104. package/dist/es-legacy/components/internal/ClickToPay/ClickToPayComponent.js.map +1 -1
  105. package/dist/es-legacy/components/internal/ClickToPay/components/CtPCards/CtPCards.js +1 -1
  106. package/dist/es-legacy/components/internal/ClickToPay/components/CtPCards/CtPCards.js.map +1 -1
  107. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLogin.js +1 -1
  108. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLogin.js.map +1 -1
  109. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js +1 -1
  110. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js.map +1 -1
  111. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePassword.js +1 -1
  112. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePassword.js.map +1 -1
  113. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js +1 -1
  114. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js.map +1 -1
  115. package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPSection.js +1 -1
  116. package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPSection.js.map +1 -1
  117. package/dist/es-legacy/components/internal/ClickToPay/errors/TimeoutError.js +1 -1
  118. package/dist/es-legacy/components/internal/ClickToPay/errors/TimeoutError.js.map +1 -1
  119. package/dist/es-legacy/components/internal/ClickToPay/services/ClickToPayService.js +1 -1
  120. package/dist/es-legacy/components/internal/ClickToPay/services/ClickToPayService.js.map +1 -1
  121. package/dist/es-legacy/components/internal/ClickToPay/services/execute-with-timeout.js +2 -0
  122. package/dist/es-legacy/components/internal/ClickToPay/services/execute-with-timeout.js.map +1 -0
  123. package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
  124. package/dist/es-legacy/components/tx-variants.js +1 -1
  125. package/dist/es-legacy/components/tx-variants.js.map +1 -1
  126. package/dist/es-legacy/core/Analytics/Analytics.js +1 -1
  127. package/dist/es-legacy/core/Analytics/Analytics.js.map +1 -1
  128. package/dist/es-legacy/core/Analytics/constants.js +1 -1
  129. package/dist/es-legacy/core/Analytics/constants.js.map +1 -1
  130. package/dist/es-legacy/core/Analytics/utils.js +1 -1
  131. package/dist/es-legacy/core/Analytics/utils.js.map +1 -1
  132. package/dist/es-legacy/core/CheckoutSession/CheckoutSession.js +1 -1
  133. package/dist/es-legacy/core/CheckoutSession/CheckoutSession.js.map +1 -1
  134. package/dist/es-legacy/core/Context/CoreProvider.js +1 -1
  135. package/dist/es-legacy/core/Context/CoreProvider.js.map +1 -1
  136. package/dist/es-legacy/core/ProcessResponse/PaymentMethods/filters.js +1 -1
  137. package/dist/es-legacy/core/ProcessResponse/PaymentMethods/filters.js.map +1 -1
  138. package/dist/es-legacy/core/Services/analytics/collect-id.js +1 -1
  139. package/dist/es-legacy/core/Services/sessions/setup-session.js +1 -1
  140. package/dist/es-legacy/core/Services/sessions/setup-session.js.map +1 -1
  141. package/dist/es-legacy/core/core.js +1 -1
  142. package/dist/es-legacy/index.js +1 -1
  143. package/dist/es-legacy/utils/listenerUtils.js +1 -1
  144. package/dist/es-legacy/utils/listenerUtils.js.map +1 -1
  145. package/package.json +5 -4
  146. package/styles/adyen.css +85 -0
@@ -1 +1 @@
1
- {"version":3,"file":"components-name-map.js","sources":["../../../src/components/components-name-map.ts"],"sourcesContent":["import { TxVariants } from './tx-variants';\n\n/**\n * Maps each payment type with the string name of its Component element.\n *\n * It is used to give nicer error messages when creating components using Drop-in.\n * Example: paymentMethods response contains blik, but Blik component is not configured. So it warns that 'Blik' must be imported and added to the Drop-in configuration.\n */\nconst ComponentsNameMap = {\n /** internal */\n [TxVariants.address]: 'Address',\n [TxVariants.bankTransfer_IBAN]: 'BankTransfer',\n [TxVariants.donation]: 'Donation',\n [TxVariants.personal_details]: 'PersonalDetails',\n /** internal */\n\n /** Card */\n [TxVariants.bcmc]: 'Bancontact',\n [TxVariants.card]: 'Card',\n [TxVariants.scheme]: 'Card',\n [TxVariants.storedCard]: 'Card',\n [TxVariants.customCard]: 'CustomCard',\n /** Card */\n\n /** Direct debit */\n [TxVariants.ach]: 'Ach',\n [TxVariants.directdebit_GB]: 'BacsDD',\n [TxVariants.sepadirectdebit]: 'Sepa',\n /** Direct debit */\n\n /** Open Invoice */\n [TxVariants.affirm]: 'Affirm',\n [TxVariants.afterpay]: 'AfterPay',\n [TxVariants.afterpay_default]: 'AfterPay',\n [TxVariants.afterpay_b2b]: 'AfterPayB2B',\n [TxVariants.atome]: 'Atome',\n [TxVariants.facilypay_3x]: 'FacilyPay3x',\n [TxVariants.facilypay_4x]: 'FacilyPay4x',\n [TxVariants.facilypay_6x]: 'FacilyPay6x',\n [TxVariants.facilypay_10x]: 'FacilyPay10x',\n [TxVariants.facilypay_12x]: 'FacilyPay12x',\n [TxVariants.ratepay]: 'RatePay',\n [TxVariants.ratepay_directdebit]: 'RatePayDirectDebit',\n [TxVariants.riverty]: 'Riverty',\n /** Open Invoice */\n\n /** Wallets */\n [TxVariants.amazonpay]: 'AmazonPay',\n [TxVariants.applepay]: 'ApplePay',\n [TxVariants.cashapp]: 'CashAppPay',\n [TxVariants.clicktopay]: 'ClickToPay',\n [TxVariants.googlepay]: 'GooglePay',\n [TxVariants.paypal]: 'PayPal',\n [TxVariants.paywithgoogle]: 'GooglePay',\n /** Wallets */\n\n /** Voucher */\n [TxVariants.boletobancario]: 'Boleto',\n [TxVariants.boletobancario_itau]: 'Boleto',\n [TxVariants.boletobancario_santander]: 'Boleto',\n [TxVariants.doku]: 'Doku',\n [TxVariants.doku_alfamart]: 'Doku',\n [TxVariants.doku_permata_lite_atm]: 'Doku',\n [TxVariants.doku_indomaret]: 'Doku',\n [TxVariants.doku_atm_mandiri_va]: 'Doku',\n [TxVariants.doku_sinarmas_va]: 'Doku',\n [TxVariants.doku_mandiri_va]: 'Doku',\n [TxVariants.doku_cimb_va]: 'Doku',\n [TxVariants.doku_danamon_va]: 'Doku',\n [TxVariants.doku_bri_va]: 'Doku',\n [TxVariants.doku_bni_va]: 'Doku',\n [TxVariants.doku_bca_va]: 'Doku',\n [TxVariants.doku_wallet]: 'Doku',\n [TxVariants.oxxo]: 'Oxxo',\n [TxVariants.primeiropay_boleto]: 'Boleto',\n /** Voucher */\n\n /** issuerList */\n [TxVariants.billdesk_online]: 'BillDeskOnline',\n [TxVariants.billdesk_wallet]: 'BillDeskWallet',\n [TxVariants.dotpay]: 'Dotpay',\n [TxVariants.eps]: 'Eps',\n [TxVariants.molpay_ebanking_fpx_MY]: 'MolPayEBankingMY',\n [TxVariants.molpay_ebanking_TH]: 'MolPayEBankingTH',\n [TxVariants.molpay_ebanking_VN]: 'MolPayEBankingVN',\n [TxVariants.onlineBanking_CZ]: 'OnlineBankingCZ',\n [TxVariants.onlinebanking_IN]: 'OnlineBankingIN', // NOTE: the txVariant does have a lowercase \"b\"\n [TxVariants.onlineBanking_PL]: 'OnlineBankingPL',\n [TxVariants.onlineBanking_SK]: 'OnlineBankingSK',\n [TxVariants.paybybank]: 'PayByBank',\n [TxVariants.payu_IN_cashcard]: 'PayuCashcard',\n [TxVariants.payu_IN_nb]: 'PayuNetBanking',\n [TxVariants.wallet_IN]: 'WalletINElement',\n /** issuerList */\n\n /** Dragonpay */\n [TxVariants.dragonpay_ebanking]: 'Dragonpay',\n [TxVariants.dragonpay_otc_banking]: 'Dragonpay',\n [TxVariants.dragonpay_otc_non_banking]: 'Dragonpay',\n [TxVariants.dragonpay_otc_philippines]: 'Dragonpay',\n /** Dragonpay */\n\n /** Econtext */\n [TxVariants.econtext_atm]: 'Econtext',\n [TxVariants.econtext_online]: 'Econtext',\n [TxVariants.econtext_seven_eleven]: 'Econtext',\n [TxVariants.econtext_stores]: 'Econtext',\n /** Econtext */\n\n /** Redirect */\n [TxVariants.giropay]: 'Giropay',\n [TxVariants.multibanco]: 'Multibanco',\n [TxVariants.redirect]: 'Redirect',\n [TxVariants.twint]: 'Twint',\n [TxVariants.vipps]: 'Vipps',\n [TxVariants.trustly]: 'Trustly',\n /** Redirect */\n\n /** Klarna */\n [TxVariants.klarna]: 'Klarna',\n [TxVariants.klarna_account]: 'Klarna',\n [TxVariants.klarna_paynow]: 'Klarna',\n [TxVariants.klarna_b2b]: 'Klarna',\n /** Klarna */\n\n /** QRLoader */\n [TxVariants.bcmc_mobile]: 'BcmcMobile',\n [TxVariants.bcmc_mobile_QR]: 'BcmcMobile',\n [TxVariants.pix]: 'Pix',\n [TxVariants.swish]: 'Swish',\n [TxVariants.wechatpay]: 'WeChat',\n [TxVariants.wechatpayQR]: 'WeChat',\n [TxVariants.promptpay]: 'PromptPay',\n [TxVariants.paynow]: 'PayNow',\n [TxVariants.duitnow]: 'Duitnow',\n /** QRLoader */\n\n /** Await */\n [TxVariants.blik]: 'Blik',\n [TxVariants.mbway]: 'MBWay',\n [TxVariants.ancv]: 'ANCV',\n [TxVariants.upi]: 'UPI', // also QR\n [TxVariants.upi_qr]: 'UPI', // also QR\n [TxVariants.upi_collect]: 'UPI', // also QR\n [TxVariants.upi_intent]: 'UPI',\n /** Await */\n\n /** Giftcard */\n [TxVariants.giftcard]: 'Giftcard',\n [TxVariants.mealVoucher_FR_natixis]: 'MealVoucherFR',\n [TxVariants.mealVoucher_FR_sodexo]: 'MealVoucherFR',\n [TxVariants.mealVoucher_FR_groupeup]: 'MealVoucherFR'\n /** Giftcard */\n};\n\n/**\n * Returns the Component name based on the payment type\n * @param paymentType\n */\nfunction getComponentNameOfPaymentType(paymentType: string): string {\n return ComponentsNameMap[paymentType];\n}\n\nexport default getComponentNameOfPaymentType;\n"],"names":["ComponentsNameMap","TxVariants","address","bankTransfer_IBAN","donation","personal_details","bcmc","card","scheme","storedCard","customCard","ach","directdebit_GB","sepadirectdebit","affirm","afterpay","afterpay_default","afterpay_b2b","atome","facilypay_3x","facilypay_4x","facilypay_6x","facilypay_10x","facilypay_12x","ratepay","ratepay_directdebit","riverty","amazonpay","applepay","cashapp","clicktopay","googlepay","paypal","paywithgoogle","boletobancario","boletobancario_itau","boletobancario_santander","doku","doku_alfamart","doku_permata_lite_atm","doku_indomaret","doku_atm_mandiri_va","doku_sinarmas_va","doku_mandiri_va","doku_cimb_va","doku_danamon_va","doku_bri_va","doku_bni_va","doku_bca_va","doku_wallet","oxxo","primeiropay_boleto","billdesk_online","billdesk_wallet","dotpay","eps","molpay_ebanking_fpx_MY","molpay_ebanking_TH","molpay_ebanking_VN","onlineBanking_CZ","onlinebanking_IN","onlineBanking_PL","onlineBanking_SK","paybybank","payu_IN_cashcard","payu_IN_nb","wallet_IN","dragonpay_ebanking","dragonpay_otc_banking","dragonpay_otc_non_banking","dragonpay_otc_philippines","econtext_atm","econtext_online","econtext_seven_eleven","econtext_stores","giropay","multibanco","redirect","twint","vipps","trustly","klarna","klarna_account","klarna_paynow","klarna_b2b","bcmc_mobile","bcmc_mobile_QR","pix","swish","wechatpay","wechatpayQR","promptpay","paynow","duitnow","blik","mbway","ancv","upi","upi_qr","upi_collect","upi_intent","giftcard","mealVoucher_FR_natixis","mealVoucher_FR_sodexo","mealVoucher_FR_groupeup","getComponentNameOfPaymentType","paymentType"],"mappings":"8CAQA,MAAMA,EAAoB,CAEtB,CAACC,EAAWC,SAAU,UACtB,CAACD,EAAWE,mBAAoB,eAChC,CAACF,EAAWG,UAAW,WACvB,CAACH,EAAWI,kBAAmB,kBAI/B,CAACJ,EAAWK,MAAO,aACnB,CAACL,EAAWM,MAAO,OACnB,CAACN,EAAWO,QAAS,OACrB,CAACP,EAAWQ,YAAa,OACzB,CAACR,EAAWS,YAAa,aAIzB,CAACT,EAAWU,KAAM,MAClB,CAACV,EAAWW,gBAAiB,SAC7B,CAACX,EAAWY,iBAAkB,OAI9B,CAACZ,EAAWa,QAAS,SACrB,CAACb,EAAWc,UAAW,WACvB,CAACd,EAAWe,kBAAmB,WAC/B,CAACf,EAAWgB,cAAe,cAC3B,CAAChB,EAAWiB,OAAQ,QACpB,CAACjB,EAAWkB,cAAe,cAC3B,CAAClB,EAAWmB,cAAe,cAC3B,CAACnB,EAAWoB,cAAe,cAC3B,CAACpB,EAAWqB,eAAgB,eAC5B,CAACrB,EAAWsB,eAAgB,eAC5B,CAACtB,EAAWuB,SAAU,UACtB,CAACvB,EAAWwB,qBAAsB,qBAClC,CAACxB,EAAWyB,SAAU,UAItB,CAACzB,EAAW0B,WAAY,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,EAAWmE,uBAAwB,YACpC,CAACnE,EAAWoE,2BAA4B,YACxC,CAACpE,EAAWqE,2BAA4B,YAIxC,CAACrE,EAAWsE,cAAe,WAC3B,CAACtE,EAAWuE,iBAAkB,WAC9B,CAACvE,EAAWwE,uBAAwB,WACpC,CAACxE,EAAWyE,iBAAkB,WAI9B,CAACzE,EAAW0E,SAAU,UACtB,CAAC1E,EAAW2E,YAAa,aACzB,CAAC3E,EAAW4E,UAAW,WACvB,CAAC5E,EAAW6E,OAAQ,QACpB,CAAC7E,EAAW8E,OAAQ,QACpB,CAAC9E,EAAW+E,SAAU,UAItB,CAAC/E,EAAWgF,QAAS,SACrB,CAAChF,EAAWiF,gBAAiB,SAC7B,CAACjF,EAAWkF,eAAgB,SAC5B,CAAClF,EAAWmF,YAAa,SAIzB,CAACnF,EAAWoF,aAAc,aAC1B,CAACpF,EAAWqF,gBAAiB,aAC7B,CAACrF,EAAWsF,KAAM,MAClB,CAACtF,EAAWuF,OAAQ,QACpB,CAACvF,EAAWwF,WAAY,SACxB,CAACxF,EAAWyF,aAAc,SAC1B,CAACzF,EAAW0F,WAAY,YACxB,CAAC1F,EAAW2F,QAAS,SACrB,CAAC3F,EAAW4F,SAAU,UAItB,CAAC5F,EAAW6F,MAAO,OACnB,CAAC7F,EAAW8F,OAAQ,QACpB,CAAC9F,EAAW+F,MAAO,OACnB,CAAC/F,EAAWgG,KAAM,MAClB,CAAChG,EAAWiG,QAAS,MACrB,CAACjG,EAAWkG,aAAc,MAC1B,CAAClG,EAAWmG,YAAa,MAIzB,CAACnG,EAAWoG,UAAW,WACvB,CAACpG,EAAWqG,wBAAyB,gBACrC,CAACrG,EAAWsG,uBAAwB,gBACpC,CAACtG,EAAWuG,yBAA0B,iBAQ1C,SAASC,EAA8BC,GACnC,OAAO1G,EAAkB0G,EAC7B"}
1
+ {"version":3,"file":"components-name-map.js","sources":["../../../src/components/components-name-map.ts"],"sourcesContent":["import { TxVariants } from './tx-variants';\n\n/**\n * Maps each payment type with the string name of its Component element.\n *\n * It is used to give nicer error messages when creating components using Drop-in.\n * Example: paymentMethods response contains blik, but Blik component is not configured. So it warns that 'Blik' must be imported and added to the Drop-in configuration.\n */\nconst ComponentsNameMap = {\n /** internal */\n [TxVariants.address]: 'Address',\n [TxVariants.bankTransfer_IBAN]: 'BankTransfer',\n [TxVariants.donation]: 'Donation',\n [TxVariants.personal_details]: 'PersonalDetails',\n /** internal */\n\n /** Card */\n [TxVariants.bcmc]: 'Bancontact',\n [TxVariants.card]: 'Card',\n [TxVariants.scheme]: 'Card',\n [TxVariants.storedCard]: 'Card',\n [TxVariants.customCard]: 'CustomCard',\n /** Card */\n\n /** Direct debit */\n [TxVariants.ach]: 'Ach',\n [TxVariants.directdebit_GB]: 'BacsDirectDebit',\n [TxVariants.sepadirectdebit]: 'SepaDirectDebit',\n /** Direct debit */\n\n /** Open Invoice */\n [TxVariants.affirm]: 'Affirm',\n [TxVariants.afterpay]: 'AfterPay',\n [TxVariants.afterpay_default]: 'AfterPay',\n [TxVariants.afterpay_b2b]: 'AfterPayB2B',\n [TxVariants.atome]: 'Atome',\n [TxVariants.facilypay_3x]: 'FacilyPay3x',\n [TxVariants.facilypay_4x]: 'FacilyPay4x',\n [TxVariants.facilypay_6x]: 'FacilyPay6x',\n [TxVariants.facilypay_10x]: 'FacilyPay10x',\n [TxVariants.facilypay_12x]: 'FacilyPay12x',\n [TxVariants.ratepay]: 'RatePay',\n [TxVariants.ratepay_directdebit]: 'RatePayDirectDebit',\n [TxVariants.riverty]: 'Riverty',\n /** Open Invoice */\n\n /** Wallets */\n [TxVariants.amazonpay]: 'AmazonPay',\n [TxVariants.applepay]: 'ApplePay',\n [TxVariants.cashapp]: 'CashAppPay',\n [TxVariants.clicktopay]: 'ClickToPay',\n [TxVariants.googlepay]: 'GooglePay',\n [TxVariants.paypal]: 'PayPal',\n [TxVariants.paywithgoogle]: 'GooglePay',\n /** Wallets */\n\n /** Voucher */\n [TxVariants.boletobancario]: 'Boleto',\n [TxVariants.boletobancario_itau]: 'Boleto',\n [TxVariants.boletobancario_santander]: 'Boleto',\n [TxVariants.doku]: 'Doku',\n [TxVariants.doku_alfamart]: 'Doku',\n [TxVariants.doku_permata_lite_atm]: 'Doku',\n [TxVariants.doku_indomaret]: 'Doku',\n [TxVariants.doku_atm_mandiri_va]: 'Doku',\n [TxVariants.doku_sinarmas_va]: 'Doku',\n [TxVariants.doku_mandiri_va]: 'Doku',\n [TxVariants.doku_cimb_va]: 'Doku',\n [TxVariants.doku_danamon_va]: 'Doku',\n [TxVariants.doku_bri_va]: 'Doku',\n [TxVariants.doku_bni_va]: 'Doku',\n [TxVariants.doku_bca_va]: 'Doku',\n [TxVariants.doku_wallet]: 'Doku',\n [TxVariants.oxxo]: 'Oxxo',\n [TxVariants.primeiropay_boleto]: 'Boleto',\n /** Voucher */\n\n /** issuerList */\n [TxVariants.billdesk_online]: 'BillDeskOnline',\n [TxVariants.billdesk_wallet]: 'BillDeskWallet',\n [TxVariants.dotpay]: 'Dotpay',\n [TxVariants.eps]: 'Eps',\n [TxVariants.molpay_ebanking_fpx_MY]: 'MolPayEBankingMY',\n [TxVariants.molpay_ebanking_TH]: 'MolPayEBankingTH',\n [TxVariants.molpay_ebanking_VN]: 'MolPayEBankingVN',\n [TxVariants.onlineBanking_CZ]: 'OnlineBankingCZ',\n [TxVariants.onlinebanking_IN]: 'OnlineBankingIN', // NOTE: the txVariant does have a lowercase \"b\"\n [TxVariants.onlineBanking_PL]: 'OnlineBankingPL',\n [TxVariants.onlineBanking_SK]: 'OnlineBankingSK',\n [TxVariants.paybybank]: 'PayByBank',\n [TxVariants.payu_IN_cashcard]: 'PayuCashcard',\n [TxVariants.payu_IN_nb]: 'PayuNetBanking',\n [TxVariants.wallet_IN]: 'WalletINElement',\n /** issuerList */\n\n /** Dragonpay */\n [TxVariants.dragonpay_ebanking]: 'Dragonpay',\n [TxVariants.dragonpay_otc_banking]: 'Dragonpay',\n [TxVariants.dragonpay_otc_non_banking]: 'Dragonpay',\n [TxVariants.dragonpay_otc_philippines]: 'Dragonpay',\n /** Dragonpay */\n\n /** Econtext */\n [TxVariants.econtext_atm]: 'Econtext',\n [TxVariants.econtext_online]: 'Econtext',\n [TxVariants.econtext_seven_eleven]: 'Econtext',\n [TxVariants.econtext_stores]: 'Econtext',\n /** Econtext */\n\n /** Redirect */\n [TxVariants.giropay]: 'Giropay',\n [TxVariants.multibanco]: 'Multibanco',\n [TxVariants.redirect]: 'Redirect',\n [TxVariants.twint]: 'Twint',\n [TxVariants.vipps]: 'Vipps',\n [TxVariants.trustly]: 'Trustly',\n [TxVariants.paybybank_AIS_DD]: 'PayByBankUS',\n /** Redirect */\n\n /** Klarna */\n [TxVariants.klarna]: 'Klarna',\n [TxVariants.klarna_account]: 'Klarna',\n [TxVariants.klarna_paynow]: 'Klarna',\n [TxVariants.klarna_b2b]: 'Klarna',\n /** Klarna */\n\n /** QRLoader */\n [TxVariants.bcmc_mobile]: 'BcmcMobile',\n [TxVariants.bcmc_mobile_QR]: 'BcmcMobile',\n [TxVariants.pix]: 'Pix',\n [TxVariants.swish]: 'Swish',\n [TxVariants.wechatpay]: 'WeChat',\n [TxVariants.wechatpayQR]: 'WeChat',\n [TxVariants.promptpay]: 'PromptPay',\n [TxVariants.paynow]: 'PayNow',\n [TxVariants.duitnow]: 'DuitNow',\n /** QRLoader */\n\n /** Await */\n [TxVariants.blik]: 'Blik',\n [TxVariants.mbway]: 'MBWay',\n [TxVariants.ancv]: 'ANCV',\n [TxVariants.upi]: 'UPI', // also QR\n [TxVariants.upi_qr]: 'UPI', // also QR\n [TxVariants.upi_collect]: 'UPI', // also QR\n [TxVariants.upi_intent]: 'UPI',\n /** Await */\n\n /** Giftcard */\n [TxVariants.giftcard]: 'Giftcard',\n [TxVariants.mealVoucher_FR_natixis]: 'MealVoucherFR',\n [TxVariants.mealVoucher_FR_sodexo]: 'MealVoucherFR',\n [TxVariants.mealVoucher_FR_groupeup]: 'MealVoucherFR'\n /** Giftcard */\n};\n\n/**\n * Returns the Component name based on the payment type\n * @param paymentType\n */\nfunction getComponentNameOfPaymentType(paymentType: string): string {\n return ComponentsNameMap[paymentType];\n}\n\nexport default getComponentNameOfPaymentType;\n"],"names":["ComponentsNameMap","TxVariants","address","bankTransfer_IBAN","donation","personal_details","bcmc","card","scheme","storedCard","customCard","ach","directdebit_GB","sepadirectdebit","affirm","afterpay","afterpay_default","afterpay_b2b","atome","facilypay_3x","facilypay_4x","facilypay_6x","facilypay_10x","facilypay_12x","ratepay","ratepay_directdebit","riverty","amazonpay","applepay","cashapp","clicktopay","googlepay","paypal","paywithgoogle","boletobancario","boletobancario_itau","boletobancario_santander","doku","doku_alfamart","doku_permata_lite_atm","doku_indomaret","doku_atm_mandiri_va","doku_sinarmas_va","doku_mandiri_va","doku_cimb_va","doku_danamon_va","doku_bri_va","doku_bni_va","doku_bca_va","doku_wallet","oxxo","primeiropay_boleto","billdesk_online","billdesk_wallet","dotpay","eps","molpay_ebanking_fpx_MY","molpay_ebanking_TH","molpay_ebanking_VN","onlineBanking_CZ","onlinebanking_IN","onlineBanking_PL","onlineBanking_SK","paybybank","payu_IN_cashcard","payu_IN_nb","wallet_IN","dragonpay_ebanking","dragonpay_otc_banking","dragonpay_otc_non_banking","dragonpay_otc_philippines","econtext_atm","econtext_online","econtext_seven_eleven","econtext_stores","giropay","multibanco","redirect","twint","vipps","trustly","paybybank_AIS_DD","klarna","klarna_account","klarna_paynow","klarna_b2b","bcmc_mobile","bcmc_mobile_QR","pix","swish","wechatpay","wechatpayQR","promptpay","paynow","duitnow","blik","mbway","ancv","upi","upi_qr","upi_collect","upi_intent","giftcard","mealVoucher_FR_natixis","mealVoucher_FR_sodexo","mealVoucher_FR_groupeup","getComponentNameOfPaymentType","paymentType"],"mappings":"8CAQA,MAAMA,EAAoB,CAEtB,CAACC,EAAWC,SAAU,UACtB,CAACD,EAAWE,mBAAoB,eAChC,CAACF,EAAWG,UAAW,WACvB,CAACH,EAAWI,kBAAmB,kBAI/B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vF,EAAWwF,OAAQ,QACpB,CAACxF,EAAWyF,WAAY,SACxB,CAACzF,EAAW0F,aAAc,SAC1B,CAAC1F,EAAW2F,WAAY,YACxB,CAAC3F,EAAW4F,QAAS,SACrB,CAAC5F,EAAW6F,SAAU,UAItB,CAAC7F,EAAW8F,MAAO,OACnB,CAAC9F,EAAW+F,OAAQ,QACpB,CAAC/F,EAAWgG,MAAO,OACnB,CAAChG,EAAWiG,KAAM,MAClB,CAACjG,EAAWkG,QAAS,MACrB,CAAClG,EAAWmG,aAAc,MAC1B,CAACnG,EAAWoG,YAAa,MAIzB,CAACpG,EAAWqG,UAAW,WACvB,CAACrG,EAAWsG,wBAAyB,gBACrC,CAACtG,EAAWuG,uBAAwB,gBACpC,CAACvG,EAAWwG,yBAA0B,iBAQ1C,SAASC,EAA8BC,GACnC,OAAO3G,EAAkB2G,EAC7B"}
@@ -1,2 +1,2 @@
1
- export{CardElement as Card}from"./Card/Card.js";export{default as Bancontact}from"./Card/Bancontact.js";export{CustomCard}from"./CustomCard/CustomCard.js";export{default as ThreeDS2Challenge}from"./ThreeDS2/ThreeDS2Challenge.js";export{default as ThreeDS2DeviceFingerprint}from"./ThreeDS2/ThreeDS2DeviceFingerprint.js";export{AchElement as Ach}from"./Ach/Ach.js";export{default as BacsDirectDebit}from"./BacsDD/BacsDD.js";export{default as SepaDirectDebit}from"./Sepa/Sepa.js";export{default as Affirm}from"./Affirm/Affirm.js";export{default as AfterPay}from"./AfterPay/AfterPay.js";export{default as AfterPayB2B}from"./AfterPay/AfterPayB2B.js";export{default as Atome}from"./Atome/Atome.js";export{default as FacilPay3x}from"./FacilyPay/FacilyPay3x.js";export{default as FacilPay4x}from"./FacilyPay/FacilyPay4x.js";export{default as FacilPay6x}from"./FacilyPay/FacilyPay6x.js";export{default as FacilPay10x}from"./FacilyPay/FacilyPay10x.js";export{default as FacilPay12x}from"./FacilyPay/FacilyPay12x.js";export{default as RatePay}from"./RatePay/RatePay.js";export{default as RatePayDirectDebit}from"./RatePay/RatePayDirectDebit.js";export{default as Riverty}from"./Riverty/Riverty.js";export{AmazonPayElement as AmazonPay}from"./AmazonPay/AmazonPay.js";export{default as ApplePay}from"./ApplePay/ApplePay.js";export{CashAppPay}from"./CashAppPay/CashAppPay.js";export{ClickToPayElement as ClickToPay}from"./ClickToPay/ClickToPay.js";export{default as GooglePay}from"./GooglePay/GooglePay.js";export{default as PayPal}from"./PayPal/Paypal.js";export{BoletoElement as Boleto}from"./Boleto/Boleto.js";export{DokuElement as Doku}from"./Doku/Doku.js";export{OxxoElement as Oxxo}from"./Oxxo/Oxxo.js";export{default as BillDeskOnline}from"./BillDesk/BillDeskOnline.js";export{default as BillDeskWallet}from"./BillDesk/BillDeskWallet.js";export{default as Dotpay}from"./Dotpay/index.js";export{default as EPS}from"./EPS/index.js";export{default as MolPayEBankingMY}from"./MolPayEBanking/MolPayEBankingMY.js";export{default as MolPayEBankingTH}from"./MolPayEBanking/MolPayEBankingTH.js";export{default as MolPayEBankingVN}from"./MolPayEBanking/MolPayEBankingVN.js";export{default as OnlineBankingCZ}from"./OnlineBankingCZ/index.js";export{default as OnlineBankingIN}from"./OnlineBankingIN/index.js";export{default as OnlineBankingPL}from"./OnlineBankingPL/OnlineBankingPL.js";export{default as OnlineBankingSK}from"./OnlineBankingSK/index.js";export{default as OnlineBankingFI}from"./OnlineBankingFI/OnlineBankingFI.js";export{default as PayByBank}from"./PayByBank/PayByBank.js";export{default as PayuCashcard}from"./PayU/PayuCashcard.js";export{default as PayuNetBanking}from"./PayU/PayuNetBanking.js";export{default as WalletIN}from"./WalletIN/index.js";export{DragonpayElement as Dragonpay}from"./Dragonpay/Dragonpay.js";export{EcontextElement as Econtext}from"./Econtext/Econtext.js";export{default as Giropay}from"./Giropay/Giropay.js";export{MultibancoElement as Multibanco}from"./Multibanco/Multibanco.js";export{default as Redirect}from"./Redirect/Redirect.js";export{default as Twint}from"./Twint/Twint.js";export{default as Vipps}from"./Vipps/Vipps.js";export{default as Trustly}from"./Trustly/Trustly.js";export{default as Klarna}from"./Klarna/KlarnaPayments.js";export{default as BcmcMobile}from"./BcmcMobile/BcmcMobile.js";export{default as Pix}from"./Pix/Pix.js";export{default as Swish}from"./Swish/Swish.js";export{default as WeChat}from"./WeChat/WeChat.js";export{default as PromptPay}from"./PromptPay/PromptPay.js";export{default as PayNow}from"./PayNow/PayNow.js";export{default as DuitNow}from"./DuitNow/DuitNow.js";export{default as PayMe}from"./PayMe/PayMe.js";export{default as Blik}from"./Blik/Blik.js";export{MBWayElement as MBWay}from"./MBWay/MBWay.js";export{default as UPI}from"./UPI/UPI.js";export{ANCVElement as ANCV}from"./ANCV/ANCV.js";export{GiftcardElement as Giftcard}from"./Giftcard/Giftcard.js";export{MealVoucherFRElement as MealVoucherFR}from"./MealVoucherFR/MealVoucherFR.js";export{AddressElement as Address}from"./Address/Address.js";export{BankTransferElement as BankTransfer}from"./BankTransfer/BankTransfer.js";export{default as Donation}from"./Donation/Donation.js";export{default as Dropin}from"./Dropin/Dropin.js";export{PersonalDetailsElement as PersonalDetails}from"./PersonalDetails/PersonalDetails.js";
1
+ export{CardElement as Card}from"./Card/Card.js";export{default as Bancontact}from"./Card/Bancontact.js";export{CustomCard}from"./CustomCard/CustomCard.js";export{default as ThreeDS2Challenge}from"./ThreeDS2/ThreeDS2Challenge.js";export{default as ThreeDS2DeviceFingerprint}from"./ThreeDS2/ThreeDS2DeviceFingerprint.js";export{AchElement as Ach}from"./Ach/Ach.js";export{default as BacsDirectDebit}from"./BacsDD/BacsDD.js";export{default as SepaDirectDebit}from"./Sepa/Sepa.js";export{default as Affirm}from"./Affirm/Affirm.js";export{default as AfterPay}from"./AfterPay/AfterPay.js";export{default as AfterPayB2B}from"./AfterPay/AfterPayB2B.js";export{default as Atome}from"./Atome/Atome.js";export{default as FacilPay3x}from"./FacilyPay/FacilyPay3x.js";export{default as FacilPay4x}from"./FacilyPay/FacilyPay4x.js";export{default as FacilPay6x}from"./FacilyPay/FacilyPay6x.js";export{default as FacilPay10x}from"./FacilyPay/FacilyPay10x.js";export{default as FacilPay12x}from"./FacilyPay/FacilyPay12x.js";export{default as RatePay}from"./RatePay/RatePay.js";export{default as RatePayDirectDebit}from"./RatePay/RatePayDirectDebit.js";export{default as Riverty}from"./Riverty/Riverty.js";export{AmazonPayElement as AmazonPay}from"./AmazonPay/AmazonPay.js";export{default as ApplePay}from"./ApplePay/ApplePay.js";export{CashAppPay}from"./CashAppPay/CashAppPay.js";export{ClickToPayElement as ClickToPay}from"./ClickToPay/ClickToPay.js";export{default as GooglePay}from"./GooglePay/GooglePay.js";export{default as PayPal}from"./PayPal/Paypal.js";export{BoletoElement as Boleto}from"./Boleto/Boleto.js";export{DokuElement as Doku}from"./Doku/Doku.js";export{OxxoElement as Oxxo}from"./Oxxo/Oxxo.js";export{default as BillDeskOnline}from"./BillDesk/BillDeskOnline.js";export{default as BillDeskWallet}from"./BillDesk/BillDeskWallet.js";export{default as Dotpay}from"./Dotpay/index.js";export{default as EPS}from"./EPS/index.js";export{default as MolPayEBankingMY}from"./MolPayEBanking/MolPayEBankingMY.js";export{default as MolPayEBankingTH}from"./MolPayEBanking/MolPayEBankingTH.js";export{default as MolPayEBankingVN}from"./MolPayEBanking/MolPayEBankingVN.js";export{default as OnlineBankingCZ}from"./OnlineBankingCZ/index.js";export{default as OnlineBankingIN}from"./OnlineBankingIN/index.js";export{default as OnlineBankingPL}from"./OnlineBankingPL/OnlineBankingPL.js";export{default as OnlineBankingSK}from"./OnlineBankingSK/index.js";export{default as OnlineBankingFI}from"./OnlineBankingFI/OnlineBankingFI.js";export{default as PayByBank}from"./PayByBank/PayByBank.js";export{default as PayuCashcard}from"./PayU/PayuCashcard.js";export{default as PayuNetBanking}from"./PayU/PayuNetBanking.js";export{default as WalletIN}from"./WalletIN/index.js";export{DragonpayElement as Dragonpay}from"./Dragonpay/Dragonpay.js";export{EcontextElement as Econtext}from"./Econtext/Econtext.js";export{default as Giropay}from"./Giropay/Giropay.js";export{MultibancoElement as Multibanco}from"./Multibanco/Multibanco.js";export{default as Redirect}from"./Redirect/Redirect.js";export{default as Twint}from"./Twint/Twint.js";export{default as Vipps}from"./Vipps/Vipps.js";export{default as Trustly}from"./Trustly/Trustly.js";export{default as PayByBankUS}from"./PayByBankUS/PayByBankUS.js";export{default as Klarna}from"./Klarna/KlarnaPayments.js";export{default as BcmcMobile}from"./BcmcMobile/BcmcMobile.js";export{default as Pix}from"./Pix/Pix.js";export{default as Swish}from"./Swish/Swish.js";export{default as WeChat}from"./WeChat/WeChat.js";export{default as PromptPay}from"./PromptPay/PromptPay.js";export{default as PayNow}from"./PayNow/PayNow.js";export{default as DuitNow}from"./DuitNow/DuitNow.js";export{default as PayMe}from"./PayMe/PayMe.js";export{default as Blik}from"./Blik/Blik.js";export{MBWayElement as MBWay}from"./MBWay/MBWay.js";export{default as UPI}from"./UPI/UPI.js";export{ANCVElement as ANCV}from"./ANCV/ANCV.js";export{GiftcardElement as Giftcard}from"./Giftcard/Giftcard.js";export{MealVoucherFRElement as MealVoucherFR}from"./MealVoucherFR/MealVoucherFR.js";export{AddressElement as Address}from"./Address/Address.js";export{BankTransferElement as BankTransfer}from"./BankTransfer/BankTransfer.js";export{default as Donation}from"./Donation/Donation.js";export{default as Dropin}from"./Dropin/Dropin.js";export{PersonalDetailsElement as PersonalDetails}from"./PersonalDetails/PersonalDetails.js";
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- import{render as t}from"../../../external/preact/dist/preact.js";import e from"../../../utils/getProp.js";import s from"../../../utils/uuid.js";import o from"../../../core/Errors/AdyenCheckoutError.js";import{ANALYTICS_RENDERED_STR as r}from"../../../core/Analytics/constants.js";import{on as n,off as i}from"../../../utils/listenerUtils.js";class a{_id=`${this.constructor.type}-${s()}`;core;props;state={};_component;_node=null;static defaultProps={};constructor(t,e){const s=function(t){return!!t&&("function"==typeof t.initialize&&"function"==typeof t.createFromAction)}(t);if(!s)throw new o("IMPLEMENTATION_ERROR",`Trying to initialise the component '${this.constructor.type}' without a reference to an instance of AdyenCheckout`);this.core=t,this.buildElementProps(e),this.handleKeyPress=this.handleKeyPress.bind(this)}buildElementProps(t){this.props=this.formatProps({...this.constructor.defaultProps,...t})}formatProps(t){return t}formatData(){return{}}setUpAnalytics(t){return null}submitAnalytics(t){return null}handleKeyPress(t){return null}setState(t){this.state={...this.state,...t}}get data(){const t=e(this.props,"modules.risk.data"),s=!!e(this.props,"modules.analytics.getEnabled")?.()?e(this.props,"modules.analytics.getCheckoutAttemptId")?.():"do-not-track",o=this.state.order||this.props.order,r=this.formatData();if(r.paymentMethod&&s&&(r.paymentMethod.checkoutAttemptId=s),"riverty"!==this.props.type&&r.billingAddress){const{firstName:t,lastName:e,...s}=r.billingAddress;r.billingAddress={...s}}return{...t&&{riskData:{clientData:t}},...o&&{order:{orderData:o.orderData,pspReference:o.pspReference}},...r,clientStateDataIndicator:!0}}render(){throw new Error("Payment method cannot be rendered.")}mount(e){const s="string"==typeof e?document.querySelector(e):e;if(!s)throw new Error("Component could not mount. Root node was not found.");const o=!this._node;return this._node&&this.unmount(),this._node=s,n(this._node,"keypress",this.handleKeyPress),this._component=this.render(),t(this._component,s),o&&this.props.modules&&this.props.modules.analytics&&this.setUpAnalytics({containerWidth:s&&s.offsetWidth,component:this.props.isDropin?"dropin":this.constructor.analyticsType??this.constructor.type,flavor:this.props.isDropin?"dropin":"components"}).then((()=>{this.props.isDropin||this.submitAnalytics({type:r})})),this}update(t){return this.props=this.formatProps({...this.props,...t}),this.state={},this.unmount().mount(this._node)}unmount(){return i(this._node,"keypress",this.handleKeyPress),this._node&&t(null,this._node),this}remove(){this.unmount(),this.core&&this.core.remove(this)}}export{a as default};
1
+ import{render as t}from"../../../external/preact/dist/preact.js";import e from"../../../utils/getProp.js";import s from"../../../utils/uuid.js";import o from"../../../core/Errors/AdyenCheckoutError.js";import{NO_CHECKOUT_ATTEMPT_ID as r,ANALYTICS_RENDERED_STR as n}from"../../../core/Analytics/constants.js";import{on as i,off as p}from"../../../utils/listenerUtils.js";class a{_id=`${this.constructor.type}-${s()}`;core;props;state={};_component;_node=null;static defaultProps={};constructor(t,e){const s=function(t){return!!t&&("function"==typeof t.initialize&&"function"==typeof t.createFromAction)}(t);if(!s)throw new o("IMPLEMENTATION_ERROR",`Trying to initialise the component '${this.constructor.type}' without a reference to an instance of AdyenCheckout`);this.core=t,this.buildElementProps(e),this.handleKeyPress=this.handleKeyPress.bind(this)}buildElementProps(t){this.props=this.formatProps({...this.constructor.defaultProps,...t})}formatProps(t){return t}formatData(){return{}}setUpAnalytics(t){return null}submitAnalytics(t){return null}handleKeyPress(t){return null}setState(t){this.state={...this.state,...t}}get data(){const t=e(this.props,"modules.risk.data"),s=e(this.props,"modules.analytics.getCheckoutAttemptId")?.()??r,o=this.state.order||this.props.order,n=this.formatData();if(n.paymentMethod&&s&&(n.paymentMethod.checkoutAttemptId=s),"riverty"!==this.props.type&&n.billingAddress){const{firstName:t,lastName:e,...s}=n.billingAddress;n.billingAddress={...s}}return{...t&&{riskData:{clientData:t}},...o&&{order:{orderData:o.orderData,pspReference:o.pspReference}},...n,clientStateDataIndicator:!0}}render(){throw new Error("Payment method cannot be rendered.")}mount(e){const s="string"==typeof e?document.querySelector(e):e;if(!s)throw new Error("Component could not mount. Root node was not found.");const o=!this._node;return this._node&&this.unmount(),this._node=s,i(this._node,"keypress",this.handleKeyPress,!1),this._component=this.render(),t(this._component,s),o&&this.props.modules&&this.props.modules.analytics&&this.setUpAnalytics({containerWidth:s&&s.offsetWidth,component:this.props.isDropin?"dropin":this.constructor.analyticsType??this.constructor.type,flavor:this.props.isDropin?"dropin":"components"}).then((()=>{this.props.isDropin||this.submitAnalytics({type:n})})),this}update(t){return this.props=this.formatProps({...this.props,...t}),this.state={},this.unmount().mount(this._node)}unmount(){return p(this._node,"keypress",this.handleKeyPress),this._node&&t(null,this._node),this}remove(){this.unmount(),this.core&&this.core.remove(this)}}export{a as default};
2
2
  //# sourceMappingURL=BaseElement.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BaseElement.js","sources":["../../../../../src/components/internal/BaseElement/BaseElement.ts"],"sourcesContent":["import { ComponentChild, h, render } from 'preact';\nimport getProp from '../../../utils/getProp';\nimport uuid from '../../../utils/uuid';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { ANALYTICS_RENDERED_STR } from '../../../core/Analytics/constants';\n\nimport type { ICore } from '../../../core/types';\nimport type { BaseElementProps, IBaseElement } from './types';\nimport type { PaymentData } from '../../../types/global-types';\nimport type { AnalyticsInitialEvent, SendAnalyticsObject } from '../../../core/Analytics/types';\nimport { off, on } from '../../../utils/listenerUtils';\n\n/**\n * Verify if the first parameter is instance of Core.\n * We do not use 'instanceof' to avoid importing the Core class directly into this class.\n * @param checkout\n */\nfunction assertIsCoreInstance(checkout: ICore): checkout is ICore {\n if (!checkout) return false;\n const isCoreObject = typeof checkout.initialize === 'function' && typeof checkout.createFromAction === 'function';\n return isCoreObject;\n}\n\nabstract class BaseElement<P extends BaseElementProps> implements IBaseElement {\n public readonly _id = `${this.constructor['type']}-${uuid()}`;\n public readonly core: ICore;\n\n public props: P;\n public state: any = {};\n public _component;\n\n protected _node: HTMLElement = null;\n\n protected static defaultProps = {};\n\n constructor(checkout: ICore, props?: P) {\n const isCoreInstance = assertIsCoreInstance(checkout);\n\n if (!isCoreInstance) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Trying to initialise the component '${this.constructor['type']}' without a reference to an instance of AdyenCheckout`\n );\n }\n\n this.core = checkout;\n this.buildElementProps(props);\n\n this.handleKeyPress = this.handleKeyPress.bind(this);\n }\n\n protected buildElementProps(componentProps?: P) {\n this.props = this.formatProps({ ...this.constructor['defaultProps'], ...componentProps });\n }\n\n /**\n * Executed during creation of any payment element.\n * Gives a chance to any paymentMethod to format the props we're receiving.\n */\n protected formatProps(props: P) {\n return props;\n }\n\n /**\n * Executed on the `data` getter.\n * Returns the component data necessary for the /payments request\n */\n protected formatData(): any {\n return {};\n }\n\n /* eslint-disable-next-line */\n protected setUpAnalytics(setUpAnalyticsObj: AnalyticsInitialEvent) {\n return null;\n }\n\n /* eslint-disable-next-line */\n protected submitAnalytics(analyticsObj?: SendAnalyticsObject) {\n return null;\n }\n\n /* eslint-disable-next-line */\n protected handleKeyPress(e: h.JSX.TargetedKeyboardEvent<HTMLInputElement>) {\n return null;\n }\n\n protected setState(newState: object): void {\n this.state = { ...this.state, ...newState };\n }\n\n /**\n * Returns the component payment data ready to submit to the Checkout API\n * Note: this does not ensure validity, check isValid first\n */\n public get data(): PaymentData {\n const clientData = getProp(this.props, 'modules.risk.data');\n const useAnalytics = !!getProp(this.props, 'modules.analytics.getEnabled')?.();\n const checkoutAttemptId = useAnalytics ? getProp(this.props, 'modules.analytics.getCheckoutAttemptId')?.() : 'do-not-track';\n const order = this.state.order || this.props.order;\n const componentData = this.formatData();\n\n if (componentData.paymentMethod && checkoutAttemptId) {\n componentData.paymentMethod.checkoutAttemptId = checkoutAttemptId;\n }\n\n // Workaround, to be fixed properly\n // Remove the firstName & lastName in the billingAddress for non Riverty components\n // @ts-ignore type exists\n if (this.props.type !== 'riverty' && componentData.billingAddress) {\n const { firstName, lastName, ...rest } = componentData.billingAddress;\n componentData.billingAddress = { ...rest };\n }\n\n return {\n ...(clientData && { riskData: { clientData } }),\n ...(order && { order: { orderData: order.orderData, pspReference: order.pspReference } }),\n ...componentData,\n clientStateDataIndicator: true\n };\n }\n\n public render(): ComponentChild | Error {\n // render() not implemented in the element\n throw new Error('Payment method cannot be rendered.');\n }\n\n /**\n * Mounts an element into the dom\n * @param domNode - Node (or selector) where we will mount the payment element\n * @returns this - the payment element instance we mounted\n */\n public mount(domNode: HTMLElement | string): this {\n const node = typeof domNode === 'string' ? document.querySelector<HTMLElement>(domNode) : domNode;\n\n if (!node) {\n throw new Error('Component could not mount. Root node was not found.');\n }\n\n const setupAnalytics = !this._node;\n\n if (this._node) {\n this.unmount(); // new, if this._node exists then we are \"remounting\" so we first need to unmount if it's not already been done\n }\n\n this._node = node;\n\n // Add listener for key press events, notably 'Enter' key presses\n on(this._node, 'keypress', this.handleKeyPress);\n\n this._component = this.render();\n\n render(this._component, node);\n\n // Set up analytics (once, since this._node is currently undefined) now that we have mounted and rendered\n if (setupAnalytics) {\n if (this.props.modules && this.props.modules.analytics) {\n this.setUpAnalytics({\n containerWidth: node && node.offsetWidth,\n component: !this.props.isDropin ? this.constructor['analyticsType'] ?? this.constructor['type'] : 'dropin',\n flavor: !this.props.isDropin ? 'components' : 'dropin'\n }).then(() => {\n // Once the initial analytics set up call has been made...\n // ...create an analytics event declaring that the component has been rendered\n // (The dropin will do this itself from DropinComponent once the PM list has rendered)\n if (!this.props.isDropin) {\n this.submitAnalytics({ type: ANALYTICS_RENDERED_STR });\n }\n });\n }\n }\n\n return this;\n }\n\n /**\n * Updates props, resets the internal state and remounts the element.\n *\n * @param props - props to update\n * @returns this - the element instance\n */\n public update(props: Partial<P>): this {\n this.props = this.formatProps({ ...this.props, ...props });\n this.state = {};\n\n return this.unmount().mount(this._node); // for new mount fny\n }\n\n /**\n * Unmounts a payment element from the DOM\n */\n public unmount(): this {\n // Remove listener\n off(this._node, 'keypress', this.handleKeyPress);\n\n if (this._node) {\n render(null, this._node);\n }\n\n return this;\n }\n\n /**\n * Unmounts an element and removes it from the parent instance\n * For \"destroy\" type cleanup - when you don't intend to use the component again\n */\n public remove() {\n this.unmount();\n\n if (this.core) {\n this.core.remove(this);\n }\n }\n}\n\nexport default BaseElement;\n"],"names":["BaseElement","_id","this","constructor","uuid","core","props","state","_component","_node","static","checkout","isCoreInstance","initialize","createFromAction","assertIsCoreInstance","AdyenCheckoutError","buildElementProps","handleKeyPress","bind","componentProps","formatProps","formatData","setUpAnalytics","setUpAnalyticsObj","submitAnalytics","analyticsObj","e","setState","newState","data","clientData","getProp","checkoutAttemptId","order","componentData","paymentMethod","type","billingAddress","firstName","lastName","rest","riskData","orderData","pspReference","clientStateDataIndicator","render","Error","mount","domNode","node","document","querySelector","setupAnalytics","unmount","on","modules","analytics","containerWidth","offsetWidth","component","isDropin","flavor","then","ANALYTICS_RENDERED_STR","update","off","remove"],"mappings":"sVAuBA,MAAeA,EACKC,IAAM,GAAGC,KAAKC,YAAmB,QAAIC,MACrCC,KAETC,MACAC,MAAa,CAAA,EACbC,WAEGC,MAAqB,KAE/BC,oBAAgC,CAAA,EAEhCP,WAAAA,CAAYQ,EAAiBL,GACzB,MAAMM,EAnBd,SAA8BD,GAC1B,QAAKA,IAC+C,mBAAxBA,EAASE,YAAkE,mBAA9BF,EAASG,iBAEtF,CAe+BC,CAAqBJ,GAE5C,IAAKC,EACD,MAAM,IAAII,EACN,uBACA,uCAAuCd,KAAKC,YAAmB,6DAIvED,KAAKG,KAAOM,EACZT,KAAKe,kBAAkBX,GAEvBJ,KAAKgB,eAAiBhB,KAAKgB,eAAeC,KAAKjB,KACnD,CAEUe,iBAAAA,CAAkBG,GACxBlB,KAAKI,MAAQJ,KAAKmB,YAAY,IAAKnB,KAAKC,YAA2B,gBAAKiB,GAC5E,CAMUC,WAAAA,CAAYf,GAClB,OAAOA,CACX,CAMA,UAAAgB,GACI,MAAO,EACX,CAGUC,cAAAA,CAAeC,GACrB,OAAO,IACX,CAGUC,eAAAA,CAAgBC,GACtB,OAAO,IACX,CAGUR,cAAAA,CAAeS,GACrB,OAAO,IACX,CAEUC,QAAAA,CAASC,GACf3B,KAAKK,MAAQ,IAAKL,KAAKK,SAAUsB,EACrC,CAMA,QAAWC,GACP,MAAMC,EAAaC,EAAQ9B,KAAKI,MAAO,qBAEjC2B,IADiBD,EAAQ9B,KAAKI,MAAO,+BAApB0B,KACkBA,EAAQ9B,KAAKI,MAAO,yCAApB0B,KAAoE,eACvGE,EAAQhC,KAAKK,MAAM2B,OAAShC,KAAKI,MAAM4B,MACvCC,EAAgBjC,KAAKoB,aAS3B,GAPIa,EAAcC,eAAiBH,IAC/BE,EAAcC,cAAcH,kBAAoBA,GAM5B,YAApB/B,KAAKI,MAA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,OAGfP,IACX,CAMA,MAAAiE,GACIjE,KAAKoD,UAEDpD,KAAKG,MACLH,KAAKG,KAAK8D,OAAOjE,KAEzB"}
1
+ {"version":3,"file":"BaseElement.js","sources":["../../../../../src/components/internal/BaseElement/BaseElement.ts"],"sourcesContent":["import { ComponentChild, h, render } from 'preact';\nimport getProp from '../../../utils/getProp';\nimport uuid from '../../../utils/uuid';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { ANALYTICS_RENDERED_STR, NO_CHECKOUT_ATTEMPT_ID } from '../../../core/Analytics/constants';\n\nimport type { ICore } from '../../../core/types';\nimport type { BaseElementProps, IBaseElement } from './types';\nimport type { PaymentData } from '../../../types/global-types';\nimport type { AnalyticsInitialEvent, SendAnalyticsObject } from '../../../core/Analytics/types';\nimport { off, on } from '../../../utils/listenerUtils';\n\n/**\n * Verify if the first parameter is instance of Core.\n * We do not use 'instanceof' to avoid importing the Core class directly into this class.\n * @param checkout\n */\nfunction assertIsCoreInstance(checkout: ICore): checkout is ICore {\n if (!checkout) return false;\n const isCoreObject = typeof checkout.initialize === 'function' && typeof checkout.createFromAction === 'function';\n return isCoreObject;\n}\n\nabstract class BaseElement<P extends BaseElementProps> implements IBaseElement {\n public readonly _id = `${this.constructor['type']}-${uuid()}`;\n public readonly core: ICore;\n\n public props: P;\n public state: any = {};\n public _component;\n\n protected _node: HTMLElement = null;\n\n protected static defaultProps = {};\n\n constructor(checkout: ICore, props?: P) {\n const isCoreInstance = assertIsCoreInstance(checkout);\n\n if (!isCoreInstance) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Trying to initialise the component '${this.constructor['type']}' without a reference to an instance of AdyenCheckout`\n );\n }\n\n this.core = checkout;\n this.buildElementProps(props);\n\n this.handleKeyPress = this.handleKeyPress.bind(this);\n }\n\n protected buildElementProps(componentProps?: P) {\n this.props = this.formatProps({ ...this.constructor['defaultProps'], ...componentProps });\n }\n\n /**\n * Executed during creation of any payment element.\n * Gives a chance to any paymentMethod to format the props we're receiving.\n */\n protected formatProps(props: P) {\n return props;\n }\n\n /**\n * Executed on the `data` getter.\n * Returns the component data necessary for the /payments request\n */\n protected formatData(): any {\n return {};\n }\n\n /* eslint-disable-next-line */\n protected setUpAnalytics(setUpAnalyticsObj: AnalyticsInitialEvent) {\n return null;\n }\n\n /* eslint-disable-next-line */\n protected submitAnalytics(analyticsObj?: SendAnalyticsObject) {\n return null;\n }\n\n /* eslint-disable-next-line */\n protected handleKeyPress(e: h.JSX.TargetedKeyboardEvent<HTMLInputElement>) {\n return null;\n }\n\n protected setState(newState: object): void {\n this.state = { ...this.state, ...newState };\n }\n\n /**\n * Returns the component payment data ready to submit to the Checkout API\n * Note: this does not ensure validity, check isValid first\n */\n public get data(): PaymentData {\n const clientData = getProp(this.props, 'modules.risk.data');\n const checkoutAttemptId = getProp(this.props, 'modules.analytics.getCheckoutAttemptId')?.() ?? NO_CHECKOUT_ATTEMPT_ID; // NOTE: we never expect to see this \"failed\" value, but, just in case...\n const order = this.state.order || this.props.order;\n const componentData = this.formatData();\n\n if (componentData.paymentMethod && checkoutAttemptId) {\n componentData.paymentMethod.checkoutAttemptId = checkoutAttemptId;\n }\n\n // Workaround, to be fixed properly\n // Remove the firstName & lastName in the billingAddress for non Riverty components\n // @ts-ignore type exists\n if (this.props.type !== 'riverty' && componentData.billingAddress) {\n const { firstName, lastName, ...rest } = componentData.billingAddress;\n componentData.billingAddress = { ...rest };\n }\n\n return {\n ...(clientData && { riskData: { clientData } }),\n ...(order && { order: { orderData: order.orderData, pspReference: order.pspReference } }),\n ...componentData,\n clientStateDataIndicator: true\n };\n }\n\n public render(): ComponentChild | Error {\n // render() not implemented in the element\n throw new Error('Payment method cannot be rendered.');\n }\n\n /**\n * Mounts an element into the dom\n * @param domNode - Node (or selector) where we will mount the payment element\n * @returns this - the payment element instance we mounted\n */\n public mount(domNode: HTMLElement | string): this {\n const node = typeof domNode === 'string' ? document.querySelector<HTMLElement>(domNode) : domNode;\n\n if (!node) {\n throw new Error('Component could not mount. Root node was not found.');\n }\n\n const setupAnalytics = !this._node;\n\n if (this._node) {\n this.unmount(); // new, if this._node exists then we are \"remounting\" so we first need to unmount if it's not already been done\n }\n\n this._node = node;\n\n // Add listener for key press events, notably 'Enter' key presses\n on(this._node, 'keypress', this.handleKeyPress, false);\n\n this._component = this.render();\n\n render(this._component, node);\n\n // Set up analytics (once, since this._node is currently undefined) now that we have mounted and rendered\n if (setupAnalytics) {\n if (this.props.modules && this.props.modules.analytics) {\n this.setUpAnalytics({\n containerWidth: node && node.offsetWidth,\n component: !this.props.isDropin ? (this.constructor['analyticsType'] ?? this.constructor['type']) : 'dropin',\n flavor: !this.props.isDropin ? 'components' : 'dropin'\n }).then(() => {\n // Once the initial analytics set up call has been made...\n // ...create an analytics event declaring that the component has been rendered\n // (The dropin will do this itself from DropinComponent once the PM list has rendered)\n if (!this.props.isDropin) {\n this.submitAnalytics({ type: ANALYTICS_RENDERED_STR });\n }\n });\n }\n }\n\n return this;\n }\n\n /**\n * Updates props, resets the internal state and remounts the element.\n *\n * @param props - props to update\n * @returns this - the element instance\n */\n public update(props: Partial<P>): this {\n this.props = this.formatProps({ ...this.props, ...props });\n this.state = {};\n\n return this.unmount().mount(this._node); // for new mount fny\n }\n\n /**\n * Unmounts a payment element from the DOM\n */\n public unmount(): this {\n // Remove listener\n off(this._node, 'keypress', this.handleKeyPress);\n\n if (this._node) {\n render(null, this._node);\n }\n\n return this;\n }\n\n /**\n * Unmounts an element and removes it from the parent instance\n * For \"destroy\" type cleanup - when you don't intend to use the component again\n */\n public remove() {\n this.unmount();\n\n if (this.core) {\n this.core.remove(this);\n }\n }\n}\n\nexport default BaseElement;\n"],"names":["BaseElement","_id","this","constructor","uuid","core","props","state","_component","_node","static","checkout","isCoreInstance","initialize","createFromAction","assertIsCoreInstance","AdyenCheckoutError","buildElementProps","handleKeyPress","bind","componentProps","formatProps","formatData","setUpAnalytics","setUpAnalyticsObj","submitAnalytics","analyticsObj","e","setState","newState","data","clientData","getProp","checkoutAttemptId","NO_CHECKOUT_ATTEMPT_ID","order","componentData","paymentMethod","type","billingAddress","firstName","lastName","rest","riskData","orderData","pspReference","clientStateDataIndicator","render","Error","mount","domNode","node","document","querySelector","setupAnalytics","unmount","on","modules","analytics","containerWidth","offsetWidth","component","isDropin","flavor","then","ANALYTICS_RENDERED_STR","update","off","remove"],"mappings":"kXAuBA,MAAeA,EACKC,IAAM,GAAGC,KAAKC,YAAmB,QAAIC,MACrCC,KAETC,MACAC,MAAa,CAAA,EACbC,WAEGC,MAAqB,KAE/BC,oBAAgC,CAAA,EAEhCP,WAAAA,CAAYQ,EAAiBL,GACzB,MAAMM,EAnBd,SAA8BD,GAC1B,QAAKA,IAC+C,mBAAxBA,EAASE,YAAkE,mBAA9BF,EAASG,iBAEtF,CAe+BC,CAAqBJ,GAE5C,IAAKC,EACD,MAAM,IAAII,EACN,uBACA,uCAAuCd,KAAKC,YAAmB,6DAIvED,KAAKG,KAAOM,EACZT,KAAKe,kBAAkBX,GAEvBJ,KAAKgB,eAAiBhB,KAAKgB,eAAeC,KAAKjB,KACnD,CAEUe,iBAAAA,CAAkBG,GACxBlB,KAAKI,MAAQJ,KAAKmB,YAAY,IAAKnB,KAAKC,YAA2B,gBAAKiB,GAC5E,CAMUC,WAAAA,CAAYf,GAClB,OAAOA,CACX,CAMA,UAAAgB,GACI,MAAO,EACX,CAGUC,cAAAA,CAAeC,GACrB,OAAO,IACX,CAGUC,eAAAA,CAAgBC,GACtB,OAAO,IACX,CAGUR,cAAAA,CAAeS,GACrB,OAAO,IACX,CAEUC,QAAAA,CAASC,GACf3B,KAAKK,MAAQ,IAAKL,KAAKK,SAAUsB,EACrC,CAMA,QAAWC,GACP,MAAMC,EAAaC,EAAQ9B,KAAKI,MAAO,qBACjC2B,EAAoBD,EAAQ9B,KAAKI,MAAO,yCAApB0B,MAAqEE,EACzFC,EAAQjC,KAAKK,MAAM4B,OAASjC,KAAKI,MAAM6B,MACvCC,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AAKO,MACrC,CAKA,OAAA8C,GAQI,OANAY,EAAIjE,KAAKO,MAAO,WAAYP,KAAKgB,gBAE7BhB,KAAKO,OACLsC,EAAO,KAAM7C,KAAKO,OAGfP,IACX,CAMA,MAAAkE,GACIlE,KAAKqD,UAEDrD,KAAKG,MACLH,KAAKG,KAAK+D,OAAOlE,KAEzB"}
@@ -1,2 +1,2 @@
1
- import{Component as e,createElement as t}from"../../../external/preact/dist/preact.js";import a from"../../../external/classnames/index.js";import n from"../Spinner/Spinner.js";import{useCoreContext as s}from"../../../core/Context/CoreProvider.js";class i extends e{static defaultProps={status:"default",variant:"primary",disabled:!1,label:"",inline:!1,target:"_self",onClick:()=>{}};onClick=e=>{e.preventDefault(),this.props.disabled||this.props.onClick(e,{complete:this.complete})};complete=(e=1e3)=>{this.setState({completed:!0}),setTimeout((()=>{this.setState({completed:!1})}),e)};render({classNameModifiers:e=[],disabled:i,href:o,icon:r,inline:l,label:c,status:d,variant:p},{completed:m}){const{i18n:u}=s(),_=r?t("img",{className:"adyen-checkout__button__icon",src:r,alt:"","aria-hidden":"true"}):"",h=[...e,..."primary"!==p?[p]:[],...l?["inline"]:[],...m?["completed"]:[],..."loading"===d||"redirect"===d?["loading"]:[]],b=a(["adyen-checkout__button",...h.map((e=>`adyen-checkout__button--${e}`))]),f={loading:t("span",{className:"adyen-checkout__button__content"},t(n,{size:"medium",inline:!0}),t("span",{className:"adyen-checkout__button__text--sr-only"},u.get("loading"))),redirect:t("span",{className:"adyen-checkout__button__content"},t(n,{size:"medium",inline:!0}),u.get("payButton.redirecting")),default:t("span",{className:"adyen-checkout__button__content"},_,t("span",{className:"adyen-checkout__button__text"},c))},k=f[d]||f.default;return o?t("a",{className:b,href:o,disabled:i,target:this.props.target,rel:this.props.rel},k):t("button",{className:b,type:"button",disabled:i,onClick:this.onClick},k,"loading"!==d&&"redirect"!==d&&this.props.children)}}export{i as default};
1
+ import{Component as e,createElement as t}from"../../../external/preact/dist/preact.js";import n from"../../../external/classnames/index.js";import a from"../Spinner/Spinner.js";import{useCoreContext as o}from"../../../core/Context/CoreProvider.js";class s extends e{static defaultProps={status:"default",variant:"primary",disabled:!1,label:"",inline:!1,target:"_self",onClick:()=>{}};onClick=e=>{e.preventDefault(),this.props.disabled||this.props.onClick(e,{complete:this.complete})};complete=(e=1e3)=>{this.setState({completed:!0}),setTimeout((()=>{this.setState({completed:!1})}),e)};onKeyDown=e=>{this.props.onKeyDown?.(e)};render({classNameModifiers:e=[],disabled:s,href:i,icon:r,inline:l,label:c,status:d,variant:p},{completed:m}){const{i18n:u}=o(),_=r?t("img",{className:"adyen-checkout__button__icon",src:r,alt:"","aria-hidden":"true"}):"",h=[...e,..."primary"!==p?[p]:[],...l?["inline"]:[],...m?["completed"]:[],..."loading"===d||"redirect"===d?["loading"]:[]],b=n(["adyen-checkout__button",...h.map((e=>`adyen-checkout__button--${e}`))]),y={loading:t("span",{className:"adyen-checkout__button__content"},t(a,{size:"medium",inline:!0}),t("span",{className:"adyen-checkout__button__text--sr-only"},u.get("loading"))),redirect:t("span",{className:"adyen-checkout__button__content"},t(a,{size:"medium",inline:!0}),u.get("payButton.redirecting")),default:t("span",{className:"adyen-checkout__button__content"},_,t("span",{className:"adyen-checkout__button__text"},c))},f=y[d]||y.default;return i?t("a",{className:b,href:i,disabled:s,target:this.props.target,rel:this.props.rel},f):t("button",{className:b,type:"button",disabled:s,onClick:this.onClick,onKeyDown:this.onKeyDown},f,"loading"!==d&&"redirect"!==d&&this.props.children)}}export{s as default};
2
2
  //# sourceMappingURL=Button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sources":["../../../../../src/components/internal/Button/Button.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport classNames from 'classnames';\nimport Spinner from '../Spinner';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport './Button.scss';\nimport { ButtonProps, ButtonState } from './types';\n\nclass Button extends Component<ButtonProps, ButtonState> {\n public static defaultProps = {\n status: 'default',\n variant: 'primary',\n disabled: false,\n label: '',\n inline: false,\n target: '_self',\n onClick: () => {}\n };\n\n public onClick = e => {\n e.preventDefault();\n\n if (!this.props.disabled) {\n this.props.onClick(e, { complete: this.complete });\n }\n };\n\n public complete = (delay = 1000) => {\n this.setState({ completed: true });\n setTimeout(() => {\n this.setState({ completed: false });\n }, delay);\n };\n\n render({ classNameModifiers = [], disabled, href, icon, inline, label, status, variant }, { completed }) {\n const { i18n } = useCoreContext();\n\n const buttonIcon = icon ? <img className=\"adyen-checkout__button__icon\" src={icon} alt=\"\" aria-hidden=\"true\" /> : '';\n\n const modifiers = [\n ...classNameModifiers,\n ...(variant !== 'primary' ? [variant] : []),\n ...(inline ? ['inline'] : []),\n ...(completed ? ['completed'] : []),\n ...(status === 'loading' || status === 'redirect' ? ['loading'] : [])\n ];\n\n const buttonClasses = classNames(['adyen-checkout__button', ...modifiers.map(m => `adyen-checkout__button--${m}`)]);\n\n const buttonStates = {\n loading: (\n <span className=\"adyen-checkout__button__content\">\n <Spinner size=\"medium\" inline />\n <span className={'adyen-checkout__button__text--sr-only'}>{i18n.get('loading')}</span>\n </span>\n ),\n redirect: (\n <span className=\"adyen-checkout__button__content\">\n <Spinner size=\"medium\" inline />\n {i18n.get('payButton.redirecting')}\n </span>\n ),\n default: (\n <span className=\"adyen-checkout__button__content\">\n {buttonIcon}\n <span className=\"adyen-checkout__button__text\">{label}</span>\n </span>\n )\n };\n\n const buttonText = buttonStates[status] || buttonStates.default;\n\n if (href) {\n return (\n <a className={buttonClasses} href={href} disabled={disabled} target={this.props.target} rel={this.props.rel}>\n {buttonText}\n </a>\n );\n }\n\n return (\n <button className={buttonClasses} type=\"button\" disabled={disabled} onClick={this.onClick}>\n {buttonText}\n {status !== 'loading' && status !== 'redirect' && this.props.children}\n </button>\n );\n }\n}\n\nexport default Button;\n"],"names":["Button","Component","static","status","variant","disabled","label","inline","target","onClick","e","preventDefault","this","props","complete","delay","setState","completed","setTimeout","render","classNameModifiers","href","icon","i18n","useCoreContext","buttonIcon","h","img","className","src","alt","aria-hidden","modifiers","buttonClasses","classNames","map","m","buttonStates","loading","span","Spinner","size","get","redirect","default","buttonText","a","rel","button","type","children"],"mappings":"wPAOA,MAAMA,UAAeC,EACjBC,oBAA6B,CACzBC,OAAQ,UACRC,QAAS,UACTC,UAAU,EACVC,MAAO,GACPC,QAAQ,EACRC,OAAQ,QACRC,QAAS,QAGNA,QAAUC,IACbA,EAAEC,iBAEGC,KAAKC,MAAMR,UACZO,KAAKC,MAAMJ,QAAQC,EAAG,CAAEI,SAAUF,KAAKE,UAC3C,EAGGA,SAAW,CAACC,EAAQ,OACvBH,KAAKI,SAAS,CAAEC,WAAW,IAC3BC,YAAW,KACPN,KAAKI,SAAS,CAAEC,WAAW,GAAM,GAClCF,EAAAA,EAGPI,MAAAA,EAAOC,mBAAEA,EAAqB,GAAEf,SAAEA,EAAQgB,KAAEA,EAAIC,KAAEA,EAAIf,OAAEA,EAAMD,MAAEA,EAAKH,OAAEA,EAAMC,QAAEA,IAAWa,UAAEA,IACxF,MAAMM,KAAEA,GAASC,IAEXC,EAAaH,EAAOI,EAACC,MAAAA,CAAIC,UAAU,+BAA+BC,IAAKP,EAAMQ,IAAI,GAAGC,cAAY,SAAY,GAE5GC,EAAY,IACXZ,KACa,YAAZhB,EAAwB,CAACA,GAAW,MACpCG,EAAS,CAAC,UAAY,MACtBU,EAAY,CAAC,aAAe,MACjB,YAAXd,GAAmC,aAAXA,EAAwB,CAAC,WAAa,IAGhE8B,EAAgBC,EAAW,CAAC,4BAA6BF,EAAUG,KAAIC,GAAK,2BAA2BA,QAEvGC,EAAe,CACjBC,QACIZ,EAACa,OAAAA,CAAKX,UAAU,mCACZF,EAACc,EAAAA,CAAQC,KAAK,SAASlC,QAAAA,IACvBmB,EAACa,OAAAA,CAAKX,UAAW,yCAA0CL,EAAKmB,IAAI,aAG5EC,SACIjB,EAACa,OAAAA,CAAKX,UAAU,mCACZF,EAACc,EAAAA,CAAQC,KAAK,SAASlC,QAAAA,IACtBgB,EAAKmB,IAAI,0BAGlBE,QACIlB,EAACa,OAAAA,CAAKX,UAAU,mCACXH,EACDC,EAACa,OAAAA,CAAKX,UAAU,gCAAgCtB,KAKtDuC,EAAaR,EAAalC,IAAWkC,EAAaO,QAExD,OAAIvB,EAEIK,EAACoB,IAAAA,CAAElB,UAAWK,EAAeZ,KAAMA,EAAMhB,SAAUA,EAAUG,OAAQI,KAAKC,MAAML,OAAQuC,IAAKnC,KAAKC,MAAMkC,KACnGF,GAMTnB,EAACsB,SAAAA,CAAOpB,UAAWK,EAAegB,KAAK,SAAS5C,SAAUA,EAAUI,QAASG,KAAKH,SAC7EoC,EACW,YAAX1C,GAAmC,aAAXA,GAAyBS,KAAKC,MAAMqC,SAGzE"}
1
+ {"version":3,"file":"Button.js","sources":["../../../../../src/components/internal/Button/Button.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport classNames from 'classnames';\nimport Spinner from '../Spinner';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport './Button.scss';\nimport { ButtonProps, ButtonState } from './types';\n\nclass Button extends Component<ButtonProps, ButtonState> {\n public static defaultProps = {\n status: 'default',\n variant: 'primary',\n disabled: false,\n label: '',\n inline: false,\n target: '_self',\n onClick: () => {}\n };\n\n public onClick = e => {\n e.preventDefault();\n\n if (!this.props.disabled) {\n this.props.onClick(e, { complete: this.complete });\n }\n };\n\n public complete = (delay = 1000) => {\n this.setState({ completed: true });\n setTimeout(() => {\n this.setState({ completed: false });\n }, delay);\n };\n\n public onKeyDown = (event: KeyboardEvent) => {\n this.props.onKeyDown?.(event);\n };\n\n render({ classNameModifiers = [], disabled, href, icon, inline, label, status, variant }, { completed }) {\n const { i18n } = useCoreContext();\n\n const buttonIcon = icon ? <img className=\"adyen-checkout__button__icon\" src={icon} alt=\"\" aria-hidden=\"true\" /> : '';\n\n const modifiers = [\n ...classNameModifiers,\n ...(variant !== 'primary' ? [variant] : []),\n ...(inline ? ['inline'] : []),\n ...(completed ? ['completed'] : []),\n ...(status === 'loading' || status === 'redirect' ? ['loading'] : [])\n ];\n\n const buttonClasses = classNames(['adyen-checkout__button', ...modifiers.map(m => `adyen-checkout__button--${m}`)]);\n\n const buttonStates = {\n loading: (\n <span className=\"adyen-checkout__button__content\">\n <Spinner size=\"medium\" inline />\n <span className={'adyen-checkout__button__text--sr-only'}>{i18n.get('loading')}</span>\n </span>\n ),\n redirect: (\n <span className=\"adyen-checkout__button__content\">\n <Spinner size=\"medium\" inline />\n {i18n.get('payButton.redirecting')}\n </span>\n ),\n default: (\n <span className=\"adyen-checkout__button__content\">\n {buttonIcon}\n <span className=\"adyen-checkout__button__text\">{label}</span>\n </span>\n )\n };\n\n const buttonText = buttonStates[status] || buttonStates.default;\n\n if (href) {\n return (\n <a className={buttonClasses} href={href} disabled={disabled} target={this.props.target} rel={this.props.rel}>\n {buttonText}\n </a>\n );\n }\n\n return (\n <button className={buttonClasses} type=\"button\" disabled={disabled} onClick={this.onClick} onKeyDown={this.onKeyDown}>\n {buttonText}\n {status !== 'loading' && status !== 'redirect' && this.props.children}\n </button>\n );\n }\n}\n\nexport default Button;\n"],"names":["Button","Component","static","status","variant","disabled","label","inline","target","onClick","e","preventDefault","this","props","complete","delay","setState","completed","setTimeout","onKeyDown","event","render","classNameModifiers","href","icon","i18n","useCoreContext","buttonIcon","h","img","className","src","alt","aria-hidden","modifiers","buttonClasses","classNames","map","m","buttonStates","loading","span","Spinner","size","get","redirect","default","buttonText","a","rel","button","type","children"],"mappings":"wPAOA,MAAMA,UAAeC,EACjBC,oBAA6B,CACzBC,OAAQ,UACRC,QAAS,UACTC,UAAU,EACVC,MAAO,GACPC,QAAQ,EACRC,OAAQ,QACRC,QAAS,QAGNA,QAAUC,IACbA,EAAEC,iBAEGC,KAAKC,MAAMR,UACZO,KAAKC,MAAMJ,QAAQC,EAAG,CAAEI,SAAUF,KAAKE,UAC3C,EAGGA,SAAW,CAACC,EAAQ,OACvBH,KAAKI,SAAS,CAAEC,WAAW,IA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AAS9C,SAAUA,EAAUI,QAASG,KAAKH,QAASU,UAAWP,KAAKO,WACtG4B,EACW,YAAX5C,GAAmC,aAAXA,GAAyBS,KAAKC,MAAMuC,SAGzE"}
@@ -1,2 +1,2 @@
1
- import{createElement as o}from"../../../external/preact/dist/preact.js";import{useEffect as t}from"../../../external/preact/hooks/dist/hooks.js";import{CtpState as e}from"./services/ClickToPayService.js";import n from"./context/useClickToPayContext.js";import r from"./components/CtPOneTimePassword/CtPOneTimePassword.js";import s from"./components/CtPCards/CtPCards.js";import i from"./components/CtPSection/CtPSection.js";import a from"./components/CtPLoader/CtPLoader.js";import m from"./components/CtPLogin/CtPLogin.js";import p from"./services/sdks/SrciError.js";const c=({onDisplayCardComponent:c})=>{const{ctpState:d,onReady:l,startIdentityValidation:C,logoutShopper:f}=n();return t((()=>{[e.OneTimePassword,e.Login,e.Ready].includes(d)&&l()}),[d,l]),t((()=>{d===e.ShopperIdentified&&async function(){try{await C()}catch(o){o instanceof p&&console.warn(`CtP - Identity Validation error: ${o.toString()}`),await f()}}()}),[d]),d===e.NotAvailable?null:o(i,null,[e.Loading,e.ShopperIdentified].includes(d)&&o(a,null),d===e.OneTimePassword&&o(r,{onDisplayCardComponent:c}),d===e.Ready&&o(s,{onDisplayCardComponent:c}),d===e.Login&&o(m,null))};export{c as default};
1
+ import{createElement as o}from"../../../external/preact/dist/preact.js";import{useEffect as t,useCallback as e}from"../../../external/preact/hooks/dist/hooks.js";import{CtpState as n}from"./services/ClickToPayService.js";import r from"./context/useClickToPayContext.js";import s from"./components/CtPOneTimePassword/CtPOneTimePassword.js";import a from"./components/CtPCards/CtPCards.js";import i from"./components/CtPSection/CtPSection.js";import p from"./components/CtPLoader/CtPLoader.js";import m from"./components/CtPLogin/CtPLogin.js";import c from"./services/sdks/SrciError.js";const d=({onDisplayCardComponent:d})=>{const{ctpState:l,onReady:C,startIdentityValidation:P,logoutShopper:f}=r();t((()=>{[n.OneTimePassword,n.Login,n.Ready].includes(l)&&C()}),[l,C]),t((()=>{l===n.ShopperIdentified&&async function(){try{await P()}catch(o){o instanceof c&&console.warn(`CtP - Identity Validation error: ${o.toString()}`),await f()}}()}),[l]);const y=e((o=>{"Enter"===o.key&&(o.preventDefault(),o.stopPropagation())}),[]);return l===n.NotAvailable?null:o(i,{onEnterKeyPress:y},[n.Loading,n.ShopperIdentified].includes(l)&&o(p,null),l===n.OneTimePassword&&o(s,{onDisplayCardComponent:d}),l===n.Ready&&o(a,{onDisplayCardComponent:d}),l===n.Login&&o(m,null))};export{d as default};
2
2
  //# sourceMappingURL=ClickToPayComponent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClickToPayComponent.js","sources":["../../../../../src/components/internal/ClickToPay/ClickToPayComponent.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect } from 'preact/hooks';\nimport { CtpState } from './services/ClickToPayService';\nimport useClickToPayContext from './context/useClickToPayContext';\nimport CtPOneTimePassword from './components/CtPOneTimePassword';\nimport CtPCards from './components/CtPCards';\nimport CtPSection from './components/CtPSection';\nimport CtPLoader from './components/CtPLoader';\nimport CtPLogin from './components/CtPLogin';\nimport SrciError from './services/sdks/SrciError';\n\ntype ClickToPayComponentProps = {\n onDisplayCardComponent?(): void;\n};\n\nconst ClickToPayComponent = ({ onDisplayCardComponent }: ClickToPayComponentProps): h.JSX.Element => {\n const { ctpState, onReady, startIdentityValidation, logoutShopper } = useClickToPayContext();\n\n useEffect(() => {\n if ([CtpState.OneTimePassword, CtpState.Login, CtpState.Ready].includes(ctpState)) {\n onReady();\n }\n }, [ctpState, onReady]);\n\n useEffect(() => {\n async function sendOneTimePassword() {\n try {\n await startIdentityValidation();\n } catch (error) {\n if (error instanceof SrciError) console.warn(`CtP - Identity Validation error: ${error.toString()}`);\n await logoutShopper();\n }\n }\n if (ctpState === CtpState.ShopperIdentified) {\n void sendOneTimePassword();\n }\n }, [ctpState]);\n\n if (ctpState === CtpState.NotAvailable) {\n return null;\n }\n\n return (\n <CtPSection>\n {[CtpState.Loading, CtpState.ShopperIdentified].includes(ctpState) && <CtPLoader />}\n {ctpState === CtpState.OneTimePassword && <CtPOneTimePassword onDisplayCardComponent={onDisplayCardComponent} />}\n {ctpState === CtpState.Ready && <CtPCards onDisplayCardComponent={onDisplayCardComponent} />}\n {ctpState === CtpState.Login && <CtPLogin />}\n </CtPSection>\n );\n};\n\nexport default ClickToPayComponent;\n"],"names":["ClickToPayComponent","onDisplayCardComponent","ctpState","onReady","startIdentityValidation","logoutShopper","useClickToPayContext","useEffect","CtpState","OneTimePassword","Login","Ready","includes","ShopperIdentified","async","error","SrciError","console","warn","toString","sendOneTimePassword","NotAvailable","h","CtPSection","Loading","CtPLoader","CtPOneTimePassword","CtPCards","CtPLogin"],"mappings":"wjBAeA,MAAMA,EAAsB,EAAGC,6BAC3B,MAAMC,SAAEA,EAAQC,QAAEA,EAAOC,wBAAEA,EAAuBC,cAAEA,GAAkBC,IAsBtE,OApBAC,GAAU,KACF,CAACC,EAASC,gBAAiBD,EAASE,MAAOF,EAASG,OAAOC,SAASV,IACpEC,GACJ,GACD,CAACD,EAAUC,IAEdI,GAAU,KASFL,IAAaM,EAASK,mBAR1BC,iBACI,UACUV,GACV,CAAE,MAAOW,GACDA,aAAiBC,GAAWC,QAAQC,KAAK,oCAAoCH,EAAMI,oBACjFd,GACV,CACJ,CAESe,EACT,GACD,CAAClB,IAEAA,IAAaM,EAASa,aACf,KAIPC,EAACC,EACI,KAAA,CAACf,EAASgB,QAAShB,EAASK,mBAAmBD,SAASV,IAAaoB,EAACG,QACtEvB,IAAaM,EAASC,iBAAmBa,EAACI,EAAAA,CAAmBzB,uBAAwBA,IACrFC,IAAaM,EAASG,OAASW,EAACK,EAAAA,CAAS1B,uBAAwBA,IACjEC,IAAaM,EAASE,OAASY,EAACM,EAAAA,MAAAA"}
1
+ {"version":3,"file":"ClickToPayComponent.js","sources":["../../../../../src/components/internal/ClickToPay/ClickToPayComponent.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback, useEffect } from 'preact/hooks';\nimport { CtpState } from './services/ClickToPayService';\nimport useClickToPayContext from './context/useClickToPayContext';\nimport CtPOneTimePassword from './components/CtPOneTimePassword';\nimport CtPCards from './components/CtPCards';\nimport CtPSection from './components/CtPSection';\nimport CtPLoader from './components/CtPLoader';\nimport CtPLogin from './components/CtPLogin';\nimport SrciError from './services/sdks/SrciError';\n\ntype ClickToPayComponentProps = {\n onDisplayCardComponent?(): void;\n};\n\nconst ClickToPayComponent = ({ onDisplayCardComponent }: ClickToPayComponentProps): h.JSX.Element => {\n const { ctpState, onReady, startIdentityValidation, logoutShopper } = useClickToPayContext();\n\n useEffect(() => {\n if ([CtpState.OneTimePassword, CtpState.Login, CtpState.Ready].includes(ctpState)) {\n onReady();\n }\n }, [ctpState, onReady]);\n\n useEffect(() => {\n async function sendOneTimePassword() {\n try {\n await startIdentityValidation();\n } catch (error) {\n if (error instanceof SrciError) console.warn(`CtP - Identity Validation error: ${error.toString()}`);\n await logoutShopper();\n }\n }\n if (ctpState === CtpState.ShopperIdentified) {\n void sendOneTimePassword();\n }\n }, [ctpState]);\n\n /**\n * We capture the ENTER keypress within the ClickToPay component because we do not want to propagate the event up to the UIElement\n * UIElement would perform the payment flow (by calling .submit), which is not relevant/supported by Click to Pay\n */\n const handleEnterKeyPress = useCallback((event: h.JSX.TargetedKeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n event.preventDefault(); // Prevent <form> submission if Component is placed inside a form\n event.stopPropagation(); // Prevent global BaseElement keypress event to be triggered\n }\n }, []);\n\n if (ctpState === CtpState.NotAvailable) {\n return null;\n }\n\n return (\n <CtPSection onEnterKeyPress={handleEnterKeyPress}>\n {[CtpState.Loading, CtpState.ShopperIdentified].includes(ctpState) && <CtPLoader />}\n {ctpState === CtpState.OneTimePassword && <CtPOneTimePassword onDisplayCardComponent={onDisplayCardComponent} />}\n {ctpState === CtpState.Ready && <CtPCards onDisplayCardComponent={onDisplayCardComponent} />}\n {ctpState === CtpState.Login && <CtPLogin />}\n </CtPSection>\n );\n};\n\nexport default ClickToPayComponent;\n"],"names":["ClickToPayComponent","onDisplayCardComponent","ctpState","onReady","startIdentityValidation","logoutShopper","useClickToPayContext","useEffect","CtpState","OneTimePassword","Login","Ready","includes","ShopperIdentified","async","error","SrciError","console","warn","toString","sendOneTimePassword","handleEnterKeyPress","useCallback","event","key","preventDefault","stopPropagation","NotAvailable","h","CtPSection","onEnterKeyPress","Loading","CtPLoader","CtPOneTimePassword","CtPCards","CtPLogin"],"mappings":"ykBAeA,MAAMA,EAAsB,EAAGC,6BAC3B,MAAMC,SAAEA,EAAQC,QAAEA,EAAOC,wBAAEA,EAAuBC,cAAEA,GAAkBC,IAEtEC,GAAU,KACF,CAACC,EAASC,gBAAiBD,EAASE,MAAOF,EAASG,OAAOC,SAASV,IACpEC,GACJ,GACD,CAACD,EAAUC,IAEdI,GAAU,KASFL,IAAaM,EAASK,mBAR1BC,iBACI,UACUV,GACV,CAAE,MAAOW,GACDA,aAAiBC,GAAWC,QAAQC,KAAK,oCAAoCH,EAAMI,oBACjFd,GACV,CACJ,CAESe,EACT,GACD,CAAClB,IAMJ,MAAMmB,EAAsBC,GAAaC,IACnB,UAAdA,EAAMC,MACND,EAAME,iBACNF,EAAMG,kBACV,GACD,IAEH,OAAIxB,IAAaM,EAASmB,aACf,KAIPC,EAACC,EAAAA,CAAWC,gBAAiBT,GACxB,CAACb,EAASuB,QAASvB,EAASK,mBAAmBD,SAASV,IAAa0B,EAACI,QACtE9B,IAAaM,EAASC,iBAAmBmB,EAACK,EAAAA,CAAmBhC,uBAAwBA,IACrFC,IAAaM,EAASG,OAASiB,EAACM,EAAAA,CAASjC,uBAAwBA,IACjEC,IAAaM,EAASE,OAASkB,EAACO,EAAAA,MAAAA"}
@@ -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";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};
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 n from"../../context/useClickToPayContext.js";import a 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 k(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 P(t,e,r){return r?C()?null:t.get("payButton.with",{values:{value:c(t,e),maskedData:`•••• ${r?.panLastFour}`}}):t.get("payButton")}const j=({onDisplayCardComponent:c})=>{const{i18n:C}=g(),j=f(),{amount:E,cards:S,checkout:x,isCtpPrimaryPaymentMethod:b,status:v,onSubmit:R,onSetStatus:$,onError:w}=n(),[B,M]=r(S.find((t=>!t.isExpired))||S[0]),[N,D]=r(null),F=S.every((t=>t.isExpired)),[I,T]=r(!1);o((()=>{(0===S.length||F)&&c?.()}),[c,F,S]);const _=s((async()=>{if(B)try{T(!0),D(null),$("loading");const t=await x(B);R(t)}catch(t){t instanceof m&&(D(t?.reason),console.warn(`CtP - Checkout: Reason: ${t?.reason} / Source: ${t?.source} / Scheme: ${t?.scheme}`)),T(!1),w(t instanceof h?t:new h("ERROR","Error during ClickToPay checkout",{cause:t}))}}),[x,B]),L=s((t=>{M(t)}),[]),O=I&&"loading"===v&&B?.isDcfPopupEmbedded,K="loading"!==v||!O,A=s((t=>{"Enter"===t.key&&_()}),[_]);return t(e,null,t(p,{name:d,height:"380",width:"100%",classNameModifiers:[O?"":"hidden"]}),K&&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(a,{card:S[0],errorMessage:k(N,C)}),S.length>1&&t(l,{cardSelected:B,cards:S,onChangeCard:L,errorMessage:k(N,C)}),t(i,{disabled:F,amount:E,label:P(C,E,B),status:v,variant:b?"primary":"secondary",icon:0!==S.length&&j({imageFolder:"components/"})(b?`${y}lock`:`${y}lock_black`),onClick:_,onKeyDown:A})))};export{j 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';\nimport AdyenCheckoutError from '../../../../../core/Errors/AdyenCheckoutError';\nimport { PREFIX } from '../../../Icon/constants';\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":"46BAyBA,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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AcC,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
+ {"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\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 const handlePayButtonKeyDown = useCallback(\n (event: KeyboardEvent) => {\n if (event.key === 'Enter') {\n void doCheckout();\n }\n },\n [doCheckout]\n );\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 {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 onKeyDown={handlePayButtonKeyDown}\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","handlePayButtonKeyDown","event","key","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","onKeyDown"],"mappings":"46BAyBA,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,MAA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a,eAAxBjE,CAAyCI,EAA4B,GAAG8D,QAAe,GAAGA,eAE9FC,QAAS7C,EACT8C,UAAW7B"}
@@ -1,2 +1,2 @@
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};
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 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:y}=s(),[P,h]=r(null),[j,I]=r(!1),[E,S]=r(null),[k,x]=r(!1),[v,w]=r(null),T=e((t=>{w(t)}),[]),b=e((({data:t,isValid:o})=>{h(t.shopperLogin),I(o),t?.shopperLogin?.length>0&&g(!0)}),[]),L=e((async()=>{if(S(null),j){x(!0);try{const{isEnrolled:t}=await C({shopperEmail:P});t?await y():(S("NOT_FOUND"),x(!1))}catch(t){t instanceof m&&console.warn(`CtP - Login error: ${t.toString()}`),t instanceof c&&console.warn(t.toString()),u(t)?S(t?.reason):console.error(t),x(!1)}}else v.validateInput()}),[C,y,P,j,v]),M=e((t=>{"Enter"===t.key&&L()}),[L]);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:k,errorMessage:E&&d.get(`ctp.errors.${E}`),onPressEnter:L}),t(n,{label:d.get("continue"),variant:f?"primary":"secondary",status:k&&"loading",onClick:()=>{L()},onKeyDown:M}))};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';\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
+ {"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 const handleButtonKeyDown = useCallback(\n (event: KeyboardEvent) => {\n if (event.key === 'Enter') {\n void handleOnLoginButtonClick();\n }\n },\n [handleOnLoginButtonClick]\n );\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 onKeyDown={handleButtonKeyDown}\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","handleButtonKeyDown","event","key","h","Fragment","CtPSection","Title","endAdornment","CtPInfo","get","Text","CtPLoginInput","onChange","onSetInputHandlers","disabled","errorMessage","onPressEnter","Button","label","variant","status","onClick","onKeyDown"],"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,I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@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../external/preact/dist/preact.js";import{useRef as r,useState as o,useCallback as s,useEffect as t}from"../../../../../external/preact/hooks/dist/hooks.js";import{loginValidationRules as n}from"./validate.js";import{useCoreContext as a}from"../../../../../core/Context/CoreProvider.js";import i from"../../../../../utils/useForm/useForm.js";import p from"../../../FormFields/Field/Field.js";import l from"../../../FormFields/InputEmail.js";const u=u=>{const{i18n:d}=a(),{handleChangeFor:m,data:c,triggerValidation:g,valid:h,errors:f,isValid:L}=i({schema:["shopperLogin"],rules:n}),F=r({validateInput:null}),[v,j]=o(!1),E=s((()=>{j(!0),g()}),[g]);t((()=>{c.shopperLogin&&j(!0)}),[c.shopperLogin]),t((()=>{F.current.validateInput=E,u.onSetInputHandlers(F.current)}),[E,u.onSetInputHandlers]);const b=s((e=>{"Enter"===e.key&&u.onPressEnter()}),[u.onPressEnter]),k=s((e=>{"Enter"===e.key&&e.preventDefault()}),[]);return t((()=>{u.onChange({data:c,valid:h,errors:f,isValid:L})}),[c,h,f]),e(p,{name:"shopperLogin",label:d.get("ctp.login.inputLabel"),errorMessage:v?u.errorMessage||!!f.shopperLogin:null,classNameModifiers:["shopperLogin"]},e(l,{name:"shopperLogin",autocorrect:"off",spellcheck:!1,value:c.shopperLogin,disabled:u.disabled,onInput:m("shopperLogin","input"),onBlur:m("shopperLogin","blur"),onKeyPress:k,onKeyUp:b}))};export{u as default};
1
+ import{createElement as e}from"../../../../../external/preact/dist/preact.js";import{useRef as r,useState as o,useCallback as s,useEffect as t}from"../../../../../external/preact/hooks/dist/hooks.js";import{loginValidationRules as a}from"./validate.js";import{useCoreContext as n}from"../../../../../core/Context/CoreProvider.js";import i from"../../../../../utils/useForm/useForm.js";import p from"../../../FormFields/Field/Field.js";import l from"../../../FormFields/InputEmail.js";const d=d=>{const{i18n:u}=n(),{handleChangeFor:m,data:c,triggerValidation:g,valid:h,errors:f,isValid:L}=i({schema:["shopperLogin"],rules:a}),F=r({validateInput:null}),[j,v]=o(!1),b=s((()=>{v(!0),g()}),[g]);t((()=>{c.shopperLogin&&v(!0)}),[c.shopperLogin]),t((()=>{F.current.validateInput=b,d.onSetInputHandlers(F.current)}),[b,d.onSetInputHandlers]);const E=s((e=>{"Enter"===e.key&&d.onPressEnter()}),[d.onPressEnter]);return t((()=>{d.onChange({data:c,valid:h,errors:f,isValid:L})}),[c,h,f]),e(p,{name:"shopperLogin",label:u.get("ctp.login.inputLabel"),errorMessage:j?d.errorMessage||!!f.shopperLogin:null,classNameModifiers:["shopperLogin"]},e(l,{name:"shopperLogin",autocorrect:"off",spellcheck:!1,value:c.shopperLogin,disabled:d.disabled,onInput:m("shopperLogin","input"),onBlur:m("shopperLogin","blur"),onKeyPress:E}))};export{d as default};
2
2
  //# sourceMappingURL=CtPLoginInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CtPLoginInput.js","sources":["../../../../../../../src/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport { loginValidationRules } from './validate';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport useForm from '../../../../../utils/useForm';\nimport Field from '../../../FormFields/Field';\nimport InputEmail from '../../../FormFields/InputEmail';\n\ntype OnChangeProps = { data: CtPLoginInputDataState; valid; errors; isValid: boolean };\n\ninterface CtPLoginInputProps {\n disabled: boolean;\n errorMessage?: string;\n onPressEnter(): Promise<void>;\n onChange({ data, valid, errors, isValid }: OnChangeProps): void;\n onSetInputHandlers(handlers: CtPLoginInputHandlers): void;\n}\n\ninterface CtPLoginInputDataState {\n shopperLogin?: string;\n}\n\nexport type CtPLoginInputHandlers = {\n validateInput(): void;\n};\n\nconst CtPLoginInput = (props: CtPLoginInputProps): h.JSX.Element => {\n const { i18n } = useCoreContext();\n const formSchema = ['shopperLogin'];\n const { handleChangeFor, data, triggerValidation, valid, errors, isValid } = useForm<CtPLoginInputDataState>({\n schema: formSchema,\n rules: loginValidationRules\n });\n const loginInputHandlersRef = useRef<CtPLoginInputHandlers>({ validateInput: null });\n const [isLoginInputDirty, setIsLoginInputDirty] = useState<boolean>(false);\n\n const validateInput = useCallback(() => {\n setIsLoginInputDirty(true);\n triggerValidation();\n }, [triggerValidation]);\n\n useEffect(() => {\n if (data.shopperLogin) setIsLoginInputDirty(true);\n }, [data.shopperLogin]);\n\n useEffect(() => {\n loginInputHandlersRef.current.validateInput = validateInput;\n props.onSetInputHandlers(loginInputHandlersRef.current);\n }, [validateInput, props.onSetInputHandlers]);\n\n const handleOnKeyUp = useCallback(\n (event: h.JSX.TargetedKeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n void props.onPressEnter();\n }\n },\n [props.onPressEnter]\n );\n\n const handleOnKeyPress = useCallback((event: h.JSX.TargetedKeyboardEvent<HTMLInputElement>) => {\n // Prevent <form> submission if Component is placed inside an form\n if (event.key === 'Enter') event.preventDefault();\n }, []);\n\n useEffect(() => {\n props.onChange({ data, valid, errors, isValid });\n }, [data, valid, errors]);\n\n return (\n <Field\n name=\"shopperLogin\"\n label={i18n.get('ctp.login.inputLabel')}\n errorMessage={isLoginInputDirty ? props.errorMessage || !!errors.shopperLogin : null}\n classNameModifiers={['shopperLogin']}\n >\n <InputEmail\n name={'shopperLogin'}\n autocorrect={'off'}\n spellcheck={false}\n value={data.shopperLogin}\n disabled={props.disabled}\n onInput={handleChangeFor('shopperLogin', 'input')}\n onBlur={handleChangeFor('shopperLogin', 'blur')}\n onKeyPress={handleOnKeyPress}\n onKeyUp={handleOnKeyUp}\n />\n </Field>\n );\n};\n\nexport default CtPLoginInput;\n"],"names":["CtPLoginInput","props","i18n","useCoreContext","handleChangeFor","data","triggerValidation","valid","errors","isValid","useForm","schema","rules","loginValidationRules","loginInputHandlersRef","useRef","validateInput","isLoginInputDirty","setIsLoginInputDirty","useState","useCallback","useEffect","shopperLogin","current","onSetInputHandlers","handleOnKeyUp","event","key","onPressEnter","handleOnKeyPress","preventDefault","onChange","h","Field","name","label","get","errorMessage","classNameModifiers","InputEmail","autocorrect","spellcheck","value","disabled","onInput","onBlur","onKeyPress","onKeyUp"],"mappings":"oeA0BA,MAAMA,EAAiBC,IACnB,MAAMC,KAAEA,GAASC,KAEXC,gBAAEA,EAAeC,KAAEA,EAAIC,kBAAEA,EAAiBC,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,GAAYC,EAAgC,CACzGC,OAFe,CAAC,gBAGhBC,MAAOC,IAELC,EAAwBC,EAA8B,CAAEC,cAAe,QACtEC,EAAmBC,GAAwBC,GAAkB,GAE9DH,EAAgBI,GAAY,KAC9BF,GAAqB,GACrBZ,GAAAA,GACD,CAACA,IAEJe,GAAU,KACFhB,EAAKiB,cAAcJ,GAAqB,EAAA,GAC7C,CAACb,EAAKiB,eAETD,GAAU,KACNP,EAAsBS,QAAQP,cAAgBA,EAC9Cf,EAAMuB,mBAAmBV,EAAsBS,QAAO,GACvD,CAACP,EAAef,EAAMuB,qBAEzB,MAAMC,EAAgBL,GACjBM,IACqB,UAAdA,EAAMC,KACD1B,EAAM2B,cACf,GAEJ,CAAC3B,EAAM2B,eAGLC,EAAmBT,GAAaM,IAEhB,UAAdA,EAAMC,KAAiBD,EAAMI,gBAAc,GAChD,IAMH,OAJAT,GAAU,KACNpB,EAAM8B,SAAS,CAAE1B,OAAME,QAAOC,SAAQC,WAAQ,GAC/C,CAACJ,EAAME,EAAOC,IAGbwB,EAACC,EAAAA,CACGC,KAAK,eACLC,MAAOjC,EAAKkC,IAAI,wBAChBC,aAAcpB,EAAoBhB,EAAMoC,gBAAkB7B,EAAOc,aAAe,KAChFgB,mBAAoB,CAAC,iBAErBN,EAACO,EAAAA,CACGL,KAAM,eACNM,YAAa,MACbC,YAAY,EACZC,MAAOrC,EAAKiB,aACZqB,SAAU1C,EAAM0C,SAChBC,QAASxC,EAAgB,eAAgB,SACzCyC,OAAQzC,EAAgB,eAAgB,QACxC0C,WAAYjB,EACZkB,QAAStB"}
1
+ {"version":3,"file":"CtPLoginInput.js","sources":["../../../../../../../src/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport { loginValidationRules } from './validate';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport useForm from '../../../../../utils/useForm';\nimport Field from '../../../FormFields/Field';\nimport InputEmail from '../../../FormFields/InputEmail';\n\ntype OnChangeProps = { data: CtPLoginInputDataState; valid; errors; isValid: boolean };\n\ninterface CtPLoginInputProps {\n disabled: boolean;\n errorMessage?: string;\n onPressEnter(): Promise<void>;\n onChange({ data, valid, errors, isValid }: OnChangeProps): void;\n onSetInputHandlers(handlers: CtPLoginInputHandlers): void;\n}\n\ninterface CtPLoginInputDataState {\n shopperLogin?: string;\n}\n\nexport type CtPLoginInputHandlers = {\n validateInput(): void;\n};\n\nconst CtPLoginInput = (props: CtPLoginInputProps): h.JSX.Element => {\n const { i18n } = useCoreContext();\n const formSchema = ['shopperLogin'];\n const { handleChangeFor, data, triggerValidation, valid, errors, isValid } = useForm<CtPLoginInputDataState>({\n schema: formSchema,\n rules: loginValidationRules\n });\n const loginInputHandlersRef = useRef<CtPLoginInputHandlers>({ validateInput: null });\n const [isLoginInputDirty, setIsLoginInputDirty] = useState<boolean>(false);\n\n const validateInput = useCallback(() => {\n setIsLoginInputDirty(true);\n triggerValidation();\n }, [triggerValidation]);\n\n useEffect(() => {\n if (data.shopperLogin) setIsLoginInputDirty(true);\n }, [data.shopperLogin]);\n\n useEffect(() => {\n loginInputHandlersRef.current.validateInput = validateInput;\n props.onSetInputHandlers(loginInputHandlersRef.current);\n }, [validateInput, props.onSetInputHandlers]);\n\n const handleOnKeyPress = useCallback(\n (event: h.JSX.TargetedKeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n void props.onPressEnter();\n }\n },\n [props.onPressEnter]\n );\n\n useEffect(() => {\n props.onChange({ data, valid, errors, isValid });\n }, [data, valid, errors]);\n\n return (\n <Field\n name=\"shopperLogin\"\n label={i18n.get('ctp.login.inputLabel')}\n errorMessage={isLoginInputDirty ? props.errorMessage || !!errors.shopperLogin : null}\n classNameModifiers={['shopperLogin']}\n >\n <InputEmail\n name={'shopperLogin'}\n autocorrect={'off'}\n spellcheck={false}\n value={data.shopperLogin}\n disabled={props.disabled}\n onInput={handleChangeFor('shopperLogin', 'input')}\n onBlur={handleChangeFor('shopperLogin', 'blur')}\n onKeyPress={handleOnKeyPress}\n />\n </Field>\n );\n};\n\nexport default CtPLoginInput;\n"],"names":["CtPLoginInput","props","i18n","useCoreContext","handleChangeFor","data","triggerValidation","valid","errors","isValid","useForm","schema","rules","loginValidationRules","loginInputHandlersRef","useRef","validateInput","isLoginInputDirty","setIsLoginInputDirty","useState","useCallback","useEffect","shopperLogin","current","onSetInputHandlers","handleOnKeyPress","event","key","onPressEnter","onChange","h","Field","name","label","get","errorMessage","classNameModifiers","InputEmail","autocorrect","spellcheck","value","disabled","onInput","onBlur","onKeyPress"],"mappings":"oeA0BA,MAAMA,EAAiBC,IACnB,MAAMC,KAAEA,GAASC,KAEXC,gBAAEA,EAAeC,KAAEA,EAAIC,kBAAEA,EAAiBC,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,GAAYC,EAAgC,CACzGC,OAFe,CAAC,gBAGhBC,MAAOC,IAELC,EAAwBC,EAA8B,CAAEC,cAAe,QACtEC,EAAmBC,GAAwBC,GAAkB,GAE9DH,EAAgBI,GAAY,KAC9BF,GAAqB,GACrBZ,GAAAA,GACD,CAACA,IAEJe,GAAU,KACFhB,EAAKiB,cAAcJ,GAAqB,EAAA,GAC7C,CAACb,EAAKiB,eAETD,GAAU,KACNP,EAAsBS,QAAQP,cAAgBA,EAC9Cf,EAAMuB,mBAAmBV,EAAsBS,QAAO,GACvD,CAACP,EAAef,EAAMuB,qBAEzB,MAAMC,EAAmBL,GACpBM,IACqB,UAAdA,EAAMC,KACD1B,EAAM2B,cACf,GAEJ,CAAC3B,EAAM2B,eAOX,OAJAP,GAAU,KACNpB,EAAM4B,SAAS,CAAExB,OAAME,QAAOC,SAAQC,WAAQ,GAC/C,CAACJ,EAAME,EAAOC,IAGbsB,EAACC,EAAAA,CACGC,KAAK,eACLC,MAAO/B,EAAKgC,IAAI,wBAChBC,aAAclB,EAAoBhB,EAAMkC,gBAAkB3B,EAAOc,aAAe,KAChFc,mBAAoB,CAAC,iBAErBN,EAACO,EAAAA,CACGL,KAAM,eACNM,YAAa,MACbC,YAAY,EACZC,MAAOnC,EAAKiB,aACZmB,SAAUxC,EAAMwC,SAChBC,QAAStC,EAAgB,eAAgB,SACzCuC,OAAQvC,EAAgB,eAAgB,QACxCwC,WAAYnB"}
@@ -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 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};
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,y]=o(null),[g,j]=o(!1),[x,I]=o(!1),[b,S]=o(null),[v,T]=o(null),[w,E]=o(!1),B=n((t=>{T(t)}),[]),O=n((({data:t,isValid:e})=>{y(t.otp),j(e)}),[]),A=n((()=>{S(null)}),[]),M=n((async()=>{if(S(null),g){I(!0);try{await C(k)}catch(t){if(!m(t))return void I(!1);S(t?.reason),I(!1),"ACCT_INACCESSIBLE"===t?.reason&&(E(!0),c?.())}}else v.validateInput()}),[k,g,v,c]),N=n((t=>{"Enter"===t.key&&M()}),[M]),V=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,V[0]," ",P," ",V[1],t("span",{className:"adyen-checkout-ctp__otp-subtitle--highlighted"},f),V[2]),t(a,{hideResendOtpButton:w,onChange:O,onSetInputHandlers:B,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",onKeyDown:N}))};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';\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
+ {"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 handleButtonKeyDown = useCallback(\n (event: KeyboardEvent) => {\n if (event.key === 'Enter') {\n void onSubmitPassword();\n }\n },\n [onSubmitPassword]\n );\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 onKeyDown={handleButtonKeyDown}\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","handleButtonKeyDown","event","key","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","onKeyDown"],"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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
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../../external/preact/dist/preact.js";import{useState as t,useRef as r,useCallback as o,useEffect as s}from"../../../../../../external/preact/hooks/dist/hooks.js";import{otpValidationRules as n}from"./validate.js";import a from"./CtPResendOtpLink.js";import l from"../../../context/useClickToPayContext.js";import{useCoreContext as i}from"../../../../../../core/Context/CoreProvider.js";import d from"../../../../../../utils/useForm/useForm.js";import u from"../../../../FormFields/Field/Field.js";import p from"../../../../FormFields/InputText.js";const c=c=>{const{i18n:m}=i(),{configuration:{disableOtpAutoFocus:f}}=l(),[C,g]=t(null),{handleChangeFor:F,data:b,triggerValidation:j,valid:h,errors:k,isValid:v,setData:E}=d({schema:["otp"],rules:n}),x=r({validateInput:null}),P=r(null),[R,I]=t(!1),y=o((()=>{I(!0),j()}),[j]);s((()=>{b.otp&&I(!0)}),[b.otp]),s((()=>{!f&&P.current&&P.current.focus()}),[P.current,f]),s((()=>{x.current.validateInput=y,c.onSetInputHandlers(x.current)}),[y,c.onSetInputHandlers]);const O=o((()=>{E("otp",""),g(null),f||P.current.focus(),c.onResendCode()}),[c.onResendCode,P.current,f]),V=o((e=>{const t=m.get(`ctp.errors.${e}`);t&&g(t)}),[m]),M=o((e=>{"Enter"===e.key&&c.onPressEnter()}),[c.onPressEnter]),S=o((e=>{"Enter"===e.key&&e.preventDefault()}),[]);return s((()=>{c.onChange({data:b,valid:h,errors:k,isValid:v})}),[b,h,k]),e(u,{name:"oneTimePassword",label:m.get("ctp.otp.fieldLabel"),labelEndAdornment:!c.hideResendOtpButton&&e(a,{disabled:c.isValidatingOtp,onError:V,onResendCode:O}),errorMessage:R?C||c.errorMessage||!!k.otp:null,classNameModifiers:["otp"]},e(p,{name:"otp",autocorrect:"off",spellcheck:!1,value:b.otp,disabled:c.disabled,onInput:F("otp","input"),onBlur:F("otp","blur"),onKeyUp:M,onKeyPress:S,setRef:e=>{P.current=e}}))};export{c as default};
1
+ import{createElement as e}from"../../../../../../external/preact/dist/preact.js";import{useState as t,useRef as r,useCallback as o,useEffect as s}from"../../../../../../external/preact/hooks/dist/hooks.js";import{otpValidationRules as n}from"./validate.js";import a from"./CtPResendOtpLink.js";import l from"../../../context/useClickToPayContext.js";import{useCoreContext as i}from"../../../../../../core/Context/CoreProvider.js";import d from"../../../../../../utils/useForm/useForm.js";import u from"../../../../FormFields/Field/Field.js";import p from"../../../../FormFields/InputText.js";const c=c=>{const{i18n:m}=i(),{configuration:{disableOtpAutoFocus:f}}=l(),[C,g]=t(null),{handleChangeFor:F,data:b,triggerValidation:j,valid:h,errors:k,isValid:v,setData:x}=d({schema:["otp"],rules:n}),E=r({validateInput:null}),P=r(null),[R,I]=t(!1),O=o((()=>{I(!0),j()}),[j]);s((()=>{b.otp&&I(!0)}),[b.otp]),s((()=>{!f&&P.current&&P.current.focus()}),[P.current,f]),s((()=>{E.current.validateInput=O,c.onSetInputHandlers(E.current)}),[O,c.onSetInputHandlers]);const V=o((()=>{x("otp",""),g(null),f||P.current.focus(),c.onResendCode()}),[c.onResendCode,P.current,f]),y=o((e=>{const t=m.get(`ctp.errors.${e}`);t&&g(t)}),[m]),M=o((e=>{"Enter"===e.key&&c.onPressEnter()}),[c.onPressEnter]);return s((()=>{c.onChange({data:b,valid:h,errors:k,isValid:v})}),[b,h,k]),e(u,{name:"oneTimePassword",label:m.get("ctp.otp.fieldLabel"),labelEndAdornment:!c.hideResendOtpButton&&e(a,{disabled:c.isValidatingOtp,onError:y,onResendCode:V}),errorMessage:R?C||c.errorMessage||!!k.otp:null,classNameModifiers:["otp"]},e(p,{name:"otp",autocorrect:"off",spellcheck:!1,value:b.otp,disabled:c.disabled,onInput:F("otp","input"),onBlur:F("otp","blur"),onKeyPress:M,setRef:e=>{P.current=e}}))};export{c as default};
2
2
  //# sourceMappingURL=CtPOneTimePasswordInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CtPOneTimePasswordInput.js","sources":["../../../../../../../../src/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport { otpValidationRules } from './validate';\nimport CtPResendOtpLink from './CtPResendOtpLink';\nimport useClickToPayContext from '../../../context/useClickToPayContext';\nimport { useCoreContext } from '../../../../../../core/Context/CoreProvider';\nimport useForm from '../../../../../../utils/useForm';\nimport Field from '../../../../FormFields/Field';\nimport './CtPOneTimePasswordInput.scss';\nimport InputText from '../../../../FormFields/InputText';\n\ntype OnChangeProps = { data: CtPOneTimePasswordInputDataState; valid; errors; isValid: boolean };\n\ninterface CtPOneTimePasswordInputProps {\n hideResendOtpButton: boolean;\n disabled: boolean;\n isValidatingOtp: boolean;\n errorMessage?: string;\n onSetInputHandlers(handlers: CtPOneTimePasswordInputHandlers): void;\n onPressEnter(): Promise<void>;\n onChange({ data, valid, errors, isValid }: OnChangeProps): void;\n onResendCode(): void;\n}\n\ninterface CtPOneTimePasswordInputDataState {\n otp?: string;\n}\n\nexport type CtPOneTimePasswordInputHandlers = {\n validateInput(): void;\n};\n\nconst CtPOneTimePasswordInput = (props: CtPOneTimePasswordInputProps): h.JSX.Element => {\n const { i18n } = useCoreContext();\n const {\n configuration: { disableOtpAutoFocus }\n } = useClickToPayContext();\n\n const formSchema = ['otp'];\n const [resendOtpError, setResendOtpError] = useState<string>(null);\n const { handleChangeFor, data, triggerValidation, valid, errors, isValid, setData } = useForm<CtPOneTimePasswordInputDataState>({\n schema: formSchema,\n rules: otpValidationRules\n });\n const otpInputHandlersRef = useRef<CtPOneTimePasswordInputHandlers>({ validateInput: null });\n const inputRef = useRef<HTMLInputElement>(null);\n const [isOtpFielDirty, setIsOtpFieldDirty] = useState<boolean>(false);\n\n const validateInput = useCallback(() => {\n setIsOtpFieldDirty(true);\n triggerValidation();\n }, [triggerValidation]);\n\n /**\n * If shopper changes the value of the OTP fields, input becomes dirty\n */\n useEffect(() => {\n if (data.otp) setIsOtpFieldDirty(true);\n }, [data.otp]);\n\n useEffect(() => {\n if (!disableOtpAutoFocus && inputRef.current) {\n inputRef.current.focus();\n }\n }, [inputRef.current, disableOtpAutoFocus]);\n\n useEffect(() => {\n otpInputHandlersRef.current.validateInput = validateInput;\n props.onSetInputHandlers(otpInputHandlersRef.current);\n }, [validateInput, props.onSetInputHandlers]);\n\n const handleOnResendOtp = useCallback(() => {\n setData('otp', '');\n setResendOtpError(null);\n if (!disableOtpAutoFocus) {\n inputRef.current.focus();\n }\n props.onResendCode();\n }, [props.onResendCode, inputRef.current, disableOtpAutoFocus]);\n\n const handleOnResendOtpError = useCallback(\n (errorCode: string) => {\n const message = i18n.get(`ctp.errors.${errorCode}`);\n if (message) setResendOtpError(message);\n },\n [i18n]\n );\n\n const handleOnKeyUp = useCallback(\n (event: h.JSX.TargetedKeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n void props.onPressEnter();\n }\n },\n [props.onPressEnter]\n );\n\n const handleOnKeyPress = useCallback((event: h.JSX.TargetedKeyboardEvent<HTMLInputElement>) => {\n // Prevent <form> submission if Component is placed inside an form\n if (event.key === 'Enter') event.preventDefault();\n }, []);\n\n useEffect(() => {\n props.onChange({ data, valid, errors, isValid });\n }, [data, valid, errors]);\n\n return (\n <Field\n name=\"oneTimePassword\"\n label={i18n.get('ctp.otp.fieldLabel')}\n labelEndAdornment={\n !props.hideResendOtpButton && (\n <CtPResendOtpLink disabled={props.isValidatingOtp} onError={handleOnResendOtpError} onResendCode={handleOnResendOtp} />\n )\n }\n errorMessage={isOtpFielDirty ? resendOtpError || props.errorMessage || !!errors.otp : null}\n classNameModifiers={['otp']}\n >\n <InputText\n name={'otp'}\n autocorrect={'off'}\n spellcheck={false}\n value={data.otp}\n disabled={props.disabled}\n onInput={handleChangeFor('otp', 'input')}\n onBlur={handleChangeFor('otp', 'blur')}\n onKeyUp={handleOnKeyUp}\n onKeyPress={handleOnKeyPress}\n setRef={(ref: HTMLInputElement) => {\n inputRef.current = ref;\n }}\n />\n </Field>\n );\n};\n\nexport default CtPOneTimePasswordInput;\n"],"names":["CtPOneTimePasswordInput","props","i18n","useCoreContext","configuration","disableOtpAutoFocus","useClickToPayContext","resendOtpError","setResendOtpError","useState","handleChangeFor","data","triggerValidation","valid","errors","isValid","setData","useForm","schema","rules","otpValidationRules","otpInputHandlersRef","useRef","validateInput","inputRef","isOtpFielDirty","setIsOtpFieldDirty","useCallback","useEffect","otp","current","focus","onSetInputHandlers","handleOnResendOtp","onResendCode","handleOnResendOtpError","errorCode","message","get","handleOnKeyUp","event","key","onPressEnter","handleOnKeyPress","preventDefault","onChange","h","Field","name","label","labelEndAdornment","hideResendOtpButton","CtPResendOtpLink","disabled","isValidatingOtp","onError","errorMessage","classNameModifiers","InputText","autocorrect","spellcheck","value","onInput","onBlur","onKeyUp","onKeyPress","setRef","ref"],"mappings":"glBAgCA,MAAMA,EAA2BC,IAC7B,MAAMC,KAAEA,GAASC,KAEbC,eAAeC,oBAAEA,IACjBC,KAGGC,EAAgBC,GAAqBC,EAAiB,OACvDC,gBAAEA,EAAeC,KAAEA,EAAIC,kBAAEA,EAAiBC,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,EAAOC,QAAEA,GAAYC,EAA0C,CAC5HC,OAHe,CAAC,OAIhBC,MAAOC,IAELC,EAAsBC,EAAwC,CAAEC,cAAe,OAC/EC,EAAWF,EAAyB,OACnCG,EAAgBC,GAAsBjB,GAAkB,GAEzDc,EAAgBI,GAAY,KAC9BD,GAAmB,GACnBd,GAAAA,GACD,CAACA,IAKJgB,GAAU,KACFjB,EAAKkB,KAAKH,GAAmB,EAAA,GAClC,CAACf,EAAKkB,MAETD,GAAU,MACDvB,GAAuBmB,EAASM,SACjCN,EAASM,QAAQC,OACrB,GACD,CAACP,EAASM,QAASzB,IAEtBuB,GAAU,KACNP,EAAoBS,QAAQP,cAAgBA,EAC5CtB,EAAM+B,mBAAmBX,EAAoBS,QAAO,GACrD,CAACP,EAAetB,EAAM+B,qBAEzB,MAAMC,EAAoBN,GAAY,KAClCX,EAAQ,MAAO,IACfR,EAAkB,MACbH,GACDmB,EAASM,QAAQC,QAErB9B,EAAMiC,cAAY,GACnB,CAACjC,EAAMiC,aAAcV,EAASM,QAASzB,IAEpC8B,EAAyBR,GAC1BS,IACG,MAAMC,EAAUnC,EAAKoC,IAAI,cAAcF,KACnCC,GAAS7B,EAAkB6B,EAAAA,GAEnC,CAACnC,IAGCqC,EAAgBZ,GACjBa,IACqB,UAAdA,EAAMC,KACDxC,EAAMyC,cACf,GAEJ,CAACzC,EAAMyC,eAGLC,EAAmBhB,GAAaa,IAEhB,UAAdA,EAAMC,KAAiBD,EAAMI,gBAAc,GAChD,IAMH,OAJAhB,GAAU,KACN3B,EAAM4C,SAAS,CAAElC,OAAME,QAAOC,SAAQC,WAAQ,GAC/C,CAACJ,EAAME,EAAOC,IAGbgC,EAACC,EAAAA,CACGC,KAAK,kBACLC,MAAO/C,EAAKoC,IAAI,sBAChBY,mBACKjD,EAAMkD,qBACHL,EAACM,EAAAA,CAAiBC,SAAUpD,EAAMqD,gBAAiBC,QAASpB,EAAwBD,aAAcD,IAG1GuB,aAAc/B,EAAiBlB,GAAkBN,EAAMuD,gBAAkB1C,EAAOe,IAAM,KACtF4B,mBAAoB,CAAC,QAErBX,EAACY,EAAAA,CACGV,KAAM,MACNW,YAAa,MACbC,YAAY,EACZC,MAAOlD,EAAKkB,IACZwB,SAAUpD,EAAMoD,SAChBS,QAASpD,EAAgB,MAAO,SAChCqD,OAAQrD,EAAgB,MAAO,QAC/BsD,QAASzB,EACT0B,WAAYtB,EACZuB,OAASC,IACL3C,EAASM,QAAUqC,CAAAA"}
1
+ {"version":3,"file":"CtPOneTimePasswordInput.js","sources":["../../../../../../../../src/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport { otpValidationRules } from './validate';\nimport CtPResendOtpLink from './CtPResendOtpLink';\nimport useClickToPayContext from '../../../context/useClickToPayContext';\nimport { useCoreContext } from '../../../../../../core/Context/CoreProvider';\nimport useForm from '../../../../../../utils/useForm';\nimport Field from '../../../../FormFields/Field';\nimport './CtPOneTimePasswordInput.scss';\nimport InputText from '../../../../FormFields/InputText';\n\ntype OnChangeProps = { data: CtPOneTimePasswordInputDataState; valid; errors; isValid: boolean };\n\ninterface CtPOneTimePasswordInputProps {\n hideResendOtpButton: boolean;\n disabled: boolean;\n isValidatingOtp: boolean;\n errorMessage?: string;\n onSetInputHandlers(handlers: CtPOneTimePasswordInputHandlers): void;\n onPressEnter(): Promise<void>;\n onChange({ data, valid, errors, isValid }: OnChangeProps): void;\n onResendCode(): void;\n}\n\ninterface CtPOneTimePasswordInputDataState {\n otp?: string;\n}\n\nexport type CtPOneTimePasswordInputHandlers = {\n validateInput(): void;\n};\n\nconst CtPOneTimePasswordInput = (props: CtPOneTimePasswordInputProps): h.JSX.Element => {\n const { i18n } = useCoreContext();\n const {\n configuration: { disableOtpAutoFocus }\n } = useClickToPayContext();\n\n const formSchema = ['otp'];\n const [resendOtpError, setResendOtpError] = useState<string>(null);\n const { handleChangeFor, data, triggerValidation, valid, errors, isValid, setData } = useForm<CtPOneTimePasswordInputDataState>({\n schema: formSchema,\n rules: otpValidationRules\n });\n const otpInputHandlersRef = useRef<CtPOneTimePasswordInputHandlers>({ validateInput: null });\n const inputRef = useRef<HTMLInputElement>(null);\n const [isOtpFielDirty, setIsOtpFieldDirty] = useState<boolean>(false);\n\n const validateInput = useCallback(() => {\n setIsOtpFieldDirty(true);\n triggerValidation();\n }, [triggerValidation]);\n\n /**\n * If shopper changes the value of the OTP fields, input becomes dirty\n */\n useEffect(() => {\n if (data.otp) setIsOtpFieldDirty(true);\n }, [data.otp]);\n\n useEffect(() => {\n if (!disableOtpAutoFocus && inputRef.current) {\n inputRef.current.focus();\n }\n }, [inputRef.current, disableOtpAutoFocus]);\n\n useEffect(() => {\n otpInputHandlersRef.current.validateInput = validateInput;\n props.onSetInputHandlers(otpInputHandlersRef.current);\n }, [validateInput, props.onSetInputHandlers]);\n\n const handleOnResendOtp = useCallback(() => {\n setData('otp', '');\n setResendOtpError(null);\n if (!disableOtpAutoFocus) {\n inputRef.current.focus();\n }\n props.onResendCode();\n }, [props.onResendCode, inputRef.current, disableOtpAutoFocus]);\n\n const handleOnResendOtpError = useCallback(\n (errorCode: string) => {\n const message = i18n.get(`ctp.errors.${errorCode}`);\n if (message) setResendOtpError(message);\n },\n [i18n]\n );\n\n const handleOnKeyPress = useCallback(\n (event: h.JSX.TargetedKeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n void props.onPressEnter();\n }\n },\n [props.onPressEnter]\n );\n\n useEffect(() => {\n props.onChange({ data, valid, errors, isValid });\n }, [data, valid, errors]);\n\n return (\n <Field\n name=\"oneTimePassword\"\n label={i18n.get('ctp.otp.fieldLabel')}\n labelEndAdornment={\n !props.hideResendOtpButton && (\n <CtPResendOtpLink disabled={props.isValidatingOtp} onError={handleOnResendOtpError} onResendCode={handleOnResendOtp} />\n )\n }\n errorMessage={isOtpFielDirty ? resendOtpError || props.errorMessage || !!errors.otp : null}\n classNameModifiers={['otp']}\n >\n <InputText\n name={'otp'}\n autocorrect={'off'}\n spellcheck={false}\n value={data.otp}\n disabled={props.disabled}\n onInput={handleChangeFor('otp', 'input')}\n onBlur={handleChangeFor('otp', 'blur')}\n onKeyPress={handleOnKeyPress}\n setRef={(ref: HTMLInputElement) => {\n inputRef.current = ref;\n }}\n />\n </Field>\n );\n};\n\nexport default CtPOneTimePasswordInput;\n"],"names":["CtPOneTimePasswordInput","props","i18n","useCoreContext","configuration","disableOtpAutoFocus","useClickToPayContext","resendOtpError","setResendOtpError","useState","handleChangeFor","data","triggerValidation","valid","errors","isValid","setData","useForm","schema","rules","otpValidationRules","otpInputHandlersRef","useRef","validateInput","inputRef","isOtpFielDirty","setIsOtpFieldDirty","useCallback","useEffect","otp","current","focus","onSetInputHandlers","handleOnResendOtp","onResendCode","handleOnResendOtpError","errorCode","message","get","handleOnKeyPress","event","key","onPressEnter","onChange","h","Field","name","label","labelEndAdornment","hideResendOtpButton","CtPResendOtpLink","disabled","isValidatingOtp","onError","errorMessage","classNameModifiers","InputText","autocorrect","spellcheck","value","onInput","onBlur","onKeyPress","setRef","ref"],"mappings":"glBAgCA,MAAMA,EAA2BC,IAC7B,MAAMC,KAAEA,GAASC,KAEbC,eAAeC,oBAAEA,IACjBC,KAGGC,EAAgBC,GAAqBC,EAAiB,OACvDC,gBAAEA,EAAeC,KAAEA,EAAIC,kBAAEA,EAAiBC,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,EAAOC,QAAEA,GAAYC,EAA0C,CAC5HC,OAHe,CAAC,OAIhBC,MAAOC,IAELC,EAAsBC,EAAwC,CAAEC,cAAe,OAC/EC,EAAWF,EAAyB,OACnCG,EAAgBC,GAAsBjB,GAAkB,GAEzDc,EAAgBI,GAAY,KAC9BD,GAAmB,GACnBd,GAAAA,GACD,CAACA,IAKJgB,GAAU,KACFjB,EAAKkB,KAAKH,GAAmB,EAAA,GAClC,CAACf,EAAKkB,MAETD,GAAU,MACDvB,GAAuBmB,EAASM,SACjCN,EAASM,QAAQC,OACrB,GACD,CAACP,EAASM,QAASzB,IAEtBuB,GAAU,KACNP,EAAoBS,QAAQP,cAAgBA,EAC5CtB,EAAM+B,mBAAmBX,EAAoBS,QAAO,GACrD,CAACP,EAAetB,EAAM+B,qBAEzB,MAAMC,EAAoBN,GAAY,KAClCX,EAAQ,MAAO,IACfR,EAAkB,MACbH,GACDmB,EAASM,QAAQC,QAErB9B,EAAMiC,cAAY,GACnB,CAACjC,EAAMiC,aAAcV,EAASM,QAASzB,IAEpC8B,EAAyBR,GAC1BS,IACG,MAAMC,EAAUnC,EAAKoC,IAAI,cAAcF,KACnCC,GAAS7B,EAAkB6B,EAAAA,GAEnC,CAACnC,IAGCqC,EAAmBZ,GACpBa,IACqB,UAAdA,EAAMC,KACDxC,EAAMyC,cACf,GAEJ,CAACzC,EAAMyC,eAOX,OAJAd,GAAU,KACN3B,EAAM0C,SAAS,CAAEhC,OAAME,QAAOC,SAAQC,WAAQ,GAC/C,CAACJ,EAAME,EAAOC,IAGb8B,EAACC,EAAAA,CACGC,KAAK,kBACLC,MAAO7C,EAAKoC,IAAI,sBAChBU,mBACK/C,EAAMgD,qBACHL,EAACM,EAAAA,CAAiBC,SAAUlD,EAAMmD,gBAAiBC,QAASlB,EAAwBD,aAAcD,IAG1GqB,aAAc7B,EAAiBlB,GAAkBN,EAAMqD,gBAAkBxC,EAAOe,IAAM,KACtF0B,mBAAoB,CAAC,QAErBX,EAACY,EAAAA,CACGV,KAAM,MACNW,YAAa,MACbC,YAAY,EACZC,MAAOhD,EAAKkB,IACZsB,SAAUlD,EAAMkD,SAChBS,QAASlD,EAAgB,MAAO,SAChCmD,OAAQnD,EAAgB,MAAO,QAC/BoD,WAAYvB,EACZwB,OAASC,IACLxC,EAASM,QAAUkC,CAAAA"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../external/preact/dist/preact.js";import t from"../../../../../external/classnames/index.js";import c from"./CtPLogoutLink.js";import{CtPBrand as n}from"../CtPBrand/CtPBrand.js";import a from"../../context/useClickToPayContext.js";const o=({children:o})=>{const{isStandaloneComponent:s}=a();return e("div",{className:t("adyen-checkout-ctp__section",{"adyen-checkout-ctp__section--standalone":s})},e("div",{className:"adyen-checkout-ctp__section-brand"},e(n,null),e(c,null)),o)};o.Title=({endAdornment:t,children:c})=>e("div",{className:"adyen-checkout-ctp__section-header"},e("h1",{className:"adyen-checkout-ctp__section-header-title"},c),t&&e("span",{className:"adyen-checkout-ctp__section-header-adornment"},t)),o.Text=({children:t})=>e("p",{className:"adyen-checkout-ctp__section-text"},t);export{o as default};
1
+ import{createElement as e}from"../../../../../external/preact/dist/preact.js";import t from"../../../../../external/classnames/index.js";import n from"./CtPLogoutLink.js";import{CtPBrand as c}from"../CtPBrand/CtPBrand.js";import a from"../../context/useClickToPayContext.js";const o=({children:o,onEnterKeyPress:s})=>{const{isStandaloneComponent:r}=a();return e("div",{className:t("adyen-checkout-ctp__section",{"adyen-checkout-ctp__section--standalone":r}),onKeyPress:s},e("div",{className:"adyen-checkout-ctp__section-brand"},e(c,null),e(n,null)),o)};o.Title=({endAdornment:t,children:n})=>e("div",{className:"adyen-checkout-ctp__section-header"},e("h1",{className:"adyen-checkout-ctp__section-header-title"},n),t&&e("span",{className:"adyen-checkout-ctp__section-header-adornment"},t)),o.Text=({children:t})=>e("p",{className:"adyen-checkout-ctp__section-text"},t);export{o as default};
2
2
  //# sourceMappingURL=CtPSection.js.map