@adyen/adyen-web 6.4.0 → 6.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (333) hide show
  1. package/README.md +16 -5
  2. package/dist/cjs/adyen.css +7 -3
  3. package/dist/cjs/adyen.css.map +1 -1
  4. package/dist/cjs/index.cjs +2 -2
  5. package/dist/cjs/index.cjs.map +1 -1
  6. package/dist/cjs/index.d.cts +27 -19
  7. package/dist/es/adyen.css +7 -3
  8. package/dist/es/adyen.css.map +1 -1
  9. package/dist/es/components/ANCV/ANCV.js +1 -1
  10. package/dist/es/components/ANCV/ANCV.js.map +1 -1
  11. package/dist/es/components/Ach/Ach.js +1 -1
  12. package/dist/es/components/Ach/Ach.js.map +1 -1
  13. package/dist/es/components/Address/Address.js +1 -1
  14. package/dist/es/components/Address/Address.js.map +1 -1
  15. package/dist/es/components/Affirm/Affirm.js +1 -1
  16. package/dist/es/components/Affirm/Affirm.js.map +1 -1
  17. package/dist/es/components/AfterPay/AfterPay.js +1 -1
  18. package/dist/es/components/AfterPay/AfterPay.js.map +1 -1
  19. package/dist/es/components/AfterPay/AfterPayB2B.js +1 -1
  20. package/dist/es/components/AfterPay/AfterPayB2B.js.map +1 -1
  21. package/dist/es/components/AmazonPay/AmazonPay.js +1 -1
  22. package/dist/es/components/AmazonPay/AmazonPay.js.map +1 -1
  23. package/dist/es/components/ApplePay/ApplePay.js +1 -1
  24. package/dist/es/components/ApplePay/ApplePay.js.map +1 -1
  25. package/dist/es/components/ApplePay/ApplePayService.js +1 -1
  26. package/dist/es/components/ApplePay/ApplePayService.js.map +1 -1
  27. package/dist/es/components/ApplePay/components/ApplePayButton.js +1 -1
  28. package/dist/es/components/ApplePay/components/ApplePayButton.js.map +1 -1
  29. package/dist/es/components/Atome/Atome.js +1 -1
  30. package/dist/es/components/Atome/Atome.js.map +1 -1
  31. package/dist/es/components/BacsDD/BacsDD.js +1 -1
  32. package/dist/es/components/BacsDD/BacsDD.js.map +1 -1
  33. package/dist/es/components/BankTransfer/BankTransfer.js +1 -1
  34. package/dist/es/components/BankTransfer/BankTransfer.js.map +1 -1
  35. package/dist/es/components/BcmcMobile/BcmcMobile.js +1 -1
  36. package/dist/es/components/BcmcMobile/BcmcMobile.js.map +1 -1
  37. package/dist/es/components/BillDesk/BillDeskOnline.js +1 -1
  38. package/dist/es/components/BillDesk/BillDeskOnline.js.map +1 -1
  39. package/dist/es/components/BillDesk/BillDeskWallet.js +1 -1
  40. package/dist/es/components/BillDesk/BillDeskWallet.js.map +1 -1
  41. package/dist/es/components/Blik/Blik.js +1 -1
  42. package/dist/es/components/Blik/Blik.js.map +1 -1
  43. package/dist/es/components/Boleto/Boleto.js +1 -1
  44. package/dist/es/components/Boleto/Boleto.js.map +1 -1
  45. package/dist/es/components/Card/Bancontact.js +1 -1
  46. package/dist/es/components/Card/Bancontact.js.map +1 -1
  47. package/dist/es/components/Card/Card.js +1 -1
  48. package/dist/es/components/Card/Card.js.map +1 -1
  49. package/dist/es/components/CashAppPay/CashAppPay.js +1 -1
  50. package/dist/es/components/CashAppPay/CashAppPay.js.map +1 -1
  51. package/dist/es/components/CashAppPay/services/CashAppService.js +1 -1
  52. package/dist/es/components/CashAppPay/services/CashAppService.js.map +1 -1
  53. package/dist/es/components/ClickToPay/ClickToPay.js +1 -1
  54. package/dist/es/components/ClickToPay/ClickToPay.js.map +1 -1
  55. package/dist/es/components/CustomCard/CustomCard.js +1 -1
  56. package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
  57. package/dist/es/components/Doku/Doku.js +1 -1
  58. package/dist/es/components/Doku/Doku.js.map +1 -1
  59. package/dist/es/components/Donation/Donation.js +1 -1
  60. package/dist/es/components/Donation/Donation.js.map +1 -1
  61. package/dist/es/components/Dotpay/index.js +1 -1
  62. package/dist/es/components/Dotpay/index.js.map +1 -1
  63. package/dist/es/components/Dragonpay/Dragonpay.js +1 -1
  64. package/dist/es/components/Dragonpay/Dragonpay.js.map +1 -1
  65. package/dist/es/components/Dropin/Dropin.js +1 -1
  66. package/dist/es/components/Dropin/Dropin.js.map +1 -1
  67. package/dist/es/components/Dropin/components/DropinComponent.js +1 -1
  68. package/dist/es/components/Dropin/components/DropinComponent.js.map +1 -1
  69. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  70. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  71. package/dist/es/components/DuitNow/DuitNow.js +1 -1
  72. package/dist/es/components/DuitNow/DuitNow.js.map +1 -1
  73. package/dist/es/components/EPS/index.js +1 -1
  74. package/dist/es/components/EPS/index.js.map +1 -1
  75. package/dist/es/components/Econtext/Econtext.js +1 -1
  76. package/dist/es/components/Econtext/Econtext.js.map +1 -1
  77. package/dist/es/components/FacilyPay/FacilyPay10x.js +1 -1
  78. package/dist/es/components/FacilyPay/FacilyPay10x.js.map +1 -1
  79. package/dist/es/components/FacilyPay/FacilyPay12x.js +1 -1
  80. package/dist/es/components/FacilyPay/FacilyPay12x.js.map +1 -1
  81. package/dist/es/components/FacilyPay/FacilyPay3x.js +1 -1
  82. package/dist/es/components/FacilyPay/FacilyPay3x.js.map +1 -1
  83. package/dist/es/components/FacilyPay/FacilyPay4x.js +1 -1
  84. package/dist/es/components/FacilyPay/FacilyPay4x.js.map +1 -1
  85. package/dist/es/components/FacilyPay/FacilyPay6x.js +1 -1
  86. package/dist/es/components/FacilyPay/FacilyPay6x.js.map +1 -1
  87. package/dist/es/components/Giftcard/Giftcard.js +1 -1
  88. package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
  89. package/dist/es/components/Giftcard/components/GiftcardComponent.js +1 -1
  90. package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  91. package/dist/es/components/Giropay/Giropay.js +1 -1
  92. package/dist/es/components/Giropay/Giropay.js.map +1 -1
  93. package/dist/es/components/GooglePay/GooglePay.js +1 -1
  94. package/dist/es/components/GooglePay/GooglePay.js.map +1 -1
  95. package/dist/es/components/GooglePay/GooglePayService.js +1 -1
  96. package/dist/es/components/GooglePay/GooglePayService.js.map +1 -1
  97. package/dist/es/components/Klarna/KlarnaPayments.js +1 -1
  98. package/dist/es/components/Klarna/KlarnaPayments.js.map +1 -1
  99. package/dist/es/components/MBWay/MBWay.js +1 -1
  100. package/dist/es/components/MBWay/MBWay.js.map +1 -1
  101. package/dist/es/components/MealVoucherFR/MealVoucherFR.js +1 -1
  102. package/dist/es/components/MealVoucherFR/MealVoucherFR.js.map +1 -1
  103. package/dist/es/components/MolPayEBanking/MolPayEBankingMY.js +1 -1
  104. package/dist/es/components/MolPayEBanking/MolPayEBankingMY.js.map +1 -1
  105. package/dist/es/components/MolPayEBanking/MolPayEBankingTH.js +1 -1
  106. package/dist/es/components/MolPayEBanking/MolPayEBankingTH.js.map +1 -1
  107. package/dist/es/components/MolPayEBanking/MolPayEBankingVN.js +1 -1
  108. package/dist/es/components/MolPayEBanking/MolPayEBankingVN.js.map +1 -1
  109. package/dist/es/components/Multibanco/Multibanco.js +1 -1
  110. package/dist/es/components/Multibanco/Multibanco.js.map +1 -1
  111. package/dist/es/components/OnlineBankingCZ/index.js +1 -1
  112. package/dist/es/components/OnlineBankingCZ/index.js.map +1 -1
  113. package/dist/es/components/OnlineBankingFI/OnlineBankingFI.js +1 -1
  114. package/dist/es/components/OnlineBankingFI/OnlineBankingFI.js.map +1 -1
  115. package/dist/es/components/OnlineBankingIN/index.js +1 -1
  116. package/dist/es/components/OnlineBankingIN/index.js.map +1 -1
  117. package/dist/es/components/OnlineBankingPL/OnlineBankingPL.js +1 -1
  118. package/dist/es/components/OnlineBankingPL/OnlineBankingPL.js.map +1 -1
  119. package/dist/es/components/OnlineBankingSK/index.js +1 -1
  120. package/dist/es/components/OnlineBankingSK/index.js.map +1 -1
  121. package/dist/es/components/Oxxo/Oxxo.js +1 -1
  122. package/dist/es/components/Oxxo/Oxxo.js.map +1 -1
  123. package/dist/es/components/PayByBank/PayByBank.js +1 -1
  124. package/dist/es/components/PayByBank/PayByBank.js.map +1 -1
  125. package/dist/es/components/PayByBankUS/PayByBankUS.js +1 -1
  126. package/dist/es/components/PayByBankUS/PayByBankUS.js.map +1 -1
  127. package/dist/es/components/PayMe/PayMe.js +1 -1
  128. package/dist/es/components/PayMe/PayMe.js.map +1 -1
  129. package/dist/es/components/PayMe/components/PayMeInstructions.js +2 -0
  130. package/dist/es/components/PayMe/components/PayMeInstructions.js.map +1 -0
  131. package/dist/es/components/PayMe/components/PayMeIntroduction.js +2 -0
  132. package/dist/es/components/PayMe/components/PayMeIntroduction.js.map +1 -0
  133. package/dist/es/components/PayNow/PayNow.js +1 -1
  134. package/dist/es/components/PayNow/PayNow.js.map +1 -1
  135. package/dist/es/components/PayNow/components/PayNowInstructions.js +2 -0
  136. package/dist/es/components/PayNow/components/PayNowInstructions.js.map +1 -0
  137. package/dist/es/components/PayNow/components/PayNowIntroduction.js +2 -0
  138. package/dist/es/components/PayNow/components/PayNowIntroduction.js.map +1 -0
  139. package/dist/es/components/PayPal/Paypal.js +1 -1
  140. package/dist/es/components/PayPal/Paypal.js.map +1 -1
  141. package/dist/es/components/PayU/PayuCashcard.js +1 -1
  142. package/dist/es/components/PayU/PayuCashcard.js.map +1 -1
  143. package/dist/es/components/PayU/PayuNetBanking.js +1 -1
  144. package/dist/es/components/PayU/PayuNetBanking.js.map +1 -1
  145. package/dist/es/components/PersonalDetails/PersonalDetails.js +1 -1
  146. package/dist/es/components/PersonalDetails/PersonalDetails.js.map +1 -1
  147. package/dist/es/components/Pix/Pix.js +1 -1
  148. package/dist/es/components/Pix/Pix.js.map +1 -1
  149. package/dist/es/components/PromptPay/PromptPay.js +1 -1
  150. package/dist/es/components/PromptPay/PromptPay.js.map +1 -1
  151. package/dist/es/components/RatePay/RatePay.js +1 -1
  152. package/dist/es/components/RatePay/RatePay.js.map +1 -1
  153. package/dist/es/components/RatePay/RatePayDirectDebit.js +1 -1
  154. package/dist/es/components/RatePay/RatePayDirectDebit.js.map +1 -1
  155. package/dist/es/components/Redirect/Redirect.js +1 -1
  156. package/dist/es/components/Redirect/Redirect.js.map +1 -1
  157. package/dist/es/components/Redirect/components/RedirectShopper/RedirectShopper.js +1 -1
  158. package/dist/es/components/Redirect/components/RedirectShopper/RedirectShopper.js.map +1 -1
  159. package/dist/es/components/Riverty/Riverty.js +1 -1
  160. package/dist/es/components/Riverty/Riverty.js.map +1 -1
  161. package/dist/es/components/Sepa/Sepa.js +1 -1
  162. package/dist/es/components/Sepa/Sepa.js.map +1 -1
  163. package/dist/es/components/Swish/Swish.js +1 -1
  164. package/dist/es/components/Swish/Swish.js.map +1 -1
  165. package/dist/es/components/ThreeDS2/ThreeDS2Challenge.js +1 -1
  166. package/dist/es/components/ThreeDS2/ThreeDS2Challenge.js.map +1 -1
  167. package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js +1 -1
  168. package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  169. package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js +1 -1
  170. package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  171. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  172. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  173. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.js +1 -1
  174. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.js.map +1 -1
  175. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js +1 -1
  176. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
  177. package/dist/es/components/ThreeDS2/components/Form/ThreeDS2Form.js +1 -1
  178. package/dist/es/components/ThreeDS2/components/Form/ThreeDS2Form.js.map +1 -1
  179. package/dist/es/components/Trustly/Trustly.js +1 -1
  180. package/dist/es/components/Trustly/Trustly.js.map +1 -1
  181. package/dist/es/components/Twint/Twint.js +1 -1
  182. package/dist/es/components/Twint/Twint.js.map +1 -1
  183. package/dist/es/components/UPI/UPI.js +1 -1
  184. package/dist/es/components/UPI/UPI.js.map +1 -1
  185. package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
  186. package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
  187. package/dist/es/components/Vipps/Vipps.js +1 -1
  188. package/dist/es/components/Vipps/Vipps.js.map +1 -1
  189. package/dist/es/components/WalletIN/index.js +1 -1
  190. package/dist/es/components/WalletIN/index.js.map +1 -1
  191. package/dist/es/components/WeChat/WeChat.js +1 -1
  192. package/dist/es/components/WeChat/WeChat.js.map +1 -1
  193. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
  194. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  195. package/dist/es/components/helpers/OpenInvoiceContainer/OpenInvoiceContainer.js +1 -1
  196. package/dist/es/components/helpers/OpenInvoiceContainer/OpenInvoiceContainer.js.map +1 -1
  197. package/dist/es/components/helpers/QRLoaderContainer/QRLoaderContainer.js +1 -1
  198. package/dist/es/components/helpers/QRLoaderContainer/QRLoaderContainer.js.map +1 -1
  199. package/dist/es/components/internal/Address/Address.js +1 -1
  200. package/dist/es/components/internal/Address/Address.js.map +1 -1
  201. package/dist/es/components/internal/Address/Specifications.js +1 -1
  202. package/dist/es/components/internal/Address/Specifications.js.map +1 -1
  203. package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
  204. package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
  205. package/dist/es/components/internal/Button/Button.js +1 -1
  206. package/dist/es/components/internal/Button/Button.js.map +1 -1
  207. package/dist/es/components/internal/ClickToPay/errors/TimeoutError.js +1 -1
  208. package/dist/es/components/internal/ClickToPay/errors/TimeoutError.js.map +1 -1
  209. package/dist/es/components/internal/ClickToPay/models/ShopperCard.js +1 -1
  210. package/dist/es/components/internal/ClickToPay/models/ShopperCard.js.map +1 -1
  211. package/dist/es/components/internal/ClickToPay/services/ClickToPayService.js +1 -1
  212. package/dist/es/components/internal/ClickToPay/services/ClickToPayService.js.map +1 -1
  213. package/dist/es/components/internal/ClickToPay/services/sdks/AbstractSrcInitiator.js +1 -1
  214. package/dist/es/components/internal/ClickToPay/services/sdks/AbstractSrcInitiator.js.map +1 -1
  215. package/dist/es/components/internal/ClickToPay/services/sdks/MastercardSdk.js +1 -1
  216. package/dist/es/components/internal/ClickToPay/services/sdks/MastercardSdk.js.map +1 -1
  217. package/dist/es/components/internal/ClickToPay/services/sdks/SrcSdkLoader.js +1 -1
  218. package/dist/es/components/internal/ClickToPay/services/sdks/SrcSdkLoader.js.map +1 -1
  219. package/dist/es/components/internal/ClickToPay/services/sdks/SrciError.js +1 -1
  220. package/dist/es/components/internal/ClickToPay/services/sdks/SrciError.js.map +1 -1
  221. package/dist/es/components/internal/ClickToPay/services/sdks/VisaSdk.js +1 -1
  222. package/dist/es/components/internal/ClickToPay/services/sdks/VisaSdk.js.map +1 -1
  223. package/dist/es/components/internal/Countdown/CountdownA11yReporter.js +1 -1
  224. package/dist/es/components/internal/Countdown/CountdownA11yReporter.js.map +1 -1
  225. package/dist/es/components/internal/FormFields/ConsentCheckbox/ConsentCheckbox.js +1 -1
  226. package/dist/es/components/internal/FormFields/ConsentCheckbox/ConsentCheckbox.js.map +1 -1
  227. package/dist/es/components/internal/IFrame/Iframe.js +1 -1
  228. package/dist/es/components/internal/IFrame/Iframe.js.map +1 -1
  229. package/dist/es/components/internal/IbanInput/IbanInput.js +1 -1
  230. package/dist/es/components/internal/IbanInput/IbanInput.js.map +1 -1
  231. package/dist/es/components/internal/QRLoader/QRLoader.js +1 -1
  232. package/dist/es/components/internal/QRLoader/QRLoader.js.map +1 -1
  233. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  234. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  235. package/dist/es/components/internal/SecuredFields/lib/CSF/AbstractCSF.js +1 -1
  236. package/dist/es/components/internal/SecuredFields/lib/CSF/AbstractCSF.js.map +1 -1
  237. package/dist/es/components/internal/SecuredFields/lib/CSF/CSF.js +1 -1
  238. package/dist/es/components/internal/SecuredFields/lib/CSF/CSF.js.map +1 -1
  239. package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
  240. package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  241. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  242. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  243. package/dist/es/components/internal/Timeline/Timeline.js +2 -0
  244. package/dist/es/components/internal/Timeline/Timeline.js.map +1 -0
  245. package/dist/es/components/internal/Timeline/TimelineWrapper.js +2 -0
  246. package/dist/es/components/internal/Timeline/TimelineWrapper.js.map +1 -0
  247. package/dist/es/components/internal/UIElement/UIElement.js +1 -1
  248. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  249. package/dist/es/core/CheckoutSession/CheckoutSession.js +1 -1
  250. package/dist/es/core/CheckoutSession/CheckoutSession.js.map +1 -1
  251. package/dist/es/core/Context/Resources.js +1 -1
  252. package/dist/es/core/Context/Resources.js.map +1 -1
  253. package/dist/es/core/Errors/AdyenCheckoutError.js +1 -1
  254. package/dist/es/core/Errors/AdyenCheckoutError.js.map +1 -1
  255. package/dist/es/core/Errors/SRPanel.js +1 -1
  256. package/dist/es/core/Errors/SRPanel.js.map +1 -1
  257. package/dist/es/core/ProcessResponse/PaymentMethods/PaymentMethods.js +1 -1
  258. package/dist/es/core/ProcessResponse/PaymentMethods/PaymentMethods.js.map +1 -1
  259. package/dist/es/core/RiskModule/RiskModule.js +1 -1
  260. package/dist/es/core/RiskModule/RiskModule.js.map +1 -1
  261. package/dist/es/core/RiskModule/components/DeviceFingerprint/DeviceFingerprint.js +1 -1
  262. package/dist/es/core/RiskModule/components/DeviceFingerprint/DeviceFingerprint.js.map +1 -1
  263. package/dist/es/core/RiskModule/components/DeviceFingerprint/GetDeviceFingerprint.js +1 -1
  264. package/dist/es/core/RiskModule/components/DeviceFingerprint/GetDeviceFingerprint.js.map +1 -1
  265. package/dist/es/core/Services/analytics/collect-id.js +1 -1
  266. package/dist/es/core/core.js +1 -1
  267. package/dist/es/core/core.js.map +1 -1
  268. package/dist/es/core/core.registry.js +1 -1
  269. package/dist/es/core/core.registry.js.map +1 -1
  270. package/dist/es/index.d.ts +27 -19
  271. package/dist/es/language/Language.js +1 -1
  272. package/dist/es/language/Language.js.map +1 -1
  273. package/dist/es/utils/Script.js +1 -1
  274. package/dist/es/utils/Script.js.map +1 -1
  275. package/dist/es/utils/Storage.js +1 -1
  276. package/dist/es/utils/Storage.js.map +1 -1
  277. package/dist/es/utils/Validator/ValidationRuleResult.js +1 -1
  278. package/dist/es/utils/Validator/ValidationRuleResult.js.map +1 -1
  279. package/dist/es/utils/Validator/Validator.js +1 -1
  280. package/dist/es/utils/Validator/Validator.js.map +1 -1
  281. package/dist/es/utils/constants/currency-decimals.js +1 -1
  282. package/dist/es/utils/constants/currency-decimals.js.map +1 -1
  283. package/dist/es/utils/constants/currency-minor-units.js.map +1 -1
  284. package/dist/es/utils/useForm/reducer.js +1 -1
  285. package/dist/es/utils/useForm/reducer.js.map +1 -1
  286. package/dist/es/utils/useForm/useForm.js +1 -1
  287. package/dist/es/utils/useForm/useForm.js.map +1 -1
  288. package/dist/es/utils/useIsMobile.js +2 -0
  289. package/dist/es/utils/useIsMobile.js.map +1 -0
  290. package/dist/es-legacy/adyen.css +7 -3
  291. package/dist/es-legacy/adyen.css.map +1 -1
  292. package/dist/es-legacy/components/BcmcMobile/BcmcMobile.js +1 -1
  293. package/dist/es-legacy/components/BcmcMobile/BcmcMobile.js.map +1 -1
  294. package/dist/es-legacy/components/PayMe/PayMe.js +1 -1
  295. package/dist/es-legacy/components/PayMe/PayMe.js.map +1 -1
  296. package/dist/es-legacy/components/PayMe/components/PayMeInstructions.js +2 -0
  297. package/dist/es-legacy/components/PayMe/components/PayMeInstructions.js.map +1 -0
  298. package/dist/es-legacy/components/PayMe/components/PayMeIntroduction.js +2 -0
  299. package/dist/es-legacy/components/PayMe/components/PayMeIntroduction.js.map +1 -0
  300. package/dist/es-legacy/components/PayNow/PayNow.js +1 -1
  301. package/dist/es-legacy/components/PayNow/PayNow.js.map +1 -1
  302. package/dist/es-legacy/components/PayNow/components/PayNowInstructions.js +2 -0
  303. package/dist/es-legacy/components/PayNow/components/PayNowInstructions.js.map +1 -0
  304. package/dist/es-legacy/components/PayNow/components/PayNowIntroduction.js +2 -0
  305. package/dist/es-legacy/components/PayNow/components/PayNowIntroduction.js.map +1 -0
  306. package/dist/es-legacy/components/Swish/Swish.js.map +1 -1
  307. package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
  308. package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
  309. package/dist/es-legacy/components/internal/Address/Address.js +1 -1
  310. package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
  311. package/dist/es-legacy/components/internal/QRLoader/QRLoader.js +1 -1
  312. package/dist/es-legacy/components/internal/QRLoader/QRLoader.js.map +1 -1
  313. package/dist/es-legacy/components/internal/Timeline/Timeline.js +2 -0
  314. package/dist/es-legacy/components/internal/Timeline/Timeline.js.map +1 -0
  315. package/dist/es-legacy/components/internal/Timeline/TimelineWrapper.js +2 -0
  316. package/dist/es-legacy/components/internal/Timeline/TimelineWrapper.js.map +1 -0
  317. package/dist/es-legacy/core/Services/analytics/collect-id.js +1 -1
  318. package/dist/es-legacy/core/core.js +1 -1
  319. package/dist/es-legacy/utils/constants/currency-decimals.js +1 -1
  320. package/dist/es-legacy/utils/constants/currency-decimals.js.map +1 -1
  321. package/dist/es-legacy/utils/constants/currency-minor-units.js.map +1 -1
  322. package/dist/es-legacy/utils/useForm/reducer.js +1 -1
  323. package/dist/es-legacy/utils/useForm/reducer.js.map +1 -1
  324. package/dist/es-legacy/utils/useForm/useForm.js +1 -1
  325. package/dist/es-legacy/utils/useForm/useForm.js.map +1 -1
  326. package/dist/es-legacy/utils/useIsMobile.js +2 -0
  327. package/dist/es-legacy/utils/useIsMobile.js.map +1 -0
  328. package/package.json +4 -2
  329. package/styles/adyen.css +7 -3
  330. package/dist/es/components/PayMe/Instructions.js +0 -2
  331. package/dist/es/components/PayMe/Instructions.js.map +0 -1
  332. package/dist/es-legacy/components/PayMe/Instructions.js +0 -2
  333. package/dist/es-legacy/components/PayMe/Instructions.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as s}from"../internal/UIElement/UIElement.js";import{CoreProvider as e}from"../../core/Context/CoreProvider.js";import r from"../internal/RedirectButton/RedirectButton.js";import o from"./components/BankTransferResult/BankTransferResult.js";import n from"./components/BankTransferInput/BankTransferInput.js";import{TxVariants as i}from"../tx-variants.js";class a extends s{static type=i.bankTransfer_IBAN;static defaultProps={showEmailAddress:!0};state={isValid:!this.props.showEmailAddress,data:{}};get isValid(){return!!this.state.isValid}formatData(){const{shopperEmail:t}=this.state.data;return{paymentMethod:{type:a.type},...t&&{shopperEmail:t}}}handleRef=t=>{this.componentRef=t};render(){return this.props.reference?t(e,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},t(o,{ref:this.handleRef,...this.props,onActionHandled:this.onActionHandled})):t(e,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},this.props.showEmailAddress&&t(n,{ref:this.handleRef,...this.props,onChange:this.setState}),t(r,{...this.props,showPayButton:this.props.showPayButton,name:this.displayName,onSubmit:this.submit,payButton:this.payButton}))}}export{a as BankTransferElement,a as default};
1
+ import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import{CoreProvider as s}from"../../core/Context/CoreProvider.js";import r from"../internal/RedirectButton/RedirectButton.js";import o from"./components/BankTransferResult/BankTransferResult.js";import n from"./components/BankTransferInput/BankTransferInput.js";import{TxVariants as i}from"../tx-variants.js";function a(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}class p extends e{get isValid(){return!!this.state.isValid}formatData(){const{shopperEmail:t}=this.state.data;return{paymentMethod:{type:p.type},...t&&{shopperEmail:t}}}render(){return this.props.reference?t(s,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},t(o,{ref:this.handleRef,...this.props,onActionHandled:this.onActionHandled})):t(s,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},this.props.showEmailAddress&&t(n,{ref:this.handleRef,...this.props,onChange:this.setState}),t(r,{...this.props,showPayButton:this.props.showPayButton,name:this.displayName,onSubmit:this.submit,payButton:this.payButton}))}constructor(...t){super(...t),a(this,"state",{isValid:!this.props.showEmailAddress,data:{}}),a(this,"handleRef",(t=>{this.componentRef=t}))}}a(p,"type",i.bankTransfer_IBAN),a(p,"defaultProps",{showEmailAddress:!0});export{p as BankTransferElement,p as default};
2
2
  //# sourceMappingURL=BankTransfer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BankTransfer.js","sources":["../../../../src/components/BankTransfer/BankTransfer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport RedirectButton from '../internal/RedirectButton';\nimport { BankTransferConfiguration, BankTransferState } from './types';\nimport BankTransferResult from './components/BankTransferResult';\nimport BankTransferInput from './components/BankTransferInput';\nimport { TxVariants } from '../tx-variants';\n\nexport class BankTransferElement extends UIElement<BankTransferConfiguration> {\n public static type = TxVariants.bankTransfer_IBAN;\n\n public static defaultProps = {\n showEmailAddress: true\n };\n\n // @ts-ignore Double check why state extends all props\n public state: BankTransferState = {\n isValid: !this.props.showEmailAddress,\n data: {}\n };\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n /**\n * Formats the component data output\n */\n formatData() {\n const { shopperEmail } = this.state.data;\n\n return {\n paymentMethod: {\n type: BankTransferElement.type\n },\n ...(shopperEmail && { shopperEmail })\n };\n }\n\n private handleRef = ref => {\n this.componentRef = ref;\n };\n\n render() {\n if (this.props.reference) {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <BankTransferResult ref={this.handleRef} {...this.props} onActionHandled={this.onActionHandled} />\n </CoreProvider>\n );\n }\n\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n {this.props.showEmailAddress && <BankTransferInput ref={this.handleRef} {...this.props} onChange={this.setState} />}\n <RedirectButton\n {...this.props}\n showPayButton={this.props.showPayButton}\n name={this.displayName}\n onSubmit={this.submit}\n payButton={this.payButton}\n />\n </CoreProvider>\n );\n }\n}\n\nexport default BankTransferElement;\n"],"names":["BankTransferElement","UIElement","static","TxVariants","bankTransfer_IBAN","showEmailAddress","state","isValid","this","props","data","formatData","shopperEmail","paymentMethod","type","handleRef","ref","componentRef","render","reference","h","CoreProvider","i18n","loadingContext","resources","BankTransferResult","onActionHandled","BankTransferInput","onChange","setState","RedirectButton","showPayButton","name","displayName","onSubmit","submit","payButton"],"mappings":"ybASO,MAAMA,UAA4BC,EACrCC,YAAqBC,EAAWC,kBAEhCF,oBAA6B,CACzBG,kBAAkB,GAIfC,MAA2B,CAC9BC,SAAUC,KAAKC,MAAMJ,iBACrBK,KAAM,CAAC,GAGX,WAAIH,GACA,QAASC,KAAKF,MAAMC,OACxB,CAKAI,UAAAA,GACI,MAAMC,aAAEA,GAAiBJ,KAAKF,MAAMI,KAEpC,MAAO,CACHG,cAAe,CACXC,KAAMd,EAAoBc,SAE1BF,GAAgB,CAAEA,gBAE9B,CAEQG,UAAYC,IAChBR,KAAKS,aAAeD,CAAAA,EAGxBE,MAAAA,GACI,OAAIV,KAAKC,MAAMU,UAEPC,EAACC,EAAAA,CAAaC,KAAMd,KAAKC,MAAMa,KAAMC,eAAgBf,KAAKC,MAAMc,eAAgBC,UAAWhB,KAAKgB,WAC5FJ,EAACK,EAAAA,CAAmBT,IAAKR,KAAKO,aAAeP,KAAKC,MAAOiB,gBAAiBlB,KAAKkB,mBAMvFN,EAACC,EAAAA,CAAaC,KAAMd,KAAKC,MAAMa,KAAMC,eAAgBf,KAAKC,MAAMc,eAAgBC,UAAWhB,KAAKgB,WAC3FhB,KAAKC,MAAMJ,kBAAoBe,EAACO,EAAAA,CAAkBX,IAAKR,KAAKO,aAAeP,KAAKC,MAAOmB,SAAUpB,KAAKqB,WACvGT,EAACU,EAAAA,IACOtB,KAAKC,MACTsB,cAAevB,KAAKC,MAAMsB,cAC1BC,KAAMxB,KAAKyB,YACXC,SAAU1B,KAAK2B,OACfC,UAAW5B,KAAK4B,YAIhC"}
1
+ {"version":3,"file":"BankTransfer.js","sources":["../../../../src/components/BankTransfer/BankTransfer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport RedirectButton from '../internal/RedirectButton';\nimport { BankTransferConfiguration, BankTransferState } from './types';\nimport BankTransferResult from './components/BankTransferResult';\nimport BankTransferInput from './components/BankTransferInput';\nimport { TxVariants } from '../tx-variants';\n\nexport class BankTransferElement extends UIElement<BankTransferConfiguration> {\n public static type = TxVariants.bankTransfer_IBAN;\n\n public static defaultProps = {\n showEmailAddress: true\n };\n\n // @ts-ignore Double check why state extends all props\n public state: BankTransferState = {\n isValid: !this.props.showEmailAddress,\n data: {}\n };\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n /**\n * Formats the component data output\n */\n formatData() {\n const { shopperEmail } = this.state.data;\n\n return {\n paymentMethod: {\n type: BankTransferElement.type\n },\n ...(shopperEmail && { shopperEmail })\n };\n }\n\n private handleRef = ref => {\n this.componentRef = ref;\n };\n\n render() {\n if (this.props.reference) {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <BankTransferResult ref={this.handleRef} {...this.props} onActionHandled={this.onActionHandled} />\n </CoreProvider>\n );\n }\n\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n {this.props.showEmailAddress && <BankTransferInput ref={this.handleRef} {...this.props} onChange={this.setState} />}\n <RedirectButton\n {...this.props}\n showPayButton={this.props.showPayButton}\n name={this.displayName}\n onSubmit={this.submit}\n payButton={this.payButton}\n />\n </CoreProvider>\n );\n }\n}\n\nexport default BankTransferElement;\n"],"names":["BankTransferElement","UIElement","isValid","this","state","formatData","shopperEmail","data","paymentMethod","type","render","props","reference","h","CoreProvider","i18n","loadingContext","resources","BankTransferResult","ref","handleRef","onActionHandled","showEmailAddress","BankTransferInput","onChange","setState","RedirectButton","showPayButton","name","displayName","onSubmit","submit","payButton","_define_property","componentRef","TxVariants","bankTransfer_IBAN","defaultProps"],"mappings":"ijBASO,MAAMA,UAA4BC,EAarC,WAAIC,GACA,QAASC,KAAKC,MAAMF,OACxB,CAKAG,UAAAA,GACI,MAAMC,aAAEA,GAAiBH,KAAKC,MAAMG,KAEpC,MAAO,CACHC,cAAe,CACXC,KAAMT,EAAoBS,SAE1BH,GAAgB,CAAEA,gBAE9B,CAMAI,MAAAA,GACI,OAAIP,KAAKQ,MAAMC,UAEPC,EAACC,EAAAA,CAAaC,KAAMZ,KAAKQ,MAAMI,KAAMC,eAAgBb,KAAKQ,MAAMK,eAAgBC,UAAWd,KAAKc,WAC5FJ,EAACK,EAAAA,CAAmBC,IAAKhB,KAAKiB,aAAejB,KAAKQ,MAAOU,gBAAiBlB,KAAKkB,mBAMvFR,EAACC,EAAAA,CAAaC,KAAMZ,KAAKQ,MAAMI,KAAMC,eAAgBb,KAAKQ,MAAMK,eAAgBC,UAAWd,KAAKc,WAC3Fd,KAAKQ,MAAMW,kBAAoBT,EAACU,EAAAA,CAAkBJ,IAAKhB,KAAKiB,aAAejB,KAAKQ,MAAOa,SAAUrB,KAAKsB,WACvGZ,EAACa,EAAAA,IACOvB,KAAKQ,MACTgB,cAAexB,KAAKQ,MAAMgB,cAC1BC,KAAMzB,KAAK0B,YACXC,SAAU3B,KAAK4B,OACfC,UAAW7B,KAAK6B,YAIhC,+BAhDAC,EAAA9B,KAAOC,QAA2B,CAC9BF,SAAUC,KAAKQ,MAAMW,iBACrBf,KAAM,CAAC,IAqBX0B,EAAA9B,KAAQiB,aAAYD,IAChBhB,KAAK+B,aAAef,CAAAA,KA/BxBc,EADSjC,EACKS,OAAO0B,EAAWC,mBAEhCH,EAHSjC,EAGKqC,eAAe,CACzBf,kBAAkB"}
@@ -1,2 +1,2 @@
1
- import t from"../helpers/QRLoaderContainer/QRLoaderContainer.js";import{STATUS_INTERVAL as e,COUNTDOWN_MINUTES as o}from"./config.js";import{TxVariants as r}from"../tx-variants.js";class a extends t{static type=r.bcmc_mobile;static txVariants=[r.bcmc_mobile,r.bcmc_mobile_QR];formatProps(t){const r=window.matchMedia("(max-width: 768px)").matches&&/Android|iPhone|iPod/.test(navigator.userAgent);return{delay:e,countdownTime:o,buttonLabel:r?"openApp":"generateQRCode",...super.formatProps(t)}}}export{a as default};
1
+ import e from"../helpers/QRLoaderContainer/QRLoaderContainer.js";import{STATUS_INTERVAL as r,COUNTDOWN_MINUTES as o}from"./config.js";import{TxVariants as t}from"../tx-variants.js";function a(e,r,o){return r in e?Object.defineProperty(e,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[r]=o,e}class i extends e{formatProps(e){return{delay:r,countdownTime:o,timeToPay:"payme.timeToPay",...super.formatProps(e)}}}a(i,"type",t.bcmc_mobile),a(i,"txVariants",[t.bcmc_mobile,t.bcmc_mobile_QR]);export{i as default};
2
2
  //# sourceMappingURL=BcmcMobile.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BcmcMobile.js","sources":["../../../../src/components/BcmcMobile/BcmcMobile.ts"],"sourcesContent":["import QRLoaderContainer from '../helpers/QRLoaderContainer/QRLoaderContainer';\nimport { STATUS_INTERVAL, COUNTDOWN_MINUTES } from './config';\nimport { TxVariants } from '../tx-variants';\n\nclass BCMCMobileElement extends QRLoaderContainer {\n public static type = TxVariants.bcmc_mobile;\n public static txVariants = [TxVariants.bcmc_mobile, TxVariants.bcmc_mobile_QR];\n\n formatProps(props) {\n const isMobile = window.matchMedia('(max-width: 768px)').matches && /Android|iPhone|iPod/.test(navigator.userAgent);\n\n return {\n delay: STATUS_INTERVAL,\n countdownTime: COUNTDOWN_MINUTES,\n buttonLabel: isMobile ? 'openApp' : 'generateQRCode',\n ...super.formatProps(props)\n };\n }\n}\n\nexport default BCMCMobileElement;\n"],"names":["BCMCMobileElement","QRLoaderContainer","static","TxVariants","bcmc_mobile","bcmc_mobile_QR","formatProps","props","isMobile","window","matchMedia","matches","test","navigator","userAgent","delay","STATUS_INTERVAL","countdownTime","COUNTDOWN_MINUTES","buttonLabel","super"],"mappings":"qLAIA,MAAMA,UAA0BC,EAC5BC,YAAqBC,EAAWC,YAChCF,kBAA2B,CAACC,EAAWC,YAAaD,EAAWE,gBAE/DC,WAAAA,CAAYC,GACR,MAAMC,EAAWC,OAAOC,WAAW,sBAAsBC,SAAW,sBAAsBC,KAAKC,UAAUC,WAEzG,MAAO,CACHC,MAAOC,EACPC,cAAeC,EACfC,YAAaX,EAAW,UAAY,oBACjCY,MAAMd,YAAYC,GAE7B"}
1
+ {"version":3,"file":"BcmcMobile.js","sources":["../../../../src/components/BcmcMobile/BcmcMobile.ts"],"sourcesContent":["import QRLoaderContainer from '../helpers/QRLoaderContainer/QRLoaderContainer';\nimport { STATUS_INTERVAL, COUNTDOWN_MINUTES } from './config';\nimport { TxVariants } from '../tx-variants';\n\nclass BCMCMobileElement extends QRLoaderContainer {\n public static type = TxVariants.bcmc_mobile;\n public static txVariants = [TxVariants.bcmc_mobile, TxVariants.bcmc_mobile_QR];\n\n formatProps(props) {\n return {\n delay: STATUS_INTERVAL,\n countdownTime: COUNTDOWN_MINUTES,\n timeToPay: 'payme.timeToPay',\n ...super.formatProps(props)\n };\n }\n}\n\nexport default BCMCMobileElement;\n"],"names":["BCMCMobileElement","QRLoaderContainer","formatProps","props","delay","STATUS_INTERVAL","countdownTime","COUNTDOWN_MINUTES","timeToPay","super","_define_property","type","TxVariants","bcmc_mobile","txVariants","bcmc_mobile_QR"],"mappings":"6SAIA,MAAMA,UAA0BC,EAI5BC,WAAAA,CAAYC,GACR,MAAO,CACHC,MAAOC,EACPC,cAAeC,EACfC,UAAW,qBACRC,MAAMP,YAAYC,GAE7B,EAVAO,EADEV,EACYW,OAAOC,EAAWC,aAChCH,EAFEV,EAEYc,aAAa,CAACF,EAAWC,YAAaD,EAAWG"}
@@ -1,2 +1,2 @@
1
- import s from"../helpers/IssuerListContainer/IssuerListContainer.js";import{TxVariants as r}from"../tx-variants.js";class t extends s{static type=r.billdesk_online;formatProps(s){return{...super.formatProps(s),showImage:!1}}}export{t as default};
1
+ import e from"../helpers/IssuerListContainer/IssuerListContainer.js";import{TxVariants as r}from"../tx-variants.js";class s extends e{formatProps(e){return{...super.formatProps(e),showImage:!1}}}var t,a,o;t=s,a="type",o=r.billdesk_online,a in t?Object.defineProperty(t,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[a]=o;export{s as default};
2
2
  //# sourceMappingURL=BillDeskOnline.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BillDeskOnline.js","sources":["../../../../src/components/BillDesk/BillDeskOnline.ts"],"sourcesContent":["import IssuerListContainer from '../helpers/IssuerListContainer/IssuerListContainer';\nimport { TxVariants } from '../tx-variants';\n\nclass BillDeskOnlineElement extends IssuerListContainer {\n public static type = TxVariants.billdesk_online;\n\n formatProps(props) {\n return {\n ...super.formatProps(props),\n showImage: false\n };\n }\n}\n\nexport default BillDeskOnlineElement;\n"],"names":["BillDeskOnlineElement","IssuerListContainer","static","TxVariants","billdesk_online","formatProps","props","super","showImage"],"mappings":"oHAGA,MAAMA,UAA8BC,EAChCC,YAAqBC,EAAWC,gBAEhCC,WAAAA,CAAYC,GACR,MAAO,IACAC,MAAMF,YAAYC,GACrBE,WAAW,EAEnB"}
1
+ {"version":3,"file":"BillDeskOnline.js","sources":["../../../../src/components/BillDesk/BillDeskOnline.ts"],"sourcesContent":["import IssuerListContainer from '../helpers/IssuerListContainer/IssuerListContainer';\nimport { TxVariants } from '../tx-variants';\n\nclass BillDeskOnlineElement extends IssuerListContainer {\n public static type = TxVariants.billdesk_online;\n\n formatProps(props) {\n return {\n ...super.formatProps(props),\n showImage: false\n };\n }\n}\n\nexport default BillDeskOnlineElement;\n"],"names":["BillDeskOnlineElement","IssuerListContainer","formatProps","props","super","showImage","type","TxVariants","billdesk_online"],"mappings":"oHAGA,MAAMA,UAA8BC,EAGhCC,WAAAA,CAAYC,GACR,MAAO,IACAC,MAAMF,YAAYC,GACrBE,WAAW,EAEnB,cAREL,IACYM,SAAOC,EAAWC"}
@@ -1,2 +1,2 @@
1
- import s from"../helpers/IssuerListContainer/IssuerListContainer.js";import{TxVariants as r}from"../tx-variants.js";class t extends s{static type=r.billdesk_wallet;formatProps(s){return{...super.formatProps(s),showImage:!1}}}export{t as default};
1
+ import e from"../helpers/IssuerListContainer/IssuerListContainer.js";import{TxVariants as r}from"../tx-variants.js";class s extends e{formatProps(e){return{...super.formatProps(e),showImage:!1}}}var t,a,o;t=s,a="type",o=r.billdesk_wallet,a in t?Object.defineProperty(t,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[a]=o;export{s as default};
2
2
  //# sourceMappingURL=BillDeskWallet.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BillDeskWallet.js","sources":["../../../../src/components/BillDesk/BillDeskWallet.ts"],"sourcesContent":["import IssuerListContainer from '../helpers/IssuerListContainer/IssuerListContainer';\nimport { TxVariants } from '../tx-variants';\n\nclass BillDeskWalletElement extends IssuerListContainer {\n public static type = TxVariants.billdesk_wallet;\n\n formatProps(props) {\n return {\n ...super.formatProps(props),\n showImage: false\n };\n }\n}\n\nexport default BillDeskWalletElement;\n"],"names":["BillDeskWalletElement","IssuerListContainer","static","TxVariants","billdesk_wallet","formatProps","props","super","showImage"],"mappings":"oHAGA,MAAMA,UAA8BC,EAChCC,YAAqBC,EAAWC,gBAEhCC,WAAAA,CAAYC,GACR,MAAO,IACAC,MAAMF,YAAYC,GACrBE,WAAW,EAEnB"}
1
+ {"version":3,"file":"BillDeskWallet.js","sources":["../../../../src/components/BillDesk/BillDeskWallet.ts"],"sourcesContent":["import IssuerListContainer from '../helpers/IssuerListContainer/IssuerListContainer';\nimport { TxVariants } from '../tx-variants';\n\nclass BillDeskWalletElement extends IssuerListContainer {\n public static type = TxVariants.billdesk_wallet;\n\n formatProps(props) {\n return {\n ...super.formatProps(props),\n showImage: false\n };\n }\n}\n\nexport default BillDeskWalletElement;\n"],"names":["BillDeskWalletElement","IssuerListContainer","formatProps","props","super","showImage","type","TxVariants","billdesk_wallet"],"mappings":"oHAGA,MAAMA,UAA8BC,EAGhCC,WAAAA,CAAYC,GACR,MAAO,IACAC,MAAMF,YAAYC,GACrBE,WAAW,EAEnB,cAREL,IACYM,SAAOC,EAAWC"}
@@ -1,2 +1,2 @@
1
- import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import o from"./components/BlikInput.js";import s from"../internal/Await/Await.js";import{CoreProvider as r}from"../../core/Context/CoreProvider.js";import i from"./config.js";import n from"../internal/RedirectButton/RedirectButton.js";import a from"../../core/Errors/SRPanelProvider.js";import{TxVariants as p}from"../tx-variants.js";class h extends e{static type=p.blik;formatData(){const t=!!this.props.storedPaymentMethodId;return{paymentMethod:{type:h.type,...!t&&{blikCode:this.state?.data?.blikCode},...t&&{storedPaymentMethodId:this.props.storedPaymentMethodId}}}}get isValid(){return!!this.props.storedPaymentMethodId||!!this.state.isValid}get displayName(){return this.props.storedPaymentMethodId&&this.props.label?this.props.label:this.props.name}get additionalInfo(){return this.props.storedPaymentMethodId&&this.props.label?this.props.name:null}render(){return this.props.paymentData?t(r,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},t(a,{srPanel:this.props.modules.srPanel},t(s,{ref:t=>{this.componentRef=t},clientKey:this.props.clientKey,paymentData:this.props.paymentData,onError:this.handleError,onComplete:this.onComplete,brandLogo:this.icon,type:i.type,messageText:this.props.i18n.get(i.messageTextId),awaitText:this.props.i18n.get(i.awaitTextId),showCountdownTimer:i.showCountdownTimer,delay:i.STATUS_INTERVAL,countdownTime:i.COUNTDOWN_MINUTES,throttleTime:i.THROTTLE_TIME,throttleInterval:i.THROTTLE_INTERVAL,onActionHandled:this.onActionHandled}))):t(r,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},this.props.storedPaymentMethodId?t(n,{showPayButton:this.props.showPayButton,name:this.displayName,amount:this.props.amount,payButton:this.payButton,onSubmit:this.submit,ref:t=>{this.componentRef=t}}):t(o,{ref:t=>{this.componentRef=t},...this.props,onChange:this.setState,onSubmit:this.submit,payButton:this.payButton}))}}export{h as default};
1
+ import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import o from"./components/BlikInput.js";import s from"../internal/Await/Await.js";import{CoreProvider as r}from"../../core/Context/CoreProvider.js";import i from"./config.js";import n from"../internal/RedirectButton/RedirectButton.js";import a from"../../core/Errors/SRPanelProvider.js";import{TxVariants as p}from"../tx-variants.js";class m extends e{formatData(){const t=!!this.props.storedPaymentMethodId;return{paymentMethod:{type:m.type,...!t&&{blikCode:this.state?.data?.blikCode},...t&&{storedPaymentMethodId:this.props.storedPaymentMethodId}}}}get isValid(){return!!this.props.storedPaymentMethodId||!!this.state.isValid}get displayName(){return this.props.storedPaymentMethodId&&this.props.label?this.props.label:this.props.name}get additionalInfo(){return this.props.storedPaymentMethodId&&this.props.label?this.props.name:null}render(){return this.props.paymentData?t(r,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},t(a,{srPanel:this.props.modules.srPanel},t(s,{ref:t=>{this.componentRef=t},clientKey:this.props.clientKey,paymentData:this.props.paymentData,onError:this.handleError,onComplete:this.onComplete,brandLogo:this.icon,type:i.type,messageText:this.props.i18n.get(i.messageTextId),awaitText:this.props.i18n.get(i.awaitTextId),showCountdownTimer:i.showCountdownTimer,delay:i.STATUS_INTERVAL,countdownTime:i.COUNTDOWN_MINUTES,throttleTime:i.THROTTLE_TIME,throttleInterval:i.THROTTLE_INTERVAL,onActionHandled:this.onActionHandled}))):t(r,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},this.props.storedPaymentMethodId?t(n,{showPayButton:this.props.showPayButton,name:this.displayName,amount:this.props.amount,payButton:this.payButton,onSubmit:this.submit,ref:t=>{this.componentRef=t}}):t(o,{ref:t=>{this.componentRef=t},...this.props,onChange:this.setState,onSubmit:this.submit,payButton:this.payButton}))}}var d,h,l;d=m,h="type",l=p.blik,h in d?Object.defineProperty(d,h,{value:l,enumerable:!0,configurable:!0,writable:!0}):d[h]=l;export{m as default};
2
2
  //# sourceMappingURL=Blik.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Blik.js","sources":["../../../../src/components/Blik/Blik.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport BlikInput from '../../components/Blik/components/BlikInput';\nimport Await from '../internal/Await';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport config from './config';\nimport RedirectButton from '../../components/internal/RedirectButton';\nimport SRPanelProvider from '../../core/Errors/SRPanelProvider';\nimport { TxVariants } from '../tx-variants';\nimport { AwaitConfiguration } from '../internal/Await/types';\n\ninterface BlikElementData {\n paymentMethod: {\n type: string;\n blikCode: string;\n };\n}\n\nclass BlikElement extends UIElement<AwaitConfiguration> {\n public static type = TxVariants.blik;\n\n formatData(): BlikElementData {\n const recurringPayment = !!this.props.storedPaymentMethodId;\n\n return {\n paymentMethod: {\n type: BlikElement.type,\n ...(!recurringPayment && { blikCode: this.state?.data?.blikCode }),\n ...(recurringPayment && { storedPaymentMethodId: this.props.storedPaymentMethodId })\n }\n };\n }\n\n get isValid(): boolean {\n if (this.props.storedPaymentMethodId) {\n return true;\n }\n\n return !!this.state.isValid;\n }\n\n get displayName() {\n if (this.props.storedPaymentMethodId && this.props.label) {\n return this.props.label;\n }\n return this.props.name;\n }\n\n get additionalInfo() {\n if (this.props.storedPaymentMethodId && this.props.label) {\n return this.props.name;\n }\n return null;\n }\n\n /**\n * NOTE: for future reference:\n * this.props.onComplete (which is called from this.onComplete) equates to the merchant defined onAdditionalDetails callback\n * (the initial /payments response defines an \"await\" action, actionTypes.ts translates this to \"onComplete: props.onAdditionalDetails\")\n */\n render() {\n if (this.props.paymentData) {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <SRPanelProvider srPanel={this.props.modules.srPanel}>\n <Await\n ref={ref => {\n this.componentRef = ref;\n }}\n clientKey={this.props.clientKey}\n paymentData={this.props.paymentData}\n onError={this.handleError}\n onComplete={this.onComplete}\n brandLogo={this.icon}\n type={config.type}\n messageText={this.props.i18n.get(config.messageTextId)}\n awaitText={this.props.i18n.get(config.awaitTextId)}\n showCountdownTimer={config.showCountdownTimer}\n delay={config.STATUS_INTERVAL}\n countdownTime={config.COUNTDOWN_MINUTES}\n throttleTime={config.THROTTLE_TIME}\n throttleInterval={config.THROTTLE_INTERVAL}\n onActionHandled={this.onActionHandled}\n />\n </SRPanelProvider>\n </CoreProvider>\n );\n }\n\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n {this.props.storedPaymentMethodId ? (\n <RedirectButton\n showPayButton={this.props.showPayButton}\n name={this.displayName}\n amount={this.props.amount}\n payButton={this.payButton}\n onSubmit={this.submit}\n ref={ref => {\n this.componentRef = ref;\n }}\n />\n ) : (\n <BlikInput\n // @ts-ignore Ref is used by preact component\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n onChange={this.setState}\n onSubmit={this.submit}\n payButton={this.payButton}\n />\n )}\n </CoreProvider>\n );\n }\n}\n\nexport default BlikElement;\n"],"names":["BlikElement","UIElement","static","TxVariants","blik","formatData","recurringPayment","this","props","storedPaymentMethodId","paymentMethod","type","blikCode","state","data","isValid","displayName","label","name","additionalInfo","render","paymentData","h","CoreProvider","i18n","loadingContext","resources","SRPanelProvider","srPanel","modules","Await","ref","componentRef","clientKey","onError","handleError","onComplete","brandLogo","icon","config","messageText","get","messageTextId","awaitText","awaitTextId","showCountdownTimer","delay","STATUS_INTERVAL","countdownTime","COUNTDOWN_MINUTES","throttleTime","THROTTLE_TIME","throttleInterval","THROTTLE_INTERVAL","onActionHandled","RedirectButton","showPayButton","amount","payButton","onSubmit","submit","BlikInput","onChange","setState"],"mappings":"mdAkBA,MAAMA,UAAoBC,EACtBC,YAAqBC,EAAWC,KAEhCC,UAAAA,GACI,MAAMC,IAAqBC,KAAKC,MAAMC,sBAEtC,MAAO,CACHC,cAAe,CACXC,KAAMX,EAAYW,SACbL,GAAoB,CAAEM,SAAUL,KAAKM,OAAOC,MAAMF,aACnDN,GAAoB,CAAEG,sBAAuBF,KAAKC,MAAMC,wBAGxE,CAEA,WAAIM,GACA,QAAIR,KAAKC,MAAMC,yBAINF,KAAKM,MAAME,OACxB,CAEA,eAAIC,GACA,OAAIT,KAAKC,MAAMC,uBAAyBF,KAAKC,MAAMS,MACxCV,KAAKC,MAAMS,MAEfV,KAAKC,MAAMU,IACtB,CAEA,kBAAIC,GACA,OAAIZ,KAAKC,MAAMC,uBAAyBF,KAAKC,MAAMS,MACxCV,KAAKC,MAAMU,KAEf,IACX,CAOAE,MAAAA,GACI,OAAIb,KAAKC,MAAMa,YAEPC,EAACC,EAAAA,CAAaC,KAAMjB,KAAKC,MAAMgB,KAAMC,eAAgBlB,KAAKC,MAAMiB,eAAgBC,UAAWnB,KAAKmB,WAC5FJ,EAACK,EAAAA,CAAgBC,QAASrB,KAAKC,MAAMqB,QAAQD,SACzCN,EAACQ,EAAAA,CACGC,IAAKA,IACDxB,KAAKyB,aAAeD,CAAAA,EAExBE,UAAW1B,KAAKC,MAAMyB,UACtBZ,YAAad,KAAKC,MAAMa,YACxBa,QAAS3B,KAAK4B,YACdC,WAAY7B,KAAK6B,WACjBC,UAAW9B,KAAK+B,KAChB3B,KAAM4B,EAAO5B,KACb6B,YAAajC,KAAKC,MAAMgB,KAAKiB,IAAIF,EAAOG,eACxCC,UAAWpC,KAAKC,MAAMgB,KAAKiB,IAAIF,EAAOK,aACtCC,mBAAoBN,EAAOM,mBAC3BC,MAAOP,EAAOQ,gBACdC,cAAeT,EAAOU,kBACtBC,aAAcX,EAAOY,cACrBC,iBAAkBb,EAAOc,kBACzBC,gBAAiB/C,KAAK+C,oBAQtChC,EAACC,EAAAA,CAAaC,KAAMjB,KAAKC,MAAMgB,KAAMC,eAAgBlB,KAAKC,MAAMiB,eAAgBC,UAAWnB,KAAKmB,WAC3FnB,KAAKC,MAAMC,sBACRa,EAACiC,EAAAA,CACGC,cAAejD,KAAKC,MAAMgD,cAC1BtC,KAAMX,KAAKS,YACXyC,OAAQlD,KAAKC,MAAMiD,OACnBC,UAAWnD,KAAKmD,UAChBC,SAAUpD,KAAKqD,OACf7B,IAAKA,IACDxB,KAAKyB,aAAeD,CAAAA,IAI5BT,EAACuC,EAAAA,CAEG9B,IAAKA,IACDxB,KAAKyB,aAAeD,CAAAA,KAEpBxB,KAAKC,MACTsD,SAAUvD,KAAKwD,SACfJ,SAAUpD,KAAKqD,OACfF,UAAWnD,KAAKmD,YAKpC"}
1
+ {"version":3,"file":"Blik.js","sources":["../../../../src/components/Blik/Blik.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport BlikInput from '../../components/Blik/components/BlikInput';\nimport Await from '../internal/Await';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport config from './config';\nimport RedirectButton from '../../components/internal/RedirectButton';\nimport SRPanelProvider from '../../core/Errors/SRPanelProvider';\nimport { TxVariants } from '../tx-variants';\nimport { AwaitConfiguration } from '../internal/Await/types';\n\ninterface BlikElementData {\n paymentMethod: {\n type: string;\n blikCode: string;\n };\n}\n\nclass BlikElement extends UIElement<AwaitConfiguration> {\n public static type = TxVariants.blik;\n\n formatData(): BlikElementData {\n const recurringPayment = !!this.props.storedPaymentMethodId;\n\n return {\n paymentMethod: {\n type: BlikElement.type,\n ...(!recurringPayment && { blikCode: this.state?.data?.blikCode }),\n ...(recurringPayment && { storedPaymentMethodId: this.props.storedPaymentMethodId })\n }\n };\n }\n\n get isValid(): boolean {\n if (this.props.storedPaymentMethodId) {\n return true;\n }\n\n return !!this.state.isValid;\n }\n\n get displayName() {\n if (this.props.storedPaymentMethodId && this.props.label) {\n return this.props.label;\n }\n return this.props.name;\n }\n\n get additionalInfo() {\n if (this.props.storedPaymentMethodId && this.props.label) {\n return this.props.name;\n }\n return null;\n }\n\n /**\n * NOTE: for future reference:\n * this.props.onComplete (which is called from this.onComplete) equates to the merchant defined onAdditionalDetails callback\n * (the initial /payments response defines an \"await\" action, actionTypes.ts translates this to \"onComplete: props.onAdditionalDetails\")\n */\n render() {\n if (this.props.paymentData) {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <SRPanelProvider srPanel={this.props.modules.srPanel}>\n <Await\n ref={ref => {\n this.componentRef = ref;\n }}\n clientKey={this.props.clientKey}\n paymentData={this.props.paymentData}\n onError={this.handleError}\n onComplete={this.onComplete}\n brandLogo={this.icon}\n type={config.type}\n messageText={this.props.i18n.get(config.messageTextId)}\n awaitText={this.props.i18n.get(config.awaitTextId)}\n showCountdownTimer={config.showCountdownTimer}\n delay={config.STATUS_INTERVAL}\n countdownTime={config.COUNTDOWN_MINUTES}\n throttleTime={config.THROTTLE_TIME}\n throttleInterval={config.THROTTLE_INTERVAL}\n onActionHandled={this.onActionHandled}\n />\n </SRPanelProvider>\n </CoreProvider>\n );\n }\n\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n {this.props.storedPaymentMethodId ? (\n <RedirectButton\n showPayButton={this.props.showPayButton}\n name={this.displayName}\n amount={this.props.amount}\n payButton={this.payButton}\n onSubmit={this.submit}\n ref={ref => {\n this.componentRef = ref;\n }}\n />\n ) : (\n <BlikInput\n // @ts-ignore Ref is used by preact component\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n onChange={this.setState}\n onSubmit={this.submit}\n payButton={this.payButton}\n />\n )}\n </CoreProvider>\n );\n }\n}\n\nexport default BlikElement;\n"],"names":["BlikElement","UIElement","formatData","recurringPayment","this","props","storedPaymentMethodId","paymentMethod","type","blikCode","state","data","isValid","displayName","label","name","additionalInfo","render","paymentData","h","CoreProvider","i18n","loadingContext","resources","SRPanelProvider","srPanel","modules","Await","ref","componentRef","clientKey","onError","handleError","onComplete","brandLogo","icon","config","messageText","get","messageTextId","awaitText","awaitTextId","showCountdownTimer","delay","STATUS_INTERVAL","countdownTime","COUNTDOWN_MINUTES","throttleTime","THROTTLE_TIME","throttleInterval","THROTTLE_INTERVAL","onActionHandled","RedirectButton","showPayButton","amount","payButton","onSubmit","submit","BlikInput","onChange","setState","TxVariants","blik"],"mappings":"mdAkBA,MAAMA,UAAoBC,EAGtBC,UAAAA,GACI,MAAMC,IAAqBC,KAAKC,MAAMC,sBAEtC,MAAO,CACHC,cAAe,CACXC,KAAMR,EAAYQ,SACbL,GAAoB,CAAEM,SAAUL,KAAKM,OAAOC,MAAMF,aACnDN,GAAoB,CAAEG,sBAAuBF,KAAKC,MAAMC,wBAGxE,CAEA,WAAIM,GACA,QAAIR,KAAKC,MAAMC,yBAINF,KAAKM,MAAME,OACxB,CAEA,eAAIC,GACA,OAAIT,KAAKC,MAAMC,uBAAyBF,KAAKC,MAAMS,MACxCV,KAAKC,MAAMS,MAEfV,KAAKC,MAAMU,IACtB,CAEA,kBAAIC,GACA,OAAIZ,KAAKC,MAAMC,uBAAyBF,KAAKC,MAAMS,M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SAAOqD,EAAWC"}
@@ -1,2 +1,2 @@
1
- import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import o from"./components/BoletoInput/BoletoInput.js";import{cleanCPFCNPJ as r}from"../internal/SocialSecurityNumberBrazil/utils.js";import s from"./components/BoletoVoucherResult/BoletoVoucherResult.js";import{CoreProvider as i}from"../../core/Context/CoreProvider.js";import{TxVariants as a}from"../tx-variants.js";class n extends e{static type=a.boletobancario;static txVariants=[a.boletobancario,a.boletobancario_itau,a.boletobancario_santander,a.primeiropay_boleto];get isValid(){return!!this.state.isValid}formatData(){const{data:t={}}=this.state,{billingAddress:e,shopperEmail:o,firstName:s,lastName:i,socialSecurityNumber:a=""}=t;return{paymentMethod:{type:this.type},...e&&{billingAddress:e},...o&&{shopperEmail:o},...s&&i&&{shopperName:{firstName:s,lastName:i}},...a&&{socialSecurityNumber:r(a)}}}handleRef=t=>{this.componentRef=t};render(){return t(i,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},this.props.reference?t(s,{ref:this.handleRef,icon:this.icon,...this.props,onActionHandled:this.onActionHandled}):t(o,{setComponentRef:this.handleRef,...this.props,onChange:this.setState,onSubmit:this.submit,payButton:this.payButton}))}}export{n as BoletoElement,n as default};
1
+ import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import o from"./components/BoletoInput/BoletoInput.js";import{cleanCPFCNPJ as r}from"../internal/SocialSecurityNumberBrazil/utils.js";import i from"./components/BoletoVoucherResult/BoletoVoucherResult.js";import{CoreProvider as s}from"../../core/Context/CoreProvider.js";import{TxVariants as n}from"../tx-variants.js";function a(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}class l extends e{get isValid(){return!!this.state.isValid}formatData(){const{data:t={}}=this.state,{billingAddress:e,shopperEmail:o,firstName:i,lastName:s,socialSecurityNumber:n=""}=t;return{paymentMethod:{type:this.type},...e&&{billingAddress:e},...o&&{shopperEmail:o},...i&&s&&{shopperName:{firstName:i,lastName:s}},...n&&{socialSecurityNumber:r(n)}}}render(){return t(s,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},this.props.reference?t(i,{ref:this.handleRef,icon:this.icon,...this.props,onActionHandled:this.onActionHandled}):t(o,{setComponentRef:this.handleRef,...this.props,onChange:this.setState,onSubmit:this.submit,payButton:this.payButton}))}constructor(...t){super(...t),a(this,"handleRef",(t=>{this.componentRef=t}))}}a(l,"type",n.boletobancario),a(l,"txVariants",[n.boletobancario,n.boletobancario_itau,n.boletobancario_santander,n.primeiropay_boleto]);export{l as BoletoElement,l as default};
2
2
  //# sourceMappingURL=Boleto.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Boleto.js","sources":["../../../../src/components/Boleto/Boleto.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport BoletoInput from './components/BoletoInput';\nimport { cleanCPFCNPJ } from '../internal/SocialSecurityNumberBrazil/utils';\nimport BoletoVoucherResult from './components/BoletoVoucherResult';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport { TxVariants } from '../tx-variants';\nimport { VoucherConfiguration } from '../internal/Voucher/types';\n\nexport class BoletoElement extends UIElement<VoucherConfiguration> {\n public static type = TxVariants.boletobancario;\n\n public static txVariants = [\n TxVariants.boletobancario,\n TxVariants.boletobancario_itau,\n TxVariants.boletobancario_santander,\n TxVariants.primeiropay_boleto\n ];\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n /**\n * Formats the component data output\n */\n formatData() {\n const { data = {} } = this.state;\n const { billingAddress, shopperEmail, firstName, lastName, socialSecurityNumber = '' } = data;\n\n return {\n paymentMethod: {\n type: this.type\n },\n ...(billingAddress && { billingAddress }),\n ...(shopperEmail && { shopperEmail }),\n ...(firstName && lastName && { shopperName: { firstName, lastName } }),\n ...(socialSecurityNumber && { socialSecurityNumber: cleanCPFCNPJ(socialSecurityNumber) })\n };\n }\n\n private handleRef = ref => {\n this.componentRef = ref;\n };\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n {this.props.reference ? (\n <BoletoVoucherResult ref={this.handleRef} icon={this.icon} {...this.props} onActionHandled={this.onActionHandled} />\n ) : (\n <BoletoInput\n setComponentRef={this.handleRef}\n {...this.props}\n onChange={this.setState}\n onSubmit={this.submit}\n payButton={this.payButton}\n />\n )}\n </CoreProvider>\n );\n }\n}\n\nexport default BoletoElement;\n"],"names":["BoletoElement","UIElement","static","TxVariants","boletobancario","boletobancario_itau","boletobancario_santander","primeiropay_boleto","isValid","this","state","formatData","data","billingAddress","shopperEmail","firstName","lastName","socialSecurityNumber","paymentMethod","type","shopperName","cleanCPFCNPJ","handleRef","ref","componentRef","render","h","CoreProvider","i18n","props","loadingContext","resources","reference","BoletoVoucherResult","icon","onActionHandled","BoletoInput","setComponentRef","onChange","setState","onSubmit","submit","payButton"],"mappings":"kcASO,MAAMA,UAAsBC,EAC/BC,YAAqBC,EAAWC,eAEhCF,kBAA2B,CACvBC,EAAWC,eACXD,EAAWE,oBACXF,EAAWG,yBACXH,EAAWI,oBAGf,WAAIC,GACA,QAASC,KAAKC,MAAMF,OACxB,CAKAG,UAAAA,GACI,MAAMC,KAAEA,EAAO,CAAA,GAAOH,KAAKC,OACrBG,eAAEA,EAAcC,aAAEA,EAAYC,UAAEA,EAASC,SAAEA,EAAQC,qBAAEA,EAAuB,IAAOL,EAEzF,MAAO,CACHM,cAAe,CACXC,KAAMV,KAAKU,SAEXN,GAAkB,CAAEA,qBACpBC,GAAgB,CAAEA,mBAClBC,GAAaC,GAAY,CAAEI,YAAa,CAAEL,YAAWC,gBACrDC,GAAwB,CAAEA,qBAAsBI,EAAaJ,IAEzE,CAEQK,UAAYC,IAChBd,KAAKe,aAAeD,CAAAA,EAGxBE,MAAAA,GACI,OACIC,EAACC,EAAAA,CAAaC,KAAMnB,KAAKoB,MAAMD,KAAME,eAAgBrB,KAAKoB,MAAMC,eAAgBC,UAAWtB,KAAKsB,WAC3FtB,KAAKoB,MAAMG,UACRN,EAACO,EAAAA,CAAoBV,IAAKd,KAAKa,UAAWY,KAAMzB,KAAKyB,QAAUzB,KAAKoB,MAAOM,gBAAiB1B,KAAK0B,kBAEjGT,EAACU,EAAAA,CACGC,gBAAiB5B,KAAKa,aAClBb,KAAKoB,MACTS,SAAU7B,KAAK8B,SACfC,SAAU/B,KAAKgC,OACfC,UAAWjC,KAAKiC,YAKpC"}
1
+ {"version":3,"file":"Boleto.js","sources":["../../../../src/components/Boleto/Boleto.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport BoletoInput from './components/BoletoInput';\nimport { cleanCPFCNPJ } from '../internal/SocialSecurityNumberBrazil/utils';\nimport BoletoVoucherResult from './components/BoletoVoucherResult';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport { TxVariants } from '../tx-variants';\nimport { VoucherConfiguration } from '../internal/Voucher/types';\n\nexport class BoletoElement extends UIElement<VoucherConfiguration> {\n public static type = TxVariants.boletobancario;\n\n public static txVariants = [\n TxVariants.boletobancario,\n TxVariants.boletobancario_itau,\n TxVariants.boletobancario_santander,\n TxVariants.primeiropay_boleto\n ];\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n /**\n * Formats the component data output\n */\n formatData() {\n const { data = {} } = this.state;\n const { billingAddress, shopperEmail, firstName, lastName, socialSecurityNumber = '' } = data;\n\n return {\n paymentMethod: {\n type: this.type\n },\n ...(billingAddress && { billingAddress }),\n ...(shopperEmail && { shopperEmail }),\n ...(firstName && lastName && { shopperName: { firstName, lastName } }),\n ...(socialSecurityNumber && { socialSecurityNumber: cleanCPFCNPJ(socialSecurityNumber) })\n };\n }\n\n private handleRef = ref => {\n this.componentRef = ref;\n };\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n {this.props.reference ? (\n <BoletoVoucherResult ref={this.handleRef} icon={this.icon} {...this.props} onActionHandled={this.onActionHandled} />\n ) : (\n <BoletoInput\n setComponentRef={this.handleRef}\n {...this.props}\n onChange={this.setState}\n onSubmit={this.submit}\n payButton={this.payButton}\n />\n )}\n </CoreProvider>\n );\n }\n}\n\nexport default BoletoElement;\n"],"names":["BoletoElement","UIElement","isValid","this","state","formatData","data","billingAddress","shopperEmail","firstName","lastName","socialSecurityNumber","paymentMethod","type","shopperName","cleanCPFCNPJ","render","h","CoreProvider","i18n","props","loadingContext","resources","reference","BoletoVoucherResult","ref","handleRef","icon","onActionHandled","BoletoInput","setComponentRef","onChange","setState","onSubmit","submit","payButton","_define_property","componentRef","TxVariants","boletobancario","txVariants","boletobancario_itau","boletobancario_santander","primeiropay_boleto"],"mappings":"0jBASO,MAAMA,UAAsBC,EAU/B,WAAIC,GACA,QAASC,KAAKC,MAAMF,OACxB,CAKAG,UAAAA,GACI,MAAMC,KAAEA,EAAO,CAAA,GAAOH,KAAKC,OACrBG,eAAEA,EAAcC,aAAEA,EAAYC,UAAEA,EAASC,SAAEA,EAAQC,qBAAEA,EAAuB,IAAOL,EAEzF,MAAO,CACHM,cAAe,CACXC,KAAMV,KAAKU,SAEXN,GAAkB,CAAEA,qBACpBC,GAAgB,CAAEA,mBAClBC,GAAaC,GAAY,CAAEI,YAAa,CAAEL,YAAWC,gBACrDC,GAAwB,CAAEA,qBAAsBI,EAAaJ,IAEzE,CAMAK,MAAAA,GACI,OACIC,EAACC,EAAAA,CAAaC,KAAMhB,KAAKiB,MAAMD,KAAME,eAAgBlB,KAAKiB,MAAMC,eAAgBC,UAAWnB,KAAKmB,WAC3FnB,KAAKiB,MAAMG,UACRN,EAACO,EAAAA,CAAoBC,IAAKtB,KAAKuB,UAAWC,KAAMxB,KAAKwB,QAAUxB,KAAKiB,MAAOQ,gBAAiBzB,KAAKyB,kBAEjGX,EAACY,EAAAA,CACGC,gBAAiB3B,KAAKuB,aAClBvB,KAAKiB,MACTW,SAAU5B,KAAK6B,SACfC,SAAU9B,KAAK+B,OACfC,UAAWhC,KAAKgC,YAKpC,+BApBAC,EAAAjC,KAAQuB,aAAYD,IAChBtB,KAAKkC,aAAeZ,CAAAA,KAhCxBW,EADSpC,EACKa,OAAOyB,EAAWC,gBAEhCH,EAHSpC,EAGKwC,aAAa,CACvBF,EAAWC,eACXD,EAAWG,oBACXH,EAAWI,yBACXJ,EAAWK"}
@@ -1,2 +1,2 @@
1
- import{CardElement as t}from"./Card.js";import{CVC_POLICY_HIDDEN as r}from"../internal/SecuredFields/lib/constants.js";import{TxVariants as s}from"../tx-variants.js";class o extends t{static type=s.bcmc;constructor(t,r){super(t,r)}static defaultProps={...t.defaultProps,brands:["bcmc","maestro","visa"]};formatData(){const t=super.formatData();return t.paymentMethod.type=this.constructor.type,t}formatProps(t){return{...super.formatProps(t),type:s.bcmc,brand:s.bcmc,cvcPolicy:r}}onBrand=t=>{this.props.onBrand&&this.props.onBrand(t)}}export{o as default};
1
+ import{CardElement as r}from"./Card.js";import{CVC_POLICY_HIDDEN as t}from"../internal/SecuredFields/lib/constants.js";import{TxVariants as e}from"../tx-variants.js";function o(r,t,e){return t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}class a extends r{formatData(){const r=super.formatData();return r.paymentMethod.type=this.constructor.type,r}formatProps(r){return{...super.formatProps(r),type:e.bcmc,brand:e.bcmc,cvcPolicy:t}}constructor(r,t){super(r,t),o(this,"onBrand",(r=>{this.props.onBrand&&this.props.onBrand(r)}))}}o(a,"type",e.bcmc),o(a,"defaultProps",{...r.defaultProps,brands:["bcmc","maestro","visa"]});export{a as default};
2
2
  //# sourceMappingURL=Bancontact.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Bancontact.js","sources":["../../../../src/components/Card/Bancontact.ts"],"sourcesContent":["import { CardElement } from './Card';\nimport { CardElementData, CardConfiguration } from './types';\nimport { CVC_POLICY_HIDDEN } from '../internal/SecuredFields/lib/constants';\nimport { TxVariants } from '../tx-variants';\nimport type { ICore } from '../../core/types';\n\nclass BancontactElement extends CardElement {\n public static type = TxVariants.bcmc;\n\n constructor(checkout: ICore, props?: CardConfiguration) {\n super(checkout, props);\n }\n\n protected static defaultProps = {\n ...CardElement.defaultProps,\n brands: ['bcmc', 'maestro', 'visa']\n };\n\n formatData(): CardElementData {\n const data = super.formatData();\n data.paymentMethod.type = this.constructor['type'];\n return data;\n }\n\n /**\n * Now that the Bancontact (BCMC) Card component can accept a number dual branded with Visa (which requires a CVC) it has to be handled differently\n * at creation time (no automatic removing of the CVC securedField).\n * At the same time we can't treat it as a regular 'card' component - because it needs to hide the CVC field at at startup,\n * as well as show the BCMC logo in the number field and ignore any of the internal, regEx driven, brand detection.\n */\n formatProps(props: CardConfiguration) {\n return {\n ...super.formatProps(props),\n /**\n * Force type (only for the Dropin is type automatically set to 'bcmc')\n * - this will bypass the regEx brand detection that SF normally tries to carry out when the first few digits are entered in the PAN\n */\n type: TxVariants.bcmc,\n brand: TxVariants.bcmc,\n cvcPolicy: CVC_POLICY_HIDDEN\n };\n }\n\n // Disable internal event.emit() for Bancontact\n public onBrand = event => {\n if (this.props.onBrand) this.props.onBrand(event);\n };\n}\n\nexport default BancontactElement;\n"],"names":["BancontactElement","CardElement","static","TxVariants","bcmc","constructor","checkout","props","super","defaultProps","brands","formatData","data","paymentMethod","type","this","formatProps","brand","cvcPolicy","CVC_POLICY_HIDDEN","onBrand","event"],"mappings":"sKAMA,MAAMA,UAA0BC,EAC5BC,YAAqBC,EAAWC,KAEhCC,WAAAA,CAAYC,EAAiBC,GACzBC,MAAMF,EAAUC,EACpB,CAEAL,oBAAgC,IACzBD,EAAYQ,aACfC,OAAQ,CAAC,OAAQ,UAAW,SAGhCC,UAAAA,GACI,MAAMC,EAAOJ,MAAMG,aAEnB,OADAC,EAAKC,cAAcC,KAAOC,KAAKV,YAAmB,KAC3CO,CACX,CAQAI,WAAAA,CAAYT,GACR,MAAO,IACAC,MAAMQ,YAAYT,GAKrBO,KAAMX,EAAWC,KACjBa,MAAOd,EAAWC,KAClBc,UAAWC,EAEnB,CAGOC,QAAUC,IACTN,KAAKR,MAAMa,SAASL,KAAKR,MAAMa,QAAQC,EAAAA"}
1
+ {"version":3,"file":"Bancontact.js","sources":["../../../../src/components/Card/Bancontact.ts"],"sourcesContent":["import { CardElement } from './Card';\nimport { CardElementData, CardConfiguration } from './types';\nimport { CVC_POLICY_HIDDEN } from '../internal/SecuredFields/lib/constants';\nimport { TxVariants } from '../tx-variants';\nimport type { ICore } from '../../core/types';\n\nclass BancontactElement extends CardElement {\n public static type = TxVariants.bcmc;\n\n constructor(checkout: ICore, props?: CardConfiguration) {\n super(checkout, props);\n }\n\n protected static defaultProps = {\n ...CardElement.defaultProps,\n brands: ['bcmc', 'maestro', 'visa']\n };\n\n formatData(): CardElementData {\n const data = super.formatData();\n data.paymentMethod.type = this.constructor['type'];\n return data;\n }\n\n /**\n * Now that the Bancontact (BCMC) Card component can accept a number dual branded with Visa (which requires a CVC) it has to be handled differently\n * at creation time (no automatic removing of the CVC securedField).\n * At the same time we can't treat it as a regular 'card' component - because it needs to hide the CVC field at at startup,\n * as well as show the BCMC logo in the number field and ignore any of the internal, regEx driven, brand detection.\n */\n formatProps(props: CardConfiguration) {\n return {\n ...super.formatProps(props),\n /**\n * Force type (only for the Dropin is type automatically set to 'bcmc')\n * - this will bypass the regEx brand detection that SF normally tries to carry out when the first few digits are entered in the PAN\n */\n type: TxVariants.bcmc,\n brand: TxVariants.bcmc,\n cvcPolicy: CVC_POLICY_HIDDEN\n };\n }\n\n // Disable internal event.emit() for Bancontact\n public onBrand = event => {\n if (this.props.onBrand) this.props.onBrand(event);\n };\n}\n\nexport default BancontactElement;\n"],"names":["BancontactElement","CardElement","formatData","data","super","paymentMethod","type","this","constructor","formatProps","props","TxVariants","bcmc","brand","cvcPolicy","CVC_POLICY_HIDDEN","checkout","_define_property","onBrand","event","defaultProps","brands"],"mappings":"8RAMA,MAAMA,UAA0BC,EAY5BC,UAAAA,GACI,MAAMC,EAAOC,MAAMF,aAEnB,OADAC,EAAKE,cAAcC,KAAOC,KAAKC,YAAmB,KAC3CL,CACX,CAQAM,WAAAA,CAAYC,GACR,MAAO,IACAN,MAAMK,YAAYC,GAKrBJ,KAAMK,EAAWC,KACjBC,MAAOF,EAAWC,KAClBE,UAAWC,EAEnB,CAhCAP,WAAAA,CAAYQ,EAAiBN,GACzBN,MAAMY,EAAUN,GAkCpBO,EAAAV,KAAOW,WAAUC,IACTZ,KAAKG,MAAMQ,SAASX,KAAKG,MAAMQ,QAAQC,EAAAA,GAlC/C,EAJAF,EADEjB,EACYM,OAAOK,EAAWC,MAMhCK,EAPEjB,EAOeoB,eAAe,IACzBnB,EAAYmB,aACfC,OAAQ,CAAC,OAAQ,UAAW"}
@@ -1,2 +1,2 @@
1
- import{createElement as t}from"../../external/preact/dist/preact.js";import o from"./components/CardInput/CardInput.js";import{CoreProvider as e}from"../../core/Context/CoreProvider.js";import s from"../../utils/browserInfo.js";import r from"../internal/SecuredFields/binLookup/triggerBinLookUp.js";import{fieldTypeToSnakeCase as i}from"../internal/SecuredFields/utils.js";import{reject as n}from"../../utils/commonUtils.js";import{hasValidInstallmentsObject as a}from"./components/CardInput/utils.js";import p from"../internal/ClickToPay/services/create-clicktopay-service.js";import c from"./components/ClickToPayWrapper.js";import l from"../../core/Errors/SRPanelProvider.js";import{TxVariants as d}from"../tx-variants.js";import{UIElement as u}from"../internal/UIElement/UIElement.js";import h from"../internal/PayButton/PayButton.js";import{ANALYTICS_RENDERED_STR as m,ANALYTICS_CONFIGURED_STR as y,ANALYTICS_FOCUS_STR as f,ANALYTICS_UNFOCUS_STR as b,ANALYTICS_VALIDATION_ERROR_STR as g}from"../../core/Analytics/constants.js";import{ALL_SECURED_FIELDS as C}from"../internal/SecuredFields/lib/constants.js";import{hasOwnProperty as P}from"../../utils/hasOwnProperty.js";import S,{IMPLEMENTATION_ERROR as k}from"../../core/Errors/AdyenCheckoutError.js";import{getErrorMessageFromCode as T}from"../../core/Errors/utils.js";import{SF_ErrorCodes as R}from"../../core/Errors/constants.js";import B from"./components/CardInput/defaultProps.js";class I extends u{static type=d.scheme;clickToPayService;clickToPayRef=null;constructor(t,o){super(t,o),o&&!o._disableClickToPay&&(this.clickToPayService=p(this.props.configuration,this.props.clickToPayConfiguration,this.props.environment),this.clickToPayService?.initialize())}static defaultProps={showFormInstruction:!0,_disableClickToPay:!1,doBinLookup:!0,...n(["type","setComponentRef"]).from(B)};setStatus(t,o){return this.componentRef?.setStatus&&this.componentRef.setStatus(t,o),this.clickToPayRef?.setStatus&&this.clickToPayRef.setStatus(t,o),this}setClickToPayRef=t=>{this.clickToPayRef=t};formatProps(t){const o=t.session?.configuration?.enableStoreDetails??t.enableStoreDetails,e=!(0===t.amount?.value)&&o,s=t.storedPaymentMethodId||t.id,r=s&&t?.supportedShopperInteractions?.includes("Ecommerce");if(s&&!r)throw new S(k,"You are trying to create a storedCard from a stored PM that does not support Ecommerce interactions");return{...t,holderNameRequired:!!t.hasHolderName&&t.holderNameRequired,hasCVC:!(t.brand&&"bcmc"===t.brand||t.hideCVC),billingAddressRequired:!t.storedPaymentMethodId&&t.billingAddressRequired,billingAddressMode:t.onAddressLookup?B.billingAddressMode:t.billingAddressMode,brand:t.brand??d.card,countryCode:t.countryCode?t.countryCode.toLowerCase():null,configuration:{...t.configuration,socialSecurityNumberMode:t.configuration?.socialSecurityNumberMode??"auto"},brandsConfiguration:t.brandsConfiguration||t.configuration?.brandsConfiguration||{},icon:t.icon||t.configuration?.icon,installmentOptions:t.session?.configuration?.installmentOptions||t.installmentOptions,enableStoreDetails:o,showStoreDetailsCheckbox:e,clickToPayConfiguration:{...t.clickToPayConfiguration,disableOtpAutoFocus:t.clickToPayConfiguration?.disableOtpAutoFocus||!1,shopperEmail:t.clickToPayConfiguration?.shopperEmail||this.core.options?.session?.shopperEmail,telephoneNumber:t.clickToPayConfiguration?.telephoneNumber||this.core.options?.session?.telephoneNumber,locale:t.clickToPayConfiguration?.locale||t.i18n?.locale?.replace("-","_")},...s&&{storedPaymentMethodId:s}}}formatData(){const t=this.state.selectedBrandValue;return{paymentMethod:{type:I.type,...this.state.data,...this.props.storedPaymentMethodId&&{storedPaymentMethodId:this.props.storedPaymentMethodId,holderName:this.props.holderName??""},...t&&{brand:t},...this.props.fundingSource&&{fundingSource:this.props.fundingSource}},...this.state.billingAddress&&{billingAddress:this.state.billingAddress},...this.state.socialSecurityNumber&&{socialSecurityNumber:this.state.socialSecurityNumber},...this.storePaymentMethodPayload,...a(this.state.installments)&&{installments:this.state.installments},browserInfo:this.browserInfo,origin:!!window&&window.location.origin}}updateStyles(t){return this.componentRef?.updateStyles&&this.componentRef.updateStyles(t),this}setFocusOn(t){return this.componentRef?.setFocusOn&&this.componentRef.setFocusOn(t),this}onBrand=t=>{this.props.onBrand?.(t)};processBinLookupResponse(t,o=!1){return this.componentRef?.processBinLookupResponse&&this.componentRef.processBinLookupResponse(t,o),this}handleUnsupportedCard(t){return this.componentRef?.handleUnsupportedCard&&this.componentRef.handleUnsupportedCard(t),this}handleClickToPaySubmit=t=>{this.setState({data:{...t},valid:{},errors:{},isValid:!0}),this.submit()};onBinLookup(t){if(!t.isReset){const o=n("supportedBrandsRaw").from(t);this.props.onBinLookup?.(o)}}submitAnalytics(t){const{type:o}=t;o!==m&&o!==y||"scheme"===this.constructor.type&&P(this.props,"supportedShopperInteractions")&&(t.isStoredPaymentMethod=!0,t.brand=this.props.brand),super.submitAnalytics(t,this.props)}onConfigSuccess=t=>{this.submitAnalytics({type:y}),this.props.onConfigSuccess?.(t)};onFocus=t=>{this.submitAnalytics({type:f,target:i(t.fieldType)}),C.includes(t.fieldType)?this.props.onFocus?.(t.event):this.props.onFocus?.(t)};onBlur=t=>{this.submitAnalytics({type:b,target:i(t.fieldType)}),C.includes(t.fieldType)?this.props.onBlur?.(t.event):this.props.onBlur?.(t)};onValidationErrorAnalytics=t=>{this.submitAnalytics({type:g,target:i(t.fieldType),validationErrorCode:t.errorCode,validationErrorMessage:T(t.errorCode,R)})};onBinValue=r(this);get storePaymentMethodPayload(){if(this.props.storedPaymentMethodId?.length>0)return{};if(0===this.props.amount?.value)return this.props.enableStoreDetails?{storePaymentMethod:!0}:{};return this.props.showStoreDetailsCheckbox&&void 0!==this.state.storePaymentMethod?{storePaymentMethod:Boolean(this.state.storePaymentMethod)}:{}}get isValid(){return!!this.state.isValid}get icon(){return this.props.icon??this.resources.getImage()(this.props.brand)}get brands(){const{brands:t,brandsConfiguration:o}=this.props;return t?t.map((t=>({icon:o[t]?.icon??this.props.modules.resources.getImage()(t),name:t}))):[]}get displayName(){return this.props.storedPaymentMethodId?`•••• ${this.props.lastFour}`:this.props.name||I.type}get accessibleName(){return(this.props.name||I.type)+(this.props.storedPaymentMethodId?" "+this.props.i18n.get("creditCard.storedCard.description.ariaLabel").replace("%@",this.props.lastFour):"")}get browserInfo(){return s()}payButton=o=>{const e=0===this.props.amount?.value,s=this.props.storedPaymentMethodId?.length>0;return t(h,{...o,amount:this.props.amount,secondaryAmount:this.props.secondaryAmount,label:e&&!s?this.props.i18n.get("payButton.saveDetails"):"",onClick:this.submit})};renderCardInput(e=!0){return t(o,{setComponentRef:this.setComponentRef,...this.props,...this.state,onChange:this.setState,onSubmit:this.submit,handleKeyPress:this.handleKeyPress,payButton:this.payButton,onBrand:this.onBrand,onBinValue:this.onBinValue,brand:this.props.brand,brandsIcons:this.brands,isPayButtonPrimaryVariant:e,resources:this.resources,onFocus:this.onFocus,onBlur:this.onBlur,onValidationErrorAnalytics:this.onValidationErrorAnalytics,onConfigSuccess:this.onConfigSuccess})}render(){return t(e,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},t(l,{srPanel:this.props.modules.srPanel},t(c,{amount:this.props.amount,configuration:this.props.clickToPayConfiguration,clickToPayService:this.clickToPayService,isStandaloneComponent:!1,setClickToPayRef:this.setClickToPayRef,onSetStatus:this.setElementStatus,onSubmit:this.handleClickToPaySubmit,onError:this.handleError},(t=>this.renderCardInput(t)))))}}export{I as CardElement,I as default};
1
+ import{createElement as t}from"../../external/preact/dist/preact.js";import o from"./components/CardInput/CardInput.js";import{CoreProvider as e}from"../../core/Context/CoreProvider.js";import s from"../../utils/browserInfo.js";import r from"../internal/SecuredFields/binLookup/triggerBinLookUp.js";import{fieldTypeToSnakeCase as i}from"../internal/SecuredFields/utils.js";import{reject as n}from"../../utils/commonUtils.js";import{hasValidInstallmentsObject as a}from"./components/CardInput/utils.js";import p from"../internal/ClickToPay/services/create-clicktopay-service.js";import c from"./components/ClickToPayWrapper.js";import l from"../../core/Errors/SRPanelProvider.js";import{TxVariants as d}from"../tx-variants.js";import{UIElement as u}from"../internal/UIElement/UIElement.js";import h from"../internal/PayButton/PayButton.js";import{ANALYTICS_RENDERED_STR as m,ANALYTICS_CONFIGURED_STR as y,ANALYTICS_FOCUS_STR as f,ANALYTICS_UNFOCUS_STR as b,ANALYTICS_VALIDATION_ERROR_STR as g}from"../../core/Analytics/constants.js";import{ALL_SECURED_FIELDS as P}from"../internal/SecuredFields/lib/constants.js";import{hasOwnProperty as C}from"../../utils/hasOwnProperty.js";import S,{IMPLEMENTATION_ERROR as k}from"../../core/Errors/AdyenCheckoutError.js";import{getErrorMessageFromCode as T}from"../../core/Errors/utils.js";import{SF_ErrorCodes as R}from"../../core/Errors/constants.js";import B from"./components/CardInput/defaultProps.js";function I(t,o,e){return o in t?Object.defineProperty(t,o,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[o]=e,t}class M extends u{setStatus(t,o){return this.componentRef?.setStatus&&this.componentRef.setStatus(t,o),this.clickToPayRef?.setStatus&&this.clickToPayRef.setStatus(t,o),this}formatProps(t){const o=t.session?.configuration?.enableStoreDetails??t.enableStoreDetails,e=!(0===t.amount?.value)&&o,s=t.storedPaymentMethodId||t.id,r=s&&t?.supportedShopperInteractions?.includes("Ecommerce");if(s&&!r)throw new S(k,"You are trying to create a storedCard from a stored PM that does not support Ecommerce interactions");return{...t,holderNameRequired:!!t.hasHolderName&&t.holderNameRequired,hasCVC:!(t.brand&&"bcmc"===t.brand||t.hideCVC),billingAddressRequired:!t.storedPaymentMethodId&&t.billingAddressRequired,billingAddressMode:t.onAddressLookup?B.billingAddressMode:t.billingAddressMode,brand:t.brand??d.card,countryCode:t.countryCode?t.countryCode.toLowerCase():null,configuration:{...t.configuration,socialSecurityNumberMode:t.configuration?.socialSecurityNumberMode??"auto"},brandsConfiguration:t.brandsConfiguration||t.configuration?.brandsConfiguration||{},icon:t.icon||t.configuration?.icon,installmentOptions:t.session?.configuration?.installmentOptions||t.installmentOptions,enableStoreDetails:o,showStoreDetailsCheckbox:e,clickToPayConfiguration:{...t.clickToPayConfiguration,disableOtpAutoFocus:t.clickToPayConfiguration?.disableOtpAutoFocus||!1,shopperEmail:t.clickToPayConfiguration?.shopperEmail||this.core.options?.session?.shopperEmail,telephoneNumber:t.clickToPayConfiguration?.telephoneNumber||this.core.options?.session?.telephoneNumber,locale:t.clickToPayConfiguration?.locale||t.i18n?.locale?.replace("-","_")},...s&&{storedPaymentMethodId:s}}}formatData(){const t=this.state.selectedBrandValue;return{paymentMethod:{type:M.type,...this.state.data,...this.props.storedPaymentMethodId&&{storedPaymentMethodId:this.props.storedPaymentMethodId,holderName:this.props.holderName??""},...t&&{brand:t},...this.props.fundingSource&&{fundingSource:this.props.fundingSource}},...this.state.billingAddress&&{billingAddress:this.state.billingAddress},...this.state.socialSecurityNumber&&{socialSecurityNumber:this.state.socialSecurityNumber},...this.storePaymentMethodPayload,...a(this.state.installments)&&{installments:this.state.installments},browserInfo:this.browserInfo,origin:!!window&&window.location.origin}}updateStyles(t){return this.componentRef?.updateStyles&&this.componentRef.updateStyles(t),this}setFocusOn(t){return this.componentRef?.setFocusOn&&this.componentRef.setFocusOn(t),this}processBinLookupResponse(t,o=!1){return this.componentRef?.processBinLookupResponse&&this.componentRef.processBinLookupResponse(t,o),this}handleUnsupportedCard(t){return this.componentRef?.handleUnsupportedCard&&this.componentRef.handleUnsupportedCard(t),this}onBinLookup(t){if(!t.isReset){const o=n("supportedBrandsRaw").from(t);this.props.onBinLookup?.(o)}}submitAnalytics(t){const{type:o}=t;o!==m&&o!==y||"scheme"===this.constructor.type&&C(this.props,"supportedShopperInteractions")&&(t.isStoredPaymentMethod=!0,t.brand=this.props.brand),super.submitAnalytics(t,this.props)}get storePaymentMethodPayload(){if(this.props.storedPaymentMethodId?.length>0)return{};if(0===this.props.amount?.value)return this.props.enableStoreDetails?{storePaymentMethod:!0}:{};return this.props.showStoreDetailsCheckbox&&void 0!==this.state.storePaymentMethod?{storePaymentMethod:Boolean(this.state.storePaymentMethod)}:{}}get isValid(){return!!this.state.isValid}get icon(){return this.props.icon??this.resources.getImage()(this.props.brand)}get brands(){const{brands:t,brandsConfiguration:o}=this.props;return t?t.map((t=>({icon:o[t]?.icon??this.props.modules.resources.getImage()(t),name:t}))):[]}get displayName(){return this.props.storedPaymentMethodId?`•••• ${this.props.lastFour}`:this.props.name||M.type}get accessibleName(){return(this.props.name||M.type)+(this.props.storedPaymentMethodId?" "+this.props.i18n.get("creditCard.storedCard.description.ariaLabel").replace("%@",this.props.lastFour):"")}get browserInfo(){return s()}renderCardInput(e=!0){return t(o,{setComponentRef:this.setComponentRef,...this.props,...this.state,onChange:this.setState,onSubmit:this.submit,handleKeyPress:this.handleKeyPress,payButton:this.payButton,onBrand:this.onBrand,onBinValue:this.onBinValue,brand:this.props.brand,brandsIcons:this.brands,isPayButtonPrimaryVariant:e,resources:this.resources,onFocus:this.onFocus,onBlur:this.onBlur,onValidationErrorAnalytics:this.onValidationErrorAnalytics,onConfigSuccess:this.onConfigSuccess})}render(){return t(e,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},t(l,{srPanel:this.props.modules.srPanel},t(c,{amount:this.props.amount,configuration:this.props.clickToPayConfiguration,clickToPayService:this.clickToPayService,isStandaloneComponent:!1,setClickToPayRef:this.setClickToPayRef,onSetStatus:this.setElementStatus,onSubmit:this.handleClickToPaySubmit,onError:this.handleError},(t=>this.renderCardInput(t)))))}constructor(o,e){super(o,e),I(this,"clickToPayService",void 0),I(this,"clickToPayRef",null),I(this,"setClickToPayRef",(t=>{this.clickToPayRef=t})),I(this,"onBrand",(t=>{this.props.onBrand?.(t)})),I(this,"handleClickToPaySubmit",(t=>{this.setState({data:{...t},valid:{},errors:{},isValid:!0}),this.submit()})),I(this,"onConfigSuccess",(t=>{this.submitAnalytics({type:y}),this.props.onConfigSuccess?.(t)})),I(this,"onFocus",(t=>{this.submitAnalytics({type:f,target:i(t.fieldType)}),P.includes(t.fieldType)?this.props.onFocus?.(t.event):this.props.onFocus?.(t)})),I(this,"onBlur",(t=>{this.submitAnalytics({type:b,target:i(t.fieldType)}),P.includes(t.fieldType)?this.props.onBlur?.(t.event):this.props.onBlur?.(t)})),I(this,"onValidationErrorAnalytics",(t=>{this.submitAnalytics({type:g,target:i(t.fieldType),validationErrorCode:t.errorCode,validationErrorMessage:T(t.errorCode,R)})})),I(this,"onBinValue",r(this)),I(this,"payButton",(o=>{const e=0===this.props.amount?.value,s=this.props.storedPaymentMethodId?.length>0;return t(h,{...o,amount:this.props.amount,secondaryAmount:this.props.secondaryAmount,label:e&&!s?this.props.i18n.get("payButton.saveDetails"):"",onClick:this.submit})})),e&&!e._disableClickToPay&&(this.clickToPayService=p(this.props.configuration,this.props.clickToPayConfiguration,this.props.environment),this.clickToPayService?.initialize())}}I(M,"type",d.scheme),I(M,"defaultProps",{showFormInstruction:!0,_disableClickToPay:!1,doBinLookup:!0,...n(["type","setComponentRef"]).from(B)});export{M as CardElement,M as default};
2
2
  //# sourceMappingURL=Card.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Card.js","sources":["../../../../src/components/Card/Card.tsx"],"sourcesContent":["import { h } from 'preact';\nimport CardInput from './components/CardInput';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport { BinLookupResponse, CardElementData, CardConfiguration } from './types';\nimport triggerBinLookUp from '../internal/SecuredFields/binLookup/triggerBinLookUp';\nimport { CbObjOnBinLookup, CbObjOnConfigSuccess, CbObjOnFocus } from '../internal/SecuredFields/lib/types';\nimport { fieldTypeToSnakeCase } from '../internal/SecuredFields/utils';\nimport { reject } from '../../utils/commonUtils';\nimport { hasValidInstallmentsObject } from './components/CardInput/utils';\nimport createClickToPayService from '../internal/ClickToPay/services/create-clicktopay-service';\nimport { ClickToPayCheckoutPayload, IClickToPayService } from '../internal/ClickToPay/services/types';\nimport ClickToPayWrapper from './components/ClickToPayWrapper';\nimport { ComponentFocusObject } from '../../types/global-types';\nimport SRPanelProvider from '../../core/Errors/SRPanelProvider';\nimport { TxVariants } from '../tx-variants';\nimport type { PayButtonFunctionProps, UIElementStatus } from '../internal/UIElement/types';\nimport UIElement from '../internal/UIElement';\nimport PayButton from '../internal/PayButton';\nimport type { ICore } from '../../core/types';\nimport {\n ANALYTICS_FOCUS_STR,\n ANALYTICS_CONFIGURED_STR,\n ANALYTICS_UNFOCUS_STR,\n ANALYTICS_VALIDATION_ERROR_STR,\n ANALYTICS_RENDERED_STR\n} from '../../core/Analytics/constants';\nimport { ALL_SECURED_FIELDS } from '../internal/SecuredFields/lib/constants';\nimport { FieldErrorAnalyticsObject, SendAnalyticsObject } from '../../core/Analytics/types';\nimport { hasOwnProperty } from '../../utils/hasOwnProperty';\nimport AdyenCheckoutError, { IMPLEMENTATION_ERROR } from '../../core/Errors/AdyenCheckoutError';\nimport { getErrorMessageFromCode } from '../../core/Errors/utils';\nimport { SF_ErrorCodes } from '../../core/Errors/constants';\nimport CardInputDefaultProps from './components/CardInput/defaultProps';\n\nexport class CardElement extends UIElement<CardConfiguration> {\n public static type = TxVariants.scheme;\n\n private readonly clickToPayService: IClickToPayService | null;\n\n /**\n * Reference to the 'ClickToPayComponent'\n */\n private clickToPayRef = null;\n\n constructor(checkout: ICore, props?: CardConfiguration) {\n super(checkout, props);\n\n if (props && !props._disableClickToPay) {\n this.clickToPayService = createClickToPayService(this.props.configuration, this.props.clickToPayConfiguration, this.props.environment);\n void this.clickToPayService?.initialize();\n }\n }\n\n protected static defaultProps = {\n showFormInstruction: true,\n _disableClickToPay: false,\n doBinLookup: true,\n // Merge most of CardInput's defaultProps\n ...reject(['type', 'setComponentRef']).from(CardInputDefaultProps)\n };\n\n public setStatus(status: UIElementStatus, props?): this {\n if (this.componentRef?.setStatus) {\n this.componentRef.setStatus(status, props);\n }\n if (this.clickToPayRef?.setStatus) {\n this.clickToPayRef.setStatus(status, props);\n }\n return this;\n }\n\n private setClickToPayRef = ref => {\n this.clickToPayRef = ref;\n };\n\n formatProps(props: CardConfiguration): CardConfiguration {\n // The value from a session should be used, before falling back to the merchant configuration\n const enableStoreDetails = props.session?.configuration?.enableStoreDetails ?? props.enableStoreDetails;\n\n const isZeroAuth = props.amount?.value === 0;\n const showStoreDetailsCheckbox = isZeroAuth ? false : enableStoreDetails;\n\n const storedCardID = props.storedPaymentMethodId || props.id; // check if we've been passed a (checkout) processed storedCard or one that merchant has pulled from the PMs response\n const isEcommerceStoredCard = storedCardID && props?.supportedShopperInteractions?.includes('Ecommerce'); // If we have a storedCard does it support Ecommerce (it might not if the merchant has pulled it from the PMs response)\n\n // If we have a storedPM but it doesn't support Ecommerce - we can't make a storedCard component from it\n if (storedCardID && !isEcommerceStoredCard) {\n // TODO - Decide if an error is too severe? Would a console.warning suffice?\n throw new AdyenCheckoutError(\n IMPLEMENTATION_ERROR,\n 'You are trying to create a storedCard from a stored PM that does not support Ecommerce interactions'\n );\n }\n\n return {\n ...props,\n // Mismatch between hasHolderName & holderNameRequired which can mean card can never be valid\n holderNameRequired: !props.hasHolderName ? false : props.holderNameRequired,\n // False for *stored* BCMC cards & if merchant explicitly wants to hide the CVC field\n hasCVC: !((props.brand && props.brand === 'bcmc') || props.hideCVC),\n // billingAddressRequired only available for non-stored cards\n billingAddressRequired: props.storedPaymentMethodId ? false : props.billingAddressRequired,\n // edge case where merchant has defined both an onAddressLookup callback AND set billingAddressMode: 'partial' - which leads to some strange behaviour in the address UI\n billingAddressMode: props.onAddressLookup ? CardInputDefaultProps.billingAddressMode : props.billingAddressMode,\n /** props.brand will be specified in the case of a StoredCard or a Bancontact component, for a regular Card we default it to 'card' */\n brand: props.brand ?? TxVariants.card,\n countryCode: props.countryCode ? props.countryCode.toLowerCase() : null,\n // Required for transition period (until configuration object becomes the norm)\n // - if merchant has defined value directly in props, use this instead\n configuration: {\n ...props.configuration,\n socialSecurityNumberMode: props.configuration?.socialSecurityNumberMode ?? 'auto'\n },\n brandsConfiguration: props.brandsConfiguration || props.configuration?.brandsConfiguration || {},\n icon: props.icon || props.configuration?.icon,\n // installmentOptions of a session should be used before falling back to the merchant configuration\n installmentOptions: props.session?.configuration?.installmentOptions || props.installmentOptions,\n enableStoreDetails,\n showStoreDetailsCheckbox,\n /**\n * Click to Pay configuration\n * - If email is set explicitly in the configuration, then it can override the one used in the session creation\n */\n clickToPayConfiguration: {\n ...props.clickToPayConfiguration,\n disableOtpAutoFocus: props.clickToPayConfiguration?.disableOtpAutoFocus || false,\n shopperEmail: props.clickToPayConfiguration?.shopperEmail || this.core.options?.session?.shopperEmail,\n telephoneNumber: props.clickToPayConfiguration?.telephoneNumber || this.core.options?.session?.telephoneNumber,\n locale: props.clickToPayConfiguration?.locale || props.i18n?.locale?.replace('-', '_')\n },\n ...(storedCardID && { storedPaymentMethodId: storedCardID })\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData(): CardElementData {\n /**\n * this.state.selectedBrandValue will be set when:\n * - /binLookup detects a single brand,\n * - when /binLookup detects a dual-branded card and the shopper makes a brand selection\n * - or, in the case of a storedCard\n */\n const cardBrand = this.state.selectedBrandValue;\n\n return {\n paymentMethod: {\n type: CardElement.type,\n ...this.state.data,\n ...(this.props.storedPaymentMethodId && {\n storedPaymentMethodId: this.props.storedPaymentMethodId,\n holderName: this.props.holderName ?? ''\n }),\n ...(cardBrand && { brand: cardBrand }),\n ...(this.props.fundingSource && { fundingSource: this.props.fundingSource })\n },\n ...(this.state.billingAddress && { billingAddress: this.state.billingAddress }),\n ...(this.state.socialSecurityNumber && { socialSecurityNumber: this.state.socialSecurityNumber }),\n ...this.storePaymentMethodPayload,\n ...(hasValidInstallmentsObject(this.state.installments) && { installments: this.state.installments }),\n browserInfo: this.browserInfo,\n origin: !!window && window.location.origin\n };\n }\n\n updateStyles(stylesObj) {\n if (this.componentRef?.updateStyles) this.componentRef.updateStyles(stylesObj);\n return this;\n }\n\n setFocusOn(fieldName) {\n if (this.componentRef?.setFocusOn) this.componentRef.setFocusOn(fieldName);\n return this;\n }\n\n public onBrand = event => {\n this.props.onBrand?.(event);\n };\n\n processBinLookupResponse(binLookupResponse: BinLookupResponse, isReset = false) {\n if (this.componentRef?.processBinLookupResponse) this.componentRef.processBinLookupResponse(binLookupResponse, isReset);\n return this;\n }\n\n handleUnsupportedCard(errObj) {\n if (this.componentRef?.handleUnsupportedCard) this.componentRef.handleUnsupportedCard(errObj);\n return this;\n }\n\n private handleClickToPaySubmit = (payload: ClickToPayCheckoutPayload) => {\n this.setState({ data: { ...payload }, valid: {}, errors: {}, isValid: true });\n this.submit();\n };\n\n onBinLookup(obj: CbObjOnBinLookup) {\n // Handler for regular card comp doesn't need this 'raw' data or to know about 'resets'\n if (!obj.isReset) {\n const nuObj = reject('supportedBrandsRaw').from(obj);\n this.props.onBinLookup?.(nuObj);\n }\n }\n\n protected submitAnalytics(analyticsObj: SendAnalyticsObject) {\n const { type } = analyticsObj;\n\n if (type === ANALYTICS_RENDERED_STR || type === ANALYTICS_CONFIGURED_STR) {\n // Check if it's a storedCard\n if (this.constructor['type'] === 'scheme') {\n if (hasOwnProperty(this.props, 'supportedShopperInteractions')) {\n analyticsObj.isStoredPaymentMethod = true;\n analyticsObj.brand = this.props.brand;\n }\n }\n }\n\n super.submitAnalytics(analyticsObj, this.props);\n }\n\n private onConfigSuccess = (obj: CbObjOnConfigSuccess) => {\n this.submitAnalytics({\n type: ANALYTICS_CONFIGURED_STR\n });\n\n this.props.onConfigSuccess?.(obj);\n };\n\n private onFocus = (obj: ComponentFocusObject) => {\n this.submitAnalytics({\n type: ANALYTICS_FOCUS_STR,\n target: fieldTypeToSnakeCase(obj.fieldType)\n });\n\n // Call merchant defined callback\n if (ALL_SECURED_FIELDS.includes(obj.fieldType)) {\n this.props.onFocus?.(obj.event as CbObjOnFocus);\n } else {\n this.props.onFocus?.(obj);\n }\n };\n\n private onBlur = (obj: ComponentFocusObject) => {\n this.submitAnalytics({\n type: ANALYTICS_UNFOCUS_STR,\n target: fieldTypeToSnakeCase(obj.fieldType)\n });\n\n // Call merchant defined callback\n if (ALL_SECURED_FIELDS.includes(obj.fieldType)) {\n this.props.onBlur?.(obj.event as CbObjOnFocus);\n } else {\n this.props.onBlur?.(obj);\n }\n };\n\n private onValidationErrorAnalytics = (obj: FieldErrorAnalyticsObject) => {\n this.submitAnalytics({\n type: ANALYTICS_VALIDATION_ERROR_STR,\n target: fieldTypeToSnakeCase(obj.fieldType),\n validationErrorCode: obj.errorCode,\n validationErrorMessage: getErrorMessageFromCode(obj.errorCode, SF_ErrorCodes)\n });\n };\n\n public onBinValue = triggerBinLookUp(this);\n\n get storePaymentMethodPayload() {\n const isStoredCard = this.props.storedPaymentMethodId?.length > 0;\n if (isStoredCard) {\n return {};\n }\n\n /**\n * For regular card, zero auth payments, we store the payment method, *if* the configuration says we should:\n * - For sessions, this means if the session has been created with storePaymentMethodMode: 'askForConsent'\n * - For the advanced flow, this means if the merchant has still set enableStoreDetails: true\n *\n * What we are doing is.. if for a normal payment we would show the \"Save for my next payment\" checkbox,\n * for a zero-auth payment we effectively click the checkbox on behalf of the shopper.\n */\n const isZeroAuth = this.props.amount?.value === 0;\n if (isZeroAuth) {\n return this.props.enableStoreDetails ? { storePaymentMethod: true } : {};\n }\n\n // For regular card, non-zero auth payments, we store the payment method based on the checkbox value.\n const includeStorePaymentMethod = this.props.showStoreDetailsCheckbox && typeof this.state.storePaymentMethod !== 'undefined';\n return includeStorePaymentMethod ? { storePaymentMethod: Boolean(this.state.storePaymentMethod) } : {};\n }\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n get icon() {\n return this.props.icon ?? this.resources.getImage()(this.props.brand);\n }\n\n get brands(): { icon: any; name: string }[] {\n const { brands, brandsConfiguration } = this.props;\n if (brands) {\n return brands.map(brand => {\n const brandIcon = brandsConfiguration[brand]?.icon ?? this.props.modules.resources.getImage()(brand);\n return { icon: brandIcon, name: brand };\n });\n }\n\n return [];\n }\n\n get displayName(): string {\n if (this.props.storedPaymentMethodId) {\n return `•••• ${this.props.lastFour}`;\n }\n\n return this.props.name || CardElement.type;\n }\n\n get accessibleName(): string {\n // Use display name, unless it's a stored payment method, there inform user\n return (\n (this.props.name || CardElement.type) +\n (this.props.storedPaymentMethodId\n ? ' ' + this.props.i18n.get('creditCard.storedCard.description.ariaLabel').replace('%@', this.props.lastFour)\n : '')\n );\n }\n\n get browserInfo() {\n return collectBrowserInfo();\n }\n\n protected override payButton = (props: PayButtonFunctionProps) => {\n const isZeroAuth = this.props.amount?.value === 0;\n const isStoredCard = this.props.storedPaymentMethodId?.length > 0;\n return (\n <PayButton\n {...props}\n amount={this.props.amount}\n secondaryAmount={this.props.secondaryAmount}\n label={isZeroAuth && !isStoredCard ? this.props.i18n.get('payButton.saveDetails') : ''}\n onClick={this.submit}\n />\n );\n };\n\n private renderCardInput(isCardPrimaryInput = true): h.JSX.Element {\n return (\n <CardInput\n setComponentRef={this.setComponentRef}\n {...this.props}\n {...this.state}\n onChange={this.setState}\n onSubmit={this.submit}\n handleKeyPress={this.handleKeyPress}\n payButton={this.payButton}\n onBrand={this.onBrand}\n onBinValue={this.onBinValue}\n brand={this.props.brand}\n brandsIcons={this.brands}\n isPayButtonPrimaryVariant={isCardPrimaryInput}\n resources={this.resources}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n onValidationErrorAnalytics={this.onValidationErrorAnalytics}\n onConfigSuccess={this.onConfigSuccess}\n />\n );\n }\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <SRPanelProvider srPanel={this.props.modules.srPanel}>\n <ClickToPayWrapper\n amount={this.props.amount}\n configuration={this.props.clickToPayConfiguration}\n clickToPayService={this.clickToPayService}\n isStandaloneComponent={false}\n setClickToPayRef={this.setClickToPayRef}\n onSetStatus={this.setElementStatus}\n onSubmit={this.handleClickToPaySubmit}\n onError={this.handleError}\n >\n {isCardPrimaryInput => this.renderCardInput(isCardPrimaryInput)}\n </ClickToPayWrapper>\n </SRPanelProvider>\n </CoreProvider>\n );\n }\n}\n\nexport default CardElement;\n"],"names":["CardElement","UIElement","static","TxVariants","scheme","clickToPayService","clickToPayRef","constructor","checkout","props","super","_disableClickToPay","this","createClickToPayService","configuration","clickToPayConfiguration","environment","initialize","showFormInstruction","doBinLookup","reject","from","CardInputDefaultProps","setStatus","status","componentRef","setClickToPayRef","ref","formatProps","enableStoreDetails","session","showStoreDetailsCheckbox","amount","value","storedCardID","storedPaymentMethodId","id","isEcommerceStoredCard","supportedShopperInteractions","includes","AdyenCheckoutError","IMPLEMENTATION_ERROR","holderNameRequired","hasHolderName","hasCVC","brand","hideCVC","billingAddressRequired","billingAddressMode","onAddressLookup","card","countryCode","toLowerCase","socialSecurityNumberMode","brandsConfiguration","icon","installmentOptions","disableOtpAutoFocus","shopperEmail","core","options","telephoneNumber","locale","i18n","replace","formatData","cardBrand","state","selectedBrandValue","paymentMethod","type","data","holderName","fundingSource","billingAddress","socialSecurityNumber","storePaymentMethodPayload","hasValidInstallmentsObject","installments","browserInfo","origin","window","location","updateStyles","stylesObj","setFocusOn","fieldName","onBrand","event","processBinLookupResponse","binLookupResponse","isReset","handleUnsupportedCard","errObj","handleClickToPaySubmit","payload","setState","valid","errors","isValid","submit","onBinLookup","obj","nuObj","submitAnalytics","analyticsObj","ANALYTICS_RENDERED_STR","ANALYTICS_CONFIGURED_STR","hasOwnProperty","isStoredPaymentMethod","onConfigSuccess","onFocus","ANALYTICS_FOCUS_STR","target","fieldTypeToSnakeCase","fieldType","ALL_SECURED_FIELDS","onBlur","ANALYTICS_UNFOCUS_STR","onValidationErrorAnalytics","ANALYTICS_VALIDATION_ERROR_STR","validationErrorCode","errorCode","validationErrorMessage","getErrorMessageFromCode","SF_ErrorCodes","onBinValue","triggerBinLookUp","length","storePaymentMethod","Boolean","resources","getImage","brands","map","modules","name","displayName","lastFour","accessibleName","get","collectBrowserInfo","payButton","isZeroAuth","isStoredCard","h","PayButton","secondaryAmount","label","onClick","renderCardInput","isCardPrimaryInput","CardInput","setComponentRef","onChange","onSubmit","handleKeyPress","brandsIcons","isPayButtonPrimaryVariant","render","CoreProvider","loadingContext","SRPanelProvider","srPanel","ClickToPayWrapper","isStandaloneComponent","onSetStatus","setElementStatus","onError","handleError"],"mappings":"m6CAmCO,MAAMA,UAAoBC,EAC7BC,YAAqBC,EAAWC,OAEfC,kBAKTC,cAAgB,KAExBC,WAAAA,CAAYC,EAAiBC,GACzBC,MAAMF,EAAUC,GAEZA,IAAUA,EAAME,qBAChBC,KAAKP,kBAAoBQ,EAAwBD,KAAKH,MAAMK,cAAeF,KAAKH,MAAMM,wBAAyBH,KAAKH,MAAMO,aACrHJ,KAAKP,mBAAmBY,aAErC,CAEAf,oBAAgC,CAC5BgB,qBAAqB,EACrBP,oBAAoB,EACpBQ,aAAa,KAEVC,EAAO,CAAC,OAAQ,oBAAoBC,KAAKC,IAGzCC,SAAAA,CAAUC,EAAyBf,GAOtC,OANIG,KAAKa,cAAcF,WACnBX,KAAKa,aAAaF,UAAUC,EAAQf,GAEpCG,KAAKN,eAAeiB,WACpBX,KAAKN,cAAciB,UAAUC,EAAQf,GAElCG,IACX,CAEQc,iBAAmBC,IACvBf,KAAKN,cAAgBqB,CAAAA,EAGzBC,WAAAA,CAAYnB,GAER,MAAMoB,EAAqBpB,EAAMqB,SAAShB,eAAee,oBAAsBpB,EAAMoB,mBAG/EE,IADqC,IAAxBtB,EAAMuB,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D,SAAU/I,KAAKwF,OACfwD,eAAgBhJ,KAAKgJ,eACrBd,UAAWlI,KAAKkI,UAChBvD,QAAS3E,KAAK2E,QACduC,WAAYlH,KAAKkH,WACjBjF,MAAOjC,KAAKH,MAAMoC,MAClBgH,YAAajJ,KAAKyH,OAClByB,0BAA2BP,EAC3BpB,UAAWvH,KAAKuH,UAChBpB,QAASnG,KAAKmG,QACdM,OAAQzG,KAAKyG,OACbE,2BAA4B3G,KAAK2G,2BACjCT,gBAAiBlG,KAAKkG,iBAGlC,CAEAiD,MAAAA,GACI,OACId,EAACe,EAAAA,CAAajG,KAAMnD,KAAKH,MAAMsD,KAAMkG,eAAgBrJ,KAAKH,MAAMwJ,eAAgB9B,UAAWvH,KAAKuH,WAC5Fc,EAACiB,EAAAA,CAAgBC,QAASvJ,KAAKH,MAAM8H,QAAQ4B,SACzClB,EAACmB,EAAAA,CACGpI,OAAQpB,KAAKH,MAAMuB,OACnBlB,cAAeF,KAAKH,MAAMM,wBAC1BV,kBAAmBO,KAAKP,kBACxBgK,uBAAuB,EACvB3I,iBAAkBd,KAAKc,iBACvB4I,YAAa1J,KAAK2J,iBAClBZ,SAAU/I,KAAKkF,uBACf0E,QAAS5J,KAAK6J,cAEblB,GAAsB3I,KAAK0I,gBAAgBC,MAKhE"}
1
+ {"version":3,"file":"Card.js","sources":["../../../../src/components/Card/Card.tsx"],"sourcesContent":["import { h } from 'preact';\nimport CardInput from './components/CardInput';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport { BinLookupResponse, CardElementData, CardConfiguration } from './types';\nimport triggerBinLookUp from '../internal/SecuredFields/binLookup/triggerBinLookUp';\nimport { CbObjOnBinLookup, CbObjOnConfigSuccess, CbObjOnFocus } from '../internal/SecuredFields/lib/types';\nimport { fieldTypeToSnakeCase } from '../internal/SecuredFields/utils';\nimport { reject } from '../../utils/commonUtils';\nimport { hasValidInstallmentsObject } from './components/CardInput/utils';\nimport createClickToPayService from '../internal/ClickToPay/services/create-clicktopay-service';\nimport { ClickToPayCheckoutPayload, IClickToPayService } from '../internal/ClickToPay/services/types';\nimport ClickToPayWrapper from './components/ClickToPayWrapper';\nimport { ComponentFocusObject } from '../../types/global-types';\nimport SRPanelProvider from '../../core/Errors/SRPanelProvider';\nimport { TxVariants } from '../tx-variants';\nimport type { PayButtonFunctionProps, UIElementStatus } from '../internal/UIElement/types';\nimport UIElement from '../internal/UIElement';\nimport PayButton from '../internal/PayButton';\nimport type { ICore } from '../../core/types';\nimport {\n ANALYTICS_FOCUS_STR,\n ANALYTICS_CONFIGURED_STR,\n ANALYTICS_UNFOCUS_STR,\n ANALYTICS_VALIDATION_ERROR_STR,\n ANALYTICS_RENDERED_STR\n} from '../../core/Analytics/constants';\nimport { ALL_SECURED_FIELDS } from '../internal/SecuredFields/lib/constants';\nimport { FieldErrorAnalyticsObject, SendAnalyticsObject } from '../../core/Analytics/types';\nimport { hasOwnProperty } from '../../utils/hasOwnProperty';\nimport AdyenCheckoutError, { IMPLEMENTATION_ERROR } from '../../core/Errors/AdyenCheckoutError';\nimport { getErrorMessageFromCode } from '../../core/Errors/utils';\nimport { SF_ErrorCodes } from '../../core/Errors/constants';\nimport CardInputDefaultProps from './components/CardInput/defaultProps';\n\nexport class CardElement extends UIElement<CardConfiguration> {\n public static type = TxVariants.scheme;\n\n private readonly clickToPayService: IClickToPayService | null;\n\n /**\n * Reference to the 'ClickToPayComponent'\n */\n private clickToPayRef = null;\n\n constructor(checkout: ICore, props?: CardConfiguration) {\n super(checkout, props);\n\n if (props && !props._disableClickToPay) {\n this.clickToPayService = createClickToPayService(this.props.configuration, this.props.clickToPayConfiguration, this.props.environment);\n void this.clickToPayService?.initialize();\n }\n }\n\n protected static defaultProps = {\n showFormInstruction: true,\n _disableClickToPay: false,\n doBinLookup: true,\n // Merge most of CardInput's defaultProps\n ...reject(['type', 'setComponentRef']).from(CardInputDefaultProps)\n };\n\n public setStatus(status: UIElementStatus, props?): this {\n if (this.componentRef?.setStatus) {\n this.componentRef.setStatus(status, props);\n }\n if (this.clickToPayRef?.setStatus) {\n this.clickToPayRef.setStatus(status, props);\n }\n return this;\n }\n\n private setClickToPayRef = ref => {\n this.clickToPayRef = ref;\n };\n\n formatProps(props: CardConfiguration): CardConfiguration {\n // The value from a session should be used, before falling back to the merchant configuration\n const enableStoreDetails = props.session?.configuration?.enableStoreDetails ?? props.enableStoreDetails;\n\n const isZeroAuth = props.amount?.value === 0;\n const showStoreDetailsCheckbox = isZeroAuth ? false : enableStoreDetails;\n\n const storedCardID = props.storedPaymentMethodId || props.id; // check if we've been passed a (checkout) processed storedCard or one that merchant has pulled from the PMs response\n const isEcommerceStoredCard = storedCardID && props?.supportedShopperInteractions?.includes('Ecommerce'); // If we have a storedCard does it support Ecommerce (it might not if the merchant has pulled it from the PMs response)\n\n // If we have a storedPM but it doesn't support Ecommerce - we can't make a storedCard component from it\n if (storedCardID && !isEcommerceStoredCard) {\n // TODO - Decide if an error is too severe? Would a console.warning suffice?\n throw new AdyenCheckoutError(\n IMPLEMENTATION_ERROR,\n 'You are trying to create a storedCard from a stored PM that does not support Ecommerce interactions'\n );\n }\n\n return {\n ...props,\n // Mismatch between hasHolderName & holderNameRequired which can mean card can never be valid\n holderNameRequired: !props.hasHolderName ? false : props.holderNameRequired,\n // False for *stored* BCMC cards & if merchant explicitly wants to hide the CVC field\n hasCVC: !((props.brand && props.brand === 'bcmc') || props.hideCVC),\n // billingAddressRequired only available for non-stored cards\n billingAddressRequired: props.storedPaymentMethodId ? false : props.billingAddressRequired,\n // edge case where merchant has defined both an onAddressLookup callback AND set billingAddressMode: 'partial' - which leads to some strange behaviour in the address UI\n billingAddressMode: props.onAddressLookup ? CardInputDefaultProps.billingAddressMode : props.billingAddressMode,\n /** props.brand will be specified in the case of a StoredCard or a Bancontact component, for a regular Card we default it to 'card' */\n brand: props.brand ?? TxVariants.card,\n countryCode: props.countryCode ? props.countryCode.toLowerCase() : null,\n // Required for transition period (until configuration object becomes the norm)\n // - if merchant has defined value directly in props, use this instead\n configuration: {\n ...props.configuration,\n socialSecurityNumberMode: props.configuration?.socialSecurityNumberMode ?? 'auto'\n },\n brandsConfiguration: props.brandsConfiguration || props.configuration?.brandsConfiguration || {},\n icon: props.icon || props.configuration?.icon,\n // installmentOptions of a session should be used before falling back to the merchant configuration\n installmentOptions: props.session?.configuration?.installmentOptions || props.installmentOptions,\n enableStoreDetails,\n showStoreDetailsCheckbox,\n /**\n * Click to Pay configuration\n * - If email is set explicitly in the configuration, then it can override the one used in the session creation\n */\n clickToPayConfiguration: {\n ...props.clickToPayConfiguration,\n disableOtpAutoFocus: props.clickToPayConfiguration?.disableOtpAutoFocus || false,\n shopperEmail: props.clickToPayConfiguration?.shopperEmail || this.core.options?.session?.shopperEmail,\n telephoneNumber: props.clickToPayConfiguration?.telephoneNumber || this.core.options?.session?.telephoneNumber,\n locale: props.clickToPayConfiguration?.locale || props.i18n?.locale?.replace('-', '_')\n },\n ...(storedCardID && { storedPaymentMethodId: storedCardID })\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData(): CardElementData {\n /**\n * this.state.selectedBrandValue will be set when:\n * - /binLookup detects a single brand,\n * - when /binLookup detects a dual-branded card and the shopper makes a brand selection\n * - or, in the case of a storedCard\n */\n const cardBrand = this.state.selectedBrandValue;\n\n return {\n paymentMethod: {\n type: CardElement.type,\n ...this.state.data,\n ...(this.props.storedPaymentMethodId && {\n storedPaymentMethodId: this.props.storedPaymentMethodId,\n holderName: this.props.holderName ?? ''\n }),\n ...(cardBrand && { brand: cardBrand }),\n ...(this.props.fundingSource && { fundingSource: this.props.fundingSource })\n },\n ...(this.state.billingAddress && { billingAddress: this.state.billingAddress }),\n ...(this.state.socialSecurityNumber && { socialSecurityNumber: this.state.socialSecurityNumber }),\n ...this.storePaymentMethodPayload,\n ...(hasValidInstallmentsObject(this.state.installments) && { installments: this.state.installments }),\n browserInfo: this.browserInfo,\n origin: !!window && window.location.origin\n };\n }\n\n updateStyles(stylesObj) {\n if (this.componentRef?.updateStyles) this.componentRef.updateStyles(stylesObj);\n return this;\n }\n\n setFocusOn(fieldName) {\n if (this.componentRef?.setFocusOn) this.componentRef.setFocusOn(fieldName);\n return this;\n }\n\n public onBrand = event => {\n this.props.onBrand?.(event);\n };\n\n processBinLookupResponse(binLookupResponse: BinLookupResponse, isReset = false) {\n if (this.componentRef?.processBinLookupResponse) this.componentRef.processBinLookupResponse(binLookupResponse, isReset);\n return this;\n }\n\n handleUnsupportedCard(errObj) {\n if (this.componentRef?.handleUnsupportedCard) this.componentRef.handleUnsupportedCard(errObj);\n return this;\n }\n\n private handleClickToPaySubmit = (payload: ClickToPayCheckoutPayload) => {\n this.setState({ data: { ...payload }, valid: {}, errors: {}, isValid: true });\n this.submit();\n };\n\n onBinLookup(obj: CbObjOnBinLookup) {\n // Handler for regular card comp doesn't need this 'raw' data or to know about 'resets'\n if (!obj.isReset) {\n const nuObj = reject('supportedBrandsRaw').from(obj);\n this.props.onBinLookup?.(nuObj);\n }\n }\n\n protected submitAnalytics(analyticsObj: SendAnalyticsObject) {\n const { type } = analyticsObj;\n\n if (type === ANALYTICS_RENDERED_STR || type === ANALYTICS_CONFIGURED_STR) {\n // Check if it's a storedCard\n if (this.constructor['type'] === 'scheme') {\n if (hasOwnProperty(this.props, 'supportedShopperInteractions')) {\n analyticsObj.isStoredPaymentMethod = true;\n analyticsObj.brand = this.props.brand;\n }\n }\n }\n\n super.submitAnalytics(analyticsObj, this.props);\n }\n\n private onConfigSuccess = (obj: CbObjOnConfigSuccess) => {\n this.submitAnalytics({\n type: ANALYTICS_CONFIGURED_STR\n });\n\n this.props.onConfigSuccess?.(obj);\n };\n\n private onFocus = (obj: ComponentFocusObject) => {\n this.submitAnalytics({\n type: ANALYTICS_FOCUS_STR,\n target: fieldTypeToSnakeCase(obj.fieldType)\n });\n\n // Call merchant defined callback\n if (ALL_SECURED_FIELDS.includes(obj.fieldType)) {\n this.props.onFocus?.(obj.event as CbObjOnFocus);\n } else {\n this.props.onFocus?.(obj);\n }\n };\n\n private onBlur = (obj: ComponentFocusObject) => {\n this.submitAnalytics({\n type: ANALYTICS_UNFOCUS_STR,\n target: fieldTypeToSnakeCase(obj.fieldType)\n });\n\n // Call merchant defined callback\n if (ALL_SECURED_FIELDS.includes(obj.fieldType)) {\n this.props.onBlur?.(obj.event as CbObjOnFocus);\n } else {\n this.props.onBlur?.(obj);\n }\n };\n\n private onValidationErrorAnalytics = (obj: FieldErrorAnalyticsObject) => {\n this.submitAnalytics({\n type: ANALYTICS_VALIDATION_ERROR_STR,\n target: fieldTypeToSnakeCase(obj.fieldType),\n validationErrorCode: obj.errorCode,\n validationErrorMessage: getErrorMessageFromCode(obj.errorCode, SF_ErrorCodes)\n });\n };\n\n public onBinValue = triggerBinLookUp(this);\n\n get storePaymentMethodPayload() {\n const isStoredCard = this.props.storedPaymentMethodId?.length > 0;\n if (isStoredCard) {\n return {};\n }\n\n /**\n * For regular card, zero auth payments, we store the payment method, *if* the configuration says we should:\n * - For sessions, this means if the session has been created with storePaymentMethodMode: 'askForConsent'\n * - For the advanced flow, this means if the merchant has still set enableStoreDetails: true\n *\n * What we are doing is.. if for a normal payment we would show the \"Save for my next payment\" checkbox,\n * for a zero-auth payment we effectively click the checkbox on behalf of the shopper.\n */\n const isZeroAuth = this.props.amount?.value === 0;\n if (isZeroAuth) {\n return this.props.enableStoreDetails ? { storePaymentMethod: true } : {};\n }\n\n // For regular card, non-zero auth payments, we store the payment method based on the checkbox value.\n const includeStorePaymentMethod = this.props.showStoreDetailsCheckbox && typeof this.state.storePaymentMethod !== 'undefined';\n return includeStorePaymentMethod ? { storePaymentMethod: Boolean(this.state.storePaymentMethod) } : {};\n }\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n get icon() {\n return this.props.icon ?? this.resources.getImage()(this.props.brand);\n }\n\n get brands(): { icon: any; name: string }[] {\n const { brands, brandsConfiguration } = this.props;\n if (brands) {\n return brands.map(brand => {\n const brandIcon = brandsConfiguration[brand]?.icon ?? this.props.modules.resources.getImage()(brand);\n return { icon: brandIcon, name: brand };\n });\n }\n\n return [];\n }\n\n get displayName(): string {\n if (this.props.storedPaymentMethodId) {\n return `•••• ${this.props.lastFour}`;\n }\n\n return this.props.name || CardElement.type;\n }\n\n get accessibleName(): string {\n // Use display name, unless it's a stored payment method, there inform user\n return (\n (this.props.name || CardElement.type) +\n (this.props.storedPaymentMethodId\n ? ' ' + this.props.i18n.get('creditCard.storedCard.description.ariaLabel').replace('%@', this.props.lastFour)\n : '')\n );\n }\n\n get browserInfo() {\n return collectBrowserInfo();\n }\n\n protected override payButton = (props: PayButtonFunctionProps) => {\n const isZeroAuth = this.props.amount?.value === 0;\n const isStoredCard = this.props.storedPaymentMethodId?.length > 0;\n return (\n <PayButton\n {...props}\n amount={this.props.amount}\n secondaryAmount={this.props.secondaryAmount}\n label={isZeroAuth && !isStoredCard ? this.props.i18n.get('payButton.saveDetails') : ''}\n onClick={this.submit}\n />\n );\n };\n\n private renderCardInput(isCardPrimaryInput = true): h.JSX.Element {\n return (\n <CardInput\n setComponentRef={this.setComponentRef}\n {...this.props}\n {...this.state}\n onChange={this.setState}\n onSubmit={this.submit}\n handleKeyPress={this.handleKeyPress}\n payButton={this.payButton}\n onBrand={this.onBrand}\n onBinValue={this.onBinValue}\n brand={this.props.brand}\n brandsIcons={this.brands}\n isPayButtonPrimaryVariant={isCardPrimaryInput}\n resources={this.resources}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n onValidationErrorAnalytics={this.onValidationErrorAnalytics}\n onConfigSuccess={this.onConfigSuccess}\n />\n );\n }\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <SRPanelProvider srPanel={this.props.modules.srPanel}>\n <ClickToPayWrapper\n amount={this.props.amount}\n configuration={this.props.clickToPayConfiguration}\n clickToPayService={this.clickToPayService}\n isStandaloneComponent={false}\n setClickToPayRef={this.setClickToPayRef}\n onSetStatus={this.setElementStatus}\n onSubmit={this.handleClickToPaySubmit}\n onError={this.handleError}\n >\n {isCardPrimaryInput => this.renderCardInput(isCardPrimaryInput)}\n </ClickToPayWrapper>\n </SRPanelProvider>\n </CoreProvider>\n );\n }\n}\n\nexport default CardElement;\n"],"names":["CardElement","UIElement","setStatus","status","props","this","componentRef","clickToPayRef","formatProps","enableStoreDetails","session","configuration","showStoreDetailsCheckbox","amount","value","storedCardID","storedPaymentMethodId","id","isEcommerceStoredCard","supportedShopperInteractions","includes","AdyenCheckoutError","IMPLEMENTATION_ERROR","holderNameRequired","hasHolderName","hasCVC","brand","hideCVC","billingAddressRequired","billingAddressMode","onAddressLookup","CardInputDefaultProps","TxVariants","card","countryCode","toLowerCase","socialSecurityNumberMode","brandsConfiguration","icon","installmentOptions","clickToPayConfiguration","disableOtpAutoFocus","shopperEmail","core","options","telephoneNumber","locale","i18n","replace","formatData","cardBrand","state","selectedBrandValue","paymentMethod","type","data","holderName","fundingSource","billingAddress","socialSecurityNumber","storePaymentMethodPayload","hasValidInstallmentsObject","installments","browserInfo","origin","window","location","updateStyles","stylesObj","setFocusOn","fieldName","processBinLookupResponse","binLookupResponse","isReset","handleUnsupportedCard","errObj","onBinLookup","obj","nuObj","reject","from","submitAnalytics","analyticsObj","ANALYTICS_RENDERED_STR","ANALYTICS_CONFIGURED_STR","constructor","hasOwnProperty","isStoredPaymentMethod","super","length","storePaymentMethod","Boolean","isValid","resources","getImage","brands","map","modules","name","displayName","lastFour","accessibleName","get","collectBrowserInfo","renderCardInput","isCardPrimaryInput","h","CardInput","setComponentRef","onChange","setState","onSubmit","submit","handleKeyPress","payButton","onBrand","onBinValue","brandsIcons","isPayButtonPrimaryVariant","onFocus","onBlur","onValidationErrorAnalytics","onConfigSuccess","render","CoreProvider","loadingContext","SRPanelProvider","srPanel","ClickToPayWrapper","clickToPayService","isStandaloneComponent","setClickToPayRef","onSetStatus","setElementStatus","handleClickToPaySubmit","onError","handleError","checkout","_define_property","ref","event","payload","valid","errors","ANALYTICS_FOCUS_STR","target","fieldTypeToSnakeCase","fieldType","ALL_SECURED_FIELDS","ANALYTICS_UNFOCUS_STR","ANALYTICS_VALIDATION_ERROR_STR","validationErrorCode","errorCode","validationErrorMessage","getErrorMessageFromCode","SF_ErrorCodes","triggerBinLookUp","isZeroAuth","isStoredCard","PayButton","secondaryAmount","label","onClick","_disableClickToPay","createClickToPayService","environment","initialize","scheme","defaultProps","showFormInstruction","doBinLookup"],"mappings":"2hDAmCO,MAAMA,UAAoBC,EA2BtBC,SAAAA,CAAUC,EAAyBC,GAOtC,OANIC,KAAKC,cAAcJ,WACnBG,KAAKC,aAAaJ,UAAUC,EAAQC,GAEpCC,KAAKE,eAAeL,WACpBG,KAAKE,cAAcL,UAAUC,EAAQC,GAElCC,IACX,CAMAG,WAAAA,CAAYJ,GAER,MAAMK,EAAqBL,EAAMM,SAASC,eAAeF,oBAAsBL,EAAMK,mBAG/EG,IADqC,IAAxBR,EAAMS,QAAQC,QACqBL,EAEhDM,EAAeX,EAAMY,uBAAyBZ,EAAMa,GACpDC,EAAwBH,GAAgBX,GAAOe,8BAA8BC,SAAS,aAG5F,GAAIL,IAAiBG,EAEjB,MAAM,IAAIG,EACNC,EACA,uGAIR,MAAO,IACAlB,EAEHmB,qBAAqBnB,EAAMoB,eAAwBpB,EAAMmB,mBAEzDE,SAAUrB,EAAOsB,OAAyB,SAAhBtB,EAAMsB,OAAqBtB,EAAMuB,SAE3DC,wBAAwBxB,EAAMY,uBAAgCZ,EAAMwB,uBAEpEC,mBAAoBzB,EAAM0B,gBAAkBC,EAAsBF,mBAAqBzB,EAAMyB,mBAE7FH,MAAOtB,EAAMsB,OAASM,EAAWC,KACjCC,YAAa9B,EAAM8B,YAAc9B,EAAM8B,YAAYC,cAAgB,KAGnExB,cAAe,IACRP,EAAMO,cACTyB,yBAA0BhC,EAAMO,eAAeyB,0BAA4B,QAE/EC,oBAAqBjC,EAAMiC,qBAAuBjC,EAAMO,eAAe0B,qBAAuB,CAAC,E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,EAAqBrE,EAAIsE,WACjCI,oBAAqB1E,EAAI2E,UACzBC,uBAAwBC,EAAwB7E,EAAI2E,UAAWG,IACnE,IAGJjB,EAAOtB,KAAAA,aAAawC,EAAiBvJ,OAoErCqI,EAAArI,KAAmB6G,aAAa9G,IAC5B,MAAMyJ,EAA0C,IAA7BxJ,KAAKD,MAAMS,QAAQC,MAChCgJ,EAAezJ,KAAKD,MAAMY,uBAAuByE,OAAS,EAChE,OACIiB,EAACqD,EAAAA,IACO3J,EACJS,OAAQR,KAAKD,MAAMS,OACnBmJ,gBAAiB3J,KAAKD,MAAM4J,gBAC5BC,MAAOJ,IAAeC,EAAezJ,KAAKD,MAAM2C,KAAKuD,IAAI,yBAA2B,GACpF4D,QAAS7J,KAAK2G,YAtSlB5G,IAAUA,EAAM+J,qBAChB9J,KAAK4H,kBAAoBmC,EAAwB/J,KAAKD,MAAMO,cAAeN,KAAKD,MAAMoC,wBAAyBnC,KAAKD,MAAMiK,aACrHhK,KAAK4H,mBAAmBqC,aAErC,EAhBA5B,EADS1I,EACKsD,OAAOtB,EAAWuI,QAkBhC7B,EAnBS1I,EAmBQwK,eAAe,CAC5BC,qBAAqB,EACrBN,oBAAoB,EACpBO,aAAa,KAEV3F,EAAO,CAAC,OAAQ,oBAAoBC,KAAKjD"}
@@ -1,2 +1,2 @@
1
- import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import{CoreProvider as s}from"../../core/Context/CoreProvider.js";import{CashAppComponent as o}from"./components/CashAppComponent.js";import r from"./services/CashAppService.js";import{CashAppSdkLoader as a}from"./services/CashAppSdkLoader.js";import n from"./defaultProps.js";import i from"../internal/RedirectButton/RedirectButton.js";import"../../external/classnames/index.js";import{payAmountLabel as p}from"../internal/PayButton/utils.js";import{TxVariants as h}from"../tx-variants.js";import{PREFIX as d}from"../internal/Icon/constants.js";class c extends e{static type=h.cashapp;cashAppService;static defaultProps=n;constructor(t,e){super(t,e),this.props.enableStoreDetails&&this.props.storePaymentMethod&&console.warn("CashAppPay: enableStoreDetails AND storePaymentMethod configuration properties should not be used together. That can lead to undesired behavior."),this.props.storedPaymentMethodId||(this.cashAppService=new r(new a,{storePaymentMethod:this.props.storePaymentMethod,useCashAppButtonUi:this.props.showPayButton,environment:this.props.environment,amount:this.props.amount,redirectURL:this.props.redirectURL,clientId:this.props.configuration?.clientId,scopeId:this.props.configuration?.scopeId,button:this.props.button,referenceId:this.props.referenceId}))}formatProps(t){return{...t,enableStoreDetails:t.session?.configuration?.enableStoreDetails||t.enableStoreDetails}}formatData(){const{shopperWantsToStore:t,grantId:e,onFileGrantId:s,cashTag:o,customerId:r}=this.state.data||{},{storePaymentMethod:a,storedPaymentMethodId:n}=this.props,i=this.props.enableStoreDetails||!this.props.session&&a;if(n)return{paymentMethod:{type:c.type,storedPaymentMethodId:n}};return{paymentMethod:{type:c.type,...e&&{grantId:e},...r&&{customerId:r},...s&&o&&{onFileGrantId:s,cashtag:o}},...i&&{storePaymentMethod:a||t}}}get displayName(){return this.props.storedPaymentMethodId&&this.props.cashtag?this.props.cashtag:this.props.name}get additionalInfo(){return this.props.storedPaymentMethodId?"Cash App Pay":""}submit=()=>{const{onClick:t,storedPaymentMethodId:e}=this.props;if(e)return void super.submit();let s=!1;new Promise(((e,s)=>t({resolve:e,reject:s}))).catch((()=>{throw s=!0,Error("onClick rejected")})).then((()=>this.cashAppService.createCustomerRequest())).then((()=>{this.cashAppService.begin()})).catch((t=>{s||this.handleError(t)}))};get isValid(){return!0}handleOnChangeStoreDetails=t=>{const e={...this.state.data,shopperWantsToStore:t};this.setState({data:e})};handleAuthorize=t=>{const e={...this.state.data,...t};this.setState({data:e,valid:{},errors:{},isValid:!0}),super.submit()};render(){return t(s,{i18n:this.props.i18n,resources:this.resources,loadingContext:this.props.loadingContext},this.props.storedPaymentMethodId?t(i,{showPayButton:this.props.showPayButton,label:p(this.props.i18n,this.props.amount),icon:this.resources?.getImage({imageFolder:"components/"})(`${d}lock`),name:this.displayName,amount:this.props.amount,payButton:this.payButton,onSubmit:this.submit,ref:t=>{this.componentRef=t}}):t(o,{ref:t=>{this.componentRef=t},enableStoreDetails:this.props.enableStoreDetails,cashAppService:this.cashAppService,onChangeStoreDetails:this.handleOnChangeStoreDetails,onError:this.handleError,onClick:this.submit,onAuthorize:this.handleAuthorize}))}}export{c as CashAppPay,c as default};
1
+ import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import{CoreProvider as s}from"../../core/Context/CoreProvider.js";import{CashAppComponent as o}from"./components/CashAppComponent.js";import r from"./services/CashAppService.js";import{CashAppSdkLoader as n}from"./services/CashAppSdkLoader.js";import i from"./defaultProps.js";import a from"../internal/RedirectButton/RedirectButton.js";import"../internal/Button/Button.js";import{payAmountLabel as p}from"../internal/PayButton/utils.js";import{TxVariants as h}from"../tx-variants.js";import{PREFIX as d}from"../internal/Icon/constants.js";function c(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}class m extends e{formatProps(t){return{...t,enableStoreDetails:t.session?.configuration?.enableStoreDetails||t.enableStoreDetails}}formatData(){const{shopperWantsToStore:t,grantId:e,onFileGrantId:s,cashTag:o,customerId:r}=this.state.data||{},{storePaymentMethod:n,storedPaymentMethodId:i}=this.props,a=this.props.enableStoreDetails||!this.props.session&&n;if(i)return{paymentMethod:{type:m.type,storedPaymentMethodId:i}};return{paymentMethod:{type:m.type,...e&&{grantId:e},...r&&{customerId:r},...s&&o&&{onFileGrantId:s,cashtag:o}},...a&&{storePaymentMethod:n||t}}}get displayName(){return this.props.storedPaymentMethodId&&this.props.cashtag?this.props.cashtag:this.props.name}get additionalInfo(){return this.props.storedPaymentMethodId?"Cash App Pay":""}get isValid(){return!0}render(){return t(s,{i18n:this.props.i18n,resources:this.resources,loadingContext:this.props.loadingContext},this.props.storedPaymentMethodId?t(a,{showPayButton:this.props.showPayButton,label:p(this.props.i18n,this.props.amount),icon:this.resources?.getImage({imageFolder:"components/"})(`${d}lock`),name:this.displayName,amount:this.props.amount,payButton:this.payButton,onSubmit:this.submit,ref:t=>{this.componentRef=t}}):t(o,{ref:t=>{this.componentRef=t},enableStoreDetails:this.props.enableStoreDetails,cashAppService:this.cashAppService,onChangeStoreDetails:this.handleOnChangeStoreDetails,onError:this.handleError,onClick:this.submit,onAuthorize:this.handleAuthorize}))}constructor(t,e){super(t,e),c(this,"cashAppService",void 0),c(this,"submit",(()=>{const{onClick:t,storedPaymentMethodId:e}=this.props;if(e)return void super.submit();let s=!1;new Promise(((e,s)=>t({resolve:e,reject:s}))).catch((()=>{throw s=!0,Error("onClick rejected")})).then((()=>this.cashAppService.createCustomerRequest())).then((()=>{this.cashAppService.begin()})).catch((t=>{s||this.handleError(t)}))})),c(this,"handleOnChangeStoreDetails",(t=>{const e={...this.state.data,shopperWantsToStore:t};this.setState({data:e})})),c(this,"handleAuthorize",(t=>{const e={...this.state.data,...t};this.setState({data:e,valid:{},errors:{},isValid:!0}),super.submit()})),this.props.enableStoreDetails&&this.props.storePaymentMethod&&console.warn("CashAppPay: enableStoreDetails AND storePaymentMethod configuration properties should not be used together. That can lead to undesired behavior."),this.props.storedPaymentMethodId||(this.cashAppService=new r(new n,{storePaymentMethod:this.props.storePaymentMethod,useCashAppButtonUi:this.props.showPayButton,environment:this.props.environment,amount:this.props.amount,redirectURL:this.props.redirectURL,clientId:this.props.configuration?.clientId,scopeId:this.props.configuration?.scopeId,button:this.props.button,referenceId:this.props.referenceId}))}}c(m,"type",h.cashapp),c(m,"defaultProps",i);export{m as CashAppPay,m as default};
2
2
  //# sourceMappingURL=CashAppPay.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CashAppPay.js","sources":["../../../../src/components/CashAppPay/CashAppPay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport { CashAppComponent } from './components/CashAppComponent';\nimport CashAppService from './services/CashAppService';\nimport { CashAppSdkLoader } from './services/CashAppSdkLoader';\nimport { CashAppPayElementData, CashAppPayConfiguration, CashAppPayEventData } from './types';\nimport { ICashAppService } from './services/types';\nimport defaultProps from './defaultProps';\nimport RedirectButton from '../internal/RedirectButton';\nimport { payAmountLabel } from '../internal/PayButton';\nimport { TxVariants } from '../tx-variants';\nimport type { ICore } from '../../core/types';\nimport { PREFIX } from '../internal/Icon/constants';\n\nexport class CashAppPay extends UIElement<CashAppPayConfiguration> {\n public static type = TxVariants.cashapp;\n\n private readonly cashAppService: ICashAppService | undefined;\n\n protected static defaultProps = defaultProps;\n\n constructor(checkout: ICore, props?: CashAppPayConfiguration) {\n super(checkout, props);\n\n if (this.props.enableStoreDetails && this.props.storePaymentMethod) {\n console.warn(\n 'CashAppPay: enableStoreDetails AND storePaymentMethod configuration properties should not be used together. That can lead to undesired behavior.'\n );\n }\n\n if (this.props.storedPaymentMethodId) {\n return;\n }\n\n this.cashAppService = new CashAppService(new CashAppSdkLoader(), {\n storePaymentMethod: this.props.storePaymentMethod,\n useCashAppButtonUi: this.props.showPayButton,\n environment: this.props.environment,\n amount: this.props.amount,\n redirectURL: this.props.redirectURL,\n clientId: this.props.configuration?.clientId,\n scopeId: this.props.configuration?.scopeId,\n button: this.props.button,\n referenceId: this.props.referenceId\n });\n }\n\n public formatProps(props: CashAppPayConfiguration) {\n return {\n ...props,\n enableStoreDetails: props.session?.configuration?.enableStoreDetails || props.enableStoreDetails\n };\n }\n\n public formatData(): CashAppPayElementData {\n const { shopperWantsToStore, grantId, onFileGrantId, cashTag, customerId } = this.state.data || {};\n const { storePaymentMethod: storePaymentMethodSetByMerchant, storedPaymentMethodId } = this.props;\n\n /**\n * We include 'storePaymentMethod' flag if we either Display the Checkbox OR if it is non-sessions flow AND the merchant wants to store the payment method\n */\n const includeStorePaymentMethod = this.props.enableStoreDetails || (!this.props.session && storePaymentMethodSetByMerchant);\n\n if (storedPaymentMethodId) {\n return {\n paymentMethod: {\n type: CashAppPay.type,\n storedPaymentMethodId\n }\n };\n }\n\n const shouldAddOnFileProperties = onFileGrantId && cashTag;\n\n return {\n paymentMethod: {\n type: CashAppPay.type,\n ...(grantId && { grantId }),\n ...(customerId && { customerId }),\n ...(shouldAddOnFileProperties && { onFileGrantId, cashtag: cashTag })\n },\n ...(includeStorePaymentMethod && { storePaymentMethod: storePaymentMethodSetByMerchant || shopperWantsToStore })\n };\n }\n\n get displayName() {\n if (this.props.storedPaymentMethodId && this.props.cashtag) {\n return this.props.cashtag;\n }\n return this.props.name;\n }\n\n get additionalInfo() {\n return this.props.storedPaymentMethodId ? 'Cash App Pay' : '';\n }\n\n public submit = () => {\n const { onClick, storedPaymentMethodId } = this.props;\n\n if (storedPaymentMethodId) {\n super.submit();\n return;\n }\n\n let onClickPromiseRejected = false;\n\n new Promise<void>((resolve, reject) => onClick({ resolve, reject }))\n .catch(() => {\n onClickPromiseRejected = true;\n throw Error('onClick rejected');\n })\n .then(() => {\n return this.cashAppService.createCustomerRequest();\n })\n .then(() => {\n this.cashAppService.begin();\n })\n .catch(error => {\n if (onClickPromiseRejected) {\n // Swallow exception triggered by onClick reject\n return;\n }\n this.handleError(error);\n });\n };\n\n public get isValid(): boolean {\n return true;\n }\n\n private handleOnChangeStoreDetails = (storePayment: boolean) => {\n const data = { ...this.state.data, shopperWantsToStore: storePayment };\n this.setState({ data });\n };\n\n private handleAuthorize = (cashAppPaymentData: CashAppPayEventData): void => {\n const data = { ...this.state.data, ...cashAppPaymentData };\n this.setState({ data, valid: {}, errors: {}, isValid: true });\n super.submit();\n };\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} resources={this.resources} loadingContext={this.props.loadingContext}>\n {this.props.storedPaymentMethodId ? (\n <RedirectButton\n showPayButton={this.props.showPayButton}\n label={payAmountLabel(this.props.i18n, this.props.amount)}\n icon={this.resources?.getImage({ imageFolder: 'components/' })(`${PREFIX}lock`)}\n name={this.displayName}\n amount={this.props.amount}\n payButton={this.payButton}\n onSubmit={this.submit}\n ref={ref => {\n this.componentRef = ref;\n }}\n />\n ) : (\n <CashAppComponent\n ref={ref => {\n this.componentRef = ref;\n }}\n enableStoreDetails={this.props.enableStoreDetails}\n cashAppService={this.cashAppService}\n onChangeStoreDetails={this.handleOnChangeStoreDetails}\n onError={this.handleError}\n onClick={this.submit}\n onAuthorize={this.handleAuthorize}\n />\n )}\n </CoreProvider>\n );\n }\n}\n\nexport default CashAppPay;\n"],"names":["CashAppPay","UIElement","static","TxVariants","cashapp","cashAppService","defaultProps","constructor","checkout","props","super","this","enableStoreDetails","storePaymentMethod","console","warn","storedPaymentMethodId","CashAppService","CashAppSdkLoader","useCashAppButtonUi","showPayButton","environment","amount","redirectURL","clientId","configuration","scopeId","button","referenceId","formatProps","session","formatData","shopperWantsToStore","grantId","onFileGrantId","cashTag","customerId","state","data","storePaymentMethodSetByMerchant","includeStorePaymentMethod","paymentMethod","type","cashtag","displayName","name","additionalInfo","submit","onClick","onClickPromiseRejected","Promise","resolve","reject","catch","Error","then","createCustomerRequest","begin","error","handleError","isValid","handleOnChangeStoreDetails","storePayment","setState","handleAuthorize","cashAppPaymentData","valid","errors","render","h","CoreProvider","i18n","resources","loadingContext","RedirectButton","label","payAmountLabel","icon","getImage","imageFolder","PREFIX","payButton","onSubmit","ref","componentRef","CashAppComponent","onChangeStoreDetails","onError","onAuthorize"],"mappings":"sqBAeO,MAAMA,UAAmBC,EAC5BC,YAAqBC,EAAWC,QAEfC,eAEjBH,oBAAgCI,EAEhCC,WAAAA,CAAYC,EAAiBC,GACzBC,MAAMF,EAAUC,GAEZE,KAAKF,MAAMG,oBAAsBD,KAAKF,MAAMI,oBAC5CC,QAAQC,KACJ,oJAIJJ,KAAKF,MAAMO,wBAIfL,KAAKN,eAAiB,IAAIY,EAAe,IAAIC,EAAoB,CAC7DL,mBAAoBF,KAAKF,MAAMI,mBAC/BM,mBAAoBR,KAAKF,MAAMW,cAC/BC,YAAaV,KAAKF,MAAMY,YACxBC,OAAQX,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],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport { CashAppComponent } from './components/CashAppComponent';\nimport CashAppService from './services/CashAppService';\nimport { CashAppSdkLoader } from './services/CashAppSdkLoader';\nimport { CashAppPayElementData, CashAppPayConfiguration, CashAppPayEventData } from './types';\nimport { ICashAppService } from './services/types';\nimport defaultProps from './defaultProps';\nimport RedirectButton from '../internal/RedirectButton';\nimport { payAmountLabel } from '../internal/PayButton';\nimport { TxVariants } from '../tx-variants';\nimport type { ICore } from '../../core/types';\nimport { PREFIX } from '../internal/Icon/constants';\n\nexport class CashAppPay extends UIElement<CashAppPayConfiguration> {\n public static type = TxVariants.cashapp;\n\n private readonly cashAppService: ICashAppService | undefined;\n\n protected static defaultProps = defaultProps;\n\n constructor(checkout: ICore, props?: CashAppPayConfiguration) {\n super(checkout, props);\n\n if (this.props.enableStoreDetails && this.props.storePaymentMethod) {\n console.warn(\n 'CashAppPay: enableStoreDetails AND storePaymentMethod configuration properties should not be used together. That can lead to undesired behavior.'\n );\n }\n\n if (this.props.storedPaymentMethodId) {\n return;\n }\n\n this.cashAppService = new CashAppService(new CashAppSdkLoader(), {\n storePaymentMethod: this.props.storePaymentMethod,\n useCashAppButtonUi: this.props.showPayButton,\n environment: this.props.environment,\n amount: this.props.amount,\n redirectURL: this.props.redirectURL,\n clientId: this.props.configuration?.clientId,\n scopeId: this.props.configuration?.scopeId,\n button: this.props.button,\n referenceId: this.props.referenceId\n });\n }\n\n public formatProps(props: CashAppPayConfiguration) {\n return {\n ...props,\n enableStoreDetails: props.session?.configuration?.enableStoreDetails || props.enableStoreDetails\n };\n }\n\n public formatData(): CashAppPayElementData {\n const { shopperWantsToStore, grantId, onFileGrantId, cashTag, customerId } = this.state.data || {};\n const { storePaymentMethod: storePaymentMethodSetByMerchant, storedPaymentMethodId } = this.props;\n\n /**\n * We include 'storePaymentMethod' flag if we either Display the Checkbox OR if it is non-sessions flow AND the merchant wants to store the payment method\n */\n const includeStorePaymentMethod = this.props.enableStoreDetails || (!this.props.session && storePaymentMethodSetByMerchant);\n\n if (storedPaymentMethodId) {\n return {\n paymentMethod: {\n type: CashAppPay.type,\n storedPaymentMethodId\n }\n };\n }\n\n const shouldAddOnFileProperties = onFileGrantId && cashTag;\n\n return {\n paymentMethod: {\n type: CashAppPay.type,\n ...(grantId && { grantId }),\n ...(customerId && { customerId }),\n ...(shouldAddOnFileProperties && { onFileGrantId, cashtag: cashTag })\n },\n ...(includeStorePaymentMethod && { storePaymentMethod: storePaymentMethodSetByMerchant || shopperWantsToStore })\n };\n }\n\n get displayName() {\n if (this.props.storedPaymentMethodId && this.props.cashtag) {\n return this.props.cashtag;\n }\n return this.props.name;\n }\n\n get additionalInfo() {\n return this.props.storedPaymentMethodId ? 'Cash App Pay' : '';\n }\n\n public submit = () => {\n const { onClick, storedPaymentMethodId } = this.props;\n\n if (storedPaymentMethodId) {\n super.submit();\n return;\n }\n\n let onClickPromiseRejected = false;\n\n new Promise<void>((resolve, reject) => onClick({ resolve, reject }))\n .catch(() => {\n onClickPromiseRejected = true;\n throw Error('onClick rejected');\n })\n .then(() => {\n return this.cashAppService.createCustomerRequest();\n })\n .then(() => {\n this.cashAppService.begin();\n })\n .catch(error => {\n if (onClickPromiseRejected) {\n // Swallow exception triggered by onClick reject\n return;\n }\n this.handleError(error);\n });\n };\n\n public get isValid(): boolean {\n return true;\n }\n\n private handleOnChangeStoreDetails = (storePayment: boolean) => {\n const data = { ...this.state.data, shopperWantsToStore: storePayment };\n this.setState({ data });\n };\n\n private handleAuthorize = (cashAppPaymentData: CashAppPayEventData): void => {\n const data = { ...this.state.data, ...cashAppPaymentData };\n this.setState({ data, valid: {}, errors: {}, isValid: true });\n super.submit();\n };\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} resources={this.resources} loadingContext={this.props.loadingContext}>\n {this.props.storedPaymentMethodId ? (\n <RedirectButton\n showPayButton={this.props.showPayButton}\n label={payAmountLabel(this.props.i18n, this.props.amount)}\n icon={this.resources?.getImage({ imageFolder: 'components/' })(`${PREFIX}lock`)}\n name={this.displayName}\n amount={this.props.amount}\n payButton={this.payButton}\n onSubmit={this.submit}\n ref={ref => {\n this.componentRef = ref;\n }}\n />\n ) : (\n <CashAppComponent\n ref={ref => {\n this.componentRef = ref;\n }}\n enableStoreDetails={this.props.enableStoreDetails}\n cashAppService={this.cashAppService}\n onChangeStoreDetails={this.handleOnChangeStoreDetails}\n onError={this.handleError}\n onClick={this.submit}\n onAuthorize={this.handleAuthorize}\n />\n )}\n </CoreProvider>\n );\n }\n}\n\nexport default CashAppPay;\n"],"names":["CashAppPay","UIElement","formatProps","props","enableStoreDetails","session","configuration","formatData","shopperWantsToStore","grantId","onFileGrantId","cashTag","customerId","this","state","data","storePaymentMethod","storePaymentMethodSetByMerchant","storedPaymentMethodId","includeStorePaymentMethod","paymentMethod","type","cashtag","displayName","name","additionalInfo","isValid","render","h","CoreProvider","i18n","resources","loadingContext","RedirectButton","showPayButton","label","payAmountLabel","amount","icon","getImage","imageFolder","PREFIX","payButton","onSubmit","submit","ref","componentRef","CashAppComponent","cashAppService","onChangeStoreDetails","handleOnChangeStoreDetails","onError","handleError","onClick","onAuthorize","handleAuthorize","constructor","checkout","super","_define_property","onClickPromiseRejected","Promise","resolve","reject","catch","Error","then","createCustomerRequest","begin","error","storePayment","setState","cashAppPaymentData","valid","errors","console","warn","CashAppService","CashAppSdkLoader","useCashAppButtonUi","environment","redirectURL","clientId","scopeId","button","referenceId","TxVariants","cashapp","defaultProps"],"mappings":"wxBAeO,MAAMA,UAAmBC,EAiCrBC,WAAAA,CAAYC,GACf,MAAO,IACAA,EACHC,mBAAoBD,EAAME,SAASC,eAAeF,oBAAsBD,EAAMC,mBAEtF,CAEOG,UAAAA,GACH,MAAMC,oBAAEA,EAAmBC,QAAEA,EAAOC,cAAEA,EAAaC,QAAEA,EAAOC,WAAEA,GAAeC,KAAKC,MAAMC,MAAQ,IACx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AAStE,KAAKV,MAAMG,eAAe6E,QACnCC,OAAQvE,KAAKV,MAAMiF,OACnBC,YAAaxE,KAAKV,MAAMkF,cAEhC,EA9BA1B,EADS3D,EACKqB,OAAOiE,EAAWC,SAIhC5B,EALS3D,EAKQwF,eAAeA"}
@@ -1,2 +1,2 @@
1
- import t from"../../../core/Errors/AdyenCheckoutError.js";class e{sdkLoader;configuration;pay;startAuthorization;constructor(t,e){this.configuration=e,this.sdkLoader=t,e.clientId||console.warn("CashAppService: clientId is missing")}get hasOneTimePayment(){const{amount:t}=this.configuration;return t?.value>0}get hasOnFilePayment(){return this.configuration.storePaymentMethod}setStorePaymentMethod(t){this.configuration.storePaymentMethod=t}async initialize(){try{const{environment:t,clientId:e}=this.configuration,n=await this.sdkLoader.load(t);this.pay=await n.pay({clientId:e})}catch(e){throw new t("ERROR","Error during initialization",{cause:e})}}async renderButton(e){try{const{button:t,useCashAppButtonUi:n}=this.configuration,{begin:i}=await this.pay.render(e,{manage:!1,button:!!n&&{width:"full",shape:"semiround",...t}});this.startAuthorization=i}catch(e){throw new t("ERROR","Error rendering CashAppPay button",{cause:e})}}begin(){this.startAuthorization?this.startAuthorization():console.warn("CashAppService - begin() not available")}subscribeToEvent(t,e){return this.pay.addEventListener(t,e),()=>{this.pay.removeEventListener(t,e)}}async createCustomerRequest(){try{const{referenceId:t,amount:e,scopeId:n,redirectURL:i=window.location.href}=this.configuration,a={referenceId:t,redirectURL:i,actions:{...this.hasOneTimePayment&&{payment:{amount:e,scopeId:n}},...this.hasOnFilePayment&&{onFile:{scopeId:n}}}};await this.pay.customerRequest(a)}catch(e){throw new t("ERROR","Something went wrong during customerRequest creation",{cause:e})}}async restart(){await this.pay.restart()}}export{e as default};
1
+ import t from"../../../core/Errors/AdyenCheckoutError.js";function e(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}class i{get hasOneTimePayment(){const{amount:t}=this.configuration;return t?.value>0}get hasOnFilePayment(){return this.configuration.storePaymentMethod}setStorePaymentMethod(t){this.configuration.storePaymentMethod=t}async initialize(){try{const{environment:t,clientId:e}=this.configuration,i=await this.sdkLoader.load(t);this.pay=await i.pay({clientId:e})}catch(e){throw new t("ERROR","Error during initialization",{cause:e})}}async renderButton(e){try{const{button:t,useCashAppButtonUi:i}=this.configuration,{begin:n}=await this.pay.render(e,{manage:!1,button:!!i&&{width:"full",shape:"semiround",...t}});this.startAuthorization=n}catch(e){throw new t("ERROR","Error rendering CashAppPay button",{cause:e})}}begin(){this.startAuthorization?this.startAuthorization():console.warn("CashAppService - begin() not available")}subscribeToEvent(t,e){return this.pay.addEventListener(t,e),()=>{this.pay.removeEventListener(t,e)}}async createCustomerRequest(){try{const{referenceId:t,amount:e,scopeId:i,redirectURL:n=window.location.href}=this.configuration,r={referenceId:t,redirectURL:n,actions:{...this.hasOneTimePayment&&{payment:{amount:e,scopeId:i}},...this.hasOnFilePayment&&{onFile:{scopeId:i}}}};await this.pay.customerRequest(r)}catch(e){throw new t("ERROR","Something went wrong during customerRequest creation",{cause:e})}}async restart(){await this.pay.restart()}constructor(t,i){e(this,"sdkLoader",void 0),e(this,"configuration",void 0),e(this,"pay",void 0),e(this,"startAuthorization",void 0),this.configuration=i,this.sdkLoader=t,i.clientId||console.warn("CashAppService: clientId is missing")}}export{i as default};
2
2
  //# sourceMappingURL=CashAppService.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CashAppService.js","sources":["../../../../../src/components/CashAppPay/services/CashAppService.ts"],"sourcesContent":["import { ICashAppSdkLoader } from './CashAppSdkLoader';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { CashAppPayEvents, CashAppServiceConfig, ICashAppSDK, ICashAppService } from './types';\n\nexport default class CashAppService implements ICashAppService {\n private readonly sdkLoader: ICashAppSdkLoader;\n private readonly configuration: CashAppServiceConfig;\n\n private pay: ICashAppSDK;\n\n /**\n * Reference to CashApp 'begin' method\n */\n private startAuthorization?: () => void;\n\n constructor(sdkLoader: ICashAppSdkLoader, configuration: CashAppServiceConfig) {\n this.configuration = configuration;\n this.sdkLoader = sdkLoader;\n\n if (!configuration.clientId) {\n console.warn('CashAppService: clientId is missing');\n }\n }\n\n get hasOneTimePayment() {\n const { amount } = this.configuration;\n return amount?.value > 0;\n }\n\n get hasOnFilePayment() {\n return this.configuration.storePaymentMethod;\n }\n\n public setStorePaymentMethod(store: boolean) {\n this.configuration.storePaymentMethod = store;\n }\n\n public async initialize(): Promise<void> {\n try {\n const { environment, clientId } = this.configuration;\n const cashApp = await this.sdkLoader.load(environment);\n this.pay = await cashApp.pay({ clientId });\n } catch (error) {\n throw new AdyenCheckoutError('ERROR', 'Error during initialization', { cause: error });\n }\n }\n\n public async renderButton(target: HTMLElement): Promise<void> {\n try {\n const { button, useCashAppButtonUi } = this.configuration;\n\n const { begin } = await this.pay.render(target, {\n manage: false,\n button: useCashAppButtonUi ? { width: 'full', shape: 'semiround', ...button } : false\n });\n this.startAuthorization = begin;\n } catch (error) {\n throw new AdyenCheckoutError('ERROR', 'Error rendering CashAppPay button', { cause: error });\n }\n }\n\n public begin(): void {\n if (!this.startAuthorization) console.warn('CashAppService - begin() not available');\n else this.startAuthorization();\n }\n\n public subscribeToEvent(eventType: CashAppPayEvents, callback: Function): Function {\n this.pay.addEventListener(eventType, callback);\n return () => {\n this.pay.removeEventListener(eventType, callback);\n };\n }\n\n public async createCustomerRequest(): Promise<void> {\n try {\n const { referenceId, amount, scopeId, redirectURL = window.location.href } = this.configuration;\n\n const customerRequest = {\n referenceId,\n redirectURL,\n actions: {\n ...(this.hasOneTimePayment && {\n payment: {\n amount,\n scopeId\n }\n }),\n ...(this.hasOnFilePayment && {\n onFile: {\n scopeId\n }\n })\n }\n };\n await this.pay.customerRequest(customerRequest);\n } catch (error) {\n throw new AdyenCheckoutError('ERROR', 'Something went wrong during customerRequest creation', { cause: error });\n }\n }\n\n public async restart(): Promise<void> {\n await this.pay.restart();\n }\n}\n"],"names":["CashAppService","sdkLoader","configuration","pay","startAuthorization","constructor","this","clientId","console","warn","hasOneTimePayment","amount","value","hasOnFilePayment","storePaymentMethod","setStorePaymentMethod","store","initialize","environment","cashApp","load","error","AdyenCheckoutError","cause","renderButton","target","button","useCashAppButtonUi","begin","render","manage","width","shape","subscribeToEvent","eventType","callback","addEventListener","removeEventListener","createCustomerRequest","referenceId","scopeId","redirectURL","window","location","href","customerRequest","actions","payment","onFile","restart"],"mappings":"0DAIe,MAAMA,EACAC,UACAC,cAETC,IAKRC,mBAEAC,WAAAA,CAAYJ,EAA8BC,GACtCI,KAAKJ,cAAgBA,EACrBI,KAAKL,UAAYA,EAEZC,EAAcK,UACfC,QAAQC,KAAK,sCAErB,CAEA,qBAAIC,GACA,MAAMC,OAAEA,GAAWL,KAAKJ,cACxB,OAAOS,GAAQC,MAAQ,CAC3B,CAEA,oBAAIC,GACA,OAAOP,KAAKJ,cAAcY,kBAC9B,CAEOC,qBAAAA,CAAsBC,GACzBV,KAAKJ,cAAcY,mBAAqBE,CAC5C,CAEA,gBAAaC,GACT,IACI,MAAMC,YAAEA,EAAWX,SAAEA,GAAaD,KAAKJ,cACjCiB,QAAgBb,KAAKL,UAAUmB,KAAKF,GAC1CZ,KAAKH,UAAYgB,EAAQhB,IAAI,CAAEI,YACnC,CAAE,MAAOc,GACL,MAAM,IAAIC,EAAmB,QAAS,8BAA+B,CAAEC,MAAOF,GAClF,CACJ,CAEA,kBAAaG,CAAaC,GACtB,IACI,MAAMC,OAAEA,EAAMC,mBAAEA,GAAuBrB,KAAKJ,eAEtC0B,MAAEA,SAAgBtB,KAAKH,IAAI0B,OAAOJ,EAAQ,CAC5CK,QAAQ,EACRJ,SAAQC,GAAqB,CAAEI,MAAO,OAAQC,MAAO,eAAgBN,KAEzEpB,KAAKF,mBAAqBwB,CAC9B,CAAE,MAAOP,GACL,MAAM,IAAIC,EAAmB,QAAS,oCAAqC,CAAEC,MAAOF,GACxF,CACJ,CAEOO,KAAAA,GACEtB,KAAKF,mBACLE,KAAKF,qBADoBI,QAAQC,KAAK,yCAE/C,CAEOwB,gBAAAA,CAAiBC,EAA6BC,GAEjD,OADA7B,KAAKH,IAAIiC,iBAAiBF,EAAWC,GAC9B,KACH7B,KAAKH,IAAIkC,oBAAoBH,EAAWC,EAAAA,CAEhD,CAEA,2BAAaG,GACT,IACI,MAAMC,YAAEA,EAAW5B,OAAEA,EAAM6B,QAAEA,EAAOC,YAAEA,EAAcC,OAAOC,SAASC,MAAStC,KAAKJ,cAE5E2C,EAAkB,CACpBN,cACAE,cACAK,QAAS,IACDxC,KAAKI,mBAAqB,CAC1BqC,QAAS,CACLpC,SACA6B,eAGJlC,KAAKO,kBAAoB,CACzBmC,OAAQ,CACJR,oBAKVlC,KAAKH,IAAI0C,gBAAgBA,EACnC,CAAE,MAAOxB,GACL,MAAM,IAAIC,EAAmB,QAAS,uDAAwD,CAAEC,MAAOF,GAC3G,CACJ,CAEA,aAAa4B,SACH3C,KAAKH,IAAI8C,SACnB"}
1
+ {"version":3,"file":"CashAppService.js","sources":["../../../../../src/components/CashAppPay/services/CashAppService.ts"],"sourcesContent":["import { ICashAppSdkLoader } from './CashAppSdkLoader';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { CashAppPayEvents, CashAppServiceConfig, ICashAppSDK, ICashAppService } from './types';\n\nexport default class CashAppService implements ICashAppService {\n private readonly sdkLoader: ICashAppSdkLoader;\n private readonly configuration: CashAppServiceConfig;\n\n private pay: ICashAppSDK;\n\n /**\n * Reference to CashApp 'begin' method\n */\n private startAuthorization?: () => void;\n\n constructor(sdkLoader: ICashAppSdkLoader, configuration: CashAppServiceConfig) {\n this.configuration = configuration;\n this.sdkLoader = sdkLoader;\n\n if (!configuration.clientId) {\n console.warn('CashAppService: clientId is missing');\n }\n }\n\n get hasOneTimePayment() {\n const { amount } = this.configuration;\n return amount?.value > 0;\n }\n\n get hasOnFilePayment() {\n return this.configuration.storePaymentMethod;\n }\n\n public setStorePaymentMethod(store: boolean) {\n this.configuration.storePaymentMethod = store;\n }\n\n public async initialize(): Promise<void> {\n try {\n const { environment, clientId } = this.configuration;\n const cashApp = await this.sdkLoader.load(environment);\n this.pay = await cashApp.pay({ clientId });\n } catch (error) {\n throw new AdyenCheckoutError('ERROR', 'Error during initialization', { cause: error });\n }\n }\n\n public async renderButton(target: HTMLElement): Promise<void> {\n try {\n const { button, useCashAppButtonUi } = this.configuration;\n\n const { begin } = await this.pay.render(target, {\n manage: false,\n button: useCashAppButtonUi ? { width: 'full', shape: 'semiround', ...button } : false\n });\n this.startAuthorization = begin;\n } catch (error) {\n throw new AdyenCheckoutError('ERROR', 'Error rendering CashAppPay button', { cause: error });\n }\n }\n\n public begin(): void {\n if (!this.startAuthorization) console.warn('CashAppService - begin() not available');\n else this.startAuthorization();\n }\n\n public subscribeToEvent(eventType: CashAppPayEvents, callback: Function): Function {\n this.pay.addEventListener(eventType, callback);\n return () => {\n this.pay.removeEventListener(eventType, callback);\n };\n }\n\n public async createCustomerRequest(): Promise<void> {\n try {\n const { referenceId, amount, scopeId, redirectURL = window.location.href } = this.configuration;\n\n const customerRequest = {\n referenceId,\n redirectURL,\n actions: {\n ...(this.hasOneTimePayment && {\n payment: {\n amount,\n scopeId\n }\n }),\n ...(this.hasOnFilePayment && {\n onFile: {\n scopeId\n }\n })\n }\n };\n await this.pay.customerRequest(customerRequest);\n } catch (error) {\n throw new AdyenCheckoutError('ERROR', 'Something went wrong during customerRequest creation', { cause: error });\n }\n }\n\n public async restart(): Promise<void> {\n await this.pay.restart();\n }\n}\n"],"names":["CashAppService","hasOneTimePayment","amount","this","configuration","value","hasOnFilePayment","storePaymentMethod","setStorePaymentMethod","store","initialize","environment","clientId","cashApp","sdkLoader","load","pay","error","AdyenCheckoutError","cause","renderButton","target","button","useCashAppButtonUi","begin","render","manage","width","shape","startAuthorization","console","warn","subscribeToEvent","eventType","callback","addEventListener","removeEventListener","createCustomerRequest","referenceId","scopeId","redirectURL","window","location","href","customerRequest","actions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eAGJpC,KAAKG,kBAAoB,CACzByC,OAAQ,CACJR,oBAKVpC,KAAKa,IAAI4B,gBAAgBA,EACnC,CAAE,MAAO3B,GACL,MAAM,IAAIC,EAAmB,QAAS,uDAAwD,CAAEC,MAAOF,GAC3G,CACJ,CAEA,aAAa+B,SACH7C,KAAKa,IAAIgC,SACnB,CAvFAC,WAAAA,CAAYnC,EAA8BV,GAV1C8C,EAAA/C,KAAiBW,iBAAjB,GACAoC,EAAA/C,KAAiBC,qBAAjB,GAEA8C,EAAA/C,KAAQa,WAAR,GAKAkC,EAAA/C,KAAQ0B,0BAAR,GAGI1B,KAAKC,cAAgBA,EACrBD,KAAKW,UAAYA,EAEZV,EAAcQ,UACfkB,QAAQC,KAAK,sCAErB"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as o}from"../internal/UIElement/UIElement.js";import{CoreProvider as i}from"../../core/Context/CoreProvider.js";import t from"../../utils/browserInfo.js";import r from"../internal/ClickToPay/services/create-clicktopay-service.js";import{CtpState as s}from"../internal/ClickToPay/services/ClickToPayService.js";import n from"../internal/ClickToPay/context/ClickToPayProvider.js";import a from"../internal/ClickToPay/ClickToPayComponent.js";import c from"../../core/Errors/AdyenCheckoutError.js";import{TxVariants as l}from"../tx-variants.js";class p extends o{static type=l.clicktopay;clickToPayService;ctpConfiguration;constructor(e,o){super(e,o),this.ctpConfiguration={shopperEmail:this.props.shopperEmail,telephoneNumber:this.props.telephoneNumber,merchantDisplayName:this.props.merchantDisplayName,locale:this.props.locale,onReady:this.props.onReady,onTimeout:this.props.onTimeout},this.clickToPayService=r(this.props.configuration,this.ctpConfiguration,this.props.environment),this.clickToPayService?.initialize().catch((e=>{this.handleError(new c("ERROR",e.toString(),{cause:e}))})),this.clickToPayService||console.warn("ClickToPay not initialized - Likely the payment method is not configured or its configuration is missing")}get isValid(){return!0}get browserInfo(){return t()}formatData(){const{srcScheme:e,srcCorrelationId:o,srcTokenReference:i,srcCheckoutPayload:t,srcDigitalCardId:r}=this.state.data;return{paymentMethod:{type:p.type,...e&&{srcScheme:e},...o&&{srcCorrelationId:o},...i&&{srcTokenReference:i},...t&&{srcCheckoutPayload:t},...r&&{srcDigitalCardId:r}},browserInfo:this.browserInfo,origin:window?.location?.origin}}formatProps(e){return{...e,disableOtpAutoFocus:e.disableOtpAutoFocus||!1,shopperEmail:e.shopperEmail||this.core.options?.session?.shopperEmail,telephoneNumber:e.telephoneNumber||this.core.options?.session?.telephoneNumber,locale:e.locale||e.i18n?.locale?.replace("-","_")}}async isAvailable(){return this.clickToPayService?this.clickToPayService.shopperAccountFound?Promise.resolve():new Promise(((e,o)=>{this.clickToPayService.subscribeOnStateChange((i=>{this.clickToPayService.shopperAccountFound&&e(),i!==s.NotAvailable&&i!==s.Login&&i!==s.Idle||o()}))})):Promise.reject()}handleClickToPaySubmit=e=>{this.setState({data:{...e},valid:{},errors:{},isValid:!0}),this.submit()};render(){return e(i,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},e(n,{isStandaloneComponent:!0,configuration:this.ctpConfiguration,amount:this.props.amount,clickToPayService:this.clickToPayService,setClickToPayRef:this.setComponentRef,onSetStatus:this.setElementStatus,onSubmit:this.handleClickToPaySubmit,onError:this.handleError},e(a,null)))}}export{p as ClickToPayElement,p as default};
1
+ import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as o}from"../internal/UIElement/UIElement.js";import{CoreProvider as i}from"../../core/Context/CoreProvider.js";import t from"../../utils/browserInfo.js";import r from"../internal/ClickToPay/services/create-clicktopay-service.js";import{CtpState as s}from"../internal/ClickToPay/services/ClickToPayService.js";import n from"../internal/ClickToPay/context/ClickToPayProvider.js";import a from"../internal/ClickToPay/ClickToPayComponent.js";import c from"../../core/Errors/AdyenCheckoutError.js";import{TxVariants as l}from"../tx-variants.js";function p(e,o,i){return o in e?Object.defineProperty(e,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[o]=i,e}class h extends o{get isValid(){return!0}get browserInfo(){return t()}formatData(){const{srcScheme:e,srcCorrelationId:o,srcTokenReference:i,srcCheckoutPayload:t,srcDigitalCardId:r}=this.state.data;return{paymentMethod:{type:h.type,...e&&{srcScheme:e},...o&&{srcCorrelationId:o},...i&&{srcTokenReference:i},...t&&{srcCheckoutPayload:t},...r&&{srcDigitalCardId:r}},browserInfo:this.browserInfo,origin:window?.location?.origin}}formatProps(e){return{...e,disableOtpAutoFocus:e.disableOtpAutoFocus||!1,shopperEmail:e.shopperEmail||this.core.options?.session?.shopperEmail,telephoneNumber:e.telephoneNumber||this.core.options?.session?.telephoneNumber,locale:e.locale||e.i18n?.locale?.replace("-","_")}}async isAvailable(){return this.clickToPayService?this.clickToPayService.shopperAccountFound?Promise.resolve():new Promise(((e,o)=>{this.clickToPayService.subscribeOnStateChange((i=>{this.clickToPayService.shopperAccountFound&&e(),i!==s.NotAvailable&&i!==s.Login&&i!==s.Idle||o()}))})):Promise.reject()}render(){return e(i,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},e(n,{isStandaloneComponent:!0,configuration:this.ctpConfiguration,amount:this.props.amount,clickToPayService:this.clickToPayService,setClickToPayRef:this.setComponentRef,onSetStatus:this.setElementStatus,onSubmit:this.handleClickToPaySubmit,onError:this.handleError},e(a,null)))}constructor(e,o){super(e,o),p(this,"clickToPayService",void 0),p(this,"ctpConfiguration",void 0),p(this,"handleClickToPaySubmit",(e=>{this.setState({data:{...e},valid:{},errors:{},isValid:!0}),this.submit()})),this.ctpConfiguration={shopperEmail:this.props.shopperEmail,telephoneNumber:this.props.telephoneNumber,merchantDisplayName:this.props.merchantDisplayName,locale:this.props.locale,onReady:this.props.onReady,onTimeout:this.props.onTimeout},this.clickToPayService=r(this.props.configuration,this.ctpConfiguration,this.props.environment),this.clickToPayService?.initialize().catch((e=>{this.handleError(new c("ERROR",e.toString(),{cause:e}))})),this.clickToPayService||console.warn("ClickToPay not initialized - Likely the payment method is not configured or its configuration is missing")}}p(h,"type",l.clicktopay);export{h as ClickToPayElement,h as default};
2
2
  //# sourceMappingURL=ClickToPay.js.map