@adyen/adyen-web 6.37.0 → 6.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/adyen.css +9 -9
- package/dist/cjs/adyen.css.map +1 -1
- package/dist/cjs/index.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/es/adyen.css +9 -9
- package/dist/es/adyen.css.map +1 -1
- package/dist/es/components/ANCV/components/ANCVInput.js +1 -1
- package/dist/es/components/ANCV/components/ANCVInput.js.map +1 -1
- package/dist/es/components/Ach/components/AchComponent.js +1 -1
- package/dist/es/components/Ach/components/AchComponent.js.map +1 -1
- package/dist/es/components/BacsDD/components/BacsInput.js +1 -1
- package/dist/es/components/BacsDD/components/BacsInput.js.map +1 -1
- package/dist/es/components/BankTransfer/components/BankTransferInput/BankTransferInput.js +1 -1
- package/dist/es/components/BankTransfer/components/BankTransferInput/BankTransferInput.js.map +1 -1
- package/dist/es/components/Blik/components/BlikInput.js +1 -1
- package/dist/es/components/Blik/components/BlikInput.js.map +1 -1
- package/dist/es/components/Boleto/components/BoletoInput/BoletoInput.js +1 -1
- package/dist/es/components/Boleto/components/BoletoInput/BoletoInput.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/AvailableBrands/AvailableBrands.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/CardNumber.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
- package/dist/es/components/Card/components/Fastlane/USOnlyPhoneInput.js +1 -1
- package/dist/es/components/Card/components/Fastlane/USOnlyPhoneInput.js.map +1 -1
- package/dist/es/components/Dragonpay/components/DragonpayInput/DragonpayInput.js +1 -1
- package/dist/es/components/Dragonpay/components/DragonpayInput/DragonpayInput.js.map +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js.map +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodBrands/PaymentMethodBrands.js +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodBrands/PaymentMethodBrands.js.map +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodIcon.js +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodIcon.js.map +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
- package/dist/es/components/PayTo/components/BSBInput.js +1 -1
- package/dist/es/components/PayTo/components/BSBInput.js.map +1 -1
- package/dist/es/components/PayTo/components/PayIDInput.js +1 -1
- package/dist/es/components/PayTo/components/PayIDInput.js.map +1 -1
- package/dist/es/components/PayTo/components/PayToNameFields.js +1 -1
- package/dist/es/components/PayTo/components/PayToNameFields.js.map +1 -1
- package/dist/es/components/PayTo/components/PayToPhone.js +1 -1
- package/dist/es/components/PayTo/components/PayToPhone.js.map +1 -1
- package/dist/es/components/Pix/components/PixInput/PixInput.js +1 -1
- package/dist/es/components/Pix/components/PixInput/PixInput.js.map +1 -1
- package/dist/es/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js +1 -1
- package/dist/es/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js.map +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/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.js +1 -1
- package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.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/Await/Await.js +1 -1
- package/dist/es/components/internal/Await/Await.js.map +1 -1
- package/dist/es/components/internal/BrandIcons/BrandIcons.js +1 -1
- package/dist/es/components/internal/BrandIcons/BrandIcons.js.map +1 -1
- package/dist/es/components/internal/BrandImage/BrandImage.js +1 -1
- package/dist/es/components/internal/BrandImage/BrandImage.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPCards/CtPCardsList/CtPCardsList.js +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPCards/CtPCardsList/CtPCardsList.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/services/sdks/VisaSdk.js +1 -1
- package/dist/es/components/internal/ClickToPay/services/sdks/VisaSdk.js.map +1 -1
- package/dist/es/components/internal/CompanyDetails/CompanyDetails.js +1 -1
- package/dist/es/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
- package/dist/es/components/internal/FormFields/Field/Field.js +1 -1
- package/dist/es/components/internal/FormFields/Field/Field.js.map +1 -1
- package/dist/es/components/internal/Img/Img.js.map +1 -1
- package/dist/es/components/internal/IssuerList/IssuerList.js +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/PhoneInput/PhoneInputFields.js +1 -1
- package/dist/es/components/internal/PhoneInput/PhoneInputFields.js.map +1 -1
- package/dist/es/components/internal/PhoneInput/PhoneInputForm.js +1 -1
- package/dist/es/components/internal/PhoneInput/PhoneInputForm.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/binLookup/extensions.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/extensions/handleBrandFromBinLookup.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/utils/callbackUtils.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/constants.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/constants.js.map +1 -1
- package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
- package/dist/es/core/config.js +1 -1
- package/dist/es/hooks/usePaymentStatusTimer/usePaymentStatusTimer.js.map +1 -1
- package/dist/es/language/LanguageService.js.map +1 -1
- package/dist/es/utils/useForm/useErrorFocus.js +2 -0
- package/dist/es/utils/useForm/useErrorFocus.js.map +1 -0
- package/dist/es/utils/useForm/useFormWithA11y.js +2 -0
- package/dist/es/utils/useForm/useFormWithA11y.js.map +1 -0
- package/dist/es-legacy/adyen.css +9 -9
- package/dist/es-legacy/adyen.css.map +1 -1
- package/dist/es-legacy/components/ANCV/components/ANCVInput.js +1 -1
- package/dist/es-legacy/components/ANCV/components/ANCVInput.js.map +1 -1
- package/dist/es-legacy/components/Ach/components/AchComponent.js +1 -1
- package/dist/es-legacy/components/Ach/components/AchComponent.js.map +1 -1
- package/dist/es-legacy/components/BacsDD/components/BacsInput.js +1 -1
- package/dist/es-legacy/components/BacsDD/components/BacsInput.js.map +1 -1
- package/dist/es-legacy/components/BankTransfer/components/BankTransferInput/BankTransferInput.js +1 -1
- package/dist/es-legacy/components/BankTransfer/components/BankTransferInput/BankTransferInput.js.map +1 -1
- package/dist/es-legacy/components/Blik/components/BlikInput.js +1 -1
- package/dist/es-legacy/components/Blik/components/BlikInput.js.map +1 -1
- package/dist/es-legacy/components/Boleto/components/BoletoInput/BoletoInput.js +1 -1
- package/dist/es-legacy/components/Boleto/components/BoletoInput/BoletoInput.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/AvailableBrands/AvailableBrands.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/AvailableBrands/AvailableBrands.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CardNumber.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
- package/dist/es-legacy/components/Card/components/Fastlane/USOnlyPhoneInput.js +1 -1
- package/dist/es-legacy/components/Card/components/Fastlane/USOnlyPhoneInput.js.map +1 -1
- package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js +1 -1
- package/dist/es-legacy/components/Dragonpay/components/DragonpayInput/DragonpayInput.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodBrands/PaymentMethodBrands.js +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodBrands/PaymentMethodBrands.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodIcon.js +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodIcon.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
- package/dist/es-legacy/components/PayTo/components/BSBInput.js +1 -1
- package/dist/es-legacy/components/PayTo/components/BSBInput.js.map +1 -1
- package/dist/es-legacy/components/PayTo/components/PayIDInput.js +1 -1
- package/dist/es-legacy/components/PayTo/components/PayIDInput.js.map +1 -1
- package/dist/es-legacy/components/PayTo/components/PayToNameFields.js +1 -1
- package/dist/es-legacy/components/PayTo/components/PayToNameFields.js.map +1 -1
- package/dist/es-legacy/components/PayTo/components/PayToPhone.js +1 -1
- package/dist/es-legacy/components/PayTo/components/PayToPhone.js.map +1 -1
- package/dist/es-legacy/components/Pix/components/PixInput/PixInput.js +1 -1
- package/dist/es-legacy/components/Pix/components/PixInput/PixInput.js.map +1 -1
- package/dist/es-legacy/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js +1 -1
- package/dist/es-legacy/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js.map +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/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.js +1 -1
- package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppItem/UPIIntentAppItem.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/Await/Await.js +1 -1
- package/dist/es-legacy/components/internal/Await/Await.js.map +1 -1
- package/dist/es-legacy/components/internal/BrandIcons/BrandIcons.js +1 -1
- package/dist/es-legacy/components/internal/BrandIcons/BrandIcons.js.map +1 -1
- package/dist/es-legacy/components/internal/BrandImage/BrandImage.js +1 -1
- package/dist/es-legacy/components/internal/BrandImage/BrandImage.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPCards/CtPCardsList/CtPCardsList.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPCards/CtPCardsList/CtPCardsList.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/services/sdks/VisaSdk.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/services/sdks/VisaSdk.js.map +1 -1
- package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js +1 -1
- package/dist/es-legacy/components/internal/CompanyDetails/CompanyDetails.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Field/Field.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/Field/Field.js.map +1 -1
- package/dist/es-legacy/components/internal/Img/Img.js.map +1 -1
- package/dist/es-legacy/components/internal/IssuerList/IssuerList.js +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/PhoneInput/PhoneInputFields.js +1 -1
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInputFields.js.map +1 -1
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js +1 -1
- package/dist/es-legacy/components/internal/PhoneInput/PhoneInputForm.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/binLookup/extensions.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/extensions/handleBrandFromBinLookup.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/callbackUtils.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js.map +1 -1
- package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
- package/dist/es-legacy/core/config.js +1 -1
- package/dist/es-legacy/hooks/usePaymentStatusTimer/usePaymentStatusTimer.js.map +1 -1
- package/dist/es-legacy/language/LanguageService.js.map +1 -1
- package/dist/es-legacy/utils/useForm/useErrorFocus.js +2 -0
- package/dist/es-legacy/utils/useForm/useErrorFocus.js.map +1 -0
- package/dist/es-legacy/utils/useForm/useFormWithA11y.js +2 -0
- package/dist/es-legacy/utils/useForm/useFormWithA11y.js.map +1 -0
- package/package.json +16 -16
- package/styles/adyen.css +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaymentMethodItem.js","sources":["../../../../../../../src/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport classNames from 'classnames';\n\nimport { PaymentMethodDetails } from '../PaymentMethodDetails';\nimport PaymentMethodIcon from '../PaymentMethodIcon';\nimport DisableOneClickConfirmation from '../DisableOneClickConfirmation';\nimport UIElement from '../../../../internal/UIElement/UIElement';\nimport PaymentMethodBrands from '../PaymentMethodBrands/PaymentMethodBrands';\nimport { BRAND_ICON_UI_EXCLUSION_LIST } from '../../../../internal/SecuredFields/lib/constants';\nimport PaymentMethodName from '../PaymentMethodName';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport ExpandButton from '../../../../internal/ExpandButton';\nimport { getFullBrandName } from '../../../../Card/components/CardInput/utils';\nimport { stopPropagationForActionKeys } from '../../../../internal/Button/stopPropagationForActionKeys';\nimport './PaymentMethodItem.scss';\nimport Button from '../../../../internal/Button';\n\nexport interface PaymentMethodItemProps {\n paymentMethod: UIElement;\n isSelected?: boolean;\n isLoading?: boolean;\n isDisablingPaymentMethod: boolean;\n showRemovePaymentMethodButton: boolean;\n onDisableStoredPaymentMethod: (paymentMethod) => void;\n onSelect: (paymentMethod: UIElement) => void;\n standalone: boolean;\n className?: string;\n showRadioButton?: boolean;\n}\n\nclass PaymentMethodItem extends Component<Readonly<PaymentMethodItemProps>> {\n public static readonly defaultProps = {\n paymentMethod: null,\n isSelected: false,\n isLoaded: false,\n isLoading: false,\n showDisableStoredPaymentMethodConfirmation: false,\n showRadioButton: false\n };\n\n public state = {\n showDisableStoredPaymentMethodConfirmation: false\n };\n\n public toggleDisableConfirmation = () => {\n this.setState({ showDisableStoredPaymentMethodConfirmation: !this.state.showDisableStoredPaymentMethodConfirmation });\n };\n\n public onDisableStoredPaymentMethod = () => {\n this.props.onDisableStoredPaymentMethod(this.props.paymentMethod);\n this.toggleDisableConfirmation();\n };\n\n private readonly handleOnListItemClick = (): void => {\n const { onSelect, paymentMethod } = this.props;\n onSelect(paymentMethod);\n };\n\n // @ts-ignore need to refine the type for paymentMethod\n render({ paymentMethod, isSelected, isDisablingPaymentMethod, isLoading, standalone, showRadioButton }) {\n const { i18n } = useCoreContext();\n\n if (!paymentMethod) {\n return null;\n }\n\n const isCard = paymentMethod.props.type === 'card' || paymentMethod.props.type === 'scheme';\n\n const paymentMethodClassnames = classNames({\n 'adyen-checkout__payment-method': true,\n [`adyen-checkout__payment-method--${paymentMethod.props.type}`]: true,\n ...(isCard && { [`adyen-checkout__payment-method--${paymentMethod.props.fundingSource ?? 'credit'}`]: true }),\n 'adyen-checkout__payment-method--selected': isSelected,\n 'adyen-checkout__payment-method--loading': isLoading,\n 'adyen-checkout__payment-method--disabling': isDisablingPaymentMethod,\n 'adyen-checkout__payment-method--confirming': this.state.showDisableStoredPaymentMethodConfirmation,\n 'adyen-checkout__payment-method--standalone': standalone,\n [paymentMethod._id]: true,\n [this.props.className]: true\n });\n\n const showRemovePaymentMethodButton = this.props.showRemovePaymentMethodButton && paymentMethod.props.oneClick && isSelected;\n const disableConfirmationId = `remove-${paymentMethod._id}`;\n const containerId = `container-${paymentMethod._id}`;\n const buttonId = `button-${paymentMethod._id}`;\n\n const showBrands = !paymentMethod.props.oneClick && paymentMethod.brands && paymentMethod.brands.length > 0;\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions\n <div key={paymentMethod._id} className={paymentMethodClassnames} onClick={this.handleOnListItemClick}>\n <div className=\"adyen-checkout__payment-method__header\">\n <ExpandButton\n className=\"adyen-checkout__payment-method__header__content\"\n buttonId={buttonId}\n showRadioButton={showRadioButton}\n isSelected={isSelected}\n expandContentId={containerId}\n standalone={standalone}\n >\n <PaymentMethodIcon\n // Only add alt attribute to storedPaymentMethods (to avoid SR reading the PM name twice)\n {...(paymentMethod.props.oneClick && { altDescription: getFullBrandName(paymentMethod.props.brand) })}\n type={paymentMethod.type}\n src={paymentMethod.icon}\n />\n\n <div className=\"adyen-checkout__payment-method__header__details\">\n <PaymentMethodName\n displayName={paymentMethod.displayName}\n isSelected={isSelected}\n additionalInfo={paymentMethod.additionalInfo}\n />\n {showBrands && (\n <PaymentMethodBrands\n showOtherInsteadOfNumber={paymentMethod.props.showOtherInsteadOfNumber}\n keepBrandsVisible={paymentMethod.props.keepBrandsVisible}\n brands={paymentMethod.brands}\n excludedUIBrands={BRAND_ICON_UI_EXCLUSION_LIST}\n isPaymentMethodSelected={isSelected}\n />\n )}\n </div>\n </ExpandButton>\n\n {showRemovePaymentMethodButton && (\n <Button\n inline\n variant=\"link\"\n onClick={this.toggleDisableConfirmation}\n onKeyPress={stopPropagationForActionKeys}\n onKeyDown={stopPropagationForActionKeys}\n ariaExpanded={this.state.showDisableStoredPaymentMethodConfirmation}\n ariaControls={disableConfirmationId}\n >\n {i18n.get('storedPaymentMethod.disable.button')}\n </Button>\n )}\n </div>\n\n <div className=\"adyen-checkout-pm-details-wrapper\" aria-hidden={!isSelected}>\n <div className=\"adyen-checkout__payment-method__details\" id={containerId} inert={isSelected ? undefined : true}>\n {showRemovePaymentMethodButton && (\n <DisableOneClickConfirmation\n id={disableConfirmationId}\n open={this.state.showDisableStoredPaymentMethodConfirmation}\n onDisable={this.onDisableStoredPaymentMethod}\n onCancel={this.toggleDisableConfirmation}\n />\n )}\n\n <PaymentMethodDetails paymentMethodComponent={paymentMethod} isSelected={isSelected} />\n </div>\n </div>\n </div>\n );\n }\n}\n\nexport default PaymentMethodItem;\n"],"names":["PaymentMethodItem","Component","render","paymentMethod","isSelected","isDisablingPaymentMethod","isLoading","standalone","showRadioButton","i18n","useCoreContext","isCard","props","type","paymentMethodClassnames","classNames","fundingSource","this","state","showDisableStoredPaymentMethodConfirmation","_id","className","showRemovePaymentMethodButton","oneClick","disableConfirmationId","containerId","buttonId","showBrands","brands","length","h","div","key","onClick","handleOnListItemClick","ExpandButton","expandContentId","PaymentMethodIcon","altDescription","getFullBrandName","brand","src","icon","PaymentMethodName","displayName","additionalInfo","PaymentMethodBrands","showOtherInsteadOfNumber","keepBrandsVisible","excludedUIBrands","BRAND_ICON_UI_EXCLUSION_LIST","isPaymentMethodSelected","Button","inline","variant","toggleDisableConfirmation","onKeyPress","stopPropagationForActionKeys","onKeyDown","ariaExpanded","ariaControls","get","aria-hidden","id","inert","undefined","DisableOneClickConfirmation","open","onDisable","onDisableStoredPaymentMethod","onCancel","PaymentMethodDetails","paymentMethodComponent","super","args","_define_property","setState","onSelect","defaultProps","isLoaded"],"mappings":"s+BA8BA,MAAMA,UAA0BC,EA6B5BC,MAAAA,EAAOC,cAAEA,EAAaC,WAAEA,EAAUC,yBAAEA,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AAAA,CACGC,yBAA0B5C,EAAcS,MAAMmC,yBAC9CC,kBAAmB7C,EAAcS,MAAMoC,kBACvCpB,OAAQzB,EAAcyB,OACtBqB,iBAAkBC,EAClBC,wBAAyB/C,MAMxCkB,GACGQ,EAACsB,EAAAA,CACGC,QAAAA,EACAC,QAAQ,OACRrB,QAAShB,KAAKsC,0BACdC,WAAYC,EACZC,UAAWD,EACXE,aAAc1C,KAAKC,MAAMC,2CACzByC,aAAcpC,GAEbf,EAAKoD,IAAI,wCAKtB/B,EAACC,MAAAA,CAAIV,UAAU,oCAAoCyC,eAAc1D,GAC7D0B,EAACC,MAAAA,CAAIV,UAAU,0CAA0C0C,GAAItC,EAAauC,OAAO5D,QAAa6D,GACzF3C,GACGQ,EAACoC,EAAAA,CACGH,GAAIvC,EACJ2C,KAAMlD,KAAKC,MAAMC,2CACjBiD,UAAWnD,KAAKoD,6BAChBC,SAAUrD,KAAKsC,4BAIvBzB,EAACyC,EAAAA,CAAqBC,uBAAwBrE,EAAeC,WAAYA,MAK7F,mBA9HJqE,SAAAC,GAUIC,OAAOzD,QAAQ,CACXC,4CAA4C,IAGhDwD,OAAOpB,4BAA4B,KAC/BtC,KAAK2D,SAAS,CAAEzD,4CAA6CF,KAAKC,MAAMC,+CAG5EwD,OAAON,+BAA+B,KAClCpD,KAAKL,MAAMyD,6BAA6BpD,KAAKL,MAAMT,eACnDc,KAAKsC,8BAGToB,OAAiBzC,wBAAwB,KACrC,MAAM2C,SAAEA,EAAQ1E,cAAEA,GAAkBc,KAAKL,MACzCiE,EAAS1E,MAxBbwE,EADE3E,EACqB8E,eAAe,CAClC3E,cAAe,KACfC,YAAY,EACZ2E,UAAU,EACVzE,WAAW,EACXa,4CAA4C,EAC5CX,iBAAiB"}
|
|
1
|
+
{"version":3,"file":"PaymentMethodItem.js","sources":["../../../../../../../src/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport classNames from 'classnames';\n\nimport { PaymentMethodDetails } from '../PaymentMethodDetails';\nimport PaymentMethodIcon from '../PaymentMethodIcon';\nimport DisableOneClickConfirmation from '../DisableOneClickConfirmation';\nimport UIElement from '../../../../internal/UIElement/UIElement';\nimport PaymentMethodBrands from '../PaymentMethodBrands/PaymentMethodBrands';\nimport { BRAND_ICON_UI_EXCLUSION_LIST } from '../../../../internal/SecuredFields/lib/constants';\nimport PaymentMethodName from '../PaymentMethodName';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport ExpandButton from '../../../../internal/ExpandButton';\nimport { getFullBrandName } from '../../../../Card/components/CardInput/utils';\nimport { stopPropagationForActionKeys } from '../../../../internal/Button/stopPropagationForActionKeys';\nimport './PaymentMethodItem.scss';\nimport Button from '../../../../internal/Button';\n\nexport interface PaymentMethodItemProps {\n paymentMethod: UIElement;\n isSelected?: boolean;\n isLoading?: boolean;\n isDisablingPaymentMethod: boolean;\n showRemovePaymentMethodButton: boolean;\n onDisableStoredPaymentMethod: (paymentMethod) => void;\n onSelect: (paymentMethod: UIElement) => void;\n standalone: boolean;\n className?: string;\n showRadioButton?: boolean;\n}\n\nclass PaymentMethodItem extends Component<Readonly<PaymentMethodItemProps>> {\n public static readonly defaultProps = {\n paymentMethod: null,\n isSelected: false,\n isLoaded: false,\n isLoading: false,\n showDisableStoredPaymentMethodConfirmation: false,\n showRadioButton: false\n };\n\n public state = {\n showDisableStoredPaymentMethodConfirmation: false\n };\n\n public toggleDisableConfirmation = () => {\n this.setState({ showDisableStoredPaymentMethodConfirmation: !this.state.showDisableStoredPaymentMethodConfirmation });\n };\n\n public onDisableStoredPaymentMethod = () => {\n this.props.onDisableStoredPaymentMethod(this.props.paymentMethod);\n this.toggleDisableConfirmation();\n };\n\n private readonly handleOnListItemClick = (): void => {\n const { onSelect, paymentMethod } = this.props;\n onSelect(paymentMethod);\n };\n\n // @ts-ignore need to refine the type for paymentMethod\n render({ paymentMethod, isSelected, isDisablingPaymentMethod, isLoading, standalone, showRadioButton }) {\n const { i18n } = useCoreContext();\n\n if (!paymentMethod) {\n return null;\n }\n\n const isCard = paymentMethod.props.type === 'card' || paymentMethod.props.type === 'scheme';\n\n const paymentMethodClassnames = classNames({\n 'adyen-checkout__payment-method': true,\n [`adyen-checkout__payment-method--${paymentMethod.props.type}`]: true,\n ...(isCard && { [`adyen-checkout__payment-method--${paymentMethod.props.fundingSource ?? 'credit'}`]: true }),\n 'adyen-checkout__payment-method--selected': isSelected,\n 'adyen-checkout__payment-method--loading': isLoading,\n 'adyen-checkout__payment-method--disabling': isDisablingPaymentMethod,\n 'adyen-checkout__payment-method--confirming': this.state.showDisableStoredPaymentMethodConfirmation,\n 'adyen-checkout__payment-method--standalone': standalone,\n [paymentMethod._id]: true,\n [this.props.className]: true\n });\n\n const showRemovePaymentMethodButton = this.props.showRemovePaymentMethodButton && paymentMethod.props.oneClick && isSelected;\n const disableConfirmationId = `remove-${paymentMethod._id}`;\n const containerId = `container-${paymentMethod._id}`;\n const buttonId = `button-${paymentMethod._id}`;\n\n const showBrands = !paymentMethod.props.oneClick && paymentMethod.brands && paymentMethod.brands.length > 0;\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions\n <div key={paymentMethod._id} className={paymentMethodClassnames} onClick={this.handleOnListItemClick}>\n <div className=\"adyen-checkout__payment-method__header\">\n <ExpandButton\n className=\"adyen-checkout__payment-method__header__content\"\n buttonId={buttonId}\n showRadioButton={showRadioButton}\n isSelected={isSelected}\n expandContentId={containerId}\n standalone={standalone}\n >\n <PaymentMethodIcon\n // Only add alt attribute to storedPaymentMethods (to avoid SR reading the PM name twice)\n {...(paymentMethod.props.oneClick && { alt: getFullBrandName(paymentMethod.props.brand) })}\n type={paymentMethod.type}\n src={paymentMethod.icon}\n />\n\n <div className=\"adyen-checkout__payment-method__header__details\">\n <PaymentMethodName\n displayName={paymentMethod.displayName}\n isSelected={isSelected}\n additionalInfo={paymentMethod.additionalInfo}\n />\n {showBrands && (\n <PaymentMethodBrands\n showOtherInsteadOfNumber={paymentMethod.props.showOtherInsteadOfNumber}\n keepBrandsVisible={paymentMethod.props.keepBrandsVisible}\n brands={paymentMethod.brands}\n excludedUIBrands={BRAND_ICON_UI_EXCLUSION_LIST}\n isPaymentMethodSelected={isSelected}\n />\n )}\n </div>\n </ExpandButton>\n\n {showRemovePaymentMethodButton && (\n <Button\n inline\n variant=\"link\"\n onClick={this.toggleDisableConfirmation}\n onKeyPress={stopPropagationForActionKeys}\n onKeyDown={stopPropagationForActionKeys}\n ariaExpanded={this.state.showDisableStoredPaymentMethodConfirmation}\n ariaControls={disableConfirmationId}\n >\n {i18n.get('storedPaymentMethod.disable.button')}\n </Button>\n )}\n </div>\n\n <div className=\"adyen-checkout-pm-details-wrapper\" aria-hidden={!isSelected}>\n <div className=\"adyen-checkout__payment-method__details\" id={containerId} inert={isSelected ? undefined : true}>\n {showRemovePaymentMethodButton && (\n <DisableOneClickConfirmation\n id={disableConfirmationId}\n open={this.state.showDisableStoredPaymentMethodConfirmation}\n onDisable={this.onDisableStoredPaymentMethod}\n onCancel={this.toggleDisableConfirmation}\n />\n )}\n\n <PaymentMethodDetails paymentMethodComponent={paymentMethod} isSelected={isSelected} />\n </div>\n </div>\n </div>\n );\n }\n}\n\nexport default PaymentMethodItem;\n"],"names":["PaymentMethodItem","Component","render","paymentMethod","isSelected","isDisablingPaymentMethod","isLoading","standalone","showRadioButton","i18n","useCoreContext","isCard","props","type","paymentMethodClassnames","classNames","fundingSource","this","state","showDisableStoredPaymentMethodConfirmation","_id","className","showRemovePaymentMethodButton","oneClick","disableConfirmationId","containerId","buttonId","showBrands","brands","length","h","div","key","onClick","handleOnListItemClick","ExpandButton","expandContentId","PaymentMethodIcon","alt","getFullBrandName","brand","src","icon","PaymentMethodName","displayName","additionalInfo","PaymentMethodBrands","showOtherInsteadOfNumber","keepBrandsVisible","excludedUIBrands","BRAND_ICON_UI_EXCLUSION_LIST","isPaymentMethodSelected","Button","inline","variant","toggleDisableConfirmation","onKeyPress","stopPropagationForActionKeys","onKeyDown","ariaExpanded","ariaControls","get","aria-hidden","id","inert","undefined","DisableOneClickConfirmation","open","onDisable","onDisableStoredPaymentMethod","onCancel","PaymentMethodDetails","paymentMethodComponent","super","args","_define_property","setState","onSelect","defaultProps","isLoaded"],"mappings":"s+BA8BA,MAAMA,UAA0BC,EA6B5BC,MAAAA,EAAOC,cAAEA,EAAaC,WAAEA,EAAUC,yBAAEA,EAAwBC,UAAEA,EAASC,WAAEA,EAAUC,gBAAEA,IACjF,MAAMC,KAAEA,GAASC,IAEjB,IAAKP,EACD,OAAO,KAGX,MAAMQ,EAAsC,SAA7BR,EAAcS,MAAMC,MAAgD,WAA7BV,EAAcS,MAAMC,KAEpEC,EAA0BC,EAAW,CACvC,kCAAkC,EAClC,CAAC,mCAAmCZ,EAAcS,MAAMC,SAAS,KAC7DF,GAAU,CAAE,CAAC,mCAAmCR,EAAcS,MAAMI,eAAiB,aAAa,GACtG,2CAA4CZ,EAC5C,0CAA2CE,EAC3C,4CAA6CD,EAC7C,6CAA8CY,KAAKC,MAAMC,2CACzD,6CAA8CZ,EAC9C,CAACJ,EAAciB,MAAM,EACrB,CAACH,KAAKL,MAAMS,YAAY,IAGtBC,EAAgCL,KAAKL,MAAMU,+BAAiCnB,EAAcS,MAAMW,UAAYnB,EAC5GoB,EAAwB,UAAUrB,EAAciB,MAChDK,EAAc,aAAatB,EAAciB,MACzCM,EAAW,UAAUvB,EAAciB,MAEnCO,GAAcxB,EAAcS,MAAMW,UAAYpB,EAAcyB,QAAUzB,EAAcyB,OAAOC,OAAS,EAE1G,OAEIC,EAACC,MAAAA,CAAIC,IAAK7B,EAAciB,IAAKC,UAAWP,EAAyBmB,QAAShB,KAAKiB,uBAC3EJ,EAACC,MAAAA,CAAIV,UAAU,0CACXS,EAACK,EAAAA,CACGd,UAAU,kDACVK,SAAUA,EACVlB,gBAAiBA,EACjBJ,WAAYA,EACZgC,gBAAiBX,EACjBlB,W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KAAKL,MACzCiE,EAAS1E,MAxBbwE,EADE3E,EACqB8E,eAAe,CAClC3E,cAAe,KACfC,YAAY,EACZ2E,UAAU,EACVzE,WAAW,EACXa,4CAA4C,EAC5CX,iBAAiB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../external/preact/dist/preact.js";import r from"../../internal/FormFields/Fieldset/Fieldset.js";import{useEffect as
|
|
1
|
+
import{createElement as e}from"../../../external/preact/dist/preact.js";import r from"../../internal/FormFields/Fieldset/Fieldset.js";import{useEffect as t,useRef as a}from"../../../external/preact/hooks/dist/hooks.js";import o from"../../../utils/useForm/useFormWithA11y.js";import"../../internal/SecuredFields/lib/CSF/utils/userAgent.js";import{getErrorMessage as s}from"../../../utils/getErrorMessage.js";import n from"../../internal/FormFields/Field/Field.js";import{useCoreContext as i}from"../../../core/Context/CoreProvider.js";import l from"../../internal/FormFields/InputText.js";import{bsbValidationRules as b}from"./validate.js";import{phoneFormatters as u}from"../../internal/PhoneInput/validate.js";import m from"./PayToNameFields.js";const c=["bankAccountNumber","bsb","firstName","lastName"];function d({setComponentRef:d,defaultData:p,placeholders:f,onChange:h,setStatus:F,id:N}){const{i18n:k}=i(),g=o({schema:c,defaultData:p,rules:b,formatters:u,formHolder:`#${N}`}),{handleChangeFor:A,triggerValidation:j,data:v,errors:B,valid:C,isValid:S}=g;t(()=>{h({data:v,valid:C,errors:B,isValid:S})},[v,C,B,S]);const y=a({setStatus:F,showValidation:j});return t(()=>{d(y.current)},[d]),e(r,{id:N,classNameModifiers:["payto__bsb_input"],label:"BSB",description:"payto.bsb.description"},e(n,{label:k.get("payto.bsb.label.bankAccountNumber"),classNameModifiers:["col-60","bankAccountNumber"],errorMessage:s(k,B.bankAccountNumber,k.get("payto.bsb.label.bankAccountNumber")),name:"bankAccountNumber",i18n:k,errorLive:!0},e(l,{name:"bankAccountNumber",value:v.bankAccountNumber,onInput:A("bankAccountNumber","input"),onBlur:A("bankAccountNumber","blur"),placeholder:f?.bankAccountNumber,required:!0})),e(n,{label:k.get("Bank State Branch"),classNameModifiers:["col-40","bsb"],errorMessage:s(k,B.bsb,k.get("Bank State Branch")),name:"bsb",i18n:k,errorLive:!0},e(l,{name:"bsb",value:v.bsb,onInput:A("bsb","input"),onBlur:A("bsb","blur"),placeholder:f?.bsb,required:!0})),e(m,{i18n:k,data:v,handleChangeFor:A,errors:B,placeholders:f}))}export{d as default};
|
|
2
2
|
//# sourceMappingURL=BSBInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BSBInput.js","sources":["../../../../../src/components/PayTo/components/BSBInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Fieldset from '../../internal/FormFields/Fieldset';\nimport { useEffect, useRef } from 'preact/hooks';\nimport
|
|
1
|
+
{"version":3,"file":"BSBInput.js","sources":["../../../../../src/components/PayTo/components/BSBInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Fieldset from '../../internal/FormFields/Fieldset';\nimport { useEffect, useRef } from 'preact/hooks';\nimport { useFormWithA11y } from '../../../utils/useForm';\nimport { getErrorMessage } from '../../../utils/getErrorMessage';\nimport Field from '../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport InputText from '../../internal/FormFields/InputText';\nimport { bsbValidationRules } from './validate';\nimport './PayIDInput.scss';\nimport { phoneFormatters } from '../../internal/PhoneInput/validate';\nimport { ComponentMethodsRef, UIElementStatus } from '../../internal/UIElement/types';\nimport PayToNameFields from './PayToNameFields';\nimport { PayToPlaceholdersType } from '../types';\n\nexport interface BSBFormData {\n bsb: string;\n bankAccountNumber: string;\n firstName: string;\n lastName: string;\n}\n\nexport interface BSBInputProps {\n status: UIElementStatus;\n setStatus: (status: UIElementStatus) => void;\n defaultData: BSBFormData;\n placeholders: PayToPlaceholdersType;\n onChange: (e) => void;\n setComponentRef: (ref: ComponentMethodsRef) => void;\n id?: string;\n}\n\nconst BASE_SCHEMA = ['bankAccountNumber', 'bsb', 'firstName', 'lastName'];\n\nexport default function BSBInput({ setComponentRef, defaultData, placeholders, onChange, setStatus, id }: Readonly<BSBInputProps>) {\n const { i18n } = useCoreContext();\n\n const form = useFormWithA11y<BSBFormData>({\n schema: BASE_SCHEMA,\n defaultData: defaultData,\n rules: bsbValidationRules,\n formatters: phoneFormatters,\n formHolder: `#${id}`\n });\n const { handleChangeFor, triggerValidation, data, errors, valid, isValid } = form;\n\n // standard onChange propagate to parent state\n useEffect(() => {\n onChange({ data, valid, errors, isValid });\n }, [data, valid, errors, isValid]);\n\n const payToRef = useRef<ComponentMethodsRef>({\n setStatus: setStatus,\n showValidation: triggerValidation\n });\n\n useEffect(() => {\n setComponentRef(payToRef.current);\n }, [setComponentRef]);\n\n return (\n <Fieldset id={id} classNameModifiers={['payto__bsb_input']} label={'BSB'} description={'payto.bsb.description'}>\n <Field\n label={i18n.get('payto.bsb.label.bankAccountNumber')}\n classNameModifiers={['col-60', 'bankAccountNumber']}\n errorMessage={getErrorMessage(i18n, errors.bankAccountNumber, i18n.get('payto.bsb.label.bankAccountNumber'))}\n name={'bankAccountNumber'}\n i18n={i18n}\n errorLive={true}\n >\n <InputText\n name={'bankAccountNumber'}\n value={data.bankAccountNumber}\n onInput={handleChangeFor('bankAccountNumber', 'input')}\n onBlur={handleChangeFor('bankAccountNumber', 'blur')}\n placeholder={placeholders?.bankAccountNumber}\n required={true}\n />\n </Field>\n\n <Field\n label={i18n.get('Bank State Branch')}\n classNameModifiers={['col-40', 'bsb']}\n errorMessage={getErrorMessage(i18n, errors.bsb, i18n.get('Bank State Branch'))}\n name={'bsb'}\n i18n={i18n}\n errorLive={true}\n >\n <InputText\n name={'bsb'}\n value={data.bsb}\n onInput={handleChangeFor('bsb', 'input')}\n onBlur={handleChangeFor('bsb', 'blur')}\n placeholder={placeholders?.bsb}\n required={true}\n />\n </Field>\n\n <PayToNameFields i18n={i18n} data={data} handleChangeFor={handleChangeFor} errors={errors} placeholders={placeholders} />\n </Fieldset>\n );\n}\n"],"names":["BASE_SCHEMA","BSBInput","setComponentRef","defaultData","placeholders","onChange","setStatus","id","i18n","useCoreContext","form","useFormWithA11y","schema","rules","bsbValidationRules","formatters","phoneFormatters","formHolder","handleChangeFor","triggerValidation","data","errors","valid","isValid","useEffect","payToRef","useRef","showValidation","current","h","Fieldset","classNameModifiers","label","description","Field","get","errorMessage","getErrorMessage","bankAccountNumber","name","errorLive","InputText","value","onInput","onBlur","placeholder","required","bsb","PayToNameFields"],"mappings":"4uBAgCA,MAAMA,EAAc,CAAC,oBAAqB,MAAO,YAAa,YAE/C,SAASC,GAASC,gBAAEA,EAAeC,YAAEA,EAAWC,aAAEA,EAAYC,SAAEA,EAAQC,UAAEA,EAASC,GAAEA,IAChG,MAAMC,KAAEA,GAASC,IAEXC,EAAOC,EAA6B,CACtCC,OAAQZ,EACRG,YAAaA,EACbU,MAAOC,EACPC,WAAYC,EACZC,WAAY,IAAIV,OAEdW,gBAAEA,EAAeC,kBAAEA,EAAiBC,KAAEA,EAAIC,OAAEA,EAAMC,MAAEA,EAAKC,QAAEA,GAAYb,EAG7Ec,EAAU,KACNnB,EAAS,CAAEe,OAAME,QAAOD,SAAQE,aACjC,CAACH,EAAME,EAAOD,EAAQE,IAEzB,MAAME,EAAWC,EAA4B,CACzCpB,UAAWA,EACXqB,eAAgBR,IAOpB,OAJAK,EAAU,KACNtB,EAAgBuB,EAASG,UAC1B,CAAC1B,IAGA2B,EAACC,EAAAA,CAASvB,GAAIA,EAAIwB,mBAAoB,CAAC,oBAAqBC,MAAO,MAAOC,YAAa,yBACnFJ,EAACK,EAAAA,CACGF,MAAOxB,EAAK2B,IAAI,qCAChBJ,mBAAoB,CAAC,SAAU,qBAC/BK,aAAcC,EAAgB7B,EAAMa,EAAOiB,kBAAmB9B,EAAK2B,IAAI,sCACvEI,KAAM,oBACN/B,KAAMA,EACNgC,WAAW,GAEXX,EAACY,EAAAA,CACGF,KAAM,oBACNG,MAAOtB,EAAKkB,kBACZK,QAASzB,EAAgB,oBAAqB,SAC9C0B,OAAQ1B,EAAgB,oBAAqB,QAC7C2B,YAAazC,GAAckC,kBAC3BQ,UAAU,KAIlBjB,EAACK,EAAAA,CACGF,MAAOxB,EAAK2B,IAAI,qBAChBJ,mBAAoB,CAAC,SAAU,OAC/BK,aAAcC,EAAgB7B,EAAMa,EAAO0B,IAAKvC,EAAK2B,IAAI,sBACzDI,KAAM,MACN/B,KAAMA,EACNgC,WAAW,GAEXX,EAACY,EAAAA,CACGF,KAAM,MACNG,MAAOtB,EAAK2B,IACZJ,QAASzB,EAAgB,MAAO,SAChC0B,OAAQ1B,EAAgB,MAAO,QAC/B2B,YAAazC,GAAc2C,IAC3BD,UAAU,KAIlBjB,EAACmB,EAAAA,CAAgBxC,KAAMA,EAAMY,KAAMA,EAAMF,gBAAiBA,EAAiBG,OAAQA,EAAQjB,aAAcA,IAGrH"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../external/preact/dist/preact.js";import r from"../../internal/FormFields/Fieldset/Fieldset.js";import i,{PayToIdentifierEnum as a}from"./IdentifierSelector.js";import{useEffect as t,useRef as o}from"../../../external/preact/hooks/dist/hooks.js";import l from"../../../utils/useForm/
|
|
1
|
+
import{createElement as e}from"../../../external/preact/dist/preact.js";import r from"../../internal/FormFields/Fieldset/Fieldset.js";import i,{PayToIdentifierEnum as a}from"./IdentifierSelector.js";import{useEffect as t,useRef as o}from"../../../external/preact/hooks/dist/hooks.js";import l from"../../../utils/useForm/useFormWithA11y.js";import"../../internal/SecuredFields/lib/CSF/utils/userAgent.js";import s from"./PayToPhone.js";import n from"../../internal/FormFields/InputEmail.js";import{getErrorMessage as d}from"../../../utils/getErrorMessage.js";import m from"../../internal/FormFields/Field/Field.js";import{useCoreContext as p}from"../../../core/Context/CoreProvider.js";import f from"../../internal/FormFields/InputText.js";import{payIdValidationRules as c}from"./validate.js";import{phoneFormatters as u}from"../../internal/PhoneInput/validate.js";import g from"./PayToNameFields.js";const h=["selectedIdentifier","firstName","lastName"],b={[a.email]:["email"],[a.phone]:["phoneNumber","phonePrefix"],[a.abn]:["abn"],[a.orgid]:["orgid"]};function I({setComponentRef:I,defaultData:F,placeholders:j,onChange:y,setStatus:N,id:v}){const{i18n:M}=p(),C=l({schema:h,defaultData:{selectedIdentifier:a.phone,...F},rules:c,formatters:u,formHolder:`#${v}`}),{handleChangeFor:P,triggerValidation:S,data:x,errors:B,valid:E,isValid:A,setSchema:V}=C;t(()=>{V([...b[x.selectedIdentifier],...h])},[x.selectedIdentifier]),t(()=>{y({data:x,valid:E,errors:B,isValid:A})},[x,E,B,A]);const q=o({setStatus:N,showValidation:S});return t(()=>{I(q.current)},[I]),e(r,{id:v,classNameModifiers:["payto__payid_input"],label:"PayID",description:"payto.payid.description"},e(i,{classNameModifiers:["col-40"],onSelectedIdentifier:P("selectedIdentifier"),selectedIdentifier:x.selectedIdentifier}),x.selectedIdentifier===a.phone&&e(s,{form:C}),x.selectedIdentifier===a.email&&e(m,{label:M.get("shopperEmail"),classNameModifiers:["col-60","email"],errorMessage:d(M,B.email,M.get("shopperEmail")),dir:"ltr",name:"email",i18n:M,errorLive:!0},e(n,{name:"email",value:x.email,onInput:P("email","input"),onBlur:P("email","blur"),placeholder:j?.email,required:!0})),x.selectedIdentifier===a.abn&&e(m,{label:M.get("ABN"),classNameModifiers:["col-60","abn"],errorMessage:d(M,B.abn,M.get("ABN")),name:"ABN",i18n:M,errorLive:!0},e(f,{name:"abn",value:x.abn,onInput:P("abn","input"),onBlur:P("abn","blur"),placeholder:j?.abn,required:!0})),x.selectedIdentifier===a.orgid&&e(m,{label:M.get("payto.payid.label.orgid"),classNameModifiers:["col-60","orgid"],errorMessage:d(M,B.orgid,M.get("payto.payid.label.orgid")),name:"orgid",i18n:M,errorLive:!0},e(f,{name:"orgid",value:x.orgid,onInput:P("orgid","input"),onBlur:P("orgid","blur"),placeholder:j?.orgid,required:!0})),e(g,{i18n:M,data:x,handleChangeFor:P,errors:B,placeholders:j}))}export{I as default};
|
|
2
2
|
//# sourceMappingURL=PayIDInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayIDInput.js","sources":["../../../../../src/components/PayTo/components/PayIDInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Fieldset from '../../internal/FormFields/Fieldset';\nimport IdentifierSelector, { PayToIdentifierEnum } from './IdentifierSelector';\nimport { useEffect, useRef } from 'preact/hooks';\nimport
|
|
1
|
+
{"version":3,"file":"PayIDInput.js","sources":["../../../../../src/components/PayTo/components/PayIDInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Fieldset from '../../internal/FormFields/Fieldset';\nimport IdentifierSelector, { PayToIdentifierEnum } from './IdentifierSelector';\nimport { useEffect, useRef } from 'preact/hooks';\nimport { useFormWithA11y } from '../../../utils/useForm';\nimport PayToPhone from './PayToPhone';\nimport InputEmail from '../../internal/FormFields/InputEmail';\nimport { getErrorMessage } from '../../../utils/getErrorMessage';\nimport Field from '../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport InputText from '../../internal/FormFields/InputText';\nimport { payIdValidationRules } from './validate';\nimport './PayIDInput.scss';\nimport { phoneFormatters } from '../../internal/PhoneInput/validate';\nimport { ComponentMethodsRef, UIElementStatus } from '../../internal/UIElement/types';\nimport PayToNameFields from './PayToNameFields';\nimport { PayToPlaceholdersType } from '../types';\n\nexport interface PayIdFormData {\n email: string;\n phone: string;\n abn: string;\n orgid: string;\n firstName: string;\n lastName: string;\n phoneNumber?: string;\n phonePrefix?: string;\n selectedIdentifier: PayToIdentifierEnum;\n}\n\nexport interface PayIDInputProps {\n status: UIElementStatus;\n setStatus: (status: UIElementStatus) => void;\n defaultData: PayIdFormData;\n placeholders: PayToPlaceholdersType;\n onChange: (e) => void;\n setComponentRef: (ref: ComponentMethodsRef) => void;\n id?: string;\n}\n\nconst BASE_SCHEMA = ['selectedIdentifier', 'firstName', 'lastName'];\n\nconst IDENTIFIER_SCHEMA = {\n [PayToIdentifierEnum.email]: ['email'],\n [PayToIdentifierEnum.phone]: ['phoneNumber', 'phonePrefix'],\n [PayToIdentifierEnum.abn]: ['abn'],\n [PayToIdentifierEnum.orgid]: ['orgid']\n};\n\nexport default function PayIDInput({ setComponentRef, defaultData, placeholders, onChange, setStatus, id }: Readonly<PayIDInputProps>) {\n const { i18n } = useCoreContext();\n\n const form = useFormWithA11y<PayIdFormData>({\n schema: BASE_SCHEMA,\n defaultData: { selectedIdentifier: PayToIdentifierEnum.phone, ...defaultData },\n rules: payIdValidationRules,\n formatters: phoneFormatters,\n formHolder: `#${id}`\n });\n const { handleChangeFor, triggerValidation, data, errors, valid, isValid, setSchema } = form;\n\n // handle the changes of identifier, each identifier gets its own schema\n useEffect(() => {\n // get the correct schema for each identifier and merge it with the base\n setSchema([...IDENTIFIER_SCHEMA[data.selectedIdentifier], ...BASE_SCHEMA]);\n }, [data.selectedIdentifier]);\n\n // standard onChange propagate to parent state\n useEffect(() => {\n onChange({ data, valid, errors, isValid });\n }, [data, valid, errors, isValid]);\n\n const payToRef = useRef<ComponentMethodsRef>({\n setStatus: setStatus,\n showValidation: triggerValidation\n });\n\n useEffect(() => {\n setComponentRef(payToRef.current);\n }, [setComponentRef]);\n\n return (\n <Fieldset id={id} classNameModifiers={['payto__payid_input']} label={'PayID'} description={'payto.payid.description'}>\n <IdentifierSelector\n classNameModifiers={['col-40']}\n onSelectedIdentifier={handleChangeFor('selectedIdentifier')}\n selectedIdentifier={data.selectedIdentifier}\n />\n {data.selectedIdentifier === PayToIdentifierEnum.phone && <PayToPhone form={form} />}\n\n {/* TODO probably worth refactoring this into either re-usable components or builder */}\n {data.selectedIdentifier === PayToIdentifierEnum.email && (\n <Field\n label={i18n.get('shopperEmail')}\n classNameModifiers={['col-60', 'email']}\n errorMessage={getErrorMessage(i18n, errors.email, i18n.get('shopperEmail'))}\n dir={'ltr'}\n name={'email'}\n i18n={i18n}\n errorLive={true}\n >\n <InputEmail\n name={'email'}\n value={data.email}\n onInput={handleChangeFor('email', 'input')}\n onBlur={handleChangeFor('email', 'blur')}\n placeholder={placeholders?.email}\n required={true}\n />\n </Field>\n )}\n\n {data.selectedIdentifier === PayToIdentifierEnum.abn && (\n <Field\n label={i18n.get('ABN')}\n classNameModifiers={['col-60', 'abn']}\n errorMessage={getErrorMessage(i18n, errors.abn, i18n.get('ABN'))}\n name={'ABN'}\n i18n={i18n}\n errorLive={true}\n >\n <InputText\n name={'abn'}\n value={data.abn}\n onInput={handleChangeFor('abn', 'input')}\n onBlur={handleChangeFor('abn', 'blur')}\n placeholder={placeholders?.abn}\n required={true}\n />\n </Field>\n )}\n\n {data.selectedIdentifier === PayToIdentifierEnum.orgid && (\n <Field\n label={i18n.get('payto.payid.label.orgid')}\n classNameModifiers={['col-60', 'orgid']}\n errorMessage={getErrorMessage(i18n, errors.orgid, i18n.get('payto.payid.label.orgid'))}\n name={'orgid'}\n i18n={i18n}\n errorLive={true}\n >\n <InputText\n name={'orgid'}\n value={data.orgid}\n onInput={handleChangeFor('orgid', 'input')}\n onBlur={handleChangeFor('orgid', 'blur')}\n placeholder={placeholders?.orgid}\n required={true}\n />\n </Field>\n )}\n\n <PayToNameFields i18n={i18n} data={data} handleChangeFor={handleChangeFor} errors={errors} placeholders={placeholders} />\n </Fieldset>\n );\n}\n"],"names":["BASE_SCHEMA","IDENTIFIER_SCHEMA","PayToIdentifierEnum","email","phone","abn","orgid","PayIDInput","setComponentRef","defaultData","placeholders","onChange","setStatus","id","i18n","useCoreContext","form","useFormWithA11y","schema","selectedIdentifier","rules","payIdValidationRules","formatters","phoneFormatters","formHolder","handleChangeFor","triggerValidation","data","errors","valid","isValid","setSchema","useEffect","payToRef","useRef","showValidation","current","h","Fieldset","classNameModifiers","label","description","IdentifierSelector","onSelectedIdentifier","PayToPhone","Field","get","errorMessage","getErrorMessage","dir","name","errorLive","InputEmail","value","onInput","onBlur","placeholder","required","InputText","PayToNameFields"],"mappings":"q4BAwCA,MAAMA,EAAc,CAA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C,EAAMc,EAAOzB,MAAOW,EAAKgC,IAAI,iBAC3DG,IAAK,MACLC,KAAM,QACNpC,KAAMA,EACNqC,WAAW,GAEXd,EAACe,EAAAA,CACGF,KAAM,QACNG,MAAO1B,EAAKxB,MACZmD,QAAS7B,EAAgB,QAAS,SAClC8B,OAAQ9B,EAAgB,QAAS,QACjC+B,YAAa9C,GAAcP,MAC3BsD,UAAU,KAKrB9B,EAAKR,qBAAuBjB,EAAoBG,KAC7CgC,EAACQ,EAAAA,CACGL,MAAO1B,EAAKgC,IAAI,OAChBP,mBAAoB,CAAC,SAAU,OAC/BQ,aAAcC,EAAgBlC,EAAMc,EAAOvB,IAAKS,EAAKgC,IAAI,QACzDI,KAAM,MACNpC,KAAMA,EACNqC,WAAW,GAEXd,EAACqB,EAAAA,CACGR,KAAM,MACNG,MAAO1B,EAAKtB,IACZiD,QAAS7B,EAAgB,MAAO,SAChC8B,OAAQ9B,EAAgB,MAAO,QAC/B+B,YAAa9C,GAAcL,IAC3BoD,UAAU,KAKrB9B,EAAKR,qBAAuBjB,EAAoBI,OAC7C+B,EAACQ,EAAAA,CACGL,MAAO1B,EAAKgC,IAAI,2BAChBP,mBAAoB,CAAC,SAAU,SAC/BQ,aAAcC,EAAgBlC,EAAMc,EAAOtB,MAAOQ,EAAKgC,IAAI,4BAC3DI,KAAM,QACNpC,KAAMA,EACNqC,WAAW,GAEXd,EAACqB,EAAAA,CACGR,KAAM,QACNG,MAAO1B,EAAKrB,MACZgD,QAAS7B,EAAgB,QAAS,SAClC8B,OAAQ9B,EAAgB,QAAS,QACjC+B,YAAa9C,GAAcJ,MAC3BmD,UAAU,KAKtBpB,EAACsB,EAAAA,CAAgB7C,KAAMA,EAAMa,KAAMA,EAAMF,gBAAiBA,EAAiBG,OAAQA,EAAQlB,aAAcA,IAGrH"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e,Fragment as a}from"../../../external/preact/dist/preact.js";import r from"../../internal/FormFields/Field/Field.js";import{getErrorMessage as s}from"../../../utils/getErrorMessage.js";import t from"../../internal/FormFields/InputText.js";function l({i18n:l,errors:
|
|
1
|
+
import{createElement as e,Fragment as a}from"../../../external/preact/dist/preact.js";import r from"../../internal/FormFields/Field/Field.js";import{getErrorMessage as s}from"../../../utils/getErrorMessage.js";import t from"../../internal/FormFields/InputText.js";function l({i18n:l,errors:i,data:m,handleChangeFor:o,placeholders:n}){return e(a,null,e(r,{label:l.get("payto.label.firstName"),classNameModifiers:["col-50","firstName"],errorMessage:s(l,i.firstName,l.get("firstName")),name:"firstName",i18n:l,errorLive:!0},e(t,{name:"firstName",value:m.firstName,classNameModifiers:["firstName"],onInput:o("firstName","input"),onBlur:o("firstName","input"),placeholder:n?.firstName,spellcheck:!1,required:!0})),e(r,{label:l.get("payto.label.lastName"),classNameModifiers:["col-50","lastName"],errorMessage:s(l,i.lastName,l.get("lastName")),name:"lastName",i18n:l,errorLive:!0},e(t,{name:"lastName",value:m.lastName,classNameModifiers:["lastName"],onInput:o("lastName","input"),onBlur:o("lastName","blur"),placeholder:n?.lastName,spellcheck:!1,required:!0})))}export{l as default};
|
|
2
2
|
//# sourceMappingURL=PayToNameFields.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayToNameFields.js","sources":["../../../../../src/components/PayTo/components/PayToNameFields.tsx"],"sourcesContent":["import { h, Fragment } from 'preact';\nimport Field from '../../internal/FormFields/Field';\nimport { getErrorMessage } from '../../../utils/getErrorMessage';\nimport InputText from '../../internal/FormFields/InputText';\nimport Language from '../../../language';\nimport { HandleChangeForModeType } from '../../../utils/useForm/types';\nimport { ValidationRuleResult } from '../../../utils/Validator/ValidationRuleResult';\n\nexport interface PayToNameFieldsProps {\n i18n: Language;\n errors: {\n [key: string]: ValidationRuleResult;\n };\n data: {\n firstName: string;\n lastName: string;\n };\n handleChangeFor: (key: string, mode?: HandleChangeForModeType) => (e: h.JSX.TargetedEvent<HTMLInputElement, Event>) => void;\n placeholders: {\n firstName: string;\n lastName: string;\n };\n}\n\nexport default function PayToNameFields({ i18n, errors, data, handleChangeFor, placeholders }: Readonly<PayToNameFieldsProps>) {\n return (\n <Fragment>\n <Field\n label={i18n.get('payto.label.firstName')}\n classNameModifiers={['col-50', 'firstName']}\n errorMessage={getErrorMessage(i18n, errors.firstName, i18n.get('firstName'))}\n name={'firstName'}\n i18n={i18n}\n >\n <InputText\n name={'firstName'}\n value={data.firstName}\n classNameModifiers={['firstName']}\n onInput={handleChangeFor('firstName', 'input')}\n onBlur={handleChangeFor('firstName', 'input')}\n placeholder={placeholders?.firstName}\n spellcheck={false}\n required={true}\n />\n </Field>\n <Field\n label={i18n.get('payto.label.lastName')}\n classNameModifiers={['col-50', 'lastName']}\n errorMessage={getErrorMessage(i18n, errors.lastName, i18n.get('lastName'))}\n name={'lastName'}\n i18n={i18n}\n >\n <InputText\n name={'lastName'}\n value={data.lastName}\n classNameModifiers={['lastName']}\n onInput={handleChangeFor('lastName', 'input')}\n onBlur={handleChangeFor('lastName', 'blur')}\n placeholder={placeholders?.lastName}\n spellcheck={false}\n required={true}\n />\n </Field>\n </Fragment>\n );\n}\n"],"names":["PayToNameFields","i18n","errors","data","handleChangeFor","placeholders","h","Fragment","Field","label","get","classNameModifiers","errorMessage","getErrorMessage","firstName","name","InputText","value","onInput","onBlur","placeholder","spellcheck","required","lastName"],"mappings":"wQAwBe,SAASA,GAAgBC,KAAEA,EAAIC,OAAEA,EAAMC,KAAEA,EAAIC,gBAAEA,EAAeC,aAAEA,IAC3E,OACIC,EAACC,OACGD,EAACE,EAAAA,CACGC,MAAOR,EAAKS,IAAI,yBAChBC,mBAAoB,CAAC,SAAU,aAC/BC,aAAcC,EAAgBZ,EAAMC,EAAOY,UAAWb,EAAKS,IAAI,cAC/DK,KAAM,YACNd,KAAMA,
|
|
1
|
+
{"version":3,"file":"PayToNameFields.js","sources":["../../../../../src/components/PayTo/components/PayToNameFields.tsx"],"sourcesContent":["import { h, Fragment } from 'preact';\nimport Field from '../../internal/FormFields/Field';\nimport { getErrorMessage } from '../../../utils/getErrorMessage';\nimport InputText from '../../internal/FormFields/InputText';\nimport Language from '../../../language';\nimport { HandleChangeForModeType } from '../../../utils/useForm/types';\nimport { ValidationRuleResult } from '../../../utils/Validator/ValidationRuleResult';\n\nexport interface PayToNameFieldsProps {\n i18n: Language;\n errors: {\n [key: string]: ValidationRuleResult;\n };\n data: {\n firstName: string;\n lastName: string;\n };\n handleChangeFor: (key: string, mode?: HandleChangeForModeType) => (e: h.JSX.TargetedEvent<HTMLInputElement, Event>) => void;\n placeholders: {\n firstName: string;\n lastName: string;\n };\n}\n\nexport default function PayToNameFields({ i18n, errors, data, handleChangeFor, placeholders }: Readonly<PayToNameFieldsProps>) {\n return (\n <Fragment>\n <Field\n label={i18n.get('payto.label.firstName')}\n classNameModifiers={['col-50', 'firstName']}\n errorMessage={getErrorMessage(i18n, errors.firstName, i18n.get('firstName'))}\n name={'firstName'}\n i18n={i18n}\n errorLive={true}\n >\n <InputText\n name={'firstName'}\n value={data.firstName}\n classNameModifiers={['firstName']}\n onInput={handleChangeFor('firstName', 'input')}\n onBlur={handleChangeFor('firstName', 'input')}\n placeholder={placeholders?.firstName}\n spellcheck={false}\n required={true}\n />\n </Field>\n <Field\n label={i18n.get('payto.label.lastName')}\n classNameModifiers={['col-50', 'lastName']}\n errorMessage={getErrorMessage(i18n, errors.lastName, i18n.get('lastName'))}\n name={'lastName'}\n i18n={i18n}\n errorLive={true}\n >\n <InputText\n name={'lastName'}\n value={data.lastName}\n classNameModifiers={['lastName']}\n onInput={handleChangeFor('lastName', 'input')}\n onBlur={handleChangeFor('lastName', 'blur')}\n placeholder={placeholders?.lastName}\n spellcheck={false}\n required={true}\n />\n </Field>\n </Fragment>\n );\n}\n"],"names":["PayToNameFields","i18n","errors","data","handleChangeFor","placeholders","h","Fragment","Field","label","get","classNameModifiers","errorMessage","getErrorMessage","firstName","name","errorLive","InputText","value","onInput","onBlur","placeholder","spellcheck","required","lastName"],"mappings":"wQAwBe,SAASA,GAAgBC,KAAEA,EAAIC,OAAEA,EAAMC,KAAEA,EAAIC,gBAAEA,EAAeC,aAAEA,IAC3E,OACIC,EAACC,OACGD,EAACE,EAAAA,CACGC,MAAOR,EAAKS,IAAI,yBAChBC,mBAAoB,CAAC,SAAU,aAC/BC,aAAcC,EAAgBZ,EAAMC,EAAOY,UAAWb,EAAKS,IAAI,cAC/DK,KAAM,YACNd,KAAMA,EACNe,WAAW,GAEXV,EAACW,EAAAA,CACGF,KAAM,YACNG,MAAOf,EAAKW,UACZH,mBAAoB,CAAC,aACrBQ,QAASf,EAAgB,YAAa,SACtCgB,OAAQhB,EAAgB,YAAa,SACrCiB,YAAahB,GAAcS,UAC3BQ,YAAY,EACZC,UAAU,KAGlBjB,EAACE,EAAAA,CACGC,MAAOR,EAAKS,IAAI,wBAChBC,mBAAoB,CAAC,SAAU,YAC/BC,aAAcC,EAAgBZ,EAAMC,EAAOsB,SAAUvB,EAAKS,IAAI,aAC9DK,KAAM,WACNd,KAAMA,EACNe,WAAW,GAEXV,EAACW,EAAAA,CACGF,KAAM,WACNG,MAAOf,EAAKqB,SACZb,mBAAoB,CAAC,YACrBQ,QAASf,EAAgB,WAAY,SACrCgB,OAAQhB,EAAgB,WAAY,QACpCiB,YAAahB,GAAcmB,SAC3BF,YAAY,EACZC,UAAU,KAK9B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../external/preact/dist/preact.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";import o from"../../internal/PhoneInput/PhoneInputFields.js";import{getErrorMessage as t}from"../../../utils/getErrorMessage.js";import{useCallback as s}from"../../../external/preact/hooks/dist/hooks.js";const
|
|
1
|
+
import{createElement as e}from"../../../external/preact/dist/preact.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";import o from"../../internal/PhoneInput/PhoneInputFields.js";import{getErrorMessage as t}from"../../../utils/getErrorMessage.js";import{useCallback as s}from"../../../external/preact/hooks/dist/hooks.js";const i=[{id:"+61",name:"+61 (AU)",selectedOptionName:"+61"}];function m({form:m}){const{i18n:n}=r(),a=s(e=>t(n,m.errors[e]),[n,m]);return e(o,{phoneNumberKey:"mobileNumber",getError:a,items:i,canSelectPrefix:!1,showNumber:!0,showPrefix:!0,form:m,errorLive:!0})}export{m as default};
|
|
2
2
|
//# sourceMappingURL=PayToPhone.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayToPhone.js","sources":["../../../../../src/components/PayTo/components/PayToPhone.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport PhoneInputFields from '../../internal/PhoneInput/PhoneInputFields';\nimport { Form } from '../../../utils/useForm/types';\nimport { PayIdFormData } from './PayIDInput';\nimport { getErrorMessage } from '../../../utils/getErrorMessage';\nimport { useCallback } from 'preact/hooks';\n\ninterface PayToPhoneProps {\n form: Form<PayIdFormData>;\n}\n\n// we have decided to hardcode phone prefix as it's going to be always +61 for now\nconst AUSTRALIAN_PHONE_PREFIXES = [\n {\n id: '+61',\n name: '+61 (AU)',\n selectedOptionName: '+61'\n }\n];\n\nexport default function PayToPhone({ form }: Readonly<PayToPhoneProps>) {\n const { i18n } = useCoreContext();\n\n const getError = useCallback((field: string) => getErrorMessage(i18n, form.errors[field]), [i18n, form]);\n\n return (\n <PhoneInputFields\n phoneNumberKey={'mobileNumber'}\n getError={getError}\n items={AUSTRALIAN_PHONE_PREFIXES}\n canSelectPrefix={false}\n showNumber={true}\n showPrefix={true}\n form={form}\n />\n );\n}\n"],"names":["AUSTRALIAN_PHONE_PREFIXES","id","name","selectedOptionName","PayToPhone","form","i18n","useCoreContext","getError","useCallback","field","getErrorMessage","errors","h","PhoneInputFields","phoneNumberKey","items","canSelectPrefix","showNumber","showPrefix"],"mappings":"2VAaA,MAAMA,EAA4B,CAC9B,CACIC,GAAI,MACJC,KAAM,WACNC,mBAAoB,QAIb,SAASC,GAAWC,KAAEA,IACjC,MAAMC,KAAEA,GAASC,IAEXC,EAAWC,EAAaC,GAAkBC,EAAgBL,EAAMD,EAAKO,OAAOF,IAAS,CAACJ,EAAMD,IAElG,OACIQ,EAACC,EAAAA,CACGC,eAAgB,eAChBP,SAAUA,EACVQ,MAAOhB,EACPiB,iBAAiB,EACjBC,YAAY,EACZC,YAAY,EACZd,KAAMA,
|
|
1
|
+
{"version":3,"file":"PayToPhone.js","sources":["../../../../../src/components/PayTo/components/PayToPhone.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport PhoneInputFields from '../../internal/PhoneInput/PhoneInputFields';\nimport { Form } from '../../../utils/useForm/types';\nimport { PayIdFormData } from './PayIDInput';\nimport { getErrorMessage } from '../../../utils/getErrorMessage';\nimport { useCallback } from 'preact/hooks';\n\ninterface PayToPhoneProps {\n form: Form<PayIdFormData>;\n}\n\n// we have decided to hardcode phone prefix as it's going to be always +61 for now\nconst AUSTRALIAN_PHONE_PREFIXES = [\n {\n id: '+61',\n name: '+61 (AU)',\n selectedOptionName: '+61'\n }\n];\n\nexport default function PayToPhone({ form }: Readonly<PayToPhoneProps>) {\n const { i18n } = useCoreContext();\n\n const getError = useCallback((field: string) => getErrorMessage(i18n, form.errors[field]), [i18n, form]);\n\n return (\n <PhoneInputFields\n phoneNumberKey={'mobileNumber'}\n getError={getError}\n items={AUSTRALIAN_PHONE_PREFIXES}\n canSelectPrefix={false}\n showNumber={true}\n showPrefix={true}\n form={form}\n errorLive={true}\n />\n );\n}\n"],"names":["AUSTRALIAN_PHONE_PREFIXES","id","name","selectedOptionName","PayToPhone","form","i18n","useCoreContext","getError","useCallback","field","getErrorMessage","errors","h","PhoneInputFields","phoneNumberKey","items","canSelectPrefix","showNumber","showPrefix","errorLive"],"mappings":"2VAaA,MAAMA,EAA4B,CAC9B,CACIC,GAAI,MACJC,KAAM,WACNC,mBAAoB,QAIb,SAASC,GAAWC,KAAEA,IACjC,MAAMC,KAAEA,GAASC,IAEXC,EAAWC,EAAaC,GAAkBC,EAAgBL,EAAMD,EAAKO,OAAOF,IAAS,CAACJ,EAAMD,IAElG,OACIQ,EAACC,EAAAA,CACGC,eAAgB,eAChBP,SAAUA,EACVQ,MAAOhB,EACPiB,iBAAiB,EACjBC,YAAY,EACZC,YAAY,EACZd,KAAMA,EACNe,WAAW,GAGvB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as
|
|
1
|
+
import{createElement as e}from"../../../../external/preact/dist/preact.js";import{useEffect as t,useState as a}from"../../../../external/preact/hooks/dist/hooks.js";import{pixValidationRules as r}from"./validate.js";import{pixFormatters as s}from"./utils.js";import{useCoreContext as i}from"../../../../core/Context/CoreProvider.js";import o from"../../../../utils/useForm/useForm.js";import"../../../internal/SecuredFields/lib/CSF/utils/userAgent.js";import{BrazilPersonalDetail as l}from"../../../internal/SocialSecurityNumberBrazil/BrazilPersonalDetail.js";function n({name:n,data:d,personalDetailsRequired:m,showPayButton:u,onChange:c,payButton:p}){const{i18n:f}=i(),h=["firstName","lastName","socialSecurityNumber"],{handleChangeFor:j,triggerValidation:y,setSchema:S,data:g,valid:v,errors:C,isValid:F}=o({schema:h,defaultData:d,rules:r,formatters:s});t(()=>{const e=m?[...h]:[];S(e)},[m]);const[N,x]=a("ready");this.setStatus=x,this.showValidation=()=>{y()},t(()=>{c({data:g,valid:v,errors:C,isValid:F})},[c,g,v,C]);const b=m?[]:["standalone"];return e("div",{className:"adyen-checkout__pix-input__field",style:u||m?null:{display:"none"}},m&&e(l,{i18n:f,data:g,handleChangeFor:j,errors:C,valid:v}),u&&p({status:N,label:`${f.get("continueTo")} ${n}`,classNameModifiers:b}))}export{n as default};
|
|
2
2
|
//# sourceMappingURL=PixInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PixInput.js","sources":["../../../../../../src/components/Pix/components/PixInput/PixInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useState } from 'preact/hooks';\nimport { pixValidationRules } from './validate';\nimport { pixFormatters } from './utils';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport useForm from '../../../../utils/useForm';\nimport { BrazilPersonalDetail } from '../../../internal/SocialSecurityNumberBrazil/BrazilPersonalDetail';\nimport { PixInputDataState, PixInputProps } from './types';\n\nfunction PixInput({ name, data: dataProps, personalDetailsRequired, showPayButton, onChange, payButton }: Readonly<PixInputProps>) {\n const { i18n } = useCoreContext();\n const formSchema = ['firstName', 'lastName', 'socialSecurityNumber'];\n\n const { handleChangeFor, triggerValidation, setSchema, data, valid, errors, isValid } = useForm<PixInputDataState>({\n schema: formSchema,\n defaultData: dataProps,\n rules: pixValidationRules,\n formatters: pixFormatters\n });\n\n // Handle form schema updates\n useEffect(() => {\n const newSchema = personalDetailsRequired ? [...formSchema] : [];\n setSchema(newSchema);\n }, [personalDetailsRequired]);\n\n const [status, setStatus] = useState('ready');\n this.setStatus = setStatus;\n\n this.showValidation = () => {\n triggerValidation();\n };\n\n useEffect(() => {\n onChange({ data, valid, errors, isValid });\n }, [onChange, data, valid, errors]);\n\n const buttonModifiers = !personalDetailsRequired ? ['standalone'] : [];\n\n return (\n <div className=\"adyen-checkout__pix-input__field\" style={!showPayButton && !personalDetailsRequired ? { display: 'none' } : null}>\n {personalDetailsRequired && (\n <BrazilPersonalDetail i18n={i18n} data={data} handleChangeFor={handleChangeFor} errors={errors} valid={valid} />\n )}\n\n {showPayButton &&\n payButton({\n status,\n label: `${i18n.get('continueTo')} ${name}`,\n classNameModifiers: buttonModifiers\n })}\n </div>\n );\n}\n\nexport default PixInput;\n"],"names":["PixInput","name","data","dataProps","personalDetailsRequired","showPayButton","onChange","payButton","i18n","useCoreContext","formSchema","handleChangeFor","triggerValidation","setSchema","valid","errors","isValid","useForm","schema","defaultData","rules","pixValidationRules","formatters","pixFormatters","useEffect","newSchema","status","setStatus","useState","this","showValidation","buttonModifiers","h","div","className","style","display","BrazilPersonalDetail","label","get","classNameModifiers"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PixInput.js","sources":["../../../../../../src/components/Pix/components/PixInput/PixInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useState } from 'preact/hooks';\nimport { pixValidationRules } from './validate';\nimport { pixFormatters } from './utils';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport useForm from '../../../../utils/useForm';\nimport { BrazilPersonalDetail } from '../../../internal/SocialSecurityNumberBrazil/BrazilPersonalDetail';\nimport { PixInputDataState, PixInputProps } from './types';\n\nfunction PixInput({ name, data: dataProps, personalDetailsRequired, showPayButton, onChange, payButton }: Readonly<PixInputProps>) {\n const { i18n } = useCoreContext();\n const formSchema = ['firstName', 'lastName', 'socialSecurityNumber'];\n\n const { handleChangeFor, triggerValidation, setSchema, data, valid, errors, isValid } = useForm<PixInputDataState>({\n schema: formSchema,\n defaultData: dataProps,\n rules: pixValidationRules,\n formatters: pixFormatters\n });\n\n // Handle form schema updates\n useEffect(() => {\n const newSchema = personalDetailsRequired ? [...formSchema] : [];\n setSchema(newSchema);\n }, [personalDetailsRequired]);\n\n const [status, setStatus] = useState('ready');\n this.setStatus = setStatus;\n\n this.showValidation = () => {\n triggerValidation();\n };\n\n useEffect(() => {\n onChange({ data, valid, errors, isValid });\n }, [onChange, data, valid, errors]);\n\n const buttonModifiers = !personalDetailsRequired ? ['standalone'] : [];\n\n return (\n <div className=\"adyen-checkout__pix-input__field\" style={!showPayButton && !personalDetailsRequired ? { display: 'none' } : null}>\n {personalDetailsRequired && (\n <BrazilPersonalDetail i18n={i18n} data={data} handleChangeFor={handleChangeFor} errors={errors} valid={valid} />\n )}\n\n {showPayButton &&\n payButton({\n status,\n label: `${i18n.get('continueTo')} ${name}`,\n classNameModifiers: buttonModifiers\n })}\n </div>\n );\n}\n\nexport default PixInput;\n"],"names":["PixInput","name","data","dataProps","personalDetailsRequired","showPayButton","onChange","payButton","i18n","useCoreContext","formSchema","handleChangeFor","triggerValidation","setSchema","valid","errors","isValid","useForm","schema","defaultData","rules","pixValidationRules","formatters","pixFormatters","useEffect","newSchema","status","setStatus","useState","this","showValidation","buttonModifiers","h","div","className","style","display","BrazilPersonalDetail","label","get","classNameModifiers"],"mappings":"gjBASA,SAASA,GAASC,KAAEA,EAAMC,KAAMC,EAASC,wBAAEA,EAAuBC,cAAEA,EAAaC,SAAEA,EAAQC,UAAEA,IACzF,MAAMC,KAAEA,GAASC,IACXC,EAAa,CAAC,YAAa,WAAY,yBAEvCC,gBAAEA,EAAeC,kBAAEA,EAAiBC,UAAEA,EAASX,KAAEA,EAAIY,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,GAAYC,EAA2B,CAC/GC,OAAQR,EACRS,YAAahB,EACbiB,MAAOC,EACPC,WAAYC,IAIhBC,EAAU,KACN,MAAMC,EAAYrB,EAA0B,IAAIM,GAAc,GAC9DG,EAAUY,IACX,CAACrB,IAEJ,MAAOsB,EAAQC,GAAaC,EAAS,SACrCC,KAAKF,UAAYA,EAEjBE,KAAKC,eAAiB,KAClBlB,KAGJY,EAAU,KACNlB,EAAS,CAAEJ,OAAMY,QAAOC,SAAQC,aACjC,CAACV,EAAUJ,EAAMY,EAAOC,IAE3B,MAAMgB,EAAmB3B,EAA2C,GAAjB,CAAC,cAEpD,OACI4B,EAACC,MAAAA,CAAIC,UAAU,mCAAmCC,MAAQ9B,GAAkBD,EAAgD,KAAtB,CAAEgC,QAAS,SAC5GhC,GACG4B,EAACK,EAAAA,CAAqB7B,KAAMA,EAAMN,KAAMA,EAAMS,gBAAiBA,EAAiBI,OAAQA,EAAQD,MAAOA,IAG1GT,GACGE,EAAU,CACNmB,SACAY,MAAO,GAAG9B,EAAK+B,IAAI,iBAAiBtC,IACpCuC,mBAAoBT,IAIxC"}
|
package/dist/es/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../external/preact/dist/preact.js";import{useState as a,useRef as t,useEffect as n}from"../../../external/preact/hooks/dist/hooks.js";import{useCoreContext as o}from"../../../core/Context/CoreProvider.js";import r from"../../internal/FormFields/Fieldset/Fieldset.js";import l from"../../internal/FormInstruction/FormInstruction.js";import i from"../../../utils/useForm/useForm.js";import s from"../../internal/FormFields/Field/Field.js";import u from"../../internal/FormFields/InputText.js";import{preAuthorizedDebitCanadaValidationRules as d,preAuthorizedDebitCanadaFormatters as m}from"./validate.js";import c from"../../internal/StoreDetails/StoreDetails.js";import b from"../../../core/Context/useImage.js";import{SettlementInfo as p}from"./SettlementInfo.js";function k({onChange:k,payButton:f,showPayButton:
|
|
1
|
+
import{createElement as e}from"../../../external/preact/dist/preact.js";import{useState as a,useRef as t,useEffect as n}from"../../../external/preact/hooks/dist/hooks.js";import{useCoreContext as o}from"../../../core/Context/CoreProvider.js";import r from"../../internal/FormFields/Fieldset/Fieldset.js";import l from"../../internal/FormInstruction/FormInstruction.js";import i from"../../../utils/useForm/useForm.js";import"../../internal/SecuredFields/lib/CSF/utils/userAgent.js";import s from"../../internal/FormFields/Field/Field.js";import u from"../../internal/FormFields/InputText.js";import{preAuthorizedDebitCanadaValidationRules as d,preAuthorizedDebitCanadaFormatters as m}from"./validate.js";import c from"../../internal/StoreDetails/StoreDetails.js";import b from"../../../core/Context/useImage.js";import{SettlementInfo as p}from"./SettlementInfo.js";function k({onChange:k,payButton:f,showPayButton:g,placeholders:N,setComponentRef:x,enableStoreDetails:h,showContextualElement:C=!0}){const I=b(),{i18n:F}=o(),[w,j]=a("ready"),{handleChangeFor:A,triggerValidation:M,data:L,errors:v,valid:S,isValid:V}=i({schema:["ownerName","bankAccountNumber","bankCode","bankLocationId"],rules:d,formatters:m}),[T,y]=a(!1),B="loading"===w,E=t({setStatus:j,showValidation:()=>{M()}});return n(()=>{x(E.current)},[x,E.current]),n(()=>{k({data:L,valid:S,errors:v,isValid:V,storePaymentMethod:T})},[k,L,S,v,V,T]),e("div",{className:"adyen-checkout__eftpad-canada"},e(l,null),e(r,null,e(s,{label:F.get("eftpad-canada.input.accountHolderName.label"),errorMessage:!!v.ownerName&&F.get(v.ownerName.errorMessage),isValid:!!S.ownerName,name:"ownerName"},e(u,{disabled:B,name:"ownerName",placeholder:N?.ownerName,value:L.ownerName,onInput:A("ownerName","input"),onBlur:A("ownerName","blur"),required:!0,"data-testid":"owner-name"})),e(s,{label:F.get("eftpad-canada.input.accountNumber.label"),errorMessage:!!v.bankAccountNumber&&F.get(v.bankAccountNumber.errorMessage),name:"bankAccountNumber",isValid:!!S.bankAccountNumber,showContextualElement:C,contextualText:F.get("eftpad-canada.input.accountNumber.contextualText")},e(u,{disabled:B,name:"bankAccountNumber",placeholder:N?.bankAccountNumber,value:L.bankAccountNumber,onInput:A("bankAccountNumber","input"),onBlur:A("bankAccountNumber","blur"),required:!0,maxlength:12})),e(s,{label:F.get("eftpad-canada.input.institutionNumber.label"),classNameModifiers:["col-50"],errorMessage:!!v.bankCode&&F.get(v.bankCode.errorMessage),isValid:!!S.bankCode,name:"bankCode",showContextualElement:C,contextualText:F.get("eftpad-canada.input.institutionNumber.contextualText")},e(u,{disabled:B,name:"bankCode",placeholder:N?.bankCode,value:L.bankCode,onInput:A("bankCode","input"),onBlur:A("bankCode","blur"),required:!0,maxlength:3})),e(s,{label:F.get("eftpad-canada.input.transitNumber.label"),classNameModifiers:["col-50"],errorMessage:!!v.bankLocationId&&F.get(v.bankLocationId.errorMessage),name:"bankLocationId",isValid:!!S.bankLocationId,showContextualElement:C,contextualText:F.get("eftpad-canada.input.transitNumber.contextualText")},e(u,{disabled:B,name:"bankLocationId",placeholder:N?.bankLocationId,value:L.bankLocationId,onInput:A("bankLocationId","input"),onBlur:A("bankLocationId","blur"),required:!0,maxlength:5}))),h&&e(c,{className:"adyen-checkout_eftpad-canada-store-details",disabled:B,onChange:y}),e(p,null),g&&f({status:w,icon:I({imageFolder:"components/"})("bento_lock")}))}export{k as default};
|
|
2
2
|
//# sourceMappingURL=PreAuthorizedDebitCanadaComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreAuthorizedDebitCanadaComponent.js","sources":["../../../../../src/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useRef, useState } from 'preact/hooks';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport Fieldset from '../../internal/FormFields/Fieldset';\nimport FormInstruction from '../../internal/FormInstruction';\nimport useForm from '../../../utils/useForm';\nimport Field from '../../internal/FormFields/Field';\nimport InputText from '../../internal/FormFields/InputText';\nimport { preAuthorizedDebitCanadaFormatters, preAuthorizedDebitCanadaValidationRules } from './validate';\nimport StoreDetails from '../../internal/StoreDetails';\nimport useImage from '../../../core/Context/useImage';\nimport { SettlementInfo } from './SettlementInfo';\n\nimport type { PayButtonProps } from '../../internal/PayButton/PayButton';\nimport type { ComponentMethodsRef } from '../../internal/UIElement/types';\nimport type { PreAuthorizedDebitCanadaPlaceholders } from '../types';\n\nimport './PreAuthorizedDebitCanada.scss';\nimport { ValidationRuleResult } from '../../../utils/Validator/ValidationRuleResult';\n\ninterface PreAuthorizedDebitCanadaForm {\n ownerName: string;\n bankAccountNumber: string;\n bankCode: string;\n bankLocationId: string;\n}\n\ninterface PreAuthorizedDebitCanadaComponentProps {\n onChange({\n data,\n valid,\n errors,\n isValid,\n storePaymentMethod\n }: {\n data: PreAuthorizedDebitCanadaForm;\n valid: { [key: string]: boolean };\n errors: { [key: string]: ValidationRuleResult };\n isValid: boolean;\n storePaymentMethod: boolean;\n }): void;\n payButton: (props: PayButtonProps) => h.JSX.Element;\n setComponentRef: (ref: ComponentMethodsRef) => void;\n showPayButton: boolean;\n enableStoreDetails: boolean;\n showContextualElement?: boolean;\n placeholders?: PreAuthorizedDebitCanadaPlaceholders;\n}\n\nfunction PreAuthorizedDebitCanadaComponent({\n onChange,\n payButton,\n showPayButton,\n placeholders,\n setComponentRef,\n enableStoreDetails,\n showContextualElement = true\n}: Readonly<PreAuthorizedDebitCanadaComponentProps>) {\n const getImage = useImage();\n const { i18n } = useCoreContext();\n const [status, setStatus] = useState('ready');\n const { handleChangeFor, triggerValidation, data, errors, valid, isValid } = useForm<PreAuthorizedDebitCanadaForm>({\n schema: ['ownerName', 'bankAccountNumber', 'bankCode', 'bankLocationId'],\n rules: preAuthorizedDebitCanadaValidationRules,\n formatters: preAuthorizedDebitCanadaFormatters\n });\n const [storePaymentMethod, setStorePaymentMethod] = useState(false);\n\n const isFormDisabled = status === 'loading';\n\n const componentRef = useRef<ComponentMethodsRef>({\n setStatus: setStatus,\n showValidation: () => {\n triggerValidation();\n }\n });\n\n useEffect(() => {\n setComponentRef(componentRef.current);\n }, [setComponentRef, componentRef.current]);\n\n useEffect(() => {\n onChange({ data, valid, errors, isValid, storePaymentMethod });\n }, [onChange, data, valid, errors, isValid, storePaymentMethod]);\n\n return (\n <div className=\"adyen-checkout__eftpad-canada\">\n <FormInstruction />\n\n <Fieldset>\n <Field\n label={i18n.get('eftpad-canada.input.accountHolderName.label')}\n errorMessage={!!errors.ownerName && i18n.get(errors.ownerName.errorMessage)}\n isValid={!!valid.ownerName}\n name={'ownerName'}\n >\n <InputText\n disabled={isFormDisabled}\n name={'ownerName'}\n placeholder={placeholders?.ownerName}\n value={data.ownerName}\n onInput={handleChangeFor('ownerName', 'input')}\n onBlur={handleChangeFor('ownerName', 'blur')}\n required={true}\n data-testid={'owner-name'}\n />\n </Field>\n\n <Field\n label={i18n.get('eftpad-canada.input.accountNumber.label')}\n errorMessage={!!errors.bankAccountNumber && i18n.get(errors.bankAccountNumber.errorMessage)}\n name={'bankAccountNumber'}\n isValid={!!valid.bankAccountNumber}\n showContextualElement={showContextualElement}\n contextualText={i18n.get('eftpad-canada.input.accountNumber.contextualText')}\n >\n <InputText\n disabled={isFormDisabled}\n name={'bankAccountNumber'}\n placeholder={placeholders?.bankAccountNumber}\n value={data.bankAccountNumber}\n onInput={handleChangeFor('bankAccountNumber', 'input')}\n onBlur={handleChangeFor('bankAccountNumber', 'blur')}\n required={true}\n maxlength={12}\n />\n </Field>\n\n <Field\n label={i18n.get('eftpad-canada.input.institutionNumber.label')}\n classNameModifiers={['col-50']}\n errorMessage={!!errors.bankCode && i18n.get(errors.bankCode.errorMessage)}\n isValid={!!valid.bankCode}\n name={'bankCode'}\n showContextualElement={showContextualElement}\n contextualText={i18n.get('eftpad-canada.input.institutionNumber.contextualText')}\n >\n <InputText\n disabled={isFormDisabled}\n name={'bankCode'}\n placeholder={placeholders?.bankCode}\n value={data.bankCode}\n onInput={handleChangeFor('bankCode', 'input')}\n onBlur={handleChangeFor('bankCode', 'blur')}\n required={true}\n maxlength={3}\n />\n </Field>\n\n <Field\n label={i18n.get('eftpad-canada.input.transitNumber.label')}\n classNameModifiers={['col-50']}\n errorMessage={!!errors.bankLocationId && i18n.get(errors.bankLocationId.errorMessage)}\n name={'bankLocationId'}\n isValid={!!valid.bankLocationId}\n showContextualElement={showContextualElement}\n contextualText={i18n.get('eftpad-canada.input.transitNumber.contextualText')}\n >\n <InputText\n disabled={isFormDisabled}\n name={'bankLocationId'}\n placeholder={placeholders?.bankLocationId}\n value={data.bankLocationId}\n onInput={handleChangeFor('bankLocationId', 'input')}\n onBlur={handleChangeFor('bankLocationId', 'blur')}\n required={true}\n maxlength={5}\n />\n </Field>\n </Fieldset>\n\n {enableStoreDetails && (\n <StoreDetails className={'adyen-checkout_eftpad-canada-store-details'} disabled={isFormDisabled} onChange={setStorePaymentMethod} />\n )}\n\n <SettlementInfo />\n\n {showPayButton && payButton({ status, icon: getImage({ imageFolder: 'components/' })('bento_lock') })}\n </div>\n );\n}\n\nexport default PreAuthorizedDebitCanadaComponent;\n"],"names":["PreAuthorizedDebitCanadaComponent","onChange","payButton","showPayButton","placeholders","setComponentRef","enableStoreDetails","showContextualElement","getImage","useImage","i18n","useCoreContext","status","setStatus","useState","handleChangeFor","triggerValidation","data","errors","valid","isValid","useForm","schema","rules","preAuthorizedDebitCanadaValidationRules","formatters","preAuthorizedDebitCanadaFormatters","storePaymentMethod","setStorePaymentMethod","isFormDisabled","componentRef","useRef","showValidation","useEffect","current","h","div","className","FormInstruction","Fieldset","Field","label","get","errorMessage","ownerName","name","InputText","disabled","placeholder","value","onInput","onBlur","required","data-testid","bankAccountNumber","contextualText","maxlength","classNameModifiers","bankCode","bankLocationId","StoreDetails","SettlementInfo","icon","imageFolder"],"mappings":"iyBAiDA,SAASA,GAAkCC,SACvCA,EAAQC,UACRA,EAASC,cACTA,EAAaC,aACbA,EAAYC,gBACZA,EAAeC,mBACfA,EAAkBC,sBAClBA,GAAwB,IAExB,MAAMC,EAAWC,KACXC,KAAEA,GAASC,KACVC,EAAQC,GAAaC,EAAS,UAC/BC,gBAAEA,EAAeC,kBAAEA,EAAiBC,KAAEA,EAAIC,OAAEA,EAAMC,MAAEA,EAAKC,QAAEA,GAAYC,EAAsC,CAC/GC,OAAQ,CAAC,YAAa,oBAAqB,WAAY,kBACvDC,MAAOC,EACPC,WAAYC,KAETC,EAAoBC,GAAyBd,GAAS,GAEvDe,EAA4B,YAAXjB,EAEjBkB,EAAeC,EAA4B,CAC7ClB,UAAWA,EACXmB,eAAgB,KACZhB,OAYR,OARAiB,EAAU,KACN5B,EAAgByB,EAAaI,UAC9B,CAAC7B,EAAiByB,EAAaI,UAElCD,EAAU,KACNhC,EAAS,CAAEgB,OAAME,QAAOD,SAAQE,UAASO,wBAC1C,CAAC1B,EAAUgB,EAAME,EAAOD,EAAQE,EAASO,IAGxCQ,EAACC,MAAAA,CAAIC,UAAU,iCACXF,EAACG,EAAAA,MAEDH,EAACI,EAAAA,KACGJ,EAACK,EAAAA,CACGC,MAAO/B,EAAKgC,IAAI,+CAChBC,eAAgBzB,EAAO0B,WAAalC,EAAKgC,IAAIxB,EAAO0B,UAAUD,cAC9DvB,UAAWD,EAAMyB,UACjBC,KAAM,aAENV,EAACW,EAAAA,CACGC,SAAUlB,EACVgB,KAAM,YACNG,YAAa5C,GAAcwC,UAC3BK,MAAOh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AAK0C,eACZT,QAASnC,EAAgB,iBAAkB,SAC3CoC,OAAQpC,EAAgB,iBAAkB,QAC1CqC,UAAU,EACVI,UAAW,MAKtBlD,GACG6B,EAACyB,EAAAA,CAAavB,UAAW,6CAA8CU,SAAUlB,EAAgB5B,SAAU2B,IAG/GO,EAAC0B,EAAAA,MAEA1D,GAAiBD,EAAU,CAAEU,SAAQkD,KAAMtD,EAAS,CAAEuD,YAAa,eAAxBvD,CAAyC,gBAGjG"}
|
|
1
|
+
{"version":3,"file":"PreAuthorizedDebitCanadaComponent.js","sources":["../../../../../src/components/PreAuthorizedDebitCanada/components/PreAuthorizedDebitCanadaComponent.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useRef, useState } from 'preact/hooks';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport Fieldset from '../../internal/FormFields/Fieldset';\nimport FormInstruction from '../../internal/FormInstruction';\nimport useForm from '../../../utils/useForm';\nimport Field from '../../internal/FormFields/Field';\nimport InputText from '../../internal/FormFields/InputText';\nimport { preAuthorizedDebitCanadaFormatters, preAuthorizedDebitCanadaValidationRules } from './validate';\nimport StoreDetails from '../../internal/StoreDetails';\nimport useImage from '../../../core/Context/useImage';\nimport { SettlementInfo } from './SettlementInfo';\n\nimport type { PayButtonProps } from '../../internal/PayButton/PayButton';\nimport type { ComponentMethodsRef } from '../../internal/UIElement/types';\nimport type { PreAuthorizedDebitCanadaPlaceholders } from '../types';\n\nimport './PreAuthorizedDebitCanada.scss';\nimport { ValidationRuleResult } from '../../../utils/Validator/ValidationRuleResult';\n\ninterface PreAuthorizedDebitCanadaForm {\n ownerName: string;\n bankAccountNumber: string;\n bankCode: string;\n bankLocationId: string;\n}\n\ninterface PreAuthorizedDebitCanadaComponentProps {\n onChange({\n data,\n valid,\n errors,\n isValid,\n storePaymentMethod\n }: {\n data: PreAuthorizedDebitCanadaForm;\n valid: { [key: string]: boolean };\n errors: { [key: string]: ValidationRuleResult };\n isValid: boolean;\n storePaymentMethod: boolean;\n }): void;\n payButton: (props: PayButtonProps) => h.JSX.Element;\n setComponentRef: (ref: ComponentMethodsRef) => void;\n showPayButton: boolean;\n enableStoreDetails: boolean;\n showContextualElement?: boolean;\n placeholders?: PreAuthorizedDebitCanadaPlaceholders;\n}\n\nfunction PreAuthorizedDebitCanadaComponent({\n onChange,\n payButton,\n showPayButton,\n placeholders,\n setComponentRef,\n enableStoreDetails,\n showContextualElement = true\n}: Readonly<PreAuthorizedDebitCanadaComponentProps>) {\n const getImage = useImage();\n const { i18n } = useCoreContext();\n const [status, setStatus] = useState('ready');\n const { handleChangeFor, triggerValidation, data, errors, valid, isValid } = useForm<PreAuthorizedDebitCanadaForm>({\n schema: ['ownerName', 'bankAccountNumber', 'bankCode', 'bankLocationId'],\n rules: preAuthorizedDebitCanadaValidationRules,\n formatters: preAuthorizedDebitCanadaFormatters\n });\n const [storePaymentMethod, setStorePaymentMethod] = useState(false);\n\n const isFormDisabled = status === 'loading';\n\n const componentRef = useRef<ComponentMethodsRef>({\n setStatus: setStatus,\n showValidation: () => {\n triggerValidation();\n }\n });\n\n useEffect(() => {\n setComponentRef(componentRef.current);\n }, [setComponentRef, componentRef.current]);\n\n useEffect(() => {\n onChange({ data, valid, errors, isValid, storePaymentMethod });\n }, [onChange, data, valid, errors, isValid, storePaymentMethod]);\n\n return (\n <div className=\"adyen-checkout__eftpad-canada\">\n <FormInstruction />\n\n <Fieldset>\n <Field\n label={i18n.get('eftpad-canada.input.accountHolderName.label')}\n errorMessage={!!errors.ownerName && i18n.get(errors.ownerName.errorMessage)}\n isValid={!!valid.ownerName}\n name={'ownerName'}\n >\n <InputText\n disabled={isFormDisabled}\n name={'ownerName'}\n placeholder={placeholders?.ownerName}\n value={data.ownerName}\n onInput={handleChangeFor('ownerName', 'input')}\n onBlur={handleChangeFor('ownerName', 'blur')}\n required={true}\n data-testid={'owner-name'}\n />\n </Field>\n\n <Field\n label={i18n.get('eftpad-canada.input.accountNumber.label')}\n errorMessage={!!errors.bankAccountNumber && i18n.get(errors.bankAccountNumber.errorMessage)}\n name={'bankAccountNumber'}\n isValid={!!valid.bankAccountNumber}\n showContextualElement={showContextualElement}\n contextualText={i18n.get('eftpad-canada.input.accountNumber.contextualText')}\n >\n <InputText\n disabled={isFormDisabled}\n name={'bankAccountNumber'}\n placeholder={placeholders?.bankAccountNumber}\n value={data.bankAccountNumber}\n onInput={handleChangeFor('bankAccountNumber', 'input')}\n onBlur={handleChangeFor('bankAccountNumber', 'blur')}\n required={true}\n maxlength={12}\n />\n </Field>\n\n <Field\n label={i18n.get('eftpad-canada.input.institutionNumber.label')}\n classNameModifiers={['col-50']}\n errorMessage={!!errors.bankCode && i18n.get(errors.bankCode.errorMessage)}\n isValid={!!valid.bankCode}\n name={'bankCode'}\n showContextualElement={showContextualElement}\n contextualText={i18n.get('eftpad-canada.input.institutionNumber.contextualText')}\n >\n <InputText\n disabled={isFormDisabled}\n name={'bankCode'}\n placeholder={placeholders?.bankCode}\n value={data.bankCode}\n onInput={handleChangeFor('bankCode', 'input')}\n onBlur={handleChangeFor('bankCode', 'blur')}\n required={true}\n maxlength={3}\n />\n </Field>\n\n <Field\n label={i18n.get('eftpad-canada.input.transitNumber.label')}\n classNameModifiers={['col-50']}\n errorMessage={!!errors.bankLocationId && i18n.get(errors.bankLocationId.errorMessage)}\n name={'bankLocationId'}\n isValid={!!valid.bankLocationId}\n showContextualElement={showContextualElement}\n contextualText={i18n.get('eftpad-canada.input.transitNumber.contextualText')}\n >\n <InputText\n disabled={isFormDisabled}\n name={'bankLocationId'}\n placeholder={placeholders?.bankLocationId}\n value={data.bankLocationId}\n onInput={handleChangeFor('bankLocationId', 'input')}\n onBlur={handleChangeFor('bankLocationId', 'blur')}\n required={true}\n maxlength={5}\n />\n </Field>\n </Fieldset>\n\n {enableStoreDetails && (\n <StoreDetails className={'adyen-checkout_eftpad-canada-store-details'} disabled={isFormDisabled} onChange={setStorePaymentMethod} />\n )}\n\n <SettlementInfo />\n\n {showPayButton && payButton({ status, icon: getImage({ imageFolder: 'components/' })('bento_lock') })}\n </div>\n );\n}\n\nexport default PreAuthorizedDebitCanadaComponent;\n"],"names":["PreAuthorizedDebitCanadaComponent","onChange","payButton","showPayButton","placeholders","setComponentRef","enableStoreDetails","showContextualElement","getImage","useImage","i18n","useCoreContext","status","setStatus","useState","handleChangeFor","triggerValidation","data","errors","valid","isValid","useForm","schema","rules","preAuthorizedDebitCanadaValidationRules","formatters","preAuthorizedDebitCanadaFormatters","storePaymentMethod","setStorePaymentMethod","isFormDisabled","componentRef","useRef","showValidation","useEffect","current","h","div","className","FormInstruction","Fieldset","Field","label","get","errorMessage","ownerName","name","InputText","disabled","placeholder","value","onInput","onBlur","required","data-testid","bankAccountNumber","contextualText","maxlength","classNameModifiers","bankCode","bankLocationId","StoreDetails","SettlementInfo","icon","imageFolder"],"mappings":"i2BAiDA,SAASA,GAAkCC,SACvCA,EAAQC,UACRA,EAASC,cACTA,EAAaC,aACbA,EAAYC,gBACZA,EAAeC,mBACfA,EAAkBC,sBAClBA,GAAwB,IAExB,MAAMC,EAAWC,KACXC,KAAEA,GAASC,KACVC,EAAQC,GAAaC,EAAS,UAC/BC,gBAAEA,EAAeC,kBAAEA,EAAiBC,KAAEA,EAAIC,OAAEA,EAAMC,MAAEA,EAAKC,QAAEA,GAAYC,EAAsC,CAC/GC,OAAQ,CAAC,YAAa,oBAAqB,WAAY,kBACvDC,MAAOC,EACPC,WAAYC,KAETC,EAAoBC,GAAyBd,GAAS,GAEvDe,EAA4B,YAAXjB,EAEjBkB,EAAeC,EAA4B,CAC7ClB,UAAWA,EACXmB,eAAgB,KACZhB,OAYR,OARAiB,EAAU,KACN5B,EAAgByB,EAAaI,UAC9B,CAAC7B,EAAiByB,EAAaI,UAElCD,EAAU,KACNhC,EAAS,CAAEgB,OAAME,QAAOD,SAAQE,UAASO,wBAC1C,CAAC1B,EAAUgB,EAAME,EAAOD,EAAQE,EAASO,IAGxCQ,EAACC,MAAAA,CAAIC,UAAU,i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IAAI,2CAChBe,mBAAoB,CAAC,UACrBd,eAAgBzB,EAAOyC,gBAAkBjD,EAAKgC,IAAIxB,EAAOyC,eAAehB,cACxEE,KAAM,iBACNzB,UAAWD,EAAMwC,eACjBpD,sBAAuBA,EACvBgD,eAAgB7C,EAAKgC,IAAI,qDAEzBP,EAACW,EAAAA,CACGC,SAAUlB,EACVgB,KAAM,iBACNG,YAAa5C,GAAcuD,eAC3BV,MAAOhC,EAAK0C,eACZT,QAASnC,EAAgB,iBAAkB,SAC3CoC,OAAQpC,EAAgB,iBAAkB,QAC1CqC,UAAU,EACVI,UAAW,MAKtBlD,GACG6B,EAACyB,EAAAA,CAAavB,UAAW,6CAA8CU,SAAUlB,EAAgB5B,SAAU2B,IAG/GO,EAAC0B,EAAAA,MAEA1D,GAAiBD,EAAU,CAAEU,SAAQkD,KAAMtD,EAAS,CAAEuD,YAAa,eAAxBvD,CAAyC,gBAGjG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrepareChallenge3DS2.js","sources":["../../../../../../src/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport DoChallenge3DS2 from './DoChallenge3DS2';\nimport { createChallengeResolveData, prepareChallengeData, isErrorObject } from '../utils';\nimport { PrepareChallenge3DS2Props, PrepareChallenge3DS2State, StatusErrorInfoObject } from './types';\nimport { ChallengeData, ResultObject, ThreeDS2FlowObject, ErrorCodeObject, ChallengeResolveData } from '../../types';\nimport '../../ThreeDS2.scss';\nimport Img from '../../../internal/Img';\nimport './challenge.scss';\nimport { hasOwnProperty } from '../../../../utils/hasOwnProperty';\nimport useImage from '../../../../core/Context/useImage';\nimport AdyenCheckoutError, { ERROR } from '../../../../core/Errors/AdyenCheckoutError';\nimport { THREEDS2_CHALLENGE, THREEDS2_CHALLENGE_ERROR, THREEDS2_NUM, MISSING_TOKEN_IN_ACTION_MSG } from '../../constants';\nimport { isValidHttpUrl } from '../../../../utils/isValidURL';\nimport { ErrorObject } from '../../../../core/Errors/types';\nimport { AnalyticsLogEvent, LogEventSubtype, LogEventType } from '../../../../core/Analytics/events/AnalyticsLogEvent';\nimport { AnalyticsErrorEvent, ErrorEventCode, ErrorEventType } from '../../../../core/Analytics/events/AnalyticsErrorEvent';\nimport { AbstractAnalyticsEvent } from '../../../../core/Analytics/events/AbstractAnalyticsEvent';\n\nclass PrepareChallenge3DS2 extends Component<PrepareChallenge3DS2Props, PrepareChallenge3DS2State> {\n public static readonly defaultProps = {\n onComplete: () => {},\n onError: () => {},\n isMDFlow: false\n };\n\n constructor(props) {\n super(props);\n\n if (this.props.token) {\n const challengeData: ChallengeData | ErrorObject = prepareChallengeData({\n token: this.props.token,\n size: this.props.challengeWindowSize || this.props.size // TODO confirm that this.props.size is legacy and can be removed\n });\n\n this.state = {\n status: 'init',\n challengeData: challengeData as ChallengeData\n };\n } else {\n // Will be picked up in componentDidMount\n this.state = { challengeData: { success: false, error: MISSING_TOKEN_IN_ACTION_MSG } };\n\n console.debug(`${THREEDS2_CHALLENGE_ERROR}: ${MISSING_TOKEN_IN_ACTION_MSG}`);\n }\n }\n\n public onFormSubmit = (msg: string) => {\n const event = new AnalyticsLogEvent({\n component: this.props.type,\n type: LogEventType.threeDS2,\n subType: LogEventSubtype.challengeDataSentWeb,\n message: msg\n });\n\n this.props.onSubmitAnalytics(event);\n };\n\n componentDidMount() {\n const hasChallengeData = !isErrorObject(this.state.challengeData);\n\n if (hasChallengeData) {\n const shouldAllowHttpDomains =\n /** Allow http urls if in development and testing against localhost:8080 */\n (process.env.NODE_ENV === 'development' && process.env.__CLIENT_ENV__?.includes('localhost:8080')) ||\n /**\n * Allows the checkoutshopper demo on localhost:8080 to work -\n * requires a configuration in localhost of environment: 'test', _environmentUrls: {api: 'http://localhost:8080/'}\n */\n (this.props.environment === 'test' && this.props._environmentUrls?.api?.includes('http://localhost:8080'));\n\n /**\n * Check the structure of the created challengeData\n */\n const { acsURL } = this.state.challengeData as ChallengeData;\n const hasValidAcsURL = isValidHttpUrl(acsURL, shouldAllowHttpDomains);\n\n // Only render component if we have an acsURL.\n if (!hasValidAcsURL) {\n // Set UI error & call onError callback\n this.setError(\n {\n errorInfo: `${ErrorEventCode.THREEDS2_TOKEN_IS_MISSING_ACSURL}: ${this.props.i18n.get('err.gen.9102')}` //\n },\n true\n );\n\n // Send error to analytics endpoint // TODO - check logs to see if this *ever* happens\n const event = new AnalyticsErrorEvent({\n component: this.props.type,\n code: ErrorEventCode.THREEDS2_TOKEN_IS_MISSING_ACSURL,\n errorType: ErrorEventType.threeDS2,\n message: `${THREEDS2_CHALLENGE_ERROR}: Decoded token is missing a valid acsURL property`\n });\n this.props.onSubmitAnalytics(event);\n\n console.debug('### PrepareChallenge3DS2::exiting:: no valid acsURL');\n return;\n }\n\n const { acsTransID, messageVersion, threeDSServerTransID } = (this.state.challengeData as ChallengeData).cReqData;\n\n // Only render component if we have a acsTransID, messageVersion & threeDSServerTransID\n if (!acsTransID || !messageVersion || !threeDSServerTransID) {\n // Set UI error & call onError callback\n this.setError(\n {\n errorInfo: `${ErrorEventCode.THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS}: ${this.props.i18n.get('err.gen.9102')}`\n },\n true\n );\n\n // Send error to analytics endpoint // TODO - check logs to see if this *ever* happens\n const event = new AnalyticsErrorEvent({\n component: this.props.type,\n code: ErrorEventCode.THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS,\n errorType: ErrorEventType.threeDS2,\n message: `${THREEDS2_CHALLENGE_ERROR}: Decoded token is missing one or more of the following properties (acsTransID | messageVersion | threeDSServerTransID)`\n });\n this.props.onSubmitAnalytics(event);\n\n console.debug(\n '### PrepareChallenge3DS2::exiting:: missing one or more of the following properties (acsTransID | messageVersion | threeDSServerTransID)'\n );\n return;\n }\n\n // Proceed to allow component to render\n this.setState({ status: 'performingChallenge' });\n //\n } else {\n const errorMsg: string = (this.state.challengeData as ErrorObject).error;\n\n const errorCode = errorMsg.includes(MISSING_TOKEN_IN_ACTION_MSG)\n ? ErrorEventCode.THREEDS2_ACTION_IS_MISSING_TOKEN\n : ErrorEventCode.THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED;\n\n // Set UI error & call onError callback\n this.setError(\n {\n errorInfo: `${errorCode}: ${this.props.i18n.get('err.gen.9102')}`\n // errorObj: this.state.challengeData // TODO Decide if we want to expose this data\n },\n true\n );\n\n // Send error to analytics endpoint // TODO - check logs to see if the base64 decoding errors *ever* happen\n const event = new AnalyticsErrorEvent({\n component: this.props.type,\n code: errorCode,\n errorType: ErrorEventType.threeDS2,\n message: `${THREEDS2_CHALLENGE_ERROR}: ${errorMsg}` // can be: 'Missing \"token\" property from threeDS2 action', 'not base64', 'malformed URI sequence' or 'Could not JSON parse token'\n });\n\n this.props.onSubmitAnalytics(event);\n\n console.debug('### PrepareChallenge3DS2::exiting:: no challengeData');\n }\n }\n\n setStatusComplete(resultObj: ResultObject, errorCodeObject: ErrorCodeObject = null) {\n this.setState({ status: 'complete' }, () => {\n const data: ChallengeResolveData = createChallengeResolveData(this.props.dataKey, resultObj.transStatus, this.props.paymentData);\n\n if (errorCodeObject) {\n console.debug('### PrepareChallenge3DS2::errorCodeObject::', errorCodeObject);\n }\n\n let event: AbstractAnalyticsEvent;\n\n /** Are we in an \"error\" i.e. timeout or no transStatus, scenario? If so, submit analytics about it */\n const finalResObject = errorCodeObject ? errorCodeObject : resultObj;\n if (finalResObject.errorCode) {\n const errorTypeAndCode = {\n code: finalResObject.errorCode === 'timeout' ? ErrorEventCode.THREEDS2_TIMEOUT : ErrorEventCode.THREEDS2_NO_TRANSSTATUS,\n errorType: ErrorEventType.threeDS2\n };\n\n // Challenge process has timed out,\n // or, It's an error reported by the backend 'cos no transStatus could be retrieved // TODO - check logs to see if this *ever* happens\n\n event = new AnalyticsErrorEvent({\n component: this.props.type,\n message: (finalResObject as ErrorCodeObject).message,\n ...errorTypeAndCode\n });\n\n // Send error to analytics endpoint\n this.props.onSubmitAnalytics(event);\n }\n\n /** Calculate \"result\" for analytics */\n let result: string;\n\n switch (resultObj?.transStatus) {\n case 'Y':\n result = 'success';\n break;\n case 'N':\n result = 'failed';\n break;\n case 'U':\n result = !errorCodeObject ? 'cancelled' : 'timeout';\n break;\n default:\n }\n if (resultObj?.errorCode) {\n result = 'noTransStatus';\n }\n\n /** Create log object - the process is completed, one way or another */\n\n event = new AnalyticsLogEvent({\n component: this.props.type,\n type: LogEventType.threeDS2,\n subType: LogEventSubtype.challengeCompleted,\n message: `${THREEDS2_NUM} challenge has completed`,\n result\n });\n\n // Send log to analytics endpoint\n this.props.onSubmitAnalytics(event);\n\n /**\n * Equals call to onAdditionalDetails (except for in 3DS2InMDFlow)\n */\n this.props.onComplete(data);\n });\n }\n\n /**\n * Display error in the UI,\n * and, optionally, decide whether to send any of these errors to the merchant defined onError callback\n *\n * @param errorInfoObj -\n * @param isFatal -\n */\n setError(errorInfoObj: StatusErrorInfoObject, isFatal: boolean) {\n this.setState({ status: 'error', errorInfo: errorInfoObj.errorInfo });\n\n // Decide whether to call this.props.onError\n if (isFatal) {\n this.props.onError(new AdyenCheckoutError(ERROR, errorInfoObj.errorInfo, { cause: errorInfoObj.errorObj }));\n }\n }\n\n render(_, { challengeData }) {\n const getImage = useImage();\n if (this.state.status === 'performingChallenge') {\n return (\n <DoChallenge3DS2\n onCompleteChallenge={(challenge: ThreeDS2FlowObject) => {\n let errorCodeObject: ErrorCodeObject = null;\n\n // Challenge has resulted in an error (no transStatus could be retrieved) - but we still treat this as a valid scenario\n if (hasOwnProperty(challenge.result, 'errorCode') && challenge.result.errorCode.length) {\n // Tell the merchant there's been an error\n errorCodeObject = {\n errorCode: challenge.result.errorCode,\n message: `${THREEDS2_CHALLENGE_ERROR}: ${\n challenge.result.errorDescription ? challenge.result.errorDescription : 'no transStatus could be retrieved'\n }`\n };\n\n /**\n * NOTE: we can now use this.props.isMDFlow to decide if we want to send any of these errors to the onError handler\n * - this is problematic in the regular flow since merchants tend to treat any calls to their onError handler as 'fatal',\n * but in the MDFlow we control what the onError handler does.\n */\n if (this.props.isMDFlow) {\n this.props.onError(\n new AdyenCheckoutError(\n ERROR,\n `${THREEDS2_CHALLENGE_ERROR}: ${\n challenge.result.errorDescription\n ? challenge.result.errorDescription\n : 'no transStatus could be retrieved'\n }`,\n { cause: challenge.result.errorCode }\n )\n );\n }\n }\n\n /**\n * An object has been returned, parsed & accepted as legit (according to the rules in getProcessMessageHandler),\n * but the result prop on that object is missing\n */\n if (!challenge.result) {\n this.setError(\n {\n errorInfo: `${THREEDS2_CHALLENGE_ERROR}: ${this.props.i18n.get('3ds.chal.805', {\n values: { result: '\"result\"' }\n })}`,\n errorObj: challenge as unknown as ErrorObject\n },\n true\n );\n\n // Send error to analytics endpoint\n const event = new AnalyticsErrorEvent({\n component: this.props.type,\n code: ErrorEventCode.THREEDS2_CHALLENGE_RESOLVED_WITHOUT_RESULT_PROP,\n errorType: ErrorEventType.threeDS2,\n message: `${THREEDS2_CHALLENGE_ERROR}: challenge resolved without a \"result\" object`\n });\n\n this.props.onSubmitAnalytics(event);\n\n console.debug('### PrepareChallenge3DS2::exiting:: challenge resolved without a \"result\" object');\n\n return;\n }\n\n // Proceed with call to onAdditionalDetails (except for in 3DS2InMDFlow)\n this.setStatusComplete(challenge.result, errorCodeObject);\n }}\n onErrorChallenge={(challenge: ThreeDS2FlowObject) => {\n /**\n * Called when challenge times-out (which is still a valid scenario)...\n */\n if (hasOwnProperty(challenge, 'errorCode')) {\n const timeoutObject: ErrorCodeObject = {\n errorCode: challenge.errorCode,\n message: `${THREEDS2_CHALLENGE}: ${challenge.errorCode}`\n };\n\n // see comment in onCompleteChallenge code block\n if (this.props.isMDFlow) {\n this.props.onError(\n new AdyenCheckoutError(ERROR, `${THREEDS2_CHALLENGE_ERROR}: '3DS2 challenge timed out'`, {\n cause: challenge.errorCode\n })\n );\n }\n\n this.setStatusComplete(challenge.result, timeoutObject);\n return;\n }\n }}\n {...challengeData}\n onActionHandled={this.props.onActionHandled}\n onFormSubmit={this.onFormSubmit}\n />\n );\n }\n\n if (this.state.status === 'error') {\n return (\n <div className=\"adyen-checkout__threeds2-challenge-error\">\n <Img\n className=\"adyen-checkout__status__icon adyen-checkout__status__icon--error\"\n src={getImage({\n imageFolder: 'components/'\n })('error')}\n alt={''}\n />\n <div className=\"adyen-checkout__status__text\">\n {this.state.errorInfo ? this.state.errorInfo : this.props.i18n.get('error.message.unknown')}\n </div>\n </div>\n );\n }\n\n return null;\n }\n}\n\nexport default PrepareChallenge3DS2;\n"],"names":["PrepareChallenge3DS2","Component","componentDidMount","isErrorObject","this","state","challengeData","shouldAllowHttpDomains","props","environment","_environmentUrls","api","includes","acsURL","isValidHttpUrl","setError","errorInfo","ErrorEventCode","THREEDS2_TOKEN_IS_MISSING_ACSURL","i18n","get","event","AnalyticsErrorEvent","component","type","code","errorType","ErrorEventType","threeDS2","message","THREEDS2_CHALLENGE_ERROR","onSubmitAnalytics","console","debug","acsTransID","messageVersion","threeDSServerTransID","cReqData","THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS","setState","status","errorMsg","error","errorCode","MISSING_TOKEN_IN_ACTION_MSG","THREEDS2_ACTION_IS_MISSING_TOKEN","THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED","setStatusComplete","resultObj","errorCodeObject","data","createChallengeResolveData","dataKey","transStatus","paymentData","finalResObject","errorTypeAndCode","THREEDS2_TIMEOUT","THREEDS2_NO_TRANSSTATUS","result","AnalyticsLogEvent","LogEventType","subType","LogEventSubtype","challengeCompleted","THREEDS2_NUM","onComplete","errorInfoObj","isFatal","onError","AdyenCheckoutError","ERROR","cause","errorObj","render","_","getImage","useImage","h","DoChallenge3DS2","onCompleteChallenge","challenge","hasOwnProperty","length","errorDescription","isMDFlow","values","THREEDS2_CHALLENGE_RESOLVED_WITHOUT_RESULT_PROP","onErrorChallenge","timeoutObject","THREEDS2_CHALLENGE","onActionHandled","onFormSubmit","div","className","Img","src","imageFolder","alt","constructor","super","_define_property","msg","challengeData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DS2/components/Challenge/PrepareChallenge3DS2.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport DoChallenge3DS2 from './DoChallenge3DS2';\nimport { createChallengeResolveData, prepareChallengeData, isErrorObject } from '../utils';\nimport { PrepareChallenge3DS2Props, PrepareChallenge3DS2State, StatusErrorInfoObject } from './types';\nimport { ChallengeData, ResultObject, ThreeDS2FlowObject, ErrorCodeObject, ChallengeResolveData } from '../../types';\nimport '../../ThreeDS2.scss';\nimport Img from '../../../internal/Img';\nimport './challenge.scss';\nimport { hasOwnProperty } from '../../../../utils/hasOwnProperty';\nimport useImage from '../../../../core/Context/useImage';\nimport AdyenCheckoutError, { ERROR } from '../../../../core/Errors/AdyenCheckoutError';\nimport { THREEDS2_CHALLENGE, THREEDS2_CHALLENGE_ERROR, THREEDS2_NUM, MISSING_TOKEN_IN_ACTION_MSG } from '../../constants';\nimport { isValidHttpUrl } from '../../../../utils/isValidURL';\nimport { ErrorObject } from '../../../../core/Errors/types';\nimport { AnalyticsLogEvent, LogEventSubtype, LogEventType } from '../../../../core/Analytics/events/AnalyticsLogEvent';\nimport { AnalyticsErrorEvent, ErrorEventCode, ErrorEventType } from '../../../../core/Analytics/events/AnalyticsErrorEvent';\nimport { AbstractAnalyticsEvent } from '../../../../core/Analytics/events/AbstractAnalyticsEvent';\n\nclass PrepareChallenge3DS2 extends Component<PrepareChallenge3DS2Props, PrepareChallenge3DS2State> {\n public static readonly defaultProps = {\n onComplete: () => {},\n onError: () => {},\n isMDFlow: false\n };\n\n constructor(props) {\n super(props);\n\n if (this.props.token) {\n const challengeData: ChallengeData | ErrorObject = prepareChallengeData({\n token: this.props.token,\n size: this.props.challengeWindowSize || this.props.size // TODO confirm that this.props.size is legacy and can be removed\n });\n\n this.state = {\n status: 'init',\n challengeData\n };\n } else {\n // Will be picked up in componentDidMount\n this.state = { challengeData: { success: false, error: MISSING_TOKEN_IN_ACTION_MSG } };\n\n console.debug(`${THREEDS2_CHALLENGE_ERROR}: ${MISSING_TOKEN_IN_ACTION_MSG}`);\n }\n }\n\n public onFormSubmit = (msg: string) => {\n const event = new AnalyticsLogEvent({\n component: this.props.type,\n type: LogEventType.threeDS2,\n subType: LogEventSubtype.challengeDataSentWeb,\n message: msg\n });\n\n this.props.onSubmitAnalytics(event);\n };\n\n componentDidMount() {\n const hasChallengeData = !isErrorObject(this.state.challengeData);\n\n if (hasChallengeData) {\n const shouldAllowHttpDomains =\n /** Allow http urls if in development and testing against localhost:8080 */\n (process.env.NODE_ENV === 'development' && process.env.__CLIENT_ENV__?.includes('localhost:8080')) ||\n /**\n * Allows the checkoutshopper demo on localhost:8080 to work -\n * requires a configuration in localhost of environment: 'test', _environmentUrls: {api: 'http://localhost:8080/'}\n */\n (this.props.environment === 'test' && this.props._environmentUrls?.api?.includes('http://localhost:8080'));\n\n /**\n * Check the structure of the created challengeData\n */\n const { acsURL } = this.state.challengeData as ChallengeData;\n const hasValidAcsURL = isValidHttpUrl(acsURL, shouldAllowHttpDomains);\n\n // Only render component if we have an acsURL.\n if (!hasValidAcsURL) {\n // Set UI error & call onError callback\n this.setError(\n {\n errorInfo: `${ErrorEventCode.THREEDS2_TOKEN_IS_MISSING_ACSURL}: ${this.props.i18n.get('err.gen.9102')}` //\n },\n true\n );\n\n // Send error to analytics endpoint // TODO - check logs to see if this *ever* happens\n const event = new AnalyticsErrorEvent({\n component: this.props.type,\n code: ErrorEventCode.THREEDS2_TOKEN_IS_MISSING_ACSURL,\n errorType: ErrorEventType.threeDS2,\n message: `${THREEDS2_CHALLENGE_ERROR}: Decoded token is missing a valid acsURL property`\n });\n this.props.onSubmitAnalytics(event);\n\n console.debug('### PrepareChallenge3DS2::exiting:: no valid acsURL');\n return;\n }\n\n const { acsTransID, messageVersion, threeDSServerTransID } = (this.state.challengeData as ChallengeData).cReqData;\n\n // Only render component if we have a acsTransID, messageVersion & threeDSServerTransID\n if (!acsTransID || !messageVersion || !threeDSServerTransID) {\n // Set UI error & call onError callback\n this.setError(\n {\n errorInfo: `${ErrorEventCode.THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS}: ${this.props.i18n.get('err.gen.9102')}`\n },\n true\n );\n\n // Send error to analytics endpoint // TODO - check logs to see if this *ever* happens\n const event = new AnalyticsErrorEvent({\n component: this.props.type,\n code: ErrorEventCode.THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS,\n errorType: ErrorEventType.threeDS2,\n message: `${THREEDS2_CHALLENGE_ERROR}: Decoded token is missing one or more of the following properties (acsTransID | messageVersion | threeDSServerTransID)`\n });\n this.props.onSubmitAnalytics(event);\n\n console.debug(\n '### PrepareChallenge3DS2::exiting:: missing one or more of the following properties (acsTransID | messageVersion | threeDSServerTransID)'\n );\n return;\n }\n\n // Proceed to allow component to render\n this.setState({ status: 'performingChallenge' });\n //\n } else {\n const errorMsg: string = (this.state.challengeData as ErrorObject).error;\n\n const errorCode = errorMsg.includes(MISSING_TOKEN_IN_ACTION_MSG)\n ? ErrorEventCode.THREEDS2_ACTION_IS_MISSING_TOKEN\n : ErrorEventCode.THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED;\n\n // Set UI error & call onError callback\n this.setError(\n {\n errorInfo: `${errorCode}: ${this.props.i18n.get('err.gen.9102')}`\n // errorObj: this.state.challengeData // TODO Decide if we want to expose this data\n },\n true\n );\n\n // Send error to analytics endpoint // TODO - check logs to see if the base64 decoding errors *ever* happen\n const event = new AnalyticsErrorEvent({\n component: this.props.type,\n code: errorCode,\n errorType: ErrorEventType.threeDS2,\n message: `${THREEDS2_CHALLENGE_ERROR}: ${errorMsg}` // can be: 'Missing \"token\" property from threeDS2 action', 'not base64', 'malformed URI sequence' or 'Could not JSON parse token'\n });\n\n this.props.onSubmitAnalytics(event);\n\n console.debug('### PrepareChallenge3DS2::exiting:: no challengeData');\n }\n }\n\n setStatusComplete(resultObj: ResultObject, errorCodeObject: ErrorCodeObject = null) {\n this.setState({ status: 'complete' }, () => {\n const data: ChallengeResolveData = createChallengeResolveData(this.props.dataKey, resultObj.transStatus, this.props.paymentData);\n\n if (errorCodeObject) {\n console.debug('### PrepareChallenge3DS2::errorCodeObject::', errorCodeObject);\n }\n\n let event: AbstractAnalyticsEvent;\n\n /** Are we in an \"error\" i.e. timeout or no transStatus, scenario? If so, submit analytics about it */\n const finalResObject = errorCodeObject ? errorCodeObject : resultObj;\n if (finalResObject.errorCode) {\n const errorTypeAndCode = {\n code: finalResObject.errorCode === 'timeout' ? ErrorEventCode.THREEDS2_TIMEOUT : ErrorEventCode.THREEDS2_NO_TRANSSTATUS,\n errorType: ErrorEventType.threeDS2\n };\n\n // Challenge process has timed out,\n // or, It's an error reported by the backend 'cos no transStatus could be retrieved // TODO - check logs to see if this *ever* happens\n\n event = new AnalyticsErrorEvent({\n component: this.props.type,\n message: (finalResObject as ErrorCodeObject).message,\n ...errorTypeAndCode\n });\n\n // Send error to analytics endpoint\n this.props.onSubmitAnalytics(event);\n }\n\n /** Calculate \"result\" for analytics */\n let result: string;\n\n switch (resultObj?.transStatus) {\n case 'Y':\n result = 'success';\n break;\n case 'N':\n result = 'failed';\n break;\n case 'U':\n result = !errorCodeObject ? 'cancelled' : 'timeout';\n break;\n default:\n }\n if (resultObj?.errorCode) {\n result = 'noTransStatus';\n }\n\n /** Create log object - the process is completed, one way or another */\n\n event = new AnalyticsLogEvent({\n component: this.props.type,\n type: LogEventType.threeDS2,\n subType: LogEventSubtype.challengeCompleted,\n message: `${THREEDS2_NUM} challenge has completed`,\n result\n });\n\n // Send log to analytics endpoint\n this.props.onSubmitAnalytics(event);\n\n /**\n * Equals call to onAdditionalDetails (except for in 3DS2InMDFlow)\n */\n this.props.onComplete(data);\n });\n }\n\n /**\n * Display error in the UI,\n * and, optionally, decide whether to send any of these errors to the merchant defined onError callback\n *\n * @param errorInfoObj -\n * @param isFatal -\n */\n setError(errorInfoObj: StatusErrorInfoObject, isFatal: boolean) {\n this.setState({ status: 'error', errorInfo: errorInfoObj.errorInfo });\n\n // Decide whether to call this.props.onError\n if (isFatal) {\n this.props.onError(new AdyenCheckoutError(ERROR, errorInfoObj.errorInfo, { cause: errorInfoObj.errorObj }));\n }\n }\n\n render(_, { challengeData }) {\n const getImage = useImage();\n if (this.state.status === 'performingChallenge') {\n return (\n <DoChallenge3DS2\n onCompleteChallenge={(challenge: ThreeDS2FlowObject) => {\n let errorCodeObject: ErrorCodeObject = null;\n\n // Challenge has resulted in an error (no transStatus could be retrieved) - but we still treat this as a valid scenario\n if (hasOwnProperty(challenge.result, 'errorCode') && challenge.result.errorCode.length) {\n // Tell the merchant there's been an error\n errorCodeObject = {\n errorCode: challenge.result.errorCode,\n message: `${THREEDS2_CHALLENGE_ERROR}: ${\n challenge.result.errorDescription ? challenge.result.errorDescription : 'no transStatus could be retrieved'\n }`\n };\n\n /**\n * NOTE: we can now use this.props.isMDFlow to decide if we want to send any of these errors to the onError handler\n * - this is problematic in the regular flow since merchants tend to treat any calls to their onError handler as 'fatal',\n * but in the MDFlow we control what the onError handler does.\n */\n if (this.props.isMDFlow) {\n this.props.onError(\n new AdyenCheckoutError(\n ERROR,\n `${THREEDS2_CHALLENGE_ERROR}: ${\n challenge.result.errorDescription\n ? challenge.result.errorDescription\n : 'no transStatus could be retrieved'\n }`,\n { cause: challenge.result.errorCode }\n )\n );\n }\n }\n\n /**\n * An object has been returned, parsed & accepted as legit (according to the rules in getProcessMessageHandler),\n * but the result prop on that object is missing\n */\n if (!challenge.result) {\n this.setError(\n {\n errorInfo: `${THREEDS2_CHALLENGE_ERROR}: ${this.props.i18n.get('3ds.chal.805', {\n values: { result: '\"result\"' }\n })}`,\n errorObj: challenge as unknown as ErrorObject\n },\n true\n );\n\n // Send error to analytics endpoint\n const event = new AnalyticsErrorEvent({\n component: this.props.type,\n code: ErrorEventCode.THREEDS2_CHALLENGE_RESOLVED_WITHOUT_RESULT_PROP,\n errorType: ErrorEventType.threeDS2,\n message: `${THREEDS2_CHALLENGE_ERROR}: challenge resolved without a \"result\" object`\n });\n\n this.props.onSubmitAnalytics(event);\n\n console.debug('### PrepareChallenge3DS2::exiting:: challenge resolved without a \"result\" object');\n\n return;\n }\n\n // Proceed with call to onAdditionalDetails (except for in 3DS2InMDFlow)\n this.setStatusComplete(challenge.result, errorCodeObject);\n }}\n onErrorChallenge={(challenge: ThreeDS2FlowObject) => {\n /**\n * Called when challenge times-out (which is still a valid scenario)...\n */\n if (hasOwnProperty(challenge, 'errorCode')) {\n const timeoutObject: ErrorCodeObject = {\n errorCode: challenge.errorCode,\n message: `${THREEDS2_CHALLENGE}: ${challenge.errorCode}`\n };\n\n // see comment in onCompleteChallenge code block\n if (this.props.isMDFlow) {\n this.props.onError(\n new AdyenCheckoutError(ERROR, `${THREEDS2_CHALLENGE_ERROR}: '3DS2 challenge timed out'`, {\n cause: challenge.errorCode\n })\n );\n }\n\n this.setStatusComplete(challenge.result, timeoutObject);\n return;\n }\n }}\n {...challengeData}\n onActionHandled={this.props.onActionHandled}\n onFormSubmit={this.onFormSubmit}\n />\n );\n }\n\n if (this.state.status === 'error') {\n return (\n <div className=\"adyen-checkout__threeds2-challenge-error\">\n <Img\n className=\"adyen-checkout__status__icon adyen-checkout__status__icon--error\"\n src={getImage({\n imageFolder: 'components/'\n })('error')}\n alt={''}\n />\n <div className=\"adyen-checkout__status__text\">\n {this.state.errorInfo ? this.state.errorInfo : this.props.i18n.get('error.message.unknown')}\n </div>\n </div>\n );\n }\n\n return null;\n }\n}\n\nexport default PrepareChallenge3DS2;\n"],"names":["PrepareChallenge3DS2","Component","componentDidMount","isErrorObject","this","state","challengeData","shouldAllowHttpDomains","props","environment","_environmentUrls","api","includes","acsURL","isValidHttpUrl","setError","errorInfo","ErrorEventCode","THREEDS2_TOKEN_IS_MISSING_ACSURL","i18n","get","event","AnalyticsErrorEvent","component","type","code","errorType","ErrorEventType","threeDS2","message","THREEDS2_CHALLENGE_ERROR","onSubmitAnalytics","console","debug","acsTransID","messageVersion","threeDSServerTransID","cReqData","THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS","setState","status","errorMsg","error","errorCode","MISSING_TOKEN_IN_ACTION_MSG","THREEDS2_ACTION_IS_MISSING_TOKEN","THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED","setStatusComplete","resultObj","errorCodeObject","data","createChallengeResolveData","dataKey","transStatus","paymentData","finalResObject","errorTypeAndCode","THREEDS2_TIMEOUT","THREEDS2_NO_TRANSSTATUS","result","AnalyticsLogEvent","LogEventType","subType","LogEventSubtype","challengeCompleted","THREEDS2_NUM","onComplete","errorInfoObj","isFatal","onError","AdyenCheckoutError","ERROR","cause","errorObj","render","_","getImage","useImage","h","DoChallenge3DS2","onCompleteChallenge","challenge","hasOwnProperty","length","errorDescription","isMDFlow","values","THREEDS2_CHALLENGE_RESOLVED_WITHOUT_RESULT_PROP","onErrorChallenge","timeoutObject","THREEDS2_CHALLENGE","onActionHandled","onFormSubmit","div","className","Img","src","imageFolder","alt","constructor","super","_define_property","msg","challengeDataSentWeb","token","prepareChallengeData","size","challengeWindowSize","success","defaultProps"],"mappings":"6hCAkBA,MAAMA,UAA6BC,EAuC/BC,iBAAAA,GAGI,IAF0BC,EAAcC,KAAKC,MAAMC,eAE7B,CAClB,MAAMC,EAO0B,SAA3BH,KAAKI,MAAMC,aAA0BL,KAAKI,MAAME,kBAAkBC,KAAKC,SAAS,0BAK/EC,OAAEA,GAAWT,KAAKC,MAAMC,cAI9B,IAHuBQ,EAAeD,EAAQN,GAGzB,CAEjBH,KAAKW,SACD,CACIC,UAAW,GAAGC,EAAeC,qCAAqCd,KAAKI,MAAMW,KAAKC,IAAI,oBAE1F,GAIJ,MAAMC,EAAQ,IAAIC,EAAoB,CAClCC,UAAWnB,KAAKI,MAAMgB,KACtBC,KAAMR,EAAeC,iCACrBQ,UAAWC,EAAeC,SAC1BC,QAAS,GAAGC,wDAKhB,OAHA1B,KAAKI,MAAMuB,kBAAkBV,QAE7BW,QAAQC,MAAM,sDAElB,CAEA,MAAMC,WAAEA,EAAUC,eAAEA,EAAcC,qBAAEA,GAA0BhC,KAAKC,MAAMC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