@adyen/adyen-web 6.6.0 → 6.7.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 (295) hide show
  1. package/dist/cjs/adyen.css +3 -3
  2. package/dist/cjs/adyen.css.map +1 -1
  3. package/dist/cjs/index.cjs +2 -2
  4. package/dist/cjs/index.cjs.map +1 -1
  5. package/dist/cjs/index.d.cts +223 -140
  6. package/dist/es/adyen.css +3 -3
  7. package/dist/es/adyen.css.map +1 -1
  8. package/dist/es/components/ANCV/ANCV.js +1 -1
  9. package/dist/es/components/ANCV/ANCV.js.map +1 -1
  10. package/dist/es/components/Ach/components/AchInput/AchInput.js.map +1 -1
  11. package/dist/es/components/Ach/components/AchInput/defaultProps.js.map +1 -1
  12. package/dist/es/components/Ach/components/AchInput/defaultStyles.js.map +1 -1
  13. package/dist/es/components/AfterPay/AfterPayB2B.js.map +1 -1
  14. package/dist/es/components/AmazonPay/AmazonPay.js.map +1 -1
  15. package/dist/es/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
  16. package/dist/es/components/BacsDD/BacsDD.js.map +1 -1
  17. package/dist/es/components/BacsDD/components/BacsInput.js.map +1 -1
  18. package/dist/es/components/BankTransfer/BankTransfer.js.map +1 -1
  19. package/dist/es/components/Boleto/Boleto.js.map +1 -1
  20. package/dist/es/components/Boleto/components/BoletoInput/BoletoInput.js.map +1 -1
  21. package/dist/es/components/Card/Card.js.map +1 -1
  22. package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
  23. package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
  24. package/dist/es/components/Card/components/CardInput/defaultProps.js.map +1 -1
  25. package/dist/es/components/Card/components/CardInput/handlers.js.map +1 -1
  26. package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
  27. package/dist/es/components/CashAppPay/CashAppPay.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/Doku/components/DokuInput/DokuInput.js.map +1 -1
  33. package/dist/es/components/Dropin/Dropin.js.map +1 -1
  34. package/dist/es/components/Dropin/components/DropinComponent.js.map +1 -1
  35. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  36. package/dist/es/components/Dropin/components/PaymentMethod/useBrandLogoConfiguration.js.map +1 -1
  37. package/dist/es/components/Dropin/elements/filters.js.map +1 -1
  38. package/dist/es/components/Dropin/elements/getComponentConfiguration.js.map +1 -1
  39. package/dist/es/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
  40. package/dist/es/components/Giftcard/Giftcard.js +1 -1
  41. package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
  42. package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  43. package/dist/es/components/GooglePay/components/GooglePayButton.js +1 -1
  44. package/dist/es/components/GooglePay/components/GooglePayButton.js.map +1 -1
  45. package/dist/es/components/GooglePay/requests.js.map +1 -1
  46. package/dist/es/components/Klarna/KlarnaPayments.js +1 -1
  47. package/dist/es/components/Klarna/KlarnaPayments.js.map +1 -1
  48. package/dist/es/components/Klarna/components/KlarnaWidget/KlarnaWidget.js.map +1 -1
  49. package/dist/es/components/MBWay/MBWay.js.map +1 -1
  50. package/dist/es/components/Multibanco/Multibanco.js.map +1 -1
  51. package/dist/es/components/Oxxo/Oxxo.js.map +1 -1
  52. package/dist/es/components/PayByBankUS/PayByBankUS.js.map +1 -1
  53. package/dist/es/components/PayPal/utils/get-paypal-styles.js.map +1 -1
  54. package/dist/es/components/Pix/Pix.js.map +1 -1
  55. package/dist/es/components/Redirect/Redirect.js.map +1 -1
  56. package/dist/es/components/Redirect/components/RedirectShopper/RedirectShopper.js.map +1 -1
  57. package/dist/es/components/ThreeDS2/ThreeDS2Challenge.js.map +1 -1
  58. package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  59. package/dist/es/components/ThreeDS2/callSubmit3DS2Fingerprint.js +1 -1
  60. package/dist/es/components/ThreeDS2/callSubmit3DS2Fingerprint.js.map +1 -1
  61. package/dist/es/components/ThreeDS2/components/Form/ThreeDS2Form.js.map +1 -1
  62. package/dist/es/components/Twint/Twint.js.map +1 -1
  63. package/dist/es/components/UPI/UPI.js.map +1 -1
  64. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  65. package/dist/es/components/helpers/OpenInvoiceContainer/OpenInvoiceContainer.js.map +1 -1
  66. package/dist/es/components/internal/Address/Address.js.map +1 -1
  67. package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
  68. package/dist/es/components/internal/Button/Button.js.map +1 -1
  69. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js +1 -1
  70. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js.map +1 -1
  71. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js +1 -1
  72. package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js.map +1 -1
  73. package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.js +1 -1
  74. package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.js.map +1 -1
  75. package/dist/es/components/internal/ClickToPay/context/ClickToPayProvider.js.map +1 -1
  76. package/dist/es/components/internal/ClickToPay/services/ClickToPayService.js.map +1 -1
  77. package/dist/es/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
  78. package/dist/es/components/internal/FormFields/Select/Select.js.map +1 -1
  79. package/dist/es/components/internal/IFrame/Iframe.js.map +1 -1
  80. package/dist/es/components/internal/IbanInput/IbanInput.js.map +1 -1
  81. package/dist/es/components/internal/IssuerList/IssuerList.js.map +1 -1
  82. package/dist/es/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  83. package/dist/es/components/internal/OpenInvoice/utils.js.map +1 -1
  84. package/dist/es/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
  85. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  86. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
  87. package/dist/es/components/internal/SecuredFields/SFP/defaultProps.js.map +1 -1
  88. package/dist/es/components/internal/SecuredFields/binLookup/triggerBinLookUp.js.map +1 -1
  89. package/dist/es/components/internal/SecuredFields/lib/CSF/AbstractCSF.js.map +1 -1
  90. package/dist/es/components/internal/SecuredFields/lib/CSF/CSF.js.map +1 -1
  91. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  92. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleConfig.js.map +1 -1
  93. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleEncryption.js.map +1 -1
  94. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.js.map +1 -1
  95. package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/handleValidation.js.map +1 -1
  96. package/dist/es/components/internal/SecuredFields/lib/CSF/partials/handleBinValue.js.map +1 -1
  97. package/dist/es/components/internal/SecuredFields/lib/CSF/partials/handleFocus.js.map +1 -1
  98. package/dist/es/components/internal/SecuredFields/lib/CSF/partials/handleIframeConfigFeedback.js.map +1 -1
  99. package/dist/es/components/internal/SecuredFields/lib/CSF/partials/isConfigured.js.map +1 -1
  100. package/dist/es/components/internal/SecuredFields/lib/CSF/partials/postMessageToAllIframes.js.map +1 -1
  101. package/dist/es/components/internal/SecuredFields/lib/CSF/partials/processAutoComplete.js.map +1 -1
  102. package/dist/es/components/internal/SecuredFields/lib/CSF/partials/processBrand.js.map +1 -1
  103. package/dist/es/components/internal/SecuredFields/lib/CSF/partials/validateForm.js.map +1 -1
  104. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/callbackUtils.js.map +1 -1
  105. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/destroySecuredFields.js.map +1 -1
  106. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/processErrors.js.map +1 -1
  107. package/dist/es/components/internal/SecuredFields/lib/constants.js +1 -1
  108. package/dist/es/components/internal/SecuredFields/lib/constants.js.map +1 -1
  109. package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  110. package/dist/es/components/internal/SecuredFields/lib/utilities/addContextTranslations.js.map +1 -1
  111. package/dist/es/components/internal/UIElement/UIElement.js +1 -1
  112. package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
  113. package/dist/es/components/internal/UIElement/utils.js.map +1 -1
  114. package/dist/es/components/internal/Voucher/utils.js.map +1 -1
  115. package/dist/es/core/Analytics/Analytics.js.map +1 -1
  116. package/dist/es/core/Analytics/constants.js.map +1 -1
  117. package/dist/es/core/Analytics/utils.js.map +1 -1
  118. package/dist/es/core/Errors/AdyenCheckoutError.js +1 -1
  119. package/dist/es/core/Errors/AdyenCheckoutError.js.map +1 -1
  120. package/dist/es/core/Errors/SRMessages.js.map +1 -1
  121. package/dist/es/core/Errors/constants.js.map +1 -1
  122. package/dist/es/core/Errors/utils.js.map +1 -1
  123. package/dist/es/core/Services/analytics/collect-id.js +1 -1
  124. package/dist/es/core/Services/http.js +1 -1
  125. package/dist/es/core/Services/http.js.map +1 -1
  126. package/dist/es/core/Services/sessions/constants.js +1 -1
  127. package/dist/es/core/Services/sessions/constants.js.map +1 -1
  128. package/dist/es/core/Services/sessions/create-order.js +1 -1
  129. package/dist/es/core/Services/sessions/create-order.js.map +1 -1
  130. package/dist/es/core/Services/sessions/make-payment.js +1 -1
  131. package/dist/es/core/Services/sessions/make-payment.js.map +1 -1
  132. package/dist/es/core/Services/sessions/setup-session.js.map +1 -1
  133. package/dist/es/core/Services/sessions/submit-details.js +1 -1
  134. package/dist/es/core/Services/sessions/submit-details.js.map +1 -1
  135. package/dist/es/core/core.js +1 -1
  136. package/dist/es/core/core.registry.js.map +1 -1
  137. package/dist/es/core/utils.js.map +1 -1
  138. package/dist/es/external/classnames/index.js.map +1 -1
  139. package/dist/es/external/preact/dist/preact.js +1 -1
  140. package/dist/es/external/preact/dist/preact.js.map +1 -1
  141. package/dist/es/index.d.ts +223 -140
  142. package/dist/es/language/Language.js.map +1 -1
  143. package/dist/es/language/utils.js.map +1 -1
  144. package/dist/es/utils/Storage.js.map +1 -1
  145. package/dist/es/utils/commonUtils.js.map +1 -1
  146. package/dist/es/utils/get-process-message-handler.js.map +1 -1
  147. package/dist/es/utils/getOrigin.js.map +1 -1
  148. package/dist/es/utils/useForm/reducer.js.map +1 -1
  149. package/dist/es/utils/useForm/useForm.js.map +1 -1
  150. package/dist/es-legacy/adyen.css +3 -3
  151. package/dist/es-legacy/adyen.css.map +1 -1
  152. package/dist/es-legacy/components/ANCV/ANCV.js +1 -1
  153. package/dist/es-legacy/components/ANCV/ANCV.js.map +1 -1
  154. package/dist/es-legacy/components/Ach/components/AchInput/AchInput.js.map +1 -1
  155. package/dist/es-legacy/components/Ach/components/AchInput/defaultProps.js.map +1 -1
  156. package/dist/es-legacy/components/Ach/components/AchInput/defaultStyles.js.map +1 -1
  157. package/dist/es-legacy/components/AfterPay/AfterPayB2B.js.map +1 -1
  158. package/dist/es-legacy/components/AmazonPay/AmazonPay.js.map +1 -1
  159. package/dist/es-legacy/components/AmazonPay/components/AmazonPayButton.js.map +1 -1
  160. package/dist/es-legacy/components/BacsDD/BacsDD.js.map +1 -1
  161. package/dist/es-legacy/components/BacsDD/components/BacsInput.js.map +1 -1
  162. package/dist/es-legacy/components/BankTransfer/BankTransfer.js.map +1 -1
  163. package/dist/es-legacy/components/Boleto/Boleto.js.map +1 -1
  164. package/dist/es-legacy/components/Boleto/components/BoletoInput/BoletoInput.js.map +1 -1
  165. package/dist/es-legacy/components/Card/Card.js.map +1 -1
  166. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
  167. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
  168. package/dist/es-legacy/components/Card/components/CardInput/defaultProps.js.map +1 -1
  169. package/dist/es-legacy/components/Card/components/CardInput/handlers.js.map +1 -1
  170. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  171. package/dist/es-legacy/components/CashAppPay/CashAppPay.js.map +1 -1
  172. package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
  173. package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
  174. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
  175. package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
  176. package/dist/es-legacy/components/Doku/components/DokuInput/DokuInput.js.map +1 -1
  177. package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
  178. package/dist/es-legacy/components/Dropin/components/DropinComponent.js.map +1 -1
  179. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  180. package/dist/es-legacy/components/Dropin/components/PaymentMethod/useBrandLogoConfiguration.js.map +1 -1
  181. package/dist/es-legacy/components/Dropin/elements/filters.js.map +1 -1
  182. package/dist/es-legacy/components/Dropin/elements/getComponentConfiguration.js.map +1 -1
  183. package/dist/es-legacy/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
  184. package/dist/es-legacy/components/Giftcard/Giftcard.js +1 -1
  185. package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
  186. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  187. package/dist/es-legacy/components/GooglePay/components/GooglePayButton.js +1 -1
  188. package/dist/es-legacy/components/GooglePay/components/GooglePayButton.js.map +1 -1
  189. package/dist/es-legacy/components/GooglePay/requests.js.map +1 -1
  190. package/dist/es-legacy/components/Klarna/KlarnaPayments.js +1 -1
  191. package/dist/es-legacy/components/Klarna/KlarnaPayments.js.map +1 -1
  192. package/dist/es-legacy/components/Klarna/components/KlarnaWidget/KlarnaWidget.js.map +1 -1
  193. package/dist/es-legacy/components/MBWay/MBWay.js.map +1 -1
  194. package/dist/es-legacy/components/Multibanco/Multibanco.js.map +1 -1
  195. package/dist/es-legacy/components/Oxxo/Oxxo.js.map +1 -1
  196. package/dist/es-legacy/components/PayByBankUS/PayByBankUS.js.map +1 -1
  197. package/dist/es-legacy/components/PayPal/utils/get-paypal-styles.js.map +1 -1
  198. package/dist/es-legacy/components/Pix/Pix.js.map +1 -1
  199. package/dist/es-legacy/components/Redirect/Redirect.js.map +1 -1
  200. package/dist/es-legacy/components/Redirect/components/RedirectShopper/RedirectShopper.js.map +1 -1
  201. package/dist/es-legacy/components/ThreeDS2/ThreeDS2Challenge.js.map +1 -1
  202. package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  203. package/dist/es-legacy/components/ThreeDS2/callSubmit3DS2Fingerprint.js +1 -1
  204. package/dist/es-legacy/components/ThreeDS2/callSubmit3DS2Fingerprint.js.map +1 -1
  205. package/dist/es-legacy/components/ThreeDS2/components/Form/ThreeDS2Form.js.map +1 -1
  206. package/dist/es-legacy/components/Twint/Twint.js.map +1 -1
  207. package/dist/es-legacy/components/UPI/UPI.js.map +1 -1
  208. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  209. package/dist/es-legacy/components/helpers/OpenInvoiceContainer/OpenInvoiceContainer.js.map +1 -1
  210. package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
  211. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
  212. package/dist/es-legacy/components/internal/Button/Button.js.map +1 -1
  213. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js +1 -1
  214. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js.map +1 -1
  215. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js +1 -1
  216. package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPResendOtpLink.js.map +1 -1
  217. package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.js +1 -1
  218. package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPLogoutLink.js.map +1 -1
  219. package/dist/es-legacy/components/internal/ClickToPay/context/ClickToPayProvider.js.map +1 -1
  220. package/dist/es-legacy/components/internal/ClickToPay/services/ClickToPayService.js.map +1 -1
  221. package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
  222. package/dist/es-legacy/components/internal/FormFields/Select/Select.js.map +1 -1
  223. package/dist/es-legacy/components/internal/IFrame/Iframe.js.map +1 -1
  224. package/dist/es-legacy/components/internal/IbanInput/IbanInput.js.map +1 -1
  225. package/dist/es-legacy/components/internal/IssuerList/IssuerList.js.map +1 -1
  226. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  227. package/dist/es-legacy/components/internal/OpenInvoice/utils.js.map +1 -1
  228. package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
  229. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  230. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
  231. package/dist/es-legacy/components/internal/SecuredFields/SFP/defaultProps.js.map +1 -1
  232. package/dist/es-legacy/components/internal/SecuredFields/binLookup/extensions.js.map +1 -1
  233. package/dist/es-legacy/components/internal/SecuredFields/binLookup/triggerBinLookUp.js.map +1 -1
  234. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/AbstractCSF.js.map +1 -1
  235. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/CSF.js.map +1 -1
  236. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  237. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleConfig.js.map +1 -1
  238. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleEncryption.js.map +1 -1
  239. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.js.map +1 -1
  240. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleValidation.js.map +1 -1
  241. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/partials/handleBinValue.js.map +1 -1
  242. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/partials/handleFocus.js.map +1 -1
  243. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/partials/handleIframeConfigFeedback.js.map +1 -1
  244. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/partials/isConfigured.js.map +1 -1
  245. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/partials/postMessageToAllIframes.js.map +1 -1
  246. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/partials/processAutoComplete.js.map +1 -1
  247. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/partials/processBrand.js.map +1 -1
  248. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/partials/validateForm.js.map +1 -1
  249. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/callbackUtils.js.map +1 -1
  250. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/destroySecuredFields.js.map +1 -1
  251. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/processErrors.js.map +1 -1
  252. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js +1 -1
  253. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js.map +1 -1
  254. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
  255. package/dist/es-legacy/components/internal/SecuredFields/lib/utilities/addContextTranslations.js.map +1 -1
  256. package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
  257. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  258. package/dist/es-legacy/components/internal/UIElement/utils.js.map +1 -1
  259. package/dist/es-legacy/components/internal/Voucher/utils.js.map +1 -1
  260. package/dist/es-legacy/core/Analytics/Analytics.js.map +1 -1
  261. package/dist/es-legacy/core/Analytics/constants.js.map +1 -1
  262. package/dist/es-legacy/core/Analytics/utils.js.map +1 -1
  263. package/dist/es-legacy/core/Errors/AdyenCheckoutError.js +1 -1
  264. package/dist/es-legacy/core/Errors/AdyenCheckoutError.js.map +1 -1
  265. package/dist/es-legacy/core/Errors/SRMessages.js.map +1 -1
  266. package/dist/es-legacy/core/Errors/constants.js.map +1 -1
  267. package/dist/es-legacy/core/Errors/utils.js.map +1 -1
  268. package/dist/es-legacy/core/Services/analytics/collect-id.js +1 -1
  269. package/dist/es-legacy/core/Services/http.js +1 -1
  270. package/dist/es-legacy/core/Services/http.js.map +1 -1
  271. package/dist/es-legacy/core/Services/sessions/constants.js +1 -1
  272. package/dist/es-legacy/core/Services/sessions/constants.js.map +1 -1
  273. package/dist/es-legacy/core/Services/sessions/create-order.js +1 -1
  274. package/dist/es-legacy/core/Services/sessions/create-order.js.map +1 -1
  275. package/dist/es-legacy/core/Services/sessions/make-payment.js +1 -1
  276. package/dist/es-legacy/core/Services/sessions/make-payment.js.map +1 -1
  277. package/dist/es-legacy/core/Services/sessions/setup-session.js.map +1 -1
  278. package/dist/es-legacy/core/Services/sessions/submit-details.js +1 -1
  279. package/dist/es-legacy/core/Services/sessions/submit-details.js.map +1 -1
  280. package/dist/es-legacy/core/core.js +1 -1
  281. package/dist/es-legacy/core/core.registry.js.map +1 -1
  282. package/dist/es-legacy/core/utils.js.map +1 -1
  283. package/dist/es-legacy/external/classnames/index.js.map +1 -1
  284. package/dist/es-legacy/external/preact/dist/preact.js +1 -1
  285. package/dist/es-legacy/external/preact/dist/preact.js.map +1 -1
  286. package/dist/es-legacy/language/Language.js.map +1 -1
  287. package/dist/es-legacy/language/utils.js.map +1 -1
  288. package/dist/es-legacy/utils/Storage.js.map +1 -1
  289. package/dist/es-legacy/utils/commonUtils.js.map +1 -1
  290. package/dist/es-legacy/utils/get-process-message-handler.js.map +1 -1
  291. package/dist/es-legacy/utils/getOrigin.js.map +1 -1
  292. package/dist/es-legacy/utils/useForm/reducer.js.map +1 -1
  293. package/dist/es-legacy/utils/useForm/useForm.js.map +1 -1
  294. package/package.json +19 -19
  295. package/styles/adyen.css +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"Card.js","sources":["../../../../src/components/Card/Card.tsx"],"sourcesContent":["import { h } from 'preact';\nimport CardInput from './components/CardInput';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport { BinLookupResponse, CardElementData, CardConfiguration } from './types';\nimport triggerBinLookUp from '../internal/SecuredFields/binLookup/triggerBinLookUp';\nimport { CbObjOnBinLookup, CbObjOnConfigSuccess, CbObjOnFocus } from '../internal/SecuredFields/lib/types';\nimport { fieldTypeToSnakeCase } from '../internal/SecuredFields/utils';\nimport { reject } from '../../utils/commonUtils';\nimport { hasValidInstallmentsObject } from './components/CardInput/utils';\nimport createClickToPayService from '../internal/ClickToPay/services/create-clicktopay-service';\nimport { ClickToPayCheckoutPayload, IClickToPayService } from '../internal/ClickToPay/services/types';\nimport ClickToPayWrapper from './components/ClickToPayWrapper';\nimport { ComponentFocusObject } from '../../types/global-types';\nimport SRPanelProvider from '../../core/Errors/SRPanelProvider';\nimport { TxVariants } from '../tx-variants';\nimport type { PayButtonFunctionProps, UIElementStatus } from '../internal/UIElement/types';\nimport UIElement from '../internal/UIElement';\nimport PayButton from '../internal/PayButton';\nimport type { ICore } from '../../core/types';\nimport {\n ANALYTICS_FOCUS_STR,\n ANALYTICS_CONFIGURED_STR,\n ANALYTICS_UNFOCUS_STR,\n ANALYTICS_VALIDATION_ERROR_STR,\n ANALYTICS_RENDERED_STR\n} from '../../core/Analytics/constants';\nimport { ALL_SECURED_FIELDS } from '../internal/SecuredFields/lib/constants';\nimport { FieldErrorAnalyticsObject, SendAnalyticsObject } from '../../core/Analytics/types';\nimport { hasOwnProperty } from '../../utils/hasOwnProperty';\nimport AdyenCheckoutError, { IMPLEMENTATION_ERROR } from '../../core/Errors/AdyenCheckoutError';\nimport { getErrorMessageFromCode } from '../../core/Errors/utils';\nimport { SF_ErrorCodes } from '../../core/Errors/constants';\nimport CardInputDefaultProps from './components/CardInput/defaultProps';\n\nexport class CardElement extends UIElement<CardConfiguration> {\n public static type = TxVariants.scheme;\n\n private readonly clickToPayService: IClickToPayService | null;\n\n /**\n * Reference to the 'ClickToPayComponent'\n */\n private clickToPayRef = null;\n\n constructor(checkout: ICore, props?: CardConfiguration) {\n super(checkout, props);\n\n if (props && !props._disableClickToPay) {\n this.clickToPayService = createClickToPayService(this.props.configuration, this.props.clickToPayConfiguration, this.props.environment);\n void this.clickToPayService?.initialize();\n }\n }\n\n protected static 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, props);\n }\n return this;\n }\n\n private setClickToPayRef = ref => {\n this.clickToPayRef = ref;\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 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 of a session should be used before falling back to the merchant configuration\n installmentOptions: props.session?.configuration?.installmentOptions || props.installmentOptions,\n enableStoreDetails,\n showStoreDetailsCheckbox,\n /**\n * Click to Pay configuration\n * - If email is set explicitly in the configuration, then it can override the one used in the session creation\n */\n clickToPayConfiguration: {\n ...props.clickToPayConfiguration,\n disableOtpAutoFocus: props.clickToPayConfiguration?.disableOtpAutoFocus || false,\n shopperEmail: props.clickToPayConfiguration?.shopperEmail || this.core.options?.session?.shopperEmail,\n telephoneNumber: props.clickToPayConfiguration?.telephoneNumber || this.core.options?.session?.telephoneNumber,\n locale: props.clickToPayConfiguration?.locale || props.i18n?.locale?.replace('-', '_')\n },\n ...(storedCardID && { storedPaymentMethodId: storedCardID })\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData(): CardElementData {\n /**\n * this.state.selectedBrandValue will be set when:\n * - /binLookup detects a single brand,\n * - when /binLookup detects a dual-branded card and the shopper makes a brand selection\n * - or, in the case of a storedCard\n */\n const cardBrand = this.state.selectedBrandValue;\n\n return {\n paymentMethod: {\n type: CardElement.type,\n ...this.state.data,\n ...(this.props.storedPaymentMethodId && {\n storedPaymentMethodId: this.props.storedPaymentMethodId,\n holderName: this.props.holderName ?? ''\n }),\n ...(cardBrand && { brand: cardBrand }),\n ...(this.props.fundingSource && { fundingSource: this.props.fundingSource })\n },\n ...(this.state.billingAddress && { billingAddress: this.state.billingAddress }),\n ...(this.state.socialSecurityNumber && { socialSecurityNumber: this.state.socialSecurityNumber }),\n ...this.storePaymentMethodPayload,\n ...(hasValidInstallmentsObject(this.state.installments) && { installments: this.state.installments }),\n browserInfo: this.browserInfo,\n origin: !!window && window.location.origin\n };\n }\n\n updateStyles(stylesObj) {\n if (this.componentRef?.updateStyles) this.componentRef.updateStyles(stylesObj);\n return this;\n }\n\n setFocusOn(fieldName) {\n if (this.componentRef?.setFocusOn) this.componentRef.setFocusOn(fieldName);\n return this;\n }\n\n public onBrand = event => {\n this.props.onBrand?.(event);\n };\n\n processBinLookupResponse(binLookupResponse: BinLookupResponse, isReset = false) {\n if (this.componentRef?.processBinLookupResponse) this.componentRef.processBinLookupResponse(binLookupResponse, isReset);\n return this;\n }\n\n handleUnsupportedCard(errObj) {\n if (this.componentRef?.handleUnsupportedCard) this.componentRef.handleUnsupportedCard(errObj);\n return this;\n }\n\n private handleClickToPaySubmit = (payload: ClickToPayCheckoutPayload) => {\n this.setState({ data: { ...payload }, valid: {}, errors: {}, isValid: true });\n this.submit();\n };\n\n onBinLookup(obj: CbObjOnBinLookup) {\n // Handler for regular card comp doesn't need this 'raw' data or to know about 'resets'\n if (!obj.isReset) {\n const nuObj = reject('supportedBrandsRaw').from(obj);\n this.props.onBinLookup?.(nuObj);\n }\n }\n\n protected submitAnalytics(analyticsObj: SendAnalyticsObject) {\n const { type } = analyticsObj;\n\n if (type === ANALYTICS_RENDERED_STR || type === ANALYTICS_CONFIGURED_STR) {\n // Check if it's a storedCard\n if (this.constructor['type'] === 'scheme') {\n if (hasOwnProperty(this.props, 'supportedShopperInteractions')) {\n analyticsObj.isStoredPaymentMethod = true;\n analyticsObj.brand = this.props.brand;\n }\n }\n }\n\n super.submitAnalytics(analyticsObj, this.props);\n }\n\n private onConfigSuccess = (obj: CbObjOnConfigSuccess) => {\n this.submitAnalytics({\n type: ANALYTICS_CONFIGURED_STR\n });\n\n this.props.onConfigSuccess?.(obj);\n };\n\n private onFocus = (obj: ComponentFocusObject) => {\n this.submitAnalytics({\n type: ANALYTICS_FOCUS_STR,\n target: fieldTypeToSnakeCase(obj.fieldType)\n });\n\n // Call merchant defined callback\n if (ALL_SECURED_FIELDS.includes(obj.fieldType)) {\n this.props.onFocus?.(obj.event as CbObjOnFocus);\n } else {\n this.props.onFocus?.(obj);\n }\n };\n\n private onBlur = (obj: ComponentFocusObject) => {\n this.submitAnalytics({\n type: ANALYTICS_UNFOCUS_STR,\n target: fieldTypeToSnakeCase(obj.fieldType)\n });\n\n // Call merchant defined callback\n if (ALL_SECURED_FIELDS.includes(obj.fieldType)) {\n this.props.onBlur?.(obj.event as CbObjOnFocus);\n } else {\n this.props.onBlur?.(obj);\n }\n };\n\n private onValidationErrorAnalytics = (obj: FieldErrorAnalyticsObject) => {\n this.submitAnalytics({\n type: ANALYTICS_VALIDATION_ERROR_STR,\n target: fieldTypeToSnakeCase(obj.fieldType),\n validationErrorCode: obj.errorCode,\n validationErrorMessage: getErrorMessageFromCode(obj.errorCode, SF_ErrorCodes)\n });\n };\n\n public onBinValue = triggerBinLookUp(this);\n\n get storePaymentMethodPayload() {\n const isStoredCard = this.props.storedPaymentMethodId?.length > 0;\n if (isStoredCard) {\n return {};\n }\n\n /**\n * For regular card, zero auth payments, we store the payment method, *if* the configuration says we should:\n * - For sessions, this means if the session has been created with storePaymentMethodMode: 'askForConsent'\n * - For the advanced flow, this means if the merchant has still set enableStoreDetails: true\n *\n * What we are doing is.. if for a normal payment we would show the \"Save for my next payment\" checkbox,\n * for a zero-auth payment we effectively click the checkbox on behalf of the shopper.\n */\n const isZeroAuth = this.props.amount?.value === 0;\n if (isZeroAuth) {\n return this.props.enableStoreDetails ? { storePaymentMethod: true } : {};\n }\n\n // For regular card, non-zero auth payments, we store the payment method based on the checkbox value.\n const includeStorePaymentMethod = this.props.showStoreDetailsCheckbox && typeof this.state.storePaymentMethod !== 'undefined';\n return includeStorePaymentMethod ? { storePaymentMethod: Boolean(this.state.storePaymentMethod) } : {};\n }\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n get icon() {\n return this.props.icon ?? this.resources.getImage()(this.props.brand);\n }\n\n get brands(): { icon: any; name: string }[] {\n const { brands, brandsConfiguration } = this.props;\n if (brands) {\n return brands.map(brand => {\n const brandIcon = brandsConfiguration[brand]?.icon ?? this.props.modules.resources.getImage()(brand);\n return { icon: brandIcon, name: brand };\n });\n }\n\n return [];\n }\n\n get displayName(): string {\n if (this.props.storedPaymentMethodId) {\n return `•••• ${this.props.lastFour}`;\n }\n\n return this.props.name || CardElement.type;\n }\n\n get accessibleName(): string {\n // Use display name, unless it's a stored payment method, there inform user\n return (\n (this.props.name || CardElement.type) +\n (this.props.storedPaymentMethodId\n ? ' ' + this.props.i18n.get('creditCard.storedCard.description.ariaLabel').replace('%@', this.props.lastFour)\n : '')\n );\n }\n\n get browserInfo() {\n return collectBrowserInfo();\n }\n\n protected override payButton = (props: PayButtonFunctionProps) => {\n const isZeroAuth = this.props.amount?.value === 0;\n const isStoredCard = this.props.storedPaymentMethodId?.length > 0;\n return (\n <PayButton\n {...props}\n amount={this.props.amount}\n secondaryAmount={this.props.secondaryAmount}\n label={isZeroAuth && !isStoredCard ? this.props.i18n.get('payButton.saveDetails') : ''}\n onClick={this.submit}\n />\n );\n };\n\n private renderCardInput(isCardPrimaryInput = true): h.JSX.Element {\n return (\n <CardInput\n setComponentRef={this.setComponentRef}\n {...this.props}\n {...this.state}\n onChange={this.setState}\n onSubmit={this.submit}\n 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 onValidationErrorAnalytics={this.onValidationErrorAnalytics}\n onConfigSuccess={this.onConfigSuccess}\n />\n );\n }\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <SRPanelProvider srPanel={this.props.modules.srPanel}>\n <ClickToPayWrapper\n amount={this.props.amount}\n configuration={this.props.clickToPayConfiguration}\n clickToPayService={this.clickToPayService}\n isStandaloneComponent={false}\n setClickToPayRef={this.setClickToPayRef}\n onSetStatus={this.setElementStatus}\n onSubmit={this.handleClickToPaySubmit}\n onError={this.handleError}\n >\n {isCardPrimaryInput => this.renderCardInput(isCardPrimaryInput)}\n </ClickToPayWrapper>\n </SRPanelProvider>\n </CoreProvider>\n );\n }\n}\n\nexport default CardElement;\n"],"names":["CardElement","UIElement","setStatus","status","props","this","componentRef","clickToPayRef","formatProps","enableStoreDetails","session","configuration","showStoreDetailsCheckbox","amount","value","storedCardID","storedPaymentMethodId","id","isEcommerceStoredCard","supportedShopperInteractions","includes","AdyenCheckoutError","IMPLEMENTATION_ERROR","holderNameRequired","hasHolderName","hasCVC","brand","hideCVC","billingAddressRequired","billingAddressMode","onAddressLookup","CardInputDefaultProps","TxVariants","card","countryCode","toLowerCase","socialSecurityNumberMode","brandsConfiguration","icon","installmentOptions","clickToPayConfiguration","disableOtpAutoFocus","shopperEmail","core","options","telephoneNumber","locale","i18n","replace","formatData","cardBrand","state","selectedBrandValue","paymentMethod","type","data","holderName","fundingSource","billingAddress","socialSecurityNumber","storePaymentMethodPayload","hasValidInstallmentsObject","installments","browserInfo","origin","window","location","updateStyles","stylesObj","setFocusOn","fieldName","processBinLookupResponse","binLookupResponse","isReset","handleUnsupportedCard","errObj","onBinLookup","obj","nuObj","reject","from","submitAnalytics","analyticsObj","ANALYTICS_RENDERED_STR","ANALYTICS_CONFIGURED_STR","constructor","hasOwnProperty","isStoredPaymentMethod","super","length","storePaymentMethod","Boolean","isValid","resources","getImage","brands","map","modules","name","displayName","lastFour","accessibleName","get","collectBrowserInfo","renderCardInput","isCardPrimaryInput","h","CardInput","setComponentRef","onChange","setState","onSubmit","submit","handleKeyPress","payButton","onBrand","onBinValue","brandsIcons","isPayButtonPrimaryVariant","onFocus","onBlur","onValidationErrorAnalytics","onConfigSuccess","render","CoreProvider","loadingContext","SRPanelProvider","srPanel","ClickToPayWrapper","clickToPayService","isStandaloneComponent","setClickToPayRef","onSetStatus","setElementStatus","handleClickToPaySubmit","onError","handleError","checkout","_define_property","ref","event","payload","valid","errors","ANALYTICS_FOCUS_STR","target","fieldTypeToSnakeCase","fieldType","ALL_SECURED_FIELDS","ANALYTICS_UNFOCUS_STR","ANALYTICS_VALIDATION_ERROR_STR","validationErrorCode","errorCode","validationErrorMessage","getErrorMessageFromCode","SF_ErrorCodes","triggerBinLookUp","isZeroAuth","isStoredCard","PayButton","secondaryAmount","label","onClick","_disableClickToPay","createClickToPayService","environment","initialize","scheme","defaultProps","showFormInstruction","doBinLookup"],"mappings":"2hDAmCO,MAAMA,UAAoBC,EA2BtBC,SAAAA,CAAUC,EAAyBC,GAOtC,OANIC,K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AAKD,MAAM4J,gBAC5BC,MAAOJ,IAAeC,EAAezJ,KAAKD,MAAM2C,KAAKuD,IAAI,yBAA2B,GACpF4D,QAAS7J,KAAK2G,YAtSlB5G,IAAUA,EAAM+J,qBAChB9J,KAAK4H,kBAAoBmC,EAAwB/J,KAAKD,MAAMO,cAAeN,KAAKD,MAAMoC,wBAAyBnC,KAAKD,MAAMiK,aACrHhK,KAAK4H,mBAAmBqC,aAErC,EAhBA5B,EADS1I,EACKsD,OAAOtB,EAAWuI,QAkBhC7B,EAnBS1I,EAmBQwK,eAAe,CAC5BC,qBAAqB,EACrBN,oBAAoB,EACpBO,aAAa,KAEV3F,EAAO,CAAC,OAAQ,oBAAoBC,KAAKjD"}
1
+ {"version":3,"file":"Card.js","sources":["../../../../src/components/Card/Card.tsx"],"sourcesContent":["import { h } from 'preact';\nimport CardInput from './components/CardInput';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport { BinLookupResponse, CardElementData, CardConfiguration } from './types';\nimport triggerBinLookUp from '../internal/SecuredFields/binLookup/triggerBinLookUp';\nimport { CardBinLookupData, CardConfigSuccessData, CardFocusData } from '../internal/SecuredFields/lib/types';\nimport { fieldTypeToSnakeCase } from '../internal/SecuredFields/utils';\nimport { reject } from '../../utils/commonUtils';\nimport { hasValidInstallmentsObject } from './components/CardInput/utils';\nimport createClickToPayService from '../internal/ClickToPay/services/create-clicktopay-service';\nimport { ClickToPayCheckoutPayload, IClickToPayService } from '../internal/ClickToPay/services/types';\nimport ClickToPayWrapper from './components/ClickToPayWrapper';\nimport { ComponentFocusObject } from '../../types/global-types';\nimport SRPanelProvider from '../../core/Errors/SRPanelProvider';\nimport { TxVariants } from '../tx-variants';\nimport type { PayButtonFunctionProps, UIElementStatus } from '../internal/UIElement/types';\nimport UIElement from '../internal/UIElement';\nimport PayButton from '../internal/PayButton';\nimport type { ICore } from '../../core/types';\nimport {\n ANALYTICS_FOCUS_STR,\n ANALYTICS_CONFIGURED_STR,\n ANALYTICS_UNFOCUS_STR,\n ANALYTICS_VALIDATION_ERROR_STR,\n ANALYTICS_RENDERED_STR\n} from '../../core/Analytics/constants';\nimport { ALL_SECURED_FIELDS } from '../internal/SecuredFields/lib/constants';\nimport { FieldErrorAnalyticsObject, SendAnalyticsObject } from '../../core/Analytics/types';\nimport { hasOwnProperty } from '../../utils/hasOwnProperty';\nimport AdyenCheckoutError, { IMPLEMENTATION_ERROR } from '../../core/Errors/AdyenCheckoutError';\nimport { getErrorMessageFromCode } from '../../core/Errors/utils';\nimport { SF_ErrorCodes } from '../../core/Errors/constants';\nimport CardInputDefaultProps from './components/CardInput/defaultProps';\n\nexport class CardElement extends UIElement<CardConfiguration> {\n public static type = TxVariants.scheme;\n\n private readonly clickToPayService: IClickToPayService | null;\n\n /**\n * Reference to the 'ClickToPayComponent'\n */\n private clickToPayRef = null;\n\n constructor(checkout: ICore, props?: CardConfiguration) {\n super(checkout, props);\n\n if (props && !props._disableClickToPay) {\n this.clickToPayService = createClickToPayService(this.props.configuration, this.props.clickToPayConfiguration, this.props.environment);\n void this.clickToPayService?.initialize();\n }\n }\n\n protected static 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, props);\n }\n return this;\n }\n\n private setClickToPayRef = ref => {\n this.clickToPayRef = ref;\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 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 of a session should be used before falling back to the merchant configuration\n installmentOptions: props.session?.configuration?.installmentOptions || props.installmentOptions,\n enableStoreDetails,\n showStoreDetailsCheckbox,\n /**\n * Click to Pay configuration\n * - If email is set explicitly in the configuration, then it can override the one used in the session creation\n */\n clickToPayConfiguration: {\n ...props.clickToPayConfiguration,\n disableOtpAutoFocus: props.clickToPayConfiguration?.disableOtpAutoFocus || false,\n shopperEmail: props.clickToPayConfiguration?.shopperEmail || this.core.options?.session?.shopperEmail,\n telephoneNumber: props.clickToPayConfiguration?.telephoneNumber || this.core.options?.session?.telephoneNumber,\n locale: props.clickToPayConfiguration?.locale || props.i18n?.locale?.replace('-', '_')\n },\n ...(storedCardID && { storedPaymentMethodId: storedCardID })\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData(): CardElementData {\n /**\n * this.state.selectedBrandValue will be set when:\n * - /binLookup detects a single brand,\n * - when /binLookup detects a dual-branded card and the shopper makes a brand selection\n * - or, in the case of a storedCard\n */\n const cardBrand = this.state.selectedBrandValue;\n\n return {\n paymentMethod: {\n type: CardElement.type,\n ...this.state.data,\n ...(this.props.storedPaymentMethodId && {\n storedPaymentMethodId: this.props.storedPaymentMethodId,\n holderName: this.props.holderName ?? ''\n }),\n ...(cardBrand && { brand: cardBrand }),\n ...(this.props.fundingSource && { fundingSource: this.props.fundingSource })\n },\n ...(this.state.billingAddress && { billingAddress: this.state.billingAddress }),\n ...(this.state.socialSecurityNumber && { socialSecurityNumber: this.state.socialSecurityNumber }),\n ...this.storePaymentMethodPayload,\n ...(hasValidInstallmentsObject(this.state.installments) && { installments: this.state.installments }),\n browserInfo: this.browserInfo,\n origin: !!window && window.location.origin\n };\n }\n\n updateStyles(stylesObj) {\n if (this.componentRef?.updateStyles) this.componentRef.updateStyles(stylesObj);\n return this;\n }\n\n setFocusOn(fieldName) {\n if (this.componentRef?.setFocusOn) this.componentRef.setFocusOn(fieldName);\n return this;\n }\n\n public onBrand = event => {\n this.props.onBrand?.(event);\n };\n\n processBinLookupResponse(binLookupResponse: BinLookupResponse, isReset = false) {\n if (this.componentRef?.processBinLookupResponse) this.componentRef.processBinLookupResponse(binLookupResponse, isReset);\n return this;\n }\n\n handleUnsupportedCard(errObj) {\n if (this.componentRef?.handleUnsupportedCard) this.componentRef.handleUnsupportedCard(errObj);\n return this;\n }\n\n private handleClickToPaySubmit = (payload: ClickToPayCheckoutPayload) => {\n this.setState({ data: { ...payload }, valid: {}, errors: {}, isValid: true });\n this.submit();\n };\n\n onBinLookup(obj: 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 protected submitAnalytics(analyticsObj: SendAnalyticsObject) {\n const { type } = analyticsObj;\n\n if (type === ANALYTICS_RENDERED_STR || type === ANALYTICS_CONFIGURED_STR) {\n // Check if it's a storedCard\n if (this.constructor['type'] === 'scheme') {\n if (hasOwnProperty(this.props, 'supportedShopperInteractions')) {\n analyticsObj.isStoredPaymentMethod = true;\n analyticsObj.brand = this.props.brand;\n }\n }\n }\n\n super.submitAnalytics(analyticsObj, this.props);\n }\n\n private onConfigSuccess = (obj: CardConfigSuccessData) => {\n this.submitAnalytics({\n type: ANALYTICS_CONFIGURED_STR\n });\n\n this.props.onConfigSuccess?.(obj);\n };\n\n private onFocus = (obj: ComponentFocusObject) => {\n this.submitAnalytics({\n type: ANALYTICS_FOCUS_STR,\n target: fieldTypeToSnakeCase(obj.fieldType)\n });\n\n // Call merchant defined callback\n if (ALL_SECURED_FIELDS.includes(obj.fieldType)) {\n this.props.onFocus?.(obj.event as CardFocusData);\n } else {\n this.props.onFocus?.(obj);\n }\n };\n\n private onBlur = (obj: ComponentFocusObject) => {\n this.submitAnalytics({\n type: ANALYTICS_UNFOCUS_STR,\n target: fieldTypeToSnakeCase(obj.fieldType)\n });\n\n // Call merchant defined callback\n if (ALL_SECURED_FIELDS.includes(obj.fieldType)) {\n this.props.onBlur?.(obj.event as CardFocusData);\n } else {\n this.props.onBlur?.(obj);\n }\n };\n\n private onValidationErrorAnalytics = (obj: FieldErrorAnalyticsObject) => {\n this.submitAnalytics({\n type: ANALYTICS_VALIDATION_ERROR_STR,\n target: fieldTypeToSnakeCase(obj.fieldType),\n validationErrorCode: obj.errorCode,\n validationErrorMessage: getErrorMessageFromCode(obj.errorCode, SF_ErrorCodes)\n });\n };\n\n public onBinValue = triggerBinLookUp(this);\n\n get storePaymentMethodPayload() {\n const isStoredCard = this.props.storedPaymentMethodId?.length > 0;\n if (isStoredCard) {\n return {};\n }\n\n /**\n * For regular card, zero auth payments, we store the payment method, *if* the configuration says we should:\n * - For sessions, this means if the session has been created with storePaymentMethodMode: 'askForConsent'\n * - For the advanced flow, this means if the merchant has still set enableStoreDetails: true\n *\n * What we are doing is.. if for a normal payment we would show the \"Save for my next payment\" checkbox,\n * for a zero-auth payment we effectively click the checkbox on behalf of the shopper.\n */\n const isZeroAuth = this.props.amount?.value === 0;\n if (isZeroAuth) {\n return this.props.enableStoreDetails ? { storePaymentMethod: true } : {};\n }\n\n // For regular card, non-zero auth payments, we store the payment method based on the checkbox value.\n const includeStorePaymentMethod = this.props.showStoreDetailsCheckbox && typeof this.state.storePaymentMethod !== 'undefined';\n return includeStorePaymentMethod ? { storePaymentMethod: Boolean(this.state.storePaymentMethod) } : {};\n }\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n get icon() {\n return this.props.icon ?? this.resources.getImage()(this.props.brand);\n }\n\n get brands(): { icon: any; name: string }[] {\n const { brands, brandsConfiguration } = this.props;\n if (brands) {\n return brands.map(brand => {\n const brandIcon = brandsConfiguration[brand]?.icon ?? this.props.modules.resources.getImage()(brand);\n return { icon: brandIcon, name: brand };\n });\n }\n\n return [];\n }\n\n get displayName(): string {\n if (this.props.storedPaymentMethodId) {\n return `•••• ${this.props.lastFour}`;\n }\n\n return this.props.name || CardElement.type;\n }\n\n get accessibleName(): string {\n // Use display name, unless it's a stored payment method, there inform user\n return (\n (this.props.name || CardElement.type) +\n (this.props.storedPaymentMethodId\n ? ' ' + this.props.i18n.get('creditCard.storedCard.description.ariaLabel').replace('%@', this.props.lastFour)\n : '')\n );\n }\n\n get browserInfo() {\n return collectBrowserInfo();\n }\n\n protected override payButton = (props: PayButtonFunctionProps) => {\n const isZeroAuth = this.props.amount?.value === 0;\n const isStoredCard = this.props.storedPaymentMethodId?.length > 0;\n return (\n <PayButton\n {...props}\n amount={this.props.amount}\n secondaryAmount={this.props.secondaryAmount}\n label={isZeroAuth && !isStoredCard ? this.props.i18n.get('payButton.saveDetails') : ''}\n onClick={this.submit}\n />\n );\n };\n\n private renderCardInput(isCardPrimaryInput = true): h.JSX.Element {\n return (\n <CardInput\n setComponentRef={this.setComponentRef}\n {...this.props}\n {...this.state}\n onChange={this.setState}\n onSubmit={this.submit}\n 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 onValidationErrorAnalytics={this.onValidationErrorAnalytics}\n onConfigSuccess={this.onConfigSuccess}\n />\n );\n }\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <SRPanelProvider srPanel={this.props.modules.srPanel}>\n <ClickToPayWrapper\n amount={this.props.amount}\n configuration={this.props.clickToPayConfiguration}\n clickToPayService={this.clickToPayService}\n isStandaloneComponent={false}\n setClickToPayRef={this.setClickToPayRef}\n onSetStatus={this.setElementStatus}\n onSubmit={this.handleClickToPaySubmit}\n onError={this.handleError}\n >\n {isCardPrimaryInput => this.renderCardInput(isCardPrimaryInput)}\n </ClickToPayWrapper>\n </SRPanelProvider>\n </CoreProvider>\n );\n }\n}\n\nexport default CardElement;\n"],"names":["CardElement","UIElement","setStatus","status","props","this","componentRef","clickToPayRef","formatProps","enableStoreDetails","session","configuration","showStoreDetailsCheckbox","amount","value","storedCardID","storedPaymentMethodId","id","isEcommerceStoredCard","supportedShopperInteractions","includes","AdyenCheckoutError","IMPLEMENTATION_ERROR","holderNameRequired","hasHolderName","hasCVC","brand","hideCVC","billingAddressRequired","billingAddressMode","onAddressLookup","CardInputDefaultProps","TxVariants","card","countryCode","toLowerCase","socialSecurityNumberMode","brandsConfiguration","icon","installmentOptions","clickToPayConfiguration","disableOtpAutoFocus","shopperEmail","core","options","telephoneNumber","locale","i18n","replace","formatData","cardBrand","state","selectedBrandValue","paymentMethod","type","data","holderName","fundingSource","billingAddress","socialSecurityNumber","storePaymentMethodPayload","hasValidInstallmentsObject","installments","browserInfo","origin","window","location","updateStyles","stylesObj","setFocusOn","fieldName","processBinLookupResponse","binLookupResponse","isReset","handleUnsupportedCard","errObj","onBinLookup","obj","nuObj","reject","from","submitAnalytics","analyticsObj","ANALYTICS_RENDERED_STR","ANALYTICS_CONFIGURED_STR","constructor","hasOwnProperty","isStoredPaymentMethod","super","length","storePaymentMethod","Boolean","isValid","resources","getImage","brands","map","modules","name","displayName","lastFour","accessibleName","get","collectBrowserInfo","renderCardInput","isCardPrimaryInput","h","CardInput","setComponentRef","onChange","setState","onSubmit","submit","handleKeyPress","payButton","onBrand","onBinValue","brandsIcons","isPayButtonPrimaryVariant","onFocus","onBlur","onValidationErrorAnalytics","onConfigSuccess","render","CoreProvider","loadingContext","SRPanelProvider","srPanel","ClickToPayWrapper","clickToPayService","isStandaloneComponent","setClickToPayRef","onSetStatus","setElementStatus","handleClickToPaySubmit","onError","handleError","checkout","_define_property","ref","event","payload","valid","errors","ANALYTICS_FOCUS_STR","target","fieldTypeToSnakeCase","fieldType","ALL_SECURED_FIELDS","ANALYTICS_UNFOCUS_STR","ANALYTICS_VALIDATION_ERROR_STR","validationErrorCode","errorCode","validationErrorMessage","getErrorMessageFromCode","SF_ErrorCodes","triggerBinLookUp","isZeroAuth","isStoredCard","PayButton","secondaryAmount","label","onClick","_disableClickToPay","createClickToPayService","environment","initialize","scheme","defaultProps","showFormInstruction","doBinLookup"],"mappings":"2hDAmCO,MAAMA,UAAoBC,EA2BtBC,SAAAA,CAAUC,EAAyBC,GAOtC,OANIC,KAAKC,cAAcJ,WACnBG,KA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,MAAM4J,gBAC5BC,MAAOJ,IAAeC,EAAezJ,KAAKD,MAAM2C,KAAKuD,IAAI,yBAA2B,GACpF4D,QAAS7J,KAAK2G,YAtSlB5G,IAAUA,EAAM+J,qBAChB9J,KAAK4H,kBAAoBmC,EAAwB/J,KAAKD,MAAMO,cAAeN,KAAKD,MAAMoC,wBAAyBnC,KAAKD,MAAMiK,aACrHhK,KAAK4H,mBAAmBqC,aAErC,EAhBA5B,EADS1I,EACKsD,OAAOtB,EAAWuI,QAkBhC7B,EAnBS1I,EAmBQwK,eAAe,CAC5BC,qBAAqB,EACrBN,oBAAoB,EACpBO,aAAa,KAEV3F,EAAO,CAAC,OAAQ,oBAAoBC,KAAKjD"}
@@ -1,2 +1,2 @@
1
- import{createElement as e,Fragment as r}from"../../../../external/preact/dist/preact.js";import{useRef as s,useMemo as t,useState as o,useCallback as n,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{cardInputFormatters as p,cardInputValidationRules as h,getRuleByNameAndMode as f}from"./validate.js";import y from"../../../internal/SecuredFields/binLookup/extensions.js";import b from"../../../../utils/useForm/useForm.js";import{handlePartialAddressMode as N,extractPropsForSFP as S,extractPropsForCardFields as g,getLayout as A}from"./utils.js";import F from"../../../internal/Address/Specifications.js";import{StoredCardFieldsWrapper as C}from"./components/StoredCardFieldsWrapper.js";import{CardFieldsWrapper as j}from"./components/CardFieldsWrapper.js";import{getAutoJumpHandler as k,getFocusHandler as x,getAddressHandler as R}from"./handlers.js";import P from"../../../../external/classnames/index.js";import{getPartialAddressValidationRules as v}from"../../../internal/Address/validate.js";import w from"../../../../core/Context/useImage.js";import{getArrayDifferences as I}from"../../../../utils/arrayUtils.js";import B from"../../../internal/FormInstruction/FormInstruction.js";import{PREFIX as V}from"../../../internal/Icon/constants.js";import E from"./useSRPanelForCardInputErrors.js";const O=l=>{const O=s(null),q=s(!1),M=w(),D=s(null),_=e=>{D.current=e},L=s({});Object.keys(L.current).length||l.setComponentRef(L.current);const T=s(0),K=s(!1),H=t((()=>new F(l.specifications)),[l.specifications]);L.current.sfp=O;const[U,z]=o("ready"),[W,$]=o({}),[G,J]=o({...l.holderNameRequired&&{holderName:!1}}),[Q,X]=o({...l.hasHolderName&&{holderName:l.data.holderName??""}}),[Y,Z]=o(""),[ee,re]=o(!1),[se,te]=o(c),[oe,ne]=o(m),[ae,ie]=o(null),[le,de]=o([]),[ue,ce]=o(l.storedPaymentMethodId?l.brand:""),me=l.billingAddressMode!==d.none&&l.billingAddressRequired,pe=N(l.billingAddressMode),he=s(pe&&l.data?.billingAddress?.country),[fe,ye]=o(!1),[be,Ne]=o(me?l.data.billingAddress:null),[Se,ge]=o(!1),[Ae,Fe]=o(""),[Ce,je]=o({value:null}),[ke,xe]=o(null),{handleChangeFor:Re,triggerValidation:Pe,data:ve,valid:we,errors:Ie,setSchema:Be,setData:Ve,setValid:Ee,setErrors:Oe}=b({schema:[],defaultData:l.data,formatters:p,rules:h}),qe=!!Object.keys(l.installmentOptions).length&&"debit"!==l.fundingSource,Me=l.showInstallmentAmounts??!0,De="kr"===(ae??l.countryCode),_e=l.configuration.koreanAuthenticationRequired&&De,Le=Se&&"auto"===l.configuration.socialSecurityNumberMode||"show"===l.configuration.socialSecurityNumberMode,Te=(e,r)=>{l.onFocus({fieldType:e,event:r})},Ke=(e,r)=>{l.onBlur({fieldType:e,event:r})},He=x(Z,Te,Ke),Ue=()=>A({props:l,showKCP:_e,showBrazilianSSN:Le,...l.billingAddressRequired&&{countrySpecificSchemas:H.getAddressSchemaForCountry(be?.country),billingAddressRequiredFields:l.billingAddressRequiredFields}}),ze=n((e=>{const r="webInternalElement"!==e.fieldType?e.fieldType:e.name;xe(r)}),[]),We=R(Ve,Ee,Oe),$e=k(K,O,Ue()),Ge=t((()=>y(l,{sfp:O},{dualBrandSelectElements:le,setDualBrandSelectElements:de,setSelectedBrandValue:ce,issuingCountryCode:ae,setIssuingCountryCode:ie},T)),[le,ae]);L.current.showValidation=()=>{q.current=!0,Xe?.(),O.current.showValidation(),Pe(["holderName","socialSecurityNumber","taxNumber"]),D?.current&&D.current.showValidation()},L.current.processBinLookupResponse=(e,r)=>{Ge.processBinLookup(e,r)},L.current.setStatus=z,a((()=>(L.current.setFocusOn=O.current.setFocusOn,L.current.updateStyles=O.current.updateStyles,L.current.handleUnsupportedCard=O.current.handleUnsupportedCard,()=>{O.current.destroy()})),[]),a((()=>{const e=[...l.hasHolderName?["holderName"]:[],...Le?["socialSecurityNumber"]:[],..._e?["taxNumber"]:[],...me?["billingAddress"]:[]];Be(e)}),[l.hasHolderName,Le,_e]),a((()=>{X({...Q,holderName:ve.holderName??"",taxNumber:ve.taxNumber}),Fe(ve.socialSecurityNumber),me&&Ne({...ve.billingAddress}),J({...G,holderName:!l.holderNameRequired||we.holderName,socialSecurityNumber:!!we.socialSecurityNumber&&we.socialSecurityNumber,taxNumber:!!we.taxNumber&&we.taxNumber,billingAddress:!!we.billingAddress&&we.billingAddress});const e=!!Ie.billingAddress&&Object.entries(Ie.billingAddress).reduce(((e,[,r])=>e||null!=r),!1);$({...W,holderName:l.holderNameRequired&&Ie.holderName?Ie.holderName:null,socialSecurityNumber:Le&&Ie.socialSecurityNumber?Ie.socialSecurityNumber:null,taxNumber:_e&&Ie.taxNumber?Ie.taxNumber:null,billingAddress:me&&e?Ie.billingAddress:null})}),[ve,we,Ie]);const{sortedErrorList:Je,previousSortedErrors:Qe,clearSRPanel:Xe}=E({errors:W,props:l,isValidating:q,retrieveLayout:Ue,specifications:H,billingAddress:be,sfp:O});if(Je){const e=I(Je,Qe,"field");e?.forEach((e=>{const r={fieldType:e.field,errorCode:e.errorCode};l.onValidationErrorAnalytics(r)}))}a((()=>{const e=G.holderName,r=ee,s=!me||G.billingAddress,t=!_e||!!G.taxNumber&&!!G.encryptedPassword,o=!Le||!!G.socialSecurityNumber,n=r&&e&&s&&t&&o,a=O.current.mapErrorsToValidationRuleResult(),i={...W,...a};l.onChange({data:Q,valid:G,errors:i,isValid:n,billingAddress:be,selectedBrandValue:ue,storePaymentMethod:fe,socialSecurityNumber:Ae,installments:Ce})}),[Q,G,W,ue,fe,Ce]);const Ye=l.storedPaymentMethodId?C:j;return e(r,null,e(i,{ref:O,...S(l),styles:{...l.styles},koreanAuthenticationRequired:l.configuration.koreanAuthenticationRequired,hasKoreanFields:!(!l.configuration.koreanAuthenticationRequired||"kr"!==l.countryCode),onChange:(e,r)=>{if(e.autoCompleteName){if(!l.hasHolderName)return;const r=f("holderName","blur")(e.autoCompleteName)?e.autoCompleteName:null;r&&(Ve("holderName",r),Ee("holderName",!0),Oe("holderName",null))}else l.autoFocus&&T.current>0&&"handleOnFieldValid"===r?.event&&r?.fieldType===u&&e.valid.encryptedCardNumber&&$e(),X({...Q,...e.data}),$({...W,...e.errors}),J({...G,...e.valid}),re(e.isSfpValid),ne(e.cvcPolicy),ge(e.showSocialSecurityNumber),te(e.expiryDatePolicy)},onBrand:l.onBrand,onFocus:He,type:l.brand,disableIOSArrowKeys:l.disableIOSArrowKeys?ze:null,render:({setRootNode:r,setFocusOn:s},t)=>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"===U}),role:"form"},e(B,null),e(Ye,{...g(l),data:Q,valid:G,errors:W,handleChangeFor:Re,focusedElement:Y,setFocusOn:s,sfpState:t,cvcPolicy:oe,hasInstallments:qe,showAmountsInInstallments:Me,handleInstallments:je,brandsIcons:l.brandsIcons,formData:ve,formErrors:Ie,formValid:we,expiryDatePolicy:se,dualBrandSelectElements:le,extensions:Ge,selectedBrandValue:ue,showKCP:_e,showBrazilianSSN:Le,socialSecurityNumber:Ae,handleOnStoreDetails:ye,setAddressRef:_,billingAddress:be,billingAddressValidationRules:pe&&v(he.current),partialAddressSchema:pe,handleAddress:We,onAddressLookup:l.onAddressLookup,onAddressSelected:l.onAddressSelected,addressSearchDebounceMs:l.addressSearchDebounceMs,iOSFocusedField:ke,onFieldFocusAnalytics:Te,onFieldBlurAnalytics:Ke}))}),l.showPayButton&&l.payButton({status:U,variant:l.isPayButtonPrimaryVariant?"primary":"secondary",icon:M({imageFolder:"components/"})(`${V}lock`)}))};O.defaultProps=l;export{O as default};
1
+ import{createElement as e,Fragment as r}from"../../../../external/preact/dist/preact.js";import{useRef as s,useMemo as t,useState as o,useCallback as n,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{cardInputFormatters as p,cardInputValidationRules as h,getRuleByNameAndMode as b}from"./validate.js";import f from"../../../internal/SecuredFields/binLookup/extensions.js";import y from"../../../../utils/useForm/useForm.js";import{handlePartialAddressMode as N,extractPropsForSFP as S,extractPropsForCardFields as g,getLayout as A}from"./utils.js";import F from"../../../internal/Address/Specifications.js";import{StoredCardFieldsWrapper as C}from"./components/StoredCardFieldsWrapper.js";import{CardFieldsWrapper as j}from"./components/CardFieldsWrapper.js";import{getAutoJumpHandler as k,getFocusHandler as x,getAddressHandler as R}from"./handlers.js";import P from"../../../../external/classnames/index.js";import{getPartialAddressValidationRules as v}from"../../../internal/Address/validate.js";import w from"../../../../core/Context/useImage.js";import{getArrayDifferences as I}from"../../../../utils/arrayUtils.js";import B from"../../../internal/FormInstruction/FormInstruction.js";import{PREFIX as V}from"../../../internal/Icon/constants.js";import E from"./useSRPanelForCardInputErrors.js";const O=l=>{const O=s(null),q=s(!1),M=w(),D=s(null),_=e=>{D.current=e},L=s({});Object.keys(L.current).length||l.setComponentRef(L.current);const T=s(0),K=s(!1),H=t((()=>new F(l.specifications)),[l.specifications]);L.current.sfp=O;const[U,z]=o("ready"),[W,$]=o({}),[G,J]=o({...l.holderNameRequired&&{holderName:!1}}),[Q,X]=o({...l.hasHolderName&&{holderName:l.data.holderName??""}}),[Y,Z]=o(""),[ee,re]=o(!1),[se,te]=o(c),[oe,ne]=o(m),[ae,ie]=o(null),[le,de]=o([]),[ue,ce]=o(l.storedPaymentMethodId?l.brand:""),me=l.billingAddressMode!==d.none&&l.billingAddressRequired,pe=N(l.billingAddressMode),he=s(pe&&l.data?.billingAddress?.country),[be,fe]=o(!1),[ye,Ne]=o(me?l.data.billingAddress:null),[Se,ge]=o(!1),[Ae,Fe]=o(""),[Ce,je]=o({value:null}),[ke,xe]=o(null),[Re,Pe]=o("card"),{handleChangeFor:ve,triggerValidation:we,data:Ie,valid:Be,errors:Ve,setSchema:Ee,setData:Oe,setValid:qe,setErrors:Me}=y({schema:[],defaultData:l.data,formatters:p,rules:h}),De=!!Object.keys(l.installmentOptions).length&&"debit"!==l.fundingSource,_e=l.showInstallmentAmounts??!0,Le="kr"===(ae??l.countryCode),Te=l.configuration.koreanAuthenticationRequired&&Le,Ke=Se&&"auto"===l.configuration.socialSecurityNumberMode||"show"===l.configuration.socialSecurityNumberMode,He=(e,r)=>{l.onFocus({fieldType:e,event:r})},Ue=(e,r)=>{l.onBlur({fieldType:e,event:r})},ze=n((e=>{Pe(e.brand),l.onBrand(e)}),[]),We=x(Z,He,Ue),$e=()=>A({props:l,showKCP:Te,showBrazilianSSN:Ke,...l.billingAddressRequired&&{countrySpecificSchemas:H.getAddressSchemaForCountry(ye?.country),billingAddressRequiredFields:l.billingAddressRequiredFields}}),Ge=n((e=>{const r="webInternalElement"!==e.fieldType?e.fieldType:e.name;xe(r)}),[]),Je=R(Oe,qe,Me),Qe=k(K,O,$e()),Xe=t((()=>f(l,{sfp:O},{dualBrandSelectElements:le,setDualBrandSelectElements:de,setSelectedBrandValue:ce,issuingCountryCode:ae,setIssuingCountryCode:ie},T)),[le,ae]);L.current.showValidation=()=>{q.current=!0,er?.(),O.current.showValidation(),we(["holderName","socialSecurityNumber","taxNumber"]),D?.current&&D.current.showValidation()},L.current.processBinLookupResponse=(e,r)=>{Xe.processBinLookup(e,r)},L.current.setStatus=z,a((()=>(L.current.setFocusOn=O.current.setFocusOn,L.current.updateStyles=O.current.updateStyles,L.current.handleUnsupportedCard=O.current.handleUnsupportedCard,()=>{O.current.destroy()})),[]),a((()=>{const e=[...l.hasHolderName?["holderName"]:[],...Ke?["socialSecurityNumber"]:[],...Te?["taxNumber"]:[],...me?["billingAddress"]:[]];Ee(e)}),[l.hasHolderName,Ke,Te]),a((()=>{X({...Q,holderName:Ie.holderName??"",taxNumber:Ie.taxNumber}),Fe(Ie.socialSecurityNumber),me&&Ne({...Ie.billingAddress}),J({...G,holderName:!l.holderNameRequired||Be.holderName,socialSecurityNumber:!!Be.socialSecurityNumber&&Be.socialSecurityNumber,taxNumber:!!Be.taxNumber&&Be.taxNumber,billingAddress:!!Be.billingAddress&&Be.billingAddress});const e=!!Ve.billingAddress&&Object.entries(Ve.billingAddress).reduce(((e,[,r])=>e||null!=r),!1);$({...W,holderName:l.holderNameRequired&&Ve.holderName?Ve.holderName:null,socialSecurityNumber:Ke&&Ve.socialSecurityNumber?Ve.socialSecurityNumber:null,taxNumber:Te&&Ve.taxNumber?Ve.taxNumber:null,billingAddress:me&&e?Ve.billingAddress:null})}),[Ie,Be,Ve]);const{sortedErrorList:Ye,previousSortedErrors:Ze,clearSRPanel:er}=E({errors:W,props:l,isValidating:q,retrieveLayout:$e,specifications:H,billingAddress:ye,sfp:O});if(Ye){const e=I(Ye,Ze,"field");e?.forEach((e=>{const r={fieldType:e.field,errorCode:e.errorCode};l.onValidationErrorAnalytics(r)}))}a((()=>{const e=G.holderName,r=ee,s=!me||G.billingAddress,t=!Te||!!G.taxNumber&&!!G.encryptedPassword,o=!Ke||!!G.socialSecurityNumber,n=r&&e&&s&&t&&o,a=O.current.mapErrorsToValidationRuleResult(),i={...W,...a};l.onChange({data:Q,valid:G,errors:i,isValid:n,billingAddress:ye,selectedBrandValue:ue,storePaymentMethod:be,socialSecurityNumber:Ae,installments:Ce})}),[Q,G,W,ue,be,Ce]);const rr=l.storedPaymentMethodId?C:j;return e(r,null,e(i,{ref:O,...S(l),styles:{...l.styles},koreanAuthenticationRequired:l.configuration.koreanAuthenticationRequired,hasKoreanFields:!(!l.configuration.koreanAuthenticationRequired||"kr"!==l.countryCode),onChange:(e,r)=>{if(e.autoCompleteName){if(!l.hasHolderName)return;const r=b("holderName","blur")(e.autoCompleteName)?e.autoCompleteName:null;r&&(Oe("holderName",r),qe("holderName",!0),Me("holderName",null))}else l.autoFocus&&T.current>0&&"handleOnFieldValid"===r?.event&&r?.fieldType===u&&e.valid.encryptedCardNumber&&Qe(),X({...Q,...e.data}),$({...W,...e.errors}),J({...G,...e.valid}),re(e.isSfpValid),ne(e.cvcPolicy),ge(e.showSocialSecurityNumber),te(e.expiryDatePolicy)},onBrand:ze,onFocus:We,type:l.brand,disableIOSArrowKeys:l.disableIOSArrowKeys?Ge:null,render:({setRootNode:r,setFocusOn:s},t)=>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"===U}),role:"form"},e(B,null),e(rr,{...g(l),data:Q,valid:G,errors:W,handleChangeFor:ve,focusedElement:Y,setFocusOn:s,sfpState:t,cvcPolicy:oe,hasInstallments:De,showAmountsInInstallments:_e,handleInstallments:je,brandsIcons:l.brandsIcons,formData:Ie,formErrors:Ve,formValid:Be,expiryDatePolicy:se,dualBrandSelectElements:le,extensions:Xe,selectedBrandValue:ue,showKCP:Te,showBrazilianSSN:Ke,socialSecurityNumber:Ae,handleOnStoreDetails:fe,setAddressRef:_,billingAddress:ye,billingAddressValidationRules:pe&&v(he.current),partialAddressSchema:pe,handleAddress:Je,onAddressLookup:l.onAddressLookup,onAddressSelected:l.onAddressSelected,addressSearchDebounceMs:l.addressSearchDebounceMs,iOSFocusedField:ke,onFieldFocusAnalytics:He,onFieldBlurAnalytics:Ue}))}),l.showPayButton&&l.payButton({status:U,variant:l.isPayButtonPrimaryVariant?"primary":"secondary",icon:M({imageFolder:"components/"})(`${V}lock`)}))};O.defaultProps=l;export{O 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 } 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 { handlePartialAddressMode, extractPropsForCardFields, extractPropsForSFP, getLayout } 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 { InstallmentsObj } 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 { CbObjOnFocus } from '../../../internal/SecuredFields/lib/types';\nimport { FieldErrorAnalyticsObject } from '../../../../core/Analytics/types';\nimport { PREFIX } from '../../../internal/Icon/constants';\nimport useSRPanelForCardInputErrors from './useSRPanelForCardInputErrors';\n\nconst CardInput = (props: CardInputProps) => {\n const sfp = useRef(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 // 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([]);\n const [selectedBrandValue, setSelectedBrandValue] = useState(props.storedPaymentMethodId ? props.brand : ''); // If this is a storedCard comp initialise state with the storedCard's brand\n\n const showBillingAddress = props.billingAddressMode !== AddressModeOptions.none && props.billingAddressRequired;\n\n const partialAddressSchema = handlePartialAddressMode(props.billingAddressMode);\n // Keeps the value of the country set initially by the merchant, before the Address Component mutates it\n const partialAddressCountry = useRef<string>(partialAddressSchema && props.data?.billingAddress?.country);\n\n const [storePaymentMethod, setStorePaymentMethod] = useState(false);\n const [billingAddress, setBillingAddress] = useState<AddressData>(showBillingAddress ? props.data.billingAddress : null);\n const [showSocialSecurityNumber, setShowSocialSecurityNumber] = useState(false);\n const [socialSecurityNumber, setSocialSecurityNumber] = useState('');\n const [installments, setInstallments] = useState<InstallmentsObj>({ value: null });\n\n // re. Disable arrows for iOS: The name of the element calling for other elements to be disabled\n // - either a securedField type (like 'encryptedCardNumber') when call is coming from SF\n // or else the name of an internal, Adyen-web, element (like 'holderName')\n const [iOSFocusedField, setIOSFocusedField] = useState(null);\n\n /**\n * LOCAL VARS\n */\n const {\n handleChangeFor,\n triggerValidation,\n data: formData,\n valid: formValid,\n errors: formErrors,\n setSchema,\n setData: setFormData,\n setValid: setFormValid,\n setErrors: setFormErrors\n } = useForm<CardInputDataState>({\n schema: [],\n defaultData: props.data,\n formatters: cardInputFormatters,\n rules: cardInputValidationRules\n });\n\n const hasInstallments = !!Object.keys(props.installmentOptions).length && props.fundingSource !== 'debit';\n const showAmountsInInstallments = props.showInstallmentAmounts ?? true;\n\n const cardCountryCode: string = issuingCountryCode ?? props.countryCode;\n const isKorea = cardCountryCode === 'kr'; // If issuingCountryCode or the merchant defined countryCode is set to 'kr'\n const showKCP = props.configuration.koreanAuthenticationRequired && isKorea;\n\n const showBrazilianSSN: boolean =\n (showSocialSecurityNumber && props.configuration.socialSecurityNumberMode === 'auto') ||\n props.configuration.socialSecurityNumberMode === 'show';\n\n /**\n * HANDLERS\n */\n // Handlers for focus & blur on all fields. Can be renamed to onFieldFocus once the onFocusField is renamed in Field.tsx\n const onFieldFocusAnalytics = (who: string, e: Event | CbObjOnFocus) => {\n props.onFocus({ fieldType: who, event: e });\n };\n const onFieldBlurAnalytics = (who: string, e: Event | CbObjOnFocus) => {\n props.onBlur({ fieldType: who, event: e });\n };\n\n // Make SecuredFields aware of the focus & blur handlers\n const handleFocus = getFocusHandler(setFocusedElement, onFieldFocusAnalytics, onFieldBlurAnalytics);\n\n const retrieveLayout = (): string[] => {\n return getLayout({\n props,\n showKCP,\n showBrazilianSSN,\n ...(props.billingAddressRequired && {\n countrySpecificSchemas: specifications.getAddressSchemaForCountry(billingAddress?.country),\n billingAddressRequiredFields: props.billingAddressRequiredFields\n })\n });\n };\n\n /**\n * re. Disabling arrow keys in iOS:\n * Only by disabling all fields in the Card PM except for the active securedField input can we force the iOS soft keyboard arrow keys to disable\n *\n * NOTE: only called if ua.__IS_IOS = true && this.config.disableIOSArrowKeys = true (as referenced in CSF)\n *\n * @param obj - has fieldType prop saying whether this function is being called in response to an securedFields click ('encryptedCardNumber' etc)\n * - in which case we should disable all non-SF fields\n * or,\n * due to an internal action ('webInternalElement') - in which case we can enable all non-SF fields\n */\n const handleTouchstartIOS = useCallback((obj: TouchStartEventObj) => {\n const elementType = obj.fieldType !== 'webInternalElement' ? obj.fieldType : obj.name;\n setIOSFocusedField(elementType);\n }, []);\n\n const handleAddress = getAddressHandler(setFormData, setFormValid, setFormErrors);\n\n const doPanAutoJump = getAutoJumpHandler(isAutoJumping, sfp, retrieveLayout());\n\n const handleSecuredFieldsChange = (sfState: SFPState, eventDetails?: OnChangeEventDetails): void => {\n /**\n * Handling auto complete value for holderName (but only if the component is using a holderName field)\n */\n if (sfState.autoCompleteName) {\n if (!props.hasHolderName) return;\n const holderNameValidationFn = getRuleByNameAndMode('holderName', 'blur');\n const acHolderName = holderNameValidationFn(sfState.autoCompleteName) ? sfState.autoCompleteName : null;\n if (acHolderName) {\n setFormData('holderName', acHolderName);\n setFormValid('holderName', true); // only if holderName is valid does this fny get called - so we know it's valid and w/o error\n setFormErrors('holderName', null);\n }\n return;\n }\n\n /**\n * Decide if we can shift focus to the expiryDate field.\n *\n * We can if... the config prop, autoFocus, is true AND we have a panLength value from binLookup\n * AND we are responding to a handleOnFieldValid message about the PAN that says it is valid\n */\n if (\n props.autoFocus &&\n hasPanLengthRef.current > 0 &&\n eventDetails?.event === 'handleOnFieldValid' &&\n eventDetails?.fieldType === ENCRYPTED_CARD_NUMBER &&\n sfState.valid.encryptedCardNumber\n ) {\n doPanAutoJump();\n }\n\n /**\n * Process SFP state\n */\n setData({ ...data, ...sfState.data });\n setErrors({ ...errors, ...sfState.errors });\n setValid({ ...valid, ...sfState.valid });\n\n setIsSfpValid(sfState.isSfpValid);\n\n // Values relating to /binLookup response\n setCvcPolicy(sfState.cvcPolicy);\n setShowSocialSecurityNumber(sfState.showSocialSecurityNumber);\n setExpiryDatePolicy(sfState.expiryDatePolicy);\n };\n\n // Farm the handlers for binLookup related functionality out to another 'extensions' file\n const extensions = useMemo(\n () =>\n CIExtensions(\n props,\n { sfp },\n {\n dualBrandSelectElements,\n setDualBrandSelectElements,\n setSelectedBrandValue,\n issuingCountryCode,\n setIssuingCountryCode\n },\n hasPanLengthRef\n ),\n [dualBrandSelectElements, issuingCountryCode]\n );\n\n /**\n * EXPOSE METHODS expected by Card.tsx\n */\n cardInputRef.current.showValidation = () => {\n // set flag\n isValidating.current = true;\n\n /**\n * Clear errors prior to validating so that the screenreader will read them *all* again, and in the right order\n * - only using aria-atomic on the error panel will read them in the wrong order\n */\n clearSRPanel?.(); // TODO - recheck if this is still true\n\n // Validate SecuredFields\n sfp.current.showValidation();\n\n // Validate holderName & SSN & KCP (taxNumber) but *not* billingAddress\n triggerValidation(['holderName', 'socialSecurityNumber', 'taxNumber']);\n\n // Validate Address\n if (billingAddressRef?.current) billingAddressRef.current.showValidation();\n };\n\n cardInputRef.current.processBinLookupResponse = (binLookupResponse: BinLookupResponse, isReset: boolean) => {\n extensions.processBinLookup(binLookupResponse, isReset);\n };\n\n cardInputRef.current.setStatus = setStatus;\n\n /**\n * EFFECT HOOKS\n */\n useEffect(() => {\n // componentDidMount - expose more methods expected by Card.tsx\n cardInputRef.current.setFocusOn = sfp.current.setFocusOn;\n cardInputRef.current.updateStyles = sfp.current.updateStyles;\n cardInputRef.current.handleUnsupportedCard = sfp.current.handleUnsupportedCard;\n\n // componentWillUnmount\n return () => {\n sfp.current.destroy();\n };\n }, []);\n\n /**\n * Handle form schema updates\n */\n useEffect(() => {\n const newSchema = [\n ...(props.hasHolderName ? ['holderName'] : []),\n ...(showBrazilianSSN ? ['socialSecurityNumber'] : []),\n ...(showKCP ? ['taxNumber'] : []),\n ...(showBillingAddress ? ['billingAddress'] : [])\n ];\n setSchema(newSchema);\n }, [props.hasHolderName, showBrazilianSSN, showKCP]);\n\n /**\n * Handle updates from useForm\n */\n useEffect(() => {\n setData({ ...data, holderName: formData.holderName ?? '', taxNumber: formData.taxNumber });\n\n setSocialSecurityNumber(formData.socialSecurityNumber);\n\n if (showBillingAddress) setBillingAddress({ ...formData.billingAddress });\n\n setValid({\n ...valid,\n holderName: props.holderNameRequired ? formValid.holderName : true,\n // Setting value to false if it's falsy keeps in line with existing, expected behaviour\n // - but there is an argument to allow 'undefined' as a value to indicate the non-presence of the field\n socialSecurityNumber: formValid.socialSecurityNumber ? formValid.socialSecurityNumber : false,\n taxNumber: formValid.taxNumber ? formValid.taxNumber : false,\n billingAddress: formValid.billingAddress ? formValid.billingAddress : false\n });\n\n // Check if billingAddress errors object has any properties that aren't null or undefined\n const addressHasErrors = formErrors.billingAddress\n ? Object.entries(formErrors.billingAddress).reduce((acc, [, error]) => acc || error != null, false)\n : false;\n\n // Errors\n setErrors({\n ...errors,\n holderName: props.holderNameRequired && !!formErrors.holderName ? formErrors.holderName : null,\n socialSecurityNumber: showBrazilianSSN && !!formErrors.socialSecurityNumber ? formErrors.socialSecurityNumber : null,\n taxNumber: showKCP && !!formErrors.taxNumber ? formErrors.taxNumber : null,\n billingAddress: showBillingAddress && addressHasErrors ? formErrors.billingAddress : null\n });\n }, [formData, formValid, formErrors]);\n\n // 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 if (currentErrorsSortedByLayout) {\n const newErrors = getArrayDifferences<SortedErrorObject, string>(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n newErrors?.forEach(errorItem => {\n const aObj: FieldErrorAnalyticsObject = {\n fieldType: errorItem.field,\n errorCode: errorItem.errorCode\n };\n\n props.onValidationErrorAnalytics(aObj);\n });\n }\n\n /**\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 * RENDER\n */\n const FieldToRender = props.storedPaymentMethodId ? StoredCardFieldsWrapper : CardFieldsWrapper;\n\n return (\n <Fragment>\n <SecuredFieldsProvider\n ref={sfp}\n {...extractPropsForSFP(props)}\n styles={{ ...props.styles }}\n koreanAuthenticationRequired={props.configuration.koreanAuthenticationRequired}\n hasKoreanFields={!!(props.configuration.koreanAuthenticationRequired && props.countryCode === 'kr')}\n onChange={handleSecuredFieldsChange}\n onBrand={props.onBrand}\n onFocus={handleFocus}\n type={props.brand}\n disableIOSArrowKeys={props.disableIOSArrowKeys ? handleTouchstartIOS : null}\n render={({ setRootNode, setFocusOn }, sfpState) => (\n <div\n ref={setRootNode}\n className={classNames({\n 'adyen-checkout__card-input': true,\n 'adyen-checkout-card-input__wrapper': true,\n [`adyen-checkout__card-input--${props.fundingSource ?? 'credit'}`]: true,\n 'adyen-checkout__card-input--loading': status === 'loading'\n })}\n role={'form'}\n >\n <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 {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","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","handleChangeFor","triggerValidation","formData","formValid","formErrors","setSchema","setFormData","setFormValid","setFormErrors","useForm","schema","defaultData","formatters","cardInputFormatters","rules","cardInputValidationRules","hasInstallments","installmentOptions","fundingSource","showAmountsInInstallments","showInstallmentAmounts","isKorea","countryCode","showKCP","configuration","koreanAuthenticationRequired","showBrazilianSSN","socialSecurityNumberMode","onFieldFocusAnalytics","who","e","onFocus","fieldType","event","onFieldBlurAnalytics","onBlur","handleFocus","getFocusHandler","retrieveLayout","getLayout","countrySpecificSchemas","getAddressSchemaForCountry","billingAddressRequiredFields","handleTouchstartIOS","useCallback","obj","elementType","name","handleAddress","getAddressHandler","doPanAutoJump","getAutoJumpHandler","extensions","CIExtensions","showValidation","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","aObj","field","errorCode","onValidationErrorAnalytics","holderNameValid","sfpValid","addressValid","koreanAuthentication","encryptedPassword","socialSecurityNumberValid","isValid","sfStateErrorsObj","mapErrorsToValidationRuleResult","mergedErrors","onChange","FieldToRender","StoredCardFieldsWrapper","CardFieldsWrapper","h","Fragment","SecuredFieldsProvider","extractPropsForSFP","styles","hasKoreanFields","sfState","eventDetails","autoCompleteName","acHolderName","getRuleByNameAndMode","holderNameValidationFn","autoFocus","ENCRYPTED_CARD_NUMBER","encryptedCardNumber","onBrand","type","disableIOSArrowKeys","render","setRootNode","sfpState","div","className","classNames","role","FormInstruction","extractPropsForCardFields","handleInstallments","brandsIcons","handleOnStoreDetails","billingAddressValidationRules","getPartialAddressValidationRules","onAddressLookup","onAddressSelected","addressSearchDebounceMs","showPayButton","payButton","variant","isPayButtonPrimaryVariant","icon","imageFolder","PREFIX","defaultProps"],"mappings":"wlDA+BA,MAAMA,EAAaC,IACf,MAAMC,EAAMC,EAAO,MACbC,EAAeD,GAAO,GACtBE,EAAWC,IAEXC,EAAoBJ,EAAO,MAC3BK,EAAgBC,IAClBF,EAAkBG,QAAUD,CAAAA,EAG1BE,EAAeR,EAAqB,CAAA,GAErCS,OAAOC,KAAKF,EAAaD,SAASI,QACnCb,EAAMc,gBAAgBJ,EAAaD,SAGvC,MAAMM,EAAkBb,EAAO,GACzBc,EAAgBd,GAAO,GAEvBe,EAAiBC,GAAQ,IAAM,IAAIC,EAAenB,EAAMiB,iBAAiB,CAACjB,EAAMiB,iBAGtFP,EAAaD,QAAQR,IAAMA,EAK3B,MAAOmB,EAAQC,GA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B5M,EAAM4M,wBAE/BtI,gBAAiBA,GAEjB8B,sBAAuBA,GACvBM,qBAAsBA,QAKrC1G,EAAM6M,eACH7M,EAAM8M,UAAU,CACZ1L,SACA2L,QAAS/M,EAAMgN,0BAA4B,UAAY,YACvDC,KAAM7M,EAAS,CAAE8M,YAAa,eAAxB9M,CAAyC,GAAG+M,WACtD,EAKhBpN,EAAUqN,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 } 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 { handlePartialAddressMode, extractPropsForCardFields, extractPropsForSFP, getLayout } 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 { InstallmentsObj } 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 { FieldErrorAnalyticsObject } from '../../../../core/Analytics/types';\nimport { PREFIX } from '../../../internal/Icon/constants';\nimport useSRPanelForCardInputErrors from './useSRPanelForCardInputErrors';\n\nconst CardInput = (props: CardInputProps) => {\n const sfp = useRef(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 // 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([]);\n const [selectedBrandValue, setSelectedBrandValue] = useState(props.storedPaymentMethodId ? props.brand : ''); // If this is a storedCard comp initialise state with the storedCard's brand\n\n const showBillingAddress = props.billingAddressMode !== AddressModeOptions.none && props.billingAddressRequired;\n\n const partialAddressSchema = handlePartialAddressMode(props.billingAddressMode);\n // Keeps the value of the country set initially by the merchant, before the Address Component mutates it\n const partialAddressCountry = useRef<string>(partialAddressSchema && props.data?.billingAddress?.country);\n\n const [storePaymentMethod, setStorePaymentMethod] = useState(false);\n const [billingAddress, setBillingAddress] = useState<AddressData>(showBillingAddress ? props.data.billingAddress : null);\n const [showSocialSecurityNumber, setShowSocialSecurityNumber] = useState(false);\n const [socialSecurityNumber, setSocialSecurityNumber] = useState('');\n const [installments, setInstallments] = useState<InstallmentsObj>({ value: null });\n\n // re. Disable arrows for iOS: The name of the element calling for other elements to be disabled\n // - either a securedField type (like 'encryptedCardNumber') when call is coming from SF\n // or else the name of an internal, Adyen-web, element (like 'holderName')\n const [iOSFocusedField, setIOSFocusedField] = useState(null);\n\n /**\n * 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 // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [internallyDetectedBrand, setInternallyDetectedBrand] = useState('card');\n\n /**\n * LOCAL VARS\n */\n const {\n handleChangeFor,\n triggerValidation,\n data: formData,\n valid: formValid,\n errors: formErrors,\n setSchema,\n setData: setFormData,\n setValid: setFormValid,\n setErrors: setFormErrors\n } = useForm<CardInputDataState>({\n schema: [],\n defaultData: props.data,\n formatters: cardInputFormatters,\n rules: cardInputValidationRules\n });\n\n const hasInstallments = !!Object.keys(props.installmentOptions).length && props.fundingSource !== 'debit';\n const showAmountsInInstallments = props.showInstallmentAmounts ?? true;\n\n const cardCountryCode: string = issuingCountryCode ?? props.countryCode;\n const isKorea = cardCountryCode === 'kr'; // If issuingCountryCode or the merchant defined countryCode is set to 'kr'\n const showKCP = props.configuration.koreanAuthenticationRequired && isKorea;\n\n const showBrazilianSSN: boolean =\n (showSocialSecurityNumber && props.configuration.socialSecurityNumberMode === 'auto') ||\n props.configuration.socialSecurityNumberMode === 'show';\n\n /**\n * HANDLERS\n */\n // Handlers for focus & blur on all fields. Can be renamed to onFieldFocus once the onFocusField is renamed in Field.tsx\n const onFieldFocusAnalytics = (who: string, e: Event | 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 handleSecuredFieldsChange = (sfState: SFPState, eventDetails?: OnChangeEventDetails): void => {\n /**\n * Handling auto complete value for holderName (but only if the component is using a holderName field)\n */\n if (sfState.autoCompleteName) {\n if (!props.hasHolderName) return;\n const holderNameValidationFn = getRuleByNameAndMode('holderName', 'blur');\n const acHolderName = holderNameValidationFn(sfState.autoCompleteName) ? sfState.autoCompleteName : null;\n if (acHolderName) {\n setFormData('holderName', acHolderName);\n setFormValid('holderName', true); // only if holderName is valid does this fny get called - so we know it's valid and w/o error\n setFormErrors('holderName', null);\n }\n return;\n }\n\n /**\n * Decide if we can shift focus to the expiryDate field.\n *\n * We can if... the config prop, autoFocus, is true AND we have a panLength value from binLookup\n * AND we are responding to a handleOnFieldValid message about the PAN that says it is valid\n */\n if (\n props.autoFocus &&\n hasPanLengthRef.current > 0 &&\n eventDetails?.event === 'handleOnFieldValid' &&\n eventDetails?.fieldType === ENCRYPTED_CARD_NUMBER &&\n sfState.valid.encryptedCardNumber\n ) {\n doPanAutoJump();\n }\n\n /**\n * Process SFP state\n */\n setData({ ...data, ...sfState.data });\n setErrors({ ...errors, ...sfState.errors });\n setValid({ ...valid, ...sfState.valid });\n\n setIsSfpValid(sfState.isSfpValid);\n\n // Values relating to /binLookup response\n setCvcPolicy(sfState.cvcPolicy);\n setShowSocialSecurityNumber(sfState.showSocialSecurityNumber);\n setExpiryDatePolicy(sfState.expiryDatePolicy);\n };\n\n // Farm the handlers for binLookup related functionality out to another 'extensions' file\n const extensions = useMemo(\n () =>\n CIExtensions(\n props,\n { sfp },\n {\n dualBrandSelectElements,\n setDualBrandSelectElements,\n setSelectedBrandValue,\n issuingCountryCode,\n setIssuingCountryCode\n },\n hasPanLengthRef\n ),\n [dualBrandSelectElements, issuingCountryCode]\n );\n\n /**\n * EXPOSE METHODS expected by Card.tsx\n */\n cardInputRef.current.showValidation = () => {\n // set flag\n isValidating.current = true;\n\n /**\n * Clear errors prior to validating so that the screenreader will read them *all* again, and in the right order\n * - only using aria-atomic on the error panel will read them in the wrong order\n */\n clearSRPanel?.(); // TODO - recheck if this is still true\n\n // Validate SecuredFields\n sfp.current.showValidation();\n\n // Validate holderName & SSN & KCP (taxNumber) but *not* billingAddress\n triggerValidation(['holderName', 'socialSecurityNumber', 'taxNumber']);\n\n // Validate Address\n if (billingAddressRef?.current) billingAddressRef.current.showValidation();\n };\n\n cardInputRef.current.processBinLookupResponse = (binLookupResponse: BinLookupResponse, isReset: boolean) => {\n extensions.processBinLookup(binLookupResponse, isReset);\n };\n\n cardInputRef.current.setStatus = setStatus;\n\n /**\n * EFFECT HOOKS\n */\n useEffect(() => {\n // componentDidMount - expose more methods expected by Card.tsx\n cardInputRef.current.setFocusOn = sfp.current.setFocusOn;\n cardInputRef.current.updateStyles = sfp.current.updateStyles;\n cardInputRef.current.handleUnsupportedCard = sfp.current.handleUnsupportedCard;\n\n // componentWillUnmount\n return () => {\n sfp.current.destroy();\n };\n }, []);\n\n /**\n * Handle form schema updates\n */\n useEffect(() => {\n const newSchema = [\n ...(props.hasHolderName ? ['holderName'] : []),\n ...(showBrazilianSSN ? ['socialSecurityNumber'] : []),\n ...(showKCP ? ['taxNumber'] : []),\n ...(showBillingAddress ? ['billingAddress'] : [])\n ];\n setSchema(newSchema);\n }, [props.hasHolderName, showBrazilianSSN, showKCP]);\n\n /**\n * Handle updates from useForm\n */\n useEffect(() => {\n setData({ ...data, holderName: formData.holderName ?? '', taxNumber: formData.taxNumber });\n\n setSocialSecurityNumber(formData.socialSecurityNumber);\n\n if (showBillingAddress) setBillingAddress({ ...formData.billingAddress });\n\n setValid({\n ...valid,\n holderName: props.holderNameRequired ? formValid.holderName : true,\n // Setting value to false if it's falsy keeps in line with existing, expected behaviour\n // - but there is an argument to allow 'undefined' as a value to indicate the non-presence of the field\n socialSecurityNumber: formValid.socialSecurityNumber ? formValid.socialSecurityNumber : false,\n taxNumber: formValid.taxNumber ? formValid.taxNumber : false,\n billingAddress: formValid.billingAddress ? formValid.billingAddress : false\n });\n\n // Check if billingAddress errors object has any properties that aren't null or undefined\n const addressHasErrors = formErrors.billingAddress\n ? Object.entries(formErrors.billingAddress).reduce((acc, [, error]) => acc || error != null, false)\n : false;\n\n // Errors\n setErrors({\n ...errors,\n holderName: props.holderNameRequired && !!formErrors.holderName ? formErrors.holderName : null,\n socialSecurityNumber: showBrazilianSSN && !!formErrors.socialSecurityNumber ? formErrors.socialSecurityNumber : null,\n taxNumber: showKCP && !!formErrors.taxNumber ? formErrors.taxNumber : null,\n billingAddress: showBillingAddress && addressHasErrors ? formErrors.billingAddress : null\n });\n }, [formData, formValid, formErrors]);\n\n // 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 if (currentErrorsSortedByLayout) {\n const newErrors = getArrayDifferences<SortedErrorObject, string>(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n newErrors?.forEach(errorItem => {\n const aObj: FieldErrorAnalyticsObject = {\n fieldType: errorItem.field,\n errorCode: errorItem.errorCode\n };\n\n props.onValidationErrorAnalytics(aObj);\n });\n }\n\n /**\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 * RENDER\n */\n const FieldToRender = props.storedPaymentMethodId ? StoredCardFieldsWrapper : CardFieldsWrapper;\n\n return (\n <Fragment>\n <SecuredFieldsProvider\n ref={sfp}\n {...extractPropsForSFP(props)}\n styles={{ ...props.styles }}\n koreanAuthenticationRequired={props.configuration.koreanAuthenticationRequired}\n hasKoreanFields={!!(props.configuration.koreanAuthenticationRequired && props.countryCode === 'kr')}\n onChange={handleSecuredFieldsChange}\n onBrand={onBrand}\n onFocus={handleFocus}\n type={props.brand}\n disableIOSArrowKeys={props.disableIOSArrowKeys ? handleTouchstartIOS : null}\n render={({ setRootNode, setFocusOn }, sfpState) => (\n <div\n ref={setRootNode}\n className={classNames({\n 'adyen-checkout__card-input': true,\n 'adyen-checkout-card-input__wrapper': true,\n [`adyen-checkout__card-input--${props.fundingSource ?? 'credit'}`]: true,\n 'adyen-checkout__card-input--loading': status === 'loading'\n })}\n role={'form'}\n >\n <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 {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","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","handleChangeFor","triggerValidation","formData","formValid","formErrors","setSchema","setFormData","setFormValid","setFormErrors","useForm","schema","defaultData","formatters","cardInputFormatters","rules","cardInputValidationRules","hasInstallments","installmentOptions","fundingSource","showAmountsInInstallments","showInstallmentAmounts","isKorea","countryCode","showKCP","configuration","koreanAuthenticationRequired","showBrazilianSSN","socialSecurityNumberMode","onFieldFocusAnalytics","who","e","onFocus","fieldType","event","onFieldBlurAnalytics","onBlur","onBrand","useCallback","obj","handleFocus","getFocusHandler","retrieveLayout","getLayout","countrySpecificSchemas","getAddressSchemaForCountry","billingAddressRequiredFields","handleTouchstartIOS","elementType","name","handleAddress","getAddressHandler","doPanAutoJump","getAutoJumpHandler","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","aObj","field","errorCode","onValidationErrorAnalytics","holderNameValid","sfpValid","addressValid","koreanAuthentication","encryptedPassword","socialSecurityNumberValid","isValid","sfStateErrorsObj","mapErrorsToValidationRuleResult","mergedErrors","onChange","FieldToRender","StoredCardFieldsWrapper","CardFieldsWrapper","h","Fragment","SecuredFieldsProvider","extractPropsForSFP","styles","hasKoreanFields","sfState","eventDetails","autoCompleteName","acHolderName","getRuleByNameAndMode","holderNameValidationFn","autoFocus","ENCRYPTED_CARD_NUMBER","encryptedCardNumber","type","disableIOSArrowKeys","render","setRootNode","sfpState","div","className","classNames","role","FormInstruction","extractPropsForCardFields","handleInstallments","brandsIcons","handleOnStoreDetails","billingAddressValidationRules","getPartialAddressValidationRules","onAddressLookup","onAddressSelected","addressSearchDebounceMs","showPayButton","payButton","variant","isPayButtonPrimaryVariant","icon","imageFolder","PREFIX","defaultProps"],"mappings":"wlDA+BA,MAAMA,EAAaC,IACf,MAAMC,EAAMC,EAAO,MACbC,EAAeD,GAAO,GACtBE,EAAWC,IAEXC,EAAoBJ,EAAO,MAC3BK,EAAgBC,IAClBF,EAAkBG,QAAUD,CAAAA,EAG1BE,EAAeR,EAAqB,IAErCS,OAAOC,KAAKF,EAAaD,SA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UAAWA,GACXzC,iBAAkBA,GAClBQ,wBAAyBA,GACzBmF,WAAYA,GACZjF,mBAAoBA,GAEpBmD,QAASA,GAETG,iBAAkBA,GAClBnC,qBAAsBA,GAEtBwI,qBAAsB5I,GAEtBtD,cAAeA,EACfmD,eAAgBA,GAChBgJ,8BAA+BnJ,IAAwBoJ,EAAiClJ,GAAsBhD,SAC9G8C,qBAAsBA,GACtBoE,cAAeA,GACfiF,gBAAiB5M,EAAM4M,gBACvBC,kBAAmB7M,EAAM6M,kBACzBC,wBAAyB9M,EAAM8M,wBAE/BxI,gBAAiBA,GAEjBgC,sBAAuBA,GACvBM,qBAAsBA,QAKrC5G,EAAM+M,eACH/M,EAAMgN,UAAU,CACZ5L,SACA6L,QAASjN,EAAMkN,0BAA4B,UAAY,YACvDC,KAAM/M,EAAS,CAAEgN,YAAa,eAAxBhN,CAAyC,GAAGiN,WACtD,EAKhBtN,EAAUuN,aAAeA"}
@@ -1 +1 @@
1
- {"version":3,"file":"defaultProps.js","sources":["../../../../../../src/components/Card/components/CardInput/defaultProps.ts"],"sourcesContent":["import { SocialSecurityMode } from '../../types';\nimport { AddressModeOptions } from './types';\n\nexport default {\n type: 'scheme',\n\n setComponentRef: () => {},\n\n // Settings\n autoFocus: true,\n billingAddressAllowedCountries: [],\n billingAddressMode: AddressModeOptions.full,\n billingAddressRequired: false,\n billingAddressRequiredFields: ['street', 'houseNumberOrName', 'postalCode', 'city', 'stateOrProvince', 'country'],\n\n configuration: { koreanAuthenticationRequired: false, socialSecurityNumberMode: 'auto' as SocialSecurityMode },\n data: {\n billingAddress: {}\n },\n disableIOSArrowKeys: false,\n enableStoreDetails: false,\n exposeExpiryDate: false,\n forceCompat: false,\n hasHolderName: false,\n holderNameRequired: false,\n hasCVC: true,\n hideCVC: false,\n installmentOptions: {},\n keypadFix: true,\n legacyInputMode: false,\n maskSecurityCode: false,\n minimumExpiryDate: null,\n name: null, // Affects Dropin only, the name displayed in the PMList item\n placeholders: {},\n positionHolderNameOnTop: false,\n showBrandIcon: true,\n showInstallmentAmounts: null,\n styles: {},\n\n isPayButtonPrimaryVariant: true,\n showContextualElement: true,\n\n // Events\n onLoad: (): any => {},\n onConfigSuccess: (): any => {},\n onAllValid: (): any => {},\n onFieldValid: (): any => {},\n onBrand: (): any => {},\n onError: (): any => {},\n onBinValue: (): any => {},\n onBlur: (): any => {},\n onFocus: (): any => {},\n onChange: (): any => {}\n};\n"],"names":["CardInputDefaultProps","type","setComponentRef","autoFocus","billingAddressAllowedCountries","billingAddressMode","AddressModeOptions","full","billingAddressRequired","billingAddressRequiredFields","configuration","koreanAuthenticationRequired","socialSecurityNumberMode","data","billingAddress","disableIOSArrowKeys","enableStoreDetails","exposeExpiryDate","forceCompat","hasHolderName","holderNameRequired","hasCVC","hideCVC","installmentOptions","keypadFix","legacyInputMode","maskSecurityCode","minimumExpiryDate","name","placeholders","positionHolderNameOnTop","showBrandIcon","showInstallmentAmounts","styles","isPayButtonPrimaryVariant","showContextualElement","onLoad","onConfigSuccess","onAllValid","onFieldValid","onBrand","onError","onBinValue","onBlur","onFocus","onChange"],"mappings":"gDAGA,IAAeA,EAAA,CACXC,KAAM,SAENC,gBAAiB,OAGjBC,WAAW,EACXC,+BAAgC,GAChCC,mBAAoBC,EAAmBC,KACvCC,wBAAwB,EACxBC,6BAA8B,CAAC,SAAU,oBAAqB,aAAc,OAAQ,kBAAmB,WAEvGC,cAAe,CAAEC,8BAA8B,EAAOC,yBAA0B,QAChFC,KAAM,CACFC,eAAgB,CAAC,GAErBC,qBAAqB,EACrBC,oBAAoB,EACpBC,kBAAkB,EAClBC,aAAa,EACbC,eAAe,EACfC,oBAAoB,EACpBC,QAAQ,EACRC,SAAS,EACTC,mBAAoB,CAAC,EACrBC,WAAW,EACXC,iBAAiB,EACjBC,kBAAkB,EAClBC,kBAAmB,KACnBC,KAAM,KACNC,aAAc,CAAC,EACfC,yBAAyB,EACzBC,eAAe,EACfC,uBAAwB,KACxBC,OAAQ,CAAC,EAETC,2BAA2B,EAC3BC,uBAAuB,EAGvBC,OAAQ,OACRC,gBAAiB,OACjBC,WAAY,OACZC,aAAc,OACdC,QAAS,OACTC,QAAS,OACTC,WAAY,OACZC,OAAQ,OACRC,QAAS,OACTC,SAAU"}
1
+ {"version":3,"file":"defaultProps.js","sources":["../../../../../../src/components/Card/components/CardInput/defaultProps.ts"],"sourcesContent":["import { SocialSecurityMode } from '../../types';\nimport { AddressModeOptions } from './types';\n\nexport default {\n type: 'scheme',\n\n setComponentRef: () => {},\n\n // Settings\n autoFocus: true,\n billingAddressAllowedCountries: [],\n billingAddressMode: AddressModeOptions.full,\n billingAddressRequired: false,\n billingAddressRequiredFields: ['street', 'houseNumberOrName', 'postalCode', 'city', 'stateOrProvince', 'country'],\n\n configuration: { koreanAuthenticationRequired: false, socialSecurityNumberMode: 'auto' as SocialSecurityMode },\n data: {\n billingAddress: {}\n },\n disableIOSArrowKeys: false,\n enableStoreDetails: false,\n exposeExpiryDate: false,\n forceCompat: false,\n hasHolderName: false,\n holderNameRequired: false,\n hasCVC: true,\n hideCVC: false,\n installmentOptions: {},\n keypadFix: true,\n legacyInputMode: false,\n maskSecurityCode: false,\n minimumExpiryDate: null,\n name: null, // Affects Dropin only, the name displayed in the PMList item\n placeholders: {},\n positionHolderNameOnTop: false,\n showBrandIcon: true,\n showInstallmentAmounts: null,\n styles: {},\n\n isPayButtonPrimaryVariant: true,\n showContextualElement: true,\n\n // Events\n onLoad: (): any => {},\n onConfigSuccess: (): any => {},\n onAllValid: (): any => {},\n onFieldValid: (): any => {},\n onBrand: (): any => {},\n onError: (): any => {},\n onBinValue: (): any => {},\n onBlur: (): any => {},\n onFocus: (): any => {},\n onChange: (): any => {}\n};\n"],"names":["CardInputDefaultProps","type","setComponentRef","autoFocus","billingAddressAllowedCountries","billingAddressMode","AddressModeOptions","full","billingAddressRequired","billingAddressRequiredFields","configuration","koreanAuthenticationRequired","socialSecurityNumberMode","data","billingAddress","disableIOSArrowKeys","enableStoreDetails","exposeExpiryDate","forceCompat","hasHolderName","holderNameRequired","hasCVC","hideCVC","installmentOptions","keypadFix","legacyInputMode","maskSecurityCode","minimumExpiryDate","name","placeholders","positionHolderNameOnTop","showBrandIcon","showInstallmentAmounts","styles","isPayButtonPrimaryVariant","showContextualElement","onLoad","onConfigSuccess","onAllValid","onFieldValid","onBrand","onError","onBinValue","onBlur","onFocus","onChange"],"mappings":"gDAGA,IAAeA,EAAA,CACXC,KAAM,SAENC,gBAAiB,OAGjBC,WAAW,EACXC,+BAAgC,GAChCC,mBAAoBC,EAAmBC,KACvCC,wBAAwB,EACxBC,6BAA8B,CAAC,SAAU,oBAAqB,aAAc,OAAQ,kBAAmB,WAEvGC,cAAe,CAAEC,8BAA8B,EAAOC,yBAA0B,QAChFC,KAAM,CACFC,eAAgB,CAAA,GAEpBC,qBAAqB,EACrBC,oBAAoB,EACpBC,kBAAkB,EAClBC,aAAa,EACbC,eAAe,EACfC,oBAAoB,EACpBC,QAAQ,EACRC,SAAS,EACTC,mBAAoB,CAAC,EACrBC,WAAW,EACXC,iBAAiB,EACjBC,kBAAkB,EAClBC,kBAAmB,KACnBC,KAAM,KACNC,aAAc,CAAC,EACfC,yBAAyB,EACzBC,eAAe,EACfC,uBAAwB,KACxBC,OAAQ,CAAC,EAETC,2BAA2B,EAC3BC,uBAAuB,EAGvBC,OAAQ,OACRC,gBAAiB,OACjBC,WAAY,OACZC,aAAc,OACdC,QAAS,OACTC,QAAS,OACTC,WAAY,OACZC,OAAQ,OACRC,QAAS,OACTC,SAAU"}
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.js","sources":["../../../../../../src/components/Card/components/CardInput/handlers.ts"],"sourcesContent":["import { ENCRYPTED_CARD_NUMBER, CREDIT_CARD_SF_FIELDS } from '../../../internal/SecuredFields/lib/constants';\nimport { selectOne } from '../../../internal/SecuredFields/lib/utilities/dom';\nimport { CbObjOnFocus } from '../../../internal/SecuredFields/lib/types';\n\n/**\n * Helper for CardInput - gets a field name and sets focus on it\n */\nexport const setFocusOnFirstField = (isValidating, sfp, fieldToFocus) => {\n if (isValidating) {\n // If not a cardInput related securedField - find field and set focus on it\n if (!CREDIT_CARD_SF_FIELDS.includes(fieldToFocus)) {\n setFocusOnNonSF(fieldToFocus, sfp);\n } else {\n // Is a securedField - so it has its own focus procedures\n sfp.current.setFocusOn(fieldToFocus);\n }\n }\n};\n\nexport const getAddressHandler = (setFormData, setFormValid, setFormErrors) => {\n // Return Handler fn:\n return address => {\n setFormData('billingAddress', address.data);\n setFormValid('billingAddress', address.isValid);\n setFormErrors('billingAddress', address.errors);\n };\n};\n\nexport const getFocusHandler = (setFocusedElement, onFocus, onBlur) => {\n // Return Handler fn:\n return (e: CbObjOnFocus) => {\n setFocusedElement(e.currentFocusObject);\n e.focus === true ? onFocus(e.fieldType, e) : onBlur(e.fieldType, e);\n };\n};\n\nexport const getAutoJumpHandler = (isAutoJumping, sfp, layout) => {\n return () => {\n if (!isAutoJumping.current) {\n isAutoJumping.current = true;\n\n // CardInput can call this more than once in quick succession\n // e.g. if field was in error (error + fieldValid) or other SFs are optional (fieldValid + allValid) etc\n // - so make async to avoid double setFocus call\n void Promise.resolve().then(() => {\n const panIndex = layout.findIndex(elem => elem === ENCRYPTED_CARD_NUMBER);\n const subsequentFields = layout.slice(panIndex + 1);\n\n /**\n * Investigate subsequent fields to see if they can/should accept focus\n */\n for (const field of subsequentFields) {\n // Is the next field a credit card related securedField?\n if (CREDIT_CARD_SF_FIELDS.includes(field)) {\n const isOptionalOrHidden = sfp.current.sfIsOptionalOrHidden(field);\n if (!isOptionalOrHidden) {\n sfp.current.setFocusOn(field);\n break;\n }\n } else {\n // If it isn't an SF - shift focus to it (we're currently not concerned with whether the field is optional)\n\n setFocusOnNonSF(field, sfp);\n break;\n }\n }\n\n isAutoJumping.current = false;\n });\n }\n };\n};\n\nconst setFocusOnNonSF = (field, sfp) => {\n let nameVal: string = field;\n\n // We have an exception with the kcp taxNumber where the name of the field ('kcpTaxNumberOrDOB') doesn't match\n // the value by which the field is referred to internally ('taxNumber')\n if (nameVal === 'taxNumber') nameVal = 'kcpTaxNumberOrDOB';\n\n if (nameVal === 'country' || nameVal === 'stateOrProvince') {\n // Set focus on dropdown\n const field: HTMLElement = selectOne(sfp.current.rootNode, `.adyen-checkout__field--${nameVal} .adyen-checkout__filter-input`);\n field?.focus();\n } else {\n // Set focus on input\n const field: HTMLElement = selectOne(sfp.current.rootNode, `[name=\"${nameVal}\"]`);\n field?.focus();\n }\n};\n"],"names":["setFocusOnFirstField","isValidating","sfp","fieldToFocus","CREDIT_CARD_SF_FIELDS","includes","current","setFocusOn","setFocusOnNonSF","getAddressHandler","setFormData","setFormValid","setFormErrors","address","data","isValid","errors","getFocusHandler","setFocusedElement","onFocus","onBlur","e","currentFocusObject","focus","fieldType","getAutoJumpHandler","isAutoJumping","layout","Promise","resolve","then","panIndex","findIndex","elem","ENCRYPTED_CARD_NUMBER","subsequentFields","slice","field","sfIsOptionalOrHidden","nameVal","selectOne","rootNode"],"mappings":"qMAOO,MAAMA,EAAuB,CAACC,EAAcC,EAAKC,KAChDF,IAEKG,EAAsBC,SAASF,GAIhCD,EAAII,QAAQC,WAAWJ,GAHvBK,EAAgBL,EAAcD,GAKtC,EAGSO,EAAoB,CAACC,EAAaC,EAAcC,IAElDC,IACHH,EAAY,iBAAkBG,EAAQC,MACtCH,EAAa,iBAAkBE,EAAQE,SACvCH,EAAc,iBAAkBC,EAAQG,OAAM,EAIzCC,EAAkB,CAACC,EAAmBC,EAASC,IAEhDC,IACJH,EAAkBG,EAAEC,qBACR,IAAZD,EAAEE,MAAiBJ,EAAQE,EAAEG,UAAWH,GAAKD,EAAOC,EAAEG,UAAWH,EAAAA,EAI5DI,EAAqB,CAACC,EAAexB,EAAKyB,IAC5C,KACED,EAAcpB,UACfoB,EAAcpB,SAAU,EAKnBsB,QAAQC,UAAUC,MAAK,KACxB,MAAMC,EAAWJ,EAAOK,WAAUC,GAAQA,IAASC,IAC7CC,EAAmBR,EAAOS,MAAML,EAAW,GAKjD,IAAK,MAAMM,KAASF,EAAkB,CAElC,IAAI/B,EAAsBC,SAASgC,GAM5B,CAGH7B,EAAgB6B,EAAOnC,GACvB,KACJ,CATI,IAD2BA,EAAII,QAAQgC,qBAAqBD,GACnC,CACrBnC,EAAII,QAAQC,WAAW8B,GACvB,KACJ,CAOR,CAEAX,EAAcpB,SAAU,CAAA,IAEhC,EAIFE,EAAkB,CAAC6B,EAAOnC,KAC5B,IAAIqC,EAAkBF,EAMtB,GAFgB,cAAZE,IAAyBA,EAAU,qBAEvB,YAAZA,GAAqC,oBAAZA,EAA+B,CAExD,MAAMF,EAAqBG,EAAUtC,EAAII,QAAQmC,SAAU,2BAA2BF,mCACtFF,GAAOd,YACJ,CAEH,MAAMc,EAAqBG,EAAUtC,EAAII,QAAQmC,SAAU,UAAUF,OACrEF,GAAOd,OACX"}
1
+ {"version":3,"file":"handlers.js","sources":["../../../../../../src/components/Card/components/CardInput/handlers.ts"],"sourcesContent":["import { ENCRYPTED_CARD_NUMBER, CREDIT_CARD_SF_FIELDS } from '../../../internal/SecuredFields/lib/constants';\nimport { selectOne } from '../../../internal/SecuredFields/lib/utilities/dom';\nimport { CardFocusData } from '../../../internal/SecuredFields/lib/types';\n\n/**\n * Helper for CardInput - gets a field name and sets focus on it\n */\nexport const setFocusOnFirstField = (isValidating, sfp, fieldToFocus) => {\n if (isValidating) {\n // If not a cardInput related securedField - find field and set focus on it\n if (!CREDIT_CARD_SF_FIELDS.includes(fieldToFocus)) {\n setFocusOnNonSF(fieldToFocus, sfp);\n } else {\n // Is a securedField - so it has its own focus procedures\n sfp.current.setFocusOn(fieldToFocus);\n }\n }\n};\n\nexport const getAddressHandler = (setFormData, setFormValid, setFormErrors) => {\n // Return Handler fn:\n return address => {\n setFormData('billingAddress', address.data);\n setFormValid('billingAddress', address.isValid);\n setFormErrors('billingAddress', address.errors);\n };\n};\n\nexport const getFocusHandler = (setFocusedElement, onFocus, onBlur) => {\n // Return Handler fn:\n return (e: CardFocusData) => {\n setFocusedElement(e.currentFocusObject);\n e.focus === true ? onFocus(e.fieldType, e) : onBlur(e.fieldType, e);\n };\n};\n\nexport const getAutoJumpHandler = (isAutoJumping, sfp, layout) => {\n return () => {\n if (!isAutoJumping.current) {\n isAutoJumping.current = true;\n\n // CardInput can call this more than once in quick succession\n // e.g. if field was in error (error + fieldValid) or other SFs are optional (fieldValid + allValid) etc\n // - so make async to avoid double setFocus call\n void Promise.resolve().then(() => {\n const panIndex = layout.findIndex(elem => elem === ENCRYPTED_CARD_NUMBER);\n const subsequentFields = layout.slice(panIndex + 1);\n\n /**\n * Investigate subsequent fields to see if they can/should accept focus\n */\n for (const field of subsequentFields) {\n // Is the next field a credit card related securedField?\n if (CREDIT_CARD_SF_FIELDS.includes(field)) {\n const isOptionalOrHidden = sfp.current.sfIsOptionalOrHidden(field);\n if (!isOptionalOrHidden) {\n sfp.current.setFocusOn(field);\n break;\n }\n } else {\n // If it isn't an SF - shift focus to it (we're currently not concerned with whether the field is optional)\n\n setFocusOnNonSF(field, sfp);\n break;\n }\n }\n\n isAutoJumping.current = false;\n });\n }\n };\n};\n\nconst setFocusOnNonSF = (field, sfp) => {\n let nameVal: string = field;\n\n // We have an exception with the kcp taxNumber where the name of the field ('kcpTaxNumberOrDOB') doesn't match\n // the value by which the field is referred to internally ('taxNumber')\n if (nameVal === 'taxNumber') nameVal = 'kcpTaxNumberOrDOB';\n\n if (nameVal === 'country' || nameVal === 'stateOrProvince') {\n // Set focus on dropdown\n const field: HTMLElement = selectOne(sfp.current.rootNode, `.adyen-checkout__field--${nameVal} .adyen-checkout__filter-input`);\n field?.focus();\n } else {\n // Set focus on input\n const field: HTMLElement = selectOne(sfp.current.rootNode, `[name=\"${nameVal}\"]`);\n field?.focus();\n }\n};\n"],"names":["setFocusOnFirstField","isValidating","sfp","fieldToFocus","CREDIT_CARD_SF_FIELDS","includes","current","setFocusOn","setFocusOnNonSF","getAddressHandler","setFormData","setFormValid","setFormErrors","address","data","isValid","errors","getFocusHandler","setFocusedElement","onFocus","onBlur","e","currentFocusObject","focus","fieldType","getAutoJumpHandler","isAutoJumping","layout","Promise","resolve","then","panIndex","findIndex","elem","ENCRYPTED_CARD_NUMBER","subsequentFields","slice","field","sfIsOptionalOrHidden","nameVal","selectOne","rootNode"],"mappings":"qMAOO,MAAMA,EAAuB,CAACC,EAAcC,EAAKC,KAChDF,IAEKG,EAAsBC,SAASF,GAIhCD,EAAII,QAAQC,WAAWJ,GAHvBK,EAAgBL,EAAcD,GAKtC,EAGSO,EAAoB,CAACC,EAAaC,EAAcC,IAElDC,IACHH,EAAY,iBAAkBG,EAAQC,MACtCH,EAAa,iBAAkBE,EAAQE,SACvCH,EAAc,iBAAkBC,EAAQG,OAAM,EAIzCC,EAAkB,CAACC,EAAmBC,EAASC,IAEhDC,IACJH,EAAkBG,EAAEC,qBACR,IAAZD,EAAEE,MAAiBJ,EAAQE,EAAEG,UAAWH,GAAKD,EAAOC,EAAEG,UAAWH,EAAAA,EAI5DI,EAAqB,CAACC,EAAexB,EAAKyB,IAC5C,KACED,EAAcpB,UACfoB,EAAcpB,SAAU,EAKnBsB,QAAQC,UAAUC,MAAK,KACxB,MAAMC,EAAWJ,EAAOK,WAAUC,GAAQA,IAASC,IAC7CC,EAAmBR,EAAOS,MAAML,EAAW,GAKjD,IAAK,MAAMM,KAASF,EAAkB,CAElC,IAAI/B,EAAsBC,SAASgC,GAM5B,CAGH7B,EAAgB6B,EAAOnC,GACvB,KACJ,CATI,IAD2BA,EAAII,QAAQgC,qBAAqBD,GACnC,CACrBnC,EAAII,QAAQC,WAAW8B,GACvB,KACJ,CAOR,CAEAX,EAAcpB,SAAU,CAAA,IAEhC,EAIFE,EAAkB,CAAC6B,EAAOnC,KAC5B,IAAIqC,EAAkBF,EAMtB,GAFgB,cAAZE,IAAyBA,EAAU,qBAEvB,YAAZA,GAAqC,oBAAZA,EAA+B,CAExD,MAAMF,EAAqBG,EAAUtC,EAAII,QAAQmC,SAAU,2BAA2BF,mCACtFF,GAAOd,YACJ,CAEH,MAAMc,EAAqBG,EAAUtC,EAAII,QAAQmC,SAAU,UAAUF,OACrEF,GAAOd,OACX"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sources":["../../../../../../src/components/Card/components/CardInput/types.ts"],"sourcesContent":["import Language from '../../../../language/Language';\nimport { BinLookupResponse, BrandConfiguration, CardBrandsConfiguration, CardBackendConfiguration, DualBrandSelectElement } from '../../types';\nimport { InstallmentOptions } from './components/types';\nimport { ValidationResult } from '../../../internal/PersonalDetails/types';\nimport { CVCPolicyType, DatePolicyType } from '../../../internal/SecuredFields/lib/types';\nimport Specifications from '../../../internal/Address/Specifications';\nimport { AddressSchema } from '../../../internal/Address/types';\nimport { CbObjOnError, StylesObject } from '../../../internal/SecuredFields/lib/types';\nimport { Resources } from '../../../../core/Context/Resources';\nimport { SRPanel } from '../../../../core/Errors/SRPanel';\nimport RiskElement from '../../../../core/RiskModule';\nimport { DisclaimerMsgObject } from '../../../internal/DisclaimerMessage/DisclaimerMessage';\nimport { OnAddressLookupType, OnAddressSelectedType } from '../../../internal/Address/components/AddressSearch';\nimport { ComponentMethodsRef } from '../../../internal/UIElement/types';\nimport { AddressData, PaymentAmount } from '../../../../types/global-types';\nimport { AnalyticsModule } from '../../../../types/global-types';\nimport { FieldErrorAnalyticsObject } from '../../../../core/Analytics/types';\n\nexport interface CardInputValidState {\n holderName?: boolean;\n billingAddress?: boolean;\n socialSecurityNumber?: boolean;\n encryptedCardNumber?: boolean;\n encryptedExpiryMonth?: boolean;\n encryptedExpiryYear?: boolean;\n encryptedSecurityCode?: boolean;\n taxNumber?: boolean;\n encryptedPassword?: boolean;\n}\n\nexport interface CardInputErrorState {\n holderName?: ValidationResult;\n billingAddress?: ValidationResult;\n socialSecurityNumber?: ValidationResult;\n encryptedCardNumber?: boolean;\n encryptedExpiryDate?: boolean;\n encryptedSecurityCode?: boolean;\n taxNumber?: ValidationResult;\n encryptedPassword?: boolean;\n}\n\nexport interface CardInputDataState {\n holderName?: string;\n billingAddress?: AddressData;\n socialSecurityNumber?: string;\n taxNumber?: string;\n}\n\ntype PlaceholderKeys =\n | 'holderName'\n | 'cardNumber'\n | 'expiryDate'\n | 'expiryMonth'\n | 'expiryYear'\n | 'securityCodeThreeDigits'\n | 'securityCodeFourDigits'\n | 'password';\nexport type Placeholders = Partial<Record<PlaceholderKeys, string>>;\n\n/**\n * Should be the subset of the props sent to CardInput that are *actually* used by CardInput\n * - either in the comp itself or are passed on to its children\n */\nexport interface CardInputProps {\n amount?: PaymentAmount;\n isPayButtonPrimaryVariant?: boolean;\n autoFocus?: boolean;\n billingAddressAllowedCountries?: string[];\n billingAddressRequired?: boolean;\n billingAddressRequiredFields?: string[];\n billingAddressMode?: AddressModeOptions;\n brand?: string;\n brands?: string[];\n brandsConfiguration?: CardBrandsConfiguration;\n brandsIcons: Array<BrandConfiguration>;\n clientKey: string;\n configuration?: CardBackendConfiguration;\n countryCode?: string;\n cvcPolicy?: CVCPolicyType;\n data?: CardInputDataState;\n disableIOSArrowKeys?: boolean;\n enableStoreDetails?: boolean;\n expiryMonth?: string;\n expiryYear?: string;\n forceCompat?: boolean;\n fundingSource?: 'debit' | 'credit';\n hasCVC?: boolean;\n hasHolderName?: boolean;\n holderName?: string;\n holderNameRequired?: boolean;\n i18n?: Language;\n implementationType?: string;\n installmentOptions?: InstallmentOptions;\n keypadFix?: boolean;\n lastFour?: string;\n loadingContext: string;\n legacyInputMode?: boolean;\n minimumExpiryDate?: string;\n modules?: {\n srPanel: SRPanel;\n analytics: AnalyticsModule;\n risk: RiskElement;\n resources: Resources;\n };\n onAdditionalSFConfig?: () => {};\n onAdditionalSFRemoved?: () => {};\n onAllValid?: () => {};\n onAutoComplete?: () => {};\n onBinValue?: () => {};\n onBlur?: (e) => {};\n onBrand?: () => {};\n onConfigSuccess?: () => {};\n onChange?: (state) => {};\n onError?: () => {};\n onFieldValid?: () => {};\n onFocus?: (e) => {};\n onLoad?: () => {};\n handleKeyPress?: (obj: KeyboardEvent) => void;\n onAddressLookup?: OnAddressLookupType;\n onAddressSelected?: OnAddressSelectedType;\n addressSearchDebounceMs?: number;\n payButton?: (obj) => {};\n placeholders?: Placeholders;\n positionHolderNameOnTop?: boolean;\n resources: Resources;\n setComponentRef?: (ref) => void;\n showBrandIcon?: boolean;\n showInstallmentAmounts?: boolean;\n showPayButton: boolean;\n showStoreDetailsCheckbox?: boolean;\n showWarnings?: boolean;\n showContextualElement?: boolean;\n specifications?: Specifications;\n storedPaymentMethodId?: string;\n styles?: StylesObject;\n trimTrailingSeparator?: boolean;\n type?: string;\n maskSecurityCode?: boolean;\n exposeExpiryDate?: boolean;\n disclaimerMessage?: DisclaimerMsgObject;\n onValidationErrorAnalytics?: (obj: FieldErrorAnalyticsObject) => {};\n}\n\nexport interface CardInputState {\n dualBrandSelectElements: DualBrandSelectElement[];\n selectedBrandValue: string;\n billingAddress: object;\n brand?: string;\n data?: object;\n errors?: object;\n focusedElement: string;\n cvcPolicy: CVCPolicyType;\n expiryDatePolicy: DatePolicyType;\n isValid: boolean;\n status: string;\n valid?: object;\n issuingCountryCode: string;\n showSocialSecurityNumber?: boolean;\n}\n\n// An interface for the members exposed by CardInput to its parent Card/UIElement\nexport interface CardInputRef extends ComponentMethodsRef {\n sfp?: any;\n setFocusOn?: (who) => void;\n processBinLookupResponse?: (binLookupResponse: BinLookupResponse, isReset: boolean) => void;\n updateStyles?: (stylesObj: StylesObject) => void;\n handleUnsupportedCard?: (errObj: CbObjOnError) => boolean;\n}\n\nexport interface FieldError {\n errorMessage?: string;\n errorI18n?: string;\n}\n\nexport interface SFError {\n isValid?: boolean;\n errorMessage?: string;\n errorI18n?: string;\n error: string;\n rootNode: HTMLElement;\n detectedBrands?: string[];\n}\n\nexport interface SFStateErrorObj {\n [key: string]: SFError;\n}\n\nexport interface LayoutObj {\n props: CardInputProps;\n showKCP: boolean;\n showBrazilianSSN: boolean;\n countrySpecificSchemas: AddressSchema;\n billingAddressRequiredFields?: string[];\n}\n\nexport enum AddressModeOptions {\n full = 'full',\n partial = 'partial',\n none = 'none'\n}\n"],"names":["AddressModeOptions"],"mappings":"AAmMO,IAAAA,EAAKA,SAAAA,GAAAA,uDAAAA,CAIX,CAJWA,CAIX,CAAA"}
1
+ {"version":3,"file":"types.js","sources":["../../../../../../src/components/Card/components/CardInput/types.ts"],"sourcesContent":["import Language from '../../../../language/Language';\nimport { BinLookupResponse, BrandConfiguration, CardBrandsConfiguration, CardBackendConfiguration, DualBrandSelectElement } from '../../types';\nimport { InstallmentOptions } from './components/types';\nimport { ValidationResult } from '../../../internal/PersonalDetails/types';\nimport {\n CardAllValidData,\n CardAutoCompleteData,\n CardBinValueData,\n CardBrandData,\n CardConfigSuccessData,\n CardFieldValidData,\n CardLoadData,\n CVCPolicyType,\n DatePolicyType\n} from '../../../internal/SecuredFields/lib/types';\nimport Specifications from '../../../internal/Address/Specifications';\nimport { AddressSchema } from '../../../internal/Address/types';\nimport { CardErrorData, StylesObject } from '../../../internal/SecuredFields/lib/types';\nimport { Resources } from '../../../../core/Context/Resources';\nimport { SRPanel } from '../../../../core/Errors/SRPanel';\nimport RiskElement from '../../../../core/RiskModule';\nimport { DisclaimerMsgObject } from '../../../internal/DisclaimerMessage/DisclaimerMessage';\nimport { OnAddressLookupType, OnAddressSelectedType } from '../../../internal/Address/components/AddressSearch';\nimport { ComponentMethodsRef } from '../../../internal/UIElement/types';\nimport { AddressData, PaymentAmount } from '../../../../types/global-types';\nimport { AnalyticsModule } from '../../../../types/global-types';\nimport { FieldErrorAnalyticsObject } from '../../../../core/Analytics/types';\n\nexport interface CardInputValidState {\n holderName?: boolean;\n billingAddress?: boolean;\n socialSecurityNumber?: boolean;\n encryptedCardNumber?: boolean;\n encryptedExpiryMonth?: boolean;\n encryptedExpiryYear?: boolean;\n encryptedSecurityCode?: boolean;\n taxNumber?: boolean;\n encryptedPassword?: boolean;\n}\n\nexport interface CardInputErrorState {\n holderName?: ValidationResult;\n billingAddress?: ValidationResult;\n socialSecurityNumber?: ValidationResult;\n encryptedCardNumber?: boolean;\n encryptedExpiryDate?: boolean;\n encryptedSecurityCode?: boolean;\n taxNumber?: ValidationResult;\n encryptedPassword?: boolean;\n}\n\nexport interface CardInputDataState {\n holderName?: string;\n billingAddress?: AddressData;\n socialSecurityNumber?: string;\n taxNumber?: string;\n}\n\ntype PlaceholderKeys =\n | 'holderName'\n | 'cardNumber'\n | 'expiryDate'\n | 'expiryMonth'\n | 'expiryYear'\n | 'securityCodeThreeDigits'\n | 'securityCodeFourDigits'\n | 'password';\nexport type Placeholders = Partial<Record<PlaceholderKeys, string>>;\n\n/**\n * Should be the subset of the props sent to CardInput that are *actually* used by CardInput\n * - either in the comp itself or are passed on to its children\n */\nexport interface CardInputProps {\n amount?: PaymentAmount;\n isPayButtonPrimaryVariant?: boolean;\n autoFocus?: boolean;\n billingAddressAllowedCountries?: string[];\n billingAddressRequired?: boolean;\n billingAddressRequiredFields?: string[];\n billingAddressMode?: AddressModeOptions;\n brand?: string;\n brands?: string[];\n brandsConfiguration?: CardBrandsConfiguration;\n brandsIcons: Array<BrandConfiguration>;\n clientKey: string;\n configuration?: CardBackendConfiguration;\n countryCode?: string;\n cvcPolicy?: CVCPolicyType;\n data?: CardInputDataState;\n disableIOSArrowKeys?: boolean;\n enableStoreDetails?: boolean;\n expiryMonth?: string;\n expiryYear?: string;\n forceCompat?: boolean;\n fundingSource?: 'debit' | 'credit';\n hasCVC?: boolean;\n hasHolderName?: boolean;\n holderName?: string;\n holderNameRequired?: boolean;\n i18n?: Language;\n implementationType?: string;\n installmentOptions?: InstallmentOptions;\n keypadFix?: boolean;\n lastFour?: string;\n loadingContext: string;\n legacyInputMode?: boolean;\n minimumExpiryDate?: string;\n modules?: {\n srPanel: SRPanel;\n analytics: AnalyticsModule;\n risk: RiskElement;\n resources: Resources;\n };\n onAdditionalSFConfig?: () => {};\n onAdditionalSFRemoved?: () => {};\n onAllValid?: (o: CardAllValidData) => {};\n onAutoComplete?: (o: CardAutoCompleteData) => {};\n onBinValue?: (o: CardBinValueData) => {};\n onBlur?: (e) => {};\n onBrand?: (o: CardBrandData) => {};\n onConfigSuccess?: (O: CardConfigSuccessData) => {};\n onChange?: (state) => {};\n onError?: () => {};\n onFieldValid?: (o: CardFieldValidData) => {};\n onFocus?: (e) => {};\n onLoad?: (o: CardLoadData) => {};\n handleKeyPress?: (obj: KeyboardEvent) => void;\n onAddressLookup?: OnAddressLookupType;\n onAddressSelected?: OnAddressSelectedType;\n addressSearchDebounceMs?: number;\n payButton?: (obj) => {};\n placeholders?: Placeholders;\n positionHolderNameOnTop?: boolean;\n resources: Resources;\n setComponentRef?: (ref) => void;\n showBrandIcon?: boolean;\n showInstallmentAmounts?: boolean;\n showPayButton: boolean;\n showStoreDetailsCheckbox?: boolean;\n showWarnings?: boolean;\n showContextualElement?: boolean;\n specifications?: Specifications;\n storedPaymentMethodId?: string;\n styles?: StylesObject;\n trimTrailingSeparator?: boolean;\n type?: string;\n maskSecurityCode?: boolean;\n exposeExpiryDate?: boolean;\n disclaimerMessage?: DisclaimerMsgObject;\n onValidationErrorAnalytics?: (obj: FieldErrorAnalyticsObject) => {};\n}\n\nexport interface CardInputState {\n dualBrandSelectElements: DualBrandSelectElement[];\n selectedBrandValue: string;\n billingAddress: object;\n brand?: string;\n data?: object;\n errors?: object;\n focusedElement: string;\n cvcPolicy: CVCPolicyType;\n expiryDatePolicy: DatePolicyType;\n isValid: boolean;\n status: string;\n valid?: object;\n issuingCountryCode: string;\n showSocialSecurityNumber?: boolean;\n}\n\n// An interface for the members exposed by CardInput to its parent Card/UIElement\nexport interface CardInputRef extends ComponentMethodsRef {\n sfp?: any;\n setFocusOn?: (who) => void;\n processBinLookupResponse?: (binLookupResponse: BinLookupResponse, isReset: boolean) => void;\n updateStyles?: (stylesObj: StylesObject) => void;\n handleUnsupportedCard?: (errObj: CardErrorData) => boolean;\n}\n\nexport interface FieldError {\n errorMessage?: string;\n errorI18n?: string;\n}\n\nexport interface SFError {\n isValid?: boolean;\n errorMessage?: string;\n errorI18n?: string;\n error: string;\n rootNode: HTMLElement;\n detectedBrands?: string[];\n}\n\nexport interface SFStateErrorObj {\n [key: string]: SFError;\n}\n\nexport interface LayoutObj {\n props: CardInputProps;\n showKCP: boolean;\n showBrazilianSSN: boolean;\n countrySpecificSchemas: AddressSchema;\n billingAddressRequiredFields?: string[];\n}\n\nexport enum AddressModeOptions {\n full = 'full',\n partial = 'partial',\n none = 'none'\n}\n"],"names":["AddressModeOptions"],"mappings":"AA6MO,IAAAA,EAAKA,SAAAA,GAAAA,uDAAAA,CAIX,CAJWA,CAIX,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"CashAppPay.js","sources":["../../../../src/components/CashAppPay/CashAppPay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport { CashAppComponent } from './components/CashAppComponent';\nimport CashAppService from './services/CashAppService';\nimport { CashAppSdkLoader } from './services/CashAppSdkLoader';\nimport { CashAppPayElementData, CashAppPayConfiguration, CashAppPayEventData } from './types';\nimport { ICashAppService } from './services/types';\nimport defaultProps from './defaultProps';\nimport RedirectButton from '../internal/RedirectButton';\nimport { payAmountLabel } from '../internal/PayButton';\nimport { TxVariants } from '../tx-variants';\nimport type { ICore } from '../../core/types';\nimport { PREFIX } from '../internal/Icon/constants';\n\nexport class CashAppPay extends UIElement<CashAppPayConfiguration> {\n public static type = TxVariants.cashapp;\n\n private readonly cashAppService: ICashAppService | undefined;\n\n protected static defaultProps = defaultProps;\n\n constructor(checkout: ICore, props?: CashAppPayConfiguration) {\n super(checkout, props);\n\n if (this.props.enableStoreDetails && this.props.storePaymentMethod) {\n console.warn(\n 'CashAppPay: enableStoreDetails AND storePaymentMethod configuration properties should not be used together. That can lead to undesired behavior.'\n );\n }\n\n if (this.props.storedPaymentMethodId) {\n return;\n }\n\n this.cashAppService = new CashAppService(new CashAppSdkLoader(), {\n storePaymentMethod: this.props.storePaymentMethod,\n useCashAppButtonUi: this.props.showPayButton,\n environment: this.props.environment,\n amount: this.props.amount,\n redirectURL: this.props.redirectURL,\n clientId: this.props.configuration?.clientId,\n scopeId: this.props.configuration?.scopeId,\n button: this.props.button,\n referenceId: this.props.referenceId\n });\n }\n\n public formatProps(props: CashAppPayConfiguration) {\n return {\n ...props,\n enableStoreDetails: props.session?.configuration?.enableStoreDetails || props.enableStoreDetails\n };\n }\n\n public formatData(): CashAppPayElementData {\n const { shopperWantsToStore, grantId, onFileGrantId, cashTag, customerId } = this.state.data || {};\n const { storePaymentMethod: storePaymentMethodSetByMerchant, storedPaymentMethodId } = this.props;\n\n /**\n * We include 'storePaymentMethod' flag if we either Display the Checkbox OR if it is non-sessions flow AND the merchant wants to store the payment method\n */\n const includeStorePaymentMethod = this.props.enableStoreDetails || (!this.props.session && storePaymentMethodSetByMerchant);\n\n if (storedPaymentMethodId) {\n return {\n paymentMethod: {\n type: CashAppPay.type,\n storedPaymentMethodId\n }\n };\n }\n\n const shouldAddOnFileProperties = onFileGrantId && cashTag;\n\n return {\n paymentMethod: {\n type: CashAppPay.type,\n ...(grantId && { grantId }),\n ...(customerId && { customerId }),\n ...(shouldAddOnFileProperties && { onFileGrantId, cashtag: cashTag })\n },\n ...(includeStorePaymentMethod && { storePaymentMethod: storePaymentMethodSetByMerchant || shopperWantsToStore })\n };\n }\n\n get displayName() {\n if (this.props.storedPaymentMethodId && this.props.cashtag) {\n return this.props.cashtag;\n }\n return this.props.name;\n }\n\n get additionalInfo() {\n return this.props.storedPaymentMethodId ? 'Cash App Pay' : '';\n }\n\n public submit = () => {\n const { onClick, storedPaymentMethodId } = this.props;\n\n if (storedPaymentMethodId) {\n super.submit();\n return;\n }\n\n let onClickPromiseRejected = false;\n\n new Promise<void>((resolve, reject) => onClick({ resolve, reject }))\n .catch(() => {\n onClickPromiseRejected = true;\n throw Error('onClick rejected');\n })\n .then(() => {\n return this.cashAppService.createCustomerRequest();\n })\n .then(() => {\n this.cashAppService.begin();\n })\n .catch(error => {\n if (onClickPromiseRejected) {\n // Swallow exception triggered by onClick reject\n return;\n }\n this.handleError(error);\n });\n };\n\n public get isValid(): boolean {\n return true;\n }\n\n private handleOnChangeStoreDetails = (storePayment: boolean) => {\n const data = { ...this.state.data, shopperWantsToStore: storePayment };\n this.setState({ data });\n };\n\n private handleAuthorize = (cashAppPaymentData: CashAppPayEventData): void => {\n const data = { ...this.state.data, ...cashAppPaymentData };\n this.setState({ data, valid: {}, errors: {}, isValid: true });\n super.submit();\n };\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} resources={this.resources} loadingContext={this.props.loadingContext}>\n {this.props.storedPaymentMethodId ? (\n <RedirectButton\n showPayButton={this.props.showPayButton}\n label={payAmountLabel(this.props.i18n, this.props.amount)}\n icon={this.resources?.getImage({ imageFolder: 'components/' })(`${PREFIX}lock`)}\n name={this.displayName}\n amount={this.props.amount}\n payButton={this.payButton}\n onSubmit={this.submit}\n ref={ref => {\n this.componentRef = ref;\n }}\n />\n ) : (\n <CashAppComponent\n ref={ref => {\n this.componentRef = ref;\n }}\n enableStoreDetails={this.props.enableStoreDetails}\n cashAppService={this.cashAppService}\n onChangeStoreDetails={this.handleOnChangeStoreDetails}\n onError={this.handleError}\n onClick={this.submit}\n onAuthorize={this.handleAuthorize}\n />\n )}\n </CoreProvider>\n );\n }\n}\n\nexport default CashAppPay;\n"],"names":["CashAppPay","UIElement","formatProps","props","enableStoreDetails","session","configuration","formatData","shopperWantsToStore","grantId","onFileGrantId","cashTag","customerId","this","state","data","storePaymentMethod","storePaymentMethodSetByMerchant","storedPaymentMethodId","includeStorePaymentMethod","paymentMethod","type","cashtag","displayName","name","additionalInfo","isValid","render","h","CoreProvider","i18n","resources","loadingContext","RedirectButton","showPayButton","label","payAmountLabel","amount","icon","getImage","imageFolder","PREFIX","payButton","onSubmit","submit","ref","componentRef","CashAppComponent","cashAppService","onChangeStoreDetails","handleOnChangeStoreDetails","onError","handleError","onClick","onAuthorize","handleAuthorize","constructor","checkout","super","_define_property","onClickPromiseRejected","Promise","resolve","reject","catch","Error","then","createCustomerRequest","begin","error","storePayment","setState","cashAppPaymentData","valid","errors","console","warn","CashAppService","CashAppSdkLoader","useCashAppButtonUi","environment","redirectURL","clientId","scopeId","button","referenceId","TxVariants","cashapp","defaultProps"],"mappings":"wxBAeO,MAAMA,UAAmBC,EAiCrBC,WAAAA,CAAYC,GACf,MAAO,IACAA,EACHC,mBAAoBD,EAAME,SAASC,eAAeF,oBAAsBD,EAAMC,mBAEtF,CAEOG,UAAAA,GACH,MAAMC,oBAAEA,EAAmBC,QAAEA,EAAOC,cAAEA,EAAaC,QAAEA,EAAOC,WAAEA,GAAeC,KAAKC,MAAMC,MAAQ,IACxFC,mBAAoBC,EAA+BC,sBAAEA,GAA0BL,KAAKV,MAKtFgB,EAA4BN,KAAKV,MAAMC,qBAAwBS,KAAKV,MAAME,SAAWY,EAE3F,GAAIC,EACA,MAAO,CACHE,cAAe,CACXC,KAAMrB,EAAWqB,KACjBH,0BAOZ,MAAO,CACHE,cAAe,CACXC,KAAMrB,EAAWqB,QACbZ,GAAW,CAAEA,cACbG,GAAc,CAAEA,iBANMF,GAAiBC,GAOV,CAAED,gBAAeY,QAASX,OAE3DQ,GAA6B,CAAEH,mBAAoBC,GAAmCT,GAElG,CAEA,eAAIe,GACA,OAAIV,KAAKV,MAAMe,uBAAyBL,KAAKV,MAAMmB,QACxCT,KAAKV,MAAMmB,QAEfT,KAAKV,MAAMqB,IACtB,CAEA,kBAAIC,GACA,OAAOZ,KAAKV,MAAMe,sBAAwB,eAAiB,EAC/D,CAgCA,WAAWQ,GACP,OAAO,CACX,CAaAC,MAAAA,GACI,OACIC,EAACC,EAAAA,CAAaC,KAAMjB,KAAKV,MAAM2B,KAAMC,UAAWlB,KAAKkB,UAAWC,eAAgBnB,KAAKV,MAAM6B,gBACtFnB,KAAKV,MAAMe,sBACRU,EAACK,EAAAA,CACGC,cAAerB,KAAKV,M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AK0D,SAAS,CAAExD,OAAM0D,MAAO,CAAC,EAAGC,OAAQ,CAAC,EAAGhD,SAAS,IACtDgC,MAAMd,QAAAA,IAlHF/B,KAAKV,MAAMC,oBAAsBS,KAAKV,MAAMa,oBAC5C2D,QAAQC,KACJ,oJAIJ/D,KAAKV,MAAMe,wBAIfL,KAAKmC,eAAiB,IAAI6B,EAAe,IAAIC,EAAoB,CAC7D9D,mBAAoBH,KAAKV,MAAMa,mBAC/B+D,mBAAoBlE,KAAKV,MAAM+B,cAC/B8C,YAAanE,KAAKV,MAAM6E,YACxB3C,OAAQxB,KAAKV,MAAMkC,OACnB4C,YAAapE,KAAKV,MAAM8E,YACxBC,SAAUrE,KAAKV,MAAMG,eAAe4E,SACpCC,QAAStE,KAAKV,MAAMG,eAAe6E,QACnCC,OAAQvE,KAAKV,MAAMiF,OACnBC,YAAaxE,KAAKV,MAAMkF,cAEhC,EA9BA1B,EADS3D,EACKqB,OAAOiE,EAAWC,SAIhC5B,EALS3D,EAKQwF,eAAeA"}
1
+ {"version":3,"file":"CashAppPay.js","sources":["../../../../src/components/CashAppPay/CashAppPay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport { CashAppComponent } from './components/CashAppComponent';\nimport CashAppService from './services/CashAppService';\nimport { CashAppSdkLoader } from './services/CashAppSdkLoader';\nimport { CashAppPayElementData, CashAppPayConfiguration, CashAppPayEventData } from './types';\nimport { ICashAppService } from './services/types';\nimport defaultProps from './defaultProps';\nimport RedirectButton from '../internal/RedirectButton';\nimport { payAmountLabel } from '../internal/PayButton';\nimport { TxVariants } from '../tx-variants';\nimport type { ICore } from '../../core/types';\nimport { PREFIX } from '../internal/Icon/constants';\n\nexport class CashAppPay extends UIElement<CashAppPayConfiguration> {\n public static type = TxVariants.cashapp;\n\n private readonly cashAppService: ICashAppService | undefined;\n\n protected static defaultProps = defaultProps;\n\n constructor(checkout: ICore, props?: CashAppPayConfiguration) {\n super(checkout, props);\n\n if (this.props.enableStoreDetails && this.props.storePaymentMethod) {\n console.warn(\n 'CashAppPay: enableStoreDetails AND storePaymentMethod configuration properties should not be used together. That can lead to undesired behavior.'\n );\n }\n\n if (this.props.storedPaymentMethodId) {\n return;\n }\n\n this.cashAppService = new CashAppService(new CashAppSdkLoader(), {\n storePaymentMethod: this.props.storePaymentMethod,\n useCashAppButtonUi: this.props.showPayButton,\n environment: this.props.environment,\n amount: this.props.amount,\n redirectURL: this.props.redirectURL,\n clientId: this.props.configuration?.clientId,\n scopeId: this.props.configuration?.scopeId,\n button: this.props.button,\n referenceId: this.props.referenceId\n });\n }\n\n public formatProps(props: CashAppPayConfiguration) {\n return {\n ...props,\n enableStoreDetails: props.session?.configuration?.enableStoreDetails || props.enableStoreDetails\n };\n }\n\n public formatData(): CashAppPayElementData {\n const { shopperWantsToStore, grantId, onFileGrantId, cashTag, customerId } = this.state.data || {};\n const { storePaymentMethod: storePaymentMethodSetByMerchant, storedPaymentMethodId } = this.props;\n\n /**\n * We include 'storePaymentMethod' flag if we either Display the Checkbox OR if it is non-sessions flow AND the merchant wants to store the payment method\n */\n const includeStorePaymentMethod = this.props.enableStoreDetails || (!this.props.session && storePaymentMethodSetByMerchant);\n\n if (storedPaymentMethodId) {\n return {\n paymentMethod: {\n type: CashAppPay.type,\n storedPaymentMethodId\n }\n };\n }\n\n const shouldAddOnFileProperties = onFileGrantId && cashTag;\n\n return {\n paymentMethod: {\n type: CashAppPay.type,\n ...(grantId && { grantId }),\n ...(customerId && { customerId }),\n ...(shouldAddOnFileProperties && { onFileGrantId, cashtag: cashTag })\n },\n ...(includeStorePaymentMethod && { storePaymentMethod: storePaymentMethodSetByMerchant || shopperWantsToStore })\n };\n }\n\n get displayName() {\n if (this.props.storedPaymentMethodId && this.props.cashtag) {\n return this.props.cashtag;\n }\n return this.props.name;\n }\n\n get additionalInfo() {\n return this.props.storedPaymentMethodId ? 'Cash App Pay' : '';\n }\n\n public submit = () => {\n const { onClick, storedPaymentMethodId } = this.props;\n\n if (storedPaymentMethodId) {\n super.submit();\n return;\n }\n\n let onClickPromiseRejected = false;\n\n new Promise<void>((resolve, reject) => onClick({ resolve, reject }))\n .catch(() => {\n onClickPromiseRejected = true;\n throw Error('onClick rejected');\n })\n .then(() => {\n return this.cashAppService.createCustomerRequest();\n })\n .then(() => {\n this.cashAppService.begin();\n })\n .catch(error => {\n if (onClickPromiseRejected) {\n // Swallow exception triggered by onClick reject\n return;\n }\n this.handleError(error);\n });\n };\n\n public get isValid(): boolean {\n return true;\n }\n\n private handleOnChangeStoreDetails = (storePayment: boolean) => {\n const data = { ...this.state.data, shopperWantsToStore: storePayment };\n this.setState({ data });\n };\n\n private handleAuthorize = (cashAppPaymentData: CashAppPayEventData): void => {\n const data = { ...this.state.data, ...cashAppPaymentData };\n this.setState({ data, valid: {}, errors: {}, isValid: true });\n super.submit();\n };\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} resources={this.resources} loadingContext={this.props.loadingContext}>\n {this.props.storedPaymentMethodId ? (\n <RedirectButton\n showPayButton={this.props.showPayButton}\n label={payAmountLabel(this.props.i18n, this.props.amount)}\n icon={this.resources?.getImage({ imageFolder: 'components/' })(`${PREFIX}lock`)}\n name={this.displayName}\n amount={this.props.amount}\n payButton={this.payButton}\n onSubmit={this.submit}\n ref={ref => {\n this.componentRef = ref;\n }}\n />\n ) : (\n <CashAppComponent\n ref={ref => {\n this.componentRef = ref;\n }}\n enableStoreDetails={this.props.enableStoreDetails}\n cashAppService={this.cashAppService}\n onChangeStoreDetails={this.handleOnChangeStoreDetails}\n onError={this.handleError}\n onClick={this.submit}\n onAuthorize={this.handleAuthorize}\n />\n )}\n </CoreProvider>\n );\n }\n}\n\nexport default CashAppPay;\n"],"names":["CashAppPay","UIElement","formatProps","props","enableStoreDetails","session","configuration","formatData","shopperWantsToStore","grantId","onFileGrantId","cashTag","customerId","this","state","data","storePaymentMethod","storePaymentMethodSetByMerchant","storedPaymentMethodId","includeStorePaymentMethod","paymentMethod","type","cashtag","displayName","name","additionalInfo","isValid","render","h","CoreProvider","i18n","resources","loadingContext","RedirectButton","showPayButton","label","payAmountLabel","amount","icon","getImage","imageFolder","PREFIX","payButton","onSubmit","submit","ref","componentRef","CashAppComponent","cashAppService","onChangeStoreDetails","handleOnChangeStoreDetails","onError","handleError","onClick","onAuthorize","handleAuthorize","constructor","checkout","super","_define_property","onClickPromiseRejected","Promise","resolve","reject","catch","Error","then","createCustomerRequest","begin","error","storePayment","setState","cashAppPaymentData","valid","errors","console","warn","CashAppService","CashAppSdkLoader","useCashAppButtonUi","environment","redirectURL","clientId","scopeId","button","referenceId","TxVariants","cashapp","defaultProps"],"mappings":"wxBAeO,MAAMA,UAAmBC,EAiCrBC,WAAAA,CAAYC,GACf,MAAO,IACAA,EACHC,mBAAoBD,EAAME,SAASC,eAAeF,oBAAsBD,EAAMC,mBAEtF,CAEOG,UAAAA,GACH,MAAMC,oBAAEA,EAAmBC,QAAEA,EAAOC,cAAEA,EAAaC,QAAEA,EAAOC,WAAEA,GAAeC,KAAKC,MAAMC,MAAQ,CAAC,GACzFC,mBAAoBC,EAA+BC,sBAAEA,GAA0BL,KAAKV,MAKtFgB,EAA4BN,KAAKV,MAAMC,qBAAwBS,KAAKV,MAAME,SAAWY,EAE3F,GAAIC,EACA,MAAO,CACHE,cAAe,CACXC,KAAMrB,EAAWqB,KACjBH,0BAOZ,MAAO,CACHE,cAAe,CACXC,KAAMrB,EAAWqB,QACbZ,GAAW,CAAEA,cACbG,GAAc,CAAEA,iBANMF,GAAiBC,GAOV,CAAED,gBAAeY,QAASX,OAE3DQ,GAA6B,CAAEH,mBAAoBC,GAAmCT,GAElG,CAEA,eAAIe,GACA,OAAIV,KAAKV,MAAMe,uBAAyBL,KAAKV,MAAMmB,QACxCT,KAAKV,MAAMmB,QAEfT,KAAKV,MAAMqB,IACtB,CAEA,kBAAIC,GACA,OAAOZ,KAAKV,MAAMe,sBAAwB,eAAi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ACrB,IAORV,EAAA9C,KAAQqC,8BAA8BoB,IAClC,MAAMvD,EAAO,IAAKF,KAAKC,MAAMC,KAAMP,oBAAqB8D,GACxDzD,KAAK0D,SAAS,CAAExD,QAAK,IAGzB4C,EAAA9C,KAAQ0C,mBAAmBiB,IACvB,MAAMzD,EAAO,IAAKF,KAAKC,MAAMC,QAASyD,GACtC3D,KAAK0D,SAAS,CAAExD,OAAM0D,MAAO,CAAC,EAAGC,OAAQ,CAAC,EAAGhD,SAAS,IACtDgC,MAAMd,QAAAA,IAlHF/B,KAAKV,MAAMC,oBAAsBS,KAAKV,MAAMa,oBAC5C2D,QAAQC,KACJ,oJAIJ/D,KAAKV,MAAMe,wBAIfL,KAAKmC,eAAiB,IAAI6B,EAAe,IAAIC,EAAoB,CAC7D9D,mBAAoBH,KAAKV,MAAMa,mBAC/B+D,mBAAoBlE,KAAKV,MAAM+B,cAC/B8C,YAAanE,KAAKV,MAAM6E,YACxB3C,OAAQxB,KAAKV,MAAMkC,OACnB4C,YAAapE,KAAKV,MAAM8E,YACxBC,SAAUrE,KAAKV,MAAMG,eAAe4E,SACpCC,QAAStE,KAAKV,MAAMG,eAAe6E,QACnCC,OAAQvE,KAAKV,MAAMiF,OACnBC,YAAaxE,KAAKV,MAAMkF,cAEhC,EA9BA1B,EADS3D,EACKqB,OAAOiE,EAAWC,SAIhC5B,EALS3D,EAKQwF,eAAeA"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as t}from"../internal/UIElement/UIElement.js";import s from"./CustomCardInput/CustomCardInput.js";import{CoreProvider as o}from"../../core/Context/CoreProvider.js";import n from"../../utils/browserInfo.js";import r from"../internal/SecuredFields/binLookup/triggerBinLookUp.js";import{getCardImageUrl as i,fieldTypeToSnakeCase as a}from"../internal/SecuredFields/utils.js";import{TxVariants as p}from"../tx-variants.js";import{ANALYTICS_FOCUS_STR as u,ANALYTICS_UNFOCUS_STR as d}from"../../core/Analytics/constants.js";function c(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}class h extends t{formatProps(e){return{...e,type:p.customCard,brand:p.card}}formatData(){const e=this.state.selectedBrandValue;return{paymentMethod:{type:"scheme",...this.state.data,...e&&{brand:e}},browserInfo:this.browserInfo,origin:!!window&&window.location.origin}}submitAnalytics(e){super.submitAnalytics(e,this.props)}updateStyles(e){return this.componentRef?.updateStyles&&this.componentRef.updateStyles(e),this}setFocusOn(e){return this.componentRef?.setFocusOn&&this.componentRef.setFocusOn(e),this}processBinLookupResponse(e){return this.componentRef?.processBinLookupResponse&&this.componentRef.processBinLookupResponse(e),this}dualBrandingChangeHandler(e){return this.componentRef?.dualBrandingChangeHandler&&this.componentRef.dualBrandingChangeHandler(e),this}handleUnsupportedCard(e){return this.componentRef?.handleUnsupportedCard&&this.componentRef.handleUnsupportedCard(e),this}onBinLookup(e){const t={...e};t.rootNode=this._node,t.isReset||(t.supportedBrandsRaw=e.supportedBrandsRaw?.map((e=>(e.brandImageUrl=this.props.brandsConfiguration[e.brand]?.icon??i(e.brand,this.resources),e)))),this.props.onBinLookup(t)}get isValid(){return!!this.state.isValid}get browserInfo(){return n()}render(){return e(o,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},e(s,{ref:e=>{this.componentRef=e},...this.props,...this.state,handleKeyPress:this.handleKeyPress,rootNode:this._node,onChange:this.setState,onBinValue:this.onBinValue,implementationType:"custom",resources:this.resources,brand:this.props.brand,onFocus:this.onFocus}))}constructor(...e){super(...e),c(this,"onBinValue",r(this)),c(this,"onFocus",(e=>{this.submitAnalytics({type:!0===e.focus?u:d,target:a(e.fieldType)}),this.props.onFocus?.(e)})),c(this,"onEnterKeyPressed",((e,t)=>{this.props.onEnterKeyPressed?.(e,t)}))}}c(h,"type",p.customCard),c(h,"analyticsType","custom-scheme"),c(h,"defaultProps",{onBinLookup:()=>{},brandsConfiguration:{}});export{h as CustomCard,h as default};
1
+ import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as t}from"../internal/UIElement/UIElement.js";import s from"./CustomCardInput/CustomCardInput.js";import{CoreProvider as o}from"../../core/Context/CoreProvider.js";import n from"../../utils/browserInfo.js";import r from"../internal/SecuredFields/binLookup/triggerBinLookUp.js";import{getCardImageUrl as i,fieldTypeToSnakeCase as a}from"../internal/SecuredFields/utils.js";import{TxVariants as p}from"../tx-variants.js";import{ANALYTICS_FOCUS_STR as u,ANALYTICS_UNFOCUS_STR as d}from"../../core/Analytics/constants.js";function c(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}class h extends t{formatProps(e){return{...e,type:p.customCard}}formatData(){const e=this.state.selectedBrandValue;return{paymentMethod:{type:"scheme",...this.state.data,...e&&{brand:e}},browserInfo:this.browserInfo,origin:!!window&&window.location.origin}}submitAnalytics(e){super.submitAnalytics(e,this.props)}updateStyles(e){return this.componentRef?.updateStyles&&this.componentRef.updateStyles(e),this}setFocusOn(e){return this.componentRef?.setFocusOn&&this.componentRef.setFocusOn(e),this}processBinLookupResponse(e){return this.componentRef?.processBinLookupResponse&&this.componentRef.processBinLookupResponse(e),this}dualBrandingChangeHandler(e){return this.componentRef?.dualBrandingChangeHandler&&this.componentRef.dualBrandingChangeHandler(e),this}handleUnsupportedCard(e){return this.componentRef?.handleUnsupportedCard&&this.componentRef.handleUnsupportedCard(e),this}onBinLookup(e){const t={...e};t.rootNode=this._node,t.isReset||(t.supportedBrandsRaw=e.supportedBrandsRaw?.map((e=>(e.brandImageUrl=this.props.brandsConfiguration[e.brand]?.icon??i(e.brand,this.resources),e)))),this.props.onBinLookup(t)}get isValid(){return!!this.state.isValid}get browserInfo(){return n()}render(){return e(o,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},e(s,{ref:e=>{this.componentRef=e},...this.props,...this.state,handleKeyPress:this.handleKeyPress,rootNode:this._node,onChange:this.setState,onBinValue:this.onBinValue,implementationType:"custom",resources:this.resources,brand:this.brand,onFocus:this.onFocus}))}constructor(...e){super(...e),c(this,"brand",p.card),c(this,"onBinValue",r(this)),c(this,"onFocus",(e=>{this.submitAnalytics({type:!0===e.focus?u:d,target:a(e.fieldType)}),this.props.onFocus?.(e)})),c(this,"onEnterKeyPressed",((e,t)=>{this.props.onEnterKeyPressed?.(e,t)}))}}c(h,"type",p.customCard),c(h,"analyticsType","custom-scheme"),c(h,"defaultProps",{onBinLookup:()=>{},brandsConfiguration:{}});export{h as CustomCard,h as default};
2
2
  //# sourceMappingURL=CustomCard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomCard.js","sources":["../../../../src/components/CustomCard/CustomCard.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement';\nimport CustomCardInput from './CustomCardInput';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport triggerBinLookUp from '../internal/SecuredFields/binLookup/triggerBinLookUp';\nimport { CbObjOnBinLookup, CbObjOnFocus } from '../internal/SecuredFields/lib/types';\nimport { BrandObject } from '../Card/types';\nimport { getCardImageUrl, fieldTypeToSnakeCase } from '../internal/SecuredFields/utils';\nimport { TxVariants } from '../tx-variants';\nimport { CustomCardConfiguration } from './types';\nimport { ANALYTICS_FOCUS_STR, ANALYTICS_UNFOCUS_STR } from '../../core/Analytics/constants';\nimport { SendAnalyticsObject } from '../../core/Analytics/types';\n\n// TODO questions about\n// brand - does a merchant ever make a custom stored card?\n// type\n// countryCode\n\nexport class CustomCard extends UIElement<CustomCardConfiguration> {\n public static type = TxVariants.customCard;\n\n public static analyticsType = 'custom-scheme';\n\n protected static defaultProps = {\n onBinLookup: () => {},\n brandsConfiguration: {}\n };\n\n formatProps(props: CustomCardConfiguration) {\n return {\n ...props,\n type: TxVariants.customCard,\n brand: TxVariants.card\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData() {\n const sfBrand = this.state.selectedBrandValue;\n return {\n paymentMethod: {\n type: 'scheme',\n ...this.state.data,\n ...(sfBrand && { brand: sfBrand })\n },\n browserInfo: this.browserInfo,\n origin: !!window && window.location.origin\n };\n }\n\n protected submitAnalytics(analyticsObj: SendAnalyticsObject) {\n super.submitAnalytics(analyticsObj, this.props);\n }\n\n updateStyles(stylesObj) {\n if (this.componentRef?.updateStyles) this.componentRef.updateStyles(stylesObj);\n return this;\n }\n\n setFocusOn(frame) {\n if (this.componentRef?.setFocusOn) this.componentRef.setFocusOn(frame);\n return this;\n }\n\n processBinLookupResponse(binLookupResponse) {\n if (this.componentRef?.processBinLookupResponse) this.componentRef.processBinLookupResponse(binLookupResponse);\n return this;\n }\n\n dualBrandingChangeHandler(e: Event | string) {\n if (this.componentRef?.dualBrandingChangeHandler) this.componentRef.dualBrandingChangeHandler(e);\n return this;\n }\n\n handleUnsupportedCard(errObj) {\n if (this.componentRef?.handleUnsupportedCard) this.componentRef.handleUnsupportedCard(errObj);\n return this;\n }\n\n onBinLookup(obj: CbObjOnBinLookup) {\n const nuObj = { ...obj };\n nuObj.rootNode = this._node;\n\n if (!nuObj.isReset) {\n // Add brandImage urls, first checking if the merchant has configured their own one for the brand\n nuObj.supportedBrandsRaw = obj.supportedBrandsRaw?.map((item: BrandObject) => {\n item.brandImageUrl = this.props.brandsConfiguration[item.brand]?.icon ?? getCardImageUrl(item.brand, this.resources);\n return item;\n });\n }\n\n this.props.onBinLookup(nuObj);\n }\n\n public onBinValue = triggerBinLookUp(this);\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n get browserInfo() {\n return collectBrowserInfo();\n }\n\n private onFocus = (obj: CbObjOnFocus) => {\n this.submitAnalytics({\n type: obj.focus === true ? ANALYTICS_FOCUS_STR : ANALYTICS_UNFOCUS_STR,\n target: fieldTypeToSnakeCase(obj.fieldType)\n });\n\n // Call merchant defined callback\n this.props.onFocus?.(obj);\n };\n\n protected onEnterKeyPressed = (activeElement: Element, component: UIElement) => {\n this.props.onEnterKeyPressed?.(activeElement, component);\n };\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <CustomCardInput\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n {...this.state}\n handleKeyPress={this.handleKeyPress}\n rootNode={this._node}\n onChange={this.setState}\n onBinValue={this.onBinValue}\n implementationType={'custom'}\n resources={this.resources}\n brand={this.props.brand}\n onFocus={this.onFocus}\n />\n </CoreProvider>\n );\n }\n}\n\nexport default CustomCard;\n"],"names":["CustomCard","UIElement","formatProps","props","type","TxVariants","customCard","brand","card","formatData","sfBrand","this","state","selectedBrandValue","paymentMethod","data","browserInfo","origin","window","location","submitAnalytics","analyticsObj","super","updateStyles","stylesObj","componentRef","setFocusOn","frame","processBinLookupResponse","binLookupResponse","dualBrandingChangeHandler","e","handleUnsupportedCard","errObj","onBinLookup","obj","nuObj","rootNode","_node","isReset","supportedBrandsRaw","map","item","brandImageUrl","brandsConfiguration","icon","getCardImageUrl","resources","isValid","collectBrowserInfo","render","h","CoreProvider","i18n","loadingContext","CustomCardInput","ref","handleKeyPress","onChange","setState","onBinValue","implementationType","onFocus","args","_define_property","triggerBinLookUp","focus","ANALYTICS_FOCUS_STR","ANALYTICS_UNFOCUS_STR","target","fieldTypeToSnakeCase","fieldType","onEnterKeyPressed","activeElement","component","analyticsType","defaultProps"],"mappings":"otBAmBO,MAAMA,UAAmBC,EAU5BC,WAAAA,CAAYC,GACR,MAAO,IACAA,EACHC,KAAMC,EAAWC,WACjBC,MAAOF,EAAWG,KAE1B,CAKAC,UAAAA,GACI,MAAMC,EAAUC,KAAKC,MAAMC,mBAC3B,MAAO,CACHC,cAAe,CACXV,KAAM,YACHO,KAAKC,MAAMG,QACVL,GAAW,CAAEH,MAAOG,IAE5BM,YAAaL,KAAKK,YAClBC,SAAUC,QAAUA,OAAOC,SAASF,OAE5C,CAEUG,eAAAA,CAAgBC,GACtBC,MAAMF,gBAAgBC,EAAcV,KAAKR,MAC7C,CAEAoB,YAAAA,CAA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AMI,MAClBuD,QAASnD,KAAKmD,UAI9B,mBA5CAxC,SAAAyC,GAAAC,EAAArD,KAAOiD,aAAaK,EAAiBtD,OAUrCqD,EAAArD,KAAQmD,WAAW3B,IACfxB,KAAKS,gBAAgB,CACjBhB,MAAoB,IAAd+B,EAAI+B,MAAiBC,EAAsBC,EACjDC,OAAQC,EAAqBnC,EAAIoC,aAIrC5D,KAAKR,MAAM2D,UAAU3B,EAAAA,IAGzB6B,EAAArD,KAAU6D,qBAAoB,CAACC,EAAwBC,KACnD/D,KAAKR,MAAMqE,oBAAoBC,EAAeC,EAAAA,KAlGlDV,EADShE,EACKI,OAAOC,EAAWC,YAEhC0D,EAHShE,EAGK2E,gBAAgB,iBAE9BX,EALShE,EAKQ4E,eAAe,CAC5B1C,YAAa,OACbU,oBAAqB,CAAC"}
1
+ {"version":3,"file":"CustomCard.js","sources":["../../../../src/components/CustomCard/CustomCard.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement';\nimport CustomCardInput from './CustomCardInput';\nimport { CoreProvider } from '../../core/Context/CoreProvider';\nimport collectBrowserInfo from '../../utils/browserInfo';\nimport triggerBinLookUp from '../internal/SecuredFields/binLookup/triggerBinLookUp';\nimport { CardBinLookupData, CardFocusData } from '../internal/SecuredFields/lib/types';\nimport { BrandObject } from '../Card/types';\nimport { getCardImageUrl, fieldTypeToSnakeCase } from '../internal/SecuredFields/utils';\nimport { TxVariants } from '../tx-variants';\nimport { CustomCardConfiguration } from './types';\nimport { ANALYTICS_FOCUS_STR, ANALYTICS_UNFOCUS_STR } from '../../core/Analytics/constants';\nimport { SendAnalyticsObject } from '../../core/Analytics/types';\n\nexport class CustomCard extends UIElement<CustomCardConfiguration> {\n public static type = TxVariants.customCard;\n\n public static analyticsType = 'custom-scheme';\n\n protected static defaultProps = {\n onBinLookup: () => {},\n brandsConfiguration: {}\n };\n\n private brand = TxVariants.card;\n\n formatProps(props: CustomCardConfiguration) {\n return {\n ...props,\n type: TxVariants.customCard\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData() {\n const sfBrand = this.state.selectedBrandValue;\n return {\n paymentMethod: {\n type: 'scheme',\n ...this.state.data,\n ...(sfBrand && { brand: sfBrand })\n },\n browserInfo: this.browserInfo,\n origin: !!window && window.location.origin\n };\n }\n\n protected submitAnalytics(analyticsObj: SendAnalyticsObject) {\n super.submitAnalytics(analyticsObj, this.props);\n }\n\n updateStyles(stylesObj) {\n if (this.componentRef?.updateStyles) this.componentRef.updateStyles(stylesObj);\n return this;\n }\n\n setFocusOn(frame) {\n if (this.componentRef?.setFocusOn) this.componentRef.setFocusOn(frame);\n return this;\n }\n\n processBinLookupResponse(binLookupResponse) {\n if (this.componentRef?.processBinLookupResponse) this.componentRef.processBinLookupResponse(binLookupResponse);\n return this;\n }\n\n dualBrandingChangeHandler(e: Event | string) {\n if (this.componentRef?.dualBrandingChangeHandler) this.componentRef.dualBrandingChangeHandler(e);\n return this;\n }\n\n handleUnsupportedCard(errObj) {\n if (this.componentRef?.handleUnsupportedCard) this.componentRef.handleUnsupportedCard(errObj);\n return this;\n }\n\n onBinLookup(obj: CardBinLookupData) {\n const nuObj = { ...obj };\n nuObj.rootNode = this._node;\n\n if (!nuObj.isReset) {\n // Add brandImage urls, first checking if the merchant has configured their own one for the brand\n nuObj.supportedBrandsRaw = obj.supportedBrandsRaw?.map((item: BrandObject) => {\n item.brandImageUrl = this.props.brandsConfiguration[item.brand]?.icon ?? getCardImageUrl(item.brand, this.resources);\n return item;\n });\n }\n\n this.props.onBinLookup(nuObj);\n }\n\n public onBinValue = triggerBinLookUp(this);\n\n get isValid() {\n return !!this.state.isValid;\n }\n\n get browserInfo() {\n return collectBrowserInfo();\n }\n\n private onFocus = (obj: CardFocusData) => {\n this.submitAnalytics({\n type: obj.focus === true ? ANALYTICS_FOCUS_STR : ANALYTICS_UNFOCUS_STR,\n target: fieldTypeToSnakeCase(obj.fieldType)\n });\n\n // Call merchant defined callback\n this.props.onFocus?.(obj);\n };\n\n protected onEnterKeyPressed = (activeElement: Element, component: UIElement) => {\n this.props.onEnterKeyPressed?.(activeElement, component);\n };\n\n render() {\n return (\n <CoreProvider i18n={this.props.i18n} loadingContext={this.props.loadingContext} resources={this.resources}>\n <CustomCardInput\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n {...this.state}\n handleKeyPress={this.handleKeyPress}\n rootNode={this._node}\n onChange={this.setState}\n onBinValue={this.onBinValue}\n implementationType={'custom'}\n resources={this.resources}\n brand={this.brand}\n onFocus={this.onFocus}\n />\n </CoreProvider>\n );\n }\n}\n\nexport default CustomCard;\n"],"names":["CustomCard","UIElement","formatProps","props","type","TxVariants","customCard","formatData","sfBrand","this","state","selectedBrandValue","paymentMethod","data","brand","browserInfo","origin","window","location","submitAnalytics","analyticsObj","super","updateStyles","stylesObj","componentRef","setFocusOn","frame","processBinLookupResponse","binLookupResponse","dualBrandingChangeHandler","e","handleUnsupportedCard","errObj","onBinLookup","obj","nuObj","rootNode","_node","isReset","supportedBrandsRaw","map","item","brandImageUrl","brandsConfiguration","icon","getCardImageUrl","resources","isValid","collectBrowserInfo","render","h","CoreProvider","i18n","loadingContext","CustomCardInput","ref","handleKeyPress","onChange","setState","onBinValue","implementationType","onFocus","args","_define_property","card","triggerBinLookUp","focus","ANALYTICS_FOCUS_STR","ANALYTICS_UNFOCUS_STR","target","fieldTypeToSnakeCase","fieldType","onEnterKeyPressed","activeElement","component","analyticsType","defaultProps"],"mappings":"otBAcO,MAAMA,UAAmBC,EAY5BC,WAAAA,CAAYC,GACR,MAAO,IACAA,EACHC,KAAMC,EAAWC,WAEzB,CAKAC,UAAAA,GACI,MAAMC,EAAUC,KAAKC,MAAMC,mBAC3B,MAAO,CACHC,cAAe,CACXR,KAAM,YACHK,KAAKC,MAAMG,QACVL,GAAW,CAAEM,MAAON,IAE5BO,YAAaN,KAAKM,YAClBC,SAAUC,QAAUA,OAAOC,SAASF,OAE5C,CAEUG,eAAAA,CAAgBC,GACtBC,MAAMF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