@adyen/adyen-web 6.28.0 → 6.29.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 (246) hide show
  1. package/dist/cjs/adyen.css +8 -6
  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 +2688 -2557
  6. package/dist/es/adyen.css +8 -6
  7. package/dist/es/adyen.css.map +1 -1
  8. package/dist/es/components/Card/Card.js +1 -1
  9. package/dist/es/components/Card/Card.js.map +1 -1
  10. package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
  11. package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
  12. package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
  13. package/dist/es/components/Econtext/Econtext.js +1 -1
  14. package/dist/es/components/Econtext/Econtext.js.map +1 -1
  15. package/dist/es/components/Econtext/components/EcontextInput/EcontextInput.js +1 -1
  16. package/dist/es/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
  17. package/dist/es/components/Econtext/components/EcontextVoucherResult/EcontextVoucherResult.js +1 -1
  18. package/dist/es/components/Econtext/components/EcontextVoucherResult/EcontextVoucherResult.js.map +1 -1
  19. package/dist/es/components/Iris/Iris.js +2 -0
  20. package/dist/es/components/Iris/Iris.js.map +1 -0
  21. package/dist/es/components/Iris/components/IrisComponent.js +2 -0
  22. package/dist/es/components/Iris/components/IrisComponent.js.map +1 -0
  23. package/dist/es/components/Iris/components/IrisComponent.module.scss.js +2 -0
  24. package/dist/es/components/Iris/components/IrisComponent.module.scss.js.map +1 -0
  25. package/dist/es/components/Iris/components/IrisGenerateQRCode.js +2 -0
  26. package/dist/es/components/Iris/components/IrisGenerateQRCode.js.map +1 -0
  27. package/dist/es/components/Iris/components/IrisGenerateQRCode.module.scss.js +2 -0
  28. package/dist/es/components/Iris/components/IrisGenerateQRCode.module.scss.js.map +1 -0
  29. package/dist/es/components/Iris/components/IrisQrCodeInstructions.js +2 -0
  30. package/dist/es/components/Iris/components/IrisQrCodeInstructions.js.map +1 -0
  31. package/dist/es/components/Iris/constants.js +2 -0
  32. package/dist/es/components/Iris/constants.js.map +1 -0
  33. package/dist/es/components/Iris/types.js +2 -0
  34. package/dist/es/components/Iris/types.js.map +1 -0
  35. package/dist/es/components/Iris/utils.js +2 -0
  36. package/dist/es/components/Iris/utils.js.map +1 -0
  37. package/dist/es/components/PayTo/components/PayToComponent.js +1 -1
  38. package/dist/es/components/PayTo/components/PayToComponent.js.map +1 -1
  39. package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
  40. package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
  41. package/dist/es/components/components-name-map.js +1 -1
  42. package/dist/es/components/components-name-map.js.map +1 -1
  43. package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  44. package/dist/es/components/index.js +1 -1
  45. package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
  46. package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
  47. package/dist/es/components/internal/PersonalDetails/PersonalDetails.js +1 -1
  48. package/dist/es/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
  49. package/dist/es/components/internal/QRLoader/QRLoader.js.map +1 -1
  50. package/dist/es/components/internal/SegmentedControl/SegmentedControl.js +1 -1
  51. package/dist/es/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
  52. package/dist/es/components/internal/SegmentedControl/SegmentedControlRegion.js +2 -0
  53. package/dist/es/components/internal/SegmentedControl/SegmentedControlRegion.js.map +1 -0
  54. package/dist/es/components/internal/Voucher/Voucher.js +1 -1
  55. package/dist/es/components/internal/Voucher/Voucher.js.map +1 -1
  56. package/dist/es/components/internal/Voucher/utils.js.map +1 -1
  57. package/dist/es/components/tx-variants.js +1 -1
  58. package/dist/es/components/tx-variants.js.map +1 -1
  59. package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
  60. package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
  61. package/dist/es/core/ProcessResponse/PaymentMethods/PaymentMethods.js +1 -1
  62. package/dist/es/core/ProcessResponse/PaymentMethods/PaymentMethods.js.map +1 -1
  63. package/dist/es/core/ProcessResponse/PaymentMethods/utils.js +1 -1
  64. package/dist/es/core/ProcessResponse/PaymentMethods/utils.js.map +1 -1
  65. package/dist/es/core/config.js +1 -1
  66. package/dist/es/index.d.ts +2688 -2557
  67. package/dist/es/index.js +1 -1
  68. package/dist/es/language/Language.js.map +1 -1
  69. package/dist/es/utils/createSdkData.js +2 -0
  70. package/dist/es/utils/createSdkData.js.map +1 -0
  71. package/dist/es-legacy/adyen.css +8 -6
  72. package/dist/es-legacy/adyen.css.map +1 -1
  73. package/dist/es-legacy/components/ApplePay/ApplePay.js +1 -1
  74. package/dist/es-legacy/components/ApplePay/ApplePay.js.map +1 -1
  75. package/dist/es-legacy/components/ApplePay/utils/payment-request.js +1 -1
  76. package/dist/es-legacy/components/ApplePay/utils/payment-request.js.map +1 -1
  77. package/dist/es-legacy/components/BankTransfer/components/BankTransferResult/BankTransferVoucher.js +1 -1
  78. package/dist/es-legacy/components/BankTransfer/components/BankTransferResult/BankTransferVoucher.js.map +1 -1
  79. package/dist/es-legacy/components/Card/Card.js +1 -1
  80. package/dist/es-legacy/components/Card/Card.js.map +1 -1
  81. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
  82. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
  83. package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js +1 -1
  84. package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
  85. package/dist/es-legacy/components/Card/components/CardInput/components/Installments/Installments.js +1 -1
  86. package/dist/es-legacy/components/Card/components/CardInput/components/Installments/Installments.js.map +1 -1
  87. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  88. package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js +1 -1
  89. package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -1
  90. package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
  91. package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
  92. package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js +1 -1
  93. package/dist/es-legacy/components/Card/components/ClickToPayWrapper.js.map +1 -1
  94. package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
  95. package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
  96. package/dist/es-legacy/components/Dragonpay/Dragonpay.js +1 -1
  97. package/dist/es-legacy/components/Dragonpay/Dragonpay.js.map +1 -1
  98. package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
  99. package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
  100. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
  101. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
  102. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js +1 -1
  103. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js.map +1 -1
  104. package/dist/es-legacy/components/Econtext/Econtext.js +1 -1
  105. package/dist/es-legacy/components/Econtext/Econtext.js.map +1 -1
  106. package/dist/es-legacy/components/Econtext/components/EcontextInput/EcontextInput.js +1 -1
  107. package/dist/es-legacy/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
  108. package/dist/es-legacy/components/Econtext/components/EcontextVoucherResult/EcontextVoucherResult.js +1 -1
  109. package/dist/es-legacy/components/Econtext/components/EcontextVoucherResult/EcontextVoucherResult.js.map +1 -1
  110. package/dist/es-legacy/components/GooglePay/GooglePay.js +1 -1
  111. package/dist/es-legacy/components/GooglePay/GooglePay.js.map +1 -1
  112. package/dist/es-legacy/components/GooglePay/requests.js +1 -1
  113. package/dist/es-legacy/components/GooglePay/requests.js.map +1 -1
  114. package/dist/es-legacy/components/Iris/Iris.js +2 -0
  115. package/dist/es-legacy/components/Iris/Iris.js.map +1 -0
  116. package/dist/es-legacy/components/Iris/components/IrisComponent.js +2 -0
  117. package/dist/es-legacy/components/Iris/components/IrisComponent.js.map +1 -0
  118. package/dist/es-legacy/components/Iris/components/IrisComponent.module.scss.js +2 -0
  119. package/dist/es-legacy/components/Iris/components/IrisComponent.module.scss.js.map +1 -0
  120. package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.js +2 -0
  121. package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.js.map +1 -0
  122. package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.module.scss.js +2 -0
  123. package/dist/es-legacy/components/Iris/components/IrisGenerateQRCode.module.scss.js.map +1 -0
  124. package/dist/es-legacy/components/Iris/components/IrisQrCodeInstructions.js +2 -0
  125. package/dist/es-legacy/components/Iris/components/IrisQrCodeInstructions.js.map +1 -0
  126. package/dist/es-legacy/components/Iris/constants.js +2 -0
  127. package/dist/es-legacy/components/Iris/constants.js.map +1 -0
  128. package/dist/es-legacy/components/Iris/types.js +2 -0
  129. package/dist/es-legacy/components/Iris/types.js.map +1 -0
  130. package/dist/es-legacy/components/Iris/utils.js +2 -0
  131. package/dist/es-legacy/components/Iris/utils.js.map +1 -0
  132. package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js +1 -1
  133. package/dist/es-legacy/components/Klarna/components/KlarnaContainer/KlarnaContainer.js.map +1 -1
  134. package/dist/es-legacy/components/Klarna/components/KlarnaWidget/KlarnaWidget.js +1 -1
  135. package/dist/es-legacy/components/Klarna/components/KlarnaWidget/KlarnaWidget.js.map +1 -1
  136. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js +1 -1
  137. package/dist/es-legacy/components/PayByBankPix/PayByBankPix.js.map +1 -1
  138. package/dist/es-legacy/components/PayPal/Paypal.js +1 -1
  139. package/dist/es-legacy/components/PayPal/Paypal.js.map +1 -1
  140. package/dist/es-legacy/components/PayPal/components/PaypalButtons.js +1 -1
  141. package/dist/es-legacy/components/PayPal/components/PaypalButtons.js.map +1 -1
  142. package/dist/es-legacy/components/PayPal/components/PaypalComponent.js +1 -1
  143. package/dist/es-legacy/components/PayPal/components/PaypalComponent.js.map +1 -1
  144. package/dist/es-legacy/components/PayTo/components/PayToComponent.js +1 -1
  145. package/dist/es-legacy/components/PayTo/components/PayToComponent.js.map +1 -1
  146. package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js +1 -1
  147. package/dist/es-legacy/components/PreAuthorizedDebitCanada/PreAuthorizedDebitCanada.js.map +1 -1
  148. package/dist/es-legacy/components/ThreeDS2/callSubmit3DS2Fingerprint.js +1 -1
  149. package/dist/es-legacy/components/ThreeDS2/callSubmit3DS2Fingerprint.js.map +1 -1
  150. package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
  151. package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
  152. package/dist/es-legacy/components/components-name-map.js +1 -1
  153. package/dist/es-legacy/components/components-name-map.js.map +1 -1
  154. package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
  155. package/dist/es-legacy/components/index.js +1 -1
  156. package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
  157. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
  158. package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
  159. package/dist/es-legacy/components/internal/Button/CopyButton.js +1 -1
  160. package/dist/es-legacy/components/internal/Button/CopyButton.js.map +1 -1
  161. package/dist/es-legacy/components/internal/Button/CopyIconButton.js +1 -1
  162. package/dist/es-legacy/components/internal/Button/CopyIconButton.js.map +1 -1
  163. package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js +1 -1
  164. package/dist/es-legacy/components/internal/FormFields/Checkbox/Checkbox.js.map +1 -1
  165. package/dist/es-legacy/components/internal/FormFields/ConsentCheckbox/ConsentCheckbox.js +1 -1
  166. package/dist/es-legacy/components/internal/FormFields/ConsentCheckbox/ConsentCheckbox.js.map +1 -1
  167. package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
  168. package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
  169. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js +1 -1
  170. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
  171. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectList.js +1 -1
  172. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectList.js.map +1 -1
  173. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js +1 -1
  174. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectListItem.js.map +1 -1
  175. package/dist/es-legacy/components/internal/IssuerList/IssuerList.js +1 -1
  176. package/dist/es-legacy/components/internal/IssuerList/IssuerList.js.map +1 -1
  177. package/dist/es-legacy/components/internal/Modal/Modal.js +1 -1
  178. package/dist/es-legacy/components/internal/Modal/Modal.js.map +1 -1
  179. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js +1 -1
  180. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  181. package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js +1 -1
  182. package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -1
  183. package/dist/es-legacy/components/internal/PayButton/PayButton.js +1 -1
  184. package/dist/es-legacy/components/internal/PayButton/PayButton.js.map +1 -1
  185. package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js +1 -1
  186. package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
  187. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputFields.js +1 -1
  188. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputFields.js.map +1 -1
  189. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js +1 -1
  190. package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js.map +1 -1
  191. package/dist/es-legacy/components/internal/QRLoader/QRLoader.js.map +1 -1
  192. package/dist/es-legacy/components/internal/QRLoader/QRLoaderDetailsProvider.js +1 -1
  193. package/dist/es-legacy/components/internal/QRLoader/QRLoaderDetailsProvider.js.map +1 -1
  194. package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js +1 -1
  195. package/dist/es-legacy/components/internal/RedirectButton/RedirectButton.js.map +1 -1
  196. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  197. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  198. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
  199. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
  200. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
  201. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
  202. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js +1 -1
  203. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleBrandFromBinLookup.js.map +1 -1
  204. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleConfig.js +1 -1
  205. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleConfig.js.map +1 -1
  206. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.js +1 -1
  207. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/handleIOSTouchEvents.js.map +1 -1
  208. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/utils/processPlaceholders.js.map +1 -1
  209. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js +1 -1
  210. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
  211. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControlRegion.js +2 -0
  212. package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControlRegion.js.map +1 -0
  213. package/dist/es-legacy/components/internal/StoreDetails/StoreDetails.js +1 -1
  214. package/dist/es-legacy/components/internal/StoreDetails/StoreDetails.js.map +1 -1
  215. package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
  216. package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
  217. package/dist/es-legacy/components/internal/Voucher/Voucher.js +1 -1
  218. package/dist/es-legacy/components/internal/Voucher/Voucher.js.map +1 -1
  219. package/dist/es-legacy/components/internal/Voucher/utils.js.map +1 -1
  220. package/dist/es-legacy/components/tx-variants.js +1 -1
  221. package/dist/es-legacy/components/tx-variants.js.map +1 -1
  222. package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
  223. package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
  224. package/dist/es-legacy/core/Analytics/utils.js +1 -1
  225. package/dist/es-legacy/core/Analytics/utils.js.map +1 -1
  226. package/dist/es-legacy/core/Context/Resources.js +1 -1
  227. package/dist/es-legacy/core/Context/Resources.js.map +1 -1
  228. package/dist/es-legacy/core/ProcessResponse/PaymentMethods/PaymentMethods.js +1 -1
  229. package/dist/es-legacy/core/ProcessResponse/PaymentMethods/PaymentMethods.js.map +1 -1
  230. package/dist/es-legacy/core/ProcessResponse/PaymentMethods/utils.js +1 -1
  231. package/dist/es-legacy/core/ProcessResponse/PaymentMethods/utils.js.map +1 -1
  232. package/dist/es-legacy/core/config.js +1 -1
  233. package/dist/es-legacy/core/core.js +1 -1
  234. package/dist/es-legacy/core/core.js.map +1 -1
  235. package/dist/es-legacy/hooks/usePaymentStatusTimer/usePaymentStatusTimer.js +1 -1
  236. package/dist/es-legacy/hooks/usePaymentStatusTimer/usePaymentStatusTimer.js.map +1 -1
  237. package/dist/es-legacy/index.js +1 -1
  238. package/dist/es-legacy/language/Language.js.map +1 -1
  239. package/dist/es-legacy/utils/Validator/Validator.js.map +1 -1
  240. package/dist/es-legacy/utils/commonUtils.js.map +1 -1
  241. package/dist/es-legacy/utils/createSdkData.js +2 -0
  242. package/dist/es-legacy/utils/createSdkData.js.map +1 -0
  243. package/dist/es-legacy/utils/useForm/reducer.js +1 -1
  244. package/dist/es-legacy/utils/useForm/reducer.js.map +1 -1
  245. package/package.json +12 -12
  246. package/styles/adyen.css +8 -6
@@ -1 +1 @@
1
- {"version":3,"file":"PhoneInputFields.js","sources":["../../../../../src/components/internal/PhoneInput/PhoneInputFields.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useEffect } from 'preact/hooks';\nimport Field from '../FormFields/Field';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport './PhoneInput.scss';\nimport Select from '../FormFields/Select';\nimport { PhoneInputSchema } from './types';\nimport InputText from '../FormFields/InputText';\nimport { DataSet } from '../../../core/Services/data-set';\nimport { Form } from '../../../utils/useForm/types';\n\nexport interface PhoneInputFieldProps {\n items: DataSet;\n requiredFields?: string[];\n form: Form<PhoneInputSchema>;\n getError: (key: string) => string | boolean;\n phoneNumberKey?: string;\n phonePrefixErrorKey?: string;\n phoneNumberErrorKey?: string;\n placeholders?: PhoneInputSchema;\n showPrefix?: boolean;\n showNumber?: boolean;\n canSelectPrefix?: boolean;\n}\n/**\n *\n * @param PhoneInputFormProps\n * @constructor\n */\nexport default function PhoneInputFields({ getError, showNumber, showPrefix, form, canSelectPrefix = true, ...props }: PhoneInputFieldProps) {\n const { i18n } = useCoreContext();\n\n const { handleChangeFor, data, valid } = form;\n\n // Force re-validation of the phoneNumber when data.phonePrefix changes (since the validation rules will also change)\n useEffect((): void => {\n if (data.phoneNumber) {\n handleChangeFor('phoneNumber', 'blur')(data.phoneNumber);\n }\n }, [data.phonePrefix]);\n\n return (\n <Fragment>\n {showPrefix && (\n <Field\n className={'adyen-checkout-field--phone-prefix'}\n label={i18n.get('telephonePrefix')}\n errorMessage={getError('phonePrefix')}\n showValidIcon={false}\n isValid={valid.phonePrefix}\n dir={'ltr'}\n i18n={i18n}\n name={'phonePrefix'}\n >\n <Select\n readonly={!canSelectPrefix}\n className={'adyen-checkout-dropdown adyen-checkout-dropdown--countrycode-selector'}\n name={'phonePrefix'}\n items={props.items}\n onChange={handleChangeFor('phonePrefix')}\n placeholder={props?.placeholders?.phonePrefix}\n selectedValue={data.phonePrefix}\n />\n </Field>\n )}\n\n {showNumber && (\n <Field\n className={'adyen-checkout-field--phone-number'}\n label={props.phoneNumberKey ? i18n.get(props.phoneNumberKey) : i18n.get('telephoneNumber')}\n errorMessage={getError('phoneNumber')}\n isValid={valid.phoneNumber}\n filled={data?.phoneNumber?.length > 0}\n dir={'ltr'}\n i18n={i18n}\n name={'phoneNumber'}\n >\n <InputText\n className=\"adyen-checkout__input adyen-checkout-input adyen-checkout-input--phone-number\"\n type=\"tel\"\n name=\"phoneNumber\"\n value={data.phoneNumber}\n onInput={handleChangeFor('phoneNumber', 'input')}\n onBlur={handleChangeFor('phoneNumber', 'blur')}\n placeholder={props?.placeholders?.phoneNumber}\n autoCorrect=\"off\"\n required={true}\n />\n </Field>\n )}\n </Fragment>\n );\n}\n"],"names":["PhoneInputFields","_param","props","data","getError","showNumber","showPrefix","form","canSelectPrefix","i18n","useCoreContext","handleChangeFor","valid","useEffect","phoneNumber","phonePrefix","h","Fragment","Field","className","label","get","errorMessage","showValidIcon","isValid","dir","name","Select","readonly","items","onChange","placeholder","placeholders","selectedValue","phoneNumberKey","filled","length","InputText","type","value","onInput","onBlur","autoCorrect","required"],"mappings":"8tBA6Be,SAASA,EAAiBC,GAAA,IA+BJC,EAYTC,EAYSD,GAvDIE,SAAEA,EAAQC,WAAEA,EAAUC,WAAEA,EAAUC,KAAEA,EAAIC,gBAAEA,G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PhoneInputFields.js","sources":["../../../../../src/components/internal/PhoneInput/PhoneInputFields.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport { useEffect } from 'preact/hooks';\nimport Field from '../FormFields/Field';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport './PhoneInput.scss';\nimport Select from '../FormFields/Select';\nimport { PhoneInputSchema } from './types';\nimport InputText from '../FormFields/InputText';\nimport { DataSet } from '../../../core/Services/data-set';\nimport { Form } from '../../../utils/useForm/types';\n\nexport interface PhoneInputFieldProps {\n items: DataSet;\n requiredFields?: string[];\n form: Form<PhoneInputSchema>;\n getError: (key: string) => string | boolean;\n phoneNumberKey?: string;\n phonePrefixErrorKey?: string;\n phoneNumberErrorKey?: string;\n placeholders?: PhoneInputSchema;\n showPrefix?: boolean;\n showNumber?: boolean;\n canSelectPrefix?: boolean;\n}\n/**\n *\n * @param PhoneInputFormProps\n * @constructor\n */\nexport default function PhoneInputFields({ getError, showNumber, showPrefix, form, canSelectPrefix = true, ...props }: PhoneInputFieldProps) {\n const { i18n } = useCoreContext();\n\n const { handleChangeFor, data, valid } = form;\n\n // Force re-validation of the phoneNumber when data.phonePrefix changes (since the validation rules will also change)\n useEffect((): void => {\n if (data.phoneNumber) {\n handleChangeFor('phoneNumber', 'blur')(data.phoneNumber);\n }\n }, [data.phonePrefix]);\n\n return (\n <Fragment>\n {showPrefix && (\n <Field\n className={'adyen-checkout-field--phone-prefix'}\n label={i18n.get('telephonePrefix')}\n errorMessage={getError('phonePrefix')}\n showValidIcon={false}\n isValid={valid.phonePrefix}\n dir={'ltr'}\n i18n={i18n}\n name={'phonePrefix'}\n >\n <Select\n readonly={!canSelectPrefix}\n className={'adyen-checkout-dropdown adyen-checkout-dropdown--countrycode-selector'}\n name={'phonePrefix'}\n items={props.items}\n onChange={handleChangeFor('phonePrefix')}\n placeholder={props?.placeholders?.phonePrefix}\n selectedValue={data.phonePrefix}\n />\n </Field>\n )}\n\n {showNumber && (\n <Field\n className={'adyen-checkout-field--phone-number'}\n label={props.phoneNumberKey ? i18n.get(props.phoneNumberKey) : i18n.get('telephoneNumber')}\n errorMessage={getError('phoneNumber')}\n isValid={valid.phoneNumber}\n filled={data?.phoneNumber?.length > 0}\n dir={'ltr'}\n i18n={i18n}\n name={'phoneNumber'}\n >\n <InputText\n className=\"adyen-checkout__input adyen-checkout-input adyen-checkout-input--phone-number\"\n type=\"tel\"\n name=\"phoneNumber\"\n value={data.phoneNumber}\n onInput={handleChangeFor('phoneNumber', 'input')}\n onBlur={handleChangeFor('phoneNumber', 'blur')}\n placeholder={props?.placeholders?.phoneNumber}\n autoCorrect=\"off\"\n required={true}\n />\n </Field>\n )}\n </Fragment>\n );\n}\n"],"names":["PhoneInputFields","_0","getError","showNumber","showPrefix","form","canSelectPrefix","props","data","i18n","useCoreContext","handleChangeFor","valid","useEffect","phoneNumber","phonePrefix","h","Fragment","Field","className","label","get","errorMessage","showValidIcon","isValid","dir","name","Select","readonly","items","onChange","placeholder","placeholders","selectedValue","phoneNumberKey","filled","length","InputText","type","value","onInput","onBlur","autoCorrect","required"],"mappings":"29BA6Be,SAASA,EAAiBC,OAAAC,SAAEA,EAAQC,WAAEA,EAAUC,WAAEA,EAAUC,KAAEA,EAAIC,gBAAEA,GAAkB,GAAsCL,EAA7BM,EAAAA,EAAAA,EAAAA,iEA+BzEA,IAAAA,EAYTC,EAYSD,EAtDjC,MAAME,KAAEA,GAASC,KAEXC,gBAAEA,EAAeH,KAAEA,EAAII,MAAEA,GAAUP,EASzC,OANAQ,EAAU,KACFL,EAAKM,aACLH,EAAgB,cAAe,OAA/BA,CAAuCH,EAAKM,cAEjD,CAACN,EAAKO,cAGLC,EAACC,EAAAA,KACIb,GACGY,EAACE,EAAAA,CACGC,UAAW,qCACXC,MAAOX,EAAKY,IAAI,mBAChBC,aAAcpB,EAAS,eACvBqB,eAAe,EACfC,QAASZ,EAAMG,YACfU,IAAK,MACLhB,KAAMA,EACNiB,KAAM,eAENV,EAACW,EAAAA,CACGC,UAAWtB,EACXa,UAAW,wEACXO,KAAM,cACNG,MAAOtB,EAAMsB,MACbC,SAAUnB,EAAgB,eAC1BoB,YAAaxB,SAAmB,QAAnBA,EAAAA,EAAOyB,oBAAPzB,IAAAA,OAAAA,EAAAA,EAAqBQ,YAClCkB,cAAezB,EAAKO,eAK/BZ,GACGa,EAACE,EAAAA,CACGC,UAAW,qCACXC,MAAOb,EAAM2B,eAAiBzB,EAAKY,IAAId,EAAM2B,gBAAkBzB,EAAKY,IAAI,mBACxEC,aAAcpB,EAAS,eACvBsB,QAASZ,EAAME,YACfqB,QAAQ3B,SAAiB,QAAjBA,EAAAA,EAAMM,mBAANN,IAAAA,OAAAA,EAAAA,EAAmB4B,QAAS,EACpCX,IAAK,MACLhB,KAAMA,EACNiB,KAAM,eAENV,EAACqB,EAAAA,CACGlB,UAAU,gFACVmB,KAAK,MACLZ,KAAK,cACLa,MAAO/B,EAAKM,YACZ0B,QAAS7B,EAAgB,cAAe,SACxC8B,OAAQ9B,EAAgB,cAAe,QACvCoB,YAAaxB,SAAmB,QAAnBA,EAAAA,EAAOyB,oBAAPzB,IAAAA,OAAAA,EAAAA,EAAqBO,YAClC4B,YAAY,MACZC,UAAU,KAMlC"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../external/preact/dist/preact.js";import{useEffect as r,useRef as t,useCallback as o}from"../../../external/preact/hooks/dist/hooks.js";import n from"../../../utils/useForm/useForm.js";import{useCoreContext as i}from"../../../core/Context/CoreProvider.js";import{phoneFormatters as s,phoneValidationRules as l}from"./validate.js";import a from"../FormFields/Fieldset/Fieldset.js";import u from"./PhoneInputFields.js";function c(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function p(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},o=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.forEach(function(r){c(e,r,t[r])})}return e}function f(e,r){return r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):function(e){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r.push.apply(r,t)}return r}(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}function m(c){var m,d;const{i18n:b}=i(),h=c.requiredFields||[...(null==c||null===(m=c.items)||void 0===m?void 0:m.length)?["phonePrefix"]:[],"phoneNumber"],O=h.includes("phonePrefix")&&!!(null==c||null===(d=c.items)||void 0===d?void 0:d.length),j=h.includes("phoneNumber"),y=n(f(p({i18n:b},c),{schema:h,defaultData:c.data,rules:l,formatters:s}));r(()=>{y.setSchema(h)},[h.toString()]);const{data:g,valid:P,errors:v,isValid:w,triggerValidation:x}=y;r(()=>{c.onChange({data:g,valid:P,errors:v,isValid:w})},[g,P,v,w]);const F=t({showValidation:x});r(()=>{c.setComponentRef(F.current)},[c.setComponentRef]);const E=o(e=>{if(v[e]){const t="phoneNumber"===e?"phoneNumberErrorKey":"phonePrefixErrorKey",o=c[t]?c[t]:v[e].errorMessage;var r;return null!==(r=b.get(o))&&void 0!==r?r:null}return null},[v]);return e(a,{classNameModifiers:["phone-input"]},e(u,p({getError:E,showNumber:j,showPrefix:O,form:y},c)))}m.defaultProps={phoneLabel:"telephoneNumber"};export{m as default};
1
+ import{createElement as e}from"../../../external/preact/dist/preact.js";import{useEffect as r,useRef as t,useCallback as o}from"../../../external/preact/hooks/dist/hooks.js";import n from"../../../utils/useForm/useForm.js";import{useCoreContext as i}from"../../../core/Context/CoreProvider.js";import{phoneFormatters as s,phoneValidationRules as l}from"./validate.js";import a from"../FormFields/Fieldset/Fieldset.js";import u from"./PhoneInputFields.js";function c(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function p(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},o=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.forEach(function(r){c(e,r,t[r])})}return e}function f(e,r){return r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):function(e){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r.push.apply(r,t)}return r}(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}function m(c){var m,d;const{i18n:b}=i(),h=c.requiredFields||[...(null==c||null===(m=c.items)||void 0===m?void 0:m.length)?["phonePrefix"]:[],"phoneNumber"],O=h.includes("phonePrefix")&&!!(null==c||null===(d=c.items)||void 0===d?void 0:d.length),j=h.includes("phoneNumber"),y=n(f(p({i18n:b},c),{schema:h,defaultData:c.data,rules:l,formatters:s}));r(()=>{y.setSchema(h)},[h.toString()]);const{data:g,valid:P,errors:v,isValid:w,triggerValidation:x}=y;r(()=>{c.onChange({data:g,valid:P,errors:v,isValid:w})},[g,P,v,w]);const F=t({showValidation:x});r(()=>{c.setComponentRef(F.current)},[c.setComponentRef]);const E=o(e=>{if(v[e]){var r;const t="phoneNumber"===e?"phoneNumberErrorKey":"phonePrefixErrorKey",o=c[t]?c[t]:v[e].errorMessage;return null!==(r=b.get(o))&&void 0!==r?r:null}return null},[v]);return e(a,{classNameModifiers:["phone-input"]},e(u,p({getError:E,showNumber:j,showPrefix:O,form:y},c)))}m.defaultProps={phoneLabel:"telephoneNumber"};export{m as default};
2
2
  //# sourceMappingURL=PhoneInputForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PhoneInputForm.js","sources":["../../../../../src/components/internal/PhoneInput/PhoneInputForm.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useCallback, useRef } from 'preact/hooks';\nimport useForm from '../../../utils/useForm';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport './PhoneInput.scss';\nimport { phoneFormatters, phoneValidationRules } from './validate';\nimport { PhoneInputFormProps, PhoneInputSchema } from './types';\nimport Fieldset from '../FormFields/Fieldset';\nimport PhoneInputFields from './PhoneInputFields';\nimport { ComponentMethodsRef } from '../UIElement/types';\n\n/**\n *\n * @param PhoneInputFormProps\n * @constructor\n */\nfunction PhoneInputForm(props: PhoneInputFormProps) {\n const { i18n } = useCoreContext();\n\n const schema = props.requiredFields || [...(props?.items?.length ? ['phonePrefix'] : []), 'phoneNumber'];\n const showPrefix = schema.includes('phonePrefix') && !!props?.items?.length;\n const showNumber = schema.includes('phoneNumber');\n\n const form = useForm<PhoneInputSchema>({\n i18n,\n ...props,\n schema,\n defaultData: props.data,\n rules: phoneValidationRules,\n formatters: phoneFormatters\n });\n\n useEffect(() => {\n form.setSchema(schema);\n }, [schema.toString()]);\n\n const { data, valid, errors, isValid, triggerValidation } = form;\n\n useEffect(() => {\n props.onChange({ data, valid, errors, isValid });\n }, [data, valid, errors, isValid]);\n\n const componentRef = useRef<ComponentMethodsRef>({\n showValidation: triggerValidation\n });\n\n useEffect(() => {\n props.setComponentRef(componentRef.current);\n }, [props.setComponentRef]);\n\n // This is here for MBWay, prob should be moved up\n // MBWay has a weird way of loading its error messages\n // They come form the prop phoneNumberErrorKey: 'mobileNumber.invalid'\n // Strangely it's defined as invalidPhoneNumber in the validation rules\n const getPhoneFieldError = useCallback(\n (field: string) => {\n if (errors[field]) {\n const propsField = field === 'phoneNumber' ? 'phoneNumberErrorKey' : 'phonePrefixErrorKey';\n const key = props[propsField] ? props[propsField] : errors[field].errorMessage;\n return i18n.get(key) ?? null;\n }\n return null;\n },\n [errors]\n );\n\n return (\n <Fieldset classNameModifiers={['phone-input']}>\n <PhoneInputFields getError={getPhoneFieldError} showNumber={showNumber} showPrefix={showPrefix} form={form} {...props} />\n </Fieldset>\n );\n}\n\nPhoneInputForm.defaultProps = {\n phoneLabel: 'telephoneNumber'\n};\n\nexport default PhoneInputForm;\n"],"names":["PhoneInputForm","props","i18n","useCoreContext","schema","requiredFields","items","length","showPrefix","includes","showNumber","form","useForm","_object_spread_props","_object_spread","defaultData","data","rules","phoneValidationRules","formatters","phoneFormatters","useEffect","setSchema","toString","valid","errors","isValid","triggerValidation","onChange","componentRef","useRef","showValidation","setComponentRef","current","getPhoneFieldError","useCallback","field","propsField","key","errorMessage","get","h","Fieldset","classNameModifiers","PhoneInputFields","getError","defaultProps","phoneLabel"],"mappings":"gvCAgBA,SAASA,EAAeC,OAGwBA,EACWA,EAHvD,MAAMC,KAAEA,GAASC,IAEXC,EAASH,EAAMI,gBAAkB,KAAKJ,SAAY,QAAZA,EAAAA,EAAOK,aAAPL,IAAAA,SAAAA,EAAcM,QAAS,CAAC,eAAiB,GAAK,eACpFC,EAAaJ,EAAOK,SAAS,mBAAoBR,SAAY,QAAZA,EAAAA,EAAOK,aAAPL,IAAAA,OAAAA,EAAAA,EAAcM,QAC/DG,EAAaN,EAAOK,SAAS,eAE7BE,EAAOC,EAA0BC,EAAAC,EAAA,CACnCZ,QACGD,GAAAA,CACHG,SACAW,YAAad,EAAMe,KACnBC,MAAOC,EACPC,WAAYC,KAGhBC,EAAU,KACNV,EAAKW,UAAUlB,IAChB,CAACA,EAAOmB,aAEX,MAAMP,KAAEA,EAAIQ,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,EAAOC,kBAAEA,GAAsBhB,EAE5DU,EAAU,KACNpB,EAAM2B,SAAS,CAAEZ,OAAMQ,QAAOC,SAAQC,aACvC,CAACV,EAAMQ,EAAOC,EAAQC,IAEzB,MAAMG,EAAeC,EAA4B,CAC7CC,eAAgBJ,IAGpBN,EAAU,KACNpB,EAAM+B,gBAAgBH,EAAaI,UACpC,CAAChC,EAAM+B,kBAMV,MAAME,EAAqBC,EACtBC,IACG,GAAIX,EAAOW,GAAQ,CACf,MAAMC,EAAuB,gBAAVD,EAA0B,sBAAwB,sBAC/DE,EAAMrC,EAAMoC,GAAcpC,EAAMoC,GAAcZ,EAAOW,GAAOG,aAC3DrC,IAAAA,EAAP,OAAgBoC,QAATpC,EAAAA,EAAKsC,IAAIF,cAATpC,EAAAA,EAAiB,IAC5B,CACA,OAAO,MAEX,CAACuB,IAGL,OACIgB,EAACC,EAAAA,CAASC,mBAAoB,CAAC,gBAC3BF,EAACG,EAAAA,EAAAA,CAAiBC,SAAUX,EAAoBxB,WAAYA,EAAYF,WAAYA,EAAYG,KAAMA,GAAUV,IAG5H,CAEAD,EAAe8C,aAAe,CAC1BC,WAAY"}
1
+ {"version":3,"file":"PhoneInputForm.js","sources":["../../../../../src/components/internal/PhoneInput/PhoneInputForm.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useCallback, useRef } from 'preact/hooks';\nimport useForm from '../../../utils/useForm';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport './PhoneInput.scss';\nimport { phoneFormatters, phoneValidationRules } from './validate';\nimport { PhoneInputFormProps, PhoneInputSchema } from './types';\nimport Fieldset from '../FormFields/Fieldset';\nimport PhoneInputFields from './PhoneInputFields';\nimport { ComponentMethodsRef } from '../UIElement/types';\n\n/**\n *\n * @param PhoneInputFormProps\n * @constructor\n */\nfunction PhoneInputForm(props: PhoneInputFormProps) {\n const { i18n } = useCoreContext();\n\n const schema = props.requiredFields || [...(props?.items?.length ? ['phonePrefix'] : []), 'phoneNumber'];\n const showPrefix = schema.includes('phonePrefix') && !!props?.items?.length;\n const showNumber = schema.includes('phoneNumber');\n\n const form = useForm<PhoneInputSchema>({\n i18n,\n ...props,\n schema,\n defaultData: props.data,\n rules: phoneValidationRules,\n formatters: phoneFormatters\n });\n\n useEffect(() => {\n form.setSchema(schema);\n }, [schema.toString()]);\n\n const { data, valid, errors, isValid, triggerValidation } = form;\n\n useEffect(() => {\n props.onChange({ data, valid, errors, isValid });\n }, [data, valid, errors, isValid]);\n\n const componentRef = useRef<ComponentMethodsRef>({\n showValidation: triggerValidation\n });\n\n useEffect(() => {\n props.setComponentRef(componentRef.current);\n }, [props.setComponentRef]);\n\n // This is here for MBWay, prob should be moved up\n // MBWay has a weird way of loading its error messages\n // They come form the prop phoneNumberErrorKey: 'mobileNumber.invalid'\n // Strangely it's defined as invalidPhoneNumber in the validation rules\n const getPhoneFieldError = useCallback(\n (field: string) => {\n if (errors[field]) {\n const propsField = field === 'phoneNumber' ? 'phoneNumberErrorKey' : 'phonePrefixErrorKey';\n const key = props[propsField] ? props[propsField] : errors[field].errorMessage;\n return i18n.get(key) ?? null;\n }\n return null;\n },\n [errors]\n );\n\n return (\n <Fieldset classNameModifiers={['phone-input']}>\n <PhoneInputFields getError={getPhoneFieldError} showNumber={showNumber} showPrefix={showPrefix} form={form} {...props} />\n </Fieldset>\n );\n}\n\nPhoneInputForm.defaultProps = {\n phoneLabel: 'telephoneNumber'\n};\n\nexport default PhoneInputForm;\n"],"names":["PhoneInputForm","props","i18n","useCoreContext","schema","requiredFields","items","length","showPrefix","includes","showNumber","form","useForm","_object_spread_props","_object_spread","defaultData","data","rules","phoneValidationRules","formatters","phoneFormatters","useEffect","setSchema","toString","valid","errors","isValid","triggerValidation","onChange","componentRef","useRef","showValidation","setComponentRef","current","getPhoneFieldError","useCallback","field","propsField","key","errorMessage","get","h","Fieldset","classNameModifiers","PhoneInputFields","getError","defaultProps","phoneLabel"],"mappings":"gvCAgBA,SAASA,EAAeC,OAGwBA,EACWA,EAHvD,MAAMC,KAAEA,GAASC,IAEXC,EAASH,EAAMI,gBAAkB,KAAKJ,SAAY,QAAZA,EAAAA,EAAOK,aAAPL,IAAAA,SAAAA,EAAcM,QAAS,CAAC,eAAiB,GAAK,eACpFC,EAAaJ,EAAOK,SAAS,mBAAoBR,SAAY,QAAZA,EAAAA,EAAOK,aAAPL,IAAAA,OAAAA,EAAAA,EAAcM,QAC/DG,EAAaN,EAAOK,SAAS,eAE7BE,EAAOC,EAA0BC,EAAAC,EAAA,CACnCZ,QACGD,GAAAA,CACHG,SACAW,YAAad,EAAMe,KACnBC,MAAOC,EACPC,WAAYC,KAGhBC,EAAU,KACNV,EAAKW,UAAUlB,IAChB,CAACA,EAAOmB,aAEX,MAAMP,KAAEA,EAAIQ,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,EAAOC,kBAAEA,GAAsBhB,EAE5DU,EAAU,KACNpB,EAAM2B,SAAS,CAAEZ,OAAMQ,QAAOC,SAAQC,aACvC,CAACV,EAAMQ,EAAOC,EAAQC,IAEzB,MAAMG,EAAeC,EAA4B,CAC7CC,eAAgBJ,IAGpBN,EAAU,KACNpB,EAAM+B,gBAAgBH,EAAaI,UACpC,CAAChC,EAAM+B,kBAMV,MAAME,EAAqBC,EACtBC,IACG,GAAIX,EAAOW,GAAQ,CAGRlC,IAAAA,EAFP,MAAMmC,EAAuB,gBAAVD,EAA0B,sBAAwB,sBAC/DE,EAAMrC,EAAMoC,GAAcpC,EAAMoC,GAAcZ,EAAOW,GAAOG,aAClE,OAAgBD,QAATpC,EAAAA,EAAKsC,IAAIF,cAATpC,EAAAA,EAAiB,IAC5B,CACA,OAAO,MAEX,CAACuB,IAGL,OACIgB,EAACC,EAAAA,CAASC,mBAAoB,CAAC,gBAC3BF,EAACG,EAAAA,EAAAA,CAAiBC,SAAUX,EAAoBxB,WAAYA,EAAYF,WAAYA,EAAYG,KAAMA,GAAUV,IAG5H,CAEAD,EAAe8C,aAAe,CAC1BC,WAAY"}
@@ -1 +1 @@
1
- {"version":3,"file":"QRLoader.js","sources":["../../../../../src/components/internal/QRLoader/QRLoader.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport {\n usePaymentStatusTimer,\n DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN,\n DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS,\n DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS,\n DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS\n} from '../../../hooks/usePaymentStatusTimer';\nimport useAutoFocus from '../../../utils/useAutoFocus';\nimport Button from '../Button';\nimport ContentSeparator from '../ContentSeparator';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../../core/Analytics/events/AnalyticsInfoEvent';\nimport { CountdownTime } from '../Countdown/types';\nimport Spinner from '../Spinner';\nimport { QRDetails } from './components/QRDetails';\nimport { QRFinalState } from './components/QRFinalState';\nimport { QRLoaderDetailsProvider } from './QRLoaderDetailsProvider';\nimport { QRLoaderProps } from './types';\nimport { redirectToApp } from '../../../utils/urls';\nimport './QRLoader.scss';\n\nconst QRCODE_URL = 'utility/v1/barcode.png?type=qrCode&data=';\n\nexport function QRLoader(props: QRLoaderProps) {\n const { i18n, loadingContext } = useCoreContext();\n\n const { state: timerState, actions: timerActions } = usePaymentStatusTimer({\n loadingContext,\n paymentData: props.paymentData,\n clientKey: props.clientKey,\n delay: props.delay,\n throttleTime: props.throttleTime,\n throttleInterval: props.throttledInterval,\n type: props.type,\n onError: props.onError,\n onComplete: props.onComplete,\n onActionHandled: props.onActionHandled\n });\n\n const { completed, expired, loading, percentage } = timerState;\n const { onTick, onTimeUp } = timerActions;\n\n const { amount, showAmount, url, brandLogo, brandName, countdownTime, type, onActionHandled } = props;\n\n const qrCodeImage = props.qrCodeData ? `${loadingContext}${QRCODE_URL}${props.qrCodeData}&clientKey=${props.clientKey}` : props.qrCodeImage;\n\n const handleCopy = () => {\n const event = new AnalyticsInfoEvent({\n component: props.type,\n type: InfoEventType.download,\n target: UiTarget.qrDownloadButton\n });\n props.onSubmitAnalytics(event);\n };\n\n const onQrCodeLoad = () => {\n onActionHandled?.({\n componentType: props.type,\n actionDescription: 'qr-code-loaded'\n });\n };\n\n const qrSubtitleRef = useAutoFocus();\n\n if (expired) {\n return <QRFinalState image=\"error\" message={i18n.get('error.subtitle.payment')} />;\n }\n\n if (completed) {\n return <QRFinalState image=\"success\" message={i18n.get('creditCard.success')} />;\n }\n\n if (loading) {\n return (\n <div className=\"adyen-checkout__qr-loader\">\n {brandLogo && (\n <div className=\"adyen-checkout__qr-loader__brand-logo-wrapper\">\n <img alt={brandName} src={brandLogo} className=\"adyen-checkout__qr-loader__brand-logo\" />\n </div>\n )}\n <Spinner />\n </div>\n );\n }\n\n const classnames = props.classNameModifiers.map(m => `adyen-checkout__qr-loader--${m}`);\n\n return (\n <div className={`adyen-checkout__qr-loader adyen-checkout__qr-loader--${type} ${classnames.join(' ')}`}>\n {brandLogo && (\n <div className=\"adyen-checkout__qr-loader__brand-logo-wrapper\">\n <img src={brandLogo} alt={brandName} className=\"adyen-checkout__qr-loader__brand-logo\" />\n </div>\n )}\n\n {showAmount && amount && amount.value !== null && !!amount.currency && (\n <h1 className=\"adyen-checkout__qr-loader__payment_amount\">{i18n.amount(amount.value, amount.currency)}</h1>\n )}\n\n {url && (\n <div className=\"adyen-checkout__qr-loader__app-link\">\n {props.redirectIntroduction && <p className=\"adyen-checkout__qr-loader__subtitle\">{i18n.get(props.redirectIntroduction)}</p>}\n <Button classNameModifiers={['qr-loader']} onClick={() => redirectToApp(url)} label={i18n.get(props.buttonLabel)} />\n <ContentSeparator />\n </div>\n )}\n\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */}\n <p ref={qrSubtitleRef} tabIndex={0} className=\"adyen-checkout__qr-loader__subtitle\">\n {typeof props.introduction === 'string' ? i18n.get(props.introduction) : props.introduction?.()}\n </p>\n\n <QRLoaderDetailsProvider\n qrCodeImage={qrCodeImage}\n qrCodeData={props.qrCodeData}\n percentage={percentage}\n timeToPay={props.timeToPay}\n copyBtn={props.copyBtn}\n instructions={props.instructions}\n countdownTime={countdownTime}\n onTick={(time: CountdownTime) => onTick(time)}\n onQRCodeLoad={onQrCodeLoad}\n onTimeUp={() => onTimeUp()}\n handleCopy={handleCopy}\n >\n {props.children ? props.children : <QRDetails />}\n </QRLoaderDetailsProvider>\n </div>\n );\n}\n\nQRLoader.defaultProps = {\n countdownTime: DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN,\n delay: DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS,\n throttleTime: DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS,\n throttledInterval: DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS,\n onError: () => {},\n onComplete: () => {},\n classNameModifiers: [],\n introduction: 'wechatpay.scanqrcode',\n timeToPay: 'wechatpay.timetopay',\n buttonLabel: 'openApp',\n showAmount: true\n};\n"],"names":["QRLoader","props","i18n","loadingContext","useCoreContext","state","timerState","actions","timerActions","usePaymentStatusTimer","paymentData","clientKey","delay","throttleTime","throttleInterval","throttledInterval","type","onError","onComplete","onActionHandled","completed","expired","loading","percentage","onTick","onTimeUp","amount","showAmount","url","brandLogo","brandName","countdownTime","qrCodeImage","qrCodeData","qrSubtitleRef","useAutoFocus","h","QRFinalState","image","message","get","div","className","img","alt","src","Spinner","classnames","classNameModifiers","map","m","join","value","currency","h1","redirectIntroduction","p","Button","onClick","redirectToApp","label","buttonLabel","ContentSeparator","ref","tabIndex","introduction","QRLoaderDetailsProvider","timeToPay","copyBtn","instructions","time","onQRCodeLoad","componentType","actionDescription","handleCopy","event","AnalyticsInfoEvent","component","InfoEventType","download","target","UiTarget","qrDownloadButton","onSubmitAnalytics","children","QRDetails","defaultProps","DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN","DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS","DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS","DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS"],"mappings":"shCAwBO,SAASA,EAASC,GAsFgEA,IAAAA,EArFrF,MAAMC,KAAEA,EAAIC,eAAEA,GAAmBC,KAEzBC,MAAOC,EAAYC,QAASC,GAAiBC,EAAsB,CACvEN,iBACAO,YAAaT,EAAMS,YACnBC,UAAWV,EA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,EAAO2B,WAG/FzB,GACGQ,EAACK,MAAAA,CAAIC,UAAU,uCACVzC,EAAMsD,sBAAwBnB,EAACoB,IAAAA,CAAEd,UAAU,uCAAuCxC,EAAKsC,IAAIvC,EAAMsD,uBAClGnB,EAACqB,EAAAA,CAAOT,mBAAoB,CAAC,aAAcU,QAAS,IAAMC,EAAc/B,GAAMgC,MAAO1D,EAAKsC,IAAIvC,EAAM4D,eACpGzB,EAAC0B,SAKT1B,EAACoB,IAAAA,CAAEO,IAAK7B,EAAe8B,SAAU,EAAGtB,UAAU,uCACX,iBAAvBzC,EAAMgE,aAA4B/D,EAAKsC,IAAIvC,EAAMgE,sBAAgBhE,EAAAA,EAAMgE,oBAANhE,IAAAA,OAAAA,EAAAA,EAAAA,KAAAA,IAG7EmC,EAAC8B,EAAAA,CACGlC,YAAaA,EACbC,WAAYhC,EAAMgC,WAClBV,WAAYA,EACZ4C,UAAWlE,EAAMkE,UACjBC,QAASnE,EAAMmE,QACfC,aAAcpE,EAAMoE,aACpBtC,cAAeA,EACfP,OAAS8C,GAAwB9C,EAAO8C,GACxCC,aAlES,KACjBpD,SAAAA,EAAkB,CACdqD,cAAevE,EAAMe,KACrByD,kBAAmB,oBAgEfhD,SAAU,IAAMA,IAChBiD,WA7EO,KACf,MAAMC,EAAQ,IAAIC,EAAmB,CACjCC,UAAW5E,EAAMe,KACjBA,KAAM8D,EAAcC,SACpBC,OAAQC,EAASC,mBAErBjF,EAAMkF,kBAAkBR,KAyEf1E,EAAMmF,SAAWnF,EAAMmF,SAAWhD,EAACiD,EAAAA,OAIpD,CAEArF,EAASsF,aAAe,CACpBvD,cAAewD,EACf3E,MAAO4E,EACP3E,aAAc4E,EACd1E,kBAAmB2E,EACnBzE,QAAS,OACTC,WAAY,OACZ8B,mBAAoB,GACpBiB,aAAc,uBACdE,UAAW,sBACXN,YAAa,UACblC,YAAY"}
1
+ {"version":3,"file":"QRLoader.js","sources":["../../../../../src/components/internal/QRLoader/QRLoader.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport {\n usePaymentStatusTimer,\n DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN,\n DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS,\n DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS,\n DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS\n} from '../../../hooks/usePaymentStatusTimer';\nimport useAutoFocus from '../../../utils/useAutoFocus';\nimport Button from '../Button';\nimport ContentSeparator from '../ContentSeparator';\nimport { AnalyticsInfoEvent, InfoEventType, UiTarget } from '../../../core/Analytics/events/AnalyticsInfoEvent';\nimport { CountdownTime } from '../Countdown/types';\nimport Spinner from '../Spinner';\nimport { QRDetails } from './components/QRDetails';\nimport { QRFinalState } from './components/QRFinalState';\nimport { QRLoaderDetailsProvider } from './QRLoaderDetailsProvider';\nimport { QRLoaderProps } from './types';\nimport { redirectToApp } from '../../../utils/urls';\nimport './QRLoader.scss';\n\nconst QRCODE_URL = 'utility/v1/barcode.png?type=qrCode&data=';\n\nexport function QRLoader(props: Readonly<QRLoaderProps>) {\n const { i18n, loadingContext } = useCoreContext();\n\n const { state: timerState, actions: timerActions } = usePaymentStatusTimer({\n loadingContext,\n paymentData: props.paymentData,\n clientKey: props.clientKey,\n delay: props.delay,\n throttleTime: props.throttleTime,\n throttleInterval: props.throttledInterval,\n type: props.type,\n onError: props.onError,\n onComplete: props.onComplete,\n onActionHandled: props.onActionHandled\n });\n\n const { completed, expired, loading, percentage } = timerState;\n const { onTick, onTimeUp } = timerActions;\n\n const { amount, showAmount, url, brandLogo, brandName, countdownTime, type, onActionHandled } = props;\n\n const qrCodeImage = props.qrCodeData ? `${loadingContext}${QRCODE_URL}${props.qrCodeData}&clientKey=${props.clientKey}` : props.qrCodeImage;\n\n const handleCopy = () => {\n const event = new AnalyticsInfoEvent({\n component: props.type,\n type: InfoEventType.download,\n target: UiTarget.qrDownloadButton\n });\n props.onSubmitAnalytics(event);\n };\n\n const onQrCodeLoad = () => {\n onActionHandled?.({\n componentType: props.type,\n actionDescription: 'qr-code-loaded'\n });\n };\n\n const qrSubtitleRef = useAutoFocus();\n\n if (expired) {\n return <QRFinalState image=\"error\" message={i18n.get('error.subtitle.payment')} />;\n }\n\n if (completed) {\n return <QRFinalState image=\"success\" message={i18n.get('creditCard.success')} />;\n }\n\n if (loading) {\n return (\n <div className=\"adyen-checkout__qr-loader\">\n {brandLogo && (\n <div className=\"adyen-checkout__qr-loader__brand-logo-wrapper\">\n <img alt={brandName} src={brandLogo} className=\"adyen-checkout__qr-loader__brand-logo\" />\n </div>\n )}\n <Spinner />\n </div>\n );\n }\n\n const classnames = props.classNameModifiers.map(m => `adyen-checkout__qr-loader--${m}`);\n\n return (\n <div className={`adyen-checkout__qr-loader adyen-checkout__qr-loader--${type} ${classnames.join(' ')}`}>\n {brandLogo && (\n <div className=\"adyen-checkout__qr-loader__brand-logo-wrapper\">\n <img src={brandLogo} alt={brandName} className=\"adyen-checkout__qr-loader__brand-logo\" />\n </div>\n )}\n\n {showAmount && amount && amount.value !== null && !!amount.currency && (\n <h1 className=\"adyen-checkout__qr-loader__payment_amount\">{i18n.amount(amount.value, amount.currency)}</h1>\n )}\n\n {url && (\n <div className=\"adyen-checkout__qr-loader__app-link\">\n {props.redirectIntroduction && <p className=\"adyen-checkout__qr-loader__subtitle\">{i18n.get(props.redirectIntroduction)}</p>}\n <Button classNameModifiers={['qr-loader']} onClick={() => redirectToApp(url)} label={i18n.get(props.buttonLabel)} />\n <ContentSeparator />\n </div>\n )}\n\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */}\n <p ref={qrSubtitleRef} tabIndex={0} className=\"adyen-checkout__qr-loader__subtitle\">\n {typeof props.introduction === 'string' ? i18n.get(props.introduction) : props.introduction?.()}\n </p>\n\n <QRLoaderDetailsProvider\n qrCodeImage={qrCodeImage}\n qrCodeData={props.qrCodeData}\n percentage={percentage}\n timeToPay={props.timeToPay}\n copyBtn={props.copyBtn}\n instructions={props.instructions}\n countdownTime={countdownTime}\n onTick={(time: CountdownTime) => onTick(time)}\n onQRCodeLoad={onQrCodeLoad}\n onTimeUp={() => onTimeUp()}\n handleCopy={handleCopy}\n >\n {props.children ? props.children : <QRDetails />}\n </QRLoaderDetailsProvider>\n </div>\n );\n}\n\nQRLoader.defaultProps = {\n countdownTime: DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN,\n delay: DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS,\n throttleTime: DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS,\n throttledInterval: DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS,\n onError: () => {},\n onComplete: () => {},\n classNameModifiers: [],\n introduction: 'wechatpay.scanqrcode',\n timeToPay: 'wechatpay.timetopay',\n buttonLabel: 'openApp',\n showAmount: true\n};\n"],"names":["QRLoader","props","i18n","loadingContext","useCoreContext","state","timerState","actions","timerActions","usePaymentStatusTimer","paymentData","clientKey","delay","throttleTime","throttleInterval","throttledInterval","type","onError","onComplete","onActionHandled","completed","expired","loading","percentage","onTick","onTimeUp","amount","showAmount","url","brandLogo","brandName","countdownTime","qrCodeImage","qrCodeData","qrSubtitleRef","useAutoFocus","h","QRFinalState","image","message","get","div","className","img","alt","src","Spinner","classnames","classNameModifiers","map","m","join","value","currency","h1","redirectIntroduction","p","Button","onClick","redirectToApp","label","buttonLabel","ContentSeparator","ref","tabIndex","introduction","QRLoaderDetailsProvider","timeToPay","copyBtn","instructions","time","onQRCodeLoad","componentType","actionDescription","handleCopy","event","AnalyticsInfoEvent","component","InfoEventType","download","target","UiTarget","qrDownloadButton","onSubmitAnalytics","children","QRDetails","defaultProps","DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN","DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS","DEFAULT_PAYMENT_STATUS_TIMER_THROT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sF,aAAe,CACpBvD,cAAewD,EACf3E,MAAO4E,EACP3E,aAAc4E,EACd1E,kBAAmB2E,EACnBzE,QAAS,OACTC,WAAY,OACZ8B,mBAAoB,GACpBiB,aAAc,uBACdE,UAAW,sBACXN,YAAa,UACblC,YAAY"}
@@ -1,2 +1,2 @@
1
- import{createContext as e,createElement as r}from"../../../external/preact/dist/preact.js";import{useContext as t}from"../../../external/preact/hooks/dist/hooks.js";function n(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function o(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},o=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.forEach(function(r){n(e,r,t[r])})}return e}function i(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}const a=e(void 0),c=e=>{var{children:t}=e,n=i(e,["children"]);return r(a.Provider,{value:o({},n)},t)},l=()=>{const e=t(a);if(void 0===e)throw new Error('"useQRLoaderDetails" must be used within a QRLoaderDetailsContext');return e};export{c as QRLoaderDetailsProvider,l as useQRLoaderDetails};
1
+ import{createContext as e,createElement as t}from"../../../external/preact/dist/preact.js";import{useContext as r}from"../../../external/preact/hooks/dist/hooks.js";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){n(e,t,r[t])})}return e}function l(e,t){if(null==e)return{};var r,n,o,l={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(r=Reflect.ownKeys(e),o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}if(l=function(e,t){if(null==e)return{};var r,n,o={},l=Object.getOwnPropertyNames(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,t),Object.getOwnPropertySymbols)for(r=Object.getOwnPropertySymbols(e),o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}const c=e(void 0),i=e=>{let{children:r}=e,n=l(e,["children"]);return t(c.Provider,{value:o({},n)},r)},a=()=>{const e=r(c);if(void 0===e)throw new Error('"useQRLoaderDetails" must be used within a QRLoaderDetailsContext');return e};export{i as QRLoaderDetailsProvider,a as useQRLoaderDetails};
2
2
  //# sourceMappingURL=QRLoaderDetailsProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"QRLoaderDetailsProvider.js","sources":["../../../../../src/components/internal/QRLoader/QRLoaderDetailsProvider.tsx"],"sourcesContent":["import { h, createContext } from 'preact';\nimport type { ComponentChildren } from 'preact';\nimport { useContext } from 'preact/hooks';\nimport { CountdownTime } from '../Countdown/types';\n\ninterface QRLoaderDetailsProviderProps {\n qrCodeImage: string;\n qrCodeData: string;\n countdownTime: number;\n percentage: number;\n timeToPay: string;\n instructions?: string | (() => h.JSX.Element);\n copyBtn: boolean;\n onTick: (time: CountdownTime) => void;\n onQRCodeLoad: () => void;\n onTimeUp: () => void;\n handleCopy?: (e: h.JSX.TargetedMouseEvent<HTMLButtonElement>) => void;\n children: ComponentChildren;\n}\n\ntype QRLoaderDetailsContextValue = Omit<QRLoaderDetailsProviderProps, 'children'>;\n\nconst QRLoaderDetailsContext = createContext<QRLoaderDetailsContextValue | undefined>(undefined);\n\nconst QRLoaderDetailsProvider = ({ children, ...props }: QRLoaderDetailsProviderProps) => {\n return <QRLoaderDetailsContext.Provider value={{ ...props }}>{children}</QRLoaderDetailsContext.Provider>;\n};\n\nconst useQRLoaderDetails = (): QRLoaderDetailsContextValue => {\n const context = useContext(QRLoaderDetailsContext);\n\n if (context === undefined) {\n throw new Error('\"useQRLoaderDetails\" must be used within a QRLoaderDetailsContext');\n }\n\n return context;\n};\n\nexport { QRLoaderDetailsProvider, useQRLoaderDetails };\n"],"names":["QRLoaderDetailsContext","createContext","undefined","QRLoaderDetailsProvider","_param","children","props","h","Provider","value","_object_spread","useQRLoaderDetails","context","useContext","Error"],"mappings":"q9BAsBA,MAAMA,EAAyBC,OAAuDC,GAEhFC,EAA0BC,QAACC,SAAEA,GAAkDD,EAArCE,EAAAA,EAAAA,EAAAA,CAAbD,aAC/B,OAAOE,EAACP,EAAuBQ,SAAQ,CAACC,MAAOC,EAAA,CAAA,EAAKJ,IAAUD,IAG5DM,EAAqB,KACvB,MAAMC,EAAUC,EAAWb,GAE3B,QAAgBE,IAAZU,EACA,MAAM,IAAIE,MAAM,qEAGpB,OAAOF"}
1
+ {"version":3,"file":"QRLoaderDetailsProvider.js","sources":["../../../../../src/components/internal/QRLoader/QRLoaderDetailsProvider.tsx"],"sourcesContent":["import { h, createContext } from 'preact';\nimport type { ComponentChildren } from 'preact';\nimport { useContext } from 'preact/hooks';\nimport { CountdownTime } from '../Countdown/types';\n\ninterface QRLoaderDetailsProviderProps {\n qrCodeImage: string;\n qrCodeData: string;\n countdownTime: number;\n percentage: number;\n timeToPay: string;\n instructions?: string | (() => h.JSX.Element);\n copyBtn: boolean;\n onTick: (time: CountdownTime) => void;\n onQRCodeLoad: () => void;\n onTimeUp: () => void;\n handleCopy?: (e: h.JSX.TargetedMouseEvent<HTMLButtonElement>) => void;\n children: ComponentChildren;\n}\n\ntype QRLoaderDetailsContextValue = Omit<QRLoaderDetailsProviderProps, 'children'>;\n\nconst QRLoaderDetailsContext = createContext<QRLoaderDetailsContextValue | undefined>(undefined);\n\nconst QRLoaderDetailsProvider = ({ children, ...props }: QRLoaderDetailsProviderProps) => {\n return <QRLoaderDetailsContext.Provider value={{ ...props }}>{children}</QRLoaderDetailsContext.Provider>;\n};\n\nconst useQRLoaderDetails = (): QRLoaderDetailsContextValue => {\n const context = useContext(QRLoaderDetailsContext);\n\n if (context === undefined) {\n throw new Error('\"useQRLoaderDetails\" must be used within a QRLoaderDetailsContext');\n }\n\n return context;\n};\n\nexport { QRLoaderDetailsProvider, useQRLoaderDetails };\n"],"names":["QRLoaderDetailsContext","createContext","undefined","QRLoaderDetailsProvider","_0","children","props","h","Provider","value","_object_spread","useQRLoaderDetails","context","useContext","Error"],"mappings":"ktCAsBA,MAAMA,EAAyBC,OAAuDC,GAEhFC,EAA0BC,QAACC,SAAEA,GAAkDD,EAArCE,EAAAA,EAAAA,EAAAA,cAC5C,OAAOC,EAACP,EAAuBQ,SAAQ,CAACC,MAAOC,EAAA,CAAA,EAAKJ,IAAUD,IAG5DM,EAAqB,KACvB,MAAMC,EAAUC,EAAWb,GAE3B,QAAgBE,IAAZU,EACA,MAAM,IAAIE,MAAM,qEAGpB,OAAOF"}
@@ -1,2 +1,2 @@
1
- import{createElement as e,Fragment as t}from"../../../external/preact/dist/preact.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";import{useState as n}from"../../../external/preact/hooks/dist/hooks.js";function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function c(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function l(l){var{label:u=null,icon:i=null,payButton:s,onSubmit:p,amount:b=null,name:f,showPayButton:y}=l,O=c(l,["label","icon","payButton","onSubmit","amount","name","showPayButton"]);const{i18n:m}=r(),[j,g]=n("ready");this.setStatus=e=>{g(e)};if(y)return e(t,null,s(a(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){o(e,t,r[t])})}return e}({},O),{status:j,icon:i,classNameModifiers:["standalone"],label:u||(b&&{}.hasOwnProperty.call(b,"value")&&0===b.value?`${m.get("preauthorizeWith")} ${f}`:`${m.get("continueTo")} ${f}`),onClick:p})))}export{l as default};
1
+ import{createElement as e,Fragment as t}from"../../../external/preact/dist/preact.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";import{useState as n}from"../../../external/preact/hooks/dist/hooks.js";function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function c(e,t){if(null==e)return{};var r,n,o,l={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(r=Reflect.ownKeys(e),o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}if(l=function(e,t){if(null==e)return{};var r,n,o={},l=Object.getOwnPropertyNames(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,t),Object.getOwnPropertySymbols)for(r=Object.getOwnPropertySymbols(e),o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}function a(a){let{label:u=null,icon:i=null,payButton:s,onSubmit:p,amount:f=null,name:b,showPayButton:y}=a,O=c(a,["label","icon","payButton","onSubmit","amount","name","showPayButton"]);const{i18n:m}=r(),[j,g]=n("ready");this.setStatus=e=>{g(e)};if(y)return e(t,null,s(l(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){o(e,t,r[t])})}return e}({},O),{status:j,icon:i,classNameModifiers:["standalone"],label:u||(f&&{}.hasOwnProperty.call(f,"value")&&0===f.value?`${m.get("preauthorizeWith")} ${b}`:`${m.get("continueTo")} ${b}`),onClick:p})))}export{a as default};
2
2
  //# sourceMappingURL=RedirectButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RedirectButton.js","sources":["../../../../../src/components/internal/RedirectButton/RedirectButton.tsx"],"sourcesContent":["import { h, Fragment } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { useState } from 'preact/hooks';\nimport { PaymentAmount } from '../../../types';\n\n// TODO this should ideally be remove but we need let prop propagate down\n// probably not worth changing this behaviour now\nexport interface RedirectButtonProps {\n label?: string;\n icon?: string;\n payButton: Function;\n onSubmit: Function;\n amount?: PaymentAmount;\n name: string;\n showPayButton: boolean;\n ref?: any;\n}\n\nfunction RedirectButton({ label = null, icon = null, payButton, onSubmit, amount = null, name, showPayButton, ...props }: RedirectButtonProps) {\n const { i18n } = useCoreContext();\n const [status, setStatus] = useState('ready');\n\n this.setStatus = newStatus => {\n setStatus(newStatus);\n };\n\n const payButtonLabel = () => {\n const isZeroAuth = amount && {}.hasOwnProperty.call(amount, 'value') && amount.value === 0;\n if (isZeroAuth) return `${i18n.get('preauthorizeWith')} ${name}`;\n return `${i18n.get('continueTo')} ${name}`;\n };\n\n if (!showPayButton) {\n return;\n }\n\n return (\n <Fragment>\n {payButton({\n ...props,\n status,\n icon,\n classNameModifiers: ['standalone'],\n label: label || payButtonLabel(),\n onClick: onSubmit\n })}\n </Fragment>\n );\n}\n\nexport default RedirectButton;\n"],"names":["RedirectButton","_param","label","icon","payButton","onSubmit","amount","name","showPayButton","props","i18n","useCoreContext","status","setStatus","useState","this","newStatus","h","Fragment","_object_spread_props","_object_spread","classNameModifiers","hasOwnProperty","call","value","get","onClick"],"mappings":"8jCAkBA,SAASA,EAAeC,GAAA,IAAAC,MAAEA,EAAQ,KAAIC,KAAEA,EAAO,KAAIC,UAAEA,EAASC,SAAEA,EAAQC,OAAEA,EAAS,KAAIC,KAAEA,EAAIC,cAAEA,GAAvEP,EAAyFQ,EAAAA,EAAzFR,EAAA,CAAEC,QAAcC,OAAaC,YAAWC,WAAUC,SAAeC,OAAMC,kBAC3F,MAAME,KAAEA,GAASC,KACVC,EAAQC,GAAaC,EAAS,SAErCC,KAAKF,UAAYG,IACbH,EAAUG,IASd,GAAKR,EAIL,OACIS,EAACC,EAAAA,KACId,EAAUe,oUAAAC,CAAA,GACJX,GAAAA,CACHG,SACAT,OACAkB,mBAAoB,CAAC,cACrBnB,MAAOA,IAhBII,GAAU,CAAC,EAAEgB,eAAeC,KAAKjB,EAAQ,UAA6B,IAAjBA,EAAOkB,MACxD,GAAGd,EAAKe,IAAI,uBAAuBlB,IACnD,GAAGG,EAAKe,IAAI,iBAAiBlB,KAe5BmB,QAASrB,KAIzB"}
1
+ {"version":3,"file":"RedirectButton.js","sources":["../../../../../src/components/internal/RedirectButton/RedirectButton.tsx"],"sourcesContent":["import { h, Fragment } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { useState } from 'preact/hooks';\nimport { PaymentAmount } from '../../../types';\n\n// TODO this should ideally be remove but we need let prop propagate down\n// probably not worth changing this behaviour now\nexport interface RedirectButtonProps {\n label?: string;\n icon?: string;\n payButton: Function;\n onSubmit: Function;\n amount?: PaymentAmount;\n name: string;\n showPayButton: boolean;\n ref?: any;\n}\n\nfunction RedirectButton({ label = null, icon = null, payButton, onSubmit, amount = null, name, showPayButton, ...props }: RedirectButtonProps) {\n const { i18n } = useCoreContext();\n const [status, setStatus] = useState('ready');\n\n this.setStatus = newStatus => {\n setStatus(newStatus);\n };\n\n const payButtonLabel = () => {\n const isZeroAuth = amount && {}.hasOwnProperty.call(amount, 'value') && amount.value === 0;\n if (isZeroAuth) return `${i18n.get('preauthorizeWith')} ${name}`;\n return `${i18n.get('continueTo')} ${name}`;\n };\n\n if (!showPayButton) {\n return;\n }\n\n return (\n <Fragment>\n {payButton({\n ...props,\n status,\n icon,\n classNameModifiers: ['standalone'],\n label: label || payButtonLabel(),\n onClick: onSubmit\n })}\n </Fragment>\n );\n}\n\nexport default RedirectButton;\n"],"names":["RedirectButton","_0","label","icon","payButton","onSubmit","amount","name","showPayButton","props","i18n","useCoreContext","status","setStatus","useState","this","newStatus","h","Fragment","_object_spread_props","_object_spread","classNameModifiers","hasOwnProperty","call","value","get","onClick"],"mappings":"2zCAkBA,SAASA,EAAeC,GAAA,IAAAC,MAAEA,EAAQ,KAAIC,KAAEA,EAAO,KAAIC,UAAEA,EAASC,SAAEA,EAAQC,OAAEA,EAAS,KAAIC,KAAEA,EAAIC,cAAEA,GAA8CP,EAA5BQ,EAAAA,EAAAA,EAAAA,yEAC7G,MAAMC,KAAEA,GAASC,KACVC,EAAQC,GAAaC,EAAS,SAErCC,KAAKF,UAAYG,IACbH,EAAUG,IASd,GAAKR,EAIL,OACIS,EAACC,EAAAA,KACId,EAAUe,oUAAAC,CAAA,GACJX,GAAAA,CACHG,SACAT,OACAkB,mBAAoB,CAAC,cACrBnB,MAAOA,IAhBII,GAAU,CAAC,EAAEgB,eAAeC,KAAKjB,EAAQ,UAA6B,IAAjBA,EAAOkB,MACxD,GAAGd,EAAKe,IAAI,uBAAuBlB,IACnD,GAAGG,EAAKe,IAAI,iBAAiBlB,KAe5BmB,QAASrB,KAIzB"}
@@ -1,2 +1,2 @@
1
- import{Component as t}from"../../../../external/preact/dist/preact.js";import{getFields as s,validFieldsReducer as e,getErrorReducer as i,getErrorObject as o}from"./SFPUtils.js";import r from"../lib/CSF/initCSF.js";import n from"./SecuredFieldsProviderHandlers.js";import d from"./defaultProps.js";import{ENCRYPTED_PWD_FIELD as a,ENCRYPTED_CARD_NUMBER as h,DEDICATED_CARD_COMPONENTS as l,DATE_POLICY_REQUIRED as p,CVC_POLICY_REQUIRED as c}from"../lib/constants.js";import u from"../../../../core/Errors/AdyenCheckoutError.js";import{getErrorMessageFromCode as f}from"../../../../core/Errors/utils.js";import{SF_ErrorCodes as m}from"../../../../core/Errors/constants.js";function O(t,s,e){return s in t?Object.defineProperty(t,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[s]=e,t}function y(t){for(var s=1;s<arguments.length;s++){var e=null!=arguments[s]?arguments[s]:{},i=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.forEach(function(s){O(t,s,e[s])})}return t}function F(t,s){return s=null!=s?s:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):function(t){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);s.push.apply(s,e)}return s}(Object(s)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(s,e))}),t}class C extends t{componentDidMount(){this.props.rootNode&&this.setRootNode(this.props.rootNode);const t=s(this.rootNode),i=t.reduce(e,{});this.setState({valid:i}),t.forEach(t=>{this.numCharsInField[t]=0}),this.numDateFields=t.filter(t=>t.match(/Expiry/)).length,t.length?(this.destroy(),this.initializeCSF(this.rootNode)):this.handleOnNoDataRequired()}componentDidUpdate(){var t,s;this.checkForKCPFields(),null===(t=(s=this.props).onStateUpdate)||void 0===t||t.call(s,this.state)}componentWillUnmount(){this.csf=null,clearTimeout(this.csfLoadFailTimeout),clearTimeout(this.csfConfigFailTimeout)}initializeCSF(t){let s=this.props.loadingContext;var e;const i={rootNode:t,type:this.props.type,clientKey:this.props.clientKey,cardGroupTypes:this.props.brands,autoFocus:this.props.autoFocus,trimTrailingSeparator:this.props.trimTrailingSeparator,loadingContext:s,keypadFix:this.props.keypadFix,showWarnings:this.props.showWarnings,iframeUIConfig:{sfStyles:this.props.styles},i18n:this.props.i18n,callbacks:{onLoad:this.handleOnLoad,onConfigSuccess:this.handleOnConfigSuccess,onFieldValid:this.handleOnFieldValid,onAllValid:this.handleOnAllValid,onBrand:this.handleOnBrand,onError:this.handleOnError,onFocus:this.handleFocus,onBinValue:this.props.onBinValue,onAutoComplete:this.handleOnAutoComplete,onAdditionalSFConfig:this.props.onAdditionalSFConfig,onAdditionalSFRemoved:this.props.onAdditionalSFRemoved,onTouchstartIOS:this.handleOnTouchstartIOS,onKeyPressed:this.handleKeyPressed},isKCP:this.state.hasKoreanFields,legacyInputMode:this.props.legacyInputMode,minimumExpiryDate:this.props.minimumExpiryDate,implementationType:this.props.implementationType||"components",forceCompat:this.props.forceCompat,maskSecurityCode:this.props.maskSecurityCode,exposeExpiryDate:this.props.exposeExpiryDate,shouldDisableIOSArrowKeys:!!this.props.disableIOSArrowKeys,placeholders:null!==(e=this.props.placeholders)&&void 0!==e?e:{},showContextualElement:this.props.showContextualElement};this.csf=r(i),this.csfLoadFailTimeout=setTimeout(()=>{"ready"!==this.state.status&&(this.setState({status:"csfLoadFailure"}),this.props.onError(new u("ERROR","secured field iframes have failed to load")))},this.csfLoadFailTimeoutMS)}checkForKCPFields(){let t=!1;if(this.props.koreanAuthenticationRequired&&(t=this.issuingCountryCode?"kr"===this.issuingCountryCode:"kr"===this.props.countryCode),this.state.hasKoreanFields&&!t){const t=t=>({data:F(y({},t.data),{[a]:void 0}),valid:F(y({},t.valid),{[a]:!1}),errors:F(y({},t.errors),{[a]:!1}),hasKoreanFields:!1});this.setState(t,()=>{this.props.onChange(this.state)}),this.csf.removeSecuredField(a),this.csf.setKCPStatus(!1)}if(!this.state.hasKoreanFields&&t){const t=t=>({valid:F(y({},t.valid),{[a]:!1}),hasKoreanFields:!0,isSfpValid:!1});this.setState(t,()=>{this.props.onChange(this.state)}),this.csf.addSecuredField(a),this.csf.setKCPStatus(!0)}}getChildContext(){return{i18n:this.props.i18n}}handleUnsupportedCard(t){const s=!!t.error;return s&&this.setState({detectedUnsupportedBrands:t.detectedBrands}),t.rootNode=this.rootNode,this.handleOnError(t,s),this.csf&&this.csf.hasUnsupportedCard(h,t.error),s}setFocusOn(t){this.csf&&this.csf.setFocusOnFrame(t)}updateStyles(t){this.csf&&this.csf.updateStyles(t)}sfIsOptionalOrHidden(t){return this.csf.sfIsOptionalOrHidden(t)}destroy(){this.csf&&this.csf.destroy()}showValidation(){const{numDateFields:t,state:s}=this;Object.keys(s.valid).reduce(i(t,s),[]).forEach(t=>{const e=o(t,this.rootNode,s);this.handleOnError(e,!!s.detectedUnsupportedBrands),this.csf&&this.csf.isValidated&&this.csf.isValidated(t,e.error)})}mapErrorsToValidationRuleResult(){return Object.keys(this.state.errors).reduce((t,s)=>{const e=this.state.errors[s];return t[s]=e?y({isValid:!1,errorMessage:f(e,m),errorI18n:this.props.i18n.get(e),error:e,rootNode:this.rootNode},this.state.detectedUnsupportedBrands&&{detectedBrands:this.state.detectedUnsupportedBrands}):null,t},{})}processBinLookupResponse(t,s){var e;if(this.state.detectedUnsupportedBrands&&(this.setState(t=>({errors:F(y({},t.errors),{[h]:!1}),detectedUnsupportedBrands:null})),this.csf&&t)){const t={type:"card",fieldType:"encryptedCardNumber",error:""};this.handleUnsupportedCard(t)}this.issuingCountryCode=null==t||null===(e=t.issuingCountryCode)||void 0===e?void 0:e.toLowerCase();const i=(null==s?void 0:s.brand)&&l.includes(s.brand);i&&this.setState(s,()=>{this.props.onChange(this.state)}),this.csf&&this.csf.brandsFromBinLookup(t,i?s:null)}render(t,s){return t.render({setRootNode:this.setRootNode,setFocusOn:this.setFocusOn},s)}constructor(t){super(t),O(this,"csfLoadFailTimeout",void 0),O(this,"csfLoadFailTimeoutMS",void 0),O(this,"csfConfigFailTimeout",void 0),O(this,"csfConfigFailTimeoutMS",void 0),O(this,"numCharsInField",void 0),O(this,"rootNode",void 0),O(this,"numDateFields",void 0),O(this,"csf",void 0),O(this,"handleOnLoad",void 0),O(this,"handleOnConfigSuccess",void 0),O(this,"handleOnFieldValid",void 0),O(this,"handleOnAllValid",void 0),O(this,"handleOnBrand",void 0),O(this,"handleFocus",void 0),O(this,"handleOnError",void 0),O(this,"handleOnAutoComplete",void 0),O(this,"handleOnNoDataRequired",void 0),O(this,"handleOnTouchstartIOS",void 0),O(this,"handleKeyPressed",void 0),O(this,"state",void 0),O(this,"props",void 0),O(this,"issuingCountryCode",void 0),O(this,"setRootNode",t=>{this.rootNode=t});const s={status:"loading",brand:t.type,errors:{},valid:{},data:{},cvcPolicy:c,expiryDatePolicy:p,isSfpValid:!1,hasKoreanFields:t.hasKoreanFields};this.state=s,this.csfLoadFailTimeout=null,this.csfLoadFailTimeoutMS=3e4,this.csfConfigFailTimeout=null,this.csfConfigFailTimeoutMS=15e3,this.numCharsInField={},this.handleOnLoad=n.handleOnLoad.bind(this),this.handleOnConfigSuccess=n.handleOnConfigSuccess.bind(this),this.handleOnFieldValid=n.handleOnFieldValid.bind(this),this.handleOnAllValid=n.handleOnAllValid.bind(this),this.handleOnBrand=n.handleOnBrand.bind(this),this.handleFocus=n.handleFocus.bind(this),this.handleOnError=n.handleOnError.bind(this),this.handleOnNoDataRequired=n.handleOnNoDataRequired.bind(this),this.handleOnAutoComplete=n.handleOnAutoComplete.bind(this),this.handleOnTouchstartIOS=n.handleOnTouchstartIOS.bind(this),this.handleKeyPressed=n.handleKeyPressed.bind(this),this.processBinLookupResponse=this.processBinLookupResponse.bind(this),this.setFocusOn=this.setFocusOn.bind(this),this.updateStyles=this.updateStyles.bind(this),this.handleUnsupportedCard=this.handleUnsupportedCard.bind(this),this.showValidation=this.showValidation.bind(this),this.destroy=this.destroy.bind(this)}}O(C,"defaultProps",d);export{C as default};
1
+ import{Component as t}from"../../../../external/preact/dist/preact.js";import{getFields as s,validFieldsReducer as e,getErrorReducer as i,getErrorObject as o}from"./SFPUtils.js";import r from"../lib/CSF/initCSF.js";import n from"./SecuredFieldsProviderHandlers.js";import d from"./defaultProps.js";import{ENCRYPTED_PWD_FIELD as a,ENCRYPTED_CARD_NUMBER as h,DEDICATED_CARD_COMPONENTS as l,DATE_POLICY_REQUIRED as p,CVC_POLICY_REQUIRED as c}from"../lib/constants.js";import u from"../../../../core/Errors/AdyenCheckoutError.js";import{getErrorMessageFromCode as f}from"../../../../core/Errors/utils.js";import{SF_ErrorCodes as m}from"../../../../core/Errors/constants.js";function O(t,s,e){return s in t?Object.defineProperty(t,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[s]=e,t}function y(t){for(var s=1;s<arguments.length;s++){var e=null!=arguments[s]?arguments[s]:{},i=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.forEach(function(s){O(t,s,e[s])})}return t}function F(t,s){return s=null!=s?s:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):function(t){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);s.push.apply(s,e)}return s}(Object(s)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(s,e))}),t}class C extends t{componentDidMount(){this.props.rootNode&&this.setRootNode(this.props.rootNode);const t=s(this.rootNode),i=t.reduce(e,{});this.setState({valid:i}),t.forEach(t=>{this.numCharsInField[t]=0}),this.numDateFields=t.filter(t=>t.match(/Expiry/)).length,t.length?(this.destroy(),this.initializeCSF(this.rootNode)):this.handleOnNoDataRequired()}componentDidUpdate(){var t,s;this.checkForKCPFields(),null===(t=(s=this.props).onStateUpdate)||void 0===t||t.call(s,this.state)}componentWillUnmount(){this.csf=null,clearTimeout(this.csfLoadFailTimeout),clearTimeout(this.csfConfigFailTimeout)}initializeCSF(t){var s;let e=this.props.loadingContext;const i={rootNode:t,type:this.props.type,clientKey:this.props.clientKey,cardGroupTypes:this.props.brands,autoFocus:this.props.autoFocus,trimTrailingSeparator:this.props.trimTrailingSeparator,loadingContext:e,keypadFix:this.props.keypadFix,showWarnings:this.props.showWarnings,iframeUIConfig:{sfStyles:this.props.styles},i18n:this.props.i18n,callbacks:{onLoad:this.handleOnLoad,onConfigSuccess:this.handleOnConfigSuccess,onFieldValid:this.handleOnFieldValid,onAllValid:this.handleOnAllValid,onBrand:this.handleOnBrand,onError:this.handleOnError,onFocus:this.handleFocus,onBinValue:this.props.onBinValue,onAutoComplete:this.handleOnAutoComplete,onAdditionalSFConfig:this.props.onAdditionalSFConfig,onAdditionalSFRemoved:this.props.onAdditionalSFRemoved,onTouchstartIOS:this.handleOnTouchstartIOS,onKeyPressed:this.handleKeyPressed},isKCP:this.state.hasKoreanFields,legacyInputMode:this.props.legacyInputMode,minimumExpiryDate:this.props.minimumExpiryDate,implementationType:this.props.implementationType||"components",forceCompat:this.props.forceCompat,maskSecurityCode:this.props.maskSecurityCode,exposeExpiryDate:this.props.exposeExpiryDate,shouldDisableIOSArrowKeys:!!this.props.disableIOSArrowKeys,placeholders:null!==(s=this.props.placeholders)&&void 0!==s?s:{},showContextualElement:this.props.showContextualElement};this.csf=r(i),this.csfLoadFailTimeout=setTimeout(()=>{"ready"!==this.state.status&&(this.setState({status:"csfLoadFailure"}),this.props.onError(new u("ERROR","secured field iframes have failed to load")))},this.csfLoadFailTimeoutMS)}checkForKCPFields(){let t=!1;if(this.props.koreanAuthenticationRequired&&(t=this.issuingCountryCode?"kr"===this.issuingCountryCode:"kr"===this.props.countryCode),this.state.hasKoreanFields&&!t){const t=t=>({data:F(y({},t.data),{[a]:void 0}),valid:F(y({},t.valid),{[a]:!1}),errors:F(y({},t.errors),{[a]:!1}),hasKoreanFields:!1});this.setState(t,()=>{this.props.onChange(this.state)}),this.csf.removeSecuredField(a),this.csf.setKCPStatus(!1)}if(!this.state.hasKoreanFields&&t){const t=t=>({valid:F(y({},t.valid),{[a]:!1}),hasKoreanFields:!0,isSfpValid:!1});this.setState(t,()=>{this.props.onChange(this.state)}),this.csf.addSecuredField(a),this.csf.setKCPStatus(!0)}}getChildContext(){return{i18n:this.props.i18n}}handleUnsupportedCard(t){const s=!!t.error;return s&&this.setState({detectedUnsupportedBrands:t.detectedBrands}),t.rootNode=this.rootNode,this.handleOnError(t,s),this.csf&&this.csf.hasUnsupportedCard(h,t.error),s}setFocusOn(t){this.csf&&this.csf.setFocusOnFrame(t)}updateStyles(t){this.csf&&this.csf.updateStyles(t)}sfIsOptionalOrHidden(t){return this.csf.sfIsOptionalOrHidden(t)}destroy(){this.csf&&this.csf.destroy()}showValidation(){const{numDateFields:t,state:s}=this;Object.keys(s.valid).reduce(i(t,s),[]).forEach(t=>{const e=o(t,this.rootNode,s);this.handleOnError(e,!!s.detectedUnsupportedBrands),this.csf&&this.csf.isValidated&&this.csf.isValidated(t,e.error)})}mapErrorsToValidationRuleResult(){return Object.keys(this.state.errors).reduce((t,s)=>{const e=this.state.errors[s];return t[s]=e?y({isValid:!1,errorMessage:f(e,m),errorI18n:this.props.i18n.get(e),error:e,rootNode:this.rootNode},this.state.detectedUnsupportedBrands&&{detectedBrands:this.state.detectedUnsupportedBrands}):null,t},{})}processBinLookupResponse(t,s){var e;if(this.state.detectedUnsupportedBrands&&(this.setState(t=>({errors:F(y({},t.errors),{[h]:!1}),detectedUnsupportedBrands:null})),this.csf&&t)){const t={type:"card",fieldType:"encryptedCardNumber",error:""};this.handleUnsupportedCard(t)}this.issuingCountryCode=null==t||null===(e=t.issuingCountryCode)||void 0===e?void 0:e.toLowerCase();const i=(null==s?void 0:s.brand)&&l.includes(s.brand);i&&this.setState(s,()=>{this.props.onChange(this.state)}),this.csf&&this.csf.brandsFromBinLookup(t,i?s:null)}render(t,s){return t.render({setRootNode:this.setRootNode,setFocusOn:this.setFocusOn},s)}constructor(t){super(t),O(this,"csfLoadFailTimeout",void 0),O(this,"csfLoadFailTimeoutMS",void 0),O(this,"csfConfigFailTimeout",void 0),O(this,"csfConfigFailTimeoutMS",void 0),O(this,"numCharsInField",void 0),O(this,"rootNode",void 0),O(this,"numDateFields",void 0),O(this,"csf",void 0),O(this,"handleOnLoad",void 0),O(this,"handleOnConfigSuccess",void 0),O(this,"handleOnFieldValid",void 0),O(this,"handleOnAllValid",void 0),O(this,"handleOnBrand",void 0),O(this,"handleFocus",void 0),O(this,"handleOnError",void 0),O(this,"handleOnAutoComplete",void 0),O(this,"handleOnNoDataRequired",void 0),O(this,"handleOnTouchstartIOS",void 0),O(this,"handleKeyPressed",void 0),O(this,"state",void 0),O(this,"props",void 0),O(this,"issuingCountryCode",void 0),O(this,"setRootNode",t=>{this.rootNode=t});const s={status:"loading",brand:t.type,errors:{},valid:{},data:{},cvcPolicy:c,expiryDatePolicy:p,isSfpValid:!1,hasKoreanFields:t.hasKoreanFields};this.state=s,this.csfLoadFailTimeout=null,this.csfLoadFailTimeoutMS=3e4,this.csfConfigFailTimeout=null,this.csfConfigFailTimeoutMS=15e3,this.numCharsInField={},this.handleOnLoad=n.handleOnLoad.bind(this),this.handleOnConfigSuccess=n.handleOnConfigSuccess.bind(this),this.handleOnFieldValid=n.handleOnFieldValid.bind(this),this.handleOnAllValid=n.handleOnAllValid.bind(this),this.handleOnBrand=n.handleOnBrand.bind(this),this.handleFocus=n.handleFocus.bind(this),this.handleOnError=n.handleOnError.bind(this),this.handleOnNoDataRequired=n.handleOnNoDataRequired.bind(this),this.handleOnAutoComplete=n.handleOnAutoComplete.bind(this),this.handleOnTouchstartIOS=n.handleOnTouchstartIOS.bind(this),this.handleKeyPressed=n.handleKeyPressed.bind(this),this.processBinLookupResponse=this.processBinLookupResponse.bind(this),this.setFocusOn=this.setFocusOn.bind(this),this.updateStyles=this.updateStyles.bind(this),this.handleUnsupportedCard=this.handleUnsupportedCard.bind(this),this.showValidation=this.showValidation.bind(this),this.destroy=this.destroy.bind(this)}}O(C,"defaultProps",d);export{C as default};
2
2
  //# sourceMappingURL=SecuredFieldsProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SecuredFieldsProvider.js","sources":["../../../../../../src/components/internal/SecuredFields/SFP/SecuredFieldsProvider.ts"],"sourcesContent":["import { Component } from 'preact';\nimport { getErrorObject, getFields, getErrorReducer, validFieldsReducer } from './SFPUtils';\nimport initCSF from '../lib/CSF';\nimport handlers from './SecuredFieldsProviderHandlers';\nimport defaultProps from './defaultProps';\nimport { SFPProps, SFPState, SingleBrandResetObject } from './types';\nimport {\n StylesObject,\n CardErrorData,\n CardFocusData,\n CardBrandData,\n CardAllValidData,\n CardFieldValidData,\n CardAutoCompleteData,\n CardConfigSuccessData,\n CardLoadData,\n SFKeyPressObj\n} from '../lib/types';\nimport { CSFReturnObject, CSFSetupObject } from '../lib/CSF/types';\nimport { CVC_POLICY_REQUIRED, DATE_POLICY_REQUIRED, DEDICATED_CARD_COMPONENTS, ENCRYPTED_CARD_NUMBER, ENCRYPTED_PWD_FIELD } from '../lib/constants';\nimport { BinLookupResponse } from '../../../Card/types';\nimport AdyenCheckoutError from '../../../../core/Errors/AdyenCheckoutError';\nimport { SFStateErrorObj } from '../../../Card/components/CardInput/types';\nimport { getErrorMessageFromCode } from '../../../../core/Errors/utils';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\n\n/**\n * SecuredFieldsProvider:\n * Initialises & handles the client-side part of SecuredFields\n */\nclass SecuredFieldsProvider extends Component<SFPProps, SFPState> {\n private csfLoadFailTimeout: number;\n private csfLoadFailTimeoutMS: number;\n private csfConfigFailTimeout: number;\n private csfConfigFailTimeoutMS: number;\n private numCharsInField: object;\n private rootNode;\n private numDateFields: number;\n private csf: CSFReturnObject;\n private handleOnLoad: (obj: CardLoadData) => void;\n private handleOnConfigSuccess: (obj: CardConfigSuccessData) => void;\n private handleOnFieldValid: (obj: CardFieldValidData) => void;\n private handleOnAllValid: (obj: CardAllValidData) => void;\n private handleOnBrand: (obj: CardBrandData) => void;\n private handleFocus: (obj: CardFocusData) => void;\n private handleOnError: (obj: CardErrorData, hasUnsupportedCard?: boolean) => void;\n private handleOnAutoComplete: (obj: CardAutoCompleteData) => void;\n private handleOnNoDataRequired: () => void;\n private handleOnTouchstartIOS: (obj) => void;\n private handleKeyPressed: (obj: SFKeyPressObj) => void;\n public state: SFPState;\n public props;\n private issuingCountryCode;\n\n constructor(props: SFPProps) {\n super(props);\n\n const stateObj: SFPState = {\n status: 'loading',\n brand: props.type,\n errors: {},\n valid: {},\n data: {},\n cvcPolicy: CVC_POLICY_REQUIRED,\n expiryDatePolicy: DATE_POLICY_REQUIRED,\n isSfpValid: false,\n hasKoreanFields: props.hasKoreanFields\n };\n this.state = stateObj;\n\n this.csfLoadFailTimeout = null;\n this.csfLoadFailTimeoutMS = 30000;\n\n this.csfConfigFailTimeout = null;\n this.csfConfigFailTimeoutMS = 15000;\n\n this.numCharsInField = {};\n\n // Handlers\n this.handleOnLoad = handlers.handleOnLoad.bind(this);\n this.handleOnConfigSuccess = handlers.handleOnConfigSuccess.bind(this);\n this.handleOnFieldValid = handlers.handleOnFieldValid.bind(this);\n this.handleOnAllValid = handlers.handleOnAllValid.bind(this);\n this.handleOnBrand = handlers.handleOnBrand.bind(this);\n this.handleFocus = handlers.handleFocus.bind(this);\n this.handleOnError = handlers.handleOnError.bind(this);\n this.handleOnNoDataRequired = handlers.handleOnNoDataRequired.bind(this);\n this.handleOnAutoComplete = handlers.handleOnAutoComplete.bind(this);\n this.handleOnTouchstartIOS = handlers.handleOnTouchstartIOS.bind(this); // Only called when iOS detected\n this.handleKeyPressed = handlers.handleKeyPressed.bind(this);\n\n this.processBinLookupResponse = this.processBinLookupResponse.bind(this);\n\n // Bindings for functions exposed to users of this component: SecuredFields & CardInput\n this.setFocusOn = this.setFocusOn.bind(this);\n this.updateStyles = this.updateStyles.bind(this);\n this.handleUnsupportedCard = this.handleUnsupportedCard.bind(this);\n this.showValidation = this.showValidation.bind(this);\n this.destroy = this.destroy.bind(this);\n }\n\n public static defaultProps = defaultProps;\n\n public componentDidMount(): void {\n // When SFP instantiated through SecuredFieldsInput c.f. CardInput\n if (this.props.rootNode) {\n this.setRootNode(this.props.rootNode);\n }\n\n // Find encryptedFields and map them to the values we use to store valid states\n const fields = getFields(this.rootNode);\n const valid = fields.reduce(validFieldsReducer, {});\n\n this.setState({ valid });\n\n // Populate numCharsInField object\n fields.forEach(field => {\n this.numCharsInField[field] = 0;\n });\n\n // Store how many dateFields we are dealing with visually\n this.numDateFields = fields.filter(f => f.match(/Expiry/)).length;\n\n if (fields.length) {\n this.destroy(); // TODO test if this solves the React double render problem.\n this.initializeCSF(this.rootNode);\n } else {\n this.handleOnNoDataRequired();\n }\n }\n\n public componentDidUpdate() {\n this.checkForKCPFields();\n // Pass all the state data up - Used right now for loading status\n this.props.onStateUpdate?.(this.state);\n }\n\n public componentWillUnmount(): void {\n this.csf = null;\n clearTimeout(this.csfLoadFailTimeout);\n clearTimeout(this.csfConfigFailTimeout);\n }\n\n private initializeCSF(root: HTMLElement): void {\n let loadingContext = this.props.loadingContext;\n\n // For loading securedFields from local server during development\n if (process.env.NODE_ENV === 'development' && process.env.__SF_ENV__ !== 'build') {\n loadingContext = process.env.__SF_ENV__;\n }\n\n const csfSetupObj: CSFSetupObject = {\n rootNode: root,\n type: this.props.type,\n clientKey: this.props.clientKey,\n cardGroupTypes: this.props.brands,\n autoFocus: this.props.autoFocus,\n trimTrailingSeparator: this.props.trimTrailingSeparator,\n loadingContext,\n keypadFix: this.props.keypadFix,\n showWarnings: this.props.showWarnings,\n iframeUIConfig: {\n sfStyles: this.props.styles\n },\n i18n: this.props.i18n,\n callbacks: {\n onLoad: this.handleOnLoad,\n onConfigSuccess: this.handleOnConfigSuccess,\n onFieldValid: this.handleOnFieldValid,\n onAllValid: this.handleOnAllValid,\n onBrand: this.handleOnBrand,\n onError: this.handleOnError,\n onFocus: this.handleFocus,\n onBinValue: this.props.onBinValue,\n onAutoComplete: this.handleOnAutoComplete,\n onAdditionalSFConfig: this.props.onAdditionalSFConfig,\n onAdditionalSFRemoved: this.props.onAdditionalSFRemoved,\n onTouchstartIOS: this.handleOnTouchstartIOS,\n onKeyPressed: this.handleKeyPressed\n },\n isKCP: this.state.hasKoreanFields,\n legacyInputMode: this.props.legacyInputMode,\n minimumExpiryDate: this.props.minimumExpiryDate,\n implementationType: this.props.implementationType || 'components', // to distinguish between 'regular' and 'custom' card component\n forceCompat: this.props.forceCompat,\n maskSecurityCode: this.props.maskSecurityCode,\n exposeExpiryDate: this.props.exposeExpiryDate,\n shouldDisableIOSArrowKeys: !!this.props.disableIOSArrowKeys, // convert whether function has been defined into a boolean\n placeholders: this.props.placeholders ?? {},\n showContextualElement: this.props.showContextualElement\n };\n\n this.csf = initCSF(csfSetupObj);\n\n /**\n * Expect to at least have had the handleOnLoad callback called within this time\n * - if this hasn't happened then something has happened to interrupt the loading of the securedFields\n * So we need to clear the loading spinner to see if the securedFields are reporting anything\n */\n // @ts-ignore - timout 'type' is a number\n this.csfLoadFailTimeout = setTimeout(() => {\n if (this.state.status !== 'ready') {\n // Hide the spinner\n this.setState({ status: 'csfLoadFailure' });\n // Report the error\n this.props.onError(new AdyenCheckoutError('ERROR', 'secured field iframes have failed to load'));\n }\n }, this.csfLoadFailTimeoutMS);\n }\n\n private checkForKCPFields() {\n let needsKoreanFields = false;\n if (this.props.koreanAuthenticationRequired) {\n needsKoreanFields = this.issuingCountryCode ? this.issuingCountryCode === 'kr' : this.props.countryCode === 'kr';\n }\n\n // Was korean, now isn't - hide password field\n if (this.state.hasKoreanFields && !needsKoreanFields) {\n // Clear any stored data\n const setRemovedFieldState = prevState => ({\n data: { ...prevState.data, [ENCRYPTED_PWD_FIELD]: undefined },\n valid: { ...prevState.valid, [ENCRYPTED_PWD_FIELD]: false },\n errors: { ...prevState.errors, [ENCRYPTED_PWD_FIELD]: false },\n hasKoreanFields: false\n });\n\n this.setState(setRemovedFieldState, () => {\n this.props.onChange(this.state);\n });\n\n this.csf.removeSecuredField(ENCRYPTED_PWD_FIELD);\n this.csf.setKCPStatus(false);\n }\n\n // Wasn't korean, now is - show password field\n if (!this.state.hasKoreanFields && needsKoreanFields) {\n const setAddedFieldState = prevState => ({\n valid: { ...prevState.valid, [ENCRYPTED_PWD_FIELD]: false },\n hasKoreanFields: true,\n isSfpValid: false\n });\n\n this.setState(setAddedFieldState, () => {\n this.props.onChange(this.state);\n });\n\n this.csf.addSecuredField(ENCRYPTED_PWD_FIELD);\n this.csf.setKCPStatus(true);\n }\n }\n\n public getChildContext(): object {\n return { i18n: this.props.i18n };\n }\n\n public handleUnsupportedCard(errObj: CardErrorData): boolean {\n const hasUnsupportedCard = !!errObj.error;\n\n // Store the brand(s) we detected and which we don't support\n if (hasUnsupportedCard) {\n this.setState({ detectedUnsupportedBrands: errObj.detectedBrands });\n }\n\n errObj.rootNode = this.rootNode; // Needed for CustomCard\n this.handleOnError(errObj, hasUnsupportedCard);\n // Inform CSF that the number field has an unsupportedCard error (or that it has been cleared)\n if (this.csf) {\n this.csf.hasUnsupportedCard(ENCRYPTED_CARD_NUMBER, errObj.error);\n }\n return hasUnsupportedCard;\n }\n\n public setFocusOn(frame: string): void {\n if (this.csf) this.csf.setFocusOnFrame(frame);\n }\n\n public updateStyles(stylesObj: StylesObject): void {\n if (this.csf) this.csf.updateStyles(stylesObj);\n }\n\n public sfIsOptionalOrHidden(fieldType: string): boolean {\n return this.csf.sfIsOptionalOrHidden(fieldType);\n }\n\n public destroy(): void {\n if (this.csf) this.csf.destroy();\n }\n\n public showValidation(): void {\n const { numDateFields, state }: SecuredFieldsProvider = this;\n\n Object.keys(state.valid)\n .reduce(getErrorReducer(numDateFields, state), [])\n .forEach(field => {\n // For each detected error pass an error object to the handler (calls error callback & sets state)\n const errorObj: CardErrorData = getErrorObject(field, this.rootNode, state);\n this.handleOnError(errorObj, !!state.detectedUnsupportedBrands);\n // Inform the secured-fields instance of which fields have been found to have errors\n if (this.csf && this.csf.isValidated) {\n this.csf.isValidated(field, errorObj.error);\n }\n });\n }\n\n /**\n * Map SF errors to ValidationRuleResult-like objects, for CardInput component\n */\n public mapErrorsToValidationRuleResult(): SFStateErrorObj {\n const fieldNames: string[] = Object.keys(this.state.errors);\n\n const sfStateErrorsObj = fieldNames.reduce((acc, fieldName) => {\n const errorCode = this.state.errors[fieldName];\n if (errorCode) {\n acc[fieldName] = {\n isValid: false,\n errorMessage: getErrorMessageFromCode(errorCode, SF_ErrorCodes), // this is the human-readable, untranslated, explanation of the error that will exist on the error object in card.state.errors\n // For v5 the object found in state.errors should also contain the additional properties that used to be sent to the onError callback\n // namely: translation, errorCode, a ref to rootNode &, in the case of failed binLookup, an array of the detectedBrands\n errorI18n: this.props.i18n.get(errorCode),\n error: errorCode,\n rootNode: this.rootNode,\n ...(this.state.detectedUnsupportedBrands && { detectedBrands: this.state.detectedUnsupportedBrands })\n };\n } else {\n acc[fieldName] = null;\n }\n return acc;\n }, {});\n return sfStateErrorsObj;\n }\n\n public processBinLookupResponse(binLookupResponse: BinLookupResponse, resetObject: SingleBrandResetObject): void {\n // If we were dealing with an unsupported card & now we have a valid /binLookup response (or a response triggering a reset of the UI),\n // - reset state to clear the error & the stored unsupportedBrands and, in the case of a valid /binLookup response, inform CSF (via handleUnsupportedCard)\n // (Scenario: from an unsupportedCard state the shopper has pasted another number long enough to trigger a /binLookup)\n if (this.state.detectedUnsupportedBrands) {\n this.setState(prevState => ({\n errors: { ...prevState.errors, [ENCRYPTED_CARD_NUMBER]: false },\n detectedUnsupportedBrands: null\n }));\n\n // If we have some sort of binLookupResponse object then this isn't the reset caused by digits dropping below a threshold\n // - so call handleUnsupportedCard to clear the error\n if (this.csf && binLookupResponse) {\n const errObj: CardErrorData = {\n type: 'card',\n fieldType: 'encryptedCardNumber',\n error: ''\n };\n this.handleUnsupportedCard(errObj);\n }\n }\n\n this.issuingCountryCode = binLookupResponse?.issuingCountryCode?.toLowerCase();\n\n const hasBrandedResetObj = resetObject?.brand;\n\n /**\n * Are we dealing with a \"dedicated\" card scenario i.e a card component created as: checkout.create('bcmc') but which can accept multiple brands\n * - in which case we will need to reset brand and pass on the resetObj to CSF\n */\n const mustResetDedicatedBrand = hasBrandedResetObj && DEDICATED_CARD_COMPONENTS.includes(resetObject.brand);\n\n if (mustResetDedicatedBrand) {\n // resetObject.brand will be the value of the brand whose logo we want to reshow in the UI\n this.setState(resetObject, () => {\n this.props.onChange(this.state);\n });\n }\n\n /**\n * Scenarios:\n *\n * - RESET (binLookupResponse === null): The number of digits in number field has dropped below threshold for BIN lookup\n * - RESULT (binLookupResponse.supportedBrands.length === 1): binLookup has found a result so inform CSF\n *\n * In the RESET scenario, for \"dedicated\" card components we also need to pass on the resetObject since this contains information about\n * the brand that CSF needs to reset to, internally.\n */\n if (this.csf) this.csf.brandsFromBinLookup(binLookupResponse, mustResetDedicatedBrand ? resetObject : null);\n }\n\n private setRootNode = (input: HTMLElement): void => {\n this.rootNode = input;\n };\n\n public render(props, state) {\n return props.render({ setRootNode: this.setRootNode, setFocusOn: this.setFocusOn }, state);\n }\n}\n\nexport default SecuredFieldsProvider;\n"],"names":["SecuredFieldsProvider","Component","componentDidMount","this","props","rootNode","setRootNode","fields","getFields","valid","reduce","validFieldsReducer","setState","forEach","field","numCharsInField","numDateFields","filter","f","match","length","destroy","initializeCSF","handleOnNoDataRequired","componentDidUpdate","_this_props_onStateUpdate","_this_props","checkForKCPFields","onStateUpdate","call","state","componentWillUnmount","csf","clearTimeout","csfLoadFailTimeout","csfConfigFailTimeout","root","loadingContext","_this_props_placeholders","csfSetupObj","type","clientKey","cardGroupTypes","brands","autoFocus","trimTrailingSeparator","keypadFix","showWarnings","iframeUIConfig","sfStyles","styles","i18n","callbacks","onLoad","handleOnLoad","onConfigSuccess","handleOnConfigSuccess","onFieldValid","handleOnFieldValid","onAllValid","handleOnAllValid","onBrand","handleOnBrand","onError","handleOnError","onFocus","handleFocus","onBinValue","onAutoComplete","handleOnAutoComplete","onAdditionalSFConfig","onAdditionalSFRemoved","onTouchstartIOS","handleOnTouchstartIOS","onKeyPressed","handleKeyPressed","isKCP","hasKoreanFields","legacyInputMode","minimumExpiryDate","implementationType","forceCompat","maskSecurityCode","exposeExpiryDate","shouldDisableIOSArrowKeys","disableIOSArrowKeys","placeholders","showContextualElement","initCSF","setTimeout","status","AdyenCheckoutError","csfLoadFailTimeoutMS","needsKoreanFields","koreanAuthenticationRequired","issuingCountryCode","countryCode","setRemovedFieldState","prevState","data","_object_spread_props","_object_spread","ENCRYPTED_PWD_FIELD","undefined","errors","onChange","removeSecuredField","setKCPStatus","setAddedFieldState","isSfpValid","addSecuredField","getChildContext","handleUnsupportedCard","errObj","hasUnsupportedCard","error","detectedUnsupportedBrands","detectedBrands","ENCRYPTED_CARD_NUMBER","setFocusOn","frame","setFocusOnFrame","updateStyles","stylesObj","sfIsOptionalOrHidden","fieldType","showValidation","Object","keys","getErrorReducer","errorObj","getErrorObject","isValidated","mapErrorsToValidationRuleResult","acc","fieldName","errorCode","isValid","errorMessage","getErrorMessageFromCode","SF_ErrorCodes","errorI18n","get","processBinLookupResponse","binLookupResponse","resetObject","toLowerCase","mustResetDedicatedBrand","brand","DEDICATED_CARD_COMPONENTS","includes","brandsFromBinLookup","render","constructor","super","_define_property","csfConfigFailTimeoutMS","input","stateObj","cvcPolicy","CVC_POLICY_REQUIRED","expiryDatePolicy","DATE_POLICY_REQUIRED","handlers","bind","defaultProps"],"mappings":"u8CA8BA,MAAMA,UAA8BC,EAyEzBC,iBAAAA,GAECC,KAAKC,MAAMC,UACXF,KAAKG,YAAYH,KAAKC,MAAMC,UAIhC,MAAME,EAASC,EAAUL,KAAKE,UACxBI,EAAQF,EAAOG,OAAOC,EAAoB,CAAA,GAEhDR,KAAKS,SAAS,CAAEH,UAGhBF,EAAOM,QAAQC,IACXX,KAAKY,gBAAgBD,GAAS,IAIlCX,KAAKa,cAAgBT,EAAOU,OAAOC,GAAKA,EAAEC,MAAM,WAAWC,OAEvDb,EAAOa,QACPjB,KAAKkB,UACLlB,KAAKmB,cAAcnB,KAAKE,WAExBF,KAAKoB,wBAEb,CAEOC,kBAAAA,OAGHC,EAAAC,EAFAvB,KAAKwB,oBAEmB,QAAxBF,GAAAC,EAAAvB,KAAKC,OAAMwB,qBAAX,IAAAH,GAAAA,EAAAI,KAAAH,EAA2BvB,KAAK2B,MACpC,CAEOC,oBAAAA,GACH5B,KAAK6B,IAAM,KACXC,aAAa9B,KAAK+B,oBAClBD,aAAa9B,KAAKgC,qBACtB,CAEQb,aAAAA,CAAcc,GAClB,IAAIC,EAAiBlC,KAAKC,MAAMiC,eA4Cd,IAAAC,EArClB,MAAMC,EAA8B,CAChClC,SAAU+B,EACVI,KAAMrC,KAAKC,MAAMoC,KACjBC,UAAWtC,KAAKC,MAAMqC,UACtBC,eAAgBvC,KAAKC,MAAMuC,OAC3BC,UAAWzC,KAAKC,MAAMwC,UACtBC,sBAAuB1C,KAAKC,MAAMyC,sBAClCR,iBACAS,UAAW3C,KAAKC,MAAM0C,UACtBC,aAAc5C,KAAKC,MAAM2C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kB,QAAQ+I,KAAKjK,KACrC,EAEAwJ,EAvEE3J,EAuEYqK,eAAeA"}
1
+ {"version":3,"file":"SecuredFieldsProvider.js","sources":["../../../../../../src/components/internal/SecuredFields/SFP/SecuredFieldsProvider.ts"],"sourcesContent":["import { Component } from 'preact';\nimport { getErrorObject, getFields, getErrorReducer, validFieldsReducer } from './SFPUtils';\nimport initCSF from '../lib/CSF';\nimport handlers from './SecuredFieldsProviderHandlers';\nimport defaultProps from './defaultProps';\nimport { SFPProps, SFPState, SingleBrandResetObject } from './types';\nimport {\n StylesObject,\n CardErrorData,\n CardFocusData,\n CardBrandData,\n CardAllValidData,\n CardFieldValidData,\n CardAutoCompleteData,\n CardConfigSuccessData,\n CardLoadData,\n SFKeyPressObj\n} from '../lib/types';\nimport { CSFReturnObject, CSFSetupObject } from '../lib/CSF/types';\nimport { CVC_POLICY_REQUIRED, DATE_POLICY_REQUIRED, DEDICATED_CARD_COMPONENTS, ENCRYPTED_CARD_NUMBER, ENCRYPTED_PWD_FIELD } from '../lib/constants';\nimport { BinLookupResponse } from '../../../Card/types';\nimport AdyenCheckoutError from '../../../../core/Errors/AdyenCheckoutError';\nimport { SFStateErrorObj } from '../../../Card/components/CardInput/types';\nimport { getErrorMessageFromCode } from '../../../../core/Errors/utils';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\n\n/**\n * SecuredFieldsProvider:\n * Initialises & handles the client-side part of SecuredFields\n */\nclass SecuredFieldsProvider extends Component<SFPProps, SFPState> {\n private csfLoadFailTimeout: number;\n private csfLoadFailTimeoutMS: number;\n private csfConfigFailTimeout: number;\n private csfConfigFailTimeoutMS: number;\n private numCharsInField: object;\n private rootNode;\n private numDateFields: number;\n private csf: CSFReturnObject;\n private handleOnLoad: (obj: CardLoadData) => void;\n private handleOnConfigSuccess: (obj: CardConfigSuccessData) => void;\n private handleOnFieldValid: (obj: CardFieldValidData) => void;\n private handleOnAllValid: (obj: CardAllValidData) => void;\n private handleOnBrand: (obj: CardBrandData) => void;\n private handleFocus: (obj: CardFocusData) => void;\n private handleOnError: (obj: CardErrorData, hasUnsupportedCard?: boolean) => void;\n private handleOnAutoComplete: (obj: CardAutoCompleteData) => void;\n private handleOnNoDataRequired: () => void;\n private handleOnTouchstartIOS: (obj) => void;\n private handleKeyPressed: (obj: SFKeyPressObj) => void;\n public state: SFPState;\n public props;\n private issuingCountryCode;\n\n constructor(props: SFPProps) {\n super(props);\n\n const stateObj: SFPState = {\n status: 'loading',\n brand: props.type,\n errors: {},\n valid: {},\n data: {},\n cvcPolicy: CVC_POLICY_REQUIRED,\n expiryDatePolicy: DATE_POLICY_REQUIRED,\n isSfpValid: false,\n hasKoreanFields: props.hasKoreanFields\n };\n this.state = stateObj;\n\n this.csfLoadFailTimeout = null;\n this.csfLoadFailTimeoutMS = 30000;\n\n this.csfConfigFailTimeout = null;\n this.csfConfigFailTimeoutMS = 15000;\n\n this.numCharsInField = {};\n\n // Handlers\n this.handleOnLoad = handlers.handleOnLoad.bind(this);\n this.handleOnConfigSuccess = handlers.handleOnConfigSuccess.bind(this);\n this.handleOnFieldValid = handlers.handleOnFieldValid.bind(this);\n this.handleOnAllValid = handlers.handleOnAllValid.bind(this);\n this.handleOnBrand = handlers.handleOnBrand.bind(this);\n this.handleFocus = handlers.handleFocus.bind(this);\n this.handleOnError = handlers.handleOnError.bind(this);\n this.handleOnNoDataRequired = handlers.handleOnNoDataRequired.bind(this);\n this.handleOnAutoComplete = handlers.handleOnAutoComplete.bind(this);\n this.handleOnTouchstartIOS = handlers.handleOnTouchstartIOS.bind(this); // Only called when iOS detected\n this.handleKeyPressed = handlers.handleKeyPressed.bind(this);\n\n this.processBinLookupResponse = this.processBinLookupResponse.bind(this);\n\n // Bindings for functions exposed to users of this component: SecuredFields & CardInput\n this.setFocusOn = this.setFocusOn.bind(this);\n this.updateStyles = this.updateStyles.bind(this);\n this.handleUnsupportedCard = this.handleUnsupportedCard.bind(this);\n this.showValidation = this.showValidation.bind(this);\n this.destroy = this.destroy.bind(this);\n }\n\n public static defaultProps = defaultProps;\n\n public componentDidMount(): void {\n // When SFP instantiated through SecuredFieldsInput c.f. CardInput\n if (this.props.rootNode) {\n this.setRootNode(this.props.rootNode);\n }\n\n // Find encryptedFields and map them to the values we use to store valid states\n const fields = getFields(this.rootNode);\n const valid = fields.reduce(validFieldsReducer, {});\n\n this.setState({ valid });\n\n // Populate numCharsInField object\n fields.forEach(field => {\n this.numCharsInField[field] = 0;\n });\n\n // Store how many dateFields we are dealing with visually\n this.numDateFields = fields.filter(f => f.match(/Expiry/)).length;\n\n if (fields.length) {\n this.destroy(); // TODO test if this solves the React double render problem.\n this.initializeCSF(this.rootNode);\n } else {\n this.handleOnNoDataRequired();\n }\n }\n\n public componentDidUpdate() {\n this.checkForKCPFields();\n // Pass all the state data up - Used right now for loading status\n this.props.onStateUpdate?.(this.state);\n }\n\n public componentWillUnmount(): void {\n this.csf = null;\n clearTimeout(this.csfLoadFailTimeout);\n clearTimeout(this.csfConfigFailTimeout);\n }\n\n private initializeCSF(root: HTMLElement): void {\n let loadingContext = this.props.loadingContext;\n\n // For loading securedFields from local server during development\n if (process.env.NODE_ENV === 'development' && process.env.__SF_ENV__ !== 'build') {\n loadingContext = process.env.__SF_ENV__;\n }\n\n const csfSetupObj: CSFSetupObject = {\n rootNode: root,\n type: this.props.type,\n clientKey: this.props.clientKey,\n cardGroupTypes: this.props.brands,\n autoFocus: this.props.autoFocus,\n trimTrailingSeparator: this.props.trimTrailingSeparator,\n loadingContext,\n keypadFix: this.props.keypadFix,\n showWarnings: this.props.showWarnings,\n iframeUIConfig: {\n sfStyles: this.props.styles\n },\n i18n: this.props.i18n,\n callbacks: {\n onLoad: this.handleOnLoad,\n onConfigSuccess: this.handleOnConfigSuccess,\n onFieldValid: this.handleOnFieldValid,\n onAllValid: this.handleOnAllValid,\n onBrand: this.handleOnBrand,\n onError: this.handleOnError,\n onFocus: this.handleFocus,\n onBinValue: this.props.onBinValue,\n onAutoComplete: this.handleOnAutoComplete,\n onAdditionalSFConfig: this.props.onAdditionalSFConfig,\n onAdditionalSFRemoved: this.props.onAdditionalSFRemoved,\n onTouchstartIOS: this.handleOnTouchstartIOS,\n onKeyPressed: this.handleKeyPressed\n },\n isKCP: this.state.hasKoreanFields,\n legacyInputMode: this.props.legacyInputMode,\n minimumExpiryDate: this.props.minimumExpiryDate,\n implementationType: this.props.implementationType || 'components', // to distinguish between 'regular' and 'custom' card component\n forceCompat: this.props.forceCompat,\n maskSecurityCode: this.props.maskSecurityCode,\n exposeExpiryDate: this.props.exposeExpiryDate,\n shouldDisableIOSArrowKeys: !!this.props.disableIOSArrowKeys, // convert whether function has been defined into a boolean\n placeholders: this.props.placeholders ?? {},\n showContextualElement: this.props.showContextualElement\n };\n\n this.csf = initCSF(csfSetupObj);\n\n /**\n * Expect to at least have had the handleOnLoad callback called within this time\n * - if this hasn't happened then something has happened to interrupt the loading of the securedFields\n * So we need to clear the loading spinner to see if the securedFields are reporting anything\n */\n // @ts-ignore - timout 'type' is a number\n this.csfLoadFailTimeout = setTimeout(() => {\n if (this.state.status !== 'ready') {\n // Hide the spinner\n this.setState({ status: 'csfLoadFailure' });\n // Report the error\n this.props.onError(new AdyenCheckoutError('ERROR', 'secured field iframes have failed to load'));\n }\n }, this.csfLoadFailTimeoutMS);\n }\n\n private checkForKCPFields() {\n let needsKoreanFields = false;\n if (this.props.koreanAuthenticationRequired) {\n needsKoreanFields = this.issuingCountryCode ? this.issuingCountryCode === 'kr' : this.props.countryCode === 'kr';\n }\n\n // Was korean, now isn't - hide password field\n if (this.state.hasKoreanFields && !needsKoreanFields) {\n // Clear any stored data\n const setRemovedFieldState = prevState => ({\n data: { ...prevState.data, [ENCRYPTED_PWD_FIELD]: undefined },\n valid: { ...prevState.valid, [ENCRYPTED_PWD_FIELD]: false },\n errors: { ...prevState.errors, [ENCRYPTED_PWD_FIELD]: false },\n hasKoreanFields: false\n });\n\n this.setState(setRemovedFieldState, () => {\n this.props.onChange(this.state);\n });\n\n this.csf.removeSecuredField(ENCRYPTED_PWD_FIELD);\n this.csf.setKCPStatus(false);\n }\n\n // Wasn't korean, now is - show password field\n if (!this.state.hasKoreanFields && needsKoreanFields) {\n const setAddedFieldState = prevState => ({\n valid: { ...prevState.valid, [ENCRYPTED_PWD_FIELD]: false },\n hasKoreanFields: true,\n isSfpValid: false\n });\n\n this.setState(setAddedFieldState, () => {\n this.props.onChange(this.state);\n });\n\n this.csf.addSecuredField(ENCRYPTED_PWD_FIELD);\n this.csf.setKCPStatus(true);\n }\n }\n\n public getChildContext(): object {\n return { i18n: this.props.i18n };\n }\n\n public handleUnsupportedCard(errObj: CardErrorData): boolean {\n const hasUnsupportedCard = !!errObj.error;\n\n // Store the brand(s) we detected and which we don't support\n if (hasUnsupportedCard) {\n this.setState({ detectedUnsupportedBrands: errObj.detectedBrands });\n }\n\n errObj.rootNode = this.rootNode; // Needed for CustomCard\n this.handleOnError(errObj, hasUnsupportedCard);\n // Inform CSF that the number field has an unsupportedCard error (or that it has been cleared)\n if (this.csf) {\n this.csf.hasUnsupportedCard(ENCRYPTED_CARD_NUMBER, errObj.error);\n }\n return hasUnsupportedCard;\n }\n\n public setFocusOn(frame: string): void {\n if (this.csf) this.csf.setFocusOnFrame(frame);\n }\n\n public updateStyles(stylesObj: StylesObject): void {\n if (this.csf) this.csf.updateStyles(stylesObj);\n }\n\n public sfIsOptionalOrHidden(fieldType: string): boolean {\n return this.csf.sfIsOptionalOrHidden(fieldType);\n }\n\n public destroy(): void {\n if (this.csf) this.csf.destroy();\n }\n\n public showValidation(): void {\n const { numDateFields, state }: SecuredFieldsProvider = this;\n\n Object.keys(state.valid)\n .reduce(getErrorReducer(numDateFields, state), [])\n .forEach(field => {\n // For each detected error pass an error object to the handler (calls error callback & sets state)\n const errorObj: CardErrorData = getErrorObject(field, this.rootNode, state);\n this.handleOnError(errorObj, !!state.detectedUnsupportedBrands);\n // Inform the secured-fields instance of which fields have been found to have errors\n if (this.csf && this.csf.isValidated) {\n this.csf.isValidated(field, errorObj.error);\n }\n });\n }\n\n /**\n * Map SF errors to ValidationRuleResult-like objects, for CardInput component\n */\n public mapErrorsToValidationRuleResult(): SFStateErrorObj {\n const fieldNames: string[] = Object.keys(this.state.errors);\n\n const sfStateErrorsObj = fieldNames.reduce((acc, fieldName) => {\n const errorCode = this.state.errors[fieldName];\n if (errorCode) {\n acc[fieldName] = {\n isValid: false,\n errorMessage: getErrorMessageFromCode(errorCode, SF_ErrorCodes), // this is the human-readable, untranslated, explanation of the error that will exist on the error object in card.state.errors\n // For v5 the object found in state.errors should also contain the additional properties that used to be sent to the onError callback\n // namely: translation, errorCode, a ref to rootNode &, in the case of failed binLookup, an array of the detectedBrands\n errorI18n: this.props.i18n.get(errorCode),\n error: errorCode,\n rootNode: this.rootNode,\n ...(this.state.detectedUnsupportedBrands && { detectedBrands: this.state.detectedUnsupportedBrands })\n };\n } else {\n acc[fieldName] = null;\n }\n return acc;\n }, {});\n return sfStateErrorsObj;\n }\n\n public processBinLookupResponse(binLookupResponse: BinLookupResponse, resetObject: SingleBrandResetObject): void {\n // If we were dealing with an unsupported card & now we have a valid /binLookup response (or a response triggering a reset of the UI),\n // - reset state to clear the error & the stored unsupportedBrands and, in the case of a valid /binLookup response, inform CSF (via handleUnsupportedCard)\n // (Scenario: from an unsupportedCard state the shopper has pasted another number long enough to trigger a /binLookup)\n if (this.state.detectedUnsupportedBrands) {\n this.setState(prevState => ({\n errors: { ...prevState.errors, [ENCRYPTED_CARD_NUMBER]: false },\n detectedUnsupportedBrands: null\n }));\n\n // If we have some sort of binLookupResponse object then this isn't the reset caused by digits dropping below a threshold\n // - so call handleUnsupportedCard to clear the error\n if (this.csf && binLookupResponse) {\n const errObj: CardErrorData = {\n type: 'card',\n fieldType: 'encryptedCardNumber',\n error: ''\n };\n this.handleUnsupportedCard(errObj);\n }\n }\n\n this.issuingCountryCode = binLookupResponse?.issuingCountryCode?.toLowerCase();\n\n const hasBrandedResetObj = resetObject?.brand;\n\n /**\n * Are we dealing with a \"dedicated\" card scenario i.e a card component created as: checkout.create('bcmc') but which can accept multiple brands\n * - in which case we will need to reset brand and pass on the resetObj to CSF\n */\n const mustResetDedicatedBrand = hasBrandedResetObj && DEDICATED_CARD_COMPONENTS.includes(resetObject.brand);\n\n if (mustResetDedicatedBrand) {\n // resetObject.brand will be the value of the brand whose logo we want to reshow in the UI\n this.setState(resetObject, () => {\n this.props.onChange(this.state);\n });\n }\n\n /**\n * Scenarios:\n *\n * - RESET (binLookupResponse === null): The number of digits in number field has dropped below threshold for BIN lookup\n * - RESULT (binLookupResponse.supportedBrands.length === 1): binLookup has found a result so inform CSF\n *\n * In the RESET scenario, for \"dedicated\" card components we also need to pass on the resetObject since this contains information about\n * the brand that CSF needs to reset to, internally.\n */\n if (this.csf) this.csf.brandsFromBinLookup(binLookupResponse, mustResetDedicatedBrand ? resetObject : null);\n }\n\n private setRootNode = (input: HTMLElement): void => {\n this.rootNode = input;\n };\n\n public render(props, state) {\n return props.render({ setRootNode: this.setRootNode, setFocusOn: this.setFocusOn }, state);\n }\n}\n\nexport default SecuredFieldsProvider;\n"],"names":["SecuredFieldsProvider","Component","componentDidMount","this","props","rootNode","setRootNode","fields","getFields","valid","reduce","validFieldsReducer","setState","forEach","field","numCharsInField","numDateFields","filter","f","match","length","destroy","initializeCSF","handleOnNoDataRequired","componentDidUpdate","_this_props_onStateUpdate","_this_props","checkForKCPFields","onStateUpdate","call","state","componentWillUnmount","csf","clearTimeout","csfLoadFailTimeout","csfConfigFailTimeout","root","_this_props_placeholders","loadingContext","csfSetupObj","type","clientKey","cardGroupTypes","brands","autoFocus","trimTrailingSeparator","keypadFix","showWarnings","iframeUIConfig","sfStyles","styles","i18n","callbacks","onLoad","handleOnLoad","onConfigSuccess","handleOnConfigSuccess","onFieldValid","handleOnFieldValid","onAllValid","handleOnAllValid","onBrand","handleOnBrand","onError","handleOnError","onFocus","handleFocus","onBinValue","onAutoComplete","handleOnAutoComplete","onAdditionalSFConfig","onAdditionalSFRemoved","onTouchstartIOS","handleOnTouchstartIOS","onKeyPressed","handleKeyPressed","isKCP","hasKoreanFields","legacyInputMode","minimumExpiryDate","implementationType","forceCompat","maskSecurityCode","exposeExpiryDate","shouldDisableIOSArrowKeys","disableIOSArrowKeys","placeholders","showContextualElement","initCSF","setTimeout","status","AdyenCheckoutError","csfLoadFailTimeoutMS","needsKoreanFields","koreanAuthenticationRequired","issuingCountryCode","countryCode","setRemovedFieldState","prevState","data","_object_spread_props","_object_spread","ENCRYPTED_PWD_FIELD","undefined","errors","onChange","removeSecuredField","setKCPStatus","setAddedFieldState","isSfpValid","addSecuredField","getChildContext","handleUnsupportedCard","errObj","hasUnsupportedCard","error","detectedUnsupportedBrands","detectedBrands","ENCRYPTED_CARD_NUMBER","setFocusOn","frame","setFocusOnFrame","updateStyles","stylesObj","sfIsOptionalOrHidden","fieldType","showValidation","Object","keys","getErrorReducer","errorObj","getErrorObject","isValidated","mapErrorsToValidationRuleResult","acc","fieldName","errorCode","isValid","errorMessage","getErrorMessageFromCode","SF_ErrorCodes","errorI18n","get","processBinLookupResponse","binLookupResponse","resetObject","toLowerCase","mustResetDedicatedBrand","brand","DEDICATED_CARD_COMPONENTS","includes","brandsFromBinLookup","render","constructor","super","_define_property","csfConfigFailTimeoutMS","input","stateObj","cvcPolicy","CVC_POLICY_REQUIRED","expiryDatePolicy","DATE_POLICY_REQUIRED","handlers","bind","defaultProps"],"mappings":"u8CA8BA,MAAMA,UAA8BC,EAyEzBC,iBAAAA,GAECC,KAAKC,MAAMC,UACXF,KAAKG,YAAYH,KAAKC,MAAMC,UAIhC,MAAME,EAASC,EAAUL,KAAKE,UACxBI,EAAQF,EAAOG,OAAOC,EAAoB,CAAA,GAEhDR,KAAKS,SAAS,CAAEH,UAGhBF,EAAOM,QAAQC,IACXX,KAAKY,gBAAgBD,GAAS,IAIlCX,KAAKa,cAAgBT,EAAOU,OAAOC,GAAKA,EAAEC,MAAM,WAAWC,OAEvDb,EAAOa,QACPjB,KAAKkB,UAC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,KAAK2D,cAAgBqG,EAASrG,cAAcsG,KAAKjK,MACjDA,KAAK+D,YAAciG,EAASjG,YAAYkG,KAAKjK,MAC7CA,KAAK6D,cAAgBmG,EAASnG,cAAcoG,KAAKjK,MACjDA,KAAKoB,uBAAyB4I,EAAS5I,uBAAuB6I,KAAKjK,MACnEA,KAAKkE,qBAAuB8F,EAAS9F,qBAAqB+F,KAAKjK,MAC/DA,KAAKsE,sBAAwB0F,EAAS1F,sBAAsB2F,KAAKjK,MACjEA,KAAKwE,iBAAmBwF,EAASxF,iBAAiByF,KAAKjK,MAEvDA,KAAK4I,yBAA2B5I,KAAK4I,yBAAyBqB,KAAKjK,MAGnEA,KAAKoH,WAAapH,KAAKoH,WAAW6C,KAAKjK,MACvCA,KAAKuH,aAAevH,KAAKuH,aAAa0C,KAAKjK,MAC3CA,KAAK6G,sBAAwB7G,KAAK6G,sBAAsBoD,KAAKjK,MAC7DA,KAAK2H,eAAiB3H,KAAK2H,eAAesC,KAAKjK,MAC/CA,KAAKkB,QAAUlB,KAAKkB,QAAQ+I,KAAKjK,KACrC,EAEAwJ,EAvEE3J,EAuEYqK,eAAeA"}
@@ -1,2 +1,2 @@
1
- import{getCardImageUrl as e}from"../utils.js";import{ENCRYPTED_CARD_NUMBER as t,ENCRYPTED_SECURITY_CODE as r,ENCRYPTED_EXPIRY_DATE as n,ENCRYPTED_EXPIRY_MONTH as i,ENCRYPTED_EXPIRY_YEAR as s,DATE_POLICY_REQUIRED as o,CVC_POLICY_REQUIRED as a,OPTIONAL as l,HIDDEN as d}from"../lib/constants.js";import{existy as u}from"../../../../utils/commonUtils.js";import c from"../../../../core/Errors/AdyenCheckoutError.js";function p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function h(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){p(e,t,r[t])})}return e}function f(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function y(e,t,r,n){return(t!==l&&t!==d||0!==r[e])&&n[e]}var m={handleFocus:function(e){this.numCharsInField[e.fieldType]=e.numChars,this.props.onFocus(e)},handleOnAllValid:function(e){return!this.state.detectedUnsupportedBrands&&(this.setState({isSfpValid:e.allValid},()=>{this.props.onChange(this.state,{event:"handleOnAllValid"}),this.props.onAllValid(e)}),!0)},handleOnAutoComplete:function(e){this.setState({autoCompleteName:e.value},()=>{this.props.onChange(this.state,{event:"handleOnAutoComplete",fieldType:e.fieldType}),this.setState({autoCompleteName:null})}),this.props.onAutoComplete(e)},handleOnFieldValid:function(e){return(!this.state.detectedUnsupportedBrands||e.fieldType!==t)&&(this.setState(t=>{var r;return{data:f(h({},t.data),{[e.encryptedFieldName]:e.blob}),valid:f(h({},t.valid),{[e.encryptedFieldName]:e.valid}),errors:f(h({},t.errors),{[e.fieldType]:null!==(r=t.errors[e.fieldType])&&void 0!==r&&r})}},()=>{this.props.onChange(this.state,{event:"handleOnFieldValid",fieldType:e.fieldType}),this.props.onFieldValid(e)}),!0)},handleOnLoad:function(e){clearTimeout(this.csfLoadFailTimeout),this.csfLoadFailTimeout=null,this.props.onLoad(e),this.csfConfigFailTimeout=setTimeout(()=>{"ready"!==this.state.status&&(this.setState({status:"csfConfigFailure"}),this.props.onError(new c("ERROR","secured fields have failed to configure")))},this.csfConfigFailTimeoutMS)},handleOnConfigSuccess:function(e){clearTimeout(this.csfConfigFailTimeout),this.csfConfigFailTimeout=null,this.setState({status:"ready"},()=>{this.props.onConfigSuccess(e)})},handleOnBrand:function(t){this.setState(e=>{const l=y(r,t.cvcPolicy,this.numCharsInField,e.errors),d=1===this.numDateFields?y(n,t.expiryDatePolicy,this.numCharsInField,e.errors):null,c=2===this.numDateFields?y(i,t.expiryDatePolicy,this.numCharsInField,e.errors):null,p=2===this.numDateFields?y(s,t.expiryDatePolicy,this.numCharsInField,e.errors):null;var f,m;return{brand:t.brand,cvcPolicy:null!==(f=t.cvcPolicy)&&void 0!==f?f:a,showSocialSecurityNumber:t.showSocialSecurityNumber,errors:h({},e.errors,u(l)&&{[r]:l},u(d)&&{[n]:d},u(c)&&{[i]:c},u(p)&&{[s]:p}),expiryDatePolicy:null!==(m=t.expiryDatePolicy)&&void 0!==m?m:o}},()=>{var r,n;this.props.onChange(this.state,{event:"handleOnBrand"});const i=null!==(n=null===(r=this.props.brandsConfiguration[t.brand])||void 0===r?void 0:r.icon)&&void 0!==n?n:e(t.brand,this.props.resources);this.props.onBrand(f(h({},t),{brandImageUrl:i}))})},handleOnError:function(e,r=null){const n=e.error;return this.setState(i=>h({errors:f(h({},i.errors),{[e.fieldType]:n||!1})},r&&{data:f(h({},i.data),{[t]:void 0})},r&&{valid:f(h({},i.valid),{[t]:!1})},r&&{isSfpValid:!1}),()=>{this.props.onChange(this.state,{event:"handleOnError",fieldType:e.fieldType})}),!0},handleOnNoDataRequired:function(){this.setState({status:"ready"},()=>this.props.onChange({isSfpValid:!0}))},handleOnTouchstartIOS:function(e){var t,r;null===(t=(r=this.props).disableIOSArrowKeys)||void 0===t||t.call(r,e)},handleKeyPressed:function(e){if("enterKeyPressed"===e.action){var t,r;const e=new KeyboardEvent("keypress",{bubbles:!0,cancelable:!0,key:"Enter",code:"Enter"});null===(t=(r=this.props).handleKeyPress)||void 0===t||t.call(r,e)}}};export{m as default};
1
+ import{getCardImageUrl as e}from"../utils.js";import{ENCRYPTED_CARD_NUMBER as t,ENCRYPTED_SECURITY_CODE as r,ENCRYPTED_EXPIRY_DATE as n,ENCRYPTED_EXPIRY_MONTH as i,ENCRYPTED_EXPIRY_YEAR as s,DATE_POLICY_REQUIRED as o,CVC_POLICY_REQUIRED as a,OPTIONAL as l,HIDDEN as d}from"../lib/constants.js";import{existy as u}from"../../../../utils/commonUtils.js";import c from"../../../../core/Errors/AdyenCheckoutError.js";function p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function h(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){p(e,t,r[t])})}return e}function f(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function y(e,t,r,n){return(t!==l&&t!==d||0!==r[e])&&n[e]}var m={handleFocus:function(e){this.numCharsInField[e.fieldType]=e.numChars,this.props.onFocus(e)},handleOnAllValid:function(e){return!this.state.detectedUnsupportedBrands&&(this.setState({isSfpValid:e.allValid},()=>{this.props.onChange(this.state,{event:"handleOnAllValid"}),this.props.onAllValid(e)}),!0)},handleOnAutoComplete:function(e){this.setState({autoCompleteName:e.value},()=>{this.props.onChange(this.state,{event:"handleOnAutoComplete",fieldType:e.fieldType}),this.setState({autoCompleteName:null})}),this.props.onAutoComplete(e)},handleOnFieldValid:function(e){return(!this.state.detectedUnsupportedBrands||e.fieldType!==t)&&(this.setState(t=>{var r;return{data:f(h({},t.data),{[e.encryptedFieldName]:e.blob}),valid:f(h({},t.valid),{[e.encryptedFieldName]:e.valid}),errors:f(h({},t.errors),{[e.fieldType]:null!==(r=t.errors[e.fieldType])&&void 0!==r&&r})}},()=>{this.props.onChange(this.state,{event:"handleOnFieldValid",fieldType:e.fieldType}),this.props.onFieldValid(e)}),!0)},handleOnLoad:function(e){clearTimeout(this.csfLoadFailTimeout),this.csfLoadFailTimeout=null,this.props.onLoad(e),this.csfConfigFailTimeout=setTimeout(()=>{"ready"!==this.state.status&&(this.setState({status:"csfConfigFailure"}),this.props.onError(new c("ERROR","secured fields have failed to configure")))},this.csfConfigFailTimeoutMS)},handleOnConfigSuccess:function(e){clearTimeout(this.csfConfigFailTimeout),this.csfConfigFailTimeout=null,this.setState({status:"ready"},()=>{this.props.onConfigSuccess(e)})},handleOnBrand:function(t){this.setState(e=>{var l,d;const c=y(r,t.cvcPolicy,this.numCharsInField,e.errors),p=1===this.numDateFields?y(n,t.expiryDatePolicy,this.numCharsInField,e.errors):null,f=2===this.numDateFields?y(i,t.expiryDatePolicy,this.numCharsInField,e.errors):null,m=2===this.numDateFields?y(s,t.expiryDatePolicy,this.numCharsInField,e.errors):null;return{brand:t.brand,cvcPolicy:null!==(l=t.cvcPolicy)&&void 0!==l?l:a,showSocialSecurityNumber:t.showSocialSecurityNumber,errors:h({},e.errors,u(c)&&{[r]:c},u(p)&&{[n]:p},u(f)&&{[i]:f},u(m)&&{[s]:m}),expiryDatePolicy:null!==(d=t.expiryDatePolicy)&&void 0!==d?d:o}},()=>{var r,n;this.props.onChange(this.state,{event:"handleOnBrand"});const i=null!==(r=null===(n=this.props.brandsConfiguration[t.brand])||void 0===n?void 0:n.icon)&&void 0!==r?r:e(t.brand,this.props.resources);this.props.onBrand(f(h({},t),{brandImageUrl:i}))})},handleOnError:function(e,r=null){const n=e.error;return this.setState(i=>h({errors:f(h({},i.errors),{[e.fieldType]:n||!1})},r&&{data:f(h({},i.data),{[t]:void 0})},r&&{valid:f(h({},i.valid),{[t]:!1})},r&&{isSfpValid:!1}),()=>{this.props.onChange(this.state,{event:"handleOnError",fieldType:e.fieldType})}),!0},handleOnNoDataRequired:function(){this.setState({status:"ready"},()=>this.props.onChange({isSfpValid:!0}))},handleOnTouchstartIOS:function(e){var t,r;null===(t=(r=this.props).disableIOSArrowKeys)||void 0===t||t.call(r,e)},handleKeyPressed:function(e){if("enterKeyPressed"===e.action){var t,r;const e=new KeyboardEvent("keypress",{bubbles:!0,cancelable:!0,key:"Enter",code:"Enter"});null===(t=(r=this.props).handleKeyPress)||void 0===t||t.call(r,e)}}};export{m as default};
2
2
  //# sourceMappingURL=SecuredFieldsProviderHandlers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SecuredFieldsProviderHandlers.js","sources":["../../../../../../src/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.ts"],"sourcesContent":["import { getCardImageUrl } from '../utils';\nimport {\n ENCRYPTED_SECURITY_CODE,\n ENCRYPTED_CARD_NUMBER,\n CVC_POLICY_REQUIRED,\n DATE_POLICY_REQUIRED,\n ENCRYPTED_EXPIRY_DATE,\n OPTIONAL,\n HIDDEN,\n ENCRYPTED_EXPIRY_MONTH,\n ENCRYPTED_EXPIRY_YEAR\n} from '../lib/constants';\nimport {\n CardErrorData,\n CardFocusData,\n CardBrandData,\n CardAllValidData,\n CardFieldValidData,\n CardAutoCompleteData,\n CardConfigSuccessData,\n CardLoadData,\n SFKeyPressObj\n} from '../lib/types';\nimport { existy } from '../../../../utils/commonUtils';\nimport AdyenCheckoutError from '../../../../core/Errors/AdyenCheckoutError';\n\n/**\n * Emits the onLoad event\n * Here we can assume all securedFields iframes have fired their 'load' event\n */\nfunction handleOnLoad(cbObj: CardLoadData): void {\n // Clear 'loading' timeout\n clearTimeout(this.csfLoadFailTimeout);\n this.csfLoadFailTimeout = null;\n\n // Propagate onLoad event\n this.props.onLoad(cbObj);\n\n /**\n * Having seen that the securedFields iframes have loaded some kind of content (we don't know what, yet)\n * - setTimeout since we expect to get a successful configuration message \"within a reasonable time\"\n *\n * Now we catch clientKey & environment mismatch in core.ts - this timeout being called indicates that the securedFields have not all configured\n * - so we need to clear the loading spinner to see if the securedFields are reporting anything\n */\n this.csfConfigFailTimeout = setTimeout(() => {\n if (this.state.status !== 'ready') {\n // Hide the spinner\n this.setState({ status: 'csfConfigFailure' });\n // Report the error\n this.props.onError(new AdyenCheckoutError('ERROR', 'secured fields have failed to configure'));\n }\n }, this.csfConfigFailTimeoutMS);\n}\n\n/**\n * Emits the onConfigSuccess (ready) event\n * Here we can assume CSF is loaded, configured and ready to be used\n */\nfunction handleOnConfigSuccess(cbObj: CardConfigSuccessData): void {\n // Clear 'config' timeout\n clearTimeout(this.csfConfigFailTimeout);\n this.csfConfigFailTimeout = null;\n\n this.setState({ status: 'ready' }, () => {\n // Propagate onConfigSuccess event\n this.props.onConfigSuccess(cbObj);\n });\n}\n\n/**\n * Emits the onAllValid event\n */\nfunction handleOnAllValid(status: CardAllValidData): boolean {\n // Form cannot be valid whilst there is an unsupported card\n if (this.state.detectedUnsupportedBrands) {\n return false;\n }\n\n this.setState({ isSfpValid: status.allValid }, () => {\n // New - fixes maestro-with-error-on-optional-cvc-field bug\n this.props.onChange(this.state, { event: 'handleOnAllValid' });\n // Propagate onAllValid event\n this.props.onAllValid(status);\n });\n\n return true;\n}\n\n/**\n * Saves a field value from CSF in the CardInput state\n * Emits the onFieldValid event\n */\nfunction handleOnFieldValid(fieldObj: CardFieldValidData): boolean {\n // A card number field cannot be valid whilst there is an unsupported card\n if (this.state.detectedUnsupportedBrands && fieldObj.fieldType === ENCRYPTED_CARD_NUMBER) {\n return false;\n }\n\n const setValidFieldState = prevState => ({\n data: { ...prevState.data, [fieldObj.encryptedFieldName]: fieldObj.blob },\n valid: { ...prevState.valid, [fieldObj.encryptedFieldName]: fieldObj.valid },\n /**\n * For a field that has just received valid:true (field has just been completed & encrypted) - mark the error state for this field as false\n * For a field that has just received valid:false (field was encrypted, now is not)\n * - field is either in a state of being incomplete but without errors (digit deleted) - so mark the error state for this field as false\n * or has switched from valid/encrypted state to being in error (digit edited to one that puts the field in error) - so keep any error that\n * might just have been set\n */\n errors: { ...prevState.errors, [fieldObj.fieldType]: prevState.errors[fieldObj.fieldType] ?? false }\n });\n\n this.setState(setValidFieldState, () => {\n this.props.onChange(this.state, { event: 'handleOnFieldValid', fieldType: fieldObj.fieldType });\n\n // Propagate onFieldValid event\n this.props.onFieldValid(fieldObj);\n });\n\n return true;\n}\n\nfunction fieldIsInError(fieldType: string, policy: string, numCharsObj: object, errorsObj) {\n return (policy === OPTIONAL || policy === HIDDEN) && numCharsObj[fieldType] === 0 ? false : errorsObj[fieldType];\n}\n\n/**\n * Saves the card brand in state\n * Emits the onBrand event\n */\nfunction handleOnBrand(cardInfo: CardBrandData): void {\n this.setState(\n prevState => {\n /**\n * If we change brand to one where the cvc or date field(s) are not required & are empty - then these fields cannot be in error\n * (scenario: have validated empty form, then choose brand w. optional/hidden cvc or date)...\n * ...else propagate the existing error.\n */\n const cvcFieldInError = fieldIsInError(ENCRYPTED_SECURITY_CODE, cardInfo.cvcPolicy, this.numCharsInField, prevState.errors);\n\n const dateFieldInError =\n this.numDateFields === 1\n ? fieldIsInError(ENCRYPTED_EXPIRY_DATE, cardInfo.expiryDatePolicy, this.numCharsInField, prevState.errors)\n : null;\n\n // For custom card comp\n const monthFieldInError =\n this.numDateFields === 2\n ? fieldIsInError(ENCRYPTED_EXPIRY_MONTH, cardInfo.expiryDatePolicy, this.numCharsInField, prevState.errors)\n : null;\n\n const yearFieldInError =\n this.numDateFields === 2\n ? fieldIsInError(ENCRYPTED_EXPIRY_YEAR, cardInfo.expiryDatePolicy, this.numCharsInField, prevState.errors)\n : null;\n // --\n /** end */\n\n return {\n brand: cardInfo.brand,\n cvcPolicy: cardInfo.cvcPolicy ?? CVC_POLICY_REQUIRED,\n showSocialSecurityNumber: cardInfo.showSocialSecurityNumber,\n errors: {\n ...prevState.errors,\n ...(existy(cvcFieldInError) && { [ENCRYPTED_SECURITY_CODE]: cvcFieldInError }),\n ...(existy(dateFieldInError) && { [ENCRYPTED_EXPIRY_DATE]: dateFieldInError }),\n ...(existy(monthFieldInError) && { [ENCRYPTED_EXPIRY_MONTH]: monthFieldInError }),\n ...(existy(yearFieldInError) && { [ENCRYPTED_EXPIRY_YEAR]: yearFieldInError })\n },\n expiryDatePolicy: cardInfo.expiryDatePolicy ?? DATE_POLICY_REQUIRED\n };\n },\n () => {\n this.props.onChange(this.state, { event: 'handleOnBrand' });\n\n // Enhance data object with the url for the brand image, first checking if the merchant has configured their own one for this brand\n const brandImageUrl = this.props.brandsConfiguration[cardInfo.brand]?.icon ?? getCardImageUrl(cardInfo.brand, this.props.resources);\n this.props.onBrand({ ...cardInfo, brandImageUrl });\n }\n );\n}\n\n/**\n * Handles validation errors\n */\nfunction handleOnError(cbObj: CardErrorData, hasUnsupportedCard: boolean = null): boolean {\n const errorCode = cbObj.error;\n\n this.setState(\n prevState => ({\n errors: { ...prevState.errors, [cbObj.fieldType]: errorCode || false },\n // If dealing with an unsupported card ensure these card number related fields are reset re. pasting a full, unsupported card straight in\n ...(hasUnsupportedCard && { data: { ...prevState.data, [ENCRYPTED_CARD_NUMBER]: undefined } }),\n ...(hasUnsupportedCard && { valid: { ...prevState.valid, [ENCRYPTED_CARD_NUMBER]: false } }),\n ...(hasUnsupportedCard && { isSfpValid: false })\n }),\n () => {\n this.props.onChange(this.state, { event: 'handleOnError', fieldType: cbObj.fieldType });\n }\n );\n\n return true;\n}\n\nfunction handleFocus(cbObj: CardFocusData): void {\n this.numCharsInField[cbObj.fieldType] = cbObj.numChars;\n\n this.props.onFocus(cbObj);\n}\n\nfunction handleOnTouchstartIOS(cbObj): void {\n // disableIOSArrowKeys is either null or a function (in which case we should call it)\n this.props.disableIOSArrowKeys?.(cbObj);\n}\n\n// Only called for holder name (from CSF>partials>processAutoComplete)\nfunction handleOnAutoComplete(cbObj: CardAutoCompleteData): void {\n this.setState({ autoCompleteName: cbObj.value }, () => {\n this.props.onChange(this.state, { event: 'handleOnAutoComplete', fieldType: cbObj.fieldType });\n this.setState({ autoCompleteName: null }); // Nullify ref after sending it (lets shopper edit holder name)\n });\n this.props.onAutoComplete(cbObj);\n}\n\nfunction handleKeyPressed(obj: SFKeyPressObj): void {\n if (obj.action === 'enterKeyPressed') {\n const kb = new KeyboardEvent('keypress', {\n bubbles: true,\n cancelable: true,\n key: 'Enter',\n code: 'Enter'\n });\n this.props.handleKeyPress?.(kb);\n }\n}\n\n/**\n * Handles cases where no secured fields are necessary (one click payments without CVC)\n * Automatically resolves with a valid state\n */\nfunction handleOnNoDataRequired(): void {\n this.setState({ status: 'ready' }, () => this.props.onChange({ isSfpValid: true }));\n}\n\nexport default {\n handleFocus,\n handleOnAllValid,\n handleOnAutoComplete,\n handleOnFieldValid,\n handleOnLoad,\n handleOnConfigSuccess,\n handleOnBrand,\n handleOnError,\n handleOnNoDataRequired,\n handleOnTouchstartIOS,\n handleKeyPressed\n};\n"],"names":["fieldIsInError","fieldType","policy","numCharsObj","errorsObj","OPTIONAL","HIDDEN","handlers","handleFocus","cbObj","this","numCharsInField","numChars","props","onFocus","handleOnAllValid","status","state","detectedUnsupportedBrands","setState","isSfpValid","allValid","onChange","event","onAllValid","handleOnAutoComplete","autoCompleteName","value","onAutoComplete","handleOnFieldValid","fieldObj","ENCRYPTED_CARD_NUMBER","prevState","data","_object_spread_props","_object_spread","encryptedFieldName","blob","valid","errors","onFieldValid","handleOnLoad","clearTimeout","csfLoadFailTimeout","onLoad","csfConfigFailTimeout","setTimeout","onError","AdyenCheckoutError","csfConfigFailTimeoutMS","handleOnConfigSuccess","onConfigSuccess","handleOnBrand","cardInfo","cvcFieldInError","ENCRYPTED_SECURITY_CODE","cvcPolicy","dateFieldInError","numDateFields","ENCRYPTED_EXPIRY_DATE","expiryDatePolicy","monthFieldInError","ENCRYPTED_EXPIRY_MONTH","yearFieldInError","ENCRYPTED_EXPIRY_YEAR","brand","CVC_POLICY_REQUIRED","showSocialSecurityNumber","existy","DATE_POLICY_REQUIRED","_this_props_brandsConfiguration_cardInfo_brand","_this_props_brandsConfiguration_cardInfo_brand_icon","brandImageUrl","brandsConfiguration","icon","getCardImageUrl","resources","onBrand","handleOnError","hasUnsupportedCard","errorCode","error","undefined","handleOnNoDataRequired","handleOnTouchstartIOS","_this_props_disableIOSArrowKeys","_this_props","disableIOSArrowKeys","call","handleKeyPressed","obj","action","_this_props_handleKeyPress","kb","KeyboardEvent","bubbles","cancelable","key","code","handleKeyPress"],"mappings":"ssCA0HA,SAASA,EAAeC,EAAmBC,EAAgBC,EAAqBC,GAC5E,OAAQF,IAAWG,GAAYH,IAAWI,GAAsC,IAA3BH,EAAYF,KAA2BG,EAAUH,EAC1G,CAwHA,IAAAM,EAAe,CACXC,YAzCJ,SAAqBC,GACjBC,KAAKC,gBAAgBF,EAAMR,WAAaQ,EAAMG,SAE9CF,KAAKG,MAAMC,QAAQL,EACvB,EAsCIM,iBA7KJ,SAA0BC,GAEtB,OAAIN,KAAKO,MAAMC,4BAIfR,KAAKS,SAAS,CAAEC,WAAYJ,EAAOK,UAAY,KAE3CX,KAAKG,MAAMS,SAASZ,KAAKO,MAAO,CAAEM,MAAO,qBAEzCb,KAAKG,MAAMW,WAAWR,MAGnB,EACX,EAgKIS,qBA/BJ,SAA8BhB,GAC1BC,KAAKS,SAAS,CAAEO,iBAAkBjB,EAAMkB,OAAS,KAC7CjB,KAAKG,MAAMS,SAASZ,KAAKO,MAAO,CAAEM,MAAO,uBAAwBtB,UAAWQ,EAAMR,YAClFS,KAAKS,SAAS,CAAEO,iBAAkB,SAEtChB,KAAKG,MAAMe,eAAenB,EAC9B,EA0BIoB,mBA3JJ,SAA4BC,GAExB,QAAIpB,KAAKO,MAAMC,2BAA6BY,EAAS7B,YAAc8B,KAiBnErB,KAAKS,SAbsBa,IAU8BA,IAAAA,EAVhB,MAAA,CACrCC,KAAMC,EAAAC,EAAA,CAAA,EAAKH,EAAUC,MAAI,CAAE,CAACH,EAASM,oBAAqBN,EAASO,OACnEC,MAAOJ,EAAAC,EAAA,CAAA,EAAKH,EAAUM,OAAK,CAAE,CAACR,EAASM,oBAA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ACX,EAmDIkF,uBAbJ,WACIzE,KAAKS,SAAS,CAAEH,OAAQ,SAAW,IAAMN,KAAKG,MAAMS,SAAS,CAAEF,YAAY,IAC/E,EAYIgE,sBA5CJ,SAA+B3E,OAE3B4E,EAAAC,EAA8B,QAA9BD,GAAAC,EAAA5E,KAAKG,OAAM0E,2BAAX,IAAAF,GAAAA,EAAAG,KAAAF,EAAiC7E,EACrC,EA0CIgF,iBA/BJ,SAA0BC,GACtB,GAAmB,oBAAfA,EAAIC,OAA8B,KAOlCC,EAAAN,EANA,MAAMO,EAAK,IAAIC,cAAc,WAAY,CACrCC,SAAS,EACTC,YAAY,EACZC,IAAK,QACLC,KAAM,UAEe,QAAzBN,GAAAN,EAAA5E,KAAKG,OAAMsF,sBAAX,IAAAP,GAAAA,EAAAJ,KAAAF,EAA4BO,EAChC,CACJ"}
1
+ {"version":3,"file":"SecuredFieldsProviderHandlers.js","sources":["../../../../../../src/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.ts"],"sourcesContent":["import { getCardImageUrl } from '../utils';\nimport {\n ENCRYPTED_SECURITY_CODE,\n ENCRYPTED_CARD_NUMBER,\n CVC_POLICY_REQUIRED,\n DATE_POLICY_REQUIRED,\n ENCRYPTED_EXPIRY_DATE,\n OPTIONAL,\n HIDDEN,\n ENCRYPTED_EXPIRY_MONTH,\n ENCRYPTED_EXPIRY_YEAR\n} from '../lib/constants';\nimport {\n CardErrorData,\n CardFocusData,\n CardBrandData,\n CardAllValidData,\n CardFieldValidData,\n CardAutoCompleteData,\n CardConfigSuccessData,\n CardLoadData,\n SFKeyPressObj\n} from '../lib/types';\nimport { existy } from '../../../../utils/commonUtils';\nimport AdyenCheckoutError from '../../../../core/Errors/AdyenCheckoutError';\n\n/**\n * Emits the onLoad event\n * Here we can assume all securedFields iframes have fired their 'load' event\n */\nfunction handleOnLoad(cbObj: CardLoadData): void {\n // Clear 'loading' timeout\n clearTimeout(this.csfLoadFailTimeout);\n this.csfLoadFailTimeout = null;\n\n // Propagate onLoad event\n this.props.onLoad(cbObj);\n\n /**\n * Having seen that the securedFields iframes have loaded some kind of content (we don't know what, yet)\n * - setTimeout since we expect to get a successful configuration message \"within a reasonable time\"\n *\n * Now we catch clientKey & environment mismatch in core.ts - this timeout being called indicates that the securedFields have not all configured\n * - so we need to clear the loading spinner to see if the securedFields are reporting anything\n */\n this.csfConfigFailTimeout = setTimeout(() => {\n if (this.state.status !== 'ready') {\n // Hide the spinner\n this.setState({ status: 'csfConfigFailure' });\n // Report the error\n this.props.onError(new AdyenCheckoutError('ERROR', 'secured fields have failed to configure'));\n }\n }, this.csfConfigFailTimeoutMS);\n}\n\n/**\n * Emits the onConfigSuccess (ready) event\n * Here we can assume CSF is loaded, configured and ready to be used\n */\nfunction handleOnConfigSuccess(cbObj: CardConfigSuccessData): void {\n // Clear 'config' timeout\n clearTimeout(this.csfConfigFailTimeout);\n this.csfConfigFailTimeout = null;\n\n this.setState({ status: 'ready' }, () => {\n // Propagate onConfigSuccess event\n this.props.onConfigSuccess(cbObj);\n });\n}\n\n/**\n * Emits the onAllValid event\n */\nfunction handleOnAllValid(status: CardAllValidData): boolean {\n // Form cannot be valid whilst there is an unsupported card\n if (this.state.detectedUnsupportedBrands) {\n return false;\n }\n\n this.setState({ isSfpValid: status.allValid }, () => {\n // New - fixes maestro-with-error-on-optional-cvc-field bug\n this.props.onChange(this.state, { event: 'handleOnAllValid' });\n // Propagate onAllValid event\n this.props.onAllValid(status);\n });\n\n return true;\n}\n\n/**\n * Saves a field value from CSF in the CardInput state\n * Emits the onFieldValid event\n */\nfunction handleOnFieldValid(fieldObj: CardFieldValidData): boolean {\n // A card number field cannot be valid whilst there is an unsupported card\n if (this.state.detectedUnsupportedBrands && fieldObj.fieldType === ENCRYPTED_CARD_NUMBER) {\n return false;\n }\n\n const setValidFieldState = prevState => ({\n data: { ...prevState.data, [fieldObj.encryptedFieldName]: fieldObj.blob },\n valid: { ...prevState.valid, [fieldObj.encryptedFieldName]: fieldObj.valid },\n /**\n * For a field that has just received valid:true (field has just been completed & encrypted) - mark the error state for this field as false\n * For a field that has just received valid:false (field was encrypted, now is not)\n * - field is either in a state of being incomplete but without errors (digit deleted) - so mark the error state for this field as false\n * or has switched from valid/encrypted state to being in error (digit edited to one that puts the field in error) - so keep any error that\n * might just have been set\n */\n errors: { ...prevState.errors, [fieldObj.fieldType]: prevState.errors[fieldObj.fieldType] ?? false }\n });\n\n this.setState(setValidFieldState, () => {\n this.props.onChange(this.state, { event: 'handleOnFieldValid', fieldType: fieldObj.fieldType });\n\n // Propagate onFieldValid event\n this.props.onFieldValid(fieldObj);\n });\n\n return true;\n}\n\nfunction fieldIsInError(fieldType: string, policy: string, numCharsObj: object, errorsObj) {\n return (policy === OPTIONAL || policy === HIDDEN) && numCharsObj[fieldType] === 0 ? false : errorsObj[fieldType];\n}\n\n/**\n * Saves the card brand in state\n * Emits the onBrand event\n */\nfunction handleOnBrand(cardInfo: CardBrandData): void {\n this.setState(\n prevState => {\n /**\n * If we change brand to one where the cvc or date field(s) are not required & are empty - then these fields cannot be in error\n * (scenario: have validated empty form, then choose brand w. optional/hidden cvc or date)...\n * ...else propagate the existing error.\n */\n const cvcFieldInError = fieldIsInError(ENCRYPTED_SECURITY_CODE, cardInfo.cvcPolicy, this.numCharsInField, prevState.errors);\n\n const dateFieldInError =\n this.numDateFields === 1\n ? fieldIsInError(ENCRYPTED_EXPIRY_DATE, cardInfo.expiryDatePolicy, this.numCharsInField, prevState.errors)\n : null;\n\n // For custom card comp\n const monthFieldInError =\n this.numDateFields === 2\n ? fieldIsInError(ENCRYPTED_EXPIRY_MONTH, cardInfo.expiryDatePolicy, this.numCharsInField, prevState.errors)\n : null;\n\n const yearFieldInError =\n this.numDateFields === 2\n ? fieldIsInError(ENCRYPTED_EXPIRY_YEAR, cardInfo.expiryDatePolicy, this.numCharsInField, prevState.errors)\n : null;\n // --\n /** end */\n\n return {\n brand: cardInfo.brand,\n cvcPolicy: cardInfo.cvcPolicy ?? CVC_POLICY_REQUIRED,\n showSocialSecurityNumber: cardInfo.showSocialSecurityNumber,\n errors: {\n ...prevState.errors,\n ...(existy(cvcFieldInError) && { [ENCRYPTED_SECURITY_CODE]: cvcFieldInError }),\n ...(existy(dateFieldInError) && { [ENCRYPTED_EXPIRY_DATE]: dateFieldInError }),\n ...(existy(monthFieldInError) && { [ENCRYPTED_EXPIRY_MONTH]: monthFieldInError }),\n ...(existy(yearFieldInError) && { [ENCRYPTED_EXPIRY_YEAR]: yearFieldInError })\n },\n expiryDatePolicy: cardInfo.expiryDatePolicy ?? DATE_POLICY_REQUIRED\n };\n },\n () => {\n this.props.onChange(this.state, { event: 'handleOnBrand' });\n\n // Enhance data object with the url for the brand image, first checking if the merchant has configured their own one for this brand\n const brandImageUrl = this.props.brandsConfiguration[cardInfo.brand]?.icon ?? getCardImageUrl(cardInfo.brand, this.props.resources);\n this.props.onBrand({ ...cardInfo, brandImageUrl });\n }\n );\n}\n\n/**\n * Handles validation errors\n */\nfunction handleOnError(cbObj: CardErrorData, hasUnsupportedCard: boolean = null): boolean {\n const errorCode = cbObj.error;\n\n this.setState(\n prevState => ({\n errors: { ...prevState.errors, [cbObj.fieldType]: errorCode || false },\n // If dealing with an unsupported card ensure these card number related fields are reset re. pasting a full, unsupported card straight in\n ...(hasUnsupportedCard && { data: { ...prevState.data, [ENCRYPTED_CARD_NUMBER]: undefined } }),\n ...(hasUnsupportedCard && { valid: { ...prevState.valid, [ENCRYPTED_CARD_NUMBER]: false } }),\n ...(hasUnsupportedCard && { isSfpValid: false })\n }),\n () => {\n this.props.onChange(this.state, { event: 'handleOnError', fieldType: cbObj.fieldType });\n }\n );\n\n return true;\n}\n\nfunction handleFocus(cbObj: CardFocusData): void {\n this.numCharsInField[cbObj.fieldType] = cbObj.numChars;\n\n this.props.onFocus(cbObj);\n}\n\nfunction handleOnTouchstartIOS(cbObj): void {\n // disableIOSArrowKeys is either null or a function (in which case we should call it)\n this.props.disableIOSArrowKeys?.(cbObj);\n}\n\n// Only called for holder name (from CSF>partials>processAutoComplete)\nfunction handleOnAutoComplete(cbObj: CardAutoCompleteData): void {\n this.setState({ autoCompleteName: cbObj.value }, () => {\n this.props.onChange(this.state, { event: 'handleOnAutoComplete', fieldType: cbObj.fieldType });\n this.setState({ autoCompleteName: null }); // Nullify ref after sending it (lets shopper edit holder name)\n });\n this.props.onAutoComplete(cbObj);\n}\n\nfunction handleKeyPressed(obj: SFKeyPressObj): void {\n if (obj.action === 'enterKeyPressed') {\n const kb = new KeyboardEvent('keypress', {\n bubbles: true,\n cancelable: true,\n key: 'Enter',\n code: 'Enter'\n });\n this.props.handleKeyPress?.(kb);\n }\n}\n\n/**\n * Handles cases where no secured fields are necessary (one click payments without CVC)\n * Automatically resolves with a valid state\n */\nfunction handleOnNoDataRequired(): void {\n this.setState({ status: 'ready' }, () => this.props.onChange({ isSfpValid: true }));\n}\n\nexport default {\n handleFocus,\n handleOnAllValid,\n handleOnAutoComplete,\n handleOnFieldValid,\n handleOnLoad,\n handleOnConfigSuccess,\n handleOnBrand,\n handleOnError,\n handleOnNoDataRequired,\n handleOnTouchstartIOS,\n handleKeyPressed\n};\n"],"names":["fieldIsInError","fieldType","policy","numCharsObj","errorsObj","OPTIONAL","HIDDEN","handlers","handleFocus","cbObj","this","numCharsInField","numChars","props","onFocus","handleOnAllValid","status","state","detectedUnsupportedBrands","setState","isSfpValid","allValid","onChange","event","onAllValid","handleOnAutoComplete","autoCompleteName","value","onAutoComplete","handleOnFieldValid","fieldObj","ENCRYPTED_CARD_NUMBER","prevState","data","_object_spread_props","_object_spread","encryptedFieldName","blob","valid","errors","onFieldValid","handleOnLoad","clearTimeout","csfLoadFailTimeout","onLoad","csfConfigFailTimeout","setTimeout","onError","AdyenCheckoutError","csfConfigFailTimeoutMS","handleOnConfigSuccess","onConfigSuccess","handleOnBrand","cardInfo","cvcFieldInError","ENCRYPTED_SECURITY_CODE","cvcPolicy","dateFieldInError","numDateFields","ENCRYPTED_EXPIRY_DATE","expiryDatePolicy","monthFieldInError","ENCRYPTED_EXPIRY_MONTH","yearFieldInError","ENCRYPTED_EXPIRY_YEAR","brand","CVC_POLICY_REQUIRED","showSocialSecurityNumber","existy","DATE_POLICY_REQUIRED","_this_props_brandsConfiguration_cardInfo_brand","brandImageUrl","brandsConfiguration","icon","_ref","getCardImageUrl","resources","onBrand","handleOnError","hasUnsupportedCard","errorCode","error","undefined","handleOnNoDataRequired","handleOnTouchstartIOS","_this_props_disableIOSArrowKeys","_this_props","disableIOSArrowKeys","call","handleKeyPressed","obj","action","_this_props_handleKeyPress","kb","KeyboardEvent","bubbles","cancelable","key","code","handleKeyPress"],"mappings":"ssCA0HA,SAASA,EAAeC,EAAmBC,EAAgBC,EAAqBC,GAC5E,OAAQF,IAAWG,GAAYH,IAAWI,GAAsC,IAA3BH,EAAYF,KAA2BG,EAAUH,EAC1G,CAwHA,IAAAM,EAAe,CACXC,YAzCJ,SAAqBC,GACjBC,KAAKC,gBAAgBF,EAAMR,WAAaQ,EAAMG,SAE9CF,KAAKG,MAAMC,QAAQL,EACvB,EAsCIM,iBA7KJ,SAA0BC,GAEtB,OAAIN,KAAKO,MAAMC,4BAIfR,KAAKS,SAAS,CAAEC,WAAYJ,EAAOK,UAAY,KAE3CX,KAAKG,MAAMS,SAASZ,KAAKO,MAAO,CAAEM,MAAO,qBAEzCb,KAAKG,MAAMW,WAAWR,MAGnB,EACX,EAgKIS,qBA/BJ,SAA8BhB,GAC1BC,KAAKS,SAAS,CAAEO,iBAAkBjB,EAAMkB,OAAS,KAC7CjB,KAAKG,MAAMS,SAASZ,KAAKO,MAAO,CAAEM,MAAO,uBAAwBtB,UAAWQ,EAAMR,YAClFS,KAAKS,SAAS,CAAEO,iBAAkB,SAEtChB,KAAKG,MAAMe,eAAenB,EAC9B,EA0BIoB,mBA3JJ,SAA4BC,GAExB,QAAIpB,KAAKO,MAAMC,2BAA6BY,EAAS7B,YAAc8B,KAiBnErB,KAAKS,SAbsBa,IAU8BA,IAAAA,EAVhB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AK,CAAEP,CAACA,IAAwB,KAC9EgD,GAAsB,CAAE3D,YAAY,IAE5C,KACIV,KAAKG,MAAMS,SAASZ,KAAKO,MAAO,CAAEM,MAAO,gBAAiBtB,UAAWQ,EAAMR,eAI5E,CACX,EAmDIkF,uBAbJ,WACIzE,KAAKS,SAAS,CAAEH,OAAQ,SAAW,IAAMN,KAAKG,MAAMS,SAAS,CAAEF,YAAY,IAC/E,EAYIgE,sBA5CJ,SAA+B3E,OAE3B4E,EAAAC,EAA8B,QAA9BD,GAAAC,EAAA5E,KAAKG,OAAM0E,2BAAX,IAAAF,GAAAA,EAAAG,KAAAF,EAAiC7E,EACrC,EA0CIgF,iBA/BJ,SAA0BC,GACtB,GAAmB,oBAAfA,EAAIC,OAA8B,KAOlCC,EAAAN,EANA,MAAMO,EAAK,IAAIC,cAAc,WAAY,CACrCC,SAAS,EACTC,YAAY,EACZC,IAAK,QACLC,KAAM,UAEe,QAAzBN,GAAAN,EAAA5E,KAAKG,OAAMsF,sBAAX,IAAAP,GAAAA,EAAAJ,KAAAF,EAA4BO,EAChC,CACJ"}
@@ -1,2 +1,2 @@
1
- import{select as e,getAttribute as t}from"../../utilities/dom.js";import{DATA_ENCRYPTED_FIELD_ATTR as i,ALL_SECURED_FIELDS as o,CVC_POLICY_REQUIRED as s,DATE_POLICY_REQUIRED as r,ENCRYPTED_EXPIRY_YEAR as n,SF_CONFIG_TIMEOUT as a,DATA_UID as d,DATA_INFO as l}from"../../constants.js";import{existy as c}from"../../../../../../utils/commonUtils.js";import h from"../utils/cardType.js";import u from"../../securedField/SecuredField.js";import p from"../../../../../../core/Errors/AdyenCheckoutError.js";function f(e,t){if(null==e)return{};var i,o,s=function(e,t){if(null==e)return{};var i,o,s={},r=Object.keys(e);for(o=0;o<r.length;o++)i=r[o],t.indexOf(i)>=0||(s[i]=e[i]);return s}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)i=r[o],t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(s[i]=e[i])}return s}function m(){this.encryptedAttrName=i;const n=e(this.props.rootNode,`[${this.encryptedAttrName}]`).filter(e=>{const i=t(e,this.encryptedAttrName),s=o.includes(i);return s||console.warn(`WARNING: '${i}' is not a valid type for the '${this.encryptedAttrName}' attribute. A SecuredField will not be created for this element.`),s}),a=s,d=r;return this.config.isCreditCardType?(this.isSingleBrandedCard=!1,this.securityCode="",this.createCardSecuredFields(n,a,d),n.length):(this.createNonCardSecuredFields(n),n.length)}async function y(e){for(let t=0;t<e.length;t++){const i=e[t];await this.setupSecuredField(i).catch(e=>{window._b$dl&&console.log("Secured fields setup failure. e=",e)})}}async function g(e,t,i){let o=this.state.type;if("card"===o&&1===this.config.cardGroupTypes.length&&(o=this.config.cardGroupTypes[0],this.state.type=o),this.isSingleBrandedCard="card"!==o,this.isSingleBrandedCard){const e=h.getCardByBrand(o);c(e)?(t=e.cvcPolicy||s,i=e.expiryDatePolicy||r,this.securityCode=e.securityCode):this.state.type="unrecognised-single-brand"}for(let o=0;o<e.length;o++){const s=e[o];window._b$dl&&console.log("\nAbout to set up securedField:",s),await this.setupSecuredField(s,t,i).catch(e=>{window._b$dl&&console.log("Secured fields setup failure. e=",e)}),window._b$dl&&console.log("Finished setting up securedField:",s)}if(window._b$dl&&console.log("Finished setting up all securedFields"),this.isSingleBrandedCard){const e={type:this.state.type,rootNode:this.props.rootNode,brand:o,cvcPolicy:t,expiryDatePolicy:i,cvcText:this.securityCode};setTimeout(()=>{this.callbacks.onBrand(e)},0)}}function C(e,i,o){return new Promise((s,r)=>{const c=t(e,this.encryptedAttrName);c===n&&(this.state.hasSeparateDateFields=!0);const h={fieldType:c,extraFieldData:t(e,l),uid:t(e,d),cvcPolicy:i,holderEl:e,expiryDatePolicy:o,txVariant:this.state.type,cardGroupTypes:this.config.cardGroupTypes,iframeUIConfig:this.config.iframeUIConfig,sfLogAtStart:this.config.sfLogAtStart,trimTrailingSeparator:this.config.trimTrailingSeparator,isCreditCardType:this.config.isCreditCardType,iframeSrc:this.config.iframeSrc,loadingContext:this.config.loadingContext,showWarnings:this.config.showWarnings,legacyInputMode:this.config.legacyInputMode,minimumExpiryDate:this.config.minimumExpiryDate,maskSecurityCode:this.props.maskSecurityCode,exposeExpiryDate:this.props.exposeExpiryDate,disableIOSArrowKeys:this.props.shouldDisableIOSArrowKeys,implementationType:this.props.implementationType,showContextualElement:this.props.showContextualElement,placeholders:this.props.placeholders},m=new u(h,this.props.i18n).onIframeLoaded(()=>{if(this.state.iframeCount+=1,window._b$dl&&console.log("### createSecuredFields::onIframeLoaded:: this.state.iframeCount=",this.state.iframeCount),this.state.iframeCount>this.state.numIframes)throw this.destroySecuredFields(),new p("ERROR",`One or more securedFields has just loaded new content. This should never happen. securedFields have been removed.\n iframe load count=${this.state.iframeCount}. Expected count:${this.state.numIframes}`);if(m.loadToConfigTimeout=setTimeout(()=>{r({type:h.fieldType,failReason:"sf took too long to config"})},a),this.state.iframeCount===this.state.originalNumIframes){const e={iframesLoaded:!0};this.callbacks.onLoad(e)}}).onConfig(e=>{this.handleIframeConfigFeedback(e),clearTimeout(m.loadToConfigTimeout),m.loadToConfigTimeout=null,s(e)}).onFocus(e=>{this.handleFocus(e)}).onBinValue(e=>{this.handleBinValue(e)}).onTouchstart(e=>{this.props.shouldDisableIOSArrowKeys&&(this.hasGenuineTouchEvents||e.hasGenuineTouchEvents)&&this.callbacks.onTouchstartIOS({fieldType:e.fieldType}),(e.hasGenuineTouchEvents||this.hasGenuineTouchEvents)&&this.postMessageToAllIframes({fieldType:e.fieldType,fieldClick:!0})}).onShiftTab(e=>{this.handleSFShiftTab(e.fieldType)}).onEncryption(e=>{this.handleEncryption(e)}).onValidation(e=>{this.handleValidation(e)}).onAutoComplete(e=>{this.processAutoComplete(e)}).onKeyPressed(e=>{const{numKey:t}=e,i=f(e,["numKey"]);this.callbacks.onKeyPressed(i)});this.state.securedFields[c]=m})}export{g as createCardSecuredFields,y as createNonCardSecuredFields,m as createSecuredFields,C as setupSecuredField};
1
+ import{select as e,getAttribute as t}from"../../utilities/dom.js";import{DATA_ENCRYPTED_FIELD_ATTR as i,ALL_SECURED_FIELDS as o,CVC_POLICY_REQUIRED as s,DATE_POLICY_REQUIRED as r,ENCRYPTED_EXPIRY_YEAR as n,SF_CONFIG_TIMEOUT as a,DATA_UID as l,DATA_INFO as d}from"../../constants.js";import{existy as c}from"../../../../../../utils/commonUtils.js";import h from"../utils/cardType.js";import p from"../../securedField/SecuredField.js";import u from"../../../../../../core/Errors/AdyenCheckoutError.js";function f(e,t){if(null==e)return{};var i,o,s,r={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(i=Reflect.ownKeys(e),s=0;s<i.length;s++)o=i[s],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o]);return r}if(r=function(e,t){if(null==e)return{};var i,o,s={},r=Object.getOwnPropertyNames(e);for(o=0;o<r.length;o++)i=r[o],t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(s[i]=e[i]);return s}(e,t),Object.getOwnPropertySymbols)for(i=Object.getOwnPropertySymbols(e),s=0;s<i.length;s++)o=i[s],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o]);return r}function y(){this.encryptedAttrName=i;const n=e(this.props.rootNode,`[${this.encryptedAttrName}]`).filter(e=>{const i=t(e,this.encryptedAttrName),s=o.includes(i);return s||console.warn(`WARNING: '${i}' is not a valid type for the '${this.encryptedAttrName}' attribute. A SecuredField will not be created for this element.`),s}),a=s,l=r;return this.config.isCreditCardType?(this.isSingleBrandedCard=!1,this.securityCode="",this.createCardSecuredFields(n,a,l),n.length):(this.createNonCardSecuredFields(n),n.length)}async function m(e){for(let t=0;t<e.length;t++){const i=e[t];await this.setupSecuredField(i).catch(e=>{window._b$dl&&console.log("Secured fields setup failure. e=",e)})}}async function g(e,t,i){let o=this.state.type;if("card"===o&&1===this.config.cardGroupTypes.length&&(o=this.config.cardGroupTypes[0],this.state.type=o),this.isSingleBrandedCard="card"!==o,this.isSingleBrandedCard){const e=h.getCardByBrand(o);c(e)?(t=e.cvcPolicy||s,i=e.expiryDatePolicy||r,this.securityCode=e.securityCode):this.state.type="unrecognised-single-brand"}for(let o=0;o<e.length;o++){const s=e[o];window._b$dl&&console.log("\nAbout to set up securedField:",s),await this.setupSecuredField(s,t,i).catch(e=>{window._b$dl&&console.log("Secured fields setup failure. e=",e)}),window._b$dl&&console.log("Finished setting up securedField:",s)}if(window._b$dl&&console.log("Finished setting up all securedFields"),this.isSingleBrandedCard){const e={type:this.state.type,rootNode:this.props.rootNode,brand:o,cvcPolicy:t,expiryDatePolicy:i,cvcText:this.securityCode};setTimeout(()=>{this.callbacks.onBrand(e)},0)}}function C(e,i,o){return new Promise((s,r)=>{const c=t(e,this.encryptedAttrName);c===n&&(this.state.hasSeparateDateFields=!0);const h={fieldType:c,extraFieldData:t(e,d),uid:t(e,l),cvcPolicy:i,holderEl:e,expiryDatePolicy:o,txVariant:this.state.type,cardGroupTypes:this.config.cardGroupTypes,iframeUIConfig:this.config.iframeUIConfig,sfLogAtStart:this.config.sfLogAtStart,trimTrailingSeparator:this.config.trimTrailingSeparator,isCreditCardType:this.config.isCreditCardType,iframeSrc:this.config.iframeSrc,loadingContext:this.config.loadingContext,showWarnings:this.config.showWarnings,legacyInputMode:this.config.legacyInputMode,minimumExpiryDate:this.config.minimumExpiryDate,maskSecurityCode:this.props.maskSecurityCode,exposeExpiryDate:this.props.exposeExpiryDate,disableIOSArrowKeys:this.props.shouldDisableIOSArrowKeys,implementationType:this.props.implementationType,showContextualElement:this.props.showContextualElement,placeholders:this.props.placeholders},y=new p(h,this.props.i18n).onIframeLoaded(()=>{if(this.state.iframeCount+=1,window._b$dl&&console.log("### createSecuredFields::onIframeLoaded:: this.state.iframeCount=",this.state.iframeCount),this.state.iframeCount>this.state.numIframes)throw this.destroySecuredFields(),new u("ERROR",`One or more securedFields has just loaded new content. This should never happen. securedFields have been removed.\n iframe load count=${this.state.iframeCount}. Expected count:${this.state.numIframes}`);if(y.loadToConfigTimeout=setTimeout(()=>{r({type:h.fieldType,failReason:"sf took too long to config"})},a),this.state.iframeCount===this.state.originalNumIframes){const e={iframesLoaded:!0};this.callbacks.onLoad(e)}}).onConfig(e=>{this.handleIframeConfigFeedback(e),clearTimeout(y.loadToConfigTimeout),y.loadToConfigTimeout=null,s(e)}).onFocus(e=>{this.handleFocus(e)}).onBinValue(e=>{this.handleBinValue(e)}).onTouchstart(e=>{this.props.shouldDisableIOSArrowKeys&&(this.hasGenuineTouchEvents||e.hasGenuineTouchEvents)&&this.callbacks.onTouchstartIOS({fieldType:e.fieldType}),(e.hasGenuineTouchEvents||this.hasGenuineTouchEvents)&&this.postMessageToAllIframes({fieldType:e.fieldType,fieldClick:!0})}).onShiftTab(e=>{this.handleSFShiftTab(e.fieldType)}).onEncryption(e=>{this.handleEncryption(e)}).onValidation(e=>{this.handleValidation(e)}).onAutoComplete(e=>{this.processAutoComplete(e)}).onKeyPressed(e=>{const{numKey:t}=e,i=f(e,["numKey"]);this.callbacks.onKeyPressed(i)});this.state.securedFields[c]=y})}export{g as createCardSecuredFields,m as createNonCardSecuredFields,y as createSecuredFields,C as setupSecuredField};
2
2
  //# sourceMappingURL=createSecuredFields.js.map