@searchspring/snap-store-mobx 0.27.5 → 0.27.8
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/dist/cjs/Abstract/AbstractStore.d.ts +3 -4
- package/dist/cjs/Abstract/AbstractStore.d.ts.map +1 -1
- package/dist/cjs/Abstract/AbstractStore.js +0 -1
- package/dist/cjs/Autocomplete/AutocompleteStore.d.ts +8 -7
- package/dist/cjs/Autocomplete/AutocompleteStore.d.ts.map +1 -1
- package/dist/cjs/Autocomplete/AutocompleteStore.js +17 -16
- package/dist/cjs/Autocomplete/Stores/QueryStore.d.ts +3 -3
- package/dist/cjs/Autocomplete/Stores/QueryStore.d.ts.map +1 -1
- package/dist/cjs/Autocomplete/Stores/QueryStore.js +1 -1
- package/dist/cjs/Autocomplete/Stores/StateStore.d.ts +2 -2
- package/dist/cjs/Autocomplete/Stores/StateStore.d.ts.map +1 -1
- package/dist/cjs/Autocomplete/Stores/StateStore.js +2 -2
- package/dist/cjs/Autocomplete/Stores/TermStore.d.ts +1 -1
- package/dist/cjs/Autocomplete/Stores/TermStore.d.ts.map +1 -1
- package/dist/cjs/Autocomplete/Stores/TrendingStore.d.ts +4 -2
- package/dist/cjs/Autocomplete/Stores/TrendingStore.d.ts.map +1 -1
- package/dist/cjs/Autocomplete/Stores/TrendingStore.js +2 -2
- package/dist/cjs/Finder/FinderStore.d.ts +2 -1
- package/dist/cjs/Finder/FinderStore.d.ts.map +1 -1
- package/dist/cjs/Finder/FinderStore.js +7 -7
- package/dist/cjs/Finder/Stores/SelectionStore.d.ts +43 -4
- package/dist/cjs/Finder/Stores/SelectionStore.d.ts.map +1 -1
- package/dist/cjs/Finder/Stores/SelectionStore.js +10 -9
- package/dist/cjs/Recommendation/RecommendationStore.d.ts +2 -1
- package/dist/cjs/Recommendation/RecommendationStore.d.ts.map +1 -1
- package/dist/cjs/Recommendation/RecommendationStore.js +4 -4
- package/dist/cjs/Recommendation/Stores/ProfileStore.d.ts +2 -1
- package/dist/cjs/Recommendation/Stores/ProfileStore.d.ts.map +1 -1
- package/dist/cjs/Recommendation/Stores/ProfileStore.js +6 -5
- package/dist/cjs/Search/SearchStore.d.ts +3 -3
- package/dist/cjs/Search/SearchStore.d.ts.map +1 -1
- package/dist/cjs/Search/SearchStore.js +24 -8
- package/dist/cjs/Search/Stores/FacetStore.d.ts +70 -1
- package/dist/cjs/Search/Stores/FacetStore.d.ts.map +1 -1
- package/dist/cjs/Search/Stores/FacetStore.js +36 -30
- package/dist/cjs/Search/Stores/FilterStore.d.ts +30 -2
- package/dist/cjs/Search/Stores/FilterStore.d.ts.map +1 -1
- package/dist/cjs/Search/Stores/FilterStore.js +30 -33
- package/dist/cjs/Search/Stores/MerchandisingStore.d.ts +4 -4
- package/dist/cjs/Search/Stores/MerchandisingStore.d.ts.map +1 -1
- package/dist/cjs/Search/Stores/MerchandisingStore.js +1 -1
- package/dist/cjs/Search/Stores/PaginationStore.d.ts +3 -4
- package/dist/cjs/Search/Stores/PaginationStore.d.ts.map +1 -1
- package/dist/cjs/Search/Stores/PaginationStore.js +2 -1
- package/dist/cjs/Search/Stores/QueryStore.d.ts +4 -4
- package/dist/cjs/Search/Stores/QueryStore.d.ts.map +1 -1
- package/dist/cjs/Search/Stores/ResultStore.d.ts +30 -3
- package/dist/cjs/Search/Stores/ResultStore.d.ts.map +1 -1
- package/dist/cjs/Search/Stores/ResultStore.js +4 -2
- package/dist/cjs/Search/Stores/SortingStore.d.ts +7 -3
- package/dist/cjs/Search/Stores/SortingStore.d.ts.map +1 -1
- package/dist/cjs/Search/Stores/SortingStore.js +4 -5
- package/dist/cjs/Search/Stores/index.d.ts +1 -1
- package/dist/cjs/Search/Stores/index.d.ts.map +1 -1
- package/dist/cjs/Search/Stores/index.js +2 -1
- package/dist/cjs/Storage/StorageStore.d.ts +6 -6
- package/dist/cjs/Storage/StorageStore.d.ts.map +1 -1
- package/dist/cjs/Storage/StorageStore.js +7 -5
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +5 -1
- package/dist/cjs/types.d.ts +6 -23
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/esm/Abstract/AbstractStore.d.ts +3 -4
- package/dist/esm/Abstract/AbstractStore.d.ts.map +1 -1
- package/dist/esm/Abstract/AbstractStore.js +0 -1
- package/dist/esm/Autocomplete/AutocompleteStore.d.ts +8 -7
- package/dist/esm/Autocomplete/AutocompleteStore.d.ts.map +1 -1
- package/dist/esm/Autocomplete/AutocompleteStore.js +16 -17
- package/dist/esm/Autocomplete/Stores/QueryStore.d.ts +3 -3
- package/dist/esm/Autocomplete/Stores/QueryStore.d.ts.map +1 -1
- package/dist/esm/Autocomplete/Stores/QueryStore.js +1 -1
- package/dist/esm/Autocomplete/Stores/StateStore.d.ts +2 -2
- package/dist/esm/Autocomplete/Stores/StateStore.d.ts.map +1 -1
- package/dist/esm/Autocomplete/Stores/StateStore.js +2 -2
- package/dist/esm/Autocomplete/Stores/TermStore.d.ts +1 -1
- package/dist/esm/Autocomplete/Stores/TermStore.d.ts.map +1 -1
- package/dist/esm/Autocomplete/Stores/TrendingStore.d.ts +4 -2
- package/dist/esm/Autocomplete/Stores/TrendingStore.d.ts.map +1 -1
- package/dist/esm/Autocomplete/Stores/TrendingStore.js +1 -1
- package/dist/esm/Finder/FinderStore.d.ts +2 -1
- package/dist/esm/Finder/FinderStore.d.ts.map +1 -1
- package/dist/esm/Finder/FinderStore.js +5 -5
- package/dist/esm/Finder/Stores/SelectionStore.d.ts +47 -4
- package/dist/esm/Finder/Stores/SelectionStore.d.ts.map +1 -1
- package/dist/esm/Finder/Stores/SelectionStore.js +8 -8
- package/dist/esm/Recommendation/RecommendationStore.d.ts +2 -1
- package/dist/esm/Recommendation/RecommendationStore.d.ts.map +1 -1
- package/dist/esm/Recommendation/RecommendationStore.js +4 -4
- package/dist/esm/Recommendation/Stores/ProfileStore.d.ts +2 -1
- package/dist/esm/Recommendation/Stores/ProfileStore.d.ts.map +1 -1
- package/dist/esm/Recommendation/Stores/ProfileStore.js +5 -5
- package/dist/esm/Search/SearchStore.d.ts +3 -3
- package/dist/esm/Search/SearchStore.d.ts.map +1 -1
- package/dist/esm/Search/SearchStore.js +24 -9
- package/dist/esm/Search/Stores/FacetStore.d.ts +71 -2
- package/dist/esm/Search/Stores/FacetStore.d.ts.map +1 -1
- package/dist/esm/Search/Stores/FacetStore.js +29 -28
- package/dist/esm/Search/Stores/FilterStore.d.ts +31 -3
- package/dist/esm/Search/Stores/FilterStore.d.ts.map +1 -1
- package/dist/esm/Search/Stores/FilterStore.js +28 -35
- package/dist/esm/Search/Stores/MerchandisingStore.d.ts +4 -4
- package/dist/esm/Search/Stores/MerchandisingStore.d.ts.map +1 -1
- package/dist/esm/Search/Stores/MerchandisingStore.js +1 -1
- package/dist/esm/Search/Stores/PaginationStore.d.ts +3 -4
- package/dist/esm/Search/Stores/PaginationStore.d.ts.map +1 -1
- package/dist/esm/Search/Stores/PaginationStore.js +2 -2
- package/dist/esm/Search/Stores/QueryStore.d.ts +4 -4
- package/dist/esm/Search/Stores/QueryStore.d.ts.map +1 -1
- package/dist/esm/Search/Stores/ResultStore.d.ts +30 -3
- package/dist/esm/Search/Stores/ResultStore.d.ts.map +1 -1
- package/dist/esm/Search/Stores/ResultStore.js +3 -5
- package/dist/esm/Search/Stores/SortingStore.d.ts +7 -3
- package/dist/esm/Search/Stores/SortingStore.d.ts.map +1 -1
- package/dist/esm/Search/Stores/SortingStore.js +4 -5
- package/dist/esm/Search/Stores/index.d.ts +1 -1
- package/dist/esm/Search/Stores/index.d.ts.map +1 -1
- package/dist/esm/Search/Stores/index.js +1 -1
- package/dist/esm/Storage/StorageStore.d.ts +6 -6
- package/dist/esm/Storage/StorageStore.d.ts.map +1 -1
- package/dist/esm/Storage/StorageStore.js +7 -5
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/types.d.ts +6 -23
- package/dist/esm/types.d.ts.map +1 -1
- package/package.json +6 -5
|
@@ -1,7 +1,35 @@
|
|
|
1
|
+
import type { UrlManager } from '@searchspring/snap-url-manager';
|
|
1
2
|
import type { StoreServices } from '../../types';
|
|
2
|
-
import type { SearchResponseModelFilter, MetaResponseModel } from '@searchspring/snapi-types';
|
|
3
|
-
export declare class FilterStore extends Array {
|
|
3
|
+
import type { SearchResponseModelFilter, MetaResponseModel, SearchResponseModelFilterRange, SearchResponseModelFilterValue, MetaResponseModelFacetDefaults, MetaResponseModelFacet } from '@searchspring/snapi-types';
|
|
4
|
+
export declare class FilterStore extends Array<RangeFilter | Filter> {
|
|
4
5
|
static get [Symbol.species](): ArrayConstructor;
|
|
5
|
-
constructor(services: StoreServices, filtersData: SearchResponseModelFilter[], meta: MetaResponseModel);
|
|
6
|
+
constructor(services: StoreServices, filtersData: SearchResponseModelFilter[] | undefined, meta: MetaResponseModel);
|
|
7
|
+
}
|
|
8
|
+
export declare class Filter {
|
|
9
|
+
label: string;
|
|
10
|
+
facet: {
|
|
11
|
+
field?: string;
|
|
12
|
+
label?: string;
|
|
13
|
+
};
|
|
14
|
+
value: {
|
|
15
|
+
value?: string;
|
|
16
|
+
label?: string;
|
|
17
|
+
};
|
|
18
|
+
url: UrlManager;
|
|
19
|
+
constructor(services: StoreServices, filter: SearchResponseModelFilterValue, meta: MetaResponseModelFacet & MetaResponseModelFacetDefaults);
|
|
20
|
+
}
|
|
21
|
+
export declare class RangeFilter {
|
|
22
|
+
label: string;
|
|
23
|
+
facet: {
|
|
24
|
+
field?: string;
|
|
25
|
+
label?: string;
|
|
26
|
+
};
|
|
27
|
+
value: {
|
|
28
|
+
low?: number;
|
|
29
|
+
high?: number;
|
|
30
|
+
label: string;
|
|
31
|
+
};
|
|
32
|
+
url: UrlManager;
|
|
33
|
+
constructor(services: StoreServices, filter: SearchResponseModelFilterRange, meta: MetaResponseModelFacet & MetaResponseModelFacetDefaults);
|
|
6
34
|
}
|
|
7
35
|
//# sourceMappingURL=FilterStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterStore.d.ts","sourceRoot":"","sources":["../../../../src/Search/Stores/FilterStore.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FilterStore.d.ts","sourceRoot":"","sources":["../../../../src/Search/Stores/FilterStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EACX,yBAAyB,EACzB,iBAAiB,EACjB,8BAA8B,EAC9B,8BAA8B,EAC9B,8BAA8B,EAC9B,sBAAsB,EACtB,MAAM,2BAA2B,CAAC;AAEnC,qBAAa,WAAY,SAAQ,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC;IAC3D,MAAM,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,gBAAgB,CAE9C;gBAEW,QAAQ,EAAE,aAAa,EAAE,WAAW,yCAAkC,EAAE,IAAI,EAAE,iBAAiB;CAmB3G;AAED,qBAAa,MAAM;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACK,KAAK,EAAE;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IAEK,GAAG,EAAE,UAAU,CAAC;gBAEX,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,8BAA8B,EAAE,IAAI,EAAE,sBAAsB,GAAG,8BAA8B;CAmB1I;AAED,qBAAa,WAAW;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACK,KAAK,EAAE;QACb,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACd,CAAC;IAEK,GAAG,EAAE,UAAU,CAAC;gBAEX,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,8BAA8B,EAAE,IAAI,EAAE,sBAAsB,GAAG,8BAA8B;CAoB1I"}
|
|
@@ -5,46 +5,32 @@ export class FilterStore extends Array {
|
|
|
5
5
|
}
|
|
6
6
|
constructor(services, filtersData = [], meta) {
|
|
7
7
|
const filters = filtersData.map((filter) => {
|
|
8
|
-
const
|
|
8
|
+
const field = filter.field;
|
|
9
|
+
const facetMeta = meta.facets && meta.facets[field];
|
|
9
10
|
switch (filter.type) {
|
|
10
11
|
case 'range':
|
|
11
12
|
const rangeFilter = filter;
|
|
12
|
-
return new RangeFilter(services,
|
|
13
|
-
facet: {
|
|
14
|
-
field: rangeFilter.field,
|
|
15
|
-
label: facetMeta?.label || rangeFilter.field,
|
|
16
|
-
},
|
|
17
|
-
value: {
|
|
18
|
-
low: rangeFilter.value.low,
|
|
19
|
-
high: rangeFilter.value.high,
|
|
20
|
-
label: rangeFilter.label || `${rangeFilter.value.low} - ${rangeFilter.value.high}`,
|
|
21
|
-
},
|
|
22
|
-
});
|
|
13
|
+
return new RangeFilter(services, rangeFilter, facetMeta);
|
|
23
14
|
case 'value':
|
|
24
15
|
default:
|
|
25
16
|
const valueFilter = filter;
|
|
26
|
-
return new Filter(services,
|
|
27
|
-
facet: {
|
|
28
|
-
field: valueFilter.field,
|
|
29
|
-
label: facetMeta?.label || valueFilter.field,
|
|
30
|
-
},
|
|
31
|
-
value: {
|
|
32
|
-
value: valueFilter.value,
|
|
33
|
-
label: valueFilter.label,
|
|
34
|
-
},
|
|
35
|
-
});
|
|
17
|
+
return new Filter(services, valueFilter, facetMeta);
|
|
36
18
|
}
|
|
37
19
|
});
|
|
38
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
39
|
-
// @ts-ignore
|
|
40
20
|
super(...filters);
|
|
41
21
|
}
|
|
42
22
|
}
|
|
43
|
-
class Filter {
|
|
44
|
-
constructor(services, filter) {
|
|
45
|
-
this.facet =
|
|
46
|
-
|
|
47
|
-
|
|
23
|
+
export class Filter {
|
|
24
|
+
constructor(services, filter, meta) {
|
|
25
|
+
this.facet = {
|
|
26
|
+
field: filter.field,
|
|
27
|
+
label: meta?.label || filter.field,
|
|
28
|
+
};
|
|
29
|
+
this.value = {
|
|
30
|
+
value: filter.value,
|
|
31
|
+
label: filter.label,
|
|
32
|
+
};
|
|
33
|
+
this.label = `${this.facet.label}: ${this.value.label}`;
|
|
48
34
|
this.url = services?.urlManager?.remove('page').remove(`filter.${this.facet.field}`, this.value.value);
|
|
49
35
|
makeObservable(this, {
|
|
50
36
|
facet: observable,
|
|
@@ -53,12 +39,19 @@ class Filter {
|
|
|
53
39
|
});
|
|
54
40
|
}
|
|
55
41
|
}
|
|
56
|
-
class RangeFilter {
|
|
57
|
-
constructor(services, filter) {
|
|
58
|
-
this.facet =
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
42
|
+
export class RangeFilter {
|
|
43
|
+
constructor(services, filter, meta) {
|
|
44
|
+
this.facet = {
|
|
45
|
+
field: filter.field,
|
|
46
|
+
label: meta?.label || filter.field,
|
|
47
|
+
};
|
|
48
|
+
this.value = {
|
|
49
|
+
low: filter?.value?.low,
|
|
50
|
+
high: filter?.value?.high,
|
|
51
|
+
label: filter.label || `${filter?.value?.low} - ${filter?.value?.high}`,
|
|
52
|
+
};
|
|
53
|
+
this.label = `${this.facet.label}: ${this.value.label}`;
|
|
54
|
+
this.url = services?.urlManager?.remove('page').remove(`filter.${this.facet.field}`, { low: this.value.low, high: this.value.high });
|
|
62
55
|
makeObservable(this, {
|
|
63
56
|
facet: observable,
|
|
64
57
|
value: observable,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { StoreServices } from '../../types';
|
|
2
|
-
import type { SearchResponseModelMerchandising } from '@searchspring/snapi-types';
|
|
2
|
+
import type { SearchResponseModelMerchandising, SearchResponseModelMerchandisingContentInline } from '@searchspring/snapi-types';
|
|
3
3
|
declare enum ContentType {
|
|
4
4
|
HEADER = "header",
|
|
5
5
|
BANNER = "banner",
|
|
@@ -9,12 +9,12 @@ declare enum ContentType {
|
|
|
9
9
|
}
|
|
10
10
|
export declare class MerchandisingStore {
|
|
11
11
|
redirect: string;
|
|
12
|
-
content: Partial<Record<ContentType, Content
|
|
12
|
+
content: Partial<Record<ContentType, Content>>;
|
|
13
13
|
constructor(services: StoreServices, merchData: SearchResponseModelMerchandising);
|
|
14
14
|
}
|
|
15
|
-
declare class Content extends Array {
|
|
15
|
+
declare class Content extends Array<string | SearchResponseModelMerchandisingContentInline> {
|
|
16
16
|
static get [Symbol.species](): ArrayConstructor;
|
|
17
|
-
constructor(content:
|
|
17
|
+
constructor(content: string[] | SearchResponseModelMerchandisingContentInline[]);
|
|
18
18
|
}
|
|
19
19
|
export {};
|
|
20
20
|
//# sourceMappingURL=MerchandisingStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MerchandisingStore.d.ts","sourceRoot":"","sources":["../../../../src/Search/Stores/MerchandisingStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"MerchandisingStore.d.ts","sourceRoot":"","sources":["../../../../src/Search/Stores/MerchandisingStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,gCAAgC,EAAE,6CAA6C,EAAE,MAAM,2BAA2B,CAAC;AAEjI,aAAK,WAAW;IACf,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,MAAM,WAAW;CACjB;AACD,qBAAa,kBAAkB;IACvB,QAAQ,SAAM;IACd,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAM;gBAE/C,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,gCAAgC;CAahF;AAED,cAAM,OAAQ,SAAQ,KAAK,CAAC,MAAM,GAAG,6CAA6C,CAAC;IAClF,MAAM,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,gBAAgB,CAE9C;gBAEW,OAAO,EAAE,MAAM,EAAE,GAAG,6CAA6C,EAAE;CAG/E"}
|
|
@@ -14,7 +14,7 @@ export class MerchandisingStore {
|
|
|
14
14
|
this.redirect = merchData.redirect || '';
|
|
15
15
|
if (merchData.content) {
|
|
16
16
|
Object.values(ContentType).forEach((type) => {
|
|
17
|
-
if (merchData.content[type]) {
|
|
17
|
+
if (merchData.content && merchData.content[type]) {
|
|
18
18
|
this.content[type] = new Content(merchData.content[type]);
|
|
19
19
|
}
|
|
20
20
|
});
|
|
@@ -2,7 +2,7 @@ import type { SearchStoreConfig, StoreServices } from '../../types';
|
|
|
2
2
|
import type { SearchResponseModelPagination } from '@searchspring/snapi-types';
|
|
3
3
|
import type { UrlManager } from '@searchspring/snap-url-manager';
|
|
4
4
|
export declare class PaginationStore {
|
|
5
|
-
|
|
5
|
+
services: StoreServices;
|
|
6
6
|
page: number;
|
|
7
7
|
pageSize: number;
|
|
8
8
|
pageSizeOptions: {
|
|
@@ -12,7 +12,6 @@ export declare class PaginationStore {
|
|
|
12
12
|
defaultPageSize: number;
|
|
13
13
|
totalResults: number;
|
|
14
14
|
totalPages: number;
|
|
15
|
-
infinite: boolean;
|
|
16
15
|
controllerConfig: SearchStoreConfig;
|
|
17
16
|
constructor(config: SearchStoreConfig, services: StoreServices, paginationData?: SearchResponseModelPagination);
|
|
18
17
|
get begin(): number;
|
|
@@ -21,8 +20,8 @@ export declare class PaginationStore {
|
|
|
21
20
|
get current(): Page;
|
|
22
21
|
get first(): Page;
|
|
23
22
|
get last(): Page;
|
|
24
|
-
get next(): Page;
|
|
25
|
-
get previous(): Page;
|
|
23
|
+
get next(): Page | undefined;
|
|
24
|
+
get previous(): Page | undefined;
|
|
26
25
|
getPages(min?: number, max?: number): Page[];
|
|
27
26
|
setPageSize(num: number): void;
|
|
28
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaginationStore.d.ts","sourceRoot":"","sources":["../../../../src/Search/Stores/PaginationStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAEjE,qBAAa,eAAe;
|
|
1
|
+
{"version":3,"file":"PaginationStore.d.ts","sourceRoot":"","sources":["../../../../src/Search/Stores/PaginationStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAEjE,qBAAa,eAAe;IACpB,QAAQ,EAAE,aAAa,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE;QACvB,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACd,EAAE,CAAC;IACG,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,iBAAiB,CAAC;gBAG1C,MAAM,EAAE,iBAAiB,EACzB,QAAQ,EAAE,aAAa,EACvB,cAAc,GAAE,6BAMf;IA4CF,IAAW,KAAK,IAAI,MAAM,CAKzB;IAED,IAAW,GAAG,IAAI,MAAM,CAMvB;IAED,IAAW,aAAa,IAAI,OAAO,CAElC;IAED,IAAW,OAAO,IAAI,IAAI,CAKzB;IAED,IAAW,KAAK,IAAI,IAAI,CAKvB;IAED,IAAW,IAAI,IAAI,IAAI,CAKtB;IAED,IAAW,IAAI,IAAI,IAAI,GAAG,SAAS,CAMlC;IAED,IAAW,QAAQ,IAAI,IAAI,GAAG,SAAS,CAMtC;IAEM,QAAQ,CAAC,GAAG,GAAE,MAAU,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE;IAmD/C,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;CAKrC;AAED,qBAAa,IAAI;IACT,QAAQ,EAAE,aAAa,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,EAAE,UAAU,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;gBAGlB,QAAQ,EAAE,aAAa,EACvB,IAAI,EAAE;QACL,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,OAAO,CAAC;KACjB;CAQF"}
|
|
@@ -92,11 +92,11 @@ export class PaginationStore {
|
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
getPages(min, max) {
|
|
95
|
+
getPages(min = 5, max) {
|
|
96
96
|
if (!Number.isInteger(min)) {
|
|
97
97
|
return [];
|
|
98
98
|
}
|
|
99
|
-
if (!Number.isInteger(max)) {
|
|
99
|
+
if (typeof max == 'undefined' || !Number.isInteger(max)) {
|
|
100
100
|
const surrounding = min - 1;
|
|
101
101
|
let from = this.page;
|
|
102
102
|
let to = this.page;
|
|
@@ -2,10 +2,10 @@ import type { UrlManager } from '@searchspring/snap-url-manager';
|
|
|
2
2
|
import type { StoreServices } from '../../types';
|
|
3
3
|
import type { SearchResponseModelSearch, SearchResponseModelSearchMatchTypeEnum } from '@searchspring/snapi-types';
|
|
4
4
|
export declare class QueryStore {
|
|
5
|
-
query
|
|
6
|
-
didYouMean
|
|
7
|
-
originalQuery
|
|
8
|
-
matchType
|
|
5
|
+
query?: Query;
|
|
6
|
+
didYouMean?: Query;
|
|
7
|
+
originalQuery?: Query;
|
|
8
|
+
matchType?: SearchResponseModelSearchMatchTypeEnum;
|
|
9
9
|
constructor(services: StoreServices, search: SearchResponseModelSearch);
|
|
10
10
|
}
|
|
11
11
|
declare class Query {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryStore.d.ts","sourceRoot":"","sources":["../../../../src/Search/Stores/QueryStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,yBAAyB,EAAE,sCAAsC,EAAE,MAAM,2BAA2B,CAAC;AACnH,qBAAa,UAAU;
|
|
1
|
+
{"version":3,"file":"QueryStore.d.ts","sourceRoot":"","sources":["../../../../src/Search/Stores/QueryStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,yBAAyB,EAAE,sCAAsC,EAAE,MAAM,2BAA2B,CAAC;AACnH,qBAAa,UAAU;IACf,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB,aAAa,CAAC,EAAE,KAAK,CAAC;IACtB,SAAS,CAAC,EAAE,sCAAsC,CAAC;gBAE9C,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,yBAAyB;CAyBtE;AASD,cAAM,KAAK;IACH,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,UAAU,CAAC;gBAEX,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM;CASlD"}
|
|
@@ -1,7 +1,34 @@
|
|
|
1
1
|
import type { SearchStoreConfig, AutocompleteStoreConfig, StoreServices } from '../../types';
|
|
2
|
-
import type { SearchResponseModelResult, SearchResponseModelPagination, SearchResponseModelMerchandising } from '@searchspring/snapi-types';
|
|
3
|
-
export declare class ResultStore extends Array {
|
|
2
|
+
import type { SearchResponseModelResult, SearchResponseModelPagination, SearchResponseModelMerchandising, SearchResponseModelResultMappings, SearchResponseModelMerchandisingContentInline, SearchResponseModelMerchandisingContentConfig } from '@searchspring/snapi-types';
|
|
3
|
+
export declare class ResultStore extends Array<Product | Banner> {
|
|
4
4
|
static get [Symbol.species](): ArrayConstructor;
|
|
5
|
-
constructor(config: SearchStoreConfig | AutocompleteStoreConfig, services: StoreServices, resultData
|
|
5
|
+
constructor(config: SearchStoreConfig | AutocompleteStoreConfig, services: StoreServices, resultData?: SearchResponseModelResult[], paginationData?: SearchResponseModelPagination, merchData?: SearchResponseModelMerchandising);
|
|
6
6
|
}
|
|
7
|
+
export declare class Banner {
|
|
8
|
+
type: string;
|
|
9
|
+
id: string;
|
|
10
|
+
attributes: Record<string, unknown>;
|
|
11
|
+
mappings: SearchResponseModelResultMappings;
|
|
12
|
+
custom: {};
|
|
13
|
+
config: SearchResponseModelMerchandisingContentConfig;
|
|
14
|
+
value: string;
|
|
15
|
+
constructor(services: StoreServices, banner: SearchResponseModelMerchandisingContentInline);
|
|
16
|
+
}
|
|
17
|
+
export declare class Product {
|
|
18
|
+
type: string;
|
|
19
|
+
id: string;
|
|
20
|
+
attributes: Record<string, unknown>;
|
|
21
|
+
mappings: SearchResponseModelResultMappings;
|
|
22
|
+
custom: {};
|
|
23
|
+
children?: Array<Child>;
|
|
24
|
+
constructor(services: StoreServices, result: SearchResponseModelResult);
|
|
25
|
+
}
|
|
26
|
+
declare class Child {
|
|
27
|
+
type: string;
|
|
28
|
+
id: string;
|
|
29
|
+
attributes: Record<string, unknown>;
|
|
30
|
+
custom: {};
|
|
31
|
+
constructor(services: StoreServices, result: SearchResponseModelResult);
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
7
34
|
//# sourceMappingURL=ResultStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResultStore.d.ts","sourceRoot":"","sources":["../../../../src/Search/Stores/ResultStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC7F,OAAO,KAAK,EACX,yBAAyB,EACzB,6BAA6B,EAC7B,gCAAgC,
|
|
1
|
+
{"version":3,"file":"ResultStore.d.ts","sourceRoot":"","sources":["../../../../src/Search/Stores/ResultStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC7F,OAAO,KAAK,EACX,yBAAyB,EACzB,6BAA6B,EAC7B,gCAAgC,EAChC,iCAAiC,EACjC,6CAA6C,EAC7C,6CAA6C,EAC7C,MAAM,2BAA2B,CAAC;AAEnC,qBAAa,WAAY,SAAQ,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;IACvD,MAAM,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,gBAAgB,CAE9C;gBAGA,MAAM,EAAE,iBAAiB,GAAG,uBAAuB,EACnD,QAAQ,EAAE,aAAa,EACvB,UAAU,CAAC,EAAE,yBAAyB,EAAE,EACxC,cAAc,CAAC,EAAE,6BAA6B,EAC9C,SAAS,CAAC,EAAE,gCAAgC;CAqB7C;AAED,qBAAa,MAAM;IACX,IAAI,SAAY;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM;IACzC,QAAQ,EAAE,iCAAiC,CAEhD;IACK,MAAM,KAAM;IACZ,MAAM,EAAE,6CAA6C,CAAC;IACtD,KAAK,EAAE,MAAM,CAAC;gBAET,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,6CAA6C;CAW1F;AAED,qBAAa,OAAO;IACZ,IAAI,SAAa;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM;IACzC,QAAQ,EAAE,iCAAiC,CAEhD;IACK,MAAM,KAAM;IACZ,QAAQ,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAM;gBAExB,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,yBAAyB;CA8BtE;AAED,cAAM,KAAK;IACH,IAAI,SAAW;IACf,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM;IACzC,MAAM,KAAM;gBAEP,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,yBAAyB;CAUtE"}
|
|
@@ -19,12 +19,10 @@ export class ResultStore extends Array {
|
|
|
19
19
|
results = addBannersToResults(config, results, banners, paginationData);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
23
|
-
// @ts-ignore
|
|
24
22
|
super(...results);
|
|
25
23
|
}
|
|
26
24
|
}
|
|
27
|
-
class Banner {
|
|
25
|
+
export class Banner {
|
|
28
26
|
constructor(services, banner) {
|
|
29
27
|
this.type = 'banner';
|
|
30
28
|
this.attributes = {};
|
|
@@ -42,7 +40,7 @@ class Banner {
|
|
|
42
40
|
});
|
|
43
41
|
}
|
|
44
42
|
}
|
|
45
|
-
class Product {
|
|
43
|
+
export class Product {
|
|
46
44
|
constructor(services, result) {
|
|
47
45
|
this.type = 'product';
|
|
48
46
|
this.attributes = {};
|
|
@@ -68,7 +66,7 @@ class Product {
|
|
|
68
66
|
custom: observable,
|
|
69
67
|
});
|
|
70
68
|
// must set all subo
|
|
71
|
-
const coreObservables = Object.keys(
|
|
69
|
+
const coreObservables = Object.keys(this.mappings.core).reduce((map, key) => {
|
|
72
70
|
return {
|
|
73
71
|
...map,
|
|
74
72
|
[key]: observable,
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import type { UrlManager } from '@searchspring/snap-url-manager';
|
|
2
2
|
import type { StoreServices } from '../../types';
|
|
3
|
-
import type { MetaResponseModel, SearchResponseModelSearch, SearchResponseModelSorting } from '@searchspring/snapi-types';
|
|
3
|
+
import type { MetaResponseModel, MetaResponseModelSortOption, SearchResponseModelSearch, SearchResponseModelSorting } from '@searchspring/snapi-types';
|
|
4
|
+
declare type MetaResponseModelSortOptionMutated = MetaResponseModelSortOption & {
|
|
5
|
+
active?: boolean;
|
|
6
|
+
default?: boolean;
|
|
7
|
+
};
|
|
4
8
|
export declare class SortingStore {
|
|
5
9
|
options: Option[];
|
|
6
10
|
constructor(services: StoreServices, sorting: SearchResponseModelSorting[], search: SearchResponseModelSearch, meta: MetaResponseModel);
|
|
7
|
-
get current(): Option;
|
|
11
|
+
get current(): Option | undefined;
|
|
8
12
|
}
|
|
9
13
|
declare class Option {
|
|
10
14
|
active: boolean;
|
|
@@ -15,7 +19,7 @@ declare class Option {
|
|
|
15
19
|
type: string;
|
|
16
20
|
value: string;
|
|
17
21
|
url: UrlManager;
|
|
18
|
-
constructor(services: StoreServices, option:
|
|
22
|
+
constructor(services: StoreServices, option: MetaResponseModelSortOptionMutated, index: number);
|
|
19
23
|
}
|
|
20
24
|
export {};
|
|
21
25
|
//# sourceMappingURL=SortingStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SortingStore.d.ts","sourceRoot":"","sources":["../../../../src/Search/Stores/SortingStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EACX,iBAAiB,
|
|
1
|
+
{"version":3,"file":"SortingStore.d.ts","sourceRoot":"","sources":["../../../../src/Search/Stores/SortingStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EACX,iBAAiB,EACjB,2BAA2B,EAC3B,yBAAyB,EACzB,0BAA0B,EAC1B,MAAM,2BAA2B,CAAC;AAEnC,aAAK,kCAAkC,GAAG,2BAA2B,GAAG;IACvE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,qBAAa,YAAY;IACjB,OAAO,EAAE,MAAM,EAAE,CAAM;gBAElB,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,0BAA0B,EAAE,EAAE,MAAM,EAAE,yBAAyB,EAAE,IAAI,EAAE,iBAAiB;IAsCtI,IAAW,OAAO,IAAI,MAAM,GAAG,SAAS,CAEvC;CACD;AAED,cAAM,MAAM;IACJ,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,UAAU,CAAC;gBAEX,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,kCAAkC,EAAE,KAAK,EAAE,MAAM;CAuB9F"}
|
|
@@ -3,8 +3,8 @@ export class SortingStore {
|
|
|
3
3
|
constructor(services, sorting, search, meta) {
|
|
4
4
|
this.options = [];
|
|
5
5
|
if (services && meta.sortOptions) {
|
|
6
|
-
const activeSort = sorting
|
|
7
|
-
|
|
6
|
+
const activeSort = sorting?.length && sorting[0];
|
|
7
|
+
const options = (meta.sortOptions || [])
|
|
8
8
|
.filter((option) => {
|
|
9
9
|
if (!search?.query) {
|
|
10
10
|
return option.type == 'field';
|
|
@@ -13,9 +13,7 @@ export class SortingStore {
|
|
|
13
13
|
})
|
|
14
14
|
.map((option, index) => {
|
|
15
15
|
option.active = false;
|
|
16
|
-
|
|
17
|
-
// @ts-ignore
|
|
18
|
-
if (activeSort && activeSort.field == option.field && activeSort.direction == option.direction) {
|
|
16
|
+
if (activeSort && activeSort.field == option.field && String(activeSort.direction) == String(option.direction)) {
|
|
19
17
|
option.active = true;
|
|
20
18
|
}
|
|
21
19
|
else if (!activeSort && index === 0) {
|
|
@@ -29,6 +27,7 @@ export class SortingStore {
|
|
|
29
27
|
const optionObj = new Option(services, option, index);
|
|
30
28
|
return optionObj;
|
|
31
29
|
});
|
|
30
|
+
this.options = options;
|
|
32
31
|
makeObservable(this, {
|
|
33
32
|
options: observable,
|
|
34
33
|
current: computed,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { MerchandisingStore } from './MerchandisingStore';
|
|
2
|
-
export { FacetStore } from './FacetStore';
|
|
2
|
+
export { FacetStore, Value } from './FacetStore';
|
|
3
3
|
export { FilterStore } from './FilterStore';
|
|
4
4
|
export { PaginationStore } from './PaginationStore';
|
|
5
5
|
export { ResultStore } from './ResultStore';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/Search/Stores/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/Search/Stores/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { MerchandisingStore } from './MerchandisingStore';
|
|
2
|
-
export { FacetStore } from './FacetStore';
|
|
2
|
+
export { FacetStore, Value } from './FacetStore';
|
|
3
3
|
export { FilterStore } from './FilterStore';
|
|
4
4
|
export { PaginationStore } from './PaginationStore';
|
|
5
5
|
export { ResultStore } from './ResultStore';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export declare class StorageStore {
|
|
2
|
-
type
|
|
3
|
-
expiration
|
|
4
|
-
sameSite
|
|
5
|
-
key
|
|
6
|
-
state:
|
|
2
|
+
private type;
|
|
3
|
+
private expiration;
|
|
4
|
+
private sameSite;
|
|
5
|
+
private key;
|
|
6
|
+
state: Record<string, any>;
|
|
7
7
|
constructor(config?: StorageConfig);
|
|
8
8
|
set(path: string, value: any): void;
|
|
9
|
-
get(path: string): any;
|
|
9
|
+
get(path: string): any | undefined;
|
|
10
10
|
clear(): void;
|
|
11
11
|
}
|
|
12
12
|
export declare type StorageConfig = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorageStore.d.ts","sourceRoot":"","sources":["../../../src/Storage/StorageStore.ts"],"names":[],"mappings":"AAMA,qBAAa,YAAY;IACxB,
|
|
1
|
+
{"version":3,"file":"StorageStore.d.ts","sourceRoot":"","sources":["../../../src/Storage/StorageStore.ts"],"names":[],"mappings":"AAMA,qBAAa,YAAY;IACxB,OAAO,CAAC,IAAI,CAA4B;IACxC,OAAO,CAAC,UAAU,CAAe;IACjC,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,GAAG,CAAgB;IACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;gBAE3B,MAAM,CAAC,EAAE,aAAa;IA8C3B,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IAyBnC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS;IAiClC,KAAK,IAAI,IAAI;CAcpB;AAED,oBAAY,aAAa,GAAG;IAC3B,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,CAAC,EAAE;QACR,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,GAAG,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,oBAAY,WAAW;IACtB,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,MAAM,WAAW;CACjB"}
|
|
@@ -6,7 +6,7 @@ export class StorageStore {
|
|
|
6
6
|
constructor(config) {
|
|
7
7
|
this.type = null;
|
|
8
8
|
this.expiration = 31536000000; // one year (ms)
|
|
9
|
-
this.sameSite =
|
|
9
|
+
this.sameSite = 'Lax';
|
|
10
10
|
this.key = 'ss-storage';
|
|
11
11
|
this.state = {};
|
|
12
12
|
if (config) {
|
|
@@ -79,10 +79,12 @@ export class StorageStore {
|
|
|
79
79
|
get(path) {
|
|
80
80
|
switch (this.type) {
|
|
81
81
|
case StorageType.SESSION:
|
|
82
|
-
|
|
82
|
+
const sessionData = window.sessionStorage.getItem(this.key);
|
|
83
|
+
this.state = sessionData ? JSON.parse(sessionData) : {};
|
|
83
84
|
break;
|
|
84
85
|
case StorageType.LOCAL:
|
|
85
|
-
|
|
86
|
+
const localData = window.localStorage.getItem(this.key);
|
|
87
|
+
this.state = localData ? JSON.parse(localData) : {};
|
|
86
88
|
break;
|
|
87
89
|
case StorageType.COOKIE:
|
|
88
90
|
const data = utils.cookies.get(this.key);
|
|
@@ -100,8 +102,8 @@ export class StorageStore {
|
|
|
100
102
|
value = value[p];
|
|
101
103
|
}
|
|
102
104
|
else {
|
|
103
|
-
value =
|
|
104
|
-
|
|
105
|
+
value = {};
|
|
106
|
+
return;
|
|
105
107
|
}
|
|
106
108
|
}
|
|
107
109
|
return value;
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { AbstractStore } from './Abstract/AbstractStore';
|
|
|
2
2
|
export { AutocompleteStore } from './Autocomplete/AutocompleteStore';
|
|
3
3
|
export { FinderStore } from './Finder/FinderStore';
|
|
4
4
|
export { SearchStore } from './Search/SearchStore';
|
|
5
|
+
export { ResultStore, Product, Banner } from './Search/Stores/ResultStore';
|
|
5
6
|
export { RecommendationStore } from './Recommendation/RecommendationStore';
|
|
6
7
|
export { StorageStore, StorageConfig, StorageType } from './Storage/StorageStore';
|
|
7
8
|
export * from './types';
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAElF,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAElF,cAAc,SAAS,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export { AbstractStore } from './Abstract/AbstractStore';
|
|
|
2
2
|
export { AutocompleteStore } from './Autocomplete/AutocompleteStore';
|
|
3
3
|
export { FinderStore } from './Finder/FinderStore';
|
|
4
4
|
export { SearchStore } from './Search/SearchStore';
|
|
5
|
+
export { ResultStore, Product, Banner } from './Search/Stores/ResultStore';
|
|
5
6
|
export { RecommendationStore } from './Recommendation/RecommendationStore';
|
|
6
7
|
export { StorageStore, StorageType } from './Storage/StorageStore';
|
|
7
8
|
export * from './types';
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import type { UrlManager } from '@searchspring/snap-url-manager';
|
|
2
|
-
import type { SearchResponseModelFacetValueAllOfValues } from '@searchspring/snapi-types';
|
|
2
|
+
import type { SearchResponseModelFacetValueAllOfValues, AutocompleteRequestModel, SearchRequestModel } from '@searchspring/snapi-types';
|
|
3
3
|
export declare type StoreConfig = {
|
|
4
4
|
id: string;
|
|
5
5
|
[any: string]: unknown;
|
|
6
6
|
};
|
|
7
7
|
export declare type SearchStoreConfig = StoreConfig & {
|
|
8
|
-
globals?:
|
|
9
|
-
personalization?: {
|
|
10
|
-
disabled: boolean;
|
|
11
|
-
};
|
|
12
|
-
[any: string]: unknown;
|
|
13
|
-
};
|
|
8
|
+
globals?: Partial<SearchRequestModel>;
|
|
14
9
|
settings?: {
|
|
15
10
|
redirects?: {
|
|
16
11
|
merchandising?: boolean;
|
|
@@ -26,7 +21,7 @@ export declare type SearchStoreConfig = StoreConfig & {
|
|
|
26
21
|
};
|
|
27
22
|
};
|
|
28
23
|
};
|
|
29
|
-
declare type FacetStoreConfig = {
|
|
24
|
+
export declare type FacetStoreConfig = {
|
|
30
25
|
trim?: boolean;
|
|
31
26
|
pinFiltered?: boolean;
|
|
32
27
|
storeRange?: boolean;
|
|
@@ -47,19 +42,7 @@ export declare type FinderFieldConfig = {
|
|
|
47
42
|
levels?: string[];
|
|
48
43
|
};
|
|
49
44
|
export declare type AutocompleteStoreConfig = StoreConfig & {
|
|
50
|
-
globals?:
|
|
51
|
-
personalization?: {
|
|
52
|
-
disabled: boolean;
|
|
53
|
-
};
|
|
54
|
-
search?: {
|
|
55
|
-
[any: string]: unknown;
|
|
56
|
-
query?: {
|
|
57
|
-
[any: string]: unknown;
|
|
58
|
-
spellCorrection?: boolean;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
[any: string]: unknown;
|
|
62
|
-
};
|
|
45
|
+
globals?: Partial<AutocompleteRequestModel>;
|
|
63
46
|
selector: string;
|
|
64
47
|
action?: string;
|
|
65
48
|
settings?: {
|
|
@@ -82,10 +65,11 @@ export declare type RecommendationStoreConfig = StoreConfig & {
|
|
|
82
65
|
branch?: string;
|
|
83
66
|
realtime?: boolean;
|
|
84
67
|
batched?: boolean;
|
|
68
|
+
order?: number;
|
|
85
69
|
};
|
|
86
70
|
export declare type StoreConfigs = SearchStoreConfig | AutocompleteStoreConfig | FinderStoreConfig | RecommendationStoreConfig;
|
|
87
71
|
export declare type StoreServices = {
|
|
88
|
-
urlManager
|
|
72
|
+
urlManager: UrlManager;
|
|
89
73
|
};
|
|
90
74
|
export declare enum ErrorType {
|
|
91
75
|
WARNING = "warning",
|
|
@@ -100,5 +84,4 @@ export declare type SelectedSelection = {
|
|
|
100
84
|
export declare type FinderStoreState = {
|
|
101
85
|
persisted: boolean;
|
|
102
86
|
};
|
|
103
|
-
export {};
|
|
104
87
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/esm/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,wCAAwC,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@searchspring/snap-store-mobx",
|
|
3
|
-
"version": "0.27.
|
|
3
|
+
"version": "0.27.8",
|
|
4
4
|
"description": "Snap MobX Store",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -20,15 +20,16 @@
|
|
|
20
20
|
"test:watch": "jest --watch"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@searchspring/snap-toolbox": "^0.27.
|
|
24
|
-
"mobx": "
|
|
23
|
+
"@searchspring/snap-toolbox": "^0.27.8",
|
|
24
|
+
"mobx": "6.6.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@searchspring/snap-
|
|
27
|
+
"@searchspring/snap-client": "^0.27.8",
|
|
28
|
+
"@searchspring/snap-url-manager": "^0.27.8"
|
|
28
29
|
},
|
|
29
30
|
"sideEffects": false,
|
|
30
31
|
"files": [
|
|
31
32
|
"dist/**/*"
|
|
32
33
|
],
|
|
33
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "cfbe6d18899fb4944ec397e2419d8409d4ab0065"
|
|
34
35
|
}
|