@adyen/adyen-web 6.0.0-alpha.0 → 6.0.0-alpha.3

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 (393) hide show
  1. package/README.md +166 -0
  2. package/auto/auto.js +2 -0
  3. package/dist/cjs/adyen.css +3 -3
  4. package/dist/cjs/index.cjs +2 -2
  5. package/dist/cjs/index.cjs.map +1 -1
  6. package/dist/cjs/index.d.cts +2414 -2537
  7. package/dist/es/adyen.css +3 -3
  8. package/dist/es/components/AmazonPay/AmazonPay.js +1 -1
  9. package/dist/es/components/AmazonPay/AmazonPay.js.map +1 -1
  10. package/dist/es/components/AmazonPay/components/AmazonPayComponent.js +1 -1
  11. package/dist/es/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
  12. package/dist/es/components/ApplePay/ApplePay.js +1 -1
  13. package/dist/es/components/ApplePay/ApplePay.js.map +1 -1
  14. package/dist/es/components/ApplePay/defaultProps.js +1 -1
  15. package/dist/es/components/ApplePay/defaultProps.js.map +1 -1
  16. package/dist/es/components/ApplePay/payment-request.js.map +1 -1
  17. package/dist/es/components/Boleto/components/BoletoInput/validate.js +1 -1
  18. package/dist/es/components/Boleto/components/BoletoInput/validate.js.map +1 -1
  19. package/dist/es/components/Card/Card.js +1 -1
  20. package/dist/es/components/Card/Card.js.map +1 -1
  21. package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
  22. package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
  23. package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js +1 -1
  24. package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
  25. package/dist/es/components/Card/components/CardInput/components/CardHolderName.js +1 -1
  26. package/dist/es/components/Card/components/CardInput/components/CardHolderName.js.map +1 -1
  27. package/dist/es/components/Card/components/CardInput/components/KCPAuthentication.js +1 -1
  28. package/dist/es/components/Card/components/CardInput/components/KCPAuthentication.js.map +1 -1
  29. package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
  30. package/dist/es/components/Card/components/CardInput/utils.js +1 -1
  31. package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
  32. package/dist/es/components/Card/components/CardInput/validate.js +1 -1
  33. package/dist/es/components/Card/components/CardInput/validate.js.map +1 -1
  34. package/dist/es/components/CashAppPay/defaultProps.js +1 -1
  35. package/dist/es/components/CashAppPay/defaultProps.js.map +1 -1
  36. package/dist/es/components/Donation/Donation.js.map +1 -1
  37. package/dist/es/components/Dragonpay/Dragonpay.js +1 -1
  38. package/dist/es/components/Dragonpay/Dragonpay.js.map +1 -1
  39. package/dist/es/components/Dropin/Dropin.js +1 -1
  40. package/dist/es/components/Dropin/Dropin.js.map +1 -1
  41. package/dist/es/components/Dropin/components/DropinComponent.js +1 -1
  42. package/dist/es/components/Dropin/components/DropinComponent.js.map +1 -1
  43. package/dist/es/components/Dropin/defaultProps.js +1 -1
  44. package/dist/es/components/Dropin/defaultProps.js.map +1 -1
  45. package/dist/es/components/Econtext/Econtext.js +1 -1
  46. package/dist/es/components/Econtext/Econtext.js.map +1 -1
  47. package/dist/es/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
  48. package/dist/es/components/Giftcard/Giftcard.js +1 -1
  49. package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
  50. package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  51. package/dist/es/components/Giropay/Giropay.js +1 -1
  52. package/dist/es/components/Giropay/Giropay.js.map +1 -1
  53. package/dist/es/components/GooglePay/GooglePay.js +1 -1
  54. package/dist/es/components/GooglePay/GooglePay.js.map +1 -1
  55. package/dist/es/components/GooglePay/GooglePayService.js +1 -1
  56. package/dist/es/components/GooglePay/GooglePayService.js.map +1 -1
  57. package/dist/es/components/GooglePay/defaultProps.js +1 -1
  58. package/dist/es/components/GooglePay/defaultProps.js.map +1 -1
  59. package/dist/es/components/GooglePay/requests.js.map +1 -1
  60. package/dist/es/components/Multibanco/Multibanco.js +1 -1
  61. package/dist/es/components/Multibanco/Multibanco.js.map +1 -1
  62. package/dist/es/components/PayPal/Paypal.js +1 -1
  63. package/dist/es/components/PayPal/Paypal.js.map +1 -1
  64. package/dist/es/components/PayPal/components/PaypalButtons.js +1 -1
  65. package/dist/es/components/PayPal/components/PaypalButtons.js.map +1 -1
  66. package/dist/es/components/PayPal/components/PaypalComponent.js +1 -1
  67. package/dist/es/components/PayPal/components/PaypalComponent.js.map +1 -1
  68. package/dist/es/components/PayPal/defaultProps.js +1 -1
  69. package/dist/es/components/PayPal/defaultProps.js.map +1 -1
  70. package/dist/es/components/PayPal/utils/format-paypal-order-contact-to-adyen-format.js +1 -1
  71. package/dist/es/components/PayPal/utils/format-paypal-order-contact-to-adyen-format.js.map +1 -1
  72. package/dist/es/components/PayPal/utils/get-paypal-locale.js +2 -0
  73. package/dist/es/components/PayPal/utils/get-paypal-locale.js.map +1 -0
  74. package/dist/es/components/PayPal/utils/get-paypal-settings.js +2 -0
  75. package/dist/es/components/PayPal/utils/get-paypal-settings.js.map +1 -0
  76. package/dist/es/components/PayPal/utils/get-paypal-styles.js +2 -0
  77. package/dist/es/components/PayPal/utils/get-paypal-styles.js.map +1 -0
  78. package/dist/es/components/PayPal/utils/get-paypal-url.js +2 -0
  79. package/dist/es/components/PayPal/utils/get-paypal-url.js.map +1 -0
  80. package/dist/es/components/Pix/Pix.js +1 -1
  81. package/dist/es/components/Pix/Pix.js.map +1 -1
  82. package/dist/es/components/Pix/PixInput/PixInput.js +1 -1
  83. package/dist/es/components/Pix/PixInput/PixInput.js.map +1 -1
  84. package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js +1 -1
  85. package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  86. package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js +1 -1
  87. package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  88. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  89. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  90. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
  91. package/dist/es/components/ThreeDS2/components/utils.js +1 -1
  92. package/dist/es/components/ThreeDS2/components/utils.js.map +1 -1
  93. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
  94. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  95. package/dist/es/components/internal/Address/Address.js +1 -1
  96. package/dist/es/components/internal/Address/Address.js.map +1 -1
  97. package/dist/es/components/internal/Address/validate.js +1 -1
  98. package/dist/es/components/internal/Address/validate.js.map +1 -1
  99. package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
  100. package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
  101. package/dist/es/components/internal/CompanyDetails/validate.js +1 -1
  102. package/dist/es/components/internal/CompanyDetails/validate.js.map +1 -1
  103. package/dist/es/components/internal/IbanInput/IbanInput.js.map +1 -1
  104. package/dist/es/components/internal/Img/Img.js +1 -1
  105. package/dist/es/components/internal/Img/Img.js.map +1 -1
  106. package/dist/es/components/internal/PersonalDetails/PersonalDetails.js +1 -1
  107. package/dist/es/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
  108. package/dist/es/components/internal/PersonalDetails/validate.js +1 -1
  109. package/dist/es/components/internal/PersonalDetails/validate.js.map +1 -1
  110. package/dist/es/components/internal/SecuredFields/SFP/SFPUtils.js +1 -1
  111. package/dist/es/components/internal/SecuredFields/SFP/SFPUtils.js.map +1 -1
  112. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  113. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  114. package/dist/es/components/internal/SecuredFields/binLookup/triggerBinLookUp.js +1 -1
  115. package/dist/es/components/internal/SecuredFields/binLookup/triggerBinLookUp.js.map +1 -1
  116. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  117. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/cardType.js +1 -1
  118. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/cardType.js.map +1 -1
  119. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/processErrors.js +1 -1
  120. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/processErrors.js.map +1 -1
  121. package/dist/es/components/internal/SecuredFields/lib/configuration/constants.js +1 -1
  122. package/dist/es/components/internal/SecuredFields/lib/configuration/constants.js.map +1 -1
  123. package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  124. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  125. package/dist/es/components/internal/SecuredFields/lib/securedField/utils/processAriaConfig.js.map +1 -1
  126. package/dist/es/components/internal/SecuredFields/lib/securedField/utils/processPlaceholders.js.map +1 -1
  127. package/dist/es/components/internal/SecuredFields/lib/utilities/addContextTranslations.js.map +1 -1
  128. package/dist/es/components/internal/SegmentedControl/SegmentedControl.js +1 -1
  129. package/dist/es/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
  130. package/dist/es/components/internal/UIElement/UIElement.js +1 -1
  131. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  132. package/dist/es/components/internal/UIElement/utils.js +1 -1
  133. package/dist/es/components/internal/UIElement/utils.js.map +1 -1
  134. package/dist/es/core/AdyenCheckout.js +1 -1
  135. package/dist/es/core/AdyenCheckout.js.map +1 -1
  136. package/dist/es/core/Analytics/Analytics.js +1 -1
  137. package/dist/es/core/Analytics/Analytics.js.map +1 -1
  138. package/dist/es/core/Analytics/EventsQueue.js +1 -1
  139. package/dist/es/core/Analytics/EventsQueue.js.map +1 -1
  140. package/dist/es/core/Analytics/constants.js +1 -1
  141. package/dist/es/core/Analytics/constants.js.map +1 -1
  142. package/dist/es/core/Analytics/utils.js +1 -1
  143. package/dist/es/core/Analytics/utils.js.map +1 -1
  144. package/dist/es/core/Errors/AdyenCheckoutError.js +1 -1
  145. package/dist/es/core/Errors/AdyenCheckoutError.js.map +1 -1
  146. package/dist/es/core/Errors/constants.js +1 -1
  147. package/dist/es/core/Errors/constants.js.map +1 -1
  148. package/dist/es/core/Errors/utils.js +1 -1
  149. package/dist/es/core/Errors/utils.js.map +1 -1
  150. package/dist/es/core/ProcessResponse/PaymentAction/actionTypes.js +1 -1
  151. package/dist/es/core/ProcessResponse/PaymentAction/actionTypes.js.map +1 -1
  152. package/dist/es/core/Services/analytics/collect-id.js +1 -1
  153. package/dist/es/core/Services/analytics/collect-id.js.map +1 -1
  154. package/dist/es/core/Services/analytics/log-event.js +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/core/utils.js +1 -1
  160. package/dist/es/core/utils.js.map +1 -1
  161. package/dist/es/index.d.ts +2414 -2537
  162. package/dist/es/language/locales/ar.json.js +1 -1
  163. package/dist/es/language/locales/cs-CZ.json.js +1 -1
  164. package/dist/es/language/locales/da-DK.json.js +1 -1
  165. package/dist/es/language/locales/de-DE.json.js +1 -1
  166. package/dist/es/language/locales/el-GR.json.js +1 -1
  167. package/dist/es/language/locales/en-US.json.js +1 -1
  168. package/dist/es/language/locales/es-ES.json.js +1 -1
  169. package/dist/es/language/locales/fi-FI.json.js +1 -1
  170. package/dist/es/language/locales/fr-FR.json.js +1 -1
  171. package/dist/es/language/locales/hr-HR.json.js +1 -1
  172. package/dist/es/language/locales/hu-HU.json.js +1 -1
  173. package/dist/es/language/locales/it-IT.json.js +1 -1
  174. package/dist/es/language/locales/ja-JP.json.js +1 -1
  175. package/dist/es/language/locales/ko-KR.json.js +1 -1
  176. package/dist/es/language/locales/nl-NL.json.js +1 -1
  177. package/dist/es/language/locales/no-NO.json.js +1 -1
  178. package/dist/es/language/locales/pl-PL.json.js +1 -1
  179. package/dist/es/language/locales/pt-BR.json.js +1 -1
  180. package/dist/es/language/locales/pt-PT.json.js +1 -1
  181. package/dist/es/language/locales/ro-RO.json.js +1 -1
  182. package/dist/es/language/locales/ru-RU.json.js +1 -1
  183. package/dist/es/language/locales/sk-SK.json.js +1 -1
  184. package/dist/es/language/locales/sl-SI.json.js +1 -1
  185. package/dist/es/language/locales/sv-SE.json.js +1 -1
  186. package/dist/es/language/locales/zh-CN.json.js +1 -1
  187. package/dist/es/language/locales/zh-TW.json.js +1 -1
  188. package/dist/es/utils/Formatters/formatters.js.map +1 -1
  189. package/dist/es/utils/Script.js +1 -1
  190. package/dist/es/utils/Script.js.map +1 -1
  191. package/dist/es/utils/Validator/defaultRules.js +1 -1
  192. package/dist/es/utils/Validator/defaultRules.js.map +1 -1
  193. package/dist/es/utils/base64.js +1 -1
  194. package/dist/es/utils/base64.js.map +1 -1
  195. package/dist/es/utils/getErrorMessage.js +1 -1
  196. package/dist/es/utils/getErrorMessage.js.map +1 -1
  197. package/dist/es-legacy/adyen.css +3 -3
  198. package/dist/es-legacy/components/AmazonPay/AmazonPay.js +1 -1
  199. package/dist/es-legacy/components/AmazonPay/AmazonPay.js.map +1 -1
  200. package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js +1 -1
  201. package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
  202. package/dist/es-legacy/components/ApplePay/ApplePay.js +1 -1
  203. package/dist/es-legacy/components/ApplePay/ApplePay.js.map +1 -1
  204. package/dist/es-legacy/components/ApplePay/defaultProps.js +1 -1
  205. package/dist/es-legacy/components/ApplePay/defaultProps.js.map +1 -1
  206. package/dist/es-legacy/components/ApplePay/payment-request.js.map +1 -1
  207. package/dist/es-legacy/components/Boleto/components/BoletoInput/validate.js +1 -1
  208. package/dist/es-legacy/components/Boleto/components/BoletoInput/validate.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/CardFieldsWrapper.js +1 -1
  214. package/dist/es-legacy/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
  215. package/dist/es-legacy/components/Card/components/CardInput/components/CardHolderName.js +1 -1
  216. package/dist/es-legacy/components/Card/components/CardInput/components/CardHolderName.js.map +1 -1
  217. package/dist/es-legacy/components/Card/components/CardInput/components/KCPAuthentication.js +1 -1
  218. package/dist/es-legacy/components/Card/components/CardInput/components/KCPAuthentication.js.map +1 -1
  219. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  220. package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
  221. package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
  222. package/dist/es-legacy/components/Card/components/CardInput/validate.js +1 -1
  223. package/dist/es-legacy/components/Card/components/CardInput/validate.js.map +1 -1
  224. package/dist/es-legacy/components/CashAppPay/defaultProps.js +1 -1
  225. package/dist/es-legacy/components/CashAppPay/defaultProps.js.map +1 -1
  226. package/dist/es-legacy/components/Donation/Donation.js.map +1 -1
  227. package/dist/es-legacy/components/Dragonpay/Dragonpay.js +1 -1
  228. package/dist/es-legacy/components/Dragonpay/Dragonpay.js.map +1 -1
  229. package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
  230. package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
  231. package/dist/es-legacy/components/Dropin/components/DropinComponent.js +1 -1
  232. package/dist/es-legacy/components/Dropin/components/DropinComponent.js.map +1 -1
  233. package/dist/es-legacy/components/Dropin/defaultProps.js +1 -1
  234. package/dist/es-legacy/components/Dropin/defaultProps.js.map +1 -1
  235. package/dist/es-legacy/components/Econtext/Econtext.js +1 -1
  236. package/dist/es-legacy/components/Econtext/Econtext.js.map +1 -1
  237. package/dist/es-legacy/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
  238. package/dist/es-legacy/components/Giftcard/Giftcard.js +1 -1
  239. package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
  240. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  241. package/dist/es-legacy/components/Giropay/Giropay.js +1 -1
  242. package/dist/es-legacy/components/Giropay/Giropay.js.map +1 -1
  243. package/dist/es-legacy/components/GooglePay/GooglePay.js +1 -1
  244. package/dist/es-legacy/components/GooglePay/GooglePay.js.map +1 -1
  245. package/dist/es-legacy/components/GooglePay/GooglePayService.js +1 -1
  246. package/dist/es-legacy/components/GooglePay/GooglePayService.js.map +1 -1
  247. package/dist/es-legacy/components/GooglePay/defaultProps.js +1 -1
  248. package/dist/es-legacy/components/GooglePay/defaultProps.js.map +1 -1
  249. package/dist/es-legacy/components/GooglePay/requests.js.map +1 -1
  250. package/dist/es-legacy/components/Multibanco/Multibanco.js +1 -1
  251. package/dist/es-legacy/components/Multibanco/Multibanco.js.map +1 -1
  252. package/dist/es-legacy/components/PayPal/Paypal.js +1 -1
  253. package/dist/es-legacy/components/PayPal/Paypal.js.map +1 -1
  254. package/dist/es-legacy/components/PayPal/components/PaypalButtons.js +1 -1
  255. package/dist/es-legacy/components/PayPal/components/PaypalButtons.js.map +1 -1
  256. package/dist/es-legacy/components/PayPal/components/PaypalComponent.js +1 -1
  257. package/dist/es-legacy/components/PayPal/components/PaypalComponent.js.map +1 -1
  258. package/dist/es-legacy/components/PayPal/defaultProps.js +1 -1
  259. package/dist/es-legacy/components/PayPal/defaultProps.js.map +1 -1
  260. package/dist/es-legacy/components/PayPal/utils/format-paypal-order-contact-to-adyen-format.js +1 -1
  261. package/dist/es-legacy/components/PayPal/utils/format-paypal-order-contact-to-adyen-format.js.map +1 -1
  262. package/dist/es-legacy/components/PayPal/utils/get-paypal-locale.js +2 -0
  263. package/dist/es-legacy/components/PayPal/utils/get-paypal-locale.js.map +1 -0
  264. package/dist/es-legacy/components/PayPal/utils/get-paypal-settings.js +2 -0
  265. package/dist/es-legacy/components/PayPal/utils/get-paypal-settings.js.map +1 -0
  266. package/dist/es-legacy/components/PayPal/utils/get-paypal-styles.js +2 -0
  267. package/dist/es-legacy/components/PayPal/utils/get-paypal-styles.js.map +1 -0
  268. package/dist/es-legacy/components/PayPal/utils/get-paypal-url.js +2 -0
  269. package/dist/es-legacy/components/PayPal/utils/get-paypal-url.js.map +1 -0
  270. package/dist/es-legacy/components/Pix/Pix.js +1 -1
  271. package/dist/es-legacy/components/Pix/Pix.js.map +1 -1
  272. package/dist/es-legacy/components/Pix/PixInput/PixInput.js +1 -1
  273. package/dist/es-legacy/components/Pix/PixInput/PixInput.js.map +1 -1
  274. package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js +1 -1
  275. package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  276. package/dist/es-legacy/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js +1 -1
  277. package/dist/es-legacy/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  278. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  279. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  280. package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
  281. package/dist/es-legacy/components/ThreeDS2/components/utils.js +1 -1
  282. package/dist/es-legacy/components/ThreeDS2/components/utils.js.map +1 -1
  283. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
  284. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  285. package/dist/es-legacy/components/internal/Address/Address.js +1 -1
  286. package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
  287. package/dist/es-legacy/components/internal/Address/validate.js +1 -1
  288. package/dist/es-legacy/components/internal/Address/validate.js.map +1 -1
  289. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
  290. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
  291. package/dist/es-legacy/components/internal/CompanyDetails/validate.js +1 -1
  292. package/dist/es-legacy/components/internal/CompanyDetails/validate.js.map +1 -1
  293. package/dist/es-legacy/components/internal/IbanInput/IbanInput.js.map +1 -1
  294. package/dist/es-legacy/components/internal/Img/Img.js +1 -1
  295. package/dist/es-legacy/components/internal/Img/Img.js.map +1 -1
  296. package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js +1 -1
  297. package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
  298. package/dist/es-legacy/components/internal/PersonalDetails/validate.js +1 -1
  299. package/dist/es-legacy/components/internal/PersonalDetails/validate.js.map +1 -1
  300. package/dist/es-legacy/components/internal/SecuredFields/SFP/SFPUtils.js +1 -1
  301. package/dist/es-legacy/components/internal/SecuredFields/SFP/SFPUtils.js.map +1 -1
  302. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  303. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  304. package/dist/es-legacy/components/internal/SecuredFields/binLookup/triggerBinLookUp.js +1 -1
  305. package/dist/es-legacy/components/internal/SecuredFields/binLookup/triggerBinLookUp.js.map +1 -1
  306. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  307. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/cardType.js +1 -1
  308. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/cardType.js.map +1 -1
  309. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/processErrors.js +1 -1
  310. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/processErrors.js.map +1 -1
  311. package/dist/es-legacy/components/internal/SecuredFields/lib/configuration/constants.js +1 -1
  312. package/dist/es-legacy/components/internal/SecuredFields/lib/configuration/constants.js.map +1 -1
  313. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  314. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  315. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/utils/processAriaConfig.js.map +1 -1
  316. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/utils/processPlaceholders.js.map +1 -1
  317. package/dist/es-legacy/components/internal/SecuredFields/lib/utilities/addContextTranslations.js.map +1 -1
  318. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js +1 -1
  319. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
  320. package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
  321. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  322. package/dist/es-legacy/components/internal/UIElement/utils.js +1 -1
  323. package/dist/es-legacy/components/internal/UIElement/utils.js.map +1 -1
  324. package/dist/es-legacy/core/AdyenCheckout.js +1 -1
  325. package/dist/es-legacy/core/AdyenCheckout.js.map +1 -1
  326. package/dist/es-legacy/core/Analytics/Analytics.js +1 -1
  327. package/dist/es-legacy/core/Analytics/Analytics.js.map +1 -1
  328. package/dist/es-legacy/core/Analytics/EventsQueue.js +1 -1
  329. package/dist/es-legacy/core/Analytics/EventsQueue.js.map +1 -1
  330. package/dist/es-legacy/core/Analytics/constants.js +1 -1
  331. package/dist/es-legacy/core/Analytics/constants.js.map +1 -1
  332. package/dist/es-legacy/core/Analytics/utils.js +1 -1
  333. package/dist/es-legacy/core/Analytics/utils.js.map +1 -1
  334. package/dist/es-legacy/core/Errors/AdyenCheckoutError.js +1 -1
  335. package/dist/es-legacy/core/Errors/AdyenCheckoutError.js.map +1 -1
  336. package/dist/es-legacy/core/Errors/constants.js +1 -1
  337. package/dist/es-legacy/core/Errors/constants.js.map +1 -1
  338. package/dist/es-legacy/core/Errors/utils.js +1 -1
  339. package/dist/es-legacy/core/Errors/utils.js.map +1 -1
  340. package/dist/es-legacy/core/ProcessResponse/PaymentAction/actionTypes.js +1 -1
  341. package/dist/es-legacy/core/ProcessResponse/PaymentAction/actionTypes.js.map +1 -1
  342. package/dist/es-legacy/core/Services/analytics/collect-id.js +1 -1
  343. package/dist/es-legacy/core/Services/analytics/collect-id.js.map +1 -1
  344. package/dist/es-legacy/core/Services/analytics/log-event.js +1 -1
  345. package/dist/es-legacy/core/config.js +1 -1
  346. package/dist/es-legacy/core/config.js.map +1 -1
  347. package/dist/es-legacy/core/core.js +1 -1
  348. package/dist/es-legacy/core/core.js.map +1 -1
  349. package/dist/es-legacy/core/utils.js +1 -1
  350. package/dist/es-legacy/core/utils.js.map +1 -1
  351. package/dist/es-legacy/language/locales/ar.json.js +1 -1
  352. package/dist/es-legacy/language/locales/cs-CZ.json.js +1 -1
  353. package/dist/es-legacy/language/locales/da-DK.json.js +1 -1
  354. package/dist/es-legacy/language/locales/de-DE.json.js +1 -1
  355. package/dist/es-legacy/language/locales/el-GR.json.js +1 -1
  356. package/dist/es-legacy/language/locales/en-US.json.js +1 -1
  357. package/dist/es-legacy/language/locales/es-ES.json.js +1 -1
  358. package/dist/es-legacy/language/locales/fi-FI.json.js +1 -1
  359. package/dist/es-legacy/language/locales/fr-FR.json.js +1 -1
  360. package/dist/es-legacy/language/locales/hr-HR.json.js +1 -1
  361. package/dist/es-legacy/language/locales/hu-HU.json.js +1 -1
  362. package/dist/es-legacy/language/locales/it-IT.json.js +1 -1
  363. package/dist/es-legacy/language/locales/ja-JP.json.js +1 -1
  364. package/dist/es-legacy/language/locales/ko-KR.json.js +1 -1
  365. package/dist/es-legacy/language/locales/nl-NL.json.js +1 -1
  366. package/dist/es-legacy/language/locales/no-NO.json.js +1 -1
  367. package/dist/es-legacy/language/locales/pl-PL.json.js +1 -1
  368. package/dist/es-legacy/language/locales/pt-BR.json.js +1 -1
  369. package/dist/es-legacy/language/locales/pt-PT.json.js +1 -1
  370. package/dist/es-legacy/language/locales/ro-RO.json.js +1 -1
  371. package/dist/es-legacy/language/locales/ru-RU.json.js +1 -1
  372. package/dist/es-legacy/language/locales/sk-SK.json.js +1 -1
  373. package/dist/es-legacy/language/locales/sl-SI.json.js +1 -1
  374. package/dist/es-legacy/language/locales/sv-SE.json.js +1 -1
  375. package/dist/es-legacy/language/locales/zh-CN.json.js +1 -1
  376. package/dist/es-legacy/language/locales/zh-TW.json.js +1 -1
  377. package/dist/es-legacy/utils/Formatters/formatters.js.map +1 -1
  378. package/dist/es-legacy/utils/Script.js +1 -1
  379. package/dist/es-legacy/utils/Script.js.map +1 -1
  380. package/dist/es-legacy/utils/Validator/defaultRules.js +1 -1
  381. package/dist/es-legacy/utils/Validator/defaultRules.js.map +1 -1
  382. package/dist/es-legacy/utils/base64.js +1 -1
  383. package/dist/es-legacy/utils/base64.js.map +1 -1
  384. package/dist/es-legacy/utils/getErrorMessage.js +1 -1
  385. package/dist/es-legacy/utils/getErrorMessage.js.map +1 -1
  386. package/dist/umd/adyen.css +3 -3
  387. package/dist/umd/adyen.js +2 -2
  388. package/dist/umd/adyen.js.map +1 -1
  389. package/package.json +2 -2
  390. package/dist/es/components/PayPal/utils.js +0 -2
  391. package/dist/es/components/PayPal/utils.js.map +0 -1
  392. package/dist/es-legacy/components/PayPal/utils.js +0 -2
  393. package/dist/es-legacy/components/PayPal/utils.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Card.js","sources":["../../../../src/components/Card/Card.tsx"],"sourcesContent":["import { h } from 'preact';\nimport CardInput from './components/CardInput';\nimport CoreProvider from '../../core/Context/CoreProvider';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport { BinLookupResponse, CardElementData, CardConfiguration } from './types';\nimport triggerBinLookUp from '../internal/SecuredFields/binLookup/triggerBinLookUp';\nimport { CbObjOnBinLookup, CbObjOnConfigSuccess, CbObjOnFocus } from '../internal/SecuredFields/lib/types';\nimport { fieldTypeToSnakeCase, reject } from '../internal/SecuredFields/utils';\nimport { hasValidInstallmentsObject } from './components/CardInput/utils';\nimport createClickToPayService from '../internal/ClickToPay/services/create-clicktopay-service';\nimport { ClickToPayCheckoutPayload, IClickToPayService } from '../internal/ClickToPay/services/types';\nimport ClickToPayWrapper from './components/ClickToPayWrapper';\nimport { ComponentFocusObject } from '../../types/global-types';\nimport SRPanelProvider from '../../core/Errors/SRPanelProvider';\nimport { TxVariants } from '../tx-variants';\nimport { UIElementStatus } from '../internal/UIElement/types';\nimport UIElement from '../internal/UIElement';\nimport PayButton from '../internal/PayButton';\nimport { PayButtonProps } from '../internal/PayButton/PayButton';\nimport type { ICore } from '../../core/types';\nimport {\n ANALYTICS_FOCUS_STR,\n ANALYTICS_CONFIGURED_STR,\n ANALYTICS_UNFOCUS_STR,\n ANALYTICS_VALIDATION_ERROR_STR,\n ANALYTICS_RENDERED_STR\n} from '../../core/Analytics/constants';\nimport { ALL_SECURED_FIELDS } from '../internal/SecuredFields/lib/configuration/constants';\nimport { FieldErrorAnalyticsObject, SendAnalyticsObject } from '../../core/Analytics/types';\nimport { hasOwnProperty } from '../../utils/hasOwnProperty';\nimport AdyenCheckoutError, { IMPLEMENTATION_ERROR } from '../../core/Errors/AdyenCheckoutError';\n\nexport class CardElement extends UIElement<CardConfiguration> {\n public static type = TxVariants.scheme;\n\n private readonly clickToPayService: IClickToPayService | null;\n\n /**\n * Reference to the 'ClickToPayComponent'\n */\n private clickToPayRef = null;\n\n constructor(checkout: ICore, props?: CardConfiguration) {\n super(checkout, props);\n\n if (props && !props._disableClickToPay) {\n this.clickToPayService = createClickToPayService(this.props.configuration, this.props.clickToPayConfiguration, this.props.environment);\n this.clickToPayService?.initialize();\n }\n }\n\n protected static defaultProps = {\n onBinLookup: () => {},\n showFormInstruction: true,\n _disableClickToPay: false\n };\n\n public setStatus(status: UIElementStatus, props?): this {\n if (this.componentRef?.setStatus) {\n this.componentRef.setStatus(status, props);\n }\n if (this.clickToPayRef?.setStatus) {\n this.clickToPayRef.setStatus(status, props);\n }\n return this;\n }\n\n private setClickToPayRef = ref => {\n this.clickToPayRef = ref;\n };\n\n formatProps(props: CardConfiguration) {\n const isZeroAuth = props.amount?.value === 0;\n const enableStoreDetails = isZeroAuth ? false : props.session?.configuration?.enableStoreDetails || props.enableStoreDetails;\n\n const storedCardID = props.storedPaymentMethodId || props.id; // check if we've been passed a (checkout) processed storedCard or one that merchant has pulled from the PMs response\n const isEcommerceStoredCard = storedCardID && props?.supportedShopperInteractions?.includes('Ecommerce'); // If we have a storedCard does it support Ecommerce (it might not if the merchant has pulled it from the PMs response)\n\n // If we have a storedPM but it doesn't support Ecommerce - we can't make a storedCard component from it\n if (storedCardID && !isEcommerceStoredCard) {\n // TODO - Decide if an error is too severe? Would a console.warning suffice?\n throw new AdyenCheckoutError(\n IMPLEMENTATION_ERROR,\n 'You are trying to create a storedCard from a stored PM that does not support Ecommerce interactions'\n );\n }\n\n return {\n ...props,\n // Mismatch between hasHolderName & holderNameRequired which can mean card can never be valid\n holderNameRequired: !props.hasHolderName ? false : props.holderNameRequired,\n // False for *stored* BCMC cards & if merchant explicitly wants to hide the CVC field\n hasCVC: !((props.brand && props.brand === 'bcmc') || props.hideCVC),\n // billingAddressRequired only available for non-stored cards\n billingAddressRequired: props.storedPaymentMethodId ? false : props.billingAddressRequired,\n // ...(props.brands && !props.groupTypes && { groupTypes: props.brands }),\n /** props.brand will be specified in the case of a StoredCard or a Bancontact component, for a regular Card we default it to 'card' */\n brand: props.brand ?? TxVariants.card,\n countryCode: props.countryCode ? props.countryCode.toLowerCase() : null,\n // Required for transition period (until configuration object becomes the norm)\n // - if merchant has defined value directly in props, use this instead\n configuration: {\n ...props.configuration,\n socialSecurityNumberMode: props.configuration?.socialSecurityNumberMode ?? 'auto'\n },\n brandsConfiguration: props.brandsConfiguration || props.configuration?.brandsConfiguration || {},\n icon: props.icon || props.configuration?.icon,\n // installmentOptions of a session should be used before falling back to the merchant configuration\n installmentOptions: props.session?.configuration?.installmentOptions || props.installmentOptions,\n enableStoreDetails,\n /**\n * Click to Pay configuration\n * - If email is set explicitly in the configuration, then it can override the one used in the session creation\n */\n clickToPayConfiguration: {\n ...props.clickToPayConfiguration,\n disableOtpAutoFocus: props.clickToPayConfiguration?.disableOtpAutoFocus || false,\n shopperEmail: props.clickToPayConfiguration?.shopperEmail || this.core.options?.session?.shopperEmail,\n telephoneNumber: props.clickToPayConfiguration?.telephoneNumber || this.core.options?.session?.telephoneNumber,\n locale: props.clickToPayConfiguration?.locale || props.i18n?.locale?.replace('-', '_')\n },\n ...(storedCardID && { storedPaymentMethodId: storedCardID })\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData(): CardElementData {\n /**\n * this.state.selectedBrandValue will be set when:\n * - /binLookup detects a single brand,\n * - when /binLookup detects a dual-branded card and the shopper makes a brand selection\n * - or, in the case of a storedCard\n */\n const cardBrand = this.state.selectedBrandValue;\n const includeStorePaymentMethod = this.props.enableStoreDetails && typeof this.state.storePaymentMethod !== 'undefined';\n\n return {\n paymentMethod: {\n type: CardElement.type,\n ...this.state.data,\n ...(this.props.storedPaymentMethodId && { storedPaymentMethodId: this.props.storedPaymentMethodId }),\n ...(cardBrand && { brand: cardBrand }),\n ...(this.props.fundingSource && { fundingSource: this.props.fundingSource })\n },\n ...(this.state.billingAddress && { billingAddress: this.state.billingAddress }),\n ...(this.state.socialSecurityNumber && { socialSecurityNumber: this.state.socialSecurityNumber }),\n ...(includeStorePaymentMethod && { storePaymentMethod: Boolean(this.state.storePaymentMethod) }),\n ...(hasValidInstallmentsObject(this.state.installments) && { installments: this.state.installments }),\n browserInfo: this.browserInfo,\n origin: !!window && window.location.origin\n };\n }\n\n updateStyles(stylesObj) {\n if (this.componentRef?.updateStyles) this.componentRef.updateStyles(stylesObj);\n return this;\n }\n\n setFocusOn(fieldName) {\n if (this.componentRef?.setFocusOn) this.componentRef.setFocusOn(fieldName);\n return this;\n }\n\n public onBrand = event => {\n this.props.onBrand?.(event);\n };\n\n processBinLookupResponse(binLookupResponse: BinLookupResponse, isReset = false) {\n if (this.componentRef?.processBinLookupResponse) this.componentRef.processBinLookupResponse(binLookupResponse, isReset);\n return this;\n }\n\n handleUnsupportedCard(errObj) {\n if (this.componentRef?.handleUnsupportedCard) this.componentRef.handleUnsupportedCard(errObj);\n return this;\n }\n\n private handleClickToPaySubmit = (payload: ClickToPayCheckoutPayload) => {\n this.setState({ data: { ...payload }, valid: {}, errors: {}, isValid: true });\n this.submit();\n };\n\n onBinLookup(obj: CbObjOnBinLookup) {\n // Handler for regular card comp doesn't need this 'raw' data or to know about 'resets'\n if (!obj.isReset) {\n const nuObj = reject('supportedBrandsRaw').from(obj);\n this.props.onBinLookup(nuObj);\n }\n }\n\n protected submitAnalytics(analyticsObj: SendAnalyticsObject) {\n const { type } = analyticsObj;\n\n if (type === ANALYTICS_RENDERED_STR || type === ANALYTICS_CONFIGURED_STR) {\n // Check if it's a storedCard\n if (this.constructor['type'] === 'scheme') {\n if (hasOwnProperty(this.props, 'supportedShopperInteractions')) {\n analyticsObj.isStoredPaymentMethod = true;\n analyticsObj.brand = this.props.brand;\n }\n }\n }\n\n super.submitAnalytics(analyticsObj);\n }\n\n private onConfigSuccess = (obj: CbObjOnConfigSuccess) => {\n this.submitAnalytics({\n type: ANALYTICS_CONFIGURED_STR\n });\n\n this.props.onConfigSuccess?.(obj);\n };\n\n private onFocus = (obj: ComponentFocusObject) => {\n this.submitAnalytics({\n type: ANALYTICS_FOCUS_STR,\n target: fieldTypeToSnakeCase(obj.fieldType)\n });\n\n // Call merchant defined callback\n if (ALL_SECURED_FIELDS.includes(obj.fieldType)) {\n this.props.onFocus?.(obj.event as CbObjOnFocus);\n } else {\n this.props.onFocus?.(obj);\n }\n };\n\n private onBlur = (obj: ComponentFocusObject) => {\n this.submitAnalytics({\n type: ANALYTICS_UNFOCUS_STR,\n target: fieldTypeToSnakeCase(obj.fieldType)\n });\n\n // Call merchant defined callback\n if (ALL_SECURED_FIELDS.includes(obj.fieldType)) {\n this.props.onBlur?.(obj.event as CbObjOnFocus);\n } else {\n this.props.onBlur?.(obj);\n }\n };\n\n private onErrorAnalytics = (obj: FieldErrorAnalyticsObject) => {\n this.submitAnalytics({\n type: ANALYTICS_VALIDATION_ERROR_STR,\n target: fieldTypeToSnakeCase(obj.fieldType),\n validationErrorCode: obj.errorCode,\n validationErrorMessage: obj.errorMessage\n });\n };\n\n public onBinValue = triggerBinLookUp(this);\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n get icon() {\n return this.props.icon ?? this.resources.getImage()(this.props.brand);\n }\n\n get brands(): { icon: any; name: string }[] {\n const { brands, brandsConfiguration } = this.props;\n if (brands) {\n return brands.map(brand => {\n const brandIcon = brandsConfiguration[brand]?.icon ?? this.props.modules.resources.getImage()(brand);\n return { icon: brandIcon, name: brand };\n });\n }\n\n return [];\n }\n\n get displayName(): string {\n if (this.props.storedPaymentMethodId) {\n return `•••• ${this.props.lastFour}`;\n }\n\n return this.props.name || CardElement.type;\n }\n\n get accessibleName(): string {\n // Use display name, unless it's a stored payment method, there inform user\n return (\n (this.props.name || CardElement.type) +\n (this.props.storedPaymentMethodId\n ? ' ' + this.props.i18n.get('creditCard.storedCard.description.ariaLabel').replace('%@', this.props.lastFour)\n : '')\n );\n }\n\n get browserInfo() {\n return collectBrowserInfo();\n }\n // Override\n protected payButton = (props: PayButtonProps) => {\n const isZeroAuth = this.props.amount?.value === 0;\n const isStoredCard = this.props.storedPaymentMethodId?.length > 0;\n return (\n <PayButton\n {...props}\n amount={this.props.amount}\n secondaryAmount={this.props.secondaryAmount}\n label={isZeroAuth && !isStoredCard ? this.props.i18n.get('payButton.saveDetails') : ''}\n onClick={this.submit}\n />\n );\n };\n\n private renderCardInput(isCardPrimaryInput = true): h.JSX.Element {\n return (\n <CardInput\n setComponentRef={this.setComponentRef}\n {...this.props}\n {...this.state}\n onChange={this.setState}\n onSubmit={this.submit}\n payButton={this.payButton}\n onBrand={this.onBrand}\n onBinValue={this.onBinValue}\n brand={this.props.brand}\n brandsIcons={this.brands}\n isPayButtonPrimaryVariant={isCardPrimaryInput}\n resources={this.resources}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n onErrorAnalytics={this.onErrorAnalytics}\n onConfigSuccess={this.onConfigSuccess}\n />\n );\n }\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <SRPanelProvider srPanel={this.props.modules.srPanel}>\n <ClickToPayWrapper\n amount={this.props.amount}\n configuration={this.props.clickToPayConfiguration}\n clickToPayService={this.clickToPayService}\n isStandaloneComponent={false}\n setClickToPayRef={this.setClickToPayRef}\n onSetStatus={this.setElementStatus}\n onSubmit={this.handleClickToPaySubmit}\n onError={this.handleError}\n >\n {isCardPrimaryInput => this.renderCardInput(isCardPrimaryInput)}\n </ClickToPayWrapper>\n </SRPanelProvider>\n </CoreProvider>\n );\n }\n}\n\nexport default CardElement;\n"],"names":["CardElement","UIElement","static","TxVariants","scheme","clickToPayService","clickToPayRef","constructor","checkout","props","super","_disableClickToPay","this","createClickToPayService","configuration","clickToPayConfiguration","environment","initialize","onBinLookup","showFormInstruction","setStatus","status","componentRef","setClickToPayRef","ref","formatProps","enableStoreDetails","amount","value","session","storedCardID","storedPaymentMethodId","id","isEcommerceStoredCard","supportedShopperInteractions","includes","AdyenCheckoutError","IMPLEMENTATION_ERROR","holderNameRequired","hasHolderName","hasCVC","brand","hideCVC","billingAddressRequired","card","countryCode","toLowerCase","socialSecurityNumberMode","brandsConfiguration","icon","installmentOptions","disableOtpAutoFocus","shopperEmail","core","options","telephoneNumber","locale","i18n","replace","formatData","cardBrand","state","selectedBrandValue","includeStorePaymentMethod","storePaymentMethod","paymentMethod","type","data","fundingSource","billingAddress","socialSecurityNumber","Boolean","hasValidInstallmentsObject","installments","browserInfo","origin","window","location","updateStyles","stylesObj","setFocusOn","fieldName","onBrand","event","processBinLookupResponse","binLookupResponse","isReset","handleUnsupportedCard","errObj","handleClickToPaySubmit","payload","setState","valid","errors","isValid","submit","obj","nuObj","reject","from","submitAnalytics","analyticsObj","ANALYTICS_RENDERED_STR","ANALYTICS_CONFIGURED_STR","hasOwnProperty","isStoredPaymentMethod","onConfigSuccess","onFocus","ANALYTICS_FOCUS_STR","target","fieldTypeToSnakeCase","fieldType","ALL_SECURED_FIELDS","onBlur","ANALYTICS_UNFOCUS_STR","onErrorAnalytics","ANALYTICS_VALIDATION_ERROR_STR","validationErrorCode","errorCode","validationErrorMessage","errorMessage","onBinValue","triggerBinLookUp","resources","getImage","brands","map","modules","name","displayName","lastFour","accessibleName","get","collectBrowserInfo","payButton","isZeroAuth","isStoredCard","length","h","PayButton","secondaryAmount","label","onClick","renderCardInput","isCardPrimaryInput","CardInput","setComponentRef","onChange","onSubmit","brandsIcons","isPayButtonPrimaryVariant","render","CoreProvider","loadingContext","SRPanelProvider","srPanel","ClickToPayWrapper","isStandaloneComponent","onSetStatus","setElementStatus","onError","handleError"],"mappings":"+rCAgCO,MAAMA,UAAoBC,EAC7BC,YAAqBC,EAAWC,OAEfC,kBAKTC,cAAgB,KAExBC,WAAAA,CAAYC,EAAiBC,GACzBC,MAAMF,EAAUC,GAEZA,IAAUA,EAAME,qBAChBC,KAAKP,kBAAoBQ,EAAwBD,KAAKH,MAAMK,cAAeF,KAAKH,MAAMM,wBAAyBH,KAAKH,MAAMO,aAC1HJ,KAAKP,mBAAmBY,aAEhC,CAEAf,oBAAgC,CAC5BgB,YAAa,OACbC,qBAAqB,EACrBR,oBAAoB,GAGjBS,SAAAA,CAAUC,EAAyBZ,GAOtC,OANIG,KAAKU,cAAcF,WACnBR,KAAKU,aAAaF,UAAUC,EAAQZ,GAEpCG,KAAKN,eAAec,WACpBR,KAAKN,cAAcc,UAAUC,EAAQZ,GAElCG,IACX,CAEQW,iBAAmBC,IACvBZ,KAAKN,cAAgBkB,CAAAA,EAGzBC,WAAAA,CAAYhB,GACR,MACMiB,IADqC,IAAxBjB,EAAMkB,QAAQC,SACenB,EAAMoB,SAASf,eAAeY,oBAAsB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AAMgD,KAAMgG,eAAgB7I,KAAKH,MAAMgJ,eAAgB9B,UAAW/G,KAAK+G,WAC5Fe,EAACgB,EAAAA,CAAgBC,QAAS/I,KAAKH,MAAMsH,QAAQ4B,SACzCjB,EAACkB,EAAAA,CACGjI,OAAQf,KAAKH,MAAMkB,OACnBb,cAAeF,KAAKH,MAAMM,wBAC1BV,kBAAmBO,KAAKP,kBACxBwJ,uBAAuB,EACvBtI,iBAAkBX,KAAKW,iBACvBuI,YAAalJ,KAAKmJ,iBAClBX,SAAUxI,KAAK6E,uBACfuE,QAASpJ,KAAKqJ,cAEbjB,GAAsBpI,KAAKmI,gBAAgBC,MAKhE"}
1
+ {"version":3,"file":"Card.js","sources":["../../../../src/components/Card/Card.tsx"],"sourcesContent":["import { h } from 'preact';\nimport CardInput from './components/CardInput';\nimport CoreProvider from '../../core/Context/CoreProvider';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport { BinLookupResponse, CardElementData, CardConfiguration } from './types';\nimport triggerBinLookUp from '../internal/SecuredFields/binLookup/triggerBinLookUp';\nimport { CbObjOnBinLookup, CbObjOnConfigSuccess, CbObjOnFocus } from '../internal/SecuredFields/lib/types';\nimport { fieldTypeToSnakeCase, reject } from '../internal/SecuredFields/utils';\nimport { hasValidInstallmentsObject } from './components/CardInput/utils';\nimport createClickToPayService from '../internal/ClickToPay/services/create-clicktopay-service';\nimport { ClickToPayCheckoutPayload, IClickToPayService } from '../internal/ClickToPay/services/types';\nimport ClickToPayWrapper from './components/ClickToPayWrapper';\nimport { ComponentFocusObject } from '../../types/global-types';\nimport SRPanelProvider from '../../core/Errors/SRPanelProvider';\nimport { TxVariants } from '../tx-variants';\nimport { UIElementStatus } from '../internal/UIElement/types';\nimport UIElement from '../internal/UIElement';\nimport PayButton from '../internal/PayButton';\nimport { PayButtonProps } from '../internal/PayButton/PayButton';\nimport type { ICore } from '../../core/types';\nimport {\n ANALYTICS_FOCUS_STR,\n ANALYTICS_CONFIGURED_STR,\n ANALYTICS_UNFOCUS_STR,\n ANALYTICS_VALIDATION_ERROR_STR,\n ANALYTICS_RENDERED_STR\n} from '../../core/Analytics/constants';\nimport { ALL_SECURED_FIELDS } from '../internal/SecuredFields/lib/configuration/constants';\nimport { FieldErrorAnalyticsObject, SendAnalyticsObject } from '../../core/Analytics/types';\nimport { hasOwnProperty } from '../../utils/hasOwnProperty';\nimport AdyenCheckoutError, { IMPLEMENTATION_ERROR } from '../../core/Errors/AdyenCheckoutError';\nimport { getErrorMessageFromCode } from '../../core/Errors/utils';\nimport { SF_ErrorCodes } from '../../core/Errors/constants';\n\nexport class CardElement extends UIElement<CardConfiguration> {\n public static type = TxVariants.scheme;\n\n private readonly clickToPayService: IClickToPayService | null;\n\n /**\n * Reference to the 'ClickToPayComponent'\n */\n private clickToPayRef = null;\n\n constructor(checkout: ICore, props?: CardConfiguration) {\n super(checkout, props);\n\n if (props && !props._disableClickToPay) {\n this.clickToPayService = createClickToPayService(this.props.configuration, this.props.clickToPayConfiguration, this.props.environment);\n this.clickToPayService?.initialize();\n }\n }\n\n protected static defaultProps = {\n onBinLookup: () => {},\n showFormInstruction: true,\n _disableClickToPay: false\n };\n\n public setStatus(status: UIElementStatus, props?): this {\n if (this.componentRef?.setStatus) {\n this.componentRef.setStatus(status, props);\n }\n if (this.clickToPayRef?.setStatus) {\n this.clickToPayRef.setStatus(status, props);\n }\n return this;\n }\n\n private setClickToPayRef = ref => {\n this.clickToPayRef = ref;\n };\n\n formatProps(props: CardConfiguration) {\n // The value from a session should be used, before falling back to the merchant configuration\n const enableStoreDetails = props.session?.configuration?.enableStoreDetails ?? props.enableStoreDetails;\n\n const isZeroAuth = props.amount?.value === 0;\n const showStoreDetailsCheckbox = isZeroAuth ? false : enableStoreDetails;\n\n const storedCardID = props.storedPaymentMethodId || props.id; // check if we've been passed a (checkout) processed storedCard or one that merchant has pulled from the PMs response\n const isEcommerceStoredCard = storedCardID && props?.supportedShopperInteractions?.includes('Ecommerce'); // If we have a storedCard does it support Ecommerce (it might not if the merchant has pulled it from the PMs response)\n\n // If we have a storedPM but it doesn't support Ecommerce - we can't make a storedCard component from it\n if (storedCardID && !isEcommerceStoredCard) {\n // TODO - Decide if an error is too severe? Would a console.warning suffice?\n throw new AdyenCheckoutError(\n IMPLEMENTATION_ERROR,\n 'You are trying to create a storedCard from a stored PM that does not support Ecommerce interactions'\n );\n }\n\n return {\n ...props,\n // Mismatch between hasHolderName & holderNameRequired which can mean card can never be valid\n holderNameRequired: !props.hasHolderName ? false : props.holderNameRequired,\n // False for *stored* BCMC cards & if merchant explicitly wants to hide the CVC field\n hasCVC: !((props.brand && props.brand === 'bcmc') || props.hideCVC),\n // billingAddressRequired only available for non-stored cards\n billingAddressRequired: props.storedPaymentMethodId ? false : props.billingAddressRequired,\n // ...(props.brands && !props.groupTypes && { groupTypes: props.brands }),\n /** props.brand will be specified in the case of a StoredCard or a Bancontact component, for a regular Card we default it to 'card' */\n brand: props.brand ?? TxVariants.card,\n countryCode: props.countryCode ? props.countryCode.toLowerCase() : null,\n // Required for transition period (until configuration object becomes the norm)\n // - if merchant has defined value directly in props, use this instead\n configuration: {\n ...props.configuration,\n socialSecurityNumberMode: props.configuration?.socialSecurityNumberMode ?? 'auto'\n },\n brandsConfiguration: props.brandsConfiguration || props.configuration?.brandsConfiguration || {},\n icon: props.icon || props.configuration?.icon,\n // installmentOptions of a session should be used before falling back to the merchant configuration\n installmentOptions: props.session?.configuration?.installmentOptions || props.installmentOptions,\n enableStoreDetails,\n showStoreDetailsCheckbox,\n /**\n * Click to Pay configuration\n * - If email is set explicitly in the configuration, then it can override the one used in the session creation\n */\n clickToPayConfiguration: {\n ...props.clickToPayConfiguration,\n disableOtpAutoFocus: props.clickToPayConfiguration?.disableOtpAutoFocus || false,\n shopperEmail: props.clickToPayConfiguration?.shopperEmail || this.core.options?.session?.shopperEmail,\n telephoneNumber: props.clickToPayConfiguration?.telephoneNumber || this.core.options?.session?.telephoneNumber,\n locale: props.clickToPayConfiguration?.locale || props.i18n?.locale?.replace('-', '_')\n },\n ...(storedCardID && { storedPaymentMethodId: storedCardID })\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData(): CardElementData {\n /**\n * this.state.selectedBrandValue will be set when:\n * - /binLookup detects a single brand,\n * - when /binLookup detects a dual-branded card and the shopper makes a brand selection\n * - or, in the case of a storedCard\n */\n const cardBrand = this.state.selectedBrandValue;\n\n return {\n paymentMethod: {\n type: CardElement.type,\n ...this.state.data,\n ...(this.props.storedPaymentMethodId && { storedPaymentMethodId: this.props.storedPaymentMethodId }),\n ...(cardBrand && { brand: cardBrand }),\n ...(this.props.fundingSource && { fundingSource: this.props.fundingSource })\n },\n ...(this.state.billingAddress && { billingAddress: this.state.billingAddress }),\n ...(this.state.socialSecurityNumber && { socialSecurityNumber: this.state.socialSecurityNumber }),\n ...this.storePaymentMethodPayload,\n ...(hasValidInstallmentsObject(this.state.installments) && { installments: this.state.installments }),\n browserInfo: this.browserInfo,\n origin: !!window && window.location.origin\n };\n }\n\n updateStyles(stylesObj) {\n if (this.componentRef?.updateStyles) this.componentRef.updateStyles(stylesObj);\n return this;\n }\n\n setFocusOn(fieldName) {\n if (this.componentRef?.setFocusOn) this.componentRef.setFocusOn(fieldName);\n return this;\n }\n\n public onBrand = event => {\n this.props.onBrand?.(event);\n };\n\n processBinLookupResponse(binLookupResponse: BinLookupResponse, isReset = false) {\n if (this.componentRef?.processBinLookupResponse) this.componentRef.processBinLookupResponse(binLookupResponse, isReset);\n return this;\n }\n\n handleUnsupportedCard(errObj) {\n if (this.componentRef?.handleUnsupportedCard) this.componentRef.handleUnsupportedCard(errObj);\n return this;\n }\n\n private handleClickToPaySubmit = (payload: ClickToPayCheckoutPayload) => {\n this.setState({ data: { ...payload }, valid: {}, errors: {}, isValid: true });\n this.submit();\n };\n\n onBinLookup(obj: CbObjOnBinLookup) {\n // Handler for regular card comp doesn't need this 'raw' data or to know about 'resets'\n if (!obj.isReset) {\n const nuObj = reject('supportedBrandsRaw').from(obj);\n this.props.onBinLookup(nuObj);\n }\n }\n\n protected submitAnalytics(analyticsObj: SendAnalyticsObject) {\n const { type } = analyticsObj;\n\n if (type === ANALYTICS_RENDERED_STR || type === ANALYTICS_CONFIGURED_STR) {\n // Check if it's a storedCard\n if (this.constructor['type'] === 'scheme') {\n if (hasOwnProperty(this.props, 'supportedShopperInteractions')) {\n analyticsObj.isStoredPaymentMethod = true;\n analyticsObj.brand = this.props.brand;\n }\n }\n }\n\n super.submitAnalytics(analyticsObj);\n }\n\n private onConfigSuccess = (obj: CbObjOnConfigSuccess) => {\n this.submitAnalytics({\n type: ANALYTICS_CONFIGURED_STR\n });\n\n this.props.onConfigSuccess?.(obj);\n };\n\n private onFocus = (obj: ComponentFocusObject) => {\n this.submitAnalytics({\n type: ANALYTICS_FOCUS_STR,\n target: fieldTypeToSnakeCase(obj.fieldType)\n });\n\n // Call merchant defined callback\n if (ALL_SECURED_FIELDS.includes(obj.fieldType)) {\n this.props.onFocus?.(obj.event as CbObjOnFocus);\n } else {\n this.props.onFocus?.(obj);\n }\n };\n\n private onBlur = (obj: ComponentFocusObject) => {\n this.submitAnalytics({\n type: ANALYTICS_UNFOCUS_STR,\n target: fieldTypeToSnakeCase(obj.fieldType)\n });\n\n // Call merchant defined callback\n if (ALL_SECURED_FIELDS.includes(obj.fieldType)) {\n this.props.onBlur?.(obj.event as CbObjOnFocus);\n } else {\n this.props.onBlur?.(obj);\n }\n };\n\n private onValidationErrorAnalytics = (obj: FieldErrorAnalyticsObject) => {\n this.submitAnalytics({\n type: ANALYTICS_VALIDATION_ERROR_STR,\n target: fieldTypeToSnakeCase(obj.fieldType),\n validationErrorCode: obj.errorCode,\n validationErrorMessage: getErrorMessageFromCode(obj.errorCode, SF_ErrorCodes)\n });\n };\n\n public onBinValue = triggerBinLookUp(this);\n\n get storePaymentMethodPayload() {\n const isStoredCard = this.props.storedPaymentMethodId?.length > 0;\n if (isStoredCard) {\n return {};\n }\n\n /**\n * For regular card, zero auth payments, we store the payment method, *if* the configuration says we should:\n * - For sessions, this means if the session has been created with storePaymentMethodMode: 'askForConsent'\n * - For the advanced flow, this means if the merchant has still set enableStoreDetails: true\n *\n * What we are doing is.. if for a normal payment we would show the \"Save for my next payment\" checkbox,\n * for a zero-auth payment we effectively click the checkbox on behalf of the shopper.\n */\n const isZeroAuth = this.props.amount?.value === 0;\n if (isZeroAuth) {\n return this.props.enableStoreDetails ? { storePaymentMethod: true } : {};\n }\n\n // For regular card, non-zero auth payments, we store the payment method based on the checkbox value.\n // const includeStorePaymentMethod = this.props.enableStoreDetails && typeof this.state.storePaymentMethod !== 'undefined';\n const includeStorePaymentMethod = this.props.showStoreDetailsCheckbox && typeof this.state.storePaymentMethod !== 'undefined';\n return includeStorePaymentMethod ? { storePaymentMethod: Boolean(this.state.storePaymentMethod) } : {};\n }\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n get icon() {\n return this.props.icon ?? this.resources.getImage()(this.props.brand);\n }\n\n get brands(): { icon: any; name: string }[] {\n const { brands, brandsConfiguration } = this.props;\n if (brands) {\n return brands.map(brand => {\n const brandIcon = brandsConfiguration[brand]?.icon ?? this.props.modules.resources.getImage()(brand);\n return { icon: brandIcon, name: brand };\n });\n }\n\n return [];\n }\n\n get displayName(): string {\n if (this.props.storedPaymentMethodId) {\n return `•••• ${this.props.lastFour}`;\n }\n\n return this.props.name || CardElement.type;\n }\n\n get accessibleName(): string {\n // Use display name, unless it's a stored payment method, there inform user\n return (\n (this.props.name || CardElement.type) +\n (this.props.storedPaymentMethodId\n ? ' ' + this.props.i18n.get('creditCard.storedCard.description.ariaLabel').replace('%@', this.props.lastFour)\n : '')\n );\n }\n\n get browserInfo() {\n return collectBrowserInfo();\n }\n // Override\n protected payButton = (props: PayButtonProps) => {\n const isZeroAuth = this.props.amount?.value === 0;\n const isStoredCard = this.props.storedPaymentMethodId?.length > 0;\n return (\n <PayButton\n {...props}\n amount={this.props.amount}\n secondaryAmount={this.props.secondaryAmount}\n label={isZeroAuth && !isStoredCard ? this.props.i18n.get('payButton.saveDetails') : ''}\n onClick={this.submit}\n />\n );\n };\n\n private renderCardInput(isCardPrimaryInput = true): h.JSX.Element {\n return (\n <CardInput\n setComponentRef={this.setComponentRef}\n {...this.props}\n {...this.state}\n onChange={this.setState}\n onSubmit={this.submit}\n payButton={this.payButton}\n onBrand={this.onBrand}\n onBinValue={this.onBinValue}\n brand={this.props.brand}\n brandsIcons={this.brands}\n isPayButtonPrimaryVariant={isCardPrimaryInput}\n resources={this.resources}\n onFocus={this.onFocus}\n onBlur={this.onBlur}\n onValidationErrorAnalytics={this.onValidationErrorAnalytics}\n onConfigSuccess={this.onConfigSuccess}\n />\n );\n }\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <SRPanelProvider srPanel={this.props.modules.srPanel}>\n <ClickToPayWrapper\n amount={this.props.amount}\n configuration={this.props.clickToPayConfiguration}\n clickToPayService={this.clickToPayService}\n isStandaloneComponent={false}\n setClickToPayRef={this.setClickToPayRef}\n onSetStatus={this.setElementStatus}\n onSubmit={this.handleClickToPaySubmit}\n onError={this.handleError}\n >\n {isCardPrimaryInput => this.renderCardInput(isCardPrimaryInput)}\n </ClickToPayWrapper>\n </SRPanelProvider>\n </CoreProvider>\n );\n }\n}\n\nexport default CardElement;\n"],"names":["CardElement","UIElement","static","TxVariants","scheme","clickToPayService","clickToPayRef","constructor","checkout","props","super","_disableClickToPay","this","createClickToPayService","configuration","clickToPayConfiguration","environment","initialize","onBinLookup","showFormInstruction","setStatus","status","componentRef","setClickToPayRef","ref","formatProps","enableStoreDetails","session","showStoreDetailsCheckbox","amount","value","storedCardID","storedPaymentMethodId","id","isEcommerceStoredCard","supportedShopperInteractions","includes","AdyenCheckoutError","IMPLEMENTATION_ERROR","holderNameRequired","hasHolderName","hasCVC","brand","hideCVC","billingAddressRequired","card","countryCode","toLowerCase","socialSecurityNumberMode","brandsConfiguration","icon","installmentOptions","disableOtpAutoFocus","shopperEmail","core","options","telephoneNumber","locale","i18n","replace","formatData","cardBrand","state","selectedBrandValue","paymentMethod","type","data","fundingSource","billingAddress","socialSecurityNumber","storePaymentMethodPayload","hasValidInstallmentsObject","installments","browserInfo","origin","window","location","updateStyles","stylesObj","setFocusOn","fieldName","onBrand","event","processBinLookupResponse","binLookupResponse","isReset","handleUnsupportedCard","errObj","handleClickToPaySubmit","payload","setState","valid","errors","isValid","submit","obj","nuObj","reject","from","submitAnalytics","analyticsObj","ANALYTICS_RENDERED_STR","ANALYTICS_CONFIGURED_STR","hasOwnProperty","isStoredPaymentMethod","onConfigSuccess","onFocus","ANALYTICS_FOCUS_STR","target","fieldTypeToSnakeCase","fieldType","ALL_SECURED_FIELDS","onBlur","ANALYTICS_UNFOCUS_STR","onValidationErrorAnalytics","ANALYTICS_VALIDATION_ERROR_STR","validationErrorCode","errorCode","validationErrorMessage","getErrorMessageFromCode","SF_ErrorCodes","onBinValue","triggerBinLookUp","length","storePaymentMethod","Boolean","resources","getImage","brands","map","modules","name","displayName","lastFour","accessibleName","get","collectBrowserInfo","payButton","isZeroAuth","isStoredCard","h","PayButton","secondaryAmount","label","onClick","renderCardInput","isCardPrimaryInput","CardInput","setComponentRef","onChange","onSubmit","brandsIcons","isPayButtonPrimaryVariant","render","CoreProvider","loadingContext","SRPanelProvider","srPanel","ClickToPayWrapper","isStandaloneComponent","onSetStatus","setElementStatus","onError","handleError"],"mappings":"m0CAkCO,MAAMA,UAAoBC,EAC7BC,YAAqBC,EAAWC,OAEfC,kBAKTC,cAAgB,KAExBC,WAAAA,CAAYC,EAAiBC,GACzBC,MAAMF,EAAUC,GAEZA,IAAUA,EAAME,qBAChBC,KAAKP,kBAAoBQ,EAAwBD,KAAKH,MAAMK,cAAeF,KAAKH,MAAMM,wBAAyBH,KAAKH,MAAMO,aAC1HJ,KAAKP,mBAAmBY,aAEhC,CAEAf,oBAAgC,CAC5BgB,YAAa,OACbC,qBAAqB,EACrBR,oBAAoB,GAGjBS,SAAAA,CAAUC,EAAy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AAI,yBAA2B,GACpFS,QAASpI,KAAKkF,UAKlBmD,eAAAA,CAAgBC,GAAqB,GACzC,OACIN,EAACO,EAAAA,CACGC,gBAAiBxI,KAAKwI,mBAClBxI,KAAKH,SACLG,KAAKkD,MACTuF,SAAUzI,KAAK8E,SACf4D,SAAU1I,KAAKkF,OACf2C,UAAW7H,KAAK6H,UAChBxD,QAASrE,KAAKqE,QACdwC,WAAY7G,KAAK6G,WACjB/E,MAAO9B,KAAKH,MAAMiC,MAClB6G,YAAa3I,KAAKoH,OAClBwB,0BAA2BN,EAC3BpB,UAAWlH,KAAKkH,UAChBpB,QAAS9F,KAAK8F,QACdM,OAAQpG,KAAKoG,OACbE,2BAA4BtG,KAAKsG,2BACjCT,gBAAiB7F,KAAK6F,iBAGlC,CAEAgD,MAAAA,GACI,OACIb,EAACc,EAAAA,CAAahG,KAAM9C,KAAKH,MAAMiD,KAAMiG,eAAgB/I,KAAKH,MAAMkJ,eAAgB7B,UAAWlH,KAAKkH,WAC5Fc,EAACgB,EAAAA,CAAgBC,QAASjJ,KAAKH,MAAMyH,QAAQ2B,SACzCjB,EAACkB,EAAAA,CACGjI,OAAQjB,KAAKH,MAAMoB,OACnBf,cAAeF,KAAKH,MAAMM,wBAC1BV,kBAAmBO,KAAKP,kBACxB0J,uBAAuB,EACvBxI,iBAAkBX,KAAKW,iBACvByI,YAAapJ,KAAKqJ,iBAClBX,SAAU1I,KAAK4E,uBACf0E,QAAStJ,KAAKuJ,cAEbjB,GAAsBtI,KAAKqI,gBAAgBC,MAKhE"}
@@ -1,2 +1,2 @@
1
- import{createElement as e,Fragment as r}from"../../../../external/preact/dist/preact.js";import{useRef as s,useMemo as o,useState as t,useCallback as n,useEffect as a}from"../../../../external/preact/hooks/dist/hooks.js";import l from"../../../internal/SecuredFields/SFP/SecuredFieldsProvider.js";import i from"./defaultProps.js";import{AddressModeOptions as d}from"./types.js";import{DATE_POLICY_REQUIRED as u,CVC_POLICY_REQUIRED as c}from"../../../internal/SecuredFields/lib/configuration/constants.js";import{cardInputFormatters as m,cardInputValidationRules as p,getRuleByNameAndMode as h}from"./validate.js";import b from"../../../internal/SecuredFields/binLookup/extensions.js";import y from"../../../../utils/useForm/useForm.js";import{mapFieldKey as f,handlePartialAddressMode as N,extractPropsForSFP as S,extractPropsForCardFields as g,getLayout as A,lookupBlurBasedErrors as F}from"./utils.js";import{usePrevious as C}from"../../../../utils/hookUtils.js";import j from"../../../internal/Address/Specifications.js";import{StoredCardFieldsWrapper as k}from"./components/StoredCardFieldsWrapper.js";import{CardFieldsWrapper as R}from"./components/CardFieldsWrapper.js";import{getAutoJumpHandler as x,setFocusOnFirstField as w,getFocusHandler as B,getAddressHandler as P}from"./handlers.js";import v from"../../../../external/classnames/index.js";import{getPartialAddressValidationRules as I}from"../../../internal/Address/validate.js";import{ERROR_ACTION_BLUR_SCENARIO as M,ERROR_ACTION_FOCUS_FIELD as E}from"../../../../core/Errors/constants.js";import V from"../../../../core/Errors/useSRPanelContext.js";import O from"../../../../core/Context/useImage.js";import{getArrayDifferences as q}from"../../../../utils/arrayUtils.js";import D from"../../../internal/FormInstruction/FormInstruction.js";const T=i=>{const T=s(null),L=s(!1),_=O(),{setSRMessagesFromObjects:K,setSRMessagesFromStrings:H,clearSRPanel:U,shouldMoveFocusSR:z}=V(),W=K?.({fieldTypeMappingFn:f}),$=s(null),G=e=>{$.current=e},J=s({});Object.keys(J.current).length||i.setComponentRef(J.current);const Q=s(0),X=s(!1),Y=o((()=>new j(i.specifications)),[i.specifications]);J.current.sfp=T;const[Z,ee]=t("ready"),[re,se]=t({}),[oe,te]=t({...i.holderNameRequired&&{holderName:!1}}),[ne,ae]=t({...i.hasHolderName&&{holderName:i.data.holderName??""}}),[le,ie]=t(null),[de,ue]=t(""),[ce,me]=t(!1),[pe,he]=t(u),[be,ye]=t(c),[fe,Ne]=t(null),[Se,ge]=t([]),[Ae,Fe]=t(i.storedPaymentMethodId?i.brand:""),Ce=i.billingAddressMode!==d.none&&i.billingAddressRequired,je=N(i.billingAddressMode),ke=s(je&&i.data?.billingAddress?.country),[Re,xe]=t(!1),[we,Be]=t(Ce?i.data.billingAddress:null),[Pe,ve]=t(!1),[Ie,Me]=t(""),[Ee,Ve]=t({value:null}),[Oe,qe]=t(null),{handleChangeFor:De,triggerValidation:Te,data:Le,valid:_e,errors:Ke,setSchema:He,setData:Ue,setValid:ze,setErrors:We}=y({schema:[],defaultData:i.data,formatters:m,rules:p}),$e=!!Object.keys(i.installmentOptions).length&&"debit"!==i.fundingSource,Ge=i.showInstallmentAmounts??!0,Je="kr"===(fe??i.countryCode),Qe=i.configuration.koreanAuthenticationRequired&&Je,Xe=Pe&&"auto"===i.configuration.socialSecurityNumberMode||"show"===i.configuration.socialSecurityNumberMode,Ye=(e,r)=>{i.onFocus({fieldType:e,event:r})},Ze=(e,r)=>{i.onBlur({fieldType:e,event:r})},er=B(ue,Ye,Ze),rr=()=>A({props:i,showKCP:Qe,showBrazilianSSN:Xe,...i.billingAddressRequired&&{countrySpecificSchemas:Y.getAddressSchemaForCountry(we?.country),billingAddressRequiredFields:i.billingAddressRequiredFields}}),sr=n((e=>{const r="webInternalElement"!==e.fieldType?e.fieldType:e.name;qe(r)}),[]),or=P(Ue,ze,We),tr=x(X,T,rr()),nr=o((()=>b(i,{sfp:T},{dualBrandSelectElements:Se,setDualBrandSelectElements:ge,setSelectedBrandValue:Fe,issuingCountryCode:fe,setIssuingCountryCode:Ne},Q)),[Se,fe]);J.current.showValidation=()=>{L.current=!0,U?.(),T.current.showValidation(),Te(["holderName","socialSecurityNumber","taxNumber"]),$?.current&&$.current.showValidation()},J.current.processBinLookupResponse=(e,r)=>{nr.processBinLookup(e,r)},J.current.setStatus=ee,a((()=>(J.current.setFocusOn=T.current.setFocusOn,J.current.updateStyles=T.current.updateStyles,J.current.handleUnsupportedCard=T.current.handleUnsupportedCard,()=>{T.current.destroy()})),[]),a((()=>{const e=[...i.hasHolderName?["holderName"]:[],...Xe?["socialSecurityNumber"]:[],...Qe?["taxNumber"]:[],...Ce?["billingAddress"]:[]];He(e)}),[i.hasHolderName,Xe,Qe]),a((()=>{ae({...ne,holderName:Le.holderName??"",taxNumber:Le.taxNumber}),Me(Le.socialSecurityNumber),Ce&&Be({...Le.billingAddress}),te({...oe,holderName:!i.holderNameRequired||_e.holderName,socialSecurityNumber:!!_e.socialSecurityNumber&&_e.socialSecurityNumber,taxNumber:!!_e.taxNumber&&_e.taxNumber,billingAddress:!!_e.billingAddress&&_e.billingAddress});const e=!!Ke.billingAddress&&Object.entries(Ke.billingAddress).reduce(((e,[,r])=>e||null!=r),!1);se({...re,holderName:i.holderNameRequired&&Ke.holderName?Ke.holderName:null,socialSecurityNumber:Xe&&Ke.socialSecurityNumber?Ke.socialSecurityNumber:null,taxNumber:Qe&&Ke.taxNumber?Ke.taxNumber:null,billingAddress:Ce&&e?Ke.billingAddress:null})}),[Le,_e,Ke]);const ar=C(le);a((()=>{const e=oe.holderName,r=ce,s=!Ce||oe.billingAddress,o=!Qe||!!oe.taxNumber&&!!oe.encryptedPassword,t=!Xe||!!oe.socialSecurityNumber,n=r&&e&&s&&o&&t,a=T.current.mapErrorsToValidationRuleResult(),l={...re,...a},{billingAddress:d,...u}=l,c={...u,...d},m=W?.({errors:c,isValidating:L.current,layout:rr(),countrySpecificLabels:Y.getAddressLabelsForCountry(we?.country)??je?.default?.labels}),p=m?.currentErrorsSortedByLayout;switch(ie(p),m?.action){case E:z&&w(L.current,T,m?.fieldToFocus),setTimeout((()=>{L.current=!1}),300);break;case M:{const e=q(p,ar,"field"),r=e?.[0];if(r){const e=F(r.errorCode)?r.errorMessage:null;H(e)}else U();break}}if(p){const e=q(p,ar,"field");e?.forEach((e=>{const r={fieldType:e.field,errorCode:e.errorCode,errorMessage:e.errorMessage};i.onErrorAnalytics(r)}))}i.onChange({data:ne,valid:oe,errors:l,isValid:n,billingAddress:we,selectedBrandValue:Ae,storePaymentMethod:Re,socialSecurityNumber:Ie,installments:Ee})}),[ne,oe,re,Ae,Re,Ee]);const lr=i.storedPaymentMethodId?k:R;return e(r,null,e(l,{ref:T,...S(i),styles:{...i.styles},koreanAuthenticationRequired:i.configuration.koreanAuthenticationRequired,hasKoreanFields:!(!i.configuration.koreanAuthenticationRequired||"kr"!==i.countryCode),onChange:(e,r)=>{if(e.autoCompleteName){if(!i.hasHolderName)return;const r=h("holderName","blur")(e.autoCompleteName)?e.autoCompleteName:null;r&&(Ue("holderName",r),ze("holderName",!0),We("holderName",null))}else i.autoFocus&&Q.current>0&&(!oe.encryptedCardNumber&&e.valid?.encryptedCardNumber||oe.encryptedCardNumber&&e.valid.encryptedCardNumber&&"handleOnBrand"===r?.event)&&tr(),ae({...ne,...e.data}),se({...re,...e.errors}),te({...oe,...e.valid}),me(e.isSfpValid),ye(e.cvcPolicy),ve(e.showSocialSecurityNumber),he(e.expiryDatePolicy)},onBrand:i.onBrand,onFocus:er,type:i.brand,disableIOSArrowKeys:i.disableIOSArrowKeys?sr:null,render:({setRootNode:r,setFocusOn:s},o)=>e("div",{ref:r,className:v({"adyen-checkout__card-input":!0,"adyen-checkout-card-input__wrapper":!0,[`adyen-checkout__card-input--${i.fundingSource??"credit"}`]:!0,"adyen-checkout__card-input--loading":"loading"===Z}),role:"form"},i.showFormInstruction&&e(D,null),e(lr,{...g(i),data:ne,valid:oe,errors:re,handleChangeFor:De,focusedElement:de,setFocusOn:s,sfpState:o,cvcPolicy:be,hasInstallments:$e,showAmountsInInstallments:Ge,handleInstallments:Ve,brandsIcons:i.brandsIcons,formData:Le,formErrors:Ke,formValid:_e,expiryDatePolicy:pe,dualBrandSelectElements:Se,extensions:nr,selectedBrandValue:Ae,showKCP:Qe,showBrazilianSSN:Xe,socialSecurityNumber:Ie,handleOnStoreDetails:xe,setAddressRef:G,billingAddress:we,billingAddressValidationRules:je&&I(ke.current),partialAddressSchema:je,handleAddress:or,onAddressLookup:i.onAddressLookup,onAddressSelected:i.onAddressSelected,addressSearchDebounceMs:i.addressSearchDebounceMs,iOSFocusedField:Oe,onFieldFocusAnalytics:Ye,onFieldBlurAnalytics:Ze}))}),i.showPayButton&&i.payButton({status:Z,variant:i.isPayButtonPrimaryVariant?"primary":"secondary",icon:_({imageFolder:"components/"})("lock")}))};T.defaultProps=i;export{T as default};
1
+ import{createElement as e,Fragment as r}from"../../../../external/preact/dist/preact.js";import{useRef as s,useMemo as o,useState as t,useCallback as n,useEffect as a}from"../../../../external/preact/hooks/dist/hooks.js";import l from"../../../internal/SecuredFields/SFP/SecuredFieldsProvider.js";import i from"./defaultProps.js";import{AddressModeOptions as d}from"./types.js";import{DATE_POLICY_REQUIRED as u,CVC_POLICY_REQUIRED as c,ENCRYPTED_CARD_NUMBER as m}from"../../../internal/SecuredFields/lib/configuration/constants.js";import{cardInputFormatters as p,cardInputValidationRules as h,getRuleByNameAndMode as f}from"./validate.js";import y from"../../../internal/SecuredFields/binLookup/extensions.js";import b from"../../../../utils/useForm/useForm.js";import{mapFieldKey as S,handlePartialAddressMode as N,extractPropsForSFP as g,extractPropsForCardFields as A,getLayout as F,lookupBlurBasedErrors as C}from"./utils.js";import{usePrevious as j}from"../../../../utils/hookUtils.js";import k from"../../../internal/Address/Specifications.js";import{StoredCardFieldsWrapper as R}from"./components/StoredCardFieldsWrapper.js";import{CardFieldsWrapper as x}from"./components/CardFieldsWrapper.js";import{getAutoJumpHandler as w,setFocusOnFirstField as P,getFocusHandler as B,getAddressHandler as v}from"./handlers.js";import I from"../../../../external/classnames/index.js";import{getPartialAddressValidationRules as V}from"../../../internal/Address/validate.js";import{ERROR_ACTION_BLUR_SCENARIO as E,ERROR_ACTION_FOCUS_FIELD as M}from"../../../../core/Errors/constants.js";import O from"../../../../core/Errors/useSRPanelContext.js";import q from"../../../../core/Context/useImage.js";import{getArrayDifferences as T}from"../../../../utils/arrayUtils.js";import D from"../../../internal/FormInstruction/FormInstruction.js";const L=i=>{const L=s(null),_=s(!1),K=q(),{setSRMessagesFromObjects:H,setSRMessagesFromStrings:U,clearSRPanel:z,shouldMoveFocusSR:W}=O(),$=H?.({fieldTypeMappingFn:S}),G=s(null),J=e=>{G.current=e},Q=s({});Object.keys(Q.current).length||i.setComponentRef(Q.current);const X=s(0),Y=s(!1),Z=o((()=>new k(i.specifications)),[i.specifications]);Q.current.sfp=L;const[ee,re]=t("ready"),[se,oe]=t({}),[te,ne]=t({...i.holderNameRequired&&{holderName:!1}}),[ae,le]=t({...i.hasHolderName&&{holderName:i.data.holderName??""}}),[ie,de]=t(null),[ue,ce]=t(""),[me,pe]=t(!1),[he,fe]=t(u),[ye,be]=t(c),[Se,Ne]=t(null),[ge,Ae]=t([]),[Fe,Ce]=t(i.storedPaymentMethodId?i.brand:""),je=i.billingAddressMode!==d.none&&i.billingAddressRequired,ke=N(i.billingAddressMode),Re=s(ke&&i.data?.billingAddress?.country),[xe,we]=t(!1),[Pe,Be]=t(je?i.data.billingAddress:null),[ve,Ie]=t(!1),[Ve,Ee]=t(""),[Me,Oe]=t({value:null}),[qe,Te]=t(null),{handleChangeFor:De,triggerValidation:Le,data:_e,valid:Ke,errors:He,setSchema:Ue,setData:ze,setValid:We,setErrors:$e}=b({schema:[],defaultData:i.data,formatters:p,rules:h}),Ge=!!Object.keys(i.installmentOptions).length&&"debit"!==i.fundingSource,Je=i.showInstallmentAmounts??!0,Qe="kr"===(Se??i.countryCode),Xe=i.configuration.koreanAuthenticationRequired&&Qe,Ye=ve&&"auto"===i.configuration.socialSecurityNumberMode||"show"===i.configuration.socialSecurityNumberMode,Ze=(e,r)=>{i.onFocus({fieldType:e,event:r})},er=(e,r)=>{i.onBlur({fieldType:e,event:r})},rr=B(ce,Ze,er),sr=()=>F({props:i,showKCP:Xe,showBrazilianSSN:Ye,...i.billingAddressRequired&&{countrySpecificSchemas:Z.getAddressSchemaForCountry(Pe?.country),billingAddressRequiredFields:i.billingAddressRequiredFields}}),or=n((e=>{const r="webInternalElement"!==e.fieldType?e.fieldType:e.name;Te(r)}),[]),tr=v(ze,We,$e),nr=w(Y,L,sr()),ar=o((()=>y(i,{sfp:L},{dualBrandSelectElements:ge,setDualBrandSelectElements:Ae,setSelectedBrandValue:Ce,issuingCountryCode:Se,setIssuingCountryCode:Ne},X)),[ge,Se]);Q.current.showValidation=()=>{_.current=!0,z?.(),L.current.showValidation(),Le(["holderName","socialSecurityNumber","taxNumber"]),G?.current&&G.current.showValidation()},Q.current.processBinLookupResponse=(e,r)=>{ar.processBinLookup(e,r)},Q.current.setStatus=re,a((()=>(Q.current.setFocusOn=L.current.setFocusOn,Q.current.updateStyles=L.current.updateStyles,Q.current.handleUnsupportedCard=L.current.handleUnsupportedCard,()=>{L.current.destroy()})),[]),a((()=>{const e=[...i.hasHolderName?["holderName"]:[],...Ye?["socialSecurityNumber"]:[],...Xe?["taxNumber"]:[],...je?["billingAddress"]:[]];Ue(e)}),[i.hasHolderName,Ye,Xe]),a((()=>{le({...ae,holderName:_e.holderName??"",taxNumber:_e.taxNumber}),Ee(_e.socialSecurityNumber),je&&Be({..._e.billingAddress}),ne({...te,holderName:!i.holderNameRequired||Ke.holderName,socialSecurityNumber:!!Ke.socialSecurityNumber&&Ke.socialSecurityNumber,taxNumber:!!Ke.taxNumber&&Ke.taxNumber,billingAddress:!!Ke.billingAddress&&Ke.billingAddress});const e=!!He.billingAddress&&Object.entries(He.billingAddress).reduce(((e,[,r])=>e||null!=r),!1);oe({...se,holderName:i.holderNameRequired&&He.holderName?He.holderName:null,socialSecurityNumber:Ye&&He.socialSecurityNumber?He.socialSecurityNumber:null,taxNumber:Xe&&He.taxNumber?He.taxNumber:null,billingAddress:je&&e?He.billingAddress:null})}),[_e,Ke,He]);const lr=j(ie);a((()=>{const e=te.holderName,r=me,s=!je||te.billingAddress,o=!Xe||!!te.taxNumber&&!!te.encryptedPassword,t=!Ye||!!te.socialSecurityNumber,n=r&&e&&s&&o&&t,a=L.current.mapErrorsToValidationRuleResult(),l={...se,...a},{billingAddress:d,...u}=l,c={...u,...d},m=$?.({errors:c,isValidating:_.current,layout:sr(),countrySpecificLabels:Z.getAddressLabelsForCountry(Pe?.country)??ke?.default?.labels}),p=m?.currentErrorsSortedByLayout;switch(de(p),m?.action){case M:W&&P(_.current,L,m?.fieldToFocus),setTimeout((()=>{_.current=!1}),300);break;case E:{const e=T(p,lr,"field"),r=e?.[0];if(r){const e=C(r.errorCode)?r.errorMessage:null;U(e)}else z();break}}if(p){const e=T(p,lr,"field");e?.forEach((e=>{const r={fieldType:e.field,errorCode:e.errorCode};i.onValidationErrorAnalytics(r)}))}i.onChange({data:ae,valid:te,errors:l,isValid:n,billingAddress:Pe,selectedBrandValue:Fe,storePaymentMethod:xe,socialSecurityNumber:Ve,installments:Me})}),[ae,te,se,Fe,xe,Me]);const ir=i.storedPaymentMethodId?R:x;return e(r,null,e(l,{ref:L,...g(i),styles:{...i.styles},koreanAuthenticationRequired:i.configuration.koreanAuthenticationRequired,hasKoreanFields:!(!i.configuration.koreanAuthenticationRequired||"kr"!==i.countryCode),onChange:(e,r)=>{if(e.autoCompleteName){if(!i.hasHolderName)return;const r=f("holderName","blur")(e.autoCompleteName)?e.autoCompleteName:null;r&&(ze("holderName",r),We("holderName",!0),$e("holderName",null))}else i.autoFocus&&X.current>0&&"handleOnFieldValid"===r?.event&&r?.fieldType===m&&e.valid.encryptedCardNumber&&nr(),le({...ae,...e.data}),oe({...se,...e.errors}),ne({...te,...e.valid}),pe(e.isSfpValid),be(e.cvcPolicy),Ie(e.showSocialSecurityNumber),fe(e.expiryDatePolicy)},onBrand:i.onBrand,onFocus:rr,type:i.brand,disableIOSArrowKeys:i.disableIOSArrowKeys?or:null,render:({setRootNode:r,setFocusOn:s},o)=>e("div",{ref:r,className:I({"adyen-checkout__card-input":!0,"adyen-checkout-card-input__wrapper":!0,[`adyen-checkout__card-input--${i.fundingSource??"credit"}`]:!0,"adyen-checkout__card-input--loading":"loading"===ee}),role:"form"},i.showFormInstruction&&e(D,null),e(ir,{...A(i),data:ae,valid:te,errors:se,handleChangeFor:De,focusedElement:ue,setFocusOn:s,sfpState:o,cvcPolicy:ye,hasInstallments:Ge,showAmountsInInstallments:Je,handleInstallments:Oe,brandsIcons:i.brandsIcons,formData:_e,formErrors:He,formValid:Ke,expiryDatePolicy:he,dualBrandSelectElements:ge,extensions:ar,selectedBrandValue:Fe,showKCP:Xe,showBrazilianSSN:Ye,socialSecurityNumber:Ve,handleOnStoreDetails:we,setAddressRef:J,billingAddress:Pe,billingAddressValidationRules:ke&&V(Re.current),partialAddressSchema:ke,handleAddress:tr,onAddressLookup:i.onAddressLookup,onAddressSelected:i.onAddressSelected,addressSearchDebounceMs:i.addressSearchDebounceMs,iOSFocusedField:qe,onFieldFocusAnalytics:Ze,onFieldBlurAnalytics:er}))}),i.showPayButton&&i.payButton({status:ee,variant:i.isPayButtonPrimaryVariant?"primary":"secondary",icon:K({imageFolder:"components/"})("lock")}))};L.defaultProps=i;export{L as default};
2
2
  //# sourceMappingURL=CardInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CardInput.js","sources":["../../../../../../src/components/Card/components/CardInput/CardInput.tsx"],"sourcesContent":["import { h, Fragment } from 'preact';\nimport { useState, useEffect, useRef, useMemo, useCallback } from 'preact/hooks';\nimport SecuredFieldsProvider from '../../../internal/SecuredFields/SFP/SecuredFieldsProvider';\nimport { OnChangeEventDetails, SFPState } from '../../../internal/SecuredFields/SFP/types';\nimport defaultProps from './defaultProps';\nimport './CardInput.scss';\nimport { AddressModeOptions, CardInputDataState, CardInputErrorState, CardInputProps, CardInputRef, CardInputValidState } from './types';\nimport { CVC_POLICY_REQUIRED, DATE_POLICY_REQUIRED } from '../../../internal/SecuredFields/lib/configuration/constants';\nimport { BinLookupResponse } from '../../types';\nimport { cardInputFormatters, cardInputValidationRules, getRuleByNameAndMode } from './validate';\nimport CIExtensions from '../../../internal/SecuredFields/binLookup/extensions';\nimport useForm from '../../../../utils/useForm';\nimport { SetSRMessagesReturnObject, SortedErrorObject } from '../../../../core/Errors/types';\nimport { handlePartialAddressMode, extractPropsForCardFields, extractPropsForSFP, getLayout, lookupBlurBasedErrors, mapFieldKey } from './utils';\nimport { usePrevious } from '../../../../utils/hookUtils';\nimport Specifications from '../../../internal/Address/Specifications';\nimport { StoredCardFieldsWrapper } from './components/StoredCardFieldsWrapper';\nimport { CardFieldsWrapper } from './components/CardFieldsWrapper';\nimport { getAddressHandler, getAutoJumpHandler, getFocusHandler, setFocusOnFirstField } from './handlers';\nimport { InstallmentsObj } from './components/Installments/Installments';\nimport { TouchStartEventObj } from './components/types';\nimport classNames from 'classnames';\nimport { getPartialAddressValidationRules } from '../../../internal/Address/validate';\nimport { ERROR_ACTION_BLUR_SCENARIO, ERROR_ACTION_FOCUS_FIELD } from '../../../../core/Errors/constants';\nimport useSRPanelContext from '../../../../core/Errors/useSRPanelContext';\nimport { SetSRMessagesReturnFn } from '../../../../core/Errors/SRPanelProvider';\nimport useImage from '../../../../core/Context/useImage';\nimport { getArrayDifferences } from '../../../../utils/arrayUtils';\nimport FormInstruction from '../../../internal/FormInstruction';\nimport { AddressData } from '../../../../types/global-types';\nimport { CbObjOnFocus } from '../../../internal/SecuredFields/lib/types';\nimport { FieldErrorAnalyticsObject } from '../../../../core/Analytics/types';\n\nconst CardInput = (props: CardInputProps) => {\n const sfp = useRef(null);\n const isValidating = useRef(false);\n const getImage = useImage();\n\n /** SR stuff */\n const { setSRMessagesFromObjects, setSRMessagesFromStrings, clearSRPanel, shouldMoveFocusSR } = useSRPanelContext();\n\n // Generate a setSRMessages function - implemented as a partial, since the initial set of arguments don't change.\n const setSRMessages: SetSRMessagesReturnFn = setSRMessagesFromObjects?.({\n fieldTypeMappingFn: mapFieldKey\n });\n /** end SR stuff */\n\n const billingAddressRef = useRef(null);\n const setAddressRef = ref => {\n billingAddressRef.current = ref;\n };\n\n const cardInputRef = useRef<CardInputRef>({});\n // Just call once to create the object by which we expose the members expected by the parent Card comp\n if (!Object.keys(cardInputRef.current).length) {\n props.setComponentRef(cardInputRef.current);\n }\n\n const hasPanLengthRef = useRef(0);\n const isAutoJumping = useRef(false);\n\n const specifications = useMemo(() => new Specifications(props.specifications), [props.specifications]);\n\n // Store ref to sfp (useful for 'deep' debugging)\n cardInputRef.current.sfp = sfp;\n\n /**\n * STATE HOOKS\n */\n const [status, setStatus] = useState('ready');\n\n const [errors, setErrors] = useState<CardInputErrorState>({});\n const [valid, setValid] = useState<CardInputValidState>({\n ...(props.holderNameRequired && { holderName: false })\n });\n const [data, setData] = useState<CardInputDataState>({\n ...(props.hasHolderName && { holderName: props.data.holderName ?? '' })\n });\n\n const [sortedErrorList, setSortedErrorList] = useState<SortedErrorObject[]>(null);\n\n const [focusedElement, setFocusedElement] = useState('');\n const [isSfpValid, setIsSfpValid] = useState(false);\n const [expiryDatePolicy, setExpiryDatePolicy] = useState(DATE_POLICY_REQUIRED);\n const [cvcPolicy, setCvcPolicy] = useState(CVC_POLICY_REQUIRED);\n const [issuingCountryCode, setIssuingCountryCode] = useState<string>(null);\n\n const [dualBrandSelectElements, setDualBrandSelectElements] = useState([]);\n const [selectedBrandValue, setSelectedBrandValue] = useState(props.storedPaymentMethodId ? props.brand : ''); // If this is a storedCard comp initialise state with the storedCard's brand\n\n const showBillingAddress = props.billingAddressMode !== AddressModeOptions.none && props.billingAddressRequired;\n\n const partialAddressSchema = handlePartialAddressMode(props.billingAddressMode);\n // Keeps the value of the country set initially by the merchant, before the Address Component mutates it\n const partialAddressCountry = useRef<string>(partialAddressSchema && props.data?.billingAddress?.country);\n\n const [storePaymentMethod, setStorePaymentMethod] = useState(false);\n const [billingAddress, setBillingAddress] = useState<AddressData>(showBillingAddress ? props.data.billingAddress : null);\n const [showSocialSecurityNumber, setShowSocialSecurityNumber] = useState(false);\n const [socialSecurityNumber, setSocialSecurityNumber] = useState('');\n const [installments, setInstallments] = useState<InstallmentsObj>({ value: null });\n\n // re. Disable arrows for iOS: The name of the element calling for other elements to be disabled\n // - either a securedField type (like 'encryptedCardNumber') when call is coming from SF\n // or else the name of an internal, Adyen-web, element (like 'holderName')\n const [iOSFocusedField, setIOSFocusedField] = useState(null);\n\n /**\n * LOCAL VARS\n */\n const {\n handleChangeFor,\n triggerValidation,\n data: formData,\n valid: formValid,\n errors: formErrors,\n setSchema,\n setData: setFormData,\n setValid: setFormValid,\n setErrors: setFormErrors\n } = useForm<CardInputDataState>({\n schema: [],\n defaultData: props.data,\n formatters: cardInputFormatters,\n rules: cardInputValidationRules\n });\n\n const hasInstallments = !!Object.keys(props.installmentOptions).length && props.fundingSource !== 'debit';\n const showAmountsInInstallments = props.showInstallmentAmounts ?? true;\n\n const cardCountryCode: string = issuingCountryCode ?? props.countryCode;\n const isKorea = cardCountryCode === 'kr'; // If issuingCountryCode or the merchant defined countryCode is set to 'kr'\n const showKCP = props.configuration.koreanAuthenticationRequired && isKorea;\n\n const showBrazilianSSN: boolean =\n (showSocialSecurityNumber && props.configuration.socialSecurityNumberMode === 'auto') ||\n props.configuration.socialSecurityNumberMode === 'show';\n\n /**\n * HANDLERS\n */\n // Handlers for focus & blur on all fields. Can be renamed to onFieldFocus once the onFocusField is renamed in Field.tsx\n const onFieldFocusAnalytics = (who: string, e: Event | CbObjOnFocus) => {\n props.onFocus({ fieldType: who, event: e });\n };\n const onFieldBlurAnalytics = (who: string, e: Event | CbObjOnFocus) => {\n props.onBlur({ fieldType: who, event: e });\n };\n\n // Make SecuredFields aware of the focus & blur handlers\n const handleFocus = getFocusHandler(setFocusedElement, onFieldFocusAnalytics, onFieldBlurAnalytics);\n\n const retrieveLayout = (): string[] => {\n return getLayout({\n props,\n showKCP,\n showBrazilianSSN,\n ...(props.billingAddressRequired && {\n countrySpecificSchemas: specifications.getAddressSchemaForCountry(billingAddress?.country),\n billingAddressRequiredFields: props.billingAddressRequiredFields\n })\n });\n };\n\n /**\n * re. Disabling arrow keys in iOS:\n * Only by disabling all fields in the Card PM except for the active securedField input can we force the iOS soft keyboard arrow keys to disable\n *\n * NOTE: only called if ua.__IS_IOS = true && this.config.disableIOSArrowKeys = true (as referenced in CSF)\n *\n * @param obj - has fieldType prop saying whether this function is being called in response to an securedFields click ('encryptedCardNumber' etc)\n * - in which case we should disable all non-SF fields\n * or,\n * due to an internal action ('webInternalElement') - in which case we can enable all non-SF fields\n */\n const handleTouchstartIOS = useCallback((obj: TouchStartEventObj) => {\n const elementType = obj.fieldType !== 'webInternalElement' ? obj.fieldType : obj.name;\n setIOSFocusedField(elementType);\n }, []);\n\n const handleAddress = getAddressHandler(setFormData, setFormValid, setFormErrors);\n\n const doPanAutoJump = getAutoJumpHandler(isAutoJumping, sfp, retrieveLayout());\n\n const handleSecuredFieldsChange = (sfState: SFPState, eventDetails?: OnChangeEventDetails): void => {\n /**\n * Handling auto complete value for holderName (but only if the component is using a holderName field)\n */\n if (sfState.autoCompleteName) {\n if (!props.hasHolderName) return;\n const holderNameValidationFn = getRuleByNameAndMode('holderName', 'blur');\n const acHolderName = holderNameValidationFn(sfState.autoCompleteName) ? sfState.autoCompleteName : null;\n if (acHolderName) {\n setFormData('holderName', acHolderName);\n setFormValid('holderName', true); // only if holderName is valid does this fny get called - so we know it's valid and w/o error\n setFormErrors('holderName', null);\n }\n return;\n }\n\n /**\n * If PAN has just become valid: decide if we can shift focus to the next field.\n *\n * We can if the config prop, autoFocus, is true AND we have a panLength value from binLookup AND one of the following scenarios is true:\n * - If encryptedCardNumber was invalid but now is valid\n * [scenario: shopper has typed in a number and field is now valid]\n * - If encryptedCardNumber was valid and still is valid and we're handling an onBrand event (triggered by binLookup which has happened after the handleOnFieldValid event)\n * [scenario: shopper has pasted in a full, valid, number]\n */\n if (\n props.autoFocus &&\n hasPanLengthRef.current > 0 &&\n ((!valid.encryptedCardNumber && sfState.valid?.encryptedCardNumber) ||\n (valid.encryptedCardNumber && sfState.valid.encryptedCardNumber && eventDetails?.event === 'handleOnBrand'))\n ) {\n doPanAutoJump();\n }\n\n /**\n * Process SFP state\n */\n setData({ ...data, ...sfState.data });\n setErrors({ ...errors, ...sfState.errors });\n setValid({ ...valid, ...sfState.valid });\n\n setIsSfpValid(sfState.isSfpValid);\n\n // Values relating to /binLookup response\n setCvcPolicy(sfState.cvcPolicy);\n setShowSocialSecurityNumber(sfState.showSocialSecurityNumber);\n setExpiryDatePolicy(sfState.expiryDatePolicy);\n };\n\n // Farm the handlers for binLookup related functionality out to another 'extensions' file\n const extensions = useMemo(\n () =>\n CIExtensions(\n props,\n { sfp },\n {\n dualBrandSelectElements,\n setDualBrandSelectElements,\n setSelectedBrandValue,\n issuingCountryCode,\n setIssuingCountryCode\n },\n hasPanLengthRef\n ),\n [dualBrandSelectElements, issuingCountryCode]\n );\n\n /**\n * EXPOSE METHODS expected by Card.tsx\n */\n cardInputRef.current.showValidation = () => {\n // set flag\n isValidating.current = true;\n\n /**\n * Clear errors prior to validating so that the screenreader will read them *all* again, and in the right order\n * - only using aria-atomic on the error panel will read them in the wrong order\n */\n clearSRPanel?.(); // TODO - recheck if this is still true\n\n // Validate SecuredFields\n sfp.current.showValidation();\n\n // Validate holderName & SSN & KCP (taxNumber) but *not* billingAddress\n triggerValidation(['holderName', 'socialSecurityNumber', 'taxNumber']);\n\n // Validate Address\n if (billingAddressRef?.current) billingAddressRef.current.showValidation();\n };\n\n cardInputRef.current.processBinLookupResponse = (binLookupResponse: BinLookupResponse, isReset: boolean) => {\n extensions.processBinLookup(binLookupResponse, isReset);\n };\n\n cardInputRef.current.setStatus = setStatus;\n\n /**\n * EFFECT HOOKS\n */\n useEffect(() => {\n // componentDidMount - expose more methods expected by Card.tsx\n cardInputRef.current.setFocusOn = sfp.current.setFocusOn;\n cardInputRef.current.updateStyles = sfp.current.updateStyles;\n cardInputRef.current.handleUnsupportedCard = sfp.current.handleUnsupportedCard;\n\n // componentWillUnmount\n return () => {\n sfp.current.destroy();\n };\n }, []);\n\n /**\n * Handle form schema updates\n */\n useEffect(() => {\n const newSchema = [\n ...(props.hasHolderName ? ['holderName'] : []),\n ...(showBrazilianSSN ? ['socialSecurityNumber'] : []),\n ...(showKCP ? ['taxNumber'] : []),\n ...(showBillingAddress ? ['billingAddress'] : [])\n ];\n setSchema(newSchema);\n }, [props.hasHolderName, showBrazilianSSN, showKCP]);\n\n /**\n * Handle updates from useForm\n */\n useEffect(() => {\n setData({ ...data, holderName: formData.holderName ?? '', taxNumber: formData.taxNumber });\n\n setSocialSecurityNumber(formData.socialSecurityNumber);\n\n if (showBillingAddress) setBillingAddress({ ...formData.billingAddress });\n\n setValid({\n ...valid,\n holderName: props.holderNameRequired ? formValid.holderName : true,\n // Setting value to false if it's falsy keeps in line with existing, expected behaviour\n // - but there is an argument to allow 'undefined' as a value to indicate the non-presence of the field\n socialSecurityNumber: formValid.socialSecurityNumber ? formValid.socialSecurityNumber : false,\n taxNumber: formValid.taxNumber ? formValid.taxNumber : false,\n billingAddress: formValid.billingAddress ? formValid.billingAddress : false\n });\n\n // Check if billingAddress errors object has any properties that aren't null or undefined\n const addressHasErrors = formErrors.billingAddress\n ? Object.entries(formErrors.billingAddress).reduce((acc, [, error]) => acc || error != null, false)\n : false;\n\n // Errors\n setErrors({\n ...errors,\n holderName: props.holderNameRequired && !!formErrors.holderName ? formErrors.holderName : null,\n socialSecurityNumber: showBrazilianSSN && !!formErrors.socialSecurityNumber ? formErrors.socialSecurityNumber : null,\n taxNumber: showKCP && !!formErrors.taxNumber ? formErrors.taxNumber : null,\n billingAddress: showBillingAddress && addressHasErrors ? formErrors.billingAddress : null\n });\n }, [formData, formValid, formErrors]);\n\n // Get the previous value\n const previousSortedErrors = usePrevious(sortedErrorList);\n\n /**\n * Main 'componentDidUpdate' handler\n */\n useEffect(() => {\n const holderNameValid: boolean = valid.holderName;\n\n const sfpValid: boolean = isSfpValid;\n const addressValid: boolean = showBillingAddress ? valid.billingAddress : true;\n\n const koreanAuthentication: boolean = showKCP ? !!valid.taxNumber && !!valid.encryptedPassword : true;\n\n const socialSecurityNumberValid: boolean = showBrazilianSSN ? !!valid.socialSecurityNumber : true;\n\n const isValid: boolean = sfpValid && holderNameValid && addressValid && koreanAuthentication && socialSecurityNumberValid;\n\n const sfStateErrorsObj = sfp.current.mapErrorsToValidationRuleResult();\n const mergedErrors = { ...errors, ...sfStateErrorsObj }; // maps sfErrors AND solves race condition problems for sfp from showValidation\n\n // Extract and then flatten billingAddress errors into a new object with *all* the field errors at top level\n const { billingAddress: extractedAddressErrors, ...errorsWithoutAddress } = mergedErrors;\n\n const errorsForPanel = { ...errorsWithoutAddress, ...extractedAddressErrors };\n\n // Pass dynamic props (errors, layout etc) to SRPanel via partial\n const srPanelResp: SetSRMessagesReturnObject = setSRMessages?.({\n errors: errorsForPanel,\n isValidating: isValidating.current,\n layout: retrieveLayout(),\n // If we don't have country specific address labels, we might have a label related to a partialAddressSchema (i.e. zipCode)\n countrySpecificLabels: specifications.getAddressLabelsForCountry(billingAddress?.country) ?? partialAddressSchema?.default?.labels\n });\n\n /**\n * Need extra actions after setting SRPanel messages in order to focus field (if required) and because we have some errors that are fired onBlur\n */\n const currentErrorsSortedByLayout = srPanelResp?.currentErrorsSortedByLayout;\n\n // Store the array of sorted error objects separately so that we can use it to make comparisons between the old and new arrays\n setSortedErrorList(currentErrorsSortedByLayout);\n\n switch (srPanelResp?.action) {\n // A call to focus the first field in error will always follow the call to validate the whole form\n case ERROR_ACTION_FOCUS_FIELD:\n if (shouldMoveFocusSR) setFocusOnFirstField(isValidating.current, sfp, srPanelResp?.fieldToFocus);\n // Remove 'showValidation' mode - allowing time for collation of all the fields in error whilst it is 'showValidation' mode (some errors come in a second render pass)\n setTimeout(() => {\n isValidating.current = false;\n }, 300);\n break;\n /** On blur scenario: not validating, i.e. trying to submit form, but there might be an error, either to set or to clear */\n case ERROR_ACTION_BLUR_SCENARIO: {\n const difference = getArrayDifferences<SortedErrorObject, string>(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n\n const latestErrorMsg = difference?.[0];\n\n if (latestErrorMsg) {\n // Use the error code to look up whether error is actually a blur based one (most are but some SF ones aren't)\n const isBlurBasedError = lookupBlurBasedErrors(latestErrorMsg.errorCode);\n\n /**\n * ONLY ADD BLUR BASED ERRORS TO THE ERROR PANEL - doing this step prevents the non-blur based errors from being read out twice\n * (once from the aria-live, error panel & once from the aria-describedby element)\n */\n const latestSRError = isBlurBasedError ? latestErrorMsg.errorMessage : null;\n // console.log('### CardInput2::componentDidUpdate:: #2 (not validating) single error:: latestSRError', latestSRError);\n setSRMessagesFromStrings(latestSRError);\n } else {\n // called when previousSortedErrors.length >= currentErrorsSortedByLayout.length\n // console.log('### CardInput2::componentDidUpdate:: #3(not validating) clearing errors:: NO latestErrorMsg');\n clearSRPanel();\n }\n break;\n }\n default:\n break;\n }\n\n // Analytics\n if (currentErrorsSortedByLayout) {\n const newErrors = getArrayDifferences<SortedErrorObject, string>(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n newErrors?.forEach(errorItem => {\n const aObj: FieldErrorAnalyticsObject = {\n fieldType: errorItem.field,\n errorCode: errorItem.errorCode,\n errorMessage: errorItem.errorMessage\n };\n\n props.onErrorAnalytics(aObj);\n });\n }\n\n props.onChange({\n data,\n valid,\n errors: mergedErrors,\n isValid,\n billingAddress,\n selectedBrandValue,\n storePaymentMethod,\n socialSecurityNumber,\n installments\n });\n }, [data, valid, errors, selectedBrandValue, storePaymentMethod, installments]);\n\n /**\n * RENDER\n */\n const FieldToRender = props.storedPaymentMethodId ? StoredCardFieldsWrapper : CardFieldsWrapper;\n\n return (\n <Fragment>\n <SecuredFieldsProvider\n ref={sfp}\n {...extractPropsForSFP(props)}\n styles={{ ...props.styles }}\n koreanAuthenticationRequired={props.configuration.koreanAuthenticationRequired}\n hasKoreanFields={!!(props.configuration.koreanAuthenticationRequired && props.countryCode === 'kr')}\n onChange={handleSecuredFieldsChange}\n onBrand={props.onBrand}\n onFocus={handleFocus}\n type={props.brand}\n disableIOSArrowKeys={props.disableIOSArrowKeys ? handleTouchstartIOS : null}\n render={({ setRootNode, setFocusOn }, sfpState) => (\n <div\n ref={setRootNode}\n className={classNames({\n 'adyen-checkout__card-input': true,\n 'adyen-checkout-card-input__wrapper': true,\n [`adyen-checkout__card-input--${props.fundingSource ?? 'credit'}`]: true,\n 'adyen-checkout__card-input--loading': status === 'loading'\n })}\n role={'form'}\n >\n {props.showFormInstruction && <FormInstruction />}\n <FieldToRender\n // Extract exact props that we need to pass down\n {...extractPropsForCardFields(props)}\n // Pass on vars created in CardInput:\n // Base (shared w. StoredCard)\n data={data}\n valid={valid}\n errors={errors}\n handleChangeFor={handleChangeFor}\n focusedElement={focusedElement}\n setFocusOn={setFocusOn}\n sfpState={sfpState}\n cvcPolicy={cvcPolicy}\n hasInstallments={hasInstallments}\n showAmountsInInstallments={showAmountsInInstallments}\n handleInstallments={setInstallments}\n // For Card\n brandsIcons={props.brandsIcons}\n formData={formData}\n formErrors={formErrors}\n formValid={formValid}\n expiryDatePolicy={expiryDatePolicy}\n dualBrandSelectElements={dualBrandSelectElements}\n extensions={extensions}\n selectedBrandValue={selectedBrandValue}\n // For KCP\n showKCP={showKCP}\n // For SSN\n showBrazilianSSN={showBrazilianSSN}\n socialSecurityNumber={socialSecurityNumber}\n // For Store details\n handleOnStoreDetails={setStorePaymentMethod}\n // For Address\n setAddressRef={setAddressRef}\n billingAddress={billingAddress}\n billingAddressValidationRules={partialAddressSchema && getPartialAddressValidationRules(partialAddressCountry.current)}\n partialAddressSchema={partialAddressSchema}\n handleAddress={handleAddress}\n onAddressLookup={props.onAddressLookup}\n onAddressSelected={props.onAddressSelected}\n addressSearchDebounceMs={props.addressSearchDebounceMs}\n //\n iOSFocusedField={iOSFocusedField}\n //\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n </div>\n )}\n />\n {props.showPayButton &&\n props.payButton({\n status,\n variant: props.isPayButtonPrimaryVariant ? 'primary' : 'secondary',\n icon: getImage({ imageFolder: 'components/' })('lock')\n })}\n </Fragment>\n );\n};\n\nCardInput.defaultProps = defaultProps;\n\nexport default CardInput;\n"],"names":["CardInput","props","sfp","useRef","isValidating","getImage","useImage","setSRMessagesFromObjects","setSRMessagesFromStrings","clearSRPanel","shouldMoveFocusSR","useSRPanelContext","setSRMessages","fieldTypeMappingFn","mapFieldKey","billingAddressRef","setAddressRef","ref","current","cardInputRef","Object","keys","length","setComponentRef","hasPanLengthRef","isAutoJumping","specifications","useMemo","Specifications","status","setStatus","useState","errors","setErrors","valid","setValid","holderNameRequired","holderName","data","setData","hasHolderName","sortedErrorList","setSortedErrorList","focusedElement","setFocusedElement","isSfpValid","setIsSfpValid","expiryDatePolicy","setExpiryDatePolicy","DATE_POLICY_REQUIRED","cvcPolicy","setCvcPolicy","CVC_POLICY_REQUIRED","issuingCountryCode","setIssuingCountryCode","dualBrandSelectElements","setDualBrandSelectElements","selectedBrandValue","setSelectedBrandValue","storedPaymentMethodId","brand","showBillingAddress","billingAddressMode","AddressModeOptions","none","billingAddressRequired","partialAddressSchema","handlePartialAddressMode","partialAddressCountry","billingAddress","country","storePaymentMethod","setStorePaymentMethod","setBillingAddress","showSocialSecurityNumber","setShowSocialSecurityNumber","socialSecurityNumber","setSocialSecurityNumber","installments","setInstallments","value","iOSFocusedField","setIOSFocusedField","handleChangeFor","triggerValidation","formData","formValid","formErrors","setSchema","setFormData","setFormValid","setFormErrors","useForm","schema","defaultData","formatters","cardInputFormatters","rules","cardInputValidationRules","hasInstallments","installmentOptions","fundingSource","showAmountsInInstallments","showInstallmentAmounts","isKorea","countryCode","showKCP","configuration","koreanAuthenticationRequired","showBrazilianSSN","socialSecurityNumberMode","onFieldFocusAnalytics","who","e","onFocus","fieldType","event","onFieldBlurAnalytics","onBlur","handleFocus","getFocusHandler","retrieveLayout","getLayout","countrySpecificSchemas","getAddressSchemaForCountry","billingAddressRequiredFields","handleTouchstartIOS","useCallback","obj","elementType","name","handleAddress","getAddressHandler","doPanAutoJump","getAutoJumpHandler","extensions","CIExtensions","showValidation","processBinLookupResponse","binLookupResponse","isReset","processBinLookup","useEffect","setFocusOn","updateStyles","handleUnsupportedCard","destroy","newSchema","taxNumber","addressHasErrors","entries","reduce","acc","error","previousSortedErrors","usePrevious","holderNameValid","sfpValid","addressValid","koreanAuthentication","encryptedPassword","socialSecurityNumberValid","isValid","sfStateErrorsObj","mapErrorsToValidationRuleResult","mergedErrors","extractedAddressErrors","errorsWithoutAddress","errorsForPanel","srPanelResp","layout","countrySpecificLabels","getAddressLabelsForCountry","default","labels","currentErrorsSortedByLayout","action","ERROR_ACTION_FOCUS_FIELD","setFocusOnFirstField","fieldToFocus","setTimeout","ERROR_ACTION_BLUR_SCENARIO","difference","getArrayDifferences","latestErrorMsg","latestSRError","lookupBlurBasedErrors","errorCode","errorMessage","newErrors","forEach","errorItem","aObj","field","onErrorAnalytics","onChange","FieldToRender","StoredCardFieldsWrapper","CardFieldsWrapper","h","Fragment","SecuredFieldsProvider","extractPropsForSFP","styles","hasKoreanFields","sfState","eventDetails","autoCompleteName","acHolderName","getRuleByNameAndMode","holderNameValidationFn","autoFocus","encryptedCardNumber","onBrand","type","disableIOSArrowKeys","render","setRootNode","sfpState","div","className","classNames","role","showFormInstruction","FormInstruction","extractPropsForCardFields","handleInstallments","brandsIcons","handleOnStoreDetails","billingAddressValidationRules","getPartialAddressValidationRules","onAddressLookup","onAddressSelected","addressSearchDebounceMs","showPayButton","payButton","variant","isPayButtonPrimaryVariant","icon","imageFolder","defaultProps"],"mappings":"4wDAiCA,MAAMA,EAAaC,IACf,MAAMC,EAAMC,EAAO,MACbC,EAAeD,GAAO,GACtBE,EAAWC,KAGXC,yBAAEA,EAAwBC,yBAAEA,EAAwBC,aAAEA,EAAYC,kBAAEA,GAAsBC,IAG1FC,EAAuCL,IAA2B,CACpEM,mBAAoBC,IAIlBC,EAAoBZ,EAAO,MAC3Ba,EAAgBC,IAClBF,EAAkBG,QAAUD,CAAAA,EAG1BE,EAAehB,EAAqB,CAAA,GAErCiB,OAAOC,KAAKF,EAAaD,SAASI,QACnCrB,EAAMsB,gBAAgBJ,EAAaD,SAGvC,MAAMM,EAAkBrB,EAAO,GACzBsB,EAAgBtB,GAAO,GAEvBuB,EAAiBC,GA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UAAWC,EAAW,CAClB,8BAA8B,EAC9B,sCAAsC,EACtC,CAAC,+BAA+B5N,EAAMoG,eAAiB,aAAa,EACpE,sCAAkD,YAAXxE,IAE3CiM,KAAM,QAEL7N,EAAM8N,qBAAuBxB,EAACyB,EAAAA,MAC/BzB,EAACH,GAAAA,IAEO6B,EAA0BhO,GAG9BqC,KAAMA,GACNJ,MAAOA,GACPF,OAAQA,GACRmD,gBAAiBA,GACjBxC,eAAgBA,GAChBoG,WAAYA,EACZ2E,SAAUA,EACVxK,UAAWA,GACXiD,gBAAiBA,GACjBG,0BAA2BA,GAC3B4H,mBAAoBnJ,GAEpBoJ,YAAalO,EAAMkO,YACnB9I,SAAUA,GACVE,WAAYA,GACZD,UAAWA,GACXvC,iBAAkBA,GAClBQ,wBAAyBA,GACzBgF,WAAYA,GACZ9E,mBAAoBA,GAEpBiD,QAASA,GAETG,iBAAkBA,GAClBjC,qBAAsBA,GAEtBwJ,qBAAsB5J,GAEtBxD,cAAeA,EACfqD,eAAgBA,GAChBgK,8BAA+BnK,IAAwBoK,EAAiClK,GAAsBlD,SAC9GgD,qBAAsBA,GACtBiE,cAAeA,GACfoG,gBAAiBtO,EAAMsO,gBACvBC,kBAAmBvO,EAAMuO,kBACzBC,wBAAyBxO,EAAMwO,wBAE/BxJ,gBAAiBA,GAEjB8B,sBAAuBA,GACvBM,qBAAsBA,QAKrCpH,EAAMyO,eACHzO,EAAM0O,UAAU,CACZ9M,SACA+M,QAAS3O,EAAM4O,0BAA4B,UAAY,YACvDC,KAAMzO,EAAS,CAAE0O,YAAa,eAAxB1O,CAAyC,UACnD,EAKhBL,EAAUgP,aAAeA"}
1
+ {"version":3,"file":"CardInput.js","sources":["../../../../../../src/components/Card/components/CardInput/CardInput.tsx"],"sourcesContent":["import { h, Fragment } from 'preact';\nimport { useState, useEffect, useRef, useMemo, useCallback } from 'preact/hooks';\nimport SecuredFieldsProvider from '../../../internal/SecuredFields/SFP/SecuredFieldsProvider';\nimport { OnChangeEventDetails, SFPState } from '../../../internal/SecuredFields/SFP/types';\nimport defaultProps from './defaultProps';\nimport './CardInput.scss';\nimport { AddressModeOptions, CardInputDataState, CardInputErrorState, CardInputProps, CardInputRef, CardInputValidState } from './types';\nimport { CVC_POLICY_REQUIRED, DATE_POLICY_REQUIRED, ENCRYPTED_CARD_NUMBER } from '../../../internal/SecuredFields/lib/configuration/constants';\nimport { BinLookupResponse } from '../../types';\nimport { cardInputFormatters, cardInputValidationRules, getRuleByNameAndMode } from './validate';\nimport CIExtensions from '../../../internal/SecuredFields/binLookup/extensions';\nimport useForm from '../../../../utils/useForm';\nimport { SetSRMessagesReturnObject, SortedErrorObject } from '../../../../core/Errors/types';\nimport { handlePartialAddressMode, extractPropsForCardFields, extractPropsForSFP, getLayout, lookupBlurBasedErrors, mapFieldKey } from './utils';\nimport { usePrevious } from '../../../../utils/hookUtils';\nimport Specifications from '../../../internal/Address/Specifications';\nimport { StoredCardFieldsWrapper } from './components/StoredCardFieldsWrapper';\nimport { CardFieldsWrapper } from './components/CardFieldsWrapper';\nimport { getAddressHandler, getAutoJumpHandler, getFocusHandler, setFocusOnFirstField } from './handlers';\nimport { InstallmentsObj } from './components/Installments/Installments';\nimport { TouchStartEventObj } from './components/types';\nimport classNames from 'classnames';\nimport { getPartialAddressValidationRules } from '../../../internal/Address/validate';\nimport { ERROR_ACTION_BLUR_SCENARIO, ERROR_ACTION_FOCUS_FIELD } from '../../../../core/Errors/constants';\nimport useSRPanelContext from '../../../../core/Errors/useSRPanelContext';\nimport { SetSRMessagesReturnFn } from '../../../../core/Errors/SRPanelProvider';\nimport useImage from '../../../../core/Context/useImage';\nimport { getArrayDifferences } from '../../../../utils/arrayUtils';\nimport FormInstruction from '../../../internal/FormInstruction';\nimport { AddressData } from '../../../../types/global-types';\nimport { CbObjOnFocus } from '../../../internal/SecuredFields/lib/types';\nimport { FieldErrorAnalyticsObject } from '../../../../core/Analytics/types';\n\nconst CardInput = (props: CardInputProps) => {\n const sfp = useRef(null);\n const isValidating = useRef(false);\n const getImage = useImage();\n\n /** SR stuff */\n const { setSRMessagesFromObjects, setSRMessagesFromStrings, clearSRPanel, shouldMoveFocusSR } = useSRPanelContext();\n\n // Generate a setSRMessages function - implemented as a partial, since the initial set of arguments don't change.\n const setSRMessages: SetSRMessagesReturnFn = setSRMessagesFromObjects?.({\n fieldTypeMappingFn: mapFieldKey\n });\n /** end SR stuff */\n\n const billingAddressRef = useRef(null);\n const setAddressRef = ref => {\n billingAddressRef.current = ref;\n };\n\n const cardInputRef = useRef<CardInputRef>({});\n // Just call once to create the object by which we expose the members expected by the parent Card comp\n if (!Object.keys(cardInputRef.current).length) {\n props.setComponentRef(cardInputRef.current);\n }\n\n const hasPanLengthRef = useRef(0);\n const isAutoJumping = useRef(false);\n\n const specifications = useMemo(() => new Specifications(props.specifications), [props.specifications]);\n\n // Store ref to sfp (useful for 'deep' debugging)\n cardInputRef.current.sfp = sfp;\n\n /**\n * STATE HOOKS\n */\n const [status, setStatus] = useState('ready');\n\n const [errors, setErrors] = useState<CardInputErrorState>({});\n const [valid, setValid] = useState<CardInputValidState>({\n ...(props.holderNameRequired && { holderName: false })\n });\n const [data, setData] = useState<CardInputDataState>({\n ...(props.hasHolderName && { holderName: props.data.holderName ?? '' })\n });\n\n const [sortedErrorList, setSortedErrorList] = useState<SortedErrorObject[]>(null);\n\n const [focusedElement, setFocusedElement] = useState('');\n const [isSfpValid, setIsSfpValid] = useState(false);\n const [expiryDatePolicy, setExpiryDatePolicy] = useState(DATE_POLICY_REQUIRED);\n const [cvcPolicy, setCvcPolicy] = useState(CVC_POLICY_REQUIRED);\n const [issuingCountryCode, setIssuingCountryCode] = useState<string>(null);\n\n const [dualBrandSelectElements, setDualBrandSelectElements] = useState([]);\n const [selectedBrandValue, setSelectedBrandValue] = useState(props.storedPaymentMethodId ? props.brand : ''); // If this is a storedCard comp initialise state with the storedCard's brand\n\n const showBillingAddress = props.billingAddressMode !== AddressModeOptions.none && props.billingAddressRequired;\n\n const partialAddressSchema = handlePartialAddressMode(props.billingAddressMode);\n // Keeps the value of the country set initially by the merchant, before the Address Component mutates it\n const partialAddressCountry = useRef<string>(partialAddressSchema && props.data?.billingAddress?.country);\n\n const [storePaymentMethod, setStorePaymentMethod] = useState(false);\n const [billingAddress, setBillingAddress] = useState<AddressData>(showBillingAddress ? props.data.billingAddress : null);\n const [showSocialSecurityNumber, setShowSocialSecurityNumber] = useState(false);\n const [socialSecurityNumber, setSocialSecurityNumber] = useState('');\n const [installments, setInstallments] = useState<InstallmentsObj>({ value: null });\n\n // re. Disable arrows for iOS: The name of the element calling for other elements to be disabled\n // - either a securedField type (like 'encryptedCardNumber') when call is coming from SF\n // or else the name of an internal, Adyen-web, element (like 'holderName')\n const [iOSFocusedField, setIOSFocusedField] = useState(null);\n\n /**\n * LOCAL VARS\n */\n const {\n handleChangeFor,\n triggerValidation,\n data: formData,\n valid: formValid,\n errors: formErrors,\n setSchema,\n setData: setFormData,\n setValid: setFormValid,\n setErrors: setFormErrors\n } = useForm<CardInputDataState>({\n schema: [],\n defaultData: props.data,\n formatters: cardInputFormatters,\n rules: cardInputValidationRules\n });\n\n const hasInstallments = !!Object.keys(props.installmentOptions).length && props.fundingSource !== 'debit';\n const showAmountsInInstallments = props.showInstallmentAmounts ?? true;\n\n const cardCountryCode: string = issuingCountryCode ?? props.countryCode;\n const isKorea = cardCountryCode === 'kr'; // If issuingCountryCode or the merchant defined countryCode is set to 'kr'\n const showKCP = props.configuration.koreanAuthenticationRequired && isKorea;\n\n const showBrazilianSSN: boolean =\n (showSocialSecurityNumber && props.configuration.socialSecurityNumberMode === 'auto') ||\n props.configuration.socialSecurityNumberMode === 'show';\n\n /**\n * HANDLERS\n */\n // Handlers for focus & blur on all fields. Can be renamed to onFieldFocus once the onFocusField is renamed in Field.tsx\n const onFieldFocusAnalytics = (who: string, e: Event | CbObjOnFocus) => {\n props.onFocus({ fieldType: who, event: e });\n };\n const onFieldBlurAnalytics = (who: string, e: Event | CbObjOnFocus) => {\n props.onBlur({ fieldType: who, event: e });\n };\n\n // Make SecuredFields aware of the focus & blur handlers\n const handleFocus = getFocusHandler(setFocusedElement, onFieldFocusAnalytics, onFieldBlurAnalytics);\n\n const retrieveLayout = (): string[] => {\n return getLayout({\n props,\n showKCP,\n showBrazilianSSN,\n ...(props.billingAddressRequired && {\n countrySpecificSchemas: specifications.getAddressSchemaForCountry(billingAddress?.country),\n billingAddressRequiredFields: props.billingAddressRequiredFields\n })\n });\n };\n\n /**\n * re. Disabling arrow keys in iOS:\n * Only by disabling all fields in the Card PM except for the active securedField input can we force the iOS soft keyboard arrow keys to disable\n *\n * NOTE: only called if ua.__IS_IOS = true && this.config.disableIOSArrowKeys = true (as referenced in CSF)\n *\n * @param obj - has fieldType prop saying whether this function is being called in response to an securedFields click ('encryptedCardNumber' etc)\n * - in which case we should disable all non-SF fields\n * or,\n * due to an internal action ('webInternalElement') - in which case we can enable all non-SF fields\n */\n const handleTouchstartIOS = useCallback((obj: TouchStartEventObj) => {\n const elementType = obj.fieldType !== 'webInternalElement' ? obj.fieldType : obj.name;\n setIOSFocusedField(elementType);\n }, []);\n\n const handleAddress = getAddressHandler(setFormData, setFormValid, setFormErrors);\n\n const doPanAutoJump = getAutoJumpHandler(isAutoJumping, sfp, retrieveLayout());\n\n const handleSecuredFieldsChange = (sfState: SFPState, eventDetails?: OnChangeEventDetails): void => {\n /**\n * Handling auto complete value for holderName (but only if the component is using a holderName field)\n */\n if (sfState.autoCompleteName) {\n if (!props.hasHolderName) return;\n const holderNameValidationFn = getRuleByNameAndMode('holderName', 'blur');\n const acHolderName = holderNameValidationFn(sfState.autoCompleteName) ? sfState.autoCompleteName : null;\n if (acHolderName) {\n setFormData('holderName', acHolderName);\n setFormValid('holderName', true); // only if holderName is valid does this fny get called - so we know it's valid and w/o error\n setFormErrors('holderName', null);\n }\n return;\n }\n\n /**\n * Decide if we can shift focus to the expiryDate field.\n *\n * We can if... the config prop, autoFocus, is true AND we have a panLength value from binLookup\n * AND we are responding to a handleOnFieldValid message about the PAN that says it is valid\n */\n if (\n props.autoFocus &&\n hasPanLengthRef.current > 0 &&\n eventDetails?.event === 'handleOnFieldValid' &&\n eventDetails?.fieldType === ENCRYPTED_CARD_NUMBER &&\n sfState.valid.encryptedCardNumber\n ) {\n doPanAutoJump();\n }\n\n /**\n * Process SFP state\n */\n setData({ ...data, ...sfState.data });\n setErrors({ ...errors, ...sfState.errors });\n setValid({ ...valid, ...sfState.valid });\n\n setIsSfpValid(sfState.isSfpValid);\n\n // Values relating to /binLookup response\n setCvcPolicy(sfState.cvcPolicy);\n setShowSocialSecurityNumber(sfState.showSocialSecurityNumber);\n setExpiryDatePolicy(sfState.expiryDatePolicy);\n };\n\n // Farm the handlers for binLookup related functionality out to another 'extensions' file\n const extensions = useMemo(\n () =>\n CIExtensions(\n props,\n { sfp },\n {\n dualBrandSelectElements,\n setDualBrandSelectElements,\n setSelectedBrandValue,\n issuingCountryCode,\n setIssuingCountryCode\n },\n hasPanLengthRef\n ),\n [dualBrandSelectElements, issuingCountryCode]\n );\n\n /**\n * EXPOSE METHODS expected by Card.tsx\n */\n cardInputRef.current.showValidation = () => {\n // set flag\n isValidating.current = true;\n\n /**\n * Clear errors prior to validating so that the screenreader will read them *all* again, and in the right order\n * - only using aria-atomic on the error panel will read them in the wrong order\n */\n clearSRPanel?.(); // TODO - recheck if this is still true\n\n // Validate SecuredFields\n sfp.current.showValidation();\n\n // Validate holderName & SSN & KCP (taxNumber) but *not* billingAddress\n triggerValidation(['holderName', 'socialSecurityNumber', 'taxNumber']);\n\n // Validate Address\n if (billingAddressRef?.current) billingAddressRef.current.showValidation();\n };\n\n cardInputRef.current.processBinLookupResponse = (binLookupResponse: BinLookupResponse, isReset: boolean) => {\n extensions.processBinLookup(binLookupResponse, isReset);\n };\n\n cardInputRef.current.setStatus = setStatus;\n\n /**\n * EFFECT HOOKS\n */\n useEffect(() => {\n // componentDidMount - expose more methods expected by Card.tsx\n cardInputRef.current.setFocusOn = sfp.current.setFocusOn;\n cardInputRef.current.updateStyles = sfp.current.updateStyles;\n cardInputRef.current.handleUnsupportedCard = sfp.current.handleUnsupportedCard;\n\n // componentWillUnmount\n return () => {\n sfp.current.destroy();\n };\n }, []);\n\n /**\n * Handle form schema updates\n */\n useEffect(() => {\n const newSchema = [\n ...(props.hasHolderName ? ['holderName'] : []),\n ...(showBrazilianSSN ? ['socialSecurityNumber'] : []),\n ...(showKCP ? ['taxNumber'] : []),\n ...(showBillingAddress ? ['billingAddress'] : [])\n ];\n setSchema(newSchema);\n }, [props.hasHolderName, showBrazilianSSN, showKCP]);\n\n /**\n * Handle updates from useForm\n */\n useEffect(() => {\n setData({ ...data, holderName: formData.holderName ?? '', taxNumber: formData.taxNumber });\n\n setSocialSecurityNumber(formData.socialSecurityNumber);\n\n if (showBillingAddress) setBillingAddress({ ...formData.billingAddress });\n\n setValid({\n ...valid,\n holderName: props.holderNameRequired ? formValid.holderName : true,\n // Setting value to false if it's falsy keeps in line with existing, expected behaviour\n // - but there is an argument to allow 'undefined' as a value to indicate the non-presence of the field\n socialSecurityNumber: formValid.socialSecurityNumber ? formValid.socialSecurityNumber : false,\n taxNumber: formValid.taxNumber ? formValid.taxNumber : false,\n billingAddress: formValid.billingAddress ? formValid.billingAddress : false\n });\n\n // Check if billingAddress errors object has any properties that aren't null or undefined\n const addressHasErrors = formErrors.billingAddress\n ? Object.entries(formErrors.billingAddress).reduce((acc, [, error]) => acc || error != null, false)\n : false;\n\n // Errors\n setErrors({\n ...errors,\n holderName: props.holderNameRequired && !!formErrors.holderName ? formErrors.holderName : null,\n socialSecurityNumber: showBrazilianSSN && !!formErrors.socialSecurityNumber ? formErrors.socialSecurityNumber : null,\n taxNumber: showKCP && !!formErrors.taxNumber ? formErrors.taxNumber : null,\n billingAddress: showBillingAddress && addressHasErrors ? formErrors.billingAddress : null\n });\n }, [formData, formValid, formErrors]);\n\n // Get the previous value\n const previousSortedErrors = usePrevious(sortedErrorList);\n\n /**\n * Main 'componentDidUpdate' handler\n */\n useEffect(() => {\n const holderNameValid: boolean = valid.holderName;\n\n const sfpValid: boolean = isSfpValid;\n const addressValid: boolean = showBillingAddress ? valid.billingAddress : true;\n\n const koreanAuthentication: boolean = showKCP ? !!valid.taxNumber && !!valid.encryptedPassword : true;\n\n const socialSecurityNumberValid: boolean = showBrazilianSSN ? !!valid.socialSecurityNumber : true;\n\n const isValid: boolean = sfpValid && holderNameValid && addressValid && koreanAuthentication && socialSecurityNumberValid;\n\n const sfStateErrorsObj = sfp.current.mapErrorsToValidationRuleResult();\n const mergedErrors = { ...errors, ...sfStateErrorsObj }; // maps sfErrors AND solves race condition problems for sfp from showValidation\n\n // Extract and then flatten billingAddress errors into a new object with *all* the field errors at top level\n const { billingAddress: extractedAddressErrors, ...errorsWithoutAddress } = mergedErrors;\n\n const errorsForPanel = { ...errorsWithoutAddress, ...extractedAddressErrors };\n\n // Pass dynamic props (errors, layout etc) to SRPanel via partial\n const srPanelResp: SetSRMessagesReturnObject = setSRMessages?.({\n errors: errorsForPanel,\n isValidating: isValidating.current,\n layout: retrieveLayout(),\n // If we don't have country specific address labels, we might have a label related to a partialAddressSchema (i.e. zipCode)\n countrySpecificLabels: specifications.getAddressLabelsForCountry(billingAddress?.country) ?? partialAddressSchema?.default?.labels\n });\n\n /**\n * Need extra actions after setting SRPanel messages in order to focus field (if required) and because we have some errors that are fired onBlur\n */\n const currentErrorsSortedByLayout = srPanelResp?.currentErrorsSortedByLayout;\n\n // Store the array of sorted error objects separately so that we can use it to make comparisons between the old and new arrays\n setSortedErrorList(currentErrorsSortedByLayout);\n\n switch (srPanelResp?.action) {\n // A call to focus the first field in error will always follow the call to validate the whole form\n case ERROR_ACTION_FOCUS_FIELD:\n if (shouldMoveFocusSR) setFocusOnFirstField(isValidating.current, sfp, srPanelResp?.fieldToFocus);\n // Remove 'showValidation' mode - allowing time for collation of all the fields in error whilst it is 'showValidation' mode (some errors come in a second render pass)\n setTimeout(() => {\n isValidating.current = false;\n }, 300);\n break;\n /** On blur scenario: not validating, i.e. trying to submit form, but there might be an error, either to set or to clear */\n case ERROR_ACTION_BLUR_SCENARIO: {\n const difference = getArrayDifferences<SortedErrorObject, string>(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n\n const latestErrorMsg = difference?.[0];\n\n if (latestErrorMsg) {\n // Use the error code to look up whether error is actually a blur based one (most are but some SF ones aren't)\n const isBlurBasedError = lookupBlurBasedErrors(latestErrorMsg.errorCode);\n\n /**\n * ONLY ADD BLUR BASED ERRORS TO THE ERROR PANEL - doing this step prevents the non-blur based errors from being read out twice\n * (once from the aria-live, error panel & once from the aria-describedby element)\n */\n const latestSRError = isBlurBasedError ? latestErrorMsg.errorMessage : null;\n // console.log('### CardInput2::componentDidUpdate:: #2 (not validating) single error:: latestSRError', latestSRError);\n setSRMessagesFromStrings(latestSRError);\n } else {\n // called when previousSortedErrors.length >= currentErrorsSortedByLayout.length\n // console.log('### CardInput2::componentDidUpdate:: #3(not validating) clearing errors:: NO latestErrorMsg');\n clearSRPanel();\n }\n break;\n }\n default:\n break;\n }\n\n // Analytics\n if (currentErrorsSortedByLayout) {\n const newErrors = getArrayDifferences<SortedErrorObject, string>(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n newErrors?.forEach(errorItem => {\n const aObj: FieldErrorAnalyticsObject = {\n fieldType: errorItem.field,\n errorCode: errorItem.errorCode\n };\n\n props.onValidationErrorAnalytics(aObj);\n });\n }\n\n props.onChange({\n data,\n valid,\n errors: mergedErrors,\n isValid,\n billingAddress,\n selectedBrandValue,\n storePaymentMethod,\n socialSecurityNumber,\n installments\n });\n }, [data, valid, errors, selectedBrandValue, storePaymentMethod, installments]);\n\n /**\n * RENDER\n */\n const FieldToRender = props.storedPaymentMethodId ? StoredCardFieldsWrapper : CardFieldsWrapper;\n\n return (\n <Fragment>\n <SecuredFieldsProvider\n ref={sfp}\n {...extractPropsForSFP(props)}\n styles={{ ...props.styles }}\n koreanAuthenticationRequired={props.configuration.koreanAuthenticationRequired}\n hasKoreanFields={!!(props.configuration.koreanAuthenticationRequired && props.countryCode === 'kr')}\n onChange={handleSecuredFieldsChange}\n onBrand={props.onBrand}\n onFocus={handleFocus}\n type={props.brand}\n disableIOSArrowKeys={props.disableIOSArrowKeys ? handleTouchstartIOS : null}\n render={({ setRootNode, setFocusOn }, sfpState) => (\n <div\n ref={setRootNode}\n className={classNames({\n 'adyen-checkout__card-input': true,\n 'adyen-checkout-card-input__wrapper': true,\n [`adyen-checkout__card-input--${props.fundingSource ?? 'credit'}`]: true,\n 'adyen-checkout__card-input--loading': status === 'loading'\n })}\n role={'form'}\n >\n {props.showFormInstruction && <FormInstruction />}\n <FieldToRender\n // Extract exact props that we need to pass down\n {...extractPropsForCardFields(props)}\n // Pass on vars created in CardInput:\n // Base (shared w. StoredCard)\n data={data}\n valid={valid}\n errors={errors}\n handleChangeFor={handleChangeFor}\n focusedElement={focusedElement}\n setFocusOn={setFocusOn}\n sfpState={sfpState}\n cvcPolicy={cvcPolicy}\n hasInstallments={hasInstallments}\n showAmountsInInstallments={showAmountsInInstallments}\n handleInstallments={setInstallments}\n // For Card\n brandsIcons={props.brandsIcons}\n formData={formData}\n formErrors={formErrors}\n formValid={formValid}\n expiryDatePolicy={expiryDatePolicy}\n dualBrandSelectElements={dualBrandSelectElements}\n extensions={extensions}\n selectedBrandValue={selectedBrandValue}\n // For KCP\n showKCP={showKCP}\n // For SSN\n showBrazilianSSN={showBrazilianSSN}\n socialSecurityNumber={socialSecurityNumber}\n // For Store details\n handleOnStoreDetails={setStorePaymentMethod}\n // For Address\n setAddressRef={setAddressRef}\n billingAddress={billingAddress}\n billingAddressValidationRules={partialAddressSchema && getPartialAddressValidationRules(partialAddressCountry.current)}\n partialAddressSchema={partialAddressSchema}\n handleAddress={handleAddress}\n onAddressLookup={props.onAddressLookup}\n onAddressSelected={props.onAddressSelected}\n addressSearchDebounceMs={props.addressSearchDebounceMs}\n //\n iOSFocusedField={iOSFocusedField}\n //\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n </div>\n )}\n />\n {props.showPayButton &&\n props.payButton({\n status,\n variant: props.isPayButtonPrimaryVariant ? 'primary' : 'secondary',\n icon: getImage({ imageFolder: 'components/' })('lock')\n })}\n </Fragment>\n );\n};\n\nCardInput.defaultProps = defaultProps;\n\nexport default CardInput;\n"],"names":["CardInput","props","sfp","useRef","isValidating","getImage","useImage","setSRMessagesFromObjects","setSRMessagesFromStrings","clearSRPanel","shouldMoveFocusSR","useSRPanelContext","setSRMessages","fieldTypeMappingFn","mapFieldKey","billingAddressRef","setAddressRef","ref","current","cardInputRef","Object","keys","length","setComponentRef","hasPanLengthRef","isAutoJumping","specifications","useMemo","Specifications","status","setStatus","useState","errors","setErrors","valid","setValid","holderNameRequired","holderName","data","setData","hasHolderName","sortedErrorList","setSortedErrorList","focusedElement","setFocusedElement","isSfpValid","setIsSfpValid","expiryDatePolicy","setExpiryDatePolicy","DATE_POLICY_REQUIRED","cvcPolicy","setCvcPolicy","CVC_POLICY_REQUIRED","issuingCountryCode","setIssuingCountryCode","dualBrandSelectElements","setDualBrandSelectElements","selectedBrandValue","setSelectedBrandValue","storedPaymentMethodId","brand","showBillingAddress","billingAddressMode","AddressModeOptions","none","billingAddressRequired","partialAddressSchema","handlePartialAddressMode","partialAddressCountry","billingAddress","country","storePaymentMethod","setStorePaymentMethod","setBillingAddress","showSocialSecurityNumber","setShowSocialSecurityNumber","socialSecurityNumber","setSocialSecurityNumber","installments","setInstallments","value","iOSFocusedField","setIOSFocusedField","handleChangeFor","triggerValidation","formData","formValid","formErrors","setSchema","setFormData","setFormValid","setFormErrors","useForm","schema","defaultData","formatters","cardInputFormatters","rules","cardInputValidationRules","hasInstallments","installmentOptions","fundingSource","showAmountsInInstallments","showInstallmentAmounts","isKorea","countryCode","showKCP","configuration","koreanAuthenticationRequired","showBrazilianSSN","socialSecurityNumberMode","onFieldFocusAnalytics","who","e","onFocus","fieldType","event","onFieldBlurAnalytics","onBlur","handleFocus","getFocusHandler","retrieveLayout","getLayout","countrySpecificSchemas","getAddressSchemaForCountry","billingAddressRequiredFields","handleTouchstartIOS","useCallback","obj","elementType","name","handleAddress","getAddressHandler","doPanAutoJump","getAutoJumpHandler","extensions","CIExtensions","showValidation","processBinLookupResponse","binLookupResponse","isReset","processBinLookup","useEffect","setFocusOn","updateStyles","handleUnsupportedCard","destroy","newSchema","taxNumber","addressHasErrors","entries","reduce","acc","error","previousSortedErrors","usePrevious","holderNameValid","sfpValid","addressValid","koreanAuthentication","encryptedPassword","socialSecurityNumberValid","isValid","sfStateErrorsObj","mapErrorsToValidationRuleResult","mergedErrors","extractedAddressErrors","errorsWithoutAddress","errorsForPanel","srPanelResp","layout","countrySpecificLabels","getAddressLabelsForCountry","default","labels","currentErrorsSortedByLayout","action","ERROR_ACTION_FOCUS_FIELD","setFocusOnFirstField","fieldToFocus","setTimeout","ERROR_ACTION_BLUR_SCENARIO","difference","getArrayDifferences","latestErrorMsg","latestSRError","lookupBlurBasedErrors","errorCode","errorMessage","newErrors","forEach","errorItem","aObj","field","onValidationErrorAnalytics","onChange","FieldToRender","StoredCardFieldsWrapper","CardFieldsWrapper","h","Fragment","SecuredFieldsProvider","extractPropsForSFP","styles","hasKoreanFields","sfState","eventDetails","autoCompleteName","acHolderName","getRuleByNameAndMode","holderNameValidationFn","autoFocus","ENCRYPTED_CARD_NUMBER","encryptedCardNumber","onBrand","type","disableIOSArrowKeys","render","setRootNode","sfpState","div","className","classNames","role","showFormInstruction","FormInstruction","extractPropsForCardFields","handleInstallments","brandsIcons","handleOnStoreDetails","billingAddressValidationRules","getPartialAddressValidationRules","onAddressLookup","onAddressSelected","addressSearchDebounceMs","showPayButton","payButton","variant","isPayButtonPrimaryVariant","icon","imageFolder","defaultProps"],"mappings":"uyDAiCA,MAAMA,EAAaC,IACf,MAAMC,EAAMC,EAAO,MACbC,EAAeD,GAAO,GACtBE,EAAWC,KAGXC,yBAAEA,EAAwBC,yBAAEA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Aa,eAAxB3O,CAAyC,UACnD,EAKhBL,EAAUiP,aAAeA"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../external/preact/dist/preact.js";import r from"../../../../internal/LoadingWrapper/LoadingWrapper.js";import a from"./CardFields.js";import s from"./KCPAuthentication.js";import l from"../../../../internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.js";import n from"../../../../internal/StoreDetails/StoreDetails.js";import o from"../../../../internal/Address/Address.js";import i from"./CardHolderName.js";import d from"./Installments/Installments.js";import t from"../../../../internal/DisclaimerMessage/DisclaimerMessage.js";const u=({data:u,valid:c,errors:m,handleChangeFor:p,sfpState:b,setFocusOn:h,cvcPolicy:y,focusedElement:N,hasInstallments:S,handleInstallments:A,showAmountsInInstallments:F,brandsIcons:g,formData:f,formErrors:C,formValid:B,expiryDatePolicy:x,dualBrandSelectElements:w,extensions:v,selectedBrandValue:D,showKCP:I,showBrazilianSSN:j,socialSecurityNumber:E,handleOnStoreDetails:P,billingAddress:O,handleAddress:k,setAddressRef:R,partialAddressSchema:V,onAddressLookup:q,onAddressSelected:M,addressSearchDebounceMs:H,amount:L,billingAddressRequired:T,billingAddressRequiredFields:_,billingAddressAllowedCountries:z,billingAddressValidationRules:K=null,brandsConfiguration:W,enableStoreDetails:$,hasCVC:G,hasHolderName:J,holderNameRequired:Q,installmentOptions:U,placeholders:X,positionHolderNameOnTop:Y,showBrandIcon:Z,showContextualElement:ee,iOSFocusedField:re,disclaimerMessage:ae,onFieldFocusAnalytics:se,onFieldBlurAnalytics:le})=>{const ne=e(i,{required:Q,placeholder:X.holderName,value:f.holderName,error:!!C.holderName&&Q,isValid:!!B.holderName,onBlur:p("holderName","blur"),onInput:p("holderName","input"),disabled:re&&"holderName"!==re,onFieldFocusAnalytics:se,onFieldBlurAnalytics:le});return e(r,{status:b.status},J&&Y&&ne,e(a,{showBrandIcon:Z,showContextualElement:ee,brand:b.brand,brandsIcons:g,brandsConfiguration:W,focusedElement:N,onFocusField:h,hasCVC:G,cvcPolicy:y,expiryDatePolicy:x,errors:b.errors,valid:b.valid,dualBrandingElements:w.length>0&&w,dualBrandingChangeHandler:v.handleDualBrandSelection,dualBrandingSelected:D}),J&&!Y&&ne,I&&e(s,{onFocusField:h,focusedElement:N,encryptedPasswordState:{data:b.encryptedPassword,valid:!!b.valid&&b.valid.encryptedPassword,errors:!!b.errors&&b.errors.encryptedPassword},value:u.taxNumber,error:!!m.taxNumber,isValid:!!c.taxNumber,onBlur:p("taxNumber","blur"),onInput:p("taxNumber","input"),disabled:re&&"kcpTaxNumberOrDOB"!==re,placeholder:X.taxNumber,onFieldFocusAnalytics:se,onFieldBlurAnalytics:le}),j&&e("div",{className:"adyen-checkout__card__socialSecurityNumber"},e(l,{onBlur:p("socialSecurityNumber","blur"),onInput:p("socialSecurityNumber","input"),error:m?.socialSecurityNumber,valid:c?.socialSecurityNumber,data:E,required:!0,disabled:re&&"socialSecurityNumber"!==re,onFieldFocusAnalytics:se,onFieldBlurAnalytics:le})),$&&e(n,{onChange:P}),S&&e(d,{amount:L,brand:b.brand,installmentOptions:U,onChange:A,type:F?"amount":"months"}),T&&e(o,{label:"billingAddress",data:O,onChange:k,allowedCountries:z,requiredFields:_,setComponentRef:R,validationRules:K,specifications:V,iOSFocusedField:re,onAddressLookup:q,showContextualElement:ee,onAddressSelected:M,addressSearchDebounceMs:H,onFieldFocusAnalytics:se,onFieldBlurAnalytics:le}),ae&&e(t,{message:ae.message.replace("%{linkText}",`%#${ae.linkText}%#`),urls:[ae.link]}))};export{u as CardFieldsWrapper};
1
+ import{createElement as e}from"../../../../../external/preact/dist/preact.js";import r from"../../../../internal/LoadingWrapper/LoadingWrapper.js";import a from"./CardFields.js";import s from"./KCPAuthentication.js";import l from"../../../../internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil.js";import n from"../../../../internal/StoreDetails/StoreDetails.js";import o from"../../../../internal/Address/Address.js";import i from"./CardHolderName.js";import d from"./Installments/Installments.js";import t from"../../../../internal/DisclaimerMessage/DisclaimerMessage.js";const u=({data:u,valid:c,errors:m,handleChangeFor:p,sfpState:h,setFocusOn:b,cvcPolicy:y,focusedElement:N,hasInstallments:S,handleInstallments:A,showAmountsInInstallments:F,brandsIcons:g,formData:f,formErrors:C,formValid:B,expiryDatePolicy:x,dualBrandSelectElements:w,extensions:v,selectedBrandValue:D,showKCP:I,showBrazilianSSN:j,socialSecurityNumber:E,handleOnStoreDetails:P,billingAddress:O,handleAddress:k,setAddressRef:R,partialAddressSchema:V,onAddressLookup:q,onAddressSelected:M,addressSearchDebounceMs:H,amount:L,billingAddressRequired:T,billingAddressRequiredFields:_,billingAddressAllowedCountries:z,billingAddressValidationRules:K=null,brandsConfiguration:W,showStoreDetailsCheckbox:$,hasCVC:G,hasHolderName:J,holderNameRequired:Q,installmentOptions:U,placeholders:X,positionHolderNameOnTop:Y,showBrandIcon:Z,showContextualElement:ee,iOSFocusedField:re,disclaimerMessage:ae,onFieldFocusAnalytics:se,onFieldBlurAnalytics:le})=>{const ne=e(i,{required:Q,placeholder:X.holderName,value:f.holderName,error:!!C.holderName&&Q,isValid:!!B.holderName,onBlur:p("holderName","blur"),onInput:p("holderName","input"),disabled:re&&"holderName"!==re,onFieldFocusAnalytics:se,onFieldBlurAnalytics:le});return e(r,{status:h.status},J&&Y&&ne,e(a,{showBrandIcon:Z,showContextualElement:ee,brand:h.brand,brandsIcons:g,brandsConfiguration:W,focusedElement:N,onFocusField:b,hasCVC:G,cvcPolicy:y,expiryDatePolicy:x,errors:h.errors,valid:h.valid,dualBrandingElements:w.length>0&&w,dualBrandingChangeHandler:v.handleDualBrandSelection,dualBrandingSelected:D}),J&&!Y&&ne,I&&e(s,{onFocusField:b,focusedElement:N,encryptedPasswordState:{data:h.encryptedPassword,valid:!!h.valid&&h.valid.encryptedPassword,errors:!!h.errors&&h.errors.encryptedPassword},value:u.taxNumber,error:!!m.taxNumber,isValid:!!c.taxNumber,onBlur:p("taxNumber","blur"),onInput:p("taxNumber","input"),disabled:re&&"kcpTaxNumberOrDOB"!==re,placeholder:X.taxNumber,onFieldFocusAnalytics:se,onFieldBlurAnalytics:le}),j&&e("div",{className:"adyen-checkout__card__socialSecurityNumber"},e(l,{onBlur:p("socialSecurityNumber","blur"),onInput:p("socialSecurityNumber","input"),error:m?.socialSecurityNumber,valid:c?.socialSecurityNumber,data:E,required:!0,disabled:re&&"socialSecurityNumber"!==re,onFieldFocusAnalytics:se,onFieldBlurAnalytics:le})),$&&e(n,{onChange:P}),S&&e(d,{amount:L,brand:h.brand,installmentOptions:U,onChange:A,type:F?"amount":"months"}),T&&e(o,{label:"billingAddress",data:O,onChange:k,allowedCountries:z,requiredFields:_,setComponentRef:R,validationRules:K,specifications:V,iOSFocusedField:re,onAddressLookup:q,showContextualElement:ee,onAddressSelected:M,addressSearchDebounceMs:H,onFieldFocusAnalytics:se,onFieldBlurAnalytics:le}),ae&&e(t,{message:ae.message.replace("%{linkText}",`%#${ae.linkText}%#`),urls:[ae.link]}))};export{u as CardFieldsWrapper};
2
2
  //# sourceMappingURL=CardFieldsWrapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CardFieldsWrapper.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CardFieldsWrapper.tsx"],"sourcesContent":["import { h } from 'preact';\nimport LoadingWrapper from '../../../../internal/LoadingWrapper';\nimport CardFields from './CardFields';\nimport KCPAuthentication from './KCPAuthentication';\nimport SocialSecurityNumberBrazil from '../../../../internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil';\nimport StoreDetails from '../../../../internal/StoreDetails';\nimport Address from '../../../../internal/Address';\nimport CardHolderName from './CardHolderName';\nimport Installments from './Installments';\nimport DisclaimerMessage from '../../../../internal/DisclaimerMessage';\n\nexport const CardFieldsWrapper = ({\n // vars created in CardInput:\n // base (shared)\n data,\n valid,\n errors,\n handleChangeFor,\n sfpState,\n setFocusOn,\n cvcPolicy,\n focusedElement,\n hasInstallments,\n handleInstallments,\n showAmountsInInstallments,\n // Card\n brandsIcons,\n formData,\n formErrors,\n formValid,\n expiryDatePolicy,\n dualBrandSelectElements,\n extensions,\n selectedBrandValue,\n // KCP\n showKCP,\n // SSN\n showBrazilianSSN,\n socialSecurityNumber,\n // Store details\n handleOnStoreDetails,\n // Address\n billingAddress,\n handleAddress,\n setAddressRef,\n partialAddressSchema,\n onAddressLookup,\n onAddressSelected,\n addressSearchDebounceMs,\n // For this comp (props passed through from CardInput)\n amount,\n billingAddressRequired,\n billingAddressRequiredFields,\n billingAddressAllowedCountries,\n billingAddressValidationRules = null,\n brandsConfiguration,\n enableStoreDetails,\n hasCVC,\n hasHolderName,\n holderNameRequired,\n installmentOptions,\n placeholders,\n positionHolderNameOnTop,\n // For CardFields > CardNumber\n showBrandIcon,\n showContextualElement,\n //\n iOSFocusedField,\n disclaimerMessage,\n //\n onFieldFocusAnalytics,\n onFieldBlurAnalytics\n}) => {\n const cardHolderField = (\n <CardHolderName\n required={holderNameRequired}\n placeholder={placeholders.holderName}\n value={formData.holderName}\n error={!!formErrors.holderName && holderNameRequired}\n isValid={!!formValid.holderName}\n onBlur={handleChangeFor('holderName', 'blur')}\n onInput={handleChangeFor('holderName', 'input')}\n disabled={iOSFocusedField && iOSFocusedField !== 'holderName'}\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n );\n\n return (\n <LoadingWrapper status={sfpState.status}>\n {hasHolderName && positionHolderNameOnTop && cardHolderField}\n\n <CardFields\n showBrandIcon={showBrandIcon}\n showContextualElement={showContextualElement}\n brand={sfpState.brand}\n brandsIcons={brandsIcons}\n brandsConfiguration={brandsConfiguration}\n focusedElement={focusedElement}\n onFocusField={setFocusOn}\n hasCVC={hasCVC}\n cvcPolicy={cvcPolicy}\n expiryDatePolicy={expiryDatePolicy}\n errors={sfpState.errors}\n valid={sfpState.valid}\n dualBrandingElements={dualBrandSelectElements.length > 0 && dualBrandSelectElements}\n dualBrandingChangeHandler={extensions.handleDualBrandSelection}\n dualBrandingSelected={selectedBrandValue}\n />\n\n {hasHolderName && !positionHolderNameOnTop && cardHolderField}\n\n {showKCP && (\n <KCPAuthentication\n onFocusField={setFocusOn}\n focusedElement={focusedElement}\n encryptedPasswordState={{\n data: sfpState.encryptedPassword,\n valid: sfpState.valid ? sfpState.valid.encryptedPassword : false,\n errors: sfpState.errors ? sfpState.errors.encryptedPassword : false\n }}\n value={data.taxNumber}\n error={!!errors.taxNumber}\n isValid={!!valid.taxNumber}\n onBlur={handleChangeFor('taxNumber', 'blur')}\n onInput={handleChangeFor('taxNumber', 'input')}\n disabled={iOSFocusedField && iOSFocusedField !== 'kcpTaxNumberOrDOB'}\n placeholder={placeholders.taxNumber}\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n )}\n\n {showBrazilianSSN && (\n <div className=\"adyen-checkout__card__socialSecurityNumber\">\n <SocialSecurityNumberBrazil\n onBlur={handleChangeFor('socialSecurityNumber', 'blur')}\n onInput={handleChangeFor('socialSecurityNumber', 'input')}\n error={errors?.socialSecurityNumber}\n valid={valid?.socialSecurityNumber}\n data={socialSecurityNumber}\n required={true}\n disabled={iOSFocusedField && iOSFocusedField !== 'socialSecurityNumber'}\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n </div>\n )}\n\n {enableStoreDetails && <StoreDetails onChange={handleOnStoreDetails} />}\n\n {hasInstallments && (\n <Installments\n amount={amount}\n brand={sfpState.brand}\n installmentOptions={installmentOptions}\n onChange={handleInstallments}\n type={showAmountsInInstallments ? 'amount' : 'months'}\n />\n )}\n\n {billingAddressRequired && (\n <Address\n label=\"billingAddress\"\n data={billingAddress}\n onChange={handleAddress}\n allowedCountries={billingAddressAllowedCountries}\n requiredFields={billingAddressRequiredFields}\n setComponentRef={setAddressRef}\n validationRules={billingAddressValidationRules}\n specifications={partialAddressSchema}\n iOSFocusedField={iOSFocusedField}\n onAddressLookup={onAddressLookup}\n showContextualElement={showContextualElement}\n onAddressSelected={onAddressSelected}\n addressSearchDebounceMs={addressSearchDebounceMs}\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n )}\n\n {disclaimerMessage && (\n <DisclaimerMessage\n message={disclaimerMessage.message.replace('%{linkText}', `%#${disclaimerMessage.linkText}%#`)}\n urls={[disclaimerMessage.link]}\n />\n )}\n </LoadingWrapper>\n );\n};\n"],"names":["CardFieldsWrapper","data","valid","errors","handleChangeFor","sfpState","setFocusOn","cvcPolicy","focusedElement","hasInstallments","handleInstallments","showAmountsInInstallments","brandsIcons","formData","formErrors","formValid","expiryDatePolicy","dualBrandSelectElements","extensions","selectedBrandValue","showKCP","showBrazilianSSN","socialSecurityNumber","handleOnStoreDetails","billingAddress","handleAddress","setAddressRef","partialAddressSchema","onAddressLookup","onAddressSelected","addressSearchDebounceMs","amount","billingAddressRequired","billingAddressRequiredFields","billingAddressAllowedCountries","billingAddressValidationRules","brandsConfiguration","enableStoreDetails","hasCVC","hasHolderName","holderNameRequired","installmentOptions","placeholders","positionHolderNameOnTop","showBrandIcon","showContextualElement","iOSFocusedField","disclaimerMessage","onFieldFocusAnalytics","onFieldBlurAnalytics","cardHolderField","h","CardHolderName","required","placeholder","holderName","value","error","isValid","onBlur","onInput","disabled","LoadingWrapper","status","CardFields","brand","onFocusField","dualBrandingElements","length","dualBrandingChangeHandler","handleDualBrandSelection","dualBrandingSelected","KCPAuthentication","encryptedPasswordState","encryptedPassword","taxNumber","div","className","SocialSecurityNumberBrazil","StoreDetails","onChange","Installments","type","Address","label","allowedCountries","requiredFields","setComponentRef","validationRules","specifications","DisclaimerMessage","message","replace","linkText","urls","link"],"mappings":"ykBAWaA,MAAAA,EAAoB,EAG7BC,OACAC,QACAC,SACAC,kBACAC,WACAC,aACAC,YACAC,iBACAC,kBACAC,qBACAC,4BAEAC,cACAC,WACAC,aACAC,YACAC,mBACAC,0BACAC,aACAC,q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D,EAAgB,YAAa,SACtCyD,SAAUf,IAAuC,sBAApBA,GAC7BQ,YAAaZ,EAAaiC,UAC1B3B,sBAAuBA,GACvBC,qBAAsBA,KAI7B5B,GACG8B,EAACyB,MAAAA,CAAIC,UAAU,8CACX1B,EAAC2B,EAAAA,CACGnB,OAAQvD,EAAgB,uBAAwB,QAChDwD,QAASxD,EAAgB,uBAAwB,SACjDqD,MAAOtD,GAAQmB,qBACfpB,MAAOA,GAAOoB,qBACdrB,KAAMqB,EACN+B,UAAU,EACVQ,SAAUf,IAAuC,yBAApBA,GAC7BE,sBAAuBA,GACvBC,qBAAsBA,MAKjCZ,GAAsBc,EAAC4B,EAAAA,CAAaC,SAAUzD,IAE9Cd,GACG0C,EAAC8B,EAAAA,CACGlD,OAAQA,EACRkC,MAAO5D,EAAS4D,MAChBxB,mBAAoBA,EACpBuC,SAAUtE,EACVwE,KAAMvE,EAA4B,SAAW,WAIpDqB,GACGmB,EAACgC,EAAAA,CACGC,MAAM,iBACNnF,KAAMuB,EACNwD,SAAUvD,EACV4D,iBAAkBnD,EAClBoD,eAAgBrD,EAChBsD,gBAAiB7D,EACjB8D,gBAAiBrD,EACjBsD,eAAgB9D,EAChBmB,gBAAiBA,GACjBlB,gBAAiBA,EACjBiB,sBAAuBA,GACvBhB,kBAAmBA,EACnBC,wBAAyBA,EACzBkB,sBAAuBA,GACvBC,qBAAsBA,KAI7BF,IACGI,EAACuC,EAAAA,CACGC,QAAS5C,GAAkB4C,QAAQC,QAAQ,cAAe,KAAK7C,GAAkB8C,cACjFC,KAAM,CAAC/C,GAAkBgD"}
1
+ {"version":3,"file":"CardFieldsWrapper.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CardFieldsWrapper.tsx"],"sourcesContent":["import { h } from 'preact';\nimport LoadingWrapper from '../../../../internal/LoadingWrapper';\nimport CardFields from './CardFields';\nimport KCPAuthentication from './KCPAuthentication';\nimport SocialSecurityNumberBrazil from '../../../../internal/SocialSecurityNumberBrazil/SocialSecurityNumberBrazil';\nimport StoreDetails from '../../../../internal/StoreDetails';\nimport Address from '../../../../internal/Address';\nimport CardHolderName from './CardHolderName';\nimport Installments from './Installments';\nimport DisclaimerMessage from '../../../../internal/DisclaimerMessage';\n\nexport const CardFieldsWrapper = ({\n // vars created in CardInput:\n // base (shared)\n data,\n valid,\n errors,\n handleChangeFor,\n sfpState,\n setFocusOn,\n cvcPolicy,\n focusedElement,\n hasInstallments,\n handleInstallments,\n showAmountsInInstallments,\n // Card\n brandsIcons,\n formData,\n formErrors,\n formValid,\n expiryDatePolicy,\n dualBrandSelectElements,\n extensions,\n selectedBrandValue,\n // KCP\n showKCP,\n // SSN\n showBrazilianSSN,\n socialSecurityNumber,\n // Store details\n handleOnStoreDetails,\n // Address\n billingAddress,\n handleAddress,\n setAddressRef,\n partialAddressSchema,\n onAddressLookup,\n onAddressSelected,\n addressSearchDebounceMs,\n // For this comp (props passed through from CardInput)\n amount,\n billingAddressRequired,\n billingAddressRequiredFields,\n billingAddressAllowedCountries,\n billingAddressValidationRules = null,\n brandsConfiguration,\n showStoreDetailsCheckbox,\n hasCVC,\n hasHolderName,\n holderNameRequired,\n installmentOptions,\n placeholders,\n positionHolderNameOnTop,\n // For CardFields > CardNumber\n showBrandIcon,\n showContextualElement,\n //\n iOSFocusedField,\n disclaimerMessage,\n //\n onFieldFocusAnalytics,\n onFieldBlurAnalytics\n}) => {\n const cardHolderField = (\n <CardHolderName\n required={holderNameRequired}\n placeholder={placeholders.holderName}\n value={formData.holderName}\n error={!!formErrors.holderName && holderNameRequired}\n isValid={!!formValid.holderName}\n onBlur={handleChangeFor('holderName', 'blur')}\n onInput={handleChangeFor('holderName', 'input')}\n disabled={iOSFocusedField && iOSFocusedField !== 'holderName'}\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n );\n\n return (\n <LoadingWrapper status={sfpState.status}>\n {hasHolderName && positionHolderNameOnTop && cardHolderField}\n\n <CardFields\n showBrandIcon={showBrandIcon}\n showContextualElement={showContextualElement}\n brand={sfpState.brand}\n brandsIcons={brandsIcons}\n brandsConfiguration={brandsConfiguration}\n focusedElement={focusedElement}\n onFocusField={setFocusOn}\n hasCVC={hasCVC}\n cvcPolicy={cvcPolicy}\n expiryDatePolicy={expiryDatePolicy}\n errors={sfpState.errors}\n valid={sfpState.valid}\n dualBrandingElements={dualBrandSelectElements.length > 0 && dualBrandSelectElements}\n dualBrandingChangeHandler={extensions.handleDualBrandSelection}\n dualBrandingSelected={selectedBrandValue}\n />\n\n {hasHolderName && !positionHolderNameOnTop && cardHolderField}\n\n {showKCP && (\n <KCPAuthentication\n onFocusField={setFocusOn}\n focusedElement={focusedElement}\n encryptedPasswordState={{\n data: sfpState.encryptedPassword,\n valid: sfpState.valid ? sfpState.valid.encryptedPassword : false,\n errors: sfpState.errors ? sfpState.errors.encryptedPassword : false\n }}\n value={data.taxNumber}\n error={!!errors.taxNumber}\n isValid={!!valid.taxNumber}\n onBlur={handleChangeFor('taxNumber', 'blur')}\n onInput={handleChangeFor('taxNumber', 'input')}\n disabled={iOSFocusedField && iOSFocusedField !== 'kcpTaxNumberOrDOB'}\n placeholder={placeholders.taxNumber}\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n )}\n\n {showBrazilianSSN && (\n <div className=\"adyen-checkout__card__socialSecurityNumber\">\n <SocialSecurityNumberBrazil\n onBlur={handleChangeFor('socialSecurityNumber', 'blur')}\n onInput={handleChangeFor('socialSecurityNumber', 'input')}\n error={errors?.socialSecurityNumber}\n valid={valid?.socialSecurityNumber}\n data={socialSecurityNumber}\n required={true}\n disabled={iOSFocusedField && iOSFocusedField !== 'socialSecurityNumber'}\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n </div>\n )}\n\n {showStoreDetailsCheckbox && <StoreDetails onChange={handleOnStoreDetails} />}\n\n {hasInstallments && (\n <Installments\n amount={amount}\n brand={sfpState.brand}\n installmentOptions={installmentOptions}\n onChange={handleInstallments}\n type={showAmountsInInstallments ? 'amount' : 'months'}\n />\n )}\n\n {billingAddressRequired && (\n <Address\n label=\"billingAddress\"\n data={billingAddress}\n onChange={handleAddress}\n allowedCountries={billingAddressAllowedCountries}\n requiredFields={billingAddressRequiredFields}\n setComponentRef={setAddressRef}\n validationRules={billingAddressValidationRules}\n specifications={partialAddressSchema}\n iOSFocusedField={iOSFocusedField}\n onAddressLookup={onAddressLookup}\n showContextualElement={showContextualElement}\n onAddressSelected={onAddressSelected}\n addressSearchDebounceMs={addressSearchDebounceMs}\n onFieldFocusAnalytics={onFieldFocusAnalytics}\n onFieldBlurAnalytics={onFieldBlurAnalytics}\n />\n )}\n\n {disclaimerMessage && (\n <DisclaimerMessage\n message={disclaimerMessage.message.replace('%{linkText}', `%#${disclaimerMessage.linkText}%#`)}\n urls={[disclaimerMessage.link]}\n />\n )}\n </LoadingWrapper>\n );\n};\n"],"names":["CardFieldsWrapper","data","valid","errors","handleChangeFor","sfpState","setFocusOn","cvcPolicy","focusedElement","hasInstallments","handleInstallments","showAmountsInInstallments","brandsIcons","formData","formErrors","formValid","expiryDatePolicy","dualBrandSelectElements","extensions","selectedBrandValue","showKCP","showBrazilianSSN","socialSecurityNumber","handleOnStoreDetails","billingAddress","handleAddress","setAddressRef","partialAddressSchema","onAddressLookup","onAddressSelected","addressSearchDebounceMs","amount","billingAddressRequired","billingAddressRequiredFields","billingAddressAllowedCountries","billingAddressValidationRules","brandsConfiguration","showStoreDetailsCheckbox","hasCVC","hasHolderName","holderNameRequired","installmentOptions","placeholders","positionHolderNameOnTop","showBrandIcon","showContextualElement","iOSFocusedField","disclaimerMessage","onFieldFocusAnalytics","onFieldBlurAnalytics","cardHolderField","h","CardHolderName","required","placeholder","holderName","value","error","isValid","onBlur","onInput","disabled","LoadingWrapper","status","CardFields","brand","onFocusField","dualBrandingElements","length","dualBrandingChangeHandler","handleDualBrandSelection","dualBrandingSelected","KCPAuthentication","encryptedPasswordState","encryptedPassword","taxNumber","div","className","SocialSecurityNumberBrazil","StoreDetails","onChange","Installments","type","Address","label","allowedCountries","requiredFields","setComponentRef","validationRules","specifications","DisclaimerMessage","message","replace","linkText","urls","link"],"mappings":"ykBAWaA,MAAAA,EAAoB,EAG7BC,OACAC,QACAC,SACAC,kBACAC,WACAC,aACAC,YACAC,iBACAC,kBACAC,qBACAC,4BAEAC,cACAC,WACAC,aACAC,YACAC,mBACAC,0BACAC,aACAC,qBAEAC,UAEAC,mBACAC,uBAEAC,uBAEAC,iBACAC,gBACAC,gBACAC,uBACAC,kBACAC,oBACAC,0BAEAC,SACAC,yBACAC,+BACAC,iCACAC,gCAAgC,KAChCC,sBACAC,2BACAC,SACAC,gBACAC,qBACAC,qBACAC,eACAC,0BAEAC,gBACAC,yBAEAC,mBACAC,qBAEAC,yBACAC,4BAEA,MAAMC,GACFC,EAACC,EAAAA,CACGC,SAAUb,EACVc,YAAaZ,EAAaa,WAC1BC,MAAO3C,EAAS0C,WAChBE,QAAS3C,EAAWyC,YAAcf,EAClCkB,UAAW3C,EAAUwC,WACrBI,OAAQvD,EAAgB,aAAc,QACtCwD,QAASxD,EAAgB,aAAc,SACvCyD,SAAUf,IAAuC,eAApBA,GAC7BE,sBAAuBA,GACvBC,qBAAsBA,KAI9B,OACIE,EAACW,EAAAA,CAAeC,OAAQ1D,EAAS0D,QAC5BxB,GAAiBI,GAA2BO,GAE7CC,EAACa,EAAAA,CACGpB,cAAeA,EACfC,sBAAuBA,GACvBoB,MAAO5D,EAAS4D,MAChBrD,YAAaA,EACbwB,oBAAqBA,EACrB5B,eAAgBA,EAChB0D,aAAc5D,EACdgC,OAAQA,EACR/B,UAAWA,EACXS,iBAAkBA,EAClBb,OAAQE,EAASF,OACjBD,MAAOG,EAASH,MAChBiE,qBAAsBlD,EAAwBmD,OAAS,GAAKnD,EAC5DoD,0BAA2BnD,EAAWoD,yBACtCC,qBAAsBpD,IAG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,GAAkB4C,QAAQC,QAAQ,cAAe,KAAK7C,GAAkB8C,cACjFC,KAAM,CAAC/C,GAAkBgD"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../external/preact/dist/preact.js";import r from"../../../../internal/FormFields/Field/Field.js";import a from"../../../../../core/Context/useCoreContext.js";import o from"../../../../internal/FormFields/InputText.js";function l({onBlur:l,onInput:t,placeholder:d,value:n,required:i,error:c=!1,isValid:m,disabled:s,onFieldFocusAnalytics:u,onFieldBlurAnalytics:p}){const{i18n:h}=a();return e(r,{label:h.get("creditCard.holderName"),className:"adyen-checkout__card__holderName",errorMessage:c&&h.get("creditCard.holderName.invalid"),isValid:!!m,name:"holderName",i18n:h,onFocus:e=>u("holderName",e),onBlur:e=>p("holderName",e)},e(o,{name:"holderName",className:"adyen-checkout__card__holderName__input adyen-checkout__input",placeholder:d,autocomplete:"cc-name",value:n,required:i,onBlur:l,onInput:t,disabled:s}))}export{l as default};
1
+ import{createElement as e}from"../../../../../external/preact/dist/preact.js";import r from"../../../../internal/FormFields/Field/Field.js";import o from"../../../../../core/Context/useCoreContext.js";import a from"../../../../internal/FormFields/InputText.js";import{CREDITCARD_HOLDER_NAME_INVALID as t}from"../../../../../core/Errors/constants.js";function l({onBlur:l,onInput:n,placeholder:d,value:i,required:s,error:c=!1,isValid:m,disabled:u,onFieldFocusAnalytics:p,onFieldBlurAnalytics:h}){const{i18n:_}=o();return e(r,{label:_.get("creditCard.holderName"),className:"adyen-checkout__card__holderName",errorMessage:c&&_.get(t),isValid:!!m,name:"holderName",i18n:_,onFocus:e=>p("holderName",e),onBlur:e=>h("holderName",e)},e(a,{name:"holderName",className:"adyen-checkout__card__holderName__input adyen-checkout__input",placeholder:d,autocomplete:"cc-name",value:i,required:s,onBlur:l,onInput:n,disabled:u}))}export{l as default};
2
2
  //# sourceMappingURL=CardHolderName.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CardHolderName.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CardHolderName.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Field from '../../../../internal/FormFields/Field';\nimport useCoreContext from '../../../../../core/Context/useCoreContext';\nimport { CardHolderNameProps } from './types';\nimport InputText from '../../../../internal/FormFields/InputText';\n\nexport default function CardHolderName({\n onBlur,\n onInput,\n placeholder,\n value,\n required,\n error = false,\n isValid,\n disabled,\n onFieldFocusAnalytics,\n onFieldBlurAnalytics\n}: CardHolderNameProps) {\n const { i18n } = useCoreContext();\n\n return (\n <Field\n label={i18n.get('creditCard.holderName')}\n className={'adyen-checkout__card__holderName'}\n errorMessage={error && i18n.get('creditCard.holderName.invalid')}\n isValid={!!isValid}\n name={'holderName'}\n i18n={i18n}\n onFocus={e => onFieldFocusAnalytics('holderName', e)}\n onBlur={e => onFieldBlurAnalytics('holderName', e)}\n >\n <InputText\n name={'holderName'}\n className=\"adyen-checkout__card__holderName__input adyen-checkout__input\"\n placeholder={placeholder}\n autocomplete={'cc-name'}\n {...{ value, required, onBlur, onInput, disabled }}\n />\n </Field>\n );\n}\n"],"names":["CardHolderName","onBlur","onInput","placeholder","value","required","error","isValid","disabled","onFieldFocusAnalytics","onFieldBlurAnalytics","i18n","useCoreContext","h","Field","label","get","className","errorMessage","name","onFocus","e","InputText","autocomplete"],"mappings":"qQAMe,SAASA,GAAeC,OACnCA,EAAMC,QACNA,EAAOC,YACPA,EAAWC,MACXA,EAAKC,SACLA,EAAQC,MACRA,GAAQ,EAAKC,QACbA,EAAOC,SACPA,EAAQC,sBACRA,EAAqBC,qBACrBA,IAEA,MAAMC,KAAEA,GAASC,IAEjB,OACIC,EAACC,EAAAA,CACGC,MAAOJ,EAAKK,IAAI,yBAChBC,UAAW,mCACXC,aAAcZ,GAASK,EAAKK,IAAI,iCAChCT,UAAWA,EACXY,KAAM,aACNR,KAAMA,EACNS,QAASC,GAAKZ,EAAsB,aAAcY,GAClDpB,OAAQoB,GAAKX,EAAqB,aAAcW,IAEhDR,EAACS,EAAAA,CACGH,KAAM,aACNF,UAAU,gEACVd,YAAaA,EACboB,aAAc,UACRnB,QAAOC,WAAUJ,SAAQC,UAASM,aAIxD"}
1
+ {"version":3,"file":"CardHolderName.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CardHolderName.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Field from '../../../../internal/FormFields/Field';\nimport useCoreContext from '../../../../../core/Context/useCoreContext';\nimport { CardHolderNameProps } from './types';\nimport InputText from '../../../../internal/FormFields/InputText';\nimport { CREDITCARD_HOLDER_NAME_INVALID } from '../../../../../core/Errors/constants';\n\nexport default function CardHolderName({\n onBlur,\n onInput,\n placeholder,\n value,\n required,\n error = false,\n isValid,\n disabled,\n onFieldFocusAnalytics,\n onFieldBlurAnalytics\n}: CardHolderNameProps) {\n const { i18n } = useCoreContext();\n\n return (\n <Field\n label={i18n.get('creditCard.holderName')}\n className={'adyen-checkout__card__holderName'}\n errorMessage={error && i18n.get(CREDITCARD_HOLDER_NAME_INVALID)}\n isValid={!!isValid}\n name={'holderName'}\n i18n={i18n}\n onFocus={e => onFieldFocusAnalytics('holderName', e)}\n onBlur={e => onFieldBlurAnalytics('holderName', e)}\n >\n <InputText\n name={'holderName'}\n className=\"adyen-checkout__card__holderName__input adyen-checkout__input\"\n placeholder={placeholder}\n autocomplete={'cc-name'}\n {...{ value, required, onBlur, onInput, disabled }}\n />\n </Field>\n );\n}\n"],"names":["CardHolderName","onBlur","onInput","placeholder","value","required","error","isValid","disabled","onFieldFocusAnalytics","onFieldBlurAnalytics","i18n","useCoreContext","h","Field","label","get","className","errorMessage","CREDITCARD_HOLDER_NAME_INVALID","name","onFocus","e","InputText","autocomplete"],"mappings":"8VAOe,SAASA,GAAeC,OACnCA,EAAMC,QACNA,EAAOC,YACPA,EAAWC,MACXA,EAAKC,SACLA,EAAQC,MACRA,GAAQ,EAAKC,QACbA,EAAOC,SACPA,EAAQC,sBACRA,EAAqBC,qBACrBA,IAEA,MAAMC,KAAEA,GAASC,IAEjB,OACIC,EAACC,EAAAA,CACGC,MAAOJ,EAAKK,IAAI,yBAChBC,UAAW,mCACXC,aAAcZ,GAASK,EAAKK,IAAIG,GAChCZ,UAAWA,EACXa,KAAM,aACNT,KAAMA,EACNU,QAASC,GAAKb,EAAsB,aAAca,GAClDrB,OAAQqB,GAAKZ,EAAqB,aAAcY,IAEhDT,EAACU,EAAAA,CACGH,KAAM,aACNH,UAAU,gEACVd,YAAaA,EACbqB,aAAc,UACRpB,QAAOC,WAAUJ,SAAQC,UAASM,aAIxD"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../external/preact/dist/preact.js";import{useMemo as r}from"../../../../../external/preact/hooks/dist/hooks.js";import t from"../../../../../external/classnames/index.js";import a from"../../../../internal/FormFields/Field/Field.js";import o from"../../../../../core/Context/useCoreContext.js";import s from"./DataSfSpan.js";import d from"../../../../internal/FormFields/InputTelephone.js";import{alternativeLabelContent as n}from"./IframeLabelAlternative.js";function l(l){const{i18n:i}=o(),c=r((()=>l.value?.length>6?i.get("creditCard.taxNumber.labelAlt"):i.get("creditCard.taxNumber.label")),[l.value]);return e("div",{className:"adyen-checkout__card__kcp-authentication"},e(a,{label:c,filled:l.filled,classNameModifiers:["kcp-taxNumber"],errorMessage:l.error&&i.get("creditCard.taxNumber.invalid"),isValid:l.isValid,dir:"ltr",name:"kcpTaxNumberOrDOB",onFocus:e=>l.onFieldFocusAnalytics("taxNumber",e),onBlur:e=>l.onFieldBlurAnalytics("taxNumber",e)},e(d,{name:"kcpTaxNumberOrDOB",className:"adyen-checkout__card__kcp-taxNumber__input adyen-checkout__input",maxLength:10,minLength:6,autoComplete:"false",value:l.value,required:!0,onBlur:l.onBlur,onInput:l.onInput,disabled:l.disabled,placeholder:l.placeholder})),e(a,{label:i.get("creditCard.password.label"),focused:"encryptedPassword"===l.focusedElement,filled:l.filled,classNameModifiers:["50","koreanAuthentication-encryptedPassword"],onFocusField:()=>l.onFocusField("encryptedPassword"),errorMessage:l.encryptedPasswordState.errors&&i.get(String(l.encryptedPasswordState.errors)),isValid:l.encryptedPasswordState.valid,dir:"ltr",name:"encryptedPassword",useLabelElement:!1,renderAlternativeToLabel:n},e(s,{encryptedFieldType:"encryptedPassword",className:t({"adyen-checkout__input":!0,"adyen-checkout__input--large":!0,"adyen-checkout__input--error":l.encryptedPasswordState.errors,"adyen-checkout__input--valid":l.encryptedPasswordState.valid,"adyen-checkout__input--focus":"encryptedPassword"===l.focusedElement})})))}export{l as default};
1
+ import{createElement as e}from"../../../../../external/preact/dist/preact.js";import{useMemo as r}from"../../../../../external/preact/hooks/dist/hooks.js";import t from"../../../../../external/classnames/index.js";import a from"../../../../internal/FormFields/Field/Field.js";import o from"../../../../../core/Context/useCoreContext.js";import s from"./DataSfSpan.js";import n from"../../../../internal/FormFields/InputTelephone.js";import{alternativeLabelContent as d}from"./IframeLabelAlternative.js";import{CREDITCARD_TAX_NUMBER_INVALID as l}from"../../../../../core/Errors/constants.js";function i(i){const{i18n:c}=o(),u=r((()=>i.value?.length>6?c.get("creditCard.taxNumber.labelAlt"):c.get("creditCard.taxNumber.label")),[i.value]);return e("div",{className:"adyen-checkout__card__kcp-authentication"},e(a,{label:u,filled:i.filled,classNameModifiers:["kcp-taxNumber"],errorMessage:i.error&&c.get(l),isValid:i.isValid,dir:"ltr",name:"kcpTaxNumberOrDOB",onFocus:e=>i.onFieldFocusAnalytics("taxNumber",e),onBlur:e=>i.onFieldBlurAnalytics("taxNumber",e)},e(n,{name:"kcpTaxNumberOrDOB",className:"adyen-checkout__card__kcp-taxNumber__input adyen-checkout__input",maxLength:10,minLength:6,autoComplete:"false",value:i.value,required:!0,onBlur:i.onBlur,onInput:i.onInput,disabled:i.disabled,placeholder:i.placeholder})),e(a,{label:c.get("creditCard.password.label"),focused:"encryptedPassword"===i.focusedElement,filled:i.filled,classNameModifiers:["50","koreanAuthentication-encryptedPassword"],onFocusField:()=>i.onFocusField("encryptedPassword"),errorMessage:i.encryptedPasswordState.errors&&c.get(String(i.encryptedPasswordState.errors)),isValid:i.encryptedPasswordState.valid,dir:"ltr",name:"encryptedPassword",useLabelElement:!1,renderAlternativeToLabel:d},e(s,{encryptedFieldType:"encryptedPassword",className:t({"adyen-checkout__input":!0,"adyen-checkout__input--large":!0,"adyen-checkout__input--error":i.encryptedPasswordState.errors,"adyen-checkout__input--valid":i.encryptedPasswordState.valid,"adyen-checkout__input--focus":"encryptedPassword"===i.focusedElement})})))}export{i as default};
2
2
  //# sourceMappingURL=KCPAuthentication.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"KCPAuthentication.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/KCPAuthentication.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useMemo } from 'preact/hooks';\nimport classNames from 'classnames';\nimport Field from '../../../../internal/FormFields/Field';\nimport useCoreContext from '../../../../../core/Context/useCoreContext';\nimport { KCPProps } from './types';\nimport DataSfSpan from './DataSfSpan';\nimport InputTelephone from '../../../../internal/FormFields/InputTelephone';\nimport { alternativeLabelContent } from './IframeLabelAlternative';\n\nexport default function KCPAuthentication(props: KCPProps) {\n const { i18n } = useCoreContext();\n\n const taxNumberLabel = useMemo((): string => {\n if (props.value?.length > 6) return i18n.get('creditCard.taxNumber.labelAlt');\n\n return i18n.get('creditCard.taxNumber.label');\n }, [props.value]);\n\n return (\n <div className=\"adyen-checkout__card__kcp-authentication\">\n <Field\n label={taxNumberLabel}\n filled={props.filled}\n classNameModifiers={['kcp-taxNumber']}\n errorMessage={props.error && i18n.get('creditCard.taxNumber.invalid')}\n isValid={props.isValid}\n dir={'ltr'}\n name={'kcpTaxNumberOrDOB'}\n onFocus={e => props.onFieldFocusAnalytics('taxNumber', e)}\n onBlur={e => props.onFieldBlurAnalytics('taxNumber', e)}\n >\n <InputTelephone\n name={'kcpTaxNumberOrDOB'}\n className=\"adyen-checkout__card__kcp-taxNumber__input adyen-checkout__input\"\n maxLength={10}\n minLength={6}\n autoComplete={'false'}\n value={props.value}\n required={true}\n onBlur={props.onBlur}\n onInput={props.onInput}\n disabled={props.disabled}\n placeholder={props.placeholder}\n />\n </Field>\n\n <Field\n label={i18n.get('creditCard.password.label')}\n focused={props.focusedElement === 'encryptedPassword'}\n filled={props.filled}\n classNameModifiers={['50', 'koreanAuthentication-encryptedPassword']}\n onFocusField={() => props.onFocusField('encryptedPassword')}\n errorMessage={props.encryptedPasswordState.errors && i18n.get(String(props.encryptedPasswordState.errors))}\n isValid={props.encryptedPasswordState.valid}\n dir={'ltr'}\n name={'encryptedPassword'}\n useLabelElement={false}\n renderAlternativeToLabel={alternativeLabelContent}\n >\n <DataSfSpan\n encryptedFieldType=\"encryptedPassword\"\n className={classNames({\n 'adyen-checkout__input': true,\n 'adyen-checkout__input--large': true,\n 'adyen-checkout__input--error': props.encryptedPasswordState.errors,\n 'adyen-checkout__input--valid': props.encryptedPasswordState.valid,\n 'adyen-checkout__input--focus': props.focusedElement === 'encryptedPassword'\n })}\n />\n </Field>\n </div>\n );\n}\n"],"names":["KCPAuthentication","props","i18n","useCoreContext","taxNumberLabel","useMemo","value","length","get","h","div","className","Field","label","filled","classNameModifiers","errorMessage","error","isValid","dir","name","onFocus","e","onFieldFocusAnalytics","onBlur","onFieldBlurAnalytics","InputTelephone","maxLength","minLength","autoComplete","required","onInput","disabled","placeholder","focused","focusedElement","onFocusField","encryptedPasswordState","errors","String","valid","useLabelElement","renderAlternativeToLabel","alternativeLabelContent","DataSfSpan","encryptedFieldType","classNames"],"mappings":"ufAUe,SAASA,EAAkBC,GACtC,MAAMC,KAAEA,GAASC,IAEXC,EAAiBC,GAAQ,IACvBJ,EAAMK,OAAOC,OAAS,EAAUL,EAAKM,IAAI,iCAEtCN,EAAKM,IAAI,+BACjB,CAACP,EAAMK,QAEV,OACIG,EAACC,MAAAA,CAAIC,UAAU,4CACXF,EAACG,EAAAA,CACGC,MAAOT,EACPU,OAAQb,EAAMa,OACdC,mBAAoB,CAAC,iBACrBC,aAAcf,EAAMgB,OAASf,EAAKM,IAAI,gCACtCU,QAASjB,EAAMiB,QACfC,IAAK,MACLC,KAAM,oBACNC,QAASC,GAAKrB,EAAMsB,sBAAsB,YAAaD,GACvDE,OAAQF,GAAKrB,EAAMwB,qBAAqB,YAAaH,IAErDb,EAACiB,EAAAA,CACGN,KAAM,oBACNT,UAAU,mEACVgB,UAAW,GACXC,UAAW,EACXC,aAAc,QACdvB,MAAOL,EAAMK,MACbwB,UAAU,EACVN,OAAQvB,EAAMuB,OACdO,QAAS9B,EAAM8B,QACfC,SAAU/B,EAAM+B,SAChBC,YAAahC,EAAMgC,eAI3BxB,EAACG,EAAAA,CACGC,MAAOX,EAAKM,IAAI,6BAChB0B,QAAkC,sBAAzBjC,EAAMkC,eACfrB,OAAQb,EAAMa,OACdC,mBAAoB,CAAC,KAAM,0CAC3BqB,aAAc,IAAMnC,EAAMmC,aAAa,qBACvCpB,aAAcf,EAAMoC,uBAAuBC,QAAUpC,EAAKM,IAAI+B,OAAOtC,EAAMoC,uBAAuBC,SAClGpB,QAASjB,EAAMoC,uBAAuBG,MACtCrB,IAAK,MACLC,KAAM,oBACNqB,iBAAiB,EACjBC,yBAA0BC,GAE1BlC,EAACmC,EAAAA,CACGC,mBAAmB,oBACnBlC,UAAWmC,EAAW,CAClB,yBAAyB,EACzB,gCAAgC,EAChC,+BAAgC7C,EAAMoC,uBAAuBC,OAC7D,+BAAgCrC,EAAMoC,uBAAuBG,MAC7D,+BAAyD,sBAAzBvC,EAAMkC,oBAM9D"}
1
+ {"version":3,"file":"KCPAuthentication.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/KCPAuthentication.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useMemo } from 'preact/hooks';\nimport classNames from 'classnames';\nimport Field from '../../../../internal/FormFields/Field';\nimport useCoreContext from '../../../../../core/Context/useCoreContext';\nimport { KCPProps } from './types';\nimport DataSfSpan from './DataSfSpan';\nimport InputTelephone from '../../../../internal/FormFields/InputTelephone';\nimport { alternativeLabelContent } from './IframeLabelAlternative';\nimport { CREDITCARD_TAX_NUMBER_INVALID } from '../../../../../core/Errors/constants';\n\nexport default function KCPAuthentication(props: KCPProps) {\n const { i18n } = useCoreContext();\n\n const taxNumberLabel = useMemo((): string => {\n if (props.value?.length > 6) return i18n.get('creditCard.taxNumber.labelAlt');\n\n return i18n.get('creditCard.taxNumber.label');\n }, [props.value]);\n\n return (\n <div className=\"adyen-checkout__card__kcp-authentication\">\n <Field\n label={taxNumberLabel}\n filled={props.filled}\n classNameModifiers={['kcp-taxNumber']}\n errorMessage={props.error && i18n.get(CREDITCARD_TAX_NUMBER_INVALID)}\n isValid={props.isValid}\n dir={'ltr'}\n name={'kcpTaxNumberOrDOB'}\n onFocus={e => props.onFieldFocusAnalytics('taxNumber', e)}\n onBlur={e => props.onFieldBlurAnalytics('taxNumber', e)}\n >\n <InputTelephone\n name={'kcpTaxNumberOrDOB'}\n className=\"adyen-checkout__card__kcp-taxNumber__input adyen-checkout__input\"\n maxLength={10}\n minLength={6}\n autoComplete={'false'}\n value={props.value}\n required={true}\n onBlur={props.onBlur}\n onInput={props.onInput}\n disabled={props.disabled}\n placeholder={props.placeholder}\n />\n </Field>\n\n <Field\n label={i18n.get('creditCard.password.label')}\n focused={props.focusedElement === 'encryptedPassword'}\n filled={props.filled}\n classNameModifiers={['50', 'koreanAuthentication-encryptedPassword']}\n onFocusField={() => props.onFocusField('encryptedPassword')}\n errorMessage={props.encryptedPasswordState.errors && i18n.get(String(props.encryptedPasswordState.errors))}\n isValid={props.encryptedPasswordState.valid}\n dir={'ltr'}\n name={'encryptedPassword'}\n useLabelElement={false}\n renderAlternativeToLabel={alternativeLabelContent}\n >\n <DataSfSpan\n encryptedFieldType=\"encryptedPassword\"\n className={classNames({\n 'adyen-checkout__input': true,\n 'adyen-checkout__input--large': true,\n 'adyen-checkout__input--error': props.encryptedPasswordState.errors,\n 'adyen-checkout__input--valid': props.encryptedPasswordState.valid,\n 'adyen-checkout__input--focus': props.focusedElement === 'encryptedPassword'\n })}\n />\n </Field>\n </div>\n );\n}\n"],"names":["KCPAuthentication","props","i18n","useCoreContext","taxNumberLabel","useMemo","value","length","get","h","div","className","Field","label","filled","classNameModifiers","errorMessage","error","CREDITCARD_TAX_NUMBER_INVALID","isValid","dir","name","onFocus","e","onFieldFocusAnalytics","onBlur","onFieldBlurAnalytics","InputTelephone","maxLength","minLength","autoComplete","required","onInput","disabled","placeholder","focused","focusedElement","onFocusField","encryptedPasswordState","errors","String","valid","useLabelElement","renderAlternativeToLabel","alternativeLabelContent","DataSfSpan","encryptedFieldType","classNames"],"mappings":"+kBAWe,SAASA,EAAkBC,GACtC,MAAMC,KAAEA,GAASC,IAEXC,EAAiBC,GAAQ,IACvBJ,EAAMK,OAAOC,OAAS,EAAUL,EAAKM,IAAI,iCAEtCN,EAAKM,IAAI,+BACjB,CAACP,EAAMK,QAEV,OACIG,EAACC,MAAAA,CAAIC,UAAU,4CACXF,EAACG,EAAAA,CACGC,MAAOT,EACPU,OAAQb,EAAMa,OACdC,mBAAoB,CAAC,iBACrBC,aAAcf,EAAMgB,OAASf,EAAKM,IAAIU,GACtCC,QAASlB,EAAMkB,QACfC,IAAK,MACLC,KAAM,oBACNC,QAASC,GAAKtB,EAAMuB,sBAAsB,YAAaD,GACvDE,OAAQF,GAAKtB,EAAMyB,qBAAqB,YAAaH,IAErDd,EAACkB,EAAAA,CACGN,KAAM,oBACNV,UAAU,mEACViB,UAAW,GACXC,UAAW,EACXC,aAAc,QACdxB,MAAOL,EAAMK,MACbyB,UAAU,EACVN,OAAQxB,EAAMwB,OACdO,QAAS/B,EAAM+B,QACfC,SAAUhC,EAAMgC,SAChBC,YAAajC,EAAMiC,eAI3BzB,EAACG,EAAAA,CACGC,MAAOX,EAAKM,IAAI,6BAChB2B,QAAkC,sBAAzBlC,EAAMmC,eACftB,OAAQb,EAAMa,OACdC,mBAAoB,CAAC,KAAM,0CAC3BsB,aAAc,IAAMpC,EAAMoC,aAAa,qBACvCrB,aAAcf,EAAMqC,uBAAuBC,QAAUrC,EAAKM,IAAIgC,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