@adyen/adyen-web 6.0.3 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +13 -4
- 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/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/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 +13 -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/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/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/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
package/dist/es-legacy/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderPaymentMethods.js","sources":["../../../../../../src/components/Dropin/components/PaymentMethod/OrderPaymentMethods.tsx"],"sourcesContent":["import { h } from 'preact';\nimport PaymentMethodIcon from './PaymentMethodIcon';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport useImage from '../../../../core/Context/useImage';\nimport './OrderPaymentMethods.scss';\n\nexport const OrderPaymentMethods = ({ order, orderStatus, onOrderCancel, brandLogoConfiguration }) => {\n const { i18n } = useCoreContext();\n const getImage = useImage();\n\n return (\n <div>\n <ul className={'adyen-checkout__order-payment-methods-list'}>\n {orderStatus?.paymentMethods?.map((orderPaymentMethod, index) => (\n <li key={`${orderPaymentMethod.type}-${index}`} className=\"adyen-checkout__order-payment-method\">\n <div className=\"adyen-checkout__order-payment-method__header\">\n <div className=\"adyen-checkout__payment-method__header__title\">\n <PaymentMethodIcon\n altDescription={orderPaymentMethod.name}\n type={orderPaymentMethod.type}\n src={brandLogoConfiguration[orderPaymentMethod.type] || getImage()(orderPaymentMethod.type)}\n />\n
|
|
1
|
+
{"version":3,"file":"OrderPaymentMethods.js","sources":["../../../../../../src/components/Dropin/components/PaymentMethod/OrderPaymentMethods.tsx"],"sourcesContent":["import { h } from 'preact';\nimport PaymentMethodIcon from './PaymentMethodIcon';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport useImage from '../../../../core/Context/useImage';\nimport './OrderPaymentMethods.scss';\nimport { Order, OrderStatus } from '../../../../types';\n\ntype OrderPaymentMethodsProps = {\n order: Order;\n orderStatus: OrderStatus;\n onOrderCancel: (order) => void;\n brandLogoConfiguration: any;\n};\n\nexport const OrderPaymentMethods = ({ order, orderStatus, onOrderCancel, brandLogoConfiguration }: OrderPaymentMethodsProps) => {\n const { i18n } = useCoreContext();\n const getImage = useImage();\n\n return (\n <div>\n <ul className={'adyen-checkout__order-payment-methods-list'}>\n {orderStatus?.paymentMethods?.map((orderPaymentMethod, index) => (\n <li key={`${orderPaymentMethod.type}-${index}`} className=\"adyen-checkout__order-payment-method\">\n <div className=\"adyen-checkout__order-payment-method__header\">\n <div className=\"adyen-checkout__payment-method__header__title\">\n <PaymentMethodIcon\n altDescription={orderPaymentMethod.name}\n type={orderPaymentMethod.type}\n src={brandLogoConfiguration[orderPaymentMethod.type] || getImage()(orderPaymentMethod.type)}\n />\n {orderPaymentMethod.label ? `${orderPaymentMethod.label}` : `•••• ${orderPaymentMethod.lastFour}`}\n </div>\n\n {onOrderCancel && (\n <button\n type=\"button\"\n className=\"adyen-checkout__button adyen-checkout__button--inline adyen-checkout__button--link\"\n onClick={() => {\n onOrderCancel({ order });\n }}\n >\n {i18n.get('storedPaymentMethod.disable.button')}\n </button>\n )}\n </div>\n <div className=\"adyen-checkout__order-payment-method__details\">\n <div className=\"adyen-checkout__order-payment-method__deducted-amount\">\n <div className=\"adyen-checkout__order-payment-method__deducted-amount__label\">{i18n.get('deductedBalance')}</div>\n <div className=\"adyen-checkout__order-payment-method__deducted-amount__value\">\n {i18n.amount(orderPaymentMethod.amount.value, orderPaymentMethod.amount.currency)}\n </div>\n </div>\n </div>\n </li>\n ))}\n </ul>\n\n {orderStatus.remainingAmount && (\n <div className=\"adyen-checkout__order-remaining-amount\">\n {i18n.get('partialPayment.warning')}{' '}\n <strong>{i18n.amount(orderStatus.remainingAmount.value, orderStatus.remainingAmount.currency)}</strong>\n </div>\n )}\n </div>\n );\n};\n\nexport default OrderPaymentMethods;\n"],"names":["OrderPaymentMethods","order","orderStatus","onOrderCancel","brandLogoConfiguration","i18n","useCoreContext","getImage","useImage","h","div","ul","className","paymentMethods","map","orderPaymentMethod","index","li","key","type","PaymentMethodIcon","altDescription","name","src","label","lastFour","button","onClick","get","amount","value","currency","remainingAmount","strong"],"mappings":"+OAcO,MAAMA,EAAsB,EAAGC,QAAOC,cAAaC,gBAAeC,6BAOxDF,IAAAA,EANb,MAAMG,KAAEA,GAASC,IACXC,EAAWC,IAEjB,OACIC,EAACC,WACGD,EAACE,KAAAA,CAAGC,UAAW,8CACVV,SAAAA,QAAAA,EAAAA,EAAaW,sBAAbX,IAAAA,OAAAA,EAAAA,EAA6BY,KAAI,CAACC,EAAoBC,IACnDP,EAACQ,KAAAA,CAAGC,IAAK,GAAGH,EAAmBI,QAAQH,IAASJ,UAAU,wCACtDH,EAACC,MAAAA,CAAIE,UAAU,gDACXH,EAACC,MAAAA,CAAIE,UAAU,iDACXH,EAACW,EAAAA,CACGC,eAAgBN,EAAmBO,KACnCH,KAAMJ,EAAmBI,KACzBI,IAAKnB,EAAuBW,EAAmBI,OAASZ,IAAWQ,EAAmBI,QAEzFJ,EAAmBS,MAAQ,GAAGT,EAAmBS,QAAU,QAAQT,EAAmBU,YAG1FtB,GACGM,EAACiB,SAAAA,CACGP,KAAK,SACLP,UAAU,qFACVe,QAAS,KACLxB,EAAc,CAAEF,SAAM,GAGzBI,EAAKuB,IAAI,wCAItBnB,EAACC,MAAAA,CAAIE,UAAU,iDACXH,EAACC,MAAAA,CAAIE,UAAU,yDACXH,EAACC,MAAAA,CAAIE,UAAU,gEAAgEP,EAAKuB,IAAI,oBACxFnB,EAACC,MAAAA,CAAIE,UAAU,gEACVP,EAAKwB,OAAOd,EAAmBc,OAAOC,MAAOf,EAAmBc,OAAOE,iBAQ/F7B,EAAY8B,iBACTvB,EAACC,MAAAA,CAAIE,UAAU,0CACVP,EAAKuB,IAAI,0BAA2B,IACrCnB,EAACwB,cAAQ5B,EAAKwB,OAAO3B,EAAY8B,gBAAgBF,MAAO5B,EAAY8B,gBAAgBD,YAAQ"}
|
|
@@ -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,yBAChD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AOc,EACPjB,KAAM,CAAEnB,YAAWG,OAAMkC,UAASI,WAAUF,UAASG,YAEzD,KACJ,CAKA,KAAKC,EAAgB,CACjB,MAAMN,QAAEA,EAAOO,KAAEA,EAAIC,UAAEA,GAAc5C,EACrCF,EAAgBsB,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","hasOnLoad","entries","key","value","index"],"mappings":"gyBAWaA,MAAAA,EAAkB,IAAMC,KAAKC,MAoB7BC,EAAyBC,yUAAkDC,CAAA,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,WAAY3B,EAAK2B,YAEtC3B,EAAK4B,UAAY,CAAEA,SAAU5B,EAAK4B,WAGpCH,EAA4B,CAACI,EAAm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X,WACpDuC,UAAWtC,IAAWU,EAAsBV,OAC5CuC,WAAYtC,IAAYS,EAAsBT,QAC9CuC,mBAAoBtC,IAAoBQ,EAAsBR,gBAC9DuC,qBAAsBtC,IAAsBO,EAAsBP,kBAClEuC,gBAAiBtC,IAAiBM,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,E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C4D,QAASvD,GAAQiC,KAAKC,UAAU/C,EAAUa,QAAUgC,GACpDwB,uBAAwBvD,EACxBM,gBACAkD,sBAAuBH,EAAS5C,GAChCgD,gBAAiBJ,EAAStC,GAC1B2C,oBAAqBL,EAASjC,GAC9Bb,UACAC,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.0
|
|
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.0",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.0
|
|
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.0",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.0
|
|
3
|
+
"version": "6.1.0",
|
|
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",
|