@commercelayer/react-components 4.15.9 → 4.15.10
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/README.md +1 -1
- package/lib/cjs/components/payment_source/AdyenPayment.js +1 -1
- package/lib/cjs/components/payment_source/BraintreePayment.d.ts +4 -0
- package/lib/cjs/components/payment_source/BraintreePayment.js +1 -1
- package/lib/cjs/context/ExternalFunctionContext.js +1 -1
- package/lib/esm/components/payment_source/AdyenPayment.js +1 -1
- package/lib/esm/components/payment_source/BraintreePayment.d.ts +4 -0
- package/lib/esm/components/payment_source/BraintreePayment.js +1 -1
- package/lib/esm/context/ExternalFunctionContext.js +1 -1
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ A collection of reusable React components that makes it super fast and simple to
|
|
|
8
8
|
|
|
9
9
|
# Getting started
|
|
10
10
|
|
|
11
|
-
For a constantly updated list of the available and soon-to-come micro frontends provided by Commerce Layer's react componente, please refer to [this interactive documentation](https://commercelayer.github.io/commercelayer-react-components
|
|
11
|
+
For a constantly updated list of the available and soon-to-come micro frontends provided by Commerce Layer's react componente, please refer to [this interactive documentation](https://commercelayer.github.io/commercelayer-react-components) that will provide you with all the necessary information about the involved web components and help you get started in a snap.
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AdyenPayment=AdyenPayment;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),localStorage_1=require("../../utils/localStorage"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),browserInfo_1=tslib_1.__importStar(require("../../utils/browserInfo")),PlaceOrderContext_1=tslib_1.__importDefault(require("../../context/PlaceOrderContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),omit_1=tslib_1.__importDefault(require("../../utils/omit")),getPublicIp_1=require("../../utils/getPublicIp"),defaultConfig={};function AdyenPayment({clientKey,config,templateCustomerSaveToWallet,environment="test",locale="en_US"}){const{cardContainerClassName,threeDSecureContainerClassName,styles}=Object.assign(Object.assign({},defaultConfig),config),[loadAdyen,setLoadAdyen]=(0,react_1.useState)(!1),[checkout,setCheckout]=(0,react_1.useState)(),{setPaymentSource,paymentSource,setPaymentMethodErrors,currentPaymentMethodType,setPaymentRef}=(0,react_1.useContext)(PaymentMethodContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),{placeOrderButtonRef}=(0,react_1.useContext)(PlaceOrderContext_1.default),ref=(0,react_1.useRef)(null),handleSubmit=(e,component)=>tslib_1.__awaiter(this,void 0,void 0,function*(){var _a,_b;const savePaymentSourceToCustomerWallet=(_b=(_a=e?.elements)===null||_a===void 0?void 0:_a.save_payment_source_to_customer_wallet)===null||_b===void 0?void 0:_b.checked;return savePaymentSourceToCustomerWallet&&(0,localStorage_1.setCustomerOrderParam)("_save_payment_source_to_customer_wallet",savePaymentSourceToCustomerWallet),component?.submit&&component.submit(),!1}),handleChange=(state,component)=>tslib_1.__awaiter(this,void 0,void 0,function*(){if(state.isValid){ref.current&&(ref.current.onsubmit=()=>tslib_1.__awaiter(this,void 0,void 0,function*(){return yield handleSubmit(ref.current,component)}),setPaymentRef({ref}));const browserInfo=(0,browserInfo_1.default)(),shopperIp=yield(0,getPublicIp_1.getPublicIP)(),attributes={payment_request_data:{payment_method:state.data.paymentMethod,shopperInteraction:"Ecommerce",recurringProcessingModel:"CardOnFile",origin:window.location.origin,return_url:window.location.href,redirect_from_issuer_method:"GET",shopper_ip:shopperIp,browser_info:Object.assign({acceptHeader:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"},browserInfo)}};paymentSource&&(yield setPaymentSource({paymentSourceId:paymentSource.id,paymentResource:"adyen_payments",attributes}))}}),handleOnAdditionalDetails=(state,component)=>tslib_1.__awaiter(this,void 0,void 0,function*(){var _a,_b,_c;const attributes={payment_request_details:state.data,_details:1};try{const pSource=paymentSource&&(yield setPaymentSource({paymentSourceId:paymentSource.id,paymentResource:"adyen_payments",attributes})),adyenAction=(_a=pSource?.payment_response)===null||_a===void 0?void 0:_a.action,resultCode=(_b=pSource?.payment_response)===null||_b===void 0?void 0:_b.resultCode;if(adyenAction&&component)return component.handleAction(adyenAction),!1;if(["Authorised","Pending","Received"].includes(resultCode))return placeOrderButtonRef?.current!=null&&(placeOrderButtonRef.current.disabled&&(placeOrderButtonRef.current.disabled=!1),placeOrderButtonRef.current.click()),!0;if(["Cancelled","Refused"].includes(resultCode)){const message=(_c=pSource?.payment_response)===null||_c===void 0?void 0:_c.refusalReason;setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}]),component&&component.mount("#adyen-dropin")}return!1}catch(error){return console.error("Adyen additional details error:",error),!1}}),onSubmit=(state,component)=>tslib_1.__awaiter(this,void 0,void 0,function*(){var _a,_b,_c,_d,_e,_f,_g,_h,_j;const saveCustomer=document.getElementById("save_payment_source_to_customer_wallet"),url=(0,browserInfo_1.cleanUrlBy)(),shopperIp=yield(0,getPublicIp_1.getPublicIP)();let control=yield setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments"});if(((_a=control?.payment_response)===null||_a===void 0?void 0:_a.resultCode)==="Authorised")return!0;const paymentDataAvailable=Object.keys(control?.payment_request_data).length>0,paymentMethodSelected=(_c=(_b=control?.payment_request_data)===null||_b===void 0?void 0:_b.payment_method)===null||_c===void 0?void 0:_c.type,paymentMethod=saveCustomer?.checked?state.data.paymentMethod:(0,omit_1.default)(state.data.paymentMethod,["encryptedCardNumber","encryptedExpiryMonth","encryptedExpiryYear"]);(!paymentDataAvailable||paymentMethodSelected!==state.data.paymentMethod.type)&&(control=yield setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes:{payment_request_data:Object.assign(Object.assign({},state.data),{payment_method:paymentMethod,return_url:url,origin:window.location.origin,redirect_from_issuer_method:"GET",shopper_ip:shopperIp})}}));const attributes={payment_request_data:Object.assign(Object.assign({},state.data),{payment_method:paymentMethod,return_url:url,origin:window.location.origin,redirect_from_issuer_method:"GET",shopper_ip:shopperIp}),_authorize:1};delete attributes.payment_request_data.paymentMethod;try{const res=yield setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes}),action=(_d=res?.payment_response)===null||_d===void 0?void 0:_d.action;if(component&&action)return component.handleAction(action),!1;const resultCode=(_e=res?.payment_response)===null||_e===void 0?void 0:_e.resultCode;if(["Authorised","Pending","Received"].includes(resultCode))return placeOrderButtonRef?.current!=null&&(placeOrderButtonRef.current.disabled&&(placeOrderButtonRef.current.disabled=!1),placeOrderButtonRef.current.click()),!0;if(["Cancelled","Refused"].includes(resultCode)){const message=(_f=res?.payment_response)===null||_f===void 0?void 0:_f.refusalReason;setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}]),component&&component.mount("#adyen-dropin")}if((_g=res?.payment_response)===null||_g===void 0?void 0:_g.errorType)if(((_h=res?.payment_response)===null||_h===void 0?void 0:_h.errorCode)==="14_006")onSubmit(state,component);else{const message=(_j=res?.payment_response)===null||_j===void 0?void 0:_j.message;setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}])}return!1}catch(error){return setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:error.message}]),!1}});return(0,react_1.useEffect)(()=>{var _a,_b,_c,_d,_e,_f,_g,_h;const paymentMethodsResponse={paymentMethods:!((_a=paymentSource?.payment_methods)===null||_a===void 0)&&_a.paymentMethods?paymentSource?.payment_methods.paymentMethods:[],storedPaymentMethods:!((_b=paymentSource?.payment_methods)===null||_b===void 0)&&_b.storedPaymentMethods?paymentSource?.payment_methods.storedPaymentMethods:[]},[firstPaymentMethod]=paymentMethodsResponse.paymentMethods,isOnlyCard=((_c=paymentMethodsResponse.paymentMethods)===null||_c===void 0?void 0:_c.length)===1&&firstPaymentMethod.type==="scheme";paymentMethodsResponse.paymentMethods.length===0&&console.error("Payment methods are not available. Please, check your Adyen configuration.");const showStoredPaymentMethods=(_e=((_d=paymentSource?.payment_methods)===null||_d===void 0?void 0:_d.storedPaymentMethods)!=null)!==null&&_e!==void 0?_e:!1,options={locale:(_f=order?.language_code)!==null&&_f!==void 0?_f:locale,environment,clientKey,amount:{currency:order?.currency_code||"",value:order?.total_amount_with_taxes_cents||0},countryCode:order?.country_code||"",paymentMethodsResponse,showPayButton:!1,paymentMethodsConfiguration:Object.assign({showStoredPaymentMethods,paypal:Object.assign({showPayButton:!0,style:styles?.paypal},(_g=config?.paymentMethodsConfiguration)===null||_g===void 0?void 0:_g.paypal),card:Object.assign({enableStoreDetails:showStoredPaymentMethods,styles:styles?.card,holderNameRequired:!1},(_h=config?.paymentMethodsConfiguration)===null||_h===void 0?void 0:_h.card)},config?.paymentMethodsConfiguration),onAdditionalDetails:(state,element)=>{handleOnAdditionalDetails(state,element)},onChange:(state,element)=>{handleChange(state,element)},onSubmit:(state,element)=>{onSubmit(state,element)}};return!ref&&clientKey&&(0,localStorage_1.setCustomerOrderParam)("_save_payment_source_to_customer_wallet","false"),clientKey&&!loadAdyen&&window&&!checkout&&Promise.resolve().then(()=>tslib_1.__importStar(require("@adyen/adyen-web"))).then(({default:AdyenCheckout})=>{const type=isOnlyCard?"card":"dropin";AdyenCheckout(options).then(adyenCheckout=>{const component=adyenCheckout.create(type,{showRemovePaymentMethodButton:showStoredPaymentMethods,onSelect:component2=>{const id=component2._id;id.search("scheme")===-1&&ref.current&&(id.search("paypal")===-1?ref.current.onsubmit=()=>tslib_1.__awaiter(this,void 0,void 0,function*(){return yield handleSubmit(ref.current,component2)}):ref.current.onsubmit=null,setPaymentRef({ref}))}}).mount("#adyen-dropin");component&&(setCheckout(component),setLoadAdyen(!0))})}),()=>{setPaymentRef({ref:{current:null}}),setLoadAdyen(!1)}},[clientKey,ref!=null]),!clientKey&&!loadAdyen&&!checkout?null:(0,jsx_runtime_1.jsxs)("form",{ref,onSubmit:e=>{handleSubmit(e,checkout)},children:[(0,jsx_runtime_1.jsx)("div",{className:cardContainerClassName,id:"adyen-dropin"}),templateCustomerSaveToWallet&&(0,jsx_runtime_1.jsx)(Parent_1.default,{name:"save_payment_source_to_customer_wallet",children:templateCustomerSaveToWallet}),(0,jsx_runtime_1.jsx)("div",{className:threeDSecureContainerClassName,id:"adyen-action"})]})}exports.default=AdyenPayment;
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AdyenPayment=AdyenPayment;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),localStorage_1=require("../../utils/localStorage"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),browserInfo_1=tslib_1.__importStar(require("../../utils/browserInfo")),PlaceOrderContext_1=tslib_1.__importDefault(require("../../context/PlaceOrderContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),omit_1=tslib_1.__importDefault(require("../../utils/omit")),getPublicIp_1=require("../../utils/getPublicIp"),defaultConfig={};function AdyenPayment({clientKey,config,templateCustomerSaveToWallet,environment="test",locale="en_US"}){const{cardContainerClassName,threeDSecureContainerClassName,styles}=Object.assign(Object.assign({},defaultConfig),config),[loadAdyen,setLoadAdyen]=(0,react_1.useState)(!1),[checkout,setCheckout]=(0,react_1.useState)(),{setPaymentSource,paymentSource,setPaymentMethodErrors,currentPaymentMethodType,setPaymentRef}=(0,react_1.useContext)(PaymentMethodContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),{placeOrderButtonRef}=(0,react_1.useContext)(PlaceOrderContext_1.default),ref=(0,react_1.useRef)(null),handleSubmit=(e,component)=>tslib_1.__awaiter(this,void 0,void 0,function*(){var _a,_b;const savePaymentSourceToCustomerWallet=(_b=(_a=e?.elements)===null||_a===void 0?void 0:_a.save_payment_source_to_customer_wallet)===null||_b===void 0?void 0:_b.checked;return savePaymentSourceToCustomerWallet&&(0,localStorage_1.setCustomerOrderParam)("_save_payment_source_to_customer_wallet",savePaymentSourceToCustomerWallet),component?.submit&&component.submit(),!1}),handleChange=(state,component)=>tslib_1.__awaiter(this,void 0,void 0,function*(){if(state.isValid){ref.current&&(ref.current.onsubmit=()=>tslib_1.__awaiter(this,void 0,void 0,function*(){return yield handleSubmit(ref.current,component)}),setPaymentRef({ref}));const browserInfo=(0,browserInfo_1.default)(),shopperIp=yield(0,getPublicIp_1.getPublicIP)(),attributes={payment_request_data:{payment_method:state.data.paymentMethod,shopperInteraction:"Ecommerce",recurringProcessingModel:"CardOnFile",origin:window.location.origin,return_url:window.location.href,redirect_from_issuer_method:"GET",shopper_ip:shopperIp,browser_info:Object.assign({acceptHeader:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"},browserInfo)}};paymentSource&&(yield setPaymentSource({paymentSourceId:paymentSource.id,paymentResource:"adyen_payments",attributes}))}}),handleOnAdditionalDetails=(state,component)=>tslib_1.__awaiter(this,void 0,void 0,function*(){var _a,_b,_c;const attributes={payment_request_details:state.data,_details:1};try{const pSource=paymentSource&&(yield setPaymentSource({paymentSourceId:paymentSource.id,paymentResource:"adyen_payments",attributes})),adyenAction=(_a=pSource?.payment_response)===null||_a===void 0?void 0:_a.action,resultCode=(_b=pSource?.payment_response)===null||_b===void 0?void 0:_b.resultCode;if(adyenAction&&component)return component.handleAction(adyenAction),!1;if(["Authorised","Pending","Received"].includes(resultCode))return placeOrderButtonRef?.current!=null&&(placeOrderButtonRef.current.disabled&&(placeOrderButtonRef.current.disabled=!1),placeOrderButtonRef.current.click()),!0;if(["Cancelled","Refused"].includes(resultCode)){const message=(_c=pSource?.payment_response)===null||_c===void 0?void 0:_c.refusalReason;setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}]),component&&component.mount("#adyen-dropin")}return!1}catch(error){return console.error("Adyen additional details error:",error),!1}}),onSubmit=(state,component)=>tslib_1.__awaiter(this,void 0,void 0,function*(){var _a,_b,_c,_d,_e,_f,_g,_h,_j;const saveCustomer=document.getElementById("save_payment_source_to_customer_wallet"),url=(0,browserInfo_1.cleanUrlBy)(),shopperIp=yield(0,getPublicIp_1.getPublicIP)();let control=yield setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments"});if(((_a=control?.payment_response)===null||_a===void 0?void 0:_a.resultCode)==="Authorised")return!0;const paymentDataAvailable=Object.keys(control?.payment_request_data).length>0,paymentMethodSelected=(_c=(_b=control?.payment_request_data)===null||_b===void 0?void 0:_b.payment_method)===null||_c===void 0?void 0:_c.type,paymentMethod=saveCustomer?.checked?state.data.paymentMethod:(0,omit_1.default)(state.data.paymentMethod,["encryptedCardNumber","encryptedExpiryMonth","encryptedExpiryYear"]);(!paymentDataAvailable||paymentMethodSelected!==state.data.paymentMethod.type)&&(control=yield setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes:{payment_request_data:Object.assign(Object.assign({},state.data),{payment_method:paymentMethod,return_url:url,origin:window.location.origin,redirect_from_issuer_method:"GET",shopper_ip:shopperIp})}}));const attributes={payment_request_data:Object.assign(Object.assign({},state.data),{payment_method:paymentMethod,return_url:url,origin:window.location.origin,redirect_from_issuer_method:"GET",shopper_ip:shopperIp}),_authorize:1};delete attributes.payment_request_data.paymentMethod;try{const res=yield setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes}),action=(_d=res?.payment_response)===null||_d===void 0?void 0:_d.action;if(component&&action)return component.handleAction(action),!1;const resultCode=(_e=res?.payment_response)===null||_e===void 0?void 0:_e.resultCode;if(["Authorised","Pending","Received"].includes(resultCode))return placeOrderButtonRef?.current!=null&&(placeOrderButtonRef.current.disabled&&(placeOrderButtonRef.current.disabled=!1),placeOrderButtonRef.current.click()),!0;if(["Cancelled","Refused"].includes(resultCode)){const message=(_f=res?.payment_response)===null||_f===void 0?void 0:_f.refusalReason;setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}]),component&&component.mount("#adyen-dropin")}if((_g=res?.payment_response)===null||_g===void 0?void 0:_g.errorType)if(((_h=res?.payment_response)===null||_h===void 0?void 0:_h.errorCode)==="14_006")onSubmit(state,component);else{const message=(_j=res?.payment_response)===null||_j===void 0?void 0:_j.message;setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}])}return!1}catch(error){return setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:error.message}]),!1}});return(0,react_1.useEffect)(()=>{var _a,_b,_c,_d,_e,_f,_g,_h;const paymentMethodsResponse={paymentMethods:!((_a=paymentSource?.payment_methods)===null||_a===void 0)&&_a.paymentMethods?paymentSource?.payment_methods.paymentMethods:[],storedPaymentMethods:!((_b=paymentSource?.payment_methods)===null||_b===void 0)&&_b.storedPaymentMethods?paymentSource?.payment_methods.storedPaymentMethods:[]},[firstPaymentMethod]=paymentMethodsResponse.paymentMethods,isOnlyCard=((_c=paymentMethodsResponse.paymentMethods)===null||_c===void 0?void 0:_c.length)===1&&firstPaymentMethod.type==="scheme";paymentMethodsResponse.paymentMethods.length===0&&console.error("Payment methods are not available. Please, check your Adyen configuration.");const showStoredPaymentMethods=(_e=((_d=paymentSource?.payment_methods)===null||_d===void 0?void 0:_d.storedPaymentMethods)!=null)!==null&&_e!==void 0?_e:!1,options={locale:(_f=order?.language_code)!==null&&_f!==void 0?_f:locale,environment,clientKey,amount:{currency:order?.currency_code||"",value:order?.total_amount_with_taxes_cents||0},countryCode:order?.country_code||"",paymentMethodsResponse,showPayButton:!1,paymentMethodsConfiguration:Object.assign({showStoredPaymentMethods,paypal:Object.assign({showPayButton:!0,style:styles?.paypal},(_g=config?.paymentMethodsConfiguration)===null||_g===void 0?void 0:_g.paypal),card:Object.assign({enableStoreDetails:showStoredPaymentMethods,styles:styles?.card,holderNameRequired:!1},(_h=config?.paymentMethodsConfiguration)===null||_h===void 0?void 0:_h.card)},config?.paymentMethodsConfiguration),onAdditionalDetails:(state,element)=>{handleOnAdditionalDetails(state,element)},onChange:(state,element)=>{handleChange(state,element)},onSubmit:(state,element)=>{onSubmit(state,element)}};return!ref&&clientKey&&(0,localStorage_1.setCustomerOrderParam)("_save_payment_source_to_customer_wallet","false"),clientKey&&!loadAdyen&&window&&!checkout&&Promise.resolve().then(()=>tslib_1.__importStar(require("@adyen/adyen-web"))).then(({default:AdyenCheckout})=>{const type=isOnlyCard?"card":"dropin";AdyenCheckout(options).then(adyenCheckout=>{const component=adyenCheckout.create(type,{showRemovePaymentMethodButton:showStoredPaymentMethods,instantPaymentTypes:["applepay","googlepay"],onSelect:component2=>{const id=component2._id;id.search("scheme")===-1&&ref.current&&(id.search("paypal")===-1?ref.current.onsubmit=()=>tslib_1.__awaiter(this,void 0,void 0,function*(){return yield handleSubmit(ref.current,component2)}):ref.current.onsubmit=null,setPaymentRef({ref}))}}).mount("#adyen-dropin");component&&(setCheckout(component),setLoadAdyen(!0))})}),()=>{setPaymentRef({ref:{current:null}}),setLoadAdyen(!1)}},[clientKey,ref!=null]),!clientKey&&!loadAdyen&&!checkout?null:(0,jsx_runtime_1.jsxs)("form",{ref,onSubmit:e=>{handleSubmit(e,checkout)},children:[(0,jsx_runtime_1.jsx)("div",{className:cardContainerClassName,id:"adyen-dropin"}),templateCustomerSaveToWallet&&(0,jsx_runtime_1.jsx)(Parent_1.default,{name:"save_payment_source_to_customer_wallet",children:templateCustomerSaveToWallet}),(0,jsx_runtime_1.jsx)("div",{className:threeDSecureContainerClassName,id:"adyen-action"})]})}exports.default=AdyenPayment;
|
|
@@ -16,6 +16,10 @@ export interface BraintreeConfig {
|
|
|
16
16
|
inputWrapperClassName?: string;
|
|
17
17
|
fields?: BraintreeHostedFields<HostedFieldFieldOptions>;
|
|
18
18
|
styles?: Record<string, Record<string, string>>;
|
|
19
|
+
/**
|
|
20
|
+
* Force challenge request for 3D Secure authentication. Default is true.
|
|
21
|
+
*/
|
|
22
|
+
challengeRequested?: boolean;
|
|
19
23
|
}
|
|
20
24
|
interface Props {
|
|
21
25
|
authorization: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BraintreePayment=BraintreePayment;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),localStorage_1=require("../../utils/localStorage"),promisify_1=tslib_1.__importDefault(require("../../utils/promisify")),defaultConfig={styles:{input:{"font-size":"16px",color:"#3A3A3A"},".number":{"font-family":"monospace"},":focus":{color:"blue"},".valid":{color:"green"},".invalid":{color:"red"},"@media screen and (max-width: 700px)":{input:{"font-size":"14px"}}},fields:{number:{label:"Card Number",selector:"#card-number",placeholder:"4111 1111 1111 1111"},cvv:{label:"CVV",selector:"#cvv",placeholder:"123"},expirationDate:{label:"Expiration Date",selector:"#expiration-date",placeholder:"10/2022"}},submitLabel:"Set payment method"};function BraintreePayment({authorization,config,templateCustomerSaveToWallet}){var _a,_b,_c;const{fields,styles,containerClassName,cardContainerClassName,fieldsContainerClassName,expDateContainerClassName,fieldLabelClassName,cvvContainerClassName,inputWrapperClassName,cardDetailsContainerClassName}=Object.assign(Object.assign({},defaultConfig),config),[loadBraintree,setLoadBraintree]=(0,react_1.useState)(!1),{setPaymentSource,paymentSource,setPaymentMethodErrors,currentPaymentMethodType,setPaymentRef}=(0,react_1.useContext)(PaymentMethodContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),ref=(0,react_1.useRef)(null),handleSubmitForm=_a2=>tslib_1.__awaiter(this,[_a2],void 0,function*({event,hostedFieldsInstance,threeDSInstance}){var _b2,_c2,_d,_e,_f,_g,_h;const savePaymentSourceToCustomerWallet=(_c2=(_b2=event?.elements)===null||_b2===void 0?void 0:_b2.save_payment_source_to_customer_wallet)===null||_c2===void 0?void 0:_c2.checked;if(savePaymentSourceToCustomerWallet&&(0,localStorage_1.setCustomerOrderParam)("_save_payment_source_to_customer_wallet",savePaymentSourceToCustomerWallet),hostedFieldsInstance)try{const payload=yield(0,promisify_1.default)(hostedFieldsInstance).then(payload2=>payload2),billingAddress=order?.billing_address,verifyCardOptions={nonce:payload.nonce,bin:payload.details.bin,amount:`${order?.total_amount_with_taxes_float}`,email:(_d=order?.customer_email)!==null&&_d!==void 0?_d:"",billingAddress:{givenName:(_e=billingAddress?.first_name)!==null&&_e!==void 0?_e:"",surname:(_f=billingAddress?.last_name)!==null&&_f!==void 0?_f:"",phoneNumber:billingAddress?.phone,streetAddress:billingAddress?.line_1,countryCodeAlpha2:billingAddress?.country_code,postalCode:(_g=billingAddress?.zip_code)!==null&&_g!==void 0?_g:"",region:billingAddress?.state_code,locality:billingAddress?.city},onLookupComplete:(_data,next)=>{next()}},response=yield threeDSInstance.verifyCard(verifyCardOptions),validStatus=response?.liabilityShiftPossible===!0&&response?.liabilityShifted===!0;if(console.log("validStatus",validStatus),validStatus&&paymentSource!=null)return yield setPaymentSource({paymentSourceId:paymentSource.id,paymentResource:"braintree_payments",attributes:{payment_method_nonce:response.nonce,options:{id:response.nonce,card:{last4:response.details.lastFour,exp_year:response.details.expirationYear,exp_month:response.details.expirationMonth,brand:response.details.cardType.toLowerCase()}}}}),!0;throw new Error(`3D Secure authentication failed - ${(_h=response?.threeDSecureInfo)===null||_h===void 0?void 0:_h.status}`)}catch(error){return console.error(error),setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:error.message}]),!1}return!1});return(0,react_1.useEffect)(()=>{if(!ref&&authorization&&(0,localStorage_1.setCustomerOrderParam)("_save_payment_source_to_customer_wallet","false"),authorization&&!loadBraintree&&!(0,isEmpty_1.default)(window)){const braintreeClient=require("braintree-web/client"),hostedFields=require("braintree-web/hosted-fields"),threeDSecure=require("braintree-web/three-d-secure");braintreeClient.create({authorization},(clientErr,clientInstance)=>{if(clientErr){console.error(clientErr);return}hostedFields.create({client:clientInstance,fields,styles},(hostedFieldsErr,hostedFieldsInstance)=>{if(hostedFieldsErr){console.error(hostedFieldsErr);return}setLoadBraintree(!0),threeDSecure.create({authorization,version:2},(threeDSecureErr,threeDSInstance)=>{threeDSecureErr&&(console.error("3DSecure error",threeDSecureErr),setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:threeDSecureErr.message}])),ref.current&&(ref.current.onsubmit=paymentSource2=>tslib_1.__awaiter(this,void 0,void 0,function*(){return yield handleSubmitForm({event:ref.current,hostedFieldsInstance,threeDSInstance,paymentSource:paymentSource2})}),setPaymentRef({ref}))})})})}return()=>{setPaymentRef({ref:{current:null}}),setLoadBraintree(!1)}},[authorization,ref]),!authorization&&!loadBraintree?null:(0,jsx_runtime_1.jsx)("div",{className:containerClassName,children:(0,jsx_runtime_1.jsxs)("form",{ref,id:"braintree-form",onSubmit:handleSubmitForm,className:containerClassName,children:[(0,jsx_runtime_1.jsxs)("div",{className:fieldsContainerClassName,children:[(0,jsx_runtime_1.jsxs)("div",{className:cardContainerClassName,children:[(0,jsx_runtime_1.jsx)("label",{className:fieldLabelClassName,htmlFor:"card-number",children:(_a=fields?.number)===null||_a===void 0?void 0:_a.label}),(0,jsx_runtime_1.jsx)("div",{className:inputWrapperClassName,id:"card-number"})]}),(0,jsx_runtime_1.jsxs)("div",{className:cardDetailsContainerClassName,children:[(0,jsx_runtime_1.jsxs)("div",{className:expDateContainerClassName,children:[(0,jsx_runtime_1.jsx)("label",{className:fieldLabelClassName,htmlFor:"expiration-date",children:(_b=fields?.expirationDate)===null||_b===void 0?void 0:_b.label}),(0,jsx_runtime_1.jsx)("div",{className:inputWrapperClassName,id:"expiration-date"})]}),(0,jsx_runtime_1.jsxs)("div",{className:cvvContainerClassName,children:[(0,jsx_runtime_1.jsx)("label",{className:fieldLabelClassName,htmlFor:"cvv",children:(_c=fields?.cvv)===null||_c===void 0?void 0:_c.label}),(0,jsx_runtime_1.jsx)("div",{className:inputWrapperClassName,id:"cvv"})]})]})]}),(0,jsx_runtime_1.jsx)("div",{className:fieldsContainerClassName,children:templateCustomerSaveToWallet&&(0,jsx_runtime_1.jsx)(Parent_1.default,{name:"save_payment_source_to_customer_wallet",children:templateCustomerSaveToWallet})})]})})}exports.default=BraintreePayment;
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BraintreePayment=BraintreePayment;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),localStorage_1=require("../../utils/localStorage"),promisify_1=tslib_1.__importDefault(require("../../utils/promisify")),defaultConfig={styles:{input:{"font-size":"16px",color:"#3A3A3A"},".number":{"font-family":"monospace"},":focus":{color:"blue"},".valid":{color:"green"},".invalid":{color:"red"},"@media screen and (max-width: 700px)":{input:{"font-size":"14px"}}},fields:{number:{label:"Card Number",selector:"#card-number",placeholder:"4111 1111 1111 1111"},cvv:{label:"CVV",selector:"#cvv",placeholder:"123"},expirationDate:{label:"Expiration Date",selector:"#expiration-date",placeholder:"10/2022"}},submitLabel:"Set payment method"};function BraintreePayment({authorization,config,templateCustomerSaveToWallet}){var _a,_b,_c;const{fields,styles,containerClassName,cardContainerClassName,fieldsContainerClassName,expDateContainerClassName,fieldLabelClassName,cvvContainerClassName,inputWrapperClassName,cardDetailsContainerClassName}=Object.assign(Object.assign({},defaultConfig),config),[loadBraintree,setLoadBraintree]=(0,react_1.useState)(!1),{setPaymentSource,paymentSource,setPaymentMethodErrors,currentPaymentMethodType,setPaymentRef}=(0,react_1.useContext)(PaymentMethodContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),ref=(0,react_1.useRef)(null),handleSubmitForm=_a2=>tslib_1.__awaiter(this,[_a2],void 0,function*({event,hostedFieldsInstance,threeDSInstance}){var _b2,_c2,_d,_e,_f,_g,_h;const savePaymentSourceToCustomerWallet=(_c2=(_b2=event?.elements)===null||_b2===void 0?void 0:_b2.save_payment_source_to_customer_wallet)===null||_c2===void 0?void 0:_c2.checked;if(savePaymentSourceToCustomerWallet&&(0,localStorage_1.setCustomerOrderParam)("_save_payment_source_to_customer_wallet",savePaymentSourceToCustomerWallet),hostedFieldsInstance)try{const payload=yield(0,promisify_1.default)(hostedFieldsInstance).then(payload2=>payload2),billingAddress=order?.billing_address,verifyCardOptions={nonce:payload.nonce,bin:payload.details.bin,amount:`${order?.total_amount_with_taxes_float}`,email:(_d=order?.customer_email)!==null&&_d!==void 0?_d:"",billingAddress:{givenName:(_e=billingAddress?.first_name)!==null&&_e!==void 0?_e:"",surname:(_f=billingAddress?.last_name)!==null&&_f!==void 0?_f:"",phoneNumber:billingAddress?.phone,streetAddress:billingAddress?.line_1,countryCodeAlpha2:billingAddress?.country_code,postalCode:(_g=billingAddress?.zip_code)!==null&&_g!==void 0?_g:"",region:billingAddress?.state_code,locality:billingAddress?.city},onLookupComplete:(_data,next)=>{next()}},response=yield threeDSInstance.verifyCard(verifyCardOptions),validStatus=response?.liabilityShiftPossible===!0&&response?.liabilityShifted===!0;if(console.log("validStatus",validStatus),validStatus&&paymentSource!=null)return yield setPaymentSource({paymentSourceId:paymentSource.id,paymentResource:"braintree_payments",attributes:{payment_method_nonce:response.nonce,options:{id:response.nonce,card:{last4:response.details.lastFour,exp_year:response.details.expirationYear,exp_month:response.details.expirationMonth,brand:response.details.cardType.toLowerCase()}}}}),!0;throw new Error(`3D Secure authentication failed - ${(_h=response?.threeDSecureInfo)===null||_h===void 0?void 0:_h.status}`)}catch(error){return console.error(error),setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:error.message}]),!1}return!1});return(0,react_1.useEffect)(()=>{var _a2;if(!ref&&authorization&&(0,localStorage_1.setCustomerOrderParam)("_save_payment_source_to_customer_wallet","false"),authorization&&!loadBraintree&&!(0,isEmpty_1.default)(window)){const braintreeClient=require("braintree-web/client"),hostedFields=require("braintree-web/hosted-fields"),threeDSecure=require("braintree-web/three-d-secure");braintreeClient.create({authorization,challengeRequested:(_a2=config?.challengeRequested)!==null&&_a2!==void 0?_a2:!0},(clientErr,clientInstance)=>{if(clientErr){console.error(clientErr);return}hostedFields.create({client:clientInstance,fields,styles},(hostedFieldsErr,hostedFieldsInstance)=>{if(hostedFieldsErr){console.error(hostedFieldsErr);return}setLoadBraintree(!0),threeDSecure.create({authorization,version:2},(threeDSecureErr,threeDSInstance)=>{threeDSecureErr&&(console.error("3DSecure error",threeDSecureErr),setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:threeDSecureErr.message}])),ref.current&&(ref.current.onsubmit=paymentSource2=>tslib_1.__awaiter(this,void 0,void 0,function*(){return yield handleSubmitForm({event:ref.current,hostedFieldsInstance,threeDSInstance,paymentSource:paymentSource2})}),setPaymentRef({ref}))})})})}return()=>{setPaymentRef({ref:{current:null}}),setLoadBraintree(!1)}},[authorization,ref]),!authorization&&!loadBraintree?null:(0,jsx_runtime_1.jsx)("div",{className:containerClassName,children:(0,jsx_runtime_1.jsxs)("form",{ref,id:"braintree-form",onSubmit:handleSubmitForm,className:containerClassName,children:[(0,jsx_runtime_1.jsxs)("div",{className:fieldsContainerClassName,children:[(0,jsx_runtime_1.jsxs)("div",{className:cardContainerClassName,children:[(0,jsx_runtime_1.jsx)("label",{className:fieldLabelClassName,htmlFor:"card-number",children:(_a=fields?.number)===null||_a===void 0?void 0:_a.label}),(0,jsx_runtime_1.jsx)("div",{className:inputWrapperClassName,id:"card-number"})]}),(0,jsx_runtime_1.jsxs)("div",{className:cardDetailsContainerClassName,children:[(0,jsx_runtime_1.jsxs)("div",{className:expDateContainerClassName,children:[(0,jsx_runtime_1.jsx)("label",{className:fieldLabelClassName,htmlFor:"expiration-date",children:(_b=fields?.expirationDate)===null||_b===void 0?void 0:_b.label}),(0,jsx_runtime_1.jsx)("div",{className:inputWrapperClassName,id:"expiration-date"})]}),(0,jsx_runtime_1.jsxs)("div",{className:cvvContainerClassName,children:[(0,jsx_runtime_1.jsx)("label",{className:fieldLabelClassName,htmlFor:"cvv",children:(_c=fields?.cvv)===null||_c===void 0?void 0:_c.label}),(0,jsx_runtime_1.jsx)("div",{className:inputWrapperClassName,id:"cvv"})]})]})]}),(0,jsx_runtime_1.jsx)("div",{className:fieldsContainerClassName,children:templateCustomerSaveToWallet&&(0,jsx_runtime_1.jsx)(Parent_1.default,{name:"save_payment_source_to_customer_wallet",children:templateCustomerSaveToWallet})})]})})}exports.default=BraintreePayment;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.callExternalFunction=void 0;const tslib_1=require("tslib"),react_1=require("react"),
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.callExternalFunction=void 0;const tslib_1=require("tslib"),react_1=require("react"),callExternalFunction=_a=>tslib_1.__awaiter(void 0,[_a],void 0,function*({url,data}){const response=yield fetch(url,{method:"POST",body:JSON.stringify(data),headers:{"Content-Type":"application/json"}});if(!response.ok)throw new Error("Failed to call external function");return yield response.json()});exports.callExternalFunction=callExternalFunction;const ExternalFunctionContext=(0,react_1.createContext)({url:null,callExternalFunction:exports.callExternalFunction});exports.default=ExternalFunctionContext;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext,useEffect,useRef,useState}from"react";import PaymentMethodContext from"../../context/PaymentMethodContext";import{setCustomerOrderParam}from"../../utils/localStorage";import Parent from"../utils/Parent";import getBrowserInfo,{cleanUrlBy}from"../../utils/browserInfo";import PlaceOrderContext from"../../context/PlaceOrderContext";import OrderContext from"../../context/OrderContext";import omit from"../../utils/omit";import{getPublicIP}from"../../utils/getPublicIp";const defaultConfig={};export function AdyenPayment({clientKey,config,templateCustomerSaveToWallet,environment="test",locale="en_US"}){const{cardContainerClassName,threeDSecureContainerClassName,styles}={...defaultConfig,...config},[loadAdyen,setLoadAdyen]=useState(!1),[checkout,setCheckout]=useState(),{setPaymentSource,paymentSource,setPaymentMethodErrors,currentPaymentMethodType,setPaymentRef}=useContext(PaymentMethodContext),{order}=useContext(OrderContext),{placeOrderButtonRef}=useContext(PlaceOrderContext),ref=useRef(null),handleSubmit=async(e,component)=>{const savePaymentSourceToCustomerWallet=e?.elements?.save_payment_source_to_customer_wallet?.checked;return savePaymentSourceToCustomerWallet&&setCustomerOrderParam("_save_payment_source_to_customer_wallet",savePaymentSourceToCustomerWallet),component?.submit&&component.submit(),!1},handleChange=async(state,component)=>{if(state.isValid){ref.current&&(ref.current.onsubmit=async()=>await handleSubmit(ref.current,component),setPaymentRef({ref}));const browserInfo=getBrowserInfo(),shopperIp=await getPublicIP(),attributes={payment_request_data:{payment_method:state.data.paymentMethod,shopperInteraction:"Ecommerce",recurringProcessingModel:"CardOnFile",origin:window.location.origin,return_url:window.location.href,redirect_from_issuer_method:"GET",shopper_ip:shopperIp,browser_info:{acceptHeader:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",...browserInfo}}};paymentSource&&await setPaymentSource({paymentSourceId:paymentSource.id,paymentResource:"adyen_payments",attributes})}},handleOnAdditionalDetails=async(state,component)=>{const attributes={payment_request_details:state.data,_details:1};try{const pSource=paymentSource&&await setPaymentSource({paymentSourceId:paymentSource.id,paymentResource:"adyen_payments",attributes}),adyenAction=pSource?.payment_response?.action,resultCode=pSource?.payment_response?.resultCode;if(adyenAction&&component)return component.handleAction(adyenAction),!1;if(["Authorised","Pending","Received"].includes(resultCode))return placeOrderButtonRef?.current!=null&&(placeOrderButtonRef.current.disabled&&(placeOrderButtonRef.current.disabled=!1),placeOrderButtonRef.current.click()),!0;if(["Cancelled","Refused"].includes(resultCode)){const message=pSource?.payment_response?.refusalReason;setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}]),component&&component.mount("#adyen-dropin")}return!1}catch(error){return console.error("Adyen additional details error:",error),!1}},onSubmit=async(state,component)=>{const saveCustomer=document.getElementById("save_payment_source_to_customer_wallet"),url=cleanUrlBy(),shopperIp=await getPublicIP();let control=await setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments"});if(control?.payment_response?.resultCode==="Authorised")return!0;const paymentDataAvailable=Object.keys(control?.payment_request_data).length>0,paymentMethodSelected=control?.payment_request_data?.payment_method?.type,paymentMethod=saveCustomer?.checked?state.data.paymentMethod:omit(state.data.paymentMethod,["encryptedCardNumber","encryptedExpiryMonth","encryptedExpiryYear"]);(!paymentDataAvailable||paymentMethodSelected!==state.data.paymentMethod.type)&&(control=await setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes:{payment_request_data:{...state.data,payment_method:paymentMethod,return_url:url,origin:window.location.origin,redirect_from_issuer_method:"GET",shopper_ip:shopperIp}}}));const attributes={payment_request_data:{...state.data,payment_method:paymentMethod,return_url:url,origin:window.location.origin,redirect_from_issuer_method:"GET",shopper_ip:shopperIp},_authorize:1};delete attributes.payment_request_data.paymentMethod;try{const res=await setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes}),action=res?.payment_response?.action;if(component&&action)return component.handleAction(action),!1;const resultCode=res?.payment_response?.resultCode;if(["Authorised","Pending","Received"].includes(resultCode))return placeOrderButtonRef?.current!=null&&(placeOrderButtonRef.current.disabled&&(placeOrderButtonRef.current.disabled=!1),placeOrderButtonRef.current.click()),!0;if(["Cancelled","Refused"].includes(resultCode)){const message=res?.payment_response?.refusalReason;setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}]),component&&component.mount("#adyen-dropin")}if(res?.payment_response?.errorType)if(res?.payment_response?.errorCode==="14_006")onSubmit(state,component);else{const message=res?.payment_response?.message;setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}])}return!1}catch(error){return setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:error.message}]),!1}};return useEffect(()=>{const paymentMethodsResponse={paymentMethods:paymentSource?.payment_methods?.paymentMethods?paymentSource?.payment_methods.paymentMethods:[],storedPaymentMethods:paymentSource?.payment_methods?.storedPaymentMethods?paymentSource?.payment_methods.storedPaymentMethods:[]},[firstPaymentMethod]=paymentMethodsResponse.paymentMethods,isOnlyCard=paymentMethodsResponse.paymentMethods?.length===1&&firstPaymentMethod.type==="scheme";paymentMethodsResponse.paymentMethods.length===0&&console.error("Payment methods are not available. Please, check your Adyen configuration.");const showStoredPaymentMethods=paymentSource?.payment_methods?.storedPaymentMethods!=null,options={locale:order?.language_code??locale,environment,clientKey,amount:{currency:order?.currency_code||"",value:order?.total_amount_with_taxes_cents||0},countryCode:order?.country_code||"",paymentMethodsResponse,showPayButton:!1,paymentMethodsConfiguration:{showStoredPaymentMethods,paypal:{showPayButton:!0,style:styles?.paypal,...config?.paymentMethodsConfiguration?.paypal},card:{enableStoreDetails:showStoredPaymentMethods,styles:styles?.card,holderNameRequired:!1,...config?.paymentMethodsConfiguration?.card},...config?.paymentMethodsConfiguration},onAdditionalDetails:(state,element)=>{handleOnAdditionalDetails(state,element)},onChange:(state,element)=>{handleChange(state,element)},onSubmit:(state,element)=>{onSubmit(state,element)}};return!ref&&clientKey&&setCustomerOrderParam("_save_payment_source_to_customer_wallet","false"),clientKey&&!loadAdyen&&window&&!checkout&&import("@adyen/adyen-web").then(({default:AdyenCheckout})=>{const type=isOnlyCard?"card":"dropin";AdyenCheckout(options).then(adyenCheckout=>{const component=adyenCheckout.create(type,{showRemovePaymentMethodButton:showStoredPaymentMethods,onSelect:component2=>{const id=component2._id;id.search("scheme")===-1&&ref.current&&(id.search("paypal")===-1?ref.current.onsubmit=async()=>await handleSubmit(ref.current,component2):ref.current.onsubmit=null,setPaymentRef({ref}))}}).mount("#adyen-dropin");component&&(setCheckout(component),setLoadAdyen(!0))})}),()=>{setPaymentRef({ref:{current:null}}),setLoadAdyen(!1)}},[clientKey,ref!=null]),!clientKey&&!loadAdyen&&!checkout?null:_jsxs("form",{ref,onSubmit:e=>{handleSubmit(e,checkout)},children:[_jsx("div",{className:cardContainerClassName,id:"adyen-dropin"}),templateCustomerSaveToWallet&&_jsx(Parent,{name:"save_payment_source_to_customer_wallet",children:templateCustomerSaveToWallet}),_jsx("div",{className:threeDSecureContainerClassName,id:"adyen-action"})]})}export default AdyenPayment;
|
|
2
|
+
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext,useEffect,useRef,useState}from"react";import PaymentMethodContext from"../../context/PaymentMethodContext";import{setCustomerOrderParam}from"../../utils/localStorage";import Parent from"../utils/Parent";import getBrowserInfo,{cleanUrlBy}from"../../utils/browserInfo";import PlaceOrderContext from"../../context/PlaceOrderContext";import OrderContext from"../../context/OrderContext";import omit from"../../utils/omit";import{getPublicIP}from"../../utils/getPublicIp";const defaultConfig={};export function AdyenPayment({clientKey,config,templateCustomerSaveToWallet,environment="test",locale="en_US"}){const{cardContainerClassName,threeDSecureContainerClassName,styles}={...defaultConfig,...config},[loadAdyen,setLoadAdyen]=useState(!1),[checkout,setCheckout]=useState(),{setPaymentSource,paymentSource,setPaymentMethodErrors,currentPaymentMethodType,setPaymentRef}=useContext(PaymentMethodContext),{order}=useContext(OrderContext),{placeOrderButtonRef}=useContext(PlaceOrderContext),ref=useRef(null),handleSubmit=async(e,component)=>{const savePaymentSourceToCustomerWallet=e?.elements?.save_payment_source_to_customer_wallet?.checked;return savePaymentSourceToCustomerWallet&&setCustomerOrderParam("_save_payment_source_to_customer_wallet",savePaymentSourceToCustomerWallet),component?.submit&&component.submit(),!1},handleChange=async(state,component)=>{if(state.isValid){ref.current&&(ref.current.onsubmit=async()=>await handleSubmit(ref.current,component),setPaymentRef({ref}));const browserInfo=getBrowserInfo(),shopperIp=await getPublicIP(),attributes={payment_request_data:{payment_method:state.data.paymentMethod,shopperInteraction:"Ecommerce",recurringProcessingModel:"CardOnFile",origin:window.location.origin,return_url:window.location.href,redirect_from_issuer_method:"GET",shopper_ip:shopperIp,browser_info:{acceptHeader:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",...browserInfo}}};paymentSource&&await setPaymentSource({paymentSourceId:paymentSource.id,paymentResource:"adyen_payments",attributes})}},handleOnAdditionalDetails=async(state,component)=>{const attributes={payment_request_details:state.data,_details:1};try{const pSource=paymentSource&&await setPaymentSource({paymentSourceId:paymentSource.id,paymentResource:"adyen_payments",attributes}),adyenAction=pSource?.payment_response?.action,resultCode=pSource?.payment_response?.resultCode;if(adyenAction&&component)return component.handleAction(adyenAction),!1;if(["Authorised","Pending","Received"].includes(resultCode))return placeOrderButtonRef?.current!=null&&(placeOrderButtonRef.current.disabled&&(placeOrderButtonRef.current.disabled=!1),placeOrderButtonRef.current.click()),!0;if(["Cancelled","Refused"].includes(resultCode)){const message=pSource?.payment_response?.refusalReason;setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}]),component&&component.mount("#adyen-dropin")}return!1}catch(error){return console.error("Adyen additional details error:",error),!1}},onSubmit=async(state,component)=>{const saveCustomer=document.getElementById("save_payment_source_to_customer_wallet"),url=cleanUrlBy(),shopperIp=await getPublicIP();let control=await setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments"});if(control?.payment_response?.resultCode==="Authorised")return!0;const paymentDataAvailable=Object.keys(control?.payment_request_data).length>0,paymentMethodSelected=control?.payment_request_data?.payment_method?.type,paymentMethod=saveCustomer?.checked?state.data.paymentMethod:omit(state.data.paymentMethod,["encryptedCardNumber","encryptedExpiryMonth","encryptedExpiryYear"]);(!paymentDataAvailable||paymentMethodSelected!==state.data.paymentMethod.type)&&(control=await setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes:{payment_request_data:{...state.data,payment_method:paymentMethod,return_url:url,origin:window.location.origin,redirect_from_issuer_method:"GET",shopper_ip:shopperIp}}}));const attributes={payment_request_data:{...state.data,payment_method:paymentMethod,return_url:url,origin:window.location.origin,redirect_from_issuer_method:"GET",shopper_ip:shopperIp},_authorize:1};delete attributes.payment_request_data.paymentMethod;try{const res=await setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes}),action=res?.payment_response?.action;if(component&&action)return component.handleAction(action),!1;const resultCode=res?.payment_response?.resultCode;if(["Authorised","Pending","Received"].includes(resultCode))return placeOrderButtonRef?.current!=null&&(placeOrderButtonRef.current.disabled&&(placeOrderButtonRef.current.disabled=!1),placeOrderButtonRef.current.click()),!0;if(["Cancelled","Refused"].includes(resultCode)){const message=res?.payment_response?.refusalReason;setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}]),component&&component.mount("#adyen-dropin")}if(res?.payment_response?.errorType)if(res?.payment_response?.errorCode==="14_006")onSubmit(state,component);else{const message=res?.payment_response?.message;setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}])}return!1}catch(error){return setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:error.message}]),!1}};return useEffect(()=>{const paymentMethodsResponse={paymentMethods:paymentSource?.payment_methods?.paymentMethods?paymentSource?.payment_methods.paymentMethods:[],storedPaymentMethods:paymentSource?.payment_methods?.storedPaymentMethods?paymentSource?.payment_methods.storedPaymentMethods:[]},[firstPaymentMethod]=paymentMethodsResponse.paymentMethods,isOnlyCard=paymentMethodsResponse.paymentMethods?.length===1&&firstPaymentMethod.type==="scheme";paymentMethodsResponse.paymentMethods.length===0&&console.error("Payment methods are not available. Please, check your Adyen configuration.");const showStoredPaymentMethods=paymentSource?.payment_methods?.storedPaymentMethods!=null,options={locale:order?.language_code??locale,environment,clientKey,amount:{currency:order?.currency_code||"",value:order?.total_amount_with_taxes_cents||0},countryCode:order?.country_code||"",paymentMethodsResponse,showPayButton:!1,paymentMethodsConfiguration:{showStoredPaymentMethods,paypal:{showPayButton:!0,style:styles?.paypal,...config?.paymentMethodsConfiguration?.paypal},card:{enableStoreDetails:showStoredPaymentMethods,styles:styles?.card,holderNameRequired:!1,...config?.paymentMethodsConfiguration?.card},...config?.paymentMethodsConfiguration},onAdditionalDetails:(state,element)=>{handleOnAdditionalDetails(state,element)},onChange:(state,element)=>{handleChange(state,element)},onSubmit:(state,element)=>{onSubmit(state,element)}};return!ref&&clientKey&&setCustomerOrderParam("_save_payment_source_to_customer_wallet","false"),clientKey&&!loadAdyen&&window&&!checkout&&import("@adyen/adyen-web").then(({default:AdyenCheckout})=>{const type=isOnlyCard?"card":"dropin";AdyenCheckout(options).then(adyenCheckout=>{const component=adyenCheckout.create(type,{showRemovePaymentMethodButton:showStoredPaymentMethods,instantPaymentTypes:["applepay","googlepay"],onSelect:component2=>{const id=component2._id;id.search("scheme")===-1&&ref.current&&(id.search("paypal")===-1?ref.current.onsubmit=async()=>await handleSubmit(ref.current,component2):ref.current.onsubmit=null,setPaymentRef({ref}))}}).mount("#adyen-dropin");component&&(setCheckout(component),setLoadAdyen(!0))})}),()=>{setPaymentRef({ref:{current:null}}),setLoadAdyen(!1)}},[clientKey,ref!=null]),!clientKey&&!loadAdyen&&!checkout?null:_jsxs("form",{ref,onSubmit:e=>{handleSubmit(e,checkout)},children:[_jsx("div",{className:cardContainerClassName,id:"adyen-dropin"}),templateCustomerSaveToWallet&&_jsx(Parent,{name:"save_payment_source_to_customer_wallet",children:templateCustomerSaveToWallet}),_jsx("div",{className:threeDSecureContainerClassName,id:"adyen-action"})]})}export default AdyenPayment;
|
|
@@ -16,6 +16,10 @@ export interface BraintreeConfig {
|
|
|
16
16
|
inputWrapperClassName?: string;
|
|
17
17
|
fields?: BraintreeHostedFields<HostedFieldFieldOptions>;
|
|
18
18
|
styles?: Record<string, Record<string, string>>;
|
|
19
|
+
/**
|
|
20
|
+
* Force challenge request for 3D Secure authentication. Default is true.
|
|
21
|
+
*/
|
|
22
|
+
challengeRequested?: boolean;
|
|
19
23
|
}
|
|
20
24
|
interface Props {
|
|
21
25
|
authorization: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext,useEffect,useRef,useState}from"react";import PaymentMethodContext from"../../context/PaymentMethodContext";import isEmpty from"lodash/isEmpty";import OrderContext from"../../context/OrderContext";import Parent from"../utils/Parent";import{setCustomerOrderParam}from"../../utils/localStorage";import promisify from"../../utils/promisify";const defaultConfig={styles:{input:{"font-size":"16px",color:"#3A3A3A"},".number":{"font-family":"monospace"},":focus":{color:"blue"},".valid":{color:"green"},".invalid":{color:"red"},"@media screen and (max-width: 700px)":{input:{"font-size":"14px"}}},fields:{number:{label:"Card Number",selector:"#card-number",placeholder:"4111 1111 1111 1111"},cvv:{label:"CVV",selector:"#cvv",placeholder:"123"},expirationDate:{label:"Expiration Date",selector:"#expiration-date",placeholder:"10/2022"}},submitLabel:"Set payment method"};export function BraintreePayment({authorization,config,templateCustomerSaveToWallet}){const{fields,styles,containerClassName,cardContainerClassName,fieldsContainerClassName,expDateContainerClassName,fieldLabelClassName,cvvContainerClassName,inputWrapperClassName,cardDetailsContainerClassName}={...defaultConfig,...config},[loadBraintree,setLoadBraintree]=useState(!1),{setPaymentSource,paymentSource,setPaymentMethodErrors,currentPaymentMethodType,setPaymentRef}=useContext(PaymentMethodContext),{order}=useContext(OrderContext),ref=useRef(null),handleSubmitForm=async({event,hostedFieldsInstance,threeDSInstance})=>{const savePaymentSourceToCustomerWallet=event?.elements?.save_payment_source_to_customer_wallet?.checked;if(savePaymentSourceToCustomerWallet&&setCustomerOrderParam("_save_payment_source_to_customer_wallet",savePaymentSourceToCustomerWallet),hostedFieldsInstance)try{const payload=await promisify(hostedFieldsInstance).then(payload2=>payload2),billingAddress=order?.billing_address,verifyCardOptions={nonce:payload.nonce,bin:payload.details.bin,amount:`${order?.total_amount_with_taxes_float}`,email:order?.customer_email??"",billingAddress:{givenName:billingAddress?.first_name??"",surname:billingAddress?.last_name??"",phoneNumber:billingAddress?.phone,streetAddress:billingAddress?.line_1,countryCodeAlpha2:billingAddress?.country_code,postalCode:billingAddress?.zip_code??"",region:billingAddress?.state_code,locality:billingAddress?.city},onLookupComplete:(_data,next)=>{next()}},response=await threeDSInstance.verifyCard(verifyCardOptions),validStatus=response?.liabilityShiftPossible===!0&&response?.liabilityShifted===!0;if(console.log("validStatus",validStatus),validStatus&&paymentSource!=null)return await setPaymentSource({paymentSourceId:paymentSource.id,paymentResource:"braintree_payments",attributes:{payment_method_nonce:response.nonce,options:{id:response.nonce,card:{last4:response.details.lastFour,exp_year:response.details.expirationYear,exp_month:response.details.expirationMonth,brand:response.details.cardType.toLowerCase()}}}}),!0;throw new Error(`3D Secure authentication failed - ${response?.threeDSecureInfo?.status}`)}catch(error){return console.error(error),setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:error.message}]),!1}return!1};return useEffect(()=>{if(!ref&&authorization&&setCustomerOrderParam("_save_payment_source_to_customer_wallet","false"),authorization&&!loadBraintree&&!isEmpty(window)){const braintreeClient=require("braintree-web/client"),hostedFields=require("braintree-web/hosted-fields"),threeDSecure=require("braintree-web/three-d-secure");braintreeClient.create({authorization},(clientErr,clientInstance)=>{if(clientErr){console.error(clientErr);return}hostedFields.create({client:clientInstance,fields,styles},(hostedFieldsErr,hostedFieldsInstance)=>{if(hostedFieldsErr){console.error(hostedFieldsErr);return}setLoadBraintree(!0),threeDSecure.create({authorization,version:2},(threeDSecureErr,threeDSInstance)=>{threeDSecureErr&&(console.error("3DSecure error",threeDSecureErr),setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:threeDSecureErr.message}])),ref.current&&(ref.current.onsubmit=async paymentSource2=>await handleSubmitForm({event:ref.current,hostedFieldsInstance,threeDSInstance,paymentSource:paymentSource2}),setPaymentRef({ref}))})})})}return()=>{setPaymentRef({ref:{current:null}}),setLoadBraintree(!1)}},[authorization,ref]),!authorization&&!loadBraintree?null:_jsx("div",{className:containerClassName,children:_jsxs("form",{ref,id:"braintree-form",onSubmit:handleSubmitForm,className:containerClassName,children:[_jsxs("div",{className:fieldsContainerClassName,children:[_jsxs("div",{className:cardContainerClassName,children:[_jsx("label",{className:fieldLabelClassName,htmlFor:"card-number",children:fields?.number?.label}),_jsx("div",{className:inputWrapperClassName,id:"card-number"})]}),_jsxs("div",{className:cardDetailsContainerClassName,children:[_jsxs("div",{className:expDateContainerClassName,children:[_jsx("label",{className:fieldLabelClassName,htmlFor:"expiration-date",children:fields?.expirationDate?.label}),_jsx("div",{className:inputWrapperClassName,id:"expiration-date"})]}),_jsxs("div",{className:cvvContainerClassName,children:[_jsx("label",{className:fieldLabelClassName,htmlFor:"cvv",children:fields?.cvv?.label}),_jsx("div",{className:inputWrapperClassName,id:"cvv"})]})]})]}),_jsx("div",{className:fieldsContainerClassName,children:templateCustomerSaveToWallet&&_jsx(Parent,{name:"save_payment_source_to_customer_wallet",children:templateCustomerSaveToWallet})})]})})}export default BraintreePayment;
|
|
2
|
+
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import{useContext,useEffect,useRef,useState}from"react";import PaymentMethodContext from"../../context/PaymentMethodContext";import isEmpty from"lodash/isEmpty";import OrderContext from"../../context/OrderContext";import Parent from"../utils/Parent";import{setCustomerOrderParam}from"../../utils/localStorage";import promisify from"../../utils/promisify";const defaultConfig={styles:{input:{"font-size":"16px",color:"#3A3A3A"},".number":{"font-family":"monospace"},":focus":{color:"blue"},".valid":{color:"green"},".invalid":{color:"red"},"@media screen and (max-width: 700px)":{input:{"font-size":"14px"}}},fields:{number:{label:"Card Number",selector:"#card-number",placeholder:"4111 1111 1111 1111"},cvv:{label:"CVV",selector:"#cvv",placeholder:"123"},expirationDate:{label:"Expiration Date",selector:"#expiration-date",placeholder:"10/2022"}},submitLabel:"Set payment method"};export function BraintreePayment({authorization,config,templateCustomerSaveToWallet}){const{fields,styles,containerClassName,cardContainerClassName,fieldsContainerClassName,expDateContainerClassName,fieldLabelClassName,cvvContainerClassName,inputWrapperClassName,cardDetailsContainerClassName}={...defaultConfig,...config},[loadBraintree,setLoadBraintree]=useState(!1),{setPaymentSource,paymentSource,setPaymentMethodErrors,currentPaymentMethodType,setPaymentRef}=useContext(PaymentMethodContext),{order}=useContext(OrderContext),ref=useRef(null),handleSubmitForm=async({event,hostedFieldsInstance,threeDSInstance})=>{const savePaymentSourceToCustomerWallet=event?.elements?.save_payment_source_to_customer_wallet?.checked;if(savePaymentSourceToCustomerWallet&&setCustomerOrderParam("_save_payment_source_to_customer_wallet",savePaymentSourceToCustomerWallet),hostedFieldsInstance)try{const payload=await promisify(hostedFieldsInstance).then(payload2=>payload2),billingAddress=order?.billing_address,verifyCardOptions={nonce:payload.nonce,bin:payload.details.bin,amount:`${order?.total_amount_with_taxes_float}`,email:order?.customer_email??"",billingAddress:{givenName:billingAddress?.first_name??"",surname:billingAddress?.last_name??"",phoneNumber:billingAddress?.phone,streetAddress:billingAddress?.line_1,countryCodeAlpha2:billingAddress?.country_code,postalCode:billingAddress?.zip_code??"",region:billingAddress?.state_code,locality:billingAddress?.city},onLookupComplete:(_data,next)=>{next()}},response=await threeDSInstance.verifyCard(verifyCardOptions),validStatus=response?.liabilityShiftPossible===!0&&response?.liabilityShifted===!0;if(console.log("validStatus",validStatus),validStatus&&paymentSource!=null)return await setPaymentSource({paymentSourceId:paymentSource.id,paymentResource:"braintree_payments",attributes:{payment_method_nonce:response.nonce,options:{id:response.nonce,card:{last4:response.details.lastFour,exp_year:response.details.expirationYear,exp_month:response.details.expirationMonth,brand:response.details.cardType.toLowerCase()}}}}),!0;throw new Error(`3D Secure authentication failed - ${response?.threeDSecureInfo?.status}`)}catch(error){return console.error(error),setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:error.message}]),!1}return!1};return useEffect(()=>{if(!ref&&authorization&&setCustomerOrderParam("_save_payment_source_to_customer_wallet","false"),authorization&&!loadBraintree&&!isEmpty(window)){const braintreeClient=require("braintree-web/client"),hostedFields=require("braintree-web/hosted-fields"),threeDSecure=require("braintree-web/three-d-secure");braintreeClient.create({authorization,challengeRequested:config?.challengeRequested??!0},(clientErr,clientInstance)=>{if(clientErr){console.error(clientErr);return}hostedFields.create({client:clientInstance,fields,styles},(hostedFieldsErr,hostedFieldsInstance)=>{if(hostedFieldsErr){console.error(hostedFieldsErr);return}setLoadBraintree(!0),threeDSecure.create({authorization,version:2},(threeDSecureErr,threeDSInstance)=>{threeDSecureErr&&(console.error("3DSecure error",threeDSecureErr),setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:threeDSecureErr.message}])),ref.current&&(ref.current.onsubmit=async paymentSource2=>await handleSubmitForm({event:ref.current,hostedFieldsInstance,threeDSInstance,paymentSource:paymentSource2}),setPaymentRef({ref}))})})})}return()=>{setPaymentRef({ref:{current:null}}),setLoadBraintree(!1)}},[authorization,ref]),!authorization&&!loadBraintree?null:_jsx("div",{className:containerClassName,children:_jsxs("form",{ref,id:"braintree-form",onSubmit:handleSubmitForm,className:containerClassName,children:[_jsxs("div",{className:fieldsContainerClassName,children:[_jsxs("div",{className:cardContainerClassName,children:[_jsx("label",{className:fieldLabelClassName,htmlFor:"card-number",children:fields?.number?.label}),_jsx("div",{className:inputWrapperClassName,id:"card-number"})]}),_jsxs("div",{className:cardDetailsContainerClassName,children:[_jsxs("div",{className:expDateContainerClassName,children:[_jsx("label",{className:fieldLabelClassName,htmlFor:"expiration-date",children:fields?.expirationDate?.label}),_jsx("div",{className:inputWrapperClassName,id:"expiration-date"})]}),_jsxs("div",{className:cvvContainerClassName,children:[_jsx("label",{className:fieldLabelClassName,htmlFor:"cvv",children:fields?.cvv?.label}),_jsx("div",{className:inputWrapperClassName,id:"cvv"})]})]})]}),_jsx("div",{className:fieldsContainerClassName,children:templateCustomerSaveToWallet&&_jsx(Parent,{name:"save_payment_source_to_customer_wallet",children:templateCustomerSaveToWallet})})]})})}export default BraintreePayment;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{createContext}from"react";
|
|
2
|
+
import{createContext}from"react";export const callExternalFunction=async({url,data})=>{const response=await fetch(url,{method:"POST",body:JSON.stringify(data),headers:{"Content-Type":"application/json"}});if(!response.ok)throw new Error("Failed to call external function");return await response.json()};const ExternalFunctionContext=createContext({url:null,callExternalFunction});export default ExternalFunctionContext;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercelayer/react-components",
|
|
3
|
-
"version": "4.15.
|
|
3
|
+
"version": "4.15.10",
|
|
4
4
|
"description": "The Official Commerce Layer React Components",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -172,7 +172,6 @@
|
|
|
172
172
|
"@stripe/stripe-js": "^4.3.0",
|
|
173
173
|
"@tanstack/react-table": "^8.17.3",
|
|
174
174
|
"@types/iframe-resizer": "^3.5.13",
|
|
175
|
-
"axios": "^1.7.3",
|
|
176
175
|
"braintree-web": "^3.106.0",
|
|
177
176
|
"frames-react": "^1.1.2",
|
|
178
177
|
"iframe-resizer": "^4.4.5",
|