@commercelayer/react-components 4.13.1-beta.0 → 4.13.1-beta.2
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/payment_methods/PaymentMethod.d.ts +3 -2
- package/lib/cjs/components/payment_methods/PaymentMethod.js +1 -1
- package/lib/cjs/components/prices/PricesContainer.d.ts +2 -1
- package/lib/cjs/reducers/CustomerReducer.d.ts +3 -4
- package/lib/cjs/reducers/PriceReducer.d.ts +2 -2
- package/lib/esm/components/payment_methods/PaymentMethod.d.ts +3 -2
- package/lib/esm/components/payment_methods/PaymentMethod.js +1 -1
- package/lib/esm/components/prices/PricesContainer.d.ts +2 -1
- package/lib/esm/reducers/CustomerReducer.d.ts +3 -4
- package/lib/esm/reducers/PriceReducer.d.ts +2 -2
- package/package.json +2 -2
|
@@ -2,9 +2,10 @@ import type { LoaderType } from '../../typings/index';
|
|
|
2
2
|
import type { Order, PaymentMethod as PaymentMethodType } from '@commercelayer/sdk';
|
|
3
3
|
import type { PaymentResource } from '../../reducers/PaymentMethodReducer';
|
|
4
4
|
import type { DefaultChildrenType } from '../../typings/globals';
|
|
5
|
-
interface
|
|
5
|
+
export interface PaymentMethodOnClickParams {
|
|
6
6
|
payment?: PaymentMethodType | Record<string, any>;
|
|
7
7
|
order?: Order;
|
|
8
|
+
paymentSource?: Order['payment_source'];
|
|
8
9
|
}
|
|
9
10
|
type Props = {
|
|
10
11
|
/**
|
|
@@ -30,7 +31,7 @@ type Props = {
|
|
|
30
31
|
expressPayments?: boolean;
|
|
31
32
|
} & Omit<JSX.IntrinsicElements['div'], 'onClick' | 'children'> & ({
|
|
32
33
|
clickableContainer: true;
|
|
33
|
-
onClick?: (params?:
|
|
34
|
+
onClick?: (params?: PaymentMethodOnClickParams) => void;
|
|
34
35
|
} | {
|
|
35
36
|
clickableContainer?: never;
|
|
36
37
|
onClick?: never;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentMethod=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),getLoaderComponent_1=tslib_1.__importDefault(require("../../utils/getLoaderComponent")),useCustomContext_1=tslib_1.__importDefault(require("../../utils/hooks/useCustomContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),getPaymentAttributes_1=require("../../utils/getPaymentAttributes"),isEmpty_1=require("../../utils/isEmpty"),expressPaymentHelper_1=require("../../utils/expressPaymentHelper");function PaymentMethod(_a){var{children,className,activeClass,loader="Loading...",clickableContainer,autoSelectSinglePaymentMethod,expressPayments,hide,onClick}=_a,p=tslib_1.__rest(_a,["children","className","activeClass","loader","clickableContainer","autoSelectSinglePaymentMethod","expressPayments","hide","onClick"]);const[loading,setLoading]=(0,react_1.useState)(!0),[paymentSelected,setPaymentSelected]=(0,react_1.useState)(""),{paymentMethods,currentPaymentMethodId,setPaymentMethod,setLoading:setLoadingPlaceOrder,paymentSource,setPaymentSource,config}=(0,useCustomContext_1.default)({context:PaymentMethodContext_1.default,contextComponentName:"PaymentMethodsContainer",currentComponentName:"PaymentMethod",key:"paymentMethods"}),{order}=(0,react_1.useContext)(OrderContext_1.default),{getCustomerPaymentSources}=(0,react_1.useContext)(CustomerContext_1.default);(0,react_1.useEffect)(()=>{if(paymentMethods!=null&&!(0,isEmpty_1.isEmpty)(paymentMethods)&&expressPayments){const[paymentMethod]=(0,expressPaymentHelper_1.getAvailableExpressPayments)(paymentMethods);!paymentSource&&paymentMethod!=null&&tslib_1.__awaiter(this,void 0,void 0,function*(){setLoadingPlaceOrder({loading:!0}),setPaymentSelected(paymentMethod.id);const paymentMethodId=paymentMethod?.id,paymentResource=paymentMethod?.payment_source_type;yield setPaymentMethod({paymentResource,paymentMethodId})
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentMethod=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),react_1=require("react"),PaymentMethodContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodContext")),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),getLoaderComponent_1=tslib_1.__importDefault(require("../../utils/getLoaderComponent")),useCustomContext_1=tslib_1.__importDefault(require("../../utils/hooks/useCustomContext")),OrderContext_1=tslib_1.__importDefault(require("../../context/OrderContext")),CustomerContext_1=tslib_1.__importDefault(require("../../context/CustomerContext")),getPaymentAttributes_1=require("../../utils/getPaymentAttributes"),isEmpty_1=require("../../utils/isEmpty"),expressPaymentHelper_1=require("../../utils/expressPaymentHelper");function PaymentMethod(_a){var{children,className,activeClass,loader="Loading...",clickableContainer,autoSelectSinglePaymentMethod,expressPayments,hide,onClick}=_a,p=tslib_1.__rest(_a,["children","className","activeClass","loader","clickableContainer","autoSelectSinglePaymentMethod","expressPayments","hide","onClick"]);const[loading,setLoading]=(0,react_1.useState)(!0),[paymentSelected,setPaymentSelected]=(0,react_1.useState)(""),{paymentMethods,currentPaymentMethodId,setPaymentMethod,setLoading:setLoadingPlaceOrder,paymentSource,setPaymentSource,config}=(0,useCustomContext_1.default)({context:PaymentMethodContext_1.default,contextComponentName:"PaymentMethodsContainer",currentComponentName:"PaymentMethod",key:"paymentMethods"}),{order}=(0,react_1.useContext)(OrderContext_1.default),{getCustomerPaymentSources}=(0,react_1.useContext)(CustomerContext_1.default);(0,react_1.useEffect)(()=>{if(paymentMethods!=null&&!(0,isEmpty_1.isEmpty)(paymentMethods)&&expressPayments){const[paymentMethod]=(0,expressPaymentHelper_1.getAvailableExpressPayments)(paymentMethods);!paymentSource&&paymentMethod!=null&&tslib_1.__awaiter(this,void 0,void 0,function*(){setLoadingPlaceOrder({loading:!0}),setPaymentSelected(paymentMethod.id);const paymentMethodId=paymentMethod?.id,paymentResource=paymentMethod?.payment_source_type;yield setPaymentMethod({paymentResource,paymentMethodId});const ps=yield setPaymentSource({paymentResource,order});ps&&paymentMethod&&onClick!=null&&(onClick({payment:paymentMethod,order,paymentSource:ps}),setTimeout(()=>{setLoading(!1)},200)),setLoadingPlaceOrder({loading:!1})})}},[!(0,isEmpty_1.isEmpty)(paymentMethods),expressPayments]),(0,react_1.useEffect)(()=>{paymentMethods!=null&&autoSelectSinglePaymentMethod!=null&&!expressPayments&&tslib_1.__awaiter(this,void 0,void 0,function*(){if(paymentMethods.length===1){const[paymentMethod]=paymentMethods??[];if(paymentMethod&&!paymentSource){setLoadingPlaceOrder({loading:!0}),setPaymentSelected(paymentMethod.id);const paymentMethodId=paymentMethod?.id,paymentResource=paymentMethod?.payment_source_type;yield setPaymentMethod({paymentResource,paymentMethodId});let attributes={};config!=null&&paymentResource==="paypal_payments"&&(attributes=(0,getPaymentAttributes_1.getPaypalAttributes)(paymentResource,config)),config!=null&&paymentResource==="external_payments"&&(attributes=(0,getPaymentAttributes_1.getExternalPaymentAttributes)(paymentResource,config));const ps=yield setPaymentSource({paymentResource,order,attributes});ps&&paymentMethod&&onClick!=null&&(onClick({payment:paymentMethod,order,paymentSource:ps}),setTimeout(()=>{setLoading(!1)},200)),getCustomerPaymentSources&&getCustomerPaymentSources(),setLoadingPlaceOrder({loading:!1})}typeof autoSelectSinglePaymentMethod=="function"&&autoSelectSinglePaymentMethod()}else setTimeout(()=>{setLoading(!1)},200)})},[paymentMethods,expressPayments]),(0,react_1.useEffect)(()=>(paymentMethods&&(paymentMethods.length===1&&autoSelectSinglePaymentMethod?paymentSource&&setTimeout(()=>{setLoading(!1)},200):setLoading(!1)),currentPaymentMethodId&&setPaymentSelected(currentPaymentMethodId),()=>{setLoading(!0)}),[paymentMethods,currentPaymentMethodId]);const components=paymentMethods?.filter(payment=>{if(Array.isArray(hide)){const source=payment?.payment_source_type;return!hide?.includes(source)}else if(typeof hide=="function")return hide(payment);return!0}).map((payment,k)=>{const isActive=currentPaymentMethodId===payment?.id,paymentMethodProps={payment,clickableContainer,paymentSelected,setPaymentSelected,expressPayments},paymentResource=payment?.payment_source_type,onClickable=clickableContainer?e=>tslib_1.__awaiter(this,void 0,void 0,function*(){e.stopPropagation(),setLoadingPlaceOrder({loading:!0}),setPaymentSelected(payment.id);const paymentMethodId=payment?.id,{order:order2}=yield setPaymentMethod({paymentResource,paymentMethodId});onClick&&onClick({payment,order:order2}),setLoadingPlaceOrder({loading:!1})}):void 0;return(0,jsx_runtime_1.jsx)("div",Object.assign({"data-testid":paymentResource,className:`${className??""} ${isActive&&activeClass!=null?activeClass:""}`,onClick:onClickable},p,{children:(0,jsx_runtime_1.jsx)(PaymentMethodChildrenContext_1.default.Provider,{value:paymentMethodProps,children})}),k)});return loading?(0,getLoaderComponent_1.default)(loader):(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:components})}exports.PaymentMethod=PaymentMethod,exports.default=PaymentMethod;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type LoaderType } from '../../typings/index';
|
|
2
|
+
import { type QueryPageSize } from '@commercelayer/sdk';
|
|
2
3
|
interface Props {
|
|
3
4
|
/**
|
|
4
5
|
* Any valid JSX.Element(s).
|
|
@@ -17,7 +18,7 @@ interface Props {
|
|
|
17
18
|
/**
|
|
18
19
|
* Prices per page to be fetched
|
|
19
20
|
*/
|
|
20
|
-
perPage?:
|
|
21
|
+
perPage?: QueryPageSize;
|
|
21
22
|
/**
|
|
22
23
|
* SKU code to fetch the prices for. If not provided, the `sku_code` will be retrieved from the `<Price>` component(s) nested as children.
|
|
23
24
|
*/
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { type Dispatch } from 'react';
|
|
2
2
|
import { type BaseError } from '../typings/errors';
|
|
3
|
-
import type { Address, AddressCreate, AddressUpdate, Customer, CustomerPaymentSource, Order, OrderSubscription } from '@commercelayer/sdk';
|
|
3
|
+
import type { Address, AddressCreate, AddressUpdate, Customer, CustomerPaymentSource, ListResponse, Order, OrderSubscription, QueryPageSize } from '@commercelayer/sdk';
|
|
4
4
|
import { type CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
5
5
|
import { type updateOrder } from './OrderReducer';
|
|
6
|
-
import { type ListResponse } from '@commercelayer/sdk/lib/cjs/resource';
|
|
7
6
|
import { type TriggerAttributeHelper } from '../utils/triggerAttributeHelper';
|
|
8
7
|
export type CustomerActionType = 'setErrors' | 'setCustomerEmail' | 'setAddresses' | 'setPayments' | 'setOrders' | 'setSubscriptions' | 'setCustomers';
|
|
9
8
|
export interface CustomerActionPayload {
|
|
@@ -112,7 +111,7 @@ interface GetCustomerOrdersProps {
|
|
|
112
111
|
/**
|
|
113
112
|
* The page size
|
|
114
113
|
*/
|
|
115
|
-
pageSize?:
|
|
114
|
+
pageSize?: QueryPageSize;
|
|
116
115
|
/**
|
|
117
116
|
* The page number
|
|
118
117
|
*/
|
|
@@ -160,7 +159,7 @@ export type SetResourceTriggerParams = {
|
|
|
160
159
|
/**
|
|
161
160
|
* The page size
|
|
162
161
|
*/
|
|
163
|
-
pageSize?:
|
|
162
|
+
pageSize?: QueryPageSize;
|
|
164
163
|
/**
|
|
165
164
|
* The page number
|
|
166
165
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type BaseAction, type LoaderType } from '../typings/index';
|
|
2
|
-
import { type Price } from '@commercelayer/sdk';
|
|
2
|
+
import { type QueryPageSize, type Price } from '@commercelayer/sdk';
|
|
3
3
|
import { type CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
4
4
|
import { type Dispatch } from 'react';
|
|
5
5
|
import { type BaseError } from '../typings/errors';
|
|
@@ -25,7 +25,7 @@ export declare function setSkuCodes({ skuCodes, dispatch }: {
|
|
|
25
25
|
export declare function getSkusPrice(skuCodes: SkuCodesPrice, { config, dispatch, perPage, filters }: {
|
|
26
26
|
config: CommerceLayerConfig;
|
|
27
27
|
dispatch: Dispatch<PriceAction>;
|
|
28
|
-
perPage:
|
|
28
|
+
perPage: QueryPageSize;
|
|
29
29
|
filters: Record<string, any>;
|
|
30
30
|
}): void;
|
|
31
31
|
export type UnsetPriceState = (dispatch: Dispatch<PriceAction>) => void;
|
|
@@ -2,9 +2,10 @@ import type { LoaderType } from '../../typings/index';
|
|
|
2
2
|
import type { Order, PaymentMethod as PaymentMethodType } from '@commercelayer/sdk';
|
|
3
3
|
import type { PaymentResource } from '../../reducers/PaymentMethodReducer';
|
|
4
4
|
import type { DefaultChildrenType } from '../../typings/globals';
|
|
5
|
-
interface
|
|
5
|
+
export interface PaymentMethodOnClickParams {
|
|
6
6
|
payment?: PaymentMethodType | Record<string, any>;
|
|
7
7
|
order?: Order;
|
|
8
|
+
paymentSource?: Order['payment_source'];
|
|
8
9
|
}
|
|
9
10
|
type Props = {
|
|
10
11
|
/**
|
|
@@ -30,7 +31,7 @@ type Props = {
|
|
|
30
31
|
expressPayments?: boolean;
|
|
31
32
|
} & Omit<JSX.IntrinsicElements['div'], 'onClick' | 'children'> & ({
|
|
32
33
|
clickableContainer: true;
|
|
33
|
-
onClick?: (params?:
|
|
34
|
+
onClick?: (params?: PaymentMethodOnClickParams) => void;
|
|
34
35
|
} | {
|
|
35
36
|
clickableContainer?: never;
|
|
36
37
|
onClick?: never;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";import{useState,useEffect,useContext}from"react";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import getLoaderComponent from"../../utils/getLoaderComponent";import useCustomContext from"../../utils/hooks/useCustomContext";import OrderContext from"../../context/OrderContext";import CustomerContext from"../../context/CustomerContext";import{getExternalPaymentAttributes,getPaypalAttributes}from"../../utils/getPaymentAttributes";import{isEmpty}from"../../utils/isEmpty";import{getAvailableExpressPayments}from"../../utils/expressPaymentHelper";export function PaymentMethod({children,className,activeClass,loader="Loading...",clickableContainer,autoSelectSinglePaymentMethod,expressPayments,hide,onClick,...p}){const[loading,setLoading]=useState(!0),[paymentSelected,setPaymentSelected]=useState(""),{paymentMethods,currentPaymentMethodId,setPaymentMethod,setLoading:setLoadingPlaceOrder,paymentSource,setPaymentSource,config}=useCustomContext({context:PaymentMethodContext,contextComponentName:"PaymentMethodsContainer",currentComponentName:"PaymentMethod",key:"paymentMethods"}),{order}=useContext(OrderContext),{getCustomerPaymentSources}=useContext(CustomerContext);useEffect(()=>{if(paymentMethods!=null&&!isEmpty(paymentMethods)&&expressPayments){const[paymentMethod]=getAvailableExpressPayments(paymentMethods);!paymentSource&&paymentMethod!=null&&(async()=>{setLoadingPlaceOrder({loading:!0}),setPaymentSelected(paymentMethod.id);const paymentMethodId=paymentMethod?.id,paymentResource=paymentMethod?.payment_source_type;await setPaymentMethod({paymentResource,paymentMethodId})
|
|
2
|
+
import{jsx as _jsx,Fragment as _Fragment}from"react/jsx-runtime";import{useState,useEffect,useContext}from"react";import PaymentMethodContext from"../../context/PaymentMethodContext";import PaymentMethodChildrenContext from"../../context/PaymentMethodChildrenContext";import getLoaderComponent from"../../utils/getLoaderComponent";import useCustomContext from"../../utils/hooks/useCustomContext";import OrderContext from"../../context/OrderContext";import CustomerContext from"../../context/CustomerContext";import{getExternalPaymentAttributes,getPaypalAttributes}from"../../utils/getPaymentAttributes";import{isEmpty}from"../../utils/isEmpty";import{getAvailableExpressPayments}from"../../utils/expressPaymentHelper";export function PaymentMethod({children,className,activeClass,loader="Loading...",clickableContainer,autoSelectSinglePaymentMethod,expressPayments,hide,onClick,...p}){const[loading,setLoading]=useState(!0),[paymentSelected,setPaymentSelected]=useState(""),{paymentMethods,currentPaymentMethodId,setPaymentMethod,setLoading:setLoadingPlaceOrder,paymentSource,setPaymentSource,config}=useCustomContext({context:PaymentMethodContext,contextComponentName:"PaymentMethodsContainer",currentComponentName:"PaymentMethod",key:"paymentMethods"}),{order}=useContext(OrderContext),{getCustomerPaymentSources}=useContext(CustomerContext);useEffect(()=>{if(paymentMethods!=null&&!isEmpty(paymentMethods)&&expressPayments){const[paymentMethod]=getAvailableExpressPayments(paymentMethods);!paymentSource&&paymentMethod!=null&&(async()=>{setLoadingPlaceOrder({loading:!0}),setPaymentSelected(paymentMethod.id);const paymentMethodId=paymentMethod?.id,paymentResource=paymentMethod?.payment_source_type;await setPaymentMethod({paymentResource,paymentMethodId});const ps=await setPaymentSource({paymentResource,order});ps&&paymentMethod&&onClick!=null&&(onClick({payment:paymentMethod,order,paymentSource:ps}),setTimeout(()=>{setLoading(!1)},200)),setLoadingPlaceOrder({loading:!1})})()}},[!isEmpty(paymentMethods),expressPayments]),useEffect(()=>{paymentMethods!=null&&autoSelectSinglePaymentMethod!=null&&!expressPayments&&(async()=>{if(paymentMethods.length===1){const[paymentMethod]=paymentMethods??[];if(paymentMethod&&!paymentSource){setLoadingPlaceOrder({loading:!0}),setPaymentSelected(paymentMethod.id);const paymentMethodId=paymentMethod?.id,paymentResource=paymentMethod?.payment_source_type;await setPaymentMethod({paymentResource,paymentMethodId});let attributes={};config!=null&&paymentResource==="paypal_payments"&&(attributes=getPaypalAttributes(paymentResource,config)),config!=null&&paymentResource==="external_payments"&&(attributes=getExternalPaymentAttributes(paymentResource,config));const ps=await setPaymentSource({paymentResource,order,attributes});ps&&paymentMethod&&onClick!=null&&(onClick({payment:paymentMethod,order,paymentSource:ps}),setTimeout(()=>{setLoading(!1)},200)),getCustomerPaymentSources&&getCustomerPaymentSources(),setLoadingPlaceOrder({loading:!1})}typeof autoSelectSinglePaymentMethod=="function"&&autoSelectSinglePaymentMethod()}else setTimeout(()=>{setLoading(!1)},200)})()},[paymentMethods,expressPayments]),useEffect(()=>(paymentMethods&&(paymentMethods.length===1&&autoSelectSinglePaymentMethod?paymentSource&&setTimeout(()=>{setLoading(!1)},200):setLoading(!1)),currentPaymentMethodId&&setPaymentSelected(currentPaymentMethodId),()=>{setLoading(!0)}),[paymentMethods,currentPaymentMethodId]);const components=paymentMethods?.filter(payment=>{if(Array.isArray(hide)){const source=payment?.payment_source_type;return!hide?.includes(source)}else if(typeof hide=="function")return hide(payment);return!0}).map((payment,k)=>{const isActive=currentPaymentMethodId===payment?.id,paymentMethodProps={payment,clickableContainer,paymentSelected,setPaymentSelected,expressPayments},paymentResource=payment?.payment_source_type,onClickable=clickableContainer?async e=>{e.stopPropagation(),setLoadingPlaceOrder({loading:!0}),setPaymentSelected(payment.id);const paymentMethodId=payment?.id,{order:order2}=await setPaymentMethod({paymentResource,paymentMethodId});onClick&&onClick({payment,order:order2}),setLoadingPlaceOrder({loading:!1})}:void 0;return _jsx("div",{"data-testid":paymentResource,className:`${className??""} ${isActive&&activeClass!=null?activeClass:""}`,onClick:onClickable,...p,children:_jsx(PaymentMethodChildrenContext.Provider,{value:paymentMethodProps,children})},k)});return loading?getLoaderComponent(loader):_jsx(_Fragment,{children:components})}export default PaymentMethod;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type LoaderType } from '../../typings/index';
|
|
2
|
+
import { type QueryPageSize } from '@commercelayer/sdk';
|
|
2
3
|
interface Props {
|
|
3
4
|
/**
|
|
4
5
|
* Any valid JSX.Element(s).
|
|
@@ -17,7 +18,7 @@ interface Props {
|
|
|
17
18
|
/**
|
|
18
19
|
* Prices per page to be fetched
|
|
19
20
|
*/
|
|
20
|
-
perPage?:
|
|
21
|
+
perPage?: QueryPageSize;
|
|
21
22
|
/**
|
|
22
23
|
* SKU code to fetch the prices for. If not provided, the `sku_code` will be retrieved from the `<Price>` component(s) nested as children.
|
|
23
24
|
*/
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { type Dispatch } from 'react';
|
|
2
2
|
import { type BaseError } from '../typings/errors';
|
|
3
|
-
import type { Address, AddressCreate, AddressUpdate, Customer, CustomerPaymentSource, Order, OrderSubscription } from '@commercelayer/sdk';
|
|
3
|
+
import type { Address, AddressCreate, AddressUpdate, Customer, CustomerPaymentSource, ListResponse, Order, OrderSubscription, QueryPageSize } from '@commercelayer/sdk';
|
|
4
4
|
import { type CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
5
5
|
import { type updateOrder } from './OrderReducer';
|
|
6
|
-
import { type ListResponse } from '@commercelayer/sdk/lib/cjs/resource';
|
|
7
6
|
import { type TriggerAttributeHelper } from '../utils/triggerAttributeHelper';
|
|
8
7
|
export type CustomerActionType = 'setErrors' | 'setCustomerEmail' | 'setAddresses' | 'setPayments' | 'setOrders' | 'setSubscriptions' | 'setCustomers';
|
|
9
8
|
export interface CustomerActionPayload {
|
|
@@ -112,7 +111,7 @@ interface GetCustomerOrdersProps {
|
|
|
112
111
|
/**
|
|
113
112
|
* The page size
|
|
114
113
|
*/
|
|
115
|
-
pageSize?:
|
|
114
|
+
pageSize?: QueryPageSize;
|
|
116
115
|
/**
|
|
117
116
|
* The page number
|
|
118
117
|
*/
|
|
@@ -160,7 +159,7 @@ export type SetResourceTriggerParams = {
|
|
|
160
159
|
/**
|
|
161
160
|
* The page size
|
|
162
161
|
*/
|
|
163
|
-
pageSize?:
|
|
162
|
+
pageSize?: QueryPageSize;
|
|
164
163
|
/**
|
|
165
164
|
* The page number
|
|
166
165
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type BaseAction, type LoaderType } from '../typings/index';
|
|
2
|
-
import { type Price } from '@commercelayer/sdk';
|
|
2
|
+
import { type QueryPageSize, type Price } from '@commercelayer/sdk';
|
|
3
3
|
import { type CommerceLayerConfig } from '../context/CommerceLayerContext';
|
|
4
4
|
import { type Dispatch } from 'react';
|
|
5
5
|
import { type BaseError } from '../typings/errors';
|
|
@@ -25,7 +25,7 @@ export declare function setSkuCodes({ skuCodes, dispatch }: {
|
|
|
25
25
|
export declare function getSkusPrice(skuCodes: SkuCodesPrice, { config, dispatch, perPage, filters }: {
|
|
26
26
|
config: CommerceLayerConfig;
|
|
27
27
|
dispatch: Dispatch<PriceAction>;
|
|
28
|
-
perPage:
|
|
28
|
+
perPage: QueryPageSize;
|
|
29
29
|
filters: Record<string, any>;
|
|
30
30
|
}): void;
|
|
31
31
|
export type UnsetPriceState = (dispatch: Dispatch<PriceAction>) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercelayer/react-components",
|
|
3
|
-
"version": "4.13.1-beta.
|
|
3
|
+
"version": "4.13.1-beta.2",
|
|
4
4
|
"description": "The Official Commerce Layer React Components",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -167,7 +167,7 @@
|
|
|
167
167
|
"dependencies": {
|
|
168
168
|
"@adyen/adyen-web": "^5.58.0",
|
|
169
169
|
"@commercelayer/organization-config": "^1.4.5",
|
|
170
|
-
"@commercelayer/sdk": "
|
|
170
|
+
"@commercelayer/sdk": "6.0.0-rc.2",
|
|
171
171
|
"@stripe/react-stripe-js": "^2.4.0",
|
|
172
172
|
"@stripe/stripe-js": "^3.0.5",
|
|
173
173
|
"@tanstack/react-table": "^8.11.8",
|