@adyen/adyen-web 6.43.0 → 6.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (305) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/adyen.css +8 -8
  3. package/dist/cjs/adyen.css.map +1 -1
  4. package/dist/cjs/index.cjs +2 -2
  5. package/dist/cjs/index.cjs.map +1 -1
  6. package/dist/cjs/index.d.cts +99 -37
  7. package/dist/es/adyen.css +8 -8
  8. package/dist/es/adyen.css.map +1 -1
  9. package/dist/es/components/BacsDD/BacsDD.js +1 -1
  10. package/dist/es/components/BacsDD/BacsDD.js.map +1 -1
  11. package/dist/es/components/Card/Card.js +1 -1
  12. package/dist/es/components/Card/Card.js.map +1 -1
  13. package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
  14. package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
  15. package/dist/es/components/Card/components/CardInput/components/CVC.js +1 -1
  16. package/dist/es/components/Card/components/CardInput/components/CVC.js.map +1 -1
  17. package/dist/es/components/Card/components/CardInput/components/CardFields.js +1 -1
  18. package/dist/es/components/Card/components/CardInput/components/CardFields.js.map +1 -1
  19. package/dist/es/components/Card/components/CardInput/components/DualBrandSelector.js +1 -1
  20. package/dist/es/components/Card/components/CardInput/components/DualBrandSelector.js.map +1 -1
  21. package/dist/es/components/Card/components/CardInput/components/StoredCardFields.js +1 -1
  22. package/dist/es/components/Card/components/CardInput/components/StoredCardFields.js.map +1 -1
  23. package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
  24. package/dist/es/components/Card/components/CardInput/useSRPanelForCardInputErrors.js +1 -1
  25. package/dist/es/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -1
  26. package/dist/es/components/Card/components/CardInput/utils.js +1 -1
  27. package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
  28. package/dist/es/components/CustomCard/CustomCard.js +1 -1
  29. package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
  30. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  31. package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  32. package/dist/es/components/Donation/DonationCampaignService.js +1 -1
  33. package/dist/es/components/Donation/DonationCampaignService.js.map +1 -1
  34. package/dist/es/components/Dropin/Dropin.js +1 -1
  35. package/dist/es/components/Dropin/Dropin.js.map +1 -1
  36. package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
  37. package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js.map +1 -1
  38. package/dist/es/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js +1 -1
  39. package/dist/es/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js.map +1 -1
  40. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodDetails.js +1 -1
  41. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodDetails.js.map +1 -1
  42. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  43. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  44. package/dist/es/components/Giftcard/Giftcard.js +1 -1
  45. package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
  46. package/dist/es/components/Giftcard/components/GiftcardComponent.js +1 -1
  47. package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  48. package/dist/es/components/GooglePay/GooglePay.js +1 -1
  49. package/dist/es/components/GooglePay/GooglePay.js.map +1 -1
  50. package/dist/es/components/GooglePay/GooglePayService.js +1 -1
  51. package/dist/es/components/GooglePay/GooglePayService.js.map +1 -1
  52. package/dist/es/components/Klarna/KlarnaPayments.js +1 -1
  53. package/dist/es/components/Klarna/KlarnaPayments.js.map +1 -1
  54. package/dist/es/components/PayByBankPix/PayByBankPix.js +1 -1
  55. package/dist/es/components/PayByBankPix/PayByBankPix.js.map +1 -1
  56. package/dist/es/components/PayByBankUS/PayByBankUS.js +1 -1
  57. package/dist/es/components/PayByBankUS/PayByBankUS.js.map +1 -1
  58. package/dist/es/components/PayTo/PayTo.js +1 -1
  59. package/dist/es/components/PayTo/PayTo.js.map +1 -1
  60. package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  61. package/dist/es/components/Twint/Twint.js +1 -1
  62. package/dist/es/components/Twint/Twint.js.map +1 -1
  63. package/dist/es/components/internal/Address/Address.js +1 -1
  64. package/dist/es/components/internal/Address/Address.js.map +1 -1
  65. package/dist/es/components/internal/Address/validate.formats.js +1 -1
  66. package/dist/es/components/internal/Address/validate.formats.js.map +1 -1
  67. package/dist/es/components/internal/Address/validate.js +1 -1
  68. package/dist/es/components/internal/Address/validate.js.map +1 -1
  69. package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
  70. package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
  71. package/dist/es/components/internal/Button/Button.js +1 -1
  72. package/dist/es/components/internal/Button/Button.js.map +1 -1
  73. package/dist/es/components/internal/Button/CopyButton.js +1 -1
  74. package/dist/es/components/internal/Button/CopyButton.js.map +1 -1
  75. package/dist/es/components/internal/Button/CopyIconButton.js +1 -1
  76. package/dist/es/components/internal/Button/CopyIconButton.js.map +1 -1
  77. package/dist/es/components/internal/ClickToPay/ClickToPayComponent.js.map +1 -1
  78. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js +1 -1
  79. package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js.map +1 -1
  80. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js +1 -1
  81. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js.map +1 -1
  82. package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPSection.js +1 -1
  83. package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPSection.js.map +1 -1
  84. package/dist/es/components/internal/FormFields/InputBase.js +1 -1
  85. package/dist/es/components/internal/FormFields/InputBase.js.map +1 -1
  86. package/dist/es/components/internal/FormFields/Select/Select.js +1 -1
  87. package/dist/es/components/internal/FormFields/Select/Select.js.map +1 -1
  88. package/dist/es/components/internal/LoadingWrapper/LoadingWrapper.js +1 -1
  89. package/dist/es/components/internal/LoadingWrapper/LoadingWrapper.js.map +1 -1
  90. package/dist/es/components/internal/Modal/Modal.js +1 -1
  91. package/dist/es/components/internal/Modal/Modal.js.map +1 -1
  92. package/dist/es/components/internal/PayButton/PayButton.js +1 -1
  93. package/dist/es/components/internal/PayButton/PayButton.js.map +1 -1
  94. package/dist/es/components/internal/PayButton/utils.js +1 -1
  95. package/dist/es/components/internal/PayButton/utils.js.map +1 -1
  96. package/dist/es/components/internal/QRLoader/QRLoader.js +1 -1
  97. package/dist/es/components/internal/QRLoader/QRLoader.js.map +1 -1
  98. package/dist/es/components/internal/QRLoader/components/QRFinalState.js +1 -1
  99. package/dist/es/components/internal/QRLoader/components/QRFinalState.js.map +1 -1
  100. package/dist/es/components/internal/QRLoader/components/QRLoaderPendingState.js +2 -0
  101. package/dist/es/components/internal/QRLoader/components/QRLoaderPendingState.js.map +1 -0
  102. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  103. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  104. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
  105. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
  106. package/dist/es/components/internal/SecuredFields/SFP/defaultProps.js +1 -1
  107. package/dist/es/components/internal/SecuredFields/SFP/defaultProps.js.map +1 -1
  108. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js +1 -1
  109. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js.map +1 -1
  110. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
  111. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  112. package/dist/es/components/internal/SecuredFields/lib/constants.js +1 -1
  113. package/dist/es/components/internal/SecuredFields/lib/constants.js.map +1 -1
  114. package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
  115. package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  116. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  117. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  118. package/dist/es/components/internal/SegmentedControl/SegmentedControl.js +1 -1
  119. package/dist/es/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
  120. package/dist/es/components/internal/UIElement/UIElement.js +1 -1
  121. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  122. package/dist/es/core/Analytics/constants.js +1 -1
  123. package/dist/es/core/Analytics/constants.js.map +1 -1
  124. package/dist/es/core/Analytics/events/AnalyticsLogEvent.js +1 -1
  125. package/dist/es/core/Analytics/events/AnalyticsLogEvent.js.map +1 -1
  126. package/dist/es/core/Errors/SRMessages.js +1 -1
  127. package/dist/es/core/Errors/SRMessages.js.map +1 -1
  128. package/dist/es/core/Errors/SRPanel.js.map +1 -1
  129. package/dist/es/core/Errors/SRPanelProvider.js.map +1 -1
  130. package/dist/es/core/Errors/constants.js +1 -1
  131. package/dist/es/core/Errors/constants.js.map +1 -1
  132. package/dist/es/core/Errors/useA11yReporter.js +1 -1
  133. package/dist/es/core/Errors/useA11yReporter.js.map +1 -1
  134. package/dist/es/core/Errors/useLoadingA11yReporter.js +2 -0
  135. package/dist/es/core/Errors/useLoadingA11yReporter.js.map +1 -0
  136. package/dist/es/core/Errors/utils.js +1 -1
  137. package/dist/es/core/Errors/utils.js.map +1 -1
  138. package/dist/es/core/config.js +1 -1
  139. package/dist/es/core/config.js.map +1 -1
  140. package/dist/es/core/core.js +1 -1
  141. package/dist/es/core/core.js.map +1 -1
  142. package/dist/es/core/utils.js +1 -1
  143. package/dist/es/core/utils.js.map +1 -1
  144. package/dist/es/external/preact/compat/dist/compat.js +1 -1
  145. package/dist/es/external/preact/compat/dist/compat.js.map +1 -1
  146. package/dist/es/external/preact/dist/preact.js +1 -1
  147. package/dist/es/external/preact/dist/preact.js.map +1 -1
  148. package/dist/es/external/preact/hooks/dist/hooks.js +1 -1
  149. package/dist/es/external/preact/hooks/dist/hooks.js.map +1 -1
  150. package/dist/es/index.d.ts +99 -37
  151. package/dist/es/packages/server/translations/en-US.json.js +1 -1
  152. package/dist/es/utils/useForm/useForm.js +1 -1
  153. package/dist/es/utils/useForm/useForm.js.map +1 -1
  154. package/dist/es/utils/validator-utils.js +1 -1
  155. package/dist/es/utils/validator-utils.js.map +1 -1
  156. package/dist/es-legacy/adyen.css +8 -8
  157. package/dist/es-legacy/adyen.css.map +1 -1
  158. package/dist/es-legacy/components/BacsDD/BacsDD.js +1 -1
  159. package/dist/es-legacy/components/BacsDD/BacsDD.js.map +1 -1
  160. package/dist/es-legacy/components/Card/Card.js +1 -1
  161. package/dist/es-legacy/components/Card/Card.js.map +1 -1
  162. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
  163. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
  164. package/dist/es-legacy/components/Card/components/CardInput/components/CVC.js +1 -1
  165. package/dist/es-legacy/components/Card/components/CardInput/components/CVC.js.map +1 -1
  166. package/dist/es-legacy/components/Card/components/CardInput/components/CardFields.js +1 -1
  167. package/dist/es-legacy/components/Card/components/CardInput/components/CardFields.js.map +1 -1
  168. package/dist/es-legacy/components/Card/components/CardInput/components/DualBrandSelector.js +1 -1
  169. package/dist/es-legacy/components/Card/components/CardInput/components/DualBrandSelector.js.map +1 -1
  170. package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFields.js +1 -1
  171. package/dist/es-legacy/components/Card/components/CardInput/components/StoredCardFields.js.map +1 -1
  172. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  173. package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js +1 -1
  174. package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -1
  175. package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
  176. package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
  177. package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
  178. package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
  179. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  180. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  181. package/dist/es-legacy/components/Donation/DonationCampaignService.js +1 -1
  182. package/dist/es-legacy/components/Donation/DonationCampaignService.js.map +1 -1
  183. package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
  184. package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
  185. package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
  186. package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js.map +1 -1
  187. package/dist/es-legacy/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js +1 -1
  188. package/dist/es-legacy/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js.map +1 -1
  189. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodDetails.js +1 -1
  190. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodDetails.js.map +1 -1
  191. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  192. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  193. package/dist/es-legacy/components/Giftcard/Giftcard.js +1 -1
  194. package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
  195. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js +1 -1
  196. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  197. package/dist/es-legacy/components/GooglePay/GooglePay.js +1 -1
  198. package/dist/es-legacy/components/GooglePay/GooglePay.js.map +1 -1
  199. package/dist/es-legacy/components/GooglePay/GooglePayService.js +1 -1
  200. package/dist/es-legacy/components/GooglePay/GooglePayService.js.map +1 -1
  201. package/dist/es-legacy/components/Klarna/KlarnaPayments.js +1 -1
  202. package/dist/es-legacy/components/Klarna/KlarnaPayments.js.map +1 -1
  203. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js +1 -1
  204. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js.map +1 -1
  205. package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js +1 -1
  206. package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js.map +1 -1
  207. package/dist/es-legacy/components/PayTo/PayTo.js +1 -1
  208. package/dist/es-legacy/components/PayTo/PayTo.js.map +1 -1
  209. package/dist/es-legacy/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  210. package/dist/es-legacy/components/Twint/Twint.js +1 -1
  211. package/dist/es-legacy/components/Twint/Twint.js.map +1 -1
  212. package/dist/es-legacy/components/internal/Address/Address.js +1 -1
  213. package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
  214. package/dist/es-legacy/components/internal/Address/validate.formats.js +1 -1
  215. package/dist/es-legacy/components/internal/Address/validate.formats.js.map +1 -1
  216. package/dist/es-legacy/components/internal/Address/validate.js +1 -1
  217. package/dist/es-legacy/components/internal/Address/validate.js.map +1 -1
  218. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
  219. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
  220. package/dist/es-legacy/components/internal/Button/Button.js +1 -1
  221. package/dist/es-legacy/components/internal/Button/Button.js.map +1 -1
  222. package/dist/es-legacy/components/internal/Button/CopyButton.js +1 -1
  223. package/dist/es-legacy/components/internal/Button/CopyButton.js.map +1 -1
  224. package/dist/es-legacy/components/internal/Button/CopyIconButton.js +1 -1
  225. package/dist/es-legacy/components/internal/Button/CopyIconButton.js.map +1 -1
  226. package/dist/es-legacy/components/internal/ClickToPay/ClickToPayComponent.js.map +1 -1
  227. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js +1 -1
  228. package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js.map +1 -1
  229. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js +1 -1
  230. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js.map +1 -1
  231. package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPSection.js +1 -1
  232. package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPSection.js.map +1 -1
  233. package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
  234. package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
  235. package/dist/es-legacy/components/internal/FormFields/Select/Select.js +1 -1
  236. package/dist/es-legacy/components/internal/FormFields/Select/Select.js.map +1 -1
  237. package/dist/es-legacy/components/internal/LoadingWrapper/LoadingWrapper.js +1 -1
  238. package/dist/es-legacy/components/internal/LoadingWrapper/LoadingWrapper.js.map +1 -1
  239. package/dist/es-legacy/components/internal/Modal/Modal.js +1 -1
  240. package/dist/es-legacy/components/internal/Modal/Modal.js.map +1 -1
  241. package/dist/es-legacy/components/internal/PayButton/PayButton.js +1 -1
  242. package/dist/es-legacy/components/internal/PayButton/PayButton.js.map +1 -1
  243. package/dist/es-legacy/components/internal/PayButton/utils.js +1 -1
  244. package/dist/es-legacy/components/internal/PayButton/utils.js.map +1 -1
  245. package/dist/es-legacy/components/internal/QRLoader/QRLoader.js +1 -1
  246. package/dist/es-legacy/components/internal/QRLoader/QRLoader.js.map +1 -1
  247. package/dist/es-legacy/components/internal/QRLoader/components/QRFinalState.js +1 -1
  248. package/dist/es-legacy/components/internal/QRLoader/components/QRFinalState.js.map +1 -1
  249. package/dist/es-legacy/components/internal/QRLoader/components/QRLoaderPendingState.js +2 -0
  250. package/dist/es-legacy/components/internal/QRLoader/components/QRLoaderPendingState.js.map +1 -0
  251. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  252. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  253. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
  254. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
  255. package/dist/es-legacy/components/internal/SecuredFields/SFP/defaultProps.js +1 -1
  256. package/dist/es-legacy/components/internal/SecuredFields/SFP/defaultProps.js.map +1 -1
  257. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js +1 -1
  258. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js.map +1 -1
  259. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
  260. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  261. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js +1 -1
  262. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js.map +1 -1
  263. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
  264. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  265. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  266. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  267. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js +1 -1
  268. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
  269. package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
  270. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  271. package/dist/es-legacy/core/Analytics/constants.js +1 -1
  272. package/dist/es-legacy/core/Analytics/constants.js.map +1 -1
  273. package/dist/es-legacy/core/Analytics/events/AnalyticsLogEvent.js +1 -1
  274. package/dist/es-legacy/core/Analytics/events/AnalyticsLogEvent.js.map +1 -1
  275. package/dist/es-legacy/core/Errors/SRMessages.js +1 -1
  276. package/dist/es-legacy/core/Errors/SRMessages.js.map +1 -1
  277. package/dist/es-legacy/core/Errors/SRPanel.js.map +1 -1
  278. package/dist/es-legacy/core/Errors/SRPanelProvider.js.map +1 -1
  279. package/dist/es-legacy/core/Errors/constants.js +1 -1
  280. package/dist/es-legacy/core/Errors/constants.js.map +1 -1
  281. package/dist/es-legacy/core/Errors/useA11yReporter.js +1 -1
  282. package/dist/es-legacy/core/Errors/useA11yReporter.js.map +1 -1
  283. package/dist/es-legacy/core/Errors/useLoadingA11yReporter.js +2 -0
  284. package/dist/es-legacy/core/Errors/useLoadingA11yReporter.js.map +1 -0
  285. package/dist/es-legacy/core/Errors/utils.js +1 -1
  286. package/dist/es-legacy/core/Errors/utils.js.map +1 -1
  287. package/dist/es-legacy/core/config.js +1 -1
  288. package/dist/es-legacy/core/config.js.map +1 -1
  289. package/dist/es-legacy/core/core.js +1 -1
  290. package/dist/es-legacy/core/core.js.map +1 -1
  291. package/dist/es-legacy/core/utils.js +1 -1
  292. package/dist/es-legacy/core/utils.js.map +1 -1
  293. package/dist/es-legacy/external/preact/compat/dist/compat.js +1 -1
  294. package/dist/es-legacy/external/preact/compat/dist/compat.js.map +1 -1
  295. package/dist/es-legacy/external/preact/dist/preact.js +1 -1
  296. package/dist/es-legacy/external/preact/dist/preact.js.map +1 -1
  297. package/dist/es-legacy/external/preact/hooks/dist/hooks.js +1 -1
  298. package/dist/es-legacy/external/preact/hooks/dist/hooks.js.map +1 -1
  299. package/dist/es-legacy/packages/server/translations/en-US.json.js +1 -1
  300. package/dist/es-legacy/utils/useForm/useForm.js +1 -1
  301. package/dist/es-legacy/utils/useForm/useForm.js.map +1 -1
  302. package/dist/es-legacy/utils/validator-utils.js +1 -1
  303. package/dist/es-legacy/utils/validator-utils.js.map +1 -1
  304. package/package.json +27 -27
  305. package/styles/adyen.css +8 -8
@@ -1,2 +1,2 @@
1
- import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import a from"./components/BacsInput.js";import o from"./components/BacsResult.js";import n from"../internal/PayButton/PayButton.js";import{TxVariants as s}from"../tx-variants.js";function i(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}class r extends e{formatData(){return{paymentMethod:{type:r.type,...this.state.data?.holderName&&{holderName:this.state.data.holderName},...this.state.data?.bankAccountNumber&&{bankAccountNumber:this.state.data.bankAccountNumber},...this.state.data?.bankLocationId&&{bankLocationId:this.state.data.bankLocationId}},...this.state.data?.shopperEmail&&{shopperEmail:this.state.data.shopperEmail}}}get isValid(){return!!this.state.isValid}componentToRender(){return this.props.url?t(o,{ref:t=>{this.componentRef=t},icon:this.icon,url:this.props.url,paymentMethodType:this.props.paymentMethodType,onActionHandled:this.onActionHandled}):t(a,{ref:t=>{this.componentRef=t},...this.props,onChange:this.setState,payButton:this.payButton,onSubmit:this.submit})}constructor(...e){super(...e),i(this,"payButton",e=>t(n,{onClick:this.submit,...e}))}}i(r,"type",s.directdebit_GB);export{r as default};
1
+ import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import a from"./components/BacsInput.js";import o from"./components/BacsResult.js";import n from"../internal/PayButton/PayButton.js";import{TxVariants as s}from"../tx-variants.js";function i(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}class r extends e{formatData(){return{paymentMethod:{type:r.type,...this.state.data?.holderName&&{holderName:this.state.data.holderName},...this.state.data?.bankAccountNumber&&{bankAccountNumber:this.state.data.bankAccountNumber},...this.state.data?.bankLocationId&&{bankLocationId:this.state.data.bankLocationId}},...this.state.data?.shopperEmail&&{shopperEmail:this.state.data.shopperEmail}}}get isValid(){return!!this.state.isValid}componentToRender(){return this.props.url?t(o,{ref:t=>{this.componentRef=t},icon:this.icon,url:this.props.url,paymentMethodType:this.props.paymentMethodType,onActionHandled:this.onActionHandled}):t(a,{ref:t=>{this.componentRef=t},...this.props,onChange:this.setState,payButton:this.payButton,onSubmit:this.submit})}constructor(...e){super(...e),i(this,"payButton",e=>t(n,{onClick:this.submit,...e,showReview:!!this.props.onReview}))}}i(r,"type",s.directdebit_GB);export{r as default};
2
2
  //# sourceMappingURL=BacsDD.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BacsDD.js","sources":["../../../../src/components/BacsDD/BacsDD.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport BacsInput from './components/BacsInput';\nimport BacsResult from './components/BacsResult';\nimport PayButton from '../internal/PayButton';\nimport { TxVariants } from '../tx-variants';\nimport { VoucherConfiguration } from '../internal/Voucher/types';\nimport { BacsElementData } from './types';\nimport { PayButtonProps } from '../internal/PayButton/PayButton';\n\nclass BacsElement extends UIElement<VoucherConfiguration> {\n public static readonly type = TxVariants.directdebit_GB;\n\n formatData(): BacsElementData {\n return {\n paymentMethod: {\n type: BacsElement.type,\n ...(this.state.data?.holderName && { holderName: this.state.data.holderName }),\n ...(this.state.data?.bankAccountNumber && { bankAccountNumber: this.state.data.bankAccountNumber }),\n ...(this.state.data?.bankLocationId && { bankLocationId: this.state.data.bankLocationId })\n },\n ...(this.state.data?.shopperEmail && { shopperEmail: this.state.data.shopperEmail })\n };\n }\n\n get isValid(): boolean {\n return !!this.state.isValid;\n }\n\n protected override payButton = (props: PayButtonProps) => {\n return <PayButton onClick={this.submit} {...props} />;\n };\n\n protected override componentToRender(): h.JSX.Element {\n return this.props.url ? (\n <BacsResult\n ref={ref => {\n this.componentRef = ref;\n }}\n icon={this.icon}\n url={this.props.url}\n paymentMethodType={this.props.paymentMethodType}\n onActionHandled={this.onActionHandled}\n // originalAction={this.props.originalAction}\n />\n ) : (\n <BacsInput\n // @ts-ignore ref is internal from the Component\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n onChange={this.setState}\n payButton={this.payButton}\n onSubmit={this.submit}\n />\n );\n }\n}\n\nexport default BacsElement;\n"],"names":["BacsElement","UIElement","formatData","paymentMethod","type","this","state","data","holderName","bankAccountNumber","bankLocationId","shopperEmail","isValid","componentToRender","props","url","h","BacsResult","ref","componentRef","icon","paymentMethodType","onActionHandled","BacsInput","onChange","setState","payButton","onSubmit","submit","super","args","_define_property","PayButton","onClick","TxVariants","directdebit_GB"],"mappings":"gbAUA,MAAMA,UAAoBC,EAGtBC,UAAAA,GACI,MAAO,CACHC,cAAe,CACXC,KAAMJ,EAAYI,QACdC,KAAKC,MAAMC,MAAMC,YAAc,CAAEA,WAAYH,KAAKC,MAAMC,KAAKC,eAC7DH,KAAKC,MAAMC,MAAME,mBAAqB,CAAEA,kBAAmBJ,KAAKC,MAAMC,KAAKE,sBAC3EJ,KAAKC,MAAMC,MAAMG,gBAAkB,CAAEA,eAAgBL,KAAKC,MAAMC,KAAKG,oBAEzEL,KAAKC,MAAMC,MAAMI,cAAgB,CAAEA,aAAcN,KAAKC,MAAMC,KAAKI,cAE7E,CAEA,WAAIC,GACA,QAASP,KAAKC,MAAMM,OACxB,CAMmBC,iBAAAA,GACf,OAAOR,KAAKS,MAAMC,IACdC,EAACC,EAAAA,CACGC,IAAKA,IACDb,KAAKc,aAAeD,GAExBE,KAAMf,KAAKe,KACXL,IAAKV,KAAKS,MAAMC,IAChBM,kBAAmBhB,KAAKS,MAAMO,kBAC9BC,gBAAiBjB,KAAKiB,kBAI1BN,EAACO,EAAAA,CAEGL,IAAKA,IACDb,KAAKc,aAAeD,MAEpBb,KAAKS,MACTU,SAAUnB,KAAKoB,SACfC,UAAWrB,KAAKqB,UAChBC,SAAUtB,KAAKuB,QAG3B,mBA/CJC,SAAAC,GAmBIC,EAAA1B,KAAmBqB,YAAaZ,GACrBE,EAACgB,EAAAA,CAAUC,QAAS5B,KAAKuB,UAAYd,MAnBhDiB,EADE/B,EACqBI,OAAO8B,EAAWC"}
1
+ {"version":3,"file":"BacsDD.js","sources":["../../../../src/components/BacsDD/BacsDD.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport BacsInput from './components/BacsInput';\nimport BacsResult from './components/BacsResult';\nimport PayButton from '../internal/PayButton';\nimport { TxVariants } from '../tx-variants';\nimport { VoucherConfiguration } from '../internal/Voucher/types';\nimport { BacsElementData } from './types';\nimport { PayButtonProps } from '../internal/PayButton/PayButton';\n\nclass BacsElement extends UIElement<VoucherConfiguration> {\n public static readonly type = TxVariants.directdebit_GB;\n\n formatData(): BacsElementData {\n return {\n paymentMethod: {\n type: BacsElement.type,\n ...(this.state.data?.holderName && { holderName: this.state.data.holderName }),\n ...(this.state.data?.bankAccountNumber && { bankAccountNumber: this.state.data.bankAccountNumber }),\n ...(this.state.data?.bankLocationId && { bankLocationId: this.state.data.bankLocationId })\n },\n ...(this.state.data?.shopperEmail && { shopperEmail: this.state.data.shopperEmail })\n };\n }\n\n get isValid(): boolean {\n return !!this.state.isValid;\n }\n\n protected override payButton = (props: PayButtonProps) => {\n return <PayButton onClick={this.submit} {...props} showReview={!!this.props.onReview} />;\n };\n\n protected override componentToRender(): h.JSX.Element {\n return this.props.url ? (\n <BacsResult\n ref={ref => {\n this.componentRef = ref;\n }}\n icon={this.icon}\n url={this.props.url}\n paymentMethodType={this.props.paymentMethodType}\n onActionHandled={this.onActionHandled}\n // originalAction={this.props.originalAction}\n />\n ) : (\n <BacsInput\n // @ts-ignore ref is internal from the Component\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n onChange={this.setState}\n payButton={this.payButton}\n onSubmit={this.submit}\n />\n );\n }\n}\n\nexport default BacsElement;\n"],"names":["BacsElement","UIElement","formatData","paymentMethod","type","this","state","data","holderName","bankAccountNumber","bankLocationId","shopperEmail","isValid","componentToRender","props","url","h","BacsResult","ref","componentRef","icon","paymentMethodType","onActionHandled","BacsInput","onChange","setState","payButton","onSubmit","submit","super","args","_define_property","PayButton","onClick","showReview","onReview","TxVariants","directdebit_GB"],"mappings":"gbAUA,MAAMA,UAAoBC,EAGtBC,UAAAA,GACI,MAAO,CACHC,cAAe,CACXC,KAAMJ,EAAYI,QACdC,KAAKC,MAAMC,MAAMC,YAAc,CAAEA,WAAYH,KAAKC,MAAMC,KAAKC,eAC7DH,KAAKC,MAAMC,MAAME,mBAAqB,CAAEA,kBAAmBJ,KAAKC,MAAMC,KAAKE,sBAC3EJ,KAAKC,MAAMC,MAAMG,gBAAkB,CAAEA,eAAgBL,KAAKC,MAAMC,KAAKG,oBAEzEL,KAAKC,MAAMC,MAAMI,cAAgB,CAAEA,aAAcN,KAAKC,MAAMC,KAAKI,cAE7E,CAEA,WAAIC,GACA,QAASP,KAAKC,MAAMM,OACxB,CAMmBC,iBAAAA,GACf,OAAOR,KAAKS,MAAMC,IACdC,EAACC,EAAAA,CACGC,IAAKA,IACDb,KAAKc,aAAeD,GAExBE,KAAMf,KAAKe,KACXL,IAAKV,KAAKS,MAAMC,IAChBM,kBAAmBhB,KAAKS,MAAMO,kBAC9BC,gBAAiBjB,KAAKiB,kBAI1BN,EAACO,EAAAA,CAEGL,IAAKA,IACDb,KAAKc,aAAeD,MAEpBb,KAAKS,MACTU,SAAUnB,KAAKoB,SACfC,UAAWrB,KAAKqB,UAChBC,SAAUtB,KAAKuB,QAG3B,mBA/CJC,SAAAC,GAmBIC,EAAA1B,KAAmBqB,YAAaZ,GACrBE,EAACgB,EAAAA,CAAUC,QAAS5B,KAAKuB,UAAYd,EAAOoB,aAAc7B,KAAKS,MAAMqB,aAnBhFJ,EADE/B,EACqBI,OAAOgC,EAAWC"}
@@ -1,2 +1,2 @@
1
- import{createElement as t}from"../../external/preact/dist/preact.js";import e from"./components/CardInput/CardInput.js";import o from"../../utils/browserInfo.js";import{triggerBinLookUp as s}from"../internal/SecuredFields/binLookup/triggerBinLookUp.js";import{fieldTypeToSnakeCase as n,isSecuredField as i}from"../internal/SecuredFields/utils.js";import{reject as r,notFalsy as a}from"../../utils/commonUtils.js";import{shouldIncludeInstallmentsInPaymentData as p}from"./components/CardInput/utils.js";import c from"../internal/ClickToPay/services/create-clicktopay-service.js";import u from"./components/ClickToPayWrapper.js";import{TxVariants as d}from"../tx-variants.js";import{UIElement as l}from"../internal/UIElement/UIElement.js";import h from"../internal/PayButton/PayButton.js";import m,{IMPLEMENTATION_ERROR as y}from"../../core/Errors/AdyenCheckoutError.js";import f from"./components/CardInput/defaultProps.js";import{AnalyticsInfoEvent as g,InfoEventType as b}from"../../core/Analytics/events/AnalyticsInfoEvent.js";function P(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}class C extends l{setStatus(t,e){return this.componentRef?.setStatus&&this.componentRef.setStatus(t,e),this.clickToPayRef?.setStatus&&this.clickToPayRef.setStatus(t),this}getPaymentMethodConfigFromResponse(t){return t?.fundingSource?this.core.paymentMethodsResponse?.findByFundingSource(t.type,t.fundingSource):super.getPaymentMethodConfigFromResponse(t)}formatProps(t){const e=t.session?.configuration?.enableStoreDetails??t.enableStoreDetails,o=!(0===t.amount?.value)&&e,s=t.storedPaymentMethodId||t.id,n=s&&t?.supportedShopperInteractions?.includes("Ecommerce");if(s&&!n)throw new m(y,"You are trying to create a storedCard from a stored PM that does not support Ecommerce interactions");const i=t.installmentOptions;t.session&&a(i)&&console.warn("WARNING: You have defined installments configuration on the Card component, but you are using a /sessions integration.\nWith this integration, installments configuration must be defined when you create the session. Any configuration defined elsewhere will be ignored.\n\n");const r=t.session?t.session?.configuration?.installmentOptions??f.installmentOptions:i;return{...t,holderNameRequired:!!t.hasHolderName&&t.holderNameRequired,hasCVC:!(t.brand&&"bcmc"===t.brand||t.hideCVC),billingAddressRequired:!t.storedPaymentMethodId&&t.billingAddressRequired,billingAddressMode:t.onAddressLookup?f.billingAddressMode:t.billingAddressMode,brand:t.brand??d.card,countryCode:t.countryCode?t.countryCode.toLowerCase():null,configuration:{...t.configuration,socialSecurityNumberMode:t.configuration?.socialSecurityNumberMode??"auto"},brandsConfiguration:t.brandsConfiguration||t.configuration?.brandsConfiguration||{},icon:t.icon||t.configuration?.icon,installmentOptions:r,enableStoreDetails:e,showStoreDetailsCheckbox:o,clickToPayConfiguration:{...t.clickToPayConfiguration,disableOtpAutoFocus:t.clickToPayConfiguration?.disableOtpAutoFocus||!1,shopperEmail:t.clickToPayConfiguration?.shopperEmail||this.core.options?.session?.shopperEmail,telephoneNumber:t.clickToPayConfiguration?.telephoneNumber||this.core.options?.session?.telephoneNumber,locale:t.clickToPayConfiguration?.locale||t.i18n?.locale?.replace("-","_")},...s&&{storedPaymentMethodId:s}}}formatData(){const t=this.state.selectedBrandValue;return{paymentMethod:{type:C.type,...this.state.data,...this.props.storedPaymentMethodId&&{storedPaymentMethodId:this.props.storedPaymentMethodId,holderName:this.props.holderName??""},...t&&{brand:t},...this.props.fundingSource&&{fundingSource:this.props.fundingSource},...this.state.fastlaneData&&{fastlaneData:btoa(JSON.stringify(this.state.fastlaneData))}},...this.state.billingAddress&&{billingAddress:this.state.billingAddress},...this.state.socialSecurityNumber&&{socialSecurityNumber:this.state.socialSecurityNumber},...this.storePaymentMethodPayload,...p(this.state.installments)&&{installments:this.state.installments},browserInfo:this.browserInfo,origin:!!window&&window.location.origin}}beforeRender(t){if(t?.originalAction)return;const e=new g({type:b.rendered,component:this.type,configData:{...t,showPayButton:this.props.showPayButton},...t?.oneClick&&{isStoredPaymentMethod:!0,brand:t.brand}});this.analytics.sendAnalytics(e)}updateStyles(t){return this.componentRef?.updateStyles&&this.componentRef.updateStyles(t),this}setFocusOn(t){return this.componentRef?.setFocusOn&&this.componentRef.setFocusOn(t),this}processBinLookupResponse(t,e=!1){return this.componentRef?.processBinLookupResponse&&this.componentRef.processBinLookupResponse(t,e),this}handleUnsupportedCard(t){return this.componentRef?.handleUnsupportedCard&&this.componentRef.handleUnsupportedCard(t),this}onBinLookup(t){if(!t.isReset){const e=r("supportedBrandsRaw").from(t);this.props.onBinLookup?.(e)}}get storePaymentMethodPayload(){if(this.props.storedPaymentMethodId?.length>0)return{};if(0===this.props.amount?.value)return this.props.enableStoreDetails?{storePaymentMethod:!0}:{};return this.props.showStoreDetailsCheckbox&&void 0!==this.state.storePaymentMethod?{storePaymentMethod:Boolean(this.state.storePaymentMethod)}:{}}get isValid(){return!!this.state.isValid}get icon(){return this.props.icon??this.resources.getImage()(this.props.brand)}get brands(){const{brands:t,brandsConfiguration:e}=this.props;return t?t.map(t=>({icon:e?.[t]?.icon??this.props.modules.resources.getImage()(t),name:t})):[]}get displayName(){return this.props.storedPaymentMethodId?`•••• ${this.props.lastFour}`:this.props.name||C.type}get accessibleName(){return(this.props.name||C.type)+(this.props.storedPaymentMethodId?" "+this.props.i18n.get("creditCard.storedCard.description.ariaLabel").replace("%@",this.props.lastFour):"")}get browserInfo(){return o()}renderCardInput(o=!0){return t(e,{setComponentRef:this.setComponentRef,...this.props,...this.state,onSubmitAnalytics:this.submitAnalytics,onChange:this.setState,onSubmit:this.submit,handleKeyPress:this.handleKeyPress,payButton:this.payButton,onBrand:this.onBrand,onBinValue:this.onBinValue,brand:this.props.brand,brandsIcons:this.brands,isPayButtonPrimaryVariant:o,resources:this.resources,onFocus:this.onFocus,onBlur:this.onBlur,onConfigSuccess:this.onConfigSuccess})}componentToRender(){return t(u,{configuration:this.props.clickToPayConfiguration,clickToPayService:this.clickToPayService,isStandaloneComponent:!1,setClickToPayRef:this.setClickToPayRef,onSetStatus:this.setElementStatus,onSubmit:this.handleClickToPaySubmit,onError:this.handleError},t=>this.renderCardInput(t))}constructor(e,o){super(e,o),P(this,"clickToPayService",void 0),P(this,"clickToPayRef",null),P(this,"setClickToPayRef",t=>{this.clickToPayRef=t}),P(this,"onBrand",t=>{this.props.onBrand?.(t)}),P(this,"handleClickToPaySubmit",t=>{this.setState({data:{...t},valid:{},errors:{},isValid:!0}),this.submit()}),P(this,"onConfigSuccess",t=>{const e=new g({component:this.type,type:b.configured});this.submitAnalytics(e),this.props.onConfigSuccess?.(t)}),P(this,"onFocus",t=>{const e=new g({component:this.type,type:b.focus,target:n(t.fieldType)});this.submitAnalytics(e),i(t.fieldType)?this.props.onFocus?.(t.event):this.props.onFocus?.(t)}),P(this,"onBlur",t=>{const e=new g({component:this.type,type:b.unfocus,target:n(t.fieldType)});this.submitAnalytics(e),i(t.fieldType)?this.props.onBlur?.(t.event):this.props.onBlur?.(t)}),P(this,"onBinValue",s(this)),P(this,"payButton",e=>{const o=0===this.props.amount?.value,s=this.props.storedPaymentMethodId?.length>0;return t(h,{...e,label:o&&!s?this.props.i18n.get("payButton.saveDetails"):"",onClick:this.submit})}),o&&!o._disableClickToPay&&"prepaid"!==this.props.fundingSource&&(this.clickToPayService=c(this.props.configuration,this.props.clickToPayConfiguration,this.props.environment,this.analytics),this.clickToPayService?.initialize())}}P(C,"type",d.scheme),P(C,"defaultProps",{showFormInstruction:!0,_disableClickToPay:!1,doBinLookup:!0,...r(["type","setComponentRef"]).from(f)});export{C as CardElement,C as default};
1
+ import{createElement as t}from"../../external/preact/dist/preact.js";import e from"./components/CardInput/CardInput.js";import o from"../../utils/browserInfo.js";import{triggerBinLookUp as s}from"../internal/SecuredFields/binLookup/triggerBinLookUp.js";import{fieldTypeToSnakeCase as n,isSecuredField as i}from"../internal/SecuredFields/utils.js";import{reject as r,notFalsy as a}from"../../utils/commonUtils.js";import{shouldIncludeInstallmentsInPaymentData as p}from"./components/CardInput/utils.js";import c from"../internal/ClickToPay/services/create-clicktopay-service.js";import u from"./components/ClickToPayWrapper.js";import{TxVariants as d}from"../tx-variants.js";import{UIElement as l}from"../internal/UIElement/UIElement.js";import h from"../internal/PayButton/PayButton.js";import m,{IMPLEMENTATION_ERROR as y}from"../../core/Errors/AdyenCheckoutError.js";import f from"./components/CardInput/defaultProps.js";import{AnalyticsInfoEvent as g,InfoEventType as b}from"../../core/Analytics/events/AnalyticsInfoEvent.js";function C(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}class P extends l{setStatus(t,e){return this.componentRef?.setStatus&&this.componentRef.setStatus(t,e),this.clickToPayRef?.setStatus&&this.clickToPayRef.setStatus(t),this}getPaymentMethodConfigFromResponse(t){return t?.fundingSource?this.core.paymentMethodsResponse?.findByFundingSource(t.type,t.fundingSource):super.getPaymentMethodConfigFromResponse(t)}formatProps(t){const e=t.session?.configuration?.enableStoreDetails??t.enableStoreDetails,o=!(0===t.amount?.value)&&e,s=t.storedPaymentMethodId||t.id,n=s&&t?.supportedShopperInteractions?.includes("Ecommerce");if(s&&!n)throw new m(y,"You are trying to create a storedCard from a stored PM that does not support Ecommerce interactions");const i=t.installmentOptions;t.session&&a(i)&&console.warn("WARNING: You have defined installments configuration on the Card component, but you are using a /sessions integration.\nWith this integration, installments configuration must be defined when you create the session. Any configuration defined elsewhere will be ignored.\n\n");const r=t.session?t.session?.configuration?.installmentOptions??f.installmentOptions:i;return{...t,holderNameRequired:!!t.hasHolderName&&t.holderNameRequired,hasCVC:!(t.brand&&"bcmc"===t.brand||t.hideCVC),billingAddressRequired:!t.storedPaymentMethodId&&t.billingAddressRequired,billingAddressMode:t.onAddressLookup?f.billingAddressMode:t.billingAddressMode,brand:t.brand??d.card,countryCode:t.countryCode?t.countryCode.toLowerCase():null,configuration:{...t.configuration,socialSecurityNumberMode:t.configuration?.socialSecurityNumberMode??"auto"},brandsConfiguration:t.brandsConfiguration||t.configuration?.brandsConfiguration||{},icon:t.icon||t.configuration?.icon,installmentOptions:r,enableStoreDetails:e,showStoreDetailsCheckbox:o,clickToPayConfiguration:{...t.clickToPayConfiguration,disableOtpAutoFocus:t.clickToPayConfiguration?.disableOtpAutoFocus||!1,shopperEmail:t.clickToPayConfiguration?.shopperEmail||this.core.options?.session?.shopperEmail,telephoneNumber:t.clickToPayConfiguration?.telephoneNumber||this.core.options?.session?.telephoneNumber,locale:t.clickToPayConfiguration?.locale||t.i18n?.locale?.replace("-","_")},...s&&{storedPaymentMethodId:s}}}formatData(){const t=this.state.selectedBrandValue;return{paymentMethod:{type:P.type,...this.state.data,...this.props.storedPaymentMethodId&&{storedPaymentMethodId:this.props.storedPaymentMethodId,holderName:this.props.holderName??""},...t&&{brand:t},...this.props.fundingSource&&{fundingSource:this.props.fundingSource},...this.state.fastlaneData&&{fastlaneData:btoa(JSON.stringify(this.state.fastlaneData))}},...this.state.billingAddress&&{billingAddress:this.state.billingAddress},...this.state.socialSecurityNumber&&{socialSecurityNumber:this.state.socialSecurityNumber},...this.storePaymentMethodPayload,...p(this.state.installments)&&{installments:this.state.installments},browserInfo:this.browserInfo,origin:!!window&&window.location.origin}}beforeRender(t){if(t?.originalAction)return;const e=new g({type:b.rendered,component:this.type,configData:{...t,showPayButton:this.props.showPayButton},...t?.oneClick&&{isStoredPaymentMethod:!0,brand:t.brand}});this.analytics.sendAnalytics(e)}updateStyles(t){return this.componentRef?.updateStyles&&this.componentRef.updateStyles(t),this}setFocusOn(t){return this.componentRef?.setFocusOn&&this.componentRef.setFocusOn(t),this}processBinLookupResponse(t,e=!1){return this.componentRef?.processBinLookupResponse&&this.componentRef.processBinLookupResponse(t,e),this}handleUnsupportedCard(t){return this.componentRef?.handleUnsupportedCard&&this.componentRef.handleUnsupportedCard(t),this}onBinLookup(t){if(!t.isReset){const e=r("supportedBrandsRaw").from(t);this.props.onBinLookup?.(e)}}get storePaymentMethodPayload(){if(this.props.storedPaymentMethodId?.length>0)return{};if(0===this.props.amount?.value)return this.props.enableStoreDetails?{storePaymentMethod:!0}:{};return this.props.showStoreDetailsCheckbox&&void 0!==this.state.storePaymentMethod?{storePaymentMethod:Boolean(this.state.storePaymentMethod)}:{}}get isValid(){return!!this.state.isValid}get icon(){return this.props.icon??this.resources.getImage()(this.props.brand)}get brands(){const{brands:t,brandsConfiguration:e}=this.props;return t?t.map(t=>({icon:e?.[t]?.icon??this.props.modules.resources.getImage()(t),name:t})):[]}get displayName(){return this.props.storedPaymentMethodId?`•••• ${this.props.lastFour}`:this.props.name||P.type}get accessibleName(){return(this.props.name||P.type)+(this.props.storedPaymentMethodId?" "+this.props.i18n.get("creditCard.storedCard.description.ariaLabel").replace("%@",this.props.lastFour):"")}get browserInfo(){return o()}renderCardInput(o=!0){return t(e,{setComponentRef:this.setComponentRef,...this.props,...this.state,onSubmitAnalytics:this.submitAnalytics,onChange:this.setState,onSubmit:this.submit,handleKeyDown:this.handleKeyDown,payButton:this.payButton,onBrand:this.onBrand,onBinValue:this.onBinValue,brand:this.props.brand,brandsIcons:this.brands,isPayButtonPrimaryVariant:o,resources:this.resources,onFocus:this.onFocus,onBlur:this.onBlur,onConfigSuccess:this.onConfigSuccess})}componentToRender(){return t(u,{configuration:this.props.clickToPayConfiguration,clickToPayService:this.clickToPayService,isStandaloneComponent:!1,setClickToPayRef:this.setClickToPayRef,onSetStatus:this.setElementStatus,onSubmit:this.handleClickToPaySubmit,onError:this.handleError},t=>this.renderCardInput(t))}constructor(e,o){super(e,o),C(this,"clickToPayService",void 0),C(this,"clickToPayRef",null),C(this,"setClickToPayRef",t=>{this.clickToPayRef=t}),C(this,"onBrand",t=>{this.props.onBrand?.(t)}),C(this,"handleClickToPaySubmit",t=>{this.setState({data:{...t},valid:{},errors:{},isValid:!0}),this.submit()}),C(this,"onConfigSuccess",t=>{const e=new g({component:this.type,type:b.configured});this.submitAnalytics(e),this.props.onConfigSuccess?.(t)}),C(this,"onFocus",t=>{const e=new g({component:this.type,type:b.focus,target:n(t.fieldType)});this.submitAnalytics(e),i(t.fieldType)?this.props.onFocus?.(t.event):this.props.onFocus?.(t)}),C(this,"onBlur",t=>{const e=new g({component:this.type,type:b.unfocus,target:n(t.fieldType)});this.submitAnalytics(e),i(t.fieldType)?this.props.onBlur?.(t.event):this.props.onBlur?.(t)}),C(this,"onBinValue",s(this)),C(this,"payButton",e=>{const o=0===this.props.amount?.value,s=this.props.storedPaymentMethodId?.length>0;return t(h,{...e,label:o&&!s?this.props.i18n.get("payButton.saveDetails"):"",onClick:this.submit,showReview:!!this.props.onReview})}),o&&!o._disableClickToPay&&"prepaid"!==this.props.fundingSource&&(this.clickToPayService=c(this.props.configuration,this.props.clickToPayConfiguration,this.props.environment,this.analytics),this.clickToPayService?.initialize())}}C(P,"type",d.scheme),C(P,"defaultProps",{showFormInstruction:!0,_disableClickToPay:!1,doBinLookup:!0,...r(["type","setComponentRef"]).from(f)});export{P as CardElement,P as default};
2
2
  //# sourceMappingURL=Card.js.map
@@ -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 collectBrowserInfo from '../../utils/browserInfo';\nimport { BinLookupResponse, CardElementData, CardConfiguration } from './types';\nimport { triggerBinLookUp } from '../internal/SecuredFields/binLookup/triggerBinLookUp';\nimport { CardBinLookupData, CardConfigSuccessData, CardFocusData } from '../internal/SecuredFields/lib/types';\nimport { fieldTypeToSnakeCase, isSecuredField } from '../internal/SecuredFields/utils';\nimport { notFalsy, reject } from '../../utils/commonUtils';\nimport { shouldIncludeInstallmentsInPaymentData } 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, PaymentMethodBrand } from '../../types/global-types';\nimport { TxVariants } from '../tx-variants';\nimport type { ComponentMethodsRef, UIElementStatus } from '../internal/UIElement/types';\nimport UIElement from '../internal/UIElement';\nimport PayButton from '../internal/PayButton';\nimport type { ICore } from '../../core/types';\nimport AdyenCheckoutError, { IMPLEMENTATION_ERROR } from '../../core/Errors/AdyenCheckoutError';\nimport CardInputDefaultProps from './components/CardInput/defaultProps';\nimport { PayButtonProps } from '../internal/PayButton/PayButton';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../core/Analytics/events/AnalyticsInfoEvent';\nimport { InstallmentOptions } from './components/CardInput/components/Installments/Installments';\n\nexport class CardElement extends UIElement<CardConfiguration> {\n public static readonly type: TxVariants = TxVariants.scheme;\n\n private readonly clickToPayService: IClickToPayService | null;\n\n /**\n * Reference to the 'ClickToPayComponent'\n */\n private clickToPayRef: ComponentMethodsRef | null = null;\n\n constructor(checkout: ICore, props?: CardConfiguration) {\n super(checkout, props);\n\n if (props && !props._disableClickToPay && this.props.fundingSource !== 'prepaid') {\n this.clickToPayService = createClickToPayService(\n this.props.configuration,\n this.props.clickToPayConfiguration,\n this.props.environment,\n this.analytics\n );\n\n void this.clickToPayService?.initialize();\n }\n }\n\n protected static readonly defaultProps = {\n showFormInstruction: true,\n _disableClickToPay: false,\n doBinLookup: true,\n // Merge most of CardInput's defaultProps\n ...reject(['type', 'setComponentRef']).from(CardInputDefaultProps)\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);\n }\n return this;\n }\n\n private readonly setClickToPayRef = (ref: ComponentMethodsRef) => {\n this.clickToPayRef = ref;\n };\n\n // This is the most self contained way of handling funding source matching\n // Alternatives would be to override getPaymentMethodConfigFromResponse and change it's signature\n protected override getPaymentMethodConfigFromResponse(componentProps: CardConfiguration) {\n if (componentProps?.fundingSource) {\n return this.core.paymentMethodsResponse?.findByFundingSource(componentProps.type, componentProps.fundingSource);\n }\n\n return super.getPaymentMethodConfigFromResponse(componentProps);\n }\n\n formatProps(props: CardConfiguration): 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 // Take the configuration set on the card component - which is either merchant defined or default (empty object)\n // @ts-ignore 'installmentOptions' is optional on CardConfiguration (the merchant-facing type), but by this point\n // UIElement.buildElementProps has already merged CardInputDefaultProps.installmentOptions ({}) into props\n // before formatProps() is called, so the value is always defined here.\n const merchantInstallmentOptions: InstallmentOptions = props.installmentOptions;\n\n if (props.session && notFalsy(merchantInstallmentOptions)) {\n console.warn(\n 'WARNING: You have defined installments configuration on the Card component, but you are using a /sessions integration.\\nWith this integration, installments configuration must be defined when you create the session. Any configuration defined elsewhere will be ignored.\\n\\n'\n );\n }\n\n // In a session scenario, only the session's own installments configuration is used; otherwise fall back to the merchant configuration / default\n const shownInstallmentOptions: InstallmentOptions = props.session\n ? (props.session?.configuration?.installmentOptions ?? CardInputDefaultProps.installmentOptions)\n : merchantInstallmentOptions;\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 // edge case where merchant has defined both an onAddressLookup callback AND set billingAddressMode: 'partial' - which leads to some strange behaviour in the address UI\n billingAddressMode: props.onAddressLookup ? CardInputDefaultProps.billingAddressMode : props.billingAddressMode,\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: shownInstallmentOptions,\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 && {\n storedPaymentMethodId: this.props.storedPaymentMethodId,\n holderName: this.props.holderName ?? ''\n }),\n ...(cardBrand && { brand: cardBrand }),\n ...(this.props.fundingSource && { fundingSource: this.props.fundingSource }),\n ...(this.state.fastlaneData && { fastlaneData: btoa(JSON.stringify(this.state.fastlaneData)) })\n },\n ...(this.state.billingAddress && { billingAddress: this.state.billingAddress }),\n ...(this.state.socialSecurityNumber && { socialSecurityNumber: this.state.socialSecurityNumber }),\n ...this.storePaymentMethodPayload,\n ...(shouldIncludeInstallmentsInPaymentData(this.state.installments) && { installments: this.state.installments }),\n browserInfo: this.browserInfo,\n origin: !!window && window.location.origin\n };\n }\n\n protected override beforeRender(configSetByMerchant?: CardConfiguration): void {\n // We don't send 'rendered' events when rendering actions\n if (configSetByMerchant?.originalAction) {\n return;\n }\n\n const event = new AnalyticsInfoEvent({\n type: InfoEventType.rendered,\n component: this.type,\n configData: { ...configSetByMerchant, showPayButton: this.props.showPayButton },\n ...(configSetByMerchant?.oneClick && {\n isStoredPaymentMethod: true,\n brand: configSetByMerchant.brand\n })\n });\n\n this.analytics.sendAnalytics(event);\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 | null, 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 readonly handleClickToPaySubmit = (payload: ClickToPayCheckoutPayload) => {\n this.setState({ data: { ...payload }, valid: {}, errors: {}, isValid: true });\n this.submit();\n };\n\n onBinLookup(obj: CardBinLookupData) {\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 private readonly onConfigSuccess = (obj: CardConfigSuccessData) => {\n const event = new AnalyticsInfoEvent({ component: this.type, type: InfoEventType.configured });\n this.submitAnalytics(event);\n\n this.props.onConfigSuccess?.(obj);\n };\n\n private readonly onFocus = (obj: ComponentFocusObject) => {\n const event = new AnalyticsInfoEvent({\n component: this.type,\n type: InfoEventType.focus,\n target: fieldTypeToSnakeCase(obj.fieldType) as UiTarget\n });\n this.submitAnalytics(event);\n\n // Call merchant defined callback\n if (isSecuredField(obj.fieldType)) {\n this.props.onFocus?.(obj.event as CardFocusData);\n } else {\n this.props.onFocus?.(obj);\n }\n };\n\n private readonly onBlur = (obj: ComponentFocusObject) => {\n const event = new AnalyticsInfoEvent({\n component: this.type,\n type: InfoEventType.unfocus,\n target: fieldTypeToSnakeCase(obj.fieldType) as UiTarget\n });\n this.submitAnalytics(event);\n\n // Call merchant defined callback\n if (isSecuredField(obj.fieldType)) {\n this.props.onBlur?.(obj.event as CardFocusData);\n } else {\n this.props.onBlur?.(obj);\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.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(): PaymentMethodBrand[] {\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\n protected override payButton = (props: PayButtonProps): h.JSX.Element => {\n const isZeroAuth = this.props.amount?.value === 0;\n const isStoredCard = this.props.storedPaymentMethodId?.length > 0;\n return <PayButton {...props} label={isZeroAuth && !isStoredCard ? this.props.i18n.get('payButton.saveDetails') : ''} onClick={this.submit} />;\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 onSubmitAnalytics={this.submitAnalytics}\n onChange={this.setState}\n onSubmit={this.submit}\n handleKeyPress={this.handleKeyPress}\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 onConfigSuccess={this.onConfigSuccess}\n />\n );\n }\n\n protected override componentToRender(): h.JSX.Element {\n return (\n <ClickToPayWrapper\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 );\n }\n}\n\nexport default CardElement;\n"],"names":["CardElement","UIElement","setStatus","status","props","this","componentRef","clickToPayRef","getPaymentMethodConfigFromResponse","componentProps","fundingSource","core","paymentMethodsResponse","findByFundingSource","type","super","formatProps","enableStoreDetails","session","configuration","showStoreDetailsCheckbox","amount","value","storedCardID","storedPaymentMethodId","id","isEcommerceStoredCard","supportedShopperInteractions","includes","AdyenCheckoutError","IMPLEMENTATION_ERROR","merchantInstallmentOptions","installmentOptions","notFalsy","console","warn","shownInstallmentOptions","CardInputDefaultProps","holderNameRequired","hasHolderName","hasCVC","brand","hideCVC","billingAddressRequired","billingAddressMode","onAddressLookup","TxVariants","card","countryCode","toLowerCase","socialSecurityNumberMode","brandsConfiguration","icon","clickToPayConfiguration","disableOtpAutoFocus","shopperEmail","options","telephoneNumber","locale","i18n","replace","formatData","cardBrand","state","selectedBrandValue","paymentMethod","data","holderName","fastlaneData","btoa","JSON","stringify","billingAddress","socialSecurityNumber","storePaymentMethodPayload","shouldIncludeInstallmentsInPaymentData","installments","browserInfo","origin","window","location","beforeRender","configSetByMerchant","originalAction","event","AnalyticsInfoEvent","InfoEventType","rendered","component","configData","showPayButton","oneClick","isStoredPaymentMethod","analytics","sendAnalytics","updateStyles","stylesObj","setFocusOn","fieldName","processBinLookupResponse","binLookupResponse","isReset","handleUnsupportedCard","errObj","onBinLookup","obj","nuObj","reject","from","length","storePaymentMethod","Boolean","isValid","resources","getImage","brands","map","modules","name","displayName","lastFour","accessibleName","get","collectBrowserInfo","renderCardInput","isCardPrimaryInput","h","CardInput","setComponentRef","onSubmitAnalytics","submitAnalytics","onChange","setState","onSubmit","submit","handleKeyPress","payButton","onBrand","onBinValue","brandsIcons","isPayButtonPrimaryVariant","onFocus","onBlur","onConfigSuccess","componentToRender","ClickToPayWrapper","clickToPayService","isStandaloneComponent","setClickToPayRef","onSetStatus","setElementStatus","handleClickToPaySubmit","onError","handleError","constructor","checkout","_define_property","ref","payload","valid","errors","configured","focus","target","fieldTypeToSnakeCase","fieldType","isSecuredField","unfocus","triggerBinLookUp","isZeroAuth","isStoredCard","PayButton","label","onClick","_disableClickToPay","createClickToPayService","environment","initialize","scheme","defaultProps","showFormInstruction","doBinLookup"],"mappings":"6nCAwBO,MAAMA,UAAoBC,EAiCtBC,SAAAA,CAAUC,EAAyBC,GAOtC,OANIC,KAAKC,cAAcJ,WACnBG,KAAKC,aAAaJ,UAAUC,EAAQC,GAEpCC,KAAKE,eAAeL,WACpBG,KAAKE,cAAcL,UAAUC,GAE1BE,IACX,CAQmBG,kCAAAA,CAAmCC,GAClD,OAAIA,GAAgBC,cACTL,KAAKM,KAAKC,wBAAwBC,oBAAoBJ,EAAeK,KAAML,EAAeC,eAG9FK,MAAMP,mCAAmCC,EACpD,CAEAO,WAAAA,CAAYZ,GAER,MAAMa,EAAqBb,EAAMc,SAASC,eAAeF,oBAAsBb,EAAMa,mBAG/EG,IADqC,IAAxBhB,EAAMiB,QAAQC,QACqBL,EAEhDM,EAAenB,EAAMoB,uBAAyBpB,EAAMqB,GACpDC,EAAwBH,GAAgBnB,GAAOuB,8BAA8BC,SAAS,aAG5F,GAAIL,IAAiBG,EAEjB,MAAM,IAAIG,EACNC,EACA,uGAQR,MAAMC,EAAiD3B,EAAM4B,mBAEzD5B,EAAMc,SAAWe,EAASF,IAC1BG,QAAQC,KACJ,mRAKR,MAAMC,EAA8ChC,EAAMc,QACnDd,EAAMc,SAASC,eAAea,oBAAsBK,EAAsBL,mBAC3ED,EAEN,MAAO,IACA3B,EAEHkC,qBAAqBlC,EAAMmC,eAAwBnC,EAAMkC,mBAEzDE,SAAUpC,EAAOqC,OAAyB,SAAhBrC,EAAMqC,OAAqBrC,EAAMsC,SAE3DC,wB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EAAIrB,OAEzB/E,KAAKD,MAAMyI,UAAUpC,KAI7BmD,EAAAvJ,KAAiByI,SAAUrC,IACvB,MAAMrB,EAAQ,IAAIC,EAAmB,CACjCG,UAAWnF,KAAKS,KAChBA,KAAMwE,EAAciF,QACpBJ,OAAQC,EAAqB3D,EAAI4D,aAErChK,KAAK6H,gBAAgB9C,GAGjBkF,EAAe7D,EAAI4D,WACnBhK,KAAKD,MAAM0I,SAASrC,EAAIrB,OAExB/E,KAAKD,MAAM0I,SAASrC,KAI5BmD,OAAOlB,aAAa8B,EAAiBnK,OAoErCuJ,EAAAvJ,KAAmBmI,YAAapI,IAC5B,MAAMqK,EAA0C,IAA7BpK,KAAKD,MAAMiB,QAAQC,MAChCoJ,EAAerK,KAAKD,MAAMoB,uBAAuBqF,OAAS,EAChE,OAAOiB,EAAC6C,EAAAA,IAAcvK,EAAOwK,MAAOH,IAAeC,EAAerK,KAAKD,MAAMuD,KAAK+D,IAAI,yBAA2B,GAAImD,QAASxK,KAAKiI,WA9T/HlI,IAAUA,EAAM0K,oBAAmD,YAA7BzK,KAAKD,MAAMM,gBACjDL,KAAK6I,kBAAoB6B,EACrB1K,KAAKD,MAAMe,cACXd,KAAKD,MAAMiD,wBACXhD,KAAKD,MAAM4K,YACX3K,KAAKwF,WAGJxF,KAAK6I,mBAAmB+B,aAErC,EAtBArB,EADS5J,EACcc,OAAmBgC,EAAWoI,QAwBrDtB,EAzBS5J,EAyBiBmL,eAAe,CACrCC,qBAAqB,EACrBN,oBAAoB,EACpBO,aAAa,KAEV1E,EAAO,CAAC,OAAQ,oBAAoBC,KAAKvE"}
1
+ {"version":3,"file":"Card.js","sources":["../../../../src/components/Card/Card.tsx"],"sourcesContent":["import { h } from 'preact';\nimport CardInput from './components/CardInput';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport { BinLookupResponse, CardElementData, CardConfiguration } from './types';\nimport { triggerBinLookUp } from '../internal/SecuredFields/binLookup/triggerBinLookUp';\nimport { CardBinLookupData, CardConfigSuccessData, CardFocusData } from '../internal/SecuredFields/lib/types';\nimport { fieldTypeToSnakeCase, isSecuredField } from '../internal/SecuredFields/utils';\nimport { notFalsy, reject } from '../../utils/commonUtils';\nimport { shouldIncludeInstallmentsInPaymentData } 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, PaymentMethodBrand } from '../../types/global-types';\nimport { TxVariants } from '../tx-variants';\nimport type { ComponentMethodsRef, UIElementStatus } from '../internal/UIElement/types';\nimport UIElement from '../internal/UIElement';\nimport PayButton from '../internal/PayButton';\nimport type { ICore } from '../../core/types';\nimport AdyenCheckoutError, { IMPLEMENTATION_ERROR } from '../../core/Errors/AdyenCheckoutError';\nimport CardInputDefaultProps from './components/CardInput/defaultProps';\nimport { PayButtonProps } from '../internal/PayButton/PayButton';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../core/Analytics/events/AnalyticsInfoEvent';\nimport { InstallmentOptions } from './components/CardInput/components/Installments/Installments';\n\nexport class CardElement extends UIElement<CardConfiguration> {\n public static readonly type: TxVariants = TxVariants.scheme;\n\n private readonly clickToPayService: IClickToPayService | null;\n\n /**\n * Reference to the 'ClickToPayComponent'\n */\n private clickToPayRef: ComponentMethodsRef | null = null;\n\n constructor(checkout: ICore, props?: CardConfiguration) {\n super(checkout, props);\n\n if (props && !props._disableClickToPay && this.props.fundingSource !== 'prepaid') {\n this.clickToPayService = createClickToPayService(\n this.props.configuration,\n this.props.clickToPayConfiguration,\n this.props.environment,\n this.analytics\n );\n\n void this.clickToPayService?.initialize();\n }\n }\n\n protected static readonly defaultProps = {\n showFormInstruction: true,\n _disableClickToPay: false,\n doBinLookup: true,\n // Merge most of CardInput's defaultProps\n ...reject(['type', 'setComponentRef']).from(CardInputDefaultProps)\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);\n }\n return this;\n }\n\n private readonly setClickToPayRef = (ref: ComponentMethodsRef) => {\n this.clickToPayRef = ref;\n };\n\n // This is the most self contained way of handling funding source matching\n // Alternatives would be to override getPaymentMethodConfigFromResponse and change it's signature\n protected override getPaymentMethodConfigFromResponse(componentProps: CardConfiguration) {\n if (componentProps?.fundingSource) {\n return this.core.paymentMethodsResponse?.findByFundingSource(componentProps.type, componentProps.fundingSource);\n }\n\n return super.getPaymentMethodConfigFromResponse(componentProps);\n }\n\n formatProps(props: CardConfiguration): 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 // Take the configuration set on the card component - which is either merchant defined or default (empty object)\n // @ts-ignore 'installmentOptions' is optional on CardConfiguration (the merchant-facing type), but by this point\n // UIElement.buildElementProps has already merged CardInputDefaultProps.installmentOptions ({}) into props\n // before formatProps() is called, so the value is always defined here.\n const merchantInstallmentOptions: InstallmentOptions = props.installmentOptions;\n\n if (props.session && notFalsy(merchantInstallmentOptions)) {\n console.warn(\n 'WARNING: You have defined installments configuration on the Card component, but you are using a /sessions integration.\\nWith this integration, installments configuration must be defined when you create the session. Any configuration defined elsewhere will be ignored.\\n\\n'\n );\n }\n\n // In a session scenario, only the session's own installments configuration is used; otherwise fall back to the merchant configuration / default\n const shownInstallmentOptions: InstallmentOptions = props.session\n ? (props.session?.configuration?.installmentOptions ?? CardInputDefaultProps.installmentOptions)\n : merchantInstallmentOptions;\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 // edge case where merchant has defined both an onAddressLookup callback AND set billingAddressMode: 'partial' - which leads to some strange behaviour in the address UI\n billingAddressMode: props.onAddressLookup ? CardInputDefaultProps.billingAddressMode : props.billingAddressMode,\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: shownInstallmentOptions,\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 && {\n storedPaymentMethodId: this.props.storedPaymentMethodId,\n holderName: this.props.holderName ?? ''\n }),\n ...(cardBrand && { brand: cardBrand }),\n ...(this.props.fundingSource && { fundingSource: this.props.fundingSource }),\n ...(this.state.fastlaneData && { fastlaneData: btoa(JSON.stringify(this.state.fastlaneData)) })\n },\n ...(this.state.billingAddress && { billingAddress: this.state.billingAddress }),\n ...(this.state.socialSecurityNumber && { socialSecurityNumber: this.state.socialSecurityNumber }),\n ...this.storePaymentMethodPayload,\n ...(shouldIncludeInstallmentsInPaymentData(this.state.installments) && { installments: this.state.installments }),\n browserInfo: this.browserInfo,\n origin: !!window && window.location.origin\n };\n }\n\n protected override beforeRender(configSetByMerchant?: CardConfiguration): void {\n // We don't send 'rendered' events when rendering actions\n if (configSetByMerchant?.originalAction) {\n return;\n }\n\n const event = new AnalyticsInfoEvent({\n type: InfoEventType.rendered,\n component: this.type,\n configData: { ...configSetByMerchant, showPayButton: this.props.showPayButton },\n ...(configSetByMerchant?.oneClick && {\n isStoredPaymentMethod: true,\n brand: configSetByMerchant.brand\n })\n });\n\n this.analytics.sendAnalytics(event);\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 | null, 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 readonly handleClickToPaySubmit = (payload: ClickToPayCheckoutPayload) => {\n this.setState({ data: { ...payload }, valid: {}, errors: {}, isValid: true });\n this.submit();\n };\n\n onBinLookup(obj: CardBinLookupData) {\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 private readonly onConfigSuccess = (obj: CardConfigSuccessData) => {\n const event = new AnalyticsInfoEvent({ component: this.type, type: InfoEventType.configured });\n this.submitAnalytics(event);\n\n this.props.onConfigSuccess?.(obj);\n };\n\n private readonly onFocus = (obj: ComponentFocusObject) => {\n const event = new AnalyticsInfoEvent({\n component: this.type,\n type: InfoEventType.focus,\n target: fieldTypeToSnakeCase(obj.fieldType) as UiTarget\n });\n this.submitAnalytics(event);\n\n // Call merchant defined callback\n if (isSecuredField(obj.fieldType)) {\n this.props.onFocus?.(obj.event as CardFocusData);\n } else {\n this.props.onFocus?.(obj);\n }\n };\n\n private readonly onBlur = (obj: ComponentFocusObject) => {\n const event = new AnalyticsInfoEvent({\n component: this.type,\n type: InfoEventType.unfocus,\n target: fieldTypeToSnakeCase(obj.fieldType) as UiTarget\n });\n this.submitAnalytics(event);\n\n // Call merchant defined callback\n if (isSecuredField(obj.fieldType)) {\n this.props.onBlur?.(obj.event as CardFocusData);\n } else {\n this.props.onBlur?.(obj);\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.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(): PaymentMethodBrand[] {\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\n protected override payButton = (props: PayButtonProps): h.JSX.Element => {\n const isZeroAuth = this.props.amount?.value === 0;\n const isStoredCard = this.props.storedPaymentMethodId?.length > 0;\n return (\n <PayButton\n {...props}\n label={isZeroAuth && !isStoredCard ? this.props.i18n.get('payButton.saveDetails') : ''}\n onClick={this.submit}\n showReview={!!this.props.onReview}\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 onSubmitAnalytics={this.submitAnalytics}\n onChange={this.setState}\n onSubmit={this.submit}\n handleKeyDown={this.handleKeyDown}\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 onConfigSuccess={this.onConfigSuccess}\n />\n );\n }\n\n protected override componentToRender(): h.JSX.Element {\n return (\n <ClickToPayWrapper\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 );\n }\n}\n\nexport default CardElement;\n"],"names":["CardElement","UIElement","setStatus","status","props","this","componentRef","clickToPayRef","getPaymentMethodConfigFromResponse","componentProps","fundingSource","core","paymentMethodsResponse","findByFundingSource","type","super","formatProps","enableStoreDetails","session","configuration","showStoreDetailsCheckbox","amount","value","storedCardID","storedPaymentMethodId","id","isEcommerceStoredCard","supportedShopperInteractions","includes","AdyenCheckoutError","IMPLEMENTATION_ERROR","merchantInstallmentOptions","installmentOptions","notFalsy","console","warn","shownInstallmentOptions","CardInputDefaultProps","holderNameRequired","hasHolderName","hasCVC","brand","hideCVC","billingAddressRequired","billingAddressMode","onAddressLookup","TxVariants","card","countryCode","toLowerCase","socialSecurityNumberMode","brandsConfiguration","icon","clickToPayConfiguration","disableOtpAutoFocus","shopperEmail","options","telephoneNumber","locale","i18n","replace","formatData","cardBrand","state","selectedBrandValue","paymentMethod","data","holderName","fastlaneData","btoa","JSON","stringify","billingAddress","socialSecurityNumber","storePaymentMethodPayload","shouldIncludeInstallmentsInPaymentData","installments","browserInfo","origin","window","location","beforeRender","configSetByMerchant","originalAction","event","AnalyticsInfoEvent","InfoEventType","rendered","component","configData","showPayButton","oneClick","isStoredPaymentMethod","analytics","sendAnalytics","updateStyles","stylesObj","setFocusOn","fieldName","processBinLookupResponse","binLookupResponse","isReset","handleUnsupportedCard","errObj","onBinLookup","obj","nuObj","reject","from","length","storePaymentMethod","Boolean","isValid","resources","getImage","brands","map","modules","name","displayName","lastFour","accessibleName","get","collectBrowserInfo","renderCardInput","isCardPrimaryInput","h","CardInput","setComponentRef","onSubmitAnalytics","submitAnalytics","onChange","setState","onSubmit","submit","handleKeyDown","payButton","onBrand","onBinValue","brandsIcons","isPayButtonPrimaryVariant","onFocus","onBlur","onConfigSuccess","componentToRender","ClickToPayWrapper","clickToPayService","isStandaloneComponent","setClickToPayRef","onSetStatus","setElementStatus","handleClickToPaySubmit","onError","handleError","constructor","checkout","_define_property","ref","payload","valid","errors","configured","focus","target","fieldTypeToSnakeCase","fieldType","isSecuredField","unfocus","triggerBinLookUp","isZeroAuth","isStoredCard","PayButton","label","onClick","showReview","onReview","_disableClickToPay","createClickToPayService","environment","initialize","scheme","defaultProps","showFormInstruction","doBinLookup"],"mappings":"6nCAwBO,MAAMA,UAAoBC,EAiCtBC,SAAAA,CAAUC,EAAyBC,GAOtC,OANIC,KAAKC,cAAcJ,WACnBG,KAAKC,aAAaJ,UAAUC,EAAQC,GAEpCC,KAAKE,eAAeL,WACpBG,KAAKE,cAAcL,UAAUC,GAE1BE,IACX,CAQmBG,kCAAAA,CAAmCC,GAClD,OAAIA,GAAgBC,cACTL,KAAKM,KAAKC,wBAAwBC,oBAAoBJ,EAAeK,KAAML,EAAeC,eAG9FK,MAAMP,mCAAmCC,EACpD,CAEAO,WAAAA,CAAYZ,GAER,MAAMa,EAAqBb,EAAMc,SAASC,eAAeF,oBAAsBb,EAAMa,mBAG/EG,IADqC,IAAxBhB,EAAMiB,QAA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e,cACXd,KAAKD,MAAMiD,wBACXhD,KAAKD,MAAM8K,YACX7K,KAAKwF,WAGJxF,KAAK6I,mBAAmBiC,aAErC,EAtBAvB,EADS5J,EACcc,OAAmBgC,EAAWsI,QAwBrDxB,EAzBS5J,EAyBiBqL,eAAe,CACrCC,qBAAqB,EACrBN,oBAAoB,EACpBO,aAAa,KAEV5E,EAAO,CAAC,OAAQ,oBAAoBC,KAAKvE"}
@@ -1,2 +1,2 @@
1
- import{createElement as e,Fragment as r}from"../../../../external/preact/dist/preact.js";import{useRef as t,useMemo as o,useState as n,useCallback as s,useEffect as a}from"../../../../external/preact/hooks/dist/hooks.js";import i from"../../../internal/SecuredFields/SFP/SecuredFieldsProvider.js";import l from"./defaultProps.js";import{AddressModeOptions as d}from"./types.js";import{ENCRYPTED_CARD_NUMBER as u,DATE_POLICY_REQUIRED as c,CVC_POLICY_REQUIRED as m}from"../../../internal/SecuredFields/lib/constants.js";import{cardInputValidationRules as p,getRuleByNameAndMode as y,cardInputFormatters as f}from"./validate.js";import h from"../../../internal/SecuredFields/binLookup/extensions.js";import b from"../../../../utils/useForm/useForm.js";import"../../../internal/SecuredFields/lib/CSF/utils/userAgent.js";import{handlePartialAddressMode as S,shouldShowInstallmentsComponent as g,extractPropsForCardFields as N,extractPropsForSFP as A,getLayout as C,requiresDualBrandSelection as F}from"./utils.js";import j from"../../../internal/Address/Specifications.js";import{StoredCardFieldsWrapper as v}from"./components/StoredCardFieldsWrapper.js";import{CardFieldsWrapper as w}from"./components/CardFieldsWrapper.js";import{getAutoJumpHandler as x,getFocusHandler as B,getAddressHandler as E}from"./handlers.js";import P from"../../../../_virtual/index.js";import{getPartialAddressValidationRules as k}from"../../../internal/Address/validate.js";import R from"../../../../core/Context/useImage.js";import{getArrayDifferences as I}from"../../../../utils/arrayUtils.js";import V from"../../../internal/FormInstruction/FormInstruction.js";import{PREFIX as D}from"../../../internal/Icon/constants.js";import O from"./useSRPanelForCardInputErrors.js";import q from"../Fastlane/FastlaneSignup.js";import{fieldTypeToSnakeCase as M}from"../../../internal/SecuredFields/utils.js";import{getErrorMessageFromCode as _}from"../../../../core/Errors/utils.js";import{SF_ErrorCodes as L}from"../../../../core/Errors/constants.js";import{usePrevious as T}from"../../../../utils/hookUtils.js";import{AnalyticsInfoEvent as K,InfoEventType as U,UiTarget as H}from"../../../../core/Analytics/events/AnalyticsInfoEvent.js";import{useAmount as z}from"../../../../core/Context/AmountProvider.js";import{DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM as W}from"../../constants.js";const $=l=>{const $=t(null),G=t(!1),J=R(),Q=t(null),X=e=>{Q.current=e},Y=t({});Object.keys(Y.current).length||l.setComponentRef(Y.current);const Z=t(0),ee=t(!1),re=o(()=>new j(l.specifications),[l.specifications]),{amount:te}=z();Y.current.sfp=$;const[oe,ne]=n("ready"),[se,ae]=n({}),[ie,le]=n({...l.holderNameRequired&&{holderName:!1}}),[de,ue]=n({...l.hasHolderName&&{holderName:l.data?.holderName??""}}),[ce,me]=n(""),[pe,ye]=n(!1),[fe,he]=n(c),[be,Se]=n(m),[ge,Ne]=n(null),[Ae,Ce]=n([]),[Fe,je]=n(l.storedPaymentMethodId?l.brand:""),ve=l.billingAddressMode!==d.none&&l.billingAddressRequired,we=S(l.billingAddressMode),xe=t(we&&l.data?.billingAddress?.country),[Be,Ee]=n(!1),[Pe,ke]=n(ve?l.data?.billingAddress??null:null),[Re,Ie]=n(!1),[Ve,De]=n(""),[Oe,qe]=n({value:null}),[Me,_e]=n(null),[Le,Te]=n("card"),[Ke,Ue]=n(!1),{handleChangeFor:He,triggerValidation:ze,data:We,valid:$e,errors:Ge,setSchema:Je,setData:Qe,setValid:Xe,setErrors:Ye}=b({schema:[],defaultData:l.data,formatters:f,rules:p}),Ze=g({installmentOptions:l.installmentOptions,fundingSource:l.fundingSource,amount:te}),er=l.showInstallmentAmounts??!0,rr="kr"===(ge??l.countryCode),tr=!!l.configuration.koreanAuthenticationRequired&&rr,or=Re&&"auto"===l.configuration.socialSecurityNumberMode||"show"===l.configuration.socialSecurityNumberMode,nr=(e,r)=>{l.onFocus({fieldType:e,event:r})},sr=(e,r)=>{l.onBlur({fieldType:e,event:r})},ar=s(e=>{Te(e.brand),l.onBrand(e)},[]),ir=B(me,nr,sr),lr=()=>C({props:l,showKCP:tr,showBrazilianSSN:or,...l.billingAddressRequired&&{countrySpecificSchemas:re.getAddressSchemaForCountry(Pe?.country),billingAddressRequiredFields:l.billingAddressRequiredFields}}),dr=s(e=>{const r="webInternalElement"!==e.fieldType?e.fieldType:e.name;_e(r)},[]),ur=E(Qe,Xe,Ye),cr=x(ee,$,lr()),mr=s(e=>{pr(e)},[Ke,Ue]),pr=e=>{e.status&&("loading"==e.status?Ue(!1):Ue(!0))},yr=o(()=>h(l,{sfp:$},{dualBrandSelectElements:Ae,setDualBrandSelectElements:Ce,setSelectedBrandValue:je,issuingCountryCode:ge,setIssuingCountryCode:Ne},Z),[Ae,ge]);Y.current.showValidation=()=>{G.current=!0,br?.(),$.current.showValidation(),ze(["holderName","socialSecurityNumber","taxNumber"]),Q?.current&&Q.current.showValidation()},Y.current.processBinLookupResponse=(e,r)=>{yr.processBinLookup(e,r)},Y.current.setStatus=ne,a(()=>(Y.current.setFocusOn=$.current.setFocusOn,Y.current.updateStyles=$.current.updateStyles,Y.current.handleUnsupportedCard=$.current.handleUnsupportedCard,()=>{$.current.destroy()}),[]),a(()=>{const e=[...l.hasHolderName?["holderName"]:[],...or?["socialSecurityNumber"]:[],...tr?["taxNumber"]:[],...ve?["billingAddress"]:[]];Je(e)},[l.hasHolderName,or,tr]),a(()=>{ue({...de,holderName:We.holderName??"",taxNumber:We.taxNumber}),De(We.socialSecurityNumber),ve&&ke({...We.billingAddress}),le({...ie,holderName:!l.holderNameRequired||$e.holderName,socialSecurityNumber:!!$e.socialSecurityNumber&&$e.socialSecurityNumber,taxNumber:!!$e.taxNumber&&$e.taxNumber,billingAddress:!!$e.billingAddress&&$e.billingAddress});const e=!!Ge.billingAddress&&Object.entries(Ge.billingAddress).reduce((e,[,r])=>e||null!=r,!1);ae({...se,holderName:l.holderNameRequired&&Ge.holderName?Ge.holderName:null,socialSecurityNumber:or&&Ge.socialSecurityNumber?Ge.socialSecurityNumber:null,taxNumber:tr&&Ge.taxNumber?Ge.taxNumber:null,billingAddress:ve&&e?Ge.billingAddress:null})},[We,$e,Ge]);const{sortedErrorList:fr,previousSortedErrors:hr,clearSRPanel:br}=O({errors:se,props:l,isValidating:G,retrieveLayout:lr,specifications:re,billingAddress:Pe,sfp:$});a(()=>{if(fr){const e=I(fr,hr,"field");e?.forEach(e=>{const r=new K({component:l.type,type:U.validationError,target:M(e.field),validationErrorCode:e.errorCode,validationErrorMessage:_(e.errorCode,L)});l.onSubmitAnalytics(r)})}},[fr]),a(()=>{const e=!!ie.holderName,r=pe,t=!ve||!!ie.billingAddress,o=!tr||!!ie.taxNumber&&!!ie.encryptedPassword,n=!or||!!ie.socialSecurityNumber,s=r&&e&&t&&o&&n,a=$.current.mapErrorsToValidationRuleResult(),i={...se,...a};l.onChange({data:de,valid:ie,errors:i,isValid:s,billingAddress:Pe,selectedBrandValue:Fe,storePaymentMethod:Be,socialSecurityNumber:Ve,installments:Oe})},[de,ie,se,Fe,Be,Oe]),a(()=>{if(Ae.length>0&&Ae){const e=Ae.map(e=>e.id),r=e[0],t=e.toString();if(!!Ae&&F(W,Ae,"id")){const e=new K({component:l.type,type:U.displayed,target:H.dualBrandButton,brand:r,configData:{dualBrands:t}});l.onSubmitAnalytics(e)}}},[Ae]);const Sr=T(Fe);a(()=>{if(Sr?.length&&Fe?.length){const e=new K({component:l.type,type:U.selected,target:H.dualBrandButton,brand:Fe});l.onSubmitAnalytics(e)}},[Fe]);const gr=l.storedPaymentMethodId?v:w;return e(r,null,e(i,{ref:$,...A(l),styles:{...l.styles},koreanAuthenticationRequired:l.configuration.koreanAuthenticationRequired,hasKoreanFields:!(!l.configuration.koreanAuthenticationRequired||"kr"!==l.countryCode),onSubmitAnalytics:l.onSubmitAnalytics,onChange:(e,r)=>{if(e.autoCompleteName){if(!l.hasHolderName)return;const r=y("holderName","blur"),t=r?.(e.autoCompleteName,null)?e.autoCompleteName:null;return void(t&&(Qe("holderName",t),Xe("holderName",!0),Ye("holderName",null)))}var t;l.autoFocus&&Z.current>0&&"handleOnFieldValid"===r?.event&&r?.fieldType===u&&e.valid.encryptedCardNumber&&cr(),ue({...de,...e.data}),ae({...se,...(t=e.errors,t?{encryptedCardNumber:!!t.encryptedCardNumber,encryptedExpiryDate:!!t.encryptedExpiryDate,encryptedSecurityCode:!!t.encryptedSecurityCode,encryptedPassword:!!t.encryptedPassword}:{})}),le({...ie,...e.valid}),ye(e.isSfpValid),Se(e.cvcPolicy),Ie(e.showSocialSecurityNumber),he(e.expiryDatePolicy)},onBrand:ar,onFocus:ir,onStateUpdate:mr,type:l.brand,componentType:l.type,disableIOSArrowKeys:l.disableIOSArrowKeys?dr:null,render:({setRootNode:r,setFocusOn:t},o)=>e("div",{ref:r,className:P({"adyen-checkout__card-input":!0,"adyen-checkout-card-input__wrapper":!0,[`adyen-checkout__card-input--${l.fundingSource??"credit"}`]:!0,"adyen-checkout__card-input--loading":"loading"===oe}),role:"form"},Ke&&e(V,null),e(gr,{...N(l),data:de,valid:ie,errors:se,handleChangeFor:He,focusedElement:ce,setFocusOn:t,sfpState:o,cvcPolicy:be,hasInstallments:Ze,showAmountsInInstallments:er,handleInstallments:qe,brandsIcons:l.brandsIcons,formData:We,formErrors:Ge,formValid:$e,expiryDatePolicy:fe,dualBrandSelectElements:Ae,extensions:yr,selectedBrandValue:Fe,showKCP:tr,showBrazilianSSN:or,socialSecurityNumber:Ve,handleOnStoreDetails:Ee,setAddressRef:X,billingAddress:Pe,billingAddressValidationRules:we&&k(xe.current),partialAddressSchema:we,handleAddress:ur,onAddressLookup:l.onAddressLookup,onAddressSelected:l.onAddressSelected,addressSearchDebounceMs:l.addressSearchDebounceMs,iOSFocusedField:Me,onFieldFocusAnalytics:nr,onFieldBlurAnalytics:sr}))}),l.fastlaneConfiguration&&e(q,{...l.fastlaneConfiguration,currentDetectedBrand:Le,onChange:l.onChange,onSubmitAnalytics:l.onSubmitAnalytics,type:l.type}),Ke&&l.showPayButton&&l.payButton({status:oe,variant:l.isPayButtonPrimaryVariant?"primary":"secondary",icon:J({imageFolder:"components/"})(`${D}lock`)}))};$.defaultProps=l;export{$ as default};
1
+ import{createElement as e,Fragment as r}from"../../../../external/preact/dist/preact.js";import{useRef as t,useMemo as o,useState as n,useCallback as s,useEffect as a}from"../../../../external/preact/hooks/dist/hooks.js";import i from"../../../internal/SecuredFields/SFP/SecuredFieldsProvider.js";import l from"./defaultProps.js";import{AddressModeOptions as d}from"./types.js";import{ENCRYPTED_CARD_NUMBER as u,DATE_POLICY_REQUIRED as c,CVC_POLICY_REQUIRED as m}from"../../../internal/SecuredFields/lib/constants.js";import{cardInputValidationRules as p,getRuleByNameAndMode as y,cardInputFormatters as f}from"./validate.js";import h from"../../../internal/SecuredFields/binLookup/extensions.js";import b from"../../../../utils/useForm/useForm.js";import"../../../internal/SecuredFields/lib/CSF/utils/userAgent.js";import{handlePartialAddressMode as S,shouldShowInstallmentsComponent as g,extractPropsForCardFields as N,extractPropsForSFP as A,getLayout as C,requiresDualBrandSelection as F}from"./utils.js";import j from"../../../internal/Address/Specifications.js";import{StoredCardFieldsWrapper as v}from"./components/StoredCardFieldsWrapper.js";import{CardFieldsWrapper as w}from"./components/CardFieldsWrapper.js";import{getAutoJumpHandler as x,getFocusHandler as B,getAddressHandler as E}from"./handlers.js";import P from"../../../../_virtual/index.js";import{getPartialAddressValidationRules as k}from"../../../internal/Address/validate.js";import R from"../../../../core/Context/useImage.js";import{getArrayDifferences as I}from"../../../../utils/arrayUtils.js";import V from"../../../internal/FormInstruction/FormInstruction.js";import{PREFIX as D}from"../../../internal/Icon/constants.js";import O from"./useSRPanelForCardInputErrors.js";import q from"../Fastlane/FastlaneSignup.js";import{fieldTypeToSnakeCase as M}from"../../../internal/SecuredFields/utils.js";import{getErrorMessageFromCode as _}from"../../../../core/Errors/utils.js";import{SF_ErrorCodes as L}from"../../../../core/Errors/constants.js";import{usePrevious as T}from"../../../../utils/hookUtils.js";import{AnalyticsInfoEvent as U,InfoEventType as K,UiTarget as H}from"../../../../core/Analytics/events/AnalyticsInfoEvent.js";import{useAmount as z}from"../../../../core/Context/AmountProvider.js";import{DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM as W}from"../../constants.js";const $=l=>{const $=t(null),G=t(!1),J=R(),Q=t(null),X=e=>{Q.current=e},Y=t({});Object.keys(Y.current).length||l.setComponentRef(Y.current);const Z=t(0),ee=t(!1),re=o(()=>new j(l.specifications),[l.specifications]),{amount:te}=z();Y.current.sfp=$;const[oe,ne]=n("ready"),[se,ae]=n({}),[ie,le]=n({...l.holderNameRequired&&{holderName:!1}}),[de,ue]=n({...l.hasHolderName&&{holderName:l.data?.holderName??""}}),[ce,me]=n(""),[pe,ye]=n(!1),[fe,he]=n(c),[be,Se]=n(m),[ge,Ne]=n(null),[Ae,Ce]=n([]),[Fe,je]=n(l.storedPaymentMethodId?l.brand:""),ve=l.billingAddressMode!==d.none&&l.billingAddressRequired,we=S(l.billingAddressMode),xe=l.data?.billingAddress??null,Be=t(we?xe?.country?.toUpperCase()??null:null),[Ee,Pe]=n(!1),[ke,Re]=n(ve?xe:null),[Ie,Ve]=n(!1),[De,Oe]=n(""),[qe,Me]=n({value:null}),[_e,Le]=n(null),[Te,Ue]=n("card"),[Ke,He]=n(!1),{handleChangeFor:ze,triggerValidation:We,data:$e,valid:Ge,errors:Je,setSchema:Qe,setData:Xe,setValid:Ye,setErrors:Ze}=b({schema:[],defaultData:l.data,formatters:f,rules:p}),er=g({installmentOptions:l.installmentOptions,fundingSource:l.fundingSource,amount:te}),rr=l.showInstallmentAmounts??!0,tr="kr"===(ge??l.countryCode),or=!!l.configuration.koreanAuthenticationRequired&&tr,nr=Ie&&"auto"===l.configuration.socialSecurityNumberMode||"show"===l.configuration.socialSecurityNumberMode,sr=(e,r)=>{l.onFocus({fieldType:e,event:r})},ar=(e,r)=>{l.onBlur({fieldType:e,event:r})},ir=s(e=>{Ue(e.brand),l.onBrand(e)},[]),lr=B(me,sr,ar),dr=()=>C({props:l,showKCP:or,showBrazilianSSN:nr,...l.billingAddressRequired&&{countrySpecificSchemas:re.getAddressSchemaForCountry(ke?.country),billingAddressRequiredFields:l.billingAddressRequiredFields}}),ur=s(e=>{const r="webInternalElement"!==e.fieldType?e.fieldType:e.name;Le(r)},[]),cr=E(Xe,Ye,Ze),mr=x(ee,$,dr()),pr=s(e=>{yr(e)},[Ke,He]),yr=e=>{e.status&&("loading"==e.status?He(!1):He(!0))},fr=o(()=>h(l,{sfp:$},{dualBrandSelectElements:Ae,setDualBrandSelectElements:Ce,setSelectedBrandValue:je,issuingCountryCode:ge,setIssuingCountryCode:Ne},Z),[Ae,ge]);Y.current.showValidation=()=>{G.current=!0,Sr?.(),$.current.showValidation(),We(["holderName","socialSecurityNumber","taxNumber"]),Q?.current&&Q.current.showValidation()},Y.current.processBinLookupResponse=(e,r)=>{fr.processBinLookup(e,r)},Y.current.setStatus=ne,a(()=>(Y.current.setFocusOn=$.current.setFocusOn,Y.current.updateStyles=$.current.updateStyles,Y.current.handleUnsupportedCard=$.current.handleUnsupportedCard,()=>{$.current.destroy()}),[]),a(()=>{const e=[...l.hasHolderName?["holderName"]:[],...nr?["socialSecurityNumber"]:[],...or?["taxNumber"]:[],...ve?["billingAddress"]:[]];Qe(e)},[l.hasHolderName,nr,or]),a(()=>{ue({...de,holderName:$e.holderName??"",taxNumber:$e.taxNumber}),Oe($e.socialSecurityNumber),ve&&Re({...$e.billingAddress}),le({...ie,holderName:!l.holderNameRequired||Ge.holderName,socialSecurityNumber:!!Ge.socialSecurityNumber&&Ge.socialSecurityNumber,taxNumber:!!Ge.taxNumber&&Ge.taxNumber,billingAddress:!!Ge.billingAddress&&Ge.billingAddress});const e=!!Je.billingAddress&&Object.entries(Je.billingAddress).reduce((e,[,r])=>e||null!=r,!1);ae({...se,holderName:l.holderNameRequired&&Je.holderName?Je.holderName:null,socialSecurityNumber:nr&&Je.socialSecurityNumber?Je.socialSecurityNumber:null,taxNumber:or&&Je.taxNumber?Je.taxNumber:null,billingAddress:ve&&e?Je.billingAddress:null})},[$e,Ge,Je]);const{sortedErrorList:hr,previousSortedErrors:br,clearSRPanel:Sr}=O({errors:se,props:l,isValidating:G,retrieveLayout:dr,specifications:re,billingAddress:ke,sfp:$});a(()=>{if(hr){const e=I(hr,br,"field");e?.forEach(e=>{const r=new U({component:l.type,type:K.validationError,target:M(e.field),validationErrorCode:e.errorCode,validationErrorMessage:_(e.errorCode,L)});l.onSubmitAnalytics(r)})}},[hr]),a(()=>{const e=!!ie.holderName,r=pe,t=!ve||!!ie.billingAddress,o=!or||!!ie.taxNumber&&!!ie.encryptedPassword,n=!nr||!!ie.socialSecurityNumber,s=r&&e&&t&&o&&n,a=$.current.mapErrorsToValidationRuleResult(),i={...se,...a};l.onChange({data:de,valid:ie,errors:i,isValid:s,billingAddress:ke,selectedBrandValue:Fe,storePaymentMethod:Ee,socialSecurityNumber:De,installments:qe})},[de,ie,se,Fe,Ee,qe]),a(()=>{if(Ae.length>0&&Ae){const e=Ae.map(e=>e.id),r=e[0],t=e.toString();if(!!Ae&&F(W,Ae,"id")){const e=new U({component:l.type,type:K.displayed,target:H.dualBrandButton,brand:r,configData:{dualBrands:t}});l.onSubmitAnalytics(e)}}},[Ae]);const gr=T(Fe);a(()=>{if(gr?.length&&Fe?.length){const e=new U({component:l.type,type:K.selected,target:H.dualBrandButton,brand:Fe});l.onSubmitAnalytics(e)}},[Fe]);const Nr=l.storedPaymentMethodId?v:w;return e(r,null,e(i,{ref:$,...A(l),styles:{...l.styles},koreanAuthenticationRequired:l.configuration.koreanAuthenticationRequired,hasKoreanFields:!(!l.configuration.koreanAuthenticationRequired||"kr"!==l.countryCode),onSubmitAnalytics:l.onSubmitAnalytics,onChange:(e,r)=>{if(e.autoCompleteName){if(!l.hasHolderName)return;const r=y("holderName","blur"),t=r?.(e.autoCompleteName,null)?e.autoCompleteName:null;return void(t&&(Xe("holderName",t),Ye("holderName",!0),Ze("holderName",null)))}var t;l.autoFocus&&Z.current>0&&"handleOnFieldValid"===r?.event&&r?.fieldType===u&&e.valid.encryptedCardNumber&&mr(),ue({...de,...e.data}),ae({...se,...(t=e.errors,t?{encryptedCardNumber:!!t.encryptedCardNumber,encryptedExpiryDate:!!t.encryptedExpiryDate,encryptedSecurityCode:!!t.encryptedSecurityCode,encryptedPassword:!!t.encryptedPassword}:{})}),le({...ie,...e.valid}),ye(e.isSfpValid),Se(e.cvcPolicy),Ve(e.showSocialSecurityNumber),he(e.expiryDatePolicy)},onBrand:ir,onFocus:lr,onStateUpdate:pr,type:l.brand,componentType:l.type,disableIOSArrowKeys:l.disableIOSArrowKeys?ur:null,render:({setRootNode:r,setFocusOn:t},o)=>e("div",{ref:r,className:P({"adyen-checkout__card-input":!0,"adyen-checkout-card-input__wrapper":!0,[`adyen-checkout__card-input--${l.fundingSource??"credit"}`]:!0,"adyen-checkout__card-input--loading":"loading"===oe}),role:"form"},Ke&&e(V,null),e(Nr,{...N(l),data:de,valid:ie,errors:se,handleChangeFor:ze,focusedElement:ce,setFocusOn:t,sfpState:o,cvcPolicy:be,hasInstallments:er,showAmountsInInstallments:rr,handleInstallments:Me,brandsIcons:l.brandsIcons,formData:$e,formErrors:Je,formValid:Ge,expiryDatePolicy:fe,dualBrandSelectElements:Ae,extensions:fr,selectedBrandValue:Fe,showKCP:or,showBrazilianSSN:nr,socialSecurityNumber:De,handleOnStoreDetails:Pe,setAddressRef:X,billingAddress:ke,billingAddressValidationRules:we&&k(Be.current),partialAddressSchema:we,handleAddress:cr,onAddressLookup:l.onAddressLookup,onAddressSelected:l.onAddressSelected,addressSearchDebounceMs:l.addressSearchDebounceMs,iOSFocusedField:_e,onFieldFocusAnalytics:sr,onFieldBlurAnalytics:ar}))}),l.fastlaneConfiguration&&e(q,{...l.fastlaneConfiguration,currentDetectedBrand:Te,onChange:l.onChange,onSubmitAnalytics:l.onSubmitAnalytics,type:l.type}),Ke&&l.showPayButton&&l.payButton({status:oe,variant:l.isPayButtonPrimaryVariant?"primary":"secondary",icon:J({imageFolder:"components/"})(`${D}lock`)}))};$.defaultProps=l;export{$ 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, ENCRYPTED_CARD_NUMBER } from '../../../internal/SecuredFields/lib/constants';\nimport { BinLookupResponse, DualBrandSelectElement } from '../../types';\nimport { cardInputFormatters, cardInputValidationRules, getRuleByNameAndMode } from './validate';\nimport CIExtensions from '../../../internal/SecuredFields/binLookup/extensions';\nimport useForm from '../../../../utils/useForm';\nimport { SortedErrorObject } from '../../../../core/Errors/types';\nimport {\n handlePartialAddressMode,\n extractPropsForCardFields,\n extractPropsForSFP,\n getLayout,\n shouldShowInstallmentsComponent,\n requiresDualBrandSelection\n} from './utils';\nimport Specifications from '../../../internal/Address/Specifications';\nimport { StoredCardFieldsWrapper } from './components/StoredCardFieldsWrapper';\nimport { CardFieldsWrapper } from './components/CardFieldsWrapper';\nimport { getAddressHandler, getAutoJumpHandler, getFocusHandler } from './handlers';\nimport { InstallmentsState } from './components/Installments/Installments';\nimport { TouchStartEventObj } from './components/types';\nimport classNames from 'classnames';\nimport { getPartialAddressValidationRules } from '../../../internal/Address/validate';\nimport useImage from '../../../../core/Context/useImage';\nimport { getArrayDifferences } from '../../../../utils/arrayUtils';\nimport FormInstruction from '../../../internal/FormInstruction';\nimport { AddressData } from '../../../../types/global-types';\nimport { CardBrandData, CardFocusData } from '../../../internal/SecuredFields/lib/types';\nimport { PREFIX } from '../../../internal/Icon/constants';\nimport useSRPanelForCardInputErrors from './useSRPanelForCardInputErrors';\nimport FastlaneSignup from '../Fastlane/FastlaneSignup';\nimport { fieldTypeToSnakeCase } from '../../../internal/SecuredFields/utils';\nimport { getErrorMessageFromCode } from '../../../../core/Errors/utils';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\nimport { usePrevious } from '../../../../utils/hookUtils';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../../../core/Analytics/events/AnalyticsInfoEvent';\nimport { useAmount } from '../../../../core/Context/AmountProvider';\nimport { DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM } from '../../constants';\n\nconst CardInput = (props: Readonly<CardInputProps>) => {\n const sfp = useRef<SecuredFieldsProvider>(null);\n const isValidating = useRef(false);\n const getImage = useImage();\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 const { amount } = useAmount();\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 [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<DualBrandSelectElement[]>([]);\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) : null);\n const [showSocialSecurityNumber, setShowSocialSecurityNumber] = useState(false);\n const [socialSecurityNumber, setSocialSecurityNumber] = useState('');\n const [installments, setInstallments] = useState<InstallmentsState>({ 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 * This stores the brand as detected by the internal regEx.\n * It eventually gets overwritten by the brand as detected by the /binLookup, but will revert back to the regEx detection\n * if the PAN length drops below the /binLookup digit threshold.\n * Default value, 'card', indicates no brand detected\n */\n const [internallyDetectedBrand, setInternallyDetectedBrand] = useState('card');\n\n /**\n * Used tho show and hide the pay button and instructions text\n * Should mimic the same logic as CardInput loading wrapper\n */\n const [showCardUIElements, setShowCardUIElements] = useState(false);\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 = shouldShowInstallmentsComponent({\n installmentOptions: props.installmentOptions,\n fundingSource: props.fundingSource,\n amount\n });\n\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 | CardFocusData) => {\n props.onFocus({ fieldType: who, event: e });\n };\n const onFieldBlurAnalytics = (who: string, e: Event | CardFocusData) => {\n props.onBlur({ fieldType: who, event: e });\n };\n\n const onBrand = useCallback((obj: CardBrandData) => {\n setInternallyDetectedBrand(obj.brand);\n props.onBrand(obj);\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 mapSfpErrorsToCardInputErrors = (sfpErrors: SFPState['errors']): Partial<CardInputErrorState> => {\n if (!sfpErrors) return {};\n\n return {\n encryptedCardNumber: !!sfpErrors.encryptedCardNumber,\n encryptedExpiryDate: !!sfpErrors.encryptedExpiryDate,\n encryptedSecurityCode: !!sfpErrors.encryptedSecurityCode,\n encryptedPassword: !!sfpErrors.encryptedPassword\n };\n };\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, null) ? 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, ...mapSfpErrorsToCardInputErrors(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 /**\n * Listen to the full SecureFieldsProvider state and handle actions\n * Used right now to mimic the loading status changes, this can only be done this way\n * Trying to do it via onConfiguSuccess or onChange has side effects\n */\n const handleSFPStateUpdate = useCallback(\n sfpState => {\n mimicLoadingStatusChange(sfpState);\n },\n [showCardUIElements, setShowCardUIElements]\n );\n\n /**\n * This function implements the same logic that LoadingProvider uses to show and hide elements\n * We want to mimic this behavior so we can hide and show the pay button or the instructions text\n * Deciding to do it this way since we garante there's no DOM changes to merchants\n * We can break this in the next major version (v7)\n */\n const mimicLoadingStatusChange = (sfpState: SFPState) => {\n if (!sfpState.status) return;\n if (sfpState.status == 'loading') {\n setShowCardUIElements(false);\n } else {\n setShowCardUIElements(true);\n }\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 // Use the custom hook to set (or clear) errors in the SRPanel\n const {\n sortedErrorList: currentErrorsSortedByLayout,\n previousSortedErrors,\n clearSRPanel\n } = useSRPanelForCardInputErrors({\n errors,\n props,\n isValidating,\n retrieveLayout,\n specifications,\n billingAddress,\n sfp\n });\n\n // Analytics: ValidationErrors\n useEffect(() => {\n if (currentErrorsSortedByLayout) {\n const newErrors = getArrayDifferences<SortedErrorObject, string>(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n\n newErrors?.forEach(errorItem => {\n const event = new AnalyticsInfoEvent({\n component: props.type,\n type: InfoEventType.validationError,\n target: fieldTypeToSnakeCase(errorItem.field) as UiTarget,\n validationErrorCode: errorItem.errorCode,\n validationErrorMessage: getErrorMessageFromCode(errorItem.errorCode, SF_ErrorCodes)\n });\n props.onSubmitAnalytics(event);\n });\n }\n }, [currentErrorsSortedByLayout]);\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 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 * \"Update\" handler related to dual brand buttons being initially displayed\n */\n useEffect(() => {\n if (dualBrandSelectElements.length > 0 && dualBrandSelectElements) {\n const dualBrandsArr: string[] = dualBrandSelectElements.map(item => item.id);\n const brand = dualBrandsArr[0]; // initially selected brand\n const dualBrands = dualBrandsArr.toString();\n\n const showDualBrandSelector = dualBrandSelectElements\n ? requiresDualBrandSelection(DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM, dualBrandSelectElements, 'id')\n : false;\n\n // Only send analytics event about displaying dualBrand selector for countries that need to show a selection mechanism\n if (showDualBrandSelector) {\n const event = new AnalyticsInfoEvent({\n component: props.type,\n type: InfoEventType.displayed,\n target: UiTarget.dualBrandButton,\n brand,\n configData: { dualBrands }\n });\n\n props.onSubmitAnalytics(event);\n }\n }\n }, [dualBrandSelectElements]);\n\n const previousSelectedBrandValue = usePrevious(selectedBrandValue);\n\n /**\n * \"Update\" handler related to a dual brand button being selected\n */\n useEffect(() => {\n if (previousSelectedBrandValue?.length && selectedBrandValue?.length) {\n const event = new AnalyticsInfoEvent({\n component: props.type,\n type: InfoEventType.selected,\n target: UiTarget.dualBrandButton,\n brand: selectedBrandValue\n });\n\n props.onSubmitAnalytics(event);\n }\n }, [selectedBrandValue]);\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 onSubmitAnalytics={props.onSubmitAnalytics}\n onChange={handleSecuredFieldsChange}\n onBrand={onBrand}\n onFocus={handleFocus}\n onStateUpdate={handleSFPStateUpdate}\n type={props.brand}\n componentType={props.type}\n disableIOSArrowKeys={props.disableIOSArrowKeys ? handleTouchstartIOS : null}\n render={({ setRootNode, setFocusOn }, sfpState: 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 {showCardUIElements && <FormInstruction />}\n\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\n {props.fastlaneConfiguration && (\n <FastlaneSignup\n {...props.fastlaneConfiguration}\n currentDetectedBrand={internallyDetectedBrand}\n onChange={props.onChange}\n onSubmitAnalytics={props.onSubmitAnalytics}\n type={props.type}\n />\n )}\n\n {showCardUIElements &&\n props.showPayButton &&\n props.payButton({\n status,\n variant: props.isPayButtonPrimaryVariant ? 'primary' : 'secondary',\n icon: getImage({ imageFolder: 'components/' })(`${PREFIX}lock`)\n })}\n </Fragment>\n );\n};\n\nCardInput.defaultProps = defaultProps;\n\nexport default CardInput;\n"],"names":["CardInput","props","sfp","useRef","isValidating","getImage","useImage","billingAddressRef","setAddressRef","ref","current","cardInputRef","Object","keys","length","setComponentRef","hasPanLengthRef","isAutoJumping","specifications","useMemo","Specifications","amount","useAmount","status","setStatus","useState","errors","setErrors","valid","setValid","holderNameRequired","holderName","data","setData","hasHolderName","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","internallyDetectedBrand","setInternallyDetectedBrand","showCardUIElements","setShowCardUIElements","handleChangeFor","triggerValidation","formData","formValid","formErrors","setSchema","setFormData","setFormValid","setFormErrors","useForm","schema","defaultData","formatters","cardInputFormatters","rules","cardInputValidationRules","hasInstallments","shouldShowInstallmentsComponent","installmentOptions","fundingSource","showAmountsInInstallments","showInstallmentAmounts","isKorea","countryCode","showKCP","configuration","koreanAuthenticationRequired","showBrazilianSSN","socialSecurityNumberMode","onFieldFocusAnalytics","who","e","onFocus","fieldType","event","onFieldBlurAnalytics","onBlur","onBrand","useCallback","obj","handleFocus","getFocusHandler","retrieveLayout","getLayout","countrySpecificSchemas","getAddressSchemaForCountry","billingAddressRequiredFields","handleTouchstartIOS","elementType","name","handleAddress","getAddressHandler","doPanAutoJump","getAutoJumpHandler","handleSFPStateUpdate","sfpState","mimicLoadingStatusChange","extensions","CIExtensions","showValidation","clearSRPanel","processBinLookupResponse","binLookupResponse","isReset","processBinLookup","useEffect","setFocusOn","updateStyles","handleUnsupportedCard","destroy","newSchema","taxNumber","addressHasErrors","entries","reduce","acc","error","sortedErrorList","currentErrorsSortedByLayout","previousSortedErrors","useSRPanelForCardInputErrors","newErrors","getArrayDifferences","forEach","errorItem","AnalyticsInfoEvent","component","type","InfoEventType","validationError","target","fieldTypeToSnakeCase","field","validationErrorCode","errorCode","validationErrorMessage","getErrorMessageFromCode","SF_ErrorCodes","onSubmitAnalytics","holderNameValid","sfpValid","addressValid","koreanAuthentication","encryptedPassword","socialSecurityNumberValid","isValid","sfStateErrorsObj","mapErrorsToValidationRuleResult","mergedErrors","onChange","dualBrandsArr","map","item","id","dualBrands","toString","requiresDualBrandSelection","DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM","displayed","UiTarget","dualBrandButton","configData","previousSelectedBrandValue","usePrevious","selected","FieldToRender","StoredCardFieldsWrapper","CardFieldsWrapper","h","Fragment","SecuredFieldsProvider","extractPropsForSFP","styles","hasKoreanFields","sfState","eventDetails","autoCompleteName","holderNameValidationFn","getRuleByNameAndMode","acHolderName","sfpErrors","autoFocus","ENCRYPTED_CARD_NUMBER","encryptedCardNumber","encryptedExpiryDate","encryptedSecurityCode","onStateUpdate","componentType","disableIOSArrowKeys","render","setRootNode","div","className","classNames","role","FormInstruction","extractPropsForCardFields","handleInstallments","brandsIcons","handleOnStoreDetails","billingAddressValidationRules","getPartialAddressValidationRules","onAddressLookup","onAddressSelected","addressSearchDebounceMs","fastlaneConfiguration","FastlaneSignup","currentDetectedBrand","showPayButton","payButton","variant","isPayButtonPrimaryVariant","icon","imageFolder","PREFIX","defaultProps"],"mappings":"mzEA6CA,MAAMA,EAAaC,IACf,MAAMC,EAAMC,EAA8B,MACpCC,EAAeD,GAAO,GACtBE,EAAWC,IAEXC,EAAoBJ,EAAO,MAC3BK,EAAgBC,IAClBF,EAAkBG,QAAUD,GAG1BE,EAAeR,EAAqB,IAErCS,OAAOC,KAAKF,EAAaD,SAASI,QACnCb,EAAMc,gBAAgBJ,EAAaD,SAGvC,MAAMM,EAAkBb,EAAO,GACzBc,GAAgBd,GAAO,GAEvBe,GAAiBC,EAAQ,IAAM,IAAIC,EAAenB,EAAMiB,gBAAiB,CAACjB,EAAMiB,kBAEhFG,OAAEA,IAAWC,IAGnBX,EAAaD,QAAQR,IAAMA,EAK3B,MAAOqB,GAAQC,IAAaC,EAAS,UAE9BC,GAAQC,IAAaF,EAA8B,CAAA,IACnDG,GAAOC,IAAYJ,EAA8B,IAChDxB,EAAM6B,oBAAsB,CAAEC,YAAY,MAE3CC,GAAMC,IAAWR,EAA6B,IAC7CxB,EAAMiC,eAAiB,CAAEH,WAAY9B,EAAM+B,MAAMD,YAAc,OAGhEI,GAAgBC,IAAqBX,EAAS,KAC9CY,GAAYC,IAAiBb,GAAS,IACtCc,GAAkBC,IAAuBf,EAASgB,IAClDC,GAAWC,IAAgBlB,EAASmB,IACpCC,GAAoBC,IAAyBrB,EAAiB,OAE9DsB,GAAyBC,IAA8BvB,EAAmC,KAC1FwB,GAAoBC,IAAyBzB,EAASxB,EAAMkD,sBAAwBlD,EAAMmD,MAAQ,IAEnGC,GAAqBpD,EAAMqD,qBAAuBC,EAAmBC,MAAQvD,EAAMwD,uBAEnFC,GAAuBC,EAAyB1D,EAAMqD,oBAEtDM,GAAwBzD,EAAeuD,IAAwBzD,EAAM+B,MAAM6B,gBAAgBC,UAE1FC,GAAoBC,IAAyBvC,GAAS,IACtDoC,GAA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3E,KAE3CkN,KAAM,QAEL5J,IAAsBkI,EAAC2B,QAExB3B,EAACH,GAAAA,IAEO+B,EAA0B1O,GAG9B+B,KAAMA,GACNJ,MAAOA,GACPF,OAAQA,GACRqD,gBAAiBA,GACjB5C,eAAgBA,GAChB8G,WAAYA,EACZX,SAAUA,EACV5F,UAAWA,GACXqD,gBAAiBA,GACjBI,0BAA2BA,GAC3ByI,mBAAoBrK,GAEpBsK,YAAa5O,EAAM4O,YACnB5J,SAAUA,GACVE,WAAYA,GACZD,UAAWA,GACX3C,iBAAkBA,GAClBQ,wBAAyBA,GACzByF,WAAYA,GACZvF,mBAAoBA,GAEpBsD,QAASA,GAETG,iBAAkBA,GAClBtC,qBAAsBA,GAEtB0K,qBAAsB9K,GAEtBxD,cAAeA,EACfqD,eAAgBA,GAChBkL,8BAA+BrL,IAAwBsL,EAAiCpL,GAAsBlD,SAC9GgD,qBAAsBA,GACtBuE,cAAeA,GACfgH,gBAAiBhP,EAAMgP,gBACvBC,kBAAmBjP,EAAMiP,kBACzBC,wBAAyBlP,EAAMkP,wBAE/B1K,gBAAiBA,GAEjBmC,sBAAuBA,GACvBM,qBAAsBA,QAMrCjH,EAAMmP,uBACHrC,EAACsC,EAAAA,IACOpP,EAAMmP,sBACVE,qBAAsB3K,GACtBiH,SAAU3L,EAAM2L,SAChBX,kBAAmBhL,EAAMgL,kBACzBX,KAAMrK,EAAMqK,OAInBzF,IACG5E,EAAMsP,eACNtP,EAAMuP,UAAU,CACZjO,UACAkO,QAASxP,EAAMyP,0BAA4B,UAAY,YACvDC,KAAMtP,EAAS,CAAEuP,YAAa,eAAxBvP,CAAyC,GAAGwP,aAMtE7P,EAAU8P,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/constants';\nimport { BinLookupResponse, DualBrandSelectElement } from '../../types';\nimport { cardInputFormatters, cardInputValidationRules, getRuleByNameAndMode } from './validate';\nimport CIExtensions from '../../../internal/SecuredFields/binLookup/extensions';\nimport useForm from '../../../../utils/useForm';\nimport { SortedErrorObject } from '../../../../core/Errors/types';\nimport {\n handlePartialAddressMode,\n extractPropsForCardFields,\n extractPropsForSFP,\n getLayout,\n shouldShowInstallmentsComponent,\n requiresDualBrandSelection\n} from './utils';\nimport Specifications from '../../../internal/Address/Specifications';\nimport { StoredCardFieldsWrapper } from './components/StoredCardFieldsWrapper';\nimport { CardFieldsWrapper } from './components/CardFieldsWrapper';\nimport { getAddressHandler, getAutoJumpHandler, getFocusHandler } from './handlers';\nimport { InstallmentsState } from './components/Installments/Installments';\nimport { TouchStartEventObj } from './components/types';\nimport classNames from 'classnames';\nimport { getPartialAddressValidationRules } from '../../../internal/Address/validate';\nimport useImage from '../../../../core/Context/useImage';\nimport { getArrayDifferences } from '../../../../utils/arrayUtils';\nimport FormInstruction from '../../../internal/FormInstruction';\nimport { AddressData } from '../../../../types/global-types';\nimport { CardBrandData, CardFocusData } from '../../../internal/SecuredFields/lib/types';\nimport { PREFIX } from '../../../internal/Icon/constants';\nimport useSRPanelForCardInputErrors from './useSRPanelForCardInputErrors';\nimport FastlaneSignup from '../Fastlane/FastlaneSignup';\nimport { fieldTypeToSnakeCase } from '../../../internal/SecuredFields/utils';\nimport { getErrorMessageFromCode } from '../../../../core/Errors/utils';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\nimport { usePrevious } from '../../../../utils/hookUtils';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../../../core/Analytics/events/AnalyticsInfoEvent';\nimport { useAmount } from '../../../../core/Context/AmountProvider';\nimport { DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM } from '../../constants';\n\nconst CardInput = (props: Readonly<CardInputProps>) => {\n const sfp = useRef<SecuredFieldsProvider>(null);\n const isValidating = useRef(false);\n const getImage = useImage();\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 const { amount } = useAmount();\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 [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<DualBrandSelectElement[]>([]);\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 const initialBillingAddress = props.data?.billingAddress ?? null;\n\n // Keeps the value of the country set initially by the merchant, before the Address Component mutates it\n const partialAddressCountry = useRef<string | null>(partialAddressSchema ? (initialBillingAddress?.country?.toUpperCase() ?? null) : null);\n\n const [storePaymentMethod, setStorePaymentMethod] = useState(false);\n const [billingAddress, setBillingAddress] = useState<AddressData | null>(showBillingAddress ? initialBillingAddress : null);\n const [showSocialSecurityNumber, setShowSocialSecurityNumber] = useState(false);\n const [socialSecurityNumber, setSocialSecurityNumber] = useState('');\n const [installments, setInstallments] = useState<InstallmentsState>({ 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 * This stores the brand as detected by the internal regEx.\n * It eventually gets overwritten by the brand as detected by the /binLookup, but will revert back to the regEx detection\n * if the PAN length drops below the /binLookup digit threshold.\n * Default value, 'card', indicates no brand detected\n */\n const [internallyDetectedBrand, setInternallyDetectedBrand] = useState('card');\n\n /**\n * Used tho show and hide the pay button and instructions text\n * Should mimic the same logic as CardInput loading wrapper\n */\n const [showCardUIElements, setShowCardUIElements] = useState(false);\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 = shouldShowInstallmentsComponent({\n installmentOptions: props.installmentOptions,\n fundingSource: props.fundingSource,\n amount\n });\n\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 | CardFocusData) => {\n props.onFocus({ fieldType: who, event: e });\n };\n const onFieldBlurAnalytics = (who: string, e: Event | CardFocusData) => {\n props.onBlur({ fieldType: who, event: e });\n };\n\n const onBrand = useCallback((obj: CardBrandData) => {\n setInternallyDetectedBrand(obj.brand);\n props.onBrand(obj);\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 mapSfpErrorsToCardInputErrors = (sfpErrors: SFPState['errors']): Partial<CardInputErrorState> => {\n if (!sfpErrors) return {};\n\n return {\n encryptedCardNumber: !!sfpErrors.encryptedCardNumber,\n encryptedExpiryDate: !!sfpErrors.encryptedExpiryDate,\n encryptedSecurityCode: !!sfpErrors.encryptedSecurityCode,\n encryptedPassword: !!sfpErrors.encryptedPassword\n };\n };\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, null) ? 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, ...mapSfpErrorsToCardInputErrors(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 /**\n * Listen to the full SecureFieldsProvider state and handle actions\n * Used right now to mimic the loading status changes, this can only be done this way\n * Trying to do it via onConfiguSuccess or onChange has side effects\n */\n const handleSFPStateUpdate = useCallback(\n sfpState => {\n mimicLoadingStatusChange(sfpState);\n },\n [showCardUIElements, setShowCardUIElements]\n );\n\n /**\n * This function implements the same logic that LoadingProvider uses to show and hide elements\n * We want to mimic this behavior so we can hide and show the pay button or the instructions text\n * Deciding to do it this way since we garante there's no DOM changes to merchants\n * We can break this in the next major version (v7)\n */\n const mimicLoadingStatusChange = (sfpState: SFPState) => {\n if (!sfpState.status) return;\n if (sfpState.status == 'loading') {\n setShowCardUIElements(false);\n } else {\n setShowCardUIElements(true);\n }\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 // Use the custom hook to set (or clear) errors in the SRPanel\n const {\n sortedErrorList: currentErrorsSortedByLayout,\n previousSortedErrors,\n clearSRPanel\n } = useSRPanelForCardInputErrors({\n errors,\n props,\n isValidating,\n retrieveLayout,\n specifications,\n billingAddress,\n sfp\n });\n\n // Analytics: ValidationErrors\n useEffect(() => {\n if (currentErrorsSortedByLayout) {\n const newErrors = getArrayDifferences<SortedErrorObject, string>(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n\n newErrors?.forEach(errorItem => {\n const event = new AnalyticsInfoEvent({\n component: props.type,\n type: InfoEventType.validationError,\n target: fieldTypeToSnakeCase(errorItem.field) as UiTarget,\n validationErrorCode: errorItem.errorCode,\n validationErrorMessage: getErrorMessageFromCode(errorItem.errorCode, SF_ErrorCodes)\n });\n props.onSubmitAnalytics(event);\n });\n }\n }, [currentErrorsSortedByLayout]);\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 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 * \"Update\" handler related to dual brand buttons being initially displayed\n */\n useEffect(() => {\n if (dualBrandSelectElements.length > 0 && dualBrandSelectElements) {\n const dualBrandsArr: string[] = dualBrandSelectElements.map(item => item.id);\n const brand = dualBrandsArr[0]; // initially selected brand\n const dualBrands = dualBrandsArr.toString();\n\n const showDualBrandSelector = dualBrandSelectElements\n ? requiresDualBrandSelection(DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM, dualBrandSelectElements, 'id')\n : false;\n\n // Only send analytics event about displaying dualBrand selector for countries that need to show a selection mechanism\n if (showDualBrandSelector) {\n const event = new AnalyticsInfoEvent({\n component: props.type,\n type: InfoEventType.displayed,\n target: UiTarget.dualBrandButton,\n brand,\n configData: { dualBrands }\n });\n\n props.onSubmitAnalytics(event);\n }\n }\n }, [dualBrandSelectElements]);\n\n const previousSelectedBrandValue = usePrevious(selectedBrandValue);\n\n /**\n * \"Update\" handler related to a dual brand button being selected\n */\n useEffect(() => {\n if (previousSelectedBrandValue?.length && selectedBrandValue?.length) {\n const event = new AnalyticsInfoEvent({\n component: props.type,\n type: InfoEventType.selected,\n target: UiTarget.dualBrandButton,\n brand: selectedBrandValue\n });\n\n props.onSubmitAnalytics(event);\n }\n }, [selectedBrandValue]);\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 onSubmitAnalytics={props.onSubmitAnalytics}\n onChange={handleSecuredFieldsChange}\n onBrand={onBrand}\n onFocus={handleFocus}\n onStateUpdate={handleSFPStateUpdate}\n type={props.brand}\n componentType={props.type}\n disableIOSArrowKeys={props.disableIOSArrowKeys ? handleTouchstartIOS : null}\n render={({ setRootNode, setFocusOn }, sfpState: 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 {showCardUIElements && <FormInstruction />}\n\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\n {props.fastlaneConfiguration && (\n <FastlaneSignup\n {...props.fastlaneConfiguration}\n currentDetectedBrand={internallyDetectedBrand}\n onChange={props.onChange}\n onSubmitAnalytics={props.onSubmitAnalytics}\n type={props.type}\n />\n )}\n\n {showCardUIElements &&\n props.showPayButton &&\n props.payButton({\n status,\n variant: props.isPayButtonPrimaryVariant ? 'primary' : 'secondary',\n icon: getImage({ imageFolder: 'components/' })(`${PREFIX}lock`)\n })}\n </Fragment>\n );\n};\n\nCardInput.defaultProps = defaultProps;\n\nexport default CardInput;\n"],"names":["CardInput","props","sfp","useRef","isValidating","getImage","useImage","billingAddressRef","setAddressRef","ref","current","cardInputRef","Object","keys","length","setComponentRef","hasPanLengthRef","isAutoJumping","specifications","useMemo","Specifications","amount","useAmount","status","setStatus","useState","errors","setErrors","valid","setValid","holderNameRequired","holderName","data","setData","hasHolderName","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","initialBillingAddress","billingAddress","partialAddressCountry","country","toUpperCase","storePaymentMethod","setStorePaymentMethod","setBillingAddress","showSocialSecurityNumber","setShowSocialSecurityNumber","socialSecurityNumber","setSocialSecurityNumber","installments","setInstallments","value","iOSFocusedField","setIOSFocusedField","internallyDetectedBrand","setInternallyDetectedBrand","showCardUIElements","setShowCardUIElements","handleChangeFor","triggerValidation","formData","formValid","formErrors","setSchema","setFormData","setFormValid","setFormErrors","useForm","schema","defaultData","formatters","cardInputFormatters","rules","cardInputValidationRules","hasInstallments","shouldShowInstallmentsComponent","installmentOptions","fundingSource","showAmountsInInstallments","showInstallmentAmounts","isKorea","countryCode","showKCP","configuration","koreanAuthenticationRequired","showBrazilianSSN","socialSecurityNumberMode","onFieldFocusAnalytics","who","e","onFocus","fieldType","event","onFieldBlurAnalytics","onBlur","onBrand","useCallback","obj","handleFocus","getFocusHandler","retrieveLayout","getLayout","countrySpecificSchemas","getAddressSchemaForCountry","billingAddressRequiredFields","handleTouchstartIOS","elementType","name","handleAddress","getAddressHandler","doPanAutoJump","getAutoJumpHandler","handleSFPStateUpdate","sfpState","mimicLoadingStatusChange","extensions","CIExtensions","showValidation","clearSRPanel","processBinLookupResponse","binLookupResponse","isReset","processBinLookup","useEffect","setFocusOn","updateStyles","handleUnsupportedCard","destroy","newSchema","taxNumber","addressHasErrors","entries","reduce","acc","error","sortedErrorList","currentErrorsSortedByLayout","previousSortedErrors","useSRPanelForCardInputErrors","newErrors","getArrayDifferences","forEach","errorItem","AnalyticsInfoEvent","component","type","InfoEventType","validationError","target","fieldTypeToSnakeCase","field","validationErrorCode","errorCode","validationErrorMessage","getErrorMessageFromCode","SF_ErrorCodes","onSubmitAnalytics","holderNameValid","sfpValid","addressValid","koreanAuthentication","encryptedPassword","socialSecurityNumberValid","isValid","sfStateErrorsObj","mapErrorsToValidationRuleResult","mergedErrors","onChange","dualBrandsArr","map","item","id","dualBrands","toString","requiresDualBrandSelection","DUAL_BRANDS_THAT_NEED_SELECTION_MECHANISM","displayed","UiTarget","dualBrandButton","configData","previousSelectedBrandValue","usePrevious","selected","FieldToRender","StoredCardFieldsWrapper","CardFieldsWrapper","h","Fragment","SecuredFieldsProvider","extractPropsForSFP","styles","hasKoreanFields","sfState","eventDetails","autoCompleteName","holderNameValidationFn","getRuleByNameAndMode","acHolderName","sfpErrors","autoFocus","ENCRYPTED_CARD_NUMBER","encryptedCardNumber","encryptedExpiryDate","encryptedSecurityCode","onStateUpdate","componentType","disableIOSArrowKeys","render","setRootNode","div","className","classNames","role","FormInstruction","extractPropsForCardFields","handleInstallments","brandsIcons","handleOnStoreDetails","billingAddressValidationRules","getPartialAddressValidationRules","onAddressLookup","onAddressSelected","addressSearchDebounceMs","fastlaneConfiguration","FastlaneSignup","currentDetectedBrand","showPayButton","payButton","variant","isPayButtonPrimaryVariant","icon","imageFolder","PREFIX","defaultProps"],"mappings":"mzEA6CA,MAAMA,EAAaC,IACf,MAAMC,EAAMC,EAA8B,MACpCC,EAAeD,GAAO,GACtBE,EAAWC,IAEXC,EAAoBJ,EAAO,MAC3BK,EAAgBC,IAClBF,EAAkBG,QAAUD,GAG1BE,EAAeR,EAAqB,IAErCS,OAAOC,KAAKF,EAAaD,SAASI,QACnCb,EAAMc,gBAAgBJ,EAAaD,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ZD,UAAWA,GACX7C,iBAAkBA,GAClBQ,wBAAyBA,GACzB2F,WAAYA,GACZzF,mBAAoBA,GAEpBwD,QAASA,GAETG,iBAAkBA,GAClBtC,qBAAsBA,GAEtB0K,qBAAsB9K,GAEtB1D,cAAeA,EACfqD,eAAgBA,GAChBoL,8BAA+BvL,IAAwBwL,EAAiCpL,GAAsBpD,SAC9GgD,qBAAsBA,GACtByE,cAAeA,GACfgH,gBAAiBlP,EAAMkP,gBACvBC,kBAAmBnP,EAAMmP,kBACzBC,wBAAyBpP,EAAMoP,wBAE/B1K,gBAAiBA,GAEjBmC,sBAAuBA,GACvBM,qBAAsBA,QAMrCnH,EAAMqP,uBACHrC,EAACsC,EAAAA,IACOtP,EAAMqP,sBACVE,qBAAsB3K,GACtBiH,SAAU7L,EAAM6L,SAChBX,kBAAmBlL,EAAMkL,kBACzBX,KAAMvK,EAAMuK,OAInBzF,IACG9E,EAAMwP,eACNxP,EAAMyP,UAAU,CACZnO,UACAoO,QAAS1P,EAAM2P,0BAA4B,UAAY,YACvDC,KAAMxP,EAAS,CAAEyP,YAAa,eAAxBzP,CAAyC,GAAG0P,aAMtE/P,EAAUgQ,aAAeA"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../external/preact/dist/preact.js";import t from"../../../../../_virtual/index.js";import o from"./CVCHint.js";import i from"../../../../internal/FormFields/Field/Field.js";import{useCoreContext as r}from"../../../../../core/Context/CoreProvider.js";import{CVC_POLICY_REQUIRED as n,CVC_POLICY_OPTIONAL as a,CVC_POLICY_HIDDEN as c,ENCRYPTED_SECURITY_CODE as l}from"../../../../internal/SecuredFields/lib/constants.js";import d from"./DataSfSpan.js";import{alternativeLabelContent as s}from"./FieldLabelAlternative.js";function u(u){const{label:_,onFocusField:m=()=>{},error:p="",className:f="",classNameModifiers:C=[],focused:y,filled:h,isValid:x,frontCVC:F=!1,cvcPolicy:k=n,showContextualElement:v,contextualText:b}=u,{i18n:j}=r(),V=t(f,{"adyen-checkout__field__cvc":!0,"adyen-checkout__card__cvc__input--hidden":k===c,"adyen-checkout__field__cvc--optional":k===a}),N=t({"adyen-checkout__input":!0,"adyen-checkout__input--small":!0,"adyen-checkout__card__cvc__input":!0,"adyen-checkout__input--error":p,"adyen-checkout__input--focus":y,"adyen-checkout__input--valid":x}),T=k!==a?_:j.get("creditCard.securityCode.label.optional");return e(i,{label:T,focused:y,filled:h,classNameModifiers:[...C,"securityCode"],onFocusField:()=>m(l),className:V,errorMessage:p,isValid:x,dir:"ltr",name:l,i18n:j,contextVisibleToScreenReader:!1,useLabelElement:!1,renderAlternativeToLabel:s,showContextualElement:v,contextualText:b,onInputContainerClick:()=>{m(l)}},e(d,{encryptedFieldType:l,className:N}),e(o,{frontCVC:F}))}export{u as default};
1
+ import{createElement as e}from"../../../../../external/preact/dist/preact.js";import t from"../../../../../_virtual/index.js";import o from"./CVCHint.js";import i from"../../../../internal/FormFields/Field/Field.js";import{useCoreContext as r}from"../../../../../core/Context/CoreProvider.js";import{CVC_POLICY_REQUIRED as n,CVC_POLICY_OPTIONAL as a,CVC_POLICY_HIDDEN as c,ENCRYPTED_SECURITY_CODE as l}from"../../../../internal/SecuredFields/lib/constants.js";import d from"./DataSfSpan.js";import{alternativeLabelContent as s}from"./FieldLabelAlternative.js";import{resolveCVCErrorKey as u}from"../utils.js";function _(_){const{label:m,onFocusField:p=()=>{},errorCode:f="",className:C="",classNameModifiers:y=[],focused:h,filled:x,isValid:F,frontCVC:k=!1,cvcPolicy:v=n,showContextualElement:j,contextualText:b}=_,{i18n:V}=r(),N=f?V.get(u(f,k)):"",T=t(C,{"adyen-checkout__field__cvc":!0,"adyen-checkout__card__cvc__input--hidden":v===c,"adyen-checkout__field__cvc--optional":v===a}),E=t({"adyen-checkout__input":!0,"adyen-checkout__input--small":!0,"adyen-checkout__card__cvc__input":!0,"adyen-checkout__input--error":N,"adyen-checkout__input--focus":h,"adyen-checkout__input--valid":F}),S=v!==a?m:V.get("creditCard.securityCode.label.optional");return e(i,{label:S,focused:h,filled:x,classNameModifiers:[...y,"securityCode"],onFocusField:()=>p(l),className:T,errorMessage:N,isValid:F,dir:"ltr",name:l,i18n:V,contextVisibleToScreenReader:!1,useLabelElement:!1,renderAlternativeToLabel:s,showContextualElement:j,contextualText:b,onInputContainerClick:()=>{p(l)}},e(d,{encryptedFieldType:l,className:E}),e(o,{frontCVC:k}))}export{_ as default};
2
2
  //# sourceMappingURL=CVC.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CVC.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CVC.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport CVCHint from './CVCHint';\nimport Field from '../../../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { CVCProps } from './types';\nimport {\n CVC_POLICY_HIDDEN,\n CVC_POLICY_OPTIONAL,\n CVC_POLICY_REQUIRED,\n ENCRYPTED_SECURITY_CODE\n} from '../../../../internal/SecuredFields/lib/constants';\nimport DataSfSpan from './DataSfSpan';\nimport { alternativeLabelContent } from './FieldLabelAlternative';\nimport './CVC.scss';\n\nexport default function CVC(props: Readonly<CVCProps>) {\n const {\n label,\n onFocusField = () => {},\n error = '',\n className = '',\n classNameModifiers = [],\n focused,\n filled,\n isValid,\n frontCVC = false,\n cvcPolicy = CVC_POLICY_REQUIRED,\n showContextualElement,\n contextualText\n } = props;\n const { i18n } = useCoreContext();\n\n const fieldClassnames = classNames(className, {\n 'adyen-checkout__field__cvc': true,\n 'adyen-checkout__card__cvc__input--hidden': cvcPolicy === CVC_POLICY_HIDDEN,\n 'adyen-checkout__field__cvc--optional': cvcPolicy === CVC_POLICY_OPTIONAL\n });\n\n const cvcClassnames = classNames({\n 'adyen-checkout__input': true,\n 'adyen-checkout__input--small': true,\n 'adyen-checkout__card__cvc__input': true,\n 'adyen-checkout__input--error': error,\n 'adyen-checkout__input--focus': focused,\n 'adyen-checkout__input--valid': isValid\n });\n\n const fieldLabel = cvcPolicy !== CVC_POLICY_OPTIONAL ? label : i18n.get('creditCard.securityCode.label.optional');\n\n const handleIconClick = () => {\n onFocusField(ENCRYPTED_SECURITY_CODE);\n };\n\n return (\n <Field\n label={fieldLabel}\n focused={focused}\n filled={filled}\n classNameModifiers={[...classNameModifiers, 'securityCode']}\n onFocusField={() => onFocusField(ENCRYPTED_SECURITY_CODE)}\n className={fieldClassnames}\n errorMessage={error}\n isValid={isValid}\n dir={'ltr'}\n name={ENCRYPTED_SECURITY_CODE}\n i18n={i18n}\n contextVisibleToScreenReader={false}\n useLabelElement={false}\n renderAlternativeToLabel={alternativeLabelContent}\n showContextualElement={showContextualElement}\n contextualText={contextualText}\n onInputContainerClick={handleIconClick}\n >\n <DataSfSpan encryptedFieldType={ENCRYPTED_SECURITY_CODE} className={cvcClassnames} />\n\n <CVCHint frontCVC={frontCVC} />\n </Field>\n );\n}\n"],"names":["CVC","props","label","onFocusField","error","className","classNameModifiers","focused","filled","isValid","frontCVC","cvcPolicy","CVC_POLICY_REQUIRED","showContextualElement","contextualText","i18n","useCoreContext","fieldClassnames","classNames","CVC_POLICY_HIDDEN","CVC_POLICY_OPTIONAL","cvcClassnames","fieldLabel","get","h","Field","ENCRYPTED_SECURITY_CODE","errorMessage","dir","name","contextVisibleToScreenReader","useLabelElement","renderAlternativeToLabel","alternativeLabelContent","onInputContainerClick","DataSfSpan","encryptedFieldType","CVCHint"],"mappings":"gjBAgBe,SAASA,EAAIC,GACxB,MAAMC,MACFA,EAAKC,aACLA,EAAe,OAAQC,MACvBA,EAAQ,GAAEC,UACVA,EAAY,GAAEC,mBACdA,EAAqB,GAAEC,QACvBA,EAAOC,OACPA,EAAMC,QACNA,EAAOC,SACPA,GAAW,EAAKC,UAChBA,EAAYC,EAAmBC,sBAC/BA,EAAqBC,eACrBA,GACAb,GACEc,KAAEA,GAASC,IAEXC,EAAkBC,EAAWb,EAAW,CAC1C,8BAA8B,EAC9B,2CAA4CM,IAAcQ,EAC1D,uCAAwCR,IAAcS,IAGpDC,EAAgBH,EAAW,CAC7B,yBAAyB,EACzB,gCAAgC,EAChC,oCAAoC,EACpC,+BAAgCd,EAChC,+BAAgCG,EAChC,+BAAgCE,IAG9Ba,EAAaX,IAAcS,EAAsBlB,EAAQa,EAAKQ,IAAI,0CAMxE,OACIC,EAACC,EAAAA,CACGvB,MAAOoB,EACPf,QAASA,EACTC,OAAQA,EACRF,mBAAoB,IAAIA,EAAoB,gBAC5CH,aAAc,IAAMA,EAAauB,GACjCrB,UAAWY,EACXU,aAAcvB,EACdK,QAASA,EACTmB,IAAK,MACLC,KAAMH,EACNX,KAAMA,EACNe,8BAA8B,EAC9BC,iBAAiB,EACjBC,yBAA0BC,EAC1BpB,sBAAuBA,EACvBC,eAAgBA,EAChBoB,sBAtBgB,KACpB/B,EAAauB,KAuBTF,EAACW,EAAAA,CAAWC,mBAAoBV,EAAyBrB,UAAWgB,IAEpEG,EAACa,EAAAA,CAAQ3B,SAAUA,IAG/B"}
1
+ {"version":3,"file":"CVC.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CVC.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport CVCHint from './CVCHint';\nimport Field from '../../../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { CVCProps } from './types';\nimport {\n CVC_POLICY_HIDDEN,\n CVC_POLICY_OPTIONAL,\n CVC_POLICY_REQUIRED,\n ENCRYPTED_SECURITY_CODE\n} from '../../../../internal/SecuredFields/lib/constants';\nimport DataSfSpan from './DataSfSpan';\nimport { alternativeLabelContent } from './FieldLabelAlternative';\nimport { resolveCVCErrorKey } from '../utils';\nimport './CVC.scss';\n\nexport default function CVC(props: Readonly<CVCProps>) {\n const {\n label,\n onFocusField = () => {},\n errorCode = '',\n className = '',\n classNameModifiers = [],\n focused,\n filled,\n isValid,\n frontCVC = false,\n cvcPolicy = CVC_POLICY_REQUIRED,\n showContextualElement,\n contextualText\n } = props;\n const { i18n } = useCoreContext();\n\n const errorMessage = errorCode ? i18n.get(resolveCVCErrorKey(errorCode, frontCVC)) : '';\n\n const fieldClassnames = classNames(className, {\n 'adyen-checkout__field__cvc': true,\n 'adyen-checkout__card__cvc__input--hidden': cvcPolicy === CVC_POLICY_HIDDEN,\n 'adyen-checkout__field__cvc--optional': cvcPolicy === CVC_POLICY_OPTIONAL\n });\n\n const cvcClassnames = classNames({\n 'adyen-checkout__input': true,\n 'adyen-checkout__input--small': true,\n 'adyen-checkout__card__cvc__input': true,\n 'adyen-checkout__input--error': errorMessage,\n 'adyen-checkout__input--focus': focused,\n 'adyen-checkout__input--valid': isValid\n });\n\n const fieldLabel = cvcPolicy !== CVC_POLICY_OPTIONAL ? label : i18n.get('creditCard.securityCode.label.optional');\n\n const handleIconClick = () => {\n onFocusField(ENCRYPTED_SECURITY_CODE);\n };\n\n return (\n <Field\n label={fieldLabel}\n focused={focused}\n filled={filled}\n classNameModifiers={[...classNameModifiers, 'securityCode']}\n onFocusField={() => onFocusField(ENCRYPTED_SECURITY_CODE)}\n className={fieldClassnames}\n errorMessage={errorMessage}\n isValid={isValid}\n dir={'ltr'}\n name={ENCRYPTED_SECURITY_CODE}\n i18n={i18n}\n contextVisibleToScreenReader={false}\n useLabelElement={false}\n renderAlternativeToLabel={alternativeLabelContent}\n showContextualElement={showContextualElement}\n contextualText={contextualText}\n onInputContainerClick={handleIconClick}\n >\n <DataSfSpan encryptedFieldType={ENCRYPTED_SECURITY_CODE} className={cvcClassnames} />\n\n <CVCHint frontCVC={frontCVC} />\n </Field>\n );\n}\n"],"names":["CVC","props","label","onFocusField","errorCode","className","classNameModifiers","focused","filled","isValid","frontCVC","cvcPolicy","CVC_POLICY_REQUIRED","showContextualElement","contextualText","i18n","useCoreContext","errorMessage","get","resolveCVCErrorKey","fieldClassnames","classNames","CVC_POLICY_HIDDEN","CVC_POLICY_OPTIONAL","cvcClassnames","fieldLabel","h","Field","ENCRYPTED_SECURITY_CODE","dir","name","contextVisibleToScreenReader","useLabelElement","renderAlternativeToLabel","alternativeLabelContent","onInputContainerClick","DataSfSpan","encryptedFieldType","CVCHint"],"mappings":"imBAiBe,SAASA,EAAIC,GACxB,MAAMC,MACFA,EAAKC,aACLA,EAAe,OAAQC,UACvBA,EAAY,GAAEC,UACdA,EAAY,GAAEC,mBACdA,EAAqB,GAAEC,QACvBA,EAAOC,OACPA,EAAMC,QACNA,EAAOC,SACPA,GAAW,EAAKC,UAChBA,EAAYC,EAAmBC,sBAC/BA,EAAqBC,eACrBA,GACAb,GACEc,KAAEA,GAASC,IAEXC,EAAeb,EAAYW,EAAKG,IAAIC,EAAmBf,EAAWM,IAAa,GAE/EU,EAAkBC,EAAWhB,EAAW,CAC1C,8BAA8B,EAC9B,2CAA4CM,IAAcW,EAC1D,uCAAwCX,IAAcY,IAGpDC,EAAgBH,EAAW,CAC7B,yBAAyB,EACzB,gCAAgC,EAChC,oCAAoC,EACpC,+BAAgCJ,EAChC,+BAAgCV,EAChC,+BAAgCE,IAG9BgB,EAAad,IAAcY,EAAsBrB,EAAQa,EAAKG,IAAI,0CAMxE,OACIQ,EAACC,EAAAA,CACGzB,MAAOuB,EACPlB,QAASA,EACTC,OAAQA,EACRF,mBAAoB,IAAIA,EAAoB,gBAC5CH,aAAc,IAAMA,EAAayB,GACjCvB,UAAWe,EACXH,aAAcA,EACdR,QAASA,EACToB,IAAK,MACLC,KAAMF,EACNb,KAAMA,EACNgB,8BAA8B,EAC9BC,iBAAiB,EACjBC,yBAA0BC,EAC1BrB,sBAAuBA,EACvBC,eAAgBA,EAChBqB,sBAtBgB,KACpBhC,EAAayB,KAuBTF,EAACU,EAAAA,CAAWC,mBAAoBT,EAAyBvB,UAAWmB,IAEpEE,EAACY,EAAAA,CAAQ5B,SAAUA,IAG/B"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../../external/preact/dist/preact.js";import r from"./CardNumber.js";import t from"./CVC.js";import a from"./ExpirationDate.js";import{useCoreContext as d}from"../../../../../core/Context/CoreProvider.js";import n from"../../../../../_virtual/index.js";import{BRAND_ICON_UI_EXCLUSION_LIST as i,ENCRYPTED_CARD_NUMBER as o,DATE_POLICY_HIDDEN as c,ENCRYPTED_EXPIRY_DATE as l,ENCRYPTED_SECURITY_CODE as s}from"../../../../internal/SecuredFields/lib/constants.js";import u from"./AvailableBrands/AvailableBrands.js";function m({brand:m,brandsIcons:p,brandsConfiguration:y,dualBrandingElements:C,selectedBrandValue:x,dualBrandingChangeHandler:f,errors:b,focusedElement:g,hasCVC:_,cvcPolicy:h,expiryDatePolicy:v,onFocusField:E,showBrandIcon:B,valid:F,showContextualElement:N}){const{i18n:j}=d(),V=(e,r)=>e[r]?j.get(e[r]):null,D=p?.filter(e=>!i?.includes(e.name)),w="amex"===m,P=w?j.get("creditCard.securityCode.contextualText.4digits"):j.get("creditCard.securityCode.contextualText.3digits");return e("div",{className:"adyen-checkout__card__form"},e(r,{brand:m,brandsConfiguration:y,error:V(b,o),focused:g===o,isValid:!!F.encryptedCardNumber,label:j.get("creditCard.cardNumber.label"),onFocusField:E,filled:!!b.encryptedCardNumber||!!F.encryptedCardNumber,showBrandIcon:B,dualBrandingElements:C,selectedBrandValue:x,dualBrandingChangeHandler:f}),e(u,{activeBrand:m,brands:D}),e("div",{className:n("adyen-checkout__card__exp-cvc",{"adyen-checkout__card__exp-cvc__exp-date__input--hidden":v===c})},e(a,{classNameModifiers:["col-50"],error:V(b,l),focused:g===l,isValid:!!F.encryptedExpiryMonth&&!!F.encryptedExpiryYear,filled:!!b.encryptedExpiryDate||!!F.encryptedExpiryYear,label:j.get("creditCard.expiryDate.label"),onFocusField:E,expiryDatePolicy:v,showContextualElement:N,contextualText:j.get("creditCard.expiryDate.contextualText")}),_&&e(t,{classNameModifiers:["col-50"],error:V(b,s),focused:g===s,cvcPolicy:h,isValid:!!F.encryptedSecurityCode,filled:!!b.encryptedSecurityCode||!!F.encryptedSecurityCode,label:j.get("creditCard.securityCode.label"),onFocusField:E,frontCVC:w,showContextualElement:N,contextualText:P})))}export{m as default};
1
+ import{createElement as e}from"../../../../../external/preact/dist/preact.js";import r from"./CardNumber.js";import t from"./CVC.js";import a from"./ExpirationDate.js";import{useCoreContext as d}from"../../../../../core/Context/CoreProvider.js";import n from"../../../../../_virtual/index.js";import{BRAND_ICON_UI_EXCLUSION_LIST as o,ENCRYPTED_CARD_NUMBER as i,DATE_POLICY_HIDDEN as c,ENCRYPTED_EXPIRY_DATE as l,ENCRYPTED_SECURITY_CODE as s}from"../../../../internal/SecuredFields/lib/constants.js";import u from"./AvailableBrands/AvailableBrands.js";function m({brand:m,brandsIcons:p,brandsConfiguration:C,dualBrandingElements:y,selectedBrandValue:x,dualBrandingChangeHandler:f,errors:b,focusedElement:g,hasCVC:_,cvcPolicy:h,expiryDatePolicy:v,onFocusField:E,showBrandIcon:B,valid:F,showContextualElement:N}){const{i18n:j}=d(),V=(e,r)=>{const t=e[r];return t?j.get(t):null},D=p?.filter(e=>!o?.includes(e.name)),w="amex"===m,P=w?j.get("creditCard.securityCode.contextualText.4digits"):j.get("creditCard.securityCode.contextualText.3digits");return e("div",{className:"adyen-checkout__card__form"},e(r,{brand:m,brandsConfiguration:C,error:V(b,i),focused:g===i,isValid:!!F.encryptedCardNumber,label:j.get("creditCard.cardNumber.label"),onFocusField:E,filled:!!b.encryptedCardNumber||!!F.encryptedCardNumber,showBrandIcon:B,dualBrandingElements:y,selectedBrandValue:x,dualBrandingChangeHandler:f}),e(u,{activeBrand:m,brands:D}),e("div",{className:n("adyen-checkout__card__exp-cvc",{"adyen-checkout__card__exp-cvc__exp-date__input--hidden":v===c})},e(a,{classNameModifiers:["col-50"],error:V(b,l),focused:g===l,isValid:!!F.encryptedExpiryMonth&&!!F.encryptedExpiryYear,filled:!!b.encryptedExpiryDate||!!F.encryptedExpiryYear,label:j.get("creditCard.expiryDate.label"),onFocusField:E,expiryDatePolicy:v,showContextualElement:N,contextualText:j.get("creditCard.expiryDate.contextualText")}),_&&e(t,{classNameModifiers:["col-50"],errorCode:b[s],focused:g===s,cvcPolicy:h,isValid:!!F.encryptedSecurityCode,filled:!!b.encryptedSecurityCode||!!F.encryptedSecurityCode,label:j.get("creditCard.securityCode.label"),onFocusField:E,frontCVC:w,showContextualElement:N,contextualText:P})))}export{m as default};
2
2
  //# sourceMappingURL=CardFields.js.map