@commercelayer/react-components 4.0.0-alpha.5 → 4.0.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/SubmitButton.d.ts +6 -15
- package/lib/cjs/components/SubmitButton.js +1 -1
- package/lib/cjs/components/addresses/AddressInput.d.ts +0 -11
- package/lib/cjs/components/addresses/AddressInput.js +1 -1
- package/lib/cjs/components/addresses/SaveAddressesButton.d.ts +4 -3
- package/lib/cjs/components/addresses/SaveAddressesButton.js +1 -1
- package/lib/cjs/components/auth/CommerceLayer.d.ts +2 -9
- package/lib/cjs/components/auth/CommerceLayer.js +1 -1
- package/lib/cjs/components/customers/SaveCustomerButton.d.ts +6 -7
- package/lib/cjs/components/customers/SaveCustomerButton.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponCode.d.ts +8 -16
- package/lib/cjs/components/gift_cards/GiftCardOrCouponCode.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +4 -12
- package/lib/cjs/components/gift_cards/GiftCardOrCouponRemoveButton.js +1 -1
- package/lib/cjs/components/gift_cards/GiftCardOrCouponSubmit.d.ts +6 -12
- package/lib/cjs/components/gift_cards/GiftCardOrCouponSubmit.js +1 -1
- package/lib/cjs/components/line_items/LineItemOption.d.ts +2 -2
- package/lib/cjs/components/line_items/LineItemQuantity.d.ts +4 -16
- package/lib/cjs/components/line_items/LineItemQuantity.js +1 -1
- package/lib/cjs/components/line_items/LineItemRemoveLink.d.ts +6 -16
- package/lib/cjs/components/line_items/LineItemRemoveLink.js +1 -1
- package/lib/cjs/components/line_items/LineItemsCount.d.ts +4 -14
- package/lib/cjs/components/line_items/LineItemsCount.js +1 -1
- package/lib/cjs/components/line_items/LineItemsEmpty.d.ts +6 -17
- package/lib/cjs/components/line_items/LineItemsEmpty.js +1 -1
- package/lib/cjs/components/orders/AddToCartButton.d.ts +4 -5
- package/lib/cjs/components/orders/AddToCartButton.js +1 -1
- package/lib/cjs/components/orders/CartLink.d.ts +6 -6
- package/lib/cjs/components/orders/CartLink.js +1 -1
- package/lib/cjs/components/orders/CheckoutLink.d.ts +4 -4
- package/lib/cjs/components/orders/CheckoutLink.js +1 -1
- package/lib/cjs/components/orders/ItemContainer.d.ts +2 -13
- package/lib/cjs/components/orders/ItemContainer.js +1 -1
- package/lib/cjs/components/orders/OrderList.d.ts +10 -11
- package/lib/cjs/components/orders/OrderList.js +1 -1
- package/lib/cjs/components/orders/OrderListEmpty.d.ts +14 -0
- package/lib/cjs/components/orders/OrderListEmpty.js +1 -0
- package/lib/cjs/components/orders/OrderListRow.d.ts +1 -1
- package/lib/cjs/components/orders/PlaceOrderButton.d.ts +4 -14
- package/lib/cjs/components/orders/PlaceOrderButton.js +1 -1
- package/lib/cjs/components/parcels/Parcel.d.ts +6 -0
- package/lib/cjs/components/parcels/Parcel.js +1 -0
- package/lib/cjs/components/payment_source/AdyenPayment.js +1 -1
- package/lib/cjs/components/payment_source/PaymentSourceBrandIcon.d.ts +4 -14
- package/lib/cjs/components/payment_source/PaymentSourceBrandIcon.js +1 -1
- package/lib/cjs/components/payment_source/PaymentSourceBrandName.d.ts +4 -11
- package/lib/cjs/components/payment_source/PaymentSourceBrandName.js +1 -1
- package/lib/cjs/components/payment_source/PaymentSourceDetail.d.ts +6 -12
- package/lib/cjs/components/payment_source/PaymentSourceDetail.js +1 -1
- package/lib/cjs/components/payment_source/PaymentSourceEditButton.d.ts +4 -10
- package/lib/cjs/components/payment_source/PaymentSourceEditButton.js +1 -1
- package/lib/cjs/components/prices/Price.d.ts +6 -18
- package/lib/cjs/components/prices/Price.js +1 -1
- package/lib/cjs/components/prices/PricesContainer.d.ts +4 -20
- package/lib/cjs/components/prices/PricesContainer.js +1 -1
- package/lib/cjs/components/shipments/Shipment.d.ts +2 -8
- package/lib/cjs/components/shipments/Shipment.js +1 -1
- package/lib/cjs/components/shipments/ShipmentField.d.ts +0 -7
- package/lib/cjs/components/shipments/ShipmentField.js +1 -1
- package/lib/cjs/components/shipments/ShipmentsContainer.d.ts +2 -8
- package/lib/cjs/components/shipments/ShipmentsContainer.js +1 -1
- package/lib/cjs/components/shipping_methods/ShippingMethod.d.ts +2 -9
- package/lib/cjs/components/shipping_methods/ShippingMethod.js +1 -1
- package/lib/cjs/components/shipping_methods/ShippingMethodName.d.ts +0 -6
- package/lib/cjs/components/shipping_methods/ShippingMethodName.js +1 -1
- package/lib/cjs/components/skus/AvailabilityTemplate.d.ts +4 -13
- package/lib/cjs/components/skus/AvailabilityTemplate.js +1 -1
- package/lib/cjs/components/skus/QuantitySelector.d.ts +4 -18
- package/lib/cjs/components/skus/QuantitySelector.js +1 -1
- package/lib/cjs/components/skus/VariantSelector.d.ts +4 -27
- package/lib/cjs/components/skus/VariantSelector.js +1 -1
- package/lib/cjs/components/utils/AddressCardsTemplate.d.ts +2 -2
- package/lib/cjs/components/utils/BaseInput.d.ts +1 -1
- package/lib/cjs/components/utils/ErrorBoundary.d.ts +14 -0
- package/lib/cjs/components/utils/ErrorBoundary.js +1 -0
- package/lib/cjs/components/utils/PaymentCardsTemplate.d.ts +2 -2
- package/lib/cjs/components/utils/PriceTemplate.d.ts +2 -2
- package/lib/cjs/components/utils/PriceTemplate.js +1 -1
- package/lib/cjs/context/BillingAddressFormContext.d.ts +2 -2
- package/lib/cjs/context/OrderListChildrenContext.d.ts +8 -0
- package/lib/cjs/context/ParcelChildrenContext.d.ts +7 -0
- package/lib/cjs/context/ParcelChildrenContext.js +1 -0
- package/lib/cjs/context/ShipmentChildrenContext.d.ts +6 -5
- package/lib/cjs/context/ShipmentChildrenContext.js +1 -1
- package/lib/cjs/index.d.ts +35 -34
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/reducers/CustomerReducer.d.ts +16 -18
- package/lib/cjs/reducers/CustomerReducer.js +1 -1
- package/lib/cjs/reducers/OrderReducer.d.ts +14 -24
- package/lib/cjs/reducers/ShipmentReducer.d.ts +1 -3
- package/lib/cjs/typings/errors.d.ts +2 -2
- package/lib/cjs/typings/index.d.ts +8 -16
- package/lib/cjs/utils/getPrices.d.ts +4 -15
- package/lib/cjs/utils/getPrices.js +1 -1
- package/lib/cjs/utils/getSdk.d.ts +1 -1
- package/lib/cjs/utils/organization.d.ts +2 -2
- package/lib/esm/components/SubmitButton.d.ts +6 -15
- package/lib/esm/components/SubmitButton.js +1 -1
- package/lib/esm/components/addresses/AddressInput.d.ts +0 -11
- package/lib/esm/components/addresses/AddressInput.js +1 -1
- package/lib/esm/components/addresses/SaveAddressesButton.d.ts +4 -3
- package/lib/esm/components/addresses/SaveAddressesButton.js +1 -1
- package/lib/esm/components/auth/CommerceLayer.d.ts +2 -9
- package/lib/esm/components/auth/CommerceLayer.js +1 -1
- package/lib/esm/components/customers/SaveCustomerButton.d.ts +6 -7
- package/lib/esm/components/customers/SaveCustomerButton.js +1 -1
- package/lib/esm/components/gift_cards/GiftCardOrCouponCode.d.ts +8 -16
- package/lib/esm/components/gift_cards/GiftCardOrCouponCode.js +1 -1
- package/lib/esm/components/gift_cards/GiftCardOrCouponRemoveButton.d.ts +4 -12
- package/lib/esm/components/gift_cards/GiftCardOrCouponRemoveButton.js +1 -1
- package/lib/esm/components/gift_cards/GiftCardOrCouponSubmit.d.ts +6 -12
- package/lib/esm/components/gift_cards/GiftCardOrCouponSubmit.js +1 -1
- package/lib/esm/components/line_items/LineItemOption.d.ts +2 -2
- package/lib/esm/components/line_items/LineItemQuantity.d.ts +4 -16
- package/lib/esm/components/line_items/LineItemQuantity.js +1 -1
- package/lib/esm/components/line_items/LineItemRemoveLink.d.ts +6 -16
- package/lib/esm/components/line_items/LineItemRemoveLink.js +1 -1
- package/lib/esm/components/line_items/LineItemsCount.d.ts +4 -14
- package/lib/esm/components/line_items/LineItemsCount.js +1 -1
- package/lib/esm/components/line_items/LineItemsEmpty.d.ts +6 -17
- package/lib/esm/components/line_items/LineItemsEmpty.js +1 -1
- package/lib/esm/components/orders/AddToCartButton.d.ts +4 -5
- package/lib/esm/components/orders/AddToCartButton.js +1 -1
- package/lib/esm/components/orders/CartLink.d.ts +6 -6
- package/lib/esm/components/orders/CartLink.js +1 -1
- package/lib/esm/components/orders/CheckoutLink.d.ts +4 -4
- package/lib/esm/components/orders/CheckoutLink.js +1 -1
- package/lib/esm/components/orders/ItemContainer.d.ts +2 -13
- package/lib/esm/components/orders/ItemContainer.js +1 -1
- package/lib/esm/components/orders/OrderList.d.ts +10 -11
- package/lib/esm/components/orders/OrderList.js +1 -1
- package/lib/esm/components/orders/OrderListEmpty.d.ts +14 -0
- package/lib/esm/components/orders/OrderListEmpty.js +1 -0
- package/lib/esm/components/orders/OrderListRow.d.ts +1 -1
- package/lib/esm/components/orders/PlaceOrderButton.d.ts +4 -14
- package/lib/esm/components/orders/PlaceOrderButton.js +1 -1
- package/lib/esm/components/parcels/Parcel.d.ts +6 -0
- package/lib/esm/components/parcels/Parcel.js +1 -0
- package/lib/esm/components/payment_source/AdyenPayment.js +1 -1
- package/lib/esm/components/payment_source/PaymentSourceBrandIcon.d.ts +4 -14
- package/lib/esm/components/payment_source/PaymentSourceBrandIcon.js +1 -1
- package/lib/esm/components/payment_source/PaymentSourceBrandName.d.ts +4 -11
- package/lib/esm/components/payment_source/PaymentSourceBrandName.js +1 -1
- package/lib/esm/components/payment_source/PaymentSourceDetail.d.ts +6 -12
- package/lib/esm/components/payment_source/PaymentSourceDetail.js +1 -1
- package/lib/esm/components/payment_source/PaymentSourceEditButton.d.ts +4 -10
- package/lib/esm/components/payment_source/PaymentSourceEditButton.js +1 -1
- package/lib/esm/components/prices/Price.d.ts +6 -18
- package/lib/esm/components/prices/Price.js +1 -1
- package/lib/esm/components/prices/PricesContainer.d.ts +4 -20
- package/lib/esm/components/prices/PricesContainer.js +1 -1
- package/lib/esm/components/shipments/Shipment.d.ts +2 -8
- package/lib/esm/components/shipments/Shipment.js +1 -1
- package/lib/esm/components/shipments/ShipmentField.d.ts +0 -7
- package/lib/esm/components/shipments/ShipmentField.js +1 -1
- package/lib/esm/components/shipments/ShipmentsContainer.d.ts +2 -8
- package/lib/esm/components/shipments/ShipmentsContainer.js +1 -1
- package/lib/esm/components/shipping_methods/ShippingMethod.d.ts +2 -9
- package/lib/esm/components/shipping_methods/ShippingMethod.js +1 -1
- package/lib/esm/components/shipping_methods/ShippingMethodName.d.ts +0 -6
- package/lib/esm/components/shipping_methods/ShippingMethodName.js +1 -1
- package/lib/esm/components/skus/AvailabilityTemplate.d.ts +4 -13
- package/lib/esm/components/skus/AvailabilityTemplate.js +1 -1
- package/lib/esm/components/skus/QuantitySelector.d.ts +4 -18
- package/lib/esm/components/skus/QuantitySelector.js +1 -1
- package/lib/esm/components/skus/VariantSelector.d.ts +4 -27
- package/lib/esm/components/skus/VariantSelector.js +1 -1
- package/lib/esm/components/utils/AddressCardsTemplate.d.ts +2 -2
- package/lib/esm/components/utils/BaseInput.d.ts +1 -1
- package/lib/esm/components/utils/ErrorBoundary.d.ts +14 -0
- package/lib/esm/components/utils/ErrorBoundary.js +1 -0
- package/lib/esm/components/utils/PaymentCardsTemplate.d.ts +2 -2
- package/lib/esm/components/utils/PriceTemplate.d.ts +2 -2
- package/lib/esm/components/utils/PriceTemplate.js +1 -1
- package/lib/esm/context/BillingAddressFormContext.d.ts +2 -2
- package/lib/esm/context/OrderListChildrenContext.d.ts +8 -0
- package/lib/esm/context/ParcelChildrenContext.d.ts +7 -0
- package/lib/esm/context/ParcelChildrenContext.js +1 -0
- package/lib/esm/context/ShipmentChildrenContext.d.ts +6 -5
- package/lib/esm/context/ShipmentChildrenContext.js +1 -1
- package/lib/esm/index.d.ts +35 -34
- package/lib/esm/index.js +1 -1
- package/lib/esm/reducers/CustomerReducer.d.ts +16 -18
- package/lib/esm/reducers/CustomerReducer.js +1 -1
- package/lib/esm/reducers/OrderReducer.d.ts +14 -24
- package/lib/esm/reducers/ShipmentReducer.d.ts +1 -3
- package/lib/esm/typings/errors.d.ts +2 -2
- package/lib/esm/typings/index.d.ts +8 -16
- package/lib/esm/utils/getPrices.d.ts +4 -15
- package/lib/esm/utils/getPrices.js +1 -1
- package/lib/esm/utils/getSdk.d.ts +1 -1
- package/lib/esm/utils/organization.d.ts +2 -2
- package/lib/tsconfig.prod.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +46 -35
package/lib/esm/index.d.ts
CHANGED
|
@@ -1,28 +1,25 @@
|
|
|
1
|
-
export * from './components/
|
|
2
|
-
export * from './components/
|
|
1
|
+
export * from './components/Errors';
|
|
2
|
+
export * from './components/ExternalFunction';
|
|
3
|
+
export * from './components/MetadataInput';
|
|
4
|
+
export * from './components/SubmitButton';
|
|
3
5
|
export * from './components/addresses/Address';
|
|
6
|
+
export * from './components/addresses/AddressCountrySelector';
|
|
4
7
|
export * from './components/addresses/AddressField';
|
|
5
8
|
export * from './components/addresses/AddressInput';
|
|
6
9
|
export * from './components/addresses/AddressStateSelector';
|
|
7
10
|
export * from './components/addresses/AddressesContainer';
|
|
8
11
|
export * from './components/addresses/BillingAddressContainer';
|
|
9
12
|
export * from './components/addresses/BillingAddressForm';
|
|
10
|
-
export * from './components/
|
|
11
|
-
export * from './components/
|
|
12
|
-
export * from './components/
|
|
13
|
-
export * from './components/orders/CartLink';
|
|
14
|
-
export * from './components/orders/CheckoutLink';
|
|
13
|
+
export * from './components/addresses/SaveAddressesButton';
|
|
14
|
+
export * from './components/addresses/ShippingAddressContainer';
|
|
15
|
+
export * from './components/addresses/ShippingAddressForm';
|
|
15
16
|
export * from './components/auth/CommerceLayer';
|
|
17
|
+
export * from './components/customers/CustomerAddressForm';
|
|
16
18
|
export * from './components/customers/CustomerContainer';
|
|
17
19
|
export * from './components/customers/CustomerField';
|
|
18
|
-
export * from './components/customers/CustomerAddressForm';
|
|
19
20
|
export * from './components/customers/CustomerInput';
|
|
20
|
-
export * from './components/
|
|
21
|
-
export * from './components/orders/DiscountAmount';
|
|
22
|
-
export * from './components/Errors';
|
|
23
|
-
export * from './components/ExternalFunction';
|
|
21
|
+
export * from './components/customers/SaveCustomerButton';
|
|
24
22
|
export * from './components/gift_cards/GiftCard';
|
|
25
|
-
export * from './components/orders/GiftCardAmount';
|
|
26
23
|
export * from './components/gift_cards/GiftCardContainer';
|
|
27
24
|
export * from './components/gift_cards/GiftCardCurrencySelector';
|
|
28
25
|
export * from './components/gift_cards/GiftCardInput';
|
|
@@ -31,7 +28,6 @@ export * from './components/gift_cards/GiftCardOrCouponForm';
|
|
|
31
28
|
export * from './components/gift_cards/GiftCardOrCouponInput';
|
|
32
29
|
export * from './components/gift_cards/GiftCardOrCouponRemoveButton';
|
|
33
30
|
export * from './components/gift_cards/GiftCardOrCouponSubmit';
|
|
34
|
-
export * from './components/orders/ItemContainer';
|
|
35
31
|
export * from './components/line_items/LineItem';
|
|
36
32
|
export * from './components/line_items/LineItemAmount';
|
|
37
33
|
export * from './components/line_items/LineItemCode';
|
|
@@ -44,12 +40,26 @@ export * from './components/line_items/LineItemRemoveLink';
|
|
|
44
40
|
export * from './components/line_items/LineItemsContainer';
|
|
45
41
|
export * from './components/line_items/LineItemsCount';
|
|
46
42
|
export * from './components/line_items/LineItemsEmpty';
|
|
47
|
-
export * from './components/
|
|
43
|
+
export * from './components/orders/AddToCartButton';
|
|
44
|
+
export * from './components/orders/AdjustmentAmount';
|
|
45
|
+
export * from './components/orders/CartLink';
|
|
46
|
+
export * from './components/orders/CheckoutLink';
|
|
47
|
+
export * from './components/orders/DiscountAmount';
|
|
48
|
+
export * from './components/orders/GiftCardAmount';
|
|
49
|
+
export * from './components/orders/ItemContainer';
|
|
48
50
|
export * from './components/orders/OrderContainer';
|
|
49
|
-
export * from './components/orders/OrderNumber';
|
|
50
|
-
export * from './components/orders/OrderStorage';
|
|
51
51
|
export * from './components/orders/OrderList';
|
|
52
52
|
export * from './components/orders/OrderListRow';
|
|
53
|
+
export * from './components/orders/OrderNumber';
|
|
54
|
+
export * from './components/orders/OrderStorage';
|
|
55
|
+
export * from './components/orders/OrderListEmpty';
|
|
56
|
+
export * from './components/orders/PlaceOrderButton';
|
|
57
|
+
export * from './components/orders/PlaceOrderContainer';
|
|
58
|
+
export * from './components/orders/PrivacyAndTermsCheckbox';
|
|
59
|
+
export * from './components/orders/ShippingAmount';
|
|
60
|
+
export * from './components/orders/SubTotalAmount';
|
|
61
|
+
export * from './components/orders/TaxesAmount';
|
|
62
|
+
export * from './components/orders/TotalAmount';
|
|
53
63
|
export * from './components/payment_methods/PaymentMethod';
|
|
54
64
|
export * from './components/payment_methods/PaymentMethodAmount';
|
|
55
65
|
export * from './components/payment_methods/PaymentMethodName';
|
|
@@ -61,24 +71,19 @@ export * from './components/payment_source/PaymentSourceBrandIcon';
|
|
|
61
71
|
export * from './components/payment_source/PaymentSourceBrandName';
|
|
62
72
|
export * from './components/payment_source/PaymentSourceDetail';
|
|
63
73
|
export * from './components/payment_source/PaymentSourceEditButton';
|
|
64
|
-
export * from './components/orders/PlaceOrderButton';
|
|
65
|
-
export * from './components/orders/PlaceOrderContainer';
|
|
66
74
|
export * from './components/prices/Price';
|
|
67
75
|
export * from './components/prices/PricesContainer';
|
|
68
|
-
export * from './components/orders/PrivacyAndTermsCheckbox';
|
|
69
|
-
export * from './components/skus/QuantitySelector';
|
|
70
|
-
export * from './components/addresses/SaveAddressesButton';
|
|
71
|
-
export * from './components/customers/SaveCustomerButton';
|
|
72
76
|
export * from './components/shipments/Shipment';
|
|
73
77
|
export * from './components/shipments/ShipmentField';
|
|
74
78
|
export * from './components/shipments/ShipmentsContainer';
|
|
75
|
-
export * from './components/addresses/ShippingAddressContainer';
|
|
76
|
-
export * from './components/addresses/ShippingAddressForm';
|
|
77
|
-
export * from './components/orders/ShippingAmount';
|
|
78
79
|
export * from './components/shipping_methods/ShippingMethod';
|
|
79
80
|
export * from './components/shipping_methods/ShippingMethodName';
|
|
80
81
|
export * from './components/shipping_methods/ShippingMethodPrice';
|
|
81
82
|
export * from './components/shipping_methods/ShippingMethodRadioButton';
|
|
83
|
+
export * from './components/skus/AvailabilityContainer';
|
|
84
|
+
export * from './components/skus/AvailabilityTemplate';
|
|
85
|
+
export * from './components/skus/DeliveryLeadTime';
|
|
86
|
+
export * from './components/skus/QuantitySelector';
|
|
82
87
|
export * from './components/skus/SkuField';
|
|
83
88
|
export * from './components/skus/SkuList';
|
|
84
89
|
export * from './components/skus/SkuListsContainer';
|
|
@@ -87,21 +92,17 @@ export * from './components/skus/SkuOptionInput';
|
|
|
87
92
|
export * from './components/skus/SkuOptionsContainer';
|
|
88
93
|
export * from './components/skus/Skus';
|
|
89
94
|
export * from './components/skus/SkusContainer';
|
|
90
|
-
export * from './components/stock_transfers/StockTransfer';
|
|
91
|
-
export * from './components/stock_transfers/StockTransferField';
|
|
92
|
-
export * from './components/orders/SubTotalAmount';
|
|
93
|
-
export * from './components/SubmitButton';
|
|
94
|
-
export * from './components/orders/TaxesAmount';
|
|
95
|
-
export * from './components/orders/TotalAmount';
|
|
96
95
|
export * from './components/skus/VariantSelector';
|
|
97
96
|
export * from './components/skus/VariantsContainer';
|
|
97
|
+
export * from './components/stock_transfers/StockTransfer';
|
|
98
|
+
export * from './components/stock_transfers/StockTransferField';
|
|
98
99
|
export type { CustomerCardsType } from './components/utils/PaymentCardsTemplate';
|
|
99
100
|
export type { AddressCardsType } from './components/utils/AddressCardsTemplate';
|
|
100
101
|
export type { AddToCartButtonType } from './components/orders/AddToCartButton';
|
|
101
|
-
export type { ShippingMethodRadioButtonType, ShippingMethodRadioButtonOnChangeType
|
|
102
|
+
export type { ShippingMethodRadioButtonType, ShippingMethodRadioButtonOnChangeType } from './components/shipping_methods/ShippingMethodRadioButton';
|
|
102
103
|
export type { LineItemCodeType } from './components/line_items/LineItemCode';
|
|
103
104
|
export type { LineItemNameType } from './components/line_items/LineItemName';
|
|
104
105
|
export type { LineItemImageType } from './components/line_items/LineItemImage';
|
|
105
106
|
export type { LineItemType } from './typings/index';
|
|
106
107
|
export type { ErrorComponentProps, ResourceErrorType } from './typings/errors';
|
|
107
|
-
export type { AddressCountrySelectName, AddressInputName, AddressStateSelectName, BaseInputType
|
|
108
|
+
export type { AddressCountrySelectName, AddressInputName, AddressStateSelectName, BaseInputType } from './typings/index';
|
package/lib/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./components/
|
|
1
|
+
export*from"./components/Errors";export*from"./components/ExternalFunction";export*from"./components/MetadataInput";export*from"./components/SubmitButton";export*from"./components/addresses/Address";export*from"./components/addresses/AddressCountrySelector";export*from"./components/addresses/AddressField";export*from"./components/addresses/AddressInput";export*from"./components/addresses/AddressStateSelector";export*from"./components/addresses/AddressesContainer";export*from"./components/addresses/BillingAddressContainer";export*from"./components/addresses/BillingAddressForm";export*from"./components/addresses/SaveAddressesButton";export*from"./components/addresses/ShippingAddressContainer";export*from"./components/addresses/ShippingAddressForm";export*from"./components/auth/CommerceLayer";export*from"./components/customers/CustomerAddressForm";export*from"./components/customers/CustomerContainer";export*from"./components/customers/CustomerField";export*from"./components/customers/CustomerInput";export*from"./components/customers/SaveCustomerButton";export*from"./components/gift_cards/GiftCard";export*from"./components/gift_cards/GiftCardContainer";export*from"./components/gift_cards/GiftCardCurrencySelector";export*from"./components/gift_cards/GiftCardInput";export*from"./components/gift_cards/GiftCardOrCouponCode";export*from"./components/gift_cards/GiftCardOrCouponForm";export*from"./components/gift_cards/GiftCardOrCouponInput";export*from"./components/gift_cards/GiftCardOrCouponRemoveButton";export*from"./components/gift_cards/GiftCardOrCouponSubmit";export*from"./components/line_items/LineItem";export*from"./components/line_items/LineItemAmount";export*from"./components/line_items/LineItemCode";export*from"./components/line_items/LineItemImage";export*from"./components/line_items/LineItemName";export*from"./components/line_items/LineItemOption";export*from"./components/line_items/LineItemOptions";export*from"./components/line_items/LineItemQuantity";export*from"./components/line_items/LineItemRemoveLink";export*from"./components/line_items/LineItemsContainer";export*from"./components/line_items/LineItemsCount";export*from"./components/line_items/LineItemsEmpty";export*from"./components/orders/AddToCartButton";export*from"./components/orders/AdjustmentAmount";export*from"./components/orders/CartLink";export*from"./components/orders/CheckoutLink";export*from"./components/orders/DiscountAmount";export*from"./components/orders/GiftCardAmount";export*from"./components/orders/ItemContainer";export*from"./components/orders/OrderContainer";export*from"./components/orders/OrderList";export*from"./components/orders/OrderListRow";export*from"./components/orders/OrderNumber";export*from"./components/orders/OrderStorage";export*from"./components/orders/OrderListEmpty";export*from"./components/orders/PlaceOrderButton";export*from"./components/orders/PlaceOrderContainer";export*from"./components/orders/PrivacyAndTermsCheckbox";export*from"./components/orders/ShippingAmount";export*from"./components/orders/SubTotalAmount";export*from"./components/orders/TaxesAmount";export*from"./components/orders/TotalAmount";export*from"./components/payment_methods/PaymentMethod";export*from"./components/payment_methods/PaymentMethodAmount";export*from"./components/payment_methods/PaymentMethodName";export*from"./components/payment_methods/PaymentMethodPrice";export*from"./components/payment_methods/PaymentMethodRadioButton";export*from"./components/payment_methods/PaymentMethodsContainer";export*from"./components/payment_source/PaymentSource";export*from"./components/payment_source/PaymentSourceBrandIcon";export*from"./components/payment_source/PaymentSourceBrandName";export*from"./components/payment_source/PaymentSourceDetail";export*from"./components/payment_source/PaymentSourceEditButton";export*from"./components/prices/Price";export*from"./components/prices/PricesContainer";export*from"./components/shipments/Shipment";export*from"./components/shipments/ShipmentField";export*from"./components/shipments/ShipmentsContainer";export*from"./components/shipping_methods/ShippingMethod";export*from"./components/shipping_methods/ShippingMethodName";export*from"./components/shipping_methods/ShippingMethodPrice";export*from"./components/shipping_methods/ShippingMethodRadioButton";export*from"./components/skus/AvailabilityContainer";export*from"./components/skus/AvailabilityTemplate";export*from"./components/skus/DeliveryLeadTime";export*from"./components/skus/QuantitySelector";export*from"./components/skus/SkuField";export*from"./components/skus/SkuList";export*from"./components/skus/SkuListsContainer";export*from"./components/skus/SkuOption";export*from"./components/skus/SkuOptionInput";export*from"./components/skus/SkuOptionsContainer";export*from"./components/skus/Skus";export*from"./components/skus/SkusContainer";export*from"./components/skus/VariantSelector";export*from"./components/skus/VariantsContainer";export*from"./components/stock_transfers/StockTransfer";export*from"./components/stock_transfers/StockTransferField";
|
|
@@ -4,7 +4,7 @@ import type { Address, AddressCreate, AddressUpdate, Customer, CustomerPaymentSo
|
|
|
4
4
|
import { CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
5
5
|
import { updateOrder } from './OrderReducer';
|
|
6
6
|
export declare type CustomerActionType = 'setErrors' | 'setCustomerEmail' | 'setAddresses' | 'setPayments' | 'setOrders';
|
|
7
|
-
export
|
|
7
|
+
export interface CustomerActionPayload {
|
|
8
8
|
addresses: Address[];
|
|
9
9
|
payments: CustomerPaymentSource[];
|
|
10
10
|
customerEmail: string;
|
|
@@ -12,7 +12,7 @@ export declare type CustomerActionPayload = {
|
|
|
12
12
|
orders: Order[];
|
|
13
13
|
isGuest: boolean;
|
|
14
14
|
customers: Customer;
|
|
15
|
-
}
|
|
15
|
+
}
|
|
16
16
|
export declare type CustomerState = Partial<CustomerActionPayload>;
|
|
17
17
|
export interface CustomerAction {
|
|
18
18
|
type: CustomerActionType;
|
|
@@ -22,7 +22,7 @@ export declare type SetSaveOnBlur = (args: {
|
|
|
22
22
|
saveOnBlur: boolean;
|
|
23
23
|
dispatch: Dispatch<CustomerAction>;
|
|
24
24
|
}) => void;
|
|
25
|
-
export
|
|
25
|
+
export interface SaveCustomerUser {
|
|
26
26
|
/**
|
|
27
27
|
* The Commerce Layer Config
|
|
28
28
|
*/
|
|
@@ -43,11 +43,9 @@ export declare type SaveCustomerUser = {
|
|
|
43
43
|
* The function to update the order resource
|
|
44
44
|
*/
|
|
45
45
|
updateOrder: typeof updateOrder;
|
|
46
|
-
};
|
|
47
|
-
export declare function saveCustomerUser({ customerEmail, order, updateOrder, }: SaveCustomerUser): Promise<void>;
|
|
48
|
-
export interface SetCustomerErrors {
|
|
49
|
-
<V extends BaseError[]>(errors: V, dispatch?: Dispatch<CustomerAction>): void;
|
|
50
46
|
}
|
|
47
|
+
export declare function saveCustomerUser({ customerEmail, order, updateOrder }: SaveCustomerUser): Promise<void>;
|
|
48
|
+
export declare type SetCustomerErrors = <V extends BaseError[]>(errors: V, dispatch?: Dispatch<CustomerAction>) => void;
|
|
51
49
|
export declare function setCustomerErrors(
|
|
52
50
|
/**
|
|
53
51
|
* @param errors - An array of errors
|
|
@@ -66,7 +64,7 @@ customerEmail: string,
|
|
|
66
64
|
* @param dispatch The dispatch function
|
|
67
65
|
*/
|
|
68
66
|
dispatch?: Dispatch<CustomerAction>): void;
|
|
69
|
-
export
|
|
67
|
+
export interface GetCustomerAddresses {
|
|
70
68
|
/**
|
|
71
69
|
* The Commerce Layer config
|
|
72
70
|
*/
|
|
@@ -75,16 +73,16 @@ export declare type GetCustomerAddresses = {
|
|
|
75
73
|
* The Customer dispatch function
|
|
76
74
|
*/
|
|
77
75
|
dispatch: Dispatch<CustomerAction>;
|
|
78
|
-
}
|
|
79
|
-
export declare function getCustomerAddresses({ config, dispatch
|
|
80
|
-
export
|
|
76
|
+
}
|
|
77
|
+
export declare function getCustomerAddresses({ config, dispatch }: GetCustomerAddresses): Promise<void>;
|
|
78
|
+
export interface DeleteCustomerAddress {
|
|
81
79
|
config?: CommerceLayerConfig;
|
|
82
80
|
dispatch?: Dispatch<CustomerAction>;
|
|
83
81
|
customerAddressId: string;
|
|
84
82
|
addresses?: Address[];
|
|
85
|
-
}
|
|
86
|
-
export declare function deleteCustomerAddress({ config, dispatch, customerAddressId, addresses
|
|
87
|
-
export
|
|
83
|
+
}
|
|
84
|
+
export declare function deleteCustomerAddress({ config, dispatch, customerAddressId, addresses }: DeleteCustomerAddress): Promise<void>;
|
|
85
|
+
export interface GetCustomerPaymentSources {
|
|
88
86
|
/**
|
|
89
87
|
* The Customer dispatch function
|
|
90
88
|
*/
|
|
@@ -93,7 +91,7 @@ export declare type GetCustomerPaymentSources = {
|
|
|
93
91
|
* The Commerce Layer Order resource
|
|
94
92
|
*/
|
|
95
93
|
order?: Order;
|
|
96
|
-
}
|
|
94
|
+
}
|
|
97
95
|
export declare function getCustomerPaymentSources(params?: GetCustomerPaymentSources): void;
|
|
98
96
|
export declare type GetCustomerOrders = (params: {
|
|
99
97
|
/**
|
|
@@ -107,7 +105,7 @@ export declare type GetCustomerOrders = (params: {
|
|
|
107
105
|
}) => Promise<void>;
|
|
108
106
|
export declare const getCustomerOrders: GetCustomerOrders;
|
|
109
107
|
export declare type TCustomerAddress = AddressCreate & AddressUpdate;
|
|
110
|
-
|
|
108
|
+
interface TCreateCustomerAddress {
|
|
111
109
|
/**
|
|
112
110
|
* Customer address dispatch function
|
|
113
111
|
*/
|
|
@@ -124,8 +122,8 @@ declare type TCreateCustomerAddress = {
|
|
|
124
122
|
* Current state of the customer
|
|
125
123
|
*/
|
|
126
124
|
state?: CustomerState;
|
|
127
|
-
}
|
|
128
|
-
export declare function createCustomerAddress({ address, config, dispatch, state
|
|
125
|
+
}
|
|
126
|
+
export declare function createCustomerAddress({ address, config, dispatch, state }: TCreateCustomerAddress): Promise<void>;
|
|
129
127
|
export declare const customerInitialState: CustomerState;
|
|
130
128
|
declare const customerReducer: (state: CustomerState, reducer: CustomerAction) => CustomerState;
|
|
131
129
|
export default customerReducer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import baseReducer from"../utils/baseReducer";import getSdk from"../utils/getSdk";import getErrors from"../utils/getErrors";import jwtDecode from"../utils/jwt";export async function saveCustomerUser({customerEmail,order,updateOrder}){if(order){const attributes={customer_email:customerEmail,id:order.id};await updateOrder({id:order.id,attributes})}}export function setCustomerErrors(errors,dispatch){dispatch&&dispatch({type:"setErrors",payload:{errors}})}export function setCustomerEmail(customerEmail,dispatch){dispatch&&dispatch({type:"setCustomerEmail",payload:{customerEmail}})}export async function getCustomerAddresses({config,dispatch}){try{const addresses=[];(await getSdk(config).customer_addresses.list({include:["address"]})).forEach(customerAddress=>{customerAddress.address&&addresses.push(customerAddress.address)}),addresses.sort((a,b)=>a.full_name&&b.full_name?a.full_name.localeCompare(b.full_name):0),dispatch({type:"setAddresses",payload:{addresses}})}catch(error){const errors=getErrors(error,"addresses");dispatch({type:"setErrors",payload:{errors}})}}export async function deleteCustomerAddress({config,dispatch,customerAddressId,addresses}){if(config&&addresses&&dispatch&&config)try{await getSdk(config).customer_addresses.delete(customerAddressId);const newAddresses=addresses.filter(({reference})=>reference!==customerAddressId);dispatch({type:"setAddresses",payload:{addresses:newAddresses}})}catch{throw new Error("Couldn't delete address")}}export function getCustomerPaymentSources(params){if(params){const{order,dispatch}=params;order?.available_customer_payment_sources&&dispatch&&dispatch({type:"setPayments",payload:{payments:order.available_customer_payment_sources}})}}export const getCustomerOrders=async({config,dispatch})=>{if(config.accessToken){const{owner}=jwtDecode(config.accessToken);if(owner?.id){const customers=await getSdk(config).customers.retrieve(owner.id,{include:["orders"]}),orders=customers.orders?.filter(order=>order.status!=="pending"&&order.status!=="draft");dispatch({type:"setOrders",payload:{orders,customers}})}}};export async function createCustomerAddress({address,config,dispatch,state}){if(config&&address){const sdk=getSdk(config),{id}=address;try{if(id){const upAddress=await sdk.addresses.update(address),updatedAddresses=state?.addresses?.map(a=>a.id===upAddress.id?upAddress:a);dispatch&&dispatch({type:"setAddresses",payload:{addresses:updatedAddresses}})}else{const newAddress=await sdk.addresses.create(address);if(state?.customers?.id&&newAddress?.id){const newCustomerAddress=await sdk.customer_addresses.create({customer:sdk.customers.relationship(state?.customers?.id),address:sdk.addresses.relationship(newAddress.id)});await sdk.addresses.update({id:newAddress.id,reference:newCustomerAddress.id}),dispatch&&state?.addresses&&(newAddress.reference=newCustomerAddress.id,dispatch({type:"setAddresses",payload:{addresses:[...state.addresses,newAddress]}}))}}}catch{throw new Error("Couldn't create customer address")}}}export const customerInitialState={errors:[],addresses:[],payments:[]
|
|
1
|
+
import baseReducer from"../utils/baseReducer";import getSdk from"../utils/getSdk";import getErrors from"../utils/getErrors";import jwtDecode from"../utils/jwt";export async function saveCustomerUser({customerEmail,order,updateOrder}){if(order){const attributes={customer_email:customerEmail,id:order.id};await updateOrder({id:order.id,attributes})}}export function setCustomerErrors(errors,dispatch){dispatch&&dispatch({type:"setErrors",payload:{errors}})}export function setCustomerEmail(customerEmail,dispatch){dispatch&&dispatch({type:"setCustomerEmail",payload:{customerEmail}})}export async function getCustomerAddresses({config,dispatch}){try{const addresses=[];(await getSdk(config).customer_addresses.list({include:["address"]})).forEach(customerAddress=>{customerAddress.address&&addresses.push(customerAddress.address)}),addresses.sort((a,b)=>a.full_name&&b.full_name?a.full_name.localeCompare(b.full_name):0),dispatch({type:"setAddresses",payload:{addresses}})}catch(error){const errors=getErrors(error,"addresses");dispatch({type:"setErrors",payload:{errors}})}}export async function deleteCustomerAddress({config,dispatch,customerAddressId,addresses}){if(config&&addresses&&dispatch&&config)try{await getSdk(config).customer_addresses.delete(customerAddressId);const newAddresses=addresses.filter(({reference})=>reference!==customerAddressId);dispatch({type:"setAddresses",payload:{addresses:newAddresses}})}catch{throw new Error("Couldn't delete address")}}export function getCustomerPaymentSources(params){if(params){const{order,dispatch}=params;order?.available_customer_payment_sources&&dispatch&&dispatch({type:"setPayments",payload:{payments:order.available_customer_payment_sources}})}}export const getCustomerOrders=async({config,dispatch})=>{if(config.accessToken){const{owner}=jwtDecode(config.accessToken);if(owner?.id){const customers=await getSdk(config).customers.retrieve(owner.id,{include:["orders"]}),orders=customers.orders?.filter(order=>order.status!=="pending"&&order.status!=="draft");dispatch({type:"setOrders",payload:{orders,customers}})}}};export async function createCustomerAddress({address,config,dispatch,state}){if(config&&address){const sdk=getSdk(config),{id}=address;try{if(id){const upAddress=await sdk.addresses.update(address),updatedAddresses=state?.addresses?.map(a=>a.id===upAddress.id?upAddress:a);dispatch&&dispatch({type:"setAddresses",payload:{addresses:updatedAddresses}})}else{const newAddress=await sdk.addresses.create(address);if(state?.customers?.id&&newAddress?.id){const newCustomerAddress=await sdk.customer_addresses.create({customer:sdk.customers.relationship(state?.customers?.id),address:sdk.addresses.relationship(newAddress.id)});await sdk.addresses.update({id:newAddress.id,reference:newCustomerAddress.id}),dispatch&&state?.addresses&&(newAddress.reference=newCustomerAddress.id,dispatch({type:"setAddresses",payload:{addresses:[...state.addresses,newAddress]}}))}}}catch{throw new Error("Couldn't create customer address")}}}export const customerInitialState={errors:[],addresses:[],payments:[]};const type=["setErrors","setCustomerEmail","setAddresses","setPayments","setOrders"],customerReducer=(state,reducer)=>baseReducer(state,reducer,type);export default customerReducer;
|
|
@@ -15,13 +15,9 @@ export declare type GetOrderParams = Partial<{
|
|
|
15
15
|
persistKey: string;
|
|
16
16
|
state: OrderState;
|
|
17
17
|
}>;
|
|
18
|
-
export
|
|
19
|
-
(params: GetOrderParams): Promise<void | Order>;
|
|
20
|
-
}
|
|
18
|
+
export declare type GetOrder = (params: GetOrderParams) => Promise<void | Order>;
|
|
21
19
|
declare type CreateOrderParams = Pick<AddToCartParams, 'config' | 'dispatch' | 'persistKey' | 'state' | 'orderMetadata' | 'orderAttributes' | 'setLocalOrder'>;
|
|
22
|
-
export
|
|
23
|
-
(params?: CreateOrderParams): Promise<string>;
|
|
24
|
-
}
|
|
20
|
+
export declare type CreateOrder = (params?: CreateOrderParams) => Promise<string>;
|
|
25
21
|
export declare type AddToCartParams = Partial<{
|
|
26
22
|
bundleCode: string;
|
|
27
23
|
skuCode: string;
|
|
@@ -47,16 +43,10 @@ export declare type AddToCartReturn = Promise<{
|
|
|
47
43
|
success: boolean;
|
|
48
44
|
orderId: string | undefined;
|
|
49
45
|
}>;
|
|
50
|
-
export
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
export
|
|
54
|
-
(params: AddToCartImportParams): AddToCartReturn;
|
|
55
|
-
}
|
|
56
|
-
export interface UnsetOrderState {
|
|
57
|
-
(dispatch: Dispatch<OrderActions>): void;
|
|
58
|
-
}
|
|
59
|
-
export declare type ResourceIncluded = 'billing_address' | 'shipping_address' | 'line_items.line_item_options.sku_option' | 'line_items.item' | 'available_customer_payment_sources.payment_source' | 'shipments.available_shipping_methods' | 'shipments.stock_transfers' | 'shipments.stock_transfers.line_item' | 'shipments.shipment_line_items.line_item' | 'shipments.shipping_method' | 'shipments.stock_location' | 'payment_source' | 'available_payment_methods' | 'payment_method';
|
|
46
|
+
export declare type AddToCart = (params: AddToCartParams) => AddToCartReturn;
|
|
47
|
+
export declare type AddToCartImport = (params: AddToCartImportParams) => AddToCartReturn;
|
|
48
|
+
export declare type UnsetOrderState = (dispatch: Dispatch<OrderActions>) => void;
|
|
49
|
+
export declare type ResourceIncluded = 'billing_address' | 'shipping_address' | 'line_items.line_item_options.sku_option' | 'line_items.item' | 'available_customer_payment_sources.payment_source' | 'shipments.available_shipping_methods' | 'shipments.stock_transfers' | 'shipments.stock_transfers.line_item' | 'shipments.shipment_line_items.line_item' | 'shipments.shipping_method' | 'shipments.stock_location' | 'shipments.parcels' | 'payment_source' | 'available_payment_methods' | 'payment_method';
|
|
60
50
|
declare type ResourceIncludedLoaded = Partial<Record<ResourceIncluded, boolean>>;
|
|
61
51
|
export interface OrderPayload {
|
|
62
52
|
loading?: boolean;
|
|
@@ -78,15 +68,15 @@ export interface OrderActions {
|
|
|
78
68
|
export declare type OrderActionType = 'setLoading' | 'setOrderId' | 'setOrder' | 'setSingleQuantity' | 'setCurrentSkuCodes' | 'setCurrentSkuPrices' | 'setCurrentItem' | 'setErrors' | 'setSaveAddressToCustomerAddressBook' | 'setGiftCardOrCouponCode' | 'setIncludesResource';
|
|
79
69
|
export declare const createOrder: CreateOrder;
|
|
80
70
|
export declare const getApiOrder: GetOrder;
|
|
81
|
-
export
|
|
71
|
+
export interface UpdateOrderArgs {
|
|
82
72
|
id: string;
|
|
83
73
|
attributes: Omit<OrderUpdate, 'id'>;
|
|
84
74
|
dispatch?: Dispatch<OrderActions>;
|
|
85
75
|
include?: string[];
|
|
86
76
|
config?: CommerceLayerConfig;
|
|
87
77
|
state?: OrderState;
|
|
88
|
-
}
|
|
89
|
-
export declare function updateOrder({ id, attributes, dispatch, config, include, state
|
|
78
|
+
}
|
|
79
|
+
export declare function updateOrder({ id, attributes, dispatch, config, include, state }: UpdateOrderArgs): Promise<{
|
|
90
80
|
success: boolean;
|
|
91
81
|
error?: undefined;
|
|
92
82
|
} | {
|
|
@@ -94,20 +84,20 @@ export declare function updateOrder({ id, attributes, dispatch, config, include,
|
|
|
94
84
|
error: unknown;
|
|
95
85
|
}>;
|
|
96
86
|
export declare const setOrder: (order: Order, dispatch?: Dispatch<OrderActions>) => void;
|
|
97
|
-
export
|
|
87
|
+
export interface AddResourceToInclude {
|
|
98
88
|
resourcesIncluded?: ResourceIncluded[];
|
|
99
89
|
dispatch?: Dispatch<OrderActions>;
|
|
100
90
|
newResource?: ResourceIncluded | ResourceIncluded[];
|
|
101
91
|
resourceIncludedLoaded?: ResourceIncludedLoaded;
|
|
102
92
|
newResourceLoaded?: ResourceIncludedLoaded;
|
|
103
|
-
}
|
|
104
|
-
export declare function addResourceToInclude({ resourcesIncluded, dispatch, newResource, newResourceLoaded, resourceIncludedLoaded
|
|
93
|
+
}
|
|
94
|
+
export declare function addResourceToInclude({ resourcesIncluded, dispatch, newResource, newResourceLoaded, resourceIncludedLoaded }: AddResourceToInclude): void;
|
|
105
95
|
export declare const addToCart: AddToCart;
|
|
106
96
|
export declare const unsetOrderState: UnsetOrderState;
|
|
107
|
-
|
|
97
|
+
interface OrderErrors {
|
|
108
98
|
dispatch?: Dispatch<OrderActions>;
|
|
109
99
|
errors: BaseError[];
|
|
110
|
-
}
|
|
100
|
+
}
|
|
111
101
|
export declare function setOrderErrors({ dispatch, errors }: OrderErrors): {
|
|
112
102
|
success: boolean;
|
|
113
103
|
};
|
|
@@ -18,9 +18,7 @@ export interface ShipmentAction {
|
|
|
18
18
|
payload: Partial<ShipmentActionPayload>;
|
|
19
19
|
}
|
|
20
20
|
export declare const shipmentInitialState: ShipmentState;
|
|
21
|
-
export
|
|
22
|
-
<V extends BaseError[]>(errors: V, dispatch?: Dispatch<ShipmentAction>): void;
|
|
23
|
-
}
|
|
21
|
+
export declare type SetShipmentErrors = <V extends BaseError[]>(errors: V, dispatch?: Dispatch<ShipmentAction>) => void;
|
|
24
22
|
export declare const setShipmentErrors: SetShipmentErrors;
|
|
25
23
|
declare type GetShipments = (args: {
|
|
26
24
|
order: Order;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
-
import {
|
|
2
|
+
import { ChildrenFunction } from './index';
|
|
3
3
|
export declare type CodeErrorType = 'EMPTY_ERROR' | 'FILTER_NOT_ALLOWED' | 'FORBIDDEN' | 'INTERNAL_SERVER_ERROR' | 'INVALID_DATA_FORMAT' | 'INVALID_FIELD' | 'INVALID_FIELD_FORMAT' | 'INVALID_FIELD_VALUE' | 'INVALID_FILTERS_SYNTAX' | 'INVALID_FILTER_VALUE' | 'INVALID_INCLUDE' | 'INVALID_LINKS_OBJECT' | 'INVALID_PAGE_OBJECT' | 'INVALID_PAGE_VALUE' | 'INVALID_RESOURCE' | 'INVALID_RESOURCE_ID' | 'INVALID_SORT_CRITERIA' | 'INVALID_TOKEN' | 'KEY_NOT_INCLUDED_IN_URL' | 'KEY_ORDER_MISMATCH' | 'LOCKED' | 'NOT_ACCEPTABLE' | 'OUT_OF_STOCK' | 'PARAM_MISSING' | 'PARAM_NOT_ALLOWED' | 'PAYMENT_NOT_APPROVED_FOR_EXECUTION' | 'PAYMENT_INTENT_AUTHENTICATION_FAILURE' | 'RECORD_NOT_FOUND' | 'RECORD_NOT_FOUND' | 'RELATION_EXISTS' | 'NO_SHIPPING_METHODS' | 'SAVE_FAILED' | 'TYPE_MISMATCH' | 'UNAUTHORIZED' | 'UNSUPPORTED_MEDIA_TYPE' | 'VALIDATION_ERROR';
|
|
4
4
|
export declare type ResourceErrorType = 'addresses' | 'billing_address' | 'gift_cards' | 'gift_card_or_coupon_code' | 'line_items' | 'orders' | 'payment_methods' | 'prices' | 'shipments' | 'shipping_address' | 'customer_address' | 'sku_options' | 'variant';
|
|
5
5
|
export interface BaseError {
|
|
@@ -24,7 +24,7 @@ export declare const ErrorPropTypes: {
|
|
|
24
24
|
children: PropTypes.Requireable<(...args: any[]) => any>;
|
|
25
25
|
field: PropTypes.Requireable<string>;
|
|
26
26
|
};
|
|
27
|
-
declare type ErrorChildrenComponentProps =
|
|
27
|
+
declare type ErrorChildrenComponentProps = ChildrenFunction<Omit<ErrorComponentProps, 'children'> & {
|
|
28
28
|
errors: string[];
|
|
29
29
|
}>;
|
|
30
30
|
export declare type ErrorComponentProps = {
|
|
@@ -24,11 +24,11 @@ export declare const BaseSelectComponentPropTypes: {
|
|
|
24
24
|
};
|
|
25
25
|
export declare type SelectPlaceholder = Option;
|
|
26
26
|
declare type BaseSelectChildrenComponentProps = Omit<BaseSelectComponentProps, 'children'>;
|
|
27
|
-
|
|
27
|
+
interface Option {
|
|
28
28
|
label: string;
|
|
29
29
|
value: string | number;
|
|
30
30
|
disabled?: boolean;
|
|
31
|
-
}
|
|
31
|
+
}
|
|
32
32
|
export interface BaseSelectComponentProps {
|
|
33
33
|
children?: (props: BaseSelectChildrenComponentProps) => JSX.Element;
|
|
34
34
|
options: Option[];
|
|
@@ -67,9 +67,9 @@ export declare type LoaderType = string | ReactNode;
|
|
|
67
67
|
export declare const BMObject: PropTypes.Requireable<{
|
|
68
68
|
[x: string]: string | null | undefined;
|
|
69
69
|
}>;
|
|
70
|
-
export
|
|
70
|
+
export interface BaseMetadataObject {
|
|
71
71
|
[key: string]: string | undefined | null;
|
|
72
|
-
}
|
|
72
|
+
}
|
|
73
73
|
export declare type TimeFormat = 'days' | 'hours';
|
|
74
74
|
export declare type BaseComponent = InferProps<typeof BC>;
|
|
75
75
|
export interface BaseAction<A = string, P = Record<string, any>> {
|
|
@@ -81,15 +81,9 @@ export interface BaseState {
|
|
|
81
81
|
errors?: BaseError[];
|
|
82
82
|
}
|
|
83
83
|
export declare type BaseActionType<T = string> = T[];
|
|
84
|
-
export
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
export interface BaseReducer {
|
|
88
|
-
<S extends BaseState, A extends BaseAction, T extends BaseActionType>(state: S, action: A, type: T): S;
|
|
89
|
-
}
|
|
90
|
-
export interface BaseUnsetState<A> {
|
|
91
|
-
(dispatch: Dispatch<A>): void;
|
|
92
|
-
}
|
|
84
|
+
export declare type BFSetStateContainer<T> = <P extends T>(param: P) => void;
|
|
85
|
+
export declare type BaseReducer = <S extends BaseState, A extends BaseAction, T extends BaseActionType>(state: S, action: A, type: T) => S;
|
|
86
|
+
export declare type BaseUnsetState<A> = (dispatch: Dispatch<A>) => void;
|
|
93
87
|
export interface BaseMetadata {
|
|
94
88
|
[key: string]: string | undefined | null;
|
|
95
89
|
}
|
|
@@ -122,9 +116,7 @@ export declare type BaseAmountComponent = {
|
|
|
122
116
|
priceCents?: number;
|
|
123
117
|
labelFree?: string;
|
|
124
118
|
} & JSX.IntrinsicElements['span'];
|
|
125
|
-
export
|
|
126
|
-
(props: P): JSX.Element;
|
|
127
|
-
}
|
|
119
|
+
export declare type ChildrenFunction<P = Record<string, any>> = (props: P) => JSX.Element;
|
|
128
120
|
export declare type ExcludeTag<T extends keyof JSX.IntrinsicElements> = Exclude<keyof JSX.IntrinsicElements, T>;
|
|
129
121
|
export declare type ExtractTag<T extends keyof JSX.IntrinsicElements> = Extract<keyof JSX.IntrinsicElements, T>;
|
|
130
122
|
export declare type ConditionalElement<E> = ({
|
|
@@ -1,17 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { Price } from '@commercelayer/sdk';
|
|
2
|
-
import { Prices } from '../reducers/PriceReducer';
|
|
3
|
-
import { Items } from '../reducers/ItemReducer';
|
|
4
|
-
import { ReactNode } from 'react';
|
|
5
3
|
import { PTemplateProps } from '../components/utils/PriceTemplate';
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export declare const getPriceByCode: GetPriceByCode;
|
|
10
|
-
export interface GetPricesComponent {
|
|
11
|
-
(skuPrices: Price[], props: PTemplateProps): ReactNode;
|
|
12
|
-
}
|
|
13
|
-
export declare const getPricesComponent: GetPricesComponent;
|
|
14
|
-
export interface GetPrices {
|
|
15
|
-
(prices: Price[] | Items): Prices;
|
|
16
|
-
}
|
|
17
|
-
export default function getPrices<P extends Price>(prices: P[]): Record<string, any>;
|
|
4
|
+
export declare function getPriceByCode(skuPrices: Price[], code?: string): Price | undefined;
|
|
5
|
+
export declare function getPricesComponent(skuPrices: Price[], props: PTemplateProps): JSX.Element[] | JSX.Element;
|
|
6
|
+
export default function getPrices<P extends Price>(prices: P[]): Record<string, P[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createElement as _createElement}from"react";import{jsx as _jsx}from"react/jsx-runtime";import{isEmpty,first,isArray,has}from"lodash";import PriceTemplate from"../components/utils/PriceTemplate";export
|
|
1
|
+
import{createElement as _createElement}from"react";import{jsx as _jsx}from"react/jsx-runtime";import{isEmpty,first,isArray,has}from"lodash";import PriceTemplate from"../components/utils/PriceTemplate";export function getPriceByCode(skuPrices,code=""){return code?first(skuPrices.filter(p=>p.currency_code===code)):first(skuPrices)}export function getPricesComponent(skuPrices,props){return isEmpty(skuPrices)?_jsx(PriceTemplate,{...props}):skuPrices.map((p,k)=>{const showCompare=typeof props.showCompare>"u"&&p?.compare_at_amount_cents>p?.amount_cents||props.showCompare;return _createElement(PriceTemplate,{...props,key:k,showCompare,formattedAmount:p.formatted_amount,formattedCompare:p.formatted_compare_at_amount,skuCode:p.sku_code})})}export default function getPrices(prices){const obj={};return isArray(prices)&&prices.forEach(p=>{const sku=p.sku_code;has(obj,sku)?obj[sku].push(p):obj[sku]=[p]}),obj}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import Sdk from '@commercelayer/sdk';
|
|
2
2
|
import { CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
3
|
-
export default function getSdk({ endpoint, accessToken
|
|
3
|
+
export default function getSdk({ endpoint, accessToken }: CommerceLayerConfig): ReturnType<typeof Sdk>;
|