@commercelayer/react-components 4.0.0-alpha.5 → 4.0.0-alpha.7
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/Address.d.ts +4 -9
- package/lib/cjs/components/addresses/Address.js +1 -1
- package/lib/cjs/components/addresses/AddressField.d.ts +8 -12
- package/lib/cjs/components/addresses/AddressField.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/AddressesContainer.d.ts +2 -9
- package/lib/cjs/components/addresses/AddressesContainer.js +1 -1
- package/lib/cjs/components/addresses/AddressesEmpty.d.ts +14 -0
- package/lib/cjs/components/addresses/AddressesEmpty.js +1 -0
- 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/CustomerContainer.d.ts +2 -2
- package/lib/cjs/components/customers/CustomerContainer.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/OrderContainer.d.ts +4 -18
- package/lib/cjs/components/orders/OrderContainer.js +1 -1
- package/lib/cjs/components/orders/OrderList.d.ts +11 -12
- 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 +9 -5
- package/lib/cjs/components/orders/OrderListRow.js +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 +8 -8
- package/lib/cjs/components/utils/AddressCardsTemplate.js +1 -1
- 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/OrderContext.d.ts +3 -3
- 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 +36 -34
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/reducers/AddressReducer.d.ts +17 -23
- package/lib/cjs/reducers/AddressReducer.js +1 -1
- package/lib/cjs/reducers/CustomerReducer.d.ts +18 -20
- package/lib/cjs/reducers/CustomerReducer.js +1 -1
- package/lib/cjs/reducers/OrderReducer.d.ts +16 -29
- package/lib/cjs/reducers/OrderReducer.js +1 -1
- 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/addressesManager.d.ts +5 -4
- 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/Address.d.ts +4 -9
- package/lib/esm/components/addresses/Address.js +1 -1
- package/lib/esm/components/addresses/AddressField.d.ts +8 -12
- package/lib/esm/components/addresses/AddressField.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/AddressesContainer.d.ts +2 -9
- package/lib/esm/components/addresses/AddressesContainer.js +1 -1
- package/lib/esm/components/addresses/AddressesEmpty.d.ts +14 -0
- package/lib/esm/components/addresses/AddressesEmpty.js +1 -0
- 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/CustomerContainer.d.ts +2 -2
- package/lib/esm/components/customers/CustomerContainer.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/OrderContainer.d.ts +4 -18
- package/lib/esm/components/orders/OrderContainer.js +1 -1
- package/lib/esm/components/orders/OrderList.d.ts +11 -12
- 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 +9 -5
- package/lib/esm/components/orders/OrderListRow.js +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 +8 -8
- package/lib/esm/components/utils/AddressCardsTemplate.js +1 -1
- 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/OrderContext.d.ts +3 -3
- 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 +36 -34
- package/lib/esm/index.js +1 -1
- package/lib/esm/reducers/AddressReducer.d.ts +17 -23
- package/lib/esm/reducers/AddressReducer.js +1 -1
- package/lib/esm/reducers/CustomerReducer.d.ts +18 -20
- package/lib/esm/reducers/CustomerReducer.js +1 -1
- package/lib/esm/reducers/OrderReducer.d.ts +16 -29
- package/lib/esm/reducers/OrderReducer.js +1 -1
- 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/addressesManager.d.ts +5 -4
- 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
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { ChildrenFunction } from '../../typings/index';
|
|
3
|
+
interface CustomComponent extends Omit<Props, 'children'> {
|
|
4
|
+
}
|
|
4
5
|
declare type Props = {
|
|
5
|
-
children?: CustomComponent
|
|
6
|
+
children?: ChildrenFunction<CustomComponent>;
|
|
6
7
|
label?: string | ReactNode;
|
|
7
8
|
} & Omit<JSX.IntrinsicElements['button'], 'onClick'>;
|
|
8
9
|
export declare function PaymentSourceEditButton({ children, label, ...props }: Props): JSX.Element | null;
|
|
9
|
-
export declare namespace PaymentSourceEditButton {
|
|
10
|
-
var propTypes: {
|
|
11
|
-
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
12
|
-
label: import("prop-types").Requireable<NonNullable<string | import("prop-types").ReactElementLike | null | undefined>>;
|
|
13
|
-
};
|
|
14
|
-
var displayName: string;
|
|
15
|
-
}
|
|
16
10
|
export default PaymentSourceEditButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentSourceEditButton=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),PaymentSourceContext_1=tslib_1.__importDefault(require("../../context/PaymentSourceContext")),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("../utils/Parent"))
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentSourceEditButton=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),PaymentSourceContext_1=tslib_1.__importDefault(require("../../context/PaymentSourceContext")),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("../utils/Parent"));function PaymentSourceEditButton({children,label="Edit",...props}){const{showCard,handleEditClick,readonly}=(0,react_1.useContext)(PaymentSourceContext_1.default),parentProps={showCard,label,handleEditClick,...props};return children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}):readonly?null:(0,jsx_runtime_1.jsx)("button",{...props,onClick:handleEditClick,children:label})}exports.PaymentSourceEditButton=PaymentSourceEditButton,exports.default=PaymentSourceEditButton;
|
|
@@ -1,28 +1,16 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Price as PriceType } from '@commercelayer/sdk';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { ChildrenFunction, LoaderType } from '../../typings/index';
|
|
4
|
+
interface PriceChildrenProps extends Omit<PriceProps, 'children'> {
|
|
5
5
|
loading: boolean;
|
|
6
6
|
loader: LoaderType;
|
|
7
7
|
prices: PriceType[];
|
|
8
|
-
}
|
|
9
|
-
export
|
|
10
|
-
children?: PriceChildrenProps
|
|
8
|
+
}
|
|
9
|
+
export interface PriceProps extends Omit<JSX.IntrinsicElements['span'], 'children'> {
|
|
10
|
+
children?: ChildrenFunction<PriceChildrenProps>;
|
|
11
11
|
compareClassName?: string;
|
|
12
12
|
showCompare?: boolean;
|
|
13
13
|
skuCode?: string;
|
|
14
|
-
};
|
|
15
|
-
export declare function Price(props: PriceProps): JSX.Element;
|
|
16
|
-
export declare namespace Price {
|
|
17
|
-
var propTypes: {
|
|
18
|
-
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
19
|
-
compareClassName: import("prop-types").Requireable<string>;
|
|
20
|
-
skuCode: import("prop-types").Requireable<string>;
|
|
21
|
-
showCompare: import("prop-types").Requireable<boolean>;
|
|
22
|
-
};
|
|
23
|
-
var defaultProps: {
|
|
24
|
-
skuCode: string;
|
|
25
|
-
};
|
|
26
|
-
var displayName: string;
|
|
27
14
|
}
|
|
15
|
+
export declare function Price(props: PriceProps): JSX.Element;
|
|
28
16
|
export default Price;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Price=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Price=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),PricesContext_1=tslib_1.__importDefault(require("../../context/PricesContext")),react_1=require("react"),lodash_1=require("lodash"),getPrices_1=require("../../utils/getPrices"),SkuChildrenContext_1=tslib_1.__importDefault(require("../../context/SkuChildrenContext"));function Price(props){const{children,skuCode=""}=props,{prices,skuCode:pricesSkuCode,loading,skuCodes,setSkuCodes,loader}=(0,react_1.useContext)(PricesContext_1.default),{sku}=(0,react_1.useContext)(SkuChildrenContext_1.default),[skuPrices,setSkuPrices]=(0,react_1.useState)([]),sCode=pricesSkuCode||skuCode||sku?.code;(0,react_1.useEffect)(()=>(!(0,lodash_1.isEmpty)(prices)&&(0,lodash_1.has)(prices,`${sCode}`)?setSkuPrices(prices[sCode]):sCode&&(0,lodash_1.indexOf)(skuCodes,sCode)===-1&&(skuCodes.push(sCode),setSkuCodes&&setSkuCodes(skuCodes)),()=>{setSkuPrices([])}),[prices,sCode]);const parentProps={loading,loader,prices:skuPrices,...props},pricesComponent=(0,lodash_1.isEmpty)(prices)||(0,lodash_1.isEmpty)(skuPrices)?null:(0,getPrices_1.getPricesComponent)(skuPrices,props);return children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}):(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:loading||(0,lodash_1.isEmpty)(pricesComponent)?loader:pricesComponent})}exports.Price=Price,exports.default=Price;
|
|
@@ -1,27 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { LoaderType } from '../../typings/index';
|
|
3
|
-
|
|
4
|
-
children:
|
|
3
|
+
interface Props {
|
|
4
|
+
children: JSX.Element | JSX.Element[];
|
|
5
5
|
filters?: object;
|
|
6
6
|
loader?: LoaderType;
|
|
7
7
|
perPage?: number;
|
|
8
8
|
skuCode?: string;
|
|
9
|
-
};
|
|
10
|
-
export declare function PricesContainer(props: Props): JSX.Element;
|
|
11
|
-
export declare namespace PricesContainer {
|
|
12
|
-
var propTypes: {
|
|
13
|
-
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
14
|
-
skuCode: import("prop-types").Requireable<string>;
|
|
15
|
-
loader: import("prop-types").Requireable<NonNullable<string | import("prop-types").ReactElementLike | null | undefined>>;
|
|
16
|
-
perPage: import("prop-types").Requireable<number>;
|
|
17
|
-
filters: import("prop-types").Requireable<object>;
|
|
18
|
-
};
|
|
19
|
-
var defaultProps: {
|
|
20
|
-
perPage: number;
|
|
21
|
-
filters: {};
|
|
22
|
-
loader: string;
|
|
23
|
-
skuCode: string;
|
|
24
|
-
};
|
|
25
|
-
var displayName: string;
|
|
26
9
|
}
|
|
10
|
+
export declare function PricesContainer(props: Props): JSX.Element;
|
|
27
11
|
export default PricesContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PricesContainer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),getPrices_1=tslib_1.__importDefault(require("../../utils/getPrices")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),has_1=tslib_1.__importDefault(require("lodash/has")),indexOf_1=tslib_1.__importDefault(require("lodash/indexOf")),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),PriceReducer_1=tslib_1.__importStar(require("../../reducers/PriceReducer")),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PricesContainer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),getPrices_1=tslib_1.__importDefault(require("../../utils/getPrices")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),has_1=tslib_1.__importDefault(require("lodash/has")),indexOf_1=tslib_1.__importDefault(require("lodash/indexOf")),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),PriceReducer_1=tslib_1.__importStar(require("../../reducers/PriceReducer")),PricesContext_1=tslib_1.__importDefault(require("../../context/PricesContext")),getCurrentItemKey_1=tslib_1.__importDefault(require("../../utils/getCurrentItemKey")),ItemContext_1=tslib_1.__importDefault(require("../../context/ItemContext")),SkuContext_1=tslib_1.__importDefault(require("../../context/SkuContext"));function PricesContainer(props){const{children,skuCode="",loader="Loading...",perPage=10,filters={}}=props,[state,dispatch]=(0,react_1.useReducer)(PriceReducer_1.default,PriceReducer_1.priceInitialState),config=(0,react_1.useContext)(CommerceLayerContext_1.default),{skuCodes}=(0,react_1.useContext)(SkuContext_1.default),{setPrices,prices,items,item:currentItem,skuCode:itemSkuCode}=(0,react_1.useContext)(ItemContext_1.default);(0,indexOf_1.default)(state.skuCodes,skuCode)===-1&&skuCode&&state.skuCodes.push(skuCode);const sCode=skuCodes&&skuCodes?.length>0?"":skuCode||(0,getCurrentItemKey_1.default)(currentItem)||itemSkuCode||"",setSkuCodes=skuCodes2=>{dispatch({type:"setSkuCodes",payload:{skuCodes:skuCodes2}})};(0,react_1.useEffect)(()=>{if(state.skuCodes.length===0&&skuCodes&&skuCodes.length>0&&setSkuCodes(skuCodes),currentItem&&(0,has_1.default)(prices,sCode)&&dispatch({type:"setPrices",payload:{prices}}),!(0,isEmpty_1.default)(items)&&(0,isEmpty_1.default)(currentItem)){const p=(0,getPrices_1.default)(items);dispatch({type:"setPrices",payload:{prices:p}})}return config.accessToken&&!(0,has_1.default)(prices,itemSkuCode||sCode)&&(state.skuCodes.length>0||itemSkuCode||sCode)&&(0,PriceReducer_1.getSkusPrice)(sCode&&[itemSkuCode||sCode]||state.skuCodes,{config,dispatch,setPrices,prices,perPage,filters}),config.accessToken&&(0,isEmpty_1.default)(currentItem)&&(state.skuCodes.length>0||skuCode)&&(0,PriceReducer_1.getSkusPrice)(sCode&&[sCode]||state.skuCodes,{config,dispatch,setPrices,prices,perPage,filters}),()=>{(0,isEmpty_1.default)(currentItem)&&(0,PriceReducer_1.unsetPriceState)(dispatch)}},[config.accessToken,currentItem,sCode,state.skuCodes.length,itemSkuCode]);const priceValue={...state,skuCode:sCode,loader,setSkuCodes};return(0,jsx_runtime_1.jsx)(PricesContext_1.default.Provider,{value:priceValue,children})}exports.PricesContainer=PricesContainer,exports.default=PricesContainer;
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { LoaderType } from '../../typings/index';
|
|
3
|
-
|
|
3
|
+
interface ShipmentProps {
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
loader?: LoaderType;
|
|
6
6
|
autoSelectSingleShippingMethod?: boolean | (() => void);
|
|
7
|
-
};
|
|
8
|
-
export declare function Shipment({ children, loader, autoSelectSingleShippingMethod, }: ShipmentProps): JSX.Element;
|
|
9
|
-
export declare namespace Shipment {
|
|
10
|
-
var propTypes: {
|
|
11
|
-
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
12
|
-
};
|
|
13
|
-
var displayName: string;
|
|
14
7
|
}
|
|
8
|
+
export declare function Shipment({ children, loader, autoSelectSingleShippingMethod }: ShipmentProps): JSX.Element;
|
|
15
9
|
export default Shipment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Shipment=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),ShipmentContext_1=tslib_1.__importDefault(require("../../context/ShipmentContext")),ShipmentChildrenContext_1=tslib_1.__importDefault(require("../../context/ShipmentChildrenContext")),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Shipment=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),ShipmentContext_1=tslib_1.__importDefault(require("../../context/ShipmentContext")),ShipmentChildrenContext_1=tslib_1.__importDefault(require("../../context/ShipmentChildrenContext")),getLoaderComponent_1=tslib_1.__importDefault(require("../../utils/getLoaderComponent"));function Shipment({children,loader="Loading...",autoSelectSingleShippingMethod=!1}){const[loading,setLoading]=(0,react_1.useState)(!0),{shipments,deliveryLeadTimes,setShippingMethod}=(0,react_1.useContext)(ShipmentContext_1.default);(0,react_1.useEffect)(()=>{shipments&&(autoSelectSingleShippingMethod?(async()=>shipments.forEach(async shipment=>{const isSingle=shipment?.available_shipping_methods?.length===1;if(!shipment?.shipping_method&&isSingle){const[shippingMethod]=shipment?.available_shipping_methods||[];shippingMethod&&await setShippingMethod(shipment.id,shippingMethod.id),typeof autoSelectSingleShippingMethod=="function"&&autoSelectSingleShippingMethod()}else setTimeout(()=>{setLoading(!1)},200)}))():setLoading(!1))},[shipments]);const components=shipments?.map((shipment,k)=>{const lineItems=shipment.shipment_line_items?.map(shipmentLineItem=>{const l=shipmentLineItem.line_item;return l&&(l.quantity=shipmentLineItem.quantity),l}),shippingMethods=shipment.available_shipping_methods,currentShippingMethodId=autoSelectSingleShippingMethod&&shippingMethods&&shippingMethods.length===1?shippingMethods[0]?.id:shipment.shipping_method?.id,stockTransfers=shipment.stock_transfers,parcels=shipment.parcels,times=deliveryLeadTimes?.filter(time=>time.stock_location?.id===shipment.stock_location?.id),shipmentProps={parcels,lineItems,shippingMethods,currentShippingMethodId,stockTransfers,deliveryLeadTimes:times,shipment,keyNumber:k+1};return(0,jsx_runtime_1.jsx)(ShipmentChildrenContext_1.default.Provider,{value:shipmentProps,children},k)});return loading?(0,getLoaderComponent_1.default)(loader):(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:components})}exports.Shipment=Shipment,exports.default=Shipment;
|
|
@@ -9,11 +9,4 @@ declare type Props = {
|
|
|
9
9
|
name: ShipmentAttribute;
|
|
10
10
|
} & JSX.IntrinsicElements['span'];
|
|
11
11
|
export declare function ShipmentField(props: Props): JSX.Element;
|
|
12
|
-
export declare namespace ShipmentField {
|
|
13
|
-
var propTypes: {
|
|
14
|
-
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
15
|
-
name: import("prop-types").Validator<NonNullable<ShipmentAttribute>>;
|
|
16
|
-
};
|
|
17
|
-
var displayName: string;
|
|
18
|
-
}
|
|
19
12
|
export default ShipmentField;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShipmentField=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShipmentField=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),get_1=tslib_1.__importDefault(require("lodash/get")),ShipmentChildrenContext_1=tslib_1.__importDefault(require("../../context/ShipmentChildrenContext"));function ShipmentField(props){const{name}=props,{shipment,keyNumber}=(0,react_1.useContext)(ShipmentChildrenContext_1.default),key=name,text=key!=="key_number"?(0,get_1.default)(shipment,key):keyNumber,parentProps={shipment,...props};return props.children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children:props.children}):(0,jsx_runtime_1.jsx)("span",{...props,children:text})}exports.ShipmentField=ShipmentField,exports.default=ShipmentField;
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
|
|
2
|
+
interface Props {
|
|
3
3
|
children: ReactNode;
|
|
4
|
-
};
|
|
5
|
-
export declare function ShipmentsContainer(props: Props): JSX.Element;
|
|
6
|
-
export declare namespace ShipmentsContainer {
|
|
7
|
-
var propTypes: {
|
|
8
|
-
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
9
|
-
};
|
|
10
|
-
var displayName: string;
|
|
11
4
|
}
|
|
5
|
+
export declare function ShipmentsContainer(props: Props): JSX.Element;
|
|
12
6
|
export default ShipmentsContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShipmentsContainer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),ShipmentContext_1=tslib_1.__importStar(require("../../context/ShipmentContext")),react_1=require("react"),ShipmentReducer_1=tslib_1.__importStar(require("../../reducers/ShipmentReducer")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShipmentsContainer=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),ShipmentContext_1=tslib_1.__importStar(require("../../context/ShipmentContext")),react_1=require("react"),ShipmentReducer_1=tslib_1.__importStar(require("../../reducers/ShipmentReducer")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty"));function ShipmentsContainer(props){const{children}=props,[state,dispatch]=(0,react_1.useReducer)(ShipmentReducer_1.default,ShipmentReducer_1.shipmentInitialState),{order,getOrder,include,addResourceToInclude,includeLoaded}=(0,react_1.useContext)(OrderContext_1.default),config=(0,react_1.useContext)(CommerceLayerContext_1.default);(0,react_1.useEffect)(()=>{include?.includes("shipments.available_shipping_methods")?includeLoaded?.["shipments.available_shipping_methods"]||addResourceToInclude({newResourceLoaded:{"shipments.available_shipping_methods":!0,"shipments.shipment_line_items.line_item":!0,"shipments.shipping_method":!0,"shipments.stock_transfers.line_item":!0,"shipments.stock_location":!0,"shipments.parcels":!0}}):addResourceToInclude({newResource:["shipments.available_shipping_methods","shipments.shipment_line_items.line_item","shipments.shipping_method","shipments.stock_transfers.line_item","shipments.stock_location","shipments.parcels"]}),order&&!(0,isEmpty_1.default)(config)&&order.shipments&&(0,ShipmentReducer_1.getShipments)({order,dispatch,config})},[order,include,includeLoaded]),(0,react_1.useEffect)(()=>(order&&(order.shipments&&order.shipments.length>0&&order.shipments.map(shipment=>shipment.available_shipping_methods&&shipment.available_shipping_methods.length>0).includes(!1)&&(0,ShipmentReducer_1.setShipmentErrors)([...state.errors||[],{code:"NO_SHIPPING_METHODS",message:"No shipping methods",resource:"shipments"}],dispatch),order.line_items&&order.line_items.length>0&&order.line_items.filter(({item_type:itemType})=>itemType==="skus").map(lineItem=>!!(lineItem.item?.do_not_ship||lineItem.item?.do_not_track||lineItem.item?.inventory?.quantity>=lineItem?.quantity)).includes(!1)&&(0,ShipmentReducer_1.setShipmentErrors)([...state.errors||[],{code:"OUT_OF_STOCK",message:"No stock available",resource:"line_items"}],dispatch)),()=>{(0,ShipmentReducer_1.setShipmentErrors)([],dispatch)}),[order?.shipments]);const contextValue={...state,setShipmentErrors:errors=>ShipmentContext_1.defaultShipmentContext.setShipmentErrors(errors,dispatch),setShippingMethod:async(shipmentId,shippingMethodId)=>await(0,ShipmentReducer_1.setShippingMethod)({shippingMethodId,shipmentId,config,getOrder,order})};return(0,jsx_runtime_1.jsx)(ShipmentContext_1.default.Provider,{value:contextValue,children})}exports.ShipmentsContainer=ShipmentsContainer,exports.default=ShipmentsContainer;
|
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
|
|
2
|
+
interface Props {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
readonly?: boolean;
|
|
5
5
|
emptyText?: string;
|
|
6
|
-
};
|
|
7
|
-
export declare function ShippingMethod(props: Props): JSX.Element;
|
|
8
|
-
export declare namespace ShippingMethod {
|
|
9
|
-
var propTypes: {
|
|
10
|
-
children: import("prop-types").Validator<NonNullable<ReactNode | (() => JSX.Element)>>;
|
|
11
|
-
readonly: import("prop-types").Requireable<boolean>;
|
|
12
|
-
};
|
|
13
|
-
var displayName: string;
|
|
14
6
|
}
|
|
7
|
+
export declare function ShippingMethod(props: Props): JSX.Element;
|
|
15
8
|
export default ShippingMethod;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShippingMethod=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")),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShippingMethod=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")),ShipmentChildrenContext_1=tslib_1.__importDefault(require("../../context/ShipmentChildrenContext")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty"));function ShippingMethod(props){const{children,readonly,emptyText="There are not any shipping method available"}=props,{shippingMethods,currentShippingMethodId,deliveryLeadTimes,shipment}=(0,react_1.useContext)(ShipmentChildrenContext_1.default),[items,setItems]=(0,react_1.useState)([]);(0,react_1.useEffect)(()=>{const methods=shippingMethods?.filter(s=>readonly?s.id===currentShippingMethodId:!0).map((shippingMethod,k)=>{const[deliveryLeadTimeForShipment]=deliveryLeadTimes?.filter(delivery=>{const deliveryShippingMethodId=delivery.shipping_method?.id;return shippingMethod.id===deliveryShippingMethodId}),shippingProps={shipmentId:shipment?.id,shippingMethod,currentShippingMethodId,deliveryLeadTimeForShipment};return(0,jsx_runtime_1.jsx)(ShippingMethodChildrenContext_1.default.Provider,{value:shippingProps,children},k)});methods&&setItems(methods)},[currentShippingMethodId,deliveryLeadTimes,shippingMethods]);const components=!(0,isEmpty_1.default)(items)&&items||emptyText;return(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:components})}exports.ShippingMethod=ShippingMethod,exports.default=ShippingMethod;
|
|
@@ -8,10 +8,4 @@ declare type Props = {
|
|
|
8
8
|
children?: (props: ChildrenProps) => JSX.Element;
|
|
9
9
|
} & JSX.IntrinsicElements['label'];
|
|
10
10
|
export declare function ShippingMethodName(props: Props): JSX.Element;
|
|
11
|
-
export declare namespace ShippingMethodName {
|
|
12
|
-
var propTypes: {
|
|
13
|
-
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
14
|
-
};
|
|
15
|
-
var displayName: string;
|
|
16
|
-
}
|
|
17
11
|
export default ShippingMethodName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShippingMethodName=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"))
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ShippingMethodName=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 ShippingMethodName(props){const{shippingMethod,deliveryLeadTimeForShipment,shipmentId}=(0,react_1.useContext)(ShippingMethodChildrenContext_1.default),htmlFor=`shipment-${shipmentId??""}-${shippingMethod?.id??""}`||"",labelName=shippingMethod?.name,parentProps={shippingMethod,deliveryLeadTimeForShipment,label:labelName,htmlFor,...props};return props.children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children:props.children}):(0,jsx_runtime_1.jsx)("label",{htmlFor,...props,children:labelName})}exports.ShippingMethodName=ShippingMethodName,exports.default=ShippingMethodName;
|
|
@@ -1,24 +1,15 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { TimeFormat,
|
|
2
|
+
import { TimeFormat, ChildrenFunction } from '../../typings/index';
|
|
3
3
|
import { DeliveryLeadTime } from '../../reducers/AvailabilityReducer';
|
|
4
|
-
|
|
4
|
+
interface AvailabilityTemplateChildrenProps extends Omit<Props, 'children'>, DeliveryLeadTime {
|
|
5
5
|
text: string;
|
|
6
6
|
quantity: number;
|
|
7
|
-
}
|
|
7
|
+
}
|
|
8
8
|
declare type Props = {
|
|
9
|
-
children?: AvailabilityTemplateChildrenProps
|
|
9
|
+
children?: ChildrenFunction<AvailabilityTemplateChildrenProps>;
|
|
10
10
|
timeFormat?: TimeFormat;
|
|
11
11
|
showShippingMethodName?: boolean;
|
|
12
12
|
showShippingMethodPrice?: boolean;
|
|
13
13
|
} & JSX.IntrinsicElements['p'];
|
|
14
14
|
export declare function AvailabilityTemplate(props: Props): JSX.Element;
|
|
15
|
-
export declare namespace AvailabilityTemplate {
|
|
16
|
-
var propTypes: {
|
|
17
|
-
timeFormat: import("prop-types").Requireable<TimeFormat>;
|
|
18
|
-
showShippingMethodName: import("prop-types").Requireable<boolean>;
|
|
19
|
-
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
20
|
-
};
|
|
21
|
-
var defaultProps: Props;
|
|
22
|
-
var displayName: string;
|
|
23
|
-
}
|
|
24
15
|
export default AvailabilityTemplate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AvailabilityTemplate=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),AvailabilityContext_1=tslib_1.__importDefault(require("../../context/AvailabilityContext")),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),lodash_1=require("lodash"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AvailabilityTemplate=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),AvailabilityContext_1=tslib_1.__importDefault(require("../../context/AvailabilityContext")),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),lodash_1=require("lodash"),ItemContext_1=tslib_1.__importDefault(require("../../context/ItemContext")),SkuChildrenContext_1=tslib_1.__importDefault(require("../../context/SkuChildrenContext"));function AvailabilityTemplate(props){const{timeFormat,showShippingMethodName,showShippingMethodPrice,children,...p}=props;let{min,max,shipping_method:shippingMethod,quantity}=(0,react_1.useContext)(AvailabilityContext_1.default);const{item}=(0,react_1.useContext)(ItemContext_1.default),{sku}=(0,react_1.useContext)(SkuChildrenContext_1.default),text=[];if(item&&sku){const code=sku.code,currentItem=item[code];if(currentItem){const[level]=currentItem.inventory?.levels||[],[delivery]=level?.delivery_lead_times||[];delivery&&(min=delivery?.min,max=delivery?.max,shippingMethod=delivery?.shipping_method),quantity=currentItem.inventory.quantity}}const mn=!(0,lodash_1.isEmpty)(min)&&timeFormat?min?.[timeFormat]:"",mx=!(0,lodash_1.isEmpty)(max)&&timeFormat?max?.[timeFormat]:"",shippingMethodPrice=showShippingMethodPrice&&shippingMethod?.formatted_price_amount?`(${shippingMethod?.formatted_price_amount})`:"",name=showShippingMethodName&&shippingMethod?`with ${shippingMethod.name}`:"";quantity&&quantity>0?(text.push("Available"),mn&&mx&&text.push(`in ${mn} - ${mx} ${timeFormat??""} ${name} ${shippingMethodPrice}`)):quantity===0&&text.push("Out of stock");const parentProps={min,max,shipping_method:shippingMethod,quantity,text:text.join(" "),...props};return children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}):(0,jsx_runtime_1.jsx)("p",{...p,children:text.join(" ")})}exports.AvailabilityTemplate=AvailabilityTemplate,exports.default=AvailabilityTemplate;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { ChildrenFunction } from '../../typings/index';
|
|
3
|
+
interface ChildrenProps extends Omit<Props, 'children'> {
|
|
4
4
|
handleChange: (event: React.MouseEvent<HTMLInputElement>) => void;
|
|
5
5
|
handleBlur: (event: React.MouseEvent<HTMLInputElement>) => void;
|
|
6
|
-
}
|
|
6
|
+
}
|
|
7
7
|
declare type Props = {
|
|
8
|
-
children?: ChildrenProps
|
|
8
|
+
children?: ChildrenFunction<ChildrenProps>;
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
min?: number;
|
|
11
11
|
max?: number;
|
|
@@ -14,18 +14,4 @@ declare type Props = {
|
|
|
14
14
|
skuListId?: string;
|
|
15
15
|
} & JSX.IntrinsicElements['input'];
|
|
16
16
|
export declare function QuantitySelector(props: Props): JSX.Element;
|
|
17
|
-
export declare namespace QuantitySelector {
|
|
18
|
-
var propTypes: {
|
|
19
|
-
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
20
|
-
min: import("prop-types").Requireable<number>;
|
|
21
|
-
max: import("prop-types").Requireable<number>;
|
|
22
|
-
value: import("prop-types").Requireable<string>;
|
|
23
|
-
skuCode: import("prop-types").Requireable<string>;
|
|
24
|
-
disabled: import("prop-types").Requireable<boolean>;
|
|
25
|
-
};
|
|
26
|
-
var defaultProps: {
|
|
27
|
-
min: number;
|
|
28
|
-
};
|
|
29
|
-
var displayName: string;
|
|
30
|
-
}
|
|
31
17
|
export default QuantitySelector;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.QuantitySelector=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),has_1=tslib_1.__importDefault(require("lodash/has")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),getCurrentItemKey_1=tslib_1.__importDefault(require("../../utils/getCurrentItemKey")),ItemContext_1=tslib_1.__importDefault(require("../../context/ItemContext")),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.QuantitySelector=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),has_1=tslib_1.__importDefault(require("lodash/has")),isEmpty_1=tslib_1.__importDefault(require("lodash/isEmpty")),getCurrentItemKey_1=tslib_1.__importDefault(require("../../utils/getCurrentItemKey")),ItemContext_1=tslib_1.__importDefault(require("../../context/ItemContext")),SkuListsContext_1=tslib_1.__importDefault(require("../../context/SkuListsContext")),SkuChildrenContext_1=tslib_1.__importDefault(require("../../context/SkuChildrenContext"));function QuantitySelector(props){const{skuCode,skuListId,children,min=1,max,...p}=props,{item,setQuantity,items,quantity,prices,skuCode:itemSkuCode}=(0,react_1.useContext)(ItemContext_1.default),{sku}=(0,react_1.useContext)(SkuChildrenContext_1.default),{skuLists,listIds}=(0,react_1.useContext)(SkuListsContext_1.default),defaultVal=p?.value||min,[value,setValue]=(0,react_1.useState)(defaultVal),[disabled,setDisabled]=(0,react_1.useState)(!!p.disabled),sCode=!(0,isEmpty_1.default)(items)&&skuCode?items[skuCode]?.code:sku?.code||skuCode||(0,getCurrentItemKey_1.default)(item)||itemSkuCode,inventory=(0,isEmpty_1.default)(item)?50:item[sCode]?.inventory?.quantity,maxInv=max||inventory;(0,react_1.useEffect)(()=>{if(setValue(defaultVal),(!prices[sCode]||!sCode)&&setDisabled(!0),skuListId&&setDisabled(!1),sCode&&!quantity[sCode]){const qty=Number(defaultVal);setQuantity&&setQuantity({...quantity,[`${sCode}`]:qty}),!(0,isEmpty_1.default)(prices)&&(0,has_1.default)(prices,sCode)&&setDisabled(!1)}return()=>{setValue(defaultVal)}},[item,listIds,prices,quantity]);const handleChange=e=>{const qty=Number(e.target.value),valid=Number(qty)>=Number(min)&&Number(qty)<=Number(maxInv);setValue(qty),!(0,isEmpty_1.default)(skuLists)&&skuListId&&valid?setQuantity&&setQuantity({...quantity,[`${skuListId}`]:Number(qty)}):sCode&&valid&&setQuantity&&setQuantity({...quantity,[`${sCode}`]:Number(qty)})},handleBlur=e=>{const qty=e.target.value;if(!(Number(qty)>=Number(min)&&Number(qty)<=Number(maxInv))){const resetVal=Number(qty)<Number(min)?min:maxInv;resetVal&&setValue(resetVal),!(0,isEmpty_1.default)(skuLists)&&skuListId?setQuantity&&setQuantity({...quantity,[`${skuListId}`]:Number(resetVal)}):setQuantity&&setQuantity({...quantity,[`${sCode}`]:Number(resetVal)})}},parentProps={min,max:maxInv,disabled,handleChange,handleBlur,value,...props};return children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}):(0,jsx_runtime_1.jsx)("input",{type:"number",max:maxInv,min,value:value||"",disabled,onChange:handleChange,onBlur:handleBlur,...p})}exports.QuantitySelector=QuantitySelector,exports.default=QuantitySelector;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { VariantHandleCallback } from '../utils/VariantTemplate';
|
|
3
3
|
import { BaseSelectorType } from '../../typings/index';
|
|
4
|
-
import {
|
|
4
|
+
import { ChildrenFunction } from '../../typings/index';
|
|
5
5
|
import { VariantsObject, SetSkuCode } from '../../reducers/VariantReducer';
|
|
6
6
|
export interface VariantOption {
|
|
7
7
|
label: string;
|
|
@@ -11,13 +11,13 @@ export interface VariantOption {
|
|
|
11
11
|
imageUrl?: string | null;
|
|
12
12
|
} | null;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
interface ChildrenProps extends Omit<Props, 'children'> {
|
|
15
15
|
variants: VariantsObject;
|
|
16
16
|
handleSelect: SetSkuCode;
|
|
17
17
|
loading: boolean;
|
|
18
|
-
}
|
|
18
|
+
}
|
|
19
19
|
declare type Props = {
|
|
20
|
-
children?: ChildrenProps
|
|
20
|
+
children?: ChildrenFunction<ChildrenProps>;
|
|
21
21
|
options: VariantOption[];
|
|
22
22
|
type?: BaseSelectorType;
|
|
23
23
|
loader?: ReactNode;
|
|
@@ -26,27 +26,4 @@ declare type Props = {
|
|
|
26
26
|
handleCallback?: VariantHandleCallback;
|
|
27
27
|
} & JSX.IntrinsicElements['input'] & JSX.IntrinsicElements['select'];
|
|
28
28
|
export declare function VariantSelector(props: Props): JSX.Element;
|
|
29
|
-
export declare namespace VariantSelector {
|
|
30
|
-
var propTypes: {
|
|
31
|
-
options: import("prop-types").Validator<NonNullable<import("prop-types").InferProps<{
|
|
32
|
-
label: import("prop-types").Validator<string>;
|
|
33
|
-
code: import("prop-types").Validator<string>;
|
|
34
|
-
lineItem: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
35
|
-
name: import("prop-types").Validator<string>;
|
|
36
|
-
imageUrl: import("prop-types").Requireable<string>;
|
|
37
|
-
}>>;
|
|
38
|
-
}>>[]>;
|
|
39
|
-
name: import("prop-types").Requireable<string>;
|
|
40
|
-
children: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
41
|
-
type: import("prop-types").Requireable<BaseSelectorType>;
|
|
42
|
-
loader: import("prop-types").Requireable<import("prop-types").ReactElementLike>;
|
|
43
|
-
placeholder: import("prop-types").Requireable<string>;
|
|
44
|
-
skuCode: import("prop-types").Requireable<string>;
|
|
45
|
-
};
|
|
46
|
-
var defaultProps: {
|
|
47
|
-
placeholder: string;
|
|
48
|
-
type: BaseSelectorType;
|
|
49
|
-
};
|
|
50
|
-
var displayName: string;
|
|
51
|
-
}
|
|
52
29
|
export default VariantSelector;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.VariantSelector=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),VariantTemplate_1=tslib_1.__importDefault(require("../utils/VariantTemplate")),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),VariantsContext_1=tslib_1.__importDefault(require("../../context/VariantsContext"))
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.VariantSelector=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),VariantTemplate_1=tslib_1.__importDefault(require("../utils/VariantTemplate")),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),VariantsContext_1=tslib_1.__importDefault(require("../../context/VariantsContext"));function VariantSelector(props){const{children,type="select",placeholder,skuCode,name,options,...prs}=props,{setSkuCode,skuCode:variantSkuCode,loading,variants,setSkuCodes}=(0,react_1.useContext)(VariantsContext_1.default);(0,react_1.useEffect)(()=>(setSkuCodes&&setSkuCodes(options),()=>{setSkuCodes&&setSkuCodes([])}),[options]);const sCode=variantSkuCode||skuCode||"",DefaultTemplate=()=>loading?(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:props.loader||"Loading..."}):(0,jsx_runtime_1.jsx)(VariantTemplate_1.default,{variants,type,placeholder,skuCode:sCode,options,handleChange:setSkuCode,name,...prs}),parentProps={variants,loading:!!loading,handleSelect:setSkuCode,skuCode:sCode,...props};return children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children}):(0,jsx_runtime_1.jsx)(DefaultTemplate,{})}exports.VariantSelector=VariantSelector,exports.default=VariantSelector;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Address } from '@commercelayer/sdk';
|
|
2
|
+
import type { Address } from '@commercelayer/sdk';
|
|
3
3
|
import AddressChildrenContext from '../../context/AddressChildrenContext';
|
|
4
|
-
import {
|
|
4
|
+
import { ChildrenFunction } from '../../typings/index';
|
|
5
5
|
declare type ChildrenProps = Pick<Props, 'customerAddresses' | 'className'> & {
|
|
6
6
|
AddressProvider: typeof AddressChildrenContext.Provider;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export interface CustomerAddress extends Address {
|
|
9
9
|
onClick: () => void;
|
|
10
10
|
handleSelect?: () => void;
|
|
11
|
-
}
|
|
12
|
-
export declare type AddressCardsTemplateChildren =
|
|
11
|
+
}
|
|
12
|
+
export declare type AddressCardsTemplateChildren = ChildrenFunction<ChildrenProps>;
|
|
13
13
|
export declare type AddressCardsType = ChildrenProps;
|
|
14
14
|
export declare type HandleSelect = (k: number, addressId: string, customerAddressId: string, disabled: boolean, address: Address) => Promise<void>;
|
|
15
|
-
|
|
15
|
+
interface Props {
|
|
16
16
|
customerAddresses: CustomerAddress[];
|
|
17
17
|
countryLock?: string;
|
|
18
18
|
children: AddressCardsTemplateChildren;
|
|
@@ -22,6 +22,6 @@ declare type Props = {
|
|
|
22
22
|
selected?: number | null;
|
|
23
23
|
className?: string;
|
|
24
24
|
handleSelect: HandleSelect;
|
|
25
|
-
}
|
|
26
|
-
export default function AddressCardsTemplate({ customerAddresses, children, deselect, countryLock, selected, selectedClassName, className, disabledClassName, handleSelect
|
|
25
|
+
}
|
|
26
|
+
export default function AddressCardsTemplate({ customerAddresses, children, deselect, countryLock, selected, selectedClassName, className, disabledClassName, handleSelect }: Props): JSX.Element;
|
|
27
27
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),react_1=require("react"),AddressChildrenContext_1=tslib_1.__importDefault(require("../../context/AddressChildrenContext")),ShippingAddressContext_1=tslib_1.__importDefault(require("../../context/ShippingAddressContext"));function AddressCardsTemplate({customerAddresses,children,deselect,countryLock,selected,selectedClassName,className,disabledClassName,handleSelect}){const{setShippingAddress}=(0,react_1.useContext)(ShippingAddressContext_1.default),value={customerAddresses:customerAddresses.map((address,k)=>{const attributes=address,disabled=setShippingAddress&&countryLock&&countryLock!==address.country_code||!1,addressSelectedClass=selected===k?`${className} ${deselect?"":selectedClassName}`:className,finalClassName=disabled?`${className} ${disabledClassName}`:addressSelectedClass,customerAddressId=address?.reference||"";return{...attributes,className:finalClassName,onClick:()=>handleSelect(k,address.id,customerAddressId,disabled,address)}}),AddressProvider:AddressChildrenContext_1.default.Provider};return(0,jsx_runtime_1.jsx)(Parent_1.default,{...value,children})}exports.default=AddressCardsTemplate;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),react_1=require("react"),AddressChildrenContext_1=tslib_1.__importDefault(require("../../context/AddressChildrenContext")),ShippingAddressContext_1=tslib_1.__importDefault(require("../../context/ShippingAddressContext"));function AddressCardsTemplate({customerAddresses,children,deselect,countryLock,selected,selectedClassName,className,disabledClassName,handleSelect}){const{setShippingAddress}=(0,react_1.useContext)(ShippingAddressContext_1.default),value={customerAddresses:customerAddresses.map((address,k)=>{const attributes=address,disabled=setShippingAddress&&countryLock&&countryLock!==address.country_code||!1,addressSelectedClass=selected===k?`${className??""} ${(deselect?"":selectedClassName)??""}`:className,finalClassName=disabled?`${className??""} ${disabledClassName??""}`:addressSelectedClass,customerAddressId=address?.reference||"";return{...attributes,className:finalClassName,onClick:async()=>await handleSelect(k,address.id,customerAddressId,disabled,address)}}),AddressProvider:AddressChildrenContext_1.default.Provider};return(0,jsx_runtime_1.jsx)(Parent_1.default,{...value,children})}exports.default=AddressCardsTemplate;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BaseInputComponentProps } from '../../typings/index';
|
|
3
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" | "min" | "max" | "type" | "list" | "
|
|
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" | "min" | "max" | "type" | "list" | "disabled" | "width" | "height" | "src" | "step" | "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>>;
|
|
5
5
|
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Component, ErrorInfo } from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
children: JSX.Element;
|
|
4
|
+
}
|
|
5
|
+
interface State {
|
|
6
|
+
hasError: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare class ErrorBoundary extends Component<Props, State> {
|
|
9
|
+
state: State;
|
|
10
|
+
static getDerivedStateFromError(): State;
|
|
11
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
12
|
+
render(): JSX.Element;
|
|
13
|
+
}
|
|
14
|
+
export default ErrorBoundary;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ErrorBoundary=void 0;const jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react");class ErrorBoundary extends react_1.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(error,errorInfo){if(process.env.NODE_ENV!=="test")console.error("Uncaught error:",error,errorInfo);else throw error}render(){return this.state.hasError?(0,jsx_runtime_1.jsx)("h1",{children:"Sorry.. there was an error, check the console."}):this.props.children}}exports.ErrorBoundary=ErrorBoundary,exports.default=ErrorBoundary;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { PaymentResource, PaymentSourceType } from '../../reducers/PaymentMethodReducer';
|
|
3
3
|
import PaymentSourceContext, { IconBrand } from '../../context/PaymentSourceContext';
|
|
4
|
-
import {
|
|
4
|
+
import { ChildrenFunction } from '../../typings/index';
|
|
5
5
|
declare type ChildrenProps = Pick<Props, 'customerPayments'> & {
|
|
6
6
|
PaymentSourceProvider: typeof PaymentSourceContext.Provider;
|
|
7
7
|
};
|
|
@@ -12,7 +12,7 @@ declare type CustomerPayment = PaymentSourceType & {
|
|
|
12
12
|
};
|
|
13
13
|
handleClick?: () => void;
|
|
14
14
|
};
|
|
15
|
-
export declare type CustomerCardsTemplateChildren =
|
|
15
|
+
export declare type CustomerCardsTemplateChildren = ChildrenFunction<ChildrenProps>;
|
|
16
16
|
export declare type CustomerCardsType = ChildrenProps;
|
|
17
17
|
declare type Props = {
|
|
18
18
|
customerPayments: CustomerPayment[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { PriceProps } from '../prices/Price';
|
|
3
3
|
export declare type PTemplateProps = {
|
|
4
4
|
formattedAmount?: string;
|
|
5
5
|
formattedCompare?: string;
|
|
6
6
|
} & Omit<PriceProps, 'children'>;
|
|
7
|
-
declare
|
|
7
|
+
export declare function PriceTemplate(props: PTemplateProps): JSX.Element;
|
|
8
8
|
export default PriceTemplate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PriceTemplate=void 0;const jsx_runtime_1=require("react/jsx-runtime");function PriceTemplate(props){const{showCompare,formattedCompare,compareClassName,className,formattedAmount,skuCode,...p}=props;return(0,jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment,{children:[(0,jsx_runtime_1.jsx)("span",{"data-testid":`price-${skuCode??""}`,className,...p,children:formattedAmount}),showCompare&&(0,jsx_runtime_1.jsx)("span",{"data-testid":`compare-${skuCode??""}`,className:compareClassName||"",...p,children:formattedCompare})]})}exports.PriceTemplate=PriceTemplate,exports.default=PriceTemplate;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { Address } from '@commercelayer/sdk';
|
|
3
3
|
export declare type AddressValuesKeys = `${keyof Address}` | `billing_address_${keyof Address}` | `shipping_address_${keyof Address}`;
|
|
4
|
-
export
|
|
4
|
+
export interface DefaultContextAddress {
|
|
5
5
|
validation?: void;
|
|
6
6
|
setValue?: (name: AddressValuesKeys, value: string | number | readonly string[]) => void;
|
|
7
7
|
errors?: {
|
|
@@ -20,6 +20,6 @@ export declare type DefaultContextAddress = {
|
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
isBusiness?: boolean;
|
|
23
|
-
}
|
|
23
|
+
}
|
|
24
24
|
declare const BillingAddressFormContext: import("react").Context<DefaultContextAddress>;
|
|
25
25
|
export default BillingAddressFormContext;
|