@commercelayer/react-components 3.10.0 → 3.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{FunctionComponent,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 AddToCartButtonProps={children?:AddToCartButtonChildrenProps;label?:string|ReactNode;skuCode?:string;bundleCode?:string;disabled?:boolean;skuListId?:string;lineItem?:VariantOption['lineItem'];}&PropsWithoutRef<JSX.IntrinsicElements['button']>;declare const AddToCartButton:FunctionComponent<AddToCartButtonProps>;export default AddToCartButton;
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{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import Parent from"./utils/Parent";import OrderContext from"../context/OrderContext";import{isEmpty,has}from"lodash";import ItemContext from"../context/ItemContext";import getCurrentItemKey from"../utils/getCurrentItemKey";import components from"../config/components";import SkuListsContext from"../context/SkuListsContext";import ExternalFunctionContext from"../context/ExternalFunctionContext";import isFunction from"lodash/isFunction";const propTypes=components.AddToCartButton.propTypes,defaultProps=components.AddToCartButton.defaultProps,displayName=components.AddToCartButton.displayName,AddToCartButton=props=>{var _a,_b,_c;const{label="Add to cart",children,skuCode,bundleCode,disabled,skuListId,lineItem}=props,p=__rest(props,["label","children","skuCode","bundleCode","disabled","skuListId","lineItem"]),{addToCart,orderId,getOrder,setOrderErrors}=useContext(OrderContext),{url,callExternalFunction}=useContext(ExternalFunctionContext),{item,items,quantity,option,prices,lineItems,lineItem:lineItemContext,skuCode:itemSkuCode}=useContext(ItemContext),{skuLists}=useContext(SkuListsContext),sCode=!isEmpty(items)&&skuCode?(_a=items[skuCode])===null||_a===void 0?void 0:_a.code:skuCode||getCurrentItemKey(item)||itemSkuCode,availabilityQuantity=(_c=(_b=item[sCode])===null||_b===void 0?void 0:_b.inventory)===null||_c===void 0?void 0:_c.quantity,handleClick=()=>{var _a2,_b2;const qty=quantity[sCode],opt=option[sCode],customLineItem=isEmpty(lineItem||lineItemContext)?lineItems[sCode]:lineItem||lineItemContext;if(!isEmpty(skuLists)&&skuListId&&url){const slQty=quantity[skuListId]||1;if(has(skuLists,skuListId)){const lineItems2=skuLists&&skuLists[skuListId].map(skuCode2=>({skuCode:skuCode2,quantity:slQty,_update_quantity:1}));return callExternalFunction({url,data:{resourceType:"orders",inputs:[{id:orderId,lineItems:lineItems2}]}}).then(async res=>(getOrder&&orderId&&await getOrder(orderId),res)).catch(({response})=>(setOrderErrors&&setOrderErrors(response.data),response))}}return url?callExternalFunction({url,data:{bundleCode,skuCode:sCode,skuId:(_b2=item[sCode])===null||_b2===void 0?void 0:_b2.id,quantity:qty,option:opt,lineItem:customLineItem}}).then(async res=>(getOrder&&orderId&&await getOrder(orderId),res)).catch(({response})=>(setOrderErrors&&setOrderErrors(response.data),response)):addToCart&&addToCart({bundleCode,skuCode:sCode,skuId:(_a2=item[sCode])===null||_a2===void 0?void 0:_a2.id,quantity:qty,option:opt,lineItem:customLineItem})},autoDisabled=!isEmpty(skuLists)||skuListId?!1:disabled||!prices[sCode]||!sCode||availabilityQuantity===0,parentProps=Object.assign({handleClick,disabled:disabled||autoDisabled,label},props);return children?_jsx(Parent,Object.assign({},parentProps,{children})):_jsx("button",Object.assign({},p,{disabled:autoDisabled,onClick:handleClick},{children:isFunction(label)?label():label}))};AddToCartButton.propTypes=propTypes,AddToCartButton.defaultProps=defaultProps,AddToCartButton.displayName=displayName;export default AddToCartButton;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import Parent from"./utils/Parent";import OrderContext from"../context/OrderContext";import{isEmpty,has}from"lodash";import ItemContext from"../context/ItemContext";import getCurrentItemKey from"../utils/getCurrentItemKey";import components from"../config/components";import SkuListsContext from"../context/SkuListsContext";import ExternalFunctionContext from"../context/ExternalFunctionContext";import isFunction from"lodash/isFunction";import SkuChildrenContext from"../context/SkuChildrenContext";const propTypes=components.AddToCartButton.propTypes,defaultProps=components.AddToCartButton.defaultProps,displayName=components.AddToCartButton.displayName,AddToCartButton=props=>{var _a,_b,_c;const{label="Add to cart",children,skuCode,bundleCode,disabled,skuListId,lineItem,buyNowMode,checkoutUrl}=props,p=__rest(props,["label","children","skuCode","bundleCode","disabled","skuListId","lineItem","buyNowMode","checkoutUrl"]),{addToCart,orderId,getOrder,setOrderErrors}=useContext(OrderContext),{url,callExternalFunction}=useContext(ExternalFunctionContext),{item,items,quantity,option,prices,lineItems,lineItem:lineItemContext,skuCode:itemSkuCode}=useContext(ItemContext),{skuLists}=useContext(SkuListsContext),{sku}=useContext(SkuChildrenContext),sCode=!isEmpty(items)&&skuCode?(_a=items[skuCode])===null||_a===void 0?void 0:_a.code:(sku==null?void 0:sku.code)||skuCode||getCurrentItemKey(item)||itemSkuCode,availabilityQuantity=(_c=(_b=item[sCode])===null||_b===void 0?void 0:_b.inventory)===null||_c===void 0?void 0:_c.quantity,handleClick=()=>{var _a2,_b2;const qty=quantity[sCode],opt=option[sCode],customLineItem=isEmpty(lineItem||lineItemContext)?lineItems[sCode]:lineItem||lineItemContext;if(!isEmpty(skuLists)&&skuListId&&url){const slQty=quantity[skuListId]||1;if(has(skuLists,skuListId)){const lineItems2=skuLists&&skuLists[skuListId].map(skuCode2=>({skuCode:skuCode2,quantity:slQty,_update_quantity:1}));return callExternalFunction({url,data:{resourceType:"orders",inputs:[{id:orderId,lineItems:lineItems2}]}}).then(async res=>(getOrder&&orderId&&await getOrder(orderId),res)).catch(({response})=>(setOrderErrors&&setOrderErrors(response.data),response))}}return url?callExternalFunction({url,data:{bundleCode,skuCode:sCode,skuId:(_b2=item[sCode])===null||_b2===void 0?void 0:_b2.id,quantity:qty,option:opt,lineItem:customLineItem,buyNowMode,checkoutUrl}}).then(async res=>(getOrder&&orderId&&await getOrder(orderId),res)).catch(({response})=>(setOrderErrors&&setOrderErrors(response.data),response)):addToCart&&addToCart({bundleCode,skuCode:sCode,skuId:(_a2=item[sCode])===null||_a2===void 0?void 0:_a2.id,quantity:qty,option:opt,lineItem:customLineItem,buyNowMode,checkoutUrl})},autoDisabled=!isEmpty(skuLists)||skuListId?!1:disabled||!prices[sCode]||!sCode||availabilityQuantity===0,parentProps=Object.assign({handleClick,disabled:disabled||autoDisabled,label},props);return children?_jsx(Parent,Object.assign({},parentProps,{children})):_jsx("button",Object.assign({},p,{disabled:autoDisabled,onClick:handleClick},{children:isFunction(label)?label():label}))};AddToCartButton.propTypes=propTypes,AddToCartButton.defaultProps=defaultProps,AddToCartButton.displayName=displayName;export default AddToCartButton;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useReducer,useEffect}from"react";import availabilityReducer,{availabilityInitialState,getAvailability}from"../reducers/AvailabilityReducer";import AvailabilityContext from"../context/AvailabilityContext";import ItemContext from"../context/ItemContext";import getCurrentItemKey from"../utils/getCurrentItemKey";import components from"../config/components";import CommerceLayerContext from"../context/CommerceLayerContext";import LineItemChildrenContext from"../context/LineItemChildrenContext";const propTypes=components.AvailabilityContainer.propTypes,displayName=components.AvailabilityContainer.displayName,AvailabilityContainer=props=>{const{children,skuCode}=props,{item,skuCode:itemSkuCode,setItem}=useContext(ItemContext),{lineItem}=useContext(LineItemChildrenContext),config=useContext(CommerceLayerContext),[state,dispatch]=useReducer(availabilityReducer,availabilityInitialState),sCode=skuCode||getCurrentItemKey(item)||itemSkuCode||(lineItem==null?void 0:lineItem.sku_code);return useEffect(()=>{var _a,_b,_c,_d,_e,_f,_g;if(sCode){const available=(_b=(_a=item[sCode])===null||_a===void 0?void 0:_a.inventory)===null||_b===void 0?void 0:_b.available,quantity=(_d=(_c=item[sCode])===null||_c===void 0?void 0:_c.inventory)===null||_d===void 0?void 0:_d.quantity,[level]=((_f=(_e=item[sCode])===null||_e===void 0?void 0:_e.inventory)===null||_f===void 0?void 0:_f.levels)||[{quantity:null,delivery_lead_times:[]}];if(level!==void 0&&((_g=level==null?void 0:level.delivery_lead_times)===null||_g===void 0?void 0:_g.length)>0){const[delivery]=level.delivery_lead_times;dispatch({type:"setAvailability",payload:Object.assign(Object.assign({},delivery),{quantity:level==null?void 0:level.quantity})})}else config.accessToken&&!(item==null?void 0:item[sCode])?getAvailability({skuCode:sCode,config,dispatch,setItem}):available||dispatch({type:"setAvailability",payload:{quantity}})}return()=>{dispatch({type:"setAvailability",payload:{}})}},[config.accessToken,item,sCode]),_jsx(AvailabilityContext.Provider,Object.assign({value:Object.assign({},state)},{children}))};AvailabilityContainer.propTypes=propTypes,AvailabilityContainer.displayName=displayName;export default AvailabilityContainer;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useReducer,useEffect}from"react";import availabilityReducer,{availabilityInitialState,getAvailability}from"../reducers/AvailabilityReducer";import AvailabilityContext from"../context/AvailabilityContext";import ItemContext from"../context/ItemContext";import getCurrentItemKey from"../utils/getCurrentItemKey";import components from"../config/components";import CommerceLayerContext from"../context/CommerceLayerContext";import LineItemChildrenContext from"../context/LineItemChildrenContext";import SkuChildrenContext from"../context/SkuChildrenContext";const propTypes=components.AvailabilityContainer.propTypes,displayName=components.AvailabilityContainer.displayName,AvailabilityContainer=props=>{const{children,skuCode}=props,{item,skuCode:itemSkuCode,setItem}=useContext(ItemContext),{lineItem}=useContext(LineItemChildrenContext),{sku}=useContext(SkuChildrenContext),config=useContext(CommerceLayerContext),[state,dispatch]=useReducer(availabilityReducer,availabilityInitialState),sCode=skuCode||getCurrentItemKey(item)||itemSkuCode||(lineItem==null?void 0:lineItem.sku_code)||(sku==null?void 0:sku.code);return useEffect(()=>{var _a,_b,_c,_d,_e,_f,_g;if(sCode){const available=(_b=(_a=item[sCode])===null||_a===void 0?void 0:_a.inventory)===null||_b===void 0?void 0:_b.available,quantity=(_d=(_c=item[sCode])===null||_c===void 0?void 0:_c.inventory)===null||_d===void 0?void 0:_d.quantity,[level]=((_f=(_e=item[sCode])===null||_e===void 0?void 0:_e.inventory)===null||_f===void 0?void 0:_f.levels)||[{quantity:null,delivery_lead_times:[]}];if(level!==void 0&&((_g=level==null?void 0:level.delivery_lead_times)===null||_g===void 0?void 0:_g.length)>0){const[delivery]=level.delivery_lead_times;dispatch({type:"setAvailability",payload:Object.assign(Object.assign({},delivery),{quantity:level==null?void 0:level.quantity})})}else config.accessToken&&!(item==null?void 0:item[sCode])?getAvailability({skuCode:sCode,config,dispatch,setItem}):available||dispatch({type:"setAvailability",payload:{quantity}})}return()=>{dispatch({type:"setAvailability",payload:{}})}},[config.accessToken,item,sCode]),_jsx(AvailabilityContext.Provider,Object.assign({value:Object.assign({},state)},{children}))};AvailabilityContainer.propTypes=propTypes,AvailabilityContainer.displayName=displayName;export default AvailabilityContainer;
@@ -1 +1 @@
1
- import{FunctionComponent,ReactNode}from'react';declare type ItemContainerProps={children:ReactNode;skuCode?:string|null;lineItem?:{name:string;imageUrl?:string|null;}|null;};declare const ItemContainer:FunctionComponent<ItemContainerProps>;export default ItemContainer;
1
+ import React,{ReactNode}from'react';declare type ItemContainerProps={children:ReactNode;skuCode?:string|null;lineItem?:{name:string;imageUrl?:string|null;}|null;};declare const ItemContainer:React.FunctionComponent<ItemContainerProps>;export default ItemContainer;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useReducer,useEffect}from"react";import ItemContext,{initialItemContext}from"../context/ItemContext";import itemReducer,{itemInitialState,setItemState}from"../reducers/ItemReducer";import components from"../config/components";const propTypes=components.ItemContainer.propTypes,displayName=components.ItemContainer.displayName,ItemContainer=props=>{const{children,skuCode,lineItem}=props,[state,dispatch]=useReducer(itemReducer,itemInitialState);useEffect(()=>{skuCode&&setItemState(skuCode,{type:"setSkuCode",key:"skuCode"},dispatch),lineItem&&setItemState(lineItem,{type:"setCustomLineItem",key:"lineItem"},dispatch)},[]);const setItems=items=>setItemState(items,{type:"setItems",key:"items"},dispatch),setItem=item=>setItemState(item,{type:"setItem",key:"item"},dispatch),setQuantity=item=>setItemState(item,{type:"setQuantity",key:"quantity"},dispatch),setOption=item=>setItemState(item,{type:"setOption",key:"option"},dispatch),setPrices=item=>setItemState(item,{type:"setPrices",key:"prices"},dispatch),setCustomLineItems=item=>setItemState(item,{type:"setCustomLineItems",key:"lineItems"},dispatch),itemValue=Object.assign(Object.assign(Object.assign({},initialItemContext),state),{setItems,setItem,setQuantity,setOption,setPrices,setCustomLineItems});return _jsx(ItemContext.Provider,Object.assign({value:itemValue},{children}))};ItemContainer.propTypes=propTypes,ItemContainer.displayName=displayName;export default ItemContainer;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useReducer,useEffect,useContext}from"react";import ItemContext,{initialItemContext}from"../context/ItemContext";import itemReducer,{itemInitialState,setItemState}from"../reducers/ItemReducer";import components from"../config/components";import SkuChildrenContext from"../context/SkuChildrenContext";const propTypes=components.ItemContainer.propTypes,displayName=components.ItemContainer.displayName,ItemContainer=props=>{const{children,skuCode,lineItem}=props,[state,dispatch]=useReducer(itemReducer,itemInitialState),{sku}=useContext(SkuChildrenContext);useEffect(()=>{const code=skuCode||(sku==null?void 0:sku.code);code&&setItemState(code,{type:"setSkuCode",key:"skuCode"},dispatch),lineItem&&setItemState(lineItem,{type:"setCustomLineItem",key:"lineItem"},dispatch)},[sku==null?void 0:sku.code]);const setItems=items=>setItemState(items,{type:"setItems",key:"items"},dispatch),setItem=item=>setItemState(item,{type:"setItem",key:"item"},dispatch),setQuantity=item=>setItemState(item,{type:"setQuantity",key:"quantity"},dispatch),setOption=item=>setItemState(item,{type:"setOption",key:"option"},dispatch),setPrices=item=>setItemState(item,{type:"setPrices",key:"prices"},dispatch),setCustomLineItems=item=>setItemState(item,{type:"setCustomLineItems",key:"lineItems"},dispatch),itemValue=Object.assign(Object.assign(Object.assign({},initialItemContext),state),{setItems,setItem,setQuantity,setOption,setPrices,setCustomLineItems});return _jsx(ItemContext.Provider,Object.assign({value:itemValue},{children}))};ItemContainer.propTypes=propTypes,ItemContainer.displayName=displayName;export default ItemContainer;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useEffect,useContext,useReducer}from"react";import getPrices from"../utils/getPrices";import{isEmpty,indexOf,has}from"lodash";import CommerceLayerContext from"../context/CommerceLayerContext";import priceReducer,{unsetPriceState}from"../reducers/PriceReducer";import{priceInitialState,getSkusPrice}from"../reducers/PriceReducer";import PricesContext from"../context/PricesContext";import getCurrentItemKey from"../utils/getCurrentItemKey";import ItemContext from"../context/ItemContext";import components from"../config/components";const propTypes=components.PricesContainer.propTypes,defaultProps=components.PricesContainer.defaultProps,displayName=components.PricesContainer.displayName,PricesContainer=props=>{const{children,skuCode="",loader="Loading...",perPage=10,filters={}}=props,[state,dispatch]=useReducer(priceReducer,priceInitialState),config=useContext(CommerceLayerContext),{setPrices,prices,items,item:currentItem,skuCode:itemSkuCode}=useContext(ItemContext);indexOf(state.skuCodes,skuCode)===-1&&skuCode&&state.skuCodes.push(skuCode);const sCode=getCurrentItemKey(currentItem)||skuCode||itemSkuCode||"",setSkuCodes=skuCodes=>{dispatch({type:"setSkuCodes",payload:{skuCodes}})};useEffect(()=>{if(currentItem&&has(prices,sCode)&&dispatch({type:"setPrices",payload:{prices}}),!isEmpty(items)&&isEmpty(currentItem)){const p=getPrices(items);dispatch({type:"setPrices",payload:{prices:p}})}return(config.accessToken&&isEmpty(currentItem)||config.accessToken&&!has(prices,sCode))&&(state.skuCodes.length>0||skuCode)&&getSkusPrice(sCode&&[sCode]||state.skuCodes,{config,dispatch,setPrices,prices,perPage,filters}),()=>{isEmpty(currentItem)&&unsetPriceState(dispatch)}},[config.accessToken,currentItem,sCode,state.skuCodes.length]);const priceValue=Object.assign(Object.assign({},state),{skuCode:sCode,loader,setSkuCodes});return _jsx(PricesContext.Provider,Object.assign({value:priceValue},{children}))};PricesContainer.propTypes=propTypes,PricesContainer.defaultProps=defaultProps,PricesContainer.displayName=displayName;export default PricesContainer;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useEffect,useContext,useReducer}from"react";import getPrices from"../utils/getPrices";import{isEmpty,indexOf,has}from"lodash";import CommerceLayerContext from"../context/CommerceLayerContext";import priceReducer,{unsetPriceState}from"../reducers/PriceReducer";import{priceInitialState,getSkusPrice}from"../reducers/PriceReducer";import PricesContext from"../context/PricesContext";import getCurrentItemKey from"../utils/getCurrentItemKey";import ItemContext from"../context/ItemContext";import components from"../config/components";import SkuChildrenContext from"../context/SkuChildrenContext";const propTypes=components.PricesContainer.propTypes,defaultProps=components.PricesContainer.defaultProps,displayName=components.PricesContainer.displayName,PricesContainer=props=>{const{children,skuCode="",loader="Loading...",perPage=10,filters={}}=props,[state,dispatch]=useReducer(priceReducer,priceInitialState),config=useContext(CommerceLayerContext),{sku}=useContext(SkuChildrenContext),{setPrices,prices,items,item:currentItem,skuCode:itemSkuCode}=useContext(ItemContext);indexOf(state.skuCodes,skuCode)===-1&&skuCode&&state.skuCodes.push(skuCode);const sCode=getCurrentItemKey(currentItem)||(sku==null?void 0:sku.code)||skuCode||itemSkuCode||"",setSkuCodes=skuCodes=>{dispatch({type:"setSkuCodes",payload:{skuCodes}})};useEffect(()=>{if(currentItem&&has(prices,sCode)&&dispatch({type:"setPrices",payload:{prices}}),!isEmpty(items)&&isEmpty(currentItem)){const p=getPrices(items);dispatch({type:"setPrices",payload:{prices:p}})}return(config.accessToken&&isEmpty(currentItem)||config.accessToken&&!has(prices,sCode))&&(state.skuCodes.length>0||skuCode)&&getSkusPrice(sCode&&[sCode]||state.skuCodes,{config,dispatch,setPrices,prices,perPage,filters}),()=>{isEmpty(currentItem)&&unsetPriceState(dispatch)}},[config.accessToken,currentItem,sCode,state.skuCodes.length]);const priceValue=Object.assign(Object.assign({},state),{skuCode:sCode,loader,setSkuCodes});return _jsx(PricesContext.Provider,Object.assign({value:priceValue},{children}))};PricesContainer.propTypes=propTypes,PricesContainer.defaultProps=defaultProps,PricesContainer.displayName=displayName;export default PricesContainer;
@@ -1 +1 @@
1
- import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useState,useEffect}from"react";import Parent from"./utils/Parent";import{isEmpty,has}from"lodash";import getCurrentItemKey from"../utils/getCurrentItemKey";import ItemContext from"../context/ItemContext";import components from"../config/components";import SkuListsContext from"../context/SkuListsContext";const propTypes=components.QuantitySelector.propTypes,defaultProps=components.QuantitySelector.defaultProps,displayName=components.QuantitySelector.displayName,QuantitySelector=props=>{var _a,_b,_c;const{skuCode,skuListId,children,min=1,max}=props,p=__rest(props,["skuCode","skuListId","children","min","max"]),{item,setQuantity,items,quantity,prices,skuCode:itemSkuCode}=useContext(ItemContext),{skuLists,listIds}=useContext(SkuListsContext),[value,setValue]=useState(min),[disabled,setDisabled]=useState(!!p.disabled),sCode=!isEmpty(items)&&skuCode?(_a=items[skuCode])===null||_a===void 0?void 0:_a.code:skuCode||getCurrentItemKey(item)||itemSkuCode,inventory=isEmpty(item)?50:(_c=(_b=item[sCode])===null||_b===void 0?void 0:_b.inventory)===null||_c===void 0?void 0:_c.quantity,maxInv=max||inventory;useEffect(()=>{if(setValue(min),(!prices[sCode]||!sCode)&&setDisabled(!0),skuListId&&setDisabled(!1),sCode){const qty=Number(min);setQuantity&&setQuantity(Object.assign(Object.assign({},quantity),{[`${sCode}`]:qty})),!isEmpty(prices)&&has(prices,sCode)&&setDisabled(!1)}return()=>{setValue(min)}},[item,listIds,prices]);const handleChange=e=>{const qty=Number(e.target.value),valid=Number(qty)>=Number(min)&&Number(qty)<=Number(maxInv);setValue(qty),!isEmpty(skuLists)&&skuListId&&valid?setQuantity&&setQuantity(Object.assign(Object.assign({},quantity),{[`${skuListId}`]:Number(qty)})):sCode&&valid&&setQuantity&&setQuantity(Object.assign(Object.assign({},quantity),{[`${sCode}`]:Number(qty)}))},handleBlur=e=>{const qty=e.target.value;if(!(Number(qty)>=Number(min)&&Number(qty)<=Number(maxInv))){const resetVal=Number(qty)<Number(min)?min:maxInv;setValue(resetVal),!isEmpty(skuLists)&&skuListId?setQuantity&&setQuantity(Object.assign(Object.assign({},quantity),{[`${skuListId}`]:Number(resetVal)})):setQuantity&&setQuantity(Object.assign(Object.assign({},quantity),{[`${sCode}`]:Number(resetVal)}))}},parentProps=Object.assign({min,max:maxInv,disabled,handleChange,handleBlur,value},props);return children?_jsx(Parent,Object.assign({},parentProps,{children})):_jsx("input",Object.assign({type:"number",max:maxInv,min,value:value||"",disabled,onChange:handleChange,onBlur:handleBlur},p))};QuantitySelector.propTypes=propTypes,QuantitySelector.defaultProps=defaultProps,QuantitySelector.displayName=displayName;export default QuantitySelector;
1
+ import{__rest}from"tslib";import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useState,useEffect}from"react";import Parent from"./utils/Parent";import{isEmpty,has}from"lodash";import getCurrentItemKey from"../utils/getCurrentItemKey";import ItemContext from"../context/ItemContext";import components from"../config/components";import SkuListsContext from"../context/SkuListsContext";import SkuChildrenContext from"../context/SkuChildrenContext";const propTypes=components.QuantitySelector.propTypes,defaultProps=components.QuantitySelector.defaultProps,displayName=components.QuantitySelector.displayName,QuantitySelector=props=>{var _a,_b,_c;const{skuCode,skuListId,children,min=1,max}=props,p=__rest(props,["skuCode","skuListId","children","min","max"]),{item,setQuantity,items,quantity,prices,skuCode:itemSkuCode}=useContext(ItemContext),{sku}=useContext(SkuChildrenContext),{skuLists,listIds}=useContext(SkuListsContext),[value,setValue]=useState(min),[disabled,setDisabled]=useState(!!p.disabled),sCode=!isEmpty(items)&&skuCode?(_a=items[skuCode])===null||_a===void 0?void 0:_a.code:(sku==null?void 0:sku.code)||skuCode||getCurrentItemKey(item)||itemSkuCode,inventory=isEmpty(item)?50:(_c=(_b=item[sCode])===null||_b===void 0?void 0:_b.inventory)===null||_c===void 0?void 0:_c.quantity,maxInv=max||inventory;useEffect(()=>{if(setValue(min),(!prices[sCode]||!sCode)&&setDisabled(!0),skuListId&&setDisabled(!1),sCode){const qty=Number(min);setQuantity&&setQuantity(Object.assign(Object.assign({},quantity),{[`${sCode}`]:qty})),!isEmpty(prices)&&has(prices,sCode)&&setDisabled(!1)}return()=>{setValue(min)}},[item,listIds,prices]);const handleChange=e=>{const qty=Number(e.target.value),valid=Number(qty)>=Number(min)&&Number(qty)<=Number(maxInv);setValue(qty),!isEmpty(skuLists)&&skuListId&&valid?setQuantity&&setQuantity(Object.assign(Object.assign({},quantity),{[`${skuListId}`]:Number(qty)})):sCode&&valid&&setQuantity&&setQuantity(Object.assign(Object.assign({},quantity),{[`${sCode}`]:Number(qty)}))},handleBlur=e=>{const qty=e.target.value;if(!(Number(qty)>=Number(min)&&Number(qty)<=Number(maxInv))){const resetVal=Number(qty)<Number(min)?min:maxInv;setValue(resetVal),!isEmpty(skuLists)&&skuListId?setQuantity&&setQuantity(Object.assign(Object.assign({},quantity),{[`${skuListId}`]:Number(resetVal)})):setQuantity&&setQuantity(Object.assign(Object.assign({},quantity),{[`${sCode}`]:Number(resetVal)}))}},parentProps=Object.assign({min,max:maxInv,disabled,handleChange,handleBlur,value},props);return children?_jsx(Parent,Object.assign({},parentProps,{children})):_jsx("input",Object.assign({type:"number",max:maxInv,min,value:value||"",disabled,onChange:handleChange,onBlur:handleBlur},p))};QuantitySelector.propTypes=propTypes,QuantitySelector.defaultProps=defaultProps,QuantitySelector.displayName=displayName;export default QuantitySelector;
@@ -0,0 +1 @@
1
+ import{QueryParamsList}from'@commercelayer/sdk';import{ReactNode}from'react';declare type Props={skus:string[];children:ReactNode;queryParams?:QueryParamsList;};declare function SkusContainer<P extends Props>(props:P):JSX.Element;declare namespace SkusContainer{var propTypes:{children:import("prop-types").Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>ReactNode)>;};}export default SkusContainer;
@@ -0,0 +1 @@
1
+ import{jsx as _jsx}from"react/jsx-runtime";import components from"../config/components";import CommerceLayerContext from"../context/CommerceLayerContext";import SkuContext from"../context/SkuContext";import skuReducer,{getSku,skuInitialState}from"../reducers/SkuReducer";import{useContext,useEffect,useMemo,useReducer}from"react";export default function SkusContainer(props){const{skus,children,queryParams}=props,[state,dispatch]=useReducer(skuReducer,skuInitialState),config=useContext(CommerceLayerContext),loadSkus=async()=>await getSku({config,dispatch,skus,queryParams});useEffect(()=>(config.accessToken&&(state==null?void 0:state.skus)&&(state==null?void 0:state.skus.length)===0&&loadSkus(),()=>{dispatch({type:"setLoading",payload:{loading:!0}})}),[config,skus]);const contextValue=useMemo(()=>state,[state]);return _jsx(SkuContext.Provider,Object.assign({value:contextValue},{children}))}SkusContainer.propTypes=components.SkusContainer.propTypes;
@@ -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>;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;};};SkuContainer:{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{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;
@@ -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,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"}},SkuContainer:{displayName:"SkuContainer",permittedChildren:["Skus","ReactNode"],propTypes:{children:childrenTypes.isRequired}},Skus:{displayName:"Skus",permittedChildren:["SkuField","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,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;
package/lib/index.d.ts CHANGED
@@ -1 +1 @@
1
- export{default as AddToCartButton}from'./components/AddToCartButton';export{default as Address}from'./components/Address';export{default as AddressCountrySelector}from'./components/AddressCountrySelector';export{default as AddressField}from'./components/AddressField';export{default as AddressInput}from'./components/AddressInput';export{default as AddressStateSelector}from'./components/AddressStateSelector';export{default as AddressesContainer}from'./components/AddressesContainer';export{default as AdjustmentAmount}from'./components/AdjustmentAmount';export{default as AvailabilityContainer}from'./components/AvailabilityContainer';export{default as AvailabilityTemplate}from'./components/AvailabilityTemplate';export{default as BillingAddressContainer}from'./components/BillingAddressContainer';export{default as BillingAddressForm}from'./components/BillingAddressForm';export{default as CheckoutLink}from'./components/CheckoutLink';export{default as CommerceLayer}from'./components/CommerceLayer';export{default as CustomerContainer}from'./components/CustomerContainer';export{default as CustomerInput}from'./components/CustomerInput';export{default as DeliveryLeadTime}from'./components/DeliveryLeadTime';export{default as DiscountAmount}from'./components/DiscountAmount';export{default as Errors}from'./components/Errors';export{default as ExternalFunction}from'./components/ExternalFunction';export{default as GiftCard}from'./components/GiftCard';export{default as GiftCardAmount}from'./components/GiftCardAmount';export{default as GiftCardContainer}from'./components/GiftCardContainer';export{default as GiftCardCurrencySelector}from'./components/GiftCardCurrencySelector';export{default as GiftCardInput}from'./components/GiftCardInput';export{default as GiftCardOrCouponCode}from'./components/GiftCardOrCouponCode';export{default as GiftCardOrCouponForm}from'./components/GiftCardOrCouponForm';export{default as GiftCardOrCouponInput}from'./components/GiftCardOrCouponInput';export{default as GiftCardOrCouponRemoveButton}from'./components/GiftCardOrCouponRemoveButton';export{default as GiftCardOrCouponSubmit}from'./components/GiftCardOrCouponSubmit';export{default as ItemContainer}from'./components/ItemContainer';export{default as LineItem}from'./components/LineItem';export{default as LineItemAmount}from'./components/LineItemAmount';export{default as LineItemCode}from'./components/LineItemCode';export{default as LineItemImage}from'./components/LineItemImage';export{default as LineItemName}from'./components/LineItemName';export{default as LineItemOption}from'./components/LineItemOption';export{default as LineItemOptions}from'./components/LineItemOptions';export{default as LineItemQuantity}from'./components/LineItemQuantity';export{default as LineItemRemoveLink}from'./components/LineItemRemoveLink';export{default as LineItemsContainer}from'./components/LineItemsContainer';export{default as LineItemsCount}from'./components/LineItemsCount';export{default as LineItemsEmpty}from'./components/LineItemsEmpty';export{default as MetadataInput}from'./components/MetadataInput';export{default as OrderContainer}from'./components/OrderContainer';export{default as OrderNumber}from'./components/OrderNumber';export{default as OrderStorage}from'./components/OrderStorage';export{default as PaymentMethod}from'./components/PaymentMethod';export{default as PaymentMethodAmount}from'./components/PaymentMethodAmount';export{default as PaymentMethodName}from'./components/PaymentMethodName';export{default as PaymentMethodPrice}from'./components/PaymentMethodPrice';export{default as PaymentMethodRadioButton}from'./components/PaymentMethodRadioButton';export{default as PaymentMethodsContainer}from'./components/PaymentMethodsContainer';export{default as PaymentSource}from'./components/PaymentSource';export{default as PaymentSourceBrandIcon}from'./components/PaymentSourceBrandIcon';export{default as PaymentSourceBrandName}from'./components/PaymentSourceBrandName';export{default as PaymentSourceDetail}from'./components/PaymentSourceDetail';export{default as PaymentSourceEditButton}from'./components/PaymentSourceEditButton';export{default as PlaceOrderButton}from'./components/PlaceOrderButton';export{default as PlaceOrderContainer}from'./components/PlaceOrderContainer';export{default as Price}from'./components/Price';export{default as PricesContainer}from'./components/PricesContainer';export{default as PrivacyAndTermsCheckbox}from'./components/PrivacyAndTermsCheckbox';export{default as QuantitySelector}from'./components/QuantitySelector';export{default as SaveAddressesButton}from'./components/SaveAddressesButton';export{default as SaveCustomerButton}from'./components/SaveCustomerButton';export{default as Shipment}from'./components/Shipment';export{default as ShipmentField}from'./components/ShipmentField';export{default as ShipmentsContainer}from'./components/ShipmentsContainer';export{default as ShippingAddressContainer}from'./components/ShippingAddressContainer';export{default as ShippingAddressForm}from'./components/ShippingAddressForm';export{default as ShippingAmount}from'./components/ShippingAmount';export{default as ShippingMethod}from'./components/ShippingMethod';export{default as ShippingMethodName}from'./components/ShippingMethodName';export{default as ShippingMethodPrice}from'./components/ShippingMethodPrice';export{default as ShippingMethodRadioButton}from'./components/ShippingMethodRadioButton';export{default as Skus}from'./components/Skus';export{default as SkuContainer}from'./components/SkuContainer';export{default as SkuField}from'./components/SkuField';export{default as SkuList}from'./components/SkuList';export{default as SkuListsContainer}from'./components/SkuListsContainer';export{default as SkuOption}from'./components/SkuOption';export{default as SkuOptionInput}from'./components/SkuOptionInput';export{default as SkuOptionsContainer}from'./components/SkuOptionsContainer';export{default as StockTransfer}from'./components/StockTransfer';export{default as StockTransferField}from'./components/StockTransferField';export{default as SubTotalAmount}from'./components/SubTotalAmount';export{default as SubmitButton}from'./components/SubmitButton';export{default as TaxesAmount}from'./components/TaxesAmount';export{default as TotalAmount}from'./components/TotalAmount';export{default as VariantSelector}from'./components/VariantSelector';export{default as VariantsContainer}from'./components/VariantsContainer';export type{CustomerCardsType}from'./components/utils/PaymentCardsTemplate';export type{AddressCardsType}from'./components/utils/AddressCardsTemplate';export type{AddToCartButtonType}from'./components/AddToCartButton';export type{ShippingMethodRadioButtonType,ShippingMethodRadioButtonOnChangeType,}from'./components/ShippingMethodRadioButton';export type{LineItemCodeType}from'./components/LineItemCode';export type{LineItemNameType}from'./components/LineItemName';export type{LineItemImageType}from'./components/LineItemImage';export type{LineItemType}from'./typings/index';export type{ErrorComponentProps,ResourceErrorType}from'./typings/errors';export type{AddressCountrySelectName,AddressInputName,AddressStateSelectName,BaseInputType,}from'./typings/index';
1
+ export{default as AddToCartButton}from'./components/AddToCartButton';export{default as Address}from'./components/Address';export{default as AddressCountrySelector}from'./components/AddressCountrySelector';export{default as AddressField}from'./components/AddressField';export{default as AddressInput}from'./components/AddressInput';export{default as AddressStateSelector}from'./components/AddressStateSelector';export{default as AddressesContainer}from'./components/AddressesContainer';export{default as AdjustmentAmount}from'./components/AdjustmentAmount';export{default as AvailabilityContainer}from'./components/AvailabilityContainer';export{default as AvailabilityTemplate}from'./components/AvailabilityTemplate';export{default as BillingAddressContainer}from'./components/BillingAddressContainer';export{default as BillingAddressForm}from'./components/BillingAddressForm';export{default as CheckoutLink}from'./components/CheckoutLink';export{default as CommerceLayer}from'./components/CommerceLayer';export{default as CustomerContainer}from'./components/CustomerContainer';export{default as CustomerInput}from'./components/CustomerInput';export{default as DeliveryLeadTime}from'./components/DeliveryLeadTime';export{default as DiscountAmount}from'./components/DiscountAmount';export{default as Errors}from'./components/Errors';export{default as ExternalFunction}from'./components/ExternalFunction';export{default as GiftCard}from'./components/GiftCard';export{default as GiftCardAmount}from'./components/GiftCardAmount';export{default as GiftCardContainer}from'./components/GiftCardContainer';export{default as GiftCardCurrencySelector}from'./components/GiftCardCurrencySelector';export{default as GiftCardInput}from'./components/GiftCardInput';export{default as GiftCardOrCouponCode}from'./components/GiftCardOrCouponCode';export{default as GiftCardOrCouponForm}from'./components/GiftCardOrCouponForm';export{default as GiftCardOrCouponInput}from'./components/GiftCardOrCouponInput';export{default as GiftCardOrCouponRemoveButton}from'./components/GiftCardOrCouponRemoveButton';export{default as GiftCardOrCouponSubmit}from'./components/GiftCardOrCouponSubmit';export{default as ItemContainer}from'./components/ItemContainer';export{default as LineItem}from'./components/LineItem';export{default as LineItemAmount}from'./components/LineItemAmount';export{default as LineItemCode}from'./components/LineItemCode';export{default as LineItemImage}from'./components/LineItemImage';export{default as LineItemName}from'./components/LineItemName';export{default as LineItemOption}from'./components/LineItemOption';export{default as LineItemOptions}from'./components/LineItemOptions';export{default as LineItemQuantity}from'./components/LineItemQuantity';export{default as LineItemRemoveLink}from'./components/LineItemRemoveLink';export{default as LineItemsContainer}from'./components/LineItemsContainer';export{default as LineItemsCount}from'./components/LineItemsCount';export{default as LineItemsEmpty}from'./components/LineItemsEmpty';export{default as MetadataInput}from'./components/MetadataInput';export{default as OrderContainer}from'./components/OrderContainer';export{default as OrderNumber}from'./components/OrderNumber';export{default as OrderStorage}from'./components/OrderStorage';export{default as PaymentMethod}from'./components/PaymentMethod';export{default as PaymentMethodAmount}from'./components/PaymentMethodAmount';export{default as PaymentMethodName}from'./components/PaymentMethodName';export{default as PaymentMethodPrice}from'./components/PaymentMethodPrice';export{default as PaymentMethodRadioButton}from'./components/PaymentMethodRadioButton';export{default as PaymentMethodsContainer}from'./components/PaymentMethodsContainer';export{default as PaymentSource}from'./components/PaymentSource';export{default as PaymentSourceBrandIcon}from'./components/PaymentSourceBrandIcon';export{default as PaymentSourceBrandName}from'./components/PaymentSourceBrandName';export{default as PaymentSourceDetail}from'./components/PaymentSourceDetail';export{default as PaymentSourceEditButton}from'./components/PaymentSourceEditButton';export{default as PlaceOrderButton}from'./components/PlaceOrderButton';export{default as PlaceOrderContainer}from'./components/PlaceOrderContainer';export{default as Price}from'./components/Price';export{default as PricesContainer}from'./components/PricesContainer';export{default as PrivacyAndTermsCheckbox}from'./components/PrivacyAndTermsCheckbox';export{default as QuantitySelector}from'./components/QuantitySelector';export{default as SaveAddressesButton}from'./components/SaveAddressesButton';export{default as SaveCustomerButton}from'./components/SaveCustomerButton';export{default as Shipment}from'./components/Shipment';export{default as ShipmentField}from'./components/ShipmentField';export{default as ShipmentsContainer}from'./components/ShipmentsContainer';export{default as ShippingAddressContainer}from'./components/ShippingAddressContainer';export{default as ShippingAddressForm}from'./components/ShippingAddressForm';export{default as ShippingAmount}from'./components/ShippingAmount';export{default as ShippingMethod}from'./components/ShippingMethod';export{default as ShippingMethodName}from'./components/ShippingMethodName';export{default as ShippingMethodPrice}from'./components/ShippingMethodPrice';export{default as ShippingMethodRadioButton}from'./components/ShippingMethodRadioButton';export{default as Skus}from'./components/Skus';export{default as SkusContainer}from'./components/SkusContainer';export{default as SkuField}from'./components/SkuField';export{default as SkuList}from'./components/SkuList';export{default as SkuListsContainer}from'./components/SkuListsContainer';export{default as SkuOption}from'./components/SkuOption';export{default as SkuOptionInput}from'./components/SkuOptionInput';export{default as SkuOptionsContainer}from'./components/SkuOptionsContainer';export{default as StockTransfer}from'./components/StockTransfer';export{default as StockTransferField}from'./components/StockTransferField';export{default as SubTotalAmount}from'./components/SubTotalAmount';export{default as SubmitButton}from'./components/SubmitButton';export{default as TaxesAmount}from'./components/TaxesAmount';export{default as TotalAmount}from'./components/TotalAmount';export{default as VariantSelector}from'./components/VariantSelector';export{default as VariantsContainer}from'./components/VariantsContainer';export type{CustomerCardsType}from'./components/utils/PaymentCardsTemplate';export type{AddressCardsType}from'./components/utils/AddressCardsTemplate';export type{AddToCartButtonType}from'./components/AddToCartButton';export type{ShippingMethodRadioButtonType,ShippingMethodRadioButtonOnChangeType,}from'./components/ShippingMethodRadioButton';export type{LineItemCodeType}from'./components/LineItemCode';export type{LineItemNameType}from'./components/LineItemName';export type{LineItemImageType}from'./components/LineItemImage';export type{LineItemType}from'./typings/index';export type{ErrorComponentProps,ResourceErrorType}from'./typings/errors';export type{AddressCountrySelectName,AddressInputName,AddressStateSelectName,BaseInputType,}from'./typings/index';
package/lib/index.js CHANGED
@@ -1 +1 @@
1
- export{default as AddToCartButton}from"./components/AddToCartButton";export{default as Address}from"./components/Address";export{default as AddressCountrySelector}from"./components/AddressCountrySelector";export{default as AddressField}from"./components/AddressField";export{default as AddressInput}from"./components/AddressInput";export{default as AddressStateSelector}from"./components/AddressStateSelector";export{default as AddressesContainer}from"./components/AddressesContainer";export{default as AdjustmentAmount}from"./components/AdjustmentAmount";export{default as AvailabilityContainer}from"./components/AvailabilityContainer";export{default as AvailabilityTemplate}from"./components/AvailabilityTemplate";export{default as BillingAddressContainer}from"./components/BillingAddressContainer";export{default as BillingAddressForm}from"./components/BillingAddressForm";export{default as CheckoutLink}from"./components/CheckoutLink";export{default as CommerceLayer}from"./components/CommerceLayer";export{default as CustomerContainer}from"./components/CustomerContainer";export{default as CustomerInput}from"./components/CustomerInput";export{default as DeliveryLeadTime}from"./components/DeliveryLeadTime";export{default as DiscountAmount}from"./components/DiscountAmount";export{default as Errors}from"./components/Errors";export{default as ExternalFunction}from"./components/ExternalFunction";export{default as GiftCard}from"./components/GiftCard";export{default as GiftCardAmount}from"./components/GiftCardAmount";export{default as GiftCardContainer}from"./components/GiftCardContainer";export{default as GiftCardCurrencySelector}from"./components/GiftCardCurrencySelector";export{default as GiftCardInput}from"./components/GiftCardInput";export{default as GiftCardOrCouponCode}from"./components/GiftCardOrCouponCode";export{default as GiftCardOrCouponForm}from"./components/GiftCardOrCouponForm";export{default as GiftCardOrCouponInput}from"./components/GiftCardOrCouponInput";export{default as GiftCardOrCouponRemoveButton}from"./components/GiftCardOrCouponRemoveButton";export{default as GiftCardOrCouponSubmit}from"./components/GiftCardOrCouponSubmit";export{default as ItemContainer}from"./components/ItemContainer";export{default as LineItem}from"./components/LineItem";export{default as LineItemAmount}from"./components/LineItemAmount";export{default as LineItemCode}from"./components/LineItemCode";export{default as LineItemImage}from"./components/LineItemImage";export{default as LineItemName}from"./components/LineItemName";export{default as LineItemOption}from"./components/LineItemOption";export{default as LineItemOptions}from"./components/LineItemOptions";export{default as LineItemQuantity}from"./components/LineItemQuantity";export{default as LineItemRemoveLink}from"./components/LineItemRemoveLink";export{default as LineItemsContainer}from"./components/LineItemsContainer";export{default as LineItemsCount}from"./components/LineItemsCount";export{default as LineItemsEmpty}from"./components/LineItemsEmpty";export{default as MetadataInput}from"./components/MetadataInput";export{default as OrderContainer}from"./components/OrderContainer";export{default as OrderNumber}from"./components/OrderNumber";export{default as OrderStorage}from"./components/OrderStorage";export{default as PaymentMethod}from"./components/PaymentMethod";export{default as PaymentMethodAmount}from"./components/PaymentMethodAmount";export{default as PaymentMethodName}from"./components/PaymentMethodName";export{default as PaymentMethodPrice}from"./components/PaymentMethodPrice";export{default as PaymentMethodRadioButton}from"./components/PaymentMethodRadioButton";export{default as PaymentMethodsContainer}from"./components/PaymentMethodsContainer";export{default as PaymentSource}from"./components/PaymentSource";export{default as PaymentSourceBrandIcon}from"./components/PaymentSourceBrandIcon";export{default as PaymentSourceBrandName}from"./components/PaymentSourceBrandName";export{default as PaymentSourceDetail}from"./components/PaymentSourceDetail";export{default as PaymentSourceEditButton}from"./components/PaymentSourceEditButton";export{default as PlaceOrderButton}from"./components/PlaceOrderButton";export{default as PlaceOrderContainer}from"./components/PlaceOrderContainer";export{default as Price}from"./components/Price";export{default as PricesContainer}from"./components/PricesContainer";export{default as PrivacyAndTermsCheckbox}from"./components/PrivacyAndTermsCheckbox";export{default as QuantitySelector}from"./components/QuantitySelector";export{default as SaveAddressesButton}from"./components/SaveAddressesButton";export{default as SaveCustomerButton}from"./components/SaveCustomerButton";export{default as Shipment}from"./components/Shipment";export{default as ShipmentField}from"./components/ShipmentField";export{default as ShipmentsContainer}from"./components/ShipmentsContainer";export{default as ShippingAddressContainer}from"./components/ShippingAddressContainer";export{default as ShippingAddressForm}from"./components/ShippingAddressForm";export{default as ShippingAmount}from"./components/ShippingAmount";export{default as ShippingMethod}from"./components/ShippingMethod";export{default as ShippingMethodName}from"./components/ShippingMethodName";export{default as ShippingMethodPrice}from"./components/ShippingMethodPrice";export{default as ShippingMethodRadioButton}from"./components/ShippingMethodRadioButton";export{default as Skus}from"./components/Skus";export{default as SkuContainer}from"./components/SkuContainer";export{default as SkuField}from"./components/SkuField";export{default as SkuList}from"./components/SkuList";export{default as SkuListsContainer}from"./components/SkuListsContainer";export{default as SkuOption}from"./components/SkuOption";export{default as SkuOptionInput}from"./components/SkuOptionInput";export{default as SkuOptionsContainer}from"./components/SkuOptionsContainer";export{default as StockTransfer}from"./components/StockTransfer";export{default as StockTransferField}from"./components/StockTransferField";export{default as SubTotalAmount}from"./components/SubTotalAmount";export{default as SubmitButton}from"./components/SubmitButton";export{default as TaxesAmount}from"./components/TaxesAmount";export{default as TotalAmount}from"./components/TotalAmount";export{default as VariantSelector}from"./components/VariantSelector";export{default as VariantsContainer}from"./components/VariantsContainer";
1
+ export{default as AddToCartButton}from"./components/AddToCartButton";export{default as Address}from"./components/Address";export{default as AddressCountrySelector}from"./components/AddressCountrySelector";export{default as AddressField}from"./components/AddressField";export{default as AddressInput}from"./components/AddressInput";export{default as AddressStateSelector}from"./components/AddressStateSelector";export{default as AddressesContainer}from"./components/AddressesContainer";export{default as AdjustmentAmount}from"./components/AdjustmentAmount";export{default as AvailabilityContainer}from"./components/AvailabilityContainer";export{default as AvailabilityTemplate}from"./components/AvailabilityTemplate";export{default as BillingAddressContainer}from"./components/BillingAddressContainer";export{default as BillingAddressForm}from"./components/BillingAddressForm";export{default as CheckoutLink}from"./components/CheckoutLink";export{default as CommerceLayer}from"./components/CommerceLayer";export{default as CustomerContainer}from"./components/CustomerContainer";export{default as CustomerInput}from"./components/CustomerInput";export{default as DeliveryLeadTime}from"./components/DeliveryLeadTime";export{default as DiscountAmount}from"./components/DiscountAmount";export{default as Errors}from"./components/Errors";export{default as ExternalFunction}from"./components/ExternalFunction";export{default as GiftCard}from"./components/GiftCard";export{default as GiftCardAmount}from"./components/GiftCardAmount";export{default as GiftCardContainer}from"./components/GiftCardContainer";export{default as GiftCardCurrencySelector}from"./components/GiftCardCurrencySelector";export{default as GiftCardInput}from"./components/GiftCardInput";export{default as GiftCardOrCouponCode}from"./components/GiftCardOrCouponCode";export{default as GiftCardOrCouponForm}from"./components/GiftCardOrCouponForm";export{default as GiftCardOrCouponInput}from"./components/GiftCardOrCouponInput";export{default as GiftCardOrCouponRemoveButton}from"./components/GiftCardOrCouponRemoveButton";export{default as GiftCardOrCouponSubmit}from"./components/GiftCardOrCouponSubmit";export{default as ItemContainer}from"./components/ItemContainer";export{default as LineItem}from"./components/LineItem";export{default as LineItemAmount}from"./components/LineItemAmount";export{default as LineItemCode}from"./components/LineItemCode";export{default as LineItemImage}from"./components/LineItemImage";export{default as LineItemName}from"./components/LineItemName";export{default as LineItemOption}from"./components/LineItemOption";export{default as LineItemOptions}from"./components/LineItemOptions";export{default as LineItemQuantity}from"./components/LineItemQuantity";export{default as LineItemRemoveLink}from"./components/LineItemRemoveLink";export{default as LineItemsContainer}from"./components/LineItemsContainer";export{default as LineItemsCount}from"./components/LineItemsCount";export{default as LineItemsEmpty}from"./components/LineItemsEmpty";export{default as MetadataInput}from"./components/MetadataInput";export{default as OrderContainer}from"./components/OrderContainer";export{default as OrderNumber}from"./components/OrderNumber";export{default as OrderStorage}from"./components/OrderStorage";export{default as PaymentMethod}from"./components/PaymentMethod";export{default as PaymentMethodAmount}from"./components/PaymentMethodAmount";export{default as PaymentMethodName}from"./components/PaymentMethodName";export{default as PaymentMethodPrice}from"./components/PaymentMethodPrice";export{default as PaymentMethodRadioButton}from"./components/PaymentMethodRadioButton";export{default as PaymentMethodsContainer}from"./components/PaymentMethodsContainer";export{default as PaymentSource}from"./components/PaymentSource";export{default as PaymentSourceBrandIcon}from"./components/PaymentSourceBrandIcon";export{default as PaymentSourceBrandName}from"./components/PaymentSourceBrandName";export{default as PaymentSourceDetail}from"./components/PaymentSourceDetail";export{default as PaymentSourceEditButton}from"./components/PaymentSourceEditButton";export{default as PlaceOrderButton}from"./components/PlaceOrderButton";export{default as PlaceOrderContainer}from"./components/PlaceOrderContainer";export{default as Price}from"./components/Price";export{default as PricesContainer}from"./components/PricesContainer";export{default as PrivacyAndTermsCheckbox}from"./components/PrivacyAndTermsCheckbox";export{default as QuantitySelector}from"./components/QuantitySelector";export{default as SaveAddressesButton}from"./components/SaveAddressesButton";export{default as SaveCustomerButton}from"./components/SaveCustomerButton";export{default as Shipment}from"./components/Shipment";export{default as ShipmentField}from"./components/ShipmentField";export{default as ShipmentsContainer}from"./components/ShipmentsContainer";export{default as ShippingAddressContainer}from"./components/ShippingAddressContainer";export{default as ShippingAddressForm}from"./components/ShippingAddressForm";export{default as ShippingAmount}from"./components/ShippingAmount";export{default as ShippingMethod}from"./components/ShippingMethod";export{default as ShippingMethodName}from"./components/ShippingMethodName";export{default as ShippingMethodPrice}from"./components/ShippingMethodPrice";export{default as ShippingMethodRadioButton}from"./components/ShippingMethodRadioButton";export{default as Skus}from"./components/Skus";export{default as SkusContainer}from"./components/SkusContainer";export{default as SkuField}from"./components/SkuField";export{default as SkuList}from"./components/SkuList";export{default as SkuListsContainer}from"./components/SkuListsContainer";export{default as SkuOption}from"./components/SkuOption";export{default as SkuOptionInput}from"./components/SkuOptionInput";export{default as SkuOptionsContainer}from"./components/SkuOptionsContainer";export{default as StockTransfer}from"./components/StockTransfer";export{default as StockTransferField}from"./components/StockTransferField";export{default as SubTotalAmount}from"./components/SubTotalAmount";export{default as SubmitButton}from"./components/SubmitButton";export{default as TaxesAmount}from"./components/TaxesAmount";export{default as TotalAmount}from"./components/TotalAmount";export{default as VariantSelector}from"./components/VariantSelector";export{default as VariantsContainer}from"./components/VariantsContainer";
@@ -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;}>;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'>;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.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";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?payload.include=[...resourcesIncluded,...typeof newResource=="string"?[newResource]:newResource]:delete payload.include,payload.includeLoaded=Object.assign(Object.assign({},resourceIncludedLoaded),newResourceLoaded),dispatch&&dispatch({type:"setIncludesResource",payload})}export const addToCart=async params=>{const{skuCode,bundleCode,skuId,quantity,option,config,dispatch,lineItem,state,errors=[]}=params;try{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))})}return!isEmpty(errors)&&dispatch&&dispatch({type:"setErrors",payload:{errors:[]}}),{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;
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?payload.include=[...resourcesIncluded,...typeof newResource=="string"?[newResource]:newResource]:delete payload.include,payload.includeLoaded=Object.assign(Object.assign({},resourceIncludedLoaded),newResourceLoaded),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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercelayer/react-components",
3
- "version": "3.10.0",
3
+ "version": "3.11.0",
4
4
  "description": "The Official Commerce Layer React Components",
5
5
  "module": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -1 +0,0 @@
1
- import{QueryParamsList}from'@commercelayer/sdk';import{ReactNode}from'react';declare type Props={skus:string[];children:ReactNode;queryParams?:QueryParamsList;};declare function SkuContainer<P extends Props>(props:P):JSX.Element;declare namespace SkuContainer{var propTypes:{children:import("prop-types").Validator<boolean|import("react").ReactChild|import("react").ReactFragment|import("react").ReactPortal|(()=>ReactNode)>;};}export default SkuContainer;
@@ -1 +0,0 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import components from"../config/components";import CommerceLayerContext from"../context/CommerceLayerContext";import SkuContext from"../context/SkuContext";import skuReducer,{getSku,skuInitialState}from"../reducers/SkuReducer";import{useContext,useEffect,useMemo,useReducer}from"react";export default function SkuContainer(props){const{skus,children,queryParams}=props,[state,dispatch]=useReducer(skuReducer,skuInitialState),config=useContext(CommerceLayerContext),loadSkus=async()=>await getSku({config,dispatch,skus,queryParams});useEffect(()=>(config.accessToken&&(state==null?void 0:state.skus)&&(state==null?void 0:state.skus.length)===0&&loadSkus(),()=>{dispatch({type:"setLoading",payload:{loading:!0}})}),[config,skus]);const contextValue=useMemo(()=>state,[state]);return _jsx(SkuContext.Provider,Object.assign({value:contextValue},{children}))}SkuContainer.propTypes=components.SkuContainer.propTypes;