@adyen/adyen-web 6.0.3 → 6.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/adyen.css +1 -1
- package/dist/cjs/adyen.css.map +1 -1
- package/dist/cjs/index.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +14 -4
- package/dist/es/adyen.css +1 -1
- package/dist/es/adyen.css.map +1 -1
- package/dist/es/components/Card/Card.js +1 -1
- package/dist/es/components/Card/Card.js.map +1 -1
- package/dist/es/components/Card/components/CardInput/types.js.map +1 -1
- package/dist/es/components/CustomCard/CustomCard.js +1 -1
- package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
- package/dist/es/components/Dropin/components/DropinComponent.js +1 -1
- package/dist/es/components/Dropin/components/DropinComponent.js.map +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js.map +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
- package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
- package/dist/es/components/internal/Address/validate.js +1 -1
- package/dist/es/components/internal/Address/validate.js.map +1 -1
- package/dist/es/components/internal/Button/Button.js +1 -1
- package/dist/es/components/internal/Button/Button.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/constants.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/constants.js.map +1 -1
- package/dist/es/core/Analytics/analyticsPreProcessor.js +1 -1
- package/dist/es/core/Analytics/analyticsPreProcessor.js.map +1 -1
- package/dist/es/core/Analytics/utils.js +1 -1
- package/dist/es/core/Analytics/utils.js.map +1 -1
- package/dist/es/core/Services/analytics/collect-id.js +1 -1
- package/dist/es/core/core.js +1 -1
- package/dist/es/index.d.ts +14 -4
- package/dist/es/utils/constants/currency-decimals.js +1 -1
- package/dist/es/utils/constants/currency-decimals.js.map +1 -1
- package/dist/es-legacy/adyen.css +1 -1
- package/dist/es-legacy/adyen.css.map +1 -1
- package/dist/es-legacy/components/Card/Card.js +1 -1
- package/dist/es-legacy/components/Card/Card.js.map +1 -1
- package/dist/es-legacy/components/Card/components/CardInput/types.js.map +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
- package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/DropinComponent.js +1 -1
- package/dist/es-legacy/components/Dropin/components/DropinComponent.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js.map +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js +1 -1
- package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.js.map +1 -1
- package/dist/es-legacy/components/internal/Address/validate.js +1 -1
- package/dist/es-legacy/components/internal/Address/validate.js.map +1 -1
- package/dist/es-legacy/components/internal/Button/Button.js +1 -1
- package/dist/es-legacy/components/internal/Button/Button.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/constants.js.map +1 -1
- package/dist/es-legacy/core/Analytics/analyticsPreProcessor.js +1 -1
- package/dist/es-legacy/core/Analytics/analyticsPreProcessor.js.map +1 -1
- package/dist/es-legacy/core/Analytics/utils.js +1 -1
- package/dist/es-legacy/core/Analytics/utils.js.map +1 -1
- package/dist/es-legacy/core/Services/analytics/collect-id.js +1 -1
- package/dist/es-legacy/core/core.js +1 -1
- package/dist/es-legacy/utils/constants/currency-decimals.js +1 -1
- package/dist/es-legacy/utils/constants/currency-decimals.js.map +1 -1
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","sources":["../../../../../src/components/internal/Address/validate.ts"],"sourcesContent":["import { ValidatorRules, ValidatorRule } from '../../../utils/Validator/types';\nimport { countrySpecificFormatters } from './validate.formats';\nimport { ERROR_FIELD_REQUIRED, ERROR_INVALID_FORMAT_EXPECTS } from '../../../core/Errors/constants';\nimport { isEmpty } from '../../../utils/validator-utils';\n\nconst createPatternByDigits = (digits: number) => {\n return {\n pattern: new RegExp(`\\\\d{${digits}}`)\n };\n};\n\
|
|
1
|
+
{"version":3,"file":"validate.js","sources":["../../../../../src/components/internal/Address/validate.ts"],"sourcesContent":["import { ValidatorRules, ValidatorRule } from '../../../utils/Validator/types';\nimport { countrySpecificFormatters } from './validate.formats';\nimport { ERROR_FIELD_REQUIRED, ERROR_INVALID_FORMAT_EXPECTS } from '../../../core/Errors/constants';\nimport { isEmpty } from '../../../utils/validator-utils';\n\nconst createPatternByDigits = (digits: number) => {\n return {\n pattern: new RegExp(`\\\\d{${digits}}`)\n };\n};\n\nexport const validatePostalCode = (val: string, countryCode: string, validatorRules: ValidatorRules) => {\n if (countryCode) {\n // If there is no value, we display the 'required' error message\n if (isEmpty(val)) return null;\n\n // Dynamically create errorMessage\n (validatorRules.postalCode as ValidatorRule).errorMessage = {\n translationKey: ERROR_INVALID_FORMAT_EXPECTS,\n translationObject: {\n values: {\n format: countrySpecificFormatters[countryCode]?.postalCode.format || null\n }\n }\n };\n\n const pattern = postalCodePatterns[countryCode]?.pattern;\n return pattern ? pattern.test(val) : !!val; // No pattern? Accept any, filled, value.\n }\n // Default rule\n return isEmpty(val) ? null : true;\n};\n\nconst postalCodePatterns = {\n AT: createPatternByDigits(4),\n AU: createPatternByDigits(4),\n BE: { pattern: /(?:(?:[1-9])(?:\\d{3}))/ },\n BG: createPatternByDigits(4),\n BR: { pattern: /^\\d{5}-?\\d{3}$/ },\n CA: { pattern: /(?:[ABCEGHJ-NPRSTVXY]\\d[A-Z][ -]?\\d[A-Z]\\d)/ },\n CH: { pattern: /[1-9]\\d{3}/ },\n CY: createPatternByDigits(4),\n CZ: { pattern: /\\d{3}\\s?\\d{2}/ },\n DE: createPatternByDigits(5),\n DK: createPatternByDigits(4),\n EE: createPatternByDigits(5),\n ES: { pattern: /(?:0[1-9]|[1-4]\\d|5[0-2])\\d{3}/ },\n FI: createPatternByDigits(5),\n FR: createPatternByDigits(5),\n GB: { pattern: /^([A-Za-z][A-Ha-hK-Yk-y]?[0-9][A-Za-z0-9]? ?[0-9][A-Za-z]{2}|[Gg][Ii][Rr] ?0[Aa]{2})$/ },\n GE: createPatternByDigits(4),\n GR: { pattern: /^\\d{3}\\s{0,1}\\d{2}$/ },\n HR: { pattern: /^([1-5])[0-9]{4}$/ },\n HU: createPatternByDigits(4),\n IE: { pattern: /(?:^[AC-FHKNPRTV-Y][0-9]{2}|D6W)[ -]?[0-9AC-FHKNPRTV-Y]{4}/ },\n IS: createPatternByDigits(3),\n IT: createPatternByDigits(5),\n LI: createPatternByDigits(4),\n LT: { pattern: /^(LT-\\d{5}|\\d{4,5})$/ },\n LU: createPatternByDigits(4),\n LV: { pattern: /^(LV-)[0-9]{4}$/ },\n MC: { pattern: /^980\\d{2}$/ },\n MT: { pattern: /^[A-Za-z]{3}\\d{4}$/ },\n MY: createPatternByDigits(5),\n NL: { pattern: /(?:NL-)?(?:[1-9]\\d{3} ?(?:[A-EGHJ-NPRTVWXZ][A-EGHJ-NPRSTVWXZ]|S[BCEGHJ-NPRTVWXZ]))/ },\n NO: createPatternByDigits(4),\n PL: { pattern: /^\\d{2}[-]{0,1}\\d{3}$/ },\n PT: { pattern: /^([1-9]\\d{3})([- ]?(\\d{3})? *)$/ },\n RO: createPatternByDigits(6),\n SI: createPatternByDigits(4),\n SE: createPatternByDigits(5),\n SG: createPatternByDigits(6),\n SK: createPatternByDigits(5),\n US: createPatternByDigits(5)\n};\n\n/**\n * Validates only postalCode property. As the partial address form does not have the country selector, the country value\n * must be informed beforehand and can't be picked up from the form context\n *\n * @param country - Country that will be used to validate postal code\n */\nexport const getPartialAddressValidationRules = (country: string): ValidatorRules => {\n const validationRules: ValidatorRules = {\n postalCode: {\n modes: ['blur'],\n validate: val => {\n return validatePostalCode(val, country, validationRules);\n },\n errorMessage: ERROR_FIELD_REQUIRED\n }\n };\n return validationRules;\n};\n\nexport const getAddressValidationRules = (specifications): ValidatorRules => {\n const addressValidationRules: ValidatorRules = {\n postalCode: {\n modes: ['blur'],\n validate: (val, context) => {\n const country = context.state.data.country;\n return validatePostalCode(val, country, addressValidationRules);\n },\n errorMessage: ERROR_FIELD_REQUIRED\n },\n houseNumberOrName: {\n validate: (value, context) => {\n const selectedCountry = context.state?.data?.country;\n const isOptional = selectedCountry && specifications.countryHasOptionalField(selectedCountry, 'houseNumberOrName');\n return isOptional || (isEmpty(value) ? null : true);\n },\n modes: ['blur'],\n errorMessage: ERROR_FIELD_REQUIRED\n },\n default: {\n validate: value => (isEmpty(value) ? null : true), // true, if there are chars other than spaces\n modes: ['blur'],\n errorMessage: ERROR_FIELD_REQUIRED\n }\n };\n return addressValidationRules;\n};\n"],"names":["createPatternByDigits","digits","pattern","RegExp","validatePostalCode","val","countryCode","validatorRules","countrySpecificFormatters","postalCodePatterns","isEmpty","postalCode","errorMessage","translationKey","ERROR_INVALID_FORMAT_EXPECTS","translationObject","values","format","test","AT","AU","BE","BG","BR","CA","CH","CY","CZ","DE","DK","EE","ES","FI","FR","GB","GE","GR","HR","HU","IE","IS","IT","LI","LT","LU","LV","MC","MT","MY","NL","NO","PL","PT","RO","SI","SE","SG","SK","US","getPartialAddressValidationRules","country","validationRules","modes","validate","ERROR_FIELD_REQUIRED","getAddressValidationRules","specifications","addressValidationRules","context","state","data","houseNumberOrName","value","selectedCountry","countryHasOptionalField","default"],"mappings":"yOAKA,MAAMA,EAAyBC,IACpB,CACHC,QAAS,IAAIC,OAAO,OAAOF,QAItBG,EAAqB,CAACC,EAAaC,EAAqBC,KACjE,GAAID,EAAa,KASOE,EAKJC,EAZhB,GAAIC,EAAQL,G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,wBACfkD,GAAI,CAAElD,QAAS,mCACfmD,GAAIrD,EAAsB,GAC1BsD,GAAItD,EAAsB,GAC1BuD,GAAIvD,EAAsB,GAC1BwD,GAAIxD,EAAsB,GAC1ByD,GAAIzD,EAAsB,GAC1B0D,GAAI1D,EAAsB,IASjB2D,EAAoCC,IAC7C,MAAMC,EAAkC,CACpClD,WAAY,CACRmD,MAAO,CAAC,QACRC,SAAU1D,GACCD,EAAmBC,EAAKuD,EAASC,GAE5CjD,aAAcoD,IAGtB,OAAOH,CAAAA,EAGEI,EAA6BC,IACtC,MAAMC,EAAyC,CAC3CxD,WAAY,CACRmD,MAAO,CAAC,QACRC,SAAU,CAAC1D,EAAK+D,KACZ,MAAMR,EAAUQ,EAAQC,MAAMC,KAAKV,QACnC,OAAOxD,EAAmBC,EAAKuD,EAASO,EAAAA,EAE5CvD,aAAcoD,GAElBO,kBAAmB,CACfR,SAAU,CAACS,EAAOJ,SACUA,EAAAA,EAAxB,MAAMK,EAAkBL,QAAAA,EAAAA,EAAQC,aAARD,IAAAA,GAAmB,QAAnBA,EAAAA,EAAeE,YAAfF,IAAAA,OAAAA,EAAAA,EAAqBR,QAE7C,OADmBa,GAAmBP,EAAeQ,wBAAwBD,EAAiB,uBACxE/D,EAAQ8D,IAAS,IAAU,EAErDV,MAAO,CAAC,QACRlD,aAAcoD,GAElBW,QAAS,CACLZ,SAAUS,IAAU9D,EAAQ8D,IAAS,KACrCV,MAAO,CAAC,QACRlD,aAAcoD,IAGtB,OAAOG,CAAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Component as e,createElement as t}from"../../../external/preact/dist/preact.js";import
|
|
1
|
+
import{Component as e,createElement as t}from"../../../external/preact/dist/preact.js";import n from"../../../external/classnames/index.js";import a from"../Spinner/Spinner.js";import{useCoreContext as s}from"../../../core/Context/CoreProvider.js";function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class o extends e{render({classNameModifiers:e=[],disabled:i,href:o,icon:r,inline:l,label:c,status:d,variant:p},{completed:u}){const{i18n:m}=s(),_=r?t("img",{className:"adyen-checkout__button__icon",src:r,alt:"","aria-hidden":"true"}):"",h=[...e,..."primary"!==p?[p]:[],...l?["inline"]:[],...u?["completed"]:[],..."loading"===d||"redirect"===d?["loading"]:[]],b=n(["adyen-checkout__button",...h.map((e=>`adyen-checkout__button--${e}`))]),f={loading:t("span",{className:"adyen-checkout__button__content"},t(a,{size:"medium",inline:!0}),t("span",{className:"adyen-checkout__button__text--sr-only"},m.get("loading"))),redirect:t("span",{className:"adyen-checkout__button__content"},t(a,{size:"medium",inline:!0}),m.get("payButton.redirecting")),default:t("span",{className:"adyen-checkout__button__content"},_,t("span",{className:"adyen-checkout__button__text"},c))},y=f[d]||f.default;return o?t("a",{className:b,href:o,disabled:i,target:this.props.target,rel:this.props.rel},y):t("button",{className:b,type:"button",disabled:i,onClick:this.onClick},y,"loading"!==d&&"redirect"!==d&&this.props.children)}constructor(...e){super(...e),i(this,"onClick",(e=>{e.preventDefault(),this.props.disabled||this.props.onClick(e,{complete:this.complete})})),i(this,"complete",((e=1e3)=>{this.setState({completed:!0}),setTimeout((()=>{this.setState({completed:!1})}),e)}))}}i(o,"defaultProps",{status:"default",variant:"primary",disabled:!1,label:"",inline:!1,target:"_self",onClick:()=>{}});export{o as default};
|
|
2
2
|
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../../../src/components/internal/Button/Button.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport classNames from 'classnames';\nimport Spinner from '../Spinner';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport './Button.scss';\nimport { ButtonProps, ButtonState } from './types';\n\nclass Button extends Component<ButtonProps, ButtonState> {\n public static defaultProps = {\n status: 'default',\n variant: 'primary',\n disabled: false,\n label: '',\n inline: false,\n target: '_self',\n onClick: () => {}\n };\n\n public onClick = e => {\n e.preventDefault();\n\n if (!this.props.disabled) {\n this.props.onClick(e, { complete: this.complete });\n }\n };\n\n public complete = (delay = 1000) => {\n this.setState({ completed: true });\n setTimeout(() => {\n this.setState({ completed: false });\n }, delay);\n };\n\n render({ classNameModifiers = [], disabled, href, icon, inline, label, status, variant }, { completed }) {\n const { i18n } = useCoreContext();\n\n const buttonIcon = icon ? <img className=\"adyen-checkout__button__icon\" src={icon} alt=\"\" aria-hidden=\"true\" /> : '';\n\n const modifiers = [\n ...classNameModifiers,\n ...(variant !== 'primary' ? [variant] : []),\n ...(inline ? ['inline'] : []),\n ...(completed ? ['completed'] : []),\n ...(status === 'loading' || status === 'redirect' ? ['loading'] : [])\n ];\n\n const buttonClasses = classNames(['adyen-checkout__button', ...modifiers.map(m => `adyen-checkout__button--${m}`)]);\n\n const buttonStates = {\n loading: <Spinner size=\"medium\"
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../../../src/components/internal/Button/Button.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport classNames from 'classnames';\nimport Spinner from '../Spinner';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport './Button.scss';\nimport { ButtonProps, ButtonState } from './types';\n\nclass Button extends Component<ButtonProps, ButtonState> {\n public static defaultProps = {\n status: 'default',\n variant: 'primary',\n disabled: false,\n label: '',\n inline: false,\n target: '_self',\n onClick: () => {}\n };\n\n public onClick = e => {\n e.preventDefault();\n\n if (!this.props.disabled) {\n this.props.onClick(e, { complete: this.complete });\n }\n };\n\n public complete = (delay = 1000) => {\n this.setState({ completed: true });\n setTimeout(() => {\n this.setState({ completed: false });\n }, delay);\n };\n\n render({ classNameModifiers = [], disabled, href, icon, inline, label, status, variant }, { completed }) {\n const { i18n } = useCoreContext();\n\n const buttonIcon = icon ? <img className=\"adyen-checkout__button__icon\" src={icon} alt=\"\" aria-hidden=\"true\" /> : '';\n\n const modifiers = [\n ...classNameModifiers,\n ...(variant !== 'primary' ? [variant] : []),\n ...(inline ? ['inline'] : []),\n ...(completed ? ['completed'] : []),\n ...(status === 'loading' || status === 'redirect' ? ['loading'] : [])\n ];\n\n const buttonClasses = classNames(['adyen-checkout__button', ...modifiers.map(m => `adyen-checkout__button--${m}`)]);\n\n const buttonStates = {\n loading: (\n <span className=\"adyen-checkout__button__content\">\n <Spinner size=\"medium\" inline />\n <span className={'adyen-checkout__button__text--sr-only'}>{i18n.get('loading')}</span>\n </span>\n ),\n redirect: (\n <span className=\"adyen-checkout__button__content\">\n <Spinner size=\"medium\" inline />\n {i18n.get('payButton.redirecting')}\n </span>\n ),\n default: (\n <span className=\"adyen-checkout__button__content\">\n {buttonIcon}\n <span className=\"adyen-checkout__button__text\">{label}</span>\n </span>\n )\n };\n\n const buttonText = buttonStates[status] || buttonStates.default;\n\n if (href) {\n return (\n <a className={buttonClasses} href={href} disabled={disabled} target={this.props.target} rel={this.props.rel}>\n {buttonText}\n </a>\n );\n }\n\n return (\n <button className={buttonClasses} type=\"button\" disabled={disabled} onClick={this.onClick}>\n {buttonText}\n {status !== 'loading' && status !== 'redirect' && this.props.children}\n </button>\n );\n }\n}\n\nexport default Button;\n"],"names":["Button","Component","render","classNameModifiers","disabled","href","icon","inline","label","status","variant","completed","i18n","useCoreContext","buttonIcon","h","img","className","src","alt","aria-hidden","modifiers","buttonClasses","classNames","map","m","buttonStates","loading","span","Spinner","size","get","redirect","default","buttonText","a","target","this","props","rel","button","type","onClick","children","_define_property","e","preventDefault","complete","delay","setState","setTimeout","defaultProps"],"mappings":"gXAOA,MAAMA,UAAeC,EA0BjBC,MAAAA,EAAOC,mBAAEA,EAAqB,GAAEC,SAAEA,EAAQC,KAAEA,EAAIC,KAAEA,EAAIC,OAAEA,EAAMC,MAAEA,EAAKC,OAAEA,EAAMC,QAAEA,IAAWC,UAAEA,IACxF,MAAMC,KAAEA,GAASC,IAEXC,EAAaR,EAAOS,EAACC,MAAAA,CAAIC,UAAU,+BAA+BC,IAAKZ,EAAMa,IAAI,GAAGC,cAAY,SAA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eAAe,CACzB1C,OAAQ,UACRC,QAAS,UACTN,UAAU,EACVI,MAAO,GACPD,QAAQ,EACR6B,OAAQ,QACRM,QAAS"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e="encrypted",r="encryptedCardNumber",c="encryptedExpiryDate",t="encryptedExpiryMonth",a="encryptedExpiryYear",d="encryptedSecurityCode",i="encryptedPassword",n="encryptedBankAccountNumber",o="encryptedBankLocationId",s="encryptedSecurityCode3digits",y="encryptedSecurityCode4digits",p="giftcard",u="5.
|
|
1
|
+
const e="encrypted",r="encryptedCardNumber",c="encryptedExpiryDate",t="encryptedExpiryMonth",a="encryptedExpiryYear",d="encryptedSecurityCode",i="encryptedPassword",n="encryptedBankAccountNumber",o="encryptedBankLocationId",s="encryptedSecurityCode3digits",y="encryptedSecurityCode4digits",p="giftcard",u="5.3.0",m=["amex","mc","visa"],C=["ach",p],b=[r,c,t,a,d,i],x=[n,o],h=b.concat(x),D=["bcmc"],g="required",k="optional",B="hidden",l=g,v=k,A=B,E=g,M=k,N=B,S="data-cse",f="data-info",j="data-uid",I=["accel","pulse","star","nyce"],w={visa:"VISA",mc:"MasterCard",amex:"American Express",discover:"Discover",cup:"China Union Pay",jcb:"JCB",diners:"Diners Club",maestro:"Maestro",bcmc:"Bancontact card",bijcard:"de Bijenkorf Card"},L={[r]:"cardNumber",[c]:"expiryDate",[d]:"securityCode",[t]:"expiryMonth",[a]:"expiryYear",[i]:"password",[n]:"bankAccountNumber",[o]:"bankLocationId",[s]:"securityCodeThreeDigits",[y]:"securityCodeFourDigits"},P=6e3;export{h as ALL_SECURED_FIELDS,I as BRAND_ICON_UI_EXCLUSION_LIST,w as BRAND_READABLE_NAME_MAP,b as CREDIT_CARD_SF_FIELDS,A as CVC_POLICY_HIDDEN,v as CVC_POLICY_OPTIONAL,l as CVC_POLICY_REQUIRED,S as DATA_ENCRYPTED_FIELD_ATTR,f as DATA_INFO,j as DATA_UID,N as DATE_POLICY_HIDDEN,M as DATE_POLICY_OPTIONAL,E as DATE_POLICY_REQUIRED,D as DEDICATED_CARD_COMPONENTS,m as DEFAULT_CARD_GROUP_TYPES,e as ENCRYPTED,n as ENCRYPTED_BANK_ACCNT_NUMBER_FIELD,o as ENCRYPTED_BANK_LOCATION_FIELD,r as ENCRYPTED_CARD_NUMBER,c as ENCRYPTED_EXPIRY_DATE,t as ENCRYPTED_EXPIRY_MONTH,a as ENCRYPTED_EXPIRY_YEAR,i as ENCRYPTED_PWD_FIELD,d as ENCRYPTED_SECURITY_CODE,s as ENCRYPTED_SECURITY_CODE_3_DIGITS,y as ENCRYPTED_SECURITY_CODE_4_DIGITS,p as GIFT_CARD,B as HIDDEN,C as NON_CREDIT_CARD_TYPE_SECURED_FIELDS,k as OPTIONAL,x as OTHER_SF_FIELDS,g as REQUIRED,P as SF_CONFIG_TIMEOUT,L as SF_FIELDS_MAP,u as SF_VERSION};
|
|
2
2
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../../../../../../src/components/internal/SecuredFields/lib/constants.ts"],"sourcesContent":["import { CVCPolicyType, DatePolicyType } from './types';\n\nexport const ENCRYPTED = 'encrypted';\n\nexport const ENCRYPTED_CARD_NUMBER = 'encryptedCardNumber';\nexport const ENCRYPTED_EXPIRY_DATE = 'encryptedExpiryDate';\nexport const ENCRYPTED_EXPIRY_MONTH = 'encryptedExpiryMonth';\nexport const ENCRYPTED_EXPIRY_YEAR = 'encryptedExpiryYear';\nexport const ENCRYPTED_SECURITY_CODE = 'encryptedSecurityCode';\nexport const ENCRYPTED_PWD_FIELD = 'encryptedPassword';\nexport const ENCRYPTED_PIN_FIELD = 'encryptedPin';\nexport const ENCRYPTED_BANK_ACCNT_NUMBER_FIELD = 'encryptedBankAccountNumber';\nexport const ENCRYPTED_BANK_LOCATION_FIELD = 'encryptedBankLocationId';\n\nexport const ENCRYPTED_SECURITY_CODE_3_DIGITS = 'encryptedSecurityCode3digits';\nexport const ENCRYPTED_SECURITY_CODE_4_DIGITS = 'encryptedSecurityCode4digits';\n\nexport const GIFT_CARD = 'giftcard';\n\nexport const SF_VERSION = '5.
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../../../src/components/internal/SecuredFields/lib/constants.ts"],"sourcesContent":["import { CVCPolicyType, DatePolicyType } from './types';\n\nexport const ENCRYPTED = 'encrypted';\n\nexport const ENCRYPTED_CARD_NUMBER = 'encryptedCardNumber';\nexport const ENCRYPTED_EXPIRY_DATE = 'encryptedExpiryDate';\nexport const ENCRYPTED_EXPIRY_MONTH = 'encryptedExpiryMonth';\nexport const ENCRYPTED_EXPIRY_YEAR = 'encryptedExpiryYear';\nexport const ENCRYPTED_SECURITY_CODE = 'encryptedSecurityCode';\nexport const ENCRYPTED_PWD_FIELD = 'encryptedPassword';\nexport const ENCRYPTED_PIN_FIELD = 'encryptedPin';\nexport const ENCRYPTED_BANK_ACCNT_NUMBER_FIELD = 'encryptedBankAccountNumber';\nexport const ENCRYPTED_BANK_LOCATION_FIELD = 'encryptedBankLocationId';\n\nexport const ENCRYPTED_SECURITY_CODE_3_DIGITS = 'encryptedSecurityCode3digits';\nexport const ENCRYPTED_SECURITY_CODE_4_DIGITS = 'encryptedSecurityCode4digits';\n\nexport const GIFT_CARD = 'giftcard';\n\nexport const SF_VERSION = '5.3.0';\n\nexport const DEFAULT_CARD_GROUP_TYPES = ['amex', 'mc', 'visa'];\n\nexport const NON_CREDIT_CARD_TYPE_SECURED_FIELDS = ['ach', GIFT_CARD]; // Maybe, sometime in the future will include 'sepa' & 'sepadirectdebit'\n\n// Credit card (CardInput) related securedFields (based on the data-cse attribute)\nexport const CREDIT_CARD_SF_FIELDS = [\n ENCRYPTED_CARD_NUMBER,\n ENCRYPTED_EXPIRY_DATE,\n ENCRYPTED_EXPIRY_MONTH,\n ENCRYPTED_EXPIRY_YEAR,\n ENCRYPTED_SECURITY_CODE,\n ENCRYPTED_PWD_FIELD\n // ENCRYPTED_PIN_FIELD,// probably redundant - it was an alt. name for KCP's encryptedPassword. But maybe has a role to play if we ever encrypt ibans.\n];\n\nexport const OTHER_SF_FIELDS = [ENCRYPTED_BANK_ACCNT_NUMBER_FIELD, ENCRYPTED_BANK_LOCATION_FIELD]; // ACH fields\n\n/** A list of all the data-cse attributes that relate to securedFields (as found in card, giftcard or ach) */\nexport const ALL_SECURED_FIELDS = CREDIT_CARD_SF_FIELDS.concat(OTHER_SF_FIELDS);\n\n// Card components created as: checkout.create({BRAND}) e.g. checkout.create('bcmc')\n// - which are dedicated to a single, core, brand e.g. 'bcmc' BUT which can in effect handle multiple brands e.g. \"bcmc\", \"maestro\", \"visa\"\nexport const DEDICATED_CARD_COMPONENTS = ['bcmc'];\n\nexport const REQUIRED = 'required';\nexport const OPTIONAL = 'optional';\nexport const HIDDEN = 'hidden';\n\nexport const CVC_POLICY_REQUIRED: CVCPolicyType = REQUIRED;\nexport const CVC_POLICY_OPTIONAL: CVCPolicyType = OPTIONAL;\nexport const CVC_POLICY_HIDDEN: CVCPolicyType = HIDDEN;\n\nexport const DATE_POLICY_REQUIRED: DatePolicyType = REQUIRED;\nexport const DATE_POLICY_OPTIONAL: DatePolicyType = OPTIONAL;\nexport const DATE_POLICY_HIDDEN: DatePolicyType = HIDDEN;\n\nexport const DATA_ENCRYPTED_FIELD_ATTR = 'data-cse';\nexport const DATA_INFO = 'data-info';\nexport const DATA_UID = 'data-uid';\n\nexport const BRAND_ICON_UI_EXCLUSION_LIST = ['accel', 'pulse', 'star', 'nyce'];\n\nexport const BRAND_READABLE_NAME_MAP = {\n visa: 'VISA',\n mc: 'MasterCard',\n amex: 'American Express',\n discover: 'Discover',\n cup: 'China Union Pay',\n jcb: 'JCB',\n diners: 'Diners Club',\n maestro: 'Maestro',\n bcmc: 'Bancontact card',\n bijcard: 'de Bijenkorf Card'\n};\n\nexport const SF_FIELDS_MAP = {\n [ENCRYPTED_CARD_NUMBER]: 'cardNumber', // ph\n [ENCRYPTED_EXPIRY_DATE]: 'expiryDate', // ph\n [ENCRYPTED_SECURITY_CODE]: 'securityCode',\n [ENCRYPTED_EXPIRY_MONTH]: 'expiryMonth', // ph\n [ENCRYPTED_EXPIRY_YEAR]: 'expiryYear', // ph\n //\n [ENCRYPTED_PWD_FIELD]: 'password',\n [ENCRYPTED_BANK_ACCNT_NUMBER_FIELD]: 'bankAccountNumber',\n [ENCRYPTED_BANK_LOCATION_FIELD]: 'bankLocationId',\n //\n [ENCRYPTED_SECURITY_CODE_3_DIGITS]: 'securityCodeThreeDigits', // ph\n [ENCRYPTED_SECURITY_CODE_4_DIGITS]: 'securityCodeFourDigits' // ph\n};\n\n/** time within which we expect to receive a \"configured\" message from a securedField iframe, once it has registered as having loaded */\nexport const SF_CONFIG_TIMEOUT = 6000;\n"],"names":["ENCRYPTED","ENCRYPTED_CARD_NUMBER","ENCRYPTED_EXPIRY_DATE","ENCRYPTED_EXPIRY_MONTH","ENCRYPTED_EXPIRY_YEAR","ENCRYPTED_SECURITY_CODE","ENCRYPTED_PWD_FIELD","ENCRYPTED_BANK_ACCNT_NUMBER_FIELD","ENCRYPTED_BANK_LOCATION_FIELD","ENCRYPTED_SECURITY_CODE_3_DIGITS","ENCRYPTED_SECURITY_CODE_4_DIGITS","GIFT_CARD","SF_VERSION","DEFAULT_CARD_GROUP_TYPES","NON_CREDIT_CARD_TYPE_SECURED_FIELDS","CREDIT_CARD_SF_FIELDS","OTHER_SF_FIELDS","ALL_SECURED_FIELDS","concat","DEDICATED_CARD_COMPONENTS","REQUIRED","OPTIONAL","HIDDEN","CVC_POLICY_REQUIRED","CVC_POLICY_OPTIONAL","CVC_POLICY_HIDDEN","DATE_POLICY_REQUIRED","DATE_POLICY_OPTIONAL","DATE_POLICY_HIDDEN","DATA_ENCRYPTED_FIELD_ATTR","DATA_INFO","DATA_UID","BRAND_ICON_UI_EXCLUSION_LIST","BRAND_READABLE_NAME_MAP","visa","mc","amex","discover","cup","jcb","diners","maestro","bcmc","bijcard","SF_FIELDS_MAP","SF_CONFIG_TIMEOUT"],"mappings":"AAEO,MAAMA,EAAY,YAEZC,EAAwB,sBACxBC,EAAwB,sBACxBC,EAAyB,uBACzBC,EAAwB,sBACxBC,EAA0B,wBAC1BC,EAAsB,oBAEtBC,EAAoC,6BACpCC,EAAgC,0BAEhCC,EAAmC,+BACnCC,EAAmC,+BAEnCC,EAAY,WAEZC,EAAa,QAEbC,EAA2B,CAAC,OAAQ,KAAM,QAE1CC,EAAsC,CAAC,MAAOH,GAG9CI,EAAwB,CACjCd,EACAC,EACAC,EACAC,EACAC,EACAC,GAISU,EAAkB,CAACT,EAAmCC,GAGtDS,EAAqBF,EAAsBG,OAAOF,GAIlDG,EAA4B,CAAC,QAE7BC,EAAW,WACXC,EAAW,WACXC,EAAS,SAETC,EAAqCH,EACrCI,EAAqCH,EACrCI,EAAmCH,EAEnCI,EAAuCN,EACvCO,EAAuCN,EACvCO,EAAqCN,EAErCO,EAA4B,WAC5BC,EAAY,YACZC,EAAW,WAEXC,EAA+B,CAAC,QAAS,QAAS,OAAQ,QAE1DC,EAA0B,CACnCC,KAAM,OACNC,GAAI,aACJC,KAAM,mBACNC,SAAU,WACVC,IAAK,kBACLC,IAAK,MACLC,OAAQ,cACRC,QAAS,UACTC,KAAM,kBACNC,QAAS,qBAGAC,EAAgB,CACzB3C,CAACA,GAAwB,aACzBC,CAACA,GAAwB,aACzBG,CAACA,GAA0B,eAC3BF,CAACA,GAAyB,cAC1BC,CAACA,GAAwB,aAEzBE,CAACA,GAAsB,WACvBC,CAACA,GAAoC,oBACrCC,CAACA,GAAgC,iBAEjCC,CAACA,GAAmC,0BACpCC,CAACA,GAAmC,0BAI3BmC,EAAoB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ANALYTICS_EVENT_ERROR as e,ANALYTICS_EVENT_LOG as t,ANALYTICS_ACTION_STR as a,ANALYTICS_SUBMIT_STR as n,ANALYTICS_VALIDATION_ERROR_STR as r,ANALYTICS_EVENT_INFO as o,ANALYTICS_SELECTED_STR as s,ANALYTICS_DOWNLOAD_STR as c,ANALYTICS_INPUT_STR as i,ANALYTICS_DISPLAYED_STR as p,ANALYTICS_UNFOCUS_STR as y,ANALYTICS_FOCUS_STR as m,ANALYTICS_CONFIGURED_STR as d,ANALYTICS_RENDERED_STR as l,ANALYTICS_EXPRESS_PAGES_ARRAY as b}from"./constants.js";import{THREEDS2_ERROR as u,THREEDS2_FULL as v}from"../../components/ThreeDS2/constants.js";import g,{SDK_ERROR as f}from"../Errors/AdyenCheckoutError.js";import{getCardConfigData as E}from"./utils.js";function h(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const k=k=>(A,P,j={})=>{const{type:w,target:O}=P;if(!w)throw new g(f,"You are trying to create an analytics event without a type");switch(w){case l:{const{isStoredPaymentMethod:e,brand:t}=P,{isExpress:
|
|
1
|
+
import{ANALYTICS_EVENT_ERROR as e,ANALYTICS_EVENT_LOG as t,ANALYTICS_ACTION_STR as a,ANALYTICS_SUBMIT_STR as n,ANALYTICS_VALIDATION_ERROR_STR as r,ANALYTICS_EVENT_INFO as o,ANALYTICS_SELECTED_STR as s,ANALYTICS_DOWNLOAD_STR as c,ANALYTICS_INPUT_STR as i,ANALYTICS_DISPLAYED_STR as p,ANALYTICS_UNFOCUS_STR as y,ANALYTICS_FOCUS_STR as m,ANALYTICS_CONFIGURED_STR as d,ANALYTICS_RENDERED_STR as l,ANALYTICS_EXPRESS_PAGES_ARRAY as b}from"./constants.js";import{THREEDS2_ERROR as u,THREEDS2_FULL as v}from"../../components/ThreeDS2/constants.js";import g,{SDK_ERROR as f}from"../Errors/AdyenCheckoutError.js";import{getCardConfigData as E}from"./utils.js";function h(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const k=k=>(A,P,j={})=>{const{type:w,target:O}=P;if(!w)throw new g(f,"You are trying to create an analytics event without a type");switch(w){case l:{const{isStoredPaymentMethod:e,brand:t,configData:a}=P,{isExpress:n,expressPage:r}=j,s=r&&b.includes(r),{type:c}=j;let i=null;"scheme"!==c&&"bcmc"!==c&&"customcard"!==c||(i=E(j));const p=function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{},n=Object.keys(a);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(a).filter((function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable})))),n.forEach((function(t){h(e,t,a[t])}))}return e}({component:A,type:w},"boolean"==typeof e&&{isStoredPaymentMethod:e},t&&{brand:t},"boolean"==typeof n&&{isExpress:n},!0===n&&s&&{expressPage:r},i&&{configData:i},a&&{configData:a});k.createAnalyticsEvent({event:o,data:p});break}case d:{const{isStoredPaymentMethod:e,brand:t}=P,a={component:A,type:w,isStoredPaymentMethod:e,brand:t};k.createAnalyticsEvent({event:o,data:a});break}case m:case y:case p:case i:case c:k.createAnalyticsEvent({event:o,data:{component:A,type:w,target:O}});break;case s:{const{issuer:e}=P;k.createAnalyticsEvent({event:o,data:{component:A,type:w,target:O,issuer:e}});break}case r:{const{validationErrorCode:e,validationErrorMessage:t}=P;k.createAnalyticsEvent({event:o,data:{component:A,type:w,target:O,validationErrorCode:e,validationErrorMessage:t}});break}case n:k.createAnalyticsEvent({event:t,data:{component:A,type:w,message:"Shopper clicked pay"}});break;case a:{const{subtype:e,message:a}=P;k.createAnalyticsEvent({event:t,data:{component:A,type:w,subtype:e,message:a}});break}case v:{const{message:e,metadata:a,subtype:n,result:r}=P;k.createAnalyticsEvent({event:t,data:{component:A,type:w,message:e,metadata:a,subtype:n,result:r}});break}case u:{const{message:t,code:a,errorType:n}=P;k.createAnalyticsEvent({event:e,data:{component:A,type:w,message:t,code:a,errorType:n}});break}default:k.createAnalyticsEvent(P)}};export{k as analyticsPreProcessor};
|
|
2
2
|
//# sourceMappingURL=analyticsPreProcessor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyticsPreProcessor.js","sources":["../../../../src/core/Analytics/analyticsPreProcessor.ts"],"sourcesContent":["import { AnalyticsModule } from '../../types/global-types';\nimport { ConfigData, CreateAnalyticsEventObject, SendAnalyticsObject } from './types';\nimport {\n ANALYTICS_ACTION_STR,\n ANALYTICS_CONFIGURED_STR,\n ANALYTICS_DISPLAYED_STR,\n ANALYTICS_DOWNLOAD_STR,\n ANALYTICS_EVENT_ERROR,\n ANALYTICS_EVENT_INFO,\n ANALYTICS_EVENT_LOG,\n ANALYTICS_FOCUS_STR,\n ANALYTICS_INPUT_STR,\n ANALYTICS_RENDERED_STR,\n ANALYTICS_SELECTED_STR,\n ANALYTICS_SUBMIT_STR,\n ANALYTICS_UNFOCUS_STR,\n ANALYTICS_VALIDATION_ERROR_STR,\n ANALYTICS_EXPRESS_PAGES_ARRAY\n} from './constants';\nimport { THREEDS2_ERROR, THREEDS2_FULL } from '../../components/ThreeDS2/constants';\nimport AdyenCheckoutError, { SDK_ERROR } from '../Errors/AdyenCheckoutError';\nimport { getCardConfigData } from './utils';\n\nexport const analyticsPreProcessor = (analyticsModule: AnalyticsModule) => {\n // return function with an analyticsModule reference\n return (component: string, analyticsObj: SendAnalyticsObject, uiElementProps = {} as any) => {\n const { type, target } = analyticsObj;\n\n if (!type) {\n throw new AdyenCheckoutError(SDK_ERROR, 'You are trying to create an analytics event without a type');\n }\n\n switch (type) {\n /**\n * INFO\n */\n // Called from BaseElement (when component mounted) or, from DropinComponent (after mounting, when it has finished resolving all the PM promises)\n // &/or, from DropinComponent when a PM is selected\n case ANALYTICS_RENDERED_STR: {\n const { isStoredPaymentMethod, brand } = analyticsObj;\n\n // Expected from Wallet PMs\n const { isExpress, expressPage } = uiElementProps;\n\n const hasExpressPage = expressPage && ANALYTICS_EXPRESS_PAGES_ARRAY.includes(expressPage);\n\n const { type: componentType } = uiElementProps;\n let configData: ConfigData = null;\n\n if (componentType === 'scheme' || componentType === 'bcmc' || componentType === 'customcard') {\n // Expected from Card related PMs\n configData = getCardConfigData(uiElementProps);\n }\n\n const data = {\n component,\n type,\n ...(typeof isStoredPaymentMethod === 'boolean' && { isStoredPaymentMethod }), // if defined and a boolean...\n ...(brand && { brand }),\n ...(typeof isExpress === 'boolean' && { isExpress }),\n ...(isExpress === true && hasExpressPage && { expressPage }), // We only care about the expressPage value if isExpress is true\n ...(configData && { configData })\n };\n\n analyticsModule.createAnalyticsEvent({\n event: ANALYTICS_EVENT_INFO,\n data\n });\n\n break;\n }\n\n case ANALYTICS_CONFIGURED_STR: {\n const { isStoredPaymentMethod, brand } = analyticsObj;\n const data = { component, type, isStoredPaymentMethod, brand };\n\n analyticsModule.createAnalyticsEvent({\n event: ANALYTICS_EVENT_INFO,\n data\n });\n break;\n }\n\n case ANALYTICS_FOCUS_STR:\n case ANALYTICS_UNFOCUS_STR:\n case ANALYTICS_DISPLAYED_STR: // issuerList\n case ANALYTICS_INPUT_STR: // issuerList\n case ANALYTICS_DOWNLOAD_STR: // QR codes\n analyticsModule.createAnalyticsEvent({\n event: ANALYTICS_EVENT_INFO,\n data: { component, type, target }\n });\n break;\n\n // - ApplePay & GooglePay when instant PMs\n // - issuerList buttons\n case ANALYTICS_SELECTED_STR: {\n const { issuer } = analyticsObj;\n analyticsModule.createAnalyticsEvent({\n event: ANALYTICS_EVENT_INFO,\n data: { component, type, target, issuer }\n });\n break;\n }\n\n case ANALYTICS_VALIDATION_ERROR_STR: {\n const { validationErrorCode, validationErrorMessage } = analyticsObj;\n analyticsModule.createAnalyticsEvent({\n event: ANALYTICS_EVENT_INFO,\n data: { component, type, target, validationErrorCode, validationErrorMessage }\n });\n break;\n }\n\n /**\n * LOGS\n */\n case ANALYTICS_SUBMIT_STR:\n analyticsModule.createAnalyticsEvent({\n event: ANALYTICS_EVENT_LOG,\n data: { component, type, message: 'Shopper clicked pay' }\n });\n break;\n\n case ANALYTICS_ACTION_STR: {\n const { subtype, message } = analyticsObj;\n analyticsModule.createAnalyticsEvent({\n event: ANALYTICS_EVENT_LOG,\n data: { component, type, subtype, message }\n });\n break;\n }\n\n // General 3DS2 log events: \"action handled\" (i.e. iframe loaded), data sent, process completed\n case THREEDS2_FULL: {\n const { message, metadata, subtype, result } = analyticsObj;\n\n analyticsModule.createAnalyticsEvent({\n event: ANALYTICS_EVENT_LOG,\n data: { component, type, message, metadata, subtype, result }\n });\n break;\n }\n\n /**\n * ERRORS\n */\n case THREEDS2_ERROR: {\n const { message, code, errorType } = analyticsObj;\n analyticsModule.createAnalyticsEvent({\n event: ANALYTICS_EVENT_ERROR,\n data: { component, type, message, code, errorType }\n });\n break;\n }\n\n default: {\n analyticsModule.createAnalyticsEvent(analyticsObj as CreateAnalyticsEventObject);\n }\n }\n };\n};\n"],"names":["analyticsPreProcessor","analyticsModule","component","analyticsObj","uiElementProps","type","target","AdyenCheckoutError","SDK_ERROR","ANALYTICS_RENDERED_STR","isStoredPaymentMethod","brand","isExpress","expressPage","hasExpressPage","ANALYTICS_EXPRESS_PAGES_ARRAY","includes","componentType","
|
|
1
|
+
{"version":3,"file":"analyticsPreProcessor.js","sources":["../../../../src/core/Analytics/analyticsPreProcessor.ts"],"sourcesContent":["import { AnalyticsModule } from '../../types/global-types';\nimport { ConfigData, CreateAnalyticsEventObject, SendAnalyticsObject } from './types';\nimport {\n ANALYTICS_ACTION_STR,\n ANALYTICS_CONFIGURED_STR,\n ANALYTICS_DISPLAYED_STR,\n ANALYTICS_DOWNLOAD_STR,\n ANALYTICS_EVENT_ERROR,\n ANALYTICS_EVENT_INFO,\n ANALYTICS_EVENT_LOG,\n ANALYTICS_FOCUS_STR,\n ANALYTICS_INPUT_STR,\n ANALYTICS_RENDERED_STR,\n ANALYTICS_SELECTED_STR,\n ANALYTICS_SUBMIT_STR,\n ANALYTICS_UNFOCUS_STR,\n ANALYTICS_VALIDATION_ERROR_STR,\n ANALYTICS_EXPRESS_PAGES_ARRAY\n} from './constants';\nimport { THREEDS2_ERROR, THREEDS2_FULL } from '../../components/ThreeDS2/constants';\nimport AdyenCheckoutError, { SDK_ERROR } from '../Errors/AdyenCheckoutError';\nimport { getCardConfigData } from './utils';\n\nexport const analyticsPreProcessor = (analyticsModule: AnalyticsModule) => {\n // return function with an analyticsModule reference\n return (component: string, analyticsObj: SendAnalyticsObject, uiElementProps = {} as any) => {\n const { type, target } = analyticsObj;\n\n if (!type) {\n throw new AdyenCheckoutError(SDK_ERROR, 'You are trying to create an analytics event without a type');\n }\n\n switch (type) {\n /**\n * INFO\n */\n // Called from BaseElement (when component mounted) or, from DropinComponent (after mounting, when it has finished resolving all the PM promises)\n // &/or, from DropinComponent when a PM is selected\n // Only Drop-in sends the configData directly, if it happens the configData from the component(drop-in atm) will take over the internal configData below.\n case ANALYTICS_RENDERED_STR: {\n const { isStoredPaymentMethod, brand, configData: originalConfigData } = analyticsObj;\n\n // Expected from Wallet PMs\n const { isExpress, expressPage } = uiElementProps;\n\n const hasExpressPage = expressPage && ANALYTICS_EXPRESS_PAGES_ARRAY.includes(expressPage);\n\n const { type: componentType } = uiElementProps;\n let configData: ConfigData = null;\n\n if (componentType === 'scheme' || componentType === 'bcmc' || componentType === 'customcard') {\n // Expected from Card related PMs\n configData = getCardConfigData(uiElementProps);\n }\n\n const data = {\n component,\n type,\n ...(typeof isStoredPaymentMethod === 'boolean' && { isStoredPaymentMethod }), // if defined and a boolean...\n ...(brand && { brand }),\n ...(typeof isExpress === 'boolean' && { isExpress }),\n ...(isExpress === true && hasExpressPage && { expressPage }), // We only care about the expressPage value if isExpress is true\n ...(configData && { configData }),\n ...(originalConfigData && { configData: originalConfigData })\n };\n\n analyticsModule.createAnalyticsEvent({\n event: ANALYTICS_EVENT_INFO,\n data\n });\n\n break;\n }\n\n case ANALYTICS_CONFIGURED_STR: {\n const { isStoredPaymentMethod, brand } = analyticsObj;\n const data = { component, type, isStoredPaymentMethod, brand };\n\n analyticsModule.createAnalyticsEvent({\n event: ANALYTICS_EVENT_INFO,\n data\n });\n break;\n }\n\n case ANALYTICS_FOCUS_STR:\n case ANALYTICS_UNFOCUS_STR:\n case ANALYTICS_DISPLAYED_STR: // issuerList\n case ANALYTICS_INPUT_STR: // issuerList\n case ANALYTICS_DOWNLOAD_STR: // QR codes\n analyticsModule.createAnalyticsEvent({\n event: ANALYTICS_EVENT_INFO,\n data: { component, type, target }\n });\n break;\n\n // - ApplePay & GooglePay when instant PMs\n // - issuerList buttons\n case ANALYTICS_SELECTED_STR: {\n const { issuer } = analyticsObj;\n analyticsModule.createAnalyticsEvent({\n event: ANALYTICS_EVENT_INFO,\n data: { component, type, target, issuer }\n });\n break;\n }\n\n case ANALYTICS_VALIDATION_ERROR_STR: {\n const { validationErrorCode, validationErrorMessage } = analyticsObj;\n analyticsModule.createAnalyticsEvent({\n event: ANALYTICS_EVENT_INFO,\n data: { component, type, target, validationErrorCode, validationErrorMessage }\n });\n break;\n }\n\n /**\n * LOGS\n */\n case ANALYTICS_SUBMIT_STR:\n analyticsModule.createAnalyticsEvent({\n event: ANALYTICS_EVENT_LOG,\n data: { component, type, message: 'Shopper clicked pay' }\n });\n break;\n\n case ANALYTICS_ACTION_STR: {\n const { subtype, message } = analyticsObj;\n analyticsModule.createAnalyticsEvent({\n event: ANALYTICS_EVENT_LOG,\n data: { component, type, subtype, message }\n });\n break;\n }\n\n // General 3DS2 log events: \"action handled\" (i.e. iframe loaded), data sent, process completed\n case THREEDS2_FULL: {\n const { message, metadata, subtype, result } = analyticsObj;\n\n analyticsModule.createAnalyticsEvent({\n event: ANALYTICS_EVENT_LOG,\n data: { component, type, message, metadata, subtype, result }\n });\n break;\n }\n\n /**\n * ERRORS\n */\n case THREEDS2_ERROR: {\n const { message, code, errorType } = analyticsObj;\n analyticsModule.createAnalyticsEvent({\n event: ANALYTICS_EVENT_ERROR,\n data: { component, type, message, code, errorType }\n });\n break;\n }\n\n default: {\n analyticsModule.createAnalyticsEvent(analyticsObj as CreateAnalyticsEventObject);\n }\n }\n };\n};\n"],"names":["analyticsPreProcessor","analyticsModule","component","analyticsObj","uiElementProps","type","target","AdyenCheckoutError","SDK_ERROR","ANALYTICS_RENDERED_STR","isStoredPaymentMethod","brand","configData","originalConfigData","isExpress","expressPage","hasExpressPage","ANALYTICS_EXPRESS_PAGES_ARRAY","includes","componentType","getCardConfigData","data","_object_spread","createAnalyticsEvent","event","ANALYTICS_EVENT_INFO","ANALYTICS_CONFIGURED_STR","ANALYTICS_FOCUS_STR","ANALYTICS_UNFOCUS_STR","ANALYTICS_DISPLAYED_STR","ANALYTICS_INPUT_STR","ANALYTICS_DOWNLOAD_STR","ANALYTICS_SELECTED_STR","issuer","ANALYTICS_VALIDATION_ERROR_STR","validationErrorCode","validationErrorMessage","ANALYTICS_SUBMIT_STR","ANALYTICS_EVENT_LOG","message","ANALYTICS_ACTION_STR","subtype","THREEDS2_FULL","metadata","result","THREEDS2_ERROR","code","errorType","ANALYTICS_EVENT_ERROR"],"mappings":"kwBAuBO,MAAMA,EAAyBC,GAE3B,CAACC,EAAmBC,EAAmCC,EAAiB,CAAA,KAC3E,MAAMC,KAAEA,EAAIC,OAAEA,GAAWH,EAEzB,IAAKE,EACD,MAAM,IAAIE,EAAmBC,EAAW,8DAG5C,OAAQH,GAOJ,KAAKI,EAAwB,CACzB,MAAMC,sBAAEA,EAAqBC,MAAEA,EAAOC,WAAYC,GAAuBV,GAGnEW,UAAEA,EAASC,YAAEA,GAAgBX,EAE7BY,EAAiBD,GAAeE,EAA8BC,SAASH,IAErEV,KAAMc,GAAkBf,EAChC,IAAIQ,EAAyB,KAEP,WAAlBO,GAAgD,SAAlBA,GAA8C,eAAlBA,IAE1DP,EAAaQ,EAAkBhB,IAGnC,MAAMiB,wUAAOC,CAAA,CACTpB,YACAG,QACqC,kBAA1BK,GAAuC,CAAEA,yBAChDC,GAAS,CAAEA,SACU,kBAAdG,GAA2B,CAAEA,cACtB,IAAdA,GAAsBE,GAAkB,CAAED,eAC1CH,GAAc,CAAEA,cAChBC,GAAsB,CAAED,WAAYC,IAG5CZ,EAAgBsB,qBAAqB,CACjCC,MAAOC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,qBAAqB,CACjCC,MAAOwB,EACP3B,KAAM,CAAEnB,YAAWG,OAAMkC,UAASO,OAAMC,eAE5C,KACJ,CAEA,QACI9C,EAAgBsB,qBAAqBpB,GAE7C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ANALYTICS_VALIDATION_ERROR_STR as e,ANALYTICS_ACTION_STR as o,errorCodeMapping as n,ALLOWED_ANALYTICS_DATA as
|
|
1
|
+
import{ANALYTICS_VALIDATION_ERROR_STR as e,ANALYTICS_ACTION_STR as o,errorCodeMapping as n,ALLOWED_ANALYTICS_DATA as t}from"./constants.js";import r from"../../utils/uuid.js";import{digitsOnlyFormatter as s}from"../../utils/Formatters/formatters.js";import{ERROR_FIELD_REQUIRED as i,ERROR_INVALID_FORMAT_EXPECTS as a}from"../Errors/constants.js";import{THREEDS2_FULL as l,DEFAULT_CHALLENGE_WINDOW_SIZE as d}from"../../components/ThreeDS2/constants.js";import u from"../../components/Card/components/CardInput/defaultProps.js";import{DEFAULT_CARD_GROUP_TYPES as c}from"../../components/internal/SecuredFields/lib/constants.js";import{notFalsy as p}from"../../utils/commonUtils.js";function m(e,o,n){return o in e?Object.defineProperty(e,o,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[o]=n,e}function y(e){for(var o=1;o<arguments.length;o++){var n=null!=arguments[o]?arguments[o]:{},t=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),t.forEach((function(o){m(e,o,n[o])}))}return e}function g(e,o){return o=null!=o?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):function(e){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);o.push.apply(o,n)}return o}(Object(o)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(o,n))})),e}const b=()=>Date.now(),f=n=>y({timestamp:String(b()),component:n.component,id:r()},"error"===n.event&&{code:n.code,errorType:n.errorType,message:n.message},"log"===n.event&&{type:n.type,message:n.message},"log"===n.event&&(n.type===o||n.type===l)&&{subType:n.subtype},"log"===n.event&&n.type===l&&{result:n.result},"info"===n.event&&{type:n.type,target:n.target},"info"===n.event&&n.issuer&&{issuer:n.issuer},"info"===n.event&&{isExpress:n.isExpress,expressPage:n.expressPage},"info"===n.event&&n.isStoredPaymentMethod&&{isStoredPaymentMethod:n.isStoredPaymentMethod,brand:n.brand},"info"===n.event&&n.type===e&&{validationErrorCode:h(n.validationErrorCode,n.target),validationErrorMessage:n.validationErrorMessage},n.configData&&{configData:n.configData},n.metadata&&{metadata:n.metadata}),h=(e,o)=>{var t,r;if(e===i||e===a)return null!==(t=n[`${e}.${o}`])&&void 0!==t?t:e;let l=null!==(r=n[e])&&void 0!==r?r:e;return isNaN(Number(l))&&(l=s(l)),l},O=e=>Object.keys(e).reduce(((o,n)=>(t.includes(n)&&(o[n]=e[n]),o)),{}),v=e=>{var o,n,t,r,s,i,a,l;const{autoFocus:m,billingAddressAllowedCountries:b,billingAddressMode:f,billingAddressRequired:h,billingAddressRequiredFields:O,brands:v=c,brandsConfiguration:S,challengeWindowSize:P=d,configuration:j,countryCode:w,data:C,disclaimerMessage:k,disableIOSArrowKeys:A,doBinLookup:B,enableStoreDetails:E,exposeExpiryDate:D,forceCompat:F,hasHolderName:M,hideCVC:x,holderNameRequired:N,installmentOptions:V,keypadFix:I,legacyInputMode:L,maskSecurityCode:q,minimumExpiryDate:R,name:T,placeholders:K,positionHolderNameOnTop:H,showBrandIcon:z,showInstallmentAmounts:J,showPayButton:W=!1,styles:$,onAllValid:U,onBinLookup:G,onBinValue:Q,onBlur:X,onBrand:Y,onConfigSuccess:Z,onEnterKeyPressed:_,onFieldValid:ee,onFocus:oe,onLoad:ne}=e,te=JSON.stringify(u.data),re=null===(n=e.modules)||void 0===n||null===(o=n.srPanel)||void 0===o?void 0:o.enabled,se=null===(r=e.modules)||void 0===r||null===(t=r.srPanel)||void 0===t?void 0:t.moveFocus,ie=null===(i=e.modules)||void 0===i||null===(s=i.risk)||void 0===s?void 0:s.enabled,ae=e.onAddressLookup?"lookup":f;let le="none";!0===(null==j?void 0:j.koreanAuthenticationRequired)&&(le="kr"===(null==w?void 0:w.toLowerCase())?"atStart":"auto");const de=g(y({autoFocus:m},(null==b?void 0:b.length)>0&&{billingAddressAllowedCountries:b.toString().substring(0,128)}),{billingAddressMode:ae,billingAddressRequired:h,billingAddressRequiredFields:null==O||null===(a=O.toString())||void 0===a?void 0:a.substring(0,128),brands:null==v||null===(l=v.toString())||void 0===l?void 0:l.substring(0,128),challengeWindowSize:P,disableIOSArrowKeys:A,doBinLookup:B,enableStoreDetails:E,exposeExpiryDate:D,forceCompat:F,hasBrandsConfiguration:p(S),hasData:C&&JSON.stringify(e.data)!==te,hasDisclaimerMessage:!!k,hasHolderName:M,hasInstallmentOptions:p(V),hasPlaceholders:p(K),hasStylesConfigured:p($),hideCVC:x,holderNameRequired:N,keypadFix:I,legacyInputMode:L,maskSecurityCode:q,minimumExpiryDate:!!R,name:T,positionHolderNameOnTop:H,riskEnabled:ie,showBrandIcon:z,showInstallmentAmounts:!!J,showKCPType:le,showPayButton:W,socialSecurityNumberMode:null==j?void 0:j.socialSecurityNumberMode,srPanelEnabled:re,srPanelMoveFocus:se,hasOnAllValid:U!==u.onAllValid,hasOnBinLookup:G!==u.onBinLookup,hasOnBinValue:Q!==u.onBinValue,hasOnBlur:X!==u.onBlur,hasOnBrand:Y!==u.onBrand,hasOnConfigSuccess:Z!==u.onConfigSuccess,hasOnEnterKeyPressed:_!==u.onEnterKeyPressed,hasOnFieldValid:ee!==u.onFieldValid,hasOnFocus:oe!==u.onFocus,hasOnLoad:ne!==u.onLoad});if(Object.keys(de).length>32){return Object.entries(de).reduce(((e,[o,n],t)=>(t<32&&(e[o]=n),e)),{})}return de};export{f as createAnalyticsObject,v as getCardConfigData,b as getUTCTimestamp,O as processAnalyticsData};
|
|
2
2
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../../src/core/Analytics/utils.ts"],"sourcesContent":["import { AnalyticsObject, CreateAnalyticsObject, CardConfigData, AnalyticsData } from './types';\nimport { ANALYTICS_ACTION_STR, ANALYTICS_VALIDATION_ERROR_STR, errorCodeMapping, ALLOWED_ANALYTICS_DATA } from './constants';\nimport uuid from '../../utils/uuid';\nimport { digitsOnlyFormatter } from '../../utils/Formatters/formatters';\nimport { ERROR_FIELD_REQUIRED, ERROR_INVALID_FORMAT_EXPECTS } from '../Errors/constants';\nimport { DEFAULT_CHALLENGE_WINDOW_SIZE, THREEDS2_FULL } from '../../components/ThreeDS2/constants';\nimport { CardConfiguration } from '../../components/Card/types';\nimport CardInputDefaultProps from '../../components/Card/components/CardInput/defaultProps';\nimport { DEFAULT_CARD_GROUP_TYPES } from '../../components/internal/SecuredFields/lib/constants';\nimport { notFalsy } from '../../utils/commonUtils';\n\nexport const getUTCTimestamp = () => Date.now();\n\n/**\n * All objects for the /checkoutanalytics endpoint have base props:\n * \"timestamp\" & \"component\"\n *\n * Error objects have, in addition to the base props:\n * \"code\", \"errorType\" & \"message\"\n *\n * Log objects have, in addition to the base props:\n * \"message\" & \"type\" &\n * \"subtype\" (e.g. when an action is handled)\n *\n * Info objects have, in addition to the base props:\n * \"type\" & \"target\" &\n * \"isStoredPaymentMethod\" & \"brand\" (when a storedCard is \"selected\"), or,\n * \"validationErrorCode\" & \"validationErrorMessage\" (when the event is describing a validation error)\n *\n * All objects can also have a \"metadata\" object of key-value pairs\n */\nexport const createAnalyticsObject = (aObj: CreateAnalyticsObject): AnalyticsObject => ({\n timestamp: String(getUTCTimestamp()),\n component: aObj.component,\n id: uuid(),\n /** ERROR */\n ...(aObj.event === 'error' && { code: aObj.code, errorType: aObj.errorType, message: aObj.message }), // error event\n /** LOG */\n ...(aObj.event === 'log' && { type: aObj.type, message: aObj.message }), // log event\n ...(aObj.event === 'log' && (aObj.type === ANALYTICS_ACTION_STR || aObj.type === THREEDS2_FULL) && { subType: aObj.subtype }), // only added if we have a log event of Action type or ThreeDS2\n ...(aObj.event === 'log' && aObj.type === THREEDS2_FULL && { result: aObj.result }), // only added if we have a log event of ThreeDS2 type\n /** INFO */\n ...(aObj.event === 'info' && { type: aObj.type, target: aObj.target }), // info event\n ...(aObj.event === 'info' && aObj.issuer && { issuer: aObj.issuer }), // relates to issuerLists\n ...(aObj.event === 'info' && { isExpress: aObj.isExpress, expressPage: aObj.expressPage }), // relates to Plugins & detecting Express PMs\n ...(aObj.event === 'info' && aObj.isStoredPaymentMethod && { isStoredPaymentMethod: aObj.isStoredPaymentMethod, brand: aObj.brand }), // only added if we have an info event about a storedPM\n ...(aObj.event === 'info' &&\n aObj.type === ANALYTICS_VALIDATION_ERROR_STR && {\n validationErrorCode: mapErrorCodesForAnalytics(aObj.validationErrorCode, aObj.target),\n validationErrorMessage: aObj.validationErrorMessage\n }), // only added if we have an info event describing a validation error\n ...(aObj.configData && { configData: aObj.configData }),\n /** All */\n ...(aObj.metadata && { metadata: aObj.metadata })\n});\n\nconst mapErrorCodesForAnalytics = (errorCode: string, target: string) => {\n // Some of the more generic error codes required combination with target to retrieve a specific code\n if (errorCode === ERROR_FIELD_REQUIRED || errorCode === ERROR_INVALID_FORMAT_EXPECTS) {\n return errorCodeMapping[`${errorCode}.${target}`] ?? errorCode;\n }\n\n let errCode = errorCodeMapping[errorCode] ?? errorCode;\n\n // If errCode isn't now a number - then we just need to remove any non-digits\n // since the correct error code is already contained within the string e.g. securedField related errors\n if (isNaN(Number(errCode))) {\n errCode = digitsOnlyFormatter(errCode);\n }\n\n return errCode;\n};\n\nexport const processAnalyticsData = (analyticsData: AnalyticsData): AnalyticsData => {\n return Object.keys(analyticsData).reduce((acc, prop) => {\n if (ALLOWED_ANALYTICS_DATA.includes(prop)) acc[prop] = analyticsData[prop];\n return acc;\n }, {});\n};\n\nexport const getCardConfigData = (cardProps: CardConfiguration): CardConfigData => {\n // Extract props from cardProps - mostly setting a default value, if prop not found\n const {\n autoFocus,\n billingAddressAllowedCountries,\n billingAddressMode,\n billingAddressRequired,\n billingAddressRequiredFields,\n brands = DEFAULT_CARD_GROUP_TYPES,\n brandsConfiguration,\n challengeWindowSize = DEFAULT_CHALLENGE_WINDOW_SIZE,\n configuration,\n countryCode,\n data,\n disclaimerMessage,\n disableIOSArrowKeys,\n doBinLookup,\n enableStoreDetails,\n exposeExpiryDate,\n forceCompat,\n hasHolderName,\n hideCVC,\n holderNameRequired,\n installmentOptions,\n keypadFix,\n legacyInputMode,\n maskSecurityCode,\n minimumExpiryDate,\n name, // = 'none',\n placeholders,\n positionHolderNameOnTop,\n showBrandIcon,\n showInstallmentAmounts,\n showPayButton = false, // hard coded default\n styles,\n onAllValid,\n onBinLookup,\n onBinValue,\n onBlur,\n onBrand,\n onConfigSuccess,\n onEnterKeyPressed,\n onFieldValid,\n onFocus,\n onLoad\n } = cardProps;\n\n const dataString = JSON.stringify(CardInputDefaultProps.data);\n\n const srPanelEnabled = cardProps.modules?.srPanel?.enabled;\n const srPanelMoveFocus = cardProps.modules?.srPanel?.moveFocus;\n\n const riskEnabled = cardProps.modules?.risk?.enabled;\n\n const billingAddressModeValue = cardProps.onAddressLookup ? 'lookup' : billingAddressMode;\n\n let showKCPType: 'none' | 'auto' | 'atStart' = 'none';\n if (configuration?.koreanAuthenticationRequired === true) {\n showKCPType = countryCode?.toLowerCase() === 'kr' ? 'atStart' : 'auto';\n }\n\n // Probably just for development - in real life we wouldn't expect the number of supported brands to push the endpoint limit on 128 chars\n let brandsStr = JSON.stringify(brands);\n if (brandsStr.length > 128) {\n brandsStr = brandsStr.substring(0, 124) + '...]';\n }\n\n // @ts-ignore commenting out props until endpoint is ready\n const configData: CardConfigData = {\n autoFocus,\n billingAddressAllowedCountries: JSON.stringify(billingAddressAllowedCountries),\n billingAddressMode: billingAddressModeValue,\n billingAddressRequired,\n billingAddressRequiredFields: JSON.stringify(billingAddressRequiredFields),\n brands: brandsStr,\n challengeWindowSize,\n disableIOSArrowKeys,\n doBinLookup,\n enableStoreDetails,\n exposeExpiryDate,\n forceCompat,\n hasBrandsConfiguration: notFalsy(brandsConfiguration),\n hasData: data && JSON.stringify(cardProps.data) !== dataString,\n hasDisclaimerMessage: !!disclaimerMessage,\n hasHolderName,\n hasInstallmentOptions: notFalsy(installmentOptions),\n hasPlaceholders: notFalsy(placeholders), // has merchant defined placeholders\n hasStylesConfigured: notFalsy(styles),\n hideCVC,\n holderNameRequired,\n keypadFix,\n legacyInputMode,\n maskSecurityCode,\n minimumExpiryDate: !!minimumExpiryDate, // Potentially, in the future, we can send the actual string value\n name,\n positionHolderNameOnTop,\n riskEnabled,\n showBrandIcon,\n showInstallmentAmounts: !!showInstallmentAmounts,\n showKCPType,\n showPayButton,\n socialSecurityNumberMode: configuration?.socialSecurityNumberMode,\n srPanelEnabled,\n srPanelMoveFocus,\n /** callbacks */\n // We need to detect if the merchant themselves has defined these, not if we've set them as a default\n hasOnAllValid: onAllValid !== CardInputDefaultProps.onAllValid,\n hasOnBinLookup: onBinLookup !== CardInputDefaultProps.onBinLookup,\n hasOnBinValue: onBinValue !== CardInputDefaultProps.onBinValue,\n hasOnBlur: onBlur !== CardInputDefaultProps.onBlur,\n hasOnBrand: onBrand !== CardInputDefaultProps.onBrand,\n hasOnConfigSuccess: onConfigSuccess !== CardInputDefaultProps.onConfigSuccess,\n hasOnEnterKeyPressed: onEnterKeyPressed !== CardInputDefaultProps.onEnterKeyPressed,\n hasOnFieldValid: onFieldValid !== CardInputDefaultProps.onFieldValid,\n hasOnFocus: onFocus !== CardInputDefaultProps.onFocus,\n hasOnLoad: onLoad !== CardInputDefaultProps.onLoad\n };\n\n // TODO - keep until endpoint can accept more entries in the configData object (current limit: 32);\n if (Object.keys(configData).length > 32) {\n const strippedConfigData = Object.entries(configData).reduce((acc, [key, value], index) => {\n if (index < 32) {\n acc[key] = value;\n }\n return acc;\n }, {});\n\n return strippedConfigData as CardConfigData;\n }\n\n return configData;\n};\n"],"names":["getUTCTimestamp","Date","now","createAnalyticsObject","aObj","_object_spread","timestamp","String","component","id","uuid","event","code","errorType","message","type","ANALYTICS_ACTION_STR","THREEDS2_FULL","subType","subtype","result","target","issuer","isExpress","expressPage","isStoredPaymentMethod","brand","ANALYTICS_VALIDATION_ERROR_STR","validationErrorCode","mapErrorCodesForAnalytics","validationErrorMessage","configData","metadata","errorCode","errorCodeMapping","ERROR_FIELD_REQUIRED","ERROR_INVALID_FORMAT_EXPECTS","errCode","isNaN","Number","digitsOnlyFormatter","processAnalyticsData","analyticsData","Object","keys","reduce","acc","prop","ALLOWED_ANALYTICS_DATA","includes","getCardConfigData","cardProps","autoFocus","billingAddressAllowedCountries","billingAddressMode","billingAddressRequired","billingAddressRequiredFields","brands","DEFAULT_CARD_GROUP_TYPES","brandsConfiguration","challengeWindowSize","DEFAULT_CHALLENGE_WINDOW_SIZE","configuration","countryCode","data","disclaimerMessage","disableIOSArrowKeys","doBinLookup","enableStoreDetails","exposeExpiryDate","forceCompat","hasHolderName","hideCVC","holderNameRequired","installmentOptions","keypadFix","legacyInputMode","maskSecurityCode","minimumExpiryDate","name","placeholders","positionHolderNameOnTop","showBrandIcon","showInstallmentAmounts","showPayButton","styles","onAllValid","onBinLookup","onBinValue","onBlur","onBrand","onConfigSuccess","onEnterKeyPressed","onFieldValid","onFocus","onLoad","dataString","JSON","stringify","CardInputDefaultProps","srPanelEnabled","modules","srPanel","enabled","srPanelMoveFocus","moveFocus","riskEnabled","risk","billingAddressModeValue","onAddressLookup","showKCPType","koreanAuthenticationRequired","toLowerCase","brandsStr","length","substring","hasBrandsConfiguration","notFalsy","hasData","hasDisclaimerMessage","hasInstallmentOptions","hasPlaceholders","hasStylesConfigured","socialSecurityNumberMode","hasOnAllValid","hasOnBinLookup","hasOnBinValue","hasOnBlur","hasOnBrand","hasOnConfigSuccess","hasOnEnterKeyPressed","hasOnFieldValid","hasOnFocus","h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AiBM,EAAsBN,aACxDuC,WAAYtC,IAAYK,EAAsBL,QAC9CuC,UAAWtC,IAAWI,EAAsBJ,QAIhD,GAAIpD,OAAOC,KAAKb,IAAYmF,OAAS,GAAI,CAQrC,OAP2BvE,OAAO2F,QAAQvG,IAAYc,QAAO,CAACC,GAAMyF,EAAKC,GAAQC,KACzEA,EAAQ,KACR3F,EAAIyF,GAAOC,GAER1F,IACR,CAAC,EAGR,CAEA,OAAOf,EAAAA"}
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../src/core/Analytics/utils.ts"],"sourcesContent":["import { AnalyticsObject, CreateAnalyticsObject, CardConfigData, AnalyticsData } from './types';\nimport { ANALYTICS_ACTION_STR, ANALYTICS_VALIDATION_ERROR_STR, errorCodeMapping, ALLOWED_ANALYTICS_DATA } from './constants';\nimport uuid from '../../utils/uuid';\nimport { digitsOnlyFormatter } from '../../utils/Formatters/formatters';\nimport { ERROR_FIELD_REQUIRED, ERROR_INVALID_FORMAT_EXPECTS } from '../Errors/constants';\nimport { DEFAULT_CHALLENGE_WINDOW_SIZE, THREEDS2_FULL } from '../../components/ThreeDS2/constants';\nimport { CardConfiguration } from '../../components/Card/types';\nimport CardInputDefaultProps from '../../components/Card/components/CardInput/defaultProps';\nimport { DEFAULT_CARD_GROUP_TYPES } from '../../components/internal/SecuredFields/lib/constants';\nimport { notFalsy } from '../../utils/commonUtils';\n\nconst MAX_LENGTH = 128;\nexport const getUTCTimestamp = () => Date.now();\n\n/**\n * All objects for the /checkoutanalytics endpoint have base props:\n * \"timestamp\" & \"component\"\n *\n * Error objects have, in addition to the base props:\n * \"code\", \"errorType\" & \"message\"\n *\n * Log objects have, in addition to the base props:\n * \"message\" & \"type\" &\n * \"subtype\" (e.g. when an action is handled)\n *\n * Info objects have, in addition to the base props:\n * \"type\" & \"target\" &\n * \"isStoredPaymentMethod\" & \"brand\" (when a storedCard is \"selected\"), or,\n * \"validationErrorCode\" & \"validationErrorMessage\" (when the event is describing a validation error)\n *\n * All objects can also have a \"metadata\" object of key-value pairs\n */\nexport const createAnalyticsObject = (aObj: CreateAnalyticsObject): AnalyticsObject => ({\n timestamp: String(getUTCTimestamp()),\n component: aObj.component,\n id: uuid(),\n /** ERROR */\n ...(aObj.event === 'error' && { code: aObj.code, errorType: aObj.errorType, message: aObj.message }), // error event\n /** LOG */\n ...(aObj.event === 'log' && { type: aObj.type, message: aObj.message }), // log event\n ...(aObj.event === 'log' && (aObj.type === ANALYTICS_ACTION_STR || aObj.type === THREEDS2_FULL) && { subType: aObj.subtype }), // only added if we have a log event of Action type or ThreeDS2\n ...(aObj.event === 'log' && aObj.type === THREEDS2_FULL && { result: aObj.result }), // only added if we have a log event of ThreeDS2 type\n /** INFO */\n ...(aObj.event === 'info' && { type: aObj.type, target: aObj.target }), // info event\n ...(aObj.event === 'info' && aObj.issuer && { issuer: aObj.issuer }), // relates to issuerLists\n ...(aObj.event === 'info' && { isExpress: aObj.isExpress, expressPage: aObj.expressPage }), // relates to Plugins & detecting Express PMs\n ...(aObj.event === 'info' && aObj.isStoredPaymentMethod && { isStoredPaymentMethod: aObj.isStoredPaymentMethod, brand: aObj.brand }), // only added if we have an info event about a storedPM\n ...(aObj.event === 'info' &&\n aObj.type === ANALYTICS_VALIDATION_ERROR_STR && {\n validationErrorCode: mapErrorCodesForAnalytics(aObj.validationErrorCode, aObj.target),\n validationErrorMessage: aObj.validationErrorMessage\n }), // only added if we have an info event describing a validation error\n ...(aObj.configData && { configData: aObj.configData }),\n /** All */\n ...(aObj.metadata && { metadata: aObj.metadata })\n});\n\nconst mapErrorCodesForAnalytics = (errorCode: string, target: string) => {\n // Some of the more generic error codes required combination with target to retrieve a specific code\n if (errorCode === ERROR_FIELD_REQUIRED || errorCode === ERROR_INVALID_FORMAT_EXPECTS) {\n return errorCodeMapping[`${errorCode}.${target}`] ?? errorCode;\n }\n\n let errCode = errorCodeMapping[errorCode] ?? errorCode;\n\n // If errCode isn't now a number - then we just need to remove any non-digits\n // since the correct error code is already contained within the string e.g. securedField related errors\n if (isNaN(Number(errCode))) {\n errCode = digitsOnlyFormatter(errCode);\n }\n\n return errCode;\n};\n\nexport const processAnalyticsData = (analyticsData: AnalyticsData): AnalyticsData => {\n return Object.keys(analyticsData).reduce((acc, prop) => {\n if (ALLOWED_ANALYTICS_DATA.includes(prop)) acc[prop] = analyticsData[prop];\n return acc;\n }, {});\n};\n\nexport const getCardConfigData = (cardProps: CardConfiguration): CardConfigData => {\n // Extract props from cardProps - mostly setting a default value, if prop not found\n const {\n autoFocus,\n billingAddressAllowedCountries,\n billingAddressMode,\n billingAddressRequired,\n billingAddressRequiredFields,\n brands = DEFAULT_CARD_GROUP_TYPES,\n brandsConfiguration,\n challengeWindowSize = DEFAULT_CHALLENGE_WINDOW_SIZE,\n configuration,\n countryCode,\n data,\n disclaimerMessage,\n disableIOSArrowKeys,\n doBinLookup,\n enableStoreDetails,\n exposeExpiryDate,\n forceCompat,\n hasHolderName,\n hideCVC,\n holderNameRequired,\n installmentOptions,\n keypadFix,\n legacyInputMode,\n maskSecurityCode,\n minimumExpiryDate,\n name, // = 'none',\n placeholders,\n positionHolderNameOnTop,\n showBrandIcon,\n showInstallmentAmounts,\n showPayButton = false, // hard coded default\n styles,\n onAllValid,\n onBinLookup,\n onBinValue,\n onBlur,\n onBrand,\n onConfigSuccess,\n onEnterKeyPressed,\n onFieldValid,\n onFocus,\n onLoad\n } = cardProps;\n\n const dataString = JSON.stringify(CardInputDefaultProps.data);\n\n const srPanelEnabled = cardProps.modules?.srPanel?.enabled;\n const srPanelMoveFocus = cardProps.modules?.srPanel?.moveFocus;\n\n const riskEnabled = cardProps.modules?.risk?.enabled;\n\n const billingAddressModeValue = cardProps.onAddressLookup ? 'lookup' : billingAddressMode;\n\n let showKCPType: 'none' | 'auto' | 'atStart' = 'none';\n if (configuration?.koreanAuthenticationRequired === true) {\n showKCPType = countryCode?.toLowerCase() === 'kr' ? 'atStart' : 'auto';\n }\n\n // @ts-ignore commenting out props until endpoint is ready\n const configData: CardConfigData = {\n autoFocus,\n ...(billingAddressAllowedCountries?.length > 0 && {\n billingAddressAllowedCountries: billingAddressAllowedCountries.toString().substring(0, MAX_LENGTH)\n }),\n billingAddressMode: billingAddressModeValue,\n billingAddressRequired,\n billingAddressRequiredFields: billingAddressRequiredFields?.toString()?.substring(0, MAX_LENGTH),\n // Probably just for development - in real life we wouldn't expect the number of supported brands to push the endpoint limit on 128 chars\n brands: brands?.toString()?.substring(0, MAX_LENGTH),\n challengeWindowSize,\n disableIOSArrowKeys,\n doBinLookup,\n enableStoreDetails,\n exposeExpiryDate,\n forceCompat,\n hasBrandsConfiguration: notFalsy(brandsConfiguration),\n hasData: data && JSON.stringify(cardProps.data) !== dataString,\n hasDisclaimerMessage: !!disclaimerMessage,\n hasHolderName,\n hasInstallmentOptions: notFalsy(installmentOptions),\n hasPlaceholders: notFalsy(placeholders), // has merchant defined placeholders\n hasStylesConfigured: notFalsy(styles),\n hideCVC,\n holderNameRequired,\n keypadFix,\n legacyInputMode,\n maskSecurityCode,\n minimumExpiryDate: !!minimumExpiryDate, // Potentially, in the future, we can send the actual string value\n name,\n positionHolderNameOnTop,\n riskEnabled,\n showBrandIcon,\n showInstallmentAmounts: !!showInstallmentAmounts,\n showKCPType,\n showPayButton,\n socialSecurityNumberMode: configuration?.socialSecurityNumberMode,\n srPanelEnabled,\n srPanelMoveFocus,\n /** callbacks */\n // We need to detect if the merchant themselves has defined these, not if we've set them as a default\n hasOnAllValid: onAllValid !== CardInputDefaultProps.onAllValid,\n hasOnBinLookup: onBinLookup !== CardInputDefaultProps.onBinLookup,\n hasOnBinValue: onBinValue !== CardInputDefaultProps.onBinValue,\n hasOnBlur: onBlur !== CardInputDefaultProps.onBlur,\n hasOnBrand: onBrand !== CardInputDefaultProps.onBrand,\n hasOnConfigSuccess: onConfigSuccess !== CardInputDefaultProps.onConfigSuccess,\n hasOnEnterKeyPressed: onEnterKeyPressed !== CardInputDefaultProps.onEnterKeyPressed,\n hasOnFieldValid: onFieldValid !== CardInputDefaultProps.onFieldValid,\n hasOnFocus: onFocus !== CardInputDefaultProps.onFocus,\n hasOnLoad: onLoad !== CardInputDefaultProps.onLoad\n };\n\n // TODO - keep until endpoint can accept more entries in the configData object (current limit: 32);\n if (Object.keys(configData).length > 32) {\n const strippedConfigData = Object.entries(configData).reduce((acc, [key, value], index) => {\n if (index < 32) {\n acc[key] = value;\n }\n return acc;\n }, {});\n\n return strippedConfigData as CardConfigData;\n }\n\n return configData;\n};\n"],"names":["getUTCTimestamp","Date","now","createAnalyticsObject","aObj","_object_spread","timestamp","String","component","id","uuid","event","code","errorType","message","type","ANALYTICS_ACTION_STR","THREEDS2_FULL","subType","subtype","result","target","issuer","isExpress","expressPage","isStoredPaymentMethod","brand","ANALYTICS_VALIDATION_ERROR_STR","validationErrorCode","mapErrorCodesForAnalytics","validationErrorMessage","configData","metadata","errorCode","errorCodeMapping","ERROR_FIELD_REQUIRED","ERROR_INVALID_FORMAT_EXPECTS","errCode","isNaN","Number","digitsOnlyFormatter","processAnalyticsData","analyticsData","Object","keys","reduce","acc","prop","ALLOWED_ANALYTICS_DATA","includes","getCardConfigData","cardProps","billingAddressRequiredFields","brands","autoFocus","billingAddressAllowedCountries","billingAddressMode","billingAddressRequired","DEFAULT_CARD_GROUP_TYPES","brandsConfiguration","challengeWindowSize","DEFAULT_CHALLENGE_WINDOW_SIZE","configuration","countryCode","data","disclaimerMessage","disableIOSArrowKeys","doBinLookup","enableStoreDetails","exposeExpiryDate","forceCompat","hasHolderName","hideCVC","holderNameRequired","installmentOptions","keypadFix","legacyInputMode","maskSecurityCode","minimumExpiryDate","name","placeholders","positionHolderNameOnTop","showBrandIcon","showInstallmentAmounts","showPayButton","styles","onAllValid","onBinLookup","onBinValue","onBlur","onBrand","onConfigSuccess","onEnterKeyPressed","onFieldValid","onFocus","onLoad","dataString","JSON","stringify","CardInputDefaultProps","srPanelEnabled","modules","srPanel","enabled","srPanelMoveFocus","moveFocus","riskEnabled","risk","billingAddressModeValue","onAddressLookup","showKCPType","koreanAuthenticationRequired","toLowerCase","_object_spread_props","length","toString","substring","hasBrandsConfiguration","notFalsy","hasData","hasDisclaimerMessage","hasInstallmentOptions","hasPlaceholders","hasStylesConfigured","socialSecurityNumberMode","hasOnAllValid","hasOnBinLookup","hasOnBinValue","hasOnBlur","hasOnBrand","hasOnConfigSuccess","hasOnEnterKeyPressed","hasOnFieldValid","hasOnFocus","hasOnLoad","entries","key","value","index"],"mappings":"u9CAWA,MACaA,EAAkB,IAAMC,KAAKC,MAoB7BC,EAAyBC,GAAkDC,EAAA,CACpFC,UAAWC,OAAOP,KAClBQ,UAAWJ,EAAKI,UAChBC,GAAIC,KAEe,UAAfN,EAAKO,OAAqB,CAAEC,KAAMR,EAAKQ,KAAMC,UAAWT,EAAKS,UAAWC,QAASV,EAAKU,SAEvE,QAAfV,EAAKO,OAAmB,CAAEI,KAAMX,EAAKW,KAAMD,QAASV,EAAKU,SAC1C,QAAfV,EAAKO,QAAoBP,EAAKW,OAASC,GAAwBZ,EAAKW,OAASE,IAAkB,CAAEC,QAASd,EAAKe,SAChG,QAAff,EAAKO,OAAmBP,EAAKW,OAASE,GAAiB,CAAEG,OAAQhB,EAAKgB,QAEvD,SAAfhB,EAAKO,OAAoB,CAAEI,KAAMX,EAAKW,KAAMM,OAAQjB,EAAKiB,QAC1C,SAAfjB,EAAKO,OAAoBP,EAAKkB,QAAU,CAAEA,OAAQlB,EAAKkB,QACxC,SAAflB,EAAKO,OAAoB,CAAEY,UAAWnB,EAAKmB,UAAWC,YAAapB,EAAKoB,aACzD,SAAfpB,EAAKO,OAAoBP,EAAKqB,uBAAyB,CAAEA,sBAAuBrB,EAAKqB,sBAAuBC,MAAOtB,EAAKsB,OACzG,SAAftB,EAAKO,OACLP,EAAKW,OAASY,GAAkC,CAC5CC,oBAAqBC,EAA0BzB,EAAKwB,oBAAqBxB,EAAKiB,QAC9ES,uBAAwB1B,EAAK0B,wBAEjC1B,EAAK2B,YAAc,CAAEA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ACAC,qBACAE,YACAC,kBACAC,mBACAC,oBAAqBA,EACrBC,OACAE,0BACAyB,eACAxB,gBACAC,yBAA0BA,EAC1B2B,eACA1B,gBACAwC,yBAA0B9D,aAAAA,EAAAA,EAAe8D,yBACzCxB,kBACAI,oBAGAqB,cAAevC,IAAea,EAAsBb,WACpDwC,eAAgBvC,IAAgBY,EAAsBZ,YACtDwC,cAAevC,IAAeW,EAAsBX,WACpDwC,UAAWvC,IAAWU,EAAsBV,OAC5CwC,WAAYvC,IAAYS,EAAsBT,QAC9CwC,mBAAoBvC,IAAoBQ,EAAsBR,gBAC9DwC,qBAAsBvC,IAAsBO,EAAsBP,kBAClEwC,gBAAiBvC,KAAiBM,EAAsBN,aACxDwC,WAAYvC,KAAYK,EAAsBL,QAC9CwC,UAAWvC,KAAWI,EAAsBJ,SAIhD,GAAIpD,OAAOC,KAAKb,IAAYmF,OAAS,GAAI,CAQrC,OAP2BvE,OAAO4F,QAAQxG,IAAYc,QAAO,CAACC,GAAM0F,EAAKC,GAAQC,KACzEA,EAAQ,KACR5F,EAAI0F,GAAOC,GAER3F,IACR,CAAC,EAGR,CAEA,OAAOf,EAAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{httpPost as e}from"../http.js";import t from"../../../utils/Storage.js";function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const r='WARNING: Failed to retrieve "checkoutAttemptId". Consequently, analytics will not be available for this payment. The payment process, however, will not be affected.';const o=({analyticsContext:o,clientKey:i,locale:c,analyticsPath:l,bundleType:a})=>{let s;const u={errorLevel:"fatal",loadingContext:o,path:`${l}?clientKey=${i}`};return o=>{const l=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){n(e,t,r[t])}))}return e}({version:"6.
|
|
1
|
+
import{httpPost as e}from"../http.js";import t from"../../../utils/Storage.js";function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const r='WARNING: Failed to retrieve "checkoutAttemptId". Consequently, analytics will not be available for this payment. The payment process, however, will not be affected.';const o=({analyticsContext:o,clientKey:i,locale:c,analyticsPath:l,bundleType:a})=>{let s;const u={errorLevel:"fatal",loadingContext:o,path:`${l}?clientKey=${i}`};return o=>{const l=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){n(e,t,r[t])}))}return e}({version:"6.1.1",channel:"Web",platform:"Web",buildType:a,locale:c,referrer:window.location.href,screenWidth:window.screen.width},o);if(s)return s;if(!i)return Promise.reject("no-client-key");const f=new t("checkout-attempt-id","sessionStorage"),p=f.get();return function(e){if(!(null==e?void 0:e.id))return!1;const t=Date.now()-9e5;return e.timestamp>t}(p)?Promise.resolve(p.id):(s=e(u,l).then((e=>{if(null==e?void 0:e.checkoutAttemptId)return f.set({id:e.checkoutAttemptId,timestamp:Date.now()}),e.checkoutAttemptId})).catch((()=>Promise.reject(r))),s)}};export{r as FAILURE_MSG,o as default};
|
|
2
2
|
//# sourceMappingURL=collect-id.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Language as t}from"../language/Language.js";import o from"./RiskModule/RiskModule.js";import e from"./ProcessResponse/PaymentMethods/PaymentMethods.js";import{getComponentForAction as s}from"./ProcessResponse/PaymentAction/PaymentAction.js";import n from"./Analytics/Analytics.js";import{processGlobalOptions as i,assertConfigurationPropertiesAreValid as r}from"./utils.js";import a from"./CheckoutSession/CheckoutSession.js";import{hasOwnProperty as l}from"../utils/hasOwnProperty.js";import{Resources as c}from"./Context/Resources.js";import{SRPanel as h}from"./Errors/SRPanel.js";import p from"./core.registry.js";import{sanitizeResponse as d,verifyPaymentDidNotFail as m,cleanupFinalResult as u}from"../components/internal/UIElement/utils.js";import y,{IMPLEMENTATION_ERROR as f}from"./Errors/AdyenCheckoutError.js";import{ANALYTICS_ACTION_STR as g}from"./Analytics/constants.js";import{THREEDS2_FULL as v}from"../components/ThreeDS2/constants.js";import{DEFAULT_LOCALE as b}from"../language/constants.js";import C from"./Services/get-translations.js";import{defaultProps as j}from"./core.defaultProps.js";import{formatLocale as w,formatCustomTranslations as O}from"../language/utils.js";import{resolveEnvironments as P}from"./Environment/Environment.js";function E(t,o,e){return o in t?Object.defineProperty(t,o,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[o]=e,t}function A(t){for(var o=1;o<arguments.length;o++){var e=null!=arguments[o]?arguments[o]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})))),s.forEach((function(o){E(t,o,e[o])}))}return t}function M(t,o){return o=null!=o?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):function(t){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);o.push.apply(o,e)}return o}(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))})),t}function x(t,o){if(null==t)return{};var e,s,n=function(t,o){if(null==t)return{};var e,s,n={},i=Object.keys(t);for(s=0;s<i.length;s++)e=i[s],o.indexOf(e)>=0||(n[e]=t[e]);return n}(t,o);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)e=i[s],o.indexOf(e)>=0||Object.prototype.propertyIsEnumerable.call(t,e)&&(n[e]=t[e])}return n}class T{static setBundleType(t){T.metadata.bundleType=t}static register(...t){p.add(...t)}register(...t){p.add(...t)}getComponent(t){return p.getComponent(t)}async initialize(){return await this.initializeCore(),this.validateCoreConfiguration(),await this.createCoreModules(),this}async initializeCore(){return this.session?this.session.setupSession(this.options).then((t=>{const{amount:o,shopperLocale:e,countryCode:s,paymentMethods:n}=t,i=x(t,["amount","shopperLocale","countryCode","paymentMethods"]);return this.setOptions(M(A({},i),{amount:this.options.order?this.options.order.remainingAmount:o,locale:this.options.locale||e,countryCode:this.options.countryCode||s})),this.createPaymentMethodsList(n),this})).catch((t=>(this.options.onError&&this.options.onError(t),Promise.reject(t)))):(this.createPaymentMethodsList(),Promise.resolve(this))}async fetchLocaleTranslations(){try{return await C(this.cdnTranslationsUrl,T.metadata.version,this.options.locale)}catch(n){var t,o,e,s;n instanceof y?null===(t=(o=this.options).onError)||void 0===t||t.call(o,n):null===(e=(s=this.options).onError)||void 0===e||e.call(s,new y("ERROR","Failed to fetch translation",{cause:n}))}}validateCoreConfiguration(){if(this.options.paymentMethodsConfiguration&&console.warn('WARNING: "paymentMethodsConfiguration" is supported only by Drop-in.'),!this.options.countryCode)throw new y(f,"You must specify a countryCode when initializing checkout.");this.options.locale||this.setOptions({locale:b}),this.options.locale=w(this.options.locale),this.options.translations=O(this.options.translations)}submitDetails(t){let o=null;var e,s;(this.options.onAdditionalDetails&&(o=new Promise(((o,e)=>{this.options.onAdditionalDetails({data:t},void 0,{resolve:o,reject:e})}))),this.session&&(o=this.session.submitDetails(t).catch((t=>{var o,e;return null===(o=(e=this.options).onError)||void 0===o||o.call(e,t),Promise.reject(t)}))),o)?o.then(d).then(m).then((t=>{var o,e;u(t),null===(o=(e=this.options).onPaymentCompleted)||void 0===o||o.call(e,t)})).catch((t=>{var o,e;u(t),null===(o=(e=this.options).onPaymentFailed)||void 0===o||o.call(e,t)})):null===(e=(s=this.options).onError)||void 0===e||e.call(s,new y("IMPLEMENTATION_ERROR",'It can not submit the details. The callback "onAdditionalDetails" or the Session is not setup correctly.'))}createFromAction(t,o={}){if(!t||!t.type){if(l(t,"action")&&l(t,"resultCode"))throw new Error('createFromAction::Invalid Action - the passed action object itself has an "action" property and a "resultCode": have you passed in the whole response object by mistake?');throw new Error('createFromAction::Invalid Action - the passed action object does not have a "type" property')}if(t.type){const e=t.type===v?`${t.type}${t.subtype}`:t.paymentMethodType;this.modules.analytics.sendAnalytics(e,{type:g,subtype:t.type,message:`${e} action was handled by the SDK`});const n=A({},this.getCorePropsForComponent(),o);return s(this,p,t,n)}return this.handleCreateError()}getCorePropsForComponent(){return M(A({},i(this.options)),{core:this,i18n:this.modules.i18n,modules:this.modules,session:this.session,loadingContext:this.loadingContext,cdnContext:this.cdnImagesUrl,createFromAction:this.createFromAction})}storeElementReference(t){t&&this.components.push(t)}handleCreateError(t){var o;const e=null!==(o=null==t?void 0:t.name)&&void 0!==o?o:"The passed payment method",s=t?`${e} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(t)}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`:"No Payment Method component was passed";throw new Error(s)}createPaymentMethodsList(t){this.paymentMethodsResponse=new e(this.options.paymentMethodsResponse||t,this.options)}async createCoreModules(){if(this.modules)return;const e=await this.fetchLocaleTranslations();this.modules=Object.freeze({risk:new o(this,M(A({},this.options),{loadingContext:this.loadingContext})),analytics:n({loadingContext:this.loadingContext,analyticsContext:this.analyticsContext,clientKey:this.options.clientKey,locale:this.options.locale,analytics:this.options.analytics,amount:this.options.amount,bundleType:T.metadata.bundleType}),resources:new c(this.cdnImagesUrl),i18n:new t({locale:this.options.locale,translations:e,customTranslations:this.options.translations}),srPanel:new h(this,A({},this.options.srConfig))})}constructor(t){var o;E(this,"session",void 0),E(this,"paymentMethodsResponse",void 0),E(this,"modules",void 0),E(this,"options",void 0),E(this,"analyticsContext",void 0),E(this,"loadingContext",void 0),E(this,"cdnImagesUrl",void 0),E(this,"cdnTranslationsUrl",void 0),E(this,"components",[]),E(this,"update",((t={})=>(this.setOptions(t),this.initialize().then((()=>(this.components.forEach((o=>{const e=A({},t,this.session&&{session:this.session});o.update(e)})),this)))))),E(this,"remove",(t=>(this.components=this.components.filter((o=>o._id!==t._id)),t.unmount(),this))),E(this,"setOptions",(t=>{var o;this.options=M(A({},this.options,t),{locale:(null==t?void 0:t.locale)||(null===(o=this.options)||void 0===o?void 0:o.locale)})})),r(t),this.createFromAction=this.createFromAction.bind(this),this.setOptions(A({},j,t));const{apiUrl:e,analyticsUrl:s,cdnImagesUrl:n,cdnTranslationsUrl:i}=P(this.options.environment,this.options._environmentUrls);this.loadingContext=e,this.analyticsContext=s,this.cdnImagesUrl=n,this.cdnTranslationsUrl=i,this.session=this.options.session&&new a(this.options.session,this.options.clientKey,this.loadingContext);const l=null===(o=this.options.clientKey)||void 0===o?void 0:o.substring(0,4);var c,h;if(("test"===l||"live"===l)&&!this.loadingContext.includes(l))throw new y("IMPLEMENTATION_ERROR",`Error: you are using a ${l} clientKey against the ${(null===(c=this.options._environmentUrls)||void 0===c?void 0:c.api)||this.options.environment} environment`);"pub."===l&&console.debug(`The value you are passing as your "clientKey" looks like an originKey (${null===(h=this.options.clientKey)||void 0===h?void 0:h.substring(0,12)}..). Although this is supported it is not the recommended way to integrate. To generate a clientKey, see the documentation (https://docs.adyen.com/development-resources/client-side-authentication/migrate-from-origin-key-to-client-key/) for more details.`);this.options.exposeLibraryMetadata&&(window.AdyenWebMetadata=T.metadata)}}E(T,"metadata",{version:"6.
|
|
1
|
+
import{Language as t}from"../language/Language.js";import o from"./RiskModule/RiskModule.js";import e from"./ProcessResponse/PaymentMethods/PaymentMethods.js";import{getComponentForAction as s}from"./ProcessResponse/PaymentAction/PaymentAction.js";import n from"./Analytics/Analytics.js";import{processGlobalOptions as i,assertConfigurationPropertiesAreValid as r}from"./utils.js";import a from"./CheckoutSession/CheckoutSession.js";import{hasOwnProperty as l}from"../utils/hasOwnProperty.js";import{Resources as c}from"./Context/Resources.js";import{SRPanel as h}from"./Errors/SRPanel.js";import p from"./core.registry.js";import{sanitizeResponse as d,verifyPaymentDidNotFail as m,cleanupFinalResult as u}from"../components/internal/UIElement/utils.js";import y,{IMPLEMENTATION_ERROR as f}from"./Errors/AdyenCheckoutError.js";import{ANALYTICS_ACTION_STR as g}from"./Analytics/constants.js";import{THREEDS2_FULL as v}from"../components/ThreeDS2/constants.js";import{DEFAULT_LOCALE as b}from"../language/constants.js";import C from"./Services/get-translations.js";import{defaultProps as j}from"./core.defaultProps.js";import{formatLocale as w,formatCustomTranslations as O}from"../language/utils.js";import{resolveEnvironments as P}from"./Environment/Environment.js";function E(t,o,e){return o in t?Object.defineProperty(t,o,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[o]=e,t}function A(t){for(var o=1;o<arguments.length;o++){var e=null!=arguments[o]?arguments[o]:{},s=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(e).filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})))),s.forEach((function(o){E(t,o,e[o])}))}return t}function M(t,o){return o=null!=o?o:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):function(t){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);o.push.apply(o,e)}return o}(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))})),t}function x(t,o){if(null==t)return{};var e,s,n=function(t,o){if(null==t)return{};var e,s,n={},i=Object.keys(t);for(s=0;s<i.length;s++)e=i[s],o.indexOf(e)>=0||(n[e]=t[e]);return n}(t,o);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)e=i[s],o.indexOf(e)>=0||Object.prototype.propertyIsEnumerable.call(t,e)&&(n[e]=t[e])}return n}class T{static setBundleType(t){T.metadata.bundleType=t}static register(...t){p.add(...t)}register(...t){p.add(...t)}getComponent(t){return p.getComponent(t)}async initialize(){return await this.initializeCore(),this.validateCoreConfiguration(),await this.createCoreModules(),this}async initializeCore(){return this.session?this.session.setupSession(this.options).then((t=>{const{amount:o,shopperLocale:e,countryCode:s,paymentMethods:n}=t,i=x(t,["amount","shopperLocale","countryCode","paymentMethods"]);return this.setOptions(M(A({},i),{amount:this.options.order?this.options.order.remainingAmount:o,locale:this.options.locale||e,countryCode:this.options.countryCode||s})),this.createPaymentMethodsList(n),this})).catch((t=>(this.options.onError&&this.options.onError(t),Promise.reject(t)))):(this.createPaymentMethodsList(),Promise.resolve(this))}async fetchLocaleTranslations(){try{return await C(this.cdnTranslationsUrl,T.metadata.version,this.options.locale)}catch(n){var t,o,e,s;n instanceof y?null===(t=(o=this.options).onError)||void 0===t||t.call(o,n):null===(e=(s=this.options).onError)||void 0===e||e.call(s,new y("ERROR","Failed to fetch translation",{cause:n}))}}validateCoreConfiguration(){if(this.options.paymentMethodsConfiguration&&console.warn('WARNING: "paymentMethodsConfiguration" is supported only by Drop-in.'),!this.options.countryCode)throw new y(f,"You must specify a countryCode when initializing checkout.");this.options.locale||this.setOptions({locale:b}),this.options.locale=w(this.options.locale),this.options.translations=O(this.options.translations)}submitDetails(t){let o=null;var e,s;(this.options.onAdditionalDetails&&(o=new Promise(((o,e)=>{this.options.onAdditionalDetails({data:t},void 0,{resolve:o,reject:e})}))),this.session&&(o=this.session.submitDetails(t).catch((t=>{var o,e;return null===(o=(e=this.options).onError)||void 0===o||o.call(e,t),Promise.reject(t)}))),o)?o.then(d).then(m).then((t=>{var o,e;u(t),null===(o=(e=this.options).onPaymentCompleted)||void 0===o||o.call(e,t)})).catch((t=>{var o,e;u(t),null===(o=(e=this.options).onPaymentFailed)||void 0===o||o.call(e,t)})):null===(e=(s=this.options).onError)||void 0===e||e.call(s,new y("IMPLEMENTATION_ERROR",'It can not submit the details. The callback "onAdditionalDetails" or the Session is not setup correctly.'))}createFromAction(t,o={}){if(!t||!t.type){if(l(t,"action")&&l(t,"resultCode"))throw new Error('createFromAction::Invalid Action - the passed action object itself has an "action" property and a "resultCode": have you passed in the whole response object by mistake?');throw new Error('createFromAction::Invalid Action - the passed action object does not have a "type" property')}if(t.type){const e=t.type===v?`${t.type}${t.subtype}`:t.paymentMethodType;this.modules.analytics.sendAnalytics(e,{type:g,subtype:t.type,message:`${e} action was handled by the SDK`});const n=A({},this.getCorePropsForComponent(),o);return s(this,p,t,n)}return this.handleCreateError()}getCorePropsForComponent(){return M(A({},i(this.options)),{core:this,i18n:this.modules.i18n,modules:this.modules,session:this.session,loadingContext:this.loadingContext,cdnContext:this.cdnImagesUrl,createFromAction:this.createFromAction})}storeElementReference(t){t&&this.components.push(t)}handleCreateError(t){var o;const e=null!==(o=null==t?void 0:t.name)&&void 0!==o?o:"The passed payment method",s=t?`${e} is not a valid Checkout Component. What was passed as a txVariant was: ${JSON.stringify(t)}. Check if this payment method is configured in the Backoffice or if the txVariant is a valid one`:"No Payment Method component was passed";throw new Error(s)}createPaymentMethodsList(t){this.paymentMethodsResponse=new e(this.options.paymentMethodsResponse||t,this.options)}async createCoreModules(){if(this.modules)return;const e=await this.fetchLocaleTranslations();this.modules=Object.freeze({risk:new o(this,M(A({},this.options),{loadingContext:this.loadingContext})),analytics:n({loadingContext:this.loadingContext,analyticsContext:this.analyticsContext,clientKey:this.options.clientKey,locale:this.options.locale,analytics:this.options.analytics,amount:this.options.amount,bundleType:T.metadata.bundleType}),resources:new c(this.cdnImagesUrl),i18n:new t({locale:this.options.locale,translations:e,customTranslations:this.options.translations}),srPanel:new h(this,A({},this.options.srConfig))})}constructor(t){var o;E(this,"session",void 0),E(this,"paymentMethodsResponse",void 0),E(this,"modules",void 0),E(this,"options",void 0),E(this,"analyticsContext",void 0),E(this,"loadingContext",void 0),E(this,"cdnImagesUrl",void 0),E(this,"cdnTranslationsUrl",void 0),E(this,"components",[]),E(this,"update",((t={})=>(this.setOptions(t),this.initialize().then((()=>(this.components.forEach((o=>{const e=A({},t,this.session&&{session:this.session});o.update(e)})),this)))))),E(this,"remove",(t=>(this.components=this.components.filter((o=>o._id!==t._id)),t.unmount(),this))),E(this,"setOptions",(t=>{var o;this.options=M(A({},this.options,t),{locale:(null==t?void 0:t.locale)||(null===(o=this.options)||void 0===o?void 0:o.locale)})})),r(t),this.createFromAction=this.createFromAction.bind(this),this.setOptions(A({},j,t));const{apiUrl:e,analyticsUrl:s,cdnImagesUrl:n,cdnTranslationsUrl:i}=P(this.options.environment,this.options._environmentUrls);this.loadingContext=e,this.analyticsContext=s,this.cdnImagesUrl=n,this.cdnTranslationsUrl=i,this.session=this.options.session&&new a(this.options.session,this.options.clientKey,this.loadingContext);const l=null===(o=this.options.clientKey)||void 0===o?void 0:o.substring(0,4);var c,h;if(("test"===l||"live"===l)&&!this.loadingContext.includes(l))throw new y("IMPLEMENTATION_ERROR",`Error: you are using a ${l} clientKey against the ${(null===(c=this.options._environmentUrls)||void 0===c?void 0:c.api)||this.options.environment} environment`);"pub."===l&&console.debug(`The value you are passing as your "clientKey" looks like an originKey (${null===(h=this.options.clientKey)||void 0===h?void 0:h.substring(0,12)}..). Although this is supported it is not the recommended way to integrate. To generate a clientKey, see the documentation (https://docs.adyen.com/development-resources/client-side-authentication/migrate-from-origin-key-to-client-key/) for more details.`);this.options.exposeLibraryMetadata&&(window.AdyenWebMetadata=T.metadata)}}E(T,"metadata",{version:"6.1.1",bundleType:"eslegacy"}),E(T,"registry",p);export{T as default};
|
|
2
2
|
//# sourceMappingURL=core.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e={IDR:1,JPY:1,KRW:1,VND:1,BYR:1,CVE:1,DJF:1,GHC:1,GNF:1,KMF:1,PYG:1,RWF:1,UGX:1,VUV:1,XAF:1,XOF:1,XPF:1,MRO:10,BHD:1e3,IQD:1e3,JOD:1e3,KWD:1e3,OMR:1e3,LYD:1e3,TND:1e3};export{e as default};
|
|
1
|
+
const e={IDR:1,JPY:1,KRW:1,VND:1,BYR:1,CVE:1,DJF:1,GHC:1,GNF:1,KMF:1,ISK:1,PYG:1,RWF:1,UGX:1,VUV:1,XAF:1,XOF:1,XPF:1,MRO:10,BHD:1e3,IQD:1e3,JOD:1e3,KWD:1e3,OMR:1e3,LYD:1e3,TND:1e3};export{e as default};
|
|
2
2
|
//# sourceMappingURL=currency-decimals.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"currency-decimals.js","sources":["../../../../src/utils/constants/currency-decimals.ts"],"sourcesContent":["const CURRENCY_DECIMALS = {\n // ZERO_DECIMAL_CURRENCIES\n IDR: 1,\n JPY: 1,\n KRW: 1,\n VND: 1,\n BYR: 1,\n CVE: 1,\n DJF: 1,\n GHC: 1,\n GNF: 1,\n KMF: 1,\n PYG: 1,\n RWF: 1,\n UGX: 1,\n VUV: 1,\n XAF: 1,\n XOF: 1,\n XPF: 1,\n\n // ONE_DECIMAL_CURRENCIES\n MRO: 10,\n\n // THREE_DECIMAL_CURRENCIES\n BHD: 1000,\n IQD: 1000,\n JOD: 1000,\n KWD: 1000,\n OMR: 1000,\n LYD: 1000,\n TND: 1000\n};\n\nexport default CURRENCY_DECIMALS;\n"],"names":["CURRENCY_DECIMALS","IDR","JPY","KRW","VND","BYR","CVE","DJF","GHC","GNF","KMF","PYG","RWF","UGX","VUV","XAF","XOF","XPF","MRO","BHD","IQD","JOD","KWD","OMR","LYD","TND"],"mappings":"AAAA,MAAMA,EAAoB,CAEtBC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EAGLC,IAAK,GAGLC,IAAK,IACLC,IAAK,IACLC,IAAK,IACLC,IAAK,IACLC,IAAK,IACLC,IAAK,IACLC,IAAK"}
|
|
1
|
+
{"version":3,"file":"currency-decimals.js","sources":["../../../../src/utils/constants/currency-decimals.ts"],"sourcesContent":["const CURRENCY_DECIMALS = {\n // ZERO_DECIMAL_CURRENCIES\n IDR: 1,\n JPY: 1,\n KRW: 1,\n VND: 1,\n BYR: 1,\n CVE: 1,\n DJF: 1,\n GHC: 1,\n GNF: 1,\n KMF: 1,\n ISK: 1,\n PYG: 1,\n RWF: 1,\n UGX: 1,\n VUV: 1,\n XAF: 1,\n XOF: 1,\n XPF: 1,\n\n // ONE_DECIMAL_CURRENCIES\n MRO: 10,\n\n // THREE_DECIMAL_CURRENCIES\n BHD: 1000,\n IQD: 1000,\n JOD: 1000,\n KWD: 1000,\n OMR: 1000,\n LYD: 1000,\n TND: 1000\n};\n\nexport default CURRENCY_DECIMALS;\n"],"names":["CURRENCY_DECIMALS","IDR","JPY","KRW","VND","BYR","CVE","DJF","GHC","GNF","KMF","ISK","PYG","RWF","UGX","VUV","XAF","XOF","XPF","MRO","BHD","IQD","JOD","KWD","OMR","LYD","TND"],"mappings":"AAAA,MAAMA,EAAoB,CAEtBC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EACLC,IAAK,EAGLC,IAAK,GAGLC,IAAK,IACLC,IAAK,IACLC,IAAK,IACLC,IAAK,IACLC,IAAK,IACLC,IAAK,IACLC,IAAK"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adyen/adyen-web",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://docs.adyen.com/checkout",
|
|
6
6
|
"type": "module",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"lint:fix": "npm run lint -- --fix",
|
|
75
75
|
"prettier:fix": "prettier \"src/**/*.{js,ts,tsx}\" \"package.json\" --write --loglevel silent",
|
|
76
76
|
"prepublishOnly": "npm run build",
|
|
77
|
-
"prepare": "cd ../.. && husky
|
|
77
|
+
"prepare": "cd ../.. && husky packages/lib/.husky",
|
|
78
78
|
"size": "npm run build && size-limit"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
@@ -88,11 +88,11 @@
|
|
|
88
88
|
"@rollup/plugin-replace": "5.0.7",
|
|
89
89
|
"@rollup/plugin-terser": "0.4.4",
|
|
90
90
|
"@size-limit/preset-big-lib": "11.1.4",
|
|
91
|
-
"@storybook/addon-a11y": "8.
|
|
92
|
-
"@storybook/addon-essentials": "8.
|
|
93
|
-
"@storybook/manager-api": "8.
|
|
94
|
-
"@storybook/preact": "8.
|
|
95
|
-
"@storybook/preact-vite": "8.
|
|
91
|
+
"@storybook/addon-a11y": "^8.2.9",
|
|
92
|
+
"@storybook/addon-essentials": "^8.2.9",
|
|
93
|
+
"@storybook/manager-api": "^8.2.9",
|
|
94
|
+
"@storybook/preact": "^8.2.9",
|
|
95
|
+
"@storybook/preact-vite": "^8.2.9",
|
|
96
96
|
"@swc/core": "1.7.0",
|
|
97
97
|
"@testing-library/jest-dom": "6.4.6",
|
|
98
98
|
"@testing-library/preact": "3.2.4",
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"rollup-plugin-swc3": "0.11.2",
|
|
127
127
|
"sass": "1.77.8",
|
|
128
128
|
"size-limit": "11.1.4",
|
|
129
|
-
"storybook": "8.
|
|
129
|
+
"storybook": "^8.2.9",
|
|
130
130
|
"stylelint": "16.7.0",
|
|
131
131
|
"stylelint-config-standard-scss": "13.1.0",
|
|
132
132
|
"ts-jest": "29.2.3",
|