@adyen/adyen-web 6.33.0 → 6.34.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (410) hide show
  1. package/dist/cjs/adyen.css +6 -5
  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 +219 -114
  6. package/dist/es/adyen.css +6 -5
  7. package/dist/es/adyen.css.map +1 -1
  8. package/dist/es/components/Ach/Ach.js.map +1 -1
  9. package/dist/es/components/Ach/components/AchComponent.js.map +1 -1
  10. package/dist/es/components/AmazonPay/AmazonPay.js +1 -1
  11. package/dist/es/components/AmazonPay/AmazonPay.js.map +1 -1
  12. package/dist/es/components/AmazonPay/components/AmazonPayButton.js +1 -1
  13. package/dist/es/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
  14. package/dist/es/components/AmazonPay/components/AmazonPayComponent.js +1 -1
  15. package/dist/es/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
  16. package/dist/es/components/AmazonPay/components/ChangePaymentDetailsButton.js +1 -1
  17. package/dist/es/components/AmazonPay/components/ChangePaymentDetailsButton.js.map +1 -1
  18. package/dist/es/components/AmazonPay/components/SignOutButton.js +1 -1
  19. package/dist/es/components/AmazonPay/components/SignOutButton.js.map +1 -1
  20. package/dist/es/components/AmazonPay/defaultProps.js +1 -1
  21. package/dist/es/components/AmazonPay/defaultProps.js.map +1 -1
  22. package/dist/es/components/AmazonPay/services.js.map +1 -1
  23. package/dist/es/components/ApplePay/ApplePay.js.map +1 -1
  24. package/dist/es/components/ApplePay/services/ApplePayService.js.map +1 -1
  25. package/dist/es/components/BankTransfer/components/BankTransferInput/BankTransferInput.js.map +1 -1
  26. package/dist/es/components/Boleto/Boleto.js +1 -1
  27. package/dist/es/components/Boleto/Boleto.js.map +1 -1
  28. package/dist/es/components/Boleto/components/BoletoInput/BoletoInput.js.map +1 -1
  29. package/dist/es/components/Card/Card.js +1 -1
  30. package/dist/es/components/Card/Card.js.map +1 -1
  31. package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
  32. package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
  33. package/dist/es/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js +1 -1
  34. package/dist/es/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js.map +1 -1
  35. package/dist/es/components/Card/components/CardInput/components/BrandIcon.js +1 -1
  36. package/dist/es/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
  37. package/dist/es/components/Card/components/CardInput/components/ExpirationDate.js +1 -1
  38. package/dist/es/components/Card/components/CardInput/components/ExpirationDate.js.map +1 -1
  39. package/dist/es/components/Card/components/CardInput/defaultProps.js +1 -1
  40. package/dist/es/components/Card/components/CardInput/defaultProps.js.map +1 -1
  41. package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
  42. package/dist/es/components/Card/components/CardInput/useSRPanelForCardInputErrors.js +1 -1
  43. package/dist/es/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -1
  44. package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
  45. package/dist/es/components/Card/components/CardInput/validate.js +1 -1
  46. package/dist/es/components/Card/components/CardInput/validate.js.map +1 -1
  47. package/dist/es/components/Card/components/Fastlane/FastlaneSignup.js.map +1 -1
  48. package/dist/es/components/CashAppPay/CashAppPay.js +1 -1
  49. package/dist/es/components/CashAppPay/CashAppPay.js.map +1 -1
  50. package/dist/es/components/CashAppPay/components/CashAppComponent.js +1 -1
  51. package/dist/es/components/CashAppPay/components/CashAppComponent.js.map +1 -1
  52. package/dist/es/components/CashAppPay/services/types.js.map +1 -1
  53. package/dist/es/components/Doku/Doku.js +1 -1
  54. package/dist/es/components/Doku/Doku.js.map +1 -1
  55. package/dist/es/components/Dragonpay/Dragonpay.js +1 -1
  56. package/dist/es/components/Dragonpay/Dragonpay.js.map +1 -1
  57. package/dist/es/components/Dragonpay/components/DragonpayInput/DragonpayInput.js +1 -1
  58. package/dist/es/components/Dragonpay/components/DragonpayInput/DragonpayInput.js.map +1 -1
  59. package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
  60. package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js.map +1 -1
  61. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodBrands/PaymentMethodBrands.js +1 -1
  62. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodBrands/PaymentMethodBrands.js.map +1 -1
  63. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodBrands/utils.js +2 -0
  64. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodBrands/utils.js.map +1 -0
  65. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodIcon.js +1 -1
  66. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodIcon.js.map +1 -1
  67. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  68. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  69. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodName.js +1 -1
  70. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodName.js.map +1 -1
  71. package/dist/es/components/Econtext/Econtext.js +1 -1
  72. package/dist/es/components/Econtext/Econtext.js.map +1 -1
  73. package/dist/es/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
  74. package/dist/es/components/Giftcard/components/useSRPanelForGiftcardErrors.js.map +1 -1
  75. package/dist/es/components/Iris/Iris.js +1 -1
  76. package/dist/es/components/Iris/Iris.js.map +1 -1
  77. package/dist/es/components/Multibanco/Multibanco.js +1 -1
  78. package/dist/es/components/Multibanco/Multibanco.js.map +1 -1
  79. package/dist/es/components/Multibanco/components/MultibancoVoucherResult/MultibancoVoucherResult.js.map +1 -1
  80. package/dist/es/components/Oxxo/Oxxo.js +1 -1
  81. package/dist/es/components/Oxxo/Oxxo.js.map +1 -1
  82. package/dist/es/components/Oxxo/components/OxxoVoucherResult/OxxoVoucherResult.js.map +1 -1
  83. package/dist/es/components/PayByBankUS/PayByBankUS.js.map +1 -1
  84. package/dist/es/components/PayPal/Paypal.js +1 -1
  85. package/dist/es/components/PayPal/Paypal.js.map +1 -1
  86. package/dist/es/components/PayPal/components/PaypalButtons.js +1 -1
  87. package/dist/es/components/PayPal/components/PaypalButtons.js.map +1 -1
  88. package/dist/es/components/PayPal/components/PaypalComponent.js +1 -1
  89. package/dist/es/components/PayPal/components/PaypalComponent.js.map +1 -1
  90. package/dist/es/components/PayPal/utils/format-paypal-order-contact-to-adyen-format.js +1 -1
  91. package/dist/es/components/PayPal/utils/format-paypal-order-contact-to-adyen-format.js.map +1 -1
  92. package/dist/es/components/PayPal/utils/get-paypal-styles.js.map +1 -1
  93. package/dist/es/components/PayPalFastlane/Fastlane.js.map +1 -1
  94. package/dist/es/components/PayTo/components/PayToNameFields.js.map +1 -1
  95. package/dist/es/components/Pix/Pix.js +1 -1
  96. package/dist/es/components/Pix/Pix.js.map +1 -1
  97. package/dist/es/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js.map +1 -1
  98. package/dist/es/components/Redirect/components/RedirectShopper/RedirectShopper.js.map +1 -1
  99. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  100. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  101. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js +1 -1
  102. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
  103. package/dist/es/components/UPI/UPI.js +1 -1
  104. package/dist/es/components/UPI/UPI.js.map +1 -1
  105. package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
  106. package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
  107. package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.js +1 -1
  108. package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.js.map +1 -1
  109. package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js +1 -1
  110. package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js.map +1 -1
  111. package/dist/es/components/UPI/components/UPIMandate/UPIMandate.js.map +1 -1
  112. package/dist/es/components/UPI/constants.js +1 -1
  113. package/dist/es/components/UPI/constants.js.map +1 -1
  114. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  115. package/dist/es/components/helpers/QRLoaderContainer/QRLoaderContainer.js +1 -1
  116. package/dist/es/components/helpers/QRLoaderContainer/QRLoaderContainer.js.map +1 -1
  117. package/dist/es/components/internal/Address/validate.formats.js +1 -1
  118. package/dist/es/components/internal/Address/validate.formats.js.map +1 -1
  119. package/dist/es/components/internal/BrandIcons/BrandIcons.js +2 -0
  120. package/dist/es/components/internal/BrandIcons/BrandIcons.js.map +1 -0
  121. package/dist/es/components/internal/BrandIcons/BrandIcons.module.scss.js +2 -0
  122. package/dist/es/components/internal/BrandIcons/BrandIcons.module.scss.js.map +1 -0
  123. package/dist/es/components/internal/{Brand/Brand.js → BrandImage/BrandImage.js} +2 -2
  124. package/dist/es/components/internal/BrandImage/BrandImage.js.map +1 -0
  125. package/dist/es/components/internal/Button/Button.js +1 -1
  126. package/dist/es/components/internal/Button/Button.js.map +1 -1
  127. package/dist/es/components/internal/ExpandButton/ExpandButton.js +1 -1
  128. package/dist/es/components/internal/ExpandButton/ExpandButton.js.map +1 -1
  129. package/dist/es/components/internal/FormFields/InputDate/utils.js +1 -1
  130. package/dist/es/components/internal/FormFields/InputDate/utils.js.map +1 -1
  131. package/dist/es/components/internal/RedirectButton/RedirectButton.js.map +1 -1
  132. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  133. package/dist/es/components/internal/SecuredFields/lib/CSF/AbstractCSF.js.map +1 -1
  134. package/dist/es/components/internal/SecuredFields/lib/CSF/CSF.js +1 -1
  135. package/dist/es/components/internal/SecuredFields/lib/CSF/CSF.js.map +1 -1
  136. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js.map +1 -1
  137. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  138. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleEncryption.js +1 -1
  139. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleEncryption.js.map +1 -1
  140. package/dist/es/components/internal/SecuredFields/lib/CSF/initCSF.js.map +1 -1
  141. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/iframes/postMessageValidation.js +1 -1
  142. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/iframes/postMessageValidation.js.map +1 -1
  143. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/processErrors.js.map +1 -1
  144. package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  145. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  146. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  147. package/dist/es/components/internal/Tooltip/Tooltip.js.map +1 -1
  148. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  149. package/dist/es/core/Analytics/Analytics.js +1 -1
  150. package/dist/es/core/Analytics/Analytics.js.map +1 -1
  151. package/dist/es/core/Analytics/AnalyticsEventQueue.js +1 -1
  152. package/dist/es/core/Analytics/AnalyticsEventQueue.js.map +1 -1
  153. package/dist/es/core/ProcessResponse/PaymentMethods/filters.js +1 -1
  154. package/dist/es/core/ProcessResponse/PaymentMethods/filters.js.map +1 -1
  155. package/dist/es/core/config.js +1 -1
  156. package/dist/es/core/config.js.map +1 -1
  157. package/dist/es/core/core.js +1 -1
  158. package/dist/es/core/core.js.map +1 -1
  159. package/dist/es/external/preact/compat/dist/compat.js +1 -1
  160. package/dist/es/external/preact/compat/dist/compat.js.map +1 -1
  161. package/dist/es/external/preact/dist/preact.js +1 -1
  162. package/dist/es/external/preact/dist/preact.js.map +1 -1
  163. package/dist/es/external/preact/hooks/dist/hooks.js +1 -1
  164. package/dist/es/external/preact/hooks/dist/hooks.js.map +1 -1
  165. package/dist/es/index.d.ts +219 -114
  166. package/dist/es/language/Language.js +1 -1
  167. package/dist/es/language/Language.js.map +1 -1
  168. package/dist/es/language/LanguageService.js +2 -0
  169. package/dist/es/language/LanguageService.js.map +1 -0
  170. package/dist/es/language/constants.js +1 -1
  171. package/dist/es/language/constants.js.map +1 -1
  172. package/dist/es/language/utils.js +1 -1
  173. package/dist/es/language/utils.js.map +1 -1
  174. package/dist/es/packages/server/translations/en-US.json.js +2 -0
  175. package/dist/es/packages/server/translations/en-US.json.js.map +1 -0
  176. package/dist/es/utils/Script.js.map +1 -1
  177. package/dist/es/utils/debounce.js.map +1 -1
  178. package/dist/es/utils/getErrorMessage.js +1 -1
  179. package/dist/es/utils/getErrorMessage.js.map +1 -1
  180. package/dist/es/utils/hookUtils.js.map +1 -1
  181. package/dist/es/utils/promiseTimeout.js.map +1 -1
  182. package/dist/es-legacy/adyen.css +6 -5
  183. package/dist/es-legacy/adyen.css.map +1 -1
  184. package/dist/es-legacy/components/Ach/Ach.js.map +1 -1
  185. package/dist/es-legacy/components/Ach/components/AchComponent.js.map +1 -1
  186. package/dist/es-legacy/components/AmazonPay/AmazonPay.js +1 -1
  187. package/dist/es-legacy/components/AmazonPay/AmazonPay.js.map +1 -1
  188. package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js +1 -1
  189. package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
  190. package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js +1 -1
  191. package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
  192. package/dist/es-legacy/components/AmazonPay/components/ChangePaymentDetailsButton.js +1 -1
  193. package/dist/es-legacy/components/AmazonPay/components/ChangePaymentDetailsButton.js.map +1 -1
  194. package/dist/es-legacy/components/AmazonPay/components/SignOutButton.js +1 -1
  195. package/dist/es-legacy/components/AmazonPay/components/SignOutButton.js.map +1 -1
  196. package/dist/es-legacy/components/AmazonPay/defaultProps.js +1 -1
  197. package/dist/es-legacy/components/AmazonPay/defaultProps.js.map +1 -1
  198. package/dist/es-legacy/components/AmazonPay/services.js.map +1 -1
  199. package/dist/es-legacy/components/ApplePay/ApplePay.js.map +1 -1
  200. package/dist/es-legacy/components/ApplePay/services/ApplePayService.js.map +1 -1
  201. package/dist/es-legacy/components/ApplePay/utils/payment-request.js +1 -1
  202. package/dist/es-legacy/components/ApplePay/utils/payment-request.js.map +1 -1
  203. package/dist/es-legacy/components/BankTransfer/components/BankTransferInput/BankTransferInput.js.map +1 -1
  204. package/dist/es-legacy/components/BankTransfer/components/BankTransferResult/BankTransferVoucher.js +1 -1
  205. package/dist/es-legacy/components/BankTransfer/components/BankTransferResult/BankTransferVoucher.js.map +1 -1
  206. package/dist/es-legacy/components/Boleto/Boleto.js +1 -1
  207. package/dist/es-legacy/components/Boleto/Boleto.js.map +1 -1
  208. package/dist/es-legacy/components/Boleto/components/BoletoInput/BoletoInput.js.map +1 -1
  209. package/dist/es-legacy/components/Card/Card.js +1 -1
  210. package/dist/es-legacy/components/Card/Card.js.map +1 -1
  211. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
  212. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
  213. package/dist/es-legacy/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js +1 -1
  214. package/dist/es-legacy/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js.map +1 -1
  215. package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js +1 -1
  216. package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
  217. package/dist/es-legacy/components/Card/components/CardInput/components/ExpirationDate.js +1 -1
  218. package/dist/es-legacy/components/Card/components/CardInput/components/ExpirationDate.js.map +1 -1
  219. package/dist/es-legacy/components/Card/components/CardInput/defaultProps.js +1 -1
  220. package/dist/es-legacy/components/Card/components/CardInput/defaultProps.js.map +1 -1
  221. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  222. package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js +1 -1
  223. package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -1
  224. package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
  225. package/dist/es-legacy/components/Card/components/CardInput/validate.js +1 -1
  226. package/dist/es-legacy/components/Card/components/CardInput/validate.js.map +1 -1
  227. package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js +1 -1
  228. package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js.map +1 -1
  229. package/dist/es-legacy/components/Card/components/Fastlane/FastlaneSignup.js.map +1 -1
  230. package/dist/es-legacy/components/CashAppPay/CashAppPay.js +1 -1
  231. package/dist/es-legacy/components/CashAppPay/CashAppPay.js.map +1 -1
  232. package/dist/es-legacy/components/CashAppPay/components/CashAppComponent.js +1 -1
  233. package/dist/es-legacy/components/CashAppPay/components/CashAppComponent.js.map +1 -1
  234. package/dist/es-legacy/components/CashAppPay/services/types.js.map +1 -1
  235. package/dist/es-legacy/components/Doku/Doku.js +1 -1
  236. package/dist/es-legacy/components/Doku/Doku.js.map +1 -1
  237. package/dist/es-legacy/components/Dragonpay/Dragonpay.js +1 -1
  238. package/dist/es-legacy/components/Dragonpay/Dragonpay.js.map +1 -1
  239. package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js +1 -1
  240. package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js.map +1 -1
  241. package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
  242. package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js.map +1 -1
  243. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodBrands/PaymentMethodBrands.js +1 -1
  244. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodBrands/PaymentMethodBrands.js.map +1 -1
  245. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodBrands/utils.js +2 -0
  246. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodBrands/utils.js.map +1 -0
  247. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodIcon.js +1 -1
  248. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodIcon.js.map +1 -1
  249. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  250. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  251. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js +1 -1
  252. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js.map +1 -1
  253. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodName.js +1 -1
  254. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodName.js.map +1 -1
  255. package/dist/es-legacy/components/Econtext/Econtext.js +1 -1
  256. package/dist/es-legacy/components/Econtext/Econtext.js.map +1 -1
  257. package/dist/es-legacy/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
  258. package/dist/es-legacy/components/Giftcard/components/useSRPanelForGiftcardErrors.js.map +1 -1
  259. package/dist/es-legacy/components/GooglePay/requests.js +1 -1
  260. package/dist/es-legacy/components/GooglePay/requests.js.map +1 -1
  261. package/dist/es-legacy/components/Iris/Iris.js +1 -1
  262. package/dist/es-legacy/components/Iris/Iris.js.map +1 -1
  263. package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js +1 -1
  264. package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js.map +1 -1
  265. package/dist/es-legacy/components/Klarna/components/KlarnaWidget/KlarnaWidget.js +1 -1
  266. package/dist/es-legacy/components/Klarna/components/KlarnaWidget/KlarnaWidget.js.map +1 -1
  267. package/dist/es-legacy/components/Multibanco/Multibanco.js +1 -1
  268. package/dist/es-legacy/components/Multibanco/Multibanco.js.map +1 -1
  269. package/dist/es-legacy/components/Multibanco/components/MultibancoVoucherResult/MultibancoVoucherResult.js.map +1 -1
  270. package/dist/es-legacy/components/Oxxo/Oxxo.js +1 -1
  271. package/dist/es-legacy/components/Oxxo/Oxxo.js.map +1 -1
  272. package/dist/es-legacy/components/Oxxo/components/OxxoVoucherResult/OxxoVoucherResult.js.map +1 -1
  273. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js +1 -1
  274. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js.map +1 -1
  275. package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js.map +1 -1
  276. package/dist/es-legacy/components/PayPal/Paypal.js +1 -1
  277. package/dist/es-legacy/components/PayPal/Paypal.js.map +1 -1
  278. package/dist/es-legacy/components/PayPal/components/PaypalButtons.js +1 -1
  279. package/dist/es-legacy/components/PayPal/components/PaypalButtons.js.map +1 -1
  280. package/dist/es-legacy/components/PayPal/components/PaypalComponent.js +1 -1
  281. package/dist/es-legacy/components/PayPal/components/PaypalComponent.js.map +1 -1
  282. package/dist/es-legacy/components/PayPal/utils/format-paypal-order-contact-to-adyen-format.js +1 -1
  283. package/dist/es-legacy/components/PayPal/utils/format-paypal-order-contact-to-adyen-format.js.map +1 -1
  284. package/dist/es-legacy/components/PayPal/utils/get-paypal-styles.js.map +1 -1
  285. package/dist/es-legacy/components/PayPalFastlane/Fastlane.js.map +1 -1
  286. package/dist/es-legacy/components/PayTo/components/PayToNameFields.js.map +1 -1
  287. package/dist/es-legacy/components/Pix/Pix.js +1 -1
  288. package/dist/es-legacy/components/Pix/Pix.js.map +1 -1
  289. package/dist/es-legacy/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js.map +1 -1
  290. package/dist/es-legacy/components/Redirect/components/RedirectShopper/RedirectShopper.js.map +1 -1
  291. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  292. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  293. package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js +1 -1
  294. package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
  295. package/dist/es-legacy/components/UPI/UPI.js +1 -1
  296. package/dist/es-legacy/components/UPI/UPI.js.map +1 -1
  297. package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
  298. package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
  299. package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.js +1 -1
  300. package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.js.map +1 -1
  301. package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js +1 -1
  302. package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js.map +1 -1
  303. package/dist/es-legacy/components/UPI/components/UPIMandate/UPIMandate.js.map +1 -1
  304. package/dist/es-legacy/components/UPI/constants.js +1 -1
  305. package/dist/es-legacy/components/UPI/constants.js.map +1 -1
  306. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  307. package/dist/es-legacy/components/helpers/QRLoaderContainer/QRLoaderContainer.js +1 -1
  308. package/dist/es-legacy/components/helpers/QRLoaderContainer/QRLoaderContainer.js.map +1 -1
  309. package/dist/es-legacy/components/internal/Address/validate.formats.js +1 -1
  310. package/dist/es-legacy/components/internal/Address/validate.formats.js.map +1 -1
  311. package/dist/es-legacy/components/internal/BrandIcons/BrandIcons.js +2 -0
  312. package/dist/es-legacy/components/internal/BrandIcons/BrandIcons.js.map +1 -0
  313. package/dist/es-legacy/components/internal/BrandIcons/BrandIcons.module.scss.js +2 -0
  314. package/dist/es-legacy/components/internal/BrandIcons/BrandIcons.module.scss.js.map +1 -0
  315. package/dist/es-legacy/components/internal/{Brand/Brand.js → BrandImage/BrandImage.js} +2 -2
  316. package/dist/es-legacy/components/internal/BrandImage/BrandImage.js.map +1 -0
  317. package/dist/es-legacy/components/internal/Button/Button.js +1 -1
  318. package/dist/es-legacy/components/internal/Button/Button.js.map +1 -1
  319. package/dist/es-legacy/components/internal/ExpandButton/ExpandButton.js +1 -1
  320. package/dist/es-legacy/components/internal/ExpandButton/ExpandButton.js.map +1 -1
  321. package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js +1 -1
  322. package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js.map +1 -1
  323. package/dist/es-legacy/components/internal/FormFields/ConsentCheckbox/ConsentCheckbox.js +1 -1
  324. package/dist/es-legacy/components/internal/FormFields/ConsentCheckbox/ConsentCheckbox.js.map +1 -1
  325. package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
  326. package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
  327. package/dist/es-legacy/components/internal/FormFields/InputDate/utils.js +1 -1
  328. package/dist/es-legacy/components/internal/FormFields/InputDate/utils.js.map +1 -1
  329. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js +1 -1
  330. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
  331. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectList.js +1 -1
  332. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectList.js.map +1 -1
  333. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js +1 -1
  334. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js.map +1 -1
  335. package/dist/es-legacy/components/internal/IssuerList/IssuerList.js +1 -1
  336. package/dist/es-legacy/components/internal/IssuerList/IssuerList.js.map +1 -1
  337. package/dist/es-legacy/components/internal/Modal/Modal.js +1 -1
  338. package/dist/es-legacy/components/internal/Modal/Modal.js.map +1 -1
  339. package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js +1 -1
  340. package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -1
  341. package/dist/es-legacy/components/internal/PayButton/PayButton.js +1 -1
  342. package/dist/es-legacy/components/internal/PayButton/PayButton.js.map +1 -1
  343. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputFields.js +1 -1
  344. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputFields.js.map +1 -1
  345. package/dist/es-legacy/components/internal/QRLoader/QRLoaderDetailsProvider.js +1 -1
  346. package/dist/es-legacy/components/internal/QRLoader/QRLoaderDetailsProvider.js.map +1 -1
  347. package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js +1 -1
  348. package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js.map +1 -1
  349. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  350. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/AbstractCSF.js.map +1 -1
  351. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/CSF.js +1 -1
  352. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/CSF.js.map +1 -1
  353. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js.map +1 -1
  354. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
  355. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  356. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleEncryption.js +1 -1
  357. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleEncryption.js.map +1 -1
  358. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/initCSF.js.map +1 -1
  359. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/iframes/postMessageValidation.js +1 -1
  360. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/iframes/postMessageValidation.js.map +1 -1
  361. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/processErrors.js.map +1 -1
  362. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  363. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  364. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  365. package/dist/es-legacy/components/internal/StoreDetails/StoreDetails.js +1 -1
  366. package/dist/es-legacy/components/internal/StoreDetails/StoreDetails.js.map +1 -1
  367. package/dist/es-legacy/components/internal/Tooltip/Tooltip.js.map +1 -1
  368. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  369. package/dist/es-legacy/core/Analytics/Analytics.js +1 -1
  370. package/dist/es-legacy/core/Analytics/Analytics.js.map +1 -1
  371. package/dist/es-legacy/core/Analytics/AnalyticsEventQueue.js +1 -1
  372. package/dist/es-legacy/core/Analytics/AnalyticsEventQueue.js.map +1 -1
  373. package/dist/es-legacy/core/Context/Resources.js +1 -1
  374. package/dist/es-legacy/core/Context/Resources.js.map +1 -1
  375. package/dist/es-legacy/core/ProcessResponse/PaymentMethods/filters.js +1 -1
  376. package/dist/es-legacy/core/ProcessResponse/PaymentMethods/filters.js.map +1 -1
  377. package/dist/es-legacy/core/config.js +1 -1
  378. package/dist/es-legacy/core/config.js.map +1 -1
  379. package/dist/es-legacy/core/core.js +1 -1
  380. package/dist/es-legacy/core/core.js.map +1 -1
  381. package/dist/es-legacy/external/preact/compat/dist/compat.js +1 -1
  382. package/dist/es-legacy/external/preact/compat/dist/compat.js.map +1 -1
  383. package/dist/es-legacy/external/preact/dist/preact.js +1 -1
  384. package/dist/es-legacy/external/preact/dist/preact.js.map +1 -1
  385. package/dist/es-legacy/external/preact/hooks/dist/hooks.js +1 -1
  386. package/dist/es-legacy/external/preact/hooks/dist/hooks.js.map +1 -1
  387. package/dist/es-legacy/language/Language.js +1 -1
  388. package/dist/es-legacy/language/Language.js.map +1 -1
  389. package/dist/es-legacy/language/LanguageService.js +2 -0
  390. package/dist/es-legacy/language/LanguageService.js.map +1 -0
  391. package/dist/es-legacy/language/constants.js +1 -1
  392. package/dist/es-legacy/language/constants.js.map +1 -1
  393. package/dist/es-legacy/language/utils.js +1 -1
  394. package/dist/es-legacy/language/utils.js.map +1 -1
  395. package/dist/es-legacy/packages/server/translations/en-US.json.js +2 -0
  396. package/dist/es-legacy/packages/server/translations/en-US.json.js.map +1 -0
  397. package/dist/es-legacy/utils/Script.js.map +1 -1
  398. package/dist/es-legacy/utils/debounce.js.map +1 -1
  399. package/dist/es-legacy/utils/getErrorMessage.js +1 -1
  400. package/dist/es-legacy/utils/getErrorMessage.js.map +1 -1
  401. package/dist/es-legacy/utils/hookUtils.js.map +1 -1
  402. package/dist/es-legacy/utils/promiseTimeout.js.map +1 -1
  403. package/package.json +30 -29
  404. package/styles/adyen.css +6 -5
  405. package/dist/es/components/internal/Brand/Brand.js.map +0 -1
  406. package/dist/es/core/Services/get-translations.js +0 -2
  407. package/dist/es/core/Services/get-translations.js.map +0 -1
  408. package/dist/es-legacy/components/internal/Brand/Brand.js.map +0 -1
  409. package/dist/es-legacy/core/Services/get-translations.js +0 -2
  410. package/dist/es-legacy/core/Services/get-translations.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{getFormattingRegEx as o,SPECIAL_CHARS as t,trimValWithOneSpace as a}from"../../../utils/validator-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(t),l=o=>a(o).replace(r,""),s={postalCode:{formatterFn:(o,t)=>{const a=t.state.data.country,e=m[a]?.postalCode.formatterFn;return e?e(o):o}},street:{formatterFn:l},houseNumberOrName:{formatterFn:l},city:{formatterFn:l}},m={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.indexOf("-")>-1?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:a=>a.replace(o(t),"").substring(0,8),format:"AA99 9AA or A99 9AA or A9 9AA",maxlength:8}},GR:{postalCode:{format:"999 99",maxlength:6}},HR:{postalCode:{format:"[1-5]9999",maxlength:5}},HU:{postalCode: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.indexOf("-")>-1?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:{format:"999-9999",maxlength:8}},US:{postalCode:{formatterFn:t=>{const a=t.replace(o("^\\d-","g"),""),e=a.indexOf("-")>-1?10:5;return a.substring(0,e)},format:"99999 or 99999-9999"}}};export{s as addressFormatters,m as countrySpecificFormatters};
1
+ import{getFormattingRegEx as o,SPECIAL_CHARS as t,trimValWithOneSpace as a}from"../../../utils/validator-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(t),l=o=>a(o).replace(r,""),s={postalCode:{formatterFn:(o,t)=>{const a=t.state.data.country,e=m[a]?.postalCode.formatterFn;return e?e(o):o}},street:{formatterFn:l},houseNumberOrName:{formatterFn:l},city:{formatterFn:l}},m={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:a=>a.replace(o(t),"").substring(0,8),format:"AA99 9AA or A99 9AA or A9 9AA",maxlength:8}},GR:{postalCode:{format:"999 99",maxlength:6}},HR:{postalCode:{format:"[1-5]9999",maxlength:5}},HU:{postalCode: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:{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{s as addressFormatters,m 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 { CountryFormatRules, FormatRules } from '../../../utils/Validator/types';\nimport { Formatter } from '../../../utils/useForm/types';\nimport { getFormattingRegEx, SPECIAL_CHARS, trimValWithOneSpace } from '../../../utils/validator-utils';\n\nconst createFormatByDigits = (digits: number): Formatter => {\n const format = new Array(digits).fill('9').join('');\n return {\n // Formatter - excludes non digits and limits to maxlength\n formatterFn: val => val.replace(getFormattingRegEx('^\\\\d', 'g'), '').substring(0, digits),\n format,\n maxlength: digits\n };\n};\n\nconst specialCharsRegEx = getFormattingRegEx(SPECIAL_CHARS);\nconst formattingFn = val => trimValWithOneSpace(val).replace(specialCharsRegEx, '');\n\nexport const addressFormatters: FormatRules = {\n postalCode: {\n formatterFn: (val, context) => {\n const country = context.state.data.country;\n\n // Country specific formatting rule\n const specificRule = countrySpecificFormatters[country]?.postalCode.formatterFn;\n if (specificRule) {\n return specificRule(val);\n }\n\n // Default formatting rule: allow anything\n return val;\n }\n },\n street: {\n formatterFn: formattingFn\n },\n houseNumberOrName: {\n formatterFn: formattingFn\n },\n city: {\n formatterFn: formattingFn\n }\n};\n\n// TODO make proper formatter fns for those entries that don't just have a straightforward, x number of digits, no spaces, format\n// check against our internal documentation on address postal code\n// which, for example, says BR isn't just 8 digits (it can be spilt by a hyphen) & CZ can also be 5 digits, no spaces\nexport const countrySpecificFormatters: CountryFormatRules = {\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.indexOf('-') > -1 ? 9 : 8;\n return nuVal.substring(0, maxlength);\n },\n format: '12345678 or 12345-678',\n maxlength: 9\n }\n },\n CA: {\n postalCode: {\n format: 'A9A 9A9 or A9A9A9',\n maxlength: 7\n }\n },\n CH: {\n postalCode: createFormatByDigits(4)\n },\n CY: {\n postalCode: createFormatByDigits(4)\n },\n CZ: {\n postalCode: {\n format: '999 99',\n maxlength: 6\n }\n },\n DE: {\n postalCode: createFormatByDigits(5)\n },\n DK: {\n postalCode: {\n format: '9999',\n maxlength: 7\n }\n },\n EE: {\n postalCode: createFormatByDigits(5)\n },\n ES: {\n postalCode: createFormatByDigits(5)\n },\n FI: {\n postalCode: createFormatByDigits(5)\n },\n FR: {\n postalCode: createFormatByDigits(5)\n },\n GB: {\n postalCode: {\n // Disallow special chars & set to maxlength\n formatterFn: val => val.replace(getFormattingRegEx(SPECIAL_CHARS), '').substring(0, 8),\n format: 'AA99 9AA or A99 9AA or A9 9AA',\n maxlength: 8\n }\n },\n GR: {\n postalCode: {\n format: '999 99',\n maxlength: 6\n }\n },\n HR: {\n postalCode: {\n format: '[1-5]9999',\n maxlength: 5\n }\n },\n HU: {\n postalCode: createFormatByDigits(4)\n },\n IE: {\n postalCode: {\n format: 'A99 A999',\n maxlength: 8\n }\n },\n IS: {\n postalCode: createFormatByDigits(3)\n },\n IT: {\n postalCode: createFormatByDigits(5)\n },\n LI: {\n postalCode: createFormatByDigits(4)\n },\n LT: {\n postalCode: {\n format: '9999 or 99999 or LT-99999',\n maxlength: 8\n }\n },\n LU: {\n postalCode: createFormatByDigits(4)\n },\n LV: {\n postalCode: {\n format: '9999 or LV-9999',\n maxlength: 7\n }\n },\n MC: {\n postalCode: {\n format: '980NN',\n maxlength: 5\n }\n },\n MT: {\n postalCode: {\n format: 'AA99 or AAA99 or AA9999 or AAA9999',\n maxlength: 8\n }\n },\n MY: {\n postalCode: createFormatByDigits(5)\n },\n NL: {\n postalCode: {\n format: '9999AA',\n maxlength: 7\n }\n },\n NZ: {\n postalCode: createFormatByDigits(4)\n },\n NO: {\n postalCode: createFormatByDigits(4)\n },\n PL: {\n postalCode: {\n // Formatter - excludes non digits, but allows hyphens, and limits to a maxlength that varies depending on whether a hyphen is present or not\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n const maxlength = nuVal.indexOf('-') > -1 ? 6 : 5;\n return nuVal.substring(0, maxlength);\n },\n format: '99999 or 99-999',\n maxlength: 6\n }\n },\n PT: {\n postalCode: {\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n return nuVal.substring(0, 8);\n },\n format: '9999-999',\n maxlength: 8\n }\n },\n RO: {\n postalCode: createFormatByDigits(6)\n },\n SI: {\n postalCode: {\n format: '9999 or SI-9999',\n maxlength: 7\n }\n },\n SE: {\n postalCode: createFormatByDigits(5)\n },\n SG: {\n postalCode: createFormatByDigits(6)\n },\n SK: {\n postalCode: {\n format: '99999 or SK-99999',\n maxlength: 8\n }\n },\n JP: {\n postalCode: {\n format: '999-9999',\n maxlength: 8\n }\n },\n US: {\n postalCode: {\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n const maxlength = nuVal.indexOf('-') > -1 ? 10 : 5;\n return nuVal.substring(0, maxlength);\n },\n format: '99999 or 99999-9999'\n }\n }\n};\n"],"names":["createFormatByDigits","digits","formatterFn","val","replace","getFormattingRegEx","substring","format","Array","fill","join","maxlength","specialCharsRegEx","SPECIAL_CHARS","formattingFn","trimValWithOneSpace","addressFormatters","postalCode","context","country","state","data","specificRule","countrySpecificFormatters","street","houseNumberOrName","city","AT","AU","BE","BG","BR","nuVal","indexOf","CA","CH","CY","CZ","DE","DK","EE","ES","FI","FR","GB","GR","HR","HU","IE","IS","IT","LI","LT","LU","LV","MC","MT","MY","NL","NZ","NO","PL","PT","RO","SI","SE","SG","SK","JP","US"],"mappings":"mHAIA,MAAMA,EAAwBC,IAEnB,CAEHC,YAAaC,GAAOA,EAAIC,QAAQC,EAAmB,OAAQ,KAAM,IAAIC,UAAU,EAAGL,GAClFM,OAJW,IAAIC,MAAMP,GAAQQ,KAAK,KAAKC,KAAK,IAK5CC,UAAWV,IAIbW,EAAoBP,EAAmBQ,GACvCC,EAAeX,GAAOY,EAAoBZ,GAAKC,QAAQQ,EAAmB,IAEnEI,EAAiC,CAC1CC,WAAY,CACRf,YAAa,CAACC,EAAKe,KACf,MAAMC,EAAUD,EAAQE,MAAMC,KAAKF,QAG7BG,EAAeC,EAA0BJ,IAAUF,WAAWf,YACpE,OAAIoB,EACOA,EAAanB,GAIjBA,IAGfqB,OAAQ,CACJtB,YAAaY,GAEjBW,kBAAmB,CACfvB,YAAaY,GAEjBY,KAAM,CACFxB,YAAaY,IAORS,EAAgD,CACzDI,GAAI,CACAV,WAAYjB,EAAqB,IAErC4B,GAAI,CACAX,WA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C,WAAYjB,EAAqB,IAErCsD,GAAI,CACArC,WAAY,CACRV,OAAQ,kBACRI,UAAW,IAGnB4C,GAAI,CACAtC,WAAY,CACRV,OAAQ,QACRI,UAAW,IAGnB6C,GAAI,CACAvC,WAAY,CACRV,OAAQ,qCACRI,UAAW,IAGnB8C,GAAI,CACAxC,WAAYjB,EAAqB,IAErC0D,GAAI,CACAzC,WAAY,CACRV,OAAQ,SACRI,UAAW,IAGnBgD,GAAI,CACA1C,WAAYjB,EAAqB,IAErC4D,GAAI,CACA3C,WAAYjB,EAAqB,IAErC6D,GAAI,CACA5C,WAAY,CAERf,YAAaC,IACT,MAAM6B,EAAQ7B,EAAIC,QAAQC,EAAmB,QAAS,KAAM,IACtDM,EAAYqB,EAAMC,QAAQ,MAAO,EAAK,EAAI,EAChD,OAAOD,EAAM1B,UAAU,EAAGK,IAE9BJ,OAAQ,kBACRI,UAAW,IAGnBmD,GAAI,CACA7C,WAAY,CACRf,YAAaC,GACKA,EAAIC,QAAQC,EAAmB,QAAS,KAAM,IAC/CC,UAAU,EAAG,GAE9BC,OAAQ,WACRI,UAAW,IAGnBoD,GAAI,CACA9C,WAAYjB,EAAqB,IAErCgE,GAAI,CACA/C,WAAY,CACRV,OAAQ,kBACRI,UAAW,IAGnBsD,GAAI,CACAhD,WAAYjB,EAAqB,IAErCkE,GAAI,CACAjD,WAAYjB,EAAqB,IAErCmE,GAAI,CACAlD,WAAY,CACRV,OAAQ,oBACRI,UAAW,IAGnByD,GAAI,CACAnD,WAAY,CACRV,OAAQ,WACRI,UAAW,IAGnB0D,GAAI,CACApD,WAAY,CACRf,YAAaC,IACT,MAAM6B,EAAQ7B,EAAIC,QAAQC,EAAmB,QAAS,KAAM,IACtDM,EAAYqB,EAAMC,QAAQ,MAAO,EAAK,GAAK,EACjD,OAAOD,EAAM1B,UAAU,EAAGK,IAE9BJ,OAAQ"}
1
+ {"version":3,"file":"validate.formats.js","sources":["../../../../../src/components/internal/Address/validate.formats.ts"],"sourcesContent":["import { CountryFormatRules, FormatRules } from '../../../utils/Validator/types';\nimport { Formatter } from '../../../utils/useForm/types';\nimport { getFormattingRegEx, SPECIAL_CHARS, trimValWithOneSpace } from '../../../utils/validator-utils';\n\nconst asCountryFormatRules = <T extends CountryFormatRules>(rules: T): T & CountryFormatRules => rules;\n\nconst createFormatByDigits = (digits: number): Formatter => {\n const format = new Array(digits).fill('9').join('');\n return {\n // Formatter - excludes non digits and limits to maxlength\n formatterFn: val => val.replace(getFormattingRegEx('^\\\\d', 'g'), '').substring(0, digits),\n format,\n maxlength: digits\n };\n};\n\nconst specialCharsRegEx = getFormattingRegEx(SPECIAL_CHARS);\nconst formattingFn = val => trimValWithOneSpace(val).replace(specialCharsRegEx, '');\n\nexport const addressFormatters: FormatRules = {\n postalCode: {\n formatterFn: (val, context) => {\n const country = context.state.data.country;\n\n // Country specific formatting rule\n const specificRule = countrySpecificFormatters[country]?.postalCode.formatterFn;\n if (specificRule) {\n return specificRule(val);\n }\n\n // Default formatting rule: allow anything\n return val;\n }\n },\n street: {\n formatterFn: formattingFn\n },\n houseNumberOrName: {\n formatterFn: formattingFn\n },\n city: {\n formatterFn: formattingFn\n }\n};\n\n// TODO make proper formatter fns for those entries that don't just have a straightforward, x number of digits, no spaces, format\n// check against our internal documentation on address postal code\n// which, for example, says BR isn't just 8 digits (it can be spilt by a hyphen) & CZ can also be 5 digits, no spaces\nexport const countrySpecificFormatters = asCountryFormatRules({\n AT: {\n postalCode: createFormatByDigits(4)\n },\n AU: {\n postalCode: createFormatByDigits(4)\n },\n BE: {\n postalCode: createFormatByDigits(4)\n },\n BG: {\n postalCode: createFormatByDigits(4)\n },\n BR: {\n postalCode: {\n // Formatter - excludes non digits, but allows hyphens, and limits to a maxlength that varies depending on whether a hyphen is present or not\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n const maxlength = nuVal.includes('-') ? 9 : 8;\n return nuVal.substring(0, maxlength);\n },\n format: '12345678 or 12345-678',\n maxlength: 9\n }\n },\n CA: {\n postalCode: {\n format: 'A9A 9A9 or A9A9A9',\n maxlength: 7\n }\n },\n CH: {\n postalCode: createFormatByDigits(4)\n },\n CY: {\n postalCode: createFormatByDigits(4)\n },\n CZ: {\n postalCode: {\n format: '999 99',\n maxlength: 6\n }\n },\n DE: {\n postalCode: createFormatByDigits(5)\n },\n DK: {\n postalCode: {\n format: '9999',\n maxlength: 7\n }\n },\n EE: {\n postalCode: createFormatByDigits(5)\n },\n ES: {\n postalCode: createFormatByDigits(5)\n },\n FI: {\n postalCode: createFormatByDigits(5)\n },\n FR: {\n postalCode: createFormatByDigits(5)\n },\n GB: {\n postalCode: {\n // Disallow special chars & set to maxlength\n formatterFn: val => val.replace(getFormattingRegEx(SPECIAL_CHARS), '').substring(0, 8),\n format: 'AA99 9AA or A99 9AA or A9 9AA',\n maxlength: 8\n }\n },\n GR: {\n postalCode: {\n format: '999 99',\n maxlength: 6\n }\n },\n HR: {\n postalCode: {\n format: '[1-5]9999',\n maxlength: 5\n }\n },\n HU: {\n postalCode: createFormatByDigits(4)\n },\n IE: {\n postalCode: {\n format: 'A99 A999',\n maxlength: 8\n }\n },\n IS: {\n postalCode: createFormatByDigits(3)\n },\n IT: {\n postalCode: createFormatByDigits(5)\n },\n LI: {\n postalCode: createFormatByDigits(4)\n },\n LT: {\n postalCode: {\n format: '9999 or 99999 or LT-99999',\n maxlength: 8\n }\n },\n LU: {\n postalCode: createFormatByDigits(4)\n },\n LV: {\n postalCode: {\n format: '9999 or LV-9999',\n maxlength: 7\n }\n },\n MC: {\n postalCode: {\n format: '980NN',\n maxlength: 5\n }\n },\n MT: {\n postalCode: {\n format: 'AA99 or AAA99 or AA9999 or AAA9999',\n maxlength: 8\n }\n },\n MY: {\n postalCode: createFormatByDigits(5)\n },\n NL: {\n postalCode: {\n format: '9999AA',\n maxlength: 7\n }\n },\n NZ: {\n postalCode: createFormatByDigits(4)\n },\n NO: {\n postalCode: createFormatByDigits(4)\n },\n PL: {\n postalCode: {\n // Formatter - excludes non digits, but allows hyphens, and limits to a maxlength that varies depending on whether a hyphen is present or not\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n const maxlength = nuVal.includes('-') ? 6 : 5;\n return nuVal.substring(0, maxlength);\n },\n format: '99999 or 99-999',\n maxlength: 6\n }\n },\n PT: {\n postalCode: {\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n return nuVal.substring(0, 8);\n },\n format: '9999-999',\n maxlength: 8\n }\n },\n RO: {\n postalCode: createFormatByDigits(6)\n },\n SI: {\n postalCode: {\n format: '9999 or SI-9999',\n maxlength: 7\n }\n },\n SE: {\n postalCode: createFormatByDigits(5)\n },\n SG: {\n postalCode: createFormatByDigits(6)\n },\n SK: {\n postalCode: {\n format: '99999 or SK-99999',\n maxlength: 8\n }\n },\n JP: {\n postalCode: {\n format: '999-9999',\n maxlength: 8\n }\n },\n US: {\n postalCode: {\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n const maxlength = nuVal.includes('-') ? 10 : 5;\n return nuVal.substring(0, maxlength);\n },\n format: '99999 or 99999-9999'\n }\n }\n});\n"],"names":["createFormatByDigits","digits","formatterFn","val","replace","getFormattingRegEx","substring","format","Array","fill","join","maxlength","specialCharsRegEx","SPECIAL_CHARS","formattingFn","trimValWithOneSpace","addressFormatters","postalCode","context","country","state","data","specificRule","countrySpecificFormatters","street","houseNumberOrName","city","AT","AU","BE","BG","BR","nuVal","includes","CA","CH","CY","CZ","DE","DK","EE","ES","FI","FR","GB","GR","HR","HU","IE","IS","IT","LI","LT","LU","LV","MC","MT","MY","NL","NZ","NO","PL","PT","RO","SI","SE","SG","SK","JP","US"],"mappings":"mHAIA,MAEMA,EAAwBC,IAEnB,CAEHC,YAAaC,GAAOA,EAAIC,QAAQC,EAAmB,OAAQ,KAAM,IAAIC,UAAU,EAAGL,GAClFM,OAJW,IAAI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AW,IAGnBsD,GAAI,CACAhD,WAAYjB,EAAqB,IAErCkE,GAAI,CACAjD,WAAYjB,EAAqB,IAErCmE,GAAI,CACAlD,WAAY,CACRV,OAAQ,oBACRI,UAAW,IAGnByD,GAAI,CACAnD,WAAY,CACRV,OAAQ,WACRI,UAAW,IAGnB0D,GAAI,CACApD,WAAY,CACRf,YAAaC,IACT,MAAM6B,EAAQ7B,EAAIC,QAAQC,EAAmB,QAAS,KAAM,IACtDM,EAAYqB,EAAMC,SAAS,KAAO,GAAK,EAC7C,OAAOD,EAAM1B,UAAU,EAAGK,IAE9BJ,OAAQ"}
@@ -0,0 +1,2 @@
1
+ import{createElement as a}from"../../../external/preact/dist/preact.js";import{useMemo as r}from"../../../external/preact/hooks/dist/hooks.js";import e from"../../../_virtual/index.js";import{BrandImage as s}from"../BrandImage/BrandImage.js";import n from"./BrandIcons.module.scss.js";const m=({brandIcons:m,maxBrandsToShow:o=m.length,remainingBrandsLabel:l,className:t,containerType:i="flex",remainingBrandsLabelClassName:c,brandImageClassName:d,brandImageWrapperClassName:g,showIconOnError:p,smallIcons:I,renderBrandIcon:B})=>{const h=r(()=>m.slice(0,o),[m,o]),N=r(()=>m.slice(o),[m,o]),b=Boolean(l)||N.length>0;return a("div",{className:e(n.container,{[n.grid]:"grid"===i,[n.smallImgGrid]:I&&"grid"===i},t)},h.map(r=>B?B(r):a(s,{key:r.alt,src:r.src,alt:r.alt,wrapperClassName:g,imgClassName:e(n.img,{[n.smallImg]:I},d),showOnError:p})),b&&a("span",{className:e(n.remainingBrandsLabel,c)},l||`+ ${N.length}`))};export{m as BrandIcons};
2
+ //# sourceMappingURL=BrandIcons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BrandIcons.js","sources":["../../../../../src/components/internal/BrandIcons/BrandIcons.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useMemo } from 'preact/hooks';\nimport cn from 'classnames';\n\nimport { BrandIcon } from './types';\nimport { BrandImage } from '../BrandImage';\n\nimport styles from './BrandIcons.module.scss';\n\nexport type BrandIconsProp = {\n brandIcons: BrandIcon[];\n suffix?: string;\n maxBrandsToShow?: number;\n remainingBrandsLabel?: string;\n className?: string;\n containerType?: 'flex' | 'grid';\n remainingBrandsLabelClassName?: string;\n brandImageWrapperClassName?: string;\n brandImageClassName?: string;\n showIconOnError?: boolean;\n smallIcons?: boolean;\n renderBrandIcon?: (brandIcon: BrandIcon) => h.JSX.Element;\n};\n\nexport const BrandIcons = ({\n brandIcons,\n maxBrandsToShow = brandIcons.length,\n remainingBrandsLabel,\n className,\n containerType = 'flex',\n remainingBrandsLabelClassName,\n brandImageClassName,\n brandImageWrapperClassName,\n showIconOnError,\n smallIcons,\n renderBrandIcon\n}: Readonly<BrandIconsProp>) => {\n const visibleBrands = useMemo(() => brandIcons.slice(0, maxBrandsToShow), [brandIcons, maxBrandsToShow]);\n const remainingBrands = useMemo(() => brandIcons.slice(maxBrandsToShow), [brandIcons, maxBrandsToShow]);\n\n const hasRemainingBrands = Boolean(remainingBrandsLabel) || remainingBrands.length > 0;\n\n return (\n <div\n className={cn(\n styles.container,\n { [styles.grid]: containerType === 'grid', [styles.smallImgGrid]: smallIcons && containerType === 'grid' },\n className\n )}\n >\n {visibleBrands.map(brandIcon =>\n renderBrandIcon ? (\n renderBrandIcon(brandIcon)\n ) : (\n <BrandImage\n key={brandIcon.alt}\n src={brandIcon.src}\n alt={brandIcon.alt}\n wrapperClassName={brandImageWrapperClassName}\n imgClassName={cn(styles.img, { [styles.smallImg]: smallIcons }, brandImageClassName)}\n showOnError={showIconOnError}\n />\n )\n )}\n {hasRemainingBrands && (\n <span className={cn(styles.remainingBrandsLabel, remainingBrandsLabelClassName)}>\n {remainingBrandsLabel || `+ ${remainingBrands.length}`}\n </span>\n )}\n </div>\n );\n};\n"],"names":["BrandIcons","brandIcons","maxBrandsToShow","length","remainingBrandsLabel","className","containerType","remainingBrandsLabelClassName","brandImageClassName","brandImageWrapperClassName","showIconOnError","smallIcons","renderBrandIcon","visibleBrands","useMemo","slice","remainingBrands","hasRemainingBrands","Boolean","h","div","cn","styles","container","grid","smallImgGrid","map","brandIcon","BrandImage","key","alt","src","wrapperClassName","imgClassName","img","smallImg","showOnError","span"],"mappings":"6RAwBO,MAAMA,EAAa,EACtBC,aACAC,kBAAkBD,EAAWE,OAC7BC,uBACAC,YACAC,gBAAgB,OAChBC,gCACAC,sBACAC,6BACAC,kBACAC,aACAC,sBAEA,MAAMC,EAAgBC,EAAQ,IAAMb,EAAWc,MAAM,EAAGb,GAAkB,CAACD,EAAYC,IACjFc,EAAkBF,EAAQ,IAAMb,EAAWc,MAAMb,GAAkB,CAACD,EAAYC,IAEhFe,EAAqBC,QAAQd,IAAyBY,EAAgBb,OAAS,EAErF,OACIgB,EAACC,MAAAA,CACGf,UAAWgB,EACPC,EAAOC,UACP,CAAE,CAACD,EAAOE,MAAyB,SAAlBlB,EAA0B,CAACgB,EAAOG,cAAed,GAAgC,SAAlBL,GAChFD,IAGHQ,EAAca,IAAIC,GACff,EACIA,EAAgBe,GAEhBR,EAACS,EAAAA,CACGC,IAAKF,EAAUG,IACfC,IAAKJ,EAAUI,IACfD,IAAKH,EAAUG,IACfE,iBAAkBvB,EAClBwB,aAAcZ,EAAGC,EAAOY,IAAK,CAAE,CAACZ,EAAOa,UAAWxB,GAAcH,GAChE4B,YAAa1B,KAIxBO,GACGE,EAACkB,OAAAA,CAAKhC,UAAWgB,EAAGC,EAAOlB,qBAAsBG,IAC5CH,GAAwB,KAAKY,EAAgBb"}
@@ -0,0 +1,2 @@
1
+ var n={container:"BrandIcons-module_container__FeCxK",grid:"BrandIcons-module_grid__wb0DE",smallImgGrid:"BrandIcons-module_smallImgGrid__iCMqT",remainingBrandsLabel:"BrandIcons-module_remainingBrandsLabel__v0FKS",img:"BrandIcons-module_img__Oe3i-",smallImg:"BrandIcons-module_smallImg__GwOZ0"};export{n as default};
2
+ //# sourceMappingURL=BrandIcons.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BrandIcons.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- import{createElement as r}from"../../../external/preact/dist/preact.js";import{useState as a}from"../../../external/preact/hooks/dist/hooks.js";import e from"../../../_virtual/index.js";import t from"../Img/Img.js";const s=({url:s,alt:o,wrapperClassName:m="",imgClassName:p="",showOnError:n})=>{const[c,l]=a(!1),d=e("adyen-checkout-brand-wrapper",m,n?{}:{"adyen-checkout-brand-wrapper--error":c});return r("span",{className:d,"data-testid":"brand-image-wrapper"},r(t,{className:p,src:s,alt:o,onError:()=>l(!0)}))};export{s as default};
2
- //# sourceMappingURL=Brand.js.map
1
+ import{createElement as r}from"../../../external/preact/dist/preact.js";import{useState as a}from"../../../external/preact/hooks/dist/hooks.js";import e from"../../../_virtual/index.js";import t from"../Img/Img.js";const s=({src:s,alt:o,wrapperClassName:m="",imgClassName:p="",showOnError:n})=>{const[c,i]=a(!1),d=e("adyen-checkout-brand-wrapper",m,n?{}:{"adyen-checkout-brand-wrapper--error":c});return r("span",{className:d,"data-testid":"brand-image-wrapper"},r(t,{className:p,src:s,alt:o,onError:()=>i(!0)}))};export{s as BrandImage};
2
+ //# sourceMappingURL=BrandImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BrandImage.js","sources":["../../../../../src/components/internal/BrandImage/BrandImage.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useState } from 'preact/hooks';\nimport cx from 'classnames';\nimport Img from '../Img';\nimport './BrandImage.scss';\n\ninterface BrandImageProps {\n src: string;\n alt: string;\n wrapperClassName?: string;\n imgClassName?: string;\n showOnError?: boolean;\n}\n\nexport const BrandImage = ({ src, alt, wrapperClassName = '', imgClassName = '', showOnError }: Readonly<BrandImageProps>) => {\n const [hasError, setHasError] = useState(false);\n const classesOnError = showOnError ? {} : { 'adyen-checkout-brand-wrapper--error': hasError };\n const classes = cx('adyen-checkout-brand-wrapper', wrapperClassName, classesOnError);\n\n return (\n <span className={classes} data-testid=\"brand-image-wrapper\">\n <Img className={imgClassName} src={src} alt={alt} onError={() => setHasError(true)} />\n </span>\n );\n};\n"],"names":["BrandImage","src","alt","wrapperClassName","imgClassName","showOnError","hasError","setHasError","useState","classes","cx","h","span","className","data-testid","Img","onError"],"mappings":"uNAcO,MAAMA,EAAa,EAAGC,MAAKC,MAAKC,mBAAmB,GAAIC,eAAe,GAAIC,kBAC7E,MAAOC,EAAUC,GAAeC,GAAS,GAEnCC,EAAUC,EAAG,+BAAgCP,EAD5BE,EAAc,GAAK,CAAE,sCAAuCC,IAGnF,OACIK,EAACC,OAAAA,CAAKC,UAAWJ,EAASK,cAAY,uBAClCH,EAACI,EAAAA,CAAIF,UAAWT,EAAcH,IAAKA,EAAKC,IAAKA,EAAKc,QAAS,IAAMT,GAAY"}
@@ -1,2 +1,2 @@
1
- import{Component as e,createElement as t}from"../../../external/preact/dist/preact.js";import a from"../../../_virtual/index.js";import n from"../Spinner/Spinner.js";import{useCoreContext as o}from"../../../core/Context/CoreProvider.js";function i(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class s extends e{render(){const{classNameModifiers:e=[],disabled:i,href:s,icon:r,onClickCompletedIcon:l,inline:c,label:d,ariaLabel:u,ariaDescribedBy:p,status:m,variant:b,buttonRef:h,onClickCompletedLabel:_,onMouseEnter:y,onMouseLeave:f,onFocus:g,onBlur:k,onKeyDown:C,onKeyPress:v}=this.props,{completed:N}=this.state,{i18n:S}=o(),x=l||r?t("img",{className:"adyen-checkout__button__icon",src:this.state.completed?l??r:r,alt:"","aria-hidden":"true"}):"",L=[...e,..."primary"===b?[]:[b],...c?["inline"]:[],...N?["completed"]:[],..."loading"===m||"redirect"===m?["loading"]:[]],j=a(["adyen-checkout__button",...L.map(e=>`adyen-checkout__button--${e}`)]),B={loading:t("span",{"aria-hidden":"true",className:"adyen-checkout__button__content"},t(n,{size:"medium",inline:!0})),redirect:t("span",{"aria-hidden":"true",className:"adyen-checkout__button__content"},t(n,{size:"medium",inline:!0}),S.get("payButton.redirecting")),default:t("span",{className:"adyen-checkout__button__content"},x,t("span",{className:"adyen-checkout__button__text"},this.state.completed?_??d:d))},D=B[m]||B.default;return s?t("a",{className:j,href:s,target:this.props.target,rel:this.props.rel,"aria-disabled":i,onClick:e=>{i&&e.preventDefault()}},D):t("button",{ref:h,className:j,type:"button",disabled:i,onClick:this.onClick,"aria-label":u,"aria-describedby":p,onMouseEnter:y,onMouseLeave:f,onKeyDown:C,onFocus:g,onBlur:k,onKeyPress:v},D,"loading"!==m&&"redirect"!==m&&this.props.children,t("span",{role:"status","aria-live":"polite",className:"adyen-checkout__button__text--sr-only"},S.get(this.buttonStatusSRLabel(m))))}constructor(...e){super(...e),i(this,"onClick",e=>{e.preventDefault(),this.props.disabled||this.props.onClick?.(e,{complete:this.complete})}),i(this,"complete",(e=1e3)=>{this.setState({completed:!0}),setTimeout(()=>{this.setState({completed:!1})},e)}),i(this,"buttonStatusSRLabel",e=>({loading:"loading",redirect:"payButton.redirecting"}[e]||""))}}i(s,"defaultProps",{status:"default",variant:"primary",disabled:!1,label:"",inline:!1,target:"_self"});export{s as default};
1
+ import{Component as e,createElement as t}from"../../../external/preact/dist/preact.js";import a from"../../../_virtual/index.js";import n from"../Spinner/Spinner.js";import{useCoreContext as o}from"../../../core/Context/CoreProvider.js";function i(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class r extends e{render(){const{classNameModifiers:e=[],disabled:i,href:r,icon:s,onClickCompletedIcon:l,inline:c,label:d,ariaLabel:u,ariaDescribedBy:p,ariaExpanded:m,ariaControls:b,status:h,variant:_,buttonRef:y,onClickCompletedLabel:f,onMouseEnter:g,onMouseLeave:k,onFocus:C,onBlur:v,onKeyDown:x,onKeyPress:N}=this.props,{completed:S}=this.state,{i18n:L}=o(),j=l||s?t("img",{className:"adyen-checkout__button__icon",src:this.state.completed?l??s:s,alt:"","aria-hidden":"true"}):"",B=[...e,..."primary"===_?[]:[_],...c?["inline"]:[],...S?["completed"]:[],..."loading"===h||"redirect"===h?["loading"]:[]],D=a(["adyen-checkout__button",...B.map(e=>`adyen-checkout__button--${e}`)]),M={loading:t("span",{"aria-hidden":"true",className:"adyen-checkout__button__content"},t(n,{size:"medium",inline:!0})),redirect:t("span",{"aria-hidden":"true",className:"adyen-checkout__button__content"},t(n,{size:"medium",inline:!0}),L.get("payButton.redirecting")),default:t("span",{className:"adyen-checkout__button__content"},j,t("span",{className:"adyen-checkout__button__text"},this.state.completed?f??d:d))},P=M[h]||M.default;return r?t("a",{className:D,href:r,target:this.props.target,rel:this.props.rel,"aria-disabled":i,onClick:e=>{i&&e.preventDefault()}},P):t("button",{ref:y,className:D,type:"button",disabled:i,onClick:this.onClick,"aria-label":u,"aria-describedby":p,"aria-expanded":m,"aria-controls":b,onMouseEnter:g,onMouseLeave:k,onKeyDown:x,onFocus:C,onBlur:v,onKeyPress:N},P,"loading"!==h&&"redirect"!==h&&this.props.children,t("span",{role:"status","aria-live":"polite",className:"adyen-checkout__button__text--sr-only"},L.get(this.buttonStatusSRLabel(h))))}constructor(...e){super(...e),i(this,"onClick",e=>{e.preventDefault(),this.props.disabled||this.props.onClick?.(e,{complete:this.complete})}),i(this,"complete",(e=1e3)=>{this.setState({completed:!0}),setTimeout(()=>{this.setState({completed:!1})},e)}),i(this,"buttonStatusSRLabel",e=>({loading:"loading",redirect:"payButton.redirecting"}[e]||""))}}i(r,"defaultProps",{status:"default",variant:"primary",disabled:!1,label:"",inline:!1,target:"_self"});export{r as default};
2
2
  //# sourceMappingURL=Button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sources":["../../../../../src/components/internal/Button/Button.tsx"],"sourcesContent":["import { Component, h, TargetedMouseEvent } from 'preact';\nimport classNames from 'classnames';\nimport Spinner from '../Spinner';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { ButtonProps, ButtonState } from './types';\nimport './Button.scss';\n\nclass Button extends Component<ButtonProps, ButtonState> {\n public static readonly defaultProps = {\n status: 'default',\n variant: 'primary',\n disabled: false,\n label: '',\n inline: false,\n target: '_self'\n };\n\n public onClick = (e: TargetedMouseEvent<HTMLButtonElement>) => {\n e.preventDefault();\n\n if (!this.props.disabled) {\n this.props.onClick?.(e, { complete: this.complete });\n }\n };\n\n public complete = (delay = 1_000) => {\n this.setState({ completed: true });\n setTimeout(() => {\n this.setState({ completed: false });\n }, delay);\n };\n\n private readonly buttonStatusSRLabel = (status: string): string => {\n const srLabels: Record<string, string> = {\n loading: 'loading',\n redirect: 'payButton.redirecting'\n };\n\n return srLabels[status] || '';\n };\n\n render() {\n const {\n classNameModifiers = [],\n disabled,\n href,\n icon,\n onClickCompletedIcon,\n inline,\n label,\n ariaLabel,\n ariaDescribedBy,\n status,\n variant,\n buttonRef,\n onClickCompletedLabel,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n onKeyDown,\n onKeyPress\n }: ButtonProps = this.props;\n const { completed } = this.state;\n const { i18n } = useCoreContext();\n\n const buttonIcon =\n onClickCompletedIcon || icon ? (\n <img\n className=\"adyen-checkout__button__icon\"\n src={this.state.completed ? (onClickCompletedIcon ?? icon) : icon}\n alt=\"\"\n aria-hidden=\"true\"\n />\n ) : (\n ''\n );\n\n const modifiers = [\n ...classNameModifiers,\n ...(variant === 'primary' ? [] : [variant]),\n ...(inline ? ['inline'] : []),\n ...(completed ? ['completed'] : []),\n ...(status === 'loading' || status === 'redirect' ? ['loading'] : [])\n ];\n\n const buttonClasses = classNames(['adyen-checkout__button', ...modifiers.map(m => `adyen-checkout__button--${m}`)]);\n\n const buttonStates = {\n loading: (\n <span aria-hidden=\"true\" className=\"adyen-checkout__button__content\">\n <Spinner size=\"medium\" inline />\n </span>\n ),\n redirect: (\n <span aria-hidden=\"true\" className=\"adyen-checkout__button__content\">\n <Spinner size=\"medium\" inline />\n {i18n.get('payButton.redirecting')}\n </span>\n ),\n default: (\n <span className=\"adyen-checkout__button__content\">\n {buttonIcon}\n <span className=\"adyen-checkout__button__text\">{this.state.completed ? (onClickCompletedLabel ?? label) : label}</span>\n </span>\n )\n };\n\n const buttonText = buttonStates[status] || buttonStates.default;\n\n if (href) {\n return (\n <a\n className={buttonClasses}\n href={href}\n target={this.props.target}\n rel={this.props.rel}\n aria-disabled={disabled}\n onClick={(e: TargetedMouseEvent<HTMLAnchorElement>) => {\n if (disabled) {\n e.preventDefault();\n }\n }}\n >\n {buttonText}\n </a>\n );\n }\n\n return (\n <button\n ref={buttonRef}\n className={buttonClasses}\n type=\"button\"\n disabled={disabled}\n onClick={this.onClick}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedBy}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onKeyDown={onKeyDown}\n onFocus={onFocus}\n onBlur={onBlur}\n onKeyPress={onKeyPress}\n >\n {buttonText}\n {status !== 'loading' && status !== 'redirect' && this.props.children}\n <span role=\"status\" aria-live=\"polite\" className=\"adyen-checkout__button__text--sr-only\">\n {i18n.get(this.buttonStatusSRLabel(status))}\n </span>\n </button>\n );\n }\n}\n\nexport default Button;\n"],"names":["Button","Component","render","classNameModifiers","disabled","href","icon","onClickCompletedIcon","inline","label","ariaLabel","ariaDescribedBy","status","variant","buttonRef","onClickCompletedLabel","onMouseEnter","onMouseLeave","onFocus","onBlur","onKeyDown","onKeyPress","this","props","completed","state","i18n","useCoreContext","buttonIcon","h","img","className","src","alt","aria-hidden","modifiers","buttonClasses","classNames","map","m","buttonStates","loading","span","Spinner","size","redirect","get","default","buttonText","a","target","rel","aria-disabled","onClick","e","preventDefault","button","ref","type","aria-label","aria-describedby","children","role","aria-live","buttonStatusSRLabel","super","args","_define_property","complete","delay","setState","setTimeout","defaultProps"],"mappings":"qWAOA,MAAMA,UAAeC,EAkCjBC,MAAAA,GACI,MAAMC,mBACFA,EAAqB,GAAEC,SACvBA,EAAQC,KACRA,EAAIC,KACJA,EAAIC,qBACJA,EAAoB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2B,SAAAA,CACGC,IAAK3C,EACLiB,UAAWK,EACXsB,KAAK,SACLtD,SAAUA,EACViD,QAAS/B,KAAK+B,QACdM,aAAYjD,EACZkD,mBAAkBjD,EAClBK,aAAcA,EACdC,aAAcA,EACdG,UAAWA,EACXF,QAASA,EACTC,OAAQA,EACRE,WAAYA,GAEX2B,EACW,YAAXpC,GAAmC,aAAXA,GAAyBU,KAAKC,MAAMsC,SAC7DhC,EAACa,OAAAA,CAAKoB,KAAK,SAASC,YAAU,SAAShC,UAAU,yCAC5CL,EAAKoB,IAAIxB,KAAK0C,oBAAoBpD,KAInD,mBAjJJqD,SAAAC,GAUIC,EAAA7C,KAAO+B,UAAWC,IACdA,EAAEC,iBAEGjC,KAAKC,MAAMnB,UACZkB,KAAKC,MAAM8B,UAAUC,EAAG,CAAEc,SAAU9C,KAAK8C,aAIjDD,EAAA7C,KAAO8C,WAAW,CAACC,EAAQ,OACvB/C,KAAKgD,SAAS,CAAE9C,WAAW,IAC3B+C,WAAW,KACPjD,KAAKgD,SAAS,CAAE9C,WAAW,KAC5B6C,KAGPF,EAAA7C,KAAiB0C,sBAAuBpD,IACK,CACrC6B,QAAS,UACTI,SAAU,yBAGEjC,IAAW,MA9B/BuD,EADEnE,EACqBwE,eAAe,CAClC5D,OAAQ,UACRC,QAAS,UACTT,UAAU,EACVK,MAAO,GACPD,QAAQ,EACR0C,OAAQ"}
1
+ {"version":3,"file":"Button.js","sources":["../../../../../src/components/internal/Button/Button.tsx"],"sourcesContent":["import { Component, h, TargetedMouseEvent } from 'preact';\nimport classNames from 'classnames';\nimport Spinner from '../Spinner';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { ButtonProps, ButtonState } from './types';\nimport './Button.scss';\n\nclass Button extends Component<ButtonProps, ButtonState> {\n public static readonly defaultProps = {\n status: 'default',\n variant: 'primary',\n disabled: false,\n label: '',\n inline: false,\n target: '_self'\n };\n\n public onClick = (e: TargetedMouseEvent<HTMLButtonElement>) => {\n e.preventDefault();\n\n if (!this.props.disabled) {\n this.props.onClick?.(e, { complete: this.complete });\n }\n };\n\n public complete = (delay = 1_000) => {\n this.setState({ completed: true });\n setTimeout(() => {\n this.setState({ completed: false });\n }, delay);\n };\n\n private readonly buttonStatusSRLabel = (status: string): string => {\n const srLabels: Record<string, string> = {\n loading: 'loading',\n redirect: 'payButton.redirecting'\n };\n\n return srLabels[status] || '';\n };\n\n render() {\n const {\n classNameModifiers = [],\n disabled,\n href,\n icon,\n onClickCompletedIcon,\n inline,\n label,\n ariaLabel,\n ariaDescribedBy,\n ariaExpanded,\n ariaControls,\n status,\n variant,\n buttonRef,\n onClickCompletedLabel,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n onKeyDown,\n onKeyPress\n }: ButtonProps = this.props;\n const { completed } = this.state;\n const { i18n } = useCoreContext();\n\n const buttonIcon =\n onClickCompletedIcon || icon ? (\n <img\n className=\"adyen-checkout__button__icon\"\n src={this.state.completed ? (onClickCompletedIcon ?? icon) : icon}\n alt=\"\"\n aria-hidden=\"true\"\n />\n ) : (\n ''\n );\n\n const modifiers = [\n ...classNameModifiers,\n ...(variant === 'primary' ? [] : [variant]),\n ...(inline ? ['inline'] : []),\n ...(completed ? ['completed'] : []),\n ...(status === 'loading' || status === 'redirect' ? ['loading'] : [])\n ];\n\n const buttonClasses = classNames(['adyen-checkout__button', ...modifiers.map(m => `adyen-checkout__button--${m}`)]);\n\n const buttonStates = {\n loading: (\n <span aria-hidden=\"true\" className=\"adyen-checkout__button__content\">\n <Spinner size=\"medium\" inline />\n </span>\n ),\n redirect: (\n <span aria-hidden=\"true\" className=\"adyen-checkout__button__content\">\n <Spinner size=\"medium\" inline />\n {i18n.get('payButton.redirecting')}\n </span>\n ),\n default: (\n <span className=\"adyen-checkout__button__content\">\n {buttonIcon}\n <span className=\"adyen-checkout__button__text\">{this.state.completed ? (onClickCompletedLabel ?? label) : label}</span>\n </span>\n )\n };\n\n const buttonText = buttonStates[status] || buttonStates.default;\n\n if (href) {\n return (\n <a\n className={buttonClasses}\n href={href}\n target={this.props.target}\n rel={this.props.rel}\n aria-disabled={disabled}\n onClick={(e: TargetedMouseEvent<HTMLAnchorElement>) => {\n if (disabled) {\n e.preventDefault();\n }\n }}\n >\n {buttonText}\n </a>\n );\n }\n\n return (\n <button\n ref={buttonRef}\n className={buttonClasses}\n type=\"button\"\n disabled={disabled}\n onClick={this.onClick}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedBy}\n aria-expanded={ariaExpanded}\n aria-controls={ariaControls}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onKeyDown={onKeyDown}\n onFocus={onFocus}\n onBlur={onBlur}\n onKeyPress={onKeyPress}\n >\n {buttonText}\n {status !== 'loading' && status !== 'redirect' && this.props.children}\n <span role=\"status\" aria-live=\"polite\" className=\"adyen-checkout__button__text--sr-only\">\n {i18n.get(this.buttonStatusSRLabel(status))}\n </span>\n </button>\n );\n }\n}\n\nexport default Button;\n"],"names":["Button","Component","render","classNameModifiers","disabled","href","icon","onClickCompletedIcon","inline","label","ariaLabel","ariaDescribedBy","ariaExpanded","ariaControls","status","variant","buttonRef","onClickCompletedLabel","onMouseEnter","onMouseLeave","onFocus","onBlur","onKeyDown","onKeyPress","this","props","completed","state","i18n","useCoreContext","buttonIcon","h","img","className","src","alt","aria-hidden","modifiers","buttonClasses","classNames","map","m","buttonStates","loading","span","Spinner","size","redirect","get","default","buttonText","a","target","rel","aria-disabled","onClick","e","preventDefault","button","ref","type","aria-label","aria-describedby","aria-expanded","aria-controls","children","role","aria-live","buttonStatusSRLabel","super","args","_define_property","complete","delay","setState","setTimeout","defaultProps"],"mappings":"qWAOA,MAAMA,UAAeC,EAkCjBC,MAAAA,GACI,MAAMC,mBACFA,EAAqB,GAAEC,SACvBA,EAAQC,KACRA,EAAIC,KACJA,EAAIC,qBACJA,EAAoBC,OACpBA,EAAMC,MACNA,EAAKC,UACLA,EAASC,gBACTA,EAAeC,aACfA,EAAYC,aACZ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AAK,SACLxD,SAAUA,EACVmD,QAAS/B,KAAK+B,QACdM,aAAYnD,EACZoD,mBAAkBnD,EAClBoD,gBAAenD,EACfoD,gBAAenD,EACfK,aAAcA,EACdC,aAAcA,EACdG,UAAWA,EACXF,QAASA,EACTC,OAAQA,EACRE,WAAYA,GAEX2B,EACW,YAAXpC,GAAmC,aAAXA,GAAyBU,KAAKC,MAAMwC,SAC7DlC,EAACa,OAAAA,CAAKsB,KAAK,SAASC,YAAU,SAASlC,UAAU,yCAC5CL,EAAKoB,IAAIxB,KAAK4C,oBAAoBtD,KAInD,mBArJJuD,SAAAC,GAUIC,EAAA/C,KAAO+B,UAAWC,IACdA,EAAEC,iBAEGjC,KAAKC,MAAMrB,UACZoB,KAAKC,MAAM8B,UAAUC,EAAG,CAAEgB,SAAUhD,KAAKgD,aAIjDD,EAAA/C,KAAOgD,WAAW,CAACC,EAAQ,OACvBjD,KAAKkD,SAAS,CAAEhD,WAAW,IAC3BiD,WAAW,KACPnD,KAAKkD,SAAS,CAAEhD,WAAW,KAC5B+C,KAGPF,EAAA/C,KAAiB4C,sBAAuBtD,IACK,CACrC6B,QAAS,UACTI,SAAU,yBAGEjC,IAAW,MA9B/ByD,EADEvE,EACqB4E,eAAe,CAClC9D,OAAQ,UACRC,QAAS,UACTX,UAAU,EACVK,MAAO,GACPD,QAAQ,EACR4C,OAAQ"}
@@ -1,2 +1,2 @@
1
- import e from"../../../_virtual/index.js";import{createElement as t}from"../../../external/preact/dist/preact.js";function a({buttonId:a,showRadioButton:d,isSelected:n,expandContentId:o,children:_,classNameModifiers:c=[],standalone:r=!1}){return r?t("div",{className:e("adyen-checkout__payment-method__header__title","adyen-checkout__payment-method__header__title--standalone")},_):t("button",{className:e("adyen-checkout__payment-method__header__title",...c.map(e=>`adyen-checkout-expand-button--${e}`)),id:a,role:"radio","aria-checked":n,"aria-controls":o,type:"button"},d&&t("span",{className:e({"adyen-checkout__payment-method__radio":!0,"adyen-checkout__payment-method__radio--selected":n}),"aria-hidden":"true"}),_)}export{a as default};
1
+ import{createElement as e}from"../../../external/preact/dist/preact.js";import t from"../../../_virtual/index.js";function a({buttonId:a,showRadioButton:d,isSelected:n,expandContentId:o,children:c,classNameModifiers:_=[],standalone:r=!1,className:i}){return r?e("div",{className:t("adyen-checkout__payment-method__header__title","adyen-checkout__payment-method__header__title--standalone",i)},c):e("button",{className:t("adyen-checkout__payment-method__header__title",..._.map(e=>`adyen-checkout-expand-button--${e}`),i),id:a,role:"radio","aria-checked":n,"aria-controls":o,type:"button"},d&&e("span",{className:t({"adyen-checkout__payment-method__radio":!0,"adyen-checkout__payment-method__radio--selected":n}),"aria-hidden":"true"}),c)}export{a as default};
2
2
  //# sourceMappingURL=ExpandButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpandButton.js","sources":["../../../../../src/components/internal/ExpandButton/ExpandButton.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport { ComponentChildren, h } from 'preact';\nimport './ExpandButton.scss';\n\ninterface ExpandButton {\n buttonId: string;\n isSelected: boolean;\n expandContentId: string;\n children?: ComponentChildren;\n showRadioButton?: boolean;\n classNameModifiers?: string[];\n standalone?: boolean;\n}\n\nfunction ExpandButton({\n buttonId,\n showRadioButton,\n isSelected,\n expandContentId,\n children,\n classNameModifiers = [],\n standalone = false\n}: Readonly<ExpandButton>) {\n // If we only have a single payment method we should use a div instead of toggable button\n if (standalone) {\n return (\n <div className={classNames('adyen-checkout__payment-method__header__title', 'adyen-checkout__payment-method__header__title--standalone')}>\n {children}\n </div>\n );\n }\n\n return (\n // See discussion: https://github.com/w3c/aria/issues/1404\n // this has been disabled as we got quite a few complains\n // mainly from merchants running automated systems\n <button\n className={classNames(\n 'adyen-checkout__payment-method__header__title',\n ...classNameModifiers.map(modifier => `adyen-checkout-expand-button--${modifier}`)\n )}\n id={buttonId}\n role={'radio'}\n aria-checked={isSelected}\n //aria-expanded={isSelected} - disabled for now\n aria-controls={expandContentId}\n type=\"button\"\n >\n {showRadioButton && (\n <span\n className={classNames({\n 'adyen-checkout__payment-method__radio': true,\n 'adyen-checkout__payment-method__radio--selected': isSelected\n })}\n aria-hidden=\"true\"\n />\n )}\n {children}\n </button>\n );\n}\n\nexport default ExpandButton;\n"],"names":["ExpandButton","buttonId","showRadioButton","isSelected","expandContentId","children","classNameModifiers","standalone","h","div","className","classNames","button","map","modifier","id","role","aria-checked","aria-controls","type","span","aria-hidden"],"mappings":"kHAcA,SAASA,GAAaC,SAClBA,EAAQC,gBACRA,EAAeC,WACfA,EAAUC,gBACVA,EAAeC,SACfA,EAAQC,mBACRA,EAAqB,GAAEC,WACvBA,GAAa,IAGb,OAAIA,EAEIC,EAACC,MAAAA,CAAIC,UAAWC,EAAW,gDAAiD,8DACvEN,GASTG,EAACI,SAAAA,CACGF,UAAWC,EACP,mDACGL,EAAmBO,IAAIC,GAAY,iCAAiCA,MAE3EC,GAAId,EACJe,KAAM,QACNC,eAAcd,EAEde,gBAAed,EACfe,KAAK,UAEJjB,GACGM,EAACY,OAAAA,CACGV,UAAWC,EAAW,CAClB,yCAAyC,EACzC,kDAAmDR,IAEvDkB,cAAY,SAGnBhB,EAGb"}
1
+ {"version":3,"file":"ExpandButton.js","sources":["../../../../../src/components/internal/ExpandButton/ExpandButton.tsx"],"sourcesContent":["import { ComponentChildren, h } from 'preact';\nimport classNames from 'classnames';\n\nimport './ExpandButton.scss';\n\ninterface ExpandButton {\n buttonId: string;\n isSelected: boolean;\n expandContentId: string;\n children?: ComponentChildren;\n showRadioButton?: boolean;\n classNameModifiers?: string[];\n standalone?: boolean;\n className?: string;\n}\n\nfunction ExpandButton({\n buttonId,\n showRadioButton,\n isSelected,\n expandContentId,\n children,\n classNameModifiers = [],\n standalone = false,\n className\n}: Readonly<ExpandButton>) {\n // If we only have a single payment method we should use a div instead of toggable button\n if (standalone) {\n return (\n <div\n className={classNames(\n 'adyen-checkout__payment-method__header__title',\n 'adyen-checkout__payment-method__header__title--standalone',\n className\n )}\n >\n {children}\n </div>\n );\n }\n\n return (\n // See discussion: https://github.com/w3c/aria/issues/1404\n // this has been disabled as we got quite a few complains\n // mainly from merchants running automated systems\n <button\n className={classNames(\n 'adyen-checkout__payment-method__header__title',\n ...classNameModifiers.map(modifier => `adyen-checkout-expand-button--${modifier}`),\n className\n )}\n id={buttonId}\n role={'radio'}\n aria-checked={isSelected}\n //aria-expanded={isSelected} - disabled for now\n aria-controls={expandContentId}\n type=\"button\"\n >\n {showRadioButton && (\n <span\n className={classNames({\n 'adyen-checkout__payment-method__radio': true,\n 'adyen-checkout__payment-method__radio--selected': isSelected\n })}\n aria-hidden=\"true\"\n />\n )}\n {children}\n </button>\n );\n}\n\nexport default ExpandButton;\n"],"names":["ExpandButton","buttonId","showRadioButton","isSelected","expandContentId","children","classNameModifiers","standalone","className","h","div","classNames","button","map","modifier","id","role","aria-checked","aria-controls","type","span","aria-hidden"],"mappings":"kHAgBA,SAASA,GAAaC,SAClBA,EAAQC,gBACRA,EAAeC,WACfA,EAAUC,gBACVA,EAAeC,SACfA,EAAQC,mBACRA,EAAqB,GAAEC,WACvBA,GAAa,EAAKC,UAClBA,IAGA,OAAID,EAEIE,EAACC,MAAAA,CACGF,UAAWG,EACP,gDACA,4DACAH,IAGHH,GASTI,EAACG,SAAAA,CACGJ,UAAWG,EACP,mDACGL,EAAmBO,IAAIC,GAAY,iCAAiCA,KACvEN,GAEJO,GAAId,EACJe,KAAM,QACNC,eAAcd,EAEde,gBAAed,EACfe,KAAK,UAEJjB,GACGO,EAACW,OAAAA,CACGZ,UAAWG,EAAW,CAClB,yCAAyC,EACzC,kDAAmDR,IAEvDkB,cAAY,SAGnBhB,EAGb"}
@@ -1,2 +1,2 @@
1
- const e=()=>{const e=document.createElement("input");return e.setAttribute("type","date"),"date"===e.type},t=e=>{const t=e.replace(/\D|\s/g,"").replace(/^(00)(.*)?/,"01$2").replace(/^(3[2-9])(.*)?/,"0$1$2").replace(/^([4-9])(.*)?/,"0$1").replace(/^([0-9]{2})(00)(.*)?/,"$101").replace(/^(3[01])(02)(.*)?/,"29$2").replace(/^([0-9]{2})([2-9]|1[3-9])(.*)?/,"$10$2").replace(/^([0-9]{2})([0-9]{2})([0-9])/,"$1/$2/$3").replace(/^([0-9]{2})([0-9])/,"$1/$2"),[r="",c="",l=""]=t.split("/");return 4===l.length&&"29"===r&&"02"===c&&(Number(l)%4!=0||"00"===l.substr(2,2)&&Number(l)%400!=0)?t.replace(/^29/,"28"):t},r=(e="")=>{if(-1===e.indexOf("/"))return e;const[t="",r="",c=""]=e.split("/");return t&&r&&c?`${c}-${r}-${t}`:null};export{e as checkDateInputSupport,t as formatDate,r as unformatDate};
1
+ const e=()=>{const e=document.createElement("input");return e.setAttribute("type","date"),"date"===e.type},t=e=>{const t=e.replace(/\D|\s/g,"").replace(/^(00)(.*)?/,"01$2").replace(/^(3[2-9])(.*)?/,"0$1$2").replace(/^([4-9])(.*)?/,"0$1").replace(/^([0-9]{2})(00)(.*)?/,"$101").replace(/^(3[01])(02)(.*)?/,"29$2").replace(/^([0-9]{2})([2-9]|1[3-9])(.*)?/,"$10$2").replace(/^([0-9]{2})([0-9]{2})([0-9])/,"$1/$2/$3").replace(/^([0-9]{2})([0-9])/,"$1/$2"),[r="",c="",l=""]=t.split("/");return 4===l.length&&"29"===r&&"02"===c&&(Number(l)%4!=0||"00"===l.substr(2,2)&&Number(l)%400!=0)?t.replace(/^29/,"28"):t},r=(e="")=>{if(!e.includes("/"))return e;const[t="",r="",c=""]=e.split("/");return t&&r&&c?`${c}-${r}-${t}`:null};export{e as checkDateInputSupport,t as formatDate,r as unformatDate};
2
2
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../../../src/components/internal/FormFields/InputDate/utils.ts"],"sourcesContent":["/**\n * Returns either the date input is supported or not in the current browser\n */\nconst checkDateInputSupport = (): boolean => {\n const input = document.createElement('input');\n input.setAttribute('type', 'date');\n return input.type === 'date';\n};\n\n/**\n * Returns a formatted date\n * @param value -\n * @example\n * formatDate('22111990');\n * // '22/11/1990'\n */\nconst formatDate = (value: string): string => {\n const date = value\n .replace(/\\D|\\s/g, '') // Digits only\n .replace(/^(00)(.*)?/, '01$2') // 00 -> 01\n .replace(/^(3[2-9])(.*)?/, '0$1$2') // 34 -> 03/04\n .replace(/^([4-9])(.*)?/, '0$1') // 4 -> 04\n .replace(/^([0-9]{2})(00)(.*)?/, '$101') // 01/00 -> 01/01\n .replace(/^(3[01])(02)(.*)?/, '29$2') // Force up to day 29 for Feb\n .replace(/^([0-9]{2})([2-9]|1[3-9])(.*)?/, '$10$2') // 01/4 -> 01/04\n .replace(/^([0-9]{2})([0-9]{2})([0-9])/, '$1/$2/$3') // 22111990 -> 22/11/1990\n .replace(/^([0-9]{2})([0-9])/, '$1/$2'); // 2211 -> 22/11\n\n const [day = '', month = '', year = ''] = date.split('/');\n\n // Check leap year\n if (year.length === 4 && day === '29' && month === '02' && (Number(year) % 4 !== 0 || (year.substr(2, 2) === '00' && Number(year) % 400 !== 0))) {\n return date.replace(/^29/, '28');\n }\n\n return date;\n};\n\n/**\n * Receives a formatted date and returns it as the API expects it\n * @param value -\n * @example\n * unformatDate('22/11/1990');\n * // '1990-11-22'\n */\nconst unformatDate = (value = ''): string => {\n if (value.indexOf('/') === -1) return value;\n const [day = '', month = '', year = ''] = value.split('/');\n if (!day || !month || !year) return null;\n return `${year}-${month}-${day}`;\n};\n\nexport { checkDateInputSupport, formatDate, unformatDate };\n"],"names":["checkDateInputSupport","input","document","createElement","setAttribute","type","formatDate","value","date","replace","day","month","year","split","length","Number","substr","unformatDate","indexOf"],"mappings":"MAGMA,EAAwB,KAC1B,MAAMC,EAAQC,SAASC,cAAc,SAErC,OADAF,EAAMG,aAAa,OAAQ,QACL,SAAfH,EAAMI,MAUXC,EAAcC,IAChB,MAAMC,EAAOD,EACRE,QAAQ,SAAU,IAClBA,QAAQ,aAAc,QACtBA,QAAQ,iBAAkB,SAC1BA,QAAQ,gBAAiB,OACzBA,QAAQ,uBAAwB,QAChCA,QAAQ,oBAAqB,QAC7BA,QAAQ,iCAAkC,SAC1CA,QAAQ,+BAAgC,YACxCA,QAAQ,qBAAsB,UAE5BC,EAAM,GAAIC,EAAQ,GAAIC,EAAO,IAAMJ,EAAKK,MAAM,KAGrD,OAAoB,IAAhBD,EAAKE,QAAwB,OAARJ,GAA0B,OAAVC,IAAmBI,OAAOH,GAAQ,GAAM,GAA4B,OAAtBA,EAAKI,OAAO,EAAG,IAAeD,OAAOH,GAAQ,KAAQ,GACjIJ,EAAKC,QAAQ,MAAO,MAGxBD,GAULS,EAAe,CAACV,EAAQ,MAC1B,IAA2B,IAAvBA,EAAMW,QAAQ,KAAa,OAAOX,EACtC,MAAOG,EAAM,GAAIC,EAAQ,GAAIC,EAAO,IAAML,EAAMM,MAAM,KACtD,OAAKH,GAAQC,GAAUC,EAChB,GAAGA,KAAQD,KAASD,IADS"}
1
+ {"version":3,"file":"utils.js","sources":["../../../../../../src/components/internal/FormFields/InputDate/utils.ts"],"sourcesContent":["/**\n * Returns either the date input is supported or not in the current browser\n */\nconst checkDateInputSupport = (): boolean => {\n const input = document.createElement('input');\n input.setAttribute('type', 'date');\n return input.type === 'date';\n};\n\n/**\n * Returns a formatted date\n * @param value -\n * @example\n * formatDate('22111990');\n * // '22/11/1990'\n */\nconst formatDate = (value: string): string => {\n const date = value\n .replace(/\\D|\\s/g, '') // Digits only\n .replace(/^(00)(.*)?/, '01$2') // 00 -> 01\n .replace(/^(3[2-9])(.*)?/, '0$1$2') // 34 -> 03/04\n .replace(/^([4-9])(.*)?/, '0$1') // 4 -> 04\n .replace(/^([0-9]{2})(00)(.*)?/, '$101') // 01/00 -> 01/01\n .replace(/^(3[01])(02)(.*)?/, '29$2') // Force up to day 29 for Feb\n .replace(/^([0-9]{2})([2-9]|1[3-9])(.*)?/, '$10$2') // 01/4 -> 01/04\n .replace(/^([0-9]{2})([0-9]{2})([0-9])/, '$1/$2/$3') // 22111990 -> 22/11/1990\n .replace(/^([0-9]{2})([0-9])/, '$1/$2'); // 2211 -> 22/11\n\n const [day = '', month = '', year = ''] = date.split('/');\n\n // Check leap year\n if (year.length === 4 && day === '29' && month === '02' && (Number(year) % 4 !== 0 || (year.substr(2, 2) === '00' && Number(year) % 400 !== 0))) {\n return date.replace(/^29/, '28');\n }\n\n return date;\n};\n\n/**\n * Receives a formatted date and returns it as the API expects it\n * @param value -\n * @example\n * unformatDate('22/11/1990');\n * // '1990-11-22'\n */\nconst unformatDate = (value = ''): string => {\n if (!value.includes('/')) return value;\n const [day = '', month = '', year = ''] = value.split('/');\n if (!day || !month || !year) return null;\n return `${year}-${month}-${day}`;\n};\n\nexport { checkDateInputSupport, formatDate, unformatDate };\n"],"names":["checkDateInputSupport","input","document","createElement","setAttribute","type","formatDate","value","date","replace","day","month","year","split","length","Number","substr","unformatDate","includes"],"mappings":"MAGMA,EAAwB,KAC1B,MAAMC,EAAQC,SAASC,cAAc,SAErC,OADAF,EAAMG,aAAa,OAAQ,QACL,SAAfH,EAAMI,MAUXC,EAAcC,IAChB,MAAMC,EAAOD,EACRE,QAAQ,SAAU,IAClBA,QAAQ,aAAc,QACtBA,QAAQ,iBAAkB,SAC1BA,QAAQ,gBAAiB,OACzBA,QAAQ,uBAAwB,QAChCA,QAAQ,oBAAqB,QAC7BA,QAAQ,iCAAkC,SAC1CA,QAAQ,+BAAgC,YACxCA,QAAQ,qBAAsB,UAE5BC,EAAM,GAAIC,EAAQ,GAAIC,EAAO,IAAMJ,EAAKK,MAAM,KAGrD,OAAoB,IAAhBD,EAAKE,QAAwB,OAARJ,GAA0B,OAAVC,IAAmBI,OAAOH,GAAQ,GAAM,GAA4B,OAAtBA,EAAKI,OAAO,EAAG,IAAeD,OAAOH,GAAQ,KAAQ,GACjIJ,EAAKC,QAAQ,MAAO,MAGxBD,GAULS,EAAe,CAACV,EAAQ,MAC1B,IAAKA,EAAMW,SAAS,KAAM,OAAOX,EACjC,MAAOG,EAAM,GAAIC,EAAQ,GAAIC,EAAO,IAAML,EAAMM,MAAM,KACtD,OAAKH,GAAQC,GAAUC,EAChB,GAAGA,KAAQD,KAASD,IADS"}
@@ -1 +1 @@
1
- {"version":3,"file":"RedirectButton.js","sources":["../../../../../src/components/internal/RedirectButton/RedirectButton.tsx"],"sourcesContent":["import { h, Fragment } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { useState } from 'preact/hooks';\nimport { useAmount } from '../../../core/Context/AmountProvider';\n\n// TODO this should ideally be remove but we need let prop propagate down\n// probably not worth changing this behaviour now\nexport interface RedirectButtonProps {\n label?: string;\n icon?: string;\n payButton: Function;\n onSubmit: Function;\n name: string;\n showPayButton: boolean;\n ref?: any;\n}\n\nfunction RedirectButton({ label = null, icon = null, payButton, onSubmit, name, showPayButton, ...props }: Readonly<RedirectButtonProps>) {\n const { i18n } = useCoreContext();\n const [status, setStatus] = useState('ready');\n const { amount } = useAmount();\n\n this.setStatus = newStatus => {\n setStatus(newStatus);\n };\n\n const payButtonLabel = () => {\n const isZeroAuth = amount && {}.hasOwnProperty.call(amount, 'value') && amount.value === 0;\n if (isZeroAuth) return `${i18n.get('preauthorizeWith')} ${name}`;\n return `${i18n.get('continueTo')} ${name}`;\n };\n\n if (!showPayButton) {\n return;\n }\n\n return (\n <Fragment>\n {payButton({\n ...props,\n status,\n icon,\n classNameModifiers: ['standalone'],\n label: label || payButtonLabel(),\n onClick: onSubmit\n })}\n </Fragment>\n );\n}\n\nexport default RedirectButton;\n"],"names":["RedirectButton","label","icon","payButton","onSubmit","name","showPayButton","props","i18n","useCoreContext","status","setStatus","useState","amount","useAmount","this","newStatus","h","Fragment","classNameModifiers","hasOwnProperty","call","value","get","onClick"],"mappings":"ySAiBA,SAASA,GAAeC,MAAEA,EAAQ,KAAIC,KAAEA,EAAO,KAAIC,UAAEA,EAASC,SAAEA,EAAQC,KAAEA,EAAIC,cAAEA,KAAkBC,IAC9F,MAAMC,KAAEA,GAASC,KACVC,EAAQC,GAAaC,EAAS,UAC/BC,OAAEA,GAAWC,IAEnBC,KAAKJ,UAAYK,IACbL,EAAUK,IASd,GAAKV,EAIL,OACIW,EAACC,OACIf,EAAU,IACJI,EACHG,SACAR,OACAiB,mBAAoB,CAAC,cACrBlB,MAAOA,IAhBIY,GAAU,CAAC,EAAEO,eAAeC,KAAKR,EAAQ,UAA6B,IAAjBA,EAAOS,MACxD,GAAGd,EAAKe,IAAI,uBAAuBlB,IACnD,GAAGG,EAAKe,IAAI,iBAAiBlB,KAe5BmB,QAASpB,IAIzB"}
1
+ {"version":3,"file":"RedirectButton.js","sources":["../../../../../src/components/internal/RedirectButton/RedirectButton.tsx"],"sourcesContent":["import { h, Fragment, Ref } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { useState } from 'preact/hooks';\nimport { useAmount } from '../../../core/Context/AmountProvider';\n\n// TODO this should ideally be remove but we need let prop propagate down\n// probably not worth changing this behaviour now\nexport interface RedirectButtonProps {\n label?: string;\n icon?: string;\n payButton: Function;\n onSubmit: Function;\n name: string;\n showPayButton: boolean;\n ref?: Ref<typeof RedirectButton>;\n}\n\nfunction RedirectButton({ label = null, icon = null, payButton, onSubmit, name, showPayButton, ...props }: Readonly<RedirectButtonProps>) {\n const { i18n } = useCoreContext();\n const [status, setStatus] = useState('ready');\n const { amount } = useAmount();\n\n this.setStatus = newStatus => {\n setStatus(newStatus);\n };\n\n const payButtonLabel = () => {\n const isZeroAuth = amount && {}.hasOwnProperty.call(amount, 'value') && amount.value === 0;\n if (isZeroAuth) return `${i18n.get('preauthorizeWith')} ${name}`;\n return `${i18n.get('continueTo')} ${name}`;\n };\n\n if (!showPayButton) {\n return;\n }\n\n return (\n <Fragment>\n {payButton({\n ...props,\n status,\n icon,\n classNameModifiers: ['standalone'],\n label: label || payButtonLabel(),\n onClick: onSubmit\n })}\n </Fragment>\n );\n}\n\nexport default RedirectButton;\n"],"names":["RedirectButton","label","icon","payButton","onSubmit","name","showPayButton","props","i18n","useCoreContext","status","setStatus","useState","amount","useAmount","this","newStatus","h","Fragment","classNameModifiers","hasOwnProperty","call","value","get","onClick"],"mappings":"ySAiBA,SAASA,GAAeC,MAAEA,EAAQ,KAAIC,KAAEA,EAAO,KAAIC,UAAEA,EAASC,SAAEA,EAAQC,KAAEA,EAAIC,cAAEA,KAAkBC,IAC9F,MAAMC,KAAEA,GAASC,KACVC,EAAQC,GAAaC,EAAS,UAC/BC,OAAEA,GAAWC,IAEnBC,KAAKJ,UAAYK,IACbL,EAAUK,IASd,GAAKV,EAIL,OACIW,EAACC,OACIf,EAAU,IACJI,EACHG,SACAR,OACAiB,mBAAoB,CAAC,cACrBlB,MAAOA,IAhBIY,GAAU,CAAC,EAAEO,eAAeC,KAAKR,EAAQ,UAA6B,IAAjBA,EAAOS,MACxD,GAAGd,EAAKe,IAAI,uBAAuBlB,IACnD,GAAGG,EAAKe,IAAI,iBAAiBlB,KAe5BmB,QAASpB,IAIzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"SecuredFieldsProvider.js","sources":["../../../../../../src/components/internal/SecuredFields/SFP/SecuredFieldsProvider.ts"],"sourcesContent":["import { Component } from 'preact';\nimport { getErrorObject, getFields, getErrorReducer, validFieldsReducer } from './SFPUtils';\nimport initCSF from '../lib/CSF';\nimport handlers from './SecuredFieldsProviderHandlers';\nimport defaultProps from './defaultProps';\nimport { SFPProps, SFPState, SingleBrandResetObject } from './types';\nimport {\n StylesObject,\n CardErrorData,\n CardFocusData,\n CardBrandData,\n CardAllValidData,\n CardFieldValidData,\n CardAutoCompleteData,\n CardConfigSuccessData,\n CardLoadData,\n SFKeyPressObj\n} from '../lib/types';\nimport { CSFReturnObject, CSFSetupObject } from '../lib/CSF/types';\nimport { CVC_POLICY_REQUIRED, DATE_POLICY_REQUIRED, DEDICATED_CARD_COMPONENTS, ENCRYPTED_CARD_NUMBER, ENCRYPTED_PWD_FIELD } from '../lib/constants';\nimport { BinLookupResponse } from '../../../Card/types';\nimport AdyenCheckoutError from '../../../../core/Errors/AdyenCheckoutError';\nimport { SFStateErrorObj } from '../../../Card/components/CardInput/types';\nimport { getErrorMessageFromCode } from '../../../../core/Errors/utils';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\nimport { TxVariants } from '../../../tx-variants';\n\n/**\n * SecuredFieldsProvider:\n * Initialises & handles the client-side part of SecuredFields\n */\nclass SecuredFieldsProvider extends Component<SFPProps, SFPState> {\n private csfLoadFailTimeout: number;\n private csfLoadFailTimeoutMS: number;\n private csfConfigFailTimeout: number;\n private csfConfigFailTimeoutMS: number;\n private numCharsInField: object;\n private rootNode;\n private numDateFields: number;\n private csf: CSFReturnObject;\n private handleOnLoad: (obj: CardLoadData) => void;\n private handleOnConfigSuccess: (obj: CardConfigSuccessData) => void;\n private handleOnFieldValid: (obj: CardFieldValidData) => void;\n private handleOnAllValid: (obj: CardAllValidData) => void;\n private handleOnBrand: (obj: CardBrandData) => void;\n private handleFocus: (obj: CardFocusData) => void;\n private handleOnError: (obj: CardErrorData, hasUnsupportedCard?: boolean) => void;\n private handleOnAutoComplete: (obj: CardAutoCompleteData) => void;\n private handleOnNoDataRequired: () => void;\n private handleOnTouchstartIOS: (obj) => void;\n private handleKeyPressed: (obj: SFKeyPressObj) => void;\n public state: SFPState;\n public props;\n private issuingCountryCode;\n\n constructor(props: SFPProps) {\n super(props);\n\n const stateObj: SFPState = {\n status: 'loading',\n brand: props.type,\n errors: {},\n valid: {},\n data: {},\n cvcPolicy: CVC_POLICY_REQUIRED,\n expiryDatePolicy: DATE_POLICY_REQUIRED,\n isSfpValid: false,\n hasKoreanFields: props.hasKoreanFields\n };\n this.state = stateObj;\n\n this.csfLoadFailTimeout = null;\n this.csfLoadFailTimeoutMS = 30000;\n\n this.csfConfigFailTimeout = null;\n this.csfConfigFailTimeoutMS = 15000;\n\n this.numCharsInField = {};\n\n // Handlers\n this.handleOnLoad = handlers.handleOnLoad.bind(this);\n this.handleOnConfigSuccess = handlers.handleOnConfigSuccess.bind(this);\n this.handleOnFieldValid = handlers.handleOnFieldValid.bind(this);\n this.handleOnAllValid = handlers.handleOnAllValid.bind(this);\n this.handleOnBrand = handlers.handleOnBrand.bind(this);\n this.handleFocus = handlers.handleFocus.bind(this);\n this.handleOnError = handlers.handleOnError.bind(this);\n this.handleOnNoDataRequired = handlers.handleOnNoDataRequired.bind(this);\n this.handleOnAutoComplete = handlers.handleOnAutoComplete.bind(this);\n this.handleOnTouchstartIOS = handlers.handleOnTouchstartIOS.bind(this); // Only called when iOS detected\n this.handleKeyPressed = handlers.handleKeyPressed.bind(this);\n\n this.processBinLookupResponse = this.processBinLookupResponse.bind(this);\n\n // Bindings for functions exposed to users of this component: SecuredFields & CardInput\n this.setFocusOn = this.setFocusOn.bind(this);\n this.updateStyles = this.updateStyles.bind(this);\n this.handleUnsupportedCard = this.handleUnsupportedCard.bind(this);\n this.showValidation = this.showValidation.bind(this);\n this.destroy = this.destroy.bind(this);\n }\n\n public static readonly defaultProps = defaultProps;\n\n public componentDidMount(): void {\n // When SFP instantiated through SecuredFieldsInput c.f. CardInput\n if (this.props.rootNode) {\n this.setRootNode(this.props.rootNode);\n }\n\n // Find encryptedFields and map them to the values we use to store valid states\n const fields = getFields(this.rootNode);\n const valid = fields.reduce(validFieldsReducer, {});\n\n this.setState({ valid });\n\n // Populate numCharsInField object\n fields.forEach(field => {\n this.numCharsInField[field] = 0;\n });\n\n // Store how many dateFields we are dealing with visually\n this.numDateFields = fields.filter(f => f.match(/Expiry/)).length;\n\n if (fields.length) {\n this.destroy();\n this.initializeCSF(this.rootNode);\n } else {\n if (this.props.componentType === TxVariants.customCard) {\n console.debug(\n 'You are trying to create a CustomCard component but the element into which you are trying to mount the CustomCard component does not contain any elements with a \"data-cse\" attribute e.g. <div data-cse=\"encryptedCardNumber\"></div>'\n );\n }\n this.handleOnNoDataRequired();\n }\n }\n\n public componentDidUpdate() {\n this.checkForKCPFields();\n // Pass all the state data up - Used right now for loading status\n this.props.onStateUpdate?.(this.state);\n }\n\n public componentWillUnmount(): void {\n this.csf = null;\n clearTimeout(this.csfLoadFailTimeout);\n clearTimeout(this.csfConfigFailTimeout);\n }\n\n private initializeCSF(root: HTMLElement): void {\n let loadingContext = this.props.loadingContext;\n\n // For loading securedFields from local server during development\n if (process.env.NODE_ENV === 'development' && process.env.__SF_ENV__ !== 'build') {\n loadingContext = process.env.__SF_ENV__;\n }\n\n const csfSetupObj: CSFSetupObject = {\n rootNode: root,\n type: this.props.type,\n componentType: this.props.componentType,\n clientKey: this.props.clientKey,\n cardGroupTypes: this.props.brands,\n autoFocus: this.props.autoFocus,\n trimTrailingSeparator: this.props.trimTrailingSeparator,\n loadingContext,\n keypadFix: this.props.keypadFix,\n showWarnings: this.props.showWarnings,\n iframeUIConfig: {\n sfStyles: this.props.styles\n },\n i18n: this.props.i18n,\n onSubmitAnalytics: this.props.onSubmitAnalytics,\n callbacks: {\n onLoad: this.handleOnLoad,\n onConfigSuccess: this.handleOnConfigSuccess,\n onFieldValid: this.handleOnFieldValid,\n onAllValid: this.handleOnAllValid,\n onBrand: this.handleOnBrand,\n onError: this.handleOnError,\n onFocus: this.handleFocus,\n onBinValue: this.props.onBinValue,\n onAutoComplete: this.handleOnAutoComplete,\n onAdditionalSFConfig: this.props.onAdditionalSFConfig,\n onAdditionalSFRemoved: this.props.onAdditionalSFRemoved,\n onTouchstartIOS: this.handleOnTouchstartIOS,\n onKeyPressed: this.handleKeyPressed\n },\n isKCP: this.state.hasKoreanFields,\n legacyInputMode: this.props.legacyInputMode,\n minimumExpiryDate: this.props.minimumExpiryDate,\n implementationType: this.props.implementationType || 'components', // to distinguish between 'regular' and 'custom' card component\n forceCompat: this.props.forceCompat,\n maskSecurityCode: this.props.maskSecurityCode,\n exposeExpiryDate: this.props.exposeExpiryDate,\n shouldDisableIOSArrowKeys: !!this.props.disableIOSArrowKeys, // convert whether function has been defined into a boolean\n placeholders: this.props.placeholders ?? {},\n showContextualElement: this.props.showContextualElement\n };\n\n this.csf = initCSF(csfSetupObj);\n\n /**\n * Expect to at least have had the handleOnLoad callback called within this time\n * - if this hasn't happened then something has happened to interrupt the loading of the securedFields\n * So we need to clear the loading spinner to see if the securedFields are reporting anything\n */\n // @ts-ignore - timout 'type' is a number\n this.csfLoadFailTimeout = setTimeout(() => {\n if (this.state.status !== 'ready') {\n // Hide the spinner\n this.setState({ status: 'csfLoadFailure' });\n // Report the error\n this.props.onError(new AdyenCheckoutError('ERROR', 'secured field iframes have failed to load'));\n }\n }, this.csfLoadFailTimeoutMS);\n }\n\n private checkForKCPFields() {\n let needsKoreanFields = false;\n if (this.props.koreanAuthenticationRequired) {\n needsKoreanFields = this.issuingCountryCode ? this.issuingCountryCode === 'kr' : this.props.countryCode === 'kr';\n }\n\n // Was korean, now isn't - hide password field\n if (this.state.hasKoreanFields && !needsKoreanFields) {\n // Clear any stored data\n const setRemovedFieldState = prevState => ({\n data: { ...prevState.data, [ENCRYPTED_PWD_FIELD]: undefined },\n valid: { ...prevState.valid, [ENCRYPTED_PWD_FIELD]: false },\n errors: { ...prevState.errors, [ENCRYPTED_PWD_FIELD]: null },\n hasKoreanFields: false\n });\n\n this.setState(setRemovedFieldState, () => {\n this.props.onChange(this.state);\n });\n\n this.csf.removeSecuredField(ENCRYPTED_PWD_FIELD);\n this.csf.setKCPStatus(false);\n }\n\n // Wasn't korean, now is - show password field\n if (!this.state.hasKoreanFields && needsKoreanFields) {\n const setAddedFieldState = prevState => ({\n valid: { ...prevState.valid, [ENCRYPTED_PWD_FIELD]: false },\n hasKoreanFields: true,\n isSfpValid: false\n });\n\n this.setState(setAddedFieldState, () => {\n this.props.onChange(this.state);\n });\n\n this.csf.addSecuredField(ENCRYPTED_PWD_FIELD);\n this.csf.setKCPStatus(true);\n }\n }\n\n public getChildContext(): object {\n return { i18n: this.props.i18n };\n }\n\n public handleUnsupportedCard(errObj: CardErrorData): boolean {\n const hasUnsupportedCard = !!errObj.error;\n\n // Store the brand(s) we detected and which we don't support\n if (hasUnsupportedCard) {\n this.setState({ detectedUnsupportedBrands: errObj.detectedBrands });\n }\n\n errObj.rootNode = this.rootNode; // Needed for CustomCard\n this.handleOnError(errObj, hasUnsupportedCard);\n // Inform CSF that the number field has an unsupportedCard error (or that it has been cleared)\n if (this.csf) {\n this.csf.hasUnsupportedCard(ENCRYPTED_CARD_NUMBER, errObj.error);\n }\n return hasUnsupportedCard;\n }\n\n public setFocusOn(frame: string): void {\n if (this.csf) this.csf.setFocusOnFrame(frame);\n }\n\n public updateStyles(stylesObj: StylesObject): void {\n if (this.csf) this.csf.updateStyles(stylesObj);\n }\n\n public sfIsOptionalOrHidden(fieldType: string): boolean {\n return this.csf.sfIsOptionalOrHidden(fieldType);\n }\n\n public destroy(): void {\n if (this.csf) this.csf.destroy();\n }\n\n public getRootNode(): HTMLElement {\n return this.rootNode;\n }\n\n public showValidation(): void {\n const { numDateFields, state }: SecuredFieldsProvider = this;\n\n Object.keys(state.valid)\n .reduce(getErrorReducer(numDateFields, state), [])\n .forEach(field => {\n // For each detected error pass an error object to the handler (calls error callback & sets state)\n const errorObj: CardErrorData = getErrorObject(field, this.rootNode, state);\n this.handleOnError(errorObj, !!state.detectedUnsupportedBrands);\n // Inform the secured-fields instance of which fields have been found to have errors\n if (this.csf && this.csf.isValidated) {\n this.csf.isValidated(field, errorObj.error);\n }\n });\n }\n\n /**\n * Map SF errors to ValidationRuleResult-like objects, for CardInput component\n */\n public mapErrorsToValidationRuleResult(): SFStateErrorObj {\n const fieldNames: string[] = Object.keys(this.state.errors);\n\n const sfStateErrorsObj = fieldNames.reduce((acc, fieldName) => {\n const errorCode = this.state.errors[fieldName];\n if (errorCode) {\n acc[fieldName] = {\n isValid: false,\n errorMessage: getErrorMessageFromCode(errorCode, SF_ErrorCodes), // this is the human-readable, untranslated, explanation of the error that will exist on the error object in card.state.errors\n // For v5 the object found in state.errors should also contain the additional properties that used to be sent to the onError callback\n // namely: translation, errorCode, a ref to rootNode &, in the case of failed binLookup, an array of the detectedBrands\n errorI18n: this.props.i18n.get(errorCode),\n error: errorCode,\n rootNode: this.rootNode,\n ...(this.state.detectedUnsupportedBrands && { detectedBrands: this.state.detectedUnsupportedBrands })\n };\n } else {\n acc[fieldName] = null;\n }\n return acc;\n }, {});\n return sfStateErrorsObj;\n }\n\n public processBinLookupResponse(binLookupResponse: BinLookupResponse, resetObject: SingleBrandResetObject): void {\n // If we were dealing with an unsupported card & now we have a valid /binLookup response (or a response triggering a reset of the UI),\n // - reset state to clear the error & the stored unsupportedBrands and, in the case of a valid /binLookup response, inform CSF (via handleUnsupportedCard)\n // (Scenario: from an unsupportedCard state the shopper has pasted another number long enough to trigger a /binLookup)\n if (this.state.detectedUnsupportedBrands) {\n this.setState(prevState => ({\n errors: { ...prevState.errors, [ENCRYPTED_CARD_NUMBER]: null },\n detectedUnsupportedBrands: null\n }));\n\n // If we have some sort of binLookupResponse object then this isn't the reset caused by digits dropping below a threshold\n // - so call handleUnsupportedCard to clear the error\n if (this.csf && binLookupResponse) {\n const errObj: CardErrorData = {\n type: 'card',\n fieldType: 'encryptedCardNumber',\n error: ''\n };\n this.handleUnsupportedCard(errObj);\n }\n }\n\n this.issuingCountryCode = binLookupResponse?.issuingCountryCode?.toLowerCase();\n\n const hasBrandedResetObj = resetObject?.brand;\n\n /**\n * Are we dealing with a \"dedicated\" card scenario i.e a card component created as: checkout.create('bcmc') but which can accept multiple brands\n * - in which case we will need to reset brand and pass on the resetObj to CSF\n */\n const mustResetDedicatedBrand = hasBrandedResetObj && DEDICATED_CARD_COMPONENTS.includes(resetObject.brand);\n\n if (mustResetDedicatedBrand) {\n // resetObject.brand will be the value of the brand whose logo we want to reshow in the UI\n this.setState(resetObject, () => {\n this.props.onChange(this.state);\n });\n }\n\n /**\n * Scenarios:\n *\n * - RESET (binLookupResponse === null): The number of digits in number field has dropped below threshold for BIN lookup\n * - RESULT (binLookupResponse.supportedBrands.length === 1): binLookup has found a result so inform CSF\n *\n * In the RESET scenario, for \"dedicated\" card components we also need to pass on the resetObject since this contains information about\n * the brand that CSF needs to reset to, internally.\n */\n if (this.csf) this.csf.brandsFromBinLookup(binLookupResponse, mustResetDedicatedBrand ? resetObject : null);\n }\n\n private setRootNode = (input: HTMLElement): void => {\n this.rootNode = input;\n };\n\n public render(props, state) {\n return props.render({ setRootNode: this.setRootNode, setFocusOn: this.setFocusOn }, state);\n }\n}\n\nexport default SecuredFieldsProvider;\n"],"names":["SecuredFieldsProvider","Component","componentDidMount","this","props","rootNode","setRootNode","fields","getFields","valid","reduce","validFieldsReducer","setState","forEach","field","numCharsInField","numDateFields","filter","f","match","length","destroy","initializeCSF","componentType","TxVariants","customCard","console","debug","handleOnNoDataRequired","componentDidUpdate","checkForKCPFields","onStateUpdate","state","componentWillUnmount","csf","clearTimeout","csfLoadFailTimeout","csfConfigFailTimeout","root","loadingContext","csfSetupObj","type","clientKey","cardGroupTypes","brands","autoFocus","trimTrailingSeparator","keypadFix","showWarnings","iframeUIConfig","sfStyles","styles","i18n","onSubmitAnalytics","callbacks","onLoad","handleOnLoad","onConfigSuccess","handleOnConfigSuccess","onFieldValid","handleOnFieldValid","onAllValid","handleOnAllValid","onBrand","handleOnBrand","onError","handleOnError","onFocus","handleFocus","onBinValue","onAutoComplete","handleOnAutoComplete","onAdditionalSFConfig","onAdditionalSFRemoved","onTouchstartIOS","handleOnTouchstartIOS","onKeyPressed","handleKeyPressed","isKCP","hasKoreanFields","legacyInputMode","minimumExpiryDate","implementationType","forceCompat","maskSecurityCode","exposeExpiryDate","shouldDisableIOSArrowKeys","disableIOSArrowKeys","placeholders","showContextualElement","initCSF","setTimeout","status","AdyenCheckoutError","csfLoadFailTimeoutMS","needsKoreanFields","koreanAuthenticationRequired","issuingCountryCode","countryCode","setRemovedFieldState","prevState","data","ENCRYPTED_PWD_FIELD","undefined","errors","onChange","removeSecuredField","setKCPStatus","setAddedFieldState","isSfpValid","addSecuredField","getChildContext","handleUnsupportedCard","errObj","hasUnsupportedCard","error","detectedUnsupportedBrands","detectedBrands","ENCRYPTED_CARD_NUMBER","setFocusOn","frame","setFocusOnFrame","updateStyles","stylesObj","sfIsOptionalOrHidden","fieldType","getRootNode","showValidation","Object","keys","getErrorReducer","errorObj","getErrorObject","isValidated","mapErrorsToValidationRuleResult","acc","fieldName","errorCode","isValid","errorMessage","getErrorMessageFromCode","SF_ErrorCodes","errorI18n","get","processBinLookupResponse","binLookupResponse","resetObject","toLowerCase","hasBrandedResetObj","brand","mustResetDedicatedBrand","DEDICATED_CARD_COMPONENTS","includes","brandsFromBinLookup","render","constructor","super","_define_property","csfConfigFailTimeoutMS","input","stateObj","cvcPolicy","CVC_POLICY_REQUIRED","expiryDatePolicy","DATE_POLICY_REQUIRED","handlers","bind","defaultProps"],"mappings":"20BA+BA,MAAMA,UAA8BC,EAyEzBC,iBAAAA,GAECC,KAAKC,MAAMC,UACXF,KAAKG,YAAYH,KAAKC,MAAMC,UAIhC,MAAME,EAASC,EAAUL,KAAKE,UACxBI,EAAQF,EAAOG,OAAOC,EAAoB,CAAA,GAEhDR,KAAKS,SAAS,CAAEH,UAGhBF,EAAOM,QAAQC,IACXX,KAAKY,gBAAgBD,GAAS,IAIlCX,KAAKa,cAAgBT,EAAOU,OAAOC,GAAKA,EAAEC,MAAM,WAAWC,OAEvDb,EAAOa,QACPjB,KAAKkB,UACLlB,KAAKmB,cAAcnB,KAAKE,YAEpBF,KAAKC,MAAMmB,gBAAkBC,EAAWC,YACxCC,QAAQC,MACJ,yOAGRxB,KAAKyB,yBAEb,CAEOC,kBAAAA,GACH1B,KAAK2B,oBAEL3B,KAAKC,MAAM2B,gBAAgB5B,KAAK6B,MACpC,CAEOC,oBAAAA,GACH9B,KAAK+B,IAAM,KACXC,aAAahC,KAAKiC,oBAClBD,aAAahC,KAAKkC,qBACtB,CAEQf,aAAAA,CAAcgB,GAClB,IAAIC,EAAiBpC,KAAKC,MAAMmC,eAOhC,MAAMC,EAA8B,CAChCnC,SAAUiC,EACVG,KAAMtC,KAAKC,MAAMqC,KACjBlB,cAAepB,KAAKC,MAAMmB,cAC1BmB,UAAWvC,K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AQiJ,KAAKnK,KACrC,EAEA0J,EAvEE7J,EAuEqBuK,eAAeA"}
1
+ {"version":3,"file":"SecuredFieldsProvider.js","sources":["../../../../../../src/components/internal/SecuredFields/SFP/SecuredFieldsProvider.ts"],"sourcesContent":["import { Component } from 'preact';\nimport { getErrorObject, getFields, getErrorReducer, validFieldsReducer } from './SFPUtils';\nimport initCSF from '../lib/CSF';\nimport handlers from './SecuredFieldsProviderHandlers';\nimport defaultProps from './defaultProps';\nimport { SFPProps, SFPState, SingleBrandResetObject } from './types';\nimport {\n StylesObject,\n CardErrorData,\n CardFocusData,\n CardBrandData,\n CardAllValidData,\n CardFieldValidData,\n CardAutoCompleteData,\n CardConfigSuccessData,\n CardLoadData,\n SFKeyPressObj,\n SFFieldType\n} from '../lib/types';\nimport { CSFReturnObject, CSFSetupObject } from '../lib/CSF/types';\nimport { CVC_POLICY_REQUIRED, DATE_POLICY_REQUIRED, DEDICATED_CARD_COMPONENTS, ENCRYPTED_CARD_NUMBER, ENCRYPTED_PWD_FIELD } from '../lib/constants';\nimport { BinLookupResponse } from '../../../Card/types';\nimport AdyenCheckoutError from '../../../../core/Errors/AdyenCheckoutError';\nimport { SFStateErrorObj } from '../../../Card/components/CardInput/types';\nimport { getErrorMessageFromCode } from '../../../../core/Errors/utils';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\nimport { TxVariants } from '../../../tx-variants';\n\n/**\n * SecuredFieldsProvider:\n * Initialises & handles the client-side part of SecuredFields\n */\nclass SecuredFieldsProvider extends Component<SFPProps, SFPState> {\n private csfLoadFailTimeout: number;\n private csfLoadFailTimeoutMS: number;\n private csfConfigFailTimeout: number;\n private csfConfigFailTimeoutMS: number;\n private numCharsInField: object;\n private rootNode;\n private numDateFields: number;\n private csf: CSFReturnObject;\n private handleOnLoad: (obj: CardLoadData) => void;\n private handleOnConfigSuccess: (obj: CardConfigSuccessData) => void;\n private handleOnFieldValid: (obj: CardFieldValidData) => void;\n private handleOnAllValid: (obj: CardAllValidData) => void;\n private handleOnBrand: (obj: CardBrandData) => void;\n private handleFocus: (obj: CardFocusData) => void;\n private handleOnError: (obj: CardErrorData, hasUnsupportedCard?: boolean) => void;\n private handleOnAutoComplete: (obj: CardAutoCompleteData) => void;\n private handleOnNoDataRequired: () => void;\n private handleOnTouchstartIOS: (obj) => void;\n private handleKeyPressed: (obj: SFKeyPressObj) => void;\n public state: SFPState;\n public props;\n private issuingCountryCode;\n\n constructor(props: SFPProps) {\n super(props);\n\n const stateObj: SFPState = {\n status: 'loading',\n brand: props.type,\n errors: {},\n valid: {},\n data: {},\n cvcPolicy: CVC_POLICY_REQUIRED,\n expiryDatePolicy: DATE_POLICY_REQUIRED,\n isSfpValid: false,\n hasKoreanFields: props.hasKoreanFields\n };\n this.state = stateObj;\n\n this.csfLoadFailTimeout = null;\n this.csfLoadFailTimeoutMS = 30000;\n\n this.csfConfigFailTimeout = null;\n this.csfConfigFailTimeoutMS = 15000;\n\n this.numCharsInField = {};\n\n // Handlers\n this.handleOnLoad = handlers.handleOnLoad.bind(this);\n this.handleOnConfigSuccess = handlers.handleOnConfigSuccess.bind(this);\n this.handleOnFieldValid = handlers.handleOnFieldValid.bind(this);\n this.handleOnAllValid = handlers.handleOnAllValid.bind(this);\n this.handleOnBrand = handlers.handleOnBrand.bind(this);\n this.handleFocus = handlers.handleFocus.bind(this);\n this.handleOnError = handlers.handleOnError.bind(this);\n this.handleOnNoDataRequired = handlers.handleOnNoDataRequired.bind(this);\n this.handleOnAutoComplete = handlers.handleOnAutoComplete.bind(this);\n this.handleOnTouchstartIOS = handlers.handleOnTouchstartIOS.bind(this); // Only called when iOS detected\n this.handleKeyPressed = handlers.handleKeyPressed.bind(this);\n\n this.processBinLookupResponse = this.processBinLookupResponse.bind(this);\n\n // Bindings for functions exposed to users of this component: SecuredFields & CardInput\n this.setFocusOn = this.setFocusOn.bind(this);\n this.updateStyles = this.updateStyles.bind(this);\n this.handleUnsupportedCard = this.handleUnsupportedCard.bind(this);\n this.showValidation = this.showValidation.bind(this);\n this.destroy = this.destroy.bind(this);\n }\n\n public static readonly defaultProps = defaultProps;\n\n public componentDidMount(): void {\n // When SFP instantiated through SecuredFieldsInput c.f. CardInput\n if (this.props.rootNode) {\n this.setRootNode(this.props.rootNode);\n }\n\n // Find encryptedFields and map them to the values we use to store valid states\n const fields = getFields(this.rootNode);\n const valid = fields.reduce(validFieldsReducer, {});\n\n this.setState({ valid });\n\n // Populate numCharsInField object\n fields.forEach(field => {\n this.numCharsInField[field] = 0;\n });\n\n // Store how many dateFields we are dealing with visually\n this.numDateFields = fields.filter(f => f.match(/Expiry/)).length;\n\n if (fields.length) {\n this.destroy();\n this.initializeCSF(this.rootNode);\n } else {\n if (this.props.componentType === TxVariants.customCard) {\n console.debug(\n 'You are trying to create a CustomCard component but the element into which you are trying to mount the CustomCard component does not contain any elements with a \"data-cse\" attribute e.g. <div data-cse=\"encryptedCardNumber\"></div>'\n );\n }\n this.handleOnNoDataRequired();\n }\n }\n\n public componentDidUpdate() {\n this.checkForKCPFields();\n // Pass all the state data up - Used right now for loading status\n this.props.onStateUpdate?.(this.state);\n }\n\n public componentWillUnmount(): void {\n this.csf = null;\n clearTimeout(this.csfLoadFailTimeout);\n clearTimeout(this.csfConfigFailTimeout);\n }\n\n private initializeCSF(root: HTMLElement): void {\n let loadingContext = this.props.loadingContext;\n\n // For loading securedFields from local server during development\n if (process.env.NODE_ENV === 'development' && process.env.__SF_ENV__ !== 'build') {\n loadingContext = process.env.__SF_ENV__;\n }\n\n const csfSetupObj: CSFSetupObject = {\n rootNode: root,\n type: this.props.type,\n componentType: this.props.componentType,\n clientKey: this.props.clientKey,\n cardGroupTypes: this.props.brands,\n autoFocus: this.props.autoFocus,\n trimTrailingSeparator: this.props.trimTrailingSeparator,\n loadingContext,\n keypadFix: this.props.keypadFix,\n showWarnings: this.props.showWarnings,\n iframeUIConfig: {\n sfStyles: this.props.styles\n },\n i18n: this.props.i18n,\n onSubmitAnalytics: this.props.onSubmitAnalytics,\n callbacks: {\n onLoad: this.handleOnLoad,\n onConfigSuccess: this.handleOnConfigSuccess,\n onFieldValid: this.handleOnFieldValid,\n onAllValid: this.handleOnAllValid,\n onBrand: this.handleOnBrand,\n onError: this.handleOnError,\n onFocus: this.handleFocus,\n onBinValue: this.props.onBinValue,\n onAutoComplete: this.handleOnAutoComplete,\n onAdditionalSFConfig: this.props.onAdditionalSFConfig,\n onAdditionalSFRemoved: this.props.onAdditionalSFRemoved,\n onTouchstartIOS: this.handleOnTouchstartIOS,\n onKeyPressed: this.handleKeyPressed\n },\n isKCP: this.state.hasKoreanFields,\n legacyInputMode: this.props.legacyInputMode,\n minimumExpiryDate: this.props.minimumExpiryDate,\n implementationType: this.props.implementationType || 'components', // to distinguish between 'regular' and 'custom' card component\n forceCompat: this.props.forceCompat,\n maskSecurityCode: this.props.maskSecurityCode,\n exposeExpiryDate: this.props.exposeExpiryDate,\n shouldDisableIOSArrowKeys: !!this.props.disableIOSArrowKeys, // convert whether function has been defined into a boolean\n placeholders: this.props.placeholders ?? {},\n showContextualElement: this.props.showContextualElement\n };\n\n this.csf = initCSF(csfSetupObj);\n\n /**\n * Expect to at least have had the handleOnLoad callback called within this time\n * - if this hasn't happened then something has happened to interrupt the loading of the securedFields\n * So we need to clear the loading spinner to see if the securedFields are reporting anything\n */\n // @ts-ignore - timout 'type' is a number\n this.csfLoadFailTimeout = setTimeout(() => {\n if (this.state.status !== 'ready') {\n // Hide the spinner\n this.setState({ status: 'csfLoadFailure' });\n // Report the error\n this.props.onError(new AdyenCheckoutError('ERROR', 'secured field iframes have failed to load'));\n }\n }, this.csfLoadFailTimeoutMS);\n }\n\n private checkForKCPFields() {\n let needsKoreanFields = false;\n if (this.props.koreanAuthenticationRequired) {\n needsKoreanFields = this.issuingCountryCode ? this.issuingCountryCode === 'kr' : this.props.countryCode === 'kr';\n }\n\n // Was korean, now isn't - hide password field\n if (this.state.hasKoreanFields && !needsKoreanFields) {\n // Clear any stored data\n const setRemovedFieldState = prevState => ({\n data: { ...prevState.data, [ENCRYPTED_PWD_FIELD]: undefined },\n valid: { ...prevState.valid, [ENCRYPTED_PWD_FIELD]: false },\n errors: { ...prevState.errors, [ENCRYPTED_PWD_FIELD]: null },\n hasKoreanFields: false\n });\n\n this.setState(setRemovedFieldState, () => {\n this.props.onChange(this.state);\n });\n\n this.csf.removeSecuredField(ENCRYPTED_PWD_FIELD);\n this.csf.setKCPStatus(false);\n }\n\n // Wasn't korean, now is - show password field\n if (!this.state.hasKoreanFields && needsKoreanFields) {\n const setAddedFieldState = prevState => ({\n valid: { ...prevState.valid, [ENCRYPTED_PWD_FIELD]: false },\n hasKoreanFields: true,\n isSfpValid: false\n });\n\n this.setState(setAddedFieldState, () => {\n this.props.onChange(this.state);\n });\n\n this.csf.addSecuredField(ENCRYPTED_PWD_FIELD);\n this.csf.setKCPStatus(true);\n }\n }\n\n public getChildContext(): object {\n return { i18n: this.props.i18n };\n }\n\n public handleUnsupportedCard(errObj: CardErrorData): boolean {\n const hasUnsupportedCard = !!errObj.error;\n\n // Store the brand(s) we detected and which we don't support\n if (hasUnsupportedCard) {\n this.setState({ detectedUnsupportedBrands: errObj.detectedBrands });\n }\n\n errObj.rootNode = this.rootNode; // Needed for CustomCard\n this.handleOnError(errObj, hasUnsupportedCard);\n // Inform CSF that the number field has an unsupportedCard error (or that it has been cleared)\n if (this.csf) {\n this.csf.hasUnsupportedCard(ENCRYPTED_CARD_NUMBER, errObj.error);\n }\n return hasUnsupportedCard;\n }\n\n public setFocusOn(frame: SFFieldType): void {\n if (this.csf) this.csf.setFocusOnFrame(frame);\n }\n\n public updateStyles(stylesObj: StylesObject): void {\n if (this.csf) this.csf.updateStyles(stylesObj);\n }\n\n public sfIsOptionalOrHidden(fieldType: string): boolean {\n return this.csf.sfIsOptionalOrHidden(fieldType as SFFieldType);\n }\n\n public destroy(): void {\n if (this.csf) this.csf.destroy();\n }\n\n public getRootNode(): HTMLElement {\n return this.rootNode;\n }\n\n public showValidation(): void {\n const { numDateFields, state }: SecuredFieldsProvider = this;\n\n Object.keys(state.valid)\n .reduce(getErrorReducer(numDateFields, state), [])\n .forEach(field => {\n // For each detected error pass an error object to the handler (calls error callback & sets state)\n const errorObj: CardErrorData = getErrorObject(field, this.rootNode, state);\n this.handleOnError(errorObj, !!state.detectedUnsupportedBrands);\n // Inform the secured-fields instance of which fields have been found to have errors\n if (this.csf && this.csf.isValidated) {\n this.csf.isValidated(field, errorObj.error);\n }\n });\n }\n\n /**\n * Map SF errors to ValidationRuleResult-like objects, for CardInput component\n */\n public mapErrorsToValidationRuleResult(): SFStateErrorObj {\n const fieldNames: string[] = Object.keys(this.state.errors);\n\n const sfStateErrorsObj = fieldNames.reduce((acc, fieldName) => {\n const errorCode = this.state.errors[fieldName];\n if (errorCode) {\n acc[fieldName] = {\n isValid: false,\n errorMessage: getErrorMessageFromCode(errorCode, SF_ErrorCodes), // this is the human-readable, untranslated, explanation of the error that will exist on the error object in card.state.errors\n // For v5 the object found in state.errors should also contain the additional properties that used to be sent to the onError callback\n // namely: translation, errorCode, a ref to rootNode &, in the case of failed binLookup, an array of the detectedBrands\n errorI18n: this.props.i18n.get(errorCode),\n error: errorCode,\n rootNode: this.rootNode,\n ...(this.state.detectedUnsupportedBrands && { detectedBrands: this.state.detectedUnsupportedBrands })\n };\n } else {\n acc[fieldName] = null;\n }\n return acc;\n }, {});\n return sfStateErrorsObj;\n }\n\n public processBinLookupResponse(binLookupResponse: BinLookupResponse, resetObject: SingleBrandResetObject): void {\n // If we were dealing with an unsupported card & now we have a valid /binLookup response (or a response triggering a reset of the UI),\n // - reset state to clear the error & the stored unsupportedBrands and, in the case of a valid /binLookup response, inform CSF (via handleUnsupportedCard)\n // (Scenario: from an unsupportedCard state the shopper has pasted another number long enough to trigger a /binLookup)\n if (this.state.detectedUnsupportedBrands) {\n this.setState(prevState => ({\n errors: { ...prevState.errors, [ENCRYPTED_CARD_NUMBER]: null },\n detectedUnsupportedBrands: null\n }));\n\n // If we have some sort of binLookupResponse object then this isn't the reset caused by digits dropping below a threshold\n // - so call handleUnsupportedCard to clear the error\n if (this.csf && binLookupResponse) {\n const errObj: CardErrorData = {\n type: 'card',\n fieldType: 'encryptedCardNumber',\n error: ''\n };\n this.handleUnsupportedCard(errObj);\n }\n }\n\n this.issuingCountryCode = binLookupResponse?.issuingCountryCode?.toLowerCase();\n\n const hasBrandedResetObj = resetObject?.brand;\n\n /**\n * Are we dealing with a \"dedicated\" card scenario i.e a card component created as: checkout.create('bcmc') but which can accept multiple brands\n * - in which case we will need to reset brand and pass on the resetObj to CSF\n */\n const mustResetDedicatedBrand = hasBrandedResetObj && DEDICATED_CARD_COMPONENTS.includes(resetObject.brand);\n\n if (mustResetDedicatedBrand) {\n // resetObject.brand will be the value of the brand whose logo we want to reshow in the UI\n this.setState(resetObject, () => {\n this.props.onChange(this.state);\n });\n }\n\n /**\n * Scenarios:\n *\n * - RESET (binLookupResponse === null): The number of digits in number field has dropped below threshold for BIN lookup\n * - RESULT (binLookupResponse.supportedBrands.length === 1): binLookup has found a result so inform CSF\n *\n * In the RESET scenario, for \"dedicated\" card components we also need to pass on the resetObject since this contains information about\n * the brand that CSF needs to reset to, internally.\n */\n if (this.csf) this.csf.brandsFromBinLookup(binLookupResponse, mustResetDedicatedBrand ? resetObject : null);\n }\n\n private setRootNode = (input: HTMLElement): void => {\n this.rootNode = input;\n };\n\n public render(props, state) {\n return props.render({ setRootNode: this.setRootNode, setFocusOn: this.setFocusOn }, state);\n }\n}\n\nexport default SecuredFieldsProvider;\n"],"names":["SecuredFieldsProvider","Component","componentDidMount","this","props","rootNode","setRootNode","fields","getFields","valid","reduce","validFieldsReducer","setState","forEach","field","numCharsInField","numDateFields","filter","f","match","length","destroy","initializeCSF","componentType","TxVariants","customCard","console","debug","handleOnNoDataRequired","componentDidUpdate","checkForKCPFields","onStateUpdate","state","componentWillUnmount","csf","clearTimeout","csfLoadFailTimeout","csfConfigFailTimeout","root","loadingContext","csfSetupObj","type","clientKey","cardGroupTypes","brands","autoFocus","trimTrailingSeparator","keypadFix","showWarnings","iframeUIConfig","sfStyles","styles","i18n","onSubmitAnalytics","callbacks","onLoad","handleOnLoad","onConfigSuccess","handleOnConfigSuccess","onFieldValid","handleOnFieldValid","onAllValid","handleOnAllValid","onBrand","handleOnBrand","onError","handleOnError","onFocus","handleFocus","onBinValue","onAutoComplete","handleOnAutoComplete","onAdditionalSFConfig","onAdditionalSFRemoved","onTouchstartIOS","handleOnTouchstartIOS","onKeyPressed","handleKeyPressed","isKCP","hasKoreanFields","legacyInputMode","minimumExpiryDate","implementationType","forceCompat","maskSecurityCode","exposeExpiryDate","shouldDisableIOSArrowKeys","disableIOSArrowKeys","placeholders","showContextualElement","initCSF","setTimeout","status","AdyenCheckoutError","csfLoadFailTimeoutMS","needsKoreanFields","koreanAuthenticationRequired","issuingCountryCode","countryCode","setRemovedFieldState","prevState","data","ENCRYPTED_PWD_FIELD","undefined","errors","onChange","removeSecuredField","setKCPStatus","setAddedFieldState","isSfpValid","addSecuredField","getChildContext","handleUnsupportedCard","errObj","hasUnsupportedCard","error","detectedUnsupportedBrands","detectedBrands","ENCRYPTED_CARD_NUMBER","setFocusOn","frame","setFocusOnFrame","updateStyles","stylesObj","sfIsOptionalOrHidden","fieldType","getRootNode","showValidation","Object","keys","getErrorReducer","errorObj","getErrorObject","isValidated","mapErrorsToValidationRuleResult","acc","fieldName","errorCode","isValid","errorMessage","getErrorMessageFromCode","SF_ErrorCodes","errorI18n","get","processBinLookupResponse","binLookupResponse","resetObject","toLowerCase","hasBrandedResetObj","brand","mustResetDedicatedBrand","DEDICATED_CARD_COMPONENTS","includes","brandsFromBinLookup","render","constructor","super","_define_property","csfConfigFailTimeoutMS","input","stateObj","cvcPolicy","CVC_POLICY_REQUIRED","expiryDatePolicy","DATE_POLICY_REQUIRED","handlers","bind","defaultProps"],"mappings":"20BAgCA,MAAMA,UAA8BC,EAyEzBC,iBAAAA,GAECC,KAAKC,MAAMC,UACXF,KAAKG,YAAYH,KAAKC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zG,mBAAmB0G,KAAKnK,MAC3DA,KAAK2D,iBAAmBuG,EAASvG,iBAAiBwG,KAAKnK,MACvDA,KAAK6D,cAAgBqG,EAASrG,cAAcsG,KAAKnK,MACjDA,KAAKiE,YAAciG,EAASjG,YAAYkG,KAAKnK,MAC7CA,KAAK+D,cAAgBmG,EAASnG,cAAcoG,KAAKnK,MACjDA,KAAKyB,uBAAyByI,EAASzI,uBAAuB0I,KAAKnK,MACnEA,KAAKoE,qBAAuB8F,EAAS9F,qBAAqB+F,KAAKnK,MAC/DA,KAAKwE,sBAAwB0F,EAAS1F,sBAAsB2F,KAAKnK,MACjEA,KAAK0E,iBAAmBwF,EAASxF,iBAAiByF,KAAKnK,MAEvDA,KAAK6I,yBAA2B7I,KAAK6I,yBAAyBsB,KAAKnK,MAGnEA,KAAKoH,WAAapH,KAAKoH,WAAW+C,KAAKnK,MACvCA,KAAKuH,aAAevH,KAAKuH,aAAa4C,KAAKnK,MAC3CA,KAAK6G,sBAAwB7G,KAAK6G,sBAAsBsD,KAAKnK,MAC7DA,KAAK4H,eAAiB5H,KAAK4H,eAAeuC,KAAKnK,MAC/CA,KAAKkB,QAAUlB,KAAKkB,QAAQiJ,KAAKnK,KACrC,EAEA0J,EAvEE7J,EAuEqBuK,eAAeA"}
@@ -1 +1 @@
1
- {"version":3,"file":"AbstractCSF.js","sources":["../../../../../../../src/components/internal/SecuredFields/lib/CSF/AbstractCSF.ts"],"sourcesContent":["import { CSFSetupObject, CSFConfigObject, CSFCallbacksConfig, CSFStateObject } from './types';\nimport { SFFeedbackObj, SendBrandObject, SendExpiryDateObject, CVCPolicyType, DatePolicyType, SFFieldType } from '../types';\nimport { createSecuredFields } from './extensions/createSecuredFields';\nimport processBrand from './partials/processBrand';\nimport handleBrandFromBinLookup from './extensions/handleBrandFromBinLookup';\n\nabstract class AbstractCSF {\n // Set in CSF\n protected callbacks: CSFCallbacksConfig;\n protected config: CSFConfigObject;\n protected props: CSFSetupObject;\n protected state: CSFStateObject;\n protected validateForm: () => void;\n protected handleBrandFromBinLookup: typeof handleBrandFromBinLookup;\n protected callbacksHandler: (callbacksObj: object) => void;\n protected configHandler: (props: CSFSetupObject) => void;\n protected createCardSecuredFields: (securedFields: HTMLElement[], cvcPolicy: CVCPolicyType, expiryDatePolicy: DatePolicyType) => Promise<any>;\n protected createNonCardSecuredFields: (securedFields: HTMLElement[]) => Promise<any>;\n protected createSecuredFields: typeof createSecuredFields;\n protected destroySecuredFields: () => void;\n protected handleIOSTouchEvents: () => void;\n protected destroyTouchendListener: () => void;\n protected destroyTouchstartListener: () => void;\n protected handleBinValue: (pFeedbackObj: SFFeedbackObj) => void;\n protected handleEncryption: (pFeedbackObj: SFFeedbackObj) => void;\n protected handleFocus: (pFeedbackObj: SFFeedbackObj) => void;\n protected handleIframeConfigFeedback: (pFeedbackObj) => boolean;\n protected handleValidation: (pFeedbackObj: SFFeedbackObj) => void;\n protected handleSFShiftTab: (fieldType: string) => void;\n protected handleShiftTab: (fieldType: string) => void;\n protected isConfigured: () => void;\n protected postMessageToAllIframes: (pDataObj: object) => void;\n protected processAutoComplete: (pFeedbackObj: SFFeedbackObj) => void;\n protected processBrand: typeof processBrand;\n protected sendBrandToCardSF: (brandObj: SendBrandObject) => void;\n protected sendExpiryDatePolicyToSF: (dateObj: SendExpiryDateObject) => void;\n protected setFocusOnFrame: (pFieldType: SFFieldType, doLog?: boolean) => void;\n protected setupSecuredField: (pItem: HTMLElement) => void;\n protected touchendListener: (e: Event) => void;\n protected touchstartListener: () => void;\n protected hasGenuineTouchEvents: boolean;\n // Set in createSecuredFields\n protected encryptedAttrName: string;\n protected hasRedundantCVCField: boolean;\n protected isSingleBrandedCard: boolean;\n protected securityCode: string;\n // --\n protected constructor(setupObj: CSFSetupObject) {\n this.props = setupObj;\n this.state = {} as any as CSFStateObject;\n\n // Initialise storage objects\n this.config = {} as any as CSFConfigObject; // {} as ConfigObject fails in linting\n this.callbacks = {} as any as CSFCallbacksConfig;\n }\n}\nexport default AbstractCSF;\n"],"names":["AbstractCSF","constructor","setupObj","_define_property","this","callbacks","config","props","state","validateForm","handleBrandFromBinLookup","callbacksHandler","configHandler","createCardSecuredFields","createNonCardSecuredFields","createSecuredFields","destroySecuredFields","handleIOSTouchEvents","destroyTouchendListener","destroyTouchstartListener","handleBinValue","handleEncryption","handleFocus","handleIframeConfigFeedback","handleValidation","handleSFShiftTab","handleShiftTab","isConfigured","postMessageToAllIframes","processAutoComplete","processBrand","sendBrandToCardSF","sendExpiryDatePolicyToSF","setFocusOnFrame","setupSecuredField","touchendListener","touchstartListener","hasGenuineTouchEvents","encryptedAttrName","hasRedundantCVCField","isSingleBrandedCard","securityCode"],"mappings":"wHAMA,MAAeA,EAyCX,WAAAC,CAAsBC,GAvCtBC,EAAAC,KAAUC,oBACVF,EAAAC,KAAUE,iBACVH,EAAAC,KAAUG,gBACVJ,EAAAC,KAAUI,gBACVL,EAAAC,KAAUK,uBACVN,EAAAC,KAAUM,mCACVP,EAAAC,KAAUO,2BACVR,EAAAC,KAAUQ,wBACVT,EAAAC,KAAUS,kCACVV,EAAAC,KAAUU,qCACVX,EAAAC,KAAUW,8BACVZ,EAAAC,KAAUY,+BACVb,EAAAC,KAAUa,+BACVd,EAAAC,KAAUc,kCACVf,EAAAC,KAAUe,oCACVhB,EAAAC,KAAUgB,yBACVjB,EAAAC,KAAUiB,2BACVlB,EAAAC,KAAUkB,sBACVnB,EAAAC,KAAUmB,qCACVpB,EAAAC,KAAUoB,2BACVrB,EAAAC,KAAUqB,2BACVtB,EAAAC,KAAUsB,yBACVvB,EAAAC,KAAUuB,uBACVxB,EAAAC,KAAUwB,kCACVzB,EAAAC,KAAUyB,8BACV1B,EAAAC,KAAU0B,uBACV3B,EAAAC,KAAU2B,4BACV5B,EAAAC,KAAU4B,mCACV7B,EAAAC,KAAU6B,0BACV9B,EAAAC,KAAU8B,4BACV/B,EAAAC,KAAU+B,2BACVhC,EAAAC,KAAUgC,6BACVjC,EAAAC,KAAUiC,gCAEVlC,EAAAC,KAAUkC,4BACVnC,EAAAC,KAAUmC,+BACVpC,EAAAC,KAAUoC,8BACVrC,EAAAC,KAAUqC,uBAGNrC,KAAKG,MAAQL,EACbE,KAAKI,MAAQ,CAAA,EAGbJ,KAAKE,OAAS,GACdF,KAAKC,UAAY,CAAA,CACrB"}
1
+ {"version":3,"file":"AbstractCSF.js","sources":["../../../../../../../src/components/internal/SecuredFields/lib/CSF/AbstractCSF.ts"],"sourcesContent":["import { CSFSetupObject, CSFConfigObject, CSFCallbacksConfig, CSFStateObject } from './types';\nimport { SFFeedbackObj, SendBrandObject, SendExpiryDateObject, CVCPolicyType, DatePolicyType, SFFieldType } from '../types';\nimport { createSecuredFields } from './extensions/createSecuredFields';\nimport processBrand from './partials/processBrand';\nimport handleBrandFromBinLookup from './extensions/handleBrandFromBinLookup';\n\nabstract class AbstractCSF {\n // Set in CSF\n protected callbacks: Partial<CSFCallbacksConfig>;\n protected config: Partial<CSFConfigObject>;\n protected props: CSFSetupObject;\n protected state: Partial<CSFStateObject>;\n protected validateForm: () => void;\n protected handleBrandFromBinLookup: typeof handleBrandFromBinLookup;\n protected callbacksHandler: (callbacksObj: object) => void;\n protected configHandler: (props: CSFSetupObject) => void;\n protected createCardSecuredFields: (securedFields: HTMLElement[], cvcPolicy: CVCPolicyType, expiryDatePolicy: DatePolicyType) => Promise<void>;\n protected createNonCardSecuredFields: (securedFields: HTMLElement[]) => Promise<void>;\n protected createSecuredFields: typeof createSecuredFields;\n protected destroySecuredFields: () => void;\n protected handleIOSTouchEvents: () => void;\n protected destroyTouchendListener: () => void;\n protected destroyTouchstartListener: () => void;\n protected handleBinValue: (pFeedbackObj: SFFeedbackObj) => void;\n protected handleEncryption: (pFeedbackObj: SFFeedbackObj) => void;\n protected handleFocus: (pFeedbackObj: SFFeedbackObj) => void;\n protected handleIframeConfigFeedback: (pFeedbackObj) => boolean;\n protected handleValidation: (pFeedbackObj: SFFeedbackObj) => void;\n protected handleSFShiftTab: (fieldType: string) => void;\n protected handleShiftTab: (fieldType: string) => void;\n protected isConfigured: () => void;\n protected postMessageToAllIframes: (pDataObj: object) => void;\n protected processAutoComplete: (pFeedbackObj: SFFeedbackObj) => void;\n protected processBrand: typeof processBrand;\n protected sendBrandToCardSF: (brandObj: SendBrandObject) => void;\n protected sendExpiryDatePolicyToSF: (dateObj: SendExpiryDateObject) => void;\n protected setFocusOnFrame: (pFieldType: SFFieldType, doLog?: boolean) => void;\n protected setupSecuredField: (pItem: HTMLElement) => void;\n protected touchendListener: (e: Event) => void;\n protected touchstartListener: () => void;\n protected hasGenuineTouchEvents: boolean;\n // Set in createSecuredFields\n protected encryptedAttrName: string;\n protected hasRedundantCVCField: boolean;\n protected isSingleBrandedCard: boolean;\n protected securityCode: string;\n // --\n protected constructor(setupObj: CSFSetupObject) {\n this.props = setupObj;\n this.state = {};\n\n // Initialise storage objects\n this.config = {};\n this.callbacks = {};\n }\n}\nexport default AbstractCSF;\n"],"names":["AbstractCSF","constructor","setupObj","_define_property","this","callbacks","config","props","state","validateForm","handleBrandFromBinLookup","callbacksHandler","configHandler","createCardSecuredFields","createNonCardSecuredFields","createSecuredFields","destroySecuredFields","handleIOSTouchEvents","destroyTouchendListener","destroyTouchstartListener","handleBinValue","handleEncryption","handleFocus","handleIframeConfigFeedback","handleValidation","handleSFShiftTab","handleShiftTab","isConfigured","postMessageToAllIframes","processAutoComplete","processBrand","sendBrandToCardSF","sendExpiryDatePolicyToSF","setFocusOnFrame","setupSecuredField","touchendListener","touchstartListener","hasGenuineTouchEvents","encryptedAttrName","hasRedundantCVCField","isSingleBrandedCard","securityCode"],"mappings":"wHAMA,MAAeA,EAyCX,WAAAC,CAAsBC,GAvCtBC,EAAAC,KAAUC,oBACVF,EAAAC,KAAUE,iBACVH,EAAAC,KAAUG,gBACVJ,EAAAC,KAAUI,gBACVL,EAAAC,KAAUK,uBACVN,EAAAC,KAAUM,mCACVP,EAAAC,KAAUO,2BACVR,EAAAC,KAAUQ,wBACVT,EAAAC,KAAUS,kCACVV,EAAAC,KAAUU,qCACVX,EAAAC,KAAUW,8BACVZ,EAAAC,KAAUY,+BACVb,EAAAC,KAAUa,+BACVd,EAAAC,KAAUc,kCACVf,EAAAC,KAAUe,oCACVhB,EAAAC,KAAUgB,yBACVjB,EAAAC,KAAUiB,2BACVlB,EAAAC,KAAUkB,sBACVnB,EAAAC,KAAUmB,qCACVpB,EAAAC,KAAUoB,2BACVrB,EAAAC,KAAUqB,2BACVtB,EAAAC,KAAUsB,yBACVvB,EAAAC,KAAUuB,uBACVxB,EAAAC,KAAUwB,kCACVzB,EAAAC,KAAUyB,8BACV1B,EAAAC,KAAU0B,uBACV3B,EAAAC,KAAU2B,4BACV5B,EAAAC,KAAU4B,mCACV7B,EAAAC,KAAU6B,0BACV9B,EAAAC,KAAU8B,4BACV/B,EAAAC,KAAU+B,2BACVhC,EAAAC,KAAUgC,6BACVjC,EAAAC,KAAUiC,gCAEVlC,EAAAC,KAAUkC,4BACVnC,EAAAC,KAAUmC,+BACVpC,EAAAC,KAAUoC,8BACVrC,EAAAC,KAAUqC,uBAGNrC,KAAKG,MAAQL,EACbE,KAAKI,MAAQ,CAAA,EAGbJ,KAAKE,OAAS,CAAA,EACdF,KAAKC,UAAY,CAAA,CACrB"}
@@ -1,2 +1,2 @@
1
- import e from"./AbstractCSF.js";import{handleConfig as s}from"./extensions/handleConfig.js";import{configureCallbacks as t}from"./extensions/configureCallbacks.js";import{handleValidation as i}from"./extensions/handleValidation.js";import{handleEncryption as r}from"./extensions/handleEncryption.js";import{createSecuredFields as o,createNonCardSecuredFields as a,createCardSecuredFields as n,setupSecuredField as d}from"./extensions/createSecuredFields.js";import h from"./extensions/handleIOSTouchEvents.js";import l from"./extensions/handleTab.js";import c,{sendBrandToCardSF as u,sendExpiryDatePolicyToSF as p}from"./extensions/handleBrandFromBinLookup.js";import{setFocusOnFrame as m}from"./partials/setFocusOnFrame.js";import{postMessageToAllIframes as f}from"./partials/postMessageToAllIframes.js";import F from"./partials/processBrand.js";import{processAutoComplete as y}from"./partials/processAutoComplete.js";import{handleFocus as C}from"./partials/handleFocus.js";import{handleIframeConfigFeedback as g}from"./partials/handleIframeConfigFeedback.js";import{isConfigured as S}from"./partials/isConfigured.js";import b from"./partials/validateForm.js";import{handleBinValue as j}from"./partials/handleBinValue.js";import{destroySecuredFields as T}from"./utils/destroySecuredFields.js";import I from"./utils/iframes/postMessageToIframe.js";import k from"./utils/iframes/getIframeContentWin.js";import{warn as O}from"../utilities/logger.js";import{selectOne as x}from"../utilities/dom.js";import{on as v}from"../../../../../utils/listenerUtils.js";import{partial as L}from"../utilities/commonUtils.js";import{hasOwnProperty as B}from"../../../../../utils/hasOwnProperty.js";import K from"./utils/userAgent.js";const P=(e="You cannot use secured fields")=>{O(`${e} - they are not yet configured. Use the 'onConfigSuccess' callback to know when this has happened.`)};class V extends e{init(){this.configHandler(this.props),this.callbacksHandler(this.props.callbacks);const e=this.createSecuredFields();this.state.numIframes=this.state.originalNumIframes=e,this.state.isKCP=!!this.props.isKCP,K.__IS_IOS&&this.props.shouldDisableIOSArrowKeys&&(this.hasGenuineTouchEvents=!1,v(document,"touchstart",this.touchstartListener))}createReturnObject(){return{updateStyles:e=>{this.state.isConfigured?this.postMessageToAllIframes({styleObject:e}):O("You cannot update the secured fields styling - they are not yet configured. Use the 'onConfigSuccess' callback to know when this has happened.")},setFocusOnFrame:e=>{this.state.isConfigured?this.setFocusOnFrame(e):P("You cannot set focus on any secured field")},isValidated:(e,s)=>{if(this.state.isConfigured){if(B(this.state.securedFields,e)){this.state.securedFields[e].hasError=!0,""===this.state.securedFields[e].errorType&&(this.state.securedFields[e].errorType="isValidated");const t={txVariant:this.state.type,fieldType:e,externalValidation:!0,code:s,numKey:this.state.securedFields[e].numKey};I(t,k(this.state,e),this.config.loadingContext)}}else P("You cannot set validated on any secured field")},hasUnsupportedCard:(e,s)=>{if(this.state.isConfigured){if(B(this.state.securedFields,e)){this.state.securedFields[e].hasError=!!s,this.state.securedFields[e].errorType=s;const t={txVariant:this.state.type,fieldType:e,unsupportedCard:!!s,code:s,numKey:this.state.securedFields[e].numKey};I(t,k(this.state,e),this.config.loadingContext)}}else P("You cannot set hasUnsupportedCard on any secured field")},destroy:()=>{this.state.isConfigured?this.destroySecuredFields():P("You cannot destroy secured fields")},brandsFromBinLookup:(e,s)=>{if(!this.config.isCreditCardType)return null;this.state.isConfigured?this.handleBrandFromBinLookup(e,s):P("You cannot set pass brands to secured fields")},addSecuredField:e=>{const s=x(this.props.rootNode,`[data-cse="${e}"]`);s&&(this.state.numIframes+=1,this.setupSecuredField(s))},removeSecuredField:e=>{if(this.state.securedFields[e]){this.state.securedFields[e].destroy(),delete this.state.securedFields[e],this.state.numIframes-=1,this.state.iframeCount-=1;const s={additionalIframeRemoved:!0,fieldType:e,type:this.state.type};this.callbacks.onAdditionalSFRemoved(s)}},setKCPStatus:e=>{this.state.isKCP=e},sfIsOptionalOrHidden:e=>this.state.securedFields[e].isOptionalOrHidden()}}constructor(e){super(e),this.state={type:this.props.type,brand:"card"!==this.props.type?{brand:this.props.type,cvcPolicy:"required"}:{brand:null,cvcPolicy:"required"},allValid:void 0,numIframes:0,originalNumIframes:0,iframeCount:0,iframeConfigCount:0,isConfigured:!1,hasSeparateDateFields:!1,currentFocusObject:null,registerFieldForIos:!1,securedFields:{},isKCP:!1};const I={csfState:this.state,csfConfig:this.config,csfProps:this.props,csfCallbacks:this.callbacks};this.configHandler=s,this.callbacksHandler=t,this.validateForm=L(b,I),this.isConfigured=L(S,I,this.validateForm),this.handleIframeConfigFeedback=L(g,I,this.isConfigured),this.processBrand=L(F,I),this.handleValidation=i,this.handleEncryption=r,this.createSecuredFields=o,this.createNonCardSecuredFields=a,this.createCardSecuredFields=n,this.setupSecuredField=d,this.postMessageToAllIframes=L(f,I),this.handleIOSTouchEvents=h.handleTouchend.bind(this),this.touchendListener=h.touchendListener.bind(this),this.destroyTouchendListener=h.destroyTouchendListener.bind(this),this.touchstartListener=h.touchstartListener.bind(this),this.destroyTouchstartListener=h.destroyTouchstartListener.bind(this),this.setFocusOnFrame=L(m,I),this.handleFocus=L(C,I,this.handleIOSTouchEvents),this.handleSFShiftTab=l.handleSFShiftTab,this.handleShiftTab=l.handleShiftTab,this.destroySecuredFields=T,this.processAutoComplete=L(y,I),this.handleBinValue=L(j,I),this.handleBrandFromBinLookup=c,this.sendBrandToCardSF=u,this.sendExpiryDatePolicyToSF=p,this.init()}}export{V as default};
1
+ import s from"./AbstractCSF.js";import{handleConfig as e}from"./extensions/handleConfig.js";import{configureCallbacks as t}from"./extensions/configureCallbacks.js";import{handleValidation as i}from"./extensions/handleValidation.js";import{handleEncryption as r}from"./extensions/handleEncryption.js";import{createSecuredFields as o,createNonCardSecuredFields as a,createCardSecuredFields as n,setupSecuredField as d}from"./extensions/createSecuredFields.js";import h from"./extensions/handleIOSTouchEvents.js";import l from"./extensions/handleTab.js";import c,{sendBrandToCardSF as u,sendExpiryDatePolicyToSF as p}from"./extensions/handleBrandFromBinLookup.js";import{setFocusOnFrame as m}from"./partials/setFocusOnFrame.js";import{postMessageToAllIframes as f}from"./partials/postMessageToAllIframes.js";import F from"./partials/processBrand.js";import{processAutoComplete as y}from"./partials/processAutoComplete.js";import{handleFocus as b}from"./partials/handleFocus.js";import{handleIframeConfigFeedback as C}from"./partials/handleIframeConfigFeedback.js";import{isConfigured as g}from"./partials/isConfigured.js";import S from"./partials/validateForm.js";import{handleBinValue as j}from"./partials/handleBinValue.js";import{destroySecuredFields as T}from"./utils/destroySecuredFields.js";import I from"./utils/iframes/postMessageToIframe.js";import k from"./utils/iframes/getIframeContentWin.js";import{warn as O}from"../utilities/logger.js";import{selectOne as x}from"../utilities/dom.js";import{on as v}from"../../../../../utils/listenerUtils.js";import{partial as L}from"../utilities/commonUtils.js";import{hasOwnProperty as B}from"../../../../../utils/hasOwnProperty.js";import K from"./utils/userAgent.js";const P=(s="You cannot use secured fields")=>{O(`${s} - they are not yet configured. Use the 'onConfigSuccess' callback to know when this has happened.`)};class V extends s{init(){this.configHandler(this.props),this.callbacksHandler(this.props.callbacks);const s=this.createSecuredFields();this.state.numIframes=this.state.originalNumIframes=s,this.state.isKCP=!!this.props.isKCP,K.__IS_IOS&&this.props.shouldDisableIOSArrowKeys&&(this.hasGenuineTouchEvents=!1,v(document,"touchstart",this.touchstartListener))}createReturnObject(){return{updateStyles:s=>{this.state.isConfigured?this.postMessageToAllIframes({styleObject:s}):O("You cannot update the secured fields styling - they are not yet configured. Use the 'onConfigSuccess' callback to know when this has happened.")},setFocusOnFrame:s=>{this.state.isConfigured?this.setFocusOnFrame(s):P("You cannot set focus on any secured field")},isValidated:(s,e)=>{if(this.state.isConfigured){if(B(this.state.securedFields,s)){this.state.securedFields[s].hasError=!0,""===this.state.securedFields[s].errorType&&(this.state.securedFields[s].errorType="isValidated");const t={txVariant:this.state.type,fieldType:s,externalValidation:!0,code:e,numKey:this.state.securedFields[s].numKey};I(t,k(this.state,s),this.config.loadingContext)}}else P("You cannot set validated on any secured field")},hasUnsupportedCard:(s,e)=>{if(this.state.isConfigured){if(B(this.state.securedFields,s)){this.state.securedFields[s].hasError=!!e,this.state.securedFields[s].errorType=e;const t={txVariant:this.state.type,fieldType:s,unsupportedCard:!!e,code:e,numKey:this.state.securedFields[s].numKey};I(t,k(this.state,s),this.config.loadingContext)}}else P("You cannot set hasUnsupportedCard on any secured field")},destroy:()=>{this.state.isConfigured?this.destroySecuredFields():P("You cannot destroy secured fields")},brandsFromBinLookup:(s,e)=>{if(!this.config.isCreditCardType)return null;this.state.isConfigured?this.handleBrandFromBinLookup(s,e):P("You cannot set pass brands to secured fields")},addSecuredField:s=>{const e=x(this.props.rootNode,`[data-cse="${s}"]`);e&&(this.state.numIframes+=1,this.setupSecuredField(e))},removeSecuredField:s=>{if(this.state.securedFields[s]){this.state.securedFields[s].destroy(),delete this.state.securedFields[s],this.state.numIframes-=1,this.state.iframeCount-=1;const e={additionalIframeRemoved:!0,fieldType:s,type:this.state.type};this.callbacks.onAdditionalSFRemoved(e)}},setKCPStatus:s=>{this.state.isKCP=s},sfIsOptionalOrHidden:s=>this.state.securedFields[s].isOptionalOrHidden()}}constructor(s){super(s),this.state={type:this.props.type,brand:"card"!==this.props.type?{brand:this.props.type,cvcPolicy:"required"}:{brand:null,cvcPolicy:"required"},allValid:void 0,numIframes:0,originalNumIframes:0,iframeCount:0,iframeConfigCount:0,isConfigured:!1,hasSeparateDateFields:!1,currentFocusObject:null,registerFieldForIos:!1,securedFields:{},isKCP:!1};const I={csfState:this.state,csfConfig:this.config,csfProps:this.props,csfCallbacks:this.callbacks};this.configHandler=e.bind(this),this.callbacksHandler=t.bind(this),this.validateForm=L(S,I),this.isConfigured=L(g,I,this.validateForm),this.handleIframeConfigFeedback=L(C,I,this.isConfigured),this.processBrand=L(F,I),this.handleValidation=i.bind(this),this.handleEncryption=r.bind(this),this.createSecuredFields=o.bind(this),this.createNonCardSecuredFields=a.bind(this),this.createCardSecuredFields=n.bind(this),this.setupSecuredField=d.bind(this),this.postMessageToAllIframes=L(f,I),this.handleIOSTouchEvents=h.handleTouchend.bind(this),this.touchendListener=h.touchendListener.bind(this),this.destroyTouchendListener=h.destroyTouchendListener.bind(this),this.touchstartListener=h.touchstartListener.bind(this),this.destroyTouchstartListener=h.destroyTouchstartListener.bind(this),this.setFocusOnFrame=L(m,I),this.handleFocus=L(b,I,this.handleIOSTouchEvents),this.handleSFShiftTab=l.handleSFShiftTab.bind(this),this.handleShiftTab=l.handleShiftTab.bind(this),this.destroySecuredFields=T.bind(this),this.processAutoComplete=L(y,I),this.handleBinValue=L(j,I),this.handleBrandFromBinLookup=c.bind(this),this.sendBrandToCardSF=u.bind(this),this.sendExpiryDatePolicyToSF=p.bind(this),this.init()}}export{V as default};
2
2
  //# sourceMappingURL=CSF.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CSF.js","sources":["../../../../../../../src/components/internal/SecuredFields/lib/CSF/CSF.ts"],"sourcesContent":["import AbstractCSF from './AbstractCSF';\nimport { CSFReturnObject, CSFSetupObject, CSFStateObject, CSFThisObject } from './types';\nimport { StylesObject, CardAdditionalSFData, SFFieldType } from '../types';\nimport { BinLookupResponse } from '../../../../Card/types';\nimport { handleConfig } from './extensions/handleConfig';\nimport { configureCallbacks } from './extensions/configureCallbacks';\nimport { handleValidation } from './extensions/handleValidation';\nimport { handleEncryption } from './extensions/handleEncryption';\nimport { createSecuredFields, createNonCardSecuredFields, createCardSecuredFields, setupSecuredField } from './extensions/createSecuredFields';\nimport handleIOSTouchEvents from './extensions/handleIOSTouchEvents';\nimport handleTab from './extensions/handleTab';\nimport handleBrandFromBinLookup, { sendBrandToCardSF, sendExpiryDatePolicyToSF } from './extensions/handleBrandFromBinLookup';\nimport { setFocusOnFrame } from './partials/setFocusOnFrame';\nimport { postMessageToAllIframes } from './partials/postMessageToAllIframes';\nimport processBrand from './partials/processBrand';\nimport { processAutoComplete } from './partials/processAutoComplete';\nimport { handleFocus } from './partials/handleFocus';\nimport { handleIframeConfigFeedback } from './partials/handleIframeConfigFeedback';\nimport { isConfigured } from './partials/isConfigured';\nimport validateForm from './partials/validateForm';\nimport { handleBinValue } from './partials/handleBinValue';\nimport { destroySecuredFields } from './utils/destroySecuredFields';\nimport postMessageToIframe from './utils/iframes/postMessageToIframe';\nimport getIframeContentWin from './utils/iframes/getIframeContentWin';\nimport * as logger from '../utilities/logger';\nimport { selectOne } from '../utilities/dom';\nimport { on } from '../../../../../utils/listenerUtils';\nimport { partial } from '../utilities/commonUtils';\nimport { hasOwnProperty } from '../../../../../utils/hasOwnProperty';\nimport ua from './utils/userAgent';\nimport { SingleBrandResetObject } from '../../SFP/types';\n\nconst notConfiguredWarning = (str = 'You cannot use secured fields') => {\n logger.warn(`${str} - they are not yet configured. Use the 'onConfigSuccess' callback to know when this has happened.`);\n};\n\nclass CSF extends AbstractCSF {\n // --\n constructor(setupObj: CSFSetupObject) {\n /**\n * Initialises:\n * - this.props = setupObj: CSFSetupObject\n *\n * and empty objects for:\n * - this.config: CSFConfigObject (populated in handleConfig.ts)\n * - this.callbacks: CSFCallbacksConfig (populated in configureCallbacks.ts\n * - this.state: CSFStateObject (populated below)\n */\n super(setupObj);\n\n this.state = {\n /**\n * For generic card will always be 'card'.\n * For non-generic card will be hardcoded to a particular txVariant e.g. 'mc' or 'visa'\n * For other types of SecuredField will be the passed type e.g. 'ach' or 'giftcard'\n */\n type: this.props.type,\n /**\n * For generic card will change as shopper types\n * For non-generic card will be fixed\n */\n brand: this.props.type !== 'card' ? { brand: this.props.type, cvcPolicy: 'required' } : { brand: null, cvcPolicy: 'required' },\n allValid: undefined,\n numIframes: 0,\n originalNumIframes: 0,\n iframeCount: 0,\n iframeConfigCount: 0,\n isConfigured: false,\n hasSeparateDateFields: false,\n currentFocusObject: null,\n registerFieldForIos: false,\n securedFields: {},\n isKCP: false\n } as CSFStateObject;\n\n // Create object of references to properties on 'this', that can be used to set up the partials\n const thisObj: CSFThisObject = { csfState: this.state, csfConfig: this.config, csfProps: this.props, csfCallbacks: this.callbacks };\n\n // Setup 'this' references\n this.configHandler = handleConfig;\n\n this.callbacksHandler = configureCallbacks;\n\n this.validateForm = partial(validateForm, thisObj);\n\n this.isConfigured = partial(isConfigured, thisObj, this.validateForm);\n this.handleIframeConfigFeedback = partial(handleIframeConfigFeedback, thisObj, this.isConfigured);\n\n this.processBrand = partial(processBrand, thisObj);\n\n this.handleValidation = handleValidation;\n this.handleEncryption = handleEncryption;\n\n this.createSecuredFields = createSecuredFields;\n this.createNonCardSecuredFields = createNonCardSecuredFields;\n this.createCardSecuredFields = createCardSecuredFields;\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n this.setupSecuredField = setupSecuredField;\n\n this.postMessageToAllIframes = partial(postMessageToAllIframes, thisObj);\n\n this.handleIOSTouchEvents = handleIOSTouchEvents.handleTouchend.bind(this);\n this.touchendListener = handleIOSTouchEvents.touchendListener.bind(this);\n this.destroyTouchendListener = handleIOSTouchEvents.destroyTouchendListener.bind(this);\n this.touchstartListener = handleIOSTouchEvents.touchstartListener.bind(this);\n this.destroyTouchstartListener = handleIOSTouchEvents.destroyTouchstartListener.bind(this);\n\n this.setFocusOnFrame = partial(setFocusOnFrame, thisObj);\n this.handleFocus = partial(handleFocus, thisObj, this.handleIOSTouchEvents);\n\n this.handleSFShiftTab = handleTab.handleSFShiftTab;\n this.handleShiftTab = handleTab.handleShiftTab;\n\n this.destroySecuredFields = destroySecuredFields;\n\n this.processAutoComplete = partial(processAutoComplete, thisObj);\n\n this.handleBinValue = partial(handleBinValue, thisObj);\n\n this.handleBrandFromBinLookup = handleBrandFromBinLookup;\n this.sendBrandToCardSF = sendBrandToCardSF;\n this.sendExpiryDatePolicyToSF = sendExpiryDatePolicyToSF;\n\n // Populate config & callbacks objects & create securedFields\n this.init();\n }\n\n private init(): void {\n this.configHandler(this.props);\n this.callbacksHandler(this.props.callbacks);\n\n /**\n * Create all the securedFields\n */\n const numIframes: number = this.createSecuredFields();\n\n this.state.numIframes = this.state.originalNumIframes = numIframes;\n\n this.state.isKCP = !!this.props.isKCP;\n\n /**\n * Add touchstart listener\n * re. Disabling arrow keys in iOS\n */\n if (ua.__IS_IOS && this.props.shouldDisableIOSArrowKeys) {\n this.hasGenuineTouchEvents = false;\n on(document, 'touchstart', this.touchstartListener);\n }\n }\n\n // Expose functions that can be called on the CSF instance\n public createReturnObject(): CSFReturnObject {\n // --\n const returnObj: CSFReturnObject = {\n // --\n updateStyles: (pStyleObject: StylesObject): void => {\n if (this.state.isConfigured) {\n this.postMessageToAllIframes({ styleObject: pStyleObject });\n } else {\n logger.warn(\n 'You cannot update the secured fields styling ' +\n \"- they are not yet configured. Use the 'onConfigSuccess' callback to know when this has happened.\"\n );\n }\n },\n setFocusOnFrame: (pFieldType: SFFieldType): void => {\n if (this.state.isConfigured) {\n this.setFocusOnFrame(pFieldType);\n // Comment in a quick way to test destroying secured fields (also see comment in destroySecuredFields)\n // this.destroySecuredFields();\n } else {\n notConfiguredWarning('You cannot set focus on any secured field');\n }\n },\n // For component based implementation - if showValidation function is called on the component use this\n // function as a way to notify the CSF that a field is in error\n isValidated: (pFieldType: SFFieldType, code: string): void => {\n if (this.state.isConfigured) {\n if (hasOwnProperty(this.state.securedFields, pFieldType)) {\n this.state.securedFields[pFieldType].hasError = true;\n\n // If there's not already an errorType, set one\n // NOTE: fixes issue in Components where you first validate and then start typing a maestro number\n // - w/o this and the corresponding fix in the SecuredField class the maestro PM will never register as valid\n if (this.state.securedFields[pFieldType].errorType === '') {\n this.state.securedFields[pFieldType].errorType = 'isValidated';\n }\n\n // Inform iframe\n const dataObj: object = {\n txVariant: this.state.type,\n fieldType: pFieldType,\n externalValidation: true,\n code,\n numKey: this.state.securedFields[pFieldType].numKey\n };\n postMessageToIframe(dataObj, getIframeContentWin(this.state, pFieldType), this.config.loadingContext);\n }\n } else {\n notConfiguredWarning('You cannot set validated on any secured field');\n }\n },\n hasUnsupportedCard: (pFieldType: SFFieldType, code: string): void => {\n if (this.state.isConfigured) {\n if (hasOwnProperty(this.state.securedFields, pFieldType)) {\n //\n this.state.securedFields[pFieldType].hasError = !!code;\n this.state.securedFields[pFieldType].errorType = code;\n\n // Inform iframe\n const dataObj: object = {\n txVariant: this.state.type,\n fieldType: pFieldType,\n unsupportedCard: !!code,\n code,\n numKey: this.state.securedFields[pFieldType].numKey\n };\n postMessageToIframe(dataObj, getIframeContentWin(this.state, pFieldType), this.config.loadingContext);\n }\n } else {\n notConfiguredWarning('You cannot set hasUnsupportedCard on any secured field');\n }\n },\n destroy: (): void => {\n if (this.state.isConfigured) {\n this.destroySecuredFields();\n } else {\n notConfiguredWarning('You cannot destroy secured fields');\n }\n },\n brandsFromBinLookup: (binLookupResponse: BinLookupResponse, resetObj: SingleBrandResetObject): void => {\n if (!this.config.isCreditCardType) return null;\n\n if (this.state.isConfigured) {\n this.handleBrandFromBinLookup(binLookupResponse, resetObj);\n } else {\n notConfiguredWarning('You cannot set pass brands to secured fields');\n }\n },\n addSecuredField: (pFieldType: SFFieldType): void => {\n const securedField: HTMLElement = selectOne(this.props.rootNode, `[data-cse=\"${pFieldType}\"]`);\n if (securedField) {\n this.state.numIframes += 1;\n this.setupSecuredField(securedField);\n }\n },\n removeSecuredField: (pFieldType: SFFieldType): void => {\n if (this.state.securedFields[pFieldType]) {\n this.state.securedFields[pFieldType].destroy();\n delete this.state.securedFields[pFieldType];\n this.state.numIframes -= 1;\n this.state.iframeCount -= 1;\n\n const callbackObj: CardAdditionalSFData = { additionalIframeRemoved: true, fieldType: pFieldType, type: this.state.type };\n this.callbacks.onAdditionalSFRemoved(callbackObj);\n }\n },\n setKCPStatus: (isKCP: boolean): void => {\n this.state.isKCP = isKCP;\n },\n sfIsOptionalOrHidden: (fieldType: string): boolean => {\n return this.state.securedFields[fieldType].isOptionalOrHidden();\n }\n };\n\n return returnObj;\n }\n}\n\nexport default CSF;\n"],"names":["notConfiguredWarning","str","logger","CSF","AbstractCSF","init","this","configHandler","props","callbacksHandler","callbacks","numIframes","createSecuredFields","state","originalNumIframes","isKCP","ua","__IS_IOS","shouldDisableIOSArrowKeys","hasGenuineTouchEvents","on","document","touchstartListener","createReturnObject","updateStyles","pStyleObject","isConfigured","postMessageToAllIframes","styleObject","setFocusOnFrame","pFieldType","isValidated","code","hasOwnProperty","securedFields","hasError","errorType","dataObj","txVariant","type","fieldType","externalValidation","numKey","postMessageToIframe","getIframeContentWin","config","loadingContext","hasUnsupportedCard","unsupportedCard","destroy","destroySecuredFields","brandsFromBinLookup","binLookupResponse","resetObj","isCreditCardType","handleBrandFromBinLookup","addSecuredField","securedField","selectOne","rootNode","setupSecuredField","removeSecuredField","iframeCount","callbackObj","additionalIframeRemoved","onAdditionalSFRemoved","setKCPStatus","sfIsOptionalOrHidden","isOptionalOrHidden","constructor","setupObj","super","brand","cvcPolicy","allValid","undefined","iframeConfigCount","hasSeparateDateFields","currentFocusObject","registerFieldForIos","thisObj","csfState","csfConfig","csfProps","csfCallbacks","handleConfig","configureCallbacks","validateForm","partial","handleIframeConfigFeedback","processBrand","handleValidation","handleEncryption","createNonCardSecuredFields","createCardSecuredFields","handleIOSTouchEvents","handleTouchend","bind","touchendListener","destroyTouchendListener","destroyTouchstartListener","handleFocus","handleSFShiftTab","handleTab","handleShiftTab","processAutoComplete","handleBinValue","sendBrandToCardSF","sendExpiryDatePolicyToSF"],"mappings":"qrDAgCA,MAAMA,EAAuB,CAACC,EAAM,mCAChCC,EAAY,GAAGD,wGAGnB,MAAME,UAAYC,EA2FNC,IAAAA,GACJC,KAAKC,cAAcD,KAAKE,OACxBF,KAAKG,iBAAiBH,KAAKE,MAAME,WAKjC,MAAMC,EAAqBL,KAAKM,sBAEhCN,KAAKO,MAAMF,WAAaL,KAAKO,MAAMC,mBAAqBH,EAExDL,KAAKO,MAAME,QAAUT,KAAKE,MAAMO,MAM5BC,EAAGC,UAAYX,KAAKE,MAAMU,4BAC1BZ,KAAKa,uBAAwB,EAC7BC,EAAGC,SAAU,aAAcf,KAAKgB,oBAExC,CAGOC,kBAAAA,GAkHH,MAhHmC,CAE/BC,aAAeC,IACPnB,KAAKO,MAAMa,aACXpB,KAAKqB,wBAAwB,CAAEC,YAAaH,IAE5CvB,EACI,mJAKZ2B,gBAAkBC,IACVxB,KAAKO,MAAMa,aACXpB,KAAKuB,gBAAgBC,GAIrB9B,EAAqB,8CAK7B+B,YAAa,CAACD,EAAyBE,KACnC,GAAI1B,KAAKO,MAAMa,cACX,GAAIO,EAAe3B,KAAKO,MAAMqB,cAAeJ,GAAa,CACtDxB,KAAKO,MAAMqB,cAAcJ,GAAYK,UAAW,EAKO,KAAnD7B,KAAKO,MAAMqB,cAAcJ,GAAYM,YACrC9B,KAAKO,MAAMqB,cAAcJ,GAAYM,UAAY,eAIrD,MAAMC,EAAkB,CACpBC,UAAWhC,KAAKO,MAAM0B,KACtBC,UAAWV,EACXW,oBAAoB,EACpBT,OACAU,OAAQpC,KAAKO,MAAMqB,cAAcJ,GAAYY,QAEjDC,EAAoBN,EAASO,EAAoBtC,KAAKO,MAAOiB,GAAa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F,0BAA4BL,EAAqBK,0BAA0BH,KAAK3F,MAErFA,KAAKuB,gBAAkB2D,EAAQ3D,EAAiBmD,GAChD1E,KAAK+F,YAAcb,EAAQa,EAAarB,EAAS1E,KAAKyF,sBAEtDzF,KAAKgG,iBAAmBC,EAAUD,iBAClChG,KAAKkG,eAAiBD,EAAUC,eAEhClG,KAAK4C,qBAAuBA,EAE5B5C,KAAKmG,oBAAsBjB,EAAQiB,EAAqBzB,GAExD1E,KAAKoG,eAAiBlB,EAAQkB,EAAgB1B,GAE9C1E,KAAKiD,yBAA2BA,EAChCjD,KAAKqG,kBAAoBA,EACzBrG,KAAKsG,yBAA2BA,EAGhCtG,KAAKD,MACT"}
1
+ {"version":3,"file":"CSF.js","sources":["../../../../../../../src/components/internal/SecuredFields/lib/CSF/CSF.ts"],"sourcesContent":["import AbstractCSF from './AbstractCSF';\nimport { CSFReturnObject, CSFSetupObject, CSFStateObject, CSFThisObject, CSFCallbacksConfig, CSFConfigObject } from './types';\nimport { StylesObject, CardAdditionalSFData, SFFieldType } from '../types';\nimport { BinLookupResponse } from '../../../../Card/types';\nimport { handleConfig } from './extensions/handleConfig';\nimport { configureCallbacks } from './extensions/configureCallbacks';\nimport { handleValidation } from './extensions/handleValidation';\nimport { handleEncryption } from './extensions/handleEncryption';\nimport { createSecuredFields, createNonCardSecuredFields, createCardSecuredFields, setupSecuredField } from './extensions/createSecuredFields';\nimport handleIOSTouchEvents from './extensions/handleIOSTouchEvents';\nimport handleTab from './extensions/handleTab';\nimport handleBrandFromBinLookup, { sendBrandToCardSF, sendExpiryDatePolicyToSF } from './extensions/handleBrandFromBinLookup';\nimport { setFocusOnFrame } from './partials/setFocusOnFrame';\nimport { postMessageToAllIframes } from './partials/postMessageToAllIframes';\nimport processBrand from './partials/processBrand';\nimport { processAutoComplete } from './partials/processAutoComplete';\nimport { handleFocus } from './partials/handleFocus';\nimport { handleIframeConfigFeedback } from './partials/handleIframeConfigFeedback';\nimport { isConfigured } from './partials/isConfigured';\nimport validateForm from './partials/validateForm';\nimport { handleBinValue } from './partials/handleBinValue';\nimport { destroySecuredFields } from './utils/destroySecuredFields';\nimport postMessageToIframe from './utils/iframes/postMessageToIframe';\nimport getIframeContentWin from './utils/iframes/getIframeContentWin';\nimport * as logger from '../utilities/logger';\nimport { selectOne } from '../utilities/dom';\nimport { on } from '../../../../../utils/listenerUtils';\nimport { partial } from '../utilities/commonUtils';\nimport { hasOwnProperty } from '../../../../../utils/hasOwnProperty';\nimport ua from './utils/userAgent';\nimport { SingleBrandResetObject } from '../../SFP/types';\n\nconst notConfiguredWarning = (str = 'You cannot use secured fields') => {\n logger.warn(`${str} - they are not yet configured. Use the 'onConfigSuccess' callback to know when this has happened.`);\n};\n\nclass CSF extends AbstractCSF {\n declare protected callbacks: CSFCallbacksConfig;\n declare protected config: CSFConfigObject;\n declare protected state: CSFStateObject;\n\n constructor(setupObj: CSFSetupObject) {\n /**\n * Initialises:\n * - this.props = setupObj: CSFSetupObject\n *\n * and empty objects for:\n * - this.config: CSFConfigObject (populated in handleConfig.ts)\n * - this.callbacks: CSFCallbacksConfig (populated in configureCallbacks.ts\n * - this.state: CSFStateObject (populated below)\n */\n super(setupObj);\n\n this.state = {\n /**\n * For generic card will always be 'card'.\n * For non-generic card will be hardcoded to a particular txVariant e.g. 'mc' or 'visa'\n * For other types of SecuredField will be the passed type e.g. 'ach' or 'giftcard'\n */\n type: this.props.type,\n /**\n * For generic card will change as shopper types\n * For non-generic card will be fixed\n */\n brand: this.props.type !== 'card' ? { brand: this.props.type, cvcPolicy: 'required' } : { brand: null, cvcPolicy: 'required' },\n allValid: undefined,\n numIframes: 0,\n originalNumIframes: 0,\n iframeCount: 0,\n iframeConfigCount: 0,\n isConfigured: false,\n hasSeparateDateFields: false,\n currentFocusObject: null,\n registerFieldForIos: false,\n securedFields: {},\n isKCP: false\n } as CSFStateObject;\n\n // Create object of references to properties on 'this', that can be used to set up the partials\n const thisObj: CSFThisObject = { csfState: this.state, csfConfig: this.config, csfProps: this.props, csfCallbacks: this.callbacks };\n\n // Setup 'this' references\n this.configHandler = handleConfig.bind(this);\n\n this.callbacksHandler = configureCallbacks.bind(this);\n\n this.validateForm = partial(validateForm, thisObj);\n\n this.isConfigured = partial(isConfigured, thisObj, this.validateForm);\n this.handleIframeConfigFeedback = partial(handleIframeConfigFeedback, thisObj, this.isConfigured);\n\n this.processBrand = partial(processBrand, thisObj);\n\n this.handleValidation = handleValidation.bind(this);\n this.handleEncryption = handleEncryption.bind(this);\n\n this.createSecuredFields = createSecuredFields.bind(this);\n this.createNonCardSecuredFields = createNonCardSecuredFields.bind(this);\n this.createCardSecuredFields = createCardSecuredFields.bind(this);\n \n this.setupSecuredField = setupSecuredField.bind(this);\n\n this.postMessageToAllIframes = partial(postMessageToAllIframes, thisObj);\n\n this.handleIOSTouchEvents = handleIOSTouchEvents.handleTouchend.bind(this);\n this.touchendListener = handleIOSTouchEvents.touchendListener.bind(this);\n this.destroyTouchendListener = handleIOSTouchEvents.destroyTouchendListener.bind(this);\n this.touchstartListener = handleIOSTouchEvents.touchstartListener.bind(this);\n this.destroyTouchstartListener = handleIOSTouchEvents.destroyTouchstartListener.bind(this);\n\n this.setFocusOnFrame = partial(setFocusOnFrame, thisObj);\n this.handleFocus = partial(handleFocus, thisObj, this.handleIOSTouchEvents);\n\n this.handleSFShiftTab = handleTab.handleSFShiftTab.bind(this);\n this.handleShiftTab = handleTab.handleShiftTab.bind(this);\n\n this.destroySecuredFields = destroySecuredFields.bind(this);\n\n this.processAutoComplete = partial(processAutoComplete, thisObj);\n\n this.handleBinValue = partial(handleBinValue, thisObj);\n\n this.handleBrandFromBinLookup = handleBrandFromBinLookup.bind(this);\n this.sendBrandToCardSF = sendBrandToCardSF.bind(this);\n this.sendExpiryDatePolicyToSF = sendExpiryDatePolicyToSF.bind(this);\n\n // Populate config & callbacks objects & create securedFields\n this.init();\n }\n\n private init(): void {\n this.configHandler(this.props);\n this.callbacksHandler(this.props.callbacks);\n\n /**\n * Create all the securedFields\n */\n const numIframes: number = this.createSecuredFields();\n\n this.state.numIframes = this.state.originalNumIframes = numIframes;\n\n this.state.isKCP = !!this.props.isKCP;\n\n /**\n * Add touchstart listener\n * re. Disabling arrow keys in iOS\n */\n if (ua.__IS_IOS && this.props.shouldDisableIOSArrowKeys) {\n this.hasGenuineTouchEvents = false;\n on(document, 'touchstart', this.touchstartListener);\n }\n }\n\n // Expose functions that can be called on the CSF instance\n public createReturnObject(): CSFReturnObject {\n // --\n const returnObj: CSFReturnObject = {\n // --\n updateStyles: (pStyleObject: StylesObject): void => {\n if (this.state.isConfigured) {\n this.postMessageToAllIframes({ styleObject: pStyleObject });\n } else {\n logger.warn(\n 'You cannot update the secured fields styling ' +\n \"- they are not yet configured. Use the 'onConfigSuccess' callback to know when this has happened.\"\n );\n }\n },\n setFocusOnFrame: (pFieldType: SFFieldType): void => {\n if (this.state.isConfigured) {\n this.setFocusOnFrame(pFieldType);\n // Comment in a quick way to test destroying secured fields (also see comment in destroySecuredFields)\n // this.destroySecuredFields();\n } else {\n notConfiguredWarning('You cannot set focus on any secured field');\n }\n },\n // For component based implementation - if showValidation function is called on the component use this\n // function as a way to notify the CSF that a field is in error\n isValidated: (pFieldType: SFFieldType, code: string): void => {\n if (this.state.isConfigured) {\n if (hasOwnProperty(this.state.securedFields, pFieldType)) {\n this.state.securedFields[pFieldType].hasError = true;\n\n // If there's not already an errorType, set one\n // NOTE: fixes issue in Components where you first validate and then start typing a maestro number\n // - w/o this and the corresponding fix in the SecuredField class the maestro PM will never register as valid\n if (this.state.securedFields[pFieldType].errorType === '') {\n this.state.securedFields[pFieldType].errorType = 'isValidated';\n }\n\n // Inform iframe\n const dataObj: object = {\n txVariant: this.state.type,\n fieldType: pFieldType,\n externalValidation: true,\n code,\n numKey: this.state.securedFields[pFieldType].numKey\n };\n postMessageToIframe(dataObj, getIframeContentWin(this.state, pFieldType), this.config.loadingContext);\n }\n } else {\n notConfiguredWarning('You cannot set validated on any secured field');\n }\n },\n hasUnsupportedCard: (pFieldType: SFFieldType, code: string): void => {\n if (this.state.isConfigured) {\n if (hasOwnProperty(this.state.securedFields, pFieldType)) {\n //\n this.state.securedFields[pFieldType].hasError = !!code;\n this.state.securedFields[pFieldType].errorType = code;\n\n // Inform iframe\n const dataObj: object = {\n txVariant: this.state.type,\n fieldType: pFieldType,\n unsupportedCard: !!code,\n code,\n numKey: this.state.securedFields[pFieldType].numKey\n };\n postMessageToIframe(dataObj, getIframeContentWin(this.state, pFieldType), this.config.loadingContext);\n }\n } else {\n notConfiguredWarning('You cannot set hasUnsupportedCard on any secured field');\n }\n },\n destroy: (): void => {\n if (this.state.isConfigured) {\n this.destroySecuredFields();\n } else {\n notConfiguredWarning('You cannot destroy secured fields');\n }\n },\n brandsFromBinLookup: (binLookupResponse: BinLookupResponse, resetObj: SingleBrandResetObject): void => {\n if (!this.config.isCreditCardType) return null;\n\n if (this.state.isConfigured) {\n this.handleBrandFromBinLookup(binLookupResponse, resetObj);\n } else {\n notConfiguredWarning('You cannot set pass brands to secured fields');\n }\n },\n addSecuredField: (pFieldType: SFFieldType): void => {\n const securedField: HTMLElement = selectOne(this.props.rootNode, `[data-cse=\"${pFieldType}\"]`);\n if (securedField) {\n this.state.numIframes += 1;\n this.setupSecuredField(securedField);\n }\n },\n removeSecuredField: (pFieldType: SFFieldType): void => {\n if (this.state.securedFields[pFieldType]) {\n this.state.securedFields[pFieldType].destroy();\n delete this.state.securedFields[pFieldType];\n this.state.numIframes -= 1;\n this.state.iframeCount -= 1;\n\n const callbackObj: CardAdditionalSFData = { additionalIframeRemoved: true, fieldType: pFieldType, type: this.state.type };\n this.callbacks.onAdditionalSFRemoved(callbackObj);\n }\n },\n setKCPStatus: (isKCP: boolean): void => {\n this.state.isKCP = isKCP;\n },\n sfIsOptionalOrHidden: (fieldType: string): boolean => {\n return this.state.securedFields[fieldType].isOptionalOrHidden();\n }\n };\n\n return returnObj;\n }\n}\n\nexport default CSF;\n"],"names":["notConfiguredWarning","str","logger","CSF","AbstractCSF","init","this","configHandler","props","callbacksHandler","callbacks","numIframes","createSecuredFields","state","originalNumIframes","isKCP","ua","__IS_IOS","shouldDisableIOSArrowKeys","hasGenuineTouchEvents","on","document","touchstartListener","createReturnObject","updateStyles","pStyleObject","isConfigured","postMessageToAllIframes","styleObject","setFocusOnFrame","pFieldType","isValidated","code","hasOwnProperty","securedFields","hasError","errorType","dataObj","txVariant","type","fieldType","externalValidation","numKey","postMessageToIframe","getIframeContentWin","config","loadingContext","hasUnsupportedCard","unsupportedCard","destroy","destroySecuredFields","brandsFromBinLookup","binLookupResponse","resetObj","isCreditCardType","handleBrandFromBinLookup","addSecuredField","securedField","selectOne","rootNode","setupSecuredField","removeSecuredField","iframeCount","callbackObj","additionalIframeRemoved","onAdditionalSFRemoved","setKCPStatus","sfIsOptionalOrHidden","isOptionalOrHidden","constructor","setupObj","super","brand","cvcPolicy","allValid","undefined","iframeConfigCount","hasSeparateDateFields","currentFocusObject","registerFieldForIos","thisObj","csfState","csfConfig","csfProps","csfCallbacks","handleConfig","bind","configureCallbacks","validateForm","partial","handleIframeConfigFeedback","processBrand","handleValidation","handleEncryption","createNonCardSecuredFields","createCardSecuredFields","handleIOSTouchEvents","handleTouchend","touchendListener","destroyTouchendListener","destroyTouchstartListener","handleFocus","handleSFShiftTab","handleTab","handleShiftTab","processAutoComplete","handleBinValue","sendBrandToCardSF","sendExpiryDatePolicyToSF"],"mappings":"qrDAgCA,MAAMA,EAAuB,CAACC,EAAM,mCAChCC,EAAY,GAAGD,wGAGnB,MAAME,UAAYC,EA8FNC,IAAAA,GACJC,KAAKC,cAAcD,KAAKE,OACxBF,KAAKG,iBAAiBH,KAAKE,MAAME,WAKjC,MAAMC,EAAqBL,KAAKM,sBAEhCN,KAAKO,MAAMF,WAAaL,KAAKO,MAAMC,mBAAqBH,EAExDL,KAAKO,MAAME,QAAUT,KAAKE,MAAMO,MAM5BC,EAAGC,UAAYX,KAAKE,MAAMU,4BAC1BZ,KAAKa,uBAAw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