@commercelayer/react-components 4.13.2 → 4.13.3
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/payment_gateways/PaypalGateway.js +1 -1
- package/lib/cjs/components/payment_gateways/WireTransferGateway.js +1 -1
- package/lib/cjs/components/shipping_methods/ShippingMethodRadioButton.js +1 -1
- package/lib/esm/components/payment_gateways/PaypalGateway.js +1 -1
- package/lib/esm/components/payment_gateways/WireTransferGateway.js +1 -1
- package/lib/esm/components/shipping_methods/ShippingMethodRadioButton.js +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaypalGateway=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),PaypalPayment_1=tslib_1.__importDefault(require("../payment_source/PaypalPayment")),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")),getCardDetails_1=tslib_1.__importDefault(require("../../utils/getCardDetails")),getPaymentAttributes_1=require("../../utils/getPaymentAttributes"),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),react_1=require("react");function PaypalGateway(props){var _a;const{readonly,showCard,handleEditClick,children}=props,p=tslib_1.__rest(props,["readonly","showCard","handleEditClick","children"]),{order}=(0,react_1.useContext)(OrderContext_1.default),{payment}=(0,react_1.useContext)(PaymentMethodChildrenContext_1.default),{currentPaymentMethodId,config,paymentSource}=(0,react_1.useContext)(PaymentMethodContext_1.default),paymentResource="paypal_payments";if(!readonly&&payment?.id!==currentPaymentMethodId)return null;if(readonly
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaypalGateway=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),PaypalPayment_1=tslib_1.__importDefault(require("../payment_source/PaypalPayment")),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")),getCardDetails_1=tslib_1.__importDefault(require("../../utils/getCardDetails")),getPaymentAttributes_1=require("../../utils/getPaymentAttributes"),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),react_1=require("react");function PaypalGateway(props){var _a;const{readonly,showCard,handleEditClick,children}=props,p=tslib_1.__rest(props,["readonly","showCard","handleEditClick","children"]),{order}=(0,react_1.useContext)(OrderContext_1.default),{payment}=(0,react_1.useContext)(PaymentMethodChildrenContext_1.default),{currentPaymentMethodId,config,paymentSource}=(0,react_1.useContext)(PaymentMethodContext_1.default),paymentResource="paypal_payments";if(!readonly&&payment?.id!==currentPaymentMethodId)return null;if(readonly){const card=(0,getCardDetails_1.default)({customerPayment:{payment_source:order?.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 attributes=(0,getPaymentAttributes_1.getPaymentAttributes)({resource:paymentResource,config:config??{},keys:["paypal_payments"]}),infoMessage=(_a=attributes?.paypalPayment)===null||_a===void 0?void 0:_a.infoMessage;return delete p.show,delete p.templateCustomerCards,delete p.templateCustomerSaveToWallet,delete p.loading,delete p.loaderComponent,delete p.onClickCustomerCards,(0,jsx_runtime_1.jsx)(PaypalPayment_1.default,Object.assign({},p,{infoMessage}))}exports.PaypalGateway=PaypalGateway,exports.default=PaypalGateway;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.WireTransferGateway=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),WireTransferPayment_1=tslib_1.__importDefault(require("../payment_source/WireTransferPayment")),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")),PaymentMethodReducer_1=require("../../reducers/PaymentMethodReducer"),getCardDetails_1=tslib_1.__importDefault(require("../../utils/getCardDetails")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),react_1=require("react");function WireTransferGateway(props){const{readonly,showCard,handleEditClick,children}=props,p=tslib_1.__rest(props,["readonly","showCard","handleEditClick","children"]),{payment}=(0,react_1.useContext)(PaymentMethodChildrenContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),{currentPaymentMethodId,config,paymentSource}=(0,react_1.useContext)(PaymentMethodContext_1.default),paymentResource="wire_transfers";if(!readonly&&payment?.id!==currentPaymentMethodId)return null;if(readonly
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.WireTransferGateway=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),WireTransferPayment_1=tslib_1.__importDefault(require("../payment_source/WireTransferPayment")),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")),PaymentMethodReducer_1=require("../../reducers/PaymentMethodReducer"),getCardDetails_1=tslib_1.__importDefault(require("../../utils/getCardDetails")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),react_1=require("react");function WireTransferGateway(props){const{readonly,showCard,handleEditClick,children}=props,p=tslib_1.__rest(props,["readonly","showCard","handleEditClick","children"]),{payment}=(0,react_1.useContext)(PaymentMethodChildrenContext_1.default),{order}=(0,react_1.useContext)(OrderContext_1.default),{currentPaymentMethodId,config,paymentSource}=(0,react_1.useContext)(PaymentMethodContext_1.default),paymentResource="wire_transfers";if(!readonly&&payment?.id!==currentPaymentMethodId)return null;if(readonly){const card=(0,getCardDetails_1.default)({customerPayment:{payment_source:order?.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 wireTransferConfig=config&&paymentResource?(0,PaymentMethodReducer_1.getPaymentConfig)(paymentResource,config):{};return(0,jsx_runtime_1.jsx)(WireTransferPayment_1.default,Object.assign({},p,wireTransferConfig?.wireTransfer))}exports.WireTransferGateway=WireTransferGateway,exports.default=WireTransferGateway;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShippingMethodRadioButton=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),ShippingMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/ShippingMethodChildrenContext")),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),ShipmentContext_1=tslib_1.__importDefault(require("../../context/ShipmentContext"));function ShippingMethodRadioButton(props){const{onChange}=props,p=tslib_1.__rest(props,["onChange"]),[checked,setChecked]=(0,react_1.useState)(!1),{shippingMethod,currentShippingMethodId,shipmentId}=(0,react_1.useContext)(ShippingMethodChildrenContext_1.default),{setShippingMethod}=(0,react_1.useContext)(ShipmentContext_1.default),shippingMethodId=shippingMethod?.id,name=`shipment-${shipmentId??""}`,id=`${name}-${shippingMethodId??""}`;(0,react_1.useEffect)(()=>(setChecked(shippingMethodId===currentShippingMethodId),()=>{setChecked(!1)}),[currentShippingMethodId,shippingMethodId]);const handleOnChange=()=>tslib_1.__awaiter(this,void 0,void 0,function*(){if(shipmentId&&shippingMethodId&&setShippingMethod!=null){const{order}=yield setShippingMethod(shipmentId,shippingMethodId);shippingMethod&&onChange!=null&&onChange({shippingMethod,shipmentId,order})}}),parentProps=Object.assign({shippingMethod,shipmentId,handleOnChange,name,id},props);return props.children?(0,jsx_runtime_1.jsx)(Parent_1.default,Object.assign({},parentProps,{children:props.children})):(0,jsx_runtime_1.jsx)("input",Object.assign({type:"radio",name,id,onChange:e=>{e.stopPropagation(),handleOnChange()},checked},p))}exports.ShippingMethodRadioButton=ShippingMethodRadioButton,exports.default=ShippingMethodRadioButton;
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShippingMethodRadioButton=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),ShippingMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/ShippingMethodChildrenContext")),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),ShipmentContext_1=tslib_1.__importDefault(require("../../context/ShipmentContext"));function ShippingMethodRadioButton(props){const{onChange}=props,p=tslib_1.__rest(props,["onChange"]),[checked,setChecked]=(0,react_1.useState)(!1),[disabled,setDisabled]=(0,react_1.useState)(!1),{shippingMethod,currentShippingMethodId,shipmentId}=(0,react_1.useContext)(ShippingMethodChildrenContext_1.default),{setShippingMethod}=(0,react_1.useContext)(ShipmentContext_1.default),shippingMethodId=shippingMethod?.id,name=`shipment-${shipmentId??""}`,id=`${name}-${shippingMethodId??""}`;(0,react_1.useEffect)(()=>(setChecked(shippingMethodId===currentShippingMethodId),()=>{setChecked(!1)}),[currentShippingMethodId,shippingMethodId]);const handleOnChange=()=>tslib_1.__awaiter(this,void 0,void 0,function*(){if(setDisabled(!0),shipmentId&&shippingMethodId&&setShippingMethod!=null){const{order}=yield setShippingMethod(shipmentId,shippingMethodId);shippingMethod&&onChange!=null&&onChange({shippingMethod,shipmentId,order})}setDisabled(!1)}),parentProps=Object.assign({shippingMethod,shipmentId,handleOnChange,name,id,disabled},props);return props.children?(0,jsx_runtime_1.jsx)(Parent_1.default,Object.assign({},parentProps,{children:props.children})):(0,jsx_runtime_1.jsx)("input",Object.assign({disabled,type:"radio",name,id,onChange:e=>{e.preventDefault(),e.stopPropagation(),handleOnChange()},checked},p))}exports.ShippingMethodRadioButton=ShippingMethodRadioButton,exports.default=ShippingMethodRadioButton;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as _jsx}from"react/jsx-runtime";import PaypalPayment from"../payment_source/PaypalPayment";import OrderContext from"../../context/OrderContext";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";import getCardDetails from"../../utils/getCardDetails";import{getPaymentAttributes}from"../../utils/getPaymentAttributes";import isEmpty from"lodash/isEmpty";import{useContext}from"react";export function PaypalGateway(props){const{readonly,showCard,handleEditClick,children,...p}=props,{order}=useContext(OrderContext),{payment}=useContext(PaymentMethodChildrenContext),{currentPaymentMethodId,config,paymentSource}=useContext(PaymentMethodContext),paymentResource="paypal_payments";if(!readonly&&payment?.id!==currentPaymentMethodId)return null;if(readonly
|
|
2
|
+
import{jsx as _jsx}from"react/jsx-runtime";import PaypalPayment from"../payment_source/PaypalPayment";import OrderContext from"../../context/OrderContext";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";import getCardDetails from"../../utils/getCardDetails";import{getPaymentAttributes}from"../../utils/getPaymentAttributes";import isEmpty from"lodash/isEmpty";import{useContext}from"react";export function PaypalGateway(props){const{readonly,showCard,handleEditClick,children,...p}=props,{order}=useContext(OrderContext),{payment}=useContext(PaymentMethodChildrenContext),{currentPaymentMethodId,config,paymentSource}=useContext(PaymentMethodContext),paymentResource="paypal_payments";if(!readonly&&payment?.id!==currentPaymentMethodId)return null;if(readonly){const card=getCardDetails({customerPayment:{payment_source:order?.payment_source||paymentSource},paymentType:paymentResource}),value={...card,showCard,handleEditClick,readonly};return isEmpty(card)?null:_jsx(PaymentSourceContext.Provider,{value,children})}const infoMessage=getPaymentAttributes({resource:paymentResource,config:config??{},keys:["paypal_payments"]})?.paypalPayment?.infoMessage;return delete p.show,delete p.templateCustomerCards,delete p.templateCustomerSaveToWallet,delete p.loading,delete p.loaderComponent,delete p.onClickCustomerCards,_jsx(PaypalPayment,{...p,infoMessage})}export default PaypalGateway;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as _jsx}from"react/jsx-runtime";import WireTransferPayment from"../payment_source/WireTransferPayment";import OrderContext from"../../context/OrderContext";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";import{getPaymentConfig}from"../../reducers/PaymentMethodReducer";import getCardDetails from"../../utils/getCardDetails";import isEmpty from"lodash/isEmpty";import{useContext}from"react";export function WireTransferGateway(props){const{readonly,showCard,handleEditClick,children,...p}=props,{payment}=useContext(PaymentMethodChildrenContext),{order}=useContext(OrderContext),{currentPaymentMethodId,config,paymentSource}=useContext(PaymentMethodContext),paymentResource="wire_transfers";if(!readonly&&payment?.id!==currentPaymentMethodId)return null;if(readonly
|
|
2
|
+
import{jsx as _jsx}from"react/jsx-runtime";import WireTransferPayment from"../payment_source/WireTransferPayment";import OrderContext from"../../context/OrderContext";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentSourceContext from"../../context/PaymentSourceContext";import{getPaymentConfig}from"../../reducers/PaymentMethodReducer";import getCardDetails from"../../utils/getCardDetails";import isEmpty from"lodash/isEmpty";import{useContext}from"react";export function WireTransferGateway(props){const{readonly,showCard,handleEditClick,children,...p}=props,{payment}=useContext(PaymentMethodChildrenContext),{order}=useContext(OrderContext),{currentPaymentMethodId,config,paymentSource}=useContext(PaymentMethodContext),paymentResource="wire_transfers";if(!readonly&&payment?.id!==currentPaymentMethodId)return null;if(readonly){const card=getCardDetails({customerPayment:{payment_source:order?.payment_source||paymentSource},paymentType:paymentResource}),value={...card,showCard,handleEditClick,readonly};return isEmpty(card)?null:_jsx(PaymentSourceContext.Provider,{value,children})}const wireTransferConfig=config&&paymentResource?getPaymentConfig(paymentResource,config):{};return _jsx(WireTransferPayment,{...p,...wireTransferConfig?.wireTransfer})}export default WireTransferGateway;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useState}from"react";import ShippingMethodChildrenContext from"../../context/ShippingMethodChildrenContext";import Parent from"../utils/Parent";import ShipmentContext from"../../context/ShipmentContext";export function ShippingMethodRadioButton(props){const{onChange,...p}=props,[checked,setChecked]=useState(!1),{shippingMethod,currentShippingMethodId,shipmentId}=useContext(ShippingMethodChildrenContext),{setShippingMethod}=useContext(ShipmentContext),shippingMethodId=shippingMethod?.id,name=`shipment-${shipmentId??""}`,id=`${name}-${shippingMethodId??""}`;useEffect(()=>(setChecked(shippingMethodId===currentShippingMethodId),()=>{setChecked(!1)}),[currentShippingMethodId,shippingMethodId]);const handleOnChange=async()=>{if(shipmentId&&shippingMethodId&&setShippingMethod!=null){const{order}=await setShippingMethod(shipmentId,shippingMethodId);shippingMethod&&onChange!=null&&onChange({shippingMethod,shipmentId,order})}},parentProps={shippingMethod,shipmentId,handleOnChange,name,id,...props};return props.children?_jsx(Parent,{...parentProps,children:props.children}):_jsx("input",{type:"radio",name,id,onChange:e=>{e.stopPropagation(),handleOnChange()},checked,...p})}export default ShippingMethodRadioButton;
|
|
2
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useState}from"react";import ShippingMethodChildrenContext from"../../context/ShippingMethodChildrenContext";import Parent from"../utils/Parent";import ShipmentContext from"../../context/ShipmentContext";export function ShippingMethodRadioButton(props){const{onChange,...p}=props,[checked,setChecked]=useState(!1),[disabled,setDisabled]=useState(!1),{shippingMethod,currentShippingMethodId,shipmentId}=useContext(ShippingMethodChildrenContext),{setShippingMethod}=useContext(ShipmentContext),shippingMethodId=shippingMethod?.id,name=`shipment-${shipmentId??""}`,id=`${name}-${shippingMethodId??""}`;useEffect(()=>(setChecked(shippingMethodId===currentShippingMethodId),()=>{setChecked(!1)}),[currentShippingMethodId,shippingMethodId]);const handleOnChange=async()=>{if(setDisabled(!0),shipmentId&&shippingMethodId&&setShippingMethod!=null){const{order}=await setShippingMethod(shipmentId,shippingMethodId);shippingMethod&&onChange!=null&&onChange({shippingMethod,shipmentId,order})}setDisabled(!1)},parentProps={shippingMethod,shipmentId,handleOnChange,name,id,disabled,...props};return props.children?_jsx(Parent,{...parentProps,children:props.children}):_jsx("input",{disabled,type:"radio",name,id,onChange:e=>{e.preventDefault(),e.stopPropagation(),handleOnChange()},checked,...p})}export default ShippingMethodRadioButton;
|