@adyen/adyen-web 6.44.0 → 6.45.1

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 (313) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/adyen.css +17 -17
  3. package/dist/cjs/adyen.css.map +1 -1
  4. package/dist/cjs/index.cjs +2 -2
  5. package/dist/cjs/index.cjs.map +1 -1
  6. package/dist/cjs/index.d.cts +2001 -1879
  7. package/dist/es/adyen.css +17 -17
  8. package/dist/es/adyen.css.map +1 -1
  9. package/dist/es/components/ANCV/components/ANCVInput.js +1 -1
  10. package/dist/es/components/ANCV/components/ANCVInput.js.map +1 -1
  11. package/dist/es/components/Ach/Ach.js +1 -1
  12. package/dist/es/components/Ach/Ach.js.map +1 -1
  13. package/dist/es/components/Ach/components/AchComponent.js +1 -1
  14. package/dist/es/components/Ach/components/AchComponent.js.map +1 -1
  15. package/dist/es/components/AmazonPay/AmazonPay.js +1 -1
  16. package/dist/es/components/AmazonPay/AmazonPay.js.map +1 -1
  17. package/dist/es/components/BacsDD/BacsDD.js +1 -1
  18. package/dist/es/components/BacsDD/BacsDD.js.map +1 -1
  19. package/dist/es/components/BacsDD/components/BacsInput.js +1 -1
  20. package/dist/es/components/BacsDD/components/BacsInput.js.map +1 -1
  21. package/dist/es/components/BankTransfer/BankTransfer.js +1 -1
  22. package/dist/es/components/BankTransfer/BankTransfer.js.map +1 -1
  23. package/dist/es/components/BankTransfer/components/BankTransferInput/BankTransferInput.js +1 -1
  24. package/dist/es/components/BankTransfer/components/BankTransferInput/BankTransferInput.js.map +1 -1
  25. package/dist/es/components/Blik/Blik.js +1 -1
  26. package/dist/es/components/Blik/Blik.js.map +1 -1
  27. package/dist/es/components/Blik/components/BlikInput.js +1 -1
  28. package/dist/es/components/Blik/components/BlikInput.js.map +1 -1
  29. package/dist/es/components/Card/Card.js +1 -1
  30. package/dist/es/components/Card/Card.js.map +1 -1
  31. package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
  32. package/dist/es/components/Card/components/ClickToPayHolder.js.map +1 -1
  33. package/dist/es/components/Card/components/ClickToPayWrapper.js +1 -1
  34. package/dist/es/components/Card/components/ClickToPayWrapper.js.map +1 -1
  35. package/dist/es/components/CashAppPay/CashAppPay.js +1 -1
  36. package/dist/es/components/CashAppPay/CashAppPay.js.map +1 -1
  37. package/dist/es/components/CustomCard/CustomCard.js +1 -1
  38. package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
  39. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  40. package/dist/es/components/Donation/Donation.js +1 -1
  41. package/dist/es/components/Donation/Donation.js.map +1 -1
  42. package/dist/es/components/Donation/DonationCampaignService.js +1 -1
  43. package/dist/es/components/Donation/DonationCampaignService.js.map +1 -1
  44. package/dist/es/components/Donation/components/DonationComponent.js +1 -1
  45. package/dist/es/components/Donation/components/DonationComponent.js.map +1 -1
  46. package/dist/es/components/Dropin/Dropin.js +1 -1
  47. package/dist/es/components/Dropin/Dropin.js.map +1 -1
  48. package/dist/es/components/Dropin/components/DropinComponent.js.map +1 -1
  49. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodDetails.js +1 -1
  50. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodDetails.js.map +1 -1
  51. package/dist/es/components/Giftcard/Giftcard.js +1 -1
  52. package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
  53. package/dist/es/components/Giftcard/components/GiftcardComponent.js +1 -1
  54. package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  55. package/dist/es/components/Giropay/Giropay.js +1 -1
  56. package/dist/es/components/Giropay/Giropay.js.map +1 -1
  57. package/dist/es/components/GooglePay/GooglePay.js +1 -1
  58. package/dist/es/components/GooglePay/GooglePay.js.map +1 -1
  59. package/dist/es/components/GooglePay/GooglePayService.js +1 -1
  60. package/dist/es/components/GooglePay/GooglePayService.js.map +1 -1
  61. package/dist/es/components/Klarna/KlarnaPayments.js +1 -1
  62. package/dist/es/components/Klarna/KlarnaPayments.js.map +1 -1
  63. package/dist/es/components/MBWay/MBWay.js +1 -1
  64. package/dist/es/components/MBWay/MBWay.js.map +1 -1
  65. package/dist/es/components/MBWay/components/MBWayInput/MBWayInput.js +1 -1
  66. package/dist/es/components/MBWay/components/MBWayInput/MBWayInput.js.map +1 -1
  67. package/dist/es/components/Multibanco/Multibanco.js +1 -1
  68. package/dist/es/components/Multibanco/Multibanco.js.map +1 -1
  69. package/dist/es/components/PayByBankPix/PayByBankPix.js +1 -1
  70. package/dist/es/components/PayByBankPix/PayByBankPix.js.map +1 -1
  71. package/dist/es/components/PayByBankUS/PayByBankUS.js +1 -1
  72. package/dist/es/components/PayByBankUS/PayByBankUS.js.map +1 -1
  73. package/dist/es/components/PayTo/PayTo.js +1 -1
  74. package/dist/es/components/PayTo/PayTo.js.map +1 -1
  75. package/dist/es/components/PayTo/components/BSBInput.js +1 -1
  76. package/dist/es/components/PayTo/components/BSBInput.js.map +1 -1
  77. package/dist/es/components/PayTo/components/PayToNameFields.js +1 -1
  78. package/dist/es/components/PayTo/components/PayToNameFields.js.map +1 -1
  79. package/dist/es/components/PayTo/components/PayToPhone.js +1 -1
  80. package/dist/es/components/PayTo/components/PayToPhone.js.map +1 -1
  81. package/dist/es/components/Pix/Pix.js +1 -1
  82. package/dist/es/components/Pix/Pix.js.map +1 -1
  83. package/dist/es/components/Pix/components/PixInput/PixInput.js +1 -1
  84. package/dist/es/components/Pix/components/PixInput/PixInput.js.map +1 -1
  85. package/dist/es/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js +1 -1
  86. package/dist/es/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js.map +1 -1
  87. package/dist/es/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js +1 -1
  88. package/dist/es/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js.map +1 -1
  89. package/dist/es/components/Redirect/Redirect.js +1 -1
  90. package/dist/es/components/Redirect/Redirect.js.map +1 -1
  91. package/dist/es/components/Sepa/Sepa.js.map +1 -1
  92. package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  93. package/dist/es/components/Trustly/Trustly.js +1 -1
  94. package/dist/es/components/Trustly/Trustly.js.map +1 -1
  95. package/dist/es/components/Twint/Twint.js +1 -1
  96. package/dist/es/components/Twint/Twint.js.map +1 -1
  97. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
  98. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  99. package/dist/es/components/helpers/QRLoaderContainer/QRLoaderContainer.js +1 -1
  100. package/dist/es/components/helpers/QRLoaderContainer/QRLoaderContainer.js.map +1 -1
  101. package/dist/es/components/internal/Address/Specifications.js.map +1 -1
  102. package/dist/es/components/internal/Address/components/AddressSearch.js.map +1 -1
  103. package/dist/es/components/internal/Address/components/FieldContainer.js.map +1 -1
  104. package/dist/es/components/internal/Address/validate.formats.js +1 -1
  105. package/dist/es/components/internal/Address/validate.formats.js.map +1 -1
  106. package/dist/es/components/internal/Address/validate.js +1 -1
  107. package/dist/es/components/internal/Address/validate.js.map +1 -1
  108. package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
  109. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js +1 -1
  110. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js.map +1 -1
  111. package/dist/es/components/internal/ClickToPay/context/ClickToPayProvider.js.map +1 -1
  112. package/dist/es/components/internal/ClickToPay/services/sdks/AbstractSrcInitiator.js.map +1 -1
  113. package/dist/es/components/internal/ClickToPay/services/sdks/MastercardSdk.js.map +1 -1
  114. package/dist/es/components/internal/ClickToPay/services/sdks/VisaSdk.js.map +1 -1
  115. package/dist/es/components/internal/IbanInput/IbanInput.js +1 -1
  116. package/dist/es/components/internal/IbanInput/IbanInput.js.map +1 -1
  117. package/dist/es/components/internal/IbanInput/validate.js +1 -1
  118. package/dist/es/components/internal/IbanInput/validate.js.map +1 -1
  119. package/dist/es/components/internal/OpenInvoice/OpenInvoice.js +1 -1
  120. package/dist/es/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  121. package/dist/es/components/internal/PayButton/PayButton.js +1 -1
  122. package/dist/es/components/internal/PayButton/PayButton.js.map +1 -1
  123. package/dist/es/components/internal/PayButton/utils.js +1 -1
  124. package/dist/es/components/internal/PayButton/utils.js.map +1 -1
  125. package/dist/es/components/internal/PhoneInput/PhoneInputForm.js +1 -1
  126. package/dist/es/components/internal/PhoneInput/PhoneInputForm.js.map +1 -1
  127. package/dist/es/components/internal/RedirectButton/RedirectButton.js +1 -1
  128. package/dist/es/components/internal/RedirectButton/RedirectButton.js.map +1 -1
  129. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  130. package/dist/es/components/internal/UIElement/UIElement.js +1 -1
  131. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  132. package/dist/es/components/internal/UIElement/utils.js +1 -1
  133. package/dist/es/components/internal/UIElement/utils.js.map +1 -1
  134. package/dist/es/core/Analytics/constants.js +1 -1
  135. package/dist/es/core/Analytics/constants.js.map +1 -1
  136. package/dist/es/core/Analytics/events/AnalyticsLogEvent.js +1 -1
  137. package/dist/es/core/Analytics/events/AnalyticsLogEvent.js.map +1 -1
  138. package/dist/es/core/Errors/constants.js +1 -1
  139. package/dist/es/core/Errors/constants.js.map +1 -1
  140. package/dist/es/core/config.js +1 -1
  141. package/dist/es/core/config.js.map +1 -1
  142. package/dist/es/core/core.js +1 -1
  143. package/dist/es/core/core.js.map +1 -1
  144. package/dist/es/core/utils.js +1 -1
  145. package/dist/es/core/utils.js.map +1 -1
  146. package/dist/es/external/preact/compat/dist/compat.js.map +1 -1
  147. package/dist/es/external/preact/dist/preact.js +1 -1
  148. package/dist/es/external/preact/dist/preact.js.map +1 -1
  149. package/dist/es/index.d.ts +2001 -1879
  150. package/dist/es/utils/Validator/Validator.js +1 -1
  151. package/dist/es/utils/Validator/Validator.js.map +1 -1
  152. package/dist/es/utils/useForm/reducer.js +1 -1
  153. package/dist/es/utils/useForm/reducer.js.map +1 -1
  154. package/dist/es/utils/useForm/useForm.js +1 -1
  155. package/dist/es/utils/useForm/useForm.js.map +1 -1
  156. package/dist/es/utils/useForm/useFormWithA11y.js +1 -1
  157. package/dist/es/utils/useForm/useFormWithA11y.js.map +1 -1
  158. package/dist/es/utils/validator-utils.js +1 -1
  159. package/dist/es/utils/validator-utils.js.map +1 -1
  160. package/dist/es-legacy/adyen.css +17 -17
  161. package/dist/es-legacy/adyen.css.map +1 -1
  162. package/dist/es-legacy/components/ANCV/components/ANCVInput.js +1 -1
  163. package/dist/es-legacy/components/ANCV/components/ANCVInput.js.map +1 -1
  164. package/dist/es-legacy/components/Ach/Ach.js +1 -1
  165. package/dist/es-legacy/components/Ach/Ach.js.map +1 -1
  166. package/dist/es-legacy/components/Ach/components/AchComponent.js +1 -1
  167. package/dist/es-legacy/components/Ach/components/AchComponent.js.map +1 -1
  168. package/dist/es-legacy/components/AmazonPay/AmazonPay.js +1 -1
  169. package/dist/es-legacy/components/AmazonPay/AmazonPay.js.map +1 -1
  170. package/dist/es-legacy/components/BacsDD/BacsDD.js +1 -1
  171. package/dist/es-legacy/components/BacsDD/BacsDD.js.map +1 -1
  172. package/dist/es-legacy/components/BacsDD/components/BacsInput.js +1 -1
  173. package/dist/es-legacy/components/BacsDD/components/BacsInput.js.map +1 -1
  174. package/dist/es-legacy/components/BankTransfer/BankTransfer.js +1 -1
  175. package/dist/es-legacy/components/BankTransfer/BankTransfer.js.map +1 -1
  176. package/dist/es-legacy/components/BankTransfer/components/BankTransferInput/BankTransferInput.js +1 -1
  177. package/dist/es-legacy/components/BankTransfer/components/BankTransferInput/BankTransferInput.js.map +1 -1
  178. package/dist/es-legacy/components/Blik/Blik.js +1 -1
  179. package/dist/es-legacy/components/Blik/Blik.js.map +1 -1
  180. package/dist/es-legacy/components/Blik/components/BlikInput.js +1 -1
  181. package/dist/es-legacy/components/Blik/components/BlikInput.js.map +1 -1
  182. package/dist/es-legacy/components/Card/Card.js +1 -1
  183. package/dist/es-legacy/components/Card/Card.js.map +1 -1
  184. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  185. package/dist/es-legacy/components/Card/components/ClickToPayHolder.js.map +1 -1
  186. package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js +1 -1
  187. package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js.map +1 -1
  188. package/dist/es-legacy/components/CashAppPay/CashAppPay.js +1 -1
  189. package/dist/es-legacy/components/CashAppPay/CashAppPay.js.map +1 -1
  190. package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
  191. package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
  192. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  193. package/dist/es-legacy/components/Donation/Donation.js +1 -1
  194. package/dist/es-legacy/components/Donation/Donation.js.map +1 -1
  195. package/dist/es-legacy/components/Donation/DonationCampaignService.js +1 -1
  196. package/dist/es-legacy/components/Donation/DonationCampaignService.js.map +1 -1
  197. package/dist/es-legacy/components/Donation/components/DonationComponent.js +1 -1
  198. package/dist/es-legacy/components/Donation/components/DonationComponent.js.map +1 -1
  199. package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
  200. package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
  201. package/dist/es-legacy/components/Dropin/components/DropinComponent.js.map +1 -1
  202. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodDetails.js +1 -1
  203. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodDetails.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/Giropay/Giropay.js +1 -1
  209. package/dist/es-legacy/components/Giropay/Giropay.js.map +1 -1
  210. package/dist/es-legacy/components/GooglePay/GooglePay.js +1 -1
  211. package/dist/es-legacy/components/GooglePay/GooglePay.js.map +1 -1
  212. package/dist/es-legacy/components/GooglePay/GooglePayService.js +1 -1
  213. package/dist/es-legacy/components/GooglePay/GooglePayService.js.map +1 -1
  214. package/dist/es-legacy/components/Klarna/KlarnaPayments.js +1 -1
  215. package/dist/es-legacy/components/Klarna/KlarnaPayments.js.map +1 -1
  216. package/dist/es-legacy/components/MBWay/MBWay.js +1 -1
  217. package/dist/es-legacy/components/MBWay/MBWay.js.map +1 -1
  218. package/dist/es-legacy/components/MBWay/components/MBWayInput/MBWayInput.js +1 -1
  219. package/dist/es-legacy/components/MBWay/components/MBWayInput/MBWayInput.js.map +1 -1
  220. package/dist/es-legacy/components/Multibanco/Multibanco.js +1 -1
  221. package/dist/es-legacy/components/Multibanco/Multibanco.js.map +1 -1
  222. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js +1 -1
  223. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js.map +1 -1
  224. package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js +1 -1
  225. package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js.map +1 -1
  226. package/dist/es-legacy/components/PayTo/PayTo.js +1 -1
  227. package/dist/es-legacy/components/PayTo/PayTo.js.map +1 -1
  228. package/dist/es-legacy/components/PayTo/components/BSBInput.js +1 -1
  229. package/dist/es-legacy/components/PayTo/components/BSBInput.js.map +1 -1
  230. package/dist/es-legacy/components/PayTo/components/PayToNameFields.js +1 -1
  231. package/dist/es-legacy/components/PayTo/components/PayToNameFields.js.map +1 -1
  232. package/dist/es-legacy/components/PayTo/components/PayToPhone.js +1 -1
  233. package/dist/es-legacy/components/PayTo/components/PayToPhone.js.map +1 -1
  234. package/dist/es-legacy/components/Pix/Pix.js +1 -1
  235. package/dist/es-legacy/components/Pix/Pix.js.map +1 -1
  236. package/dist/es-legacy/components/Pix/components/PixInput/PixInput.js +1 -1
  237. package/dist/es-legacy/components/Pix/components/PixInput/PixInput.js.map +1 -1
  238. package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js +1 -1
  239. package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js.map +1 -1
  240. package/dist/es-legacy/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js +1 -1
  241. package/dist/es-legacy/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js.map +1 -1
  242. package/dist/es-legacy/components/Redirect/Redirect.js +1 -1
  243. package/dist/es-legacy/components/Redirect/Redirect.js.map +1 -1
  244. package/dist/es-legacy/components/Sepa/Sepa.js.map +1 -1
  245. package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  246. package/dist/es-legacy/components/Trustly/Trustly.js +1 -1
  247. package/dist/es-legacy/components/Trustly/Trustly.js.map +1 -1
  248. package/dist/es-legacy/components/Twint/Twint.js +1 -1
  249. package/dist/es-legacy/components/Twint/Twint.js.map +1 -1
  250. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
  251. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  252. package/dist/es-legacy/components/helpers/QRLoaderContainer/QRLoaderContainer.js +1 -1
  253. package/dist/es-legacy/components/helpers/QRLoaderContainer/QRLoaderContainer.js.map +1 -1
  254. package/dist/es-legacy/components/internal/Address/Specifications.js.map +1 -1
  255. package/dist/es-legacy/components/internal/Address/components/AddressSearch.js.map +1 -1
  256. package/dist/es-legacy/components/internal/Address/components/FieldContainer.js.map +1 -1
  257. package/dist/es-legacy/components/internal/Address/validate.formats.js +1 -1
  258. package/dist/es-legacy/components/internal/Address/validate.formats.js.map +1 -1
  259. package/dist/es-legacy/components/internal/Address/validate.js +1 -1
  260. package/dist/es-legacy/components/internal/Address/validate.js.map +1 -1
  261. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
  262. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js +1 -1
  263. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js.map +1 -1
  264. package/dist/es-legacy/components/internal/ClickToPay/context/ClickToPayProvider.js.map +1 -1
  265. package/dist/es-legacy/components/internal/ClickToPay/services/sdks/AbstractSrcInitiator.js.map +1 -1
  266. package/dist/es-legacy/components/internal/ClickToPay/services/sdks/MastercardSdk.js.map +1 -1
  267. package/dist/es-legacy/components/internal/ClickToPay/services/sdks/VisaSdk.js.map +1 -1
  268. package/dist/es-legacy/components/internal/IbanInput/IbanInput.js +1 -1
  269. package/dist/es-legacy/components/internal/IbanInput/IbanInput.js.map +1 -1
  270. package/dist/es-legacy/components/internal/IbanInput/validate.js +1 -1
  271. package/dist/es-legacy/components/internal/IbanInput/validate.js.map +1 -1
  272. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js +1 -1
  273. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  274. package/dist/es-legacy/components/internal/PayButton/PayButton.js +1 -1
  275. package/dist/es-legacy/components/internal/PayButton/PayButton.js.map +1 -1
  276. package/dist/es-legacy/components/internal/PayButton/utils.js +1 -1
  277. package/dist/es-legacy/components/internal/PayButton/utils.js.map +1 -1
  278. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js +1 -1
  279. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js.map +1 -1
  280. package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js +1 -1
  281. package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js.map +1 -1
  282. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  283. package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
  284. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  285. package/dist/es-legacy/components/internal/UIElement/utils.js +1 -1
  286. package/dist/es-legacy/components/internal/UIElement/utils.js.map +1 -1
  287. package/dist/es-legacy/core/Analytics/constants.js +1 -1
  288. package/dist/es-legacy/core/Analytics/constants.js.map +1 -1
  289. package/dist/es-legacy/core/Analytics/events/AnalyticsLogEvent.js +1 -1
  290. package/dist/es-legacy/core/Analytics/events/AnalyticsLogEvent.js.map +1 -1
  291. package/dist/es-legacy/core/Errors/constants.js +1 -1
  292. package/dist/es-legacy/core/Errors/constants.js.map +1 -1
  293. package/dist/es-legacy/core/config.js +1 -1
  294. package/dist/es-legacy/core/config.js.map +1 -1
  295. package/dist/es-legacy/core/core.js +1 -1
  296. package/dist/es-legacy/core/core.js.map +1 -1
  297. package/dist/es-legacy/core/utils.js +1 -1
  298. package/dist/es-legacy/core/utils.js.map +1 -1
  299. package/dist/es-legacy/external/preact/compat/dist/compat.js.map +1 -1
  300. package/dist/es-legacy/external/preact/dist/preact.js +1 -1
  301. package/dist/es-legacy/external/preact/dist/preact.js.map +1 -1
  302. package/dist/es-legacy/utils/Validator/Validator.js +1 -1
  303. package/dist/es-legacy/utils/Validator/Validator.js.map +1 -1
  304. package/dist/es-legacy/utils/useForm/reducer.js +1 -1
  305. package/dist/es-legacy/utils/useForm/reducer.js.map +1 -1
  306. package/dist/es-legacy/utils/useForm/useForm.js +1 -1
  307. package/dist/es-legacy/utils/useForm/useForm.js.map +1 -1
  308. package/dist/es-legacy/utils/useForm/useFormWithA11y.js +1 -1
  309. package/dist/es-legacy/utils/useForm/useFormWithA11y.js.map +1 -1
  310. package/dist/es-legacy/utils/validator-utils.js +1 -1
  311. package/dist/es-legacy/utils/validator-utils.js.map +1 -1
  312. package/package.json +22 -22
  313. package/styles/adyen.css +17 -17
@@ -1 +1 @@
1
- {"version":3,"file":"Trustly.js","sources":["../../../../src/components/Trustly/Trustly.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport RedirectElement from '../Redirect';\nimport RedirectButton from '../internal/RedirectButton';\nimport { TxVariants } from '../tx-variants';\nimport './Trustly.scss';\n\nclass TrustlyElement extends RedirectElement {\n public static override readonly type: TxVariants = TxVariants.trustly;\n\n override get displayName() {\n return this.props.name || this.constructor['type'];\n }\n\n protected override componentToRender(): h.JSX.Element {\n return (\n <Fragment>\n <div className=\"adyen-checkout-trustly\">\n <p className=\"adyen-checkout-trustly__descriptor\">{this.props.i18n.get('trustly.descriptor')}</p>\n <ul className=\"adyen-checkout-trustly__description-list\">\n <li>{this.props.i18n.get('trustly.description1')}</li>\n <li>{this.props.i18n.get('trustly.description2')}</li>\n </ul>\n </div>\n\n {this.props.showPayButton && (\n <RedirectButton\n {...this.props}\n showPayButton={this.props.showPayButton}\n name={this.displayName}\n onSubmit={this.submit}\n payButton={this.payButton}\n ref={ref => {\n this.componentRef = ref;\n }}\n />\n )}\n </Fragment>\n );\n }\n}\n\nexport default TrustlyElement;\n"],"names":["TrustlyElement","RedirectElement","displayName","this","props","name","constructor","componentToRender","h","Fragment","div","className","p","i18n","get","ul","li","showPayButton","RedirectButton","onSubmit","submit","payButton","ref","componentRef","type","TxVariants","trustly"],"mappings":"qOAMA,MAAMA,UAAuBC,EAGzB,eAAaC,GACT,OAAOC,KAAKC,MAAMC,MAAQF,KAAKG,YAAY,IAC/C,CAEmBC,iBAAAA,GACf,OACIC,EAACC,OACGD,EAACE,MAAAA,CAAIC,UAAU,0BACXH,EAACI,IAAAA,CAAED,UAAU,sCAAsCR,KAAKC,MAAMS,KAAKC,IAAI,uBACvEN,EAACO,KAAAA,CAAGJ,UAAU,4CACVH,EAACQ,KAAAA,KAAIb,KAAKC,MAAMS,KAAKC,IAAI,yBACzBN,EAACQ,KAAAA,KAAIb,KAAKC,MAAMS,KAAKC,IAAI,2BAIhCX,KAAKC,MAAMa,eACRT,EAACU,EAAAA,IACOf,KAAKC,MACTa,cAAed,KAAKC,MAAMa,cAC1BZ,KAAMF,KAAKD,YACXiB,SAAUhB,KAAKiB,OACfC,UAAWlB,KAAKkB,UAChBC,IAAKA,IACDnB,KAAKoB,aAAeD,KAM5C,cAhCEtB,IAC8BwB,SAAmBC,EAAWC"}
1
+ {"version":3,"file":"Trustly.js","sources":["../../../../src/components/Trustly/Trustly.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport RedirectElement from '../Redirect';\nimport RedirectButton from '../internal/RedirectButton';\nimport { TxVariants } from '../tx-variants';\nimport './Trustly.scss';\n\nclass TrustlyElement extends RedirectElement {\n public static override readonly type: TxVariants = TxVariants.trustly;\n\n override get displayName() {\n return this.props.name || this.constructor['type'];\n }\n\n protected override componentToRender(): h.JSX.Element {\n return (\n <Fragment>\n <div className=\"adyen-checkout-trustly\">\n <p className=\"adyen-checkout-trustly__descriptor\">{this.props.i18n.get('trustly.descriptor')}</p>\n <ul className=\"adyen-checkout-trustly__description-list\">\n <li>{this.props.i18n.get('trustly.description1')}</li>\n <li>{this.props.i18n.get('trustly.description2')}</li>\n </ul>\n </div>\n\n {this.props.showPayButton && (\n <RedirectButton\n {...this.props}\n showPayButton={this.props.showPayButton}\n name={this.displayName}\n onSubmit={this.submit}\n payButton={this.payButton}\n setComponentRef={this.setComponentRef}\n />\n )}\n </Fragment>\n );\n }\n}\n\nexport default TrustlyElement;\n"],"names":["TrustlyElement","RedirectElement","displayName","this","props","name","constructor","componentToRender","h","Fragment","div","className","p","i18n","get","ul","li","showPayButton","RedirectButton","onSubmit","submit","payButton","setComponentRef","type","TxVariants","trustly"],"mappings":"qOAMA,MAAMA,UAAuBC,EAGzB,eAAaC,GACT,OAAOC,KAAKC,MAAMC,MAAQF,KAAKG,YAAY,IAC/C,CAEmBC,iBAAAA,GACf,OACIC,EAACC,OACGD,EAACE,MAAAA,CAAIC,UAAU,0BACXH,EAACI,IAAAA,CAAED,UAAU,sCAAsCR,KAAKC,MAAMS,KAAKC,IAAI,uBACvEN,EAACO,KAAAA,CAAGJ,UAAU,4CACVH,EAACQ,KAAAA,KAAIb,KAAKC,MAAMS,KAAKC,IAAI,yBACzBN,EAACQ,KAAAA,KAAIb,KAAKC,MAAMS,KAAKC,IAAI,2BAIhCX,KAAKC,MAAMa,eACRT,EAACU,EAAAA,IACOf,KAAKC,MACTa,cAAed,KAAKC,MAAMa,cAC1BZ,KAAMF,KAAKD,YACXiB,SAAUhB,KAAKiB,OACfC,UAAWlB,KAAKkB,UAChBC,gBAAiBnB,KAAKmB,kBAK1C,cA9BEtB,IAC8BuB,SAAmBC,EAAWC"}
@@ -1,2 +1,2 @@
1
- import t from"../Redirect/Redirect.js";import e from"../internal/PayButton/PayButton.js";import{payAmountLabel as n}from"../internal/PayButton/utils.js";import{createElement as r}from"../../external/preact/dist/preact.js";import{TxVariants as o}from"../tx-variants.js";function a(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class i extends t{get displayName(){const{i18n:t,name:e,isStoredPaymentMethod:n}=this.props;return n?`${e} ${t.get("twint.saved")}`:e||this.constructor.type}payButtonLabel(){const{i18n:t,amount:e,isStoredPaymentMethod:r,name:o}=this.props;return r?n(t,e):`${t.get("continueTo")} ${o}`}constructor(...t){super(...t),a(this,"payButton",t=>r(e,{...t,label:this.payButtonLabel(),onClick:this.submit}))}}a(i,"type",o.twint),a(i,"defaultProps",{type:i.type,name:"Twint"});export{i as default};
1
+ import t from"../Redirect/Redirect.js";import e from"../internal/PayButton/PayButton.js";import{payAmountLabel as n}from"../internal/PayButton/utils.js";import{createElement as r}from"../../external/preact/dist/preact.js";import{TxVariants as o}from"../tx-variants.js";function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class a extends t{get displayName(){const{i18n:t,name:e,isStoredPaymentMethod:n}=this.props;return n?`${e} ${t.get("twint.saved")}`:e||this.constructor.type}payButtonLabel(){const{i18n:t,amount:e,isStoredPaymentMethod:r,name:o}=this.props;return r?n(t,e):`${t.get("continueTo")} ${o}`}constructor(...t){super(...t),i(this,"payButton",t=>r(e,{...t,label:this.payButtonLabel(),onClick:this.submit,showReview:!!this.props.onReview}))}}i(a,"type",o.twint),i(a,"defaultProps",{type:a.type,name:"Twint"});export{a as default};
2
2
  //# sourceMappingURL=Twint.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Twint.js","sources":["../../../../src/components/Twint/Twint.tsx"],"sourcesContent":["import RedirectElement from '../Redirect';\nimport PayButton from '../internal/PayButton';\nimport { payAmountLabel } from '../internal/PayButton/utils';\nimport { h } from 'preact';\nimport { TxVariants } from '../tx-variants';\nimport { PayButtonProps } from '../internal/PayButton/PayButton';\n\nclass TwintElement extends RedirectElement {\n public static override readonly type: TxVariants = TxVariants.twint;\n\n public static readonly defaultProps = {\n type: TwintElement.type,\n name: 'Twint'\n };\n /**\n * Get the element displayable name\n */\n get displayName(): string {\n const { i18n, name, isStoredPaymentMethod } = this.props;\n return isStoredPaymentMethod ? `${name} ${i18n.get('twint.saved')}` : name || this.constructor['type'];\n }\n\n public payButtonLabel() {\n const { i18n, amount, isStoredPaymentMethod, name } = this.props;\n if (isStoredPaymentMethod) return payAmountLabel(i18n, amount);\n return `${i18n.get('continueTo')} ${name}`;\n }\n\n /**\n * Overrides RedirectElement default payButton behaviour to use label\n * @param props - props\n */\n protected override payButton = (props: PayButtonProps): h.JSX.Element => {\n return <PayButton {...props} label={this.payButtonLabel()} onClick={this.submit} />;\n };\n}\n\nexport default TwintElement;\n"],"names":["TwintElement","RedirectElement","displayName","i18n","name","isStoredPaymentMethod","this","props","get","constructor","payButtonLabel","amount","payAmountLabel","super","args","_define_property","payButton","h","PayButton","label","onClick","submit","type","TxVariants","twint","defaultProps"],"mappings":"qYAOA,MAAMA,UAAqBC,EAUvB,eAAIC,GACA,MAAMC,KAAEA,EAAIC,KAAEA,EAAIC,sBAAEA,GAA0BC,KAAKC,MACnD,OAAOF,EAAwB,GAAGD,KAAQD,EAAKK,IAAI,iBAAmBJ,GAAQE,KAAKG,YAAY,IACnG,CAEOC,cAAAA,GACH,MAAMP,KAAEA,EAAIQ,OAAEA,EAAMN,sBAAEA,EAAqBD,KAAEA,GAASE,KAAKC,MAC3D,OAAIF,EAA8BO,EAAeT,EAAMQ,GAChD,GAAGR,EAAKK,IAAI,iBAAiBJ,GACxC,mBAnBJS,SAAAC,GAyBIC,EAAAT,KAAmBU,YAAaT,GACrBU,EAACC,EAAAA,IAAcX,EAAOY,MAAOb,KAAKI,iBAAkBU,QAASd,KAAKe,WAzB7EN,EADEf,EAC8BsB,OAAmBC,EAAWC,OAE9DT,EAHEf,EAGqByB,eAAe,CAClCH,KAAMtB,EAAasB,KACnBlB,KAAM"}
1
+ {"version":3,"file":"Twint.js","sources":["../../../../src/components/Twint/Twint.tsx"],"sourcesContent":["import RedirectElement from '../Redirect';\nimport PayButton from '../internal/PayButton';\nimport { payAmountLabel } from '../internal/PayButton/utils';\nimport { h } from 'preact';\nimport { TxVariants } from '../tx-variants';\nimport { PayButtonProps } from '../internal/PayButton/PayButton';\n\nclass TwintElement extends RedirectElement {\n public static override readonly type: TxVariants = TxVariants.twint;\n\n public static readonly defaultProps = {\n type: TwintElement.type,\n name: 'Twint'\n };\n /**\n * Get the element displayable name\n */\n get displayName(): string {\n const { i18n, name, isStoredPaymentMethod } = this.props;\n return isStoredPaymentMethod ? `${name} ${i18n.get('twint.saved')}` : name || this.constructor['type'];\n }\n\n public payButtonLabel() {\n const { i18n, amount, isStoredPaymentMethod, name } = this.props;\n if (isStoredPaymentMethod) return payAmountLabel(i18n, amount);\n return `${i18n.get('continueTo')} ${name}`;\n }\n\n /**\n * Overrides RedirectElement default payButton behaviour to use label\n * @param props - props\n */\n protected override payButton = (props: PayButtonProps): h.JSX.Element => {\n return <PayButton {...props} label={this.payButtonLabel()} onClick={this.submit} showReview={!!this.props.onReview} />;\n };\n}\n\nexport default TwintElement;\n"],"names":["TwintElement","RedirectElement","displayName","i18n","name","isStoredPaymentMethod","this","props","get","constructor","payButtonLabel","amount","payAmountLabel","super","args","_define_property","payButton","h","PayButton","label","onClick","submit","showReview","onReview","type","TxVariants","twint","defaultProps"],"mappings":"qYAOA,MAAMA,UAAqBC,EAUvB,eAAIC,GACA,MAAMC,KAAEA,EAAIC,KAAEA,EAAIC,sBAAEA,GAA0BC,KAAKC,MACnD,OAAOF,EAAwB,GAAGD,KAAQD,EAAKK,IAAI,iBAAmBJ,GAAQE,KAAKG,YAAY,IACnG,CAEOC,cAAAA,GACH,MAAMP,KAAEA,EAAIQ,OAAEA,EAAMN,sBAAEA,EAAqBD,KAAEA,GAASE,KAAKC,MAC3D,OAAIF,EAA8BO,EAAeT,EAAMQ,GAChD,GAAGR,EAAKK,IAAI,iBAAiBJ,GACxC,mBAnBJS,SAAAC,GAyBIC,EAAAT,KAAmBU,YAAaT,GACrBU,EAACC,EAAAA,IAAcX,EAAOY,MAAOb,KAAKI,iBAAkBU,QAASd,KAAKe,OAAQC,aAAchB,KAAKC,MAAMgB,aAzB9GR,EADEf,EAC8BwB,OAAmBC,EAAWC,OAE9DX,EAHEf,EAGqB2B,eAAe,CAClCH,KAAMxB,EAAawB,KACnBpB,KAAM"}
@@ -1,2 +1,2 @@
1
- import{createElement as t}from"../../../external/preact/dist/preact.js";import{UIElement as s}from"../../internal/UIElement/UIElement.js";import e from"../../internal/IssuerList/IssuerList.js";import i from"../../../utils/get-issuer-image.js";import{FALLBACK_CONTEXT as o}from"../../../core/config.js";import r from"../../internal/RedirectButton/RedirectButton.js";class n extends s{formatProps(t){const s=t?.details?.length&&t.details.find(t=>"issuer"===t.key)?.items||t.issuers||[];return{...t,issuers:s}}formatData(){return{paymentMethod:{type:this.type,issuer:this.state?.data?.issuer}}}get isValid(){return 0===this.props.issuers.length||Boolean(this.state?.isValid)}get brands(){return this.props.showPaymentMethodItemImages?this.props.issuers.map(t=>({icon:t.icon,name:t.id})):[]}componentToRender(){return this.props.issuers.length>0?t(e,{items:this.props.issuers,highlightedIds:this.props.highlightedIssuers,...this.props,...this.state,setComponentRef:this.setComponentRef,showImage:this.props.showImage,type:this.constructor.type,onChange:this.setState,onSubmit:this.submit,payButton:this.payButton,contextualText:this.props.i18n.get("issuerList.selectField.contextualText"),onSubmitAnalytics:this.submitAnalytics}):t(r,{showPayButton:this.props.showPayButton,name:this.props.name,...this.props,onSubmit:this.submit,payButton:this.payButton,ref:t=>{this.componentRef=t}})}constructor(t,s){super(t,s);const e=t=>this.resources.getImage(t);if(this.props.showImage){const t=i({loadingContext:this.props.loadingContext},this.constructor.type,e);this.props.issuers=this.props.issuers.map(s=>({...s,icon:t(s.id)}))}}}var a,p,h;h={showImage:!0,issuers:[],highlightedIssuers:[],loadingContext:o,showPaymentMethodItemImages:!1},(p="defaultProps")in(a=n)?Object.defineProperty(a,p,{value:h,enumerable:!0,configurable:!0,writable:!0}):a[p]=h;export{n as default};
1
+ import{createElement as t}from"../../../external/preact/dist/preact.js";import{UIElement as s}from"../../internal/UIElement/UIElement.js";import e from"../../internal/IssuerList/IssuerList.js";import i from"../../../utils/get-issuer-image.js";import{FALLBACK_CONTEXT as o}from"../../../core/config.js";import r from"../../internal/RedirectButton/RedirectButton.js";class n extends s{formatProps(t){const s=t?.details?.length&&t.details.find(t=>"issuer"===t.key)?.items||t.issuers||[];return{...t,issuers:s}}formatData(){return{paymentMethod:{type:this.type,issuer:this.state?.data?.issuer}}}get isValid(){return 0===this.props.issuers.length||Boolean(this.state?.isValid)}get brands(){return this.props.showPaymentMethodItemImages?this.props.issuers.map(t=>({icon:t.icon,name:t.id})):[]}componentToRender(){return this.props.issuers.length>0?t(e,{items:this.props.issuers,highlightedIds:this.props.highlightedIssuers,...this.props,...this.state,setComponentRef:this.setComponentRef,showImage:this.props.showImage,type:this.constructor.type,onChange:this.setState,onSubmit:this.submit,payButton:this.payButton,contextualText:this.props.i18n.get("issuerList.selectField.contextualText"),onSubmitAnalytics:this.submitAnalytics}):t(r,{showPayButton:this.props.showPayButton,name:this.props.name,...this.props,onSubmit:this.submit,payButton:this.payButton,setComponentRef:this.setComponentRef})}constructor(t,s){super(t,s);const e=t=>this.resources.getImage(t);if(this.props.showImage){const t=i({loadingContext:this.props.loadingContext},this.constructor.type,e);this.props.issuers=this.props.issuers.map(s=>({...s,icon:t(s.id)}))}}}var a,p,h;h={showImage:!0,issuers:[],highlightedIssuers:[],loadingContext:o,showPaymentMethodItemImages:!1},(p="defaultProps")in(a=n)?Object.defineProperty(a,p,{value:h,enumerable:!0,configurable:!0,writable:!0}):a[p]=h;export{n as default};
2
2
  //# sourceMappingURL=IssuerListContainer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IssuerListContainer.js","sources":["../../../../../src/components/helpers/IssuerListContainer/IssuerListContainer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../../internal/UIElement/UIElement';\nimport IssuerList from '../../internal/IssuerList';\nimport getIssuerImageUrl from '../../../utils/get-issuer-image';\nimport { FALLBACK_CONTEXT } from '../../../core/config';\nimport RedirectButton from '../../internal/RedirectButton';\nimport { IssuerListConfiguration, IssuerListData } from './types';\nimport type { ICore } from '../../../core/types';\nimport { PaymentMethodBrand } from '../../../types/global-types';\nimport { ImageOptions } from '../../../core/Context/Resources';\n\nclass IssuerListContainer<TProps extends IssuerListConfiguration = IssuerListConfiguration, TData = IssuerListData> extends UIElement<TProps> {\n protected static readonly defaultProps = {\n showImage: true,\n issuers: [],\n highlightedIssuers: [],\n loadingContext: FALLBACK_CONTEXT,\n showPaymentMethodItemImages: false\n };\n\n constructor(checkout: ICore, props?: TProps) {\n super(checkout, props);\n\n const getImage = (props: ImageOptions) => this.resources.getImage(props);\n\n if (this.props.showImage) {\n const getIssuerIcon = getIssuerImageUrl({ loadingContext: this.props.loadingContext }, this.constructor['type'], getImage);\n\n this.props.issuers = this.props.issuers.map(item => ({\n ...item,\n icon: getIssuerIcon(item.id)\n }));\n }\n }\n\n formatProps(props: TProps): TProps {\n const issuers =\n // @ts-expect-error - details is not in the props type but we need it for backward compatibility\n (props?.details?.length && props.details.find((d: Record<string, unknown>) => d.key === 'issuer')?.items) || props.issuers || [];\n return { ...props, issuers };\n }\n\n /**\n * Formats the component data output\n */\n formatData(): TData {\n return {\n paymentMethod: {\n type: this.type,\n issuer: this.state?.data?.issuer\n }\n } as TData;\n }\n\n /**\n * Returns whether the component state is valid or not\n */\n get isValid() {\n if (this.props.issuers.length === 0) {\n return true;\n }\n return Boolean(this.state?.isValid);\n }\n\n /**\n * Returns brands array (similar to card) depending on showPaymentMethodItemImages\n * This is used to show the brands in the PaymentMethodItem\n * Requires brands icons to be loaded in the payment method\n */\n get brands(): PaymentMethodBrand[] {\n if (this.props.showPaymentMethodItemImages) {\n return this.props.issuers.map(brand => {\n const brandIcon = brand.icon;\n return { icon: brandIcon, name: brand.id };\n });\n }\n\n return [];\n }\n\n protected override componentToRender(): h.JSX.Element {\n return this.props.issuers.length > 0 ? (\n <IssuerList\n items={this.props.issuers}\n highlightedIds={this.props.highlightedIssuers}\n {...this.props}\n {...this.state}\n setComponentRef={this.setComponentRef}\n showImage={this.props.showImage}\n type={this.constructor['type']}\n onChange={this.setState}\n onSubmit={this.submit}\n payButton={this.payButton}\n contextualText={this.props.i18n.get('issuerList.selectField.contextualText')}\n onSubmitAnalytics={this.submitAnalytics}\n />\n ) : (\n <RedirectButton\n showPayButton={this.props.showPayButton}\n name={this.props.name}\n {...this.props}\n onSubmit={this.submit}\n payButton={this.payButton}\n ref={ref => {\n this.componentRef = ref;\n }}\n />\n );\n }\n}\n\nexport default IssuerListContainer;\n"],"names":["IssuerListContainer","UIElement","formatProps","props","issuers","details","length","find","d","key","items","formatData","paymentMethod","type","this","issuer","state","data","isValid","Boolean","brands","showPaymentMethodItemImages","map","brand","icon","name","id","componentToRender","h","IssuerList","highlightedIds","highlightedIssuers","setComponentRef","showImage","constructor","onChange","setState","onSubmit","submit","payButton","contextualText","i18n","get","onSubmitAnalytics","submitAnalytics","RedirectButton","showPayButton","ref","componentRef","checkout","super","getImage","resources","getIssuerIc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GAEhB,MAAMgD,EAAYhD,GAAwBW,KAAKsC,UAAUD,SAAShD,GAElE,GAAIW,KAAKX,MAAM8B,UAAW,CACtB,MAAMoB,EAAgBC,EAAkB,CAAEC,eAAgBzC,KAAKX,MAAMoD,gBAAkBzC,KAAKoB,iBAAqBiB,GAEjHrC,KAAKX,MAAMC,QAAUU,KAAKX,MAAMC,QAAQkB,IAAIkC,QACrCA,EACHhC,KAAM6B,EAAcG,EAAK9B,MAEjC,CACJ,cArByC,CACrCO,WAAW,EACX7B,QAAS,GACT2B,mBAAoB,GACpBwB,eAAgBE,EAChBpC,6BAA6B,MALPqC,oBADxB1D"}
1
+ {"version":3,"file":"IssuerListContainer.js","sources":["../../../../../src/components/helpers/IssuerListContainer/IssuerListContainer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../../internal/UIElement/UIElement';\nimport IssuerList from '../../internal/IssuerList';\nimport getIssuerImageUrl from '../../../utils/get-issuer-image';\nimport { FALLBACK_CONTEXT } from '../../../core/config';\nimport RedirectButton from '../../internal/RedirectButton';\nimport { IssuerListConfiguration, IssuerListData } from './types';\nimport type { ICore } from '../../../core/types';\nimport { PaymentData, PaymentMethodBrand } from '../../../types/global-types';\nimport { ImageOptions } from '../../../core/Context/Resources';\n\nclass IssuerListContainer<\n TProps extends IssuerListConfiguration = IssuerListConfiguration,\n TData extends PaymentData = IssuerListData\n> extends UIElement<TProps> {\n protected static readonly defaultProps = {\n showImage: true,\n issuers: [],\n highlightedIssuers: [],\n loadingContext: FALLBACK_CONTEXT,\n showPaymentMethodItemImages: false\n };\n\n constructor(checkout: ICore, props?: TProps) {\n super(checkout, props);\n\n const getImage = (props: ImageOptions) => this.resources.getImage(props);\n\n if (this.props.showImage) {\n const getIssuerIcon = getIssuerImageUrl({ loadingContext: this.props.loadingContext }, this.constructor['type'], getImage);\n\n this.props.issuers = this.props.issuers.map(item => ({\n ...item,\n icon: getIssuerIcon(item.id)\n }));\n }\n }\n\n formatProps(props: TProps): TProps {\n const issuers =\n // @ts-expect-error - details is not in the props type but we need it for backward compatibility\n (props?.details?.length && props.details.find((d: Record<string, unknown>) => d.key === 'issuer')?.items) || props.issuers || [];\n return { ...props, issuers };\n }\n\n /**\n * Formats the component data output\n */\n formatData(): TData {\n return {\n paymentMethod: {\n type: this.type,\n issuer: this.state?.data?.issuer\n }\n } as unknown as TData;\n }\n\n /**\n * Returns whether the component state is valid or not\n */\n get isValid() {\n if (this.props.issuers.length === 0) {\n return true;\n }\n return Boolean(this.state?.isValid);\n }\n\n /**\n * Returns brands array (similar to card) depending on showPaymentMethodItemImages\n * This is used to show the brands in the PaymentMethodItem\n * Requires brands icons to be loaded in the payment method\n */\n get brands(): PaymentMethodBrand[] {\n if (this.props.showPaymentMethodItemImages) {\n return this.props.issuers.map(brand => {\n const brandIcon = brand.icon;\n return { icon: brandIcon, name: brand.id };\n });\n }\n\n return [];\n }\n\n protected override componentToRender(): h.JSX.Element {\n return this.props.issuers.length > 0 ? (\n <IssuerList\n items={this.props.issuers}\n highlightedIds={this.props.highlightedIssuers}\n {...this.props}\n {...this.state}\n setComponentRef={this.setComponentRef}\n showImage={this.props.showImage}\n type={this.constructor['type']}\n onChange={this.setState}\n onSubmit={this.submit}\n payButton={this.payButton}\n contextualText={this.props.i18n.get('issuerList.selectField.contextualText')}\n onSubmitAnalytics={this.submitAnalytics}\n />\n ) : (\n <RedirectButton\n showPayButton={this.props.showPayButton}\n name={this.props.name}\n {...this.props}\n onSubmit={this.submit}\n payButton={this.payButton}\n setComponentRef={this.setComponentRef}\n />\n );\n }\n}\n\nexport default IssuerListContainer;\n"],"names":["IssuerListContainer","UIElement","formatProps","props","issuers","details","length","find","d","key","items","formatData","paymentMethod","type","this","issuer","state","data","isValid","Boolean","brands","showPaymentMethodItemImages","map","brand","icon","name","id","componentToRender","h","IssuerList","highlightedIds","highlightedIssuers","setComponentRef","showImage","constructor","onChange","setState","onSubmit","submit","payButton","contextualText","i18n","get","onSubmitAnalytics","submitAnalytics","RedirectButton","showPayButton","checkout","super","getImage","resources","getIssuerIcon","getIssuerImageUrl","loadingContext","item","FALLBACK_CONTEXT","defaultProps"],"mappings":"6WAWA,MAAMA,UAGIC,EAwBNC,WAAAA,CAAYC,GACR,MAAMC,EAEDD,GAAOE,SAASC,QAAUH,EAAME,QAAQE,KAAMC,GAAyC,WAAVA,EAAEC,MAAmBC,OAAUP,EAAMC,SAAW,GAClI,MAAO,IAAKD,EAAOC,UACvB,CAKAO,UAAAA,GACI,MAAO,CACHC,cAAe,CACXC,KAAMC,KAAKD,KACXE,OAAQD,KAAKE,OAAOC,MAAMF,QAGtC,CAKA,WAAIG,GACA,OAAkC,IAA9BJ,KAAKX,MAAMC,QAAQE,QAGhBa,QAAQL,KAAKE,OAAOE,QAC/B,CAOA,UAAIE,GACA,OAAIN,KAAKX,MAAMkB,4BACJP,KAAKX,MAAMC,QAAQkB,IAAIC,IAEnB,CAAEC,KADSD,EAAMC,KACEC,KAAMF,EAAMG,MAIvC,EACX,CAEmBC,iBAAAA,GACf,OAAOb,KAAKX,MAAMC,QAAQE,OAAS,EAC/BsB,EAACC,EAAAA,CACGnB,MAAOI,KAAKX,MAAMC,QAClB0B,eAAgBhB,KAAKX,MAAM4B,sBACvBjB,KAAKX,SACLW,KAAKE,MACTgB,gBAAiBlB,KAAKkB,gBACtBC,UAAWnB,KAAKX,MAAM8B,UACtBpB,KAAMC,KAAKoB,YAAY,KACvBC,SAAUrB,KAAKsB,SACfC,SAAUvB,KAAKwB,OACfC,UAAWzB,KAAKyB,UAChBC,eAAgB1B,KAAKX,MAAMsC,KAAKC,IAAI,yCACpCC,kBAAmB7B,KAAK8B,kBAG5BhB,EAACiB,EAAAA,CACGC,cAAehC,KAAKX,MAAM2C,cAC1BrB,KAAMX,KAAKX,MAAMsB,QACbX,KAAKX,MACTkC,SAAUvB,KAAKwB,OACfC,UAAWzB,KAAKyB,UAChBP,gBAAiBlB,KAAKkB,iBAGlC,CAtFA,WAAAE,CAAYa,EAAiB5C,GACzB6C,MAAMD,EAAU5C,GAEhB,MAAM8C,EAAY9C,GAAwBW,KAAKoC,UAAUD,SAAS9C,GAElE,GAAIW,KAAKX,MAAM8B,UAAW,CACtB,MAAMkB,EAAgBC,EAAkB,CAAEC,eAAgBvC,KAAKX,MAAMkD,gBAAkBvC,KAAKoB,iBAAqBe,GAEjHnC,KAAKX,MAAMC,QAAUU,KAAKX,MAAMC,QAAQkB,IAAIgC,QACrCA,EACH9B,KAAM2B,EAAcG,EAAK5B,MAEjC,CACJ,cArByC,CACrCO,WAAW,EACX7B,QAAS,GACT2B,mBAAoB,GACpBsB,eAAgBE,EAChBlC,6BAA6B,MALPmC,oBAJxBxD"}
@@ -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{QRLoader as o}from"../../internal/QRLoader/QRLoader.js";import"../../../core/Context/CoreProvider.js";import"../../../external/preact/hooks/dist/hooks.js";import"../../../core/Errors/SRPanelContext.js";import"../../internal/Button/Button.js";import"../../internal/QRLoader/QRLoaderDetailsProvider.js";import r from"../../internal/RedirectButton/RedirectButton.js";class n extends e{formatData(){return{paymentMethod:{type:this.type,...this.state.data}}}get isValid(){return!0}renderQRCode(){return t(o,{...this.props,delay:this.props.delay,countdownTime:this.props.countdownTime,instructions:this.props.instructions,type:this.constructor.type,brandLogo:this.props.brandLogo||this.icon,onComplete:this.onComplete,onActionHandled:this.onActionHandled,brandName:this.displayName,onSubmitAnalytics:this.submitAnalytics})}componentToRender(){return this.props.paymentData?this.renderQRCode():this.props.showPayButton?t(r,{showPayButton:this.props.showPayButton,name:this.displayName,onSubmit:this.submit,payButton:this.payButton,ref:t=>{this.componentRef=t}}):null}}var s,i,a;a={qrCodeImage:"",amount:null,paymentData:null,onError:()=>{}},(i="defaultProps")in(s=n)?Object.defineProperty(s,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):s[i]=a;export{n as default};
1
+ import{createElement as t}from"../../../external/preact/dist/preact.js";import{UIElement as e}from"../../internal/UIElement/UIElement.js";import{QRLoader as o}from"../../internal/QRLoader/QRLoader.js";import"../../../core/Context/CoreProvider.js";import"../../../external/preact/hooks/dist/hooks.js";import"../../../core/Errors/SRPanelContext.js";import"../../internal/Button/Button.js";import"../../internal/QRLoader/QRLoaderDetailsProvider.js";import r from"../../internal/RedirectButton/RedirectButton.js";class n extends e{formatData(){return{paymentMethod:{type:this.type,...this.state.data}}}get isValid(){return!0}renderQRCode(){return t(o,{...this.props,delay:this.props.delay,countdownTime:this.props.countdownTime,instructions:this.props.instructions,type:this.constructor.type,brandLogo:this.props.brandLogo||this.icon,onComplete:this.onComplete,onActionHandled:this.onActionHandled,brandName:this.displayName,onSubmitAnalytics:this.submitAnalytics})}componentToRender(){return this.props.paymentData?this.renderQRCode():this.props.showPayButton?t(r,{showPayButton:this.props.showPayButton,name:this.displayName,onSubmit:this.submit,payButton:this.payButton,setComponentRef:this.setComponentRef}):null}}var s,i,a;a={qrCodeImage:"",amount:null,paymentData:null,onError:()=>{}},(i="defaultProps")in(s=n)?Object.defineProperty(s,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):s[i]=a;export{n as default};
2
2
  //# sourceMappingURL=QRLoaderContainer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"QRLoaderContainer.js","sources":["../../../../../src/components/helpers/QRLoaderContainer/QRLoaderContainer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../../internal/UIElement/UIElement';\nimport { QRLoader } from '../../internal/QRLoader';\nimport RedirectButton from '../../internal/RedirectButton';\nimport { QRLoaderConfiguration } from './types';\n\nclass QRLoaderContainer<T extends QRLoaderConfiguration = QRLoaderConfiguration> extends UIElement<T> {\n // Using the generic here allow to fully extend the QRLoaderContainer (including it's props)\n protected static readonly defaultProps = {\n qrCodeImage: '',\n amount: null,\n paymentData: null,\n onError: () => {}\n };\n\n formatData() {\n return {\n paymentMethod: {\n type: this.type,\n ...this.state.data\n }\n };\n }\n\n get isValid() {\n return true;\n }\n\n // Makes possible to extend the final QR code step\n public renderQRCode() {\n return (\n <QRLoader\n {...this.props}\n delay={this.props.delay}\n countdownTime={this.props.countdownTime}\n instructions={this.props.instructions}\n type={this.constructor['type']}\n brandLogo={this.props.brandLogo || this.icon}\n onComplete={this.onComplete}\n onActionHandled={this.onActionHandled}\n brandName={this.displayName}\n onSubmitAnalytics={this.submitAnalytics}\n />\n );\n }\n\n protected override componentToRender(): h.JSX.Element {\n if (this.props.paymentData) {\n return this.renderQRCode();\n }\n\n if (this.props.showPayButton) {\n return (\n <RedirectButton\n showPayButton={this.props.showPayButton}\n name={this.displayName}\n onSubmit={this.submit}\n payButton={this.payButton}\n ref={ref => {\n this.componentRef = ref;\n }}\n />\n );\n }\n\n return null;\n }\n}\n\nexport default QRLoaderContainer;\n"],"names":["QRLoaderContainer","UIElement","formatData","paymentMethod","type","this","state","data","isValid","renderQRCode","h","QRLoader","props","delay","countdownTime","instructions","constructor","brandLogo","icon","onComplete","onActionHandled","brandName","displayName","onSubmitAnalytics","submitAnalytics","componentToRender","paymentData","showPayButton","RedirectButton","name","onSubmit","submit","payButton","ref","componentRef","qrCodeImage","amount","onError","defaultProps"],"mappings":"6fAMA,MAAMA,UAAmFC,EASrFC,UAAAA,GACI,MAAO,CACHC,cAAe,CACXC,KAAMC,KAAKD,QACRC,KAAKC,MAAMC,MAG1B,CAEA,WAAIC,GACA,OAAO,CACX,CAGOC,YAAAA,GACH,OACIC,EAACC,EAAAA,IACON,KAAKO,MACTC,MAAOR,KAAKO,MAAMC,MAClBC,cAAeT,KAAKO,MAAME,cAC1BC,aAAcV,KAAKO,MAAMG,aACzBX,KAAMC,KAAKW,YAAY,KACvBC,UAAWZ,KAAKO,MAAMK,WAAaZ,KAAKa,KACxCC,WAAYd,KAAKc,WACjBC,gBAAiBf,KAAKe,gBACtBC,UAAWhB,KAAKiB,YAChBC,kBAAmBlB,KAAKmB,iBAGpC,CAEmBC,iBAAAA,GACf,OAAIpB,KAAKO,MAAMc,YACJrB,KAAKI,eAGZJ,KAAKO,MAAMe,cAEPjB,EAACkB,EAAAA,CACGD,cAAetB,KAAKO,MAAMe,cAC1BE,KAAMxB,KAAKiB,YACXQ,SAAUzB,KAAK0B,OACfC,UAAW3B,KAAK2B,UAChBC,IAAKA,IACD5B,KAAK6B,aAAeD,KAM7B,IACX,cA1DyC,CACrCE,YAAa,GACbC,OAAQ,KACRV,YAAa,KACbW,QAAS,WAJaC,oBAFxBtC"}
1
+ {"version":3,"file":"QRLoaderContainer.js","sources":["../../../../../src/components/helpers/QRLoaderContainer/QRLoaderContainer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../../internal/UIElement/UIElement';\nimport { QRLoader } from '../../internal/QRLoader';\nimport RedirectButton from '../../internal/RedirectButton';\nimport { QRLoaderConfiguration } from './types';\n\nclass QRLoaderContainer<T extends QRLoaderConfiguration = QRLoaderConfiguration> extends UIElement<T> {\n // Using the generic here allow to fully extend the QRLoaderContainer (including it's props)\n protected static readonly defaultProps = {\n qrCodeImage: '',\n amount: null,\n paymentData: null,\n onError: () => {}\n };\n\n formatData() {\n return {\n paymentMethod: {\n type: this.type,\n ...this.state.data\n }\n };\n }\n\n get isValid() {\n return true;\n }\n\n // Makes possible to extend the final QR code step\n public renderQRCode() {\n return (\n <QRLoader\n {...this.props}\n delay={this.props.delay}\n countdownTime={this.props.countdownTime}\n instructions={this.props.instructions}\n type={this.constructor['type']}\n brandLogo={this.props.brandLogo || this.icon}\n onComplete={this.onComplete}\n onActionHandled={this.onActionHandled}\n brandName={this.displayName}\n onSubmitAnalytics={this.submitAnalytics}\n />\n );\n }\n\n protected override componentToRender(): h.JSX.Element {\n if (this.props.paymentData) {\n return this.renderQRCode();\n }\n\n if (this.props.showPayButton) {\n return (\n <RedirectButton\n showPayButton={this.props.showPayButton}\n name={this.displayName}\n onSubmit={this.submit}\n payButton={this.payButton}\n setComponentRef={this.setComponentRef}\n />\n );\n }\n\n return null;\n }\n}\n\nexport default QRLoaderContainer;\n"],"names":["QRLoaderContainer","UIElement","formatData","paymentMethod","type","this","state","data","isValid","renderQRCode","h","QRLoader","props","delay","countdownTime","instructions","constructor","brandLogo","icon","onComplete","onActionHandled","brandName","displayName","onSubmitAnalytics","submitAnalytics","componentToRender","paymentData","showPayButton","RedirectButton","name","onSubmit","submit","payButton","setComponentRef","qrCodeImage","amount","onError","defaultProps"],"mappings":"6fAMA,MAAMA,UAAmFC,EASrFC,UAAAA,GACI,MAAO,CACHC,cAAe,CACXC,KAAMC,KAAKD,QACRC,KAAKC,MAAMC,MAG1B,CAEA,WAAIC,GACA,OAAO,CACX,CAGOC,YAAAA,GACH,OACIC,EAACC,EAAAA,IACON,KAAKO,MACTC,MAAOR,KAAKO,MAAMC,MAClBC,cAAeT,KAAKO,MAAME,cAC1BC,aAAcV,KAAKO,MAAMG,aACzBX,KAAMC,KAAKW,YAAY,KACvBC,UAAWZ,KAAKO,MAAMK,WAAaZ,KAAKa,KACxCC,WAAYd,KAAKc,WACjBC,gBAAiBf,KAAKe,gBACtBC,UAAWhB,KAAKiB,YAChBC,kBAAmBlB,KAAKmB,iBAGpC,CAEmBC,iBAAAA,GACf,OAAIpB,KAAKO,MAAMc,YACJrB,KAAKI,eAGZJ,KAAKO,MAAMe,cAEPjB,EAACkB,EAAAA,CACGD,cAAetB,KAAKO,MAAMe,cAC1BE,KAAMxB,KAAKiB,YACXQ,SAAUzB,KAAK0B,OACfC,UAAW3B,KAAK2B,UAChBC,gBAAiB5B,KAAK4B,kBAK3B,IACX,cAxDyC,CACrCC,YAAa,GACbC,OAAQ,KACRT,YAAa,KACbU,QAAS,WAJaC,oBAFxBrC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Specifications.js","sources":["../../../../../src/components/internal/Address/Specifications.ts"],"sourcesContent":["import { AddressSchema, AddressSpecifications, StringObject } from './types';\nimport { ADDRESS_SPECIFICATIONS } from './constants';\nimport { AddressField } from '../../../types/global-types';\n\nconst SCHEMA_MAX_DEPTH = 2;\n\nclass Specifications {\n private specifications: AddressSpecifications;\n\n constructor(specifications?) {\n this.specifications = { ...ADDRESS_SPECIFICATIONS, ...specifications };\n }\n\n /**\n * Checks if a certain country has a dataset.\n * @param country - The selected country\n * @returns Boolean\n */\n countryHasDataset(country: string): boolean {\n return !!this.specifications?.[country]?.hasDataset;\n }\n\n /**\n * Checks if a certain country has the passed field in their optional fields array.\n * @param country - The selected country\n * @param fieldName - The field to be checked\n * @returns Boolean\n */\n countryHasOptionalField(country: string, fieldName: string): boolean {\n return !!this.specifications?.[country]?.optionalFields?.includes(fieldName as any);\n }\n\n /**\n * Returns the address schema of the selected country or the default address schema.\n * @param country - The selected country\n * @returns AddressSchema\n */\n getAddressSchemaForCountry(country: string): AddressSchema {\n return this.specifications?.[country]?.schema || this.specifications.default.schema;\n }\n\n /**\n * Returns the address labels of the selected country or the default address labels.\n * @param country - The selected country\n * @returns StringObject\n */\n getAddressLabelsForCountry(country: string): StringObject {\n return this.specifications?.[country]?.labels || this.specifications.default.labels;\n }\n\n /**\n * Returns the optional fields of the selected country or the default optional fields.\n * @param country - The selected country\n * @returns Optional fields array\n */\n getOptionalFieldsForCountry(country: string): string[] {\n return this.specifications?.[country]?.optionalFields || this.specifications.default?.optionalFields || [];\n }\n\n /**\n * Returns the key for a field of the passed country or the default key for that field.\n * @param fieldName - The field to be searched\n * @param country - The selected country\n */\n getKeyForField(fieldName: string, country: string): string {\n return this.specifications?.[country]?.labels?.[fieldName] || this.specifications?.default?.labels?.[fieldName] || fieldName;\n }\n\n /**\n * Returns the placeholder key for a field of the passed country or the default key for that field.\n * @param fieldName - The field to be searched\n * @param country - The selected country\n */\n getPlaceholderKeyForField(fieldName: string, country: string): string {\n return this.specifications?.[country]?.placeholders?.[fieldName] || this.specifications?.default?.placeholders?.[fieldName];\n }\n\n /**\n * Returns an array with the address schema of the selected country or the default address schema\n * Flat version of getAddressSchemaForCountry\n * @param country - The selected country\n * @returns Array\n */\n getAddressSchemaForCountryFlat(country: string): AddressField[] {\n return this.getAddressSchemaForCountry(country)\n .flat(SCHEMA_MAX_DEPTH)\n .filter((element): element is AddressField => typeof element === 'string');\n }\n}\n\nexport default Specifications;\n"],"names":["Specifications","countryHasDataset","country","this","specifications","hasDataset","countryHasOptionalField","fieldName","optionalFields","includes","getAddressSchemaForCountry","schema","default","getAddressLabelsForCountry","labels","getOptionalFieldsForCountry","getKeyForField","getPlaceholderKeyForField","placeholders","getAddressSchemaForCountryFlat","flat","filter","element","constructor","ADDRESS_SPECIFICATIONS"],"mappings":"wDAMA,MAAMA,EAYFC,iBAAAA,CAAkBC,GACd,QAASC,KAAKC,iBAAiBF,IAAUG,UAC7C,CAQAC,uBAAAA,CAAwBJ,EAAiBK,GACrC,QAASJ,KAAKC,iBAAiBF,IAAUM,gBAAgBC,SAASF,EACtE,CAOAG,0BAAAA,CAA2BR,GACvB,OAAOC,KAAKC,iBAAiBF,IAAUS,QAAUR,KAAKC,eAAeQ,QAAQD,MACjF,CAOAE,0BAAAA,CAA2BX,GACvB,OAAOC,KAAKC,iBAAiBF,IAAUY,QAAUX,KAAKC,eAAeQ,QAAQE,MACjF,CAOAC,2BAAAA,CAA4Bb,GACxB,OAAOC,KAAKC,iBAAiBF,IAAUM,gBAAkBL,KAAKC,eAAeQ,SAASJ,gBAAkB,EAC5G,CAOAQ,cAAAA,CAAeT,EAAmBL,GAC9B,OAAOC,KAAKC,iBAAiBF,IAAUY,SAASP,IAAcJ,KAAKC,gBAAgBQ,SAASE,SAASP,IAAcA,CACvH,CAOAU,yBAAAA,CAA0BV,EAAmBL,GACzC,OAAOC,KAAKC,iBAAiBF,IAAUgB,eAAeX,IAAcJ,KAAKC,gBAAgBQ,SAASM,eAAeX,EACrH,CAQAY,8BAAAA,CAA+BjB,GAC3B,OAAOC,KAAKO,2BAA2BR,GAClCkB,KAjFY,GAkFZC,OAAQC,GAAwD,iBAAZA,EAC7D,CA9EA,WAAAC,CAAYnB,yBAFJA,sBAARD,4FAGIA,KAAKC,eAAiB,IAAKoB,KAA2BpB,EAC1D"}
1
+ {"version":3,"file":"Specifications.js","sources":["../../../../../src/components/internal/Address/Specifications.ts"],"sourcesContent":["import { AddressSchema, AddressSpecifications, StringObject } from './types';\nimport { ADDRESS_SPECIFICATIONS } from './constants';\nimport { AddressField } from '../../../types/global-types';\n\nconst SCHEMA_MAX_DEPTH = 2;\n\nclass Specifications {\n private specifications: AddressSpecifications;\n\n constructor(specifications?) {\n this.specifications = { ...ADDRESS_SPECIFICATIONS, ...specifications };\n }\n\n /**\n * Checks if a certain country has a dataset.\n * @param country - The selected country\n * @returns Boolean\n */\n countryHasDataset(country: string): boolean {\n return !!this.specifications?.[country]?.hasDataset;\n }\n\n /**\n * Checks if a certain country has the passed field in their optional fields array.\n * @param country - The selected country\n * @param fieldName - The field to be checked\n * @returns Boolean\n */\n countryHasOptionalField(country: string, fieldName: AddressField): boolean {\n return !!this.specifications?.[country]?.optionalFields?.includes(fieldName);\n }\n\n /**\n * Returns the address schema of the selected country or the default address schema.\n * @param country - The selected country\n * @returns AddressSchema\n */\n getAddressSchemaForCountry(country: string): AddressSchema {\n return this.specifications?.[country]?.schema || this.specifications.default.schema;\n }\n\n /**\n * Returns the address labels of the selected country or the default address labels.\n * @param country - The selected country\n * @returns StringObject\n */\n getAddressLabelsForCountry(country: string): StringObject {\n return this.specifications?.[country]?.labels || this.specifications.default.labels;\n }\n\n /**\n * Returns the optional fields of the selected country or the default optional fields.\n * @param country - The selected country\n * @returns Optional fields array\n */\n getOptionalFieldsForCountry(country: string): string[] {\n return this.specifications?.[country]?.optionalFields || this.specifications.default?.optionalFields || [];\n }\n\n /**\n * Returns the key for a field of the passed country or the default key for that field.\n * @param fieldName - The field to be searched\n * @param country - The selected country\n */\n getKeyForField(fieldName: string, country: string): string {\n return this.specifications?.[country]?.labels?.[fieldName] || this.specifications?.default?.labels?.[fieldName] || fieldName;\n }\n\n /**\n * Returns the placeholder key for a field of the passed country or the default key for that field.\n * @param fieldName - The field to be searched\n * @param country - The selected country\n */\n getPlaceholderKeyForField(fieldName: string, country: string): string {\n return this.specifications?.[country]?.placeholders?.[fieldName] || this.specifications?.default?.placeholders?.[fieldName];\n }\n\n /**\n * Returns an array with the address schema of the selected country or the default address schema\n * Flat version of getAddressSchemaForCountry\n * @param country - The selected country\n * @returns Array\n */\n getAddressSchemaForCountryFlat(country: string): AddressField[] {\n return this.getAddressSchemaForCountry(country)\n .flat(SCHEMA_MAX_DEPTH)\n .filter((element): element is AddressField => typeof element === 'string');\n }\n}\n\nexport default Specifications;\n"],"names":["Specifications","countryHasDataset","country","this","specifications","hasDataset","countryHasOptionalField","fieldName","optionalFields","includes","getAddressSchemaForCountry","schema","default","getAddressLabelsForCountry","labels","getOptionalFieldsForCountry","getKeyForField","getPlaceholderKeyForField","placeholders","getAddressSchemaForCountryFlat","flat","filter","element","constructor","ADDRESS_SPECIFICATIONS"],"mappings":"wDAMA,MAAMA,EAYFC,iBAAAA,CAAkBC,GACd,QAASC,KAAKC,iBAAiBF,IAAUG,UAC7C,CAQAC,uBAAAA,CAAwBJ,EAAiBK,GACrC,QAASJ,KAAKC,iBAAiBF,IAAUM,gBAAgBC,SAASF,EACtE,CAOAG,0BAAAA,CAA2BR,GACvB,OAAOC,KAAKC,iBAAiBF,IAAUS,QAAUR,KAAKC,eAAeQ,QAAQD,MACjF,CAOAE,0BAAAA,CAA2BX,GACvB,OAAOC,KAAKC,iBAAiBF,IAAUY,QAAUX,KAAKC,eAAeQ,QAAQE,MACjF,CAOAC,2BAAAA,CAA4Bb,GACxB,OAAOC,KAAKC,iBAAiBF,IAAUM,gBAAkBL,KAAKC,eAAeQ,SAASJ,gBAAkB,EAC5G,CAOAQ,cAAAA,CAAeT,EAAmBL,GAC9B,OAAOC,KAAKC,iBAAiBF,IAAUY,SAASP,IAAcJ,KAAKC,gBAAgBQ,SAASE,SAASP,IAAcA,CACvH,CAOAU,yBAAAA,CAA0BV,EAAmBL,GACzC,OAAOC,KAAKC,iBAAiBF,IAAUgB,eAAeX,IAAcJ,KAAKC,gBAAgBQ,SAASM,eAAeX,EACrH,CAQAY,8BAAAA,CAA+BjB,GAC3B,OAAOC,KAAKO,2BAA2BR,GAClCkB,KAjFY,GAkFZC,OAAQC,GAAwD,iBAAZA,EAC7D,CA9EA,WAAAC,CAAYnB,yBAFJA,sBAARD,4FAGIA,KAAKC,eAAiB,IAAKoB,KAA2BpB,EAC1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"AddressSearch.js","sources":["../../../../../../src/components/internal/Address/components/AddressSearch.tsx"],"sourcesContent":["import Field from '../../FormFields/Field';\nimport { h } from 'preact';\nimport { AddressLookupItem } from '../types';\nimport { useCallback, useEffect, useState, useMemo } from 'preact/hooks';\nimport './AddressSearch.scss';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport { debounce } from '../../../../utils/debounce';\nimport Select from '../../FormFields/Select';\nimport { AddressData } from '../../../../types';\n\nexport type OnAddressLookupType = (\n value: string,\n actions: {\n resolve: (value: Array<AddressLookupItem>) => void;\n reject: (reason?: any) => void;\n }\n) => Promise<void>;\n\nexport type OnAddressSelectedType = (\n value: AddressLookupItem,\n actions: {\n resolve: (value: AddressLookupItem) => void;\n reject: (reason?: any) => void;\n }\n) => Promise<void>;\n\ninterface AddressSearchProps {\n onAddressLookup?: OnAddressLookupType;\n onAddressSelected?: OnAddressSelectedType;\n onSelect: (addressItem: AddressData) => void;\n onManualAddress: any;\n externalErrorMessage: string;\n hideManualButton: boolean;\n showContextualElement?: boolean;\n contextualText?: string;\n placeholder?: string;\n addressSearchDebounceMs?: number;\n}\n\ninterface RejectionReason {\n errorMessage: string;\n}\n\nexport default function AddressSearch({\n onAddressLookup,\n onAddressSelected,\n onSelect,\n onManualAddress,\n externalErrorMessage,\n hideManualButton,\n showContextualElement,\n contextualText,\n placeholder,\n addressSearchDebounceMs\n}: Readonly<AddressSearchProps>) {\n const [formattedData, setFormattedData] = useState<AddressLookupItem[]>([]);\n const [originalData, setOriginalData] = useState<AddressLookupItem[]>([]);\n\n const [errorMessage, setErrorMessage] = useState('');\n\n const { i18n } = useCoreContext();\n const mapDataToSelect = data => data.map(({ id, name }) => ({ id, name }));\n\n const handlePromiseReject = useCallback((reason: RejectionReason) => {\n if (reason?.errorMessage) {\n setErrorMessage(reason.errorMessage);\n }\n }, []);\n\n const onTextInput = useCallback(\n (inputValue: string) => {\n new Promise<Array<AddressLookupItem>>((resolve, reject) => {\n void onAddressLookup(inputValue, { resolve, reject });\n })\n .then(searchArray => {\n setOriginalData(searchArray);\n setFormattedData(mapDataToSelect(searchArray));\n setErrorMessage('');\n })\n .catch(reason => handlePromiseReject(reason));\n },\n [onAddressLookup]\n );\n\n // update error message when there's a new one\n useEffect(() => {\n setErrorMessage(externalErrorMessage);\n }, [externalErrorMessage]);\n\n const onSelectItem = event => {\n if (!event.target.value) {\n setErrorMessage(i18n.get('address.errors.incomplete'));\n return;\n }\n const value = originalData.find(item => item.id === event.target.value);\n\n // 1. in case we don't get a function just select item\n if (typeof onAddressSelected !== 'function') {\n onSelect(value);\n setFormattedData([]);\n return;\n }\n\n // 2. in case callback is provided, create and call onAddressSelected\n new Promise<AddressLookupItem>((resolve, reject) => {\n void onAddressSelected(value, { resolve, reject });\n })\n .then(fullData => {\n onSelect(fullData);\n setFormattedData([]);\n })\n .catch(reason => handlePromiseReject(reason));\n };\n\n const debounceInputHandler = useMemo(() => debounce(onTextInput, addressSearchDebounceMs), []);\n\n return (\n // The search field is intentionally rendered before the manual entry button in the DOM.\n // See: ../a11y.md\n <div className={'adyen-checkout__address-search adyen-checkout__field-group'}>\n <Field\n label={i18n.get('address')}\n classNameModifiers={['address-search']}\n errorMessage={errorMessage}\n name={'address-search'}\n showContextualElement={showContextualElement}\n contextualText={contextualText}\n >\n <Select\n name={'address-search'}\n className={'adyen-checkout__address-search__dropdown'}\n placeholder={placeholder}\n onInput={debounceInputHandler}\n items={formattedData}\n onChange={onSelectItem}\n disableTextFilter={true}\n blurOnClose={true}\n />\n </Field>\n {!hideManualButton && (\n <span className=\"adyen-checkout__address-search__manual-add\">\n <button\n type=\"button\"\n className=\"adyen-checkout__button adyen-checkout__button--inline adyen-checkout__button--link adyen-checkout__address-search__manual-add__button\"\n onClick={onManualAddress}\n >\n {'+ ' + i18n.get('address.enterManually')}\n </button>\n </span>\n )}\n </div>\n );\n}\n"],"names":["AddressSearch","onAddressLookup","onAddressSelected","onSelect","onManualAddress","externalErrorMessage","hideManualButton","showContextualElement","contextualText","placeholder","addressSearchDebounceMs","formattedData","setFormattedData","useState","originalData","setOriginalData","errorMessage","setErrorMessage","i18n","useCoreContext","handlePromiseReject","useCallback","reason","onTextInput","inputValue","Promise","resolve","reject","then","searchArray","map","id","name","catch","useEffect","debounceInputHandler","useMemo","debounce","h","div","className","Field","label","get","classNameModifiers","Select","onInput","items","onChange","event","target","value","find","item","fullData","disableTextFilter","blurOnClose","span","button","type","onClick"],"mappings":"saA2Ce,SAASA,GAAcC,gBAClCA,EAAeC,kBACfA,EAAiBC,SACjBA,EAAQC,gBACRA,EAAeC,qBACfA,EAAoBC,iBACpBA,EAAgBC,sBAChBA,EAAqBC,eACrBA,EAAcC,YACdA,EAAWC,wBACXA,IAEA,MAAOC,EAAeC,GAAoBC,EAA8B,KACjEC,EAAcC,GAAmBF,EAA8B,KAE/DG,EAAcC,GAAmBJ,EAAS,KAE3CK,KAAEA,GAASC,IAGXC,EAAsBC,EAAaC,IACjCA,GAAQN,cACRC,EAAgBK,EAAON,eAE5B,IAEGO,EAAcF,EACfG,IACG,IAAIC,QAAkC,CAACC,EAASC,KACvC1B,EAAgBuB,EAAY,CAAEE,UAASC,aAE3CC,KAAKC,IACFd,EAAgBc,GAChBjB,EAAiCiB,EAfZC,IAAI,EAAGC,KAAIC,WAAM,CAAQD,KAAIC,WAgBlDf,EAAgB,MAEnBgB,MAAMX,GAAUF,EAAoBE,KAE7C,CAACrB,IAILiC,EAAU,KACNjB,EAAgBZ,IACjB,CAACA,IAEJ,MAyBM8B,EAAuBC,EAAQ,IAAMC,EAASd,EAAab,GAA0B,IAE3F,OAGI4B,EAACC,MAAAA,CAAIC,UAAW,8DACZF,EAACG,EAAAA,CACGC,MAAOxB,EAAKyB,IAAI,WAChBC,mBAAoB,CAAC,kBACrB5B,aAAcA,EACdgB,KAAM,iBACNzB,sBAAuBA,EACvBC,eAAgBA,GAEhB8B,EAACO,EAAAA,CACGb,KAAM,iBACNQ,UAAW,2CACX/B,YAAaA,EACbqC,QAASX,EACTY,MAAOpC,EACPqC,SA7CKC,IACjB,IAAKA,EAAMC,OAAOC,MAEd,YADAlC,EAAgBC,EAAKyB,IAAI,8BAG7B,MAAMQ,EAAQrC,EAAasC,KAAKC,GAAQA,EAAKtB,KAAOkB,EAAMC,OAAOC,OAGjE,GAAiC,mBAAtBjD,EAGP,OAFAC,EAASgD,QACTvC,EAAiB,IAKrB,IAAIa,QAA2B,CAACC,EAASC,KAChCzB,EAAkBiD,EAAO,CAAEzB,UAASC,aAExCC,KAAK0B,IACFnD,EAASmD,GACT1C,EAAiB,MAEpBqB,MAAMX,GAAUF,EAAoBE,KAwB7BiC,mBAAmB,EACnBC,aAAa,MAGnBlD,GACEgC,EAACmB,OAAAA,CAAKjB,UAAU,8CACZF,EAACoB,SAAAA,CACGC,KAAK,SACLnB,UAAU,wIACVoB,QAASxD,GAER,KAAOc,EAAKyB,IAAI,2BAMzC"}
1
+ {"version":3,"file":"AddressSearch.js","sources":["../../../../../../src/components/internal/Address/components/AddressSearch.tsx"],"sourcesContent":["import Field from '../../FormFields/Field';\nimport { h } from 'preact';\nimport { AddressLookupItem } from '../types';\nimport { useCallback, useEffect, useState, useMemo } from 'preact/hooks';\nimport './AddressSearch.scss';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport { debounce } from '../../../../utils/debounce';\nimport Select from '../../FormFields/Select';\nimport { AddressData } from '../../../../types';\n\nexport type OnAddressLookupType = (\n value: string,\n actions: {\n resolve: (value: Array<AddressLookupItem>) => void;\n reject: (reason?: RejectionReason) => void;\n }\n) => Promise<void>;\n\nexport type OnAddressSelectedType = (\n value: AddressLookupItem,\n actions: {\n resolve: (value: AddressLookupItem) => void;\n reject: (reason?: RejectionReason) => void;\n }\n) => Promise<void>;\n\ninterface AddressSearchProps {\n onAddressLookup?: OnAddressLookupType;\n onAddressSelected?: OnAddressSelectedType;\n onSelect: (addressItem: AddressData) => void;\n onManualAddress: () => void;\n externalErrorMessage: string;\n hideManualButton: boolean;\n showContextualElement?: boolean;\n contextualText?: string;\n placeholder?: string;\n addressSearchDebounceMs?: number;\n}\n\ninterface RejectionReason {\n errorMessage: string;\n}\n\nexport default function AddressSearch({\n onAddressLookup,\n onAddressSelected,\n onSelect,\n onManualAddress,\n externalErrorMessage,\n hideManualButton,\n showContextualElement,\n contextualText,\n placeholder,\n addressSearchDebounceMs\n}: Readonly<AddressSearchProps>) {\n const [formattedData, setFormattedData] = useState<AddressLookupItem[]>([]);\n const [originalData, setOriginalData] = useState<AddressLookupItem[]>([]);\n\n const [errorMessage, setErrorMessage] = useState('');\n\n const { i18n } = useCoreContext();\n const mapDataToSelect = data => data.map(({ id, name }) => ({ id, name }));\n\n const handlePromiseReject = useCallback((reason: RejectionReason) => {\n if (reason?.errorMessage) {\n setErrorMessage(reason.errorMessage);\n }\n }, []);\n\n const onTextInput = useCallback(\n (inputValue: string) => {\n new Promise<Array<AddressLookupItem>>((resolve, reject) => {\n void onAddressLookup(inputValue, { resolve, reject });\n })\n .then(searchArray => {\n setOriginalData(searchArray);\n setFormattedData(mapDataToSelect(searchArray));\n setErrorMessage('');\n })\n .catch(reason => handlePromiseReject(reason));\n },\n [onAddressLookup]\n );\n\n // update error message when there's a new one\n useEffect(() => {\n setErrorMessage(externalErrorMessage);\n }, [externalErrorMessage]);\n\n const onSelectItem = event => {\n if (!event.target.value) {\n setErrorMessage(i18n.get('address.errors.incomplete'));\n return;\n }\n const value = originalData.find(item => item.id === event.target.value);\n\n // 1. in case we don't get a function just select item\n if (typeof onAddressSelected !== 'function') {\n onSelect(value);\n setFormattedData([]);\n return;\n }\n\n // 2. in case callback is provided, create and call onAddressSelected\n new Promise<AddressLookupItem>((resolve, reject) => {\n void onAddressSelected(value, { resolve, reject });\n })\n .then(fullData => {\n onSelect(fullData);\n setFormattedData([]);\n })\n .catch(reason => handlePromiseReject(reason));\n };\n\n const debounceInputHandler = useMemo(() => debounce(onTextInput, addressSearchDebounceMs), []);\n\n return (\n // The search field is intentionally rendered before the manual entry button in the DOM.\n // See: ../a11y.md\n <div className={'adyen-checkout__address-search adyen-checkout__field-group'}>\n <Field\n label={i18n.get('address')}\n classNameModifiers={['address-search']}\n errorMessage={errorMessage}\n name={'address-search'}\n showContextualElement={showContextualElement}\n contextualText={contextualText}\n >\n <Select\n name={'address-search'}\n className={'adyen-checkout__address-search__dropdown'}\n placeholder={placeholder}\n onInput={debounceInputHandler}\n items={formattedData}\n onChange={onSelectItem}\n disableTextFilter={true}\n blurOnClose={true}\n />\n </Field>\n {!hideManualButton && (\n <span className=\"adyen-checkout__address-search__manual-add\">\n <button\n type=\"button\"\n className=\"adyen-checkout__button adyen-checkout__button--inline adyen-checkout__button--link adyen-checkout__address-search__manual-add__button\"\n onClick={onManualAddress}\n >\n {'+ ' + i18n.get('address.enterManually')}\n </button>\n </span>\n )}\n </div>\n );\n}\n"],"names":["AddressSearch","onAddressLookup","onAddressSelected","onSelect","onManualAddress","externalErrorMessage","hideManualButton","showContextualElement","contextualText","placeholder","addressSearchDebounceMs","formattedData","setFormattedData","useState","originalData","setOriginalData","errorMessage","setErrorMessage","i18n","useCoreContext","handlePromiseReject","useCallback","reason","onTextInput","inputValue","Promise","resolve","reject","then","searchArray","map","id","name","catch","useEffect","debounceInputHandler","useMemo","debounce","h","div","className","Field","label","get","classNameModifiers","Select","onInput","items","onChange","event","target","value","find","item","fullData","disableTextFilter","blurOnClose","span","button","type","onClick"],"mappings":"saA2Ce,SAASA,GAAcC,gBAClCA,EAAeC,kBACfA,EAAiBC,SACjBA,EAAQC,gBACRA,EAAeC,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MAAMX,GAAUF,EAAoBE,KAwB7BiC,mBAAmB,EACnBC,aAAa,MAGnBlD,GACEgC,EAACmB,OAAAA,CAAKjB,UAAU,8CACZF,EAACoB,SAAAA,CACGC,KAAK,SACLnB,UAAU,wIACVoB,QAASxD,GAER,KAAOc,EAAKyB,IAAI,2BAMzC"}
@@ -1 +1 @@
1
- {"version":3,"file":"FieldContainer.js","sources":["../../../../../../src/components/internal/Address/components/FieldContainer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Field from '../../FormFields/Field';\nimport StateField from './StateField';\nimport CountryField from './CountryField';\nimport { AddressStateError, AddressType, FieldContainerProps } from '../types';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport Language from '../../../../language/Language';\nimport InputText from '../../FormFields/InputText';\nimport { AutocompleteValue } from '../../FormFields/types';\nimport { ADDRESS_FIELD_TOKEN_MAP } from '../constants';\n\nfunction getErrorMessage(errors: AddressStateError, fieldName: string, i18n: Language, label: string): string | boolean {\n if (typeof errors[fieldName]?.errorMessage === 'object') {\n const { translationKey, translationObject } = errors[fieldName].errorMessage;\n return i18n.get(translationKey, translationObject);\n }\n // Default error msg: Enter the [label name]\n const errorMsg = i18n.get(errors[fieldName]?.errorMessage, { values: { label: label.toLowerCase() } });\n return errorMsg || !!errors[fieldName];\n}\n\n/**\n * USAGE: Specifically defined as a util to provide a wrapper for fields created within the Address component\n *\n * NOT TO BE USED: if you just want to add a Country or State dropdown outside of an Address component\n * - then you should implement <CountryField> or <StateField> directly\n */\nfunction getAddressAutocomplete(fieldName: string, addressType: AddressType): AutocompleteValue {\n const token = ADDRESS_FIELD_TOKEN_MAP[fieldName];\n if (!token) return undefined;\n if (addressType === 'billingAddress') return `billing ${token}` as AutocompleteValue;\n if (addressType === 'deliveryAddress') return `shipping ${token}` as AutocompleteValue;\n // Fallback: bare token (no prefix) when address type is unspecified\n return token as AutocompleteValue;\n}\n\nfunction FieldContainer(props: Readonly<FieldContainerProps>) {\n const { i18n } = useCoreContext();\n const { classNameModifiers = [], data, errors, valid, fieldName, onInput, onBlur, trimOnBlur, maxLength, disabled, addressType } = props;\n\n const value: string = data[fieldName];\n const selectedCountry: string = data.country;\n const isOptional: boolean = props.specifications.countryHasOptionalField(selectedCountry, fieldName);\n const labelKey: string = props.specifications.getKeyForField(fieldName, selectedCountry);\n const optionalLabel = isOptional ? ` ${i18n.get('field.title.optional')}` : '';\n const label = `${i18n.get(labelKey)}${optionalLabel}`;\n const errorMessage = getErrorMessage(errors, fieldName, i18n, label);\n\n switch (fieldName) {\n case 'country':\n return (\n <CountryField\n allowedCountries={props.allowedCountries}\n classNameModifiers={classNameModifiers}\n label={label}\n errorMessage={errorMessage}\n onDropdownChange={props.onDropdownChange}\n value={value}\n required={!isOptional}\n />\n );\n case 'stateOrProvince':\n return (\n <StateField\n classNameModifiers={classNameModifiers}\n label={label}\n errorMessage={errorMessage}\n onDropdownChange={props.onDropdownChange}\n selectedCountry={selectedCountry}\n specifications={props.specifications}\n value={value}\n required={!isOptional}\n />\n );\n default:\n return (\n <Field\n label={label}\n classNameModifiers={classNameModifiers}\n errorMessage={errorMessage}\n isValid={valid[fieldName]}\n name={fieldName}\n i18n={i18n}\n onFocus={e => props.onFieldFocusAnalytics(fieldName, e)}\n onBlur={e => props.onFieldBlurAnalytics(fieldName, e)}\n >\n <InputText\n name={fieldName}\n classNameModifiers={classNameModifiers}\n value={value}\n onInput={onInput}\n onBlur={onBlur}\n maxlength={maxLength}\n trimOnBlur={trimOnBlur}\n disabled={disabled}\n required={!isOptional}\n autocomplete={getAddressAutocomplete(fieldName, addressType)}\n />\n </Field>\n );\n }\n}\n\nexport default FieldContainer;\n"],"names":["getAddressAutocomplete","fieldName","addressType","token","ADDRESS_FIELD_TOKEN_MAP","FieldContainer","props","i18n","useCoreContext","classNameModifiers","data","errors","valid","onInput","onBlur","trimOnBlur","maxLength","disabled","value","selectedCountry","country","isOptional","specifications","countryHasOptionalField","labelKey","getKeyForField","optionalLabel","get","label","errorMessage","translationKey","translationObject","values","toLowerCase","getErrorMessage","h","CountryField","allowedCountries","onDropdownChange","required","StateField","Field","isValid","name","onFocus","e","onFieldFocusAnalytics","onFieldBlurAnalytics","InputText","maxlength","autocomplete"],"mappings":"2WA2BA,SAASA,EAAuBC,EAAmBC,GAC/C,MAAMC,EAAQC,EAAwBH,GACtC,GAAKE,EACL,MAAoB,mBAAhBD,EAAyC,WAAWC,IACpC,oBAAhBD,EAA0C,YAAYC,IAEnDA,CACX,CAEA,SAASE,EAAeC,GACpB,MAAMC,KAAEA,GAASC,KACXC,mBAAEA,EAAqB,GAAEC,KAAEA,EAAIC,OAAEA,EAAMC,MAAEA,EAAKX,UAAEA,EAASY,QAAEA,EAAOC,OAAEA,EAAMC,WAAEA,EAAUC,UAAEA,EAASC,SAAEA,EAAQf,YAAEA,GAAgBI,EAE7HY,EAAgBR,EAAKT,GACrBkB,EAA0BT,EAAKU,QAC/BC,EAAsBf,EAAMgB,eAAeC,wBAAwBJ,EAAiBlB,GACpFuB,EAAmBlB,EAAMgB,eAAeG,eAAexB,EAAWkB,GAClEO,EAAgBL,EAAa,IAAId,EAAKoB,IAAI,0BAA4B,GACtEC,EAAQ,GAAGrB,EAAKoB,IAAIH,KAAYE,IAChCG,EAnCV,SAAyBlB,EAA2BV,EAAmBM,EAAgBqB,GACnF,GAA+C,iBAApCjB,EAAOV,IAAY4B,aAA2B,CACrD,MAAMC,eAAEA,EAAcC,kBAAEA,GAAsBpB,EAAOV,GAAW4B,aAChE,OAAOtB,EAAKoB,IAAIG,EAAgBC,EACpC,CAGA,OADiBxB,EAAKoB,IAAIhB,EAAOV,IAAY4B,aAAc,CAAEG,OAAQ,CAAEJ,MAAOA,EAAMK,oBAC/DtB,EAAOV,EAChC,CA2ByBiC,CAAgBvB,EAAQV,EAAWM,EAAMqB,GAE9D,OAAQ3B,GACJ,IAAK,UACD,OACIkC,EAACC,EAAAA,CACGC,iBAAkB/B,EAAM+B,iBACxB5B,mBAAoBA,EACpBmB,MAAOA,EACPC,aAAcA,EACdS,iBAAkBhC,EAAMgC,iBACxBpB,MAAOA,EACPqB,UAAWlB,IAGvB,IAAK,kBACD,OACIc,EAACK,EAAAA,CACG/B,mBAAoBA,EACpBmB,MAAOA,EACPC,aAAcA,EACdS,iBAAkBhC,EAAMgC,iBACxBnB,gBAAiBA,EACjBG,eAAgBhB,EAAMgB,eACtBJ,MAAOA,EACPqB,UAAWlB,IAGvB,QACI,OACIc,EAACM,EAAAA,CACGb,MAAOA,EACPnB,mBAAoBA,EACpBoB,aAAcA,EACda,QAAS9B,EAAMX,GACf0C,KAAM1C,EACNM,KAAMA,EACNqC,QAASC,GAAKvC,EAAMwC,sBAAsB7C,EAAW4C,GACrD/B,OAAQ+B,GAAKvC,EAAMyC,qBAAqB9C,EAAW4C,IAEnDV,EAACa,EAAAA,CACGL,KAAM1C,EACNQ,mBAAoBA,EACpBS,MAAOA,EACPL,QAASA,EACTC,OAAQA,EACRmC,UAAWjC,EACXD,WAAYA,EACZE,SAAUA,EACVsB,UAAWlB,EACX6B,aAAclD,EAAuBC,EAAWC,MAKxE"}
1
+ {"version":3,"file":"FieldContainer.js","sources":["../../../../../../src/components/internal/Address/components/FieldContainer.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Field from '../../FormFields/Field';\nimport StateField from './StateField';\nimport CountryField from './CountryField';\nimport { AddressStateError, AddressType, FieldContainerProps } from '../types';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport Language from '../../../../language/Language';\nimport InputText from '../../FormFields/InputText';\nimport { AutocompleteValue } from '../../FormFields/types';\nimport { ADDRESS_FIELD_TOKEN_MAP } from '../constants';\nimport { AddressField } from '../../../../types';\n\nfunction getErrorMessage(errors: AddressStateError, fieldName: string, i18n: Language, label: string): string | boolean {\n if (typeof errors[fieldName]?.errorMessage === 'object') {\n const { translationKey, translationObject } = errors[fieldName].errorMessage;\n return i18n.get(translationKey, translationObject);\n }\n // Default error msg: Enter the [label name]\n const errorMsg = i18n.get(errors[fieldName]?.errorMessage, { values: { label: label.toLowerCase() } });\n return errorMsg || !!errors[fieldName];\n}\n\n/**\n * USAGE: Specifically defined as a util to provide a wrapper for fields created within the Address component\n *\n * NOT TO BE USED: if you just want to add a Country or State dropdown outside of an Address component\n * - then you should implement <CountryField> or <StateField> directly\n */\nfunction getAddressAutocomplete(fieldName: string, addressType: AddressType): AutocompleteValue {\n const token = ADDRESS_FIELD_TOKEN_MAP[fieldName];\n if (!token) return undefined;\n if (addressType === 'billingAddress') return `billing ${token}` as AutocompleteValue;\n if (addressType === 'deliveryAddress') return `shipping ${token}` as AutocompleteValue;\n // Fallback: bare token (no prefix) when address type is unspecified\n return token as AutocompleteValue;\n}\n\nfunction FieldContainer(props: Readonly<FieldContainerProps>) {\n const { i18n } = useCoreContext();\n const { classNameModifiers = [], data, errors, valid, fieldName, onInput, onBlur, trimOnBlur, maxLength, disabled, addressType } = props;\n\n const value: string = data[fieldName];\n const selectedCountry: string = data.country;\n const isOptional: boolean = props.specifications.countryHasOptionalField(selectedCountry, fieldName as AddressField);\n const labelKey: string = props.specifications.getKeyForField(fieldName, selectedCountry);\n const optionalLabel = isOptional ? ` ${i18n.get('field.title.optional')}` : '';\n const label = `${i18n.get(labelKey)}${optionalLabel}`;\n const errorMessage = getErrorMessage(errors, fieldName, i18n, label);\n\n switch (fieldName) {\n case 'country':\n return (\n <CountryField\n allowedCountries={props.allowedCountries}\n classNameModifiers={classNameModifiers}\n label={label}\n errorMessage={errorMessage}\n onDropdownChange={props.onDropdownChange}\n value={value}\n required={!isOptional}\n />\n );\n case 'stateOrProvince':\n return (\n <StateField\n classNameModifiers={classNameModifiers}\n label={label}\n errorMessage={errorMessage}\n onDropdownChange={props.onDropdownChange}\n selectedCountry={selectedCountry}\n specifications={props.specifications}\n value={value}\n required={!isOptional}\n />\n );\n default:\n return (\n <Field\n label={label}\n classNameModifiers={classNameModifiers}\n errorMessage={errorMessage}\n isValid={valid[fieldName]}\n name={fieldName}\n i18n={i18n}\n onFocus={e => props.onFieldFocusAnalytics(fieldName, e)}\n onBlur={e => props.onFieldBlurAnalytics(fieldName, e)}\n >\n <InputText\n name={fieldName}\n classNameModifiers={classNameModifiers}\n value={value}\n onInput={onInput}\n onBlur={onBlur}\n maxlength={maxLength}\n trimOnBlur={trimOnBlur}\n disabled={disabled}\n required={!isOptional}\n autocomplete={getAddressAutocomplete(fieldName, addressType)}\n />\n </Field>\n );\n }\n}\n\nexport default FieldContainer;\n"],"names":["getAddressAutocomplete","fieldName","addressType","token","ADDRESS_FIELD_TOKEN_MAP","FieldContainer","props","i18n","useCoreContext","classNameModifiers","data","errors","valid","onInput","onBlur","trimOnBlur","maxLength","disabled","value","selectedCountry","country","isOptional","specifications","countryHasOptionalField","labelKey","getKeyForField","optionalLabel","get","label","errorMessage","translationKey","translationObject","values","toLowerCase","getErrorMessage","h","CountryField","allowedCountries","onDropdownChange","required","StateField","Field","isValid","name","onFocus","e","onFieldFocusAnalytics","onFieldBlurAnalytics","InputText","maxlength","autocomplete"],"mappings":"2WA4BA,SAASA,EAAuBC,EAAmBC,GAC/C,MAAMC,EAAQC,EAAwBH,GACtC,GAAKE,EACL,MAAoB,mBAAhBD,EAAyC,WAAWC,IACpC,oBAAhBD,EAA0C,YAAYC,IAEnDA,CACX,CAEA,SAASE,EAAeC,GACpB,MAAMC,KAAEA,GAASC,KACXC,mBAAEA,EAAqB,GAAEC,KAAEA,EAAIC,OAAEA,EAAMC,MAAEA,EAAKX,UAAEA,EAASY,QAAEA,EAAOC,OAAEA,EAAMC,WAAEA,EAAUC,UAAEA,EAASC,SAAEA,EAAQf,YAAEA,GAAgBI,EAE7HY,EAAgBR,EAAKT,GACrBkB,EAA0BT,EAAKU,QAC/BC,EAAsBf,EAAMgB,eAAeC,wBAAwBJ,EAAiBlB,GACpFuB,EAAmBlB,EAAMgB,eAAeG,eAAexB,EAAWkB,GAClEO,EAAgBL,EAAa,IAAId,EAAKoB,IAAI,0BAA4B,GACtEC,EAAQ,GAAGrB,EAAKoB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validator-utils.js";const a=t=>({formatterFn:a=>a.replace(o("^\\d","g"),"").substring(0,t),format:new Array(t).fill("9").join(""),maxlength:t}),e=o(t),r=o=>o.replace(e,""),l={postalCode:{formatterFn:(o,t)=>{const a=t.state.data.country,e=s[a]?.postalCode.formatterFn;return e?e(o):o}},street:{formatterFn:r},houseNumberOrName:{formatterFn:r},city:{formatterFn:r}},s={AT:{postalCode:a(4)},AU:{postalCode:a(4)},BE:{postalCode:a(4)},BG:{postalCode:a(4)},BR:{postalCode:{formatterFn:t=>{const a=t.replace(o("^\\d-","g"),""),e=a.includes("-")?9:8;return a.substring(0,e)},format:"12345678 or 12345-678",maxlength:9}},CA:{postalCode:{format:"A9A 9A9 or A9A9A9",maxlength:7}},CH:{postalCode:a(4)},CY:{postalCode:a(4)},CZ:{postalCode:{format:"999 99",maxlength:6}},DE:{postalCode:a(5)},DK:{postalCode:{format:"9999",maxlength:7}},EE:{postalCode:a(5)},ES:{postalCode:a(5)},FI:{postalCode:a(5)},FR:{postalCode:a(5)},GB:{postalCode:{formatterFn:a=>a.replace(o(t),"").substring(0,8),format:"AA99 9AA or A99 9AA or A9 9AA",maxlength:8}},GR:{postalCode:{format:"999 99",maxlength:6}},HR:{postalCode:{format:"[1-5]9999",maxlength:5}},HU:{postalCode:a(4)},IE:{postalCode:{format:"A99 A999",maxlength:8}},IS:{postalCode:a(3)},IT:{postalCode:a(5)},LI:{postalCode:a(4)},LT:{postalCode:{format:"9999 or 99999 or LT-99999",maxlength:8}},LU:{postalCode:a(4)},LV:{postalCode:{format:"9999 or LV-9999",maxlength:7}},MC:{postalCode:{format:"980NN",maxlength:5}},MT:{postalCode:{format:"AA99 or AAA99 or AA9999 or AAA9999",maxlength:8}},MY:{postalCode:a(5)},NL:{postalCode:{format:"9999AA",maxlength:7}},NZ:{postalCode:a(4)},NO:{postalCode:a(4)},PL:{postalCode:{formatterFn:t=>{const a=t.replace(o("^\\d-","g"),""),e=a.includes("-")?6:5;return a.substring(0,e)},format:"99999 or 99-999",maxlength:6}},PT:{postalCode:{formatterFn:t=>t.replace(o("^\\d-","g"),"").substring(0,8),format:"9999-999",maxlength:8}},RO:{postalCode:a(6)},SI:{postalCode:{format:"9999 or SI-9999",maxlength:7}},SE:{postalCode:a(5)},SG:{postalCode:a(6)},SK:{postalCode:{format:"99999 or SK-99999",maxlength:8}},JP:{postalCode:{format:"999-9999",maxlength:8}},US:{postalCode:{formatterFn:t=>{const a=t.replace(o("^\\d-","g"),""),e=a.includes("-")?10:5;return a.substring(0,e)},format:"99999 or 99999-9999"}}};export{l as addressFormatters,s as countrySpecificFormatters};
1
+ import{getFormattingRegEx as o,stripInvalidChars as t}from"../../../utils/validator-utils.js";const a=t=>({formatterFn:a=>a.replace(o("^\\d","g"),"").substring(0,t),format:new Array(t).fill("9").join(""),maxlength:t}),e=o=>o,r={postalCode:{formatterFn:(o,t)=>{const a=t.state.data.country,e=l[a]?.postalCode.formatterFn;return e?e(o):o}},street:{formatterFn:e},houseNumberOrName:{formatterFn:e},city:{formatterFn:e}},l={AT:{postalCode:a(4)},AU:{postalCode:a(4)},BE:{postalCode:a(4)},BG:{postalCode:a(4)},BR:{postalCode:{formatterFn:t=>{const a=t.replace(o("^\\d-","g"),""),e=a.includes("-")?9:8;return a.substring(0,e)},format:"12345678 or 12345-678",maxlength:9}},CA:{postalCode:{format:"A9A 9A9 or A9A9A9",maxlength:7}},CH:{postalCode:a(4)},CY:{postalCode:a(4)},CZ:{postalCode:{format:"999 99",maxlength:6}},DE:{postalCode:a(5)},DK:{postalCode:{format:"9999",maxlength:7}},EE:{postalCode:a(5)},ES:{postalCode:a(5)},FI:{postalCode:a(5)},FR:{postalCode:a(5)},GB:{postalCode:{formatterFn:o=>t(o).substring(0,8),format:"AA99 9AA or A99 9AA or A9 9AA",maxlength:8}},GR:{postalCode:{format:"999 99",maxlength:6}},HR:{postalCode:{format:"[1-5]9999",maxlength:5}},HU:{postalCode:a(4)},IE:{postalCode:{format:"A99 A999",maxlength:8}},IS:{postalCode:a(3)},IT:{postalCode:a(5)},LI:{postalCode:a(4)},LT:{postalCode:{format:"9999 or 99999 or LT-99999",maxlength:8}},LU:{postalCode:a(4)},LV:{postalCode:{format:"9999 or LV-9999",maxlength:7}},MC:{postalCode:{format:"980NN",maxlength:5}},MT:{postalCode:{format:"AA99 or AAA99 or AA9999 or AAA9999",maxlength:8}},MY:{postalCode:a(5)},NL:{postalCode:{format:"9999AA",maxlength:7}},NZ:{postalCode:a(4)},NO:{postalCode:a(4)},PL:{postalCode:{formatterFn:t=>{const a=t.replace(o("^\\d-","g"),""),e=a.includes("-")?6:5;return a.substring(0,e)},format:"99999 or 99-999",maxlength:6}},PT:{postalCode:{formatterFn:t=>t.replace(o("^\\d-","g"),"").substring(0,8),format:"9999-999",maxlength:8}},RO:{postalCode:a(6)},SI:{postalCode:{format:"9999 or SI-9999",maxlength:7}},SE:{postalCode:a(5)},SG:{postalCode:a(6)},SK:{postalCode:{format:"99999 or SK-99999",maxlength:8}},JP:{postalCode:{format:"999-9999",maxlength:8}},US:{postalCode:{formatterFn:t=>{const a=t.replace(o("^\\d-","g"),""),e=a.includes("-")?10:5;return a.substring(0,e)},format:"99999 or 99999-9999"}}};export{r as addressFormatters,l as countrySpecificFormatters};
2
2
  //# sourceMappingURL=validate.formats.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate.formats.js","sources":["../../../../../src/components/internal/Address/validate.formats.ts"],"sourcesContent":["import { FormatterContext } from '../../../utils/Formatters/types';\nimport { CountryFormatRules, FormatRules } from '../../../utils/Validator/types';\nimport { Formatter } from '../../../utils/useForm/types';\nimport { getFormattingRegEx, SPECIAL_CHARS } from '../../../utils/validator-utils';\n\nconst asCountryFormatRules = <T extends CountryFormatRules>(rules: T): T & CountryFormatRules => rules;\n\nconst createFormatByDigits = (digits: number): Formatter => {\n const format = new Array(digits).fill('9').join('');\n return {\n // Formatter - excludes non digits and limits to maxlength\n formatterFn: val => val.replace(getFormattingRegEx('^\\\\d', 'g'), '').substring(0, digits),\n format,\n maxlength: digits\n };\n};\n\nconst specialCharsRegEx = getFormattingRegEx(SPECIAL_CHARS);\nconst formattingFn = (val: string) => val.replace(specialCharsRegEx, '');\n\nexport const addressFormatters: FormatRules = {\n postalCode: {\n formatterFn: (val: string, context: FormatterContext) => {\n const country = context.state.data.country;\n\n // Country specific formatting rule\n const specificRule = countrySpecificFormatters[country]?.postalCode.formatterFn;\n if (specificRule) {\n return specificRule(val);\n }\n\n // Default formatting rule: allow anything\n return val;\n }\n },\n street: {\n formatterFn: formattingFn\n },\n houseNumberOrName: {\n formatterFn: formattingFn\n },\n city: {\n formatterFn: formattingFn\n }\n};\n\n// TODO make proper formatter fns for those entries that don't just have a straightforward, x number of digits, no spaces, format\n// check against our internal documentation on address postal code\n// which, for example, says BR isn't just 8 digits (it can be spilt by a hyphen) & CZ can also be 5 digits, no spaces\nexport const countrySpecificFormatters = asCountryFormatRules({\n AT: {\n postalCode: createFormatByDigits(4)\n },\n AU: {\n postalCode: createFormatByDigits(4)\n },\n BE: {\n postalCode: createFormatByDigits(4)\n },\n BG: {\n postalCode: createFormatByDigits(4)\n },\n BR: {\n postalCode: {\n // Formatter - excludes non digits, but allows hyphens, and limits to a maxlength that varies depending on whether a hyphen is present or not\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n const maxlength = nuVal.includes('-') ? 9 : 8;\n return nuVal.substring(0, maxlength);\n },\n format: '12345678 or 12345-678',\n maxlength: 9\n }\n },\n CA: {\n postalCode: {\n format: 'A9A 9A9 or A9A9A9',\n maxlength: 7\n }\n },\n CH: {\n postalCode: createFormatByDigits(4)\n },\n CY: {\n postalCode: createFormatByDigits(4)\n },\n CZ: {\n postalCode: {\n format: '999 99',\n maxlength: 6\n }\n },\n DE: {\n postalCode: createFormatByDigits(5)\n },\n DK: {\n postalCode: {\n format: '9999',\n maxlength: 7\n }\n },\n EE: {\n postalCode: createFormatByDigits(5)\n },\n ES: {\n postalCode: createFormatByDigits(5)\n },\n FI: {\n postalCode: createFormatByDigits(5)\n },\n FR: {\n postalCode: createFormatByDigits(5)\n },\n GB: {\n postalCode: {\n // Disallow special chars & set to maxlength\n formatterFn: val => val.replace(getFormattingRegEx(SPECIAL_CHARS), '').substring(0, 8),\n format: 'AA99 9AA or A99 9AA or A9 9AA',\n maxlength: 8\n }\n },\n GR: {\n postalCode: {\n format: '999 99',\n maxlength: 6\n }\n },\n HR: {\n postalCode: {\n format: '[1-5]9999',\n maxlength: 5\n }\n },\n HU: {\n postalCode: createFormatByDigits(4)\n },\n IE: {\n postalCode: {\n format: 'A99 A999',\n maxlength: 8\n }\n },\n IS: {\n postalCode: createFormatByDigits(3)\n },\n IT: {\n postalCode: createFormatByDigits(5)\n },\n LI: {\n postalCode: createFormatByDigits(4)\n },\n LT: {\n postalCode: {\n format: '9999 or 99999 or LT-99999',\n maxlength: 8\n }\n },\n LU: {\n postalCode: createFormatByDigits(4)\n },\n LV: {\n postalCode: {\n format: '9999 or LV-9999',\n maxlength: 7\n }\n },\n MC: {\n postalCode: {\n format: '980NN',\n maxlength: 5\n }\n },\n MT: {\n postalCode: {\n format: 'AA99 or AAA99 or AA9999 or AAA9999',\n maxlength: 8\n }\n },\n MY: {\n postalCode: createFormatByDigits(5)\n },\n NL: {\n postalCode: {\n format: '9999AA',\n maxlength: 7\n }\n },\n NZ: {\n postalCode: createFormatByDigits(4)\n },\n NO: {\n postalCode: createFormatByDigits(4)\n },\n PL: {\n postalCode: {\n // Formatter - excludes non digits, but allows hyphens, and limits to a maxlength that varies depending on whether a hyphen is present or not\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n const maxlength = nuVal.includes('-') ? 6 : 5;\n return nuVal.substring(0, maxlength);\n },\n format: '99999 or 99-999',\n maxlength: 6\n }\n },\n PT: {\n postalCode: {\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n return nuVal.substring(0, 8);\n },\n format: '9999-999',\n maxlength: 8\n }\n },\n RO: {\n postalCode: createFormatByDigits(6)\n },\n SI: {\n postalCode: {\n format: '9999 or SI-9999',\n maxlength: 7\n }\n },\n SE: {\n postalCode: createFormatByDigits(5)\n },\n SG: {\n postalCode: createFormatByDigits(6)\n },\n SK: {\n postalCode: {\n format: '99999 or SK-99999',\n maxlength: 8\n }\n },\n JP: {\n postalCode: {\n format: '999-9999',\n maxlength: 8\n }\n },\n US: {\n postalCode: {\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n const maxlength = nuVal.includes('-') ? 10 : 5;\n return nuVal.substring(0, maxlength);\n },\n format: '99999 or 99999-9999'\n }\n }\n});\n"],"names":["createFormatByDigits","digits","formatterFn","val","replace","getFormattingRegEx","substring","format","Array","fill","join","maxlength","specialCharsRegEx","SPECIAL_CHARS","formattingFn","addressFormatters","postalCode","context","country","state","data","specificRule","countrySpecificFormatters","street","houseNumberOrName","city","AT","AU","BE","BG","BR","nuVal","includes","CA","CH","CY","CZ","DE","DK","EE","ES","FI","FR","GB","GR","HR","HU","IE","IS","IT","LI","LT","LU","LV","MC","MT","MY","NL","NZ","NO","PL","PT","RO","SI","SE","SG","SK","JP","US"],"mappings":"0FAKA,MAEMA,EAAwBC,IAEnB,CAEHC,YAAaC,GAAOA,EAAIC,QAAQC,EAAmB,OAAQ,KAAM,IAAIC,UAAU,EAAGL,GAClFM,OAJW,IAAIC,MAAMP,GAAQQ,KAAK,KAAKC,KAAK,IAK5CC,UAAWV,IAIbW,EAAoBP,EAAmBQ,GACvCC,EAAgBX,GAAgBA,EAAIC,QAAQQ,EAAmB,IAExDG,EAAiC,CAC1CC,WAAY,CACRd,YAAa,CAACC,EAAac,KACvB,MAAMC,EAAUD,EAAQE,MAAMC,KAAKF,QAG7BG,EAAeC,EAA0BJ,IAAUF,WAAWd,YACpE,OAAImB,EACOA,EAAalB,GAIjBA,IAGfoB,OAAQ,CACJrB,YAAaY,GAEjBU,kBAAm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AU,EAAGK,IAE9BJ,OAAQ"}
1
+ {"version":3,"file":"validate.formats.js","sources":["../../../../../src/components/internal/Address/validate.formats.ts"],"sourcesContent":["import { FormatterContext } from '../../../utils/Formatters/types';\nimport { CountryFormatRules, FormatRules } from '../../../utils/Validator/types';\nimport { Formatter } from '../../../utils/useForm/types';\nimport { getFormattingRegEx, stripInvalidChars } from '../../../utils/validator-utils';\n\nconst asCountryFormatRules = <T extends CountryFormatRules>(rules: T): T & CountryFormatRules => rules;\n\nconst createFormatByDigits = (digits: number): Formatter => {\n const format = new Array(digits).fill('9').join('');\n return {\n // Formatter - excludes non digits and limits to maxlength\n formatterFn: val => val.replace(getFormattingRegEx('^\\\\d', 'g'), '').substring(0, digits),\n format,\n maxlength: digits\n };\n};\n\nconst defaultFormattingFn = (val: string) => val;\n\nexport const addressFormatters: FormatRules = {\n postalCode: {\n formatterFn: (val: string, context: FormatterContext) => {\n const country = context.state.data.country;\n\n // Country specific formatting rule\n const specificRule = countrySpecificFormatters[country]?.postalCode.formatterFn;\n if (specificRule) {\n return specificRule(val);\n }\n\n // Default formatting rule: allow anything\n return val;\n }\n },\n street: {\n formatterFn: defaultFormattingFn\n },\n houseNumberOrName: {\n formatterFn: defaultFormattingFn\n },\n city: {\n formatterFn: defaultFormattingFn\n }\n};\n\n// TODO make proper formatter fns for those entries that don't just have a straightforward, x number of digits, no spaces, format\n// check against our internal documentation on address postal code\n// which, for example, says BR isn't just 8 digits (it can be spilt by a hyphen) & CZ can also be 5 digits, no spaces\nexport const countrySpecificFormatters = asCountryFormatRules({\n AT: {\n postalCode: createFormatByDigits(4)\n },\n AU: {\n postalCode: createFormatByDigits(4)\n },\n BE: {\n postalCode: createFormatByDigits(4)\n },\n BG: {\n postalCode: createFormatByDigits(4)\n },\n BR: {\n postalCode: {\n // Formatter - excludes non digits, but allows hyphens, and limits to a maxlength that varies depending on whether a hyphen is present or not\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n const maxlength = nuVal.includes('-') ? 9 : 8;\n return nuVal.substring(0, maxlength);\n },\n format: '12345678 or 12345-678',\n maxlength: 9\n }\n },\n CA: {\n postalCode: {\n format: 'A9A 9A9 or A9A9A9',\n maxlength: 7\n }\n },\n CH: {\n postalCode: createFormatByDigits(4)\n },\n CY: {\n postalCode: createFormatByDigits(4)\n },\n CZ: {\n postalCode: {\n format: '999 99',\n maxlength: 6\n }\n },\n DE: {\n postalCode: createFormatByDigits(5)\n },\n DK: {\n postalCode: {\n format: '9999',\n maxlength: 7\n }\n },\n EE: {\n postalCode: createFormatByDigits(5)\n },\n ES: {\n postalCode: createFormatByDigits(5)\n },\n FI: {\n postalCode: createFormatByDigits(5)\n },\n FR: {\n postalCode: createFormatByDigits(5)\n },\n GB: {\n postalCode: {\n formatterFn: val => stripInvalidChars(val).substring(0, 8),\n format: 'AA99 9AA or A99 9AA or A9 9AA',\n maxlength: 8\n }\n },\n GR: {\n postalCode: {\n format: '999 99',\n maxlength: 6\n }\n },\n HR: {\n postalCode: {\n format: '[1-5]9999',\n maxlength: 5\n }\n },\n HU: {\n postalCode: createFormatByDigits(4)\n },\n IE: {\n postalCode: {\n format: 'A99 A999',\n maxlength: 8\n }\n },\n IS: {\n postalCode: createFormatByDigits(3)\n },\n IT: {\n postalCode: createFormatByDigits(5)\n },\n LI: {\n postalCode: createFormatByDigits(4)\n },\n LT: {\n postalCode: {\n format: '9999 or 99999 or LT-99999',\n maxlength: 8\n }\n },\n LU: {\n postalCode: createFormatByDigits(4)\n },\n LV: {\n postalCode: {\n format: '9999 or LV-9999',\n maxlength: 7\n }\n },\n MC: {\n postalCode: {\n format: '980NN',\n maxlength: 5\n }\n },\n MT: {\n postalCode: {\n format: 'AA99 or AAA99 or AA9999 or AAA9999',\n maxlength: 8\n }\n },\n MY: {\n postalCode: createFormatByDigits(5)\n },\n NL: {\n postalCode: {\n format: '9999AA',\n maxlength: 7\n }\n },\n NZ: {\n postalCode: createFormatByDigits(4)\n },\n NO: {\n postalCode: createFormatByDigits(4)\n },\n PL: {\n postalCode: {\n // Formatter - excludes non digits, but allows hyphens, and limits to a maxlength that varies depending on whether a hyphen is present or not\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n const maxlength = nuVal.includes('-') ? 6 : 5;\n return nuVal.substring(0, maxlength);\n },\n format: '99999 or 99-999',\n maxlength: 6\n }\n },\n PT: {\n postalCode: {\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n return nuVal.substring(0, 8);\n },\n format: '9999-999',\n maxlength: 8\n }\n },\n RO: {\n postalCode: createFormatByDigits(6)\n },\n SI: {\n postalCode: {\n format: '9999 or SI-9999',\n maxlength: 7\n }\n },\n SE: {\n postalCode: createFormatByDigits(5)\n },\n SG: {\n postalCode: createFormatByDigits(6)\n },\n SK: {\n postalCode: {\n format: '99999 or SK-99999',\n maxlength: 8\n }\n },\n JP: {\n postalCode: {\n format: '999-9999',\n maxlength: 8\n }\n },\n US: {\n postalCode: {\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n const maxlength = nuVal.includes('-') ? 10 : 5;\n return nuVal.substring(0, maxlength);\n },\n format: '99999 or 99999-9999'\n }\n }\n});\n"],"names":["createFormatByDigits","digits","formatterFn","val","replace","getFormattingRegEx","substring","format","Array","fill","join","maxlength","defaultFormattingFn","addressFormatters","postalCode","context","country","state","data","specificRule","countrySpecificFormatters","street","houseNumberOrName","city","AT","AU","BE","BG","BR","nuVal","includes","CA","CH","CY","CZ","DE","DK","EE","ES","FI","FR","GB","stripInvalidChars","GR","HR","HU","IE","IS","IT","LI","LT","LU","LV","MC","MT","MY","NL","NZ","NO","PL","PT","RO","SI","SE","SG","SK","JP","US"],"mappings":"8FAKA,MAEMA,EAAwBC,IAEnB,CAEHC,YAAaC,GAAOA,EAAIC,QAAQC,EAAmB,OAAQ,KAAM,IAAIC,UAAU,EAAGL,GAClFM,OA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iE,GAAI,CACAnD,WAAY,CACRP,OAAQ,oBACRI,UAAW,IAGnBuD,GAAI,CACApD,WAAY,CACRP,OAAQ,WACRI,UAAW,IAGnBwD,GAAI,CACArD,WAAY,CACRZ,YAAaC,IACT,MAAM0B,EAAQ1B,EAAIC,QAAQC,EAAmB,QAAS,KAAM,IACtDM,EAAYkB,EAAMC,SAAS,KAAO,GAAK,EAC7C,OAAOD,EAAMvB,UAAU,EAAGK,IAE9BJ,OAAQ"}
@@ -1,2 +1,2 @@
1
- import{countrySpecificFormatters as t}from"./validate.formats.js";import{ERROR_FIELD_REQUIRED as r,ERROR_INVALID_FORMAT_EXPECTS as e}from"../../../core/Errors/constants.js";import{isEmpty as a}from"../../../utils/validator-utils.js";const n=t=>({pattern:new RegExp(`\\d{${t}}`)}),o=(r,n,o)=>{if(n){if(a(r))return null;o.postalCode.errorMessage={translationKey:e,translationObject:{values:{format:t[n]?.postalCode.format||null}}};const d=s[n]?.pattern;return d?d.test(r):!!r}return!a(r)||null},s={AT:n(4),AU:n(4),BE:{pattern:/(?:(?:[1-9])(?:\d{3}))/},BG:n(4),BR:{pattern:/^\d{5}-?\d{3}$/},CA:{pattern:/(?:[ABCEGHJ-NPRSTVXY]\d[A-Z][ -]?\d[A-Z]\d)/},CH:{pattern:/[1-9]\d{3}/},CY:n(4),CZ:{pattern:/\d{3}\s?\d{2}/},DE:n(5),DK:n(4),EE:n(5),ES:{pattern:/(?:0[1-9]|[1-4]\d|5[0-2])\d{3}/},FI:n(5),FR:n(5),GB:{pattern:/^([A-Za-z][A-Ha-hK-Yk-y]?[0-9][A-Za-z0-9]? ?[0-9][A-Za-z]{2}|[Gg][Ii][Rr] ?0[Aa]{2})$/},GE:n(4),GR:{pattern:/^\d{3}\s{0,1}\d{2}$/},HR:{pattern:/^([1-5])[0-9]{4}$/},HU:n(4),IE:{pattern:/(?:^[AC-FHKNPRTV-Y][0-9]{2}|D6W)[ -]?[0-9AC-FHKNPRTV-Y]{4}/},IS:n(3),IT:n(5),LI:n(4),LT:{pattern:/^(LT-\d{5}|\d{4,5})$/},LU:n(4),LV:{pattern:/^(LV-)[0-9]{4}$/},MC:{pattern:/^980\d{2}$/},MT:{pattern:/^[A-Za-z]{3}\d{4}$/},MY:n(5),NL:{pattern:/(?:NL-)?(?:[1-9]\d{3} ?(?:[A-EGHJ-NPRTVWXZ][A-EGHJ-NPRSTVWXZ]|S[BCEGHJ-NPRTVWXZ]))/},NO:n(4),PL:{pattern:/^\d{2}[-]{0,1}\d{3}$/},PT:{pattern:/^([1-9]\d{3})([- ]?(\d{3})? *)$/},RO:n(6),SI:n(4),SE:n(5),SG:n(6),SK:n(5),US:{pattern:/^\d{5}(?:-\d{4})?$/}},d=t=>{const e={postalCode:{modes:["blur"],validate:r=>o(r,t,e),errorMessage:r}};return e},l=t=>{const e={postalCode:{modes:["blur"],validate:(t,r)=>{const a=r.state.data.country;return o(t,a,e)},errorMessage:r},houseNumberOrName:{validate:(r,e)=>{const n=e.state?.data?.country;return n&&t.countryHasOptionalField(n,"houseNumberOrName")||!a(r)||null},modes:["blur"],errorMessage:r},default:{validate:t=>!a(t)||null,modes:["blur"],errorMessage:r}};return e};export{l as getAddressValidationRules,d as getPartialAddressValidationRules,o as validatePostalCode};
1
+ import{countrySpecificFormatters as t}from"./validate.formats.js";import{ERROR_FIELD_REQUIRED as r,ERROR_INVALID_CHARACTERS as e,ERROR_INVALID_FORMAT_EXPECTS as a}from"../../../core/Errors/constants.js";import{isEmpty as n,validateForSpecialChars as s}from"../../../utils/validator-utils.js";const o=t=>({pattern:new RegExp(`\\d{${t}}`)}),d=(r,e,s)=>{if(e){if(n(r))return null;s.postalCode.errorMessage={translationKey:a,translationObject:{values:{format:t[e]?.postalCode.format||null}}};const o=l[e]?.pattern;return o?o.test(r):!!r}return!n(r)||null},l={AT:o(4),AU:o(4),BE:{pattern:/(?:(?:[1-9])(?:\d{3}))/},BG:o(4),BR:{pattern:/^\d{5}-?\d{3}$/},CA:{pattern:/(?:[ABCEGHJ-NPRSTVXY]\d[A-Z][ -]?\d[A-Z]\d)/},CH:{pattern:/[1-9]\d{3}/},CY:o(4),CZ:{pattern:/\d{3}\s?\d{2}/},DE:o(5),DK:o(4),EE:o(5),ES:{pattern:/(?:0[1-9]|[1-4]\d|5[0-2])\d{3}/},FI:o(5),FR:o(5),GB:{pattern:/^([A-Za-z][A-Ha-hK-Yk-y]?[0-9][A-Za-z0-9]? ?[0-9][A-Za-z]{2}|[Gg][Ii][Rr] ?0[Aa]{2})$/},GE:o(4),GR:{pattern:/^\d{3}\s{0,1}\d{2}$/},HR:{pattern:/^([1-5])[0-9]{4}$/},HU:o(4),IE:{pattern:/(?:^[AC-FHKNPRTV-Y][0-9]{2}|D6W)[ -]?[0-9AC-FHKNPRTV-Y]{4}/},IS:o(3),IT:o(5),LI:o(4),LT:{pattern:/^(LT-\d{5}|\d{4,5})$/},LU:o(4),LV:{pattern:/^(LV-)[0-9]{4}$/},MC:{pattern:/^980\d{2}$/},MT:{pattern:/^[A-Za-z]{3}\d{4}$/},MY:o(5),NL:{pattern:/(?:NL-)?(?:[1-9]\d{3} ?(?:[A-EGHJ-NPRTVWXZ][A-EGHJ-NPRSTVWXZ]|S[BCEGHJ-NPRTVWXZ]))/},NO:o(4),PL:{pattern:/^\d{2}[-]{0,1}\d{3}$/},PT:{pattern:/^([1-9]\d{3})([- ]?(\d{3})? *)$/},RO:o(6),SI:o(4),SE:o(5),SG:o(6),SK:o(5),US:{pattern:/^\d{5}(?:-\d{4})?$/}},p=t=>{const e={postalCode:{modes:["blur"],validate:r=>d(r,t,e),errorMessage:r}};return e},u={modes:["blur"],validate:t=>!n(t)||null,errorMessage:r},i={modes:["blur"],validate:t=>s(t),errorMessage:e},m=t=>{const e={postalCode:{modes:["blur"],validate:(t,r)=>{const a=r.state.data.country;return d(t,a,e)},errorMessage:r},street:[u,i],houseNumberOrName:[{validate:(r,e)=>{const a=e.state?.data?.country;return a&&t.countryHasOptionalField(a,"houseNumberOrName")||!n(r)||null},modes:["blur"],errorMessage:r},i],city:[u,i],default:u};return e};export{m as getAddressValidationRules,p as getPartialAddressValidationRules,d as validatePostalCode};
2
2
  //# sourceMappingURL=validate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate.js","sources":["../../../../../src/components/internal/Address/validate.ts"],"sourcesContent":["import { ValidatorRules, ValidatorRule } from '../../../utils/Validator/types';\nimport { countrySpecificFormatters } from './validate.formats';\nimport { ERROR_FIELD_REQUIRED, ERROR_INVALID_FORMAT_EXPECTS } from '../../../core/Errors/constants';\nimport { isEmpty } from '../../../utils/validator-utils';\n\nconst createPatternByDigits = (digits: number) => {\n return {\n pattern: new RegExp(`\\\\d{${digits}}`)\n };\n};\n\nexport const validatePostalCode = (val: string, countryCode: string | null, validatorRules: ValidatorRules) => {\n if (countryCode) {\n // If there is no value, we display the 'required' error message\n if (isEmpty(val)) return null;\n\n // Dynamically create errorMessage\n (validatorRules.postalCode as ValidatorRule).errorMessage = {\n translationKey: ERROR_INVALID_FORMAT_EXPECTS,\n translationObject: {\n values: {\n format: countrySpecificFormatters[countryCode]?.postalCode.format || null\n }\n }\n };\n\n const pattern = postalCodePatterns[countryCode]?.pattern;\n return pattern ? pattern.test(val) : !!val; // No pattern? Accept any, filled, value.\n }\n // Default rule\n return isEmpty(val) ? null : true;\n};\n\nconst postalCodePatterns = {\n AT: createPatternByDigits(4),\n AU: createPatternByDigits(4),\n BE: { pattern: /(?:(?:[1-9])(?:\\d{3}))/ },\n BG: createPatternByDigits(4),\n BR: { pattern: /^\\d{5}-?\\d{3}$/ },\n CA: { pattern: /(?:[ABCEGHJ-NPRSTVXY]\\d[A-Z][ -]?\\d[A-Z]\\d)/ },\n CH: { pattern: /[1-9]\\d{3}/ },\n CY: createPatternByDigits(4),\n CZ: { pattern: /\\d{3}\\s?\\d{2}/ },\n DE: createPatternByDigits(5),\n DK: createPatternByDigits(4),\n EE: createPatternByDigits(5),\n ES: { pattern: /(?:0[1-9]|[1-4]\\d|5[0-2])\\d{3}/ },\n FI: createPatternByDigits(5),\n FR: createPatternByDigits(5),\n GB: { pattern: /^([A-Za-z][A-Ha-hK-Yk-y]?[0-9][A-Za-z0-9]? ?[0-9][A-Za-z]{2}|[Gg][Ii][Rr] ?0[Aa]{2})$/ },\n GE: createPatternByDigits(4),\n GR: { pattern: /^\\d{3}\\s{0,1}\\d{2}$/ },\n HR: { pattern: /^([1-5])[0-9]{4}$/ },\n HU: createPatternByDigits(4),\n IE: { pattern: /(?:^[AC-FHKNPRTV-Y][0-9]{2}|D6W)[ -]?[0-9AC-FHKNPRTV-Y]{4}/ },\n IS: createPatternByDigits(3),\n IT: createPatternByDigits(5),\n LI: createPatternByDigits(4),\n LT: { pattern: /^(LT-\\d{5}|\\d{4,5})$/ },\n LU: createPatternByDigits(4),\n LV: { pattern: /^(LV-)[0-9]{4}$/ },\n MC: { pattern: /^980\\d{2}$/ },\n MT: { pattern: /^[A-Za-z]{3}\\d{4}$/ },\n MY: createPatternByDigits(5),\n NL: { pattern: /(?:NL-)?(?:[1-9]\\d{3} ?(?:[A-EGHJ-NPRTVWXZ][A-EGHJ-NPRSTVWXZ]|S[BCEGHJ-NPRTVWXZ]))/ },\n NO: createPatternByDigits(4),\n PL: { pattern: /^\\d{2}[-]{0,1}\\d{3}$/ },\n PT: { pattern: /^([1-9]\\d{3})([- ]?(\\d{3})? *)$/ },\n RO: createPatternByDigits(6),\n SI: createPatternByDigits(4),\n SE: createPatternByDigits(5),\n SG: createPatternByDigits(6),\n SK: createPatternByDigits(5),\n US: { pattern: /^\\d{5}(?:-\\d{4})?$/ }\n};\n\n/**\n * Validates only postalCode property. As the partial address form does not have the country selector, the country value\n * must be informed beforehand and can't be picked up from the form context\n *\n * @param country - Country that will be used to validate postal code\n */\nexport const getPartialAddressValidationRules = (country: string | null): ValidatorRules => {\n const validationRules: ValidatorRules = {\n postalCode: {\n modes: ['blur'],\n validate: val => {\n return validatePostalCode(val, country, validationRules);\n },\n errorMessage: ERROR_FIELD_REQUIRED\n }\n };\n return validationRules;\n};\n\nexport const getAddressValidationRules = (specifications): ValidatorRules => {\n const addressValidationRules: ValidatorRules = {\n postalCode: {\n modes: ['blur'],\n validate: (val, context) => {\n const country = context.state.data.country;\n return validatePostalCode(val, country, addressValidationRules);\n },\n errorMessage: ERROR_FIELD_REQUIRED\n },\n houseNumberOrName: {\n validate: (value, context) => {\n const selectedCountry = context.state?.data?.country;\n const isOptional = selectedCountry && specifications.countryHasOptionalField(selectedCountry, 'houseNumberOrName');\n return isOptional || (isEmpty(value) ? null : true);\n },\n modes: ['blur'],\n errorMessage: ERROR_FIELD_REQUIRED\n },\n default: {\n validate: value => (isEmpty(value) ? null : true), // true, if there are chars other than spaces\n modes: ['blur'],\n errorMessage: ERROR_FIELD_REQUIRED\n }\n };\n return addressValidationRules;\n};\n"],"names":["createPatternByDigits","digits","pattern","RegExp","validatePostalCode","val","countryCode","validatorRules","isEmpty","postalCode","errorMessage","translationKey","ERROR_INVALID_FORMAT_EXPECTS","translationObject","values","format","countrySpecificFormatters","postalCodePatterns","test","AT","AU","BE","BG","BR","CA","CH","CY","CZ","DE","DK","EE","ES","FI","FR","GB","GE","GR","HR","HU","IE","IS","IT","LI","LT","LU","LV","MC","MT","MY","NL","NO","PL","PT","RO","SI","SE","SG","SK","US","getPartialAddressValidationRules","country","validationRules","modes","validate","ERROR_FIELD_REQUIRED","getAddressValidationRules","specifications","addressValidationRules","context","state","data","houseNumberOrName","value","selectedCountry","countryHasOptionalField","default"],"mappings":"yOAKA,MAAMA,EAAyBC,IACpB,CACHC,QAAS,IAAIC,OAAO,OAAOF,QAItBG,EAAqB,CAACC,EAAaC,EAA4BC,KACxE,GAAID,EAAa,CAEb,GAAIE,EAAQH,GAAM,OAAO,KAGxBE,EAAeE,WAA6BC,aAAe,CACxDC,eAAgBC,EAChBC,kBAAmB,CACfC,OAAQ,CACJC,OAAQC,EAA0BV,IAAcG,WAAWM,QAAU,QAKjF,MAAMb,EAAUe,EAAmBX,IAAcJ,Q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U1D,GACCD,EAAmBC,EAAKuD,EAASC,GAE5CnD,aAAcsD,IAGtB,OAAOH,GAGEI,EAA6BC,IACtC,MAAMC,EAAyC,CAC3C1D,WAAY,CACRqD,MAAO,CAAC,QACRC,SAAU,CAAC1D,EAAK+D,KACZ,MAAMR,EAAUQ,EAAQC,MAAMC,KAAKV,QACnC,OAAOxD,EAAmBC,EAAKuD,EAASO,IAE5CzD,aAAcsD,GAElBO,kBAAmB,CACfR,SAAU,CAACS,EAAOJ,KACd,MAAMK,EAAkBL,EAAQC,OAAOC,MAAMV,QAE7C,OADmBa,GAAmBP,EAAeQ,wBAAwBD,EAAiB,uBACxEjE,EAAQgE,IAAS,MAE3CV,MAAO,CAAC,QACRpD,aAAcsD,GAElBW,QAAS,CACLZ,SAAUS,IAAUhE,EAAQgE,IAAS,KACrCV,MAAO,CAAC,QACRpD,aAAcsD,IAGtB,OAAOG"}
1
+ {"version":3,"file":"validate.js","sources":["../../../../../src/components/internal/Address/validate.ts"],"sourcesContent":["import { ValidatorRules, ValidatorRule } from '../../../utils/Validator/types';\nimport { countrySpecificFormatters } from './validate.formats';\nimport { ERROR_FIELD_REQUIRED, ERROR_INVALID_FORMAT_EXPECTS, ERROR_INVALID_CHARACTERS } from '../../../core/Errors/constants';\nimport { isEmpty, validateForSpecialChars } from '../../../utils/validator-utils';\n\nconst createPatternByDigits = (digits: number) => {\n return {\n pattern: new RegExp(`\\\\d{${digits}}`)\n };\n};\n\nexport const validatePostalCode = (val: string, countryCode: string | null, validatorRules: ValidatorRules) => {\n if (countryCode) {\n // If there is no value, we display the 'required' error message\n if (isEmpty(val)) return null;\n\n // Dynamically create errorMessage\n (validatorRules.postalCode as ValidatorRule).errorMessage = {\n translationKey: ERROR_INVALID_FORMAT_EXPECTS,\n translationObject: {\n values: {\n format: countrySpecificFormatters[countryCode]?.postalCode.format || null\n }\n }\n };\n\n const pattern = postalCodePatterns[countryCode]?.pattern;\n return pattern ? pattern.test(val) : !!val; // No pattern? Accept any, filled, value.\n }\n // Default rule\n return isEmpty(val) ? null : true;\n};\n\nconst postalCodePatterns = {\n AT: createPatternByDigits(4),\n AU: createPatternByDigits(4),\n BE: { pattern: /(?:(?:[1-9])(?:\\d{3}))/ },\n BG: createPatternByDigits(4),\n BR: { pattern: /^\\d{5}-?\\d{3}$/ },\n CA: { pattern: /(?:[ABCEGHJ-NPRSTVXY]\\d[A-Z][ -]?\\d[A-Z]\\d)/ },\n CH: { pattern: /[1-9]\\d{3}/ },\n CY: createPatternByDigits(4),\n CZ: { pattern: /\\d{3}\\s?\\d{2}/ },\n DE: createPatternByDigits(5),\n DK: createPatternByDigits(4),\n EE: createPatternByDigits(5),\n ES: { pattern: /(?:0[1-9]|[1-4]\\d|5[0-2])\\d{3}/ },\n FI: createPatternByDigits(5),\n FR: createPatternByDigits(5),\n GB: { pattern: /^([A-Za-z][A-Ha-hK-Yk-y]?[0-9][A-Za-z0-9]? ?[0-9][A-Za-z]{2}|[Gg][Ii][Rr] ?0[Aa]{2})$/ },\n GE: createPatternByDigits(4),\n GR: { pattern: /^\\d{3}\\s{0,1}\\d{2}$/ },\n HR: { pattern: /^([1-5])[0-9]{4}$/ },\n HU: createPatternByDigits(4),\n IE: { pattern: /(?:^[AC-FHKNPRTV-Y][0-9]{2}|D6W)[ -]?[0-9AC-FHKNPRTV-Y]{4}/ },\n IS: createPatternByDigits(3),\n IT: createPatternByDigits(5),\n LI: createPatternByDigits(4),\n LT: { pattern: /^(LT-\\d{5}|\\d{4,5})$/ },\n LU: createPatternByDigits(4),\n LV: { pattern: /^(LV-)[0-9]{4}$/ },\n MC: { pattern: /^980\\d{2}$/ },\n MT: { pattern: /^[A-Za-z]{3}\\d{4}$/ },\n MY: createPatternByDigits(5),\n NL: { pattern: /(?:NL-)?(?:[1-9]\\d{3} ?(?:[A-EGHJ-NPRTVWXZ][A-EGHJ-NPRSTVWXZ]|S[BCEGHJ-NPRTVWXZ]))/ },\n NO: createPatternByDigits(4),\n PL: { pattern: /^\\d{2}[-]{0,1}\\d{3}$/ },\n PT: { pattern: /^([1-9]\\d{3})([- ]?(\\d{3})? *)$/ },\n RO: createPatternByDigits(6),\n SI: createPatternByDigits(4),\n SE: createPatternByDigits(5),\n SG: createPatternByDigits(6),\n SK: createPatternByDigits(5),\n US: { pattern: /^\\d{5}(?:-\\d{4})?$/ }\n};\n\n/**\n * Validates only postalCode property. As the partial address form does not have the country selector, the country value\n * must be informed beforehand and can't be picked up from the form context\n *\n * @param country - Country that will be used to validate postal code\n */\nexport const getPartialAddressValidationRules = (country: string | null): ValidatorRules => {\n const validationRules: ValidatorRules = {\n postalCode: {\n modes: ['blur'],\n validate: val => {\n return validatePostalCode(val, country, validationRules);\n },\n errorMessage: ERROR_FIELD_REQUIRED\n }\n };\n return validationRules;\n};\n\nconst ruleIsEmpty: ValidatorRule = {\n modes: ['blur'],\n validate: value => (isEmpty(value) ? null : true),\n errorMessage: ERROR_FIELD_REQUIRED\n};\n\nconst ruleValidateForSpecialChars: ValidatorRule = {\n modes: ['blur'],\n validate: value => validateForSpecialChars(value),\n errorMessage: ERROR_INVALID_CHARACTERS\n};\n\nexport const getAddressValidationRules = (specifications): ValidatorRules => {\n const addressValidationRules: ValidatorRules = {\n postalCode: {\n modes: ['blur'],\n validate: (val, context) => {\n const country = context.state.data.country;\n return validatePostalCode(val, country, addressValidationRules);\n },\n errorMessage: ERROR_FIELD_REQUIRED\n },\n street: [\n ruleIsEmpty,\n ruleValidateForSpecialChars\n ],\n houseNumberOrName: [\n {\n validate: (value, context) => {\n const selectedCountry = context.state?.data?.country;\n const isOptional = selectedCountry && specifications.countryHasOptionalField(selectedCountry, 'houseNumberOrName');\n return isOptional || (isEmpty(value) ? null : true);\n },\n modes: ['blur'],\n errorMessage: ERROR_FIELD_REQUIRED\n },\n ruleValidateForSpecialChars\n ],\n city: [\n ruleIsEmpty,\n ruleValidateForSpecialChars\n ],\n default: ruleIsEmpty\n };\n return addressValidationRules;\n};\n"],"names":["createPatternByDigits","digits","pattern","RegExp","validatePostalCode","val","countryCode","validatorRules","isEmpty","postalCode","errorMessage","translationKey","ERROR_INVALID_FORMAT_EXPECTS","translationObject","values","format","countrySpecificFormatters","postalCodePatterns","test","AT","AU","BE","BG","BR","CA","CH","CY","CZ","DE","DK","EE","ES","FI","FR","GB","GE","GR","HR","HU","IE","IS","IT","LI","LT","LU","LV","MC","MT","MY","NL","NO","PL","PT","RO","SI","SE","SG","SK","US","getPartialAddressValidationRules","country","validationRules","modes","validate","ERROR_FIELD_REQUIRED","ruleIsEmpty","value","ruleValidateForSpecialChars","validateForSpecialChars","ERROR_INVALID_CHARACTERS","getAddressValidationRules","specifications","addressValidationRules","context","state","data","street","houseNumberOrName","selectedCountry","countryHasOptionalField","city","default"],"mappings":"oSAKA,MAAMA,EAAyBC,IACpB,CACHC,QAAS,IAAIC,OAAO,OAAOF,QAItBG,EAAqB,CAACC,EAAaC,EAA4BC,KACxE,GAAID,EAAa,CAEb,GAAIE,EAAQH,GAAM,OAAO,KAGxBE,EAAeE,WAA6BC,aAAe,CACxDC,eAAgBC,EAChBC,kBAAmB,CACfC,OAAQ,CACJC,OAAQC,EAA0BV,IAAcG,WAAWM,QAAU,QAKjF,MAAMb,EAAUe,EAAmBX,IAAcJ,QACjD,OAAOA,EAAUA,EAAQgB,KAAKb,KAASA,CAC3C,CAEA,OAAOG,EAAQH,IAAO,MAGpBY,EAAqB,CACvBE,GAAInB,EAAsB,GAC1BoB,GAAIpB,EAAsB,GAC1BqB,GAAI,CAAEnB,QAAS,0BACfoB,GAAItB,EAAsB,GAC1BuB,GAAI,CAAErB,QAAS,kBACfsB,GAAI,CAAEtB,QAAS,+CACfuB,GAAI,CAAEvB,QAAS,cACfwB,GAAI1B,EAAsB,GAC1B2B,GAAI,CAAEzB,QAAS,iBACf0B,GAAI5B,EAAsB,GAC1B6B,GAAI7B,EAAsB,GAC1B8B,GAAI9B,EAAsB,GAC1B+B,GAAI,CAAE7B,QAAS,kCACf8B,GAAIhC,EAAsB,GAC1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JU,kBAAmB,CACf,CACId,SAAU,CAACG,EAAOO,KACd,MAAMK,EAAkBL,EAAQC,OAAOC,MAAMf,QAE7C,OADmBkB,GAAmBP,EAAeQ,wBAAwBD,EAAiB,uBACxEtE,EAAQ0D,IAAS,MAE3CJ,MAAO,CAAC,QACRpD,aAAcsD,GAElBG,GAEJa,KAAM,CACFf,EACAE,GAEJc,QAAShB,GAEb,OAAOO"}
@@ -1 +1 @@
1
- {"version":3,"file":"BaseElement.js","sources":["../../../../../src/components/internal/BaseElement/BaseElement.ts"],"sourcesContent":["import { ComponentChild, h, render, TargetedKeyboardEvent } from 'preact';\nimport uuid from '../../../utils/uuid';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { NO_CHECKOUT_ATTEMPT_ID } from '../../../core/Analytics/constants';\nimport type { ICore } from '../../../core/types';\nimport type { BaseElementProps, IBaseElement } from './types';\nimport type { PaymentData } from '../../../types/global-types';\nimport { off, on } from '../../../utils/listenerUtils';\nimport { AbstractAnalyticsEvent } from '../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { createSdkData } from '../../../utils/createSdkData';\nimport getComponentNameOfPaymentType from '../../components-name-map';\nimport { PAYMENT_METHOD_BEHAVIOR } from '../../../core/config';\n\n/**\n * Verify if the first parameter is instance of Core.\n * We do not use 'instanceof' to avoid importing the Core class directly into this class.\n * @param checkout\n */\nfunction assertIsCoreInstance(checkout: ICore): checkout is ICore {\n if (!checkout) return false;\n const isCoreObject = typeof checkout.initialize === 'function' && typeof checkout.createFromAction === 'function';\n return isCoreObject;\n}\n\nabstract class BaseElement<P extends BaseElementProps> implements IBaseElement {\n public readonly _id = `${this.constructor['type']}-${uuid()}`;\n public readonly core: ICore;\n\n public props: P;\n public state: any = {};\n public _component;\n\n protected _node: HTMLElement = null;\n\n protected static readonly defaultProps = {};\n\n constructor(checkout: ICore, props?: P) {\n const isCoreInstance = assertIsCoreInstance(checkout);\n\n if (!isCoreInstance) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Trying to initialise the component '${this.constructor['type']}' without a reference to an instance of AdyenCheckout`\n );\n }\n\n this.core = checkout;\n this.buildElementProps(props);\n\n this.handleKeyDown = this.handleKeyDown.bind(this);\n }\n\n protected buildElementProps(componentProps?: P) {\n this.props = this.formatProps({ ...this.constructor['defaultProps'], ...componentProps });\n }\n\n /**\n * Executed during creation of any payment element.\n * Gives a chance to any paymentMethod to format the props we're receiving.\n */\n protected formatProps(props: P) {\n return props;\n }\n\n /**\n * Executed on the `data` getter.\n * Returns the component data necessary for the /payments request\n */\n protected formatData(): any {\n return {};\n }\n\n protected submitAnalytics(_analyticsObj?: AbstractAnalyticsEvent) {\n return null;\n }\n\n protected handleKeyDown(_e: TargetedKeyboardEvent<HTMLInputElement>) {\n return null;\n }\n\n protected setState(newState: object): void {\n this.state = { ...this.state, ...newState };\n }\n\n /**\n * Returns the component payment data ready to submit to the Checkout API\n * Note: this does not ensure validity, check isValid first\n */\n public get data(): PaymentData {\n const order = this.state.order || this.props.order;\n const componentData = this.formatData();\n const doesPaymentMethodHaveNativeComponent = Boolean(getComponentNameOfPaymentType(componentData.paymentMethod?.type));\n const clientData = this.core.modules.risk.data;\n const checkoutAttemptId = this.core.modules.analytics.checkoutAttemptId ?? NO_CHECKOUT_ATTEMPT_ID;\n const paymentMethodBehavior = doesPaymentMethodHaveNativeComponent ? PAYMENT_METHOD_BEHAVIOR.NATIVE : PAYMENT_METHOD_BEHAVIOR.GENERIC;\n\n const sdkData = createSdkData(checkoutAttemptId, clientData, paymentMethodBehavior);\n if (componentData.paymentMethod && checkoutAttemptId) {\n componentData.paymentMethod.checkoutAttemptId = checkoutAttemptId;\n }\n\n if (componentData.paymentMethod && sdkData) {\n componentData.paymentMethod.sdkData = sdkData;\n }\n\n return {\n ...(clientData && { riskData: { clientData } }),\n ...(order && { order: { orderData: order.orderData, pspReference: order.pspReference } }),\n ...componentData,\n clientStateDataIndicator: true\n };\n }\n\n /**\n * Method used to make the payment method active\n * (Useful when there are different payment methods available and activating one PM must trigger a specific task)\n */\n public activate(): void {\n return;\n }\n\n public render(): ComponentChild | Error {\n // render() not implemented in the element\n throw new Error('Payment method cannot be rendered.');\n }\n\n /**\n * Mounts an element into the dom\n * @param domNode - Node (or selector) where we will mount the payment element\n * @returns this - the payment element instance we mounted\n */\n public mount(domNode: HTMLElement | string): this {\n const node = typeof domNode === 'string' ? document.querySelector<HTMLElement>(domNode) : domNode;\n\n if (!node) {\n throw new Error('Component could not mount. Root node was not found.');\n }\n\n if (this._node) {\n this.unmount(); // new, if this._node exists then we are \"remounting\" so we first need to unmount if it's not already been done\n }\n\n this._node = node;\n\n // Add listener for key down events, notably 'Enter' key presses\n on(this._node, 'keydown', this.handleKeyDown, false);\n\n this._component = this.render();\n\n render(this._component, node);\n\n return this;\n }\n\n /**\n * Updates props, resets the internal state and remounts the element.\n *\n * @param props - props to update\n * @returns this - the element instance\n */\n public update(props: Partial<P>): this {\n this.props = this.formatProps({ ...this.props, ...props });\n this.state = {};\n\n return this.unmount().mount(this._node); // for new mount fny\n }\n\n /**\n * Unmounts a payment element from the DOM\n */\n public unmount(): this {\n // Remove listener\n off(this._node, 'keydown', this.handleKeyDown);\n\n if (this._node) {\n render(null, this._node);\n }\n\n return this;\n }\n\n /**\n * Unmounts an element and removes it from the parent instance\n * For \"destroy\" type cleanup - when you don't intend to use the component again\n */\n public remove() {\n this.unmount();\n\n if (this.core) {\n this.core.remove(this);\n }\n }\n}\n\nexport default BaseElement;\n"],"names":["BaseElement","buildElementProps","componentProps","this","props","formatProps","constructor","formatData","submitAnalytics","_analyticsObj","handleKeyDown","_e","setState","newState","state","data","order","componentData","doesPaymentMethodHaveNativeComponent","Boolean","getComponentNameOfPaymentType","paymentMethod","type","clientData","core","modules","risk","checkoutAttemptId","analytics","NO_CHECKOUT_ATTEMPT_ID","paymentMethodBehavior","PAYMENT_METHOD_BEHAVIOR","NATIVE","GENERIC","sdkData","createSdkData","riskData","orderData","pspReference","clientStateDataIndicator","activate","render","Error","mount","domNode","node","document","querySelector","_node","unmount","on","_component","update","off","remove","checkout","_define_property","_id","uuid","isCoreInstance","initialize","createFromAction","assertIsCoreInstance","AdyenCheckoutError","bind","defaultProps"],"mappings":"mlBAwBA,MAAeA,EA4BDC,iBAAAA,CAAkBC,GACxBC,KAAKC,MAAQD,KAAKE,YAAY,IAAKF,KAAKG,YAAY,gBAAoBJ,GAC5E,CAMUG,WAAAA,CAAYD,GAClB,OAAOA,CACX,CAMA,UAAAG,GACI,MAAO,CAAA,CACX,CAEUC,eAAAA,CAAgBC,GACtB,OAAO,IACX,CAEUC,aAAAA,CAAcC,GACpB,OAAO,IACX,CAEUC,QAAAA,CAASC,GACfV,KAAKW,MAAQ,IAAKX,KAAKW,SAAUD,EACrC,CAMA,QAAWE,GACP,MAAMC,EAAQb,KAAKW,MAAME,OAASb,KAAKC,MAAMY,MACvCC,EAAgBd,KAAKI,aACrBW,EAAuCC,QAAQC,EAA8BH,EAAcI,eAAeC,OAC1GC,EAAapB,KAAKqB,KAAKC,QAAQC,KAAKX,KACpCY,EAAoBxB,KAAKqB,KAAKC,QAAQG,UAAUD,mBAAqBE,EACrEC,EAAwBZ,EAAuCa,EAAwBC,OAASD,EAAwBE,QAExHC,EAAUC,EAAcR,EAAmBJ,EAAYO,GAS7D,OARIb,EAAcI,eAAiBM,IAC/BV,EAAcI,cAAcM,kBAAoBA,GAGhDV,EAAcI,eAAiBa,IAC/BjB,EAAcI,cAAca,QAAUA,GAGnC,IACCX,GAAc,CAAEa,SAAU,CAAEb,kBAC5BP,GAAS,CAAEA,MAAO,CAAEqB,UAAWrB,EAAMqB,UAAWC,aAActB,EAAMsB,kBACrErB,EACHsB,0BAA0B,EAElC,CAMA,QAAAC,GAEA,CAEOC,MAAAA,GAEH,MAAM,IAAIC,MAAM,qCACpB,CAOOC,KAAAA,CAAMC,GACT,MAAMC,EAA0B,iBAAZD,EAAuBE,SAASC,cAA2BH,GAAWA,EAE1F,IAAKC,EACD,MAAM,IAAIH,MAAM,uDAgBpB,OAbIvC,KAAK6C,OACL7C,KAAK8C,UAGT9C,KAAK6C,MAAQH,EAGbK,EAAG/C,KAAK6C,MAAO,UAAW7C,KAAKO,eAAe,GAE9CP,KAAKgD,WAAahD,KAAKsC,SAEvBA,EAAOtC,KAAKgD,WAAYN,GAEjB1C,IACX,CAQOiD,MAAAA,CAAOhD,GAIV,OAHAD,KAAKC,MAAQD,KAAKE,YAAY,IAAKF,KAAKC,SAAUA,IAClDD,KAAKW,MAAQ,CAAA,EAENX,KAAK8C,UAAUN,MAAMxC,KAAK6C,MACrC,CAKA,OAAAC,GAQI,OANAI,EAAIlD,KAAK6C,MAAO,UAAW7C,KAAKO,eAE5BP,KAAK6C,OACLP,EAAO,KAAMtC,KAAK6C,OAGf7C,IACX,CAMA,MAAAmD,GACInD,KAAK8C,UAED9C,KAAKqB,MACLrB,KAAKqB,KAAK8B,OAAOnD,KAEzB,CA3JA,WAAAG,CAAYiD,EAAiBnD,GAX7BoD,EAAArD,KAAgBsD,MAAM,GAAGtD,KAAKG,YAAY,QAAWoD,OACrDF,EAAArD,KAAgBqB,eAEhBgC,EAAArD,KAAOC,gBACPoD,EAAArD,KAAOW,QAAa,IACpB0C,EAAArD,KAAOgD,qBAEPK,EAAArD,KAAU6C,QAAqB,MAK3B,MAAMW,EAnBd,SAA8BJ,GAC1B,QAAKA,IAC+C,mBAAxBA,EAASK,YAAkE,mBAA9BL,EAASM,iBAEtF,CAe+BC,CAAqBP,GAE5C,IAAKI,EACD,MAAM,IAAII,EACN,uBACA,uCAAuC5D,KAAKG,YAAY,6DAIhEH,KAAKqB,KAAO+B,EACZpD,KAAKF,kBAAkBG,GAEvBD,KAAKO,cAAgBP,KAAKO,cAAcsD,KAAK7D,KACjD,EAhBAqD,EAVWxD,EAUeiE,eAAe"}
1
+ {"version":3,"file":"BaseElement.js","sources":["../../../../../src/components/internal/BaseElement/BaseElement.ts"],"sourcesContent":["import { ComponentChild, h, render, TargetedKeyboardEvent } from 'preact';\nimport uuid from '../../../utils/uuid';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { NO_CHECKOUT_ATTEMPT_ID } from '../../../core/Analytics/constants';\nimport type { ICore } from '../../../core/types';\nimport type { BaseElementProps, BaseElementState, IBaseElement } from './types';\nimport type { PaymentData } from '../../../types/global-types';\nimport { off, on } from '../../../utils/listenerUtils';\nimport { AbstractAnalyticsEvent } from '../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { createSdkData } from '../../../utils/createSdkData';\nimport getComponentNameOfPaymentType from '../../components-name-map';\nimport { PAYMENT_METHOD_BEHAVIOR } from '../../../core/config';\n\n/**\n * Verify if the first parameter is instance of Core.\n * We do not use 'instanceof' to avoid importing the Core class directly into this class.\n * @param checkout\n */\nfunction assertIsCoreInstance(checkout: ICore): checkout is ICore {\n if (!checkout) return false;\n const isCoreObject = typeof checkout.initialize === 'function' && typeof checkout.createFromAction === 'function';\n return isCoreObject;\n}\n\nabstract class BaseElement<P extends BaseElementProps, S extends BaseElementState = BaseElementState> implements IBaseElement<P> {\n public readonly _id = `${this.constructor['type']}-${uuid()}`;\n public readonly core: ICore;\n\n public props: P;\n public state: S = {} as S;\n public _component: ComponentChild | undefined;\n\n protected _node: HTMLElement = null;\n\n protected static readonly defaultProps = {};\n\n constructor(checkout: ICore, props?: P) {\n const isCoreInstance = assertIsCoreInstance(checkout);\n\n if (!isCoreInstance) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Trying to initialise the component '${this.constructor['type']}' without a reference to an instance of AdyenCheckout`\n );\n }\n\n this.core = checkout;\n this.buildElementProps(props);\n\n this.handleKeyDown = this.handleKeyDown.bind(this);\n }\n\n protected buildElementProps(componentProps?: P) {\n this.props = this.formatProps({ ...this.constructor['defaultProps'], ...componentProps });\n }\n\n /**\n * Executed during creation of any payment element.\n * Gives a chance to any paymentMethod to format the props we're receiving.\n */\n protected formatProps(props: P) {\n return props;\n }\n\n /**\n * Executed on the `data` getter.\n * Returns the component data necessary for the /payments request\n */\n protected formatData(): PaymentData {\n return {} as PaymentData;\n }\n\n protected submitAnalytics(_analyticsObj?: AbstractAnalyticsEvent) {\n return null;\n }\n\n protected handleKeyDown(_e: TargetedKeyboardEvent<HTMLInputElement>) {\n return null;\n }\n\n protected setState(newState: S): void {\n this.state = { ...this.state, ...newState };\n }\n\n /**\n * Returns the component payment data ready to submit to the Checkout API\n * Note: this does not ensure validity, check isValid first\n */\n public get data(): PaymentData {\n const order = this.state.order || this.props.order;\n const componentData = this.formatData();\n const doesPaymentMethodHaveNativeComponent = Boolean(getComponentNameOfPaymentType(componentData.paymentMethod?.type));\n const clientData = this.core.modules.risk.data;\n const checkoutAttemptId = this.core.modules.analytics.checkoutAttemptId ?? NO_CHECKOUT_ATTEMPT_ID;\n const paymentMethodBehavior = doesPaymentMethodHaveNativeComponent ? PAYMENT_METHOD_BEHAVIOR.NATIVE : PAYMENT_METHOD_BEHAVIOR.GENERIC;\n\n const sdkData = createSdkData(checkoutAttemptId, clientData, paymentMethodBehavior);\n if (componentData.paymentMethod && checkoutAttemptId) {\n componentData.paymentMethod.checkoutAttemptId = checkoutAttemptId;\n }\n\n if (componentData.paymentMethod && sdkData) {\n componentData.paymentMethod.sdkData = sdkData;\n }\n\n return {\n ...(clientData && { riskData: { clientData } }),\n ...(order && { order: { orderData: order.orderData, pspReference: order.pspReference } }),\n ...componentData,\n clientStateDataIndicator: true\n };\n }\n\n /**\n * Method used to make the payment method active\n * (Useful when there are different payment methods available and activating one PM must trigger a specific task)\n */\n public activate(): void {\n return;\n }\n\n public render(): ComponentChild | Error {\n // render() not implemented in the element\n throw new Error('Payment method cannot be rendered.');\n }\n\n /**\n * Mounts an element into the dom\n * @param domNode - Node (or selector) where we will mount the payment element\n * @returns this - the payment element instance we mounted\n */\n public mount(domNode: HTMLElement | string): this {\n const node = typeof domNode === 'string' ? document.querySelector<HTMLElement>(domNode) : domNode;\n\n if (!node) {\n throw new Error('Component could not mount. Root node was not found.');\n }\n\n if (this._node) {\n this.unmount(); // new, if this._node exists then we are \"remounting\" so we first need to unmount if it's not already been done\n }\n\n this._node = node;\n\n // Add listener for key down events, notably 'Enter' key presses\n on(this._node, 'keydown', this.handleKeyDown, false);\n\n this._component = this.render();\n\n render(this._component, node);\n\n return this;\n }\n\n /**\n * Updates props, resets the internal state and remounts the element.\n *\n * @param props - props to update\n * @returns this - the element instance\n */\n public update(props: Partial<P>): this {\n this.props = this.formatProps({ ...this.props, ...props });\n this.state = {} as S;\n\n return this.unmount().mount(this._node); // for new mount fny\n }\n\n /**\n * Unmounts a payment element from the DOM\n */\n public unmount(): this {\n // Remove listener\n off(this._node, 'keydown', this.handleKeyDown);\n\n if (this._node) {\n render(null, this._node);\n }\n\n return this;\n }\n\n /**\n * Unmounts an element and removes it from the parent instance\n * For \"destroy\" type cleanup - when you don't intend to use the component again\n */\n public remove() {\n this.unmount();\n\n if (this.core) {\n this.core.remove(this);\n }\n }\n}\n\nexport default BaseElement;\n"],"names":["BaseElement","buildElementProps","componentProps","this","props","formatProps","constructor","formatData","submitAnalytics","_analyticsObj","handleKeyDown","_e","setState","newState","state","data","order","componentData","doesPaymentMethodHaveNativeComponent","Boolean","getComponentNameOfPaymentType","paymentMethod","type","clientData","core","modules","risk","checkoutAttemptId","analytics","NO_CHECKOUT_ATTEMPT_ID","paymentMethodBehavior","PAYMENT_METHOD_BEHAVIOR","NATIVE","GENERIC","sdkData","createSdkData","riskData","orderData","pspReference","clientStateDataIndicator","activate","render","Error","mount","domNode","node","document","querySelector","_node","unmount","on","_component","update","off","remove","checkout","_define_property","_id","uuid","isCoreInstance","initialize","createFromAction","assertIsCoreInstance","AdyenCheckoutError","bind","defaultProps"],"mappings":"mlBAwBA,MAAeA,EA4BDC,iBAAAA,CAAkBC,GACxBC,KAAKC,MAAQD,KAAKE,YAAY,IAAKF,KAAKG,YAAY,gBAAoBJ,GAC5E,CAMUG,WAAAA,CAAYD,GAClB,OAAOA,CACX,C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,IAClDD,KAAKW,MAAQ,CAAA,EAENX,KAAK8C,UAAUN,MAAMxC,KAAK6C,MACrC,CAKA,OAAAC,GAQI,OANAI,EAAIlD,KAAK6C,MAAO,UAAW7C,KAAKO,eAE5BP,KAAK6C,OACLP,EAAO,KAAMtC,KAAK6C,OAGf7C,IACX,CAMA,MAAAmD,GACInD,KAAK8C,UAED9C,KAAKqB,MACLrB,KAAKqB,KAAK8B,OAAOnD,KAEzB,CA3JA,WAAAG,CAAYiD,EAAiBnD,GAX7BoD,EAAArD,KAAgBsD,MAAM,GAAGtD,KAAKG,YAAY,QAAWoD,OACrDF,EAAArD,KAAgBqB,eAEhBgC,EAAArD,KAAOC,gBACPoD,EAAArD,KAAOW,QAAW,IAClB0C,EAAArD,KAAOgD,qBAEPK,EAAArD,KAAU6C,QAAqB,MAK3B,MAAMW,EAnBd,SAA8BJ,GAC1B,QAAKA,IAC+C,mBAAxBA,EAASK,YAAkE,mBAA9BL,EAASM,iBAEtF,CAe+BC,CAAqBP,GAE5C,IAAKI,EACD,MAAM,IAAII,EACN,uBACA,uCAAuC5D,KAAKG,YAAY,6DAIhEH,KAAKqB,KAAO+B,EACZpD,KAAKF,kBAAkBG,GAEvBD,KAAKO,cAAgBP,KAAKO,cAAcsD,KAAK7D,KACjD,EAhBAqD,EAVWxD,EAUeiE,eAAe"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../external/preact/dist/preact.js";import{useRef as r,useState as o,useCallback as s,useEffect as t}from"../../../../../external/preact/hooks/dist/hooks.js";import{loginValidationRules as n}from"./validate.js";import{useCoreContext as a}from"../../../../../core/Context/CoreProvider.js";import i from"../../../../../utils/useForm/useFormWithA11y.js";import{setFocusOnField as l}from"../../../../../utils/setFocus.js";import p from"../../../FormFields/Field/Field.js";import u from"../../../FormFields/InputEmail.js";const m=m=>{const{i18n:d}=a(),c=r(null),{handleChangeFor:g,data:h,triggerValidation:f,valid:L,errors:F,isValid:v}=i({schema:["shopperLogin"],rules:n,formHolder:c}),j=r({validateInput:null,focusInput:null}),[I,b]=o(!1),E=s(()=>{b(!0),f()},[f]);t(()=>{c.current&&m.errorMessage&&l(c.current,"shopperLogin")},[m.errorMessage]),t(()=>{h.shopperLogin&&b(!0)},[h.shopperLogin]),t(()=>{j.current.validateInput=E,m.onSetInputHandlers(j.current)},[E,m.onSetInputHandlers]);const M=s(e=>{"Enter"===e.key&&m.onPressEnter()},[m.onPressEnter]);return t(()=>{m.onChange({data:h,valid:L,errors:F,isValid:v})},[h,L,F]),e("div",{ref:c},e(p,{name:"shopperLogin",label:d.get("ctp.login.inputLabel"),errorMessage:I?m.errorMessage||F.shopperLogin&&d.get(F.shopperLogin.errorMessage):null,classNameModifiers:["shopperLogin"],errorLive:!0},e(u,{name:"shopperLogin",autocorrect:"off",spellcheck:!1,value:h.shopperLogin,disabled:m.disabled,onInput:g("shopperLogin","input"),onBlur:g("shopperLogin","blur"),onKeyDown:M,autocomplete:"email"})))};export{m as default};
1
+ import{createElement as e}from"../../../../../external/preact/dist/preact.js";import{useRef as r,useState as o,useCallback as s,useEffect as t}from"../../../../../external/preact/hooks/dist/hooks.js";import{loginValidationRules as n}from"./validate.js";import{useCoreContext as a}from"../../../../../core/Context/CoreProvider.js";import i from"../../../../../utils/useForm/useFormWithA11y.js";import{setFocusOnField as p}from"../../../../../utils/setFocus.js";import l from"../../../FormFields/Field/Field.js";import u from"../../../FormFields/InputEmail.js";const m=m=>{const{i18n:d}=a(),g=r(null),{handleChangeFor:c,data:h,triggerValidation:f,valid:L,errors:F,isValid:v}=i({schema:["shopperLogin"],rules:n,formHolder:g}),j=r({validateInput:null,focusInput:null}),[I,M]=o(!1),b=s(()=>{M(!0),f()},[f]);t(()=>{g.current&&m.errorMessage&&p(g.current,"shopperLogin")},[m.errorMessage]),t(()=>{h.shopperLogin&&M(!0)},[h.shopperLogin]),t(()=>{j.current.validateInput=b,m.onSetInputHandlers(j.current)},[b,m.onSetInputHandlers]);const E=s(e=>{"Enter"===e.key&&m.onPressEnter()},[m.onPressEnter]);return t(()=>{m.onChange({data:h,valid:L,errors:F,isValid:v})},[h,L,F]),e("div",{ref:g},e(l,{name:"shopperLogin",label:d.get("ctp.login.inputLabel"),errorMessage:I?m.errorMessage||(F.shopperLogin&&"string"==typeof F.shopperLogin?.errorMessage?d.get(F.shopperLogin.errorMessage):null):null,classNameModifiers:["shopperLogin"],errorLive:!0},e(u,{name:"shopperLogin",autocorrect:"off",spellcheck:!1,value:h.shopperLogin,disabled:m.disabled,onInput:c("shopperLogin","input"),onBlur:c("shopperLogin","blur"),onKeyDown:E,autocomplete:"email"})))};export{m as default};
2
2
  //# sourceMappingURL=CtPLoginInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CtPLoginInput.js","sources":["../../../../../../../src/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.tsx"],"sourcesContent":["import { h, TargetedKeyboardEvent } from 'preact';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport { loginValidationRules } from './validate';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { useFormWithA11y } from '../../../../../utils/useForm';\nimport Field from '../../../FormFields/Field';\nimport InputEmail from '../../../FormFields/InputEmail';\nimport { setFocusOnField } from '../../../../../utils/setFocus';\n\ntype OnChangeProps = { data: CtPLoginInputDataState; valid; errors; isValid: boolean };\n\ninterface CtPLoginInputProps {\n disabled: boolean;\n errorMessage?: string;\n onPressEnter(): Promise<void>;\n onChange({ data, valid, errors, isValid }: OnChangeProps): void;\n onSetInputHandlers(handlers: CtPLoginInputHandlers): void;\n}\n\ninterface CtPLoginInputDataState {\n shopperLogin?: string;\n}\n\nexport type CtPLoginInputHandlers = {\n validateInput(): void;\n focusInput(): void;\n};\n\nconst CtPLoginInput = (props: Readonly<CtPLoginInputProps>): h.JSX.Element => {\n const { i18n } = useCoreContext();\n const formSchema = ['shopperLogin'];\n const containerRef = useRef<HTMLDivElement>(null);\n const { handleChangeFor, data, triggerValidation, valid, errors, isValid } = useFormWithA11y<CtPLoginInputDataState>({\n schema: formSchema,\n rules: loginValidationRules,\n formHolder: containerRef\n });\n const loginInputHandlersRef = useRef<CtPLoginInputHandlers>({ validateInput: null, focusInput: null });\n const [isLoginInputDirty, setIsLoginInputDirty] = useState<boolean>(false);\n\n const validateInput = useCallback(() => {\n setIsLoginInputDirty(true);\n triggerValidation();\n }, [triggerValidation]);\n\n useEffect(() => {\n if (containerRef.current && props.errorMessage) {\n setFocusOnField(containerRef.current, 'shopperLogin');\n }\n }, [props.errorMessage]);\n\n useEffect(() => {\n if (data.shopperLogin) setIsLoginInputDirty(true);\n }, [data.shopperLogin]);\n\n useEffect(() => {\n loginInputHandlersRef.current.validateInput = validateInput;\n props.onSetInputHandlers(loginInputHandlersRef.current);\n }, [validateInput, props.onSetInputHandlers]);\n\n const handleOnKeyDown = useCallback(\n (event: TargetedKeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n void props.onPressEnter();\n }\n },\n [props.onPressEnter]\n );\n\n useEffect(() => {\n props.onChange({ data, valid, errors, isValid });\n }, [data, valid, errors]);\n\n return (\n <div ref={containerRef}>\n <Field\n name=\"shopperLogin\"\n label={i18n.get('ctp.login.inputLabel')}\n errorMessage={isLoginInputDirty ? props.errorMessage || (errors.shopperLogin && i18n.get(errors.shopperLogin.errorMessage)) : null}\n classNameModifiers={['shopperLogin']}\n errorLive={true}\n >\n <InputEmail\n name={'shopperLogin'}\n autocorrect={'off'}\n spellcheck={false}\n value={data.shopperLogin}\n disabled={props.disabled}\n onInput={handleChangeFor('shopperLogin', 'input')}\n onBlur={handleChangeFor('shopperLogin', 'blur')}\n onKeyDown={handleOnKeyDown}\n autocomplete={'email'}\n />\n </Field>\n </div>\n );\n};\n\nexport default CtPLoginInput;\n"],"names":["CtPLoginInput","props","i18n","useCoreContext","containerRef","useRef","handleChangeFor","data","triggerValidation","valid","errors","isValid","useFormWithA11y","schema","rules","loginValidationRules","formHolder","loginInputHandlersRef","validateInput","focusInput","isLoginInputDirty","setIsLoginInputDirty","useState","useCallback","useEffect","current","errorMessage","setFocusOnField","shopperLogin","onSetInputHandlers","handleOnKeyDown","event","key","onPressEnter","onChange","h","div","ref","Field","name","label","get","classNameModifiers","errorLive","InputEmail","autocorrect","spellcheck","value","disabled","onInput","onBlur","onKeyDown","autocomplete"],"mappings":"+iBA4BA,MAAMA,EAAiBC,IACnB,MAAMC,KAAEA,GAASC,IAEXC,EAAeC,EAAuB,OACtCC,gBAAEA,EAAeC,KAAEA,EAAIC,kBAAEA,EAAiBC,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,GAAYC,EAAwC,CACjHC,OAHe,CAAC,gBAIhBC,MAAOC,EACPC,WAAYZ,IAEVa,EAAwBZ,EAA8B,CAAEa,cAAe,KAAMC,WAAY,QACxFC,EAAmBC,GAAwBC,GAAkB,GAE9DJ,EAAgBK,EAAY,KAC9BF,GAAqB,GACrBb,KACD,CAACA,IAEJgB,EAAU,KACFpB,EAAaqB,SAAWxB,EAAMyB,cAC9BC,EAAgBvB,EAAaqB,QAAS,iBAE3C,CAACxB,EAAMyB,eAEVF,EAAU,KACFjB,EAAKqB,cAAcP,GAAqB,IAC7C,CAACd,EAAKqB,eAETJ,EAAU,KACNP,EAAsBQ,QAAQP,cAAgBA,EAC9CjB,EAAM4B,mBAAmBZ,EAAsBQ,UAChD,CAACP,EAAejB,EAAM4B,qBAEzB,MAAMC,EAAkBP,EACnBQ,IACqB,UAAdA,EAAMC,KACD/B,EAAMgC,gBAGnB,CAAChC,EAAMgC,eAOX,OAJAT,EAAU,KACNvB,EAAMiC,SAAS,CAAE3B,OAAME,QAAOC,SAAQC,aACvC,CAACJ,EAAME,EAAOC,IAGbyB,EAACC,MAAAA,CAAIC,IAAKjC,GACN+B,EAACG,EAAAA,CACGC,KAAK,eACLC,MAAOtC,EAAKuC,IAAI,wBAChBf,aAAcN,EAAoBnB,EAAMyB,cAAiBhB,EAAOkB,cAAgB1B,EAAKuC,IAAI/B,EAAOkB,aAAaF,cAAiB,KAC9HgB,mBAAoB,CAAC,gBACrBC,WAAW,GAEXR,EAACS,EAAAA,CACGL,KAAM,eACNM,YAAa,MACbC,YAAY,EACZC,MAAOxC,EAAKqB,aACZoB,SAAU/C,EAAM+C,SAChBC,QAAS3C,EAAgB,eAAgB,SACzC4C,OAAQ5C,EAAgB,eAAgB,QACxC6C,UAAWrB,EACXsB,aAAc"}
1
+ {"version":3,"file":"CtPLoginInput.js","sources":["../../../../../../../src/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.tsx"],"sourcesContent":["import { h, TargetedKeyboardEvent } from 'preact';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport { loginValidationRules } from './validate';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { useFormWithA11y } from '../../../../../utils/useForm';\nimport Field from '../../../FormFields/Field';\nimport InputEmail from '../../../FormFields/InputEmail';\nimport { setFocusOnField } from '../../../../../utils/setFocus';\n\ntype OnChangeProps = { data: CtPLoginInputDataState; valid; errors; isValid: boolean };\n\ninterface CtPLoginInputProps {\n disabled: boolean;\n errorMessage?: string;\n onPressEnter(): Promise<void>;\n onChange({ data, valid, errors, isValid }: OnChangeProps): void;\n onSetInputHandlers(handlers: CtPLoginInputHandlers): void;\n}\n\ninterface CtPLoginInputDataState {\n shopperLogin?: string;\n}\n\nexport type CtPLoginInputHandlers = {\n validateInput(): void;\n focusInput(): void;\n};\n\nconst CtPLoginInput = (props: Readonly<CtPLoginInputProps>): h.JSX.Element => {\n const { i18n } = useCoreContext();\n const formSchema = ['shopperLogin'];\n const containerRef = useRef<HTMLDivElement>(null);\n const { handleChangeFor, data, triggerValidation, valid, errors, isValid } = useFormWithA11y<CtPLoginInputDataState>({\n schema: formSchema,\n rules: loginValidationRules,\n formHolder: containerRef\n });\n const loginInputHandlersRef = useRef<CtPLoginInputHandlers>({ validateInput: null, focusInput: null });\n const [isLoginInputDirty, setIsLoginInputDirty] = useState<boolean>(false);\n\n const validateInput = useCallback(() => {\n setIsLoginInputDirty(true);\n triggerValidation();\n }, [triggerValidation]);\n\n useEffect(() => {\n if (containerRef.current && props.errorMessage) {\n setFocusOnField(containerRef.current, 'shopperLogin');\n }\n }, [props.errorMessage]);\n\n useEffect(() => {\n if (data.shopperLogin) setIsLoginInputDirty(true);\n }, [data.shopperLogin]);\n\n useEffect(() => {\n loginInputHandlersRef.current.validateInput = validateInput;\n props.onSetInputHandlers(loginInputHandlersRef.current);\n }, [validateInput, props.onSetInputHandlers]);\n\n const handleOnKeyDown = useCallback(\n (event: TargetedKeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n void props.onPressEnter();\n }\n },\n [props.onPressEnter]\n );\n\n useEffect(() => {\n props.onChange({ data, valid, errors, isValid });\n }, [data, valid, errors]);\n\n return (\n <div ref={containerRef}>\n <Field\n name=\"shopperLogin\"\n label={i18n.get('ctp.login.inputLabel')}\n errorMessage={\n isLoginInputDirty\n ? props.errorMessage ||\n (errors.shopperLogin && typeof errors.shopperLogin?.errorMessage === 'string'\n ? i18n.get(errors.shopperLogin.errorMessage)\n : null)\n : null\n }\n classNameModifiers={['shopperLogin']}\n errorLive={true}\n >\n <InputEmail\n name={'shopperLogin'}\n autocorrect={'off'}\n spellcheck={false}\n value={data.shopperLogin}\n disabled={props.disabled}\n onInput={handleChangeFor('shopperLogin', 'input')}\n onBlur={handleChangeFor('shopperLogin', 'blur')}\n onKeyDown={handleOnKeyDown}\n autocomplete={'email'}\n />\n </Field>\n </div>\n );\n};\n\nexport default CtPLoginInput;\n"],"names":["CtPLoginInput","props","i18n","useCoreContext","containerRef","useRef","handleChangeFor","data","triggerValidation","valid","errors","isValid","useFormWithA11y","schema","rules","loginValidationRules","formHolder","loginInputHandlersRef","validateInput","focusInput","isLoginInputDirty","setIsLoginInputDirty","useState","useCallback","useEffect","current","errorMessage","setFocusOnField","shopperLogin","onSetInputHandlers","handleOnKeyDown","event","key","onPressEnter","onChange","h","div","ref","Field","name","label","get","classNameModifiers","errorLive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MAAOxC,EAAKqB,aACZoB,SAAU/C,EAAM+C,SAChBC,QAAS3C,EAAgB,eAAgB,SACzC4C,OAAQ5C,EAAgB,eAAgB,QACxC6C,UAAWrB,EACXsB,aAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"ClickToPayProvider.js","sources":["../../../../../../src/components/internal/ClickToPay/context/ClickToPayProvider.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { CtpState } from '../services/ClickToPayService';\nimport { ClickToPayContext } from './ClickToPayContext';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport { ClickToPayCheckoutPayload, IClickToPayService, IdentityLookupParams } from '../services/types';\nimport ShopperCard from '../models/ShopperCard';\nimport { ClickToPayProps } from '../types';\nimport AdyenCheckoutError from '../../../../core/Errors/AdyenCheckoutError';\nimport { ComponentMethodsRef, UIElementStatus } from '../../UIElement/types';\n\ntype ClickToPayProviderRef = {\n setStatus?(status: UIElementStatus): void;\n};\n\nexport type ClickToPayProviderProps = {\n isStandaloneComponent: boolean;\n clickToPayService: IClickToPayService | null;\n configuration: ClickToPayProps;\n children: any;\n setClickToPayRef(ref: ComponentMethodsRef): void;\n onSubmit(payload: ClickToPayCheckoutPayload): void;\n onSetStatus(status: UIElementStatus): void;\n onError(error: AdyenCheckoutError): void;\n};\n\nconst ClickToPayProvider = ({\n isStandaloneComponent = false,\n clickToPayService,\n configuration,\n children,\n setClickToPayRef,\n onSubmit,\n onSetStatus,\n onError\n}: Readonly<ClickToPayProviderProps>) => {\n const [ctpService] = useState<IClickToPayService | null>(clickToPayService);\n const [ctpState, setCtpState] = useState<CtpState>(clickToPayService?.state || CtpState.NotAvailable);\n const [isCtpPrimaryPaymentMethod, setIsCtpPrimaryPaymentMethod] = useState<boolean>(true);\n const [status, setStatus] = useState<UIElementStatus>('ready');\n const isOnReadyInvoked = useRef<boolean>(false);\n\n const clickToPayRef = useRef<ClickToPayProviderRef>({\n setStatus\n });\n\n useEffect(() => {\n setClickToPayRef(clickToPayRef.current);\n }, []);\n\n useEffect(() => {\n ctpService?.subscribeOnStateChange(status => setCtpState(status));\n }, [ctpService]);\n\n const onReady = useCallback(() => {\n if (isOnReadyInvoked.current) {\n return;\n }\n configuration.onReady?.();\n isOnReadyInvoked.current = true;\n }, [configuration?.onReady]);\n\n const finishIdentityValidation = useCallback(\n async (otpValue: string) => {\n await ctpService?.finishIdentityValidation(otpValue);\n },\n [ctpService]\n );\n\n const startIdentityValidation = useCallback(async () => {\n const data = await ctpService?.startIdentityValidation();\n return data;\n }, [ctpService]);\n\n const checkout = useCallback(\n async (card: ShopperCard) => {\n return await ctpService?.checkout(card);\n },\n [ctpService]\n );\n\n const verifyIfShopperIsEnrolled = useCallback(\n async (shopperIdentity: IdentityLookupParams) => {\n return await ctpService?.verifyIfShopperIsEnrolled(shopperIdentity);\n },\n [ctpService]\n );\n\n const logoutShopper = useCallback(async () => {\n await ctpService?.logout();\n }, [ctpService]);\n\n const updateStoreCookiesConsent = useCallback(\n (shouldStore: boolean) => {\n ctpService.updateStoreCookiesConsent(shouldStore);\n },\n [ctpService]\n );\n\n return (\n <ClickToPayContext.Provider\n value={{\n status,\n onSubmit,\n onError,\n onSetStatus,\n configuration,\n isStoringCookies: ctpService?.storeCookies,\n isStandaloneComponent,\n isCtpPrimaryPaymentMethod,\n setIsCtpPrimaryPaymentMethod,\n ctpState,\n verifyIfShopperIsEnrolled,\n cards: ctpService?.shopperCards,\n schemes: ctpService?.schemes,\n otpMaskedContact: ctpService?.identityValidationData?.maskedShopperContact,\n otpNetwork: ctpService?.identityValidationData?.selectedNetwork,\n checkout,\n logoutShopper,\n startIdentityValidation,\n finishIdentityValidation,\n updateStoreCookiesConsent,\n onReady\n }}\n >\n {children}\n </ClickToPayContext.Provider>\n );\n};\n\nexport default ClickToPayProvider;\n"],"names":["ClickToPayProvider","isStandaloneComponent","clickToPayService","configuration","children","setClickToPayRef","onSubmit","onSetStatus","onError","ctpService","useState","ctpState","setCtpState","state","CtpState","NotAvailable","isCtpPrimaryPaymentMethod","setIsCtpPrimaryPaymentMethod","status","setStatus","isOnReadyInvoked","useRef","clickToPayRef","useEffect","current","subscribeOnStateChange","onReady","useCallback","finishIdentityValidation","async","otpValue","startIdentityValidation","checkout","card","verifyIfShopperIsEnrolled","shopperIdentity","logoutShopper","logout","updateStoreCookiesConsent","shouldStore","h","ClickToPayContext","Provider","value","isStoringCookies","storeCookies","cards","shopperCards","schemes","otpMaskedContact","identityValidationData","maskedShopperContact","otpNetwork","selectedNetwork"],"mappings":"yTAyBA,MAAMA,EAAqB,EACvBC,yBAAwB,EACxBC,oBACAC,gBACAC,WACAC,mBACAC,WACAC,cACAC,cAEA,MAAOC,GAAcC,EAAoCR,IAClDS,EAAUC,GAAeF,EAAmBR,GAAmBW,OAASC,EAASC,eACjFC,EAA2BC,GAAgCP,GAAkB,IAC7EQ,EAAQC,GAAaT,EAA0B,SAChDU,EAAmBC,GAAgB,GAEnCC,EAAgBD,EAA8B,CAChDF,cAGJI,EAAU,KACNlB,EAAiBiB,EAAcE,UAChC,IAEHD,EAAU,KACNd,GAAYgB,uBAAuBP,GAAUN,EAAYM,KAC1D,CAACT,IAEJ,MAAMiB,EAAUC,EAAY,KACpBP,EAAiBI,UAGrBrB,EAAcuB,YACdN,EAAiBI,SAAU,IAC5B,CAACrB,GAAeuB,UAEbE,EAA2BD,EAC7BE,MAAOC,UACGrB,GAAYmB,yBAAyBE,KAE/C,CAACrB,IAGCsB,EAA0BJ,EAAYE,eACrBpB,GAAYsB,2BAEhC,CAACtB,IAEEuB,EAAWL,EACbE,MAAOI,SACUxB,GAAYuB,SAASC,IAEtC,CAACxB,IAGCyB,EAA4BP,EAC9BE,MAAOM,SACU1B,GAAYyB,0BAA0BC,IAEvD,CAAC1B,IAGC2B,EAAgBT,EAAYE,gBACxBpB,GAAY4B,WACnB,CAAC5B,IAEE6B,EAA4BX,EAC7BY,IACG9B,EAAW6B,0BAA0BC,IAEzC,CAAC9B,IAGL,OACI+B,EAACC,EAAkBC,SAAQ,CACvBC,MAAO,CACHzB,SACAZ,WACAE,UACAD,cACAJ,gBACAyC,iBAAkBnC,GAAYoC,aAC9B5C,wBACAe,4BACAC,+BACAN,WACAuB,4BACAY,MAAOrC,GAAYsC,aACnBC,QAASvC,GAAYuC,QACrBC,iBAAkBxC,GAAYyC,wBAAwBC,qBACtDC,WAAY3C,GAAYyC,wBAAwBG,gBAChDrB,WACAI,gBACAL,0BACAH,2BACAU,4BACAZ,YAGHtB"}
1
+ {"version":3,"file":"ClickToPayProvider.js","sources":["../../../../../../src/components/internal/ClickToPay/context/ClickToPayProvider.tsx"],"sourcesContent":["import { ComponentChildren, h } from 'preact';\nimport { CtpState } from '../services/ClickToPayService';\nimport { ClickToPayContext } from './ClickToPayContext';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport { ClickToPayCheckoutPayload, IClickToPayService, IdentityLookupParams } from '../services/types';\nimport ShopperCard from '../models/ShopperCard';\nimport { ClickToPayProps } from '../types';\nimport AdyenCheckoutError from '../../../../core/Errors/AdyenCheckoutError';\nimport { ComponentMethodsRef, UIElementStatus } from '../../UIElement/types';\n\ntype ClickToPayProviderRef = {\n setStatus?(status: UIElementStatus): void;\n};\n\nexport type ClickToPayProviderProps = {\n isStandaloneComponent: boolean;\n clickToPayService: IClickToPayService | null;\n configuration: ClickToPayProps;\n children: ComponentChildren;\n setClickToPayRef(ref: ComponentMethodsRef): void;\n onSubmit(payload: ClickToPayCheckoutPayload): void;\n onSetStatus(status: UIElementStatus): void;\n onError(error: AdyenCheckoutError): void;\n};\n\nconst ClickToPayProvider = ({\n isStandaloneComponent = false,\n clickToPayService,\n configuration,\n children,\n setClickToPayRef,\n onSubmit,\n onSetStatus,\n onError\n}: Readonly<ClickToPayProviderProps>) => {\n const [ctpService] = useState<IClickToPayService | null>(clickToPayService);\n const [ctpState, setCtpState] = useState<CtpState>(clickToPayService?.state || CtpState.NotAvailable);\n const [isCtpPrimaryPaymentMethod, setIsCtpPrimaryPaymentMethod] = useState<boolean>(true);\n const [status, setStatus] = useState<UIElementStatus>('ready');\n const isOnReadyInvoked = useRef<boolean>(false);\n\n const clickToPayRef = useRef<ClickToPayProviderRef>({\n setStatus\n });\n\n useEffect(() => {\n setClickToPayRef(clickToPayRef.current);\n }, []);\n\n useEffect(() => {\n ctpService?.subscribeOnStateChange(status => setCtpState(status));\n }, [ctpService]);\n\n const onReady = useCallback(() => {\n if (isOnReadyInvoked.current) {\n return;\n }\n configuration.onReady?.();\n isOnReadyInvoked.current = true;\n }, [configuration?.onReady]);\n\n const finishIdentityValidation = useCallback(\n async (otpValue: string) => {\n await ctpService?.finishIdentityValidation(otpValue);\n },\n [ctpService]\n );\n\n const startIdentityValidation = useCallback(async () => {\n const data = await ctpService?.startIdentityValidation();\n return data;\n }, [ctpService]);\n\n const checkout = useCallback(\n async (card: ShopperCard) => {\n return await ctpService?.checkout(card);\n },\n [ctpService]\n );\n\n const verifyIfShopperIsEnrolled = useCallback(\n async (shopperIdentity: IdentityLookupParams) => {\n return await ctpService?.verifyIfShopperIsEnrolled(shopperIdentity);\n },\n [ctpService]\n );\n\n const logoutShopper = useCallback(async () => {\n await ctpService?.logout();\n }, [ctpService]);\n\n const updateStoreCookiesConsent = useCallback(\n (shouldStore: boolean) => {\n ctpService.updateStoreCookiesConsent(shouldStore);\n },\n [ctpService]\n );\n\n return (\n <ClickToPayContext.Provider\n value={{\n status,\n onSubmit,\n onError,\n onSetStatus,\n configuration,\n isStoringCookies: ctpService?.storeCookies,\n isStandaloneComponent,\n isCtpPrimaryPaymentMethod,\n setIsCtpPrimaryPaymentMethod,\n ctpState,\n verifyIfShopperIsEnrolled,\n cards: ctpService?.shopperCards,\n schemes: ctpService?.schemes,\n otpMaskedContact: ctpService?.identityValidationData?.maskedShopperContact,\n otpNetwork: ctpService?.identityValidationData?.selectedNetwork,\n checkout,\n logoutShopper,\n startIdentityValidation,\n finishIdentityValidation,\n updateStoreCookiesConsent,\n onReady\n }}\n >\n {children}\n </ClickToPayContext.Provider>\n );\n};\n\nexport default ClickToPayProvider;\n"],"names":["ClickToPayProvider","isStandaloneComponent","clickToPayService","configuration","children","setClickToPayRef","onSubmit","onSetStatus","onError","ctpService","useState","ctpState","setCtpState","state","CtpState","NotAvailable","isCtpPrimaryPaymentMethod","setIsCtpPrimaryPaymentMethod","status","setStatus","isOnReadyInvoked","useRef","clickToPayRef","useEffect","current","subscribeOnStateChange","onReady","useCallback","finishIdentityValidation","async","otpValue","startIdentityValidation","checkout","card","verifyIfShopperIsEnrolled","shopperIdentity","logoutShopper","logout","updateStoreCookiesConsent","shouldStore","h","ClickToPayContext","Provider","value","isStoringCookies","storeCookies","cards","shopperCards","schemes","otpMaskedContact","identityValidationData","maskedShopperContact","otpNetwork","selectedNetwork"],"mappings":"yTAyBA,MAAMA,EAAqB,EACvBC,yBAAwB,EACxBC,oBACAC,gBACAC,WACAC,mBACAC,WACAC,cACAC,cAEA,MAAOC,GAAcC,EAAoCR,IAClDS,EAAUC,GAAeF,EAAmBR,GAAmBW,OAASC,EAASC,eACjFC,EAA2BC,GAAgCP,GAAkB,IAC7EQ,EAAQC,GAAaT,EAA0B,SAChDU,EAAmBC,GAAgB,GAEnCC,EAAgBD,EAA8B,CAChDF,cAGJI,EAAU,KACNlB,EAAiBiB,EAAcE,UAChC,IAEHD,EAAU,KACNd,GAAYgB,uBAAuBP,GAAUN,EAAYM,KAC1D,CAACT,IAEJ,MAAMiB,EAAUC,EAAY,KACpBP,EAAiBI,UAGrBrB,EAAcuB,YACdN,EAAiBI,SAAU,IAC5B,CAACrB,GAAeuB,UAEbE,EAA2BD,EAC7BE,MAAOC,UACGrB,GAAYmB,yBAAyBE,KAE/C,CAACrB,IAGCsB,EAA0BJ,EAAYE,eACrBpB,GAAYsB,2BAEhC,CAACtB,IAEEuB,EAAWL,EACbE,MAAOI,SACUxB,GAAYuB,SAASC,IAEtC,CAACxB,IAGCyB,EAA4BP,EAC9BE,MAAOM,SACU1B,GAAYyB,0BAA0BC,IAEvD,C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