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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (449) hide show
  1. package/dist/cjs/adyen.css +12 -10
  2. package/dist/cjs/adyen.css.map +1 -0
  3. package/dist/cjs/index.cjs +2 -2
  4. package/dist/cjs/index.cjs.map +1 -1
  5. package/dist/cjs/index.d.cts +33 -29
  6. package/dist/es/adyen.css +12 -10
  7. package/dist/es/adyen.css.map +1 -0
  8. package/dist/es/components/Address/Address.js +1 -1
  9. package/dist/es/components/Address/Address.js.map +1 -1
  10. package/dist/es/components/BacsDD/components/BacsInput.js +1 -1
  11. package/dist/es/components/BacsDD/components/BacsInput.js.map +1 -1
  12. package/dist/es/components/Blik/components/BlikInput.js +1 -1
  13. package/dist/es/components/Blik/components/BlikInput.js.map +1 -1
  14. package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
  15. package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
  16. package/dist/es/components/CashAppPay/CashAppPay.js +1 -1
  17. package/dist/es/components/CashAppPay/CashAppPay.js.map +1 -1
  18. package/dist/es/components/CashAppPay/components/CashAppComponent.js +1 -1
  19. package/dist/es/components/CashAppPay/components/CashAppComponent.js.map +1 -1
  20. package/dist/es/components/Dropin/components/PaymentMethod/InstantPaymentMethods.js.map +1 -1
  21. package/dist/es/components/GooglePay/components/GooglePayButton.js +1 -1
  22. package/dist/es/components/GooglePay/components/GooglePayButton.js.map +1 -1
  23. package/dist/es/components/GooglePay/defaultProps.js +1 -1
  24. package/dist/es/components/GooglePay/defaultProps.js.map +1 -1
  25. package/dist/es/components/PersonalDetails/PersonalDetails.js +1 -1
  26. package/dist/es/components/PersonalDetails/PersonalDetails.js.map +1 -1
  27. package/dist/es/components/internal/Address/Address.js +1 -1
  28. package/dist/es/components/internal/Address/Address.js.map +1 -1
  29. package/dist/es/components/internal/ClickToPay/components/CtPCards/CtPCards.js +1 -1
  30. package/dist/es/components/internal/ClickToPay/components/CtPCards/CtPCards.js.map +1 -1
  31. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLogin.js +1 -1
  32. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLogin.js.map +1 -1
  33. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePassword.js +1 -1
  34. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePassword.js.map +1 -1
  35. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js +1 -1
  36. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js.map +1 -1
  37. package/dist/es/components/internal/ClickToPay/services/sdks/AbstractSrcInitiator.js.map +1 -1
  38. package/dist/es/components/internal/ClickToPay/services/sdks/MastercardSdk.js.map +1 -1
  39. package/dist/es/components/internal/ClickToPay/services/sdks/VisaSdk.js.map +1 -1
  40. package/dist/es/components/internal/ClickToPay/services/utils.js +1 -1
  41. package/dist/es/components/internal/ClickToPay/services/utils.js.map +1 -1
  42. package/dist/es/components/internal/CompanyDetails/CompanyDetails.js +1 -1
  43. package/dist/es/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
  44. package/dist/es/components/internal/FormFields/Field/Field.js +1 -1
  45. package/dist/es/components/internal/FormFields/Field/Field.js.map +1 -1
  46. package/dist/es/components/internal/FormFields/InputBase.js.map +1 -1
  47. package/dist/es/components/internal/FormFields/Select/components/SelectListItem.js +1 -1
  48. package/dist/es/components/internal/FormFields/Select/components/SelectListItem.js.map +1 -1
  49. package/dist/es/components/internal/Icon/constants.js +2 -0
  50. package/dist/es/components/internal/Icon/constants.js.map +1 -0
  51. package/dist/es/components/internal/OpenInvoice/OpenInvoice.js +1 -1
  52. package/dist/es/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  53. package/dist/es/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js +2 -0
  54. package/dist/es/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -0
  55. package/dist/es/components/internal/QRLoader/QRLoader.js +1 -1
  56. package/dist/es/components/internal/QRLoader/QRLoader.js.map +1 -1
  57. package/dist/es/components/internal/SecuredFields/lib/constants.js +1 -1
  58. package/dist/es/components/internal/SecuredFields/lib/constants.js.map +1 -1
  59. package/dist/es/components/internal/UIElement/UIElement.js +1 -1
  60. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  61. package/dist/es/components/internal/Voucher/Voucher.js +1 -1
  62. package/dist/es/components/internal/Voucher/Voucher.js.map +1 -1
  63. package/dist/es/core/Analytics/Analytics.js +1 -1
  64. package/dist/es/core/Analytics/Analytics.js.map +1 -1
  65. package/dist/es/core/Analytics/constants.js +1 -1
  66. package/dist/es/core/Analytics/constants.js.map +1 -1
  67. package/dist/es/core/Analytics/utils.js.map +1 -1
  68. package/dist/es/core/Context/Resources.js +1 -1
  69. package/dist/es/core/Context/Resources.js.map +1 -1
  70. package/dist/es/core/Environment/Environment.js +1 -1
  71. package/dist/es/core/Environment/Environment.js.map +1 -1
  72. package/dist/es/core/Environment/constants.js +2 -0
  73. package/dist/es/core/Environment/constants.js.map +1 -0
  74. package/dist/es/core/Errors/SRMessages.js +1 -1
  75. package/dist/es/core/Errors/SRMessages.js.map +1 -1
  76. package/dist/es/core/Errors/SRPanel.js +1 -1
  77. package/dist/es/core/Errors/SRPanel.js.map +1 -1
  78. package/dist/es/core/Services/analytics/collect-id.js +1 -1
  79. package/dist/es/core/Services/analytics/collect-id.js.map +1 -1
  80. package/dist/es/core/Services/analytics/log-event.js +1 -1
  81. package/dist/es/core/Services/get-translations.js +1 -1
  82. package/dist/es/core/Services/get-translations.js.map +1 -1
  83. package/dist/es/core/core.defaultProps.js +1 -1
  84. package/dist/es/core/core.defaultProps.js.map +1 -1
  85. package/dist/es/core/core.js +1 -1
  86. package/dist/es/core/core.js.map +1 -1
  87. package/dist/es/core/utils.js +1 -1
  88. package/dist/es/core/utils.js.map +1 -1
  89. package/dist/es/external/preact/dist/preact.js +1 -1
  90. package/dist/es/external/preact/dist/preact.js.map +1 -1
  91. package/dist/es/external/preact/hooks/dist/hooks.js +1 -1
  92. package/dist/es/external/preact/hooks/dist/hooks.js.map +1 -1
  93. package/dist/es/index.d.ts +33 -29
  94. package/dist/es/utils/arrayUtils.js +1 -1
  95. package/dist/es/utils/arrayUtils.js.map +1 -1
  96. package/dist/es/utils/useForm/useForm.js +1 -1
  97. package/dist/es/utils/validator-utils.js +1 -1
  98. package/dist/es/utils/validator-utils.js.map +1 -1
  99. package/dist/es-legacy/adyen.css +12 -10
  100. package/dist/es-legacy/adyen.css.map +1 -0
  101. package/dist/es-legacy/components/ANCV/ANCV.js +1 -1
  102. package/dist/es-legacy/components/ANCV/ANCV.js.map +1 -1
  103. package/dist/es-legacy/components/Ach/Ach.js +1 -1
  104. package/dist/es-legacy/components/Ach/Ach.js.map +1 -1
  105. package/dist/es-legacy/components/Ach/components/AchInput/AchInput.js +1 -1
  106. package/dist/es-legacy/components/Ach/components/AchInput/AchInput.js.map +1 -1
  107. package/dist/es-legacy/components/Address/Address.js +1 -1
  108. package/dist/es-legacy/components/Address/Address.js.map +1 -1
  109. package/dist/es-legacy/components/Affirm/Affirm.js +1 -1
  110. package/dist/es-legacy/components/Affirm/Affirm.js.map +1 -1
  111. package/dist/es-legacy/components/AfterPay/AfterPay.js +1 -1
  112. package/dist/es-legacy/components/AfterPay/AfterPay.js.map +1 -1
  113. package/dist/es-legacy/components/AfterPay/AfterPayB2B.js +1 -1
  114. package/dist/es-legacy/components/AfterPay/AfterPayB2B.js.map +1 -1
  115. package/dist/es-legacy/components/AmazonPay/AmazonPay.js +1 -1
  116. package/dist/es-legacy/components/AmazonPay/AmazonPay.js.map +1 -1
  117. package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js +1 -1
  118. package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
  119. package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js +1 -1
  120. package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
  121. package/dist/es-legacy/components/AmazonPay/utils.js +1 -1
  122. package/dist/es-legacy/components/AmazonPay/utils.js.map +1 -1
  123. package/dist/es-legacy/components/ApplePay/ApplePay.js +1 -1
  124. package/dist/es-legacy/components/ApplePay/ApplePay.js.map +1 -1
  125. package/dist/es-legacy/components/Atome/Atome.js +1 -1
  126. package/dist/es-legacy/components/Atome/Atome.js.map +1 -1
  127. package/dist/es-legacy/components/Atome/config.js +1 -1
  128. package/dist/es-legacy/components/Atome/config.js.map +1 -1
  129. package/dist/es-legacy/components/BacsDD/BacsDD.js +1 -1
  130. package/dist/es-legacy/components/BacsDD/BacsDD.js.map +1 -1
  131. package/dist/es-legacy/components/BacsDD/components/BacsInput.js +1 -1
  132. package/dist/es-legacy/components/BacsDD/components/BacsInput.js.map +1 -1
  133. package/dist/es-legacy/components/BankTransfer/BankTransfer.js +1 -1
  134. package/dist/es-legacy/components/BankTransfer/BankTransfer.js.map +1 -1
  135. package/dist/es-legacy/components/BillDesk/BillDeskOnline.js +1 -1
  136. package/dist/es-legacy/components/BillDesk/BillDeskOnline.js.map +1 -1
  137. package/dist/es-legacy/components/BillDesk/BillDeskWallet.js +1 -1
  138. package/dist/es-legacy/components/BillDesk/BillDeskWallet.js.map +1 -1
  139. package/dist/es-legacy/components/Blik/Blik.js +1 -1
  140. package/dist/es-legacy/components/Blik/Blik.js.map +1 -1
  141. package/dist/es-legacy/components/Blik/components/BlikInput.js +1 -1
  142. package/dist/es-legacy/components/Blik/components/BlikInput.js.map +1 -1
  143. package/dist/es-legacy/components/Boleto/Boleto.js +1 -1
  144. package/dist/es-legacy/components/Boleto/Boleto.js.map +1 -1
  145. package/dist/es-legacy/components/Boleto/components/BoletoInput/BoletoInput.js +1 -1
  146. package/dist/es-legacy/components/Boleto/components/BoletoInput/BoletoInput.js.map +1 -1
  147. package/dist/es-legacy/components/Card/Bancontact.js +1 -1
  148. package/dist/es-legacy/components/Card/Bancontact.js.map +1 -1
  149. package/dist/es-legacy/components/Card/Card.js +1 -1
  150. package/dist/es-legacy/components/Card/Card.js.map +1 -1
  151. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
  152. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
  153. package/dist/es-legacy/components/Card/components/CardInput/components/IframeLabelAlternative.js +1 -1
  154. package/dist/es-legacy/components/Card/components/CardInput/components/IframeLabelAlternative.js.map +1 -1
  155. package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFields.js +1 -1
  156. package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFields.js.map +1 -1
  157. package/dist/es-legacy/components/CashAppPay/CashAppPay.js +1 -1
  158. package/dist/es-legacy/components/CashAppPay/CashAppPay.js.map +1 -1
  159. package/dist/es-legacy/components/CashAppPay/components/CashAppComponent.js +1 -1
  160. package/dist/es-legacy/components/CashAppPay/components/CashAppComponent.js.map +1 -1
  161. package/dist/es-legacy/components/ClickToPay/ClickToPay.js +1 -1
  162. package/dist/es-legacy/components/ClickToPay/ClickToPay.js.map +1 -1
  163. package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
  164. package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
  165. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  166. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  167. package/dist/es-legacy/components/Doku/Doku.js +1 -1
  168. package/dist/es-legacy/components/Doku/Doku.js.map +1 -1
  169. package/dist/es-legacy/components/Donation/Donation.js +1 -1
  170. package/dist/es-legacy/components/Donation/Donation.js.map +1 -1
  171. package/dist/es-legacy/components/Donation/components/DonationComponent.js +1 -1
  172. package/dist/es-legacy/components/Donation/components/DonationComponent.js.map +1 -1
  173. package/dist/es-legacy/components/Dragonpay/Dragonpay.js +1 -1
  174. package/dist/es-legacy/components/Dragonpay/Dragonpay.js.map +1 -1
  175. package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js +1 -1
  176. package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js.map +1 -1
  177. package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
  178. package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
  179. package/dist/es-legacy/components/Dropin/components/DropinComponent.js +1 -1
  180. package/dist/es-legacy/components/Dropin/components/DropinComponent.js.map +1 -1
  181. package/dist/es-legacy/components/Dropin/components/PaymentMethod/InstantPaymentMethods.js.map +1 -1
  182. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  183. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  184. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js +1 -1
  185. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js.map +1 -1
  186. package/dist/es-legacy/components/Dropin/elements/createInstantPaymentElements.js +1 -1
  187. package/dist/es-legacy/components/Dropin/elements/createInstantPaymentElements.js.map +1 -1
  188. package/dist/es-legacy/components/Dropin/elements/createStoredElements.js +1 -1
  189. package/dist/es-legacy/components/Dropin/elements/createStoredElements.js.map +1 -1
  190. package/dist/es-legacy/components/EPS/index.js +1 -1
  191. package/dist/es-legacy/components/EPS/index.js.map +1 -1
  192. package/dist/es-legacy/components/Econtext/Econtext.js +1 -1
  193. package/dist/es-legacy/components/Econtext/Econtext.js.map +1 -1
  194. package/dist/es-legacy/components/FacilyPay/FacilyPay10x.js +1 -1
  195. package/dist/es-legacy/components/FacilyPay/FacilyPay10x.js.map +1 -1
  196. package/dist/es-legacy/components/FacilyPay/FacilyPay12x.js +1 -1
  197. package/dist/es-legacy/components/FacilyPay/FacilyPay12x.js.map +1 -1
  198. package/dist/es-legacy/components/FacilyPay/FacilyPay3x.js +1 -1
  199. package/dist/es-legacy/components/FacilyPay/FacilyPay3x.js.map +1 -1
  200. package/dist/es-legacy/components/FacilyPay/FacilyPay4x.js +1 -1
  201. package/dist/es-legacy/components/FacilyPay/FacilyPay4x.js.map +1 -1
  202. package/dist/es-legacy/components/FacilyPay/FacilyPay6x.js +1 -1
  203. package/dist/es-legacy/components/FacilyPay/FacilyPay6x.js.map +1 -1
  204. package/dist/es-legacy/components/Giftcard/Giftcard.js +1 -1
  205. package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
  206. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js +1 -1
  207. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  208. package/dist/es-legacy/components/Giftcard/components/GiftcardFields.js +1 -1
  209. package/dist/es-legacy/components/Giftcard/components/GiftcardFields.js.map +1 -1
  210. package/dist/es-legacy/components/Giropay/Giropay.js +1 -1
  211. package/dist/es-legacy/components/Giropay/Giropay.js.map +1 -1
  212. package/dist/es-legacy/components/GooglePay/GooglePay.js +1 -1
  213. package/dist/es-legacy/components/GooglePay/GooglePay.js.map +1 -1
  214. package/dist/es-legacy/components/GooglePay/components/GooglePayButton.js +1 -1
  215. package/dist/es-legacy/components/GooglePay/components/GooglePayButton.js.map +1 -1
  216. package/dist/es-legacy/components/GooglePay/defaultProps.js +1 -1
  217. package/dist/es-legacy/components/GooglePay/defaultProps.js.map +1 -1
  218. package/dist/es-legacy/components/Klarna/KlarnaPayments.js +1 -1
  219. package/dist/es-legacy/components/Klarna/KlarnaPayments.js.map +1 -1
  220. package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js +1 -1
  221. package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js.map +1 -1
  222. package/dist/es-legacy/components/MBWay/MBWay.js +1 -1
  223. package/dist/es-legacy/components/MBWay/MBWay.js.map +1 -1
  224. package/dist/es-legacy/components/MBWay/components/MBWayInput/MBWayInput.js +1 -1
  225. package/dist/es-legacy/components/MBWay/components/MBWayInput/MBWayInput.js.map +1 -1
  226. package/dist/es-legacy/components/MealVoucherFR/MealVoucherFR.js +1 -1
  227. package/dist/es-legacy/components/MealVoucherFR/MealVoucherFR.js.map +1 -1
  228. package/dist/es-legacy/components/MealVoucherFR/components/MealVoucherFields.js +1 -1
  229. package/dist/es-legacy/components/MealVoucherFR/components/MealVoucherFields.js.map +1 -1
  230. package/dist/es-legacy/components/Multibanco/Multibanco.js +1 -1
  231. package/dist/es-legacy/components/Multibanco/Multibanco.js.map +1 -1
  232. package/dist/es-legacy/components/OnlineBankingCZ/index.js +1 -1
  233. package/dist/es-legacy/components/OnlineBankingCZ/index.js.map +1 -1
  234. package/dist/es-legacy/components/OnlineBankingIN/index.js +1 -1
  235. package/dist/es-legacy/components/OnlineBankingIN/index.js.map +1 -1
  236. package/dist/es-legacy/components/OnlineBankingPL/OnlineBankingPL.js +1 -1
  237. package/dist/es-legacy/components/OnlineBankingPL/OnlineBankingPL.js.map +1 -1
  238. package/dist/es-legacy/components/OnlineBankingSK/index.js +1 -1
  239. package/dist/es-legacy/components/OnlineBankingSK/index.js.map +1 -1
  240. package/dist/es-legacy/components/Oxxo/Oxxo.js +1 -1
  241. package/dist/es-legacy/components/Oxxo/Oxxo.js.map +1 -1
  242. package/dist/es-legacy/components/PayByBank/PayByBank.js +1 -1
  243. package/dist/es-legacy/components/PayByBank/PayByBank.js.map +1 -1
  244. package/dist/es-legacy/components/PayPal/Paypal.js +1 -1
  245. package/dist/es-legacy/components/PayPal/Paypal.js.map +1 -1
  246. package/dist/es-legacy/components/PayPal/components/PaypalButtons.js +1 -1
  247. package/dist/es-legacy/components/PayPal/components/PaypalButtons.js.map +1 -1
  248. package/dist/es-legacy/components/PayPal/components/PaypalComponent.js +1 -1
  249. package/dist/es-legacy/components/PayPal/components/PaypalComponent.js.map +1 -1
  250. package/dist/es-legacy/components/PayPal/utils/get-paypal-settings.js +1 -1
  251. package/dist/es-legacy/components/PayPal/utils/get-paypal-settings.js.map +1 -1
  252. package/dist/es-legacy/components/PayU/PayuCashcard.js +1 -1
  253. package/dist/es-legacy/components/PayU/PayuCashcard.js.map +1 -1
  254. package/dist/es-legacy/components/PayU/PayuNetBanking.js +1 -1
  255. package/dist/es-legacy/components/PayU/PayuNetBanking.js.map +1 -1
  256. package/dist/es-legacy/components/PersonalDetails/PersonalDetails.js +1 -1
  257. package/dist/es-legacy/components/PersonalDetails/PersonalDetails.js.map +1 -1
  258. package/dist/es-legacy/components/Pix/Pix.js +1 -1
  259. package/dist/es-legacy/components/Pix/Pix.js.map +1 -1
  260. package/dist/es-legacy/components/RatePay/RatePay.js +1 -1
  261. package/dist/es-legacy/components/RatePay/RatePay.js.map +1 -1
  262. package/dist/es-legacy/components/RatePay/RatePayDirectDebit.js +1 -1
  263. package/dist/es-legacy/components/RatePay/RatePayDirectDebit.js.map +1 -1
  264. package/dist/es-legacy/components/Redirect/Redirect.js +1 -1
  265. package/dist/es-legacy/components/Redirect/Redirect.js.map +1 -1
  266. package/dist/es-legacy/components/Riverty/Riverty.js +1 -1
  267. package/dist/es-legacy/components/Riverty/Riverty.js.map +1 -1
  268. package/dist/es-legacy/components/Sepa/Sepa.js +1 -1
  269. package/dist/es-legacy/components/Sepa/Sepa.js.map +1 -1
  270. package/dist/es-legacy/components/ThreeDS2/ThreeDS2Challenge.js +1 -1
  271. package/dist/es-legacy/components/ThreeDS2/ThreeDS2Challenge.js.map +1 -1
  272. package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js +1 -1
  273. package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  274. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  275. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  276. package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js +1 -1
  277. package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
  278. package/dist/es-legacy/components/Trustly/Trustly.js +1 -1
  279. package/dist/es-legacy/components/Trustly/Trustly.js.map +1 -1
  280. package/dist/es-legacy/components/Twint/Twint.js +1 -1
  281. package/dist/es-legacy/components/Twint/Twint.js.map +1 -1
  282. package/dist/es-legacy/components/UPI/UPI.js +1 -1
  283. package/dist/es-legacy/components/UPI/UPI.js.map +1 -1
  284. package/dist/es-legacy/components/WalletIN/index.js +1 -1
  285. package/dist/es-legacy/components/WalletIN/index.js.map +1 -1
  286. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
  287. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  288. package/dist/es-legacy/components/helpers/OpenInvoiceContainer/OpenInvoiceContainer.js +1 -1
  289. package/dist/es-legacy/components/helpers/OpenInvoiceContainer/OpenInvoiceContainer.js.map +1 -1
  290. package/dist/es-legacy/components/helpers/QRLoaderContainer/QRLoaderContainer.js +1 -1
  291. package/dist/es-legacy/components/helpers/QRLoaderContainer/QRLoaderContainer.js.map +1 -1
  292. package/dist/es-legacy/components/internal/Address/Address.js +1 -1
  293. package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
  294. package/dist/es-legacy/components/internal/Address/components/CountryField.js +1 -1
  295. package/dist/es-legacy/components/internal/Address/components/CountryField.js.map +1 -1
  296. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
  297. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
  298. package/dist/es-legacy/components/internal/ClickToPay/components/CtPCards/CtPCards.js +1 -1
  299. package/dist/es-legacy/components/internal/ClickToPay/components/CtPCards/CtPCards.js.map +1 -1
  300. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLogin.js +1 -1
  301. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLogin.js.map +1 -1
  302. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePassword.js +1 -1
  303. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePassword.js.map +1 -1
  304. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js +1 -1
  305. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js.map +1 -1
  306. package/dist/es-legacy/components/internal/ClickToPay/services/ClickToPayService.js +1 -1
  307. package/dist/es-legacy/components/internal/ClickToPay/services/ClickToPayService.js.map +1 -1
  308. package/dist/es-legacy/components/internal/ClickToPay/services/sdks/AbstractSrcInitiator.js.map +1 -1
  309. package/dist/es-legacy/components/internal/ClickToPay/services/sdks/MastercardSdk.js +1 -1
  310. package/dist/es-legacy/components/internal/ClickToPay/services/sdks/MastercardSdk.js.map +1 -1
  311. package/dist/es-legacy/components/internal/ClickToPay/services/sdks/VisaSdk.js +1 -1
  312. package/dist/es-legacy/components/internal/ClickToPay/services/sdks/VisaSdk.js.map +1 -1
  313. package/dist/es-legacy/components/internal/ClickToPay/services/utils.js +1 -1
  314. package/dist/es-legacy/components/internal/ClickToPay/services/utils.js.map +1 -1
  315. package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js +1 -1
  316. package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
  317. package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js +1 -1
  318. package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js.map +1 -1
  319. package/dist/es-legacy/components/internal/FormFields/Field/Field.js +1 -1
  320. package/dist/es-legacy/components/internal/FormFields/Field/Field.js.map +1 -1
  321. package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
  322. package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
  323. package/dist/es-legacy/components/internal/FormFields/InputDate/InputDate.js +1 -1
  324. package/dist/es-legacy/components/internal/FormFields/InputDate/InputDate.js.map +1 -1
  325. package/dist/es-legacy/components/internal/FormFields/InputEmail.js +1 -1
  326. package/dist/es-legacy/components/internal/FormFields/InputEmail.js.map +1 -1
  327. package/dist/es-legacy/components/internal/FormFields/InputTelephone.js +1 -1
  328. package/dist/es-legacy/components/internal/FormFields/InputTelephone.js.map +1 -1
  329. package/dist/es-legacy/components/internal/FormFields/InputText.js +1 -1
  330. package/dist/es-legacy/components/internal/FormFields/InputText.js.map +1 -1
  331. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js +1 -1
  332. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
  333. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js +1 -1
  334. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js.map +1 -1
  335. package/dist/es-legacy/components/internal/IbanInput/IbanInput.js +1 -1
  336. package/dist/es-legacy/components/internal/IbanInput/IbanInput.js.map +1 -1
  337. package/dist/es-legacy/components/internal/Icon/constants.js +2 -0
  338. package/dist/es-legacy/components/internal/Icon/constants.js.map +1 -0
  339. package/dist/es-legacy/components/internal/Img/Img.js +1 -1
  340. package/dist/es-legacy/components/internal/Img/Img.js.map +1 -1
  341. package/dist/es-legacy/components/internal/IssuerList/IssuerButtonGroup/IssuerButtonGroup.js +1 -1
  342. package/dist/es-legacy/components/internal/IssuerList/IssuerButtonGroup/IssuerButtonGroup.js.map +1 -1
  343. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js +1 -1
  344. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  345. package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js +2 -0
  346. package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -0
  347. package/dist/es-legacy/components/internal/PayButton/PayButton.js +1 -1
  348. package/dist/es-legacy/components/internal/PayButton/PayButton.js.map +1 -1
  349. package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js +1 -1
  350. package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
  351. package/dist/es-legacy/components/internal/PhoneInput/PhoneInput.js +1 -1
  352. package/dist/es-legacy/components/internal/PhoneInput/PhoneInput.js.map +1 -1
  353. package/dist/es-legacy/components/internal/QRLoader/QRLoader.js +1 -1
  354. package/dist/es-legacy/components/internal/QRLoader/QRLoader.js.map +1 -1
  355. package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js +1 -1
  356. package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js.map +1 -1
  357. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  358. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  359. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
  360. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
  361. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js +1 -1
  362. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js.map +1 -1
  363. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js +1 -1
  364. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js.map +1 -1
  365. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  366. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  367. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/utils/processAriaConfig.js +1 -1
  368. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/utils/processAriaConfig.js.map +1 -1
  369. package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
  370. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  371. package/dist/es-legacy/components/internal/Voucher/Voucher.js +1 -1
  372. package/dist/es-legacy/components/internal/Voucher/Voucher.js.map +1 -1
  373. package/dist/es-legacy/core/Analytics/Analytics.js +1 -1
  374. package/dist/es-legacy/core/Analytics/Analytics.js.map +1 -1
  375. package/dist/es-legacy/core/Analytics/constants.js +1 -1
  376. package/dist/es-legacy/core/Analytics/constants.js.map +1 -1
  377. package/dist/es-legacy/core/Analytics/utils.js.map +1 -1
  378. package/dist/es-legacy/core/Context/Resources.js +1 -1
  379. package/dist/es-legacy/core/Context/Resources.js.map +1 -1
  380. package/dist/es-legacy/core/Environment/Environment.js +1 -1
  381. package/dist/es-legacy/core/Environment/Environment.js.map +1 -1
  382. package/dist/es-legacy/core/Environment/constants.js +2 -0
  383. package/dist/es-legacy/core/Environment/constants.js.map +1 -0
  384. package/dist/es-legacy/core/Errors/SRPanel.js +1 -1
  385. package/dist/es-legacy/core/Errors/SRPanel.js.map +1 -1
  386. package/dist/es-legacy/core/ProcessResponse/PaymentAction/actionTypes.js +1 -1
  387. package/dist/es-legacy/core/ProcessResponse/PaymentAction/actionTypes.js.map +1 -1
  388. package/dist/es-legacy/core/ProcessResponse/PaymentMethods/utils.js +1 -1
  389. package/dist/es-legacy/core/ProcessResponse/PaymentMethods/utils.js.map +1 -1
  390. package/dist/es-legacy/core/ProcessResponse/process-response.js +1 -1
  391. package/dist/es-legacy/core/ProcessResponse/process-response.js.map +1 -1
  392. package/dist/es-legacy/core/RiskModule/RiskModule.js +1 -1
  393. package/dist/es-legacy/core/RiskModule/RiskModule.js.map +1 -1
  394. package/dist/es-legacy/core/Services/analytics/collect-id.js +1 -1
  395. package/dist/es-legacy/core/Services/analytics/collect-id.js.map +1 -1
  396. package/dist/es-legacy/core/Services/analytics/log-event.js +1 -1
  397. package/dist/es-legacy/core/Services/get-translations.js +1 -1
  398. package/dist/es-legacy/core/Services/get-translations.js.map +1 -1
  399. package/dist/es-legacy/core/Services/http.js +1 -1
  400. package/dist/es-legacy/core/Services/http.js.map +1 -1
  401. package/dist/es-legacy/core/core.defaultProps.js +1 -1
  402. package/dist/es-legacy/core/core.defaultProps.js.map +1 -1
  403. package/dist/es-legacy/core/core.js +1 -1
  404. package/dist/es-legacy/core/core.js.map +1 -1
  405. package/dist/es-legacy/core/core.registry.js +1 -1
  406. package/dist/es-legacy/core/core.registry.js.map +1 -1
  407. package/dist/es-legacy/core/utils.js +1 -1
  408. package/dist/es-legacy/core/utils.js.map +1 -1
  409. package/dist/es-legacy/external/preact/dist/preact.js +1 -1
  410. package/dist/es-legacy/external/preact/dist/preact.js.map +1 -1
  411. package/dist/es-legacy/external/preact/hooks/dist/hooks.js +1 -1
  412. package/dist/es-legacy/external/preact/hooks/dist/hooks.js.map +1 -1
  413. package/dist/es-legacy/utils/arrayUtils.js +1 -1
  414. package/dist/es-legacy/utils/arrayUtils.js.map +1 -1
  415. package/dist/es-legacy/utils/useForm/reducer.js +1 -1
  416. package/dist/es-legacy/utils/useForm/reducer.js.map +1 -1
  417. package/dist/es-legacy/utils/useForm/useForm.js +1 -1
  418. package/dist/es-legacy/utils/validator-utils.js +1 -1
  419. package/dist/es-legacy/utils/validator-utils.js.map +1 -1
  420. package/package.json +146 -147
  421. package/dist/umd/adyen.css +0 -78
  422. package/dist/umd/adyen.js +0 -7
  423. package/dist/umd/adyen.js.map +0 -1
  424. package/translations/ar.json +0 -306
  425. package/translations/cs-CZ.json +0 -302
  426. package/translations/da-DK.json +0 -303
  427. package/translations/de-DE.json +0 -302
  428. package/translations/el-GR.json +0 -305
  429. package/translations/en-US.json +0 -307
  430. package/translations/es-ES.json +0 -300
  431. package/translations/fi-FI.json +0 -302
  432. package/translations/fr-FR.json +0 -305
  433. package/translations/hr-HR.json +0 -305
  434. package/translations/hu-HU.json +0 -305
  435. package/translations/it-IT.json +0 -305
  436. package/translations/ja-JP.json +0 -305
  437. package/translations/ko-KR.json +0 -305
  438. package/translations/nl-NL.json +0 -302
  439. package/translations/no-NO.json +0 -302
  440. package/translations/pl-PL.json +0 -305
  441. package/translations/pt-BR.json +0 -306
  442. package/translations/pt-PT.json +0 -307
  443. package/translations/ro-RO.json +0 -305
  444. package/translations/ru-RU.json +0 -303
  445. package/translations/sk-SK.json +0 -305
  446. package/translations/sl-SI.json +0 -305
  447. package/translations/sv-SE.json +0 -303
  448. package/translations/zh-CN.json +0 -305
  449. package/translations/zh-TW.json +0 -305
@@ -1,2 +1,2 @@
1
- import{createElement as e,Fragment as r}from"../../../../external/preact/dist/preact.js";import{useRef as s,useMemo as o,useState as t,useCallback as n,useEffect as a}from"../../../../external/preact/hooks/dist/hooks.js";import l from"../../../internal/SecuredFields/SFP/SecuredFieldsProvider.js";import i from"./defaultProps.js";import{AddressModeOptions as d}from"./types.js";import{DATE_POLICY_REQUIRED as u,CVC_POLICY_REQUIRED as c,ENCRYPTED_CARD_NUMBER as m}from"../../../internal/SecuredFields/lib/constants.js";import{cardInputFormatters as p,cardInputValidationRules as h,getRuleByNameAndMode as y}from"./validate.js";import b from"../../../internal/SecuredFields/binLookup/extensions.js";import f from"../../../../utils/useForm/useForm.js";import{mapFieldKey as S,handlePartialAddressMode as N,extractPropsForSFP as g,extractPropsForCardFields as A,getLayout as F,lookupBlurBasedErrors as C}from"./utils.js";import{usePrevious as j}from"../../../../utils/hookUtils.js";import k from"../../../internal/Address/Specifications.js";import{StoredCardFieldsWrapper as R}from"./components/StoredCardFieldsWrapper.js";import{CardFieldsWrapper as x}from"./components/CardFieldsWrapper.js";import{getAutoJumpHandler as w,setFocusOnFirstField as P,getFocusHandler as B,getAddressHandler as v}from"./handlers.js";import I from"../../../../external/classnames/index.js";import{getPartialAddressValidationRules as V}from"../../../internal/Address/validate.js";import{ERROR_ACTION_BLUR_SCENARIO as E,ERROR_ACTION_FOCUS_FIELD as M}from"../../../../core/Errors/constants.js";import O from"../../../../core/Errors/useSRPanelContext.js";import q from"../../../../core/Context/useImage.js";import{getArrayDifferences as T}from"../../../../utils/arrayUtils.js";import D from"../../../internal/FormInstruction/FormInstruction.js";const L=i=>{const L=s(null),_=s(!1),K=q(),{setSRMessagesFromObjects:H,setSRMessagesFromStrings:U,clearSRPanel:z,shouldMoveFocusSR:W}=O(),$=H?.({fieldTypeMappingFn:S}),G=s(null),J=e=>{G.current=e},Q=s({});Object.keys(Q.current).length||i.setComponentRef(Q.current);const X=s(0),Y=s(!1),Z=o((()=>new k(i.specifications)),[i.specifications]);Q.current.sfp=L;const[ee,re]=t("ready"),[se,oe]=t({}),[te,ne]=t({...i.holderNameRequired&&{holderName:!1}}),[ae,le]=t({...i.hasHolderName&&{holderName:i.data.holderName??""}}),[ie,de]=t(null),[ue,ce]=t(""),[me,pe]=t(!1),[he,ye]=t(u),[be,fe]=t(c),[Se,Ne]=t(null),[ge,Ae]=t([]),[Fe,Ce]=t(i.storedPaymentMethodId?i.brand:""),je=i.billingAddressMode!==d.none&&i.billingAddressRequired,ke=N(i.billingAddressMode),Re=s(ke&&i.data?.billingAddress?.country),[xe,we]=t(!1),[Pe,Be]=t(je?i.data.billingAddress:null),[ve,Ie]=t(!1),[Ve,Ee]=t(""),[Me,Oe]=t({value:null}),[qe,Te]=t(null),{handleChangeFor:De,triggerValidation:Le,data:_e,valid:Ke,errors:He,setSchema:Ue,setData:ze,setValid:We,setErrors:$e}=f({schema:[],defaultData:i.data,formatters:p,rules:h}),Ge=!!Object.keys(i.installmentOptions).length&&"debit"!==i.fundingSource,Je=i.showInstallmentAmounts??!0,Qe="kr"===(Se??i.countryCode),Xe=i.configuration.koreanAuthenticationRequired&&Qe,Ye=ve&&"auto"===i.configuration.socialSecurityNumberMode||"show"===i.configuration.socialSecurityNumberMode,Ze=(e,r)=>{i.onFocus({fieldType:e,event:r})},er=(e,r)=>{i.onBlur({fieldType:e,event:r})},rr=B(ce,Ze,er),sr=()=>F({props:i,showKCP:Xe,showBrazilianSSN:Ye,...i.billingAddressRequired&&{countrySpecificSchemas:Z.getAddressSchemaForCountry(Pe?.country),billingAddressRequiredFields:i.billingAddressRequiredFields}}),or=n((e=>{const r="webInternalElement"!==e.fieldType?e.fieldType:e.name;Te(r)}),[]),tr=v(ze,We,$e),nr=w(Y,L,sr()),ar=o((()=>b(i,{sfp:L},{dualBrandSelectElements:ge,setDualBrandSelectElements:Ae,setSelectedBrandValue:Ce,issuingCountryCode:Se,setIssuingCountryCode:Ne},X)),[ge,Se]);Q.current.showValidation=()=>{_.current=!0,z?.(),L.current.showValidation(),Le(["holderName","socialSecurityNumber","taxNumber"]),G?.current&&G.current.showValidation()},Q.current.processBinLookupResponse=(e,r)=>{ar.processBinLookup(e,r)},Q.current.setStatus=re,a((()=>(Q.current.setFocusOn=L.current.setFocusOn,Q.current.updateStyles=L.current.updateStyles,Q.current.handleUnsupportedCard=L.current.handleUnsupportedCard,()=>{L.current.destroy()})),[]),a((()=>{const e=[...i.hasHolderName?["holderName"]:[],...Ye?["socialSecurityNumber"]:[],...Xe?["taxNumber"]:[],...je?["billingAddress"]:[]];Ue(e)}),[i.hasHolderName,Ye,Xe]),a((()=>{le({...ae,holderName:_e.holderName??"",taxNumber:_e.taxNumber}),Ee(_e.socialSecurityNumber),je&&Be({..._e.billingAddress}),ne({...te,holderName:!i.holderNameRequired||Ke.holderName,socialSecurityNumber:!!Ke.socialSecurityNumber&&Ke.socialSecurityNumber,taxNumber:!!Ke.taxNumber&&Ke.taxNumber,billingAddress:!!Ke.billingAddress&&Ke.billingAddress});const e=!!He.billingAddress&&Object.entries(He.billingAddress).reduce(((e,[,r])=>e||null!=r),!1);oe({...se,holderName:i.holderNameRequired&&He.holderName?He.holderName:null,socialSecurityNumber:Ye&&He.socialSecurityNumber?He.socialSecurityNumber:null,taxNumber:Xe&&He.taxNumber?He.taxNumber:null,billingAddress:je&&e?He.billingAddress:null})}),[_e,Ke,He]);const lr=j(ie);a((()=>{const e=te.holderName,r=me,s=!je||te.billingAddress,o=!Xe||!!te.taxNumber&&!!te.encryptedPassword,t=!Ye||!!te.socialSecurityNumber,n=r&&e&&s&&o&&t,a=L.current.mapErrorsToValidationRuleResult(),l={...se,...a},{billingAddress:d,...u}=l,c={...u,...d},m=$?.({errors:c,isValidating:_.current,layout:sr(),countrySpecificLabels:Z.getAddressLabelsForCountry(Pe?.country)??ke?.default?.labels}),p=m?.currentErrorsSortedByLayout;switch(de(p),m?.action){case M:W&&P(_.current,L,m?.fieldToFocus),setTimeout((()=>{_.current=!1}),300);break;case E:{const e=T(p,lr,"field"),r=e?.[0];if(r){const e=C(r.errorCode)?r.errorMessage:null;U(e)}else z();break}}if(p){const e=T(p,lr,"field");e?.forEach((e=>{const r={fieldType:e.field,errorCode:e.errorCode};i.onValidationErrorAnalytics(r)}))}i.onChange({data:ae,valid:te,errors:l,isValid:n,billingAddress:Pe,selectedBrandValue:Fe,storePaymentMethod:xe,socialSecurityNumber:Ve,installments:Me})}),[ae,te,se,Fe,xe,Me]);const ir=i.storedPaymentMethodId?R:x;return e(r,null,e(l,{ref:L,...g(i),styles:{...i.styles},koreanAuthenticationRequired:i.configuration.koreanAuthenticationRequired,hasKoreanFields:!(!i.configuration.koreanAuthenticationRequired||"kr"!==i.countryCode),onChange:(e,r)=>{if(e.autoCompleteName){if(!i.hasHolderName)return;const r=y("holderName","blur")(e.autoCompleteName)?e.autoCompleteName:null;r&&(ze("holderName",r),We("holderName",!0),$e("holderName",null))}else i.autoFocus&&X.current>0&&"handleOnFieldValid"===r?.event&&r?.fieldType===m&&e.valid.encryptedCardNumber&&nr(),le({...ae,...e.data}),oe({...se,...e.errors}),ne({...te,...e.valid}),pe(e.isSfpValid),fe(e.cvcPolicy),Ie(e.showSocialSecurityNumber),ye(e.expiryDatePolicy)},onBrand:i.onBrand,onFocus:rr,type:i.brand,disableIOSArrowKeys:i.disableIOSArrowKeys?or:null,render:({setRootNode:r,setFocusOn:s},o)=>e("div",{ref:r,className:I({"adyen-checkout__card-input":!0,"adyen-checkout-card-input__wrapper":!0,[`adyen-checkout__card-input--${i.fundingSource??"credit"}`]:!0,"adyen-checkout__card-input--loading":"loading"===ee}),role:"form"},i.showFormInstruction&&e(D,null),e(ir,{...A(i),data:ae,valid:te,errors:se,handleChangeFor:De,focusedElement:ue,setFocusOn:s,sfpState:o,cvcPolicy:be,hasInstallments:Ge,showAmountsInInstallments:Je,handleInstallments:Oe,brandsIcons:i.brandsIcons,formData:_e,formErrors:He,formValid:Ke,expiryDatePolicy:he,dualBrandSelectElements:ge,extensions:ar,selectedBrandValue:Fe,showKCP:Xe,showBrazilianSSN:Ye,socialSecurityNumber:Ve,handleOnStoreDetails:we,setAddressRef:J,billingAddress:Pe,billingAddressValidationRules:ke&&V(Re.current),partialAddressSchema:ke,handleAddress:tr,onAddressLookup:i.onAddressLookup,onAddressSelected:i.onAddressSelected,addressSearchDebounceMs:i.addressSearchDebounceMs,iOSFocusedField:qe,onFieldFocusAnalytics:Ze,onFieldBlurAnalytics:er}))}),i.showPayButton&&i.payButton({status:ee,variant:i.isPayButtonPrimaryVariant?"primary":"secondary",icon:K({imageFolder:"components/"})("lock")}))};L.defaultProps=i;export{L as default};
1
+ import{createElement as e,Fragment as r}from"../../../../external/preact/dist/preact.js";import{useRef as s,useMemo as o,useState as t,useCallback as n,useEffect as a}from"../../../../external/preact/hooks/dist/hooks.js";import l from"../../../internal/SecuredFields/SFP/SecuredFieldsProvider.js";import i from"./defaultProps.js";import{AddressModeOptions as d}from"./types.js";import{ENCRYPTED_CARD_NUMBER as u,DATE_POLICY_REQUIRED as c,CVC_POLICY_REQUIRED as m}from"../../../internal/SecuredFields/lib/constants.js";import{cardInputFormatters as p,cardInputValidationRules as h,getRuleByNameAndMode as f}from"./validate.js";import y from"../../../internal/SecuredFields/binLookup/extensions.js";import b from"../../../../utils/useForm/useForm.js";import{mapFieldKey as S,handlePartialAddressMode as N,extractPropsForSFP as g,extractPropsForCardFields as A,getLayout as F,lookupBlurBasedErrors as C}from"./utils.js";import{usePrevious as j}from"../../../../utils/hookUtils.js";import k from"../../../internal/Address/Specifications.js";import{StoredCardFieldsWrapper as R}from"./components/StoredCardFieldsWrapper.js";import{CardFieldsWrapper as x}from"./components/CardFieldsWrapper.js";import{getAutoJumpHandler as w,setFocusOnFirstField as P,getFocusHandler as B,getAddressHandler as I}from"./handlers.js";import v from"../../../../external/classnames/index.js";import{getPartialAddressValidationRules as V}from"../../../internal/Address/validate.js";import{ERROR_ACTION_BLUR_SCENARIO as E,ERROR_ACTION_FOCUS_FIELD as M}from"../../../../core/Errors/constants.js";import O from"../../../../core/Errors/useSRPanelContext.js";import q from"../../../../core/Context/useImage.js";import{getArrayDifferences as T}from"../../../../utils/arrayUtils.js";import D from"../../../internal/FormInstruction/FormInstruction.js";import{PREFIX as L}from"../../../internal/Icon/constants.js";const _=i=>{const _=s(null),K=s(!1),H=q(),{setSRMessagesFromObjects:U,setSRMessagesFromStrings:z,clearSRPanel:W,shouldMoveFocusSR:$}=O(),G=U?.({fieldTypeMappingFn:S}),J=s(null),Q=e=>{J.current=e},X=s({});Object.keys(X.current).length||i.setComponentRef(X.current);const Y=s(0),Z=s(!1),ee=o((()=>new k(i.specifications)),[i.specifications]);X.current.sfp=_;const[re,se]=t("ready"),[oe,te]=t({}),[ne,ae]=t({...i.holderNameRequired&&{holderName:!1}}),[le,ie]=t({...i.hasHolderName&&{holderName:i.data.holderName??""}}),[de,ue]=t(null),[ce,me]=t(""),[pe,he]=t(!1),[fe,ye]=t(c),[be,Se]=t(m),[Ne,ge]=t(null),[Ae,Fe]=t([]),[Ce,je]=t(i.storedPaymentMethodId?i.brand:""),ke=i.billingAddressMode!==d.none&&i.billingAddressRequired,Re=N(i.billingAddressMode),xe=s(Re&&i.data?.billingAddress?.country),[we,Pe]=t(!1),[Be,Ie]=t(ke?i.data.billingAddress:null),[ve,Ve]=t(!1),[Ee,Me]=t(""),[Oe,qe]=t({value:null}),[Te,De]=t(null),{handleChangeFor:Le,triggerValidation:_e,data:Ke,valid:He,errors:Ue,setSchema:ze,setData:We,setValid:$e,setErrors:Ge}=b({schema:[],defaultData:i.data,formatters:p,rules:h}),Je=!!Object.keys(i.installmentOptions).length&&"debit"!==i.fundingSource,Qe=i.showInstallmentAmounts??!0,Xe="kr"===(Ne??i.countryCode),Ye=i.configuration.koreanAuthenticationRequired&&Xe,Ze=ve&&"auto"===i.configuration.socialSecurityNumberMode||"show"===i.configuration.socialSecurityNumberMode,er=(e,r)=>{i.onFocus({fieldType:e,event:r})},rr=(e,r)=>{i.onBlur({fieldType:e,event:r})},sr=B(me,er,rr),or=()=>F({props:i,showKCP:Ye,showBrazilianSSN:Ze,...i.billingAddressRequired&&{countrySpecificSchemas:ee.getAddressSchemaForCountry(Be?.country),billingAddressRequiredFields:i.billingAddressRequiredFields}}),tr=n((e=>{const r="webInternalElement"!==e.fieldType?e.fieldType:e.name;De(r)}),[]),nr=I(We,$e,Ge),ar=w(Z,_,or()),lr=o((()=>y(i,{sfp:_},{dualBrandSelectElements:Ae,setDualBrandSelectElements:Fe,setSelectedBrandValue:je,issuingCountryCode:Ne,setIssuingCountryCode:ge},Y)),[Ae,Ne]);X.current.showValidation=()=>{K.current=!0,W?.(),_.current.showValidation(),_e(["holderName","socialSecurityNumber","taxNumber"]),J?.current&&J.current.showValidation()},X.current.processBinLookupResponse=(e,r)=>{lr.processBinLookup(e,r)},X.current.setStatus=se,a((()=>(X.current.setFocusOn=_.current.setFocusOn,X.current.updateStyles=_.current.updateStyles,X.current.handleUnsupportedCard=_.current.handleUnsupportedCard,()=>{_.current.destroy()})),[]),a((()=>{const e=[...i.hasHolderName?["holderName"]:[],...Ze?["socialSecurityNumber"]:[],...Ye?["taxNumber"]:[],...ke?["billingAddress"]:[]];ze(e)}),[i.hasHolderName,Ze,Ye]),a((()=>{ie({...le,holderName:Ke.holderName??"",taxNumber:Ke.taxNumber}),Me(Ke.socialSecurityNumber),ke&&Ie({...Ke.billingAddress}),ae({...ne,holderName:!i.holderNameRequired||He.holderName,socialSecurityNumber:!!He.socialSecurityNumber&&He.socialSecurityNumber,taxNumber:!!He.taxNumber&&He.taxNumber,billingAddress:!!He.billingAddress&&He.billingAddress});const e=!!Ue.billingAddress&&Object.entries(Ue.billingAddress).reduce(((e,[,r])=>e||null!=r),!1);te({...oe,holderName:i.holderNameRequired&&Ue.holderName?Ue.holderName:null,socialSecurityNumber:Ze&&Ue.socialSecurityNumber?Ue.socialSecurityNumber:null,taxNumber:Ye&&Ue.taxNumber?Ue.taxNumber:null,billingAddress:ke&&e?Ue.billingAddress:null})}),[Ke,He,Ue]);const ir=j(de);a((()=>{const e=ne.holderName,r=pe,s=!ke||ne.billingAddress,o=!Ye||!!ne.taxNumber&&!!ne.encryptedPassword,t=!Ze||!!ne.socialSecurityNumber,n=r&&e&&s&&o&&t,a=_.current.mapErrorsToValidationRuleResult(),l={...oe,...a},{billingAddress:d,...u}=l,c={...u,...d},m=G?.({errors:c,isValidating:K.current,layout:or(),countrySpecificLabels:ee.getAddressLabelsForCountry(Be?.country)??Re?.default?.labels}),p=m?.currentErrorsSortedByLayout;switch(ue(p),m?.action){case M:$&&P(K.current,_,m?.fieldToFocus),setTimeout((()=>{K.current=!1}),300);break;case E:{const e=T(p,ir,"field"),r=e?.[0];if(r){const e=C(r.errorCode)?r.errorMessage:null;z(e)}else W();break}}if(p){const e=T(p,ir,"field");e?.forEach((e=>{const r={fieldType:e.field,errorCode:e.errorCode};i.onValidationErrorAnalytics(r)}))}i.onChange({data:le,valid:ne,errors:l,isValid:n,billingAddress:Be,selectedBrandValue:Ce,storePaymentMethod:we,socialSecurityNumber:Ee,installments:Oe})}),[le,ne,oe,Ce,we,Oe]);const dr=i.storedPaymentMethodId?R:x;return e(r,null,e(l,{ref:_,...g(i),styles:{...i.styles},koreanAuthenticationRequired:i.configuration.koreanAuthenticationRequired,hasKoreanFields:!(!i.configuration.koreanAuthenticationRequired||"kr"!==i.countryCode),onChange:(e,r)=>{if(e.autoCompleteName){if(!i.hasHolderName)return;const r=f("holderName","blur")(e.autoCompleteName)?e.autoCompleteName:null;r&&(We("holderName",r),$e("holderName",!0),Ge("holderName",null))}else i.autoFocus&&Y.current>0&&"handleOnFieldValid"===r?.event&&r?.fieldType===u&&e.valid.encryptedCardNumber&&ar(),ie({...le,...e.data}),te({...oe,...e.errors}),ae({...ne,...e.valid}),he(e.isSfpValid),Se(e.cvcPolicy),Ve(e.showSocialSecurityNumber),ye(e.expiryDatePolicy)},onBrand:i.onBrand,onFocus:sr,type:i.brand,disableIOSArrowKeys:i.disableIOSArrowKeys?tr:null,render:({setRootNode:r,setFocusOn:s},o)=>e("div",{ref:r,className:v({"adyen-checkout__card-input":!0,"adyen-checkout-card-input__wrapper":!0,[`adyen-checkout__card-input--${i.fundingSource??"credit"}`]:!0,"adyen-checkout__card-input--loading":"loading"===re}),role:"form"},i.showFormInstruction&&e(D,null),e(dr,{...A(i),data:le,valid:ne,errors:oe,handleChangeFor:Le,focusedElement:ce,setFocusOn:s,sfpState:o,cvcPolicy:be,hasInstallments:Je,showAmountsInInstallments:Qe,handleInstallments:qe,brandsIcons:i.brandsIcons,formData:Ke,formErrors:Ue,formValid:He,expiryDatePolicy:fe,dualBrandSelectElements:Ae,extensions:lr,selectedBrandValue:Ce,showKCP:Ye,showBrazilianSSN:Ze,socialSecurityNumber:Ee,handleOnStoreDetails:Pe,setAddressRef:Q,billingAddress:Be,billingAddressValidationRules:Re&&V(xe.current),partialAddressSchema:Re,handleAddress:nr,onAddressLookup:i.onAddressLookup,onAddressSelected:i.onAddressSelected,addressSearchDebounceMs:i.addressSearchDebounceMs,iOSFocusedField:Te,onFieldFocusAnalytics:er,onFieldBlurAnalytics:rr}))}),i.showPayButton&&i.payButton({status:re,variant:i.isPayButtonPrimaryVariant?"primary":"secondary",icon:H({imageFolder:"components/"})(`${L}lock`)}))};_.defaultProps=i;export{_ as default};
2
2
  //# sourceMappingURL=CardInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CardInput.js","sources":["../../../../../../src/components/Card/components/CardInput/CardInput.tsx"],"sourcesContent":["import { h, Fragment } from 'preact';\nimport { useState, useEffect, useRef, useMemo, useCallback } from 'preact/hooks';\nimport SecuredFieldsProvider from '../../../internal/SecuredFields/SFP/SecuredFieldsProvider';\nimport { OnChangeEventDetails, SFPState } from '../../../internal/SecuredFields/SFP/types';\nimport defaultProps from './defaultProps';\nimport './CardInput.scss';\nimport { AddressModeOptions, CardInputDataState, CardInputErrorState, CardInputProps, CardInputRef, CardInputValidState } from './types';\nimport { CVC_POLICY_REQUIRED, DATE_POLICY_REQUIRED, ENCRYPTED_CARD_NUMBER } from '../../../internal/SecuredFields/lib/constants';\nimport { BinLookupResponse } from '../../types';\nimport { cardInputFormatters, cardInputValidationRules, getRuleByNameAndMode } from './validate';\nimport CIExtensions from '../../../internal/SecuredFields/binLookup/extensions';\nimport useForm from '../../../../utils/useForm';\nimport { SetSRMessagesReturnObject, SortedErrorObject } from '../../../../core/Errors/types';\nimport { handlePartialAddressMode, extractPropsForCardFields, extractPropsForSFP, getLayout, lookupBlurBasedErrors, mapFieldKey } from './utils';\nimport { usePrevious } from '../../../../utils/hookUtils';\nimport Specifications from '../../../internal/Address/Specifications';\nimport { StoredCardFieldsWrapper } from './components/StoredCardFieldsWrapper';\nimport { CardFieldsWrapper } from './components/CardFieldsWrapper';\nimport { getAddressHandler, getAutoJumpHandler, getFocusHandler, setFocusOnFirstField } from './handlers';\nimport { InstallmentsObj } from './components/Installments/Installments';\nimport { TouchStartEventObj } from './components/types';\nimport classNames from 'classnames';\nimport { getPartialAddressValidationRules } from '../../../internal/Address/validate';\nimport { ERROR_ACTION_BLUR_SCENARIO, ERROR_ACTION_FOCUS_FIELD } from '../../../../core/Errors/constants';\nimport useSRPanelContext from '../../../../core/Errors/useSRPanelContext';\nimport { SetSRMessagesReturnFn } from '../../../../core/Errors/SRPanelProvider';\nimport useImage from '../../../../core/Context/useImage';\nimport { getArrayDifferences } from '../../../../utils/arrayUtils';\nimport FormInstruction from '../../../internal/FormInstruction';\nimport { AddressData } from '../../../../types/global-types';\nimport { CbObjOnFocus } from '../../../internal/SecuredFields/lib/types';\nimport { FieldErrorAnalyticsObject } from '../../../../core/Analytics/types';\n\nconst CardInput = (props: CardInputProps) => {\n const sfp = useRef(null);\n const isValidating = useRef(false);\n const getImage = useImage();\n\n /** SR stuff */\n const { setSRMessagesFromObjects, setSRMessagesFromStrings, clearSRPanel, shouldMoveFocusSR } = useSRPanelContext();\n\n // Generate a setSRMessages function - implemented as a partial, since the initial set of arguments don't change.\n const setSRMessages: SetSRMessagesReturnFn = setSRMessagesFromObjects?.({\n fieldTypeMappingFn: mapFieldKey\n });\n /** end SR stuff */\n\n const billingAddressRef = useRef(null);\n const setAddressRef = ref => {\n billingAddressRef.current = ref;\n };\n\n const cardInputRef = useRef<CardInputRef>({});\n // Just call once to create the object by which we expose the members expected by the parent Card comp\n if (!Object.keys(cardInputRef.current).length) {\n props.setComponentRef(cardInputRef.current);\n }\n\n const hasPanLengthRef = useRef(0);\n const isAutoJumping = useRef(false);\n\n const specifications = useMemo(() => new Specifications(props.specifications), [props.specifications]);\n\n // Store ref to sfp (useful for 'deep' debugging)\n cardInputRef.current.sfp = sfp;\n\n /**\n * STATE HOOKS\n */\n const [status, setStatus] = useState('ready');\n\n const [errors, setErrors] = useState<CardInputErrorState>({});\n const [valid, setValid] = useState<CardInputValidState>({\n ...(props.holderNameRequired && { holderName: false })\n });\n const [data, setData] = useState<CardInputDataState>({\n ...(props.hasHolderName && { holderName: props.data.holderName ?? '' })\n });\n\n const [sortedErrorList, setSortedErrorList] = useState<SortedErrorObject[]>(null);\n\n const [focusedElement, setFocusedElement] = useState('');\n const [isSfpValid, setIsSfpValid] = useState(false);\n const [expiryDatePolicy, setExpiryDatePolicy] = useState(DATE_POLICY_REQUIRED);\n const [cvcPolicy, setCvcPolicy] = useState(CVC_POLICY_REQUIRED);\n const [issuingCountryCode, setIssuingCountryCode] = useState<string>(null);\n\n const [dualBrandSelectElements, setDualBrandSelectElements] = useState([]);\n const [selectedBrandValue, setSelectedBrandValue] = useState(props.storedPaymentMethodId ? props.brand : ''); // If this is a storedCard comp initialise state with the storedCard's brand\n\n const showBillingAddress = props.billingAddressMode !== AddressModeOptions.none && props.billingAddressRequired;\n\n const partialAddressSchema = handlePartialAddressMode(props.billingAddressMode);\n // Keeps the value of the country set initially by the merchant, before the Address Component mutates it\n const partialAddressCountry = useRef<string>(partialAddressSchema && props.data?.billingAddress?.country);\n\n const [storePaymentMethod, setStorePaymentMethod] = useState(false);\n const [billingAddress, setBillingAddress] = useState<AddressData>(showBillingAddress ? props.data.billingAddress : null);\n const [showSocialSecurityNumber, setShowSocialSecurityNumber] = useState(false);\n const [socialSecurityNumber, setSocialSecurityNumber] = useState('');\n const [installments, setInstallments] = useState<InstallmentsObj>({ value: null });\n\n // re. Disable arrows for iOS: The name of the element calling for other elements to be disabled\n // - either a securedField type (like 'encryptedCardNumber') when call is coming from SF\n // or else the name of an internal, Adyen-web, element (like 'holderName')\n const [iOSFocusedField, setIOSFocusedField] = useState(null);\n\n /**\n * LOCAL VARS\n */\n const {\n handleChangeFor,\n triggerValidation,\n data: formData,\n valid: formValid,\n errors: formErrors,\n setSchema,\n setData: setFormData,\n setValid: setFormValid,\n setErrors: setFormErrors\n } = useForm<CardInputDataState>({\n schema: [],\n defaultData: props.data,\n formatters: cardInputFormatters,\n rules: cardInputValidationRules\n });\n\n const hasInstallments = !!Object.keys(props.installmentOptions).length && props.fundingSource !== 'debit';\n const showAmountsInInstallments = props.showInstallmentAmounts ?? true;\n\n const cardCountryCode: string = issuingCountryCode ?? props.countryCode;\n const isKorea = cardCountryCode === 'kr'; // If issuingCountryCode or the merchant defined countryCode is set to 'kr'\n const showKCP = props.configuration.koreanAuthenticationRequired && isKorea;\n\n const showBrazilianSSN: boolean =\n (showSocialSecurityNumber && props.configuration.socialSecurityNumberMode === 'auto') ||\n props.configuration.socialSecurityNumberMode === 'show';\n\n /**\n * HANDLERS\n */\n // Handlers for focus & blur on all fields. Can be renamed to onFieldFocus once the onFocusField is renamed in Field.tsx\n const onFieldFocusAnalytics = (who: string, e: Event | CbObjOnFocus) => {\n props.onFocus({ fieldType: who, event: e });\n };\n const onFieldBlurAnalytics = (who: string, e: Event | CbObjOnFocus) => {\n props.onBlur({ fieldType: who, event: e });\n };\n\n // Make SecuredFields aware of the focus & blur handlers\n const handleFocus = getFocusHandler(setFocusedElement, onFieldFocusAnalytics, onFieldBlurAnalytics);\n\n const retrieveLayout = (): string[] => {\n return getLayout({\n props,\n showKCP,\n showBrazilianSSN,\n ...(props.billingAddressRequired && {\n countrySpecificSchemas: specifications.getAddressSchemaForCountry(billingAddress?.country),\n billingAddressRequiredFields: props.billingAddressRequiredFields\n })\n });\n };\n\n /**\n * re. Disabling arrow keys in iOS:\n * Only by disabling all fields in the Card PM except for the active securedField input can we force the iOS soft keyboard arrow keys to disable\n *\n * NOTE: only called if ua.__IS_IOS = true && this.config.disableIOSArrowKeys = true (as referenced in CSF)\n *\n * @param obj - has fieldType prop saying whether this function is being called in response to an securedFields click ('encryptedCardNumber' etc)\n * - in which case we should disable all non-SF fields\n * or,\n * due to an internal action ('webInternalElement') - in which case we can enable all non-SF fields\n */\n const handleTouchstartIOS = useCallback((obj: TouchStartEventObj) => {\n const elementType = obj.fieldType !== 'webInternalElement' ? obj.fieldType : obj.name;\n setIOSFocusedField(elementType);\n }, []);\n\n const handleAddress = getAddressHandler(setFormData, setFormValid, setFormErrors);\n\n const doPanAutoJump = getAutoJumpHandler(isAutoJumping, sfp, retrieveLayout());\n\n const handleSecuredFieldsChange = (sfState: SFPState, eventDetails?: OnChangeEventDetails): void => {\n /**\n * Handling auto complete value for holderName (but only if the component is using a holderName field)\n */\n if (sfState.autoCompleteName) {\n if (!props.hasHolderName) return;\n const holderNameValidationFn = getRuleByNameAndMode('holderName', 'blur');\n const acHolderName = holderNameValidationFn(sfState.autoCompleteName) ? sfState.autoCompleteName : null;\n if (acHolderName) {\n setFormData('holderName', acHolderName);\n setFormValid('holderName', true); // only if holderName is valid does this fny get called - so we know it's valid and w/o error\n setFormErrors('holderName', null);\n }\n return;\n }\n\n /**\n * Decide if we can shift focus to the expiryDate field.\n *\n * We can if... the config prop, autoFocus, is true AND we have a panLength value from binLookup\n * AND we are responding to a handleOnFieldValid message about the PAN that says it is valid\n */\n if (\n props.autoFocus &&\n hasPanLengthRef.current > 0 &&\n eventDetails?.event === 'handleOnFieldValid' &&\n eventDetails?.fieldType === ENCRYPTED_CARD_NUMBER &&\n sfState.valid.encryptedCardNumber\n ) {\n doPanAutoJump();\n }\n\n /**\n * Process SFP state\n */\n setData({ ...data, ...sfState.data });\n setErrors({ ...errors, ...sfState.errors });\n setValid({ ...valid, ...sfState.valid });\n\n setIsSfpValid(sfState.isSfpValid);\n\n // Values relating to /binLookup response\n setCvcPolicy(sfState.cvcPolicy);\n setShowSocialSecurityNumber(sfState.showSocialSecurityNumber);\n setExpiryDatePolicy(sfState.expiryDatePolicy);\n };\n\n // Farm the handlers for binLookup related functionality out to another 'extensions' file\n const extensions = useMemo(\n () =>\n CIExtensions(\n props,\n { sfp },\n {\n dualBrandSelectElements,\n setDualBrandSelectElements,\n setSelectedBrandValue,\n issuingCountryCode,\n setIssuingCountryCode\n },\n hasPanLengthRef\n ),\n [dualBrandSelectElements, issuingCountryCode]\n );\n\n /**\n * EXPOSE METHODS expected by Card.tsx\n */\n cardInputRef.current.showValidation = () => {\n // set flag\n isValidating.current = true;\n\n /**\n * Clear errors prior to validating so that the screenreader will read them *all* again, and in the right order\n * - only using aria-atomic on the error panel will read them in the wrong order\n */\n clearSRPanel?.(); // TODO - recheck if this is still true\n\n // Validate SecuredFields\n sfp.current.showValidation();\n\n // Validate holderName & SSN & KCP (taxNumber) but *not* billingAddress\n triggerValidation(['holderName', 'socialSecurityNumber', 'taxNumber']);\n\n // Validate Address\n if (billingAddressRef?.current) billingAddressRef.current.showValidation();\n };\n\n cardInputRef.current.processBinLookupResponse = (binLookupResponse: BinLookupResponse, isReset: boolean) => {\n extensions.processBinLookup(binLookupResponse, isReset);\n };\n\n cardInputRef.current.setStatus = setStatus;\n\n /**\n * EFFECT HOOKS\n */\n useEffect(() => {\n // componentDidMount - expose more methods expected by Card.tsx\n cardInputRef.current.setFocusOn = sfp.current.setFocusOn;\n cardInputRef.current.updateStyles = sfp.current.updateStyles;\n cardInputRef.current.handleUnsupportedCard = sfp.current.handleUnsupportedCard;\n\n // componentWillUnmount\n return () => {\n sfp.current.destroy();\n };\n }, []);\n\n /**\n * Handle form schema updates\n */\n useEffect(() => {\n const newSchema = [\n ...(props.hasHolderName ? ['holderName'] : []),\n ...(showBrazilianSSN ? ['socialSecurityNumber'] : []),\n ...(showKCP ? ['taxNumber'] : []),\n ...(showBillingAddress ? ['billingAddress'] : [])\n ];\n setSchema(newSchema);\n }, [props.hasHolderName, showBrazilianSSN, showKCP]);\n\n /**\n * Handle updates from useForm\n */\n useEffect(() => {\n setData({ ...data, holderName: formData.holderName ?? '', taxNumber: formData.taxNumber });\n\n setSocialSecurityNumber(formData.socialSecurityNumber);\n\n if (showBillingAddress) setBillingAddress({ ...formData.billingAddress });\n\n setValid({\n ...valid,\n holderName: props.holderNameRequired ? formValid.holderName : true,\n // Setting value to false if it's falsy keeps in line with existing, expected behaviour\n // - but there is an argument to allow 'undefined' as a value to indicate the non-presence of the field\n socialSecurityNumber: formValid.socialSecurityNumber ? formValid.socialSecurityNumber : false,\n taxNumber: formValid.taxNumber ? formValid.taxNumber : false,\n billingAddress: formValid.billingAddress ? formValid.billingAddress : false\n });\n\n // Check if billingAddress errors object has any properties that aren't null or undefined\n const addressHasErrors = formErrors.billingAddress\n ? Object.entries(formErrors.billingAddress).reduce((acc, [, error]) => acc || error != null, false)\n : false;\n\n // Errors\n setErrors({\n ...errors,\n holderName: props.holderNameRequired && !!formErrors.holderName ? formErrors.holderName : null,\n socialSecurityNumber: showBrazilianSSN && !!formErrors.socialSecurityNumber ? formErrors.socialSecurityNumber : null,\n taxNumber: showKCP && !!formErrors.taxNumber ? formErrors.taxNumber : null,\n billingAddress: showBillingAddress && addressHasErrors ? formErrors.billingAddress : null\n });\n }, [formData, formValid, formErrors]);\n\n // Get the previous value\n const previousSortedErrors = usePrevious(sortedErrorList);\n\n /**\n * Main 'componentDidUpdate' handler\n */\n useEffect(() => {\n const holderNameValid: boolean = valid.holderName;\n\n const sfpValid: boolean = isSfpValid;\n const addressValid: boolean = showBillingAddress ? valid.billingAddress : true;\n\n const koreanAuthentication: boolean = showKCP ? !!valid.taxNumber && !!valid.encryptedPassword : true;\n\n const socialSecurityNumberValid: boolean = showBrazilianSSN ? !!valid.socialSecurityNumber : true;\n\n const isValid: boolean = sfpValid && holderNameValid && addressValid && koreanAuthentication && socialSecurityNumberValid;\n\n const sfStateErrorsObj = sfp.current.mapErrorsToValidationRuleResult();\n const mergedErrors = { ...errors, ...sfStateErrorsObj }; // maps sfErrors AND solves race condition problems for sfp from showValidation\n\n // Extract and then flatten billingAddress errors into a new object with *all* the field errors at top level\n const { billingAddress: extractedAddressErrors, ...errorsWithoutAddress } = mergedErrors;\n\n const errorsForPanel = { ...errorsWithoutAddress, ...extractedAddressErrors };\n\n // Pass dynamic props (errors, layout etc) to SRPanel via partial\n const srPanelResp: SetSRMessagesReturnObject = setSRMessages?.({\n errors: errorsForPanel,\n isValidating: isValidating.current,\n layout: retrieveLayout(),\n // If we don't have country specific address labels, we might have a label related to a partialAddressSchema (i.e. zipCode)\n countrySpecificLabels: specifications.getAddressLabelsForCountry(billingAddress?.country) ?? partialAddressSchema?.default?.labels\n });\n\n /**\n * Need extra actions after setting SRPanel messages in order to focus field (if required) and because we have some errors that are fired onBlur\n */\n const currentErrorsSortedByLayout = srPanelResp?.currentErrorsSortedByLayout;\n\n // Store the array of sorted error objects separately so that we can use it to make comparisons between the old and new arrays\n setSortedErrorList(currentErrorsSortedByLayout);\n\n switch (srPanelResp?.action) {\n // A call to focus the first field in error will always follow the call to validate the whole form\n case ERROR_ACTION_FOCUS_FIELD:\n if (shouldMoveFocusSR) setFocusOnFirstField(isValidating.current, sfp, srPanelResp?.fieldToFocus);\n // Remove 'showValidation' mode - allowing time for collation of all the fields in error whilst it is 'showValidation' mode (some errors come in a second render pass)\n setTimeout(() => {\n isValidating.current = false;\n }, 300);\n break;\n /** On blur scenario: not validating, i.e. trying to submit form, but there might be an error, either to set or to clear */\n case ERROR_ACTION_BLUR_SCENARIO: {\n const difference = getArrayDifferences<SortedErrorObject, string>(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n\n const latestErrorMsg = difference?.[0];\n\n if (latestErrorMsg) {\n // Use the error code to look up whether error is actually a blur based one (most are but some SF ones aren't)\n const isBlurBasedError = lookupBlurBasedErrors(latestErrorMsg.errorCode);\n\n /**\n * ONLY ADD BLUR BASED ERRORS TO THE ERROR PANEL - doing this step prevents the non-blur based errors from being read out twice\n * (once from the aria-live, error panel & once from the aria-describedby element)\n */\n const latestSRError = isBlurBasedError ? latestErrorMsg.errorMessage : null;\n // console.log('### CardInput2::componentDidUpdate:: #2 (not validating) single error:: latestSRError', latestSRError);\n setSRMessagesFromStrings(latestSRError);\n } else {\n // called when previousSortedErrors.length >= currentErrorsSortedByLayout.length\n // console.log('### CardInput2::componentDidUpdate:: #3(not validating) clearing errors:: NO latestErrorMsg');\n clearSRPanel();\n }\n break;\n }\n default:\n break;\n }\n\n // Analytics\n if (currentErrorsSortedByLayout) {\n const newErrors = getArrayDifferences<SortedErrorObject, string>(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n newErrors?.forEach(errorItem => {\n const aObj: FieldErrorAnalyticsObject = {\n fieldType: errorItem.field,\n errorCode: errorItem.errorCode\n };\n\n props.onValidationErrorAnalytics(aObj);\n });\n }\n\n props.onChange({\n data,\n valid,\n errors: mergedErrors,\n isValid,\n billingAddress,\n selectedBrandValue,\n storePaymentMethod,\n socialSecurityNumber,\n installments\n });\n }, [data, valid, errors, selectedBrandValue, storePaymentMethod, installments]);\n\n /**\n * RENDER\n */\n const FieldToRender = props.storedPaymentMethodId ? StoredCardFieldsWrapper : CardFieldsWrapper;\n\n return (\n <Fragment>\n <SecuredFieldsProvider\n ref={sfp}\n {...extractPropsForSFP(props)}\n styles={{ ...props.styles }}\n koreanAuthenticationRequired={props.configuration.koreanAuthenticationRequired}\n hasKoreanFields={!!(props.configuration.koreanAuthenticationRequired && props.countryCode === 'kr')}\n onChange={handleSecuredFieldsChange}\n onBrand={props.onBrand}\n onFocus={handleFocus}\n type={props.brand}\n disableIOSArrowKeys={props.disableIOSArrowKeys ? handleTouchstartIOS : null}\n render={({ setRootNode, setFocusOn }, sfpState) => (\n <div\n ref={setRootNode}\n className={classNames({\n 'adyen-checkout__card-input': true,\n 'adyen-checkout-card-input__wrapper': true,\n [`adyen-checkout__card-input--${props.fundingSource ?? 'credit'}`]: true,\n 'adyen-checkout__card-input--loading': status === 'loading'\n })}\n role={'form'}\n >\n {props.showFormInstruction && <FormInstruction />}\n <FieldToRender\n // Extract exact props that we need to pass down\n {...extractPropsForCardFields(props)}\n // Pass on vars created in CardInput:\n // Base (shared w. StoredCard)\n data={data}\n valid={valid}\n errors={errors}\n handleChangeFor={handleChangeFor}\n focusedElement={focusedElement}\n setFocusOn={setFocusOn}\n sfpState={sfpState}\n cvcPolicy={cvcPolicy}\n hasInstallments={hasInstallments}\n showAmountsInInstallments={showAmountsInInstallments}\n handleInstallments={setInstallments}\n // For Card\n brandsIcons={props.brandsIcons}\n formData={formData}\n formErrors={formErrors}\n formValid={formValid}\n expiryDatePolicy={expiryDatePolicy}\n dualBrandSelectElements={dualBrandSelectElements}\n extensions={extensions}\n selectedBrandValue={selectedBrandValue}\n // For KCP\n showKCP={showKCP}\n // For SSN\n showBrazilianSSN={showBrazilianSSN}\n socialSecurityNumber={socialSecurityNumber}\n // For Store details\n handleOnStoreDetails={setStorePaymentMethod}\n // For Address\n setAddressRef={setAddressRef}\n billingAddress={billingAddress}\n billingAddressValidationRules={partialAddressSchema && getPartialAddressValidationRules(partialAddressCountry.current)}\n partialAddressSchema={partialAddressSchema}\n handleAddress={handleAddress}\n onAddressLookup={props.onAddressLookup}\n onAddressSelected={props.onAddressSelected}\n addressSearchDebounceMs={props.addressSearchDebounceMs}\n //\n iOSFocusedField={iOSFocusedField}\n //\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n </div>\n )}\n />\n {props.showPayButton &&\n props.payButton({\n status,\n variant: props.isPayButtonPrimaryVariant ? 'primary' : 'secondary',\n icon: getImage({ imageFolder: 'components/' })('lock')\n })}\n </Fragment>\n );\n};\n\nCardInput.defaultProps = defaultProps;\n\nexport default CardInput;\n"],"names":["CardInput","props","sfp","useRef","isValidating","getImage","useImage","setSRMessagesFromObjects","setSRMessagesFromStrings","clearSRPanel","shouldMoveFocusSR","useSRPanelContext","setSRMessages","fieldTypeMappingFn","mapFieldKey","billingAddressRef","setAddressRef","ref","current","cardInputRef","Object","keys","length","setComponentRef","hasPanLengthRef","isAutoJumping","specifications","useMemo","Specifications","status","setStatus","useState","errors","setErrors","valid","setValid","holderNameRequired","holderName","data","setData","hasHolderName","sortedErrorList","setSortedErrorList","focusedElement","setFocusedElement","isSfpValid","setIsSfpValid","expiryDatePolicy","setExpiryDatePolicy","DATE_POLICY_REQUIRED","cvcPolicy","setCvcPolicy","CVC_POLICY_REQUIRED","issuingCountryCode","setIssuingCountryCode","dualBrandSelectElements","setDualBrandSelectElements","selectedBrandValue","setSelectedBrandValue","storedPaymentMethodId","brand","showBillingAddress","billingAddressMode","AddressModeOptions","none","billingAddressRequired","partialAddressSchema","handlePartialAddressMode","partialAddressCountry","billingAddress","country","storePaymentMethod","setStorePaymentMethod","setBillingAddress","showSocialSecurityNumber","setShowSocialSecurityNumber","socialSecurityNumber","setSocialSecurityNumber","installments","setInstallments","value","iOSFocusedField","setIOSFocusedField","handleChangeFor","triggerValidation","formData","formValid","formErrors","setSchema","setFormData","setFormValid","setFormErrors","useForm","schema","defaultData","formatters","cardInputFormatters","rules","cardInputValidationRules","hasInstallments","installmentOptions","fundingSource","showAmountsInInstallments","showInstallmentAmounts","isKorea","countryCode","showKCP","configuration","koreanAuthenticationRequired","showBrazilianSSN","socialSecurityNumberMode","onFieldFocusAnalytics","who","e","onFocus","fieldType","event","onFieldBlurAnalytics","onBlur","handleFocus","getFocusHandler","retrieveLayout","getLayout","countrySpecificSchemas","getAddressSchemaForCountry","billingAddressRequiredFields","handleTouchstartIOS","useCallback","obj","elementType","name","handleAddress","getAddressHandler","doPanAutoJump","getAutoJumpHandler","extensions","CIExtensions","showValidation","processBinLookupResponse","binLookupResponse","isReset","processBinLookup","useEffect","setFocusOn","updateStyles","handleUnsupportedCard","destroy","newSchema","taxNumber","addressHasErrors","entries","reduce","acc","error","previousSortedErrors","usePrevious","holderNameValid","sfpValid","addressValid","koreanAuthentication","encryptedPassword","socialSecurityNumberValid","isValid","sfStateErrorsObj","mapErrorsToValidationRuleResult","mergedErrors","extractedAddressErrors","errorsWithoutAddress","errorsForPanel","srPanelResp","layout","countrySpecificLabels","getAddressLabelsForCountry","default","labels","currentErrorsSortedByLayout","action","ERROR_ACTION_FOCUS_FIELD","setFocusOnFirstField","fieldToFocus","setTimeout","ERROR_ACTION_BLUR_SCENARIO","difference","getArrayDifferences","latestErrorMsg","latestSRError","lookupBlurBasedErrors","errorCode","errorMessage","newErrors","forEach","errorItem","aObj","field","onValidationErrorAnalytics","onChange","FieldToRender","StoredCardFieldsWrapper","CardFieldsWrapper","h","Fragment","SecuredFieldsProvider","extractPropsForSFP","styles","hasKoreanFields","sfState","eventDetails","autoCompleteName","acHolderName","getRuleByNameAndMode","holderNameValidationFn","autoFocus","ENCRYPTED_CARD_NUMBER","encryptedCardNumber","onBrand","type","disableIOSArrowKeys","render","setRootNode","sfpState","div","className","classNames","role","showFormInstruction","FormInstruction","extractPropsForCardFields","handleInstallments","brandsIcons","handleOnStoreDetails","billingAddressValidationRules","getPartialAddressValidationRules","onAddressLookup","onAddressSelected","addressSearchDebounceMs","showPayButton","payButton","variant","isPayButtonPrimaryVariant","icon","imageFolder","defaultProps"],"mappings":"yxDAiCA,MAAMA,EAAaC,IACf,MAAMC,EAAMC,EAA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gN,QAAS5O,EAAM6O,0BAA4B,UAAY,YACvDC,KAAM1O,EAAS,CAAE2O,YAAa,eAAxB3O,CAAyC,UACnD,EAKhBL,EAAUiP,aAAeA"}
1
+ {"version":3,"file":"CardInput.js","sources":["../../../../../../src/components/Card/components/CardInput/CardInput.tsx"],"sourcesContent":["import { h, Fragment } from 'preact';\nimport { useState, useEffect, useRef, useMemo, useCallback } from 'preact/hooks';\nimport SecuredFieldsProvider from '../../../internal/SecuredFields/SFP/SecuredFieldsProvider';\nimport { OnChangeEventDetails, SFPState } from '../../../internal/SecuredFields/SFP/types';\nimport defaultProps from './defaultProps';\nimport './CardInput.scss';\nimport { AddressModeOptions, CardInputDataState, CardInputErrorState, CardInputProps, CardInputRef, CardInputValidState } from './types';\nimport { CVC_POLICY_REQUIRED, DATE_POLICY_REQUIRED, ENCRYPTED_CARD_NUMBER } from '../../../internal/SecuredFields/lib/constants';\nimport { BinLookupResponse } from '../../types';\nimport { cardInputFormatters, cardInputValidationRules, getRuleByNameAndMode } from './validate';\nimport CIExtensions from '../../../internal/SecuredFields/binLookup/extensions';\nimport useForm from '../../../../utils/useForm';\nimport { SetSRMessagesReturnObject, SortedErrorObject } from '../../../../core/Errors/types';\nimport { handlePartialAddressMode, extractPropsForCardFields, extractPropsForSFP, getLayout, lookupBlurBasedErrors, mapFieldKey } from './utils';\nimport { usePrevious } from '../../../../utils/hookUtils';\nimport Specifications from '../../../internal/Address/Specifications';\nimport { StoredCardFieldsWrapper } from './components/StoredCardFieldsWrapper';\nimport { CardFieldsWrapper } from './components/CardFieldsWrapper';\nimport { getAddressHandler, getAutoJumpHandler, getFocusHandler, setFocusOnFirstField } from './handlers';\nimport { InstallmentsObj } from './components/Installments/Installments';\nimport { TouchStartEventObj } from './components/types';\nimport classNames from 'classnames';\nimport { getPartialAddressValidationRules } from '../../../internal/Address/validate';\nimport { ERROR_ACTION_BLUR_SCENARIO, ERROR_ACTION_FOCUS_FIELD } from '../../../../core/Errors/constants';\nimport useSRPanelContext from '../../../../core/Errors/useSRPanelContext';\nimport { SetSRMessagesReturnFn } from '../../../../core/Errors/SRPanelProvider';\nimport useImage from '../../../../core/Context/useImage';\nimport { getArrayDifferences } from '../../../../utils/arrayUtils';\nimport FormInstruction from '../../../internal/FormInstruction';\nimport { AddressData } from '../../../../types/global-types';\nimport { CbObjOnFocus } from '../../../internal/SecuredFields/lib/types';\nimport { FieldErrorAnalyticsObject } from '../../../../core/Analytics/types';\nimport { PREFIX } from '../../../internal/Icon/constants';\n\nconst CardInput = (props: CardInputProps) => {\n const sfp = useRef(null);\n const isValidating = useRef(false);\n const getImage = useImage();\n\n /** SR stuff */\n const { setSRMessagesFromObjects, setSRMessagesFromStrings, clearSRPanel, shouldMoveFocusSR } = useSRPanelContext();\n\n // Generate a setSRMessages function - implemented as a partial, since the initial set of arguments don't change.\n const setSRMessages: SetSRMessagesReturnFn = setSRMessagesFromObjects?.({\n fieldTypeMappingFn: mapFieldKey\n });\n /** end SR stuff */\n\n const billingAddressRef = useRef(null);\n const setAddressRef = ref => {\n billingAddressRef.current = ref;\n };\n\n const cardInputRef = useRef<CardInputRef>({});\n // Just call once to create the object by which we expose the members expected by the parent Card comp\n if (!Object.keys(cardInputRef.current).length) {\n props.setComponentRef(cardInputRef.current);\n }\n\n const hasPanLengthRef = useRef(0);\n const isAutoJumping = useRef(false);\n\n const specifications = useMemo(() => new Specifications(props.specifications), [props.specifications]);\n\n // Store ref to sfp (useful for 'deep' debugging)\n cardInputRef.current.sfp = sfp;\n\n /**\n * STATE HOOKS\n */\n const [status, setStatus] = useState('ready');\n\n const [errors, setErrors] = useState<CardInputErrorState>({});\n const [valid, setValid] = useState<CardInputValidState>({\n ...(props.holderNameRequired && { holderName: false })\n });\n const [data, setData] = useState<CardInputDataState>({\n ...(props.hasHolderName && { holderName: props.data.holderName ?? '' })\n });\n\n const [sortedErrorList, setSortedErrorList] = useState<SortedErrorObject[]>(null);\n\n const [focusedElement, setFocusedElement] = useState('');\n const [isSfpValid, setIsSfpValid] = useState(false);\n const [expiryDatePolicy, setExpiryDatePolicy] = useState(DATE_POLICY_REQUIRED);\n const [cvcPolicy, setCvcPolicy] = useState(CVC_POLICY_REQUIRED);\n const [issuingCountryCode, setIssuingCountryCode] = useState<string>(null);\n\n const [dualBrandSelectElements, setDualBrandSelectElements] = useState([]);\n const [selectedBrandValue, setSelectedBrandValue] = useState(props.storedPaymentMethodId ? props.brand : ''); // If this is a storedCard comp initialise state with the storedCard's brand\n\n const showBillingAddress = props.billingAddressMode !== AddressModeOptions.none && props.billingAddressRequired;\n\n const partialAddressSchema = handlePartialAddressMode(props.billingAddressMode);\n // Keeps the value of the country set initially by the merchant, before the Address Component mutates it\n const partialAddressCountry = useRef<string>(partialAddressSchema && props.data?.billingAddress?.country);\n\n const [storePaymentMethod, setStorePaymentMethod] = useState(false);\n const [billingAddress, setBillingAddress] = useState<AddressData>(showBillingAddress ? props.data.billingAddress : null);\n const [showSocialSecurityNumber, setShowSocialSecurityNumber] = useState(false);\n const [socialSecurityNumber, setSocialSecurityNumber] = useState('');\n const [installments, setInstallments] = useState<InstallmentsObj>({ value: null });\n\n // re. Disable arrows for iOS: The name of the element calling for other elements to be disabled\n // - either a securedField type (like 'encryptedCardNumber') when call is coming from SF\n // or else the name of an internal, Adyen-web, element (like 'holderName')\n const [iOSFocusedField, setIOSFocusedField] = useState(null);\n\n /**\n * LOCAL VARS\n */\n const {\n handleChangeFor,\n triggerValidation,\n data: formData,\n valid: formValid,\n errors: formErrors,\n setSchema,\n setData: setFormData,\n setValid: setFormValid,\n setErrors: setFormErrors\n } = useForm<CardInputDataState>({\n schema: [],\n defaultData: props.data,\n formatters: cardInputFormatters,\n rules: cardInputValidationRules\n });\n\n const hasInstallments = !!Object.keys(props.installmentOptions).length && props.fundingSource !== 'debit';\n const showAmountsInInstallments = props.showInstallmentAmounts ?? true;\n\n const cardCountryCode: string = issuingCountryCode ?? props.countryCode;\n const isKorea = cardCountryCode === 'kr'; // If issuingCountryCode or the merchant defined countryCode is set to 'kr'\n const showKCP = props.configuration.koreanAuthenticationRequired && isKorea;\n\n const showBrazilianSSN: boolean =\n (showSocialSecurityNumber && props.configuration.socialSecurityNumberMode === 'auto') ||\n props.configuration.socialSecurityNumberMode === 'show';\n\n /**\n * HANDLERS\n */\n // Handlers for focus & blur on all fields. Can be renamed to onFieldFocus once the onFocusField is renamed in Field.tsx\n const onFieldFocusAnalytics = (who: string, e: Event | CbObjOnFocus) => {\n props.onFocus({ fieldType: who, event: e });\n };\n const onFieldBlurAnalytics = (who: string, e: Event | CbObjOnFocus) => {\n props.onBlur({ fieldType: who, event: e });\n };\n\n // Make SecuredFields aware of the focus & blur handlers\n const handleFocus = getFocusHandler(setFocusedElement, onFieldFocusAnalytics, onFieldBlurAnalytics);\n\n const retrieveLayout = (): string[] => {\n return getLayout({\n props,\n showKCP,\n showBrazilianSSN,\n ...(props.billingAddressRequired && {\n countrySpecificSchemas: specifications.getAddressSchemaForCountry(billingAddress?.country),\n billingAddressRequiredFields: props.billingAddressRequiredFields\n })\n });\n };\n\n /**\n * re. Disabling arrow keys in iOS:\n * Only by disabling all fields in the Card PM except for the active securedField input can we force the iOS soft keyboard arrow keys to disable\n *\n * NOTE: only called if ua.__IS_IOS = true && this.config.disableIOSArrowKeys = true (as referenced in CSF)\n *\n * @param obj - has fieldType prop saying whether this function is being called in response to an securedFields click ('encryptedCardNumber' etc)\n * - in which case we should disable all non-SF fields\n * or,\n * due to an internal action ('webInternalElement') - in which case we can enable all non-SF fields\n */\n const handleTouchstartIOS = useCallback((obj: TouchStartEventObj) => {\n const elementType = obj.fieldType !== 'webInternalElement' ? obj.fieldType : obj.name;\n setIOSFocusedField(elementType);\n }, []);\n\n const handleAddress = getAddressHandler(setFormData, setFormValid, setFormErrors);\n\n const doPanAutoJump = getAutoJumpHandler(isAutoJumping, sfp, retrieveLayout());\n\n const handleSecuredFieldsChange = (sfState: SFPState, eventDetails?: OnChangeEventDetails): void => {\n /**\n * Handling auto complete value for holderName (but only if the component is using a holderName field)\n */\n if (sfState.autoCompleteName) {\n if (!props.hasHolderName) return;\n const holderNameValidationFn = getRuleByNameAndMode('holderName', 'blur');\n const acHolderName = holderNameValidationFn(sfState.autoCompleteName) ? sfState.autoCompleteName : null;\n if (acHolderName) {\n setFormData('holderName', acHolderName);\n setFormValid('holderName', true); // only if holderName is valid does this fny get called - so we know it's valid and w/o error\n setFormErrors('holderName', null);\n }\n return;\n }\n\n /**\n * Decide if we can shift focus to the expiryDate field.\n *\n * We can if... the config prop, autoFocus, is true AND we have a panLength value from binLookup\n * AND we are responding to a handleOnFieldValid message about the PAN that says it is valid\n */\n if (\n props.autoFocus &&\n hasPanLengthRef.current > 0 &&\n eventDetails?.event === 'handleOnFieldValid' &&\n eventDetails?.fieldType === ENCRYPTED_CARD_NUMBER &&\n sfState.valid.encryptedCardNumber\n ) {\n doPanAutoJump();\n }\n\n /**\n * Process SFP state\n */\n setData({ ...data, ...sfState.data });\n setErrors({ ...errors, ...sfState.errors });\n setValid({ ...valid, ...sfState.valid });\n\n setIsSfpValid(sfState.isSfpValid);\n\n // Values relating to /binLookup response\n setCvcPolicy(sfState.cvcPolicy);\n setShowSocialSecurityNumber(sfState.showSocialSecurityNumber);\n setExpiryDatePolicy(sfState.expiryDatePolicy);\n };\n\n // Farm the handlers for binLookup related functionality out to another 'extensions' file\n const extensions = useMemo(\n () =>\n CIExtensions(\n props,\n { sfp },\n {\n dualBrandSelectElements,\n setDualBrandSelectElements,\n setSelectedBrandValue,\n issuingCountryCode,\n setIssuingCountryCode\n },\n hasPanLengthRef\n ),\n [dualBrandSelectElements, issuingCountryCode]\n );\n\n /**\n * EXPOSE METHODS expected by Card.tsx\n */\n cardInputRef.current.showValidation = () => {\n // set flag\n isValidating.current = true;\n\n /**\n * Clear errors prior to validating so that the screenreader will read them *all* again, and in the right order\n * - only using aria-atomic on the error panel will read them in the wrong order\n */\n clearSRPanel?.(); // TODO - recheck if this is still true\n\n // Validate SecuredFields\n sfp.current.showValidation();\n\n // Validate holderName & SSN & KCP (taxNumber) but *not* billingAddress\n triggerValidation(['holderName', 'socialSecurityNumber', 'taxNumber']);\n\n // Validate Address\n if (billingAddressRef?.current) billingAddressRef.current.showValidation();\n };\n\n cardInputRef.current.processBinLookupResponse = (binLookupResponse: BinLookupResponse, isReset: boolean) => {\n extensions.processBinLookup(binLookupResponse, isReset);\n };\n\n cardInputRef.current.setStatus = setStatus;\n\n /**\n * EFFECT HOOKS\n */\n useEffect(() => {\n // componentDidMount - expose more methods expected by Card.tsx\n cardInputRef.current.setFocusOn = sfp.current.setFocusOn;\n cardInputRef.current.updateStyles = sfp.current.updateStyles;\n cardInputRef.current.handleUnsupportedCard = sfp.current.handleUnsupportedCard;\n\n // componentWillUnmount\n return () => {\n sfp.current.destroy();\n };\n }, []);\n\n /**\n * Handle form schema updates\n */\n useEffect(() => {\n const newSchema = [\n ...(props.hasHolderName ? ['holderName'] : []),\n ...(showBrazilianSSN ? ['socialSecurityNumber'] : []),\n ...(showKCP ? ['taxNumber'] : []),\n ...(showBillingAddress ? ['billingAddress'] : [])\n ];\n setSchema(newSchema);\n }, [props.hasHolderName, showBrazilianSSN, showKCP]);\n\n /**\n * Handle updates from useForm\n */\n useEffect(() => {\n setData({ ...data, holderName: formData.holderName ?? '', taxNumber: formData.taxNumber });\n\n setSocialSecurityNumber(formData.socialSecurityNumber);\n\n if (showBillingAddress) setBillingAddress({ ...formData.billingAddress });\n\n setValid({\n ...valid,\n holderName: props.holderNameRequired ? formValid.holderName : true,\n // Setting value to false if it's falsy keeps in line with existing, expected behaviour\n // - but there is an argument to allow 'undefined' as a value to indicate the non-presence of the field\n socialSecurityNumber: formValid.socialSecurityNumber ? formValid.socialSecurityNumber : false,\n taxNumber: formValid.taxNumber ? formValid.taxNumber : false,\n billingAddress: formValid.billingAddress ? formValid.billingAddress : false\n });\n\n // Check if billingAddress errors object has any properties that aren't null or undefined\n const addressHasErrors = formErrors.billingAddress\n ? Object.entries(formErrors.billingAddress).reduce((acc, [, error]) => acc || error != null, false)\n : false;\n\n // Errors\n setErrors({\n ...errors,\n holderName: props.holderNameRequired && !!formErrors.holderName ? formErrors.holderName : null,\n socialSecurityNumber: showBrazilianSSN && !!formErrors.socialSecurityNumber ? formErrors.socialSecurityNumber : null,\n taxNumber: showKCP && !!formErrors.taxNumber ? formErrors.taxNumber : null,\n billingAddress: showBillingAddress && addressHasErrors ? formErrors.billingAddress : null\n });\n }, [formData, formValid, formErrors]);\n\n // Get the previous value\n const previousSortedErrors = usePrevious(sortedErrorList);\n\n /**\n * Main 'componentDidUpdate' handler\n */\n useEffect(() => {\n const holderNameValid: boolean = valid.holderName;\n\n const sfpValid: boolean = isSfpValid;\n const addressValid: boolean = showBillingAddress ? valid.billingAddress : true;\n\n const koreanAuthentication: boolean = showKCP ? !!valid.taxNumber && !!valid.encryptedPassword : true;\n\n const socialSecurityNumberValid: boolean = showBrazilianSSN ? !!valid.socialSecurityNumber : true;\n\n const isValid: boolean = sfpValid && holderNameValid && addressValid && koreanAuthentication && socialSecurityNumberValid;\n\n const sfStateErrorsObj = sfp.current.mapErrorsToValidationRuleResult();\n const mergedErrors = { ...errors, ...sfStateErrorsObj }; // maps sfErrors AND solves race condition problems for sfp from showValidation\n\n // Extract and then flatten billingAddress errors into a new object with *all* the field errors at top level\n const { billingAddress: extractedAddressErrors, ...errorsWithoutAddress } = mergedErrors;\n\n const errorsForPanel = { ...errorsWithoutAddress, ...extractedAddressErrors };\n\n // Pass dynamic props (errors, layout etc) to SRPanel via partial\n const srPanelResp: SetSRMessagesReturnObject = setSRMessages?.({\n errors: errorsForPanel,\n isValidating: isValidating.current,\n layout: retrieveLayout(),\n // If we don't have country specific address labels, we might have a label related to a partialAddressSchema (i.e. zipCode)\n countrySpecificLabels: specifications.getAddressLabelsForCountry(billingAddress?.country) ?? partialAddressSchema?.default?.labels\n });\n\n /**\n * Need extra actions after setting SRPanel messages in order to focus field (if required) and because we have some errors that are fired onBlur\n */\n const currentErrorsSortedByLayout = srPanelResp?.currentErrorsSortedByLayout;\n\n // Store the array of sorted error objects separately so that we can use it to make comparisons between the old and new arrays\n setSortedErrorList(currentErrorsSortedByLayout);\n\n switch (srPanelResp?.action) {\n // A call to focus the first field in error will always follow the call to validate the whole form\n case ERROR_ACTION_FOCUS_FIELD:\n if (shouldMoveFocusSR) setFocusOnFirstField(isValidating.current, sfp, srPanelResp?.fieldToFocus);\n // Remove 'showValidation' mode - allowing time for collation of all the fields in error whilst it is 'showValidation' mode (some errors come in a second render pass)\n setTimeout(() => {\n isValidating.current = false;\n }, 300);\n break;\n /** On blur scenario: not validating, i.e. trying to submit form, but there might be an error, either to set or to clear */\n case ERROR_ACTION_BLUR_SCENARIO: {\n const difference = getArrayDifferences<SortedErrorObject, string>(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n\n const latestErrorMsg = difference?.[0];\n\n if (latestErrorMsg) {\n // Use the error code to look up whether error is actually a blur based one (most are but some SF ones aren't)\n const isBlurBasedError = lookupBlurBasedErrors(latestErrorMsg.errorCode);\n\n /**\n * ONLY ADD BLUR BASED ERRORS TO THE ERROR PANEL - doing this step prevents the non-blur based errors from being read out twice\n * (once from the aria-live, error panel & once from the aria-describedby element)\n */\n const latestSRError = isBlurBasedError ? latestErrorMsg.errorMessage : null;\n // console.log('### CardInput2::componentDidUpdate:: #2 (not validating) single error:: latestSRError', latestSRError);\n setSRMessagesFromStrings(latestSRError);\n } else {\n // called when previousSortedErrors.length >= currentErrorsSortedByLayout.length\n // console.log('### CardInput2::componentDidUpdate:: #3(not validating) clearing errors:: NO latestErrorMsg');\n clearSRPanel();\n }\n break;\n }\n default:\n break;\n }\n\n // Analytics\n if (currentErrorsSortedByLayout) {\n const newErrors = getArrayDifferences<SortedErrorObject, string>(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n newErrors?.forEach(errorItem => {\n const aObj: FieldErrorAnalyticsObject = {\n fieldType: errorItem.field,\n errorCode: errorItem.errorCode\n };\n\n props.onValidationErrorAnalytics(aObj);\n });\n }\n\n props.onChange({\n data,\n valid,\n errors: mergedErrors,\n isValid,\n billingAddress,\n selectedBrandValue,\n storePaymentMethod,\n socialSecurityNumber,\n installments\n });\n }, [data, valid, errors, selectedBrandValue, storePaymentMethod, installments]);\n\n /**\n * RENDER\n */\n const FieldToRender = props.storedPaymentMethodId ? StoredCardFieldsWrapper : CardFieldsWrapper;\n\n return (\n <Fragment>\n <SecuredFieldsProvider\n ref={sfp}\n {...extractPropsForSFP(props)}\n styles={{ ...props.styles }}\n koreanAuthenticationRequired={props.configuration.koreanAuthenticationRequired}\n hasKoreanFields={!!(props.configuration.koreanAuthenticationRequired && props.countryCode === 'kr')}\n onChange={handleSecuredFieldsChange}\n onBrand={props.onBrand}\n onFocus={handleFocus}\n type={props.brand}\n disableIOSArrowKeys={props.disableIOSArrowKeys ? handleTouchstartIOS : null}\n render={({ setRootNode, setFocusOn }, sfpState) => (\n <div\n ref={setRootNode}\n className={classNames({\n 'adyen-checkout__card-input': true,\n 'adyen-checkout-card-input__wrapper': true,\n [`adyen-checkout__card-input--${props.fundingSource ?? 'credit'}`]: true,\n 'adyen-checkout__card-input--loading': status === 'loading'\n })}\n role={'form'}\n >\n {props.showFormInstruction && <FormInstruction />}\n <FieldToRender\n // Extract exact props that we need to pass down\n {...extractPropsForCardFields(props)}\n // Pass on vars created in CardInput:\n // Base (shared w. StoredCard)\n data={data}\n valid={valid}\n errors={errors}\n handleChangeFor={handleChangeFor}\n focusedElement={focusedElement}\n setFocusOn={setFocusOn}\n sfpState={sfpState}\n cvcPolicy={cvcPolicy}\n hasInstallments={hasInstallments}\n showAmountsInInstallments={showAmountsInInstallments}\n handleInstallments={setInstallments}\n // For Card\n brandsIcons={props.brandsIcons}\n formData={formData}\n formErrors={formErrors}\n formValid={formValid}\n expiryDatePolicy={expiryDatePolicy}\n dualBrandSelectElements={dualBrandSelectElements}\n extensions={extensions}\n selectedBrandValue={selectedBrandValue}\n // For KCP\n showKCP={showKCP}\n // For SSN\n showBrazilianSSN={showBrazilianSSN}\n socialSecurityNumber={socialSecurityNumber}\n // For Store details\n handleOnStoreDetails={setStorePaymentMethod}\n // For Address\n setAddressRef={setAddressRef}\n billingAddress={billingAddress}\n billingAddressValidationRules={partialAddressSchema && getPartialAddressValidationRules(partialAddressCountry.current)}\n partialAddressSchema={partialAddressSchema}\n handleAddress={handleAddress}\n onAddressLookup={props.onAddressLookup}\n onAddressSelected={props.onAddressSelected}\n addressSearchDebounceMs={props.addressSearchDebounceMs}\n //\n iOSFocusedField={iOSFocusedField}\n //\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n </div>\n )}\n />\n {props.showPayButton &&\n props.payButton({\n status,\n variant: props.isPayButtonPrimaryVariant ? 'primary' : 'secondary',\n icon: getImage({ imageFolder: 'components/' })(`${PREFIX}lock`)\n })}\n </Fragment>\n );\n};\n\nCardInput.defaultProps = defaultProps;\n\nexport default CardInput;\n"],"names":["CardInput","props","sfp","useRef","isValidating","getImage","useImage","setSRMessagesFromObjects","setSRMessagesFromStrings","clearSRPanel","shouldMoveFocusSR","useSRPanelContext","setSRMessages","fieldTypeMappingFn","mapFieldKey","billingAddressRef","setAddressRef","ref","current","cardInputRef","Object","keys","length","setComponentRef","hasPanLengthRef","isAutoJumping","specifications","useMemo","Specifications","status","setStatus","useState","errors","setErrors","valid","setValid","holderNameRequired","holderName","data","setData","hasHolderName","sortedErrorList","setSortedErrorList","focusedElement","setFocusedElement","isSfpValid","setIsSfpValid","expiryDatePolicy","setExpiryDatePolicy","DATE_POLICY_REQUIRED","cvcPolicy","setCvcPolicy","CVC_POLICY_REQUIRED","issuingCountryCode","setIssuingCountryCode","dualBrandSelectElements","setDualBrandSelectElements","selectedBrandValue","setSelectedBrandValue","storedPaymentMethodId","brand","showBillingAddress","billingAddressMode","AddressModeOptions","none","billingAddressRequired","partialAddressSchema","handlePartialAddressMode","partialAddressCountry","billingAddress","country","storePaymentMethod","setStorePaymentMethod","setBillingAddress","showSocialSecurityNumber","setShowSocialSecurityNumber","socialSecurityNumber","setSocialSecurityNumber","installments","setInstallments","value","iOSFocusedField","setIOSFocusedField","handleChangeFor","triggerValidation","formData","formValid","formErrors","setSchema","setFormData","setFormValid","setFormErrors","useForm","schema","defaultData","formatters","cardInputFormatters","rules","cardInputValidationRules","hasInstallments","installmentOptions","fundingSource","showAmountsInInstallments","showInstallmentAmounts","isKorea","countryCode","showKCP","configuration","koreanAuthenticationRequired","showBrazilianSSN","socialSecurityNumberMode","onFieldFocusAnalytics","who","e","onFocus","fieldType","event","onFieldBlurAnalytics","onBlur","handleFocus","getFocusHandler","retrieveLayout","getLayout","countrySpecificSchemas","getAddressSchemaForCountry","billingAddressRequiredFields","handleTouchstartIOS","useCallback","obj","elementType","name","handleAddress","getAddressHandler","doPanAutoJump","getAutoJumpHandler","extensions","CIExtensions","showValidation","processBinLookupResponse","binLookupResponse","isReset","processBinLookup","useEffect","setFocusOn","updateStyles","handleUnsupportedCard","destroy","newSchema","taxNumber","addressHasErrors","entries","reduce","acc","error","previousSortedErrors","usePrevious","holderNameValid","sfpValid","addressValid","koreanAuthentication","encryptedPassword","socialSecurityNumberValid","isValid","sfStateErrorsObj","mapErrorsToValidationRuleResult","mergedErrors","extractedAddressErrors","errorsWithoutAddress","errorsForPanel","srPanelResp","layout","countrySpecificLabels","getAddressLabelsForCountry","default","labels","currentErrorsSortedByLayout","action","ERROR_ACTION_FOCUS_FIELD","setFocusOnFirstField","fieldToFocus","setTimeout","ERROR_ACTION_BLUR_SCENARIO","difference","getArrayDifferences","latestErrorMsg","latestSRError","lookupBlurBasedErrors","errorCode","errorMessage","newErrors","forEach","errorItem","aObj","field","onValidationErrorAnalytics","onChange","FieldToRender","StoredCardFieldsWrapper","CardFieldsWrapper","h","Fragment","SecuredFieldsProvider","extractPropsForSFP","styles","hasKoreanFields","sfState","eventDetails","autoCompleteName","acHolderName","getRuleByNameAndMode","holderNameValidationFn","autoFocus","ENCRYPTED_CARD_NUMBER","encryptedCardNumber","onBrand","type","disableIOSArrowKeys","render","setRootNode","sfpState","div","className","classNames","role","showFormInstruction","FormInstruction","extractPropsForCardFields","handleInstallments","brandsIcons","handleOnStoreDetails","billingAddressValidationRules","getPartialAddressValidationRules","onAddressLookup","onAddressSelected","addressSearchDebounceMs","showPayButton","payButton","variant","isPayButtonPrimaryVariant","icon","imageFolder","PREFIX","defaultProps"],"mappings":"s1DAkCA,MAAMA,EAAaC,IACf,MAAMC,EAAMC,EAAO,MACbC,EAAeD,GAAO,GACtBE,EAAWC,KAGXC,yBAAEA,EAAwBC,yBAAEA,EAAwBC,aAAEA,EAAYC,kBAAEA,GAAsBC,IAG1FC,EAAuCL,IAA2B,CACpEM,mBAAoBC,IAIlBC,EAAoBZ,EAAO,MAC3Ba,EAAgBC,IAClBF,EAAkBG,QAAUD,CAAAA,EAG1BE,EAAehB,EAAqB,CAAA,GAErCiB,OAAOC,KAAKF,EAAaD,SAASI,QACnCrB,EAAMsB,gBAAgBJ,EAAaD,SAGvC,MAAMM,EAAkBrB,EAAO,GACzBsB,EAAgBtB,GAAO,GAEvBuB,GAAiBC,GAAQ,IAAM,IAAIC,EAAe3B,EAAMyB,iBAAiB,CAACzB,EAAMyB,iBAGtFP,EAAaD,QAAQhB,IAAMA,EAK3B,MAAO2B,GAAQC,IAAaC,EAAS,UAE9BC,GAAQC,IAAaF,EAA8B,CAAC,IACpDG,GAAOC,IAAYJ,EAA8B,IAChD9B,EAAMmC,oBAAsB,CAAEC,YAAY,MAE3CC,GAAMC,IAAWR,EAA6B,IAC7C9B,EAAMuC,eAAiB,CAAEH,WAAYpC,EAAMqC,KAAKD,YAAc,OAG/DI,GAAiBC,IAAsBX,EAA8B,OAErEY,GAAgBC,IAAqBb,EAAS,KAC9Cc,GAAYC,IAAiBf,GAAS,IACtCgB,GAAkBC,IAAuBjB,EAASkB,IAClDC,GAAWC,IAAgBpB,EAASqB,IACpCC,GAAoBC,IAAyBvB,EAAiB,OAE9DwB,GAA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GAEtBxD,cAAeA,EACfqD,eAAgBA,GAChBiK,8BAA+BpK,IAAwBqK,EAAiCnK,GAAsBlD,SAC9GgD,qBAAsBA,GACtBiE,cAAeA,GACfqG,gBAAiBvO,EAAMuO,gBACvBC,kBAAmBxO,EAAMwO,kBACzBC,wBAAyBzO,EAAMyO,wBAE/BzJ,gBAAiBA,GAEjB8B,sBAAuBA,GACvBM,qBAAsBA,QAKrCpH,EAAM0O,eACH1O,EAAM2O,UAAU,CACZ/M,UACAgN,QAAS5O,EAAM6O,0BAA4B,UAAY,YACvDC,KAAM1O,EAAS,CAAE2O,YAAa,eAAxB3O,CAAyC,GAAG4O,WACtD,EAKhBjP,EAAUkP,aAAeA"}
@@ -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,YAAaV,KAAKF,MAAMY,YACxBC,OAAQX,KAAKF,MAAMa,OACnBC,YAAaZ,KAAKF,MAAMc,YACxBC,SAAUb,KAAKF,MAAMgB,eAAeD,SACpCE,QAASf,KAAKF,MAAMgB,eAAeC,QACnCC,OAAQhB,KAAKF,MAAMkB,OACnBC,YAAajB,KAAKF,MAAMmB,cAEhC,CAEOC,WAAAA,CAAYpB,GACf,MAAO,IACAA,EACHG,mBAAoBH,EAAMqB,SAASL,eAAeb,oBAAsBH,EAAMG,mBAEtF,CAEOmB,UAAAA,GACH,MAAMC,oBAAEA,EAAmBC,QAAEA,EAAOC,cAAEA,EAAaC,QAAEA,EAAOC,WAAEA,GAAezB,KAAK0B,MAAMC,MAAQ,IACxFzB,mBAAoB0B,EAA+BvB,sBAAEA,GAA0BL,KAAKF,MAKtF+B,EAA4B7B,KAAKF,MAAMG,qBAAwBD,KAAKF,MAAMqB,SAAWS,EAE3F,GAAIvB,EACA,MAAO,CACHyB,cAAe,CACXC,KAAM1C,EAAW0C,KACjB1B,0BAOZ,MAAO,CACHyB,cAAe,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ejE,KAAKF,MAAM8D,KAAM5D,KAAKF,MAAMa,QAClDuD,KAAMlE,KAAK6D,WAAWM,SAAS,CAAEC,YAAa,eAAxCpE,CAAyD,QAC/DkC,KAAMlC,KAAKiC,YACXtB,OAAQX,KAAKF,MAAMa,OACnB0D,UAAWrE,KAAKqE,UAChBC,SAAUtE,KAAKoC,OACfmC,IAAKA,IACDvE,KAAKwE,aAAeD,CAAAA,IAI5Bb,EAACe,EAAAA,CACGF,IAAKA,IACDvE,KAAKwE,aAAeD,CAAAA,EAExBtE,mBAAoBD,KAAKF,MAAMG,mBAC/BP,eAAgBM,KAAKN,eACrBgF,qBAAsB1E,KAAKkD,2BAC3ByB,QAAS3E,KAAKgD,YACdX,QAASrC,KAAKoC,OACdwC,YAAa5E,KAAKqD,kBAKtC"}
1
+ {"version":3,"file":"CashAppPay.js","sources":["../../../../src/components/CashAppPay/CashAppPay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport { CashAppComponent } from './components/CashAppComponent';\nimport CashAppService from './services/CashAppService';\nimport { CashAppSdkLoader } from './services/CashAppSdkLoader';\nimport { CashAppPayElementData, CashAppPayConfiguration, CashAppPayEventData } from './types';\nimport { ICashAppService } from './services/types';\nimport defaultProps from './defaultProps';\nimport RedirectButton from '../internal/RedirectButton';\nimport { payAmountLabel } from '../internal/PayButton';\nimport { TxVariants } from '../tx-variants';\nimport type { ICore } from '../../core/types';\nimport { PREFIX } from '../internal/Icon/constants';\n\nexport class CashAppPay extends UIElement<CashAppPayConfiguration> {\n public static type = TxVariants.cashapp;\n\n private readonly cashAppService: ICashAppService | undefined;\n\n protected static defaultProps = defaultProps;\n\n constructor(checkout: ICore, props?: CashAppPayConfiguration) {\n super(checkout, props);\n\n if (this.props.enableStoreDetails && this.props.storePaymentMethod) {\n console.warn(\n 'CashAppPay: enableStoreDetails AND storePaymentMethod configuration properties should not be used together. That can lead to undesired behavior.'\n );\n }\n\n if (this.props.storedPaymentMethodId) {\n return;\n }\n\n this.cashAppService = new CashAppService(new CashAppSdkLoader(), {\n storePaymentMethod: this.props.storePaymentMethod,\n useCashAppButtonUi: this.props.showPayButton,\n environment: this.props.environment,\n amount: this.props.amount,\n redirectURL: this.props.redirectURL,\n clientId: this.props.configuration?.clientId,\n scopeId: this.props.configuration?.scopeId,\n button: this.props.button,\n referenceId: this.props.referenceId\n });\n }\n\n public formatProps(props: CashAppPayConfiguration) {\n return {\n ...props,\n enableStoreDetails: props.session?.configuration?.enableStoreDetails || props.enableStoreDetails\n };\n }\n\n public formatData(): CashAppPayElementData {\n const { shopperWantsToStore, grantId, onFileGrantId, cashTag, customerId } = this.state.data || {};\n const { storePaymentMethod: storePaymentMethodSetByMerchant, storedPaymentMethodId } = this.props;\n\n /**\n * We include 'storePaymentMethod' flag if we either Display the Checkbox OR if it is non-sessions flow AND the merchant wants to store the payment method\n */\n const includeStorePaymentMethod = this.props.enableStoreDetails || (!this.props.session && storePaymentMethodSetByMerchant);\n\n if (storedPaymentMethodId) {\n return {\n paymentMethod: {\n type: CashAppPay.type,\n storedPaymentMethodId\n }\n };\n }\n\n const shouldAddOnFileProperties = onFileGrantId && cashTag;\n\n return {\n paymentMethod: {\n type: CashAppPay.type,\n ...(grantId && { grantId }),\n ...(customerId && { customerId }),\n ...(shouldAddOnFileProperties && { onFileGrantId, cashtag: cashTag })\n },\n ...(includeStorePaymentMethod && { storePaymentMethod: storePaymentMethodSetByMerchant || shopperWantsToStore })\n };\n }\n\n get displayName() {\n if (this.props.storedPaymentMethodId && this.props.cashtag) {\n return this.props.cashtag;\n }\n return this.props.name;\n }\n\n get additionalInfo() {\n return this.props.storedPaymentMethodId ? 'Cash App Pay' : '';\n }\n\n public submit = () => {\n const { onClick, storedPaymentMethodId } = this.props;\n\n if (storedPaymentMethodId) {\n super.submit();\n return;\n }\n\n let onClickPromiseRejected = false;\n\n new Promise<void>((resolve, reject) => onClick({ resolve, reject }))\n .catch(() => {\n onClickPromiseRejected = true;\n throw Error('onClick rejected');\n })\n .then(() => {\n return this.cashAppService.createCustomerRequest();\n })\n .then(() => {\n this.cashAppService.begin();\n })\n .catch(error => {\n if (onClickPromiseRejected) {\n // Swallow exception triggered by onClick reject\n return;\n }\n this.handleError(error);\n });\n };\n\n public get isValid(): boolean {\n return true;\n }\n\n private handleOnChangeStoreDetails = (storePayment: boolean) => {\n const data = { ...this.state.data, shopperWantsToStore: storePayment };\n this.setState({ data });\n };\n\n private handleAuthorize = (cashAppPaymentData: CashAppPayEventData): void => {\n const data = { ...this.state.data, ...cashAppPaymentData };\n this.setState({ data, valid: {}, errors: {}, isValid: true });\n super.submit();\n };\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} resources={this.resources} loadingContext={this.props.loadingContext}>\n {this.props.storedPaymentMethodId ? (\n <RedirectButton\n label={payAmountLabel(this.props.i18n, this.props.amount)}\n icon={this.resources?.getImage({ imageFolder: 'components/' })(`${PREFIX}lock`)}\n name={this.displayName}\n amount={this.props.amount}\n payButton={this.payButton}\n onSubmit={this.submit}\n ref={ref => {\n this.componentRef = ref;\n }}\n />\n ) : (\n <CashAppComponent\n ref={ref => {\n this.componentRef = ref;\n }}\n enableStoreDetails={this.props.enableStoreDetails}\n cashAppService={this.cashAppService}\n onChangeStoreDetails={this.handleOnChangeStoreDetails}\n onError={this.handleError}\n onClick={this.submit}\n onAuthorize={this.handleAuthorize}\n />\n )}\n </CoreProvider>\n );\n }\n}\n\nexport default CashAppPay;\n"],"names":["CashAppPay","UIElement","static","TxVariants","cashapp","cashAppService","defaultProps","constructor","checkout","props","super","this","enableStoreDetails","storePaymentMethod","console","warn","storedPaymentMethodId","CashAppService","CashAppSdkLoader","useCashAppButtonUi","showPayButton","environment","amount","redirectURL","clientId","configuration","scopeId","button","referenceId","formatProps","session","formatData","shopperWantsToStore","grantId","onFileGrantId","cashTag","customerId","state","data","storePaymentMethodSetByMerchant","includeStorePaymentMethod","paymentMethod","type","cashtag","displayName","name","additionalInfo","submit","onClick","onClickPromiseRejected","Promise","resolve","reject","catch","Error","then","createCustomerRequest","begin","error","handleError","isValid","handleOnChangeStoreDetails","storePayment","setState","handleAuthorize","cashAppPaymentData","valid","errors","render","h","CoreProvider","i18n","resources","loadingContext","RedirectButton","label","payAmountLabel","icon","getImage","imageFolder","PREFIX","payButton","onSubmit","ref","componentRef","CashAppComponent","onChangeStoreDetails","onError","onAuthorize"],"mappings":"sqBAeO,MAAMA,UAAmBC,EAC5BC,YAAqBC,EAAWC,QAEfC,eAEjBH,oBAAgCI,EAEhCC,WAAAA,CAAYC,EAAiBC,GACzBC,MAAMF,EAAUC,GAEZE,KAAKF,MAAMG,oBAAsBD,KAAKF,MAAMI,oBAC5CC,QAAQC,KACJ,oJAIJJ,KAAKF,MAAMO,wBAIfL,KAAKN,eAAiB,IAAIY,EAAe,IAAIC,EAAoB,CAC7DL,mBAAoBF,KAAKF,MAAMI,mBAC/BM,mBAAoBR,KAAKF,MAAMW,cAC/BC,YAAaV,KAAKF,MAAMY,YACxBC,OAAQX,KAAKF,MAAMa,OACnBC,YAAaZ,KAAKF,MAAMc,YACxBC,SAAUb,KAAKF,MAAMgB,eAAeD,SACpCE,QAASf,KAAKF,MAAMgB,eAAeC,QACnCC,OAAQhB,KAAKF,MAAMkB,OACnBC,YAAajB,KAAKF,MAAMmB,cAEhC,CAEOC,WAAAA,CAAYpB,GACf,MAAO,IACAA,EACHG,mBAAoBH,EAAMqB,SAASL,eAAeb,oBAAsBH,EAAMG,mBAEtF,CAEOmB,UAAAA,GACH,MAAMC,oBAAEA,EAAmBC,QAAEA,EAAOC,cAAEA,EAAaC,QAAEA,EAAOC,WAAEA,GAAezB,KAAK0B,MAAMC,MAAQ,IACxFzB,mBAAoB0B,EAA+BvB,sBAAEA,GAA0BL,KAAKF,MAKtF+B,EAA4B7B,KAAKF,MAAMG,qBAAwBD,KAAKF,MAAMqB,SAAWS,EAE3F,GAAIvB,EACA,MAAO,CACHyB,cA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gBACtF9D,KAAKF,MAAMO,sBACRqD,EAACK,EAAAA,CACGC,MAAOC,EAAejE,KAAKF,MAAM8D,KAAM5D,KAAKF,MAAMa,QAClDuD,KAAMlE,KAAK6D,WAAWM,SAAS,CAAEC,YAAa,eAAxCpE,CAAyD,GAAGqE,SAClEnC,KAAMlC,KAAKiC,YACXtB,OAAQX,KAAKF,MAAMa,OACnB2D,UAAWtE,KAAKsE,UAChBC,SAAUvE,KAAKoC,OACfoC,IAAKA,IACDxE,KAAKyE,aAAeD,CAAAA,IAI5Bd,EAACgB,EAAAA,CACGF,IAAKA,IACDxE,KAAKyE,aAAeD,CAAAA,EAExBvE,mBAAoBD,KAAKF,MAAMG,mBAC/BP,eAAgBM,KAAKN,eACrBiF,qBAAsB3E,KAAKkD,2BAC3B0B,QAAS5E,KAAKgD,YACdX,QAASrC,KAAKoC,OACdyC,YAAa7E,KAAKqD,kBAKtC"}
@@ -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,GAAyBH,GAAkB,GAEtEI,KAAKL,UAAYA,EAEjB,MAAMM,EAAuBC,GAAYC,UACrC,UACUhB,EAAeiB,aAErBP,EAAcQ,QAAU,CACpBlB,EAAemB,iBAAiBC,EAAiBC,mBAAmB,KAChEjB,EAAQ,IAAIkB,EAAmB,SAAU,gCAAA,IAE7CtB,EAAemB,iBAAiBC,EAAiBG,yBAAyBP,UACtEZ,EAAQ,IAAIkB,EAAmB,QAAS,yCAClCtB,EAAewB,gBACfxB,EAAeyB,aAAapB,EAAWa,QAAO,IAGxDlB,EAAemB,iBAAiBC,EAAiBM,yBAAyB,EAAGC,kBAAiBC,aAC1F,MAAMC,EAA0C,IACxCF,GAAiBG,IAAM,CAAEC,WAAYJ,EAAgBG,OACrDH,GAAiBK,SAAW,CAAEC,QAASN,EAAgBK,YACvDJ,GAAQM,SAASC,SAAW,CAAEA,QAASP,EAAOM,QAAQC,YACtDP,GAAQQ,QAAQD,SAAW,CAAEE,cAAeT,EAAOQ,OAAOD,UAGlEhC,EAAY0B,EAAAA,IAEhB7B,EAAemB,iBAAiBC,EAAiBkB,uBAAuB,KACpElC,EAAQ,IAAIkB,EAAmB,QAAS,2BAAA,WAI1CtB,EAAeyB,aAAapB,EAAWa,SAE7CV,EAAU,QACd,CAAE,MAAO+B,GACLnC,EAAQmC,EACZ,IACD,CAACvC,EAAgBI,EAASD,IAiB7B,OAfAqC,GAAU,KACFzC,IACAC,EAAeY,sBAAsBD,GACrCT,EAAqBS,GACzB,GACD,CAACZ,EAAoBY,IAExB6B,GAAU,KACN1B,IACO,KACHd,EAAewB,UACfd,EAAcQ,QAAQuB,SAAQC,GAAiBA,KAAAA,IAEpD,CAAC1C,EAAgBc,IAGhB6B,EAACC,MAAAA,CAAIC,UAAU,0BAA0BC,YAAU,SAASC,YAAsB,YAAXxC,GACvD,YAAXA,GAAwBoC,EAACK,EAAAA,MACd,YAAXzC,GAAwBR,GAAsB4C,EAACM,EAAAA,CAAaC,aAAcvC,EAAoBwC,SAAUvC,IAGzG+B,EAACC,MAAAA,CAAI3C,QAASA,EAAS4C,UAAW,iCAAkCO,IAAK/C,IAGrF"}
1
+ {"version":3,"file":"CashAppComponent.js","sources":["../../../../../src/components/CashAppPay/components/CashAppComponent.tsx"],"sourcesContent":["import { h, RefObject } from 'preact';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport Spinner from '../../internal/Spinner';\nimport { CashAppPayEvents, ICashAppService } from '../services/types';\nimport { CashAppPayEventData } from '../types';\nimport StoreDetails from '../../internal/StoreDetails';\nimport './CashAppComponent.scss';\nimport { UIElementStatus } from '../../internal/UIElement/types';\n\ninterface CashAppComponentProps {\n enableStoreDetails?: boolean;\n cashAppService: ICashAppService;\n onClick(): void;\n onChangeStoreDetails(data: any): void;\n onAuthorize(payEventData: CashAppPayEventData): void;\n onError(error: AdyenCheckoutError): void;\n ref(ref: RefObject<typeof CashAppComponent>): void;\n}\n\nexport function CashAppComponent({\n enableStoreDetails,\n cashAppService,\n onClick,\n onChangeStoreDetails,\n onAuthorize,\n onError\n}: CashAppComponentProps): h.JSX.Element {\n const cashAppRef = useRef<HTMLDivElement>(null);\n const [status, setStatus] = useState<UIElementStatus>('loading');\n const subscriptions = useRef<Function[]>([]);\n const [storePaymentMethod, setStorePaymentMethod] = useState<boolean>(false);\n\n this.setStatus = setStatus;\n\n const initializeCashAppSdk = useCallback(async () => {\n try {\n await cashAppService.initialize();\n\n subscriptions.current = [\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerDismissed, () => {\n onError(new AdyenCheckoutError('CANCEL', 'Customer dismissed the modal'));\n }),\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerRequestDeclined, async () => {\n onError(new AdyenCheckoutError('ERROR', 'Payment declined by CashAppPay'));\n await cashAppService.restart();\n await cashAppService.renderButton(cashAppRef.current);\n }),\n\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerRequestApproved, ({ customerProfile, grants }) => {\n const cashAppPaymentData: CashAppPayEventData = {\n ...(customerProfile?.id && { customerId: customerProfile.id }),\n ...(customerProfile?.cashtag && { cashTag: customerProfile.cashtag }),\n ...(grants?.payment?.grantId && { grantId: grants.payment.grantId }),\n ...(grants?.onFile?.grantId && { onFileGrantId: grants.onFile.grantId })\n };\n\n onAuthorize(cashAppPaymentData);\n }),\n cashAppService.subscribeToEvent(CashAppPayEvents.CustomerRequestFailed, () => {\n onError(new AdyenCheckoutError('ERROR', 'Customer request failed'));\n })\n ];\n\n await cashAppService.renderButton(cashAppRef.current);\n\n setStatus('ready');\n } catch (error) {\n if (error instanceof AdyenCheckoutError) onError(error);\n else onError(new AdyenCheckoutError('ERROR', 'Error when initializing CashAppPay', { cause: error }));\n }\n }, [cashAppService, onError, onAuthorize]);\n\n useEffect(() => {\n if (enableStoreDetails) {\n cashAppService.setStorePaymentMethod(storePaymentMethod);\n onChangeStoreDetails(storePaymentMethod);\n }\n }, [enableStoreDetails, storePaymentMethod]);\n\n useEffect(() => {\n initializeCashAppSdk();\n return () => {\n cashAppService.restart();\n subscriptions.current.forEach(unsubscribeFn => unsubscribeFn());\n };\n }, [cashAppService, initializeCashAppSdk]);\n\n return (\n <div className=\"adyen-checkout__cashapp\" aria-live=\"polite\" aria-busy={status === 'loading'}>\n {status === 'loading' && <Spinner />}\n {status !== 'loading' && enableStoreDetails && <StoreDetails storeDetails={storePaymentMethod} onChange={setStorePaymentMethod} />}\n\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}\n <div onClick={onClick} className={'adyen-checkout__cashapp-button'} ref={cashAppRef}></div>\n </div>\n );\n}\n"],"names":["CashAppComponent","enableStoreDetails","cashAppService","onClick","onChangeStoreDetails","onAuthorize","onError","cashAppRef","useRef","status","setStatus","useState","subscriptions","storePaymentMethod","setStorePaymentMethod","this","initializeCashAppSdk","useCallback","async","initialize","current","subscribeToEvent","CashAppPayEvents","CustomerDismissed","AdyenCheckoutError","CustomerRequestDeclined","restart","renderButton","CustomerRequestApproved","customerProfile","grants","cashAppPaymentData","id","customerId","cashtag","cashTag","payment","grantId","onFile","onFileGrantId","CustomerRequestFailed","error","cause","useEffect","forEach","unsubscribeFn","h","div","className","aria-live","aria-busy","Spinner","StoreDetails","storeDetails","onChange","ref"],"mappings":"0ZAoBO,SAASA,GAAiBC,mBAC7BA,EAAkBC,eAClBA,EAAcC,QACdA,EAAOC,qBACPA,EAAoBC,YACpBA,EAAWC,QACXA,IAEA,MAAMC,EAAaC,EAAuB,OACnCC,EAAQC,GAAaC,EAA0B,WAChDC,EAAgBJ,EAAmB,KAClCK,EAAoBC,GAAyBH,GAAkB,GAEtEI,KAAKL,UAAYA,EAEjB,MAAMM,EAAuBC,GAAYC,UACrC,UACUhB,EAAeiB,aAErBP,EAAcQ,QAAU,CACpBlB,EAAemB,iBAAiBC,EAAiBC,mBAAmB,KAChEjB,EAAQ,IAAIkB,EAAmB,SAAU,gCAAA,IAE7CtB,EAAemB,iBAAiBC,EAAiBG,yBAAyBP,UACtEZ,EAAQ,IAAIkB,EAAmB,QAAS,yCAClCtB,EAAewB,gBACfxB,EAAeyB,aAAapB,EAAWa,QAAO,IAGxDlB,EAAemB,iBAAiBC,EAAiBM,yBAAyB,EAAGC,kBAAiBC,aAC1F,MAAMC,EAA0C,IACxCF,GAAiBG,IAAM,CAAEC,WAAYJ,EAAgBG,OACrDH,GAAiBK,SAAW,CAAEC,QAASN,EAAgBK,YACvDJ,GAAQM,SAASC,SAAW,CAAEA,QAASP,EAAOM,QAAQC,YACtDP,GAAQQ,QAAQD,SAAW,CAAEE,cAAeT,EAAOQ,OAAOD,UAGlEhC,EAAY0B,EAAAA,IAEhB7B,EAAemB,iBAAiBC,EAAiBkB,uBAAuB,KACpElC,EAAQ,IAAIkB,EAAmB,QAAS,2BAAA,WAI1CtB,EAAeyB,aAAapB,EAAWa,SAE7CV,EAAU,QACd,CAAE,MAAO+B,GACoCnC,EAArCmC,aAAiBjB,EAA4BiB,EACpC,IAAIjB,EAAmB,QAAS,qCAAsC,CAAEkB,MAAOD,IAChG,IACD,CAACvC,EAAgBI,EAASD,IAiB7B,OAfAsC,GAAU,KACF1C,IACAC,EAAeY,sBAAsBD,GACrCT,EAAqBS,GACzB,GACD,CAACZ,EAAoBY,IAExB8B,GAAU,KACN3B,IACO,KACHd,EAAewB,UACfd,EAAcQ,QAAQwB,SAAQC,GAAiBA,KAAAA,IAEpD,CAAC3C,EAAgBc,IAGhB8B,EAACC,MAAAA,CAAIC,UAAU,0BAA0BC,YAAU,SAASC,YAAsB,YAAXzC,GACvD,YAAXA,GAAwBqC,EAACK,EAAAA,MACd,YAAX1C,GAAwBR,GAAsB6C,EAACM,EAAAA,CAAaC,aAAcxC,EAAoByC,SAAUxC,IAGzGgC,EAACC,MAAAA,CAAI5C,QAASA,EAAS6C,UAAW,iCAAkCO,IAAKhD,IAGrF"}
@@ -1 +1 @@
1
- {"version":3,"file":"InstantPaymentMethods.js","sources":["../../../../../../src/components/Dropin/components/PaymentMethod/InstantPaymentMethods.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport UIElement from '../../../internal/UIElement/UIElement';\n\ninterface InstantPaymentMethodsProps {\n paymentMethods: UIElement[];\n}\n\nfunction InstantPaymentMethods({ paymentMethods }: InstantPaymentMethodsProps) {\n return (\n <Fragment>\n <ul className=\"adyen-checkout__instant-payment-methods-list\">\n {paymentMethods.map(pm => (\n <li key={pm.type}>{pm.render()}</li>\n ))}\n </ul>\n </Fragment>\n );\n}\n\nexport default InstantPaymentMethods;\n"],"names":["InstantPaymentMethods","paymentMethods","h","Fragment","ul","className","map","pm","li","key","type","render"],"mappings":"yFAOA,SAASA,GAAsBC,eAAEA,IAC7B,OACIC,EAACC,OACGD,EAACE,KAAAA,CAAGC,UAAU,gDACTJ,EAAeK,KAAIC,GAChBL,EAACM,KAAAA,CAAGC,IAAKF,EAAGG,MAAOH,EAAGI,aAK1C"}
1
+ {"version":3,"file":"InstantPaymentMethods.js","sources":["../../../../../../src/components/Dropin/components/PaymentMethod/InstantPaymentMethods.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport UIElement from '../../../internal/UIElement/UIElement';\nimport './InstantPaymentMethods.scss';\n\ninterface InstantPaymentMethodsProps {\n paymentMethods: UIElement[];\n}\n\nfunction InstantPaymentMethods({ paymentMethods }: InstantPaymentMethodsProps) {\n return (\n <Fragment>\n <ul className=\"adyen-checkout__instant-payment-methods-list\">\n {paymentMethods.map(pm => (\n <li key={pm.type}>{pm.render()}</li>\n ))}\n </ul>\n </Fragment>\n );\n}\n\nexport default InstantPaymentMethods;\n"],"names":["InstantPaymentMethods","paymentMethods","h","Fragment","ul","className","map","pm","li","key","type","render"],"mappings":"yFAQA,SAASA,GAAsBC,eAAEA,IAC7B,OACIC,EAACC,OACGD,EAACE,KAAAA,CAAGC,UAAU,gDACTJ,EAAeK,KAAIC,GAChBL,EAACM,KAAAA,CAAGC,IAAKF,EAAGG,MAAOH,EAAGI,aAK1C"}
@@ -1,2 +1,2 @@
1
- import{Component as t,createElement as e}from"../../../external/preact/dist/preact.js";class o extends t{paywithgoogleWrapper;static defaultProps={buttonColor:"default",buttonType:"long",buttonSizeMode:"static"};clicked=!1;handleClick=t=>{t.preventDefault(),t.stopPropagation(),this.clicked||(this.props.onClick(t),this.clicked=!0,setTimeout((()=>{this.clicked=!1}),300))};componentDidMount(){const{buttonColor:t,buttonType:e,buttonLocale:o,buttonSizeMode:n,buttonRootNode:a,paymentsClient:i}=this.props;i.then((i=>i.createButton({onClick:this.handleClick,buttonType:e,buttonColor:t,buttonLocale:o,buttonSizeMode:n,buttonRootNode:a}))).then((t=>{this.paywithgoogleWrapper.appendChild(t)}))}render(){return e("span",{className:"adyen-checkout__paywithgoogle",ref:t=>{this.paywithgoogleWrapper=t}})}}export{o as default};
1
+ import{createElement as t}from"../../../external/preact/dist/preact.js";import{useRef as o,useEffect as e}from"../../../external/preact/hooks/dist/hooks.js";const n=n=>{const a=o(void 0);return e((()=>{const{onClick:t,buttonColor:o,buttonType:e,buttonLocale:u,buttonSizeMode:r,buttonRootNode:c,paymentsClient:s}=n;s.then((n=>n.createButton({onClick:t,buttonType:e,buttonColor:o,buttonLocale:u,buttonSizeMode:r,buttonRootNode:c}))).then((t=>{a.current&&a.current.appendChild(t)}))}),[n.buttonColor,n.buttonType,n.buttonLocale,n.buttonSizeMode,n.buttonRootNode,n.paymentsClient]),t("div",{"data-testid":"googlepay-button-container",className:"adyen-checkout__paywithgoogle",ref:a})};export{n as default};
2
2
  //# sourceMappingURL=GooglePayButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GooglePayButton.js","sources":["../../../../../src/components/GooglePay/components/GooglePayButton.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport './GooglePayButton.scss';\n\ninterface GooglePayButtonProps {\n buttonColor: google.payments.api.ButtonColor;\n buttonType: google.payments.api.ButtonType;\n buttonSizeMode: google.payments.api.ButtonSizeMode;\n buttonLocale: string;\n buttonRootNode?: HTMLDocument | ShadowRoot;\n paymentsClient: Promise<google.payments.api.PaymentsClient>;\n onClick: (e: Event) => void;\n}\n\nclass GooglePayButton extends Component<GooglePayButtonProps> {\n public paywithgoogleWrapper;\n\n public static defaultProps = {\n buttonColor: 'default', // default (black), black, white\n buttonType: 'long', // long, short\n buttonSizeMode: 'static' // long, short\n };\n private clicked = false;\n\n private handleClick = e => {\n e.preventDefault();\n e.stopPropagation();\n\n if (!this.clicked) {\n this.props.onClick(e);\n this.clicked = true;\n\n setTimeout(() => {\n this.clicked = false;\n }, 300);\n }\n };\n\n componentDidMount() {\n const { buttonColor, buttonType, buttonLocale, buttonSizeMode, buttonRootNode, paymentsClient } = this.props;\n\n paymentsClient\n .then(client =>\n client.createButton({\n onClick: this.handleClick,\n buttonType,\n buttonColor,\n buttonLocale,\n buttonSizeMode,\n buttonRootNode\n })\n )\n .then(googlePayButton => {\n this.paywithgoogleWrapper.appendChild(googlePayButton);\n });\n }\n\n render() {\n return (\n <span\n className={'adyen-checkout__paywithgoogle'}\n ref={ref => {\n this.paywithgoogleWrapper = ref;\n }}\n />\n );\n }\n}\n\nexport default GooglePayButton;\n"],"names":["GooglePayButton","Component","paywithgoogleWrapper","static","buttonColor","buttonType","buttonSizeMode","clicked","handleClick","e","preventDefault","stopPropagation","this","props","onClick","setTimeout","componentDidMount","buttonLocale","buttonRootNode","paymentsClient","then","client","createButton","googlePayButton","appendChild","render","h","span","className","ref"],"mappings":"uFAaA,MAAMA,UAAwBC,EACnBC,qBAEPC,oBAA6B,CACzBC,YAAa,UACbC,WAAY,OACZC,eAAgB,UAEZC,SAAU,EAEVC,YAAcC,IAClBA,EAAEC,iBACFD,EAAEE,kBAEGC,KAAKL,UACNK,KAAKC,MAAMC,QAAQL,GACnBG,KAAKL,SAAU,EAEfQ,YAAW,KACPH,KAAKL,SAAU,CAAA,GAChB,KACP,EAGJS,iBAAAA,GACI,MAAMZ,YAAEA,EAAWC,WAAEA,EAAUY,aAAEA,EAAYX,eAAEA,EAAcY,eAAEA,EAAcC,eAAEA,GAAmBP,KAAKC,MAEvGM,EACKC,MAAKC,GACFA,EAAOC,aAAa,CAChBR,QAASF,KAAKJ,YACdH,aACAD,cACAa,eACAX,iBACAY,qBAGPE,MAAKG,IACFX,KAAKV,qBAAqBsB,YAAYD,EAAAA,GAElD,CAEAE,MAAAA,GACI,OACIC,EAACC,OAAAA,CACGC,UAAW,gCACXC,IAAKA,IACDjB,KAAKV,qBAAuB2B,CAAAA,GAI5C"}
1
+ {"version":3,"file":"GooglePayButton.js","sources":["../../../../../src/components/GooglePay/components/GooglePayButton.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useRef } from 'preact/hooks';\nimport './GooglePayButton.scss';\n\ninterface GooglePayButtonProps {\n buttonColor: google.payments.api.ButtonColor;\n buttonType: google.payments.api.ButtonType;\n buttonSizeMode: google.payments.api.ButtonSizeMode;\n buttonLocale: string;\n buttonRootNode?: HTMLDocument | ShadowRoot;\n paymentsClient: Promise<google.payments.api.PaymentsClient>;\n onClick: (e: Event) => void;\n}\n\nconst GooglePayButton = (props: GooglePayButtonProps) => {\n const googlePayWrapperRef = useRef<HTMLDivElement | undefined>(undefined);\n\n useEffect(() => {\n const { onClick, buttonColor, buttonType, buttonLocale, buttonSizeMode, buttonRootNode, paymentsClient } = props;\n\n paymentsClient\n .then(client =>\n client.createButton({\n onClick,\n buttonType,\n buttonColor,\n buttonLocale,\n buttonSizeMode,\n buttonRootNode\n })\n )\n .then(googlePayButton => {\n if (googlePayWrapperRef.current) {\n googlePayWrapperRef.current.appendChild(googlePayButton);\n }\n });\n }, [props.buttonColor, props.buttonType, props.buttonLocale, props.buttonSizeMode, props.buttonRootNode, props.paymentsClient]);\n\n return <div data-testid=\"googlepay-button-container\" className={'adyen-checkout__paywithgoogle'} ref={googlePayWrapperRef} />;\n};\n\nexport default GooglePayButton;\n"],"names":["GooglePayButton","props","googlePayWrapperRef","useRef","undefined","useEffect","onClick","buttonColor","buttonType","buttonLocale","buttonSizeMode","buttonRootNode","paymentsClient","then","client","createButton","googlePayButton","current","appendChild","h","div","data-testid","className","ref"],"mappings":"6JAcA,MAAMA,EAAmBC,IACrB,MAAMC,EAAsBC,OAAmCC,GAuB/D,OArBAC,GAAU,KACN,MAAMC,QAAEA,EAAOC,YAAEA,EAAWC,WAAEA,EAAUC,aAAEA,EAAYC,eAAEA,EAAcC,eAAEA,EAAcC,eAAEA,GAAmBX,EAE3GW,EACKC,MAAKC,GACFA,EAAOC,aAAa,CAChBT,UACAE,aACAD,cACAE,eACAC,iBACAC,qBAGPE,MAAKG,IACEd,EAAoBe,SACpBf,EAAoBe,QAAQC,YAAYF,EAC5C,GACJ,GACL,CAACf,EAAMM,YAAaN,EAAMO,WAAYP,EAAMQ,aAAcR,EAAMS,eAAgBT,EAAMU,eAAgBV,EAAMW,iBAExGO,EAACC,MAAAA,CAAIC,cAAY,6BAA6BC,UAAW,gCAAiCC,IAAKrB"}
@@ -1,2 +1,2 @@
1
- const e={isExpress:!1,existingPaymentMethodRequired:!1,buttonColor:"default",buttonType:"long",buttonSizeMode:void 0,configuration:{gatewayMerchantId:"",merchantId:"",merchantName:""},amount:{value:0,currency:"USD"},totalPriceStatus:"FINAL",onClick:e=>e(),allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:["AMEX","DISCOVER","JCB","MASTERCARD","VISA"],allowCreditCards:!0,allowPrepaidCards:!0,billingAddressRequired:!1,billingAddressParameters:void 0,assuranceDetailsRequired:!1,emailRequired:!1,shippingAddressRequired:!1,shippingAddressParameters:void 0,shippingOptionRequired:!1,shippingOptionParameters:void 0,callbackIntents:[]};export{e as default};
1
+ const e={isExpress:!1,existingPaymentMethodRequired:!1,buttonColor:"default",buttonType:"buy",buttonSizeMode:"fill",configuration:{gatewayMerchantId:"",merchantId:"",merchantName:""},amount:{value:0,currency:"USD"},totalPriceStatus:"FINAL",onClick:e=>e(),allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:["AMEX","DISCOVER","JCB","MASTERCARD","VISA"],allowCreditCards:!0,allowPrepaidCards:!0,billingAddressRequired:!1,billingAddressParameters:void 0,assuranceDetailsRequired:!1,emailRequired:!1,shippingAddressRequired:!1,shippingAddressParameters:void 0,shippingOptionRequired:!1,shippingOptionParameters:void 0,callbackIntents:[]};export{e as default};
2
2
  //# sourceMappingURL=defaultProps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"defaultProps.js","sources":["../../../../src/components/GooglePay/defaultProps.ts"],"sourcesContent":["import { GooglePayConfiguration } from './types';\n\nconst defaultProps: GooglePayConfiguration = {\n isExpress: false,\n\n // isReadyToPayRequest\n existingPaymentMethodRequired: false,\n\n // ButtonOptions\n // https://developers.google.com/pay/api/web/reference/object#ButtonOptions\n buttonColor: 'default' as google.payments.api.ButtonColor, // default/black/white\n buttonType: 'long' as google.payments.api.ButtonType, // long/short\n buttonSizeMode: undefined,\n\n // PaymentDataRequest\n configuration: {\n // Adyen's merchant account\n gatewayMerchantId: '', // E.g TestMerchant\n\n // https://developers.google.com/pay/api/web/reference/object#MerchantInfo\n merchantId: '', // E.g 039484839309\n merchantName: '' // E.g Example Merchant,\n },\n\n // Payment\n amount: {\n value: 0,\n currency: 'USD'\n },\n\n totalPriceStatus: 'FINAL' as google.payments.api.TotalPriceStatus,\n\n // Callbacks\n onClick: resolve => resolve(),\n\n // CardParameters\n // https://developers.google.com/pay/api/web/reference/object#CardParameters\n allowedAuthMethods: ['PAN_ONLY', 'CRYPTOGRAM_3DS'] as google.payments.api.CardAuthMethod[],\n allowedCardNetworks: ['AMEX', 'DISCOVER', 'JCB', 'MASTERCARD', 'VISA'] as google.payments.api.CardNetwork[],\n allowCreditCards: true, // Set to false if you don't support credit cards.\n allowPrepaidCards: true, // Set to false if you don't support prepaid cards.\n billingAddressRequired: false, // A billing address should only be requested if it's required to process the transaction.\n billingAddressParameters: undefined, // The expected fields returned if billingAddressRequired is set to true.\n assuranceDetailsRequired: false, // https://developers.google.com/pay/api/web/reference/response-objects#assurance-details-specifications\n\n emailRequired: false,\n shippingAddressRequired: false,\n shippingAddressParameters: undefined, // https://developers.google.com/pay/api/web/reference/object#ShippingAddressParameters\n shippingOptionRequired: false,\n shippingOptionParameters: undefined,\n callbackIntents: []\n};\n\nexport default defaultProps;\n"],"names":["defaultProps","isExpress","existingPaymentMethodRequired","buttonColor","buttonType","buttonSizeMode","undefined","configuration","gatewayMerchantId","merchantId","merchantName","amount","value","currency","totalPriceStatus","onClick","resolve","allowedAuthMethods","allowedCardNetworks","allowCreditCards","allowPrepaidCards","billingAddressRequired","billingAddressParameters","assuranceDetailsRequired","emailRequired","shippingAddressRequired","shippingAddressParameters","shippingOptionRequired","shippingOptionParameters","callbackIntents"],"mappings":"AAEA,MAAMA,EAAuC,CACzCC,WAAW,EAGXC,+BAA+B,EAI/BC,YAAa,UACbC,WAAY,OACZC,oBAAgBC,EAGhBC,cAAe,CAEXC,kBAAmB,GAGnBC,WAAY,GACZC,aAAc,IAIlBC,OAAQ,CACJC,MAAO,EACPC,SAAU,OAGdC,iBAAkB,QAGlBC,QAASC,GAAWA,IAIpBC,mBAAoB,CAAC,WAAY,kBACjCC,oBAAqB,CAAC,OAAQ,WAAY,MAAO,aAAc,QAC/DC,kBAAkB,EAClBC,mBAAmB,EACnBC,wBAAwB,EACxBC,8BAA0BhB,EAC1BiB,0BAA0B,EAE1BC,eAAe,EACfC,yBAAyB,EACzBC,+BAA2BpB,EAC3BqB,wBAAwB,EACxBC,8BAA0BtB,EAC1BuB,gBAAiB"}
1
+ {"version":3,"file":"defaultProps.js","sources":["../../../../src/components/GooglePay/defaultProps.ts"],"sourcesContent":["import { GooglePayConfiguration } from './types';\n\nconst defaultProps: GooglePayConfiguration = {\n isExpress: false,\n\n // isReadyToPayRequest\n existingPaymentMethodRequired: false,\n\n // ButtonOptions\n // https://developers.google.com/pay/api/web/reference/object#ButtonOptions\n buttonColor: 'default',\n buttonType: 'buy',\n buttonSizeMode: 'fill',\n\n // PaymentDataRequest\n configuration: {\n // Adyen's merchant account\n gatewayMerchantId: '', // E.g TestMerchant\n\n // https://developers.google.com/pay/api/web/reference/object#MerchantInfo\n merchantId: '', // E.g 039484839309\n merchantName: '' // E.g Example Merchant,\n },\n\n // Payment\n amount: {\n value: 0,\n currency: 'USD'\n },\n\n totalPriceStatus: 'FINAL',\n\n // Callbacks\n onClick: resolve => resolve(),\n\n // CardParameters\n // https://developers.google.com/pay/api/web/reference/object#CardParameters\n allowedAuthMethods: ['PAN_ONLY', 'CRYPTOGRAM_3DS'] as google.payments.api.CardAuthMethod[],\n allowedCardNetworks: ['AMEX', 'DISCOVER', 'JCB', 'MASTERCARD', 'VISA'] as google.payments.api.CardNetwork[],\n allowCreditCards: true, // Set to false if you don't support credit cards.\n allowPrepaidCards: true, // Set to false if you don't support prepaid cards.\n billingAddressRequired: false, // A billing address should only be requested if it's required to process the transaction.\n billingAddressParameters: undefined, // The expected fields returned if billingAddressRequired is set to true.\n assuranceDetailsRequired: false, // https://developers.google.com/pay/api/web/reference/response-objects#assurance-details-specifications\n\n emailRequired: false,\n shippingAddressRequired: false,\n shippingAddressParameters: undefined, // https://developers.google.com/pay/api/web/reference/object#ShippingAddressParameters\n shippingOptionRequired: false,\n shippingOptionParameters: undefined,\n callbackIntents: []\n};\n\nexport default defaultProps;\n"],"names":["defaultProps","isExpress","existingPaymentMethodRequired","buttonColor","buttonType","buttonSizeMode","configuration","gatewayMerchantId","merchantId","merchantName","amount","value","currency","totalPriceStatus","onClick","resolve","allowedAuthMethods","allowedCardNetworks","allowCreditCards","allowPrepaidCards","billingAddressRequired","billingAddressParameters","undefined","assuranceDetailsRequired","emailRequired","shippingAddressRequired","shippingAddressParameters","shippingOptionRequired","shippingOptionParameters","callbackIntents"],"mappings":"AAEA,MAAMA,EAAuC,CACzCC,WAAW,EAGXC,+BAA+B,EAI/BC,YAAa,UACbC,WAAY,MACZC,eAAgB,OAGhBC,cAAe,CAEXC,kBAAmB,GAGnBC,WAAY,GACZC,aAAc,IAIlBC,OAAQ,CACJC,MAAO,EACPC,SAAU,OAGdC,iBAAkB,QAGlBC,QAASC,GAAWA,IAIpBC,mBAAoB,CAAC,WAAY,kBACjCC,oBAAqB,CAAC,OAAQ,WAAY,MAAO,aAAc,QAC/DC,kBAAkB,EAClBC,mBAAmB,EACnBC,wBAAwB,EACxBC,8BAA0BC,EAC1BC,0BAA0B,EAE1BC,eAAe,EACfC,yBAAyB,EACzBC,+BAA2BJ,EAC3BK,wBAAwB,EACxBC,8BAA0BN,EAC1BO,gBAAiB"}
@@ -1,2 +1,2 @@
1
- import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import r from"../internal/PersonalDetails/PersonalDetails.js";import{CoreProvider as s}from"../../core/Context/CoreProvider.js";import{TxVariants as o}from"../tx-variants.js";import n from"../internal/FormInstruction/FormInstruction.js";class i extends e{static type=o.personal_details;static defaultProps={showFormInstruction:!0};get data(){return this.state.data}get isValid(){return!!this.state.isValid}render(){return t(s,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},this.props.showFormInstruction&&t(n,null),t(r,{setComponentRef:this.setComponentRef,...this.props,onChange:this.setState,...!1}))}}export{i as PersonalDetailsElement,i as default};
1
+ import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import r from"../internal/PersonalDetails/PersonalDetails.js";import{CoreProvider as s}from"../../core/Context/CoreProvider.js";import{TxVariants as o}from"../tx-variants.js";import n from"../internal/FormInstruction/FormInstruction.js";class i extends e{static type=o.personal_details;static defaultProps={showFormInstruction:!0};get data(){return this.state.data}get isValid(){return!!this.state.isValid}render(){return t(s,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},this.props.showFormInstruction&&t(n,null),t(r,{setComponentRef:this.setComponentRef,...this.props,onChange:this.setState}))}}export{i as PersonalDetailsElement,i as default};
2
2
  //# sourceMappingURL=PersonalDetails.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PersonalDetails.js","sources":["../../../../src/components/PersonalDetails/PersonalDetails.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport PersonalDetails from '../internal/PersonalDetails';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport { TxVariants } from '../tx-variants';\nimport FormInstruction from '../internal/FormInstruction';\nimport { UIElementProps } from '../internal/UIElement/types';\n\ninterface PersonalDetailsConfiguration extends UIElementProps {\n showFormInstruction?: boolean;\n}\n\nexport class PersonalDetailsElement extends UIElement<PersonalDetailsConfiguration> {\n public static type = TxVariants.personal_details;\n\n protected static defaultProps = {\n showFormInstruction: true\n };\n\n get data() {\n return this.state.data;\n }\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n {this.props.showFormInstruction && <FormInstruction />}\n <PersonalDetails\n setComponentRef={this.setComponentRef}\n {...this.props}\n onChange={this.setState}\n {...(process.env.NODE_ENV !== 'production' && { payButton: this.payButton })}\n />\n </CoreProvider>\n );\n }\n}\n\nexport default PersonalDetailsElement;\n"],"names":["PersonalDetailsElement","UIElement","static","TxVariants","personal_details","showFormInstruction","data","this","state","isValid","render","h","CoreProvider","i18n","props","loadingContext","resources","FormInstruction","PersonalDetails","setComponentRef","onChange","setState"],"mappings":"iXAYO,MAAMA,UAA+BC,EACxCC,YAAqBC,EAAWC,iBAEhCF,oBAAgC,CAC5BG,qBAAqB,GAGzB,QAAIC,GACA,OAAOC,KAAKC,MAAMF,IACtB,CAEA,WAAIG,GACA,QAASF,KAAKC,MAAMC,OACxB,CAEAC,MAAAA,GACI,OACIC,EAACC,EAAAA,CAAaC,KAAMN,KAAKO,MAAMD,KAAME,eAAgBR,KAAKO,MAAMC,eAAgBC,UAAWT,KAAKS,WAC3FT,KAAKO,MAAMT,qBAAuBM,EAACM,QACpCN,EAACO,EAAAA,CACGC,gBAAiBZ,KAAKY,mBAClBZ,KAAKO,MACTM,SAAUb,KAAKc,aACV,IAIrB"}
1
+ {"version":3,"file":"PersonalDetails.js","sources":["../../../../src/components/PersonalDetails/PersonalDetails.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport PersonalDetails from '../internal/PersonalDetails';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport { TxVariants } from '../tx-variants';\nimport FormInstruction from '../internal/FormInstruction';\nimport { UIElementProps } from '../internal/UIElement/types';\n\ninterface PersonalDetailsConfiguration extends UIElementProps {\n showFormInstruction?: boolean;\n}\n\nexport class PersonalDetailsElement extends UIElement<PersonalDetailsConfiguration> {\n public static type = TxVariants.personal_details;\n\n protected static defaultProps = {\n showFormInstruction: true\n };\n\n get data() {\n return this.state.data;\n }\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n {this.props.showFormInstruction && <FormInstruction />}\n <PersonalDetails\n setComponentRef={this.setComponentRef}\n {...this.props}\n onChange={this.setState}\n {...(process.env.NODE_ENV !== 'production' && { payButton: this.payButton })}\n />\n </CoreProvider>\n );\n }\n}\n\nexport default PersonalDetailsElement;\n"],"names":["PersonalDetailsElement","UIElement","static","TxVariants","personal_details","showFormInstruction","data","this","state","isValid","render","h","CoreProvider","i18n","props","loadingContext","resources","FormInstruction","PersonalDetails","setComponentRef","onChange","setState"],"mappings":"iXAYO,MAAMA,UAA+BC,EACxCC,YAAqBC,EAAWC,iBAEhCF,oBAAgC,CAC5BG,qBAAqB,GAGzB,QAAIC,GACA,OAAOC,KAAKC,MAAMF,IACtB,CAEA,WAAIG,GACA,QAASF,KAAKC,MAAMC,OACxB,CAEAC,MAAAA,GACI,OACIC,EAACC,EAAAA,CAAaC,KAAMN,KAAKO,MAAMD,KAAME,eAAgBR,KAAKO,MAAMC,eAAgBC,UAAWT,KAAKS,WAC3FT,KAAKO,MAAMT,qBAAuBM,EAACM,QACpCN,EAACO,EAAAA,CACGC,gBAAiBZ,KAAKY,mBAClBZ,KAAKO,MACTM,SAAUb,KAAKc,WAK/B"}
@@ -1,2 +1,2 @@
1
- import{createElement as e,Fragment as t}from"../../../external/preact/dist/preact.js";import{useRef as s,useMemo as o,useState as r,useCallback as a,useEffect as n}from"../../../external/preact/hooks/dist/hooks.js";import i from"../FormFields/Fieldset/Fieldset.js";import l from"./components/ReadOnlyAddress.js";import{getAddressValidationRules as d}from"./validate.js";import{addressFormatters as c,countrySpecificFormatters as u}from"./validate.formats.js";import m from"./components/FieldContainer.js";import p from"../../../utils/useForm/useForm.js";import f from"./Specifications.js";import{FALLBACK_VALUE as y,ADDRESS_SCHEMA as F}from"./constants.js";import{getMaxLengthByFieldAndCountry as h}from"../../../utils/validator-utils.js";import{useCoreContext as C}from"../../../core/Context/CoreProvider.js";import g from"./components/AddressSearch.js";function A(A){const{i18n:v}=C(),{label:b="",requiredFields:j,visibility:x,iOSFocusedField:S=null,showContextualElement:k}=A,M=s({});Object.keys(M.current).length||A.setComponentRef?.(M.current);const O=o((()=>new f(A.specifications)),[A.specifications]),w=O.getAddressSchemaForCountryFlat(A.countryCode).filter((e=>j.includes(e))),[D,E]=r(!1),[B,N]=r(!1),[P,L]=r(""),R=!!A.onAddressLookup,V=!A.onAddressLookup||(D||B),{data:q,errors:H,valid:T,isValid:_,handleChangeFor:I,triggerValidation:$,setData:z}=p({schema:w,defaultData:A.data,rules:{...d(O),...A.validationRules},formatters:c}),G=a((e=>{F.forEach((t=>{const s=e[t];null!=s&&z(t,String(s))})),$(),E(!0)}),[E,$,z]),J=a((()=>{N(!0)}),[]);M.current.showValidation=()=>{$(),L(!R||V||_?"":v.get("address.errors.incomplete"))};const K=w.filter((e=>!S||e===S));if(n((()=>{const e=O.countryHasDataset(q.country)?"":y,t={...q,stateOrProvince:e};j.forEach((e=>{I(e,"input")(t[e]??"")})),t.postalCode&&I("postalCode","blur")(q.postalCode)}),[q.country]),n((()=>{const e=j.includes("stateOrProvince"),t=q.country&&O.countryHasDataset(q.country),s=e&&t,o=q.stateOrProvince||(s?"":y);I("stateOrProvince","input")(o)}),[]),n((()=>{const e=O.getOptionalFieldsForCountry(q.country),t=F.reduce(((t,s)=>{const o=e.includes(s),r=j.includes(s),a=q[s],n=A.data[s],i=o&&!a||!r?r||a||!n?y:n:a;return i?.length&&(t[s]=i),t}),{});A.onChange({data:t,valid:T,errors:H,isValid:_})}),[q,T,H,_]),"hidden"===x)return null;if("readOnly"===x)return e(l,{data:q,label:b});const Q=(t,{classNameModifiers:s=[]})=>j.includes(t)?e(m,{key:t,allowedCountries:A.allowedCountries,classNameModifiers:[...s,t],data:q,errors:H,valid:T,fieldName:t,onInput:I(t,"input"),onBlur:I(t,"blur"),onDropdownChange:I(t,"blur"),specifications:O,maxLength:h(u,t,q.country,!0),trimOnBlur:!0,disabled:!K.includes(t),onFieldFocusAnalytics:A.onFieldFocusAnalytics,onFieldBlurAnalytics:A.onFieldBlurAnalytics}):null,U=O.getAddressSchemaForCountry(q.country);return e(t,null,e(i,{classNameModifiers:[b||"address"],label:b},R&&e(g,{onAddressLookup:A.onAddressLookup,onAddressSelected:A.onAddressSelected,onSelect:G,onManualAddress:J,externalErrorMessage:P,hideManualButton:V,showContextualElement:k,contextualText:v.get("address.search.contextualText"),addressSearchDebounceMs:A.addressSearchDebounceMs}),V&&e(t,null,U.map((t=>t instanceof Array?e("div",{className:"adyen-checkout__field-group"},t.map((([e,t])=>Q(e,{classNameModifiers:[`col-${t}`]})))):Q(t,{}))))))}A.defaultProps={countryCode:null,validationRules:null,data:{},onChange:()=>{},visibility:"editable",requiredFields:F,specifications:{},onFieldFocusAnalytics:()=>{},onFieldBlurAnalytics:()=>{}};export{A as default};
1
+ import{createElement as e,Fragment as t}from"../../../external/preact/dist/preact.js";import{useRef as s,useMemo as o,useState as r,useCallback as a,useEffect as n}from"../../../external/preact/hooks/dist/hooks.js";import i from"../FormFields/Fieldset/Fieldset.js";import l from"./components/ReadOnlyAddress.js";import{getAddressValidationRules as d}from"./validate.js";import{addressFormatters as c,countrySpecificFormatters as u}from"./validate.formats.js";import m from"./components/FieldContainer.js";import p from"../../../utils/useForm/useForm.js";import f from"./Specifications.js";import{FALLBACK_VALUE as y,ADDRESS_SCHEMA as F}from"./constants.js";import{getMaxLengthByFieldAndCountry as h}from"../../../utils/validator-utils.js";import{useCoreContext as C}from"../../../core/Context/CoreProvider.js";import g from"./components/AddressSearch.js";function A(A){const{i18n:v}=C(),{label:b="",requiredFields:j,visibility:x,iOSFocusedField:S=null,showContextualElement:k}=A,M=s({});Object.keys(M.current).length||A.setComponentRef?.(M.current);const O=o((()=>new f(A.specifications)),[A.specifications]),w=O.getAddressSchemaForCountryFlat(A.countryCode).filter((e=>j.includes(e))),[D,E]=r(!1),[B,N]=r(!1),[P,L]=r(""),R=!!A.onAddressLookup,V=!A.onAddressLookup||(D||B),{data:q,errors:H,valid:T,isValid:_,handleChangeFor:I,triggerValidation:$,setData:z}=p({schema:w,defaultData:A.data,rules:{...d(O),...A.validationRules},formatters:c}),G=a((e=>{F.forEach((t=>{const s=e[t];null!=s&&z(t,String(s))})),$(),E(!0)}),[E,$,z]),J=a((()=>{N(!0)}),[]);M.current.showValidation=()=>{$(),L(!R||V||_?"":v.get("address.errors.incomplete"))};const K=w.filter((e=>!S||e===S));if(n((()=>{const e=O.countryHasDataset(q.country)?"":y,t={...q,stateOrProvince:e};j.forEach((e=>{I(e,"input")(t[e]??"")})),t.postalCode&&I("postalCode","blur")(q.postalCode)}),[q.country]),n((()=>{const e=j.includes("stateOrProvince"),t=q.country&&O.countryHasDataset(q.country),s=e&&t,o=q.stateOrProvince||(s?"":y);I("stateOrProvince","input")(o)}),[]),n((()=>{const e=O.getOptionalFieldsForCountry(q.country),t=F.reduce(((t,s)=>{const o=e.includes(s),r=j.includes(s),a=q[s],n=A.data[s],i=o&&!a||!r?r||a||!n?y:n:a;return i?.length&&(t[s]=i),t}),{});A.onChange({data:t,valid:T,errors:H,isValid:_})}),[q,T,H,_]),"hidden"===x)return null;if("readOnly"===x)return e(l,{data:q,label:b});const Q=(t,{classNameModifiers:s=[]})=>j.includes(t)?e(m,{key:t,allowedCountries:A.allowedCountries,classNameModifiers:[...s,t],data:q,errors:H,valid:T,fieldName:t,onInput:I(t,"input"),onBlur:I(t,"blur"),onDropdownChange:I(t,"blur"),specifications:O,maxLength:h(u,t,q.country),trimOnBlur:!0,disabled:!K.includes(t),onFieldFocusAnalytics:A.onFieldFocusAnalytics,onFieldBlurAnalytics:A.onFieldBlurAnalytics}):null,U=O.getAddressSchemaForCountry(q.country);return e(t,null,e(i,{classNameModifiers:[b||"address"],label:b},R&&e(g,{onAddressLookup:A.onAddressLookup,onAddressSelected:A.onAddressSelected,onSelect:G,onManualAddress:J,externalErrorMessage:P,hideManualButton:V,showContextualElement:k,contextualText:v.get("address.search.contextualText"),addressSearchDebounceMs:A.addressSearchDebounceMs}),V&&e(t,null,U.map((t=>t instanceof Array?e("div",{className:"adyen-checkout__field-group"},t.map((([e,t])=>Q(e,{classNameModifiers:[`col-${t}`]})))):Q(t,{}))))))}A.defaultProps={countryCode:null,validationRules:null,data:{},onChange:()=>{},visibility:"editable",requiredFields:F,specifications:{},onFieldFocusAnalytics:()=>{},onFieldBlurAnalytics:()=>{}};export{A as default};
2
2
  //# sourceMappingURL=Address.js.map