@commercelayer/react-components 3.11.0 → 3.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/AddToCartButton.d.ts +1 -1
- package/lib/components/LineItemsContainer.js +1 -1
- package/lib/components/PaymentMethodsContainer.js +1 -1
- package/lib/components/PlaceOrderContainer.js +1 -1
- package/lib/components/ShipmentsContainer.js +1 -1
- package/lib/components/SkuField.d.ts +1 -1
- package/lib/components/SkuField.js +1 -1
- package/lib/components/StockTransfer.d.ts +1 -1
- package/lib/components/StockTransfer.js +1 -1
- package/lib/components/StockTransferField.d.ts +2 -1
- package/lib/components/StockTransferField.js +1 -1
- package/lib/components/utils/GenericFieldComponent.d.ts +1 -0
- package/lib/components/utils/GenericFieldComponent.js +1 -0
- package/lib/config/components.d.ts +1 -1
- package/lib/config/components.js +1 -1
- package/lib/reducers/OrderReducer.d.ts +1 -1
- package/lib/reducers/OrderReducer.js +1 -1
- package/lib/typings/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import React,{PropsWithoutRef,ReactNode}from'react';import{FunctionChildren}from'../typings/index';import{AddToCartReturn}from'../reducers/OrderReducer';import{VariantOption}from'./VariantSelector';declare type ChildrenProps={handleClick:()=>AddToCartReturn;}&Omit<AddToCartButtonProps,'children'>;declare type AddToCartButtonChildrenProps=FunctionChildren<ChildrenProps>;export declare type AddToCartButtonType=ChildrenProps;declare type BuyNowMode={buyNowMode:true;checkoutUrl?:string;}|{buyNowMode
|
|
1
|
+
import React,{PropsWithoutRef,ReactNode}from'react';import{FunctionChildren}from'../typings/index';import{AddToCartReturn}from'../reducers/OrderReducer';import{VariantOption}from'./VariantSelector';declare type ChildrenProps={handleClick:()=>AddToCartReturn;}&Omit<AddToCartButtonProps,'children'>;declare type AddToCartButtonChildrenProps=FunctionChildren<ChildrenProps>;export declare type AddToCartButtonType=ChildrenProps;declare type BuyNowMode={buyNowMode:true;checkoutUrl?:string;}|{buyNowMode?:false;checkoutUrl?:never;};declare type AddToCartButtonProps={children?:AddToCartButtonChildrenProps;label?:string|ReactNode;skuCode?:string;bundleCode?:string;disabled?:boolean;skuListId?:string;lineItem?:VariantOption['lineItem'];}&BuyNowMode&PropsWithoutRef<JSX.IntrinsicElements['button']>;declare const AddToCartButton:React.FunctionComponent<AddToCartButtonProps>;export default AddToCartButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useEffect,useReducer,useContext}from"react";import lineItemReducer,{lineItemInitialState,updateLineItem,deleteLineItem}from"../reducers/LineItemReducer";import OrderContext from"../context/OrderContext";import LineItemContext from"../context/LineItemContext";import CommerceLayerContext from"../context/CommerceLayerContext";import{isEmpty}from"lodash";import components from"../config/components";const propTypes=components.LineItemsContainer.propTypes,defaultProps=components.LineItemsContainer.defaultProps,displayName=components.LineItemsContainer.displayName,LineItemsContainer=props=>{const{children,loader="Loading..."}=props,{order,addResourceToInclude,include,orderId,getOrder,includeLoaded}=useContext(OrderContext),config=useContext(CommerceLayerContext),[state,dispatch]=useReducer(lineItemReducer,lineItemInitialState);useEffect(()=>((include==null?void 0:include.includes("line_items.line_item_options.sku_option"))?(includeLoaded==null?void 0:includeLoaded["line_items.line_item_options.sku_option"])||addResourceToInclude({newResourceLoaded:{"line_items.line_item_options.sku_option":!0
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useEffect,useReducer,useContext}from"react";import lineItemReducer,{lineItemInitialState,updateLineItem,deleteLineItem}from"../reducers/LineItemReducer";import OrderContext from"../context/OrderContext";import LineItemContext from"../context/LineItemContext";import CommerceLayerContext from"../context/CommerceLayerContext";import{isEmpty}from"lodash";import components from"../config/components";const propTypes=components.LineItemsContainer.propTypes,defaultProps=components.LineItemsContainer.defaultProps,displayName=components.LineItemsContainer.displayName,LineItemsContainer=props=>{const{children,loader="Loading..."}=props,{order,addResourceToInclude,include,orderId,getOrder,includeLoaded}=useContext(OrderContext),config=useContext(CommerceLayerContext),[state,dispatch]=useReducer(lineItemReducer,lineItemInitialState);useEffect(()=>((include==null?void 0:include.includes("line_items.line_item_options.sku_option"))?(includeLoaded==null?void 0:includeLoaded["line_items.line_item_options.sku_option"])||addResourceToInclude({newResourceLoaded:{"line_items.line_item_options.sku_option":!0}}):addResourceToInclude({newResource:["line_items.line_item_options.sku_option"]}),(include==null?void 0:include.includes("line_items.item"))?(includeLoaded==null?void 0:includeLoaded["line_items.item"])||addResourceToInclude({newResourceLoaded:{"line_items.item":!0}}):addResourceToInclude({newResource:["line_items.item"]}),!isEmpty(order)&&(order==null?void 0:order.line_items)&&dispatch({type:"setLineItems",payload:{lineItems:order.line_items}}),()=>{isEmpty(order)&&dispatch({type:"setLineItems",payload:{lineItems:[]}})}),[order,include,includeLoaded]);const lineItemValue=Object.assign(Object.assign({},state),{loader,updateLineItem:(lineItemId,quantity=1)=>updateLineItem({lineItemId,quantity,dispatch,config,getOrder,orderId,errors:state.errors}),deleteLineItem:lineItemId=>deleteLineItem({lineItemId,dispatch,config,getOrder,orderId,errors:state.errors})});return _jsx(LineItemContext.Provider,Object.assign({value:lineItemValue},{children:state.loading?loader:children}))};LineItemsContainer.propTypes=propTypes,LineItemsContainer.defaultProps=defaultProps,LineItemsContainer.displayName=displayName;export default LineItemsContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import PaymentMethodContext,{defaultPaymentMethodContext}from"../context/PaymentMethodContext";import{useContext,useEffect,useReducer,useMemo}from"react";import paymentMethodReducer,{paymentMethodInitialState,getPaymentMethods,setPaymentMethodConfig}from"../reducers/PaymentMethodReducer";import OrderContext from"../context/OrderContext";import CommerceLayerContext from"../context/CommerceLayerContext";import components from"../config/components";import{isEmpty}from"lodash";import{setPaymentRef}from"../reducers/PaymentMethodReducer";const propTypes=components.PaymentMethodsContainer.propTypes,displayName=components.PaymentMethodsContainer.displayName,PaymentMethodsContainer=props=>{const{children,config}=props,[state,dispatch]=useReducer(paymentMethodReducer,paymentMethodInitialState),{order,getOrder,setOrderErrors,include,addResourceToInclude,updateOrder,includeLoaded}=useContext(OrderContext),credentials=useContext(CommerceLayerContext);async function getPayMethods(){order&&await getPaymentMethods({order,dispatch})}useEffect(()=>{(include==null?void 0:include.includes("available_payment_methods"))?(includeLoaded==null?void 0:includeLoaded.available_payment_methods)||addResourceToInclude({newResourceLoaded:{available_payment_methods:!0,payment_source:!0,payment_method:!0,"line_items.line_item_options.sku_option":!0}}):addResourceToInclude({newResource:["available_payment_methods","payment_source","payment_method","line_items.line_item_options.sku_option"]}),config&&isEmpty(state.config)&&setPaymentMethodConfig(config,dispatch),credentials&&order&&(state.paymentMethods||getPayMethods()),(order==null?void 0:order.payment_source)&&dispatch({type:"setPaymentSource",payload:{paymentSource:order==null?void 0:order.payment_source}}),(order==null?void 0:order.payment_source)===null&&dispatch({type:"setPaymentSource",payload:{paymentSource:void 0}})},[order,credentials,include,includeLoaded]);const contextValue=useMemo(()=>Object.assign(Object.assign({},state),{setLoading:({loading})=>defaultPaymentMethodContext.setLoading({loading,dispatch}),setPaymentRef:({ref})=>setPaymentRef({ref,dispatch}),setPaymentMethodErrors:errors=>defaultPaymentMethodContext.setPaymentMethodErrors(errors,dispatch),setPaymentMethod:async args=>await defaultPaymentMethodContext.setPaymentMethod(Object.assign(Object.assign({},args),{config:credentials,updateOrder,order,dispatch,setOrderErrors})),setPaymentSource:async args=>await defaultPaymentMethodContext.setPaymentSource(Object.assign(Object.assign(Object.assign({},state),args),{config:credentials,dispatch,getOrder,updateOrder,order})),updatePaymentSource:async args=>await defaultPaymentMethodContext.updatePaymentSource(Object.assign(Object.assign({},args),{config:credentials,dispatch})),destroyPaymentSource:async args=>await defaultPaymentMethodContext.destroyPaymentSource(Object.assign(Object.assign({},args),{dispatch,config:credentials,updateOrder,orderId:order==null?void 0:order.id}))}),[state]);return _jsx(PaymentMethodContext.Provider,Object.assign({value:contextValue},{children}))};PaymentMethodsContainer.propTypes=propTypes,PaymentMethodsContainer.displayName=displayName;export default PaymentMethodsContainer;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import PaymentMethodContext,{defaultPaymentMethodContext}from"../context/PaymentMethodContext";import{useContext,useEffect,useReducer,useMemo}from"react";import paymentMethodReducer,{paymentMethodInitialState,getPaymentMethods,setPaymentMethodConfig}from"../reducers/PaymentMethodReducer";import OrderContext from"../context/OrderContext";import CommerceLayerContext from"../context/CommerceLayerContext";import components from"../config/components";import{isEmpty}from"lodash";import{setPaymentRef}from"../reducers/PaymentMethodReducer";const propTypes=components.PaymentMethodsContainer.propTypes,displayName=components.PaymentMethodsContainer.displayName,PaymentMethodsContainer=props=>{const{children,config}=props,[state,dispatch]=useReducer(paymentMethodReducer,paymentMethodInitialState),{order,getOrder,setOrderErrors,include,addResourceToInclude,updateOrder,includeLoaded}=useContext(OrderContext),credentials=useContext(CommerceLayerContext);async function getPayMethods(){order&&await getPaymentMethods({order,dispatch})}useEffect(()=>{(include==null?void 0:include.includes("available_payment_methods"))?(includeLoaded==null?void 0:includeLoaded.available_payment_methods)||addResourceToInclude({newResourceLoaded:{available_payment_methods:!0,payment_source:!0,payment_method:!0,"line_items.line_item_options.sku_option":!0,"line_items.item":!0}}):addResourceToInclude({newResource:["available_payment_methods","payment_source","payment_method","line_items.line_item_options.sku_option","line_items.item"]}),config&&isEmpty(state.config)&&setPaymentMethodConfig(config,dispatch),credentials&&order&&(state.paymentMethods||getPayMethods()),(order==null?void 0:order.payment_source)&&dispatch({type:"setPaymentSource",payload:{paymentSource:order==null?void 0:order.payment_source}}),(order==null?void 0:order.payment_source)===null&&dispatch({type:"setPaymentSource",payload:{paymentSource:void 0}})},[order,credentials,include,includeLoaded]);const contextValue=useMemo(()=>Object.assign(Object.assign({},state),{setLoading:({loading})=>defaultPaymentMethodContext.setLoading({loading,dispatch}),setPaymentRef:({ref})=>setPaymentRef({ref,dispatch}),setPaymentMethodErrors:errors=>defaultPaymentMethodContext.setPaymentMethodErrors(errors,dispatch),setPaymentMethod:async args=>await defaultPaymentMethodContext.setPaymentMethod(Object.assign(Object.assign({},args),{config:credentials,updateOrder,order,dispatch,setOrderErrors})),setPaymentSource:async args=>await defaultPaymentMethodContext.setPaymentSource(Object.assign(Object.assign(Object.assign({},state),args),{config:credentials,dispatch,getOrder,updateOrder,order})),updatePaymentSource:async args=>await defaultPaymentMethodContext.updatePaymentSource(Object.assign(Object.assign({},args),{config:credentials,dispatch})),destroyPaymentSource:async args=>await defaultPaymentMethodContext.destroyPaymentSource(Object.assign(Object.assign({},args),{dispatch,config:credentials,updateOrder,orderId:order==null?void 0:order.id}))}),[state]);return _jsx(PaymentMethodContext.Provider,Object.assign({value:contextValue},{children}))};PaymentMethodsContainer.propTypes=propTypes,PaymentMethodsContainer.displayName=displayName;export default PaymentMethodsContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import PlaceOrderContext from"../context/PlaceOrderContext";import{useContext,useEffect,useReducer}from"react";import placeOrderReducer,{placeOrderInitialState,placeOrderPermitted}from"../reducers/PlaceOrderReducer";import OrderContext from"../context/OrderContext";import CommerceLayerContext from"../context/CommerceLayerContext";import components from"../config/components";import{setPlaceOrder}from"../reducers/PlaceOrderReducer";const propTypes=components.PlaceOrderContainer.propTypes,displayName=components.PlaceOrderContainer.displayName,PlaceOrderContainer=props=>{const{children,options}=props,[state,dispatch]=useReducer(placeOrderReducer,placeOrderInitialState),{order,setOrder,setOrderErrors,include,addResourceToInclude,includeLoaded}=useContext(OrderContext),config=useContext(CommerceLayerContext);useEffect(()=>{(include==null?void 0:include.includes("shipments.available_shipping_methods"))?(includeLoaded==null?void 0:includeLoaded["shipments.available_shipping_methods"])||addResourceToInclude({newResourceLoaded:{"shipments.available_shipping_methods":!0,"shipments.shipment_line_items.line_item":!0,"shipments.shipping_method":!0,"shipments.stock_transfers":!0,"shipments.stock_location":!0}}):addResourceToInclude({newResource:["shipments.available_shipping_methods","shipments.shipment_line_items.line_item","shipments.shipping_method","shipments.stock_transfers","shipments.stock_location"]}),(include==null?void 0:include.includes("billing_address"))?(includeLoaded==null?void 0:includeLoaded.billing_address)||addResourceToInclude({newResourceLoaded:{billing_address:!0}}):addResourceToInclude({newResource:"billing_address"}),(include==null?void 0:include.includes("shipping_address"))?(includeLoaded==null?void 0:includeLoaded.shipping_address)||addResourceToInclude({newResourceLoaded:{shipping_address:!0}}):addResourceToInclude({newResource:"shipping_address",resourcesIncluded:include}),order&&placeOrderPermitted({config,dispatch,order,options:Object.assign({},options)})},[order,include,includeLoaded]);const contextValue=Object.assign(Object.assign({},state),{setPlaceOrder:({paymentSource})=>setPlaceOrder({config,order,state,setOrderErrors,paymentSource,include,setOrder}),placeOrderPermitted:()=>placeOrderPermitted({config,dispatch,order,options:Object.assign({},options)})});return _jsx(PlaceOrderContext.Provider,Object.assign({value:contextValue},{children}))};PlaceOrderContainer.propTypes=propTypes,PlaceOrderContainer.displayName=displayName;export default PlaceOrderContainer;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import PlaceOrderContext from"../context/PlaceOrderContext";import{useContext,useEffect,useReducer}from"react";import placeOrderReducer,{placeOrderInitialState,placeOrderPermitted}from"../reducers/PlaceOrderReducer";import OrderContext from"../context/OrderContext";import CommerceLayerContext from"../context/CommerceLayerContext";import components from"../config/components";import{setPlaceOrder}from"../reducers/PlaceOrderReducer";const propTypes=components.PlaceOrderContainer.propTypes,displayName=components.PlaceOrderContainer.displayName,PlaceOrderContainer=props=>{const{children,options}=props,[state,dispatch]=useReducer(placeOrderReducer,placeOrderInitialState),{order,setOrder,setOrderErrors,include,addResourceToInclude,includeLoaded}=useContext(OrderContext),config=useContext(CommerceLayerContext);useEffect(()=>{(include==null?void 0:include.includes("shipments.available_shipping_methods"))?(includeLoaded==null?void 0:includeLoaded["shipments.available_shipping_methods"])||addResourceToInclude({newResourceLoaded:{"shipments.available_shipping_methods":!0,"shipments.shipment_line_items.line_item":!0,"shipments.shipping_method":!0,"shipments.stock_transfers.line_item":!0,"shipments.stock_location":!0}}):addResourceToInclude({newResource:["shipments.available_shipping_methods","shipments.shipment_line_items.line_item","shipments.shipping_method","shipments.stock_transfers.line_item","shipments.stock_location"]}),(include==null?void 0:include.includes("billing_address"))?(includeLoaded==null?void 0:includeLoaded.billing_address)||addResourceToInclude({newResourceLoaded:{billing_address:!0}}):addResourceToInclude({newResource:"billing_address"}),(include==null?void 0:include.includes("shipping_address"))?(includeLoaded==null?void 0:includeLoaded.shipping_address)||addResourceToInclude({newResourceLoaded:{shipping_address:!0}}):addResourceToInclude({newResource:"shipping_address",resourcesIncluded:include}),order&&placeOrderPermitted({config,dispatch,order,options:Object.assign({},options)})},[order,include,includeLoaded]);const contextValue=Object.assign(Object.assign({},state),{setPlaceOrder:({paymentSource})=>setPlaceOrder({config,order,state,setOrderErrors,paymentSource,include,setOrder}),placeOrderPermitted:()=>placeOrderPermitted({config,dispatch,order,options:Object.assign({},options)})});return _jsx(PlaceOrderContext.Provider,Object.assign({value:contextValue},{children}))};PlaceOrderContainer.propTypes=propTypes,PlaceOrderContainer.displayName=displayName;export default PlaceOrderContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import ShipmentContext,{defaultShipmentContext}from"../context/ShipmentContext";import{useContext,useEffect,useReducer}from"react";import shipmentReducer,{shipmentInitialState,setShipmentErrors,getShipments,setShippingMethod}from"../reducers/ShipmentReducer";import OrderContext from"../context/OrderContext";import CommerceLayerContext from"../context/CommerceLayerContext";import components from"../config/components";import{isEmpty}from"lodash";const propTypes=components.ShipmentsContainer.propTypes,displayName=components.ShipmentsContainer.displayName,ShipmentsContainer=props=>{const{children}=props,[state,dispatch]=useReducer(shipmentReducer,shipmentInitialState),{order,getOrder,include,addResourceToInclude,includeLoaded}=useContext(OrderContext),config=useContext(CommerceLayerContext);useEffect(()=>{(include==null?void 0:include.includes("shipments.available_shipping_methods"))?(includeLoaded==null?void 0:includeLoaded["shipments.available_shipping_methods"])||addResourceToInclude({newResourceLoaded:{"shipments.available_shipping_methods":!0,"shipments.shipment_line_items.line_item":!0,"shipments.shipping_method":!0,"shipments.stock_transfers":!0,"shipments.stock_location":!0}}):addResourceToInclude({newResource:["shipments.available_shipping_methods","shipments.shipment_line_items.line_item","shipments.shipping_method","shipments.stock_transfers","shipments.stock_location"]}),order&&!isEmpty(config)&&order.shipments&&getShipments({order,dispatch,config})},[order,include,includeLoaded]),useEffect(()=>(order&&(order.shipments&&order.shipments.length>0&&order.shipments.map(shipment=>shipment.available_shipping_methods&&shipment.available_shipping_methods.length>0).includes(!1)&&setShipmentErrors([...state.errors||[],{code:"NO_SHIPPING_METHODS",message:"No shipping methods",resource:"shipments"}],dispatch),order.line_items&&order.line_items.length>0&&order.line_items.filter(({item_type})=>item_type==="skus").map(lineItem=>{var _a,_b,_c,_d,_e;return((_b=(_a=lineItem.item)===null||_a===void 0?void 0:_a.inventory)===null||_b===void 0?void 0:_b.quantity)>=(lineItem==null?void 0:lineItem.quantity)?((_c=lineItem.item)===null||_c===void 0?void 0:_c.do_not_ship)||((_e=(_d=lineItem.item)===null||_d===void 0?void 0:_d.inventory)===null||_e===void 0?void 0:_e.available):!1}).includes(!1)&&setShipmentErrors([...state.errors||[],{code:"OUT_OF_STOCK",message:"No stock available",resource:"line_items"}],dispatch)),()=>{setShipmentErrors([],dispatch)}),[order]);const contextValue=Object.assign(Object.assign({},state),{setShipmentErrors:errors=>defaultShipmentContext.setShipmentErrors(errors,dispatch),setShippingMethod:async(shipmentId,shippingMethodId)=>await setShippingMethod({shippingMethodId,shipmentId,config,getOrder,order})});return _jsx(ShipmentContext.Provider,Object.assign({value:contextValue},{children}))};ShipmentsContainer.propTypes=propTypes,ShipmentsContainer.displayName=displayName;export default ShipmentsContainer;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import ShipmentContext,{defaultShipmentContext}from"../context/ShipmentContext";import{useContext,useEffect,useReducer}from"react";import shipmentReducer,{shipmentInitialState,setShipmentErrors,getShipments,setShippingMethod}from"../reducers/ShipmentReducer";import OrderContext from"../context/OrderContext";import CommerceLayerContext from"../context/CommerceLayerContext";import components from"../config/components";import{isEmpty}from"lodash";const propTypes=components.ShipmentsContainer.propTypes,displayName=components.ShipmentsContainer.displayName,ShipmentsContainer=props=>{const{children}=props,[state,dispatch]=useReducer(shipmentReducer,shipmentInitialState),{order,getOrder,include,addResourceToInclude,includeLoaded}=useContext(OrderContext),config=useContext(CommerceLayerContext);useEffect(()=>{(include==null?void 0:include.includes("shipments.available_shipping_methods"))?(includeLoaded==null?void 0:includeLoaded["shipments.available_shipping_methods"])||addResourceToInclude({newResourceLoaded:{"shipments.available_shipping_methods":!0,"shipments.shipment_line_items.line_item":!0,"shipments.shipping_method":!0,"shipments.stock_transfers.line_item":!0,"shipments.stock_location":!0}}):addResourceToInclude({newResource:["shipments.available_shipping_methods","shipments.shipment_line_items.line_item","shipments.shipping_method","shipments.stock_transfers.line_item","shipments.stock_location"]}),order&&!isEmpty(config)&&order.shipments&&getShipments({order,dispatch,config})},[order,include,includeLoaded]),useEffect(()=>(order&&(order.shipments&&order.shipments.length>0&&order.shipments.map(shipment=>shipment.available_shipping_methods&&shipment.available_shipping_methods.length>0).includes(!1)&&setShipmentErrors([...state.errors||[],{code:"NO_SHIPPING_METHODS",message:"No shipping methods",resource:"shipments"}],dispatch),order.line_items&&order.line_items.length>0&&order.line_items.filter(({item_type})=>item_type==="skus").map(lineItem=>{var _a,_b,_c,_d,_e;return((_b=(_a=lineItem.item)===null||_a===void 0?void 0:_a.inventory)===null||_b===void 0?void 0:_b.quantity)>=(lineItem==null?void 0:lineItem.quantity)?((_c=lineItem.item)===null||_c===void 0?void 0:_c.do_not_ship)||((_e=(_d=lineItem.item)===null||_d===void 0?void 0:_d.inventory)===null||_e===void 0?void 0:_e.available):!1}).includes(!1)&&setShipmentErrors([...state.errors||[],{code:"OUT_OF_STOCK",message:"No stock available",resource:"line_items"}],dispatch)),()=>{setShipmentErrors([],dispatch)}),[order]);const contextValue=Object.assign(Object.assign({},state),{setShipmentErrors:errors=>defaultShipmentContext.setShipmentErrors(errors,dispatch),setShippingMethod:async(shipmentId,shippingMethodId)=>await setShippingMethod({shippingMethodId,shipmentId,config,getOrder,order})});return _jsx(ShipmentContext.Provider,Object.assign({value:contextValue},{children}))};ShipmentsContainer.propTypes=propTypes,ShipmentsContainer.displayName=displayName;export default ShipmentsContainer;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import{Sku}from'@commercelayer/sdk';
|
|
2
|
+
import{Sku}from'@commercelayer/sdk';import{ExcludeTag}from'../typings/index';declare type Conditional=({attribute:'image_url';tagElement:'img';}&JSX.IntrinsicElements['img'])|({attribute:Exclude<keyof Sku,'image_url'>;tagElement:ExcludeTag<'img'>;}&JSX.IntrinsicElements[ExcludeTag<'img'>]);declare type ChildrenProps=Omit<Props,'children'|'attribute'>&{element:Sku[keyof Sku];};declare type Props={children?:(props:ChildrenProps)=>JSX.Element;}&Conditional;declare function SkuField<P extends Props>({attribute,tagElement,children,...p}:P):JSX.Element;declare namespace SkuField{var propTypes:{children:import("prop-types").Requireable<(...args:any[])=>any>;attribute:import("prop-types").Requireable<string>;tagElement:import("prop-types").Requireable<string>;};}export default SkuField;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import SkuChildrenContext from"../context/SkuChildrenContext";import{useContext}from"react";import Parent from"./utils/Parent";import components from"../config/components";export default function SkuField(_a){var{attribute,tagElement,children}=_a,p=__rest(_a,["attribute","tagElement","children"]);const{sku}=useContext(SkuChildrenContext),element=sku&&sku[attribute]||"",Tag=tagElement;if(Tag==="img"){const src=element,name=sku==null?void 0:sku.name;return _jsx("img",Object.assign({alt:name,src},p))}const parentProps=Object.assign({element,tagElement},p);return children?_jsx(Parent,Object.assign({},parentProps,{children})):_jsx(Tag,{children:element})}SkuField.propTypes=components.SkuField.propTypes;
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import SkuChildrenContext from"../context/SkuChildrenContext";import{useContext}from"react";import Parent from"./utils/Parent";import components from"../config/components";export default function SkuField(_a){var{attribute,tagElement,children}=_a,p=__rest(_a,["attribute","tagElement","children"]);const{sku}=useContext(SkuChildrenContext),element=sku&&sku[attribute]||"",Tag=tagElement;if(Tag==="img"&&!children){const src=element,name=sku==null?void 0:sku.name;return _jsx("img",Object.assign({alt:name,src},p))}const parentProps=Object.assign({element,tagElement},p);return children?_jsx(Parent,Object.assign({},parentProps,{children})):_jsx(Tag,{children:element})}SkuField.propTypes=components.SkuField.propTypes;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import React,{ReactNode}from'react';declare type StockTransferProps={children:ReactNode;}&JSX.IntrinsicElements['p'];declare const StockTransfer:React.FunctionComponent<StockTransferProps>;export default StockTransfer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{useContext,Fragment}from"react";import LineItemChildrenContext from"../context/LineItemChildrenContext";import components from"../config/components";import ShipmentChildrenContext from"../context/ShipmentChildrenContext";import StockTransferChildrenContext from"../context/StockTransferChildrenContext";const propTypes=components.StockTransfer.propTypes,displayName=components.StockTransfer.displayName,StockTransfer=props=>{const{children}=props,{lineItem}=useContext(LineItemChildrenContext),{stockTransfers}=useContext(ShipmentChildrenContext),components2=
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import{useContext,Fragment}from"react";import LineItemChildrenContext from"../context/LineItemChildrenContext";import components from"../config/components";import ShipmentChildrenContext from"../context/ShipmentChildrenContext";import StockTransferChildrenContext from"../context/StockTransferChildrenContext";const propTypes=components.StockTransfer.propTypes,displayName=components.StockTransfer.displayName,StockTransfer=props=>{const{children}=props,{lineItem}=useContext(LineItemChildrenContext),{stockTransfers}=useContext(ShipmentChildrenContext),items=[...lineItem?[lineItem]:[],...stockTransfers||[]],components2=items==null?void 0:items.filter(stock=>stock.sku_code!==(lineItem==null?void 0:lineItem.sku_code)).map((stockTransfer,k)=>{const stockTransferProps={stockTransfer:stockTransfer==null?void 0:stockTransfer.line_item};return _jsx(StockTransferChildrenContext.Provider,Object.assign({value:stockTransferProps},{children}),k)});return _jsx(Fragment,{children:components2})};StockTransfer.propTypes=propTypes,StockTransfer.displayName=displayName;export default StockTransfer;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import{ConditionalElement}from'../typings/index';import{TResources}from'./utils/GenericFieldComponent';declare type StockTransferFieldChildrenProps=Omit<Props,'children'|'attribute'|'element'>;declare type TCondition=ConditionalElement<Exclude<TResources['StockTransfer'],'resource'>>;declare type Props={children?:(props:StockTransferFieldChildrenProps)=>JSX.Element;}&TCondition;export default function StockTransferField<P extends Props>(props:P):JSX.Element;export{};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import StockTransferChildrenContext from"../context/StockTransferChildrenContext";import GenericFieldComponent from"./utils/GenericFieldComponent";export default function StockTransferField(props){const{attribute,tagElement,children}=props;return _jsx(GenericFieldComponent,Object.assign({resource:"stock_transfers",attribute,tagElement,context:StockTransferChildrenContext},{children}))}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{InitialSkuContext}from'../../context/SkuChildrenContext';import{InitialStockTransferContext}from'../../context/StockTransferChildrenContext';import{LineItem,Sku}from'@commercelayer/sdk';import{InitialLineItemContext}from'../../context/LineItemChildrenContext';import{Context}from'react';export declare type TResources={StockTransfer:LineItem&{resource:'stock_transfers';};Sku:Sku&{resource:'skus';};LineItem:LineItem&{resource:'line_items';};};export declare type TResourceKey={[K in keyof TResources]:K;};declare type ChildrenProps<E extends TResources[keyof TResources]>=Omit<Props<E>,'children'|'attribute'>&{element:E[keyof E];};declare type ResourceContext={stock_transfers:InitialStockTransferContext;skus:InitialSkuContext;line_items:InitialLineItemContext;};declare type GenericContext<K extends keyof ResourceContext>=Context<ResourceContext[K]>;declare type Props<E extends TResources[keyof TResources]>={children?:(props:ChildrenProps<E>)=>JSX.Element;resource:E['resource'];attribute:keyof E;tagElement:keyof JSX.IntrinsicElements;context:GenericContext<E['resource']>;};export default function GenericFieldComponent<R extends keyof TResources>(props:Props<TResources[R]>):JSX.Element;export{};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import Parent from"./Parent";import{useContext}from"react";export default function GenericFieldComponent(props){const{children,tagElement,attribute,context}=props,p=__rest(props,["children","tagElement","attribute","context"]),resourceContext=useContext(context);let element;for(const key in resourceContext)Object.prototype.hasOwnProperty.call(resourceContext,key)&&(element=resourceContext[key][attribute]);const Tag=tagElement||"span";if(Tag==="img"&&!children)return _jsx("img",Object.assign({alt:"",src:element},p));const parentProps=Object.assign({element,tagElement},p);return children?_jsx(Parent,Object.assign({},parentProps,{children})):_jsx(Tag,Object.assign({},p,{children:element}))}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import PropTypes from'prop-types';import{TimeFormat,BaseInputType,GiftCardInputName,LineItemType,BasePriceType,BaseFormatPrice,BaseSelectorType,AddressInputName,AddressCountrySelectName,AddressStateSelectName}from'../typings/index';import{DeliveryLeadTimeField}from'../components/DeliveryLeadTime';import{StockTransferFieldType}from'../components/StockTransferField';import{PaymentSourceDetailType}from'../components/PaymentSourceDetail';import{CodeType}from'../reducers/OrderReducer';import{ShipmentAttribute}from'../components/ShipmentField';declare const components:{Address:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};AddressCountrySelector:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;placeholder:PropTypes.Requireable<PropTypes.InferProps<{label:PropTypes.Validator<string>;value:PropTypes.Validator<string|number>;}>>;value:PropTypes.Requireable<string>;name:PropTypes.Validator<AddressCountrySelectName>;required:PropTypes.Requireable<boolean>;};defaultProps:{required:boolean;};};AddressStateSelector:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;placeholder:PropTypes.Requireable<PropTypes.InferProps<{label:PropTypes.Validator<string>;value:PropTypes.Validator<string|number>;}>>;value:PropTypes.Requireable<string>;name:PropTypes.Validator<AddressStateSelectName>;required:PropTypes.Requireable<boolean>;};defaultProps:{required:boolean;};};AddressField:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;};};AddressInput:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;name:PropTypes.Validator<AddressInputName>;type:PropTypes.Validator<BaseInputType>;placeholder:PropTypes.Requireable<string>;disabled:PropTypes.Requireable<boolean>;required:PropTypes.Requireable<boolean>;};defaultProps:{required:boolean;};};AdjustmentAmount:{displayName:string;propTypes:{id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;name:PropTypes.Requireable<string>;children:PropTypes.Requireable<(...args:any[])=>any>;format:PropTypes.Requireable<BaseFormatPrice>;};defaultProps:{format:BaseFormatPrice;};};AddToCartButton:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;label:PropTypes.Requireable<string|PropTypes.ReactElementLike>;skuCode:PropTypes.Requireable<string>;disabled:PropTypes.Requireable<boolean>;buyNowMode:PropTypes.Requireable<boolean>;checkoutUrl:PropTypes.Requireable<string>;lineItem:PropTypes.Requireable<PropTypes.InferProps<{name:PropTypes.Validator<string>;imageUrl:PropTypes.Requireable<string>;}>>;};defaultProps:{label:string;};};AddressesContainer:{displayName:string;permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;shipToDifferentAddress:PropTypes.Requireable<boolean>;};};AvailabilityContainer:{displayName:string;permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;skuCode:PropTypes.Requireable<string>;};};AvailabilityTemplate:{displayName:string;propTypes:{timeFormat:PropTypes.Requireable<TimeFormat>;showShippingMethodName:PropTypes.Requireable<boolean>;children:PropTypes.Requireable<(...args:any[])=>any>;};defaultProps:{timeFormat:string;showShippingMethodName:boolean;};};BillingAddressContainer:{permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};BillingAddressForm:{permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};CheckoutLink:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;label:PropTypes.Requireable<string>;};defaultProps:{label:string;};};CommerceLayer:{permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;accessToken:PropTypes.Validator<string>;endpoint:PropTypes.Validator<string>;};};CustomerContainer:{displayName:string;permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;isGuest:PropTypes.Requireable<boolean>;};};CustomerInput:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;name:PropTypes.Requireable<string>;type:PropTypes.Requireable<string>;placeholder:PropTypes.Requireable<string>;disabled:PropTypes.Requireable<boolean>;required:PropTypes.Requireable<boolean>;saveOnBlur:PropTypes.Requireable<boolean>;};defaultProps:{required:boolean;};};DeliveryLeadTime:{displayName:string;propTypes:{type:PropTypes.Validator<DeliveryLeadTimeField>;children:PropTypes.Requireable<(...args:any[])=>any>;};};DiscountAmount:{displayName:string;propTypes:{id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;name:PropTypes.Requireable<string>;children:PropTypes.Requireable<(...args:any[])=>any>;format:PropTypes.Requireable<BaseFormatPrice>;};defaultProps:{format:BaseFormatPrice;};};Errors:{displayName:string;propTypes:{resource:PropTypes.Validator<import("../typings/errors").ResourceErrorType>;children:PropTypes.Requireable<(...args:any[])=>any>;field:PropTypes.Requireable<string>;};defaultProps:{messages:never[];field:string;};};ExternalFunction:{displayName:string;permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;url:PropTypes.Validator<string>;};};GiftCard:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;onSubmit:PropTypes.Requireable<(...args:any[])=>any>;};defaultProps:{onSubmit:undefined;};};GiftCardAmount:{displayName:string;propTypes:{id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;name:PropTypes.Requireable<string>;children:PropTypes.Requireable<(...args:any[])=>any>;format:PropTypes.Requireable<BaseFormatPrice>;};};GiftCardContainer:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};GiftCardCurrencySelector:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;placeholder:PropTypes.Requireable<PropTypes.InferProps<{value:PropTypes.Validator<string|number>;label:PropTypes.Validator<string>;}>>;value:PropTypes.Requireable<string>;required:PropTypes.Requireable<boolean>;};defaultProps:{required:boolean;};};GiftCardInput:{displayName:string;propTypes:{type:PropTypes.Validator<BaseInputType>;name:PropTypes.Validator<GiftCardInputName>;children:PropTypes.Requireable<(...args:any[])=>any>;placeholder:PropTypes.Requireable<string>;};};GiftCardOrCouponForm:{permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};GiftCardOrCouponInput:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;placeholder:PropTypes.Requireable<string>;disabled:PropTypes.Requireable<boolean>;required:PropTypes.Requireable<boolean>;};};GiftCardOrCouponSubmit:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;label:PropTypes.Requireable<string|object>;};};GiftCardOrCouponCode:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;type:PropTypes.Requireable<CodeType>;};};GiftCardOrCouponRemoveButton:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;type:PropTypes.Requireable<CodeType>;label:PropTypes.Requireable<string|object>;};};ItemContainer:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;skuCode:PropTypes.Requireable<string>;lineItem:PropTypes.Requireable<PropTypes.InferProps<{name:PropTypes.Validator<string>;imageUrl:PropTypes.Requireable<string>;}>>;};};LineItem:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;type:PropTypes.Requireable<LineItemType>;};defaultProps:{type:string;};};LineItemAmount:{displayName:string;propTypes:{type:PropTypes.Requireable<BasePriceType>;id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;name:PropTypes.Requireable<string>;children:PropTypes.Requireable<(...args:any[])=>any>;format:PropTypes.Requireable<BaseFormatPrice>;};defaultProps:{format:string;type:string;};};LineItemImage:{displayName:string;propTypes:{width:PropTypes.Requireable<number>;children:PropTypes.Requireable<(...args:any[])=>any>;};};LineItemName:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;};};LineItemCode:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;};};LineItemOption:{displayName:string;propTypes:{name:PropTypes.Requireable<string>;children:PropTypes.Requireable<(...args:any[])=>any>;valueClassName:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;id:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;};};LineItemOptions:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;title:PropTypes.Requireable<string>;showName:PropTypes.Requireable<boolean>;skuOptionId:PropTypes.Requireable<string>;};};LineItemQuantity:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;max:PropTypes.Requireable<number>;disabled:PropTypes.Requireable<boolean>;readonly:PropTypes.Requireable<boolean>;};defaultProps:{max:number;};};LineItemRemoveLink:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;label:PropTypes.Requireable<string>;};defaultProps:{label:string;};};LineItemsContainer:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;filters:PropTypes.Requireable<object>;loader:PropTypes.Requireable<string|PropTypes.ReactElementLike>;};defaultProps:{filters:{};loader:string;};};LineItemsCount:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;name:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;};};LineItemsEmpty:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;name:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;text:PropTypes.Requireable<string>;};};MetadataInput:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;name:PropTypes.Validator<string>;type:PropTypes.Validator<BaseInputType>;onChange:PropTypes.Requireable<(...args:any[])=>any>;placeholder:PropTypes.Requireable<string>;};};OrderContainer:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;orderId:PropTypes.Requireable<string>;metadata:PropTypes.Requireable<{[x:string]:string|null|undefined;}>;attributes:PropTypes.Requireable<object>;};defaultProps:{metadata:{};};};OrderNumber:{displayName:string;propTypes:{className:PropTypes.Requireable<string>;};defaultProps:{format:BaseFormatPrice;};};OrderStorage:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;clearWhenPlaced:PropTypes.Requireable<boolean>;persistKey:PropTypes.Validator<string>;};};PaymentMethod:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};PaymentMethodAmount:{displayName:string;propTypes:{id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;name:PropTypes.Requireable<string>;children:PropTypes.Requireable<(...args:any[])=>any>;format:PropTypes.Requireable<BaseFormatPrice>;};defaultProps:{format:BaseFormatPrice;};};PaymentMethodName:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;};};PaymentMethodPrice:{displayName:string;propTypes:{type:PropTypes.Requireable<"amount">;id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;name:PropTypes.Requireable<string>;children:PropTypes.Requireable<(...args:any[])=>any>;format:PropTypes.Requireable<BaseFormatPrice>;};};PaymentMethodRadioButton:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;};};PaymentMethodsContainer:{displayName:string;permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};PaymentSource:{displayName:string;permittedChildren:string[];propTypes:{children:PropTypes.Requireable<import("react").ReactNode|(()=>import("react").ReactNode)>;readonly:PropTypes.Requireable<boolean>;};};PaymentSourceBrandIcon:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;width:PropTypes.Requireable<number>;height:PropTypes.Requireable<number>;src:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;};};PaymentSourceBrandName:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;label:PropTypes.Requireable<string>;};};PaymentSourceEditButton:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;label:PropTypes.Requireable<string|PropTypes.ReactElementLike>;};};PaymentSourceDetail:{displayName:string;propTypes:{type:PropTypes.Validator<PaymentSourceDetailType>;};};PlaceOrderButton:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;label:PropTypes.Requireable<string|PropTypes.ReactElementLike>;};defaultProps:{label:string;};};PlaceOrderContainer:{displayName:string;permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};Price:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;compareClassName:PropTypes.Requireable<string>;skuCode:PropTypes.Requireable<string>;showCompare:PropTypes.Requireable<boolean>;};defaultProps:{skuCode:string;};};PricesContainer:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;skuCode:PropTypes.Requireable<string>;loader:PropTypes.Requireable<string|PropTypes.ReactElementLike>;perPage:PropTypes.Requireable<number>;filters:PropTypes.Requireable<object>;};defaultProps:{perPage:number;filters:{};loader:string;skuCode:string;};};PrivacyAndTermsCheckbox:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;};};QuantitySelector:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;min:PropTypes.Requireable<number>;max:PropTypes.Requireable<number>;value:PropTypes.Requireable<string>;skuCode:PropTypes.Requireable<string>;disabled:PropTypes.Requireable<boolean>;};defaultProps:{min:number;};};SaveAddressesButton:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;label:PropTypes.Requireable<string|PropTypes.ReactElementLike>;onClick:PropTypes.Requireable<(...args:any[])=>any>;disabled:PropTypes.Requireable<boolean>;};defaultProps:{label:string;};};Shipment:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};ShipmentField:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;name:PropTypes.Validator<ShipmentAttribute>;};};ShipmentsContainer:{displayName:string;permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};ShippingAddressContainer:{permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};SaveCustomerButton:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;label:PropTypes.Requireable<string|PropTypes.ReactElementLike>;onClick:PropTypes.Requireable<(...args:any[])=>any>;};defaultProps:{label:string;};};ShippingAddressForm:{permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};ShippingAmount:{displayName:string;propTypes:{id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;name:PropTypes.Requireable<string>;children:PropTypes.Requireable<(...args:any[])=>any>;format:PropTypes.Requireable<BaseFormatPrice>;};};ShippingMethod:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;readonly:PropTypes.Requireable<boolean>;};};ShippingMethodName:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;};};ShippingMethodRadioButton:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;};};ShippingMethodPrice:{displayName:string;propTypes:{type:PropTypes.Requireable<"amount">;id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;name:PropTypes.Requireable<string>;children:PropTypes.Requireable<(...args:any[])=>any>;format:PropTypes.Requireable<BaseFormatPrice>;};defaultProps:{format:string;type:string;};};SkusContainer:{displayName:string;permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};Skus:{displayName:string;permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};SkuField:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;attribute:PropTypes.Requireable<string>;tagElement:PropTypes.Requireable<string>;};};SkuList:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;id:PropTypes.Validator<string>;};};SkuListsContainer:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};SkuOption:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;id:PropTypes.Validator<string>;};};SkuOptionInput:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;name:PropTypes.Validator<string>;type:PropTypes.Validator<BaseInputType>;onChange:PropTypes.Requireable<(...args:any[])=>any>;placeholder:PropTypes.Requireable<string>;};};SkuOptionsContainer:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;skuCode:PropTypes.Requireable<string>;};};StockTransfer:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};StockTransferField:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;type:PropTypes.Validator<StockTransferFieldType>;};};SubmitButton:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;label:PropTypes.Requireable<string|PropTypes.ReactElementLike>;};defaultProps:{label:string;};};SubTotalAmount:{displayName:string;propTypes:{id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;name:PropTypes.Requireable<string>;children:PropTypes.Requireable<(...args:any[])=>any>;format:PropTypes.Requireable<BaseFormatPrice>;};defaultProps:{format:BaseFormatPrice;};};TaxesAmount:{displayName:string;propTypes:{id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;name:PropTypes.Requireable<string>;children:PropTypes.Requireable<(...args:any[])=>any>;format:PropTypes.Requireable<BaseFormatPrice>;};defaultProps:{format:BaseFormatPrice;};};TotalAmount:{displayName:string;propTypes:{id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;name:PropTypes.Requireable<string>;children:PropTypes.Requireable<(...args:any[])=>any>;format:PropTypes.Requireable<BaseFormatPrice>;};defaultProps:{format:BaseFormatPrice;};};VariantsContainer:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;skuCode:PropTypes.Requireable<string>;filters:PropTypes.Requireable<object>;};defaultProps:{skuCode:string;filters:{};};};VariantSelector:{displayName:string;propTypes:{options:PropTypes.Validator<PropTypes.InferProps<{label:PropTypes.Validator<string>;code:PropTypes.Validator<string>;lineItem:PropTypes.Requireable<PropTypes.InferProps<{name:PropTypes.Validator<string>;imageUrl:PropTypes.Requireable<string>;}>>;}>[]>;name:PropTypes.Requireable<string>;children:PropTypes.Requireable<(...args:any[])=>any>;type:PropTypes.Requireable<BaseSelectorType>;loader:PropTypes.Requireable<PropTypes.ReactElementLike>;placeholder:PropTypes.Requireable<string>;skuCode:PropTypes.Requireable<string>;};defaultProps:{placeholder:string;type:BaseSelectorType;};};};export default components;
|
|
2
|
+
import PropTypes from'prop-types';import{TimeFormat,BaseInputType,GiftCardInputName,LineItemType,BasePriceType,BaseFormatPrice,BaseSelectorType,AddressInputName,AddressCountrySelectName,AddressStateSelectName}from'../typings/index';import{DeliveryLeadTimeField}from'../components/DeliveryLeadTime';import{PaymentSourceDetailType}from'../components/PaymentSourceDetail';import{CodeType}from'../reducers/OrderReducer';import{ShipmentAttribute}from'../components/ShipmentField';declare const components:{Address:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};AddressCountrySelector:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;placeholder:PropTypes.Requireable<PropTypes.InferProps<{label:PropTypes.Validator<string>;value:PropTypes.Validator<string|number>;}>>;value:PropTypes.Requireable<string>;name:PropTypes.Validator<AddressCountrySelectName>;required:PropTypes.Requireable<boolean>;};defaultProps:{required:boolean;};};AddressStateSelector:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;placeholder:PropTypes.Requireable<PropTypes.InferProps<{label:PropTypes.Validator<string>;value:PropTypes.Validator<string|number>;}>>;value:PropTypes.Requireable<string>;name:PropTypes.Validator<AddressStateSelectName>;required:PropTypes.Requireable<boolean>;};defaultProps:{required:boolean;};};AddressField:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;};};AddressInput:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;name:PropTypes.Validator<AddressInputName>;type:PropTypes.Validator<BaseInputType>;placeholder:PropTypes.Requireable<string>;disabled:PropTypes.Requireable<boolean>;required:PropTypes.Requireable<boolean>;};defaultProps:{required:boolean;};};AdjustmentAmount:{displayName:string;propTypes:{id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;name:PropTypes.Requireable<string>;children:PropTypes.Requireable<(...args:any[])=>any>;format:PropTypes.Requireable<BaseFormatPrice>;};defaultProps:{format:BaseFormatPrice;};};AddToCartButton:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;label:PropTypes.Requireable<string|PropTypes.ReactElementLike>;skuCode:PropTypes.Requireable<string>;disabled:PropTypes.Requireable<boolean>;buyNowMode:PropTypes.Requireable<boolean>;checkoutUrl:PropTypes.Requireable<string>;lineItem:PropTypes.Requireable<PropTypes.InferProps<{name:PropTypes.Validator<string>;imageUrl:PropTypes.Requireable<string>;}>>;};defaultProps:{label:string;};};AddressesContainer:{displayName:string;permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;shipToDifferentAddress:PropTypes.Requireable<boolean>;};};AvailabilityContainer:{displayName:string;permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;skuCode:PropTypes.Requireable<string>;};};AvailabilityTemplate:{displayName:string;propTypes:{timeFormat:PropTypes.Requireable<TimeFormat>;showShippingMethodName:PropTypes.Requireable<boolean>;children:PropTypes.Requireable<(...args:any[])=>any>;};defaultProps:{timeFormat:string;showShippingMethodName:boolean;};};BillingAddressContainer:{permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};BillingAddressForm:{permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};CheckoutLink:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;label:PropTypes.Requireable<string>;};defaultProps:{label:string;};};CommerceLayer:{permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;accessToken:PropTypes.Validator<string>;endpoint:PropTypes.Validator<string>;};};CustomerContainer:{displayName:string;permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;isGuest:PropTypes.Requireable<boolean>;};};CustomerInput:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;name:PropTypes.Requireable<string>;type:PropTypes.Requireable<string>;placeholder:PropTypes.Requireable<string>;disabled:PropTypes.Requireable<boolean>;required:PropTypes.Requireable<boolean>;saveOnBlur:PropTypes.Requireable<boolean>;};defaultProps:{required:boolean;};};DeliveryLeadTime:{displayName:string;propTypes:{type:PropTypes.Validator<DeliveryLeadTimeField>;children:PropTypes.Requireable<(...args:any[])=>any>;};};DiscountAmount:{displayName:string;propTypes:{id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;name:PropTypes.Requireable<string>;children:PropTypes.Requireable<(...args:any[])=>any>;format:PropTypes.Requireable<BaseFormatPrice>;};defaultProps:{format:BaseFormatPrice;};};Errors:{displayName:string;propTypes:{resource:PropTypes.Validator<import("../typings/errors").ResourceErrorType>;children:PropTypes.Requireable<(...args:any[])=>any>;field:PropTypes.Requireable<string>;};defaultProps:{messages:never[];field:string;};};ExternalFunction:{displayName:string;permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;url:PropTypes.Validator<string>;};};GiftCard:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;onSubmit:PropTypes.Requireable<(...args:any[])=>any>;};defaultProps:{onSubmit:undefined;};};GiftCardAmount:{displayName:string;propTypes:{id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;name:PropTypes.Requireable<string>;children:PropTypes.Requireable<(...args:any[])=>any>;format:PropTypes.Requireable<BaseFormatPrice>;};};GiftCardContainer:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};GiftCardCurrencySelector:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;placeholder:PropTypes.Requireable<PropTypes.InferProps<{value:PropTypes.Validator<string|number>;label:PropTypes.Validator<string>;}>>;value:PropTypes.Requireable<string>;required:PropTypes.Requireable<boolean>;};defaultProps:{required:boolean;};};GiftCardInput:{displayName:string;propTypes:{type:PropTypes.Validator<BaseInputType>;name:PropTypes.Validator<GiftCardInputName>;children:PropTypes.Requireable<(...args:any[])=>any>;placeholder:PropTypes.Requireable<string>;};};GiftCardOrCouponForm:{permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};GiftCardOrCouponInput:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;placeholder:PropTypes.Requireable<string>;disabled:PropTypes.Requireable<boolean>;required:PropTypes.Requireable<boolean>;};};GiftCardOrCouponSubmit:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;label:PropTypes.Requireable<string|object>;};};GiftCardOrCouponCode:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;type:PropTypes.Requireable<CodeType>;};};GiftCardOrCouponRemoveButton:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;type:PropTypes.Requireable<CodeType>;label:PropTypes.Requireable<string|object>;};};ItemContainer:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;skuCode:PropTypes.Requireable<string>;lineItem:PropTypes.Requireable<PropTypes.InferProps<{name:PropTypes.Validator<string>;imageUrl:PropTypes.Requireable<string>;}>>;};};LineItem:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;type:PropTypes.Requireable<LineItemType>;};defaultProps:{type:string;};};LineItemAmount:{displayName:string;propTypes:{type:PropTypes.Requireable<BasePriceType>;id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;name:PropTypes.Requireable<string>;children:PropTypes.Requireable<(...args:any[])=>any>;format:PropTypes.Requireable<BaseFormatPrice>;};defaultProps:{format:string;type:string;};};LineItemImage:{displayName:string;propTypes:{width:PropTypes.Requireable<number>;children:PropTypes.Requireable<(...args:any[])=>any>;};};LineItemName:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;};};LineItemCode:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;};};LineItemOption:{displayName:string;propTypes:{name:PropTypes.Requireable<string>;children:PropTypes.Requireable<(...args:any[])=>any>;valueClassName:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;id:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;};};LineItemOptions:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;title:PropTypes.Requireable<string>;showName:PropTypes.Requireable<boolean>;skuOptionId:PropTypes.Requireable<string>;};};LineItemQuantity:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;max:PropTypes.Requireable<number>;disabled:PropTypes.Requireable<boolean>;readonly:PropTypes.Requireable<boolean>;};defaultProps:{max:number;};};LineItemRemoveLink:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;label:PropTypes.Requireable<string>;};defaultProps:{label:string;};};LineItemsContainer:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;filters:PropTypes.Requireable<object>;loader:PropTypes.Requireable<string|PropTypes.ReactElementLike>;};defaultProps:{filters:{};loader:string;};};LineItemsCount:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;name:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;};};LineItemsEmpty:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;name:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;text:PropTypes.Requireable<string>;};};MetadataInput:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;name:PropTypes.Validator<string>;type:PropTypes.Validator<BaseInputType>;onChange:PropTypes.Requireable<(...args:any[])=>any>;placeholder:PropTypes.Requireable<string>;};};OrderContainer:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;orderId:PropTypes.Requireable<string>;metadata:PropTypes.Requireable<{[x:string]:string|null|undefined;}>;attributes:PropTypes.Requireable<object>;};defaultProps:{metadata:{};};};OrderNumber:{displayName:string;propTypes:{className:PropTypes.Requireable<string>;};defaultProps:{format:BaseFormatPrice;};};OrderStorage:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;clearWhenPlaced:PropTypes.Requireable<boolean>;persistKey:PropTypes.Validator<string>;};};PaymentMethod:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};PaymentMethodAmount:{displayName:string;propTypes:{id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;name:PropTypes.Requireable<string>;children:PropTypes.Requireable<(...args:any[])=>any>;format:PropTypes.Requireable<BaseFormatPrice>;};defaultProps:{format:BaseFormatPrice;};};PaymentMethodName:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;};};PaymentMethodPrice:{displayName:string;propTypes:{type:PropTypes.Requireable<"amount">;id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;name:PropTypes.Requireable<string>;children:PropTypes.Requireable<(...args:any[])=>any>;format:PropTypes.Requireable<BaseFormatPrice>;};};PaymentMethodRadioButton:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;};};PaymentMethodsContainer:{displayName:string;permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};PaymentSource:{displayName:string;permittedChildren:string[];propTypes:{children:PropTypes.Requireable<import("react").ReactNode|(()=>import("react").ReactNode)>;readonly:PropTypes.Requireable<boolean>;};};PaymentSourceBrandIcon:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;width:PropTypes.Requireable<number>;height:PropTypes.Requireable<number>;src:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;};};PaymentSourceBrandName:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;label:PropTypes.Requireable<string>;};};PaymentSourceEditButton:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;label:PropTypes.Requireable<string|PropTypes.ReactElementLike>;};};PaymentSourceDetail:{displayName:string;propTypes:{type:PropTypes.Validator<PaymentSourceDetailType>;};};PlaceOrderButton:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;label:PropTypes.Requireable<string|PropTypes.ReactElementLike>;};defaultProps:{label:string;};};PlaceOrderContainer:{displayName:string;permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};Price:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;compareClassName:PropTypes.Requireable<string>;skuCode:PropTypes.Requireable<string>;showCompare:PropTypes.Requireable<boolean>;};defaultProps:{skuCode:string;};};PricesContainer:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;skuCode:PropTypes.Requireable<string>;loader:PropTypes.Requireable<string|PropTypes.ReactElementLike>;perPage:PropTypes.Requireable<number>;filters:PropTypes.Requireable<object>;};defaultProps:{perPage:number;filters:{};loader:string;skuCode:string;};};PrivacyAndTermsCheckbox:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;};};QuantitySelector:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;min:PropTypes.Requireable<number>;max:PropTypes.Requireable<number>;value:PropTypes.Requireable<string>;skuCode:PropTypes.Requireable<string>;disabled:PropTypes.Requireable<boolean>;};defaultProps:{min:number;};};SaveAddressesButton:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;label:PropTypes.Requireable<string|PropTypes.ReactElementLike>;onClick:PropTypes.Requireable<(...args:any[])=>any>;disabled:PropTypes.Requireable<boolean>;};defaultProps:{label:string;};};Shipment:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};ShipmentField:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;name:PropTypes.Validator<ShipmentAttribute>;};};ShipmentsContainer:{displayName:string;permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};ShippingAddressContainer:{permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};SaveCustomerButton:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;label:PropTypes.Requireable<string|PropTypes.ReactElementLike>;onClick:PropTypes.Requireable<(...args:any[])=>any>;};defaultProps:{label:string;};};ShippingAddressForm:{permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};ShippingAmount:{displayName:string;propTypes:{id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;name:PropTypes.Requireable<string>;children:PropTypes.Requireable<(...args:any[])=>any>;format:PropTypes.Requireable<BaseFormatPrice>;};};ShippingMethod:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;readonly:PropTypes.Requireable<boolean>;};};ShippingMethodName:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;};};ShippingMethodRadioButton:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;};};ShippingMethodPrice:{displayName:string;propTypes:{type:PropTypes.Requireable<"amount">;id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;name:PropTypes.Requireable<string>;children:PropTypes.Requireable<(...args:any[])=>any>;format:PropTypes.Requireable<BaseFormatPrice>;};defaultProps:{format:string;type:string;};};SkusContainer:{displayName:string;permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};Skus:{displayName:string;permittedChildren:string[];propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};SkuField:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;attribute:PropTypes.Requireable<string>;tagElement:PropTypes.Requireable<string>;};};SkuList:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;id:PropTypes.Validator<string>;};};SkuListsContainer:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};SkuOption:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;id:PropTypes.Validator<string>;};};SkuOptionInput:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;name:PropTypes.Validator<string>;type:PropTypes.Validator<BaseInputType>;onChange:PropTypes.Requireable<(...args:any[])=>any>;placeholder:PropTypes.Requireable<string>;};};SkuOptionsContainer:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;skuCode:PropTypes.Requireable<string>;};};StockTransfer:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;};};StockTransferField:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;};};SubmitButton:{displayName:string;propTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;label:PropTypes.Requireable<string|PropTypes.ReactElementLike>;};defaultProps:{label:string;};};SubTotalAmount:{displayName:string;propTypes:{id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;name:PropTypes.Requireable<string>;children:PropTypes.Requireable<(...args:any[])=>any>;format:PropTypes.Requireable<BaseFormatPrice>;};defaultProps:{format:BaseFormatPrice;};};TaxesAmount:{displayName:string;propTypes:{id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;name:PropTypes.Requireable<string>;children:PropTypes.Requireable<(...args:any[])=>any>;format:PropTypes.Requireable<BaseFormatPrice>;};defaultProps:{format:BaseFormatPrice;};};TotalAmount:{displayName:string;propTypes:{id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;name:PropTypes.Requireable<string>;children:PropTypes.Requireable<(...args:any[])=>any>;format:PropTypes.Requireable<BaseFormatPrice>;};defaultProps:{format:BaseFormatPrice;};};VariantsContainer:{permittedChildren:string[];displayName:string;propTypes:{children:PropTypes.Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>import("react").ReactNode)>;skuCode:PropTypes.Requireable<string>;filters:PropTypes.Requireable<object>;};defaultProps:{skuCode:string;filters:{};};};VariantSelector:{displayName:string;propTypes:{options:PropTypes.Validator<PropTypes.InferProps<{label:PropTypes.Validator<string>;code:PropTypes.Validator<string>;lineItem:PropTypes.Requireable<PropTypes.InferProps<{name:PropTypes.Validator<string>;imageUrl:PropTypes.Requireable<string>;}>>;}>[]>;name:PropTypes.Requireable<string>;children:PropTypes.Requireable<(...args:any[])=>any>;type:PropTypes.Requireable<BaseSelectorType>;loader:PropTypes.Requireable<PropTypes.ReactElementLike>;placeholder:PropTypes.Requireable<string>;skuCode:PropTypes.Requireable<string>;};defaultProps:{placeholder:string;type:BaseSelectorType;};};};export default components;
|
package/lib/config/components.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import PropTypes from"prop-types";import childrenTypes from"../utils/childrenTypes";import{baseOrderComponentPricePropTypes,PTLoader,BMObject}from"../typings/index";import{ErrorPropTypes}from"../typings/errors";import{BaseInputComponentPropTypes}from"../typings/index";const components={Address:{permittedChildren:["AddressField","ReactNode"],displayName:"Address",propTypes:{children:childrenTypes.isRequired}},AddressCountrySelector:{displayName:"AddressCountrySelector",propTypes:{children:PropTypes.func,placeholder:PropTypes.shape({label:PropTypes.string.isRequired,value:PropTypes.oneOfType([PropTypes.string,PropTypes.number]).isRequired}),value:PropTypes.string,name:PropTypes.oneOf(["billing_address_country_code","shipping_address_country_code"]).isRequired,required:PropTypes.bool},defaultProps:{required:!0}},AddressStateSelector:{displayName:"AddressStateSelector",propTypes:{children:PropTypes.func,placeholder:PropTypes.shape({label:PropTypes.string.isRequired,value:PropTypes.oneOfType([PropTypes.string,PropTypes.number]).isRequired}),value:PropTypes.string,name:PropTypes.oneOf(["billing_address_state_code","shipping_address_state_code"]).isRequired,required:PropTypes.bool},defaultProps:{required:!0}},AddressField:{displayName:"AddressField",propTypes:{children:PropTypes.func}},AddressInput:{displayName:"AddressInput",propTypes:{children:PropTypes.func,name:PropTypes.oneOf(["billing_address_city","billing_address_company","billing_address_email","billing_address_first_name","billing_address_last_name","billing_address_line_1","billing_address_line_2","billing_address_phone","billing_address_state_code","billing_address_zip_code","billing_address_billing_info","billing_address_save_to_customer_book","shipping_address_city","shipping_address_company","shipping_address_email","shipping_address_first_name","shipping_address_last_name","shipping_address_line_1","shipping_address_line_2","shipping_address_phone","shipping_address_state_code","shipping_address_zip_code","shipping_address_save_to_customer_book"]).isRequired,type:PropTypes.oneOf(["checkbox","date","email","number","tel","text","textarea"]).isRequired,placeholder:PropTypes.string,disabled:PropTypes.bool,required:PropTypes.bool},defaultProps:{required:!0}},AdjustmentAmount:{displayName:"AdjustmentAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},AddToCartButton:{displayName:"AddToCartButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element]),skuCode:PropTypes.string,disabled:PropTypes.bool,buyNowMode:PropTypes.bool,checkoutUrl:PropTypes.string,lineItem:PropTypes.shape({name:PropTypes.string.isRequired,imageUrl:PropTypes.string})},defaultProps:{label:"Add to cart"}},AddressesContainer:{displayName:"AddressesContainer",permittedChildren:["BillingAddressForm","BillingAddressContainer","ShippingAddressForm","ShippingAddressContainer","SaveAddressesButton","ReactNode"],propTypes:{children:childrenTypes.isRequired,shipToDifferentAddress:PropTypes.bool}},AvailabilityContainer:{displayName:"AvailabilityContainer",permittedChildren:["AvailabilityTemplate","ReactNode"],propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string}},AvailabilityTemplate:{displayName:"AvailabilityTemplate",propTypes:{timeFormat:PropTypes.oneOf(["days","hours"]),showShippingMethodName:PropTypes.bool,children:PropTypes.func},defaultProps:{timeFormat:"days",showShippingMethodName:!1}},BillingAddressContainer:{permittedChildren:["Address","ReactNode"],propTypes:{children:childrenTypes.isRequired}},BillingAddressForm:{permittedChildren:["AddressInput","ReactNode","Errors"],propTypes:{children:childrenTypes.isRequired}},CheckoutLink:{displayName:"CheckoutLink",propTypes:{children:PropTypes.func,label:PropTypes.string},defaultProps:{label:"Checkout"}},CommerceLayer:{permittedChildren:["OrderContainer","OrderStorage","PricesContainer","GiftCardContainer","ReactNode"],propTypes:{children:childrenTypes.isRequired,accessToken:PropTypes.string.isRequired,endpoint:PropTypes.string.isRequired}},CustomerContainer:{displayName:"CustomerContainer",permittedChildren:["CustomerInput","SaveCustomerButton","AddressesContainer","PaymentMethodsContainer","ShipmentsContainer","ReactNode"],propTypes:{children:childrenTypes.isRequired,isGuest:PropTypes.bool}},CustomerInput:{displayName:"CustomerInput",propTypes:{children:PropTypes.func,name:PropTypes.oneOf(["customerEmail"]),type:PropTypes.oneOf(["email"]),placeholder:PropTypes.string,disabled:PropTypes.bool,required:PropTypes.bool,saveOnBlur:PropTypes.bool},defaultProps:{required:!0}},DeliveryLeadTime:{displayName:"DeliveryLeadTime",propTypes:{type:PropTypes.oneOf(["max_days","max_hours","min_days","min_hours"]).isRequired,children:PropTypes.func}},DiscountAmount:{displayName:"DiscountAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},Errors:{displayName:"Errors",propTypes:ErrorPropTypes,defaultProps:{messages:[],field:"base"}},ExternalFunction:{displayName:"ExternalFunction",permittedChildren:["AddToCartButton","ReactNode"],propTypes:{children:childrenTypes.isRequired,url:PropTypes.string.isRequired}},GiftCard:{permittedChildren:["GiftCardCurrencySelector","GiftCardInput","Errors","MetadataInput","SubmitButton","ReactNode"],displayName:"GiftCard",propTypes:{children:childrenTypes.isRequired,onSubmit:PropTypes.func},defaultProps:{onSubmit:void 0}},GiftCardAmount:{displayName:"GiftCardAmount",propTypes:baseOrderComponentPricePropTypes},GiftCardContainer:{permittedChildren:["GiftCard","Errors","ReactNode"],displayName:"GiftCardContainer",propTypes:{children:childrenTypes.isRequired}},GiftCardCurrencySelector:{displayName:"GiftCardCurrencySelector",propTypes:{children:PropTypes.func,placeholder:PropTypes.shape({value:PropTypes.oneOfType([PropTypes.string,PropTypes.number]).isRequired,label:PropTypes.string.isRequired}),value:PropTypes.string,required:PropTypes.bool},defaultProps:{required:!0}},GiftCardInput:{displayName:"GiftCardInput",propTypes:{type:PropTypes.oneOf(["text","email","number","date","checkbox"]).isRequired,name:PropTypes.oneOf(["balanceCents","balanceMaxCents","singleUse","rechargeable","imageUrl","expiresAt","referenceOrigin","email","firstName","lastName","reference"]).isRequired,children:PropTypes.func,placeholder:PropTypes.string}},GiftCardOrCouponForm:{permittedChildren:["GiftCardOrCouponInput","GiftCardOrCouponSubmit","ReactNode"],propTypes:{children:childrenTypes.isRequired}},GiftCardOrCouponInput:{displayName:"GiftCardOrCouponInput",propTypes:{children:PropTypes.func,placeholder:PropTypes.string,disabled:PropTypes.bool,required:PropTypes.bool}},GiftCardOrCouponSubmit:{displayName:"GiftCardOrCouponSubmit",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.object])}},GiftCardOrCouponCode:{displayName:"GiftCardOrCouponCode",propTypes:{children:PropTypes.func,type:PropTypes.oneOf(["coupon","gift_card"])}},GiftCardOrCouponRemoveButton:{displayName:"GiftCardOrCouponRemoveButton",propTypes:{children:PropTypes.func,type:PropTypes.oneOf(["coupon","gift_card"]),label:PropTypes.oneOfType([PropTypes.string,PropTypes.object])}},ItemContainer:{permittedChildren:["PricesContainer","VariantsContainer","SkuOptionContainer","QuantitySelector","AddToCartButton","AvailabilityContainer","SkuListsContainer","ReactNode"],displayName:"ItemContainer",propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string,lineItem:PropTypes.shape({name:PropTypes.string.isRequired,imageUrl:PropTypes.string})}},LineItem:{permittedChildren:["AvailabilityContainer","LineItemImage","LineItemName","LineItemOptions","LineItemQuantity","LineItemAmount","LineItemRemoveLink","StockTransfer","Errors","ReactNode"],displayName:"LineItem",propTypes:{children:childrenTypes.isRequired,type:PropTypes.oneOf(["skus","gift_cards","shipments","payment_methods","promotions","adjustments","bundles"])},defaultProps:{type:"skus"}},LineItemAmount:{displayName:"LineItemAmount",propTypes:Object.assign(Object.assign({},baseOrderComponentPricePropTypes),{type:PropTypes.oneOf(["total","unit","option"])}),defaultProps:{format:"formatted",type:"total"}},LineItemImage:{displayName:"LineItemImage",propTypes:{width:PropTypes.number,children:PropTypes.func}},LineItemName:{displayName:"LineItemName",propTypes:{children:PropTypes.func}},LineItemCode:{displayName:"LineItemCode",propTypes:{children:PropTypes.func}},LineItemOption:{displayName:"LineItemOption",propTypes:{name:PropTypes.string,children:PropTypes.func,valueClassName:PropTypes.string,className:PropTypes.string,id:PropTypes.string,style:PropTypes.object}},LineItemOptions:{permittedChildren:["LineItemOption","ReactNode"],displayName:"LineItemOptions",propTypes:{children:childrenTypes.isRequired,title:PropTypes.string,showName:PropTypes.bool,skuOptionId:PropTypes.string}},LineItemQuantity:{displayName:"LineItemQuantity",propTypes:{children:PropTypes.func,max:PropTypes.number,disabled:PropTypes.bool,readonly:PropTypes.bool},defaultProps:{max:50}},LineItemRemoveLink:{displayName:"LineItemRemoveLink",propTypes:{children:PropTypes.func,label:PropTypes.string},defaultProps:{label:"Remove"}},LineItemsContainer:{permittedChildren:["LineItemsCount","LineItemsEmpty","LineItem","ReactNode"],displayName:"LineItemsContainer",propTypes:{children:childrenTypes.isRequired,filters:PropTypes.object,loader:PTLoader},defaultProps:{filters:{},loader:"Loading..."}},LineItemsCount:{displayName:"LineItemsCount",propTypes:{children:PropTypes.func,id:PropTypes.string,className:PropTypes.string,name:PropTypes.string,style:PropTypes.object}},LineItemsEmpty:{displayName:"LineItemsEmpty",propTypes:{children:PropTypes.func,id:PropTypes.string,className:PropTypes.string,name:PropTypes.string,style:PropTypes.object,text:PropTypes.string}},MetadataInput:{displayName:"MetadataInput",propTypes:BaseInputComponentPropTypes},OrderContainer:{permittedChildren:["AddressesContainer","CustomerContainer","ItemContainer","LineItemsContainer","SubTotalAmount","DiscountAmount","AdjustmentAmount","ShippingAmount","TaxesAmount","GiftCardAmount","TotalAmount","CheckoutLink","GiftCardContainer","ShipmentsContainer","PaymentMethodsContainer","PaymentMethodAmount","GiftCardOrCouponForm","GiftCardOrCouponCode","GiftCardOrCouponRemoveButton","Errors","OrderNumber","ReactNode"],displayName:"OrderContainer",propTypes:{children:childrenTypes.isRequired,orderId:PropTypes.string,metadata:BMObject,attributes:PropTypes.object},defaultProps:{metadata:{}}},OrderNumber:{displayName:"OrderNumber",propTypes:{className:PropTypes.string},defaultProps:{format:"formatted"}},OrderStorage:{permittedChildren:["OrderContainer","ReactNode"],displayName:"OrderStorage",propTypes:{children:childrenTypes.isRequired,clearWhenPlaced:PropTypes.bool,persistKey:PropTypes.string.isRequired}},PaymentMethod:{permittedChildren:["PaymentMethodName","PaymentMethodRadioButton","PaymentMethodPrice","PaymentSource","ReactNode","Errors"],displayName:"PaymentMethod",propTypes:{children:childrenTypes.isRequired}},PaymentMethodAmount:{displayName:"PaymentMethodAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},PaymentMethodName:{displayName:"PaymentMethodName",propTypes:{children:PropTypes.func}},PaymentMethodPrice:{displayName:"PaymentMethodPrice",propTypes:Object.assign(Object.assign({},baseOrderComponentPricePropTypes),{type:PropTypes.oneOf(["amount"])})},PaymentMethodRadioButton:{displayName:"PaymentMethodRadioButton",propTypes:{children:PropTypes.func}},PaymentMethodsContainer:{displayName:"PaymentMethodsContainer",permittedChildren:["PaymentSource","ReactNode","PlaceOrderContainer"],propTypes:{children:childrenTypes.isRequired}},PaymentSource:{displayName:"PaymentSource",permittedChildren:["PaymentSourceBrandIcon","PaymentSourceBrandName","PaymentSourceEditButton","PaymentSourceDetail","ReactNode"],propTypes:{children:childrenTypes,readonly:PropTypes.bool}},PaymentSourceBrandIcon:{displayName:"PaymentSourceBrandIcon",propTypes:{children:PropTypes.func,width:PropTypes.number,height:PropTypes.number,src:PropTypes.string,className:PropTypes.string}},PaymentSourceBrandName:{displayName:"PaymentSourceBrandName",propTypes:{children:PropTypes.func,label:PropTypes.string}},PaymentSourceEditButton:{displayName:"PaymentSourceEditButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element])}},PaymentSourceDetail:{displayName:"PaymentSourceDetail",propTypes:{type:PropTypes.oneOf(["last4","exp_year","exp_month"]).isRequired}},PlaceOrderButton:{displayName:"PlaceOrderButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element])},defaultProps:{label:"Place order"}},PlaceOrderContainer:{displayName:"PlaceOrderContainer",permittedChildren:["PaymentMethod","PlaceOrderButton","PrivacyAndTermsCheckbox","ReactNode"],propTypes:{children:childrenTypes.isRequired}},Price:{displayName:"Price",propTypes:{children:PropTypes.func,compareClassName:PropTypes.string,skuCode:PropTypes.string,showCompare:PropTypes.bool},defaultProps:{skuCode:""}},PricesContainer:{permittedChildren:["Price","ReactNode"],displayName:"PricesContainer",propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string,loader:PTLoader,perPage:PropTypes.number,filters:PropTypes.object},defaultProps:{perPage:10,filters:{},loader:"Loading...",skuCode:""}},PrivacyAndTermsCheckbox:{displayName:"PrivacyAndTermsCheckbox",propTypes:{children:PropTypes.func}},QuantitySelector:{displayName:"QuantitySelector",propTypes:{children:PropTypes.func,min:PropTypes.number,max:PropTypes.number,value:PropTypes.string,skuCode:PropTypes.string,disabled:PropTypes.bool},defaultProps:{min:1}},SaveAddressesButton:{displayName:"SaveAddressesButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element]),onClick:PropTypes.func,disabled:PropTypes.bool},defaultProps:{label:"Continue to delivery"}},Shipment:{permittedChildren:["LineItemsContainer","LineItem","ShippingMethod","ReactNode"],displayName:"Shipment",propTypes:{children:childrenTypes.isRequired}},ShipmentField:{displayName:"ShipmentField",propTypes:{children:PropTypes.func,name:PropTypes.oneOf(["cost_amount_cents","cost_amount_float","currency_code","formatted_cost_amount","number","status","key_number"]).isRequired}},ShipmentsContainer:{displayName:"ShipmentsContainer",permittedChildren:["Shipment","ReactNode","Errors"],propTypes:{children:childrenTypes.isRequired}},ShippingAddressContainer:{permittedChildren:["Address","ReactNode"],propTypes:{children:childrenTypes.isRequired}},SaveCustomerButton:{displayName:"SaveCustomerButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element]),onClick:PropTypes.func},defaultProps:{label:"Save"}},ShippingAddressForm:{permittedChildren:["AddressInput","ReactNode"],propTypes:{children:childrenTypes.isRequired}},ShippingAmount:{displayName:"ShippingAmount",propTypes:baseOrderComponentPricePropTypes},ShippingMethod:{permittedChildren:["ShippingMethodName","ShippingMethodPrice","ShippingMethodRadioButton","DeliveryLeadTime","ReactNode"],displayName:"ShippingMethod",propTypes:{children:childrenTypes.isRequired,readonly:PropTypes.bool}},ShippingMethodName:{displayName:"ShippingMethodName",propTypes:{children:PropTypes.func}},ShippingMethodRadioButton:{displayName:"ShippingMethodRadioButton",propTypes:{children:PropTypes.func}},ShippingMethodPrice:{displayName:"ShippingMethodPrice",propTypes:Object.assign(Object.assign({},baseOrderComponentPricePropTypes),{type:PropTypes.oneOf(["amount"])}),defaultProps:{format:"formatted",type:"amount"}},SkusContainer:{displayName:"SkuContainer",permittedChildren:["Skus","ReactNode"],propTypes:{children:childrenTypes.isRequired}},Skus:{displayName:"Skus",permittedChildren:["SkuField","ItemContainer","PricesContainer","AddToCartButton","AvailabilityContainer","QuantitySelector","ReactNode"],propTypes:{children:childrenTypes.isRequired}},SkuField:{displayName:"SkuField",propTypes:{children:PropTypes.func,attribute:PropTypes.string,tagElement:PropTypes.string}},SkuList:{permittedChildren:["AddToCartButton","QuantitySelector","ReactNode"],displayName:"SkuList",propTypes:{children:childrenTypes.isRequired,id:PropTypes.string.isRequired}},SkuListsContainer:{permittedChildren:["SkuList","ReactNode"],displayName:"SkuListsContainer",propTypes:{children:childrenTypes.isRequired}},SkuOption:{permittedChildren:["SkuOptionInput","ReactNode"],displayName:"SkuOption",propTypes:{children:childrenTypes.isRequired,id:PropTypes.string.isRequired}},SkuOptionInput:{displayName:"SkuOptionInput",propTypes:BaseInputComponentPropTypes},SkuOptionsContainer:{permittedChildren:["SkuOption","ReactNode"],displayName:"SkuOptionsContainer",propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string}},StockTransfer:{permittedChildren:["StockTransferField","ReactNode"],displayName:"StockTransfer",propTypes:{children:childrenTypes.isRequired}},StockTransferField:{displayName:"StockTransferField",propTypes:{children:PropTypes.func,type:PropTypes.oneOf(["quantity","sku_code"]).isRequired}},SubmitButton:{displayName:"SubmitButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element])},defaultProps:{label:"Submit"}},SubTotalAmount:{displayName:"SubTotalAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},TaxesAmount:{displayName:"TaxesAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},TotalAmount:{displayName:"TotalAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},VariantsContainer:{permittedChildren:["VariantSelector","ReactNode"],displayName:"VariantsContainer",propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string,filters:PropTypes.object},defaultProps:{skuCode:"",filters:{}}},VariantSelector:{displayName:"VariantSelector",propTypes:{options:PropTypes.arrayOf(PropTypes.shape({label:PropTypes.string.isRequired,code:PropTypes.string.isRequired,lineItem:PropTypes.shape({name:PropTypes.string.isRequired,imageUrl:PropTypes.string})}).isRequired).isRequired,name:PropTypes.string,children:PropTypes.func,type:PropTypes.oneOf(["select","radio"]),loader:PropTypes.element,placeholder:PropTypes.string,skuCode:PropTypes.string},defaultProps:{placeholder:"Select a variant",type:"select"}}};export default components;
|
|
1
|
+
import PropTypes from"prop-types";import childrenTypes from"../utils/childrenTypes";import{baseOrderComponentPricePropTypes,PTLoader,BMObject}from"../typings/index";import{ErrorPropTypes}from"../typings/errors";import{BaseInputComponentPropTypes}from"../typings/index";const components={Address:{permittedChildren:["AddressField","ReactNode"],displayName:"Address",propTypes:{children:childrenTypes.isRequired}},AddressCountrySelector:{displayName:"AddressCountrySelector",propTypes:{children:PropTypes.func,placeholder:PropTypes.shape({label:PropTypes.string.isRequired,value:PropTypes.oneOfType([PropTypes.string,PropTypes.number]).isRequired}),value:PropTypes.string,name:PropTypes.oneOf(["billing_address_country_code","shipping_address_country_code"]).isRequired,required:PropTypes.bool},defaultProps:{required:!0}},AddressStateSelector:{displayName:"AddressStateSelector",propTypes:{children:PropTypes.func,placeholder:PropTypes.shape({label:PropTypes.string.isRequired,value:PropTypes.oneOfType([PropTypes.string,PropTypes.number]).isRequired}),value:PropTypes.string,name:PropTypes.oneOf(["billing_address_state_code","shipping_address_state_code"]).isRequired,required:PropTypes.bool},defaultProps:{required:!0}},AddressField:{displayName:"AddressField",propTypes:{children:PropTypes.func}},AddressInput:{displayName:"AddressInput",propTypes:{children:PropTypes.func,name:PropTypes.oneOf(["billing_address_city","billing_address_company","billing_address_email","billing_address_first_name","billing_address_last_name","billing_address_line_1","billing_address_line_2","billing_address_phone","billing_address_state_code","billing_address_zip_code","billing_address_billing_info","billing_address_save_to_customer_book","shipping_address_city","shipping_address_company","shipping_address_email","shipping_address_first_name","shipping_address_last_name","shipping_address_line_1","shipping_address_line_2","shipping_address_phone","shipping_address_state_code","shipping_address_zip_code","shipping_address_save_to_customer_book"]).isRequired,type:PropTypes.oneOf(["checkbox","date","email","number","tel","text","textarea"]).isRequired,placeholder:PropTypes.string,disabled:PropTypes.bool,required:PropTypes.bool},defaultProps:{required:!0}},AdjustmentAmount:{displayName:"AdjustmentAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},AddToCartButton:{displayName:"AddToCartButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element]),skuCode:PropTypes.string,disabled:PropTypes.bool,buyNowMode:PropTypes.bool,checkoutUrl:PropTypes.string,lineItem:PropTypes.shape({name:PropTypes.string.isRequired,imageUrl:PropTypes.string})},defaultProps:{label:"Add to cart"}},AddressesContainer:{displayName:"AddressesContainer",permittedChildren:["BillingAddressForm","BillingAddressContainer","ShippingAddressForm","ShippingAddressContainer","SaveAddressesButton","ReactNode"],propTypes:{children:childrenTypes.isRequired,shipToDifferentAddress:PropTypes.bool}},AvailabilityContainer:{displayName:"AvailabilityContainer",permittedChildren:["AvailabilityTemplate","ReactNode"],propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string}},AvailabilityTemplate:{displayName:"AvailabilityTemplate",propTypes:{timeFormat:PropTypes.oneOf(["days","hours"]),showShippingMethodName:PropTypes.bool,children:PropTypes.func},defaultProps:{timeFormat:"days",showShippingMethodName:!1}},BillingAddressContainer:{permittedChildren:["Address","ReactNode"],propTypes:{children:childrenTypes.isRequired}},BillingAddressForm:{permittedChildren:["AddressInput","ReactNode","Errors"],propTypes:{children:childrenTypes.isRequired}},CheckoutLink:{displayName:"CheckoutLink",propTypes:{children:PropTypes.func,label:PropTypes.string},defaultProps:{label:"Checkout"}},CommerceLayer:{permittedChildren:["OrderContainer","OrderStorage","PricesContainer","GiftCardContainer","ReactNode"],propTypes:{children:childrenTypes.isRequired,accessToken:PropTypes.string.isRequired,endpoint:PropTypes.string.isRequired}},CustomerContainer:{displayName:"CustomerContainer",permittedChildren:["CustomerInput","SaveCustomerButton","AddressesContainer","PaymentMethodsContainer","ShipmentsContainer","ReactNode"],propTypes:{children:childrenTypes.isRequired,isGuest:PropTypes.bool}},CustomerInput:{displayName:"CustomerInput",propTypes:{children:PropTypes.func,name:PropTypes.oneOf(["customerEmail"]),type:PropTypes.oneOf(["email"]),placeholder:PropTypes.string,disabled:PropTypes.bool,required:PropTypes.bool,saveOnBlur:PropTypes.bool},defaultProps:{required:!0}},DeliveryLeadTime:{displayName:"DeliveryLeadTime",propTypes:{type:PropTypes.oneOf(["max_days","max_hours","min_days","min_hours"]).isRequired,children:PropTypes.func}},DiscountAmount:{displayName:"DiscountAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},Errors:{displayName:"Errors",propTypes:ErrorPropTypes,defaultProps:{messages:[],field:"base"}},ExternalFunction:{displayName:"ExternalFunction",permittedChildren:["AddToCartButton","ReactNode"],propTypes:{children:childrenTypes.isRequired,url:PropTypes.string.isRequired}},GiftCard:{permittedChildren:["GiftCardCurrencySelector","GiftCardInput","Errors","MetadataInput","SubmitButton","ReactNode"],displayName:"GiftCard",propTypes:{children:childrenTypes.isRequired,onSubmit:PropTypes.func},defaultProps:{onSubmit:void 0}},GiftCardAmount:{displayName:"GiftCardAmount",propTypes:baseOrderComponentPricePropTypes},GiftCardContainer:{permittedChildren:["GiftCard","Errors","ReactNode"],displayName:"GiftCardContainer",propTypes:{children:childrenTypes.isRequired}},GiftCardCurrencySelector:{displayName:"GiftCardCurrencySelector",propTypes:{children:PropTypes.func,placeholder:PropTypes.shape({value:PropTypes.oneOfType([PropTypes.string,PropTypes.number]).isRequired,label:PropTypes.string.isRequired}),value:PropTypes.string,required:PropTypes.bool},defaultProps:{required:!0}},GiftCardInput:{displayName:"GiftCardInput",propTypes:{type:PropTypes.oneOf(["text","email","number","date","checkbox"]).isRequired,name:PropTypes.oneOf(["balanceCents","balanceMaxCents","singleUse","rechargeable","imageUrl","expiresAt","referenceOrigin","email","firstName","lastName","reference"]).isRequired,children:PropTypes.func,placeholder:PropTypes.string}},GiftCardOrCouponForm:{permittedChildren:["GiftCardOrCouponInput","GiftCardOrCouponSubmit","ReactNode"],propTypes:{children:childrenTypes.isRequired}},GiftCardOrCouponInput:{displayName:"GiftCardOrCouponInput",propTypes:{children:PropTypes.func,placeholder:PropTypes.string,disabled:PropTypes.bool,required:PropTypes.bool}},GiftCardOrCouponSubmit:{displayName:"GiftCardOrCouponSubmit",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.object])}},GiftCardOrCouponCode:{displayName:"GiftCardOrCouponCode",propTypes:{children:PropTypes.func,type:PropTypes.oneOf(["coupon","gift_card"])}},GiftCardOrCouponRemoveButton:{displayName:"GiftCardOrCouponRemoveButton",propTypes:{children:PropTypes.func,type:PropTypes.oneOf(["coupon","gift_card"]),label:PropTypes.oneOfType([PropTypes.string,PropTypes.object])}},ItemContainer:{permittedChildren:["PricesContainer","VariantsContainer","SkuOptionContainer","QuantitySelector","AddToCartButton","AvailabilityContainer","SkuListsContainer","ReactNode"],displayName:"ItemContainer",propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string,lineItem:PropTypes.shape({name:PropTypes.string.isRequired,imageUrl:PropTypes.string})}},LineItem:{permittedChildren:["AvailabilityContainer","LineItemImage","LineItemName","LineItemOptions","LineItemQuantity","LineItemAmount","LineItemRemoveLink","StockTransfer","Errors","ReactNode"],displayName:"LineItem",propTypes:{children:childrenTypes.isRequired,type:PropTypes.oneOf(["skus","gift_cards","shipments","payment_methods","promotions","adjustments","bundles"])},defaultProps:{type:"skus"}},LineItemAmount:{displayName:"LineItemAmount",propTypes:Object.assign(Object.assign({},baseOrderComponentPricePropTypes),{type:PropTypes.oneOf(["total","unit","option"])}),defaultProps:{format:"formatted",type:"total"}},LineItemImage:{displayName:"LineItemImage",propTypes:{width:PropTypes.number,children:PropTypes.func}},LineItemName:{displayName:"LineItemName",propTypes:{children:PropTypes.func}},LineItemCode:{displayName:"LineItemCode",propTypes:{children:PropTypes.func}},LineItemOption:{displayName:"LineItemOption",propTypes:{name:PropTypes.string,children:PropTypes.func,valueClassName:PropTypes.string,className:PropTypes.string,id:PropTypes.string,style:PropTypes.object}},LineItemOptions:{permittedChildren:["LineItemOption","ReactNode"],displayName:"LineItemOptions",propTypes:{children:childrenTypes.isRequired,title:PropTypes.string,showName:PropTypes.bool,skuOptionId:PropTypes.string}},LineItemQuantity:{displayName:"LineItemQuantity",propTypes:{children:PropTypes.func,max:PropTypes.number,disabled:PropTypes.bool,readonly:PropTypes.bool},defaultProps:{max:50}},LineItemRemoveLink:{displayName:"LineItemRemoveLink",propTypes:{children:PropTypes.func,label:PropTypes.string},defaultProps:{label:"Remove"}},LineItemsContainer:{permittedChildren:["LineItemsCount","LineItemsEmpty","LineItem","ReactNode"],displayName:"LineItemsContainer",propTypes:{children:childrenTypes.isRequired,filters:PropTypes.object,loader:PTLoader},defaultProps:{filters:{},loader:"Loading..."}},LineItemsCount:{displayName:"LineItemsCount",propTypes:{children:PropTypes.func,id:PropTypes.string,className:PropTypes.string,name:PropTypes.string,style:PropTypes.object}},LineItemsEmpty:{displayName:"LineItemsEmpty",propTypes:{children:PropTypes.func,id:PropTypes.string,className:PropTypes.string,name:PropTypes.string,style:PropTypes.object,text:PropTypes.string}},MetadataInput:{displayName:"MetadataInput",propTypes:BaseInputComponentPropTypes},OrderContainer:{permittedChildren:["AddressesContainer","CustomerContainer","ItemContainer","LineItemsContainer","SubTotalAmount","DiscountAmount","AdjustmentAmount","ShippingAmount","TaxesAmount","GiftCardAmount","TotalAmount","CheckoutLink","GiftCardContainer","ShipmentsContainer","PaymentMethodsContainer","PaymentMethodAmount","GiftCardOrCouponForm","GiftCardOrCouponCode","GiftCardOrCouponRemoveButton","Errors","OrderNumber","ReactNode"],displayName:"OrderContainer",propTypes:{children:childrenTypes.isRequired,orderId:PropTypes.string,metadata:BMObject,attributes:PropTypes.object},defaultProps:{metadata:{}}},OrderNumber:{displayName:"OrderNumber",propTypes:{className:PropTypes.string},defaultProps:{format:"formatted"}},OrderStorage:{permittedChildren:["OrderContainer","ReactNode"],displayName:"OrderStorage",propTypes:{children:childrenTypes.isRequired,clearWhenPlaced:PropTypes.bool,persistKey:PropTypes.string.isRequired}},PaymentMethod:{permittedChildren:["PaymentMethodName","PaymentMethodRadioButton","PaymentMethodPrice","PaymentSource","ReactNode","Errors"],displayName:"PaymentMethod",propTypes:{children:childrenTypes.isRequired}},PaymentMethodAmount:{displayName:"PaymentMethodAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},PaymentMethodName:{displayName:"PaymentMethodName",propTypes:{children:PropTypes.func}},PaymentMethodPrice:{displayName:"PaymentMethodPrice",propTypes:Object.assign(Object.assign({},baseOrderComponentPricePropTypes),{type:PropTypes.oneOf(["amount"])})},PaymentMethodRadioButton:{displayName:"PaymentMethodRadioButton",propTypes:{children:PropTypes.func}},PaymentMethodsContainer:{displayName:"PaymentMethodsContainer",permittedChildren:["PaymentSource","ReactNode","PlaceOrderContainer"],propTypes:{children:childrenTypes.isRequired}},PaymentSource:{displayName:"PaymentSource",permittedChildren:["PaymentSourceBrandIcon","PaymentSourceBrandName","PaymentSourceEditButton","PaymentSourceDetail","ReactNode"],propTypes:{children:childrenTypes,readonly:PropTypes.bool}},PaymentSourceBrandIcon:{displayName:"PaymentSourceBrandIcon",propTypes:{children:PropTypes.func,width:PropTypes.number,height:PropTypes.number,src:PropTypes.string,className:PropTypes.string}},PaymentSourceBrandName:{displayName:"PaymentSourceBrandName",propTypes:{children:PropTypes.func,label:PropTypes.string}},PaymentSourceEditButton:{displayName:"PaymentSourceEditButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element])}},PaymentSourceDetail:{displayName:"PaymentSourceDetail",propTypes:{type:PropTypes.oneOf(["last4","exp_year","exp_month"]).isRequired}},PlaceOrderButton:{displayName:"PlaceOrderButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element])},defaultProps:{label:"Place order"}},PlaceOrderContainer:{displayName:"PlaceOrderContainer",permittedChildren:["PaymentMethod","PlaceOrderButton","PrivacyAndTermsCheckbox","ReactNode"],propTypes:{children:childrenTypes.isRequired}},Price:{displayName:"Price",propTypes:{children:PropTypes.func,compareClassName:PropTypes.string,skuCode:PropTypes.string,showCompare:PropTypes.bool},defaultProps:{skuCode:""}},PricesContainer:{permittedChildren:["Price","ReactNode"],displayName:"PricesContainer",propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string,loader:PTLoader,perPage:PropTypes.number,filters:PropTypes.object},defaultProps:{perPage:10,filters:{},loader:"Loading...",skuCode:""}},PrivacyAndTermsCheckbox:{displayName:"PrivacyAndTermsCheckbox",propTypes:{children:PropTypes.func}},QuantitySelector:{displayName:"QuantitySelector",propTypes:{children:PropTypes.func,min:PropTypes.number,max:PropTypes.number,value:PropTypes.string,skuCode:PropTypes.string,disabled:PropTypes.bool},defaultProps:{min:1}},SaveAddressesButton:{displayName:"SaveAddressesButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element]),onClick:PropTypes.func,disabled:PropTypes.bool},defaultProps:{label:"Continue to delivery"}},Shipment:{permittedChildren:["LineItemsContainer","LineItem","ShippingMethod","ReactNode"],displayName:"Shipment",propTypes:{children:childrenTypes.isRequired}},ShipmentField:{displayName:"ShipmentField",propTypes:{children:PropTypes.func,name:PropTypes.oneOf(["cost_amount_cents","cost_amount_float","currency_code","formatted_cost_amount","number","status","key_number"]).isRequired}},ShipmentsContainer:{displayName:"ShipmentsContainer",permittedChildren:["Shipment","ReactNode","Errors"],propTypes:{children:childrenTypes.isRequired}},ShippingAddressContainer:{permittedChildren:["Address","ReactNode"],propTypes:{children:childrenTypes.isRequired}},SaveCustomerButton:{displayName:"SaveCustomerButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element]),onClick:PropTypes.func},defaultProps:{label:"Save"}},ShippingAddressForm:{permittedChildren:["AddressInput","ReactNode"],propTypes:{children:childrenTypes.isRequired}},ShippingAmount:{displayName:"ShippingAmount",propTypes:baseOrderComponentPricePropTypes},ShippingMethod:{permittedChildren:["ShippingMethodName","ShippingMethodPrice","ShippingMethodRadioButton","DeliveryLeadTime","ReactNode"],displayName:"ShippingMethod",propTypes:{children:childrenTypes.isRequired,readonly:PropTypes.bool}},ShippingMethodName:{displayName:"ShippingMethodName",propTypes:{children:PropTypes.func}},ShippingMethodRadioButton:{displayName:"ShippingMethodRadioButton",propTypes:{children:PropTypes.func}},ShippingMethodPrice:{displayName:"ShippingMethodPrice",propTypes:Object.assign(Object.assign({},baseOrderComponentPricePropTypes),{type:PropTypes.oneOf(["amount"])}),defaultProps:{format:"formatted",type:"amount"}},SkusContainer:{displayName:"SkuContainer",permittedChildren:["Skus","ReactNode"],propTypes:{children:childrenTypes.isRequired}},Skus:{displayName:"Skus",permittedChildren:["SkuField","ItemContainer","PricesContainer","AddToCartButton","AvailabilityContainer","QuantitySelector","ReactNode"],propTypes:{children:childrenTypes.isRequired}},SkuField:{displayName:"SkuField",propTypes:{children:PropTypes.func,attribute:PropTypes.string,tagElement:PropTypes.string}},SkuList:{permittedChildren:["AddToCartButton","QuantitySelector","ReactNode"],displayName:"SkuList",propTypes:{children:childrenTypes.isRequired,id:PropTypes.string.isRequired}},SkuListsContainer:{permittedChildren:["SkuList","ReactNode"],displayName:"SkuListsContainer",propTypes:{children:childrenTypes.isRequired}},SkuOption:{permittedChildren:["SkuOptionInput","ReactNode"],displayName:"SkuOption",propTypes:{children:childrenTypes.isRequired,id:PropTypes.string.isRequired}},SkuOptionInput:{displayName:"SkuOptionInput",propTypes:BaseInputComponentPropTypes},SkuOptionsContainer:{permittedChildren:["SkuOption","ReactNode"],displayName:"SkuOptionsContainer",propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string}},StockTransfer:{permittedChildren:["StockTransferField","ReactNode"],displayName:"StockTransfer",propTypes:{children:childrenTypes.isRequired}},StockTransferField:{displayName:"StockTransferField",propTypes:{children:PropTypes.func}},SubmitButton:{displayName:"SubmitButton",propTypes:{children:PropTypes.func,label:PropTypes.oneOfType([PropTypes.string,PropTypes.element])},defaultProps:{label:"Submit"}},SubTotalAmount:{displayName:"SubTotalAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},TaxesAmount:{displayName:"TaxesAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},TotalAmount:{displayName:"TotalAmount",propTypes:baseOrderComponentPricePropTypes,defaultProps:{format:"formatted"}},VariantsContainer:{permittedChildren:["VariantSelector","ReactNode"],displayName:"VariantsContainer",propTypes:{children:childrenTypes.isRequired,skuCode:PropTypes.string,filters:PropTypes.object},defaultProps:{skuCode:"",filters:{}}},VariantSelector:{displayName:"VariantSelector",propTypes:{options:PropTypes.arrayOf(PropTypes.shape({label:PropTypes.string.isRequired,code:PropTypes.string.isRequired,lineItem:PropTypes.shape({name:PropTypes.string.isRequired,imageUrl:PropTypes.string})}).isRequired).isRequired,name:PropTypes.string,children:PropTypes.func,type:PropTypes.oneOf(["select","radio"]),loader:PropTypes.element,placeholder:PropTypes.string,skuCode:PropTypes.string},defaultProps:{placeholder:"Select a variant",type:"select"}}};export default components;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Dispatch}from'react';import{SetLocalOrder,DeleteLocalOrder}from'../utils/localStorage';import{CommerceLayerConfig}from'../context/CommerceLayerContext';import{ItemOption,CustomLineItem}from'./ItemReducer';import{BaseMetadataObject}from'../typings/index';import{BaseError}from'../typings/errors';import{AddressResource}from'./AddressReducer';import{Order,OrderUpdate}from'@commercelayer/sdk';export declare type GetOrderParams=Partial<{clearWhenPlaced:boolean;config:CommerceLayerConfig;deleteLocalOrder:DeleteLocalOrder;dispatch:Dispatch<OrderActions>;id:string;persistKey:string;state:OrderState;}>;export interface GetOrder{(params:GetOrderParams):Promise<void|Order>;}declare type CreateOrderParams=Pick<AddToCartParams,'config'|'dispatch'|'persistKey'|'state'|'orderMetadata'|'orderAttributes'|'setLocalOrder'>;export interface CreateOrder{(params?:CreateOrderParams):Promise<string>;}export declare type AddToCartParams=Partial<{bundleCode:string;skuCode:string;persistKey:string;config:CommerceLayerConfig;dispatch:Dispatch<OrderActions>;state:Partial<OrderState>;skuId:string;quantity:number;option:ItemOption;lineItem:CustomLineItem;orderMetadata:BaseMetadataObject;orderAttributes:Record<string,any>;errors:BaseError[];setLocalOrder:SetLocalOrder;buyNowMode:boolean;checkoutUrl:string;}>;export interface AddToCartImportParams extends Omit<AddToCartParams,'skuCode'|'skuId'|'quantity'|'option'|'lineItem'>{lineItems:CustomLineItem[];}export declare type AddToCartReturn=Promise<{success:boolean;}>;export interface AddToCart{(params:AddToCartParams):AddToCartReturn;}export interface AddToCartImport{(params:AddToCartImportParams):AddToCartReturn;}export interface UnsetOrderState{(dispatch:Dispatch<OrderActions>):void;}export declare type ResourceIncluded='billing_address'|'shipping_address'|'line_items.line_item_options.sku_option'|'line_items.item'|'available_customer_payment_sources.payment_source'|'shipments.available_shipping_methods'|'shipments.stock_transfers'|'shipments.shipment_line_items.line_item'|'shipments.shipping_method'|'shipments.stock_location'|'payment_source'|'available_payment_methods'|'payment_method';declare type ResourceIncludedLoaded=Partial<Record<ResourceIncluded,boolean>>;export interface OrderPayload{loading?:boolean;orderId?:string;order?:Order;errors?:BaseError[];include?:ResourceIncluded[];includeLoaded?:ResourceIncludedLoaded;}export declare type AddToCartValues=Pick<AddToCartParams,'bundleCode'|'lineItem'|'quantity'|'skuCode'|'skuId'|'option'|'buyNowMode'|'checkoutUrl'>;export declare type AddToCartImportValues=Pick<AddToCartImportParams,'lineItems'>;export declare type getOrderContext=(id:string)=>Promise<void|Order>;export declare type OrderState=Partial<OrderPayload>;export interface OrderActions{type:OrderActionType;payload:OrderPayload;}export declare type OrderActionType='setLoading'|'setOrderId'|'setOrder'|'setSingleQuantity'|'setCurrentSkuCodes'|'setCurrentSkuPrices'|'setCurrentItem'|'setErrors'|'setSaveAddressToCustomerAddressBook'|'setGiftCardOrCouponCode'|'setIncludesResource';export declare const createOrder:CreateOrder;export declare const getApiOrder:GetOrder;export declare type UpdateOrderArgs={id:string;attributes:Omit<OrderUpdate,'id'>;dispatch?:Dispatch<OrderActions>;include?:string[];config?:CommerceLayerConfig;state?:OrderState;};export declare function updateOrder({id,attributes,dispatch,config,include,state,}:UpdateOrderArgs):Promise<{success:boolean;error?:undefined;}|{success:boolean;error:unknown;}>;export declare const setOrder:(order:Order,dispatch?:Dispatch<OrderActions>|undefined)=>void;export declare type AddResourceToInclude={resourcesIncluded?:ResourceIncluded[];dispatch?:Dispatch<OrderActions>;newResource?:ResourceIncluded|ResourceIncluded[];resourceIncludedLoaded?:ResourceIncludedLoaded;newResourceLoaded?:ResourceIncludedLoaded;};export declare function addResourceToInclude({resourcesIncluded,dispatch,newResource,newResourceLoaded,resourceIncludedLoaded,}:AddResourceToInclude):void;export declare const addToCart:AddToCart;export declare const unsetOrderState:UnsetOrderState;declare type OrderErrors={dispatch?:Dispatch<OrderActions>;errors:BaseError[];};export declare function setOrderErrors({dispatch,errors}:OrderErrors):{success:boolean;};export declare type SaveAddressToCustomerAddressBook=(params:{dispatch?:Dispatch<OrderActions>;type:AddressResource;value:boolean;})=>void;export declare const saveAddressToCustomerAddressBook:SaveAddressToCustomerAddressBook;export declare type SetGiftCardOrCouponCode=(args:{code:string;codeType:OrderCodeType;dispatch?:Dispatch<OrderActions>;config?:CommerceLayerConfig;order?:Order;include?:string[];state?:OrderState;})=>Promise<{success:boolean;}>;export declare const setGiftCardOrCouponCode:SetGiftCardOrCouponCode;export declare type CodeType='coupon'|'gift_card'|'gift_card_or_coupon';export declare type OrderCodeType=`${CodeType}_code`;
|
|
1
|
+
import{Dispatch}from'react';import{SetLocalOrder,DeleteLocalOrder}from'../utils/localStorage';import{CommerceLayerConfig}from'../context/CommerceLayerContext';import{ItemOption,CustomLineItem}from'./ItemReducer';import{BaseMetadataObject}from'../typings/index';import{BaseError}from'../typings/errors';import{AddressResource}from'./AddressReducer';import{Order,OrderUpdate}from'@commercelayer/sdk';export declare type GetOrderParams=Partial<{clearWhenPlaced:boolean;config:CommerceLayerConfig;deleteLocalOrder:DeleteLocalOrder;dispatch:Dispatch<OrderActions>;id:string;persistKey:string;state:OrderState;}>;export interface GetOrder{(params:GetOrderParams):Promise<void|Order>;}declare type CreateOrderParams=Pick<AddToCartParams,'config'|'dispatch'|'persistKey'|'state'|'orderMetadata'|'orderAttributes'|'setLocalOrder'>;export interface CreateOrder{(params?:CreateOrderParams):Promise<string>;}export declare type AddToCartParams=Partial<{bundleCode:string;skuCode:string;persistKey:string;config:CommerceLayerConfig;dispatch:Dispatch<OrderActions>;state:Partial<OrderState>;skuId:string;quantity:number;option:ItemOption;lineItem:CustomLineItem;orderMetadata:BaseMetadataObject;orderAttributes:Record<string,any>;errors:BaseError[];setLocalOrder:SetLocalOrder;buyNowMode:boolean;checkoutUrl:string;}>;export interface AddToCartImportParams extends Omit<AddToCartParams,'skuCode'|'skuId'|'quantity'|'option'|'lineItem'>{lineItems:CustomLineItem[];}export declare type AddToCartReturn=Promise<{success:boolean;}>;export interface AddToCart{(params:AddToCartParams):AddToCartReturn;}export interface AddToCartImport{(params:AddToCartImportParams):AddToCartReturn;}export interface UnsetOrderState{(dispatch:Dispatch<OrderActions>):void;}export declare type ResourceIncluded='billing_address'|'shipping_address'|'line_items.line_item_options.sku_option'|'line_items.item'|'available_customer_payment_sources.payment_source'|'shipments.available_shipping_methods'|'shipments.stock_transfers'|'shipments.stock_transfers.line_item'|'shipments.shipment_line_items.line_item'|'shipments.shipping_method'|'shipments.stock_location'|'payment_source'|'available_payment_methods'|'payment_method';declare type ResourceIncludedLoaded=Partial<Record<ResourceIncluded,boolean>>;export interface OrderPayload{loading?:boolean;orderId?:string;order?:Order;errors?:BaseError[];include?:ResourceIncluded[];includeLoaded?:ResourceIncludedLoaded;}export declare type AddToCartValues=Pick<AddToCartParams,'bundleCode'|'lineItem'|'quantity'|'skuCode'|'skuId'|'option'|'buyNowMode'|'checkoutUrl'>;export declare type AddToCartImportValues=Pick<AddToCartImportParams,'lineItems'>;export declare type getOrderContext=(id:string)=>Promise<void|Order>;export declare type OrderState=Partial<OrderPayload>;export interface OrderActions{type:OrderActionType;payload:OrderPayload;}export declare type OrderActionType='setLoading'|'setOrderId'|'setOrder'|'setSingleQuantity'|'setCurrentSkuCodes'|'setCurrentSkuPrices'|'setCurrentItem'|'setErrors'|'setSaveAddressToCustomerAddressBook'|'setGiftCardOrCouponCode'|'setIncludesResource';export declare const createOrder:CreateOrder;export declare const getApiOrder:GetOrder;export declare type UpdateOrderArgs={id:string;attributes:Omit<OrderUpdate,'id'>;dispatch?:Dispatch<OrderActions>;include?:string[];config?:CommerceLayerConfig;state?:OrderState;};export declare function updateOrder({id,attributes,dispatch,config,include,state,}:UpdateOrderArgs):Promise<{success:boolean;error?:undefined;}|{success:boolean;error:unknown;}>;export declare const setOrder:(order:Order,dispatch?:Dispatch<OrderActions>|undefined)=>void;export declare type AddResourceToInclude={resourcesIncluded?:ResourceIncluded[];dispatch?:Dispatch<OrderActions>;newResource?:ResourceIncluded|ResourceIncluded[];resourceIncludedLoaded?:ResourceIncludedLoaded;newResourceLoaded?:ResourceIncludedLoaded;};export declare function addResourceToInclude({resourcesIncluded,dispatch,newResource,newResourceLoaded,resourceIncludedLoaded,}:AddResourceToInclude):void;export declare const addToCart:AddToCart;export declare const unsetOrderState:UnsetOrderState;declare type OrderErrors={dispatch?:Dispatch<OrderActions>;errors:BaseError[];};export declare function setOrderErrors({dispatch,errors}:OrderErrors):{success:boolean;};export declare type SaveAddressToCustomerAddressBook=(params:{dispatch?:Dispatch<OrderActions>;type:AddressResource;value:boolean;})=>void;export declare const saveAddressToCustomerAddressBook:SaveAddressToCustomerAddressBook;export declare type SetGiftCardOrCouponCode=(args:{code:string;codeType:OrderCodeType;dispatch?:Dispatch<OrderActions>;config?:CommerceLayerConfig;order?:Order;include?:string[];state?:OrderState;})=>Promise<{success:boolean;}>;export declare const setGiftCardOrCouponCode:SetGiftCardOrCouponCode;export declare type CodeType='coupon'|'gift_card'|'gift_card_or_coupon';export declare type OrderCodeType=`${CodeType}_code`;
|
|
2
2
|
export declare type RemoveGiftCardOrCouponCode = (args: {
|
|
3
3
|
codeType: OrderCodeType;
|
|
4
4
|
dispatch?: Dispatch<OrderActions>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{setCustomerOrderParam}from"../utils/localStorage";import baseReducer from"../utils/baseReducer";import{isEmpty,size,map}from"lodash";import getSdk from"../utils/getSdk";import getErrors,{setErrors}from"../utils/getErrors";import getOrganizationSlug from"../utils/organization";const actionType=["setLoading","setOrderId","setOrder","setSingleQuantity","setCurrentSkuCodes","setCurrentSkuPrices","setErrors","setCurrentItem","setSaveAddressToCustomerAddressBook","setIncludesResource"];export const createOrder=async params=>{if(params){const{persistKey,state,dispatch,config,orderMetadata:metadata,orderAttributes={},setLocalOrder}=params;if(state==null?void 0:state.orderId)return state.orderId;const sdk=getSdk(config);try{const o=await(sdk==null?void 0:sdk.orders.create(Object.assign({metadata},orderAttributes)));return dispatch&&dispatch({type:"setOrderId",payload:{orderId:o==null?void 0:o.id}}),persistKey&&setLocalOrder&&setLocalOrder(persistKey,o.id),o.id}catch(error){const errors=getErrors(error,"orders");console.error("Create order",errors),dispatch&&setErrors({currentErrors:state==null?void 0:state.errors,newErrors:errors,dispatch})}}return""},getApiOrder=async params=>{const{id,dispatch,config,clearWhenPlaced,persistKey,deleteLocalOrder,state}=params,sdk=getSdk(config);try{const options={};(state==null?void 0:state.include)&&state.include.length>0&&(options.include=state.include);const order=await sdk.orders.retrieve(id,options);return clearWhenPlaced&&order.status==="placed"||order.status==="approved"||order.status==="cancelled"?(persistKey&&deleteLocalOrder&&deleteLocalOrder(persistKey),dispatch&&dispatch({type:"setOrder",payload:{order:void 0,orderId:""}})):dispatch&&dispatch({type:"setOrder",payload:{order,orderId:order.id}}),order}catch(error){const errors=getErrors(error,"orders");console.error("Retrieve order",errors),dispatch&&setErrors({currentErrors:state==null?void 0:state.errors,newErrors:errors,dispatch});return}};export async function updateOrder({id,attributes,dispatch,config,include,state}){const sdk=getSdk(config);try{const resource=Object.assign(Object.assign({},attributes),{id});await sdk.orders.update(resource,{include});const order=await getApiOrder({id,config,dispatch,state});return dispatch&&order&&dispatch({type:"setOrder",payload:{order}}),{success:!0}}catch(error){const errors=getErrors(error,"orders");return dispatch&&(setOrderErrors({errors,dispatch}),dispatch({type:"setErrors",payload:{errors}})),{success:!1,error}}}export const setOrder=(order,dispatch)=>{dispatch&&dispatch({type:"setOrder",payload:{order}})};export function addResourceToInclude({resourcesIncluded=[],dispatch,newResource,newResourceLoaded,resourceIncludedLoaded}){const payload={include:void 0,includeLoaded:void 0};newResource
|
|
1
|
+
import{setCustomerOrderParam}from"../utils/localStorage";import baseReducer from"../utils/baseReducer";import{isEmpty,size,map}from"lodash";import getSdk from"../utils/getSdk";import getErrors,{setErrors}from"../utils/getErrors";import getOrganizationSlug from"../utils/organization";const actionType=["setLoading","setOrderId","setOrder","setSingleQuantity","setCurrentSkuCodes","setCurrentSkuPrices","setErrors","setCurrentItem","setSaveAddressToCustomerAddressBook","setIncludesResource"];export const createOrder=async params=>{if(params){const{persistKey,state,dispatch,config,orderMetadata:metadata,orderAttributes={},setLocalOrder}=params;if(state==null?void 0:state.orderId)return state.orderId;const sdk=getSdk(config);try{const o=await(sdk==null?void 0:sdk.orders.create(Object.assign({metadata},orderAttributes)));return dispatch&&dispatch({type:"setOrderId",payload:{orderId:o==null?void 0:o.id}}),persistKey&&setLocalOrder&&setLocalOrder(persistKey,o.id),o.id}catch(error){const errors=getErrors(error,"orders");console.error("Create order",errors),dispatch&&setErrors({currentErrors:state==null?void 0:state.errors,newErrors:errors,dispatch})}}return""},getApiOrder=async params=>{const{id,dispatch,config,clearWhenPlaced,persistKey,deleteLocalOrder,state}=params,sdk=getSdk(config);try{const options={};(state==null?void 0:state.include)&&state.include.length>0&&(options.include=state.include);const order=await sdk.orders.retrieve(id,options);return clearWhenPlaced&&order.status==="placed"||order.status==="approved"||order.status==="cancelled"?(persistKey&&deleteLocalOrder&&deleteLocalOrder(persistKey),dispatch&&dispatch({type:"setOrder",payload:{order:void 0,orderId:""}})):dispatch&&dispatch({type:"setOrder",payload:{order,orderId:order.id}}),order}catch(error){const errors=getErrors(error,"orders");console.error("Retrieve order",errors),dispatch&&setErrors({currentErrors:state==null?void 0:state.errors,newErrors:errors,dispatch});return}};export async function updateOrder({id,attributes,dispatch,config,include,state}){const sdk=getSdk(config);try{const resource=Object.assign(Object.assign({},attributes),{id});await sdk.orders.update(resource,{include});const order=await getApiOrder({id,config,dispatch,state});return dispatch&&order&&dispatch({type:"setOrder",payload:{order}}),{success:!0}}catch(error){const errors=getErrors(error,"orders");return dispatch&&(setOrderErrors({errors,dispatch}),dispatch({type:"setErrors",payload:{errors}})),{success:!1,error}}}export const setOrder=(order,dispatch)=>{dispatch&&dispatch({type:"setOrder",payload:{order}})};export function addResourceToInclude({resourcesIncluded=[],dispatch,newResource,newResourceLoaded,resourceIncludedLoaded}){const payload={include:void 0,includeLoaded:void 0};if(newResource){const resources=typeof newResource=="string"?[newResource]:newResource;payload.include=[...resourcesIncluded,...resources],resources.forEach(resource=>{payload.includeLoaded=Object.assign(Object.assign({},payload.includeLoaded),{[resource]:!0})})}else delete payload.include;payload.includeLoaded=Object.assign(Object.assign(Object.assign({},resourceIncludedLoaded),newResourceLoaded),payload.includeLoaded&&payload.includeLoaded),dispatch&&dispatch({type:"setIncludesResource",payload})}export const addToCart=async params=>{const{skuCode,bundleCode,skuId,quantity,option,config,dispatch,lineItem,state,errors=[],buyNowMode,checkoutUrl}=params;try{if(!config)throw{errors:[{code:"INVALID_RESOURCE",resource:"orders",title:"Markup error",message:"You are trying to place an order outside the OrderContainer component"}]};const sdk=getSdk(config),id=await createOrder(params);if(id){const order=sdk.orders.relationship(id),name=lineItem==null?void 0:lineItem.name,imageUrl=lineItem==null?void 0:lineItem.imageUrl,attrs={order,sku_code:skuCode,name,image_url:imageUrl,quantity:quantity||1,_update_quantity:!0,bundle_code:bundleCode};skuId&&(attrs.item=sdk.skus.relationship(skuId));const newLineItem=await sdk.line_items.create(attrs);if(isEmpty(option))await getApiOrder(Object.assign(Object.assign({id},params),{state}));else{let c=0;map(option,async opt=>{const{options,skuOptionId}=opt,skuOption=sdk.sku_options.relationship(skuOptionId),lineItemRel=sdk.line_items.relationship(newLineItem.id),lineItemOptionsAttributes={quantity:1,options,sku_option:skuOption,line_item:lineItemRel};await sdk.line_item_options.create(lineItemOptionsAttributes),c+=1,c===size(option)&&await getApiOrder(Object.assign({id},params))})}if(!isEmpty(errors)&&dispatch&&dispatch({type:"setErrors",payload:{errors:[]}}),buyNowMode){const{organization}=getOrganizationSlug(config.endpoint),params2=`${id}?accessToken=${config.accessToken}`,redirectUrl=checkoutUrl?`${checkoutUrl}/${params2}`:`https://${organization}.checkout.commercelayer.app/${params2}`;location.href=redirectUrl}return{success:!0}}return{success:!1}}catch(error){const errors2=getErrors(error,"orders");return console.error("Add to cart",errors2),dispatch&&setErrors({currentErrors:state==null?void 0:state.errors,newErrors:errors2,dispatch}),{success:!1}}},unsetOrderState=dispatch=>{dispatch({type:"setOrderId",payload:{orderId:""}}),dispatch({type:"setOrder",payload:{order:void 0}})};export function setOrderErrors({dispatch,errors=[]}){return dispatch&&dispatch({type:"setErrors",payload:{errors}}),{success:!1}}export const saveAddressToCustomerAddressBook=({type,value,dispatch})=>{const k=`_save_${type}_to_customer_address_book`,v=`${value}`;setCustomerOrderParam(k,v),dispatch&&dispatch({type:"setSaveAddressToCustomerAddressBook",payload:{[k]:v}})},setGiftCardOrCouponCode=async({code,codeType,dispatch,config,order,include,state})=>{try{if(config&&order&&code&&dispatch){const attributes={[codeType]:code},{success,error}=await updateOrder({id:order.id,attributes,config,include,dispatch,state});if(!success)throw error;return dispatch({type:"setErrors",payload:{errors:[]}}),{success}}return{success:!1}}catch(error){const errors=getErrors(error,"orders",codeType);return dispatch&&setOrderErrors({errors,dispatch}),{success:!1}}},removeGiftCardOrCouponCode=async({codeType,dispatch,config,order,include,state})=>{try{if(config&&order&&dispatch){const attributes={[codeType]:""};return await updateOrder({id:order.id,attributes,config,include,dispatch,state}),dispatch({type:"setErrors",payload:{errors:[]}}),{success:!0}}return{success:!1}}catch(error){const errors=getErrors(error,"orders",codeType);return console.error("Remove gift card o coupon code",errors),dispatch&&setOrderErrors({errors,dispatch}),{success:!1}}},orderInitialState={loading:!1,orderId:"",order:void 0,errors:[],include:[]};const orderReducer=(state,reducer)=>baseReducer(state,reducer,actionType);export default orderReducer;
|
package/lib/typings/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Dispatch,ReactNode,RefObject}from'react';import PropTypes,{InferProps}from'prop-types';import{BaseError}from'./errors';export declare const BC:{id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;name:PropTypes.Requireable<string>;};export declare const PTLoader:PropTypes.Requireable<string|PropTypes.ReactElementLike>;export declare const BaseSelectComponentPropTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;options:PropTypes.Validator<PropTypes.InferProps<{label:PropTypes.Validator<string>;value:PropTypes.Validator<string|number>;selected:PropTypes.Requireable<boolean>;}>[]>;placeholder:PropTypes.Requireable<PropTypes.InferProps<{label:PropTypes.Validator<string>;value:PropTypes.Validator<string|number>;}>>;value:PropTypes.Requireable<string>;name:PropTypes.Validator<string>;};export declare type SelectPlaceholder=Option;declare type BaseSelectChildrenComponentProps=Omit<BaseSelectComponentProps,'children'>;declare type Option={label:string;value:string|number;disabled?:boolean;};export interface BaseSelectComponentProps{children?:(props:BaseSelectChildrenComponentProps)=>ReactNode;options:Option[];placeholder?:Option;value?:string;className?:string;required?:boolean;name:string;onChange?:(event:React.ChangeEvent<HTMLSelectElement>)=>void;}export declare const BaseInputComponentPropTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;name:PropTypes.Validator<string>;type:PropTypes.Validator<BaseInputType>;onChange:PropTypes.Requireable<(...args:any[])=>any>;placeholder:PropTypes.Requireable<string>;};declare type BaseInputChildrenComponentProps=Omit<BaseInputComponentProps,'children'>&{handleChange:(event:React.ChangeEvent<HTMLInputElement|HTMLTextAreaElement>)=>void;};export interface BaseInputComponentProps{ref?:()=>RefObject<any>;children?:(props:BaseInputChildrenComponentProps)=>ReactNode;name:string;onChange?:(event:React.ChangeEvent<HTMLInputElement|HTMLTextAreaElement>)=>void;placeholder?:string;}export declare type LineItemType='gift_cards'|'payment_methods'|'promotions'|'shipments'|'skus'|'bundles'|'adjustments';export declare type GiftCardInputName='balanceCents'|'balanceMaxCents'|'singleUse'|'rechargeable'|'imageUrl'|'expiresAt'|'referenceOrigin'|'email'|'firstName'|'lastName'|'reference';export declare type AddressInputName='billing_address_city'|'billing_address_company'|'billing_address_first_name'|'billing_address_email'|'billing_address_last_name'|'billing_address_line_1'|'billing_address_line_2'|'billing_address_phone'|'billing_address_state_code'|'billing_address_zip_code'|'billing_address_billing_info'|'billing_address_save_to_customer_book'|'shipping_address_city'|'shipping_address_company'|'shipping_address_email'|'shipping_address_first_name'|'shipping_address_last_name'|'shipping_address_line_1'|'shipping_address_line_2'|'shipping_address_phone'|'shipping_address_state_code'|'shipping_address_zip_code'|'shipping_address_save_to_customer_book';export declare type AddressCountrySelectName='billing_address_country_code'|'shipping_address_country_code';export declare type AddressStateSelectName='billing_address_state_code'|'shipping_address_state_code';export declare type BaseInputType='checkbox'|'date'|'email'|'number'|'tel'|'text'|'textarea';export declare type LoaderType=string|ReactNode;export declare const BMObject:PropTypes.Requireable<{[x:string]:string|null|undefined;}>;export declare type BaseMetadataObject={[key:string]:string|undefined|null;};export declare type TimeFormat='days'|'hours';export declare type BaseComponent=InferProps<typeof BC>;export interface BaseAction<A=string,P=Record<string,any>>{type:A;payload:P;}export interface BaseState{[key:string]:any;errors?:BaseError[];}export declare type BaseActionType<T=string>=T[];export interface BFSetStateContainer<T>{<P extends T>(param:P):void;}export interface BaseReducer{<S extends BaseState,A extends BaseAction,T extends BaseActionType>(state:S,action:A,type:T):S;}export interface BaseUnsetState<A>{(dispatch:Dispatch<A>):void;}export interface BaseMetadata{[key:string]:string|undefined|null;}export declare type BaseFormatPrice='formatted'|'cents'|'float';export declare const baseOrderPricePropTypes:{id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;name:PropTypes.Requireable<string>;base:PropTypes.Validator<string>;type:PropTypes.Validator<string>;children:PropTypes.Requireable<(...args:any[])=>any>;format:PropTypes.Requireable<BaseFormatPrice>;};export declare const baseOrderComponentPricePropTypes:{id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;name:PropTypes.Requireable<string>;children:PropTypes.Requireable<(...args:any[])=>any>;format:PropTypes.Requireable<BaseFormatPrice>;};export declare type BasePriceType='total'|'option'|'unit';export declare type BaseSelectorType='select'|'radio';export declare type BaseAmountComponentChildren=Omit<BaseAmountComponent,'children'>;export declare type BaseAmountComponent={children?:(props:BaseAmountComponentChildren)=>ReactNode;format?:BaseFormatPrice;price?:string;priceCents?:number;labelFree?:string;}&JSX.IntrinsicElements['span'];export interface FunctionChildren<P=Record<string,any>>{(props:P):ReactNode;}export{};
|
|
1
|
+
import{Dispatch,ReactNode,RefObject}from'react';import PropTypes,{InferProps}from'prop-types';import{BaseError}from'./errors';export declare const BC:{id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;name:PropTypes.Requireable<string>;};export declare const PTLoader:PropTypes.Requireable<string|PropTypes.ReactElementLike>;export declare const BaseSelectComponentPropTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;options:PropTypes.Validator<PropTypes.InferProps<{label:PropTypes.Validator<string>;value:PropTypes.Validator<string|number>;selected:PropTypes.Requireable<boolean>;}>[]>;placeholder:PropTypes.Requireable<PropTypes.InferProps<{label:PropTypes.Validator<string>;value:PropTypes.Validator<string|number>;}>>;value:PropTypes.Requireable<string>;name:PropTypes.Validator<string>;};export declare type SelectPlaceholder=Option;declare type BaseSelectChildrenComponentProps=Omit<BaseSelectComponentProps,'children'>;declare type Option={label:string;value:string|number;disabled?:boolean;};export interface BaseSelectComponentProps{children?:(props:BaseSelectChildrenComponentProps)=>ReactNode;options:Option[];placeholder?:Option;value?:string;className?:string;required?:boolean;name:string;onChange?:(event:React.ChangeEvent<HTMLSelectElement>)=>void;}export declare const BaseInputComponentPropTypes:{children:PropTypes.Requireable<(...args:any[])=>any>;name:PropTypes.Validator<string>;type:PropTypes.Validator<BaseInputType>;onChange:PropTypes.Requireable<(...args:any[])=>any>;placeholder:PropTypes.Requireable<string>;};declare type BaseInputChildrenComponentProps=Omit<BaseInputComponentProps,'children'>&{handleChange:(event:React.ChangeEvent<HTMLInputElement|HTMLTextAreaElement>)=>void;};export interface BaseInputComponentProps{ref?:()=>RefObject<any>;children?:(props:BaseInputChildrenComponentProps)=>ReactNode;name:string;onChange?:(event:React.ChangeEvent<HTMLInputElement|HTMLTextAreaElement>)=>void;placeholder?:string;}export declare type LineItemType='gift_cards'|'payment_methods'|'promotions'|'shipments'|'skus'|'bundles'|'adjustments';export declare type GiftCardInputName='balanceCents'|'balanceMaxCents'|'singleUse'|'rechargeable'|'imageUrl'|'expiresAt'|'referenceOrigin'|'email'|'firstName'|'lastName'|'reference';export declare type AddressInputName='billing_address_city'|'billing_address_company'|'billing_address_first_name'|'billing_address_email'|'billing_address_last_name'|'billing_address_line_1'|'billing_address_line_2'|'billing_address_phone'|'billing_address_state_code'|'billing_address_zip_code'|'billing_address_billing_info'|'billing_address_save_to_customer_book'|'shipping_address_city'|'shipping_address_company'|'shipping_address_email'|'shipping_address_first_name'|'shipping_address_last_name'|'shipping_address_line_1'|'shipping_address_line_2'|'shipping_address_phone'|'shipping_address_state_code'|'shipping_address_zip_code'|'shipping_address_save_to_customer_book';export declare type AddressCountrySelectName='billing_address_country_code'|'shipping_address_country_code';export declare type AddressStateSelectName='billing_address_state_code'|'shipping_address_state_code';export declare type BaseInputType='checkbox'|'date'|'email'|'number'|'tel'|'text'|'textarea';export declare type LoaderType=string|ReactNode;export declare const BMObject:PropTypes.Requireable<{[x:string]:string|null|undefined;}>;export declare type BaseMetadataObject={[key:string]:string|undefined|null;};export declare type TimeFormat='days'|'hours';export declare type BaseComponent=InferProps<typeof BC>;export interface BaseAction<A=string,P=Record<string,any>>{type:A;payload:P;}export interface BaseState{[key:string]:any;errors?:BaseError[];}export declare type BaseActionType<T=string>=T[];export interface BFSetStateContainer<T>{<P extends T>(param:P):void;}export interface BaseReducer{<S extends BaseState,A extends BaseAction,T extends BaseActionType>(state:S,action:A,type:T):S;}export interface BaseUnsetState<A>{(dispatch:Dispatch<A>):void;}export interface BaseMetadata{[key:string]:string|undefined|null;}export declare type BaseFormatPrice='formatted'|'cents'|'float';export declare const baseOrderPricePropTypes:{id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;name:PropTypes.Requireable<string>;base:PropTypes.Validator<string>;type:PropTypes.Validator<string>;children:PropTypes.Requireable<(...args:any[])=>any>;format:PropTypes.Requireable<BaseFormatPrice>;};export declare const baseOrderComponentPricePropTypes:{id:PropTypes.Requireable<string>;className:PropTypes.Requireable<string>;style:PropTypes.Requireable<object>;name:PropTypes.Requireable<string>;children:PropTypes.Requireable<(...args:any[])=>any>;format:PropTypes.Requireable<BaseFormatPrice>;};export declare type BasePriceType='total'|'option'|'unit';export declare type BaseSelectorType='select'|'radio';export declare type BaseAmountComponentChildren=Omit<BaseAmountComponent,'children'>;export declare type BaseAmountComponent={children?:(props:BaseAmountComponentChildren)=>ReactNode;format?:BaseFormatPrice;price?:string;priceCents?:number;labelFree?:string;}&JSX.IntrinsicElements['span'];export interface FunctionChildren<P=Record<string,any>>{(props:P):ReactNode;}export declare type ExcludeTag<T extends keyof JSX.IntrinsicElements>=Exclude<keyof JSX.IntrinsicElements,T>;export declare type ExtractTag<T extends keyof JSX.IntrinsicElements>=Extract<keyof JSX.IntrinsicElements,T>;export declare type ConditionalElement<E>=({attribute:Extract<keyof E,'image_url'>;tagElement:ExtractTag<'img'>;}&JSX.IntrinsicElements['img'])|({attribute:Exclude<keyof E,'image_url'>;tagElement:ExcludeTag<'img'>;}&JSX.IntrinsicElements[ExcludeTag<'img'>]);export{};
|