@commercelayer/react-components 4.8.5-beta.0 → 4.8.5
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/hooks/useCommerceLayer.d.ts +5 -0
- package/lib/cjs/hooks/useCustomerContainer.d.ts +3 -0
- package/lib/cjs/hooks/useOrderContainer.d.ts +6 -0
- package/lib/esm/hooks/useCommerceLayer.d.ts +5 -0
- package/lib/esm/hooks/useCustomerContainer.d.ts +3 -0
- package/lib/esm/hooks/useOrderContainer.d.ts +6 -0
- package/package.json +1 -1
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { type CommerceLayerClient } from '@commercelayer/sdk';
|
|
2
2
|
interface ReturnProps {
|
|
3
|
+
/** This is the access token used to initialize the sdk client. It need to be set as prop in the main `<CommerceLayer>` component */
|
|
3
4
|
accessToken?: string;
|
|
5
|
+
/** This method can be used to initialize an sdk client and perform list, retrieve, update or delete operations on any resource */
|
|
4
6
|
sdkClient: () => CommerceLayerClient | undefined;
|
|
5
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* React Hook that provides access to the official Commerce Layer SDK JS Client.
|
|
10
|
+
**/
|
|
6
11
|
export declare function useCommerceLayer(): ReturnProps;
|
|
7
12
|
export default useCommerceLayer;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { type CustomerState } from '../reducers/CustomerReducer';
|
|
2
2
|
interface TReturnCustomer extends Omit<CustomerState, 'errors' | 'isGuest'> {
|
|
3
3
|
}
|
|
4
|
+
/**
|
|
5
|
+
* React Hook that provides access to the order context stored in the `<CustomerContainer>` component.
|
|
6
|
+
**/
|
|
4
7
|
export declare function useCustomerContainer(): TReturnCustomer;
|
|
5
8
|
export default useCustomerContainer;
|
|
@@ -2,9 +2,15 @@ import { type createOrder, type OrderState, type addToCart } from '../reducers/O
|
|
|
2
2
|
type TAddToCartParams = Omit<Parameters<typeof addToCart>[number], 'buyNowMode' | 'state' | 'dispatch' | 'setLocalOrder' | 'errors' | 'checkoutUrl' | 'persistKey' | 'config'>;
|
|
3
3
|
type TCreateCartParams = Pick<Parameters<typeof createOrder>[number], 'orderAttributes' | 'orderMetadata'>;
|
|
4
4
|
interface TReturnOrder extends Omit<OrderState, 'loading' | 'include' | 'includeLoaded' | 'withoutIncludes' | 'orderId'> {
|
|
5
|
+
/** Refetch the current order and update the context */
|
|
5
6
|
reloadOrder: () => Promise<OrderState['order']>;
|
|
7
|
+
/** Allow to add a SKU or a Bundle to the order stored in the context */
|
|
6
8
|
addToCart: (params: TAddToCartParams) => ReturnType<typeof addToCart>;
|
|
9
|
+
/** Allow to create a new order and store it in the OrderContainer context */
|
|
7
10
|
createOrder: (params: TCreateCartParams) => Promise<string | undefined>;
|
|
8
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* React Hook that provides access to the order context stored in the `<OrderContainer>` component.
|
|
14
|
+
**/
|
|
9
15
|
export declare function useOrderContainer(): TReturnOrder;
|
|
10
16
|
export default useOrderContainer;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { type CommerceLayerClient } from '@commercelayer/sdk';
|
|
2
2
|
interface ReturnProps {
|
|
3
|
+
/** This is the access token used to initialize the sdk client. It need to be set as prop in the main `<CommerceLayer>` component */
|
|
3
4
|
accessToken?: string;
|
|
5
|
+
/** This method can be used to initialize an sdk client and perform list, retrieve, update or delete operations on any resource */
|
|
4
6
|
sdkClient: () => CommerceLayerClient | undefined;
|
|
5
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* React Hook that provides access to the official Commerce Layer SDK JS Client.
|
|
10
|
+
**/
|
|
6
11
|
export declare function useCommerceLayer(): ReturnProps;
|
|
7
12
|
export default useCommerceLayer;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { type CustomerState } from '../reducers/CustomerReducer';
|
|
2
2
|
interface TReturnCustomer extends Omit<CustomerState, 'errors' | 'isGuest'> {
|
|
3
3
|
}
|
|
4
|
+
/**
|
|
5
|
+
* React Hook that provides access to the order context stored in the `<CustomerContainer>` component.
|
|
6
|
+
**/
|
|
4
7
|
export declare function useCustomerContainer(): TReturnCustomer;
|
|
5
8
|
export default useCustomerContainer;
|
|
@@ -2,9 +2,15 @@ import { type createOrder, type OrderState, type addToCart } from '../reducers/O
|
|
|
2
2
|
type TAddToCartParams = Omit<Parameters<typeof addToCart>[number], 'buyNowMode' | 'state' | 'dispatch' | 'setLocalOrder' | 'errors' | 'checkoutUrl' | 'persistKey' | 'config'>;
|
|
3
3
|
type TCreateCartParams = Pick<Parameters<typeof createOrder>[number], 'orderAttributes' | 'orderMetadata'>;
|
|
4
4
|
interface TReturnOrder extends Omit<OrderState, 'loading' | 'include' | 'includeLoaded' | 'withoutIncludes' | 'orderId'> {
|
|
5
|
+
/** Refetch the current order and update the context */
|
|
5
6
|
reloadOrder: () => Promise<OrderState['order']>;
|
|
7
|
+
/** Allow to add a SKU or a Bundle to the order stored in the context */
|
|
6
8
|
addToCart: (params: TAddToCartParams) => ReturnType<typeof addToCart>;
|
|
9
|
+
/** Allow to create a new order and store it in the OrderContainer context */
|
|
7
10
|
createOrder: (params: TCreateCartParams) => Promise<string | undefined>;
|
|
8
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* React Hook that provides access to the order context stored in the `<OrderContainer>` component.
|
|
14
|
+
**/
|
|
9
15
|
export declare function useOrderContainer(): TReturnOrder;
|
|
10
16
|
export default useOrderContainer;
|