@commercelayer/react-components 3.13.0-beta.1 → 3.13.0-beta.4
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/components/AddToCartButton.d.ts +27 -1
- package/lib/components/Address.d.ts +13 -1
- package/lib/components/AddressCountrySelector.d.ts +9 -1
- package/lib/components/AddressField.d.ts +15 -1
- package/lib/components/AddressInput.d.ts +7 -1
- package/lib/components/AddressStateSelector.d.ts +11 -1
- package/lib/components/AddressesContainer.d.ts +8 -1
- package/lib/components/AdjustmentAmount.d.ts +4 -1
- package/lib/components/AdyenPayment.d.ts +25 -1
- package/lib/components/AvailabilityContainer.d.ts +7 -1
- package/lib/components/AvailabilityTemplate.d.ts +15 -1
- package/lib/components/BillingAddressContainer.d.ts +6 -1
- package/lib/components/BillingAddressForm.d.ts +8 -1
- package/lib/components/BraintreePayment.d.ts +30 -1
- package/lib/components/CheckoutComPayment.d.ts +23 -1
- package/lib/components/CheckoutLink.d.ts +13 -1
- package/lib/components/CommerceLayer.d.ts +8 -1
- package/lib/components/CustomerContainer.d.ts +7 -1
- package/lib/components/CustomerInput.d.ts +11 -1
- package/lib/components/DeliveryLeadTime.d.ts +10 -1
- package/lib/components/DiscountAmount.d.ts +4 -1
- package/lib/components/Errors.d.ts +5 -1
- package/lib/components/ExternalFunction.d.ts +7 -1
- package/lib/components/GiftCard.d.ts +8 -1
- package/lib/components/GiftCardAmount.d.ts +4 -1
- package/lib/components/GiftCardContainer.d.ts +6 -1
- package/lib/components/GiftCardCurrencySelector.d.ts +7 -1
- package/lib/components/GiftCardInput.d.ts +7 -1
- package/lib/components/GiftCardOrCouponCode.d.ts +17 -1
- package/lib/components/GiftCardOrCouponCode.js +1 -1
- package/lib/components/GiftCardOrCouponForm.d.ts +10 -1
- package/lib/components/GiftCardOrCouponInput.d.ts +10 -1
- package/lib/components/GiftCardOrCouponRemoveButton.d.ts +18 -1
- package/lib/components/GiftCardOrCouponSubmit.d.ts +9 -1
- package/lib/components/ItemContainer.d.ts +11 -1
- package/lib/components/KlarnaPayment.d.ts +9 -1
- package/lib/components/LineItem.d.ts +8 -1
- package/lib/components/LineItem.js +1 -1
- package/lib/components/LineItemAmount.d.ts +7 -1
- package/lib/components/LineItemCode.d.ts +12 -1
- package/lib/components/LineItemImage.d.ts +16 -1
- package/lib/components/LineItemImage.js +1 -1
- package/lib/components/LineItemName.d.ts +11 -1
- package/lib/components/LineItemOption.d.ts +19 -1
- package/lib/components/LineItemOptions.d.ts +16 -1
- package/lib/components/LineItemQuantity.d.ts +14 -1
- package/lib/components/LineItemRemoveLink.d.ts +12 -1
- package/lib/components/LineItemsContainer.d.ts +8 -1
- package/lib/components/LineItemsCount.d.ts +12 -1
- package/lib/components/LineItemsEmpty.d.ts +12 -1
- package/lib/components/MetadataInput.d.ts +5 -1
- package/lib/components/OrderContainer.d.ts +12 -1
- package/lib/components/OrderNumber.d.ts +5 -1
- package/lib/components/OrderStorage.d.ts +8 -1
- package/lib/components/PaymentGateway.d.ts +16 -1
- package/lib/components/PaymentMethod.d.ts +16 -1
- package/lib/components/PaymentMethodAmount.d.ts +4 -1
- package/lib/components/PaymentMethodName.d.ts +9 -1
- package/lib/components/PaymentMethodPrice.d.ts +9 -1
- package/lib/components/PaymentMethodRadioButton.d.ts +12 -1
- package/lib/components/PaymentMethodsContainer.d.ts +8 -1
- package/lib/components/PaymentSource.d.ts +19 -1
- package/lib/components/PaymentSourceBrandIcon.d.ts +15 -1
- package/lib/components/PaymentSourceBrandName.d.ts +12 -1
- package/lib/components/PaymentSourceDetail.d.ts +12 -1
- package/lib/components/PaymentSourceEditButton.d.ts +9 -1
- package/lib/components/PaypalPayment.d.ts +12 -1
- package/lib/components/PlaceOrderButton.d.ts +14 -1
- package/lib/components/PlaceOrderContainer.d.ts +8 -1
- package/lib/components/Price.d.ts +16 -1
- package/lib/components/PricesContainer.d.ts +11 -1
- package/lib/components/PrivacyAndTermsCheckbox.d.ts +4 -1
- package/lib/components/QuantitySelector.d.ts +17 -1
- package/lib/components/SaveAddressesButton.d.ts +10 -1
- package/lib/components/SaveCustomerButton.d.ts +13 -1
- package/lib/components/Shipment.d.ts +15 -1
- package/lib/components/Shipment.js +1 -1
- package/lib/components/ShipmentField.d.ts +12 -1
- package/lib/components/ShipmentsContainer.d.ts +6 -1
- package/lib/components/ShipmentsContainer.js +1 -1
- package/lib/components/ShippingAddressContainer.d.ts +6 -1
- package/lib/components/ShippingAddressForm.d.ts +8 -1
- package/lib/components/ShippingAmount.d.ts +4 -1
- package/lib/components/ShippingMethod.d.ts +8 -1
- package/lib/components/ShippingMethodName.d.ts +11 -1
- package/lib/components/ShippingMethodPrice.d.ts +13 -1
- package/lib/components/ShippingMethodRadioButton.d.ts +13 -1
- package/lib/components/ShippingMethodRadioButton.js +1 -1
- package/lib/components/SkuField.d.ts +9 -1
- package/lib/components/SkuList.d.ts +7 -1
- package/lib/components/SkuListsContainer.d.ts +6 -1
- package/lib/components/SkuOption.d.ts +7 -1
- package/lib/components/SkuOptionInput.d.ts +5 -1
- package/lib/components/SkuOptionsContainer.d.ts +7 -1
- package/lib/components/Skus.d.ts +11 -1
- package/lib/components/SkusContainer.d.ts +14 -1
- package/lib/components/StockTransfer.d.ts +6 -1
- package/lib/components/StockTransfer.js +1 -1
- package/lib/components/StockTransferField.d.ts +9 -1
- package/lib/components/StripePayment.d.ts +18 -1
- package/lib/components/SubTotalAmount.d.ts +4 -1
- package/lib/components/SubmitButton.d.ts +9 -1
- package/lib/components/TaxesAmount.d.ts +4 -1
- package/lib/components/TotalAmount.d.ts +4 -1
- package/lib/components/VariantSelector.d.ts +29 -1
- package/lib/components/VariantsContainer.d.ts +8 -1
- package/lib/components/WireTransferPayment.d.ts +10 -1
- package/lib/components/gateways/AdyenGateway.d.ts +4 -1
- package/lib/components/gateways/BraintreeGateway.d.ts +4 -1
- package/lib/components/gateways/CheckoutComGateway.d.ts +4 -1
- package/lib/components/gateways/KlarnaGateway.d.ts +4 -1
- package/lib/components/gateways/PaypalGateway.d.ts +4 -1
- package/lib/components/gateways/StripeGateway.d.ts +4 -1
- package/lib/components/gateways/WireTransferGateway.d.ts +4 -1
- package/lib/components/utils/AddressCardsTemplate.d.ts +26 -1
- package/lib/components/utils/BaseField.d.ts +8 -1
- package/lib/components/utils/BaseInput.d.ts +5 -1
- package/lib/components/utils/BaseInput.js +1 -1
- package/lib/components/utils/BaseOrderPrice.d.ts +6 -1
- package/lib/components/utils/BaseSelect.d.ts +5 -1
- package/lib/components/utils/GenericFieldComponent.d.ts +37 -1
- package/lib/components/utils/GenericFieldComponent.js +1 -1
- package/lib/components/utils/Parent.d.ts +6 -1
- package/lib/components/utils/Parent.js +1 -1
- package/lib/components/utils/PaymentCardsTemplate.d.ts +22 -1
- package/lib/components/utils/PriceTemplate.d.ts +8 -1
- package/lib/components/utils/VariantTemplate.d.ts +36 -1
- package/lib/components/utils/getAllErrors.d.ts +17 -1
- package/lib/config/components.d.ts +913 -1
- package/lib/config/currency.d.ts +5 -1
- package/lib/context/AddressChildrenContext.d.ts +6 -1
- package/lib/context/AddressContext.d.ts +16 -1
- package/lib/context/AvailabilityContext.d.ts +2 -1
- package/lib/context/BillingAddressContext.d.ts +11 -1
- package/lib/context/BillingAddressFormContext.d.ts +19 -1
- package/lib/context/CommerceLayerContext.d.ts +6 -1
- package/lib/context/CouponAndGiftCardFormContext.d.ts +9 -1
- package/lib/context/CustomerContext.d.ts +15 -1
- package/lib/context/ExternalFunctionContext.d.ts +11 -1
- package/lib/context/GiftCardContext.d.ts +10 -1
- package/lib/context/ItemContext.d.ts +12 -1
- package/lib/context/LineItemChildrenContext.d.ts +8 -1
- package/lib/context/LineItemContext.d.ts +7 -1
- package/lib/context/LineItemOptionChildrenContext.d.ts +7 -1
- package/lib/context/OrderContext.d.ts +29 -1
- package/lib/context/OrderStorageContext.d.ts +10 -1
- package/lib/context/PaymentMethodChildrenContext.d.ts +9 -1
- package/lib/context/PaymentMethodContext.d.ts +22 -1
- package/lib/context/PaymentSourceContext.d.ts +13 -1
- package/lib/context/PlaceOrderContext.d.ts +17 -1
- package/lib/context/PricesContext.d.ts +6 -1
- package/lib/context/ShipmentChildrenContext.d.ts +12 -1
- package/lib/context/ShipmentContext.d.ts +11 -1
- package/lib/context/ShippingAddressContext.d.ts +9 -1
- package/lib/context/ShippingAddressFormContext.d.ts +3 -1
- package/lib/context/ShippingMethodChildrenContext.d.ts +9 -1
- package/lib/context/SkuChildrenContext.d.ts +8 -1
- package/lib/context/SkuContext.d.ts +8 -1
- package/lib/context/SkuListsContext.d.ts +5 -1
- package/lib/context/SkuOptionChildrenContext.d.ts +7 -1
- package/lib/context/SkuOptionsContext.d.ts +2 -1
- package/lib/context/StockTransferChildrenContext.d.ts +6 -1
- package/lib/context/VariantsContext.d.ts +2 -1
- package/lib/index.d.ts +102 -1
- package/lib/reducers/AddressReducer.d.ts +59 -1
- package/lib/reducers/AvailabilityReducer.d.ts +61 -1
- package/lib/reducers/BillingAddressReducer.d.ts +31 -1
- package/lib/reducers/CustomerReducer.d.ts +50 -1
- package/lib/reducers/GiftCardReducer.d.ts +76 -1
- package/lib/reducers/ItemReducer.d.ts +69 -1
- package/lib/reducers/LineItemReducer.d.ts +52 -1
- package/lib/reducers/OrderReducer.d.ts +132 -2
- package/lib/reducers/PaymentMethodReducer.d.ts +151 -1
- package/lib/reducers/PlaceOrderReducer.d.ts +59 -1
- package/lib/reducers/PriceReducer.d.ts +44 -1
- package/lib/reducers/ShipmentReducer.d.ts +40 -1
- package/lib/reducers/ShippingAddressReducer.d.ts +32 -1
- package/lib/reducers/SkuListsReducer.d.ts +21 -1
- package/lib/reducers/SkuOptionsReducer.d.ts +26 -1
- package/lib/reducers/SkuReducer.d.ts +21 -1
- package/lib/reducers/VariantReducer.d.ts +71 -1
- package/lib/typings/errors.d.ts +42 -1
- package/lib/typings/index.d.ts +137 -1
- package/lib/utils/PropsType.d.ts +33 -1
- package/lib/utils/addressesManager.d.ts +28 -1
- package/lib/utils/baseReducer.d.ts +3 -1
- package/lib/utils/browserInfo.d.ts +9 -1
- package/lib/utils/checkIncludeResource.d.ts +8 -1
- package/lib/utils/childrenTypes.d.ts +9 -1
- package/lib/utils/compareObjAttribute.d.ts +7 -1
- package/lib/utils/countryStateCity.d.ts +9 -1
- package/lib/utils/customMessages.d.ts +8 -1
- package/lib/utils/customerOrderOptions.d.ts +3 -1
- package/lib/utils/getAmount.d.ts +9 -1
- package/lib/utils/getCardDetails.d.ts +15 -1
- package/lib/utils/getCurrentItemKey.d.ts +6 -1
- package/lib/utils/getErrors.d.ts +11 -1
- package/lib/utils/getLineItemsCount.d.ts +12 -1
- package/lib/utils/getLoaderComponent.d.ts +2 -1
- package/lib/utils/getPrices.d.ts +17 -1
- package/lib/utils/getSdk.d.ts +3 -1
- package/lib/utils/getSkus.d.ts +3 -1
- package/lib/utils/hooks/useExternalScript.d.ts +1 -1
- package/lib/utils/isEmptyStates.d.ts +1 -1
- package/lib/utils/isJSON.d.ts +1 -1
- package/lib/utils/jwt.d.ts +27 -1
- package/lib/utils/localStorage.d.ts +17 -1
- package/lib/utils/organization.d.ts +6 -1
- package/lib/utils/paypalPayment.d.ts +3 -1
- package/lib/utils/placeholderImages.d.ts +2 -0
- package/lib/utils/placeholderImages.js +1 -0
- package/lib/utils/promisify.d.ts +1 -1
- package/lib/utils/shipments.d.ts +3 -1
- package/lib/utils/validateFormFields.d.ts +22 -1
- package/package.json +2 -2
|
@@ -1 +1,11 @@
|
|
|
1
|
-
import{FunctionComponent,ReactNode}
|
|
1
|
+
import { FunctionComponent, ReactNode } from 'react';
|
|
2
|
+
import type { LineItem } from '@commercelayer/sdk';
|
|
3
|
+
export declare type LineItemNameType = Omit<LineItemNameProps, 'children'> & {
|
|
4
|
+
label: string;
|
|
5
|
+
lineItem: LineItem;
|
|
6
|
+
};
|
|
7
|
+
declare type LineItemNameProps = {
|
|
8
|
+
children?: (props: LineItemNameType) => ReactNode;
|
|
9
|
+
} & JSX.IntrinsicElements['p'];
|
|
10
|
+
declare const LineItemName: FunctionComponent<LineItemNameProps>;
|
|
11
|
+
export default LineItemName;
|
|
@@ -1 +1,19 @@
|
|
|
1
|
-
import{FunctionComponent,CSSProperties}
|
|
1
|
+
import { FunctionComponent, CSSProperties } from 'react';
|
|
2
|
+
import { LineItemOption as LineItemOptionType } from '@commercelayer/sdk';
|
|
3
|
+
import { FunctionChildren } from '../typings/index';
|
|
4
|
+
declare type LineItemOptionChildrenProps = FunctionChildren<Omit<LineItemOptionProps, 'children'> & {
|
|
5
|
+
lineItemOption: LineItemOptionType;
|
|
6
|
+
}>;
|
|
7
|
+
declare type LineItemOptionProps = {
|
|
8
|
+
id?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
key?: string;
|
|
11
|
+
style?: CSSProperties;
|
|
12
|
+
children?: LineItemOptionChildrenProps;
|
|
13
|
+
name?: string;
|
|
14
|
+
valueClassName?: string;
|
|
15
|
+
tagElement?: keyof JSX.IntrinsicElements;
|
|
16
|
+
tagContainer?: keyof JSX.IntrinsicElements;
|
|
17
|
+
};
|
|
18
|
+
declare const LineItemOption: FunctionComponent<LineItemOptionProps>;
|
|
19
|
+
export default LineItemOption;
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
import React,{ReactNode}from'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
export declare type LineItemOptionsProps = JSX.IntrinsicElements['div'] & {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
title?: string;
|
|
5
|
+
showName?: boolean;
|
|
6
|
+
titleTagElement?: keyof JSX.IntrinsicElements;
|
|
7
|
+
titleClassName?: string;
|
|
8
|
+
} & ({
|
|
9
|
+
skuOptionId: string;
|
|
10
|
+
showAll?: never;
|
|
11
|
+
} | {
|
|
12
|
+
skuOptionId?: never;
|
|
13
|
+
showAll: true;
|
|
14
|
+
});
|
|
15
|
+
declare const LineItemOptions: React.FunctionComponent<LineItemOptionsProps>;
|
|
16
|
+
export default LineItemOptions;
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
import React,{FunctionComponent
|
|
1
|
+
import React, { FunctionComponent } from 'react';
|
|
2
|
+
import { FunctionChildren } from '../typings/index';
|
|
3
|
+
declare type LineItemQuantityChildrenProps = FunctionChildren<Omit<LineItemQuantityProps, 'children'> & {
|
|
4
|
+
quantity: number;
|
|
5
|
+
handleChange: (event: React.MouseEvent<HTMLSelectElement>) => void;
|
|
6
|
+
}>;
|
|
7
|
+
declare type LineItemQuantityProps = {
|
|
8
|
+
children?: LineItemQuantityChildrenProps;
|
|
9
|
+
max?: number;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
readonly?: boolean;
|
|
12
|
+
} & (JSX.IntrinsicElements['select'] & JSX.IntrinsicElements['span']);
|
|
13
|
+
declare const LineItemQuantity: FunctionComponent<LineItemQuantityProps>;
|
|
14
|
+
export default LineItemQuantity;
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
import React,{FunctionComponent,PropsWithoutRef
|
|
1
|
+
import React, { FunctionComponent, PropsWithoutRef } from 'react';
|
|
2
|
+
import { FunctionChildren } from '../typings/index';
|
|
3
|
+
declare type ChildrenLineItemRemoveLinkProps = FunctionChildren<{
|
|
4
|
+
handleRemove: (event: React.MouseEvent<HTMLAnchorElement>) => void;
|
|
5
|
+
label?: string;
|
|
6
|
+
}>;
|
|
7
|
+
declare type LineItemRemoveLinkProps = {
|
|
8
|
+
children?: ChildrenLineItemRemoveLinkProps;
|
|
9
|
+
label?: string;
|
|
10
|
+
} & PropsWithoutRef<JSX.IntrinsicElements['a']>;
|
|
11
|
+
declare const LineItemRemoveLink: FunctionComponent<LineItemRemoveLinkProps>;
|
|
12
|
+
export default LineItemRemoveLink;
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
import{FunctionComponent,ReactNode}from'react';
|
|
1
|
+
import { FunctionComponent, ReactNode } from 'react';
|
|
2
|
+
declare type LineItemsContainer = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
filters?: Record<string, any>;
|
|
5
|
+
loader?: ReactNode;
|
|
6
|
+
};
|
|
7
|
+
declare const LineItemsContainer: FunctionComponent<LineItemsContainer>;
|
|
8
|
+
export default LineItemsContainer;
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
import{FunctionComponent
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { TypeAccepted } from '../utils/getLineItemsCount';
|
|
3
|
+
import { FunctionChildren } from '../typings/index';
|
|
4
|
+
declare type LineItemsCountChildrenProps = FunctionChildren<Omit<LineItemsCountProps, 'children'> & {
|
|
5
|
+
quantity: number;
|
|
6
|
+
}>;
|
|
7
|
+
declare type LineItemsCountProps = {
|
|
8
|
+
children?: LineItemsCountChildrenProps;
|
|
9
|
+
typeAccepted?: TypeAccepted[];
|
|
10
|
+
} & JSX.IntrinsicElements['span'];
|
|
11
|
+
declare const LineItemsCount: FunctionComponent<LineItemsCountProps>;
|
|
12
|
+
export default LineItemsCount;
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
import{FunctionComponent
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { FunctionChildren } from '../typings/index';
|
|
3
|
+
export declare type LineItemsCountType = FunctionChildren<Omit<LineItemsCountProps, 'children'> & {
|
|
4
|
+
quantity: number;
|
|
5
|
+
text: string;
|
|
6
|
+
}>;
|
|
7
|
+
declare type LineItemsCountProps = {
|
|
8
|
+
children?: LineItemsCountType;
|
|
9
|
+
text?: string;
|
|
10
|
+
} & JSX.IntrinsicElements['span'];
|
|
11
|
+
declare const LineItemsEmpty: FunctionComponent<LineItemsCountProps>;
|
|
12
|
+
export default LineItemsEmpty;
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
import{FunctionComponent}from'react';
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { BaseInputComponentProps } from '../typings/index';
|
|
3
|
+
export declare type MetadataInputProps = BaseInputComponentProps & JSX.IntrinsicElements['input'] & JSX.IntrinsicElements['textarea'];
|
|
4
|
+
declare const MetadataInput: FunctionComponent<MetadataInputProps>;
|
|
5
|
+
export default MetadataInput;
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
import React,{ReactNode}from'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { BaseMetadataObject } from '../typings/index';
|
|
3
|
+
import { OrderCreate, Order } from '@commercelayer/sdk';
|
|
4
|
+
declare type OrderContainerProps = {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
metadata?: BaseMetadataObject;
|
|
7
|
+
attributes?: OrderCreate;
|
|
8
|
+
orderId?: string;
|
|
9
|
+
fetchOrder?: (order: Order) => void;
|
|
10
|
+
};
|
|
11
|
+
declare const OrderContainer: React.FunctionComponent<OrderContainerProps>;
|
|
12
|
+
export default OrderContainer;
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
import{FunctionComponent}from'react';
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { BaseFieldProps } from './utils/BaseField';
|
|
3
|
+
export declare type OrderNumberProps = Omit<BaseFieldProps, 'attribute'>;
|
|
4
|
+
declare const OrderNumber: FunctionComponent<OrderNumberProps>;
|
|
5
|
+
export default OrderNumber;
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
import{FunctionComponent,ReactNode}from'react';
|
|
1
|
+
import { FunctionComponent, ReactNode } from 'react';
|
|
2
|
+
declare type OrderStorageProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
persistKey: string;
|
|
5
|
+
clearWhenPlaced?: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare const OrderStorage: FunctionComponent<OrderStorageProps>;
|
|
8
|
+
export default OrderStorage;
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
import{LoaderType}from'../typings/index';
|
|
1
|
+
import { LoaderType } from '../typings/index';
|
|
2
|
+
import { FunctionComponent } from 'react';
|
|
3
|
+
import { PaymentSourceProps } from './PaymentSource';
|
|
4
|
+
export declare type GatewayBaseType = PaymentGatewayProps & {
|
|
5
|
+
show: boolean;
|
|
6
|
+
loading: boolean;
|
|
7
|
+
loaderComponent: JSX.Element;
|
|
8
|
+
};
|
|
9
|
+
export declare type PaymentGatewayProps = PaymentSourceProps & {
|
|
10
|
+
showCard: boolean;
|
|
11
|
+
handleEditClick: (e: MouseEvent) => void;
|
|
12
|
+
show: boolean;
|
|
13
|
+
loader?: LoaderType;
|
|
14
|
+
};
|
|
15
|
+
declare const PaymentGateway: FunctionComponent<PaymentGatewayProps>;
|
|
16
|
+
export default PaymentGateway;
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
import{FunctionComponent,ReactNode}
|
|
1
|
+
import { FunctionComponent, ReactNode } from 'react';
|
|
2
|
+
import { LoaderType } from '../typings/index';
|
|
3
|
+
import { PaymentMethod as PaymentMethodType } from '@commercelayer/sdk';
|
|
4
|
+
declare type PaymentMethodProps = {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
activeClass?: string;
|
|
7
|
+
loader?: LoaderType;
|
|
8
|
+
} & Omit<JSX.IntrinsicElements['div'], 'onClick'> & ({
|
|
9
|
+
clickableContainer: true;
|
|
10
|
+
onClick?: (payment?: PaymentMethodType | Record<string, any>) => void;
|
|
11
|
+
} | {
|
|
12
|
+
clickableContainer?: never;
|
|
13
|
+
onClick?: never;
|
|
14
|
+
});
|
|
15
|
+
declare const PaymentMethod: FunctionComponent<PaymentMethodProps>;
|
|
16
|
+
export default PaymentMethod;
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
import{FunctionComponent}from'react';
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { BaseAmountComponent } from '../typings/index';
|
|
3
|
+
declare const PaymentMethodAmount: FunctionComponent<BaseAmountComponent>;
|
|
4
|
+
export default PaymentMethodAmount;
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
import{FunctionComponent,ReactNode
|
|
1
|
+
import { FunctionComponent, ReactNode } from 'react';
|
|
2
|
+
declare type PaymentMethodNameChildrenProps = Omit<PaymentMethodNameProps, 'children'> & {
|
|
3
|
+
labelName: string;
|
|
4
|
+
};
|
|
5
|
+
declare type PaymentMethodNameProps = {
|
|
6
|
+
children?: (props: PaymentMethodNameChildrenProps) => ReactNode;
|
|
7
|
+
} & JSX.IntrinsicElements['label'];
|
|
8
|
+
declare const PaymentMethodName: FunctionComponent<PaymentMethodNameProps>;
|
|
9
|
+
export default PaymentMethodName;
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
import{FunctionComponent}from'react';
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { BaseAmountComponent } from '../typings/index';
|
|
3
|
+
declare type Props = {
|
|
4
|
+
type?: 'amount';
|
|
5
|
+
labelFree?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare type PaymentMethodPriceProps = BaseAmountComponent & Props;
|
|
8
|
+
declare const PaymentMethodPrice: FunctionComponent<PaymentMethodPriceProps>;
|
|
9
|
+
export default PaymentMethodPrice;
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
import{FunctionComponent,ReactNode,ChangeEvent
|
|
1
|
+
import { FunctionComponent, ReactNode, ChangeEvent } from 'react';
|
|
2
|
+
import { PaymentMethod } from '@commercelayer/sdk';
|
|
3
|
+
declare type ShippingMethodRadioButtonChildrenProps = Omit<ShippingMethodRadioButtonProps, 'children'> & {
|
|
4
|
+
checked: boolean;
|
|
5
|
+
handleOnChange: (event: ChangeEvent<HTMLInputElement>) => Promise<void>;
|
|
6
|
+
};
|
|
7
|
+
declare type ShippingMethodRadioButtonProps = {
|
|
8
|
+
children?: (props: ShippingMethodRadioButtonChildrenProps) => ReactNode;
|
|
9
|
+
onChange?: (payment?: PaymentMethod | Record<string, any>) => void;
|
|
10
|
+
} & JSX.IntrinsicElements['input'];
|
|
11
|
+
declare const PaymentMethodRadioButton: FunctionComponent<ShippingMethodRadioButtonProps>;
|
|
12
|
+
export default PaymentMethodRadioButton;
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
import React,{ReactNode}from'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { PaymentMethodConfig } from '../reducers/PaymentMethodReducer';
|
|
3
|
+
declare type PaymentMethodsContainerProps = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
config?: PaymentMethodConfig;
|
|
6
|
+
};
|
|
7
|
+
declare const PaymentMethodsContainer: React.FunctionComponent<PaymentMethodsContainerProps>;
|
|
8
|
+
export default PaymentMethodsContainer;
|
|
@@ -1 +1,19 @@
|
|
|
1
|
-
import{FunctionComponent,ReactNode
|
|
1
|
+
import { FunctionComponent, ReactNode } from 'react';
|
|
2
|
+
import { LoaderType } from '../typings/index';
|
|
3
|
+
import { CustomerCardsTemplateChildren } from './utils/PaymentCardsTemplate';
|
|
4
|
+
export declare type CustomerCardsProps = {
|
|
5
|
+
handleClick: () => void;
|
|
6
|
+
};
|
|
7
|
+
export declare type CustomerSaveToWalletProps = {
|
|
8
|
+
name: 'save_payment_source_to_customer_wallet';
|
|
9
|
+
};
|
|
10
|
+
export declare type PaymentSourceProps = {
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
readonly?: boolean;
|
|
13
|
+
templateCustomerCards?: CustomerCardsTemplateChildren;
|
|
14
|
+
onClickCustomerCards?: () => void;
|
|
15
|
+
templateCustomerSaveToWallet?: (props: CustomerSaveToWalletProps) => ReactNode;
|
|
16
|
+
loader?: LoaderType;
|
|
17
|
+
} & JSX.IntrinsicElements['div'];
|
|
18
|
+
declare const PaymentSource: FunctionComponent<PaymentSourceProps>;
|
|
19
|
+
export default PaymentSource;
|
|
@@ -1 +1,15 @@
|
|
|
1
|
-
import{IconBrand}from'../context/PaymentSourceContext';
|
|
1
|
+
import { IconBrand } from '../context/PaymentSourceContext';
|
|
2
|
+
import { FunctionComponent } from 'react';
|
|
3
|
+
import { FunctionChildren } from '../typings/index';
|
|
4
|
+
declare type CustomComponent = FunctionChildren<Omit<Props & {
|
|
5
|
+
brand: IconBrand;
|
|
6
|
+
defaultSrc: string;
|
|
7
|
+
url: string;
|
|
8
|
+
}, 'children'>>;
|
|
9
|
+
declare type Props = {
|
|
10
|
+
children?: CustomComponent;
|
|
11
|
+
width?: number;
|
|
12
|
+
height?: number;
|
|
13
|
+
} & JSX.IntrinsicElements['img'];
|
|
14
|
+
declare const PaymentSourceBrandIcon: FunctionComponent<Props>;
|
|
15
|
+
export default PaymentSourceBrandIcon;
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
import{IconBrand}from'../context/PaymentSourceContext';
|
|
1
|
+
import { IconBrand } from '../context/PaymentSourceContext';
|
|
2
|
+
import { FunctionComponent } from 'react';
|
|
3
|
+
import { FunctionChildren } from '../typings/index';
|
|
4
|
+
declare type CustomComponent = FunctionChildren<Omit<Props & {
|
|
5
|
+
brand: IconBrand;
|
|
6
|
+
}, 'children'>>;
|
|
7
|
+
declare type Props = {
|
|
8
|
+
children?: CustomComponent;
|
|
9
|
+
label?: string;
|
|
10
|
+
} & JSX.IntrinsicElements['span'];
|
|
11
|
+
declare const PaymentSourceBrandName: FunctionComponent<Props>;
|
|
12
|
+
export default PaymentSourceBrandName;
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
import{FunctionComponent
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { FunctionChildren } from '../typings/index';
|
|
3
|
+
export declare type PaymentSourceDetailType = 'last4' | 'exp_year' | 'exp_month';
|
|
4
|
+
declare type CustomComponent = FunctionChildren<Omit<Props & {
|
|
5
|
+
text: string;
|
|
6
|
+
}, 'children'>>;
|
|
7
|
+
declare type Props = {
|
|
8
|
+
children?: CustomComponent;
|
|
9
|
+
type: PaymentSourceDetailType;
|
|
10
|
+
} & JSX.IntrinsicElements['span'];
|
|
11
|
+
declare const PaymentSourceDetail: FunctionComponent<Props>;
|
|
12
|
+
export default PaymentSourceDetail;
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
import{FunctionComponent,ReactNode}from'react';
|
|
1
|
+
import { FunctionComponent, ReactNode } from 'react';
|
|
2
|
+
import { FunctionChildren } from '../typings/index';
|
|
3
|
+
declare type CustomComponent = FunctionChildren<Omit<Props, 'children'>>;
|
|
4
|
+
declare type Props = {
|
|
5
|
+
children?: CustomComponent;
|
|
6
|
+
label?: string | ReactNode;
|
|
7
|
+
} & Omit<JSX.IntrinsicElements['button'], 'onClick'>;
|
|
8
|
+
declare const PaymentSourceEditButton: FunctionComponent<Props>;
|
|
9
|
+
export default PaymentSourceEditButton;
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
import{FunctionComponent,ReactNode
|
|
1
|
+
import { FunctionComponent, ReactNode } from 'react';
|
|
2
|
+
export declare type PaypalConfig = {
|
|
3
|
+
return_url: string;
|
|
4
|
+
cancel_url: string;
|
|
5
|
+
infoMessage?: {
|
|
6
|
+
text?: string | ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
declare type Props = Omit<PaypalConfig, 'return_url' | 'cancel_url'> & JSX.IntrinsicElements['div'];
|
|
11
|
+
declare const PaypalPayment: FunctionComponent<Props>;
|
|
12
|
+
export default PaypalPayment;
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
import{FunctionComponent,ReactNode
|
|
1
|
+
import { FunctionComponent, ReactNode } from 'react';
|
|
2
|
+
import { FunctionChildren } from '../typings/index';
|
|
3
|
+
declare type PlaceOrderButtonChildrenProps = FunctionChildren<Omit<PlaceOrderButtonProps, 'children'> & {
|
|
4
|
+
handleClick: () => Promise<void>;
|
|
5
|
+
}>;
|
|
6
|
+
declare type PlaceOrderButtonProps = {
|
|
7
|
+
children?: PlaceOrderButtonChildrenProps;
|
|
8
|
+
label?: string | ReactNode;
|
|
9
|
+
onClick?: (response: {
|
|
10
|
+
placed: boolean;
|
|
11
|
+
}) => void;
|
|
12
|
+
} & JSX.IntrinsicElements['button'];
|
|
13
|
+
declare const PlaceOrderButton: FunctionComponent<PlaceOrderButtonProps>;
|
|
14
|
+
export default PlaceOrderButton;
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
import{FunctionComponent,ReactNode}from'react';
|
|
1
|
+
import { FunctionComponent, ReactNode } from 'react';
|
|
2
|
+
import { PlaceOrderOptions } from '../reducers/PlaceOrderReducer';
|
|
3
|
+
declare type PlaceOrderContainerProps = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
options?: PlaceOrderOptions;
|
|
6
|
+
};
|
|
7
|
+
declare const PlaceOrderContainer: FunctionComponent<PlaceOrderContainerProps>;
|
|
8
|
+
export default PlaceOrderContainer;
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { Price as PriceType } from '@commercelayer/sdk';
|
|
3
|
+
import { FunctionChildren, LoaderType } from '../typings/index';
|
|
4
|
+
declare type PriceChildrenProps = FunctionChildren<{
|
|
5
|
+
loading: boolean;
|
|
6
|
+
loader: LoaderType;
|
|
7
|
+
prices: PriceType[];
|
|
8
|
+
} & Omit<PriceProps, 'children'>>;
|
|
9
|
+
export interface PriceProps extends Partial<JSX.IntrinsicElements['span']> {
|
|
10
|
+
children?: PriceChildrenProps;
|
|
11
|
+
compareClassName?: string;
|
|
12
|
+
showCompare?: boolean;
|
|
13
|
+
skuCode?: string;
|
|
14
|
+
}
|
|
15
|
+
declare const Price: FunctionComponent<PriceProps>;
|
|
16
|
+
export default Price;
|
|
@@ -1 +1,11 @@
|
|
|
1
|
-
import{FunctionComponent,ReactNode}from'react';
|
|
1
|
+
import { FunctionComponent, ReactNode } from 'react';
|
|
2
|
+
import { LoaderType } from '../typings/index';
|
|
3
|
+
declare type PricesContainerProps = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
filters?: object;
|
|
6
|
+
loader?: LoaderType;
|
|
7
|
+
perPage?: number;
|
|
8
|
+
skuCode?: string;
|
|
9
|
+
};
|
|
10
|
+
declare const PricesContainer: FunctionComponent<PricesContainerProps>;
|
|
11
|
+
export default PricesContainer;
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
import{FunctionComponent}from'react';
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { BaseInputProps } from './utils/BaseInput';
|
|
3
|
+
declare const PrivacyAndTermsCheckbox: FunctionComponent<Partial<BaseInputProps>>;
|
|
4
|
+
export default PrivacyAndTermsCheckbox;
|
|
@@ -1 +1,17 @@
|
|
|
1
|
-
import React,{FunctionComponent
|
|
1
|
+
import React, { FunctionComponent } from 'react';
|
|
2
|
+
import { FunctionChildren } from '../typings/index';
|
|
3
|
+
declare type QuantitySelectorChildrenProps = FunctionChildren<Omit<QuantitySelectorProps, 'children'> & {
|
|
4
|
+
handleChange: (event: React.MouseEvent<HTMLInputElement>) => void;
|
|
5
|
+
handleBlur: (event: React.MouseEvent<HTMLInputElement>) => void;
|
|
6
|
+
}>;
|
|
7
|
+
declare type QuantitySelectorProps = {
|
|
8
|
+
children?: QuantitySelectorChildrenProps;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
min?: number;
|
|
11
|
+
max?: number;
|
|
12
|
+
value?: string;
|
|
13
|
+
skuCode?: string;
|
|
14
|
+
skuListId?: string;
|
|
15
|
+
} & JSX.IntrinsicElements['input'];
|
|
16
|
+
declare const QuantitySelector: FunctionComponent<QuantitySelectorProps>;
|
|
17
|
+
export default QuantitySelector;
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
import{FunctionComponent,ReactNode}from'react';
|
|
1
|
+
import { FunctionComponent, ReactNode } from 'react';
|
|
2
|
+
import { FunctionChildren } from '../typings/index';
|
|
3
|
+
declare type SaveAddressesButtonChildrenProps = FunctionChildren<Omit<SaveAddressesButtonProps, 'children'>>;
|
|
4
|
+
declare type SaveAddressesButtonProps = {
|
|
5
|
+
children?: SaveAddressesButtonChildrenProps;
|
|
6
|
+
label?: string | ReactNode;
|
|
7
|
+
onClick?: () => void;
|
|
8
|
+
} & JSX.IntrinsicElements['button'];
|
|
9
|
+
declare const SaveAddressesButton: FunctionComponent<SaveAddressesButtonProps>;
|
|
10
|
+
export default SaveAddressesButton;
|
|
@@ -1 +1,13 @@
|
|
|
1
|
-
import{FunctionComponent,ReactNode
|
|
1
|
+
import { FunctionComponent, ReactNode } from 'react';
|
|
2
|
+
import { FunctionChildren } from '../typings/index';
|
|
3
|
+
declare type ParentProps = {
|
|
4
|
+
handleClick: () => any;
|
|
5
|
+
};
|
|
6
|
+
declare type SaveAddressesButtonChildrenProps = FunctionChildren<Omit<SaveCustomerButtonProps & ParentProps, 'children'>>;
|
|
7
|
+
declare type SaveCustomerButtonProps = {
|
|
8
|
+
children?: SaveAddressesButtonChildrenProps;
|
|
9
|
+
label?: string | ReactNode;
|
|
10
|
+
onClick?: () => void;
|
|
11
|
+
} & JSX.IntrinsicElements['button'];
|
|
12
|
+
declare const SaveCustomerButton: FunctionComponent<SaveCustomerButtonProps>;
|
|
13
|
+
export default SaveCustomerButton;
|
|
@@ -1 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { LoaderType } from '../typings/index';
|
|
3
|
+
declare type ShipmentProps = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
loader?: LoaderType;
|
|
6
|
+
autoSelectSingleShippingMethod?: boolean | (() => void);
|
|
7
|
+
};
|
|
8
|
+
declare function Shipment({ children, loader, autoSelectSingleShippingMethod, }: ShipmentProps): JSX.Element;
|
|
9
|
+
declare namespace Shipment {
|
|
10
|
+
var propTypes: {
|
|
11
|
+
children: import("prop-types").Validator<boolean | import("react").ReactChild | import("react").ReactFragment | import("react").ReactPortal | (() => ReactNode)>;
|
|
12
|
+
};
|
|
13
|
+
var displayName: string;
|
|
14
|
+
}
|
|
15
|
+
export default Shipment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import{
|
|
1
|
+
import{jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";import{useContext,useState,useEffect}from"react";import ShipmentContext from"../context/ShipmentContext";import ShipmentChildrenContext from"../context/ShipmentChildrenContext";import components from"../config/components";import getLoaderComponent from"../utils/getLoaderComponent";const propTypes=components.Shipment.propTypes,displayName=components.Shipment.displayName;export default function Shipment({children,loader="Loading...",autoSelectSingleShippingMethod=!1}){const[loading,setLoading]=useState(!0),{shipments,deliveryLeadTimes,setShippingMethod}=useContext(ShipmentContext);useEffect(()=>(shipments&&setLoading(!1),autoSelectSingleShippingMethod&&shipments&&shipments.forEach(shipment=>{var _a;const isSingle=((_a=shipment==null?void 0:shipment.available_shipping_methods)===null||_a===void 0?void 0:_a.length)===1;if(!(shipment==null?void 0:shipment.shipping_method)&&isSingle){const[shippingMethod]=(shipment==null?void 0:shipment.available_shipping_methods)||[];setShippingMethod(shipment==null?void 0:shipment.id,shippingMethod==null?void 0:shippingMethod.id),typeof autoSelectSingleShippingMethod=="function"&&autoSelectSingleShippingMethod()}}),()=>{setLoading(!0)}),[shipments]);const components2=shipments&&shipments.map((shipment,k)=>{var _a;const shipmentLineItems=shipment.shipment_line_items,lineItems=shipmentLineItems==null?void 0:shipmentLineItems.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:(_a=shipment.shipping_method)===null||_a===void 0?void 0:_a.id,stockTransfers=shipment.stock_transfers,times=deliveryLeadTimes==null?void 0:deliveryLeadTimes.filter(time=>{var _a2,_b;return((_a2=time.stock_location)===null||_a2===void 0?void 0:_a2.id)===((_b=shipment.stock_location)===null||_b===void 0?void 0:_b.id)}),shipmentProps={lineItems,shippingMethods,currentShippingMethodId,stockTransfers,deliveryLeadTimes:times,shipment,keyNumber:k+1};return _jsx(ShipmentChildrenContext.Provider,Object.assign({value:shipmentProps},{children}),k)});return loading?getLoaderComponent(loader):_jsx(_Fragment,{children:components2})}Shipment.propTypes=propTypes,Shipment.displayName=displayName;
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
import{FunctionComponent,ReactNode
|
|
1
|
+
import { FunctionComponent, ReactNode } from 'react';
|
|
2
|
+
import { Shipment } from '@commercelayer/sdk';
|
|
3
|
+
declare type ShipmentFieldChildrenProps = Omit<ShipmentFieldProps, 'children'> & {
|
|
4
|
+
shipment: Shipment;
|
|
5
|
+
};
|
|
6
|
+
export declare type ShipmentAttribute = 'number' | 'currency_code' | 'status' | 'cost_amount_cents' | 'cost_amount_float' | 'formatted_cost_amount' | 'key_number';
|
|
7
|
+
declare type ShipmentFieldProps = {
|
|
8
|
+
children?: (props: ShipmentFieldChildrenProps) => ReactNode;
|
|
9
|
+
name: ShipmentAttribute;
|
|
10
|
+
} & JSX.IntrinsicElements['span'];
|
|
11
|
+
declare const ShipmentField: FunctionComponent<ShipmentFieldProps>;
|
|
12
|
+
export default ShipmentField;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
import React,{ReactNode}from'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
declare type ShipmentsContainerProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
};
|
|
5
|
+
declare const ShipmentsContainer: React.FunctionComponent<ShipmentsContainerProps>;
|
|
6
|
+
export default ShipmentsContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _jsx}from"react/jsx-runtime";import ShipmentContext,{defaultShipmentContext}from"../context/ShipmentContext";import{useContext,useEffect,useReducer}from"react";import shipmentReducer,{shipmentInitialState,setShipmentErrors,getShipments,setShippingMethod}from"../reducers/ShipmentReducer";import OrderContext from"../context/OrderContext";import CommerceLayerContext from"../context/CommerceLayerContext";import components from"../config/components";import{isEmpty}from"lodash";const propTypes=components.ShipmentsContainer.propTypes,displayName=components.ShipmentsContainer.displayName,ShipmentsContainer=props=>{const{children}=props,[state,dispatch]=useReducer(shipmentReducer,shipmentInitialState),{order,getOrder,include,addResourceToInclude,includeLoaded}=useContext(OrderContext),config=useContext(CommerceLayerContext);useEffect(()=>{(include==null?void 0:include.includes("shipments.available_shipping_methods"))?(includeLoaded==null?void 0: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}}):addResourceToInclude({newResource:["shipments.available_shipping_methods","shipments.shipment_line_items.line_item","shipments.shipping_method","shipments.stock_transfers.line_item","shipments.stock_location"]}),order&&!isEmpty(config)&&order.shipments&&getShipments({order,dispatch,config})},[order,include,includeLoaded]),useEffect(()=>(order&&(order.shipments&&order.shipments.length>0&&order.shipments.map(shipment=>shipment.available_shipping_methods&&shipment.available_shipping_methods.length>0).includes(!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})=>item_type==="skus").map(lineItem=>{var _a,_b,_c,_d;return!!(((_a=lineItem.item)===null||_a===void 0?void 0:_a.do_not_ship)||((_b=lineItem.item)===null||_b===void 0?void 0:_b.do_not_track)||((_d=(_c=lineItem.item)===null||_c===void 0?void 0:_c.inventory)===null||_d===void 0?void 0:_d.quantity)>=(lineItem==null?void 0:lineItem.quantity))}).includes(!1)&&setShipmentErrors([...state.errors||[],{code:"OUT_OF_STOCK",message:"No stock available",resource:"line_items"}],dispatch)),()=>{setShipmentErrors([],dispatch)}),[order]);const contextValue=Object.assign(Object.assign({},state),{setShipmentErrors:errors=>defaultShipmentContext.setShipmentErrors(errors,dispatch),setShippingMethod:async(shipmentId,shippingMethodId)=>await setShippingMethod({shippingMethodId,shipmentId,config,getOrder,order})});return _jsx(ShipmentContext.Provider,Object.assign({value:contextValue},{children}))};ShipmentsContainer.propTypes=propTypes,ShipmentsContainer.displayName=displayName;export default ShipmentsContainer;
|
|
1
|
+
import{jsx as _jsx}from"react/jsx-runtime";import ShipmentContext,{defaultShipmentContext}from"../context/ShipmentContext";import{useContext,useEffect,useReducer}from"react";import shipmentReducer,{shipmentInitialState,setShipmentErrors,getShipments,setShippingMethod}from"../reducers/ShipmentReducer";import OrderContext from"../context/OrderContext";import CommerceLayerContext from"../context/CommerceLayerContext";import components from"../config/components";import{isEmpty}from"lodash";const propTypes=components.ShipmentsContainer.propTypes,displayName=components.ShipmentsContainer.displayName,ShipmentsContainer=props=>{const{children}=props,[state,dispatch]=useReducer(shipmentReducer,shipmentInitialState),{order,getOrder,include,addResourceToInclude,includeLoaded}=useContext(OrderContext),config=useContext(CommerceLayerContext);useEffect(()=>{(include==null?void 0:include.includes("shipments.available_shipping_methods"))?(includeLoaded==null?void 0: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}}):addResourceToInclude({newResource:["shipments.available_shipping_methods","shipments.shipment_line_items.line_item","shipments.shipping_method","shipments.stock_transfers.line_item","shipments.stock_location"]}),order&&!isEmpty(config)&&order.shipments&&getShipments({order,dispatch,config})},[order,include,includeLoaded]),useEffect(()=>(order&&(order.shipments&&order.shipments.length>0&&order.shipments.map(shipment=>shipment.available_shipping_methods&&shipment.available_shipping_methods.length>0).includes(!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})=>item_type==="skus").map(lineItem=>{var _a,_b,_c,_d;return!!(((_a=lineItem.item)===null||_a===void 0?void 0:_a.do_not_ship)||((_b=lineItem.item)===null||_b===void 0?void 0:_b.do_not_track)||((_d=(_c=lineItem.item)===null||_c===void 0?void 0:_c.inventory)===null||_d===void 0?void 0:_d.quantity)>=(lineItem==null?void 0:lineItem.quantity))}).includes(!1)&&setShipmentErrors([...state.errors||[],{code:"OUT_OF_STOCK",message:"No stock available",resource:"line_items"}],dispatch)),()=>{setShipmentErrors([],dispatch)}),[order==null?void 0:order.shipments]);const contextValue=Object.assign(Object.assign({},state),{setShipmentErrors:errors=>defaultShipmentContext.setShipmentErrors(errors,dispatch),setShippingMethod:async(shipmentId,shippingMethodId)=>await setShippingMethod({shippingMethodId,shipmentId,config,getOrder,order})});return _jsx(ShipmentContext.Provider,Object.assign({value:contextValue},{children}))};ShipmentsContainer.propTypes=propTypes,ShipmentsContainer.displayName=displayName;export default ShipmentsContainer;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
import{FunctionComponent,ReactNode}from'react';
|
|
1
|
+
import { FunctionComponent, ReactNode } from 'react';
|
|
2
|
+
declare type Props = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
};
|
|
5
|
+
declare const ShippingAddressContainer: FunctionComponent<Props>;
|
|
6
|
+
export default ShippingAddressContainer;
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
import{FunctionComponent,ReactNode}from'react';
|
|
1
|
+
import { FunctionComponent, ReactNode } from 'react';
|
|
2
|
+
declare type ShippingAddressFormProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
reset?: boolean;
|
|
5
|
+
errorClassName?: string;
|
|
6
|
+
} & Omit<JSX.IntrinsicElements['form'], 'onSubmit'>;
|
|
7
|
+
declare const ShippingAddressForm: FunctionComponent<ShippingAddressFormProps>;
|
|
8
|
+
export default ShippingAddressForm;
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
import{FunctionComponent}from'react';
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { BaseAmountComponent } from '../typings/index';
|
|
3
|
+
declare const ShippingAmount: FunctionComponent<BaseAmountComponent>;
|
|
4
|
+
export default ShippingAmount;
|