@adyen/adyen-web 6.0.0-alpha.0 → 6.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +166 -0
- package/auto/auto.js +2 -0
- package/dist/cjs/adyen.css +3 -3
- package/dist/cjs/index.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +2414 -2537
- package/dist/es/adyen.css +3 -3
- package/dist/es/components/AmazonPay/AmazonPay.js +1 -1
- package/dist/es/components/AmazonPay/AmazonPay.js.map +1 -1
- package/dist/es/components/AmazonPay/components/AmazonPayComponent.js +1 -1
- package/dist/es/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
- package/dist/es/components/ApplePay/ApplePay.js +1 -1
- package/dist/es/components/ApplePay/ApplePay.js.map +1 -1
- package/dist/es/components/ApplePay/defaultProps.js +1 -1
- package/dist/es/components/ApplePay/defaultProps.js.map +1 -1
- package/dist/es/components/ApplePay/payment-request.js.map +1 -1
- package/dist/es/components/Boleto/components/BoletoInput/validate.js +1 -1
- package/dist/es/components/Boleto/components/BoletoInput/validate.js.map +1 -1
- package/dist/es/components/Card/Card.js +1 -1
- package/dist/es/components/Card/Card.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/CardInput.js +1 -1
- package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/CardHolderName.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/CardHolderName.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/KCPAuthentication.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/KCPAuthentication.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/utils.js +1 -1
- package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/validate.js +1 -1
- package/dist/es/components/Card/components/CardInput/validate.js.map +1 -1
- package/dist/es/components/CashAppPay/defaultProps.js +1 -1
- package/dist/es/components/CashAppPay/defaultProps.js.map +1 -1
- package/dist/es/components/Donation/Donation.js.map +1 -1
- package/dist/es/components/Dragonpay/Dragonpay.js +1 -1
- package/dist/es/components/Dragonpay/Dragonpay.js.map +1 -1
- package/dist/es/components/Dropin/Dropin.js +1 -1
- package/dist/es/components/Dropin/Dropin.js.map +1 -1
- package/dist/es/components/Dropin/components/DropinComponent.js +1 -1
- package/dist/es/components/Dropin/components/DropinComponent.js.map +1 -1
- package/dist/es/components/Dropin/defaultProps.js +1 -1
- package/dist/es/components/Dropin/defaultProps.js.map +1 -1
- package/dist/es/components/Econtext/Econtext.js +1 -1
- package/dist/es/components/Econtext/Econtext.js.map +1 -1
- package/dist/es/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
- package/dist/es/components/Giftcard/Giftcard.js +1 -1
- package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
- package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
- package/dist/es/components/Giropay/Giropay.js +1 -1
- package/dist/es/components/Giropay/Giropay.js.map +1 -1
- package/dist/es/components/GooglePay/GooglePay.js +1 -1
- package/dist/es/components/GooglePay/GooglePay.js.map +1 -1
- package/dist/es/components/GooglePay/GooglePayService.js +1 -1
- package/dist/es/components/GooglePay/GooglePayService.js.map +1 -1
- package/dist/es/components/GooglePay/defaultProps.js +1 -1
- package/dist/es/components/GooglePay/defaultProps.js.map +1 -1
- package/dist/es/components/GooglePay/requests.js.map +1 -1
- package/dist/es/components/Multibanco/Multibanco.js +1 -1
- package/dist/es/components/Multibanco/Multibanco.js.map +1 -1
- package/dist/es/components/PayPal/Paypal.js +1 -1
- package/dist/es/components/PayPal/Paypal.js.map +1 -1
- package/dist/es/components/PayPal/components/PaypalButtons.js +1 -1
- package/dist/es/components/PayPal/components/PaypalButtons.js.map +1 -1
- package/dist/es/components/PayPal/components/PaypalComponent.js +1 -1
- package/dist/es/components/PayPal/components/PaypalComponent.js.map +1 -1
- package/dist/es/components/PayPal/defaultProps.js +1 -1
- package/dist/es/components/PayPal/defaultProps.js.map +1 -1
- package/dist/es/components/PayPal/utils/format-paypal-order-contact-to-adyen-format.js +1 -1
- package/dist/es/components/PayPal/utils/format-paypal-order-contact-to-adyen-format.js.map +1 -1
- package/dist/es/components/PayPal/utils/get-paypal-locale.js +2 -0
- package/dist/es/components/PayPal/utils/get-paypal-locale.js.map +1 -0
- package/dist/es/components/PayPal/utils/get-paypal-settings.js +2 -0
- package/dist/es/components/PayPal/utils/get-paypal-settings.js.map +1 -0
- package/dist/es/components/PayPal/utils/get-paypal-styles.js +2 -0
- package/dist/es/components/PayPal/utils/get-paypal-styles.js.map +1 -0
- package/dist/es/components/PayPal/utils/get-paypal-url.js +2 -0
- package/dist/es/components/PayPal/utils/get-paypal-url.js.map +1 -0
- package/dist/es/components/Pix/Pix.js +1 -1
- package/dist/es/components/Pix/Pix.js.map +1 -1
- package/dist/es/components/Pix/PixInput/PixInput.js +1 -1
- package/dist/es/components/Pix/PixInput/PixInput.js.map +1 -1
- package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js +1 -1
- package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
- package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js +1 -1
- package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
- package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
- package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
- package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
- package/dist/es/components/ThreeDS2/components/utils.js +1 -1
- package/dist/es/components/ThreeDS2/components/utils.js.map +1 -1
- package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
- package/dist/es/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
- package/dist/es/components/internal/Address/Address.js +1 -1
- package/dist/es/components/internal/Address/Address.js.map +1 -1
- package/dist/es/components/internal/Address/validate.js +1 -1
- package/dist/es/components/internal/Address/validate.js.map +1 -1
- package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
- package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
- package/dist/es/components/internal/CompanyDetails/validate.js +1 -1
- package/dist/es/components/internal/CompanyDetails/validate.js.map +1 -1
- package/dist/es/components/internal/IbanInput/IbanInput.js.map +1 -1
- package/dist/es/components/internal/Img/Img.js +1 -1
- package/dist/es/components/internal/Img/Img.js.map +1 -1
- package/dist/es/components/internal/PersonalDetails/PersonalDetails.js +1 -1
- package/dist/es/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
- package/dist/es/components/internal/PersonalDetails/validate.js +1 -1
- package/dist/es/components/internal/PersonalDetails/validate.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/SFPUtils.js +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/SFPUtils.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/binLookup/triggerBinLookUp.js +1 -1
- package/dist/es/components/internal/SecuredFields/binLookup/triggerBinLookUp.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/utils/cardType.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/utils/cardType.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/utils/processErrors.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/utils/processErrors.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/configuration/constants.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/configuration/constants.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/utils/processAriaConfig.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/utils/processPlaceholders.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/utilities/addContextTranslations.js.map +1 -1
- package/dist/es/components/internal/SegmentedControl/SegmentedControl.js +1 -1
- package/dist/es/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/es/components/internal/UIElement/UIElement.js +1 -1
- package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
- package/dist/es/components/internal/UIElement/utils.js +1 -1
- package/dist/es/components/internal/UIElement/utils.js.map +1 -1
- package/dist/es/core/AdyenCheckout.js +1 -1
- package/dist/es/core/AdyenCheckout.js.map +1 -1
- package/dist/es/core/Analytics/Analytics.js +1 -1
- package/dist/es/core/Analytics/Analytics.js.map +1 -1
- package/dist/es/core/Analytics/EventsQueue.js +1 -1
- package/dist/es/core/Analytics/EventsQueue.js.map +1 -1
- package/dist/es/core/Analytics/constants.js +1 -1
- package/dist/es/core/Analytics/constants.js.map +1 -1
- package/dist/es/core/Analytics/utils.js +1 -1
- package/dist/es/core/Analytics/utils.js.map +1 -1
- package/dist/es/core/Errors/AdyenCheckoutError.js +1 -1
- package/dist/es/core/Errors/AdyenCheckoutError.js.map +1 -1
- package/dist/es/core/Errors/constants.js +1 -1
- package/dist/es/core/Errors/constants.js.map +1 -1
- package/dist/es/core/Errors/utils.js +1 -1
- package/dist/es/core/Errors/utils.js.map +1 -1
- package/dist/es/core/ProcessResponse/PaymentAction/actionTypes.js +1 -1
- package/dist/es/core/ProcessResponse/PaymentAction/actionTypes.js.map +1 -1
- package/dist/es/core/Services/analytics/collect-id.js +1 -1
- package/dist/es/core/Services/analytics/collect-id.js.map +1 -1
- package/dist/es/core/Services/analytics/log-event.js +1 -1
- package/dist/es/core/config.js +1 -1
- package/dist/es/core/config.js.map +1 -1
- package/dist/es/core/core.js +1 -1
- package/dist/es/core/core.js.map +1 -1
- package/dist/es/core/utils.js +1 -1
- package/dist/es/core/utils.js.map +1 -1
- package/dist/es/index.d.ts +2414 -2537
- package/dist/es/language/locales/ar.json.js +1 -1
- package/dist/es/language/locales/cs-CZ.json.js +1 -1
- package/dist/es/language/locales/da-DK.json.js +1 -1
- package/dist/es/language/locales/de-DE.json.js +1 -1
- package/dist/es/language/locales/el-GR.json.js +1 -1
- package/dist/es/language/locales/en-US.json.js +1 -1
- package/dist/es/language/locales/es-ES.json.js +1 -1
- package/dist/es/language/locales/fi-FI.json.js +1 -1
- package/dist/es/language/locales/fr-FR.json.js +1 -1
- package/dist/es/language/locales/hr-HR.json.js +1 -1
- package/dist/es/language/locales/hu-HU.json.js +1 -1
- package/dist/es/language/locales/it-IT.json.js +1 -1
- package/dist/es/language/locales/ja-JP.json.js +1 -1
- package/dist/es/language/locales/ko-KR.json.js +1 -1
- package/dist/es/language/locales/nl-NL.json.js +1 -1
- package/dist/es/language/locales/no-NO.json.js +1 -1
- package/dist/es/language/locales/pl-PL.json.js +1 -1
- package/dist/es/language/locales/pt-BR.json.js +1 -1
- package/dist/es/language/locales/pt-PT.json.js +1 -1
- package/dist/es/language/locales/ro-RO.json.js +1 -1
- package/dist/es/language/locales/ru-RU.json.js +1 -1
- package/dist/es/language/locales/sk-SK.json.js +1 -1
- package/dist/es/language/locales/sl-SI.json.js +1 -1
- package/dist/es/language/locales/sv-SE.json.js +1 -1
- package/dist/es/language/locales/zh-CN.json.js +1 -1
- package/dist/es/language/locales/zh-TW.json.js +1 -1
- package/dist/es/utils/Formatters/formatters.js.map +1 -1
- package/dist/es/utils/Script.js +1 -1
- package/dist/es/utils/Script.js.map +1 -1
- package/dist/es/utils/Validator/defaultRules.js +1 -1
- package/dist/es/utils/Validator/defaultRules.js.map +1 -1
- package/dist/es/utils/base64.js +1 -1
- package/dist/es/utils/base64.js.map +1 -1
- package/dist/es/utils/getErrorMessage.js +1 -1
- package/dist/es/utils/getErrorMessage.js.map +1 -1
- package/dist/es-legacy/adyen.css +3 -3
- package/dist/es-legacy/components/AmazonPay/AmazonPay.js +1 -1
- package/dist/es-legacy/components/AmazonPay/AmazonPay.js.map +1 -1
- package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js +1 -1
- package/dist/es-legacy/components/AmazonPay/components/AmazonPayComponent.js.map +1 -1
- package/dist/es-legacy/components/ApplePay/ApplePay.js +1 -1
- package/dist/es-legacy/components/ApplePay/ApplePay.js.map +1 -1
- package/dist/es-legacy/components/ApplePay/defaultProps.js +1 -1
- package/dist/es-legacy/components/ApplePay/defaultProps.js.map +1 -1
- package/dist/es-legacy/components/ApplePay/payment-request.js.map +1 -1
- package/dist/es-legacy/components/Boleto/components/BoletoInput/validate.js +1 -1
- package/dist/es-legacy/components/Boleto/components/BoletoInput/validate.js.map +1 -1
- package/dist/es-legacy/components/Card/Card.js +1 -1
- package/dist/es-legacy/components/Card/Card.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/CardInput.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CardFieldsWrapper.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CardFieldsWrapper.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CardHolderName.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CardHolderName.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/KCPAuthentication.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/KCPAuthentication.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/validate.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/validate.js.map +1 -1
- package/dist/es-legacy/components/CashAppPay/defaultProps.js +1 -1
- package/dist/es-legacy/components/CashAppPay/defaultProps.js.map +1 -1
- package/dist/es-legacy/components/Donation/Donation.js.map +1 -1
- package/dist/es-legacy/components/Dragonpay/Dragonpay.js +1 -1
- package/dist/es-legacy/components/Dragonpay/Dragonpay.js.map +1 -1
- package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
- package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/DropinComponent.js +1 -1
- package/dist/es-legacy/components/Dropin/components/DropinComponent.js.map +1 -1
- package/dist/es-legacy/components/Dropin/defaultProps.js +1 -1
- package/dist/es-legacy/components/Dropin/defaultProps.js.map +1 -1
- package/dist/es-legacy/components/Econtext/Econtext.js +1 -1
- package/dist/es-legacy/components/Econtext/Econtext.js.map +1 -1
- package/dist/es-legacy/components/Econtext/components/EcontextInput/EcontextInput.js.map +1 -1
- package/dist/es-legacy/components/Giftcard/Giftcard.js +1 -1
- package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
- package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
- package/dist/es-legacy/components/Giropay/Giropay.js +1 -1
- package/dist/es-legacy/components/Giropay/Giropay.js.map +1 -1
- package/dist/es-legacy/components/GooglePay/GooglePay.js +1 -1
- package/dist/es-legacy/components/GooglePay/GooglePay.js.map +1 -1
- package/dist/es-legacy/components/GooglePay/GooglePayService.js +1 -1
- package/dist/es-legacy/components/GooglePay/GooglePayService.js.map +1 -1
- package/dist/es-legacy/components/GooglePay/defaultProps.js +1 -1
- package/dist/es-legacy/components/GooglePay/defaultProps.js.map +1 -1
- package/dist/es-legacy/components/GooglePay/requests.js.map +1 -1
- package/dist/es-legacy/components/Multibanco/Multibanco.js +1 -1
- package/dist/es-legacy/components/Multibanco/Multibanco.js.map +1 -1
- package/dist/es-legacy/components/PayPal/Paypal.js +1 -1
- package/dist/es-legacy/components/PayPal/Paypal.js.map +1 -1
- package/dist/es-legacy/components/PayPal/components/PaypalButtons.js +1 -1
- package/dist/es-legacy/components/PayPal/components/PaypalButtons.js.map +1 -1
- package/dist/es-legacy/components/PayPal/components/PaypalComponent.js +1 -1
- package/dist/es-legacy/components/PayPal/components/PaypalComponent.js.map +1 -1
- package/dist/es-legacy/components/PayPal/defaultProps.js +1 -1
- package/dist/es-legacy/components/PayPal/defaultProps.js.map +1 -1
- package/dist/es-legacy/components/PayPal/utils/format-paypal-order-contact-to-adyen-format.js +1 -1
- package/dist/es-legacy/components/PayPal/utils/format-paypal-order-contact-to-adyen-format.js.map +1 -1
- package/dist/es-legacy/components/PayPal/utils/get-paypal-locale.js +2 -0
- package/dist/es-legacy/components/PayPal/utils/get-paypal-locale.js.map +1 -0
- package/dist/es-legacy/components/PayPal/utils/get-paypal-settings.js +2 -0
- package/dist/es-legacy/components/PayPal/utils/get-paypal-settings.js.map +1 -0
- package/dist/es-legacy/components/PayPal/utils/get-paypal-styles.js +2 -0
- package/dist/es-legacy/components/PayPal/utils/get-paypal-styles.js.map +1 -0
- package/dist/es-legacy/components/PayPal/utils/get-paypal-url.js +2 -0
- package/dist/es-legacy/components/PayPal/utils/get-paypal-url.js.map +1 -0
- package/dist/es-legacy/components/Pix/Pix.js +1 -1
- package/dist/es-legacy/components/Pix/Pix.js.map +1 -1
- package/dist/es-legacy/components/Pix/PixInput/PixInput.js +1 -1
- package/dist/es-legacy/components/Pix/PixInput/PixInput.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/utils.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/utils.js.map +1 -1
- package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js +1 -1
- package/dist/es-legacy/components/helpers/IssuerListContainer/IssuerListContainer.js.map +1 -1
- package/dist/es-legacy/components/internal/Address/Address.js +1 -1
- package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
- package/dist/es-legacy/components/internal/Address/validate.js +1 -1
- package/dist/es-legacy/components/internal/Address/validate.js.map +1 -1
- package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
- package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
- package/dist/es-legacy/components/internal/CompanyDetails/validate.js +1 -1
- package/dist/es-legacy/components/internal/CompanyDetails/validate.js.map +1 -1
- package/dist/es-legacy/components/internal/IbanInput/IbanInput.js.map +1 -1
- package/dist/es-legacy/components/internal/Img/Img.js +1 -1
- package/dist/es-legacy/components/internal/Img/Img.js.map +1 -1
- package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js +1 -1
- package/dist/es-legacy/components/internal/PersonalDetails/PersonalDetails.js.map +1 -1
- package/dist/es-legacy/components/internal/PersonalDetails/validate.js +1 -1
- package/dist/es-legacy/components/internal/PersonalDetails/validate.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SFPUtils.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SFPUtils.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/binLookup/triggerBinLookUp.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/binLookup/triggerBinLookUp.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/cardType.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/cardType.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/processErrors.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/processErrors.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/configuration/constants.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/configuration/constants.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/utils/processAriaConfig.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/utils/processPlaceholders.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/utilities/addContextTranslations.js.map +1 -1
- package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js +1 -1
- package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
- package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
- package/dist/es-legacy/components/internal/UIElement/utils.js +1 -1
- package/dist/es-legacy/components/internal/UIElement/utils.js.map +1 -1
- package/dist/es-legacy/core/AdyenCheckout.js +1 -1
- package/dist/es-legacy/core/AdyenCheckout.js.map +1 -1
- package/dist/es-legacy/core/Analytics/Analytics.js +1 -1
- package/dist/es-legacy/core/Analytics/Analytics.js.map +1 -1
- package/dist/es-legacy/core/Analytics/EventsQueue.js +1 -1
- package/dist/es-legacy/core/Analytics/EventsQueue.js.map +1 -1
- package/dist/es-legacy/core/Analytics/constants.js +1 -1
- package/dist/es-legacy/core/Analytics/constants.js.map +1 -1
- package/dist/es-legacy/core/Analytics/utils.js +1 -1
- package/dist/es-legacy/core/Analytics/utils.js.map +1 -1
- package/dist/es-legacy/core/Errors/AdyenCheckoutError.js +1 -1
- package/dist/es-legacy/core/Errors/AdyenCheckoutError.js.map +1 -1
- package/dist/es-legacy/core/Errors/constants.js +1 -1
- package/dist/es-legacy/core/Errors/constants.js.map +1 -1
- package/dist/es-legacy/core/Errors/utils.js +1 -1
- package/dist/es-legacy/core/Errors/utils.js.map +1 -1
- package/dist/es-legacy/core/ProcessResponse/PaymentAction/actionTypes.js +1 -1
- package/dist/es-legacy/core/ProcessResponse/PaymentAction/actionTypes.js.map +1 -1
- package/dist/es-legacy/core/Services/analytics/collect-id.js +1 -1
- package/dist/es-legacy/core/Services/analytics/collect-id.js.map +1 -1
- package/dist/es-legacy/core/Services/analytics/log-event.js +1 -1
- package/dist/es-legacy/core/config.js +1 -1
- package/dist/es-legacy/core/config.js.map +1 -1
- package/dist/es-legacy/core/core.js +1 -1
- package/dist/es-legacy/core/core.js.map +1 -1
- package/dist/es-legacy/core/utils.js +1 -1
- package/dist/es-legacy/core/utils.js.map +1 -1
- package/dist/es-legacy/language/locales/ar.json.js +1 -1
- package/dist/es-legacy/language/locales/cs-CZ.json.js +1 -1
- package/dist/es-legacy/language/locales/da-DK.json.js +1 -1
- package/dist/es-legacy/language/locales/de-DE.json.js +1 -1
- package/dist/es-legacy/language/locales/el-GR.json.js +1 -1
- package/dist/es-legacy/language/locales/en-US.json.js +1 -1
- package/dist/es-legacy/language/locales/es-ES.json.js +1 -1
- package/dist/es-legacy/language/locales/fi-FI.json.js +1 -1
- package/dist/es-legacy/language/locales/fr-FR.json.js +1 -1
- package/dist/es-legacy/language/locales/hr-HR.json.js +1 -1
- package/dist/es-legacy/language/locales/hu-HU.json.js +1 -1
- package/dist/es-legacy/language/locales/it-IT.json.js +1 -1
- package/dist/es-legacy/language/locales/ja-JP.json.js +1 -1
- package/dist/es-legacy/language/locales/ko-KR.json.js +1 -1
- package/dist/es-legacy/language/locales/nl-NL.json.js +1 -1
- package/dist/es-legacy/language/locales/no-NO.json.js +1 -1
- package/dist/es-legacy/language/locales/pl-PL.json.js +1 -1
- package/dist/es-legacy/language/locales/pt-BR.json.js +1 -1
- package/dist/es-legacy/language/locales/pt-PT.json.js +1 -1
- package/dist/es-legacy/language/locales/ro-RO.json.js +1 -1
- package/dist/es-legacy/language/locales/ru-RU.json.js +1 -1
- package/dist/es-legacy/language/locales/sk-SK.json.js +1 -1
- package/dist/es-legacy/language/locales/sl-SI.json.js +1 -1
- package/dist/es-legacy/language/locales/sv-SE.json.js +1 -1
- package/dist/es-legacy/language/locales/zh-CN.json.js +1 -1
- package/dist/es-legacy/language/locales/zh-TW.json.js +1 -1
- package/dist/es-legacy/utils/Formatters/formatters.js.map +1 -1
- package/dist/es-legacy/utils/Script.js +1 -1
- package/dist/es-legacy/utils/Script.js.map +1 -1
- package/dist/es-legacy/utils/Validator/defaultRules.js +1 -1
- package/dist/es-legacy/utils/Validator/defaultRules.js.map +1 -1
- package/dist/es-legacy/utils/base64.js +1 -1
- package/dist/es-legacy/utils/base64.js.map +1 -1
- package/dist/es-legacy/utils/getErrorMessage.js +1 -1
- package/dist/es-legacy/utils/getErrorMessage.js.map +1 -1
- package/dist/umd/adyen.css +3 -3
- package/dist/umd/adyen.js +2 -2
- package/dist/umd/adyen.js.map +1 -1
- package/package.json +2 -2
- package/dist/es/components/PayPal/utils.js +0 -2
- package/dist/es/components/PayPal/utils.js.map +0 -1
- package/dist/es-legacy/components/PayPal/utils.js +0 -2
- package/dist/es-legacy/components/PayPal/utils.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../../../../src/core/Analytics/constants.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../src/core/Analytics/constants.ts"],"sourcesContent":["import {\n BOLETO_SOCIAL_SECURITY_NUMBER_INVALID,\n CREDITCARD_HOLDER_NAME_INVALID,\n CREDITCARD_TAX_NUMBER_INVALID,\n ERROR_FIELD_REQUIRED,\n ERROR_INVALID_FORMAT_EXPECTS\n} from '../Errors/constants';\n\nexport const ANALYTICS_PATH = 'v3/analytics';\n\nexport const ANALYTICS_INFO_TIMER_INTERVAL = process.env.NODE_ENV === 'development' ? 5000 : 10000;\n\nexport const ANALYTICS_SEARCH_DEBOUNCE_TIME = 3000;\n\nexport const ANALYTICS_EVENT_LOG = 'log';\nexport const ANALYTICS_EVENT_ERROR = 'error';\nexport const ANALYTICS_EVENT_INFO = 'info';\n\nexport const ANALYTICS_ACTION_STR = 'action';\nexport const ANALYTICS_SUBMIT_STR = 'submit';\nexport const ANALYTICS_SELECTED_STR = 'selected';\nexport const ANALYTICS_RENDERED_STR = 'rendered';\nexport const ANALYTICS_DISPLAYED_STR = 'displayed';\nexport const ANALYTICS_INPUT_STR = 'input';\n\nexport const ANALYTICS_DOWNLOAD_STR = 'download';\n\nexport const ANALYTICS_VALIDATION_ERROR_STR = 'validationError';\n\nexport const ANALYTICS_FOCUS_STR = 'focus';\nexport const ANALYTICS_UNFOCUS_STR = 'unfocus';\n\nexport const ANALYTICS_CONFIGURED_STR = 'configured';\n\nexport const ANALYTICS_QR_CODE_DOWNLOAD = 'qr_download_button';\n\nexport const ANALYTICS_INSTANT_PAYMENT_BUTTON = 'instant_payment_button';\nexport const ANALYTICS_FEATURED_ISSUER = 'featured_issuer';\nexport const ANALYTICS_LIST = 'list';\nexport const ANALYTICS_LIST_SEARCH = 'list_search';\n\nexport const ANALYTICS_IMPLEMENTATION_ERROR = 'ImplementationError';\nexport const ANALYTICS_API_ERROR = 'APIError';\n\nexport const ANALYTICS_ERROR_CODE_ACTION_IS_MISSING_PAYMENT_DATA = 'web_700'; // Missing 'paymentData' property from threeDS2 action\nexport const ANALYTICS_ERROR_CODE_ACTION_IS_MISSING_TOKEN = 'web_701'; // Missing 'token' property from threeDS2 action`\nexport const ANALYTICS_ERROR_CODE_TOKEN_IS_MISSING_THREEDSMETHODURL = 'web_702'; // Decoded token is missing a valid threeDSMethodURL property\n\n/**\n * Decoded token is missing one or more of the following properties:\n * fingerprint: (threeDSMethodNotificationURL | postMessageDomain | threeDSServerTransID)\n * challenge: (acsTransID | messageVersion | threeDSServerTransID)\n */\nexport const ANALYTICS_ERROR_CODE_TOKEN_IS_MISSING_OTHER_PROPS = 'web_703';\n\nexport const ANALYTICS_ERROR_CODE_TOKEN_DECODE_OR_PARSING_FAILED = 'web_704'; // token decoding or parsing has failed. ('not base64', 'malformed URI sequence' or 'Could not JSON parse token')\nexport const ANALYTICS_ERROR_CODE_3DS2_TIMEOUT = 'web_705'; // 3DS2 process has timed out\n\nexport const ANALYTICS_ERROR_CODE_TOKEN_IS_MISSING_ACSURL = 'web_800'; // Decoded token is missing a valid acsURL property\nexport const ANALYTICS_ERROR_CODE_NO_TRANSSTATUS = 'web_801'; // Challenge has resulted in an error (no transStatus could be retrieved by the backend)\n\n/**\n * Function to map errorCodes based on translation keys to the codes expected by the analytics endpoint\n */\nexport const errorCodeMapping: Record<string, string> = {\n [CREDITCARD_HOLDER_NAME_INVALID]: '925',\n [CREDITCARD_TAX_NUMBER_INVALID]: '942',\n //\n [BOLETO_SOCIAL_SECURITY_NUMBER_INVALID]: '926',\n //\n [`${ERROR_FIELD_REQUIRED}.country`]: '930',\n [`${ERROR_FIELD_REQUIRED}.street`]: '931',\n [`${ERROR_FIELD_REQUIRED}.house_number_or_name`]: '932',\n [`${ERROR_FIELD_REQUIRED}.postal_code`]: '933',\n [`${ERROR_FIELD_REQUIRED}.city`]: '935',\n [`${ERROR_FIELD_REQUIRED}.state_or_province`]: '936',\n //\n [`${ERROR_INVALID_FORMAT_EXPECTS}.postal_code`]: '934'\n //\n};\n"],"names":["ANALYTICS_PATH","ANALYTICS_INFO_TIMER_INTERVAL","ANALYTICS_SEARCH_DEBOUNCE_TIME","ANALYTICS_EVENT_LOG","ANALYTICS_EVENT_ERROR","ANALYTICS_EVENT_INFO","ANALYTICS_ACTION_STR","ANALYTICS_SUBMIT_STR","ANALYTICS_SELECTED_STR","ANALYTICS_RENDERED_STR","ANALYTICS_DISPLAYED_STR","ANALYTICS_INPUT_STR","ANALYTICS_DOWNLOAD_STR","ANALYTICS_VALIDATION_ERROR_STR","ANALYTICS_FOCUS_STR","ANALYTICS_UNFOCUS_STR","ANALYTICS_CONFIGURED_STR","ANALYTICS_QR_CODE_DOWNLOAD","ANALYTICS_INSTANT_PAYMENT_BUTTON","ANALYTICS_FEATURED_ISSUER","ANALYTICS_LIST","ANALYTICS_LIST_SEARCH","ANALYTICS_API_ERROR","ANALYTICS_ERROR_CODE_ACTION_IS_MISSING_PAYMENT_DATA","errorCodeMapping","CREDITCARD_HOLDER_NAME_INVALID","CREDITCARD_TAX_NUMBER_INVALID","BOLETO_SOCIAL_SECURITY_NUMBER_INVALID","ERROR_FIELD_REQUIRED","ERROR_INVALID_FORMAT_EXPECTS"],"mappings":"kNAQO,MAAMA,EAAiB,eAEjBC,EAAgF,IAEhFC,EAAiC,IAEjCC,EAAsB,MACtBC,EAAwB,QACxBC,EAAuB,OAEvBC,EAAuB,SACvBC,EAAuB,SACvBC,EAAyB,WACzBC,EAAyB,WACzBC,EAA0B,YAC1BC,EAAsB,QAEtBC,EAAyB,WAEzBC,EAAiC,kBAEjCC,EAAsB,QACtBC,EAAwB,UAExBC,EAA2B,aAE3BC,EAA6B,qBAE7BC,EAAmC,yBACnCC,EAA4B,kBAC5BC,EAAiB,OACjBC,EAAwB,cAGxBC,EAAsB,WAEtBC,EAAsD,UAoBtDC,EAA2C,CACpDC,CAACA,GAAiC,MAClCC,CAACA,GAAgC,MAEjCC,CAACA,GAAwC,MAEzC,CAAC,GAAGC,aAAiC,MACrC,CAAC,GAAGA,YAAgC,MACpC,CAAC,GAAGA,0BAA8C,MAClD,CAAC,GAAGA,iBAAqC,MACzC,CAAC,GAAGA,UAA8B,MAClC,CAAC,GAAGA,uBAA2C,MAE/C,CAAC,GAAGC,iBAA6C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ANALYTICS_ACTION_STR as e,ANALYTICS_VALIDATION_ERROR_STR as t}from"./constants.js";const
|
|
1
|
+
import{ANALYTICS_ACTION_STR as e,ANALYTICS_VALIDATION_ERROR_STR as t,errorCodeMapping as r}from"./constants.js";import o from"../../utils/uuid.js";import{digitsOnlyFormatter as s}from"../../utils/Formatters/formatters.js";import{ERROR_FIELD_REQUIRED as a,ERROR_INVALID_FORMAT_EXPECTS as n}from"../Errors/constants.js";const i=()=>Date.now(),m=r=>({timestamp:String(i()),component:r.component,id:o(),..."error"===r.event&&{code:r.code,errorType:r.errorType,message:r.message},..."log"===r.event&&{type:r.type,message:r.message},..."log"===r.event&&r.type===e&&{subType:r.subtype},..."info"===r.event&&{type:r.type,target:r.target},..."info"===r.event&&r.issuer&&{issuer:r.issuer},..."info"===r.event&&r.isStoredPaymentMethod&&{isStoredPaymentMethod:r.isStoredPaymentMethod,brand:r.brand},..."info"===r.event&&r.type===t&&{validationErrorCode:d(r.validationErrorCode,r.target),validationErrorMessage:r.validationErrorMessage},...r.metadata&&{metadata:r.metadata}}),d=(e,t)=>{if(e===a||e===n)return r[`${e}.${t}`]??e;let o=r[e]??e;return isNaN(Number(o))&&(o=s(o)),o};export{m as createAnalyticsObject,i as getUTCTimestamp};
|
|
2
2
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../../src/core/Analytics/utils.ts"],"sourcesContent":["import { AnalyticsObject, CreateAnalyticsObject } from './types';\nimport { ANALYTICS_ACTION_STR, ANALYTICS_VALIDATION_ERROR_STR } from './constants';\n\nexport const getUTCTimestamp = () => Date.now();\n\n/**\n * All objects for the /checkoutanalytics endpoint have base props:\n * \"timestamp\" & \"component\"\n *\n * Error objects have, in addition to the base props:\n * \"code\", \"errorType\" & \"message\"\n *\n * Log objects have, in addition to the base props:\n * \"message\" & \"type\" &\n * \"subtype\" (e.g. when an action is handled)\n *\n * Info objects have, in addition to the base props:\n * \"type\" & \"target\" &\n * \"isStoredPaymentMethod\" & \"brand\" (when a storedCard is \"selected\"), or,\n * \"validationErrorCode\" & \"validationErrorMessage\" (when the event is describing a validation error)\n *\n * All objects can also have a \"metadata\" object of key-value pairs\n */\nexport const createAnalyticsObject = (aObj: CreateAnalyticsObject): AnalyticsObject => ({\n timestamp: String(getUTCTimestamp()),\n component: aObj.component,\n /** ERROR */\n ...(aObj.event === 'error' && { code: aObj.code, errorType: aObj.errorType, message: aObj.message }), // error event\n /** LOG */\n ...(aObj.event === 'log' && { type: aObj.type, message: aObj.message }), // log event\n ...(aObj.event === 'log' && aObj.type === ANALYTICS_ACTION_STR && { subType: aObj.subtype }), // only added if we have a log event of Action type\n /** INFO */\n ...(aObj.event === 'info' && { type: aObj.type, target: aObj.target, issuer: aObj.issuer }), //
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../src/core/Analytics/utils.ts"],"sourcesContent":["import { AnalyticsObject, CreateAnalyticsObject } from './types';\nimport { ANALYTICS_ACTION_STR, ANALYTICS_VALIDATION_ERROR_STR, errorCodeMapping } from './constants';\nimport uuid from '../../utils/uuid';\nimport { digitsOnlyFormatter } from '../../utils/Formatters/formatters';\nimport { ERROR_FIELD_REQUIRED, ERROR_INVALID_FORMAT_EXPECTS } from '../Errors/constants';\n\nexport const getUTCTimestamp = () => Date.now();\n\n/**\n * All objects for the /checkoutanalytics endpoint have base props:\n * \"timestamp\" & \"component\"\n *\n * Error objects have, in addition to the base props:\n * \"code\", \"errorType\" & \"message\"\n *\n * Log objects have, in addition to the base props:\n * \"message\" & \"type\" &\n * \"subtype\" (e.g. when an action is handled)\n *\n * Info objects have, in addition to the base props:\n * \"type\" & \"target\" &\n * \"isStoredPaymentMethod\" & \"brand\" (when a storedCard is \"selected\"), or,\n * \"validationErrorCode\" & \"validationErrorMessage\" (when the event is describing a validation error)\n *\n * All objects can also have a \"metadata\" object of key-value pairs\n */\nexport const createAnalyticsObject = (aObj: CreateAnalyticsObject): AnalyticsObject => ({\n timestamp: String(getUTCTimestamp()),\n component: aObj.component,\n id: uuid(),\n /** ERROR */\n ...(aObj.event === 'error' && { code: aObj.code, errorType: aObj.errorType, message: aObj.message }), // error event\n /** LOG */\n ...(aObj.event === 'log' && { type: aObj.type, message: aObj.message }), // log event\n ...(aObj.event === 'log' && aObj.type === ANALYTICS_ACTION_STR && { subType: aObj.subtype }), // only added if we have a log event of Action type\n /** INFO */\n ...(aObj.event === 'info' && { type: aObj.type, target: aObj.target }), // info event\n ...(aObj.event === 'info' && aObj.issuer && { issuer: aObj.issuer }), // relates to issuerLists\n ...(aObj.event === 'info' && aObj.isStoredPaymentMethod && { isStoredPaymentMethod: aObj.isStoredPaymentMethod, brand: aObj.brand }), // only added if we have an info event about a storedPM\n ...(aObj.event === 'info' &&\n aObj.type === ANALYTICS_VALIDATION_ERROR_STR && {\n validationErrorCode: mapErrorCodesForAnalytics(aObj.validationErrorCode, aObj.target),\n validationErrorMessage: aObj.validationErrorMessage\n }), // only added if we have an info event describing a validation error\n /** All */\n ...(aObj.metadata && { metadata: aObj.metadata })\n});\n\nconst mapErrorCodesForAnalytics = (errorCode: string, target: string) => {\n // Some of the more generic error codes required combination with target to retrieve a specific code\n if (errorCode === ERROR_FIELD_REQUIRED || errorCode === ERROR_INVALID_FORMAT_EXPECTS) {\n return errorCodeMapping[`${errorCode}.${target}`] ?? errorCode;\n }\n\n let errCode = errorCodeMapping[errorCode] ?? errorCode;\n\n // If errCode isn't now a number - then we just need to remove any non-digits\n // since the correct error code is already contained within the string e.g. securedField related errors\n if (isNaN(Number(errCode))) {\n errCode = digitsOnlyFormatter(errCode);\n }\n\n return errCode;\n};\n"],"names":["getUTCTimestamp","Date","now","createAnalyticsObject","aObj","timestamp","String","component","id","uuid","event","code","errorType","message","type","ANALYTICS_ACTION_STR","subType","subtype","target","issuer","isStoredPaymentMethod","brand","ANALYTICS_VALIDATION_ERROR_STR","validationErrorCode","mapErrorCodesForAnalytics","validationErrorMessage","metadata","errorCode","ERROR_FIELD_REQUIRED","ERROR_INVALID_FORMAT_EXPECTS","errorCodeMapping","errCode","isNaN","Number","digitsOnlyFormatter"],"mappings":"8TAMaA,MAAAA,EAAkB,IAAMC,KAAKC,MAoB7BC,EAAyBC,IAAkD,CACpFC,UAAWC,OAAON,KAClBO,UAAWH,EAAKG,UAChBC,GAAIC,OAEe,UAAfL,EAAKM,OAAqB,CAAEC,KAAMP,EAAKO,KAAMC,UAAWR,EAAKQ,UAAWC,QAAST,EAAKS,YAEvE,QAAfT,EAAKM,OAAmB,CAAEI,KAAMV,EAAKU,KAAMD,QAAST,EAAKS,YAC1C,QAAfT,EAAKM,OAAmBN,EAAKU,OAASC,GAAwB,CAAEC,QAASZ,EAAKa,YAE/D,SAAfb,EAAKM,OAAoB,CAAEI,KAAMV,EAAKU,KAAMI,OAAQd,EAAKc,WAC1C,SAAfd,EAAKM,OAAoBN,EAAKe,QAAU,CAAEA,OAAQf,EAAKe,WACxC,SAAff,EAAKM,OAAoBN,EAAKgB,uBAAyB,CAAEA,sBAAuBhB,EAAKgB,sBAAuBC,MAAOjB,EAAKiB,UACzG,SAAfjB,EAAKM,OACLN,EAAKU,OAASQ,GAAkC,CAC5CC,oBAAqBC,EAA0BpB,EAAKmB,oBAAqBnB,EAAKc,QAC9EO,uBAAwBrB,EAAKqB,2BAGjCrB,EAAKsB,UAAY,CAAEA,SAAUtB,EAAKsB,YAGpCF,EAA4B,CAACG,EAAmBT,KAElD,GAAIS,IAAcC,GAAwBD,IAAcE,EACpD,OAAOC,EAAiB,GAAGH,KAAaT,MAAaS,EAGzD,IAAII,EAAUD,EAAiBH,IAAcA,EAQ7C,OAJIK,MAAMC,OAAOF,MACbA,EAAUG,EAAoBH,IAG3BA,CAAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const R="NETWORK_ERROR",E="CANCEL",s="IMPLEMENTATION_ERROR",
|
|
1
|
+
const R="NETWORK_ERROR",E="CANCEL",s="IMPLEMENTATION_ERROR",O="API_ERROR",e="ERROR",r="SCRIPT_ERROR";class t extends Error{static errorTypes={NETWORK_ERROR:R,CANCEL:E,IMPLEMENTATION_ERROR:s,API_ERROR:O,ERROR:e,SCRIPT_ERROR:r};cause;constructor(R,E,s){super(E),this.name=t.errorTypes[R],this.cause=s?.cause}}export{O as API_ERROR,E as CANCEL,e as ERROR,s as IMPLEMENTATION_ERROR,R as NETWORK_ERROR,r as SCRIPT_ERROR,t as default};
|
|
2
2
|
//# sourceMappingURL=AdyenCheckoutError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdyenCheckoutError.js","sources":["../../../../src/core/Errors/AdyenCheckoutError.ts"],"sourcesContent":["interface CheckoutErrorOptions {\n cause?: any;\n}\n\nexport const NETWORK_ERROR = 'NETWORK_ERROR';\nexport const CANCEL = 'CANCEL';\nexport const IMPLEMENTATION_ERROR = 'IMPLEMENTATION_ERROR';\nexport const API_ERROR = 'API_ERROR';\nexport const ERROR = 'ERROR';\n\nclass AdyenCheckoutError extends Error {\n protected static errorTypes = {\n /** Network error. */\n NETWORK_ERROR,\n\n /** Shopper canceled the current transaction. */\n CANCEL,\n\n /** Implementation error. The method or parameter are incorrect or are not supported. */\n IMPLEMENTATION_ERROR,\n\n /** API error. The API has not returned the expected data */\n API_ERROR,\n\n /** Generic error. */\n ERROR\n };\n\n public cause: unknown;\n\n constructor(type: keyof typeof AdyenCheckoutError.errorTypes, message?: string, options?: CheckoutErrorOptions) {\n super(message);\n\n this.name = AdyenCheckoutError.errorTypes[type];\n\n this.cause = options?.cause;\n }\n}\n\nexport default AdyenCheckoutError;\n"],"names":["NETWORK_ERROR","CANCEL","IMPLEMENTATION_ERROR","API_ERROR","ERROR","AdyenCheckoutError","Error","static","cause","constructor","type","message","options","super","this","name","errorTypes"],"mappings":"AAIO,MAAMA,EAAgB,gBAChBC,EAAS,SACTC,EAAuB,uBACvBC,EAAY,YACZC,EAAQ,
|
|
1
|
+
{"version":3,"file":"AdyenCheckoutError.js","sources":["../../../../src/core/Errors/AdyenCheckoutError.ts"],"sourcesContent":["interface CheckoutErrorOptions {\n cause?: any;\n}\n\nexport const NETWORK_ERROR = 'NETWORK_ERROR';\nexport const CANCEL = 'CANCEL';\nexport const IMPLEMENTATION_ERROR = 'IMPLEMENTATION_ERROR';\nexport const API_ERROR = 'API_ERROR';\nexport const ERROR = 'ERROR';\nexport const SCRIPT_ERROR = 'SCRIPT_ERROR';\n\nclass AdyenCheckoutError extends Error {\n protected static errorTypes = {\n /** Network error. */\n NETWORK_ERROR,\n\n /** Shopper canceled the current transaction. */\n CANCEL,\n\n /** Implementation error. The method or parameter are incorrect or are not supported. */\n IMPLEMENTATION_ERROR,\n\n /** API error. The API has not returned the expected data */\n API_ERROR,\n\n /** Generic error. */\n ERROR,\n\n /** Script error. The browser failed to load 3rd party script */\n SCRIPT_ERROR\n };\n\n public cause: unknown;\n\n constructor(type: keyof typeof AdyenCheckoutError.errorTypes, message?: string, options?: CheckoutErrorOptions) {\n super(message);\n\n this.name = AdyenCheckoutError.errorTypes[type];\n\n this.cause = options?.cause;\n }\n}\n\nexport default AdyenCheckoutError;\n"],"names":["NETWORK_ERROR","CANCEL","IMPLEMENTATION_ERROR","API_ERROR","ERROR","SCRIPT_ERROR","AdyenCheckoutError","Error","static","cause","constructor","type","message","options","super","this","name","errorTypes"],"mappings":"AAIO,MAAMA,EAAgB,gBAChBC,EAAS,SACTC,EAAuB,uBACvBC,EAAY,YACZC,EAAQ,QACRC,EAAe,eAE5B,MAAMC,UAA2BC,MAC7BC,kBAA8B,CAE1BR,gBAGAC,SAGAC,uBAGAC,YAGAC,QAGAC,gBAGGI,MAEPC,WAAAA,CAAYC,EAAkDC,EAAkBC,GAC5EC,MAAMF,GAENG,KAAKC,KAAOV,EAAmBW,WAAWN,GAE1CI,KAAKN,MAAQI,GAASJ,KAC1B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ENCRYPTED_CARD_NUMBER as
|
|
1
|
+
import{ENCRYPTED_CARD_NUMBER as _,ENCRYPTED_EXPIRY_DATE as R,ENCRYPTED_EXPIRY_MONTH as c,ENCRYPTED_EXPIRY_YEAR as E,ENCRYPTED_SECURITY_CODE as C,ENCRYPTED_PWD_FIELD as O,ENCRYPTED_BANK_ACCNT_NUMBER_FIELD as r,ENCRYPTED_BANK_LOCATION_FIELD as a}from"../../components/internal/SecuredFields/lib/configuration/constants.js";const M="-ariaError",n="-ariaContext",t="focusField",i="notValidating:blurScenario",L="field.error.required",T="field.error.invalid",N="invalid.format.expects",e="creditCard.holderName.invalid",d="creditCard.taxNumber.invalid",o="boleto.socialSecurityNumber.invalid";var S,A;!function(_){_.CC_NUM="cc.num",_.CC_DAT="cc.dat",_.CC_MTH="cc.mth",_.CC_YR="cc.yr",_.CC_CVC="cc.cvc",_.KCP_PWD="kcp.pwd",_.ACH_NUM="ach.num",_.ACH_LOC="ach.loc"}(S||(S={})),function(_){_.ERROR_MSG_INCOMPLETE_FIELD="err.gen.9100",_.ERROR_MSG_INVALID_FIELD="err.gen.9101",_.ERROR_MSG_LUHN_CHECK_FAILED="cc.num.902",_.ERROR_MSG_EMPTY_PAN="cc.num.900",_.ERROR_MSG_UNSUPPORTED_CARD_ENTERED="cc.num.903",_.ERROR_MSG_INCORRECTLY_FILLED_PAN="cc.num.901",_.ERROR_MSG_CARD_TOO_OLD="cc.dat.912",_.ERROR_MSG_CARD_TOO_FAR_IN_FUTURE="cc.dat.913",_.ERROR_MSG_CARD_EXPIRES_TOO_SOON="cc.dat.914",_.ERROR_MSG_EMPTY_DATE="cc.dat.910",_.ERROR_MSG_INCORRECTLY_FILLED__DATE="cc.dat.911",_.ERROR_MSG_EMPTY_YEAR="cc.yr.917",_.ERROR_MSG_INCORRECTLY_FILLED_YEAR="cc.yr.918",_.ERROR_MSG_EMPTY_MONTH="cc.mth.915",_.ERROR_MSG_EMPTY_CVC="cc.cvc.920",_.ERROR_MSG_INCORRECTLY_FILLED_CVC="cc.cvc.921",_.ERROR_MSG_EMPTY_KCP_PWD="kcp.pwd.940",_.ERROR_MSG_INCORRECTLY_FILLED_KCP_PWD="kcp.pwd.941",_.ERROR_MSG_EMPTY_ACH_ACCOUNT_NUMBER="ach.num.945",_.ERROR_MSG_INCORRECTLY_FILLED_ACH_ACCOUNT_NUMBER="ach.num.946",_.ERROR_MSG_EMPTY_ACH_BANK_LOCATION_ID="ach.loc.947",_.ERROR_MSG_INCORRECTLY_FILLED_ACH_BANK_LOCATION_ID="ach.loc.948"}(A||(A={}));const D={[_]:"cc.num.900",[R]:"cc.dat.910",[c]:"cc.mth.915",[E]:"cc.yr.917",[C]:"cc.cvc.920",[O]:"kcp.pwd.940",[r]:"ach.num.945",[a]:"ach.loc.947"};export{n as ARIA_CONTEXT_SUFFIX,M as ARIA_ERROR_SUFFIX,o as BOLETO_SOCIAL_SECURITY_NUMBER_INVALID,e as CREDITCARD_HOLDER_NAME_INVALID,d as CREDITCARD_TAX_NUMBER_INVALID,D as EMPTY_FIELD_ERROR_MESSAGES,i as ERROR_ACTION_BLUR_SCENARIO,t as ERROR_ACTION_FOCUS_FIELD,T as ERROR_FIELD_INVALID,L as ERROR_FIELD_REQUIRED,N as ERROR_INVALID_FORMAT_EXPECTS,S as ErrorCodePrefixes,A as SF_ErrorCodes};
|
|
2
2
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../../../../src/core/Errors/constants.ts"],"sourcesContent":["import {\n ENCRYPTED_BANK_ACCNT_NUMBER_FIELD,\n ENCRYPTED_BANK_LOCATION_FIELD,\n ENCRYPTED_CARD_NUMBER,\n ENCRYPTED_EXPIRY_DATE,\n ENCRYPTED_EXPIRY_MONTH,\n ENCRYPTED_EXPIRY_YEAR,\n ENCRYPTED_PWD_FIELD,\n ENCRYPTED_SECURITY_CODE\n} from '../../components/internal/SecuredFields/lib/configuration/constants';\n\nexport const ARIA_ERROR_SUFFIX = '-ariaError';\nexport const ARIA_CONTEXT_SUFFIX = '-ariaContext';\n\nexport const
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../src/core/Errors/constants.ts"],"sourcesContent":["import {\n ENCRYPTED_BANK_ACCNT_NUMBER_FIELD,\n ENCRYPTED_BANK_LOCATION_FIELD,\n ENCRYPTED_CARD_NUMBER,\n ENCRYPTED_EXPIRY_DATE,\n ENCRYPTED_EXPIRY_MONTH,\n ENCRYPTED_EXPIRY_YEAR,\n ENCRYPTED_PWD_FIELD,\n ENCRYPTED_SECURITY_CODE\n} from '../../components/internal/SecuredFields/lib/configuration/constants';\n\nexport const ARIA_ERROR_SUFFIX = '-ariaError';\nexport const ARIA_CONTEXT_SUFFIX = '-ariaContext';\n\nexport const ERROR_ACTION_FOCUS_FIELD = 'focusField';\nexport const ERROR_ACTION_BLUR_SCENARIO = 'notValidating:blurScenario';\nexport const ERROR_FIELD_REQUIRED = 'field.error.required';\nexport const ERROR_FIELD_INVALID = 'field.error.invalid';\n\nexport const ERROR_INVALID_FORMAT_EXPECTS = 'invalid.format.expects';\nexport const CREDITCARD_HOLDER_NAME_INVALID = 'creditCard.holderName.invalid';\nexport const CREDITCARD_TAX_NUMBER_INVALID = 'creditCard.taxNumber.invalid';\nexport const BOLETO_SOCIAL_SECURITY_NUMBER_INVALID = 'boleto.socialSecurityNumber.invalid';\n\nexport enum ErrorCodePrefixes {\n CC_NUM = 'cc.num',\n CC_DAT = 'cc.dat',\n CC_MTH = 'cc.mth',\n CC_YR = 'cc.yr',\n CC_CVC = 'cc.cvc',\n KCP_PWD = 'kcp.pwd',\n ACH_NUM = 'ach.num',\n ACH_LOC = 'ach.loc'\n}\n\n/**\n * For SecuredFields\n * Human readable error strings mapped to the codes, used as keys, in the translations files\n */\nexport enum SF_ErrorCodes {\n ERROR_MSG_INCOMPLETE_FIELD = 'err.gen.9100',\n ERROR_MSG_INVALID_FIELD = 'err.gen.9101',\n\n ERROR_MSG_LUHN_CHECK_FAILED = `${ErrorCodePrefixes.CC_NUM}.902`,\n ERROR_MSG_EMPTY_PAN = `${ErrorCodePrefixes.CC_NUM}.900`,\n ERROR_MSG_UNSUPPORTED_CARD_ENTERED = `${ErrorCodePrefixes.CC_NUM}.903`,\n ERROR_MSG_INCORRECTLY_FILLED_PAN = `${ErrorCodePrefixes.CC_NUM}.901`, // 'Enter the complete card number'\n\n ERROR_MSG_CARD_TOO_OLD = `${ErrorCodePrefixes.CC_DAT}.912`,\n ERROR_MSG_CARD_TOO_FAR_IN_FUTURE = `${ErrorCodePrefixes.CC_DAT}.913`,\n ERROR_MSG_CARD_EXPIRES_TOO_SOON = `${ErrorCodePrefixes.CC_DAT}.914`,\n ERROR_MSG_EMPTY_DATE = `${ErrorCodePrefixes.CC_DAT}.910`,\n ERROR_MSG_INCORRECTLY_FILLED__DATE = `${ErrorCodePrefixes.CC_DAT}.911`,\n\n ERROR_MSG_EMPTY_YEAR = `${ErrorCodePrefixes.CC_YR}.917`,\n ERROR_MSG_INCORRECTLY_FILLED_YEAR = `${ErrorCodePrefixes.CC_YR}.918`,\n\n // ERROR_MSG_INCORRECTLY_FILLED_MONTH= `cc.mth.916`,\n ERROR_MSG_EMPTY_MONTH = `${ErrorCodePrefixes.CC_MTH}.915`,\n\n ERROR_MSG_EMPTY_CVC = `${ErrorCodePrefixes.CC_CVC}.920`,\n ERROR_MSG_INCORRECTLY_FILLED_CVC = `${ErrorCodePrefixes.CC_CVC}.921`,\n\n ERROR_MSG_EMPTY_KCP_PWD = `${ErrorCodePrefixes.KCP_PWD}.940`,\n ERROR_MSG_INCORRECTLY_FILLED_KCP_PWD = `${ErrorCodePrefixes.KCP_PWD}.941`,\n\n ERROR_MSG_EMPTY_ACH_ACCOUNT_NUMBER = `${ErrorCodePrefixes.ACH_NUM}.945`,\n ERROR_MSG_INCORRECTLY_FILLED_ACH_ACCOUNT_NUMBER = `${ErrorCodePrefixes.ACH_NUM}.946`,\n\n ERROR_MSG_EMPTY_ACH_BANK_LOCATION_ID = `${ErrorCodePrefixes.ACH_LOC}.947`,\n ERROR_MSG_INCORRECTLY_FILLED_ACH_BANK_LOCATION_ID = `${ErrorCodePrefixes.ACH_LOC}.948`\n}\n\nexport const EMPTY_FIELD_ERROR_MESSAGES = {\n [ENCRYPTED_CARD_NUMBER]: SF_ErrorCodes.ERROR_MSG_EMPTY_PAN,\n [ENCRYPTED_EXPIRY_DATE]: SF_ErrorCodes.ERROR_MSG_EMPTY_DATE,\n [ENCRYPTED_EXPIRY_MONTH]: SF_ErrorCodes.ERROR_MSG_EMPTY_MONTH,\n [ENCRYPTED_EXPIRY_YEAR]: SF_ErrorCodes.ERROR_MSG_EMPTY_YEAR,\n [ENCRYPTED_SECURITY_CODE]: SF_ErrorCodes.ERROR_MSG_EMPTY_CVC,\n [ENCRYPTED_PWD_FIELD]: SF_ErrorCodes.ERROR_MSG_EMPTY_KCP_PWD,\n [ENCRYPTED_BANK_ACCNT_NUMBER_FIELD]: SF_ErrorCodes.ERROR_MSG_EMPTY_ACH_ACCOUNT_NUMBER,\n [ENCRYPTED_BANK_LOCATION_FIELD]: SF_ErrorCodes.ERROR_MSG_EMPTY_ACH_BANK_LOCATION_ID\n};\n"],"names":["ARIA_ERROR_SUFFIX","ARIA_CONTEXT_SUFFIX","ERROR_ACTION_FOCUS_FIELD","ERROR_ACTION_BLUR_SCENARIO","ERROR_FIELD_REQUIRED","ERROR_FIELD_INVALID","ERROR_INVALID_FORMAT_EXPECTS","CREDITCARD_HOLDER_NAME_INVALID","CREDITCARD_TAX_NUMBER_INVALID","BOLETO_SOCIAL_SECURITY_NUMBER_INVALID","ErrorCodePrefixes","SF_ErrorCodes","EMPTY_FIELD_ERROR_MESSAGES","ENCRYPTED_CARD_NUMBER","ENCRYPTED_EXPIRY_DATE","ENCRYPTED_EXPIRY_MONTH","ENCRYPTED_EXPIRY_YEAR","ENCRYPTED_SECURITY_CODE","ENCRYPTED_PWD_FIELD","ENCRYPTED_BANK_ACCNT_NUMBER_FIELD","ENCRYPTED_BANK_LOCATION_FIELD"],"mappings":"iUAWO,MAAMA,EAAoB,aACpBC,EAAsB,eAEtBC,EAA2B,aAC3BC,EAA6B,6BAC7BC,EAAuB,uBACvBC,EAAsB,sBAEtBC,EAA+B,yBAC/BC,EAAiC,gCACjCC,EAAgC,+BAChCC,EAAwC,+CAEzCC,SAAAA,uJAAAA,CAAAA,IAAAA,EAAAA,CAAAA,IAeAC,SAAAA,q/BAAAA,CAAAA,IAAAA,EAAAA,CAAAA,UAkCCC,EAA6B,CACtCC,CAACA,GAAsB,aACvBC,CAACA,GAAsB,aACvBC,CAACA,GAAuB,aACxBC,CAACA,GAAsB,YACvBC,CAACA,GAAwB,aACzBC,CAACA,GAAoB,cACrBC,CAACA,GAAkC,cACnCC,CAACA,GAA8B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ERROR_ACTION_FOCUS_FIELD as e,ERROR_ACTION_BLUR_SCENARIO as r,ErrorCodePrefixes as s,SF_ErrorCodes as t}from"./constants.js";import{ValidationRuleResult as o}from"../../utils/Validator/ValidationRuleResult.js";import{ENCRYPTED_BANK_LOCATION_FIELD as n,ENCRYPTED_BANK_ACCNT_NUMBER_FIELD as a,ENCRYPTED_PWD_FIELD as i,ENCRYPTED_SECURITY_CODE as c,ENCRYPTED_EXPIRY_YEAR as l,ENCRYPTED_EXPIRY_MONTH as u,ENCRYPTED_EXPIRY_DATE as f,ENCRYPTED_CARD_NUMBER as d}from"../../components/internal/SecuredFields/lib/configuration/constants.js";const p=(e,r)=>Object.values(t).reduce(((s,t)=>(t.includes(r)&&(s[t]=e.get(t)),s)),{}),g=(e,r,s)=>{const t={...e},o=y(s);return t.error=p(r,o),t},b=(e,r)=>{let s=e;for(const[t,o]of Object.entries(r))if(o===e){s=t;break}return s?.toLowerCase().replace(/[_.\s]/g,"-")},y=e=>{let r;switch(e){case d:r=s.CC_NUM;break;case f:r=s.CC_DAT;break;case u:r=s.CC_MTH;break;case l:r=s.CC_YR;break;case c:r=s.CC_CVC;break;case i:r=s.KCP_PWD;break;case a:r=s.ACH_NUM;break;case n:r=s.ACH_LOC}return r},C=({errors:e,i18n:r,layout:s,countrySpecificLabels:t,fieldTypeMappingFn:n})=>{const a="-sr";return Object.entries(e).reduce(((i,[c,l])=>{if(l){const l=e[c];let u,f;if(u=l instanceof o?"object"==typeof l.errorMessage?l.errorMessage.translationKey:l.errorMessage:l.error,l instanceof o||!("errorI18n"in l))if("object"==typeof l.errorMessage)f=`${r.get(l.errorMessage.translationKey)} ${l.errorMessage.translationObject.values.format}${a}`;else{const e=n?n(c,r,t):"";f=r.get(l.errorMessage,{values:{label:e}})+a}else f=l.errorI18n+a;i.push({field:c,errorMessage:f,errorCode:u}),s&&i.sort(((e,r)=>s.indexOf(e.field)-s.indexOf(r.field)))}return i}),[])},M=({i18n:s,fieldTypeMappingFn:t,SRPanelRef:o},{errors:n,isValidating:a,layout:i,countrySpecificLabels:c})=>{const l=C({errors:n,i18n:s,fieldTypeMappingFn:t,countrySpecificLabels:c,layout:i});if(l.length){if(a){const r=l.map((e=>e.errorMessage));o.setMessages(r);const s=l.map((e=>e.field));return{currentErrorsSortedByLayout:l,action:e,fieldToFocus:s[0]}}return o?.setMessages(null),{currentErrorsSortedByLayout:l,action:r}}return o?.setMessages(null),{currentErrorsSortedByLayout:l,action:"none"}},j=(e,r)=>{if(!e)return null;return Object.entries(e).reduce(((e,[s,t])=>{if(t){e[`${r}${s}`]=t}return e}),{})};export{g as addErrorTranslationsToObject,j as enhanceErrorObjectKeys,b as getErrorMessageFromCode,p as getTranslatedErrors,M as setSRMessagesFromErrors,C as sortErrorsByLayout};
|
|
2
2
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../../src/core/Errors/utils.ts"],"sourcesContent":["import { ERROR_ACTION_BLUR_SCENARIO, ERROR_ACTION_FOCUS_FIELD, ERROR_CODES } from './constants';\nimport { SFError } from '../../components/Card/components/CardInput/types';\nimport { SortErrorsObj, SortedErrorObject, GenericError, SetSRMessagesReturnObject } from './types';\nimport { ValidationRuleResult } from '../../utils/Validator/ValidationRuleResult';\nimport {\n ENCRYPTED_BANK_ACCNT_NUMBER_FIELD,\n ENCRYPTED_BANK_LOCATION_FIELD,\n ENCRYPTED_CARD_NUMBER,\n ENCRYPTED_EXPIRY_DATE,\n ENCRYPTED_EXPIRY_MONTH,\n ENCRYPTED_EXPIRY_YEAR,\n ENCRYPTED_PWD_FIELD,\n ENCRYPTED_SECURITY_CODE\n} from '../../components/internal/SecuredFields/lib/configuration/constants';\n\n/**\n * Access items stored in the ERROR_CODES object by either sending in the key - in which case you get the value\n * or by sending in the value - in which case you get the key\n * @param keyOrValue - key (or value) by which to retrieve the corresponding value (or key)\n */\nexport const getError = (keyOrValue: string): string => {\n // Retrieve value\n let rtnVal = ERROR_CODES[keyOrValue];\n if (rtnVal) return rtnVal;\n\n // Retrieve key\n rtnVal = Object.keys(ERROR_CODES).find(key => ERROR_CODES[key] === keyOrValue);\n if (rtnVal) return rtnVal;\n\n // Neither exist\n return keyOrValue;\n};\n\nexport const addAriaErrorTranslationsObject = (i18n, errorCodeIdentifier) => {\n const errorKeys = Object.keys(ERROR_CODES);\n\n const transObj = errorKeys.reduce((acc, item) => {\n const value = ERROR_CODES[item];\n // Limit to errors related to specific sf (or general errors) TODO check if general errors are still used\n if (value.includes(errorCodeIdentifier) || value.indexOf('gen.01') > -1) {\n acc[value] = i18n.get(value);\n }\n return acc;\n }, {});\n\n return transObj;\n};\n\n/**\n * Adds a new error property to an object.\n * This error property is an object containing the translated errors, stored by code, that relate to the securedFields\n * @param originalObject - object we want to duplicate and enhance\n * @param i18n - an i18n object to use to get translations\n * @returns a duplicate of the original object with a new property: \"error\" whose value is a object containing the translated errors\n */\nexport const addErrorTranslationsToObject = (originalObj, i18n, fieldType) => {\n const nuObj = { ...originalObj };\n\n const errorCodeIdentifier = fieldTypeToErrorCodeIdentifier(fieldType);\n nuObj.error = addAriaErrorTranslationsObject(i18n, errorCodeIdentifier);\n\n return nuObj;\n};\n\nconst fieldTypeToErrorCodeIdentifier = fieldType => {\n let errorCodeIdentifier;\n switch (fieldType) {\n case ENCRYPTED_CARD_NUMBER:\n errorCodeIdentifier = 'sf-cc-num';\n break;\n case ENCRYPTED_EXPIRY_DATE:\n errorCodeIdentifier = 'sf-cc-dat';\n break;\n case ENCRYPTED_EXPIRY_MONTH:\n errorCodeIdentifier = 'sf-cc-mth';\n break;\n case ENCRYPTED_EXPIRY_YEAR:\n errorCodeIdentifier = 'sf-cc-yr';\n break;\n case ENCRYPTED_SECURITY_CODE:\n errorCodeIdentifier = 'sf-cc-cvc';\n break;\n case ENCRYPTED_PWD_FIELD:\n errorCodeIdentifier = 'sf-kcp-pwd';\n break;\n case ENCRYPTED_BANK_ACCNT_NUMBER_FIELD:\n errorCodeIdentifier = 'sf-ach-num';\n break;\n case ENCRYPTED_BANK_LOCATION_FIELD:\n errorCodeIdentifier = 'sf-ach-loc';\n break;\n default:\n }\n return errorCodeIdentifier;\n};\n\n/**\n * sortErrorsByLayout - takes a list of errors and a layout, and returns a sorted array of error objects with translated error messages\n *\n * @param errors - an object containing errors, referenced by field type\n * @param layout - a string[] controlling how the output error objects will be ordered. Required when it is known that the way the error object is populated can vary e.g. Card comp, &/or anything with a country selector\n * @param i18n - our internal Language mechanism\n * @param countrySpecificLabels - some errors are region specific, e.g. in the US \"postal code\" = \"zip code\", so map the fieldType value accordingly (if it is being added to the errorMessage string)\n * @param fieldTypeMappingFn - a component specific lookup function that will tell us both if we need to prepend the field type to the SR panel message, and, if so, will retrieve the correct translation for the field type\n */\nexport const sortErrorsByLayout = ({ errors, i18n, layout, countrySpecificLabels, fieldTypeMappingFn }: SortErrorsObj): SortedErrorObject[] => {\n const SR_INDICATOR_PREFIX = process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'test' ? '' : '-sr'; // Useful for testing whether SR is reading out aria-live errors (sr) or aria-describedby ones\n\n // Create array of error objects, sorted by layout\n const sortedErrors: SortedErrorObject[] = Object.entries(errors).reduce((acc, [key, value]) => {\n if (value) {\n const errObj: ValidationRuleResult | SFError | GenericError = errors[key];\n // console.log('### utils::sortErrorsByLayout:: key', key, 'errObj', errObj);\n\n /**\n * Get error codes - these are used if we need to distinguish between showValidation & onBlur errors\n * - For a ValidationRuleResult or GenericError the error \"code\" is contained in the errorMessage prop.\n * - For an SFError the error \"code\" is contained in the error prop.\n */\n let errorCode: string;\n if (!(errObj instanceof ValidationRuleResult)) {\n errorCode = errObj.error; // is SFError\n } else {\n /** Special handling for Address~postalCode which can have be passed an object in the 'errorMessage' prop containing a country specific error */\n if (typeof errObj.errorMessage === 'object') {\n errorCode = errObj.errorMessage.translationKey; // is ValidationRuleResult w. country specific error\n } else {\n errorCode = errObj.errorMessage; // is ValidationRuleResult || GenericError || an as yet incorrectly formed error\n }\n }\n\n /**\n * Get corresponding error msg - a translated string we can place into the SRPanel\n * NOTE: the error object for a secured field already contains the error in a translated form (errorI18n).\n * For other fields we still need to translate it, so we use the errorMessage prop as a translation key\n */\n let errorMsg: string;\n if (!(errObj instanceof ValidationRuleResult) && 'errorI18n' in errObj) {\n errorMsg = errObj.errorI18n + SR_INDICATOR_PREFIX; // is SFError\n } else {\n /** Special handling for Address~postalCode (see above) */\n if (typeof errObj.errorMessage === 'object') {\n /* prettier-ignore */\n errorMsg = `${i18n.get(errObj.errorMessage.translationKey)} ${errObj.errorMessage.translationObject.values.format}${SR_INDICATOR_PREFIX}`; // is ValidationRuleResult w. country specific error\n } else {\n errorMsg = i18n.get(errObj.errorMessage) + SR_INDICATOR_PREFIX; // is ValidationRuleResult || GenericError || an as yet incorrectly formed error\n }\n }\n\n let errorMessage = errorMsg;\n /**\n * For some fields we might need to append the field type to the start of the error message (varies on a component by component basis)\n * - necessary for a11y, when we know the translated error msg doesn't contain a reference to the field it refers to\n * TODO - in the future this should be something we can get rid of once we align all our error texts and translations\n */\n if (fieldTypeMappingFn) {\n const fieldType: string = fieldTypeMappingFn(key, i18n, countrySpecificLabels); // Get translation for field type\n if (fieldType) errorMessage = `${fieldType}: ${errorMsg}`;\n }\n\n acc.push({ field: key, errorMessage, errorCode });\n\n if (layout) acc.sort((a, b) => layout.indexOf(a.field) - layout.indexOf(b.field));\n }\n return acc;\n }, []);\n\n return sortedErrors;\n};\n\n/**\n * Implemented as a partial, with an object containing the first 6 arguments; then the final argument, errors, is passed to the partial\n *\n * NOTE: using this generic error setting fny is only suitable when errors for the SRPanel are *only* generated by showValidation().\n * When errors are also generated onBlur, as the user leaves the input, the SR message generation becomes more complex - see CardInput as an example\n */\nexport const setSRMessagesFromErrors = (\n { i18n, fieldTypeMappingFn, SRPanelRef },\n { errors, isValidating, layout, countrySpecificLabels }\n): SetSRMessagesReturnObject => {\n const currentErrorsSortedByLayout = sortErrorsByLayout({\n errors,\n i18n,\n fieldTypeMappingFn,\n countrySpecificLabels,\n layout\n });\n\n const doLog = false;\n\n if (doLog) console.log('### setSRMessagesFromErrors::currentErrorsSortedByLayout:: ', currentErrorsSortedByLayout);\n\n if (currentErrorsSortedByLayout.length) {\n /** If validating i.e. \"on submit\" type event - then display all errors in the SR panel */\n if (isValidating) {\n const errorMsgArr: string[] = currentErrorsSortedByLayout.map(errObj => errObj.errorMessage);\n if (doLog) console.log('### setSRMessagesFromErrors:: #1 multiple errors:: (validating) errorMsgArr=', errorMsgArr);\n SRPanelRef.setMessages(errorMsgArr);\n\n const fieldListArr: string[] = currentErrorsSortedByLayout.map(errObj => errObj.field);\n return { currentErrorsSortedByLayout, action: ERROR_ACTION_FOCUS_FIELD, fieldToFocus: fieldListArr[0] };\n } else {\n // prettier-ignore\n if (doLog) console.log('### setSRMessagesFromErrors:: #3 on blur scenario:: not validating but there might be an error, either to set or to clear');\n SRPanelRef?.setMessages(null);\n\n return { currentErrorsSortedByLayout, action: ERROR_ACTION_BLUR_SCENARIO }; // on blur scenario: not validating but there might be an error, either to set or to clear\n }\n } else {\n if (doLog) console.log('### setSRMessagesFromErrors::componentDidUpdate:: #4 clearing errors:: NO currentErrorsSortedByLayout');\n SRPanelRef?.setMessages(null); // no errors - so clear SR panel\n return { currentErrorsSortedByLayout, action: 'none' };\n }\n};\n\nexport const enhanceErrorObjectKeys = (errorObj, keyPrefix) => {\n if (!errorObj) return null;\n const enhancedObj = Object.entries(errorObj).reduce((acc, [key, value]) => {\n if (value) {\n const newKey = `${keyPrefix}${key}`;\n acc[newKey] = value;\n }\n return acc;\n }, {});\n\n return enhancedObj;\n};\n"],"names":["getError","keyOrValue","rtnVal","ERROR_CODES","Object","keys","find","key","addAriaErrorTranslationsObject","i18n","errorCodeIdentifier","reduce","acc","item","value","includes","indexOf","get","addErrorTranslationsToObject","originalObj","fieldType","nuObj","fieldTypeToErrorCodeIdentifier","error","ENCRYPTED_CARD_NUMBER","ENCRYPTED_EXPIRY_DATE","ENCRYPTED_EXPIRY_MONTH","ENCRYPTED_EXPIRY_YEAR","ENCRYPTED_SECURITY_CODE","ENCRYPTED_PWD_FIELD","ENCRYPTED_BANK_ACCNT_NUMBER_FIELD","ENCRYPTED_BANK_LOCATION_FIELD","sortErrorsByLayout","errors","layout","countrySpecificLabels","fieldTypeMappingFn","SR_INDICATOR_PREFIX","entries","errObj","errorCode","errorMsg","ValidationRuleResult","errorMessage","translationKey","translationObject","values","format","errorI18n","push","field","sort","a","b","sortedErrors","setSRMessagesFromErrors","SRPanelRef","isValidating","currentErrorsSortedByLayout","length","errorMsgArr","map","setMessages","fieldListArr","action","ERROR_ACTION_FOCUS_FIELD","fieldToFocus","ERROR_ACTION_BLUR_SCENARIO","enhanceErrorObjectKeys","errorObj","keyPrefix","enhancedObj"],"mappings":"igBAoBaA,MAAAA,EAAYC,IAErB,IAAIC,EAASC,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Errors/utils.ts"],"sourcesContent":["import { ERROR_ACTION_BLUR_SCENARIO, ERROR_ACTION_FOCUS_FIELD, ErrorCodePrefixes, SF_ErrorCodes } from './constants';\nimport { SFError } from '../../components/Card/components/CardInput/types';\nimport { SortErrorsObj, SortedErrorObject, GenericError, SetSRMessagesReturnObject } from './types';\nimport { ValidationRuleResult } from '../../utils/Validator/ValidationRuleResult';\nimport {\n ENCRYPTED_BANK_ACCNT_NUMBER_FIELD,\n ENCRYPTED_BANK_LOCATION_FIELD,\n ENCRYPTED_CARD_NUMBER,\n ENCRYPTED_EXPIRY_DATE,\n ENCRYPTED_EXPIRY_MONTH,\n ENCRYPTED_EXPIRY_YEAR,\n ENCRYPTED_PWD_FIELD,\n ENCRYPTED_SECURITY_CODE\n} from '../../components/internal/SecuredFields/lib/configuration/constants';\nimport { AriaConfigObject } from '../../components/internal/SecuredFields/lib/types';\nimport type Language from '../../language';\n\n/**\n * Extract and translate all the errorCodes related to a specific securedField\n * @param i18n\n * @param errorCodeIdentifier - the identifier for which type of errorCodes we need to collect e.g. 'cc-num'\n */\nexport const getTranslatedErrors = (i18n: Language, errorCodeIdentifier: string): Record<SF_ErrorCodes, string> => {\n const transObj = Object.values(SF_ErrorCodes).reduce((acc, value) => {\n // Limit to errors related to specific sf\n if (value.includes(errorCodeIdentifier)) {\n acc[value] = i18n.get(value);\n }\n return acc;\n }, {}) as Record<SF_ErrorCodes, string>;\n\n return transObj;\n};\n\n/**\n * Adds a new error property to an object.\n * This error property is an object containing the translated errors, stored by code, that relate to the securedFields\n * @param originalObject - object we want to duplicate and enhance\n * @param i18n - an i18n object to use to get translations\n * @returns a duplicate of the original object with a new property: \"error\" whose value is a object containing the translated errors\n */\nexport const addErrorTranslationsToObject = (originalObj: AriaConfigObject, i18n: Language, fieldType: string): AriaConfigObject => {\n const nuObj: AriaConfigObject = { ...originalObj };\n\n const errorCodeIdentifier = fieldTypeToErrorCodeIdentifier(fieldType);\n nuObj.error = getTranslatedErrors(i18n, errorCodeIdentifier);\n\n return nuObj;\n};\n\nexport const getErrorMessageFromCode = (errorCode: string, codeMap: Record<string, string>): string => {\n let errMsg = errorCode;\n for (const [key, value] of Object.entries(codeMap)) {\n if (value === errorCode) {\n errMsg = key;\n break;\n }\n }\n return errMsg?.toLowerCase().replace(/[_.\\s]/g, '-');\n};\n\n/**\n * errorCodeIdentifiers must match the prefixes to the numbers in ERROR_CODES (Errors/constants.ts)\n * (Which in turn must match the keys in the translations files)\n */\nconst fieldTypeToErrorCodeIdentifier = (fieldType: string): string => {\n let errorCodeIdentifier;\n switch (fieldType) {\n case ENCRYPTED_CARD_NUMBER:\n errorCodeIdentifier = ErrorCodePrefixes.CC_NUM;\n break;\n case ENCRYPTED_EXPIRY_DATE:\n errorCodeIdentifier = ErrorCodePrefixes.CC_DAT;\n break;\n case ENCRYPTED_EXPIRY_MONTH:\n errorCodeIdentifier = ErrorCodePrefixes.CC_MTH;\n break;\n case ENCRYPTED_EXPIRY_YEAR:\n errorCodeIdentifier = ErrorCodePrefixes.CC_YR;\n break;\n case ENCRYPTED_SECURITY_CODE:\n errorCodeIdentifier = ErrorCodePrefixes.CC_CVC;\n break;\n case ENCRYPTED_PWD_FIELD:\n errorCodeIdentifier = ErrorCodePrefixes.KCP_PWD;\n break;\n case ENCRYPTED_BANK_ACCNT_NUMBER_FIELD:\n errorCodeIdentifier = ErrorCodePrefixes.ACH_NUM;\n break;\n case ENCRYPTED_BANK_LOCATION_FIELD:\n errorCodeIdentifier = ErrorCodePrefixes.ACH_LOC;\n break;\n default:\n }\n return errorCodeIdentifier;\n};\n\n/**\n * sortErrorsByLayout - takes a list of errors and a layout, and returns a sorted array of error objects with translated error messages\n *\n * @param errors - an object containing errors, referenced by field type\n * @param layout - a string[] controlling how the output error objects will be ordered. Required when it is known that the way the error object is populated can vary e.g. Card comp, &/or anything with a country selector\n * @param i18n - our internal Language mechanism\n * @param countrySpecificLabels - some errors are region specific, e.g. in the US \"postal code\" = \"zip code\", so map the fieldType value accordingly (if it is being added to the errorMessage string)\n * @param fieldTypeMappingFn - a component specific lookup function that will tell us both if we need to prepend the field type to the SR panel message, and, if so, will retrieve the correct translation for the field type\n */\nexport const sortErrorsByLayout = ({ errors, i18n, layout, countrySpecificLabels, fieldTypeMappingFn }: SortErrorsObj): SortedErrorObject[] => {\n const SR_INDICATOR_PREFIX = process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'test' ? '' : '-sr'; // Useful for testing whether SR is reading out aria-live errors (sr) or aria-describedby ones\n\n // Create array of error objects, sorted by layout\n const sortedErrors: SortedErrorObject[] = Object.entries(errors).reduce((acc, [key, value]) => {\n if (value) {\n const errObj: ValidationRuleResult | SFError | GenericError = errors[key];\n\n /**\n * Get error codes - these are used if we need to distinguish between showValidation & onBlur errors\n * - For a ValidationRuleResult or GenericError the error \"code\" is contained in the errorMessage prop.\n * - For an SFError the error \"code\" is contained in the error prop.\n */\n let errorCode: string;\n if (!(errObj instanceof ValidationRuleResult)) {\n errorCode = errObj.error; // is SFError\n } else {\n /** Special handling for Address~postalCode which can have be passed an object in the 'errorMessage' prop */\n if (typeof errObj.errorMessage === 'object') {\n errorCode = errObj.errorMessage.translationKey; // is ValidationRuleResult w. country specific error\n } else {\n errorCode = errObj.errorMessage; // is ValidationRuleResult || GenericError || an as yet incorrectly formed error\n }\n }\n\n /**\n * Get corresponding error msg - a translated string we can place into the SRPanel\n * NOTE: the error object for a secured field already contains the error in a translated form (errorI18n).\n * For other fields we still need to translate it, so we use the errorMessage prop as a translation key\n */\n let errorMsg: string;\n if (!(errObj instanceof ValidationRuleResult) && 'errorI18n' in errObj) {\n errorMsg = errObj.errorI18n + SR_INDICATOR_PREFIX; // is SFError\n } else {\n /** Special handling for Address~postalCode where the errorMessage comes as an object containing the details of the country specific format that should have been used for the postcode */\n if (typeof errObj.errorMessage === 'object') {\n /* prettier-ignore */\n errorMsg = `${i18n.get(errObj.errorMessage.translationKey)} ${errObj.errorMessage.translationObject.values.format}${SR_INDICATOR_PREFIX}`; // is ValidationRuleResult w. country specific error\n } else {\n const mappedLabel = fieldTypeMappingFn ? fieldTypeMappingFn(key, i18n, countrySpecificLabels) : '';\n errorMsg = i18n.get(errObj.errorMessage, { values: { label: mappedLabel } }) + SR_INDICATOR_PREFIX; // is ValidationRuleResult || GenericError || an as yet incorrectly formed error\n }\n }\n\n acc.push({ field: key, errorMessage: errorMsg, errorCode });\n\n if (layout) acc.sort((a, b) => layout.indexOf(a.field) - layout.indexOf(b.field));\n }\n return acc;\n }, []);\n\n return sortedErrors;\n};\n\n/**\n * Implemented as a partial, with an object containing the first 6 arguments; then the final argument, errors, is passed to the partial\n *\n * NOTE: using this generic error setting fny is only suitable when errors for the SRPanel are *only* generated by showValidation().\n * When errors are also generated onBlur, as the user leaves the input, the SR message generation becomes more complex - see CardInput as an example\n */\nexport const setSRMessagesFromErrors = (\n { i18n, fieldTypeMappingFn, SRPanelRef },\n { errors, isValidating, layout, countrySpecificLabels }\n): SetSRMessagesReturnObject => {\n const currentErrorsSortedByLayout = sortErrorsByLayout({\n errors,\n i18n,\n fieldTypeMappingFn,\n countrySpecificLabels,\n layout\n });\n\n const doLog = false;\n\n if (doLog) console.log('### setSRMessagesFromErrors::currentErrorsSortedByLayout:: ', currentErrorsSortedByLayout);\n\n if (currentErrorsSortedByLayout.length) {\n /** If validating i.e. \"on submit\" type event - then display all errors in the SR panel */\n if (isValidating) {\n const errorMsgArr: string[] = currentErrorsSortedByLayout.map(errObj => errObj.errorMessage);\n if (doLog) console.log('### setSRMessagesFromErrors:: #1 multiple errors:: (validating) errorMsgArr=', errorMsgArr);\n SRPanelRef.setMessages(errorMsgArr);\n\n const fieldListArr: string[] = currentErrorsSortedByLayout.map(errObj => errObj.field);\n return { currentErrorsSortedByLayout, action: ERROR_ACTION_FOCUS_FIELD, fieldToFocus: fieldListArr[0] };\n } else {\n // prettier-ignore\n if (doLog) console.log('### setSRMessagesFromErrors:: #3 on blur scenario:: not validating but there might be an error, either to set or to clear');\n SRPanelRef?.setMessages(null);\n\n return { currentErrorsSortedByLayout, action: ERROR_ACTION_BLUR_SCENARIO }; // on blur scenario: not validating but there might be an error, either to set or to clear\n }\n } else {\n if (doLog) console.log('### setSRMessagesFromErrors::componentDidUpdate:: #4 clearing errors:: NO currentErrorsSortedByLayout');\n SRPanelRef?.setMessages(null); // no errors - so clear SR panel\n return { currentErrorsSortedByLayout, action: 'none' };\n }\n};\n\nexport const enhanceErrorObjectKeys = (errorObj, keyPrefix) => {\n if (!errorObj) return null;\n const enhancedObj = Object.entries(errorObj).reduce((acc, [key, value]) => {\n if (value) {\n const newKey = `${keyPrefix}${key}`;\n acc[newKey] = value;\n }\n return acc;\n }, {});\n\n return enhancedObj;\n};\n"],"names":["getTranslatedErrors","i18n","errorCodeIdentifier","Object","values","SF_ErrorCodes","reduce","acc","value","includes","get","addErrorTranslationsToObject","originalObj","fieldType","nuObj","fieldTypeToErrorCodeIdentifier","error","getErrorMessageFromCode","errorCode","codeMap","errMsg","key","entries","toLowerCase","replace","ENCRYPTED_CARD_NUMBER","ErrorCodePrefixes","CC_NUM","ENCRYPTED_EXPIRY_DATE","CC_DAT","ENCRYPTED_EXPIRY_MONTH","CC_MTH","ENCRYPTED_EXPIRY_YEAR","CC_YR","ENCRYPTED_SECURITY_CODE","CC_CVC","ENCRYPTED_PWD_FIELD","KCP_PWD","ENCRYPTED_BANK_ACCNT_NUMBER_FIELD","ACH_NUM","ENCRYPTED_BANK_LOCATION_FIELD","ACH_LOC","sortErrorsByLayout","errors","layout","countrySpecificLabels","fieldTypeMappingFn","SR_INDICATOR_PREFIX","errObj","errorMsg","ValidationRuleResult","errorMessage","translationKey","translationObject","format","mappedLabel","label","errorI18n","push","field","sort","a","b","indexOf","sortedErrors","setSRMessagesFromErrors","SRPanelRef","isValidating","currentErrorsSortedByLayout","length","errorMsgArr","map","setMessages","fieldListArr","action","ERROR_ACTION_FOCUS_FIELD","fieldToFocus","ERROR_ACTION_BLUR_SCENARIO","enhanceErrorObjectKeys","error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,EAAKb,MAC5D,GAAIA,EAAO,CAEPD,EADe,GAAGyE,IAAY3D,KAChBb,CAClB,CACA,OAAOD,CAAAA,GACR,CAAC,EAEG0E"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{get3DS2FlowProps as e}from"../../../components/ThreeDS2/components/utils.js";import t from"../../../utils/uuid.js";const o=(e,o,n,r)=>{const i=o.getComponent(n);if(i)return new i(e,{...r,id:`${n}-${t()}`});console.warn(`Action Element of type '${n}' not found in the registry`)},n=e=>(t,n,r,i)=>{const s={...i,...r,onComplete:i.onAdditionalDetails,onError:i.onError,statusType:e};return o(t,n,r.paymentMethodType,s)},r={redirect:(e,t,n,r)=>{const i={...r,...n,statusType:"redirect"};return o(e,t,"redirect",i)},threeDS2:(t,n,r,i)=>{const s="fingerprint"===r.subtype?"threeDS2DeviceFingerprint":"threeDS2Challenge",a="fingerprint"===r.subtype||i.isMDFlow?r.paymentData:r.authorisationToken,l={core:t,token:r.token,paymentData:a,onActionHandled:i.onActionHandled,onComplete:i.isMDFlow?i.onComplete:i.onAdditionalDetails,onError:i.onError,isDropin:!!i.isDropin,loadingContext:i.loadingContext,clientKey:i.clientKey,paymentMethodType:i.paymentMethodType,challengeWindowSize:i.challengeWindowSize,isMDFlow:i.isMDFlow,...e(r.subtype,i)};return o(t,n,s,l)},voucher:n("custom"),qrCode:n("custom"),await:n("custom"),bankTransfer:n("custom"),sdk:n("custom")};export{r as default};
|
|
1
|
+
import{get3DS2FlowProps as e}from"../../../components/ThreeDS2/components/utils.js";import t from"../../../utils/uuid.js";const o=(e,o,n,r)=>{const i=o.getComponent(n);if(i)return new i(e,{...r,id:`${n}-${t()}`});console.warn(`Action Element of type '${n}' not found in the registry`)},n=e=>(t,n,r,i)=>{const s={...i,...r,onComplete:i.onAdditionalDetails,onError:i.onError,statusType:e};return o(t,n,r.paymentMethodType,s)},r={redirect:(e,t,n,r)=>{const i={...r,...n,statusType:"redirect"};return o(e,t,"redirect",i)},threeDS2:(t,n,r,i)=>{const s="fingerprint"===r.subtype?"threeDS2DeviceFingerprint":"threeDS2Challenge",a="fingerprint"===r.subtype||i.isMDFlow?r.paymentData:r.authorisationToken,l={core:t,token:r.token,paymentData:a,onActionHandled:i.onActionHandled,onComplete:i.isMDFlow?i.onComplete:i.onAdditionalDetails,onError:i.onError,isDropin:!!i.isDropin,loadingContext:i.loadingContext,clientKey:i.clientKey,paymentMethodType:i.paymentMethodType,challengeWindowSize:i.challengeWindowSize,isMDFlow:i.isMDFlow,modules:{analytics:i.modules?.analytics},...e(r.subtype,i)};return o(t,n,s,l)},voucher:n("custom"),qrCode:n("custom"),await:n("custom"),bankTransfer:n("custom"),sdk:n("custom")};export{r as default};
|
|
2
2
|
//# sourceMappingURL=actionTypes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actionTypes.js","sources":["../../../../../src/core/ProcessResponse/PaymentAction/actionTypes.ts"],"sourcesContent":["import { PaymentAction } from '../../../types/global-types';\nimport { get3DS2FlowProps } from '../../../components/ThreeDS2/components/utils';\nimport uuid from '../../../utils/uuid';\nimport type { IRegistry } from '../../core.registry';\nimport type { ICore } from '../../types';\n\nconst createComponent = (core: ICore, registry: IRegistry, componentType, props) => {\n const Element = registry.getComponent(componentType);\n\n if (!Element) {\n console.warn(`Action Element of type '${componentType}' not found in the registry`);\n return;\n }\n\n return new Element(core, { ...props, id: `${componentType}-${uuid()}` });\n};\n\nconst getActionHandler = statusType => {\n return (core: ICore, registry: IRegistry, action: PaymentAction, props) => {\n const config = {\n ...props,\n ...action,\n onComplete: props.onAdditionalDetails,\n onError: props.onError,\n statusType\n };\n\n return createComponent(core, registry, action.paymentMethodType, config);\n };\n};\n\nconst actionTypes = {\n redirect: (core: ICore, registry, action: PaymentAction, props) => {\n const config = {\n ...props,\n ...action,\n statusType: 'redirect'\n };\n\n return createComponent(core, registry, 'redirect', config);\n },\n\n threeDS2: (core: ICore, registry, action: PaymentAction, props) => {\n const componentType = action.subtype === 'fingerprint' ? 'threeDS2DeviceFingerprint' : 'threeDS2Challenge';\n\n const paymentData = action.subtype === 'fingerprint' || props.isMDFlow ? action.paymentData : action.authorisationToken;\n\n const config = {\n // Props common to both flows\n core: core,\n token: action.token,\n paymentData,\n onActionHandled: props.onActionHandled,\n onComplete: props.isMDFlow ? props.onComplete : props.onAdditionalDetails,\n onError: props.onError,\n isDropin: !!props.isDropin,\n loadingContext: props.loadingContext,\n clientKey: props.clientKey,\n paymentMethodType: props.paymentMethodType,\n challengeWindowSize: props.challengeWindowSize, // always pass challengeWindowSize in case it's been set directly in the handleAction config object\n isMDFlow: props.isMDFlow,\n\n // Props unique to a particular flow\n ...get3DS2FlowProps(action.subtype, props)\n };\n\n return createComponent(core, registry, componentType, config);\n },\n\n voucher: getActionHandler('custom'),\n qrCode: getActionHandler('custom'),\n await: getActionHandler('custom'),\n bankTransfer: getActionHandler('custom'),\n sdk: getActionHandler('custom')\n} as const;\n\nexport default actionTypes;\n"],"names":["createComponent","core","registry","componentType","props","Element","getComponent","id","uuid","console","warn","getActionHandler","statusType","action","config","onComplete","onAdditionalDetails","onError","paymentMethodType","actionTypes","redirect","threeDS2","subtype","paymentData","isMDFlow","authorisationToken","token","onActionHandled","isDropin","loadingContext","clientKey","challengeWindowSize","get3DS2FlowProps","voucher","qrCode","await","bankTransfer","sdk"],"mappings":"0HAMA,MAAMA,EAAkB,CAACC,EAAaC,EAAqBC,EAAeC,KACtE,MAAMC,EAAUH,EAASI,aAAaH,GAEtC,GAAKE,EAKL,OAAO,IAAIA,EAAQJ,EAAM,IAAKG,EAAOG,GAAI,GAAGJ,KAAiBK,QAJzDC,QAAQC,KAAK,2BAA2BP,+BAI0B,EAGpEQ,EAAmBC,GACd,CAACX,EAAaC,EAAqBW,EAAuBT,KAC7D,MAAMU,EAAS,IACRV,KACAS,EACHE,WAAYX,EAAMY,oBAClBC,QAASb,EAAMa,QACfL,cAGJ,OAAOZ,EAAgBC,EAAMC,EAAUW,EAAOK,kBAAmBJ,EAAAA,EAInEK,EAAc,CAChBC,SAAU,CAACnB,EAAaC,EAAUW,EAAuBT,KACrD,MAAMU,EAAS,IACRV,KACAS,EACHD,WAAY,YAGhB,OAAOZ,EAAgBC,EAAMC,EAAU,WAAYY,EAAAA,EAGvDO,SAAU,CAACpB,EAAaC,EAAUW,EAAuBT,KACrD,MAAMD,EAAmC,gBAAnBU,EAAOS,QAA4B,4BAA8B,oBAEjFC,EAAiC,gBAAnBV,EAAOS,SAA6BlB,EAAMoB,SAAWX,EAAOU,YAAcV,EAAOY,mBAE/FX,EAAS,CAEXb,KAAMA,EACNyB,MAAOb,EAAOa,MACdH,cACAI,gBAAiBvB,EAAMuB,gBACvBZ,WAAYX,EAAMoB,SAAWpB,EAAMW,WAAaX,EAAMY,oBACtDC,QAASb,EAAMa,QACfW,WAAYxB,EAAMwB,SAClBC,eAAgBzB,EAAMyB,eACtBC,UAAW1B,EAAM0B,UACjBZ,kBAAmBd,EAAMc,kBACzBa,oBAAqB3B,EAAM2B,oBAC3BP,SAAUpB,EAAMoB,
|
|
1
|
+
{"version":3,"file":"actionTypes.js","sources":["../../../../../src/core/ProcessResponse/PaymentAction/actionTypes.ts"],"sourcesContent":["import { PaymentAction } from '../../../types/global-types';\nimport { get3DS2FlowProps } from '../../../components/ThreeDS2/components/utils';\nimport uuid from '../../../utils/uuid';\nimport type { IRegistry } from '../../core.registry';\nimport type { ICore } from '../../types';\n\nconst createComponent = (core: ICore, registry: IRegistry, componentType, props) => {\n const Element = registry.getComponent(componentType);\n\n if (!Element) {\n console.warn(`Action Element of type '${componentType}' not found in the registry`);\n return;\n }\n\n return new Element(core, { ...props, id: `${componentType}-${uuid()}` });\n};\n\nconst getActionHandler = statusType => {\n return (core: ICore, registry: IRegistry, action: PaymentAction, props) => {\n const config = {\n ...props,\n ...action,\n onComplete: props.onAdditionalDetails,\n onError: props.onError,\n statusType\n };\n\n return createComponent(core, registry, action.paymentMethodType, config);\n };\n};\n\nconst actionTypes = {\n redirect: (core: ICore, registry, action: PaymentAction, props) => {\n const config = {\n ...props,\n ...action,\n statusType: 'redirect'\n };\n\n return createComponent(core, registry, 'redirect', config);\n },\n\n threeDS2: (core: ICore, registry, action: PaymentAction, props) => {\n const componentType = action.subtype === 'fingerprint' ? 'threeDS2DeviceFingerprint' : 'threeDS2Challenge';\n\n const paymentData = action.subtype === 'fingerprint' || props.isMDFlow ? action.paymentData : action.authorisationToken;\n\n const config = {\n // Props common to both flows\n core: core,\n token: action.token,\n paymentData,\n onActionHandled: props.onActionHandled,\n onComplete: props.isMDFlow ? props.onComplete : props.onAdditionalDetails,\n onError: props.onError,\n isDropin: !!props.isDropin,\n loadingContext: props.loadingContext,\n clientKey: props.clientKey,\n paymentMethodType: props.paymentMethodType,\n challengeWindowSize: props.challengeWindowSize, // always pass challengeWindowSize in case it's been set directly in the handleAction config object\n isMDFlow: props.isMDFlow,\n modules: { analytics: props.modules?.analytics },\n\n // Props unique to a particular flow\n ...get3DS2FlowProps(action.subtype, props)\n };\n\n return createComponent(core, registry, componentType, config);\n },\n\n voucher: getActionHandler('custom'),\n qrCode: getActionHandler('custom'),\n await: getActionHandler('custom'),\n bankTransfer: getActionHandler('custom'),\n sdk: getActionHandler('custom')\n} as const;\n\nexport default actionTypes;\n"],"names":["createComponent","core","registry","componentType","props","Element","getComponent","id","uuid","console","warn","getActionHandler","statusType","action","config","onComplete","onAdditionalDetails","onError","paymentMethodType","actionTypes","redirect","threeDS2","subtype","paymentData","isMDFlow","authorisationToken","token","onActionHandled","isDropin","loadingContext","clientKey","challengeWindowSize","modules","analytics","get3DS2FlowProps","voucher","qrCode","await","bankTransfer","sdk"],"mappings":"0HAMA,MAAMA,EAAkB,CAACC,EAAaC,EAAqBC,EAAeC,KACtE,MAAMC,EAAUH,EAASI,aAAaH,GAEtC,GAAKE,EAKL,OAAO,IAAIA,EAAQJ,EAAM,IAAKG,EAAOG,GAAI,GAAGJ,KAAiBK,QAJzDC,QAAQC,KAAK,2BAA2BP,+BAI0B,EAGpEQ,EAAmBC,GACd,CAACX,EAAaC,EAAqBW,EAAuBT,KAC7D,MAAMU,EAAS,IACRV,KACAS,EACHE,WAAYX,EAAMY,oBAClBC,QAASb,EAAMa,QACfL,cAGJ,OAAOZ,EAAgBC,EAAMC,EAAUW,EAAOK,kBAAmBJ,EAAAA,EAInEK,EAAc,CAChBC,SAAU,CAACnB,EAAaC,EAAUW,EAAuBT,KACrD,MAAMU,EAAS,IACRV,KACAS,EACHD,WAAY,YAGhB,OAAOZ,EAAgBC,EAAMC,EAAU,WAAYY,EAAAA,EAGvDO,SAAU,CAACpB,EAAaC,EAAUW,EAAuBT,KACrD,MAAMD,EAAmC,gBAAnBU,EAAOS,QAA4B,4BAA8B,oBAEjFC,EAAiC,gBAAnBV,EAAOS,SAA6BlB,EAAMoB,SAAWX,EAAOU,YAAcV,EAAOY,mBAE/FX,EAAS,CAEXb,KAAMA,EACNyB,MAAOb,EAAOa,MACdH,cACAI,gBAAiBvB,EAAMuB,gBACvBZ,WAAYX,EAAMoB,SAAWpB,EAAMW,WAAaX,EAAMY,oBACtDC,QAASb,EAAMa,QACfW,WAAYxB,EAAMwB,SAClBC,eAAgBzB,EAAMyB,eACtBC,UAAW1B,EAAM0B,UACjBZ,kBAAmBd,EAAMc,kBACzBa,oBAAqB3B,EAAM2B,oBAC3BP,SAAUpB,EAAMoB,SAChBQ,QAAS,CAAEC,UAAW7B,EAAM4B,SAASC,cAGlCC,EAAiBrB,EAAOS,QAASlB,IAGxC,OAAOJ,EAAgBC,EAAMC,EAAUC,EAAeW,EAAAA,EAG1DqB,QAASxB,EAAiB,UAC1ByB,OAAQzB,EAAiB,UACzB0B,MAAO1B,EAAiB,UACxB2B,aAAc3B,EAAiB,UAC/B4B,IAAK5B,EAAiB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{httpPost as e}from"../http.js";import t from"../../../utils/Storage.js";const o='WARNING: Failed to retrieve "checkoutAttemptId". Consequently, analytics will not be available for this payment. The payment process, however, will not be affected.';const n=({analyticsContext:n,clientKey:r,locale:i,analyticsPath:c})=>{let
|
|
1
|
+
import{httpPost as e}from"../http.js";import t from"../../../utils/Storage.js";const o='WARNING: Failed to retrieve "checkoutAttemptId". Consequently, analytics will not be available for this payment. The payment process, however, will not be affected.';const n=({analyticsContext:n,clientKey:r,locale:i,analyticsPath:a,bundleType:c})=>{let l;const s={errorLevel:"fatal",loadingContext:n,path:`${a}?clientKey=${r}`};return n=>{const a={version:"6.0.0-alpha.3",channel:"Web",platform:"Web",buildType:c,locale:i,referrer:window.location.href,screenWidth:window.screen.width,...n};if(l)return l;if(!r)return Promise.reject("no-client-key");const m=new t("checkout-attempt-id","sessionStorage"),p=m.get();return function(e){if(!e?.id)return!1;const t=Date.now()-9e5;return e.timestamp>t}(p)?Promise.resolve(p.id):(l=e(s,a).then((e=>{if(e?.checkoutAttemptId)return m.set({id:e.checkoutAttemptId,timestamp:Date.now()}),e.checkoutAttemptId})).catch((()=>Promise.reject(o))),l)}};export{o as FAILURE_MSG,n as default};
|
|
2
2
|
//# sourceMappingURL=collect-id.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collect-id.js","sources":["../../../../../src/core/Services/analytics/collect-id.ts"],"sourcesContent":["import { httpPost } from '../http';\nimport Storage from '../../../utils/Storage';\nimport { CheckoutAttemptIdSession, CollectIdProps, TelemetryEvent } from './types';\n\nexport const FAILURE_MSG =\n 'WARNING: Failed to retrieve \"checkoutAttemptId\". Consequently, analytics will not be available for this payment. The payment process, however, will not be affected.';\n\n/**\n * If the checkout attempt ID was stored more than fifteen minutes ago, then we should request a new ID.\n * More here: COWEB-1099\n */\nfunction confirmSessionDurationIsMaxFifteenMinutes(checkoutAttemptIdSession: CheckoutAttemptIdSession): boolean {\n if (!checkoutAttemptIdSession?.id) return false;\n\n const fifteenMinInMs = 1000 * 60 * 15;\n const fifteenMinAgoTimestamp = Date.now() - fifteenMinInMs;\n return checkoutAttemptIdSession.timestamp > fifteenMinAgoTimestamp;\n}\n\n/**\n * Send an event to Adyen with some basic telemetry info and receive a checkoutAttemptId in response\n * @param config - object containing values needed to calculate the url for the request; and also some that need to be serialized and included in the body of request\n * @returns a function returning a promise containing the response of the call (an object containing a checkoutAttemptId property)\n */\n// const collectId = ({ analyticsContext, clientKey, locale, amount }: CollectIdProps) => { // TODO - amount will be supported in the future\nconst collectId = ({ analyticsContext, clientKey, locale, analyticsPath }: CollectIdProps) => {\n let promise;\n\n const options = {\n errorLevel: 'fatal' as const, // ensure our catch block is called\n loadingContext: analyticsContext,\n path: `${analyticsPath}?clientKey=${clientKey}`\n };\n\n return (event): Promise<string> => {\n const telemetryEvent: TelemetryEvent = {\n // amount, // TODO will be supported in the future\n version: process.env.VERSION,\n // The data team want both platform & channel properties:\n channel: 'Web',\n platform: 'Web',\n buildType:
|
|
1
|
+
{"version":3,"file":"collect-id.js","sources":["../../../../../src/core/Services/analytics/collect-id.ts"],"sourcesContent":["import { httpPost } from '../http';\nimport Storage from '../../../utils/Storage';\nimport { CheckoutAttemptIdSession, CollectIdProps, TelemetryEvent } from './types';\n\nexport const FAILURE_MSG =\n 'WARNING: Failed to retrieve \"checkoutAttemptId\". Consequently, analytics will not be available for this payment. The payment process, however, will not be affected.';\n\n/**\n * If the checkout attempt ID was stored more than fifteen minutes ago, then we should request a new ID.\n * More here: COWEB-1099\n */\nfunction confirmSessionDurationIsMaxFifteenMinutes(checkoutAttemptIdSession: CheckoutAttemptIdSession): boolean {\n if (!checkoutAttemptIdSession?.id) return false;\n\n const fifteenMinInMs = 1000 * 60 * 15;\n const fifteenMinAgoTimestamp = Date.now() - fifteenMinInMs;\n return checkoutAttemptIdSession.timestamp > fifteenMinAgoTimestamp;\n}\n\n/**\n * Send an event to Adyen with some basic telemetry info and receive a checkoutAttemptId in response\n * @param config - object containing values needed to calculate the url for the request; and also some that need to be serialized and included in the body of request\n * @returns a function returning a promise containing the response of the call (an object containing a checkoutAttemptId property)\n */\n// const collectId = ({ analyticsContext, clientKey, locale, amount }: CollectIdProps) => { // TODO - amount will be supported in the future\nconst collectId = ({ analyticsContext, clientKey, locale, analyticsPath, bundleType }: CollectIdProps) => {\n let promise;\n\n const options = {\n errorLevel: 'fatal' as const, // ensure our catch block is called\n loadingContext: analyticsContext,\n path: `${analyticsPath}?clientKey=${clientKey}`\n };\n\n return (event): Promise<string> => {\n const telemetryEvent: TelemetryEvent = {\n // amount, // TODO will be supported in the future\n version: process.env.VERSION,\n // The data team want both platform & channel properties:\n channel: 'Web',\n platform: 'Web',\n buildType: bundleType,\n locale,\n referrer: window.location.href,\n screenWidth: window.screen.width,\n ...event\n };\n\n if (promise) return promise; // Prevents multiple standalone components on the same page from making multiple calls to collect a checkoutAttemptId\n if (!clientKey) return Promise.reject('no-client-key');\n\n const storage = new Storage<CheckoutAttemptIdSession>('checkout-attempt-id', 'sessionStorage');\n const checkoutAttemptIdSession = storage.get();\n\n // In some cases, e.g. where the merchant has redirected the shopper and then returned them to checkout, we still have a valid checkoutAttemptId\n // so there is no need for the re-initialised Checkout to generate another one\n if (confirmSessionDurationIsMaxFifteenMinutes(checkoutAttemptIdSession)) {\n return Promise.resolve(checkoutAttemptIdSession.id);\n }\n\n promise = httpPost(options, telemetryEvent)\n .then(conversion => {\n if (conversion?.checkoutAttemptId) {\n storage.set({ id: conversion.checkoutAttemptId, timestamp: Date.now() });\n return conversion.checkoutAttemptId;\n }\n return undefined;\n })\n .catch(() => {\n return Promise.reject(FAILURE_MSG);\n });\n\n return promise;\n };\n};\n\nexport default collectId;\n"],"names":["FAILURE_MSG","collectId","analyticsContext","clientKey","locale","analyticsPath","bundleType","promise","options","errorLevel","loadingContext","path","event","telemetryEvent","version","channel","platform","buildType","referrer","window","location","href","screenWidth","screen","width","Promise","reject","storage","Storage","checkoutAttemptIdSession","get","id","fifteenMinAgoTimestamp","Date","now","timestamp","confirmSessionDurationIsMaxFifteenMinutes","resolve","httpPost","then","conversion","checkoutAttemptId","set","undefined","catch"],"mappings":"+EAIO,MAAMA,EACT,uKAoBJ,MAAMC,EAAY,EAAGC,mBAAkBC,YAAWC,SAAQC,gBAAeC,iBACrE,IAAIC,EAEJ,MAAMC,EAAU,CACZC,WAAY,QACZC,eAAgBR,EAChBS,KAAM,GAAGN,eAA2BF,KAGxC,OAAQS,IACJ,MAAMC,EAAiC,CAEnCC,QAAS,gBAETC,QAAS,MACTC,SAAU,MACVC,UAAWX,EACXF,SACAc,SAAUC,OAAOC,SAASC,KAC1BC,YAAaH,OAAOI,OAAOC,SACxBZ,GAGP,GAAIL,EAAS,OAAOA,EACpB,IAAKJ,EAAW,OAAOsB,QAAQC,OAAO,iBAEtC,MAAMC,EAAU,IAAIC,EAAkC,sBAAuB,kBACvEC,EAA2BF,EAAQG,MAIzC,OA7CR,SAAmDD,GAC/C,IAAKA,GAA0BE,GAAI,OAAO,EAE1C,MACMC,EAAyBC,KAAKC,MADb,IAEvB,OAAOL,EAAyBM,UAAYH,CAChD,CAuCYI,CAA0CP,GACnCJ,QAAQY,QAAQR,EAAyBE,KAGpDxB,EAAU+B,EAAS9B,EAASK,GACvB0B,MAAKC,IACF,GAAIA,GAAYC,kBAEZ,OADAd,EAAQe,IAAI,CAAEX,GAAIS,EAAWC,kBAAmBN,UAAWF,KAAKC,QACzDM,EAAWC,iBAEfE,IAEVC,OAAM,IACInB,QAAQC,OAAO1B,KAGvBO,EAAAA,CACX"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=e=>o=>{const n={version:"6.0.0-alpha.
|
|
1
|
+
const e=e=>o=>{const n={version:"6.0.0-alpha.3",payload_version:1,platform:"web",locale:e.locale,...o},a=Object.keys(n).map((e=>`${encodeURIComponent(e)}=${encodeURIComponent(n[e])}`)).join("&");(new Image).src=`${e.loadingContext}images/analytics.png?${a}`};export{e as default};
|
|
2
2
|
//# sourceMappingURL=log-event.js.map
|
package/dist/es/core/config.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e="https://checkoutshopper-live.adyen.com/checkoutshopper/",o=["amount","secondaryAmount","countryCode","environment","loadingContext","i18n","modules","order","session","clientKey","showPayButton","redirectFromTopWhenInIframe","onPaymentCompleted","onPaymentFailed","beforeRedirect","beforeSubmit","onSubmit","onActionHandled","onAdditionalDetails","onChange","onError","onBalanceCheck","onOrderRequest","onOrderUpdated","
|
|
1
|
+
const e="https://checkoutshopper-live.adyen.com/checkoutshopper/",o=["amount","secondaryAmount","countryCode","environment","loadingContext","i18n","modules","order","session","clientKey","showPayButton","redirectFromTopWhenInIframe","onPaymentCompleted","onPaymentFailed","beforeRedirect","beforeSubmit","onSubmit","onActionHandled","onAdditionalDetails","onChange","onError","onBalanceCheck","onOrderRequest","onOrderUpdated","onPaymentMethodsRequest"],n=6e4;export{n as DEFAULT_HTTP_TIMEOUT,e as FALLBACK_CONTEXT,o as GENERIC_OPTIONS};
|
|
2
2
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sources":["../../../src/core/config.ts"],"sourcesContent":["/**\n * FALLBACK_CONTEXT\n */\nexport const FALLBACK_CONTEXT = 'https://checkoutshopper-live.adyen.com/checkoutshopper/';\n\nexport const GENERIC_OPTIONS = [\n 'amount',\n 'secondaryAmount',\n 'countryCode',\n 'environment',\n 'loadingContext',\n 'i18n',\n 'modules',\n 'order',\n 'session',\n 'clientKey',\n 'showPayButton',\n 'redirectFromTopWhenInIframe',\n\n // Events\n 'onPaymentCompleted',\n 'onPaymentFailed',\n 'beforeRedirect',\n 'beforeSubmit',\n 'onSubmit',\n 'onActionHandled',\n 'onAdditionalDetails',\n 'onChange',\n 'onError',\n 'onBalanceCheck',\n 'onOrderRequest',\n 'onOrderUpdated',\n '
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../../../src/core/config.ts"],"sourcesContent":["/**\n * FALLBACK_CONTEXT\n */\nexport const FALLBACK_CONTEXT = 'https://checkoutshopper-live.adyen.com/checkoutshopper/';\n\nexport const GENERIC_OPTIONS = [\n 'amount',\n 'secondaryAmount',\n 'countryCode',\n 'environment',\n 'loadingContext',\n 'i18n',\n 'modules',\n 'order',\n 'session',\n 'clientKey',\n 'showPayButton',\n 'redirectFromTopWhenInIframe',\n\n // Events\n 'onPaymentCompleted',\n 'onPaymentFailed',\n 'beforeRedirect',\n 'beforeSubmit',\n 'onSubmit',\n 'onActionHandled',\n 'onAdditionalDetails',\n 'onChange',\n 'onError',\n 'onBalanceCheck',\n 'onOrderRequest',\n 'onOrderUpdated',\n 'onPaymentMethodsRequest'\n];\n\nexport const DEFAULT_HTTP_TIMEOUT = 60000;\n\nexport default {\n FALLBACK_CONTEXT,\n GENERIC_OPTIONS,\n DEFAULT_HTTP_TIMEOUT\n};\n"],"names":["FALLBACK_CONTEXT","GENERIC_OPTIONS","DEFAULT_HTTP_TIMEOUT"],"mappings":"AAGaA,MAAAA,EAAmB,0DAEnBC,EAAkB,CAC3B,SACA,kBACA,cACA,cACA,iBACA,OACA,UACA,QACA,UACA,YACA,gBACA,8BAGA,qBACA,kBACA,iBACA,eACA,WACA,kBACA,sBACA,WACA,UACA,iBACA,iBACA,iBACA,2BAGSC,EAAuB"}
|
package/dist/es/core/core.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Language as t}from"../language/Language.js";import o from"./RiskModule/RiskModule.js";import e from"./ProcessResponse/PaymentMethods/PaymentMethods.js";import{getComponentForAction as s}from"./ProcessResponse/PaymentAction/PaymentAction.js";import{resolveEnvironment as i,resolveCDNEnvironment as n,resolveAnalyticsEnvironment as
|
|
1
|
+
import{Language as t}from"../language/Language.js";import o from"./RiskModule/RiskModule.js";import e from"./ProcessResponse/PaymentMethods/PaymentMethods.js";import{getComponentForAction as s}from"./ProcessResponse/PaymentAction/PaymentAction.js";import{resolveEnvironment as i,resolveCDNEnvironment as n,resolveAnalyticsEnvironment as a}from"./Environment/Environment.js";import r from"./Analytics/Analytics.js";import{assertConfigurationPropertiesAreValid as h,processGlobalOptions as p}from"./utils.js";import c from"./CheckoutSession/CheckoutSession.js";import{hasOwnProperty as l}from"../utils/hasOwnProperty.js";import{Resources as m}from"./Context/Resources.js";import{SRPanel as d}from"./Errors/SRPanel.js";import u from"./core.registry.js";import{sanitizeResponse as y,verifyPaymentDidNotFail as C,cleanupFinalResult as f}from"../components/internal/UIElement/utils.js";import g,{IMPLEMENTATION_ERROR as w}from"./Errors/AdyenCheckoutError.js";import{ANALYTICS_ACTION_STR as b}from"./Analytics/constants.js";import{THREEDS2_FULL as E}from"../components/ThreeDS2/config.js";import{DEFAULT_LOCALE as v}from"../language/config.js";class x{session;paymentMethodsResponse;modules;options;loadingContext;cdnContext;analyticsContext;components=[];static metadata={version:"6.0.0-alpha.3",revision:"f9b5e5c",branch:"HEAD",buildId:"@adyen/adyen-web-5505d2f0-a458-4ac4-9a16-f0086956fe42",bundleType:"esm"};static registry=u;static setBundleType(t){x.metadata.bundleType=t}static register(...t){u.add(...t)}register(...t){u.add(...t)}getComponent(t){return u.getComponent(t)}constructor(t){h(t),this.createFromAction=this.createFromAction.bind(this),this.setOptions({exposeLibraryMetadata:!0,...t}),this.loadingContext=i(this.options.environment,this.options.environmentUrls?.api),this.cdnContext=n(this.options.resourceEnvironment||this.options.environment,this.options.environmentUrls?.api),this.analyticsContext=a(this.options.environment),this.session=this.options.session&&new c(this.options.session,this.options.clientKey,this.loadingContext);const o=this.options.clientKey?.substr(0,4);if(("test"===o||"live"===o)&&!this.loadingContext.includes(o))throw new g("IMPLEMENTATION_ERROR",`Error: you are using a ${o} clientKey against the ${this.options.environment} environment`);this.options.exposeLibraryMetadata&&(window.AdyenWebMetadata=x.metadata)}async initialize(){return await this.initializeCore(),this.validateCoreConfiguration(),this.createCoreModules(),this}async initializeCore(){return this.session?this.session.setupSession(this.options).then((t=>{const{amount:o,shopperLocale:e,countryCode:s,paymentMethods:i,...n}=t;return this.setOptions({...n,amount:this.options.order?this.options.order.remainingAmount:o,locale:this.options.locale||e,countryCode:this.options.countryCode||s}),this.createPaymentMethodsList(i),this})).catch((t=>(this.options.onError&&this.options.onError(t),Promise.reject(t)))):(this.createPaymentMethodsList(),Promise.resolve(this))}validateCoreConfiguration(){if(this.options.paymentMethodsConfiguration&&console.warn('WARNING: "paymentMethodsConfiguration" is supported only by Drop-in.'),this.options.locale||this.setOptions({locale:v}),!this.options.countryCode)throw new g(w,"You must specify a countryCode when initializing checkout. (If you are using a session then this session should be initialized with a countryCode.)")}submitDetails(t){let o=null;this.options.onAdditionalDetails&&(o=new Promise(((o,e)=>{this.options.onAdditionalDetails({data:t},void 0,{resolve:o,reject:e})}))),this.session&&(o=this.session.submitDetails(t).catch((t=>(this.options.onError?.(t),Promise.reject(t))))),o?o.then(y).then(C).then((t=>{f(t),this.options.onPaymentCompleted?.(t)})).catch((t=>{f(t),this.options.onPaymentFailed?.(t)})):this.options.onError?.(new g("IMPLEMENTATION_ERROR",'It can not submit the details. The callback "onAdditionalDetails" or the Session is not setup correctly.'))}createFromAction(t,o={}){if(!t||!t.type){if(l(t,"action")&&l(t,"resultCode"))throw new Error('createFromAction::Invalid Action - the passed action object itself has an "action" property and a "resultCode": have you passed in the whole response object by mistake?');throw new Error('createFromAction::Invalid Action - the passed action object does not have a "type" property')}if(t.type){const e=t.type===E?`${t.type}${t.subtype}`:t.paymentMethodType;this.modules.analytics.sendAnalytics(e,{type:b,subtype:t.type,message:`${e} action was handled by the SDK`});const i={...this.getCorePropsForComponent(),...o};return s(this,u,t,i)}return this.handleCreateError()}update=(t={})=>(this.setOptions(t),this.initialize().then((()=>(this.components.forEach((o=>o.update(t))),this))));remove=t=>(this.components=this.components.filter((o=>o._id!==t._id)),t.unmount(),this);setOptions=t=>{this.options={...this.options,...t,locale:t?.locale||this.options?.locale}};getCorePropsForComponent(){return{...p(this.options),core:this,i18n:this.modules.i18n,modules:this.modules,session:this.session,loadingContext:this.loadingContext,cdnContext:this.cdnContext,createFromAction:this.createFromAction}}storeElementReference(t){t&&this.components.push(t)}handleCreateError(t){const o=t?`${t?.name??"The passed payment method"} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(t)}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`:"No Payment Method component was passed";throw new Error(o)}createPaymentMethodsList(t){this.paymentMethodsResponse=new e(this.options.paymentMethodsResponse||t,this.options)}createCoreModules(){this.modules||(this.modules=Object.freeze({risk:new o(this,{...this.options,loadingContext:this.loadingContext}),analytics:r({loadingContext:this.loadingContext,analyticsContext:this.analyticsContext,clientKey:this.options.clientKey,locale:this.options.locale,analytics:this.options.analytics,amount:this.options.amount,bundleType:x.metadata.bundleType}),resources:new m(this.cdnContext),i18n:new t(this.options.locale,this.options.translations,this.options.translationFile),srPanel:new d(this,{...this.options.srConfig})}))}}export{x as default};
|
|
2
2
|
//# sourceMappingURL=core.js.map
|
package/dist/es/core/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sources":["../../../src/core/core.ts"],"sourcesContent":["import Language from '../language';\nimport UIElement from '../components/internal/UIElement/UIElement';\nimport RiskModule from './RiskModule';\nimport PaymentMethods from './ProcessResponse/PaymentMethods';\nimport getComponentForAction from './ProcessResponse/PaymentAction';\nimport { resolveEnvironment, resolveCDNEnvironment, resolveAnalyticsEnvironment } from './Environment';\nimport Analytics from './Analytics';\nimport { AdditionalDetailsStateData, PaymentAction, PaymentResponseData } from '../types/global-types';\nimport { CoreConfiguration, ICore } from './types';\nimport { processGlobalOptions } from './utils';\nimport Session from './CheckoutSession';\nimport { hasOwnProperty } from '../utils/hasOwnProperty';\nimport { Resources } from './Context/Resources';\nimport { SRPanel } from './Errors/SRPanel';\nimport registry, { NewableComponent } from './core.registry';\nimport { cleanupFinalResult, sanitizeResponse, verifyPaymentDidNotFail } from '../components/internal/UIElement/utils';\nimport AdyenCheckoutError, { IMPLEMENTATION_ERROR } from './Errors/AdyenCheckoutError';\nimport { ANALYTICS_ACTION_STR } from './Analytics/constants';\nimport { THREEDS2_FULL } from '../components/ThreeDS2/config';\nimport { DEFAULT_LOCALE } from '../language/config';\n\nclass Core implements ICore {\n public session?: Session;\n public paymentMethodsResponse: PaymentMethods;\n public modules: any;\n public options: CoreConfiguration;\n public loadingContext?: string;\n public cdnContext?: string;\n public analyticsContext?: string;\n\n private components: UIElement[] = [];\n\n public static readonly version = {\n version: process.env.VERSION,\n revision: process.env.COMMIT_HASH,\n branch: process.env.COMMIT_BRANCH,\n buildId: process.env.ADYEN_BUILD_ID,\n moduleType: process.env.MODULE_TYPE\n };\n\n public static registry = registry;\n\n public static register(...items: NewableComponent[]) {\n registry.add(...items);\n }\n\n /**\n * Used internally by the PaymentMethod components to auto-register themselves\n * @internal\n */\n public register(...items: NewableComponent[]) {\n registry.add(...items);\n }\n\n public getComponent(txVariant: string) {\n return registry.getComponent(txVariant);\n }\n\n constructor(props: CoreConfiguration) {\n this.createFromAction = this.createFromAction.bind(this);\n\n this.setOptions(props);\n\n this.loadingContext = resolveEnvironment(this.options.environment, this.options.environmentUrls?.api);\n this.cdnContext = resolveCDNEnvironment(this.options.resourceEnvironment || this.options.environment, this.options.environmentUrls?.api);\n this.analyticsContext = resolveAnalyticsEnvironment(this.options.environment);\n this.session = this.options.session && new Session(this.options.session, this.options.clientKey, this.loadingContext);\n\n const clientKeyType = this.options.clientKey?.substr(0, 4);\n if ((clientKeyType === 'test' || clientKeyType === 'live') && !this.loadingContext.includes(clientKeyType)) {\n throw new Error(`Error: you are using a '${clientKeyType}' clientKey against the '${this.options.environment}' environment`);\n }\n\n // Expose version number for npm builds\n window['adyenWebVersion'] = Core.version.version;\n }\n\n public async initialize(): Promise<this> {\n await this.initializeCore();\n this.validateCoreConfiguration();\n this.createCoreModules();\n return this;\n }\n\n private async initializeCore(): Promise<this> {\n if (this.session) {\n return this.session\n .setupSession(this.options)\n .then(sessionResponse => {\n const { amount, shopperLocale, countryCode, paymentMethods, ...rest } = sessionResponse;\n\n this.setOptions({\n ...rest,\n amount: this.options.order ? this.options.order.remainingAmount : amount,\n locale: this.options.locale || shopperLocale,\n countryCode: this.options.countryCode || countryCode\n });\n\n this.createPaymentMethodsList(paymentMethods);\n\n return this;\n })\n .catch(error => {\n if (this.options.onError) this.options.onError(error);\n return Promise.reject(error);\n });\n }\n\n this.createPaymentMethodsList();\n return Promise.resolve(this);\n }\n\n private validateCoreConfiguration(): void {\n // @ts-ignore This property does not exist, although merchants might be using when migrating from v5 to v6\n if (this.options.paymentMethodsConfiguration) {\n console.warn('WARNING: \"paymentMethodsConfiguration\" is supported only by Drop-in.');\n }\n\n if (!this.options.locale) {\n this.setOptions({ locale: DEFAULT_LOCALE });\n }\n\n if (!this.options.countryCode) {\n throw new AdyenCheckoutError(\n IMPLEMENTATION_ERROR,\n 'You must specify a countryCode when initializing checkout. (If you are using a session then this session should be initialized with a countryCode.)'\n );\n }\n }\n\n /**\n * Method used when handling redirects. It submits details using 'onAdditionalDetails' or the Sessions flow if available.\n *\n * @public\n * @see {https://docs.adyen.com/online-payments/build-your-integration/?platform=Web&integration=Components&version=5.55.1#handle-the-redirect}\n * @param details - Details object containing the redirectResult\n */\n public submitDetails(details: AdditionalDetailsStateData['data']): void {\n let promise = null;\n\n if (this.options.onAdditionalDetails) {\n promise = new Promise((resolve, reject) => {\n this.options.onAdditionalDetails({ data: details }, undefined, { resolve, reject });\n });\n }\n\n if (this.session) {\n promise = this.session.submitDetails(details).catch(error => {\n this.options.onError?.(error);\n return Promise.reject(error);\n });\n }\n\n if (!promise) {\n this.options.onError?.(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not submit the details. The callback \"onAdditionalDetails\" or the Session is not setup correctly.'\n )\n );\n return;\n }\n\n promise\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then((response: PaymentResponseData) => {\n cleanupFinalResult(response);\n this.options.onPaymentCompleted?.(response);\n })\n .catch((response: PaymentResponseData) => {\n cleanupFinalResult(response);\n this.options.onPaymentFailed?.(response);\n });\n }\n\n /**\n * Instantiates a new element component ready to be mounted from an action object\n *\n * @param action - action defining the component with the component data\n * @param options - options that will be merged to the global Checkout props\n * @returns new UIElement\n */\n public createFromAction(action: PaymentAction, options = {}): any {\n if (!action || !action.type) {\n if (hasOwnProperty(action, 'action') && hasOwnProperty(action, 'resultCode')) {\n throw new Error(\n 'createFromAction::Invalid Action - the passed action object itself has an \"action\" property and ' +\n 'a \"resultCode\": have you passed in the whole response object by mistake?'\n );\n }\n throw new Error('createFromAction::Invalid Action - the passed action object does not have a \"type\" property');\n }\n\n if (action.type) {\n // 'threeDS2' OR 'qrCode', 'voucher', 'redirect', 'await', 'bankTransfer`\n const component = action.type === THREEDS2_FULL ? `${action.type}${action.subtype}` : action.paymentMethodType;\n\n this.modules.analytics.sendAnalytics(component, {\n type: ANALYTICS_ACTION_STR,\n subtype: action.type,\n message: `${component} action was handled by the SDK`\n });\n\n const props = {\n ...this.getCorePropsForComponent(),\n ...options\n };\n\n return getComponentForAction(this, registry, action, props);\n }\n\n return this.handleCreateError();\n }\n\n /**\n * Updates global configurations, resets the internal state and remounts each element.\n *\n * @param options - props to update\n * @returns this - the element instance\n */\n public update = (options: Partial<CoreConfiguration> = {}): Promise<this> => {\n this.setOptions(options);\n\n return this.initialize().then(() => {\n // Update each component under this instance\n // here we should update only the new options that have been received from core\n this.components.forEach(c => c.update(options));\n return this;\n });\n };\n\n /**\n * Remove the reference of a component\n * @param component - reference to the component to be removed\n * @returns this - the element instance\n * // TODO: Do we need this?\n */\n public remove = (component): this => {\n this.components = this.components.filter(c => c._id !== component._id);\n component.unmount();\n\n return this;\n };\n\n /**\n * @internal\n * Create or update the config object passed when AdyenCheckout is initialised (environment, clientKey, etc...)\n */\n private setOptions = (options: CoreConfiguration): void => {\n this.options = {\n ...this.options,\n ...options,\n locale: options?.locale || this.options?.locale\n };\n };\n\n /**\n * @internal\n * @returns props for a new UIElement\n */\n public getCorePropsForComponent(): any {\n const globalOptions = processGlobalOptions(this.options);\n\n return {\n ...globalOptions,\n core: this,\n i18n: this.modules.i18n,\n modules: this.modules,\n session: this.session,\n loadingContext: this.loadingContext,\n cdnContext: this.cdnContext,\n createFromAction: this.createFromAction\n };\n }\n\n public storeElementReference(element: UIElement) {\n if (element) {\n this.components.push(element);\n }\n }\n\n /**\n * @internal\n */\n private handleCreateError(paymentMethod?): never {\n const paymentMethodName = paymentMethod?.name ?? 'The passed payment method';\n const errorMessage = paymentMethod\n ? `${paymentMethodName} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(\n paymentMethod\n )}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`\n : 'No Payment Method component was passed';\n\n throw new Error(errorMessage);\n }\n\n private createPaymentMethodsList(paymentMethodsResponse?: PaymentMethods): void {\n this.paymentMethodsResponse = new PaymentMethods(this.options.paymentMethodsResponse || paymentMethodsResponse, this.options);\n }\n\n private createCoreModules(): void {\n if (this.modules) {\n if (process.env.NODE_ENV === 'development') {\n console.warn('Core: Core modules are already created.');\n }\n return;\n }\n\n this.modules = Object.freeze({\n risk: new RiskModule(this, { ...this.options, loadingContext: this.loadingContext }),\n analytics: Analytics({\n loadingContext: this.loadingContext,\n analyticsContext: this.analyticsContext,\n clientKey: this.options.clientKey,\n locale: this.options.locale,\n analytics: this.options.analytics,\n amount: this.options.amount\n }),\n resources: new Resources(this.cdnContext),\n i18n: new Language(this.options.locale, this.options.translations, this.options.translationFile),\n srPanel: new SRPanel(this, { ...this.options.srConfig })\n });\n }\n}\n\nexport default Core;\n"],"names":["Core","session","paymentMethodsResponse","modules","options","loadingContext","cdnContext","analyticsContext","components","static","version","revision","branch","buildId","moduleType","registry","register","items","add","getComponent","txVariant","constructor","props","this","createFromAction","bind","setOptions","resolveEnvironment","environment","environmentUrls","api","resolveCDNEnvironment","resourceEnvironment","resolveAnalyticsEnvironment","Session","clientKey","clientKeyType","substr","includes","Error","window","initialize","initializeCore","validateCoreConfiguration","createCoreModules","setupSession","then","sessionResponse","amount","shopperLocale","countryCode","paymentMethods","rest","order","remainingAmount","locale","createPaymentMethodsList","catch","error","onError","Promise","reject","resolve","paymentMethodsConfiguration","console","warn","DEFAULT_LOCALE","AdyenCheckoutError","IMPLEMENTATION_ERROR","submitDetails","details","promise","onAdditionalDetails","data","undefined","sanitizeResponse","verifyPaymentDidNotFail","response","cleanupFinalResult","onPaymentCompleted","onPaymentFailed","action","type","hasOwnProperty","component","THREEDS2_FULL","subtype","paymentMethodType","analytics","sendAnalytics","ANALYTICS_ACTION_STR","message","getCorePropsForComponent","getComponentForAction","handleCreateError","update","forEach","c","remove","filter","_id","unmount","processGlobalOptions","core","i18n","storeElementReference","element","push","paymentMethod","errorMessage","name","JSON","stringify","PaymentMethods","Object","freeze","risk","RiskModule","Analytics","resources","Resources","Language","translations","translationFile","srPanel","SRPanel","srConfig"],"mappings":"skCAqBA,MAAMA,EACKC,QACAC,uBACAC,QACAC,QACAC,eACAC,WACAC,iBAECC,WAA0B,GAElCC,eAAiC,CAC7BC,QAAS,gBACTC,SAAU,UACVC,OAAQ,OACRC,QAAS,wDACTC,WAAY,MAGhBL,gBAAyBM,EAEzB,eAAcC,IAAYC,GACtBF,EAASG,OAAOD,EACpB,CAMA,QAAAD,IAAmBC,GACfF,EAASG,OAAOD,EACpB,CAEOE,YAAAA,CAAaC,GAChB,OAAOL,EAASI,aAAaC,EACjC,CAEAC,WAAAA,CAAYC,GACRC,KAAKC,iBAAmBD,KAAKC,iBAAiBC,KAAKF,MAEnDA,KAAKG,WAAWJ,GAEhBC,KAAKlB,eAAiBsB,EAAmBJ,KAAKnB,QAAQwB,YAAaL,KAAKnB,QAAQyB,iBAAiBC,KACjGP,KAAKjB,WAAayB,EAAsBR,KAAKnB,QAAQ4B,qBAAuBT,KAAKnB,QAAQwB,YAAaL,KAAKnB,QAAQyB,iBAAiBC,KACpIP,KAAKhB,iBAAmB0B,EAA4BV,KAAKnB,QAAQwB,aACjEL,KAAKtB,QAAUsB,KAAKnB,QAAQH,SAAW,IAAIiC,EAAQX,KAAKnB,QAAQH,QAASsB,KAAKnB,QAAQ+B,UAAWZ,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"version":3,"file":"core.js","sources":["../../../src/core/core.ts"],"sourcesContent":["import Language from '../language';\nimport UIElement from '../components/internal/UIElement/UIElement';\nimport RiskModule from './RiskModule';\nimport PaymentMethods from './ProcessResponse/PaymentMethods';\nimport getComponentForAction from './ProcessResponse/PaymentAction';\nimport { resolveEnvironment, resolveCDNEnvironment, resolveAnalyticsEnvironment } from './Environment';\nimport Analytics from './Analytics';\nimport { assertConfigurationPropertiesAreValid, processGlobalOptions } from './utils';\nimport Session from './CheckoutSession';\nimport { hasOwnProperty } from '../utils/hasOwnProperty';\nimport { Resources } from './Context/Resources';\nimport { SRPanel } from './Errors/SRPanel';\nimport registry, { NewableComponent } from './core.registry';\nimport { cleanupFinalResult, sanitizeResponse, verifyPaymentDidNotFail } from '../components/internal/UIElement/utils';\nimport AdyenCheckoutError, { IMPLEMENTATION_ERROR } from './Errors/AdyenCheckoutError';\nimport { ANALYTICS_ACTION_STR } from './Analytics/constants';\nimport { THREEDS2_FULL } from '../components/ThreeDS2/config';\nimport { DEFAULT_LOCALE } from '../language/config';\n\nimport type { AdditionalDetailsStateData, PaymentAction, PaymentResponseData } from '../types/global-types';\nimport type { CoreConfiguration, ICore } from './types';\n\nclass Core implements ICore {\n public session?: Session;\n public paymentMethodsResponse: PaymentMethods;\n public modules: any;\n public options: CoreConfiguration;\n public loadingContext?: string;\n public cdnContext?: string;\n public analyticsContext?: string;\n\n private components: UIElement[] = [];\n\n public static readonly metadata = {\n version: process.env.VERSION,\n revision: process.env.COMMIT_HASH,\n branch: process.env.COMMIT_BRANCH,\n buildId: process.env.ADYEN_BUILD_ID,\n bundleType: process.env.BUNDLE_TYPE\n };\n\n public static registry = registry;\n\n public static setBundleType(type: string): void {\n Core.metadata.bundleType = type;\n }\n\n public static register(...items: NewableComponent[]) {\n registry.add(...items);\n }\n\n /**\n * Used internally by the PaymentMethod components to auto-register themselves\n * @internal\n */\n public register(...items: NewableComponent[]) {\n registry.add(...items);\n }\n\n public getComponent(txVariant: string) {\n return registry.getComponent(txVariant);\n }\n\n constructor(props: CoreConfiguration) {\n assertConfigurationPropertiesAreValid(props);\n\n this.createFromAction = this.createFromAction.bind(this);\n\n this.setOptions({ exposeLibraryMetadata: true, ...props });\n\n this.loadingContext = resolveEnvironment(this.options.environment, this.options.environmentUrls?.api);\n this.cdnContext = resolveCDNEnvironment(this.options.resourceEnvironment || this.options.environment, this.options.environmentUrls?.api);\n this.analyticsContext = resolveAnalyticsEnvironment(this.options.environment);\n this.session = this.options.session && new Session(this.options.session, this.options.clientKey, this.loadingContext);\n\n const clientKeyType = this.options.clientKey?.substr(0, 4);\n if ((clientKeyType === 'test' || clientKeyType === 'live') && !this.loadingContext.includes(clientKeyType)) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Error: you are using a ${clientKeyType} clientKey against the ${this.options.environment} environment`\n );\n }\n\n if (this.options.exposeLibraryMetadata) {\n window['AdyenWebMetadata'] = Core.metadata;\n }\n }\n\n public async initialize(): Promise<this> {\n await this.initializeCore();\n this.validateCoreConfiguration();\n this.createCoreModules();\n return this;\n }\n\n private async initializeCore(): Promise<this> {\n if (this.session) {\n return this.session\n .setupSession(this.options)\n .then(sessionResponse => {\n const { amount, shopperLocale, countryCode, paymentMethods, ...rest } = sessionResponse;\n\n this.setOptions({\n ...rest,\n amount: this.options.order ? this.options.order.remainingAmount : amount,\n locale: this.options.locale || shopperLocale,\n countryCode: this.options.countryCode || countryCode\n });\n\n this.createPaymentMethodsList(paymentMethods);\n\n return this;\n })\n .catch(error => {\n if (this.options.onError) this.options.onError(error);\n return Promise.reject(error);\n });\n }\n\n this.createPaymentMethodsList();\n return Promise.resolve(this);\n }\n\n private validateCoreConfiguration(): void {\n // @ts-ignore This property does not exist, although merchants might be using when migrating from v5 to v6\n if (this.options.paymentMethodsConfiguration) {\n console.warn('WARNING: \"paymentMethodsConfiguration\" is supported only by Drop-in.');\n }\n\n if (!this.options.locale) {\n this.setOptions({ locale: DEFAULT_LOCALE });\n }\n\n if (!this.options.countryCode) {\n throw new AdyenCheckoutError(\n IMPLEMENTATION_ERROR,\n 'You must specify a countryCode when initializing checkout. (If you are using a session then this session should be initialized with a countryCode.)'\n );\n }\n }\n\n /**\n * Method used when handling redirects. It submits details using 'onAdditionalDetails' or the Sessions flow if available.\n *\n * @public\n * @see {https://docs.adyen.com/online-payments/build-your-integration/?platform=Web&integration=Components&version=5.55.1#handle-the-redirect}\n * @param details - Details object containing the redirectResult\n */\n public submitDetails(details: AdditionalDetailsStateData['data']): void {\n let promise = null;\n\n if (this.options.onAdditionalDetails) {\n promise = new Promise((resolve, reject) => {\n this.options.onAdditionalDetails({ data: details }, undefined, { resolve, reject });\n });\n }\n\n if (this.session) {\n promise = this.session.submitDetails(details).catch(error => {\n this.options.onError?.(error);\n return Promise.reject(error);\n });\n }\n\n if (!promise) {\n this.options.onError?.(\n new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n 'It can not submit the details. The callback \"onAdditionalDetails\" or the Session is not setup correctly.'\n )\n );\n return;\n }\n\n promise\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then((response: PaymentResponseData) => {\n cleanupFinalResult(response);\n this.options.onPaymentCompleted?.(response);\n })\n .catch((response: PaymentResponseData) => {\n cleanupFinalResult(response);\n this.options.onPaymentFailed?.(response);\n });\n }\n\n /**\n * Instantiates a new element component ready to be mounted from an action object\n *\n * @param action - action defining the component with the component data\n * @param options - options that will be merged to the global Checkout props\n * @returns new UIElement\n */\n public createFromAction(action: PaymentAction, options = {}): any {\n if (!action || !action.type) {\n if (hasOwnProperty(action, 'action') && hasOwnProperty(action, 'resultCode')) {\n throw new Error(\n 'createFromAction::Invalid Action - the passed action object itself has an \"action\" property and ' +\n 'a \"resultCode\": have you passed in the whole response object by mistake?'\n );\n }\n throw new Error('createFromAction::Invalid Action - the passed action object does not have a \"type\" property');\n }\n\n if (action.type) {\n // 'threeDS2' OR 'qrCode', 'voucher', 'redirect', 'await', 'bankTransfer`\n const component = action.type === THREEDS2_FULL ? `${action.type}${action.subtype}` : action.paymentMethodType;\n\n this.modules.analytics.sendAnalytics(component, {\n type: ANALYTICS_ACTION_STR,\n subtype: action.type,\n message: `${component} action was handled by the SDK`\n });\n\n const props = {\n ...this.getCorePropsForComponent(),\n ...options\n };\n\n return getComponentForAction(this, registry, action, props);\n }\n\n return this.handleCreateError();\n }\n\n /**\n * Updates global configurations, resets the internal state and remounts each element.\n *\n * @param options - props to update\n * @returns this - the element instance\n */\n public update = (options: Partial<CoreConfiguration> = {}): Promise<this> => {\n this.setOptions(options);\n\n return this.initialize().then(() => {\n // Update each component under this instance\n // here we should update only the new options that have been received from core\n this.components.forEach(c => c.update(options));\n return this;\n });\n };\n\n /**\n * Remove the reference of a component\n * @param component - reference to the component to be removed\n * @returns this - the element instance\n * // TODO: Do we need this?\n */\n public remove = (component): this => {\n this.components = this.components.filter(c => c._id !== component._id);\n component.unmount();\n\n return this;\n };\n\n /**\n * @internal\n * Create or update the config object passed when AdyenCheckout is initialised (environment, clientKey, etc...)\n */\n private setOptions = (options: CoreConfiguration): void => {\n this.options = {\n ...this.options,\n ...options,\n locale: options?.locale || this.options?.locale\n };\n };\n\n /**\n * @internal\n * @returns props for a new UIElement\n */\n public getCorePropsForComponent(): any {\n const globalOptions = processGlobalOptions(this.options);\n\n return {\n ...globalOptions,\n core: this,\n i18n: this.modules.i18n,\n modules: this.modules,\n session: this.session,\n loadingContext: this.loadingContext,\n cdnContext: this.cdnContext,\n createFromAction: this.createFromAction\n };\n }\n\n public storeElementReference(element: UIElement) {\n if (element) {\n this.components.push(element);\n }\n }\n\n /**\n * @internal\n */\n private handleCreateError(paymentMethod?): never {\n const paymentMethodName = paymentMethod?.name ?? 'The passed payment method';\n const errorMessage = paymentMethod\n ? `${paymentMethodName} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(\n paymentMethod\n )}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`\n : 'No Payment Method component was passed';\n\n throw new Error(errorMessage);\n }\n\n private createPaymentMethodsList(paymentMethodsResponse?: PaymentMethods): void {\n this.paymentMethodsResponse = new PaymentMethods(this.options.paymentMethodsResponse || paymentMethodsResponse, this.options);\n }\n\n private createCoreModules(): void {\n if (this.modules) {\n if (process.env.NODE_ENV === 'development') {\n console.warn('Core: Core modules are already created.');\n }\n return;\n }\n\n this.modules = Object.freeze({\n risk: new RiskModule(this, { ...this.options, loadingContext: this.loadingContext }),\n analytics: Analytics({\n loadingContext: this.loadingContext,\n analyticsContext: this.analyticsContext,\n clientKey: this.options.clientKey,\n locale: this.options.locale,\n analytics: this.options.analytics,\n amount: this.options.amount,\n bundleType: Core.metadata.bundleType\n }),\n resources: new Resources(this.cdnContext),\n i18n: new Language(this.options.locale, this.options.translations, this.options.translationFile),\n srPanel: new SRPanel(this, { ...this.options.srConfig })\n });\n }\n}\n\nexport default Core;\n"],"names":["Core","session","paymentMethodsResponse","modules","options","loadingContext","cdnContext","analyticsContext","components","static","version","revision","branch","buildId","bundleType","registry","setBundleType","type","metadata","register","items","add","getComponent","txVariant","constructor","props","assertConfigurationPropertiesAreValid","this","createFromAction","bind","setOptions","exposeLibraryMetadata","resolveEnvironment","environment","environmentUrls","api","resolveCDNEnvironment","resourceEnvironment","resolveAnalyticsEnvironment","Session","clientKey","clientKeyType","substr","includes","AdyenCheckoutError","window","initialize","initializeCore","validateCoreConfiguration","createCoreModules","setupSession","then","sessionResponse","amount","shopperLocale","countryCode","paymentMethods","rest","order","remainingAmount","locale","createPaymentMethodsList","catch","error","onError","Promise","reject","resolve","paymentMethodsConfiguration","console","warn","DEFAULT_LOCALE","IMPLEMENTATION_ERROR","submitDetails","details","promise","onAdditionalDetails","data","undefined","sanitizeResponse","verifyPaymentDidNotFail","response","cleanupFinalResult","onPaymentCompleted","onPaymentFailed","action","hasOwnProperty","Error","component","THREEDS2_FULL","subtype","paymentMethodType","analytics","sendAnalytics","ANALYTICS_ACTION_STR","message","getCorePropsForComponent","getComponentForAction","handleCreateError","update","forEach","c","remove","filter","_id","unmount","processGlobalOptions","core","i18n","storeElementReference","element","push","paymentMethod","errorMessage","name","JSON","stringify","PaymentMethods","Object","freeze","risk","RiskModule","Analytics","resources","Resources","Language","translations","translationFile","srPanel","SRPanel","srConfig"],"mappings":"inCAsBA,MAAMA,EACKC,QACAC,uBACAC,QACAC,QACAC,eACAC,WACAC,iBAECC,WAA0B,GAElCC,gBAAkC,CAC9BC,QAAS,gBACTC,SAAU,UACVC,OAAQ,OACRC,QAAS,wDACTC,WAAY,OAGhBL,gBAAyBM,EAEzB,oBAAcC,CAAcC,GACxBjB,EAAKkB,SAASJ,WAAaG,CAC/B,CAEA,eAAcE,IAAYC,GACtBL,EAASM,OAAOD,EACpB,CAMA,QAAAD,IAAmBC,GACfL,EAASM,OAAOD,EACpB,CAEOE,YAAAA,CAAaC,GAChB,OAAOR,EAASO,aAAaC,EACjC,CAEAC,WAAAA,CAAYC,GACRC,EAAsCD,GAEtCE,KAAKC,iBAAmBD,KAAKC,iBAAiBC,KAAKF,MAEnDA,KAAKG,WAAW,CAAEC,uBAAuB,KAASN,IAElDE,KAAKtB,eAAiB2B,EAAmBL,KAAKvB,QAAQ6B,YAAaN,KAAKvB,QAAQ8B,iBAAiBC,KACjGR,KAAKrB,WAAa8B,EAAsBT,KAAKvB,QAAQiC,qBAAuBV,KAAKvB,QAAQ6B,YAAaN,KAAKvB,QAAQ8B,iBAAiBC,KACpIR,KAAKpB,iBAAmB+B,EAA4BX,KAAKvB,QAAQ6B,aACjEN,KAAK1B,QAAU0B,KAAKvB,QAAQH,SAAW,IAAIsC,EAAQZ,KAAKvB,QAAQH,QAAS0B,KAAKvB,QAAQoC,UAAWb,KAAKtB,gBAEtG,MAAMoC,EAAgBd,KAAKvB,QAAQoC,WAAWE,OAAO,EAAG,GACxD,IAAuB,SAAlBD,GAA8C,SAAlBA,KAA8Bd,KAAKtB,eAAesC,SAASF,GACxF,MAAM,IAAIG,EACN,uBACA,0BAA0BH,2BAAuCd,KAAKvB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from"./config.js";function o(o){return Object.keys(o).reduce(((n,t)=>(e.includes(t)&&(n[t]=o[t]),n)),{})}function n(e){const o=(e=>e)(["session","environment","environmentUrls","showPayButton","clientKey","locale","translationFile","translations","paymentMethodsResponse","amount","secondaryAmount","countryCode","allowPaymentMethods","removePaymentMethods","srConfig","cdnContext","resourceEnvironment","analytics","risk","order","exposeLibraryMetadata","beforeRedirect","beforeSubmit","onPaymentCompleted","onPaymentFailed","onSubmit","onAdditionalDetails","onActionHandled","onChange","onError","onBalanceCheck","onOrderRequest","onPaymentMethodsRequest","onOrderCancel","onOrderUpdated","loadingContext"]);Object.keys(e).forEach((e=>{o.includes(e)||console.warn(`AdyenCheckout - Configuration property "${e}" is not a valid AdyenCheckout property. If it is a payment method configuration, make sure to pass it directly to the Component. If you are using Drop-in, make sure to pass it to "paymentMethodsConfiguration" object`)}))}export{n as assertConfigurationPropertiesAreValid,o as processGlobalOptions};
|
|
2
2
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../src/core/utils.ts"],"sourcesContent":["import { GENERIC_OPTIONS } from './config';\n\n/**\n * Filter properties in a global configuration object from an allow list (GENERIC_OPTIONS)\n * @param globalOptions -\n * @returns any\n */\nexport function processGlobalOptions(globalOptions) {\n return Object.keys(globalOptions).reduce((r, e) => {\n if (GENERIC_OPTIONS.includes(e)) r[e] = globalOptions[e];\n return r;\n }, {});\n}\n"],"names":["processGlobalOptions","globalOptions","Object","keys","reduce","r","e","GENERIC_OPTIONS","includes"],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../src/core/utils.ts"],"sourcesContent":["import { GENERIC_OPTIONS } from './config';\nimport type { CoreConfiguration } from './types';\n\n/**\n * Filter properties in a global configuration object from an allow list (GENERIC_OPTIONS)\n * @param globalOptions -\n * @returns any\n */\nexport function processGlobalOptions(globalOptions) {\n return Object.keys(globalOptions).reduce((r, e) => {\n if (GENERIC_OPTIONS.includes(e)) r[e] = globalOptions[e];\n return r;\n }, {});\n}\n\n/**\n * Validates that there is no unknown property as part of the CoreConfiguration.\n * The validator makes sure to throw a lint error in case a property is added to CoreConfiguration, but it is not added here\n *\n * @param props - AdyenCheckout props\n */\nexport function assertConfigurationPropertiesAreValid(propsSetByMerchant: CoreConfiguration): void {\n /** Helper that creates a function that validates the array contain ALL CoreConfiguration properties in it */\n function createConfigurationKeysValidator<T>() {\n const arrayOfAll =\n <T>() =>\n <U extends T[]>(array: U & ([T] extends [U[number]] ? unknown : 'Invalid')) =>\n array;\n const arrayWithAllKeys = arrayOfAll<T>();\n return arrayWithAllKeys;\n }\n\n const validator = createConfigurationKeysValidator<keyof CoreConfiguration>();\n const possibleFields = validator([\n 'session',\n 'environment',\n 'environmentUrls',\n 'showPayButton',\n 'clientKey',\n 'locale',\n 'translationFile',\n 'translations',\n 'paymentMethodsResponse',\n 'amount',\n 'secondaryAmount',\n 'countryCode',\n 'allowPaymentMethods',\n 'removePaymentMethods',\n 'srConfig',\n 'cdnContext',\n 'resourceEnvironment',\n 'analytics',\n 'risk',\n 'order',\n 'exposeLibraryMetadata',\n 'beforeRedirect',\n 'beforeSubmit',\n 'onPaymentCompleted',\n 'onPaymentFailed',\n 'onSubmit',\n 'onAdditionalDetails',\n 'onActionHandled',\n 'onChange',\n 'onError',\n 'onBalanceCheck',\n 'onOrderRequest',\n 'onPaymentMethodsRequest',\n 'onOrderCancel',\n 'onOrderUpdated',\n 'loadingContext'\n ]);\n\n Object.keys(propsSetByMerchant).forEach((prop: keyof CoreConfiguration) => {\n if (!possibleFields.includes(prop)) {\n console.warn(\n `AdyenCheckout - Configuration property \"${prop}\" is not a valid AdyenCheckout property. If it is a payment method configuration, make sure to pass it directly to the Component. If you are using Drop-in, make sure to pass it to \"paymentMethodsConfiguration\" object`\n );\n }\n });\n}\n"],"names":["processGlobalOptions","globalOptions","Object","keys","reduce","r","e","GENERIC_OPTIONS","includes","assertConfigurationPropertiesAreValid","propsSetByMerchant","possibleFields","array","validator","forEach","prop","console","warn"],"mappings":"8CAQO,SAASA,EAAqBC,GACjC,OAAOC,OAAOC,KAAKF,GAAeG,QAAO,CAACC,EAAGC,KACrCC,EAAgBC,SAASF,KAAID,EAAEC,GAAKL,EAAcK,IAC/CD,IACR,CAAC,EACR,CAQO,SAASI,EAAsCC,GAWlD,MACMC,EAPE,CAAgBC,GACZA,EAMWC,CAAU,CAC7B,UACA,cACA,kBACA,gBACA,YACA,SACA,kBACA,eACA,yBACA,SACA,kBACA,cACA,sBACA,uBACA,WACA,aACA,sBACA,YACA,OACA,QACA,wBACA,iBACA,eACA,qBACA,kBACA,WACA,sBACA,kBACA,WACA,UACA,iBACA,iBACA,0BACA,gBACA,iBACA,mBAGJX,OAAOC,KAAKO,GAAoBI,SAASC,IAChCJ,EAAeH,SAASO,IACzBC,QAAQC,KACJ,2CAA2CF,4NAEnD,GAER"}
|