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

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 (442) hide show
  1. package/dist/cjs/adyen.css +10 -9
  2. package/dist/cjs/adyen.css.map +1 -1
  3. package/dist/cjs/index.cjs +2 -2
  4. package/dist/cjs/index.cjs.map +1 -1
  5. package/dist/cjs/index.d.cts +41 -29
  6. package/dist/es/adyen.css +10 -9
  7. package/dist/es/adyen.css.map +1 -1
  8. package/dist/es/components/Address/Address.js +1 -1
  9. package/dist/es/components/Address/Address.js.map +1 -1
  10. package/dist/es/components/BacsDD/components/BacsInput.js +1 -1
  11. package/dist/es/components/BacsDD/components/BacsInput.js.map +1 -1
  12. package/dist/es/components/Blik/components/BlikInput.js +1 -1
  13. package/dist/es/components/Blik/components/BlikInput.js.map +1 -1
  14. package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
  15. package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
  16. package/dist/es/components/Card/components/CardInput/defaultProps.js +1 -1
  17. package/dist/es/components/Card/components/CardInput/defaultProps.js.map +1 -1
  18. package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
  19. package/dist/es/components/Card/components/CardInput/utils.js +1 -1
  20. package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
  21. package/dist/es/components/CashAppPay/CashAppPay.js +1 -1
  22. package/dist/es/components/CashAppPay/CashAppPay.js.map +1 -1
  23. package/dist/es/components/CashAppPay/components/CashAppComponent.js +1 -1
  24. package/dist/es/components/CashAppPay/components/CashAppComponent.js.map +1 -1
  25. package/dist/es/components/Dropin/components/PaymentMethod/InstantPaymentMethods.js.map +1 -1
  26. package/dist/es/components/GooglePay/components/GooglePayButton.js +1 -1
  27. package/dist/es/components/GooglePay/components/GooglePayButton.js.map +1 -1
  28. package/dist/es/components/GooglePay/defaultProps.js +1 -1
  29. package/dist/es/components/GooglePay/defaultProps.js.map +1 -1
  30. package/dist/es/components/PersonalDetails/PersonalDetails.js +1 -1
  31. package/dist/es/components/PersonalDetails/PersonalDetails.js.map +1 -1
  32. package/dist/es/components/internal/Address/Address.js +1 -1
  33. package/dist/es/components/internal/Address/Address.js.map +1 -1
  34. package/dist/es/components/internal/ClickToPay/components/CtPCards/CtPCards.js +1 -1
  35. package/dist/es/components/internal/ClickToPay/components/CtPCards/CtPCards.js.map +1 -1
  36. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLogin.js +1 -1
  37. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLogin.js.map +1 -1
  38. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePassword.js +1 -1
  39. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePassword.js.map +1 -1
  40. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js +1 -1
  41. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js.map +1 -1
  42. package/dist/es/components/internal/ClickToPay/services/sdks/AbstractSrcInitiator.js.map +1 -1
  43. package/dist/es/components/internal/ClickToPay/services/sdks/MastercardSdk.js.map +1 -1
  44. package/dist/es/components/internal/ClickToPay/services/sdks/VisaSdk.js.map +1 -1
  45. package/dist/es/components/internal/ClickToPay/services/utils.js +1 -1
  46. package/dist/es/components/internal/ClickToPay/services/utils.js.map +1 -1
  47. package/dist/es/components/internal/CompanyDetails/CompanyDetails.js +1 -1
  48. package/dist/es/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
  49. package/dist/es/components/internal/FormFields/Field/Field.js +1 -1
  50. package/dist/es/components/internal/FormFields/Field/Field.js.map +1 -1
  51. package/dist/es/components/internal/FormFields/InputBase.js.map +1 -1
  52. package/dist/es/components/internal/FormFields/Select/components/SelectListItem.js +1 -1
  53. package/dist/es/components/internal/FormFields/Select/components/SelectListItem.js.map +1 -1
  54. package/dist/es/components/internal/Icon/constants.js +2 -0
  55. package/dist/es/components/internal/Icon/constants.js.map +1 -0
  56. package/dist/es/components/internal/OpenInvoice/OpenInvoice.js +1 -1
  57. package/dist/es/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  58. package/dist/es/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js +2 -0
  59. package/dist/es/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -0
  60. package/dist/es/components/internal/QRLoader/QRLoader.js +1 -1
  61. package/dist/es/components/internal/QRLoader/QRLoader.js.map +1 -1
  62. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  63. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  64. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
  65. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  66. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleEncryption.js +1 -1
  67. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleEncryption.js.map +1 -1
  68. package/dist/es/components/internal/SecuredFields/lib/constants.js +1 -1
  69. package/dist/es/components/internal/SecuredFields/lib/constants.js.map +1 -1
  70. package/dist/es/components/internal/UIElement/UIElement.js +1 -1
  71. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  72. package/dist/es/components/internal/Voucher/Voucher.js +1 -1
  73. package/dist/es/components/internal/Voucher/Voucher.js.map +1 -1
  74. package/dist/es/core/Analytics/Analytics.js +1 -1
  75. package/dist/es/core/Analytics/Analytics.js.map +1 -1
  76. package/dist/es/core/Analytics/constants.js +1 -1
  77. package/dist/es/core/Analytics/constants.js.map +1 -1
  78. package/dist/es/core/Analytics/utils.js.map +1 -1
  79. package/dist/es/core/Context/Resources.js +1 -1
  80. package/dist/es/core/Context/Resources.js.map +1 -1
  81. package/dist/es/core/Environment/Environment.js +1 -1
  82. package/dist/es/core/Environment/Environment.js.map +1 -1
  83. package/dist/es/core/Environment/constants.js +2 -0
  84. package/dist/es/core/Environment/constants.js.map +1 -0
  85. package/dist/es/core/Errors/SRMessages.js +1 -1
  86. package/dist/es/core/Errors/SRMessages.js.map +1 -1
  87. package/dist/es/core/Errors/SRPanel.js +1 -1
  88. package/dist/es/core/Errors/SRPanel.js.map +1 -1
  89. package/dist/es/core/Services/analytics/collect-id.js +1 -1
  90. package/dist/es/core/Services/analytics/collect-id.js.map +1 -1
  91. package/dist/es/core/Services/analytics/log-event.js +1 -1
  92. package/dist/es/core/Services/get-translations.js +1 -1
  93. package/dist/es/core/Services/get-translations.js.map +1 -1
  94. package/dist/es/core/core.defaultProps.js +1 -1
  95. package/dist/es/core/core.defaultProps.js.map +1 -1
  96. package/dist/es/core/core.js +1 -1
  97. package/dist/es/core/core.js.map +1 -1
  98. package/dist/es/core/core.registry.js +1 -1
  99. package/dist/es/core/core.registry.js.map +1 -1
  100. package/dist/es/core/utils.js +1 -1
  101. package/dist/es/core/utils.js.map +1 -1
  102. package/dist/es/external/preact/dist/preact.js +1 -1
  103. package/dist/es/external/preact/dist/preact.js.map +1 -1
  104. package/dist/es/external/preact/hooks/dist/hooks.js +1 -1
  105. package/dist/es/external/preact/hooks/dist/hooks.js.map +1 -1
  106. package/dist/es/index.d.ts +41 -29
  107. package/dist/es/utils/arrayUtils.js +1 -1
  108. package/dist/es/utils/arrayUtils.js.map +1 -1
  109. package/dist/es/utils/useForm/useForm.js +1 -1
  110. package/dist/es/utils/validator-utils.js +1 -1
  111. package/dist/es/utils/validator-utils.js.map +1 -1
  112. package/dist/es-legacy/adyen.css +10 -9
  113. package/dist/es-legacy/adyen.css.map +1 -1
  114. package/dist/es-legacy/components/ANCV/ANCV.js +1 -1
  115. package/dist/es-legacy/components/ANCV/ANCV.js.map +1 -1
  116. package/dist/es-legacy/components/Ach/Ach.js +1 -1
  117. package/dist/es-legacy/components/Ach/Ach.js.map +1 -1
  118. package/dist/es-legacy/components/Ach/components/AchInput/AchInput.js +1 -1
  119. package/dist/es-legacy/components/Ach/components/AchInput/AchInput.js.map +1 -1
  120. package/dist/es-legacy/components/Address/Address.js +1 -1
  121. package/dist/es-legacy/components/Address/Address.js.map +1 -1
  122. package/dist/es-legacy/components/Affirm/Affirm.js +1 -1
  123. package/dist/es-legacy/components/Affirm/Affirm.js.map +1 -1
  124. package/dist/es-legacy/components/AfterPay/AfterPay.js +1 -1
  125. package/dist/es-legacy/components/AfterPay/AfterPay.js.map +1 -1
  126. package/dist/es-legacy/components/AfterPay/AfterPayB2B.js +1 -1
  127. package/dist/es-legacy/components/AfterPay/AfterPayB2B.js.map +1 -1
  128. package/dist/es-legacy/components/AmazonPay/AmazonPay.js +1 -1
  129. package/dist/es-legacy/components/AmazonPay/AmazonPay.js.map +1 -1
  130. package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js +1 -1
  131. package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
  132. package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js +1 -1
  133. package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
  134. package/dist/es-legacy/components/AmazonPay/utils.js +1 -1
  135. package/dist/es-legacy/components/AmazonPay/utils.js.map +1 -1
  136. package/dist/es-legacy/components/ApplePay/ApplePay.js +1 -1
  137. package/dist/es-legacy/components/ApplePay/ApplePay.js.map +1 -1
  138. package/dist/es-legacy/components/Atome/Atome.js +1 -1
  139. package/dist/es-legacy/components/Atome/Atome.js.map +1 -1
  140. package/dist/es-legacy/components/Atome/config.js +1 -1
  141. package/dist/es-legacy/components/Atome/config.js.map +1 -1
  142. package/dist/es-legacy/components/BacsDD/BacsDD.js +1 -1
  143. package/dist/es-legacy/components/BacsDD/BacsDD.js.map +1 -1
  144. package/dist/es-legacy/components/BacsDD/components/BacsInput.js +1 -1
  145. package/dist/es-legacy/components/BacsDD/components/BacsInput.js.map +1 -1
  146. package/dist/es-legacy/components/BankTransfer/BankTransfer.js +1 -1
  147. package/dist/es-legacy/components/BankTransfer/BankTransfer.js.map +1 -1
  148. package/dist/es-legacy/components/BillDesk/BillDeskOnline.js +1 -1
  149. package/dist/es-legacy/components/BillDesk/BillDeskOnline.js.map +1 -1
  150. package/dist/es-legacy/components/BillDesk/BillDeskWallet.js +1 -1
  151. package/dist/es-legacy/components/BillDesk/BillDeskWallet.js.map +1 -1
  152. package/dist/es-legacy/components/Blik/Blik.js +1 -1
  153. package/dist/es-legacy/components/Blik/Blik.js.map +1 -1
  154. package/dist/es-legacy/components/Blik/components/BlikInput.js +1 -1
  155. package/dist/es-legacy/components/Blik/components/BlikInput.js.map +1 -1
  156. package/dist/es-legacy/components/Boleto/Boleto.js +1 -1
  157. package/dist/es-legacy/components/Boleto/Boleto.js.map +1 -1
  158. package/dist/es-legacy/components/Boleto/components/BoletoInput/BoletoInput.js +1 -1
  159. package/dist/es-legacy/components/Boleto/components/BoletoInput/BoletoInput.js.map +1 -1
  160. package/dist/es-legacy/components/Card/Bancontact.js +1 -1
  161. package/dist/es-legacy/components/Card/Bancontact.js.map +1 -1
  162. package/dist/es-legacy/components/Card/Card.js +1 -1
  163. package/dist/es-legacy/components/Card/Card.js.map +1 -1
  164. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
  165. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
  166. package/dist/es-legacy/components/Card/components/CardInput/components/IframeLabelAlternative.js +1 -1
  167. package/dist/es-legacy/components/Card/components/CardInput/components/IframeLabelAlternative.js.map +1 -1
  168. package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFields.js +1 -1
  169. package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFields.js.map +1 -1
  170. package/dist/es-legacy/components/Card/components/CardInput/defaultProps.js +1 -1
  171. package/dist/es-legacy/components/Card/components/CardInput/defaultProps.js.map +1 -1
  172. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  173. package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
  174. package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
  175. package/dist/es-legacy/components/CashAppPay/CashAppPay.js +1 -1
  176. package/dist/es-legacy/components/CashAppPay/CashAppPay.js.map +1 -1
  177. package/dist/es-legacy/components/CashAppPay/components/CashAppComponent.js +1 -1
  178. package/dist/es-legacy/components/CashAppPay/components/CashAppComponent.js.map +1 -1
  179. package/dist/es-legacy/components/ClickToPay/ClickToPay.js +1 -1
  180. package/dist/es-legacy/components/ClickToPay/ClickToPay.js.map +1 -1
  181. package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
  182. package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
  183. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  184. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  185. package/dist/es-legacy/components/Doku/Doku.js +1 -1
  186. package/dist/es-legacy/components/Doku/Doku.js.map +1 -1
  187. package/dist/es-legacy/components/Donation/Donation.js +1 -1
  188. package/dist/es-legacy/components/Donation/Donation.js.map +1 -1
  189. package/dist/es-legacy/components/Donation/components/DonationComponent.js +1 -1
  190. package/dist/es-legacy/components/Donation/components/DonationComponent.js.map +1 -1
  191. package/dist/es-legacy/components/Dragonpay/Dragonpay.js +1 -1
  192. package/dist/es-legacy/components/Dragonpay/Dragonpay.js.map +1 -1
  193. package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js +1 -1
  194. package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js.map +1 -1
  195. package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
  196. package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
  197. package/dist/es-legacy/components/Dropin/components/DropinComponent.js +1 -1
  198. package/dist/es-legacy/components/Dropin/components/DropinComponent.js.map +1 -1
  199. package/dist/es-legacy/components/Dropin/components/PaymentMethod/InstantPaymentMethods.js.map +1 -1
  200. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  201. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  202. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js +1 -1
  203. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js.map +1 -1
  204. package/dist/es-legacy/components/Dropin/elements/createInstantPaymentElements.js +1 -1
  205. package/dist/es-legacy/components/Dropin/elements/createInstantPaymentElements.js.map +1 -1
  206. package/dist/es-legacy/components/Dropin/elements/createStoredElements.js +1 -1
  207. package/dist/es-legacy/components/Dropin/elements/createStoredElements.js.map +1 -1
  208. package/dist/es-legacy/components/EPS/index.js +1 -1
  209. package/dist/es-legacy/components/EPS/index.js.map +1 -1
  210. package/dist/es-legacy/components/Econtext/Econtext.js +1 -1
  211. package/dist/es-legacy/components/Econtext/Econtext.js.map +1 -1
  212. package/dist/es-legacy/components/FacilyPay/FacilyPay10x.js +1 -1
  213. package/dist/es-legacy/components/FacilyPay/FacilyPay10x.js.map +1 -1
  214. package/dist/es-legacy/components/FacilyPay/FacilyPay12x.js +1 -1
  215. package/dist/es-legacy/components/FacilyPay/FacilyPay12x.js.map +1 -1
  216. package/dist/es-legacy/components/FacilyPay/FacilyPay3x.js +1 -1
  217. package/dist/es-legacy/components/FacilyPay/FacilyPay3x.js.map +1 -1
  218. package/dist/es-legacy/components/FacilyPay/FacilyPay4x.js +1 -1
  219. package/dist/es-legacy/components/FacilyPay/FacilyPay4x.js.map +1 -1
  220. package/dist/es-legacy/components/FacilyPay/FacilyPay6x.js +1 -1
  221. package/dist/es-legacy/components/FacilyPay/FacilyPay6x.js.map +1 -1
  222. package/dist/es-legacy/components/Giftcard/Giftcard.js +1 -1
  223. package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
  224. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js +1 -1
  225. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  226. package/dist/es-legacy/components/Giftcard/components/GiftcardFields.js +1 -1
  227. package/dist/es-legacy/components/Giftcard/components/GiftcardFields.js.map +1 -1
  228. package/dist/es-legacy/components/Giropay/Giropay.js +1 -1
  229. package/dist/es-legacy/components/Giropay/Giropay.js.map +1 -1
  230. package/dist/es-legacy/components/GooglePay/GooglePay.js +1 -1
  231. package/dist/es-legacy/components/GooglePay/GooglePay.js.map +1 -1
  232. package/dist/es-legacy/components/GooglePay/components/GooglePayButton.js +1 -1
  233. package/dist/es-legacy/components/GooglePay/components/GooglePayButton.js.map +1 -1
  234. package/dist/es-legacy/components/GooglePay/defaultProps.js +1 -1
  235. package/dist/es-legacy/components/GooglePay/defaultProps.js.map +1 -1
  236. package/dist/es-legacy/components/Klarna/KlarnaPayments.js +1 -1
  237. package/dist/es-legacy/components/Klarna/KlarnaPayments.js.map +1 -1
  238. package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js +1 -1
  239. package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js.map +1 -1
  240. package/dist/es-legacy/components/MBWay/MBWay.js +1 -1
  241. package/dist/es-legacy/components/MBWay/MBWay.js.map +1 -1
  242. package/dist/es-legacy/components/MBWay/components/MBWayInput/MBWayInput.js +1 -1
  243. package/dist/es-legacy/components/MBWay/components/MBWayInput/MBWayInput.js.map +1 -1
  244. package/dist/es-legacy/components/MealVoucherFR/MealVoucherFR.js +1 -1
  245. package/dist/es-legacy/components/MealVoucherFR/MealVoucherFR.js.map +1 -1
  246. package/dist/es-legacy/components/MealVoucherFR/components/MealVoucherFields.js +1 -1
  247. package/dist/es-legacy/components/MealVoucherFR/components/MealVoucherFields.js.map +1 -1
  248. package/dist/es-legacy/components/Multibanco/Multibanco.js +1 -1
  249. package/dist/es-legacy/components/Multibanco/Multibanco.js.map +1 -1
  250. package/dist/es-legacy/components/OnlineBankingCZ/index.js +1 -1
  251. package/dist/es-legacy/components/OnlineBankingCZ/index.js.map +1 -1
  252. package/dist/es-legacy/components/OnlineBankingIN/index.js +1 -1
  253. package/dist/es-legacy/components/OnlineBankingIN/index.js.map +1 -1
  254. package/dist/es-legacy/components/OnlineBankingPL/OnlineBankingPL.js +1 -1
  255. package/dist/es-legacy/components/OnlineBankingPL/OnlineBankingPL.js.map +1 -1
  256. package/dist/es-legacy/components/OnlineBankingSK/index.js +1 -1
  257. package/dist/es-legacy/components/OnlineBankingSK/index.js.map +1 -1
  258. package/dist/es-legacy/components/Oxxo/Oxxo.js +1 -1
  259. package/dist/es-legacy/components/Oxxo/Oxxo.js.map +1 -1
  260. package/dist/es-legacy/components/PayByBank/PayByBank.js +1 -1
  261. package/dist/es-legacy/components/PayByBank/PayByBank.js.map +1 -1
  262. package/dist/es-legacy/components/PayPal/Paypal.js +1 -1
  263. package/dist/es-legacy/components/PayPal/Paypal.js.map +1 -1
  264. package/dist/es-legacy/components/PayPal/components/PaypalButtons.js +1 -1
  265. package/dist/es-legacy/components/PayPal/components/PaypalButtons.js.map +1 -1
  266. package/dist/es-legacy/components/PayPal/components/PaypalComponent.js +1 -1
  267. package/dist/es-legacy/components/PayPal/components/PaypalComponent.js.map +1 -1
  268. package/dist/es-legacy/components/PayPal/utils/get-paypal-settings.js +1 -1
  269. package/dist/es-legacy/components/PayPal/utils/get-paypal-settings.js.map +1 -1
  270. package/dist/es-legacy/components/PayU/PayuCashcard.js +1 -1
  271. package/dist/es-legacy/components/PayU/PayuCashcard.js.map +1 -1
  272. package/dist/es-legacy/components/PayU/PayuNetBanking.js +1 -1
  273. package/dist/es-legacy/components/PayU/PayuNetBanking.js.map +1 -1
  274. package/dist/es-legacy/components/PersonalDetails/PersonalDetails.js +1 -1
  275. package/dist/es-legacy/components/PersonalDetails/PersonalDetails.js.map +1 -1
  276. package/dist/es-legacy/components/Pix/Pix.js +1 -1
  277. package/dist/es-legacy/components/Pix/Pix.js.map +1 -1
  278. package/dist/es-legacy/components/RatePay/RatePay.js +1 -1
  279. package/dist/es-legacy/components/RatePay/RatePay.js.map +1 -1
  280. package/dist/es-legacy/components/RatePay/RatePayDirectDebit.js +1 -1
  281. package/dist/es-legacy/components/RatePay/RatePayDirectDebit.js.map +1 -1
  282. package/dist/es-legacy/components/Redirect/Redirect.js +1 -1
  283. package/dist/es-legacy/components/Redirect/Redirect.js.map +1 -1
  284. package/dist/es-legacy/components/Riverty/Riverty.js +1 -1
  285. package/dist/es-legacy/components/Riverty/Riverty.js.map +1 -1
  286. package/dist/es-legacy/components/Sepa/Sepa.js +1 -1
  287. package/dist/es-legacy/components/Sepa/Sepa.js.map +1 -1
  288. package/dist/es-legacy/components/ThreeDS2/ThreeDS2Challenge.js +1 -1
  289. package/dist/es-legacy/components/ThreeDS2/ThreeDS2Challenge.js.map +1 -1
  290. package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js +1 -1
  291. package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  292. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  293. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  294. package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js +1 -1
  295. package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
  296. package/dist/es-legacy/components/Trustly/Trustly.js +1 -1
  297. package/dist/es-legacy/components/Trustly/Trustly.js.map +1 -1
  298. package/dist/es-legacy/components/Twint/Twint.js +1 -1
  299. package/dist/es-legacy/components/Twint/Twint.js.map +1 -1
  300. package/dist/es-legacy/components/UPI/UPI.js +1 -1
  301. package/dist/es-legacy/components/UPI/UPI.js.map +1 -1
  302. package/dist/es-legacy/components/WalletIN/index.js +1 -1
  303. package/dist/es-legacy/components/WalletIN/index.js.map +1 -1
  304. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
  305. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  306. package/dist/es-legacy/components/helpers/OpenInvoiceContainer/OpenInvoiceContainer.js +1 -1
  307. package/dist/es-legacy/components/helpers/OpenInvoiceContainer/OpenInvoiceContainer.js.map +1 -1
  308. package/dist/es-legacy/components/helpers/QRLoaderContainer/QRLoaderContainer.js +1 -1
  309. package/dist/es-legacy/components/helpers/QRLoaderContainer/QRLoaderContainer.js.map +1 -1
  310. package/dist/es-legacy/components/internal/Address/Address.js +1 -1
  311. package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
  312. package/dist/es-legacy/components/internal/Address/components/CountryField.js +1 -1
  313. package/dist/es-legacy/components/internal/Address/components/CountryField.js.map +1 -1
  314. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
  315. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
  316. package/dist/es-legacy/components/internal/ClickToPay/components/CtPCards/CtPCards.js +1 -1
  317. package/dist/es-legacy/components/internal/ClickToPay/components/CtPCards/CtPCards.js.map +1 -1
  318. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLogin.js +1 -1
  319. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLogin.js.map +1 -1
  320. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePassword.js +1 -1
  321. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePassword.js.map +1 -1
  322. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js +1 -1
  323. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js.map +1 -1
  324. package/dist/es-legacy/components/internal/ClickToPay/services/ClickToPayService.js +1 -1
  325. package/dist/es-legacy/components/internal/ClickToPay/services/ClickToPayService.js.map +1 -1
  326. package/dist/es-legacy/components/internal/ClickToPay/services/sdks/AbstractSrcInitiator.js.map +1 -1
  327. package/dist/es-legacy/components/internal/ClickToPay/services/sdks/MastercardSdk.js +1 -1
  328. package/dist/es-legacy/components/internal/ClickToPay/services/sdks/MastercardSdk.js.map +1 -1
  329. package/dist/es-legacy/components/internal/ClickToPay/services/sdks/VisaSdk.js +1 -1
  330. package/dist/es-legacy/components/internal/ClickToPay/services/sdks/VisaSdk.js.map +1 -1
  331. package/dist/es-legacy/components/internal/ClickToPay/services/utils.js +1 -1
  332. package/dist/es-legacy/components/internal/ClickToPay/services/utils.js.map +1 -1
  333. package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js +1 -1
  334. package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
  335. package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js +1 -1
  336. package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js.map +1 -1
  337. package/dist/es-legacy/components/internal/FormFields/Field/Field.js +1 -1
  338. package/dist/es-legacy/components/internal/FormFields/Field/Field.js.map +1 -1
  339. package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
  340. package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
  341. package/dist/es-legacy/components/internal/FormFields/InputDate/InputDate.js +1 -1
  342. package/dist/es-legacy/components/internal/FormFields/InputDate/InputDate.js.map +1 -1
  343. package/dist/es-legacy/components/internal/FormFields/InputEmail.js +1 -1
  344. package/dist/es-legacy/components/internal/FormFields/InputEmail.js.map +1 -1
  345. package/dist/es-legacy/components/internal/FormFields/InputTelephone.js +1 -1
  346. package/dist/es-legacy/components/internal/FormFields/InputTelephone.js.map +1 -1
  347. package/dist/es-legacy/components/internal/FormFields/InputText.js +1 -1
  348. package/dist/es-legacy/components/internal/FormFields/InputText.js.map +1 -1
  349. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js +1 -1
  350. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
  351. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js +1 -1
  352. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js.map +1 -1
  353. package/dist/es-legacy/components/internal/IbanInput/IbanInput.js +1 -1
  354. package/dist/es-legacy/components/internal/IbanInput/IbanInput.js.map +1 -1
  355. package/dist/es-legacy/components/internal/Icon/constants.js +2 -0
  356. package/dist/es-legacy/components/internal/Icon/constants.js.map +1 -0
  357. package/dist/es-legacy/components/internal/Img/Img.js +1 -1
  358. package/dist/es-legacy/components/internal/Img/Img.js.map +1 -1
  359. package/dist/es-legacy/components/internal/IssuerList/IssuerButtonGroup/IssuerButtonGroup.js +1 -1
  360. package/dist/es-legacy/components/internal/IssuerList/IssuerButtonGroup/IssuerButtonGroup.js.map +1 -1
  361. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js +1 -1
  362. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  363. package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js +2 -0
  364. package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -0
  365. package/dist/es-legacy/components/internal/PayButton/PayButton.js +1 -1
  366. package/dist/es-legacy/components/internal/PayButton/PayButton.js.map +1 -1
  367. package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js +1 -1
  368. package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
  369. package/dist/es-legacy/components/internal/PhoneInput/PhoneInput.js +1 -1
  370. package/dist/es-legacy/components/internal/PhoneInput/PhoneInput.js.map +1 -1
  371. package/dist/es-legacy/components/internal/QRLoader/QRLoader.js +1 -1
  372. package/dist/es-legacy/components/internal/QRLoader/QRLoader.js.map +1 -1
  373. package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js +1 -1
  374. package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js.map +1 -1
  375. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  376. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  377. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
  378. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
  379. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
  380. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  381. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js +1 -1
  382. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js.map +1 -1
  383. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleEncryption.js +1 -1
  384. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleEncryption.js.map +1 -1
  385. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js +1 -1
  386. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js.map +1 -1
  387. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  388. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  389. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/utils/processAriaConfig.js +1 -1
  390. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/utils/processAriaConfig.js.map +1 -1
  391. package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
  392. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  393. package/dist/es-legacy/components/internal/Voucher/Voucher.js +1 -1
  394. package/dist/es-legacy/components/internal/Voucher/Voucher.js.map +1 -1
  395. package/dist/es-legacy/core/Analytics/Analytics.js +1 -1
  396. package/dist/es-legacy/core/Analytics/Analytics.js.map +1 -1
  397. package/dist/es-legacy/core/Analytics/constants.js +1 -1
  398. package/dist/es-legacy/core/Analytics/constants.js.map +1 -1
  399. package/dist/es-legacy/core/Analytics/utils.js.map +1 -1
  400. package/dist/es-legacy/core/Context/Resources.js +1 -1
  401. package/dist/es-legacy/core/Context/Resources.js.map +1 -1
  402. package/dist/es-legacy/core/Environment/Environment.js +1 -1
  403. package/dist/es-legacy/core/Environment/Environment.js.map +1 -1
  404. package/dist/es-legacy/core/Environment/constants.js +2 -0
  405. package/dist/es-legacy/core/Environment/constants.js.map +1 -0
  406. package/dist/es-legacy/core/Errors/SRPanel.js +1 -1
  407. package/dist/es-legacy/core/Errors/SRPanel.js.map +1 -1
  408. package/dist/es-legacy/core/ProcessResponse/PaymentAction/actionTypes.js +1 -1
  409. package/dist/es-legacy/core/ProcessResponse/PaymentAction/actionTypes.js.map +1 -1
  410. package/dist/es-legacy/core/ProcessResponse/PaymentMethods/utils.js +1 -1
  411. package/dist/es-legacy/core/ProcessResponse/PaymentMethods/utils.js.map +1 -1
  412. package/dist/es-legacy/core/ProcessResponse/process-response.js +1 -1
  413. package/dist/es-legacy/core/ProcessResponse/process-response.js.map +1 -1
  414. package/dist/es-legacy/core/RiskModule/RiskModule.js +1 -1
  415. package/dist/es-legacy/core/RiskModule/RiskModule.js.map +1 -1
  416. package/dist/es-legacy/core/Services/analytics/collect-id.js +1 -1
  417. package/dist/es-legacy/core/Services/analytics/collect-id.js.map +1 -1
  418. package/dist/es-legacy/core/Services/analytics/log-event.js +1 -1
  419. package/dist/es-legacy/core/Services/get-translations.js +1 -1
  420. package/dist/es-legacy/core/Services/get-translations.js.map +1 -1
  421. package/dist/es-legacy/core/Services/http.js +1 -1
  422. package/dist/es-legacy/core/Services/http.js.map +1 -1
  423. package/dist/es-legacy/core/core.defaultProps.js +1 -1
  424. package/dist/es-legacy/core/core.defaultProps.js.map +1 -1
  425. package/dist/es-legacy/core/core.js +1 -1
  426. package/dist/es-legacy/core/core.js.map +1 -1
  427. package/dist/es-legacy/core/core.registry.js +1 -1
  428. package/dist/es-legacy/core/core.registry.js.map +1 -1
  429. package/dist/es-legacy/core/utils.js +1 -1
  430. package/dist/es-legacy/core/utils.js.map +1 -1
  431. package/dist/es-legacy/external/preact/dist/preact.js +1 -1
  432. package/dist/es-legacy/external/preact/dist/preact.js.map +1 -1
  433. package/dist/es-legacy/external/preact/hooks/dist/hooks.js +1 -1
  434. package/dist/es-legacy/external/preact/hooks/dist/hooks.js.map +1 -1
  435. package/dist/es-legacy/utils/arrayUtils.js +1 -1
  436. package/dist/es-legacy/utils/arrayUtils.js.map +1 -1
  437. package/dist/es-legacy/utils/useForm/reducer.js +1 -1
  438. package/dist/es-legacy/utils/useForm/reducer.js.map +1 -1
  439. package/dist/es-legacy/utils/useForm/useForm.js +1 -1
  440. package/dist/es-legacy/utils/validator-utils.js +1 -1
  441. package/dist/es-legacy/utils/validator-utils.js.map +1 -1
  442. package/package.json +144 -148
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../../../src/components/Card/components/CardInput/utils.ts"],"sourcesContent":["import Language from '../../../../language/Language';\nimport { AddressModeOptions, CardInputProps, LayoutObj } from './types';\nimport {\n CREDIT_CARD,\n CREDIT_CARD_NAME_BOTTOM,\n CREDIT_CARD_NAME_TOP,\n KCP_CARD,\n KCP_CARD_NAME_BOTTOM,\n KCP_CARD_NAME_TOP,\n SSN_CARD,\n SSN_CARD_NAME_BOTTOM,\n SSN_CARD_NAME_TOP\n} from './layouts';\nimport { AddressSpecifications, StringObject } from '../../../internal/Address/types';\nimport { PARTIAL_ADDRESS_SCHEMA } from '../../../internal/Address/constants';\nimport { InstallmentsObj } from './components/Installments/Installments';\nimport { SFPProps } from '../../../internal/SecuredFields/SFP/types';\nimport { BRAND_READABLE_NAME_MAP } from '../../../internal/SecuredFields/lib/constants';\nimport { UseImageHookType } from '../../../../core/Context/useImage';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\n\nexport const getCardImageUrl = (brand: string, getImage: UseImageHookType): string => {\n const imageOptions = {\n type: brand === 'card' ? 'nocard' : brand || 'nocard',\n extension: 'svg'\n };\n\n return getImage(imageOptions)(brand);\n};\n\n/**\n * Verifies that installment object is valid to send to the Backend.\n * Valid means that it has 'revolving' plan set, or the number of installments is bigger than one\n */\nexport const hasValidInstallmentsObject = (installments?: InstallmentsObj) => {\n return installments?.plan === 'revolving' || installments?.value > 1;\n};\n\nexport const getLayout = ({\n props,\n showKCP,\n showBrazilianSSN,\n countrySpecificSchemas = null,\n billingAddressRequiredFields = null\n}: LayoutObj): string[] => {\n let layout = CREDIT_CARD;\n const hasRequiredHolderName = props.hasHolderName && props.holderNameRequired;\n\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? CREDIT_CARD_NAME_TOP : CREDIT_CARD_NAME_BOTTOM;\n }\n\n if (showKCP) {\n layout = KCP_CARD;\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? KCP_CARD_NAME_TOP : KCP_CARD_NAME_BOTTOM;\n }\n }\n\n if (showBrazilianSSN) {\n layout = SSN_CARD;\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? SSN_CARD_NAME_TOP : SSN_CARD_NAME_BOTTOM;\n }\n }\n\n // w. Billing address\n if (countrySpecificSchemas) {\n // Flatten array and remove any numbers that describe how fields should be aligned\n const countrySpecificSchemasFlat: string[] = countrySpecificSchemas['flat'](2).filter(item => typeof item !== 'number') as string[];\n\n let countryBasedAddressLayout = countrySpecificSchemasFlat;\n\n if (billingAddressRequiredFields) {\n // Get intersection of the 2 arrays\n countryBasedAddressLayout = countrySpecificSchemasFlat.filter(x => billingAddressRequiredFields.includes(x));\n }\n\n layout = CREDIT_CARD.concat(countryBasedAddressLayout);\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop\n ? CREDIT_CARD_NAME_TOP.concat(countryBasedAddressLayout)\n : CREDIT_CARD_NAME_BOTTOM.concat(countryBasedAddressLayout);\n }\n // TODO we are not yet creating a layout for AVS + SSN field (w. or w/o holderName) - is AVS + SSN a real world scenario?\n }\n return layout;\n};\n\n/**\n * Lookup service to map local (CardInput) field refs to a key, possibly region specific, by which to retrieve the translation\n */\nexport const mapFieldKey = (key: string, i18n: Language, countrySpecificLabels: StringObject): string => {\n // console.log('### utils::mapFieldKey:: key', key);\n switch (key) {\n case 'socialSecurityNumber':\n return i18n.get(`boleto.${key}`);\n // Address related - if we have a country specific key for the field - use that to get the translation\n case 'street':\n case 'houseNumberOrName':\n case 'postalCode':\n case 'stateOrProvince':\n case 'city':\n case 'country':\n return countrySpecificLabels?.[key] ? i18n.get(countrySpecificLabels?.[key]) : i18n.get(key);\n // We know that the translated error messages do contain a reference to the field they refer to, so we won't need to map them (currently applies mostly to SecuredFields related errors)\n default:\n return null;\n }\n};\n\nexport const extractPropsForCardFields = (props: CardInputProps) => {\n return {\n // Extract props for CardFieldsWrapper & StoredCardFieldsWrapper(just needs amount, hasCVC, installmentOptions)\n amount: props.amount,\n billingAddressRequired: props.billingAddressRequired,\n billingAddressRequiredFields: props.billingAddressRequiredFields,\n billingAddressAllowedCountries: props.billingAddressAllowedCountries,\n brandsConfiguration: props.brandsConfiguration,\n showStoreDetailsCheckbox: props.showStoreDetailsCheckbox,\n hasCVC: props.hasCVC,\n hasHolderName: props.hasHolderName,\n holderNameRequired: props.holderNameRequired,\n installmentOptions: props.installmentOptions,\n placeholders: props.placeholders,\n positionHolderNameOnTop: props.positionHolderNameOnTop,\n // Extract props for CardFields > CardNumber\n showBrandIcon: props.showBrandIcon,\n showContextualElement: props.showContextualElement,\n // Extract props for StoredCardFields\n lastFour: props.lastFour,\n expiryMonth: props.expiryMonth,\n expiryYear: props.expiryYear,\n disclaimerMessage: props.disclaimerMessage\n };\n};\n\nexport const extractPropsForSFP = (props: CardInputProps) => {\n return {\n autoFocus: props.autoFocus,\n brands: props.brands,\n brandsConfiguration: props.brandsConfiguration,\n clientKey: props.clientKey,\n countryCode: props.countryCode,\n forceCompat: props.forceCompat,\n i18n: props.i18n,\n implementationType: props.implementationType,\n keypadFix: props.keypadFix,\n legacyInputMode: props.legacyInputMode,\n loadingContext: props.loadingContext,\n maskSecurityCode: props.maskSecurityCode,\n minimumExpiryDate: props.minimumExpiryDate,\n onAdditionalSFConfig: props.onAdditionalSFConfig,\n onAdditionalSFRemoved: props.onAdditionalSFRemoved,\n onAllValid: props.onAllValid,\n onAutoComplete: props.onAutoComplete,\n onBinValue: props.onBinValue,\n onConfigSuccess: props.onConfigSuccess,\n onError: props.onError,\n onFieldValid: props.onFieldValid,\n onLoad: props.onLoad,\n placeholders: props.placeholders,\n resources: props.resources,\n showContextualElement: props.showContextualElement,\n showWarnings: props.showWarnings,\n trimTrailingSeparator: props.trimTrailingSeparator\n } as SFPProps; // Can't set as return type on fn or it will complain about missing, mandatory, props\n};\n\nexport const handlePartialAddressMode = (addressMode: AddressModeOptions): AddressSpecifications | null => {\n return addressMode == AddressModeOptions.partial ? PARTIAL_ADDRESS_SCHEMA : null;\n};\n\n// Almost all errors are blur based, but some SF ones are not i.e. when an unsupported card is entered or the expiry date is out of range\nexport function lookupBlurBasedErrors(errorCode) {\n return ![\n SF_ErrorCodes.ERROR_MSG_UNSUPPORTED_CARD_ENTERED,\n SF_ErrorCodes.ERROR_MSG_CARD_TOO_OLD,\n SF_ErrorCodes.ERROR_MSG_CARD_TOO_FAR_IN_FUTURE,\n SF_ErrorCodes.ERROR_MSG_CARD_EXPIRES_TOO_SOON\n ].includes(errorCode);\n}\n\nexport function getFullBrandName(brand) {\n return BRAND_READABLE_NAME_MAP[brand] ?? brand;\n}\n"],"names":["getCardImageUrl","brand","getImage","type","extension","hasValidInstallmentsObject","installments","plan","value","getLayout","props","showKCP","showBrazilianSSN","countrySpecificSchemas","billingAddressRequiredFields","layout","CREDIT_CARD","hasRequiredHolderName","hasHolderName","holderNameRequired","positionHolderNameOnTop","CREDIT_CARD_NAME_TOP","CREDIT_CARD_NAME_BOTTOM","KCP_CARD","KCP_CARD_NAME_TOP","KCP_CARD_NAME_BOTTOM","SSN_CARD","SSN_CARD_NAME_TOP","SSN_CARD_NAME_BOTTOM","countrySpecificSchemasFlat","filter","item","countryBasedAddressLayout","x","includes","concat","mapFieldKey","key","i18n","countrySpecificLabels","get","extractPropsForCardFields","amount","billingAddressRequired","billingAddressAllowedCountries","brandsConfiguration","showStoreDetailsCheckbox","hasCVC","installmentOptions","placeholders","showBrandIcon","showContextualElement","lastFour","expiryMonth","expiryYear","disclaimerMessage","extractPropsForSFP","autoFocus","brands","clientKey","countryCode","forceCompat","implementationType","keypadFix","legacyInputMode","loadingContext","maskSecurityCode","minimumExpiryDate","onAdditionalSFConfig","onAdditionalSFRemoved","onAllValid","onAutoComplete","onBinValue","onConfigSuccess","onError","onFieldValid","onLoad","resources","showWarnings","trimTrailingSeparator","handlePartialAddressMode","addressMode","AddressModeOptions","partial","PARTIAL_ADDRESS_SCHEMA","lookupBlurBasedErrors","errorCode","SF_ErrorCodes","ERROR_MSG_UNSUPPORTED_CARD_ENTERED","ERROR_MSG_CARD_TOO_OLD","ERROR_MSG_CARD_TOO_FAR_IN_FUTURE","ERROR_MSG_CARD_EXPIRES_TOO_SOON","getFullBrandName","BRAND_READABLE_NAME_MAP"],"mappings":"ggBAqBO,MAAMA,EAAkB,CAACC,EAAeC,IAMpCA,EALc,CACjBC,KAAgB,SAAVF,EAAmB,SAAWA,GAAS,SAC7CG,UAAW,OAGRF,CAAuBD,GAOrBI,EAA8BC,GACT,cAAvBA,GAAcC,MAAwBD,GAAcE,MAAQ,EAG1DC,EAAY,EACrBC,QACAC,UACAC,mBACAC,yBAAyB,KACzBC,+BAA+B,SAE/B,IAAIC,EAASC,EACb,MAAMC,EAAwBP,EAAMQ,eAAiBR,EAAMS,mBAqB3D,GAnBIF,IACAF,EAASL,EAAMU,wBAA0BC,EAAuBC,GAGhEX,IACAI,EAASQ,EACLN,IACAF,EAASL,EAAMU,wBAA0BI,EAAoBC,IAIjEb,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AMiD,UACjBC,YAAalD,EAAMkD,YACnBC,YAAanD,EAAMmD,YACnBvB,KAAM5B,EAAM4B,KACZwB,mBAAoBpD,EAAMoD,mBAC1BC,UAAWrD,EAAMqD,UACjBC,gBAAiBtD,EAAMsD,gBACvBC,eAAgBvD,EAAMuD,eACtBC,iBAAkBxD,EAAMwD,iBACxBC,kBAAmBzD,EAAMyD,kBACzBC,qBAAsB1D,EAAM0D,qBAC5BC,sBAAuB3D,EAAM2D,sBAC7BC,WAAY5D,EAAM4D,WAClBC,eAAgB7D,EAAM6D,eACtBC,WAAY9D,EAAM8D,WAClBC,gBAAiB/D,EAAM+D,gBACvBC,QAAShE,EAAMgE,QACfC,aAAcjE,EAAMiE,aACpBC,OAAQlE,EAAMkE,OACd3B,aAAcvC,EAAMuC,aACpB4B,UAAWnE,EAAMmE,UACjB1B,sBAAuBzC,EAAMyC,sBAC7B2B,aAAcpE,EAAMoE,aACpBC,sBAAuBrE,EAAMqE,wBAIxBC,EAA4BC,GAC9BA,GAAeC,EAAmBC,QAAUC,EAAyB,KAIzE,SAASC,EAAsBC,GAClC,OAAQ,CACJC,EAAcC,mCACdD,EAAcE,uBACdF,EAAcG,iCACdH,EAAcI,iCAChBzD,SAASoD,EACf,CAEO,SAASM,EAAiB3F,GAC7B,OAAO4F,EAAwB5F,IAAUA,CAC7C"}
1
+ {"version":3,"file":"utils.js","sources":["../../../../../../src/components/Card/components/CardInput/utils.ts"],"sourcesContent":["import Language from '../../../../language/Language';\nimport { AddressModeOptions, CardInputProps, LayoutObj } from './types';\nimport {\n CREDIT_CARD,\n CREDIT_CARD_NAME_BOTTOM,\n CREDIT_CARD_NAME_TOP,\n KCP_CARD,\n KCP_CARD_NAME_BOTTOM,\n KCP_CARD_NAME_TOP,\n SSN_CARD,\n SSN_CARD_NAME_BOTTOM,\n SSN_CARD_NAME_TOP\n} from './layouts';\nimport { AddressSpecifications, StringObject } from '../../../internal/Address/types';\nimport { PARTIAL_ADDRESS_SCHEMA } from '../../../internal/Address/constants';\nimport { InstallmentsObj } from './components/Installments/Installments';\nimport { SFPProps } from '../../../internal/SecuredFields/SFP/types';\nimport { BRAND_READABLE_NAME_MAP } from '../../../internal/SecuredFields/lib/constants';\nimport { UseImageHookType } from '../../../../core/Context/useImage';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\n\nexport const getCardImageUrl = (brand: string, getImage: UseImageHookType): string => {\n const imageOptions = {\n type: brand === 'card' ? 'nocard' : brand || 'nocard',\n extension: 'svg'\n };\n\n return getImage(imageOptions)(brand);\n};\n\n/**\n * Verifies that installment object is valid to send to the Backend.\n * Valid means that it has 'revolving' plan set, or the number of installments is bigger than one\n */\nexport const hasValidInstallmentsObject = (installments?: InstallmentsObj) => {\n return installments?.plan === 'revolving' || installments?.value > 1;\n};\n\nexport const getLayout = ({\n props,\n showKCP,\n showBrazilianSSN,\n countrySpecificSchemas = null,\n billingAddressRequiredFields = null\n}: LayoutObj): string[] => {\n let layout = CREDIT_CARD;\n const hasRequiredHolderName = props.hasHolderName && props.holderNameRequired;\n\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? CREDIT_CARD_NAME_TOP : CREDIT_CARD_NAME_BOTTOM;\n }\n\n if (showKCP) {\n layout = KCP_CARD;\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? KCP_CARD_NAME_TOP : KCP_CARD_NAME_BOTTOM;\n }\n }\n\n if (showBrazilianSSN) {\n layout = SSN_CARD;\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop ? SSN_CARD_NAME_TOP : SSN_CARD_NAME_BOTTOM;\n }\n }\n\n // w. Billing address\n if (countrySpecificSchemas) {\n // Flatten array and remove any numbers that describe how fields should be aligned\n const countrySpecificSchemasFlat: string[] = countrySpecificSchemas['flat'](2).filter(item => typeof item !== 'number') as string[];\n\n let countryBasedAddressLayout = countrySpecificSchemasFlat;\n\n if (billingAddressRequiredFields) {\n // Get intersection of the 2 arrays\n countryBasedAddressLayout = countrySpecificSchemasFlat.filter(x => billingAddressRequiredFields.includes(x));\n }\n\n layout = CREDIT_CARD.concat(countryBasedAddressLayout);\n if (hasRequiredHolderName) {\n layout = props.positionHolderNameOnTop\n ? CREDIT_CARD_NAME_TOP.concat(countryBasedAddressLayout)\n : CREDIT_CARD_NAME_BOTTOM.concat(countryBasedAddressLayout);\n }\n // TODO we are not yet creating a layout for AVS + SSN field (w. or w/o holderName) - is AVS + SSN a real world scenario?\n }\n return layout;\n};\n\n/**\n * Lookup service to map local (CardInput) field refs to a key, possibly region specific, by which to retrieve the translation\n */\nexport const mapFieldKey = (key: string, i18n: Language, countrySpecificLabels: StringObject): string => {\n // console.log('### utils::mapFieldKey:: key', key);\n switch (key) {\n case 'socialSecurityNumber':\n return i18n.get(`boleto.${key}`);\n // Address related - if we have a country specific key for the field - use that to get the translation\n case 'street':\n case 'houseNumberOrName':\n case 'postalCode':\n case 'stateOrProvince':\n case 'city':\n case 'country':\n return countrySpecificLabels?.[key] ? i18n.get(countrySpecificLabels?.[key]) : i18n.get(key);\n // We know that the translated error messages do contain a reference to the field they refer to, so we won't need to map them (currently applies mostly to SecuredFields related errors)\n default:\n return null;\n }\n};\n\nexport const extractPropsForCardFields = (props: CardInputProps) => {\n return {\n // Extract props for CardFieldsWrapper & StoredCardFieldsWrapper(just needs amount, hasCVC, installmentOptions)\n amount: props.amount,\n billingAddressRequired: props.billingAddressRequired,\n billingAddressRequiredFields: props.billingAddressRequiredFields,\n billingAddressAllowedCountries: props.billingAddressAllowedCountries,\n brandsConfiguration: props.brandsConfiguration,\n showStoreDetailsCheckbox: props.showStoreDetailsCheckbox,\n hasCVC: props.hasCVC,\n hasHolderName: props.hasHolderName,\n holderNameRequired: props.holderNameRequired,\n installmentOptions: props.installmentOptions,\n placeholders: props.placeholders,\n positionHolderNameOnTop: props.positionHolderNameOnTop,\n // Extract props for CardFields > CardNumber\n showBrandIcon: props.showBrandIcon,\n showContextualElement: props.showContextualElement,\n // Extract props for StoredCardFields\n lastFour: props.lastFour,\n expiryMonth: props.expiryMonth,\n expiryYear: props.expiryYear,\n disclaimerMessage: props.disclaimerMessage\n };\n};\n\nexport const extractPropsForSFP = (props: CardInputProps) => {\n return {\n autoFocus: props.autoFocus,\n brands: props.brands,\n brandsConfiguration: props.brandsConfiguration,\n clientKey: props.clientKey,\n countryCode: props.countryCode,\n forceCompat: props.forceCompat,\n i18n: props.i18n,\n implementationType: props.implementationType,\n keypadFix: props.keypadFix,\n legacyInputMode: props.legacyInputMode,\n loadingContext: props.loadingContext,\n maskSecurityCode: props.maskSecurityCode,\n exposeExpiryDate: props.exposeExpiryDate,\n minimumExpiryDate: props.minimumExpiryDate,\n onAdditionalSFConfig: props.onAdditionalSFConfig,\n onAdditionalSFRemoved: props.onAdditionalSFRemoved,\n onAllValid: props.onAllValid,\n onAutoComplete: props.onAutoComplete,\n onBinValue: props.onBinValue,\n onConfigSuccess: props.onConfigSuccess,\n onError: props.onError,\n onFieldValid: props.onFieldValid,\n onLoad: props.onLoad,\n placeholders: props.placeholders,\n resources: props.resources,\n showContextualElement: props.showContextualElement,\n showWarnings: props.showWarnings,\n trimTrailingSeparator: props.trimTrailingSeparator\n } as SFPProps; // Can't set as return type on fn or it will complain about missing, mandatory, props\n};\n\nexport const handlePartialAddressMode = (addressMode: AddressModeOptions): AddressSpecifications | null => {\n return addressMode == AddressModeOptions.partial ? PARTIAL_ADDRESS_SCHEMA : null;\n};\n\n// Almost all errors are blur based, but some SF ones are not i.e. when an unsupported card is entered or the expiry date is out of range\nexport function lookupBlurBasedErrors(errorCode) {\n return ![\n SF_ErrorCodes.ERROR_MSG_UNSUPPORTED_CARD_ENTERED,\n SF_ErrorCodes.ERROR_MSG_CARD_TOO_OLD,\n SF_ErrorCodes.ERROR_MSG_CARD_TOO_FAR_IN_FUTURE,\n SF_ErrorCodes.ERROR_MSG_CARD_EXPIRES_TOO_SOON\n ].includes(errorCode);\n}\n\nexport function getFullBrandName(brand) {\n return BRAND_READABLE_NAME_MAP[brand] ?? brand;\n}\n"],"names":["getCardImageUrl","brand","getImage","type","extension","hasValidInstallmentsObject","installments","plan","value","getLayout","props","showKCP","showBrazilianSSN","countrySpecificSchemas","billingAddressRequiredFields","layout","CREDIT_CARD","hasRequiredHolderName","hasHolderName","holderNameRequired","positionHolderNameOnTop","CREDIT_CARD_NAME_TOP","CREDIT_CARD_NAME_BOTTOM","KCP_CARD","KCP_CARD_NAME_TOP","KCP_CARD_NAME_BOTTOM","SSN_CARD","SSN_CARD_NAME_TOP","SSN_CARD_NAME_BOTTOM","countrySpecificSchemasFlat","filter","item","countryBasedAddressLayout","x","includes","concat","mapFieldKey","key","i18n","countrySpecificLabels","get","extractPropsForCardFields","amount","billingAddressRequired","billingAddressAllowedCountries","brandsConfiguration","showStoreDetailsCheckbox","hasCVC","installmentOptions","placeholders","showBrandIcon","showContextualElement","lastFour","expiryMonth","expiryYear","disclaimerMessage","extractPropsForSFP","autoFocus","brands","clientKey","countryCode","forceCompat","implementationType","keypadFix","legacyInputMode","loadingContext","maskSecurityCode","exposeExpiryDate","minimumExpiryDate","onAdditionalSFConfig","onAdditionalSFRemoved","onAllValid","onAutoComplete","onBinValue","onConfigSuccess","onError","onFieldValid","onLoad","resources","showWarnings","trimTrailingSeparator","handlePartialAddressMode","addressMode","AddressModeOptions","partial","PARTIAL_ADDRESS_SCHEMA","lookupBlurBasedErrors","errorCode","SF_ErrorCodes","ERROR_MSG_UNSUPPORTED_CARD_ENTERED","ERROR_MSG_CARD_TOO_OLD","ERROR_MSG_CARD_TOO_FAR_IN_FUTURE","ERROR_MSG_CARD_EXPIRES_TOO_SOON","getFullBrandName","BRAND_READABLE_NAME_MAP"],"mappings":"ggBAqBO,MAAMA,EAAkB,CAACC,EAAeC,IAMpCA,EALc,CACjBC,KAAgB,SAAVF,EAAmB,SAAWA,GAAS,SAC7CG,UAAW,OAGRF,CAAuBD,GAOrBI,EAA8BC,GACT,cAAvBA,GAAcC,MAAwBD,GAAcE,MAAQ,EAG1DC,EAAY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rBC,sBAAuBzC,EAAMyC,sBAE7BC,SAAU1C,EAAM0C,SAChBC,YAAa3C,EAAM2C,YACnBC,WAAY5C,EAAM4C,WAClBC,kBAAmB7C,EAAM6C,oBAIpBC,EAAsB9C,IACxB,CACH+C,UAAW/C,EAAM+C,UACjBC,OAAQhD,EAAMgD,OACdb,oBAAqBnC,EAAMmC,oBAC3Bc,UAAWjD,EAAMiD,UACjBC,YAAalD,EAAMkD,YACnBC,YAAanD,EAAMmD,YACnBvB,KAAM5B,EAAM4B,KACZwB,mBAAoBpD,EAAMoD,mBAC1BC,UAAWrD,EAAMqD,UACjBC,gBAAiBtD,EAAMsD,gBACvBC,eAAgBvD,EAAMuD,eACtBC,iBAAkBxD,EAAMwD,iBACxBC,iBAAkBzD,EAAMyD,iBACxBC,kBAAmB1D,EAAM0D,kBACzBC,qBAAsB3D,EAAM2D,qBAC5BC,sBAAuB5D,EAAM4D,sBAC7BC,WAAY7D,EAAM6D,WAClBC,eAAgB9D,EAAM8D,eACtBC,WAAY/D,EAAM+D,WAClBC,gBAAiBhE,EAAMgE,gBACvBC,QAASjE,EAAMiE,QACfC,aAAclE,EAAMkE,aACpBC,OAAQnE,EAAMmE,OACd5B,aAAcvC,EAAMuC,aACpB6B,UAAWpE,EAAMoE,UACjB3B,sBAAuBzC,EAAMyC,sBAC7B4B,aAAcrE,EAAMqE,aACpBC,sBAAuBtE,EAAMsE,wBAIxBC,EAA4BC,GAC9BA,GAAeC,EAAmBC,QAAUC,EAAyB,KAIzE,SAASC,EAAsBC,GAClC,OAAQ,CACJC,EAAcC,mCACdD,EAAcE,uBACdF,EAAcG,iCACdH,EAAcI,iCAChB1D,SAASqD,EACf,CAEO,SAASM,EAAiB5F,GAC7B,OAAO6F,EAAwB7F,IAAUA,CAC7C"}
@@ -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 i from"./defaultProps.js";import n 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";class d extends e{static type=h.cashapp;cashAppService;static defaultProps=i;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:i}=this.props,n=this.props.enableStoreDetails||!this.props.session&&a;if(i)return{paymentMethod:{type:d.type,storedPaymentMethodId:i}};return{paymentMethod:{type:d.type,...e&&{grantId:e},...r&&{customerId:r},...s&&o&&{onFileGrantId:s,cashtag:o}},...n&&{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(n,{label:p(this.props.i18n,this.props.amount),icon:this.resources?.getImage({imageFolder:"components/"})("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{d as CashAppPay,d 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 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,{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};
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';\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 label={payAmountLabel(this.props.i18n, this.props.amount)}\n icon={this.resources?.getImage({ imageFolder: 'components/' })('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","payButton","onSubmit","ref","componentRef","CashAppComponent","onChangeStoreDetails","onError","onAuthorize"],"mappings":"+mBAcO,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,Y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esContent":["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 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,mBAA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
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../external/preact/dist/preact.js";import{useRef as t,useState as r,useCallback as a,useEffect as s}from"../../../external/preact/hooks/dist/hooks.js";import n from"../../../core/Errors/AdyenCheckoutError.js";import o from"../../internal/Spinner/Spinner.js";import{CashAppPayEvents as i}from"../services/types.js";import c from"../../internal/StoreDetails/StoreDetails.js";function l({enableStoreDetails:l,cashAppService:u,onClick:d,onChangeStoreDetails:m,onAuthorize:p,onError:h}){const g=t(null),[y,C]=r("loading"),f=t([]),[b,E]=r(!1);this.setStatus=C;const v=a((async()=>{try{await u.initialize(),f.current=[u.subscribeToEvent(i.CustomerDismissed,(()=>{h(new n("CANCEL","Customer dismissed the modal"))})),u.subscribeToEvent(i.CustomerRequestDeclined,(async()=>{h(new n("ERROR","Payment declined by CashAppPay")),await u.restart(),await u.renderButton(g.current)})),u.subscribeToEvent(i.CustomerRequestApproved,(({customerProfile:e,grants:t})=>{const r={...e?.id&&{customerId:e.id},...e?.cashtag&&{cashTag:e.cashtag},...t?.payment?.grantId&&{grantId:t.payment.grantId},...t?.onFile?.grantId&&{onFileGrantId:t.onFile.grantId}};p(r)})),u.subscribeToEvent(i.CustomerRequestFailed,(()=>{h(new n("ERROR","Customer request failed"))}))],await u.renderButton(g.current),C("ready")}catch(e){h(e)}}),[u,h,p]);return s((()=>{l&&(u.setStorePaymentMethod(b),m(b))}),[l,b]),s((()=>(v(),()=>{u.restart(),f.current.forEach((e=>e()))})),[u,v]),e("div",{className:"adyen-checkout__cashapp","aria-live":"polite","aria-busy":"loading"===y},"loading"===y&&e(o,null),"loading"!==y&&l&&e(c,{storeDetails:b,onChange:E}),e("div",{onClick:d,className:"adyen-checkout__cashapp-button",ref:g}))}export{l as CashAppComponent};
1
+ import{createElement as e}from"../../../external/preact/dist/preact.js";import{useRef as t,useState as r,useCallback as a,useEffect as s}from"../../../external/preact/hooks/dist/hooks.js";import n from"../../../core/Errors/AdyenCheckoutError.js";import o from"../../internal/Spinner/Spinner.js";import{CashAppPayEvents as i}from"../services/types.js";import c from"../../internal/StoreDetails/StoreDetails.js";function l({enableStoreDetails:l,cashAppService:u,onClick:d,onChangeStoreDetails:m,onAuthorize:p,onError:h}){const g=t(null),[y,C]=r("loading"),f=t([]),[E,b]=r(!1);this.setStatus=C;const R=a((async()=>{try{await u.initialize(),f.current=[u.subscribeToEvent(i.CustomerDismissed,(()=>{h(new n("CANCEL","Customer dismissed the modal"))})),u.subscribeToEvent(i.CustomerRequestDeclined,(async()=>{h(new n("ERROR","Payment declined by CashAppPay")),await u.restart(),await u.renderButton(g.current)})),u.subscribeToEvent(i.CustomerRequestApproved,(({customerProfile:e,grants:t})=>{const r={...e?.id&&{customerId:e.id},...e?.cashtag&&{cashTag:e.cashtag},...t?.payment?.grantId&&{grantId:t.payment.grantId},...t?.onFile?.grantId&&{onFileGrantId:t.onFile.grantId}};p(r)})),u.subscribeToEvent(i.CustomerRequestFailed,(()=>{h(new n("ERROR","Customer request failed"))}))],await u.renderButton(g.current),C("ready")}catch(e){h(e instanceof n?e:new n("ERROR","Error when initializing CashAppPay",{cause:e}))}}),[u,h,p]);return s((()=>{l&&(u.setStorePaymentMethod(E),m(E))}),[l,E]),s((()=>(R(),()=>{u.restart(),f.current.forEach((e=>e()))})),[u,R]),e("div",{className:"adyen-checkout__cashapp","aria-live":"polite","aria-busy":"loading"===y},"loading"===y&&e(o,null),"loading"!==y&&l&&e(c,{storeDetails:E,onChange:b}),e("div",{onClick:d,className:"adyen-checkout__cashapp-button",ref:g}))}export{l as CashAppComponent};
2
2
  //# sourceMappingURL=CashAppComponent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CashAppComponent.js","sources":["../../../../../src/components/CashAppPay/components/CashAppComponent.tsx"],"sourcesContent":["import { h, RefObject } from 'preact';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport Spinner from '../../internal/Spinner';\nimport { CashAppPayEvents, ICashAppService } from '../services/types';\nimport { CashAppPayEventData } from '../types';\nimport StoreDetails from '../../internal/StoreDetails';\nimport './CashAppComponent.scss';\nimport { UIElementStatus } from '../../internal/UIElement/types';\n\ninterface CashAppComponentProps {\n enableStoreDetails?: boolean;\n cashAppService: ICashAppService;\n onClick(): void;\n onChangeStoreDetails(data: any): void;\n onAuthorize(payEventData: CashAppPayEventData): void;\n onError(error: AdyenCheckoutError): void;\n ref(ref: RefObject<typeof CashAppComponent>): void;\n}\n\nexport function CashAppComponent({\n enableStoreDetails,\n cashAppService,\n onClick,\n onChangeStoreDetails,\n onAuthorize,\n onError\n}: CashAppComponentProps): h.JSX.Element {\n const cashAppRef = useRef<HTMLDivElement>(null);\n const [status, setStatus] = useState<UIElementStatus>('loading');\n const subscriptions = useRef<Function[]>([]);\n const [storePaymentMethod, setStorePaymentMethod] = useState<boolean>(false);\n\n this.setStatus = setStatus;\n\n const initializeCashAppSdk = useCallback(async () => {\n try {\n await cashAppService.initialize();\n\n subscriptions.current = [\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerDismissed, () => {\n onError(new AdyenCheckoutError('CANCEL', 'Customer dismissed the modal'));\n }),\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerRequestDeclined, async () => {\n onError(new AdyenCheckoutError('ERROR', 'Payment declined by CashAppPay'));\n await cashAppService.restart();\n await cashAppService.renderButton(cashAppRef.current);\n }),\n\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerRequestApproved, ({ customerProfile, grants }) => {\n const cashAppPaymentData: CashAppPayEventData = {\n ...(customerProfile?.id && { customerId: customerProfile.id }),\n ...(customerProfile?.cashtag && { cashTag: customerProfile.cashtag }),\n ...(grants?.payment?.grantId && { grantId: grants.payment.grantId }),\n ...(grants?.onFile?.grantId && { onFileGrantId: grants.onFile.grantId })\n };\n\n onAuthorize(cashAppPaymentData);\n }),\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerRequestFailed, () => {\n onError(new AdyenCheckoutError('ERROR', 'Customer request failed'));\n })\n ];\n\n await cashAppService.renderButton(cashAppRef.current);\n\n setStatus('ready');\n } catch (error) {\n onError(error);\n }\n }, [cashAppService, onError, onAuthorize]);\n\n useEffect(() => {\n if (enableStoreDetails) {\n cashAppService.setStorePaymentMethod(storePaymentMethod);\n onChangeStoreDetails(storePaymentMethod);\n }\n }, [enableStoreDetails, storePaymentMethod]);\n\n useEffect(() => {\n initializeCashAppSdk();\n return () => {\n cashAppService.restart();\n subscriptions.current.forEach(unsubscribeFn => unsubscribeFn());\n };\n }, [cashAppService, initializeCashAppSdk]);\n\n return (\n <div className=\"adyen-checkout__cashapp\" aria-live=\"polite\" aria-busy={status === 'loading'}>\n {status === 'loading' && <Spinner />}\n {status !== 'loading' && enableStoreDetails && <StoreDetails storeDetails={storePaymentMethod} onChange={setStorePaymentMethod} />}\n\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}\n <div onClick={onClick} className={'adyen-checkout__cashapp-button'} ref={cashAppRef}></div>\n </div>\n );\n}\n"],"names":["CashAppComponent","enableStoreDetails","cashAppService","onClick","onChangeStoreDetails","onAuthorize","onError","cashAppRef","useRef","status","setStatus","useState","subscriptions","storePaymentMethod","setStorePaymentMethod","this","initializeCashAppSdk","useCallback","async","initialize","current","subscribeToEvent","CashAppPayEvents","CustomerDismissed","AdyenCheckoutError","CustomerRequestDeclined","restart","renderButton","CustomerRequestApproved","customerProfile","grants","cashAppPaymentData","id","customerId","cashtag","cashTag","payment","grantId","onFile","onFileGrantId","CustomerRequestFailed","error","useEffect","forEach","unsubscribeFn","h","div","className","aria-live","aria-busy","Spinner","StoreDetails","storeDetails","onChange","ref"],"mappings":"0ZAoBO,SAASA,GAAiBC,mBAC7BA,EAAkBC,eAClBA,EAAcC,QACdA,EAAOC,qBACPA,EAAoBC,YACpBA,EAAWC,QACXA,IAEA,MAAMC,EAAaC,EAAuB,OACnCC,EAAQC,GAAaC,EAA0B,WAChDC,EAAgBJ,EAAmB,KAClCK,EAAoBC,GA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UvC,IAGzG+B,EAACC,MAAAA,CAAI3C,QAASA,EAAS4C,UAAW,iCAAkCO,IAAK/C,IAGrF"}
1
+ {"version":3,"file":"CashAppComponent.js","sources":["../../../../../src/components/CashAppPay/components/CashAppComponent.tsx"],"sourcesContent":["import { h, RefObject } from 'preact';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport Spinner from '../../internal/Spinner';\nimport { CashAppPayEvents, ICashAppService } from '../services/types';\nimport { CashAppPayEventData } from '../types';\nimport StoreDetails from '../../internal/StoreDetails';\nimport './CashAppComponent.scss';\nimport { UIElementStatus } from '../../internal/UIElement/types';\n\ninterface CashAppComponentProps {\n enableStoreDetails?: boolean;\n cashAppService: ICashAppService;\n onClick(): void;\n onChangeStoreDetails(data: any): void;\n onAuthorize(payEventData: CashAppPayEventData): void;\n onError(error: AdyenCheckoutError): void;\n ref(ref: RefObject<typeof CashAppComponent>): void;\n}\n\nexport function CashAppComponent({\n enableStoreDetails,\n cashAppService,\n onClick,\n onChangeStoreDetails,\n onAuthorize,\n onError\n}: CashAppComponentProps): h.JSX.Element {\n const cashAppRef = useRef<HTMLDivElement>(null);\n const [status, setStatus] = useState<UIElementStatus>('loading');\n const subscriptions = useRef<Function[]>([]);\n const [storePaymentMethod, setStorePaymentMethod] = useState<boolean>(false);\n\n this.setStatus = setStatus;\n\n const initializeCashAppSdk = useCallback(async () => {\n try {\n await cashAppService.initialize();\n\n subscriptions.current = [\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerDismissed, () => {\n onError(new AdyenCheckoutError('CANCEL', 'Customer dismissed the modal'));\n }),\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerRequestDeclined, async () => {\n onError(new AdyenCheckoutError('ERROR', 'Payment declined by CashAppPay'));\n await cashAppService.restart();\n await cashAppService.renderButton(cashAppRef.current);\n }),\n\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerRequestApproved, ({ customerProfile, grants }) => {\n const cashAppPaymentData: CashAppPayEventData = {\n ...(customerProfile?.id && { customerId: customerProfile.id }),\n ...(customerProfile?.cashtag && { cashTag: customerProfile.cashtag }),\n ...(grants?.payment?.grantId && { grantId: grants.payment.grantId }),\n ...(grants?.onFile?.grantId && { onFileGrantId: grants.onFile.grantId })\n };\n\n onAuthorize(cashAppPaymentData);\n }),\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerRequestFailed, () => {\n onError(new AdyenCheckoutError('ERROR', 'Customer request failed'));\n })\n ];\n\n await cashAppService.renderButton(cashAppRef.current);\n\n setStatus('ready');\n } catch (error) {\n if (error instanceof AdyenCheckoutError) onError(error);\n else onError(new AdyenCheckoutError('ERROR', 'Error when initializing CashAppPay', { cause: error }));\n }\n }, [cashAppService, onError, onAuthorize]);\n\n useEffect(() => {\n if (enableStoreDetails) {\n cashAppService.setStorePaymentMethod(storePaymentMethod);\n onChangeStoreDetails(storePaymentMethod);\n }\n }, [enableStoreDetails, storePaymentMethod]);\n\n useEffect(() => {\n initializeCashAppSdk();\n return () => {\n cashAppService.restart();\n subscriptions.current.forEach(unsubscribeFn => unsubscribeFn());\n };\n }, [cashAppService, initializeCashAppSdk]);\n\n return (\n <div className=\"adyen-checkout__cashapp\" aria-live=\"polite\" aria-busy={status === 'loading'}>\n {status === 'loading' && <Spinner />}\n {status !== 'loading' && enableStoreDetails && <StoreDetails storeDetails={storePaymentMethod} onChange={setStorePaymentMethod} />}\n\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}\n <div onClick={onClick} className={'adyen-checkout__cashapp-button'} ref={cashAppRef}></div>\n </div>\n );\n}\n"],"names":["CashAppComponent","enableStoreDetails","cashAppService","onClick","onChangeStoreDetails","onAuthorize","onError","cashAppRef","useRef","status","setStatus","useState","subscriptions","storePaymentMethod","setStorePaymentMethod","this","initializeCashAppSdk","useCallback","async","initialize","current","subscribeToEvent","CashAppPayEvents","CustomerDismissed","AdyenCheckoutError","CustomerRequestDeclined","restart","renderButton","CustomerRequestApproved","customerProfile","grants","cashAppPaymentData","id","customerId","cashtag","cashTag","payment","grantId","onFile","onFileGrantId","CustomerRequestFailed","error","cause","useEffect","forEach","unsubscribeFn","h","div","className","aria-live","aria-busy","Spinner","StoreDetails","storeDetails","onChange","ref"],"mappings":"0ZAoBO,SAASA,GAAiBC,mBAC7BA,EAAkBC,eAClBA,EAAcC,QACdA,EAAOC,qBACPA,EAAoBC,YACpBA,EAAWC,QACXA,IAEA,MAAMC,EAAaC,EAAuB,OACnCC,EAAQC,GAAaC,EAA0B,WAChDC,EAAgBJ,EAAmB,KAClCK,EAAoBC,GAAyBH,GAAkB,GAEtEI,KAAKL,UAAYA,EAEjB,MAAMM,EAAuBC,GAAYC,UACrC,UACUhB,EAAeiB,aAErBP,EAAcQ,QAAU,CACpBlB,EAAemB,iBAAiBC,EAAiBC,mBAAmB,KAChEjB,EAAQ,IAAIkB,EAAmB,SAAU,gCAAA,IAE7CtB,EAAemB,iBAAiBC,EAAiBG,yBAAyBP,UACtEZ,EAAQ,IAAIkB,EAAmB,QAAS,yCAClCtB,EAAewB,gBACfxB,EAAeyB,aAAapB,EAAWa,QAAO,IAGxDlB,EAAemB,iBAAiBC,EAAiBM,yBAAyB,EAAGC,kBAAiBC,aAC1F,MAAMC,EAA0C,IACxCF,GAAiBG,IAAM,CAAEC,WAAYJ,EAAgBG,OACrDH,GAAiBK,SAAW,CAAEC,QAASN,EAAgBK,YACvDJ,GAAQM,SAASC,SAAW,CAAEA,QAASP,EAAOM,QAAQC,YACtDP,GAAQQ,QAAQD,SAAW,CAAEE,cAAeT,EAAOQ,OAAOD,UAGlEhC,EAAY0B,EAAAA,IAEhB7B,EAAemB,iBAAiBC,EAAiBkB,uBAAuB,KACpElC,EAAQ,IAAIkB,EAAmB,QAAS,2BAAA,WAI1CtB,EAAeyB,aAAapB,EAAWa,SAE7CV,EAAU,QACd,CAAE,MAAO+B,GACoCnC,EAArCmC,aAAiBjB,EAA4BiB,EACpC,IAAIjB,EAAmB,QAAS,qCAAsC,CAAEkB,MAAOD,IAChG,IACD,CAACvC,EAAgBI,EAASD,IAiB7B,OAfAsC,GAAU,KACF1C,IACAC,EAAeY,sBAAsBD,GACrCT,EAAqBS,GACzB,GACD,CAACZ,EAAoBY,IAExB8B,GAAU,KACN3B,IACO,KACHd,EAAewB,UACfd,EAAcQ,QAAQwB,SAAQC,GAAiBA,KAAAA,IAEpD,CAAC3C,EAAgBc,IAGhB8B,EAACC,MAAAA,CAAIC,UAAU,0BAA0BC,YAAU,SAASC,YAAsB,YAAXzC,GACvD,YAAXA,GAAwBqC,EAACK,EAAAA,MACd,YAAX1C,GAAwBR,GAAsB6C,EAACM,EAAAA,CAAaC,aAAcxC,EAAoByC,SAAUxC,IAGzGgC,EAACC,MAAAA,CAAI5C,QAASA,EAAS6C,UAAW,iCAAkCO,IAAKhD,IAGrF"}
@@ -1 +1 @@
1
- {"version":3,"file":"InstantPaymentMethods.js","sources":["../../../../../../src/components/Dropin/components/PaymentMethod/InstantPaymentMethods.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport UIElement from '../../../internal/UIElement/UIElement';\n\ninterface InstantPaymentMethodsProps {\n paymentMethods: UIElement[];\n}\n\nfunction InstantPaymentMethods({ paymentMethods }: InstantPaymentMethodsProps) {\n return (\n <Fragment>\n <ul className=\"adyen-checkout__instant-payment-methods-list\">\n {paymentMethods.map(pm => (\n <li key={pm.type}>{pm.render()}</li>\n ))}\n </ul>\n </Fragment>\n );\n}\n\nexport default InstantPaymentMethods;\n"],"names":["InstantPaymentMethods","paymentMethods","h","Fragment","ul","className","map","pm","li","key","type","render"],"mappings":"yFAOA,SAASA,GAAsBC,eAAEA,IAC7B,OACIC,EAACC,OACGD,EAACE,KAAAA,CAAGC,UAAU,gDACTJ,EAAeK,KAAIC,GAChBL,EAACM,KAAAA,CAAGC,IAAKF,EAAGG,MAAOH,EAAGI,aAK1C"}
1
+ {"version":3,"file":"InstantPaymentMethods.js","sources":["../../../../../../src/components/Dropin/components/PaymentMethod/InstantPaymentMethods.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport UIElement from '../../../internal/UIElement/UIElement';\nimport './InstantPaymentMethods.scss';\n\ninterface InstantPaymentMethodsProps {\n paymentMethods: UIElement[];\n}\n\nfunction InstantPaymentMethods({ paymentMethods }: InstantPaymentMethodsProps) {\n return (\n <Fragment>\n <ul className=\"adyen-checkout__instant-payment-methods-list\">\n {paymentMethods.map(pm => (\n <li key={pm.type}>{pm.render()}</li>\n ))}\n </ul>\n </Fragment>\n );\n}\n\nexport default InstantPaymentMethods;\n"],"names":["InstantPaymentMethods","paymentMethods","h","Fragment","ul","className","map","pm","li","key","type","render"],"mappings":"yFAQA,SAASA,GAAsBC,eAAEA,IAC7B,OACIC,EAACC,OACGD,EAACE,KAAAA,CAAGC,UAAU,gDACTJ,EAAeK,KAAIC,GAChBL,EAACM,KAAAA,CAAGC,IAAKF,EAAGG,MAAOH,EAAGI,aAK1C"}
@@ -1,2 +1,2 @@
1
- import{Component as t,createElement as e}from"../../../external/preact/dist/preact.js";class o extends t{paywithgoogleWrapper;static defaultProps={buttonColor:"default",buttonType:"long",buttonSizeMode:"static"};clicked=!1;handleClick=t=>{t.preventDefault(),t.stopPropagation(),this.clicked||(this.props.onClick(t),this.clicked=!0,setTimeout((()=>{this.clicked=!1}),300))};componentDidMount(){const{buttonColor:t,buttonType:e,buttonLocale:o,buttonSizeMode:n,buttonRootNode:a,paymentsClient:i}=this.props;i.then((i=>i.createButton({onClick:this.handleClick,buttonType:e,buttonColor:t,buttonLocale:o,buttonSizeMode:n,buttonRootNode:a}))).then((t=>{this.paywithgoogleWrapper.appendChild(t)}))}render(){return e("span",{className:"adyen-checkout__paywithgoogle",ref:t=>{this.paywithgoogleWrapper=t}})}}export{o as default};
1
+ import{createElement as t}from"../../../external/preact/dist/preact.js";import{useRef as o,useEffect as e}from"../../../external/preact/hooks/dist/hooks.js";const n=n=>{const a=o(void 0);return e((()=>{const{onClick:t,buttonColor:o,buttonType:e,buttonLocale:u,buttonSizeMode:r,buttonRootNode:c,paymentsClient:s}=n;s.then((n=>n.createButton({onClick:t,buttonType:e,buttonColor:o,buttonLocale:u,buttonSizeMode:r,buttonRootNode:c}))).then((t=>{a.current&&a.current.appendChild(t)}))}),[n.buttonColor,n.buttonType,n.buttonLocale,n.buttonSizeMode,n.buttonRootNode,n.paymentsClient]),t("div",{"data-testid":"googlepay-button-container",className:"adyen-checkout__paywithgoogle",ref:a})};export{n as default};
2
2
  //# sourceMappingURL=GooglePayButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GooglePayButton.js","sources":["../../../../../src/components/GooglePay/components/GooglePayButton.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport './GooglePayButton.scss';\n\ninterface GooglePayButtonProps {\n buttonColor: google.payments.api.ButtonColor;\n buttonType: google.payments.api.ButtonType;\n buttonSizeMode: google.payments.api.ButtonSizeMode;\n buttonLocale: string;\n buttonRootNode?: HTMLDocument | ShadowRoot;\n paymentsClient: Promise<google.payments.api.PaymentsClient>;\n onClick: (e: Event) => void;\n}\n\nclass GooglePayButton extends Component<GooglePayButtonProps> {\n public paywithgoogleWrapper;\n\n public static defaultProps = {\n buttonColor: 'default', // default (black), black, white\n buttonType: 'long', // long, short\n buttonSizeMode: 'static' // long, short\n };\n private clicked = false;\n\n private handleClick = e => {\n e.preventDefault();\n e.stopPropagation();\n\n if (!this.clicked) {\n this.props.onClick(e);\n this.clicked = true;\n\n setTimeout(() => {\n this.clicked = false;\n }, 300);\n }\n };\n\n componentDidMount() {\n const { buttonColor, buttonType, buttonLocale, buttonSizeMode, buttonRootNode, paymentsClient } = this.props;\n\n paymentsClient\n .then(client =>\n client.createButton({\n onClick: this.handleClick,\n buttonType,\n buttonColor,\n buttonLocale,\n buttonSizeMode,\n buttonRootNode\n })\n )\n .then(googlePayButton => {\n this.paywithgoogleWrapper.appendChild(googlePayButton);\n });\n }\n\n render() {\n return (\n <span\n className={'adyen-checkout__paywithgoogle'}\n ref={ref => {\n this.paywithgoogleWrapper = ref;\n }}\n />\n );\n }\n}\n\nexport default GooglePayButton;\n"],"names":["GooglePayButton","Component","paywithgoogleWrapper","static","buttonColor","buttonType","buttonSizeMode","clicked","handleClick","e","preventDefault","stopPropagation","this","props","onClick","setTimeout","componentDidMount","buttonLocale","buttonRootNode","paymentsClient","then","client","createButton","googlePayButton","appendChild","render","h","span","className","ref"],"mappings":"uFAaA,MAAMA,UAAwBC,EACnBC,qBAEPC,oBAA6B,CACzBC,YAAa,UACbC,WAAY,OACZC,eAAgB,UAEZC,SAAU,EAEVC,YAAcC,IAClBA,EAAEC,iBACFD,EAAEE,kBAEGC,KAAKL,UACNK,KAAKC,MAAMC,QAAQL,GACnBG,KAAKL,SAAU,EAEfQ,YAAW,KACPH,KAAKL,SAAU,CAAA,GAChB,KACP,EAGJS,iBAAAA,GACI,MAAMZ,YAAEA,EAAWC,WAAEA,EAAUY,aAAEA,EAAYX,eAAEA,EAAcY,eAAEA,EAAcC,eAAEA,GAAmBP,KAAKC,MAEvGM,EACKC,MAAKC,GACFA,EAAOC,aAAa,CAChBR,QAASF,KAAKJ,YACdH,aACAD,cACAa,eACAX,iBACAY,qBAGPE,MAAKG,IACFX,KAAKV,qBAAqBsB,YAAYD,EAAAA,GAElD,CAEAE,MAAAA,GACI,OACIC,EAACC,OAAAA,CACGC,UAAW,gCACXC,IAAKA,IACDjB,KAAKV,qBAAuB2B,CAAAA,GAI5C"}
1
+ {"version":3,"file":"GooglePayButton.js","sources":["../../../../../src/components/GooglePay/components/GooglePayButton.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useRef } from 'preact/hooks';\nimport './GooglePayButton.scss';\n\ninterface GooglePayButtonProps {\n buttonColor: google.payments.api.ButtonColor;\n buttonType: google.payments.api.ButtonType;\n buttonSizeMode: google.payments.api.ButtonSizeMode;\n buttonLocale: string;\n buttonRootNode?: HTMLDocument | ShadowRoot;\n paymentsClient: Promise<google.payments.api.PaymentsClient>;\n onClick: (e: Event) => void;\n}\n\nconst GooglePayButton = (props: GooglePayButtonProps) => {\n const googlePayWrapperRef = useRef<HTMLDivElement | undefined>(undefined);\n\n useEffect(() => {\n const { onClick, buttonColor, buttonType, buttonLocale, buttonSizeMode, buttonRootNode, paymentsClient } = props;\n\n paymentsClient\n .then(client =>\n client.createButton({\n onClick,\n buttonType,\n buttonColor,\n buttonLocale,\n buttonSizeMode,\n buttonRootNode\n })\n )\n .then(googlePayButton => {\n if (googlePayWrapperRef.current) {\n googlePayWrapperRef.current.appendChild(googlePayButton);\n }\n });\n }, [props.buttonColor, props.buttonType, props.buttonLocale, props.buttonSizeMode, props.buttonRootNode, props.paymentsClient]);\n\n return <div data-testid=\"googlepay-button-container\" className={'adyen-checkout__paywithgoogle'} ref={googlePayWrapperRef} />;\n};\n\nexport default GooglePayButton;\n"],"names":["GooglePayButton","props","googlePayWrapperRef","useRef","undefined","useEffect","onClick","buttonColor","buttonType","buttonLocale","buttonSizeMode","buttonRootNode","paymentsClient","then","client","createButton","googlePayButton","current","appendChild","h","div","data-testid","className","ref"],"mappings":"6JAcA,MAAMA,EAAmBC,IACrB,MAAMC,EAAsBC,OAAmCC,GAuB/D,OArBAC,GAAU,KACN,MAAMC,QAAEA,EAAOC,YAAEA,EAAWC,WAAEA,EAAUC,aAAEA,EAAYC,eAAEA,EAAcC,eAAEA,EAAcC,eAAEA,GAAmBX,EAE3GW,EACKC,MAAKC,GACFA,EAAOC,aAAa,CAChBT,UACAE,aACAD,cACAE,eACAC,iBACAC,qBAGPE,MAAKG,IACEd,EAAoBe,SACpBf,EAAoBe,QAAQC,YAAYF,EAC5C,GACJ,GACL,CAACf,EAAMM,YAAaN,EAAMO,WAAYP,EAAMQ,aAAcR,EAAMS,eAAgBT,EAAMU,eAAgBV,EAAMW,iBAExGO,EAACC,MAAAA,CAAIC,cAAY,6BAA6BC,UAAW,gCAAiCC,IAAKrB"}
@@ -1,2 +1,2 @@
1
- const e={isExpress:!1,existingPaymentMethodRequired:!1,buttonColor:"default",buttonType:"long",buttonSizeMode:void 0,configuration:{gatewayMerchantId:"",merchantId:"",merchantName:""},amount:{value:0,currency:"USD"},totalPriceStatus:"FINAL",onClick:e=>e(),allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:["AMEX","DISCOVER","JCB","MASTERCARD","VISA"],allowCreditCards:!0,allowPrepaidCards:!0,billingAddressRequired:!1,billingAddressParameters:void 0,assuranceDetailsRequired:!1,emailRequired:!1,shippingAddressRequired:!1,shippingAddressParameters:void 0,shippingOptionRequired:!1,shippingOptionParameters:void 0,callbackIntents:[]};export{e as default};
1
+ const e={isExpress:!1,existingPaymentMethodRequired:!1,buttonColor:"default",buttonType:"buy",buttonSizeMode:"fill",configuration:{gatewayMerchantId:"",merchantId:"",merchantName:""},amount:{value:0,currency:"USD"},totalPriceStatus:"FINAL",onClick:e=>e(),allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:["AMEX","DISCOVER","JCB","MASTERCARD","VISA"],allowCreditCards:!0,allowPrepaidCards:!0,billingAddressRequired:!1,billingAddressParameters:void 0,assuranceDetailsRequired:!1,emailRequired:!1,shippingAddressRequired:!1,shippingAddressParameters:void 0,shippingOptionRequired:!1,shippingOptionParameters:void 0,callbackIntents:[]};export{e as default};
2
2
  //# sourceMappingURL=defaultProps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"defaultProps.js","sources":["../../../../src/components/GooglePay/defaultProps.ts"],"sourcesContent":["import { GooglePayConfiguration } from './types';\n\nconst defaultProps: GooglePayConfiguration = {\n isExpress: false,\n\n // isReadyToPayRequest\n existingPaymentMethodRequired: false,\n\n // ButtonOptions\n // https://developers.google.com/pay/api/web/reference/object#ButtonOptions\n buttonColor: 'default' as google.payments.api.ButtonColor, // default/black/white\n buttonType: 'long' as google.payments.api.ButtonType, // long/short\n buttonSizeMode: undefined,\n\n // PaymentDataRequest\n configuration: {\n // Adyen's merchant account\n gatewayMerchantId: '', // E.g TestMerchant\n\n // https://developers.google.com/pay/api/web/reference/object#MerchantInfo\n merchantId: '', // E.g 039484839309\n merchantName: '' // E.g Example Merchant,\n },\n\n // Payment\n amount: {\n value: 0,\n currency: 'USD'\n },\n\n totalPriceStatus: 'FINAL' as google.payments.api.TotalPriceStatus,\n\n // Callbacks\n onClick: resolve => resolve(),\n\n // CardParameters\n // https://developers.google.com/pay/api/web/reference/object#CardParameters\n allowedAuthMethods: ['PAN_ONLY', 'CRYPTOGRAM_3DS'] as google.payments.api.CardAuthMethod[],\n allowedCardNetworks: ['AMEX', 'DISCOVER', 'JCB', 'MASTERCARD', 'VISA'] as google.payments.api.CardNetwork[],\n allowCreditCards: true, // Set to false if you don't support credit cards.\n allowPrepaidCards: true, // Set to false if you don't support prepaid cards.\n billingAddressRequired: false, // A billing address should only be requested if it's required to process the transaction.\n billingAddressParameters: undefined, // The expected fields returned if billingAddressRequired is set to true.\n assuranceDetailsRequired: false, // https://developers.google.com/pay/api/web/reference/response-objects#assurance-details-specifications\n\n emailRequired: false,\n shippingAddressRequired: false,\n shippingAddressParameters: undefined, // https://developers.google.com/pay/api/web/reference/object#ShippingAddressParameters\n shippingOptionRequired: false,\n shippingOptionParameters: undefined,\n callbackIntents: []\n};\n\nexport default defaultProps;\n"],"names":["defaultProps","isExpress","existingPaymentMethodRequired","buttonColor","buttonType","buttonSizeMode","undefined","configuration","gatewayMerchantId","merchantId","merchantName","amount","value","currency","totalPriceStatus","onClick","resolve","allowedAuthMethods","allowedCardNetworks","allowCreditCards","allowPrepaidCards","billingAddressRequired","billingAddressParameters","assuranceDetailsRequired","emailRequired","shippingAddressRequired","shippingAddressParameters","shippingOptionRequired","shippingOptionParameters","callbackIntents"],"mappings":"AAEA,MAAMA,EAAuC,CACzCC,WAAW,EAGXC,+BAA+B,EAI/BC,YAAa,UACbC,WAAY,OACZC,oBAAgBC,EAGhBC,cAAe,CAEXC,kBAAmB,GAGnBC,WAAY,GACZC,aAAc,IAIlBC,OAAQ,CACJC,MAAO,EACPC,SAAU,OAGdC,iBAAkB,QAGlBC,QAASC,GAAWA,IAIpBC,mBAAoB,CAAC,WAAY,kBACjCC,oBAAqB,CAAC,OAAQ,WAAY,MAAO,aAAc,QAC/DC,kBAAkB,EAClBC,mBAAmB,EACnBC,wBAAwB,EACxBC,8BAA0BhB,EAC1BiB,0BAA0B,EAE1BC,eAAe,EACfC,yBAAyB,EACzBC,+BAA2BpB,EAC3BqB,wBAAwB,EACxBC,8BAA0BtB,EAC1BuB,gBAAiB"}
1
+ {"version":3,"file":"defaultProps.js","sources":["../../../../src/components/GooglePay/defaultProps.ts"],"sourcesContent":["import { GooglePayConfiguration } from './types';\n\nconst defaultProps: GooglePayConfiguration = {\n isExpress: false,\n\n // isReadyToPayRequest\n existingPaymentMethodRequired: false,\n\n // ButtonOptions\n // https://developers.google.com/pay/api/web/reference/object#ButtonOptions\n buttonColor: 'default',\n buttonType: 'buy',\n buttonSizeMode: 'fill',\n\n // PaymentDataRequest\n configuration: {\n // Adyen's merchant account\n gatewayMerchantId: '', // E.g TestMerchant\n\n // https://developers.google.com/pay/api/web/reference/object#MerchantInfo\n merchantId: '', // E.g 039484839309\n merchantName: '' // E.g Example Merchant,\n },\n\n // Payment\n amount: {\n value: 0,\n currency: 'USD'\n },\n\n totalPriceStatus: 'FINAL',\n\n // Callbacks\n onClick: resolve => resolve(),\n\n // CardParameters\n // https://developers.google.com/pay/api/web/reference/object#CardParameters\n allowedAuthMethods: ['PAN_ONLY', 'CRYPTOGRAM_3DS'] as google.payments.api.CardAuthMethod[],\n allowedCardNetworks: ['AMEX', 'DISCOVER', 'JCB', 'MASTERCARD', 'VISA'] as google.payments.api.CardNetwork[],\n allowCreditCards: true, // Set to false if you don't support credit cards.\n allowPrepaidCards: true, // Set to false if you don't support prepaid cards.\n billingAddressRequired: false, // A billing address should only be requested if it's required to process the transaction.\n billingAddressParameters: undefined, // The expected fields returned if billingAddressRequired is set to true.\n assuranceDetailsRequired: false, // https://developers.google.com/pay/api/web/reference/response-objects#assurance-details-specifications\n\n emailRequired: false,\n shippingAddressRequired: false,\n shippingAddressParameters: undefined, // https://developers.google.com/pay/api/web/reference/object#ShippingAddressParameters\n shippingOptionRequired: false,\n shippingOptionParameters: undefined,\n callbackIntents: []\n};\n\nexport default defaultProps;\n"],"names":["defaultProps","isExpress","existingPaymentMethodRequired","buttonColor","buttonType","buttonSizeMode","configuration","gatewayMerchantId","merchantId","merchantName","amount","value","currency","totalPriceStatus","onClick","resolve","allowedAuthMethods","allowedCardNetworks","allowCreditCards","allowPrepaidCards","billingAddressRequired","billingAddressParameters","undefined","assuranceDetailsRequired","emailRequired","shippingAddressRequired","shippingAddressParameters","shippingOptionRequired","shippingOptionParameters","callbackIntents"],"mappings":"AAEA,MAAMA,EAAuC,CACzCC,WAAW,EAGXC,+BAA+B,EAI/BC,YAAa,UACbC,WAAY,MACZC,eAAgB,OAGhBC,cAAe,CAEXC,kBAAmB,GAGnBC,WAAY,GACZC,aAAc,IAIlBC,OAAQ,CACJC,MAAO,EACPC,SAAU,OAGdC,iBAAkB,QAGlBC,QAASC,GAAWA,IAIpBC,mBAAoB,CAAC,WAAY,kBACjCC,oBAAqB,CAAC,OAAQ,WAAY,MAAO,aAAc,QAC/DC,kBAAkB,EAClBC,mBAAmB,EACnBC,wBAAwB,EACxBC,8BAA0BC,EAC1BC,0BAA0B,EAE1BC,eAAe,EACfC,yBAAyB,EACzBC,+BAA2BJ,EAC3BK,wBAAwB,EACxBC,8BAA0BN,EAC1BO,gBAAiB"}
@@ -1,2 +1,2 @@
1
- import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import r from"../internal/PersonalDetails/PersonalDetails.js";import{CoreProvider as s}from"../../core/Context/CoreProvider.js";import{TxVariants as o}from"../tx-variants.js";import n from"../internal/FormInstruction/FormInstruction.js";class i extends e{static type=o.personal_details;static defaultProps={showFormInstruction:!0};get data(){return this.state.data}get isValid(){return!!this.state.isValid}render(){return t(s,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},this.props.showFormInstruction&&t(n,null),t(r,{setComponentRef:this.setComponentRef,...this.props,onChange:this.setState,...!1}))}}export{i as PersonalDetailsElement,i as default};
1
+ import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import r from"../internal/PersonalDetails/PersonalDetails.js";import{CoreProvider as s}from"../../core/Context/CoreProvider.js";import{TxVariants as o}from"../tx-variants.js";import n from"../internal/FormInstruction/FormInstruction.js";class i extends e{static type=o.personal_details;static defaultProps={showFormInstruction:!0};get data(){return this.state.data}get isValid(){return!!this.state.isValid}render(){return t(s,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},this.props.showFormInstruction&&t(n,null),t(r,{setComponentRef:this.setComponentRef,...this.props,onChange:this.setState}))}}export{i as PersonalDetailsElement,i as default};
2
2
  //# sourceMappingURL=PersonalDetails.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PersonalDetails.js","sources":["../../../../src/components/PersonalDetails/PersonalDetails.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport PersonalDetails from '../internal/PersonalDetails';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport { TxVariants } from '../tx-variants';\nimport FormInstruction from '../internal/FormInstruction';\nimport { UIElementProps } from '../internal/UIElement/types';\n\ninterface PersonalDetailsConfiguration extends UIElementProps {\n showFormInstruction?: boolean;\n}\n\nexport class PersonalDetailsElement extends UIElement<PersonalDetailsConfiguration> {\n public static type = TxVariants.personal_details;\n\n protected static defaultProps = {\n showFormInstruction: true\n };\n\n get data() {\n return this.state.data;\n }\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n {this.props.showFormInstruction && <FormInstruction />}\n <PersonalDetails\n setComponentRef={this.setComponentRef}\n {...this.props}\n onChange={this.setState}\n {...(process.env.NODE_ENV !== 'production' && { payButton: this.payButton })}\n />\n </CoreProvider>\n );\n }\n}\n\nexport default PersonalDetailsElement;\n"],"names":["PersonalDetailsElement","UIElement","static","TxVariants","personal_details","showFormInstruction","data","this","state","isValid","render","h","CoreProvider","i18n","props","loadingContext","resources","FormInstruction","PersonalDetails","setComponentRef","onChange","setState"],"mappings":"iXAYO,MAAMA,UAA+BC,EACxCC,YAAqBC,EAAWC,iBAEhCF,oBAAgC,CAC5BG,qBAAqB,GAGzB,QAAIC,GACA,OAAOC,KAAKC,MAAMF,IACtB,CAEA,WAAIG,GACA,QAASF,KAAKC,MAAMC,OACxB,CAEAC,MAAAA,GACI,OACIC,EAACC,EAAAA,CAAaC,KAAMN,KAAKO,MAAMD,KAAME,eAAgBR,KAAKO,MAAMC,eAAgBC,UAAWT,KAAKS,WAC3FT,KAAKO,MAAMT,qBAAuBM,EAACM,QACpCN,EAACO,EAAAA,CACGC,gBAAiBZ,KAAKY,mBAClBZ,KAAKO,MACTM,SAAUb,KAAKc,aACV,IAIrB"}
1
+ {"version":3,"file":"PersonalDetails.js","sources":["../../../../src/components/PersonalDetails/PersonalDetails.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport PersonalDetails from '../internal/PersonalDetails';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport { TxVariants } from '../tx-variants';\nimport FormInstruction from '../internal/FormInstruction';\nimport { UIElementProps } from '../internal/UIElement/types';\n\ninterface PersonalDetailsConfiguration extends UIElementProps {\n showFormInstruction?: boolean;\n}\n\nexport class PersonalDetailsElement extends UIElement<PersonalDetailsConfiguration> {\n public static type = TxVariants.personal_details;\n\n protected static defaultProps = {\n showFormInstruction: true\n };\n\n get data() {\n return this.state.data;\n }\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n {this.props.showFormInstruction && <FormInstruction />}\n <PersonalDetails\n setComponentRef={this.setComponentRef}\n {...this.props}\n onChange={this.setState}\n {...(process.env.NODE_ENV !== 'production' && { payButton: this.payButton })}\n />\n </CoreProvider>\n );\n }\n}\n\nexport default PersonalDetailsElement;\n"],"names":["PersonalDetailsElement","UIElement","static","TxVariants","personal_details","showFormInstruction","data","this","state","isValid","render","h","CoreProvider","i18n","props","loadingContext","resources","FormInstruction","PersonalDetails","setComponentRef","onChange","setState"],"mappings":"iXAYO,MAAMA,UAA+BC,EACxCC,YAAqBC,EAAWC,iBAEhCF,oBAAgC,CAC5BG,qBAAqB,GAGzB,QAAIC,GACA,OAAOC,KAAKC,MAAMF,IACtB,CAEA,WAAIG,GACA,QAASF,KAAKC,MAAMC,OACxB,CAEAC,MAAAA,GACI,OACIC,EAACC,EAAAA,CAAaC,KAAMN,KAAKO,MAAMD,KAAME,eAAgBR,KAAKO,MAAMC,eAAgBC,UAAWT,KAAKS,WAC3FT,KAAKO,MAAMT,qBAAuBM,EAACM,QACpCN,EAACO,EAAAA,CACGC,gBAAiBZ,KAAKY,mBAClBZ,KAAKO,MACTM,SAAUb,KAAKc,WAK/B"}
@@ -1,2 +1,2 @@
1
- import{createElement as e,Fragment as t}from"../../../external/preact/dist/preact.js";import{useRef as s,useMemo as o,useState as r,useCallback as a,useEffect as n}from"../../../external/preact/hooks/dist/hooks.js";import i from"../FormFields/Fieldset/Fieldset.js";import l from"./components/ReadOnlyAddress.js";import{getAddressValidationRules as d}from"./validate.js";import{addressFormatters as c,countrySpecificFormatters as u}from"./validate.formats.js";import m from"./components/FieldContainer.js";import p from"../../../utils/useForm/useForm.js";import f from"./Specifications.js";import{FALLBACK_VALUE as y,ADDRESS_SCHEMA as F}from"./constants.js";import{getMaxLengthByFieldAndCountry as h}from"../../../utils/validator-utils.js";import{useCoreContext as C}from"../../../core/Context/CoreProvider.js";import g from"./components/AddressSearch.js";function A(A){const{i18n:v}=C(),{label:b="",requiredFields:j,visibility:x,iOSFocusedField:S=null,showContextualElement:k}=A,M=s({});Object.keys(M.current).length||A.setComponentRef?.(M.current);const O=o((()=>new f(A.specifications)),[A.specifications]),w=O.getAddressSchemaForCountryFlat(A.countryCode).filter((e=>j.includes(e))),[D,E]=r(!1),[B,N]=r(!1),[P,L]=r(""),R=!!A.onAddressLookup,V=!A.onAddressLookup||(D||B),{data:q,errors:H,valid:T,isValid:_,handleChangeFor:I,triggerValidation:$,setData:z}=p({schema:w,defaultData:A.data,rules:{...d(O),...A.validationRules},formatters:c}),G=a((e=>{F.forEach((t=>{const s=e[t];null!=s&&z(t,String(s))})),$(),E(!0)}),[E,$,z]),J=a((()=>{N(!0)}),[]);M.current.showValidation=()=>{$(),L(!R||V||_?"":v.get("address.errors.incomplete"))};const K=w.filter((e=>!S||e===S));if(n((()=>{const e=O.countryHasDataset(q.country)?"":y,t={...q,stateOrProvince:e};j.forEach((e=>{I(e,"input")(t[e]??"")})),t.postalCode&&I("postalCode","blur")(q.postalCode)}),[q.country]),n((()=>{const e=j.includes("stateOrProvince"),t=q.country&&O.countryHasDataset(q.country),s=e&&t,o=q.stateOrProvince||(s?"":y);I("stateOrProvince","input")(o)}),[]),n((()=>{const e=O.getOptionalFieldsForCountry(q.country),t=F.reduce(((t,s)=>{const o=e.includes(s),r=j.includes(s),a=q[s],n=A.data[s],i=o&&!a||!r?r||a||!n?y:n:a;return i?.length&&(t[s]=i),t}),{});A.onChange({data:t,valid:T,errors:H,isValid:_})}),[q,T,H,_]),"hidden"===x)return null;if("readOnly"===x)return e(l,{data:q,label:b});const Q=(t,{classNameModifiers:s=[]})=>j.includes(t)?e(m,{key:t,allowedCountries:A.allowedCountries,classNameModifiers:[...s,t],data:q,errors:H,valid:T,fieldName:t,onInput:I(t,"input"),onBlur:I(t,"blur"),onDropdownChange:I(t,"blur"),specifications:O,maxLength:h(u,t,q.country,!0),trimOnBlur:!0,disabled:!K.includes(t),onFieldFocusAnalytics:A.onFieldFocusAnalytics,onFieldBlurAnalytics:A.onFieldBlurAnalytics}):null,U=O.getAddressSchemaForCountry(q.country);return e(t,null,e(i,{classNameModifiers:[b||"address"],label:b},R&&e(g,{onAddressLookup:A.onAddressLookup,onAddressSelected:A.onAddressSelected,onSelect:G,onManualAddress:J,externalErrorMessage:P,hideManualButton:V,showContextualElement:k,contextualText:v.get("address.search.contextualText"),addressSearchDebounceMs:A.addressSearchDebounceMs}),V&&e(t,null,U.map((t=>t instanceof Array?e("div",{className:"adyen-checkout__field-group"},t.map((([e,t])=>Q(e,{classNameModifiers:[`col-${t}`]})))):Q(t,{}))))))}A.defaultProps={countryCode:null,validationRules:null,data:{},onChange:()=>{},visibility:"editable",requiredFields:F,specifications:{},onFieldFocusAnalytics:()=>{},onFieldBlurAnalytics:()=>{}};export{A as default};
1
+ import{createElement as e,Fragment as t}from"../../../external/preact/dist/preact.js";import{useRef as s,useMemo as o,useState as r,useCallback as a,useEffect as n}from"../../../external/preact/hooks/dist/hooks.js";import i from"../FormFields/Fieldset/Fieldset.js";import l from"./components/ReadOnlyAddress.js";import{getAddressValidationRules as d}from"./validate.js";import{addressFormatters as c,countrySpecificFormatters as u}from"./validate.formats.js";import m from"./components/FieldContainer.js";import p from"../../../utils/useForm/useForm.js";import f from"./Specifications.js";import{FALLBACK_VALUE as y,ADDRESS_SCHEMA as F}from"./constants.js";import{getMaxLengthByFieldAndCountry as h}from"../../../utils/validator-utils.js";import{useCoreContext as C}from"../../../core/Context/CoreProvider.js";import g from"./components/AddressSearch.js";function A(A){const{i18n:v}=C(),{label:b="",requiredFields:j,visibility:x,iOSFocusedField:S=null,showContextualElement:k}=A,M=s({});Object.keys(M.current).length||A.setComponentRef?.(M.current);const O=o((()=>new f(A.specifications)),[A.specifications]),w=O.getAddressSchemaForCountryFlat(A.countryCode).filter((e=>j.includes(e))),[D,E]=r(!1),[B,N]=r(!1),[P,L]=r(""),R=!!A.onAddressLookup,V=!A.onAddressLookup||(D||B),{data:q,errors:H,valid:T,isValid:_,handleChangeFor:I,triggerValidation:$,setData:z}=p({schema:w,defaultData:A.data,rules:{...d(O),...A.validationRules},formatters:c}),G=a((e=>{F.forEach((t=>{const s=e[t];null!=s&&z(t,String(s))})),$(),E(!0)}),[E,$,z]),J=a((()=>{N(!0)}),[]);M.current.showValidation=()=>{$(),L(!R||V||_?"":v.get("address.errors.incomplete"))};const K=w.filter((e=>!S||e===S));if(n((()=>{const e=O.countryHasDataset(q.country)?"":y,t={...q,stateOrProvince:e};j.forEach((e=>{I(e,"input")(t[e]??"")})),t.postalCode&&I("postalCode","blur")(q.postalCode)}),[q.country]),n((()=>{const e=j.includes("stateOrProvince"),t=q.country&&O.countryHasDataset(q.country),s=e&&t,o=q.stateOrProvince||(s?"":y);I("stateOrProvince","input")(o)}),[]),n((()=>{const e=O.getOptionalFieldsForCountry(q.country),t=F.reduce(((t,s)=>{const o=e.includes(s),r=j.includes(s),a=q[s],n=A.data[s],i=o&&!a||!r?r||a||!n?y:n:a;return i?.length&&(t[s]=i),t}),{});A.onChange({data:t,valid:T,errors:H,isValid:_})}),[q,T,H,_]),"hidden"===x)return null;if("readOnly"===x)return e(l,{data:q,label:b});const Q=(t,{classNameModifiers:s=[]})=>j.includes(t)?e(m,{key:t,allowedCountries:A.allowedCountries,classNameModifiers:[...s,t],data:q,errors:H,valid:T,fieldName:t,onInput:I(t,"input"),onBlur:I(t,"blur"),onDropdownChange:I(t,"blur"),specifications:O,maxLength:h(u,t,q.country),trimOnBlur:!0,disabled:!K.includes(t),onFieldFocusAnalytics:A.onFieldFocusAnalytics,onFieldBlurAnalytics:A.onFieldBlurAnalytics}):null,U=O.getAddressSchemaForCountry(q.country);return e(t,null,e(i,{classNameModifiers:[b||"address"],label:b},R&&e(g,{onAddressLookup:A.onAddressLookup,onAddressSelected:A.onAddressSelected,onSelect:G,onManualAddress:J,externalErrorMessage:P,hideManualButton:V,showContextualElement:k,contextualText:v.get("address.search.contextualText"),addressSearchDebounceMs:A.addressSearchDebounceMs}),V&&e(t,null,U.map((t=>t instanceof Array?e("div",{className:"adyen-checkout__field-group"},t.map((([e,t])=>Q(e,{classNameModifiers:[`col-${t}`]})))):Q(t,{}))))))}A.defaultProps={countryCode:null,validationRules:null,data:{},onChange:()=>{},visibility:"editable",requiredFields:F,specifications:{},onFieldFocusAnalytics:()=>{},onFieldBlurAnalytics:()=>{}};export{A as default};
2
2
  //# sourceMappingURL=Address.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Address.js","sources":["../../../../../src/components/internal/Address/Address.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'preact/hooks';\nimport Fieldset from '../FormFields/Fieldset';\nimport ReadOnlyAddress from './components/ReadOnlyAddress';\nimport { getAddressValidationRules } from './validate';\nimport { addressFormatters, countrySpecificFormatters } from './validate.formats';\nimport { AddressProps } from './types';\nimport { AddressData } from '../../../types/global-types';\nimport FieldContainer from './components/FieldContainer';\nimport useForm from '../../../utils/useForm';\nimport Specifications from './Specifications';\nimport { ADDRESS_SCHEMA, FALLBACK_VALUE } from './constants';\nimport { getMaxLengthByFieldAndCountry } from '../../../utils/validator-utils';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport AddressSearch from './components/AddressSearch';\nimport { ComponentMethodsRef } from '../UIElement/types';\n\nexport default function Address(props: AddressProps) {\n const { i18n } = useCoreContext();\n\n const { label = '', requiredFields, visibility, iOSFocusedField = null, showContextualElement } = props;\n\n /** An object by which to expose 'public' members to the parent UIElement */\n const addressRef = useRef<ComponentMethodsRef>({});\n // Just call once\n if (!Object.keys(addressRef.current).length) {\n props.setComponentRef?.(addressRef.current);\n }\n\n const specifications = useMemo(() => new Specifications(props.specifications), [props.specifications]);\n\n const requiredFieldsSchema = specifications.getAddressSchemaForCountryFlat(props.countryCode).filter(field => requiredFields.includes(field));\n\n const [hasSelectedAddress, setHasSelectedAddress] = useState(false);\n\n const [useManualAddress, setUseManualAddress] = useState(false);\n\n const [searchErrorMessage, setSearchErrorMessage] = useState('');\n\n const showAddressSearch = !!props.onAddressLookup;\n\n const showAddressFields = props.onAddressLookup ? hasSelectedAddress || useManualAddress : true;\n\n const { data, errors, valid, isValid, handleChangeFor, triggerValidation, setData } = useForm<AddressData>({\n schema: requiredFieldsSchema,\n defaultData: props.data,\n // Ensure any passed validation rules are merged with the default ones\n rules: { ...getAddressValidationRules(specifications), ...props.validationRules },\n formatters: addressFormatters\n });\n\n const setSearchData = useCallback(\n (selectedAddress: AddressData) => {\n const propsKeysToProcess = ADDRESS_SCHEMA;\n propsKeysToProcess.forEach(propKey => {\n // Make sure the data provided by the merchant is always strings\n const providedValue = selectedAddress[propKey];\n if (providedValue === null || providedValue === undefined) return;\n // Cast everything to string\n setData(propKey, String(providedValue));\n });\n triggerValidation();\n setHasSelectedAddress(true);\n },\n [setHasSelectedAddress, triggerValidation, setData]\n );\n\n const onManualAddress = useCallback(() => {\n setUseManualAddress(true);\n }, []);\n\n // Expose method expected by (parent) Address.tsx\n addressRef.current.showValidation = () => {\n triggerValidation();\n if (showAddressSearch && !showAddressFields && !isValid) {\n setSearchErrorMessage(i18n.get('address.errors.incomplete'));\n } else {\n setSearchErrorMessage('');\n }\n };\n\n /**\n * For iOS: iOSFocusedField is the name of the element calling for other elements to be disabled\n * - so if it is set (meaning we are in iOS *and* an input has been focussed) only enable the field that corresponds to this element\n */\n const enabledFields: string[] = requiredFieldsSchema.filter(item => {\n return !iOSFocusedField ? true : item === iOSFocusedField;\n });\n\n /**\n * Effect that:\n * - Resets validation for all fields by triggering handleChangeFor(fieldName, 'input')\n * - Applies validation on postalCode field in case it has any value\n */\n useEffect((): void => {\n const stateOrProvince = specifications.countryHasDataset(data.country) ? '' : FALLBACK_VALUE;\n const newData = { ...data, stateOrProvince };\n\n requiredFields.forEach(fieldName => {\n handleChangeFor(fieldName, 'input')(newData[fieldName] ?? '');\n });\n\n if (newData.postalCode) {\n handleChangeFor('postalCode', 'blur')(data.postalCode);\n }\n }, [data.country]);\n\n /**\n * Set the value of 'stateOrProvince' during the initial render if\n * property is provided during the creation of the payment method\n */\n useEffect((): void => {\n const stateFieldIsRequired = requiredFields.includes('stateOrProvince');\n const countryHasStatesDataset = data.country && specifications.countryHasDataset(data.country);\n const addressShouldHaveState = stateFieldIsRequired && countryHasStatesDataset;\n const stateOrProvince = data.stateOrProvince || (addressShouldHaveState ? '' : FALLBACK_VALUE);\n\n handleChangeFor('stateOrProvince', 'input')(stateOrProvince);\n }, []);\n\n useEffect((): void => {\n const optionalFields = specifications.getOptionalFieldsForCountry(data.country);\n const processedData = ADDRESS_SCHEMA.reduce((acc, cur) => {\n const isOptional = optionalFields.includes(cur);\n const isRequired = requiredFields.includes(cur);\n const newValue = data[cur];\n const initialValue = props.data[cur];\n // recover default data values which are not requiredFields, or prefill with 'N/A'\n const fallbackValue = !isRequired && !newValue && !!initialValue ? initialValue : FALLBACK_VALUE;\n const value = (isOptional && !newValue) || !isRequired ? fallbackValue : newValue;\n if (value?.length) acc[cur] = value;\n return acc;\n }, {});\n\n props.onChange({ data: processedData, valid, errors, isValid });\n }, [data, valid, errors, isValid]);\n\n if (visibility === 'hidden') return null;\n if (visibility === 'readOnly') return <ReadOnlyAddress data={data} label={label} />;\n\n const getComponent = (fieldName: string, { classNameModifiers = [] }) => {\n if (!requiredFields.includes(fieldName)) return null;\n\n return (\n <FieldContainer\n key={fieldName}\n allowedCountries={props.allowedCountries}\n classNameModifiers={[...classNameModifiers, fieldName]}\n data={data}\n errors={errors}\n valid={valid}\n fieldName={fieldName}\n onInput={handleChangeFor(fieldName, 'input')}\n onBlur={handleChangeFor(fieldName, 'blur')}\n onDropdownChange={handleChangeFor(fieldName, 'blur')}\n specifications={specifications}\n maxLength={getMaxLengthByFieldAndCountry(countrySpecificFormatters, fieldName, data.country, true)}\n trimOnBlur={true}\n disabled={!enabledFields.includes(fieldName)}\n onFieldFocusAnalytics={props.onFieldFocusAnalytics}\n onFieldBlurAnalytics={props.onFieldBlurAnalytics}\n />\n );\n };\n\n const getWrapper = group => (\n <div className=\"adyen-checkout__field-group\">\n {group.map(([field, size]) => getComponent(field, { classNameModifiers: [`col-${size}`] }))}\n </div>\n );\n\n const addressSchema = specifications.getAddressSchemaForCountry(data.country);\n\n return (\n <Fragment>\n <Fieldset classNameModifiers={[label || 'address']} label={label}>\n {showAddressSearch && (\n <AddressSearch\n onAddressLookup={props.onAddressLookup}\n onAddressSelected={props.onAddressSelected}\n onSelect={setSearchData}\n onManualAddress={onManualAddress}\n externalErrorMessage={searchErrorMessage}\n hideManualButton={showAddressFields}\n showContextualElement={showContextualElement}\n contextualText={i18n.get('address.search.contextualText')}\n addressSearchDebounceMs={props.addressSearchDebounceMs}\n />\n )}\n {showAddressFields && (\n <Fragment>{addressSchema.map(field => (field instanceof Array ? getWrapper(field) : getComponent(field, {})))}</Fragment>\n )}\n </Fieldset>\n </Fragment>\n );\n}\n\nAddress.defaultProps = {\n countryCode: null,\n validationRules: null,\n data: {},\n onChange: () => {},\n visibility: 'editable',\n requiredFields: ADDRESS_SCHEMA,\n specifications: {},\n onFieldFocusAnalytics: () => {},\n onFieldBlurAnalytics: () => {}\n};\n"],"names":["Address","props","i18n","useCoreContext","label","requiredFields","visibility","iOSFocusedField","showContextualElement","addressRef","useRef","Object","keys","current","length","setComponentRef","specifications","useMemo","Specifications","requiredFieldsSchema","getAddressSchemaForCountryFlat","countryCode","filter","field","includes","hasSelectedAddress","setHasSelectedAddress","useState","useManualAddress","setUseManualAddress","searchErrorMessage","setSearchErrorMessage","showAddressSearch","onAddressLookup","showAddressFields","data","errors","valid","isValid","handleChangeFor","triggerValidation","setData","useForm","schema","defaultData","rules","getAddressValidationRules","validationRules","formatters","addressFormatters","setSearchData","useCallback","selectedAddress","ADDRESS_SCHEMA","forEach","propKey","providedValue","String","onManualAddress","showValidation","get","enabledFields","item","useEffect","stateOrProvince","countryHasDataset","country","FALLBACK_VALUE","newData","fieldName","postalCode","stateFieldIsRequired","countryHasStatesDataset","addressShouldHaveState","optionalFields","getOptionalFieldsForCountry","processedData","reduce","acc","cur","isOptional","isRequired","newValue","initialValue","value","onChange","h","ReadOnlyAddress","getComponent","classNameModifiers","FieldContainer","key","allowedCountries","onInput","onBlur","onDropdownChange","maxLength","getMaxLengthByFieldAndCountry","countrySpecificFormatters","trimOnBlur","disabled","onFieldFocusAnalytics","onFieldBlurAnalytics","addressSchema","getAddressSchemaForCountry","Fragment","Fieldset","AddressSearch","onAddressSelected","onSelect","externalErrorMessage","hideManualButton","contextualText","addressSearchDebounceMs","map","Array","div","className","size","defaultProps"],"mappings":"u1BAiBe,SAASA,EAAQC,GAC5B,MAAMC,KAAEA,GAASC,KAEXC,MAAEA,EAAQ,GAAEC,eAAEA,EAAcC,WAAEA,EAAUC,gBAAEA,EAAkB,KAAIC,sBAAEA,GAA0BP,EAG5FQ,EAAaC,EAA4B,CAAA,GAE1CC,OAAOC,KAAKH,EAAWI,SAASC,QACjCb,EAAMc,kBAAkBN,EAAWI,SAGvC,MAAMG,EAAiBC,GAAQ,IAAM,IAAIC,EAAejB,EAAMe,iBAAiB,CAACf,EAAMe,iBAEhFG,EAAuBH,EAAeI,+BAA+BnB,EAAMoB,aAAaC,QAAOC,GAASlB,EAAemB,SAASD,MAE/HE,EAAoBC,GAAyBC,GAAS,IAEtDC,EAAkBC,GAAuBF,GAAS,IAElDG,EAAoBC,GAAyBJ,EAAS,IAEvDK,IAAsB/B,EAAMgC,gBAE5BC,GAAoBjC,EAAMgC,kBAAkBR,GAAsBG,IAElEO,KAAEA,EAAIC,OAAEA,EAAMC,MAAEA,EAAKC,QAAEA,EAAOC,gBAAEA,EAAeC,kBAAEA,EAAiBC,QAAEA,GAAYC,EAAqB,CACvGC,OAAQxB,EACRyB,YAAa3C,EAAMkC,KAEnBU,MAAO,IAAKC,EAA0B9B,MAAoBf,EAAM8C,iBAChEC,WAAYC,IAGVC,EAAgBC,GACjBC,IAC8BC,EACRC,SAAQC,IAEvB,MAAMC,EAAgBJ,EAAgBG,GAClCC,SAEJf,EAAQc,EAASE,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,KAAU9B,EAAajE,EAAO,CAAEkE,mBAAoB,CAAC,OAAO6B,UAuBY9B,EAAajE,EAAO,QAK5H,CAEAvB,EAAQuH,aAAe,CACnBlG,YAAa,KACb0B,gBAAiB,KACjBZ,KAAM,CAAC,EACPkD,SAAU,OACV/E,WAAY,WACZD,eAAgBgD,EAChBrC,eAAgB,CAAC,EACjBqF,sBAAuB,OACvBC,qBAAsB"}
1
+ {"version":3,"file":"Address.js","sources":["../../../../../src/components/internal/Address/Address.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'preact/hooks';\nimport Fieldset from '../FormFields/Fieldset';\nimport ReadOnlyAddress from './components/ReadOnlyAddress';\nimport { getAddressValidationRules } from './validate';\nimport { addressFormatters, countrySpecificFormatters } from './validate.formats';\nimport { AddressProps } from './types';\nimport { AddressData } from '../../../types/global-types';\nimport FieldContainer from './components/FieldContainer';\nimport useForm from '../../../utils/useForm';\nimport Specifications from './Specifications';\nimport { ADDRESS_SCHEMA, FALLBACK_VALUE } from './constants';\nimport { getMaxLengthByFieldAndCountry } from '../../../utils/validator-utils';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport AddressSearch from './components/AddressSearch';\nimport { ComponentMethodsRef } from '../UIElement/types';\n\nexport default function Address(props: AddressProps) {\n const { i18n } = useCoreContext();\n\n const { label = '', requiredFields, visibility, iOSFocusedField = null, showContextualElement } = props;\n\n /** An object by which to expose 'public' members to the parent UIElement */\n const addressRef = useRef<ComponentMethodsRef>({});\n // Just call once\n if (!Object.keys(addressRef.current).length) {\n props.setComponentRef?.(addressRef.current);\n }\n\n const specifications = useMemo(() => new Specifications(props.specifications), [props.specifications]);\n\n const requiredFieldsSchema = specifications.getAddressSchemaForCountryFlat(props.countryCode).filter(field => requiredFields.includes(field));\n\n const [hasSelectedAddress, setHasSelectedAddress] = useState(false);\n\n const [useManualAddress, setUseManualAddress] = useState(false);\n\n const [searchErrorMessage, setSearchErrorMessage] = useState('');\n\n const showAddressSearch = !!props.onAddressLookup;\n\n const showAddressFields = props.onAddressLookup ? hasSelectedAddress || useManualAddress : true;\n\n const { data, errors, valid, isValid, handleChangeFor, triggerValidation, setData } = useForm<AddressData>({\n schema: requiredFieldsSchema,\n defaultData: props.data,\n // Ensure any passed validation rules are merged with the default ones\n rules: { ...getAddressValidationRules(specifications), ...props.validationRules },\n formatters: addressFormatters\n });\n\n const setSearchData = useCallback(\n (selectedAddress: AddressData) => {\n const propsKeysToProcess = ADDRESS_SCHEMA;\n propsKeysToProcess.forEach(propKey => {\n // Make sure the data provided by the merchant is always strings\n const providedValue = selectedAddress[propKey];\n if (providedValue === null || providedValue === undefined) return;\n // Cast everything to string\n setData(propKey, String(providedValue));\n });\n triggerValidation();\n setHasSelectedAddress(true);\n },\n [setHasSelectedAddress, triggerValidation, setData]\n );\n\n const onManualAddress = useCallback(() => {\n setUseManualAddress(true);\n }, []);\n\n // Expose method expected by (parent) Address.tsx\n addressRef.current.showValidation = () => {\n triggerValidation();\n if (showAddressSearch && !showAddressFields && !isValid) {\n setSearchErrorMessage(i18n.get('address.errors.incomplete'));\n } else {\n setSearchErrorMessage('');\n }\n };\n\n /**\n * For iOS: iOSFocusedField is the name of the element calling for other elements to be disabled\n * - so if it is set (meaning we are in iOS *and* an input has been focussed) only enable the field that corresponds to this element\n */\n const enabledFields: string[] = requiredFieldsSchema.filter(item => {\n return !iOSFocusedField ? true : item === iOSFocusedField;\n });\n\n /**\n * Effect that:\n * - Resets validation for all fields by triggering handleChangeFor(fieldName, 'input')\n * - Applies validation on postalCode field in case it has any value\n */\n useEffect((): void => {\n const stateOrProvince = specifications.countryHasDataset(data.country) ? '' : FALLBACK_VALUE;\n const newData = { ...data, stateOrProvince };\n\n requiredFields.forEach(fieldName => {\n handleChangeFor(fieldName, 'input')(newData[fieldName] ?? '');\n });\n\n if (newData.postalCode) {\n handleChangeFor('postalCode', 'blur')(data.postalCode);\n }\n }, [data.country]);\n\n /**\n * Set the value of 'stateOrProvince' during the initial render if\n * property is provided during the creation of the payment method\n */\n useEffect((): void => {\n const stateFieldIsRequired = requiredFields.includes('stateOrProvince');\n const countryHasStatesDataset = data.country && specifications.countryHasDataset(data.country);\n const addressShouldHaveState = stateFieldIsRequired && countryHasStatesDataset;\n const stateOrProvince = data.stateOrProvince || (addressShouldHaveState ? '' : FALLBACK_VALUE);\n\n handleChangeFor('stateOrProvince', 'input')(stateOrProvince);\n }, []);\n\n useEffect((): void => {\n const optionalFields = specifications.getOptionalFieldsForCountry(data.country);\n const processedData = ADDRESS_SCHEMA.reduce((acc, cur) => {\n const isOptional = optionalFields.includes(cur);\n const isRequired = requiredFields.includes(cur);\n const newValue = data[cur];\n const initialValue = props.data[cur];\n // recover default data values which are not requiredFields, or prefill with 'N/A'\n const fallbackValue = !isRequired && !newValue && !!initialValue ? initialValue : FALLBACK_VALUE;\n const value = (isOptional && !newValue) || !isRequired ? fallbackValue : newValue;\n if (value?.length) acc[cur] = value;\n return acc;\n }, {});\n\n props.onChange({ data: processedData, valid, errors, isValid });\n }, [data, valid, errors, isValid]);\n\n if (visibility === 'hidden') return null;\n if (visibility === 'readOnly') return <ReadOnlyAddress data={data} label={label} />;\n\n const getComponent = (fieldName: string, { classNameModifiers = [] }) => {\n if (!requiredFields.includes(fieldName)) return null;\n\n return (\n <FieldContainer\n key={fieldName}\n allowedCountries={props.allowedCountries}\n classNameModifiers={[...classNameModifiers, fieldName]}\n data={data}\n errors={errors}\n valid={valid}\n fieldName={fieldName}\n onInput={handleChangeFor(fieldName, 'input')}\n onBlur={handleChangeFor(fieldName, 'blur')}\n onDropdownChange={handleChangeFor(fieldName, 'blur')}\n specifications={specifications}\n maxLength={getMaxLengthByFieldAndCountry(countrySpecificFormatters, fieldName, data.country, true)}\n trimOnBlur={true}\n disabled={!enabledFields.includes(fieldName)}\n onFieldFocusAnalytics={props.onFieldFocusAnalytics}\n onFieldBlurAnalytics={props.onFieldBlurAnalytics}\n />\n );\n };\n\n const getWrapper = group => (\n <div className=\"adyen-checkout__field-group\">\n {group.map(([field, size]) => getComponent(field, { classNameModifiers: [`col-${size}`] }))}\n </div>\n );\n\n const addressSchema = specifications.getAddressSchemaForCountry(data.country);\n\n return (\n <Fragment>\n <Fieldset classNameModifiers={[label || 'address']} label={label}>\n {showAddressSearch && (\n <AddressSearch\n onAddressLookup={props.onAddressLookup}\n onAddressSelected={props.onAddressSelected}\n onSelect={setSearchData}\n onManualAddress={onManualAddress}\n externalErrorMessage={searchErrorMessage}\n hideManualButton={showAddressFields}\n showContextualElement={showContextualElement}\n contextualText={i18n.get('address.search.contextualText')}\n addressSearchDebounceMs={props.addressSearchDebounceMs}\n />\n )}\n {showAddressFields && (\n <Fragment>{addressSchema.map(field => (field instanceof Array ? getWrapper(field) : getComponent(field, {})))}</Fragment>\n )}\n </Fieldset>\n </Fragment>\n );\n}\n\nAddress.defaultProps = {\n countryCode: null,\n validationRules: null,\n data: {},\n onChange: () => {},\n visibility: 'editable',\n requiredFields: ADDRESS_SCHEMA,\n specifications: {},\n onFieldFocusAnalytics: () => {},\n onFieldBlurAnalytics: () => {}\n};\n"],"names":["Address","props","i18n","useCoreContext","label","requiredFields","visibility","iOSFocusedField","showContextualElement","addressRef","useRef","Object","keys","current","length","setComponentRef","specifications","useMemo","Specifications","requiredFieldsSchema","getAddressSchemaForCountryFlat","countryCode","filter","field","includes","hasSelectedAddress","setHasSelectedAddress","useState","useManualAddress","setUseManualAddress","searchErrorMessage","setSearchErrorMessage","showAddressSearch","onAddressLookup","showAddressFields","data","errors","valid","isValid","handleChangeFor","triggerValidation","setData","useForm","schema","defaultData","rules","getAddressValidationRules","validationRules","formatters","addressFormatters","setSearchData","useCallback","selectedAddress","ADDRESS_SCHEMA","forEach","propKey","providedValue","String","onManualAddress","showValidation","get","enabledFields","item","useEffect","stateOrProvince","countryHasDataset","country","FALLBACK_VALUE","newData","fieldName","postalCode","stateFieldIsRequired","countryHasStatesDataset","addressShouldHaveState","optionalFields","getOptionalFieldsForCountry","processedData","reduce","acc","cur","isOptional","isRequired","newValue","initialValue","value","onChange","h","ReadOnlyAddress","getComponent","classNameModifiers","FieldContainer","key","allowedCountries","onInput","onBlur","onDropdownChange","maxLength","getMaxLengthByFieldAndCountry","countrySpecificFormatters","trimOnBlur","disabled","onFieldFocusAnalytics","onFieldBlurAnalytics","addressSchema","getAddressSchemaForCountry","Fragment","Fieldset","AddressSearch","onAddressSelected","onSelect","externalErrorMessage","hideManualButton","contextualText","addressSearchDebounceMs","map","Array","div","className","size","defaultProps"],"mappings":"u1BAiBe,SAASA,EAAQC,GAC5B,MAAMC,KAAEA,GAASC,KAEXC,MAAEA,EAAQ,GAAEC,eAAEA,EAAcC,WAAEA,EAAUC,gBAAEA,EAAkB,KAAIC,sBAAEA,GAA0BP,EAG5FQ,EAAaC,EAA4B,CAAA,GAE1CC,OAAOC,KAAKH,EAAWI,SAASC,QACjCb,EAAMc,kBAAkBN,EAAWI,SAGvC,MAAMG,EAAiBC,GAAQ,IAAM,IAAIC,EAAejB,EAAMe,iBAAiB,CAACf,EAAMe,iBAEhFG,EAAuBH,EAAeI,+BAA+BnB,EAAMoB,aAAaC,QAAOC,GAASlB,EAAemB,SAASD,MAE/HE,EAAoBC,GAAyBC,GAAS,IAEtDC,EAAkBC,GAAuBF,GAAS,IAElDG,EAAoBC,GAAyBJ,EAAS,IAEvDK,IAAsB/B,EAAMgC,gBAE5BC,GAAoBjC,EAAMgC,kBAAkBR,GAAsBG,IAElEO,KAAEA,EAAIC,OAAEA,EAAMC,MAAEA,EAAKC,QAAEA,EAAOC,gBAAEA,EAAeC,kBAAEA,EAAiBC,QAAEA,GAAYC,EAAqB,CACvGC,OAAQxB,EACRyB,YAAa3C,EAAMkC,KAEnBU,MAAO,IAAKC,EAA0B9B,MAAoBf,EAAM8C,iBAChEC,WAAYC,IAGVC,EAAgBC,GACjBC,IAC8BC,EACRC,SAAQC,IAEvB,MAAMC,EAAgBJ,EAAgBG,GAClCC,SAEJf,EAAQc,EA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AU9B,EAAajE,EAAO,CAAEkE,mBAAoB,CAAC,OAAO6B,UAuBY9B,EAAajE,EAAO,QAK5H,CAEAvB,EAAQuH,aAAe,CACnBlG,YAAa,KACb0B,gBAAiB,KACjBZ,KAAM,CAAC,EACPkD,SAAU,OACV/E,WAAY,WACZD,eAAgBgD,EAChBrC,eAAgB,CAAC,EACjBqF,sBAAuB,OACvBC,qBAAsB"}
@@ -1,2 +1,2 @@
1
- import{createElement as t,Fragment as e}from"../../../../../external/preact/dist/preact.js";import{useState as r,useEffect as o,useCallback as s}from"../../../../../external/preact/hooks/dist/hooks.js";import a from"../../context/useClickToPayContext.js";import n from"./CtPSingleCard/CtPSingleCard.js";import i from"../../../PayButton/PayButton.js";import{amountLabel as c}from"../../../PayButton/utils.js";import l from"./CtPCardsList/CtPCardsList.js";import m from"../../services/sdks/SrciError.js";import u from"../CtPSection/CtPSection.js";import{CTP_IFRAME_NAME as d}from"../../services/utils.js";import p from"../../../IFrame/Iframe.js";import f from"../../../../../core/Context/useImage.js";import{useCoreContext as g}from"../../../../../core/Context/CoreProvider.js";import C from"../../../../../utils/isMobile.js";function h(t,e){if(!t)return null;const r=e.get(`ctp.errors.${t}`);return r.includes("ctp.errors")?e.get("ctp.errors.UNKNOWN_ERROR"):r}function y(t,e,r){return r?C()?null:t.get("payButton.with",{values:{value:c(t,e),maskedData:`•••• ${r?.panLastFour}`}}):t.get("payButton")}const P=({onDisplayCardComponent:c})=>{const{i18n:C}=g(),P=f(),{amount:j,cards:k,checkout:S,isCtpPrimaryPaymentMethod:x,status:b,onSubmit:v,onSetStatus:E,onError:B}=a(),[M,N]=r(k.find((t=>!t.isExpired))||k[0]),[$,w]=r(null),F=k.every((t=>t.isExpired)),[R,_]=r(!1);o((()=>{(0===k.length||F)&&c?.()}),[c,F,k]);const D=s((async()=>{if(M)try{_(!0),w(null),E("loading");const t=await S(M);v(t)}catch(t){t instanceof m&&(w(t?.reason),console.warn(`CtP - Checkout: Reason: ${t?.reason} / Source: ${t?.source} / Scheme: ${t?.scheme}`)),_(!1),B(t)}}),[S,M]),I=s((t=>{N(t)}),[]),L=R&&"loading"===b&&M?.isDcfPopupEmbedded,T="loading"!==b||!L;return t(e,null,t(p,{name:d,height:"380",width:"100%",classNameModifiers:[L?"":"hidden"]}),T&&t(e,null,t(u.Title,null,C.get("ctp.cards.title")),t(u.Text,null,C.get("ctp.cards.subtitle")),0===k.length&&t("div",{className:"adyen-checkout-ctp__empty-cards"},C.get("ctp.emptyProfile.message")),1===k.length&&t(n,{card:k[0],errorMessage:h($,C)}),k.length>1&&t(l,{cardSelected:M,cards:k,onChangeCard:I,errorMessage:h($,C)}),t(i,{disabled:F,amount:j,label:y(C,j,M),status:b,variant:x?"primary":"secondary",icon:0!==k.length&&P({imageFolder:"components/"})(x?"lock":"lock_black"),onClick:D})))};export{P as default};
1
+ import{createElement as t,Fragment as e}from"../../../../../external/preact/dist/preact.js";import{useState as r,useEffect as o,useCallback as s}from"../../../../../external/preact/hooks/dist/hooks.js";import a from"../../context/useClickToPayContext.js";import n from"./CtPSingleCard/CtPSingleCard.js";import i from"../../../PayButton/PayButton.js";import{amountLabel as c}from"../../../PayButton/utils.js";import l from"./CtPCardsList/CtPCardsList.js";import m from"../../services/sdks/SrciError.js";import u from"../CtPSection/CtPSection.js";import{CTP_IFRAME_NAME as d}from"../../services/utils.js";import p from"../../../IFrame/Iframe.js";import f from"../../../../../core/Context/useImage.js";import{useCoreContext as g}from"../../../../../core/Context/CoreProvider.js";import C from"../../../../../utils/isMobile.js";import h from"../../../../../core/Errors/AdyenCheckoutError.js";import{PREFIX as y}from"../../../Icon/constants.js";function P(t,e){if(!t)return null;const r=e.get(`ctp.errors.${t}`);return r.includes("ctp.errors")?e.get("ctp.errors.UNKNOWN_ERROR"):r}function j(t,e,r){return r?C()?null:t.get("payButton.with",{values:{value:c(t,e),maskedData:`•••• ${r?.panLastFour}`}}):t.get("payButton")}const k=({onDisplayCardComponent:c})=>{const{i18n:C}=g(),k=f(),{amount:E,cards:S,checkout:x,isCtpPrimaryPaymentMethod:b,status:v,onSubmit:R,onSetStatus:$,onError:w}=a(),[B,M]=r(S.find((t=>!t.isExpired))||S[0]),[N,F]=r(null),I=S.every((t=>t.isExpired)),[T,_]=r(!1);o((()=>{(0===S.length||I)&&c?.()}),[c,I,S]);const D=s((async()=>{if(B)try{_(!0),F(null),$("loading");const t=await x(B);R(t)}catch(t){t instanceof m&&(F(t?.reason),console.warn(`CtP - Checkout: Reason: ${t?.reason} / Source: ${t?.source} / Scheme: ${t?.scheme}`)),_(!1),w(t instanceof h?t:new h("ERROR","Error during ClickToPay checkout",{cause:t}))}}),[x,B]),L=s((t=>{M(t)}),[]),O=T&&"loading"===v&&B?.isDcfPopupEmbedded,A="loading"!==v||!O;return t(e,null,t(p,{name:d,height:"380",width:"100%",classNameModifiers:[O?"":"hidden"]}),A&&t(e,null,t(u.Title,null,C.get("ctp.cards.title")),t(u.Text,null,C.get("ctp.cards.subtitle")),0===S.length&&t("div",{className:"adyen-checkout-ctp__empty-cards"},C.get("ctp.emptyProfile.message")),1===S.length&&t(n,{card:S[0],errorMessage:P(N,C)}),S.length>1&&t(l,{cardSelected:B,cards:S,onChangeCard:L,errorMessage:P(N,C)}),t(i,{disabled:I,amount:E,label:j(C,E,B),status:v,variant:b?"primary":"secondary",icon:0!==S.length&&k({imageFolder:"components/"})(b?`${y}lock`:`${y}lock_black`),onClick:D})))};export{k as default};
2
2
  //# sourceMappingURL=CtPCards.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CtPCards.js","sources":["../../../../../../../src/components/internal/ClickToPay/components/CtPCards/CtPCards.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useCallback, useEffect, useState } from 'preact/hooks';\nimport useClickToPayContext from '../../context/useClickToPayContext';\nimport CtPSingleCard from './CtPSingleCard/CtPSingleCard';\nimport PayButton from '../../../PayButton';\nimport { amountLabel } from '../../../PayButton/utils';\nimport CtPCardsList from './CtPCardsList';\nimport ShopperCard from '../../models/ShopperCard';\nimport SrciError from '../../services/sdks/SrciError';\nimport CtPSection from '../CtPSection';\nimport { CTP_IFRAME_NAME } from '../../services/utils';\nimport Iframe from '../../../../internal/IFrame';\nimport useImage from '../../../../../core/Context/useImage';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport isMobile from '../../../../../utils/isMobile';\nimport Language from '../../../../../language';\nimport { PaymentAmount } from '../../../../../types/global-types';\nimport './CtPCards.scss';\n\ntype CtPCardsProps = {\n onDisplayCardComponent?(): void;\n};\n\nfunction getErrorLabel(errorCode: string, i18n: Language): string {\n if (!errorCode) return null;\n\n const errorLabel = i18n.get(`ctp.errors.${errorCode}`);\n if (errorLabel.includes('ctp.errors')) return i18n.get(`ctp.errors.UNKNOWN_ERROR`);\n return errorLabel;\n}\n\nfunction getPayButtonLabel(i18n: Language, amount: PaymentAmount, checkoutCard?: ShopperCard): string | null {\n if (!checkoutCard) return i18n.get('payButton');\n if (!isMobile())\n return i18n.get('payButton.with', {\n values: { value: amountLabel(i18n, amount), maskedData: `•••• ${checkoutCard?.panLastFour}` }\n });\n return null;\n}\n\nconst CtPCards = ({ onDisplayCardComponent }: CtPCardsProps) => {\n const { i18n } = useCoreContext();\n const getImage = useImage();\n const { amount, cards, checkout, isCtpPrimaryPaymentMethod, status, onSubmit, onSetStatus, onError } = useClickToPayContext();\n const [checkoutCard, setCheckoutCard] = useState<ShopperCard | undefined>(cards.find(card => !card.isExpired) || cards[0]);\n const [errorCode, setErrorCode] = useState<string>(null);\n const isEveryCardExpired = cards.every(card => card.isExpired);\n const [isShopperCheckingOutWithCtp, setIsShopperCheckingOutWithCtp] = useState<boolean>(false);\n\n useEffect(() => {\n if (cards.length === 0 || isEveryCardExpired) {\n onDisplayCardComponent?.();\n }\n }, [onDisplayCardComponent, isEveryCardExpired, cards]);\n\n const doCheckout = useCallback(async () => {\n if (!checkoutCard) return;\n\n try {\n setIsShopperCheckingOutWithCtp(true);\n setErrorCode(null);\n onSetStatus('loading');\n const payload = await checkout(checkoutCard);\n onSubmit(payload);\n } catch (error) {\n if (error instanceof SrciError) {\n setErrorCode(error?.reason);\n console.warn(`CtP - Checkout: Reason: ${error?.reason} / Source: ${error?.source} / Scheme: ${error?.scheme}`);\n }\n setIsShopperCheckingOutWithCtp(false);\n onError(error);\n }\n }, [checkout, checkoutCard]);\n\n const handleOnChangeCard = useCallback((card: ShopperCard) => {\n setCheckoutCard(card);\n }, []);\n\n /**\n * If shopper submits the payment using the default Card component while CtP is rendered, the status here will be updated\n * and that can potentially display an iframe.\n *\n * Therefore, we use the flag 'isShopperCheckingOutWithCtp' to flag that the iframe should be displayed only in case the\n * Shopper is checking out with Click to Pay.\n */\n const displayNetworkDcf = isShopperCheckingOutWithCtp && status === 'loading' && checkoutCard?.isDcfPopupEmbedded;\n const displayCardCheckoutView = status !== 'loading' || !displayNetworkDcf;\n\n return (\n <Fragment>\n <Iframe name={CTP_IFRAME_NAME} height=\"380\" width=\"100%\" classNameModifiers={[displayNetworkDcf ? '' : 'hidden']} />\n\n {displayCardCheckoutView && (\n <Fragment>\n <CtPSection.Title>{i18n.get('ctp.cards.title')}</CtPSection.Title>\n <CtPSection.Text>{i18n.get('ctp.cards.subtitle')}</CtPSection.Text>\n\n {cards.length === 0 && <div className=\"adyen-checkout-ctp__empty-cards\">{i18n.get('ctp.emptyProfile.message')}</div>}\n {cards.length === 1 && <CtPSingleCard card={cards[0]} errorMessage={getErrorLabel(errorCode, i18n)} />}\n {cards.length > 1 && (\n <CtPCardsList\n cardSelected={checkoutCard}\n cards={cards}\n onChangeCard={handleOnChangeCard}\n errorMessage={getErrorLabel(errorCode, i18n)}\n />\n )}\n\n <PayButton\n disabled={isEveryCardExpired}\n amount={amount}\n label={getPayButtonLabel(i18n, amount, checkoutCard)}\n status={status}\n variant={isCtpPrimaryPaymentMethod ? 'primary' : 'secondary'}\n icon={cards.length !== 0 && getImage({ imageFolder: 'components/' })(isCtpPrimaryPaymentMethod ? 'lock' : 'lock_black')}\n onClick={doCheckout}\n />\n </Fragment>\n )}\n </Fragment>\n );\n};\n\nexport default CtPCards;\n"],"names":["getErrorLabel","errorCode","i18n","errorLabel","get","includes","getPayButtonLabel","amount","checkoutCard","isMobile","values","value","amountLabel","maskedData","panLastFour","CtPCards","onDisplayCardComponent","useCoreContext","getImage","useImage","cards","checkout","isCtpPrimaryPaymentMethod","status","onSubmit","onSetStatus","onError","useClickToPayContext","setCheckoutCard","useState","find","card","isExpired","setErrorCode","isEveryCardExpired","every","isShopperCheckingOutWithCtp","setIsShopperCheckingOutWithCtp","useEffect","length","doCheckout","useCallback","async","payload","error","SrciError","reason","console","warn","source","scheme","handleOnChangeCard","displayNetworkDcf","isDcfPopupEmbedded","displayCardCheckoutView","h","Fragment","Iframe","name","CTP_IFRAME_NAME","height","width","classNameModifiers","CtPSection","Title","Text","div","className","CtPSingleCard","errorMessage","CtPCardsList","cardSelected","onChangeCard","PayButton","disabled","label","variant","icon","imageFolder","onClick"],"mappings":"wzBAuBA,SAASA,EAAcC,EAAmBC,GACtC,IAAKD,EAAW,OAAO,KAEvB,MAAME,EAAaD,EAAKE,IAAI,cAAcH,KAC1C,OAAIE,EAAWE,SAAS,cAAsBH,EAAKE,IAAI,4BAChDD,CACX,CAEA,SAASG,EAAkBJ,EAAgBK,EAAuBC,GAC9D,OAAKA,EACAC,IAIE,KAHIP,EAAKE,IAAI,iBAAkB,CAC9BM,OAAQ,CAAEC,MAAOC,EAAYV,EAAMK,GAASM,WAAY,QAAQL,GAAcM,iBAH5DZ,EAAKE,IAAI,YAMvC,CAEA,MAAMW,EAAW,EAAGC,6BAChB,MAAMd,KAAEA,GAASe,IACXC,EAAWC,KACXZ,OAAEA,EAAMa,MAAEA,EAAKC,SAAEA,EAAQC,0BAAEA,EAAyBC,OAAEA,EAAMC,SAAEA,EAAQC,YAAEA,EAAWC,QAAEA,GAAYC,KAChGnB,EAAcoB,GAAmBC,EAAkCT,EAAMU,MAAKC,IAASA,EAAKC,aAAcZ,EAAM,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SAAUxC,EACV3B,OAAQA,EACRoE,MAAOrE,EAAkBJ,EAAMK,EAAQC,GACvCe,OAAQA,EACRqD,QAAStD,EAA4B,UAAY,YACjDuD,KAAuB,IAAjBzD,EAAMmB,QAAgBrB,EAAS,CAAE4D,YAAa,eAAxB5D,CAAyCI,EAA4B,OAAS,cAC1GyD,QAASvC"}
1
+ {"version":3,"file":"CtPCards.js","sources":["../../../../../../../src/components/internal/ClickToPay/components/CtPCards/CtPCards.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useCallback, useEffect, useState } from 'preact/hooks';\nimport useClickToPayContext from '../../context/useClickToPayContext';\nimport CtPSingleCard from './CtPSingleCard/CtPSingleCard';\nimport PayButton from '../../../PayButton';\nimport { amountLabel } from '../../../PayButton/utils';\nimport CtPCardsList from './CtPCardsList';\nimport ShopperCard from '../../models/ShopperCard';\nimport SrciError from '../../services/sdks/SrciError';\nimport CtPSection from '../CtPSection';\nimport { CTP_IFRAME_NAME } from '../../services/utils';\nimport Iframe from '../../../../internal/IFrame';\nimport useImage from '../../../../../core/Context/useImage';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport isMobile from '../../../../../utils/isMobile';\nimport Language from '../../../../../language';\nimport { PaymentAmount } from '../../../../../types/global-types';\nimport './CtPCards.scss';\nimport AdyenCheckoutError from '../../../../../core/Errors/AdyenCheckoutError';\nimport { PREFIX } from '../../../Icon/constants';\n\n\ntype CtPCardsProps = {\n onDisplayCardComponent?(): void;\n};\n\nfunction getErrorLabel(errorCode: string, i18n: Language): string {\n if (!errorCode) return null;\n\n const errorLabel = i18n.get(`ctp.errors.${errorCode}`);\n if (errorLabel.includes('ctp.errors')) return i18n.get(`ctp.errors.UNKNOWN_ERROR`);\n return errorLabel;\n}\n\nfunction getPayButtonLabel(i18n: Language, amount: PaymentAmount, checkoutCard?: ShopperCard): string | null {\n if (!checkoutCard) return i18n.get('payButton');\n if (!isMobile())\n return i18n.get('payButton.with', {\n values: { value: amountLabel(i18n, amount), maskedData: `•••• ${checkoutCard?.panLastFour}` }\n });\n return null;\n}\n\nconst CtPCards = ({ onDisplayCardComponent }: CtPCardsProps) => {\n const { i18n } = useCoreContext();\n const getImage = useImage();\n const { amount, cards, checkout, isCtpPrimaryPaymentMethod, status, onSubmit, onSetStatus, onError } = useClickToPayContext();\n const [checkoutCard, setCheckoutCard] = useState<ShopperCard | undefined>(cards.find(card => !card.isExpired) || cards[0]);\n const [errorCode, setErrorCode] = useState<string>(null);\n const isEveryCardExpired = cards.every(card => card.isExpired);\n const [isShopperCheckingOutWithCtp, setIsShopperCheckingOutWithCtp] = useState<boolean>(false);\n\n useEffect(() => {\n if (cards.length === 0 || isEveryCardExpired) {\n onDisplayCardComponent?.();\n }\n }, [onDisplayCardComponent, isEveryCardExpired, cards]);\n\n const doCheckout = useCallback(async () => {\n if (!checkoutCard) return;\n\n try {\n setIsShopperCheckingOutWithCtp(true);\n setErrorCode(null);\n onSetStatus('loading');\n const payload = await checkout(checkoutCard);\n onSubmit(payload);\n } catch (error: unknown) {\n if (error instanceof SrciError) {\n setErrorCode(error?.reason);\n console.warn(`CtP - Checkout: Reason: ${error?.reason} / Source: ${error?.source} / Scheme: ${error?.scheme}`);\n }\n setIsShopperCheckingOutWithCtp(false);\n\n if (error instanceof AdyenCheckoutError) onError(error);\n else onError(new AdyenCheckoutError('ERROR', 'Error during ClickToPay checkout', { cause: error }));\n }\n }, [checkout, checkoutCard]);\n\n const handleOnChangeCard = useCallback((card: ShopperCard) => {\n setCheckoutCard(card);\n }, []);\n\n /**\n * If shopper submits the payment using the default Card component while CtP is rendered, the status here will be updated\n * and that can potentially display an iframe.\n *\n * Therefore, we use the flag 'isShopperCheckingOutWithCtp' to flag that the iframe should be displayed only in case the\n * Shopper is checking out with Click to Pay.\n */\n const displayNetworkDcf = isShopperCheckingOutWithCtp && status === 'loading' && checkoutCard?.isDcfPopupEmbedded;\n const displayCardCheckoutView = status !== 'loading' || !displayNetworkDcf;\n\n return (\n <Fragment>\n <Iframe name={CTP_IFRAME_NAME} height=\"380\" width=\"100%\" classNameModifiers={[displayNetworkDcf ? '' : 'hidden']} />\n\n {displayCardCheckoutView && (\n <Fragment>\n <CtPSection.Title>{i18n.get('ctp.cards.title')}</CtPSection.Title>\n <CtPSection.Text>{i18n.get('ctp.cards.subtitle')}</CtPSection.Text>\n\n {cards.length === 0 && <div className=\"adyen-checkout-ctp__empty-cards\">{i18n.get('ctp.emptyProfile.message')}</div>}\n {cards.length === 1 && <CtPSingleCard card={cards[0]} errorMessage={getErrorLabel(errorCode, i18n)} />}\n {cards.length > 1 && (\n <CtPCardsList\n cardSelected={checkoutCard}\n cards={cards}\n onChangeCard={handleOnChangeCard}\n errorMessage={getErrorLabel(errorCode, i18n)}\n />\n )}\n\n <PayButton\n disabled={isEveryCardExpired}\n amount={amount}\n label={getPayButtonLabel(i18n, amount, checkoutCard)}\n status={status}\n variant={isCtpPrimaryPaymentMethod ? 'primary' : 'secondary'}\n icon={\n cards.length !== 0 &&\n getImage({ imageFolder: 'components/' })(isCtpPrimaryPaymentMethod ? `${PREFIX}lock` : `${PREFIX}lock_black`)\n }\n onClick={doCheckout}\n />\n </Fragment>\n )}\n </Fragment>\n );\n};\n\nexport default CtPCards;\n"],"names":["getErrorLabel","errorCode","i18n","errorLabel","get","includes","getPayButtonLabel","amount","checkoutCard","isMobile","values","value","amountLabel","maskedData","panLastFour","CtPCards","onDisplayCardComponent","useCoreContext","getImage","useImage","cards","checkout","isCtpPrimaryPaymentMethod","status","onSubmit","onSetStatus","onError","useClickToPayContext","setCheckoutCard","useState","find","card","isExpired","setErrorCode","isEveryCardExpired","every","isShopperCheckingOutWithCtp","setIsShopperCheckingOutWithCtp","useEffect","length","doCheckout","useCallback","async","payload","error","SrciError","reason","console","warn","source","scheme","AdyenCheckoutError","cause","handleOnChangeCard","displayNetworkDcf","isDcfPopupEmbedded","displayCardCheckoutView","h","Fragment","Iframe","name","CTP_IFRAME_NAME","height","width","classNameModifiers","CtPSection","Title","Text","div","className","CtPSingleCard","errorMessage","CtPCardsList","cardSelected","onChangeCard","PayButton","disabled","label","variant","icon","imageFolder","PREFIX","onClick"],"mappings":"46BA0BA,SAASA,EAAcC,EAAmBC,GACtC,IAAKD,EAAW,OAAO,KAEvB,MAAME,EAAaD,EAAKE,IAAI,cAAcH,KAC1C,OAAIE,EAAWE,SAAS,cAAsBH,EAAKE,IAAI,4BAChDD,CACX,CAEA,SAASG,EAAkBJ,EAAgBK,EAAuBC,GAC9D,OAAKA,EACAC,IAIE,KAHIP,EAAKE,IAAI,iBAAkB,CAC9BM,OAAQ,CAAEC,MAAOC,EAAYV,EAAMK,GAASM,WAAY,QAAQL,GAAcM,iBAH5DZ,EAAKE,IAAI,YAMvC,CAEA,MAAMW,EAAW,EAAGC,6BAChB,MAAMd,KAAEA,GAASe,IACXC,EAAWC,KACXZ,OAAEA,EAAMa,MAAEA,EAAKC,SAAEA,EAAQC,0BAAEA,EAAyBC,OAAEA,EAAMC,SAAEA,EAAQC,YAAEA,EAAWC,QAAEA,GAAYC,KAChGnB,EAAcoB,GAAmBC,EAAkCT,EAAMU,MAAKC,IAASA,EAAKC,aAAcZ,EAAM,KAChHnB,EAAWgC,GAAgBJ,EAAiB,MAC7CK,EAAqBd,EAAMe,OAAMJ,GAAQA,EAAKC,aAC7CI,EAA6BC,GAAkCR,GAAkB,GAExFS,GAAU,MACe,IAAjBlB,EAAMmB,QAAgBL,IACtBlB,KACJ,GACD,CAACA,EAAwBkB,EAAoBd,IAEhD,MAAMoB,EAAaC,GAAYC,UAC3B,GAAKlC,EAEL,IACI6B,GAA+B,GAC/BJ,EAAa,MACbR,EAAY,WACZ,MAAMkB,QAAgBtB,EAASb,GAC/BgB,EAASmB,EACb,CAAE,MAAOC,GACDA,aAAiBC,IACjBZ,EAAaW,GAAOE,QACpBC,QAAQC,KAAK,2BAA2BJ,GAAOE,oBAAoBF,GAAOK,oBAAoBL,GAAOM,WAEzGb,GAA+B,GAEUX,EAArCkB,aAAiBO,EAA4BP,EACpC,IAAIO,EAAmB,QAAS,mCAAoC,CAAEC,MAAOR,IAC9F,IACD,CAACvB,EAAUb,IAER6C,EAAqBZ,GAAaV,IACpCH,EAAgBG,EAAAA,GACjB,IASGuB,EAAoBlB,GAA0C,YAAXb,GAAwBf,GAAc+C,mBACzFC,EAAqC,YAAXjC,IAAyB+B,EAEzD,OACIG,EAACC,OACGD,EAACE,EAAAA,CAAOC,KAAMC,EAAiBC,OAAO,MAAMC,MAAM,OAAOC,mBAAoB,CAACV,EAAoB,GAAK,YAEtGE,GACGC,EAACC,OACGD,EAACQ,EAAWC,MAAOhE,KAAAA,EAAKE,IAAI,oBAC5BqD,EAACQ,EAAWE,KAAI,KAAEjE,EAAKE,IAAI,uBAET,IAAjBgB,EAAMmB,QAAgBkB,EAACW,MAAAA,CAAIC,UAAU,mCAAmCnE,EAAKE,IAAI,6BAChE,IAAjBgB,EAAMmB,QAAgBkB,EAACa,EAAAA,CAAcvC,KAAMX,EAAM,GAAImD,aAAcvE,EAAcC,EAAWC,KAC5FkB,EAAMmB,OAAS,GACZkB,EAACe,EAAAA,CACGC,aAAcjE,EACdY,MAAOA,EACPsD,aAAcrB,EACdkB,aAAcvE,EAAcC,EAAWC,KAI/CuD,EAACkB,EAAAA,CACGC,SAAU1C,EACV3B,OAAQA,EACRsE,MAAOvE,EAAkBJ,EAAMK,EAAQC,GACvCe,OAAQA,EACRuD,QAASxD,EAA4B,UAAY,YACjDyD,KACqB,IAAjB3D,EAAMmB,QACNrB,EAAS,CAAE8D,YAAa,eAAxB9D,CAAyCI,EAA4B,GAAG2D,QAAe,GAAGA,eAE9FC,QAAS1C"}
@@ -1,2 +1,2 @@
1
- import{createElement as t,Fragment as o}from"../../../../../external/preact/dist/preact.js";import{useState as r,useCallback as e}from"../../../../../external/preact/hooks/dist/hooks.js";import n from"../../../Button/Button.js";import s from"../../context/useClickToPayContext.js";import i from"./CtPLoginInput.js";import{CtPInfo as a}from"../CtPInfo/CtPInfo.js";import l from"../CtPSection/CtPSection.js";import p from"../../services/sdks/SrciError.js";import{useCoreContext as m}from"../../../../../core/Context/CoreProvider.js";import c from"../../errors/TimeoutError.js";const d=()=>{const{i18n:d}=m(),{isCtpPrimaryPaymentMethod:u,setIsCtpPrimaryPaymentMethod:f,verifyIfShopperIsEnrolled:g,startIdentityValidation:C}=s(),[P,h]=r(null),[y,j]=r(!1),[I,S]=r(null),[x,E]=r(!1),[k,v]=r(null),T=e((t=>{v(t)}),[]),b=e((({data:t,isValid:o})=>{h(t.shopperLogin),j(o),t?.shopperLogin?.length>0&&f(!0)}),[]),w=e((async()=>{if(S(null),y){E(!0);try{const{isEnrolled:t}=await g({shopperEmail:P});t?await C():(S("NOT_FOUND"),E(!1))}catch(t){t instanceof p&&console.warn(`CtP - Login error: ${t.toString()}`),t instanceof c&&console.warn(t.toString()),S(t?.reason),E(!1)}}else k.validateInput()}),[g,C,P,y,k]);return t(o,null,t(l.Title,{endAdornment:t(a,null)},d.get("ctp.login.title")),t(l.Text,null,d.get("ctp.login.subtitle")),t(i,{onChange:b,onSetInputHandlers:T,disabled:x,errorMessage:I&&d.get(`ctp.errors.${I}`),onPressEnter:w}),t(n,{label:d.get("continue"),variant:u?"primary":"secondary",status:x&&"loading",onClick:()=>{w()}}))};export{d as default};
1
+ import{createElement as t,Fragment as r}from"../../../../../external/preact/dist/preact.js";import{useState as o,useCallback as e}from"../../../../../external/preact/hooks/dist/hooks.js";import n from"../../../Button/Button.js";import s from"../../context/useClickToPayContext.js";import i from"./CtPLoginInput.js";import{CtPInfo as a}from"../CtPInfo/CtPInfo.js";import l from"../CtPSection/CtPSection.js";import m from"../../services/sdks/SrciError.js";import{useCoreContext as p}from"../../../../../core/Context/CoreProvider.js";import c from"../../errors/TimeoutError.js";import{isSrciError as u}from"../../services/utils.js";const d=()=>{const{i18n:d}=p(),{isCtpPrimaryPaymentMethod:f,setIsCtpPrimaryPaymentMethod:g,verifyIfShopperIsEnrolled:C,startIdentityValidation:P}=s(),[h,j]=o(null),[y,I]=o(!1),[S,x]=o(null),[E,k]=o(!1),[v,T]=o(null),b=e((t=>{T(t)}),[]),w=e((({data:t,isValid:r})=>{j(t.shopperLogin),I(r),t?.shopperLogin?.length>0&&g(!0)}),[]),L=e((async()=>{if(x(null),y){k(!0);try{const{isEnrolled:t}=await C({shopperEmail:h});t?await P():(x("NOT_FOUND"),k(!1))}catch(t){t instanceof m&&console.warn(`CtP - Login error: ${t.toString()}`),t instanceof c&&console.warn(t.toString()),u(t)?x(t?.reason):console.error(t),k(!1)}}else v.validateInput()}),[C,P,h,y,v]);return t(r,null,t(l.Title,{endAdornment:t(a,null)},d.get("ctp.login.title")),t(l.Text,null,d.get("ctp.login.subtitle")),t(i,{onChange:w,onSetInputHandlers:b,disabled:E,errorMessage:S&&d.get(`ctp.errors.${S}`),onPressEnter:L}),t(n,{label:d.get("continue"),variant:f?"primary":"secondary",status:E&&"loading",onClick:()=>{L()}}))};export{d as default};
2
2
  //# sourceMappingURL=CtPLogin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CtPLogin.js","sources":["../../../../../../../src/components/internal/ClickToPay/components/CtPLogin/CtPLogin.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useCallback, useState } from 'preact/hooks';\nimport Button from '../../../Button';\nimport useClickToPayContext from '../../context/useClickToPayContext';\nimport CtPLoginInput, { CtPLoginInputHandlers } from './CtPLoginInput';\nimport { CtPInfo } from '../CtPInfo';\nimport CtPSection from '../CtPSection';\nimport SrciError from '../../services/sdks/SrciError';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport './CtPLogin.scss';\nimport TimeoutError from '../../errors/TimeoutError';\n\nconst CtPLogin = (): h.JSX.Element => {\n const { i18n } = useCoreContext();\n const { isCtpPrimaryPaymentMethod, setIsCtpPrimaryPaymentMethod, verifyIfShopperIsEnrolled, startIdentityValidation } = useClickToPayContext();\n const [shopperLogin, setShopperLogin] = useState<string>(null);\n const [isValid, setIsValid] = useState<boolean>(false);\n const [errorCode, setErrorCode] = useState<string>(null);\n const [isLoggingIn, setIsLoggingIn] = useState<boolean>(false);\n const [loginInputHandlers, setLoginInputHandlers] = useState<CtPLoginInputHandlers>(null);\n\n const onSetLoginInputHandlers = useCallback((handlers: CtPLoginInputHandlers) => {\n setLoginInputHandlers(handlers);\n }, []);\n\n const handleOnLoginChange = useCallback(({ data, isValid }) => {\n setShopperLogin(data.shopperLogin);\n setIsValid(isValid);\n\n // As soon as the Shopper interacts with input, the CtP becomes the primary PM\n if (data?.shopperLogin?.length > 0) {\n setIsCtpPrimaryPaymentMethod(true);\n }\n }, []);\n\n const handleOnLoginButtonClick = useCallback(async () => {\n setErrorCode(null);\n\n if (!isValid) {\n loginInputHandlers.validateInput();\n return;\n }\n\n setIsLoggingIn(true);\n\n try {\n const { isEnrolled } = await verifyIfShopperIsEnrolled({ shopperEmail: shopperLogin });\n if (isEnrolled) {\n await startIdentityValidation();\n } else {\n setErrorCode('NOT_FOUND');\n setIsLoggingIn(false);\n }\n } catch (error) {\n if (error instanceof SrciError) console.warn(`CtP - Login error: ${error.toString()}`);\n if (error instanceof TimeoutError) console.warn(error.toString());\n setErrorCode(error?.reason);\n setIsLoggingIn(false);\n }\n }, [verifyIfShopperIsEnrolled, startIdentityValidation, shopperLogin, isValid, loginInputHandlers]);\n\n return (\n <Fragment>\n <CtPSection.Title endAdornment={<CtPInfo />}>{i18n.get('ctp.login.title')}</CtPSection.Title>\n\n <CtPSection.Text>{i18n.get('ctp.login.subtitle')}</CtPSection.Text>\n\n <CtPLoginInput\n onChange={handleOnLoginChange}\n onSetInputHandlers={onSetLoginInputHandlers}\n disabled={isLoggingIn}\n errorMessage={errorCode && i18n.get(`ctp.errors.${errorCode}`)}\n onPressEnter={handleOnLoginButtonClick}\n />\n\n <Button\n label={i18n.get('continue')}\n variant={isCtpPrimaryPaymentMethod ? 'primary' : 'secondary'}\n status={isLoggingIn && 'loading'}\n onClick={() => {\n void handleOnLoginButtonClick();\n }}\n />\n </Fragment>\n );\n};\n\nexport default CtPLogin;\n"],"names":["CtPLogin","i18n","useCoreContext","isCtpPrimaryPaymentMethod","setIsCtpPrimaryPaymentMethod","verifyIfShopperIsEnrolled","startIdentityValidation","useClickToPayContext","shopperLogin","setShopperLogin","useState","isValid","setIsValid","errorCode","setErrorCode","isLoggingIn","setIsLoggingIn","loginInputHandlers","setLoginInputHandlers","onSetLoginInputHandlers","useCallback","handlers","handleOnLoginChange","data","length","handleOnLoginButtonClick","async","isEnrolled","shopperEmail","error","SrciError","console","warn","toString","TimeoutError","reason","validateInput","h","Fragment","CtPSection","Title","endAdornment","CtPInfo","get","Text","CtPLoginInput","onChange","onSetInputHandlers","disabled","errorMessage","onPressEnter","Button","label","variant","status","onClick"],"mappings":"+jBAYA,MAAMA,EAAW,KACb,MAAMC,KAAEA,GAASC,KACXC,0BAAEA,EAAyBC,6BAAEA,EAA4BC,0BAAEA,EAAyBC,wBAAEA,GAA4BC,KACjHC,EAAcC,GAAmBC,EAAiB,OAClDC,EAASC,GAAcF,GAAkB,IACzCG,EAAWC,GAAgBJ,EAAiB,OAC5CK,EAAaC,GAAkBN,GAAkB,IACjDO,EAAoBC,GAAyBR,EAAgC,MAE9ES,EAA0BC,GAAaC,IACzCH,EAAsBG,EAAAA,GACvB,IAEGC,EAAsBF,GAAY,EAAGG,OAAMZ,cAC7CF,EAAgBc,EAAKf,cACrBI,EAAWD,GAGPY,GAAMf,cAAcgB,OAAS,GAC7BpB,GAA6B,EACjC,GACD,IAEGqB,EAA2BL,GAAYM,UAGzC,GAFAZ,EAAa,MAERH,EAAL,CAKAK,GAAe,GAEf,IACI,MAAMW,WAAEA,SAAqBtB,EAA0B,CAAEuB,aAAcpB,IACnEmB,QACMrB,KAENQ,EAAa,aACbE,GAAe,GAEvB,CAAE,MAAOa,GACDA,aAAiBC,GAAWC,QAAQC,KAAK,sBAAsBH,EAAMI,cACrEJ,aAAiBK,GAAcH,QAAQC,KAAKH,EAAMI,YACtDnB,EAAae,GAAOM,QACpBnB,GAAe,EACnB,CAjBA,MAFIC,EAAmBmB,eAmBvB,GACD,CAAC/B,EAA2BC,EAAyBE,EAAcG,EAASM,IAE/E,OACIoB,EAACC,EAAAA,KACGD,EAACE,EAAWC,MAAK,CAACC,aAAcJ,EAACK,EAAAA,OAAazC,EAAK0C,IAAI,oBAEvDN,EAACE,EAAWK,KAAI,KAAE3C,EAAK0C,IAAI,uBAE3BN,EAACQ,EAAAA,CACGC,SAAUxB,EACVyB,mBAAoB5B,EACpB6B,SAAUjC,EACVkC,aAAcpC,GAAaZ,EAAK0C,IAAI,cAAc9B,KAClDqC,aAAczB,IAGlBY,EAACc,EAAAA,CACGC,MAAOnD,EAAK0C,IAAI,YAChBU,QAASlD,EAA4B,UAAY,YACjDmD,OAAQvC,GAAe,UACvBwC,QAAS,KACA9B,GAAAA"}
1
+ {"version":3,"file":"CtPLogin.js","sources":["../../../../../../../src/components/internal/ClickToPay/components/CtPLogin/CtPLogin.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useCallback, useState } from 'preact/hooks';\nimport Button from '../../../Button';\nimport useClickToPayContext from '../../context/useClickToPayContext';\nimport CtPLoginInput, { CtPLoginInputHandlers } from './CtPLoginInput';\nimport { CtPInfo } from '../CtPInfo';\nimport CtPSection from '../CtPSection';\nimport SrciError from '../../services/sdks/SrciError';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport './CtPLogin.scss';\nimport TimeoutError from '../../errors/TimeoutError';\nimport { isSrciError } from '../../services/utils';\n\nconst CtPLogin = (): h.JSX.Element => {\n const { i18n } = useCoreContext();\n const { isCtpPrimaryPaymentMethod, setIsCtpPrimaryPaymentMethod, verifyIfShopperIsEnrolled, startIdentityValidation } = useClickToPayContext();\n const [shopperLogin, setShopperLogin] = useState<string>(null);\n const [isValid, setIsValid] = useState<boolean>(false);\n const [errorCode, setErrorCode] = useState<string>(null);\n const [isLoggingIn, setIsLoggingIn] = useState<boolean>(false);\n const [loginInputHandlers, setLoginInputHandlers] = useState<CtPLoginInputHandlers>(null);\n\n const onSetLoginInputHandlers = useCallback((handlers: CtPLoginInputHandlers) => {\n setLoginInputHandlers(handlers);\n }, []);\n\n const handleOnLoginChange = useCallback(({ data, isValid }) => {\n setShopperLogin(data.shopperLogin);\n setIsValid(isValid);\n\n // As soon as the Shopper interacts with input, the CtP becomes the primary PM\n if (data?.shopperLogin?.length > 0) {\n setIsCtpPrimaryPaymentMethod(true);\n }\n }, []);\n\n const handleOnLoginButtonClick = useCallback(async () => {\n setErrorCode(null);\n\n if (!isValid) {\n loginInputHandlers.validateInput();\n return;\n }\n\n setIsLoggingIn(true);\n\n try {\n const { isEnrolled } = await verifyIfShopperIsEnrolled({ shopperEmail: shopperLogin });\n if (isEnrolled) {\n await startIdentityValidation();\n } else {\n setErrorCode('NOT_FOUND');\n setIsLoggingIn(false);\n }\n } catch (error: unknown) {\n if (error instanceof SrciError) console.warn(`CtP - Login error: ${error.toString()}`);\n if (error instanceof TimeoutError) console.warn(error.toString());\n if (isSrciError(error)) setErrorCode(error?.reason);\n else console.error(error);\n\n setIsLoggingIn(false);\n }\n }, [verifyIfShopperIsEnrolled, startIdentityValidation, shopperLogin, isValid, loginInputHandlers]);\n\n return (\n <Fragment>\n <CtPSection.Title endAdornment={<CtPInfo />}>{i18n.get('ctp.login.title')}</CtPSection.Title>\n\n <CtPSection.Text>{i18n.get('ctp.login.subtitle')}</CtPSection.Text>\n\n <CtPLoginInput\n onChange={handleOnLoginChange}\n onSetInputHandlers={onSetLoginInputHandlers}\n disabled={isLoggingIn}\n errorMessage={errorCode && i18n.get(`ctp.errors.${errorCode}`)}\n onPressEnter={handleOnLoginButtonClick}\n />\n\n <Button\n label={i18n.get('continue')}\n variant={isCtpPrimaryPaymentMethod ? 'primary' : 'secondary'}\n status={isLoggingIn && 'loading'}\n onClick={() => {\n void handleOnLoginButtonClick();\n }}\n />\n </Fragment>\n );\n};\n\nexport default CtPLogin;\n"],"names":["CtPLogin","i18n","useCoreContext","isCtpPrimaryPaymentMethod","setIsCtpPrimaryPaymentMethod","verifyIfShopperIsEnrolled","startIdentityValidation","useClickToPayContext","shopperLogin","setShopperLogin","useState","isValid","setIsValid","errorCode","setErrorCode","isLoggingIn","setIsLoggingIn","loginInputHandlers","setLoginInputHandlers","onSetLoginInputHandlers","useCallback","handlers","handleOnLoginChange","data","length","handleOnLoginButtonClick","async","isEnrolled","shopperEmail","error","SrciError","console","warn","toString","TimeoutError","isSrciError","reason","validateInput","h","Fragment","CtPSection","Title","endAdornment","CtPInfo","get","Text","CtPLoginInput","onChange","onSetInputHandlers","disabled","errorMessage","onPressEnter","Button","label","variant","status","onClick"],"mappings":"qnBAaA,MAAMA,EAAW,KACb,MAAMC,KAAEA,GAASC,KACXC,0BAAEA,EAAyBC,6BAAEA,EAA4BC,0BAAEA,EAAyBC,wBAAEA,GAA4BC,KACjHC,EAAcC,GAAmBC,EAAiB,OAClDC,EAASC,GAAcF,GAAkB,IACzCG,EAAWC,GAAgBJ,EAAiB,OAC5CK,EAAaC,GAAkBN,GAAkB,IACjDO,EAAoBC,GAAyBR,EAAgC,MAE9ES,EAA0BC,GAAaC,IACzCH,EAAsBG,EAAAA,GACvB,IAEGC,EAAsBF,GAAY,EAAGG,OAAMZ,cAC7CF,EAAgBc,EAAKf,cACrBI,EAAWD,GAGPY,GAAMf,cAAcgB,OAAS,GAC7BpB,GAA6B,EACjC,GACD,IAEGqB,EAA2BL,GAAYM,UAGzC,GAFAZ,EAAa,MAERH,EAAL,CAKAK,GAAe,GAEf,IACI,MAAMW,WAAEA,SAAqBtB,EAA0B,CAAEuB,aAAcpB,IACnEmB,QACMrB,KAENQ,EAAa,aACbE,GAAe,GAEvB,CAAE,MAAOa,GACDA,aAAiBC,GAAWC,QAAQC,KAAK,sBAAsBH,EAAMI,cACrEJ,aAAiBK,GAAcH,QAAQC,KAAKH,EAAMI,YAClDE,EAAYN,GAAQf,EAAae,GAAOO,QACvCL,QAAQF,MAAMA,GAEnBb,GAAe,EACnB,CAnBA,MAFIC,EAAmBoB,eAqBvB,GACD,CAAChC,EAA2BC,EAAyBE,EAAcG,EAASM,IAE/E,OACIqB,EAACC,EAAAA,KACGD,EAACE,EAAWC,MAAK,CAACC,aAAcJ,EAACK,EAAAA,OAAa1C,EAAK2C,IAAI,oBAEvDN,EAACE,EAAWK,KAAI,KAAE5C,EAAK2C,IAAI,uBAE3BN,EAACQ,EAAAA,CACGC,SAAUzB,EACV0B,mBAAoB7B,EACpB8B,SAAUlC,EACVmC,aAAcrC,GAAaZ,EAAK2C,IAAI,cAAc/B,KAClDsC,aAAc1B,IAGlBa,EAACc,EAAAA,CACGC,MAAOpD,EAAK2C,IAAI,YAChBU,QAASnD,EAA4B,UAAY,YACjDoD,OAAQxC,GAAe,UACvByC,QAAS,KACA/B,GAAAA"}
@@ -1,2 +1,2 @@
1
- import{createElement as t,Fragment as e}from"../../../../../external/preact/dist/preact.js";import{useState as o,useCallback as n}from"../../../../../external/preact/hooks/dist/hooks.js";import a from"../../../Button/Button.js";import s from"../../context/useClickToPayContext.js";import r from"./CtPOneTimePasswordInput/CtPOneTimePasswordInput.js";import{CtPInfo as i}from"../CtPInfo/CtPInfo.js";import l from"../CtPSection/CtPSection.js";import{useCoreContext as p}from"../../../../../core/Context/CoreProvider.js";import d from"./CtPSaveCookiesCheckbox/CtPSaveCookiesCheckbox.js";const c=({onDisplayCardComponent:c})=>{const{i18n:m}=p(),{finishIdentityValidation:C,otpMaskedContact:u,otpNetwork:P,isCtpPrimaryPaymentMethod:f}=s(),[h,k]=o(null),[g,y]=o(!1),[j,x]=o(!1),[I,b]=o(null),[S,T]=o(null),[v,w]=o(!1),B=n((t=>{T(t)}),[]),E=n((({data:t,isValid:e})=>{k(t.otp),y(e)}),[]),O=n((()=>{b(null)}),[]),A=n((async()=>{if(b(null),g){x(!0);try{await C(h)}catch(t){b(t?.reason),x(!1),"ACCT_INACCESSIBLE"===t?.reason&&(w(!0),c?.())}}else S.validateInput()}),[h,g,S,c]),M=m.get("ctp.otp.subtitle").split("%@");return t(e,null,t(l.Title,{endAdornment:t(i,null)},m.get("ctp.otp.title")),t(l.Text,null,M[0]," ",P," ",M[1],t("span",{className:"adyen-checkout-ctp__otp-subtitle--highlighted"},u),M[2]),t(r,{hideResendOtpButton:v,onChange:E,onSetInputHandlers:B,disabled:j,errorMessage:I&&m.get(`ctp.errors.${I}`),onPressEnter:A,onResendCode:O,isValidatingOtp:j}),t(d,null),t(a,{disabled:v,label:m.get("continue"),variant:f?"primary":"secondary",onClick:A,status:j&&"loading"}))};export{c as default};
1
+ import{createElement as t,Fragment as e}from"../../../../../external/preact/dist/preact.js";import{useState as o,useCallback as n}from"../../../../../external/preact/hooks/dist/hooks.js";import s from"../../../Button/Button.js";import r from"../../context/useClickToPayContext.js";import a from"./CtPOneTimePasswordInput/CtPOneTimePasswordInput.js";import{CtPInfo as i}from"../CtPInfo/CtPInfo.js";import l from"../CtPSection/CtPSection.js";import{useCoreContext as p}from"../../../../../core/Context/CoreProvider.js";import d from"./CtPSaveCookiesCheckbox/CtPSaveCookiesCheckbox.js";import{isSrciError as m}from"../../services/utils.js";const c=({onDisplayCardComponent:c})=>{const{i18n:u}=p(),{finishIdentityValidation:C,otpMaskedContact:f,otpNetwork:P,isCtpPrimaryPaymentMethod:h}=r(),[k,g]=o(null),[j,y]=o(!1),[x,I]=o(!1),[b,S]=o(null),[v,T]=o(null),[w,B]=o(!1),E=n((t=>{T(t)}),[]),O=n((({data:t,isValid:e})=>{g(t.otp),y(e)}),[]),A=n((()=>{S(null)}),[]),M=n((async()=>{if(S(null),j){I(!0);try{await C(k)}catch(t){if(!m(t))return void I(!1);S(t?.reason),I(!1),"ACCT_INACCESSIBLE"===t?.reason&&(B(!0),c?.())}}else v.validateInput()}),[k,j,v,c]),N=u.get("ctp.otp.subtitle").split("%@");return t(e,null,t(l.Title,{endAdornment:t(i,null)},u.get("ctp.otp.title")),t(l.Text,null,N[0]," ",P," ",N[1],t("span",{className:"adyen-checkout-ctp__otp-subtitle--highlighted"},f),N[2]),t(a,{hideResendOtpButton:w,onChange:O,onSetInputHandlers:E,disabled:x,errorMessage:b&&u.get(`ctp.errors.${b}`),onPressEnter:M,onResendCode:A,isValidatingOtp:x}),t(d,null),t(s,{disabled:w,label:u.get("continue"),variant:h?"primary":"secondary",onClick:M,status:x&&"loading"}))};export{c as default};
2
2
  //# sourceMappingURL=CtPOneTimePassword.js.map