@adyen/adyen-web 6.36.0 → 6.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/adyen.css +2 -2
- package/dist/cjs/adyen.css.map +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +13 -7
- package/dist/es/adyen.css +2 -2
- package/dist/es/adyen.css.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/BrandIcon.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/CVC.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/CVC.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/CVCHint.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/CVCHint.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/components/ExpirationDate.js +1 -1
- package/dist/es/components/Card/components/CardInput/components/ExpirationDate.js.map +1 -1
- package/dist/es/components/PayTo/components/PayToComponent.js +1 -1
- package/dist/es/components/PayTo/components/PayToComponent.js.map +1 -1
- package/dist/es/components/ThreeDS2/ThreeDS2Challenge.js +1 -1
- package/dist/es/components/ThreeDS2/ThreeDS2Challenge.js.map +1 -1
- package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js +1 -1
- package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
- package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
- package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
- package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js +1 -1
- package/dist/es/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
- package/dist/es/components/ThreeDS2/components/utils.js +1 -1
- package/dist/es/components/ThreeDS2/components/utils.js.map +1 -1
- package/dist/es/components/UPI/UPI.js +1 -1
- package/dist/es/components/UPI/UPI.js.map +1 -1
- package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
- package/dist/es/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
- package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js +1 -1
- package/dist/es/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js.map +1 -1
- package/dist/es/components/UPI/constants.js +1 -1
- package/dist/es/components/UPI/constants.js.map +1 -1
- package/dist/es/components/internal/FormFields/Select/components/SelectButton.js +1 -1
- package/dist/es/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
- package/dist/es/components/internal/SegmentedControl/SegmentedControl.js +1 -1
- package/dist/es/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/es/components/internal/SegmentedControl/SegmentedControlRegion.js +1 -1
- package/dist/es/components/internal/SegmentedControl/SegmentedControlRegion.js.map +1 -1
- package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
- package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
- package/dist/es/core/ProcessResponse/PaymentAction/actionTypes.js +1 -1
- package/dist/es/core/ProcessResponse/PaymentAction/actionTypes.js.map +1 -1
- package/dist/es/core/config.js +1 -1
- package/dist/es/index.d.ts +13 -7
- package/dist/es-legacy/adyen.css +2 -2
- package/dist/es-legacy/adyen.css.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/BrandIcon.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CVC.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CVC.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CVCHint.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/CVCHint.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/ExpirationDate.js +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/components/ExpirationDate.js.map +1 -1
- package/dist/es-legacy/components/PayTo/components/PayToComponent.js +1 -1
- package/dist/es-legacy/components/PayTo/components/PayToComponent.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/ThreeDS2Challenge.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/ThreeDS2Challenge.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/PrepareFingerprint3DS2.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/utils.js +1 -1
- package/dist/es-legacy/components/ThreeDS2/components/utils.js.map +1 -1
- package/dist/es-legacy/components/UPI/UPI.js +1 -1
- package/dist/es-legacy/components/UPI/UPI.js.map +1 -1
- package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js +1 -1
- package/dist/es-legacy/components/UPI/components/UPIComponent/UPIComponent.js.map +1 -1
- package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js +1 -1
- package/dist/es-legacy/components/UPI/components/UPIIntentAppList/UPIIntentAppList.js.map +1 -1
- package/dist/es-legacy/components/UPI/constants.js +1 -1
- package/dist/es-legacy/components/UPI/constants.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
- package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js +1 -1
- package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControlRegion.js +1 -1
- package/dist/es-legacy/components/internal/SegmentedControl/SegmentedControlRegion.js.map +1 -1
- package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
- package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
- package/dist/es-legacy/core/ProcessResponse/PaymentAction/actionTypes.js +1 -1
- package/dist/es-legacy/core/ProcessResponse/PaymentAction/actionTypes.js.map +1 -1
- package/dist/es-legacy/core/config.js +1 -1
- package/package.json +2 -2
- package/styles/adyen.css +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as r}from"../../../../../external/preact/dist/preact.js";import{getCardImageUrl as a,getFullBrandName as n}from"../utils.js";import e from"../../../../../core/Context/useImage.js";import{BrandImage as o}from"../../../../internal/BrandImage/BrandImage.js";function t({brand:t,brandsConfiguration:c}){var d,i;const m=e(),s="card"===t?"nocard":t,
|
|
1
|
+
import{createElement as r}from"../../../../../external/preact/dist/preact.js";import{getCardImageUrl as a,getFullBrandName as n}from"../utils.js";import e from"../../../../../core/Context/useImage.js";import{BrandImage as o}from"../../../../internal/BrandImage/BrandImage.js";function t({brand:t,brandsConfiguration:c}){var d,i;const m=e(),s="card"===t,l=s?"nocard":t,u=null!==(d=null==c||null===(i=c[t])||void 0===i?void 0:i.icon)&&void 0!==d?d:a(l,m);return r(o,{imgClassName:"adyen-checkout-card-input__icon adyen-checkout__card__cardNumber__brandIcon",alt:s?"":n(t),src:u})}export{t as default};
|
|
2
2
|
//# sourceMappingURL=BrandIcon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrandIcon.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/BrandIcon.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { getCardImageUrl, getFullBrandName } from '../utils';\nimport { BrandIconProps } from './types';\nimport useImage from '../../../../../core/Context/useImage';\nimport { BrandImage } from '../../../../internal/BrandImage';\n\nexport default function BrandIcon({ brand, brandsConfiguration }: Readonly<BrandIconProps>) {\n const getImage = useImage();\n const
|
|
1
|
+
{"version":3,"file":"BrandIcon.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/BrandIcon.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { getCardImageUrl, getFullBrandName } from '../utils';\nimport { BrandIconProps } from './types';\nimport useImage from '../../../../../core/Context/useImage';\nimport { BrandImage } from '../../../../internal/BrandImage';\n\nexport default function BrandIcon({ brand, brandsConfiguration }: Readonly<BrandIconProps>) {\n const getImage = useImage();\n const isPlaceholderIcon = brand === 'card';\n const imageName = isPlaceholderIcon ? 'nocard' : brand;\n const imageUrl = brandsConfiguration?.[brand]?.icon ?? getCardImageUrl(imageName, getImage);\n const imgClassName = `adyen-checkout-card-input__icon adyen-checkout__card__cardNumber__brandIcon`;\n\n return <BrandImage imgClassName={imgClassName} alt={isPlaceholderIcon ? '' : getFullBrandName(brand)} src={imageUrl} />;\n}\n"],"names":["BrandIcon","brand","brandsConfiguration","getImage","useImage","isPlaceholderIcon","imageName","imageUrl","icon","_ref","getCardImageUrl","h","BrandImage","imgClassName","alt","getFullBrandName","src"],"mappings":"oRAMe,SAASA,GAAUC,MAAEA,EAAKC,oBAAEA,UAItBA,EAHjB,MAAMC,EAAWC,IACXC,EAA8B,SAAVJ,EACpBK,EAAYD,EAAoB,SAAWJ,EAC3CM,EAA6C,QAA7CA,EAAWL,SAA4B,QAA5BA,EAAAA,EAAsBD,UAAtBC,IAAAA,SAAAA,EAA8BM,YAAI,IAAAC,EAAAA,EAAIC,EAAgBJ,EAAWH,GAGlF,OAAOQ,EAACC,EAAAA,CAAWC,aAFE,8EAE0BC,IAAKT,EAAoB,GAAKU,EAAiBd,GAAQe,IAAKT,GAC/G"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../../../external/preact/dist/preact.js";import t from"../../../../../_virtual/index.js";import o from"./CVCHint.js";import i from"../../../../internal/FormFields/Field/Field.js";import{useCoreContext as r}from"../../../../../core/Context/CoreProvider.js";import{CVC_POLICY_REQUIRED as
|
|
1
|
+
import{createElement as e}from"../../../../../external/preact/dist/preact.js";import t from"../../../../../_virtual/index.js";import o from"./CVCHint.js";import i from"../../../../internal/FormFields/Field/Field.js";import{useCoreContext as r}from"../../../../../core/Context/CoreProvider.js";import{CVC_POLICY_REQUIRED as n,CVC_POLICY_OPTIONAL as a,CVC_POLICY_HIDDEN as c,ENCRYPTED_SECURITY_CODE as l}from"../../../../internal/SecuredFields/lib/constants.js";import d from"./DataSfSpan.js";import{alternativeLabelContent as s}from"./FieldLabelAlternative.js";function u(u){const{label:_,onFocusField:m=()=>{},error:p="",className:f="",classNameModifiers:C=[],focused:y,filled:h,isValid:x,frontCVC:F=!1,cvcPolicy:k=n,showContextualElement:v,contextualText:b}=u,{i18n:j}=r(),V=t(f,{"adyen-checkout__field__cvc":!0,"adyen-checkout__card__cvc__input--hidden":k===c,"adyen-checkout__field__cvc--optional":k===a}),N=t({"adyen-checkout__input":!0,"adyen-checkout__input--small":!0,"adyen-checkout__card__cvc__input":!0,"adyen-checkout__input--error":p,"adyen-checkout__input--focus":y,"adyen-checkout__input--valid":x}),T=k!==a?_:j.get("creditCard.securityCode.label.optional");return e(i,{label:T,focused:y,filled:h,classNameModifiers:[...C,"securityCode"],onFocusField:()=>m(l),className:V,errorMessage:p,isValid:x,dir:"ltr",name:l,i18n:j,contextVisibleToScreenReader:!1,useLabelElement:!1,renderAlternativeToLabel:s,showContextualElement:v,contextualText:b,onInputContainerClick:()=>{m(l)}},e(d,{encryptedFieldType:l,className:N}),e(o,{frontCVC:F}))}export{u as default};
|
|
2
2
|
//# sourceMappingURL=CVC.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CVC.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CVC.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport CVCHint from './CVCHint';\nimport Field from '../../../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { CVCProps } from './types';\nimport {\n CVC_POLICY_HIDDEN,\n CVC_POLICY_OPTIONAL,\n CVC_POLICY_REQUIRED,\n ENCRYPTED_SECURITY_CODE\n} from '../../../../internal/SecuredFields/lib/constants';\nimport DataSfSpan from './DataSfSpan';\nimport { alternativeLabelContent } from './FieldLabelAlternative';\nimport './CVC.scss';\n\nexport default function CVC(props: Readonly<CVCProps>) {\n const {\n label,\n onFocusField = () => {},\n error = '',\n className = '',\n classNameModifiers = [],\n focused,\n filled,\n isValid,\n frontCVC = false,\n cvcPolicy = CVC_POLICY_REQUIRED,\n showContextualElement,\n contextualText\n } = props;\n const { i18n } = useCoreContext();\n\n const fieldClassnames = classNames(className, {\n 'adyen-checkout__field__cvc': true,\n 'adyen-checkout__card__cvc__input--hidden': cvcPolicy === CVC_POLICY_HIDDEN,\n 'adyen-checkout__field__cvc--optional': cvcPolicy === CVC_POLICY_OPTIONAL\n });\n\n const cvcClassnames = classNames({\n 'adyen-checkout__input': true,\n 'adyen-checkout__input--small': true,\n 'adyen-checkout__card__cvc__input': true,\n 'adyen-checkout__input--error': error,\n 'adyen-checkout__input--focus': focused,\n 'adyen-checkout__input--valid': isValid\n });\n\n const fieldLabel = cvcPolicy !== CVC_POLICY_OPTIONAL ? label : i18n.get('creditCard.securityCode.label.optional');\n\n const handleIconClick = () => {\n onFocusField(ENCRYPTED_SECURITY_CODE);\n };\n\n
|
|
1
|
+
{"version":3,"file":"CVC.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CVC.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport CVCHint from './CVCHint';\nimport Field from '../../../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { CVCProps } from './types';\nimport {\n CVC_POLICY_HIDDEN,\n CVC_POLICY_OPTIONAL,\n CVC_POLICY_REQUIRED,\n ENCRYPTED_SECURITY_CODE\n} from '../../../../internal/SecuredFields/lib/constants';\nimport DataSfSpan from './DataSfSpan';\nimport { alternativeLabelContent } from './FieldLabelAlternative';\nimport './CVC.scss';\n\nexport default function CVC(props: Readonly<CVCProps>) {\n const {\n label,\n onFocusField = () => {},\n error = '',\n className = '',\n classNameModifiers = [],\n focused,\n filled,\n isValid,\n frontCVC = false,\n cvcPolicy = CVC_POLICY_REQUIRED,\n showContextualElement,\n contextualText\n } = props;\n const { i18n } = useCoreContext();\n\n const fieldClassnames = classNames(className, {\n 'adyen-checkout__field__cvc': true,\n 'adyen-checkout__card__cvc__input--hidden': cvcPolicy === CVC_POLICY_HIDDEN,\n 'adyen-checkout__field__cvc--optional': cvcPolicy === CVC_POLICY_OPTIONAL\n });\n\n const cvcClassnames = classNames({\n 'adyen-checkout__input': true,\n 'adyen-checkout__input--small': true,\n 'adyen-checkout__card__cvc__input': true,\n 'adyen-checkout__input--error': error,\n 'adyen-checkout__input--focus': focused,\n 'adyen-checkout__input--valid': isValid\n });\n\n const fieldLabel = cvcPolicy !== CVC_POLICY_OPTIONAL ? label : i18n.get('creditCard.securityCode.label.optional');\n\n const handleIconClick = () => {\n onFocusField(ENCRYPTED_SECURITY_CODE);\n };\n\n return (\n <Field\n label={fieldLabel}\n focused={focused}\n filled={filled}\n classNameModifiers={[...classNameModifiers, 'securityCode']}\n onFocusField={() => onFocusField(ENCRYPTED_SECURITY_CODE)}\n className={fieldClassnames}\n errorMessage={error}\n isValid={isValid}\n dir={'ltr'}\n name={ENCRYPTED_SECURITY_CODE}\n i18n={i18n}\n contextVisibleToScreenReader={false}\n useLabelElement={false}\n renderAlternativeToLabel={alternativeLabelContent}\n showContextualElement={showContextualElement}\n contextualText={contextualText}\n onInputContainerClick={handleIconClick}\n >\n <DataSfSpan encryptedFieldType={ENCRYPTED_SECURITY_CODE} className={cvcClassnames} />\n\n <CVCHint frontCVC={frontCVC} />\n </Field>\n );\n}\n"],"names":["CVC","props","label","onFocusField","error","className","classNameModifiers","focused","filled","isValid","frontCVC","cvcPolicy","CVC_POLICY_REQUIRED","showContextualElement","contextualText","i18n","useCoreContext","fieldClassnames","classNames","CVC_POLICY_HIDDEN","CVC_POLICY_OPTIONAL","cvcClassnames","fieldLabel","get","h","Field","ENCRYPTED_SECURITY_CODE","errorMessage","dir","name","contextVisibleToScreenReader","useLabelElement","renderAlternativeToLabel","alternativeLabelContent","onInputContainerClick","DataSfSpan","encryptedFieldType","CVCHint"],"mappings":"gjBAgBe,SAASA,EAAIC,GACxB,MAAMC,MACFA,EAAKC,aACLA,EAAe,OAAQC,MACvBA,EAAQ,GAAEC,UACVA,EAAY,GAAEC,mBACdA,EAAqB,GAAEC,QACvBA,EAAOC,OACPA,EAAMC,QACNA,EAAOC,SACPA,GAAW,EAAKC,UAChBA,EAAYC,EAAmBC,sBAC/BA,EAAqBC,eACrBA,GACAb,GACEc,KAAEA,GAASC,IAEXC,EAAkBC,EAAWb,EAAW,CAC1C,8BAA8B,EAC9B,2CAA4CM,IAAcQ,EAC1D,uCAAwCR,IAAcS,IAGpDC,EAAgBH,EAAW,CAC7B,yBAAyB,EACzB,gCAAgC,EAChC,oCAAoC,EACpC,+BAAgCd,EAChC,+BAAgCG,EAChC,+BAAgCE,IAG9Ba,EAAaX,IAAcS,EAAsBlB,EAAQa,EAAKQ,IAAI,0CAMxE,OACIC,EAACC,EAAAA,CACGvB,MAAOoB,EACPf,QAASA,EACTC,OAAQA,EACRF,mBAAoB,IAAIA,EAAoB,gBAC5CH,aAAc,IAAMA,EAAauB,GACjCrB,UAAWY,EACXU,aAAcvB,EACdK,QAASA,EACTmB,IAAK,MACLC,KAAMH,EACNX,KAAMA,EACNe,8BAA8B,EAC9BC,iBAAiB,EACjBC,yBAA0BC,EAC1BpB,sBAAuBA,EACvBC,eAAgBA,EAChBoB,sBAtBgB,KACpB/B,EAAauB,KAuBTF,EAACW,EAAAA,CAAWC,mBAAoBV,EAAyBrB,UAAWgB,IAEpEG,EAACa,EAAAA,CAAQ3B,SAAUA,IAG/B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as t}from"../../../../../external/preact/dist/preact.js";import c from"../../../../../_virtual/index.js";function e({frontCVC:e=!1
|
|
1
|
+
import{createElement as t}from"../../../../../external/preact/dist/preact.js";import c from"../../../../../_virtual/index.js";function e({frontCVC:e=!1}){const _=c({"adyen-checkout__card__cvc__hint__wrapper":!0,"adyen-checkout__field__cvc--front-hint":!!e,"adyen-checkout__field__cvc--back-hint":!e});return t("span",{className:_},t("svg",{className:"adyen-checkout__card__cvc__hint adyen-checkout__card__cvc__hint--front","data-testid":"cvc-hint-front",width:"27",height:"18",viewBox:"0 0 27 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0},t("path",{d:"M0 3C0 1.34315 1.34315 0 3 0H24C25.6569 0 27 1.34315 27 3V15C27 16.6569 25.6569 18 24 18H3C1.34315 18 0 16.6569 0 15V3Z",fill:"#E6E9EB"}),t("rect",{x:"4",y:"12",width:"19",height:"2",fill:"#B9C4C9"}),t("rect",{x:"4",y:"4",width:"4",height:"4",rx:"1",fill:"white"}),t("rect",{className:"adyen-checkout__card__cvc__hint__location",x:"16.5",y:"4.5",width:"7",height:"5",rx:"2.5",stroke:"#C12424"})),t("svg",{className:"adyen-checkout__card__cvc__hint adyen-checkout__card__cvc__hint--back","data-testid":"cvc-hint-back",width:"27",height:"18",viewBox:"0 0 27 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0},t("path",{d:"M27 4.00001V3.37501C27 2.4799 26.6444 1.62146 26.0115 0.988518C25.3786 0.355581 24.5201 0 23.625 0H3.375C2.47989 0 1.62145 0.355581 0.988514 0.988518C0.355579 1.62146 0 2.4799 0 3.37501V4.00001H27Z",fill:"#E6E9EB"}),t("path",{d:"M0 6.99994V14.6666C0 15.5507 0.355579 16.3985 0.988514 17.0237C1.62145 17.6488 2.47989 18 3.375 18H23.625C24.5201 18 25.3786 17.6488 26.0115 17.0237C26.6444 16.3985 27 15.5507 27 14.6666V6.99994H0Z",fill:"#E6E9EB"}),t("rect",{y:"4.00012",width:"27",height:"3.00001",fill:"#687282"}),t("path",{d:"M4 11C4 10.4477 4.44772 10 5 10H21C22.1046 10 23 10.8954 23 12C23 13.1046 22.1046 14 21 14H5C4.44771 14 4 13.5523 4 13V11Z",fill:"white"}),t("rect",{className:"adyen-checkout__card__cvc__hint__location",x:"16.5",y:"9.5",width:"7",height:"5",rx:"2.5",stroke:"#C12424"})))}export{e as default};
|
|
2
2
|
//# sourceMappingURL=CVCHint.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CVCHint.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CVCHint.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport { CVCHintProps } from './types';\n\nexport default function CVCHint({ frontCVC = false
|
|
1
|
+
{"version":3,"file":"CVCHint.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/CVCHint.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport { CVCHintProps } from './types';\n\nexport default function CVCHint({ frontCVC = false }: Readonly<CVCHintProps>) {\n const hintClassnames = classNames({\n 'adyen-checkout__card__cvc__hint__wrapper': true,\n 'adyen-checkout__field__cvc--front-hint': !!frontCVC,\n 'adyen-checkout__field__cvc--back-hint': !frontCVC\n });\n\n return (\n <span className={hintClassnames}>\n <svg\n className={'adyen-checkout__card__cvc__hint adyen-checkout__card__cvc__hint--front'}\n data-testid=\"cvc-hint-front\"\n width=\"27\"\n height=\"18\"\n viewBox=\"0 0 27 18\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden={true}\n >\n <path\n d=\"M0 3C0 1.34315 1.34315 0 3 0H24C25.6569 0 27 1.34315 27 3V15C27 16.6569 25.6569 18 24 18H3C1.34315 18 0 16.6569 0 15V3Z\"\n fill=\"#E6E9EB\"\n />\n <rect x=\"4\" y=\"12\" width=\"19\" height=\"2\" fill=\"#B9C4C9\" />\n <rect x=\"4\" y=\"4\" width=\"4\" height=\"4\" rx=\"1\" fill=\"white\" />\n <rect className={'adyen-checkout__card__cvc__hint__location'} x=\"16.5\" y=\"4.5\" width=\"7\" height=\"5\" rx=\"2.5\" stroke=\"#C12424\" />\n </svg>\n\n <svg\n className={'adyen-checkout__card__cvc__hint adyen-checkout__card__cvc__hint--back'}\n data-testid=\"cvc-hint-back\"\n width=\"27\"\n height=\"18\"\n viewBox=\"0 0 27 18\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden={true}\n >\n <path\n d=\"M27 4.00001V3.37501C27 2.4799 26.6444 1.62146 26.0115 0.988518C25.3786 0.355581 24.5201 0 23.625 0H3.375C2.47989 0 1.62145 0.355581 0.988514 0.988518C0.355579 1.62146 0 2.4799 0 3.37501V4.00001H27Z\"\n fill=\"#E6E9EB\"\n />\n <path\n d=\"M0 6.99994V14.6666C0 15.5507 0.355579 16.3985 0.988514 17.0237C1.62145 17.6488 2.47989 18 3.375 18H23.625C24.5201 18 25.3786 17.6488 26.0115 17.0237C26.6444 16.3985 27 15.5507 27 14.6666V6.99994H0Z\"\n fill=\"#E6E9EB\"\n />\n <rect y=\"4.00012\" width=\"27\" height=\"3.00001\" fill=\"#687282\" />\n <path\n d=\"M4 11C4 10.4477 4.44772 10 5 10H21C22.1046 10 23 10.8954 23 12C23 13.1046 22.1046 14 21 14H5C4.44771 14 4 13.5523 4 13V11Z\"\n fill=\"white\"\n />\n <rect className={'adyen-checkout__card__cvc__hint__location'} x=\"16.5\" y=\"9.5\" width=\"7\" height=\"5\" rx=\"2.5\" stroke=\"#C12424\" />\n </svg>\n </span>\n );\n}\n"],"names":["CVCHint","frontCVC","hintClassnames","classNames","h","span","className","svg","data-testid","width","height","viewBox","fill","xmlns","aria-hidden","path","d","rect","x","y","rx","stroke"],"mappings":"8HAIe,SAASA,GAAQC,SAAEA,GAAW,IACzC,MAAMC,EAAiBC,EAAW,CAC9B,4CAA4C,EAC5C,2CAA4CF,EAC5C,yCAA0CA,IAG9C,OACIG,EAACC,OAAAA,CAAKC,UAAWJ,GACbE,EAACG,MAAAA,CACGD,UAAW,yEACXE,cAAY,iBACZC,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BACNC,eAAa,GAEbV,EAACW,OAAAA,CACGC,EAAE,0HACFJ,KAAK,YAETR,EAACa,OAAAA,CAAKC,EAAE,IAAIC,EAAE,KAAKV,MAAM,KAAKC,OAAO,IAAIE,KAAK,YAC9CR,EAACa,OAAAA,CAAKC,EAAE,IAAIC,EAAE,IAAIV,MAAM,IAAIC,OAAO,IAAIU,GAAG,IAAIR,KAAK,UACnDR,EAACa,OAAAA,CAAKX,UAAW,4CAA6CY,EAAE,OAAOC,EAAE,MAAMV,MAAM,IAAIC,OAAO,IAAIU,GAAG,MAAMC,OAAO,aAGxHjB,EAACG,MAAAA,CACGD,UAAW,wEACXE,cAAY,gBACZC,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,OACLC,MAAM,6BACNC,eAAa,GAEbV,EAACW,OAAAA,CACGC,EAAE,wMACFJ,KAAK,YAETR,EAACW,OAAAA,CACGC,EAAE,wMACFJ,KAAK,YAETR,EAACa,OAAAA,CAAKE,EAAE,UAAUV,MAAM,KAAKC,OAAO,UAAUE,KAAK,YACnDR,EAACW,OAAAA,CACGC,EAAE,6HACFJ,KAAK,UAETR,EAACa,OAAAA,CAAKX,UAAW,4CAA6CY,EAAE,OAAOC,EAAE,MAAMV,MAAM,IAAIC,OAAO,IAAIU,GAAG,MAAMC,OAAO,aAIpI"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../../../external/preact/dist/preact.js";import t from"../../../../../_virtual/index.js";import a from"../../../../internal/FormFields/Field/Field.js";import{useCoreContext as i}from"../../../../../core/Context/CoreProvider.js";import r from"./DataSfSpan.js";import{DATE_POLICY_REQUIRED as n,DATE_POLICY_OPTIONAL as o,DATE_POLICY_HIDDEN as d,ENCRYPTED_EXPIRY_DATE as l}from"../../../../internal/SecuredFields/lib/constants.js";import c from"../../../../../core/Context/useImage.js";import{alternativeLabelContent as _}from"./FieldLabelAlternative.js";import{BrandImage as s}from"../../../../internal/BrandImage/BrandImage.js";function p(p){const{label:m,focused:u,filled:f,onFocusField:x,className:h="",classNameModifiers:y=[],error:k="",isValid:F=!1,expiryDatePolicy:j=n,showContextualElement:C,contextualText:b}=p,{i18n:g}=i(),N=c(),w=t(h,{"adyen-checkout__field__exp-date":!0,"adyen-checkout__card__exp-date__input--hidden":j===d,"adyen-checkout__field__exp-date--optional":j===o}),v=j!==o?m:`${m} ${g.get("field.title.optional")}
|
|
1
|
+
import{createElement as e}from"../../../../../external/preact/dist/preact.js";import t from"../../../../../_virtual/index.js";import a from"../../../../internal/FormFields/Field/Field.js";import{useCoreContext as i}from"../../../../../core/Context/CoreProvider.js";import r from"./DataSfSpan.js";import{DATE_POLICY_REQUIRED as n,DATE_POLICY_OPTIONAL as o,DATE_POLICY_HIDDEN as d,ENCRYPTED_EXPIRY_DATE as l}from"../../../../internal/SecuredFields/lib/constants.js";import c from"../../../../../core/Context/useImage.js";import{alternativeLabelContent as _}from"./FieldLabelAlternative.js";import{BrandImage as s}from"../../../../internal/BrandImage/BrandImage.js";function p(p){const{label:m,focused:u,filled:f,onFocusField:x,className:h="",classNameModifiers:y=[],error:k="",isValid:F=!1,expiryDatePolicy:j=n,showContextualElement:C,contextualText:b}=p,{i18n:g}=i(),N=c(),w=t(h,{"adyen-checkout__field__exp-date":!0,"adyen-checkout__card__exp-date__input--hidden":j===d,"adyen-checkout__field__exp-date--optional":j===o}),v=j!==o?m:`${m} ${g.get("field.title.optional")}`;return e(a,{label:v,classNameModifiers:[...y,"expiryDate"],className:w,focused:u,filled:f,onFocusField:()=>x(l),errorMessage:k,isValid:F,dir:"ltr",name:"encryptedExpiryDate",i18n:g,contextVisibleToScreenReader:!1,useLabelElement:!1,renderAlternativeToLabel:_,showContextualElement:C,contextualText:b,onInputContainerClick:()=>{x(l)}},e(r,{encryptedFieldType:l,className:t("adyen-checkout__input","adyen-checkout__input--small","adyen-checkout__card__exp-date__input",{"adyen-checkout__input--error":k,"adyen-checkout__input--focus":u,"adyen-checkout__input--valid":F})}),e(s,{wrapperClassName:k||F?t("adyen-checkout__field__exp-date_hint_wrapper","adyen-checkout__field__exp-date_hint_wrapper--hidden"):"adyen-checkout__field__exp-date_hint_wrapper",imgClassName:"adyen-checkout__field__exp-date_hint",alt:"",src:N({imageFolder:"components/"})("expiry_date_hint")}))}export{p as default};
|
|
2
2
|
//# sourceMappingURL=ExpirationDate.js.map
|
package/dist/es-legacy/components/Card/components/CardInput/components/ExpirationDate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpirationDate.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/ExpirationDate.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport Field from '../../../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { ExpirationDateProps } from './types';\nimport DataSfSpan from './DataSfSpan';\nimport {\n DATE_POLICY_HIDDEN,\n DATE_POLICY_OPTIONAL,\n DATE_POLICY_REQUIRED,\n ENCRYPTED_EXPIRY_DATE\n} from '../../../../internal/SecuredFields/lib/constants';\nimport useImage from '../../../../../core/Context/useImage';\nimport { alternativeLabelContent } from './FieldLabelAlternative';\nimport { BrandImage } from '../../../../internal/BrandImage';\nimport './ExpirationDate.scss';\n\nexport default function ExpirationDate(props: Readonly<ExpirationDateProps>) {\n const {\n label,\n focused,\n filled,\n onFocusField,\n className = '',\n classNameModifiers = [],\n error = '',\n isValid = false,\n expiryDatePolicy = DATE_POLICY_REQUIRED,\n showContextualElement,\n contextualText\n } = props;\n const { i18n } = useCoreContext();\n const getImage = useImage();\n\n const fieldClassnames = classNames(className, {\n 'adyen-checkout__field__exp-date': true,\n 'adyen-checkout__card__exp-date__input--hidden': expiryDatePolicy === DATE_POLICY_HIDDEN,\n 'adyen-checkout__field__exp-date--optional': expiryDatePolicy === DATE_POLICY_OPTIONAL\n });\n\n const fieldLabel = expiryDatePolicy !== DATE_POLICY_OPTIONAL ? label : `${label} ${i18n.get('field.title.optional')}`;\n\n
|
|
1
|
+
{"version":3,"file":"ExpirationDate.js","sources":["../../../../../../../src/components/Card/components/CardInput/components/ExpirationDate.tsx"],"sourcesContent":["import { h } from 'preact';\nimport classNames from 'classnames';\nimport Field from '../../../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../../../core/Context/CoreProvider';\nimport { ExpirationDateProps } from './types';\nimport DataSfSpan from './DataSfSpan';\nimport {\n DATE_POLICY_HIDDEN,\n DATE_POLICY_OPTIONAL,\n DATE_POLICY_REQUIRED,\n ENCRYPTED_EXPIRY_DATE\n} from '../../../../internal/SecuredFields/lib/constants';\nimport useImage from '../../../../../core/Context/useImage';\nimport { alternativeLabelContent } from './FieldLabelAlternative';\nimport { BrandImage } from '../../../../internal/BrandImage';\nimport './ExpirationDate.scss';\n\nexport default function ExpirationDate(props: Readonly<ExpirationDateProps>) {\n const {\n label,\n focused,\n filled,\n onFocusField,\n className = '',\n classNameModifiers = [],\n error = '',\n isValid = false,\n expiryDatePolicy = DATE_POLICY_REQUIRED,\n showContextualElement,\n contextualText\n } = props;\n const { i18n } = useCoreContext();\n const getImage = useImage();\n\n const fieldClassnames = classNames(className, {\n 'adyen-checkout__field__exp-date': true,\n 'adyen-checkout__card__exp-date__input--hidden': expiryDatePolicy === DATE_POLICY_HIDDEN,\n 'adyen-checkout__field__exp-date--optional': expiryDatePolicy === DATE_POLICY_OPTIONAL\n });\n\n const fieldLabel = expiryDatePolicy !== DATE_POLICY_OPTIONAL ? label : `${label} ${i18n.get('field.title.optional')}`;\n\n return (\n <Field\n label={fieldLabel}\n classNameModifiers={[...classNameModifiers, 'expiryDate']}\n className={fieldClassnames}\n focused={focused}\n filled={filled}\n onFocusField={() => onFocusField(ENCRYPTED_EXPIRY_DATE)}\n errorMessage={error}\n isValid={isValid}\n dir={'ltr'}\n name={'encryptedExpiryDate'}\n i18n={i18n}\n contextVisibleToScreenReader={false}\n useLabelElement={false}\n renderAlternativeToLabel={alternativeLabelContent}\n showContextualElement={showContextualElement}\n contextualText={contextualText}\n onInputContainerClick={() => {\n onFocusField(ENCRYPTED_EXPIRY_DATE);\n }}\n >\n <DataSfSpan\n encryptedFieldType={ENCRYPTED_EXPIRY_DATE}\n className={classNames('adyen-checkout__input', 'adyen-checkout__input--small', 'adyen-checkout__card__exp-date__input', {\n 'adyen-checkout__input--error': error,\n 'adyen-checkout__input--focus': focused,\n 'adyen-checkout__input--valid': isValid\n })}\n />\n <BrandImage\n wrapperClassName={\n error || isValid\n ? classNames('adyen-checkout__field__exp-date_hint_wrapper', 'adyen-checkout__field__exp-date_hint_wrapper--hidden')\n : 'adyen-checkout__field__exp-date_hint_wrapper'\n }\n imgClassName={'adyen-checkout__field__exp-date_hint'}\n alt=\"\"\n src={getImage({ imageFolder: 'components/' })('expiry_date_hint')}\n />\n </Field>\n );\n}\n"],"names":["ExpirationDate","props","label","focused","filled","onFocusField","className","classNameModifiers","error","isValid","expiryDatePolicy","DATE_POLICY_REQUIRED","showContextualElement","contextualText","i18n","useCoreContext","getImage","useImage","fieldClassnames","classNames","DATE_POLICY_HIDDEN","DATE_POLICY_OPTIONAL","fieldLabel","get","h","Field","ENCRYPTED_EXPIRY_DATE","errorMessage","dir","name","contextVisibleToScreenReader","useLabelElement","renderAlternativeToLabel","alternativeLabelContent","onInputContainerClick","DataSfSpan","encryptedFieldType","BrandImage","wrapperClassName","imgClassName","alt","src","imageFolder"],"mappings":"upBAiBe,SAASA,EAAeC,GACnC,MAAMC,MACFA,EAAKC,QACLA,EAAOC,OACPA,EAAMC,aACNA,EAAYC,UACZA,EAAY,GAAEC,mBACdA,EAAqB,GAAEC,MACvBA,EAAQ,GAAEC,QACVA,GAAU,EAAKC,iBACfA,EAAmBC,EAAoBC,sBACvCA,EAAqBC,eACrBA,GACAZ,GACEa,KAAEA,GAASC,IACXC,EAAWC,IAEXC,EAAkBC,EAAWb,EAAW,CAC1C,mCAAmC,EACnC,gDAAiDI,IAAqBU,EACtE,4CAA6CV,IAAqBW,IAGhEC,EAAaZ,IAAqBW,EAAuBnB,EAAQ,GAAGA,KAASY,EAAKS,IAAI,0BAE5F,OACIC,EAACC,EAAAA,CACGvB,MAAOoB,EACPf,mBAAoB,IAAIA,EAAoB,cAC5CD,UAAWY,EACXf,QAASA,EACTC,OAAQA,EACRC,aAAc,IAAMA,EAAaqB,GACjCC,aAAcnB,EACdC,QAASA,EACTmB,IAAK,MACLC,KAAM,sBACNf,KAAMA,EACNgB,8BAA8B,EAC9BC,iBAAiB,EACjBC,yBAA0BC,EAC1BrB,sBAAuBA,EACvBC,eAAgBA,EAChBqB,sBAAuB,KACnB7B,EAAaqB,KAGjBF,EAACW,EAAAA,CACGC,mBAAoBV,EACpBpB,UAAWa,EAAW,wBAAyB,+BAAgC,wCAAyC,CACpH,+BAAgCX,EAChC,+BAAgCL,EAChC,+BAAgCM,MAGxCe,EAACa,EAAAA,CACGC,iBACI9B,GAASC,EACHU,EAAW,+CAAgD,wDAC3D,+CAEVoB,aAAc,uCACdC,IAAI,GACJC,IAAKzB,EAAS,CAAE0B,YAAa,eAAxB1B,CAAyC,sBAI9D"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as
|
|
1
|
+
import{createElement as e}from"../../../external/preact/dist/preact.js";import{SegmentedControl as t}from"../../internal/SegmentedControl/SegmentedControl.js";import{SegmentedControlRegion as o}from"../../internal/SegmentedControl/SegmentedControlRegion.js";import{useState as n,useMemo as a}from"../../../external/preact/hooks/dist/hooks.js";import r from"./PayIDInput.js";import i from"./BSBInput.js";import{useCoreContext as l}from"../../../core/Context/CoreProvider.js";import s from"../../../_virtual/index.js";import{getUniqueId as p}from"../../../utils/idGenerator.js";function d(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function u(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},n=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),n.forEach(function(t){d(e,t,o[t])})}return e}function c(d){const{i18n:c}=l(),[m,b]=n("ready"),f=a(()=>p("payid-panel"),[]),y=a(()=>p("bsb-panel"),[]),g=a(()=>p("payid-input"),[]),h=a(()=>p("bsb-input"),[]),j=a(()=>[{value:"payid-option",label:"PayID",id:"payid-option",controls:f},{value:"bsb-option",label:c.get("payto.bsb.option.label"),id:"bsb-option",controls:y}],[c,f,y]),C=j[0].value,[v,S]=n(C),O=({data:e,valid:t,errors:o,isValid:n})=>{d.onChange({data:u({selectedInput:v},e),valid:t,errors:o,isValid:n})};return e("div",{className:s({"adyen-checkout__payto-component":!0,"adyen-checkout__payto-component--loading":"loading"===m})},e(t,{selectedValue:v,options:j,onChange:S}),"payid-option"===v&&e(o,{id:f,ariaLabelledBy:"payid-option"},e(r,{id:g,status:m,setStatus:b,setComponentRef:d.setComponentRef,onChange:O,defaultData:d.data,placeholders:d.placeholders})),"bsb-option"===v&&e(o,{id:y,ariaLabelledBy:"bsb-option"},e(i,{id:h,status:m,setStatus:b,setComponentRef:d.setComponentRef,onChange:O,defaultData:d.data,placeholders:d.placeholders})),d.showPayButton&&d.payButton({status:m,label:c.get("continue")}))}export{c as default};
|
|
2
2
|
//# sourceMappingURL=PayToComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayToComponent.js","sources":["../../../../../src/components/PayTo/components/PayToComponent.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { SegmentedControl } from '../../internal/SegmentedControl';\nimport { useMemo, useState } from 'preact/hooks';\nimport { SegmentedControlOptions } from '../../internal/SegmentedControl/SegmentedControl';\nimport PayIDInput from './PayIDInput';\nimport BSBInput from './BSBInput';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { ComponentMethodsRef, UIElementStatus } from '../../internal/UIElement/types';\nimport { PayToData, PayToPlaceholdersType } from '../types';\nimport { PayButtonProps } from '../../internal/PayButton/PayButton';\nimport classNames from 'classnames';\nimport { getUniqueId } from '../../../utils/idGenerator';\nimport './PayToComponent.scss';\n\nexport type PayToInputOption = 'payid-option' | 'bsb-option';\n\nexport type PayToComponentData = { selectedInput: PayToInputOption };\n\nexport interface PayToComponentProps {\n showPayButton: boolean;\n onChange: (e) => void;\n setComponentRef: (ref: ComponentMethodsRef) => void;\n data: PayToData;\n placeholders: PayToPlaceholdersType;\n payButton: (props: PayButtonProps) => h.JSX.Element;\n}\n\nexport default function PayToComponent(props: Readonly<PayToComponentProps>) {\n const { i18n } = useCoreContext();\n\n const [status, setStatus] = useState<UIElementStatus>('ready');\n\n // Generate unique IDs for the input sections\n const payidInputId = useMemo(() => getUniqueId('payid-input'), []);\n const bsbInputId = useMemo(() => getUniqueId('bsb-input'), []);\n\n const inputOptions: SegmentedControlOptions<PayToInputOption> = useMemo(\n () => [\n {\n value: 'payid-option',\n label: 'PayID',\n id: 'payid-option',\n controls:
|
|
1
|
+
{"version":3,"file":"PayToComponent.js","sources":["../../../../../src/components/PayTo/components/PayToComponent.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { SegmentedControl, SegmentedControlRegion } from '../../internal/SegmentedControl';\nimport { useMemo, useState } from 'preact/hooks';\nimport { SegmentedControlOptions } from '../../internal/SegmentedControl/SegmentedControl';\nimport PayIDInput from './PayIDInput';\nimport BSBInput from './BSBInput';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport { ComponentMethodsRef, UIElementStatus } from '../../internal/UIElement/types';\nimport { PayToData, PayToPlaceholdersType } from '../types';\nimport { PayButtonProps } from '../../internal/PayButton/PayButton';\nimport classNames from 'classnames';\nimport { getUniqueId } from '../../../utils/idGenerator';\nimport './PayToComponent.scss';\n\nexport type PayToInputOption = 'payid-option' | 'bsb-option';\n\nexport type PayToComponentData = { selectedInput: PayToInputOption };\n\nexport interface PayToComponentProps {\n showPayButton: boolean;\n onChange: (e) => void;\n setComponentRef: (ref: ComponentMethodsRef) => void;\n data: PayToData;\n placeholders: PayToPlaceholdersType;\n payButton: (props: PayButtonProps) => h.JSX.Element;\n}\n\nexport default function PayToComponent(props: Readonly<PayToComponentProps>) {\n const { i18n } = useCoreContext();\n\n const [status, setStatus] = useState<UIElementStatus>('ready');\n\n // Generate unique IDs for the tab panels and input sections\n const payidPanelId = useMemo(() => getUniqueId('payid-panel'), []);\n const bsbPanelId = useMemo(() => getUniqueId('bsb-panel'), []);\n const payidInputId = useMemo(() => getUniqueId('payid-input'), []);\n const bsbInputId = useMemo(() => getUniqueId('bsb-input'), []);\n\n const inputOptions: SegmentedControlOptions<PayToInputOption> = useMemo(\n () => [\n {\n value: 'payid-option',\n label: 'PayID',\n id: 'payid-option',\n controls: payidPanelId\n },\n {\n value: 'bsb-option',\n label: i18n.get('payto.bsb.option.label'),\n id: 'bsb-option',\n controls: bsbPanelId\n }\n ],\n [i18n, payidPanelId, bsbPanelId]\n );\n\n const defaultOption = inputOptions[0].value;\n const [selectedInput, setSelectedInput] = useState<PayToInputOption>(defaultOption);\n\n const onChange = ({ data, valid, errors, isValid }) => {\n // merge selected input to as data, this keep the input layers untouched\n props.onChange({ data: { selectedInput: selectedInput, ...data }, valid, errors, isValid });\n };\n\n return (\n <div\n className={classNames({\n 'adyen-checkout__payto-component': true,\n 'adyen-checkout__payto-component--loading': status === 'loading'\n })}\n >\n <SegmentedControl selectedValue={selectedInput} options={inputOptions} onChange={setSelectedInput} />\n {selectedInput === 'payid-option' && (\n <SegmentedControlRegion id={payidPanelId} ariaLabelledBy=\"payid-option\">\n <PayIDInput\n id={payidInputId}\n status={status}\n setStatus={setStatus}\n setComponentRef={props.setComponentRef}\n onChange={onChange}\n defaultData={props.data}\n placeholders={props.placeholders}\n />\n </SegmentedControlRegion>\n )}\n {selectedInput === 'bsb-option' && (\n <SegmentedControlRegion id={bsbPanelId} ariaLabelledBy=\"bsb-option\">\n <BSBInput\n id={bsbInputId}\n status={status}\n setStatus={setStatus}\n setComponentRef={props.setComponentRef}\n onChange={onChange}\n defaultData={props.data}\n placeholders={props.placeholders}\n />\n </SegmentedControlRegion>\n )}\n\n {props.showPayButton && props.payButton({ status, label: i18n.get('continue') })}\n </div>\n );\n}\n"],"names":["PayToComponent","props","i18n","useCoreContext","status","setStatus","useState","payidPanelId","useMemo","getUniqueId","bsbPanelId","payidInputId","bsbInputId","inputOptions","value","label","id","controls","get","defaultOption","selectedInput","setSelectedInput","onChange","data","valid","errors","isValid","_object_spread","h","div","className","classNames","SegmentedControl","selectedValue","options","SegmentedControlRegion","ariaLabelledBy","PayIDInput","setComponentRef","defaultData","placeholders","BSBInput","showPayButton","payButton"],"mappings":"4/BA2Be,SAASA,EAAeC,GACnC,MAAMC,KAAEA,GAASC,KAEVC,EAAQC,GAAaC,EAA0B,SAGhDC,EAAeC,EAAQ,IAAMC,EAAY,eAAgB,IACzDC,EAAaF,EAAQ,IAAMC,EAAY,aAAc,IACrDE,EAAeH,EAAQ,IAAMC,EAAY,eAAgB,IACzDG,EAAaJ,EAAQ,IAAMC,EAAY,aAAc,IAErDI,EAA0DL,EAC5D,IAAM,CACF,CACIM,MAAO,eACPC,MAAO,QACPC,GAAI,eACJC,SAAUV,GAEd,CACIO,MAAO,aACPC,MAAOb,EAAKgB,IAAI,0BAChBF,GAAI,aACJC,SAAUP,IAGlB,CAACR,EAAMK,EAAcG,IAGnBS,EAAgBN,EAAa,GAAGC,OAC/BM,EAAeC,GAAoBf,EAA2Ba,GAE/DG,EAAW,EAAGC,OAAMC,QAAOC,SAAQC,cAErCzB,EAAMqB,SAAS,CAAEC,KAAMI,EAAA,CAAEP,cAAeA,GAAkBG,GAAQC,QAAOC,SAAQC,aAGrF,OACIE,EAACC,MAAAA,CACGC,UAAWC,EAAW,CAClB,mCAAmC,EACnC,2CAAuD,YAAX3B,KAGhDwB,EAACI,EAAAA,CAAiBC,cAAeb,EAAec,QAASrB,EAAcS,SAAUD,IAC9D,iBAAlBD,GACGQ,EAACO,EAAAA,CAAuBnB,GAAIT,EAAc6B,eAAe,gBACrDR,EAACS,EAAAA,CACGrB,GAAIL,EACJP,OAAQA,EACRC,UAAWA,EACXiC,gBAAiBrC,EAAMqC,gBACvBhB,SAAUA,EACViB,YAAatC,EAAMsB,KACnBiB,aAAcvC,EAAMuC,gBAIb,eAAlBpB,GACGQ,EAACO,EAAAA,CAAuBnB,GAAIN,EAAY0B,eAAe,cACnDR,EAACa,EAAAA,CACGzB,GAAIJ,EACJR,OAAQA,EACRC,UAAWA,EACXiC,gBAAiBrC,EAAMqC,gBACvBhB,SAAUA,EACViB,YAAatC,EAAMsB,KACnBiB,aAAcvC,EAAMuC,gBAK/BvC,EAAMyC,eAAiBzC,EAAM0C,UAAU,CAAEvC,SAAQW,MAAOb,EAAKgB,IAAI,cAG9E"}
|
|
@@ -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 r from"./components/Challenge/PrepareChallenge3DS2.js";import{THREEDS2_CHALLENGE_ERROR as o,THREEDS2_CHALLENGE as n,DEFAULT_CHALLENGE_WINDOW_SIZE as s}from"./constants.js";import{existy as i}from"../../utils/commonUtils.js";import{hasOwnProperty as p}from"../../utils/hasOwnProperty.js";import{TxVariants as c}from"../tx-variants.js";import a,{API_ERROR as l}from"../../core/Errors/AdyenCheckoutError.js";import{AnalyticsLogEvent as m,LogEventSubtype as u,LogEventType as y}from"../../core/Analytics/events/AnalyticsLogEvent.js";import{AnalyticsErrorEvent as f,ErrorEventType as h,ErrorEventCode as b}from"../../core/Analytics/events/AnalyticsErrorEvent.js";function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function j(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}class O extends t{beforeRender(){}onComplete(e){this.props.
|
|
1
|
+
import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as t}from"../internal/UIElement/UIElement.js";import r from"./components/Challenge/PrepareChallenge3DS2.js";import{THREEDS2_CHALLENGE_ERROR as o,THREEDS2_CHALLENGE as n,DEFAULT_CHALLENGE_WINDOW_SIZE as s}from"./constants.js";import{existy as i}from"../../utils/commonUtils.js";import{hasOwnProperty as p}from"../../utils/hasOwnProperty.js";import{TxVariants as c}from"../tx-variants.js";import a,{API_ERROR as l}from"../../core/Errors/AdyenCheckoutError.js";import{AnalyticsLogEvent as m,LogEventSubtype as u,LogEventType as y}from"../../core/Analytics/events/AnalyticsLogEvent.js";import{AnalyticsErrorEvent as f,ErrorEventType as h,ErrorEventCode as b}from"../../core/Analytics/events/AnalyticsErrorEvent.js";function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function j(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}class O extends t{beforeRender(){}onComplete(e){var t,r;this.props.isMDFlow?null===(t=(r=this.props).on3DS2RedirectFlowComplete)||void 0===t||t.call(r,e,this.elementRef):super.onComplete(e);this.unmount()}componentToRender(){if(!i(this.props.paymentData)){const e=p(this.props,"isMDFlow")?"paymentData":"authorisationToken";this.props.onError(new a(l,`No ${e} received. 3DS2 Challenge cannot proceed`));const t=new f({component:this.type,code:b.THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA,errorType:h.threeDS2,message:`${o}: Missing 'paymentData' property from threeDS2 action`});return this.submitAnalytics(t),null}return e(r,j(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){d(e,t,r[t])})}return e}({},this.props),{onComplete:this.onComplete,onSubmitAnalytics:this.submitAnalytics,onActionHandled:this.onActionHandled}))}constructor(...e){super(...e),d(this,"onActionHandled",e=>{const t=new m({component:this.type,type:y.threeDS2,subType:u.challengeIframeLoaded,message:e.actionDescription});this.submitAnalytics(t),super.onActionHandled(e)})}}d(O,"type",c.threeDS2Challenge),d(O,"defaultProps",{dataKey:"threeDSResult",size:s,type:n});export{O 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 readonly type = TxVariants.threeDS2Challenge;\n\n public static readonly 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
|
|
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 readonly type = TxVariants.threeDS2Challenge;\n\n public static readonly 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 /**\n * Will make 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 onComplete(state: LegacyChallengeResolveData | ChallengeResolveData) {\n if (this.props.isMDFlow) {\n this.props.on3DS2RedirectFlowComplete?.(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 might send an 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 onActionHandled={this.onActionHandled}\n />\n );\n }\n}\n\nexport default ThreeDS2Challenge;\n"],"names":["ThreeDS2Challenge","UIElement","beforeRender","onComplete","state","_this_props_on3DS2RedirectFlowComplete","_this_props","this","props","isMDFlow","on3DS2RedirectFlowComplete","call","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","onActionHandled","args","_define_property","rtnObj","AnalyticsLogEvent","LogEventType","subType","LogEventSubtype","challengeIframeLoaded","actionDescription","TxVariants","threeDS2Challenge","defaultProps","dataKey","size","DEFAULT_CHALLENGE_WINDOW_SIZE","THREEDS2_CHALLENGE"],"mappings":"kwCAaA,MAAMA,UAA0BC,EASTC,YAAAA,GAEnB,CAoBAC,UAAAA,CAAWC,OAEHC,EAAAC,EADAC,KAAKC,MAAMC,SAC0B,QAArCJ,GAAAC,EAAAC,KAAKC,OAAME,kCAAX,IAAAL,GAAAA,EAAAM,KAAAL,EAAwCF,EAAOG,KAAKK,YAEpDC,MAAMV,WAAWC,GAGrBG,KAAKO,SACT,CAEmBC,iBAAAA,GAEf,IAAKC,EAAOT,KAAKC,MAAMS,aAAc,CAKjC,MAAMC,EAAmBC,EAAeZ,KAAKC,MAAO,YAAc,cAAgB,qBAElFD,KAAKC,MAAMY,QAAQ,IAAIC,EAAmBC,EAAW,MAAMJ,8CAE3D,MAAMK,EAAQ,IAAIC,EAAoB,CAClCC,UAAWlB,KAAKmB,KAChBC,KAAMC,EAAeC,wCACrBC,UAAWC,EAAeC,SAC1BC,QAAS,GAAGC,2DAKhB,OAFA3B,KAAK4B,gBAAgBZ,GAEd,IACX,CAEA,OACIa,EAACC,EAAAA,oUAAAA,CAAAA,GACO9B,KAAKC,OAAK,CACdL,WAAYI,KAAKJ,WACjBmC,kBAAmB/B,KAAK4B,gBACxBI,gBAAiBhC,KAAKgC,kBAGlC,mBAxEJ1B,SAAA2B,GAaIC,EAAAlC,KAAUgC,kBAAmBG,IACzB,MAAMnB,EAAQ,IAAIoB,EAAkB,CAChClB,UAAWlB,KAAKmB,KAChBA,KAAMkB,EAAaZ,SACnBa,QAASC,EAAgBC,sBACzBd,QAASS,EAAOM,oBAGpBzC,KAAK4B,gBAAgBZ,GAErBV,MAAM0B,gBAAgBG,MAtB1BD,EADEzC,EACqB0B,OAAOuB,EAAWC,mBAEzCT,EAHEzC,EAGqBmD,eAAe,CAClCC,QAAS,gBACTC,KAAMC,EACN5B,KAAM6B"}
|
|
@@ -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 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 c,THREEDS2_FINGERPRINT as a}from"./constants.js";import{AnalyticsLogEvent as
|
|
1
|
+
import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as t}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 c,THREEDS2_FINGERPRINT as a}from"./constants.js";import{AnalyticsLogEvent as l,LogEventSubtype as m,LogEventType as u}from"../../core/Analytics/events/AnalyticsLogEvent.js";import{AnalyticsErrorEvent as y,ErrorEventType as f,ErrorEventCode as b}from"../../core/Analytics/events/AnalyticsErrorEvent.js";function h(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}class j extends t{beforeRender(){}onComplete(e){var t,r;this.props.isMDFlow?null===(t=(r=this.props).on3DS2RedirectFlowComplete)||void 0===t||t.call(r,e,this.elementRef):super.onComplete(e);this.unmount()}componentToRender(){if(!o(this.props.paymentData)){this.props.onError(new s(p,"No paymentData received. 3DS2 Fingerprint cannot proceed"));const e=new y({component:this.type,code:b.THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA,errorType:f.threeDS2,message:`${c}: Missing 'paymentData' property from threeDS2 action`});return this.submitAnalytics(e),null}return e(r,d(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){h(e,t,r[t])})}return e}({},this.props),{onComplete:this.props.isMDFlow?this.onComplete:this.callSubmit3DS2Fingerprint,onSubmitAnalytics:this.submitAnalytics,onActionHandled:this.onActionHandled}))}constructor(...e){super(...e),h(this,"callSubmit3DS2Fingerprint",n.bind(this)),h(this,"onActionHandled",e=>{const t=new l({component:this.type,type:u.threeDS2,subType:m.fingerprintIframeLoaded,message:e.actionDescription});this.submitAnalytics(t),super.onActionHandled(e)})}}h(j,"type",i.threeDS2Fingerprint),h(j,"defaultProps",{dataKey:"fingerprintResult",type:a});export{j 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 readonly type = TxVariants.threeDS2Fingerprint;\n\n public static readonly 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.
|
|
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 readonly type = TxVariants.threeDS2Fingerprint;\n\n public static readonly 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 /**\n * Can be called directly from PrepareFingerprint (MDFlow) or after the call to /submitThreeDS2Fingerprint endpoint (native flow)\n */\n onComplete(state: LegacyFingerprintResolveData | FingerprintResolveData) {\n if (this.props.isMDFlow) {\n this.props.on3DS2RedirectFlowComplete?.(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 // For MDFlow will bypass the /submitThreeDS2Fingerprint endpoint\n onComplete={this.props.isMDFlow ? this.onComplete : this.callSubmit3DS2Fingerprint}\n onSubmitAnalytics={this.submitAnalytics}\n onActionHandled={this.onActionHandled}\n />\n );\n }\n}\n\nexport default ThreeDS2DeviceFingerprint;\n"],"names":["ThreeDS2DeviceFingerprint","UIElement","beforeRender","onComplete","state","_this_props_on3DS2RedirectFlowComplete","_this_props","this","props","isMDFlow","on3DS2RedirectFlowComplete","call","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","callSubmit3DS2Fingerprint","onSubmitAnalytics","onActionHandled","args","_define_property","bind","rtnObj","AnalyticsLogEvent","LogEventType","subType","LogEventSubtype","fingerprintIframeLoaded","actionDescription","TxVariants","threeDS2Fingerprint","defaultProps","dataKey","THREEDS2_FINGERPRINT"],"mappings":"4tCAaA,MAAMA,UAAkCC,EAUjBC,YAAAA,GAEnB,CAkBAC,UAAAA,CAAWC,OAEHC,EAAAC,EADAC,KAAKC,MAAMC,SAC0B,QAArCJ,GAAAC,EAAAC,KAAKC,OAAME,kCAAX,IAAAL,GAAAA,EAAAM,KAAAL,EAAwCF,EAAOG,KAAKK,YAEpDC,MAAMV,WAAWC,GAGrBG,KAAKO,SACT,CAEmBC,iBAAAA,GAKf,IAAKC,EAAOT,KAAKC,MAAMS,aAAc,CACjCV,KAAKC,MAAMU,QAAQ,IAAIC,EAAmBC,EAAW,6DAGrD,MAAMC,EAAQ,IAAIC,EAAoB,CAClCC,UAAWhB,KAAKiB,KAChBC,KAAMC,EAAeC,wCACrBC,UAAWC,EAAeC,SAC1BC,QAAS,GAAGC,2DAKhB,OAFAzB,KAAK0B,gBAAgBZ,GAEd,IACX,CAMA,OACIa,EAACC,EAAAA,oUAAAA,CAAAA,GACO5B,KAAKC,OAAK,CAEdL,WAAYI,KAAKC,MAAMC,SAAWF,KAAKJ,WAAaI,KAAK6B,0BACzDC,kBAAmB9B,KAAK0B,gBACxBK,gBAAiB/B,KAAK+B,kBAGlC,mBA1EJzB,SAAA0B,GAQIC,OAAQJ,4BAA4BA,EAA0BK,KAAKlC,OAMnEiC,EAAAjC,KAAU+B,kBAAmBI,IACzB,MAAMrB,EAAQ,IAAIsB,EAAkB,CAChCpB,UAAWhB,KAAKiB,KAChBA,KAAMoB,EAAad,SACnBe,QAASC,EAAgBC,wBACzBhB,QAASW,EAAOM,oBAGpBzC,KAAK0B,gBAAgBZ,GAErBR,MAAMyB,gBAAgBI,MAvB1BF,EADExC,EACqBwB,OAAOyB,EAAWC,qBAEzCV,EAHExC,EAGqBmD,eAAe,CAClCC,QAAS,oBACT5B,KAAM6B"}
|
|
@@ -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 o,
|
|
1
|
+
import{Component as e,createElement as r}from"../../../../external/preact/dist/preact.js";import t from"./DoChallenge3DS2.js";import{isErrorObject as o,createChallengeResolveData as s,prepareChallengeData as n}from"../utils.js";import i from"../../../internal/Img/Img.js";import{hasOwnProperty as a}from"../../../../utils/hasOwnProperty.js";import l from"../../../../core/Context/useImage.js";import p,{ERROR as c}from"../../../../core/Errors/AdyenCheckoutError.js";import{THREEDS2_CHALLENGE_ERROR as u,MISSING_TOKEN_IN_ACTION_MSG as h,THREEDS2_NUM as m,THREEDS2_CHALLENGE as g}from"../../constants.js";import{isValidHttpUrl as S}from"../../../../utils/isValidURL.js";import{AnalyticsLogEvent as d,LogEventSubtype as D,LogEventType as f}from"../../../../core/Analytics/events/AnalyticsLogEvent.js";import{ErrorEventCode as y,AnalyticsErrorEvent as E,ErrorEventType as b}from"../../../../core/Analytics/events/AnalyticsErrorEvent.js";function _(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function O(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},o=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.forEach(function(r){_(e,r,t[r])})}return e}function T(e,r){return r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):function(e){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r.push.apply(r,t)}return r}(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}class C extends e{componentDidMount(){if(!o(this.state.challengeData)){var e,r;const t="test"===this.props.environment&&(null===(r=this.props._environmentUrls)||void 0===r||null===(e=r.api)||void 0===e?void 0:e.includes("http://localhost:8080")),{acsURL:o}=this.state.challengeData;if(!S(o,t)){this.setError({errorInfo:`${y.THREEDS2_TOKEN_IS_MISSING_ACSURL}: ${this.props.i18n.get("err.gen.9102")}`},!0);const e=new E({component:this.props.type,code:y.THREEDS2_TOKEN_IS_MISSING_ACSURL,errorType:b.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:s,messageVersion:n,threeDSServerTransID:i}=this.state.challengeData.cReqData;if(!s||!n||!i){this.setError({errorInfo:`${y.THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS}: ${this.props.i18n.get("err.gen.9102")}`},!0);const e=new E({component:this.props.type,code:y.THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS,errorType:b.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.includes(h)?y.THREEDS2_ACTION_IS_MISSING_TOKEN:y.THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED;this.setError({errorInfo:`${r}: ${this.props.i18n.get("err.gen.9102")}`},!0);const t=new E({component:this.props.type,code:r,errorType:b.threeDS2,message:`${u}: ${e}`});this.props.onSubmitAnalytics(t),console.debug("### PrepareChallenge3DS2::exiting:: no challengeData")}}setStatusComplete(e,r=null){this.setState({status:"complete"},()=>{const t=s(this.props.dataKey,e.transStatus,this.props.paymentData);let o;r&&console.debug("### PrepareChallenge3DS2::errorCodeObject::",r);const n=r||e;if(n.errorCode){const e={code:"timeout"===n.errorCode?y.THREEDS2_TIMEOUT:y.THREEDS2_NO_TRANSSTATUS,errorType:b.threeDS2};o=new E(O({component:this.props.type,message:n.message},e)),this.props.onSubmitAnalytics(o)}let i;switch(null==e?void 0:e.transStatus){case"Y":i="success";break;case"N":i="failed";break;case"U":i=r?"timeout":"cancelled"}(null==e?void 0:e.errorCode)&&(i="noTransStatus"),o=new d({component:this.props.type,type:f.threeDS2,subType:D.challengeCompleted,message:`${m} challenge has completed`,result:i}),this.props.onSubmitAnalytics(o),this.props.onComplete(t)})}setError(e,r){this.setState({status:"error",errorInfo:e.errorInfo}),r&&this.props.onError(new p(c,e.errorInfo,{cause:e.errorObj}))}render(e,{challengeData:o}){const s=l();return"performingChallenge"===this.state.status?r(t,T(O({onCompleteChallenge:e=>{let r=null;if(a(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 p(c,`${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 E({component:this.props.type,code:y.THREEDS2_CHALLENGE_RESOLVED_WITHOUT_RESULT_PROP,errorType:b.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(a(e,"errorCode")){const r={errorCode:e.errorCode,message:`${g}: ${e.errorCode}`};return this.props.isMDFlow&&this.props.onError(new p(c,`${u}: '3DS2 challenge timed out'`,{cause:e.errorCode})),void this.setStatusComplete(e.result,r)}}},o),{onActionHandled:this.props.onActionHandled,onFormSubmit:this.onFormSubmit})):"error"===this.state.status?r("div",{className:"adyen-checkout__threeds2-challenge-error"},r(i,{className:"adyen-checkout__status__icon adyen-checkout__status__icon--error",src:s({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),_(this,"onFormSubmit",e=>{const r=new d({component:this.props.type,type:f.threeDS2,subType:D.challengeDataSentWeb,message:e});this.props.onSubmitAnalytics(r)}),this.props.token){const e=n({token:this.props.token,size:this.props.challengeWindowSize||this.props.size});this.state={status:"init",challengeData:e}}else this.state={challengeData:{success:!1,error:h}},console.debug(`${u}: ${h}`)}}_(C,"defaultProps",{onComplete:()=>{},onError:()=>{},isMDFlow:!1});export{C 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 readonly defaultProps = {\n onComplete: () => {},\n onError: () => {},\n isMDFlow: false\n };\n\n constructor(props) {\n super(props);\n\n if (this.props.token) {\n const challengeData: ChallengeData | ErrorObject = prepareChallengeData({\n token: this.props.token,\n size: this.props.challengeWindowSize || this.props.size // TODO confirm that this.props.size is legacy and can be removed\n });\n\n this.state = {\n status: 'init',\n challengeData: challengeData as ChallengeData\n };\n } else {\n // Will be picked up in componentDidMount\n this.state = { challengeData: { success: false, error: MISSING_TOKEN_IN_ACTION_MSG } };\n\n console.debug(`${THREEDS2_CHALLENGE_ERROR}: ${MISSING_TOKEN_IN_ACTION_MSG}`);\n }\n }\n\n public onFormSubmit = (msg: string) => {\n const event = new AnalyticsLogEvent({\n component: this.props.type,\n type: LogEventType.threeDS2,\n subType: LogEventSubtype.challengeDataSentWeb,\n message: msg\n });\n\n this.props.onSubmitAnalytics(event);\n };\n\n componentDidMount() {\n const hasChallengeData = !isErrorObject(this.state.challengeData);\n\n if (hasChallengeData) {\n const shouldAllowHttpDomains =\n /** Allow http urls if in development and testing against localhost:8080 */\n (process.env.NODE_ENV === 'development' && process.env.__CLIENT_ENV__?.includes('localhost:8080')) ||\n /**\n * Allows the checkoutshopper demo on localhost:8080 to work -\n * requires a configuration in localhost of environment: 'test', _environmentUrls: {api: 'http://localhost:8080/'}\n */\n (this.props.environment === 'test' && this.props._environmentUrls?.api?.includes('http://localhost:8080'));\n\n /**\n * Check the structure of the created challengeData\n */\n const { acsURL } = this.state.challengeData as ChallengeData;\n const hasValidAcsURL = isValidHttpUrl(acsURL, shouldAllowHttpDomains);\n\n // Only render component if we have an acsURL.\n if (!hasValidAcsURL) {\n // Set UI error & call onError callback\n this.setError(\n {\n errorInfo: `${ErrorEventCode.THREEDS2_TOKEN_IS_MISSING_ACSURL}: ${this.props.i18n.get('err.gen.9102')}` //\n },\n true\n );\n\n // Send error to analytics endpoint // TODO - check logs to see if this *ever* happens\n const event = new AnalyticsErrorEvent({\n component: this.props.type,\n code: ErrorEventCode.THREEDS2_TOKEN_IS_MISSING_ACSURL,\n errorType: ErrorEventType.threeDS2,\n message: `${THREEDS2_CHALLENGE_ERROR}: Decoded token is missing a valid acsURL property`\n });\n this.props.onSubmitAnalytics(event);\n\n console.debug('### PrepareChallenge3DS2::exiting:: no valid acsURL');\n return;\n }\n\n const { acsTransID, messageVersion, threeDSServerTransID } = (this.state.challengeData as ChallengeData).cReqData;\n\n // Only render component if we have a acsTransID, messageVersion & threeDSServerTransID\n if (!acsTransID || !messageVersion || !threeDSServerTransID) {\n // Set UI error & call onError callback\n this.setError(\n {\n errorInfo: `${ErrorEventCode.THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS}: ${this.props.i18n.get('err.gen.9102')}`\n },\n true\n );\n\n // Send error to analytics endpoint // TODO - check logs to see if this *ever* happens\n const event = new AnalyticsErrorEvent({\n component: this.props.type,\n code: ErrorEventCode.THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS,\n errorType: ErrorEventType.threeDS2,\n message: `${THREEDS2_CHALLENGE_ERROR}: Decoded token is missing one or more of the following properties (acsTransID | messageVersion | threeDSServerTransID)`\n });\n this.props.onSubmitAnalytics(event);\n\n console.debug(\n '### PrepareChallenge3DS2::exiting:: missing one or more of the following properties (acsTransID | messageVersion | threeDSServerTransID)'\n );\n return;\n }\n\n // Proceed to allow component to render\n this.setState({ status: 'performingChallenge' });\n //\n } else {\n const errorMsg: string = (this.state.challengeData as ErrorObject).error;\n\n const errorCode = errorMsg.includes(MISSING_TOKEN_IN_ACTION_MSG)\n ? ErrorEventCode.THREEDS2_ACTION_IS_MISSING_TOKEN\n : ErrorEventCode.THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED;\n\n // Set UI error & call onError callback\n this.setError(\n {\n errorInfo: `${errorCode}: ${this.props.i18n.get('err.gen.9102')}`\n // errorObj: this.state.challengeData // TODO Decide if we want to expose this data\n },\n true\n );\n\n // Send error to analytics endpoint // TODO - check logs to see if the base64 decoding errors *ever* happen\n const event = new AnalyticsErrorEvent({\n component: this.props.type,\n code: errorCode,\n errorType: ErrorEventType.threeDS2,\n message: `${THREEDS2_CHALLENGE_ERROR}: ${errorMsg}` // can be: 'Missing \"token\" property from threeDS2 action', 'not base64', 'malformed URI sequence' or 'Could not JSON parse token'\n });\n\n this.props.onSubmitAnalytics(event);\n\n console.debug('### PrepareChallenge3DS2::exiting:: no challengeData');\n }\n }\n\n setStatusComplete(resultObj: ResultObject, errorCodeObject: ErrorCodeObject = null) {\n this.setState({ status: 'complete' }, () => {\n /**\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","process","_this_props__environmentUrls_api","_this_props__environmentUrls","shouldAllowHttpDomains","props","environment","_environmentUrls","api","includes","acsURL","isValidHttpUrl","setError","errorInfo","ErrorEventCode","THREEDS2_TOKEN_IS_MISSING_ACSURL","i18n","get","event","AnalyticsErrorEvent","component","type","code","errorType","ErrorEventType","threeDS2","message","THREEDS2_CHALLENGE_ERROR","onSubmitAnalytics","console","debug","acsTransID","messageVersion","threeDSServerTransID","cReqData","THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS","setState","status","errorMsg","error","errorCode","MISSING_TOKEN_IN_ACTION_MSG","THREEDS2_ACTION_IS_MISSING_TOKEN","THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED","setStatusComplete","resultObj","errorCodeObject","data","isMDFlow","createOldChallengeResolveData","createChallengeResolveData","dataKey","transStatus","paymentData","finalResObject","errorTypeAndCode","THREEDS2_TIMEOUT","THREEDS2_NO_TRANSSTATUS","_object_spread","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":"ivDAkBA,MAAMA,UAA6BC,EAuC/BC,iBAAAA,GAGI,IAF0BC,EAAcC,KAAKC,MAAMC,eAE7B,CAG6BC,IAKLC,EAAAC,EAP1C,MAAMC,EAO0B,SAA3BN,KAAKO,MAAMC,cAAqD,QAA3BH,EAAAL,KAAKO,MAAME,4BAAXJ,GAAgC,QAAhCD,EAAAC,EAA6BK,WAA7B,IAAAN,SAAAA,EAAkCO,SAAS,2BAK/EC,OAAEA,GAAWZ,KAAKC,MAAMC,cAI9B,IAHuBW,EAAeD,EAAQN,GAGzB,CAEjBN,KAAKc,SACD,CACIC,UAAW,GAAGC,EAAeC,qCAAqCjB,KAAKO,MAAMW,KAAKC,IAAI,oBAE1F,GAIJ,MAAMC,EAAQ,IAAIC,EAAoB,CAClCC,UAAWtB,KAAKO,MAAMgB,KACtBC,KAAMR,EAAeC,iCACrBQ,UAAWC,EAAeC,SAC1BC,QAAS,GAAGC,wDAKhB,OAHA7B,KAAKO,MAAMuB,kBAAkBV,QAE7BW,QAAQC,MAAM,sDAElB,CAEA,MAAMC,WAAEA,EAAUC,eAAEA,EAAcC,qBAAEA,GAA0BnC,KAAKC,MAAMC,cAAgCkC,SAGzG,IAAKH,IAAeC,IAAmBC,EAAsB,CAEzDnC,KAAKc,SACD,CACIC,UAAW,GAAGC,EAAeqB,0CAA0CrC,KAAKO,MAAMW,KAAKC,IAAI,oBAE/F,GAIJ,MAAMC,EAAQ,IAAIC,EAAoB,CAClCC,UAAWtB,KAAKO,MAAMg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AAO,CAClB,MAAMvG,EAA6CwG,EAAqB,CACpED,MAAOzG,KAAKO,MAAMkG,MAClBE,KAAM3G,KAAKO,MAAMqG,qBAAuB5G,KAAKO,MAAMoG,OAGvD3G,KAAKC,MAAQ,CACTsC,OAAQ,OACRrC,cAAeA,EAEvB,MAEIF,KAAKC,MAAQ,CAAEC,cAAe,CAAE2G,SAAS,EAAOpE,MAAOE,IAEvDZ,QAAQC,MAAM,GAAGH,MAA6Bc,IAEtD,EAzBA2D,EADE1G,EACqBkH,eAAe,CAClC1C,WAAY,OACZG,QAAS,OACTrB,UAAU"}
|
|
1
|
+
{"version":3,"file":"PrepareChallenge3DS2.js","sources":["../../../../../../src/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport DoChallenge3DS2 from './DoChallenge3DS2';\nimport { createChallengeResolveData, prepareChallengeData, isErrorObject } from '../utils';\nimport { PrepareChallenge3DS2Props, PrepareChallenge3DS2State, StatusErrorInfoObject } from './types';\nimport { ChallengeData, ResultObject, ThreeDS2FlowObject, ErrorCodeObject, ChallengeResolveData } from '../../types';\nimport '../../ThreeDS2.scss';\nimport Img from '../../../internal/Img';\nimport './challenge.scss';\nimport { hasOwnProperty } from '../../../../utils/hasOwnProperty';\nimport useImage from '../../../../core/Context/useImage';\nimport AdyenCheckoutError, { ERROR } from '../../../../core/Errors/AdyenCheckoutError';\nimport { THREEDS2_CHALLENGE, THREEDS2_CHALLENGE_ERROR, THREEDS2_NUM, MISSING_TOKEN_IN_ACTION_MSG } from '../../constants';\nimport { isValidHttpUrl } from '../../../../utils/isValidURL';\nimport { ErrorObject } from '../../../../core/Errors/types';\nimport { AnalyticsLogEvent, LogEventSubtype, LogEventType } from '../../../../core/Analytics/events/AnalyticsLogEvent';\nimport { AnalyticsErrorEvent, ErrorEventCode, ErrorEventType } from '../../../../core/Analytics/events/AnalyticsErrorEvent';\nimport { AbstractAnalyticsEvent } from '../../../../core/Analytics/events/AbstractAnalyticsEvent';\n\nclass PrepareChallenge3DS2 extends Component<PrepareChallenge3DS2Props, PrepareChallenge3DS2State> {\n public static readonly defaultProps = {\n onComplete: () => {},\n onError: () => {},\n isMDFlow: false\n };\n\n constructor(props) {\n super(props);\n\n if (this.props.token) {\n const challengeData: ChallengeData | ErrorObject = prepareChallengeData({\n token: this.props.token,\n size: this.props.challengeWindowSize || this.props.size // TODO confirm that this.props.size is legacy and can be removed\n });\n\n this.state = {\n status: 'init',\n challengeData: challengeData as ChallengeData\n };\n } else {\n // Will be picked up in componentDidMount\n this.state = { challengeData: { success: false, error: MISSING_TOKEN_IN_ACTION_MSG } };\n\n console.debug(`${THREEDS2_CHALLENGE_ERROR}: ${MISSING_TOKEN_IN_ACTION_MSG}`);\n }\n }\n\n public onFormSubmit = (msg: string) => {\n const event = new AnalyticsLogEvent({\n component: this.props.type,\n type: LogEventType.threeDS2,\n subType: LogEventSubtype.challengeDataSentWeb,\n message: msg\n });\n\n this.props.onSubmitAnalytics(event);\n };\n\n componentDidMount() {\n const hasChallengeData = !isErrorObject(this.state.challengeData);\n\n if (hasChallengeData) {\n const shouldAllowHttpDomains =\n /** Allow http urls if in development and testing against localhost:8080 */\n (process.env.NODE_ENV === 'development' && process.env.__CLIENT_ENV__?.includes('localhost:8080')) ||\n /**\n * Allows the checkoutshopper demo on localhost:8080 to work -\n * requires a configuration in localhost of environment: 'test', _environmentUrls: {api: 'http://localhost:8080/'}\n */\n (this.props.environment === 'test' && this.props._environmentUrls?.api?.includes('http://localhost:8080'));\n\n /**\n * Check the structure of the created challengeData\n */\n const { acsURL } = this.state.challengeData as ChallengeData;\n const hasValidAcsURL = isValidHttpUrl(acsURL, shouldAllowHttpDomains);\n\n // Only render component if we have an acsURL.\n if (!hasValidAcsURL) {\n // Set UI error & call onError callback\n this.setError(\n {\n errorInfo: `${ErrorEventCode.THREEDS2_TOKEN_IS_MISSING_ACSURL}: ${this.props.i18n.get('err.gen.9102')}` //\n },\n true\n );\n\n // Send error to analytics endpoint // TODO - check logs to see if this *ever* happens\n const event = new AnalyticsErrorEvent({\n component: this.props.type,\n code: ErrorEventCode.THREEDS2_TOKEN_IS_MISSING_ACSURL,\n errorType: ErrorEventType.threeDS2,\n message: `${THREEDS2_CHALLENGE_ERROR}: Decoded token is missing a valid acsURL property`\n });\n this.props.onSubmitAnalytics(event);\n\n console.debug('### PrepareChallenge3DS2::exiting:: no valid acsURL');\n return;\n }\n\n const { acsTransID, messageVersion, threeDSServerTransID } = (this.state.challengeData as ChallengeData).cReqData;\n\n // Only render component if we have a acsTransID, messageVersion & threeDSServerTransID\n if (!acsTransID || !messageVersion || !threeDSServerTransID) {\n // Set UI error & call onError callback\n this.setError(\n {\n errorInfo: `${ErrorEventCode.THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS}: ${this.props.i18n.get('err.gen.9102')}`\n },\n true\n );\n\n // Send error to analytics endpoint // TODO - check logs to see if this *ever* happens\n const event = new AnalyticsErrorEvent({\n component: this.props.type,\n code: ErrorEventCode.THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS,\n errorType: ErrorEventType.threeDS2,\n message: `${THREEDS2_CHALLENGE_ERROR}: Decoded token is missing one or more of the following properties (acsTransID | messageVersion | threeDSServerTransID)`\n });\n this.props.onSubmitAnalytics(event);\n\n console.debug(\n '### PrepareChallenge3DS2::exiting:: missing one or more of the following properties (acsTransID | messageVersion | threeDSServerTransID)'\n );\n return;\n }\n\n // Proceed to allow component to render\n this.setState({ status: 'performingChallenge' });\n //\n } else {\n const errorMsg: string = (this.state.challengeData as ErrorObject).error;\n\n const errorCode = errorMsg.includes(MISSING_TOKEN_IN_ACTION_MSG)\n ? ErrorEventCode.THREEDS2_ACTION_IS_MISSING_TOKEN\n : ErrorEventCode.THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED;\n\n // Set UI error & call onError callback\n this.setError(\n {\n errorInfo: `${errorCode}: ${this.props.i18n.get('err.gen.9102')}`\n // errorObj: this.state.challengeData // TODO Decide if we want to expose this data\n },\n true\n );\n\n // Send error to analytics endpoint // TODO - check logs to see if the base64 decoding errors *ever* happen\n const event = new AnalyticsErrorEvent({\n component: this.props.type,\n code: errorCode,\n errorType: ErrorEventType.threeDS2,\n message: `${THREEDS2_CHALLENGE_ERROR}: ${errorMsg}` // can be: 'Missing \"token\" property from threeDS2 action', 'not base64', 'malformed URI sequence' or 'Could not JSON parse token'\n });\n\n this.props.onSubmitAnalytics(event);\n\n console.debug('### PrepareChallenge3DS2::exiting:: no challengeData');\n }\n }\n\n setStatusComplete(resultObj: ResultObject, errorCodeObject: ErrorCodeObject = null) {\n this.setState({ status: 'complete' }, () => {\n const data: ChallengeResolveData = createChallengeResolveData(this.props.dataKey, resultObj.transStatus, this.props.paymentData);\n\n if (errorCodeObject) {\n console.debug('### PrepareChallenge3DS2::errorCodeObject::', errorCodeObject);\n }\n\n let event: AbstractAnalyticsEvent;\n\n /** Are we in an \"error\" i.e. timeout or no transStatus, scenario? If so, submit analytics about it */\n const finalResObject = errorCodeObject ? errorCodeObject : resultObj;\n if (finalResObject.errorCode) {\n const errorTypeAndCode = {\n code: finalResObject.errorCode === 'timeout' ? ErrorEventCode.THREEDS2_TIMEOUT : ErrorEventCode.THREEDS2_NO_TRANSSTATUS,\n errorType: ErrorEventType.threeDS2\n };\n\n // Challenge process has timed out,\n // or, It's an error reported by the backend 'cos no transStatus could be retrieved // TODO - check logs to see if this *ever* happens\n\n event = new AnalyticsErrorEvent({\n component: this.props.type,\n message: (finalResObject as ErrorCodeObject).message,\n ...errorTypeAndCode\n });\n\n // Send error to analytics endpoint\n this.props.onSubmitAnalytics(event);\n }\n\n /** Calculate \"result\" for analytics */\n let result: string;\n\n switch (resultObj?.transStatus) {\n case 'Y':\n result = 'success';\n break;\n case 'N':\n result = 'failed';\n break;\n case 'U':\n result = !errorCodeObject ? 'cancelled' : 'timeout';\n break;\n default:\n }\n if (resultObj?.errorCode) {\n result = 'noTransStatus';\n }\n\n /** Create log object - the process is completed, one way or another */\n\n event = new AnalyticsLogEvent({\n component: this.props.type,\n type: LogEventType.threeDS2,\n subType: LogEventSubtype.challengeCompleted,\n message: `${THREEDS2_NUM} challenge has completed`,\n result\n });\n\n // Send log to analytics endpoint\n this.props.onSubmitAnalytics(event);\n\n /**\n * Equals call to onAdditionalDetails (except for in 3DS2InMDFlow)\n */\n this.props.onComplete(data);\n });\n }\n\n /**\n * Display error in the UI,\n * and, optionally, decide whether to send any of these errors to the merchant defined onError callback\n *\n * @param errorInfoObj -\n * @param isFatal -\n */\n setError(errorInfoObj: StatusErrorInfoObject, isFatal: boolean) {\n this.setState({ status: 'error', errorInfo: errorInfoObj.errorInfo });\n\n // Decide whether to call this.props.onError\n if (isFatal) {\n this.props.onError(new AdyenCheckoutError(ERROR, errorInfoObj.errorInfo, { cause: errorInfoObj.errorObj }));\n }\n }\n\n render(_, { challengeData }) {\n const getImage = useImage();\n if (this.state.status === 'performingChallenge') {\n return (\n <DoChallenge3DS2\n onCompleteChallenge={(challenge: ThreeDS2FlowObject) => {\n let errorCodeObject: ErrorCodeObject = null;\n\n // Challenge has resulted in an error (no transStatus could be retrieved) - but we still treat this as a valid scenario\n if (hasOwnProperty(challenge.result, 'errorCode') && challenge.result.errorCode.length) {\n // Tell the merchant there's been an error\n errorCodeObject = {\n errorCode: challenge.result.errorCode,\n message: `${THREEDS2_CHALLENGE_ERROR}: ${\n challenge.result.errorDescription ? challenge.result.errorDescription : 'no transStatus could be retrieved'\n }`\n };\n\n /**\n * NOTE: we can now use this.props.isMDFlow to decide if we want to send any of these errors to the onError handler\n * - this is problematic in the regular flow since merchants tend to treat any calls to their onError handler as 'fatal',\n * but in the MDFlow we control what the onError handler does.\n */\n if (this.props.isMDFlow) {\n this.props.onError(\n new AdyenCheckoutError(\n ERROR,\n `${THREEDS2_CHALLENGE_ERROR}: ${\n challenge.result.errorDescription\n ? challenge.result.errorDescription\n : 'no transStatus could be retrieved'\n }`,\n { cause: challenge.result.errorCode }\n )\n );\n }\n }\n\n /**\n * An object has been returned, parsed & accepted as legit (according to the rules in getProcessMessageHandler),\n * but the result prop on that object is missing\n */\n if (!challenge.result) {\n this.setError(\n {\n errorInfo: `${THREEDS2_CHALLENGE_ERROR}: ${this.props.i18n.get('3ds.chal.805', {\n values: { result: '\"result\"' }\n })}`,\n errorObj: challenge as unknown as ErrorObject\n },\n true\n );\n\n // Send error to analytics endpoint\n const event = new AnalyticsErrorEvent({\n component: this.props.type,\n code: ErrorEventCode.THREEDS2_CHALLENGE_RESOLVED_WITHOUT_RESULT_PROP,\n errorType: ErrorEventType.threeDS2,\n message: `${THREEDS2_CHALLENGE_ERROR}: challenge resolved without a \"result\" object`\n });\n\n this.props.onSubmitAnalytics(event);\n\n console.debug('### PrepareChallenge3DS2::exiting:: challenge resolved without a \"result\" object');\n\n return;\n }\n\n // Proceed with call to onAdditionalDetails (except for in 3DS2InMDFlow)\n this.setStatusComplete(challenge.result, errorCodeObject);\n }}\n onErrorChallenge={(challenge: ThreeDS2FlowObject) => {\n /**\n * Called when challenge times-out (which is still a valid scenario)...\n */\n if (hasOwnProperty(challenge, 'errorCode')) {\n const timeoutObject: ErrorCodeObject = {\n errorCode: challenge.errorCode,\n message: `${THREEDS2_CHALLENGE}: ${challenge.errorCode}`\n };\n\n // see comment in onCompleteChallenge code block\n if (this.props.isMDFlow) {\n this.props.onError(\n new AdyenCheckoutError(ERROR, `${THREEDS2_CHALLENGE_ERROR}: '3DS2 challenge timed out'`, {\n cause: challenge.errorCode\n })\n );\n }\n\n this.setStatusComplete(challenge.result, timeoutObject);\n return;\n }\n }}\n {...challengeData}\n onActionHandled={this.props.onActionHandled}\n onFormSubmit={this.onFormSubmit}\n />\n );\n }\n\n if (this.state.status === 'error') {\n return (\n <div className=\"adyen-checkout__threeds2-challenge-error\">\n <Img\n className=\"adyen-checkout__status__icon adyen-checkout__status__icon--error\"\n src={getImage({\n imageFolder: 'components/'\n })('error')}\n alt={''}\n />\n <div className=\"adyen-checkout__status__text\">\n {this.state.errorInfo ? this.state.errorInfo : this.props.i18n.get('error.message.unknown')}\n </div>\n </div>\n );\n }\n\n return null;\n }\n}\n\nexport default PrepareChallenge3DS2;\n"],"names":["PrepareChallenge3DS2","Component","componentDidMount","isErrorObject","this","state","challengeData","process","_this_props__environmentUrls_api","_this_props__environmentUrls","shouldAllowHttpDomains","props","environment","_environmentUrls","api","includes","acsURL","isValidHttpUrl","setError","errorInfo","ErrorEventCode","THREEDS2_TOKEN_IS_MISSING_ACSURL","i18n","get","event","AnalyticsErrorEvent","component","type","code","errorType","ErrorEventType","threeDS2","message","THREEDS2_CHALLENGE_ERROR","onSubmitAnalytics","console","debug","acsTransID","messageVersion","threeDSServerTransID","cReqData","THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS","setState","status","errorMsg","error","errorCode","MISSING_TOKEN_IN_ACTION_MSG","THREEDS2_ACTION_IS_MISSING_TOKEN","THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED","setStatusComplete","resultObj","errorCodeObject","data","createChallengeResolveData","dataKey","transStatus","paymentData","finalResObject","errorTypeAndCode","THREEDS2_TIMEOUT","THREEDS2_NO_TRANSSTATUS","_object_spread","result","AnalyticsLogEvent","LogEventType","subType","LogEventSubtype","challengeCompleted","THREEDS2_NUM","onComplete","errorInfoObj","isFatal","onError","AdyenCheckoutError","ERROR","cause","errorObj","render","_","getImage","useImage","h","DoChallenge3DS2","onCompleteChallenge","challenge","hasOwnProperty","length","errorDescription","isMDFlow","values","THREEDS2_CHALLENGE_RESOLVED_WITHOUT_RESULT_PROP","onErrorChallenge","timeoutObject","THREEDS2_CHALLENGE","onActionHandled","onFormSubmit","div","className","Img","src","imageFolder","alt","constructor","super","_define_property","msg","challengeDataSentWeb","token","prepareChallengeData","size","challengeWindowSize","success","defaultProps"],"mappings":"8sDAkBA,MAAMA,UAA6BC,EAuC/BC,iBAAAA,GAGI,IAF0BC,EAAcC,KAAKC,MAAMC,eAE7B,CAG6BC,IAKLC,EAAAC,EAP1C,MAAMC,EAO0B,SAA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|
|
1
|
-
import{Component as e,createElement as t}from"../../../../external/preact/dist/preact.js";import r from"./DoFingerprint3DS2.js";import{isErrorObject as o,
|
|
1
|
+
import{Component as e,createElement as t}from"../../../../external/preact/dist/preact.js";import r from"./DoFingerprint3DS2.js";import{isErrorObject as o,createFingerprintResolveData as n,prepareFingerPrintData as s}from"../utils.js";import{isValidHttpUrl as i}from"../../../../utils/isValidURL.js";import{THREEDS2_FINGERPRINT_ERROR as p,MISSING_TOKEN_IN_ACTION_MSG as a,TIMEOUT as c,THREEDS2_NUM as l,THREEDS2_FINGERPRINT as m}from"../../constants.js";import{AnalyticsLogEvent as d,LogEventSubtype as h,LogEventType as u}from"../../../../core/Analytics/events/AnalyticsLogEvent.js";import{ErrorEventCode as S,ErrorEventType as D,AnalyticsErrorEvent as g}from"../../../../core/Analytics/events/AnalyticsErrorEvent.js";function f(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){f(e,t,r[t])})}return e}function y(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}class O extends e{componentDidMount(){if(!o(this.state.fingerPrintData)){var e,t;const r="test"===this.props.environment&&(null===(t=this.props._environmentUrls)||void 0===t||null===(e=t.api)||void 0===e?void 0:e.includes("http://localhost:8080")),{threeDSMethodURL:o,threeDSMethodNotificationURL:n,postMessageDomain:s,threeDSServerTransID:a}=this.state.fingerPrintData;if(!i(o,r))return this.setStatusComplete({threeDSCompInd:"U"},{errorCode:S.THREEDS2_TOKEN_IS_MISSING_THREEDSMETHODURL,message:`${p}: Decoded token is missing a valid threeDSMethodURL property`}),void console.debug("### PrepareFingerprint3DS2::exiting:: no valid threeDSMethodURL");const c=i(n,r),l=i(s,r),m=null==a?void 0:a.length;if(!c||!l||!m)return this.setStatusComplete({threeDSCompInd:"N"},{errorCode:S.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.includes(a)?S.THREEDS2_ACTION_IS_MISSING_TOKEN:S.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=n(this.props.dataKey,e,this.props.paymentData);let o;const s=t||e;if(s.errorCode){const e={code:s.errorCode===c?S.THREEDS2_TIMEOUT:s.errorCode,errorType:D.threeDS2};o=new g(b({component:this.props.type,message:s.message},e)),this.props.onSubmitAnalytics(o)}let i;switch(null==e?void 0:e.threeDSCompInd){case"Y":i="success";break;case"N":i=t?t.errorCode===c?c:"failedInternal":"failed";break;case"U":i="noThreeDSMethodURL"}o=new d({component:this.props.type,type:u.threeDS2,subType:h.fingerprintCompleted,message:`${l} fingerprinting has completed`,result:i}),this.props.onSubmitAnalytics(o),this.props.onComplete(r)})}render({showSpinner:e},{status:o,fingerPrintData:n}){return"retrievingFingerPrint"===o?t(r,y(b({onCompleteFingerprint:e=>{this.setStatusComplete(e.result)},onErrorFingerprint:e=>{const t={errorCode:e.errorCode,message:`${m}: ${e.errorCode}`};this.setStatusComplete(e.result,t)},showSpinner:e},n),{onActionHandled:this.props.onActionHandled,onFormSubmit:this.onFormSubmit})):null}constructor(e){super(e),f(this,"onFormSubmit",e=>{const t=new d({component:this.props.type,type:u.threeDS2,subType:h.fingerprintDataSentWeb,message:e});this.props.onSubmitAnalytics(t)});const{token:t,notificationURL:r}=this.props;if(t){const e=s({token:t,notificationURL:r});this.state={status:"init",fingerPrintData:e}}else this.state={fingerPrintData:{success:!1,error:a}},console.debug(`${p}: ${a}`)}}f(O,"type","scheme"),f(O,"defaultProps",{onComplete:()=>{},onError:()=>{},paymentData:"",showSpinner:!0,isMDFlow:!1});export{O as default};
|
|
2
2
|
//# sourceMappingURL=PrepareFingerprint3DS2.js.map
|