@adyen/adyen-web 6.40.2 → 6.41.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/index.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +49 -41
- package/dist/es/components/ANCV/ANCV.js +1 -1
- package/dist/es/components/ANCV/ANCV.js.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/Card/Card.js +1 -1
- package/dist/es/components/Card/Card.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/utils.js +1 -1
- package/dist/es/components/Card/components/CardInput/utils.js.map +1 -1
- package/dist/es/components/CustomCard/CustomCard.js +1 -1
- package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
- package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
- package/dist/es/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
- package/dist/es/components/Dropin/Dropin.js +1 -1
- package/dist/es/components/Dropin/Dropin.js.map +1 -1
- package/dist/es/components/Dropin/components/DropinComponent.js +1 -1
- package/dist/es/components/Dropin/components/DropinComponent.js.map +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.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/PaymentMethodItem/PaymentMethodItem.js +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodList.js.map +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
- package/dist/es/components/Giftcard/Giftcard.js +1 -1
- package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
- package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
- package/dist/es/components/Giftcard/components/GiftcardPinField.js +1 -1
- package/dist/es/components/Giftcard/components/GiftcardPinField.js.map +1 -1
- package/dist/es/components/MealVoucherFR/components/MealVoucherExpiryField.js +1 -1
- package/dist/es/components/MealVoucherFR/components/MealVoucherExpiryField.js.map +1 -1
- package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
- package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
- package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
- package/dist/es/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.js.map +1 -1
- package/dist/es/components/internal/BaseElement/BaseElement.js +1 -1
- package/dist/es/components/internal/BaseElement/BaseElement.js.map +1 -1
- package/dist/es/components/internal/Button/Button.js +1 -1
- package/dist/es/components/internal/Button/Button.js.map +1 -1
- package/dist/es/components/internal/Button/CopyButton.js +1 -1
- package/dist/es/components/internal/Button/CopyButton.js.map +1 -1
- package/dist/es/components/internal/Button/CopyIconButton.js +1 -1
- package/dist/es/components/internal/Button/CopyIconButton.js.map +1 -1
- package/dist/es/components/internal/ClickToPay/ClickToPayComponent.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/components/CtPSection/CtPSection.js +1 -1
- package/dist/es/components/internal/ClickToPay/components/CtPSection/CtPSection.js.map +1 -1
- package/dist/es/components/internal/FormFields/InputBase.js +1 -1
- package/dist/es/components/internal/FormFields/InputBase.js.map +1 -1
- package/dist/es/components/internal/Modal/Modal.js +1 -1
- package/dist/es/components/internal/Modal/Modal.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/defaultProps.js +1 -1
- package/dist/es/components/internal/SecuredFields/SFP/defaultProps.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/configureCallbacks.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
- package/dist/es/components/internal/SegmentedControl/SegmentedControl.js +1 -1
- package/dist/es/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/es/components/internal/UIElement/UIElement.js +1 -1
- package/dist/es/components/internal/UIElement/UIElement.js.map +1 -1
- package/dist/es/core/Analytics/events/AnalyticsErrorEvent.js +1 -1
- package/dist/es/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
- package/dist/es/core/config.js +1 -1
- package/dist/es/index.d.ts +49 -41
- package/dist/es/utils/commonUtils.js +1 -1
- package/dist/es/utils/commonUtils.js.map +1 -1
- package/dist/es/utils/promiseTimeout.js.map +1 -1
- package/dist/es-legacy/components/ANCV/ANCV.js +1 -1
- package/dist/es-legacy/components/ANCV/ANCV.js.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/Card/Card.js +1 -1
- package/dist/es-legacy/components/Card/Card.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/utils.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/utils.js.map +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCardInput/CustomCardInput.js.map +1 -1
- package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
- package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/DropinComponent.js +1 -1
- package/dist/es-legacy/components/Dropin/components/DropinComponent.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.js +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/DisableOneClickConfirmation.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/PaymentMethodItem/PaymentMethodItem.js +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
- package/dist/es-legacy/components/Giftcard/Giftcard.js +1 -1
- package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
- package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
- package/dist/es-legacy/components/Giftcard/components/GiftcardPinField.js +1 -1
- package/dist/es-legacy/components/Giftcard/components/GiftcardPinField.js.map +1 -1
- package/dist/es-legacy/components/MealVoucherFR/components/MealVoucherExpiryField.js +1 -1
- package/dist/es-legacy/components/MealVoucherFR/components/MealVoucherExpiryField.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.js.map +1 -1
- package/dist/es-legacy/components/internal/BaseElement/BaseElement.js +1 -1
- package/dist/es-legacy/components/internal/BaseElement/BaseElement.js.map +1 -1
- package/dist/es-legacy/components/internal/Button/Button.js +1 -1
- package/dist/es-legacy/components/internal/Button/Button.js.map +1 -1
- package/dist/es-legacy/components/internal/Button/CopyButton.js +1 -1
- package/dist/es-legacy/components/internal/Button/CopyButton.js.map +1 -1
- package/dist/es-legacy/components/internal/Button/CopyIconButton.js +1 -1
- package/dist/es-legacy/components/internal/Button/CopyIconButton.js.map +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/ClickToPayComponent.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/components/CtPSection/CtPSection.js +1 -1
- package/dist/es-legacy/components/internal/ClickToPay/components/CtPSection/CtPSection.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
- package/dist/es-legacy/components/internal/Modal/Modal.js +1 -1
- package/dist/es-legacy/components/internal/Modal/Modal.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProviderHandlers.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/defaultProps.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/SFP/defaultProps.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/configureCallbacks.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/configureCallbacks.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/extensions/createSecuredFields.js +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/securedField/AbstractSecuredField.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/AbstractSecuredField.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
- package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js +1 -1
- package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/es-legacy/components/internal/UIElement/UIElement.js +1 -1
- package/dist/es-legacy/components/internal/UIElement/UIElement.js.map +1 -1
- package/dist/es-legacy/core/Analytics/events/AnalyticsErrorEvent.js +1 -1
- package/dist/es-legacy/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
- package/dist/es-legacy/core/config.js +1 -1
- package/dist/es-legacy/utils/commonUtils.js +1 -1
- package/dist/es-legacy/utils/commonUtils.js.map +1 -1
- package/dist/es-legacy/utils/promiseTimeout.js.map +1 -1
- package/package.json +1 -1
|
@@ -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\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,cAAgC+B,SAGzG,IAAKH,IAAeC,IAAmBC,EAAsB,CAEzDhC,KAAKW,SACD,CACIC,UAAW,GAAGC,EAAeqB,0CAA0ClC,KAAKI,MAAMW,KAAKC,IAAI,oBAE/F,GAIJ,MAAMC,EAAQ,IAAIC,EAAoB,CAClCC,UAAWnB,KAAKI,MAAMgB,KACtBC,KAAMR,EAAeqB,sCACrBZ,UAAWC,EAAeC,SAC1BC,QAAS,GAAGC,6HAOhB,OALA1B,KAAKI,MAAMuB,kBAAkBV,QAE7BW,QAAQC,MACJ,2IAGR,CAGA7B,KAAKmC,SAAS,CAAEC,OAAQ,uBAE5B,KAAO,CACH,MAAMC,EAAmBrC,KAAMC,MAAMC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eAAe,CAClC3C,WAAY,OACZG,QAAS,OACTgB,UAAU"}
|
|
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\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, postMessageDomain } = this.state.challengeData as ChallengeData;\n const hasValidAcsURL = isValidHttpUrl(acsURL, shouldAllowHttpDomains);\n const hasValidPostMessageDomain = isValidHttpUrl(postMessageDomain, shouldAllowHttpDomains);\n\n // Only render component if we have a valid acsURL & postMessageDomain.\n // i.e. a url to load into the iframe, and the domain that we expect the iframe to be sending messages back from\n if (!hasValidAcsURL || !hasValidPostMessageDomain) {\n const errorCode = !hasValidAcsURL\n ? ErrorEventCode.THREEDS2_TOKEN_IS_MISSING_ACSURL\n : ErrorEventCode.THREEDS2_CHALLENGE_TOKEN_IS_MISSING_THREEDSNOTIFICATIONURL;\n const missingProperty = !hasValidAcsURL ? 'acsURL' : 'threeDSNotificationURL';\n\n // Set UI error & call onError callback\n this.setError(\n {\n errorInfo: `${errorCode}: ${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: errorCode,\n errorType: ErrorEventType.threeDS2,\n message: `${THREEDS2_CHALLENGE_ERROR}: Decoded token is missing a valid ${missingProperty} property`\n });\n this.props.onSubmitAnalytics(event);\n\n console.debug(\n `### PrepareChallenge3DS2::exiting:: no valid ${missingProperty}.${!hasValidPostMessageDomain ? ` postMessageDomain=${postMessageDomain}` : ''}`\n );\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: stateChallengeData }: PrepareChallenge3DS2State) {\n const challengeData = stateChallengeData as 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","postMessageDomain","hasValidAcsURL","isValidHttpUrl","hasValidPostMessageDomain","errorCode","ErrorEventCode","THREEDS2_CHALLENGE_TOKEN_IS_MISSING_THREEDSNOTIFICATIONURL","THREEDS2_TOKEN_IS_MISSING_ACSURL","missingProperty","setError","errorInfo","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","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","_","stateChallengeData","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,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BA0D,EADE3G,EACqBmH,eAAe,CAClC5C,WAAY,OACZG,QAAS,OACTiB,UAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DoFingerprint3DS2.js","sources":["../../../../../../src/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport Iframe from '../../../internal/IFrame';\nimport Spinner from '../../../internal/Spinner';\nimport ThreeDS2Form from '../Form';\nimport promiseTimeout from '../../../../utils/promiseTimeout';\nimport getProcessMessageHandler from '../../../../utils/get-process-message-handler';\nimport { THREEDS_METHOD_TIMEOUT, FAILED_METHOD_STATUS_RESOLVE_OBJECT_TIMEOUT, THREEDS2_NUM } from '../../constants';\nimport { encodeBase64URL } from '../utils';\nimport { DoFingerprint3DS2Props, DoFingerprint3DS2State } from './types';\n\nconst iframeName = 'threeDSMethodIframe';\n\n/**\n * Create and Base64URL encode a JSON object containing the serverTransactionID & threeDSMethodNotificationURL.\n * This Base64URL string will be added to the <form> in the ThreeDS2Form component.\n * The ThreeDS2Form component will submit the <form> when it mounts, using the ThreeDS2Iframe as the <form> target.\n * getProcessMessageHandler will listen for the postMessage response from the notificationURL and will settle the\n * promise accordingly causing this component to call the appropriate callback.\n * The callbacks exist in the parent component: ThreeDS2DeviceFingerprint where they ultimately call the onComplete\n * function passed as a prop when checkout.create('threeDS2DeviceFingerprint') is called.\n */\nclass DoFingerprint3DS2 extends Component<DoFingerprint3DS2Props, DoFingerprint3DS2State> {\n private processMessageHandler;\n private fingerPrintPromise:
|
|
1
|
+
{"version":3,"file":"DoFingerprint3DS2.js","sources":["../../../../../../src/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport Iframe from '../../../internal/IFrame';\nimport Spinner from '../../../internal/Spinner';\nimport ThreeDS2Form from '../Form';\nimport promiseTimeout from '../../../../utils/promiseTimeout';\nimport getProcessMessageHandler from '../../../../utils/get-process-message-handler';\nimport { THREEDS_METHOD_TIMEOUT, FAILED_METHOD_STATUS_RESOLVE_OBJECT_TIMEOUT, THREEDS2_NUM } from '../../constants';\nimport { encodeBase64URL } from '../utils';\nimport { DoFingerprint3DS2Props, DoFingerprint3DS2State } from './types';\nimport { ThreeDS2FlowObject } from '../../types';\n\nconst iframeName = 'threeDSMethodIframe';\n\n/**\n * Create and Base64URL encode a JSON object containing the serverTransactionID & threeDSMethodNotificationURL.\n * This Base64URL string will be added to the <form> in the ThreeDS2Form component.\n * The ThreeDS2Form component will submit the <form> when it mounts, using the ThreeDS2Iframe as the <form> target.\n * getProcessMessageHandler will listen for the postMessage response from the notificationURL and will settle the\n * promise accordingly causing this component to call the appropriate callback.\n * The callbacks exist in the parent component: ThreeDS2DeviceFingerprint where they ultimately call the onComplete\n * function passed as a prop when checkout.create('threeDS2DeviceFingerprint') is called.\n */\nclass DoFingerprint3DS2 extends Component<DoFingerprint3DS2Props, DoFingerprint3DS2State> {\n private processMessageHandler;\n private fingerPrintPromise: { cancel: () => void; promise: Promise<ThreeDS2FlowObject> };\n public static readonly defaultProps = {\n showSpinner: true\n };\n\n constructor(props) {\n super(props);\n\n /**\n * Create and Base64URL encode a JSON object\n */\n const { threeDSServerTransID, threeDSMethodNotificationURL } = this.props;\n\n const jsonStr = JSON.stringify({\n threeDSServerTransID,\n threeDSMethodNotificationURL\n });\n const base64URLencodedData = encodeBase64URL(jsonStr);\n this.state = { base64URLencodedData };\n }\n\n get3DS2MethodPromise(): Promise<ThreeDS2FlowObject> {\n return new Promise((resolve, reject) => {\n /**\n * Listen for postMessage responses from the notification url\n */\n this.processMessageHandler = getProcessMessageHandler(this.props.postMessageDomain, resolve, reject, 'fingerPrintResult');\n\n window.addEventListener('message', this.processMessageHandler);\n });\n }\n\n componentDidMount() {\n // Check 3DS2 Device fingerprint\n this.fingerPrintPromise = promiseTimeout(THREEDS_METHOD_TIMEOUT, this.get3DS2MethodPromise(), FAILED_METHOD_STATUS_RESOLVE_OBJECT_TIMEOUT);\n this.fingerPrintPromise.promise\n .then((resolveObject: ThreeDS2FlowObject) => {\n window.removeEventListener('message', this.processMessageHandler);\n this.props.onCompleteFingerprint(resolveObject);\n })\n .catch((rejectObject: ThreeDS2FlowObject) => {\n window.removeEventListener('message', this.processMessageHandler);\n this.props.onErrorFingerprint(rejectObject);\n });\n }\n\n componentWillUnmount() {\n if (this.fingerPrintPromise) this.fingerPrintPromise.cancel();\n window.removeEventListener('message', this.processMessageHandler);\n }\n\n render({ threeDSMethodURL, onActionHandled, onFormSubmit }, { base64URLencodedData }) {\n return (\n <div className=\"adyen-checkout__3ds2-device-fingerprint\">\n {this.props.showSpinner && <Spinner />}\n <div style={{ display: 'none' }}>\n <Iframe\n name={iframeName}\n callback={() => {\n onActionHandled?.({ componentType: '3DS2Fingerprint', actionDescription: `${THREEDS2_NUM} fingerprint iframe loaded` });\n }}\n />\n <ThreeDS2Form\n name={'threeDSMethodForm'}\n action={threeDSMethodURL}\n target={iframeName}\n inputName={'threeDSMethodData'}\n inputValue={base64URLencodedData}\n onFormSubmit={onFormSubmit}\n />\n </div>\n </div>\n );\n }\n}\n\nexport default DoFingerprint3DS2;\n"],"names":["iframeName","DoFingerprint3DS2","Component","get3DS2MethodPromise","Promise","resolve","reject","this","processMessageHandler","getProcessMessageHandler","props","postMessageDomain","window","addEventListener","componentDidMount","fingerPrintPromise","promiseTimeout","THREEDS_METHOD_TIMEOUT","FAILED_METHOD_STATUS_RESOLVE_OBJECT_TIMEOUT","promise","then","resolveObject","removeEventListener","onCompleteFingerprint","catch","rejectObject","onErrorFingerprint","componentWillUnmount","cancel","render","threeDSMethodURL","onActionHandled","onFormSubmit","base64URLencodedData","h","div","className","showSpinner","Spinner","style","display","Iframe","name","callback","componentType","actionDescription","THREEDS2_NUM","ThreeDS2Form","action","target","inputName","inputValue","constructor","super","_define_property","threeDSServerTransID","threeDSMethodNotificationURL","jsonStr","JSON","stringify","encodeBase64URL","state","defaultProps"],"mappings":"+nB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EvB,EAAuB2B,EAAgBH,GAC7ClD,KAAKsD,MAAQ,CAAE5B,uBACnB,EAlBAqB,EAHErD,EAGqB6D,eAAe,CAClCzB,aAAa"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{render as t}from"../../../external/preact/dist/preact.js";import e from"../../../utils/uuid.js";import o from"../../../core/Errors/AdyenCheckoutError.js";import{NO_CHECKOUT_ATTEMPT_ID as r}from"../../../core/Analytics/constants.js";import{on as
|
|
1
|
+
import{render as t}from"../../../external/preact/dist/preact.js";import e from"../../../utils/uuid.js";import o from"../../../core/Errors/AdyenCheckoutError.js";import{NO_CHECKOUT_ATTEMPT_ID as r}from"../../../core/Analytics/constants.js";import{on as n,off as s}from"../../../utils/listenerUtils.js";import{createSdkData as i}from"../../../utils/createSdkData.js";import a from"../../components-name-map.js";import{PAYMENT_METHOD_BEHAVIOR as h}from"../../../core/config.js";function c(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}class d{buildElementProps(t){this.props=this.formatProps({...this.constructor.defaultProps,...t})}formatProps(t){return t}formatData(){return{}}submitAnalytics(t){return null}handleKeyDown(t){return null}setState(t){this.state={...this.state,...t}}get data(){const t=this.state.order||this.props.order,e=this.formatData(),o=Boolean(a(e.paymentMethod?.type)),n=this.core.modules.risk.data,s=this.core.modules.analytics.checkoutAttemptId??r,c=o?h.NATIVE:h.GENERIC,d=i(s,n,c);return e.paymentMethod&&s&&(e.paymentMethod.checkoutAttemptId=s),e.paymentMethod&&d&&(e.paymentMethod.sdkData=d),{...n&&{riskData:{clientData:n}},...t&&{order:{orderData:t.orderData,pspReference:t.pspReference}},...e,clientStateDataIndicator:!0}}activate(){}render(){throw new Error("Payment method cannot be rendered.")}mount(e){const o="string"==typeof e?document.querySelector(e):e;if(!o)throw new Error("Component could not mount. Root node was not found.");return this._node&&this.unmount(),this._node=o,n(this._node,"keydown",this.handleKeyDown,!1),this._component=this.render(),t(this._component,o),this}update(t){return this.props=this.formatProps({...this.props,...t}),this.state={},this.unmount().mount(this._node)}unmount(){return s(this._node,"keydown",this.handleKeyDown),this._node&&t(null,this._node),this}remove(){this.unmount(),this.core&&this.core.remove(this)}constructor(t,r){c(this,"_id",`${this.constructor.type}-${e()}`),c(this,"core",void 0),c(this,"props",void 0),c(this,"state",{}),c(this,"_component",void 0),c(this,"_node",null);const n=function(t){return!!t&&("function"==typeof t.initialize&&"function"==typeof t.createFromAction)}(t);if(!n)throw new o("IMPLEMENTATION_ERROR",`Trying to initialise the component '${this.constructor.type}' without a reference to an instance of AdyenCheckout`);this.core=t,this.buildElementProps(r),this.handleKeyDown=this.handleKeyDown.bind(this)}}c(d,"defaultProps",{});export{d as default};
|
|
2
2
|
//# sourceMappingURL=BaseElement.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseElement.js","sources":["../../../../../src/components/internal/BaseElement/BaseElement.ts"],"sourcesContent":["import { ComponentChild, h, render } from 'preact';\nimport uuid from '../../../utils/uuid';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { NO_CHECKOUT_ATTEMPT_ID } from '../../../core/Analytics/constants';\nimport type { ICore } from '../../../core/types';\nimport type { BaseElementProps, IBaseElement } from './types';\nimport type { PaymentData } from '../../../types/global-types';\nimport { off, on } from '../../../utils/listenerUtils';\nimport { AbstractAnalyticsEvent } from '../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { createSdkData } from '../../../utils/createSdkData';\nimport getComponentNameOfPaymentType from '../../components-name-map';\nimport { PAYMENT_METHOD_BEHAVIOR } from '../../../core/config';\n\n/**\n * Verify if the first parameter is instance of Core.\n * We do not use 'instanceof' to avoid importing the Core class directly into this class.\n * @param checkout\n */\nfunction assertIsCoreInstance(checkout: ICore): checkout is ICore {\n if (!checkout) return false;\n const isCoreObject = typeof checkout.initialize === 'function' && typeof checkout.createFromAction === 'function';\n return isCoreObject;\n}\n\nabstract class BaseElement<P extends BaseElementProps> implements IBaseElement {\n public readonly _id = `${this.constructor['type']}-${uuid()}`;\n public readonly core: ICore;\n\n public props: P;\n public state: any = {};\n public _component;\n\n protected _node: HTMLElement = null;\n\n protected static readonly defaultProps = {};\n\n constructor(checkout: ICore, props?: P) {\n const isCoreInstance = assertIsCoreInstance(checkout);\n\n if (!isCoreInstance) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Trying to initialise the component '${this.constructor['type']}' without a reference to an instance of AdyenCheckout`\n );\n }\n\n this.core = checkout;\n this.buildElementProps(props);\n\n this.
|
|
1
|
+
{"version":3,"file":"BaseElement.js","sources":["../../../../../src/components/internal/BaseElement/BaseElement.ts"],"sourcesContent":["import { ComponentChild, h, render, TargetedKeyboardEvent } from 'preact';\nimport uuid from '../../../utils/uuid';\nimport AdyenCheckoutError from '../../../core/Errors/AdyenCheckoutError';\nimport { NO_CHECKOUT_ATTEMPT_ID } from '../../../core/Analytics/constants';\nimport type { ICore } from '../../../core/types';\nimport type { BaseElementProps, IBaseElement } from './types';\nimport type { PaymentData } from '../../../types/global-types';\nimport { off, on } from '../../../utils/listenerUtils';\nimport { AbstractAnalyticsEvent } from '../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { createSdkData } from '../../../utils/createSdkData';\nimport getComponentNameOfPaymentType from '../../components-name-map';\nimport { PAYMENT_METHOD_BEHAVIOR } from '../../../core/config';\n\n/**\n * Verify if the first parameter is instance of Core.\n * We do not use 'instanceof' to avoid importing the Core class directly into this class.\n * @param checkout\n */\nfunction assertIsCoreInstance(checkout: ICore): checkout is ICore {\n if (!checkout) return false;\n const isCoreObject = typeof checkout.initialize === 'function' && typeof checkout.createFromAction === 'function';\n return isCoreObject;\n}\n\nabstract class BaseElement<P extends BaseElementProps> implements IBaseElement {\n public readonly _id = `${this.constructor['type']}-${uuid()}`;\n public readonly core: ICore;\n\n public props: P;\n public state: any = {};\n public _component;\n\n protected _node: HTMLElement = null;\n\n protected static readonly defaultProps = {};\n\n constructor(checkout: ICore, props?: P) {\n const isCoreInstance = assertIsCoreInstance(checkout);\n\n if (!isCoreInstance) {\n throw new AdyenCheckoutError(\n 'IMPLEMENTATION_ERROR',\n `Trying to initialise the component '${this.constructor['type']}' without a reference to an instance of AdyenCheckout`\n );\n }\n\n this.core = checkout;\n this.buildElementProps(props);\n\n this.handleKeyDown = this.handleKeyDown.bind(this);\n }\n\n protected buildElementProps(componentProps?: P) {\n this.props = this.formatProps({ ...this.constructor['defaultProps'], ...componentProps });\n }\n\n /**\n * Executed during creation of any payment element.\n * Gives a chance to any paymentMethod to format the props we're receiving.\n */\n protected formatProps(props: P) {\n return props;\n }\n\n /**\n * Executed on the `data` getter.\n * Returns the component data necessary for the /payments request\n */\n protected formatData(): any {\n return {};\n }\n\n protected submitAnalytics(_analyticsObj?: AbstractAnalyticsEvent) {\n return null;\n }\n\n protected handleKeyDown(_e: TargetedKeyboardEvent<HTMLInputElement>) {\n return null;\n }\n\n protected setState(newState: object): void {\n this.state = { ...this.state, ...newState };\n }\n\n /**\n * Returns the component payment data ready to submit to the Checkout API\n * Note: this does not ensure validity, check isValid first\n */\n public get data(): PaymentData {\n const order = this.state.order || this.props.order;\n const componentData = this.formatData();\n const doesPaymentMethodHaveNativeComponent = Boolean(getComponentNameOfPaymentType(componentData.paymentMethod?.type));\n const clientData = this.core.modules.risk.data;\n const checkoutAttemptId = this.core.modules.analytics.checkoutAttemptId ?? NO_CHECKOUT_ATTEMPT_ID;\n const paymentMethodBehavior = doesPaymentMethodHaveNativeComponent ? PAYMENT_METHOD_BEHAVIOR.NATIVE : PAYMENT_METHOD_BEHAVIOR.GENERIC;\n\n const sdkData = createSdkData(checkoutAttemptId, clientData, paymentMethodBehavior);\n if (componentData.paymentMethod && checkoutAttemptId) {\n componentData.paymentMethod.checkoutAttemptId = checkoutAttemptId;\n }\n\n if (componentData.paymentMethod && sdkData) {\n componentData.paymentMethod.sdkData = sdkData;\n }\n\n return {\n ...(clientData && { riskData: { clientData } }),\n ...(order && { order: { orderData: order.orderData, pspReference: order.pspReference } }),\n ...componentData,\n clientStateDataIndicator: true\n };\n }\n\n /**\n * Method used to make the payment method active\n * (Useful when there are different payment methods available and activating one PM must trigger a specific task)\n */\n public activate(): void {\n return;\n }\n\n public render(): ComponentChild | Error {\n // render() not implemented in the element\n throw new Error('Payment method cannot be rendered.');\n }\n\n /**\n * Mounts an element into the dom\n * @param domNode - Node (or selector) where we will mount the payment element\n * @returns this - the payment element instance we mounted\n */\n public mount(domNode: HTMLElement | string): this {\n const node = typeof domNode === 'string' ? document.querySelector<HTMLElement>(domNode) : domNode;\n\n if (!node) {\n throw new Error('Component could not mount. Root node was not found.');\n }\n\n if (this._node) {\n this.unmount(); // new, if this._node exists then we are \"remounting\" so we first need to unmount if it's not already been done\n }\n\n this._node = node;\n\n // Add listener for key press events, notably 'Enter' key presses\n on(this._node, 'keydown', this.handleKeyDown, false);\n\n this._component = this.render();\n\n render(this._component, node);\n\n return this;\n }\n\n /**\n * Updates props, resets the internal state and remounts the element.\n *\n * @param props - props to update\n * @returns this - the element instance\n */\n public update(props: Partial<P>): this {\n this.props = this.formatProps({ ...this.props, ...props });\n this.state = {};\n\n return this.unmount().mount(this._node); // for new mount fny\n }\n\n /**\n * Unmounts a payment element from the DOM\n */\n public unmount(): this {\n // Remove listener\n off(this._node, 'keydown', this.handleKeyDown);\n\n if (this._node) {\n render(null, this._node);\n }\n\n return this;\n }\n\n /**\n * Unmounts an element and removes it from the parent instance\n * For \"destroy\" type cleanup - when you don't intend to use the component again\n */\n public remove() {\n this.unmount();\n\n if (this.core) {\n this.core.remove(this);\n }\n }\n}\n\nexport default BaseElement;\n"],"names":["BaseElement","buildElementProps","componentProps","this","props","formatProps","constructor","formatData","submitAnalytics","_analyticsObj","handleKeyDown","_e","setState","newState","state","data","order","componentData","doesPaymentMethodHaveNativeComponent","Boolean","getComponentNameOfPaymentType","paymentMethod","type","clientData","core","modules","risk","checkoutAttemptId","analytics","NO_CHECKOUT_ATTEMPT_ID","paymentMethodBehavior","PAYMENT_METHOD_BEHAVIOR","NATIVE","GENERIC","sdkData","createSdkData","riskData","orderData","pspReference","clientStateDataIndicator","activate","render","Error","mount","domNode","node","document","querySelector","_node","unmount","on","_component","update","off","remove","checkout","_define_property","_id","uuid","isCoreInstance","initialize","createFromAction","assertIsCoreInstance","AdyenCheckoutError","bind","defaultProps"],"mappings":"mlBAwBA,MAAeA,EA4BDC,iBAAAA,CAAkBC,GACxBC,KAAKC,MAAQD,KAAKE,YAAY,IAAKF,KAAKG,YAAY,gBAAoBJ,GAC5E,CAMUG,WAAAA,CAAYD,GAClB,OAAOA,CACX,CAMA,UAAAG,GACI,MAAO,CAAA,CACX,CAEUC,eAAAA,CAAgBC,GACtB,OAAO,IACX,CAEUC,aAAAA,CAAcC,GACpB,OAAO,IACX,CAEUC,QAAAA,CAASC,GACfV,KAAKW,MAAQ,IAAKX,KAAKW,SAAUD,EACrC,CAMA,QAAWE,GACP,MAAMC,EAAQb,KAAKW,MAAME,OAASb,KAAKC,MAAMY,MACvCC,EAAgBd,KAAKI,aACrBW,EAAuCC,QAAQC,EAA8BH,EAAcI,eAAeC,OAC1GC,EAAapB,KAAKqB,KAAKC,QAAQC,KAAKX,KACpCY,EAAoBxB,KAAKqB,KAAKC,QAAQG,UAAUD,mBAAqBE,EACrEC,EAAwBZ,EAAuCa,EAAwBC,OAASD,EAAwBE,QAExHC,EAAUC,EAAcR,EAAmBJ,EAAYO,GAS7D,OARIb,EAAcI,eAAiBM,IAC/BV,EAAcI,cAAcM,kBAAoBA,GAGhDV,EAAcI,eAAiBa,IAC/BjB,EAAcI,cAAca,QAAUA,GAGnC,IACCX,GAAc,CAAEa,SAAU,CAAEb,kBAC5BP,GAAS,CAAEA,MAAO,CAAEqB,UAAWrB,EAAMqB,UAAWC,aAActB,EAAMsB,kBACrErB,EACHsB,0BAA0B,EAElC,CAMA,QAAAC,GAEA,CAEOC,MAAAA,GAEH,MAAM,IAAIC,MAAM,qCACpB,CAOOC,KAAA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 +1,2 @@
|
|
|
1
|
-
import{Component as e,createElement as t}from"../../../external/preact/dist/preact.js";import a from"../../../_virtual/index.js";import n from"../Spinner/Spinner.js";import{useCoreContext as
|
|
1
|
+
import{Component as e,createElement as t}from"../../../external/preact/dist/preact.js";import a from"../../../_virtual/index.js";import n from"../Spinner/Spinner.js";import{useCoreContext as i}from"../../../core/Context/CoreProvider.js";function o(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class r extends e{render(){const{id:e,classNameModifiers:o=[],disabled:r,href:s,icon:l,onClickCompletedIcon:c,inline:d,label:u,ariaLabel:p,ariaLabelledBy:m,ariaDescribedBy:b,ariaExpanded:h,ariaControls:_,status:y,variant:f,buttonRef:g,onClickCompletedLabel:k,onMouseEnter:C,onMouseLeave:v,onFocus:x,onBlur:N,onKeyDown:S}=this.props,{completed:L}=this.state,{i18n:B}=i(),j=c||l?t("img",{className:"adyen-checkout__button__icon",src:this.state.completed?c??l:l,alt:"","aria-hidden":"true"}):"",D=[...o,..."primary"===f?[]:[f],...d?["inline"]:[],...L?["completed"]:[],..."loading"===y||"redirect"===y?["loading"]:[]],M=a(["adyen-checkout__button",...D.map(e=>`adyen-checkout__button--${e}`)]),E={loading:t("span",{"aria-hidden":"true",className:"adyen-checkout__button__content"},t(n,{size:"medium",inline:!0})),redirect:t("span",{"aria-hidden":"true",className:"adyen-checkout__button__content"},t(n,{size:"medium",inline:!0}),B.get("payButton.redirecting")),default:t("span",{className:"adyen-checkout__button__content"},j,t("span",{className:"adyen-checkout__button__text"},this.state.completed?k??u:u))},w=E[y]||E.default;return s?t("a",{className:M,href:s,target:this.props.target,rel:this.props.rel,"aria-disabled":r,onClick:e=>{r&&e.preventDefault()}},w):t("button",{ref:g,id:e,className:M,type:"button",disabled:r,onClick:this.onClick,"aria-label":p,"aria-labelledby":m,"aria-describedby":b,"aria-expanded":h,"aria-controls":_,onMouseEnter:C,onMouseLeave:v,onKeyDown:S,onFocus:x,onBlur:N},w,"loading"!==y&&"redirect"!==y&&this.props.children,t("span",{role:"status","aria-live":"polite",className:"adyen-checkout__button__text--sr-only"},B.get(this.buttonStatusSRLabel(y))))}constructor(...e){super(...e),o(this,"onClick",e=>{e.preventDefault(),this.props.disabled||this.props.onClick?.(e,{complete:this.complete})}),o(this,"complete",(e=1e3)=>{this.setState({completed:!0}),setTimeout(()=>{this.setState({completed:!1})},e)}),o(this,"buttonStatusSRLabel",e=>({loading:"loading",redirect:"payButton.redirecting"}[e]||""))}}o(r,"defaultProps",{status:"default",variant:"primary",disabled:!1,label:"",inline:!1,target:"_self"});export{r as default};
|
|
2
2
|
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../../../src/components/internal/Button/Button.tsx"],"sourcesContent":["import { Component, h, TargetedMouseEvent } from 'preact';\nimport classNames from 'classnames';\nimport Spinner from '../Spinner';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { ButtonProps, ButtonState } from './types';\nimport './Button.scss';\n\nclass Button extends Component<ButtonProps, ButtonState> {\n public static readonly defaultProps = {\n status: 'default',\n variant: 'primary',\n disabled: false,\n label: '',\n inline: false,\n target: '_self'\n };\n\n public onClick = (e: TargetedMouseEvent<HTMLButtonElement>) => {\n e.preventDefault();\n\n if (!this.props.disabled) {\n this.props.onClick?.(e, { complete: this.complete });\n }\n };\n\n public complete = (delay = 1_000) => {\n this.setState({ completed: true });\n setTimeout(() => {\n this.setState({ completed: false });\n }, delay);\n };\n\n private readonly buttonStatusSRLabel = (status: string): string => {\n const srLabels: Record<string, string> = {\n loading: 'loading',\n redirect: 'payButton.redirecting'\n };\n\n return srLabels[status] || '';\n };\n\n render() {\n const {\n id,\n classNameModifiers = [],\n disabled,\n href,\n icon,\n onClickCompletedIcon,\n inline,\n label,\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n ariaExpanded,\n ariaControls,\n status,\n variant,\n buttonRef,\n onClickCompletedLabel,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n onKeyDown
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../../../src/components/internal/Button/Button.tsx"],"sourcesContent":["import { Component, h, TargetedMouseEvent } from 'preact';\nimport classNames from 'classnames';\nimport Spinner from '../Spinner';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { ButtonProps, ButtonState } from './types';\nimport './Button.scss';\n\nclass Button extends Component<ButtonProps, ButtonState> {\n public static readonly defaultProps = {\n status: 'default',\n variant: 'primary',\n disabled: false,\n label: '',\n inline: false,\n target: '_self'\n };\n\n public onClick = (e: TargetedMouseEvent<HTMLButtonElement>) => {\n e.preventDefault();\n\n if (!this.props.disabled) {\n this.props.onClick?.(e, { complete: this.complete });\n }\n };\n\n public complete = (delay = 1_000) => {\n this.setState({ completed: true });\n setTimeout(() => {\n this.setState({ completed: false });\n }, delay);\n };\n\n private readonly buttonStatusSRLabel = (status: string): string => {\n const srLabels: Record<string, string> = {\n loading: 'loading',\n redirect: 'payButton.redirecting'\n };\n\n return srLabels[status] || '';\n };\n\n render() {\n const {\n id,\n classNameModifiers = [],\n disabled,\n href,\n icon,\n onClickCompletedIcon,\n inline,\n label,\n ariaLabel,\n ariaLabelledBy,\n ariaDescribedBy,\n ariaExpanded,\n ariaControls,\n status,\n variant,\n buttonRef,\n onClickCompletedLabel,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n onKeyDown\n }: ButtonProps = this.props;\n const { completed } = this.state;\n const { i18n } = useCoreContext();\n\n const buttonIcon =\n onClickCompletedIcon || icon ? (\n <img\n className=\"adyen-checkout__button__icon\"\n src={this.state.completed ? (onClickCompletedIcon ?? icon) : icon}\n alt=\"\"\n aria-hidden=\"true\"\n />\n ) : (\n ''\n );\n\n const modifiers = [\n ...classNameModifiers,\n ...(variant === 'primary' ? [] : [variant]),\n ...(inline ? ['inline'] : []),\n ...(completed ? ['completed'] : []),\n ...(status === 'loading' || status === 'redirect' ? ['loading'] : [])\n ];\n\n const buttonClasses = classNames(['adyen-checkout__button', ...modifiers.map(m => `adyen-checkout__button--${m}`)]);\n\n const buttonStates = {\n loading: (\n <span aria-hidden=\"true\" className=\"adyen-checkout__button__content\">\n <Spinner size=\"medium\" inline />\n </span>\n ),\n redirect: (\n <span aria-hidden=\"true\" className=\"adyen-checkout__button__content\">\n <Spinner size=\"medium\" inline />\n {i18n.get('payButton.redirecting')}\n </span>\n ),\n default: (\n <span className=\"adyen-checkout__button__content\">\n {buttonIcon}\n <span className=\"adyen-checkout__button__text\">{this.state.completed ? (onClickCompletedLabel ?? label) : label}</span>\n </span>\n )\n };\n\n const buttonText = buttonStates[status] || buttonStates.default;\n\n if (href) {\n return (\n <a\n className={buttonClasses}\n href={href}\n target={this.props.target}\n rel={this.props.rel}\n aria-disabled={disabled}\n onClick={(e: TargetedMouseEvent<HTMLAnchorElement>) => {\n if (disabled) {\n e.preventDefault();\n }\n }}\n >\n {buttonText}\n </a>\n );\n }\n\n return (\n <button\n ref={buttonRef}\n id={id}\n className={buttonClasses}\n type=\"button\"\n disabled={disabled}\n onClick={this.onClick}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n aria-expanded={ariaExpanded}\n aria-controls={ariaControls}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onKeyDown={onKeyDown}\n onFocus={onFocus}\n onBlur={onBlur}\n >\n {buttonText}\n {status !== 'loading' && status !== 'redirect' && this.props.children}\n <span role=\"status\" aria-live=\"polite\" className=\"adyen-checkout__button__text--sr-only\">\n {i18n.get(this.buttonStatusSRLabel(status))}\n </span>\n </button>\n );\n }\n}\n\nexport default Button;\n"],"names":["Button","Component","render","id","classNameModifiers","disabled","href","icon","onClickCompletedIcon","inline","label","ariaLabel","ariaLabelledBy","ariaDescribedBy","ariaExpanded","ariaControls","status","variant","buttonRef","onClickCompletedLabel","onMouseEnter","onMouseLeave","onFocus","onBlur","onKeyDown","this","props","completed","state","i18n","useCoreContext","buttonIcon","h","img","className","src","alt","aria-hidden","modifiers","buttonClasses","classNames","map","m","buttonStates","loading","span","Spinner","size","redirect","get","default","buttonText","a","target","rel","aria-disabled","onClick","e","preventDefault","button","ref","type","aria-label","aria-labelledby","aria-describedby","aria-expanded","aria-controls","children","role","aria-live","buttonStatusSRLabel","super","args","_define_property","complete","delay","setState","setTimeout","defaultProps"],"mappings":"qWAOA,MAAMA,UAAeC,EAkCjBC,MAAAA,GACI,MAAMC,GACFA,EAAEC,mBACFA,EAAqB,GAAEC,SACvBA,EAAQC,KACRA,EAAIC,KACJA,EAAIC,qBACJA,EAAoBC,OACpBA,EAAMC,MACNA,EAAKC,UACLA,EAASC,eACTA,EAAcC,gBACdA,EAAeC,aACfA,EAAYC,aACZA,EAAYC,OACZA,EAAMC,QACNA,EAAOC,UACPA,EAASC,sBACTA,EAAqBC,aACrBA,EAAYC,aACZA,EAAYC,QACZA,EAAOC,OACPA,EAAMC,UACNA,GACaC,KAAKC,OAChBC,UAAEA,GAAcF,KAAKG,OACrBC,KAAEA,GAASC,IAEXC,EACFvB,GAAwBD,EACpByB,EAACC,MAAAA,CACGC,UAAU,+BACVC,IAAKV,KAAKG,MAAMD,UAAanB,GAAwBD,EAAQA,EAC7D6B,IAAI,GACJC,cAAY,SAGhB,GAGFC,EAAY,IACXlC,KACa,YAAZa,EAAwB,GAAK,CAACA,MAC9BR,EAAS,CAAC,UAAY,MACtBkB,EAAY,CAAC,aAAe,MACjB,YAAXX,GAAmC,aAAXA,EAAwB,CAAC,WAAa,IAGhEuB,EAAgBC,EAAW,CAAC,4BAA6BF,EAAUG,IAAIC,GAAK,2BAA2BA,OAEvGC,EAAe,CACjBC,QACIZ,EAACa,OAAAA,CAAKR,cAAY,OAAOH,UAAU,mCAC/BF,EAACc,EAAAA,CAAQC,KAAK,SAAStC,QAAAA,KAG/BuC,SACIhB,EAACa,OAAAA,CAAKR,cAAY,OAAOH,UAAU,m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,yBAGEhC,IAAW,MA9B/ByD,EADEzE,EACqB8E,eAAe,CAClC9D,OAAQ,UACRC,QAAS,UACTZ,UAAU,EACVK,MAAO,GACPD,QAAQ,EACR4C,OAAQ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as o}from"../../../external/preact/dist/preact.js";import{useCallback as t}from"../../../external/preact/hooks/dist/hooks.js";import e from"./Button.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";import{copyToClipboard as n}from"../../../utils/clipboard.js";import{PREFIX as i}from"../Icon/constants.js";import c from"../../../core/Context/useImage.js";import{stopPropagationForActionKeys as s}from"./stopPropagationForActionKeys.js";const a=a=>{const{i18n:m}=r(),p=c(),l=t((o,{complete:t})=>{n(a.text),t(),a.onClick?.(o)},[a.text,a.onClick]);return o(e,{...a,variant:"action",onClick:l,
|
|
1
|
+
import{createElement as o}from"../../../external/preact/dist/preact.js";import{useCallback as t}from"../../../external/preact/hooks/dist/hooks.js";import e from"./Button.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";import{copyToClipboard as n}from"../../../utils/clipboard.js";import{PREFIX as i}from"../Icon/constants.js";import c from"../../../core/Context/useImage.js";import{stopPropagationForActionKeys as s}from"./stopPropagationForActionKeys.js";const a=a=>{const{i18n:m}=r(),p=c(),l=t((o,{complete:t})=>{n(a.text),t(),a.onClick?.(o)},[a.text,a.onClick]);return o(e,{...a,variant:"action",onClick:l,onKeyDown:s,icon:a.icon??p({imageFolder:"components/"})(`${i}copy`),label:a.label??m.get("button.copy"),onClickCompletedLabel:a.copiedLabel??m.get("button.copied")})};export{a as CopyButton};
|
|
2
2
|
//# sourceMappingURL=CopyButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CopyButton.js","sources":["../../../../../src/components/internal/Button/CopyButton.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback } from 'preact/hooks';\nimport Button from './Button';\nimport { ButtonProps } from './types';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport copyToClipboard from '../../../utils/clipboard';\nimport { PREFIX } from '../Icon/constants';\nimport useImage from '../../../core/Context/useImage';\nimport { stopPropagationForActionKeys } from './stopPropagationForActionKeys';\n\nexport interface CopyButtonProps extends Omit<ButtonProps, 'variant' | 'onClickCompletedLabel'> {\n /**\n * String that will get copied to the clipboard\n */\n text: string;\n copiedLabel?: string;\n onClick?: (e:
|
|
1
|
+
{"version":3,"file":"CopyButton.js","sources":["../../../../../src/components/internal/Button/CopyButton.tsx"],"sourcesContent":["import { h, TargetedMouseEvent } from 'preact';\nimport { useCallback } from 'preact/hooks';\nimport Button from './Button';\nimport { ButtonProps } from './types';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport copyToClipboard from '../../../utils/clipboard';\nimport { PREFIX } from '../Icon/constants';\nimport useImage from '../../../core/Context/useImage';\nimport { stopPropagationForActionKeys } from './stopPropagationForActionKeys';\n\nexport interface CopyButtonProps extends Omit<ButtonProps, 'variant' | 'onClickCompletedLabel'> {\n /**\n * String that will get copied to the clipboard\n */\n text: string;\n copiedLabel?: string;\n onClick?: (e: TargetedMouseEvent<HTMLButtonElement>) => void;\n}\n\nconst CopyButton = (props: Readonly<CopyButtonProps>) => {\n const { i18n } = useCoreContext();\n const getImage = useImage();\n\n const onClick = useCallback(\n (e, { complete }) => {\n void copyToClipboard(props.text);\n complete();\n props.onClick?.(e);\n },\n [props.text, props.onClick]\n );\n\n return (\n <Button\n {...props}\n variant=\"action\"\n onClick={onClick}\n // Workaround: See ADR-0001-uielement-keyboard-event-propagation-workaround\n onKeyDown={stopPropagationForActionKeys}\n icon={props.icon ?? getImage({ imageFolder: 'components/' })(`${PREFIX}copy`)}\n label={props.label ?? i18n.get('button.copy')}\n onClickCompletedLabel={props.copiedLabel ?? i18n.get('button.copied')}\n />\n );\n};\n\nexport { CopyButton };\n"],"names":["CopyButton","props","i18n","useCoreContext","getImage","useImage","onClick","useCallback","e","complete","copyToClipboard","text","h","Button","variant","onKeyDown","stopPropagationForActionKeys","icon","imageFolder","PREFIX","label","get","onClickCompletedLabel","copiedLabel"],"mappings":"meAmBA,MAAMA,EAAcC,IAChB,MAAMC,KAAEA,GAASC,IACXC,EAAWC,IAEXC,EAAUC,EACZ,CAACC,GAAKC,eACGC,EAAgBT,EAAMU,MAC3BF,IACAR,EAAMK,UAAUE,IAEpB,CAACP,EAAMU,KAAMV,EAAMK,UAGvB,OACIM,EAACC,EAAAA,IACOZ,EACJa,QAAQ,SACRR,QAASA,EAETS,UAAWC,EACXC,KAAMhB,EAAMgB,MAAQb,EAAS,CAAEc,YAAa,eAAxBd,CAAyC,GAAGe,SAChEC,MAAOnB,EAAMmB,OAASlB,EAAKmB,IAAI,eAC/BC,sBAAuBrB,EAAMsB,aAAerB,EAAKmB,IAAI"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as o}from"../../../external/preact/dist/preact.js";import{useRef as t,useCallback as e}from"../../../external/preact/hooks/dist/hooks.js";import n from"./Button.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";import{copyToClipboard as
|
|
1
|
+
import{createElement as o}from"../../../external/preact/dist/preact.js";import{useRef as t,useCallback as e}from"../../../external/preact/hooks/dist/hooks.js";import n from"./Button.js";import{useCoreContext as r}from"../../../core/Context/CoreProvider.js";import{copyToClipboard as i}from"../../../utils/clipboard.js";import{SingletonTooltipProvider as a,useTooltip as s}from"../Tooltip/SingletonTooltipProvider.js";import{stopPropagationForActionKeys as p}from"./stopPropagationForActionKeys.js";const c=a=>{const{i18n:c}=r(),l=t(null),{showTooltip:C,hideTooltip:u}=s(),m=e(()=>{i(a.text),C({anchorRef:l,text:c.get("button.copied")})},[a.text,c,C]),f=e(o=>{p(o),"Escape"!==o.key&&"Escape"!==o.code||(o.stopPropagation(),u())},[u]),h=e(()=>{C({anchorRef:l,text:c.get("button.copy")})},[l,c,C]);return o(n,{...a,variant:"iconOnly",buttonRef:l,ariaLabel:a.ariaLabel??c.get("button.copy"),onMouseEnter:h,onMouseLeave:u,onFocus:h,onBlur:u,onClick:m,onKeyDown:f},o("svg",{className:"adyen-checkout__button--iconOnly__icon",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},o("path",{d:"M3.5 1.25C2.25736 1.25 1.25 2.25736 1.25 3.5V8.5C1.25 9.74264 2.25736 10.75 3.5 10.75H5.25V12.5C5.25 13.7426 6.25736 14.75 7.5 14.75H12.5C13.7426 14.75 14.75 13.7426 14.75 12.5V7.5C14.75 6.25736 13.7426 5.25 12.5 5.25H10.75V3.5C10.75 2.25736 9.74264 1.25 8.5 1.25H3.5ZM9.25 5.25H7.5C6.25736 5.25 5.25 6.25736 5.25 7.5V9.25H3.5C3.08579 9.25 2.75 8.91421 2.75 8.5V3.5C2.75 3.08579 3.08579 2.75 3.5 2.75H8.5C8.91421 2.75 9.25 3.08579 9.25 3.5V5.25ZM6.75 12.5V7.5C6.75 7.08579 7.08579 6.75 7.5 6.75H12.5C12.9142 6.75 13.25 7.08579 13.25 7.5V12.5C13.25 12.9142 12.9142 13.25 12.5 13.25H7.5C7.08579 13.25 6.75 12.9142 6.75 12.5Z"})))},l=t=>o(a,null,o(c,t));export{l as CopyIconButton};
|
|
2
2
|
//# sourceMappingURL=CopyIconButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CopyIconButton.js","sources":["../../../../../src/components/internal/Button/CopyIconButton.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback, useRef } from 'preact/hooks';\nimport Button from './Button';\nimport { ButtonProps } from './types';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport copyToClipboard from '../../../utils/clipboard';\nimport { SingletonTooltipProvider, useTooltip } from '../Tooltip/SingletonTooltipProvider';\nimport
|
|
1
|
+
{"version":3,"file":"CopyIconButton.js","sources":["../../../../../src/components/internal/Button/CopyIconButton.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback, useRef } from 'preact/hooks';\nimport Button from './Button';\nimport { ButtonProps } from './types';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport copyToClipboard from '../../../utils/clipboard';\nimport { SingletonTooltipProvider, useTooltip } from '../Tooltip/SingletonTooltipProvider';\nimport { stopPropagationForActionKeys } from './stopPropagationForActionKeys';\nimport './CopyIconButton.scss';\n\nexport interface CopyIconButtonProps extends ButtonProps {\n /**\n * String that will get copied to the clipboard\n */\n text: string;\n}\n\nconst CopyIconButton = (props: Readonly<CopyIconButtonProps>) => {\n const { i18n } = useCoreContext();\n const anchorRef = useRef<HTMLButtonElement>(null);\n const { showTooltip, hideTooltip } = useTooltip();\n\n const onClick = useCallback(() => {\n void copyToClipboard(props.text);\n showTooltip({ anchorRef, text: i18n.get('button.copied') });\n }, [props.text, i18n, showTooltip]);\n\n const onKeyDown = useCallback(\n (event: KeyboardEvent) => {\n stopPropagationForActionKeys(event);\n\n if (event.key === 'Escape' || event.code === 'Escape') {\n event.stopPropagation();\n hideTooltip();\n }\n },\n [hideTooltip]\n );\n\n const handleShowTooltip = useCallback(() => {\n showTooltip({ anchorRef, text: i18n.get('button.copy') });\n }, [anchorRef, i18n, showTooltip]);\n\n return (\n <Button\n {...props}\n variant=\"iconOnly\"\n buttonRef={anchorRef}\n ariaLabel={props.ariaLabel ?? i18n.get('button.copy')}\n onMouseEnter={handleShowTooltip}\n onMouseLeave={hideTooltip}\n onFocus={handleShowTooltip}\n onBlur={hideTooltip}\n onClick={onClick}\n onKeyDown={onKeyDown}\n >\n <svg\n className=\"adyen-checkout__button--iconOnly__icon\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n >\n <path d=\"M3.5 1.25C2.25736 1.25 1.25 2.25736 1.25 3.5V8.5C1.25 9.74264 2.25736 10.75 3.5 10.75H5.25V12.5C5.25 13.7426 6.25736 14.75 7.5 14.75H12.5C13.7426 14.75 14.75 13.7426 14.75 12.5V7.5C14.75 6.25736 13.7426 5.25 12.5 5.25H10.75V3.5C10.75 2.25736 9.74264 1.25 8.5 1.25H3.5ZM9.25 5.25H7.5C6.25736 5.25 5.25 6.25736 5.25 7.5V9.25H3.5C3.08579 9.25 2.75 8.91421 2.75 8.5V3.5C2.75 3.08579 3.08579 2.75 3.5 2.75H8.5C8.91421 2.75 9.25 3.08579 9.25 3.5V5.25ZM6.75 12.5V7.5C6.75 7.08579 7.08579 6.75 7.5 6.75H12.5C12.9142 6.75 13.25 7.08579 13.25 7.5V12.5C13.25 12.9142 12.9142 13.25 12.5 13.25H7.5C7.08579 13.25 6.75 12.9142 6.75 12.5Z\" />\n </svg>\n </Button>\n );\n};\n\nconst withTooltip = (props: Readonly<CopyIconButtonProps>) => {\n return (\n <SingletonTooltipProvider>\n <CopyIconButton {...props} />\n </SingletonTooltipProvider>\n );\n};\n\nexport { withTooltip as CopyIconButton };\n"],"names":["CopyIconButton","props","i18n","useCoreContext","anchorRef","useRef","showTooltip","hideTooltip","useTooltip","onClick","useCallback","copyToClipboard","text","get","onKeyDown","event","stopPropagationForActionKeys","key","code","stopPropagation","handleShowTooltip","h","Button","variant","buttonRef","ariaLabel","onMouseEnter","onMouseLeave","onFocus","onBlur","svg","className","xmlns","width","height","viewBox","fill","path","d","withTooltip","SingletonTooltipProvider"],"mappings":"kfAiBA,MAAMA,EAAkBC,IACpB,MAAMC,KAAEA,GAASC,IACXC,EAAYC,EAA0B,OACtCC,YAAEA,EAAWC,YAAEA,GAAgBC,IAE/BC,EAAUC,EAAY,KACnBC,EAAgBV,EAAMW,MAC3BN,EAAY,CAAEF,YAAWQ,KAAMV,EAAKW,IAAI,oBACzC,CAACZ,EAAMW,KAAMV,EAAMI,IAEhBQ,EAAYJ,EACbK,IACGC,EAA6BD,GAEX,WAAdA,EAAME,KAAmC,WAAfF,EAAMG,OAChCH,EAAMI,kBACNZ,MAGR,CAACA,IAGCa,EAAoBV,EAAY,KAClCJ,EAAY,CAAEF,YAAWQ,KAAMV,EAAKW,IAAI,kBACzC,CAACT,EAAWF,EAAMI,IAErB,OACIe,EAACC,EAAAA,IACOrB,EACJsB,QAAQ,WACRC,UAAWpB,EACXqB,UAAWxB,EAAMwB,WAAavB,EAAKW,IAAI,eACvCa,aAAcN,EACdO,aAAcpB,EACdqB,QAASR,EACTS,OAAQtB,EACRE,QAASA,EACTK,UAAWA,GAEXO,EAACS,MAAAA,CACGC,UAAU,yCACVC,MAAM,6BACNC,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,QAELf,EAACgB,OAAAA,CAAKC,EAAE,snBAMlBC,EAAetC,GAEboB,EAACmB,EAAAA,KACGnB,EAACrB,EAAmBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClickToPayComponent.js","sources":["../../../../../src/components/internal/ClickToPay/ClickToPayComponent.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback, useEffect } from 'preact/hooks';\nimport { CtpState } from './services/ClickToPayService';\nimport useClickToPayContext from './context/useClickToPayContext';\nimport CtPOneTimePassword from './components/CtPOneTimePassword';\nimport CtPCards from './components/CtPCards';\nimport CtPSection from './components/CtPSection';\nimport CtPLoader from './components/CtPLoader';\nimport CtPLogin from './components/CtPLogin';\nimport SrciError from './services/sdks/SrciError';\n\ntype ClickToPayComponentProps = {\n onDisplayCardComponent?(): void;\n};\n\nconst ClickToPayComponent = ({ onDisplayCardComponent }: Readonly<ClickToPayComponentProps>): h.JSX.Element => {\n const { ctpState, onReady, startIdentityValidation, logoutShopper } = useClickToPayContext();\n\n useEffect(() => {\n if ([CtpState.OneTimePassword, CtpState.Login, CtpState.Ready].includes(ctpState)) {\n onReady();\n }\n }, [ctpState, onReady]);\n\n useEffect(() => {\n async function sendOneTimePassword() {\n try {\n await startIdentityValidation();\n } catch (error) {\n if (error instanceof SrciError) console.warn(`CtP - Identity Validation error: ${error.toString()}`);\n await logoutShopper();\n }\n }\n if (ctpState === CtpState.ShopperIdentified) {\n void sendOneTimePassword();\n }\n }, [ctpState]);\n\n /**\n * We capture the ENTER
|
|
1
|
+
{"version":3,"file":"ClickToPayComponent.js","sources":["../../../../../src/components/internal/ClickToPay/ClickToPayComponent.tsx"],"sourcesContent":["import { h, TargetedKeyboardEvent } from 'preact';\nimport { useCallback, useEffect } from 'preact/hooks';\nimport { CtpState } from './services/ClickToPayService';\nimport useClickToPayContext from './context/useClickToPayContext';\nimport CtPOneTimePassword from './components/CtPOneTimePassword';\nimport CtPCards from './components/CtPCards';\nimport CtPSection from './components/CtPSection';\nimport CtPLoader from './components/CtPLoader';\nimport CtPLogin from './components/CtPLogin';\nimport SrciError from './services/sdks/SrciError';\n\ntype ClickToPayComponentProps = {\n onDisplayCardComponent?(): void;\n};\n\nconst ClickToPayComponent = ({ onDisplayCardComponent }: Readonly<ClickToPayComponentProps>): h.JSX.Element => {\n const { ctpState, onReady, startIdentityValidation, logoutShopper } = useClickToPayContext();\n\n useEffect(() => {\n if ([CtpState.OneTimePassword, CtpState.Login, CtpState.Ready].includes(ctpState)) {\n onReady();\n }\n }, [ctpState, onReady]);\n\n useEffect(() => {\n async function sendOneTimePassword() {\n try {\n await startIdentityValidation();\n } catch (error) {\n if (error instanceof SrciError) console.warn(`CtP - Identity Validation error: ${error.toString()}`);\n await logoutShopper();\n }\n }\n if (ctpState === CtpState.ShopperIdentified) {\n void sendOneTimePassword();\n }\n }, [ctpState]);\n\n /**\n * We capture the ENTER keydown within the ClickToPay component because we do not want to propagate the event up to the UIElement\n * UIElement would perform the payment flow (by calling .submit), which is not relevant/supported by Click to Pay\n */\n const handleEnterKeyPress = useCallback((event: TargetedKeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n event.preventDefault(); // Prevent <form> submission if Component is placed inside a form\n event.stopPropagation(); // Prevent global BaseElement keydown event to be triggered\n }\n }, []);\n\n if (ctpState === CtpState.NotAvailable) {\n return null;\n }\n\n return (\n <CtPSection onEnterKeyPress={handleEnterKeyPress}>\n {[CtpState.Loading, CtpState.ShopperIdentified].includes(ctpState) && <CtPLoader />}\n {ctpState === CtpState.OneTimePassword && <CtPOneTimePassword onDisplayCardComponent={onDisplayCardComponent} />}\n {ctpState === CtpState.Ready && <CtPCards onDisplayCardComponent={onDisplayCardComponent} />}\n {ctpState === CtpState.Login && <CtPLogin />}\n </CtPSection>\n );\n};\n\nexport default ClickToPayComponent;\n"],"names":["ClickToPayComponent","onDisplayCardComponent","ctpState","onReady","startIdentityValidation","logoutShopper","useClickToPayContext","useEffect","CtpState","OneTimePassword","Login","Ready","includes","ShopperIdentified","async","error","SrciError","console","warn","toString","sendOneTimePassword","handleEnterKeyPress","useCallback","event","key","preventDefault","stopPropagation","NotAvailable","h","CtPSection","onEnterKeyPress","Loading","CtPLoader","CtPOneTimePassword","CtPCards","CtPLogin"],"mappings":"ykBAeA,MAAMA,EAAsB,EAAGC,6BAC3B,MAAMC,SAAEA,EAAQC,QAAEA,EAAOC,wBAAEA,EAAuBC,cAAEA,GAAkBC,IAEtEC,EAAU,KACF,CAACC,EAASC,gBAAiBD,EAASE,MAAOF,EAASG,OAAOC,SAASV,IACpEC,KAEL,CAACD,EAAUC,IAEdI,EAAU,KASFL,IAAaM,EAASK,mBAR1BC,iBACI,UACUV,GACV,CAAE,MAAOW,GACDA,aAAiBC,GAAWC,QAAQC,KAAK,oCAAoCH,EAAMI,oBACjFd,GACV,CACJ,CAESe,IAEV,CAAClB,IAMJ,MAAMmB,EAAsBC,EAAaC,IACnB,UAAdA,EAAMC,MACND,EAAME,iBACNF,EAAMG,oBAEX,IAEH,OAAIxB,IAAaM,EAASmB,aACf,KAIPC,EAACC,EAAAA,CAAWC,gBAAiBT,GACxB,CAACb,EAASuB,QAASvB,EAASK,mBAAmBD,SAASV,IAAa0B,EAACI,QACtE9B,IAAaM,EAASC,iBAAmBmB,EAACK,EAAAA,CAAmBhC,uBAAwBA,IACrFC,IAAaM,EAASG,OAASiB,EAACM,EAAAA,CAASjC,uBAAwBA,IACjEC,IAAaM,EAASE,OAASkB,EAACO,EAAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../../../external/preact/dist/preact.js";import{useRef as r,useState as o,useCallback as s,useEffect as t}from"../../../../../external/preact/hooks/dist/hooks.js";import{loginValidationRules as n}from"./validate.js";import{useCoreContext as a}from"../../../../../core/Context/CoreProvider.js";import i from"../../../../../utils/useForm/useFormWithA11y.js";import{setFocusOnField as l}from"../../../../../utils/setFocus.js";import p from"../../../FormFields/Field/Field.js";import u from"../../../FormFields/InputEmail.js";const m=m=>{const{i18n:d}=a(),c=r(null),{handleChangeFor:g,data:h,triggerValidation:f,valid:L,errors:F,isValid:v}=i({schema:["shopperLogin"],rules:n,formHolder:c}),j=r({validateInput:null,focusInput:null}),[I,b]=o(!1),E=s(()=>{b(!0),f()},[f]);t(()=>{c.current&&m.errorMessage&&l(c.current,"shopperLogin")},[m.errorMessage]),t(()=>{h.shopperLogin&&b(!0)},[h.shopperLogin]),t(()=>{j.current.validateInput=E,m.onSetInputHandlers(j.current)},[E,m.onSetInputHandlers]);const M=s(e=>{"Enter"===e.key&&m.onPressEnter()},[m.onPressEnter]);return t(()=>{m.onChange({data:h,valid:L,errors:F,isValid:v})},[h,L,F]),e("div",{ref:c},e(p,{name:"shopperLogin",label:d.get("ctp.login.inputLabel"),errorMessage:I?m.errorMessage||F.shopperLogin&&d.get(F.shopperLogin.errorMessage):null,classNameModifiers:["shopperLogin"],errorLive:!0},e(u,{name:"shopperLogin",autocorrect:"off",spellcheck:!1,value:h.shopperLogin,disabled:m.disabled,onInput:g("shopperLogin","input"),onBlur:g("shopperLogin","blur"),
|
|
1
|
+
import{createElement as e}from"../../../../../external/preact/dist/preact.js";import{useRef as r,useState as o,useCallback as s,useEffect as t}from"../../../../../external/preact/hooks/dist/hooks.js";import{loginValidationRules as n}from"./validate.js";import{useCoreContext as a}from"../../../../../core/Context/CoreProvider.js";import i from"../../../../../utils/useForm/useFormWithA11y.js";import{setFocusOnField as l}from"../../../../../utils/setFocus.js";import p from"../../../FormFields/Field/Field.js";import u from"../../../FormFields/InputEmail.js";const m=m=>{const{i18n:d}=a(),c=r(null),{handleChangeFor:g,data:h,triggerValidation:f,valid:L,errors:F,isValid:v}=i({schema:["shopperLogin"],rules:n,formHolder:c}),j=r({validateInput:null,focusInput:null}),[I,b]=o(!1),E=s(()=>{b(!0),f()},[f]);t(()=>{c.current&&m.errorMessage&&l(c.current,"shopperLogin")},[m.errorMessage]),t(()=>{h.shopperLogin&&b(!0)},[h.shopperLogin]),t(()=>{j.current.validateInput=E,m.onSetInputHandlers(j.current)},[E,m.onSetInputHandlers]);const M=s(e=>{"Enter"===e.key&&m.onPressEnter()},[m.onPressEnter]);return t(()=>{m.onChange({data:h,valid:L,errors:F,isValid:v})},[h,L,F]),e("div",{ref:c},e(p,{name:"shopperLogin",label:d.get("ctp.login.inputLabel"),errorMessage:I?m.errorMessage||F.shopperLogin&&d.get(F.shopperLogin.errorMessage):null,classNameModifiers:["shopperLogin"],errorLive:!0},e(u,{name:"shopperLogin",autocorrect:"off",spellcheck:!1,value:h.shopperLogin,disabled:m.disabled,onInput:g("shopperLogin","input"),onBlur:g("shopperLogin","blur"),onKeyDown:M,autocomplete:"email"})))};export{m as default};
|
|
2
2
|
//# sourceMappingURL=CtPLoginInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CtPLoginInput.js","sources":["../../../../../../../src/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport { loginValidationRules } from './validate';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { useFormWithA11y } from '../../../../../utils/useForm';\nimport Field from '../../../FormFields/Field';\nimport InputEmail from '../../../FormFields/InputEmail';\nimport { setFocusOnField } from '../../../../../utils/setFocus';\n\ntype OnChangeProps = { data: CtPLoginInputDataState; valid; errors; isValid: boolean };\n\ninterface CtPLoginInputProps {\n disabled: boolean;\n errorMessage?: string;\n onPressEnter(): Promise<void>;\n onChange({ data, valid, errors, isValid }: OnChangeProps): void;\n onSetInputHandlers(handlers: CtPLoginInputHandlers): void;\n}\n\ninterface CtPLoginInputDataState {\n shopperLogin?: string;\n}\n\nexport type CtPLoginInputHandlers = {\n validateInput(): void;\n focusInput(): void;\n};\n\nconst CtPLoginInput = (props: Readonly<CtPLoginInputProps>): h.JSX.Element => {\n const { i18n } = useCoreContext();\n const formSchema = ['shopperLogin'];\n const containerRef = useRef<HTMLDivElement>(null);\n const { handleChangeFor, data, triggerValidation, valid, errors, isValid } = useFormWithA11y<CtPLoginInputDataState>({\n schema: formSchema,\n rules: loginValidationRules,\n formHolder: containerRef\n });\n const loginInputHandlersRef = useRef<CtPLoginInputHandlers>({ validateInput: null, focusInput: null });\n const [isLoginInputDirty, setIsLoginInputDirty] = useState<boolean>(false);\n\n const validateInput = useCallback(() => {\n setIsLoginInputDirty(true);\n triggerValidation();\n }, [triggerValidation]);\n\n useEffect(() => {\n if (containerRef.current && props.errorMessage) {\n setFocusOnField(containerRef.current, 'shopperLogin');\n }\n }, [props.errorMessage]);\n\n useEffect(() => {\n if (data.shopperLogin) setIsLoginInputDirty(true);\n }, [data.shopperLogin]);\n\n useEffect(() => {\n loginInputHandlersRef.current.validateInput = validateInput;\n props.onSetInputHandlers(loginInputHandlersRef.current);\n }, [validateInput, props.onSetInputHandlers]);\n\n const
|
|
1
|
+
{"version":3,"file":"CtPLoginInput.js","sources":["../../../../../../../src/components/internal/ClickToPay/components/CtPLogin/CtPLoginInput.tsx"],"sourcesContent":["import { h, TargetedKeyboardEvent } from 'preact';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport { loginValidationRules } from './validate';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { useFormWithA11y } from '../../../../../utils/useForm';\nimport Field from '../../../FormFields/Field';\nimport InputEmail from '../../../FormFields/InputEmail';\nimport { setFocusOnField } from '../../../../../utils/setFocus';\n\ntype OnChangeProps = { data: CtPLoginInputDataState; valid; errors; isValid: boolean };\n\ninterface CtPLoginInputProps {\n disabled: boolean;\n errorMessage?: string;\n onPressEnter(): Promise<void>;\n onChange({ data, valid, errors, isValid }: OnChangeProps): void;\n onSetInputHandlers(handlers: CtPLoginInputHandlers): void;\n}\n\ninterface CtPLoginInputDataState {\n shopperLogin?: string;\n}\n\nexport type CtPLoginInputHandlers = {\n validateInput(): void;\n focusInput(): void;\n};\n\nconst CtPLoginInput = (props: Readonly<CtPLoginInputProps>): h.JSX.Element => {\n const { i18n } = useCoreContext();\n const formSchema = ['shopperLogin'];\n const containerRef = useRef<HTMLDivElement>(null);\n const { handleChangeFor, data, triggerValidation, valid, errors, isValid } = useFormWithA11y<CtPLoginInputDataState>({\n schema: formSchema,\n rules: loginValidationRules,\n formHolder: containerRef\n });\n const loginInputHandlersRef = useRef<CtPLoginInputHandlers>({ validateInput: null, focusInput: null });\n const [isLoginInputDirty, setIsLoginInputDirty] = useState<boolean>(false);\n\n const validateInput = useCallback(() => {\n setIsLoginInputDirty(true);\n triggerValidation();\n }, [triggerValidation]);\n\n useEffect(() => {\n if (containerRef.current && props.errorMessage) {\n setFocusOnField(containerRef.current, 'shopperLogin');\n }\n }, [props.errorMessage]);\n\n useEffect(() => {\n if (data.shopperLogin) setIsLoginInputDirty(true);\n }, [data.shopperLogin]);\n\n useEffect(() => {\n loginInputHandlersRef.current.validateInput = validateInput;\n props.onSetInputHandlers(loginInputHandlersRef.current);\n }, [validateInput, props.onSetInputHandlers]);\n\n const handleOnKeyDown = useCallback(\n (event: TargetedKeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n void props.onPressEnter();\n }\n },\n [props.onPressEnter]\n );\n\n useEffect(() => {\n props.onChange({ data, valid, errors, isValid });\n }, [data, valid, errors]);\n\n return (\n <div ref={containerRef}>\n <Field\n name=\"shopperLogin\"\n label={i18n.get('ctp.login.inputLabel')}\n errorMessage={isLoginInputDirty ? props.errorMessage || (errors.shopperLogin && i18n.get(errors.shopperLogin.errorMessage)) : null}\n classNameModifiers={['shopperLogin']}\n errorLive={true}\n >\n <InputEmail\n name={'shopperLogin'}\n autocorrect={'off'}\n spellcheck={false}\n value={data.shopperLogin}\n disabled={props.disabled}\n onInput={handleChangeFor('shopperLogin', 'input')}\n onBlur={handleChangeFor('shopperLogin', 'blur')}\n onKeyDown={handleOnKeyDown}\n autocomplete={'email'}\n />\n </Field>\n </div>\n );\n};\n\nexport default CtPLoginInput;\n"],"names":["CtPLoginInput","props","i18n","useCoreContext","containerRef","useRef","handleChangeFor","data","triggerValidation","valid","errors","isValid","useFormWithA11y","schema","rules","loginValidationRules","formHolder","loginInputHandlersRef","validateInput","focusInput","isLoginInputDirty","setIsLoginInputDirty","useState","useCallback","useEffect","current","errorMessage","setFocusOnField","shopperLogin","onSetInputHandlers","handleOnKeyDown","event","key","onPressEnter","onChange","h","div","ref","Field","name","label","get","classNameModifiers","errorLive","InputEmail","autocorrect","spellcheck","value","disabled","onInput","onBlur","onKeyDown","autocomplete"],"mappings":"+iBA4BA,MAAMA,EAAiBC,IACnB,MAAMC,KAAEA,GAASC,IAEXC,EAAeC,EAAuB,OACtCC,gBAAEA,EAAeC,KAAEA,EAAIC,kBAAEA,EAAiBC,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,GAAYC,EAAwC,CACjHC,OAHe,CAAC,gBAIhBC,MAAOC,EACPC,WAAYZ,IAEVa,EAAwBZ,EAA8B,CAAEa,cAAe,KAAMC,WAAY,QACxFC,EAAmBC,GAAwBC,GAAkB,GAE9DJ,EAAgBK,EAAY,KAC9BF,GAAqB,GACrBb,KACD,CAACA,IAEJgB,EAAU,KACFpB,EAAaqB,SAAWxB,EAAMyB,cAC9BC,EAAgBvB,EAAaqB,QAAS,iBAE3C,CAACxB,EAAMyB,eAEVF,EAAU,KACFjB,EAAKqB,cAAcP,GAAqB,IAC7C,CAACd,EAAKqB,eAETJ,EAAU,KACNP,EAAsBQ,QAAQP,cAAgBA,EAC9CjB,EAAM4B,mBAAmBZ,EAAsBQ,UAChD,CAACP,EAAejB,EAAM4B,qBAEzB,MAAMC,EAAkBP,EACnBQ,IACqB,UAAdA,EAAMC,KACD/B,EAAMgC,gBAGnB,CAAChC,EAAMgC,eAOX,OAJAT,EAAU,KACNvB,EAAMiC,SAAS,CAAE3B,OAAME,QAAOC,SAAQC,aACvC,CAACJ,EAAME,EAAOC,IAGbyB,EAACC,MAAAA,CAAIC,IAAKjC,GACN+B,EAACG,EAAAA,CACGC,KAAK,eACLC,MAAOtC,EAAKuC,IAAI,wBAChBf,aAAcN,EAAoBnB,EAAMyB,cAAiBhB,EAAOkB,cAAgB1B,EAAKuC,IAAI/B,EAAOkB,aAAaF,cAAiB,KAC9HgB,mBAAoB,CAAC,gBACrBC,WAAW,GAEXR,EAACS,EAAAA,CACGL,KAAM,eACNM,YAAa,MACbC,YAAY,EACZC,MAAOxC,EAAKqB,aACZoB,SAAU/C,EAAM+C,SAChBC,QAAS3C,EAAgB,eAAgB,SACzC4C,OAAQ5C,EAAgB,eAAgB,QACxC6C,UAAWrB,EACXsB,aAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../../../../external/preact/dist/preact.js";import{useState as r,useRef as t,useCallback as o,useEffect as s}from"../../../../../../external/preact/hooks/dist/hooks.js";import{otpValidationRules as a}from"./validate.js";import n from"./CtPResendOtpLink.js";import l from"../../../context/useClickToPayContext.js";import{useCoreContext as i}from"../../../../../../core/Context/CoreProvider.js";import p from"../../../../../../utils/useForm/useFormWithA11y.js";import{setFocusOnField as u}from"../../../../../../utils/setFocus.js";import c from"../../../../FormFields/Field/Field.js";import d from"../../../../FormFields/InputText.js";import{getErrorMessage as m}from"../../../../../../utils/getErrorMessage.js";const f=f=>{const{i18n:g}=i(),{configuration:{disableOtpAutoFocus:j}}=l(),[C,F]=r(null),h=t(null),{handleChangeFor:v,data:b,triggerValidation:k,valid:x,errors:E,isValid:M,setData:
|
|
1
|
+
import{createElement as e}from"../../../../../../external/preact/dist/preact.js";import{useState as r,useRef as t,useCallback as o,useEffect as s}from"../../../../../../external/preact/hooks/dist/hooks.js";import{otpValidationRules as a}from"./validate.js";import n from"./CtPResendOtpLink.js";import l from"../../../context/useClickToPayContext.js";import{useCoreContext as i}from"../../../../../../core/Context/CoreProvider.js";import p from"../../../../../../utils/useForm/useFormWithA11y.js";import{setFocusOnField as u}from"../../../../../../utils/setFocus.js";import c from"../../../../FormFields/Field/Field.js";import d from"../../../../FormFields/InputText.js";import{getErrorMessage as m}from"../../../../../../utils/getErrorMessage.js";const f=f=>{const{i18n:g}=i(),{configuration:{disableOtpAutoFocus:j}}=l(),[C,F]=r(null),h=t(null),{handleChangeFor:v,data:b,triggerValidation:k,valid:x,errors:E,isValid:M,setData:y}=p({schema:["otp"],rules:a,formHolder:h}),I=t({validateInput:null}),P=t(null),[R,w]=r(!1),L=o(()=>{w(!0),k()},[k]);s(()=>{b.otp&&w(!0)},[b.otp]),s(()=>{!j&&P.current&&P.current.focus()},[P.current,j]),s(()=>{h.current&&f.errorMessage&&u(h.current,"otp")},[f.errorMessage]),s(()=>{I.current.validateInput=L,f.onSetInputHandlers(I.current)},[L,f.onSetInputHandlers]);const V=o(()=>{y("otp",""),F(null),j||P.current.focus(),f.onResendCode()},[f.onResendCode,P.current,j]),_=o(e=>{const r=g.get(`ctp.errors.${e}`);r&&F(r)},[g]),H=o(e=>{"Enter"===e.key&&f.onPressEnter()},[f.onPressEnter]);s(()=>{f.onChange({data:b,valid:x,errors:E,isValid:M})},[b,x,E]);const N=o(()=>R?C||f.errorMessage||m(g,E.otp,g.get("ctp.otp.fieldLabel")):null,[R,C,f.errorMessage,E.otp,g]);return e("div",{ref:h,className:"adyen-checkout-ctp__otp-field-wrapper"},e(c,{name:"oneTimePassword",label:g.get("ctp.otp.fieldLabel"),errorMessage:N(),classNameModifiers:["otp"],errorLive:!0},e(d,{name:"otp",autocorrect:"off",spellcheck:!1,value:b.otp,disabled:f.disabled,onInput:v("otp","input"),onBlur:v("otp","blur"),onKeyDown:H,setRef:e=>{P.current=e},autocomplete:"off"})),e("div",{className:"adyen-checkout-ctp__otp-resend-code-wrapper"},e(n,{disabled:f.isValidatingOtp,onError:_,onResendCode:V})))};export{f as default};
|
|
2
2
|
//# sourceMappingURL=CtPOneTimePasswordInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CtPOneTimePasswordInput.js","sources":["../../../../../../../../src/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport { otpValidationRules } from './validate';\nimport CtPResendOtpLink from './CtPResendOtpLink';\nimport useClickToPayContext from '../../../context/useClickToPayContext';\nimport { useCoreContext } from '../../../../../../core/Context/CoreProvider';\nimport { useFormWithA11y } from '../../../../../../utils/useForm';\nimport { setFocusOnField } from '../../../../../../utils/setFocus';\nimport Field from '../../../../FormFields/Field';\nimport './CtPOneTimePasswordInput.scss';\nimport InputText from '../../../../FormFields/InputText';\nimport { getErrorMessage } from '../../../../../../utils/getErrorMessage';\n\ntype OnChangeProps = { data: CtPOneTimePasswordInputDataState; valid; errors; isValid: boolean };\n\ninterface CtPOneTimePasswordInputProps {\n hideResendOtpButton: boolean;\n disabled: boolean;\n isValidatingOtp: boolean;\n errorMessage?: string;\n onSetInputHandlers(handlers: CtPOneTimePasswordInputHandlers): void;\n onPressEnter(): Promise<void>;\n onChange({ data, valid, errors, isValid }: OnChangeProps): void;\n onResendCode(): void;\n}\n\ninterface CtPOneTimePasswordInputDataState {\n otp?: string;\n}\n\nexport type CtPOneTimePasswordInputHandlers = {\n validateInput(): void;\n};\n\nconst CtPOneTimePasswordInput = (props: Readonly<CtPOneTimePasswordInputProps>): h.JSX.Element => {\n const { i18n } = useCoreContext();\n const {\n configuration: { disableOtpAutoFocus }\n } = useClickToPayContext();\n\n const formSchema = ['otp'];\n const [resendOtpError, setResendOtpError] = useState<string>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const { handleChangeFor, data, triggerValidation, valid, errors, isValid, setData } = useFormWithA11y<CtPOneTimePasswordInputDataState>({\n schema: formSchema,\n rules: otpValidationRules,\n formHolder: containerRef\n });\n const otpInputHandlersRef = useRef<CtPOneTimePasswordInputHandlers>({ validateInput: null });\n const inputRef = useRef<HTMLInputElement>(null);\n const [isOtpFielDirty, setIsOtpFieldDirty] = useState<boolean>(false);\n\n const validateInput = useCallback(() => {\n setIsOtpFieldDirty(true);\n triggerValidation();\n }, [triggerValidation]);\n\n /**\n * If shopper changes the value of the OTP fields, input becomes dirty\n */\n useEffect(() => {\n if (data.otp) setIsOtpFieldDirty(true);\n }, [data.otp]);\n\n useEffect(() => {\n if (!disableOtpAutoFocus && inputRef.current) {\n inputRef.current.focus();\n }\n }, [inputRef.current, disableOtpAutoFocus]);\n\n useEffect(() => {\n if (containerRef.current && props.errorMessage) {\n setFocusOnField(containerRef.current, 'otp');\n }\n }, [props.errorMessage]);\n\n useEffect(() => {\n otpInputHandlersRef.current.validateInput = validateInput;\n props.onSetInputHandlers(otpInputHandlersRef.current);\n }, [validateInput, props.onSetInputHandlers]);\n\n const handleOnResendOtp = useCallback(() => {\n setData('otp', '');\n setResendOtpError(null);\n if (!disableOtpAutoFocus) {\n inputRef.current.focus();\n }\n props.onResendCode();\n }, [props.onResendCode, inputRef.current, disableOtpAutoFocus]);\n\n const handleOnResendOtpError = useCallback(\n (errorCode: string) => {\n const message = i18n.get(`ctp.errors.${errorCode}`);\n if (message) setResendOtpError(message);\n },\n [i18n]\n );\n\n const
|
|
1
|
+
{"version":3,"file":"CtPOneTimePasswordInput.js","sources":["../../../../../../../../src/components/internal/ClickToPay/components/CtPOneTimePassword/CtPOneTimePasswordInput/CtPOneTimePasswordInput.tsx"],"sourcesContent":["import { h, TargetedKeyboardEvent } from 'preact';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport { otpValidationRules } from './validate';\nimport CtPResendOtpLink from './CtPResendOtpLink';\nimport useClickToPayContext from '../../../context/useClickToPayContext';\nimport { useCoreContext } from '../../../../../../core/Context/CoreProvider';\nimport { useFormWithA11y } from '../../../../../../utils/useForm';\nimport { setFocusOnField } from '../../../../../../utils/setFocus';\nimport Field from '../../../../FormFields/Field';\nimport './CtPOneTimePasswordInput.scss';\nimport InputText from '../../../../FormFields/InputText';\nimport { getErrorMessage } from '../../../../../../utils/getErrorMessage';\n\ntype OnChangeProps = { data: CtPOneTimePasswordInputDataState; valid; errors; isValid: boolean };\n\ninterface CtPOneTimePasswordInputProps {\n hideResendOtpButton: boolean;\n disabled: boolean;\n isValidatingOtp: boolean;\n errorMessage?: string;\n onSetInputHandlers(handlers: CtPOneTimePasswordInputHandlers): void;\n onPressEnter(): Promise<void>;\n onChange({ data, valid, errors, isValid }: OnChangeProps): void;\n onResendCode(): void;\n}\n\ninterface CtPOneTimePasswordInputDataState {\n otp?: string;\n}\n\nexport type CtPOneTimePasswordInputHandlers = {\n validateInput(): void;\n};\n\nconst CtPOneTimePasswordInput = (props: Readonly<CtPOneTimePasswordInputProps>): h.JSX.Element => {\n const { i18n } = useCoreContext();\n const {\n configuration: { disableOtpAutoFocus }\n } = useClickToPayContext();\n\n const formSchema = ['otp'];\n const [resendOtpError, setResendOtpError] = useState<string>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const { handleChangeFor, data, triggerValidation, valid, errors, isValid, setData } = useFormWithA11y<CtPOneTimePasswordInputDataState>({\n schema: formSchema,\n rules: otpValidationRules,\n formHolder: containerRef\n });\n const otpInputHandlersRef = useRef<CtPOneTimePasswordInputHandlers>({ validateInput: null });\n const inputRef = useRef<HTMLInputElement>(null);\n const [isOtpFielDirty, setIsOtpFieldDirty] = useState<boolean>(false);\n\n const validateInput = useCallback(() => {\n setIsOtpFieldDirty(true);\n triggerValidation();\n }, [triggerValidation]);\n\n /**\n * If shopper changes the value of the OTP fields, input becomes dirty\n */\n useEffect(() => {\n if (data.otp) setIsOtpFieldDirty(true);\n }, [data.otp]);\n\n useEffect(() => {\n if (!disableOtpAutoFocus && inputRef.current) {\n inputRef.current.focus();\n }\n }, [inputRef.current, disableOtpAutoFocus]);\n\n useEffect(() => {\n if (containerRef.current && props.errorMessage) {\n setFocusOnField(containerRef.current, 'otp');\n }\n }, [props.errorMessage]);\n\n useEffect(() => {\n otpInputHandlersRef.current.validateInput = validateInput;\n props.onSetInputHandlers(otpInputHandlersRef.current);\n }, [validateInput, props.onSetInputHandlers]);\n\n const handleOnResendOtp = useCallback(() => {\n setData('otp', '');\n setResendOtpError(null);\n if (!disableOtpAutoFocus) {\n inputRef.current.focus();\n }\n props.onResendCode();\n }, [props.onResendCode, inputRef.current, disableOtpAutoFocus]);\n\n const handleOnResendOtpError = useCallback(\n (errorCode: string) => {\n const message = i18n.get(`ctp.errors.${errorCode}`);\n if (message) setResendOtpError(message);\n },\n [i18n]\n );\n\n const handleOnKeyDown = useCallback(\n (event: TargetedKeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n void props.onPressEnter();\n }\n },\n [props.onPressEnter]\n );\n\n useEffect(() => {\n props.onChange({ data, valid, errors, isValid });\n }, [data, valid, errors]);\n\n const getOtpErrorMessage = useCallback(() => {\n if (!isOtpFielDirty) return null;\n\n return resendOtpError || props.errorMessage || getErrorMessage(i18n, errors.otp, i18n.get('ctp.otp.fieldLabel'));\n }, [isOtpFielDirty, resendOtpError, props.errorMessage, errors.otp, i18n]);\n\n return (\n <div ref={containerRef} className={'adyen-checkout-ctp__otp-field-wrapper'}>\n <Field\n name=\"oneTimePassword\"\n label={i18n.get('ctp.otp.fieldLabel')}\n errorMessage={getOtpErrorMessage()}\n classNameModifiers={['otp']}\n errorLive={true}\n >\n <InputText\n name={'otp'}\n autocorrect={'off'}\n spellcheck={false}\n value={data.otp}\n disabled={props.disabled}\n onInput={handleChangeFor('otp', 'input')}\n onBlur={handleChangeFor('otp', 'blur')}\n onKeyDown={handleOnKeyDown}\n setRef={(ref: HTMLInputElement) => {\n inputRef.current = ref;\n }}\n autocomplete={'off'}\n />\n </Field>\n <div className={'adyen-checkout-ctp__otp-resend-code-wrapper'}>\n <CtPResendOtpLink disabled={props.isValidatingOtp} onError={handleOnResendOtpError} onResendCode={handleOnResendOtp} />\n </div>\n </div>\n );\n};\n\nexport default CtPOneTimePasswordInput;\n"],"names":["CtPOneTimePasswordInput","props","i18n","useCoreContext","configuration","disableOtpAutoFocus","useClickToPayContext","resendOtpError","setResendOtpError","useState","containerRef","useRef","handleChangeFor","data","triggerValidation","valid","errors","isValid","setData","useFormWithA11y","schema","rules","otpValidationRules","formHolder","otpInputHandlersRef","validateInput","inputRef","isOtpFielDirty","setIsOtpFieldDirty","useCallback","useEffect","otp","current","focus","errorMessage","setFocusOnField","onSetInputHandlers","handleOnResendOtp","onResendCode","handleOnResendOtpError","errorCode","message","get","handleOnKeyDown","event","key","onPressEnter","onChange","getOtpErrorMessage","getErrorMessage","h","div","ref","className","Field","name","label","classNameModifiers","errorLive","InputText","autocorrect","spellcheck","value","disabled","onInput","onBlur","onKeyDown","setRef","autocomplete","CtPResendOtpLink","isValidatingOtp","onError"],"mappings":"2uBAkCA,MAAMA,EAA2BC,IAC7B,MAAMC,KAAEA,GAASC,KAEbC,eAAeC,oBAAEA,IACjBC,KAGGC,EAAgBC,GAAqBC,EAAiB,MACvDC,EAAeC,EAAuB,OACtCC,gBAAEA,EAAeC,KAAEA,EAAIC,kBAAEA,EAAiBC,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,EAAOC,QAAEA,GAAYC,EAAkD,CACpIC,OAJe,CAAC,OAKhBC,MAAOC,EACPC,WAAYb,IAEVc,EAAsBb,EAAwC,CAAEc,cAAe,OAC/EC,EAAWf,EAAyB,OACnCgB,EAAgBC,GAAsBnB,GAAkB,GAEzDgB,EAAgBI,EAAY,KAC9BD,GAAmB,GACnBd,KACD,CAACA,IAKJgB,EAAU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C,SAAU9D,EAAM8D,SAChBC,QAASpD,EAAgB,MAAO,SAChCqD,OAAQrD,EAAgB,MAAO,QAC/BsD,UAAWvB,EACXwB,OAASf,IACL1B,EAASM,QAAUoB,GAEvBgB,aAAc,SAGtBlB,EAACC,MAAAA,CAAIE,UAAW,+CACZH,EAACmB,EAAAA,CAAiBN,SAAU9D,EAAMqE,gBAAiBC,QAAShC,EAAwBD,aAAcD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../../../external/preact/dist/preact.js";import t from"../../../../../_virtual/index.js";import n from"./CtPLogoutLink.js";import{CtPBrand as c}from"../CtPBrand/CtPBrand.js";import
|
|
1
|
+
import{createElement as e}from"../../../../../external/preact/dist/preact.js";import t from"../../../../../_virtual/index.js";import n from"./CtPLogoutLink.js";import{CtPBrand as c}from"../CtPBrand/CtPBrand.js";import o from"../../context/useClickToPayContext.js";const a=({children:a,onEnterKeyPress:s})=>{const{isStandaloneComponent:r}=o();return e("div",{className:t("adyen-checkout-ctp__section",{"adyen-checkout-ctp__section--standalone":r}),onKeyDown:s},e("div",{className:"adyen-checkout-ctp__section-brand"},e(c,null),e(n,null)),a)};a.Title=({endAdornment:t,children:n})=>e("div",{className:"adyen-checkout-ctp__section-header"},e("h1",{className:"adyen-checkout-ctp__section-header-title"},n),t&&e("span",{className:"adyen-checkout-ctp__section-header-adornment"},t)),a.Text=({children:t})=>e("p",{className:"adyen-checkout-ctp__section-text"},t);export{a as default};
|
|
2
2
|
//# sourceMappingURL=CtPSection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CtPSection.js","sources":["../../../../../../../src/components/internal/ClickToPay/components/CtPSection/CtPSection.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classnames from 'classnames';\nimport CtPLogoutLink from './CtPLogoutLink';\nimport { CtPBrand } from '../CtPBrand';\nimport useClickToPayContext from '../../context/useClickToPayContext';\nimport './CtPSection.scss';\n\ninterface CtPSectionProps {\n onEnterKeyPress: (event:
|
|
1
|
+
{"version":3,"file":"CtPSection.js","sources":["../../../../../../../src/components/internal/ClickToPay/components/CtPSection/CtPSection.tsx"],"sourcesContent":["import { h, TargetedKeyboardEvent } from 'preact';\nimport classnames from 'classnames';\nimport CtPLogoutLink from './CtPLogoutLink';\nimport { CtPBrand } from '../CtPBrand';\nimport useClickToPayContext from '../../context/useClickToPayContext';\nimport './CtPSection.scss';\n\ninterface CtPSectionProps {\n onEnterKeyPress: (event: TargetedKeyboardEvent<HTMLInputElement>) => void;\n children?: h.JSX.Element[];\n}\n\nconst CtPSection = ({ children, onEnterKeyPress }: Readonly<CtPSectionProps>): h.JSX.Element => {\n const { isStandaloneComponent } = useClickToPayContext();\n\n return (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div\n className={classnames('adyen-checkout-ctp__section', { 'adyen-checkout-ctp__section--standalone': isStandaloneComponent })}\n onKeyDown={onEnterKeyPress}\n >\n <div className=\"adyen-checkout-ctp__section-brand\">\n <CtPBrand />\n <CtPLogoutLink />\n </div>\n\n {children}\n </div>\n );\n};\n\nconst Title = ({ endAdornment, children }: Readonly<{ endAdornment?; children }>) => (\n <div className=\"adyen-checkout-ctp__section-header\">\n <h1 className=\"adyen-checkout-ctp__section-header-title\">{children}</h1>\n {endAdornment && <span className=\"adyen-checkout-ctp__section-header-adornment\">{endAdornment}</span>}\n </div>\n);\nconst Text = ({ children }: Readonly<{ children }>) => <p className=\"adyen-checkout-ctp__section-text\">{children}</p>;\n\nCtPSection.Title = Title;\nCtPSection.Text = Text;\n\nexport default CtPSection;\n"],"names":["CtPSection","children","onEnterKeyPress","isStandaloneComponent","useClickToPayContext","h","div","className","classnames","onKeyDown","CtPBrand","CtPLogoutLink","Title","endAdornment","h1","span","Text","p"],"mappings":"wQAYA,MAAMA,EAAa,EAAGC,WAAUC,sBAC5B,MAAMC,sBAAEA,GAA0BC,IAElC,OAEIC,EAACC,MAAAA,CACGC,UAAWC,EAAW,8BAA+B,CAAE,0CAA2CL,IAClGM,UAAWP,GAEXG,EAACC,MAAAA,CAAIC,UAAU,qCACXF,EAACK,EAAAA,MACDL,EAACM,EAAAA,OAGJV,IAabD,EAAWY,MARG,EAAGC,eAAcZ,cAC3BI,EAACC,MAAAA,CAAIC,UAAU,sCACXF,EAACS,KAAAA,CAAGP,UAAU,4CAA4CN,GACzDY,GAAgBR,EAACU,OAAAA,CAAKR,UAAU,gDAAgDM,IAMzFb,EAAWgB,KAHE,EAAGf,cAAuCI,EAACY,IAAAA,CAAEV,UAAU,oCAAoCN"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../external/preact/dist/preact.js";import{useCallback as o}from"../../../external/preact/hooks/dist/hooks.js";import n from"../../../_virtual/index.js";import{ARIA_ERROR_SUFFIX as
|
|
1
|
+
import{createElement as e}from"../../../external/preact/dist/preact.js";import{useCallback as o}from"../../../external/preact/hooks/dist/hooks.js";import n from"../../../_virtual/index.js";import{ARIA_ERROR_SUFFIX as a,ARIA_CONTEXT_SUFFIX as r}from"../../../core/Errors/constants.js";function t({setRef:t,...l}){const{autoCorrect:i,classNameModifiers:s,isInvalid:u,isValid:d,readonly:c=null,spellcheck:p,type:m,uniqueId:y,disabled:f}=l,h=l.className;Object.prototype.hasOwnProperty.call(l,"onChange")&&console.error("Error: Form fields that rely on InputBase may not have an onChange property");const _=o(e=>{l.onInput(e)},[l.onInput]),k=o(e=>{l?.onKeyDown&&l.onKeyDown(e)},[l?.onKeyDown]),v=o(e=>{l?.onBlurHandler?.(e),l.trimOnBlur&&(e.target.value=e.target.value.trim()),l?.onBlur?.(e)},[l.onBlur,l.onBlurHandler]),b=o(e=>{l?.onFocusHandler?.(e)},[l.onFocusHandler]),B=n("adyen-checkout__input",[`adyen-checkout__input--${m}`],h,{"adyen-checkout__input--invalid":u,"adyen-checkout__input--valid":d},s.map(e=>`adyen-checkout__input--${e}`)),{classNameModifiers:I,uniqueId:j,isInvalid:x,isValid:C,addContextualElement:g,"aria-describedby":w,autocomplete:N,...q}=l,D=["string"==typeof w&&w?w:null,y?`${y}${u?a:r}`:null].filter(Boolean).join(" ")||null;return e("input",{id:y,...q,autocomplete:N,"aria-required":q.required,type:m,className:B,readOnly:c,spellcheck:p,autoCorrect:i,"aria-describedby":D,"aria-invalid":u,onInput:_,onBlur:v,onFocus:b,onKeyDown:k,disabled:f,ref:t})}t.defaultProps={type:"text",classNameModifiers:[]};export{t as default};
|
|
2
2
|
//# sourceMappingURL=InputBase.js.map
|