@soma-vertical-web/multi-lib 0.0.32 → 0.0.34
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/__vite-browser-external-CpdIDx9o.mjs +79 -0
- package/__vite-browser-external-DDWPeg5L.js +1 -0
- package/constants.d.ts +32 -0
- package/contexts/contexts/search/Facets.d.ts +5 -0
- package/contexts/contexts/search/Products.d.ts +5 -0
- package/contexts/contexts/search/Root.d.ts +5 -0
- package/contexts/contexts/search/Search.d.ts +5 -0
- package/contexts/contexts/search/SuggestedTerms.d.ts +5 -0
- package/contexts/contexts/search/TopSearches.d.ts +6 -0
- package/contexts/index.d.ts +24 -0
- package/data/api/fetchVtex.d.ts +2 -1
- package/data/api/search/autoCompleteSuggestions/index.d.ts +11 -0
- package/data/api/search/crosseling/index.d.ts +91 -0
- package/data/api/search/facets/index.d.ts +4 -0
- package/data/api/search/index.d.ts +6 -0
- package/data/api/search/product/index.d.ts +3 -0
- package/data/api/search/searchFetch.d.ts +3 -0
- package/data/api/search/suggestedTerms/index.d.ts +12 -0
- package/data/api/search/topSearch/index.d.ts +3 -0
- package/data/helpers/search/facets.d.ts +48 -0
- package/data/helpers/search/index.d.ts +12 -0
- package/data/helpers/search/product/index.d.ts +279 -0
- package/data/helpers/search/product/utils/canonical.d.ts +1 -0
- package/data/helpers/search/product/utils/enhanceSku.d.ts +9 -0
- package/data/helpers/search/product/utils/images.d.ts +7 -0
- package/data/helpers/search/product/utils/index.d.ts +8 -0
- package/data/helpers/search/product/utils/productStock.d.ts +7 -0
- package/data/helpers/search/product/utils/propertyValue.d.ts +20 -0
- package/data/helpers/search/product/utils/sanitizeHtml.d.ts +18 -0
- package/data/helpers/search/product/utils/sku.d.ts +5 -0
- package/data/helpers/search/product/utils/slugify.d.ts +1 -0
- package/data/helpers/search/root.d.ts +11 -0
- package/data/helpers/search/search.d.ts +7 -0
- package/index.js +19 -19
- package/index.mjs +4336 -3979
- package/index2.js +1 -1
- package/index2.mjs +891 -400
- package/package.json +1 -1
- package/server.d.ts +13 -0
- package/types/constants.d.ts +9 -15
- package/types/contexts/contexts/plp.d.ts +13 -0
- package/types/contexts/contexts/search.d.ts +10 -4
- package/types/data/api/index.d.ts +5 -2
- package/types/data/api/search/facets/index.d.ts +13 -13
- package/types/data/api/search/index.d.ts +25 -12
- package/types/data/api/search/product/index.d.ts +1 -8
- package/types/data/events/index.d.ts +0 -4
- package/types/data/helpers/index.d.ts +9 -1
- package/types/global/product/index.d.ts +5 -4
- package/types/layout/team-components/AddToCart/index.d.ts +2 -2
- package/types/layout/team-components/Sort/index.d.ts +2 -3
- package/types/data/api/search/autoCompleteSuggestions/index.d.ts +0 -7
- package/types/data/api/search/suggestedTerms/index.d.ts +0 -7
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import { SearchCreatePages, SearchCreateProduct } from '../../../../types/data/helpers';
|
|
2
|
+
import { ProductType_APISearch, EnhancedSku_APISearch, ProductNode_PDC } from '../../../../types/global/product';
|
|
3
|
+
import { Page } from '../../../../types/contexts/contexts/plp';
|
|
4
|
+
|
|
5
|
+
export declare const getInstallments: (installments: EnhancedSku_APISearch["sellers"][0]["commertialOffer"]["Installments"]) => {
|
|
6
|
+
count: number;
|
|
7
|
+
value: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const getOffers: (sellers: EnhancedSku_APISearch["sellers"], product: ProductType_APISearch) => {
|
|
10
|
+
lowPrice: number;
|
|
11
|
+
highPrice: number;
|
|
12
|
+
offers: {
|
|
13
|
+
availability: boolean;
|
|
14
|
+
listPrice: number;
|
|
15
|
+
price: number;
|
|
16
|
+
priceValidUntil: string;
|
|
17
|
+
priceCurrency: string;
|
|
18
|
+
installments: import('../../../../types/global/product').InstallmentType[];
|
|
19
|
+
lowPrice: number;
|
|
20
|
+
quantity: number;
|
|
21
|
+
seller: {
|
|
22
|
+
identifier: string;
|
|
23
|
+
};
|
|
24
|
+
}[];
|
|
25
|
+
};
|
|
26
|
+
export declare const getHasVariant: (item: ProductType_APISearch["items"][0]) => {
|
|
27
|
+
additionalProperty: ({
|
|
28
|
+
name: string;
|
|
29
|
+
value: Record<string, string>;
|
|
30
|
+
valueReference: "ATTACHMENT";
|
|
31
|
+
} | {
|
|
32
|
+
propertyID: string;
|
|
33
|
+
name: string;
|
|
34
|
+
value: string;
|
|
35
|
+
valueReference: {
|
|
36
|
+
valueReference: "ATTRIBUTE";
|
|
37
|
+
visible: boolean;
|
|
38
|
+
};
|
|
39
|
+
} | {
|
|
40
|
+
name: string;
|
|
41
|
+
value: string;
|
|
42
|
+
valueReference: "SPECIFICATION";
|
|
43
|
+
})[];
|
|
44
|
+
name: string;
|
|
45
|
+
offers: {
|
|
46
|
+
offers: {
|
|
47
|
+
availability: string;
|
|
48
|
+
listPrice: number;
|
|
49
|
+
price: number;
|
|
50
|
+
quantity: number;
|
|
51
|
+
seller: {
|
|
52
|
+
identifier: string;
|
|
53
|
+
};
|
|
54
|
+
}[];
|
|
55
|
+
};
|
|
56
|
+
sku: string;
|
|
57
|
+
};
|
|
58
|
+
export declare const formattedProduct: (item: EnhancedSku_APISearch) => {
|
|
59
|
+
sku: string;
|
|
60
|
+
gtin: string;
|
|
61
|
+
name: string;
|
|
62
|
+
description: string;
|
|
63
|
+
releaseDate: string;
|
|
64
|
+
slug: string;
|
|
65
|
+
video: string;
|
|
66
|
+
categories: string[];
|
|
67
|
+
categoriesIds: string[];
|
|
68
|
+
id: string;
|
|
69
|
+
brand: {
|
|
70
|
+
name: string;
|
|
71
|
+
brandName: string;
|
|
72
|
+
};
|
|
73
|
+
seo: {
|
|
74
|
+
description: string;
|
|
75
|
+
title: string;
|
|
76
|
+
canonical: string;
|
|
77
|
+
};
|
|
78
|
+
cluster: {
|
|
79
|
+
generals: Record<string, string>;
|
|
80
|
+
highlights: Record<string, any>;
|
|
81
|
+
};
|
|
82
|
+
properties: {
|
|
83
|
+
name: string;
|
|
84
|
+
values: string[];
|
|
85
|
+
}[];
|
|
86
|
+
availability: {
|
|
87
|
+
status: boolean;
|
|
88
|
+
};
|
|
89
|
+
breadcrumbList: {
|
|
90
|
+
itemListElement: {
|
|
91
|
+
name: string;
|
|
92
|
+
item: string;
|
|
93
|
+
position: number;
|
|
94
|
+
}[];
|
|
95
|
+
numberOfItems: number;
|
|
96
|
+
};
|
|
97
|
+
image: {
|
|
98
|
+
alternateName: string;
|
|
99
|
+
url: string;
|
|
100
|
+
keywords: string;
|
|
101
|
+
}[];
|
|
102
|
+
offers: {
|
|
103
|
+
lowPrice: number;
|
|
104
|
+
highPrice: number;
|
|
105
|
+
offers: {
|
|
106
|
+
availability: boolean;
|
|
107
|
+
listPrice: number;
|
|
108
|
+
price: number;
|
|
109
|
+
priceValidUntil: string;
|
|
110
|
+
priceCurrency: string;
|
|
111
|
+
installments: import('../../../../types/global/product').InstallmentType[];
|
|
112
|
+
lowPrice: number;
|
|
113
|
+
quantity: number;
|
|
114
|
+
seller: {
|
|
115
|
+
identifier: string;
|
|
116
|
+
};
|
|
117
|
+
}[];
|
|
118
|
+
};
|
|
119
|
+
additionalProperty: ({
|
|
120
|
+
name: string;
|
|
121
|
+
value: Record<string, string>;
|
|
122
|
+
valueReference: "ATTACHMENT";
|
|
123
|
+
} | {
|
|
124
|
+
propertyID: string;
|
|
125
|
+
name: string;
|
|
126
|
+
value: string;
|
|
127
|
+
valueReference: {
|
|
128
|
+
valueReference: "ATTRIBUTE";
|
|
129
|
+
visible: boolean;
|
|
130
|
+
};
|
|
131
|
+
} | {
|
|
132
|
+
name: string;
|
|
133
|
+
value: string;
|
|
134
|
+
valueReference: "SPECIFICATION";
|
|
135
|
+
})[];
|
|
136
|
+
isVariantOf: {
|
|
137
|
+
productGroupID: string;
|
|
138
|
+
hasVariant: {
|
|
139
|
+
additionalProperty: ({
|
|
140
|
+
name: string;
|
|
141
|
+
value: Record<string, string>;
|
|
142
|
+
valueReference: "ATTACHMENT";
|
|
143
|
+
} | {
|
|
144
|
+
propertyID: string;
|
|
145
|
+
name: string;
|
|
146
|
+
value: string;
|
|
147
|
+
valueReference: {
|
|
148
|
+
valueReference: "ATTRIBUTE";
|
|
149
|
+
visible: boolean;
|
|
150
|
+
};
|
|
151
|
+
} | {
|
|
152
|
+
name: string;
|
|
153
|
+
value: string;
|
|
154
|
+
valueReference: "SPECIFICATION";
|
|
155
|
+
})[];
|
|
156
|
+
name: string;
|
|
157
|
+
offers: {
|
|
158
|
+
offers: {
|
|
159
|
+
availability: string;
|
|
160
|
+
listPrice: number;
|
|
161
|
+
price: number;
|
|
162
|
+
quantity: number;
|
|
163
|
+
seller: {
|
|
164
|
+
identifier: string;
|
|
165
|
+
};
|
|
166
|
+
}[];
|
|
167
|
+
};
|
|
168
|
+
sku: string;
|
|
169
|
+
}[];
|
|
170
|
+
};
|
|
171
|
+
installments: {
|
|
172
|
+
count: number;
|
|
173
|
+
value: number;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
export declare const formattedRecommendationProduct: (item: any) => {
|
|
177
|
+
sku: any;
|
|
178
|
+
gtin: any;
|
|
179
|
+
name: any;
|
|
180
|
+
description: any;
|
|
181
|
+
releaseDate: any;
|
|
182
|
+
slug: any;
|
|
183
|
+
video: any;
|
|
184
|
+
categories: any;
|
|
185
|
+
categoriesIds: any;
|
|
186
|
+
collection: any;
|
|
187
|
+
collectionId: any;
|
|
188
|
+
id: any;
|
|
189
|
+
brand: {
|
|
190
|
+
name: any;
|
|
191
|
+
brandName: any;
|
|
192
|
+
};
|
|
193
|
+
seo: {
|
|
194
|
+
description: any;
|
|
195
|
+
title: any;
|
|
196
|
+
canonical: string;
|
|
197
|
+
};
|
|
198
|
+
cluster: {
|
|
199
|
+
generals: any;
|
|
200
|
+
highlights: never[];
|
|
201
|
+
};
|
|
202
|
+
availability: {
|
|
203
|
+
status: boolean;
|
|
204
|
+
};
|
|
205
|
+
breadcrumbList: {
|
|
206
|
+
itemListElement: any[];
|
|
207
|
+
numberOfItems: any;
|
|
208
|
+
};
|
|
209
|
+
image: {
|
|
210
|
+
alternateName: string;
|
|
211
|
+
url: string;
|
|
212
|
+
keywords: string;
|
|
213
|
+
}[];
|
|
214
|
+
offers: {
|
|
215
|
+
lowPrice: number;
|
|
216
|
+
highPrice: number;
|
|
217
|
+
offers: {
|
|
218
|
+
availability: boolean;
|
|
219
|
+
listPrice: number;
|
|
220
|
+
price: number;
|
|
221
|
+
priceValidUntil: string;
|
|
222
|
+
priceCurrency: string;
|
|
223
|
+
installments: import('../../../../types/global/product').InstallmentType[];
|
|
224
|
+
lowPrice: number;
|
|
225
|
+
quantity: number;
|
|
226
|
+
seller: {
|
|
227
|
+
identifier: string;
|
|
228
|
+
};
|
|
229
|
+
}[];
|
|
230
|
+
};
|
|
231
|
+
additionalProperty: ({
|
|
232
|
+
name: string;
|
|
233
|
+
value: Record<string, string>;
|
|
234
|
+
valueReference: "ATTACHMENT";
|
|
235
|
+
} | {
|
|
236
|
+
propertyID: string;
|
|
237
|
+
name: string;
|
|
238
|
+
value: string;
|
|
239
|
+
valueReference: {
|
|
240
|
+
valueReference: "ATTRIBUTE";
|
|
241
|
+
visible: boolean;
|
|
242
|
+
};
|
|
243
|
+
} | {
|
|
244
|
+
name: string;
|
|
245
|
+
value: string;
|
|
246
|
+
valueReference: "SPECIFICATION";
|
|
247
|
+
})[];
|
|
248
|
+
isVariantOf: {
|
|
249
|
+
productGroupID: any;
|
|
250
|
+
hasVariant: any;
|
|
251
|
+
};
|
|
252
|
+
installments: {
|
|
253
|
+
count: number;
|
|
254
|
+
value: number;
|
|
255
|
+
};
|
|
256
|
+
};
|
|
257
|
+
export declare const createProduct: ({ MAIN_IMAGE, TEXTURE_IMAGE }: SearchCreateProduct) => ProductNode_PDC;
|
|
258
|
+
export declare const createPages: ({ page, count, ...props }: SearchCreatePages) => {
|
|
259
|
+
loading: boolean;
|
|
260
|
+
page: number;
|
|
261
|
+
pagination: {
|
|
262
|
+
nextPage: boolean;
|
|
263
|
+
previousPage: boolean;
|
|
264
|
+
startCursor: string;
|
|
265
|
+
endCursor: string;
|
|
266
|
+
count: number;
|
|
267
|
+
total: number;
|
|
268
|
+
};
|
|
269
|
+
products: ProductNode_PDC[];
|
|
270
|
+
}[];
|
|
271
|
+
export declare const createPage: (pages: Page[], newPage: number) => Page[];
|
|
272
|
+
export declare const createPagination: () => {
|
|
273
|
+
nextPage: boolean;
|
|
274
|
+
previousPage: boolean;
|
|
275
|
+
startCursor: string;
|
|
276
|
+
endCursor: string;
|
|
277
|
+
count: number;
|
|
278
|
+
total: number;
|
|
279
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const canonicalPDPLink: (linkText: string) => string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CommertialOfferType, EnhancedCommercialOffer_APISearch, EnhancedSku_APISearch, ItemType_APISearch, ProductType_APISearch } from '../../../../../types/global/product';
|
|
2
|
+
|
|
3
|
+
export declare const sanitizeProduct: (product: ProductType_APISearch) => ProductType_APISearch;
|
|
4
|
+
export declare const enhanceCommercialOffer: <S, P>({ offer, seller, product, }: {
|
|
5
|
+
offer: CommertialOfferType;
|
|
6
|
+
seller: S;
|
|
7
|
+
product: P;
|
|
8
|
+
}) => EnhancedCommercialOffer_APISearch<S, P>;
|
|
9
|
+
export declare const enhanceSku: (item: ItemType_APISearch, product: ProductType_APISearch) => EnhancedSku_APISearch;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CommertialOfferType } from '../../../../../types/global/product';
|
|
2
|
+
|
|
3
|
+
export declare const availability: (available: boolean) => "https://schema.org/OutOfStock" | "https://schema.org/InStock";
|
|
4
|
+
export declare const inStock: (offer: Pick<CommertialOfferType, "AvailableQuantity">) => boolean;
|
|
5
|
+
export declare const price: (offer: Pick<CommertialOfferType, "spotPrice">) => number;
|
|
6
|
+
export declare const sellingPrice: (offer: CommertialOfferType) => number;
|
|
7
|
+
export declare const bestOfferFirst: (a: Pick<CommertialOfferType, "AvailableQuantity" | "spotPrice">, b: Pick<CommertialOfferType, "AvailableQuantity" | "spotPrice">) => number;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Attachment } from '../../../../../types/data/api/search/product';
|
|
2
|
+
import { ItemType_APISearch } from '../../../../../types/global/product';
|
|
3
|
+
|
|
4
|
+
export declare const additionalProperty: (variations: ItemType_APISearch["variations"], attributes: ItemType_APISearch["attributes"], attachments?: Attachment[]) => ({
|
|
5
|
+
name: string;
|
|
6
|
+
value: Record<string, string>;
|
|
7
|
+
valueReference: "ATTACHMENT";
|
|
8
|
+
} | {
|
|
9
|
+
propertyID: string;
|
|
10
|
+
name: string;
|
|
11
|
+
value: string;
|
|
12
|
+
valueReference: {
|
|
13
|
+
valueReference: "ATTRIBUTE";
|
|
14
|
+
visible: boolean;
|
|
15
|
+
};
|
|
16
|
+
} | {
|
|
17
|
+
name: string;
|
|
18
|
+
value: string;
|
|
19
|
+
valueReference: "SPECIFICATION";
|
|
20
|
+
})[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { default as sanitizeHtmlLib } from 'sanitize-html';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* For now, we're using sanitize-html's default set
|
|
5
|
+
* of allowed tags and attributes, which don't even include img elements
|
|
6
|
+
*
|
|
7
|
+
* It is known many client depends on pontentially vulnerable tags, such as script tags
|
|
8
|
+
* We chose to be restrictive at first, and document those restrictions later.
|
|
9
|
+
*
|
|
10
|
+
* When expanding the set of allowed tags and attributes, please consider performance, privacy and security.
|
|
11
|
+
*
|
|
12
|
+
* This possibily breaks compatibility with Portal and Store Framework,
|
|
13
|
+
* which both allows an enormous amount of tags and attributes
|
|
14
|
+
*
|
|
15
|
+
* This was a thoughtful decision that can be reviewed in the future given
|
|
16
|
+
* research was made to back up those changes.
|
|
17
|
+
*/
|
|
18
|
+
export declare const sanitizeHtml: (dirty: Parameters<typeof sanitizeHtmlLib>[0], options?: Parameters<typeof sanitizeHtmlLib>[1]) => string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ItemType_APISearch } from '../../../../../types/global/product';
|
|
2
|
+
|
|
3
|
+
export declare const min: <T>(array: T[], cmp: (a: T, b: T) => number) => T;
|
|
4
|
+
export declare const isValidSkuId: (skuId: string) => boolean;
|
|
5
|
+
export declare const pickBestSku: (skus: ItemType_APISearch[]) => ItemType_APISearch;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const slugify: (str: string) => string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Facet, FacetValueBoolean, SelectedFacet } from '../../../types/data/api/search/facets';
|
|
2
|
+
|
|
3
|
+
export declare const POLICY_KEY = "trade-policy";
|
|
4
|
+
export declare const REGION_KEY = "region-id";
|
|
5
|
+
export declare const FUZZY_KEY = "fuzzy";
|
|
6
|
+
export declare const OPERATOR_KEY = "operator";
|
|
7
|
+
export declare const EXTRA_FACETS_KEYS: Set<string>;
|
|
8
|
+
export declare const isCategoryBrand: (selectedFacets: SelectedFacet[]) => {
|
|
9
|
+
isDepartment: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare const filterNonCategorySelected: (facets: Facet[], base?: string | null) => Facet<FacetValueBoolean | import('../../../types/data/api/search/facets').FacetValueRange>[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { State } from '../../../types/data/api/search';
|
|
2
|
+
|
|
3
|
+
export declare const parseSearchState: ({ pathname, searchParams }: URL, facets: string[]) => State;
|
|
4
|
+
export declare const createCategorySlug: (slug: string[] | string, facets: string[]) => string;
|
|
5
|
+
export declare const convertSearchParams: (searchParams: {
|
|
6
|
+
[key: string]: string | string[] | undefined;
|
|
7
|
+
}) => URLSearchParams;
|