@commercelayer/react-components 4.17.0 → 4.18.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/lib/cjs/components/orders/PlaceOrderButton.js +1 -1
- package/lib/cjs/components/payment_gateways/AdyenGateway.js +1 -1
- package/lib/cjs/components/payment_methods/PaymentMethod.d.ts +5 -1
- package/lib/cjs/components/payment_methods/PaymentMethod.js +1 -1
- package/lib/cjs/components/payment_source/AdyenPayment.d.ts +44 -11
- package/lib/cjs/components/payment_source/AdyenPayment.js +1 -1
- package/lib/cjs/reducers/PlaceOrderReducer.js +1 -1
- package/lib/cjs/utils/payment-methods/sortPaymentMethods.d.ts +2 -0
- package/lib/cjs/utils/payment-methods/sortPaymentMethods.js +2 -0
- package/lib/esm/components/orders/PlaceOrderButton.js +1 -1
- package/lib/esm/components/payment_gateways/AdyenGateway.js +1 -1
- package/lib/esm/components/payment_methods/PaymentMethod.d.ts +5 -1
- package/lib/esm/components/payment_methods/PaymentMethod.js +1 -1
- package/lib/esm/components/payment_source/AdyenPayment.d.ts +44 -11
- package/lib/esm/components/payment_source/AdyenPayment.js +1 -1
- package/lib/esm/reducers/PlaceOrderReducer.js +1 -1
- package/lib/esm/utils/payment-methods/sortPaymentMethods.d.ts +2 -0
- package/lib/esm/utils/payment-methods/sortPaymentMethods.js +2 -0
- package/lib/tsconfig.prod.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +12 -12
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PlaceOrderButton=PlaceOrderButton;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),PlaceOrderContext_1=tslib_1.__importDefault(require("../../context/PlaceOrderContext")),isFunction_1=tslib_1.__importDefault(require("lodash/isFunction")),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),getCardDetails_1=tslib_1.__importDefault(require("../../utils/getCardDetails")),retrievePaymentIntent_1=require("../../utils/stripe/retrievePaymentIntent");function PlaceOrderButton(props){var _a,_b,_c,_d;const ref=(0,react_1.useRef)(null),{children,label="Place order",loadingLabel="Placing...",autoPlaceOrder=!0,disabled,onClick}=props,p=tslib_1.__rest(props,["children","label","loadingLabel","autoPlaceOrder","disabled","onClick"]),{isPermitted,setPlaceOrder,options,paymentType,setButtonRef,setPlaceOrderStatus}=(0,react_1.useContext)(PlaceOrderContext_1.default),[notPermitted,setNotPermitted]=(0,react_1.useState)(!0),[forceDisable,setForceDisable]=(0,react_1.useState)(disabled),[isLoading,setIsLoading]=(0,react_1.useState)(!1),{currentPaymentMethodRef,loading,currentPaymentMethodType,paymentSource,setPaymentSource,setPaymentMethodErrors,currentCustomerPaymentSourceId}=(0,react_1.useContext)(PaymentMethodContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),isFree=order?.total_amount_with_taxes_cents===0;(0,react_1.useEffect)(()=>{var _a2;if(loading)setNotPermitted(loading);else if(paymentType===currentPaymentMethodType&&paymentType){const card=(0,getCardDetails_1.default)({customerPayment:{payment_source:paymentSource},paymentType});currentCustomerPaymentSourceId!=null&&paymentSource?.id===currentCustomerPaymentSourceId&&card.brand===""&&(card.brand="credit-card"),(isFree&&isPermitted||!((_a2=currentPaymentMethodRef?.current)===null||_a2===void 0)&&_a2.onsubmit||card.brand)&&isPermitted&&setNotPermitted(!1)}else setNotPermitted(!(isFree&&isPermitted));return()=>{setNotPermitted(!0)}},[isPermitted,paymentType,(_a=currentPaymentMethodRef?.current)===null||_a===void 0?void 0:_a.onsubmit,loading,currentPaymentMethodType,order,paymentSource]),(0,react_1.useEffect)(()=>{paymentType==="paypal_payments"&&options?.paypalPayerId&&order?.status&&["draft","pending"].includes(order?.status)&&autoPlaceOrder&&handleClick()},[options?.paypalPayerId,paymentType]),(0,react_1.useEffect)(()=>{var _a2,_b2,_c2,_d2;if(paymentType==="stripe_payments"&&(!((_a2=options?.stripe)===null||_a2===void 0)&&_a2.paymentIntentClientSecret)&&(!((_b2=order?.payment_source)===null||_b2===void 0)&&_b2.publishable_key)&&order?.status&&["draft","pending"].includes(order?.status)&&autoPlaceOrder){const publicApiKey=(_c2=order?.payment_source)===null||_c2===void 0?void 0:_c2.publishable_key,paymentIntentClientSecret=(_d2=options?.stripe)===null||_d2===void 0?void 0:_d2.paymentIntentClientSecret,getPaymentIntent=()=>tslib_1.__awaiter(this,void 0,void 0,function*(){const paymentIntentResult=yield(0,retrievePaymentIntent_1.checkPaymentIntent)({publicApiKey,paymentIntentClientSecret});switch(paymentIntentResult.status){case"valid":handleClick();break;case"processing":setTimeout(()=>{getPaymentIntent()},1e3);break;case"invalid":setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:paymentIntentResult.message}]);break}});getPaymentIntent()}},[((_b=options?.stripe)===null||_b===void 0?void 0:_b.paymentIntentClientSecret)!=null,paymentType!=null,order?.payment_source!=null]),(0,react_1.useEffect)(()=>{var _a2,_b2,_c2,_d2,_e,_f,_g,_h,_j,_k,_l,_m;if(order?.status!=null&&["draft","pending"].includes(order?.status)){const resultCode=((_b2=(_a2=order?.payment_source)===null||_a2===void 0?void 0:_a2.payment_response)===null||_b2===void 0?void 0:_b2.resultCode)==="Authorised",paymentDetails=((_d2=(_c2=order?.payment_source)===null||_c2===void 0?void 0:_c2.payment_request_details)===null||_d2===void 0?void 0:_d2.details)!=null;if(paymentType==="adyen_payments"&&(!((_e=options?.adyen)===null||_e===void 0)&&_e.redirectResult)&&!paymentDetails){const attributes={payment_request_details:{details:{redirectResult:(_f=options?.adyen)===null||_f===void 0?void 0:_f.redirectResult}},_details:1};setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes}).then(res=>{var _a3,_b3,_c3;const resultCode2=(_a3=res?.payment_response)===null||_a3===void 0?void 0:_a3.resultCode,errorCode=(_b3=res?.payment_response)===null||_b3===void 0?void 0:_b3.errorCode,message=(_c3=res?.payment_response)===null||_c3===void 0?void 0:_c3.message;["Authorised","Pending","Received"].includes(resultCode2)&&autoPlaceOrder?handleClick():errorCode!=null&&setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}])})}else(paymentType==="adyen_payments"&&(!((_g=options?.adyen)===null||_g===void 0)&&_g.MD)&&(!((_h=options?.adyen)===null||_h===void 0)&&_h.PaRes)&&autoPlaceOrder||paymentType==="adyen_payments"&&resultCode&&((_j=ref?.current)===null||_j===void 0?void 0:_j.disabled)===!1&¤tCustomerPaymentSourceId==null&&autoPlaceOrder&&!((_m=(_l=(_k=order?.payment_source)===null||_k===void 0?void 0:_k.payment_response)===null||_l===void 0?void 0:_l.merchantReference)===null||_m===void 0)&&_m.includes(order?.number))&&handleClick()}},[options?.adyen,paymentType,(_d=(_c=order?.payment_source)===null||_c===void 0?void 0:_c.payment_response)===null||_d===void 0?void 0:_d.resultCode]),(0,react_1.useEffect)(()=>{var _a2;paymentType==="checkout_com_payments"&&(!((_a2=options?.checkoutCom)===null||_a2===void 0)&&_a2.session_id)&&order?.status&&["draft","pending"].includes(order?.status)&&autoPlaceOrder&&handleClick()},[options?.checkoutCom,paymentType]),(0,react_1.useEffect)(()=>{ref?.current!=null&&setButtonRef!=null&&setButtonRef(ref)},[ref]);const handleClick=e=>tslib_1.__awaiter(this,void 0,void 0,function*(){var _a2,_b2,_c2,_d2,_e;e?.preventDefault(),e?.stopPropagation(),setIsLoading(!0);let isValid=!0;setForceDisable(!0);const checkPaymentSource=paymentType!=="stripe_payments"?yield setPaymentSource({paymentResource:paymentType,paymentSourceId:paymentSource?.id}):paymentSource,card=paymentType&&(0,getCardDetails_1.default)({paymentType,customerPayment:{payment_source:checkPaymentSource}});!((_a2=currentPaymentMethodRef?.current)===null||_a2===void 0)&&_a2.onsubmit&&[!options?.paypalPayerId,!(!((_b2=options?.adyen)===null||_b2===void 0)&&_b2.MD),!(!((_c2=options?.checkoutCom)===null||_c2===void 0)&&_c2.session_id)].every(Boolean)?(isValid=yield(_d2=currentPaymentMethodRef.current)===null||_d2===void 0?void 0:_d2.onsubmit({paymentSource:checkPaymentSource,setPlaceOrder,onclickCallback:onClick}),!isValid&&((_e=checkPaymentSource?.payment_response)===null||_e===void 0?void 0:_e.resultCode)==="Authorised"&&(isValid=!0)):card?.brand&&(isValid=!0),isValid&&setPlaceOrderStatus!=null&&setPlaceOrderStatus({status:"placing"});const placed=isValid&&setPlaceOrder&&(checkPaymentSource||isFree)&&(yield setPlaceOrder({paymentSource:checkPaymentSource,currentCustomerPaymentSourceId}));setForceDisable(!1),onClick&&placed&&onClick(placed),setIsLoading(!1),setPlaceOrderStatus
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PlaceOrderButton=PlaceOrderButton;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),PlaceOrderContext_1=tslib_1.__importDefault(require("../../context/PlaceOrderContext")),isFunction_1=tslib_1.__importDefault(require("lodash/isFunction")),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),getCardDetails_1=tslib_1.__importDefault(require("../../utils/getCardDetails")),retrievePaymentIntent_1=require("../../utils/stripe/retrievePaymentIntent");function PlaceOrderButton(props){var _a,_b,_c,_d;const ref=(0,react_1.useRef)(null),{children,label="Place order",loadingLabel="Placing...",autoPlaceOrder=!0,disabled,onClick}=props,p=tslib_1.__rest(props,["children","label","loadingLabel","autoPlaceOrder","disabled","onClick"]),{isPermitted,setPlaceOrder,options,paymentType,setButtonRef,setPlaceOrderStatus,status}=(0,react_1.useContext)(PlaceOrderContext_1.default),[notPermitted,setNotPermitted]=(0,react_1.useState)(!0),[forceDisable,setForceDisable]=(0,react_1.useState)(disabled),[isLoading,setIsLoading]=(0,react_1.useState)(!1),{currentPaymentMethodRef,loading,currentPaymentMethodType,paymentSource,setPaymentSource,setPaymentMethodErrors,currentCustomerPaymentSourceId}=(0,react_1.useContext)(PaymentMethodContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),isFree=order?.total_amount_with_taxes_cents===0;(0,react_1.useEffect)(()=>{var _a2;if(loading)setNotPermitted(loading);else if(paymentType===currentPaymentMethodType&&paymentType){const card=(0,getCardDetails_1.default)({customerPayment:{payment_source:paymentSource},paymentType});currentCustomerPaymentSourceId!=null&&paymentSource?.id===currentCustomerPaymentSourceId&&card.brand===""&&(card.brand="credit-card"),(isFree&&isPermitted||!((_a2=currentPaymentMethodRef?.current)===null||_a2===void 0)&&_a2.onsubmit||card.brand)&&isPermitted&&setNotPermitted(!1)}else setNotPermitted(!(isFree&&isPermitted));return()=>{setNotPermitted(!0)}},[isPermitted,paymentType,(_a=currentPaymentMethodRef?.current)===null||_a===void 0?void 0:_a.onsubmit,loading,currentPaymentMethodType,order,paymentSource]),(0,react_1.useEffect)(()=>{paymentType==="paypal_payments"&&options?.paypalPayerId&&order?.status&&["draft","pending"].includes(order?.status)&&autoPlaceOrder&&handleClick()},[options?.paypalPayerId,paymentType]),(0,react_1.useEffect)(()=>{var _a2,_b2,_c2,_d2;if(paymentType==="stripe_payments"&&(!((_a2=options?.stripe)===null||_a2===void 0)&&_a2.paymentIntentClientSecret)&&(!((_b2=order?.payment_source)===null||_b2===void 0)&&_b2.publishable_key)&&order?.status&&["draft","pending"].includes(order?.status)&&autoPlaceOrder){const publicApiKey=(_c2=order?.payment_source)===null||_c2===void 0?void 0:_c2.publishable_key,paymentIntentClientSecret=(_d2=options?.stripe)===null||_d2===void 0?void 0:_d2.paymentIntentClientSecret,getPaymentIntent=()=>tslib_1.__awaiter(this,void 0,void 0,function*(){const paymentIntentResult=yield(0,retrievePaymentIntent_1.checkPaymentIntent)({publicApiKey,paymentIntentClientSecret});switch(paymentIntentResult.status){case"valid":handleClick();break;case"processing":setTimeout(()=>{getPaymentIntent()},1e3);break;case"invalid":setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:paymentIntentResult.message}]);break}});getPaymentIntent()}},[((_b=options?.stripe)===null||_b===void 0?void 0:_b.paymentIntentClientSecret)!=null,paymentType!=null,order?.payment_source!=null]),(0,react_1.useEffect)(()=>{var _a2,_b2,_c2,_d2,_e,_f,_g,_h,_j,_k,_l,_m;if(order?.status!=null&&["draft","pending"].includes(order?.status)){const resultCode=((_b2=(_a2=order?.payment_source)===null||_a2===void 0?void 0:_a2.payment_response)===null||_b2===void 0?void 0:_b2.resultCode)==="Authorised",paymentDetails=((_d2=(_c2=order?.payment_source)===null||_c2===void 0?void 0:_c2.payment_request_details)===null||_d2===void 0?void 0:_d2.details)!=null;if(paymentType==="adyen_payments"&&(!((_e=options?.adyen)===null||_e===void 0)&&_e.redirectResult)&&!paymentDetails){const attributes={payment_request_details:{details:{redirectResult:(_f=options?.adyen)===null||_f===void 0?void 0:_f.redirectResult}},_details:1};setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes}).then(res=>{var _a3,_b3,_c3;const resultCode2=(_a3=res?.payment_response)===null||_a3===void 0?void 0:_a3.resultCode,errorCode=(_b3=res?.payment_response)===null||_b3===void 0?void 0:_b3.errorCode,message=(_c3=res?.payment_response)===null||_c3===void 0?void 0:_c3.message;["Authorised","Pending","Received"].includes(resultCode2)&&autoPlaceOrder?handleClick():errorCode!=null&&setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}])})}else(paymentType==="adyen_payments"&&(!((_g=options?.adyen)===null||_g===void 0)&&_g.MD)&&(!((_h=options?.adyen)===null||_h===void 0)&&_h.PaRes)&&autoPlaceOrder||paymentType==="adyen_payments"&&resultCode&&((_j=ref?.current)===null||_j===void 0?void 0:_j.disabled)===!1&¤tCustomerPaymentSourceId==null&&autoPlaceOrder&&status==="standby"&&!((_m=(_l=(_k=order?.payment_source)===null||_k===void 0?void 0:_k.payment_response)===null||_l===void 0?void 0:_l.merchantReference)===null||_m===void 0)&&_m.includes(order?.number))&&handleClick()}},[options?.adyen,paymentType,(_d=(_c=order?.payment_source)===null||_c===void 0?void 0:_c.payment_response)===null||_d===void 0?void 0:_d.resultCode]),(0,react_1.useEffect)(()=>{var _a2;paymentType==="checkout_com_payments"&&(!((_a2=options?.checkoutCom)===null||_a2===void 0)&&_a2.session_id)&&order?.status&&["draft","pending"].includes(order?.status)&&autoPlaceOrder&&handleClick()},[options?.checkoutCom,paymentType]),(0,react_1.useEffect)(()=>{ref?.current!=null&&setButtonRef!=null&&setButtonRef(ref)},[ref]);const handleClick=e=>tslib_1.__awaiter(this,void 0,void 0,function*(){var _a2,_b2,_c2,_d2,_e;e?.preventDefault(),e?.stopPropagation(),setIsLoading(!0);let isValid=!0;setForceDisable(!0);const checkPaymentSource=paymentType!=="stripe_payments"?yield setPaymentSource({paymentResource:paymentType,paymentSourceId:paymentSource?.id}):paymentSource,card=paymentType&&(0,getCardDetails_1.default)({paymentType,customerPayment:{payment_source:checkPaymentSource}});!((_a2=currentPaymentMethodRef?.current)===null||_a2===void 0)&&_a2.onsubmit&&[!options?.paypalPayerId,!(!((_b2=options?.adyen)===null||_b2===void 0)&&_b2.MD),!(!((_c2=options?.checkoutCom)===null||_c2===void 0)&&_c2.session_id)].every(Boolean)?(isValid=yield(_d2=currentPaymentMethodRef.current)===null||_d2===void 0?void 0:_d2.onsubmit({paymentSource:checkPaymentSource,setPlaceOrder,onclickCallback:onClick}),!isValid&&((_e=checkPaymentSource?.payment_response)===null||_e===void 0?void 0:_e.resultCode)==="Authorised"&&(isValid=!0)):card?.brand&&(isValid=!0),isValid&&setPlaceOrderStatus!=null&&setPlaceOrderStatus({status:"placing"});const placed=isValid&&setPlaceOrder&&(checkPaymentSource||isFree)&&(yield setPlaceOrder({paymentSource:checkPaymentSource,currentCustomerPaymentSourceId}));placed&&setPlaceOrderStatus!=null?placed.placed?(setPlaceOrderStatus({status:"placing"}),onClick&&placed&&onClick(placed)):(setForceDisable(!1),onClick&&placed&&onClick(placed),setIsLoading(!1),setPlaceOrderStatus({status:"standby"})):(setForceDisable(!1),setIsLoading(!1))}),disabledButton=disabled!==void 0?disabled:notPermitted,labelButton=isLoading?loadingLabel:(0,isFunction_1.default)(label)?label():label,parentProps=Object.assign(Object.assign({},p),{label,disabled:disabledButton,handleClick,parentRef:ref,isLoading});return children?(0,jsx_runtime_1.jsx)(Parent_1.default,Object.assign({},parentProps,{children})):(0,jsx_runtime_1.jsx)("button",Object.assign({ref,type:"button",disabled:disabledButton||forceDisable,onClick:e=>{handleClick(e)}},p,{children:labelButton}))}exports.default=PlaceOrderButton;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AdyenGateway=AdyenGateway;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),PaymentSourceContext_1=tslib_1.__importDefault(require("../../context/PaymentSourceContext")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),react_1=require("react"),AdyenPayment_1=tslib_1.__importDefault(require("../payment_source/AdyenPayment")),PaymentCardsTemplate_1=tslib_1.__importDefault(require("../utils/PaymentCardsTemplate")),jwt_1=require("../../utils/jwt"),getCardDetails_1=tslib_1.__importDefault(require("../../utils/getCardDetails")),getPaymentAttributes_1=require("../../utils/getPaymentAttributes")
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AdyenGateway=AdyenGateway;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),PaymentSourceContext_1=tslib_1.__importDefault(require("../../context/PaymentSourceContext")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),react_1=require("react"),AdyenPayment_1=tslib_1.__importDefault(require("../payment_source/AdyenPayment")),PaymentCardsTemplate_1=tslib_1.__importDefault(require("../utils/PaymentCardsTemplate")),jwt_1=require("../../utils/jwt"),getCardDetails_1=tslib_1.__importDefault(require("../../utils/getCardDetails")),getPaymentAttributes_1=require("../../utils/getPaymentAttributes");function AdyenGateway(props){var _a,_b;const{readonly,showCard,handleEditClick,children,templateCustomerCards,loading,loaderComponent,templateCustomerSaveToWallet}=props,p=tslib_1.__rest(props,["readonly","showCard","handleEditClick","children","templateCustomerCards","loading","loaderComponent","templateCustomerSaveToWallet"]),{order}=(0,react_1.useContext)(OrderContext_1.default),{accessToken}=(0,react_1.useContext)(CommerceLayerContext_1.default),{payment}=(0,react_1.useContext)(PaymentMethodChildrenContext_1.default),{payments,isGuest}=(0,react_1.useContext)(CustomerContext_1.default),{currentPaymentMethodId,config,paymentSource}=(0,react_1.useContext)(PaymentMethodContext_1.default),paymentResource="adyen_payments",locale=order?.language_code;if(!readonly&&payment?.id!==currentPaymentMethodId)return null;const clientKey=paymentSource?.public_key,environment=accessToken&&(0,jwt_1.jwt)(accessToken).test?"test":"live",adyenConfig=(0,getPaymentAttributes_1.getPaymentAttributes)({resource:paymentResource,config:config??{},keys:["adyen_payments"]}),paymentConfig=adyenConfig?.adyenPayment,customerPayments=!(0,isEmpty_1.default)(payments)&&payments?payments.filter(customerPayment=>{var _a2;return((_a2=customerPayment.payment_source)===null||_a2===void 0?void 0:_a2.type)==="adyen_payments"||customerPayment.payment_method!=null}):[];if(readonly||showCard){const card=(0,getCardDetails_1.default)({customerPayment:{payment_source:paymentSource},paymentType:paymentResource}),value=Object.assign(Object.assign({},card),{showCard,handleEditClick,readonly});return(0,isEmpty_1.default)(card)?null:(0,jsx_runtime_1.jsx)(PaymentSourceContext_1.default.Provider,{value,children})}const hasStoredPaymentMethods=((_a=paymentSource?.payment_methods)===null||_a===void 0?void 0:_a.storedPaymentMethods)!=null&&((_b=paymentSource?.payment_methods)===null||_b===void 0?void 0:_b.storedPaymentMethods.length)>0;return!isGuest&&templateCustomerCards?(0,jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment,{children:[hasStoredPaymentMethods||(0,isEmpty_1.default)(customerPayments)?null:(0,jsx_runtime_1.jsx)("div",{className:p.className,children:(0,jsx_runtime_1.jsx)(PaymentCardsTemplate_1.default,{paymentResource,customerPayments,children:templateCustomerCards})}),(0,jsx_runtime_1.jsx)(AdyenPayment_1.default,{templateCustomerSaveToWallet,clientKey,locale,environment,config:paymentConfig})]}):(0,jsx_runtime_1.jsx)(AdyenPayment_1.default,{clientKey,locale,config:paymentConfig,environment})}exports.default=AdyenGateway;
|
|
@@ -30,6 +30,10 @@ type Props = {
|
|
|
30
30
|
* Enable express payment. Other payment methods will be disabled.
|
|
31
31
|
*/
|
|
32
32
|
expressPayments?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Sort payment methods by an array of strings
|
|
35
|
+
*/
|
|
36
|
+
sortBy?: Array<PaymentMethodType['payment_source_type']>;
|
|
33
37
|
} & Omit<JSX.IntrinsicElements['div'], 'onClick' | 'children'> & ({
|
|
34
38
|
clickableContainer: true;
|
|
35
39
|
onClick?: (params: PaymentMethodOnClickParams) => void;
|
|
@@ -37,5 +41,5 @@ type Props = {
|
|
|
37
41
|
clickableContainer?: never;
|
|
38
42
|
onClick?: never;
|
|
39
43
|
});
|
|
40
|
-
export declare function PaymentMethod({ children, className, activeClass, loader, clickableContainer, autoSelectSinglePaymentMethod, expressPayments, hide, onClick, ...p }: Props): JSX.Element;
|
|
44
|
+
export declare function PaymentMethod({ children, className, activeClass, loader, clickableContainer, autoSelectSinglePaymentMethod, expressPayments, hide, onClick, sortBy, ...p }: Props): JSX.Element;
|
|
41
45
|
export default PaymentMethod;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentMethod=PaymentMethod;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),getLoaderComponent_1=tslib_1.__importDefault(require("../../utils/getLoaderComponent")),useCustomContext_1=tslib_1.__importDefault(require("../../utils/hooks/useCustomContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),getPaymentAttributes_1=require("../../utils/getPaymentAttributes"),isEmpty_1=require("../../utils/isEmpty"),expressPaymentHelper_1=require("../../utils/expressPaymentHelper"),PlaceOrderContext_1=tslib_1.__importDefault(require("../../context/PlaceOrderContext"));let loadingResource=!1;function PaymentMethod(_a){var{children,className,activeClass,loader="Loading...",clickableContainer,autoSelectSinglePaymentMethod,expressPayments,hide,onClick}=_a,p=tslib_1.__rest(_a,["children","className","activeClass","loader","clickableContainer","autoSelectSinglePaymentMethod","expressPayments","hide","onClick"]);const[loading,setLoading]=(0,react_1.useState)(!0),[paymentSelected,setPaymentSelected]=(0,react_1.useState)(""),[paymentSourceCreated,setPaymentSourceCreated]=(0,react_1.useState)(!1),{paymentMethods,currentPaymentMethodId,setPaymentMethod,setLoading:setLoadingPlaceOrder,paymentSource,setPaymentSource,config}=(0,useCustomContext_1.default)({context:PaymentMethodContext_1.default,contextComponentName:"PaymentMethodsContainer",currentComponentName:"PaymentMethod",key:"paymentMethods"}),{order}=(0,react_1.useContext)(OrderContext_1.default),{getCustomerPaymentSources}=(0,react_1.useContext)(CustomerContext_1.default),{status}=(0,react_1.useContext)(PlaceOrderContext_1.default);(0,react_1.useEffect)(()=>{if(paymentMethods!=null&&!(0,isEmpty_1.isEmpty)(paymentMethods)&&expressPayments){const[paymentMethod]=(0,expressPaymentHelper_1.getAvailableExpressPayments)(paymentMethods);!paymentSource&&paymentMethod!=null&&tslib_1.__awaiter(this,void 0,void 0,function*(){setLoadingPlaceOrder({loading:!0}),setPaymentSelected(paymentMethod.id);const paymentMethodId=paymentMethod?.id,paymentResource=paymentMethod?.payment_source_type;yield setPaymentMethod({paymentResource,paymentMethodId});const ps=yield setPaymentSource({paymentResource,order});ps&&paymentMethod&&onClick!=null&&(onClick({payment:paymentMethod,order,paymentSource:ps}),setTimeout(()=>{setLoading(!1)},200)),setLoadingPlaceOrder({loading:!1})})}},[!(0,isEmpty_1.isEmpty)(paymentMethods),expressPayments]),(0,react_1.useEffect)(()=>{paymentMethods!=null&&!paymentSourceCreated&&!loadingResource&&!(0,isEmpty_1.isEmpty)(paymentMethods)&&(loadingResource=!0,autoSelectSinglePaymentMethod!=null&&!expressPayments&&tslib_1.__awaiter(this,void 0,void 0,function*(){if(paymentMethods.length===1){const[paymentMethod]=paymentMethods??[];if(paymentMethod&&!paymentSource){setLoadingPlaceOrder({loading:!0}),setPaymentSelected(paymentMethod.id);const paymentMethodId=paymentMethod?.id,paymentResource=paymentMethod?.payment_source_type;yield setPaymentMethod({paymentResource,paymentMethodId});let attributes={};config!=null&&paymentResource==="paypal_payments"&&(attributes=(0,getPaymentAttributes_1.getPaypalAttributes)(paymentResource,config)),config!=null&&paymentResource==="external_payments"&&(attributes=(0,getPaymentAttributes_1.getExternalPaymentAttributes)(paymentResource,config));const ps=yield setPaymentSource({paymentResource,order,attributes});ps&&paymentMethod&&onClick!=null&&(setPaymentSourceCreated(!0),onClick({payment:paymentMethod,order,paymentSource:ps}),setTimeout(()=>{setLoading(!1)},200)),getCustomerPaymentSources&&getCustomerPaymentSources(),setLoadingPlaceOrder({loading:!1})}typeof autoSelectSinglePaymentMethod=="function"&&autoSelectSinglePaymentMethod()}else setTimeout(()=>{setLoading(!1)},200)}))},[order?.payment_source!=null]),(0,react_1.useEffect)(()=>(paymentMethods&&(paymentMethods.length===1&&autoSelectSinglePaymentMethod?paymentSource&&setTimeout(()=>{setLoading(!1)},200):setLoading(!1)),currentPaymentMethodId&&setPaymentSelected(currentPaymentMethodId),()=>{setLoading(!0),setPaymentSelected("")}),[paymentMethods,currentPaymentMethodId]);const components=
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentMethod=PaymentMethod;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),getLoaderComponent_1=tslib_1.__importDefault(require("../../utils/getLoaderComponent")),useCustomContext_1=tslib_1.__importDefault(require("../../utils/hooks/useCustomContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),getPaymentAttributes_1=require("../../utils/getPaymentAttributes"),isEmpty_1=require("../../utils/isEmpty"),expressPaymentHelper_1=require("../../utils/expressPaymentHelper"),PlaceOrderContext_1=tslib_1.__importDefault(require("../../context/PlaceOrderContext")),sortPaymentMethods_1=require("../../utils/payment-methods/sortPaymentMethods");let loadingResource=!1;function PaymentMethod(_a){var{children,className,activeClass,loader="Loading...",clickableContainer,autoSelectSinglePaymentMethod,expressPayments,hide,onClick,sortBy}=_a,p=tslib_1.__rest(_a,["children","className","activeClass","loader","clickableContainer","autoSelectSinglePaymentMethod","expressPayments","hide","onClick","sortBy"]);const[loading,setLoading]=(0,react_1.useState)(!0),[paymentSelected,setPaymentSelected]=(0,react_1.useState)(""),[paymentSourceCreated,setPaymentSourceCreated]=(0,react_1.useState)(!1),{paymentMethods,currentPaymentMethodId,setPaymentMethod,setLoading:setLoadingPlaceOrder,paymentSource,setPaymentSource,config}=(0,useCustomContext_1.default)({context:PaymentMethodContext_1.default,contextComponentName:"PaymentMethodsContainer",currentComponentName:"PaymentMethod",key:"paymentMethods"}),{order}=(0,react_1.useContext)(OrderContext_1.default),{getCustomerPaymentSources}=(0,react_1.useContext)(CustomerContext_1.default),{status}=(0,react_1.useContext)(PlaceOrderContext_1.default);(0,react_1.useEffect)(()=>{if(paymentMethods!=null&&!(0,isEmpty_1.isEmpty)(paymentMethods)&&expressPayments){const[paymentMethod]=(0,expressPaymentHelper_1.getAvailableExpressPayments)(paymentMethods);!paymentSource&&paymentMethod!=null&&tslib_1.__awaiter(this,void 0,void 0,function*(){setLoadingPlaceOrder({loading:!0}),setPaymentSelected(paymentMethod.id);const paymentMethodId=paymentMethod?.id,paymentResource=paymentMethod?.payment_source_type;yield setPaymentMethod({paymentResource,paymentMethodId});const ps=yield setPaymentSource({paymentResource,order});ps&&paymentMethod&&onClick!=null&&(onClick({payment:paymentMethod,order,paymentSource:ps}),setTimeout(()=>{setLoading(!1)},200)),setLoadingPlaceOrder({loading:!1})})}},[!(0,isEmpty_1.isEmpty)(paymentMethods),expressPayments]),(0,react_1.useEffect)(()=>{paymentMethods!=null&&!paymentSourceCreated&&!loadingResource&&!(0,isEmpty_1.isEmpty)(paymentMethods)&&(loadingResource=!0,autoSelectSinglePaymentMethod!=null&&!expressPayments&&tslib_1.__awaiter(this,void 0,void 0,function*(){if(paymentMethods.length===1){const[paymentMethod]=paymentMethods??[];if(paymentMethod&&!paymentSource){setLoadingPlaceOrder({loading:!0}),setPaymentSelected(paymentMethod.id);const paymentMethodId=paymentMethod?.id,paymentResource=paymentMethod?.payment_source_type;yield setPaymentMethod({paymentResource,paymentMethodId});let attributes={};config!=null&&paymentResource==="paypal_payments"&&(attributes=(0,getPaymentAttributes_1.getPaypalAttributes)(paymentResource,config)),config!=null&&paymentResource==="external_payments"&&(attributes=(0,getPaymentAttributes_1.getExternalPaymentAttributes)(paymentResource,config));const ps=yield setPaymentSource({paymentResource,order,attributes});ps&&paymentMethod&&onClick!=null&&(setPaymentSourceCreated(!0),onClick({payment:paymentMethod,order,paymentSource:ps}),setTimeout(()=>{setLoading(!1)},200)),getCustomerPaymentSources&&getCustomerPaymentSources(),setLoadingPlaceOrder({loading:!1})}typeof autoSelectSinglePaymentMethod=="function"&&autoSelectSinglePaymentMethod()}else setTimeout(()=>{setLoading(!1)},200)}))},[!(0,isEmpty_1.isEmpty)(paymentMethods),order?.payment_source!=null]),(0,react_1.useEffect)(()=>(paymentMethods&&(paymentMethods.length===1&&autoSelectSinglePaymentMethod?paymentSource&&setTimeout(()=>{setLoading(!1)},200):setLoading(!1)),currentPaymentMethodId&&setPaymentSelected(currentPaymentMethodId),()=>{setLoading(!0),setPaymentSelected("")}),[paymentMethods,currentPaymentMethodId]);const sortedPaymentMethods=paymentMethods!=null&&sortBy!=null?(0,sortPaymentMethods_1.sortPaymentMethods)(paymentMethods,sortBy):paymentMethods,components=sortedPaymentMethods?.filter(payment=>{if(Array.isArray(hide)){const source=payment?.payment_source_type;return!hide?.includes(source)}else if(typeof hide=="function")return hide(payment);return!0}).map((payment,k)=>{const isActive=currentPaymentMethodId===payment?.id,paymentMethodProps={payment,clickableContainer,paymentSelected,setPaymentSelected,expressPayments},paymentResource=payment?.payment_source_type,onClickable=clickableContainer?e=>tslib_1.__awaiter(this,void 0,void 0,function*(){var _a2;e.stopPropagation();const paymentMethodId=payment?.id,currentPaymentMethodId2=(_a2=order?.payment_method)===null||_a2===void 0?void 0:_a2.id;if(paymentMethodId===currentPaymentMethodId2||status==="placing")return;setLoadingPlaceOrder({loading:!0}),setPaymentSelected(payment.id);const{order:updatedOrder}=yield setPaymentMethod({paymentResource,paymentMethodId});onClick&&onClick({payment,order:updatedOrder}),setLoadingPlaceOrder({loading:!1})}):void 0;return(0,jsx_runtime_1.jsx)("div",Object.assign({"data-testid":paymentResource,className:`${className??""} ${isActive&&activeClass!=null?activeClass:""}`,onClick:e=>{onClickable?.(e)}},p,{children:(0,jsx_runtime_1.jsx)(PaymentMethodChildrenContext_1.default.Provider,{value:paymentMethodProps,children})}),k)});return loading?(0,getLoaderComponent_1.default)(loader):(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:components})}exports.default=PaymentMethod;
|
|
@@ -1,12 +1,44 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type JSX } from 'react';
|
|
2
2
|
import { type PaymentSourceProps } from './PaymentSource';
|
|
3
|
-
import type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
import { type CoreConfiguration, type DropinConfiguration } from '@adyen/adyen-web/auto';
|
|
4
|
+
interface StyleDefinitions {
|
|
5
|
+
background?: string;
|
|
6
|
+
caretColor?: string;
|
|
7
|
+
color?: string;
|
|
8
|
+
display?: string;
|
|
9
|
+
font?: string;
|
|
10
|
+
fontFamily?: string;
|
|
11
|
+
fontSize?: string;
|
|
12
|
+
fontSizeAdjust?: string;
|
|
13
|
+
fontSmoothing?: string;
|
|
14
|
+
fontStretch?: string;
|
|
15
|
+
fontStyle?: string;
|
|
16
|
+
fontVariant?: string;
|
|
17
|
+
fontVariantAlternates?: string;
|
|
18
|
+
fontVariantCaps?: string;
|
|
19
|
+
fontVariantEastAsian?: string;
|
|
20
|
+
fontVariantLigatures?: string;
|
|
21
|
+
fontVariantNumeric?: string;
|
|
22
|
+
fontWeight?: string;
|
|
23
|
+
letterSpacing?: string;
|
|
24
|
+
lineHeight?: string;
|
|
25
|
+
mozOsxFontSmoothing?: string;
|
|
26
|
+
mozTransition?: string;
|
|
27
|
+
outline?: string;
|
|
28
|
+
opacity?: string;
|
|
29
|
+
padding?: string;
|
|
30
|
+
textAlign?: string;
|
|
31
|
+
textShadow?: string;
|
|
32
|
+
transition?: string;
|
|
33
|
+
webkitFontSmoothing?: string;
|
|
34
|
+
webkitTransition?: string;
|
|
35
|
+
wordSpacing?: string;
|
|
36
|
+
}
|
|
37
|
+
interface Styles {
|
|
38
|
+
error?: StyleDefinitions;
|
|
39
|
+
placeholder?: StyleDefinitions;
|
|
40
|
+
validated?: StyleDefinitions;
|
|
41
|
+
}
|
|
10
42
|
type PaypalStyle = Partial<{
|
|
11
43
|
/**
|
|
12
44
|
* @see {@link https://developer.paypal.com/docs/checkout/integration-features/customize-button/#color}
|
|
@@ -47,6 +79,7 @@ export interface AdyenPaymentConfig {
|
|
|
47
79
|
cardContainerClassName?: string;
|
|
48
80
|
/**
|
|
49
81
|
* Optional CSS class name for the 3D Secure container.
|
|
82
|
+
* @deprecated
|
|
50
83
|
*/
|
|
51
84
|
threeDSecureContainerClassName?: string;
|
|
52
85
|
/**
|
|
@@ -63,7 +96,7 @@ export interface AdyenPaymentConfig {
|
|
|
63
96
|
/**
|
|
64
97
|
* Configuration options for the payment methods.
|
|
65
98
|
*/
|
|
66
|
-
paymentMethodsConfiguration?:
|
|
99
|
+
paymentMethodsConfiguration?: DropinConfiguration['paymentMethodsConfiguration'];
|
|
67
100
|
/**
|
|
68
101
|
* Callback function to disable a stored payment method.
|
|
69
102
|
* @param props - An object containing the recurring detail reference and shopper reference.
|
|
@@ -78,8 +111,8 @@ interface Props {
|
|
|
78
111
|
clientKey?: string;
|
|
79
112
|
config?: AdyenPaymentConfig;
|
|
80
113
|
templateCustomerSaveToWallet?: PaymentSourceProps['templateCustomerSaveToWallet'];
|
|
81
|
-
locale?:
|
|
82
|
-
environment?:
|
|
114
|
+
locale?: CoreConfiguration['locale'];
|
|
115
|
+
environment?: CoreConfiguration['environment'];
|
|
83
116
|
}
|
|
84
117
|
export declare function AdyenPayment({ clientKey, config, templateCustomerSaveToWallet, environment, locale }: Props): JSX.Element | null;
|
|
85
118
|
export default AdyenPayment;
|
|
@@ -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")),getPublicIp_1=require("../../utils/getPublicIp"),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),defaultConfig={};function AdyenPayment({clientKey,config,templateCustomerSaveToWallet,environment="test",locale="en_US"}){const{cardContainerClassName,
|
|
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"),auto_1=require("@adyen/adyen-web/auto"),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")),getPublicIp_1=require("../../utils/getPublicIp"),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),defaultConfig={};function AdyenPayment({clientKey,config,templateCustomerSaveToWallet,environment="test",locale="en_US"}){const{cardContainerClassName,styles,onDisableStoredPaymentMethod}=Object.assign(Object.assign({},defaultConfig),config),[loadAdyen,setLoadAdyen]=(0,react_1.useState)(!1),[checkout,setCheckout]=(0,react_1.useState)(),{setPaymentSource,paymentSource,setPaymentMethodErrors,currentPaymentMethodType,setPaymentRef,currentCustomerPaymentSourceId}=(0,react_1.useContext)(PaymentMethodContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),{placeOrderButtonRef,setPlaceOrder}=(0,react_1.useContext)(PlaceOrderContext_1.default),{customers}=(0,react_1.useContext)(CustomerContext_1.default),ref=(0,react_1.useRef)(null),dropinRef=(0,react_1.useRef)(null),handleSubmit=e=>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),dropinRef.current&&dropinRef.current.submit(),!1}),handleChange=state=>tslib_1.__awaiter(this,void 0,void 0,function*(){state.isValid&&ref.current&&(ref.current.onsubmit=()=>tslib_1.__awaiter(this,void 0,void 0,function*(){return yield handleSubmit(ref.current)}),setPaymentRef({ref}))}),handleOnAdditionalDetails=(state,component)=>tslib_1.__awaiter(this,void 0,void 0,function*(){var _a,_b;const attributes={payment_request_details:state.data,_details:1};try{const pSource=paymentSource&&(yield setPaymentSource({paymentSourceId:paymentSource.id,paymentResource:"adyen_payments",attributes})),resultCode=(_a=pSource?.payment_response)===null||_a===void 0?void 0:_a.resultCode;if(["Authorised","Pending","Received"].includes(resultCode))return placeOrderButtonRef?.current!=null&&(placeOrderButtonRef.current.disabled&&(placeOrderButtonRef.current.disabled=!1),placeOrderButtonRef.current.click()),{resultCode};if(["Cancelled","Refused"].includes(resultCode)){const message=(_b=pSource?.payment_response)===null||_b===void 0?void 0:_b.refusalReason;setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}]),component&&component.mount("#adyen-dropin")}return{resultCode}}catch(error){return console.error("Adyen additional details error:",error),{resultCode:"Error"}}}),onSubmit=(state,component)=>tslib_1.__awaiter(this,void 0,void 0,function*(){var _a,_b,_c,_d,_e,_f,_g,_h;const url=(0,browserInfo_1.cleanUrlBy)(),shopperIp=yield(0,getPublicIp_1.getPublicIP)(),control=yield setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments"}),controlCode=(_a=control?.payment_response)===null||_a===void 0?void 0:_a.resultCode;if(controlCode==="Authorised")return{resultCode:controlCode};const attributes={payment_request_data:Object.assign(Object.assign({},state.data),{payment_method:state.data.paymentMethod,return_url:url,origin:window.location.origin,redirect_from_issuer_method:"GET",shopper_ip:shopperIp,shopperInteraction:"Ecommerce",recurringProcessingModel:"CardOnFile",browser_info:Object.assign({},(0,browserInfo_1.default)())})};delete attributes.payment_request_data.paymentMethod;try{if(yield setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes}),order?.id==null)return console.error("Order id is missing"),{resultCode:"Error"};const res=yield setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes:{_authorize:1}}),action=(_b=res?.payment_response)===null||_b===void 0?void 0:_b.action,resultCode=(_c=res?.payment_response)===null||_c===void 0?void 0:_c.resultCode;if(action!=null)return{resultCode,action};const issuerType=(_d=res?.payment_instrument)===null||_d===void 0?void 0:_d.issuer_type;if(["Authorised","Pending","Received"].includes(resultCode))return["apple pay","google pay"].includes(issuerType)&&setPlaceOrder!=null?(yield setPlaceOrder({paymentSource:res,currentCustomerPaymentSourceId}),{resultCode}):(placeOrderButtonRef?.current!=null&&(placeOrderButtonRef.current.disabled&&(placeOrderButtonRef.current.disabled=!1),placeOrderButtonRef.current.click()),{resultCode});if(["Cancelled","Refused"].includes(resultCode)){const message=(_e=res?.payment_response)===null||_e===void 0?void 0:_e.refusalReason;setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}]),component&&component.mount("#adyen-dropin")}if((_f=res?.payment_response)===null||_f===void 0?void 0:_f.errorType)if(((_g=res?.payment_response)===null||_g===void 0?void 0:_g.errorCode)==="14_006")onSubmit(state,component);else{const message=(_h=res?.payment_response)===null||_h===void 0?void 0:_h.message;setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}])}return{resultCode}}catch(error){return setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:error.message}]),{resultCode:"Error"}}});return(0,react_1.useEffect)(()=>{var _a,_b,_c,_d,_e;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:[]};paymentMethodsResponse.paymentMethods.length===0&&console.error("Payment methods are not available. Please, check your Adyen configuration.");const showStoredPaymentMethods=(_d=((_c=paymentSource?.payment_methods)===null||_c===void 0?void 0:_c.storedPaymentMethods)!=null)!==null&&_d!==void 0?_d:!1,options={locale:(_e=order?.language_code)!==null&&_e!==void 0?_e:locale,environment,clientKey,amount:{currency:order?.currency_code||"",value:order?.total_amount_with_taxes_cents||0},countryCode:order?.country_code||"",paymentMethodsResponse,showPayButton:!1,onAdditionalDetails:(state,element,actions)=>{(()=>tslib_1.__awaiter(this,void 0,void 0,function*(){const{resultCode}=yield handleOnAdditionalDetails(state,element);["Cancelled","Refused"].includes(resultCode)?actions.reject():actions.resolve({resultCode})}))()},onChange:state=>{handleChange(state)},onSubmit:(state,element,actions)=>{(()=>tslib_1.__awaiter(this,void 0,void 0,function*(){var _a2;const{resultCode,action}=yield onSubmit(state,element);["Cancelled","Refused"].includes(resultCode)?actions.reject():action!=null?(_a2=dropinRef.current)===null||_a2===void 0||_a2.handleAction(action):actions.resolve({resultCode})}))()}};if(!ref&&clientKey&&(0,localStorage_1.setCustomerOrderParam)("_save_payment_source_to_customer_wallet","false"),clientKey&&!loadAdyen&&window&&!checkout){const initializeAdyen=()=>tslib_1.__awaiter(this,void 0,void 0,function*(){var _a2,_b2;const checkout2=yield(0,auto_1.AdyenCheckout)(options),dropin=new auto_1.Dropin(checkout2,{disableFinalAnimation:!0,showRemovePaymentMethodButton:showStoredPaymentMethods,instantPaymentTypes:["applepay","googlepay"],paymentMethodsConfiguration:Object.assign({showStoredPaymentMethods,paypal:Object.assign({showPayButton:!0,style:styles?.paypal},(_a2=config?.paymentMethodsConfiguration)===null||_a2===void 0?void 0:_a2.paypal),card:Object.assign({enableStoreDetails:showStoredPaymentMethods,styles:styles?.card,holderNameRequired:!1},(_b2=config?.paymentMethodsConfiguration)===null||_b2===void 0?void 0:_b2.card)},config?.paymentMethodsConfiguration),onDisableStoredPaymentMethod:state=>{var _a3;const recurringDetailReference=state,shopperReference=(_a3=customers?.shopper_reference)!==null&&_a3!==void 0?_a3:void 0;onDisableStoredPaymentMethod?.({recurringDetailReference,shopperReference}).then(response=>{response?setPaymentSource({paymentResource:"adyen_payments",order,attributes:{}}):console.error("onDisableStoredPaymentMethod error")}).catch(error=>{console.error("onDisableStoredPaymentMethod error",error)})},onSelect:component=>{const id=component._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)}):ref.current.onsubmit=null,setPaymentRef({ref}))}}).mount("#adyen-dropin");dropin&&checkout2&&(dropinRef.current=dropin,setCheckout(dropin),setLoadAdyen(!0))});dropinRef.current||initializeAdyen()}return()=>{setPaymentRef({ref:{current:null}}),setLoadAdyen(!1)}},[clientKey,ref!=null]),!clientKey&&!loadAdyen&&!checkout?null:(0,jsx_runtime_1.jsxs)("form",{ref,onSubmit:e=>{handleSubmit(e)},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})]})}exports.default=AdyenPayment;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.placeOrderInitialState=void 0,exports.setButtonRef=setButtonRef,exports.setPlaceOrderErrors=setPlaceOrderErrors,exports.placeOrderPermitted=placeOrderPermitted,exports.setPlaceOrder=setPlaceOrder,exports.setPlaceOrderStatus=setPlaceOrderStatus;const tslib_1=require("tslib"),baseReducer_1=tslib_1.__importDefault(require("../utils/baseReducer")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),shipments_1=require("../utils/shipments"),customerOrderOptions_1=require("../utils/customerOrderOptions"),getSdk_1=tslib_1.__importDefault(require("../utils/getSdk")),getErrors_1=tslib_1.__importDefault(require("../utils/getErrors")),isGuestToken_1=require("../utils/isGuestToken"),localStorage_1=require("../utils/localStorage"),hasSubscriptions_1=require("../utils/hasSubscriptions"),updateOrderSubscriptionCustomerPaymentSource_1=require("../utils/updateOrderSubscriptionCustomerPaymentSource");function setButtonRef(ref,dispatch){ref?.current!=null&&dispatch({type:"setButtonRef",payload:{placeOrderButtonRef:ref}})}exports.placeOrderInitialState={errors:[],isPermitted:!1,status:"standby"};function setPlaceOrderErrors(errors,dispatch){dispatch&&dispatch({type:"setErrors",payload:{errors}})}function placeOrderPermitted({config,order,dispatch,options}){var _a;if(order&&config){let isPermitted=!0;order.privacy_url&&order.terms_url&&(isPermitted=localStorage.getItem("privacy-terms")==="true");const billingAddress=order.billing_address,shippingAddress=order.shipping_address,doNotShip=(0,shipments_1.isDoNotShip)(order.line_items),shipments=order.shipments,shipment=shipments&&(0,shipments_1.shipmentsFilled)(shipments),paymentMethod=order.payment_method,paymentSource=order.payment_source;order.total_amount_with_taxes_cents!==0&&(0,isEmpty_1.default)(paymentMethod?.id)&&(isPermitted=!1),(0,isEmpty_1.default)(billingAddress)&&(isPermitted=!1),(0,isEmpty_1.default)(shippingAddress)&&!doNotShip&&(isPermitted=!1),!(0,isEmpty_1.default)(shipments)&&!shipment&&(isPermitted=!1),paymentSource?.mismatched_amounts&&(isPermitted=!1),dispatch({type:"setPlaceOrderPermitted",payload:{isPermitted,paymentType:paymentMethod?.payment_source_type,paymentSecret:paymentSource?.client_secret,paymentId:(_a=paymentSource?.options)===null||_a===void 0?void 0:_a.id,paymentSource,options}})}}function setPlaceOrder(_a){return tslib_1.__awaiter(this,arguments,void 0,function*({state,order,config,setOrderErrors,paymentSource,setOrder,include,currentCustomerPaymentSourceId}){var _b,_c,_d,_e,_f,_g,_h;const response={placed:!1};if(state&&config&&order){if(order?.status==="placed")return{placed:!0,order};const sdk=(0,getSdk_1.default)(config),{options,paymentType}=state;try{
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.placeOrderInitialState=void 0,exports.setButtonRef=setButtonRef,exports.setPlaceOrderErrors=setPlaceOrderErrors,exports.placeOrderPermitted=placeOrderPermitted,exports.setPlaceOrder=setPlaceOrder,exports.setPlaceOrderStatus=setPlaceOrderStatus;const tslib_1=require("tslib"),baseReducer_1=tslib_1.__importDefault(require("../utils/baseReducer")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),shipments_1=require("../utils/shipments"),customerOrderOptions_1=require("../utils/customerOrderOptions"),getSdk_1=tslib_1.__importDefault(require("../utils/getSdk")),getErrors_1=tslib_1.__importDefault(require("../utils/getErrors")),isGuestToken_1=require("../utils/isGuestToken"),localStorage_1=require("../utils/localStorage"),hasSubscriptions_1=require("../utils/hasSubscriptions"),updateOrderSubscriptionCustomerPaymentSource_1=require("../utils/updateOrderSubscriptionCustomerPaymentSource");function setButtonRef(ref,dispatch){ref?.current!=null&&dispatch({type:"setButtonRef",payload:{placeOrderButtonRef:ref}})}exports.placeOrderInitialState={errors:[],isPermitted:!1,status:"standby"};function setPlaceOrderErrors(errors,dispatch){dispatch&&dispatch({type:"setErrors",payload:{errors}})}function placeOrderPermitted({config,order,dispatch,options}){var _a;if(order&&config){let isPermitted=!0;order.privacy_url&&order.terms_url&&(isPermitted=localStorage.getItem("privacy-terms")==="true");const billingAddress=order.billing_address,shippingAddress=order.shipping_address,doNotShip=(0,shipments_1.isDoNotShip)(order.line_items),shipments=order.shipments,shipment=shipments&&(0,shipments_1.shipmentsFilled)(shipments),paymentMethod=order.payment_method,paymentSource=order.payment_source;order.total_amount_with_taxes_cents!==0&&(0,isEmpty_1.default)(paymentMethod?.id)&&(isPermitted=!1),(0,isEmpty_1.default)(billingAddress)&&(isPermitted=!1),(0,isEmpty_1.default)(shippingAddress)&&!doNotShip&&(isPermitted=!1),!(0,isEmpty_1.default)(shipments)&&!shipment&&(isPermitted=!1),paymentSource?.mismatched_amounts&&(isPermitted=!1),dispatch({type:"setPlaceOrderPermitted",payload:{isPermitted,paymentType:paymentMethod?.payment_source_type,paymentSecret:paymentSource?.client_secret,paymentId:(_a=paymentSource?.options)===null||_a===void 0?void 0:_a.id,paymentSource,options}})}}function setPlaceOrder(_a){return tslib_1.__awaiter(this,arguments,void 0,function*({state,order,config,setOrderErrors,paymentSource,setOrder,include,currentCustomerPaymentSourceId}){var _b,_c,_d,_e,_f,_g,_h;const response={placed:!1};if(state&&config&&order){if(order?.status==="placed")return{placed:!0,order};const sdk=(0,getSdk_1.default)(config),{options,paymentType}=state;try{const lastOrderStatus=yield sdk.orders.retrieve(order.id);if(lastOrderStatus.status==="placed")return{placed:!0,order:lastOrderStatus};if(paymentType==="paypal_payments"&&paymentSource?.type==="paypal_payments"){if(!options?.paypalPayerId&&paymentSource?.approval_url)return window.location.href=paymentSource?.approval_url,response;yield sdk[paymentType].update({id:paymentSource.id,paypal_payer_id:options?.paypalPayerId})}if(paymentType==="checkout_com_payments"&&paymentSource&&(!((_b=options?.checkoutCom)===null||_b===void 0)&&_b.session_id)){const payment=yield sdk[paymentType].update({id:paymentSource.id,_details:!0,session_id:(_c=options?.checkoutCom)===null||_c===void 0?void 0:_c.session_id});if(((_d=payment?.payment_response)===null||_d===void 0?void 0:_d.status)!=="Authorized"){const[action]=((_e=payment?.payment_response)===null||_e===void 0?void 0:_e.actions)||[""];throw{errors:[{code:"PAYMENT_NOT_APPROVED_FOR_EXECUTION",message:action?.response_summary,resource:"orders",field:"checkout_com_payments"}]}}}const updateAttributes={id:order.id,_place:!0};if((0,customerOrderOptions_1.saveBillingAddress)()&&(yield sdk.orders.update({id:order.id,_save_billing_address_to_customer_address_book:!0})),(0,customerOrderOptions_1.saveShippingAddress)()&&(yield sdk.orders.update({id:order.id,_save_shipping_address_to_customer_address_book:!0})),paymentType==="stripe_payments"&&paymentSource!=null){const ps=paymentSource,currentUrl=window.location.href,returnUrl=(_f=ps?.options)===null||_f===void 0?void 0:_f.return_url;currentUrl!==returnUrl&&(yield sdk[paymentType].update({id:paymentSource.id,options:{return_url:currentUrl}}))}switch((0,hasSubscriptions_1.hasSubscriptions)(order)&&config?.accessToken!=null&&!(0,isGuestToken_1.isGuestToken)(config.accessToken)&¤tCustomerPaymentSourceId==null&&(0,localStorage_1.setCustomerOrderParam)("_save_payment_source_to_customer_wallet","true"),paymentType){case"braintree_payments":{const total=(_g=order?.total_amount_cents)!==null&&_g!==void 0?_g:0;yield Promise.all([(0,customerOrderOptions_1.saveToWallet)()&&total>0&&sdk.orders.update({id:order.id,_save_payment_source_to_customer_wallet:!0})]);const orderUpdated=yield sdk.orders.update(updateAttributes,{include});return setOrder&&setOrder(orderUpdated),setOrderErrors&&setOrderErrors([]),(0,updateOrderSubscriptionCustomerPaymentSource_1.updateOrderSubscriptionCustomerPaymentSource)(orderUpdated,paymentType,sdk),{placed:!0,order:orderUpdated}}default:{const orderUpdated=yield sdk.orders.update(updateAttributes,{include}),total=(_h=orderUpdated?.total_amount_cents)!==null&&_h!==void 0?_h:0;return setOrder&&setOrder(orderUpdated),yield Promise.all([(0,customerOrderOptions_1.saveToWallet)()&&total>0&&sdk.orders.update({id:order.id,_save_payment_source_to_customer_wallet:!0}).catch(error=>{const errors=(0,getErrors_1.default)({error,resource:"orders",field:paymentType});setOrderErrors&&setOrderErrors(errors)})]).then(()=>{(0,updateOrderSubscriptionCustomerPaymentSource_1.updateOrderSubscriptionCustomerPaymentSource)(orderUpdated,paymentType,sdk)}),{placed:!0,order:orderUpdated}}}}catch(error){const errors=(0,getErrors_1.default)({error,resource:"orders",field:paymentType});return setOrderErrors&&setOrderErrors(errors),Object.assign(Object.assign({},response),{errors})}}return response})}function setPlaceOrderStatus({status,dispatch}){dispatch?.({type:"setStatus",payload:{status}})}const type=["setErrors","setPlaceOrderPermitted","setButtonRef","setStatus"],placeOrderReducer=(state,reducer)=>(0,baseReducer_1.default)(state,reducer,type);exports.default=placeOrderReducer;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.sortPaymentMethods=sortPaymentMethods;function sortPaymentMethods(methods,labels){return methods.sort((a,b)=>{const indexA=labels.indexOf(a.payment_source_type),indexB=labels.indexOf(b.payment_source_type);return indexA===-1&&indexB===-1?0:indexA===-1?1:indexB===-1?-1:indexA-indexB})}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useRef,useState}from"react";import Parent from"../utils/Parent";import PlaceOrderContext from"../../context/PlaceOrderContext";import isFunction from"lodash/isFunction";import PaymentMethodContext from"../../context/PaymentMethodContext";import OrderContext from"../../context/OrderContext";import getCardDetails from"../../utils/getCardDetails";import{checkPaymentIntent}from"../../utils/stripe/retrievePaymentIntent";export function PlaceOrderButton(props){const ref=useRef(null),{children,label="Place order",loadingLabel="Placing...",autoPlaceOrder=!0,disabled,onClick,...p}=props,{isPermitted,setPlaceOrder,options,paymentType,setButtonRef,setPlaceOrderStatus}=useContext(PlaceOrderContext),[notPermitted,setNotPermitted]=useState(!0),[forceDisable,setForceDisable]=useState(disabled),[isLoading,setIsLoading]=useState(!1),{currentPaymentMethodRef,loading,currentPaymentMethodType,paymentSource,setPaymentSource,setPaymentMethodErrors,currentCustomerPaymentSourceId}=useContext(PaymentMethodContext),{order}=useContext(OrderContext),isFree=order?.total_amount_with_taxes_cents===0;useEffect(()=>{if(loading)setNotPermitted(loading);else if(paymentType===currentPaymentMethodType&&paymentType){const card=getCardDetails({customerPayment:{payment_source:paymentSource},paymentType});currentCustomerPaymentSourceId!=null&&paymentSource?.id===currentCustomerPaymentSourceId&&card.brand===""&&(card.brand="credit-card"),(isFree&&isPermitted||currentPaymentMethodRef?.current?.onsubmit||card.brand)&&isPermitted&&setNotPermitted(!1)}else setNotPermitted(!(isFree&&isPermitted));return()=>{setNotPermitted(!0)}},[isPermitted,paymentType,currentPaymentMethodRef?.current?.onsubmit,loading,currentPaymentMethodType,order,paymentSource]),useEffect(()=>{paymentType==="paypal_payments"&&options?.paypalPayerId&&order?.status&&["draft","pending"].includes(order?.status)&&autoPlaceOrder&&handleClick()},[options?.paypalPayerId,paymentType]),useEffect(()=>{if(paymentType==="stripe_payments"&&options?.stripe?.paymentIntentClientSecret&&order?.payment_source?.publishable_key&&order?.status&&["draft","pending"].includes(order?.status)&&autoPlaceOrder){const publicApiKey=order?.payment_source?.publishable_key,paymentIntentClientSecret=options?.stripe?.paymentIntentClientSecret,getPaymentIntent=async()=>{const paymentIntentResult=await checkPaymentIntent({publicApiKey,paymentIntentClientSecret});switch(paymentIntentResult.status){case"valid":handleClick();break;case"processing":setTimeout(()=>{getPaymentIntent()},1e3);break;case"invalid":setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:paymentIntentResult.message}]);break}};getPaymentIntent()}},[options?.stripe?.paymentIntentClientSecret!=null,paymentType!=null,order?.payment_source!=null]),useEffect(()=>{if(order?.status!=null&&["draft","pending"].includes(order?.status)){const resultCode=order?.payment_source?.payment_response?.resultCode==="Authorised",paymentDetails=order?.payment_source?.payment_request_details?.details!=null;if(paymentType==="adyen_payments"&&options?.adyen?.redirectResult&&!paymentDetails){const attributes={payment_request_details:{details:{redirectResult:options?.adyen?.redirectResult}},_details:1};setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes}).then(res=>{const resultCode2=res?.payment_response?.resultCode,errorCode=res?.payment_response?.errorCode,message=res?.payment_response?.message;["Authorised","Pending","Received"].includes(resultCode2)&&autoPlaceOrder?handleClick():errorCode!=null&&setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}])})}else(paymentType==="adyen_payments"&&options?.adyen?.MD&&options?.adyen?.PaRes&&autoPlaceOrder||paymentType==="adyen_payments"&&resultCode&&ref?.current?.disabled===!1&¤tCustomerPaymentSourceId==null&&autoPlaceOrder&&order?.payment_source?.payment_response?.merchantReference?.includes(order?.number))&&handleClick()}},[options?.adyen,paymentType,order?.payment_source?.payment_response?.resultCode]),useEffect(()=>{paymentType==="checkout_com_payments"&&options?.checkoutCom?.session_id&&order?.status&&["draft","pending"].includes(order?.status)&&autoPlaceOrder&&handleClick()},[options?.checkoutCom,paymentType]),useEffect(()=>{ref?.current!=null&&setButtonRef!=null&&setButtonRef(ref)},[ref]);const handleClick=async e=>{e?.preventDefault(),e?.stopPropagation(),setIsLoading(!0);let isValid=!0;setForceDisable(!0);const checkPaymentSource=paymentType!=="stripe_payments"?await setPaymentSource({paymentResource:paymentType,paymentSourceId:paymentSource?.id}):paymentSource,card=paymentType&&getCardDetails({paymentType,customerPayment:{payment_source:checkPaymentSource}});currentPaymentMethodRef?.current?.onsubmit&&[!options?.paypalPayerId,!options?.adyen?.MD,!options?.checkoutCom?.session_id].every(Boolean)?(isValid=await currentPaymentMethodRef.current?.onsubmit({paymentSource:checkPaymentSource,setPlaceOrder,onclickCallback:onClick}),!isValid&&checkPaymentSource?.payment_response?.resultCode==="Authorised"&&(isValid=!0)):card?.brand&&(isValid=!0),isValid&&setPlaceOrderStatus!=null&&setPlaceOrderStatus({status:"placing"});const placed=isValid&&setPlaceOrder&&(checkPaymentSource||isFree)&&await setPlaceOrder({paymentSource:checkPaymentSource,currentCustomerPaymentSourceId});setForceDisable(!1),onClick&&placed&&onClick(placed),setIsLoading(!1),setPlaceOrderStatus
|
|
2
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useRef,useState}from"react";import Parent from"../utils/Parent";import PlaceOrderContext from"../../context/PlaceOrderContext";import isFunction from"lodash/isFunction";import PaymentMethodContext from"../../context/PaymentMethodContext";import OrderContext from"../../context/OrderContext";import getCardDetails from"../../utils/getCardDetails";import{checkPaymentIntent}from"../../utils/stripe/retrievePaymentIntent";export function PlaceOrderButton(props){const ref=useRef(null),{children,label="Place order",loadingLabel="Placing...",autoPlaceOrder=!0,disabled,onClick,...p}=props,{isPermitted,setPlaceOrder,options,paymentType,setButtonRef,setPlaceOrderStatus,status}=useContext(PlaceOrderContext),[notPermitted,setNotPermitted]=useState(!0),[forceDisable,setForceDisable]=useState(disabled),[isLoading,setIsLoading]=useState(!1),{currentPaymentMethodRef,loading,currentPaymentMethodType,paymentSource,setPaymentSource,setPaymentMethodErrors,currentCustomerPaymentSourceId}=useContext(PaymentMethodContext),{order}=useContext(OrderContext),isFree=order?.total_amount_with_taxes_cents===0;useEffect(()=>{if(loading)setNotPermitted(loading);else if(paymentType===currentPaymentMethodType&&paymentType){const card=getCardDetails({customerPayment:{payment_source:paymentSource},paymentType});currentCustomerPaymentSourceId!=null&&paymentSource?.id===currentCustomerPaymentSourceId&&card.brand===""&&(card.brand="credit-card"),(isFree&&isPermitted||currentPaymentMethodRef?.current?.onsubmit||card.brand)&&isPermitted&&setNotPermitted(!1)}else setNotPermitted(!(isFree&&isPermitted));return()=>{setNotPermitted(!0)}},[isPermitted,paymentType,currentPaymentMethodRef?.current?.onsubmit,loading,currentPaymentMethodType,order,paymentSource]),useEffect(()=>{paymentType==="paypal_payments"&&options?.paypalPayerId&&order?.status&&["draft","pending"].includes(order?.status)&&autoPlaceOrder&&handleClick()},[options?.paypalPayerId,paymentType]),useEffect(()=>{if(paymentType==="stripe_payments"&&options?.stripe?.paymentIntentClientSecret&&order?.payment_source?.publishable_key&&order?.status&&["draft","pending"].includes(order?.status)&&autoPlaceOrder){const publicApiKey=order?.payment_source?.publishable_key,paymentIntentClientSecret=options?.stripe?.paymentIntentClientSecret,getPaymentIntent=async()=>{const paymentIntentResult=await checkPaymentIntent({publicApiKey,paymentIntentClientSecret});switch(paymentIntentResult.status){case"valid":handleClick();break;case"processing":setTimeout(()=>{getPaymentIntent()},1e3);break;case"invalid":setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:paymentIntentResult.message}]);break}};getPaymentIntent()}},[options?.stripe?.paymentIntentClientSecret!=null,paymentType!=null,order?.payment_source!=null]),useEffect(()=>{if(order?.status!=null&&["draft","pending"].includes(order?.status)){const resultCode=order?.payment_source?.payment_response?.resultCode==="Authorised",paymentDetails=order?.payment_source?.payment_request_details?.details!=null;if(paymentType==="adyen_payments"&&options?.adyen?.redirectResult&&!paymentDetails){const attributes={payment_request_details:{details:{redirectResult:options?.adyen?.redirectResult}},_details:1};setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes}).then(res=>{const resultCode2=res?.payment_response?.resultCode,errorCode=res?.payment_response?.errorCode,message=res?.payment_response?.message;["Authorised","Pending","Received"].includes(resultCode2)&&autoPlaceOrder?handleClick():errorCode!=null&&setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message}])})}else(paymentType==="adyen_payments"&&options?.adyen?.MD&&options?.adyen?.PaRes&&autoPlaceOrder||paymentType==="adyen_payments"&&resultCode&&ref?.current?.disabled===!1&¤tCustomerPaymentSourceId==null&&autoPlaceOrder&&status==="standby"&&order?.payment_source?.payment_response?.merchantReference?.includes(order?.number))&&handleClick()}},[options?.adyen,paymentType,order?.payment_source?.payment_response?.resultCode]),useEffect(()=>{paymentType==="checkout_com_payments"&&options?.checkoutCom?.session_id&&order?.status&&["draft","pending"].includes(order?.status)&&autoPlaceOrder&&handleClick()},[options?.checkoutCom,paymentType]),useEffect(()=>{ref?.current!=null&&setButtonRef!=null&&setButtonRef(ref)},[ref]);const handleClick=async e=>{e?.preventDefault(),e?.stopPropagation(),setIsLoading(!0);let isValid=!0;setForceDisable(!0);const checkPaymentSource=paymentType!=="stripe_payments"?await setPaymentSource({paymentResource:paymentType,paymentSourceId:paymentSource?.id}):paymentSource,card=paymentType&&getCardDetails({paymentType,customerPayment:{payment_source:checkPaymentSource}});currentPaymentMethodRef?.current?.onsubmit&&[!options?.paypalPayerId,!options?.adyen?.MD,!options?.checkoutCom?.session_id].every(Boolean)?(isValid=await currentPaymentMethodRef.current?.onsubmit({paymentSource:checkPaymentSource,setPlaceOrder,onclickCallback:onClick}),!isValid&&checkPaymentSource?.payment_response?.resultCode==="Authorised"&&(isValid=!0)):card?.brand&&(isValid=!0),isValid&&setPlaceOrderStatus!=null&&setPlaceOrderStatus({status:"placing"});const placed=isValid&&setPlaceOrder&&(checkPaymentSource||isFree)&&await setPlaceOrder({paymentSource:checkPaymentSource,currentCustomerPaymentSourceId});placed&&setPlaceOrderStatus!=null?placed.placed?(setPlaceOrderStatus({status:"placing"}),onClick&&placed&&onClick(placed)):(setForceDisable(!1),onClick&&placed&&onClick(placed),setIsLoading(!1),setPlaceOrderStatus({status:"standby"})):(setForceDisable(!1),setIsLoading(!1))},disabledButton=disabled!==void 0?disabled:notPermitted,labelButton=isLoading?loadingLabel:isFunction(label)?label():label,parentProps={...p,label,disabled:disabledButton,handleClick,parentRef:ref,isLoading};return children?_jsx(Parent,{...parentProps,children}):_jsx("button",{ref,type:"button",disabled:disabledButton||forceDisable,onClick:e=>{handleClick(e)},...p,children:labelButton})}export default PlaceOrderButton;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";import CommerceLayerContext from"../../context/CommerceLayerContext";import CustomerContext from"../../context/CustomerContext";import OrderContext from"../../context/OrderContext";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";import isEmpty from"lodash/isEmpty";import{useContext}from"react";import AdyenPayment from"../payment_source/AdyenPayment";import PaymentCardsTemplate from"../utils/PaymentCardsTemplate";import{jwt}from"../../utils/jwt";import getCardDetails from"../../utils/getCardDetails";import{getPaymentAttributes}from"../../utils/getPaymentAttributes";
|
|
2
|
+
import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";import CommerceLayerContext from"../../context/CommerceLayerContext";import CustomerContext from"../../context/CustomerContext";import OrderContext from"../../context/OrderContext";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";import isEmpty from"lodash/isEmpty";import{useContext}from"react";import AdyenPayment from"../payment_source/AdyenPayment";import PaymentCardsTemplate from"../utils/PaymentCardsTemplate";import{jwt}from"../../utils/jwt";import getCardDetails from"../../utils/getCardDetails";import{getPaymentAttributes}from"../../utils/getPaymentAttributes";export function AdyenGateway(props){const{readonly,showCard,handleEditClick,children,templateCustomerCards,loading,loaderComponent,templateCustomerSaveToWallet,...p}=props,{order}=useContext(OrderContext),{accessToken}=useContext(CommerceLayerContext),{payment}=useContext(PaymentMethodChildrenContext),{payments,isGuest}=useContext(CustomerContext),{currentPaymentMethodId,config,paymentSource}=useContext(PaymentMethodContext),paymentResource="adyen_payments",locale=order?.language_code;if(!readonly&&payment?.id!==currentPaymentMethodId)return null;const clientKey=paymentSource?.public_key,environment=accessToken&&jwt(accessToken).test?"test":"live",paymentConfig=getPaymentAttributes({resource:paymentResource,config:config??{},keys:["adyen_payments"]})?.adyenPayment,customerPayments=!isEmpty(payments)&&payments?payments.filter(customerPayment=>customerPayment.payment_source?.type==="adyen_payments"||customerPayment.payment_method!=null):[];if(readonly||showCard){const card=getCardDetails({customerPayment:{payment_source:paymentSource},paymentType:paymentResource}),value={...card,showCard,handleEditClick,readonly};return isEmpty(card)?null:_jsx(PaymentSourceContext.Provider,{value,children})}const hasStoredPaymentMethods=paymentSource?.payment_methods?.storedPaymentMethods!=null&&paymentSource?.payment_methods?.storedPaymentMethods.length>0;return!isGuest&&templateCustomerCards?_jsxs(_Fragment,{children:[hasStoredPaymentMethods||isEmpty(customerPayments)?null:_jsx("div",{className:p.className,children:_jsx(PaymentCardsTemplate,{paymentResource,customerPayments,children:templateCustomerCards})}),_jsx(AdyenPayment,{templateCustomerSaveToWallet,clientKey,locale,environment,config:paymentConfig})]}):_jsx(AdyenPayment,{clientKey,locale,config:paymentConfig,environment})}export default AdyenGateway;
|
|
@@ -30,6 +30,10 @@ type Props = {
|
|
|
30
30
|
* Enable express payment. Other payment methods will be disabled.
|
|
31
31
|
*/
|
|
32
32
|
expressPayments?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Sort payment methods by an array of strings
|
|
35
|
+
*/
|
|
36
|
+
sortBy?: Array<PaymentMethodType['payment_source_type']>;
|
|
33
37
|
} & Omit<JSX.IntrinsicElements['div'], 'onClick' | 'children'> & ({
|
|
34
38
|
clickableContainer: true;
|
|
35
39
|
onClick?: (params: PaymentMethodOnClickParams) => void;
|
|
@@ -37,5 +41,5 @@ type Props = {
|
|
|
37
41
|
clickableContainer?: never;
|
|
38
42
|
onClick?: never;
|
|
39
43
|
});
|
|
40
|
-
export declare function PaymentMethod({ children, className, activeClass, loader, clickableContainer, autoSelectSinglePaymentMethod, expressPayments, hide, onClick, ...p }: Props): JSX.Element;
|
|
44
|
+
export declare function PaymentMethod({ children, className, activeClass, loader, clickableContainer, autoSelectSinglePaymentMethod, expressPayments, hide, onClick, sortBy, ...p }: Props): JSX.Element;
|
|
41
45
|
export default PaymentMethod;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";import{useState,useEffect,useContext}from"react";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import getLoaderComponent from"../../utils/getLoaderComponent";import useCustomContext from"../../utils/hooks/useCustomContext";import OrderContext from"../../context/OrderContext";import CustomerContext from"../../context/CustomerContext";import{getExternalPaymentAttributes,getPaypalAttributes}from"../../utils/getPaymentAttributes";import{isEmpty}from"../../utils/isEmpty";import{getAvailableExpressPayments}from"../../utils/expressPaymentHelper";import PlaceOrderContext from"../../context/PlaceOrderContext";let loadingResource=!1;export function PaymentMethod({children,className,activeClass,loader="Loading...",clickableContainer,autoSelectSinglePaymentMethod,expressPayments,hide,onClick,...p}){const[loading,setLoading]=useState(!0),[paymentSelected,setPaymentSelected]=useState(""),[paymentSourceCreated,setPaymentSourceCreated]=useState(!1),{paymentMethods,currentPaymentMethodId,setPaymentMethod,setLoading:setLoadingPlaceOrder,paymentSource,setPaymentSource,config}=useCustomContext({context:PaymentMethodContext,contextComponentName:"PaymentMethodsContainer",currentComponentName:"PaymentMethod",key:"paymentMethods"}),{order}=useContext(OrderContext),{getCustomerPaymentSources}=useContext(CustomerContext),{status}=useContext(PlaceOrderContext);useEffect(()=>{if(paymentMethods!=null&&!isEmpty(paymentMethods)&&expressPayments){const[paymentMethod]=getAvailableExpressPayments(paymentMethods);!paymentSource&&paymentMethod!=null&&(async()=>{setLoadingPlaceOrder({loading:!0}),setPaymentSelected(paymentMethod.id);const paymentMethodId=paymentMethod?.id,paymentResource=paymentMethod?.payment_source_type;await setPaymentMethod({paymentResource,paymentMethodId});const ps=await setPaymentSource({paymentResource,order});ps&&paymentMethod&&onClick!=null&&(onClick({payment:paymentMethod,order,paymentSource:ps}),setTimeout(()=>{setLoading(!1)},200)),setLoadingPlaceOrder({loading:!1})})()}},[!isEmpty(paymentMethods),expressPayments]),useEffect(()=>{paymentMethods!=null&&!paymentSourceCreated&&!loadingResource&&!isEmpty(paymentMethods)&&(loadingResource=!0,autoSelectSinglePaymentMethod!=null&&!expressPayments&&(async()=>{if(paymentMethods.length===1){const[paymentMethod]=paymentMethods??[];if(paymentMethod&&!paymentSource){setLoadingPlaceOrder({loading:!0}),setPaymentSelected(paymentMethod.id);const paymentMethodId=paymentMethod?.id,paymentResource=paymentMethod?.payment_source_type;await setPaymentMethod({paymentResource,paymentMethodId});let attributes={};config!=null&&paymentResource==="paypal_payments"&&(attributes=getPaypalAttributes(paymentResource,config)),config!=null&&paymentResource==="external_payments"&&(attributes=getExternalPaymentAttributes(paymentResource,config));const ps=await setPaymentSource({paymentResource,order,attributes});ps&&paymentMethod&&onClick!=null&&(setPaymentSourceCreated(!0),onClick({payment:paymentMethod,order,paymentSource:ps}),setTimeout(()=>{setLoading(!1)},200)),getCustomerPaymentSources&&getCustomerPaymentSources(),setLoadingPlaceOrder({loading:!1})}typeof autoSelectSinglePaymentMethod=="function"&&autoSelectSinglePaymentMethod()}else setTimeout(()=>{setLoading(!1)},200)})())},[order?.payment_source!=null]),useEffect(()=>(paymentMethods&&(paymentMethods.length===1&&autoSelectSinglePaymentMethod?paymentSource&&setTimeout(()=>{setLoading(!1)},200):setLoading(!1)),currentPaymentMethodId&&setPaymentSelected(currentPaymentMethodId),()=>{setLoading(!0),setPaymentSelected("")}),[paymentMethods,currentPaymentMethodId]);const components=paymentMethods?.filter(payment=>{if(Array.isArray(hide)){const source=payment?.payment_source_type;return!hide?.includes(source)}else if(typeof hide=="function")return hide(payment);return!0}).map((payment,k)=>{const isActive=currentPaymentMethodId===payment?.id,paymentMethodProps={payment,clickableContainer,paymentSelected,setPaymentSelected,expressPayments},paymentResource=payment?.payment_source_type,onClickable=clickableContainer?async e=>{e.stopPropagation();const paymentMethodId=payment?.id,currentPaymentMethodId2=order?.payment_method?.id;if(paymentMethodId===currentPaymentMethodId2||status==="placing")return;setLoadingPlaceOrder({loading:!0}),setPaymentSelected(payment.id);const{order:updatedOrder}=await setPaymentMethod({paymentResource,paymentMethodId});onClick&&onClick({payment,order:updatedOrder}),setLoadingPlaceOrder({loading:!1})}:void 0;return _jsx("div",{"data-testid":paymentResource,className:`${className??""} ${isActive&&activeClass!=null?activeClass:""}`,onClick:e=>{onClickable?.(e)},...p,children:_jsx(PaymentMethodChildrenContext.Provider,{value:paymentMethodProps,children})},k)});return loading?getLoaderComponent(loader):_jsx(_Fragment,{children:components})}export default PaymentMethod;
|
|
2
|
+
import{jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";import{useState,useEffect,useContext}from"react";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import getLoaderComponent from"../../utils/getLoaderComponent";import useCustomContext from"../../utils/hooks/useCustomContext";import OrderContext from"../../context/OrderContext";import CustomerContext from"../../context/CustomerContext";import{getExternalPaymentAttributes,getPaypalAttributes}from"../../utils/getPaymentAttributes";import{isEmpty}from"../../utils/isEmpty";import{getAvailableExpressPayments}from"../../utils/expressPaymentHelper";import PlaceOrderContext from"../../context/PlaceOrderContext";import{sortPaymentMethods}from"../../utils/payment-methods/sortPaymentMethods";let loadingResource=!1;export function PaymentMethod({children,className,activeClass,loader="Loading...",clickableContainer,autoSelectSinglePaymentMethod,expressPayments,hide,onClick,sortBy,...p}){const[loading,setLoading]=useState(!0),[paymentSelected,setPaymentSelected]=useState(""),[paymentSourceCreated,setPaymentSourceCreated]=useState(!1),{paymentMethods,currentPaymentMethodId,setPaymentMethod,setLoading:setLoadingPlaceOrder,paymentSource,setPaymentSource,config}=useCustomContext({context:PaymentMethodContext,contextComponentName:"PaymentMethodsContainer",currentComponentName:"PaymentMethod",key:"paymentMethods"}),{order}=useContext(OrderContext),{getCustomerPaymentSources}=useContext(CustomerContext),{status}=useContext(PlaceOrderContext);useEffect(()=>{if(paymentMethods!=null&&!isEmpty(paymentMethods)&&expressPayments){const[paymentMethod]=getAvailableExpressPayments(paymentMethods);!paymentSource&&paymentMethod!=null&&(async()=>{setLoadingPlaceOrder({loading:!0}),setPaymentSelected(paymentMethod.id);const paymentMethodId=paymentMethod?.id,paymentResource=paymentMethod?.payment_source_type;await setPaymentMethod({paymentResource,paymentMethodId});const ps=await setPaymentSource({paymentResource,order});ps&&paymentMethod&&onClick!=null&&(onClick({payment:paymentMethod,order,paymentSource:ps}),setTimeout(()=>{setLoading(!1)},200)),setLoadingPlaceOrder({loading:!1})})()}},[!isEmpty(paymentMethods),expressPayments]),useEffect(()=>{paymentMethods!=null&&!paymentSourceCreated&&!loadingResource&&!isEmpty(paymentMethods)&&(loadingResource=!0,autoSelectSinglePaymentMethod!=null&&!expressPayments&&(async()=>{if(paymentMethods.length===1){const[paymentMethod]=paymentMethods??[];if(paymentMethod&&!paymentSource){setLoadingPlaceOrder({loading:!0}),setPaymentSelected(paymentMethod.id);const paymentMethodId=paymentMethod?.id,paymentResource=paymentMethod?.payment_source_type;await setPaymentMethod({paymentResource,paymentMethodId});let attributes={};config!=null&&paymentResource==="paypal_payments"&&(attributes=getPaypalAttributes(paymentResource,config)),config!=null&&paymentResource==="external_payments"&&(attributes=getExternalPaymentAttributes(paymentResource,config));const ps=await setPaymentSource({paymentResource,order,attributes});ps&&paymentMethod&&onClick!=null&&(setPaymentSourceCreated(!0),onClick({payment:paymentMethod,order,paymentSource:ps}),setTimeout(()=>{setLoading(!1)},200)),getCustomerPaymentSources&&getCustomerPaymentSources(),setLoadingPlaceOrder({loading:!1})}typeof autoSelectSinglePaymentMethod=="function"&&autoSelectSinglePaymentMethod()}else setTimeout(()=>{setLoading(!1)},200)})())},[!isEmpty(paymentMethods),order?.payment_source!=null]),useEffect(()=>(paymentMethods&&(paymentMethods.length===1&&autoSelectSinglePaymentMethod?paymentSource&&setTimeout(()=>{setLoading(!1)},200):setLoading(!1)),currentPaymentMethodId&&setPaymentSelected(currentPaymentMethodId),()=>{setLoading(!0),setPaymentSelected("")}),[paymentMethods,currentPaymentMethodId]);const components=(paymentMethods!=null&&sortBy!=null?sortPaymentMethods(paymentMethods,sortBy):paymentMethods)?.filter(payment=>{if(Array.isArray(hide)){const source=payment?.payment_source_type;return!hide?.includes(source)}else if(typeof hide=="function")return hide(payment);return!0}).map((payment,k)=>{const isActive=currentPaymentMethodId===payment?.id,paymentMethodProps={payment,clickableContainer,paymentSelected,setPaymentSelected,expressPayments},paymentResource=payment?.payment_source_type,onClickable=clickableContainer?async e=>{e.stopPropagation();const paymentMethodId=payment?.id,currentPaymentMethodId2=order?.payment_method?.id;if(paymentMethodId===currentPaymentMethodId2||status==="placing")return;setLoadingPlaceOrder({loading:!0}),setPaymentSelected(payment.id);const{order:updatedOrder}=await setPaymentMethod({paymentResource,paymentMethodId});onClick&&onClick({payment,order:updatedOrder}),setLoadingPlaceOrder({loading:!1})}:void 0;return _jsx("div",{"data-testid":paymentResource,className:`${className??""} ${isActive&&activeClass!=null?activeClass:""}`,onClick:e=>{onClickable?.(e)},...p,children:_jsx(PaymentMethodChildrenContext.Provider,{value:paymentMethodProps,children})},k)});return loading?getLoaderComponent(loader):_jsx(_Fragment,{children:components})}export default PaymentMethod;
|
|
@@ -1,12 +1,44 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type JSX } from 'react';
|
|
2
2
|
import { type PaymentSourceProps } from './PaymentSource';
|
|
3
|
-
import type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
import { type CoreConfiguration, type DropinConfiguration } from '@adyen/adyen-web/auto';
|
|
4
|
+
interface StyleDefinitions {
|
|
5
|
+
background?: string;
|
|
6
|
+
caretColor?: string;
|
|
7
|
+
color?: string;
|
|
8
|
+
display?: string;
|
|
9
|
+
font?: string;
|
|
10
|
+
fontFamily?: string;
|
|
11
|
+
fontSize?: string;
|
|
12
|
+
fontSizeAdjust?: string;
|
|
13
|
+
fontSmoothing?: string;
|
|
14
|
+
fontStretch?: string;
|
|
15
|
+
fontStyle?: string;
|
|
16
|
+
fontVariant?: string;
|
|
17
|
+
fontVariantAlternates?: string;
|
|
18
|
+
fontVariantCaps?: string;
|
|
19
|
+
fontVariantEastAsian?: string;
|
|
20
|
+
fontVariantLigatures?: string;
|
|
21
|
+
fontVariantNumeric?: string;
|
|
22
|
+
fontWeight?: string;
|
|
23
|
+
letterSpacing?: string;
|
|
24
|
+
lineHeight?: string;
|
|
25
|
+
mozOsxFontSmoothing?: string;
|
|
26
|
+
mozTransition?: string;
|
|
27
|
+
outline?: string;
|
|
28
|
+
opacity?: string;
|
|
29
|
+
padding?: string;
|
|
30
|
+
textAlign?: string;
|
|
31
|
+
textShadow?: string;
|
|
32
|
+
transition?: string;
|
|
33
|
+
webkitFontSmoothing?: string;
|
|
34
|
+
webkitTransition?: string;
|
|
35
|
+
wordSpacing?: string;
|
|
36
|
+
}
|
|
37
|
+
interface Styles {
|
|
38
|
+
error?: StyleDefinitions;
|
|
39
|
+
placeholder?: StyleDefinitions;
|
|
40
|
+
validated?: StyleDefinitions;
|
|
41
|
+
}
|
|
10
42
|
type PaypalStyle = Partial<{
|
|
11
43
|
/**
|
|
12
44
|
* @see {@link https://developer.paypal.com/docs/checkout/integration-features/customize-button/#color}
|
|
@@ -47,6 +79,7 @@ export interface AdyenPaymentConfig {
|
|
|
47
79
|
cardContainerClassName?: string;
|
|
48
80
|
/**
|
|
49
81
|
* Optional CSS class name for the 3D Secure container.
|
|
82
|
+
* @deprecated
|
|
50
83
|
*/
|
|
51
84
|
threeDSecureContainerClassName?: string;
|
|
52
85
|
/**
|
|
@@ -63,7 +96,7 @@ export interface AdyenPaymentConfig {
|
|
|
63
96
|
/**
|
|
64
97
|
* Configuration options for the payment methods.
|
|
65
98
|
*/
|
|
66
|
-
paymentMethodsConfiguration?:
|
|
99
|
+
paymentMethodsConfiguration?: DropinConfiguration['paymentMethodsConfiguration'];
|
|
67
100
|
/**
|
|
68
101
|
* Callback function to disable a stored payment method.
|
|
69
102
|
* @param props - An object containing the recurring detail reference and shopper reference.
|
|
@@ -78,8 +111,8 @@ interface Props {
|
|
|
78
111
|
clientKey?: string;
|
|
79
112
|
config?: AdyenPaymentConfig;
|
|
80
113
|
templateCustomerSaveToWallet?: PaymentSourceProps['templateCustomerSaveToWallet'];
|
|
81
|
-
locale?:
|
|
82
|
-
environment?:
|
|
114
|
+
locale?: CoreConfiguration['locale'];
|
|
115
|
+
environment?: CoreConfiguration['environment'];
|
|
83
116
|
}
|
|
84
117
|
export declare function AdyenPayment({ clientKey, config, templateCustomerSaveToWallet, environment, locale }: Props): JSX.Element | null;
|
|
85
118
|
export default AdyenPayment;
|
|
@@ -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 browserInfo,{cleanUrlBy}from"../../utils/browserInfo";import PlaceOrderContext from"../../context/PlaceOrderContext";import OrderContext from"../../context/OrderContext";import{getPublicIP}from"../../utils/getPublicIp";import CustomerContext from"../../context/CustomerContext";const defaultConfig={};export function AdyenPayment({clientKey,config,templateCustomerSaveToWallet,environment="test",locale="en_US"}){const{cardContainerClassName,
|
|
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{AdyenCheckout,Dropin}from"@adyen/adyen-web/auto";import Parent from"../utils/Parent";import browserInfo,{cleanUrlBy}from"../../utils/browserInfo";import PlaceOrderContext from"../../context/PlaceOrderContext";import OrderContext from"../../context/OrderContext";import{getPublicIP}from"../../utils/getPublicIp";import CustomerContext from"../../context/CustomerContext";const defaultConfig={};export function AdyenPayment({clientKey,config,templateCustomerSaveToWallet,environment="test",locale="en_US"}){const{cardContainerClassName,styles,onDisableStoredPaymentMethod}={...defaultConfig,...config},[loadAdyen,setLoadAdyen]=useState(!1),[checkout,setCheckout]=useState(),{setPaymentSource,paymentSource,setPaymentMethodErrors,currentPaymentMethodType,setPaymentRef,currentCustomerPaymentSourceId}=useContext(PaymentMethodContext),{order}=useContext(OrderContext),{placeOrderButtonRef,setPlaceOrder}=useContext(PlaceOrderContext),{customers}=useContext(CustomerContext),ref=useRef(null),dropinRef=useRef(null),handleSubmit=async e=>{const savePaymentSourceToCustomerWallet=e?.elements?.save_payment_source_to_customer_wallet?.checked;return savePaymentSourceToCustomerWallet&&setCustomerOrderParam("_save_payment_source_to_customer_wallet",savePaymentSourceToCustomerWallet),dropinRef.current&&dropinRef.current.submit(),!1},handleChange=async state=>{state.isValid&&ref.current&&(ref.current.onsubmit=async()=>await handleSubmit(ref.current),setPaymentRef({ref}))},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}),resultCode=pSource?.payment_response?.resultCode;if(["Authorised","Pending","Received"].includes(resultCode))return placeOrderButtonRef?.current!=null&&(placeOrderButtonRef.current.disabled&&(placeOrderButtonRef.current.disabled=!1),placeOrderButtonRef.current.click()),{resultCode};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{resultCode}}catch(error){return console.error("Adyen additional details error:",error),{resultCode:"Error"}}},onSubmit=async(state,component)=>{const url=cleanUrlBy(),shopperIp=await getPublicIP(),controlCode=(await setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments"}))?.payment_response?.resultCode;if(controlCode==="Authorised")return{resultCode:controlCode};const attributes={payment_request_data:{...state.data,payment_method:state.data.paymentMethod,return_url:url,origin:window.location.origin,redirect_from_issuer_method:"GET",shopper_ip:shopperIp,shopperInteraction:"Ecommerce",recurringProcessingModel:"CardOnFile",browser_info:{...browserInfo()}}};delete attributes.payment_request_data.paymentMethod;try{if(await setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes}),order?.id==null)return console.error("Order id is missing"),{resultCode:"Error"};const res=await setPaymentSource({paymentSourceId:paymentSource?.id,paymentResource:"adyen_payments",attributes:{_authorize:1}}),action=res?.payment_response?.action,resultCode=res?.payment_response?.resultCode;if(action!=null)return{resultCode,action};const issuerType=res?.payment_instrument?.issuer_type;if(["Authorised","Pending","Received"].includes(resultCode))return["apple pay","google pay"].includes(issuerType)&&setPlaceOrder!=null?(await setPlaceOrder({paymentSource:res,currentCustomerPaymentSourceId}),{resultCode}):(placeOrderButtonRef?.current!=null&&(placeOrderButtonRef.current.disabled&&(placeOrderButtonRef.current.disabled=!1),placeOrderButtonRef.current.click()),{resultCode});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{resultCode}}catch(error){return setPaymentMethodErrors([{code:"PAYMENT_INTENT_AUTHENTICATION_FAILURE",resource:"payment_methods",field:currentPaymentMethodType,message:error.message}]),{resultCode:"Error"}}};return useEffect(()=>{const paymentMethodsResponse={paymentMethods:paymentSource?.payment_methods?.paymentMethods?paymentSource?.payment_methods.paymentMethods:[],storedPaymentMethods:paymentSource?.payment_methods?.storedPaymentMethods?paymentSource?.payment_methods.storedPaymentMethods:[]};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,onAdditionalDetails:(state,element,actions)=>{(async()=>{const{resultCode}=await handleOnAdditionalDetails(state,element);["Cancelled","Refused"].includes(resultCode)?actions.reject():actions.resolve({resultCode})})()},onChange:state=>{handleChange(state)},onSubmit:(state,element,actions)=>{(async()=>{const{resultCode,action}=await onSubmit(state,element);["Cancelled","Refused"].includes(resultCode)?actions.reject():action!=null?dropinRef.current?.handleAction(action):actions.resolve({resultCode})})()}};if(!ref&&clientKey&&setCustomerOrderParam("_save_payment_source_to_customer_wallet","false"),clientKey&&!loadAdyen&&window&&!checkout){const initializeAdyen=async()=>{const checkout2=await AdyenCheckout(options),dropin=new Dropin(checkout2,{disableFinalAnimation:!0,showRemovePaymentMethodButton:showStoredPaymentMethods,instantPaymentTypes:["applepay","googlepay"],paymentMethodsConfiguration:{showStoredPaymentMethods,paypal:{showPayButton:!0,style:styles?.paypal,...config?.paymentMethodsConfiguration?.paypal},card:{enableStoreDetails:showStoredPaymentMethods,styles:styles?.card,holderNameRequired:!1,...config?.paymentMethodsConfiguration?.card},...config?.paymentMethodsConfiguration},onDisableStoredPaymentMethod:state=>{const recurringDetailReference=state,shopperReference=customers?.shopper_reference??void 0;onDisableStoredPaymentMethod?.({recurringDetailReference,shopperReference}).then(response=>{response?setPaymentSource({paymentResource:"adyen_payments",order,attributes:{}}):console.error("onDisableStoredPaymentMethod error")}).catch(error=>{console.error("onDisableStoredPaymentMethod error",error)})},onSelect:component=>{const id=component._id;id.search("scheme")===-1&&ref.current&&(id.search("paypal")===-1?ref.current.onsubmit=async()=>await handleSubmit(ref.current):ref.current.onsubmit=null,setPaymentRef({ref}))}}).mount("#adyen-dropin");dropin&&checkout2&&(dropinRef.current=dropin,setCheckout(dropin),setLoadAdyen(!0))};dropinRef.current||initializeAdyen()}return()=>{setPaymentRef({ref:{current:null}}),setLoadAdyen(!1)}},[clientKey,ref!=null]),!clientKey&&!loadAdyen&&!checkout?null:_jsxs("form",{ref,onSubmit:e=>{handleSubmit(e)},children:[_jsx("div",{className:cardContainerClassName,id:"adyen-dropin"}),templateCustomerSaveToWallet&&_jsx(Parent,{name:"save_payment_source_to_customer_wallet",children:templateCustomerSaveToWallet})]})}export default AdyenPayment;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import baseReducer from"../utils/baseReducer";import isEmpty from"lodash/isEmpty";import{isDoNotShip,shipmentsFilled}from"../utils/shipments";import{saveBillingAddress,saveShippingAddress,saveToWallet}from"../utils/customerOrderOptions";import getSdk from"../utils/getSdk";import getErrors from"../utils/getErrors";import{isGuestToken}from"../utils/isGuestToken";import{setCustomerOrderParam}from"../utils/localStorage";import{hasSubscriptions}from"../utils/hasSubscriptions";import{updateOrderSubscriptionCustomerPaymentSource}from"../utils/updateOrderSubscriptionCustomerPaymentSource";export function setButtonRef(ref,dispatch){ref?.current!=null&&dispatch({type:"setButtonRef",payload:{placeOrderButtonRef:ref}})}export const placeOrderInitialState={errors:[],isPermitted:!1,status:"standby"};export function setPlaceOrderErrors(errors,dispatch){dispatch&&dispatch({type:"setErrors",payload:{errors}})}export function placeOrderPermitted({config,order,dispatch,options}){if(order&&config){let isPermitted=!0;order.privacy_url&&order.terms_url&&(isPermitted=localStorage.getItem("privacy-terms")==="true");const billingAddress=order.billing_address,shippingAddress=order.shipping_address,doNotShip=isDoNotShip(order.line_items),shipments=order.shipments,shipment=shipments&&shipmentsFilled(shipments),paymentMethod=order.payment_method,paymentSource=order.payment_source;order.total_amount_with_taxes_cents!==0&&isEmpty(paymentMethod?.id)&&(isPermitted=!1),isEmpty(billingAddress)&&(isPermitted=!1),isEmpty(shippingAddress)&&!doNotShip&&(isPermitted=!1),!isEmpty(shipments)&&!shipment&&(isPermitted=!1),paymentSource?.mismatched_amounts&&(isPermitted=!1),dispatch({type:"setPlaceOrderPermitted",payload:{isPermitted,paymentType:paymentMethod?.payment_source_type,paymentSecret:paymentSource?.client_secret,paymentId:paymentSource?.options?.id,paymentSource,options}})}}export async function setPlaceOrder({state,order,config,setOrderErrors,paymentSource,setOrder,include,currentCustomerPaymentSourceId}){const response={placed:!1};if(state&&config&&order){if(order?.status==="placed")return{placed:!0,order};const sdk=getSdk(config),{options,paymentType}=state;try{
|
|
2
|
+
import baseReducer from"../utils/baseReducer";import isEmpty from"lodash/isEmpty";import{isDoNotShip,shipmentsFilled}from"../utils/shipments";import{saveBillingAddress,saveShippingAddress,saveToWallet}from"../utils/customerOrderOptions";import getSdk from"../utils/getSdk";import getErrors from"../utils/getErrors";import{isGuestToken}from"../utils/isGuestToken";import{setCustomerOrderParam}from"../utils/localStorage";import{hasSubscriptions}from"../utils/hasSubscriptions";import{updateOrderSubscriptionCustomerPaymentSource}from"../utils/updateOrderSubscriptionCustomerPaymentSource";export function setButtonRef(ref,dispatch){ref?.current!=null&&dispatch({type:"setButtonRef",payload:{placeOrderButtonRef:ref}})}export const placeOrderInitialState={errors:[],isPermitted:!1,status:"standby"};export function setPlaceOrderErrors(errors,dispatch){dispatch&&dispatch({type:"setErrors",payload:{errors}})}export function placeOrderPermitted({config,order,dispatch,options}){if(order&&config){let isPermitted=!0;order.privacy_url&&order.terms_url&&(isPermitted=localStorage.getItem("privacy-terms")==="true");const billingAddress=order.billing_address,shippingAddress=order.shipping_address,doNotShip=isDoNotShip(order.line_items),shipments=order.shipments,shipment=shipments&&shipmentsFilled(shipments),paymentMethod=order.payment_method,paymentSource=order.payment_source;order.total_amount_with_taxes_cents!==0&&isEmpty(paymentMethod?.id)&&(isPermitted=!1),isEmpty(billingAddress)&&(isPermitted=!1),isEmpty(shippingAddress)&&!doNotShip&&(isPermitted=!1),!isEmpty(shipments)&&!shipment&&(isPermitted=!1),paymentSource?.mismatched_amounts&&(isPermitted=!1),dispatch({type:"setPlaceOrderPermitted",payload:{isPermitted,paymentType:paymentMethod?.payment_source_type,paymentSecret:paymentSource?.client_secret,paymentId:paymentSource?.options?.id,paymentSource,options}})}}export async function setPlaceOrder({state,order,config,setOrderErrors,paymentSource,setOrder,include,currentCustomerPaymentSourceId}){const response={placed:!1};if(state&&config&&order){if(order?.status==="placed")return{placed:!0,order};const sdk=getSdk(config),{options,paymentType}=state;try{const lastOrderStatus=await sdk.orders.retrieve(order.id);if(lastOrderStatus.status==="placed")return{placed:!0,order:lastOrderStatus};if(paymentType==="paypal_payments"&&paymentSource?.type==="paypal_payments"){if(!options?.paypalPayerId&&paymentSource?.approval_url)return window.location.href=paymentSource?.approval_url,response;await sdk[paymentType].update({id:paymentSource.id,paypal_payer_id:options?.paypalPayerId})}if(paymentType==="checkout_com_payments"&&paymentSource&&options?.checkoutCom?.session_id){const payment=await sdk[paymentType].update({id:paymentSource.id,_details:!0,session_id:options?.checkoutCom?.session_id});if(payment?.payment_response?.status!=="Authorized"){const[action]=payment?.payment_response?.actions||[""];throw{errors:[{code:"PAYMENT_NOT_APPROVED_FOR_EXECUTION",message:action?.response_summary,resource:"orders",field:"checkout_com_payments"}]}}}const updateAttributes={id:order.id,_place:!0};if(saveBillingAddress()&&await sdk.orders.update({id:order.id,_save_billing_address_to_customer_address_book:!0}),saveShippingAddress()&&await sdk.orders.update({id:order.id,_save_shipping_address_to_customer_address_book:!0}),paymentType==="stripe_payments"&&paymentSource!=null){const ps=paymentSource,currentUrl=window.location.href,returnUrl=ps?.options?.return_url;currentUrl!==returnUrl&&await sdk[paymentType].update({id:paymentSource.id,options:{return_url:currentUrl}})}switch(hasSubscriptions(order)&&config?.accessToken!=null&&!isGuestToken(config.accessToken)&¤tCustomerPaymentSourceId==null&&setCustomerOrderParam("_save_payment_source_to_customer_wallet","true"),paymentType){case"braintree_payments":{const total=order?.total_amount_cents??0;await Promise.all([saveToWallet()&&total>0&&sdk.orders.update({id:order.id,_save_payment_source_to_customer_wallet:!0})]);const orderUpdated=await sdk.orders.update(updateAttributes,{include});return setOrder&&setOrder(orderUpdated),setOrderErrors&&setOrderErrors([]),updateOrderSubscriptionCustomerPaymentSource(orderUpdated,paymentType,sdk),{placed:!0,order:orderUpdated}}default:{const orderUpdated=await sdk.orders.update(updateAttributes,{include}),total=orderUpdated?.total_amount_cents??0;return setOrder&&setOrder(orderUpdated),await Promise.all([saveToWallet()&&total>0&&sdk.orders.update({id:order.id,_save_payment_source_to_customer_wallet:!0}).catch(error=>{const errors=getErrors({error,resource:"orders",field:paymentType});setOrderErrors&&setOrderErrors(errors)})]).then(()=>{updateOrderSubscriptionCustomerPaymentSource(orderUpdated,paymentType,sdk)}),{placed:!0,order:orderUpdated}}}}catch(error){const errors=getErrors({error,resource:"orders",field:paymentType});return setOrderErrors&&setOrderErrors(errors),{...response,errors}}}return response}export function setPlaceOrderStatus({status,dispatch}){dispatch?.({type:"setStatus",payload:{status}})}const type=["setErrors","setPlaceOrderPermitted","setButtonRef","setStatus"],placeOrderReducer=(state,reducer)=>baseReducer(state,reducer,type);export default placeOrderReducer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/index.ts","../src/components/ExternalFunction.tsx","../src/components/MetadataInput.tsx","../src/components/SubmitButton.tsx","../src/components/addresses/Address.tsx","../src/components/addresses/AddressCountrySelector.tsx","../src/components/addresses/AddressField.tsx","../src/components/addresses/AddressInput.tsx","../src/components/addresses/AddressInputSelect.tsx","../src/components/addresses/AddressStateSelector.tsx","../src/components/addresses/AddressesContainer.tsx","../src/components/addresses/AddressesEmpty.tsx","../src/components/addresses/BillingAddressContainer.tsx","../src/components/addresses/BillingAddressForm.tsx","../src/components/addresses/SaveAddressesButton.tsx","../src/components/addresses/ShippingAddressContainer.tsx","../src/components/addresses/ShippingAddressForm.tsx","../src/components/auth/CommerceLayer.tsx","../src/components/customers/CustomerAddressForm.tsx","../src/components/customers/CustomerContainer.tsx","../src/components/customers/CustomerField.tsx","../src/components/customers/CustomerInput.tsx","../src/components/customers/CustomerPaymentSource.tsx","../src/components/customers/CustomerPaymentSourceEmpty.tsx","../src/components/customers/MyAccountLink.tsx","../src/components/customers/MyIdentityLink.tsx","../src/components/customers/SaveCustomerButton.tsx","../src/components/errors/Errors.tsx","../src/components/gift_cards/GiftCard.tsx","../src/components/gift_cards/GiftCardContainer.tsx","../src/components/gift_cards/GiftCardCurrencySelector.tsx","../src/components/gift_cards/GiftCardInput.tsx","../src/components/gift_cards/GiftCardOrCouponCode.tsx","../src/components/gift_cards/GiftCardOrCouponForm.tsx","../src/components/gift_cards/GiftCardOrCouponInput.tsx","../src/components/gift_cards/GiftCardOrCouponRemoveButton.tsx","../src/components/gift_cards/GiftCardOrCouponSubmit.tsx","../src/components/gift_cards/GiftCardRecipientInput.tsx","../src/components/in_stock_subscriptions/InStockSubscriptionButton.tsx","../src/components/in_stock_subscriptions/InStockSubscriptionsContainer.tsx","../src/components/line_items/LineItem.tsx","../src/components/line_items/LineItemAmount.tsx","../src/components/line_items/LineItemCode.tsx","../src/components/line_items/LineItemField.tsx","../src/components/line_items/LineItemImage.tsx","../src/components/line_items/LineItemName.tsx","../src/components/line_items/LineItemOption.tsx","../src/components/line_items/LineItemOptions.tsx","../src/components/line_items/LineItemQuantity.tsx","../src/components/line_items/LineItemRemoveLink.tsx","../src/components/line_items/LineItemsContainer.tsx","../src/components/line_items/LineItemsCount.tsx","../src/components/line_items/LineItemsEmpty.tsx","../src/components/orders/AddToCartButton.tsx","../src/components/orders/AdjustmentAmount.tsx","../src/components/orders/CartLink.tsx","../src/components/orders/CheckoutLink.tsx","../src/components/orders/DiscountAmount.tsx","../src/components/orders/GiftCardAmount.tsx","../src/components/orders/HostedCart.tsx","../src/components/orders/OrderContainer.tsx","../src/components/orders/OrderList.tsx","../src/components/orders/OrderListEmpty.tsx","../src/components/orders/OrderListPaginationButtons.tsx","../src/components/orders/OrderListPaginationInfo.tsx","../src/components/orders/OrderListRow.tsx","../src/components/orders/OrderNumber.tsx","../src/components/orders/OrderStorage.tsx","../src/components/orders/PaymentMethodAmount.tsx","../src/components/orders/PlaceOrderButton.tsx","../src/components/orders/PlaceOrderContainer.tsx","../src/components/orders/PrivacyAndTermsCheckbox.tsx","../src/components/orders/ShippingAmount.tsx","../src/components/orders/SubTotalAmount.tsx","../src/components/orders/TaxesAmount.tsx","../src/components/orders/TotalAmount.tsx","../src/components/parcels/ParcelField.tsx","../src/components/parcels/ParcelLineItem.tsx","../src/components/parcels/ParcelLineItemField.tsx","../src/components/parcels/ParcelLineItemsCount.tsx","../src/components/parcels/Parcels.tsx","../src/components/parcels/ParcelsCount.tsx","../src/components/payment_gateways/AdyenGateway.tsx","../src/components/payment_gateways/BraintreeGateway.tsx","../src/components/payment_gateways/CheckoutComGateway.tsx","../src/components/payment_gateways/ExternalGateway.tsx","../src/components/payment_gateways/KlarnaGateway.tsx","../src/components/payment_gateways/PaymentGateway.tsx","../src/components/payment_gateways/PaypalGateway.tsx","../src/components/payment_gateways/StripeGateway.tsx","../src/components/payment_gateways/WireTransferGateway.tsx","../src/components/payment_methods/PaymentMethod.tsx","../src/components/payment_methods/PaymentMethodName.tsx","../src/components/payment_methods/PaymentMethodPrice.tsx","../src/components/payment_methods/PaymentMethodRadioButton.tsx","../src/components/payment_methods/PaymentMethodsContainer.tsx","../src/components/payment_source/AdyenPayment.tsx","../src/components/payment_source/BraintreePayment.tsx","../src/components/payment_source/CheckoutComPayment.tsx","../src/components/payment_source/ExternalPayment.tsx","../src/components/payment_source/KlarnaPayment.tsx","../src/components/payment_source/PaymentSource.tsx","../src/components/payment_source/PaymentSourceBrandIcon.tsx","../src/components/payment_source/PaymentSourceBrandName.tsx","../src/components/payment_source/PaymentSourceDetail.tsx","../src/components/payment_source/PaymentSourceEditButton.tsx","../src/components/payment_source/PaypalPayment.tsx","../src/components/payment_source/StripeExpressPayment.tsx","../src/components/payment_source/StripePayment.tsx","../src/components/payment_source/WireTransferPayment.tsx","../src/components/prices/Price.tsx","../src/components/prices/PricesContainer.tsx","../src/components/shipments/Shipment.tsx","../src/components/shipments/ShipmentField.tsx","../src/components/shipments/ShipmentsContainer.tsx","../src/components/shipments/ShipmentsCount.tsx","../src/components/shipping_methods/ShippingMethod.tsx","../src/components/shipping_methods/ShippingMethodName.tsx","../src/components/shipping_methods/ShippingMethodPrice.tsx","../src/components/shipping_methods/ShippingMethodRadioButton.tsx","../src/components/skus/AvailabilityContainer.tsx","../src/components/skus/AvailabilityTemplate.tsx","../src/components/skus/DeliveryLeadTime.tsx","../src/components/skus/SkuField.tsx","../src/components/skus/SkuList.tsx","../src/components/skus/SkuListsContainer.tsx","../src/components/skus/Skus.tsx","../src/components/skus/SkusContainer.tsx","../src/components/stock_transfers/StockTransfer.tsx","../src/components/stock_transfers/StockTransferField.tsx","../src/components/utils/AddressCardsTemplate.tsx","../src/components/utils/BaseField.tsx","../src/components/utils/BaseInput.tsx","../src/components/utils/BaseOrderPrice.tsx","../src/components/utils/BaseSelect.tsx","../src/components/utils/ErrorBoundary.tsx","../src/components/utils/GenericFieldComponent.tsx","../src/components/utils/Parent.tsx","../src/components/utils/PaymentCardsTemplate.tsx","../src/components/utils/PriceTemplate.tsx","../src/components/utils/getAllErrors.tsx","../src/config/currency.ts","../src/context/AddressChildrenContext.ts","../src/context/AddressContext.ts","../src/context/AvailabilityContext.ts","../src/context/BillingAddressContext.ts","../src/context/BillingAddressFormContext.ts","../src/context/CommerceLayerContext.ts","../src/context/CouponAndGiftCardFormContext.ts","../src/context/CustomerAddressFormContext.ts","../src/context/CustomerContext.ts","../src/context/CustomerPaymentSourceContext.ts","../src/context/ExternalFunctionContext.ts","../src/context/GiftCardContext.ts","../src/context/InStockSubscriptionContext.ts","../src/context/LineItemChildrenContext.ts","../src/context/LineItemContext.ts","../src/context/LineItemOptionChildrenContext.ts","../src/context/OrderContext.ts","../src/context/OrderListChildrenContext.ts","../src/context/OrderListPaginationContext.ts","../src/context/OrderStorageContext.ts","../src/context/ParcelChildrenContext.ts","../src/context/ParcelLineItemChildrenContext.ts","../src/context/PaymentMethodChildrenContext.ts","../src/context/PaymentMethodContext.ts","../src/context/PaymentSourceContext.ts","../src/context/PlaceOrderContext.ts","../src/context/PricesContext.ts","../src/context/ShipmentChildrenContext.ts","../src/context/ShipmentContext.ts","../src/context/ShippingAddressContext.ts","../src/context/ShippingAddressFormContext.ts","../src/context/ShippingMethodChildrenContext.ts","../src/context/SkuChildrenContext.ts","../src/context/SkuContext.ts","../src/context/SkuListsContext.ts","../src/context/StockTransferChildrenContext.ts","../src/hooks/useCommerceLayer.ts","../src/hooks/useCustomerContainer.ts","../src/hooks/useOrderContainer.ts","../src/reducers/AddressReducer.ts","../src/reducers/AvailabilityReducer.ts","../src/reducers/BillingAddressReducer.ts","../src/reducers/CustomerReducer.ts","../src/reducers/GiftCardReducer.ts","../src/reducers/InStockSubscriptionReducer.ts","../src/reducers/LineItemReducer.ts","../src/reducers/OrderReducer.ts","../src/reducers/PaymentMethodReducer.ts","../src/reducers/PlaceOrderReducer.ts","../src/reducers/PriceReducer.ts","../src/reducers/ShipmentReducer.ts","../src/reducers/ShippingAddressReducer.ts","../src/reducers/SkuListsReducer.ts","../src/reducers/SkuReducer.ts","../src/typings/environment.d.ts","../src/typings/errors.ts","../src/typings/globals.ts","../src/typings/index.ts","../src/utils/PropsType.ts","../src/utils/addressesManager.ts","../src/utils/baseReducer.ts","../src/utils/browserInfo.ts","../src/utils/canPlaceOrder.ts","../src/utils/checkIncludeResource.ts","../src/utils/compareObjAttribute.ts","../src/utils/countryStateCity.ts","../src/utils/customMessages.ts","../src/utils/customerOrderOptions.ts","../src/utils/events.ts","../src/utils/expressPaymentHelper.ts","../src/utils/filterChildren.ts","../src/utils/formCleaner.ts","../src/utils/getAmount.ts","../src/utils/getApplicationLink.ts","../src/utils/getCardDetails.ts","../src/utils/getCustomerIdByToken.ts","../src/utils/getDomain.ts","../src/utils/getErrors.ts","../src/utils/getLineItemsCount.ts","../src/utils/getLoaderComponent.tsx","../src/utils/getPaymentAttributes.ts","../src/utils/getPrices.tsx","../src/utils/getPublicIp.ts","../src/utils/getSdk.ts","../src/utils/getSkus.ts","../src/utils/hasSubscriptions.ts","../src/utils/icons.tsx","../src/utils/isDate.ts","../src/utils/isEmpty.ts","../src/utils/isGuestToken.ts","../src/utils/isJSON.ts","../src/utils/jwt.ts","../src/utils/localStorage.ts","../src/utils/omit.ts","../src/utils/organization.ts","../src/utils/pick.ts","../src/utils/placeholderImages.ts","../src/utils/promisify.ts","../src/utils/replace.ts","../src/utils/scrollbarWidth.ts","../src/utils/shipments.ts","../src/utils/snakeToCamelCase.ts","../src/utils/triggerAttributeHelper.ts","../src/utils/updateOrderSubscriptionCustomerPaymentSource.ts","../src/utils/validateFormFields.ts","../src/utils/hooks/useCustomContext.ts","../src/utils/hooks/useExternalScript.ts","../src/utils/stripe/retrievePaymentIntent.ts"],"version":"5.7.2"}
|
|
1
|
+
{"root":["../src/index.ts","../src/components/ExternalFunction.tsx","../src/components/MetadataInput.tsx","../src/components/SubmitButton.tsx","../src/components/addresses/Address.tsx","../src/components/addresses/AddressCountrySelector.tsx","../src/components/addresses/AddressField.tsx","../src/components/addresses/AddressInput.tsx","../src/components/addresses/AddressInputSelect.tsx","../src/components/addresses/AddressStateSelector.tsx","../src/components/addresses/AddressesContainer.tsx","../src/components/addresses/AddressesEmpty.tsx","../src/components/addresses/BillingAddressContainer.tsx","../src/components/addresses/BillingAddressForm.tsx","../src/components/addresses/SaveAddressesButton.tsx","../src/components/addresses/ShippingAddressContainer.tsx","../src/components/addresses/ShippingAddressForm.tsx","../src/components/auth/CommerceLayer.tsx","../src/components/customers/CustomerAddressForm.tsx","../src/components/customers/CustomerContainer.tsx","../src/components/customers/CustomerField.tsx","../src/components/customers/CustomerInput.tsx","../src/components/customers/CustomerPaymentSource.tsx","../src/components/customers/CustomerPaymentSourceEmpty.tsx","../src/components/customers/MyAccountLink.tsx","../src/components/customers/MyIdentityLink.tsx","../src/components/customers/SaveCustomerButton.tsx","../src/components/errors/Errors.tsx","../src/components/gift_cards/GiftCard.tsx","../src/components/gift_cards/GiftCardContainer.tsx","../src/components/gift_cards/GiftCardCurrencySelector.tsx","../src/components/gift_cards/GiftCardInput.tsx","../src/components/gift_cards/GiftCardOrCouponCode.tsx","../src/components/gift_cards/GiftCardOrCouponForm.tsx","../src/components/gift_cards/GiftCardOrCouponInput.tsx","../src/components/gift_cards/GiftCardOrCouponRemoveButton.tsx","../src/components/gift_cards/GiftCardOrCouponSubmit.tsx","../src/components/gift_cards/GiftCardRecipientInput.tsx","../src/components/in_stock_subscriptions/InStockSubscriptionButton.tsx","../src/components/in_stock_subscriptions/InStockSubscriptionsContainer.tsx","../src/components/line_items/LineItem.tsx","../src/components/line_items/LineItemAmount.tsx","../src/components/line_items/LineItemCode.tsx","../src/components/line_items/LineItemField.tsx","../src/components/line_items/LineItemImage.tsx","../src/components/line_items/LineItemName.tsx","../src/components/line_items/LineItemOption.tsx","../src/components/line_items/LineItemOptions.tsx","../src/components/line_items/LineItemQuantity.tsx","../src/components/line_items/LineItemRemoveLink.tsx","../src/components/line_items/LineItemsContainer.tsx","../src/components/line_items/LineItemsCount.tsx","../src/components/line_items/LineItemsEmpty.tsx","../src/components/orders/AddToCartButton.tsx","../src/components/orders/AdjustmentAmount.tsx","../src/components/orders/CartLink.tsx","../src/components/orders/CheckoutLink.tsx","../src/components/orders/DiscountAmount.tsx","../src/components/orders/GiftCardAmount.tsx","../src/components/orders/HostedCart.tsx","../src/components/orders/OrderContainer.tsx","../src/components/orders/OrderList.tsx","../src/components/orders/OrderListEmpty.tsx","../src/components/orders/OrderListPaginationButtons.tsx","../src/components/orders/OrderListPaginationInfo.tsx","../src/components/orders/OrderListRow.tsx","../src/components/orders/OrderNumber.tsx","../src/components/orders/OrderStorage.tsx","../src/components/orders/PaymentMethodAmount.tsx","../src/components/orders/PlaceOrderButton.tsx","../src/components/orders/PlaceOrderContainer.tsx","../src/components/orders/PrivacyAndTermsCheckbox.tsx","../src/components/orders/ShippingAmount.tsx","../src/components/orders/SubTotalAmount.tsx","../src/components/orders/TaxesAmount.tsx","../src/components/orders/TotalAmount.tsx","../src/components/parcels/ParcelField.tsx","../src/components/parcels/ParcelLineItem.tsx","../src/components/parcels/ParcelLineItemField.tsx","../src/components/parcels/ParcelLineItemsCount.tsx","../src/components/parcels/Parcels.tsx","../src/components/parcels/ParcelsCount.tsx","../src/components/payment_gateways/AdyenGateway.tsx","../src/components/payment_gateways/BraintreeGateway.tsx","../src/components/payment_gateways/CheckoutComGateway.tsx","../src/components/payment_gateways/ExternalGateway.tsx","../src/components/payment_gateways/KlarnaGateway.tsx","../src/components/payment_gateways/PaymentGateway.tsx","../src/components/payment_gateways/PaypalGateway.tsx","../src/components/payment_gateways/StripeGateway.tsx","../src/components/payment_gateways/WireTransferGateway.tsx","../src/components/payment_methods/PaymentMethod.tsx","../src/components/payment_methods/PaymentMethodName.tsx","../src/components/payment_methods/PaymentMethodPrice.tsx","../src/components/payment_methods/PaymentMethodRadioButton.tsx","../src/components/payment_methods/PaymentMethodsContainer.tsx","../src/components/payment_source/AdyenPayment.tsx","../src/components/payment_source/BraintreePayment.tsx","../src/components/payment_source/CheckoutComPayment.tsx","../src/components/payment_source/ExternalPayment.tsx","../src/components/payment_source/KlarnaPayment.tsx","../src/components/payment_source/PaymentSource.tsx","../src/components/payment_source/PaymentSourceBrandIcon.tsx","../src/components/payment_source/PaymentSourceBrandName.tsx","../src/components/payment_source/PaymentSourceDetail.tsx","../src/components/payment_source/PaymentSourceEditButton.tsx","../src/components/payment_source/PaypalPayment.tsx","../src/components/payment_source/StripeExpressPayment.tsx","../src/components/payment_source/StripePayment.tsx","../src/components/payment_source/WireTransferPayment.tsx","../src/components/prices/Price.tsx","../src/components/prices/PricesContainer.tsx","../src/components/shipments/Shipment.tsx","../src/components/shipments/ShipmentField.tsx","../src/components/shipments/ShipmentsContainer.tsx","../src/components/shipments/ShipmentsCount.tsx","../src/components/shipping_methods/ShippingMethod.tsx","../src/components/shipping_methods/ShippingMethodName.tsx","../src/components/shipping_methods/ShippingMethodPrice.tsx","../src/components/shipping_methods/ShippingMethodRadioButton.tsx","../src/components/skus/AvailabilityContainer.tsx","../src/components/skus/AvailabilityTemplate.tsx","../src/components/skus/DeliveryLeadTime.tsx","../src/components/skus/SkuField.tsx","../src/components/skus/SkuList.tsx","../src/components/skus/SkuListsContainer.tsx","../src/components/skus/Skus.tsx","../src/components/skus/SkusContainer.tsx","../src/components/stock_transfers/StockTransfer.tsx","../src/components/stock_transfers/StockTransferField.tsx","../src/components/utils/AddressCardsTemplate.tsx","../src/components/utils/BaseField.tsx","../src/components/utils/BaseInput.tsx","../src/components/utils/BaseOrderPrice.tsx","../src/components/utils/BaseSelect.tsx","../src/components/utils/ErrorBoundary.tsx","../src/components/utils/GenericFieldComponent.tsx","../src/components/utils/Parent.tsx","../src/components/utils/PaymentCardsTemplate.tsx","../src/components/utils/PriceTemplate.tsx","../src/components/utils/getAllErrors.tsx","../src/config/currency.ts","../src/context/AddressChildrenContext.ts","../src/context/AddressContext.ts","../src/context/AvailabilityContext.ts","../src/context/BillingAddressContext.ts","../src/context/BillingAddressFormContext.ts","../src/context/CommerceLayerContext.ts","../src/context/CouponAndGiftCardFormContext.ts","../src/context/CustomerAddressFormContext.ts","../src/context/CustomerContext.ts","../src/context/CustomerPaymentSourceContext.ts","../src/context/ExternalFunctionContext.ts","../src/context/GiftCardContext.ts","../src/context/InStockSubscriptionContext.ts","../src/context/LineItemChildrenContext.ts","../src/context/LineItemContext.ts","../src/context/LineItemOptionChildrenContext.ts","../src/context/OrderContext.ts","../src/context/OrderListChildrenContext.ts","../src/context/OrderListPaginationContext.ts","../src/context/OrderStorageContext.ts","../src/context/ParcelChildrenContext.ts","../src/context/ParcelLineItemChildrenContext.ts","../src/context/PaymentMethodChildrenContext.ts","../src/context/PaymentMethodContext.ts","../src/context/PaymentSourceContext.ts","../src/context/PlaceOrderContext.ts","../src/context/PricesContext.ts","../src/context/ShipmentChildrenContext.ts","../src/context/ShipmentContext.ts","../src/context/ShippingAddressContext.ts","../src/context/ShippingAddressFormContext.ts","../src/context/ShippingMethodChildrenContext.ts","../src/context/SkuChildrenContext.ts","../src/context/SkuContext.ts","../src/context/SkuListsContext.ts","../src/context/StockTransferChildrenContext.ts","../src/hooks/useCommerceLayer.ts","../src/hooks/useCustomerContainer.ts","../src/hooks/useOrderContainer.ts","../src/reducers/AddressReducer.ts","../src/reducers/AvailabilityReducer.ts","../src/reducers/BillingAddressReducer.ts","../src/reducers/CustomerReducer.ts","../src/reducers/GiftCardReducer.ts","../src/reducers/InStockSubscriptionReducer.ts","../src/reducers/LineItemReducer.ts","../src/reducers/OrderReducer.ts","../src/reducers/PaymentMethodReducer.ts","../src/reducers/PlaceOrderReducer.ts","../src/reducers/PriceReducer.ts","../src/reducers/ShipmentReducer.ts","../src/reducers/ShippingAddressReducer.ts","../src/reducers/SkuListsReducer.ts","../src/reducers/SkuReducer.ts","../src/typings/environment.d.ts","../src/typings/errors.ts","../src/typings/globals.ts","../src/typings/index.ts","../src/utils/PropsType.ts","../src/utils/addressesManager.ts","../src/utils/baseReducer.ts","../src/utils/browserInfo.ts","../src/utils/canPlaceOrder.ts","../src/utils/checkIncludeResource.ts","../src/utils/compareObjAttribute.ts","../src/utils/countryStateCity.ts","../src/utils/customMessages.ts","../src/utils/customerOrderOptions.ts","../src/utils/events.ts","../src/utils/expressPaymentHelper.ts","../src/utils/filterChildren.ts","../src/utils/formCleaner.ts","../src/utils/getAmount.ts","../src/utils/getApplicationLink.ts","../src/utils/getCardDetails.ts","../src/utils/getCustomerIdByToken.ts","../src/utils/getDomain.ts","../src/utils/getErrors.ts","../src/utils/getLineItemsCount.ts","../src/utils/getLoaderComponent.tsx","../src/utils/getPaymentAttributes.ts","../src/utils/getPrices.tsx","../src/utils/getPublicIp.ts","../src/utils/getSdk.ts","../src/utils/getSkus.ts","../src/utils/hasSubscriptions.ts","../src/utils/icons.tsx","../src/utils/isDate.ts","../src/utils/isEmpty.ts","../src/utils/isGuestToken.ts","../src/utils/isJSON.ts","../src/utils/jwt.ts","../src/utils/localStorage.ts","../src/utils/omit.ts","../src/utils/organization.ts","../src/utils/pick.ts","../src/utils/placeholderImages.ts","../src/utils/promisify.ts","../src/utils/replace.ts","../src/utils/scrollbarWidth.ts","../src/utils/shipments.ts","../src/utils/snakeToCamelCase.ts","../src/utils/triggerAttributeHelper.ts","../src/utils/updateOrderSubscriptionCustomerPaymentSource.ts","../src/utils/validateFormFields.ts","../src/utils/hooks/useCustomContext.ts","../src/utils/hooks/useExternalScript.ts","../src/utils/payment-methods/sortPaymentMethods.ts","../src/utils/stripe/retrievePaymentIntent.ts"],"version":"5.7.2"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/index.ts","../src/components/ExternalFunction.tsx","../src/components/MetadataInput.tsx","../src/components/SubmitButton.tsx","../src/components/addresses/Address.tsx","../src/components/addresses/AddressCountrySelector.tsx","../src/components/addresses/AddressField.tsx","../src/components/addresses/AddressInput.tsx","../src/components/addresses/AddressInputSelect.tsx","../src/components/addresses/AddressStateSelector.tsx","../src/components/addresses/AddressesContainer.tsx","../src/components/addresses/AddressesEmpty.tsx","../src/components/addresses/BillingAddressContainer.tsx","../src/components/addresses/BillingAddressForm.tsx","../src/components/addresses/SaveAddressesButton.tsx","../src/components/addresses/ShippingAddressContainer.tsx","../src/components/addresses/ShippingAddressForm.tsx","../src/components/auth/CommerceLayer.tsx","../src/components/customers/CustomerAddressForm.tsx","../src/components/customers/CustomerContainer.tsx","../src/components/customers/CustomerField.tsx","../src/components/customers/CustomerInput.tsx","../src/components/customers/CustomerPaymentSource.tsx","../src/components/customers/CustomerPaymentSourceEmpty.tsx","../src/components/customers/MyAccountLink.tsx","../src/components/customers/MyIdentityLink.tsx","../src/components/customers/SaveCustomerButton.tsx","../src/components/errors/Errors.tsx","../src/components/gift_cards/GiftCard.tsx","../src/components/gift_cards/GiftCardContainer.tsx","../src/components/gift_cards/GiftCardCurrencySelector.tsx","../src/components/gift_cards/GiftCardInput.tsx","../src/components/gift_cards/GiftCardOrCouponCode.tsx","../src/components/gift_cards/GiftCardOrCouponForm.tsx","../src/components/gift_cards/GiftCardOrCouponInput.tsx","../src/components/gift_cards/GiftCardOrCouponRemoveButton.tsx","../src/components/gift_cards/GiftCardOrCouponSubmit.tsx","../src/components/gift_cards/GiftCardRecipientInput.tsx","../src/components/in_stock_subscriptions/InStockSubscriptionButton.tsx","../src/components/in_stock_subscriptions/InStockSubscriptionsContainer.tsx","../src/components/line_items/LineItem.tsx","../src/components/line_items/LineItemAmount.tsx","../src/components/line_items/LineItemCode.tsx","../src/components/line_items/LineItemField.tsx","../src/components/line_items/LineItemImage.tsx","../src/components/line_items/LineItemName.tsx","../src/components/line_items/LineItemOption.tsx","../src/components/line_items/LineItemOptions.tsx","../src/components/line_items/LineItemQuantity.tsx","../src/components/line_items/LineItemRemoveLink.tsx","../src/components/line_items/LineItemsContainer.tsx","../src/components/line_items/LineItemsCount.tsx","../src/components/line_items/LineItemsEmpty.tsx","../src/components/orders/AddToCartButton.tsx","../src/components/orders/AdjustmentAmount.tsx","../src/components/orders/CartLink.tsx","../src/components/orders/CheckoutLink.tsx","../src/components/orders/DiscountAmount.tsx","../src/components/orders/GiftCardAmount.tsx","../src/components/orders/HostedCart.tsx","../src/components/orders/OrderContainer.tsx","../src/components/orders/OrderList.tsx","../src/components/orders/OrderListEmpty.tsx","../src/components/orders/OrderListPaginationButtons.tsx","../src/components/orders/OrderListPaginationInfo.tsx","../src/components/orders/OrderListRow.tsx","../src/components/orders/OrderNumber.tsx","../src/components/orders/OrderStorage.tsx","../src/components/orders/PaymentMethodAmount.tsx","../src/components/orders/PlaceOrderButton.tsx","../src/components/orders/PlaceOrderContainer.tsx","../src/components/orders/PrivacyAndTermsCheckbox.tsx","../src/components/orders/ShippingAmount.tsx","../src/components/orders/SubTotalAmount.tsx","../src/components/orders/TaxesAmount.tsx","../src/components/orders/TotalAmount.tsx","../src/components/parcels/ParcelField.tsx","../src/components/parcels/ParcelLineItem.tsx","../src/components/parcels/ParcelLineItemField.tsx","../src/components/parcels/ParcelLineItemsCount.tsx","../src/components/parcels/Parcels.tsx","../src/components/parcels/ParcelsCount.tsx","../src/components/payment_gateways/AdyenGateway.tsx","../src/components/payment_gateways/BraintreeGateway.tsx","../src/components/payment_gateways/CheckoutComGateway.tsx","../src/components/payment_gateways/ExternalGateway.tsx","../src/components/payment_gateways/KlarnaGateway.tsx","../src/components/payment_gateways/PaymentGateway.tsx","../src/components/payment_gateways/PaypalGateway.tsx","../src/components/payment_gateways/StripeGateway.tsx","../src/components/payment_gateways/WireTransferGateway.tsx","../src/components/payment_methods/PaymentMethod.tsx","../src/components/payment_methods/PaymentMethodName.tsx","../src/components/payment_methods/PaymentMethodPrice.tsx","../src/components/payment_methods/PaymentMethodRadioButton.tsx","../src/components/payment_methods/PaymentMethodsContainer.tsx","../src/components/payment_source/AdyenPayment.tsx","../src/components/payment_source/BraintreePayment.tsx","../src/components/payment_source/CheckoutComPayment.tsx","../src/components/payment_source/ExternalPayment.tsx","../src/components/payment_source/KlarnaPayment.tsx","../src/components/payment_source/PaymentSource.tsx","../src/components/payment_source/PaymentSourceBrandIcon.tsx","../src/components/payment_source/PaymentSourceBrandName.tsx","../src/components/payment_source/PaymentSourceDetail.tsx","../src/components/payment_source/PaymentSourceEditButton.tsx","../src/components/payment_source/PaypalPayment.tsx","../src/components/payment_source/StripeExpressPayment.tsx","../src/components/payment_source/StripePayment.tsx","../src/components/payment_source/WireTransferPayment.tsx","../src/components/prices/Price.tsx","../src/components/prices/PricesContainer.tsx","../src/components/shipments/Shipment.tsx","../src/components/shipments/ShipmentField.tsx","../src/components/shipments/ShipmentsContainer.tsx","../src/components/shipments/ShipmentsCount.tsx","../src/components/shipping_methods/ShippingMethod.tsx","../src/components/shipping_methods/ShippingMethodName.tsx","../src/components/shipping_methods/ShippingMethodPrice.tsx","../src/components/shipping_methods/ShippingMethodRadioButton.tsx","../src/components/skus/AvailabilityContainer.tsx","../src/components/skus/AvailabilityTemplate.tsx","../src/components/skus/DeliveryLeadTime.tsx","../src/components/skus/SkuField.tsx","../src/components/skus/SkuList.tsx","../src/components/skus/SkuListsContainer.tsx","../src/components/skus/Skus.tsx","../src/components/skus/SkusContainer.tsx","../src/components/stock_transfers/StockTransfer.tsx","../src/components/stock_transfers/StockTransferField.tsx","../src/components/utils/AddressCardsTemplate.tsx","../src/components/utils/BaseField.tsx","../src/components/utils/BaseInput.tsx","../src/components/utils/BaseOrderPrice.tsx","../src/components/utils/BaseSelect.tsx","../src/components/utils/ErrorBoundary.tsx","../src/components/utils/GenericFieldComponent.tsx","../src/components/utils/Parent.tsx","../src/components/utils/PaymentCardsTemplate.tsx","../src/components/utils/PriceTemplate.tsx","../src/components/utils/getAllErrors.tsx","../src/config/currency.ts","../src/context/AddressChildrenContext.ts","../src/context/AddressContext.ts","../src/context/AvailabilityContext.ts","../src/context/BillingAddressContext.ts","../src/context/BillingAddressFormContext.ts","../src/context/CommerceLayerContext.ts","../src/context/CouponAndGiftCardFormContext.ts","../src/context/CustomerAddressFormContext.ts","../src/context/CustomerContext.ts","../src/context/CustomerPaymentSourceContext.ts","../src/context/ExternalFunctionContext.ts","../src/context/GiftCardContext.ts","../src/context/InStockSubscriptionContext.ts","../src/context/LineItemChildrenContext.ts","../src/context/LineItemContext.ts","../src/context/LineItemOptionChildrenContext.ts","../src/context/OrderContext.ts","../src/context/OrderListChildrenContext.ts","../src/context/OrderListPaginationContext.ts","../src/context/OrderStorageContext.ts","../src/context/ParcelChildrenContext.ts","../src/context/ParcelLineItemChildrenContext.ts","../src/context/PaymentMethodChildrenContext.ts","../src/context/PaymentMethodContext.ts","../src/context/PaymentSourceContext.ts","../src/context/PlaceOrderContext.ts","../src/context/PricesContext.ts","../src/context/ShipmentChildrenContext.ts","../src/context/ShipmentContext.ts","../src/context/ShippingAddressContext.ts","../src/context/ShippingAddressFormContext.ts","../src/context/ShippingMethodChildrenContext.ts","../src/context/SkuChildrenContext.ts","../src/context/SkuContext.ts","../src/context/SkuListsContext.ts","../src/context/StockTransferChildrenContext.ts","../src/hooks/useCommerceLayer.ts","../src/hooks/useCustomerContainer.ts","../src/hooks/useOrderContainer.ts","../src/reducers/AddressReducer.ts","../src/reducers/AvailabilityReducer.ts","../src/reducers/BillingAddressReducer.ts","../src/reducers/CustomerReducer.ts","../src/reducers/GiftCardReducer.ts","../src/reducers/InStockSubscriptionReducer.ts","../src/reducers/LineItemReducer.ts","../src/reducers/OrderReducer.ts","../src/reducers/PaymentMethodReducer.ts","../src/reducers/PlaceOrderReducer.ts","../src/reducers/PriceReducer.ts","../src/reducers/ShipmentReducer.ts","../src/reducers/ShippingAddressReducer.ts","../src/reducers/SkuListsReducer.ts","../src/reducers/SkuReducer.ts","../src/typings/environment.d.ts","../src/typings/errors.ts","../src/typings/globals.ts","../src/typings/index.ts","../src/utils/PropsType.ts","../src/utils/addressesManager.ts","../src/utils/baseReducer.ts","../src/utils/browserInfo.ts","../src/utils/canPlaceOrder.ts","../src/utils/checkIncludeResource.ts","../src/utils/compareObjAttribute.ts","../src/utils/countryStateCity.ts","../src/utils/customMessages.ts","../src/utils/customerOrderOptions.ts","../src/utils/events.ts","../src/utils/expressPaymentHelper.ts","../src/utils/filterChildren.ts","../src/utils/formCleaner.ts","../src/utils/getAmount.ts","../src/utils/getApplicationLink.ts","../src/utils/getCardDetails.ts","../src/utils/getCustomerIdByToken.ts","../src/utils/getDomain.ts","../src/utils/getErrors.ts","../src/utils/getLineItemsCount.ts","../src/utils/getLoaderComponent.tsx","../src/utils/getPaymentAttributes.ts","../src/utils/getPrices.tsx","../src/utils/getPublicIp.ts","../src/utils/getSdk.ts","../src/utils/getSkus.ts","../src/utils/hasSubscriptions.ts","../src/utils/icons.tsx","../src/utils/isDate.ts","../src/utils/isEmpty.ts","../src/utils/isGuestToken.ts","../src/utils/isJSON.ts","../src/utils/jwt.ts","../src/utils/localStorage.ts","../src/utils/omit.ts","../src/utils/organization.ts","../src/utils/pick.ts","../src/utils/placeholderImages.ts","../src/utils/promisify.ts","../src/utils/replace.ts","../src/utils/scrollbarWidth.ts","../src/utils/shipments.ts","../src/utils/snakeToCamelCase.ts","../src/utils/triggerAttributeHelper.ts","../src/utils/updateOrderSubscriptionCustomerPaymentSource.ts","../src/utils/validateFormFields.ts","../src/utils/hooks/useCustomContext.ts","../src/utils/hooks/useExternalScript.ts","../src/utils/stripe/retrievePaymentIntent.ts"],"version":"5.7.2"}
|
|
1
|
+
{"root":["../src/index.ts","../src/components/ExternalFunction.tsx","../src/components/MetadataInput.tsx","../src/components/SubmitButton.tsx","../src/components/addresses/Address.tsx","../src/components/addresses/AddressCountrySelector.tsx","../src/components/addresses/AddressField.tsx","../src/components/addresses/AddressInput.tsx","../src/components/addresses/AddressInputSelect.tsx","../src/components/addresses/AddressStateSelector.tsx","../src/components/addresses/AddressesContainer.tsx","../src/components/addresses/AddressesEmpty.tsx","../src/components/addresses/BillingAddressContainer.tsx","../src/components/addresses/BillingAddressForm.tsx","../src/components/addresses/SaveAddressesButton.tsx","../src/components/addresses/ShippingAddressContainer.tsx","../src/components/addresses/ShippingAddressForm.tsx","../src/components/auth/CommerceLayer.tsx","../src/components/customers/CustomerAddressForm.tsx","../src/components/customers/CustomerContainer.tsx","../src/components/customers/CustomerField.tsx","../src/components/customers/CustomerInput.tsx","../src/components/customers/CustomerPaymentSource.tsx","../src/components/customers/CustomerPaymentSourceEmpty.tsx","../src/components/customers/MyAccountLink.tsx","../src/components/customers/MyIdentityLink.tsx","../src/components/customers/SaveCustomerButton.tsx","../src/components/errors/Errors.tsx","../src/components/gift_cards/GiftCard.tsx","../src/components/gift_cards/GiftCardContainer.tsx","../src/components/gift_cards/GiftCardCurrencySelector.tsx","../src/components/gift_cards/GiftCardInput.tsx","../src/components/gift_cards/GiftCardOrCouponCode.tsx","../src/components/gift_cards/GiftCardOrCouponForm.tsx","../src/components/gift_cards/GiftCardOrCouponInput.tsx","../src/components/gift_cards/GiftCardOrCouponRemoveButton.tsx","../src/components/gift_cards/GiftCardOrCouponSubmit.tsx","../src/components/gift_cards/GiftCardRecipientInput.tsx","../src/components/in_stock_subscriptions/InStockSubscriptionButton.tsx","../src/components/in_stock_subscriptions/InStockSubscriptionsContainer.tsx","../src/components/line_items/LineItem.tsx","../src/components/line_items/LineItemAmount.tsx","../src/components/line_items/LineItemCode.tsx","../src/components/line_items/LineItemField.tsx","../src/components/line_items/LineItemImage.tsx","../src/components/line_items/LineItemName.tsx","../src/components/line_items/LineItemOption.tsx","../src/components/line_items/LineItemOptions.tsx","../src/components/line_items/LineItemQuantity.tsx","../src/components/line_items/LineItemRemoveLink.tsx","../src/components/line_items/LineItemsContainer.tsx","../src/components/line_items/LineItemsCount.tsx","../src/components/line_items/LineItemsEmpty.tsx","../src/components/orders/AddToCartButton.tsx","../src/components/orders/AdjustmentAmount.tsx","../src/components/orders/CartLink.tsx","../src/components/orders/CheckoutLink.tsx","../src/components/orders/DiscountAmount.tsx","../src/components/orders/GiftCardAmount.tsx","../src/components/orders/HostedCart.tsx","../src/components/orders/OrderContainer.tsx","../src/components/orders/OrderList.tsx","../src/components/orders/OrderListEmpty.tsx","../src/components/orders/OrderListPaginationButtons.tsx","../src/components/orders/OrderListPaginationInfo.tsx","../src/components/orders/OrderListRow.tsx","../src/components/orders/OrderNumber.tsx","../src/components/orders/OrderStorage.tsx","../src/components/orders/PaymentMethodAmount.tsx","../src/components/orders/PlaceOrderButton.tsx","../src/components/orders/PlaceOrderContainer.tsx","../src/components/orders/PrivacyAndTermsCheckbox.tsx","../src/components/orders/ShippingAmount.tsx","../src/components/orders/SubTotalAmount.tsx","../src/components/orders/TaxesAmount.tsx","../src/components/orders/TotalAmount.tsx","../src/components/parcels/ParcelField.tsx","../src/components/parcels/ParcelLineItem.tsx","../src/components/parcels/ParcelLineItemField.tsx","../src/components/parcels/ParcelLineItemsCount.tsx","../src/components/parcels/Parcels.tsx","../src/components/parcels/ParcelsCount.tsx","../src/components/payment_gateways/AdyenGateway.tsx","../src/components/payment_gateways/BraintreeGateway.tsx","../src/components/payment_gateways/CheckoutComGateway.tsx","../src/components/payment_gateways/ExternalGateway.tsx","../src/components/payment_gateways/KlarnaGateway.tsx","../src/components/payment_gateways/PaymentGateway.tsx","../src/components/payment_gateways/PaypalGateway.tsx","../src/components/payment_gateways/StripeGateway.tsx","../src/components/payment_gateways/WireTransferGateway.tsx","../src/components/payment_methods/PaymentMethod.tsx","../src/components/payment_methods/PaymentMethodName.tsx","../src/components/payment_methods/PaymentMethodPrice.tsx","../src/components/payment_methods/PaymentMethodRadioButton.tsx","../src/components/payment_methods/PaymentMethodsContainer.tsx","../src/components/payment_source/AdyenPayment.tsx","../src/components/payment_source/BraintreePayment.tsx","../src/components/payment_source/CheckoutComPayment.tsx","../src/components/payment_source/ExternalPayment.tsx","../src/components/payment_source/KlarnaPayment.tsx","../src/components/payment_source/PaymentSource.tsx","../src/components/payment_source/PaymentSourceBrandIcon.tsx","../src/components/payment_source/PaymentSourceBrandName.tsx","../src/components/payment_source/PaymentSourceDetail.tsx","../src/components/payment_source/PaymentSourceEditButton.tsx","../src/components/payment_source/PaypalPayment.tsx","../src/components/payment_source/StripeExpressPayment.tsx","../src/components/payment_source/StripePayment.tsx","../src/components/payment_source/WireTransferPayment.tsx","../src/components/prices/Price.tsx","../src/components/prices/PricesContainer.tsx","../src/components/shipments/Shipment.tsx","../src/components/shipments/ShipmentField.tsx","../src/components/shipments/ShipmentsContainer.tsx","../src/components/shipments/ShipmentsCount.tsx","../src/components/shipping_methods/ShippingMethod.tsx","../src/components/shipping_methods/ShippingMethodName.tsx","../src/components/shipping_methods/ShippingMethodPrice.tsx","../src/components/shipping_methods/ShippingMethodRadioButton.tsx","../src/components/skus/AvailabilityContainer.tsx","../src/components/skus/AvailabilityTemplate.tsx","../src/components/skus/DeliveryLeadTime.tsx","../src/components/skus/SkuField.tsx","../src/components/skus/SkuList.tsx","../src/components/skus/SkuListsContainer.tsx","../src/components/skus/Skus.tsx","../src/components/skus/SkusContainer.tsx","../src/components/stock_transfers/StockTransfer.tsx","../src/components/stock_transfers/StockTransferField.tsx","../src/components/utils/AddressCardsTemplate.tsx","../src/components/utils/BaseField.tsx","../src/components/utils/BaseInput.tsx","../src/components/utils/BaseOrderPrice.tsx","../src/components/utils/BaseSelect.tsx","../src/components/utils/ErrorBoundary.tsx","../src/components/utils/GenericFieldComponent.tsx","../src/components/utils/Parent.tsx","../src/components/utils/PaymentCardsTemplate.tsx","../src/components/utils/PriceTemplate.tsx","../src/components/utils/getAllErrors.tsx","../src/config/currency.ts","../src/context/AddressChildrenContext.ts","../src/context/AddressContext.ts","../src/context/AvailabilityContext.ts","../src/context/BillingAddressContext.ts","../src/context/BillingAddressFormContext.ts","../src/context/CommerceLayerContext.ts","../src/context/CouponAndGiftCardFormContext.ts","../src/context/CustomerAddressFormContext.ts","../src/context/CustomerContext.ts","../src/context/CustomerPaymentSourceContext.ts","../src/context/ExternalFunctionContext.ts","../src/context/GiftCardContext.ts","../src/context/InStockSubscriptionContext.ts","../src/context/LineItemChildrenContext.ts","../src/context/LineItemContext.ts","../src/context/LineItemOptionChildrenContext.ts","../src/context/OrderContext.ts","../src/context/OrderListChildrenContext.ts","../src/context/OrderListPaginationContext.ts","../src/context/OrderStorageContext.ts","../src/context/ParcelChildrenContext.ts","../src/context/ParcelLineItemChildrenContext.ts","../src/context/PaymentMethodChildrenContext.ts","../src/context/PaymentMethodContext.ts","../src/context/PaymentSourceContext.ts","../src/context/PlaceOrderContext.ts","../src/context/PricesContext.ts","../src/context/ShipmentChildrenContext.ts","../src/context/ShipmentContext.ts","../src/context/ShippingAddressContext.ts","../src/context/ShippingAddressFormContext.ts","../src/context/ShippingMethodChildrenContext.ts","../src/context/SkuChildrenContext.ts","../src/context/SkuContext.ts","../src/context/SkuListsContext.ts","../src/context/StockTransferChildrenContext.ts","../src/hooks/useCommerceLayer.ts","../src/hooks/useCustomerContainer.ts","../src/hooks/useOrderContainer.ts","../src/reducers/AddressReducer.ts","../src/reducers/AvailabilityReducer.ts","../src/reducers/BillingAddressReducer.ts","../src/reducers/CustomerReducer.ts","../src/reducers/GiftCardReducer.ts","../src/reducers/InStockSubscriptionReducer.ts","../src/reducers/LineItemReducer.ts","../src/reducers/OrderReducer.ts","../src/reducers/PaymentMethodReducer.ts","../src/reducers/PlaceOrderReducer.ts","../src/reducers/PriceReducer.ts","../src/reducers/ShipmentReducer.ts","../src/reducers/ShippingAddressReducer.ts","../src/reducers/SkuListsReducer.ts","../src/reducers/SkuReducer.ts","../src/typings/environment.d.ts","../src/typings/errors.ts","../src/typings/globals.ts","../src/typings/index.ts","../src/utils/PropsType.ts","../src/utils/addressesManager.ts","../src/utils/baseReducer.ts","../src/utils/browserInfo.ts","../src/utils/canPlaceOrder.ts","../src/utils/checkIncludeResource.ts","../src/utils/compareObjAttribute.ts","../src/utils/countryStateCity.ts","../src/utils/customMessages.ts","../src/utils/customerOrderOptions.ts","../src/utils/events.ts","../src/utils/expressPaymentHelper.ts","../src/utils/filterChildren.ts","../src/utils/formCleaner.ts","../src/utils/getAmount.ts","../src/utils/getApplicationLink.ts","../src/utils/getCardDetails.ts","../src/utils/getCustomerIdByToken.ts","../src/utils/getDomain.ts","../src/utils/getErrors.ts","../src/utils/getLineItemsCount.ts","../src/utils/getLoaderComponent.tsx","../src/utils/getPaymentAttributes.ts","../src/utils/getPrices.tsx","../src/utils/getPublicIp.ts","../src/utils/getSdk.ts","../src/utils/getSkus.ts","../src/utils/hasSubscriptions.ts","../src/utils/icons.tsx","../src/utils/isDate.ts","../src/utils/isEmpty.ts","../src/utils/isGuestToken.ts","../src/utils/isJSON.ts","../src/utils/jwt.ts","../src/utils/localStorage.ts","../src/utils/omit.ts","../src/utils/organization.ts","../src/utils/pick.ts","../src/utils/placeholderImages.ts","../src/utils/promisify.ts","../src/utils/replace.ts","../src/utils/scrollbarWidth.ts","../src/utils/shipments.ts","../src/utils/snakeToCamelCase.ts","../src/utils/triggerAttributeHelper.ts","../src/utils/updateOrderSubscriptionCustomerPaymentSource.ts","../src/utils/validateFormFields.ts","../src/utils/hooks/useCustomContext.ts","../src/utils/hooks/useExternalScript.ts","../src/utils/payment-methods/sortPaymentMethods.ts","../src/utils/stripe/retrievePaymentIntent.ts"],"version":"5.7.2"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercelayer/react-components",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.18.0",
|
|
4
4
|
"description": "The Official Commerce Layer React Components",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -165,16 +165,16 @@
|
|
|
165
165
|
},
|
|
166
166
|
"homepage": "https://github.com/commercelayer/commercelayer-react-components#readme",
|
|
167
167
|
"dependencies": {
|
|
168
|
-
"@adyen/adyen-web": "^
|
|
168
|
+
"@adyen/adyen-web": "^6.6.0",
|
|
169
169
|
"@commercelayer/organization-config": "^1.4.12",
|
|
170
|
-
"@commercelayer/sdk": "^6.
|
|
171
|
-
"@stripe/react-stripe-js": "^3.
|
|
172
|
-
"@stripe/stripe-js": "^5.
|
|
173
|
-
"@tanstack/react-table": "^8.
|
|
170
|
+
"@commercelayer/sdk": "^6.27.0",
|
|
171
|
+
"@stripe/react-stripe-js": "^3.1.1",
|
|
172
|
+
"@stripe/stripe-js": "^5.3.0",
|
|
173
|
+
"@tanstack/react-table": "^8.20.6",
|
|
174
174
|
"@types/iframe-resizer": "^3.5.13",
|
|
175
|
-
"braintree-web": "^3.
|
|
175
|
+
"braintree-web": "^3.113.0",
|
|
176
176
|
"frames-react": "^1.2.2",
|
|
177
|
-
"iframe-resizer": "^4.
|
|
177
|
+
"iframe-resizer": "^4.3.6",
|
|
178
178
|
"jwt-decode": "^4.0.0",
|
|
179
179
|
"lodash": "^4.17.21",
|
|
180
180
|
"rapid-form": "2.1.0"
|
|
@@ -194,15 +194,15 @@
|
|
|
194
194
|
"@types/react-window": "^1.8.8",
|
|
195
195
|
"@vitejs/plugin-react": "^4.3.4",
|
|
196
196
|
"@vitest/coverage-v8": "^2.1.8",
|
|
197
|
-
"eslint": "
|
|
197
|
+
"eslint": "^8.57.0",
|
|
198
198
|
"jsdom": "^25.0.1",
|
|
199
199
|
"minimize-js": "^1.4.0",
|
|
200
|
-
"msw": "^2.
|
|
200
|
+
"msw": "^2.7.0",
|
|
201
201
|
"react": "^18.3.1",
|
|
202
202
|
"react-dom": "^18.3.1",
|
|
203
203
|
"react-test-renderer": "^18.3.1",
|
|
204
|
-
"tsc-alias": "^1.8.
|
|
205
|
-
"tslib": "^2.
|
|
204
|
+
"tsc-alias": "^1.8.10",
|
|
205
|
+
"tslib": "^2.8.1",
|
|
206
206
|
"typescript": "^5.7.2",
|
|
207
207
|
"vite": "^6.0.3",
|
|
208
208
|
"vite-tsconfig-paths": "^5.1.4",
|