@adyen/adyen-web 6.45.2 → 6.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (410) hide show
  1. package/dist/cjs/adyen.css +7 -7
  2. package/dist/cjs/adyen.css.map +1 -1
  3. package/dist/cjs/index.cjs +2 -2
  4. package/dist/cjs/index.cjs.map +1 -1
  5. package/dist/cjs/index.d.cts +2027 -1918
  6. package/dist/es/adyen.css +7 -7
  7. package/dist/es/adyen.css.map +1 -1
  8. package/dist/es/components/ANCV/ANCV.js +1 -1
  9. package/dist/es/components/ANCV/ANCV.js.map +1 -1
  10. package/dist/es/components/ANCV/components/ANCVInput.js +1 -1
  11. package/dist/es/components/ANCV/components/ANCVInput.js.map +1 -1
  12. package/dist/es/components/Ach/Ach.js +1 -1
  13. package/dist/es/components/Ach/Ach.js.map +1 -1
  14. package/dist/es/components/Ach/components/AchComponent.js +1 -1
  15. package/dist/es/components/Ach/components/AchComponent.js.map +1 -1
  16. package/dist/es/components/Ach/components/useSRPanelForACHErrors.js.map +1 -1
  17. package/dist/es/components/AmazonPay/AmazonPay.js +1 -1
  18. package/dist/es/components/AmazonPay/AmazonPay.js.map +1 -1
  19. package/dist/es/components/ApplePay/ApplePay.js.map +1 -1
  20. package/dist/es/components/BacsDD/BacsDD.js +1 -1
  21. package/dist/es/components/BacsDD/BacsDD.js.map +1 -1
  22. package/dist/es/components/BacsDD/components/BacsInput.js +1 -1
  23. package/dist/es/components/BacsDD/components/BacsInput.js.map +1 -1
  24. package/dist/es/components/BankTransfer/BankTransfer.js +1 -1
  25. package/dist/es/components/BankTransfer/BankTransfer.js.map +1 -1
  26. package/dist/es/components/BankTransfer/components/BankTransferInput/BankTransferInput.js +1 -1
  27. package/dist/es/components/BankTransfer/components/BankTransferInput/BankTransferInput.js.map +1 -1
  28. package/dist/es/components/Blik/Blik.js +1 -1
  29. package/dist/es/components/Blik/Blik.js.map +1 -1
  30. package/dist/es/components/Blik/components/BlikInput.js +1 -1
  31. package/dist/es/components/Blik/components/BlikInput.js.map +1 -1
  32. package/dist/es/components/Boleto/components/BoletoInput/BoletoInput.js +1 -1
  33. package/dist/es/components/Boleto/components/BoletoInput/BoletoInput.js.map +1 -1
  34. package/dist/es/components/Card/Card.js +1 -1
  35. package/dist/es/components/Card/Card.js.map +1 -1
  36. package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
  37. package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
  38. package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js +1 -1
  39. package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
  40. package/dist/es/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js +1 -1
  41. package/dist/es/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js.map +1 -1
  42. package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
  43. package/dist/es/components/Card/components/CardInput/utils.js +1 -1
  44. package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
  45. package/dist/es/components/CashAppPay/CashAppPay.js +1 -1
  46. package/dist/es/components/CashAppPay/CashAppPay.js.map +1 -1
  47. package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
  48. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  49. package/dist/es/components/Doku/components/DokuInput/DokuInput.js +1 -1
  50. package/dist/es/components/Doku/components/DokuInput/DokuInput.js.map +1 -1
  51. package/dist/es/components/Donation/Donation.js +1 -1
  52. package/dist/es/components/Donation/Donation.js.map +1 -1
  53. package/dist/es/components/Donation/components/DonationComponent.js +1 -1
  54. package/dist/es/components/Donation/components/DonationComponent.js.map +1 -1
  55. package/dist/es/components/Dragonpay/Dragonpay.js +1 -1
  56. package/dist/es/components/Dragonpay/Dragonpay.js.map +1 -1
  57. package/dist/es/components/Dragonpay/components/DragonpayInput/DragonpayInput.js +1 -1
  58. package/dist/es/components/Dragonpay/components/DragonpayInput/DragonpayInput.js.map +1 -1
  59. package/dist/es/components/Dropin/Dropin.js +1 -1
  60. package/dist/es/components/Dropin/Dropin.js.map +1 -1
  61. package/dist/es/components/Dropin/components/DropinComponent.js.map +1 -1
  62. package/dist/es/components/Econtext/Econtext.js +1 -1
  63. package/dist/es/components/Econtext/Econtext.js.map +1 -1
  64. package/dist/es/components/Econtext/components/EcontextInput/EcontextInput.js +1 -1
  65. package/dist/es/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
  66. package/dist/es/components/Giftcard/Giftcard.js +1 -1
  67. package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
  68. package/dist/es/components/Giftcard/components/GiftcardComponent.js +1 -1
  69. package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  70. package/dist/es/components/Giftcard/components/GiftcardResult.js +1 -1
  71. package/dist/es/components/Giftcard/components/GiftcardResult.js.map +1 -1
  72. package/dist/es/components/Giropay/Giropay.js +1 -1
  73. package/dist/es/components/Giropay/Giropay.js.map +1 -1
  74. package/dist/es/components/Iris/Iris.js +1 -1
  75. package/dist/es/components/Iris/Iris.js.map +1 -1
  76. package/dist/es/components/Iris/components/IrisComponent.js +1 -1
  77. package/dist/es/components/Iris/components/IrisComponent.js.map +1 -1
  78. package/dist/es/components/Iris/components/IrisGenerateQRCode.js +1 -1
  79. package/dist/es/components/Iris/components/IrisGenerateQRCode.js.map +1 -1
  80. package/dist/es/components/Klarna/KlarnaPayments.js +1 -1
  81. package/dist/es/components/Klarna/KlarnaPayments.js.map +1 -1
  82. package/dist/es/components/Klarna/components/KlarnaContainer/KlarnaContainer.js +1 -1
  83. package/dist/es/components/Klarna/components/KlarnaContainer/KlarnaContainer.js.map +1 -1
  84. package/dist/es/components/MBWay/MBWay.js +1 -1
  85. package/dist/es/components/MBWay/MBWay.js.map +1 -1
  86. package/dist/es/components/MBWay/components/MBWayInput/MBWayInput.js +1 -1
  87. package/dist/es/components/MBWay/components/MBWayInput/MBWayInput.js.map +1 -1
  88. package/dist/es/components/Multibanco/Multibanco.js +1 -1
  89. package/dist/es/components/Multibanco/Multibanco.js.map +1 -1
  90. package/dist/es/components/Oxxo/Oxxo.js +1 -1
  91. package/dist/es/components/Oxxo/Oxxo.js.map +1 -1
  92. package/dist/es/components/PayByBankPix/PayByBankPix.js +1 -1
  93. package/dist/es/components/PayByBankPix/PayByBankPix.js.map +1 -1
  94. package/dist/es/components/PayByBankPix/components/Enrollment/Enrollment.js +1 -1
  95. package/dist/es/components/PayByBankPix/components/Enrollment/Enrollment.js.map +1 -1
  96. package/dist/es/components/PayByBankUS/PayByBankUS.js +1 -1
  97. package/dist/es/components/PayByBankUS/PayByBankUS.js.map +1 -1
  98. package/dist/es/components/PayPal/Paypal.js +1 -1
  99. package/dist/es/components/PayPal/Paypal.js.map +1 -1
  100. package/dist/es/components/PayPalFastlane/Fastlane.js +1 -1
  101. package/dist/es/components/PayPalFastlane/Fastlane.js.map +1 -1
  102. package/dist/es/components/PayPalFastlane/components/FastlaneComponent.js +1 -1
  103. package/dist/es/components/PayPalFastlane/components/FastlaneComponent.js.map +1 -1
  104. package/dist/es/components/PayTo/PayTo.js +1 -1
  105. package/dist/es/components/PayTo/PayTo.js.map +1 -1
  106. package/dist/es/components/PayTo/components/BSBInput.js +1 -1
  107. package/dist/es/components/PayTo/components/BSBInput.js.map +1 -1
  108. package/dist/es/components/PayTo/components/PayToComponent.js +1 -1
  109. package/dist/es/components/PayTo/components/PayToComponent.js.map +1 -1
  110. package/dist/es/components/PayTo/components/PayToNameFields.js +1 -1
  111. package/dist/es/components/PayTo/components/PayToNameFields.js.map +1 -1
  112. package/dist/es/components/PayTo/components/PayToPhone.js +1 -1
  113. package/dist/es/components/PayTo/components/PayToPhone.js.map +1 -1
  114. package/dist/es/components/Pix/Pix.js +1 -1
  115. package/dist/es/components/Pix/Pix.js.map +1 -1
  116. package/dist/es/components/Pix/components/PixInput/PixInput.js +1 -1
  117. package/dist/es/components/Pix/components/PixInput/PixInput.js.map +1 -1
  118. package/dist/es/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js +1 -1
  119. package/dist/es/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js.map +1 -1
  120. package/dist/es/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js +1 -1
  121. package/dist/es/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js.map +1 -1
  122. package/dist/es/components/Redirect/Redirect.js +1 -1
  123. package/dist/es/components/Redirect/Redirect.js.map +1 -1
  124. package/dist/es/components/Sepa/Sepa.js.map +1 -1
  125. package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  126. package/dist/es/components/Trustly/Trustly.js +1 -1
  127. package/dist/es/components/Trustly/Trustly.js.map +1 -1
  128. package/dist/es/components/UPI/UPI.js +1 -1
  129. package/dist/es/components/UPI/UPI.js.map +1 -1
  130. package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
  131. package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
  132. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
  133. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  134. package/dist/es/components/helpers/QRLoaderContainer/QRLoaderContainer.js +1 -1
  135. package/dist/es/components/helpers/QRLoaderContainer/QRLoaderContainer.js.map +1 -1
  136. package/dist/es/components/internal/Address/components/CountryField.js.map +1 -1
  137. package/dist/es/components/internal/Address/components/FieldContainer.js +1 -1
  138. package/dist/es/components/internal/Address/components/FieldContainer.js.map +1 -1
  139. package/dist/es/components/internal/Address/components/StateField.js.map +1 -1
  140. package/dist/es/components/internal/Address/constants.js +1 -1
  141. package/dist/es/components/internal/Address/constants.js.map +1 -1
  142. package/dist/es/components/internal/Address/validate.formats.js +1 -1
  143. package/dist/es/components/internal/Address/validate.formats.js.map +1 -1
  144. package/dist/es/components/internal/Address/validate.js +1 -1
  145. package/dist/es/components/internal/Address/validate.js.map +1 -1
  146. package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
  147. package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
  148. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js +1 -1
  149. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js.map +1 -1
  150. package/dist/es/components/internal/DisclaimerMessage/DisclaimerMessage.js +1 -1
  151. package/dist/es/components/internal/DisclaimerMessage/DisclaimerMessage.js.map +1 -1
  152. package/dist/es/components/internal/DisclaimerMessage/utils.js +2 -0
  153. package/dist/es/components/internal/DisclaimerMessage/utils.js.map +1 -0
  154. package/dist/es/components/internal/FormFields/utils.js +1 -1
  155. package/dist/es/components/internal/FormFields/utils.js.map +1 -1
  156. package/dist/es/components/internal/IbanInput/IbanInput.js +1 -1
  157. package/dist/es/components/internal/IbanInput/IbanInput.js.map +1 -1
  158. package/dist/es/components/internal/IbanInput/validate.js +1 -1
  159. package/dist/es/components/internal/IbanInput/validate.js.map +1 -1
  160. package/dist/es/components/internal/IssuerList/IssuerList.js +1 -1
  161. package/dist/es/components/internal/IssuerList/IssuerList.js.map +1 -1
  162. package/dist/es/components/internal/OpenInvoice/OpenInvoice.js +1 -1
  163. package/dist/es/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  164. package/dist/es/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js +1 -1
  165. package/dist/es/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -1
  166. package/dist/es/components/internal/PayButton/PayButton.js +1 -1
  167. package/dist/es/components/internal/PayButton/PayButton.js.map +1 -1
  168. package/dist/es/components/internal/PhoneInput/PhoneInputForm.js +1 -1
  169. package/dist/es/components/internal/PhoneInput/PhoneInputForm.js.map +1 -1
  170. package/dist/es/components/internal/PhoneInput/usePhonePrefixes.js.map +1 -1
  171. package/dist/es/components/internal/RedirectButton/RedirectButton.js +1 -1
  172. package/dist/es/components/internal/RedirectButton/RedirectButton.js.map +1 -1
  173. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  174. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  175. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  176. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  177. package/dist/es/components/internal/UIElement/UIElement.js +1 -1
  178. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  179. package/dist/es/components/internal/UIElement/utils.js +1 -1
  180. package/dist/es/components/internal/UIElement/utils.js.map +1 -1
  181. package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
  182. package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
  183. package/dist/es/core/Errors/AdyenCheckoutError.js.map +1 -1
  184. package/dist/es/core/Errors/SRPanelProvider.js.map +1 -1
  185. package/dist/es/core/RiskModule/RiskModule.js +1 -1
  186. package/dist/es/core/RiskModule/RiskModule.js.map +1 -1
  187. package/dist/es/core/RiskModule/components/DeviceFingerprint/GetDeviceFingerprint.js.map +1 -1
  188. package/dist/es/core/Services/get-dataset.js.map +1 -1
  189. package/dist/es/core/Services/http.js +1 -1
  190. package/dist/es/core/Services/http.js.map +1 -1
  191. package/dist/es/core/config.js +1 -1
  192. package/dist/es/core/config.js.map +1 -1
  193. package/dist/es/core/core.js.map +1 -1
  194. package/dist/es/core/core.registry.js +1 -1
  195. package/dist/es/core/core.registry.js.map +1 -1
  196. package/dist/es/core/utils.js +1 -1
  197. package/dist/es/core/utils.js.map +1 -1
  198. package/dist/es/index.d.ts +2027 -1918
  199. package/dist/es/packages/server/translations/en-US.json.js +1 -1
  200. package/dist/es/utils/Validator/Validator.js +1 -1
  201. package/dist/es/utils/Validator/Validator.js.map +1 -1
  202. package/dist/es/utils/useForm/reducer.js +1 -1
  203. package/dist/es/utils/useForm/reducer.js.map +1 -1
  204. package/dist/es/utils/useForm/useForm.js +1 -1
  205. package/dist/es/utils/useForm/useForm.js.map +1 -1
  206. package/dist/es/utils/useForm/useFormWithA11y.js +1 -1
  207. package/dist/es/utils/useForm/useFormWithA11y.js.map +1 -1
  208. package/dist/es-legacy/adyen.css +7 -7
  209. package/dist/es-legacy/adyen.css.map +1 -1
  210. package/dist/es-legacy/components/ANCV/ANCV.js +1 -1
  211. package/dist/es-legacy/components/ANCV/ANCV.js.map +1 -1
  212. package/dist/es-legacy/components/ANCV/components/ANCVInput.js +1 -1
  213. package/dist/es-legacy/components/ANCV/components/ANCVInput.js.map +1 -1
  214. package/dist/es-legacy/components/Ach/Ach.js +1 -1
  215. package/dist/es-legacy/components/Ach/Ach.js.map +1 -1
  216. package/dist/es-legacy/components/Ach/components/AchComponent.js +1 -1
  217. package/dist/es-legacy/components/Ach/components/AchComponent.js.map +1 -1
  218. package/dist/es-legacy/components/Ach/components/useSRPanelForACHErrors.js.map +1 -1
  219. package/dist/es-legacy/components/AmazonPay/AmazonPay.js +1 -1
  220. package/dist/es-legacy/components/AmazonPay/AmazonPay.js.map +1 -1
  221. package/dist/es-legacy/components/ApplePay/ApplePay.js.map +1 -1
  222. package/dist/es-legacy/components/BacsDD/BacsDD.js +1 -1
  223. package/dist/es-legacy/components/BacsDD/BacsDD.js.map +1 -1
  224. package/dist/es-legacy/components/BacsDD/components/BacsInput.js +1 -1
  225. package/dist/es-legacy/components/BacsDD/components/BacsInput.js.map +1 -1
  226. package/dist/es-legacy/components/BankTransfer/BankTransfer.js +1 -1
  227. package/dist/es-legacy/components/BankTransfer/BankTransfer.js.map +1 -1
  228. package/dist/es-legacy/components/BankTransfer/components/BankTransferInput/BankTransferInput.js +1 -1
  229. package/dist/es-legacy/components/BankTransfer/components/BankTransferInput/BankTransferInput.js.map +1 -1
  230. package/dist/es-legacy/components/Blik/Blik.js +1 -1
  231. package/dist/es-legacy/components/Blik/Blik.js.map +1 -1
  232. package/dist/es-legacy/components/Blik/components/BlikInput.js +1 -1
  233. package/dist/es-legacy/components/Blik/components/BlikInput.js.map +1 -1
  234. package/dist/es-legacy/components/Boleto/components/BoletoInput/BoletoInput.js +1 -1
  235. package/dist/es-legacy/components/Boleto/components/BoletoInput/BoletoInput.js.map +1 -1
  236. package/dist/es-legacy/components/Card/Card.js +1 -1
  237. package/dist/es-legacy/components/Card/Card.js.map +1 -1
  238. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
  239. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
  240. package/dist/es-legacy/components/Card/components/CardInput/components/CardFieldsWrapper.js +1 -1
  241. package/dist/es-legacy/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
  242. package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js +1 -1
  243. package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFieldsWrapper.js.map +1 -1
  244. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  245. package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
  246. package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
  247. package/dist/es-legacy/components/CashAppPay/CashAppPay.js +1 -1
  248. package/dist/es-legacy/components/CashAppPay/CashAppPay.js.map +1 -1
  249. package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
  250. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  251. package/dist/es-legacy/components/Doku/components/DokuInput/DokuInput.js +1 -1
  252. package/dist/es-legacy/components/Doku/components/DokuInput/DokuInput.js.map +1 -1
  253. package/dist/es-legacy/components/Donation/Donation.js +1 -1
  254. package/dist/es-legacy/components/Donation/Donation.js.map +1 -1
  255. package/dist/es-legacy/components/Donation/components/DonationComponent.js +1 -1
  256. package/dist/es-legacy/components/Donation/components/DonationComponent.js.map +1 -1
  257. package/dist/es-legacy/components/Dragonpay/Dragonpay.js +1 -1
  258. package/dist/es-legacy/components/Dragonpay/Dragonpay.js.map +1 -1
  259. package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js +1 -1
  260. package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js.map +1 -1
  261. package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
  262. package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
  263. package/dist/es-legacy/components/Dropin/components/DropinComponent.js.map +1 -1
  264. package/dist/es-legacy/components/Econtext/Econtext.js +1 -1
  265. package/dist/es-legacy/components/Econtext/Econtext.js.map +1 -1
  266. package/dist/es-legacy/components/Econtext/components/EcontextInput/EcontextInput.js +1 -1
  267. package/dist/es-legacy/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
  268. package/dist/es-legacy/components/Giftcard/Giftcard.js +1 -1
  269. package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
  270. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js +1 -1
  271. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  272. package/dist/es-legacy/components/Giftcard/components/GiftcardResult.js +1 -1
  273. package/dist/es-legacy/components/Giftcard/components/GiftcardResult.js.map +1 -1
  274. package/dist/es-legacy/components/Giropay/Giropay.js +1 -1
  275. package/dist/es-legacy/components/Giropay/Giropay.js.map +1 -1
  276. package/dist/es-legacy/components/Iris/Iris.js +1 -1
  277. package/dist/es-legacy/components/Iris/Iris.js.map +1 -1
  278. package/dist/es-legacy/components/Iris/components/IrisComponent.js +1 -1
  279. package/dist/es-legacy/components/Iris/components/IrisComponent.js.map +1 -1
  280. package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.js +1 -1
  281. package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.js.map +1 -1
  282. package/dist/es-legacy/components/Klarna/KlarnaPayments.js +1 -1
  283. package/dist/es-legacy/components/Klarna/KlarnaPayments.js.map +1 -1
  284. package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js +1 -1
  285. package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js.map +1 -1
  286. package/dist/es-legacy/components/MBWay/MBWay.js +1 -1
  287. package/dist/es-legacy/components/MBWay/MBWay.js.map +1 -1
  288. package/dist/es-legacy/components/MBWay/components/MBWayInput/MBWayInput.js +1 -1
  289. package/dist/es-legacy/components/MBWay/components/MBWayInput/MBWayInput.js.map +1 -1
  290. package/dist/es-legacy/components/Multibanco/Multibanco.js +1 -1
  291. package/dist/es-legacy/components/Multibanco/Multibanco.js.map +1 -1
  292. package/dist/es-legacy/components/Oxxo/Oxxo.js +1 -1
  293. package/dist/es-legacy/components/Oxxo/Oxxo.js.map +1 -1
  294. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js +1 -1
  295. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js.map +1 -1
  296. package/dist/es-legacy/components/PayByBankPix/components/Enrollment/Enrollment.js +1 -1
  297. package/dist/es-legacy/components/PayByBankPix/components/Enrollment/Enrollment.js.map +1 -1
  298. package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js +1 -1
  299. package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js.map +1 -1
  300. package/dist/es-legacy/components/PayPal/Paypal.js +1 -1
  301. package/dist/es-legacy/components/PayPal/Paypal.js.map +1 -1
  302. package/dist/es-legacy/components/PayPalFastlane/Fastlane.js +1 -1
  303. package/dist/es-legacy/components/PayPalFastlane/Fastlane.js.map +1 -1
  304. package/dist/es-legacy/components/PayPalFastlane/components/FastlaneComponent.js +1 -1
  305. package/dist/es-legacy/components/PayPalFastlane/components/FastlaneComponent.js.map +1 -1
  306. package/dist/es-legacy/components/PayTo/PayTo.js +1 -1
  307. package/dist/es-legacy/components/PayTo/PayTo.js.map +1 -1
  308. package/dist/es-legacy/components/PayTo/components/BSBInput.js +1 -1
  309. package/dist/es-legacy/components/PayTo/components/BSBInput.js.map +1 -1
  310. package/dist/es-legacy/components/PayTo/components/PayToComponent.js +1 -1
  311. package/dist/es-legacy/components/PayTo/components/PayToComponent.js.map +1 -1
  312. package/dist/es-legacy/components/PayTo/components/PayToNameFields.js +1 -1
  313. package/dist/es-legacy/components/PayTo/components/PayToNameFields.js.map +1 -1
  314. package/dist/es-legacy/components/PayTo/components/PayToPhone.js +1 -1
  315. package/dist/es-legacy/components/PayTo/components/PayToPhone.js.map +1 -1
  316. package/dist/es-legacy/components/Pix/Pix.js +1 -1
  317. package/dist/es-legacy/components/Pix/Pix.js.map +1 -1
  318. package/dist/es-legacy/components/Pix/components/PixInput/PixInput.js +1 -1
  319. package/dist/es-legacy/components/Pix/components/PixInput/PixInput.js.map +1 -1
  320. package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js +1 -1
  321. package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js.map +1 -1
  322. package/dist/es-legacy/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js +1 -1
  323. package/dist/es-legacy/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js.map +1 -1
  324. package/dist/es-legacy/components/Redirect/Redirect.js +1 -1
  325. package/dist/es-legacy/components/Redirect/Redirect.js.map +1 -1
  326. package/dist/es-legacy/components/Sepa/Sepa.js.map +1 -1
  327. package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  328. package/dist/es-legacy/components/Trustly/Trustly.js +1 -1
  329. package/dist/es-legacy/components/Trustly/Trustly.js.map +1 -1
  330. package/dist/es-legacy/components/UPI/UPI.js +1 -1
  331. package/dist/es-legacy/components/UPI/UPI.js.map +1 -1
  332. package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
  333. package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
  334. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
  335. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  336. package/dist/es-legacy/components/helpers/QRLoaderContainer/QRLoaderContainer.js +1 -1
  337. package/dist/es-legacy/components/helpers/QRLoaderContainer/QRLoaderContainer.js.map +1 -1
  338. package/dist/es-legacy/components/internal/Address/components/CountryField.js.map +1 -1
  339. package/dist/es-legacy/components/internal/Address/components/FieldContainer.js +1 -1
  340. package/dist/es-legacy/components/internal/Address/components/FieldContainer.js.map +1 -1
  341. package/dist/es-legacy/components/internal/Address/components/StateField.js.map +1 -1
  342. package/dist/es-legacy/components/internal/Address/constants.js +1 -1
  343. package/dist/es-legacy/components/internal/Address/constants.js.map +1 -1
  344. package/dist/es-legacy/components/internal/Address/validate.formats.js +1 -1
  345. package/dist/es-legacy/components/internal/Address/validate.formats.js.map +1 -1
  346. package/dist/es-legacy/components/internal/Address/validate.js +1 -1
  347. package/dist/es-legacy/components/internal/Address/validate.js.map +1 -1
  348. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
  349. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
  350. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js +1 -1
  351. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js.map +1 -1
  352. package/dist/es-legacy/components/internal/DisclaimerMessage/DisclaimerMessage.js +1 -1
  353. package/dist/es-legacy/components/internal/DisclaimerMessage/DisclaimerMessage.js.map +1 -1
  354. package/dist/es-legacy/components/internal/DisclaimerMessage/utils.js +2 -0
  355. package/dist/es-legacy/components/internal/DisclaimerMessage/utils.js.map +1 -0
  356. package/dist/es-legacy/components/internal/FormFields/utils.js +1 -1
  357. package/dist/es-legacy/components/internal/FormFields/utils.js.map +1 -1
  358. package/dist/es-legacy/components/internal/IbanInput/IbanInput.js +1 -1
  359. package/dist/es-legacy/components/internal/IbanInput/IbanInput.js.map +1 -1
  360. package/dist/es-legacy/components/internal/IbanInput/validate.js +1 -1
  361. package/dist/es-legacy/components/internal/IbanInput/validate.js.map +1 -1
  362. package/dist/es-legacy/components/internal/IssuerList/IssuerList.js +1 -1
  363. package/dist/es-legacy/components/internal/IssuerList/IssuerList.js.map +1 -1
  364. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js +1 -1
  365. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  366. package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js +1 -1
  367. package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -1
  368. package/dist/es-legacy/components/internal/PayButton/PayButton.js +1 -1
  369. package/dist/es-legacy/components/internal/PayButton/PayButton.js.map +1 -1
  370. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js +1 -1
  371. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js.map +1 -1
  372. package/dist/es-legacy/components/internal/PhoneInput/usePhonePrefixes.js.map +1 -1
  373. package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js +1 -1
  374. package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js.map +1 -1
  375. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  376. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  377. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  378. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  379. package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
  380. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  381. package/dist/es-legacy/components/internal/UIElement/utils.js +1 -1
  382. package/dist/es-legacy/components/internal/UIElement/utils.js.map +1 -1
  383. package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
  384. package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
  385. package/dist/es-legacy/core/Errors/AdyenCheckoutError.js.map +1 -1
  386. package/dist/es-legacy/core/Errors/SRPanelProvider.js.map +1 -1
  387. package/dist/es-legacy/core/RiskModule/RiskModule.js +1 -1
  388. package/dist/es-legacy/core/RiskModule/RiskModule.js.map +1 -1
  389. package/dist/es-legacy/core/RiskModule/components/DeviceFingerprint/GetDeviceFingerprint.js.map +1 -1
  390. package/dist/es-legacy/core/Services/get-dataset.js.map +1 -1
  391. package/dist/es-legacy/core/Services/http.js +1 -1
  392. package/dist/es-legacy/core/Services/http.js.map +1 -1
  393. package/dist/es-legacy/core/config.js +1 -1
  394. package/dist/es-legacy/core/config.js.map +1 -1
  395. package/dist/es-legacy/core/core.js.map +1 -1
  396. package/dist/es-legacy/core/core.registry.js +1 -1
  397. package/dist/es-legacy/core/core.registry.js.map +1 -1
  398. package/dist/es-legacy/core/utils.js +1 -1
  399. package/dist/es-legacy/core/utils.js.map +1 -1
  400. package/dist/es-legacy/packages/server/translations/en-US.json.js +1 -1
  401. package/dist/es-legacy/utils/Validator/Validator.js +1 -1
  402. package/dist/es-legacy/utils/Validator/Validator.js.map +1 -1
  403. package/dist/es-legacy/utils/useForm/reducer.js +1 -1
  404. package/dist/es-legacy/utils/useForm/reducer.js.map +1 -1
  405. package/dist/es-legacy/utils/useForm/useForm.js +1 -1
  406. package/dist/es-legacy/utils/useForm/useForm.js.map +1 -1
  407. package/dist/es-legacy/utils/useForm/useFormWithA11y.js +1 -1
  408. package/dist/es-legacy/utils/useForm/useFormWithA11y.js.map +1 -1
  409. package/package.json +12 -12
  410. package/styles/adyen.css +7 -7
@@ -1,2 +1,2 @@
1
- import{createElement as e,Fragment as t}from"../../../../external/preact/dist/preact.js";import{useState as n,useRef as a,useMemo as o,useEffect as r,useCallback as i}from"../../../../external/preact/hooks/dist/hooks.js";import s from"../../../../core/Context/useImage.js";import{MAX_PRIMARY_APPS as l,UPI_MODE as p,A11Y as c}from"../../constants.js";import"../../../../_virtual/index.js";import{SegmentedControlRegion as d}from"../../../internal/SegmentedControl/SegmentedControlRegion.js";import u from"../UPIIntentAppList/UPIIntentAppList.js";import{useCoreContext as m}from"../../../../core/Context/CoreProvider.js";import f from"../../../internal/Alert/Alert.js";import g from"../UPIMandate/UPIMandate.js";import{useAmount as y}from"../../../../core/Context/AmountProvider.js";import{BrandIcons as b}from"../../../internal/BrandIcons/BrandIcons.js";import h from"../../../internal/ContentSeparator/ContentSeparator.js";import I from"../../../internal/FormFields/Field/Field.js";import j from"../../../internal/FormFields/Select/Select.js";import{AnalyticsInfoEvent as N,InfoEventType as C,UiTarget as v}from"../../../../core/Analytics/events/AnalyticsInfoEvent.js";import{ANALYTICS_SEARCH_DEBOUNCE_TIME as S}from"../../../../core/Analytics/constants.js";import{debounce as A}from"../../../../utils/debounce.js";function w(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function E(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},a=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),a.forEach(function(t){w(e,t,n[t])})}return e}function k({mode:w,onChange:k,payButton:O,setComponentRef:T,showPayButton:P,mandate:_,appsList:B,onSubmitAnalytics:L}){const{i18n:R}=m(),x=s(),[F,Q]=n("ready"),[M,V]=n(null),{amount:D}=y(),[U,q]=n(w===p.QR_CODE),$=_&&e(g,{mandate:_,amount:D}),z=a({setStatus:Q,showValidation:()=>{w===p.INTENT&&ee()}}),G=o(()=>B.slice(0,l),[B]),H=o(()=>B.slice(l),[B]);r(()=>{T(z.current)},[T]);const J=i((e,t)=>{e&&e.id!==(null==M?void 0:M.id)&&(V(e),q(!0),Q("ready"),L(new N({component:"upi_intent",type:C.selected,target:t,issuer:e.name})))},[M,L]),K=i(e=>J(e,v.list),[J]),W=i(e=>{const t=H.find(t=>t.id===e.target.value);J(t,v.listSearch)},[H,J]),X=i(e=>{e&&L(new N({component:"upi_intent",type:C.displayed,target:v.list}))},[L]),Y=a(A(L,S)),Z=i(()=>{Y.current({type:C.input,target:v.listSearch})},[]),ee=i(()=>{M?(Q("ready"),q(!0)):(Q("error"),q(!1))},[M]),te=o(()=>B.map(e=>({src:e.icon,alt:e.name})),[B]);return r(()=>{w!==p.QR_CODE?k({data:E({},M&&{app:M}),isValid:U}):k({data:{},valid:{},errors:{},isValid:!0})},[M,U,w,k]),r(()=>{w===p.INTENT&&0!==G.length&&L(new N({component:"upi_intent",type:C.displayed,target:v.list,presentedValues:G.map(e=>e.id)}))},[]),e(t,null,w===p.INTENT&&e(d,{id:c.AreaId.INTENT,ariaLabelledBy:c.ButtonId.INTENT,className:"adyen-checkout-upi-area-intent"},e("span",{className:"adyen-checkout-upi-instruction-label"},R.get("upi.intent.instruction")),e("span",{className:"adyen-checkout-upi-instruction-title"},R.get("upi.intent.apps.title")),"error"===F&&e(f,{icon:"cross"},R.get("upi.error.noAppSelected")),e(u,{disabled:"loading"===F,appsList:G,selectedAppId:null==M?void 0:M.id,onAppSelect:K}),H.length>0&&e(t,null,e(h,{classNames:["adyen-checkout-upi-instruction-separator"],label:"issuerList.separatorText"}),e(I,{label:R.get("upi.intent.apps.dropdown.label"),classNameModifiers:["upi-app-list"],name:"upi-app-list"},e(j,{items:H,selectedValue:H.some(e=>e.id===(null==M?void 0:M.id))?null==M?void 0:M.id:void 0,placeholder:R.get("upi.intent.apps.dropdown.placeholder"),name:"upi-app-list",className:"adyen-checkout__upi-app-list__dropdown",onChange:W,onInput:Z,onListToggle:X}))),$,P&&O({label:R.get("continue"),status:F})),w===p.QR_CODE&&e(d,{id:c.AreaId.QR,ariaLabelledBy:c.ButtonId.QR,className:"adyen-checkout-upi-area-qr-code"},e("span",{className:"adyen-checkout-upi-instruction-label-caption"},R.get("upi.qrCode.instruction")),e(b,{className:"adyen-checkout-upi-brands",brandIcons:te,showIconOnError:!0,smallIcons:!0,remainingBrandsLabel:`+ ${R.get("paymentMethodBrand.other")}`}),$,P&&O({label:R.get("generateQRCode"),icon:x({imageFolder:"components/"})("qr"),status:F})))}export{k as default};
1
+ import{createElement as e,Fragment as t}from"../../../../external/preact/dist/preact.js";import{useState as n,useRef as a,useMemo as o,useEffect as r,useCallback as i}from"../../../../external/preact/hooks/dist/hooks.js";import s from"../../../../core/Context/useImage.js";import{MAX_PRIMARY_APPS as l,UPI_MODE as p,A11Y as c}from"../../constants.js";import"../../../../_virtual/index.js";import{SegmentedControlRegion as d}from"../../../internal/SegmentedControl/SegmentedControlRegion.js";import u from"../UPIIntentAppList/UPIIntentAppList.js";import{useCoreContext as m}from"../../../../core/Context/CoreProvider.js";import f from"../../../internal/Alert/Alert.js";import g from"../UPIMandate/UPIMandate.js";import{useAmount as y}from"../../../../core/Context/AmountProvider.js";import{BrandIcons as b}from"../../../internal/BrandIcons/BrandIcons.js";import h from"../../../internal/ContentSeparator/ContentSeparator.js";import I from"../../../internal/FormFields/Field/Field.js";import j from"../../../internal/FormFields/Select/Select.js";import{AnalyticsInfoEvent as N,InfoEventType as C,UiTarget as v}from"../../../../core/Analytics/events/AnalyticsInfoEvent.js";import{ANALYTICS_SEARCH_DEBOUNCE_TIME as S}from"../../../../core/Analytics/constants.js";import{debounce as A}from"../../../../utils/debounce.js";function E(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function k(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},a=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),a.forEach(function(t){E(e,t,n[t])})}return e}function w({mode:E,onChange:w,payButton:O,setComponentRef:T,mandate:_,appsList:P,onSubmitAnalytics:B}){const{i18n:L}=m(),R=s(),[x,F]=n("ready"),[Q,M]=n(null),{amount:V}=y(),[D,U]=n(E===p.QR_CODE),q=_&&e(g,{mandate:_,amount:V}),$=a({setStatus:F,showValidation:()=>{E===p.INTENT&&Z()}}),z=o(()=>P.slice(0,l),[P]),G=o(()=>P.slice(l),[P]);r(()=>{T($.current)},[T]);const H=i((e,t)=>{e&&e.id!==(null==Q?void 0:Q.id)&&(M(e),U(!0),F("ready"),B(new N({component:"upi_intent",type:C.selected,target:t,issuer:e.name})))},[Q,B]),J=i(e=>H(e,v.list),[H]),K=i(e=>{const t=G.find(t=>t.id===e.target.value);H(t,v.listSearch)},[G,H]),W=i(e=>{e&&B(new N({component:"upi_intent",type:C.displayed,target:v.list}))},[B]),X=a(A(B,S)),Y=i(()=>{X.current({type:C.input,target:v.listSearch})},[]),Z=i(()=>{Q?(F("ready"),U(!0)):(F("error"),U(!1))},[Q]),ee=o(()=>P.map(e=>({src:e.icon,alt:e.name})),[P]);return r(()=>{E!==p.QR_CODE?w({data:k({},Q&&{app:Q}),isValid:D}):w({data:{},valid:{},errors:{},isValid:!0})},[Q,D,E,w]),r(()=>{E===p.INTENT&&0!==z.length&&B(new N({component:"upi_intent",type:C.displayed,target:v.list,presentedValues:z.map(e=>e.id)}))},[]),e(t,null,E===p.INTENT&&e(d,{id:c.AreaId.INTENT,ariaLabelledBy:c.ButtonId.INTENT,className:"adyen-checkout-upi-area-intent"},e("span",{className:"adyen-checkout-upi-instruction-label"},L.get("upi.intent.instruction")),e("span",{className:"adyen-checkout-upi-instruction-title"},L.get("upi.intent.apps.title")),"error"===x&&e(f,{icon:"cross"},L.get("upi.error.noAppSelected")),e(u,{disabled:"loading"===x,appsList:z,selectedAppId:null==Q?void 0:Q.id,onAppSelect:J}),G.length>0&&e(t,null,e(h,{classNames:["adyen-checkout-upi-instruction-separator"],label:"issuerList.separatorText"}),e(I,{label:L.get("upi.intent.apps.dropdown.label"),classNameModifiers:["upi-app-list"],name:"upi-app-list"},e(j,{items:G,selectedValue:G.some(e=>e.id===(null==Q?void 0:Q.id))?null==Q?void 0:Q.id:void 0,placeholder:L.get("upi.intent.apps.dropdown.placeholder"),name:"upi-app-list",className:"adyen-checkout__upi-app-list__dropdown",onChange:K,onInput:Y,onListToggle:W}))),q,O({label:L.get("continue"),status:x})),E===p.QR_CODE&&e(d,{id:c.AreaId.QR,ariaLabelledBy:c.ButtonId.QR,className:"adyen-checkout-upi-area-qr-code"},e("span",{className:"adyen-checkout-upi-instruction-label-caption"},L.get("upi.qrCode.instruction")),e(b,{className:"adyen-checkout-upi-brands",brandIcons:ee,showIconOnError:!0,smallIcons:!0,remainingBrandsLabel:`+ ${L.get("paymentMethodBrand.other")}`}),q,O({label:L.get("generateQRCode"),icon:R({imageFolder:"components/"})("qr"),status:x})))}export{w as default};
2
2
  //# sourceMappingURL=UPIComponent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UPIComponent.js","sources":["../../../../../../src/components/UPI/components/UPIComponent/UPIComponent.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'preact/hooks';\nimport { ComponentMethodsRef, UIElementStatus } from '../../../types';\nimport { App, UPIAppList, UpiMode } from '../../types';\nimport useImage from '../../../../core/Context/useImage';\nimport { A11Y, MAX_PRIMARY_APPS, UPI_MODE } from '../../constants';\nimport { SegmentedControlRegion } from '../../../internal/SegmentedControl';\nimport UPIIntentAppList from '../UPIIntentAppList';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport Alert from '../../../internal/Alert';\nimport UPIMandate, { Mandate } from '../UPIMandate/UPIMandate';\nimport { PayButtonProps } from '../../../internal/PayButton/PayButton';\nimport { useAmount } from '../../../../core/Context/AmountProvider';\nimport { BrandIcon } from '../../../internal/BrandIcons/types';\nimport { BrandIcons } from '../../../internal/BrandIcons/BrandIcons';\nimport { ValidationRuleResult } from '../../../../utils/Validator/ValidationRuleResult';\nimport './UPIComponent.scss';\nimport ContentSeparator from '../../../internal/ContentSeparator';\nimport Field from '../../../internal/FormFields/Field';\nimport Select from '../../../internal/FormFields/Select';\nimport { SelectTargetObject } from '../../../internal/FormFields/Select/types';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../../../core/Analytics/events/AnalyticsInfoEvent';\nimport { AbstractAnalyticsEvent } from '../../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { ANALYTICS_SEARCH_DEBOUNCE_TIME } from '../../../../core/Analytics/constants';\nimport { debounce } from '../../../../utils/debounce';\n\ntype UpiData = { app?: App };\n\ntype OnChangeProps = { data: UpiData; valid?: { [key: string]: boolean }; errors?: { [key: string]: ValidationRuleResult }; isValid: boolean };\ninterface UPIComponentProps {\n mode: UpiMode;\n showPayButton: boolean;\n appsList: UPIAppList;\n mandate?: Mandate;\n setComponentRef: (ref: ComponentMethodsRef) => void;\n payButton(props: PayButtonProps): h.JSX.Element;\n onChange({ data, valid, errors, isValid }: OnChangeProps): void;\n onSubmitAnalytics(event: AbstractAnalyticsEvent): void;\n}\n\nexport default function UPIComponent({\n mode,\n onChange,\n payButton,\n setComponentRef,\n showPayButton,\n mandate,\n appsList,\n onSubmitAnalytics\n}: Readonly<UPIComponentProps>): h.JSX.Element {\n const { i18n } = useCoreContext();\n const getImage = useImage();\n const [status, setStatus] = useState<UIElementStatus>('ready');\n const [selectedApp, setSelectedApp] = useState<App | null>(null);\n const { amount } = useAmount();\n const [isValid, setIsValid] = useState<boolean>(mode === UPI_MODE.QR_CODE);\n const mandateComponent = mandate && <UPIMandate mandate={mandate} amount={amount} />;\n\n const upiRef = useRef<ComponentMethodsRef>({\n setStatus: setStatus,\n showValidation: () => {\n if (mode === UPI_MODE.INTENT) {\n validateIntentApp();\n }\n }\n });\n\n const priorityApps = useMemo(() => appsList.slice(0, MAX_PRIMARY_APPS), [appsList]);\n const lowPriorityApps = useMemo(() => appsList.slice(MAX_PRIMARY_APPS), [appsList]);\n\n useEffect(() => {\n setComponentRef(upiRef.current);\n }, [setComponentRef]);\n\n const selectApp = useCallback(\n (app: App | undefined, target: UiTarget) => {\n if (!app || app.id === selectedApp?.id) return;\n\n setSelectedApp(app);\n setIsValid(true);\n setStatus('ready');\n\n onSubmitAnalytics(\n new AnalyticsInfoEvent({\n component: 'upi_intent',\n type: InfoEventType.selected,\n target,\n issuer: app.name\n })\n );\n },\n [selectedApp, onSubmitAnalytics]\n );\n\n const handleAppSelect = useCallback((app: App) => selectApp(app, UiTarget.list), [selectApp]);\n\n const handleDropdownSelect = useCallback(\n (event: { target: SelectTargetObject }) => {\n const app = lowPriorityApps.find(a => a.id === event.target.value);\n selectApp(app, UiTarget.listSearch);\n },\n [lowPriorityApps, selectApp]\n );\n\n const handleListToggle = useCallback(\n (isOpen: boolean) => {\n if (isOpen) {\n onSubmitAnalytics(\n new AnalyticsInfoEvent({\n component: 'upi_intent',\n type: InfoEventType.displayed,\n target: UiTarget.list\n })\n );\n }\n },\n [onSubmitAnalytics]\n );\n\n const debounceSearchAnalytics = useRef(debounce(onSubmitAnalytics, ANALYTICS_SEARCH_DEBOUNCE_TIME));\n\n const handleSearch = useCallback(() => {\n debounceSearchAnalytics.current({ type: InfoEventType.input, target: UiTarget.listSearch });\n }, []);\n\n const validateIntentApp = useCallback(() => {\n if (selectedApp) {\n setStatus('ready');\n setIsValid(true);\n } else {\n setStatus('error');\n setIsValid(false);\n }\n }, [selectedApp]);\n\n const brandIcons: BrandIcon[] = useMemo(\n () =>\n appsList.map(app => ({\n src: app.icon,\n alt: app.name\n })),\n [appsList]\n );\n\n useEffect(() => {\n if (mode === UPI_MODE.QR_CODE) {\n /**\n * When selecting QR code mode, we need to clear the state data and trigger 'onChange'.\n */\n onChange({ data: {}, valid: {}, errors: {}, isValid: true });\n return;\n }\n onChange({\n data: { ...(selectedApp && { app: selectedApp }) },\n isValid\n });\n }, [selectedApp, isValid, mode, onChange]);\n\n useEffect(() => {\n if (mode !== UPI_MODE.INTENT || priorityApps.length === 0) return;\n\n onSubmitAnalytics(\n new AnalyticsInfoEvent({\n component: 'upi_intent',\n type: InfoEventType.displayed,\n target: UiTarget.list,\n presentedValues: priorityApps.map(a => a.id)\n })\n );\n }, []);\n\n return (\n <Fragment>\n {mode === UPI_MODE.INTENT && (\n <SegmentedControlRegion id={A11Y.AreaId.INTENT} ariaLabelledBy={A11Y.ButtonId.INTENT} className=\"adyen-checkout-upi-area-intent\">\n <span className=\"adyen-checkout-upi-instruction-label\">{i18n.get('upi.intent.instruction')}</span>\n <span className=\"adyen-checkout-upi-instruction-title\">{i18n.get('upi.intent.apps.title')}</span>\n {status === 'error' && <Alert icon={'cross'}>{i18n.get('upi.error.noAppSelected')}</Alert>}\n <UPIIntentAppList\n disabled={status === 'loading'}\n appsList={priorityApps}\n selectedAppId={selectedApp?.id}\n onAppSelect={handleAppSelect}\n />\n {lowPriorityApps.length > 0 && (\n <Fragment>\n <ContentSeparator classNames={['adyen-checkout-upi-instruction-separator']} label=\"issuerList.separatorText\" />\n <Field label={i18n.get('upi.intent.apps.dropdown.label')} classNameModifiers={['upi-app-list']} name={'upi-app-list'}>\n <Select\n items={lowPriorityApps}\n selectedValue={lowPriorityApps.some(a => a.id === selectedApp?.id) ? selectedApp?.id : undefined}\n placeholder={i18n.get('upi.intent.apps.dropdown.placeholder')}\n name={'upi-app-list'}\n className={'adyen-checkout__upi-app-list__dropdown'}\n onChange={handleDropdownSelect}\n onInput={handleSearch}\n onListToggle={handleListToggle}\n />\n </Field>\n </Fragment>\n )}\n {mandateComponent}\n {showPayButton &&\n payButton({\n label: i18n.get('continue'),\n status\n })}\n </SegmentedControlRegion>\n )}\n {mode === UPI_MODE.QR_CODE && (\n <SegmentedControlRegion id={A11Y.AreaId.QR} ariaLabelledBy={A11Y.ButtonId.QR} className=\"adyen-checkout-upi-area-qr-code\">\n <span className=\"adyen-checkout-upi-instruction-label-caption\">{i18n.get('upi.qrCode.instruction')}</span>\n <BrandIcons\n className=\"adyen-checkout-upi-brands\"\n brandIcons={brandIcons}\n showIconOnError\n smallIcons\n remainingBrandsLabel={`+ ${i18n.get('paymentMethodBrand.other')}`}\n />\n {mandateComponent}\n {showPayButton &&\n payButton({\n label: i18n.get('generateQRCode'),\n icon: getImage({ imageFolder: 'components/' })('qr'),\n status\n })}\n </SegmentedControlRegion>\n )}\n </Fragment>\n );\n}\n"],"names":["UPIComponent","mode","onChange","payButton","setComponentRef","showPayButton","mandate","appsList","onSubmitAnalytics","i18n","useCoreContext","getImage","useImage","status","setStatus","useState","selectedApp","setSelectedApp","amount","useAmount","isValid","setIsValid","UPI_MODE","QR_CODE","mandateComponent","h","UPIMandate","upiRef","useRef","showValidation","INTENT","validateIntentApp","priorityApps","useMemo","slice","MAX_PRIMARY_APPS","lowPriorityApps","useEffect","current","selectApp","useCallback","app","target","id","AnalyticsInfoEvent","component","type","InfoEventType","selected","issuer","name","handleAppSelect","UiTarget","list","handleDropdownSelect","event","find","a","value","listSearch","handleListToggle","isOpen","displayed","debounceSearchAnalytics","debounce","ANALYTICS_SEARCH_DEBOUNCE_TIME","handleSearch","input","brandIcons","map","src","icon","alt","data","_object_spread","valid","errors","length","presentedValues","Fragment","SegmentedControlRegion","A11Y","AreaId","ariaLabelledBy","ButtonId","className","span","get","Alert","UPIIntentAppList","disabled","selectedAppId","onAppSelect","ContentSeparator","classNames","label","Field","classNameModifiers","Select","items","selectedValue","some","undefined","placeholder","onInput","onListToggle","QR","BrandIcons","showIconOnError","smallIcons","remainingBrandsLabel","imageFolder"],"mappings":"guDAwCe,SAASA,GAAaC,KACjCA,EAAIC,SACJA,EAAQC,UACRA,EAASC,gBACTA,EAAeC,cACfA,EAAaC,QACbA,EAAOC,SACPA,EAAQC,kBACRA,IAEA,MAAMC,KAAEA,GAASC,IACXC,EAAWC,KACVC,EAAQC,GAAaC,EAA0B,UAC/CC,EAAaC,GAAkBF,EAAqB,OACrDG,OAAEA,GAAWC,KACZC,EAASC,GAAcN,EAAkBd,IAASqB,EAASC,SAC5DC,EAAmBlB,GAAWmB,EAACC,EAAAA,CAAWpB,QAASA,EAASY,OAAQA,IAEpES,EAASC,EAA4B,CACvCd,UAAWA,EACXe,eAAgB,KACR5B,IAASqB,EAASQ,QAClBC,QAKNC,EAAeC,EAAQ,IAAM1B,EAAS2B,MAA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N4F,MAAOtF,EAAK8E,IAAI,YAChB1E,YAIfZ,IAASqB,EAASC,SACfE,EAACuD,EAAAA,CAAuBrC,GAAIsC,EAAKC,OAAOwB,GAAIvB,eAAgBF,EAAKG,SAASsB,GAAIrB,UAAU,mCACpF5D,EAAC6D,OAAAA,CAAKD,UAAU,gDAAgD5E,EAAK8E,IAAI,2BACzE9D,EAACkF,EAAAA,CACGtB,UAAU,4BACVjB,WAAYA,GACZwC,iBAAAA,EACAC,YAAAA,EACAC,qBAAsB,KAAKrG,EAAK8E,IAAI,gCAEvC/D,EACAnB,GACGF,EAAU,CACN4F,MAAOtF,EAAK8E,IAAI,kBAChBhB,KAAM5D,EAAS,CAAEoG,YAAa,eAAxBpG,CAAyC,MAC/CE,YAM5B"}
1
+ {"version":3,"file":"UPIComponent.js","sources":["../../../../../../src/components/UPI/components/UPIComponent/UPIComponent.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'preact/hooks';\nimport { ComponentMethodsRef, UIElementStatus } from '../../../types';\nimport { App, UPIAppList, UpiMode } from '../../types';\nimport useImage from '../../../../core/Context/useImage';\nimport { A11Y, MAX_PRIMARY_APPS, UPI_MODE } from '../../constants';\nimport { SegmentedControlRegion } from '../../../internal/SegmentedControl';\nimport UPIIntentAppList from '../UPIIntentAppList';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport Alert from '../../../internal/Alert';\nimport UPIMandate, { Mandate } from '../UPIMandate/UPIMandate';\nimport { PayButtonProps } from '../../../internal/PayButton/PayButton';\nimport { useAmount } from '../../../../core/Context/AmountProvider';\nimport { BrandIcon } from '../../../internal/BrandIcons/types';\nimport { BrandIcons } from '../../../internal/BrandIcons/BrandIcons';\nimport { ValidationRuleResult } from '../../../../utils/Validator/ValidationRuleResult';\nimport './UPIComponent.scss';\nimport ContentSeparator from '../../../internal/ContentSeparator';\nimport Field from '../../../internal/FormFields/Field';\nimport Select from '../../../internal/FormFields/Select';\nimport { SelectTargetObject } from '../../../internal/FormFields/Select/types';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../../../core/Analytics/events/AnalyticsInfoEvent';\nimport { AbstractAnalyticsEvent } from '../../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { ANALYTICS_SEARCH_DEBOUNCE_TIME } from '../../../../core/Analytics/constants';\nimport { debounce } from '../../../../utils/debounce';\n\ntype UpiData = { app?: App };\n\ntype OnChangeProps = { data: UpiData; valid?: { [key: string]: boolean }; errors?: { [key: string]: ValidationRuleResult }; isValid: boolean };\ninterface UPIComponentProps {\n mode: UpiMode;\n appsList: UPIAppList;\n mandate?: Mandate;\n setComponentRef: (ref: ComponentMethodsRef) => void;\n payButton(props: PayButtonProps): h.JSX.Element;\n onChange({ data, valid, errors, isValid }: OnChangeProps): void;\n onSubmitAnalytics(event: AbstractAnalyticsEvent): void;\n}\n\nexport default function UPIComponent({\n mode,\n onChange,\n payButton,\n setComponentRef,\n mandate,\n appsList,\n onSubmitAnalytics\n}: Readonly<UPIComponentProps>): h.JSX.Element {\n const { i18n } = useCoreContext();\n const getImage = useImage();\n const [status, setStatus] = useState<UIElementStatus>('ready');\n const [selectedApp, setSelectedApp] = useState<App | null>(null);\n const { amount } = useAmount();\n const [isValid, setIsValid] = useState<boolean>(mode === UPI_MODE.QR_CODE);\n const mandateComponent = mandate && <UPIMandate mandate={mandate} amount={amount} />;\n\n const upiRef = useRef<ComponentMethodsRef>({\n setStatus: setStatus,\n showValidation: () => {\n if (mode === UPI_MODE.INTENT) {\n validateIntentApp();\n }\n }\n });\n\n const priorityApps = useMemo(() => appsList.slice(0, MAX_PRIMARY_APPS), [appsList]);\n const lowPriorityApps = useMemo(() => appsList.slice(MAX_PRIMARY_APPS), [appsList]);\n\n useEffect(() => {\n setComponentRef(upiRef.current);\n }, [setComponentRef]);\n\n const selectApp = useCallback(\n (app: App | undefined, target: UiTarget) => {\n if (!app || app.id === selectedApp?.id) return;\n\n setSelectedApp(app);\n setIsValid(true);\n setStatus('ready');\n\n onSubmitAnalytics(\n new AnalyticsInfoEvent({\n component: 'upi_intent',\n type: InfoEventType.selected,\n target,\n issuer: app.name\n })\n );\n },\n [selectedApp, onSubmitAnalytics]\n );\n\n const handleAppSelect = useCallback((app: App) => selectApp(app, UiTarget.list), [selectApp]);\n\n const handleDropdownSelect = useCallback(\n (event: { target: SelectTargetObject }) => {\n const app = lowPriorityApps.find(a => a.id === event.target.value);\n selectApp(app, UiTarget.listSearch);\n },\n [lowPriorityApps, selectApp]\n );\n\n const handleListToggle = useCallback(\n (isOpen: boolean) => {\n if (isOpen) {\n onSubmitAnalytics(\n new AnalyticsInfoEvent({\n component: 'upi_intent',\n type: InfoEventType.displayed,\n target: UiTarget.list\n })\n );\n }\n },\n [onSubmitAnalytics]\n );\n\n const debounceSearchAnalytics = useRef(debounce(onSubmitAnalytics, ANALYTICS_SEARCH_DEBOUNCE_TIME));\n\n const handleSearch = useCallback(() => {\n debounceSearchAnalytics.current({ type: InfoEventType.input, target: UiTarget.listSearch });\n }, []);\n\n const validateIntentApp = useCallback(() => {\n if (selectedApp) {\n setStatus('ready');\n setIsValid(true);\n } else {\n setStatus('error');\n setIsValid(false);\n }\n }, [selectedApp]);\n\n const brandIcons: BrandIcon[] = useMemo(\n () =>\n appsList.map(app => ({\n src: app.icon,\n alt: app.name\n })),\n [appsList]\n );\n\n useEffect(() => {\n if (mode === UPI_MODE.QR_CODE) {\n /**\n * When selecting QR code mode, we need to clear the state data and trigger 'onChange'.\n */\n onChange({ data: {}, valid: {}, errors: {}, isValid: true });\n return;\n }\n onChange({\n data: { ...(selectedApp && { app: selectedApp }) },\n isValid\n });\n }, [selectedApp, isValid, mode, onChange]);\n\n useEffect(() => {\n if (mode !== UPI_MODE.INTENT || priorityApps.length === 0) return;\n\n onSubmitAnalytics(\n new AnalyticsInfoEvent({\n component: 'upi_intent',\n type: InfoEventType.displayed,\n target: UiTarget.list,\n presentedValues: priorityApps.map(a => a.id)\n })\n );\n }, []);\n\n return (\n <Fragment>\n {mode === UPI_MODE.INTENT && (\n <SegmentedControlRegion id={A11Y.AreaId.INTENT} ariaLabelledBy={A11Y.ButtonId.INTENT} className=\"adyen-checkout-upi-area-intent\">\n <span className=\"adyen-checkout-upi-instruction-label\">{i18n.get('upi.intent.instruction')}</span>\n <span className=\"adyen-checkout-upi-instruction-title\">{i18n.get('upi.intent.apps.title')}</span>\n {status === 'error' && <Alert icon={'cross'}>{i18n.get('upi.error.noAppSelected')}</Alert>}\n <UPIIntentAppList\n disabled={status === 'loading'}\n appsList={priorityApps}\n selectedAppId={selectedApp?.id}\n onAppSelect={handleAppSelect}\n />\n {lowPriorityApps.length > 0 && (\n <Fragment>\n <ContentSeparator classNames={['adyen-checkout-upi-instruction-separator']} label=\"issuerList.separatorText\" />\n <Field label={i18n.get('upi.intent.apps.dropdown.label')} classNameModifiers={['upi-app-list']} name={'upi-app-list'}>\n <Select\n items={lowPriorityApps}\n selectedValue={lowPriorityApps.some(a => a.id === selectedApp?.id) ? selectedApp?.id : undefined}\n placeholder={i18n.get('upi.intent.apps.dropdown.placeholder')}\n name={'upi-app-list'}\n className={'adyen-checkout__upi-app-list__dropdown'}\n onChange={handleDropdownSelect}\n onInput={handleSearch}\n onListToggle={handleListToggle}\n />\n </Field>\n </Fragment>\n )}\n {mandateComponent}\n {payButton({\n label: i18n.get('continue'),\n status\n })}\n </SegmentedControlRegion>\n )}\n {mode === UPI_MODE.QR_CODE && (\n <SegmentedControlRegion id={A11Y.AreaId.QR} ariaLabelledBy={A11Y.ButtonId.QR} className=\"adyen-checkout-upi-area-qr-code\">\n <span className=\"adyen-checkout-upi-instruction-label-caption\">{i18n.get('upi.qrCode.instruction')}</span>\n <BrandIcons\n className=\"adyen-checkout-upi-brands\"\n brandIcons={brandIcons}\n showIconOnError\n smallIcons\n remainingBrandsLabel={`+ ${i18n.get('paymentMethodBrand.other')}`}\n />\n {mandateComponent}\n {payButton({\n label: i18n.get('generateQRCode'),\n icon: getImage({ imageFolder: 'components/' })('qr'),\n status\n })}\n </SegmentedControlRegion>\n )}\n </Fragment>\n );\n}\n"],"names":["UPIComponent","mode","onChange","payButton","setComponentRef","mandate","appsList","onSubmitAnalytics","i18n","useCoreContext","getImage","useImage","status","setStatus","useState","selectedApp","setSelectedApp","amount","useAmount","isValid","setIsValid","UPI_MODE","QR_CODE","mandateComponent","h","UPIMandate","upiRef","useRef","showValidation","INTENT","validateIntentApp","priorityApps","useMemo","slice","MAX_PRIMARY_APPS","lowPriorityApps","useEffect","current","selectApp","useCallback","app","target","id","AnalyticsInfoEvent","component","type","InfoEventType","selected","issuer","name","handleAppSelect","UiTarget","list","handleDropdownSelect","event","find","a","value","listSearch","handleListToggle","isOpen","displayed","debounceSearchAnalytics","debounce","ANALYTICS_SEARCH_DEBOUNCE_TIME","handleSearch","input","brandIcons","map","src","icon","alt","data","_object_spread","valid","errors","length","presentedValues","Fragment","SegmentedControlRegion","A11Y","AreaId","ariaLabelledBy","ButtonId","className","span","get","Alert","UPIIntentAppList","disabled","selectedAppId","onAppSelect","ContentSeparator","classNames","label","Field","classNameModifiers","Select","items","selectedValue","some","undefined","placeholder","onInput","onListToggle","QR","BrandIcons","showIconOnError","smallIcons","remainingBrandsLabel","imageFolder"],"mappings":"guDAuCe,SAASA,GAAaC,KACjCA,EAAIC,SACJA,EAAQC,UACRA,EAASC,gBACTA,EAAeC,QACfA,EAAOC,SACPA,EAAQC,kBACRA,IAEA,MAAMC,KAAEA,GAASC,IACXC,EAAWC,KACVC,EAAQC,GAAaC,EAA0B,UAC/CC,EAAaC,GAAkBF,EAAqB,OACrDG,OAAEA,GAAWC,KACZC,EAASC,GAAcN,EAAkBb,IAASoB,EAASC,SAC5DC,EAAmBlB,GAAWmB,EAACC,EAAAA,CAAWpB,QAASA,EAASY,OAAQA,IAEpES,EAASC,EAA4B,CACvCd,UAAWA,EACXe,eAAgB,KACR3B,IAASoB,EAASQ,QAClBC,OAKNC,EAAeC,EAAQ,IAAM1B,EAA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ACP2F,MAAOtF,EAAK8E,IAAI,YAChB1E,YAIXX,IAASoB,EAASC,SACfE,EAACuD,EAAAA,CAAuBrC,GAAIsC,EAAKC,OAAOwB,GAAIvB,eAAgBF,EAAKG,SAASsB,GAAIrB,UAAU,mCACpF5D,EAAC6D,OAAAA,CAAKD,UAAU,gDAAgD5E,EAAK8E,IAAI,2BACzE9D,EAACkF,EAAAA,CACGtB,UAAU,4BACVjB,WAAYA,GACZwC,iBAAAA,EACAC,YAAAA,EACAC,qBAAsB,KAAKrG,EAAK8E,IAAI,gCAEvC/D,EACApB,EAAU,CACP2F,MAAOtF,EAAK8E,IAAI,kBAChBhB,KAAM5D,EAAS,CAAEoG,YAAa,eAAxBpG,CAAyC,MAC/CE,YAMxB"}
@@ -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 s from"../../internal/IssuerList/IssuerList.js";import r from"../../../utils/get-issuer-image.js";import{FALLBACK_CONTEXT as o}from"../../../core/config.js";import i from"../../internal/RedirectButton/RedirectButton.js";function n(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function p(t){for(var e=1;e<arguments.length;e++){var s=null!=arguments[e]?arguments[e]:{},r=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(s).filter(function(t){return Object.getOwnPropertyDescriptor(s,t).enumerable}))),r.forEach(function(e){n(t,e,s[e])})}return t}function a(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e.push.apply(e,s)}return e}(Object(e)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(e,s))}),t}class u extends e{formatProps(t){var e,s;const r=(null==t||null===(e=t.details)||void 0===e?void 0:e.length)&&(null===(s=t.details.find(t=>"issuer"===t.key))||void 0===s?void 0:s.items)||t.issuers||[];return a(p({},t),{issuers:r})}formatData(){var t,e;return{paymentMethod:{type:this.type,issuer:null===(e=this.state)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.issuer}}}get isValid(){var t;return 0===this.props.issuers.length||Boolean(null===(t=this.state)||void 0===t?void 0:t.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(s,a(p({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(i,a(p({showPayButton:this.props.showPayButton,name:this.props.name},this.props),{onSubmit:this.submit,payButton:this.payButton,ref:t=>{this.componentRef=t}}))}constructor(t,e){super(t,e);const s=t=>this.resources.getImage(t);if(this.props.showImage){const t=r({loadingContext:this.props.loadingContext},this.constructor.type,s);this.props.issuers=this.props.issuers.map(e=>a(p({},e),{icon:t(e.id)}))}}}n(u,"defaultProps",{showImage:!0,issuers:[],highlightedIssuers:[],loadingContext:o,showPaymentMethodItemImages:!1});export{u as default};
1
+ import{createElement as t}from"../../../external/preact/dist/preact.js";import{UIElement as e}from"../../internal/UIElement/UIElement.js";import s from"../../internal/IssuerList/IssuerList.js";import r from"../../../utils/get-issuer-image.js";import{FALLBACK_CONTEXT as o}from"../../../core/config.js";import i from"../../internal/RedirectButton/RedirectButton.js";function n(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function p(t){for(var e=1;e<arguments.length;e++){var s=null!=arguments[e]?arguments[e]:{},r=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(s).filter(function(t){return Object.getOwnPropertyDescriptor(s,t).enumerable}))),r.forEach(function(e){n(t,e,s[e])})}return t}function a(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e.push.apply(e,s)}return e}(Object(e)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(e,s))}),t}class u extends e{formatProps(t){var e,s;const r=(null==t||null===(e=t.details)||void 0===e?void 0:e.length)&&(null===(s=t.details.find(t=>"issuer"===t.key))||void 0===s?void 0:s.items)||t.issuers||[];return a(p({},t),{issuers:r})}formatData(){var t,e;return{paymentMethod:{type:this.type,issuer:null===(e=this.state)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.issuer}}}get isValid(){var t;return 0===this.props.issuers.length||Boolean(null===(t=this.state)||void 0===t?void 0:t.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(s,a(p({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(i,a(p({name:this.props.name},this.props),{onSubmit:this.submit,payButton:this.payButton,setComponentRef:this.setComponentRef}))}constructor(t,e){super(t,e);const s=t=>this.resources.getImage(t);if(this.props.showImage){const t=r({loadingContext:this.props.loadingContext},this.constructor.type,s);this.props.issuers=this.props.issuers.map(e=>a(p({},e),{icon:t(e.id)}))}}}n(u,"defaultProps",{showImage:!0,issuers:[],highlightedIssuers:[],loadingContext:o,showPaymentMethodItemImages:!1});export{u 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","_object_spread_props","_object_spread","formatData","_this_state_data","_this_state","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","getIssuerIcon","getIssuerImageUrl","loadingContext","item","_define_property","defaultProps","FALLBACK_CONTEXT"],"mappings":"spCAWA,MAAMA,UAAsHC,EAwBxHC,WAAAA,CAAYC,OAGHA,EAA0BA,EAF/B,MAAMC,GAEDD,SAAc,QAAdA,EAAAA,EAAOE,eAAPF,IAAAA,OAAAA,EAAAA,EAAgBG,UAAuE,QAA7DH,EAAAA,EAAME,QAAQE,KAAMC,GAAyC,WAAVA,EAAEC,YAArDN,IAAAA,SAAAA,EAAwEO,QAAUP,EAAMC,SAAW,GAClI,OAAOO,EAAAC,EAAA,CA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KAAKsC,UAAUD,SAASpD,GAElE,GAAIe,KAAKf,MAAMkC,UAAW,CACtB,MAAMoB,EAAgBC,EAAkB,CAAEC,eAAgBzC,KAAKf,MAAMwD,gBAAkBzC,KAAKoB,iBAAqBiB,GAEjHrC,KAAKf,MAAMC,QAAUc,KAAKf,MAAMC,QAAQsB,IAAIkC,GAASjD,EAAAC,EAAA,CAAA,EAC9CgD,GAAAA,CACHhC,KAAM6B,EAAcG,EAAK9B,MAEjC,CACJ,EArBA+B,EADE7D,EACwB8D,eAAe,CACrCzB,WAAW,EACXjC,QAAS,GACT+B,mBAAoB,GACpBwB,eAAgBI,EAChBtC,6BAA6B"}
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 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","_object_spread_props","_object_spread","formatData","_this_state_data","_this_state","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","checkout","super","getImage","resources","getIssuerIcon","getIssuerImageUrl","loadingContext","item","_define_property","defaultProps","FALLBACK_CONTEXT"],"mappings":"spCAWA,MAAMA,UAGIC,EAwBNC,WAAAA,CAAYC,OAGHA,EAA0BA,EAF/B,MAAMC,GAEDD,SAAc,QAAdA,EAAAA,EAAOE,eAAPF,IAAAA,OAAAA,EAAAA,EAAgBG,UAAuE,QAA7DH,EAAAA,EAAME,QAAQE,KAAMC,GAAyC,WAAVA,EAAEC,YAArDN,IAAAA,SAAAA,EAAwEO,QAAUP,EAAMC,SAAW,GAClI,OAAOO,EAAAC,EAAA,CAAA,EAAKT,GAAAA,CAAOC,WACvB,CAKAS,UAAAA,OAIoBC,EAAAC,EAHhB,MAAO,CACHC,cAAe,CACXC,KAAMC,KAAKD,KACXE,OAAkB,QAAVJ,EAAAG,KAAKE,iBAALL,GAAgB,QAAhBD,EAAAC,EAAYM,YAAZ,IAAAP,OAAA,EAAAA,EAAkBK,QAGtC,CAKA,WAAIG,GAIe,IAAAP,EAHf,OAAkC,IAA9BG,KAAKf,MAAMC,QAAQE,QAGhBiB,QAAkB,QAAVR,EAAAG,KAAKE,aAAL,IAAAL,SAAAA,EAAYO,QAC/B,CAOA,UAAIE,GACA,OAAIN,KAAKf,MAAMsB,4BACJP,KAAKf,MAAMC,QAAQsB,IAAIC,IAEnB,CAAEC,KADSD,EAAMC,KACEC,KAAMF,EAAMG,MAIvC,EACX,CAEmBC,iBAAAA,GACf,OAAOb,KAAKf,MAAMC,QAAQE,OAAS,EAC/B0B,EAACC,EAAAA,EAAAA,EAAAA,CACGvB,MAAOQ,KAAKf,MAAMC,QAClB8B,eAAgBhB,KAAKf,MAAMgC,oBACvBjB,KAAKf,MACLe,KAAKE,OAAK,CACdgB,gBAAiBlB,KAAKkB,gBACtBC,UAAWnB,KAAKf,MAAMkC,UACtBpB,KAAMC,KAAKoB,YAAY,KACvBC,SAAUrB,KAAKsB,SACfC,SAAUvB,KAAKwB,OACfC,UAAWzB,KAAKyB,UAChBC,eAAgB1B,KAAKf,MAAM0C,KAAKC,IAAI,yCACpCC,kBAAmB7B,KAAK8B,mBAG5BhB,EAACiB,EAAAA,EAAAA,EAAAA,CACGpB,KAAMX,KAAKf,MAAM0B,MACbX,KAAKf,OAAK,CACdsC,SAAUvB,KAAKwB,OACfC,UAAWzB,KAAKyB,UAChBP,gBAAiBlB,KAAKkB,kBAGlC,CArFA,WAAAE,CAAYY,EAAiB/C,GACzBgD,MAAMD,EAAU/C,GAEhB,MAAMiD,EAAYjD,GAAwBe,KAAKmC,UAAUD,SAASjD,GAElE,GAAIe,KAAKf,MAAMkC,UAAW,CACtB,MAAMiB,EAAgBC,EAAkB,CAAEC,eAAgBtC,KAAKf,MAAMqD,gBAAkBtC,KAAKoB,iBAAqBc,GAEjHlC,KAAKf,MAAMC,QAAUc,KAAKf,MAAMC,QAAQsB,IAAI+B,GAAS9C,EAAAC,EAAA,CAAA,EAC9C6C,GAAAA,CACH7B,KAAM0B,EAAcG,EAAK3B,MAEjC,CACJ,EArBA4B,EAJE1D,EAIwB2D,eAAe,CACrCtB,WAAW,EACXjC,QAAS,GACT+B,mBAAoB,GACpBqB,eAAgBI,EAChBnC,6BAA6B"}
@@ -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 r}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 o from"../../internal/RedirectButton/RedirectButton.js";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),o.forEach(function(e){n(t,e,r[e])})}return t}function s(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e.push.apply(e,r)}return e}(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}class a extends e{formatData(){return{paymentMethod:i({type:this.type},this.state.data)}}get isValid(){return!0}renderQRCode(){return t(r,s(i({},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(o,{showPayButton:this.props.showPayButton,name:this.displayName,onSubmit:this.submit,payButton:this.payButton,ref:t=>{this.componentRef=t}}):null}}n(a,"defaultProps",{qrCodeImage:"",amount:null,paymentData:null,onError:()=>{}});export{a 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 r}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 o from"../../internal/RedirectButton/RedirectButton.js";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),o.forEach(function(e){n(t,e,r[e])})}return t}function s(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e.push.apply(e,r)}return e}(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}class a extends e{formatData(){return{paymentMethod:i({type:this.type},this.state.data)}}get isValid(){return!0}renderQRCode(){return t(r,s(i({},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():t(o,{name:this.displayName,onSubmit:this.submit,payButton:this.payButton,setComponentRef:this.setComponentRef})}}n(a,"defaultProps",{qrCodeImage:"",amount:null,paymentData:null,onError:()=>{}});export{a 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","_object_spread","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","_define_property","defaultProps","qrCodeImage","amount","onError"],"mappings":"syCAMA,MAAMA,UAAmFC,EASrFC,UAAAA,GACI,MAAO,CACHC,cAAeC,EAAA,CACXC,KAAMC,KAAKD,MACRC,KAAKC,MAAMC,MAG1B,CAEA,WAAIC,GACA,OAAO,CACX,CAGOC,YAAAA,GACH,OACIC,EAACC,EAAAA,EAAAA,EAAAA,GACON,KAAKO,OAAK,CACdC,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,kBAGpC,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,EA1DAE,EAFEpC,EAEwBqC,eAAe,CACrCC,YAAa,GACbC,OAAQ,KACRZ,YAAa,KACba,QAAS"}
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 return (\n <RedirectButton\n name={this.displayName}\n onSubmit={this.submit}\n payButton={this.payButton}\n setComponentRef={this.setComponentRef}\n />\n );\n }\n}\n\nexport default QRLoaderContainer;\n"],"names":["QRLoaderContainer","UIElement","formatData","paymentMethod","_object_spread","type","this","state","data","isValid","renderQRCode","h","QRLoader","props","delay","countdownTime","instructions","constructor","brandLogo","icon","onComplete","onActionHandled","brandName","displayName","onSubmitAnalytics","submitAnalytics","componentToRender","paymentData","RedirectButton","name","onSubmit","submit","payButton","setComponentRef","_define_property","defaultProps","qrCodeImage","amount","onError"],"mappings":"syCAMA,MAAMA,UAAmFC,EASrFC,UAAAA,GACI,MAAO,CACHC,cAAeC,EAAA,CACXC,KAAMC,KAAKD,MACRC,KAAKC,MAAMC,MAG1B,CAEA,WAAIC,GACA,OAAO,CACX,CAGOC,YAAAA,GACH,OACIC,EAACC,EAAAA,EAAAA,EAAAA,GACON,KAAKO,OAAK,CACdC,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,kBAGpC,CAEmBC,iBAAAA,GACf,OAAIpB,KAAKO,MAAMc,YACJrB,KAAKI,eAIZC,EAACiB,EAAAA,CACGC,KAAMvB,KAAKiB,YACXO,SAAUxB,KAAKyB,OACfC,UAAW1B,KAAK0B,UAChBC,gBAAiB3B,KAAK2B,iBAGlC,EAnDAC,EAFElC,EAEwBmC,eAAe,CACrCC,YAAa,GACbC,OAAQ,KACRV,YAAa,KACbW,QAAS"}
@@ -1 +1 @@
1
- {"version":3,"file":"CountryField.js","sources":["../../../../../../src/components/internal/Address/components/CountryField.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useLayoutEffect, useState } from 'preact/hooks';\nimport Field from '../../FormFields/Field';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport getDataset from '../../../../core/Services/get-dataset';\nimport { CountryFieldProps, CountryFieldItem } from '../types';\nimport Select from '../../FormFields/Select';\n\nconst formatCountries = (countries: Array<CountryFieldItem>, allowedCountries: string[]) => {\n const applyFilter = (country: CountryFieldItem) => allowedCountries.includes(country.id);\n const applyMapper = (country: CountryFieldItem) => {\n return {\n ...country,\n name: country.name,\n selectedOptionName: country.name\n };\n };\n return allowedCountries.length ? countries.filter(applyFilter).map(applyMapper) : countries.map(applyMapper);\n};\n\nexport default function CountryField(props: Readonly<CountryFieldProps>) {\n const { allowedCountries = [], classNameModifiers = [], errorMessage, onDropdownChange, value, required } = props;\n const { i18n, loadingContext } = useCoreContext();\n const [countries, setCountries] = useState<CountryFieldItem[]>([]);\n const [loaded, setLoaded] = useState<boolean>(false);\n const [readOnly, setReadOnly] = useState(props.readOnly);\n\n useLayoutEffect(() => {\n getDataset('countries', loadingContext, i18n.locale)\n .then(response => {\n const newCountries = formatCountries(response, allowedCountries);\n setCountries(newCountries || []);\n setReadOnly(newCountries.length === 1 || readOnly);\n setLoaded(true);\n })\n .catch(error => {\n console.error(error);\n setCountries([]);\n setLoaded(true);\n });\n }, []);\n\n if (!loaded) return null;\n\n return (\n <Field\n name={'country'}\n label={i18n.get('country')}\n errorMessage={errorMessage}\n classNameModifiers={classNameModifiers}\n isValid={!!value}\n showValidIcon={false}\n i18n={i18n}\n readOnly={readOnly && !!value}\n >\n <Select\n onChange={onDropdownChange}\n name={'country'}\n selectedValue={value}\n items={countries}\n readonly={readOnly && !!value}\n required={required}\n />\n </Field>\n );\n}\n"],"names":["formatCountries","countries","allowedCountries","applyMapper","country","_object_spread_props","_object_spread","name","selectedOptionName","length","filter","includes","id","map","CountryField","props","classNameModifiers","errorMessage","onDropdownChange","value","required","i18n","loadingContext","useCoreContext","setCountries","useState","loaded","setLoaded","readOnly","setReadOnly","useLayoutEffect","getDataset","locale","then","response","newCountries","catch","error","console","h","Field","label","get","isValid","showValidIcon","Select","onChange","selectedValue","items","readonly"],"mappings":"k3BAQA,MAAMA,EAAkB,CAACC,EAAoCC,KACzD,MACMC,EAAeC,GACVC,oUAAAC,CAAA,CAAA,EACAF,GAAAA,CACHG,KAAMH,EAAQG,KACdC,mBAAoBJ,EAAQG,OAGpC,OAAOL,EAAiBO,OAASR,EAAUS,OARtBN,GAA8BF,EAAiBS,SAASP,EAAQQ,KAQtBC,IAAIV,GAAeF,EAAUY,IAAIV,IAGrF,SAASW,EAAaC,GACjC,MAAMb,iBAAEA,EAAmB,GAAEc,mBAAEA,EAAqB,GAAEC,aAAEA,EAAYC,iBAAEA,EAAgBC,MAAEA,EAAKC,SAAEA,GAAaL,GACtGM,KAAEA,EAAIC,eAAEA,GAAmBC,KAC1BtB,EAAWuB,GAAgBC,EAA6B,KACxDC,EAAQC,GAAaF,GAAkB,IACvCG,EAAUC,GAAeJ,EAASV,EAAMa,UAiB/C,OAfAE,EAAgB,KACZC,EAAW,YAAaT,EAAgBD,EAAKW,QACxCC,KAAKC,IACF,MAAMC,EAAenC,EAAgBkC,EAAUhC,GAC/CsB,EAAaW,GAAgB,IAC7BN,EAAoC,IAAxBM,EAAa1B,QAAgBmB,GACzCD,GAAU,KAEbS,MAAMC,IACHC,QAAQD,MAAMA,GACdb,EAAa,IACbG,GAAU,MAEnB,IAEED,EAGDa,EAACC,EAAAA,CACGjC,KAAM,UACNkC,MAAOpB,EAAKqB,IAAI,WAChBzB,aAAcA,EACdD,mBAAoBA,EACpB2B,UAAWxB,EACXyB,eAAe,EACfvB,KAAMA,EACNO,SAAUA,KAAcT,GAExBoB,EAACM,EAAAA,CACGC,SAAU5B,EACVX,KAAM,UACNwC,cAAe5B,EACf6B,MAAO/C,EACPgD,SAAUrB,KAAcT,EACxBC,SAAUA,KAnBF,IAuBxB"}
1
+ {"version":3,"file":"CountryField.js","sources":["../../../../../../src/components/internal/Address/components/CountryField.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useLayoutEffect, useState } from 'preact/hooks';\nimport Field from '../../FormFields/Field';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport getDataset from '../../../../core/Services/get-dataset';\nimport { CountryFieldProps, CountryFieldItem } from '../types';\nimport Select from '../../FormFields/Select';\n\nconst formatCountries = (countries: Array<CountryFieldItem>, allowedCountries: string[]) => {\n const applyFilter = (country: CountryFieldItem) => allowedCountries.includes(country.id);\n const applyMapper = (country: CountryFieldItem) => {\n return {\n ...country,\n name: country.name,\n selectedOptionName: country.name\n };\n };\n return allowedCountries.length ? countries.filter(applyFilter).map(applyMapper) : countries.map(applyMapper);\n};\n\nexport default function CountryField(props: Readonly<CountryFieldProps>) {\n const { allowedCountries = [], classNameModifiers = [], errorMessage, onDropdownChange, value, required } = props;\n const { i18n, loadingContext } = useCoreContext();\n const [countries, setCountries] = useState<CountryFieldItem[]>([]);\n const [loaded, setLoaded] = useState<boolean>(false);\n const [readOnly, setReadOnly] = useState(props.readOnly);\n\n useLayoutEffect(() => {\n getDataset<CountryFieldItem[]>('countries', loadingContext, i18n.locale)\n .then(response => {\n const newCountries = formatCountries(response, allowedCountries);\n setCountries(newCountries || []);\n setReadOnly(newCountries.length === 1 || readOnly);\n setLoaded(true);\n })\n .catch(error => {\n console.error(error);\n setCountries([]);\n setLoaded(true);\n });\n }, []);\n\n if (!loaded) return null;\n\n return (\n <Field\n name={'country'}\n label={i18n.get('country')}\n errorMessage={errorMessage}\n classNameModifiers={classNameModifiers}\n isValid={!!value}\n showValidIcon={false}\n i18n={i18n}\n readOnly={readOnly && !!value}\n >\n <Select\n onChange={onDropdownChange}\n name={'country'}\n selectedValue={value}\n items={countries}\n readonly={readOnly && !!value}\n required={required}\n />\n </Field>\n );\n}\n"],"names":["formatCountries","countries","allowedCountries","applyMapper","country","_object_spread_props","_object_spread","name","selectedOptionName","length","filter","includes","id","map","CountryField","props","classNameModifiers","errorMessage","onDropdownChange","value","required","i18n","loadingContext","useCoreContext","setCountries","useState","loaded","setLoaded","readOnly","setReadOnly","useLayoutEffect","getDataset","locale","then","response","newCountries","catch","error","console","h","Field","label","get","isValid","showValidIcon","Select","onChange","selectedValue","items","readonly"],"mappings":"k3BAQA,MAAMA,EAAkB,CAACC,EAAoCC,KACzD,MACMC,EAAeC,GACVC,oUAAAC,CAAA,CAAA,EACAF,GAAAA,CACHG,KAAMH,EAAQG,KACdC,mBAAoBJ,EAAQG,OAGpC,OAAOL,EAAiBO,OAASR,EAAUS,OARtBN,GAA8BF,EAAiBS,SAASP,EAAQQ,KAQtBC,IAAIV,GAAeF,EAAUY,IAAIV,IAGrF,SAASW,EAAaC,GACjC,MAAMb,iBAAEA,EAAmB,GAAEc,mBAAEA,EAAqB,GAAEC,aAAEA,EAAYC,iBAAEA,EAAgBC,MAAEA,EAAKC,SAAEA,GAAaL,GACtGM,KAAEA,EAAIC,eAAEA,GAAmBC,KAC1BtB,EAAWuB,GAAgBC,EAA6B,KACxDC,EAAQC,GAAaF,GAAkB,IACvCG,EAAUC,GAAeJ,EAASV,EAAMa,UAiB/C,OAfAE,EAAgB,KACZC,EAA+B,YAAaT,EAAgBD,EAAKW,QAC5DC,KAAKC,IACF,MAAMC,EAAenC,EAAgBkC,EAAUhC,GAC/CsB,EAAaW,GAAgB,IAC7BN,EAAoC,IAAxBM,EAAa1B,QAAgBmB,GACzCD,GAAU,KAEbS,MAAMC,IACHC,QAAQD,MAAMA,GACdb,EAAa,IACbG,GAAU,MAEnB,IAEED,EAGDa,EAACC,EAAAA,CACGjC,KAAM,UACNkC,MAAOpB,EAAKqB,IAAI,WAChBzB,aAAcA,EACdD,mBAAoBA,EACpB2B,UAAWxB,EACXyB,eAAe,EACfvB,KAAMA,EACNO,SAAUA,KAAcT,GAExBoB,EAACM,EAAAA,CACGC,SAAU5B,EACVX,KAAM,UACNwC,cAAe5B,EACf6B,MAAO/C,EACPgD,SAAUrB,KAAcT,EACxBC,SAAUA,KAnBF,IAuBxB"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../external/preact/dist/preact.js";import r from"../../FormFields/Field/Field.js";import o from"./StateField.js";import i from"./CountryField.js";import{useCoreContext as s}from"../../../../core/Context/CoreProvider.js";import t from"../../FormFields/InputText.js";import{ADDRESS_FIELD_TOKEN_MAP as n}from"../constants.js";function a(e,r){const o=n[e];if(o)return"billingAddress"===r?`billing ${o}`:"deliveryAddress"===r?`shipping ${o}`:o}function l(n){const{i18n:l}=s(),{classNameModifiers:d=[],data:c,errors:u,valid:m,fieldName:p,onInput:f,onBlur:g,trimOnBlur:F,maxLength:v,disabled:y,addressType:C}=n,M=c[p],b=c.country,j=n.specifications.countryHasOptionalField(b,p),h=n.specifications.getKeyForField(p,b),w=j?` ${l.get("field.title.optional")}`:"",x=`${l.get(h)}${w}`,B=function(e,r,o,i){var s,t;if("object"==typeof(null===(s=e[r])||void 0===s?void 0:s.errorMessage)){const{translationKey:i,translationObject:s}=e[r].errorMessage;return o.get(i,s)}return o.get(null===(t=e[r])||void 0===t?void 0:t.errorMessage,{values:{label:i.toLowerCase()}})||!!e[r]}(u,p,l,x);switch(p){case"country":return e(i,{allowedCountries:n.allowedCountries,classNameModifiers:d,label:x,errorMessage:B,onDropdownChange:n.onDropdownChange,value:M,required:!j});case"stateOrProvince":return e(o,{classNameModifiers:d,label:x,errorMessage:B,onDropdownChange:n.onDropdownChange,selectedCountry:b,specifications:n.specifications,value:M,required:!j});default:return e(r,{label:x,classNameModifiers:d,errorMessage:B,isValid:m[p],name:p,i18n:l,onFocus:e=>n.onFieldFocusAnalytics(p,e),onBlur:e=>n.onFieldBlurAnalytics(p,e)},e(t,{name:p,classNameModifiers:d,value:M,onInput:f,onBlur:g,maxlength:v,trimOnBlur:F,disabled:y,required:!j,autocomplete:a(p,C)}))}}export{l as default};
1
+ import{createElement as e}from"../../../../external/preact/dist/preact.js";import r from"../../FormFields/Field/Field.js";import o from"./StateField.js";import i from"./CountryField.js";import{useCoreContext as s}from"../../../../core/Context/CoreProvider.js";import t from"../../FormFields/InputText.js";import{ADDRESS_FIELD_TOKEN_MAP as n}from"../constants.js";function a(e,r){const o=n[e];if(o)return"billingAddress"===r?`billing ${o}`:"deliveryAddress"===r?`shipping ${o}`:o}function l(n){const{i18n:l}=s(),{classNameModifiers:d=[],data:c,errors:u,valid:m,fieldName:p,onInput:f,onBlur:g,trimOnBlur:F,maxLength:v,disabled:y,addressType:C}=n,M=c[p],b=c.country,j=n.specifications.countryHasOptionalField(b,p),h=n.specifications.getKeyForField(p,b),w=j?` ${l.get("field.title.optional")}`:"",x=`${l.get(h)}${w}`,B=function(e,r,o,i){var s,t;if("object"==typeof(null===(s=e[r])||void 0===s?void 0:s.errorMessage)){const{translationKey:i,translationObject:s}=e[r].errorMessage;return o.get(i,s)}return o.get(null===(t=e[r])||void 0===t?void 0:t.errorMessage,{values:{label:i.toLowerCase()}})||!!e[r]}(u,p,l,x);return"country"===p?e(i,{allowedCountries:n.allowedCountries,classNameModifiers:d,label:x,errorMessage:B,onDropdownChange:n.onDropdownChange,value:M,required:!j}):"stateOrProvince"===p?e(o,{classNameModifiers:d,label:x,errorMessage:B,onDropdownChange:n.onDropdownChange,selectedCountry:b,specifications:n.specifications,value:M,required:!j}):e(r,{label:x,classNameModifiers:d,errorMessage:B,isValid:m[p],name:p,i18n:l,onFocus:e=>n.onFieldFocusAnalytics(p,e),onBlur:e=>n.onFieldBlurAnalytics(p,e)},e(t,{name:p,classNameModifiers:d,value:M,onInput:f,onBlur:g,maxlength:v,trimOnBlur:F,disabled:y,required:!j,autocomplete:a(p,C)}))}export{l as default};
2
2
  //# sourceMappingURL=FieldContainer.js.map
@@ -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';\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,GACrBk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AQ+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 if (fieldName === '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 }\n\n if (fieldName === '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 }\n\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\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,IAAIH,KAAYE,IAChCG,EAnCV,SAAyBlB,EAA2BV,EAAmBM,EAAgBqB,OACxEjB,EAKeA,EAL1B,GAA+C,yBAApCA,EAAAA,EAAOV,UAAPU,IAAAA,OAAAA,EAAAA,EAAmBkB,cAA2B,CACrD,MAAMC,eAAEA,EAAcC,kBAAEA,GAAsBpB,EAAOV,GAAW4B,aAChE,OAAOtB,EAAKoB,IAAIG,EAAgBC,EACpC,CAGA,OADiBxB,EAAKoB,IAAqB,QAAjBhB,EAAAA,EAAOV,UAAPU,IAAAA,OAAAA,EAAAA,EAAmBkB,aAAc,CAAEG,OAAQ,CAAEJ,MAAOA,EAAMK,oBAC/DtB,EAAOV,EAChC,CA2ByBiC,CAAgBvB,EAAQV,EAAWM,EAAMqB,GAE9D,MAAkB,YAAd3B,EAEIkC,EAACC,EAAAA,CACGC,iBAAkB/B,EAAM+B,iBACxB5B,mBAAoBA,EACpBmB,MAAOA,EACPC,aAAcA,EACdS,iBAAkBhC,EAAMgC,iBACxBpB,MAAOA,EACPqB,UAAWlB,IAKL,oBAAdpB,EAEIkC,EAACK,EAAAA,CACG/B,mBAAoBA,EACpBmB,MAAOA,EACPC,aAAcA,EACdS,iBAAkBhC,EAAMgC,iBACxBnB,gBAAiBA,EACjBG,eAAgBhB,EAAMgB,eACtBJ,MAAOA,EACPqB,UAAWlB,IAMnBc,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,KAIhE"}
@@ -1 +1 @@
1
- {"version":3,"file":"StateField.js","sources":["../../../../../../src/components/internal/Address/components/StateField.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState, useLayoutEffect } from 'preact/hooks';\nimport Field from '../../FormFields/Field';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport getDataset from '../../../../core/Services/get-dataset';\nimport { StateFieldItem, StateFieldProps } from '../types';\nimport Select from '../../FormFields/Select';\n\nexport default function StateField(props: Readonly<StateFieldProps>) {\n const { classNameModifiers, label, onDropdownChange, readOnly, selectedCountry, specifications, value, required } = props;\n const { i18n, loadingContext } = useCoreContext();\n const [states, setStates] = useState<StateFieldItem[]>([]);\n const [loaded, setLoaded] = useState<boolean>(false);\n\n useLayoutEffect(() => {\n if (!selectedCountry || !specifications.countryHasDataset(selectedCountry)) {\n setStates([]);\n setLoaded(true);\n return;\n }\n\n getDataset(`states/${selectedCountry}`, loadingContext, i18n.locale)\n .then(response => {\n const newStates = response && response.length ? response : [];\n setStates(newStates);\n setLoaded(true);\n })\n .catch(() => {\n setStates([]);\n setLoaded(true);\n });\n }, [selectedCountry]);\n\n if (!loaded || !states.length) return null;\n\n return (\n <Field\n label={label}\n classNameModifiers={classNameModifiers}\n errorMessage={props.errorMessage}\n isValid={!!value}\n showValidIcon={false}\n name={'stateOrProvince'}\n i18n={i18n}\n readOnly={readOnly && !!value}\n >\n <Select\n name={'stateOrProvince'}\n onChange={onDropdownChange}\n selectedValue={value}\n items={states}\n required={required}\n readonly={readOnly && !!value}\n />\n </Field>\n );\n}\n"],"names":["StateField","props","classNameModifiers","label","onDropdownChange","readOnly","selectedCountry","specifications","value","required","i18n","loadingContext","useCoreContext","states","setStates","useState","loaded","setLoaded","useLayoutEffect","countryHasDataset","getDataset","locale","then","response","newStates","length","catch","h","Field","errorMessage","isValid","showValidIcon","name","Select","onChange","selectedValue","items","readonly"],"mappings":"6YAQe,SAASA,EAAWC,GAC/B,MAAMC,mBAAEA,EAAkBC,MAAEA,EAAKC,iBAAEA,EAAgBC,SAAEA,EAAQC,gBAAEA,EAAeC,eAAEA,EAAcC,MAAEA,EAAKC,SAAEA,GAAaR,GAC9GS,KAAEA,EAAIC,eAAEA,GAAmBC,KAC1BC,EAAQC,GAAaC,EAA2B,KAChDC,EAAQC,GAAaF,GAAkB,GAqB9C,OAnBAG,EAAgB,KACZ,IAAKZ,IAAoBC,EAAeY,kBAAkBb,GAGtD,OAFAQ,EAAU,SACVG,GAAU,GAIdG,EAAW,UAAUd,IAAmBK,EAAgBD,EAAKW,QACxDC,KAAKC,IACF,MAAMC,EAAYD,GAAYA,EAASE,OAASF,EAAW,GAC3DT,EAAUU,GACVP,GAAU,KAEbS,MAAM,KACHZ,EAAU,IACVG,GAAU,MAEnB,CAACX,IAECU,GAAWH,EAAOY,OAGnBE,EAACC,EAAAA,CACGzB,MAAOA,EACPD,mBAAoBA,EACpB2B,aAAc5B,EAAM4B,aACpBC,UAAWtB,EACXuB,eAAe,EACfC,KAAM,kBACNtB,KAAMA,EACNL,SAAUA,KAAcG,GAExBmB,EAACM,EAAAA,CACGD,KAAM,kBACNE,SAAU9B,EACV+B,cAAe3B,EACf4B,MAAOvB,EACPJ,SAAUA,EACV4B,SAAUhC,KAAcG,KAnBE,IAuB1C"}
1
+ {"version":3,"file":"StateField.js","sources":["../../../../../../src/components/internal/Address/components/StateField.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState, useLayoutEffect } from 'preact/hooks';\nimport Field from '../../FormFields/Field';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport getDataset from '../../../../core/Services/get-dataset';\nimport { StateFieldItem, StateFieldProps } from '../types';\nimport Select from '../../FormFields/Select';\n\nexport default function StateField(props: Readonly<StateFieldProps>) {\n const { classNameModifiers, label, onDropdownChange, readOnly, selectedCountry, specifications, value, required } = props;\n const { i18n, loadingContext } = useCoreContext();\n const [states, setStates] = useState<StateFieldItem[]>([]);\n const [loaded, setLoaded] = useState<boolean>(false);\n\n useLayoutEffect(() => {\n if (!selectedCountry || !specifications.countryHasDataset(selectedCountry)) {\n setStates([]);\n setLoaded(true);\n return;\n }\n\n getDataset<StateFieldItem[]>(`states/${selectedCountry}`, loadingContext, i18n.locale)\n .then(response => {\n const newStates = response && response.length ? response : [];\n setStates(newStates);\n setLoaded(true);\n })\n .catch(() => {\n setStates([]);\n setLoaded(true);\n });\n }, [selectedCountry]);\n\n if (!loaded || !states.length) return null;\n\n return (\n <Field\n label={label}\n classNameModifiers={classNameModifiers}\n errorMessage={props.errorMessage}\n isValid={!!value}\n showValidIcon={false}\n name={'stateOrProvince'}\n i18n={i18n}\n readOnly={readOnly && !!value}\n >\n <Select\n name={'stateOrProvince'}\n onChange={onDropdownChange}\n selectedValue={value}\n items={states}\n required={required}\n readonly={readOnly && !!value}\n />\n </Field>\n );\n}\n"],"names":["StateField","props","classNameModifiers","label","onDropdownChange","readOnly","selectedCountry","specifications","value","required","i18n","loadingContext","useCoreContext","states","setStates","useState","loaded","setLoaded","useLayoutEffect","countryHasDataset","getDataset","locale","then","response","newStates","length","catch","h","Field","errorMessage","isValid","showValidIcon","name","Select","onChange","selectedValue","items","readonly"],"mappings":"6YAQe,SAASA,EAAWC,GAC/B,MAAMC,mBAAEA,EAAkBC,MAAEA,EAAKC,iBAAEA,EAAgBC,SAAEA,EAAQC,gBAAEA,EAAeC,eAAEA,EAAcC,MAAEA,EAAKC,SAAEA,GAAaR,GAC9GS,KAAEA,EAAIC,eAAEA,GAAmBC,KAC1BC,EAAQC,GAAaC,EAA2B,KAChDC,EAAQC,GAAaF,GAAkB,GAqB9C,OAnBAG,EAAgB,KACZ,IAAKZ,IAAoBC,EAAeY,kBAAkBb,GAGtD,OAFAQ,EAAU,SACVG,GAAU,GAIdG,EAA6B,UAAUd,IAAmBK,EAAgBD,EAAKW,QAC1EC,KAAKC,IACF,MAAMC,EAAYD,GAAYA,EAASE,OAASF,EAAW,GAC3DT,EAAUU,GACVP,GAAU,KAEbS,MAAM,KACHZ,EAAU,IACVG,GAAU,MAEnB,CAACX,IAECU,GAAWH,EAAOY,OAGnBE,EAACC,EAAAA,CACGzB,MAAOA,EACPD,mBAAoBA,EACpB2B,aAAc5B,EAAM4B,aACpBC,UAAWtB,EACXuB,eAAe,EACfC,KAAM,kBACNtB,KAAMA,EACNL,SAAUA,KAAcG,GAExBmB,EAACM,EAAAA,CACGD,KAAM,kBACNE,SAAU9B,EACV+B,cAAe3B,EACf4B,MAAOvB,EACPJ,SAAUA,EACV4B,SAAUhC,KAAcG,KAnBE,IAuB1C"}
@@ -1,2 +1,2 @@
1
- const e="N/A",s=["street","houseNumberOrName","postalCode","city","stateOrProvince","country"],[a,t,l,r,o,c]=s,d={street:"address-line1",houseNumberOrName:"address-line2",postalCode:"postal-code",city:"address-level2"},i={AU:{hasDataset:!0,labels:{[t]:"apartmentSuite",[o]:"state",[a]:"address"},optionalFields:[t],placeholders:{[o]:"select.state"},schema:[c,a,t,r,[[o,50],[l,50]]]},BR:{hasDataset:!0,labels:{[o]:"state"},placeholders:{[o]:"select.state"}},CA:{hasDataset:!0,labels:{[t]:"apartmentSuite",[o]:"provinceOrTerritory",[a]:"address"},optionalFields:[t],schema:[c,a,t,[[r,70],[l,30]],o]},GB:{labels:{[r]:"cityTown"},schema:[c,[[t,30],[a,70]],[[r,70],[l,30]],o]},US:{hasDataset:!0,labels:{[l]:"zipCode",[t]:"apartmentSuite",[o]:"state",[a]:"address"},optionalFields:[t],placeholders:{[o]:"select.state"},schema:[c,a,t,r,[[o,50],[l,50]]]},default:{optionalFields:[],placeholders:{[o]:"select.provinceOrTerritory"},schema:[c,[[a,70],[t,30]],[[l,30],[r,70]],o]}},p=Object.keys(i).reduce((e,s)=>(e[s]={labels:i[s].labels,schema:[l]},e),{}),h=Object.keys(i);export{d as ADDRESS_FIELD_TOKEN_MAP,s as ADDRESS_SCHEMA,i as ADDRESS_SPECIFICATIONS,r as CITY,h as COUNTRIES_WITH_CUSTOM_SPECIFICATION,c as COUNTRY,e as FALLBACK_VALUE,t as HOUSE_NUMBER_OR_NAME,p as PARTIAL_ADDRESS_SCHEMA,l as POSTAL_CODE,o as STATE_OR_PROVINCE,a as STREET};
1
+ const e="N/A",s=["street","houseNumberOrName","postalCode","city","stateOrProvince","country"],[a,t,l,r,o,c]=s,d={street:"address-line1",houseNumberOrName:"address-line2",postalCode:"postal-code",city:"address-level2"},i={AU:{hasDataset:!0,labels:{[t]:"apartmentSuite",[o]:"state",[a]:"address"},optionalFields:[t],placeholders:{[o]:"select.state"},schema:[c,a,t,r,[[o,50],[l,50]]]},BR:{hasDataset:!0,labels:{[o]:"state"},placeholders:{[o]:"select.state"}},CA:{hasDataset:!0,labels:{[t]:"apartmentSuite",[o]:"provinceOrTerritory",[a]:"address"},optionalFields:[t],schema:[c,a,t,[[r,70],[l,30]],o]},GB:{labels:{[r]:"cityTown"},schema:[c,[[t,30],[a,70]],[[r,70],[l,30]],o]},JP:{hasDataset:!0,labels:{[o]:"prefecture",[r]:"cityTown",[a]:"streetNameAndBlockNumber",[t]:"buildingNameRoomNumber"},optionalFields:[t],schema:[c,[[l,50],[o,50]],r,a,t]},US:{hasDataset:!0,labels:{[l]:"zipCode",[t]:"apartmentSuite",[o]:"state",[a]:"address"},optionalFields:[t],placeholders:{[o]:"select.state"},schema:[c,a,t,r,[[o,50],[l,50]]]},default:{optionalFields:[],placeholders:{[o]:"select.provinceOrTerritory"},schema:[c,[[a,70],[t,30]],[[l,30],[r,70]],o]}},p=Object.keys(i).reduce((e,s)=>(e[s]={labels:i[s].labels,schema:[l]},e),{}),m=Object.keys(i);export{d as ADDRESS_FIELD_TOKEN_MAP,s as ADDRESS_SCHEMA,i as ADDRESS_SPECIFICATIONS,r as CITY,m as COUNTRIES_WITH_CUSTOM_SPECIFICATION,c as COUNTRY,e as FALLBACK_VALUE,t as HOUSE_NUMBER_OR_NAME,p as PARTIAL_ADDRESS_SCHEMA,l as POSTAL_CODE,o as STATE_OR_PROVINCE,a as STREET};
2
2
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../../../../../src/components/internal/Address/constants.ts"],"sourcesContent":["import { AddressSpecifications } from './types';\n\nexport const FALLBACK_VALUE = 'N/A';\nexport const ADDRESS_SCHEMA = ['street', 'houseNumberOrName', 'postalCode', 'city', 'stateOrProvince', 'country'] as const;\nexport const [STREET, HOUSE_NUMBER_OR_NAME, POSTAL_CODE, CITY, STATE_OR_PROVINCE, COUNTRY] = ADDRESS_SCHEMA;\n\n// WCAG 2.2 - Address field autocomplete tokens\nexport const ADDRESS_FIELD_TOKEN_MAP: Record<string, string> = {\n street: 'address-line1',\n houseNumberOrName: 'address-line2',\n postalCode: 'postal-code',\n city: 'address-level2'\n};\n\n// prettier-ignore\nexport const ADDRESS_SPECIFICATIONS: AddressSpecifications = {\n AU: {\n hasDataset: true,\n labels: {\n [HOUSE_NUMBER_OR_NAME]: 'apartmentSuite',\n [STATE_OR_PROVINCE]: 'state',\n [STREET]: 'address'\n },\n optionalFields: [HOUSE_NUMBER_OR_NAME],\n placeholders: {\n [STATE_OR_PROVINCE]: 'select.state'\n },\n schema: [COUNTRY, STREET, HOUSE_NUMBER_OR_NAME, CITY, [[STATE_OR_PROVINCE, 50], [POSTAL_CODE, 50]]]\n },\n BR: {\n hasDataset: true,\n labels: {\n [STATE_OR_PROVINCE]: 'state'\n },\n placeholders: {\n [STATE_OR_PROVINCE]: 'select.state'\n },\n },\n CA: {\n hasDataset: true,\n labels: {\n [HOUSE_NUMBER_OR_NAME]: 'apartmentSuite',\n [STATE_OR_PROVINCE]: 'provinceOrTerritory',\n [STREET]: 'address'\n },\n optionalFields: [HOUSE_NUMBER_OR_NAME],\n schema: [COUNTRY, STREET, HOUSE_NUMBER_OR_NAME, [[CITY, 70], [POSTAL_CODE, 30]], STATE_OR_PROVINCE]\n },\n GB: {\n labels: {\n [CITY]: 'cityTown'\n },\n schema: [COUNTRY, [[HOUSE_NUMBER_OR_NAME, 30], [STREET, 70]], [[CITY, 70], [POSTAL_CODE, 30]], STATE_OR_PROVINCE]\n },\n US: {\n hasDataset: true,\n labels: {\n [POSTAL_CODE]: 'zipCode',\n [HOUSE_NUMBER_OR_NAME]: 'apartmentSuite',\n [STATE_OR_PROVINCE]: 'state',\n [STREET]: 'address'\n },\n optionalFields: [HOUSE_NUMBER_OR_NAME],\n placeholders: {\n [STATE_OR_PROVINCE]: 'select.state'\n },\n schema: [COUNTRY, STREET, HOUSE_NUMBER_OR_NAME, CITY, [[STATE_OR_PROVINCE, 50], [POSTAL_CODE, 50]]]\n },\n default: {\n optionalFields: [],\n placeholders: {\n [STATE_OR_PROVINCE]: 'select.provinceOrTerritory'\n },\n schema: [COUNTRY, [[STREET, 70], [HOUSE_NUMBER_OR_NAME, 30]], [[POSTAL_CODE, 30], [CITY, 70]], STATE_OR_PROVINCE],\n }\n};\n\nexport const PARTIAL_ADDRESS_SCHEMA: AddressSpecifications = Object.keys(ADDRESS_SPECIFICATIONS).reduce((acc, countryCode) => {\n acc[countryCode] = {\n labels: ADDRESS_SPECIFICATIONS[countryCode].labels,\n schema: [POSTAL_CODE]\n };\n return acc;\n}, {} as AddressSpecifications);\n\nexport const COUNTRIES_WITH_CUSTOM_SPECIFICATION = Object.keys(ADDRESS_SPECIFICATIONS);\n"],"names":["FALLBACK_VALUE","ADDRESS_SCHEMA","STREET","HOUSE_NUMBER_OR_NAME","POSTAL_CODE","CITY","STATE_OR_PROVINCE","COUNTRY","ADDRESS_FIELD_TOKEN_MAP","street","houseNumberOrName","postalCode","city","ADDRESS_SPECIFICATIONS","AU","hasDataset","labels","optionalFields","placeholders","schema","BR","CA","GB","US","default","PARTIAL_ADDRESS_SCHEMA","Object","keys","reduce","acc","countryCode","COUNTRIES_WITH_CUSTOM_SPECIFICATION"],"mappings":"AAEO,MAAMA,EAAiB,MACjBC,EAAiB,CAAC,SAAU,oBAAqB,aAAc,OAAQ,kBAAmB,YACzFC,EAAQC,EAAsBC,EAAaC,EAAMC,EAAmBC,GAAWN,EAGhFO,EAAkD,CAC3DC,OAAQ,gBACRC,kBAAmB,gBACnBC,WAAY,cACZC,KAAM,kBAIGC,EAAgD,CACzDC,GAAI,CACAC,YAAY,EACZC,OAAQ,CACJb,CAACA,GAAuB,iBACxBG,CAACA,GAAoB,QACrBJ,CAACA,GAAS,WAEde,eAAgB,CAACd,GACjBe,aAAc,CACVZ,CAACA,GAAoB,gBAEzBa,OAAQ,CAACZ,EAASL,EAAQC,EAAsBE,EAAM,CAAC,CAACC,EAAmB,IAAK,CAACF,EAAa,OAElGgB,GAAI,CACAL,YAAY,EACZC,OAAQ,CACJV,CAACA,GAAoB,SAEzBY,aAAc,CACVZ,CAACA,GAAoB,iBAG7Be,GAAI,CACAN,YAAY,EACZC,OAAQ,CACJb,CAACA,GAAuB,iBACxBG,CAACA,GAAoB,sBACrBJ,CAACA,GAAS,WAEde,eAAgB,CAACd,GACjBgB,OAAQ,CAACZ,EAASL,EAAQC,EAAsB,CAAC,CAACE,EAAM,IAAK,CAACD,EAAa,KAAME,IAErFgB,GAAI,CACAN,OAAQ,CACJX,CAACA,GAAO,YAEZc,OAAQ,CAACZ,EAAS,CAAC,CAACJ,EAAsB,IAAK,CAACD,EAAQ,KAAM,CAAC,CAACG,EAAM,IAAK,CAACD,EAAa,KAAME,IAEnGiB,GAAI,CACAR,YAAY,EACZC,OAAQ,CACJZ,CAACA,GAAc,UACfD,CAACA,GAAuB,iBACxBG,CAACA,GAAoB,QACrBJ,CAACA,GAAS,WAEde,eAAgB,CAACd,GACjBe,aAAc,CACVZ,CAACA,GAAoB,gBAEzBa,OAAQ,CAACZ,EAASL,EAAQC,EAAsBE,EAAM,CAAC,CAACC,EAAmB,IAAK,CAACF,EAAa,OAElGoB,QAAS,CACLP,eAAgB,GAChBC,aAAc,CACVZ,CAACA,GAAoB,8BAEzBa,OAAQ,CAACZ,EAAS,CAAC,CAACL,EAAQ,IAAK,CAACC,EAAsB,KAAM,CAAC,CAACC,EAAa,IAAK,CAACC,EAAM,KAAMC,KAI1FmB,EAAgDC,OAAOC,KAAKd,GAAwBe,OAAO,CAACC,EAAKC,KAC1GD,EAAIC,GAAe,CACfd,OAAQH,EAAuBiB,GAAad,OAC5CG,OAAQ,CAACf,IAENyB,GACR,CAAA,GAEUE,EAAsCL,OAAOC,KAAKd"}
1
+ {"version":3,"file":"constants.js","sources":["../../../../../src/components/internal/Address/constants.ts"],"sourcesContent":["import { AddressSpecifications } from './types';\n\nexport const FALLBACK_VALUE = 'N/A';\nexport const ADDRESS_SCHEMA = ['street', 'houseNumberOrName', 'postalCode', 'city', 'stateOrProvince', 'country'] as const;\nexport const [STREET, HOUSE_NUMBER_OR_NAME, POSTAL_CODE, CITY, STATE_OR_PROVINCE, COUNTRY] = ADDRESS_SCHEMA;\n\n// WCAG 2.2 - Address field autocomplete tokens\nexport const ADDRESS_FIELD_TOKEN_MAP: Record<string, string> = {\n street: 'address-line1',\n houseNumberOrName: 'address-line2',\n postalCode: 'postal-code',\n city: 'address-level2'\n};\n\n// prettier-ignore\nexport const ADDRESS_SPECIFICATIONS: AddressSpecifications = {\n AU: {\n hasDataset: true,\n labels: {\n [HOUSE_NUMBER_OR_NAME]: 'apartmentSuite',\n [STATE_OR_PROVINCE]: 'state',\n [STREET]: 'address'\n },\n optionalFields: [HOUSE_NUMBER_OR_NAME],\n placeholders: {\n [STATE_OR_PROVINCE]: 'select.state'\n },\n schema: [COUNTRY, STREET, HOUSE_NUMBER_OR_NAME, CITY, [[STATE_OR_PROVINCE, 50], [POSTAL_CODE, 50]]]\n },\n BR: {\n hasDataset: true,\n labels: {\n [STATE_OR_PROVINCE]: 'state'\n },\n placeholders: {\n [STATE_OR_PROVINCE]: 'select.state'\n },\n },\n CA: {\n hasDataset: true,\n labels: {\n [HOUSE_NUMBER_OR_NAME]: 'apartmentSuite',\n [STATE_OR_PROVINCE]: 'provinceOrTerritory',\n [STREET]: 'address'\n },\n optionalFields: [HOUSE_NUMBER_OR_NAME],\n schema: [COUNTRY, STREET, HOUSE_NUMBER_OR_NAME, [[CITY, 70], [POSTAL_CODE, 30]], STATE_OR_PROVINCE]\n },\n GB: {\n labels: {\n [CITY]: 'cityTown'\n },\n schema: [COUNTRY, [[HOUSE_NUMBER_OR_NAME, 30], [STREET, 70]], [[CITY, 70], [POSTAL_CODE, 30]], STATE_OR_PROVINCE]\n },\n JP: {\n hasDataset: true,\n labels: {\n [STATE_OR_PROVINCE]: 'prefecture',\n [CITY]: 'cityTown',\n [STREET]: 'streetNameAndBlockNumber',\n [HOUSE_NUMBER_OR_NAME]: 'buildingNameRoomNumber'\n },\n optionalFields: [HOUSE_NUMBER_OR_NAME],\n schema: [COUNTRY, [[POSTAL_CODE, 50], [STATE_OR_PROVINCE, 50]], CITY, STREET, HOUSE_NUMBER_OR_NAME]\n },\n US: {\n hasDataset: true,\n labels: {\n [POSTAL_CODE]: 'zipCode',\n [HOUSE_NUMBER_OR_NAME]: 'apartmentSuite',\n [STATE_OR_PROVINCE]: 'state',\n [STREET]: 'address'\n },\n optionalFields: [HOUSE_NUMBER_OR_NAME],\n placeholders: {\n [STATE_OR_PROVINCE]: 'select.state'\n },\n schema: [COUNTRY, STREET, HOUSE_NUMBER_OR_NAME, CITY, [[STATE_OR_PROVINCE, 50], [POSTAL_CODE, 50]]]\n },\n default: {\n optionalFields: [],\n placeholders: {\n [STATE_OR_PROVINCE]: 'select.provinceOrTerritory'\n },\n schema: [COUNTRY, [[STREET, 70], [HOUSE_NUMBER_OR_NAME, 30]], [[POSTAL_CODE, 30], [CITY, 70]], STATE_OR_PROVINCE],\n }\n};\n\nexport const PARTIAL_ADDRESS_SCHEMA: AddressSpecifications = Object.keys(ADDRESS_SPECIFICATIONS).reduce((acc, countryCode) => {\n acc[countryCode] = {\n labels: ADDRESS_SPECIFICATIONS[countryCode].labels,\n schema: [POSTAL_CODE]\n };\n return acc;\n}, {} as AddressSpecifications);\n\nexport const COUNTRIES_WITH_CUSTOM_SPECIFICATION = Object.keys(ADDRESS_SPECIFICATIONS);\n"],"names":["FALLBACK_VALUE","ADDRESS_SCHEMA","STREET","HOUSE_NUMBER_OR_NAME","POSTAL_CODE","CITY","STATE_OR_PROVINCE","COUNTRY","ADDRESS_FIELD_TOKEN_MAP","street","houseNumberOrName","postalCode","city","ADDRESS_SPECIFICATIONS","AU","hasDataset","labels","optionalFields","placeholders","schema","BR","CA","GB","JP","US","default","PARTIAL_ADDRESS_SCHEMA","Object","keys","reduce","acc","countryCode","COUNTRIES_WITH_CUSTOM_SPECIFICATION"],"mappings":"AAEO,MAAMA,EAAiB,MACjBC,EAAiB,CAAC,SAAU,oBAAqB,aAAc,OAAQ,kBAAmB,YACzFC,EAAQC,EAAsBC,EAAaC,EAAMC,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ACZ,EAASL,EAAQC,EAAsBE,EAAM,CAAC,CAACC,EAAmB,IAAK,CAACF,EAAa,OAElGqB,QAAS,CACLR,eAAgB,GAChBC,aAAc,CACVZ,CAACA,GAAoB,8BAEzBa,OAAQ,CAACZ,EAAS,CAAC,CAACL,EAAQ,IAAK,CAACC,EAAsB,KAAM,CAAC,CAACC,EAAa,IAAK,CAACC,EAAM,KAAMC,KAI1FoB,EAAgDC,OAAOC,KAAKf,GAAwBgB,OAAO,CAACC,EAAKC,KAC1GD,EAAIC,GAAe,CACff,OAAQH,EAAuBkB,GAAaf,OAC5CG,OAAQ,CAACf,IAEN0B,GACR,CAAA,GAEUE,EAAsCL,OAAOC,KAAKf"}
@@ -1,2 +1,2 @@
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)=>{var a;const e=t.state.data.country,r=null===(a=l[e])||void 0===a?void 0:a.postalCode.formatterFn;return r?r(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};
1
+ import{getFormattingRegEx as o,stripInvalidChars as t}from"../../../utils/validator-utils.js";import{convertFullToHalf as a}from"../FormFields/utils.js";const e=t=>({formatterFn:a=>a.replace(o("^\\d","g"),"").substring(0,t),format:new Array(t).fill("9").join(""),maxlength:t}),r=o=>o,l={postalCode:{formatterFn:(o,t)=>{var a;const e=t.state.data.country,r=null===(a=s[e])||void 0===a?void 0:a.postalCode.formatterFn;return r?r(o):o}},street:{formatterFn:r},houseNumberOrName:{formatterFn:r},city:{formatterFn:r}},s={AT:{postalCode:e(4)},AU:{postalCode:e(4)},BE:{postalCode:e(4)},BG:{postalCode:e(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:e(4)},CY:{postalCode:e(4)},CZ:{postalCode:{format:"999 99",maxlength:6}},DE:{postalCode:e(5)},DK:{postalCode:{format:"9999",maxlength:7}},EE:{postalCode:e(5)},ES:{postalCode:e(5)},FI:{postalCode:e(5)},FR:{postalCode:e(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:e(4)},IE:{postalCode:{format:"A99 A999",maxlength:8}},IS:{postalCode:e(3)},IT:{postalCode:e(5)},LI:{postalCode:e(4)},LT:{postalCode:{format:"9999 or 99999 or LT-99999",maxlength:8}},LU:{postalCode:e(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:e(5)},NL:{postalCode:{format:"9999AA",maxlength:7}},NZ:{postalCode:e(4)},NO:{postalCode:e(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:e(6)},SI:{postalCode:{format:"9999 or SI-9999",maxlength:7}},SE:{postalCode:e(5)},SG:{postalCode:e(6)},SK:{postalCode:{format:"99999 or SK-99999",maxlength:8}},JP:{postalCode:{formatterFn:t=>a(t).replace(o("^\\d-","g"),"").substring(0,8),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};
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, 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","countrySpecificFormatters","country","state","data","specificRule","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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AG,GAE9BC,OAAQ,WACRI,UAAW,IAGnBkD,GAAI,CACA/C,WAAYd,EAAqB,IAErC8D,GAAI,CACAhD,WAAY,CACRP,OAAQ,kBACRI,UAAW,IAGnBoD,GAAI,CACAjD,WAAYd,EAAqB,IAErCgE,GAAI,CACAlD,WAAYd,EAAqB,IAErCiE,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
+ {"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';\nimport { convertFullToHalf } from '../FormFields/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 // Formatter - converts full-width characters (common on Japanese keyboards, e.g. '107-0052') to their\n // half-width equivalent, then strips any remaining non-digit/hyphen characters (e.g. the postal mark '〒')\n formatterFn: val => convertFullToHalf(val).replace(getFormattingRegEx('^\\\\d-', 'g'), '').substring(0, 8),\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","countrySpecificFormatters","country","state","data","specificRule","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","convertFullToHalf","US"],"mappings":"yJAMA,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,EAAuBT,GAAgBA,EAEhCU,EAAiC,CAC1CC,WAAY,CACRZ,YAAa,CAACC,EAAaY,KAIFC,IAAAA,EAHrB,MAAMC,EAAUF,EAAQG,MAAMC,KAAKF,QAG7BG,UAAeJ,EAAAA,EAA0BC,UAA1BD,IAAAA,OAAAA,EAAAA,EAAoCF,WAAWZ,YACpE,OAAIkB,EACOA,EAAajB,GAIjBA,IAGfkB,OAAQ,CACJnB,YAAaU,GAEjBU,kBAAmB,CACfpB,YAAaU,GAEjBW,KAAM,CACFrB,YAAaU,IAORI,EAAiD,CAC1DQ,GAAI,CACAV,WAAYd,EAAqB,IAErCyB,GAAI,CACAX,WAAYd,EAAqB,IAErC0B,GAAI,CACAZ,WAAYd,EAAqB,IAErC2B,GAAI,CACAb,WAAYd,EA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ORMAT_EXPECTS as a}from"../../../core/Errors/constants.js";import{isEmpty as o,validateForSpecialChars as n}from"../../../utils/validator-utils.js";const d=t=>({pattern:new RegExp(`\\d{${t}}`)}),s=(r,e,n)=>{if(e){var d,s;if(o(r))return null;n.postalCode.errorMessage={translationKey:a,translationObject:{values:{format:(null===(d=t[e])||void 0===d?void 0:d.postalCode.format)||null}}};const u=null===(s=l[e])||void 0===s?void 0:s.pattern;return u?u.test(r):!!r}return!o(r)||null},l={AT:d(4),AU:d(4),BE:{pattern:/(?:(?:[1-9])(?:\d{3}))/},BG:d(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:d(4),CZ:{pattern:/\d{3}\s?\d{2}/},DE:d(5),DK:d(4),EE:d(5),ES:{pattern:/(?:0[1-9]|[1-4]\d|5[0-2])\d{3}/},FI:d(5),FR:d(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:d(4),GR:{pattern:/^\d{3}\s{0,1}\d{2}$/},HR:{pattern:/^([1-5])[0-9]{4}$/},HU:d(4),IE:{pattern:/(?:^[AC-FHKNPRTV-Y][0-9]{2}|D6W)[ -]?[0-9AC-FHKNPRTV-Y]{4}/},IS:d(3),IT:d(5),LI:d(4),LT:{pattern:/^(LT-\d{5}|\d{4,5})$/},LU:d(4),LV:{pattern:/^(LV-)[0-9]{4}$/},MC:{pattern:/^980\d{2}$/},MT:{pattern:/^[A-Za-z]{3}\d{4}$/},MY:d(5),NL:{pattern:/(?:NL-)?(?:[1-9]\d{3} ?(?:[A-EGHJ-NPRTVWXZ][A-EGHJ-NPRSTVWXZ]|S[BCEGHJ-NPRTVWXZ]))/},NO:d(4),PL:{pattern:/^\d{2}[-]{0,1}\d{3}$/},PT:{pattern:/^([1-9]\d{3})([- ]?(\d{3})? *)$/},RO:d(6),SI:d(4),SE:d(5),SG:d(6),SK:d(5),US:{pattern:/^\d{5}(?:-\d{4})?$/}},u=t=>{const e={postalCode:{modes:["blur"],validate:r=>s(r,t,e),errorMessage:r}};return e},p={modes:["blur"],validate:t=>!o(t)||null,errorMessage:r},i={modes:["blur"],validate:t=>n(t),errorMessage:e},m=t=>{const e={postalCode:{modes:["blur"],validate:(t,r)=>{const a=r.state.data.country;return s(t,a,e)},errorMessage:r},street:[p,i],houseNumberOrName:[{validate:(r,e)=>{var a,n;const d=null===(n=e.state)||void 0===n||null===(a=n.data)||void 0===a?void 0:a.country;return d&&t.countryHasOptionalField(d,"houseNumberOrName")||!o(r)||null},modes:["blur"],errorMessage:r},i],city:[p,i],default:p};return e};export{m as getAddressValidationRules,u as getPartialAddressValidationRules,s 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 d,validateForSpecialChars as n}from"../../../utils/validator-utils.js";const o=t=>({pattern:new RegExp(`\\d{${t}}`)}),s=(r,e,n)=>{if(e){var o,s;if(d(r))return null;n.postalCode.errorMessage={translationKey:a,translationObject:{values:{format:(null===(o=t[e])||void 0===o?void 0:o.postalCode.format)||null}}};const u=null===(s=l[e])||void 0===s?void 0:s.pattern;return u?u.test(r):!!r}return!d(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),JP:{pattern:/^\d{3}-?\d{4}$/},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})?$/}},u=t=>{const e={postalCode:{modes:["blur"],validate:r=>s(r,t,e),errorMessage:r}};return e},p={modes:["blur"],validate:t=>!d(t)||null,errorMessage:r},i={modes:["blur"],validate:t=>n(t),errorMessage:e},m=t=>{const e={postalCode:{modes:["blur"],validate:(t,r)=>{const a=r.state.data.country;return s(t,a,e)},errorMessage:r},street:[p,i],houseNumberOrName:[{validate:(r,e)=>{var a,n;const o=null===(n=e.state)||void 0===n||null===(a=n.data)||void 0===a?void 0:a.country;return o&&t.countryHasOptionalField(o,"houseNumberOrName")||!d(r)||null},modes:["blur"],errorMessage:r},i],city:[p,i],default:p};return e};export{m as getAddressValidationRules,u as getPartialAddressValidationRules,s 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, 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","countrySpecificFormatters","postalCodePatterns","isEmpty","postalCode","errorMessage","translationKey","ERROR_INVALID_FORMAT_EXPECTS","translationObject","values","format","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,EAA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D,GAAI,CAAE/C,QAAS,sFACfgD,GAAIlD,EAAsB,GAC1BmD,GAAI,CAAEjD,QAAS,wBACfkD,GAAI,CAAElD,QAAS,mCACfmD,GAAIrD,EAAsB,GAC1BsD,GAAItD,EAAsB,GAC1BuD,GAAIvD,EAAsB,GAC1BwD,GAAIxD,EAAsB,GAC1ByD,GAAIzD,EAAsB,GAC1B0D,GAAI,CAAExD,QAAS,uBASNyD,EAAoCC,IAC7C,MAAMC,EAAkC,CACpClD,WAAY,CACRmD,MAAO,CAAC,QACRC,SAAU1D,GACCD,EAAmBC,EAAKuD,EAASC,GAE5CjD,aAAcoD,IAGtB,OAAOH,GAGLI,EAA6B,CAC/BH,MAAO,CAAC,QACRC,SAAUG,IAAUxD,EAAQwD,IAAS,KACrCtD,aAAcoD,GAGZG,EAA6C,CAC/CL,MAAO,CAAC,QACRC,SAAUG,GAASE,EAAwBF,GAC3CtD,aAAcyD,GAGLC,EAA6BC,IACtC,MAAMC,EAAyC,CAC3C7D,WAAY,CACRmD,MAAO,CAAC,QACRC,SAAU,CAAC1D,EAAKoE,KACZ,MAAMb,EAAUa,EAAQC,MAAMC,KAAKf,QACnC,OAAOxD,EAAmBC,EAAKuD,EAASY,IAE5C5D,aAAcoD,GAElBY,OAAQ,CACJX,EACAE,GAEJU,kBAAmB,CACf,CACId,SAAU,CAACG,EAAOO,SACUA,EAAAA,EAAxB,MAAMK,EAA+B,QAAbL,EAAAA,EAAQC,iBAARD,GAAmB,QAAnBA,EAAAA,EAAeE,gBAAfF,OAAAA,EAAAA,EAAqBb,QAE7C,OADmBkB,GAAmBP,EAAeQ,wBAAwBD,EAAiB,uBACxEpE,EAAQwD,IAAS,MAE3CJ,MAAO,CAAC,QACRlD,aAAcoD,GAElBG,GAEJa,KAAM,CACFf,EACAE,GAEJc,QAAShB,GAEb,OAAOO"}
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 JP: { pattern: /^\\d{3}-?\\d{4}$/ },\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: [ruleIsEmpty, ruleValidateForSpecialChars],\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: [ruleIsEmpty, ruleValidateForSpecialChars],\n default: ruleIsEmpty\n };\n return addressValidationRules;\n};\n"],"names":["createPatternByDigits","digits","pattern","RegExp","validatePostalCode","val","countryCode","validatorRules","countrySpecificFormatters","postalCodePatterns","isEmpty","postalCode","errorMessage","translationKey","ERROR_INVALID_FORMAT_EXPECTS","translationObject","values","format","test","AT","AU","BE","BG","BR","CA","CH","CY","CZ","DE","DK","EE","ES","FI","FR","GB","GE","GR","HR","HU","IE","IS","IT","JP","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,KASOE,EAKJC,EAZhB,GAAIC,EAAQL,GAAM,OAAO,KA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ElD,QAAS,wBACfmD,GAAI,CAAEnD,QAAS,mCACfoD,GAAItD,EAAsB,GAC1BuD,GAAIvD,EAAsB,GAC1BwD,GAAIxD,EAAsB,GAC1ByD,GAAIzD,EAAsB,GAC1B0D,GAAI1D,EAAsB,GAC1B2D,GAAI,CAAEzD,QAAS,uBASN0D,EAAoCC,IAC7C,MAAMC,EAAkC,CACpCnD,WAAY,CACRoD,MAAO,CAAC,QACRC,SAAU3D,GACCD,EAAmBC,EAAKwD,EAASC,GAE5ClD,aAAcqD,IAGtB,OAAOH,GAGLI,EAA6B,CAC/BH,MAAO,CAAC,QACRC,SAAUG,IAAUzD,EAAQyD,IAAS,KACrCvD,aAAcqD,GAGZG,EAA6C,CAC/CL,MAAO,CAAC,QACRC,SAAUG,GAASE,EAAwBF,GAC3CvD,aAAc0D,GAGLC,EAA6BC,IACtC,MAAMC,EAAyC,CAC3C9D,WAAY,CACRoD,MAAO,CAAC,QACRC,SAAU,CAAC3D,EAAKqE,KACZ,MAAMb,EAAUa,EAAQC,MAAMC,KAAKf,QACnC,OAAOzD,EAAmBC,EAAKwD,EAASY,IAE5C7D,aAAcqD,GAElBY,OAAQ,CAACX,EAAaE,GACtBU,kBAAmB,CACf,CACId,SAAU,CAACG,EAAOO,SACUA,EAAAA,EAAxB,MAAMK,EAA+B,QAAbL,EAAAA,EAAQC,iBAARD,GAAmB,QAAnBA,EAAAA,EAAeE,gBAAfF,OAAAA,EAAAA,EAAqBb,QAE7C,OADmBkB,GAAmBP,EAAeQ,wBAAwBD,EAAiB,uBACxErE,EAAQyD,IAAS,MAE3CJ,MAAO,CAAC,QACRnD,aAAcqD,GAElBG,GAEJa,KAAM,CAACf,EAAaE,GACpBc,QAAShB,GAEb,OAAOO"}
@@ -1,2 +1,2 @@
1
- import{render as t}from"../../../external/preact/dist/preact.js";import e from"../../../utils/uuid.js";import o from"../../../core/Errors/AdyenCheckoutError.js";import{NO_CHECKOUT_ATTEMPT_ID as r}from"../../../core/Analytics/constants.js";import{on as n,off as s}from"../../../utils/listenerUtils.js";import{createSdkData as i}from"../../../utils/createSdkData.js";import a from"../../components-name-map.js";import{PAYMENT_METHOD_BEHAVIOR as c}from"../../../core/config.js";function u(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function p(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter(function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable}))),r.forEach(function(e){u(t,e,o[e])})}return t}function h(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e.push.apply(e,o)}return e}(Object(e)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))}),t}class d{buildElementProps(t){this.props=this.formatProps(p({},this.constructor.defaultProps,t))}formatProps(t){return t}formatData(){return{}}submitAnalytics(t){return null}handleKeyDown(t){return null}setState(t){this.state=p({},this.state,t)}get data(){var t,e;const o=this.state.order||this.props.order,n=this.formatData(),s=Boolean(a(null===(e=n.paymentMethod)||void 0===e?void 0:e.type)),u=this.core.modules.risk.data,d=null!==(t=this.core.modules.analytics.checkoutAttemptId)&&void 0!==t?t:r,m=s?c.NATIVE:c.GENERIC,l=i(d,u,m);return n.paymentMethod&&d&&(n.paymentMethod.checkoutAttemptId=d),n.paymentMethod&&l&&(n.paymentMethod.sdkData=l),h(p({},u&&{riskData:{clientData:u}},o&&{order:{orderData:o.orderData,pspReference:o.pspReference}},n),{clientStateDataIndicator:!0})}activate(){}render(){throw new Error("Payment method cannot be rendered.")}mount(e){const o="string"==typeof e?document.querySelector(e):e;if(!o)throw new Error("Component could not mount. Root node was not found.");return this._node&&this.unmount(),this._node=o,n(this._node,"keydown",this.handleKeyDown,!1),this._component=this.render(),t(this._component,o),this}update(t){return this.props=this.formatProps(p({},this.props,t)),this.state={},this.unmount().mount(this._node)}unmount(){return s(this._node,"keydown",this.handleKeyDown),this._node&&t(null,this._node),this}remove(){this.unmount(),this.core&&this.core.remove(this)}constructor(t,r){u(this,"_id",`${this.constructor.type}-${e()}`),u(this,"core",void 0),u(this,"props",void 0),u(this,"state",{}),u(this,"_component",void 0),u(this,"_node",null);const n=function(t){return!!t&&("function"==typeof t.initialize&&"function"==typeof t.createFromAction)}(t);if(!n)throw new o("IMPLEMENTATION_ERROR",`Trying to initialise the component '${this.constructor.type}' without a reference to an instance of AdyenCheckout`);this.core=t,this.buildElementProps(r),this.handleKeyDown=this.handleKeyDown.bind(this)}}u(d,"defaultProps",{});export{d as default};
1
+ import{render as t}from"../../../external/preact/dist/preact.js";import e from"../../../utils/uuid.js";import o from"../../../core/Errors/AdyenCheckoutError.js";import{NO_CHECKOUT_ATTEMPT_ID as r}from"../../../core/Analytics/constants.js";import{on as n,off as s}from"../../../utils/listenerUtils.js";import{createSdkData as i}from"../../../utils/createSdkData.js";import a from"../../components-name-map.js";import{PAYMENT_METHOD_BEHAVIOR as c}from"../../../core/config.js";function u(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function p(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter(function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable}))),r.forEach(function(e){u(t,e,o[e])})}return t}function h(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e.push.apply(e,o)}return e}(Object(e)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))}),t}class d{buildElementProps(t){this.props=this.formatProps(p({},this.constructor.defaultProps,t))}formatProps(t){return t}formatData(){return{}}submitAnalytics(t){return null}handleKeyDown(t){return null}setState(t){this.state=p({},this.state,t)}get data(){var t,e;const o=this.state.order||this.props.order,n=this.formatData(),s=Boolean(a(null===(e=n.paymentMethod)||void 0===e?void 0:e.type)),u=this.core.modules.risk.riskData,d=null!==(t=this.core.modules.analytics.checkoutAttemptId)&&void 0!==t?t:r,m=s?c.NATIVE:c.GENERIC,l=i(d,u,m);return n.paymentMethod&&d&&(n.paymentMethod.checkoutAttemptId=d),n.paymentMethod&&l&&(n.paymentMethod.sdkData=l),h(p({},u&&{riskData:{clientData:u}},o&&{order:{orderData:o.orderData,pspReference:o.pspReference}},n),{clientStateDataIndicator:!0})}activate(){}render(){throw new Error("Payment method cannot be rendered.")}mount(e){const o="string"==typeof e?document.querySelector(e):e;if(!o)throw new Error("Component could not mount. Root node was not found.");return this._node&&this.unmount(),this._node=o,n(this._node,"keydown",this.handleKeyDown,!1),this._component=this.render(),t(this._component,o),this}update(t){return this.props=this.formatProps(p({},this.props,t)),this.state={},this.unmount().mount(this._node)}unmount(){return s(this._node,"keydown",this.handleKeyDown),this._node&&t(null,this._node),this}remove(){this.unmount(),this.core&&this.core.remove(this)}constructor(t,r){u(this,"_id",`${this.constructor.type}-${e()}`),u(this,"core",void 0),u(this,"props",void 0),u(this,"state",{}),u(this,"_component",void 0),u(this,"_node",null);const n=function(t){return!!t&&("function"==typeof t.initialize&&"function"==typeof t.createFromAction)}(t);if(!n)throw new o("IMPLEMENTATION_ERROR",`Trying to initialise the component '${this.constructor.type}' without a reference to an instance of AdyenCheckout`);this.core=t,this.buildElementProps(r),this.handleKeyDown=this.handleKeyDown.bind(this)}}u(d,"defaultProps",{});export{d as default};
2
2
  //# sourceMappingURL=BaseElement.js.map