@adyen/adyen-web 6.47.0-alpha.eada81f → 6.47.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 (492) hide show
  1. package/dist/cjs/adyen.css +20 -22
  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 +122 -581
  6. package/dist/es/adyen.css +20 -22
  7. package/dist/es/adyen.css.map +1 -1
  8. package/dist/es/components/AmazonPay/AmazonPay.js +1 -1
  9. package/dist/es/components/AmazonPay/AmazonPay.js.map +1 -1
  10. package/dist/es/components/AmazonPay/components/AmazonPayButton.js +1 -1
  11. package/dist/es/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
  12. package/dist/es/components/AmazonPay/components/AmazonPayComponent.js +1 -1
  13. package/dist/es/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
  14. package/dist/es/components/AmazonPay/components/OrderButton.js +1 -1
  15. package/dist/es/components/AmazonPay/components/OrderButton.js.map +1 -1
  16. package/dist/es/components/AmazonPay/components/SignOutButton.js +1 -1
  17. package/dist/es/components/AmazonPay/components/SignOutButton.js.map +1 -1
  18. package/dist/es/components/AmazonPay/utils.js +1 -1
  19. package/dist/es/components/AmazonPay/utils.js.map +1 -1
  20. package/dist/es/components/ApplePay/services/ApplePaySdkLoader.js.map +1 -1
  21. package/dist/es/components/Card/components/CardInput/components/Installments/Installments.js +1 -1
  22. package/dist/es/components/Card/components/CardInput/components/Installments/Installments.js.map +1 -1
  23. package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
  24. package/dist/es/components/CashAppPay/CashAppPay.js +1 -1
  25. package/dist/es/components/CashAppPay/CashAppPay.js.map +1 -1
  26. package/dist/es/components/CashAppPay/components/CashAppComponent.js +1 -1
  27. package/dist/es/components/CashAppPay/components/CashAppComponent.js.map +1 -1
  28. package/dist/es/components/CashAppPay/services/CashAppService.js +1 -1
  29. package/dist/es/components/CashAppPay/services/CashAppService.js.map +1 -1
  30. package/dist/es/components/CashAppPay/services/types.js.map +1 -1
  31. package/dist/es/components/CustomCard/CustomCard.js +1 -1
  32. package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
  33. package/dist/es/components/Donation/components/DonationComponent.js.map +1 -1
  34. package/dist/es/components/Donation/components/FixedAmounts.js.map +1 -1
  35. package/dist/es/components/Dragonpay/components/DragonpayVoucherResult/DragonpayVoucherResult.js +1 -1
  36. package/dist/es/components/Dragonpay/components/DragonpayVoucherResult/DragonpayVoucherResult.js.map +1 -1
  37. package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
  38. package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js.map +1 -1
  39. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  40. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  41. package/dist/es/components/Giftcard/Giftcard.js +1 -1
  42. package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
  43. package/dist/es/components/Giftcard/components/GiftcardComponent.js +1 -1
  44. package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  45. package/dist/es/components/Giftcard/types.js +2 -0
  46. package/dist/es/components/Giftcard/types.js.map +1 -0
  47. package/dist/es/components/Giftcard/utils.js +2 -0
  48. package/dist/es/components/Giftcard/utils.js.map +1 -0
  49. package/dist/es/components/GooglePay/GooglePay.js.map +1 -1
  50. package/dist/es/components/PayByBankPix/PayByBankPix.js +1 -1
  51. package/dist/es/components/PayByBankPix/PayByBankPix.js.map +1 -1
  52. package/dist/es/components/PayByBankPix/components/Enrollment/useIssuerWithLogo.js +1 -1
  53. package/dist/es/components/PayByBankPix/components/Enrollment/useIssuerWithLogo.js.map +1 -1
  54. package/dist/es/components/PayByBankUS/PayByBankUS.js +1 -1
  55. package/dist/es/components/PayByBankUS/PayByBankUS.js.map +1 -1
  56. package/dist/es/components/PayPal/Paypal.js +1 -1
  57. package/dist/es/components/PayPal/Paypal.js.map +1 -1
  58. package/dist/es/components/PayPal/components/PaypalButtons.js +1 -1
  59. package/dist/es/components/PayPal/components/PaypalButtons.js.map +1 -1
  60. package/dist/es/components/PayPal/components/PaypalComponent.js +1 -1
  61. package/dist/es/components/PayPal/components/PaypalComponent.js.map +1 -1
  62. package/dist/es/components/PayPal/config.js +1 -1
  63. package/dist/es/components/PayPal/config.js.map +1 -1
  64. package/dist/es/components/PayPal/utils/get-paypal-locale.js +1 -1
  65. package/dist/es/components/PayPal/utils/get-paypal-locale.js.map +1 -1
  66. package/dist/es/components/PayPal/utils/get-paypal-settings.js +1 -1
  67. package/dist/es/components/PayPal/utils/get-paypal-settings.js.map +1 -1
  68. package/dist/es/components/PayPal/utils/get-paypal-url.js +1 -1
  69. package/dist/es/components/PayPal/utils/get-paypal-url.js.map +1 -1
  70. package/dist/es/components/PayPalFastlane/Fastlane.js +1 -1
  71. package/dist/es/components/PayPalFastlane/Fastlane.js.map +1 -1
  72. package/dist/es/components/PayPalFastlane/FastlaneSDK.js +1 -1
  73. package/dist/es/components/PayPalFastlane/FastlaneSDK.js.map +1 -1
  74. package/dist/es/components/ThreeDS2/ThreeDS2Challenge.js +1 -1
  75. package/dist/es/components/ThreeDS2/ThreeDS2Challenge.js.map +1 -1
  76. package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js +1 -1
  77. package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  78. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  79. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  80. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.js.map +1 -1
  81. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js +1 -1
  82. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
  83. package/dist/es/components/ThreeDS2/components/Form/ThreeDS2Form.js +1 -1
  84. package/dist/es/components/ThreeDS2/components/Form/ThreeDS2Form.js.map +1 -1
  85. package/dist/es/components/ThreeDS2/components/utils.js +1 -1
  86. package/dist/es/components/ThreeDS2/components/utils.js.map +1 -1
  87. package/dist/es/components/components-name-map.js +1 -1
  88. package/dist/es/components/components-name-map.js.map +1 -1
  89. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
  90. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  91. package/dist/es/components/index.js +1 -1
  92. package/dist/es/components/internal/Address/Address.js +1 -1
  93. package/dist/es/components/internal/Address/Address.js.map +1 -1
  94. package/dist/es/components/internal/Address/Specifications.js +1 -1
  95. package/dist/es/components/internal/Address/Specifications.js.map +1 -1
  96. package/dist/es/components/internal/Address/components/AddressSearch.js +1 -1
  97. package/dist/es/components/internal/Address/components/AddressSearch.js.map +1 -1
  98. package/dist/es/components/internal/Address/components/CountryField.js +1 -1
  99. package/dist/es/components/internal/Address/components/CountryField.js.map +1 -1
  100. package/dist/es/components/internal/Address/components/FieldContainer.js +1 -1
  101. package/dist/es/components/internal/Address/components/FieldContainer.js.map +1 -1
  102. package/dist/es/components/internal/Address/components/StateField.js +1 -1
  103. package/dist/es/components/internal/Address/components/StateField.js.map +1 -1
  104. package/dist/es/components/internal/Address/constants.js.map +1 -1
  105. package/dist/es/components/internal/Address/utils.js.map +1 -1
  106. package/dist/es/components/internal/Address/validate.formats.js +1 -1
  107. package/dist/es/components/internal/Address/validate.formats.js.map +1 -1
  108. package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
  109. package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
  110. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js +1 -1
  111. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js.map +1 -1
  112. package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.js +1 -1
  113. package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.js.map +1 -1
  114. package/dist/es/components/internal/CompanyDetails/CompanyDetails.js +1 -1
  115. package/dist/es/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
  116. package/dist/es/components/internal/CompanyDetails/validate.js +1 -1
  117. package/dist/es/components/internal/CompanyDetails/validate.js.map +1 -1
  118. package/dist/es/components/internal/ConsentCheckboxLabel/ConsentCheckboxLabel.js.map +1 -1
  119. package/dist/es/components/internal/FormFields/Field/Field.js +1 -1
  120. package/dist/es/components/internal/FormFields/Field/Field.js.map +1 -1
  121. package/dist/es/components/internal/FormFields/InputBase.js +1 -1
  122. package/dist/es/components/internal/FormFields/InputBase.js.map +1 -1
  123. package/dist/es/components/internal/FormFields/InputDate/InputDate.js +1 -1
  124. package/dist/es/components/internal/FormFields/InputDate/InputDate.js.map +1 -1
  125. package/dist/es/components/internal/FormFields/InputDate/utils.js.map +1 -1
  126. package/dist/es/components/internal/FormFields/Select/Select.js +1 -1
  127. package/dist/es/components/internal/FormFields/Select/Select.js.map +1 -1
  128. package/dist/es/components/internal/FormFields/Select/components/SelectButton.js +1 -1
  129. package/dist/es/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
  130. package/dist/es/components/internal/IbanInput/IbanInput.js +1 -1
  131. package/dist/es/components/internal/IbanInput/IbanInput.js.map +1 -1
  132. package/dist/es/components/internal/IbanInput/specifications.js.map +1 -1
  133. package/dist/es/components/internal/IbanInput/utils.js +1 -1
  134. package/dist/es/components/internal/IbanInput/utils.js.map +1 -1
  135. package/dist/es/components/internal/PayButton/utils.js.map +1 -1
  136. package/dist/es/components/internal/PersonalDetails/PersonalDetails.js +1 -1
  137. package/dist/es/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
  138. package/dist/es/components/internal/PersonalDetails/validate.js +1 -1
  139. package/dist/es/components/internal/PersonalDetails/validate.js.map +1 -1
  140. package/dist/es/components/internal/PhoneInput/PhoneInputFields.js +1 -1
  141. package/dist/es/components/internal/PhoneInput/PhoneInputFields.js.map +1 -1
  142. package/dist/es/components/internal/PhoneInput/PhoneInputForm.js +1 -1
  143. package/dist/es/components/internal/PhoneInput/PhoneInputForm.js.map +1 -1
  144. package/dist/es/components/internal/QRLoader/QRLoader.js.map +1 -1
  145. package/dist/es/components/internal/SecuredFields/lib/securedField/utils/processAriaConfig.js +1 -1
  146. package/dist/es/components/internal/SecuredFields/lib/securedField/utils/processAriaConfig.js.map +1 -1
  147. package/dist/es/components/internal/UIElement/UIElement.js +1 -1
  148. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  149. package/dist/es/components/internal/UIElement/utils.js.map +1 -1
  150. package/dist/es/components/tx-variants.js +1 -1
  151. package/dist/es/components/tx-variants.js.map +1 -1
  152. package/dist/es/core/Services/http.js.map +1 -1
  153. package/dist/es/core/config.js +1 -1
  154. package/dist/es/core/config.js.map +1 -1
  155. package/dist/es/core/core.js +1 -1
  156. package/dist/es/core/core.js.map +1 -1
  157. package/dist/es/core/utils.js +1 -1
  158. package/dist/es/core/utils.js.map +1 -1
  159. package/dist/es/hooks/usePaymentStatusTimer/usePaymentStatusTimer.js +1 -1
  160. package/dist/es/hooks/usePaymentStatusTimer/usePaymentStatusTimer.js.map +1 -1
  161. package/dist/es/index.d.ts +122 -581
  162. package/dist/es/index.js +1 -1
  163. package/dist/es/language/Language.js +1 -1
  164. package/dist/es/language/Language.js.map +1 -1
  165. package/dist/es/language/utils.js +1 -1
  166. package/dist/es/language/utils.js.map +1 -1
  167. package/dist/es/utils/Script.js.map +1 -1
  168. package/dist/es/utils/Validator/ValidationRuleResult.js.map +1 -1
  169. package/dist/es/utils/Validator/Validator.js +1 -1
  170. package/dist/es/utils/Validator/Validator.js.map +1 -1
  171. package/dist/es/utils/Validator/defaultRules.js +1 -1
  172. package/dist/es/utils/Validator/defaultRules.js.map +1 -1
  173. package/dist/es/utils/amount-util.js +1 -1
  174. package/dist/es/utils/amount-util.js.map +1 -1
  175. package/dist/es/utils/browserInfo.js.map +1 -1
  176. package/dist/es/utils/createSdkData.js +1 -1
  177. package/dist/es/utils/createSdkData.js.map +1 -1
  178. package/dist/es/utils/get-issuer-image.js +1 -1
  179. package/dist/es/utils/get-issuer-image.js.map +1 -1
  180. package/dist/es/utils/get-process-message-handler.js.map +1 -1
  181. package/dist/es/utils/getConsentUrl.js +1 -1
  182. package/dist/es/utils/getConsentUrl.js.map +1 -1
  183. package/dist/es/utils/getErrorMessage.js.map +1 -1
  184. package/dist/es/utils/getOrigin.js.map +1 -1
  185. package/dist/es/utils/isValidURL.js +1 -1
  186. package/dist/es/utils/isValidURL.js.map +1 -1
  187. package/dist/es/utils/promiseTimeout.js.map +1 -1
  188. package/dist/es/utils/useAutoFocus.js.map +1 -1
  189. package/dist/es/utils/validator-utils.js +1 -1
  190. package/dist/es/utils/validator-utils.js.map +1 -1
  191. package/dist/es-legacy/adyen.css +20 -22
  192. package/dist/es-legacy/adyen.css.map +1 -1
  193. package/dist/es-legacy/components/AmazonPay/AmazonPay.js +1 -1
  194. package/dist/es-legacy/components/AmazonPay/AmazonPay.js.map +1 -1
  195. package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js +1 -1
  196. package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
  197. package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js +1 -1
  198. package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
  199. package/dist/es-legacy/components/AmazonPay/components/OrderButton.js +1 -1
  200. package/dist/es-legacy/components/AmazonPay/components/OrderButton.js.map +1 -1
  201. package/dist/es-legacy/components/AmazonPay/components/SignOutButton.js +1 -1
  202. package/dist/es-legacy/components/AmazonPay/components/SignOutButton.js.map +1 -1
  203. package/dist/es-legacy/components/AmazonPay/utils.js +1 -1
  204. package/dist/es-legacy/components/AmazonPay/utils.js.map +1 -1
  205. package/dist/es-legacy/components/ApplePay/services/ApplePaySdkLoader.js.map +1 -1
  206. package/dist/es-legacy/components/Card/components/CardInput/components/Installments/Installments.js +1 -1
  207. package/dist/es-legacy/components/Card/components/CardInput/components/Installments/Installments.js.map +1 -1
  208. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  209. package/dist/es-legacy/components/CashAppPay/CashAppPay.js +1 -1
  210. package/dist/es-legacy/components/CashAppPay/CashAppPay.js.map +1 -1
  211. package/dist/es-legacy/components/CashAppPay/components/CashAppComponent.js +1 -1
  212. package/dist/es-legacy/components/CashAppPay/components/CashAppComponent.js.map +1 -1
  213. package/dist/es-legacy/components/CashAppPay/services/CashAppService.js +1 -1
  214. package/dist/es-legacy/components/CashAppPay/services/CashAppService.js.map +1 -1
  215. package/dist/es-legacy/components/CashAppPay/services/types.js.map +1 -1
  216. package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
  217. package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
  218. package/dist/es-legacy/components/Donation/components/DonationComponent.js.map +1 -1
  219. package/dist/es-legacy/components/Donation/components/FixedAmounts.js.map +1 -1
  220. package/dist/es-legacy/components/Dragonpay/components/DragonpayVoucherResult/DragonpayVoucherResult.js +1 -1
  221. package/dist/es-legacy/components/Dragonpay/components/DragonpayVoucherResult/DragonpayVoucherResult.js.map +1 -1
  222. package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
  223. package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js.map +1 -1
  224. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  225. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  226. package/dist/es-legacy/components/Giftcard/Giftcard.js +1 -1
  227. package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
  228. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js +1 -1
  229. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  230. package/dist/es-legacy/components/Giftcard/types.js +2 -0
  231. package/dist/es-legacy/components/Giftcard/types.js.map +1 -0
  232. package/dist/es-legacy/components/Giftcard/utils.js +2 -0
  233. package/dist/es-legacy/components/Giftcard/utils.js.map +1 -0
  234. package/dist/es-legacy/components/GooglePay/GooglePay.js.map +1 -1
  235. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js +1 -1
  236. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js.map +1 -1
  237. package/dist/es-legacy/components/PayByBankPix/components/Enrollment/useIssuerWithLogo.js +1 -1
  238. package/dist/es-legacy/components/PayByBankPix/components/Enrollment/useIssuerWithLogo.js.map +1 -1
  239. package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js +1 -1
  240. package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js.map +1 -1
  241. package/dist/es-legacy/components/PayPal/Paypal.js +1 -1
  242. package/dist/es-legacy/components/PayPal/Paypal.js.map +1 -1
  243. package/dist/es-legacy/components/PayPal/components/PaypalButtons.js +1 -1
  244. package/dist/es-legacy/components/PayPal/components/PaypalButtons.js.map +1 -1
  245. package/dist/es-legacy/components/PayPal/components/PaypalComponent.js +1 -1
  246. package/dist/es-legacy/components/PayPal/components/PaypalComponent.js.map +1 -1
  247. package/dist/es-legacy/components/PayPal/config.js +1 -1
  248. package/dist/es-legacy/components/PayPal/config.js.map +1 -1
  249. package/dist/es-legacy/components/PayPal/utils/get-paypal-locale.js +1 -1
  250. package/dist/es-legacy/components/PayPal/utils/get-paypal-locale.js.map +1 -1
  251. package/dist/es-legacy/components/PayPal/utils/get-paypal-settings.js +1 -1
  252. package/dist/es-legacy/components/PayPal/utils/get-paypal-settings.js.map +1 -1
  253. package/dist/es-legacy/components/PayPal/utils/get-paypal-url.js +1 -1
  254. package/dist/es-legacy/components/PayPal/utils/get-paypal-url.js.map +1 -1
  255. package/dist/es-legacy/components/PayPalFastlane/Fastlane.js +1 -1
  256. package/dist/es-legacy/components/PayPalFastlane/Fastlane.js.map +1 -1
  257. package/dist/es-legacy/components/PayPalFastlane/FastlaneSDK.js +1 -1
  258. package/dist/es-legacy/components/PayPalFastlane/FastlaneSDK.js.map +1 -1
  259. package/dist/es-legacy/components/ThreeDS2/ThreeDS2Challenge.js +1 -1
  260. package/dist/es-legacy/components/ThreeDS2/ThreeDS2Challenge.js.map +1 -1
  261. package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js +1 -1
  262. package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  263. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  264. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  265. package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.js.map +1 -1
  266. package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js +1 -1
  267. package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
  268. package/dist/es-legacy/components/ThreeDS2/components/Form/ThreeDS2Form.js +1 -1
  269. package/dist/es-legacy/components/ThreeDS2/components/Form/ThreeDS2Form.js.map +1 -1
  270. package/dist/es-legacy/components/ThreeDS2/components/utils.js +1 -1
  271. package/dist/es-legacy/components/ThreeDS2/components/utils.js.map +1 -1
  272. package/dist/es-legacy/components/components-name-map.js +1 -1
  273. package/dist/es-legacy/components/components-name-map.js.map +1 -1
  274. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
  275. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  276. package/dist/es-legacy/components/index.js +1 -1
  277. package/dist/es-legacy/components/internal/Address/Address.js +1 -1
  278. package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
  279. package/dist/es-legacy/components/internal/Address/Specifications.js +1 -1
  280. package/dist/es-legacy/components/internal/Address/Specifications.js.map +1 -1
  281. package/dist/es-legacy/components/internal/Address/components/AddressSearch.js +1 -1
  282. package/dist/es-legacy/components/internal/Address/components/AddressSearch.js.map +1 -1
  283. package/dist/es-legacy/components/internal/Address/components/CountryField.js +1 -1
  284. package/dist/es-legacy/components/internal/Address/components/CountryField.js.map +1 -1
  285. package/dist/es-legacy/components/internal/Address/components/FieldContainer.js +1 -1
  286. package/dist/es-legacy/components/internal/Address/components/FieldContainer.js.map +1 -1
  287. package/dist/es-legacy/components/internal/Address/components/StateField.js +1 -1
  288. package/dist/es-legacy/components/internal/Address/components/StateField.js.map +1 -1
  289. package/dist/es-legacy/components/internal/Address/constants.js.map +1 -1
  290. package/dist/es-legacy/components/internal/Address/utils.js.map +1 -1
  291. package/dist/es-legacy/components/internal/Address/validate.formats.js +1 -1
  292. package/dist/es-legacy/components/internal/Address/validate.formats.js.map +1 -1
  293. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
  294. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
  295. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js +1 -1
  296. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js.map +1 -1
  297. package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.js +1 -1
  298. package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.js.map +1 -1
  299. package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js +1 -1
  300. package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
  301. package/dist/es-legacy/components/internal/CompanyDetails/validate.js +1 -1
  302. package/dist/es-legacy/components/internal/CompanyDetails/validate.js.map +1 -1
  303. package/dist/es-legacy/components/internal/ConsentCheckboxLabel/ConsentCheckboxLabel.js.map +1 -1
  304. package/dist/es-legacy/components/internal/FormFields/Field/Field.js +1 -1
  305. package/dist/es-legacy/components/internal/FormFields/Field/Field.js.map +1 -1
  306. package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
  307. package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
  308. package/dist/es-legacy/components/internal/FormFields/InputDate/InputDate.js +1 -1
  309. package/dist/es-legacy/components/internal/FormFields/InputDate/InputDate.js.map +1 -1
  310. package/dist/es-legacy/components/internal/FormFields/InputDate/utils.js.map +1 -1
  311. package/dist/es-legacy/components/internal/FormFields/Select/Select.js +1 -1
  312. package/dist/es-legacy/components/internal/FormFields/Select/Select.js.map +1 -1
  313. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js +1 -1
  314. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
  315. package/dist/es-legacy/components/internal/IbanInput/IbanInput.js +1 -1
  316. package/dist/es-legacy/components/internal/IbanInput/IbanInput.js.map +1 -1
  317. package/dist/es-legacy/components/internal/IbanInput/specifications.js.map +1 -1
  318. package/dist/es-legacy/components/internal/IbanInput/utils.js +1 -1
  319. package/dist/es-legacy/components/internal/IbanInput/utils.js.map +1 -1
  320. package/dist/es-legacy/components/internal/PayButton/utils.js.map +1 -1
  321. package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js +1 -1
  322. package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
  323. package/dist/es-legacy/components/internal/PersonalDetails/validate.js +1 -1
  324. package/dist/es-legacy/components/internal/PersonalDetails/validate.js.map +1 -1
  325. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputFields.js +1 -1
  326. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputFields.js.map +1 -1
  327. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js +1 -1
  328. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js.map +1 -1
  329. package/dist/es-legacy/components/internal/QRLoader/QRLoader.js.map +1 -1
  330. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/utils/processAriaConfig.js +1 -1
  331. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/utils/processAriaConfig.js.map +1 -1
  332. package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
  333. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  334. package/dist/es-legacy/components/internal/UIElement/utils.js.map +1 -1
  335. package/dist/es-legacy/components/tx-variants.js +1 -1
  336. package/dist/es-legacy/components/tx-variants.js.map +1 -1
  337. package/dist/es-legacy/core/Services/http.js.map +1 -1
  338. package/dist/es-legacy/core/config.js +1 -1
  339. package/dist/es-legacy/core/config.js.map +1 -1
  340. package/dist/es-legacy/core/core.js +1 -1
  341. package/dist/es-legacy/core/core.js.map +1 -1
  342. package/dist/es-legacy/core/utils.js +1 -1
  343. package/dist/es-legacy/core/utils.js.map +1 -1
  344. package/dist/es-legacy/hooks/usePaymentStatusTimer/usePaymentStatusTimer.js +1 -1
  345. package/dist/es-legacy/hooks/usePaymentStatusTimer/usePaymentStatusTimer.js.map +1 -1
  346. package/dist/es-legacy/index.js +1 -1
  347. package/dist/es-legacy/language/Language.js +1 -1
  348. package/dist/es-legacy/language/Language.js.map +1 -1
  349. package/dist/es-legacy/language/utils.js +1 -1
  350. package/dist/es-legacy/language/utils.js.map +1 -1
  351. package/dist/es-legacy/utils/Script.js.map +1 -1
  352. package/dist/es-legacy/utils/Validator/ValidationRuleResult.js.map +1 -1
  353. package/dist/es-legacy/utils/Validator/Validator.js +1 -1
  354. package/dist/es-legacy/utils/Validator/Validator.js.map +1 -1
  355. package/dist/es-legacy/utils/Validator/defaultRules.js +1 -1
  356. package/dist/es-legacy/utils/Validator/defaultRules.js.map +1 -1
  357. package/dist/es-legacy/utils/amount-util.js +1 -1
  358. package/dist/es-legacy/utils/amount-util.js.map +1 -1
  359. package/dist/es-legacy/utils/browserInfo.js.map +1 -1
  360. package/dist/es-legacy/utils/createSdkData.js +1 -1
  361. package/dist/es-legacy/utils/createSdkData.js.map +1 -1
  362. package/dist/es-legacy/utils/get-issuer-image.js +1 -1
  363. package/dist/es-legacy/utils/get-issuer-image.js.map +1 -1
  364. package/dist/es-legacy/utils/get-process-message-handler.js.map +1 -1
  365. package/dist/es-legacy/utils/getConsentUrl.js +1 -1
  366. package/dist/es-legacy/utils/getConsentUrl.js.map +1 -1
  367. package/dist/es-legacy/utils/getErrorMessage.js.map +1 -1
  368. package/dist/es-legacy/utils/getOrigin.js.map +1 -1
  369. package/dist/es-legacy/utils/isValidURL.js +1 -1
  370. package/dist/es-legacy/utils/isValidURL.js.map +1 -1
  371. package/dist/es-legacy/utils/promiseTimeout.js.map +1 -1
  372. package/dist/es-legacy/utils/useAutoFocus.js.map +1 -1
  373. package/dist/es-legacy/utils/validator-utils.js +1 -1
  374. package/dist/es-legacy/utils/validator-utils.js.map +1 -1
  375. package/package.json +25 -24
  376. package/styles/adyen.css +20 -22
  377. package/dist/es/components/PayPal/PayPalCredit.js +0 -2
  378. package/dist/es/components/PayPal/PayPalCredit.js.map +0 -1
  379. package/dist/es/components/PayPal/PayPalPaylater.js +0 -2
  380. package/dist/es/components/PayPal/PayPalPaylater.js.map +0 -1
  381. package/dist/es/components/PayPal/Venmo.js +0 -2
  382. package/dist/es/components/PayPal/Venmo.js.map +0 -1
  383. package/dist/es/components/PayPal/components/PayPalButton.js +0 -2
  384. package/dist/es/components/PayPal/components/PayPalButton.js.map +0 -1
  385. package/dist/es/components/PayPal/components/PayPalComponentV6.js +0 -2
  386. package/dist/es/components/PayPal/components/PayPalComponentV6.js.map +0 -1
  387. package/dist/es/components/PayPal/components/PayPalComponentV6.module.scss.js +0 -2
  388. package/dist/es/components/PayPal/components/PayPalComponentV6.module.scss.js.map +0 -1
  389. package/dist/es/components/PayPal/components/PayPalCreditButton.js +0 -2
  390. package/dist/es/components/PayPal/components/PayPalCreditButton.js.map +0 -1
  391. package/dist/es/components/PayPal/components/PayPalCreditComponent.js +0 -2
  392. package/dist/es/components/PayPal/components/PayPalCreditComponent.js.map +0 -1
  393. package/dist/es/components/PayPal/components/PayPalMessaging.js +0 -2
  394. package/dist/es/components/PayPal/components/PayPalMessaging.js.map +0 -1
  395. package/dist/es/components/PayPal/components/PayPalPayLaterButton.js +0 -2
  396. package/dist/es/components/PayPal/components/PayPalPayLaterButton.js.map +0 -1
  397. package/dist/es/components/PayPal/components/PayPalPaylaterComponent.js +0 -2
  398. package/dist/es/components/PayPal/components/PayPalPaylaterComponent.js.map +0 -1
  399. package/dist/es/components/PayPal/components/PayPalPaylaterComponent.module.scss.js +0 -2
  400. package/dist/es/components/PayPal/components/PayPalPaylaterComponent.module.scss.js.map +0 -1
  401. package/dist/es/components/PayPal/components/PayPalProcessingSpinner.js +0 -2
  402. package/dist/es/components/PayPal/components/PayPalProcessingSpinner.js.map +0 -1
  403. package/dist/es/components/PayPal/components/PayPalSpinner.js +0 -2
  404. package/dist/es/components/PayPal/components/PayPalSpinner.js.map +0 -1
  405. package/dist/es/components/PayPal/components/VenmoButton.js +0 -2
  406. package/dist/es/components/PayPal/components/VenmoButton.js.map +0 -1
  407. package/dist/es/components/PayPal/components/VenmoComponent.js +0 -2
  408. package/dist/es/components/PayPal/components/VenmoComponent.js.map +0 -1
  409. package/dist/es/components/PayPal/hooks/usePayPalButtonEligibility.js +0 -2
  410. package/dist/es/components/PayPal/hooks/usePayPalButtonEligibility.js.map +0 -1
  411. package/dist/es/components/PayPal/hooks/usePayPalOneTimeSession.js +0 -2
  412. package/dist/es/components/PayPal/hooks/usePayPalOneTimeSession.js.map +0 -1
  413. package/dist/es/components/PayPal/hooks/usePayPalSaveSession.js +0 -2
  414. package/dist/es/components/PayPal/hooks/usePayPalSaveSession.js.map +0 -1
  415. package/dist/es/components/PayPal/hooks/usePayPalSessionOptions.js +0 -2
  416. package/dist/es/components/PayPal/hooks/usePayPalSessionOptions.js.map +0 -1
  417. package/dist/es/components/PayPal/hooks/usePayPalStatus.js +0 -2
  418. package/dist/es/components/PayPal/hooks/usePayPalStatus.js.map +0 -1
  419. package/dist/es/components/PayPal/hooks/useStartPayPalSession.js +0 -2
  420. package/dist/es/components/PayPal/hooks/useStartPayPalSession.js.map +0 -1
  421. package/dist/es/components/PayPal/models/BasePayPalElement.js +0 -2
  422. package/dist/es/components/PayPal/models/BasePayPalElement.js.map +0 -1
  423. package/dist/es/components/PayPal/services/PayPalSdkLoader.js +0 -2
  424. package/dist/es/components/PayPal/services/PayPalSdkLoader.js.map +0 -1
  425. package/dist/es/components/PayPal/services/PayPalService.js +0 -2
  426. package/dist/es/components/PayPal/services/PayPalService.js.map +0 -1
  427. package/dist/es/components/PayPal/services/request-paypal-oauth-token.js +0 -2
  428. package/dist/es/components/PayPal/services/request-paypal-oauth-token.js.map +0 -1
  429. package/dist/es/components/PayPal/services/request-paypal-order-details.js +0 -2
  430. package/dist/es/components/PayPal/services/request-paypal-order-details.js.map +0 -1
  431. package/dist/es/components/PayPal/utils/is-paypal-service-config-equal.js +0 -2
  432. package/dist/es/components/PayPal/utils/is-paypal-service-config-equal.js.map +0 -1
  433. package/dist/es/utils/is-live-environment.js +0 -2
  434. package/dist/es/utils/is-live-environment.js.map +0 -1
  435. package/dist/es-legacy/components/PayPal/PayPalCredit.js +0 -2
  436. package/dist/es-legacy/components/PayPal/PayPalCredit.js.map +0 -1
  437. package/dist/es-legacy/components/PayPal/PayPalPaylater.js +0 -2
  438. package/dist/es-legacy/components/PayPal/PayPalPaylater.js.map +0 -1
  439. package/dist/es-legacy/components/PayPal/Venmo.js +0 -2
  440. package/dist/es-legacy/components/PayPal/Venmo.js.map +0 -1
  441. package/dist/es-legacy/components/PayPal/components/PayPalButton.js +0 -2
  442. package/dist/es-legacy/components/PayPal/components/PayPalButton.js.map +0 -1
  443. package/dist/es-legacy/components/PayPal/components/PayPalComponentV6.js +0 -2
  444. package/dist/es-legacy/components/PayPal/components/PayPalComponentV6.js.map +0 -1
  445. package/dist/es-legacy/components/PayPal/components/PayPalComponentV6.module.scss.js +0 -2
  446. package/dist/es-legacy/components/PayPal/components/PayPalComponentV6.module.scss.js.map +0 -1
  447. package/dist/es-legacy/components/PayPal/components/PayPalCreditButton.js +0 -2
  448. package/dist/es-legacy/components/PayPal/components/PayPalCreditButton.js.map +0 -1
  449. package/dist/es-legacy/components/PayPal/components/PayPalCreditComponent.js +0 -2
  450. package/dist/es-legacy/components/PayPal/components/PayPalCreditComponent.js.map +0 -1
  451. package/dist/es-legacy/components/PayPal/components/PayPalMessaging.js +0 -2
  452. package/dist/es-legacy/components/PayPal/components/PayPalMessaging.js.map +0 -1
  453. package/dist/es-legacy/components/PayPal/components/PayPalPayLaterButton.js +0 -2
  454. package/dist/es-legacy/components/PayPal/components/PayPalPayLaterButton.js.map +0 -1
  455. package/dist/es-legacy/components/PayPal/components/PayPalPaylaterComponent.js +0 -2
  456. package/dist/es-legacy/components/PayPal/components/PayPalPaylaterComponent.js.map +0 -1
  457. package/dist/es-legacy/components/PayPal/components/PayPalPaylaterComponent.module.scss.js +0 -2
  458. package/dist/es-legacy/components/PayPal/components/PayPalPaylaterComponent.module.scss.js.map +0 -1
  459. package/dist/es-legacy/components/PayPal/components/PayPalProcessingSpinner.js +0 -2
  460. package/dist/es-legacy/components/PayPal/components/PayPalProcessingSpinner.js.map +0 -1
  461. package/dist/es-legacy/components/PayPal/components/PayPalSpinner.js +0 -2
  462. package/dist/es-legacy/components/PayPal/components/PayPalSpinner.js.map +0 -1
  463. package/dist/es-legacy/components/PayPal/components/VenmoButton.js +0 -2
  464. package/dist/es-legacy/components/PayPal/components/VenmoButton.js.map +0 -1
  465. package/dist/es-legacy/components/PayPal/components/VenmoComponent.js +0 -2
  466. package/dist/es-legacy/components/PayPal/components/VenmoComponent.js.map +0 -1
  467. package/dist/es-legacy/components/PayPal/hooks/usePayPalButtonEligibility.js +0 -2
  468. package/dist/es-legacy/components/PayPal/hooks/usePayPalButtonEligibility.js.map +0 -1
  469. package/dist/es-legacy/components/PayPal/hooks/usePayPalOneTimeSession.js +0 -2
  470. package/dist/es-legacy/components/PayPal/hooks/usePayPalOneTimeSession.js.map +0 -1
  471. package/dist/es-legacy/components/PayPal/hooks/usePayPalSaveSession.js +0 -2
  472. package/dist/es-legacy/components/PayPal/hooks/usePayPalSaveSession.js.map +0 -1
  473. package/dist/es-legacy/components/PayPal/hooks/usePayPalSessionOptions.js +0 -2
  474. package/dist/es-legacy/components/PayPal/hooks/usePayPalSessionOptions.js.map +0 -1
  475. package/dist/es-legacy/components/PayPal/hooks/usePayPalStatus.js +0 -2
  476. package/dist/es-legacy/components/PayPal/hooks/usePayPalStatus.js.map +0 -1
  477. package/dist/es-legacy/components/PayPal/hooks/useStartPayPalSession.js +0 -2
  478. package/dist/es-legacy/components/PayPal/hooks/useStartPayPalSession.js.map +0 -1
  479. package/dist/es-legacy/components/PayPal/models/BasePayPalElement.js +0 -2
  480. package/dist/es-legacy/components/PayPal/models/BasePayPalElement.js.map +0 -1
  481. package/dist/es-legacy/components/PayPal/services/PayPalSdkLoader.js +0 -2
  482. package/dist/es-legacy/components/PayPal/services/PayPalSdkLoader.js.map +0 -1
  483. package/dist/es-legacy/components/PayPal/services/PayPalService.js +0 -2
  484. package/dist/es-legacy/components/PayPal/services/PayPalService.js.map +0 -1
  485. package/dist/es-legacy/components/PayPal/services/request-paypal-oauth-token.js +0 -2
  486. package/dist/es-legacy/components/PayPal/services/request-paypal-oauth-token.js.map +0 -1
  487. package/dist/es-legacy/components/PayPal/services/request-paypal-order-details.js +0 -2
  488. package/dist/es-legacy/components/PayPal/services/request-paypal-order-details.js.map +0 -1
  489. package/dist/es-legacy/components/PayPal/utils/is-paypal-service-config-equal.js +0 -2
  490. package/dist/es-legacy/components/PayPal/utils/is-paypal-service-config-equal.js.map +0 -1
  491. package/dist/es-legacy/utils/is-live-environment.js +0 -2
  492. package/dist/es-legacy/utils/is-live-environment.js.map +0 -1
package/dist/es/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import*as o from"./components/index.js";export{o as components};export{default as initializeFastlane}from"./components/PayPalFastlane/initializeFastlane.js";export{AdyenCheckout}from"./core/AdyenCheckout.js";export{ANCVElement as ANCV}from"./components/ANCV/ANCV.js";export{AchElement as Ach}from"./components/Ach/Ach.js";export{AddressElement as Address}from"./components/Address/Address.js";export{AmazonPayElement as AmazonPay}from"./components/AmazonPay/AmazonPay.js";export{default as ApplePay}from"./components/ApplePay/ApplePay.js";export{default as BacsDirectDebit}from"./components/BacsDD/BacsDD.js";export{default as Bancontact}from"./components/Card/Bancontact.js";export{BankTransferElement as BankTransfer}from"./components/BankTransfer/BankTransfer.js";export{default as BcmcMobile}from"./components/BcmcMobile/BcmcMobile.js";export{default as BillDeskOnline}from"./components/BillDesk/BillDeskOnline.js";export{default as BillDeskWallet}from"./components/BillDesk/BillDeskWallet.js";export{default as Blik}from"./components/Blik/Blik.js";export{BoletoElement as Boleto}from"./components/Boleto/Boleto.js";export{CardElement as Card}from"./components/Card/Card.js";export{CashAppPay}from"./components/CashAppPay/CashAppPay.js";export{ClickToPayElement as ClickToPay}from"./components/ClickToPay/ClickToPay.js";export{default as Core}from"./core/core.js";export{CustomCard}from"./components/CustomCard/CustomCard.js";export{DokuElement as Doku}from"./components/Doku/Doku.js";export{default as Donation}from"./components/Donation/Donation.js";export{default as Dotpay}from"./components/Dotpay/index.js";export{DragonpayElement as Dragonpay}from"./components/Dragonpay/Dragonpay.js";export{default as Dropin}from"./components/Dropin/Dropin.js";export{default as DuitNow}from"./components/DuitNow/DuitNow.js";export{default as EPS}from"./components/EPS/index.js";export{EcontextElement as Econtext}from"./components/Econtext/Econtext.js";export{default as Fastlane}from"./components/PayPalFastlane/Fastlane.js";export{GiftcardElement as Giftcard}from"./components/Giftcard/Giftcard.js";export{default as Giropay}from"./components/Giropay/Giropay.js";export{default as GooglePay}from"./components/GooglePay/GooglePay.js";export{Iris}from"./components/Iris/Iris.js";export{default as Klarna}from"./components/Klarna/KlarnaPayments.js";export{MBWayElement as MBWay}from"./components/MBWay/MBWay.js";export{MealVoucherFRElement as MealVoucherFR}from"./components/MealVoucherFR/MealVoucherFR.js";export{default as MolPayEBankingMY}from"./components/MolPayEBanking/MolPayEBankingMY.js";export{default as MolPayEBankingTH}from"./components/MolPayEBanking/MolPayEBankingTH.js";export{default as MolPayEBankingVN}from"./components/MolPayEBanking/MolPayEBankingVN.js";export{MultibancoElement as Multibanco}from"./components/Multibanco/Multibanco.js";export{default as OnlineBankingCZ}from"./components/OnlineBankingCZ/index.js";export{default as OnlineBankingFI}from"./components/OnlineBankingFI/OnlineBankingFI.js";export{default as OnlineBankingIN}from"./components/OnlineBankingIN/index.js";export{default as OnlineBankingPL}from"./components/OnlineBankingPL/OnlineBankingPL.js";export{default as OnlineBankingSK}from"./components/OnlineBankingSK/index.js";export{OxxoElement as Oxxo}from"./components/Oxxo/Oxxo.js";export{default as PayByBank}from"./components/PayByBank/PayByBank.js";export{default as PayByBankPix}from"./components/PayByBankPix/PayByBankPix.js";export{default as PayMe}from"./components/PayMe/PayMe.js";export{default as PayNow}from"./components/PayNow/PayNow.js";export{default as PayPal}from"./components/PayPal/Paypal.js";export{default as PayPalCredit}from"./components/PayPal/PayPalCredit.js";export{default as PayPalPayLater}from"./components/PayPal/PayPalPaylater.js";export{PayToElement as PayTo}from"./components/PayTo/PayTo.js";export{default as PayuCashcard}from"./components/PayU/PayuCashcard.js";export{default as PayuNetBanking}from"./components/PayU/PayuNetBanking.js";export{PersonalDetailsElement as PersonalDetails}from"./components/PersonalDetails/PersonalDetails.js";export{default as Pix}from"./components/Pix/Pix.js";export{PreAuthorizedDebitCanada}from"./components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js";export{default as PromptPay}from"./components/PromptPay/PromptPay.js";export{default as Redirect}from"./components/Redirect/Redirect.js";export{default as Riverty}from"./components/Riverty/Riverty.js";export{default as SepaDirectDebit}from"./components/Sepa/Sepa.js";export{default as Swish}from"./components/Swish/Swish.js";export{default as ThreeDS2Challenge}from"./components/ThreeDS2/ThreeDS2Challenge.js";export{default as ThreeDS2DeviceFingerprint}from"./components/ThreeDS2/ThreeDS2DeviceFingerprint.js";export{default as Trustly}from"./components/Trustly/Trustly.js";export{default as Twint}from"./components/Twint/Twint.js";export{default as UPI}from"./components/UPI/UPI.js";export{default as Venmo}from"./components/PayPal/Venmo.js";export{default as Vipps}from"./components/Vipps/Vipps.js";export{default as WalletIN}from"./components/WalletIN/index.js";export{default as WeChat}from"./components/WeChat/WeChat.js";export{default as Affirm}from"./components/Affirm/Affirm.js";export{default as AfterPay}from"./components/AfterPay/AfterPay.js";export{default as AfterPayB2B}from"./components/AfterPay/AfterPayB2B.js";export{default as Atome}from"./components/Atome/Atome.js";export{default as FacilPay10x}from"./components/FacilyPay/FacilyPay10x.js";export{default as FacilPay12x}from"./components/FacilyPay/FacilyPay12x.js";export{default as FacilPay3x}from"./components/FacilyPay/FacilyPay3x.js";export{default as FacilPay4x}from"./components/FacilyPay/FacilyPay4x.js";export{default as FacilPay6x}from"./components/FacilyPay/FacilyPay6x.js";export{default as PayByBankUS}from"./components/PayByBankUS/PayByBankUS.js";export{default as RatePay}from"./components/RatePay/RatePay.js";export{default as RatePayDirectDebit}from"./components/RatePay/RatePayDirectDebit.js";
1
+ import*as o from"./components/index.js";export{o as components};export{default as initializeFastlane}from"./components/PayPalFastlane/initializeFastlane.js";export{AdyenCheckout}from"./core/AdyenCheckout.js";export{ANCVElement as ANCV}from"./components/ANCV/ANCV.js";export{AchElement as Ach}from"./components/Ach/Ach.js";export{AddressElement as Address}from"./components/Address/Address.js";export{AmazonPayElement as AmazonPay}from"./components/AmazonPay/AmazonPay.js";export{default as ApplePay}from"./components/ApplePay/ApplePay.js";export{default as BacsDirectDebit}from"./components/BacsDD/BacsDD.js";export{default as Bancontact}from"./components/Card/Bancontact.js";export{BankTransferElement as BankTransfer}from"./components/BankTransfer/BankTransfer.js";export{default as BcmcMobile}from"./components/BcmcMobile/BcmcMobile.js";export{default as BillDeskOnline}from"./components/BillDesk/BillDeskOnline.js";export{default as BillDeskWallet}from"./components/BillDesk/BillDeskWallet.js";export{default as Blik}from"./components/Blik/Blik.js";export{BoletoElement as Boleto}from"./components/Boleto/Boleto.js";export{CardElement as Card}from"./components/Card/Card.js";export{CashAppPay}from"./components/CashAppPay/CashAppPay.js";export{ClickToPayElement as ClickToPay}from"./components/ClickToPay/ClickToPay.js";export{default as Core}from"./core/core.js";export{CustomCard}from"./components/CustomCard/CustomCard.js";export{DokuElement as Doku}from"./components/Doku/Doku.js";export{default as Donation}from"./components/Donation/Donation.js";export{default as Dotpay}from"./components/Dotpay/index.js";export{DragonpayElement as Dragonpay}from"./components/Dragonpay/Dragonpay.js";export{default as Dropin}from"./components/Dropin/Dropin.js";export{default as DuitNow}from"./components/DuitNow/DuitNow.js";export{default as EPS}from"./components/EPS/index.js";export{EcontextElement as Econtext}from"./components/Econtext/Econtext.js";export{default as Fastlane}from"./components/PayPalFastlane/Fastlane.js";export{GiftcardElement as Giftcard}from"./components/Giftcard/Giftcard.js";export{default as Giropay}from"./components/Giropay/Giropay.js";export{default as GooglePay}from"./components/GooglePay/GooglePay.js";export{Iris}from"./components/Iris/Iris.js";export{default as Klarna}from"./components/Klarna/KlarnaPayments.js";export{MBWayElement as MBWay}from"./components/MBWay/MBWay.js";export{MealVoucherFRElement as MealVoucherFR}from"./components/MealVoucherFR/MealVoucherFR.js";export{default as MolPayEBankingMY}from"./components/MolPayEBanking/MolPayEBankingMY.js";export{default as MolPayEBankingTH}from"./components/MolPayEBanking/MolPayEBankingTH.js";export{default as MolPayEBankingVN}from"./components/MolPayEBanking/MolPayEBankingVN.js";export{MultibancoElement as Multibanco}from"./components/Multibanco/Multibanco.js";export{default as OnlineBankingCZ}from"./components/OnlineBankingCZ/index.js";export{default as OnlineBankingFI}from"./components/OnlineBankingFI/OnlineBankingFI.js";export{default as OnlineBankingIN}from"./components/OnlineBankingIN/index.js";export{default as OnlineBankingPL}from"./components/OnlineBankingPL/OnlineBankingPL.js";export{default as OnlineBankingSK}from"./components/OnlineBankingSK/index.js";export{OxxoElement as Oxxo}from"./components/Oxxo/Oxxo.js";export{default as PayByBank}from"./components/PayByBank/PayByBank.js";export{default as PayByBankPix}from"./components/PayByBankPix/PayByBankPix.js";export{default as PayMe}from"./components/PayMe/PayMe.js";export{default as PayNow}from"./components/PayNow/PayNow.js";export{default as PayPal}from"./components/PayPal/Paypal.js";export{PayToElement as PayTo}from"./components/PayTo/PayTo.js";export{default as PayuCashcard}from"./components/PayU/PayuCashcard.js";export{default as PayuNetBanking}from"./components/PayU/PayuNetBanking.js";export{PersonalDetailsElement as PersonalDetails}from"./components/PersonalDetails/PersonalDetails.js";export{default as Pix}from"./components/Pix/Pix.js";export{PreAuthorizedDebitCanada}from"./components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js";export{default as PromptPay}from"./components/PromptPay/PromptPay.js";export{default as Redirect}from"./components/Redirect/Redirect.js";export{default as Riverty}from"./components/Riverty/Riverty.js";export{default as SepaDirectDebit}from"./components/Sepa/Sepa.js";export{default as Swish}from"./components/Swish/Swish.js";export{default as ThreeDS2Challenge}from"./components/ThreeDS2/ThreeDS2Challenge.js";export{default as ThreeDS2DeviceFingerprint}from"./components/ThreeDS2/ThreeDS2DeviceFingerprint.js";export{default as Trustly}from"./components/Trustly/Trustly.js";export{default as Twint}from"./components/Twint/Twint.js";export{default as UPI}from"./components/UPI/UPI.js";export{default as Vipps}from"./components/Vipps/Vipps.js";export{default as WalletIN}from"./components/WalletIN/index.js";export{default as WeChat}from"./components/WeChat/WeChat.js";export{default as Affirm}from"./components/Affirm/Affirm.js";export{default as AfterPay}from"./components/AfterPay/AfterPay.js";export{default as AfterPayB2B}from"./components/AfterPay/AfterPayB2B.js";export{default as Atome}from"./components/Atome/Atome.js";export{default as FacilPay10x}from"./components/FacilyPay/FacilyPay10x.js";export{default as FacilPay12x}from"./components/FacilyPay/FacilyPay12x.js";export{default as FacilPay3x}from"./components/FacilyPay/FacilyPay3x.js";export{default as FacilPay4x}from"./components/FacilyPay/FacilyPay4x.js";export{default as FacilPay6x}from"./components/FacilyPay/FacilyPay6x.js";export{default as PayByBankUS}from"./components/PayByBankUS/PayByBankUS.js";export{default as RatePay}from"./components/RatePay/RatePay.js";export{default as RatePayDirectDebit}from"./components/RatePay/RatePayDirectDebit.js";
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- import{getTranslation as t,formatCustomTranslations as s,parseLocale as e}from"./utils.js";import{getLocalisedAmount as i}from"../utils/amount-util.js";import{CDN_SUPPORTED_LOCALES as o,DEFAULT_LOCALE as a}from"./constants.js";import r from"../packages/server/translations/en-US.json.js";function n(t,s,e){return s in t?Object.defineProperty(t,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[s]=e,t}class l{async requestTranslations(){const t=await this.service.fetchTranslationsFromCdn(this.locale);this._translations={...r,...t,...Boolean(this.customTranslations[this.locale])&&this.customTranslations[this.locale]}}get translations(){return this._translations}get(s,e){const i=t(this._translations,s,e);return null!==i?i:s}amount(t,s,e){return i(t,this.locale,s,e)}date(t,s={}){if(void 0===t)return"";const e={year:"numeric",month:"2-digit",day:"2-digit",...s};return new Date(t).toLocaleDateString(this.locale,e)}dateTime(t){return void 0===t?"":this.timeAndDateFormatter.format(new Date(t))}createSupportedLocalesList(t){if(!t)return o;const s=new Set([...o,...Object.keys(t)]);return Array.from(s).sort((t,s)=>t.localeCompare(s))}constructor(t){n(this,"locale",void 0),n(this,"languageCode",void 0),n(this,"service",void 0),n(this,"customTranslations",void 0),n(this,"supportedLocales",void 0),n(this,"_translations",{}),n(this,"timeFormatOptions",{hour:"numeric",minute:"numeric"}),n(this,"timeAndDateFormatOptions",{year:"numeric",month:"2-digit",day:"2-digit",...this.timeFormatOptions}),n(this,"timeAndDateFormatter",void 0);const{locale:i,customTranslations:o,service:r}=t;this.service=r,this.customTranslations=s(o),this.supportedLocales=this.createSupportedLocalesList(this.customTranslations),this.locale=e(i||a,this.supportedLocales),this.languageCode=this.locale.split("-")[0],this.timeAndDateFormatter=Intl.DateTimeFormat(this.locale,this.timeAndDateFormatOptions)}}export{l as Language,l as default};
1
+ import{getTranslation as t,formatCustomTranslations as s,parseLocale as i,resolveFormattingLocale as a}from"./utils.js";import{getLocalisedAmount as o}from"../utils/amount-util.js";import{CDN_SUPPORTED_LOCALES as e,DEFAULT_LOCALE as n}from"./constants.js";import r from"../packages/server/translations/en-US.json.js";function l(t,s,i){return s in t?Object.defineProperty(t,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[s]=i,t}class c{get locale(){return this._formattingLocale}get translationsLocale(){return this._translationsLocale}async requestTranslations(){const t=await this.service.fetchTranslationsFromCdn(this._translationsLocale);this._translations={...r,...t,...Boolean(this.customTranslations[this._translationsLocale])&&this.customTranslations[this._translationsLocale]}}get translations(){return this._translations}get(s,i){const a=t(this._translations,s,i);return null!==a?a:s}amount(t,s,i){return o(t,this._formattingLocale,s,i)}date(t,s={}){if(void 0===t)return"";const i={year:"numeric",month:"2-digit",day:"2-digit",...s};return new Date(t).toLocaleDateString(this._formattingLocale,i)}dateTime(t){return void 0===t?"":this.timeAndDateFormatter.format(new Date(t))}createSupportedLocalesList(t){if(!t)return e;const s=new Set([...e,...Object.keys(t)]);return Array.from(s).sort((t,s)=>t.localeCompare(s))}constructor(t){l(this,"languageCode",void 0),l(this,"service",void 0),l(this,"_formattingLocale",void 0),l(this,"_translationsLocale",void 0),l(this,"customTranslations",void 0),l(this,"supportedLocales",void 0),l(this,"_translations",{}),l(this,"timeFormatOptions",{hour:"numeric",minute:"numeric"}),l(this,"timeAndDateFormatOptions",{year:"numeric",month:"2-digit",day:"2-digit",...this.timeFormatOptions}),l(this,"timeAndDateFormatter",void 0);const{locale:o,customTranslations:e,service:r}=t;this.service=r,this.customTranslations=s(e),this.supportedLocales=this.createSupportedLocalesList(this.customTranslations),this._translationsLocale=i(o||n,this.supportedLocales),this._formattingLocale=a(o||n),this.languageCode=this._translationsLocale.split("-")[0],this.timeAndDateFormatter=Intl.DateTimeFormat(this._formattingLocale,this.timeAndDateFormatOptions)}}export{c as Language,c as default};
2
2
  //# sourceMappingURL=Language.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Language.js","sources":["../../../src/language/Language.ts"],"sourcesContent":["import { formatCustomTranslations, getTranslation, parseLocale } from './utils';\nimport { getLocalisedAmount } from '../utils/amount-util';\nimport { CDN_SUPPORTED_LOCALES, DEFAULT_LOCALE } from './constants';\nimport enUS from '../../../server/translations/en-US.json';\n\nimport type { CustomTranslations, LanguageOptions, Translations } from './types';\nimport type { ILanguageService } from './LanguageService';\n\nexport class Language {\n public readonly locale: string;\n public readonly languageCode: string;\n private readonly service: ILanguageService;\n\n private readonly customTranslations: CustomTranslations;\n\n /**\n * Supported locales list\n * Includes all supported locales from the CDN and any custom locales defined in customTranslations\n */\n private readonly supportedLocales: readonly string[];\n\n /**\n * Translations object\n * Contains all translations for the current locale, including English as fallback\n */\n private _translations: Translations = {};\n\n public readonly timeFormatOptions: Intl.DateTimeFormatOptions = {\n hour: 'numeric',\n minute: 'numeric'\n };\n\n public readonly timeAndDateFormatOptions: Intl.DateTimeFormatOptions = {\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n ...this.timeFormatOptions\n };\n\n public readonly timeAndDateFormatter: Intl.DateTimeFormat;\n\n constructor(props: LanguageOptions) {\n const { locale, customTranslations, service } = props;\n\n this.service = service;\n\n this.customTranslations = formatCustomTranslations(customTranslations);\n this.supportedLocales = this.createSupportedLocalesList(this.customTranslations);\n\n this.locale = parseLocale(locale || DEFAULT_LOCALE, this.supportedLocales);\n this.languageCode = this.locale.split('-')[0];\n\n this.timeAndDateFormatter = Intl.DateTimeFormat(this.locale, this.timeAndDateFormatOptions);\n }\n\n public async requestTranslations(): Promise<void> {\n const translations = await this.service.fetchTranslationsFromCdn(this.locale);\n\n this._translations = {\n ...enUS,\n ...translations,\n ...(Boolean(this.customTranslations[this.locale]) && this.customTranslations[this.locale])\n };\n }\n\n public get translations(): Readonly<Translations> {\n return this._translations;\n }\n\n /**\n * Returns a translated string from a key in the current {@link Language.locale}\n * @param key - Translation key\n * @param options - Translation options\n * @returns Translated string\n */\n public get(key: string, options?): string {\n const translation = getTranslation(this._translations, key, options);\n if (translation !== null) {\n return translation;\n }\n\n return key;\n }\n\n /**\n * Returns a localized string for an amount\n * @param amount - Amount to be converted\n * @param currencyCode - Currency code of the amount\n * @param options - Options for String.prototype.toLocaleString\n */\n public amount(amount: number, currencyCode: string, options?: object): string {\n return getLocalisedAmount(amount, this.locale, currencyCode, options);\n }\n\n /**\n * Returns a localized string for a date\n * @param date - Date to be localized\n * @param options - Options for {@link Intl.DateTimeFormatOptions}\n */\n public date(date: string, options: Intl.DateTimeFormatOptions = {}) {\n if (date === undefined) return '';\n const dateOptions: Intl.DateTimeFormatOptions = { year: 'numeric', month: '2-digit', day: '2-digit', ...options };\n return new Date(date).toLocaleDateString(this.locale, dateOptions);\n }\n\n /**\n * Returns a localized string for a date and time\n * @param date - Date to be localized\n */\n public dateTime(date: string) {\n if (date === undefined) return '';\n return this.timeAndDateFormatter.format(new Date(date));\n }\n\n /**\n * Creates a list of supported locales including the ones passed as custom translations\n *\n * @param customTranslations - Custom translations to include\n * @returns Array of supported locales\n */\n private createSupportedLocalesList(customTranslations?: CustomTranslations): readonly string[] {\n if (!customTranslations) {\n return CDN_SUPPORTED_LOCALES;\n }\n\n const locales = new Set([...CDN_SUPPORTED_LOCALES, ...Object.keys(customTranslations)]);\n return Array.from(locales).sort((a, b) => a.localeCompare(b));\n }\n}\n\nexport default Language;\n"],"names":["Language","requestTranslations","translations","this","service","fetchTranslationsFromCdn","locale","_translations","enUS","Boolean","customTranslations","get","key","options","translation","getTranslation","amount","currencyCode","getLocalisedAmount","date","undefined","dateOptions","year","month","day","Date","toLocaleDateString","dateTime","timeAndDateFormatter","format","createSupportedLocalesList","CDN_SUPPORTED_LOCALES","locales","Set","Object","keys","Array","from","sort","a","b","localeCompare","constructor","props","_define_property","languageCode","supportedLocales","timeFormatOptions","hour","minute","timeAndDateFormatOptions","formatCustomTranslations","parseLocale","DEFAULT_LOCALE","split","Intl","DateTimeFormat"],"mappings":"wZAQO,MAAMA,EA+CT,yBAAaC,GACT,MAAMC,QAAqBC,KAAKC,QAAQC,yBAAyBF,KAAKG,QAEtEH,KAAKI,cAAgB,IACdC,KACAN,KACCO,QAAQN,KAAKO,mBAAmBP,KAAKG,UAAYH,KAAKO,mBAAmBP,KAAKG,QAE1F,CAEA,gBAAWJ,GACP,OAAOC,KAAKI,aAChB,CAQA,GAAAI,CAAWC,EAAaC,GACpB,MAAMC,EAAcC,EAAeZ,KAAKI,cAAeK,EAAKC,GAC5D,OAAoB,OAAhBC,EACOA,EAGJF,CACX,CAQA,MAAAI,CAAcA,EAAgBC,EAAsBJ,GAChD,OAAOK,EAAmBF,EAAQb,KAAKG,OAAQW,EAAcJ,EACjE,CAOA,IAAAM,CAAYA,EAAcN,EAAsC,IAC5D,QAAaO,IAATD,EAAoB,MAAO,GAC/B,MAAME,EAA0C,CAAEC,KAAM,UAAWC,MAAO,UAAWC,IAAK,aAAcX,GACxG,OAAO,IAAIY,KAAKN,GAAMO,mBAAmBvB,KAAKG,OAAQe,EAC1D,CAMOM,QAAAA,CAASR,GACZ,YAAaC,IAATD,EAA2B,GACxBhB,KAAKyB,qBAAqBC,OAAO,IAAIJ,KAAKN,GACrD,CAQQW,0BAAAA,CAA2BpB,GAC/B,IAAKA,EACD,OAAOqB,EAGX,MAAMC,EAAU,IAAIC,IAAI,IAAIF,KAA0BG,OAAOC,KAAKzB,KAClE,OAAO0B,MAAMC,KAAKL,GAASM,KAAK,CAACC,EAAGC,IAAMD,EAAEE,cAAcD,GAC9D,CAtFA,WAAAE,CAAYC,GAhCZC,EAAAzC,KAAgBG,iBAChBsC,EAAAzC,KAAgB0C,uBAChBD,EAAAzC,KAAiBC,kBAEjBwC,EAAAzC,KAAiBO,6BAMjBkC,EAAAzC,KAAiB2C,2BAMjBF,EAAAzC,KAAQI,gBAA8B,IAEtCqC,EAAAzC,KAAgB4C,oBAAgD,CAC5DC,KAAM,UACNC,OAAQ,YAGZL,EAAAzC,KAAgB+C,2BAAuD,CACnE5B,KAAM,UACNC,MAAO,UACPC,IAAK,aACFrB,KAAK4C,oBAGZH,EAAAzC,KAAgByB,+BAGZ,MAAMtB,OAAEA,EAAMI,mBAAEA,EAAkBN,QAAEA,GAAYuC,EAEhDxC,KAAKC,QAAUA,EAEfD,KAAKO,mBAAqByC,EAAyBzC,GACnDP,KAAK2C,iBAAmB3C,KAAK2B,2BAA2B3B,KAAKO,oBAE7DP,KAAKG,OAAS8C,EAAY9C,GAAU+C,EAAgBlD,KAAK2C,kBACzD3C,KAAK0C,aAAe1C,KAAKG,OAAOgD,MAAM,KAAK,GAE3CnD,KAAKyB,qBAAuB2B,KAAKC,eAAerD,KAAKG,OAAQH,KAAK+C,yBACtE"}
1
+ {"version":3,"file":"Language.js","sources":["../../../src/language/Language.ts"],"sourcesContent":["import { formatCustomTranslations, getTranslation, parseLocale, resolveFormattingLocale } from './utils';\nimport { getLocalisedAmount } from '../utils/amount-util';\nimport { CDN_SUPPORTED_LOCALES, DEFAULT_LOCALE } from './constants';\nimport enUS from '../../../server/translations/en-US.json';\n\nimport type { CustomTranslations, LanguageOptions, Translations } from './types';\nimport type { ILanguageService } from './LanguageService';\n\nexport class Language {\n public readonly languageCode: string;\n private readonly service: ILanguageService;\n\n /**\n * Locale used to format amounts and dates, and to be passed on to third-party SDKs\n */\n private readonly _formattingLocale: string;\n\n /**\n * Locale of the translations that are loaded\n */\n private readonly _translationsLocale: string;\n\n private readonly customTranslations: CustomTranslations;\n\n /**\n * Supported locales list\n * Includes all supported locales from the CDN and any custom locales defined in customTranslations\n */\n private readonly supportedLocales: readonly string[];\n\n /**\n * Translations object\n * Contains all translations for the current locale, including English as fallback\n */\n private _translations: Translations = {};\n\n public readonly timeFormatOptions: Intl.DateTimeFormatOptions = {\n hour: 'numeric',\n minute: 'numeric'\n };\n\n public readonly timeAndDateFormatOptions: Intl.DateTimeFormatOptions = {\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n ...this.timeFormatOptions\n };\n\n public readonly timeAndDateFormatter: Intl.DateTimeFormat;\n\n constructor(props: LanguageOptions) {\n const { locale, customTranslations, service } = props;\n\n this.service = service;\n\n this.customTranslations = formatCustomTranslations(customTranslations);\n this.supportedLocales = this.createSupportedLocalesList(this.customTranslations);\n\n this._translationsLocale = parseLocale(locale || DEFAULT_LOCALE, this.supportedLocales);\n this._formattingLocale = resolveFormattingLocale(locale || DEFAULT_LOCALE);\n this.languageCode = this._translationsLocale.split('-')[0];\n\n this.timeAndDateFormatter = Intl.DateTimeFormat(this._formattingLocale, this.timeAndDateFormatOptions);\n }\n\n /**\n * Returns the locale requested by the merchant, in the format Intl accepts.\n * Unlike {@link Language.translationsLocale}, it is not limited to the locales we ship translations for.\n */\n public get locale(): string {\n return this._formattingLocale;\n }\n\n /**\n * Returns the locale of the translations that are loaded.\n * Limited to the locales we ship translations for, so a request for an unsupported one resolves to the closest match.\n */\n public get translationsLocale(): string {\n return this._translationsLocale;\n }\n\n public async requestTranslations(): Promise<void> {\n const translations = await this.service.fetchTranslationsFromCdn(this._translationsLocale);\n\n this._translations = {\n ...enUS,\n ...translations,\n ...(Boolean(this.customTranslations[this._translationsLocale]) && this.customTranslations[this._translationsLocale])\n };\n }\n\n public get translations(): Readonly<Translations> {\n return this._translations;\n }\n\n /**\n * Returns a translated string from a key in the current {@link Language.translationsLocale}\n * @param key - Translation key\n * @param options - Translation options\n * @returns Translated string\n */\n public get(key: string, options?): string {\n const translation = getTranslation(this._translations, key, options);\n if (translation !== null) {\n return translation;\n }\n\n return key;\n }\n\n /**\n * Returns a localized string for an amount\n * @param amount - Amount to be converted\n * @param currencyCode - Currency code of the amount\n * @param options - Options for String.prototype.toLocaleString\n */\n public amount(amount: number, currencyCode: string, options?: object): string {\n return getLocalisedAmount(amount, this._formattingLocale, currencyCode, options);\n }\n\n /**\n * Returns a localized string for a date\n * @param date - Date to be localized\n * @param options - Options for {@link Intl.DateTimeFormatOptions}\n */\n public date(date: string, options: Intl.DateTimeFormatOptions = {}) {\n if (date === undefined) return '';\n const dateOptions: Intl.DateTimeFormatOptions = { year: 'numeric', month: '2-digit', day: '2-digit', ...options };\n return new Date(date).toLocaleDateString(this._formattingLocale, dateOptions);\n }\n\n /**\n * Returns a localized string for a date and time\n * @param date - Date to be localized\n */\n public dateTime(date: string) {\n if (date === undefined) return '';\n return this.timeAndDateFormatter.format(new Date(date));\n }\n\n /**\n * Creates a list of supported locales including the ones passed as custom translations\n *\n * @param customTranslations - Custom translations to include\n * @returns Array of supported locales\n */\n private createSupportedLocalesList(customTranslations?: CustomTranslations): readonly string[] {\n if (!customTranslations) {\n return CDN_SUPPORTED_LOCALES;\n }\n\n const locales = new Set([...CDN_SUPPORTED_LOCALES, ...Object.keys(customTranslations)]);\n return Array.from(locales).sort((a, b) => a.localeCompare(b));\n }\n}\n\nexport default Language;\n"],"names":["Language","locale","this","_formattingLocale","translationsLocale","_translationsLocale","requestTranslations","translations","service","fetchTranslationsFromCdn","_translations","enUS","Boolean","customTranslations","get","key","options","translation","getTranslation","amount","currencyCode","getLocalisedAmount","date","undefined","dateOptions","year","month","day","Date","toLocaleDateString","dateTime","timeAndDateFormatter","format","createSupportedLocalesList","CDN_SUPPORTED_LOCALES","locales","Set","Object","keys","Array","from","sort","a","b","localeCompare","constructor","props","_define_property","languageCode","supportedLocales","timeFormatOptions","hour","minute","timeAndDateFormatOptions","formatCustomTranslations","parseLocale","DEFAULT_LOCALE","resolveFormattingLocale","split","Intl","DateTimeFormat"],"mappings":"qbAQO,MAAMA,EA6DT,UAAWC,GACP,OAAOC,KAAKC,iBAChB,CAMA,sBAAWC,GACP,OAAOF,KAAKG,mBAChB,CAEA,yBAAaC,GACT,MAAMC,QAAqBL,KAAKM,QAAQC,yBAAyBP,KAAKG,qBAEtEH,KAAKQ,cAAgB,IACdC,KACAJ,KACCK,QAAQV,KAAKW,mBAAmBX,KAAKG,uBAAyBH,KAAKW,mBAAmBX,KAAKG,qBAEvG,CAEA,gBAAWE,GACP,OAAOL,KAAKQ,aAChB,CAQA,GAAAI,CAAWC,EAAaC,GACpB,MAAMC,EAAcC,EAAehB,KAAKQ,cAAeK,EAAKC,GAC5D,OAAoB,OAAhBC,EACOA,EAGJF,CACX,CAQA,MAAAI,CAAcA,EAAgBC,EAAsBJ,GAChD,OAAOK,EAAmBF,EAAQjB,KAAKC,kBAAmBiB,EAAcJ,EAC5E,CAOA,IAAAM,CAAYA,EAAcN,EAAsC,IAC5D,QAAaO,IAATD,EAAoB,MAAO,GAC/B,MAAME,EAA0C,CAAEC,KAAM,UAAWC,MAAO,UAAWC,IAAK,aAAcX,GACxG,OAAO,IAAIY,KAAKN,GAAMO,mBAAmB3B,KAAKC,kBAAmBqB,EACrE,CAMOM,QAAAA,CAASR,GACZ,YAAaC,IAATD,EAA2B,GACxBpB,KAAK6B,qBAAqBC,OAAO,IAAIJ,KAAKN,GACrD,CAQQW,0BAAAA,CAA2BpB,GAC/B,IAAKA,EACD,OAAOqB,EAGX,MAAMC,EAAU,IAAIC,IAAI,IAAIF,KAA0BG,OAAOC,KAAKzB,KAClE,OAAO0B,MAAMC,KAAKL,GAASM,KAAK,CAACC,EAAGC,IAAMD,EAAEE,cAAcD,GAC9D,CAvGA,WAAAE,CAAYC,GAzCZC,EAAA7C,KAAgB8C,uBAChBD,EAAA7C,KAAiBM,kBAKjBuC,EAAA7C,KAAiBC,4BAKjB4C,EAAA7C,KAAiBG,8BAEjB0C,EAAA7C,KAAiBW,6BAMjBkC,EAAA7C,KAAiB+C,2BAMjBF,EAAA7C,KAAQQ,gBAA8B,IAEtCqC,EAAA7C,KAAgBgD,oBAAgD,CAC5DC,KAAM,UACNC,OAAQ,YAGZL,EAAA7C,KAAgBmD,2BAAuD,CACnE5B,KAAM,UACNC,MAAO,UACPC,IAAK,aACFzB,KAAKgD,oBAGZH,EAAA7C,KAAgB6B,+BAGZ,MAAM9B,OAAEA,EAAMY,mBAAEA,EAAkBL,QAAEA,GAAYsC,EAEhD5C,KAAKM,QAAUA,EAEfN,KAAKW,mBAAqByC,EAAyBzC,GACnDX,KAAK+C,iBAAmB/C,KAAK+B,2BAA2B/B,KAAKW,oBAE7DX,KAAKG,oBAAsBkD,EAAYtD,GAAUuD,EAAgBtD,KAAK+C,kBACtE/C,KAAKC,kBAAoBsD,EAAwBxD,GAAUuD,GAC3DtD,KAAK8C,aAAe9C,KAAKG,oBAAoBqD,MAAM,KAAK,GAExDxD,KAAK6B,qBAAuB4B,KAAKC,eAAe1D,KAAKC,kBAAmBD,KAAKmD,yBACjF"}
@@ -1,2 +1,2 @@
1
- import{DEFAULT_LOCALE as t,LOCALE_NAME_MIN_LENGTH as n,LOCALE_NAME_MAX_LENGTH as e}from"./constants.js";const r=t=>t.toLowerCase().substring(0,2),o=t=>Boolean(t)&&t.length>=n&&t.length<=e;function s(t,n){if(!t||"string"!=typeof t)return null;const e=t.toLowerCase(),o=n.find(t=>t.toLowerCase()===e);if(o)return o;const s=r(t);return n.find(t=>r(t)===s)||null}function l(t){const n=t.replace("_","-");if(/^([a-z]{2})(-)([A-Z]{2})$/.test(n))return n;const[e,r]=n.split("-");if(!e||!r)return null;const o=[e.toLowerCase(),r.toUpperCase()].join("-");return 5===o.length?o:null}function u(n,e){if(!o(n))return t;const r=l(n);return r&&e.includes(r)?r:s(r||n,e)||t}function c(t={}){return Object.keys(t).reduce((n,e)=>{if(!o(e))return n;return n[l(e)||r(e)]=t[e],n},{})}const i=(t,n)=>t.replace(/%{(\w+)}/g,(t,e)=>n[e]||""),a=(t,n,e={})=>{const{values:r={},count:o=0}=e,s=`${n}__plural`,l=t=>`${n}__${t}`;return Object.prototype.hasOwnProperty.call(t,l(o))?i(t[l(o)],r):Object.prototype.hasOwnProperty.call(t,s)&&o>1?i(t[s],r):Object.prototype.hasOwnProperty.call(t,n)?i(t[n],r):null},p=(t,n)=>{const e=t.split(/%#(.*?)%#/gm);if(n.length!==Math.floor(e.length/2))throw Error("The number of functions provided does not match the number of elements in the translation string.");return e.map((t,e)=>{const r=Math.floor(e/2);return e%2==0?t:n[r](t)})};export{c as formatCustomTranslations,l as formatLocaleToLanguageCountryLocale,a as getTranslation,p as interpolateElement,s as matchLocale,u as parseLocale};
1
+ import{DEFAULT_LOCALE as t,LOCALE_NAME_MIN_LENGTH as n,LOCALE_NAME_MAX_LENGTH as r}from"./constants.js";const e=t=>t.toLowerCase().substring(0,2),o=t=>Boolean(t)&&t.length>=n&&t.length<=r;function l(t,n){if(!t||"string"!=typeof t)return null;const r=t.toLowerCase(),o=n.find(t=>t.toLowerCase()===r);if(o)return o;const l=e(t);return n.find(t=>e(t)===l)||null}function s(t){const n=t.replace("_","-");if(/^([a-z]{2})(-)([A-Z]{2})$/.test(n))return n;const[r,e]=n.split("-");if(!r||!e)return null;const o=[r.toLowerCase(),e.toUpperCase()].join("-");return 5===o.length?o:null}const u=t=>{try{return Intl.NumberFormat.supportedLocalesOf([t])[0]??null}catch{return null}};function c(n){if("string"!=typeof n)return t;const r=n.replace(/_/g,"-").split("-");for(;r.length;){const t=u(r.join("-"));if(t)return t;r.pop()}return t}function i(n,r){if(!o(n))return t;const e=s(n);return e&&r.includes(e)?e:l(e||n,r)||t}function a(t={}){return Object.keys(t).reduce((n,r)=>{if(!o(r))return n;return n[s(r)||e(r)]=t[r],n},{})}const p=(t,n)=>t.replace(/%{(\w+)}/g,(t,r)=>n[r]||""),f=(t,n,r={})=>{const{values:e={},count:o=0}=r,l=`${n}__plural`,s=t=>`${n}__${t}`;return Object.prototype.hasOwnProperty.call(t,s(o))?p(t[s(o)],e):Object.prototype.hasOwnProperty.call(t,l)&&o>1?p(t[l],e):Object.prototype.hasOwnProperty.call(t,n)?p(t[n],e):null},h=(t,n)=>{const r=t.split(/%#(.*?)%#/gm);if(n.length!==Math.floor(r.length/2))throw Error("The number of functions provided does not match the number of elements in the translation string.");return r.map((t,r)=>{const e=Math.floor(r/2);return r%2==0?t:n[e](t)})};export{a as formatCustomTranslations,s as formatLocaleToLanguageCountryLocale,f as getTranslation,h as interpolateElement,l as matchLocale,i as parseLocale,c as resolveFormattingLocale};
2
2
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../src/language/utils.ts"],"sourcesContent":["import { h } from 'preact';\nimport { CustomTranslations } from './types';\nimport { DEFAULT_LOCALE, LOCALE_NAME_MAX_LENGTH, LOCALE_NAME_MIN_LENGTH } from './constants';\n\n/**\n * @description Convert to ISO 639-1\n */\nconst toTwoLetterCode = (locale: string): string => locale.toLowerCase().substring(0, 2);\n\n/**\n * @description Checks if the locale length is valid\n * @param locale - The locale to check\n * @returns true if the locale length is valid, false otherwise\n */\nconst isLocaleLenghtValid = (locale: string): boolean =>\n Boolean(locale) && locale.length >= LOCALE_NAME_MIN_LENGTH && locale.length <= LOCALE_NAME_MAX_LENGTH;\n\n/**\n * Matches a string with one of the locales\n *\n * @param locale - The locale to match\n * @param supportedLocales - Array of possible locales\n *\n * @example\n * matchLocale('en-GB', ['en-US', 'es-ES']);\n * // returns 'en-US'\n */\nexport function matchLocale(locale: string, supportedLocales: readonly string[]): string | null {\n if (!locale || typeof locale !== 'string') return null;\n\n const lowerLocale = locale.toLowerCase();\n const exactMatch = supportedLocales.find(supLoc => supLoc.toLowerCase() === lowerLocale);\n\n if (exactMatch) return exactMatch;\n\n const localeTwoLetter = toTwoLetterCode(locale);\n return supportedLocales.find(supLoc => toTwoLetterCode(supLoc) === localeTwoLetter) || null;\n}\n\n/**\n * Returns a locale with the proper format.\n *\n * @param localeParam - Locale example: 'En_us' or 'en-US'\n *\n * @example\n * formatLocaleToLanguageCountryLocale('En_us');\n * // returns 'en-US'\n */\nexport function formatLocaleToLanguageCountryLocale(localeParam: string): string | null {\n const locale = localeParam.replace('_', '-');\n const format = /^([a-z]{2})(-)([A-Z]{2})$/;\n\n // If it's already formatted, return the locale\n if (format.test(locale)) return locale;\n\n // Split the string in two\n const [languageCode, countryCode] = locale.split('-');\n\n // If the locale or the country codes are missing, return null\n if (!languageCode || !countryCode) return null;\n\n // Ensure correct format and join the strings back together\n const fullLocale = [languageCode.toLowerCase(), countryCode.toUpperCase()].join('-');\n\n return fullLocale.length === 5 ? fullLocale : null;\n}\n\nexport function parseLocale(locale: string, supportedLocales: readonly string[]): string {\n if (!isLocaleLenghtValid(locale)) return DEFAULT_LOCALE;\n\n const formattedLocale = formatLocaleToLanguageCountryLocale(locale);\n const hasMatch = formattedLocale && supportedLocales.includes(formattedLocale);\n\n if (hasMatch) return formattedLocale;\n\n return matchLocale(formattedLocale || locale, supportedLocales) || DEFAULT_LOCALE;\n}\n\n/**\n * @description Makes sure that if custom translation is defined using not properly formatted locale keys, then it gets formatted correctly\n *\n * @example { en_US: { ... }} will be adjusted to { 'en-US': { ... }} . { ar: { ... }} is kept as is.\n */\nexport function formatCustomTranslations(customTranslations: CustomTranslations = {}): CustomTranslations {\n return Object.keys(customTranslations).reduce<CustomTranslations>((memo, localeKey) => {\n if (!isLocaleLenghtValid(localeKey)) return memo;\n\n const locale = formatLocaleToLanguageCountryLocale(localeKey) || toTwoLetterCode(localeKey);\n memo[locale] = customTranslations[localeKey];\n return memo;\n }, {});\n}\n\nconst replaceTranslationValues = (translation: string, values: Record<string, string>) => {\n return translation.replace(/%{(\\w+)}/g, (_, k) => values[k] || '');\n};\n\n/**\n * Returns a translation string by key\n * @param translations -\n * @param key -\n * @param options -\n *\n * @internal\n */\nexport const getTranslation = (\n translations: Record<string, string>,\n key: string,\n options: { values?: Record<string, string>; count?: number } = {}\n): string | null => {\n const { values = {}, count = 0 } = options;\n const keyPlural = `${key}__plural`;\n const keyForCount = (count: number) => `${key}__${count}`;\n\n if (Object.prototype.hasOwnProperty.call(translations, keyForCount(count))) {\n // Find key__count translation key\n return replaceTranslationValues(translations[keyForCount(count)], values);\n } else if (Object.prototype.hasOwnProperty.call(translations, keyPlural) && count > 1) {\n // Find key__plural translation key, if count greater than 1 (e.g. myTranslation__plural)\n return replaceTranslationValues(translations[keyPlural], values);\n } else if (Object.prototype.hasOwnProperty.call(translations, key)) {\n // Find key translation key (e.g. myTranslation)\n return replaceTranslationValues(translations[key], values);\n }\n\n return null;\n};\n\n/**\n * Injects JSX elements in a middle of a translation and returns a JSX array\n * The input string should use %# as the token to know where to insert the component\n * @param translation - Translation string\n * @param renderFunctions - An array function that renders JSX elements\n */\nexport const interpolateElement = (translation: string, renderFunctions: Array<(translation: string) => h.JSX.Element | string>) => {\n // splits by regex group, it guarantees that it only splits with 2 tokens (%#)\n const matches = translation.split(/%#(.*?)%#/gm);\n\n if (renderFunctions.length !== Math.floor(matches.length / 2)) {\n throw Error('The number of functions provided does not match the number of elements in the translation string.');\n }\n\n // the map will create an array of JSX / string elements, this syntax in accepted in JSX/react to render elements\n return matches.map((term, index) => {\n // math to get the index of the renderFunction that should be used\n // since we split on tokens, that means the index of the render function is half of the index of the string\n const indexInFunctionArray = Math.floor(index / 2);\n return index % 2 === 0 ? term : renderFunctions[indexInFunctionArray](term);\n });\n};\n"],"names":["toTwoLetterCode","locale","toLowerCase","substring","isLocaleLenghtValid","Boolean","length","LOCALE_NAME_MIN_LENGTH","LOCALE_NAME_MAX_LENGTH","matchLocale","supportedLocales","lowerLocale","exactMatch","find","supLoc","localeTwoLetter","formatLocaleToLanguageCountryLocale","localeParam","replace","test","languageCode","countryCode","split","fullLocale","toUpperCase","join","parseLocale","DEFAULT_LOCALE","formattedLocale","includes","formatCustomTranslations","customTranslations","Object","keys","reduce","memo","localeKey","replaceTranslationValues","translation","values","_","k","getTranslation","translations","key","options","count","keyPlural","keyForCount","prototype","hasOwnProperty","call","interpolateElement","renderFunctions","matches","Math","floor","Error","map","term","index","indexInFunctionArray"],"mappings":"wGAOA,MAAMA,EAAmBC,GAA2BA,EAAOC,cAAcC,UAAU,EAAG,GAOhFC,EAAuBH,GACzBI,QAAQJ,IAAWA,EAAOK,QAAUC,GAA0BN,EAAOK,QAAUE,EAY5E,SAASC,EAAYR,EAAgBS,GACxC,IAAKT,GAA4B,iBAAXA,EAAqB,OAAO,KAElD,MAAMU,EAAcV,EAAOC,cACrBU,EAAaF,EAAiBG,KAAKC,GAAUA,EAAOZ,gBAAkBS,GAE5E,GAAIC,EAAY,OAAOA,EAEvB,MAAMG,EAAkBf,EAAgBC,GACxC,OAAOS,EAAiBG,KAAKC,GAAUd,EAAgBc,KAAYC,IAAoB,IAC3F,CAWO,SAASC,EAAoCC,GAChD,MAAMhB,EAASgB,EAAYC,QAAQ,IAAK,KAIxC,GAHe,4BAGJC,KAAKlB,GAAS,OAAOA,EAGhC,MAAOmB,EAAcC,GAAepB,EAAOqB,MAAM,KAGjD,IAAKF,IAAiBC,EAAa,OAAO,KAG1C,MAAME,EAAa,CAACH,EAAalB,cAAemB,EAAYG,eAAeC,KAAK,KAEhF,OAA6B,IAAtBF,EAAWjB,OAAeiB,EAAa,IAClD,CAEO,SAASG,EAAYzB,EAAgBS,GACxC,IAAKN,EAAoBH,GAAS,OAAO0B,EAEzC,MAAMC,EAAkBZ,EAAoCf,GAG5D,OAFiB2B,GAAmBlB,EAAiBmB,SAASD,GAEzCA,EAEdnB,EAAYmB,GAAmB3B,EAAQS,IAAqBiB,CACvE,CAOO,SAASG,EAAyBC,EAAyC,IAC9E,OAAOC,OAAOC,KAAKF,GAAoBG,OAA2B,CAACC,EAAMC,KACrE,IAAKhC,EAAoBgC,GAAY,OAAOD,EAI5C,OADAA,EADenB,EAAoCoB,IAAcpC,EAAgBoC,IAClEL,EAAmBK,GAC3BD,GACR,CAAA,EACP,CAEA,MAAME,EAA2B,CAACC,EAAqBC,IAC5CD,EAAYpB,QAAQ,YAAa,CAACsB,EAAGC,IAAMF,EAAOE,IAAM,IAWtDC,EAAiB,CAC1BC,EACAC,EACAC,EAA+D,CAAA,KAE/D,MAAMN,OAAEA,EAAS,CAAA,EAAEO,MAAEA,EAAQ,GAAMD,EAC7BE,EAAY,GAAGH,YACfI,EAAeF,GAAkB,GAAGF,MAAQE,IAElD,OAAId,OAAOiB,UAAUC,eAAeC,KAAKR,EAAcK,EAAYF,IAExDT,EAAyBM,EAAaK,EAAYF,IAASP,GAC3DP,OAAOiB,UAAUC,eAAeC,KAAKR,EAAcI,IAAcD,EAAQ,EAEzET,EAAyBM,EAAaI,GAAYR,GAClDP,OAAOiB,UAAUC,eAAeC,KAAKR,EAAcC,GAEnDP,EAAyBM,EAAaC,GAAML,GAGhD,MASEa,EAAqB,CAACd,EAAqBe,KAEpD,MAAMC,EAAUhB,EAAYhB,MAAM,eAElC,GAAI+B,EAAgB/C,SAAWiD,KAAKC,MAAMF,EAAQhD,OAAS,GACvD,MAAMmD,MAAM,qGAIhB,OAAOH,EAAQI,IAAI,CAACC,EAAMC,KAGtB,MAAMC,EAAuBN,KAAKC,MAAMI,EAAQ,GAChD,OAAOA,EAAQ,GAAM,EAAID,EAAON,EAAgBQ,GAAsBF"}
1
+ {"version":3,"file":"utils.js","sources":["../../../src/language/utils.ts"],"sourcesContent":["import { h } from 'preact';\nimport { CustomTranslations } from './types';\nimport { DEFAULT_LOCALE, LOCALE_NAME_MAX_LENGTH, LOCALE_NAME_MIN_LENGTH } from './constants';\n\n/**\n * @description Convert to ISO 639-1\n */\nconst toTwoLetterCode = (locale: string): string => locale.toLowerCase().substring(0, 2);\n\n/**\n * @description Checks if the locale length is valid\n * @param locale - The locale to check\n * @returns true if the locale length is valid, false otherwise\n */\nconst isLocaleLenghtValid = (locale: string): boolean =>\n Boolean(locale) && locale.length >= LOCALE_NAME_MIN_LENGTH && locale.length <= LOCALE_NAME_MAX_LENGTH;\n\n/**\n * Matches a string with one of the locales\n *\n * @param locale - The locale to match\n * @param supportedLocales - Array of possible locales\n *\n * @example\n * matchLocale('en-GB', ['en-US', 'es-ES']);\n * // returns 'en-US'\n */\nexport function matchLocale(locale: string, supportedLocales: readonly string[]): string | null {\n if (!locale || typeof locale !== 'string') return null;\n\n const lowerLocale = locale.toLowerCase();\n const exactMatch = supportedLocales.find(supLoc => supLoc.toLowerCase() === lowerLocale);\n\n if (exactMatch) return exactMatch;\n\n const localeTwoLetter = toTwoLetterCode(locale);\n return supportedLocales.find(supLoc => toTwoLetterCode(supLoc) === localeTwoLetter) || null;\n}\n\n/**\n * Returns a locale with the proper format.\n *\n * @param localeParam - Locale example: 'En_us' or 'en-US'\n *\n * @example\n * formatLocaleToLanguageCountryLocale('En_us');\n * // returns 'en-US'\n */\nexport function formatLocaleToLanguageCountryLocale(localeParam: string): string | null {\n const locale = localeParam.replace('_', '-');\n const format = /^([a-z]{2})(-)([A-Z]{2})$/;\n\n // If it's already formatted, return the locale\n if (format.test(locale)) return locale;\n\n // Split the string in two\n const [languageCode, countryCode] = locale.split('-');\n\n // If the locale or the country codes are missing, return null\n if (!languageCode || !countryCode) return null;\n\n // Ensure correct format and join the strings back together\n const fullLocale = [languageCode.toLowerCase(), countryCode.toUpperCase()].join('-');\n\n return fullLocale.length === 5 ? fullLocale : null;\n}\n\n/**\n * Returns the locale as Intl spells it ('en_us' -> 'en-US'), or null when Intl has no data for it.\n */\nconst findIntlLocale = (locale: string): string | null => {\n try {\n return Intl.NumberFormat.supportedLocalesOf([locale])[0] ?? null;\n } catch {\n // Intl throws a RangeError on a malformed tag instead of returning an empty list\n return null;\n }\n};\n\n/**\n * Resolves the locale used for Intl formatting and for third-party SDKs. Unlike the translations\n * locale, it is not limited to the locales we ship translations for.\n *\n * Subtags are dropped one at a time, most specific first, because Intl rejects a tag outright when\n * any of its subtags is malformed. Dropping them keeps the part that Intl does understand, so\n * 'zh-Foo-CN' resolves to 'zh' instead of falling all the way back to the default.\n *\n * @param locale - Locale requested by the merchant\n */\nexport function resolveFormattingLocale(locale?: string): string {\n if (!locale || typeof locale !== 'string') return DEFAULT_LOCALE;\n\n const subtags = locale.replace(/_/g, '-').split('-');\n\n while (subtags.length) {\n const match = findIntlLocale(subtags.join('-'));\n if (match) return match;\n subtags.pop();\n }\n\n return DEFAULT_LOCALE;\n}\n\nexport function parseLocale(locale: string, supportedLocales: readonly string[]): string {\n if (!isLocaleLenghtValid(locale)) return DEFAULT_LOCALE;\n\n const formattedLocale = formatLocaleToLanguageCountryLocale(locale);\n const hasMatch = formattedLocale && supportedLocales.includes(formattedLocale);\n\n if (hasMatch) return formattedLocale;\n\n return matchLocale(formattedLocale || locale, supportedLocales) || DEFAULT_LOCALE;\n}\n\n/**\n * @description Makes sure that if custom translation is defined using not properly formatted locale keys, then it gets formatted correctly\n *\n * @example { en_US: { ... }} will be adjusted to { 'en-US': { ... }} . { ar: { ... }} is kept as is.\n */\nexport function formatCustomTranslations(customTranslations: CustomTranslations = {}): CustomTranslations {\n return Object.keys(customTranslations).reduce<CustomTranslations>((memo, localeKey) => {\n if (!isLocaleLenghtValid(localeKey)) return memo;\n\n const locale = formatLocaleToLanguageCountryLocale(localeKey) || toTwoLetterCode(localeKey);\n memo[locale] = customTranslations[localeKey];\n return memo;\n }, {});\n}\n\nconst replaceTranslationValues = (translation: string, values: Record<string, string>) => {\n return translation.replace(/%{(\\w+)}/g, (_, k) => values[k] || '');\n};\n\n/**\n * Returns a translation string by key\n * @param translations -\n * @param key -\n * @param options -\n *\n * @internal\n */\nexport const getTranslation = (\n translations: Record<string, string>,\n key: string,\n options: { values?: Record<string, string>; count?: number } = {}\n): string | null => {\n const { values = {}, count = 0 } = options;\n const keyPlural = `${key}__plural`;\n const keyForCount = (count: number) => `${key}__${count}`;\n\n if (Object.prototype.hasOwnProperty.call(translations, keyForCount(count))) {\n // Find key__count translation key\n return replaceTranslationValues(translations[keyForCount(count)], values);\n } else if (Object.prototype.hasOwnProperty.call(translations, keyPlural) && count > 1) {\n // Find key__plural translation key, if count greater than 1 (e.g. myTranslation__plural)\n return replaceTranslationValues(translations[keyPlural], values);\n } else if (Object.prototype.hasOwnProperty.call(translations, key)) {\n // Find key translation key (e.g. myTranslation)\n return replaceTranslationValues(translations[key], values);\n }\n\n return null;\n};\n\n/**\n * Injects JSX elements in a middle of a translation and returns a JSX array\n * The input string should use %# as the token to know where to insert the component\n * @param translation - Translation string\n * @param renderFunctions - An array function that renders JSX elements\n */\nexport const interpolateElement = (translation: string, renderFunctions: Array<(translation: string) => h.JSX.Element | string>) => {\n // splits by regex group, it guarantees that it only splits with 2 tokens (%#)\n const matches = translation.split(/%#(.*?)%#/gm);\n\n if (renderFunctions.length !== Math.floor(matches.length / 2)) {\n throw Error('The number of functions provided does not match the number of elements in the translation string.');\n }\n\n // the map will create an array of JSX / string elements, this syntax in accepted in JSX/react to render elements\n return matches.map((term, index) => {\n // math to get the index of the renderFunction that should be used\n // since we split on tokens, that means the index of the render function is half of the index of the string\n const indexInFunctionArray = Math.floor(index / 2);\n return index % 2 === 0 ? term : renderFunctions[indexInFunctionArray](term);\n });\n};\n"],"names":["toTwoLetterCode","locale","toLowerCase","substring","isLocaleLenghtValid","Boolean","length","LOCALE_NAME_MIN_LENGTH","LOCALE_NAME_MAX_LENGTH","matchLocale","supportedLocales","lowerLocale","exactMatch","find","supLoc","localeTwoLetter","formatLocaleToLanguageCountryLocale","localeParam","replace","test","languageCode","countryCode","split","fullLocale","toUpperCase","join","findIntlLocale","Intl","NumberFormat","supportedLocalesOf","resolveFormattingLocale","DEFAULT_LOCALE","subtags","match","pop","parseLocale","formattedLocale","includes","formatCustomTranslations","customTranslations","Object","keys","reduce","memo","localeKey","replaceTranslationValues","translation","values","_","k","getTranslation","translations","key","options","count","keyPlural","keyForCount","prototype","hasOwnProperty","call","interpolateElement","renderFunctions","matches","Math","floor","Error","map","term","index","indexInFunctionArray"],"mappings":"wGAOA,MAAMA,EAAmBC,GAA2BA,EAAOC,cAAcC,UAAU,EAAG,GAOhFC,EAAuBH,GACzBI,QAAQJ,IAAWA,EAAOK,QAAUC,GAA0BN,EAAOK,QAAUE,EAY5E,SAASC,EAAYR,EAAgBS,GACxC,IAAKT,GAA4B,iBAAXA,EAAqB,OAAO,KAElD,MAAMU,EAAcV,EAAOC,cACrBU,EAAaF,EAAiBG,KAAKC,GAAUA,EAAOZ,gBAAkBS,GAE5E,GAAIC,EAAY,OAAOA,EAEvB,MAAMG,EAAkBf,EAAgBC,GACxC,OAAOS,EAAiBG,KAAKC,GAAUd,EAAgBc,KAAYC,IAAoB,IAC3F,CAWO,SAASC,EAAoCC,GAChD,MAAMhB,EAASgB,EAAYC,QAAQ,IAAK,KAIxC,GAHe,4BAGJC,KAAKlB,GAAS,OAAOA,EAGhC,MAAOmB,EAAcC,GAAepB,EAAOqB,MAAM,KAGjD,IAAKF,IAAiBC,EAAa,OAAO,KAG1C,MAAME,EAAa,CAACH,EAAalB,cAAemB,EAAYG,eAAeC,KAAK,KAEhF,OAA6B,IAAtBF,EAAWjB,OAAeiB,EAAa,IAClD,CAKA,MAAMG,EAAkBzB,IACpB,IACI,OAAO0B,KAAKC,aAAaC,mBAAmB,CAAC5B,IAAS,IAAM,IAChE,CAAE,MAEE,OAAO,IACX,GAaG,SAAS6B,EAAwB7B,GACpC,GAAiC,iBAAXA,EAAqB,OAAO8B,EAElD,MAAMC,EAAU/B,EAAOiB,QAAQ,KAAM,KAAKI,MAAM,KAEhD,KAAOU,EAAQ1B,QAAQ,CACnB,MAAM2B,EAAQP,EAAeM,EAAQP,KAAK,MAC1C,GAAIQ,EAAO,OAAOA,EAClBD,EAAQE,KACZ,CAEA,OAAOH,CACX,CAEO,SAASI,EAAYlC,EAAgBS,GACxC,IAAKN,EAAoBH,GAAS,OAAO8B,EAEzC,MAAMK,EAAkBpB,EAAoCf,GAG5D,OAFiBmC,GAAmB1B,EAAiB2B,SAASD,GAEzCA,EAEd3B,EAAY2B,GAAmBnC,EAAQS,IAAqBqB,CACvE,CAOO,SAASO,EAAyBC,EAAyC,IAC9E,OAAOC,OAAOC,KAAKF,GAAoBG,OAA2B,CAACC,EAAMC,KACrE,IAAKxC,EAAoBwC,GAAY,OAAOD,EAI5C,OADAA,EADe3B,EAAoC4B,IAAc5C,EAAgB4C,IAClEL,EAAmBK,GAC3BD,GACR,CAAA,EACP,CAEA,MAAME,EAA2B,CAACC,EAAqBC,IAC5CD,EAAY5B,QAAQ,YAAa,CAAC8B,EAAGC,IAAMF,EAAOE,IAAM,IAWtDC,EAAiB,CAC1BC,EACAC,EACAC,EAA+D,CAAA,KAE/D,MAAMN,OAAEA,EAAS,CAAA,EAAEO,MAAEA,EAAQ,GAAMD,EAC7BE,EAAY,GAAGH,YACfI,EAAeF,GAAkB,GAAGF,MAAQE,IAElD,OAAId,OAAOiB,UAAUC,eAAeC,KAAKR,EAAcK,EAAYF,IAExDT,EAAyBM,EAAaK,EAAYF,IAASP,GAC3DP,OAAOiB,UAAUC,eAAeC,KAAKR,EAAcI,IAAcD,EAAQ,EAEzET,EAAyBM,EAAaI,GAAYR,GAClDP,OAAOiB,UAAUC,eAAeC,KAAKR,EAAcC,GAEnDP,EAAyBM,EAAaC,GAAML,GAGhD,MASEa,EAAqB,CAACd,EAAqBe,KAEpD,MAAMC,EAAUhB,EAAYxB,MAAM,eAElC,GAAIuC,EAAgBvD,SAAWyD,KAAKC,MAAMF,EAAQxD,OAAS,GACvD,MAAM2D,MAAM,qGAIhB,OAAOH,EAAQI,IAAI,CAACC,EAAMC,KAGtB,MAAMC,EAAuBN,KAAKC,MAAMI,EAAQ,GAChD,OAAOA,EAAQ,GAAM,EAAID,EAAON,EAAgBQ,GAAsBF"}
@@ -1 +1 @@
1
- {"version":3,"file":"Script.js","sources":["../../../src/utils/Script.ts"],"sourcesContent":["import AdyenCheckoutError from '../core/Errors/AdyenCheckoutError';\nimport { AnalyticsInfoEvent, InfoEventType } from '../core/Analytics/events/AnalyticsInfoEvent';\nimport type { IAnalytics } from '../core/Analytics/Analytics';\n\ninterface IScript {\n load(): Promise<void>;\n remove(): void;\n}\n\ninterface IScriptProps {\n src: string;\n component: string;\n analytics: IAnalytics;\n node?: string;\n attributes?: Partial<HTMLScriptElement>;\n dataAttributes?: Record<string, string | undefined>;\n}\n\n// Returns Base URL of the resource without any query parameters (e.g. merchant ID, token, etc). Used for Analytics\nfunction getBaseURL(src: string): string {\n const url = new URL(src);\n return url.origin + url.pathname;\n}\n\nclass Script implements IScript {\n private readonly src: string;\n private readonly component: string;\n private readonly node: string;\n private readonly attributes: Partial<HTMLScriptElement>;\n private readonly dataAttributes: Record<string, string | undefined>;\n private readonly analytics: IAnalytics;\n private readonly baseUrl: string;\n\n private script: HTMLScriptElement;\n private loadPromise: Promise<void> | null = null;\n private rejectLoadPromise: (reason?: unknown) => void | null = null;\n private resolveLoadScript: (() => void) | null = null;\n private rejectLoadScript: ((reason?: unknown) => void) | null = null;\n\n private readonly handleOnLoad = () => {\n this.script?.setAttribute('data-script-loaded', 'true');\n this.cleanupListeners();\n this.resolveLoadScript?.();\n };\n\n private readonly handleOnError = (errorEvent: ErrorEvent) => {\n this.cleanupListeners();\n const error = new AdyenCheckoutError(\n 'SCRIPT_ERROR',\n `Unable to load script ${this.src}.${errorEvent?.message && `Message: ${errorEvent.message}`}`,\n {\n cause: errorEvent?.error || errorEvent\n }\n );\n this.rejectLoadScript?.(error);\n };\n\n public static readonly RETRY_DELAY = 1000;\n public static readonly MAX_NUMBER_OF_RETRIES = 3;\n\n constructor({ src, component, node = 'body', attributes, dataAttributes, analytics }: IScriptProps) {\n this.src = src;\n this.component = component;\n this.node = node;\n this.attributes = attributes;\n this.dataAttributes = dataAttributes;\n this.analytics = analytics;\n this.baseUrl = getBaseURL(this.src);\n }\n\n public load = (): Promise<void> => {\n if (this.loadPromise !== null) {\n if (process.env.NODE_ENV === 'development') console.warn(`[Warning] script.load called more than once for ${this.src}`);\n return this.loadPromise;\n }\n\n this.loadPromise = new Promise((resolve, reject) => {\n this.rejectLoadPromise = reject;\n let attempts = 0;\n\n this.trackEvent(InfoEventType.sdkDownloadInitiated);\n\n const loadScriptWithRetry = async (): Promise<void> => {\n try {\n attempts++;\n await this.loadScript();\n this.trackEvent(InfoEventType.sdkDownloadCompleted);\n resolve();\n } catch (error: unknown) {\n if (this.loadPromise === null) {\n return;\n }\n\n this.trackEvent(InfoEventType.sdkDownloadFailed);\n\n this.removeScript();\n\n if (attempts < Script.MAX_NUMBER_OF_RETRIES) {\n setTimeout(() => void loadScriptWithRetry(), Script.RETRY_DELAY);\n } else {\n this.trackEvent(InfoEventType.sdkDownloadAborted);\n this.loadPromise = null;\n this.rejectLoadPromise = null;\n reject(error);\n }\n }\n };\n\n void loadScriptWithRetry();\n });\n\n return this.loadPromise;\n };\n\n public remove = () => {\n this.rejectLoadPromise?.(new AdyenCheckoutError('CANCEL', 'Script loading cancelled.'));\n this.removeScript();\n this.loadPromise = null;\n };\n\n private removeScript() {\n this.cleanupListeners();\n this.script?.parentNode?.removeChild(this.script);\n this.script = null;\n }\n\n private cleanupListeners() {\n if (!this.script) return;\n this.script.removeEventListener('load', this.handleOnLoad);\n this.script.removeEventListener('error', this.handleOnError);\n }\n\n private attachListeners() {\n if (!this.script) return;\n this.cleanupListeners();\n this.script.addEventListener('load', this.handleOnLoad);\n this.script.addEventListener('error', this.handleOnError);\n }\n\n private loadScript(): Promise<void> {\n return new Promise((resolve, reject) => {\n const scriptContainer = document.querySelector(this.node);\n\n if (!scriptContainer) {\n reject(new AdyenCheckoutError('SCRIPT_ERROR', `Unable to find script container node: ${this.node}`));\n return;\n }\n\n this.resolveLoadScript = resolve;\n this.rejectLoadScript = reject;\n\n this.script = scriptContainer.querySelector(`script[src=\"${this.src}\"]`);\n\n // Script element exists in the browser and is already loaded\n if (this.script?.getAttribute('data-script-loaded')) {\n this.resolveLoadScript();\n return;\n }\n\n // Script element exists in the browser, but it is not loaded yet\n // Use-case: Multiple PayPal standalone components being loaded in different parts of the screen.\n if (this.script) {\n this.attachListeners();\n return;\n }\n\n // Script element doesn't exist in the browser, so we create it and append to the DOM tree\n this.script = document.createElement('script');\n\n Object.assign(this.script, this.attributes);\n Object.assign(this.script.dataset, this.dataAttributes);\n\n this.script.src = this.src;\n this.script.async = true;\n\n this.attachListeners();\n\n scriptContainer.appendChild(this.script);\n });\n }\n\n private trackEvent(eventType: InfoEventType) {\n const event = new AnalyticsInfoEvent({\n type: eventType,\n component: this.component,\n cdnUrl: this.baseUrl\n });\n this.analytics?.sendAnalytics(event);\n }\n}\n\nexport default Script;\n"],"names":["Script","removeScript","this","cleanupListeners","script","parentNode","removeChild","removeEventListener","handleOnLoad","handleOnError","attachListeners","addEventListener","loadScript","Promise","resolve","reject","scriptContainer","document","querySelector","node","resolveLoadScript","rejectLoadScript","src","getAttribute","createElement","Object","assign","attributes","dataset","dataAttributes","async","appendChild","AdyenCheckoutError","trackEvent","eventType","event","AnalyticsInfoEvent","type","component","cdnUrl","baseUrl","analytics","sendAnalytics","constructor","_define_property","loadPromise","rejectLoadPromise","setAttribute","errorEvent","error","message","cause","load","attempts","InfoEventType","sdkDownloadInitiated","loadScriptWithRetry","sdkDownloadCompleted","sdkDownloadFailed","MAX_NUMBER_OF_RETRIES","setTimeout","RETRY_DELAY","sdkDownloadAborted","remove","url","URL","origin","pathname","getBaseURL"],"mappings":"mRAwBA,MAAMA,EAgGMC,YAAAA,GACJC,KAAKC,mBACLD,KAAKE,QAAQC,YAAYC,YAAYJ,KAAKE,QAC1CF,KAAKE,OAAS,IAClB,CAEQD,gBAAAA,GACCD,KAAKE,SACVF,KAAKE,OAAOG,oBAAoB,OAAQL,KAAKM,cAC7CN,KAAKE,OAAOG,oBAAoB,QAASL,KAAKO,eAClD,CAEQC,eAAAA,GACCR,KAAKE,SACVF,KAAKC,mBACLD,KAAKE,OAAOO,iBAAiB,OAAQT,KAAKM,cAC1CN,KAAKE,OAAOO,iBAAiB,QAAST,KAAKO,eAC/C,CAEQG,UAAAA,GACJ,OAAO,IAAIC,QAAQ,CAACC,EAASC,KACzB,MAAMC,EAAkBC,SAASC,cAAchB,KAAKiB,MAE/CH,GAKLd,KAAKkB,kBAAoBN,EACzBZ,KAAKmB,iBAAmBN,EAExBb,KAAKE,OAASY,EAAgBE,cAAc,eAAehB,KAAKoB,SAG5DpB,KAAKE,QAAQmB,aAAa,sBAC1BrB,KAAKkB,oBAMLlB,KAAKE,OACLF,KAAKQ,mBAKTR,KAAKE,OAASa,SAASO,cAAc,UAErCC,OAAOC,OAAOxB,KAAKE,OAAQF,KAAKyB,YAChCF,OAAOC,OAAOxB,KAAKE,OAAOwB,QAAS1B,KAAK2B,gBAExC3B,KAAKE,OAAOkB,IAAMpB,KAAKoB,IACvBpB,KAAKE,OAAO0B,OAAQ,EAEpB5B,KAAKQ,kBAELM,EAAgBe,YAAY7B,KAAKE,UAjC7BW,EAAO,IAAIiB,EAAmB,eAAgB,yCAAyC9B,KAAKiB,UAmCxG,CAEQc,UAAAA,CAAWC,GACf,MAAMC,EAAQ,IAAIC,EAAmB,CACjCC,KAAMH,EACNI,UAAWpC,KAAKoC,UAChBC,OAAQrC,KAAKsC,UAEjBtC,KAAKuC,WAAWC,cAAcP,EAClC,CAhIA,WAAAQ,EAAYrB,IAAEA,EAAGgB,UAAEA,EAASnB,KAAEA,EAAO,OAAMQ,WAAEA,EAAUE,eAAEA,EAAcY,UAAEA,IAnCzEG,EAAA1C,KAAiBoB,cACjBsB,EAAA1C,KAAiBoC,oBACjBM,EAAA1C,KAAiBiB,eACjByB,EAAA1C,KAAiByB,qBACjBiB,EAAA1C,KAAiB2B,yBACjBe,EAAA1C,KAAiBuC,oBACjBG,EAAA1C,KAAiBsC,kBAEjBI,EAAA1C,KAAQE,iBACRwC,EAAA1C,KAAQ2C,cAAoC,MAC5CD,EAAA1C,KAAQ4C,oBAAuD,MAC/DF,EAAA1C,KAAQkB,oBAAyC,MACjDwB,EAAA1C,KAAQmB,mBAAwD,MAEhEuB,EAAA1C,KAAiBM,eAAe,KAC5BN,KAAKE,QAAQ2C,aAAa,qBAAsB,QAChD7C,KAAKC,mBACLD,KAAKkB,wBAGTwB,EAAA1C,KAAiBO,gBAAiBuC,IAC9B9C,KAAKC,mBACL,MAAM8C,EAAQ,IAAIjB,EACd,eACA,yBAAyB9B,KAAKoB,OAAO0B,GAAYE,SAAW,YAAYF,EAAWE,YACnF,CACIC,MAAOH,GAAYC,OAASD,IAGpC9C,KAAKmB,mBAAmB4B,KAgB5BL,EAAA1C,KAAOkD,OAAO,KACe,OAArBlD,KAAK2C,cAKT3C,KAAK2C,YAAc,IAAIhC,QAAQ,CAACC,EAASC,KACrCb,KAAK4C,kBAAoB/B,EACzB,IAAIsC,EAAW,EAEfnD,KAAK+B,WAAWqB,EAAcC,sBAE9B,MAAMC,EAAsB1B,UACxB,IACIuB,UACMnD,KAAKU,aACXV,KAAK+B,WAAWqB,EAAcG,sBAC9B3C,GACJ,CAAE,MAAOmC,GACL,GAAyB,OAArB/C,KAAK2C,YACL,OAGJ3C,KAAK+B,WAAWqB,EAAcI,mBAE9BxD,KAAKD,eAEDoD,EAAWrD,EAAO2D,sBAClBC,WAAW,KAAWJ,KAAuBxD,EAAO6D,cAEpD3D,KAAK+B,WAAWqB,EAAcQ,oBAC9B5D,KAAK2C,YAAc,KACnB3C,KAAK4C,kBAAoB,KACzB/B,EAAOkC,GAEf,GAGCO,OAnCEtD,KAAK2C,cAyCpBD,EAAA1C,KAAO6D,SAAS,KACZ7D,KAAK4C,oBAAoB,IAAId,EAAmB,SAAU,8BAC1D9B,KAAKD,eACLC,KAAK2C,YAAc,OAxDnB3C,KAAKoB,IAAMA,EACXpB,KAAKoC,UAAYA,EACjBpC,KAAKiB,KAAOA,EACZjB,KAAKyB,WAAaA,EAClBzB,KAAK2B,eAAiBA,EACtB3B,KAAKuC,UAAYA,EACjBvC,KAAKsC,QAhDb,SAAoBlB,GAChB,MAAM0C,EAAM,IAAIC,IAAI3C,GACpB,OAAO0C,EAAIE,OAASF,EAAIG,QAC5B,CA6CuBC,CAAWlE,KAAKoB,IACnC,EAXAsB,EAjCE5C,EAiCqB6D,cAAc,KACrCjB,EAlCE5C,EAkCqB2D,wBAAwB"}
1
+ {"version":3,"file":"Script.js","sources":["../../../src/utils/Script.ts"],"sourcesContent":["import AdyenCheckoutError from '../core/Errors/AdyenCheckoutError';\nimport { AnalyticsInfoEvent, InfoEventType } from '../core/Analytics/events/AnalyticsInfoEvent';\nimport type { IAnalytics } from '../core/Analytics/Analytics';\n\ninterface IScript {\n load(): Promise<void>;\n remove(): void;\n}\n\ninterface IScriptProps {\n src: string;\n component: string;\n analytics: IAnalytics;\n node?: string;\n attributes?: Partial<HTMLScriptElement>;\n dataAttributes?: Record<string, string | undefined>;\n}\n\n// Returns Base URL of the resource without any query parameters (e.g. merchant ID, token, etc). Used for Analytics\nfunction getBaseURL(src: string): string {\n const url = new URL(src);\n return url.origin + url.pathname;\n}\n\nclass Script implements IScript {\n private readonly src: string;\n private readonly component: string;\n private readonly node: string;\n private readonly attributes: Partial<HTMLScriptElement> | undefined;\n private readonly dataAttributes: Record<string, string | undefined> | undefined;\n private readonly analytics: IAnalytics;\n private readonly baseUrl: string;\n\n private script: HTMLScriptElement | null;\n private loadPromise: Promise<void> | null = null;\n private rejectLoadPromise: ((reason?: unknown) => void) | null = null;\n private resolveLoadScript: (() => void) | null = null;\n private rejectLoadScript: ((reason?: unknown) => void) | null = null;\n\n private readonly handleOnLoad = () => {\n this.script?.setAttribute('data-script-loaded', 'true');\n this.cleanupListeners();\n this.resolveLoadScript?.();\n };\n\n private readonly handleOnError = (errorEvent: ErrorEvent) => {\n this.cleanupListeners();\n const error = new AdyenCheckoutError(\n 'SCRIPT_ERROR',\n `Unable to load script ${this.src}.${errorEvent?.message && `Message: ${errorEvent.message}`}`,\n {\n cause: errorEvent?.error || errorEvent\n }\n );\n this.rejectLoadScript?.(error);\n };\n\n public static readonly RETRY_DELAY = 1000;\n public static readonly MAX_NUMBER_OF_RETRIES = 3;\n\n constructor({ src, component, node = 'body', attributes, dataAttributes, analytics }: IScriptProps) {\n this.src = src;\n this.component = component;\n this.node = node;\n this.attributes = attributes;\n this.dataAttributes = dataAttributes;\n this.analytics = analytics;\n this.baseUrl = getBaseURL(this.src);\n }\n\n public load = (): Promise<void> => {\n if (this.loadPromise !== null) {\n if (process.env.NODE_ENV === 'development') console.warn(`[Warning] script.load called more than once for ${this.src}`);\n return this.loadPromise;\n }\n\n this.loadPromise = new Promise((resolve, reject) => {\n this.rejectLoadPromise = reject;\n let attempts = 0;\n\n this.trackEvent(InfoEventType.sdkDownloadInitiated);\n\n const loadScriptWithRetry = async (): Promise<void> => {\n try {\n attempts++;\n await this.loadScript();\n this.trackEvent(InfoEventType.sdkDownloadCompleted);\n resolve();\n } catch (error: unknown) {\n if (this.loadPromise === null) {\n return;\n }\n\n this.trackEvent(InfoEventType.sdkDownloadFailed);\n\n this.removeScript();\n\n if (attempts < Script.MAX_NUMBER_OF_RETRIES) {\n setTimeout(() => void loadScriptWithRetry(), Script.RETRY_DELAY);\n } else {\n this.trackEvent(InfoEventType.sdkDownloadAborted);\n this.loadPromise = null;\n this.rejectLoadPromise = null;\n reject(error);\n }\n }\n };\n\n void loadScriptWithRetry();\n });\n\n return this.loadPromise;\n };\n\n public remove = () => {\n this.rejectLoadPromise?.(new AdyenCheckoutError('CANCEL', 'Script loading cancelled.'));\n this.removeScript();\n this.loadPromise = null;\n };\n\n private removeScript() {\n this.cleanupListeners();\n this.script?.parentNode?.removeChild(this.script);\n this.script = null;\n }\n\n private cleanupListeners() {\n if (!this.script) return;\n this.script.removeEventListener('load', this.handleOnLoad);\n this.script.removeEventListener('error', this.handleOnError);\n }\n\n private attachListeners() {\n if (!this.script) return;\n this.cleanupListeners();\n this.script.addEventListener('load', this.handleOnLoad);\n this.script.addEventListener('error', this.handleOnError);\n }\n\n private loadScript(): Promise<void> {\n return new Promise((resolve, reject) => {\n const scriptContainer = document.querySelector(this.node);\n\n if (!scriptContainer) {\n reject(new AdyenCheckoutError('SCRIPT_ERROR', `Unable to find script container node: ${this.node}`));\n return;\n }\n\n this.resolveLoadScript = resolve;\n this.rejectLoadScript = reject;\n\n this.script = scriptContainer.querySelector(`script[src=\"${this.src}\"]`);\n\n // Script element exists in the browser and is already loaded\n if (this.script?.getAttribute('data-script-loaded')) {\n this.resolveLoadScript();\n return;\n }\n\n // Script element exists in the browser, but it is not loaded yet\n // Use-case: Multiple PayPal standalone components being loaded in different parts of the screen.\n if (this.script) {\n this.attachListeners();\n return;\n }\n\n // Script element doesn't exist in the browser, so we create it and append to the DOM tree\n this.script = document.createElement('script');\n\n Object.assign(this.script, this.attributes);\n Object.assign(this.script.dataset, this.dataAttributes);\n\n this.script.src = this.src;\n this.script.async = true;\n\n this.attachListeners();\n\n scriptContainer.appendChild(this.script);\n });\n }\n\n private trackEvent(eventType: InfoEventType) {\n const event = new AnalyticsInfoEvent({\n type: eventType,\n component: this.component,\n cdnUrl: this.baseUrl\n });\n this.analytics?.sendAnalytics(event);\n }\n}\n\nexport default Script;\n"],"names":["Script","removeScript","this","cleanupListeners","script","parentNode","removeChild","removeEventListener","handleOnLoad","handleOnError","attachListeners","addEventListener","loadScript","Promise","resolve","reject","scriptContainer","document","querySelector","node","resolveLoadScript","rejectLoadScript","src","getAttribute","createElement","Object","assign","attributes","dataset","dataAttributes","async","appendChild","AdyenCheckoutError","trackEvent","eventType","event","AnalyticsInfoEvent","type","component","cdnUrl","baseUrl","analytics","sendAnalytics","constructor","_define_property","loadPromise","rejectLoadPromise","setAttribute","errorEvent","error","message","cause","load","attempts","InfoEventType","sdkDownloadInitiated","loadScriptWithRetry","sdkDownloadCompleted","sdkDownloadFailed","MAX_NUMBER_OF_RETRIES","setTimeout","RETRY_DELAY","sdkDownloadAborted","remove","url","URL","origin","pathname","getBaseURL"],"mappings":"mRAwBA,MAAMA,EAgGMC,YAAAA,GACJC,KAAKC,mBACLD,KAAKE,QAAQC,YAAYC,YAAYJ,KAAKE,QAC1CF,KAAKE,OAAS,IAClB,CAEQD,gBAAAA,GACCD,KAAKE,SACVF,KAAKE,OAAOG,oBAAoB,OAAQL,KAAKM,cAC7CN,KAAKE,OAAOG,oBAAoB,QAASL,KAAKO,eAClD,CAEQC,eAAAA,GACCR,KAAKE,SACVF,KAAKC,mBACLD,KAAKE,OAAOO,iBAAiB,OAAQT,KAAKM,cAC1CN,KAAKE,OAAOO,iBAAiB,QAAST,KAAKO,eAC/C,CAEQG,UAAAA,GACJ,OAAO,IAAIC,QAAQ,CAACC,EAASC,KACzB,MAAMC,EAAkBC,SAASC,cAAchB,KAAKiB,MAE/CH,GAKLd,KAAKkB,kBAAoBN,EACzBZ,KAAKmB,iBAAmBN,EAExBb,KAAKE,OAASY,EAAgBE,cAAc,eAAehB,KAAKoB,SAG5DpB,KAAKE,QAAQmB,aAAa,sBAC1BrB,KAAKkB,oBAMLlB,KAAKE,OACLF,KAAKQ,mBAKTR,KAAKE,OAASa,SAASO,cAAc,UAErCC,OAAOC,OAAOxB,KAAKE,OAAQF,KAAKyB,YAChCF,OAAOC,OAAOxB,KAAKE,OAAOwB,QAAS1B,KAAK2B,gBAExC3B,KAAKE,OAAOkB,IAAMpB,KAAKoB,IACvBpB,KAAKE,OAAO0B,OAAQ,EAEpB5B,KAAKQ,kBAELM,EAAgBe,YAAY7B,KAAKE,UAjC7BW,EAAO,IAAIiB,EAAmB,eAAgB,yCAAyC9B,KAAKiB,UAmCxG,CAEQc,UAAAA,CAAWC,GACf,MAAMC,EAAQ,IAAIC,EAAmB,CACjCC,KAAMH,EACNI,UAAWpC,KAAKoC,UAChBC,OAAQrC,KAAKsC,UAEjBtC,KAAKuC,WAAWC,cAAcP,EAClC,CAhIA,WAAAQ,EAAYrB,IAAEA,EAAGgB,UAAEA,EAASnB,KAAEA,EAAO,OAAMQ,WAAEA,EAAUE,eAAEA,EAAcY,UAAEA,IAnCzEG,EAAA1C,KAAiBoB,cACjBsB,EAAA1C,KAAiBoC,oBACjBM,EAAA1C,KAAiBiB,eACjByB,EAAA1C,KAAiByB,qBACjBiB,EAAA1C,KAAiB2B,yBACjBe,EAAA1C,KAAiBuC,oBACjBG,EAAA1C,KAAiBsC,kBAEjBI,EAAA1C,KAAQE,iBACRwC,EAAA1C,KAAQ2C,cAAoC,MAC5CD,EAAA1C,KAAQ4C,oBAAyD,MACjEF,EAAA1C,KAAQkB,oBAAyC,MACjDwB,EAAA1C,KAAQmB,mBAAwD,MAEhEuB,EAAA1C,KAAiBM,eAAe,KAC5BN,KAAKE,QAAQ2C,aAAa,qBAAsB,QAChD7C,KAAKC,mBACLD,KAAKkB,wBAGTwB,EAAA1C,KAAiBO,gBAAiBuC,IAC9B9C,KAAKC,mBACL,MAAM8C,EAAQ,IAAIjB,EACd,eACA,yBAAyB9B,KAAKoB,OAAO0B,GAAYE,SAAW,YAAYF,EAAWE,YACnF,CACIC,MAAOH,GAAYC,OAASD,IAGpC9C,KAAKmB,mBAAmB4B,KAgB5BL,EAAA1C,KAAOkD,OAAO,KACe,OAArBlD,KAAK2C,cAKT3C,KAAK2C,YAAc,IAAIhC,QAAQ,CAACC,EAASC,KACrCb,KAAK4C,kBAAoB/B,EACzB,IAAIsC,EAAW,EAEfnD,KAAK+B,WAAWqB,EAAcC,sBAE9B,MAAMC,EAAsB1B,UACxB,IACIuB,UACMnD,KAAKU,aACXV,KAAK+B,WAAWqB,EAAcG,sBAC9B3C,GACJ,CAAE,MAAOmC,GACL,GAAyB,OAArB/C,KAAK2C,YACL,OAGJ3C,KAAK+B,WAAWqB,EAAcI,mBAE9BxD,KAAKD,eAEDoD,EAAWrD,EAAO2D,sBAClBC,WAAW,KAAWJ,KAAuBxD,EAAO6D,cAEpD3D,KAAK+B,WAAWqB,EAAcQ,oBAC9B5D,KAAK2C,YAAc,KACnB3C,KAAK4C,kBAAoB,KACzB/B,EAAOkC,GAEf,GAGCO,OAnCEtD,KAAK2C,cAyCpBD,EAAA1C,KAAO6D,SAAS,KACZ7D,KAAK4C,oBAAoB,IAAId,EAAmB,SAAU,8BAC1D9B,KAAKD,eACLC,KAAK2C,YAAc,OAxDnB3C,KAAKoB,IAAMA,EACXpB,KAAKoC,UAAYA,EACjBpC,KAAKiB,KAAOA,EACZjB,KAAKyB,WAAaA,EAClBzB,KAAK2B,eAAiBA,EACtB3B,KAAKuC,UAAYA,EACjBvC,KAAKsC,QAhDb,SAAoBlB,GAChB,MAAM0C,EAAM,IAAIC,IAAI3C,GACpB,OAAO0C,EAAIE,OAASF,EAAIG,QAC5B,CA6CuBC,CAAWlE,KAAKoB,IACnC,EAXAsB,EAjCE5C,EAiCqB6D,cAAc,KACrCjB,EAlCE5C,EAkCqB2D,wBAAwB"}
@@ -1 +1 @@
1
- {"version":3,"file":"ValidationRuleResult.js","sources":["../../../../src/utils/Validator/ValidationRuleResult.ts"],"sourcesContent":["import { ErrorMessageObject, ValidatorRule, ValidatorMode, FieldContext } from './types';\nimport Language from '../../language';\n\n/**\n * Holds the result of a validation\n */\nexport class ValidationRuleResult {\n private readonly shouldValidate: boolean;\n public isValid: boolean;\n public errorMessage: string | ErrorMessageObject | undefined;\n public errorI18n: string;\n\n constructor(rule: ValidatorRule, value: string, mode: ValidatorMode, context: FieldContext, i18n: Language) {\n this.shouldValidate = rule.modes.includes(mode);\n this.isValid = rule.validate(value, context);\n this.errorMessage = rule.errorMessage;\n\n if (typeof rule.errorMessage === 'string') {\n this.errorI18n = i18n.get(rule.errorMessage);\n } else if (rule.errorMessage) {\n this.errorI18n = i18n.get(rule.errorMessage.translationKey, rule.errorMessage.translationObject);\n }\n }\n\n /**\n * Whether the validation is considered an error.\n * A field is only considered to be an error if the validation rule applies to the current mode i.e. 'blur' or 'input'.\n * Also, if a validation function returns a null value e.g. when the field is empty, then the field will not be considered to be in error\n * unless the whole form is being validated\n */\n hasError(isValidatingForm = false): boolean {\n return isValidatingForm ? !this.isValid && this.shouldValidate : this.isValid != null && !this.isValid && this.shouldValidate;\n }\n}\n"],"names":["ValidationRuleResult","hasError","isValidatingForm","this","isValid","shouldValidate","constructor","rule","value","mode","context","i18n","_define_property","errorMessage","errorI18n","modes","includes","validate","get","translationKey","translationObject"],"mappings":"wHAMO,MAAMA,EAwBTC,QAAAA,CAASC,GAAmB,GACxB,OAAOA,GAAoBC,KAAKC,SAAWD,KAAKE,eAAiC,MAAhBF,KAAKC,UAAoBD,KAAKC,SAAWD,KAAKE,cACnH,CApBA,WAAAC,CAAYC,EAAqBC,EAAeC,EAAqBC,EAAuBC,GAL5FC,EAAAT,KAAiBE,yBACjBO,EAAAT,KAAOC,kBACPQ,EAAAT,KAAOU,uBACPD,EAAAT,KAAOW,oBAGHX,KAAKE,eAAiBE,EAAKQ,MAAMC,SAASP,GAC1CN,KAAKC,QAAUG,EAAKU,SAAST,EAAOE,GACpCP,KAAKU,aAAeN,EAAKM,aAEQ,iBAAtBN,EAAKM,aACZV,KAAKW,UAAYH,EAAKO,IAAIX,EAAKM,cACxBN,EAAKM,eACZV,KAAKW,UAAYH,EAAKO,IAAIX,EAAKM,aAAaM,eAAgBZ,EAAKM,aAAaO,mBAEtF"}
1
+ {"version":3,"file":"ValidationRuleResult.js","sources":["../../../../src/utils/Validator/ValidationRuleResult.ts"],"sourcesContent":["import { ErrorMessageObject, ValidatorRule, ValidatorMode, FieldContext } from './types';\nimport Language from '../../language';\n\n/**\n * Holds the result of a validation\n */\nexport class ValidationRuleResult {\n private readonly shouldValidate: boolean;\n public isValid: boolean | null;\n public errorMessage: string | ErrorMessageObject | undefined;\n public errorI18n: string;\n\n constructor(rule: ValidatorRule, value: string, mode: ValidatorMode, context: FieldContext | undefined, i18n: Language) {\n this.shouldValidate = rule.modes.includes(mode);\n this.isValid = rule.validate(value, context);\n this.errorMessage = rule.errorMessage;\n\n if (typeof rule.errorMessage === 'string') {\n this.errorI18n = i18n.get(rule.errorMessage);\n } else if (rule.errorMessage) {\n this.errorI18n = i18n.get(rule.errorMessage.translationKey, rule.errorMessage.translationObject);\n }\n }\n\n /**\n * Whether the validation is considered an error.\n * A field is only considered to be an error if the validation rule applies to the current mode i.e. 'blur' or 'input'.\n * Also, if a validation function returns a null value e.g. when the field is empty, then the field will not be considered to be in error\n * unless the whole form is being validated\n */\n hasError(isValidatingForm = false): boolean {\n return isValidatingForm ? !this.isValid && this.shouldValidate : this.isValid != null && !this.isValid && this.shouldValidate;\n }\n}\n"],"names":["ValidationRuleResult","hasError","isValidatingForm","this","isValid","shouldValidate","constructor","rule","value","mode","context","i18n","_define_property","errorMessage","errorI18n","modes","includes","validate","get","translationKey","translationObject"],"mappings":"wHAMO,MAAMA,EAwBTC,QAAAA,CAASC,GAAmB,GACxB,OAAOA,GAAoBC,KAAKC,SAAWD,KAAKE,eAAiC,MAAhBF,KAAKC,UAAoBD,KAAKC,SAAWD,KAAKE,cACnH,CApBA,WAAAC,CAAYC,EAAqBC,EAAeC,EAAqBC,EAAmCC,GALxGC,EAAAT,KAAiBE,yBACjBO,EAAAT,KAAOC,kBACPQ,EAAAT,KAAOU,uBACPD,EAAAT,KAAOW,oBAGHX,KAAKE,eAAiBE,EAAKQ,MAAMC,SAASP,GAC1CN,KAAKC,QAAUG,EAAKU,SAAST,EAAOE,GACpCP,KAAKU,aAAeN,EAAKM,aAEQ,iBAAtBN,EAAKM,aACZV,KAAKW,UAAYH,EAAKO,IAAIX,EAAKM,cACxBN,EAAKM,eACZV,KAAKW,UAAYH,EAAKO,IAAIX,EAAKM,aAAaM,eAAgBZ,EAAKM,aAAaO,mBAEtF"}
@@ -1,2 +1,2 @@
1
- import{ValidationRuleResult as t}from"./ValidationRuleResult.js";function r(t,r,e){return r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}class e{get isValid(){return this.validationResults.reduce((t,r)=>t&&r.isValid,!0)}hasError(t=!1){return Boolean(this.getError(t))}getError(t=!1){return this.validationResults.find(r=>r.hasError(t))??null}getAllErrors(){return this.validationResults.filter(t=>t.hasError())}constructor(t){r(this,"validationResults",void 0),this.validationResults=t}}class s{setRules(t){this.rules={...this.rules,...t}}getRulesFor(t){let r=this.rules[t]??this.rules.default;return Array.isArray(r)||(r=[r]),r}validate({key:r,value:s,mode:i="blur"},l){const u=this.getRulesFor(r).map(r=>new t(r,s,i,l,this.i18n));return new e(u)}constructor(t,e){r(this,"rules",{default:{validate:()=>!0,modes:["blur","input"]}}),r(this,"i18n",void 0),this.setRules(t),this.i18n=e}}export{e as ValidationResult,s as default};
1
+ import{ValidationRuleResult as t}from"./ValidationRuleResult.js";function r(t,r,e){return r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}class e{get isValid(){return this.validationResults.every(t=>!!t.isValid)}hasError(t=!1){return Boolean(this.getError(t))}getError(t=!1){return this.validationResults.find(r=>r.hasError(t))??null}getAllErrors(){return this.validationResults.filter(t=>t.hasError())}constructor(t){r(this,"validationResults",void 0),this.validationResults=t}}class s{setRules(t){this.rules={...this.rules,...t}}getRulesFor(t){let r=this.rules[t]??this.rules.default;return Array.isArray(r)||(r=[r]),r}validate({key:r,value:s,mode:i="blur"},l){const u=this.getRulesFor(r).map(r=>new t(r,s,i,l,this.i18n));return new e(u)}constructor(t,e){r(this,"rules",{default:{validate:()=>!0,modes:["blur","input"]}}),r(this,"i18n",void 0),this.setRules(t),this.i18n=e}}export{e as ValidationResult,s as default};
2
2
  //# sourceMappingURL=Validator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Validator.js","sources":["../../../../src/utils/Validator/Validator.ts"],"sourcesContent":["import { ValidatorRules, ValidatorRule, FieldContext, FieldData } from './types';\nimport { ValidationRuleResult } from './ValidationRuleResult';\nimport type Language from '../../language';\n\nexport class ValidationResult {\n private readonly validationResults: ValidationRuleResult[];\n\n constructor(results: ValidationRuleResult[]) {\n this.validationResults = results;\n }\n\n /** Checks if all validation rules have passed */\n get isValid(): boolean {\n return this.validationResults.reduce((acc, result) => acc && result.isValid, true);\n }\n\n /** Checks if any validation rule returned an error */\n hasError(isValidatingForm = false): boolean {\n return Boolean(this.getError(isValidatingForm));\n }\n\n /** Returns the first validation result that returned an error */\n getError(isValidatingForm = false): ValidationRuleResult | null {\n return this.validationResults.find(result => result.hasError(isValidatingForm)) ?? null;\n }\n\n /** Returns all validation results that returned an error */\n getAllErrors() {\n return this.validationResults.filter(result => result.hasError());\n }\n}\n\nclass Validator {\n public rules: ValidatorRules = {\n default: {\n validate: () => true,\n modes: ['blur', 'input']\n }\n };\n\n private readonly i18n: Language;\n\n constructor(rules: ValidatorRules, i18n: Language) {\n this.setRules(rules);\n this.i18n = i18n;\n }\n\n setRules(newRules: ValidatorRules) {\n this.rules = {\n ...this.rules,\n ...newRules\n };\n }\n\n /**\n * Get all validation rules for a field\n */\n private getRulesFor(field: string): ValidatorRule[] {\n let fieldRules: ValidatorRule | ValidatorRule[] = this.rules[field] ?? this.rules['default'];\n\n if (!Array.isArray(fieldRules)) {\n fieldRules = [fieldRules];\n }\n\n return fieldRules;\n }\n\n /**\n * Validates a field\n */\n validate({ key, value, mode = 'blur' }: FieldData, context?: FieldContext) {\n const fieldRules = this.getRulesFor(key);\n // create an ValidationRuleResult, we run the actual validation inside of it\n // validate is called in the constructor of ValidationRuleResult\n // line rule.validate(value, context);\n //\n const validationRulesResult = fieldRules.map(rule => new ValidationRuleResult(rule, value, mode, context, this.i18n));\n\n return new ValidationResult(validationRulesResult);\n }\n}\n\nexport default Validator;\n"],"names":["ValidationResult","isValid","this","validationResults","reduce","acc","result","hasError","isValidatingForm","Boolean","getError","find","getAllErrors","filter","constructor","results","_define_property","Validator","setRules","newRules","rules","getRulesFor","field","fieldRules","Array","isArray","validate","key","value","mode","context","validationRulesResult","map","rule","ValidationRuleResult","i18n","default","modes"],"mappings":"yLAIO,MAAMA,EAQT,WAAIC,GACA,OAAOC,KAAKC,kBAAkBC,OAAO,CAACC,EAAKC,IAAWD,GAAOC,EAAOL,SAAS,EACjF,CAGAM,QAAAA,CAASC,GAAmB,GACxB,OAAOC,QAAQP,KAAKQ,SAASF,GACjC,CAGAE,QAAAA,CAASF,GAAmB,GACxB,OAAON,KAAKC,kBAAkBQ,KAAKL,GAAUA,EAAOC,SAASC,KAAsB,IACvF,CAGAI,YAAAA,GACI,OAAOV,KAAKC,kBAAkBU,OAAOP,GAAUA,EAAOC,WAC1D,CAtBA,WAAAO,CAAYC,GAFZC,EAAAd,KAAiBC,4BAGbD,KAAKC,kBAAoBY,CAC7B,EAuBJ,MAAME,EAeFC,QAAAA,CAASC,GACLjB,KAAKkB,MAAQ,IACNlB,KAAKkB,SACLD,EAEX,CAKQE,WAAAA,CAAYC,GAChB,IAAIC,EAA8CrB,KAAKkB,MAAME,IAAUpB,KAAKkB,MAAM,QAMlF,OAJKI,MAAMC,QAAQF,KACfA,EAAa,CAACA,IAGXA,CACX,CAKAG,QAAAA,EAASC,IAAEA,EAAGC,MAAEA,EAAKC,KAAEA,EAAO,QAAqBC,GAC/C,MAKMC,EALa7B,KAAKmB,YAAYM,GAKKK,IAAIC,GAAQ,IAAIC,EAAqBD,EAAML,EAAOC,EAAMC,EAAS5B,KAAKiC,OAE/G,OAAO,IAAInC,EAAiB+B,EAChC,CArCA,WAAAjB,CAAYM,EAAuBe,GATnCnB,EAAAd,KAAOkB,QAAwB,CAC3BgB,QAAS,CACLV,SAAU,KAAM,EAChBW,MAAO,CAAC,OAAQ,YAIxBrB,EAAAd,KAAiBiC,eAGbjC,KAAKgB,SAASE,GACdlB,KAAKiC,KAAOA,CAChB"}
1
+ {"version":3,"file":"Validator.js","sources":["../../../../src/utils/Validator/Validator.ts"],"sourcesContent":["import { ValidatorRules, ValidatorRule, FieldContext, FieldData } from './types';\nimport { ValidationRuleResult } from './ValidationRuleResult';\nimport type Language from '../../language';\n\nexport class ValidationResult {\n private readonly validationResults: ValidationRuleResult[];\n\n constructor(results: ValidationRuleResult[]) {\n this.validationResults = results;\n }\n\n /** Checks if all validation rules have passed */\n get isValid(): boolean {\n return this.validationResults.every(result => !!result.isValid);\n }\n\n /** Checks if any validation rule returned an error */\n hasError(isValidatingForm = false): boolean {\n return Boolean(this.getError(isValidatingForm));\n }\n\n /** Returns the first validation result that returned an error */\n getError(isValidatingForm = false): ValidationRuleResult | null {\n return this.validationResults.find(result => result.hasError(isValidatingForm)) ?? null;\n }\n\n /** Returns all validation results that returned an error */\n getAllErrors() {\n return this.validationResults.filter(result => result.hasError());\n }\n}\n\nclass Validator {\n public rules: ValidatorRules = {\n default: {\n validate: () => true,\n modes: ['blur', 'input']\n }\n };\n\n private readonly i18n: Language;\n\n constructor(rules: ValidatorRules, i18n: Language) {\n this.setRules(rules);\n this.i18n = i18n;\n }\n\n setRules(newRules: ValidatorRules) {\n this.rules = {\n ...this.rules,\n ...newRules\n };\n }\n\n /**\n * Get all validation rules for a field\n */\n private getRulesFor(field: string): ValidatorRule[] {\n let fieldRules: ValidatorRule | ValidatorRule[] = this.rules[field] ?? this.rules['default'];\n\n if (!Array.isArray(fieldRules)) {\n fieldRules = [fieldRules];\n }\n\n return fieldRules;\n }\n\n /**\n * Validates a field\n */\n validate({ key, value, mode = 'blur' }: FieldData, context?: FieldContext) {\n const fieldRules = this.getRulesFor(key);\n // create an ValidationRuleResult, we run the actual validation inside of it\n // validate is called in the constructor of ValidationRuleResult\n // line rule.validate(value, context);\n //\n const validationRulesResult = fieldRules.map(rule => new ValidationRuleResult(rule, value, mode, context, this.i18n));\n\n return new ValidationResult(validationRulesResult);\n }\n}\n\nexport default Validator;\n"],"names":["ValidationResult","isValid","this","validationResults","every","result","hasError","isValidatingForm","Boolean","getError","find","getAllErrors","filter","constructor","results","_define_property","Validator","setRules","newRules","rules","getRulesFor","field","fieldRules","Array","isArray","validate","key","value","mode","context","validationRulesResult","map","rule","ValidationRuleResult","i18n","default","modes"],"mappings":"yLAIO,MAAMA,EAQT,WAAIC,GACA,OAAOC,KAAKC,kBAAkBC,MAAMC,KAAYA,EAAOJ,QAC3D,CAGAK,QAAAA,CAASC,GAAmB,GACxB,OAAOC,QAAQN,KAAKO,SAASF,GACjC,CAGAE,QAAAA,CAASF,GAAmB,GACxB,OAAOL,KAAKC,kBAAkBO,KAAKL,GAAUA,EAAOC,SAASC,KAAsB,IACvF,CAGAI,YAAAA,GACI,OAAOT,KAAKC,kBAAkBS,OAAOP,GAAUA,EAAOC,WAC1D,CAtBA,WAAAO,CAAYC,GAFZC,EAAAb,KAAiBC,4BAGbD,KAAKC,kBAAoBW,CAC7B,EAuBJ,MAAME,EAeFC,QAAAA,CAASC,GACLhB,KAAKiB,MAAQ,IACNjB,KAAKiB,SACLD,EAEX,CAKQE,WAAAA,CAAYC,GAChB,IAAIC,EAA8CpB,KAAKiB,MAAME,IAAUnB,KAAKiB,MAAM,QAMlF,OAJKI,MAAMC,QAAQF,KACfA,EAAa,CAACA,IAGXA,CACX,CAKAG,QAAAA,EAASC,IAAEA,EAAGC,MAAEA,EAAKC,KAAEA,EAAO,QAAqBC,GAC/C,MAKMC,EALa5B,KAAKkB,YAAYM,GAKKK,IAAIC,GAAQ,IAAIC,EAAqBD,EAAML,EAAOC,EAAMC,EAAS3B,KAAKgC,OAE/G,OAAO,IAAIlC,EAAiB8B,EAChC,CArCA,WAAAjB,CAAYM,EAAuBe,GATnCnB,EAAAb,KAAOiB,QAAwB,CAC3BgB,QAAS,CACLV,SAAU,KAAM,EAChBW,MAAO,CAAC,OAAQ,YAIxBrB,EAAAb,KAAiBgC,eAGbhC,KAAKe,SAASE,GACdjB,KAAKgC,KAAOA,CAChB"}
@@ -1,2 +1,2 @@
1
- import{isEmpty as e}from"../validator-utils.js";import{ERROR_FIELD_REQUIRED as r,ERROR_FIELD_INVALID as t}from"../../core/Errors/constants.js";import{email as s,telephoneNumber as o}from"../regex.js";import{unformatDate as a}from"../../components/internal/FormFields/InputDate/utils.js";const l={validate:s=>((s,a)=>e(s)?(a.errorMessage=r,null):(a.errorMessage=t,o.test(s)))(s,l),modes:["blur"]},n={validate:o=>((o,a)=>e(o)?(a.errorMessage=r,null):(a.errorMessage=t,o.length>=6&&o.length<=320&&s.test(o)))(o,n),modes:["blur"]},i={validate:e=>((e,t)=>{if(!e)return t.errorMessage=r,!1;t.errorMessage="dateOfBirth.invalid";const s=a(e),o=Date.now()-Date.parse(s);return new Date(o).getFullYear()-1970>=18})(e,i),modes:["blur"]},m={phoneNumberRule:l,emailRule:n,dateOfBirthRule:i};export{m as validationRules};
1
+ import{isEmpty as e}from"../validator-utils.js";import{ERROR_FIELD_REQUIRED as r,ERROR_FIELD_INVALID as t}from"../../core/Errors/constants.js";import{email as s,telephoneNumber as o}from"../regex.js";import{unformatDate as a}from"../../components/internal/FormFields/InputDate/utils.js";const l={validate:s=>((s,a)=>e(s)?(a.errorMessage=r,null):(a.errorMessage=t,o.test(s)))(s,l),modes:["blur"]},n={validate:o=>((o,a)=>e(o)?(a.errorMessage=r,null):(a.errorMessage=t,o.length>=6&&o.length<=320&&s.test(o)))(o,n),modes:["blur"]},i={validate:e=>((e,t)=>{if(!e)return t.errorMessage=r,!1;t.errorMessage="dateOfBirth.invalid";const s=a(e);if(!s)return!1;const o=Date.now()-Date.parse(s);return new Date(o).getFullYear()-1970>=18})(e,i),modes:["blur"]},u={phoneNumberRule:l,emailRule:n,dateOfBirthRule:i};export{u as validationRules};
2
2
  //# sourceMappingURL=defaultRules.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"defaultRules.js","sources":["../../../../src/utils/Validator/defaultRules.ts"],"sourcesContent":["import { ValidatorRule } from './types';\nimport { isEmpty } from '../validator-utils';\nimport { ERROR_FIELD_INVALID, ERROR_FIELD_REQUIRED } from '../../core/Errors/constants';\nimport { email, telephoneNumber } from '../regex';\nimport { unformatDate } from '../../components/internal/FormFields/InputDate/utils';\n\nconst isPhoneValid = (value: string, validationRule: ValidatorRule): boolean | null => {\n if (isEmpty(value)) {\n validationRule.errorMessage = ERROR_FIELD_REQUIRED;\n return null;\n }\n validationRule.errorMessage = ERROR_FIELD_INVALID;\n return telephoneNumber.test(value);\n};\n\nconst isEmailValid = (value: string, validationRule: ValidatorRule): boolean | null => {\n if (isEmpty(value)) {\n validationRule.errorMessage = ERROR_FIELD_REQUIRED;\n return null;\n }\n validationRule.errorMessage = ERROR_FIELD_INVALID;\n return value.length >= 6 && value.length <= 320 && email.test(value);\n};\n\nconst isDateOfBirthValid = (value: string, validationRule: ValidatorRule): boolean | null => {\n if (!value) {\n validationRule.errorMessage = ERROR_FIELD_REQUIRED;\n return false;\n }\n validationRule.errorMessage = 'dateOfBirth.invalid';\n const rawValue = unformatDate(value);\n const ageDiff = Date.now() - Date.parse(rawValue);\n const age = new Date(ageDiff).getFullYear() - 1970;\n return age >= 18;\n};\n\nconst phoneNumberRule: ValidatorRule = {\n validate: value => isPhoneValid(value, phoneNumberRule),\n modes: ['blur']\n};\n\nconst emailRule: ValidatorRule = {\n validate: value => isEmailValid(value, emailRule),\n modes: ['blur']\n};\n\nconst dateOfBirthRule: ValidatorRule = {\n validate: value => isDateOfBirthValid(value, dateOfBirthRule),\n modes: ['blur']\n};\n\nexport const validationRules = { phoneNumberRule, emailRule, dateOfBirthRule };\n"],"names":["phoneNumberRule","validate","value","validationRule","isEmpty","errorMessage","ERROR_FIELD_REQUIRED","ERROR_FIELD_INVALID","telephoneNumber","test","isPhoneValid","modes","emailRule","length","email","isEmailValid","dateOfBirthRule","rawValue","unformatDate","ageDiff","Date","now","parse","getFullYear","isDateOfBirthValid","validationRules"],"mappings":"+RAMA,MA8BMA,EAAiC,CACnCC,SAAUC,GA/BO,EAACA,EAAeC,IAC7BC,EAAQF,IACRC,EAAeE,aAAeC,EACvB,OAEXH,EAAeE,aAAeE,EACvBC,EAAgBC,KAAKP,IAyBTQ,CAAaR,EAAOF,GACvCW,MAAO,CAAC,SAGNC,EAA2B,CAC7BX,SAAUC,GA3BO,EAACA,EAAeC,IAC7BC,EAAQF,IACRC,EAAeE,aAAeC,EACvB,OAEXH,EAAeE,aAAeE,EACvBL,EAAMW,QAAU,GAAKX,EAAMW,QAAU,KAAOC,EAAML,KAAKP,IAqB3Ca,CAAab,EAAOU,GACvCD,MAAO,CAAC,SAGNK,EAAiC,CACnCf,SAAUC,GAvBa,EAACA,EAAeC,KACvC,IAAKD,EAED,OADAC,EAAeE,aAAeC,GACvB,EAEXH,EAAeE,aAAe,sBAC9B,MAAMY,EAAWC,EAAahB,GACxBiB,EAAUC,KAAKC,MAAQD,KAAKE,MAAML,GAExC,OADY,IAAIG,KAAKD,GAASI,cAAgB,MAChC,IAcKC,CAAmBtB,EAAOc,GAC7CL,MAAO,CAAC,SAGCc,EAAkB,CAAEzB,kBAAiBY,YAAWI"}
1
+ {"version":3,"file":"defaultRules.js","sources":["../../../../src/utils/Validator/defaultRules.ts"],"sourcesContent":["import { ValidatorRule } from './types';\nimport { isEmpty } from '../validator-utils';\nimport { ERROR_FIELD_INVALID, ERROR_FIELD_REQUIRED } from '../../core/Errors/constants';\nimport { email, telephoneNumber } from '../regex';\nimport { unformatDate } from '../../components/internal/FormFields/InputDate/utils';\n\nconst isPhoneValid = (value: string, validationRule: ValidatorRule): boolean | null => {\n if (isEmpty(value)) {\n validationRule.errorMessage = ERROR_FIELD_REQUIRED;\n return null;\n }\n validationRule.errorMessage = ERROR_FIELD_INVALID;\n return telephoneNumber.test(value);\n};\n\nconst isEmailValid = (value: string, validationRule: ValidatorRule): boolean | null => {\n if (isEmpty(value)) {\n validationRule.errorMessage = ERROR_FIELD_REQUIRED;\n return null;\n }\n validationRule.errorMessage = ERROR_FIELD_INVALID;\n return value.length >= 6 && value.length <= 320 && email.test(value);\n};\n\nconst isDateOfBirthValid = (value: string, validationRule: ValidatorRule): boolean | null => {\n if (!value) {\n validationRule.errorMessage = ERROR_FIELD_REQUIRED;\n return false;\n }\n validationRule.errorMessage = 'dateOfBirth.invalid';\n const rawValue = unformatDate(value);\n if (!rawValue) return false;\n const ageDiff = Date.now() - Date.parse(rawValue);\n const age = new Date(ageDiff).getFullYear() - 1970;\n return age >= 18;\n};\n\nconst phoneNumberRule: ValidatorRule = {\n validate: value => isPhoneValid(value, phoneNumberRule),\n modes: ['blur']\n};\n\nconst emailRule: ValidatorRule = {\n validate: value => isEmailValid(value, emailRule),\n modes: ['blur']\n};\n\nconst dateOfBirthRule: ValidatorRule = {\n validate: value => isDateOfBirthValid(value, dateOfBirthRule),\n modes: ['blur']\n};\n\nexport const validationRules = { phoneNumberRule, emailRule, dateOfBirthRule };\n"],"names":["phoneNumberRule","validate","value","validationRule","isEmpty","errorMessage","ERROR_FIELD_REQUIRED","ERROR_FIELD_INVALID","telephoneNumber","test","isPhoneValid","modes","emailRule","length","email","isEmailValid","dateOfBirthRule","rawValue","unformatDate","ageDiff","Date","now","parse","getFullYear","isDateOfBirthValid","validationRules"],"mappings":"+RAMA,MA+BMA,EAAiC,CACnCC,SAAUC,GAhCO,EAACA,EAAeC,IAC7BC,EAAQF,IACRC,EAAeE,aAAeC,EACvB,OAEXH,EAAeE,aAAeE,EACvBC,EAAgBC,KAAKP,IA0BTQ,CAAaR,EAAOF,GACvCW,MAAO,CAAC,SAGNC,EAA2B,CAC7BX,SAAUC,GA5BO,EAACA,EAAeC,IAC7BC,EAAQF,IACRC,EAAeE,aAAeC,EACvB,OAEXH,EAAeE,aAAeE,EACvBL,EAAMW,QAAU,GAAKX,EAAMW,QAAU,KAAOC,EAAML,KAAKP,IAsB3Ca,CAAab,EAAOU,GACvCD,MAAO,CAAC,SAGNK,EAAiC,CACnCf,SAAUC,GAxBa,EAACA,EAAeC,KACvC,IAAKD,EAED,OADAC,EAAeE,aAAeC,GACvB,EAEXH,EAAeE,aAAe,sBAC9B,MAAMY,EAAWC,EAAahB,GAC9B,IAAKe,EAAU,OAAO,EACtB,MAAME,EAAUC,KAAKC,MAAQD,KAAKE,MAAML,GAExC,OADY,IAAIG,KAAKD,GAASI,cAAgB,MAChC,IAcKC,CAAmBtB,EAAOc,GAC7CL,MAAO,CAAC,SAGCc,EAAkB,CAAEzB,kBAAiBY,YAAWI"}
@@ -1,2 +1,2 @@
1
- import r from"./constants/currency-decimals.js";import{currencyMinorUnitsConfig as t}from"./constants/currency-minor-units.js";const n=t=>r[t]||100,e=(r,t)=>{const e=n(t);return parseInt(String(r),10)/e},c=(r,n,c,o={})=>{const s=r.toString(),u=e(s,c),y=n.replace("_","-"),i={style:"currency",currency:c,currencyDisplay:"symbol",...t[c]?{...o,...t[c]}:o};try{return u.toLocaleString(y,i)}catch(r){return s}},o=r=>{if(!r||"object"!=typeof r)return!1;const t="number"==typeof r.value&&!Number.isNaN(r.value),n="string"==typeof r.currency&&r.currency.length>0,e=void 0===r.currencyDisplay||"string"==typeof r.currencyDisplay;return t&&n&&e};export{e as getDecimalAmount,n as getDivider,c as getLocalisedAmount,o as isAmountValid};
1
+ import r from"./constants/currency-decimals.js";import{currencyMinorUnitsConfig as t}from"./constants/currency-minor-units.js";const n=t=>r[t]||100,c=(r,t)=>{const c=n(t);return parseInt(String(r),10)/c},e=(r,n,e,o={})=>{const s=r.toString(),u=c(s,e),y={style:"currency",currency:e,currencyDisplay:"symbol",...t[e]?{...o,...t[e]}:o};try{return u.toLocaleString(n,y)}catch(r){return s}},o=r=>{if(!r||"object"!=typeof r)return!1;const t="number"==typeof r.value&&!Number.isNaN(r.value),n="string"==typeof r.currency&&r.currency.length>0,c=void 0===r.currencyDisplay||"string"==typeof r.currencyDisplay;return t&&n&&c};export{c as getDecimalAmount,n as getDivider,e as getLocalisedAmount,o as isAmountValid};
2
2
  //# sourceMappingURL=amount-util.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"amount-util.js","sources":["../../../src/utils/amount-util.ts"],"sourcesContent":["import { PaymentAmount } from '../types';\nimport CURRENCY_DECIMALS from './constants/currency-decimals';\nimport { currencyMinorUnitsConfig } from './constants/currency-minor-units';\n\n/**\n * @internal\n * @param currencyCode -\n * Get divider amount\n */\nexport const getDivider = (currencyCode: string): number => {\n const divider = CURRENCY_DECIMALS[currencyCode as keyof typeof CURRENCY_DECIMALS];\n return divider || 100;\n};\n\n/**\n * @internal\n */\nexport const getDecimalAmount = (amount: number | string, currencyCode: string): number => {\n const divider = getDivider(currencyCode);\n return parseInt(String(amount), 10) / divider;\n};\n\n/**\n * @internal\n */\nexport const getLocalisedAmount = (amount: number, locale: string, currencyCode: string, options = {}): string => {\n const stringAmount = amount.toString(); // Changing amount to string to avoid 0-value from returning false\n\n const decimalAmount = getDecimalAmount(stringAmount, currencyCode);\n const formattedLocale = locale.replace('_', '-');\n\n const modifiedOptions = currencyMinorUnitsConfig[currencyCode] ? { ...options, ...currencyMinorUnitsConfig[currencyCode] } : options;\n\n const localeOptions: Intl.NumberFormatOptions = {\n style: 'currency',\n currency: currencyCode,\n currencyDisplay: 'symbol',\n ...modifiedOptions\n };\n\n try {\n return decimalAmount.toLocaleString(formattedLocale, localeOptions);\n } catch (e) {\n return stringAmount;\n }\n};\n\n/**\n * Validates a payment amount object.\n *\n * @param amount - The payment amount object to validate\n * @returns True if the amount has a valid numeric value, non-empty currency string,\n * and optionally a valid currencyDisplay string\n */\nexport const isAmountValid = (amount: PaymentAmount): boolean => {\n if (!amount || typeof amount !== 'object') {\n return false;\n }\n\n const hasValidValue = typeof amount.value === 'number' && !Number.isNaN(amount.value);\n const hasValidCurrency = typeof amount.currency === 'string' && amount.currency.length > 0;\n const hasValidCurrencyDisplay = amount.currencyDisplay === undefined || typeof amount.currencyDisplay === 'string';\n\n return hasValidValue && hasValidCurrency && hasValidCurrencyDisplay;\n};\n"],"names":["getDivider","currencyCode","CURRENCY_DECIMALS","getDecimalAmount","amount","divider","parseInt","String","getLocalisedAmount","locale","options","stringAmount","toString","decimalAmount","formattedLocale","replace","localeOptions","style","currency","currencyDisplay","currencyMinorUnitsConfig","toLocaleString","e","isAmountValid","hasValidValue","value","Number","isNaN","hasValidCurrency","length","hasValidCurrencyDisplay","undefined"],"mappings":"+HASO,MAAMA,EAAcC,GACPC,EAAkBD,IAChB,IAMTE,EAAmB,CAACC,EAAyBH,KACtD,MAAMI,EAAUL,EAAWC,GAC3B,OAAOK,SAASC,OAAOH,GAAS,IAAMC,GAM7BG,EAAqB,CAACJ,EAAgBK,EAAgBR,EAAsBS,EAAU,MAC/F,MAAMC,EAAeP,EAAOQ,WAEtBC,EAAgBV,EAAiBQ,EAAcV,GAC/Ca,EAAkBL,EAAOM,QAAQ,IAAK,KAItCC,EAA0C,CAC5CC,MAAO,WACPC,SAAUjB,EACVkB,gBAAiB,YALGC,EAAyBnB,GAAgB,IAAKS,KAAYU,EAAyBnB,IAAkBS,GAS7H,IACI,OAAOG,EAAcQ,eAAeP,EAAiBE,EACzD,CAAE,MAAOM,GACL,OAAOX,CACX,GAUSY,EAAiBnB,IAC1B,IAAKA,GAA4B,iBAAXA,EAClB,OAAO,EAGX,MAAMoB,EAAwC,iBAAjBpB,EAAOqB,QAAuBC,OAAOC,MAAMvB,EAAOqB,OACzEG,EAA8C,iBAApBxB,EAAOc,UAAyBd,EAAOc,SAASW,OAAS,EACnFC,OAAqDC,IAA3B3B,EAAOe,iBAAmE,iBAA3Bf,EAAOe,gBAEtF,OAAOK,GAAiBI,GAAoBE"}
1
+ {"version":3,"file":"amount-util.js","sources":["../../../src/utils/amount-util.ts"],"sourcesContent":["import { PaymentAmount } from '../types';\nimport CURRENCY_DECIMALS from './constants/currency-decimals';\nimport { currencyMinorUnitsConfig } from './constants/currency-minor-units';\n\n/**\n * @internal\n * @param currencyCode -\n * Get divider amount\n */\nexport const getDivider = (currencyCode: string): number => {\n const divider = CURRENCY_DECIMALS[currencyCode as keyof typeof CURRENCY_DECIMALS];\n return divider || 100;\n};\n\n/**\n * @internal\n */\nexport const getDecimalAmount = (amount: number | string, currencyCode: string): number => {\n const divider = getDivider(currencyCode);\n return parseInt(String(amount), 10) / divider;\n};\n\n/**\n * @internal\n */\nexport const getLocalisedAmount = (amount: number, locale: string, currencyCode: string, options = {}): string => {\n const stringAmount = amount.toString(); // Changing amount to string to avoid 0-value from returning false\n\n const decimalAmount = getDecimalAmount(stringAmount, currencyCode);\n\n const modifiedOptions = currencyMinorUnitsConfig[currencyCode] ? { ...options, ...currencyMinorUnitsConfig[currencyCode] } : options;\n\n const localeOptions: Intl.NumberFormatOptions = {\n style: 'currency',\n currency: currencyCode,\n currencyDisplay: 'symbol',\n ...modifiedOptions\n };\n\n try {\n return decimalAmount.toLocaleString(locale, localeOptions);\n } catch (e) {\n return stringAmount;\n }\n};\n\n/**\n * Validates a payment amount object.\n *\n * @param amount - The payment amount object to validate\n * @returns True if the amount has a valid numeric value, non-empty currency string,\n * and optionally a valid currencyDisplay string\n */\nexport const isAmountValid = (amount: PaymentAmount): boolean => {\n if (!amount || typeof amount !== 'object') {\n return false;\n }\n\n const hasValidValue = typeof amount.value === 'number' && !Number.isNaN(amount.value);\n const hasValidCurrency = typeof amount.currency === 'string' && amount.currency.length > 0;\n const hasValidCurrencyDisplay = amount.currencyDisplay === undefined || typeof amount.currencyDisplay === 'string';\n\n return hasValidValue && hasValidCurrency && hasValidCurrencyDisplay;\n};\n"],"names":["getDivider","currencyCode","CURRENCY_DECIMALS","getDecimalAmount","amount","divider","parseInt","String","getLocalisedAmount","locale","options","stringAmount","toString","decimalAmount","localeOptions","style","currency","currencyDisplay","currencyMinorUnitsConfig","toLocaleString","e","isAmountValid","hasValidValue","value","Number","isNaN","hasValidCurrency","length","hasValidCurrencyDisplay","undefined"],"mappings":"+HASO,MAAMA,EAAcC,GACPC,EAAkBD,IAChB,IAMTE,EAAmB,CAACC,EAAyBH,KACtD,MAAMI,EAAUL,EAAWC,GAC3B,OAAOK,SAASC,OAAOH,GAAS,IAAMC,GAM7BG,EAAqB,CAACJ,EAAgBK,EAAgBR,EAAsBS,EAAU,MAC/F,MAAMC,EAAeP,EAAOQ,WAEtBC,EAAgBV,EAAiBQ,EAAcV,GAI/Ca,EAA0C,CAC5CC,MAAO,WACPC,SAAUf,EACVgB,gBAAiB,YALGC,EAAyBjB,GAAgB,IAAKS,KAAYQ,EAAyBjB,IAAkBS,GAS7H,IACI,OAAOG,EAAcM,eAAeV,EAAQK,EAChD,CAAE,MAAOM,GACL,OAAOT,CACX,GAUSU,EAAiBjB,IAC1B,IAAKA,GAA4B,iBAAXA,EAClB,OAAO,EAGX,MAAMkB,EAAwC,iBAAjBlB,EAAOmB,QAAuBC,OAAOC,MAAMrB,EAAOmB,OACzEG,EAA8C,iBAApBtB,EAAOY,UAAyBZ,EAAOY,SAASW,OAAS,EACnFC,OAAqDC,IAA3BzB,EAAOa,iBAAmE,iBAA3Bb,EAAOa,gBAEtF,OAAOK,GAAiBI,GAAoBE"}
@@ -1 +1 @@
1
- {"version":3,"file":"browserInfo.js","sources":["../../../src/utils/browserInfo.ts"],"sourcesContent":["import type { BrowserInfo } from '../types/global-types';\n\n/**\n * Collects available frontend browser info and store it in the properties dictated by the EMVCo spec\n * (3DS_Spec_protocolAndCoreFny_v2-1_Oct2017.pdf)\n *\n * @example\n * ```js\n * const browserInfo = collectBrowserInfo();\n * ```\n *\n * @returns An object containing the retrieved browser properties\n */\nexport default function collectBrowserInfo(): BrowserInfo {\n if (typeof window === 'undefined') {\n return;\n }\n const colorDepth = window.screen.colorDepth;\n const screenHeight = window.screen.height;\n const screenWidth = window.screen.width;\n const userAgent = window.navigator.userAgent;\n\n const language = window.navigator.language || 'en';\n const timeZoneOffset = new Date().getTimezoneOffset();\n\n return {\n acceptHeader: '*/*',\n javaEnabled: false,\n colorDepth,\n language,\n screenHeight,\n screenWidth,\n userAgent,\n timeZoneOffset\n };\n}\n"],"names":["collectBrowserInfo","window","colorDepth","screen","screenHeight","height","screenWidth","width","userAgent","navigator","acceptHeader","javaEnabled","language","timeZoneOffset","Date","getTimezoneOffset"],"mappings":"AAae,SAASA,IACpB,GAAsB,oBAAXC,OACP,OAEJ,MAAMC,EAAaD,OAAOE,OAAOD,WAC3BE,EAAeH,OAAOE,OAAOE,OAC7BC,EAAcL,OAAOE,OAAOI,MAC5BC,EAAYP,OAAOQ,UAAUD,UAKnC,MAAO,CACHE,aAAc,MACdC,aAAa,EACbT,aACAU,SAPaX,OAAOQ,UAAUG,UAAY,KAQ1CR,eACAE,cACAE,YACAK,gBAVmB,IAAIC,MAAOC,oBAYtC"}
1
+ {"version":3,"file":"browserInfo.js","sources":["../../../src/utils/browserInfo.ts"],"sourcesContent":["import type { BrowserInfo } from '../types/global-types';\n\n/**\n * Collects available frontend browser info and store it in the properties dictated by the EMVCo spec\n * (3DS_Spec_protocolAndCoreFny_v2-1_Oct2017.pdf)\n *\n * @example\n * ```js\n * const browserInfo = collectBrowserInfo();\n * ```\n *\n * @returns An object containing the retrieved browser properties\n */\nexport default function collectBrowserInfo(): BrowserInfo | undefined {\n if (typeof window === 'undefined') {\n return;\n }\n const colorDepth = window.screen.colorDepth;\n const screenHeight = window.screen.height;\n const screenWidth = window.screen.width;\n const userAgent = window.navigator.userAgent;\n\n const language = window.navigator.language || 'en';\n const timeZoneOffset = new Date().getTimezoneOffset();\n\n return {\n acceptHeader: '*/*',\n javaEnabled: false,\n colorDepth,\n language,\n screenHeight,\n screenWidth,\n userAgent,\n timeZoneOffset\n };\n}\n"],"names":["collectBrowserInfo","window","colorDepth","screen","screenHeight","height","screenWidth","width","userAgent","navigator","acceptHeader","javaEnabled","language","timeZoneOffset","Date","getTimezoneOffset"],"mappings":"AAae,SAASA,IACpB,GAAsB,oBAAXC,OACP,OAEJ,MAAMC,EAAaD,OAAOE,OAAOD,WAC3BE,EAAeH,OAAOE,OAAOE,OAC7BC,EAAcL,OAAOE,OAAOI,MAC5BC,EAAYP,OAAOQ,UAAUD,UAKnC,MAAO,CACHE,aAAc,MACdC,aAAa,EACbT,aACAU,SAPaX,OAAOQ,UAAUG,UAAY,KAQ1CR,eACAE,cACAE,YACAK,gBAVmB,IAAIC,MAAOC,oBAYtC"}
@@ -1,2 +1,2 @@
1
- import t from"./base64.js";import{LIBRARY_VERSION as e,PLATFORM as o,CHANNEL as n}from"../core/config.js";function a({checkoutAttemptId:a,clientData:i,paymentMethodBehavior:r,paymentMethodConfiguration:c}){const m={schemaVersion:1,createdAt:Date.now(),channel:n.WEB,platform:o,sdkVersion:e,paymentMethodBehavior:r,analytics:{checkoutAttemptId:a},...i&&{riskData:{clientData:i}},...c&&{paymentMethodConfiguration:c}};return t.encode(JSON.stringify(m))}export{a as createSdkData};
1
+ import t from"./base64.js";import{LIBRARY_VERSION as e,PLATFORM as o,CHANNEL as n}from"../core/config.js";function r(r,a,c){const i={schemaVersion:1,createdAt:Date.now(),channel:n.WEB,platform:o,sdkVersion:e,paymentMethodBehavior:c,analytics:{checkoutAttemptId:r},...a&&{riskData:{clientData:a}}};return t.encode(JSON.stringify(i))}export{r as createSdkData};
2
2
  //# sourceMappingURL=createSdkData.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createSdkData.js","sources":["../../../src/utils/createSdkData.ts"],"sourcesContent":["import base64 from './base64';\nimport { LIBRARY_VERSION, CHANNEL, PLATFORM, PAYMENT_METHOD_BEHAVIOR } from '../core/config';\nexport interface SdkDataObject {\n schemaVersion: number;\n createdAt: number;\n channel: CHANNEL;\n platform: string;\n sdkVersion: string;\n paymentMethodBehavior: PAYMENT_METHOD_BEHAVIOR;\n analytics: {\n checkoutAttemptId: string;\n };\n riskData: {\n clientData: string;\n };\n paymentMethodConfiguration?: SdkDataPaymentMethodConfiguration;\n}\n\nexport interface SdkDataPaymentMethodConfiguration {\n // PayPal component specific configuration\n supportsPayPalV6?: boolean;\n}\n\nexport interface CreateSdkDataParams {\n checkoutAttemptId: string;\n clientData: string | null;\n paymentMethodBehavior: PAYMENT_METHOD_BEHAVIOR;\n paymentMethodConfiguration?: SdkDataPaymentMethodConfiguration;\n}\n\n/**\n * @param params - The parameters for creating the SDK data\n * @param params.checkoutAttemptId - The checkout attempt ID from analytics\n * @param params.clientData - The client data from risk module\n * @param params.paymentMethodBehavior - The payment method behavior\n * @param params.paymentMethodConfiguration - The payment method configuration\n * @returns Base64 encoded JSON string of the SDK data object\n */\nexport function createSdkData({ checkoutAttemptId, clientData, paymentMethodBehavior, paymentMethodConfiguration }: CreateSdkDataParams): string {\n const sdkDataObject: SdkDataObject = {\n schemaVersion: 1,\n createdAt: Date.now(),\n channel: CHANNEL.WEB,\n platform: PLATFORM,\n sdkVersion: LIBRARY_VERSION,\n paymentMethodBehavior,\n analytics: {\n checkoutAttemptId\n },\n ...(clientData && { riskData: { clientData } }),\n ...(paymentMethodConfiguration && { paymentMethodConfiguration })\n };\n\n return base64.encode(JSON.stringify(sdkDataObject));\n}\n"],"names":["createSdkData","checkoutAttemptId","clientData","paymentMethodBehavior","paymentMethodConfiguration","sdkDataObject","schemaVersion","createdAt","Date","now","channel","CHANNEL","WEB","platform","PLATFORM","sdkVersion","LIBRARY_VERSION","analytics","riskData","base64","encode","JSON","stringify"],"mappings":"0GAsCO,SAASA,GAAcC,kBAAEA,EAAiBC,WAAEA,EAAUC,sBAAEA,EAAqBC,2BAAEA,IAClF,MAAMC,EAA+B,CACjCC,cAAe,EACfC,UAAWC,KAAKC,MAChBC,QAASC,EAAQC,IACjBC,SAAUC,EACVC,WAAYC,EACZb,wBACAc,UAAW,CACPhB,wBAEAC,GAAc,CAAEgB,SAAU,CAAEhB,kBAC5BE,GAA8B,CAAEA,+BAGxC,OAAOe,EAAOC,OAAOC,KAAKC,UAAUjB,GACxC"}
1
+ {"version":3,"file":"createSdkData.js","sources":["../../../src/utils/createSdkData.ts"],"sourcesContent":["import base64 from './base64';\nimport { LIBRARY_VERSION, CHANNEL, PLATFORM, PAYMENT_METHOD_BEHAVIOR } from '../core/config';\nexport interface SdkDataObject {\n schemaVersion: number;\n createdAt: number;\n channel: CHANNEL;\n platform: string;\n sdkVersion: string;\n paymentMethodBehavior: PAYMENT_METHOD_BEHAVIOR;\n analytics: {\n checkoutAttemptId: string;\n };\n riskData?: {\n clientData: string;\n };\n}\n\n/**\n * Creates the sdkData object with analytics and risk information\n * @param checkoutAttemptId - The checkout attempt ID from analytics\n * @param clientData - The client data from risk module\n * @returns Base64 encoded JSON string of the SDK data object\n */\nexport function createSdkData(checkoutAttemptId: string, clientData: string | null, paymentMethodBehavior: PAYMENT_METHOD_BEHAVIOR): string {\n const sdkDataObject: SdkDataObject = {\n schemaVersion: 1,\n createdAt: Date.now(),\n channel: CHANNEL.WEB,\n platform: PLATFORM,\n sdkVersion: LIBRARY_VERSION,\n paymentMethodBehavior,\n analytics: {\n checkoutAttemptId\n },\n ...(clientData && { riskData: { clientData } })\n };\n\n return base64.encode(JSON.stringify(sdkDataObject));\n}\n"],"names":["createSdkData","checkoutAttemptId","clientData","paymentMethodBehavior","sdkDataObject","schemaVersion","createdAt","Date","now","channel","CHANNEL","WEB","platform","PLATFORM","sdkVersion","LIBRARY_VERSION","analytics","riskData","base64","encode","JSON","stringify"],"mappings":"0GAuBO,SAASA,EAAcC,EAA2BC,EAA2BC,GAChF,MAAMC,EAA+B,CACjCC,cAAe,EACfC,UAAWC,KAAKC,MAChBC,QAASC,EAAQC,IACjBC,SAAUC,EACVC,WAAYC,EACZZ,wBACAa,UAAW,CACPf,wBAEAC,GAAc,CAAEe,SAAU,CAAEf,gBAGpC,OAAOgB,EAAOC,OAAOC,KAAKC,UAAUjB,GACxC"}
@@ -1,2 +1,2 @@
1
- const t=(t,e,r)=>n=>{if(!n)return null;const l={parentFolder:n?`${e}/`:"",type:n||e,...t};return r(l)(n)};export{t as default};
1
+ const t=(t,e,r)=>n=>{if(!n)return;const o={parentFolder:`${e}/`,type:n,...t};return r(o)(n)};export{t as default};
2
2
  //# sourceMappingURL=get-issuer-image.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-issuer-image.js","sources":["../../../src/utils/get-issuer-image.ts"],"sourcesContent":["import { ImageOptions } from '../core/Context/Resources';\nimport { UseImageHookType } from '../core/Context/useImage';\n\nconst getIssuerImageUrl =\n (options: object, type: string, getImage: UseImageHookType) =>\n (issuer: string): string => {\n if (!issuer) return null;\n\n const imageOptions: ImageOptions = {\n parentFolder: issuer ? `${type}/` : '',\n type: issuer || type,\n ...options\n };\n\n return getImage(imageOptions)(issuer);\n };\n\nexport default getIssuerImageUrl;\n"],"names":["getIssuerImageUrl","options","type","getImage","issuer","imageOptions","parentFolder"],"mappings":"AAGA,MAAMA,EACF,CAACC,EAAiBC,EAAcC,IAC/BC,IACG,IAAKA,EAAQ,OAAO,KAEpB,MAAMC,EAA6B,CAC/BC,aAAcF,EAAS,GAAGF,KAAU,GACpCA,KAAME,GAAUF,KACbD,GAGP,OAAOE,EAASE,EAATF,CAAuBC"}
1
+ {"version":3,"file":"get-issuer-image.js","sources":["../../../src/utils/get-issuer-image.ts"],"sourcesContent":["import type { ImageOptions } from '../core/Context/Resources';\nimport type { UseImageHookType } from '../core/Context/useImage';\n\n/**\n * USAGE:\n * Use getIssuerImageUrl() when rendering a list of issuer logos under logos/{txVariant}/{issuer}.svg\n * For anything else, like when you just need a single, named, asset - use Resources.getImage()\n */\n\nconst getIssuerImageUrl =\n (options: ImageOptions, type: string, getImage: UseImageHookType) =>\n (issuer: string | undefined): string | undefined => {\n if (!issuer) return undefined;\n\n const imageOptions: ImageOptions = {\n parentFolder: `${type}/`,\n type: issuer,\n ...options\n };\n\n return getImage(imageOptions)(issuer);\n };\n\nexport default getIssuerImageUrl;\n"],"names":["getIssuerImageUrl","options","type","getImage","issuer","imageOptions","parentFolder"],"mappings":"MASMA,EACF,CAACC,EAAuBC,EAAcC,IACrCC,IACG,IAAKA,EAAQ,OAEb,MAAMC,EAA6B,CAC/BC,aAAc,GAAGJ,KACjBA,KAAME,KACHH,GAGP,OAAOE,EAASE,EAATF,CAAuBC"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-process-message-handler.js","sources":["../../../src/utils/get-process-message-handler.ts"],"sourcesContent":["/**\n * Centralised window.postMessage processing function used in 3DS2 components and *also* by the RiskModule's device fingerprinting process\n * NOTE: this latter use case means that while the deviceFingerprinting is still completing this component is also listening to\n * securedFields related postMessaging\n *\n * @param domain - expected domain for the postMesssage to have originated from\n * @param resolve - the resolve function from the Promise that called this function\n * @param reject - the reject function from the Promise that called this function\n * @param parseErrorObj - an error object to log in the case of unparseable data (albeit from a valid origin)\n * @param expectedType - string to check that the message event's data has the expected type\n */\nimport { hasOwnProperty } from './hasOwnProperty';\nimport { PostMsgParseErrorObject } from '../components/ThreeDS2/types';\n\nconst getProcessMessageHandler =\n (\n domain: string,\n resolve: (value: unknown) => void,\n reject: (reason?: unknown) => void,\n expectedType: string\n ): ((event: Pick<MessageEvent, 'origin' | 'data'>) => string | boolean) =>\n (event: Pick<MessageEvent, 'origin' | 'data'>): string | boolean => {\n const parseErrorObj: PostMsgParseErrorObject = {};\n const origin = event.origin;\n\n if (origin !== domain) {\n // FAIL SILENTLY: if it's not from the expected domain then it's not our traffic\n return 'Message was not sent from the expected domain';\n }\n\n /**\n * At this point we know the message is from the expected domain\n * - so is presumably \"our\" traffic and not random messages from the merchant's site, the build process, or from the browser (or extensions)\n * // TODO - Do more here in terms of logging to help debug issues with 3DS2\n */\n\n if (typeof event.data !== 'string') {\n // If it's from our domain but not a string - log this somewhere?\n return 'Event data from expected domain but not in expected form';\n }\n\n if (!event.data.length) {\n // If it's from our domain, is a string, but is empty - log this somewhere?\n return 'Event data from expected domain, in expected form, but empty';\n }\n\n // Try to parse the data\n try {\n const feedbackObj = JSON.parse(event.data) as Record<string, unknown>;\n if (feedbackObj && typeof feedbackObj === 'object' && hasOwnProperty(feedbackObj, 'type')) {\n if (feedbackObj.type === expectedType) {\n // Happy flow\n resolve(feedbackObj);\n return true;\n } else {\n // feedbackObj.type != expectedType - log this somewhere?\n return 'Event data has \"type\" but the object is not in the expected form';\n }\n } else {\n // FAIL SILENTLY: event.data had no 'type' property\n // example: applies when RiskModule device fingerprinting is ongoing and this handler is picking up securedFields traffic\n // - But, *if* we know we're in 3DS2 scenario - log this somewhere?\n return 'Event data had no type';\n }\n } catch (e) {\n parseErrorObj.type = `${expectedType}-JSON-parse-error`;\n parseErrorObj.comment = 'failed to JSON parse event.data';\n parseErrorObj.extraInfo = `event.data = ${event.data}`;\n parseErrorObj.eventDataRaw = event.data;\n\n // TODO - decide whether to console.log/debug/error &/or call the merchant defined onError callback\n console.debug('get-process-message-handler::CATCH::Un-parseable JSON:: parseErrorObj=', parseErrorObj);\n\n return false;\n }\n };\n\nexport default getProcessMessageHandler;\n"],"names":["getProcessMessageHandler","domain","resolve","reject","expectedType","event","parseErrorObj","origin","data","length","feedbackObj","JSON","parse","hasOwnProperty","type","e","comment","extraInfo","eventDataRaw","console","debug"],"mappings":"qDAcA,MAAMA,EACF,CACIC,EACAC,EACAC,EACAC,IAEHC,IACG,MAAMC,EAAyC,CAAA,EAG/C,GAFeD,EAAME,SAENN,EAEX,MAAO,gDASX,GAA0B,iBAAfI,EAAMG,KAEb,MAAO,2DAGX,IAAKH,EAAMG,KAAKC,OAEZ,MAAO,+DAIX,IACI,MAAMC,EAAcC,KAAKC,MAAMP,EAAMG,MACrC,OAAIE,GAAsC,iBAAhBA,GAA4BG,EAAeH,EAAa,QAC1EA,EAAYI,OAASV,GAErBF,EAAQQ,IACD,GAGA,mEAMJ,wBAEf,CAAE,MAAOK,GASL,OARAT,EAAcQ,KAAO,GAAGV,qBACxBE,EAAcU,QAAU,kCACxBV,EAAcW,UAAY,gBAAgBZ,EAAMG,OAChDF,EAAcY,aAAeb,EAAMG,KAGnCW,QAAQC,MAAM,yEAA0Ed,IAEjF,CACX"}
1
+ {"version":3,"file":"get-process-message-handler.js","sources":["../../../src/utils/get-process-message-handler.ts"],"sourcesContent":["/**\n * Centralised window.postMessage processing function used in 3DS2 components and *also* by the RiskModule's device fingerprinting process\n * NOTE: this latter use case means that while the deviceFingerprinting is still completing this component is also listening to\n * securedFields related postMessaging\n *\n * @param domain - expected domain for the postMesssage to have originated from\n * @param resolve - the resolve function from the Promise that called this function\n * @param reject - the reject function from the Promise that called this function\n * @param parseErrorObj - an error object to log in the case of unparseable data (albeit from a valid origin)\n * @param expectedType - string to check that the message event's data has the expected type\n */\nimport { hasOwnProperty } from './hasOwnProperty';\nimport { PostMsgParseErrorObject } from '../components/ThreeDS2/types';\n\nconst getProcessMessageHandler =\n (\n domain: string | null,\n resolve: (value: unknown) => void,\n reject: (reason?: unknown) => void,\n expectedType: string\n ): ((event: Pick<MessageEvent, 'origin' | 'data'>) => string | boolean) =>\n (event: Pick<MessageEvent, 'origin' | 'data'>): string | boolean => {\n const parseErrorObj: PostMsgParseErrorObject = {};\n const origin = event.origin;\n\n if (origin !== domain) {\n // FAIL SILENTLY: if it's not from the expected domain then it's not our traffic\n return 'Message was not sent from the expected domain';\n }\n\n /**\n * At this point we know the message is from the expected domain\n * - so is presumably \"our\" traffic and not random messages from the merchant's site, the build process, or from the browser (or extensions)\n * // TODO - Do more here in terms of logging to help debug issues with 3DS2\n */\n\n if (typeof event.data !== 'string') {\n // If it's from our domain but not a string - log this somewhere?\n return 'Event data from expected domain but not in expected form';\n }\n\n if (!event.data.length) {\n // If it's from our domain, is a string, but is empty - log this somewhere?\n return 'Event data from expected domain, in expected form, but empty';\n }\n\n // Try to parse the data\n try {\n const feedbackObj = JSON.parse(event.data) as Record<string, unknown>;\n if (feedbackObj && typeof feedbackObj === 'object' && hasOwnProperty(feedbackObj, 'type')) {\n if (feedbackObj.type === expectedType) {\n // Happy flow\n resolve(feedbackObj);\n return true;\n } else {\n // feedbackObj.type != expectedType - log this somewhere?\n return 'Event data has \"type\" but the object is not in the expected form';\n }\n } else {\n // FAIL SILENTLY: event.data had no 'type' property\n // example: applies when RiskModule device fingerprinting is ongoing and this handler is picking up securedFields traffic\n // - But, *if* we know we're in 3DS2 scenario - log this somewhere?\n return 'Event data had no type';\n }\n } catch (e) {\n parseErrorObj.type = `${expectedType}-JSON-parse-error`;\n parseErrorObj.comment = 'failed to JSON parse event.data';\n parseErrorObj.extraInfo = `event.data = ${event.data}`;\n parseErrorObj.eventDataRaw = event.data;\n\n // TODO - decide whether to console.log/debug/error &/or call the merchant defined onError callback\n console.debug('get-process-message-handler::CATCH::Un-parseable JSON:: parseErrorObj=', parseErrorObj);\n\n return false;\n }\n };\n\nexport default getProcessMessageHandler;\n"],"names":["getProcessMessageHandler","domain","resolve","reject","expectedType","event","parseErrorObj","origin","data","length","feedbackObj","JSON","parse","hasOwnProperty","type","e","comment","extraInfo","eventDataRaw","console","debug"],"mappings":"qDAcA,MAAMA,EACF,CACIC,EACAC,EACAC,EACAC,IAEHC,IACG,MAAMC,EAAyC,CAAA,EAG/C,GAFeD,EAAME,SAENN,EAEX,MAAO,gDASX,GAA0B,iBAAfI,EAAMG,KAEb,MAAO,2DAGX,IAAKH,EAAMG,KAAKC,OAEZ,MAAO,+DAIX,IACI,MAAMC,EAAcC,KAAKC,MAAMP,EAAMG,MACrC,OAAIE,GAAsC,iBAAhBA,GAA4BG,EAAeH,EAAa,QAC1EA,EAAYI,OAASV,GAErBF,EAAQQ,IACD,GAGA,mEAMJ,wBAEf,CAAE,MAAOK,GASL,OARAT,EAAcQ,KAAO,GAAGV,qBACxBE,EAAcU,QAAU,kCACxBV,EAAcW,UAAY,gBAAgBZ,EAAMG,OAChDF,EAAcY,aAAeb,EAAMG,KAGnCW,QAAQC,MAAM,yEAA0Ed,IAEjF,CACX"}
@@ -1,2 +1,2 @@
1
- function o(o,e,n){const r=e?.toLowerCase().slice(0,2),t=n[o?.toLowerCase()]?.[r];if(t)return t;console.warn(`Cannot find a consent url for the provided countryCode: ${o} and locale: ${e}`)}export{o as getConsentUrl};
1
+ function o(o,e,n){const r=o?n[o.toLowerCase()]:void 0,t=e?r?.[e.toLowerCase().slice(0,2)]:void 0;return t||(console.warn(`Cannot find a consent url for the provided countryCode: ${o} and locale: ${e}`),r?.en)}export{o as getConsentUrl};
2
2
  //# sourceMappingURL=getConsentUrl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getConsentUrl.js","sources":["../../../src/utils/getConsentUrl.ts"],"sourcesContent":["type UrlMap = {\n [countryCode: string]: {\n [language: string]: string;\n };\n};\n\nfunction getConsentUrl(countryCode: string, locale: string, urlMap: UrlMap): string {\n const languageCode = locale?.toLowerCase().slice(0, 2);\n const consentLink = urlMap[countryCode?.toLowerCase()]?.[languageCode];\n if (!consentLink) {\n console.warn(`Cannot find a consent url for the provided countryCode: ${countryCode} and locale: ${locale}`);\n return;\n }\n return consentLink;\n}\n\nexport { getConsentUrl };\n"],"names":["getConsentUrl","countryCode","locale","urlMap","languageCode","toLowerCase","slice","consentLink","console","warn"],"mappings":"AAMA,SAASA,EAAcC,EAAqBC,EAAgBC,GACxD,MAAMC,EAAeF,GAAQG,cAAcC,MAAM,EAAG,GAC9CC,EAAcJ,EAAOF,GAAaI,iBAAiBD,GACzD,GAAKG,EAIL,OAAOA,EAHHC,QAAQC,KAAK,2DAA2DR,iBAA2BC,IAI3G"}
1
+ {"version":3,"file":"getConsentUrl.js","sources":["../../../src/utils/getConsentUrl.ts"],"sourcesContent":["type UrlMap = {\n [countryCode: string]: {\n [language: string]: string;\n };\n};\n\nconst FALLBACK_CONSENT_LANGUAGE = 'en';\n\nfunction getConsentUrl(countryCode: string | undefined, locale: string | undefined, urlMap: UrlMap): string | undefined {\n const countryUrls = countryCode ? urlMap[countryCode.toLowerCase()] : undefined;\n const consentUrl = locale ? countryUrls?.[locale.toLowerCase().slice(0, 2)] : undefined;\n if (consentUrl) {\n return consentUrl;\n }\n\n console.warn(`Cannot find a consent url for the provided countryCode: ${countryCode} and locale: ${locale}`);\n return countryUrls?.[FALLBACK_CONSENT_LANGUAGE];\n}\n\nexport { getConsentUrl };\n"],"names":["getConsentUrl","countryCode","locale","urlMap","countryUrls","toLowerCase","undefined","consentUrl","slice","console","warn","FALLBACK_CONSENT_LANGUAGE"],"mappings":"AAQA,SAASA,EAAcC,EAAiCC,EAA4BC,GAChF,MAAMC,EAAcH,EAAcE,EAAOF,EAAYI,oBAAiBC,EAChEC,EAAaL,EAASE,IAAcF,EAAOG,cAAcG,MAAM,EAAG,SAAMF,EAC9E,OAAIC,IAIJE,QAAQC,KAAK,2DAA2DT,iBAA2BC,KAC5FE,GAAcO,GACzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"getErrorMessage.js","sources":["../../../src/utils/getErrorMessage.ts"],"sourcesContent":["import { ERROR_FIELD_INVALID, ERROR_FIELD_REQUIRED } from '../core/Errors/constants';\nimport Language from '../language';\nimport { ValidationRuleResult } from './Validator/ValidationRuleResult';\n\nexport const getErrorMessage = (i18n: Language, error?: ValidationRuleResult, label?: string, lowerCaseLabel: boolean = true): string | boolean => {\n if (error?.errorMessage && typeof error.errorMessage === 'string') {\n const errorKey = error.errorMessage;\n const shouldBuildErrorMessage = [ERROR_FIELD_REQUIRED, ERROR_FIELD_INVALID].includes(errorKey);\n // Build the error msg: Enter the [label name] or Enter a valid [label name]\n const options = { values: { label: lowerCaseLabel ? label?.toLowerCase() : label } };\n return shouldBuildErrorMessage ? i18n.get(errorKey, options) : i18n.get(errorKey);\n }\n\n return !!error;\n};\n"],"names":["getErrorMessage","i18n","error","label","lowerCaseLabel","errorMessage","errorKey","shouldBuildErrorMessage","ERROR_FIELD_REQUIRED","ERROR_FIELD_INVALID","includes","options","values","toLowerCase","get"],"mappings":"kGAIaA,EAAkB,CAACC,EAAgBC,EAA8BC,EAAgBC,GAA0B,KACpH,GAAIF,GAAOG,cAA8C,iBAAvBH,EAAMG,aAA2B,CAC/D,MAAMC,EAAWJ,EAAMG,aACjBE,EAA0B,CAACC,EAAsBC,GAAqBC,SAASJ,GAE/EK,EAAU,CAAEC,OAAQ,CAAET,MAAOC,EAAiBD,GAAOU,cAAgBV,IAC3E,OAAOI,EAA0BN,EAAKa,IAAIR,EAAUK,GAAWV,EAAKa,IAAIR,EAC5E,CAEA,QAASJ"}
1
+ {"version":3,"file":"getErrorMessage.js","sources":["../../../src/utils/getErrorMessage.ts"],"sourcesContent":["import { ERROR_FIELD_INVALID, ERROR_FIELD_REQUIRED } from '../core/Errors/constants';\nimport Language from '../language';\nimport { ValidationRuleResult } from './Validator/ValidationRuleResult';\n\nexport const getErrorMessage = (\n i18n: Language,\n error?: ValidationRuleResult | null,\n label?: string,\n lowerCaseLabel: boolean = true\n): string | boolean => {\n if (error?.errorMessage && typeof error.errorMessage === 'string') {\n const errorKey = error.errorMessage;\n const shouldBuildErrorMessage = [ERROR_FIELD_REQUIRED, ERROR_FIELD_INVALID].includes(errorKey);\n // Build the error msg: Enter the [label name] or Enter a valid [label name]\n const options = { values: { label: lowerCaseLabel ? label?.toLowerCase() : label } };\n return shouldBuildErrorMessage ? i18n.get(errorKey, options) : i18n.get(errorKey);\n }\n\n return !!error;\n};\n"],"names":["getErrorMessage","i18n","error","label","lowerCaseLabel","errorMessage","errorKey","shouldBuildErrorMessage","ERROR_FIELD_REQUIRED","ERROR_FIELD_INVALID","includes","options","values","toLowerCase","get"],"mappings":"kGAIaA,EAAkB,CAC3BC,EACAC,EACAC,EACAC,GAA0B,KAE1B,GAAIF,GAAOG,cAA8C,iBAAvBH,EAAMG,aAA2B,CAC/D,MAAMC,EAAWJ,EAAMG,aACjBE,EAA0B,CAACC,EAAsBC,GAAqBC,SAASJ,GAE/EK,EAAU,CAAEC,OAAQ,CAAET,MAAOC,EAAiBD,GAAOU,cAAgBV,IAC3E,OAAOI,EAA0BN,EAAKa,IAAIR,EAAUK,GAAWV,EAAKa,IAAIR,EAC5E,CAEA,QAASJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"getOrigin.js","sources":["../../../src/utils/getOrigin.ts"],"sourcesContent":["/**\n * Used to retrieve the origin from a url\n *\n * @remarks\n * Uses a regex to get origin (can't handle localhost origins)\n *\n * @param url - URL\n * @returns The origin of the url\n */\nexport const getOrigin = (url: string): string => {\n const originRegex = /^(?:([A-Za-z]+):)?(\\/{0,3})([0-9.\\-A-Za-z]+)(?::(\\d+))?(?:\\/([^?#]*))?(?:\\?([^#]*))?(?:#(.*))?$/;\n const matches = originRegex.exec(url);\n\n if (!matches) return null;\n\n const [, protocol, separator, host, port] = matches;\n\n if (!protocol || !separator || !host) return null;\n\n return `${protocol}:${separator}${host}${port ? `:${port}` : ''}`;\n};\n\nexport default getOrigin;\n"],"names":["getOrigin","url","matches","exec","protocol","separator","host","port"],"mappings":"AASO,MAAMA,EAAaC,IACtB,MACMC,EADc,kGACQC,KAAKF,GAEjC,IAAKC,EAAS,OAAO,KAErB,MAAM,CAAGE,EAAUC,EAAWC,EAAMC,GAAQL,EAE5C,OAAKE,GAAaC,GAAcC,EAEzB,GAAGF,KAAYC,IAAYC,IAAOC,EAAO,IAAIA,IAAS,KAFhB"}
1
+ {"version":3,"file":"getOrigin.js","sources":["../../../src/utils/getOrigin.ts"],"sourcesContent":["/**\n * Used to retrieve the origin from a url\n *\n * @remarks\n * Uses a regex to get origin (can't handle localhost origins)\n *\n * @param url - URL\n * @returns The origin of the url\n */\nexport const getOrigin = (url: string): string | null => {\n const originRegex = /^(?:([A-Za-z]+):)?(\\/{0,3})([0-9.\\-A-Za-z]+)(?::(\\d+))?(?:\\/([^?#]*))?(?:\\?([^#]*))?(?:#(.*))?$/;\n const matches = originRegex.exec(url);\n\n if (!matches) return null;\n\n const [, protocol, separator, host, port] = matches;\n\n if (!protocol || !separator || !host) return null;\n\n return `${protocol}:${separator}${host}${port ? `:${port}` : ''}`;\n};\n\nexport default getOrigin;\n"],"names":["getOrigin","url","matches","exec","protocol","separator","host","port"],"mappings":"AASO,MAAMA,EAAaC,IACtB,MACMC,EADc,kGACQC,KAAKF,GAEjC,IAAKC,EAAS,OAAO,KAErB,MAAM,CAAGE,EAAUC,EAAWC,EAAMC,GAAQL,EAE5C,OAAKE,GAAaC,GAAcC,EAEzB,GAAGF,KAAYC,IAAYC,IAAOC,EAAO,IAAIA,IAAS,KAFhB"}
@@ -1,2 +1,2 @@
1
- const t=(t,o=!1)=>{let r;try{r=new URL(t)}catch(t){return!1}return o&&"http:"===r.protocol||"https:"===r.protocol};export{t as isValidHttpUrl};
1
+ const t=(t,r=!1)=>{if(!t)return!1;let o;try{o=new URL(t)}catch(t){return!1}return r&&"http:"===o.protocol||"https:"===o.protocol};export{t as isValidHttpUrl};
2
2
  //# sourceMappingURL=isValidURL.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"isValidURL.js","sources":["../../../src/utils/isValidURL.ts"],"sourcesContent":["export const isValidHttpUrl = (httpUrl: string, allowHttp = false) => {\n let url: URL;\n try {\n url = new URL(httpUrl);\n } catch (_) {\n return false;\n }\n return allowHttp ? url.protocol === 'http:' || url.protocol === 'https:' : url.protocol === 'https:';\n};\n"],"names":["isValidHttpUrl","httpUrl","allowHttp","url","URL","_","protocol"],"mappings":"AAAO,MAAMA,EAAiB,CAACC,EAAiBC,GAAY,KACxD,IAAIC,EACJ,IACIA,EAAM,IAAIC,IAAIH,EAClB,CAAE,MAAOI,GACL,OAAO,CACX,CACA,OAAOH,GAA6B,UAAjBC,EAAIG,UAAqE,WAAjBH,EAAIG"}
1
+ {"version":3,"file":"isValidURL.js","sources":["../../../src/utils/isValidURL.ts"],"sourcesContent":["export const isValidHttpUrl = (httpUrl: string | null | undefined, allowHttp = false) => {\n if (!httpUrl) return false;\n\n let url: URL;\n try {\n url = new URL(httpUrl);\n } catch (_) {\n return false;\n }\n return allowHttp ? url.protocol === 'http:' || url.protocol === 'https:' : url.protocol === 'https:';\n};\n"],"names":["isValidHttpUrl","httpUrl","allowHttp","url","URL","_","protocol"],"mappings":"AAAO,MAAMA,EAAiB,CAACC,EAAoCC,GAAY,KAC3E,IAAKD,EAAS,OAAO,EAErB,IAAIE,EACJ,IACIA,EAAM,IAAIC,IAAIH,EAClB,CAAE,MAAOI,GACL,OAAO,CACX,CACA,OAAOH,GAA6B,UAAjBC,EAAIG,UAAqE,WAAjBH,EAAIG"}
@@ -1 +1 @@
1
- {"version":3,"file":"promiseTimeout.js","sources":["../../../src/utils/promiseTimeout.ts"],"sourcesContent":["/**\n * Tests if a passed promise settles before a certain amount of time has elapsed\n *\n * @param ms - number of milliseconds the passed promise has to settle\n * @param promise - the passed promise\n * @param timeOutObject - the object that the promiseTimeout will reject with if the passed promise doesn't settle in time\n */\nconst promiseTimeout = <T>(ms: number, promise: Promise<T>, timeOutObject: object): { promise: Promise<T>; cancel: () => void } => {\n let timer: NodeJS.Timeout | null;\n\n const promiseTimer: Promise<T> = new Promise((resolve, reject): void => {\n // Create a timeout to reject promise if not resolved\n timer = setTimeout((): void => {\n reject(timeOutObject);\n }, ms);\n\n promise\n .then((res): void => {\n clearTimeout(timer);\n resolve(res);\n })\n .catch((err): void => {\n clearTimeout(timer);\n reject(err);\n });\n });\n\n const cancelTimer = (): void => {\n clearTimeout(timer);\n };\n\n return {\n promise: promiseTimer,\n cancel: cancelTimer\n };\n};\n\nexport default promiseTimeout;\n"],"names":["promiseTimeout","ms","promise","timeOutObject","timer","Promise","resolve","reject","setTimeout","then","res","clearTimeout","catch","err","cancel"],"mappings":"AAOA,MAAMA,EAAiB,CAAIC,EAAYC,EAAqBC,KACxD,IAAIC,EAuBJ,MAAO,CACHF,QAtB6B,IAAIG,QAAQ,CAACC,EAASC,KAEnDH,EAAQI,WAAW,KACfD,EAAOJ,IACRF,GAEHC,EACKO,KAAMC,IACHC,aAAaP,GACbE,EAAQI,KAEXE,MAAOC,IACJF,aAAaP,GACbG,EAAOM,OAUfC,OANgB,KAChBH,aAAaP"}
1
+ {"version":3,"file":"promiseTimeout.js","sources":["../../../src/utils/promiseTimeout.ts"],"sourcesContent":["/**\n * Tests if a passed promise settles before a certain amount of time has elapsed\n *\n * @param ms - number of milliseconds the passed promise has to settle\n * @param promise - the passed promise\n * @param timeOutObject - the object that the promiseTimeout will reject with if the passed promise doesn't settle in time\n */\nconst promiseTimeout = <T>(ms: number, promise: Promise<T>, timeOutObject: object): { promise: Promise<T>; cancel: () => void } => {\n let timer: NodeJS.Timeout;\n\n const promiseTimer: Promise<T> = new Promise((resolve, reject): void => {\n // Create a timeout to reject promise if not resolved\n timer = setTimeout((): void => {\n reject(timeOutObject);\n }, ms);\n\n promise\n .then((res): void => {\n clearTimeout(timer);\n resolve(res);\n })\n .catch((err): void => {\n clearTimeout(timer);\n reject(err);\n });\n });\n\n const cancelTimer = (): void => {\n clearTimeout(timer);\n };\n\n return {\n promise: promiseTimer,\n cancel: cancelTimer\n };\n};\n\nexport default promiseTimeout;\n"],"names":["promiseTimeout","ms","promise","timeOutObject","timer","Promise","resolve","reject","setTimeout","then","res","clearTimeout","catch","err","cancel"],"mappings":"AAOA,MAAMA,EAAiB,CAAIC,EAAYC,EAAqBC,KACxD,IAAIC,EAuBJ,MAAO,CACHF,QAtB6B,IAAIG,QAAQ,CAACC,EAASC,KAEnDH,EAAQI,WAAW,KACfD,EAAOJ,IACRF,GAEHC,EACKO,KAAMC,IACHC,aAAaP,GACbE,EAAQI,KAEXE,MAAOC,IACJF,aAAaP,GACbG,EAAOM,OAUfC,OANgB,KAChBH,aAAaP"}
@@ -1 +1 @@
1
- {"version":3,"file":"useAutoFocus.js","sources":["../../../src/utils/useAutoFocus.ts"],"sourcesContent":["import { useRef, useEffect } from 'preact/hooks';\n\nconst useAutoFocus = () => {\n const ref = useRef(null);\n\n useEffect(() => {\n ref.current?.focus();\n }, []);\n\n return ref;\n};\n\nexport default useAutoFocus;\n"],"names":["useAutoFocus","ref","useRef","useEffect","current","focus"],"mappings":"+EAEA,MAAMA,EAAe,KACjB,MAAMC,EAAMC,EAAO,MAMnB,OAJAC,EAAU,KACNF,EAAIG,SAASC,SACd,IAEIJ"}
1
+ {"version":3,"file":"useAutoFocus.js","sources":["../../../src/utils/useAutoFocus.ts"],"sourcesContent":["import { useRef, useEffect } from 'preact/hooks';\n\nconst useAutoFocus = <T extends HTMLElement = HTMLElement>() => {\n const ref = useRef<T | null>(null);\n\n useEffect(() => {\n ref.current?.focus();\n }, []);\n\n return ref;\n};\n\nexport default useAutoFocus;\n"],"names":["useAutoFocus","ref","useRef","useEffect","current","focus"],"mappings":"+EAEA,MAAMA,EAAe,KACjB,MAAMC,EAAMC,EAAiB,MAM7B,OAJAC,EAAU,KACNF,EAAIG,SAASC,SACd,IAEIJ"}
@@ -1,2 +1,2 @@
1
- const e=(e,t,n,r)=>{if(e[n]?.[t]?.formatterFn)return null;const u=e[n]?.[t]?.maxlength;return u||30},t=e=>!(null!=e&&!/^[\s]*$/.test(e)),n="(?:[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\p{Cc}\\p{Cf}]|[0-9#*]\\uFE0F?\\u20E3)",[r,u]=(()=>{try{return[new RegExp(n,"u"),new RegExp(n,"gu")]}catch{const e="[\\u0000-\\u001F\\u007F-\\u009F]";return[new RegExp(e),new RegExp(e,"g")]}})(),g=(e,t="g")=>new RegExp(`[${e}]`,t),p=e=>!e.length||!r.test(e),c=e=>e.replace(u,""),l=e=>e.trim().replace(/\s+/g," ");export{g as getFormattingRegEx,e as getMaxLengthByFieldAndCountry,t as isEmpty,c as stripInvalidChars,l as trimValWithOneSpace,p as validateForSpecialChars};
1
+ const e=(e,t,n,r)=>{if(n&&e[n]?.[t]?.formatterFn)return;const g=n?e[n]?.[t]?.maxlength:void 0;return g||30},t=e=>!(null!=e&&!/^[\s]*$/.test(e)),n="(?:[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\p{Cc}\\p{Cf}]|[0-9#*]\\uFE0F?\\u20E3)",[r,g]=(()=>{try{return[new RegExp(n,"u"),new RegExp(n,"gu")]}catch{const e="[\\u0000-\\u001F\\u007F-\\u009F]";return[new RegExp(e),new RegExp(e,"g")]}})(),p=(e,t="g")=>new RegExp(`[${e}]`,t),u=e=>!e.length||!r.test(e),c=e=>e.replace(g,""),o=e=>e.trim().replace(/\s+/g," ");export{p as getFormattingRegEx,e as getMaxLengthByFieldAndCountry,t as isEmpty,c as stripInvalidChars,o as trimValWithOneSpace,u as validateForSpecialChars};
2
2
  //# sourceMappingURL=validator-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validator-utils.js","sources":["../../../src/utils/validator-utils.ts"],"sourcesContent":["import { CountryFormatRules } from './Validator/types';\n\nconst MAX_LENGTH = 30;\n\nexport const getMaxLengthByFieldAndCountry = (\n formattingRules: CountryFormatRules,\n field: string,\n country: string,\n ignoreIfFormatterExists: boolean\n): number | null => {\n // In ignoreIfFormatterExists is true we expect the formatter function to also act to limit length\n if (ignoreIfFormatterExists && formattingRules[country]?.[field]?.formatterFn) {\n return null;\n }\n const maxLength = formattingRules[country]?.[field]?.maxlength;\n return maxLength ? maxLength : MAX_LENGTH;\n};\n\n// Not null or undefined or only spaces\nexport const isEmpty = (input: string) => !!(input == null || /^[\\s]*$/.test(input));\n\nexport const isString = (input: unknown) => typeof input === 'string' || input instanceof String;\nexport const hasText = (input: string) => isString(input) && !isEmpty(input);\n\n// Block emojis and control/format characters, allow everything else\nconst INVALID_CHARS_REGEX_SOURCE = '(?:[\\\\p{Extended_Pictographic}\\\\p{Regional_Indicator}\\\\p{Cc}\\\\p{Cf}]|[0-9#*]\\\\uFE0F?\\\\u20E3)';\nconst [INVALID_CHARS_TEST, INVALID_CHARS_STRIP] = ((): [RegExp, RegExp] => {\n try {\n // This is inside a try/catch just in case the browser doesn't support Unicode property escapes\n return [new RegExp(INVALID_CHARS_REGEX_SOURCE, 'u'), new RegExp(INVALID_CHARS_REGEX_SOURCE, 'gu')];\n } catch {\n // Fallback for browsers without Unicode property escapes - just block control chars\n const fallbackRegex = '[\\\\u0000-\\\\u001F\\\\u007F-\\\\u009F]';\n return [new RegExp(fallbackRegex), new RegExp(fallbackRegex, 'g')];\n }\n})();\n\n// Generates a regEx ideal for use in a String.replace call for use in a formatter\n// e.g. getFormattingRegEx('^\\\\d', 'g') will generate: /[^\\d]/g which is a regEx to match anything that is not a digit\nexport const getFormattingRegEx = (specChars: string, flags = 'g') => new RegExp(`[${specChars}]`, flags);\n\nexport const exactLength = (input: string, length: number) => {\n if (isEmpty(input)) {\n return true;\n }\n return input.length === length;\n};\n\nexport const validateForSpecialChars = (text: string): boolean => {\n if (!text.length) return true;\n // Returns true if no invalid characters found\n return !INVALID_CHARS_TEST.test(text);\n};\n\nexport const stripInvalidChars = (text: string): string => text.replace(INVALID_CHARS_STRIP, '');\n\n// Trim both ends and never allow more than 1 space in between\nexport const trimValWithOneSpace = (val: string) => val.trim().replace(/\\s+/g, ' ');\n"],"names":["getMaxLengthByFieldAndCountry","formattingRules","field","country","ignoreIfFormatterExists","formatterFn","maxLength","maxlength","isEmpty","input","test","INVALID_CHARS_REGEX_SOURCE","INVALID_CHARS_TEST","INVALID_CHARS_STRIP","RegExp","fallbackRegex","getFormattingRegEx","specChars","flags","validateForSpecialChars","text","length","stripInvalidChars","replace","trimValWithOneSpace","val","trim"],"mappings":"AAEA,MAEaA,EAAgC,CACzCC,EACAC,EACAC,EACAC,KAGA,GAA+BH,EAAgBE,KAAWD,IAAQG,YAC9D,OAAO,KAEX,MAAMC,EAAYL,EAAgBE,KAAWD,IAAQK,UACrD,OAAOD,GAbQ,IAiBNE,EAAWC,KAA8B,MAATA,IAAiB,UAAUC,KAAKD,IAMvEE,EAA6B,gGAC5BC,EAAoBC,GAAuB,MAC9C,IAEI,MAAO,CAAC,IAAIC,OAAOH,EAA4B,KAAM,IAAIG,OAAOH,EAA4B,MAChG,CAAE,MAEE,MAAMI,EAAgB,mCACtB,MAAO,CAAC,IAAID,OAAOC,GAAgB,IAAID,OAAOC,EAAe,KACjE,CACJ,EATkD,GAarCC,EAAqB,CAACC,EAAmBC,EAAQ,MAAQ,IAAIJ,OAAO,IAAIG,KAAcC,GAStFC,EAA2BC,IAC/BA,EAAKC,SAEFT,EAAmBF,KAAKU,GAGvBE,EAAqBF,GAAyBA,EAAKG,QAAQV,EAAqB,IAGhFW,EAAuBC,GAAgBA,EAAIC,OAAOH,QAAQ,OAAQ"}
1
+ {"version":3,"file":"validator-utils.js","sources":["../../../src/utils/validator-utils.ts"],"sourcesContent":["import { CountryFormatRules } from './Validator/types';\n\nconst MAX_LENGTH = 30;\n\nexport const getMaxLengthByFieldAndCountry = (\n formattingRules: CountryFormatRules,\n field: string,\n country: string | undefined,\n ignoreIfFormatterExists: boolean\n): number | undefined => {\n // In ignoreIfFormatterExists is true we expect the formatter function to also act to limit length\n if (ignoreIfFormatterExists && country && formattingRules[country]?.[field]?.formatterFn) {\n return undefined;\n }\n const maxLength = country ? formattingRules[country]?.[field]?.maxlength : undefined;\n return maxLength ? maxLength : MAX_LENGTH;\n};\n\n// Not null or undefined or only spaces\nexport const isEmpty = (input: string) => !!(input == null || /^[\\s]*$/.test(input));\n\nexport const isString = (input: unknown) => typeof input === 'string' || input instanceof String;\nexport const hasText = (input: string) => isString(input) && !isEmpty(input);\n\n// Block emojis and control/format characters, allow everything else\nconst INVALID_CHARS_REGEX_SOURCE = '(?:[\\\\p{Extended_Pictographic}\\\\p{Regional_Indicator}\\\\p{Cc}\\\\p{Cf}]|[0-9#*]\\\\uFE0F?\\\\u20E3)';\nconst [INVALID_CHARS_TEST, INVALID_CHARS_STRIP] = ((): [RegExp, RegExp] => {\n try {\n // This is inside a try/catch just in case the browser doesn't support Unicode property escapes\n return [new RegExp(INVALID_CHARS_REGEX_SOURCE, 'u'), new RegExp(INVALID_CHARS_REGEX_SOURCE, 'gu')];\n } catch {\n // Fallback for browsers without Unicode property escapes - just block control chars\n const fallbackRegex = '[\\\\u0000-\\\\u001F\\\\u007F-\\\\u009F]';\n return [new RegExp(fallbackRegex), new RegExp(fallbackRegex, 'g')];\n }\n})();\n\n// Generates a regEx ideal for use in a String.replace call for use in a formatter\n// e.g. getFormattingRegEx('^\\\\d', 'g') will generate: /[^\\d]/g which is a regEx to match anything that is not a digit\nexport const getFormattingRegEx = (specChars: string, flags = 'g') => new RegExp(`[${specChars}]`, flags);\n\nexport const exactLength = (input: string, length: number) => {\n if (isEmpty(input)) {\n return true;\n }\n return input.length === length;\n};\n\nexport const validateForSpecialChars = (text: string): boolean => {\n if (!text.length) return true;\n // Returns true if no invalid characters found\n return !INVALID_CHARS_TEST.test(text);\n};\n\nexport const stripInvalidChars = (text: string): string => text.replace(INVALID_CHARS_STRIP, '');\n\n// Trim both ends and never allow more than 1 space in between\nexport const trimValWithOneSpace = (val: string) => val.trim().replace(/\\s+/g, ' ');\n"],"names":["getMaxLengthByFieldAndCountry","formattingRules","field","country","ignoreIfFormatterExists","formatterFn","maxLength","maxlength","undefined","isEmpty","input","test","INVALID_CHARS_REGEX_SOURCE","INVALID_CHARS_TEST","INVALID_CHARS_STRIP","RegExp","fallbackRegex","getFormattingRegEx","specChars","flags","validateForSpecialChars","text","length","stripInvalidChars","replace","trimValWithOneSpace","val","trim"],"mappings":"AAEA,MAEaA,EAAgC,CACzCC,EACAC,EACAC,EACAC,KAGA,GAA+BD,GAAWF,EAAgBE,KAAWD,IAAQG,YACzE,OAEJ,MAAMC,EAAYH,EAAUF,EAAgBE,KAAWD,IAAQK,eAAYC,EAC3E,OAAOF,GAbQ,IAiBNG,EAAWC,KAA8B,MAATA,IAAiB,UAAUC,KAAKD,IAMvEE,EAA6B,gGAC5BC,EAAoBC,GAAuB,MAC9C,IAEI,MAAO,CAAC,IAAIC,OAAOH,EAA4B,KAAM,IAAIG,OAAOH,EAA4B,MAChG,CAAE,MAEE,MAAMI,EAAgB,mCACtB,MAAO,CAAC,IAAID,OAAOC,GAAgB,IAAID,OAAOC,EAAe,KACjE,CACJ,EATkD,GAarCC,EAAqB,CAACC,EAAmBC,EAAQ,MAAQ,IAAIJ,OAAO,IAAIG,KAAcC,GAStFC,EAA2BC,IAC/BA,EAAKC,SAEFT,EAAmBF,KAAKU,GAGvBE,EAAqBF,GAAyBA,EAAKG,QAAQV,EAAqB,IAGhFW,EAAuBC,GAAgBA,EAAIC,OAAOH,QAAQ,OAAQ"}