@commercelayer/react-components 4.0.0 → 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 (156) hide show
  1. package/lib/cjs/components/Errors.d.ts +1 -1
  2. package/lib/cjs/components/Errors.js +1 -1
  3. package/lib/cjs/components/ExternalFunction.d.ts +2 -9
  4. package/lib/cjs/components/ExternalFunction.js +1 -1
  5. package/lib/cjs/components/MetadataInput.d.ts +0 -10
  6. package/lib/cjs/components/MetadataInput.js +1 -1
  7. package/lib/cjs/components/addresses/AddressCountrySelector.d.ts +0 -16
  8. package/lib/cjs/components/addresses/AddressCountrySelector.js +1 -1
  9. package/lib/cjs/components/addresses/AddressStateSelector.d.ts +0 -16
  10. package/lib/cjs/components/addresses/AddressStateSelector.js +1 -1
  11. package/lib/cjs/components/addresses/BillingAddressForm.d.ts +0 -5
  12. package/lib/cjs/components/addresses/BillingAddressForm.js +1 -1
  13. package/lib/cjs/components/addresses/SaveAddressesButton.d.ts +2 -2
  14. package/lib/cjs/components/addresses/ShippingAddressContainer.d.ts +4 -9
  15. package/lib/cjs/components/addresses/ShippingAddressContainer.js +1 -1
  16. package/lib/cjs/components/addresses/ShippingAddressForm.d.ts +2 -7
  17. package/lib/cjs/components/addresses/ShippingAddressForm.js +1 -1
  18. package/lib/cjs/components/customers/CustomerAddressForm.d.ts +2 -7
  19. package/lib/cjs/components/customers/CustomerAddressForm.js +1 -1
  20. package/lib/cjs/components/customers/CustomerInput.d.ts +1 -13
  21. package/lib/cjs/components/customers/CustomerInput.js +1 -1
  22. package/lib/cjs/components/gift_cards/GiftCard.d.ts +4 -14
  23. package/lib/cjs/components/gift_cards/GiftCard.js +1 -1
  24. package/lib/cjs/components/gift_cards/GiftCardContainer.d.ts +2 -8
  25. package/lib/cjs/components/gift_cards/GiftCardContainer.js +1 -1
  26. package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.d.ts +0 -15
  27. package/lib/cjs/components/gift_cards/GiftCardCurrencySelector.js +1 -1
  28. package/lib/cjs/components/gift_cards/GiftCardInput.d.ts +1 -10
  29. package/lib/cjs/components/gift_cards/GiftCardInput.js +1 -1
  30. package/lib/cjs/components/gift_cards/GiftCardOrCouponForm.d.ts +0 -5
  31. package/lib/cjs/components/gift_cards/GiftCardOrCouponForm.js +1 -1
  32. package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.d.ts +1 -10
  33. package/lib/cjs/components/gift_cards/GiftCardOrCouponInput.js +1 -1
  34. package/lib/cjs/components/line_items/LineItemQuantity.d.ts +1 -1
  35. package/lib/cjs/components/line_items/LineItemsCount.d.ts +3 -3
  36. package/lib/cjs/components/orders/CheckoutLink.d.ts +2 -2
  37. package/lib/cjs/components/orders/OrderContainer.d.ts +12 -0
  38. package/lib/cjs/components/orders/OrderList.d.ts +1 -1
  39. package/lib/cjs/components/orders/OrderNumber.d.ts +0 -6
  40. package/lib/cjs/components/orders/OrderNumber.js +1 -1
  41. package/lib/cjs/components/orders/OrderStorage.d.ts +2 -10
  42. package/lib/cjs/components/orders/OrderStorage.js +1 -1
  43. package/lib/cjs/components/orders/PlaceOrderButton.d.ts +2 -2
  44. package/lib/cjs/components/payment_source/PaymentSource.d.ts +4 -4
  45. package/lib/cjs/components/payment_source/PaymentSourceBrandIcon.d.ts +2 -2
  46. package/lib/cjs/components/payment_source/PaymentSourceBrandName.d.ts +2 -2
  47. package/lib/cjs/components/shipments/ShipmentField.d.ts +2 -2
  48. package/lib/cjs/components/shipping_methods/ShippingMethodName.d.ts +2 -2
  49. package/lib/cjs/components/shipping_methods/ShippingMethodPrice.d.ts +0 -12
  50. package/lib/cjs/components/shipping_methods/ShippingMethodPrice.js +1 -1
  51. package/lib/cjs/components/shipping_methods/ShippingMethodRadioButton.d.ts +0 -6
  52. package/lib/cjs/components/shipping_methods/ShippingMethodRadioButton.js +1 -1
  53. package/lib/cjs/components/skus/DeliveryLeadTime.d.ts +0 -7
  54. package/lib/cjs/components/skus/DeliveryLeadTime.js +1 -1
  55. package/lib/cjs/components/skus/SkuList.d.ts +5 -9
  56. package/lib/cjs/components/skus/SkuList.js +1 -1
  57. package/lib/cjs/components/skus/SkuListsContainer.d.ts +2 -8
  58. package/lib/cjs/components/skus/SkuListsContainer.js +1 -1
  59. package/lib/cjs/components/skus/Skus.d.ts +2 -7
  60. package/lib/cjs/components/skus/Skus.js +1 -1
  61. package/lib/cjs/components/stock_transfers/StockTransfer.d.ts +4 -10
  62. package/lib/cjs/components/stock_transfers/StockTransfer.js +1 -1
  63. package/lib/cjs/components/utils/BaseField.d.ts +2 -2
  64. package/lib/cjs/components/utils/BaseInput.d.ts +2 -2
  65. package/lib/cjs/components/utils/Parent.d.ts +1 -1
  66. package/lib/cjs/hooks/useOrderContainer.d.ts +6 -0
  67. package/lib/cjs/hooks/useOrderContainer.js +1 -0
  68. package/lib/cjs/reducers/AddressReducer.d.ts +1 -1
  69. package/lib/cjs/reducers/GiftCardReducer.d.ts +11 -21
  70. package/lib/cjs/reducers/GiftCardReducer.js +1 -1
  71. package/lib/cjs/typings/errors.d.ts +2 -2
  72. package/lib/cjs/typings/index.d.ts +2 -2
  73. package/lib/esm/components/Errors.d.ts +1 -1
  74. package/lib/esm/components/Errors.js +1 -1
  75. package/lib/esm/components/ExternalFunction.d.ts +2 -9
  76. package/lib/esm/components/ExternalFunction.js +1 -1
  77. package/lib/esm/components/MetadataInput.d.ts +0 -10
  78. package/lib/esm/components/MetadataInput.js +1 -1
  79. package/lib/esm/components/addresses/AddressCountrySelector.d.ts +0 -16
  80. package/lib/esm/components/addresses/AddressCountrySelector.js +1 -1
  81. package/lib/esm/components/addresses/AddressStateSelector.d.ts +0 -16
  82. package/lib/esm/components/addresses/AddressStateSelector.js +1 -1
  83. package/lib/esm/components/addresses/BillingAddressForm.d.ts +0 -5
  84. package/lib/esm/components/addresses/BillingAddressForm.js +1 -1
  85. package/lib/esm/components/addresses/SaveAddressesButton.d.ts +2 -2
  86. package/lib/esm/components/addresses/ShippingAddressContainer.d.ts +4 -9
  87. package/lib/esm/components/addresses/ShippingAddressContainer.js +1 -1
  88. package/lib/esm/components/addresses/ShippingAddressForm.d.ts +2 -7
  89. package/lib/esm/components/addresses/ShippingAddressForm.js +1 -1
  90. package/lib/esm/components/customers/CustomerAddressForm.d.ts +2 -7
  91. package/lib/esm/components/customers/CustomerAddressForm.js +1 -1
  92. package/lib/esm/components/customers/CustomerInput.d.ts +1 -13
  93. package/lib/esm/components/customers/CustomerInput.js +1 -1
  94. package/lib/esm/components/gift_cards/GiftCard.d.ts +4 -14
  95. package/lib/esm/components/gift_cards/GiftCard.js +1 -1
  96. package/lib/esm/components/gift_cards/GiftCardContainer.d.ts +2 -8
  97. package/lib/esm/components/gift_cards/GiftCardContainer.js +1 -1
  98. package/lib/esm/components/gift_cards/GiftCardCurrencySelector.d.ts +0 -15
  99. package/lib/esm/components/gift_cards/GiftCardCurrencySelector.js +1 -1
  100. package/lib/esm/components/gift_cards/GiftCardInput.d.ts +1 -10
  101. package/lib/esm/components/gift_cards/GiftCardInput.js +1 -1
  102. package/lib/esm/components/gift_cards/GiftCardOrCouponForm.d.ts +0 -5
  103. package/lib/esm/components/gift_cards/GiftCardOrCouponForm.js +1 -1
  104. package/lib/esm/components/gift_cards/GiftCardOrCouponInput.d.ts +1 -10
  105. package/lib/esm/components/gift_cards/GiftCardOrCouponInput.js +1 -1
  106. package/lib/esm/components/line_items/LineItemQuantity.d.ts +1 -1
  107. package/lib/esm/components/line_items/LineItemsCount.d.ts +3 -3
  108. package/lib/esm/components/orders/CheckoutLink.d.ts +2 -2
  109. package/lib/esm/components/orders/OrderContainer.d.ts +12 -0
  110. package/lib/esm/components/orders/OrderList.d.ts +1 -1
  111. package/lib/esm/components/orders/OrderNumber.d.ts +0 -6
  112. package/lib/esm/components/orders/OrderNumber.js +1 -1
  113. package/lib/esm/components/orders/OrderStorage.d.ts +2 -10
  114. package/lib/esm/components/orders/OrderStorage.js +1 -1
  115. package/lib/esm/components/orders/PlaceOrderButton.d.ts +2 -2
  116. package/lib/esm/components/payment_source/PaymentSource.d.ts +4 -4
  117. package/lib/esm/components/payment_source/PaymentSourceBrandIcon.d.ts +2 -2
  118. package/lib/esm/components/payment_source/PaymentSourceBrandName.d.ts +2 -2
  119. package/lib/esm/components/shipments/ShipmentField.d.ts +2 -2
  120. package/lib/esm/components/shipping_methods/ShippingMethodName.d.ts +2 -2
  121. package/lib/esm/components/shipping_methods/ShippingMethodPrice.d.ts +0 -12
  122. package/lib/esm/components/shipping_methods/ShippingMethodPrice.js +1 -1
  123. package/lib/esm/components/shipping_methods/ShippingMethodRadioButton.d.ts +0 -6
  124. package/lib/esm/components/shipping_methods/ShippingMethodRadioButton.js +1 -1
  125. package/lib/esm/components/skus/DeliveryLeadTime.d.ts +0 -7
  126. package/lib/esm/components/skus/DeliveryLeadTime.js +1 -1
  127. package/lib/esm/components/skus/SkuList.d.ts +5 -9
  128. package/lib/esm/components/skus/SkuList.js +1 -1
  129. package/lib/esm/components/skus/SkuListsContainer.d.ts +2 -8
  130. package/lib/esm/components/skus/SkuListsContainer.js +1 -1
  131. package/lib/esm/components/skus/Skus.d.ts +2 -7
  132. package/lib/esm/components/skus/Skus.js +1 -1
  133. package/lib/esm/components/stock_transfers/StockTransfer.d.ts +4 -10
  134. package/lib/esm/components/stock_transfers/StockTransfer.js +1 -1
  135. package/lib/esm/components/utils/BaseField.d.ts +2 -2
  136. package/lib/esm/components/utils/BaseInput.d.ts +2 -2
  137. package/lib/esm/components/utils/Parent.d.ts +1 -1
  138. package/lib/esm/hooks/useOrderContainer.d.ts +6 -0
  139. package/lib/esm/hooks/useOrderContainer.js +1 -0
  140. package/lib/esm/reducers/AddressReducer.d.ts +1 -1
  141. package/lib/esm/reducers/GiftCardReducer.d.ts +11 -21
  142. package/lib/esm/reducers/GiftCardReducer.js +1 -1
  143. package/lib/esm/typings/errors.d.ts +2 -2
  144. package/lib/esm/typings/index.d.ts +2 -2
  145. package/lib/tsconfig.prod.esm.tsbuildinfo +1 -1
  146. package/lib/tsconfig.prod.tsbuildinfo +1 -1
  147. package/package.json +23 -66
  148. package/README.md +0 -338
  149. package/lib/cjs/config/components.d.ts +0 -934
  150. package/lib/cjs/config/components.js +0 -1
  151. package/lib/cjs/utils/childrenTypes.d.ts +0 -9
  152. package/lib/cjs/utils/childrenTypes.js +0 -1
  153. package/lib/esm/config/components.d.ts +0 -934
  154. package/lib/esm/config/components.js +0 -1
  155. package/lib/esm/utils/childrenTypes.d.ts +0 -9
  156. package/lib/esm/utils/childrenTypes.js +0 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OrderNumber=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),components_1=tslib_1.__importDefault(require("../../config/components")),BaseField_1=tslib_1.__importDefault(require("../utils/BaseField")),propTypes=components_1.default.OrderNumber.propTypes,displayName=components_1.default.OrderNumber.displayName;function OrderNumber(props){return(0,jsx_runtime_1.jsx)(BaseField_1.default,{attribute:"number",...props})}exports.OrderNumber=OrderNumber,OrderNumber.propTypes=propTypes,OrderNumber.displayName=displayName,exports.default=OrderNumber;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OrderNumber=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),BaseField_1=tslib_1.__importDefault(require("../utils/BaseField"));function OrderNumber(props){return(0,jsx_runtime_1.jsx)(BaseField_1.default,{attribute:"number",...props})}exports.OrderNumber=OrderNumber,exports.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
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OrderStorage=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),OrderStorageContext_1=tslib_1.__importDefault(require("../../context/OrderStorageContext")),components_1=tslib_1.__importDefault(require("../../config/components")),localStorage_1=require("../../utils/localStorage"),propTypes=components_1.default.OrderStorage.propTypes,displayName=components_1.default.OrderStorage.displayName;function OrderStorage(props){const{children,clearWhenPlaced=!0,...p}=props;return(0,jsx_runtime_1.jsx)(OrderStorageContext_1.default.Provider,{value:{...p,setLocalOrder:localStorage_1.setLocalOrder,getLocalOrder:localStorage_1.getLocalOrder,deleteLocalOrder:localStorage_1.deleteLocalOrder,clearWhenPlaced},children})}exports.OrderStorage=OrderStorage,OrderStorage.propTypes=propTypes,OrderStorage.displayName=displayName,exports.default=OrderStorage;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OrderStorage=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),OrderStorageContext_1=tslib_1.__importDefault(require("../../context/OrderStorageContext")),localStorage_1=require("../../utils/localStorage");function OrderStorage(props){const{children,clearWhenPlaced=!0,...p}=props;return(0,jsx_runtime_1.jsx)(OrderStorageContext_1.default.Provider,{value:{...p,setLocalOrder:localStorage_1.setLocalOrder,getLocalOrder:localStorage_1.getLocalOrder,deleteLocalOrder:localStorage_1.deleteLocalOrder,clearWhenPlaced},children})}exports.OrderStorage=OrderStorage,exports.default=OrderStorage;
@@ -3,12 +3,12 @@ import { ChildrenFunction } from '../../typings/index';
3
3
  interface ChildrenProps extends Omit<Props, 'children'> {
4
4
  handleClick: () => Promise<void>;
5
5
  }
6
- declare type Props = {
6
+ interface Props extends Omit<JSX.IntrinsicElements['button'], 'children' | 'onClick'> {
7
7
  children?: ChildrenFunction<ChildrenProps>;
8
8
  label?: string | ReactNode;
9
9
  onClick?: (response: {
10
10
  placed: boolean;
11
11
  }) => void;
12
- } & JSX.IntrinsicElements['button'];
12
+ }
13
13
  export declare function PlaceOrderButton(props: Props): JSX.Element;
14
14
  export default PlaceOrderButton;
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ /// <reference types="react" />
2
2
  import { LoaderType } from '../../typings/index';
3
3
  import { CustomerCardsTemplateChildren } from '../utils/PaymentCardsTemplate';
4
4
  export interface CustomerCardsProps {
@@ -7,13 +7,13 @@ export interface CustomerCardsProps {
7
7
  export interface CustomerSaveToWalletProps {
8
8
  name: 'save_payment_source_to_customer_wallet';
9
9
  }
10
- export declare type PaymentSourceProps = {
11
- children?: ReactNode;
10
+ export interface PaymentSourceProps extends Omit<JSX.IntrinsicElements['div'], 'children'> {
11
+ children?: JSX.Element | JSX.Element[];
12
12
  readonly?: boolean;
13
13
  templateCustomerCards?: CustomerCardsTemplateChildren;
14
14
  onClickCustomerCards?: () => void;
15
15
  templateCustomerSaveToWallet?: (props: CustomerSaveToWalletProps) => JSX.Element;
16
16
  loader?: LoaderType;
17
- } & JSX.IntrinsicElements['div'];
17
+ }
18
18
  export declare function PaymentSource(props: PaymentSourceProps): JSX.Element;
19
19
  export default PaymentSource;
@@ -6,10 +6,10 @@ interface ChildrenProps extends Omit<Props, 'children'> {
6
6
  defaultSrc: string;
7
7
  url: string;
8
8
  }
9
- declare type Props = {
9
+ interface Props extends Omit<JSX.IntrinsicElements['img'], 'children'> {
10
10
  children?: ChildrenFunction<ChildrenProps>;
11
11
  width?: number;
12
12
  height?: number;
13
- } & JSX.IntrinsicElements['img'];
13
+ }
14
14
  export declare function PaymentSourceBrandIcon({ src, width, children, ...p }: Props): JSX.Element;
15
15
  export default PaymentSourceBrandIcon;
@@ -4,9 +4,9 @@ import { ChildrenFunction } from '../../typings/index';
4
4
  interface CustomComponent extends Omit<Props, 'children'> {
5
5
  brand: IconBrand;
6
6
  }
7
- declare type Props = {
7
+ interface Props extends Omit<JSX.IntrinsicElements['span'], 'children'> {
8
8
  children?: ChildrenFunction<CustomComponent>;
9
9
  label?: string;
10
- } & JSX.IntrinsicElements['span'];
10
+ }
11
11
  export declare function PaymentSourceBrandName({ children, label, ...props }: Props): JSX.Element;
12
12
  export default PaymentSourceBrandName;
@@ -4,9 +4,9 @@ declare type ShipmentFieldChildrenProps = Omit<Props, 'children'> & {
4
4
  shipment: Shipment;
5
5
  };
6
6
  export declare type ShipmentAttribute = 'number' | 'currency_code' | 'status' | 'cost_amount_cents' | 'cost_amount_float' | 'formatted_cost_amount' | 'key_number';
7
- declare type Props = {
7
+ interface Props extends Omit<JSX.IntrinsicElements['span'], 'children'> {
8
8
  children?: (props: ShipmentFieldChildrenProps) => JSX.Element;
9
9
  name: ShipmentAttribute;
10
- } & JSX.IntrinsicElements['span'];
10
+ }
11
11
  export declare function ShipmentField(props: Props): JSX.Element;
12
12
  export default ShipmentField;
@@ -4,8 +4,8 @@ declare type ChildrenProps = Omit<Props, 'children'> & {
4
4
  label: string;
5
5
  shippingMethod: ShippingMethod;
6
6
  };
7
- declare type Props = {
7
+ interface Props extends Omit<JSX.IntrinsicElements['label'], 'children'> {
8
8
  children?: (props: ChildrenProps) => JSX.Element;
9
- } & JSX.IntrinsicElements['label'];
9
+ }
10
10
  export declare function ShippingMethodName(props: Props): JSX.Element;
11
11
  export default ShippingMethodName;
@@ -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
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShippingMethodPrice=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),getAmount_1=tslib_1.__importDefault(require("../../utils/getAmount")),ShippingMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/ShippingMethodChildrenContext")),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),components_1=tslib_1.__importDefault(require("../../config/components")),propTypes=components_1.default.ShippingMethodPrice.propTypes,displayName=components_1.default.ShippingMethodPrice.displayName;function ShippingMethodPrice(props){const{base="price_amount",type="for_shipment",format="formatted",labelFreeOver="Free",...p}=props,{shippingMethod}=(0,react_1.useContext)(ShippingMethodChildrenContext_1.default),[price,setPrice]=(0,react_1.useState)(""),[priceCents,setPriceCents]=(0,react_1.useState)(0);(0,react_1.useEffect)(()=>{if(shippingMethod){const p2=(0,getAmount_1.default)({base,type,format,obj:shippingMethod});setPrice(p2);const pCents=(0,getAmount_1.default)({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?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children:props.children}):(0,jsx_runtime_1.jsx)("span",{...p,children:finalPrice})}exports.ShippingMethodPrice=ShippingMethodPrice,ShippingMethodPrice.propTypes=propTypes,ShippingMethodPrice.displayName=displayName,exports.default=ShippingMethodPrice;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShippingMethodPrice=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),getAmount_1=tslib_1.__importDefault(require("../../utils/getAmount")),ShippingMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/ShippingMethodChildrenContext")),Parent_1=tslib_1.__importDefault(require("../utils/Parent"));function ShippingMethodPrice(props){const{base="price_amount",type="for_shipment",format="formatted",labelFreeOver="Free",...p}=props,{shippingMethod}=(0,react_1.useContext)(ShippingMethodChildrenContext_1.default),[price,setPrice]=(0,react_1.useState)(""),[priceCents,setPriceCents]=(0,react_1.useState)(0);(0,react_1.useEffect)(()=>{if(shippingMethod){const p2=(0,getAmount_1.default)({base,type,format,obj:shippingMethod});setPrice(p2);const pCents=(0,getAmount_1.default)({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?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children:props.children}):(0,jsx_runtime_1.jsx)("span",{...p,children:finalPrice})}exports.ShippingMethodPrice=ShippingMethodPrice,exports.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
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShippingMethodRadioButton=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),ShippingMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/ShippingMethodChildrenContext")),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),components_1=tslib_1.__importDefault(require("../../config/components")),ShipmentContext_1=tslib_1.__importDefault(require("../../context/ShipmentContext")),propTypes=components_1.default.ShippingMethodRadioButton.propTypes,displayName=components_1.default.ShippingMethodRadioButton.displayName;function ShippingMethodRadioButton(props){const{onChange,...p}=props,[checked,setChecked]=(0,react_1.useState)(!1),{shippingMethod,currentShippingMethodId,shipmentId}=(0,react_1.useContext)(ShippingMethodChildrenContext_1.default),{setShippingMethod}=(0,react_1.useContext)(ShipmentContext_1.default),shippingMethodId=shippingMethod?.id,name=`shipment-${shipmentId}`,id=`${name}-${shippingMethodId}`;(0,react_1.useEffect)(()=>(setChecked(shippingMethodId===currentShippingMethodId),()=>{setChecked(!1)}),[currentShippingMethodId]);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?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children:props.children}):(0,jsx_runtime_1.jsx)("input",{type:"radio",name,id,onChange:handleOnChange,checked,...p})}exports.ShippingMethodRadioButton=ShippingMethodRadioButton,ShippingMethodRadioButton.propTypes=propTypes,ShippingMethodRadioButton.displayName=displayName,exports.default=ShippingMethodRadioButton;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShippingMethodRadioButton=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),ShippingMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/ShippingMethodChildrenContext")),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),ShipmentContext_1=tslib_1.__importDefault(require("../../context/ShipmentContext"));function ShippingMethodRadioButton(props){const{onChange,...p}=props,[checked,setChecked]=(0,react_1.useState)(!1),{shippingMethod,currentShippingMethodId,shipmentId}=(0,react_1.useContext)(ShippingMethodChildrenContext_1.default),{setShippingMethod}=(0,react_1.useContext)(ShipmentContext_1.default),shippingMethodId=shippingMethod?.id,name=`shipment-${shipmentId??""}`,id=`${name}-${shippingMethodId??""}`;(0,react_1.useEffect)(()=>(setChecked(shippingMethodId===currentShippingMethodId),()=>{setChecked(!1)}),[currentShippingMethodId]);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?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children:props.children}):(0,jsx_runtime_1.jsx)("input",{type:"radio",name,id,onChange:()=>{handleOnChange()},checked,...p})}exports.ShippingMethodRadioButton=ShippingMethodRadioButton,exports.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
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DeliveryLeadTime=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),ShippingMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/ShippingMethodChildrenContext")),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),components_1=tslib_1.__importDefault(require("../../config/components")),propTypes=components_1.default.DeliveryLeadTime.propTypes,displayName=components_1.default.DeliveryLeadTime.displayName;function DeliveryLeadTime(props){const{type,...p}=props,[text,setText]=(0,react_1.useState)(),{deliveryLeadTimeForShipment}=(0,react_1.useContext)(ShippingMethodChildrenContext_1.default);(0,react_1.useEffect)(()=>(deliveryLeadTimeForShipment&&deliveryLeadTimeForShipment[type]&&setText(deliveryLeadTimeForShipment[type]),()=>{setText("")}),[deliveryLeadTimeForShipment]);const parentProps={text,...p};return props.children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children:props.children}):(0,jsx_runtime_1.jsx)("span",{...p,children:text})}exports.DeliveryLeadTime=DeliveryLeadTime,DeliveryLeadTime.propTypes=propTypes,DeliveryLeadTime.displayName=displayName,exports.default=DeliveryLeadTime;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DeliveryLeadTime=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),ShippingMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/ShippingMethodChildrenContext")),Parent_1=tslib_1.__importDefault(require("../utils/Parent"));function DeliveryLeadTime(props){const{type,...p}=props,[text,setText]=(0,react_1.useState)(),{deliveryLeadTimeForShipment}=(0,react_1.useContext)(ShippingMethodChildrenContext_1.default);(0,react_1.useEffect)(()=>(deliveryLeadTimeForShipment?.[type]&&setText(deliveryLeadTimeForShipment[type]),()=>{setText("")}),[deliveryLeadTimeForShipment]);const parentProps={text,...p};return props.children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children:props.children}):(0,jsx_runtime_1.jsx)("span",{...p,children:text})}exports.DeliveryLeadTime=DeliveryLeadTime,exports.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
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SkuList=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),SkuListsContext_1=tslib_1.__importDefault(require("../../context/SkuListsContext")),components_1=tslib_1.__importDefault(require("../../config/components")),propTypes=components_1.default.SkuList.propTypes,displayName=components_1.default.SkuList.displayName;function SkuList(props){const{id,children}=props,{listIds}=(0,react_1.useContext)(SkuListsContext_1.default);return(0,react_1.useEffect)(()=>{listIds&&!listIds.includes(id)&&listIds.push(id)},[]),(0,jsx_runtime_1.jsx)(react_1.Fragment,{children})}exports.SkuList=SkuList,SkuList.propTypes=propTypes,SkuList.displayName=displayName,exports.default=SkuList;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SkuList=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),SkuListsContext_1=tslib_1.__importDefault(require("../../context/SkuListsContext"));function SkuList(props){const{id,children}=props,{listIds}=(0,react_1.useContext)(SkuListsContext_1.default);return(0,react_1.useEffect)(()=>{listIds&&!listIds.includes(id)&&listIds.push(id)},[]),(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children})}exports.SkuList=SkuList,exports.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
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SkuListsContainer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),SkuListsContext_1=tslib_1.__importDefault(require("../../context/SkuListsContext")),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),SkuListsReducer_1=tslib_1.__importStar(require("../../reducers/SkuListsReducer")),components_1=tslib_1.__importDefault(require("../../config/components")),propTypes=components_1.default.SkuListsContainer.propTypes,displayName=components_1.default.SkuListsContainer.displayName;function SkuListsContainer(props){const{children}=props,[state,dispatch]=(0,react_1.useReducer)(SkuListsReducer_1.default,SkuListsReducer_1.skuListsInitialState),config=(0,react_1.useContext)(CommerceLayerContext_1.default);return(0,react_1.useEffect)(()=>{state.listIds&&state.listIds.length>0&&config.accessToken&&(0,SkuListsReducer_1.getSkuList)({listIds:state.listIds,dispatch,config,state})},[config.accessToken]),(0,jsx_runtime_1.jsx)(SkuListsContext_1.default.Provider,{value:state,children})}exports.SkuListsContainer=SkuListsContainer,SkuListsContainer.propTypes=propTypes,SkuListsContainer.displayName=displayName,exports.default=SkuListsContainer;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SkuListsContainer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),SkuListsContext_1=tslib_1.__importDefault(require("../../context/SkuListsContext")),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),SkuListsReducer_1=tslib_1.__importStar(require("../../reducers/SkuListsReducer"));function SkuListsContainer(props){const{children}=props,[state,dispatch]=(0,react_1.useReducer)(SkuListsReducer_1.default,SkuListsReducer_1.skuListsInitialState),config=(0,react_1.useContext)(CommerceLayerContext_1.default);return(0,react_1.useEffect)(()=>{state.listIds&&state.listIds.length>0&&config.accessToken&&(0,SkuListsReducer_1.getSkuList)({listIds:state.listIds,dispatch,config,state})},[config.accessToken]),(0,jsx_runtime_1.jsx)(SkuListsContext_1.default.Provider,{value:state,children})}exports.SkuListsContainer=SkuListsContainer,exports.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
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Skus=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),components_1=tslib_1.__importDefault(require("../../config/components")),SkuChildrenContext_1=tslib_1.__importDefault(require("../../context/SkuChildrenContext")),SkuContext_1=tslib_1.__importDefault(require("../../context/SkuContext")),react_1=require("react");function Skus({children}){const{skus}=(0,react_1.useContext)(SkuContext_1.default),components=skus&&skus.map((sku,key)=>{const value={sku};return(0,jsx_runtime_1.jsx)(SkuChildrenContext_1.default.Provider,{value,children},key)});return(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:components})}exports.Skus=Skus,Skus.propTypes=components_1.default.Skus.propTypes,exports.default=Skus;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Skus=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),SkuChildrenContext_1=tslib_1.__importDefault(require("../../context/SkuChildrenContext")),SkuContext_1=tslib_1.__importDefault(require("../../context/SkuContext")),react_1=require("react");function Skus({children}){const{skus}=(0,react_1.useContext)(SkuContext_1.default),components=skus?.map((sku,key)=>{const value={sku};return(0,jsx_runtime_1.jsx)(SkuChildrenContext_1.default.Provider,{value,children},key)});return(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:components})}exports.Skus=Skus,exports.default=Skus;
@@ -1,12 +1,6 @@
1
- import { ReactNode } from 'react';
2
- declare type Props = {
3
- children: ReactNode;
4
- } & JSX.IntrinsicElements['p'];
5
- export declare function StockTransfer(props: Props): JSX.Element;
6
- export declare namespace StockTransfer {
7
- var propTypes: {
8
- children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
9
- };
10
- var displayName: string;
1
+ /// <reference types="react" />
2
+ interface Props {
3
+ children: JSX.Element[] | JSX.Element;
11
4
  }
5
+ export declare function StockTransfer(props: Props): JSX.Element;
12
6
  export default StockTransfer;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.StockTransfer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),components_1=tslib_1.__importDefault(require("../../config/components")),ShipmentChildrenContext_1=tslib_1.__importDefault(require("../../context/ShipmentChildrenContext")),StockTransferChildrenContext_1=tslib_1.__importDefault(require("../../context/StockTransferChildrenContext")),propTypes=components_1.default.StockTransfer.propTypes,displayName=components_1.default.StockTransfer.displayName;function StockTransfer(props){const{children}=props,{stockTransfers,lineItems}=(0,react_1.useContext)(ShipmentChildrenContext_1.default),components=stockTransfers?.filter(st=>!!lineItems?.find(l=>l.sku_code!==st.sku_code)).map((stockTransfer,k)=>{const stockTransferProps={stockTransfer:stockTransfer.type==="line_items"?stockTransfer:stockTransfer?.line_item};return(0,jsx_runtime_1.jsx)(StockTransferChildrenContext_1.default.Provider,{value:stockTransferProps,children},k)});return(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:components})}exports.StockTransfer=StockTransfer,StockTransfer.propTypes=propTypes,StockTransfer.displayName=displayName,exports.default=StockTransfer;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.StockTransfer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),ShipmentChildrenContext_1=tslib_1.__importDefault(require("../../context/ShipmentChildrenContext")),StockTransferChildrenContext_1=tslib_1.__importDefault(require("../../context/StockTransferChildrenContext"));function StockTransfer(props){const{children}=props,{stockTransfers,lineItems}=(0,react_1.useContext)(ShipmentChildrenContext_1.default),components=stockTransfers?.filter(st=>!!lineItems?.find(l=>l.sku_code!==st.sku_code)).map((stockTransfer,k)=>{const stockTransferProps={stockTransfer:stockTransfer.type==="line_items"?stockTransfer:stockTransfer?.line_item};return(0,jsx_runtime_1.jsx)(StockTransferChildrenContext_1.default.Provider,{value:stockTransferProps,children},k)});return(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:components})}exports.StockTransfer=StockTransfer,exports.default=StockTransfer;
@@ -1,8 +1,8 @@
1
1
  import { FunctionComponent } from 'react';
2
2
  declare type BaseFieldChildren = Omit<BaseFieldProps, 'children'>;
3
- export declare type BaseFieldProps = {
3
+ export interface BaseFieldProps extends Omit<JSX.IntrinsicElements['span'], 'children'> {
4
4
  attribute: 'number' | 'id';
5
5
  children?: (props: BaseFieldChildren) => JSX.Element;
6
- } & JSX.IntrinsicElements['span'];
6
+ }
7
7
  declare const BaseField: FunctionComponent<BaseFieldProps>;
8
8
  export default BaseField;
@@ -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" | "type" | "list" | "step" | "disabled" | "height" | "width" | "max" | "src" | "min" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "enterKeyHint" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "maxLength" | "minLength" | "multiple" | "readOnly" | "size" | "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
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useOrderContainer=void 0;const tslib_1=require("tslib"),OrderContext_1=tslib_1.__importDefault(require("../context/OrderContext")),react_1=require("react");function useOrderContainer(){const ctx=(0,react_1.useContext)(OrderContext_1.default);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/>")}exports.useOrderContainer=useOrderContainer,exports.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
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.addGiftCardError=exports.addGiftCard=exports.addGiftCardLoading=exports.addGiftCardRecipient=exports.giftCardInitialState=void 0;const tslib_1=require("tslib"),baseReducer_1=tslib_1.__importDefault(require("../utils/baseReducer")),lodash_1=require("lodash"),getErrors_1=tslib_1.__importDefault(require("../utils/getErrors")),getSdk_1=tslib_1.__importDefault(require("../utils/getSdk"));exports.giftCardInitialState={currencyCode:"",balanceCent:0,singleUse:!1,rechargeable:!0,loading:!1,expiresAt:null,errors:[]};const addGiftCardRecipient=async(values,config,dispatch)=>{try{const recipient=await(0,getSdk_1.default)(config).gift_card_recipients.create(values);dispatch({type:"setGiftCardRecipient",payload:{giftCardRecipient:recipient}})}catch(error){console.error(error)}};exports.addGiftCardRecipient=addGiftCardRecipient;const addGiftCardLoading=(loading,dispatch)=>{dispatch({type:"setGiftCardLoading",payload:{loading}})};exports.addGiftCardLoading=addGiftCardLoading;const addGiftCard=async(values,{config,dispatch,getOrder,createOrder,order})=>{try{const sdk=(0,getSdk_1.default)(config);(0,exports.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),(0,lodash_1.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}}),(0,exports.addGiftCardLoading)(!1,dispatch)}catch(error){const errors=(0,getErrors_1.default)(error,"gift_cards");dispatch({type:"setGiftCardErrors",payload:{errors}}),(0,exports.addGiftCardLoading)(!1,dispatch)}};exports.addGiftCard=addGiftCard;const addGiftCardError=(errors,dispatch)=>{dispatch({type:"setGiftCardErrors",payload:{errors}})};exports.addGiftCardError=addGiftCardError;const type=["setAvailability","setGiftCardRecipient","setGiftCardErrors","setGiftCardLoading"],giftCardReducer=(state,reducer)=>(0,baseReducer_1.default)(state,reducer,type);exports.default=giftCardReducer;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.addGiftCardError=exports.addGiftCard=exports.addGiftCardLoading=exports.addGiftCardRecipient=exports.giftCardInitialState=void 0;const tslib_1=require("tslib"),baseReducer_1=tslib_1.__importDefault(require("../utils/baseReducer")),lodash_1=require("lodash"),getErrors_1=tslib_1.__importDefault(require("../utils/getErrors")),getSdk_1=tslib_1.__importDefault(require("../utils/getSdk"));exports.giftCardInitialState={currencyCode:"",balanceCent:0,singleUse:!1,rechargeable:!0,loading:!1,expiresAt:null,errors:[]};async function addGiftCardRecipient(values,config,dispatch){try{const recipient=await(0,getSdk_1.default)(config).gift_card_recipients.create(values);dispatch({type:"setGiftCardRecipient",payload:{giftCardRecipient:recipient}})}catch(error){console.error(error)}}exports.addGiftCardRecipient=addGiftCardRecipient;const addGiftCardLoading=(loading,dispatch)=>{dispatch({type:"setGiftCardLoading",payload:{loading}})};exports.addGiftCardLoading=addGiftCardLoading;async function addGiftCard(values,{config,dispatch,getOrder,createOrder,order}){try{const sdk=(0,getSdk_1.default)(config);(0,exports.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),(0,lodash_1.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}}),(0,exports.addGiftCardLoading)(!1,dispatch)}catch(error){const errors=(0,getErrors_1.default)(error,"gift_cards");dispatch({type:"setGiftCardErrors",payload:{errors}}),(0,exports.addGiftCardLoading)(!1,dispatch)}}exports.addGiftCard=addGiftCard;const addGiftCardError=(errors,dispatch)=>{dispatch({type:"setGiftCardErrors",payload:{errors}})};exports.addGiftCardError=addGiftCardError;const type=["setAvailability","setGiftCardRecipient","setGiftCardErrors","setGiftCardLoading"],giftCardReducer=(state,reducer)=>(0,baseReducer_1.default)(state,reducer,type);exports.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,7 +116,7 @@ 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> = ({
@@ -125,5 +125,5 @@ export declare type ConditionalElement<E> = ({
125
125
  } & JSX.IntrinsicElements['img']) | ({
126
126
  attribute: Exclude<keyof E, 'image_url'>;
127
127
  tagElement: ExcludeTag<'img'>;
128
- } & JSX.IntrinsicElements[ExcludeTag<'img'>]);
128
+ } & Omit<JSX.IntrinsicElements[ExcludeTag<'img'>], 'children'>);
129
129
  export {};
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import type { ErrorComponentProps } from '../typings/errors';
3
- declare type Props = ErrorComponentProps & JSX.IntrinsicElements['span'];
3
+ declare type Props = ErrorComponentProps & Omit<JSX.IntrinsicElements['span'], 'children'>;
4
4
  export declare function Errors(props: Props): JSX.Element;
5
5
  export default Errors;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext,Fragment,useMemo}from"react";import Parent from"./utils/Parent";import GiftCardContext from"../context/GiftCardContext";import OrderContext from"../context/OrderContext";import AddressContext from"../context/AddressContext";import getAllErrors from"./utils/getAllErrors";import LineItemContext from"../context/LineItemContext";import LineItemChildrenContext from"../context/LineItemChildrenContext";import CustomerContext from"../context/CustomerContext";import PaymentMethodContext from"../context/PaymentMethodContext";import PaymentMethodChildrenContext from"../context/PaymentMethodChildrenContext";import ShipmentContext from"../context/ShipmentContext";export function Errors(props){const{children,messages=[],resource,field,...p}=props,{payment}=useContext(PaymentMethodChildrenContext),{errors:orderErrors}=useContext(OrderContext),{errors:giftCardErrors}=useContext(GiftCardContext),{errors:lineItemErrors}=useContext(LineItemContext),{errors:addressErrors}=useContext(AddressContext),{errors:customerErrors}=useContext(CustomerContext),{errors:shipmentErrors}=useContext(ShipmentContext),{errors:paymentMethodErrors,currentPaymentMethodType,currentPaymentMethodId}=useContext(PaymentMethodContext),{lineItem}=useContext(LineItemChildrenContext),allErrors=useMemo(()=>[...giftCardErrors||[],...orderErrors||[],...lineItemErrors||[],...addressErrors||[],...customerErrors||[],...shipmentErrors||[],...paymentMethodErrors?.filter(v=>v.field===currentPaymentMethodType&&payment?.id===currentPaymentMethodId)||[]],[giftCardErrors,orderErrors,lineItemErrors,addressErrors,customerErrors,shipmentErrors,paymentMethodErrors]).filter((v,k,a)=>v?.code!==a[k-1]?.code),msgErrors=getAllErrors({allErrors,field,messages,props:p,lineItem,resource,returnHtml:!children}),parentProps={messages,resource,field,errors:msgErrors,...p};return children?_jsx(Parent,{...parentProps,children}):_jsx(Fragment,{children:msgErrors})}export default Errors;
1
+ import{jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";import{useContext,useMemo}from"react";import Parent from"./utils/Parent";import GiftCardContext from"../context/GiftCardContext";import OrderContext from"../context/OrderContext";import AddressContext from"../context/AddressContext";import getAllErrors from"./utils/getAllErrors";import LineItemContext from"../context/LineItemContext";import LineItemChildrenContext from"../context/LineItemChildrenContext";import CustomerContext from"../context/CustomerContext";import PaymentMethodContext from"../context/PaymentMethodContext";import PaymentMethodChildrenContext from"../context/PaymentMethodChildrenContext";import ShipmentContext from"../context/ShipmentContext";export function Errors(props){const{children,messages=[],resource,field,...p}=props,{payment}=useContext(PaymentMethodChildrenContext),{errors:orderErrors}=useContext(OrderContext),{errors:giftCardErrors}=useContext(GiftCardContext),{errors:lineItemErrors}=useContext(LineItemContext),{errors:addressErrors}=useContext(AddressContext),{errors:customerErrors}=useContext(CustomerContext),{errors:shipmentErrors}=useContext(ShipmentContext),{errors:paymentMethodErrors,currentPaymentMethodType,currentPaymentMethodId}=useContext(PaymentMethodContext),{lineItem}=useContext(LineItemChildrenContext),allErrors=useMemo(()=>[...giftCardErrors||[],...orderErrors||[],...lineItemErrors||[],...addressErrors||[],...customerErrors||[],...shipmentErrors||[],...paymentMethodErrors?.filter(v=>v.field===currentPaymentMethodType&&payment?.id===currentPaymentMethodId)||[]],[giftCardErrors,orderErrors,lineItemErrors,addressErrors,customerErrors,shipmentErrors,paymentMethodErrors]).filter((v,k,a)=>v?.code!==a[k-1]?.code),msgErrors=getAllErrors({allErrors,field,messages,props:p,lineItem,resource,returnHtml:!children}),parentProps={messages,resource,field,errors:msgErrors,...p};return children?_jsx(Parent,{...parentProps,children}):_jsx(_Fragment,{children:msgErrors})}export default Errors;
@@ -1,14 +1,7 @@
1
1
  import { ReactNode } from 'react';
2
- declare type Props = {
2
+ interface Props {
3
3
  children: ReactNode;
4
4
  url: string;
5
- };
6
- export declare function ExternalFunction({ children, url }: Props): JSX.Element;
7
- export declare namespace ExternalFunction {
8
- var propTypes: {
9
- children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
10
- url: import("prop-types").Validator<string>;
11
- };
12
- var displayName: string;
13
5
  }
6
+ export declare function ExternalFunction({ children, url }: Props): JSX.Element;
14
7
  export default ExternalFunction;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import ExternalFunctionContext,{callExternalFunction}from"../context/ExternalFunctionContext";import components from"../config/components";const propTypes=components.ExternalFunction.propTypes,displayName=components.ExternalFunction.displayName;export function ExternalFunction({children,url}){return _jsx(ExternalFunctionContext.Provider,{value:{url,callExternalFunction},children})}ExternalFunction.propTypes=propTypes,ExternalFunction.displayName=displayName;export default ExternalFunction;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import ExternalFunctionContext,{callExternalFunction}from"../context/ExternalFunctionContext";export function ExternalFunction({children,url}){return _jsx(ExternalFunctionContext.Provider,{value:{url,callExternalFunction},children})}export default ExternalFunction;
@@ -2,14 +2,4 @@
2
2
  import { BaseInputComponentProps } from '../typings/index';
3
3
  declare type Props = BaseInputComponentProps & JSX.IntrinsicElements['input'] & JSX.IntrinsicElements['textarea'];
4
4
  export declare function MetadataInput(props: Props): JSX.Element;
5
- export declare namespace MetadataInput {
6
- var propTypes: {
7
- children: import("prop-types").Requireable<(...args: any[]) => any>;
8
- name: import("prop-types").Validator<string>;
9
- type: import("prop-types").Validator<NonNullable<import("../typings/index").BaseInputType>>;
10
- onChange: import("prop-types").Requireable<(...args: any[]) => any>;
11
- placeholder: import("prop-types").Requireable<string>;
12
- };
13
- var displayName: string;
14
- }
15
5
  export default MetadataInput;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import BaseInput from"./utils/BaseInput";import components from"../config/components";const propTypes=components.MetadataInput.propTypes,displayName=components.MetadataInput.displayName;export function MetadataInput(props){return _jsx(BaseInput,{"data-metadata":!0,...props})}MetadataInput.propTypes=propTypes,MetadataInput.displayName=displayName;export default MetadataInput;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import BaseInput from"./utils/BaseInput";export function MetadataInput(props){return _jsx(BaseInput,{"data-metadata":!0,...props})}export default MetadataInput;
@@ -7,20 +7,4 @@ declare type Props = Omit<BaseSelectComponentProps, 'options' | 'name'> & {
7
7
  disabled?: boolean;
8
8
  } & Pick<JSX.IntrinsicElements['select'], 'className' | 'id' | 'style'>;
9
9
  export declare function AddressCountrySelector(props: Props): JSX.Element;
10
- export declare namespace AddressCountrySelector {
11
- var propTypes: {
12
- children: import("prop-types").Requireable<(...args: any[]) => any>;
13
- placeholder: import("prop-types").Requireable<import("prop-types").InferProps<{
14
- label: import("prop-types").Validator<string>;
15
- value: import("prop-types").Validator<NonNullable<NonNullable<string | number | null | undefined>>>;
16
- }>>;
17
- value: import("prop-types").Requireable<string>;
18
- name: import("prop-types").Validator<NonNullable<AddressCountrySelectName>>;
19
- required: import("prop-types").Requireable<boolean>;
20
- };
21
- var defaultProps: {
22
- required: boolean;
23
- };
24
- var displayName: string;
25
- }
26
10
  export default AddressCountrySelector;
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useState}from"react";import BaseSelect from"../utils/BaseSelect";import components from"../../config/components";import BillingAddressFormContext from"../../context/BillingAddressFormContext";import ShippingAddressFormContext from"../../context/ShippingAddressFormContext";import{getCountries}from"../../utils/countryStateCity";import CustomerAddressFormContext from"../../context/CustomerAddressFormContext";const propTypes=components.AddressCountrySelector.propTypes,defaultProps=components.AddressCountrySelector.defaultProps,displayName=components.AddressCountrySelector.displayName;export function AddressCountrySelector(props){const{required=!0,value,name,className,...p}=props,billingAddress=useContext(BillingAddressFormContext),shippingAddress=useContext(ShippingAddressFormContext),customerAddress=useContext(CustomerAddressFormContext),[hasError,setHasError]=useState(!1);useEffect(()=>(value&&billingAddress?.setValue&&billingAddress.setValue(name,value),value&&shippingAddress?.setValue&&shippingAddress.setValue(name,value),value&&customerAddress?.setValue&&customerAddress.setValue(name,value),billingAddress.errors&&billingAddress?.errors?.[name]?.error&&setHasError(!0),billingAddress?.errors?.[name]&&hasError&&setHasError(!1),customerAddress.errors&&customerAddress?.errors?.[name]?.error&&setHasError(!0),customerAddress?.errors?.[name]&&hasError&&setHasError(!1),shippingAddress.errors&&shippingAddress?.errors?.[name]?.error&&setHasError(!0),shippingAddress?.errors?.[name]&&hasError&&setHasError(!1),()=>{setHasError(!1)}),[value,billingAddress?.errors,shippingAddress?.errors,customerAddress?.errors]);const errorClassName=billingAddress?.errorClassName||shippingAddress?.errorClassName||customerAddress?.errorClassName,classNameComputed=`${className||""} ${hasError&&errorClassName?errorClassName:""}`;return _jsx(BaseSelect,{className:classNameComputed,ref:billingAddress?.validation||shippingAddress?.validation||customerAddress?.validation,required,options:getCountries(),name,value,...p})}AddressCountrySelector.propTypes=propTypes,AddressCountrySelector.defaultProps=defaultProps,AddressCountrySelector.displayName=displayName;export default AddressCountrySelector;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import{useContext,useEffect,useState}from"react";import BaseSelect from"../utils/BaseSelect";import BillingAddressFormContext from"../../context/BillingAddressFormContext";import ShippingAddressFormContext from"../../context/ShippingAddressFormContext";import{getCountries}from"../../utils/countryStateCity";import CustomerAddressFormContext from"../../context/CustomerAddressFormContext";export function AddressCountrySelector(props){const{required=!0,value,name,className,...p}=props,billingAddress=useContext(BillingAddressFormContext),shippingAddress=useContext(ShippingAddressFormContext),customerAddress=useContext(CustomerAddressFormContext),[hasError,setHasError]=useState(!1);useEffect(()=>(value&&billingAddress?.setValue&&billingAddress.setValue(name,value),value&&shippingAddress?.setValue&&shippingAddress.setValue(name,value),value&&customerAddress?.setValue&&customerAddress.setValue(name,value),billingAddress.errors&&billingAddress?.errors?.[name]?.error&&setHasError(!0),billingAddress?.errors?.[name]&&hasError&&setHasError(!1),customerAddress.errors&&customerAddress?.errors?.[name]?.error&&setHasError(!0),customerAddress?.errors?.[name]&&hasError&&setHasError(!1),shippingAddress.errors&&shippingAddress?.errors?.[name]?.error&&setHasError(!0),shippingAddress?.errors?.[name]&&hasError&&setHasError(!1),()=>{setHasError(!1)}),[value,billingAddress?.errors,shippingAddress?.errors,customerAddress?.errors]);const errorClassName=billingAddress?.errorClassName||shippingAddress?.errorClassName||customerAddress?.errorClassName,classNameComputed=`${className??""} ${hasError&&errorClassName?errorClassName:""}`;return _jsx(BaseSelect,{className:classNameComputed,ref:billingAddress?.validation||shippingAddress?.validation||customerAddress?.validation,required,options:getCountries(),name,value,...p})}export default AddressCountrySelector;