@commercelayer/react-components 4.0.1 → 4.1.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/lib/cjs/components/Errors.js +1 -1
  2. package/lib/cjs/components/ExternalFunction.d.ts +2 -9
  3. package/lib/cjs/components/ExternalFunction.js +1 -1
  4. package/lib/cjs/components/MetadataInput.d.ts +0 -10
  5. package/lib/cjs/components/MetadataInput.js +1 -1
  6. package/lib/cjs/components/addresses/AddressCountrySelector.d.ts +0 -16
  7. package/lib/cjs/components/addresses/AddressCountrySelector.js +1 -1
  8. package/lib/cjs/components/addresses/AddressStateSelector.d.ts +0 -16
  9. package/lib/cjs/components/addresses/AddressStateSelector.js +1 -1
  10. package/lib/cjs/components/addresses/BillingAddressForm.d.ts +0 -5
  11. package/lib/cjs/components/addresses/BillingAddressForm.js +1 -1
  12. package/lib/cjs/components/addresses/ShippingAddressContainer.d.ts +4 -9
  13. package/lib/cjs/components/addresses/ShippingAddressContainer.js +1 -1
  14. package/lib/cjs/components/addresses/ShippingAddressForm.d.ts +2 -7
  15. package/lib/cjs/components/addresses/ShippingAddressForm.js +1 -1
  16. package/lib/cjs/components/customers/CustomerAddressForm.d.ts +2 -7
  17. package/lib/cjs/components/customers/CustomerAddressForm.js +1 -1
  18. package/lib/cjs/components/customers/CustomerInput.d.ts +1 -13
  19. package/lib/cjs/components/customers/CustomerInput.js +1 -1
  20. package/lib/cjs/components/gift_cards/GiftCard.d.ts +2 -12
  21. package/lib/cjs/components/gift_cards/GiftCard.js +1 -1
  22. package/lib/cjs/components/gift_cards/GiftCardContainer.d.ts +2 -8
  23. package/lib/cjs/components/gift_cards/GiftCardContainer.js +1 -1
  24. package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.d.ts +0 -15
  25. package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.js +1 -1
  26. package/lib/cjs/components/gift_cards/GiftCardInput.d.ts +1 -10
  27. package/lib/cjs/components/gift_cards/GiftCardInput.js +1 -1
  28. package/lib/cjs/components/gift_cards/GiftCardOrCouponForm.d.ts +0 -5
  29. package/lib/cjs/components/gift_cards/GiftCardOrCouponForm.js +1 -1
  30. package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.d.ts +1 -10
  31. package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.js +1 -1
  32. package/lib/cjs/components/line_items/LineItemQuantity.d.ts +1 -1
  33. package/lib/cjs/components/line_items/LineItemsCount.d.ts +1 -1
  34. package/lib/cjs/components/orders/OrderContainer.d.ts +12 -0
  35. package/lib/cjs/components/orders/OrderNumber.d.ts +0 -6
  36. package/lib/cjs/components/orders/OrderNumber.js +1 -1
  37. package/lib/cjs/components/orders/OrderStorage.d.ts +2 -10
  38. package/lib/cjs/components/orders/OrderStorage.js +1 -1
  39. package/lib/cjs/components/shipping_methods/ShippingMethodPrice.d.ts +0 -12
  40. package/lib/cjs/components/shipping_methods/ShippingMethodPrice.js +1 -1
  41. package/lib/cjs/components/shipping_methods/ShippingMethodRadioButton.d.ts +0 -6
  42. package/lib/cjs/components/shipping_methods/ShippingMethodRadioButton.js +1 -1
  43. package/lib/cjs/components/skus/DeliveryLeadTime.d.ts +0 -7
  44. package/lib/cjs/components/skus/DeliveryLeadTime.js +1 -1
  45. package/lib/cjs/components/skus/SkuList.d.ts +5 -9
  46. package/lib/cjs/components/skus/SkuList.js +1 -1
  47. package/lib/cjs/components/skus/SkuListsContainer.d.ts +2 -8
  48. package/lib/cjs/components/skus/SkuListsContainer.js +1 -1
  49. package/lib/cjs/components/skus/Skus.d.ts +2 -7
  50. package/lib/cjs/components/skus/Skus.js +1 -1
  51. package/lib/cjs/components/utils/BaseInput.d.ts +2 -2
  52. package/lib/cjs/components/utils/Parent.d.ts +1 -1
  53. package/lib/cjs/hooks/useOrderContainer.d.ts +6 -0
  54. package/lib/cjs/hooks/useOrderContainer.js +1 -0
  55. package/lib/cjs/reducers/AddressReducer.d.ts +1 -1
  56. package/lib/cjs/reducers/GiftCardReducer.d.ts +11 -21
  57. package/lib/cjs/reducers/GiftCardReducer.js +1 -1
  58. package/lib/cjs/typings/errors.d.ts +2 -2
  59. package/lib/cjs/typings/index.d.ts +2 -2
  60. package/lib/esm/components/Errors.js +1 -1
  61. package/lib/esm/components/ExternalFunction.d.ts +2 -9
  62. package/lib/esm/components/ExternalFunction.js +1 -1
  63. package/lib/esm/components/MetadataInput.d.ts +0 -10
  64. package/lib/esm/components/MetadataInput.js +1 -1
  65. package/lib/esm/components/addresses/AddressCountrySelector.d.ts +0 -16
  66. package/lib/esm/components/addresses/AddressCountrySelector.js +1 -1
  67. package/lib/esm/components/addresses/AddressStateSelector.d.ts +0 -16
  68. package/lib/esm/components/addresses/AddressStateSelector.js +1 -1
  69. package/lib/esm/components/addresses/BillingAddressForm.d.ts +0 -5
  70. package/lib/esm/components/addresses/BillingAddressForm.js +1 -1
  71. package/lib/esm/components/addresses/ShippingAddressContainer.d.ts +4 -9
  72. package/lib/esm/components/addresses/ShippingAddressContainer.js +1 -1
  73. package/lib/esm/components/addresses/ShippingAddressForm.d.ts +2 -7
  74. package/lib/esm/components/addresses/ShippingAddressForm.js +1 -1
  75. package/lib/esm/components/customers/CustomerAddressForm.d.ts +2 -7
  76. package/lib/esm/components/customers/CustomerAddressForm.js +1 -1
  77. package/lib/esm/components/customers/CustomerInput.d.ts +1 -13
  78. package/lib/esm/components/customers/CustomerInput.js +1 -1
  79. package/lib/esm/components/gift_cards/GiftCard.d.ts +2 -12
  80. package/lib/esm/components/gift_cards/GiftCard.js +1 -1
  81. package/lib/esm/components/gift_cards/GiftCardContainer.d.ts +2 -8
  82. package/lib/esm/components/gift_cards/GiftCardContainer.js +1 -1
  83. package/lib/esm/components/gift_cards/GiftCardCurrencySelector.d.ts +0 -15
  84. package/lib/esm/components/gift_cards/GiftCardCurrencySelector.js +1 -1
  85. package/lib/esm/components/gift_cards/GiftCardInput.d.ts +1 -10
  86. package/lib/esm/components/gift_cards/GiftCardInput.js +1 -1
  87. package/lib/esm/components/gift_cards/GiftCardOrCouponForm.d.ts +0 -5
  88. package/lib/esm/components/gift_cards/GiftCardOrCouponForm.js +1 -1
  89. package/lib/esm/components/gift_cards/GiftCardOrCouponInput.d.ts +1 -10
  90. package/lib/esm/components/gift_cards/GiftCardOrCouponInput.js +1 -1
  91. package/lib/esm/components/line_items/LineItemQuantity.d.ts +1 -1
  92. package/lib/esm/components/line_items/LineItemsCount.d.ts +1 -1
  93. package/lib/esm/components/orders/OrderContainer.d.ts +12 -0
  94. package/lib/esm/components/orders/OrderNumber.d.ts +0 -6
  95. package/lib/esm/components/orders/OrderNumber.js +1 -1
  96. package/lib/esm/components/orders/OrderStorage.d.ts +2 -10
  97. package/lib/esm/components/orders/OrderStorage.js +1 -1
  98. package/lib/esm/components/shipping_methods/ShippingMethodPrice.d.ts +0 -12
  99. package/lib/esm/components/shipping_methods/ShippingMethodPrice.js +1 -1
  100. package/lib/esm/components/shipping_methods/ShippingMethodRadioButton.d.ts +0 -6
  101. package/lib/esm/components/shipping_methods/ShippingMethodRadioButton.js +1 -1
  102. package/lib/esm/components/skus/DeliveryLeadTime.d.ts +0 -7
  103. package/lib/esm/components/skus/DeliveryLeadTime.js +1 -1
  104. package/lib/esm/components/skus/SkuList.d.ts +5 -9
  105. package/lib/esm/components/skus/SkuList.js +1 -1
  106. package/lib/esm/components/skus/SkuListsContainer.d.ts +2 -8
  107. package/lib/esm/components/skus/SkuListsContainer.js +1 -1
  108. package/lib/esm/components/skus/Skus.d.ts +2 -7
  109. package/lib/esm/components/skus/Skus.js +1 -1
  110. package/lib/esm/components/utils/BaseInput.d.ts +2 -2
  111. package/lib/esm/components/utils/Parent.d.ts +1 -1
  112. package/lib/esm/hooks/useOrderContainer.d.ts +6 -0
  113. package/lib/esm/hooks/useOrderContainer.js +1 -0
  114. package/lib/esm/reducers/AddressReducer.d.ts +1 -1
  115. package/lib/esm/reducers/GiftCardReducer.d.ts +11 -21
  116. package/lib/esm/reducers/GiftCardReducer.js +1 -1
  117. package/lib/esm/typings/errors.d.ts +2 -2
  118. package/lib/esm/typings/index.d.ts +2 -2
  119. package/lib/tsconfig.prod.esm.tsbuildinfo +1 -1
  120. package/lib/tsconfig.prod.tsbuildinfo +1 -1
  121. package/package.json +23 -66
  122. package/README.md +0 -302
  123. package/lib/cjs/config/components.d.ts +0 -860
  124. package/lib/cjs/config/components.js +0 -1
  125. package/lib/cjs/utils/childrenTypes.d.ts +0 -9
  126. package/lib/cjs/utils/childrenTypes.js +0 -1
  127. package/lib/esm/config/components.d.ts +0 -860
  128. package/lib/esm/config/components.js +0 -1
  129. package/lib/esm/utils/childrenTypes.d.ts +0 -9
  130. package/lib/esm/utils/childrenTypes.js +0 -1
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useState}from"react";import BaseInput from"../utils/BaseInput";import components from"../../config/components";import{useRapidForm}from"rapid-form";import CustomerContext from"../../context/CustomerContext";import isEmpty from"lodash/isEmpty";const propTypes=components.CustomerInput.propTypes,displayName=components.CustomerInput.displayName;export function CustomerInput(props){const{name="customer_email",placeholder="",required=!0,saveOnBlur=!1,type="email",value,onBlur,className,errorClassName,...p}=props,{validation,values,errors}=useRapidForm({fieldEvent:"blur"}),{saveCustomerUser,setCustomerErrors,setCustomerEmail}=useContext(CustomerContext),[hasError,setHasError]=useState(!1),handleOnBlur=async()=>{saveOnBlur&&isEmpty(errors)&&!isEmpty(values)&&(saveCustomerUser&&await saveCustomerUser(values[name].value),onBlur&&onBlur(values[name].value))};useEffect(()=>{if(isEmpty(errors))isEmpty(values)||(setCustomerErrors&&setCustomerErrors([]),setCustomerEmail&&setCustomerEmail(values[name].value),setHasError(!1));else{const formErrors=[];for(const fieldName in errors){const code=errors[fieldName]?.code,message=errors[fieldName]?.message;formErrors.push({code,message:message||"",resource:"orders",field:fieldName})}isEmpty(formErrors)||(setHasError(!0),setCustomerErrors&&setCustomerErrors(formErrors))}return()=>{setHasError(!1)}},[errors]);const classNameComputed=`${className||""} ${hasError&&errorClassName?errorClassName:""}`;return _jsx(BaseInput,{name,type,ref:validation,required,placeholder,defaultValue:value,onBlur:handleOnBlur,className:classNameComputed,...p})}CustomerInput.propTypes=propTypes,CustomerInput.displayName=displayName;export default CustomerInput;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useState}from"react";import BaseInput from"../utils/BaseInput";import{useRapidForm}from"rapid-form";import CustomerContext from"../../context/CustomerContext";export function CustomerInput(props){const{name="customer_email",placeholder="",required=!0,saveOnBlur=!1,type="email",value,onBlur,className,errorClassName,...p}=props,{validation,values,errors}=useRapidForm({fieldEvent:"blur"}),{saveCustomerUser,setCustomerErrors,setCustomerEmail}=useContext(CustomerContext),[hasError,setHasError]=useState(!1),handleOnBlur=async()=>{saveOnBlur&&Object.keys(errors).length===0&&Object.keys(values).length>0&&(saveCustomerUser&&await saveCustomerUser(values[name].value),onBlur&&onBlur(values[name].value))};useEffect(()=>{if(Object.keys(errors).length>0){const formErrors=[];for(const fieldName in errors){const code=errors[fieldName]?.code,message=errors[fieldName]?.message;formErrors.push({code,message:message||"",resource:"orders",field:fieldName})}formErrors.length>0&&(setHasError(!0),setCustomerErrors&&setCustomerErrors(formErrors))}else Object.keys(values).length>0&&(setCustomerErrors&&setCustomerErrors([]),setCustomerEmail&&setCustomerEmail(values[name].value),setHasError(!1));return()=>{setHasError(!1)}},[errors]);const classNameComputed=`${className??""} ${hasError&&errorClassName?errorClassName:""}`;return _jsx(BaseInput,{name,type,ref:validation,required,placeholder,defaultValue:value,onBlur:()=>{handleOnBlur()},className:classNameComputed,...p})}export default CustomerInput;
@@ -1,18 +1,8 @@
1
- import { ReactNode } from 'react';
1
+ /// <reference types="react" />
2
2
  import { BaseState } from '../../typings/index';
3
3
  interface Props extends Omit<JSX.IntrinsicElements['form'], 'children'> {
4
- children: ReactNode;
4
+ children: JSX.Element[] | JSX.Element;
5
5
  onSubmit?: (values: BaseState) => void;
6
6
  }
7
7
  export declare function GiftCard(props: Props): JSX.Element;
8
- export declare namespace GiftCard {
9
- var propTypes: {
10
- children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
11
- onSubmit: import("prop-types").Requireable<(...args: any[]) => any>;
12
- };
13
- var defaultProps: {
14
- onSubmit: undefined;
15
- };
16
- var displayName: string;
17
- }
18
8
  export default GiftCard;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{Fragment,useRef,useContext}from"react";import validateFormFields from"../../utils/validateFormFields";import{isEmpty}from"lodash";import GiftCardContext from"../../context/GiftCardContext";import components from"../../config/components";const propTypes=components.GiftCard.propTypes,defaultProps=components.GiftCard.defaultProps,displayName=components.GiftCard.displayName;export function GiftCard(props){const{children,onSubmit}=props,name="giftCardForm",ref=useRef(null),{addGiftCard,addGiftCardError}=useContext(GiftCardContext);return _jsx(Fragment,{children:_jsx("form",{name,ref,onSubmit:e=>{e.preventDefault();const currentForm=ref.current,elements=currentForm?.elements,{errors,values}=validateFormFields(elements,["currencyCode","balanceCents"],"gift_cards");isEmpty(errors)?(addGiftCard(values),currentForm?.reset(),onSubmit&&onSubmit(values)):addGiftCardError(errors)},children},name)})}GiftCard.propTypes=propTypes,GiftCard.defaultProps=defaultProps,GiftCard.displayName=displayName;export default GiftCard;
1
+ import{jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";import{useRef,useContext}from"react";import validateFormFields from"../../utils/validateFormFields";import{isEmpty}from"lodash";import GiftCardContext from"../../context/GiftCardContext";export function GiftCard(props){const{children,onSubmit}=props,name="giftCardForm",ref=useRef(null),{addGiftCard,addGiftCardError}=useContext(GiftCardContext);return _jsx(_Fragment,{children:_jsx("form",{name,ref,onSubmit:e=>{e.preventDefault();const currentForm=ref.current,elements=currentForm?.elements,{errors,values}=validateFormFields(elements,["currencyCode","balanceCents"],"gift_cards");isEmpty(errors)?(addGiftCard(values),currentForm?.reset(),onSubmit&&onSubmit(values)):addGiftCardError(errors)},children},name)})}export default GiftCard;
@@ -1,12 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
- export declare type Props = {
2
+ export interface Props {
3
3
  children: ReactNode;
4
- };
5
- export declare function GiftCardContainer(props: Props): JSX.Element;
6
- export declare namespace GiftCardContainer {
7
- var propTypes: {
8
- children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
9
- };
10
- var displayName: string;
11
4
  }
5
+ export declare function GiftCardContainer(props: Props): JSX.Element;
12
6
  export default GiftCardContainer;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useReducer,useContext}from"react";import GiftCardContext from"../../context/GiftCardContext";import CommerceLayerContext from"../../context/CommerceLayerContext";import giftCardReducer,{giftCardInitialState,addGiftCardRecipient,addGiftCard,addGiftCardError,addGiftCardLoading}from"../../reducers/GiftCardReducer";import OrderContext from"../../context/OrderContext";import components from"../../config/components";const propTypes=components.GiftCardContainer.propTypes,displayName=components.GiftCardContainer.displayName;export function GiftCardContainer(props){const{children}=props,[state,dispatch]=useReducer(giftCardReducer,giftCardInitialState),config=useContext(CommerceLayerContext),{getOrder,createOrder,order}=useContext(OrderContext),giftCardValue={...state,addGiftCardRecipient:values=>addGiftCardRecipient(values,config,dispatch),addGiftCard:values=>addGiftCard({...values},{config,dispatch,getOrder,createOrder,order}),addGiftCardError:errors=>addGiftCardError(errors,dispatch),addGiftCardLoading:loading=>addGiftCardLoading(loading,dispatch)};return _jsx(GiftCardContext.Provider,{value:giftCardValue,children})}GiftCardContainer.propTypes=propTypes,GiftCardContainer.displayName=displayName;export default GiftCardContainer;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useReducer,useContext}from"react";import GiftCardContext from"../../context/GiftCardContext";import CommerceLayerContext from"../../context/CommerceLayerContext";import giftCardReducer,{giftCardInitialState,addGiftCardRecipient,addGiftCard,addGiftCardError,addGiftCardLoading}from"../../reducers/GiftCardReducer";import OrderContext from"../../context/OrderContext";export function GiftCardContainer(props){const{children}=props,[state,dispatch]=useReducer(giftCardReducer,giftCardInitialState),config=useContext(CommerceLayerContext),{getOrder,createOrder,order}=useContext(OrderContext),giftCardValue={...state,addGiftCardRecipient:async values=>await addGiftCardRecipient(values,config,dispatch),addGiftCard:async values=>await addGiftCard({...values},{config,dispatch,getOrder,createOrder,order}),addGiftCardError:errors=>addGiftCardError(errors,dispatch),addGiftCardLoading:loading=>addGiftCardLoading(loading,dispatch)};return _jsx(GiftCardContext.Provider,{value:giftCardValue,children})}export default GiftCardContainer;
@@ -4,19 +4,4 @@ declare type Props = Omit<BaseSelectComponentProps, 'options' | 'name'> & {
4
4
  required?: boolean;
5
5
  } & Pick<JSX.IntrinsicElements['select'], 'className' | 'id' | 'style'>;
6
6
  export declare function GiftCardCurrencySelector(props: Props): JSX.Element;
7
- export declare namespace GiftCardCurrencySelector {
8
- var propTypes: {
9
- children: import("prop-types").Requireable<(...args: any[]) => any>;
10
- placeholder: import("prop-types").Requireable<import("prop-types").InferProps<{
11
- value: import("prop-types").Validator<NonNullable<NonNullable<string | number | null | undefined>>>;
12
- label: import("prop-types").Validator<string>;
13
- }>>;
14
- value: import("prop-types").Requireable<string>;
15
- required: import("prop-types").Requireable<boolean>;
16
- };
17
- var defaultProps: {
18
- required: boolean;
19
- };
20
- var displayName: string;
21
- }
22
7
  export default GiftCardCurrencySelector;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import BaseSelect from"../utils/BaseSelect";import currencyOptions from"../../config/currency";import components from"../../config/components";const propTypes=components.GiftCardCurrencySelector.propTypes,defaultProps=components.GiftCardCurrencySelector.defaultProps,displayName=components.GiftCardCurrencySelector.displayName;export function GiftCardCurrencySelector(props){return _jsx(BaseSelect,{options:currencyOptions,name:"currencyCode",...props})}GiftCardCurrencySelector.propTypes=propTypes,GiftCardCurrencySelector.defaultProps=defaultProps,GiftCardCurrencySelector.displayName=displayName;export default GiftCardCurrencySelector;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import BaseSelect from"../utils/BaseSelect";import currencyOptions from"../../config/currency";export function GiftCardCurrencySelector(props){return _jsx(BaseSelect,{options:currencyOptions,name:"currencyCode",...props})}export default GiftCardCurrencySelector;
@@ -2,15 +2,6 @@
2
2
  import { BaseInputComponentProps, GiftCardInputName } from '../../typings/index';
3
3
  declare type Props = {
4
4
  name: GiftCardInputName;
5
- } & Omit<BaseInputComponentProps, 'name'> & JSX.IntrinsicElements['input'] & JSX.IntrinsicElements['textarea'];
5
+ } & Omit<BaseInputComponentProps, 'name'> & Omit<JSX.IntrinsicElements['input'], 'children'> & Omit<JSX.IntrinsicElements['textarea'], 'children'>;
6
6
  export declare function GiftCardInput(props: Props): JSX.Element;
7
- export declare namespace GiftCardInput {
8
- var propTypes: {
9
- type: import("prop-types").Validator<NonNullable<import("../../typings/index").BaseInputType>>;
10
- name: import("prop-types").Validator<NonNullable<GiftCardInputName>>;
11
- children: import("prop-types").Requireable<(...args: any[]) => any>;
12
- placeholder: import("prop-types").Requireable<string>;
13
- };
14
- var displayName: string;
15
- }
16
7
  export default GiftCardInput;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import BaseInput from"../utils/BaseInput";import components from"../../config/components";const propTypes=components.GiftCardInput.propTypes,displayName=components.GiftCardInput.displayName;export function GiftCardInput(props){const{placeholder="",...p}=props;return _jsx(BaseInput,{placeholder,...p})}GiftCardInput.propTypes=propTypes,GiftCardInput.displayName=displayName;export default GiftCardInput;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import BaseInput from"../utils/BaseInput";export function GiftCardInput(props){const{placeholder="",...p}=props;return _jsx(BaseInput,{placeholder,...p})}export default GiftCardInput;
@@ -7,9 +7,4 @@ declare type Props = {
7
7
  }) => void;
8
8
  } & Omit<JSX.IntrinsicElements['form'], 'onSubmit'>;
9
9
  export declare function GiftCardOrCouponForm(props: Props): JSX.Element | null;
10
- export declare namespace GiftCardOrCouponForm {
11
- var propTypes: {
12
- children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
13
- };
14
- }
15
10
  export default GiftCardOrCouponForm;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useRapidForm}from"rapid-form";import{useContext,useEffect,useRef,useState}from"react";import CouponAndGiftCardFormContext from"../../context/CouponAndGiftCardFormContext";import OrderContext from"../../context/OrderContext";import isEmpty from"lodash/isEmpty";import components from"../../config/components";import camelCase from"lodash/camelCase";import dropWhile from"lodash/dropWhile";import has from"lodash/has";import{findIndex}from"lodash";const propTypes=components.GiftCardOrCouponForm.propTypes;export function GiftCardOrCouponForm(props){const{children,autoComplete="on",onSubmit,...p}=props,{validation,values,reset}=useRapidForm(),[codeType,setCodeType]=useState("gift_card_or_coupon_code"),{setGiftCardOrCouponCode,order,errors,setOrderErrors}=useContext(OrderContext),ref=useRef(null),inputName="gift_card_or_coupon_code";useEffect(()=>{if(values[inputName]?.value===""&&findIndex(errors,{field:camelCase(inputName)})!==-1){const err=dropWhile(errors,i=>i.field===camelCase(inputName));setOrderErrors(err),onSubmit&&onSubmit({value:values[inputName]?.value,success:!1})}values[inputName]?.value===""&&(setOrderErrors([]),onSubmit&&onSubmit({value:values[inputName]?.value,success:!1}))},[values]),useEffect(()=>{order?.gift_card_code&&!order?.coupon_code&&setCodeType("coupon_code"),!order?.gift_card_code&&order?.coupon_code&&setCodeType("gift_card_code"),!order?.gift_card_code&&!order?.coupon_code&&setCodeType("gift_card_or_coupon_code")},[order]);const handleSubmit=async e=>{e.preventDefault();const code=has(values,inputName)?values[inputName].value:void 0;if(code){const{success}=await setGiftCardOrCouponCode({code,codeType}),value=values[inputName]?.value;onSubmit&&onSubmit({success,value}),success&&reset(e)}};return order?.gift_card_code&&order?.coupon_code||isEmpty(order)?null:_jsx(CouponAndGiftCardFormContext.Provider,{value:{validation,codeType},children:_jsx("form",{ref,autoComplete,onSubmit:handleSubmit,...p,children})})}GiftCardOrCouponForm.propTypes=propTypes;export default GiftCardOrCouponForm;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useRapidForm}from"rapid-form";import{useContext,useEffect,useRef,useState}from"react";import CouponAndGiftCardFormContext from"../../context/CouponAndGiftCardFormContext";import OrderContext from"../../context/OrderContext";import isEmpty from"lodash/isEmpty";import camelCase from"lodash/camelCase";import dropWhile from"lodash/dropWhile";import has from"lodash/has";import{findIndex}from"lodash";export function GiftCardOrCouponForm(props){const{children,autoComplete="on",onSubmit,...p}=props,{validation,values,reset}=useRapidForm(),[codeType,setCodeType]=useState("gift_card_or_coupon_code"),{setGiftCardOrCouponCode,order,errors,setOrderErrors}=useContext(OrderContext),ref=useRef(null),inputName="gift_card_or_coupon_code";useEffect(()=>{if(values[inputName]?.value===""&&findIndex(errors,{field:camelCase(inputName)})!==-1){const err=dropWhile(errors,i=>i.field===camelCase(inputName));setOrderErrors(err),onSubmit&&onSubmit({value:values[inputName]?.value,success:!1})}values[inputName]?.value===""&&(setOrderErrors([]),onSubmit&&onSubmit({value:values[inputName]?.value,success:!1}))},[values]),useEffect(()=>{order?.gift_card_code&&!order?.coupon_code&&setCodeType("coupon_code"),!order?.gift_card_code&&order?.coupon_code&&setCodeType("gift_card_code"),!order?.gift_card_code&&!order?.coupon_code&&setCodeType("gift_card_or_coupon_code")},[order]);const handleSubmit=async e=>{e.preventDefault();const code=has(values,inputName)?values[inputName].value:void 0;if(code){const{success}=await setGiftCardOrCouponCode({code,codeType}),value=values[inputName]?.value;onSubmit&&onSubmit({success,value}),success&&reset(e)}};return order?.gift_card_code&&order?.coupon_code||isEmpty(order)?null:_jsx(CouponAndGiftCardFormContext.Provider,{value:{validation,codeType},children:_jsx("form",{ref,autoComplete,onSubmit:e=>{handleSubmit(e)},...p,children})})}export default GiftCardOrCouponForm;
@@ -5,15 +5,6 @@ declare type Props = {
5
5
  name?: 'gift_card_or_coupon_code';
6
6
  type?: 'text';
7
7
  placeholderTranslation?: (codeType: OrderCodeType) => string;
8
- } & Omit<BaseInputComponentProps, 'name' | 'type'> & JSX.IntrinsicElements['input'] & JSX.IntrinsicElements['textarea'];
8
+ } & Omit<BaseInputComponentProps, 'name' | 'type'> & Omit<JSX.IntrinsicElements['input'], 'children'> & Omit<JSX.IntrinsicElements['textarea'], 'children'>;
9
9
  export declare function GiftCardOrCouponInput(props: Props): JSX.Element;
10
- export declare namespace GiftCardOrCouponInput {
11
- var propTypes: {
12
- children: import("prop-types").Requireable<(...args: any[]) => any>;
13
- placeholder: import("prop-types").Requireable<string>;
14
- disabled: import("prop-types").Requireable<boolean>;
15
- required: import("prop-types").Requireable<boolean>;
16
- };
17
- var displayName: string;
18
- }
19
10
  export default GiftCardOrCouponInput;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import components from"../../config/components";import BaseInput from"../utils/BaseInput";import CouponAndGiftCardFormContext from"../../context/CouponAndGiftCardFormContext";const propTypes=components.GiftCardOrCouponInput.propTypes,displayName=components.GiftCardOrCouponInput.displayName;export function GiftCardOrCouponInput(props){const{placeholder="",required,value,placeholderTranslation,...p}=props,{validation,codeType}=useContext(CouponAndGiftCardFormContext);let placeholderLabel=placeholder;return placeholderTranslation&&codeType&&(placeholderLabel=placeholderTranslation(codeType)),_jsx(BaseInput,{type:"text",name:"gift_card_or_coupon_code",ref:validation,required:required!==void 0?required:!0,placeholder:placeholderLabel,defaultValue:value,...p})}GiftCardOrCouponInput.propTypes=propTypes,GiftCardOrCouponInput.displayName=displayName;export default GiftCardOrCouponInput;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext}from"react";import BaseInput from"../utils/BaseInput";import CouponAndGiftCardFormContext from"../../context/CouponAndGiftCardFormContext";export function GiftCardOrCouponInput(props){const{placeholder="",required,value,placeholderTranslation,...p}=props,{validation,codeType}=useContext(CouponAndGiftCardFormContext);let placeholderLabel=placeholder;return placeholderTranslation&&codeType&&(placeholderLabel=placeholderTranslation(codeType)),_jsx(BaseInput,{type:"text",name:"gift_card_or_coupon_code",ref:validation,required:required!==void 0?required:!0,placeholder:placeholderLabel,defaultValue:value,...p})}export default GiftCardOrCouponInput;
@@ -9,6 +9,6 @@ declare type Props = {
9
9
  max?: number;
10
10
  disabled?: boolean;
11
11
  readonly?: boolean;
12
- } & (Omit<JSX.IntrinsicElements['select'], 'children'> & Omit<JSX.IntrinsicElements['span'], 'children'>);
12
+ } & (JSX.IntrinsicElements['select'] & Omit<JSX.IntrinsicElements['span'], 'children'>);
13
13
  export declare function LineItemQuantity(props: Props): JSX.Element;
14
14
  export default LineItemQuantity;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { TypeAccepted } from '../../utils/getLineItemsCount';
2
+ import { type TypeAccepted } from '../../utils/getLineItemsCount';
3
3
  import { ChildrenFunction } from '../../typings/index';
4
4
  interface ChildrenProps extends Omit<Props, 'children'> {
5
5
  quantity: number;
@@ -3,9 +3,21 @@ import { BaseMetadataObject } from '../../typings/index';
3
3
  import type { OrderCreate, Order } from '@commercelayer/sdk';
4
4
  interface Props {
5
5
  children: JSX.Element[] | JSX.Element;
6
+ /**
7
+ * Metadata to add when creates a new order
8
+ */
6
9
  metadata?: BaseMetadataObject;
10
+ /**
11
+ * Attribute to add when creates/updates an order
12
+ */
7
13
  attributes?: OrderCreate;
14
+ /**
15
+ * ID of the order
16
+ */
8
17
  orderId?: string;
18
+ /**
19
+ * Callback called when the order is updated
20
+ */
9
21
  fetchOrder?: (order: Order) => void;
10
22
  }
11
23
  export declare function OrderContainer(props: Props): JSX.Element;
@@ -2,10 +2,4 @@
2
2
  import { BaseFieldProps } from '../utils/BaseField';
3
3
  declare type Props = Omit<BaseFieldProps, 'attribute'>;
4
4
  export declare function OrderNumber(props: Props): JSX.Element;
5
- export declare namespace OrderNumber {
6
- var propTypes: {
7
- className: import("prop-types").Requireable<string>;
8
- };
9
- var displayName: string;
10
- }
11
5
  export default OrderNumber;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import components from"../../config/components";import BaseField from"../utils/BaseField";const propTypes=components.OrderNumber.propTypes,displayName=components.OrderNumber.displayName;export function OrderNumber(props){return _jsx(BaseField,{attribute:"number",...props})}OrderNumber.propTypes=propTypes,OrderNumber.displayName=displayName;export default OrderNumber;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import BaseField from"../utils/BaseField";export function OrderNumber(props){return _jsx(BaseField,{attribute:"number",...props})}export default OrderNumber;
@@ -1,16 +1,8 @@
1
1
  import { ReactNode } from 'react';
2
- declare type Props = {
2
+ interface Props {
3
3
  children: ReactNode;
4
4
  persistKey: string;
5
5
  clearWhenPlaced?: boolean;
6
- };
7
- export declare function OrderStorage(props: Props): JSX.Element;
8
- export declare namespace OrderStorage {
9
- var propTypes: {
10
- children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
11
- clearWhenPlaced: import("prop-types").Requireable<boolean>;
12
- persistKey: import("prop-types").Validator<string>;
13
- };
14
- var displayName: string;
15
6
  }
7
+ export declare function OrderStorage(props: Props): JSX.Element;
16
8
  export default OrderStorage;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import OrderStorageContext from"../../context/OrderStorageContext";import components from"../../config/components";import{getLocalOrder,setLocalOrder,deleteLocalOrder}from"../../utils/localStorage";const propTypes=components.OrderStorage.propTypes,displayName=components.OrderStorage.displayName;export function OrderStorage(props){const{children,clearWhenPlaced=!0,...p}=props;return _jsx(OrderStorageContext.Provider,{value:{...p,setLocalOrder,getLocalOrder,deleteLocalOrder,clearWhenPlaced},children})}OrderStorage.propTypes=propTypes,OrderStorage.displayName=displayName;export default OrderStorage;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import OrderStorageContext from"../../context/OrderStorageContext";import{getLocalOrder,setLocalOrder,deleteLocalOrder}from"../../utils/localStorage";export function OrderStorage(props){const{children,clearWhenPlaced=!0,...p}=props;return _jsx(OrderStorageContext.Provider,{value:{...p,setLocalOrder,getLocalOrder,deleteLocalOrder,clearWhenPlaced},children})}export default OrderStorage;
@@ -10,16 +10,4 @@ declare type Props = BaseAmountComponent & {
10
10
  base?: 'price';
11
11
  });
12
12
  export declare function ShippingMethodPrice(props: Props): JSX.Element;
13
- export declare namespace ShippingMethodPrice {
14
- var propTypes: {
15
- type: import("prop-types").Requireable<"amount">;
16
- id: import("prop-types").Requireable<string>;
17
- className: import("prop-types").Requireable<string>;
18
- style: import("prop-types").Requireable<object>;
19
- name: import("prop-types").Requireable<string>;
20
- children: import("prop-types").Requireable<(...args: any[]) => any>;
21
- format: import("prop-types").Requireable<import("../../typings/index").BaseFormatPrice>;
22
- };
23
- var displayName: string;
24
- }
25
13
  export default ShippingMethodPrice;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useState,useEffect,useContext}from"react";import getAmount from"../../utils/getAmount";import ShippingMethodChildrenContext from"../../context/ShippingMethodChildrenContext";import Parent from"../utils/Parent";import components from"../../config/components";const propTypes=components.ShippingMethodPrice.propTypes,displayName=components.ShippingMethodPrice.displayName;export function ShippingMethodPrice(props){const{base="price_amount",type="for_shipment",format="formatted",labelFreeOver="Free",...p}=props,{shippingMethod}=useContext(ShippingMethodChildrenContext),[price,setPrice]=useState(""),[priceCents,setPriceCents]=useState(0);useEffect(()=>{if(shippingMethod){const p2=getAmount({base,type,format,obj:shippingMethod});setPrice(p2);const pCents=getAmount({base:"price_amount",type:"for_shipment",format:"cents",obj:shippingMethod});setPriceCents(pCents)}return()=>{setPrice(""),setPriceCents(0)}},[shippingMethod]);const parentProps={price,...p},finalPrice=priceCents===0?labelFreeOver:price;return props.children?_jsx(Parent,{...parentProps,children:props.children}):_jsx("span",{...p,children:finalPrice})}ShippingMethodPrice.propTypes=propTypes,ShippingMethodPrice.displayName=displayName;export default ShippingMethodPrice;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useState,useEffect,useContext}from"react";import getAmount from"../../utils/getAmount";import ShippingMethodChildrenContext from"../../context/ShippingMethodChildrenContext";import Parent from"../utils/Parent";export function ShippingMethodPrice(props){const{base="price_amount",type="for_shipment",format="formatted",labelFreeOver="Free",...p}=props,{shippingMethod}=useContext(ShippingMethodChildrenContext),[price,setPrice]=useState(""),[priceCents,setPriceCents]=useState(0);useEffect(()=>{if(shippingMethod){const p2=getAmount({base,type,format,obj:shippingMethod});setPrice(p2);const pCents=getAmount({base:"price_amount",type:"for_shipment",format:"cents",obj:shippingMethod});setPriceCents(pCents)}return()=>{setPrice(""),setPriceCents(0)}},[shippingMethod]);const parentProps={price,...p},finalPrice=priceCents===0?labelFreeOver:price;return props.children?_jsx(Parent,{...parentProps,children:props.children}):_jsx("span",{...p,children:finalPrice})}export default ShippingMethodPrice;
@@ -10,10 +10,4 @@ declare type Props = {
10
10
  onChange?: ShippingMethodRadioButtonOnChangeType;
11
11
  } & Omit<JSX.IntrinsicElements['input'], 'onChange'>;
12
12
  export declare function ShippingMethodRadioButton(props: Props): JSX.Element;
13
- export declare namespace ShippingMethodRadioButton {
14
- var propTypes: {
15
- children: import("prop-types").Requireable<(...args: any[]) => any>;
16
- };
17
- var displayName: string;
18
- }
19
13
  export default ShippingMethodRadioButton;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useState}from"react";import ShippingMethodChildrenContext from"../../context/ShippingMethodChildrenContext";import Parent from"../utils/Parent";import components from"../../config/components";import ShipmentContext from"../../context/ShipmentContext";const propTypes=components.ShippingMethodRadioButton.propTypes,displayName=components.ShippingMethodRadioButton.displayName;export function ShippingMethodRadioButton(props){const{onChange,...p}=props,[checked,setChecked]=useState(!1),{shippingMethod,currentShippingMethodId,shipmentId}=useContext(ShippingMethodChildrenContext),{setShippingMethod}=useContext(ShipmentContext),shippingMethodId=shippingMethod?.id,name=`shipment-${shipmentId}`,id=`${name}-${shippingMethodId}`;useEffect(()=>(setChecked(shippingMethodId===currentShippingMethodId),()=>{setChecked(!1)}),[currentShippingMethodId]);const handleOnChange=async()=>{shipmentId&&shippingMethodId&&(setChecked(!0),await setShippingMethod(shipmentId,shippingMethodId),shippingMethod&&onChange&&onChange(shippingMethod,shipmentId))},parentProps={shippingMethod,shipmentId,handleOnChange,name,id,...props};return props.children?_jsx(Parent,{...parentProps,children:props.children}):_jsx("input",{type:"radio",name,id,onChange:handleOnChange,checked,...p})}ShippingMethodRadioButton.propTypes=propTypes,ShippingMethodRadioButton.displayName=displayName;export default ShippingMethodRadioButton;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useState}from"react";import ShippingMethodChildrenContext from"../../context/ShippingMethodChildrenContext";import Parent from"../utils/Parent";import ShipmentContext from"../../context/ShipmentContext";export function ShippingMethodRadioButton(props){const{onChange,...p}=props,[checked,setChecked]=useState(!1),{shippingMethod,currentShippingMethodId,shipmentId}=useContext(ShippingMethodChildrenContext),{setShippingMethod}=useContext(ShipmentContext),shippingMethodId=shippingMethod?.id,name=`shipment-${shipmentId??""}`,id=`${name}-${shippingMethodId??""}`;useEffect(()=>(setChecked(shippingMethodId===currentShippingMethodId),()=>{setChecked(!1)}),[currentShippingMethodId]);const handleOnChange=async()=>{shipmentId&&shippingMethodId&&(setChecked(!0),await setShippingMethod(shipmentId,shippingMethodId),shippingMethod&&onChange&&onChange(shippingMethod,shipmentId))},parentProps={shippingMethod,shipmentId,handleOnChange,name,id,...props};return props.children?_jsx(Parent,{...parentProps,children:props.children}):_jsx("input",{type:"radio",name,id,onChange:()=>{handleOnChange()},checked,...p})}export default ShippingMethodRadioButton;
@@ -7,11 +7,4 @@ declare type Props = Partial<JSX.IntrinsicElements['span']> & {
7
7
  text?: string;
8
8
  };
9
9
  export declare function DeliveryLeadTime(props: Props): JSX.Element;
10
- export declare namespace DeliveryLeadTime {
11
- var propTypes: {
12
- type: import("prop-types").Validator<NonNullable<DeliveryLeadTimeField>>;
13
- children: import("prop-types").Requireable<(...args: any[]) => any>;
14
- };
15
- var displayName: string;
16
- }
17
10
  export default DeliveryLeadTime;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useState,useEffect}from"react";import ShippingMethodChildrenContext from"../../context/ShippingMethodChildrenContext";import Parent from"../utils/Parent";import components from"../../config/components";const propTypes=components.DeliveryLeadTime.propTypes,displayName=components.DeliveryLeadTime.displayName;export function DeliveryLeadTime(props){const{type,...p}=props,[text,setText]=useState(),{deliveryLeadTimeForShipment}=useContext(ShippingMethodChildrenContext);useEffect(()=>(deliveryLeadTimeForShipment&&deliveryLeadTimeForShipment[type]&&setText(deliveryLeadTimeForShipment[type]),()=>{setText("")}),[deliveryLeadTimeForShipment]);const parentProps={text,...p};return props.children?_jsx(Parent,{...parentProps,children:props.children}):_jsx("span",{...p,children:text})}DeliveryLeadTime.propTypes=propTypes,DeliveryLeadTime.displayName=displayName;export default DeliveryLeadTime;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useState,useEffect}from"react";import ShippingMethodChildrenContext from"../../context/ShippingMethodChildrenContext";import Parent from"../utils/Parent";export function DeliveryLeadTime(props){const{type,...p}=props,[text,setText]=useState(),{deliveryLeadTimeForShipment}=useContext(ShippingMethodChildrenContext);useEffect(()=>(deliveryLeadTimeForShipment?.[type]&&setText(deliveryLeadTimeForShipment[type]),()=>{setText("")}),[deliveryLeadTimeForShipment]);const parentProps={text,...p};return props.children?_jsx(Parent,{...parentProps,children:props.children}):_jsx("span",{...p,children:text})}export default DeliveryLeadTime;
@@ -1,14 +1,10 @@
1
1
  import { ReactNode } from 'react';
2
- declare type Props = {
2
+ interface Props {
3
3
  children: ReactNode;
4
+ /**
5
+ * ID of the SKU list.
6
+ */
4
7
  id: string;
5
- };
6
- export declare function SkuList(props: Props): JSX.Element;
7
- export declare namespace SkuList {
8
- var propTypes: {
9
- children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
10
- id: import("prop-types").Validator<string>;
11
- };
12
- var displayName: string;
13
8
  }
9
+ export declare function SkuList(props: Props): JSX.Element;
14
10
  export default SkuList;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,Fragment}from"react";import SkuListsContext from"../../context/SkuListsContext";import components from"../../config/components";const propTypes=components.SkuList.propTypes,displayName=components.SkuList.displayName;export function SkuList(props){const{id,children}=props,{listIds}=useContext(SkuListsContext);return useEffect(()=>{listIds&&!listIds.includes(id)&&listIds.push(id)},[]),_jsx(Fragment,{children})}SkuList.propTypes=propTypes,SkuList.displayName=displayName;export default SkuList;
1
+ import{Fragment as _Fragment,jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect}from"react";import SkuListsContext from"../../context/SkuListsContext";export function SkuList(props){const{id,children}=props,{listIds}=useContext(SkuListsContext);return useEffect(()=>{listIds&&!listIds.includes(id)&&listIds.push(id)},[]),_jsx(_Fragment,{children})}export default SkuList;
@@ -1,12 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
- declare type Props = {
2
+ interface Props {
3
3
  children: ReactNode;
4
- };
5
- export declare function SkuListsContainer(props: Props): JSX.Element;
6
- export declare namespace SkuListsContainer {
7
- var propTypes: {
8
- children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
9
- };
10
- var displayName: string;
11
4
  }
5
+ export declare function SkuListsContainer(props: Props): JSX.Element;
12
6
  export default SkuListsContainer;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useReducer,useContext,useEffect}from"react";import SkuListsContext from"../../context/SkuListsContext";import CommerceLayerContext from"../../context/CommerceLayerContext";import skuListsReducer,{skuListsInitialState,getSkuList}from"../../reducers/SkuListsReducer";import components from"../../config/components";const propTypes=components.SkuListsContainer.propTypes,displayName=components.SkuListsContainer.displayName;export function SkuListsContainer(props){const{children}=props,[state,dispatch]=useReducer(skuListsReducer,skuListsInitialState),config=useContext(CommerceLayerContext);return useEffect(()=>{state.listIds&&state.listIds.length>0&&config.accessToken&&getSkuList({listIds:state.listIds,dispatch,config,state})},[config.accessToken]),_jsx(SkuListsContext.Provider,{value:state,children})}SkuListsContainer.propTypes=propTypes,SkuListsContainer.displayName=displayName;export default SkuListsContainer;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useReducer,useContext,useEffect}from"react";import SkuListsContext from"../../context/SkuListsContext";import CommerceLayerContext from"../../context/CommerceLayerContext";import skuListsReducer,{skuListsInitialState,getSkuList}from"../../reducers/SkuListsReducer";export function SkuListsContainer(props){const{children}=props,[state,dispatch]=useReducer(skuListsReducer,skuListsInitialState),config=useContext(CommerceLayerContext);return useEffect(()=>{state.listIds&&state.listIds.length>0&&config.accessToken&&getSkuList({listIds:state.listIds,dispatch,config,state})},[config.accessToken]),_jsx(SkuListsContext.Provider,{value:state,children})}export default SkuListsContainer;
@@ -1,11 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
- declare type Props = {
2
+ interface Props {
3
3
  children: ReactNode;
4
- };
5
- export declare function Skus<P extends Props>({ children }: P): JSX.Element;
6
- export declare namespace Skus {
7
- var propTypes: {
8
- children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
9
- };
10
4
  }
5
+ export declare function Skus<P extends Props>({ children }: P): JSX.Element;
11
6
  export default Skus;
@@ -1 +1 @@
1
- import{jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";import components from"../../config/components";import SkuChildrenContext from"../../context/SkuChildrenContext";import SkuContext from"../../context/SkuContext";import{useContext}from"react";export function Skus({children}){const{skus}=useContext(SkuContext),components2=skus&&skus.map((sku,key)=>{const value={sku};return _jsx(SkuChildrenContext.Provider,{value,children},key)});return _jsx(_Fragment,{children:components2})}Skus.propTypes=components.Skus.propTypes;export default Skus;
1
+ import{jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";import SkuChildrenContext from"../../context/SkuChildrenContext";import SkuContext from"../../context/SkuContext";import{useContext}from"react";export function Skus({children}){const{skus}=useContext(SkuContext),components=skus?.map((sku,key)=>{const value={sku};return _jsx(SkuChildrenContext.Provider,{value,children},key)});return _jsx(_Fragment,{children:components})}export default Skus;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import { BaseInputComponentProps } from '../../typings/index';
3
- export declare type BaseInputProps = BaseInputComponentProps & JSX.IntrinsicElements['input'] & JSX.IntrinsicElements['textarea'];
4
- declare const _default: React.ForwardRefExoticComponent<Pick<BaseInputProps, "children" | "form" | "slot" | "style" | "title" | "pattern" | "resource" | "id" | "value" | "placeholder" | "className" | "required" | "name" | "onChange" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "alt" | "crossOrigin" | "height" | "src" | "width" | "max" | "min" | "type" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "autoComplete" | "accept" | "capture" | "checked" | "enterKeyHint" | "list" | "maxLength" | "minLength" | "multiple" | "readOnly" | "size" | "step" | "cols" | "dirName" | "rows" | "wrap"> & React.RefAttributes<any>>;
3
+ export declare type BaseInputProps = BaseInputComponentProps & Omit<JSX.IntrinsicElements['input'], 'children'> & Omit<JSX.IntrinsicElements['textarea'], 'children'>;
4
+ declare const _default: React.ForwardRefExoticComponent<Pick<BaseInputProps, "children" | "form" | "slot" | "style" | "title" | "pattern" | "resource" | "id" | "value" | "placeholder" | "className" | "required" | "name" | "onChange" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "height" | "max" | "min" | "type" | "width" | "crossOrigin" | "alt" | "src" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "autoComplete" | "accept" | "capture" | "checked" | "enterKeyHint" | "list" | "maxLength" | "minLength" | "multiple" | "readOnly" | "size" | "step" | "cols" | "dirName" | "rows" | "wrap"> & React.RefAttributes<any>>;
5
5
  export default _default;
@@ -1,6 +1,6 @@
1
1
  import { Component, ForwardedRef } from 'react';
2
2
  export interface ParentProps {
3
3
  parentRef?: ForwardedRef<any>;
4
- children?: typeof Component | ((P: any) => JSX.Element);
4
+ children?: typeof Component | ((P: any) => JSX.Element | null);
5
5
  }
6
6
  export default function Parent({ children, ...p }: ParentProps): JSX.Element | null;
@@ -0,0 +1,6 @@
1
+ import { type Order } from '@commercelayer/sdk';
2
+ export declare function useOrderContainer(): {
3
+ order?: Order;
4
+ reloadOrder: () => Promise<Order | undefined>;
5
+ };
6
+ export default useOrderContainer;
@@ -0,0 +1 @@
1
+ import OrderContext from"../context/OrderContext";import{useContext}from"react";export function useOrderContainer(){const ctx=useContext(OrderContext);if("order"in ctx)return{order:ctx.order,reloadOrder:async()=>{if(ctx?.order?.id)return await ctx?.getOrder(ctx?.order?.id)}};throw new Error("Cannot use `useOrderContainer` outside of <OrderContainer/>")}export default useOrderContainer;
@@ -9,7 +9,7 @@ export declare type AddressField = 'city' | 'company' | 'country_code' | 'first_
9
9
  export declare type AddressFieldView = AddressField | 'full_address' | 'full_name';
10
10
  export declare const addressFields: AddressField[];
11
11
  export declare type AddressResource = Extract<ResourceErrorType, 'billing_address' | 'shipping_address'>;
12
- export declare type AddressSchema = Address;
12
+ export declare type AddressSchema = Omit<Address, 'created_at' | 'updated_at' | 'id' | 'type'>;
13
13
  export interface AddressActionPayload {
14
14
  errors: BaseError[];
15
15
  billing_address: TCustomerAddress;
@@ -3,7 +3,7 @@ import { BaseMetadata } from '../typings/index';
3
3
  import { Dispatch } from 'react';
4
4
  import { CommerceLayerConfig } from '../context/CommerceLayerContext';
5
5
  import { BaseError } from '../typings/errors';
6
- import { CreateOrder } from './OrderReducer';
6
+ import { CreateOrder, getOrderContext } from './OrderReducer';
7
7
  export declare type GiftCardActionType = 'setAvailability' | 'setGiftCardRecipient' | 'setGiftCardErrors' | 'setGiftCardLoading';
8
8
  export interface GiftCardRecipientI {
9
9
  email: string;
@@ -50,27 +50,17 @@ export interface GiftCardAction {
50
50
  payload: GiftCardActionPayload;
51
51
  }
52
52
  export declare const giftCardInitialState: GiftCardState;
53
- export interface AddGiftCardRecipient {
54
- <V extends GiftCardRecipientCreate>(values: V, config: CommerceLayerConfig, dispatch: Dispatch<GiftCardAction>): void;
55
- }
56
- export interface AddGiftCard {
57
- <V extends GiftCardI>(values: V, configParameters: {
58
- getOrder?: (id: string) => void;
59
- createOrder?: CreateOrder;
60
- config: CommerceLayerConfig;
61
- dispatch: Dispatch<GiftCardAction>;
62
- order?: Order;
63
- }): void;
64
- }
65
- export interface AddGiftCardError {
66
- <V extends BaseError[]>(errors: V, dispatch: Dispatch<GiftCardAction>): void;
67
- }
68
- export interface AddGiftCardLoading {
69
- <V extends boolean>(loading: V, dispatch: Dispatch<GiftCardAction>): void;
70
- }
71
- export declare const addGiftCardRecipient: AddGiftCardRecipient;
53
+ export declare type AddGiftCardError = <V extends BaseError[]>(errors: V, dispatch: Dispatch<GiftCardAction>) => void;
54
+ export declare type AddGiftCardLoading = <V extends boolean>(loading: V, dispatch: Dispatch<GiftCardAction>) => void;
55
+ export declare function addGiftCardRecipient<V extends GiftCardRecipientCreate>(values: V, config: CommerceLayerConfig, dispatch: Dispatch<GiftCardAction>): Promise<void>;
72
56
  export declare const addGiftCardLoading: AddGiftCardLoading;
73
- export declare const addGiftCard: AddGiftCard;
57
+ export declare function addGiftCard<V extends GiftCardI>(values: V, { config, dispatch, getOrder, createOrder, order }: {
58
+ getOrder?: getOrderContext;
59
+ createOrder?: CreateOrder;
60
+ config: CommerceLayerConfig;
61
+ dispatch: Dispatch<GiftCardAction>;
62
+ order?: Order;
63
+ }): Promise<void>;
74
64
  export declare const addGiftCardError: AddGiftCardError;
75
65
  declare const giftCardReducer: (state: GiftCardState, reducer: GiftCardAction) => GiftCardState;
76
66
  export default giftCardReducer;
@@ -1 +1 @@
1
- import baseReducer from"../utils/baseReducer";import{isEmpty}from"lodash";import getErrors from"../utils/getErrors";import getSdk from"../utils/getSdk";export const giftCardInitialState={currencyCode:"",balanceCent:0,singleUse:!1,rechargeable:!0,loading:!1,expiresAt:null,errors:[]},addGiftCardRecipient=async(values,config,dispatch)=>{try{const recipient=await getSdk(config).gift_card_recipients.create(values);dispatch({type:"setGiftCardRecipient",payload:{giftCardRecipient:recipient}})}catch(error){console.error(error)}},addGiftCardLoading=(loading,dispatch)=>{dispatch({type:"setGiftCardLoading",payload:{loading}})},addGiftCard=async(values,{config,dispatch,getOrder,createOrder,order})=>{try{const sdk=getSdk(config);addGiftCardLoading(!0,dispatch);const{firstName,lastName,email,...val}=values,giftCardValue={recipient_email:email,...val},giftCard=await sdk.gift_cards.create(giftCardValue,{include:["gift_card_recipient"]}),recipientValues={id:giftCard.gift_card_recipient?.id};if(firstName&&(recipientValues.first_name=firstName),lastName&&(recipientValues.last_name=lastName),isEmpty(recipientValues)||await sdk.gift_card_recipients.update(recipientValues),createOrder&&getOrder){const id=order?order.id:await createOrder();if(id){const order2=sdk.orders.relationship(id),item=sdk.gift_cards.relationship(giftCard.id);await sdk.line_items.create({quantity:1,order:order2,item}),getOrder&&await getOrder(id)}}dispatch({type:"setGiftCardRecipient",payload:{...giftCardValue}}),addGiftCardLoading(!1,dispatch)}catch(error){const errors=getErrors(error,"gift_cards");dispatch({type:"setGiftCardErrors",payload:{errors}}),addGiftCardLoading(!1,dispatch)}},addGiftCardError=(errors,dispatch)=>{dispatch({type:"setGiftCardErrors",payload:{errors}})};const type=["setAvailability","setGiftCardRecipient","setGiftCardErrors","setGiftCardLoading"],giftCardReducer=(state,reducer)=>baseReducer(state,reducer,type);export default giftCardReducer;
1
+ import baseReducer from"../utils/baseReducer";import{isEmpty}from"lodash";import getErrors from"../utils/getErrors";import getSdk from"../utils/getSdk";export const giftCardInitialState={currencyCode:"",balanceCent:0,singleUse:!1,rechargeable:!0,loading:!1,expiresAt:null,errors:[]};export async function addGiftCardRecipient(values,config,dispatch){try{const recipient=await getSdk(config).gift_card_recipients.create(values);dispatch({type:"setGiftCardRecipient",payload:{giftCardRecipient:recipient}})}catch(error){console.error(error)}}export const addGiftCardLoading=(loading,dispatch)=>{dispatch({type:"setGiftCardLoading",payload:{loading}})};export async function addGiftCard(values,{config,dispatch,getOrder,createOrder,order}){try{const sdk=getSdk(config);addGiftCardLoading(!0,dispatch);const{firstName,lastName,email,...val}=values,giftCardValue={recipient_email:email,...val},giftCard=await sdk.gift_cards.create(giftCardValue,{include:["gift_card_recipient"]}),recipientValues={id:giftCard.gift_card_recipient?.id};if(firstName&&(recipientValues.first_name=firstName),lastName&&(recipientValues.last_name=lastName),isEmpty(recipientValues)||await sdk.gift_card_recipients.update(recipientValues),createOrder&&getOrder){const id=order?order.id:await createOrder();if(id){const order2=sdk.orders.relationship(id),item=sdk.gift_cards.relationship(giftCard.id);await sdk.line_items.create({quantity:1,order:order2,item}),await getOrder(id)}}dispatch({type:"setGiftCardRecipient",payload:{...giftCardValue}}),addGiftCardLoading(!1,dispatch)}catch(error){const errors=getErrors(error,"gift_cards");dispatch({type:"setGiftCardErrors",payload:{errors}}),addGiftCardLoading(!1,dispatch)}}export const addGiftCardError=(errors,dispatch)=>{dispatch({type:"setGiftCardErrors",payload:{errors}})};const type=["setAvailability","setGiftCardRecipient","setGiftCardErrors","setGiftCardLoading"],giftCardReducer=(state,reducer)=>baseReducer(state,reducer,type);export default giftCardReducer;
@@ -29,12 +29,12 @@ declare type ErrorChildrenComponentProps = ChildrenFunction<Omit<ErrorComponentP
29
29
  }>;
30
30
  export interface ErrorComponentProps {
31
31
  /**
32
- * Resource which caused the error
32
+ * Resource which get the error
33
33
  */
34
34
  resource: ResourceErrorType;
35
35
  children?: ErrorChildrenComponentProps;
36
36
  /**
37
- * Field which caused the error
37
+ * Field which get the error
38
38
  */
39
39
  field?: string;
40
40
  /**
@@ -116,13 +116,13 @@ export interface BaseAmountComponent extends Omit<JSX.IntrinsicElements['span'],
116
116
  priceCents?: number;
117
117
  labelFree?: string;
118
118
  }
119
- export declare type ChildrenFunction<P = Record<string, any>> = (props: P) => JSX.Element;
119
+ export declare type ChildrenFunction<P = Record<string, any>> = (props: P) => JSX.Element | null;
120
120
  export declare type ExcludeTag<T extends keyof JSX.IntrinsicElements> = Exclude<keyof JSX.IntrinsicElements, T>;
121
121
  export declare type ExtractTag<T extends keyof JSX.IntrinsicElements> = Extract<keyof JSX.IntrinsicElements, T>;
122
122
  export declare type ConditionalElement<E> = ({
123
123
  attribute: Extract<keyof E, 'image_url'>;
124
124
  tagElement: ExtractTag<'img'>;
125
- } & Omit<JSX.IntrinsicElements['img'], 'children'>) | ({
125
+ } & JSX.IntrinsicElements['img']) | ({
126
126
  attribute: Exclude<keyof E, 'image_url'>;
127
127
  tagElement: ExcludeTag<'img'>;
128
128
  } & Omit<JSX.IntrinsicElements[ExcludeTag<'img'>], 'children'>);