@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
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../../../../../src/components/internal/Address/constants.ts"],"sourcesContent":["import { AddressSpecifications } from './types';\n\nexport const FALLBACK_VALUE = 'N/A';\nexport const ADDRESS_SCHEMA = ['street', 'houseNumberOrName', 'postalCode', 'city', 'stateOrProvince', 'country'] as const;\nexport const [STREET, HOUSE_NUMBER_OR_NAME, POSTAL_CODE, CITY, STATE_OR_PROVINCE, COUNTRY] = ADDRESS_SCHEMA;\n\n// WCAG 2.2 - Address field autocomplete tokens\nexport const ADDRESS_FIELD_TOKEN_MAP: Record<string, string> = {\n street: 'address-line1',\n houseNumberOrName: 'address-line2',\n postalCode: 'postal-code',\n city: 'address-level2'\n};\n\n// prettier-ignore\nexport const ADDRESS_SPECIFICATIONS: AddressSpecifications = {\n AU: {\n hasDataset: true,\n labels: {\n [HOUSE_NUMBER_OR_NAME]: 'apartmentSuite',\n [STATE_OR_PROVINCE]: 'state',\n [STREET]: 'address'\n },\n optionalFields: [HOUSE_NUMBER_OR_NAME],\n placeholders: {\n [STATE_OR_PROVINCE]: 'select.state'\n },\n schema: [COUNTRY, STREET, HOUSE_NUMBER_OR_NAME, CITY, [[STATE_OR_PROVINCE, 50], [POSTAL_CODE, 50]]]\n },\n BR: {\n hasDataset: true,\n labels: {\n [STATE_OR_PROVINCE]: 'state'\n },\n placeholders: {\n [STATE_OR_PROVINCE]: 'select.state'\n },\n },\n CA: {\n hasDataset: true,\n labels: {\n [HOUSE_NUMBER_OR_NAME]: 'apartmentSuite',\n [STATE_OR_PROVINCE]: 'provinceOrTerritory',\n [STREET]: 'address'\n },\n optionalFields: [HOUSE_NUMBER_OR_NAME],\n schema: [COUNTRY, STREET, HOUSE_NUMBER_OR_NAME, [[CITY, 70], [POSTAL_CODE, 30]], STATE_OR_PROVINCE]\n },\n GB: {\n labels: {\n [CITY]: 'cityTown'\n },\n schema: [COUNTRY, [[HOUSE_NUMBER_OR_NAME, 30], [STREET, 70]], [[CITY, 70], [POSTAL_CODE, 30]], STATE_OR_PROVINCE]\n },\n JP: {\n hasDataset: true,\n labels: {\n [STATE_OR_PROVINCE]: 'prefecture',\n [CITY]: 'cityTown',\n [STREET]: 'streetNameAndBlockNumber',\n [HOUSE_NUMBER_OR_NAME]: 'buildingNameRoomNumber'\n },\n optionalFields: [HOUSE_NUMBER_OR_NAME],\n schema: [COUNTRY, [[POSTAL_CODE, 50], [STATE_OR_PROVINCE, 50]], CITY, STREET, HOUSE_NUMBER_OR_NAME]\n },\n US: {\n hasDataset: true,\n labels: {\n [POSTAL_CODE]: 'zipCode',\n [HOUSE_NUMBER_OR_NAME]: 'apartmentSuite',\n [STATE_OR_PROVINCE]: 'state',\n [STREET]: 'address'\n },\n optionalFields: [HOUSE_NUMBER_OR_NAME],\n placeholders: {\n [STATE_OR_PROVINCE]: 'select.state'\n },\n schema: [COUNTRY, STREET, HOUSE_NUMBER_OR_NAME, CITY, [[STATE_OR_PROVINCE, 50], [POSTAL_CODE, 50]]]\n },\n default: {\n optionalFields: [],\n placeholders: {\n [STATE_OR_PROVINCE]: 'select.provinceOrTerritory'\n },\n schema: [COUNTRY, [[STREET, 70], [HOUSE_NUMBER_OR_NAME, 30]], [[POSTAL_CODE, 30], [CITY, 70]], STATE_OR_PROVINCE],\n }\n};\n\nexport const PARTIAL_ADDRESS_SCHEMA: AddressSpecifications = Object.keys(ADDRESS_SPECIFICATIONS).reduce((acc, countryCode) => {\n acc[countryCode] = {\n labels: ADDRESS_SPECIFICATIONS[countryCode].labels,\n schema: [POSTAL_CODE]\n };\n return acc;\n}, {} as AddressSpecifications);\n\nexport const COUNTRIES_WITH_CUSTOM_SPECIFICATION = Object.keys(ADDRESS_SPECIFICATIONS);\n"],"names":["FALLBACK_VALUE","ADDRESS_SCHEMA","STREET","HOUSE_NUMBER_OR_NAME","POSTAL_CODE","CITY","STATE_OR_PROVINCE","COUNTRY","ADDRESS_FIELD_TOKEN_MAP","street","houseNumberOrName","postalCode","city","ADDRESS_SPECIFICATIONS","AU","hasDataset","labels","optionalFields","placeholders","schema","BR","CA","GB","JP","US","default","PARTIAL_ADDRESS_SCHEMA","Object","keys","reduce","acc","countryCode","COUNTRIES_WITH_CUSTOM_SPECIFICATION"],"mappings":"AAEO,MAAMA,EAAiB,MACjBC,EAAiB,CAAC,SAAU,oBAAqB,aAAc,OAAQ,kBAAmB,YACzFC,EAAQC,EAAsBC,EAAaC,EAAMC,EAAmBC,GAAWN,EAGhFO,EAAkD,CAC3DC,OAAQ,gBACRC,kBAAmB,gBACnBC,WAAY,cACZC,KAAM,kBAIGC,EAAgD,CACzDC,GAAI,CACAC,YAAY,EACZC,OAAQ,CACJb,CAACA,GAAuB,iBACxBG,CAACA,GAAoB,QACrBJ,CAACA,GAAS,WAEde,eAAgB,CAACd,GACjBe,aAAc,CACVZ,CAACA,GAAoB,gBAEzBa,OAAQ,CAACZ,EAASL,EAAQC,EAAsBE,EAAM,CAAC,CAACC,EAAmB,IAAK,CAACF,EAAa,OAElGgB,GAAI,CACAL,YAAY,EACZC,OAAQ,CACJV,CAACA,GAAoB,SAEzBY,aAAc,CACVZ,CAACA,GAAoB,iBAG7Be,GAAI,CACAN,YAAY,EACZC,OAAQ,CACJb,CAACA,GAAuB,iBACxBG,CAACA,GAAoB,sBACrBJ,CAACA,GAAS,WAEde,eAAgB,CAACd,GACjBgB,OAAQ,CAACZ,EAASL,EAAQC,EAAsB,CAAC,CAACE,EAAM,IAAK,CAACD,EAAa,KAAME,IAErFgB,GAAI,CACAN,OAAQ,CACJX,CAACA,GAAO,YAEZc,OAAQ,CAACZ,EAAS,CAAC,CAACJ,EAAsB,IAAK,CAACD,EAAQ,KAAM,CAAC,CAACG,EAAM,IAAK,CAACD,EAAa,KAAME,IAEnGiB,GAAI,CACAR,YAAY,EACZC,OAAQ,CACJV,CAACA,GAAoB,aACrBD,CAACA,GAAO,WACRH,CAACA,GAAS,2BACVC,CAACA,GAAuB,0BAE5Bc,eAAgB,CAACd,GACjBgB,OAAQ,CAACZ,EAAS,CAAC,CAACH,EAAa,IAAK,CAACE,EAAmB,KAAMD,EAAMH,EAAQC,IAElFqB,GAAI,CACAT,YAAY,EACZC,OAAQ,CACJZ,CAACA,GAAc,UACfD,CAACA,GAAuB,iBACxBG,CAACA,GAAoB,QACrBJ,CAACA,GAAS,WAEde,eAAgB,CAACd,GACjBe,aAAc,CACVZ,CAACA,GAAoB,gBAEzBa,OAAQ,CAACZ,EAASL,EAAQC,EAAsBE,EAAM,CAAC,CAACC,EAAmB,IAAK,CAACF,EAAa,OAElGqB,QAAS,CACLR,eAAgB,GAChBC,aAAc,CACVZ,CAACA,GAAoB,8BAEzBa,OAAQ,CAACZ,EAAS,CAAC,CAACL,EAAQ,IAAK,CAACC,EAAsB,KAAM,CAAC,CAACC,EAAa,IAAK,CAACC,EAAM,KAAMC,KAI1FoB,EAAgDC,OAAOC,KAAKf,GAAwBgB,OAAO,CAACC,EAAKC,KAC1GD,EAAIC,GAAe,CACff,OAAQH,EAAuBkB,GAAaf,OAC5CG,OAAQ,CAACf,IAEN0B,GACR,CAAA,GAEUE,EAAsCL,OAAOC,KAAKf"}
1
+ {"version":3,"file":"constants.js","sources":["../../../../../src/components/internal/Address/constants.ts"],"sourcesContent":["import { AddressSpecifications } from './types';\n\nexport const FALLBACK_VALUE = 'N/A';\nexport const ADDRESS_SCHEMA = ['street', 'houseNumberOrName', 'postalCode', 'city', 'stateOrProvince', 'country'] as const;\nexport const [STREET, HOUSE_NUMBER_OR_NAME, POSTAL_CODE, CITY, STATE_OR_PROVINCE, COUNTRY] = ADDRESS_SCHEMA;\n\n// WCAG 2.2 - Address field autocomplete tokens\nexport const ADDRESS_FIELD_TOKEN_MAP: Record<string, string> = {\n street: 'address-line1',\n houseNumberOrName: 'address-line2',\n postalCode: 'postal-code',\n city: 'address-level2'\n};\n\n// prettier-ignore\nexport const ADDRESS_SPECIFICATIONS = {\n AU: {\n hasDataset: true,\n labels: {\n [HOUSE_NUMBER_OR_NAME]: 'apartmentSuite',\n [STATE_OR_PROVINCE]: 'state',\n [STREET]: 'address'\n },\n optionalFields: [HOUSE_NUMBER_OR_NAME],\n placeholders: {\n [STATE_OR_PROVINCE]: 'select.state'\n },\n schema: [COUNTRY, STREET, HOUSE_NUMBER_OR_NAME, CITY, [[STATE_OR_PROVINCE, 50], [POSTAL_CODE, 50]]]\n },\n BR: {\n hasDataset: true,\n labels: {\n [STATE_OR_PROVINCE]: 'state'\n },\n placeholders: {\n [STATE_OR_PROVINCE]: 'select.state'\n },\n },\n CA: {\n hasDataset: true,\n labels: {\n [HOUSE_NUMBER_OR_NAME]: 'apartmentSuite',\n [STATE_OR_PROVINCE]: 'provinceOrTerritory',\n [STREET]: 'address'\n },\n optionalFields: [HOUSE_NUMBER_OR_NAME],\n schema: [COUNTRY, STREET, HOUSE_NUMBER_OR_NAME, [[CITY, 70], [POSTAL_CODE, 30]], STATE_OR_PROVINCE]\n },\n GB: {\n labels: {\n [CITY]: 'cityTown'\n },\n schema: [COUNTRY, [[HOUSE_NUMBER_OR_NAME, 30], [STREET, 70]], [[CITY, 70], [POSTAL_CODE, 30]], STATE_OR_PROVINCE]\n },\n JP: {\n hasDataset: true,\n labels: {\n [STATE_OR_PROVINCE]: 'prefecture',\n [CITY]: 'cityTown',\n [STREET]: 'streetNameAndBlockNumber',\n [HOUSE_NUMBER_OR_NAME]: 'buildingNameRoomNumber'\n },\n optionalFields: [HOUSE_NUMBER_OR_NAME],\n schema: [COUNTRY, [[POSTAL_CODE, 50], [STATE_OR_PROVINCE, 50]], CITY, STREET, HOUSE_NUMBER_OR_NAME]\n },\n US: {\n hasDataset: true,\n labels: {\n [POSTAL_CODE]: 'zipCode',\n [HOUSE_NUMBER_OR_NAME]: 'apartmentSuite',\n [STATE_OR_PROVINCE]: 'state',\n [STREET]: 'address'\n },\n optionalFields: [HOUSE_NUMBER_OR_NAME],\n placeholders: {\n [STATE_OR_PROVINCE]: 'select.state'\n },\n schema: [COUNTRY, STREET, HOUSE_NUMBER_OR_NAME, CITY, [[STATE_OR_PROVINCE, 50], [POSTAL_CODE, 50]]]\n },\n default: {\n optionalFields: [],\n placeholders: {\n [STATE_OR_PROVINCE]: 'select.provinceOrTerritory'\n },\n schema: [COUNTRY, [[STREET, 70], [HOUSE_NUMBER_OR_NAME, 30]], [[POSTAL_CODE, 30], [CITY, 70]], STATE_OR_PROVINCE],\n }\n} satisfies AddressSpecifications;\n\nexport const PARTIAL_ADDRESS_SCHEMA: AddressSpecifications = Object.keys(ADDRESS_SPECIFICATIONS).reduce((acc, countryCode) => {\n acc[countryCode] = {\n labels: ADDRESS_SPECIFICATIONS[countryCode].labels,\n schema: [POSTAL_CODE]\n };\n return acc;\n}, {} as AddressSpecifications);\n\nexport const COUNTRIES_WITH_CUSTOM_SPECIFICATION = Object.keys(ADDRESS_SPECIFICATIONS);\n"],"names":["FALLBACK_VALUE","ADDRESS_SCHEMA","STREET","HOUSE_NUMBER_OR_NAME","POSTAL_CODE","CITY","STATE_OR_PROVINCE","COUNTRY","ADDRESS_FIELD_TOKEN_MAP","street","houseNumberOrName","postalCode","city","ADDRESS_SPECIFICATIONS","AU","hasDataset","labels","optionalFields","placeholders","schema","BR","CA","GB","JP","US","default","PARTIAL_ADDRESS_SCHEMA","Object","keys","reduce","acc","countryCode","COUNTRIES_WITH_CUSTOM_SPECIFICATION"],"mappings":"AAEO,MAAMA,EAAiB,MACjBC,EAAiB,CAAC,SAAU,oBAAqB,aAAc,OAAQ,kBAAmB,YACzFC,EAAQC,EAAsBC,EAAaC,EAAMC,EAAmBC,GAAWN,EAGhFO,EAAkD,CAC3DC,OAAQ,gBACRC,kBAAmB,gBACnBC,WAAY,cACZC,KAAM,kBAIGC,EAAyB,CAClCC,GAAI,CACAC,YAAY,EACZC,OAAQ,CACJb,CAACA,GAAuB,iBACxBG,CAACA,GAAoB,QACrBJ,CAACA,GAAS,WAEde,eAAgB,CAACd,GACjBe,aAAc,CACVZ,CAACA,GAAoB,gBAEzBa,OA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AOC,KAAKf,GAAwBgB,OAAO,CAACC,EAAKC,KAC1GD,EAAIC,GAAe,CACff,OAAQH,EAAuBkB,GAAaf,OAC5CG,OAAQ,CAACf,IAEN0B,GACR,CAAA,GAEUE,EAAsCL,OAAOC,KAAKf"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../../src/components/internal/Address/utils.ts"],"sourcesContent":["import Language from '../../../language';\nimport { ADDRESS_SCHEMA } from './constants';\nimport { AddressField } from '../../../types/global-types';\nimport { StringObject, AddressType } from './types';\n\n/**\n * Used by the SRPanel sorting function to tell it whether we need to prepend the field type to the SR panel message, and, if so, we retrieve the correct translation for the field type.\n * (Whether we need to prepend the field type depends on whether we know that the error message correctly reflects the label of the field. Ultimately all error messages should do this\n * and this mapping fn will become redundant)\n */\nexport const mapFieldKey = (key: string, i18n: Language, countrySpecificLabels: StringObject): string => {\n if (ADDRESS_SCHEMA.includes(key as AddressField)) {\n return countrySpecificLabels?.[key] ? i18n.get(countrySpecificLabels?.[key]) : i18n.get(key);\n }\n return null;\n};\n\nexport const getAddressTypeFromLabel = (addressType: AddressType, label: string): AddressType => {\n if (addressType) {\n return addressType;\n }\n if (label === 'billingAddress' || label === 'deliveryAddress') {\n return label;\n }\n return undefined;\n};\n"],"names":["mapFieldKey","key","i18n","countrySpecificLabels","ADDRESS_SCHEMA","includes","get","getAddressTypeFromLabel","addressType","label"],"mappings":"gDAUO,MAAMA,EAAc,CAACC,EAAaC,EAAgBC,IACjDC,EAAeC,SAASJ,IACjBE,aAAAA,EAAAA,EAAwBF,IAAOC,EAAKI,IAAIH,eAAAA,EAAwBF,IAAQC,EAAKI,IAAIL,GAErF,KAGEM,EAA0B,CAACC,EAA0BC,IAC1DD,IAGU,mBAAVC,GAAwC,oBAAVA,EACvBA,OADX"}
1
+ {"version":3,"file":"utils.js","sources":["../../../../../src/components/internal/Address/utils.ts"],"sourcesContent":["import Language from '../../../language';\nimport { ADDRESS_SCHEMA } from './constants';\nimport { AddressField } from '../../../types/global-types';\nimport { StringObject, AddressType } from './types';\n\n/**\n * Used by the SRPanel sorting function to tell it whether we need to prepend the field type to the SR panel message, and, if so, we retrieve the correct translation for the field type.\n * (Whether we need to prepend the field type depends on whether we know that the error message correctly reflects the label of the field. Ultimately all error messages should do this\n * and this mapping fn will become redundant)\n *\n * TODO: This function should probably be using Specifications instead of hardcoded ADDRESS_SCHEMA\n */\nexport const mapFieldKey = (key: string, i18n: Language, countrySpecificLabels: StringObject): string | null => {\n if (ADDRESS_SCHEMA.includes(key as AddressField)) {\n return countrySpecificLabels?.[key] ? i18n.get(countrySpecificLabels?.[key]) : i18n.get(key);\n }\n return null;\n};\n\nexport const getAddressTypeFromLabel = (addressType: AddressType, label: string): AddressType => {\n if (addressType) {\n return addressType;\n }\n if (label === 'billingAddress' || label === 'deliveryAddress') {\n return label;\n }\n return undefined;\n};\n"],"names":["mapFieldKey","key","i18n","countrySpecificLabels","ADDRESS_SCHEMA","includes","get","getAddressTypeFromLabel","addressType","label"],"mappings":"gDAYO,MAAMA,EAAc,CAACC,EAAaC,EAAgBC,IACjDC,EAAeC,SAASJ,IACjBE,aAAAA,EAAAA,EAAwBF,IAAOC,EAAKI,IAAIH,eAAAA,EAAwBF,IAAQC,EAAKI,IAAIL,GAErF,KAGEM,EAA0B,CAACC,EAA0BC,IAC1DD,IAGU,mBAAVC,GAAwC,oBAAVA,EACvBA,OADX"}
@@ -1,2 +1,2 @@
1
- import{getFormattingRegEx as o,stripInvalidChars as t}from"../../../utils/validator-utils.js";import{convertFullToHalf as a}from"../FormFields/utils.js";const e=t=>({formatterFn:a=>a.replace(o("^\\d","g"),"").substring(0,t),format:new Array(t).fill("9").join(""),maxlength:t}),r=o=>o,l={postalCode:{formatterFn:(o,t)=>{var a;const e=t.state.data.country,r=null===(a=s[e])||void 0===a?void 0:a.postalCode.formatterFn;return r?r(o):o}},street:{formatterFn:r},houseNumberOrName:{formatterFn:r},city:{formatterFn:r}},s={AT:{postalCode:e(4)},AU:{postalCode:e(4)},BE:{postalCode:e(4)},BG:{postalCode:e(4)},BR:{postalCode:{formatterFn:t=>{const a=t.replace(o("^\\d-","g"),""),e=a.includes("-")?9:8;return a.substring(0,e)},format:"12345678 or 12345-678",maxlength:9}},CA:{postalCode:{format:"A9A 9A9 or A9A9A9",maxlength:7}},CH:{postalCode:e(4)},CY:{postalCode:e(4)},CZ:{postalCode:{format:"999 99",maxlength:6}},DE:{postalCode:e(5)},DK:{postalCode:{format:"9999",maxlength:7}},EE:{postalCode:e(5)},ES:{postalCode:e(5)},FI:{postalCode:e(5)},FR:{postalCode:e(5)},GB:{postalCode:{formatterFn:o=>t(o).substring(0,8),format:"AA99 9AA or A99 9AA or A9 9AA",maxlength:8}},GR:{postalCode:{format:"999 99",maxlength:6}},HR:{postalCode:{format:"[1-5]9999",maxlength:5}},HU:{postalCode:e(4)},IE:{postalCode:{format:"A99 A999",maxlength:8}},IS:{postalCode:e(3)},IT:{postalCode:e(5)},LI:{postalCode:e(4)},LT:{postalCode:{format:"9999 or 99999 or LT-99999",maxlength:8}},LU:{postalCode:e(4)},LV:{postalCode:{format:"9999 or LV-9999",maxlength:7}},MC:{postalCode:{format:"980NN",maxlength:5}},MT:{postalCode:{format:"AA99 or AAA99 or AA9999 or AAA9999",maxlength:8}},MY:{postalCode:e(5)},NL:{postalCode:{format:"9999AA",maxlength:7}},NZ:{postalCode:e(4)},NO:{postalCode:e(4)},PL:{postalCode:{formatterFn:t=>{const a=t.replace(o("^\\d-","g"),""),e=a.includes("-")?6:5;return a.substring(0,e)},format:"99999 or 99-999",maxlength:6}},PT:{postalCode:{formatterFn:t=>t.replace(o("^\\d-","g"),"").substring(0,8),format:"9999-999",maxlength:8}},RO:{postalCode:e(6)},SI:{postalCode:{format:"9999 or SI-9999",maxlength:7}},SE:{postalCode:e(5)},SG:{postalCode:e(6)},SK:{postalCode:{format:"99999 or SK-99999",maxlength:8}},JP:{postalCode:{formatterFn:t=>a(t).replace(o("^\\d-","g"),"").substring(0,8),format:"999-9999",maxlength:8}},US:{postalCode:{formatterFn:t=>{const a=t.replace(o("^\\d-","g"),""),e=a.includes("-")?10:5;return a.substring(0,e)},format:"99999 or 99999-9999"}}};export{l as addressFormatters,s as countrySpecificFormatters};
1
+ import{getFormattingRegEx as o,stripInvalidChars as t}from"../../../utils/validator-utils.js";import{convertFullToHalf as a}from"../FormFields/utils.js";const e=t=>({formatterFn:a=>a.replace(o("^\\d","g"),"").substring(0,t),format:new Array(t).fill("9").join(""),maxlength:t}),r=o=>o,l={postalCode:{formatterFn:(o,t)=>{var a;const e=t.state.data.country,r=e?null===(a=s[e])||void 0===a?void 0:a.postalCode.formatterFn:void 0;return r?r(o):o}},street:{formatterFn:r},houseNumberOrName:{formatterFn:r},city:{formatterFn:r}},s={AT:{postalCode:e(4)},AU:{postalCode:e(4)},BE:{postalCode:e(4)},BG:{postalCode:e(4)},BR:{postalCode:{formatterFn:t=>{const a=t.replace(o("^\\d-","g"),""),e=a.includes("-")?9:8;return a.substring(0,e)},format:"12345678 or 12345-678",maxlength:9}},CA:{postalCode:{format:"A9A 9A9 or A9A9A9",maxlength:7}},CH:{postalCode:e(4)},CY:{postalCode:e(4)},CZ:{postalCode:{format:"999 99",maxlength:6}},DE:{postalCode:e(5)},DK:{postalCode:{format:"9999",maxlength:7}},EE:{postalCode:e(5)},ES:{postalCode:e(5)},FI:{postalCode:e(5)},FR:{postalCode:e(5)},GB:{postalCode:{formatterFn:o=>t(o).substring(0,8),format:"AA99 9AA or A99 9AA or A9 9AA",maxlength:8}},GR:{postalCode:{format:"999 99",maxlength:6}},HR:{postalCode:{format:"[1-5]9999",maxlength:5}},HU:{postalCode:e(4)},IE:{postalCode:{format:"A99 A999",maxlength:8}},IS:{postalCode:e(3)},IT:{postalCode:e(5)},LI:{postalCode:e(4)},LT:{postalCode:{format:"9999 or 99999 or LT-99999",maxlength:8}},LU:{postalCode:e(4)},LV:{postalCode:{format:"9999 or LV-9999",maxlength:7}},MC:{postalCode:{format:"980NN",maxlength:5}},MT:{postalCode:{format:"AA99 or AAA99 or AA9999 or AAA9999",maxlength:8}},MY:{postalCode:e(5)},NL:{postalCode:{format:"9999AA",maxlength:7}},NZ:{postalCode:e(4)},NO:{postalCode:e(4)},PL:{postalCode:{formatterFn:t=>{const a=t.replace(o("^\\d-","g"),""),e=a.includes("-")?6:5;return a.substring(0,e)},format:"99999 or 99-999",maxlength:6}},PT:{postalCode:{formatterFn:t=>t.replace(o("^\\d-","g"),"").substring(0,8),format:"9999-999",maxlength:8}},RO:{postalCode:e(6)},SI:{postalCode:{format:"9999 or SI-9999",maxlength:7}},SE:{postalCode:e(5)},SG:{postalCode:e(6)},SK:{postalCode:{format:"99999 or SK-99999",maxlength:8}},JP:{postalCode:{formatterFn:t=>a(t).replace(o("^\\d-","g"),"").substring(0,8),format:"999-9999",maxlength:8}},US:{postalCode:{formatterFn:t=>{const a=t.replace(o("^\\d-","g"),""),e=a.includes("-")?10:5;return a.substring(0,e)},format:"99999 or 99999-9999"}}};export{l as addressFormatters,s as countrySpecificFormatters};
2
2
  //# sourceMappingURL=validate.formats.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate.formats.js","sources":["../../../../../src/components/internal/Address/validate.formats.ts"],"sourcesContent":["import { FormatterContext } from '../../../utils/Formatters/types';\nimport { CountryFormatRules, FormatRules } from '../../../utils/Validator/types';\nimport { Formatter } from '../../../utils/useForm/types';\nimport { getFormattingRegEx, stripInvalidChars } from '../../../utils/validator-utils';\nimport { convertFullToHalf } from '../FormFields/utils';\n\nconst asCountryFormatRules = <T extends CountryFormatRules>(rules: T): T & CountryFormatRules => rules;\n\nconst createFormatByDigits = (digits: number): Formatter => {\n const format = new Array(digits).fill('9').join('');\n return {\n // Formatter - excludes non digits and limits to maxlength\n formatterFn: val => val.replace(getFormattingRegEx('^\\\\d', 'g'), '').substring(0, digits),\n format,\n maxlength: digits\n };\n};\n\nconst defaultFormattingFn = (val: string) => val;\n\nexport const addressFormatters: FormatRules = {\n postalCode: {\n formatterFn: (val: string, context: FormatterContext) => {\n const country = context.state.data.country;\n\n // Country specific formatting rule\n const specificRule = countrySpecificFormatters[country]?.postalCode.formatterFn;\n if (specificRule) {\n return specificRule(val);\n }\n\n // Default formatting rule: allow anything\n return val;\n }\n },\n street: {\n formatterFn: defaultFormattingFn\n },\n houseNumberOrName: {\n formatterFn: defaultFormattingFn\n },\n city: {\n formatterFn: defaultFormattingFn\n }\n};\n\n// TODO make proper formatter fns for those entries that don't just have a straightforward, x number of digits, no spaces, format\n// check against our internal documentation on address postal code\n// which, for example, says BR isn't just 8 digits (it can be spilt by a hyphen) & CZ can also be 5 digits, no spaces\nexport const countrySpecificFormatters = asCountryFormatRules({\n AT: {\n postalCode: createFormatByDigits(4)\n },\n AU: {\n postalCode: createFormatByDigits(4)\n },\n BE: {\n postalCode: createFormatByDigits(4)\n },\n BG: {\n postalCode: createFormatByDigits(4)\n },\n BR: {\n postalCode: {\n // Formatter - excludes non digits, but allows hyphens, and limits to a maxlength that varies depending on whether a hyphen is present or not\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n const maxlength = nuVal.includes('-') ? 9 : 8;\n return nuVal.substring(0, maxlength);\n },\n format: '12345678 or 12345-678',\n maxlength: 9\n }\n },\n CA: {\n postalCode: {\n format: 'A9A 9A9 or A9A9A9',\n maxlength: 7\n }\n },\n CH: {\n postalCode: createFormatByDigits(4)\n },\n CY: {\n postalCode: createFormatByDigits(4)\n },\n CZ: {\n postalCode: {\n format: '999 99',\n maxlength: 6\n }\n },\n DE: {\n postalCode: createFormatByDigits(5)\n },\n DK: {\n postalCode: {\n format: '9999',\n maxlength: 7\n }\n },\n EE: {\n postalCode: createFormatByDigits(5)\n },\n ES: {\n postalCode: createFormatByDigits(5)\n },\n FI: {\n postalCode: createFormatByDigits(5)\n },\n FR: {\n postalCode: createFormatByDigits(5)\n },\n GB: {\n postalCode: {\n formatterFn: val => stripInvalidChars(val).substring(0, 8),\n format: 'AA99 9AA or A99 9AA or A9 9AA',\n maxlength: 8\n }\n },\n GR: {\n postalCode: {\n format: '999 99',\n maxlength: 6\n }\n },\n HR: {\n postalCode: {\n format: '[1-5]9999',\n maxlength: 5\n }\n },\n HU: {\n postalCode: createFormatByDigits(4)\n },\n IE: {\n postalCode: {\n format: 'A99 A999',\n maxlength: 8\n }\n },\n IS: {\n postalCode: createFormatByDigits(3)\n },\n IT: {\n postalCode: createFormatByDigits(5)\n },\n LI: {\n postalCode: createFormatByDigits(4)\n },\n LT: {\n postalCode: {\n format: '9999 or 99999 or LT-99999',\n maxlength: 8\n }\n },\n LU: {\n postalCode: createFormatByDigits(4)\n },\n LV: {\n postalCode: {\n format: '9999 or LV-9999',\n maxlength: 7\n }\n },\n MC: {\n postalCode: {\n format: '980NN',\n maxlength: 5\n }\n },\n MT: {\n postalCode: {\n format: 'AA99 or AAA99 or AA9999 or AAA9999',\n maxlength: 8\n }\n },\n MY: {\n postalCode: createFormatByDigits(5)\n },\n NL: {\n postalCode: {\n format: '9999AA',\n maxlength: 7\n }\n },\n NZ: {\n postalCode: createFormatByDigits(4)\n },\n NO: {\n postalCode: createFormatByDigits(4)\n },\n PL: {\n postalCode: {\n // Formatter - excludes non digits, but allows hyphens, and limits to a maxlength that varies depending on whether a hyphen is present or not\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n const maxlength = nuVal.includes('-') ? 6 : 5;\n return nuVal.substring(0, maxlength);\n },\n format: '99999 or 99-999',\n maxlength: 6\n }\n },\n PT: {\n postalCode: {\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n return nuVal.substring(0, 8);\n },\n format: '9999-999',\n maxlength: 8\n }\n },\n RO: {\n postalCode: createFormatByDigits(6)\n },\n SI: {\n postalCode: {\n format: '9999 or SI-9999',\n maxlength: 7\n }\n },\n SE: {\n postalCode: createFormatByDigits(5)\n },\n SG: {\n postalCode: createFormatByDigits(6)\n },\n SK: {\n postalCode: {\n format: '99999 or SK-99999',\n maxlength: 8\n }\n },\n JP: {\n postalCode: {\n // Formatter - converts full-width characters (common on Japanese keyboards, e.g. '107-0052') to their\n // half-width equivalent, then strips any remaining non-digit/hyphen characters (e.g. the postal mark '〒')\n formatterFn: val => convertFullToHalf(val).replace(getFormattingRegEx('^\\\\d-', 'g'), '').substring(0, 8),\n format: '999-9999',\n maxlength: 8\n }\n },\n US: {\n postalCode: {\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n const maxlength = nuVal.includes('-') ? 10 : 5;\n return nuVal.substring(0, maxlength);\n },\n format: '99999 or 99999-9999'\n }\n }\n});\n"],"names":["createFormatByDigits","digits","formatterFn","val","replace","getFormattingRegEx","substring","format","Array","fill","join","maxlength","defaultFormattingFn","addressFormatters","postalCode","context","countrySpecificFormatters","country","state","data","specificRule","street","houseNumberOrName","city","AT","AU","BE","BG","BR","nuVal","includes","CA","CH","CY","CZ","DE","DK","EE","ES","FI","FR","GB","stripInvalidChars","GR","HR","HU","IE","IS","IT","LI","LT","LU","LV","MC","MT","MY","NL","NZ","NO","PL","PT","RO","SI","SE","SG","SK","JP","convertFullToHalf","US"],"mappings":"yJAMA,MAEMA,EAAwBC,IAEnB,CAEHC,YAAaC,GAAOA,EAAIC,QAAQC,EAAmB,OAAQ,KAAM,IAAIC,UAAU,EAAGL,GAClFM,OAJW,IAAIC,MAAMP,GAAQQ,KAAK,KAAKC,KAAK,IAK5CC,UAAWV,IAIbW,EAAuBT,GAAgBA,EAEhCU,EAAiC,CAC1CC,WAAY,CACRZ,YAAa,CAACC,EAAaY,KAIFC,IAAAA,EAHrB,MAAMC,EAAUF,EAAQG,MAAMC,KAAKF,QAG7BG,UAAeJ,EAAAA,EAA0BC,UAA1BD,IAAAA,OAAAA,EAAAA,EAAoCF,WAAWZ,YACpE,OAAIkB,EACOA,EAAajB,GAIjBA,IAGfkB,OAAQ,CACJnB,YAAaU,GAEjBU,kBAA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EAAMC,SAAS,KAAO,GAAK,EAC7C,OAAOD,EAAMvB,UAAU,EAAGK,IAE9BJ,OAAQ"}
1
+ {"version":3,"file":"validate.formats.js","sources":["../../../../../src/components/internal/Address/validate.formats.ts"],"sourcesContent":["import { FormatterContext } from '../../../utils/Formatters/types';\nimport { CountryFormatRules, FormatRules } from '../../../utils/Validator/types';\nimport { Formatter } from '../../../utils/useForm/types';\nimport { getFormattingRegEx, stripInvalidChars } from '../../../utils/validator-utils';\nimport { convertFullToHalf } from '../FormFields/utils';\n\nconst asCountryFormatRules = <T extends CountryFormatRules>(rules: T): T & CountryFormatRules => rules;\n\nconst createFormatByDigits = (digits: number): Formatter => {\n const format = new Array(digits).fill('9').join('');\n return {\n // Formatter - excludes non digits and limits to maxlength\n formatterFn: val => val.replace(getFormattingRegEx('^\\\\d', 'g'), '').substring(0, digits),\n format,\n maxlength: digits\n };\n};\n\nconst defaultFormattingFn = (val: string) => val;\n\nexport const addressFormatters: FormatRules = {\n postalCode: {\n formatterFn: (val: string, context: FormatterContext) => {\n const country = context.state.data.country;\n\n // Country specific formatting rule\n const specificRule = country ? countrySpecificFormatters[country]?.postalCode.formatterFn : undefined;\n if (specificRule) {\n return specificRule(val);\n }\n\n // Default formatting rule: allow anything\n return val;\n }\n },\n street: {\n formatterFn: defaultFormattingFn\n },\n houseNumberOrName: {\n formatterFn: defaultFormattingFn\n },\n city: {\n formatterFn: defaultFormattingFn\n }\n};\n\n// TODO make proper formatter fns for those entries that don't just have a straightforward, x number of digits, no spaces, format\n// check against our internal documentation on address postal code\n// which, for example, says BR isn't just 8 digits (it can be spilt by a hyphen) & CZ can also be 5 digits, no spaces\nexport const countrySpecificFormatters = asCountryFormatRules({\n AT: {\n postalCode: createFormatByDigits(4)\n },\n AU: {\n postalCode: createFormatByDigits(4)\n },\n BE: {\n postalCode: createFormatByDigits(4)\n },\n BG: {\n postalCode: createFormatByDigits(4)\n },\n BR: {\n postalCode: {\n // Formatter - excludes non digits, but allows hyphens, and limits to a maxlength that varies depending on whether a hyphen is present or not\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n const maxlength = nuVal.includes('-') ? 9 : 8;\n return nuVal.substring(0, maxlength);\n },\n format: '12345678 or 12345-678',\n maxlength: 9\n }\n },\n CA: {\n postalCode: {\n format: 'A9A 9A9 or A9A9A9',\n maxlength: 7\n }\n },\n CH: {\n postalCode: createFormatByDigits(4)\n },\n CY: {\n postalCode: createFormatByDigits(4)\n },\n CZ: {\n postalCode: {\n format: '999 99',\n maxlength: 6\n }\n },\n DE: {\n postalCode: createFormatByDigits(5)\n },\n DK: {\n postalCode: {\n format: '9999',\n maxlength: 7\n }\n },\n EE: {\n postalCode: createFormatByDigits(5)\n },\n ES: {\n postalCode: createFormatByDigits(5)\n },\n FI: {\n postalCode: createFormatByDigits(5)\n },\n FR: {\n postalCode: createFormatByDigits(5)\n },\n GB: {\n postalCode: {\n formatterFn: val => stripInvalidChars(val).substring(0, 8),\n format: 'AA99 9AA or A99 9AA or A9 9AA',\n maxlength: 8\n }\n },\n GR: {\n postalCode: {\n format: '999 99',\n maxlength: 6\n }\n },\n HR: {\n postalCode: {\n format: '[1-5]9999',\n maxlength: 5\n }\n },\n HU: {\n postalCode: createFormatByDigits(4)\n },\n IE: {\n postalCode: {\n format: 'A99 A999',\n maxlength: 8\n }\n },\n IS: {\n postalCode: createFormatByDigits(3)\n },\n IT: {\n postalCode: createFormatByDigits(5)\n },\n LI: {\n postalCode: createFormatByDigits(4)\n },\n LT: {\n postalCode: {\n format: '9999 or 99999 or LT-99999',\n maxlength: 8\n }\n },\n LU: {\n postalCode: createFormatByDigits(4)\n },\n LV: {\n postalCode: {\n format: '9999 or LV-9999',\n maxlength: 7\n }\n },\n MC: {\n postalCode: {\n format: '980NN',\n maxlength: 5\n }\n },\n MT: {\n postalCode: {\n format: 'AA99 or AAA99 or AA9999 or AAA9999',\n maxlength: 8\n }\n },\n MY: {\n postalCode: createFormatByDigits(5)\n },\n NL: {\n postalCode: {\n format: '9999AA',\n maxlength: 7\n }\n },\n NZ: {\n postalCode: createFormatByDigits(4)\n },\n NO: {\n postalCode: createFormatByDigits(4)\n },\n PL: {\n postalCode: {\n // Formatter - excludes non digits, but allows hyphens, and limits to a maxlength that varies depending on whether a hyphen is present or not\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n const maxlength = nuVal.includes('-') ? 6 : 5;\n return nuVal.substring(0, maxlength);\n },\n format: '99999 or 99-999',\n maxlength: 6\n }\n },\n PT: {\n postalCode: {\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n return nuVal.substring(0, 8);\n },\n format: '9999-999',\n maxlength: 8\n }\n },\n RO: {\n postalCode: createFormatByDigits(6)\n },\n SI: {\n postalCode: {\n format: '9999 or SI-9999',\n maxlength: 7\n }\n },\n SE: {\n postalCode: createFormatByDigits(5)\n },\n SG: {\n postalCode: createFormatByDigits(6)\n },\n SK: {\n postalCode: {\n format: '99999 or SK-99999',\n maxlength: 8\n }\n },\n JP: {\n postalCode: {\n // Formatter - converts full-width characters (common on Japanese keyboards, e.g. '107-0052') to their\n // half-width equivalent, then strips any remaining non-digit/hyphen characters (e.g. the postal mark '〒')\n formatterFn: val => convertFullToHalf(val).replace(getFormattingRegEx('^\\\\d-', 'g'), '').substring(0, 8),\n format: '999-9999',\n maxlength: 8\n }\n },\n US: {\n postalCode: {\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n const maxlength = nuVal.includes('-') ? 10 : 5;\n return nuVal.substring(0, maxlength);\n },\n format: '99999 or 99999-9999'\n }\n }\n});\n"],"names":["createFormatByDigits","digits","formatterFn","val","replace","getFormattingRegEx","substring","format","Array","fill","join","maxlength","defaultFormattingFn","addressFormatters","postalCode","context","countrySpecificFormatters","country","state","data","specificRule","undefined","street","houseNumberOrName","city","AT","AU","BE","BG","BR","nuVal","includes","CA","CH","CY","CZ","DE","DK","EE","ES","FI","FR","GB","stripInvalidChars","GR","HR","HU","IE","IS","IT","LI","LT","LU","LV","MC","MT","MY","NL","NZ","NO","PL","PT","RO","SI","SE","SG","SK","JP","convertFullToHalf","US"],"mappings":"yJAMA,MAEMA,EAAwBC,IAEnB,CAEHC,YAAaC,GAAOA,EAAIC,QAAQC,EAAmB,OAAQ,KAAM,IAAIC,UAAU,EAAGL,GAClFM,OAJW,IAAIC,MAAMP,GAAQQ,KAAK,KAAKC,KAAK,IAK5CC,UAAWV,IAIbW,EAAuBT,GAAgBA,EAEhCU,EAAiC,CAC1CC,WAAY,CACRZ,YAAa,CAACC,EAAaY,KAIQC,IAAAA,EAH/B,MAAMC,EAAUF,EAAQG,MAAMC,KAAKF,QAG7BG,EAAeH,EAA4C,QAAlCD,EAAAA,EAA0BC,UAA1BD,IAAAA,OAAAA,EAAAA,EAAoCF,WAAWZ,iBAAcmB,EAC5F,OAAID,EACOA,EAAajB,GAIjBA,IAGfmB,OAAQ,CACJpB,YAAaU,GAEjBW,kBAAmB,CACfrB,YAAaU,GAEjBY,KAAM,CACFtB,YAAaU,IAORI,EAAiD,CAC1DS,GAAI,CACAX,WAAYd,EAAqB,IAErC0B,GAAI,CACAZ,WAAYd,EAAqB,IAErC2B,GAAI,CACAb,WAAYd,EAAqB,IAErC4B,GAAI,CACAd,WAAYd,EAAqB,IAErC6B,GAAI,CACAf,WAAY,CAERZ,YAAaC,IACT,MAAM2B,EAAQ3B,EAAIC,QAAQC,EAAmB,QAAS,KAAM,IACtDM,EAAYmB,EAAMC,SAAS,KAAO,EAAI,EAC5C,OAAOD,EAAMxB,UAAU,EAAGK,IAE9BJ,OAAQ,wBACRI,UAAW,IAGnBqB,GAAI,CACAlB,WAAY,CACRP,OAAQ,oBACRI,UAAW,IAGnBsB,GAAI,CACAnB,WAAYd,EAAqB,IAErCkC,GAAI,CACApB,WAAYd,EAAqB,IAErCmC,GAAI,CACArB,WAAY,CACRP,OAAQ,SACRI,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,UAAU,EAAGK,IAE9BJ,OAAQ,kBACRI,UAAW,IAGnBkD,GAAI,CACA/C,WAAY,CACRZ,YAAaC,GACKA,EAAIC,QAAQC,EAAmB,QAAS,KAAM,IAC/CC,UAAU,EAAG,GAE9BC,OAAQ,WACRI,UAAW,IAGnBmD,GAAI,CACAhD,WAAYd,EAAqB,IAErC+D,GAAI,CACAjD,WAAY,CACRP,OAAQ,kBACRI,UAAW,IAGnBqD,GAAI,CACAlD,WAAYd,EAAqB,IAErCiE,GAAI,CACAnD,WAAYd,EAAqB,IAErCkE,GAAI,CACApD,WAAY,CACRP,OAAQ,oBACRI,UAAW,IAGnBwD,GAAI,CACArD,WAAY,CAGRZ,YAAaC,GAAOiE,EAAkBjE,GAAKC,QAAQC,EAAmB,QAAS,KAAM,IAAIC,UAAU,EAAG,GACtGC,OAAQ,WACRI,UAAW,IAGnB0D,GAAI,CACAvD,WAAY,CACRZ,YAAaC,IACT,MAAM2B,EAAQ3B,EAAIC,QAAQC,EAAmB,QAAS,KAAM,IACtDM,EAAYmB,EAAMC,SAAS,KAAO,GAAK,EAC7C,OAAOD,EAAMxB,UAAU,EAAGK,IAE9BJ,OAAQ"}
@@ -1,2 +1,2 @@
1
- import{render as t}from"../../../external/preact/dist/preact.js";import e from"../../../utils/uuid.js";import o from"../../../core/Errors/AdyenCheckoutError.js";import{NO_CHECKOUT_ATTEMPT_ID as r}from"../../../core/Analytics/constants.js";import{on as n,off as i}from"../../../utils/listenerUtils.js";import{createSdkData as s}from"../../../utils/createSdkData.js";import a from"../../components-name-map.js";import{PAYMENT_METHOD_BEHAVIOR as c}from"../../../core/config.js";function u(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function h(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter(function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable}))),r.forEach(function(e){u(t,e,o[e])})}return t}function p(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e.push.apply(e,o)}return e}(Object(e)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))}),t}class d{buildElementProps(t){this.props=this.formatProps(h({},this.constructor.defaultProps,t))}formatProps(t){return t}formatData(){return{}}submitAnalytics(t){return null}handleKeyDown(t){return null}setState(t){this.state=h({},this.state,t)}get sdkDataPaymentMethodConfiguration(){}get data(){var t,e;const o=this.state.order||this.props.order,n=this.formatData(),i=Boolean(a(null===(e=n.paymentMethod)||void 0===e?void 0:e.type)),u=this.core.modules.risk.riskData,d=null!==(t=this.core.modules.analytics.checkoutAttemptId)&&void 0!==t?t:r,m=i?c.NATIVE:c.GENERIC,l=this.sdkDataPaymentMethodConfiguration,f=s({checkoutAttemptId:d,clientData:u,paymentMethodBehavior:m,paymentMethodConfiguration:l});return n.paymentMethod&&d&&(n.paymentMethod.checkoutAttemptId=d),n.paymentMethod&&f&&(n.paymentMethod.sdkData=f),p(h({},u&&{riskData:{clientData:u}},o&&{order:{orderData:o.orderData,pspReference:o.pspReference}},n),{clientStateDataIndicator:!0})}activate(){}render(){throw new Error("Payment method cannot be rendered.")}mount(e){const o="string"==typeof e?document.querySelector(e):e;if(!o)throw new Error("Component could not mount. Root node was not found.");return this._node&&this.unmount(),this._node=o,n(this._node,"keydown",this.handleKeyDown,!1),this._component=this.render(),t(this._component,o),this}update(t){return this.props=this.formatProps(h({},this.props,t)),this.state={},this.unmount().mount(this._node)}unmount(){return i(this._node,"keydown",this.handleKeyDown),this._node&&t(null,this._node),this}remove(){this.unmount(),this.core&&this.core.remove(this)}constructor(t,r){u(this,"_id",`${this.constructor.type}-${e()}`),u(this,"core",void 0),u(this,"props",void 0),u(this,"state",{}),u(this,"_component",void 0),u(this,"_node",null);const n=function(t){return!!t&&("function"==typeof t.initialize&&"function"==typeof t.createFromAction)}(t);if(!n)throw new o("IMPLEMENTATION_ERROR",`Trying to initialise the component '${this.constructor.type}' without a reference to an instance of AdyenCheckout`);this.core=t,this.buildElementProps(r),this.handleKeyDown=this.handleKeyDown.bind(this)}}u(d,"defaultProps",{});export{d as default};
1
+ import{render as t}from"../../../external/preact/dist/preact.js";import e from"../../../utils/uuid.js";import o from"../../../core/Errors/AdyenCheckoutError.js";import{NO_CHECKOUT_ATTEMPT_ID as r}from"../../../core/Analytics/constants.js";import{on as n,off as s}from"../../../utils/listenerUtils.js";import{createSdkData as i}from"../../../utils/createSdkData.js";import a from"../../components-name-map.js";import{PAYMENT_METHOD_BEHAVIOR as c}from"../../../core/config.js";function u(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function h(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter(function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable}))),r.forEach(function(e){u(t,e,o[e])})}return t}function p(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e.push.apply(e,o)}return e}(Object(e)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))}),t}const d="Component could not mount. Root node was not found.";class m{buildElementProps(t){this.props=this.formatProps(h({},this.constructor.defaultProps,t))}formatProps(t){return t}formatData(){return{}}submitAnalytics(t){}handleKeyDown(t){}get mountedNode(){if(!this._node)throw new Error(d);return this._node}setState(t){this.state=h({},this.state,t)}get data(){var t,e;const o=this.state.order||this.props.order,n=this.formatData(),s=Boolean(a(null===(e=n.paymentMethod)||void 0===e?void 0:e.type)),u=this.core.modules.risk.riskData,d=null!==(t=this.core.modules.analytics.checkoutAttemptId)&&void 0!==t?t:r,m=s?c.NATIVE:c.GENERIC,l=i(d,u,m);return n.paymentMethod&&d&&(n.paymentMethod.checkoutAttemptId=d),n.paymentMethod&&l&&(n.paymentMethod.sdkData=l),p(h({},u&&{riskData:{clientData:u}},o&&{order:{orderData:o.orderData,pspReference:o.pspReference}},n),{clientStateDataIndicator:!0})}activate(){}render(){throw new Error("Payment method cannot be rendered.")}mount(e){const o="string"==typeof e?document.querySelector(e):e;if(!o)throw new Error(d);return this._node&&this.unmount(),this._node=o,n(this._node,"keydown",this.handleKeyDown,!1),this._component=this.render(),t(this._component,o),this}update(t){return this.props=this.formatProps(h({},this.props,t)),this.state={},this.unmount().mount(this.mountedNode)}unmount(){return this._node&&(s(this._node,"keydown",this.handleKeyDown),t(null,this._node)),this}remove(){this.unmount(),this.core&&this.core.remove(this)}constructor(t,r){u(this,"_id",`${this.constructor.type}-${e()}`),u(this,"core",void 0),u(this,"props",void 0),u(this,"state",{}),u(this,"_component",void 0),u(this,"_node",null);const n=function(t){return!!t&&("function"==typeof t.initialize&&"function"==typeof t.createFromAction)}(t);if(!n)throw new o("IMPLEMENTATION_ERROR",`Trying to initialise the component '${this.constructor.type}' without a reference to an instance of AdyenCheckout`);this.core=t,this.buildElementProps(r),this.handleKeyDown=this.handleKeyDown.bind(this)}}u(m,"defaultProps",{});export{m as default};
2
2
  //# sourceMappingURL=BaseElement.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BaseElement.js","sources":["../../../../../src/components/internal/BaseElement/BaseElement.ts"],"sourcesContent":["import { ComponentChild, h, render, TargetedKeyboardEvent } from 'preact';\nimport uuid from '../../../utils/uuid';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { NO_CHECKOUT_ATTEMPT_ID } from '../../../core/Analytics/constants';\nimport type { ICore } from '../../../core/types';\nimport type { BaseElementProps, BaseElementState, IBaseElement } from './types';\nimport type { PaymentData } from '../../../types/global-types';\nimport { off, on } from '../../../utils/listenerUtils';\nimport { AbstractAnalyticsEvent } from '../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { createSdkData, CreateSdkDataParams } from '../../../utils/createSdkData';\nimport getComponentNameOfPaymentType from '../../components-name-map';\nimport { PAYMENT_METHOD_BEHAVIOR } from '../../../core/config';\n\n/**\n * Verify if the first parameter is instance of Core.\n * We do not use 'instanceof' to avoid importing the Core class directly into this class.\n * @param checkout\n */\nfunction assertIsCoreInstance(checkout: ICore): checkout is ICore {\n if (!checkout) return false;\n const isCoreObject = typeof checkout.initialize === 'function' && typeof checkout.createFromAction === 'function';\n return isCoreObject;\n}\n\nabstract class BaseElement<P extends BaseElementProps, S extends BaseElementState = BaseElementState> implements IBaseElement<P> {\n public readonly _id = `${this.constructor['type']}-${uuid()}`;\n public readonly core: ICore;\n\n public props: P;\n public state: S = {} as S;\n public _component: ComponentChild | undefined;\n\n protected _node: HTMLElement = null;\n\n protected static readonly defaultProps = {};\n\n constructor(checkout: ICore, props?: P) {\n const isCoreInstance = assertIsCoreInstance(checkout);\n\n if (!isCoreInstance) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Trying to initialise the component '${this.constructor['type']}' without a reference to an instance of AdyenCheckout`\n );\n }\n\n this.core = checkout;\n this.buildElementProps(props);\n\n this.handleKeyDown = this.handleKeyDown.bind(this);\n }\n\n protected buildElementProps(componentProps?: P) {\n this.props = this.formatProps({ ...this.constructor['defaultProps'], ...componentProps });\n }\n\n /**\n * Executed during creation of any payment element.\n * Gives a chance to any paymentMethod to format the props we're receiving.\n */\n protected formatProps(props: P) {\n return props;\n }\n\n /**\n * Executed on the `data` getter.\n * Returns the component data necessary for the /payments request\n */\n protected formatData(): PaymentData {\n return {} as PaymentData;\n }\n\n protected submitAnalytics(_analyticsObj?: AbstractAnalyticsEvent) {\n return null;\n }\n\n protected handleKeyDown(_e: TargetedKeyboardEvent<HTMLInputElement>) {\n return null;\n }\n\n protected setState(newState: S): void {\n this.state = { ...this.state, ...newState };\n }\n\n protected get sdkDataPaymentMethodConfiguration(): CreateSdkDataParams['paymentMethodConfiguration'] {\n return undefined;\n }\n\n /**\n * Returns the component payment data ready to submit to the Checkout API\n * Note: this does not ensure validity, check isValid first\n */\n public get data(): PaymentData {\n const order = this.state.order || this.props.order;\n const componentData = this.formatData();\n const doesPaymentMethodHaveNativeComponent = Boolean(getComponentNameOfPaymentType(componentData.paymentMethod?.type));\n const clientData = this.core.modules.risk.riskData;\n const checkoutAttemptId = this.core.modules.analytics.checkoutAttemptId ?? NO_CHECKOUT_ATTEMPT_ID;\n const paymentMethodBehavior = doesPaymentMethodHaveNativeComponent ? PAYMENT_METHOD_BEHAVIOR.NATIVE : PAYMENT_METHOD_BEHAVIOR.GENERIC;\n const sdkDataPaymentMethodConfiguration = this.sdkDataPaymentMethodConfiguration;\n\n const sdkData = createSdkData({\n checkoutAttemptId,\n clientData,\n paymentMethodBehavior,\n paymentMethodConfiguration: sdkDataPaymentMethodConfiguration\n });\n\n if (componentData.paymentMethod && checkoutAttemptId) {\n componentData.paymentMethod.checkoutAttemptId = checkoutAttemptId;\n }\n\n if (componentData.paymentMethod && sdkData) {\n componentData.paymentMethod.sdkData = sdkData;\n }\n\n return {\n ...(clientData && { riskData: { clientData } }),\n ...(order && { order: { orderData: order.orderData, pspReference: order.pspReference } }),\n ...componentData,\n clientStateDataIndicator: true\n };\n }\n\n /**\n * Method used to make the payment method active\n * (Useful when there are different payment methods available and activating one PM must trigger a specific task)\n */\n public activate(): void {\n return;\n }\n\n public render(): ComponentChild | Error {\n // render() not implemented in the element\n throw new Error('Payment method cannot be rendered.');\n }\n\n /**\n * Mounts an element into the dom\n * @param domNode - Node (or selector) where we will mount the payment element\n * @returns this - the payment element instance we mounted\n */\n public mount(domNode: HTMLElement | string): this {\n const node = typeof domNode === 'string' ? document.querySelector<HTMLElement>(domNode) : domNode;\n\n if (!node) {\n throw new Error('Component could not mount. Root node was not found.');\n }\n\n if (this._node) {\n this.unmount(); // new, if this._node exists then we are \"remounting\" so we first need to unmount if it's not already been done\n }\n\n this._node = node;\n\n // Add listener for key down events, notably 'Enter' key presses\n on(this._node, 'keydown', this.handleKeyDown, false);\n\n this._component = this.render();\n\n render(this._component, node);\n\n return this;\n }\n\n /**\n * Updates props, resets the internal state and remounts the element.\n *\n * @param props - props to update\n * @returns this - the element instance\n */\n public update(props: Partial<P>): this {\n this.props = this.formatProps({ ...this.props, ...props });\n this.state = {} as S;\n\n return this.unmount().mount(this._node); // for new mount fny\n }\n\n /**\n * Unmounts a payment element from the DOM\n */\n public unmount(): this {\n // Remove listener\n off(this._node, 'keydown', this.handleKeyDown);\n\n if (this._node) {\n render(null, this._node);\n }\n\n return this;\n }\n\n /**\n * Unmounts an element and removes it from the parent instance\n * For \"destroy\" type cleanup - when you don't intend to use the component again\n */\n public remove() {\n this.unmount();\n\n if (this.core) {\n this.core.remove(this);\n }\n }\n}\n\nexport default BaseElement;\n"],"names":["BaseElement","buildElementProps","componentProps","this","props","formatProps","_object_spread","constructor","formatData","submitAnalytics","_analyticsObj","handleKeyDown","_e","setState","newState","state","sdkDataPaymentMethodConfiguration","data","_this_core_modules_analytics_checkoutAttemptId","componentData","order","doesPaymentMethodHaveNativeComponent","Boolean","getComponentNameOfPaymentType","paymentMethod","type","clientData","core","modules","risk","riskData","checkoutAttemptId","analytics","NO_CHECKOUT_ATTEMPT_ID","paymentMethodBehavior","PAYMENT_METHOD_BEHAVIOR","NATIVE","GENERIC","sdkData","createSdkData","paymentMethodConfiguration","_object_spread_props","orderData","pspReference","clientStateDataIndicator","activate","render","Error","mount","domNode","node","document","querySelector","_node","unmount","on","_component","update","off","remove","checkout","_define_property","_id","uuid","isCoreInstance","initialize","createFromAction","assertIsCoreInstance","AdyenCheckoutError","bind","defaultProps"],"mappings":"owCAwBA,MAAeA,EA4BDC,iBAAAA,CAAkBC,GACxBC,KAAKC,M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H,MAAM,uDAgBpB,OAbI5C,KAAKkD,OACLlD,KAAKmD,UAGTnD,KAAKkD,MAAQH,EAGbK,EAAGpD,KAAKkD,MAAO,UAAWlD,KAAKQ,eAAe,GAE9CR,KAAKqD,WAAarD,KAAK2C,SAEvBA,EAAO3C,KAAKqD,WAAYN,GAEjB/C,IACX,CAQOsD,MAAAA,CAAOrD,GAIV,OAHAD,KAAKC,MAAQD,KAAKE,YAAYC,EAAA,CAAA,EAAKH,KAAKC,MAAUA,IAClDD,KAAKY,MAAQ,CAAA,EAENZ,KAAKmD,UAAUN,MAAM7C,KAAKkD,MACrC,CAKA,OAAAC,GAQI,OANAI,EAAIvD,KAAKkD,MAAO,UAAWlD,KAAKQ,eAE5BR,KAAKkD,OACLP,EAAO,KAAM3C,KAAKkD,OAGflD,IACX,CAMA,MAAAwD,GACIxD,KAAKmD,UAEDnD,KAAKwB,MACLxB,KAAKwB,KAAKgC,OAAOxD,KAEzB,CAtKA,WAAAI,CAAYqD,EAAiBxD,GAX7ByD,EAAA1D,KAAgB2D,MAAM,GAAG3D,KAAKI,YAAY,QAAWwD,OACrDF,EAAA1D,KAAgBwB,eAEhBkC,EAAA1D,KAAOC,gBACPyD,EAAA1D,KAAOY,QAAW,IAClB8C,EAAA1D,KAAOqD,qBAEPK,EAAA1D,KAAUkD,QAAqB,MAK3B,MAAMW,EAnBd,SAA8BJ,GAC1B,QAAKA,IAC+C,mBAAxBA,EAASK,YAAkE,mBAA9BL,EAASM,iBAEtF,CAe+BC,CAAqBP,GAE5C,IAAKI,EACD,MAAM,IAAII,EACN,uBACA,uCAAuCjE,KAAKI,YAAY,6DAIhEJ,KAAKwB,KAAOiC,EACZzD,KAAKF,kBAAkBG,GAEvBD,KAAKQ,cAAgBR,KAAKQ,cAAc0D,KAAKlE,KACjD,EAhBA0D,EAVW7D,EAUesE,eAAe"}
1
+ {"version":3,"file":"BaseElement.js","sources":["../../../../../src/components/internal/BaseElement/BaseElement.ts"],"sourcesContent":["import { ComponentChild, h, render, TargetedKeyboardEvent } from 'preact';\nimport uuid from '../../../utils/uuid';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { NO_CHECKOUT_ATTEMPT_ID } from '../../../core/Analytics/constants';\nimport type { ICore } from '../../../core/types';\nimport type { BaseElementProps, BaseElementState, IBaseElement } from './types';\nimport type { PaymentData } from '../../../types/global-types';\nimport { off, on } from '../../../utils/listenerUtils';\nimport { AbstractAnalyticsEvent } from '../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { createSdkData } from '../../../utils/createSdkData';\nimport getComponentNameOfPaymentType from '../../components-name-map';\nimport { PAYMENT_METHOD_BEHAVIOR } from '../../../core/config';\n\nconst ROOT_NODE_NOT_FOUND = 'Component could not mount. Root node was not found.';\n\n/**\n * Verify if the first parameter is instance of Core.\n * We do not use 'instanceof' to avoid importing the Core class directly into this class.\n * @param checkout\n */\nfunction assertIsCoreInstance(checkout: ICore): checkout is ICore {\n if (!checkout) return false;\n const isCoreObject = typeof checkout.initialize === 'function' && typeof checkout.createFromAction === 'function';\n return isCoreObject;\n}\n\nabstract class BaseElement<P extends BaseElementProps, S extends BaseElementState = BaseElementState> implements IBaseElement<P> {\n public readonly _id = `${this.constructor['type']}-${uuid()}`;\n public readonly core: ICore;\n\n public props: P;\n public state: S = {} as S;\n public _component: ComponentChild | undefined;\n\n protected _node: HTMLElement | null = null;\n\n protected static readonly defaultProps = {};\n\n constructor(checkout: ICore, props?: P) {\n const isCoreInstance = assertIsCoreInstance(checkout);\n\n if (!isCoreInstance) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Trying to initialise the component '${this.constructor['type']}' without a reference to an instance of AdyenCheckout`\n );\n }\n\n this.core = checkout;\n this.buildElementProps(props);\n\n this.handleKeyDown = this.handleKeyDown.bind(this);\n }\n\n protected buildElementProps(componentProps?: P) {\n this.props = this.formatProps({ ...this.constructor['defaultProps'], ...componentProps });\n }\n\n /**\n * Executed during creation of any payment element.\n * Gives a chance to any paymentMethod to format the props we're receiving.\n */\n protected formatProps(props: P) {\n return props;\n }\n\n /**\n * Executed on the `data` getter.\n * Returns the component data necessary for the /payments request\n */\n protected formatData(): PaymentData {\n return {} as PaymentData;\n }\n\n protected submitAnalytics(_analyticsObj?: AbstractAnalyticsEvent): void {\n return;\n }\n\n protected handleKeyDown(_e: TargetedKeyboardEvent<HTMLInputElement>): void {\n return;\n }\n\n /**\n * The node the element is currently mounted into.\n * Throws the same error as `mount()` when the element has not been mounted yet.\n */\n protected get mountedNode(): HTMLElement {\n if (!this._node) {\n throw new Error(ROOT_NODE_NOT_FOUND);\n }\n return this._node;\n }\n\n protected setState(newState: S): void {\n this.state = { ...this.state, ...newState };\n }\n\n /**\n * Returns the component payment data ready to submit to the Checkout API\n * Note: this does not ensure validity, check isValid first\n */\n public get data(): PaymentData {\n const order = this.state.order || this.props.order;\n const componentData = this.formatData();\n const doesPaymentMethodHaveNativeComponent = Boolean(getComponentNameOfPaymentType(componentData.paymentMethod?.type));\n const clientData = this.core.modules.risk.riskData;\n const checkoutAttemptId = this.core.modules.analytics.checkoutAttemptId ?? NO_CHECKOUT_ATTEMPT_ID;\n const paymentMethodBehavior = doesPaymentMethodHaveNativeComponent ? PAYMENT_METHOD_BEHAVIOR.NATIVE : PAYMENT_METHOD_BEHAVIOR.GENERIC;\n\n const sdkData = createSdkData(checkoutAttemptId, clientData, paymentMethodBehavior);\n if (componentData.paymentMethod && checkoutAttemptId) {\n componentData.paymentMethod.checkoutAttemptId = checkoutAttemptId;\n }\n\n if (componentData.paymentMethod && sdkData) {\n componentData.paymentMethod.sdkData = sdkData;\n }\n\n return {\n ...(clientData && { riskData: { clientData } }),\n ...(order && { order: { orderData: order.orderData, pspReference: order.pspReference } }),\n ...componentData,\n clientStateDataIndicator: true\n };\n }\n\n /**\n * Method used to make the payment method active\n * (Useful when there are different payment methods available and activating one PM must trigger a specific task)\n */\n public activate(): void {\n return;\n }\n\n public render(): ComponentChild | Error {\n // render() not implemented in the element\n throw new Error('Payment method cannot be rendered.');\n }\n\n /**\n * Mounts an element into the dom\n * @param domNode - Node (or selector) where we will mount the payment element\n * @returns this - the payment element instance we mounted\n */\n public mount(domNode: HTMLElement | string): this {\n const node = typeof domNode === 'string' ? document.querySelector<HTMLElement>(domNode) : domNode;\n\n if (!node) {\n throw new Error(ROOT_NODE_NOT_FOUND);\n }\n\n if (this._node) {\n this.unmount(); // new, if this._node exists then we are \"remounting\" so we first need to unmount if it's not already been done\n }\n\n this._node = node;\n\n // Add listener for key down events, notably 'Enter' key presses\n on(this._node, 'keydown', this.handleKeyDown, false);\n\n this._component = this.render();\n\n render(this._component, node);\n\n return this;\n }\n\n /**\n * Updates props, resets the internal state and remounts the element.\n *\n * @param props - props to update\n * @returns this - the element instance\n */\n public update(props: Partial<P>): this {\n this.props = this.formatProps({ ...this.props, ...props });\n this.state = {} as S;\n\n return this.unmount().mount(this.mountedNode); // for new mount fny\n }\n\n /**\n * Unmounts a payment element from the DOM\n */\n public unmount(): this {\n if (this._node) {\n // Remove listener\n off(this._node, 'keydown', this.handleKeyDown);\n render(null, this._node);\n }\n\n return this;\n }\n\n /**\n * Unmounts an element and removes it from the parent instance\n * For \"destroy\" type cleanup - when you don't intend to use the component again\n */\n public remove() {\n this.unmount();\n\n if (this.core) {\n this.core.remove(this);\n }\n }\n}\n\nexport default BaseElement;\n"],"names":["ROOT_NODE_NOT_FOUND","BaseElement","buildElementProps","componentProps","this","props","formatProps","_object_spread","constructor","formatData","submitAnalytics","_analyticsObj","handleKeyDown","_e","mountedNode","_node","Error","setState","newState","state","data","_this_core_modules_analytics_checkoutAttemptId","componentData","order","doesPaymentMethodHaveNativeComponent","Boolean","getComponentNameOfPaymentType","paymentMethod","type","clientData","core","modules","risk","riskData","checkoutAttemptId","analytics","NO_CHECKOUT_ATTEMPT_ID","paymentMethodBehavior","PAYMENT_METHOD_BEHAVIOR","NATIVE","GENERIC","sdkData","createSdkData","_object_spread_props","orderData","pspReference","clientStateDataIndicator","activate","render","mount","domNode","node","document","querySelector","unmount","on","_component","update","off","remove","checkout","_define_property","_id","uuid","isCoreInstance","initialize","createFromAction","assertIsCoreInstance","AdyenCheckoutError","bind","defaultProps"],"mappings":"owCAaA,MAAMA,EAAsB,sDAa5B,MAAeC,EA4BDC,iBAAAA,CAAkBC,GACxBC,KAAKC,MAAQD,KAAKE,YAAYC,EAAA,GAAKH,KAAKI,yBAAgCL,GAC5E,CAMUG,WAAAA,CAAYD,GAClB,OAAOA,CACX,CAMA,UAAAI,GACI,MAAO,CAAA,CACX,CAEUC,eAAAA,CAAgBC,GAE1B,CAEUC,aAAAA,CAAcC,GAExB,CAMA,eAAcC,GACV,IAAKV,KAAKW,MACN,MAAM,IAAIC,MAAMhB,GAEpB,OAAOI,KAAKW,KAChB,CAEUE,QAAAA,CAASC,GACfd,KAAKe,MAAQZ,KAAKH,KAAKe,MAAUD,EACrC,CAMA,QAAWE,GAKmB,IAAAC,EAFyDC,EAFnF,MAAMC,EAAQnB,KAAKe,MAAMI,OAASnB,KAAKC,MAAMkB,MACvCD,EAAgBlB,KAAKK,aACrBe,EAAuCC,QAAQC,EAAyD,QAA3BJ,EAAAA,EAAcK,qBAAdL,IAAAA,OAAAA,EAAAA,EAA6BM,OAC1GC,EAAazB,KAAK0B,KAAKC,QAAQC,KAAKC,SACpCC,EAAiE,QAA7Cb,EAAAjB,KAAK0B,KAAKC,QAAQI,UAAUD,6BAA5Bb,EAAAA,EAAiDe,EACrEC,EAAwBb,EAAuCc,EAAwBC,OAASD,EAAwBE,QAExHC,EAAUC,EAAcR,EAAmBL,EAAYQ,GAS7D,OARIf,EAAcK,eAAiBO,IAC/BZ,EAAcK,cAAcO,kBAAoBA,GAGhDZ,EAAcK,eAAiBc,IAC/BnB,EAAcK,cAAcc,QAAUA,GAGnCE,OACCd,GAAc,CAAEI,SAAU,CAAEJ,eAC5BN,GAAS,CAAEA,MAAO,CAAEqB,UAAWrB,EAAMqB,UAAWC,aAActB,EAAMsB,eACr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B,EACZxD,KAAKF,kBAAkBG,GAEvBD,KAAKQ,cAAgBR,KAAKQ,cAAcyD,KAAKjE,KACjD,EAhBAyD,EAVW5D,EAUeqE,eAAe"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../../external/preact/dist/preact.js";import{useState as t,useEffect as o,useCallback as r}from"../../../../../../external/preact/hooks/dist/hooks.js";import s from"../../../context/useClickToPayContext.js";import n from"../../../../../../_virtual/index.js";import{useCoreContext as c}from"../../../../../../core/Context/CoreProvider.js";import{useA11yReporter as a}from"../../../../../../core/Errors/useA11yReporter.js";import i from"../../../../Icon/Icon.js";import{isSrciError as d}from"../../../services/utils.js";import{PREFIX as p}from"../../../../Icon/constants.js";import l from"../../../../Button/Button.js";const m=({onError:m,onResendCode:u,disabled:f})=>{const[k,C]=t(null),[h,j]=t(!1),{i18n:y}=c(),{startIdentityValidation:v}=s(),[_,x]=t(null);a(_),o(()=>{let e;return k>0&&(e=setTimeout(()=>C(k-1),1e3)),60===k?x(`${y.get("ctp.otp.resendCode")} - ${k}s`):0===k&&x(y.get("ctp.otp.resendCode")),()=>clearTimeout(e)},[k]),o(()=>{let e;return h&&(e=setTimeout(()=>{j(!1),C(60)},2e3)),()=>clearTimeout(e)},[h]);const b=r(async e=>{e.preventDefault();try{u(),j(!0),await v()}catch(e){if(C(0),j(!1),!d(e))return void console.error(e);m(e.reason)}},[v,m,u]);return h?e("div",{role:"alert",className:"adyen-checkout-ctp__otp-resend-code--confirmation"},y.get("ctp.otp.codeResent"),e(i,{type:`${p}checkmark_black`,height:14,width:14})):k>0?e("div",{role:"timer",className:"adyen-checkout-ctp__otp-resend-code--disabled"},y.get("ctp.otp.resendCode")," -"," ",e("span",{className:"adyen-checkout-ctp__otp-resend-code-counter"}," ",k>0&&`${k}s`," ")):e(l,{classNameModifiers:[n("otp-resend-code",{"otp-resend-code--disabled":f})],onClick:b,variant:"link",inline:!0,disabled:f},y.get("ctp.otp.resendCode"))};export{m as default};
1
+ import{createElement as e}from"../../../../../../external/preact/dist/preact.js";import{useState as t,useEffect as o,useCallback as r}from"../../../../../../external/preact/hooks/dist/hooks.js";import s from"../../../context/useClickToPayContext.js";import n from"../../../../../../_virtual/index.js";import{useCoreContext as c}from"../../../../../../core/Context/CoreProvider.js";import{useA11yReporter as a}from"../../../../../../core/Errors/useA11yReporter.js";import i from"../../../../Icon/Icon.js";import{isSrciError as d}from"../../../services/utils.js";import{PREFIX as l}from"../../../../Icon/constants.js";import p from"../../../../Button/Button.js";const m=({onError:m,onResendCode:u,disabled:f})=>{const[k,C]=t(null),[h,j]=t(!1),{i18n:y}=c(),{startIdentityValidation:v}=s(),[_,b]=t(null);a(_),o(()=>{let e;return k>0&&(e=setTimeout(()=>C(k-1),1e3)),60===k?b(`${y.get("ctp.otp.resendCode")} - ${k}s`):0===k&&b(y.get("ctp.otp.resendCode")),()=>clearTimeout(e)},[k]),o(()=>{let e;return h&&(e=setTimeout(()=>{j(!1),C(60)},2e3)),()=>clearTimeout(e)},[h]);const x=r(async e=>{e.preventDefault();try{u(),j(!0),await v()}catch(e){if(C(0),j(!1),!d(e))return void console.error(e);m(e.reason)}},[v,m,u]);return h?e("div",{role:"alert",className:"adyen-checkout-ctp__otp-resend-code--confirmation"},y.get("ctp.otp.codeResent"),e(i,{type:`${l}checkmark_black`,height:14,width:14})):k>0?e("div",{role:"timer",className:"adyen-checkout-ctp__otp-resend-code--disabled"},y.get("ctp.otp.resendCode")," -"," ",e("span",{className:"adyen-checkout-ctp__otp-resend-code-counter"}," ",k>0&&`${k}s`," ")):e(p,{classNameModifiers:[n("otp-resend-code",{"otp-resend-code--disabled":f})],onClick:x,variant:"link",inline:!0,label:y.get("ctp.otp.resendCode"),disabled:f})};export{m as default};
2
2
  //# sourceMappingURL=CtPResendOtpLink.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CtPResendOtpLink.js","sources":["../../../../../../../../src/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.tsx"],"sourcesContent":["import { h, TargetedMouseEvent } from 'preact';\nimport { useCallback, useEffect, useState } from 'preact/hooks';\nimport useClickToPayContext from '../../../context/useClickToPayContext';\nimport classnames from 'classnames';\nimport { useCoreContext } from '../../../../../../core/Context/CoreProvider';\nimport { useA11yReporter } from '../../../../../../core/Errors/useA11yReporter';\nimport Icon from '../../../../Icon';\nimport { isSrciError } from '../../../services/utils';\nimport { PREFIX } from '../../../../Icon/constants';\nimport Button from '../../../../Button';\n\nconst CONFIRMATION_SHOWING_TIME = 2000;\nconst RESEND_OTP_COUNTDOWN_SECONDS = 60;\n\ninterface CtPResendOtpLinkProps {\n onError(errorCode: string): void;\n onResendCode(): void;\n disabled: boolean;\n}\n\nconst CtPResendOtpLink = ({ onError, onResendCode, disabled }: Readonly<CtPResendOtpLinkProps>): h.JSX.Element => {\n const [counter, setCounter] = useState<number | null>(null);\n const [showConfirmation, setShowConfirmation] = useState<boolean>(false);\n const { i18n } = useCoreContext();\n const { startIdentityValidation } = useClickToPayContext();\n const [resendStatusMessage, setResendStatusMessage] = useState<string | null>(null);\n useA11yReporter(resendStatusMessage);\n\n useEffect(() => {\n let timeout: ReturnType<typeof setTimeout> | undefined;\n if (counter > 0) {\n timeout = setTimeout(() => setCounter(counter - 1), 1000);\n }\n if (counter === RESEND_OTP_COUNTDOWN_SECONDS) {\n setResendStatusMessage(`${i18n.get('ctp.otp.resendCode')} - ${counter}s`);\n } else if (counter === 0) {\n setResendStatusMessage(i18n.get('ctp.otp.resendCode'));\n }\n return () => clearTimeout(timeout);\n }, [counter]);\n\n useEffect(() => {\n let timeout: ReturnType<typeof setTimeout> | undefined;\n\n if (showConfirmation) {\n timeout = setTimeout(() => {\n setShowConfirmation(false);\n setCounter(RESEND_OTP_COUNTDOWN_SECONDS);\n }, CONFIRMATION_SHOWING_TIME);\n }\n return () => clearTimeout(timeout);\n }, [showConfirmation]);\n\n const handleResendCodeClick = useCallback(\n async (event: TargetedMouseEvent<HTMLButtonElement>) => {\n event.preventDefault();\n\n try {\n onResendCode();\n setShowConfirmation(true);\n await startIdentityValidation();\n } catch (error: unknown) {\n setCounter(0);\n setShowConfirmation(false);\n\n if (!isSrciError(error)) {\n console.error(error);\n return;\n }\n\n onError(error.reason);\n }\n },\n [startIdentityValidation, onError, onResendCode]\n );\n\n if (showConfirmation) {\n return (\n <div role=\"alert\" className=\"adyen-checkout-ctp__otp-resend-code--confirmation\">\n {i18n.get('ctp.otp.codeResent')}\n <Icon type={`${PREFIX}checkmark_black`} height={14} width={14} />\n </div>\n );\n }\n\n if (counter > 0) {\n return (\n <div role=\"timer\" className=\"adyen-checkout-ctp__otp-resend-code--disabled\">\n {i18n.get('ctp.otp.resendCode')} -{' '}\n <span className=\"adyen-checkout-ctp__otp-resend-code-counter\"> {counter > 0 && `${counter}s`} </span>\n </div>\n );\n }\n\n return (\n <Button\n classNameModifiers={[classnames('otp-resend-code', { 'otp-resend-code--disabled': disabled })]}\n onClick={handleResendCodeClick}\n variant=\"link\"\n inline={true}\n disabled={disabled}\n >\n {i18n.get('ctp.otp.resendCode')}\n </Button>\n );\n};\n\nexport default CtPResendOtpLink;\n"],"names":["CtPResendOtpLink","onError","onResendCode","disabled","counter","setCounter","useState","showConfirmation","setShowConfirmation","i18n","useCoreContext","startIdentityValidation","useClickToPayContext","resendStatusMessage","setResendStatusMessage","useA11yReporter","useEffect","timeout","setTimeout","get","clearTimeout","handleResendCodeClick","useCallback","async","event","preventDefault","error","isSrciError","console","reason","h","div","role","className","Icon","type","PREFIX","height","width","span","Button","classNameModifiers","classnames","onClick","variant","inline"],"mappings":"opBAWA,MASMA,EAAmB,EAAGC,UAASC,eAAcC,eAC/C,MAAOC,EAASC,GAAcC,EAAwB,OAC/CC,EAAkBC,GAAuBF,GAAkB,IAC5DG,KAAEA,GAASC,KACXC,wBAAEA,GAA4BC,KAC7BC,EAAqBC,GAA0BR,EAAwB,MAC9ES,EAAgBF,GAEhBG,EAAU,KACN,IAAIC,EASJ,OARIb,EAAU,IACVa,EAAUC,WAAW,IAAMb,EAAWD,EAAU,GAAI,MAnB3B,KAqBzBA,EACAU,EAAuB,GAAGL,EAAKU,IAAI,2BAA2Bf,MAC3C,IAAZA,GACPU,EAAuBL,EAAKU,IAAI,uBAE7B,IAAMC,aAAaH,IAC3B,CAACb,IAEJY,EAAU,KACN,IAAIC,EAQJ,OANIV,IACAU,EAAUC,WAAW,KACjBV,GAAoB,GACpBH,EAnCqB,KADH,MAuCnB,IAAMe,aAAaH,IAC3B,CAACV,IAEJ,MAAMc,EAAwBC,EAC1BC,MAAOC,IACHA,EAAMC,iBAEN,IACIvB,IACAM,GAAoB,SACdG,GACV,CAAE,MAAOe,GAIL,GAHArB,EAAW,GACXG,GAAoB,IAEfmB,EAAYD,GAEb,YADAE,QAAQF,MAAMA,GAIlBzB,EAAQyB,EAAMG,OAClB,GAEJ,CAAClB,EAAyBV,EAASC,IAGvC,OAAIK,EAEIuB,EAACC,MAAAA,CAAIC,KAAK,QAAQC,UAAU,qDACvBxB,EAAKU,IAAI,sBACVW,EAACI,EAAAA,CAAKC,KAAM,GAAGC,mBAAyBC,OAAQ,GAAIC,MAAO,MAKnElC,EAAU,EAEN0B,EAACC,MAAAA,CAAIC,KAAK,QAAQC,UAAU,iDACvBxB,EAAKU,IAAI,sBAAsB,KAAG,IACnCW,EAACS,OAAAA,CAAKN,UAAU,+CAA8C,IAAE7B,EAAU,GAAK,GAAGA,KAAW,MAMrG0B,EAACU,EAAAA,CACGC,mBAAoB,CAACC,EAAW,kBAAmB,CAAE,4BAA6BvC,KAClFwC,QAAStB,EACTuB,QAAQ,OACRC,QAAQ,EACR1C,SAAUA,GAETM,EAAKU,IAAI"}
1
+ {"version":3,"file":"CtPResendOtpLink.js","sources":["../../../../../../../../src/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.tsx"],"sourcesContent":["import { h, TargetedMouseEvent } from 'preact';\nimport { useCallback, useEffect, useState } from 'preact/hooks';\nimport useClickToPayContext from '../../../context/useClickToPayContext';\nimport classnames from 'classnames';\nimport { useCoreContext } from '../../../../../../core/Context/CoreProvider';\nimport { useA11yReporter } from '../../../../../../core/Errors/useA11yReporter';\nimport Icon from '../../../../Icon';\nimport { isSrciError } from '../../../services/utils';\nimport { PREFIX } from '../../../../Icon/constants';\nimport Button from '../../../../Button';\n\nconst CONFIRMATION_SHOWING_TIME = 2000;\nconst RESEND_OTP_COUNTDOWN_SECONDS = 60;\n\ninterface CtPResendOtpLinkProps {\n onError(errorCode: string): void;\n onResendCode(): void;\n disabled: boolean;\n}\n\nconst CtPResendOtpLink = ({ onError, onResendCode, disabled }: Readonly<CtPResendOtpLinkProps>): h.JSX.Element => {\n const [counter, setCounter] = useState<number | null>(null);\n const [showConfirmation, setShowConfirmation] = useState<boolean>(false);\n const { i18n } = useCoreContext();\n const { startIdentityValidation } = useClickToPayContext();\n const [resendStatusMessage, setResendStatusMessage] = useState<string | null>(null);\n useA11yReporter(resendStatusMessage);\n\n useEffect(() => {\n let timeout: ReturnType<typeof setTimeout> | undefined;\n if (counter > 0) {\n timeout = setTimeout(() => setCounter(counter - 1), 1000);\n }\n if (counter === RESEND_OTP_COUNTDOWN_SECONDS) {\n setResendStatusMessage(`${i18n.get('ctp.otp.resendCode')} - ${counter}s`);\n } else if (counter === 0) {\n setResendStatusMessage(i18n.get('ctp.otp.resendCode'));\n }\n return () => clearTimeout(timeout);\n }, [counter]);\n\n useEffect(() => {\n let timeout: ReturnType<typeof setTimeout> | undefined;\n\n if (showConfirmation) {\n timeout = setTimeout(() => {\n setShowConfirmation(false);\n setCounter(RESEND_OTP_COUNTDOWN_SECONDS);\n }, CONFIRMATION_SHOWING_TIME);\n }\n return () => clearTimeout(timeout);\n }, [showConfirmation]);\n\n const handleResendCodeClick = useCallback(\n async (event: TargetedMouseEvent<HTMLButtonElement>) => {\n event.preventDefault();\n\n try {\n onResendCode();\n setShowConfirmation(true);\n await startIdentityValidation();\n } catch (error: unknown) {\n setCounter(0);\n setShowConfirmation(false);\n\n if (!isSrciError(error)) {\n console.error(error);\n return;\n }\n\n onError(error.reason);\n }\n },\n [startIdentityValidation, onError, onResendCode]\n );\n\n if (showConfirmation) {\n return (\n <div role=\"alert\" className=\"adyen-checkout-ctp__otp-resend-code--confirmation\">\n {i18n.get('ctp.otp.codeResent')}\n <Icon type={`${PREFIX}checkmark_black`} height={14} width={14} />\n </div>\n );\n }\n\n if (counter > 0) {\n return (\n <div role=\"timer\" className=\"adyen-checkout-ctp__otp-resend-code--disabled\">\n {i18n.get('ctp.otp.resendCode')} -{' '}\n <span className=\"adyen-checkout-ctp__otp-resend-code-counter\"> {counter > 0 && `${counter}s`} </span>\n </div>\n );\n }\n\n return (\n <Button\n classNameModifiers={[classnames('otp-resend-code', { 'otp-resend-code--disabled': disabled })]}\n onClick={handleResendCodeClick}\n variant=\"link\"\n inline={true}\n label={i18n.get('ctp.otp.resendCode')}\n disabled={disabled}\n />\n );\n};\n\nexport default CtPResendOtpLink;\n"],"names":["CtPResendOtpLink","onError","onResendCode","disabled","counter","setCounter","useState","showConfirmation","setShowConfirmation","i18n","useCoreContext","startIdentityValidation","useClickToPayContext","resendStatusMessage","setResendStatusMessage","useA11yReporter","useEffect","timeout","setTimeout","get","clearTimeout","handleResendCodeClick","useCallback","async","event","preventDefault","error","isSrciError","console","reason","h","div","role","className","Icon","type","PREFIX","height","width","span","Button","classNameModifiers","classnames","onClick","variant","inline","label"],"mappings":"opBAWA,MASMA,EAAmB,EAAGC,UAASC,eAAcC,eAC/C,MAAOC,EAASC,GAAcC,EAAwB,OAC/CC,EAAkBC,GAAuBF,GAAkB,IAC5DG,KAAEA,GAASC,KACXC,wBAAEA,GAA4BC,KAC7BC,EAAqBC,GAA0BR,EAAwB,MAC9ES,EAAgBF,GAEhBG,EAAU,KACN,IAAIC,EASJ,OARIb,EAAU,IACVa,EAAUC,WAAW,IAAMb,EAAWD,EAAU,GAAI,MAnB3B,KAqBzBA,EACAU,EAAuB,GAAGL,EAAKU,IAAI,2BAA2Bf,MAC3C,IAAZA,GACPU,EAAuBL,EAAKU,IAAI,uBAE7B,IAAMC,aAAaH,IAC3B,CAACb,IAEJY,EAAU,KACN,IAAIC,EAQJ,OANIV,IACAU,EAAUC,WAAW,KACjBV,GAAoB,GACpBH,EAnCqB,KADH,MAuCnB,IAAMe,aAAaH,IAC3B,CAACV,IAEJ,MAAMc,EAAwBC,EAC1BC,MAAOC,IACHA,EAAMC,iBAEN,IACIvB,IACAM,GAAoB,SACdG,GACV,CAAE,MAAOe,GAIL,GAHArB,EAAW,GACXG,GAAoB,IAEfmB,EAAYD,GAEb,YADAE,QAAQF,MAAMA,GAIlBzB,EAAQyB,EAAMG,OAClB,GAEJ,CAAClB,EAAyBV,EAASC,IAGvC,OAAIK,EAEIuB,EAACC,MAAAA,CAAIC,KAAK,QAAQC,UAAU,qDACvBxB,EAAKU,IAAI,sBACVW,EAACI,EAAAA,CAAKC,KAAM,GAAGC,mBAAyBC,OAAQ,GAAIC,MAAO,MAKnElC,EAAU,EAEN0B,EAACC,MAAAA,CAAIC,KAAK,QAAQC,UAAU,iDACvBxB,EAAKU,IAAI,sBAAsB,KAAG,IACnCW,EAACS,OAAAA,CAAKN,UAAU,+CAA8C,IAAE7B,EAAU,GAAK,GAAGA,KAAW,MAMrG0B,EAACU,EAAAA,CACGC,mBAAoB,CAACC,EAAW,kBAAmB,CAAE,4BAA6BvC,KAClFwC,QAAStB,EACTuB,QAAQ,OACRC,QAAQ,EACRC,MAAOrC,EAAKU,IAAI,sBAChBhB,SAAUA"}
@@ -1,2 +1,2 @@
1
- import{createElement as t}from"../../../../../external/preact/dist/preact.js";import o from"../../context/useClickToPayContext.js";import{CtpState as e}from"../../services/ClickToPayService.js";import r from"../../../../../_virtual/index.js";import{useMemo as n}from"../../../../../external/preact/hooks/dist/hooks.js";import{useCoreContext as s}from"../../../../../core/Context/CoreProvider.js";import i from"../../../Button/Button.js";const a=()=>{const{ctpState:a,logoutShopper:l,status:c,cards:u}=o(),{i18n:d}=s();if(!1===[e.Ready,e.OneTimePassword].includes(a))return null;const m=n(()=>a===e.Ready&&u.length>1?d.get("ctp.logout.notYourCards"):a===e.Ready&&1===u.length?d.get("ctp.logout.notYourCard"):a===e.Ready&&0===u.length?d.get("ctp.logout.notYourProfile"):d.get("ctp.logout.notYou"),[d,a]);return t(i,{classNameModifiers:[r("section-logout-button",{"section-logout-button--disabled":"loading"===c})],disabled:"loading"===c,onClick:l,variant:"link",inline:!0},m)};export{a as default};
1
+ import{createElement as t}from"../../../../../external/preact/dist/preact.js";import o from"../../context/useClickToPayContext.js";import{CtpState as e}from"../../services/ClickToPayService.js";import r from"../../../../../_virtual/index.js";import{useMemo as n}from"../../../../../external/preact/hooks/dist/hooks.js";import{useCoreContext as s}from"../../../../../core/Context/CoreProvider.js";import i from"../../../Button/Button.js";const a=()=>{const{ctpState:a,logoutShopper:l,status:c,cards:u}=o(),{i18n:d}=s();if(!1===[e.Ready,e.OneTimePassword].includes(a))return null;const m=n(()=>a===e.Ready&&u.length>1?d.get("ctp.logout.notYourCards"):a===e.Ready&&1===u.length?d.get("ctp.logout.notYourCard"):a===e.Ready&&0===u.length?d.get("ctp.logout.notYourProfile"):d.get("ctp.logout.notYou"),[d,a]);return t(i,{classNameModifiers:[r("section-logout-button",{"section-logout-button--disabled":"loading"===c})],disabled:"loading"===c,onClick:l,variant:"link",inline:!0,label:m})};export{a as default};
2
2
  //# sourceMappingURL=CtPLogoutLink.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CtPLogoutLink.js","sources":["../../../../../../../src/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.tsx"],"sourcesContent":["import { h } from 'preact';\nimport useClickToPayContext from '../../context/useClickToPayContext';\nimport { CtpState } from '../../services/ClickToPayService';\nimport classnames from 'classnames';\nimport { useMemo } from 'preact/hooks';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport './CtPLogoutLink.scss';\nimport Button from '../../../Button';\n\nconst CtPLogoutLink = () => {\n const { ctpState, logoutShopper, status, cards } = useClickToPayContext();\n const { i18n } = useCoreContext();\n\n if ([CtpState.Ready, CtpState.OneTimePassword].includes(ctpState) === false) {\n return null;\n }\n\n const label = useMemo(() => {\n if (ctpState === CtpState.Ready && cards.length > 1) return i18n.get('ctp.logout.notYourCards');\n if (ctpState === CtpState.Ready && cards.length === 1) return i18n.get('ctp.logout.notYourCard');\n if (ctpState === CtpState.Ready && cards.length === 0) return i18n.get('ctp.logout.notYourProfile');\n return i18n.get('ctp.logout.notYou');\n }, [i18n, ctpState]);\n\n return (\n <Button\n classNameModifiers={[\n classnames('section-logout-button', {\n 'section-logout-button--disabled': status === 'loading'\n })\n ]}\n disabled={status === 'loading'}\n onClick={logoutShopper}\n variant=\"link\"\n inline={true}\n >\n {label}\n </Button>\n );\n};\n\nexport default CtPLogoutLink;\n"],"names":["CtPLogoutLink","ctpState","logoutShopper","status","cards","useClickToPayContext","i18n","useCoreContext","CtpState","Ready","OneTimePassword","includes","label","useMemo","length","get","h","Button","classNameModifiers","classnames","disabled","onClick","variant","inline"],"mappings":"qbASA,MAAMA,EAAgB,KAClB,MAAMC,SAAEA,EAAQC,cAAEA,EAAaC,OAAEA,EAAMC,MAAEA,GAAUC,KAC7CC,KAAEA,GAASC,IAEjB,IAAsE,IAAlE,CAACC,EAASC,MAAOD,EAASE,iBAAiBC,SAASV,GACpD,OAAO,KAGX,MAAMW,EAAQC,EAAQ,IACdZ,IAAaO,EAASC,OAASL,EAAMU,OAAS,EAAUR,EAAKS,IAAI,2BACjEd,IAAaO,EAASC,OAA0B,IAAjBL,EAAMU,OAAqBR,EAAKS,IAAI,0BACnEd,IAAaO,EAASC,OAA0B,IAAjBL,EAAMU,OAAqBR,EAAKS,IAAI,6BAChET,EAAKS,IAAI,qBACjB,CAACT,EAAML,IAEV,OACIe,EAACC,EAAAA,CACGC,mBAAoB,CAChBC,EAAW,wBAAyB,CAChC,kCAA8C,YAAXhB,KAG3CiB,SAAqB,YAAXjB,EACVkB,QAASnB,EACToB,QAAQ,OACRC,QAAQ,GAEPX"}
1
+ {"version":3,"file":"CtPLogoutLink.js","sources":["../../../../../../../src/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.tsx"],"sourcesContent":["import { h } from 'preact';\nimport useClickToPayContext from '../../context/useClickToPayContext';\nimport { CtpState } from '../../services/ClickToPayService';\nimport classnames from 'classnames';\nimport { useMemo } from 'preact/hooks';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport './CtPLogoutLink.scss';\nimport Button from '../../../Button';\n\nconst CtPLogoutLink = () => {\n const { ctpState, logoutShopper, status, cards } = useClickToPayContext();\n const { i18n } = useCoreContext();\n\n if ([CtpState.Ready, CtpState.OneTimePassword].includes(ctpState) === false) {\n return null;\n }\n\n const label = useMemo(() => {\n if (ctpState === CtpState.Ready && cards.length > 1) return i18n.get('ctp.logout.notYourCards');\n if (ctpState === CtpState.Ready && cards.length === 1) return i18n.get('ctp.logout.notYourCard');\n if (ctpState === CtpState.Ready && cards.length === 0) return i18n.get('ctp.logout.notYourProfile');\n return i18n.get('ctp.logout.notYou');\n }, [i18n, ctpState]);\n\n return (\n <Button\n classNameModifiers={[\n classnames('section-logout-button', {\n 'section-logout-button--disabled': status === 'loading'\n })\n ]}\n disabled={status === 'loading'}\n onClick={logoutShopper}\n variant=\"link\"\n inline={true}\n label={label}\n />\n );\n};\n\nexport default CtPLogoutLink;\n"],"names":["CtPLogoutLink","ctpState","logoutShopper","status","cards","useClickToPayContext","i18n","useCoreContext","CtpState","Ready","OneTimePassword","includes","label","useMemo","length","get","h","Button","classNameModifiers","classnames","disabled","onClick","variant","inline"],"mappings":"qbASA,MAAMA,EAAgB,KAClB,MAAMC,SAAEA,EAAQC,cAAEA,EAAaC,OAAEA,EAAMC,MAAEA,GAAUC,KAC7CC,KAAEA,GAASC,IAEjB,IAAsE,IAAlE,CAACC,EAASC,MAAOD,EAASE,iBAAiBC,SAASV,GACpD,OAAO,KAGX,MAAMW,EAAQC,EAAQ,IACdZ,IAAaO,EAASC,OAASL,EAAMU,OAAS,EAAUR,EAAKS,IAAI,2BACjEd,IAAaO,EAASC,OAA0B,IAAjBL,EAAMU,OAAqBR,EAAKS,IAAI,0BACnEd,IAAaO,EAASC,OAA0B,IAAjBL,EAAMU,OAAqBR,EAAKS,IAAI,6BAChET,EAAKS,IAAI,qBACjB,CAACT,EAAML,IAEV,OACIe,EAACC,EAAAA,CACGC,mBAAoB,CAChBC,EAAW,wBAAyB,CAChC,kCAA8C,YAAXhB,KAG3CiB,SAAqB,YAAXjB,EACVkB,QAASnB,EACToB,QAAQ,OACRC,QAAQ,EACRX,MAAOA"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../external/preact/dist/preact.js";import{useRef as r,useEffect as t}from"../../../external/preact/hooks/dist/hooks.js";import i from"../FormFields/Fieldset/Fieldset.js";import o from"../FormFields/Field/Field.js";import n from"./ReadOnlyCompanyDetails.js";import{companyDetailsValidationRules as a}from"./validate.js";import{useCoreContext as s}from"../../../core/Context/CoreProvider.js";import{getFormattedData as l}from"./utils.js";import m from"../../../utils/useForm/useForm.js";import"../SecuredFields/lib/CSF/utils/userAgent.js";import u from"../FormFields/InputText.js";function c(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function p(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},i=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.forEach(function(r){c(e,r,t[r])})}return e}function d(e,r){return r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):function(e){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r.push.apply(r,t)}return r}(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}const b=["name","registrationNumber"];function f(c){const{label:b="",namePrefix:f,requiredFields:g,visibility:y}=c,{i18n:j}=s(),{handleChangeFor:O,triggerValidation:v,data:F,valid:h,errors:N,isValid:P}=m({schema:g,rules:p({},a,c.validationRules),defaultData:c.data}),w=r({});var C;Object.keys(w.current).length||(null===(C=c.setComponentRef)||void 0===C||C.call(c,w.current));w.current.showValidation=()=>{v()};const D=e=>`${f?`${f}.`:""}${e}`,k=e=>r=>{const{name:t}=r.target,i=t.split(`${f}.`).pop();O(i,e)(r)},M=e=>r=>{const{name:t}=r.target,i=t.split(`${f}.`).pop();O(i,e)(r)};return t(()=>{const e=l(F);c.onChange({data:e,valid:h,errors:N,isValid:P})},[F,h,N,P]),"hidden"===y?null:"readOnly"===y?e(n,d(p({},c),{data:F})):e(i,{classNameModifiers:[b],label:b},g.includes("name")&&e(o,{label:j.get("companyDetails.name"),classNameModifiers:["name"],errorMessage:!!N.name,i18n:j,name:D("companyName")},e(u,{name:D("name"),value:F.name,classNameModifiers:["name"],onInput:M("input"),onBlur:k("blur"),spellcheck:!1,autocomplete:"organization"})),g.includes("registrationNumber")&&e(o,{label:j.get("companyDetails.registrationNumber"),classNameModifiers:["registrationNumber"],errorMessage:!!N.registrationNumber,i18n:j,name:D("registrationNumber")},e(u,{name:D("registrationNumber"),value:F.registrationNumber,classNameModifiers:["registrationNumber"],onInput:M("input"),onBlur:k("blur"),spellcheck:!1,autocomplete:void 0})))}f.defaultProps={data:{},onChange:()=>{},visibility:"editable",requiredFields:b,validationRules:a};export{b as COMPANY_DETAILS_SCHEMA,f as default};
1
+ import{createElement as e}from"../../../external/preact/dist/preact.js";import{useRef as r,useEffect as t}from"../../../external/preact/hooks/dist/hooks.js";import o from"../FormFields/Fieldset/Fieldset.js";import n from"../FormFields/Field/Field.js";import i from"./ReadOnlyCompanyDetails.js";import{companyDetailsValidationRules as a}from"./validate.js";import{useCoreContext as s}from"../../../core/Context/CoreProvider.js";import{getFormattedData as l}from"./utils.js";import m from"../../../utils/useForm/useForm.js";import"../SecuredFields/lib/CSF/utils/userAgent.js";import c from"../FormFields/InputText.js";function u(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function p(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},o=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.forEach(function(r){u(e,r,t[r])})}return e}function d(e,r){return r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):function(e){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r.push.apply(r,t)}return r}(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}const b=["name","registrationNumber"];function f(u){const{label:f="",namePrefix:g,requiredFields:j=b,visibility:y="editable",data:O={},onChange:v=()=>{},validationRules:F=a}=u,{i18n:h}=s(),{handleChangeFor:N,triggerValidation:P,data:w,valid:D,errors:k,isValid:C}=m({schema:j,rules:p({},a,F),defaultData:O}),M=r({});var x;Object.keys(M.current).length||(null===(x=u.setComponentRef)||void 0===x||x.call(u,M.current));M.current.showValidation=()=>{P()};const S=e=>`${g?`${g}.`:""}${e}`,$=e=>r=>{const{name:t}=r.target,o=g?t.split(`${g}.`).pop():t;o&&N(o,e)(r)},E=e=>r=>{const{name:t}=r.target,o=g?t.split(`${g}.`).pop():t;o&&N(o,e)(r)};return t(()=>{const e=l(w);v({data:e,valid:D,errors:k,isValid:C})},[w,D,k,C]),"hidden"===y?null:"readOnly"===y?e(i,d(p({},u),{data:w})):e(o,{classNameModifiers:[f],label:f},j.includes("name")&&e(n,{label:h.get("companyDetails.name"),classNameModifiers:["name"],errorMessage:!!k.name,i18n:h,name:S("companyName")},e(c,{name:S("name"),value:w.name,classNameModifiers:["name"],onInput:E("input"),onBlur:$("blur"),spellcheck:!1,autocomplete:"organization"})),j.includes("registrationNumber")&&e(n,{label:h.get("companyDetails.registrationNumber"),classNameModifiers:["registrationNumber"],errorMessage:!!k.registrationNumber,i18n:h,name:S("registrationNumber")},e(c,{name:S("registrationNumber"),value:w.registrationNumber,classNameModifiers:["registrationNumber"],onInput:E("input"),onBlur:$("blur"),spellcheck:!1,autocomplete:void 0})))}export{b as COMPANY_DETAILS_SCHEMA,f as default};
2
2
  //# sourceMappingURL=CompanyDetails.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CompanyDetails.js","sources":["../../../../../src/components/internal/CompanyDetails/CompanyDetails.tsx"],"sourcesContent":["import { h, FocusEventHandler, InputEventHandler } from 'preact';\nimport { useEffect, useRef } from 'preact/hooks';\nimport Fieldset from '../FormFields/Fieldset';\nimport Field from '../FormFields/Field';\nimport ReadOnlyCompanyDetails from './ReadOnlyCompanyDetails';\nimport { companyDetailsValidationRules } from './validate';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { getFormattedData } from './utils';\nimport { CompanyDetailsSchema, CompanyDetailsProps } from './types';\nimport useForm from '../../../utils/useForm';\nimport InputText from '../FormFields/InputText';\nimport { ComponentMethodsRef } from '../UIElement/types';\nimport { HandleChangeForModeType } from '../../../utils/useForm/types';\n\nexport const COMPANY_DETAILS_SCHEMA = ['name', 'registrationNumber'];\n\nexport default function CompanyDetails(props: Readonly<CompanyDetailsProps>) {\n const { label = '', namePrefix, requiredFields, visibility } = props;\n const { i18n } = useCoreContext();\n const { handleChangeFor, triggerValidation, data, valid, errors, isValid } = useForm<CompanyDetailsSchema>({\n schema: requiredFields,\n rules: { ...companyDetailsValidationRules, ...props.validationRules },\n defaultData: props.data\n });\n\n /** An object by which to expose 'public' members to the parent UIElement */\n const companyDetailsRef = useRef<ComponentMethodsRef>({});\n // Just call once\n if (!Object.keys(companyDetailsRef.current).length) {\n props.setComponentRef?.(companyDetailsRef.current);\n }\n\n // Expose method expected by (parent) Address.tsx\n companyDetailsRef.current.showValidation = () => {\n triggerValidation();\n };\n\n const generateFieldName = (name: string): string => `${namePrefix ? `${namePrefix}.` : ''}${name}`;\n\n const eventHandler =\n (mode: HandleChangeForModeType): FocusEventHandler<HTMLInputElement> =>\n (e): void => {\n const { name } = e.target as HTMLInputElement;\n const key = name.split(`${namePrefix}.`).pop();\n\n handleChangeFor(key, mode)(e);\n };\n\n const inputEventHandler =\n (mode: HandleChangeForModeType): InputEventHandler<HTMLInputElement> =>\n (e): void => {\n const { name } = e.target as HTMLInputElement;\n const key = name.split(`${namePrefix}.`).pop();\n\n handleChangeFor(key, mode)(e);\n };\n\n useEffect(() => {\n const formattedData = getFormattedData(data);\n props.onChange({ data: formattedData, valid, errors, isValid });\n }, [data, valid, errors, isValid]);\n\n if (visibility === 'hidden') return null;\n if (visibility === 'readOnly') return <ReadOnlyCompanyDetails {...props} data={data} />;\n\n return (\n <Fieldset classNameModifiers={[label]} label={label}>\n {requiredFields.includes('name') && (\n <Field\n label={i18n.get('companyDetails.name')}\n classNameModifiers={['name']}\n errorMessage={!!errors.name}\n i18n={i18n}\n name={generateFieldName('companyName')}\n >\n <InputText\n name={generateFieldName('name')}\n value={data.name}\n classNameModifiers={['name']}\n onInput={inputEventHandler('input')}\n onBlur={eventHandler('blur')}\n spellcheck={false}\n autocomplete={'organization'}\n />\n </Field>\n )}\n\n {requiredFields.includes('registrationNumber') && (\n <Field\n label={i18n.get('companyDetails.registrationNumber')}\n classNameModifiers={['registrationNumber']}\n errorMessage={!!errors.registrationNumber}\n i18n={i18n}\n name={generateFieldName('registrationNumber')}\n >\n <InputText\n name={generateFieldName('registrationNumber')}\n value={data.registrationNumber}\n classNameModifiers={['registrationNumber']}\n onInput={inputEventHandler('input')}\n onBlur={eventHandler('blur')}\n spellcheck={false}\n autocomplete={undefined}\n />\n </Field>\n )}\n </Fieldset>\n );\n}\n\nCompanyDetails.defaultProps = {\n data: {},\n onChange: () => {},\n visibility: 'editable',\n requiredFields: COMPANY_DETAILS_SCHEMA,\n validationRules: companyDetailsValidationRules\n};\n"],"names":["COMPANY_DETAILS_SCHEMA","CompanyDetails","props","label","namePrefix","requiredFields","visibility","i18n","useCoreContext","handleChangeFor","triggerValidation","data","valid","errors","isValid","useForm","schema","rules","_object_spread","companyDetailsValidationRules","validationRules","defaultData","companyDetailsRef","useRef","Object","keys","current","length","setComponentRef","showValidation","generateFieldName","name","eventHandler","mode","e","target","key","split","pop","inputEventHandler","useEffect","formattedData","getFormattedData","onChange","h","ReadOnlyCompanyDetails","Fieldset","classNameModifiers","includes","Field","get","errorMessage","InputText","value","onInput","onBlur","spellcheck","autocomplete","registrationNumber","undefined","defaultProps"],"mappings":"u5CAcaA,EAAyB,CAAC,OAAQ,sBAEhC,SAASC,EAAeC,GACnC,MAAMC,MAAEA,EAAQ,GAAEC,WAAEA,EAAUC,eAAEA,EAAcC,WAAEA,GAAeJ,GACzDK,KAAEA,GAASC,KACXC,gBAAEA,EAAeC,kBAAEA,EAAiBC,KAAEA,EAAIC,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,GAAYC,EAA8B,CACvGC,OAAQX,EACRY,MAAOC,EAAA,CAAA,EAAKC,EAAkCjB,EAAMkB,iBACpDC,YAAanB,EAAMS,OAIjBW,EAAoBC,EAA4B,IAGlDrB,IAAAA,EADCsB,OAAOC,KAAKH,EAAkBI,SAASC,SACnB,QAArBzB,EAAAA,EAAM0B,2BAAN1B,GAAAA,EAAAA,KAAAA,EAAwBoB,EAAkBI,UAI9CJ,EAAkBI,QAAQG,eAAiB,KACvCnB,KAGJ,MAAMoB,EAAqBC,GAAyB,GAAG3B,EAAa,GAAGA,KAAgB,KAAK2B,IAEtFC,EACDC,GACAC,IACG,MAAMH,KAAEA,GAASG,EAAEC,OACbC,EAAML,EAAKM,MAAM,GAAGjC,MAAekC,MAEzC7B,EAAgB2B,EAAKH,EAArBxB,CAA2ByB,IAG7BK,EACDN,GACAC,IACG,MAAMH,KAAEA,GAASG,EAAEC,OACbC,EAAML,EAAKM,MAAM,GAAGjC,MAAekC,MAEzC7B,EAAgB2B,EAAKH,EAArBxB,CAA2ByB,IAQnC,OALAM,EAAU,KACN,MAAMC,EAAgBC,EAAiB/B,GACvCT,EAAMyC,SAAS,CAAEhC,KAAM8B,EAAe7B,QAAOC,SAAQC,aACtD,CAACH,EAAMC,EAAOC,EAAQC,IAEN,WAAfR,EAAgC,KACjB,aAAfA,EAAkCsC,EAACC,EAAAA,EAAAA,EAAAA,GAA2B3C,GAAAA,CAAOS,KAAMA,KAG3EiC,EAACE,EAAAA,CAASC,mBAAoB,CAAC5C,GAAQA,MAAOA,GACzCE,EAAe2C,SAAS,SACrBJ,EAACK,EAAAA,CACG9C,MAAOI,EAAK2C,IAAI,uBAChBH,mBAAoB,CAAC,QACrBI,eAAgBtC,EAAOkB,KACvBxB,KAAMA,EACNwB,KAAMD,EAAkB,gBAExBc,EAACQ,EAAAA,CACGrB,KAAMD,EAAkB,QACxBuB,MAAO1C,EAAKoB,KACZgB,mBAAoB,CAAC,QACrBO,QAASf,EAAkB,SAC3BgB,OAAQvB,EAAa,QACrBwB,YAAY,EACZC,aAAc,kBAKzBpD,EAAe2C,SAAS,uBACrBJ,EAACK,EAAAA,CACG9C,MAAOI,EAAK2C,IAAI,qCAChBH,mBAAoB,CAAC,sBACrBI,eAAgBtC,EAAO6C,mBACvBnD,KAAMA,EACNwB,KAAMD,EAAkB,uBAExBc,EAACQ,EAAAA,CACGrB,KAAMD,EAAkB,sBACxBuB,MAAO1C,EAAK+C,mBACZX,mBAAoB,CAAC,sBACrBO,QAASf,EAAkB,SAC3BgB,OAAQvB,EAAa,QACrBwB,YAAY,EACZC,kBAAcE,KAMtC,CAEA1D,EAAe2D,aAAe,CAC1BjD,KAAM,CAAA,EACNgC,SAAU,OACVrC,WAAY,WACZD,eAAgBL,EAChBoB,gBAAiBD"}
1
+ {"version":3,"file":"CompanyDetails.js","sources":["../../../../../src/components/internal/CompanyDetails/CompanyDetails.tsx"],"sourcesContent":["import { h, FocusEventHandler, InputEventHandler } from 'preact';\nimport { useEffect, useRef } from 'preact/hooks';\nimport Fieldset from '../FormFields/Fieldset';\nimport Field from '../FormFields/Field';\nimport ReadOnlyCompanyDetails from './ReadOnlyCompanyDetails';\nimport { companyDetailsValidationRules } from './validate';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { getFormattedData } from './utils';\nimport { CompanyDetailsSchema, CompanyDetailsProps } from './types';\nimport useForm from '../../../utils/useForm';\nimport InputText from '../FormFields/InputText';\nimport { ComponentMethodsRef } from '../UIElement/types';\nimport { HandleChangeForModeType } from '../../../utils/useForm/types';\n\nexport const COMPANY_DETAILS_SCHEMA = ['name', 'registrationNumber'];\n\nexport default function CompanyDetails(props: Readonly<CompanyDetailsProps>) {\n const {\n label = '',\n namePrefix,\n requiredFields = COMPANY_DETAILS_SCHEMA,\n visibility = 'editable',\n data: initialData = {},\n onChange = () => {},\n validationRules = companyDetailsValidationRules\n } = props;\n const { i18n } = useCoreContext();\n const { handleChangeFor, triggerValidation, data, valid, errors, isValid } = useForm<CompanyDetailsSchema>({\n schema: requiredFields,\n rules: { ...companyDetailsValidationRules, ...validationRules },\n defaultData: initialData\n });\n\n /** An object by which to expose 'public' members to the parent UIElement */\n const companyDetailsRef = useRef<ComponentMethodsRef>({});\n // Just call once\n if (!Object.keys(companyDetailsRef.current).length) {\n props.setComponentRef?.(companyDetailsRef.current);\n }\n\n // Expose method expected by (parent) Address.tsx\n companyDetailsRef.current.showValidation = () => {\n triggerValidation();\n };\n\n const generateFieldName = (name: string): string => `${namePrefix ? `${namePrefix}.` : ''}${name}`;\n\n const eventHandler =\n (mode: HandleChangeForModeType): FocusEventHandler<HTMLInputElement> =>\n (e): void => {\n const { name } = e.target as HTMLInputElement;\n const key = namePrefix ? name.split(`${namePrefix}.`).pop() : name;\n\n if (!key) return;\n handleChangeFor(key, mode)(e);\n };\n\n const inputEventHandler =\n (mode: HandleChangeForModeType): InputEventHandler<HTMLInputElement> =>\n (e): void => {\n const { name } = e.target as HTMLInputElement;\n const key = namePrefix ? name.split(`${namePrefix}.`).pop() : name;\n\n if (!key) return;\n handleChangeFor(key, mode)(e);\n };\n\n useEffect(() => {\n const formattedData = getFormattedData(data);\n onChange({ data: formattedData, valid, errors, isValid });\n }, [data, valid, errors, isValid]);\n\n if (visibility === 'hidden') return null;\n if (visibility === 'readOnly') return <ReadOnlyCompanyDetails {...props} data={data} />;\n\n return (\n <Fieldset classNameModifiers={[label]} label={label}>\n {requiredFields.includes('name') && (\n <Field\n label={i18n.get('companyDetails.name')}\n classNameModifiers={['name']}\n errorMessage={!!errors.name}\n i18n={i18n}\n name={generateFieldName('companyName')}\n >\n <InputText\n name={generateFieldName('name')}\n value={data.name}\n classNameModifiers={['name']}\n onInput={inputEventHandler('input')}\n onBlur={eventHandler('blur')}\n spellcheck={false}\n autocomplete={'organization'}\n />\n </Field>\n )}\n\n {requiredFields.includes('registrationNumber') && (\n <Field\n label={i18n.get('companyDetails.registrationNumber')}\n classNameModifiers={['registrationNumber']}\n errorMessage={!!errors.registrationNumber}\n i18n={i18n}\n name={generateFieldName('registrationNumber')}\n >\n <InputText\n name={generateFieldName('registrationNumber')}\n value={data.registrationNumber}\n classNameModifiers={['registrationNumber']}\n onInput={inputEventHandler('input')}\n onBlur={eventHandler('blur')}\n spellcheck={false}\n autocomplete={undefined}\n />\n </Field>\n )}\n </Fieldset>\n );\n}\n"],"names":["COMPANY_DETAILS_SCHEMA","CompanyDetails","props","label","namePrefix","requiredFields","visibility","data","initialData","onChange","validationRules","companyDetailsValidationRules","i18n","useCoreContext","handleChangeFor","triggerValidation","valid","errors","isValid","useForm","schema","rules","_object_spread","defaultData","companyDetailsRef","useRef","Object","keys","current","length","setComponentRef","showValidation","generateFieldName","name","eventHandler","mode","e","target","key","split","pop","inputEventHandler","useEffect","formattedData","getFormattedData","h","ReadOnlyCompanyDetails","Fieldset","classNameModifiers","includes","Field","get","errorMessage","In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,EAAAA,EAAAA,GAA2B5C,GAAAA,CAAOK,KAAMA,KAG3EsC,EAACE,EAAAA,CAASC,mBAAoB,CAAC7C,GAAQA,MAAOA,GACzCE,EAAe4C,SAAS,SACrBJ,EAACK,EAAAA,CACG/C,MAAOS,EAAKuC,IAAI,uBAChBH,mBAAoB,CAAC,QACrBI,eAAgBnC,EAAOgB,KACvBrB,KAAMA,EACNqB,KAAMD,EAAkB,gBAExBa,EAACQ,EAAAA,CACGpB,KAAMD,EAAkB,QACxBsB,MAAO/C,EAAK0B,KACZe,mBAAoB,CAAC,QACrBO,QAASd,EAAkB,SAC3Be,OAAQtB,EAAa,QACrBuB,YAAY,EACZC,aAAc,kBAKzBrD,EAAe4C,SAAS,uBACrBJ,EAACK,EAAAA,CACG/C,MAAOS,EAAKuC,IAAI,qCAChBH,mBAAoB,CAAC,sBACrBI,eAAgBnC,EAAO0C,mBACvB/C,KAAMA,EACNqB,KAAMD,EAAkB,uBAExBa,EAACQ,EAAAA,CACGpB,KAAMD,EAAkB,sBACxBsB,MAAO/C,EAAKoD,mBACZX,mBAAoB,CAAC,sBACrBO,QAASd,EAAkB,SAC3Be,OAAQtB,EAAa,QACrBuB,YAAY,EACZC,kBAAcE,KAMtC"}
@@ -1,2 +1,2 @@
1
- import{isEmpty as r}from"../../../utils/validator-utils.js";import{SF_ErrorCodes as e}from"../../../core/Errors/constants.js";const a={default:{validate:r=>r&&r.length>0,modes:["blur"],errorMessage:e.ERROR_MSG_INCOMPLETE_FIELD},name:{validate:e=>!r(e)||null,errorMessage:"companyDetails.name.invalid",modes:["blur"]},registrationNumber:{validate:e=>!r(e)||null,errorMessage:"companyDetails.registrationNumber.invalid",modes:["blur"]}};export{a as companyDetailsValidationRules};
1
+ import{isEmpty as r}from"../../../utils/validator-utils.js";import{SF_ErrorCodes as e}from"../../../core/Errors/constants.js";const a={default:{validate:e=>!r(e)||null,modes:["blur"],errorMessage:e.ERROR_MSG_INCOMPLETE_FIELD},name:{validate:e=>!r(e)||null,errorMessage:"companyDetails.name.invalid",modes:["blur"]},registrationNumber:{validate:e=>!r(e)||null,errorMessage:"companyDetails.registrationNumber.invalid",modes:["blur"]}};export{a as companyDetailsValidationRules};
2
2
  //# sourceMappingURL=validate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate.js","sources":["../../../../../src/components/internal/CompanyDetails/validate.ts"],"sourcesContent":["import { ValidatorRules } from '../../../utils/Validator/types';\nimport { isEmpty } from '../../../utils/validator-utils';\nimport { SF_ErrorCodes } from '../../../core/Errors/constants';\n\nexport const companyDetailsValidationRules: ValidatorRules = {\n default: {\n validate: value => {\n return value && value.length > 0;\n },\n modes: ['blur'],\n errorMessage: SF_ErrorCodes.ERROR_MSG_INCOMPLETE_FIELD // = 'err-gen-9100'\n },\n name: {\n validate: value => (isEmpty(value) ? null : true), // valid, if there are chars other than spaces\n errorMessage: 'companyDetails.name.invalid',\n modes: ['blur']\n },\n registrationNumber: {\n validate: value => (isEmpty(value) ? null : true),\n errorMessage: 'companyDetails.registrationNumber.invalid',\n modes: ['blur']\n }\n};\n"],"names":["companyDetailsValidationRules","default","validate","value","length","modes","errorMessage","SF_ErrorCodes","ERROR_MSG_INCOMPLETE_FIELD","name","isEmpty","registrationNumber"],"mappings":"oIAIaA,EAAgD,CACzDC,QAAS,CACLC,SAAUC,GACCA,GAASA,EAAMC,OAAS,EAEnCC,MAAO,CAAC,QACRC,aAAcC,EAAcC,4BAEhCC,KAAM,CACFP,SAAUC,IAAUO,EAAQP,IAAS,KACrCG,aAAc,8BACdD,MAAO,CAAC,SAEZM,mBAAoB,CAChBT,SAAUC,IAAUO,EAAQP,IAAS,KACrCG,aAAc,4CACdD,MAAO,CAAC"}
1
+ {"version":3,"file":"validate.js","sources":["../../../../../src/components/internal/CompanyDetails/validate.ts"],"sourcesContent":["import { ValidatorRules } from '../../../utils/Validator/types';\nimport { isEmpty } from '../../../utils/validator-utils';\nimport { SF_ErrorCodes } from '../../../core/Errors/constants';\n\nexport const companyDetailsValidationRules: ValidatorRules = {\n default: {\n validate: value => (isEmpty(value) ? null : true), // valid, if there are chars other than spaces\n modes: ['blur'],\n errorMessage: SF_ErrorCodes.ERROR_MSG_INCOMPLETE_FIELD // = 'err-gen-9100'\n },\n name: {\n validate: value => (isEmpty(value) ? null : true), // valid, if there are chars other than spaces\n errorMessage: 'companyDetails.name.invalid',\n modes: ['blur']\n },\n registrationNumber: {\n validate: value => (isEmpty(value) ? null : true),\n errorMessage: 'companyDetails.registrationNumber.invalid',\n modes: ['blur']\n }\n};\n"],"names":["companyDetailsValidationRules","default","validate","value","isEmpty","modes","errorMessage","SF_ErrorCodes","ERROR_MSG_INCOMPLETE_FIELD","name","registrationNumber"],"mappings":"oIAIaA,EAAgD,CACzDC,QAAS,CACLC,SAAUC,IAAUC,EAAQD,IAAS,KACrCE,MAAO,CAAC,QACRC,aAAcC,EAAcC,4BAEhCC,KAAM,CACFP,SAAUC,IAAUC,EAAQD,IAAS,KACrCG,aAAc,8BACdD,MAAO,CAAC,SAEZK,mBAAoB,CAChBR,SAAUC,IAAUC,EAAQD,IAAS,KACrCG,aAAc,4CACdD,MAAO,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ConsentCheckboxLabel.js","sources":["../../../../../src/components/internal/ConsentCheckboxLabel/ConsentCheckboxLabel.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\n\ninterface ConsentCheckboxLabelProps {\n url: string;\n}\n\nexport default function ConsentCheckboxLabel(props: Readonly<ConsentCheckboxLabelProps>) {\n const { i18n } = useCoreContext();\n const linkText = i18n.get('paymentConditions');\n const translationString = i18n.get('afterPay.agreement');\n const [textBeforeLink, textAfterLink] = translationString.split('%@');\n\n if (textBeforeLink && textAfterLink) {\n return (\n <Fragment>\n {textBeforeLink}\n <a className=\"adyen-checkout-link\" target=\"_blank\" rel=\"noopener noreferrer\" href={props.url}>\n {linkText}\n </a>\n {textAfterLink}\n </Fragment>\n );\n }\n\n return <span className=\"adyen-checkout__checkbox__label\">{i18n.get('privacyPolicy')}</span>;\n}\n"],"names":["ConsentCheckboxLabel","props","i18n","useCoreContext","linkText","get","translationString","textBeforeLink","textAfterLink","split","h","Fragment","a","className","target","rel","href","url","span"],"mappings":"6JAOe,SAASA,EAAqBC,GACzC,MAAMC,KAAEA,GAASC,IACXC,EAAWF,EAAKG,IAAI,qBACpBC,EAAoBJ,EAAKG,IAAI,uBAC5BE,EAAgBC,GAAiBF,EAAkBG,MAAM,MAEhE,OAAIF,GAAkBC,EAEdE,EAACC,EAAAA,KACIJ,EACDG,EAACE,IAAAA,CAAEC,UAAU,sBAAsBC,OAAO,SAASC,IAAI,sBAAsBC,KAAMf,EAAMgB,KACpFb,GAEJI,GAKNE,EAACQ,OAAAA,CAAKL,UAAU,mCAAmCX,EAAKG,IAAI,iBACvE"}
1
+ {"version":3,"file":"ConsentCheckboxLabel.js","sources":["../../../../../src/components/internal/ConsentCheckboxLabel/ConsentCheckboxLabel.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\n\ninterface ConsentCheckboxLabelProps {\n url?: string;\n}\n\nexport default function ConsentCheckboxLabel(props: Readonly<ConsentCheckboxLabelProps>) {\n const { i18n } = useCoreContext();\n const linkText = i18n.get('paymentConditions');\n const translationString = i18n.get('afterPay.agreement');\n const [textBeforeLink, textAfterLink] = translationString.split('%@');\n\n if (textBeforeLink && textAfterLink) {\n return (\n <Fragment>\n {textBeforeLink}\n <a className=\"adyen-checkout-link\" target=\"_blank\" rel=\"noopener noreferrer\" href={props.url}>\n {linkText}\n </a>\n {textAfterLink}\n </Fragment>\n );\n }\n\n return <span className=\"adyen-checkout__checkbox__label\">{i18n.get('privacyPolicy')}</span>;\n}\n"],"names":["ConsentCheckboxLabel","props","i18n","useCoreContext","linkText","get","translationString","textBeforeLink","textAfterLink","split","h","Fragment","a","className","target","rel","href","url","span"],"mappings":"6JAOe,SAASA,EAAqBC,GACzC,MAAMC,KAAEA,GAASC,IACXC,EAAWF,EAAKG,IAAI,qBACpBC,EAAoBJ,EAAKG,IAAI,uBAC5BE,EAAgBC,GAAiBF,EAAkBG,MAAM,MAEhE,OAAIF,GAAkBC,EAEdE,EAACC,EAAAA,KACIJ,EACDG,EAACE,IAAAA,CAAEC,UAAU,sBAAsBC,OAAO,SAASC,IAAI,sBAAsBC,KAAMf,EAAMgB,KACpFb,GAEJI,GAKNE,EAACQ,OAAAA,CAAKL,UAAU,mCAAmCX,EAAKG,IAAI,iBACvE"}
@@ -1,2 +1,2 @@
1
- import e from"../../../../_virtual/index.js";import{createElement as t,Fragment as n,toChildArray as a,cloneElement as l}from"../../../../external/preact/dist/preact.js";import r from"../../Spinner/Spinner.js";import o from"../../Icon/Icon.js";import{ARIA_ERROR_SUFFIX as i,ARIA_CONTEXT_SUFFIX as c}from"../../../../core/Errors/constants.js";import{useRef as s,useMemo as d,useState as u,useCallback as p}from"../../../../external/preact/hooks/dist/hooks.js";import{getUniqueId as m}from"../../../../utils/idGenerator.js";import{PREFIX as f}from"../../Icon/constants.js";import h from"../../../../utils/uuid.js";function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},a=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),a.forEach(function(t){y(e,t,n[t])})}return e}function b(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}const k=y=>{const{children:k,className:v,classNameModifiers:j,dir:O,disabled:g,readOnly:x,errorMessage:w,helper:E,inputWrapperModifiers:N,isLoading:F,isValid:P,label:$,labelEndAdornment:L,name:S,onBlur:I,onFieldBlur:C,onFocus:A,onFocusField:M,showValidIcon:T,useLabelElement:V,showErrorElement:D,showContextualElement:q,staticValue:B,contextualText:H,filled:R,focused:W,i18n:z,contextVisibleToScreenReader:G,renderAlternativeToLabel:J,onInputContainerClick:K,errorLive:Q}=y,U=null==G||G,X=D&&"string"==typeof w&&w.length>0,Y=q&&!X&&H&&H.length>0,Z=s(m(`adyen-checkout-${S}`)),ee=d(()=>B?`input-static-value-${h()}`:null,[B]),[te,ne]=u(!1),[ae,le]=u(!1);null!=W&&ne(!!W),null!=R&&le(!!R);const re=p(e=>{ne(!0),null==A||A(e)},[A]),oe=p(e=>{ne(!1),null==I||I(e),null==C||C(e)},[I,C]),ie=p(()=>t(n,null,"string"==typeof $&&t("span",{className:e({"adyen-checkout__label__text":!0,"adyen-checkout__label__text--error":w}),"data-id":S,"data-testid":S},$),"function"==typeof $&&$(),L&&t("span",{className:"adyen-checkout__label-adornment--end"},L),E&&t("span",{className:"adyen-checkout__helper-text"},E)),[$,w,L,E]),ce=p(()=>{const s=t("span",_(b(_({className:e({"adyen-checkout-contextual-text--error":!0,"adyen-checkout-contextual-text--hidden":!X})},U&&{id:`${Z.current}${i}`}),{"aria-hidden":U?void 0:"true"}),U&&Q&&{"aria-live":"polite"}),w),d=t("span",b(_({className:e({"adyen-checkout-contextual-text":!0,"adyen-checkout-contextual-text--hidden":!Y})},U&&{id:`${Z.current}${c}`}),{"aria-hidden":U?void 0:"true"}),H);return t(n,null,t("div",{className:e(["adyen-checkout__input-wrapper",...N.map(e=>`adyen-checkout__input-wrapper--${e}`)]),dir:O,onClick:K},B&&t("span",{id:ee,className:"adyen-checkout__field-static-value"},B),a(k).map(e=>{const t=b(_({isValid:P,onFocusHandler:re,onBlurHandler:oe,isInvalid:!!w,"aria-owns":ee},S&&{uniqueId:Z.current}),{showErrorElement:D});return l(e,t)}),F&&t("span",{className:"adyen-checkout-input__inline-validation adyen-checkout-input__inline-validation--loading"},t(r,{size:"small"})),P&&!1!==T&&t("span",{className:"adyen-checkout-input__inline-validation adyen-checkout-input__inline-validation--valid"},t(o,{type:`${f}checkmark_black`,alt:null==z?void 0:z.get("field.valid")})),w&&t("span",{className:"adyen-checkout-input__inline-validation adyen-checkout-input__inline-validation--invalid"},t(o,{type:`${f}field_error`,alt:null==z?void 0:z.get("error.title")}))),s,d)},[k,w,H,F,P,re,oe]),se=p(({onFocusField:n,focused:a,filled:l,disabled:r,name:o,uniqueId:i,useLabelElement:c,isSecuredField:s,children:d,renderAlternativeToLabel:u})=>{const p={onClick:n,className:e({"adyen-checkout__label":!0,"adyen-checkout__label--focused":a,"adyen-checkout__label--filled":l,"adyen-checkout__label--disabled":r})};return c?t("label",_({},p,!s&&o&&{htmlFor:i,id:`${i}-label`}),d):u(p,d,i)},[]);return t("div",{"data-testid":"form-field",className:e("adyen-checkout__field",v,null==j?void 0:j.map(e=>`adyen-checkout__field--${e}`),{"adyen-checkout__field--error":w,"adyen-checkout__field--valid":P,"adyen-checkout__field--inactive":x||g})},t(se,{onFocusField:M,name:S,disabled:g,filled:ae,focused:te,useLabelElement:V,uniqueId:Z.current,isSecuredField:!U,renderAlternativeToLabel:J},ie()),ce())};k.defaultProps={className:"",classNameModifiers:[],inputWrapperModifiers:[],useLabelElement:!0,showErrorElement:!0,showContextualElement:!0,renderAlternativeToLabel:()=>null};export{k as default};
1
+ import e from"../../../../_virtual/index.js";import{createElement as t,Fragment as n,toChildArray as a,cloneElement as l}from"../../../../external/preact/dist/preact.js";import r from"../../Spinner/Spinner.js";import i from"../../Icon/Icon.js";import{ARIA_ERROR_SUFFIX as o,ARIA_CONTEXT_SUFFIX as c}from"../../../../core/Errors/constants.js";import{useRef as d,useMemo as s,useState as u,useCallback as p}from"../../../../external/preact/hooks/dist/hooks.js";import{getUniqueId as m}from"../../../../utils/idGenerator.js";import{PREFIX as f}from"../../Icon/constants.js";import y from"../../../../utils/uuid.js";function _(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},a=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),a.forEach(function(t){_(e,t,n[t])})}return e}function b(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}const k=_=>{const{children:k,className:v="",classNameModifiers:j,dir:O,disabled:g,readOnly:x,errorMessage:w,helper:E,inputWrapperModifiers:N=[],isLoading:F,isValid:P,label:$,labelEndAdornment:S,name:I,onBlur:L,onFieldBlur:C,onFocus:A,onFocusField:T,showValidIcon:V,useLabelElement:D=!0,showErrorElement:M=!0,showContextualElement:q=!0,staticValue:B,contextualText:H,filled:R,focused:z,i18n:G,contextVisibleToScreenReader:W,renderAlternativeToLabel:J=()=>null,onInputContainerClick:K,errorLive:Q}=_,U=null==W||W,X=M&&"string"==typeof w&&w.length>0,Y=q&&!X&&H&&H.length>0,Z=d(m(`adyen-checkout-${I}`)),ee=s(()=>B?`input-static-value-${y()}`:void 0,[B]),[te,ne]=u(!1),[ae,le]=u(!1);null!=z&&ne(!!z),null!=R&&le(!!R);const re=p(e=>{ne(!0),null==A||A(e)},[A]),ie=p(e=>{ne(!1),null==L||L(e),null==C||C(e)},[L,C]),oe=p(()=>t(n,null,"string"==typeof $&&t("span",{className:e({"adyen-checkout__label__text":!0,"adyen-checkout__label__text--error":w}),"data-id":I,"data-testid":I},$),"function"==typeof $&&$(),S&&t("span",{className:"adyen-checkout__label-adornment--end"},S),E&&t("span",{className:"adyen-checkout__helper-text"},E)),[$,w,S,E]),ce=p(()=>{const d=t("span",h(b(h({className:e({"adyen-checkout-contextual-text--error":!0,"adyen-checkout-contextual-text--hidden":!X})},U&&{id:`${Z.current}${o}`}),{"aria-hidden":U?void 0:"true"}),U&&Q&&{"aria-live":"polite"}),w),s=t("span",b(h({className:e({"adyen-checkout-contextual-text":!0,"adyen-checkout-contextual-text--hidden":!Y})},U&&{id:`${Z.current}${c}`}),{"aria-hidden":U?void 0:"true"}),H);return t(n,null,t("div",{className:e(["adyen-checkout__input-wrapper",...N.map(e=>`adyen-checkout__input-wrapper--${e}`)]),dir:O,onClick:K},B&&t("span",{id:ee,className:"adyen-checkout__field-static-value"},B),a(k).map(e=>{const t=b(h({isValid:P,onFocusHandler:re,onBlurHandler:ie,isInvalid:!!w,"aria-owns":ee},I&&{uniqueId:Z.current}),{showErrorElement:M});return l(e,t)}),F&&t("span",{className:"adyen-checkout-input__inline-validation adyen-checkout-input__inline-validation--loading"},t(r,{size:"small"})),P&&!1!==V&&t("span",{className:"adyen-checkout-input__inline-validation adyen-checkout-input__inline-validation--valid"},t(i,{type:`${f}checkmark_black`,alt:null==G?void 0:G.get("field.valid")})),w&&t("span",{className:"adyen-checkout-input__inline-validation adyen-checkout-input__inline-validation--invalid"},t(i,{type:`${f}field_error`,alt:null==G?void 0:G.get("error.title")}))),d,s)},[k,w,H,F,P,re,ie]),de=p(({onFocusField:n,focused:a,filled:l,disabled:r,name:i,uniqueId:o,useLabelElement:c,isSecuredField:d,children:s,renderAlternativeToLabel:u})=>{const p={onClick:n,className:e({"adyen-checkout__label":!0,"adyen-checkout__label--focused":a,"adyen-checkout__label--filled":l,"adyen-checkout__label--disabled":r})};return c?t("label",h({},p,!d&&i&&{htmlFor:o,id:`${o}-label`}),s):u(p,s,o)},[]);return t("div",{"data-testid":"form-field",className:e("adyen-checkout__field",v,null==j?void 0:j.map(e=>`adyen-checkout__field--${e}`),{"adyen-checkout__field--error":w,"adyen-checkout__field--valid":P,"adyen-checkout__field--inactive":x||g})},t(de,{onFocusField:T,name:I,disabled:g,filled:ae,focused:te,useLabelElement:D,uniqueId:Z.current,isSecuredField:!U,renderAlternativeToLabel:J},oe()),ce())};export{k as default};
2
2
  //# sourceMappingURL=Field.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Field.js","sources":["../../../../../../src/components/internal/FormFields/Field/Field.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport { cloneElement, ComponentChild, Fragment, FunctionalComponent, h, toChildArray, VNode } from 'preact';\nimport Spinner from '../../Spinner';\nimport Icon from '../../Icon';\nimport { ARIA_CONTEXT_SUFFIX, ARIA_ERROR_SUFFIX } from '../../../../core/Errors/constants';\nimport { useCallback, useMemo, useRef, useState } from 'preact/hooks';\nimport { getUniqueId } from '../../../../utils/idGenerator';\nimport { FieldProps } from './types';\nimport './Field.scss';\nimport { PREFIX } from '../../Icon/constants';\nimport uuid from '../../../../utils/uuid';\n\nconst Field: FunctionalComponent<Readonly<FieldProps>> = props => {\n const {\n children,\n className,\n classNameModifiers,\n dir,\n disabled,\n readOnly,\n errorMessage,\n helper,\n inputWrapperModifiers,\n isLoading,\n isValid,\n label,\n labelEndAdornment,\n name,\n onBlur,\n onFieldBlur,\n onFocus,\n // onFocusField is a securedField related function that allows a label click to set focus on a securedField (equates to CardInput setFocusOn)\n // TODO should rename it to make its purpose clear => setFocusOnSecuredField\n onFocusField,\n showValidIcon,\n useLabelElement,\n showErrorElement,\n showContextualElement,\n staticValue,\n contextualText,\n // Redeclare prop names to avoid internal clashes\n filled: propsFilled,\n focused: propsFocused,\n i18n,\n contextVisibleToScreenReader,\n renderAlternativeToLabel,\n onInputContainerClick,\n errorLive\n } = props;\n\n // Controls whether any error element has an aria-hidden=\"true\" attr (which means it is the error for a securedField)\n // or whether it has an id attr that can be pointed to by an aria-describedby attr on an input element\n const contextVisibleToSR = contextVisibleToScreenReader ?? true;\n const showError = showErrorElement && typeof errorMessage === 'string' && errorMessage.length > 0;\n const showContext = showContextualElement && !showError && contextualText && contextualText.length > 0;\n\n const uniqueId = useRef(getUniqueId(`adyen-checkout-${name}`));\n const staticValueId = useMemo(() => (staticValue ? `input-static-value-${uuid()}` : null), [staticValue]);\n\n const [focused, setFocused] = useState(false);\n const [filled, setFilled] = useState(false);\n\n // The means by which focussed/filled is set for securedFields\n if (propsFocused != null) setFocused(!!propsFocused);\n if (propsFilled != null) setFilled(!!propsFilled);\n\n // The means by which focussed/filled is set for other fields - this function is passed down to them and triggered\n const onFocusHandler = useCallback(\n (event: h.JSX.TargetedEvent<HTMLInputElement>) => {\n setFocused(true);\n onFocus?.(event);\n },\n [onFocus]\n );\n\n const onBlurHandler = useCallback(\n (event: h.JSX.TargetedEvent<HTMLInputElement>) => {\n setFocused(false);\n onBlur?.(event);\n // When we also need to fire a specific function when a field blurs // TODO - what is the use case?\n onFieldBlur?.(event);\n },\n [onBlur, onFieldBlur]\n );\n\n const renderLabelOrAlternativeContents = useCallback(() => {\n return (\n <Fragment>\n {typeof label === 'string' && (\n <span\n className={classNames({\n 'adyen-checkout__label__text': true,\n 'adyen-checkout__label__text--error': errorMessage\n })}\n data-id={name}\n data-testid={name}\n >\n {label}\n </span>\n )}\n\n {/*TODO - in what scenario is label a function? */}\n {/*@ts-ignore - function is callable*/}\n {typeof label === 'function' && label()}\n\n {labelEndAdornment && <span className=\"adyen-checkout__label-adornment--end\">{labelEndAdornment}</span>}\n\n {helper && <span className={'adyen-checkout__helper-text'}>{helper}</span>}\n </Fragment>\n );\n }, [label, errorMessage, labelEndAdornment, helper]);\n\n const renderInputRelatedElements = useCallback(() => {\n const errorElem = (\n <span\n className={classNames({ 'adyen-checkout-contextual-text--error': true, 'adyen-checkout-contextual-text--hidden': !showError })}\n {...(contextVisibleToSR && { id: `${uniqueId.current}${ARIA_ERROR_SUFFIX}` })}\n aria-hidden={contextVisibleToSR ? undefined : 'true'}\n {...(contextVisibleToSR && errorLive && { 'aria-live': 'polite' })}\n >\n {errorMessage}\n </span>\n );\n const contextualElem = (\n <span\n className={classNames({ 'adyen-checkout-contextual-text': true, 'adyen-checkout-contextual-text--hidden': !showContext })}\n {...(contextVisibleToSR && { id: `${uniqueId.current}${ARIA_CONTEXT_SUFFIX}` })}\n aria-hidden={contextVisibleToSR ? undefined : 'true'}\n >\n {contextualText}\n </span>\n );\n\n return (\n <Fragment>\n {/* The <div> element has a child <input> element that allows keyboard interaction */}\n {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */}\n <div\n className={classNames([\n 'adyen-checkout__input-wrapper',\n ...inputWrapperModifiers.map(m => `adyen-checkout__input-wrapper--${m}`)\n ])}\n dir={dir}\n onClick={onInputContainerClick}\n >\n {staticValue && (\n <span id={staticValueId} className=\"adyen-checkout__field-static-value\">\n {staticValue}\n </span>\n )}\n\n {toChildArray(children).map((child: ComponentChild): ComponentChild => {\n const propsFromFieldComponent = {\n isValid,\n onFocusHandler,\n onBlurHandler,\n isInvalid: !!errorMessage,\n 'aria-owns': staticValueId,\n ...(name && { uniqueId: uniqueId.current }),\n showErrorElement: showErrorElement\n };\n\n return cloneElement(child as VNode, propsFromFieldComponent);\n })}\n\n {isLoading && (\n <span className=\"adyen-checkout-input__inline-validation adyen-checkout-input__inline-validation--loading\">\n <Spinner size=\"small\" />\n </span>\n )}\n\n {isValid && showValidIcon !== false && (\n <span className=\"adyen-checkout-input__inline-validation adyen-checkout-input__inline-validation--valid\">\n <Icon type={`${PREFIX}checkmark_black`} alt={i18n?.get('field.valid')} />\n </span>\n )}\n\n {errorMessage && (\n <span className=\"adyen-checkout-input__inline-validation adyen-checkout-input__inline-validation--invalid\">\n <Icon type={`${PREFIX}field_error`} alt={i18n?.get('error.title')} />\n </span>\n )}\n </div>\n {errorElem}\n {contextualElem}\n </Fragment>\n );\n }, [children, errorMessage, contextualText, isLoading, isValid, onFocusHandler, onBlurHandler]);\n\n /**\n * Use cases:\n * - Not all form controls want/need a label e.g. many checkboxes describe what they are in their own markup and don't need the wrapping Field to also generate a labelling element\n * - securedFields *can't* have a label (screen-reader's can make the association, over different browser contexts, between the label and the input)\n */\n const LabelOrAlternative = useCallback(\n ({ onFocusField, focused, filled, disabled, name, uniqueId, useLabelElement, isSecuredField, children, renderAlternativeToLabel }) => {\n const defaultWrapperProps = {\n onClick: onFocusField,\n className: classNames({\n 'adyen-checkout__label': true,\n 'adyen-checkout__label--focused': focused,\n 'adyen-checkout__label--filled': filled,\n 'adyen-checkout__label--disabled': disabled\n })\n };\n\n return useLabelElement ? (\n // if we are NOT dealing with the label for a securedField... we can give it a `for` attribute\n <label {...defaultWrapperProps} {...(!isSecuredField && name && { htmlFor: uniqueId, id: `${uniqueId}-label` })}>\n {children}\n </label>\n ) : (\n renderAlternativeToLabel(defaultWrapperProps, children, uniqueId) // defaults to null\n\n // Example usage:\n // const alternativeLabelContent = (defaultWrapperProps, children, uniqueId) => {\n // return (\n // <div {...defaultWrapperProps} role={'label'} htmlFor={uniqueId}>\n // {children}\n // </div>\n // );\n // };\n // <Field name={'myField'} useLabelElement={false} renderAlternativeToLabel={alternativeLabelContent}>\n );\n },\n []\n );\n\n /**\n * RENDER\n */\n return (\n <div\n data-testid=\"form-field\"\n className={classNames(\n 'adyen-checkout__field',\n className,\n classNameModifiers?.map(m => `adyen-checkout__field--${m}`),\n {\n 'adyen-checkout__field--error': errorMessage,\n 'adyen-checkout__field--valid': isValid,\n 'adyen-checkout__field--inactive': readOnly || disabled\n }\n )}\n >\n <LabelOrAlternative\n onFocusField={onFocusField}\n name={name}\n disabled={disabled}\n filled={filled}\n focused={focused}\n useLabelElement={useLabelElement}\n uniqueId={uniqueId.current}\n isSecuredField={!contextVisibleToSR}\n renderAlternativeToLabel={renderAlternativeToLabel}\n >\n {renderLabelOrAlternativeContents()}\n </LabelOrAlternative>\n {renderInputRelatedElements()}\n </div>\n );\n};\n\nField.defaultProps = {\n className: '',\n classNameModifiers: [],\n inputWrapperModifiers: [],\n useLabelElement: true,\n showErrorElement: true,\n showContextualElement: true,\n renderAlternativeToLabel: () => null\n};\n\nexport default Field;\n"],"names":["Field","props","children","className","classNameModifiers","dir","disabled","readOnly","errorMessage","helper","inputWrapperModifiers","isLoading","isValid","label","labelEndAdornment","name","onBlur","onFieldBlur","onFocus","onFocusField","showValidIcon","useLabelElement","showErrorElement","showContextualElement","staticValue","contextualText","filled","propsFilled","focused","propsFocused","i18n","contextVisibleToScreenReader","renderAlternativeToLabel","onInputContainerClick","errorLive","contextVisibleToSR","showError","length","showContext","uniqueId","useRef","getUniqueId","staticValueId","useMemo","uuid","setFocused","useState","setFilled","onFocusHandler","useCallback","event","onBlurHandler","renderLabelOrAlternativeContents","h","Fragment","span","classNames","data-id","data-testid","renderInputRelatedElements","errorElem","id","current","ARIA_ERROR_SUFFIX","aria-hidden","undefined","contextualElem","ARIA_CONTEXT_SUFFIX","div","map","m","onClick","toChildArray","child","propsFromFieldComponent","_object_spread_props","_object_spread","isInvalid","cloneElement","Spinner","size","Icon","type","PREFIX","alt","get","LabelOrAlternative","isSecuredField","defaultWrapperProps","htmlFor","defaultProps"],"mappings":"64CAYA,MAAMA,EAAmDC,IACrD,MAAMC,SACFA,EAAQC,UACRA,EAASC,mBACTA,EAAkBC,IAClBA,EAAGC,SACHA,EAAQC,SACRA,EAAQC,aACRA,EAAYC,OACZA,EAAMC,sBACNA,EAAqBC,UACrBA,EAASC,QACTA,EAAOC,MACPA,EAAKC,kBACLA,EAAiBC,KACjBA,EAAIC,OACJA,EAAMC,YACNA,EAAWC,QACXA,EAAOC,aAGPA,EAAYC,cACZA,EAAaC,gBACbA,EAAeC,iBACfA,EAAgBC,sBAChBA,EAAqBC,YACrBA,EAAWC,eACXA,EAEAC,OAAQC,EACRC,QAASC,EAAYC,KACrBA,EAAIC,6BACJA,EAA4BC,yBAC5BA,EAAwBC,sBACxBA,EAAqBC,UACrBA,GACAjC,EAIEkC,EAAqBJ,SAAAA,EACrBK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2BD,GAAkBxE,GAAQ,CAAE0E,QAASlD,EAAUsB,GAAI,GAAGtB,YACvFrC,GAGL8B,EAAyBwD,EAAqBtF,EAAUqC,IAahE,IAMJ,OACIc,EAACe,MAAAA,CACGV,cAAY,aACZvD,UAAWqD,EACP,wBACArD,EACAC,eAAAA,EAAoBiE,IAAIC,GAAK,0BAA0BA,KACvD,CACI,+BAAgC9D,EAChC,+BAAgCI,EAChC,kCAAmCL,GAAYD,KAIvD+C,EAACiC,GAAAA,CACGnE,aAAcA,EACdJ,KAAMA,EACNT,SAAUA,EACVoB,OAAQA,GACRE,QAASA,GACTP,gBAAiBA,EACjBkB,SAAUA,EAASuB,QACnByB,gBAAiBpD,EACjBH,yBAA0BA,GAEzBoB,MAEJO,OAKb3D,EAAM0F,aAAe,CACjBvF,UAAW,GACXC,mBAAoB,GACpBM,sBAAuB,GACvBW,iBAAiB,EACjBC,kBAAkB,EAClBC,uBAAuB,EACvBS,yBAA0B,IAAM"}
1
+ {"version":3,"file":"Field.js","sources":["../../../../../../src/components/internal/FormFields/Field/Field.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport { cloneElement, ComponentChild, Fragment, FunctionalComponent, h, toChildArray, VNode } from 'preact';\nimport Spinner from '../../Spinner';\nimport Icon from '../../Icon';\nimport { ARIA_CONTEXT_SUFFIX, ARIA_ERROR_SUFFIX } from '../../../../core/Errors/constants';\nimport { useCallback, useMemo, useRef, useState } from 'preact/hooks';\nimport { getUniqueId } from '../../../../utils/idGenerator';\nimport { FieldProps } from './types';\nimport './Field.scss';\nimport { PREFIX } from '../../Icon/constants';\nimport uuid from '../../../../utils/uuid';\n\nconst Field: FunctionalComponent<Readonly<FieldProps>> = props => {\n const {\n children,\n className = '',\n classNameModifiers,\n dir,\n disabled,\n readOnly,\n errorMessage,\n helper,\n inputWrapperModifiers = [],\n isLoading,\n isValid,\n label,\n labelEndAdornment,\n name,\n onBlur,\n onFieldBlur,\n onFocus,\n // onFocusField is a securedField related function that allows a label click to set focus on a securedField (equates to CardInput setFocusOn)\n // TODO should rename it to make its purpose clear => setFocusOnSecuredField\n onFocusField,\n showValidIcon,\n useLabelElement = true,\n showErrorElement = true,\n showContextualElement = true,\n staticValue,\n contextualText,\n // Redeclare prop names to avoid internal clashes\n filled: propsFilled,\n focused: propsFocused,\n i18n,\n contextVisibleToScreenReader,\n renderAlternativeToLabel = () => null,\n onInputContainerClick,\n errorLive\n } = props;\n\n // Controls whether any error element has an aria-hidden=\"true\" attr (which means it is the error for a securedField)\n // or whether it has an id attr that can be pointed to by an aria-describedby attr on an input element\n const contextVisibleToSR = contextVisibleToScreenReader ?? true;\n const showError = showErrorElement && typeof errorMessage === 'string' && errorMessage.length > 0;\n const showContext = showContextualElement && !showError && contextualText && contextualText.length > 0;\n\n const uniqueId = useRef(getUniqueId(`adyen-checkout-${name}`));\n const staticValueId = useMemo(() => (staticValue ? `input-static-value-${uuid()}` : undefined), [staticValue]);\n\n const [focused, setFocused] = useState(false);\n const [filled, setFilled] = useState(false);\n\n // The means by which focussed/filled is set for securedFields\n if (propsFocused != null) setFocused(!!propsFocused);\n if (propsFilled != null) setFilled(!!propsFilled);\n\n // The means by which focussed/filled is set for other fields - this function is passed down to them and triggered\n const onFocusHandler = useCallback(\n (event: h.JSX.TargetedEvent<HTMLInputElement>) => {\n setFocused(true);\n onFocus?.(event);\n },\n [onFocus]\n );\n\n const onBlurHandler = useCallback(\n (event: h.JSX.TargetedEvent<HTMLInputElement>) => {\n setFocused(false);\n onBlur?.(event);\n // When we also need to fire a specific function when a field blurs // TODO - what is the use case?\n onFieldBlur?.(event);\n },\n [onBlur, onFieldBlur]\n );\n\n const renderLabelOrAlternativeContents = useCallback(() => {\n return (\n <Fragment>\n {typeof label === 'string' && (\n <span\n className={classNames({\n 'adyen-checkout__label__text': true,\n 'adyen-checkout__label__text--error': errorMessage\n })}\n data-id={name}\n data-testid={name}\n >\n {label}\n </span>\n )}\n\n {/*TODO - in what scenario is label a function? */}\n {/*@ts-ignore - function is callable*/}\n {typeof label === 'function' && label()}\n\n {labelEndAdornment && <span className=\"adyen-checkout__label-adornment--end\">{labelEndAdornment}</span>}\n\n {helper && <span className={'adyen-checkout__helper-text'}>{helper}</span>}\n </Fragment>\n );\n }, [label, errorMessage, labelEndAdornment, helper]);\n\n const renderInputRelatedElements = useCallback(() => {\n const errorElem = (\n <span\n className={classNames({ 'adyen-checkout-contextual-text--error': true, 'adyen-checkout-contextual-text--hidden': !showError })}\n {...(contextVisibleToSR && { id: `${uniqueId.current}${ARIA_ERROR_SUFFIX}` })}\n aria-hidden={contextVisibleToSR ? undefined : 'true'}\n {...(contextVisibleToSR && errorLive && { 'aria-live': 'polite' })}\n >\n {errorMessage}\n </span>\n );\n const contextualElem = (\n <span\n className={classNames({ 'adyen-checkout-contextual-text': true, 'adyen-checkout-contextual-text--hidden': !showContext })}\n {...(contextVisibleToSR && { id: `${uniqueId.current}${ARIA_CONTEXT_SUFFIX}` })}\n aria-hidden={contextVisibleToSR ? undefined : 'true'}\n >\n {contextualText}\n </span>\n );\n\n return (\n <Fragment>\n {/* The <div> element has a child <input> element that allows keyboard interaction */}\n {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */}\n <div\n className={classNames([\n 'adyen-checkout__input-wrapper',\n ...inputWrapperModifiers.map(m => `adyen-checkout__input-wrapper--${m}`)\n ])}\n dir={dir}\n onClick={onInputContainerClick}\n >\n {staticValue && (\n <span id={staticValueId} className=\"adyen-checkout__field-static-value\">\n {staticValue}\n </span>\n )}\n\n {toChildArray(children).map((child: ComponentChild): ComponentChild => {\n const propsFromFieldComponent = {\n isValid,\n onFocusHandler,\n onBlurHandler,\n isInvalid: !!errorMessage,\n 'aria-owns': staticValueId,\n ...(name && { uniqueId: uniqueId.current }),\n showErrorElement: showErrorElement\n };\n\n return cloneElement(child as VNode, propsFromFieldComponent);\n })}\n\n {isLoading && (\n <span className=\"adyen-checkout-input__inline-validation adyen-checkout-input__inline-validation--loading\">\n <Spinner size=\"small\" />\n </span>\n )}\n\n {isValid && showValidIcon !== false && (\n <span className=\"adyen-checkout-input__inline-validation adyen-checkout-input__inline-validation--valid\">\n <Icon type={`${PREFIX}checkmark_black`} alt={i18n?.get('field.valid')} />\n </span>\n )}\n\n {errorMessage && (\n <span className=\"adyen-checkout-input__inline-validation adyen-checkout-input__inline-validation--invalid\">\n <Icon type={`${PREFIX}field_error`} alt={i18n?.get('error.title')} />\n </span>\n )}\n </div>\n {errorElem}\n {contextualElem}\n </Fragment>\n );\n }, [children, errorMessage, contextualText, isLoading, isValid, onFocusHandler, onBlurHandler]);\n\n /**\n * Use cases:\n * - Not all form controls want/need a label e.g. many checkboxes describe what they are in their own markup and don't need the wrapping Field to also generate a labelling element\n * - securedFields *can't* have a label (screen-reader's can make the association, over different browser contexts, between the label and the input)\n */\n const LabelOrAlternative = useCallback(\n ({ onFocusField, focused, filled, disabled, name, uniqueId, useLabelElement, isSecuredField, children, renderAlternativeToLabel }) => {\n const defaultWrapperProps = {\n onClick: onFocusField,\n className: classNames({\n 'adyen-checkout__label': true,\n 'adyen-checkout__label--focused': focused,\n 'adyen-checkout__label--filled': filled,\n 'adyen-checkout__label--disabled': disabled\n })\n };\n\n return useLabelElement ? (\n // if we are NOT dealing with the label for a securedField... we can give it a `for` attribute\n <label {...defaultWrapperProps} {...(!isSecuredField && name && { htmlFor: uniqueId, id: `${uniqueId}-label` })}>\n {children}\n </label>\n ) : (\n renderAlternativeToLabel(defaultWrapperProps, children, uniqueId) // defaults to null\n\n // Example usage:\n // const alternativeLabelContent = (defaultWrapperProps, children, uniqueId) => {\n // return (\n // <div {...defaultWrapperProps} role={'label'} htmlFor={uniqueId}>\n // {children}\n // </div>\n // );\n // };\n // <Field name={'myField'} useLabelElement={false} renderAlternativeToLabel={alternativeLabelContent}>\n );\n },\n []\n );\n\n /**\n * RENDER\n */\n return (\n <div\n data-testid=\"form-field\"\n className={classNames(\n 'adyen-checkout__field',\n className,\n classNameModifiers?.map(m => `adyen-checkout__field--${m}`),\n {\n 'adyen-checkout__field--error': errorMessage,\n 'adyen-checkout__field--valid': isValid,\n 'adyen-checkout__field--inactive': readOnly || disabled\n }\n )}\n >\n <LabelOrAlternative\n onFocusField={onFocusField}\n name={name}\n disabled={disabled}\n filled={filled}\n focused={focused}\n useLabelElement={useLabelElement}\n uniqueId={uniqueId.current}\n isSecuredField={!contextVisibleToSR}\n renderAlternativeToLabel={renderAlternativeToLabel}\n >\n {renderLabelOrAlternativeContents()}\n </LabelOrAlternative>\n {renderInputRelatedElements()}\n </div>\n );\n};\n\nexport default Field;\n"],"names":["Field","props","children","className","classNameModifiers","dir","disabled","readOnly","errorMessage","helper","inputWrapperModifiers","isLoading","isValid","label","labelEndAdornment","name","onBlur","onFieldBlur","onFocus","onFocusField","showValidIcon","useLabelElement","showErrorElement","showContextualElement","staticValue","contextualText","filled","propsFilled","focused","propsFocused","i18n","contextVisibleToScreenReader","renderAlternativeToLabel","onInputContainerClick","errorLive","contextVisibleToSR","showError","length","showContext","uniqueId","useRef","getUniqueId","staticValueId","useMemo","uuid","undefined","setFocused","useState","setFilled","onFocusHandler","useCallback","event","onBlurHandler","renderLabelOrAlternativeContents","h","Fragment","span","classNames","data-id","data-testid","renderInputRelatedElements","errorElem","id","current","ARIA_ERROR_SUFFIX","aria-hidden","contextualElem","ARIA_CONTEXT_SUFFIX","div","map","m","onClick","toChildArray","child","propsFromFieldComponent","_object_spread_props","_object_spread","isInvalid","cloneElement","Spinner","size","Icon","type","PREFIX","alt","get","LabelOrAlternative","isSecuredField","defaultWrapperProps","htmlFor"],"mappings":"64CAYA,MAAMA,EAAmDC,IACrD,MAAMC,SACFA,EAAQC,UACRA,EAAY,GAAEC,mBACdA,EAAkBC,IAClBA,EAAGC,SACHA,EAAQC,SACRA,EAAQC,aACRA,EAAYC,OACZA,EAAMC,sBACNA,EAAwB,GAAEC,UAC1BA,EAASC,QACTA,EAAOC,MACPA,EAAKC,kBACLA,EAAiBC,KACjBA,EAAIC,O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,EAASqC,GAAgBG,KAO1EkC,GAAqBpC,EACvB,EAAG/B,eAAcS,UAASF,SAAQpB,WAAUS,OAAMwB,WAAUlB,kBAAiBkE,iBAAgBrF,WAAU8B,+BACnG,MAAMwD,EAAsB,CACxBjB,QAASpD,EACThB,UAAWsD,EAAW,CAClB,yBAAyB,EACzB,iCAAkC7B,EAClC,gCAAiCF,EACjC,kCAAmCpB,KAI3C,OAAOe,EAEHiC,EAACzC,QAAAA,EAAAA,CAAAA,EAAU2E,GAA2BD,GAAkBxE,GAAQ,CAAE0E,QAASlD,EAAUuB,GAAI,GAAGvB,YACvFrC,GAGL8B,EAAyBwD,EAAqBtF,EAAUqC,IAahE,IAMJ,OACIe,EAACc,MAAAA,CACGT,cAAY,aACZxD,UAAWsD,EACP,wBACAtD,EACAC,eAAAA,EAAoBiE,IAAIC,GAAK,0BAA0BA,KACvD,CACI,+BAAgC9D,EAChC,+BAAgCI,EAChC,kCAAmCL,GAAYD,KAIvDgD,EAACgC,GAAAA,CACGnE,aAAcA,EACdJ,KAAMA,EACNT,SAAUA,EACVoB,OAAQA,GACRE,QAASA,GACTP,gBAAiBA,EACjBkB,SAAUA,EAASwB,QACnBwB,gBAAiBpD,EACjBH,yBAA0BA,GAEzBqB,MAEJO"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../external/preact/dist/preact.js";import{useCallback as t}from"../../../external/preact/hooks/dist/hooks.js";import r from"../../../_virtual/index.js";import{ARIA_ERROR_SUFFIX as n,ARIA_CONTEXT_SUFFIX as o}from"../../../core/Errors/constants.js";import{trimValWithOneSpace as l}from"../../../utils/validator-utils.js";function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function u(e,t){if(null==e)return{};var r,n,o,l={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(r=Reflect.ownKeys(Object(e)),o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}if(l=function(e,t){if(null==e)return{};var r,n,o={},l=Object.getOwnPropertyNames(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,t),Object.getOwnPropertySymbols)for(r=Object.getOwnPropertySymbols(e),o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}function c(c){let{setRef:s}=c,p=u(c,["setRef"]);const{autoCorrect:d,classNameModifiers:y,isInvalid:f,isValid:b,readonly:O=null,spellcheck:m,type:j,uniqueId:v,disabled:h}=p,g=p.className;Object.prototype.hasOwnProperty.call(p,"onChange")&&console.error("Error: Form fields that rely on InputBase may not have an onChange property");const w=t(e=>{var t;null===(t=p.onInput)||void 0===t||t.call(p,e)},[p.onInput]),P=t(e=>{(null==p?void 0:p.onKeyDown)&&p.onKeyDown(e)},[null==p?void 0:p.onKeyDown]),I=t(e=>{var t,r;if(null==p||null===(t=p.onBlurHandler)||void 0===t||t.call(p,e),p.trimOnBlur){const t=e.target;t.value=l(t.value)}null==p||null===(r=p.onBlur)||void 0===r||r.call(p,e)},[p.onBlur,p.onBlurHandler]),k=t(e=>{var t;null==p||null===(t=p.onFocusHandler)||void 0===t||t.call(p,e)},[p.onFocusHandler]),_=r("adyen-checkout__input",[`adyen-checkout__input--${j}`],g,{"adyen-checkout__input--invalid":f,"adyen-checkout__input--valid":b},(null!=y?y:[]).map(e=>`adyen-checkout__input--${e}`)),{classNameModifiers:x,uniqueId:E,isInvalid:B,isValid:D,addContextualElement:C,"aria-describedby":N,autocomplete:K}=p,S=u(p,["classNameModifiers","uniqueId","isInvalid","isValid","addContextualElement","aria-describedby","autocomplete"]),q=["string"==typeof N&&N?N:null,v?`${v}${f?n:o}`:null].filter(Boolean).join(" ")||null;return e("input",i(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){a(e,t,r[t])})}return e}({id:v},S),{autocomplete:K,"aria-required":S.required,type:j,className:_,readOnly:O,spellcheck:m,autoCorrect:d,"aria-describedby":q,"aria-invalid":f,onInput:w,onBlur:I,onFocus:k,onKeyDown:P,disabled:h,ref:s}))}c.defaultProps={type:"text",classNameModifiers:[]};export{c as default};
1
+ import{createElement as e}from"../../../external/preact/dist/preact.js";import{useCallback as t}from"../../../external/preact/hooks/dist/hooks.js";import r from"../../../_virtual/index.js";import{ARIA_ERROR_SUFFIX as n,ARIA_CONTEXT_SUFFIX as o}from"../../../core/Errors/constants.js";import{trimValWithOneSpace as l}from"../../../utils/validator-utils.js";function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function c(e,t){if(null==e)return{};var r,n,o,l={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(r=Reflect.ownKeys(Object(e)),o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}if(l=function(e,t){if(null==e)return{};var r,n,o={},l=Object.getOwnPropertyNames(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,t),Object.getOwnPropertySymbols)for(r=Object.getOwnPropertySymbols(e),o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}function u(u){let{setRef:s,type:p="text",classNameModifiers:d=[]}=u,y=c(u,["setRef","type","classNameModifiers"]);const{autoCorrect:f,isInvalid:b,isValid:O,readonly:m,spellcheck:v,uniqueId:j,disabled:h}=y,g=y.className;Object.prototype.hasOwnProperty.call(y,"onChange")&&console.error("Error: Form fields that rely on InputBase may not have an onChange property");const w=t(e=>{var t;null===(t=y.onInput)||void 0===t||t.call(y,e)},[y.onInput]),P=t(e=>{(null==y?void 0:y.onKeyDown)&&y.onKeyDown(e)},[null==y?void 0:y.onKeyDown]),I=t(e=>{var t,r;if(null==y||null===(t=y.onBlurHandler)||void 0===t||t.call(y,e),y.trimOnBlur){const t=e.target;t.value=l(t.value)}null==y||null===(r=y.onBlur)||void 0===r||r.call(y,e)},[y.onBlur,y.onBlurHandler]),k=t(e=>{var t;null==y||null===(t=y.onFocusHandler)||void 0===t||t.call(y,e)},[y.onFocusHandler]),_=r("adyen-checkout__input",[`adyen-checkout__input--${p}`],g,{"adyen-checkout__input--invalid":b,"adyen-checkout__input--valid":O},d.map(e=>`adyen-checkout__input--${e}`)),{uniqueId:x,isInvalid:E,isValid:B,addContextualElement:D,"aria-describedby":C,autocomplete:K}=y,S=c(y,["uniqueId","isInvalid","isValid","addContextualElement","aria-describedby","autocomplete"]),q=["string"==typeof C&&C?C:void 0,j?`${j}${b?n:o}`:void 0].filter(Boolean).join(" ")||void 0;return e("input",i(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){a(e,t,r[t])})}return e}({id:j},S),{autocomplete:K,"aria-required":S.required,type:p,className:_,readOnly:m,spellcheck:v,autoCorrect:f,"aria-describedby":q,"aria-invalid":b,onInput:w,onBlur:I,onFocus:k,onKeyDown:P,disabled:h,ref:s}))}export{u as default};
2
2
  //# sourceMappingURL=InputBase.js.map