@soma-vertical-web/multi-lib 0.0.13 → 0.0.15
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/contexts/contexts/pdp/PDPDataContext.d.ts +2 -8
- package/contexts/index.d.ts +1 -5
- package/contexts/store/cart.d.ts +1 -0
- package/data/helpers/cart/index.d.ts +188 -0
- package/data/helpers/product/generalInfo.d.ts +2 -2
- package/data/helpers/product/skuInfos.d.ts +2 -2
- package/data/index.d.ts +2 -0
- package/index.js +4 -4
- package/index.mjs +1714 -1649
- package/layout/team-component/AddToCart/AddToCart.d.ts +1 -1
- package/layout/team-component/AddToCart/Composite/Root.d.ts +1 -1
- package/package.json +1 -1
- package/types/constants.d.ts +12 -0
- package/types/contexts/contexts/pdp.d.ts +7 -0
- package/types/data/events/index.d.ts +4 -7
- package/types/data/helpers/index.d.ts +6 -178
- package/types/layout/team-components/AddToCart/index.d.ts +11 -3
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PDPDataContextProps } from '../../../types/contexts/contexts/pdp';
|
|
3
|
-
import { PropsWithChildren } from 'react';
|
|
1
|
+
import { PDPDataContextProps, PDPDataProviderProps } from '../../../types/contexts/contexts/pdp';
|
|
4
2
|
|
|
5
|
-
export declare const PDPDataProvider: ({ children, productData, isKit, PDP_INFO, }:
|
|
6
|
-
productData: ProductType_PDP;
|
|
7
|
-
isKit: boolean;
|
|
8
|
-
PDP_INFO: any;
|
|
9
|
-
}>) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const PDPDataProvider: ({ children, productData, isKit, PDP_INFO, NAME_SPLIT_SYMBOL }: PDPDataProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
4
|
export declare const usePDPDataContext: () => PDPDataContextProps;
|
package/contexts/index.d.ts
CHANGED
|
@@ -62,11 +62,7 @@ export declare const contexts: {
|
|
|
62
62
|
};
|
|
63
63
|
pdpdata: {
|
|
64
64
|
hook: () => import('../types/contexts/contexts/pdp').PDPDataContextProps;
|
|
65
|
-
provider: ({ children, productData, isKit, PDP_INFO, }: import('
|
|
66
|
-
productData: import('../types/global/product').ProductType_PDP;
|
|
67
|
-
isKit: boolean;
|
|
68
|
-
PDP_INFO: any;
|
|
69
|
-
}>) => import("react/jsx-runtime").JSX.Element;
|
|
65
|
+
provider: ({ children, productData, isKit, PDP_INFO, NAME_SPLIT_SYMBOL }: import('../types/contexts/contexts/pdp').PDPDataProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
70
66
|
};
|
|
71
67
|
ui: {
|
|
72
68
|
hook: () => import('../types/contexts/contexts/cart').UIContextProps;
|
package/contexts/store/cart.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { CartStore } from '../../types/contexts/store/cart';
|
|
|
3
3
|
export declare const KEY_INDEXED_STORE = "soma::cart";
|
|
4
4
|
export declare const KEY_INDEXED_OPTIONS = "soma::options";
|
|
5
5
|
export declare const useCartStore: import('zustand').UseBoundStore<import('zustand').StoreApi<CartStore>>;
|
|
6
|
+
export declare const useGetCartStoreState: () => CartStore;
|
|
6
7
|
export declare const useGetNotificationsStore: () => import('../../types/contexts/store/cart').Notification[];
|
|
7
8
|
export declare const useGetNotificationActions: () => {
|
|
8
9
|
addNotification(message: string, callback?: () => void): void;
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { FetchPriority } from '../../../types/contexts/hooks';
|
|
2
|
+
import { OrderFormItem, OrderForm } from '../../../types/data/api/checkout/order-form';
|
|
3
|
+
import { AddToCart, CartItem, CartItemOptionalProps, CartItemStore, NotificationsStore, OptionalOrderForm } from '../../../types/contexts/store/cart';
|
|
4
|
+
|
|
5
|
+
export declare const VALUE_REFERENCES: {
|
|
6
|
+
readonly attachment: "ATTACHMENT";
|
|
7
|
+
readonly specification: "SPECIFICATION";
|
|
8
|
+
readonly attribute: "ATTRIBUTE";
|
|
9
|
+
};
|
|
10
|
+
export declare const promiseDefault: Promise<boolean>;
|
|
11
|
+
export declare const initialState: {
|
|
12
|
+
id: string;
|
|
13
|
+
isOpen: boolean;
|
|
14
|
+
items: never[];
|
|
15
|
+
loading: boolean;
|
|
16
|
+
marketingData: null;
|
|
17
|
+
messages: never[];
|
|
18
|
+
openTextField: {};
|
|
19
|
+
paymentData: null;
|
|
20
|
+
shippingData: null;
|
|
21
|
+
totalizers: never[];
|
|
22
|
+
itemMetadata: never[];
|
|
23
|
+
recentlyAddedProducts: never[];
|
|
24
|
+
addCoupon: () => Promise<boolean>;
|
|
25
|
+
addItem: () => Promise<boolean>;
|
|
26
|
+
addSellerCode: () => Promise<boolean>;
|
|
27
|
+
emptyCart: () => void;
|
|
28
|
+
removeItem: () => Promise<boolean>;
|
|
29
|
+
setIsOpen: () => void;
|
|
30
|
+
shipping: () => Promise<boolean>;
|
|
31
|
+
shippingUpdate: () => Promise<boolean>;
|
|
32
|
+
toggleServiceToProduct: () => Promise<boolean>;
|
|
33
|
+
updateItemQuantity: () => Promise<boolean>;
|
|
34
|
+
insertProfileEmail: () => Promise<boolean>;
|
|
35
|
+
setRecentlyAddedProducts: () => void;
|
|
36
|
+
};
|
|
37
|
+
export declare const isGift: (price: number) => price is 0;
|
|
38
|
+
export declare const getCategories: (productCategoryIds: string, productCategories: {
|
|
39
|
+
[key: string]: string;
|
|
40
|
+
}) => string[];
|
|
41
|
+
export declare const createItemOrder: (item: OrderFormItem) => CartItemStore;
|
|
42
|
+
export declare const addItemOrder: (items: CartItemStore[], item: AddToCart | AddToCart[]) => AddToCart[];
|
|
43
|
+
export declare const removeQuantity: (items: CartItemStore[], id: string) => {
|
|
44
|
+
updateItems: {
|
|
45
|
+
id: string;
|
|
46
|
+
index: number;
|
|
47
|
+
quantity: number;
|
|
48
|
+
seller: string;
|
|
49
|
+
}[];
|
|
50
|
+
filterItems: {
|
|
51
|
+
id: string;
|
|
52
|
+
index: number;
|
|
53
|
+
quantity: number;
|
|
54
|
+
seller: string;
|
|
55
|
+
}[];
|
|
56
|
+
};
|
|
57
|
+
export declare const updateQuantity: (items: CartItemStore[], id: string, quantity: number) => {
|
|
58
|
+
id: string;
|
|
59
|
+
index: number;
|
|
60
|
+
quantity: number;
|
|
61
|
+
seller: string;
|
|
62
|
+
sku: string;
|
|
63
|
+
}[];
|
|
64
|
+
export declare const findItemIndex: (items: CartItemStore[], id: string) => number;
|
|
65
|
+
export declare const findTotalizerValue: (totalizers: Array<{
|
|
66
|
+
id: string;
|
|
67
|
+
name: string;
|
|
68
|
+
value: number;
|
|
69
|
+
}>, id: string) => number;
|
|
70
|
+
export declare const getTotalizer: (items: CartItemStore[]) => {
|
|
71
|
+
totalItems: number;
|
|
72
|
+
total: number;
|
|
73
|
+
subTotal: number;
|
|
74
|
+
};
|
|
75
|
+
export declare const getTotalItems: (items?: CartItemStore[]) => number;
|
|
76
|
+
export declare const orderFormValues: (orderForm: OrderForm) => {
|
|
77
|
+
id: string;
|
|
78
|
+
itemMetadata: {
|
|
79
|
+
items: import('../../../types/data/api/checkout/order-form').MetadataItem[];
|
|
80
|
+
} | null;
|
|
81
|
+
items: CartItemStore[];
|
|
82
|
+
marketingData: import('../../../types/data/api/checkout/order-form').OrderFormMarketingData | null;
|
|
83
|
+
messages: any[];
|
|
84
|
+
openTextField: Record<string, string | boolean>;
|
|
85
|
+
paymentData: import('../../../types/data/api/checkout/order-form').PaymentData;
|
|
86
|
+
shippingData: import('../../../types/data/api/checkout/order-form/shipping').ShippingData | null;
|
|
87
|
+
totalizers: {
|
|
88
|
+
id: string;
|
|
89
|
+
name: string;
|
|
90
|
+
value: number;
|
|
91
|
+
}[];
|
|
92
|
+
};
|
|
93
|
+
export declare const updateItemSellerExternal: (items: CartItemStore[], productId: string) => boolean;
|
|
94
|
+
export declare const getSize: (item: CartItem, NAME_SPLIT_SYMBOL: string) => string;
|
|
95
|
+
export declare const getCode: (data: string, value: string, statusOk?: boolean) => {
|
|
96
|
+
code: number;
|
|
97
|
+
value: string;
|
|
98
|
+
statusOk: boolean;
|
|
99
|
+
};
|
|
100
|
+
export declare const wishlistArray: (productNode: CartItem, wishlist: CartItem[]) => {
|
|
101
|
+
slug: string;
|
|
102
|
+
sku: string;
|
|
103
|
+
name: string;
|
|
104
|
+
gtin: string;
|
|
105
|
+
id: string;
|
|
106
|
+
brand: {
|
|
107
|
+
name: string;
|
|
108
|
+
brandName: string;
|
|
109
|
+
};
|
|
110
|
+
isVariantOf: {
|
|
111
|
+
hasVariant: Array<{
|
|
112
|
+
sku: string;
|
|
113
|
+
name: string;
|
|
114
|
+
gtin: string;
|
|
115
|
+
id: string;
|
|
116
|
+
brand: {
|
|
117
|
+
name: string;
|
|
118
|
+
brandName: string;
|
|
119
|
+
};
|
|
120
|
+
isVariantOf: {
|
|
121
|
+
productGroupID: string;
|
|
122
|
+
name: string;
|
|
123
|
+
};
|
|
124
|
+
image: Array<{
|
|
125
|
+
url: string;
|
|
126
|
+
alternateName: string;
|
|
127
|
+
}>;
|
|
128
|
+
offers: {
|
|
129
|
+
lowPrice: number;
|
|
130
|
+
offers: Array<{
|
|
131
|
+
availability: string;
|
|
132
|
+
price: number;
|
|
133
|
+
listPrice: number;
|
|
134
|
+
quantity: number;
|
|
135
|
+
seller: {
|
|
136
|
+
identifier: string;
|
|
137
|
+
};
|
|
138
|
+
}>;
|
|
139
|
+
};
|
|
140
|
+
}>;
|
|
141
|
+
productGroupID: string;
|
|
142
|
+
name: string;
|
|
143
|
+
additionalProperty: Array<{
|
|
144
|
+
propertyID: string;
|
|
145
|
+
name: string;
|
|
146
|
+
value: any;
|
|
147
|
+
valueReference: string;
|
|
148
|
+
}>;
|
|
149
|
+
};
|
|
150
|
+
categories: Array<string>;
|
|
151
|
+
referenceId: Array<{
|
|
152
|
+
Key: string;
|
|
153
|
+
Value: string;
|
|
154
|
+
}>;
|
|
155
|
+
image: Array<{
|
|
156
|
+
url: string;
|
|
157
|
+
alternateName: string;
|
|
158
|
+
}>;
|
|
159
|
+
offers: {
|
|
160
|
+
lowPrice: number;
|
|
161
|
+
offers: Array<{
|
|
162
|
+
availability: string;
|
|
163
|
+
price: number;
|
|
164
|
+
listPrice: number;
|
|
165
|
+
quantity: number;
|
|
166
|
+
seller: {
|
|
167
|
+
identifier: string;
|
|
168
|
+
};
|
|
169
|
+
priceValidUntil: string;
|
|
170
|
+
priceCurrency: string;
|
|
171
|
+
itemCondition: string;
|
|
172
|
+
}>;
|
|
173
|
+
};
|
|
174
|
+
}[];
|
|
175
|
+
export declare const getRemoveId: (productId: string, items?: CartItemStore[] | boolean) => Promise<string> | Promise<boolean>;
|
|
176
|
+
export declare const getValue: <K extends keyof OptionalOrderForm>(order: OptionalOrderForm, key?: K) => Promise<boolean> | Promise<Awaited<OptionalOrderForm[K]>>;
|
|
177
|
+
export declare const updateOrderFormPromise: (callback: () => Promise<OptionalOrderForm | boolean>) => Promise<false | OptionalOrderForm>;
|
|
178
|
+
export declare const getQuantity: (quantity: number, index: number) => number;
|
|
179
|
+
export declare const findOptions: (options?: CartItemOptionalProps[], items?: OptionalOrderForm["items"]) => CartItemOptionalProps[];
|
|
180
|
+
export declare const mergeOptionsPromise: (res: Promise<Array<CartItemOptionalProps> | undefined>, options?: CartItemOptionalProps[]) => Promise<CartItemOptionalProps[]>;
|
|
181
|
+
export declare const fetchCartAPI: (url: string, params: {
|
|
182
|
+
priority?: FetchPriority;
|
|
183
|
+
body: Record<string, unknown>;
|
|
184
|
+
}, skipSanitize?: boolean) => Promise<any>;
|
|
185
|
+
export declare const addNotification: (state: NotificationsStore, message: string, callback?: () => void) => {
|
|
186
|
+
notifications: import('../../../types/contexts/store/cart').Notification[];
|
|
187
|
+
};
|
|
188
|
+
export declare const marketingTagsBuilder: (marketingTags: string | string[]) => string[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export declare const splitNameAndSizeFromFullName: (fullName: string) => {
|
|
1
|
+
export declare const splitNameAndSizeFromFullName: (fullName: string, NAME_SPLIT_SYMBOL: string) => {
|
|
2
2
|
name: string;
|
|
3
3
|
size: string;
|
|
4
4
|
};
|
|
5
|
-
export declare const getColorAndSizeFromSkuName: (skuName
|
|
5
|
+
export declare const getColorAndSizeFromSkuName: (skuName: string, NAME_SPLIT_SYMBOL: string) => {
|
|
6
6
|
color?: undefined;
|
|
7
7
|
size?: undefined;
|
|
8
8
|
} | {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ItemType_PDP } from '../../../types/global/product';
|
|
2
1
|
import { Sizes } from '../../../types/contexts/contexts/pdp';
|
|
2
|
+
import { GetSkuInfosProps } from '../../../types/data/helpers';
|
|
3
3
|
|
|
4
|
-
export declare const getSkuInfos: (items:
|
|
4
|
+
export declare const getSkuInfos: ({ items, NAME_SPLIT_SYMBOL }: GetSkuInfosProps) => {
|
|
5
5
|
sizes: Sizes;
|
|
6
6
|
allSizesAvailable: boolean;
|
|
7
7
|
price: number;
|
package/data/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { freightSimulation } from './api/checkout/simulation';
|
|
2
2
|
|
|
3
|
+
import * as cart from "./helpers/cart";
|
|
3
4
|
import * as events from "./helpers/events";
|
|
4
5
|
import * as product from "./helpers/product";
|
|
5
6
|
import * as utils from "./helpers/utils";
|
|
6
7
|
export declare const data: {
|
|
7
8
|
helpers: {
|
|
9
|
+
cart: typeof cart;
|
|
8
10
|
events: typeof events;
|
|
9
11
|
product: typeof product;
|
|
10
12
|
utils: typeof utils;
|