@adyen/adyen-web 6.31.0 → 6.31.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/index.cjs +2 -2
  3. package/dist/cjs/index.cjs.map +1 -1
  4. package/dist/cjs/index.d.cts +88 -73
  5. package/dist/es/components/Card/components/CardInput/CardInput.js.map +1 -1
  6. package/dist/es/components/Card/components/CardInput/handlers.js +1 -1
  7. package/dist/es/components/Card/components/CardInput/handlers.js.map +1 -1
  8. package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
  9. package/dist/es/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -1
  10. package/dist/es/components/Giftcard/components/GiftcardComponent.js +1 -1
  11. package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  12. package/dist/es/components/Giftcard/components/useSRPanelForGiftcardErrors.js +1 -1
  13. package/dist/es/components/Giftcard/components/useSRPanelForGiftcardErrors.js.map +1 -1
  14. package/dist/es/components/ThreeDS2/ThreeDS2Challenge.js +1 -1
  15. package/dist/es/components/ThreeDS2/ThreeDS2Challenge.js.map +1 -1
  16. package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js +1 -1
  17. package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  18. package/dist/es/components/ThreeDS2/callSubmit3DS2Fingerprint.js +1 -1
  19. package/dist/es/components/ThreeDS2/callSubmit3DS2Fingerprint.js.map +1 -1
  20. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  21. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  22. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js +1 -1
  23. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
  24. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  25. package/dist/es/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  26. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/userAgent.js +1 -1
  27. package/dist/es/components/internal/SecuredFields/lib/CSF/utils/userAgent.js.map +1 -1
  28. package/dist/es/components/internal/SecuredFields/lib/constants.js +1 -1
  29. package/dist/es/components/internal/SecuredFields/lib/constants.js.map +1 -1
  30. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  31. package/dist/es/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  32. package/dist/es/core/Analytics/events/AnalyticsErrorEvent.js +1 -1
  33. package/dist/es/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
  34. package/dist/es/core/config.js +1 -1
  35. package/dist/es/index.d.ts +88 -73
  36. package/dist/es/utils/setFocus.js +1 -1
  37. package/dist/es/utils/setFocus.js.map +1 -1
  38. package/dist/es/utils/windowScrollTo.js +2 -0
  39. package/dist/es/utils/windowScrollTo.js.map +1 -0
  40. package/dist/es-legacy/components/Card/components/CardInput/CardInput.js.map +1 -1
  41. package/dist/es-legacy/components/Card/components/CardInput/handlers.js +1 -1
  42. package/dist/es-legacy/components/Card/components/CardInput/handlers.js.map +1 -1
  43. package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
  44. package/dist/es-legacy/components/Card/components/CardInput/useSRPanelForCardInputErrors.js.map +1 -1
  45. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js +1 -1
  46. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  47. package/dist/es-legacy/components/Giftcard/components/useSRPanelForGiftcardErrors.js +1 -1
  48. package/dist/es-legacy/components/Giftcard/components/useSRPanelForGiftcardErrors.js.map +1 -1
  49. package/dist/es-legacy/components/ThreeDS2/ThreeDS2Challenge.js +1 -1
  50. package/dist/es-legacy/components/ThreeDS2/ThreeDS2Challenge.js.map +1 -1
  51. package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js +1 -1
  52. package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  53. package/dist/es-legacy/components/ThreeDS2/callSubmit3DS2Fingerprint.js +1 -1
  54. package/dist/es-legacy/components/ThreeDS2/callSubmit3DS2Fingerprint.js.map +1 -1
  55. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  56. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  57. package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js +1 -1
  58. package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
  59. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js +1 -1
  60. package/dist/es-legacy/components/internal/SecuredFields/SFP/SecuredFieldsProvider.js.map +1 -1
  61. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/userAgent.js +1 -1
  62. package/dist/es-legacy/components/internal/SecuredFields/lib/CSF/utils/userAgent.js.map +1 -1
  63. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js +1 -1
  64. package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js.map +1 -1
  65. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js +1 -1
  66. package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/SecuredField.js.map +1 -1
  67. package/dist/es-legacy/core/Analytics/events/AnalyticsErrorEvent.js +1 -1
  68. package/dist/es-legacy/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
  69. package/dist/es-legacy/core/config.js +1 -1
  70. package/dist/es-legacy/utils/setFocus.js +1 -1
  71. package/dist/es-legacy/utils/setFocus.js.map +1 -1
  72. package/dist/es-legacy/utils/windowScrollTo.js +2 -0
  73. package/dist/es-legacy/utils/windowScrollTo.js.map +1 -0
  74. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"GiftcardComponent.js","sources":["../../../../../src/components/Giftcard/components/GiftcardComponent.tsx"],"sourcesContent":["import { Component, FunctionComponent, h } from 'preact';\nimport SecuredFieldsProvider from '../../internal/SecuredFields/SFP/SecuredFieldsProvider';\nimport Alert from '../../internal/Alert';\nimport GiftcardResult from './GiftcardResult';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { GIFT_CARD } from '../../internal/SecuredFields/lib/constants';\nimport { GiftCardFields } from './GiftcardFields';\nimport { GiftcardFieldsProps, Placeholders } from './types';\nimport { useSRPanelForGiftcardErrors } from './useSRPanelForGiftcardErrors';\nimport { GiftCardBalanceCheckErrorType } from '../types';\nimport { PayButtonProps } from '../../internal/PayButton/PayButton';\nimport { useAmount } from '../../../core/Context/AmountProvider';\nimport type { AbstractAnalyticsEvent } from '../../../core/Analytics/events/AbstractAnalyticsEvent';\n\ninterface GiftcardComponentProps {\n onChange: (state) => void;\n onFocus: (event) => void;\n onBlur: (event) => void;\n makeBalanceCheck: (event) => void;\n makePayment: (event) => void;\n showPayButton: boolean;\n payButton: (props: PayButtonProps) => h.JSX.Element;\n pinRequired: boolean;\n expiryDateRequired?: boolean;\n fieldsLayoutComponent: FunctionComponent<GiftcardFieldsProps>;\n placeholders?: Placeholders;\n handleKeyPress?: (o: KeyboardEvent) => void;\n onSubmitAnalytics?: (event: AbstractAnalyticsEvent) => void;\n}\n\nclass Giftcard extends Component<GiftcardComponentProps> {\n public state = {\n status: 'ready',\n data: {},\n balance: null,\n transactionLimit: null,\n focusedElement: false,\n isValid: false,\n sfpState: {},\n isValidating: false,\n transformedErrors: {}\n };\n\n public static defaultProps = {\n pinRequired: true,\n expiryDateRequired: false,\n onChange: () => {},\n onFocus: () => {},\n onBlur: () => {},\n fieldsLayoutComponent: GiftCardFields\n };\n\n public sfp: SecuredFieldsProvider;\n\n /**\n * Maps string error codes from SecuredFields to validation rule objects\n */\n public mapErrorsToValidationObjects = () => {\n // Use the sfp reference to call mapErrorsToValidationRuleResult\n if (!this.sfp) return {};\n return this.sfp.mapErrorsToValidationRuleResult();\n };\n\n private updateTransformedErrors = (balanceCheckErrors?: Record<string, any>) => {\n const transformedErrors = this.mapErrorsToValidationObjects();\n\n const mergedErrors = { ...transformedErrors, ...balanceCheckErrors };\n\n this.setState({ transformedErrors: mergedErrors });\n };\n\n public onChange = sfpState => {\n this.setState({ sfpState }, () => this.updateTransformedErrors());\n\n this.props.onChange({\n data: sfpState.data,\n isValid: sfpState.isSfpValid\n });\n };\n\n public handleFocus = e => {\n this.setState({ focusedElement: e.currentFocusObject });\n\n const isFocused = e.focus === true;\n if (isFocused) {\n this.props.onFocus(e);\n } else {\n this.props.onBlur(e);\n }\n };\n\n public setBalance = ({ balance, transactionLimit }) => {\n this.setState({ balance, transactionLimit });\n };\n\n /**\n * Generates balance check errors in the same format as SFP errors\n * Compatible with the transformedErrors structure\n */\n private generateBalanceCheckErrors(errorType?: GiftCardBalanceCheckErrorType | null): Record<string, any> {\n const balanceCheckErrors: Record<string, any> = {};\n\n // This is the field that the error is associated with, only used for SR logic\n const fieldToAnnounce = 'encryptedCardNumber';\n\n // If errorType is null, clear errors\n if (errorType === null) {\n return balanceCheckErrors;\n }\n\n // Create error in the same format as SFP errors for consistency\n balanceCheckErrors[fieldToAnnounce] = {\n isValid: false,\n errorMessage: `error.giftcard.${errorType}`,\n error: errorType\n };\n\n return balanceCheckErrors;\n }\n\n /**\n * Checks if a status represents a balance check error\n */\n private isBalanceCheckError(status: string): boolean {\n return ['no-balance', 'card-error', 'currency-error'].includes(status);\n }\n\n /**\n * Method called by GiftcardElement to set balance check errors only\n */\n public setBalanceCheckErrors = (errorType: GiftCardBalanceCheckErrorType | null): void => {\n // Check if the errors should be displayed\n if (this.isBalanceCheckError(errorType)) {\n // Generate balance check errors in the style of useForm\n // This is usefull because then we can use the same logic for SF and balance check errors\n // Also we can use the same logic for SRPanel errors\n const balanceCheckErrors = this.generateBalanceCheckErrors(errorType);\n this.updateTransformedErrors(balanceCheckErrors);\n }\n };\n\n public showValidation = () => {\n this.setState({ isValidating: true });\n\n // Validate SecuredFields\n this.sfp?.showValidation();\n };\n\n render(props, { focusedElement, balance, transactionLimit, isValidating, transformedErrors }) {\n const { i18n } = useCoreContext();\n const { amount } = useAmount();\n\n // Handle SRPanel errors in render with transformed error objects\n useSRPanelForGiftcardErrors({\n errors: transformedErrors,\n isValidating,\n sfp: this.sfp\n });\n\n const transactionAmount = transactionLimit?.value < balance?.value ? transactionLimit : balance;\n const hasEnoughBalance = transactionAmount?.value >= amount?.value;\n\n if (transactionAmount && hasEnoughBalance) {\n return (\n <GiftcardResult\n balance={balance}\n transactionLimit={transactionLimit}\n makePayment={props.makePayment}\n status={this.state.status}\n makeBalanceCheck={props.makeBalanceCheck}\n showPayButton={this.props.showPayButton}\n payButton={this.props.payButton}\n />\n );\n }\n\n const getCardErrorMessage = sfpState => {\n if (sfpState.errors.encryptedCardNumber) return i18n.get(sfpState.errors.encryptedCardNumber);\n\n // This logic is a bit of a hack, but it's the only way to get the error message for balance check errors\n // In the future we should move this logic to useForm\n if (transformedErrors.encryptedCardNumber) {\n return i18n.get(transformedErrors.encryptedCardNumber.errorMessage);\n }\n\n return null;\n };\n\n return (\n <div className=\"adyen-checkout__giftcard\">\n {this.state.status === 'error' && <Alert icon={'cross'}>{i18n.get('error.message.unknown')}</Alert>}\n\n <SecuredFieldsProvider\n {...this.props}\n ref={ref => {\n this.sfp = ref;\n }}\n onChange={this.onChange}\n onFocus={this.handleFocus}\n onSubmitAnalytics={props.onSubmitAnalytics}\n type={GIFT_CARD}\n componentType={props.type}\n render={({ setRootNode, setFocusOn }, sfpState) =>\n this.props.fieldsLayoutComponent({\n i18n: i18n,\n pinRequired: this.props.pinRequired,\n focusedElement: focusedElement,\n getCardErrorMessage: getCardErrorMessage,\n setRootNode: setRootNode,\n setFocusOn: setFocusOn,\n sfpState: sfpState\n })\n }\n />\n\n {this.props.showPayButton &&\n this.props.payButton({\n status: this.state.status,\n onClick: this.props.makeBalanceCheck,\n label: i18n.get('applyGiftcard')\n })}\n </div>\n );\n }\n}\n\nexport default Giftcard;\n"],"names":["Giftcard","Component","generateBalanceCheckErrors","errorType","balanceCheckErrors","isValid","errorMessage","error","isBalanceCheckError","status","includes","render","props","focusedElement","balance","transactionLimit","isValidating","transformedErrors","i18n","useCoreContext","amount","useAmount","useSRPanelForGiftcardErrors","errors","sfp","this","transactionAmount","value","h","GiftcardResult","makePayment","state","makeBalanceCheck","showPayButton","payButton","getCardErrorMessage","sfpState","encryptedCardNumber","get","div","className","Alert","icon","SecuredFieldsProvider","ref","onChange","onFocus","handleFocus","onSubmitAnalytics","type","GIFT_CARD","componentType","setRootNode","setFocusOn","fieldsLayoutComponent","pinRequired","onClick","label","super","args","_define_property","data","mapErrorsToValidationObjects","mapErrorsToValidationRuleResult","updateTransformedErrors","mergedErrors","setState","isSfpValid","e","currentFocusObject","focus","onBlur","setBalance","setBalanceCheckErrors","showValidation","defaultProps","expiryDateRequired","GiftCardFields"],"mappings":"isBA8BA,MAAMA,UAAiBC,EAqEXC,0BAAAA,CAA2BC,GAC/B,MAAMC,EAA0C,CAAA,EAMhD,OAAkB,OAAdD,IAKJC,sBAAsC,CAClCC,SAAS,EACTC,aAAc,kBAAkBH,IAChCI,MAAOJ,IAPAC,CAWf,CAKQI,mBAAAA,CAAoBC,GACxB,MAAO,CAAC,aAAc,aAAc,kBAAkBC,SAASD,EACnE,CAuBAE,MAAAA,CAAOC,GAAOC,eAAEA,EAAcC,QAAEA,EAAOC,iBAAEA,EAAgBC,aAAEA,EAAYC,kBAAEA,IACrE,MAAMC,KAAEA,GAASC,KACXC,OAAEA,GAAWC,IAGnBC,EAA4B,CACxBC,OAAQN,EACRD,eACAQ,IAAKC,KAAKD,MAGd,MAAME,EAAoBX,GAAkBY,MAAQb,GAASa,MAAQZ,EAAmBD,EAGxF,GAAIY,GAFqBA,GAAmBC,OAASP,GAAQO,MAGzD,OACIC,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AOE,+BAA+B,IAE7BrC,KAAKD,IACHC,KAAKD,IAAIuC,kCADM,CAAA,GAI1BH,EAAAnC,KAAQuC,0BAA2B5D,IAC/B,MAEM6D,EAAe,IAFKxC,KAAKqC,kCAEiB1D,GAEhDqB,KAAKyC,SAAS,CAAEjD,kBAAmBgD,MAGvCL,EAAAnC,KAAOoB,WAAWT,IACdX,KAAKyC,SAAS,CAAE9B,YAAY,IAAMX,KAAKuC,2BAEvCvC,KAAKb,MAAMiC,SAAS,CAChBgB,KAAMzB,EAASyB,KACfxD,QAAS+B,EAAS+B,eAI1BP,EAAAnC,KAAOsB,cAAcqB,IACjB3C,KAAKyC,SAAS,CAAErD,eAAgBuD,EAAEC,sBAEJ,IAAZD,EAAEE,MAEhB7C,KAAKb,MAAMkC,QAAQsB,GAEnB3C,KAAKb,MAAM2D,OAAOH,KAI1BR,OAAOY,aAAa,EAAG1D,UAASC,uBAC5BU,KAAKyC,SAAS,CAAEpD,UAASC,uBAsC7B6C,EAAAnC,KAAOgD,wBAAyBtE,IAE5B,GAAIsB,KAAKjB,oBAAoBL,GAAY,CAIrC,MAAMC,EAAqBqB,KAAKvB,2BAA2BC,GAC3DsB,KAAKuC,wBAAwB5D,EACjC,IAGJwD,OAAOc,iBAAiB,KACpBjD,KAAKyC,SAAS,CAAElD,cAAc,IAG9BS,KAAKD,KAAKkD,oBAtGdd,EAbE5D,EAaY2E,eAAe,CACzBpB,aAAa,EACbqB,oBAAoB,EACpB/B,SAAU,OACVC,QAAS,OACTyB,OAAQ,OACRjB,sBAAuBuB"}
1
+ {"version":3,"file":"GiftcardComponent.js","sources":["../../../../../src/components/Giftcard/components/GiftcardComponent.tsx"],"sourcesContent":["import { Component, FunctionComponent, h } from 'preact';\nimport SecuredFieldsProvider from '../../internal/SecuredFields/SFP/SecuredFieldsProvider';\nimport Alert from '../../internal/Alert';\nimport GiftcardResult from './GiftcardResult';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { GIFT_CARD } from '../../internal/SecuredFields/lib/constants';\nimport { GiftCardFields } from './GiftcardFields';\nimport { GiftcardFieldsProps, Placeholders } from './types';\nimport { useSRPanelForGiftcardErrors } from './useSRPanelForGiftcardErrors';\nimport { GiftCardBalanceCheckErrorType } from '../types';\nimport { PayButtonProps } from '../../internal/PayButton/PayButton';\nimport { useAmount } from '../../../core/Context/AmountProvider';\nimport type { AbstractAnalyticsEvent } from '../../../core/Analytics/events/AbstractAnalyticsEvent';\n\ninterface GiftcardComponentProps {\n onChange: (state) => void;\n onFocus: (event) => void;\n onBlur: (event) => void;\n makeBalanceCheck: (event) => void;\n makePayment: (event) => void;\n showPayButton: boolean;\n payButton: (props: PayButtonProps) => h.JSX.Element;\n pinRequired: boolean;\n expiryDateRequired?: boolean;\n fieldsLayoutComponent: FunctionComponent<GiftcardFieldsProps>;\n placeholders?: Placeholders;\n handleKeyPress?: (o: KeyboardEvent) => void;\n onSubmitAnalytics?: (event: AbstractAnalyticsEvent) => void;\n}\n\nclass Giftcard extends Component<GiftcardComponentProps> {\n public state = {\n status: 'ready',\n data: {},\n balance: null,\n transactionLimit: null,\n focusedElement: false,\n isValid: false,\n sfpState: {},\n isValidating: false,\n transformedErrors: {}\n };\n\n public static defaultProps = {\n pinRequired: true,\n expiryDateRequired: false,\n onChange: () => {},\n onFocus: () => {},\n onBlur: () => {},\n fieldsLayoutComponent: GiftCardFields\n };\n\n public sfp: SecuredFieldsProvider;\n\n /**\n * Maps string error codes from SecuredFields to validation rule objects\n */\n public mapErrorsToValidationObjects = () => {\n // Use the sfp reference to call mapErrorsToValidationRuleResult\n if (!this.sfp) return {};\n return this.sfp.mapErrorsToValidationRuleResult();\n };\n\n private updateTransformedErrors = (balanceCheckErrors?: Record<string, any>) => {\n const transformedErrors = this.mapErrorsToValidationObjects();\n\n const mergedErrors = { ...transformedErrors, ...balanceCheckErrors };\n\n this.setState({ transformedErrors: mergedErrors });\n };\n\n public onChange = sfpState => {\n this.setState({ sfpState }, () => this.updateTransformedErrors());\n\n this.props.onChange({\n data: sfpState.data,\n isValid: sfpState.isSfpValid\n });\n };\n\n public handleFocus = e => {\n this.setState({ focusedElement: e.currentFocusObject });\n\n const isFocused = e.focus === true;\n if (isFocused) {\n this.props.onFocus(e);\n } else {\n this.props.onBlur(e);\n }\n };\n\n public setBalance = ({ balance, transactionLimit }) => {\n this.setState({ balance, transactionLimit });\n };\n\n /**\n * Generates balance check errors in the same format as SFP errors\n * Compatible with the transformedErrors structure\n */\n private generateBalanceCheckErrors(errorType?: GiftCardBalanceCheckErrorType | null): Record<string, any> {\n const balanceCheckErrors: Record<string, any> = {};\n\n // This is the field that the error is associated with, only used for SR logic\n const fieldToAnnounce = 'encryptedCardNumber';\n\n // If errorType is null, clear errors\n if (errorType === null) {\n return balanceCheckErrors;\n }\n\n // Create error in the same format as SFP errors for consistency\n balanceCheckErrors[fieldToAnnounce] = {\n isValid: false,\n errorMessage: `error.giftcard.${errorType}`,\n error: errorType\n };\n\n return balanceCheckErrors;\n }\n\n /**\n * Checks if a status represents a balance check error\n */\n private isBalanceCheckError(status: string): boolean {\n return ['no-balance', 'card-error', 'currency-error'].includes(status);\n }\n\n /**\n * Method called by GiftcardElement to set balance check errors only\n */\n public setBalanceCheckErrors = (errorType: GiftCardBalanceCheckErrorType | null): void => {\n // Check if the errors should be displayed\n if (this.isBalanceCheckError(errorType)) {\n // Generate balance check errors in the style of useForm\n // This is usefull because then we can use the same logic for SF and balance check errors\n // Also we can use the same logic for SRPanel errors\n const balanceCheckErrors = this.generateBalanceCheckErrors(errorType);\n this.updateTransformedErrors(balanceCheckErrors);\n }\n };\n\n public showValidation = () => {\n this.setState({ isValidating: true });\n\n // Validate SecuredFields\n this.sfp?.showValidation();\n };\n\n public setIsValidating = (val: boolean) => {\n this.setState({ isValidating: val });\n };\n\n render(props, { focusedElement, balance, transactionLimit, isValidating, transformedErrors }) {\n const { i18n } = useCoreContext();\n const { amount } = useAmount();\n\n // Handle SRPanel errors in render with transformed error objects\n useSRPanelForGiftcardErrors({\n errors: transformedErrors,\n isValidating,\n setIsValidating: this.setIsValidating,\n sfp: this.sfp\n });\n\n const transactionAmount = transactionLimit?.value < balance?.value ? transactionLimit : balance;\n const hasEnoughBalance = transactionAmount?.value >= amount?.value;\n\n if (transactionAmount && hasEnoughBalance) {\n return (\n <GiftcardResult\n balance={balance}\n transactionLimit={transactionLimit}\n makePayment={props.makePayment}\n status={this.state.status}\n makeBalanceCheck={props.makeBalanceCheck}\n showPayButton={this.props.showPayButton}\n payButton={this.props.payButton}\n />\n );\n }\n\n const getCardErrorMessage = sfpState => {\n if (sfpState.errors.encryptedCardNumber) return i18n.get(sfpState.errors.encryptedCardNumber);\n\n // This logic is a bit of a hack, but it's the only way to get the error message for balance check errors\n // In the future we should move this logic to useForm\n if (transformedErrors.encryptedCardNumber) {\n return i18n.get(transformedErrors.encryptedCardNumber.errorMessage);\n }\n\n return null;\n };\n\n return (\n <div className=\"adyen-checkout__giftcard\">\n {this.state.status === 'error' && <Alert icon={'cross'}>{i18n.get('error.message.unknown')}</Alert>}\n\n <SecuredFieldsProvider\n {...this.props}\n ref={ref => {\n this.sfp = ref;\n }}\n onChange={this.onChange}\n onFocus={this.handleFocus}\n onSubmitAnalytics={props.onSubmitAnalytics}\n type={GIFT_CARD}\n componentType={props.type}\n render={({ setRootNode, setFocusOn }, sfpState) =>\n this.props.fieldsLayoutComponent({\n i18n: i18n,\n pinRequired: this.props.pinRequired,\n focusedElement: focusedElement,\n getCardErrorMessage: getCardErrorMessage,\n setRootNode: setRootNode,\n setFocusOn: setFocusOn,\n sfpState: sfpState\n })\n }\n />\n\n {this.props.showPayButton &&\n this.props.payButton({\n status: this.state.status,\n onClick: this.props.makeBalanceCheck,\n label: i18n.get('applyGiftcard')\n })}\n </div>\n );\n }\n}\n\nexport default Giftcard;\n"],"names":["Giftcard","Component","generateBalanceCheckErrors","errorType","balanceCheckErrors","isValid","errorMessage","error","isBalanceCheckError","status","includes","render","props","focusedElement","balance","transactionLimit","isValidating","transformedErrors","i18n","useCoreContext","amount","useAmount","useSRPanelForGiftcardErrors","errors","setIsValidating","this","sfp","transactionAmount","value","h","GiftcardResult","makePayment","state","makeBalanceCheck","showPayButton","payButton","getCardErrorMessage","sfpState","encryptedCardNumber","get","div","className","Alert","icon","SecuredFieldsProvider","ref","onChange","onFocus","handleFocus","onSubmitAnalytics","type","GIFT_CARD","componentType","setRootNode","setFocusOn","fieldsLayoutComponent","pinRequired","onClick","label","super","args","_define_property","data","mapErrorsToValidationObjects","mapErrorsToValidationRuleResult","updateTransformedErrors","mergedErrors","setState","isSfpValid","e","currentFocusObject","focus","onBlur","setBalance","setBalanceCheckErrors","showValidation","val","defaultProps","expiryDateRequired","GiftCardFields"],"mappings":"isBA8BA,MAAMA,UAAiBC,EAqEXC,0BAAAA,CAA2BC,GAC/B,MAAMC,EAA0C,CAAA,EAMhD,OAAkB,OAAdD,IAKJC,sBAAsC,CAClCC,SAAS,EACTC,aAAc,kBAAkBH,IAChCI,MAAOJ,IAPAC,CAWf,CAKQI,mBAAAA,CAAoBC,GACxB,MAAO,CAAC,aAAc,aAAc,kBAAkBC,SAASD,EACnE,CA2BAE,MAAAA,CAAOC,GAAOC,eAAEA,EAAcC,QAAEA,EAAOC,iBAAEA,EAAgBC,aAAEA,EAAYC,kBAAEA,IACrE,MAAMC,KAAEA,GAASC,KACXC,OAAEA,GAAWC,IAGnBC,EAA4B,CACxBC,OAAQN,EACRD,eACAQ,gBAAiBC,KAAKD,gBACtBE,IAAKD,KAAKC,MAGd,MAAMC,EAAoBZ,GAAkBa,MAAQd,GAASc,MAAQb,EAAmBD,EAGxF,GAAIa,GAFqBA,GAAmBC,OAASR,GAAQQ,MAGzD,OACIC,EAACC,EAAAA,CACGhB,QAASA,EACTC,iBAAkBA,EAClBgB,YAAanB,EAAMmB,YACnBtB,OAAQgB,KAAKO,MAAMvB,OACnBwB,iBAAkBrB,EAAMqB,iBACxBC,cAAeT,KAAKb,MAAMsB,cAC1BC,UAAWV,KAAKb,M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BAAmBiD,MAGvCL,EAAApC,KAAOqB,WAAWT,IACdZ,KAAK0C,SAAS,CAAE9B,YAAY,IAAMZ,KAAKwC,2BAEvCxC,KAAKb,MAAMkC,SAAS,CAChBgB,KAAMzB,EAASyB,KACfzD,QAASgC,EAAS+B,eAI1BP,EAAApC,KAAOuB,cAAcqB,IACjB5C,KAAK0C,SAAS,CAAEtD,eAAgBwD,EAAEC,sBAEJ,IAAZD,EAAEE,MAEhB9C,KAAKb,MAAMmC,QAAQsB,GAEnB5C,KAAKb,MAAM4D,OAAOH,KAI1BR,OAAOY,aAAa,EAAG3D,UAASC,uBAC5BU,KAAK0C,SAAS,CAAErD,UAASC,uBAsC7B8C,EAAApC,KAAOiD,wBAAyBvE,IAE5B,GAAIsB,KAAKjB,oBAAoBL,GAAY,CAIrC,MAAMC,EAAqBqB,KAAKvB,2BAA2BC,GAC3DsB,KAAKwC,wBAAwB7D,EACjC,IAGJyD,OAAOc,iBAAiB,KACpBlD,KAAK0C,SAAS,CAAEnD,cAAc,IAG9BS,KAAKC,KAAKiD,mBAGdd,EAAApC,KAAOD,kBAAmBoD,IACtBnD,KAAK0C,SAAS,CAAEnD,aAAc4D,OA1GlCf,EAbE7D,EAaY6E,eAAe,CACzBrB,aAAa,EACbsB,oBAAoB,EACpBhC,SAAU,OACVC,QAAS,OACTyB,OAAQ,OACRjB,sBAAuBwB"}
@@ -1,2 +1,2 @@
1
- import{useState as s,useEffect as e}from"../../../external/preact/hooks/dist/hooks.js";import r from"../../../core/Errors/useSRPanelContext.js";import{usePrevious as o}from"../../../utils/hookUtils.js";import{ERROR_ACTION_BLUR_SCENARIO as t,ERROR_ACTION_FOCUS_FIELD as a}from"../../../core/Errors/constants.js";import{getArrayDifferences as c}from"../../../utils/arrayUtils.js";const i=({errors:i,isValidating:n,sfp:l})=>{const[u,m]=s(null),p=o(u),{setSRMessagesFromObjects:d,setSRMessagesFromStrings:f,clearSRPanel:y,shouldMoveFocusSR:S}=r(),g=["encryptedCardNumber","encryptedExpiryDate","encryptedSecurityCode"];e(()=>{try{const s=d?.({}),e=s?.({errors:i,isValidating:n,layout:g}),r=e?.currentErrorsSortedByLayout;switch(m(r),e?.action){case a:S&&l?.setFocusOn(e?.fieldToFocus),setTimeout(()=>{"boolean"==typeof n&&(n=!1)},300);break;case t:{const s=c(r,p,"field"),e=s?.[0];if(e){const s=!0?e.errorMessage:null;f(s)}else y();break}}}catch(s){}},[i])};export{i as useSRPanelForGiftcardErrors};
1
+ import{useState as e,useEffect as s}from"../../../external/preact/hooks/dist/hooks.js";import r from"../../../core/Errors/useSRPanelContext.js";import{usePrevious as o}from"../../../utils/hookUtils.js";import{ERROR_ACTION_BLUR_SCENARIO as t,ERROR_ACTION_FOCUS_FIELD as i}from"../../../core/Errors/constants.js";import{getArrayDifferences as a}from"../../../utils/arrayUtils.js";import c from"../../internal/SecuredFields/lib/CSF/utils/userAgent.js";import{windowScrollTo as l}from"../../../utils/windowScrollTo.js";const n=({errors:n,isValidating:u,setIsValidating:d,sfp:m})=>{const[f,S]=e(null),p=o(f),{setSRMessagesFromObjects:y,setSRMessagesFromStrings:g,clearSRPanel:j,shouldMoveFocusSR:F}=r(),h=["encryptedCardNumber","encryptedExpiryDate","encryptedSecurityCode"];s(()=>{try{const e=y?.({}),s=e?.({errors:n,isValidating:u,layout:h}),r=s?.currentErrorsSortedByLayout;switch(S(r),s?.action){case i:if(F&&u){if(c.__IS_IOS){const e=m?.getRootNode(),r=e?.querySelector(`[data-id="${s?.fieldToFocus}"]`);l(r)}m?.setFocusOn(s?.fieldToFocus)}setTimeout(()=>{d(!1)},300);break;case t:{const e=a(r,p,"field"),s=e?.[0];if(s){const e=!0?s.errorMessage:null;g(e)}else j();break}}}catch(e){}},[n])};export{n as useSRPanelForGiftcardErrors};
2
2
  //# sourceMappingURL=useSRPanelForGiftcardErrors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSRPanelForGiftcardErrors.js","sources":["../../../../../src/components/Giftcard/components/useSRPanelForGiftcardErrors.ts"],"sourcesContent":["import { useEffect, useState } from 'preact/hooks';\nimport { SetSRMessagesReturnObject } from '../../../core/Errors/types';\nimport useSRPanelContext from '../../../core/Errors/useSRPanelContext';\nimport { usePrevious } from '../../../utils/hookUtils';\nimport { ERROR_ACTION_BLUR_SCENARIO, ERROR_ACTION_FOCUS_FIELD } from '../../../core/Errors/constants';\nimport { getArrayDifferences } from '../../../utils/arrayUtils';\nimport { SetSRMessagesReturnFn } from '../../../core/Errors/SRPanelProvider';\nimport SecuredFieldsProvider from '../../internal/SecuredFields/SFP/SecuredFieldsProvider';\n\n/**\n * Interface for transformed error objects returned from mapErrorsToValidationRuleResult\n */\ninterface TransformedError {\n isValid: boolean;\n errorMessage: string;\n errorI18n: string;\n error: string;\n rootNode: HTMLElement;\n}\n\n/**\n * Interface for errors object with transformed error entries\n */\ninterface TransformedErrorsObj {\n [key: string]: TransformedError | null;\n}\n\n/**\n * Props interface for the error handling hook\n */\ninterface UseSRPanelForGiftcardErrorsProps {\n errors: TransformedErrorsObj;\n isValidating: boolean;\n sfp: SecuredFieldsProvider;\n}\n\n/**\n * Interface for sorted error objects used for comparison\n */\ninterface SortedErrorObject {\n field: string;\n errorMessage: string;\n}\n\n/**\n * Custom hook for handling gift card component errors and screen reader announcements\n *\n * This hook manages both visual and screen reader error announcements for the gift card component,\n * handling both blur-based validation errors and form-wide validation errors.\n */\nconst useSRPanelForGiftcardErrors = ({ errors, isValidating, sfp }: UseSRPanelForGiftcardErrorsProps) => {\n // Track sorted list of errors for comparison with previous state\n const [sortedErrorList, setSortedErrorList] = useState<SortedErrorObject[]>(null);\n // Track previous error list for detecting changes\n const previousSortedErrors = usePrevious(sortedErrorList);\n\n // Get SRPanel context for managing screen reader messages\n const { setSRMessagesFromObjects, setSRMessagesFromStrings, clearSRPanel, shouldMoveFocusSR } = useSRPanelContext();\n\n // Fixed layout array defining the order of fields for error sorting\n // Assume fields in this order, and adds encryptedExpiryDate for MealVoucher, this is ignored in giftcard\n const layout = ['encryptedCardNumber', 'encryptedExpiryDate', 'encryptedSecurityCode'];\n\n useEffect(() => {\n try {\n // Create a partial function for setting SR messages with fixed configuration\n const setMessages: SetSRMessagesReturnFn = setSRMessagesFromObjects?.({});\n // Set messages with current errors and layout\n\n // Unlike Card SR Panel, isValidating is a boolean\n const srPanelResp: SetSRMessagesReturnObject = setMessages?.({\n errors,\n isValidating,\n layout\n });\n\n // Store the sorted list of errors for comparison\n const currentErrorsSortedByLayout = srPanelResp?.currentErrorsSortedByLayout;\n setSortedErrorList(currentErrorsSortedByLayout);\n\n // Handle different error scenarios based on the action type\n switch (srPanelResp?.action) {\n case ERROR_ACTION_FOCUS_FIELD:\n // When a field needs to be focused due to validation error\n if (shouldMoveFocusSR) {\n sfp?.setFocusOn(srPanelResp?.fieldToFocus);\n }\n // Remove 'showValidation' mode - allowing time for collation of all the fields in error whilst it is 'showValidation' mode (some errors come in a second render pass)\n setTimeout(() => {\n if (typeof isValidating === 'boolean') {\n isValidating = false;\n }\n }, 300);\n break;\n\n case ERROR_ACTION_BLUR_SCENARIO: {\n // Handle blur-based validation errors\n const difference = getArrayDifferences(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n const latestErrorMsg = difference?.[0];\n\n if (latestErrorMsg) {\n // Only announce blur-based errors to screen reader\n const isBlurBasedError = true;\n const latestSRError = isBlurBasedError ? latestErrorMsg.errorMessage : null;\n setSRMessagesFromStrings(latestSRError);\n } else {\n // Clear SR panel if there are no more errors\n clearSRPanel();\n }\n break;\n }\n }\n } catch (_) {\n // Fail silently - we don't want to break the component if SRPanel fails\n }\n }, [errors]);\n};\n\n// Export all interfaces and the hook\nexport type { TransformedError, TransformedErrorsObj };\n\nexport { useSRPanelForGiftcardErrors };\n"],"names":["useSRPanelForGiftcardErrors","errors","isValidating","sfp","sortedErrorList","setSortedErrorList","useState","previousSortedErrors","usePrevious","setSRMessagesFromObjects","setSRMessagesFromStrings","clearSRPanel","shouldMoveFocusSR","useSRPanelContext","layout","useEffect","setMessages","srPanelResp","currentErrorsSortedByLayout","action","ERROR_ACTION_FOCUS_FIELD","setFocusOn","fieldToFocus","setTimeout","ERROR_ACTION_BLUR_SCENARIO","difference","getArrayDifferences","latestErrorMsg","latestSRError","errorMessage","_"],"mappings":"0XAkDA,MAAMA,EAA8B,EAAGC,SAAQC,eAAcC,UAEzD,MAAOC,EAAiBC,GAAsBC,EAA8B,MAEtEC,EAAuBC,EAAYJ,IAGnCK,yBAAEA,EAAwBC,yBAAEA,EAAwBC,aAAEA,EAAYC,kBAAEA,GAAsBC,IAI1FC,EAAS,CAAC,sBAAuB,sBAAuB,yBAE9DC,EAAU,KACN,IAEI,MAAMC,EAAqCP,IAA2B,IAIhEQ,EAAyCD,IAAc,CACzDf,SACAC,eACAY,WAIEI,EAA8BD,GAAaC,4BAIjD,OAHAb,EAAmBa,GAGXD,GAAaE,QACjB,KAAKC,EAEGR,GACAT,GAAKkB,WAAWJ,GAAaK,cAGjCC,WAAW,KACqB,kBAAjBrB,IACPA,GAAe,IAEpB,KACH,MAEJ,KAAKsB,EAA4B,CAE7B,MAAMC,EAAaC,EAAoBR,EAA6BX,EAAsB,SACpFoB,EAAiBF,IAAa,GAEpC,GAAIE,EAAgB,CAEhB,MACMC,GADmB,EACgBD,EAAeE,aAAe,KACvEnB,EAAyBkB,EAC7B,MAEIjB,IAEJ,KACJ,EAER,CAAE,MAAOmB,GAET,GACD,CAAC7B"}
1
+ {"version":3,"file":"useSRPanelForGiftcardErrors.js","sources":["../../../../../src/components/Giftcard/components/useSRPanelForGiftcardErrors.ts"],"sourcesContent":["import { useEffect, useState } from 'preact/hooks';\nimport { SetSRMessagesReturnObject } from '../../../core/Errors/types';\nimport useSRPanelContext from '../../../core/Errors/useSRPanelContext';\nimport { usePrevious } from '../../../utils/hookUtils';\nimport { ERROR_ACTION_BLUR_SCENARIO, ERROR_ACTION_FOCUS_FIELD } from '../../../core/Errors/constants';\nimport { getArrayDifferences } from '../../../utils/arrayUtils';\nimport { SetSRMessagesReturnFn } from '../../../core/Errors/SRPanelProvider';\nimport SecuredFieldsProvider from '../../internal/SecuredFields/SFP/SecuredFieldsProvider';\nimport ua from '../../internal/SecuredFields/lib/CSF/utils/userAgent';\nimport { windowScrollTo } from '../../../utils/windowScrollTo';\n\n/**\n * Interface for transformed error objects returned from mapErrorsToValidationRuleResult\n */\ninterface TransformedError {\n isValid: boolean;\n errorMessage: string;\n errorI18n: string;\n error: string;\n rootNode: HTMLElement;\n}\n\n/**\n * Interface for errors object with transformed error entries\n */\ninterface TransformedErrorsObj {\n [key: string]: TransformedError | null;\n}\n\n/**\n * Props interface for the error handling hook\n */\ninterface UseSRPanelForGiftcardErrorsProps {\n errors: TransformedErrorsObj;\n isValidating: boolean;\n setIsValidating: (val: boolean) => void;\n sfp: SecuredFieldsProvider;\n}\n\n/**\n * Interface for sorted error objects used for comparison\n */\ninterface SortedErrorObject {\n field: string;\n errorMessage: string;\n}\n\n/**\n * Custom hook for handling gift card component errors and screen reader announcements\n *\n * This hook manages both visual and screen reader error announcements for the gift card component,\n * handling both blur-based validation errors and form-wide validation errors.\n */\nconst useSRPanelForGiftcardErrors = ({ errors, isValidating, setIsValidating, sfp }: UseSRPanelForGiftcardErrorsProps) => {\n // Track sorted list of errors for comparison with previous state\n const [sortedErrorList, setSortedErrorList] = useState<SortedErrorObject[]>(null);\n // Track previous error list for detecting changes\n const previousSortedErrors = usePrevious(sortedErrorList);\n\n // Get SRPanel context for managing screen reader messages\n const { setSRMessagesFromObjects, setSRMessagesFromStrings, clearSRPanel, shouldMoveFocusSR } = useSRPanelContext();\n\n // Fixed layout array defining the order of fields for error sorting\n // Assume fields in this order, and adds encryptedExpiryDate for MealVoucher, this is ignored in giftcard\n const layout = ['encryptedCardNumber', 'encryptedExpiryDate', 'encryptedSecurityCode'];\n\n useEffect(() => {\n try {\n // Create a partial function for setting SR messages with fixed configuration\n const setMessages: SetSRMessagesReturnFn = setSRMessagesFromObjects?.({});\n // Set messages with current errors and layout\n\n // Unlike Card SR Panel, isValidating is a boolean\n const srPanelResp: SetSRMessagesReturnObject = setMessages?.({\n errors,\n isValidating,\n layout\n });\n\n // Store the sorted list of errors for comparison\n const currentErrorsSortedByLayout = srPanelResp?.currentErrorsSortedByLayout;\n setSortedErrorList(currentErrorsSortedByLayout);\n\n // Handle different error scenarios based on the action type\n switch (srPanelResp?.action) {\n case ERROR_ACTION_FOCUS_FIELD:\n // When a field needs to be focused due to validation error\n if (shouldMoveFocusSR && isValidating) {\n // Fix for iOS scrolling issues: can't programmatically set focus on a cross-origin element on iOS, so we scroll to it's label instead, so at least the element is in view\n if (ua.__IS_IOS) {\n const rootNode = sfp?.getRootNode();\n const elementToScrollTo: HTMLElement = rootNode?.querySelector(`[data-id=\"${srPanelResp?.fieldToFocus}\"]`);\n windowScrollTo(elementToScrollTo);\n }\n\n sfp?.setFocusOn(srPanelResp?.fieldToFocus);\n }\n // Remove 'showValidation' mode - allowing time for collation of all the fields in error whilst it is 'showValidation' mode (some errors come in a second render pass)\n setTimeout(() => {\n // Need to reset isValidating on the *state* of the Giftcard component (which is where isValidating comes from),\n // - otherwise it remains true and any subsequent click, *anywhere* in the UI, will trigger a second \"focus field\" event\n setIsValidating(false);\n }, 300);\n break;\n\n case ERROR_ACTION_BLUR_SCENARIO: {\n // Handle blur-based validation errors\n const difference = getArrayDifferences(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n const latestErrorMsg = difference?.[0];\n\n if (latestErrorMsg) {\n // Only announce blur-based errors to screen reader\n const isBlurBasedError = true;\n const latestSRError = isBlurBasedError ? latestErrorMsg.errorMessage : null;\n setSRMessagesFromStrings(latestSRError);\n } else {\n // Clear SR panel if there are no more errors\n clearSRPanel();\n }\n break;\n }\n }\n } catch (_) {\n // Fail silently - we don't want to break the component if SRPanel fails\n }\n }, [errors]);\n};\n\n// Export all interfaces and the hook\nexport type { TransformedError, TransformedErrorsObj };\n\nexport { useSRPanelForGiftcardErrors };\n"],"names":["useSRPanelForGiftcardErrors","errors","isValidating","setIsValidating","sfp","sortedErrorList","setSortedErrorList","useState","previousSortedErrors","usePrevious","setSRMessagesFromObjects","setSRMessagesFromStrings","clearSRPanel","shouldMoveFocusSR","useSRPanelContext","layout","useEffect","setMessages","srPanelResp","currentErrorsSortedByLayout","action","ERROR_ACTION_FOCUS_FIELD","ua","__IS_IOS","rootNode","getRootNode","elementToScrollTo","querySelector","fieldToFocus","windowScrollTo","setFocusOn","setTimeout","ERROR_ACTION_BLUR_SCENARIO","difference","getArrayDifferences","latestErrorMsg","latestSRError","errorMessage","_"],"mappings":"mgBAqDA,MAAMA,EAA8B,EAAGC,SAAQC,eAAcC,kBAAiBC,UAE1E,MAAOC,EAAiBC,GAAsBC,EAA8B,MAEtEC,EAAuBC,EAAYJ,IAGnCK,yBAAEA,EAAwBC,yBAAEA,EAAwBC,aAAEA,EAAYC,kBAAEA,GAAsBC,IAI1FC,EAAS,CAAC,sBAAuB,sBAAuB,yBAE9DC,EAAU,KACN,IAEI,MAAMC,EAAqCP,IAA2B,IAIhEQ,EAAyCD,IAAc,CACzDhB,SACAC,eACAa,WAIEI,EAA8BD,GAAaC,4BAIjD,OAHAb,EAAmBa,GAGXD,GAAaE,QACjB,KAAKC,EAED,GAAIR,GAAqBX,EAAc,CAEnC,GAAIoB,EAAGC,SAAU,CACb,MAAMC,EAAWpB,GAAKqB,cAChBC,EAAiCF,GAAUG,cAAc,aAAaT,GAAaU,kBACzFC,EAAeH,EACnB,CAEAtB,GAAK0B,WAAWZ,GAAaU,aACjC,CAEAG,WAAW,KAGP5B,GAAgB,IACjB,KACH,MAEJ,KAAK6B,EAA4B,CAE7B,MAAMC,EAAaC,EAAoBf,EAA6BX,EAAsB,SACpF2B,EAAiBF,IAAa,GAEpC,GAAIE,EAAgB,CAEhB,MACMC,GADmB,EACgBD,EAAeE,aAAe,KACvE1B,EAAyByB,EAC7B,MAEIxB,IAEJ,KACJ,EAER,CAAE,MAAO0B,GAET,GACD,CAACrC"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as t}from"../internal/UIElement/UIElement.js";import o from"./components/Challenge/PrepareChallenge3DS2.js";import{THREEDS2_CHALLENGE_ERROR as n,THREEDS2_CHALLENGE as r,DEFAULT_CHALLENGE_WINDOW_SIZE as s}from"./constants.js";import{existy as i}from"../../utils/commonUtils.js";import{hasOwnProperty as a}from"../../utils/hasOwnProperty.js";import{TxVariants as p}from"../tx-variants.js";import l,{API_ERROR as m}from"../../core/Errors/AdyenCheckoutError.js";import{AnalyticsLogEvent as c,LogEventSubtype as h,LogEventType as u}from"../../core/Analytics/events/AnalyticsLogEvent.js";import{AnalyticsErrorEvent as y,ErrorEventType as d,ErrorEventCode as f}from"../../core/Analytics/events/AnalyticsErrorEvent.js";function A(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}class D extends t{beforeRender(){}onComplete(e){this.props.onComplete?this.props.onComplete(e,this.elementRef):super.onComplete(e),this.unmount()}componentToRender(){if(!i(this.props.paymentData)){const e=a(this.props,"isMDFlow")?"paymentData":"authorisationToken";this.props.onError(new l(m,`No ${e} received. 3DS2 Challenge cannot proceed`));const t=new y({component:this.type,code:f.THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA,errorType:d.apiError,message:`${n}: Missing 'paymentData' property from threeDS2 action`});return this.submitAnalytics(t),null}return e(o,{...this.props,onComplete:this.onComplete,onSubmitAnalytics:this.submitAnalytics,isMDFlow:this.props.paymentData.length<15,onActionHandled:this.onActionHandled})}constructor(...e){super(...e),A(this,"onActionHandled",e=>{const t=new c({component:this.type,type:u.threeDS2,subType:h.challengeIframeLoaded,message:e.actionDescription});this.submitAnalytics(t),super.onActionHandled(e)})}}A(D,"type",p.threeDS2Challenge),A(D,"defaultProps",{dataKey:"threeDSResult",size:s,type:r});export{D as default};
1
+ import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as t}from"../internal/UIElement/UIElement.js";import o from"./components/Challenge/PrepareChallenge3DS2.js";import{THREEDS2_CHALLENGE_ERROR as n,THREEDS2_CHALLENGE as r,DEFAULT_CHALLENGE_WINDOW_SIZE as s}from"./constants.js";import{existy as i}from"../../utils/commonUtils.js";import{hasOwnProperty as a}from"../../utils/hasOwnProperty.js";import{TxVariants as p}from"../tx-variants.js";import l,{API_ERROR as m}from"../../core/Errors/AdyenCheckoutError.js";import{AnalyticsLogEvent as c,LogEventSubtype as h,LogEventType as u}from"../../core/Analytics/events/AnalyticsLogEvent.js";import{AnalyticsErrorEvent as y,ErrorEventType as d,ErrorEventCode as f}from"../../core/Analytics/events/AnalyticsErrorEvent.js";function A(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}class D extends t{beforeRender(){}onComplete(e){this.props.onComplete?this.props.onComplete(e,this.elementRef):super.onComplete(e),this.unmount()}componentToRender(){if(!i(this.props.paymentData)){const e=a(this.props,"isMDFlow")?"paymentData":"authorisationToken";this.props.onError(new l(m,`No ${e} received. 3DS2 Challenge cannot proceed`));const t=new y({component:this.type,code:f.THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA,errorType:d.threeDS2,message:`${n}: Missing 'paymentData' property from threeDS2 action`});return this.submitAnalytics(t),null}return e(o,{...this.props,onComplete:this.onComplete,onSubmitAnalytics:this.submitAnalytics,isMDFlow:this.props.paymentData.length<15,onActionHandled:this.onActionHandled})}constructor(...e){super(...e),A(this,"onActionHandled",e=>{const t=new c({component:this.type,type:u.threeDS2,subType:h.challengeIframeLoaded,message:e.actionDescription});this.submitAnalytics(t),super.onActionHandled(e)})}}A(D,"type",p.threeDS2Challenge),A(D,"defaultProps",{dataKey:"threeDSResult",size:s,type:r});export{D as default};
2
2
  //# sourceMappingURL=ThreeDS2Challenge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThreeDS2Challenge.js","sources":["../../../../src/components/ThreeDS2/ThreeDS2Challenge.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport PrepareChallenge from './components/Challenge';\nimport { DEFAULT_CHALLENGE_WINDOW_SIZE, THREEDS2_CHALLENGE, THREEDS2_CHALLENGE_ERROR } from './constants';\nimport { existy } from '../../utils/commonUtils';\nimport { hasOwnProperty } from '../../utils/hasOwnProperty';\nimport { TxVariants } from '../tx-variants';\nimport { ChallengeResolveData, LegacyChallengeResolveData, ThreeDS2ChallengeConfiguration } from './types';\nimport AdyenCheckoutError, { API_ERROR } from '../../core/Errors/AdyenCheckoutError';\nimport { ActionHandledReturnObject } from '../../types/global-types';\nimport { AnalyticsLogEvent, LogEventSubtype, LogEventType } from '../../core/Analytics/events/AnalyticsLogEvent';\nimport { AnalyticsErrorEvent, ErrorEventCode, ErrorEventType } from '../../core/Analytics/events/AnalyticsErrorEvent';\n\nclass ThreeDS2Challenge extends UIElement<ThreeDS2ChallengeConfiguration> {\n public static type = TxVariants.threeDS2Challenge;\n\n public static defaultProps = {\n dataKey: 'threeDSResult',\n size: DEFAULT_CHALLENGE_WINDOW_SIZE,\n type: THREEDS2_CHALLENGE\n };\n\n protected override beforeRender() {\n /* Do not send rendered events for ThreeDS2Challenge - it will have the same timestamp as the \"creq sent\" event */\n }\n\n protected onActionHandled = (rtnObj: ActionHandledReturnObject) => {\n const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.threeDS2,\n subType: LogEventSubtype.challengeIframeLoaded,\n message: rtnObj.actionDescription\n });\n\n this.submitAnalytics(event);\n\n super.onActionHandled(rtnObj);\n };\n\n onComplete(state: LegacyChallengeResolveData | ChallengeResolveData) {\n /**\n * Equals a call to onAdditionalDetails (as set in actionTypes.ts) for the regular, \"native\" flow.\n * However, if the action to create this component came from the 3DS2InMDFlow process it will instead equal a call to the onComplete callback\n * (as defined in the 3DS2InMDFlow and passed in as a config prop).\n */\n if (this.props.onComplete) {\n this.props.onComplete(state, this.elementRef);\n } else {\n super.onComplete(state);\n }\n\n this.unmount(); // re. fixing issue around back to back challenge calls\n }\n\n protected override componentToRender(): h.JSX.Element {\n // existy used because threeds2InMDFlow will send empty string for paymentData and we should be allowed to proceed with this\n if (!existy(this.props.paymentData)) {\n /**\n * The presence of props.isMDFlow indicates the action to create this component came from the threeds2InMDFlow process which passes (an empty) paymentsData.\n * The regular, \"native\" flow uses the authorisationToken from the 3DS2 action, which actionTypes.ts assigns to a property called paymentData\n */\n const dataTypeForError = hasOwnProperty(this.props, 'isMDFlow') ? 'paymentData' : 'authorisationToken';\n\n this.props.onError(new AdyenCheckoutError(API_ERROR, `No ${dataTypeForError} received. 3DS2 Challenge cannot proceed`));\n\n const event = new AnalyticsErrorEvent({\n component: this.type,\n code: ErrorEventCode.THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA,\n errorType: ErrorEventType.apiError,\n message: `${THREEDS2_CHALLENGE_ERROR}: Missing 'paymentData' property from threeDS2 action`\n });\n\n this.submitAnalytics(event);\n\n return null;\n }\n\n return (\n <PrepareChallenge\n {...this.props}\n onComplete={this.onComplete}\n onSubmitAnalytics={this.submitAnalytics}\n isMDFlow={this.props.paymentData.length < 15}\n onActionHandled={this.onActionHandled}\n />\n );\n }\n}\n\nexport default ThreeDS2Challenge;\n"],"names":["ThreeDS2Challenge","UIElement","beforeRender","onComplete","state","this","props","elementRef","super","unmount","componentToRender","existy","paymentData","dataTypeForError","hasOwnProperty","onError","AdyenCheckoutError","API_ERROR","event","AnalyticsErrorEvent","component","type","code","ErrorEventCode","THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA","errorType","ErrorEventType","apiError","message","THREEDS2_CHALLENGE_ERROR","submitAnalytics","h","PrepareChallenge","onSubmitAnalytics","isMDFlow","length","onActionHandled","args","_define_property","rtnObj","AnalyticsLogEvent","LogEventType","threeDS2","subType","LogEventSubtype","challengeIframeLoaded","actionDescription","TxVariants","threeDS2Challenge","defaultProps","dataKey","size","DEFAULT_CHALLENGE_WINDOW_SIZE","THREEDS2_CHALLENGE"],"mappings":"q5BAaA,MAAMA,UAA0BC,EASTC,YAAAA,GAEnB,CAeAC,UAAAA,CAAWC,GAMHC,KAAKC,MAAMH,WACXE,KAAKC,MAAMH,WAAWC,EAAOC,KAAKE,YAElCC,MAAML,WAAWC,GAGrBC,KAAKI,SACT,CAEmBC,iBAAAA,GAEf,IAAKC,EAAON,KAAKC,MAAMM,aAAc,CAKjC,MAAMC,EAAmBC,EAAeT,KAAKC,MAAO,YAAc,cAAgB,qBAElFD,KAAKC,MAAMS,QAAQ,IAAIC,EAAmBC,EAAW,MAAMJ,8CAE3D,MAAMK,EAAQ,IAAIC,EAAoB,CAClCC,UAAWf,KAAKgB,KAChBC,KAAMC,EAAeC,wCACrBC,UAAWC,EAAeC,SAC1BC,QAAS,GAAGC,2DAKhB,OAFAxB,KAAKyB,gBAAgBZ,GAEd,IACX,CAEA,OACIa,EAACC,EAAAA,IACO3B,KAAKC,MACTH,WAAYE,KAAKF,WACjB8B,kBAAmB5B,KAAKyB,gBACxBI,SAAU7B,KAAKC,MAAMM,YAAYuB,OAAS,GAC1CC,gBAAiB/B,KAAK+B,iBAGlC,mBAzEJ5B,SAAA6B,GAaIC,EAAAjC,KAAU+B,kBAAmBG,IACzB,MAAMrB,EAAQ,IAAIsB,EAAkB,CAChCpB,UAAWf,KAAKgB,KAChBA,KAAMoB,EAAaC,SACnBC,QAASC,EAAgBC,sBACzBjB,QAASW,EAAOO,oBAGpBzC,KAAKyB,gBAAgBZ,GAErBV,MAAM4B,gBAAgBG,MAtB1BD,EADEtC,EACYqB,OAAO0B,EAAWC,mBAEhCV,EAHEtC,EAGYiD,eAAe,CACzBC,QAAS,gBACTC,KAAMC,EACN/B,KAAMgC"}
1
+ {"version":3,"file":"ThreeDS2Challenge.js","sources":["../../../../src/components/ThreeDS2/ThreeDS2Challenge.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport PrepareChallenge from './components/Challenge';\nimport { DEFAULT_CHALLENGE_WINDOW_SIZE, THREEDS2_CHALLENGE, THREEDS2_CHALLENGE_ERROR } from './constants';\nimport { existy } from '../../utils/commonUtils';\nimport { hasOwnProperty } from '../../utils/hasOwnProperty';\nimport { TxVariants } from '../tx-variants';\nimport { ChallengeResolveData, LegacyChallengeResolveData, ThreeDS2ChallengeConfiguration } from './types';\nimport AdyenCheckoutError, { API_ERROR } from '../../core/Errors/AdyenCheckoutError';\nimport { ActionHandledReturnObject } from '../../types/global-types';\nimport { AnalyticsLogEvent, LogEventSubtype, LogEventType } from '../../core/Analytics/events/AnalyticsLogEvent';\nimport { AnalyticsErrorEvent, ErrorEventCode, ErrorEventType } from '../../core/Analytics/events/AnalyticsErrorEvent';\n\nclass ThreeDS2Challenge extends UIElement<ThreeDS2ChallengeConfiguration> {\n public static type = TxVariants.threeDS2Challenge;\n\n public static defaultProps = {\n dataKey: 'threeDSResult',\n size: DEFAULT_CHALLENGE_WINDOW_SIZE,\n type: THREEDS2_CHALLENGE\n };\n\n protected override beforeRender() {\n /* Do not send rendered events for ThreeDS2Challenge - it will have the same timestamp as the \"creq sent\" event */\n }\n\n protected onActionHandled = (rtnObj: ActionHandledReturnObject) => {\n const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.threeDS2,\n subType: LogEventSubtype.challengeIframeLoaded,\n message: rtnObj.actionDescription\n });\n\n this.submitAnalytics(event);\n\n super.onActionHandled(rtnObj);\n };\n\n onComplete(state: LegacyChallengeResolveData | ChallengeResolveData) {\n /**\n * Equals a call to onAdditionalDetails (as set in actionTypes.ts) for the regular, \"native\" flow.\n * However, if the action to create this component came from the 3DS2InMDFlow process it will instead equal a call to the onComplete callback\n * (as defined in the 3DS2InMDFlow and passed in as a config prop).\n */\n if (this.props.onComplete) {\n this.props.onComplete(state, this.elementRef);\n } else {\n super.onComplete(state);\n }\n\n this.unmount(); // re. fixing issue around back to back challenge calls\n }\n\n protected override componentToRender(): h.JSX.Element {\n // existy used because threeds2InMDFlow will send empty string for paymentData and we should be allowed to proceed with this\n if (!existy(this.props.paymentData)) {\n /**\n * The presence of props.isMDFlow indicates the action to create this component came from the threeds2InMDFlow process which passes (an empty) paymentsData.\n * The regular, \"native\" flow uses the authorisationToken from the 3DS2 action, which actionTypes.ts assigns to a property called paymentData\n */\n const dataTypeForError = hasOwnProperty(this.props, 'isMDFlow') ? 'paymentData' : 'authorisationToken';\n\n this.props.onError(new AdyenCheckoutError(API_ERROR, `No ${dataTypeForError} received. 3DS2 Challenge cannot proceed`));\n\n const event = new AnalyticsErrorEvent({\n component: this.type,\n code: ErrorEventCode.THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA,\n errorType: ErrorEventType.threeDS2,\n message: `${THREEDS2_CHALLENGE_ERROR}: Missing 'paymentData' property from threeDS2 action`\n });\n\n this.submitAnalytics(event);\n\n return null;\n }\n\n return (\n <PrepareChallenge\n {...this.props}\n onComplete={this.onComplete}\n onSubmitAnalytics={this.submitAnalytics}\n isMDFlow={this.props.paymentData.length < 15}\n onActionHandled={this.onActionHandled}\n />\n );\n }\n}\n\nexport default ThreeDS2Challenge;\n"],"names":["ThreeDS2Challenge","UIElement","beforeRender","onComplete","state","this","props","elementRef","super","unmount","componentToRender","existy","paymentData","dataTypeForError","hasOwnProperty","onError","AdyenCheckoutError","API_ERROR","event","AnalyticsErrorEvent","component","type","code","ErrorEventCode","THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA","errorType","ErrorEventType","threeDS2","message","THREEDS2_CHALLENGE_ERROR","submitAnalytics","h","PrepareChallenge","onSubmitAnalytics","isMDFlow","length","onActionHandled","args","_define_property","rtnObj","AnalyticsLogEvent","LogEventType","subType","LogEventSubtype","challengeIframeLoaded","actionDescription","TxVariants","threeDS2Challenge","defaultProps","dataKey","size","DEFAULT_CHALLENGE_WINDOW_SIZE","THREEDS2_CHALLENGE"],"mappings":"q5BAaA,MAAMA,UAA0BC,EASTC,YAAAA,GAEnB,CAeAC,UAAAA,CAAWC,GAMHC,KAAKC,MAAMH,WACXE,KAAKC,MAAMH,WAAWC,EAAOC,KAAKE,YAElCC,MAAML,WAAWC,GAGrBC,KAAKI,SACT,CAEmBC,iBAAAA,GAEf,IAAKC,EAAON,KAAKC,MAAMM,aAAc,CAKjC,MAAMC,EAAmBC,EAAeT,KAAKC,MAAO,YAAc,cAAgB,qBAElFD,KAAKC,MAAMS,QAAQ,IAAIC,EAAmBC,EAAW,MAAMJ,8CAE3D,MAAMK,EAAQ,IAAIC,EAAoB,CAClCC,UAAWf,KAAKgB,KAChBC,KAAMC,EAAeC,wCACrBC,UAAWC,EAAeC,SAC1BC,QAAS,GAAGC,2DAKhB,OAFAxB,KAAKyB,gBAAgBZ,GAEd,IACX,CAEA,OACIa,EAACC,EAAAA,IACO3B,KAAKC,MACTH,WAAYE,KAAKF,WACjB8B,kBAAmB5B,KAAKyB,gBACxBI,SAAU7B,KAAKC,MAAMM,YAAYuB,OAAS,GAC1CC,gBAAiB/B,KAAK+B,iBAGlC,mBAzEJ5B,SAAA6B,GAaIC,EAAAjC,KAAU+B,kBAAmBG,IACzB,MAAMrB,EAAQ,IAAIsB,EAAkB,CAChCpB,UAAWf,KAAKgB,KAChBA,KAAMoB,EAAad,SACnBe,QAASC,EAAgBC,sBACzBhB,QAASW,EAAOM,oBAGpBxC,KAAKyB,gBAAgBZ,GAErBV,MAAM4B,gBAAgBG,MAtB1BD,EADEtC,EACYqB,OAAOyB,EAAWC,mBAEhCT,EAHEtC,EAGYgD,eAAe,CACzBC,QAAS,gBACTC,KAAMC,EACN9B,KAAM+B"}
@@ -1,2 +1,2 @@
1
- import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import r from"./components/DeviceFingerprint/PrepareFingerprint3DS2.js";import n from"./callSubmit3DS2Fingerprint.js";import{existy as o}from"../../utils/commonUtils.js";import{TxVariants as i}from"../tx-variants.js";import s,{API_ERROR as p}from"../../core/Errors/AdyenCheckoutError.js";import{THREEDS2_FINGERPRINT_ERROR as a,THREEDS2_FINGERPRINT as m}from"./constants.js";import{AnalyticsLogEvent as l,LogEventSubtype as c,LogEventType as u}from"../../core/Analytics/events/AnalyticsLogEvent.js";import{AnalyticsErrorEvent as h,ErrorEventType as d,ErrorEventCode as y}from"../../core/Analytics/events/AnalyticsErrorEvent.js";function f(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class D extends e{beforeRender(){}onComplete(t){this.props.onComplete?this.props.onComplete(t,this.elementRef):super.onComplete(t),this.unmount()}componentToRender(){if(!o(this.props.paymentData)){this.props.onError(new s(p,"No paymentData received. 3DS2 Fingerprint cannot proceed"));const t=new h({component:this.type,code:y.THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA,errorType:d.apiError,message:`${a}: Missing 'paymentData' property from threeDS2 action`});return this.submitAnalytics(t),null}return t(r,{...this.props,onComplete:this.props.isMDFlow?this.onComplete:this.callSubmit3DS2Fingerprint,onSubmitAnalytics:this.submitAnalytics,isMDFlow:this.props.paymentData.length<15,onActionHandled:this.onActionHandled})}constructor(...t){super(...t),f(this,"callSubmit3DS2Fingerprint",n.bind(this)),f(this,"onActionHandled",t=>{const e=new l({component:this.type,type:u.threeDS2,subType:c.fingerprintIframeLoaded,message:t.actionDescription});this.submitAnalytics(e),super.onActionHandled(t)})}}f(D,"type",i.threeDS2Fingerprint),f(D,"defaultProps",{dataKey:"fingerprintResult",type:m});export{D as default};
1
+ import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import n from"./components/DeviceFingerprint/PrepareFingerprint3DS2.js";import r from"./callSubmit3DS2Fingerprint.js";import{existy as o}from"../../utils/commonUtils.js";import{TxVariants as i}from"../tx-variants.js";import s,{API_ERROR as p}from"../../core/Errors/AdyenCheckoutError.js";import{THREEDS2_FINGERPRINT_ERROR as a,THREEDS2_FINGERPRINT as m}from"./constants.js";import{AnalyticsLogEvent as l,LogEventSubtype as c,LogEventType as u}from"../../core/Analytics/events/AnalyticsLogEvent.js";import{AnalyticsErrorEvent as h,ErrorEventType as d,ErrorEventCode as y}from"../../core/Analytics/events/AnalyticsErrorEvent.js";function f(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class D extends e{beforeRender(){}onComplete(t){this.props.onComplete?this.props.onComplete(t,this.elementRef):super.onComplete(t),this.unmount()}componentToRender(){if(!o(this.props.paymentData)){this.props.onError(new s(p,"No paymentData received. 3DS2 Fingerprint cannot proceed"));const t=new h({component:this.type,code:y.THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA,errorType:d.threeDS2,message:`${a}: Missing 'paymentData' property from threeDS2 action`});return this.submitAnalytics(t),null}return t(n,{...this.props,onComplete:this.props.isMDFlow?this.onComplete:this.callSubmit3DS2Fingerprint,onSubmitAnalytics:this.submitAnalytics,isMDFlow:this.props.paymentData.length<15,onActionHandled:this.onActionHandled})}constructor(...t){super(...t),f(this,"callSubmit3DS2Fingerprint",r.bind(this)),f(this,"onActionHandled",t=>{const e=new l({component:this.type,type:u.threeDS2,subType:c.fingerprintIframeLoaded,message:t.actionDescription});this.submitAnalytics(e),super.onActionHandled(t)})}}f(D,"type",i.threeDS2Fingerprint),f(D,"defaultProps",{dataKey:"fingerprintResult",type:m});export{D as default};
2
2
  //# sourceMappingURL=ThreeDS2DeviceFingerprint.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThreeDS2DeviceFingerprint.js","sources":["../../../../src/components/ThreeDS2/ThreeDS2DeviceFingerprint.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport PrepareFingerprint from './components/DeviceFingerprint';\nimport callSubmit3DS2Fingerprint from './callSubmit3DS2Fingerprint';\nimport { existy } from '../../utils/commonUtils';\nimport { TxVariants } from '../tx-variants';\nimport { FingerprintResolveData, LegacyFingerprintResolveData, ThreeDS2DeviceFingerprintConfiguration } from './types';\nimport AdyenCheckoutError, { API_ERROR } from '../../core/Errors/AdyenCheckoutError';\nimport { THREEDS2_FINGERPRINT, THREEDS2_FINGERPRINT_ERROR } from './constants';\nimport { ActionHandledReturnObject } from '../../types/global-types';\nimport { AnalyticsLogEvent, LogEventSubtype, LogEventType } from '../../core/Analytics/events/AnalyticsLogEvent';\nimport { AnalyticsErrorEvent, ErrorEventCode, ErrorEventType } from '../../core/Analytics/events/AnalyticsErrorEvent';\n\nclass ThreeDS2DeviceFingerprint extends UIElement<ThreeDS2DeviceFingerprintConfiguration> {\n public static type = TxVariants.threeDS2Fingerprint;\n\n public static defaultProps = {\n dataKey: 'fingerprintResult',\n type: THREEDS2_FINGERPRINT\n };\n\n private callSubmit3DS2Fingerprint = callSubmit3DS2Fingerprint.bind(this); // New 3DS2 flow\n\n protected override beforeRender() {\n /* Do not send rendered events for ThreeDS2DeviceFingerprint - it will have the same timestamp as the \"threeDSMethodData sent\" event */\n }\n\n protected onActionHandled = (rtnObj: ActionHandledReturnObject) => {\n const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.threeDS2,\n subType: LogEventSubtype.fingerprintIframeLoaded,\n message: rtnObj.actionDescription\n });\n\n this.submitAnalytics(event);\n\n super.onActionHandled(rtnObj);\n };\n\n onComplete(state: LegacyFingerprintResolveData | FingerprintResolveData) {\n if (this.props.onComplete) {\n this.props.onComplete(state, this.elementRef);\n } else {\n super.onComplete(state);\n }\n\n this.unmount(); // re. fixing issue around back to back fingerprinting calls\n }\n\n protected override componentToRender(): h.JSX.Element {\n /**\n * In the regular components (aka \"native\") flow we can't proceed because something has gone wrong with the payment if paymentData is missing from the threeDS2 action.\n * In the MDFlow the paymentData is always present (albeit an empty string, which is why we use 'existy' since we should be allowed to proceed with this)\n */\n if (!existy(this.props.paymentData)) {\n this.props.onError(new AdyenCheckoutError(API_ERROR, `No paymentData received. 3DS2 Fingerprint cannot proceed`));\n\n // TODO - check logs to see if this *ever* happens\n const event = new AnalyticsErrorEvent({\n component: this.type,\n code: ErrorEventCode.THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA,\n errorType: ErrorEventType.apiError,\n message: `${THREEDS2_FINGERPRINT_ERROR}: Missing 'paymentData' property from threeDS2 action`\n });\n\n this.submitAnalytics(event);\n\n return null;\n }\n\n /**\n * this.props.isMDFlow indicates the action to create this component came from the 3DS2InMDFlow process and upon completion should call the\n * passed onComplete callback (as defined in the 3DS2InMDFlow) instead of the /submitThreeDS2Fingerprint endpoint for the regular, \"native\" flow\n */\n return (\n <PrepareFingerprint\n {...this.props}\n onComplete={this.props.isMDFlow ? this.onComplete : this.callSubmit3DS2Fingerprint}\n onSubmitAnalytics={this.submitAnalytics}\n isMDFlow={this.props.paymentData.length < 15}\n onActionHandled={this.onActionHandled}\n />\n );\n }\n}\n\nexport default ThreeDS2DeviceFingerprint;\n"],"names":["ThreeDS2DeviceFingerprint","UIElement","beforeRender","onComplete","state","this","props","elementRef","super","unmount","componentToRender","existy","paymentData","onError","AdyenCheckoutError","API_ERROR","event","AnalyticsErrorEvent","component","type","code","ErrorEventCode","THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA","errorType","ErrorEventType","apiError","message","THREEDS2_FINGERPRINT_ERROR","submitAnalytics","h","PrepareFingerprint","isMDFlow","callSubmit3DS2Fingerprint","onSubmitAnalytics","length","onActionHandled","args","_define_property","bind","rtnObj","AnalyticsLogEvent","LogEventType","threeDS2","subType","LogEventSubtype","fingerprintIframeLoaded","actionDescription","TxVariants","threeDS2Fingerprint","defaultProps","dataKey","THREEDS2_FINGERPRINT"],"mappings":"+2BAaA,MAAMA,UAAkCC,EAUjBC,YAAAA,GAEnB,CAeAC,UAAAA,CAAWC,GACHC,KAAKC,MAAMH,WACXE,KAAKC,MAAMH,WAAWC,EAAOC,KAAKE,YAElCC,MAAML,WAAWC,GAGrBC,KAAKI,SACT,CAEmBC,iBAAAA,GAKf,IAAKC,EAAON,KAAKC,MAAMM,aAAc,CACjCP,KAAKC,MAAMO,QAAQ,IAAIC,EAAmBC,EAAW,6DAGrD,MAAMC,EAAQ,IAAIC,EAAoB,CAClCC,UAAWb,KAAKc,KAChBC,KAAMC,EAAeC,wCACrBC,UAAWC,EAAeC,SAC1BC,QAAS,GAAGC,2DAKhB,OAFAtB,KAAKuB,gBAAgBZ,GAEd,IACX,CAMA,OACIa,EAACC,EAAAA,IACOzB,KAAKC,MACTH,WAAYE,KAAKC,MAAMyB,SAAW1B,KAAKF,WAAaE,KAAK2B,0BACzDC,kBAAmB5B,KAAKuB,gBACxBG,SAAU1B,KAAKC,MAAMM,YAAYsB,OAAS,GAC1CC,gBAAiB9B,KAAK8B,iBAGlC,mBAvEJ3B,SAAA4B,GAQIC,OAAQL,4BAA4BA,EAA0BM,KAAKjC,OAMnEgC,EAAAhC,KAAU8B,kBAAmBI,IACzB,MAAMvB,EAAQ,IAAIwB,EAAkB,CAChCtB,UAAWb,KAAKc,KAChBA,KAAMsB,EAAaC,SACnBC,QAASC,EAAgBC,wBACzBnB,QAASa,EAAOO,oBAGpBzC,KAAKuB,gBAAgBZ,GAErBR,MAAM2B,gBAAgBI,MAvB1BF,EADErC,EACYmB,OAAO4B,EAAWC,qBAEhCX,EAHErC,EAGYiD,eAAe,CACzBC,QAAS,oBACT/B,KAAMgC"}
1
+ {"version":3,"file":"ThreeDS2DeviceFingerprint.js","sources":["../../../../src/components/ThreeDS2/ThreeDS2DeviceFingerprint.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport PrepareFingerprint from './components/DeviceFingerprint';\nimport callSubmit3DS2Fingerprint from './callSubmit3DS2Fingerprint';\nimport { existy } from '../../utils/commonUtils';\nimport { TxVariants } from '../tx-variants';\nimport { FingerprintResolveData, LegacyFingerprintResolveData, ThreeDS2DeviceFingerprintConfiguration } from './types';\nimport AdyenCheckoutError, { API_ERROR } from '../../core/Errors/AdyenCheckoutError';\nimport { THREEDS2_FINGERPRINT, THREEDS2_FINGERPRINT_ERROR } from './constants';\nimport { ActionHandledReturnObject } from '../../types/global-types';\nimport { AnalyticsLogEvent, LogEventSubtype, LogEventType } from '../../core/Analytics/events/AnalyticsLogEvent';\nimport { AnalyticsErrorEvent, ErrorEventCode, ErrorEventType } from '../../core/Analytics/events/AnalyticsErrorEvent';\n\nclass ThreeDS2DeviceFingerprint extends UIElement<ThreeDS2DeviceFingerprintConfiguration> {\n public static type = TxVariants.threeDS2Fingerprint;\n\n public static defaultProps = {\n dataKey: 'fingerprintResult',\n type: THREEDS2_FINGERPRINT\n };\n\n private callSubmit3DS2Fingerprint = callSubmit3DS2Fingerprint.bind(this); // New 3DS2 flow\n\n protected override beforeRender() {\n /* Do not send rendered events for ThreeDS2DeviceFingerprint - it will have the same timestamp as the \"threeDSMethodData sent\" event */\n }\n\n protected onActionHandled = (rtnObj: ActionHandledReturnObject) => {\n const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.threeDS2,\n subType: LogEventSubtype.fingerprintIframeLoaded,\n message: rtnObj.actionDescription\n });\n\n this.submitAnalytics(event);\n\n super.onActionHandled(rtnObj);\n };\n\n onComplete(state: LegacyFingerprintResolveData | FingerprintResolveData) {\n if (this.props.onComplete) {\n this.props.onComplete(state, this.elementRef);\n } else {\n super.onComplete(state);\n }\n\n this.unmount(); // re. fixing issue around back to back fingerprinting calls\n }\n\n protected override componentToRender(): h.JSX.Element {\n /**\n * In the regular components (aka \"native\") flow we can't proceed because something has gone wrong with the payment if paymentData is missing from the threeDS2 action.\n * In the MDFlow the paymentData is always present (albeit an empty string, which is why we use 'existy' since we should be allowed to proceed with this)\n */\n if (!existy(this.props.paymentData)) {\n this.props.onError(new AdyenCheckoutError(API_ERROR, `No paymentData received. 3DS2 Fingerprint cannot proceed`));\n\n // TODO - check logs to see if this *ever* happens\n const event = new AnalyticsErrorEvent({\n component: this.type,\n code: ErrorEventCode.THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA,\n errorType: ErrorEventType.threeDS2,\n message: `${THREEDS2_FINGERPRINT_ERROR}: Missing 'paymentData' property from threeDS2 action`\n });\n\n this.submitAnalytics(event);\n\n return null;\n }\n\n /**\n * this.props.isMDFlow indicates the action to create this component came from the 3DS2InMDFlow process and upon completion should call the\n * passed onComplete callback (as defined in the 3DS2InMDFlow) instead of the /submitThreeDS2Fingerprint endpoint for the regular, \"native\" flow\n */\n return (\n <PrepareFingerprint\n {...this.props}\n onComplete={this.props.isMDFlow ? this.onComplete : this.callSubmit3DS2Fingerprint}\n onSubmitAnalytics={this.submitAnalytics}\n isMDFlow={this.props.paymentData.length < 15}\n onActionHandled={this.onActionHandled}\n />\n );\n }\n}\n\nexport default ThreeDS2DeviceFingerprint;\n"],"names":["ThreeDS2DeviceFingerprint","UIElement","beforeRender","onComplete","state","this","props","elementRef","super","unmount","componentToRender","existy","paymentData","onError","AdyenCheckoutError","API_ERROR","event","AnalyticsErrorEvent","component","type","code","ErrorEventCode","THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA","errorType","ErrorEventType","threeDS2","message","THREEDS2_FINGERPRINT_ERROR","submitAnalytics","h","PrepareFingerprint","isMDFlow","callSubmit3DS2Fingerprint","onSubmitAnalytics","length","onActionHandled","args","_define_property","bind","rtnObj","AnalyticsLogEvent","LogEventType","subType","LogEventSubtype","fingerprintIframeLoaded","actionDescription","TxVariants","threeDS2Fingerprint","defaultProps","dataKey","THREEDS2_FINGERPRINT"],"mappings":"+2BAaA,MAAMA,UAAkCC,EAUjBC,YAAAA,GAEnB,CAeAC,UAAAA,CAAWC,GACHC,KAAKC,MAAMH,WACXE,KAAKC,MAAMH,WAAWC,EAAOC,KAAKE,YAElCC,MAAML,WAAWC,GAGrBC,KAAKI,SACT,CAEmBC,iBAAAA,GAKf,IAAKC,EAAON,KAAKC,MAAMM,aAAc,CACjCP,KAAKC,MAAMO,QAAQ,IAAIC,EAAmBC,EAAW,6DAGrD,MAAMC,EAAQ,IAAIC,EAAoB,CAClCC,UAAWb,KAAKc,KAChBC,KAAMC,EAAeC,wCACrBC,UAAWC,EAAeC,SAC1BC,QAAS,GAAGC,2DAKhB,OAFAtB,KAAKuB,gBAAgBZ,GAEd,IACX,CAMA,OACIa,EAACC,EAAAA,IACOzB,KAAKC,MACTH,WAAYE,KAAKC,MAAMyB,SAAW1B,KAAKF,WAAaE,KAAK2B,0BACzDC,kBAAmB5B,KAAKuB,gBACxBG,SAAU1B,KAAKC,MAAMM,YAAYsB,OAAS,GAC1CC,gBAAiB9B,KAAK8B,iBAGlC,mBAvEJ3B,SAAA4B,GAQIC,OAAQL,4BAA4BA,EAA0BM,KAAKjC,OAMnEgC,EAAAhC,KAAU8B,kBAAmBI,IACzB,MAAMvB,EAAQ,IAAIwB,EAAkB,CAChCtB,UAAWb,KAAKc,KAChBA,KAAMsB,EAAahB,SACnBiB,QAASC,EAAgBC,wBACzBlB,QAASa,EAAOM,oBAGpBxC,KAAKuB,gBAAgBZ,GAErBR,MAAM2B,gBAAgBI,MAvB1BF,EADErC,EACYmB,OAAO2B,EAAWC,qBAEhCV,EAHErC,EAGYgD,eAAe,CACzBC,QAAS,oBACT9B,KAAM+B"}
@@ -1,2 +1,2 @@
1
- import{httpPost as e}from"../../core/Services/http.js";import{pick as t}from"../../utils/commonUtils.js";import{THREEDS2_FINGERPRINT_SUBMIT as n}from"./constants.js";import{API_ERROR_CODE as r}from"../../core/Services/sessions/constants.js";import{AnalyticsErrorEvent as o,ErrorEventType as i,ErrorEventCode as s}from"../../core/Analytics/events/AnalyticsErrorEvent.js";function a({data:a}){e({path:`v1/submitThreeDS2Fingerprint?token=${this.props.clientKey}`,loadingContext:this.props.loadingContext,errorLevel:"fatal",errorCode:r.submitThreeDS2Fingerprint},{...a}).then(e=>{let r;if("completed"===e.type){const{details:t}=e;return e.details?this.onComplete({data:{details:t}}):(console.debug('Handled Error::callSubmit3DS2Fingerprint::FAILED:: no details object in a response indicating either a "frictionless" flow, or a "refused" response. resData=',e),r=new o({component:"threeDS2Fingerprint",code:s.THREEDS2_NO_DETAILS_FOR_FRICTIONLESS_OR_REFUSED,errorType:i.apiError,message:`${n}: no details object in a response indicating either a "frictionless" flow, or a "refused" response`}),void this.submitAnalytics(r))}if(!e.action)return console.debug('Handled Error::callSubmit3DS2Fingerprint::FAILED:: no action object in a response indicating a "challenge". resData=',e),r=new o({component:"threeDS2Fingerprint",code:s.THREEDS2_NO_ACTION_FOR_CHALLENGE,errorType:i.apiError,message:`${n}: no action object in a response indicating a "challenge" flow`}),void this.submitAnalytics(r);const a=this.props.elementRef??this;return a?"threeDS2"===e.action?.type?a.handleAction(e.action,t("challengeWindowSize").from(this.props)):"redirect"===e.action?.type?a.handleAction(e.action):void 0:(console.debug("Handled Error::callSubmit3DS2Fingerprint::FAILED:: no actionHandler"),r=new o({component:"threeDS2Fingerprint",code:s.THREEDS2_NO_COMPONENT_FOR_ACTION,errorType:i.sdkError,message:`${n}: no component defined to handle the action response`}),void this.submitAnalytics(r))}).catch(e=>{this.handleError(e)})}export{a as default};
1
+ import{httpPost as e}from"../../core/Services/http.js";import{pick as t}from"../../utils/commonUtils.js";import{THREEDS2_FINGERPRINT_SUBMIT as n}from"./constants.js";import{API_ERROR_CODE as o}from"../../core/Services/sessions/constants.js";import{AnalyticsErrorEvent as r,ErrorEventType as i,ErrorEventCode as s}from"../../core/Analytics/events/AnalyticsErrorEvent.js";function a({data:a}){e({path:`v1/submitThreeDS2Fingerprint?token=${this.props.clientKey}`,loadingContext:this.props.loadingContext,errorLevel:"fatal",errorCode:o.submitThreeDS2Fingerprint},{...a}).then(e=>{let o;if("completed"===e.type){const{details:t}=e;return e.details?this.onComplete({data:{details:t}}):(console.debug('Handled Error::callSubmit3DS2Fingerprint::FAILED:: no details object in a response indicating either a "frictionless" flow, or a "refused" response. resData=',e),o=new r({component:"threeDS2Fingerprint",code:s.THREEDS2_NO_DETAILS_FOR_FRICTIONLESS_OR_REFUSED,errorType:i.threeDS2,message:`${n}: no details object in a response indicating either a "frictionless" flow, or a "refused" response`}),void this.submitAnalytics(o))}if(!e.action)return console.debug('Handled Error::callSubmit3DS2Fingerprint::FAILED:: no action object in a response indicating a "challenge". resData=',e),o=new r({component:"threeDS2Fingerprint",code:s.THREEDS2_NO_ACTION_FOR_CHALLENGE,errorType:i.threeDS2,message:`${n}: no action object in a response indicating a "challenge" flow`}),void this.submitAnalytics(o);const a=this.props.elementRef??this;return a?"threeDS2"===e.action?.type?a.handleAction(e.action,t("challengeWindowSize").from(this.props)):"redirect"===e.action?.type?a.handleAction(e.action):void 0:(console.debug("Handled Error::callSubmit3DS2Fingerprint::FAILED:: no actionHandler"),o=new r({component:"threeDS2Fingerprint",code:s.THREEDS2_NO_COMPONENT_FOR_ACTION,errorType:i.threeDS2,message:`${n}: no component defined to handle the action response`}),void this.submitAnalytics(o))}).catch(e=>{this.handleError(e)})}export{a as default};
2
2
  //# sourceMappingURL=callSubmit3DS2Fingerprint.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"callSubmit3DS2Fingerprint.js","sources":["../../../../src/components/ThreeDS2/callSubmit3DS2Fingerprint.ts"],"sourcesContent":["import { httpPost } from '../../core/Services/http';\nimport { pick } from '../../utils/commonUtils';\nimport { ThreeDS2FingerprintResponse } from './types';\nimport AdyenCheckoutError from '../../core/Errors/AdyenCheckoutError';\nimport { THREEDS2_FINGERPRINT_SUBMIT } from './constants';\nimport { API_ERROR_CODE } from '../../core/Services/sessions/constants';\nimport { AbstractAnalyticsEvent } from '../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { AnalyticsErrorEvent, ErrorEventCode, ErrorEventType } from '../../core/Analytics/events/AnalyticsErrorEvent';\n\n/**\n * ThreeDS2DeviceFingerprint, onComplete, calls a new, internal, endpoint which\n * behaves like the /details endpoint but doesn't require the same credentials\n */\nexport default function callSubmit3DS2Fingerprint({ data }): void {\n httpPost<ThreeDS2FingerprintResponse>(\n {\n path: `v1/submitThreeDS2Fingerprint?token=${this.props.clientKey}`,\n loadingContext: this.props.loadingContext,\n errorLevel: 'fatal',\n errorCode: API_ERROR_CODE.submitThreeDS2Fingerprint\n },\n {\n ...data\n }\n )\n .then(resData => {\n let event: AbstractAnalyticsEvent;\n\n /**\n * Frictionless (no challenge) flow OR \"refused\" flow\n */\n if (resData.type === 'completed') {\n const { details } = resData;\n\n if (!resData.details) {\n console.debug(\n 'Handled Error::callSubmit3DS2Fingerprint::FAILED:: no details object in a response indicating either a \"frictionless\" flow, or a \"refused\" response. resData=',\n resData\n );\n\n event = new AnalyticsErrorEvent({\n component: 'threeDS2Fingerprint',\n code: ErrorEventCode.THREEDS2_NO_DETAILS_FOR_FRICTIONLESS_OR_REFUSED,\n errorType: ErrorEventType.apiError,\n message: `${THREEDS2_FINGERPRINT_SUBMIT}: no details object in a response indicating either a \"frictionless\" flow, or a \"refused\" response`\n });\n\n this.submitAnalytics(event);\n\n return;\n }\n\n return this.onComplete({ data: { details } });\n }\n\n /**\n * If we don't have a type: \"completed\", then we expect an action, because we must be in a Challenge or Redirect flow\n */\n if (!resData.action) {\n console.debug(\n 'Handled Error::callSubmit3DS2Fingerprint::FAILED:: no action object in a response indicating a \"challenge\". resData=',\n resData\n );\n\n event = new AnalyticsErrorEvent({\n component: 'threeDS2Fingerprint',\n code: ErrorEventCode.THREEDS2_NO_ACTION_FOR_CHALLENGE,\n errorType: ErrorEventType.apiError,\n message: `${THREEDS2_FINGERPRINT_SUBMIT}: no action object in a response indicating a \"challenge\" flow`\n });\n this.submitAnalytics(event);\n\n return;\n }\n\n // elementRef exists when the fingerprint component is created from the Dropin\n const actionHandler = this.props.elementRef ?? this;\n\n /**\n * We have an action but do we have a way to handle it?\n * TODO - check logs: do we ever *not* have an actionHandler?\n */\n if (!actionHandler) {\n console.debug('Handled Error::callSubmit3DS2Fingerprint::FAILED:: no actionHandler');\n\n event = new AnalyticsErrorEvent({\n component: 'threeDS2Fingerprint',\n code: ErrorEventCode.THREEDS2_NO_COMPONENT_FOR_ACTION,\n errorType: ErrorEventType.sdkError,\n message: `${THREEDS2_FINGERPRINT_SUBMIT}: no component defined to handle the action response`\n });\n\n this.submitAnalytics(event);\n\n return;\n }\n\n /**\n * Challenge flow\n */\n if (resData.action?.type === 'threeDS2') {\n // Ensure challengeWindowSize is propagated if there was a (merchant defined) handleAction call proceeding this one that had it set as an option\n return actionHandler.handleAction(resData.action, pick('challengeWindowSize').from(this.props));\n }\n\n /**\n * Redirect flow (usecase: we thought we could do 3DS2 but it turns out we can't)\n * TODO - check logs: does this ever happen, anymore?\n */\n if (resData.action?.type === 'redirect') {\n return actionHandler.handleAction(resData.action);\n }\n })\n .catch((error: AdyenCheckoutError) => {\n this.handleError(error);\n });\n}\n"],"names":["callSubmit3DS2Fingerprint","data","httpPost","path","this","props","clientKey","loadingContext","errorLevel","errorCode","API_ERROR_CODE","submitThreeDS2Fingerprint","then","resData","event","type","details","onComplete","console","debug","AnalyticsErrorEvent","component","code","ErrorEventCode","THREEDS2_NO_DETAILS_FOR_FRICTIONLESS_OR_REFUSED","errorType","ErrorEventType","apiError","message","THREEDS2_FINGERPRINT_SUBMIT","submitAnalytics","action","THREEDS2_NO_ACTION_FOR_CHALLENGE","actionHandler","elementRef","handleAction","pick","from","THREEDS2_NO_COMPONENT_FOR_ACTION","sdkError","catch","error","handleError"],"mappings":"kXAae,SAASA,GAA0BC,KAAEA,IAChDC,EACI,CACIC,KAAM,sCAAsCC,KAAKC,MAAMC,YACvDC,eAAgBH,KAAKC,MAAME,eAC3BC,WAAY,QACZC,UAAWC,EAAeC,2BAE9B,IACOV,IAGNW,KAAKC,IACF,IAAIC,EAKJ,GAAqB,cAAjBD,EAAQE,KAAsB,CAC9B,MAAMC,QAAEA,GAAYH,EAEpB,OAAKA,EAAQG,QAkBNZ,KAAKa,WAAW,CAAEhB,KAAM,CAAEe,cAjB7BE,QAAQC,MACJ,gKACAN,GAGJC,EAAQ,IAAIM,EAAoB,CAC5BC,UAAW,sBACXC,KAAMC,EAAeC,gDACrBC,UAAWC,EAAeC,SAC1BC,QAAS,GAAGC,6GAGhBzB,KAAK0B,gBAAgBhB,GAM7B,CAKA,IAAKD,EAAQkB,OAcT,OAbAb,QAAQC,MACJ,uHACAN,GAGJC,EAAQ,IAAIM,EAAoB,CAC5BC,UAAW,sBACXC,KAAMC,EAAeS,iCACrBP,UAAWC,EAAeC,SAC1BC,QAAS,GAAGC,yEAEhBzB,KAAK0B,gBAAgBhB,GAMzB,MAAMmB,EAAgB7B,KAAKC,MAAM6B,YAAc9B,KAM/C,OAAK6B,EAkBwB,aAAzBpB,EAAQkB,QAAQhB,KAETkB,EAAcE,aAAatB,EAAQkB,OAAQK,EAAK,uBAAuBC,KAAKjC,KAAKC,QAO/D,aAAzBQ,EAAQkB,QAAQhB,KACTkB,EAAcE,aAAatB,EAAQkB,aAD9C,GA1BIb,QAAQC,MAAM,uEAEdL,EAAQ,IAAIM,EAAoB,CAC5BC,UAAW,sBACXC,KAAMC,EAAee,iCACrBb,UAAWC,EAAea,SAC1BX,QAAS,GAAGC,+DAGhBzB,KAAK0B,gBAAgBhB,MAqB5B0B,MAAOC,IACJrC,KAAKsC,YAAYD,IAE7B"}
1
+ {"version":3,"file":"callSubmit3DS2Fingerprint.js","sources":["../../../../src/components/ThreeDS2/callSubmit3DS2Fingerprint.ts"],"sourcesContent":["import { httpPost } from '../../core/Services/http';\nimport { pick } from '../../utils/commonUtils';\nimport { ThreeDS2FingerprintResponse } from './types';\nimport AdyenCheckoutError from '../../core/Errors/AdyenCheckoutError';\nimport { THREEDS2_FINGERPRINT_SUBMIT } from './constants';\nimport { API_ERROR_CODE } from '../../core/Services/sessions/constants';\nimport { AbstractAnalyticsEvent } from '../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { AnalyticsErrorEvent, ErrorEventCode, ErrorEventType } from '../../core/Analytics/events/AnalyticsErrorEvent';\n\n/**\n * ThreeDS2DeviceFingerprint, onComplete, calls a new, internal, endpoint which\n * behaves like the /details endpoint but doesn't require the same credentials\n */\nexport default function callSubmit3DS2Fingerprint({ data }): void {\n httpPost<ThreeDS2FingerprintResponse>(\n {\n path: `v1/submitThreeDS2Fingerprint?token=${this.props.clientKey}`,\n loadingContext: this.props.loadingContext,\n errorLevel: 'fatal',\n errorCode: API_ERROR_CODE.submitThreeDS2Fingerprint\n },\n {\n ...data\n }\n )\n .then(resData => {\n let event: AbstractAnalyticsEvent;\n\n /**\n * Frictionless (no challenge) flow OR \"refused\" flow\n */\n if (resData.type === 'completed') {\n const { details } = resData;\n\n if (!resData.details) {\n console.debug(\n 'Handled Error::callSubmit3DS2Fingerprint::FAILED:: no details object in a response indicating either a \"frictionless\" flow, or a \"refused\" response. resData=',\n resData\n );\n\n event = new AnalyticsErrorEvent({\n component: 'threeDS2Fingerprint',\n code: ErrorEventCode.THREEDS2_NO_DETAILS_FOR_FRICTIONLESS_OR_REFUSED,\n errorType: ErrorEventType.threeDS2,\n message: `${THREEDS2_FINGERPRINT_SUBMIT}: no details object in a response indicating either a \"frictionless\" flow, or a \"refused\" response`\n });\n\n this.submitAnalytics(event);\n\n return;\n }\n\n return this.onComplete({ data: { details } });\n }\n\n /**\n * If we don't have a type: \"completed\", then we expect an action, because we must be in a Challenge or Redirect flow\n */\n if (!resData.action) {\n console.debug(\n 'Handled Error::callSubmit3DS2Fingerprint::FAILED:: no action object in a response indicating a \"challenge\". resData=',\n resData\n );\n\n event = new AnalyticsErrorEvent({\n component: 'threeDS2Fingerprint',\n code: ErrorEventCode.THREEDS2_NO_ACTION_FOR_CHALLENGE,\n errorType: ErrorEventType.threeDS2,\n message: `${THREEDS2_FINGERPRINT_SUBMIT}: no action object in a response indicating a \"challenge\" flow`\n });\n this.submitAnalytics(event);\n\n return;\n }\n\n // elementRef exists when the fingerprint component is created from the Dropin\n const actionHandler = this.props.elementRef ?? this;\n\n /**\n * We have an action but do we have a way to handle it?\n * TODO - check logs: do we ever *not* have an actionHandler?\n */\n if (!actionHandler) {\n console.debug('Handled Error::callSubmit3DS2Fingerprint::FAILED:: no actionHandler');\n\n event = new AnalyticsErrorEvent({\n component: 'threeDS2Fingerprint',\n code: ErrorEventCode.THREEDS2_NO_COMPONENT_FOR_ACTION,\n errorType: ErrorEventType.threeDS2,\n message: `${THREEDS2_FINGERPRINT_SUBMIT}: no component defined to handle the action response`\n });\n\n this.submitAnalytics(event);\n\n return;\n }\n\n /**\n * Challenge flow\n */\n if (resData.action?.type === 'threeDS2') {\n // Ensure challengeWindowSize is propagated if there was a (merchant defined) handleAction call proceeding this one that had it set as an option\n return actionHandler.handleAction(resData.action, pick('challengeWindowSize').from(this.props));\n }\n\n /**\n * Redirect flow (usecase: we thought we could do 3DS2 but it turns out we can't)\n * TODO - check logs: does this ever happen, anymore?\n */\n if (resData.action?.type === 'redirect') {\n return actionHandler.handleAction(resData.action);\n }\n })\n .catch((error: AdyenCheckoutError) => {\n this.handleError(error);\n });\n}\n"],"names":["callSubmit3DS2Fingerprint","data","httpPost","path","this","props","clientKey","loadingContext","errorLevel","errorCode","API_ERROR_CODE","submitThreeDS2Fingerprint","then","resData","event","type","details","onComplete","console","debug","AnalyticsErrorEvent","component","code","ErrorEventCode","THREEDS2_NO_DETAILS_FOR_FRICTIONLESS_OR_REFUSED","errorType","ErrorEventType","threeDS2","message","THREEDS2_FINGERPRINT_SUBMIT","submitAnalytics","action","THREEDS2_NO_ACTION_FOR_CHALLENGE","actionHandler","elementRef","handleAction","pick","from","THREEDS2_NO_COMPONENT_FOR_ACTION","catch","error","handleError"],"mappings":"kXAae,SAASA,GAA0BC,KAAEA,IAChDC,EACI,CACIC,KAAM,sCAAsCC,KAAKC,MAAMC,YACvDC,eAAgBH,KAAKC,MAAME,eAC3BC,WAAY,QACZC,UAAWC,EAAeC,2BAE9B,IACOV,IAGNW,KAAKC,IACF,IAAIC,EAKJ,GAAqB,cAAjBD,EAAQE,KAAsB,CAC9B,MAAMC,QAAEA,GAAYH,EAEpB,OAAKA,EAAQG,QAkBNZ,KAAKa,WAAW,CAAEhB,KAAM,CAAEe,cAjB7BE,QAAQC,MACJ,gKACAN,GAGJC,EAAQ,IAAIM,EAAoB,CAC5BC,UAAW,sBACXC,KAAMC,EAAeC,gDACrBC,UAAWC,EAAeC,SAC1BC,QAAS,GAAGC,6GAGhBzB,KAAK0B,gBAAgBhB,GAM7B,CAKA,IAAKD,EAAQkB,OAcT,OAbAb,QAAQC,MACJ,uHACAN,GAGJC,EAAQ,IAAIM,EAAoB,CAC5BC,UAAW,sBACXC,KAAMC,EAAeS,iCACrBP,UAAWC,EAAeC,SAC1BC,QAAS,GAAGC,yEAEhBzB,KAAK0B,gBAAgBhB,GAMzB,MAAMmB,EAAgB7B,KAAKC,MAAM6B,YAAc9B,KAM/C,OAAK6B,EAkBwB,aAAzBpB,EAAQkB,QAAQhB,KAETkB,EAAcE,aAAatB,EAAQkB,OAAQK,EAAK,uBAAuBC,KAAKjC,KAAKC,QAO/D,aAAzBQ,EAAQkB,QAAQhB,KACTkB,EAAcE,aAAatB,EAAQkB,aAD9C,GA1BIb,QAAQC,MAAM,uEAEdL,EAAQ,IAAIM,EAAoB,CAC5BC,UAAW,sBACXC,KAAMC,EAAee,iCACrBb,UAAWC,EAAeC,SAC1BC,QAAS,GAAGC,+DAGhBzB,KAAK0B,gBAAgBhB,MAqB5ByB,MAAOC,IACJpC,KAAKqC,YAAYD,IAE7B"}
@@ -1,2 +1,2 @@
1
- import{Component as e,createElement as r}from"../../../../external/preact/dist/preact.js";import t from"./DoChallenge3DS2.js";import{isErrorObject as s,createOldChallengeResolveData as o,createChallengeResolveData as n,prepareChallengeData as i}from"../utils.js";import a from"../../../internal/Img/Img.js";import{hasOwnProperty as l}from"../../../../utils/hasOwnProperty.js";import p from"../../../../core/Context/useImage.js";import c,{ERROR as h}from"../../../../core/Errors/AdyenCheckoutError.js";import{THREEDS2_CHALLENGE_ERROR as u,MISSING_TOKEN_IN_ACTION_MSG as m,THREEDS2_NUM as S,THREEDS2_CHALLENGE as d}from"../../constants.js";import{isValidHttpUrl as g}from"../../../../utils/isValidURL.js";import{AnalyticsLogEvent as E,LogEventSubtype as D,LogEventType as _}from"../../../../core/Analytics/events/AnalyticsLogEvent.js";import{ErrorEventCode as T,AnalyticsErrorEvent as I,ErrorEventType as C}from"../../../../core/Analytics/events/AnalyticsErrorEvent.js";function f(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}class y extends e{componentDidMount(){if(!s(this.state.challengeData)){const e="test"===this.props.environment&&this.props._environmentUrls?.api?.includes("http://localhost:8080"),{acsURL:r}=this.state.challengeData;if(!g(r,e)){this.setError({errorInfo:`${T.THREEDS2_TOKEN_IS_MISSING_ACSURL}: ${this.props.i18n.get("err.gen.9102")}`},!0);const e=new I({component:this.props.type,code:T.THREEDS2_TOKEN_IS_MISSING_ACSURL,errorType:C.apiError,message:`${u}: Decoded token is missing a valid acsURL property`});return this.props.onSubmitAnalytics(e),void console.debug("### PrepareChallenge3DS2::exiting:: no valid acsURL")}const{acsTransID:t,messageVersion:s,threeDSServerTransID:o}=this.state.challengeData.cReqData;if(!t||!s||!o){this.setError({errorInfo:`${T.THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS}: ${this.props.i18n.get("err.gen.9102")}`},!0);const e=new I({component:this.props.type,code:T.THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS,errorType:C.apiError,message:`${u}: Decoded token is missing one or more of the following properties (acsTransID | messageVersion | threeDSServerTransID)`});return this.props.onSubmitAnalytics(e),void console.debug("### PrepareChallenge3DS2::exiting:: missing one or more of the following properties (acsTransID | messageVersion | threeDSServerTransID)")}this.setState({status:"performingChallenge"})}else{const e=this.state.challengeData.error,r=e.indexOf(m)>-1?T.THREEDS2_ACTION_IS_MISSING_TOKEN:T.THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED;this.setError({errorInfo:e.indexOf(m)>-1?`${T.THREEDS2_ACTION_IS_MISSING_TOKEN}: ${this.props.i18n.get("err.gen.9102")}`:`${T.THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED}: ${this.props.i18n.get("err.gen.9102")}`},!0);const t=new I({component:this.props.type,code:r,errorType:C.apiError,message:`${u}: ${e}`});this.props.onSubmitAnalytics(t),console.debug("### PrepareChallenge3DS2::exiting:: no challengeData")}}setStatusComplete(e,r=null){this.setState({status:"complete"},()=>{const t=(this.props.isMDFlow?o:n)(this.props.dataKey,e.transStatus,this.props.paymentData);let s;r&&console.debug("### PrepareChallenge3DS2::errorCodeObject::",r);const i=r||e;if(i.errorCode){const e={code:"timeout"===i.errorCode?T.THREEDS2_TIMEOUT:T.THREEDS2_NO_TRANSSTATUS,errorType:"timeout"===i.errorCode?C.network:C.apiError};s=new I({component:this.props.type,message:i.message,...e}),this.props.onSubmitAnalytics(s)}let a;switch(e?.transStatus){case"Y":a="success";break;case"N":a="failed";break;case"U":a=r?"timeout":"cancelled"}e?.errorCode&&(a="noTransStatus"),s=new E({component:this.props.type,type:_.threeDS2,subType:D.challengeCompleted,message:`${S} challenge has completed`,result:a}),this.props.onSubmitAnalytics(s),this.props.onComplete(t)})}setError(e,r){this.setState({status:"error",errorInfo:e.errorInfo}),r&&this.props.onError(new c(h,e.errorInfo,{cause:e.errorObj}))}render(e,{challengeData:s}){const o=p();return"performingChallenge"===this.state.status?r(t,{onCompleteChallenge:e=>{let r=null;if(l(e.result,"errorCode")&&e.result.errorCode.length&&(r={errorCode:e.result.errorCode,message:`${u}: ${e.result.errorDescription?e.result.errorDescription:"no transStatus could be retrieved"}`},this.props.isMDFlow&&this.props.onError(new c(h,`${u}: ${e.result.errorDescription?e.result.errorDescription:"no transStatus could be retrieved"}`,{cause:e.result.errorCode}))),!e.result){this.setError({errorInfo:`${u}: ${this.props.i18n.get("3ds.chal.805",{values:{result:'"result"'}})}`,errorObj:e},!0);const r=new I({component:this.props.type,code:T.THREEDS2_CHALLENGE_RESOLVED_WITHOUT_RESULT_PROP,errorType:C.apiError,message:`${u}: challenge resolved without a "result" object`});return this.props.onSubmitAnalytics(r),void console.debug('### PrepareChallenge3DS2::exiting:: challenge resolved without a "result" object')}this.setStatusComplete(e.result,r)},onErrorChallenge:e=>{if(l(e,"errorCode")){const r={errorCode:e.errorCode,message:`${d}: ${e.errorCode}`};return this.props.isMDFlow&&this.props.onError(new c(h,`${u}: '3DS2 challenge timed out'`,{cause:e.errorCode})),void this.setStatusComplete(e.result,r)}},...s,onActionHandled:this.props.onActionHandled,onFormSubmit:this.onFormSubmit}):"error"===this.state.status?r("div",{className:"adyen-checkout__threeds2-challenge-error"},r(a,{className:"adyen-checkout__status__icon adyen-checkout__status__icon--error",src:o({imageFolder:"components/"})("error"),alt:""}),r("div",{className:"adyen-checkout__status__text"},this.state.errorInfo?this.state.errorInfo:this.props.i18n.get("error.message.unknown"))):null}constructor(e){if(super(e),f(this,"onFormSubmit",e=>{const r=new E({component:this.props.type,type:_.threeDS2,subType:D.challengeDataSentWeb,message:e});this.props.onSubmitAnalytics(r)}),this.props.token){const e=i({token:this.props.token,size:this.props.challengeWindowSize||this.props.size});this.state={status:"init",challengeData:e}}else this.state={challengeData:{success:!1,error:m}},console.debug(`${u}: ${m}`)}}f(y,"defaultProps",{onComplete:()=>{},onError:()=>{},isMDFlow:!1});export{y as default};
1
+ import{Component as e,createElement as r}from"../../../../external/preact/dist/preact.js";import t from"./DoChallenge3DS2.js";import{isErrorObject as s,createOldChallengeResolveData as o,createChallengeResolveData as n,prepareChallengeData as i}from"../utils.js";import a from"../../../internal/Img/Img.js";import{hasOwnProperty as l}from"../../../../utils/hasOwnProperty.js";import p from"../../../../core/Context/useImage.js";import c,{ERROR as h}from"../../../../core/Errors/AdyenCheckoutError.js";import{THREEDS2_CHALLENGE_ERROR as u,MISSING_TOKEN_IN_ACTION_MSG as m,THREEDS2_NUM as S,THREEDS2_CHALLENGE as g}from"../../constants.js";import{isValidHttpUrl as d}from"../../../../utils/isValidURL.js";import{AnalyticsLogEvent as D,LogEventSubtype as E,LogEventType as _}from"../../../../core/Analytics/events/AnalyticsLogEvent.js";import{ErrorEventCode as T,AnalyticsErrorEvent as I,ErrorEventType as f}from"../../../../core/Analytics/events/AnalyticsErrorEvent.js";function C(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}class y extends e{componentDidMount(){if(!s(this.state.challengeData)){const e="test"===this.props.environment&&this.props._environmentUrls?.api?.includes("http://localhost:8080"),{acsURL:r}=this.state.challengeData;if(!d(r,e)){this.setError({errorInfo:`${T.THREEDS2_TOKEN_IS_MISSING_ACSURL}: ${this.props.i18n.get("err.gen.9102")}`},!0);const e=new I({component:this.props.type,code:T.THREEDS2_TOKEN_IS_MISSING_ACSURL,errorType:f.threeDS2,message:`${u}: Decoded token is missing a valid acsURL property`});return this.props.onSubmitAnalytics(e),void console.debug("### PrepareChallenge3DS2::exiting:: no valid acsURL")}const{acsTransID:t,messageVersion:s,threeDSServerTransID:o}=this.state.challengeData.cReqData;if(!t||!s||!o){this.setError({errorInfo:`${T.THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS}: ${this.props.i18n.get("err.gen.9102")}`},!0);const e=new I({component:this.props.type,code:T.THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS,errorType:f.threeDS2,message:`${u}: Decoded token is missing one or more of the following properties (acsTransID | messageVersion | threeDSServerTransID)`});return this.props.onSubmitAnalytics(e),void console.debug("### PrepareChallenge3DS2::exiting:: missing one or more of the following properties (acsTransID | messageVersion | threeDSServerTransID)")}this.setState({status:"performingChallenge"})}else{const e=this.state.challengeData.error,r=e.indexOf(m)>-1?T.THREEDS2_ACTION_IS_MISSING_TOKEN:T.THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED;this.setError({errorInfo:e.indexOf(m)>-1?`${T.THREEDS2_ACTION_IS_MISSING_TOKEN}: ${this.props.i18n.get("err.gen.9102")}`:`${T.THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED}: ${this.props.i18n.get("err.gen.9102")}`},!0);const t=new I({component:this.props.type,code:r,errorType:f.threeDS2,message:`${u}: ${e}`});this.props.onSubmitAnalytics(t),console.debug("### PrepareChallenge3DS2::exiting:: no challengeData")}}setStatusComplete(e,r=null){this.setState({status:"complete"},()=>{const t=(this.props.isMDFlow?o:n)(this.props.dataKey,e.transStatus,this.props.paymentData);let s;r&&console.debug("### PrepareChallenge3DS2::errorCodeObject::",r);const i=r||e;if(i.errorCode){const e={code:"timeout"===i.errorCode?T.THREEDS2_TIMEOUT:T.THREEDS2_NO_TRANSSTATUS,errorType:f.threeDS2};s=new I({component:this.props.type,message:i.message,...e}),this.props.onSubmitAnalytics(s)}let a;switch(e?.transStatus){case"Y":a="success";break;case"N":a="failed";break;case"U":a=r?"timeout":"cancelled"}e?.errorCode&&(a="noTransStatus"),s=new D({component:this.props.type,type:_.threeDS2,subType:E.challengeCompleted,message:`${S} challenge has completed`,result:a}),this.props.onSubmitAnalytics(s),this.props.onComplete(t)})}setError(e,r){this.setState({status:"error",errorInfo:e.errorInfo}),r&&this.props.onError(new c(h,e.errorInfo,{cause:e.errorObj}))}render(e,{challengeData:s}){const o=p();return"performingChallenge"===this.state.status?r(t,{onCompleteChallenge:e=>{let r=null;if(l(e.result,"errorCode")&&e.result.errorCode.length&&(r={errorCode:e.result.errorCode,message:`${u}: ${e.result.errorDescription?e.result.errorDescription:"no transStatus could be retrieved"}`},this.props.isMDFlow&&this.props.onError(new c(h,`${u}: ${e.result.errorDescription?e.result.errorDescription:"no transStatus could be retrieved"}`,{cause:e.result.errorCode}))),!e.result){this.setError({errorInfo:`${u}: ${this.props.i18n.get("3ds.chal.805",{values:{result:'"result"'}})}`,errorObj:e},!0);const r=new I({component:this.props.type,code:T.THREEDS2_CHALLENGE_RESOLVED_WITHOUT_RESULT_PROP,errorType:f.threeDS2,message:`${u}: challenge resolved without a "result" object`});return this.props.onSubmitAnalytics(r),void console.debug('### PrepareChallenge3DS2::exiting:: challenge resolved without a "result" object')}this.setStatusComplete(e.result,r)},onErrorChallenge:e=>{if(l(e,"errorCode")){const r={errorCode:e.errorCode,message:`${g}: ${e.errorCode}`};return this.props.isMDFlow&&this.props.onError(new c(h,`${u}: '3DS2 challenge timed out'`,{cause:e.errorCode})),void this.setStatusComplete(e.result,r)}},...s,onActionHandled:this.props.onActionHandled,onFormSubmit:this.onFormSubmit}):"error"===this.state.status?r("div",{className:"adyen-checkout__threeds2-challenge-error"},r(a,{className:"adyen-checkout__status__icon adyen-checkout__status__icon--error",src:o({imageFolder:"components/"})("error"),alt:""}),r("div",{className:"adyen-checkout__status__text"},this.state.errorInfo?this.state.errorInfo:this.props.i18n.get("error.message.unknown"))):null}constructor(e){if(super(e),C(this,"onFormSubmit",e=>{const r=new D({component:this.props.type,type:_.threeDS2,subType:E.challengeDataSentWeb,message:e});this.props.onSubmitAnalytics(r)}),this.props.token){const e=i({token:this.props.token,size:this.props.challengeWindowSize||this.props.size});this.state={status:"init",challengeData:e}}else this.state={challengeData:{success:!1,error:m}},console.debug(`${u}: ${m}`)}}C(y,"defaultProps",{onComplete:()=>{},onError:()=>{},isMDFlow:!1});export{y as default};
2
2
  //# sourceMappingURL=PrepareChallenge3DS2.js.map
@@ -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, createOldChallengeResolveData, isErrorObject } from '../utils';\nimport { PrepareChallenge3DS2Props, PrepareChallenge3DS2State, StatusErrorInfoObject } from './types';\nimport { ChallengeData, ResultObject, ThreeDS2FlowObject, ErrorCodeObject, LegacyChallengeResolveData, 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 defaultProps = {\n onComplete: () => {},\n onError: () => {},\n isMDFlow: false\n };\n\n constructor(props) {\n super(props);\n\n if (this.props.token) {\n const challengeData: ChallengeData | ErrorObject = prepareChallengeData({\n token: this.props.token,\n size: this.props.challengeWindowSize || this.props.size // TODO confirm that this.props.size is legacy and can be removed\n });\n\n this.state = {\n status: 'init',\n challengeData: challengeData as ChallengeData\n };\n } else {\n // Will be picked up in componentDidMount\n this.state = { challengeData: { success: false, error: MISSING_TOKEN_IN_ACTION_MSG } };\n\n console.debug(`${THREEDS2_CHALLENGE_ERROR}: ${MISSING_TOKEN_IN_ACTION_MSG}`);\n }\n }\n\n public onFormSubmit = (msg: string) => {\n const event = new AnalyticsLogEvent({\n component: this.props.type,\n type: LogEventType.threeDS2,\n subType: LogEventSubtype.challengeDataSentWeb,\n message: msg\n });\n\n this.props.onSubmitAnalytics(event);\n };\n\n componentDidMount() {\n const hasChallengeData = !isErrorObject(this.state.challengeData);\n\n if (hasChallengeData) {\n const shouldAllowHttpDomains =\n /** Allow http urls if in development and testing against localhost:8080 */\n (process.env.NODE_ENV === 'development' && process.env.__CLIENT_ENV__?.indexOf('localhost:8080') > -1) ||\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.apiError,\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.apiError,\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 =\n errorMsg.indexOf(MISSING_TOKEN_IN_ACTION_MSG) > -1\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:\n errorMsg.indexOf(MISSING_TOKEN_IN_ACTION_MSG) > -1\n ? `${ErrorEventCode.THREEDS2_ACTION_IS_MISSING_TOKEN}: ${this.props.i18n.get('err.gen.9102')}`\n : `${ErrorEventCode.THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED}: ${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.apiError,\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 /**\n * Create the data in the way that the /details endpoint expects.\n * This is different for the flow triggered by the threeds2InMDFlow process than for the new, v67, 'threeDS2' action\n */\n const resolveDataFunction = this.props.isMDFlow ? createOldChallengeResolveData : createChallengeResolveData;\n const data: LegacyChallengeResolveData | ChallengeResolveData = resolveDataFunction(\n this.props.dataKey,\n resultObj.transStatus,\n this.props.paymentData\n );\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: finalResObject.errorCode === 'timeout' ? ErrorEventType.network : ErrorEventType.apiError\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.apiError,\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","apiError","message","THREEDS2_CHALLENGE_ERROR","onSubmitAnalytics","console","debug","acsTransID","messageVersion","threeDSServerTransID","cReqData","THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS","setState","status","errorMsg","error","errorCode","indexOf","MISSING_TOKEN_IN_ACTION_MSG","THREEDS2_ACTION_IS_MISSING_TOKEN","THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED","setStatusComplete","resultObj","errorCodeObject","data","isMDFlow","createOldChallengeResolveData","createChallengeResolveData","dataKey","transStatus","paymentData","finalResObject","errorTypeAndCode","THREEDS2_TIMEOUT","THREEDS2_NO_TRANSSTATUS","network","result","AnalyticsLogEvent","LogEventType","threeDS2","subType","LogEventSubtype","challengeCompleted","THREEDS2_NUM","onComplete","errorInfoObj","isFatal","onError","AdyenCheckoutError","ERROR","cause","errorObj","render","_","getImage","useImage","h","DoChallenge3DS2","onCompleteChallenge","challenge","hasOwnProperty","length","errorDescription","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":"gkCAkBA,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,IA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B,KACtBA,KAAMyC,EAAaC,SACnBC,QAASC,EAAgBuC,qBACzB9E,QAAS6E,IAGbtG,KAAKI,MAAMuB,kBAAkBV,KA1BzBjB,KAAKI,MAAMoG,MAAO,CAClB,MAAMtG,EAA6CuG,EAAqB,CACpED,MAAOxG,KAAKI,MAAMoG,MAClBE,KAAM1G,KAAKI,MAAMuG,qBAAuB3G,KAAKI,MAAMsG,OAGvD1G,KAAKC,MAAQ,CACTmC,OAAQ,OACRlC,cAAeA,EAEvB,MAEIF,KAAKC,MAAQ,CAAEC,cAAe,CAAE0G,SAAS,EAAOtE,MAAOG,IAEvDb,QAAQC,MAAM,GAAGH,MAA6Be,IAEtD,EAzBA4D,EADEzG,EACYiH,eAAe,CACzB1C,WAAY,OACZG,QAAS,OACTtB,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, createOldChallengeResolveData, isErrorObject } from '../utils';\nimport { PrepareChallenge3DS2Props, PrepareChallenge3DS2State, StatusErrorInfoObject } from './types';\nimport { ChallengeData, ResultObject, ThreeDS2FlowObject, ErrorCodeObject, LegacyChallengeResolveData, 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 defaultProps = {\n onComplete: () => {},\n onError: () => {},\n isMDFlow: false\n };\n\n constructor(props) {\n super(props);\n\n if (this.props.token) {\n const challengeData: ChallengeData | ErrorObject = prepareChallengeData({\n token: this.props.token,\n size: this.props.challengeWindowSize || this.props.size // TODO confirm that this.props.size is legacy and can be removed\n });\n\n this.state = {\n status: 'init',\n challengeData: challengeData as ChallengeData\n };\n } else {\n // Will be picked up in componentDidMount\n this.state = { challengeData: { success: false, error: MISSING_TOKEN_IN_ACTION_MSG } };\n\n console.debug(`${THREEDS2_CHALLENGE_ERROR}: ${MISSING_TOKEN_IN_ACTION_MSG}`);\n }\n }\n\n public onFormSubmit = (msg: string) => {\n const event = new AnalyticsLogEvent({\n component: this.props.type,\n type: LogEventType.threeDS2,\n subType: LogEventSubtype.challengeDataSentWeb,\n message: msg\n });\n\n this.props.onSubmitAnalytics(event);\n };\n\n componentDidMount() {\n const hasChallengeData = !isErrorObject(this.state.challengeData);\n\n if (hasChallengeData) {\n const shouldAllowHttpDomains =\n /** Allow http urls if in development and testing against localhost:8080 */\n (process.env.NODE_ENV === 'development' && process.env.__CLIENT_ENV__?.indexOf('localhost:8080') > -1) ||\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 =\n errorMsg.indexOf(MISSING_TOKEN_IN_ACTION_MSG) > -1\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:\n errorMsg.indexOf(MISSING_TOKEN_IN_ACTION_MSG) > -1\n ? `${ErrorEventCode.THREEDS2_ACTION_IS_MISSING_TOKEN}: ${this.props.i18n.get('err.gen.9102')}`\n : `${ErrorEventCode.THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED}: ${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 /**\n * Create the data in the way that the /details endpoint expects.\n * This is different for the flow triggered by the threeds2InMDFlow process than for the new, v67, 'threeDS2' action\n */\n const resolveDataFunction = this.props.isMDFlow ? createOldChallengeResolveData : createChallengeResolveData;\n const data: LegacyChallengeResolveData | ChallengeResolveData = resolveDataFunction(\n this.props.dataKey,\n resultObj.transStatus,\n this.props.paymentData\n );\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","indexOf","MISSING_TOKEN_IN_ACTION_MSG","THREEDS2_ACTION_IS_MISSING_TOKEN","THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED","setStatusComplete","resultObj","errorCodeObject","data","isMDFlow","createOldChallengeResolveData","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","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":"gkCAkBA,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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MpG,EAA6CqG,EAAqB,CACpED,MAAOtG,KAAKI,MAAMkG,MAClBE,KAAMxG,KAAKI,MAAMqG,qBAAuBzG,KAAKI,MAAMoG,OAGvDxG,KAAKC,MAAQ,CACTmC,OAAQ,OACRlC,cAAeA,EAEvB,MAEIF,KAAKC,MAAQ,CAAEC,cAAe,CAAEwG,SAAS,EAAOpE,MAAOG,IAEvDb,QAAQC,MAAM,GAAGH,MAA6Be,IAEtD,EAzBA0D,EADEvG,EACY+G,eAAe,CACzB1C,WAAY,OACZG,QAAS,OACTpB,UAAU"}
@@ -1,2 +1,2 @@
1
- import{Component as e,createElement as t}from"../../../../external/preact/dist/preact.js";import r from"./DoFingerprint3DS2.js";import{isErrorObject as o,createOldFingerprintResolveData as s,createFingerprintResolveData as n,prepareFingerPrintData as i}from"../utils.js";import{isValidHttpUrl as a}from"../../../../utils/isValidURL.js";import{THREEDS2_FINGERPRINT_ERROR as p,MISSING_TOKEN_IN_ACTION_MSG as m,TIMEOUT as l,THREEDS2_NUM as c,THREEDS2_FINGERPRINT as d}from"../../constants.js";import{AnalyticsLogEvent as h,LogEventSubtype as S,LogEventType as D}from"../../../../core/Analytics/events/AnalyticsLogEvent.js";import{ErrorEventCode as u,ErrorEventType as g,AnalyticsErrorEvent as f}from"../../../../core/Analytics/events/AnalyticsErrorEvent.js";function E(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class C extends e{componentDidMount(){if(!o(this.state.fingerPrintData)){const e="test"===this.props.environment&&this.props._environmentUrls?.api?.includes("http://localhost:8080"),{threeDSMethodURL:t,threeDSMethodNotificationURL:r,postMessageDomain:o,threeDSServerTransID:s}=this.state.fingerPrintData;if(!a(t,e))return this.setStatusComplete({threeDSCompInd:"U"},{errorCode:u.THREEDS2_TOKEN_IS_MISSING_THREEDSMETHODURL,message:`${p}: Decoded token is missing a valid threeDSMethodURL property`}),void console.debug("### PrepareFingerprint3DS2::exiting:: no valid threeDSMethodURL");const n=a(r,e),i=a(o,e),m=s?.length;if(!n||!i||!m)return this.setStatusComplete({threeDSCompInd:"N"},{errorCode:u.THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS,message:`${p}: Decoded token is missing one or more of the following properties (threeDSMethodNotificationURL | postMessageDomain | threeDSServerTransID)`}),void console.debug("### PrepareFingerprint3DS2::exiting:: Decoded token is missing one or more of the following properties (threeDSMethodNotificationURL | postMessageDomain | threeDSServerTransID)");this.setState({status:"retrievingFingerPrint"})}else{const e=this.state.fingerPrintData.error,t=e.indexOf(m)>-1?u.THREEDS2_ACTION_IS_MISSING_TOKEN:u.THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED;this.setStatusComplete({threeDSCompInd:"N"},{errorCode:t,message:`${p}: ${e}`}),console.debug("### PrepareFingerprint3DS2:: token does not exist or could not be base64 decoded &/or JSON.parsed")}}setStatusComplete(e,t=null){this.setState({status:"complete"},()=>{const r=(this.props.isMDFlow?s:n)(this.props.dataKey,e,this.props.paymentData);let o;const i=t||e;if(i.errorCode){const e={code:i.errorCode===l?u.THREEDS2_TIMEOUT:i.errorCode,errorType:i.errorCode===l?g.network:g.apiError};o=new f({component:this.props.type,message:i.message,...e}),this.props.onSubmitAnalytics(o)}let a;switch(e?.threeDSCompInd){case"Y":a="success";break;case"N":a=t?t.errorCode===l?l:"failedInternal":"failed";break;case"U":a="noThreeDSMethodURL"}o=new h({component:this.props.type,type:D.threeDS2,subType:S.fingerprintCompleted,message:`${c} fingerprinting has completed`,result:a}),this.props.onSubmitAnalytics(o),this.props.onComplete(r)})}render({showSpinner:e},{status:o,fingerPrintData:s}){return"retrievingFingerPrint"===o?t(r,{onCompleteFingerprint:e=>{this.setStatusComplete(e.result)},onErrorFingerprint:e=>{const t={errorCode:e.errorCode,message:`${d}: ${e.errorCode}`};this.setStatusComplete(e.result,t)},showSpinner:e,...s,onActionHandled:this.props.onActionHandled,onFormSubmit:this.onFormSubmit}):null}constructor(e){super(e),E(this,"onFormSubmit",e=>{const t=new h({component:this.props.type,type:D.threeDS2,subType:S.fingerprintDataSentWeb,message:e});this.props.onSubmitAnalytics(t)});const{token:t,notificationURL:r}=this.props;if(t){const e=i({token:t,notificationURL:r});this.state={status:"init",fingerPrintData:e}}else this.state={fingerPrintData:{success:!1,error:m}},console.debug(`${p}: ${m}`)}}E(C,"type","scheme"),E(C,"defaultProps",{onComplete:()=>{},onError:()=>{},paymentData:"",showSpinner:!0,isMDFlow:!1});export{C as default};
1
+ import{Component as e,createElement as t}from"../../../../external/preact/dist/preact.js";import r from"./DoFingerprint3DS2.js";import{isErrorObject as o,createOldFingerprintResolveData as s,createFingerprintResolveData as n,prepareFingerPrintData as i}from"../utils.js";import{isValidHttpUrl as a}from"../../../../utils/isValidURL.js";import{THREEDS2_FINGERPRINT_ERROR as p,MISSING_TOKEN_IN_ACTION_MSG as m,TIMEOUT as l,THREEDS2_NUM as c,THREEDS2_FINGERPRINT as h}from"../../constants.js";import{AnalyticsLogEvent as d,LogEventSubtype as S,LogEventType as D}from"../../../../core/Analytics/events/AnalyticsLogEvent.js";import{ErrorEventCode as u,ErrorEventType as g,AnalyticsErrorEvent as f}from"../../../../core/Analytics/events/AnalyticsErrorEvent.js";function E(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class C extends e{componentDidMount(){if(!o(this.state.fingerPrintData)){const e="test"===this.props.environment&&this.props._environmentUrls?.api?.includes("http://localhost:8080"),{threeDSMethodURL:t,threeDSMethodNotificationURL:r,postMessageDomain:o,threeDSServerTransID:s}=this.state.fingerPrintData;if(!a(t,e))return this.setStatusComplete({threeDSCompInd:"U"},{errorCode:u.THREEDS2_TOKEN_IS_MISSING_THREEDSMETHODURL,message:`${p}: Decoded token is missing a valid threeDSMethodURL property`}),void console.debug("### PrepareFingerprint3DS2::exiting:: no valid threeDSMethodURL");const n=a(r,e),i=a(o,e),m=s?.length;if(!n||!i||!m)return this.setStatusComplete({threeDSCompInd:"N"},{errorCode:u.THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS,message:`${p}: Decoded token is missing one or more of the following properties (threeDSMethodNotificationURL | postMessageDomain | threeDSServerTransID)`}),void console.debug("### PrepareFingerprint3DS2::exiting:: Decoded token is missing one or more of the following properties (threeDSMethodNotificationURL | postMessageDomain | threeDSServerTransID)");this.setState({status:"retrievingFingerPrint"})}else{const e=this.state.fingerPrintData.error,t=e.indexOf(m)>-1?u.THREEDS2_ACTION_IS_MISSING_TOKEN:u.THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED;this.setStatusComplete({threeDSCompInd:"N"},{errorCode:t,message:`${p}: ${e}`}),console.debug("### PrepareFingerprint3DS2:: token does not exist or could not be base64 decoded &/or JSON.parsed")}}setStatusComplete(e,t=null){this.setState({status:"complete"},()=>{const r=(this.props.isMDFlow?s:n)(this.props.dataKey,e,this.props.paymentData);let o;const i=t||e;if(i.errorCode){const e={code:i.errorCode===l?u.THREEDS2_TIMEOUT:i.errorCode,errorType:g.threeDS2};o=new f({component:this.props.type,message:i.message,...e}),this.props.onSubmitAnalytics(o)}let a;switch(e?.threeDSCompInd){case"Y":a="success";break;case"N":a=t?t.errorCode===l?l:"failedInternal":"failed";break;case"U":a="noThreeDSMethodURL"}o=new d({component:this.props.type,type:D.threeDS2,subType:S.fingerprintCompleted,message:`${c} fingerprinting has completed`,result:a}),this.props.onSubmitAnalytics(o),this.props.onComplete(r)})}render({showSpinner:e},{status:o,fingerPrintData:s}){return"retrievingFingerPrint"===o?t(r,{onCompleteFingerprint:e=>{this.setStatusComplete(e.result)},onErrorFingerprint:e=>{const t={errorCode:e.errorCode,message:`${h}: ${e.errorCode}`};this.setStatusComplete(e.result,t)},showSpinner:e,...s,onActionHandled:this.props.onActionHandled,onFormSubmit:this.onFormSubmit}):null}constructor(e){super(e),E(this,"onFormSubmit",e=>{const t=new d({component:this.props.type,type:D.threeDS2,subType:S.fingerprintDataSentWeb,message:e});this.props.onSubmitAnalytics(t)});const{token:t,notificationURL:r}=this.props;if(t){const e=i({token:t,notificationURL:r});this.state={status:"init",fingerPrintData:e}}else this.state={fingerPrintData:{success:!1,error:m}},console.debug(`${p}: ${m}`)}}E(C,"type","scheme"),E(C,"defaultProps",{onComplete:()=>{},onError:()=>{},paymentData:"",showSpinner:!0,isMDFlow:!1});export{C as default};
2
2
  //# sourceMappingURL=PrepareFingerprint3DS2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PrepareFingerprint3DS2.js","sources":["../../../../../../src/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport DoFingerprint3DS2 from './DoFingerprint3DS2';\nimport { createFingerprintResolveData, createOldFingerprintResolveData, isErrorObject, prepareFingerPrintData } from '../utils';\nimport { PrepareFingerprint3DS2Props, PrepareFingerprint3DS2State } from './types';\nimport { FingerPrintData, ResultObject, ErrorCodeObject, LegacyFingerprintResolveData, FingerprintResolveData } from '../../types';\nimport { ErrorObject } from '../../../../core/Errors/types';\nimport { isValidHttpUrl } from '../../../../utils/isValidURL';\nimport { THREEDS2_FINGERPRINT, THREEDS2_FINGERPRINT_ERROR, THREEDS2_NUM, MISSING_TOKEN_IN_ACTION_MSG, TIMEOUT } from '../../constants';\nimport { AnalyticsLogEvent, LogEventSubtype, LogEventType } from '../../../../core/Analytics/events/AnalyticsLogEvent';\nimport { AbstractAnalyticsEvent } from '../../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { AnalyticsErrorEvent, ErrorEventCode, ErrorEventType } from '../../../../core/Analytics/events/AnalyticsErrorEvent';\n\nclass PrepareFingerprint3DS2 extends Component<PrepareFingerprint3DS2Props, PrepareFingerprint3DS2State> {\n public static type = 'scheme';\n\n public static defaultProps = {\n onComplete: () => {},\n onError: () => {},\n paymentData: '',\n showSpinner: true,\n isMDFlow: false\n };\n\n constructor(props) {\n super(props);\n const { token, notificationURL } = this.props; // See comments on prepareFingerPrintData regarding notificationURL\n\n if (token) {\n const fingerPrintData: FingerPrintData | ErrorObject = prepareFingerPrintData({ token, notificationURL });\n\n this.state = {\n status: 'init',\n fingerPrintData: fingerPrintData as FingerPrintData\n };\n } else {\n // Will be picked up in componentDidMount\n this.state = { fingerPrintData: { success: false, error: MISSING_TOKEN_IN_ACTION_MSG } };\n\n console.debug(`${THREEDS2_FINGERPRINT_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.fingerprintDataSentWeb,\n message: msg\n });\n\n this.props.onSubmitAnalytics(event);\n };\n\n componentDidMount() {\n const hasFingerPrintData = !isErrorObject(this.state.fingerPrintData);\n\n if (hasFingerPrintData) {\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__?.indexOf('localhost:8080') > -1) ||\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 fingerPrintData\n */\n const { threeDSMethodURL, threeDSMethodNotificationURL, postMessageDomain, threeDSServerTransID } = this.state\n .fingerPrintData as FingerPrintData;\n\n const hasValid3DSMethodURL = isValidHttpUrl(threeDSMethodURL, shouldAllowHttpDomains);\n\n // Only render component if we have a threeDSMethodURL. Otherwise, exit with threeDSCompInd: 'U'\n if (!hasValid3DSMethodURL) {\n this.setStatusComplete(\n { threeDSCompInd: 'U' },\n {\n errorCode: ErrorEventCode.THREEDS2_TOKEN_IS_MISSING_THREEDSMETHODURL,\n message: `${THREEDS2_FINGERPRINT_ERROR}: Decoded token is missing a valid threeDSMethodURL property`\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\n console.debug('### PrepareFingerprint3DS2::exiting:: no valid threeDSMethodURL');\n return;\n }\n\n const hasValid3DSMethodNotificationURL = isValidHttpUrl(threeDSMethodNotificationURL, shouldAllowHttpDomains);\n const hasValidPostMessageDomain = isValidHttpUrl(postMessageDomain, shouldAllowHttpDomains);\n const hasTransServerID = threeDSServerTransID?.length;\n\n if (!hasValid3DSMethodNotificationURL || !hasValidPostMessageDomain || !hasTransServerID) {\n /**\n * NOTE: EMVCo_3DS_CoreSpec_v2.3.1_20220831.pdf states that we should return: threeDSCompInd: 'N'\n * when the fingerprinting process \"Did not run or did not successfully complete\"\n */\n this.setStatusComplete(\n { threeDSCompInd: 'N' },\n {\n errorCode: ErrorEventCode.THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS,\n message: `${THREEDS2_FINGERPRINT_ERROR}: Decoded token is missing one or more of the following properties (threeDSMethodNotificationURL | postMessageDomain | threeDSServerTransID)`\n }\n );\n\n console.debug(\n '### PrepareFingerprint3DS2::exiting:: Decoded token is missing one or more of the following properties (threeDSMethodNotificationURL | postMessageDomain | threeDSServerTransID)'\n );\n\n return;\n }\n\n // Proceed to allow component to render\n this.setState({ status: 'retrievingFingerPrint' });\n //\n } else {\n // Only render component if we have fingerPrintData. Otherwise, complete with threeDSCompInd: 'N'\n\n const errorMsg: string = (this.state.fingerPrintData as ErrorObject).error;\n\n const errorCode =\n errorMsg.indexOf(MISSING_TOKEN_IN_ACTION_MSG) > -1\n ? ErrorEventCode.THREEDS2_ACTION_IS_MISSING_TOKEN\n : ErrorEventCode.THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED;\n\n this.setStatusComplete(\n { threeDSCompInd: 'N' },\n {\n errorCode,\n message: `${THREEDS2_FINGERPRINT_ERROR}: ${errorMsg}` // can be: 'Missing \"token\" property from threeDS2 action', 'not base64', 'malformed URI sequence' or 'Could not JSON parse token'\n }\n );\n\n console.debug('### PrepareFingerprint3DS2:: token does not exist or could not be base64 decoded &/or JSON.parsed');\n }\n }\n\n setStatusComplete(resultObj: ResultObject, errorCodeObject: ErrorCodeObject = null) {\n this.setState({ status: 'complete' }, () => {\n /**\n * Create the data in the way that the /details endpoint expects.\n * This is different for the flow triggered by the threeds2InMDFlow process than for the new, v67, 'threeDS2' action\n */\n const resolveDataFunction = this.props.isMDFlow ? createOldFingerprintResolveData : createFingerprintResolveData;\n const data: LegacyFingerprintResolveData | FingerprintResolveData = resolveDataFunction(\n this.props.dataKey,\n resultObj,\n this.props.paymentData\n );\n\n let event: AbstractAnalyticsEvent;\n\n /** Are we in an error 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 : finalResObject.errorCode,\n errorType: finalResObject.errorCode === TIMEOUT ? ErrorEventType.network : ErrorEventType.apiError\n };\n\n /**\n * Timeout or data parsing problems:\n *\n * (threeDSCompInd:\"U\"):\n * - Decoded token is missing a valid threeDSMethodURL property,\n * or, (threeDSCompInd:\"N\"):\n * - Fingerprint process has timed out,\n * also, (threeDSCompInd:\"N\"):\n * - Missing \"token\" property from threeDS2 action\n * - or, decoded token is missing one or more of the following properties (threeDSMethodNotificationURL | postMessageDomain | threeDSServerTransID)\n * - or, token could not be base64 decoded &/or JSON.parsed\n */\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?.threeDSCompInd) {\n case 'Y':\n result = 'success';\n break;\n case 'N': {\n if (!errorCodeObject) {\n result = 'failed'; // 'failed' is the result returned from the threeDSMethodURL\n } else {\n result = errorCodeObject.errorCode === TIMEOUT ? TIMEOUT : 'failedInternal'; // timed-out; or, 'failed' as a result of internal checks\n }\n break;\n }\n case 'U':\n result = 'noThreeDSMethodURL';\n break;\n default:\n }\n\n /**\n * The fingerprint process is completed, one way or another.\n * The resultObj will be {threeDSCompInd:\"Y\"} in the case of success,\n * else {threeDSCompInd:\"U\"} or {threeDSCompInd:\"N\"} - if we've had some kind of timeout or data parsing problem (as described above)\n */\n\n event = new AnalyticsLogEvent({\n component: this.props.type,\n type: LogEventType.threeDS2,\n subType: LogEventSubtype.fingerprintCompleted,\n message: `${THREEDS2_NUM} fingerprinting has completed`,\n result\n });\n // Send log to analytics endpoint\n this.props.onSubmitAnalytics(event);\n\n /**\n * Equals call to callSubmit3DS2Fingerprint (except for in 3DS2InMDFlow)\n */\n this.props.onComplete(data);\n });\n }\n\n render({ showSpinner }, { status, fingerPrintData }) {\n if (status === 'retrievingFingerPrint') {\n return (\n <DoFingerprint3DS2\n onCompleteFingerprint={fingerprint => {\n this.setStatusComplete(fingerprint.result);\n }}\n onErrorFingerprint={fingerprint => {\n /**\n * Called when fingerprint times-out (which is still a valid scenario)...\n */\n const timeoutObject: ErrorCodeObject = {\n errorCode: fingerprint.errorCode, // 'timeout'\n message: `${THREEDS2_FINGERPRINT}: ${fingerprint.errorCode}`\n };\n\n this.setStatusComplete(fingerprint.result, timeoutObject); // fingerprint.result = threeDSCompInd: 'N'\n }}\n showSpinner={showSpinner}\n {...fingerPrintData}\n onActionHandled={this.props.onActionHandled}\n onFormSubmit={this.onFormSubmit}\n />\n );\n }\n\n return null;\n }\n}\n\nexport default PrepareFingerprint3DS2;\n"],"names":["PrepareFingerprint3DS2","Component","componentDidMount","isErrorObject","this","state","fingerPrintData","shouldAllowHttpDomains","props","environment","_environmentUrls","api","includes","threeDSMethodURL","threeDSMethodNotificationURL","postMessageDomain","threeDSServerTransID","isValidHttpUrl","setStatusComplete","threeDSCompInd","errorCode","ErrorEventCode","THREEDS2_TOKEN_IS_MISSING_THREEDSMETHODURL","message","THREEDS2_FINGERPRINT_ERROR","console","debug","hasValid3DSMethodNotificationURL","hasValidPostMessageDomain","hasTransServerID","length","THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS","setState","status","errorMsg","error","indexOf","MISSING_TOKEN_IN_ACTION_MSG","THREEDS2_ACTION_IS_MISSING_TOKEN","THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED","resultObj","errorCodeObject","data","isMDFlow","createOldFingerprintResolveData","createFingerprintResolveData","dataKey","paymentData","event","finalResObject","errorTypeAndCode","code","TIMEOUT","THREEDS2_TIMEOUT","errorType","ErrorEventType","network","apiError","AnalyticsErrorEvent","component","type","onSubmitAnalytics","result","AnalyticsLogEvent","LogEventType","threeDS2","subType","LogEventSubtype","fingerprintCompleted","THREEDS2_NUM","onComplete","render","showSpinner","h","DoFingerprint3DS2","onCompleteFingerprint","fingerprint","onErrorFingerprint","timeoutObject","THREEDS2_FINGERPRINT","onActionHandled","onFormSubmit","constructor","super","_define_property","msg","fingerprintDataSentWeb","token","notificationURL","prepareFingerPrintData","success","defaultProps","onError"],"mappings":"22BAYA,MAAMA,UAA+BC,EAyCjCC,iBAAAA,GAGI,IAF4BC,EAAcC,KAAKC,MAAMC,iBAE7B,CACpB,MAAMC,EAO0B,SAA3BH,KAAKI,MAAMC,aAA0BL,KAAKI,MAAME,kBAAkBC,KAAKC,SAAS,0BAK/EC,iBAAEA,EAAgBC,6BAAEA,EAA4BC,kBAAEA,EAAiBC,qBAAEA,GAAyBZ,KAAKC,MACpGC,gBAKL,IAH6BW,EAAeJ,EAAkBN,GAoB1D,OAhBAH,KAAKc,kBACD,CAAEC,eAAgB,KAClB,CACIC,UAAWC,EAAeC,2CAC1BC,QAAS,GAAGC,uEAWpBC,QAAQC,MAAM,mEAIlB,MAAMC,EAAmCV,EAAeH,EAA8BP,GAChFqB,EAA4BX,EAAeF,EAAmBR,GAC9DsB,EAAmBb,GAAsBc,OAE/C,IAAKH,IAAqCC,IAA8BC,EA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2/components/DeviceFingerprint/PrepareFingerprint3DS2.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport DoFingerprint3DS2 from './DoFingerprint3DS2';\nimport { createFingerprintResolveData, createOldFingerprintResolveData, isErrorObject, prepareFingerPrintData } from '../utils';\nimport { PrepareFingerprint3DS2Props, PrepareFingerprint3DS2State } from './types';\nimport { FingerPrintData, ResultObject, ErrorCodeObject, LegacyFingerprintResolveData, FingerprintResolveData } from '../../types';\nimport { ErrorObject } from '../../../../core/Errors/types';\nimport { isValidHttpUrl } from '../../../../utils/isValidURL';\nimport { THREEDS2_FINGERPRINT, THREEDS2_FINGERPRINT_ERROR, THREEDS2_NUM, MISSING_TOKEN_IN_ACTION_MSG, TIMEOUT } from '../../constants';\nimport { AnalyticsLogEvent, LogEventSubtype, LogEventType } from '../../../../core/Analytics/events/AnalyticsLogEvent';\nimport { AbstractAnalyticsEvent } from '../../../../core/Analytics/events/AbstractAnalyticsEvent';\nimport { AnalyticsErrorEvent, ErrorEventCode, ErrorEventType } from '../../../../core/Analytics/events/AnalyticsErrorEvent';\n\nclass PrepareFingerprint3DS2 extends Component<PrepareFingerprint3DS2Props, PrepareFingerprint3DS2State> {\n public static type = 'scheme';\n\n public static defaultProps = {\n onComplete: () => {},\n onError: () => {},\n paymentData: '',\n showSpinner: true,\n isMDFlow: false\n };\n\n constructor(props) {\n super(props);\n const { token, notificationURL } = this.props; // See comments on prepareFingerPrintData regarding notificationURL\n\n if (token) {\n const fingerPrintData: FingerPrintData | ErrorObject = prepareFingerPrintData({ token, notificationURL });\n\n this.state = {\n status: 'init',\n fingerPrintData: fingerPrintData as FingerPrintData\n };\n } else {\n // Will be picked up in componentDidMount\n this.state = { fingerPrintData: { success: false, error: MISSING_TOKEN_IN_ACTION_MSG } };\n\n console.debug(`${THREEDS2_FINGERPRINT_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.fingerprintDataSentWeb,\n message: msg\n });\n\n this.props.onSubmitAnalytics(event);\n };\n\n componentDidMount() {\n const hasFingerPrintData = !isErrorObject(this.state.fingerPrintData);\n\n if (hasFingerPrintData) {\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__?.indexOf('localhost:8080') > -1) ||\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 fingerPrintData\n */\n const { threeDSMethodURL, threeDSMethodNotificationURL, postMessageDomain, threeDSServerTransID } = this.state\n .fingerPrintData as FingerPrintData;\n\n const hasValid3DSMethodURL = isValidHttpUrl(threeDSMethodURL, shouldAllowHttpDomains);\n\n // Only render component if we have a threeDSMethodURL. Otherwise, exit with threeDSCompInd: 'U'\n if (!hasValid3DSMethodURL) {\n this.setStatusComplete(\n { threeDSCompInd: 'U' },\n {\n errorCode: ErrorEventCode.THREEDS2_TOKEN_IS_MISSING_THREEDSMETHODURL,\n message: `${THREEDS2_FINGERPRINT_ERROR}: Decoded token is missing a valid threeDSMethodURL property`\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\n console.debug('### PrepareFingerprint3DS2::exiting:: no valid threeDSMethodURL');\n return;\n }\n\n const hasValid3DSMethodNotificationURL = isValidHttpUrl(threeDSMethodNotificationURL, shouldAllowHttpDomains);\n const hasValidPostMessageDomain = isValidHttpUrl(postMessageDomain, shouldAllowHttpDomains);\n const hasTransServerID = threeDSServerTransID?.length;\n\n if (!hasValid3DSMethodNotificationURL || !hasValidPostMessageDomain || !hasTransServerID) {\n /**\n * NOTE: EMVCo_3DS_CoreSpec_v2.3.1_20220831.pdf states that we should return: threeDSCompInd: 'N'\n * when the fingerprinting process \"Did not run or did not successfully complete\"\n */\n this.setStatusComplete(\n { threeDSCompInd: 'N' },\n {\n errorCode: ErrorEventCode.THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS,\n message: `${THREEDS2_FINGERPRINT_ERROR}: Decoded token is missing one or more of the following properties (threeDSMethodNotificationURL | postMessageDomain | threeDSServerTransID)`\n }\n );\n\n console.debug(\n '### PrepareFingerprint3DS2::exiting:: Decoded token is missing one or more of the following properties (threeDSMethodNotificationURL | postMessageDomain | threeDSServerTransID)'\n );\n\n return;\n }\n\n // Proceed to allow component to render\n this.setState({ status: 'retrievingFingerPrint' });\n //\n } else {\n // Only render component if we have fingerPrintData. Otherwise, complete with threeDSCompInd: 'N'\n\n const errorMsg: string = (this.state.fingerPrintData as ErrorObject).error;\n\n const errorCode =\n errorMsg.indexOf(MISSING_TOKEN_IN_ACTION_MSG) > -1\n ? ErrorEventCode.THREEDS2_ACTION_IS_MISSING_TOKEN\n : ErrorEventCode.THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED;\n\n this.setStatusComplete(\n { threeDSCompInd: 'N' },\n {\n errorCode,\n message: `${THREEDS2_FINGERPRINT_ERROR}: ${errorMsg}` // can be: 'Missing \"token\" property from threeDS2 action', 'not base64', 'malformed URI sequence' or 'Could not JSON parse token'\n }\n );\n\n console.debug('### PrepareFingerprint3DS2:: token does not exist or could not be base64 decoded &/or JSON.parsed');\n }\n }\n\n setStatusComplete(resultObj: ResultObject, errorCodeObject: ErrorCodeObject = null) {\n this.setState({ status: 'complete' }, () => {\n /**\n * Create the data in the way that the /details endpoint expects.\n * This is different for the flow triggered by the threeds2InMDFlow process than for the new, v67, 'threeDS2' action\n */\n const resolveDataFunction = this.props.isMDFlow ? createOldFingerprintResolveData : createFingerprintResolveData;\n const data: LegacyFingerprintResolveData | FingerprintResolveData = resolveDataFunction(\n this.props.dataKey,\n resultObj,\n this.props.paymentData\n );\n\n let event: AbstractAnalyticsEvent;\n\n /** Are we in an error 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 : finalResObject.errorCode,\n errorType: ErrorEventType.threeDS2\n };\n\n /**\n * Timeout or data parsing problems:\n *\n * (threeDSCompInd:\"U\"):\n * - Decoded token is missing a valid threeDSMethodURL property,\n * or, (threeDSCompInd:\"N\"):\n * - Fingerprint process has timed out,\n * also, (threeDSCompInd:\"N\"):\n * - Missing \"token\" property from threeDS2 action\n * - or, decoded token is missing one or more of the following properties (threeDSMethodNotificationURL | postMessageDomain | threeDSServerTransID)\n * - or, token could not be base64 decoded &/or JSON.parsed\n */\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?.threeDSCompInd) {\n case 'Y':\n result = 'success';\n break;\n case 'N': {\n if (!errorCodeObject) {\n result = 'failed'; // 'failed' is the result returned from the threeDSMethodURL\n } else {\n result = errorCodeObject.errorCode === TIMEOUT ? TIMEOUT : 'failedInternal'; // timed-out; or, 'failed' as a result of internal checks\n }\n break;\n }\n case 'U':\n result = 'noThreeDSMethodURL';\n break;\n default:\n }\n\n /**\n * The fingerprint process is completed, one way or another.\n * The resultObj will be {threeDSCompInd:\"Y\"} in the case of success,\n * else {threeDSCompInd:\"U\"} or {threeDSCompInd:\"N\"} - if we've had some kind of timeout or data parsing problem (as described above)\n */\n\n event = new AnalyticsLogEvent({\n component: this.props.type,\n type: LogEventType.threeDS2,\n subType: LogEventSubtype.fingerprintCompleted,\n message: `${THREEDS2_NUM} fingerprinting has completed`,\n result\n });\n // Send log to analytics endpoint\n this.props.onSubmitAnalytics(event);\n\n /**\n * Equals call to callSubmit3DS2Fingerprint (except for in 3DS2InMDFlow)\n */\n this.props.onComplete(data);\n });\n }\n\n render({ showSpinner }, { status, fingerPrintData }) {\n if (status === 'retrievingFingerPrint') {\n return (\n <DoFingerprint3DS2\n onCompleteFingerprint={fingerprint => {\n this.setStatusComplete(fingerprint.result);\n }}\n onErrorFingerprint={fingerprint => {\n /**\n * Called when fingerprint times-out (which is still a valid scenario)...\n */\n const timeoutObject: ErrorCodeObject = {\n errorCode: fingerprint.errorCode, // 'timeout'\n message: `${THREEDS2_FINGERPRINT}: ${fingerprint.errorCode}`\n };\n\n this.setStatusComplete(fingerprint.result, timeoutObject); // fingerprint.result = threeDSCompInd: 'N'\n }}\n showSpinner={showSpinner}\n {...fingerPrintData}\n onActionHandled={this.props.onActionHandled}\n onFormSubmit={this.onFormSubmit}\n />\n );\n }\n\n return null;\n }\n}\n\nexport default PrepareFingerprint3DS2;\n"],"names":["PrepareFingerprint3DS2","Component","componentDidMount","isErrorObject","this","state","fingerPrintData","shouldAllowHttpDomains","props","environment","_environmentUrls","api","includes","threeDSMethodURL","threeDSMethodNotificationURL","postMessageDomain","threeDSServerTransID","isValidHttpUrl","setStatusComplete","threeDSCompInd","errorCode","ErrorEventCode","THREEDS2_TOKEN_IS_MISSING_THREEDSMETHODURL","message","THREEDS2_FINGERPRINT_ERROR","console","debug","hasValid3DSMethodNotificationURL","hasValidPostMessageDomain","hasTransServerID","length","THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS","setState","status","errorMsg","error","indexOf","MISSING_TOKEN_IN_ACTION_MSG","THREEDS2_ACTION_IS_MISSING_TOKEN","THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED","resultObj","errorCodeObject","data","isMDFlow","createOldFingerprintResolveData","createFingerprintResolveData","dataKey","paymentData","event","finalResObject","errorTypeAndCode","code","TIMEOUT","THREEDS2_TIMEOUT","errorType","ErrorEventType","threeDS2","AnalyticsErrorEvent","component","type","onSubmitAnalytics","result","AnalyticsLogEvent","LogEventType","subType","LogEventSubtype","fingerprintCompleted","THREEDS2_NUM","onComplete","render","showSpinner","h","DoFingerprint3DS2","onCompleteFingerprint","fingerprint","onErrorFingerprint","timeoutObject","THREEDS2_FINGERPRINT","onActionHandled","onFormSubmit","constructor","super","_define_property","msg","fingerprintDataSentWeb","token","notificationURL","prepareFingerPrintData","success","defaultProps","onError"],"mappings":"22BAYA,MAAMA,UAA+BC,EAyCjCC,iBAAAA,GAGI,IAF4BC,EAAcC,KAAKC,MAAMC,iBAE7B,CACpB,MAAMC,EAO0B,SAA3BH,KAAKI,MAAMC,aAA0BL,KAAKI,MAAME,kBAAkBC,KAAKC,SAAS,0BAK/EC,iBAAEA,EAAgBC,6BAAEA,EAA4BC,kBAAEA,EAAiBC,qBAAEA,GAAyBZ,KAAKC,MACpGC,gBAKL,IAH6BW,EAAeJ,EAAkBN,GAoB1D,OAhBAH,KAAKc,kBACD,CAAEC,eAAgB,KAClB,CACIC,UAAWC,EAAeC,2CAC1BC,QAAS,GAAGC,uEAWpBC,QAAQC,MAAM,mEAIlB,MAAMC,EAAmCV,EAAeH,EAA8BP,GAChFqB,EAA4BX,EAAeF,EAAmBR,GAC9DsB,EAAmBb,GAAsBc,OAE/C,IAAKH,IAAqCC,IAA8BC,EAiBpE,OAZAzB,KAAKc,kBACD,CAAEC,eAAgB,KAClB,CACIC,UAAWC,EAAeU,sCAC1BR,QAAS,GAAGC,uJAIpBC,QAAQC,MACJ,oLAORtB,KAAK4B,SAAS,CAAEC,OAAQ,yBAE5B,KAAO,CAGH,MAAMC,EAAmB9B,KAAMC,MAAMC,gBAAgC6B,MAE/Df,EACFc,EAASE,QAAQC,IAA+B,EAC1ChB,EAAeiB,iCACfjB,EAAekB,wCAEzBnC,KAAKc,kBACD,CAAEC,eAAgB,KAClB,CACIC,YACAG,QAAS,GAAGC,MAA+BU,M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