@soma-vertical-web/multi-lib 0.0.33 → 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/search/crosseling/index.d.ts +4 -8
- package/index.js +19 -19
- package/index.mjs +4336 -3979
- package/index2.js +1 -1
- package/index2.mjs +493 -560
- package/package.json +1 -1
- package/types/constants.d.ts +4 -24
- package/types/contexts/contexts/search.d.ts +8 -2
- package/types/layout/team-components/AddToCart/index.d.ts +2 -2
- package/types/layout/team-components/Sort/index.d.ts +2 -3
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
const c = "fuzzy", l = "operator", i = (e) => ({
|
|
2
|
+
isDepartment: e != null && e.length ? e[0].key === "category-1" : !1
|
|
3
|
+
}), _ = (e, t) => {
|
|
4
|
+
const n = decodeURIComponent(t ?? "").slice(1).split("/");
|
|
5
|
+
return e.map((o) => {
|
|
6
|
+
if (o.key === "category-2" && o.__typename === "FacetBoolean") {
|
|
7
|
+
const a = o.values;
|
|
8
|
+
return {
|
|
9
|
+
...o,
|
|
10
|
+
values: a.filter(
|
|
11
|
+
(r) => !n.find(
|
|
12
|
+
(s) => s.toLowerCase() === r.value || s.toLowerCase() === r.name.toLowerCase()
|
|
13
|
+
)
|
|
14
|
+
)
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
return o;
|
|
18
|
+
});
|
|
19
|
+
}, p = (e, t) => t ? e === "category-1" : !1, u = (e) => e.key === "operator" && (e.value === "and" || e.value === "or"), f = (e) => e.type === "TEXT", y = (e) => e.key === "fuzzy" && (e.value === "0" || e.value === "1" || e.value === "auto"), m = (e) => {
|
|
20
|
+
const { key: t, name: n, values: o } = e;
|
|
21
|
+
return {
|
|
22
|
+
__typename: "FacetBoolean",
|
|
23
|
+
key: t,
|
|
24
|
+
label: n,
|
|
25
|
+
values: o.slice().sort((a, r) => a.name.localeCompare(r.name))
|
|
26
|
+
};
|
|
27
|
+
}, g = ({ key: e, values: t }) => ({
|
|
28
|
+
__typename: "FacetRange",
|
|
29
|
+
key: e,
|
|
30
|
+
values: t
|
|
31
|
+
}), R = (e, t, n) => {
|
|
32
|
+
if (!(e instanceof Object) || !("facets" in e))
|
|
33
|
+
return [];
|
|
34
|
+
const { facets: o = [] } = e, a = t != null && t.length ? t[0].key === "category-1" : !1;
|
|
35
|
+
return o.filter(
|
|
36
|
+
(s) => !n || !p(s.key, a)
|
|
37
|
+
).map(
|
|
38
|
+
(s) => f(s) ? m(s) : g(s)
|
|
39
|
+
);
|
|
40
|
+
}, C = (e, t) => {
|
|
41
|
+
const n = e.find(({ key: a }) => a === c) ?? null, o = e.find(({ key: a }) => a === l) ?? null;
|
|
42
|
+
n && y(n) && t.append(c, n.value), o && u(o) && t.append(l, o.value);
|
|
43
|
+
}, d = (e) => e.map((t) => {
|
|
44
|
+
const [n, o] = t.split("/");
|
|
45
|
+
return { key: n, value: o };
|
|
46
|
+
}), z = (e, t) => {
|
|
47
|
+
const n = decodeURIComponent(t ?? "").slice(1).split("/"), o = e.filter(({ value: r }) => !n.includes(decodeURIComponent(r))).map((r) => ({
|
|
48
|
+
...r,
|
|
49
|
+
value: decodeURIComponent(r.value)
|
|
50
|
+
})), { isDepartment: a } = i(o);
|
|
51
|
+
return o == null ? void 0 : o.filter((r) => !p(r.key, a));
|
|
52
|
+
}, b = ({ pathname: e, searchParams: t }, n) => {
|
|
53
|
+
const o = t.get("sort") ?? "", a = t.get("query") ?? null, r = parseInt(t.get("page") ?? "1", 10);
|
|
54
|
+
return {
|
|
55
|
+
sort: o,
|
|
56
|
+
facets: d(n),
|
|
57
|
+
term: a,
|
|
58
|
+
base: a ? "" : e,
|
|
59
|
+
page: r
|
|
60
|
+
};
|
|
61
|
+
}, k = (e) => {
|
|
62
|
+
const t = new URLSearchParams();
|
|
63
|
+
return Object.entries(e).forEach(([n, o]) => {
|
|
64
|
+
Array.isArray(o) ? o.forEach((a) => t.append(n, a)) : o !== void 0 && t.append(n, o);
|
|
65
|
+
}), t;
|
|
66
|
+
}, v = {}, S = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
67
|
+
__proto__: null,
|
|
68
|
+
default: v
|
|
69
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
70
|
+
export {
|
|
71
|
+
S as _,
|
|
72
|
+
C as a,
|
|
73
|
+
R as b,
|
|
74
|
+
k as c,
|
|
75
|
+
_ as d,
|
|
76
|
+
z as e,
|
|
77
|
+
v as f,
|
|
78
|
+
b as p
|
|
79
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const c="fuzzy",l="operator",p=e=>({isDepartment:e!=null&&e.length?e[0].key==="category-1":!1}),f=(e,t)=>{const n=decodeURIComponent(t??"").slice(1).split("/");return e.map(o=>{if(o.key==="category-2"&&o.__typename==="FacetBoolean"){const a=o.values;return{...o,values:a.filter(r=>!n.find(s=>s.toLowerCase()===r.value||s.toLowerCase()===r.name.toLowerCase()))}}return o})},i=(e,t)=>t?e==="category-1":!1,y=e=>e.key==="operator"&&(e.value==="and"||e.value==="or"),m=e=>e.type==="TEXT",d=e=>e.key==="fuzzy"&&(e.value==="0"||e.value==="1"||e.value==="auto"),g=e=>{const{key:t,name:n,values:o}=e;return{__typename:"FacetBoolean",key:t,label:n,values:o.slice().sort((a,r)=>a.name.localeCompare(r.name))}},v=({key:e,values:t})=>({__typename:"FacetRange",key:e,values:t}),_=(e,t,n)=>{if(!(e instanceof Object)||!("facets"in e))return[];const{facets:o=[]}=e,a=t!=null&&t.length?t[0].key==="category-1":!1;return o.filter(s=>!n||!i(s.key,a)).map(s=>m(s)?g(s):v(s))},S=(e,t)=>{const n=e.find(({key:a})=>a===c)??null,o=e.find(({key:a})=>a===l)??null;n&&d(n)&&t.append(c,n.value),o&&y(o)&&t.append(l,o.value)},R=e=>e.map(t=>{const[n,o]=t.split("/");return{key:n,value:o}}),C=(e,t)=>{const n=decodeURIComponent(t??"").slice(1).split("/"),o=e.filter(({value:r})=>!n.includes(decodeURIComponent(r))).map(r=>({...r,value:decodeURIComponent(r.value)})),{isDepartment:a}=p(o);return o==null?void 0:o.filter(r=>!i(r.key,a))},F=({pathname:e,searchParams:t},n)=>{const o=t.get("sort")??"",a=t.get("query")??null,r=parseInt(t.get("page")??"1",10);return{sort:o,facets:R(n),term:a,base:a?"":e,page:r}},h=e=>{const t=new URLSearchParams;return Object.entries(e).forEach(([n,o])=>{Array.isArray(o)?o.forEach(a=>t.append(n,a)):o!==void 0&&t.append(n,o)}),t},u={},z=Object.freeze(Object.defineProperty({__proto__:null,default:u},Symbol.toStringTag,{value:"Module"}));exports.__viteBrowserExternal=z;exports.addSearchParamsFacets=S;exports.convertSearchParams=h;exports.filterNonCategorySelected=f;exports.filterNonRootFacets=C;exports.formattedFacets=_;exports.fs=u;exports.parseSearchState=F;
|
package/constants.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare const PLP_FILTERS_SORT: {
|
|
2
|
+
placeholder: string;
|
|
3
|
+
options: {
|
|
4
|
+
score_desc: string;
|
|
5
|
+
orders_desc: string;
|
|
6
|
+
price_desc: string;
|
|
7
|
+
price_asc: string;
|
|
8
|
+
release_desc: string;
|
|
9
|
+
discount_desc: string;
|
|
10
|
+
name_asc: string;
|
|
11
|
+
};
|
|
12
|
+
default_option: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const PDPShelfType: readonly ["whosawalsosaw", "whosawalsobought", "whoboughtalsobought", "accessories", "similars", "showtogether", "suggestions"];
|
|
15
|
+
export declare const FACET_CROSS_SELLING_MAP: {
|
|
16
|
+
readonly buy: "whoboughtalsobought";
|
|
17
|
+
readonly view: "whosawalsosaw";
|
|
18
|
+
readonly similars: "similars";
|
|
19
|
+
readonly viewAndBought: "whosawalsobought";
|
|
20
|
+
readonly accessories: "accessories";
|
|
21
|
+
readonly suggestions: "suggestions";
|
|
22
|
+
};
|
|
23
|
+
export declare const SORT_OPTIONS: string[];
|
|
24
|
+
export declare const ObjectFitsDefault: readonly ["contain", "cover", "fill", "none"];
|
|
25
|
+
export declare const SEARCH_PAGE_DEFAULT_PAGINATION: {
|
|
26
|
+
nextPage: boolean;
|
|
27
|
+
previousPage: boolean;
|
|
28
|
+
startCursor: string;
|
|
29
|
+
endCursor: string;
|
|
30
|
+
count: number;
|
|
31
|
+
total: number;
|
|
32
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FacetsContextProps, FacetsProviderProps } from '../../../types/contexts/contexts/search';
|
|
2
|
+
|
|
3
|
+
declare const FacetsProvider: ({ children, searchParams, forceUpdate, }: FacetsProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare const useFacetsContext: () => FacetsContextProps;
|
|
5
|
+
export { FacetsProvider, useFacetsContext };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ProductsContextProps, ProductsProviderProps } from '../../../types/contexts/contexts/search';
|
|
2
|
+
|
|
3
|
+
declare const ProductsProvider: ({ children, query, state, selectedFacets, forceUpdate, }: ProductsProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare const useProductsContext: () => ProductsContextProps;
|
|
5
|
+
export { ProductsProvider, useProductsContext };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RootContextProps, RootProviderProps } from '../../../types/contexts/contexts/search';
|
|
2
|
+
|
|
3
|
+
declare const RootProvider: ({ children, fetch }: RootProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare const useRootContext: () => RootContextProps;
|
|
5
|
+
export { RootProvider, useRootContext };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SearchProviderProps, SearchContextProps } from '../../../types/contexts/contexts/search';
|
|
2
|
+
|
|
3
|
+
declare const SearchProvider: ({ children, sort, state, count, collectionId, CONSTANTS }: SearchProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare const useSearchContext: () => SearchContextProps;
|
|
5
|
+
export { SearchProvider, useSearchContext };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SuggestedTermsContextProps, SuggestedTermsProviderProps } from '../../../types/contexts/contexts/search';
|
|
2
|
+
|
|
3
|
+
declare const SuggestedTermsProvider: ({ children, ...props }: SuggestedTermsProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare const useSuggestedTermsContext: () => SuggestedTermsContextProps;
|
|
5
|
+
export { SuggestedTermsProvider, useSuggestedTermsContext, };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TopSearchesContextProps } from '../../../types/contexts/contexts/search';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
|
|
4
|
+
declare const TopSearchesProvider: ({ children }: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare const useTopSearches: () => TopSearchesContextProps;
|
|
6
|
+
export { TopSearchesProvider, useTopSearches };
|
package/contexts/index.d.ts
CHANGED
|
@@ -74,6 +74,30 @@ export declare const contexts: {
|
|
|
74
74
|
hook: () => import('../types/contexts/contexts/pdp').PDPDataContextProps;
|
|
75
75
|
provider: ({ children, productData, isKit, PDP_INFO, NAME_SPLIT_SYMBOL }: import('../types/contexts/contexts/pdp').PDPDataProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
76
76
|
};
|
|
77
|
+
searchFacets: {
|
|
78
|
+
hook: () => import('../types/contexts/contexts/search').FacetsContextProps;
|
|
79
|
+
provider: ({ children, searchParams, forceUpdate, }: import('../types/contexts/contexts/search').FacetsProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
80
|
+
};
|
|
81
|
+
searchProducts: {
|
|
82
|
+
hook: () => import('../types/contexts/contexts/search').ProductsContextProps;
|
|
83
|
+
provider: ({ children, query, state, selectedFacets, forceUpdate, }: import('../types/contexts/contexts/search').ProductsProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
84
|
+
};
|
|
85
|
+
searchRoot: {
|
|
86
|
+
hook: () => import('../types/contexts/contexts/search').RootContextProps;
|
|
87
|
+
provider: ({ children, fetch }: import('../types/contexts/contexts/search').RootProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
88
|
+
};
|
|
89
|
+
searchSearch: {
|
|
90
|
+
hook: () => import('../types/contexts/contexts/search').SearchContextProps;
|
|
91
|
+
provider: ({ children, sort, state, count, collectionId, CONSTANTS }: import('../types/contexts/contexts/search').SearchProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
92
|
+
};
|
|
93
|
+
searchSuggestedTerms: {
|
|
94
|
+
hook: () => import('../types/contexts/contexts/search').SuggestedTermsContextProps;
|
|
95
|
+
provider: ({ children, ...props }: import('../types/contexts/contexts/search').SuggestedTermsProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
96
|
+
};
|
|
97
|
+
searchTopSearchs: {
|
|
98
|
+
hook: () => import('../types/contexts/contexts/search').TopSearchesContextProps;
|
|
99
|
+
provider: ({ children }: import('react').PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
|
|
100
|
+
};
|
|
77
101
|
ui: {
|
|
78
102
|
hook: () => import('../types/contexts/contexts/cart').UIContextProps;
|
|
79
103
|
provider: ({ children, ...props }: import('../types/contexts/contexts/cart').UIProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { FetchFunctionsProps } from '../../../../types/data/api';
|
|
2
2
|
import * as yup from 'yup';
|
|
3
|
-
declare const schema: yup.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}[];
|
|
8
|
-
}, yup.AnyObject, {
|
|
9
|
-
facets: "";
|
|
10
|
-
}, "">;
|
|
3
|
+
declare const schema: yup.ArraySchema<{
|
|
4
|
+
value: string;
|
|
5
|
+
key: string;
|
|
6
|
+
}[], yup.AnyObject, "", "">;
|
|
11
7
|
type SchemaType = yup.InferType<typeof schema>;
|
|
12
8
|
export declare function getSearchCrossellingProducts({ apiUrl, body, fetchOptions }: FetchFunctionsProps<SchemaType>): Promise<{
|
|
13
9
|
node: {
|