fast-simon-sdk 1.6.4 → 1.6.9
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/config.d.ts +25 -22
- package/lib/config.js +30 -27
- package/lib/config.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.js +72 -71
- package/lib/index.js.map +1 -1
- package/lib/models/autocomplete.d.ts +73 -70
- package/lib/models/autocomplete.js +2 -2
- package/lib/models/common.d.ts +267 -208
- package/lib/models/common.js +65 -63
- package/lib/models/common.js.map +1 -1
- package/lib/models/content.d.ts +37 -37
- package/lib/models/content.js +2 -2
- package/lib/models/events.d.ts +113 -87
- package/lib/models/events.js +2 -2
- package/lib/models/exports.d.ts +6 -6
- package/lib/models/exports.js +5 -5
- package/lib/models/fullTextSearch.d.ts +130 -126
- package/lib/models/fullTextSearch.js +17 -17
- package/lib/models/fullTextSearch.js.map +1 -1
- package/lib/models/lookAlikeProductRecommendation.d.ts +8 -8
- package/lib/models/lookAlikeProductRecommendation.js +2 -2
- package/lib/models/productsInventory.d.ts +10 -10
- package/lib/models/productsInventory.js +2 -2
- package/lib/models/related.d.ts +35 -35
- package/lib/models/related.js +2 -2
- package/lib/models/smartCollections.d.ts +94 -90
- package/lib/models/smartCollections.js +2 -2
- package/lib/models/visualDiscovery.d.ts +129 -0
- package/lib/models/visualDiscovery.js +31 -0
- package/lib/models/visualDiscovery.js.map +1 -0
- package/lib/sections/contentSearch/index.d.ts +7 -7
- package/lib/sections/contentSearch/index.js +44 -44
- package/lib/sections/contentSearch/index.js.map +1 -1
- package/lib/sections/enums/index.d.ts +47 -45
- package/lib/sections/enums/index.js +50 -48
- package/lib/sections/enums/index.js.map +1 -1
- package/lib/sections/eventReporter/index.d.ts +10 -10
- package/lib/sections/eventReporter/index.js +628 -501
- package/lib/sections/eventReporter/index.js.map +1 -1
- package/lib/sections/eventReporter/utils.d.ts +9 -9
- package/lib/sections/eventReporter/utils.js +31 -29
- package/lib/sections/eventReporter/utils.js.map +1 -1
- package/lib/sections/fullTextSearch/index.d.ts +6 -6
- package/lib/sections/fullTextSearch/index.js +178 -171
- package/lib/sections/fullTextSearch/index.js.map +1 -1
- package/lib/sections/fullTextSearch/utils.d.ts +17 -17
- package/lib/sections/fullTextSearch/utils.js +185 -177
- package/lib/sections/fullTextSearch/utils.js.map +1 -1
- package/lib/sections/index.d.ts +3 -3
- package/lib/sections/index.js +432 -342
- package/lib/sections/index.js.map +1 -1
- package/lib/sections/initialization/index.d.ts +8 -8
- package/lib/sections/initialization/index.js +150 -150
- package/lib/sections/initialization/index.js.map +1 -1
- package/lib/sections/initialization/utils.d.ts +11 -11
- package/lib/sections/initialization/utils.js +200 -196
- package/lib/sections/initialization/utils.js.map +1 -1
- package/lib/sections/instantSearch/index.d.ts +6 -6
- package/lib/sections/instantSearch/index.js +66 -66
- package/lib/sections/instantSearch/index.js.map +1 -1
- package/lib/sections/instantSearch/utils.d.ts +21 -21
- package/lib/sections/instantSearch/utils.js +232 -232
- package/lib/sections/instantSearch/utils.js.map +1 -1
- package/lib/sections/landingPage/index.d.ts +6 -6
- package/lib/sections/landingPage/index.js +95 -95
- package/lib/sections/landingPage/index.js.map +1 -1
- package/lib/sections/landingPage/utils.d.ts +14 -14
- package/lib/sections/landingPage/utils.js +96 -90
- package/lib/sections/landingPage/utils.js.map +1 -1
- package/lib/sections/lookAlikeProductRecommendation/index.d.ts +6 -6
- package/lib/sections/lookAlikeProductRecommendation/index.js +23 -23
- package/lib/sections/recommendations/index.d.ts +10 -6
- package/lib/sections/recommendations/index.js +95 -48
- package/lib/sections/recommendations/index.js.map +1 -1
- package/lib/sections/recommendations/utils.d.ts +6 -7
- package/lib/sections/recommendations/utils.js +82 -91
- package/lib/sections/recommendations/utils.js.map +1 -1
- package/lib/sections/smartCollections/index.d.ts +6 -6
- package/lib/sections/smartCollections/index.js +169 -163
- package/lib/sections/smartCollections/index.js.map +1 -1
- package/lib/sections/smartCollections/utils.d.ts +41 -40
- package/lib/sections/smartCollections/utils.js +286 -269
- package/lib/sections/smartCollections/utils.js.map +1 -1
- package/lib/sections/visualDiscovery/index.d.ts +22 -0
- package/lib/sections/visualDiscovery/index.js +262 -0
- package/lib/sections/visualDiscovery/index.js.map +1 -0
- package/lib/services/autocomplete.d.ts +24 -24
- package/lib/services/autocomplete.js +50 -50
- package/lib/services/common.d.ts +35 -35
- package/lib/services/common.js +94 -94
- package/lib/services/content.d.ts +4 -4
- package/lib/services/content.js +25 -25
- package/lib/services/fullTextSearch.d.ts +4 -4
- package/lib/services/fullTextSearch.js +87 -84
- package/lib/services/fullTextSearch.js.map +1 -1
- package/lib/services/landingPage.d.ts +21 -21
- package/lib/services/landingPage.js +44 -44
- package/lib/services/lookAlikeProductRecommendation.d.ts +13 -13
- package/lib/services/lookAlikeProductRecommendation.js +23 -23
- package/lib/services/related.d.ts +48 -29
- package/lib/services/related.js +114 -72
- package/lib/services/related.js.map +1 -1
- package/lib/services/reporting.d.ts +80 -68
- package/lib/services/reporting.js +258 -208
- package/lib/services/reporting.js.map +1 -1
- package/lib/services/smartCollections.d.ts +5 -5
- package/lib/services/smartCollections.js +93 -82
- package/lib/services/smartCollections.js.map +1 -1
- package/lib/services/utils.d.ts +5 -5
- package/lib/services/utils.js +25 -25
- package/lib/services/utils.js.map +1 -1
- package/lib/services/visualDiscovery.d.ts +9 -0
- package/lib/services/visualDiscovery.js +167 -0
- package/lib/services/visualDiscovery.js.map +1 -0
- package/lib/utils/ABTesting.d.ts +2 -1
- package/lib/utils/ABTesting.js +27 -14
- package/lib/utils/ABTesting.js.map +1 -1
- package/lib/utils/API.d.ts +19 -19
- package/lib/utils/API.js +81 -81
- package/lib/utils/API.js.map +1 -1
- package/lib/utils/ArrayUtils.d.ts +2 -2
- package/lib/utils/ArrayUtils.js +16 -17
- package/lib/utils/ArrayUtils.js.map +1 -1
- package/lib/utils/bindingBoxes.d.ts +23 -0
- package/lib/utils/bindingBoxes.js +89 -0
- package/lib/utils/bindingBoxes.js.map +1 -0
- package/lib/utils/cookies.d.ts +13 -13
- package/lib/utils/cookies.js +50 -50
- package/lib/utils/debug.d.ts +4 -4
- package/lib/utils/debug.js +31 -31
- package/lib/utils/debug.js.map +1 -1
- package/lib/utils/duplicationsHandler.d.ts +19 -0
- package/lib/utils/duplicationsHandler.js +70 -0
- package/lib/utils/duplicationsHandler.js.map +1 -0
- package/lib/utils/filtersPersonalization.d.ts +3 -3
- package/lib/utils/filtersPersonalization.js +39 -39
- package/lib/utils/filtersPersonalization.js.map +1 -1
- package/lib/utils/image.d.ts +6 -0
- package/lib/utils/image.js +154 -0
- package/lib/utils/image.js.map +1 -0
- package/lib/utils/klaviyo.js +1 -1
- package/lib/utils/location.d.ts +1 -1
- package/lib/utils/location.js +11 -11
- package/lib/utils/location.js.map +1 -1
- package/lib/utils/mappingUtil.d.ts +4 -4
- package/lib/utils/mappingUtil.js +16 -16
- package/lib/utils/options.d.ts +23 -23
- package/lib/utils/options.js +16 -16
- package/lib/utils/personalization.d.ts +2 -0
- package/lib/utils/personalization.js +21 -0
- package/lib/utils/personalization.js.map +1 -0
- package/lib/utils/segments.d.ts +2 -2
- package/lib/utils/segments.js +19 -20
- package/lib/utils/segments.js.map +1 -1
- package/lib/utils/shopifyMarkets.d.ts +3 -3
- package/lib/utils/shopifyMarkets.js +12 -12
- package/lib/utils/sortUtil.d.ts +1 -0
- package/lib/utils/sortUtil.js +25 -0
- package/lib/utils/sortUtil.js.map +1 -0
- package/lib/utils/updateRecentSearches.d.ts +2 -1
- package/lib/utils/updateRecentSearches.js +56 -26
- package/lib/utils/updateRecentSearches.js.map +1 -1
- package/lib/utils/validation.d.ts +5 -5
- package/lib/utils/validation.js +46 -46
- package/lib/utils/validation.js.map +1 -1
- package/package.json +3 -2
|
@@ -1,164 +1,170 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
25
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
26
|
-
if (ar || !(i in from)) {
|
|
27
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
28
|
-
ar[i] = from[i];
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
32
|
-
};
|
|
33
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
-
exports.smartCollections = void 0;
|
|
35
|
-
var utils_1 = require("./utils");
|
|
36
|
-
var smartCollections_1 = require("../../services/smartCollections");
|
|
37
|
-
var
|
|
38
|
-
var
|
|
39
|
-
var smartCollections = function (_a) {
|
|
40
|
-
var _b, _c, _d, _e;
|
|
41
|
-
var props = __rest(_a, []);
|
|
42
|
-
var _f = props.self.data, uuid = _f.uuid, storeID = _f.storeID, cdnKey = _f.cdnKey, sessionToken = _f.sessionToken, userToken = _f.userToken;
|
|
43
|
-
var hasShopifyMarkets = ((_b = props.self.data.dashboard) === null || _b === void 0 ? void 0 : _b.has_shopify_markets) || false;
|
|
44
|
-
var companyLocationContext = (hasShopifyMarkets && (window === null || window === void 0 ? void 0 : window.__FAST_CUSTOMER_DETAILS)) ? (_c = window.__FAST_CUSTOMER_DETAILS) === null || _c === void 0 ? void 0 : _c.customer_current_location : undefined;
|
|
45
|
-
var categoryID = props.categoryID, narrowBy = props.narrowBy, _g = props.page, page = _g === void 0 ? 1 : _g, productsPerPage = props.productsPerPage, _h = props.facets, facets = _h === void 0 ? true : _h, _j = props.withAttributes, withAttributes = _j === void 0 ? false : _j, searchWithinSearch = props.searchWithinSearch, segments = props.segments;
|
|
46
|
-
var sortBy = (0, fullTextSearch_1.isSortBy)(props.sortBy) ? props.sortBy : undefined;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
result
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
25
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
26
|
+
if (ar || !(i in from)) {
|
|
27
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
28
|
+
ar[i] = from[i];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
32
|
+
};
|
|
33
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
+
exports.smartCollections = void 0;
|
|
35
|
+
var utils_1 = require("./utils");
|
|
36
|
+
var smartCollections_1 = require("../../services/smartCollections");
|
|
37
|
+
var fullTextSearch_1 = require("../../models/fullTextSearch");
|
|
38
|
+
var updateRecentSearches_1 = require("../../utils/updateRecentSearches");
|
|
39
|
+
var smartCollections = function (_a) {
|
|
40
|
+
var _b, _c, _d, _e;
|
|
41
|
+
var props = __rest(_a, []);
|
|
42
|
+
var _f = props.self.data, uuid = _f.uuid, storeID = _f.storeID, cdnKey = _f.cdnKey, sessionToken = _f.sessionToken, userToken = _f.userToken;
|
|
43
|
+
var hasShopifyMarkets = ((_b = props.self.data.dashboard) === null || _b === void 0 ? void 0 : _b.has_shopify_markets) || false;
|
|
44
|
+
var companyLocationContext = (hasShopifyMarkets && (window === null || window === void 0 ? void 0 : window.__FAST_CUSTOMER_DETAILS)) ? (_c = window.__FAST_CUSTOMER_DETAILS) === null || _c === void 0 ? void 0 : _c.customer_current_location : undefined;
|
|
45
|
+
var categoryID = props.categoryID, narrowBy = props.narrowBy, _g = props.page, page = _g === void 0 ? 1 : _g, productsPerPage = props.productsPerPage, _h = props.facets, facets = _h === void 0 ? true : _h, _j = props.withAttributes, withAttributes = _j === void 0 ? false : _j, searchWithinSearch = props.searchWithinSearch, segments = props.segments;
|
|
46
|
+
var sortBy = (0, fullTextSearch_1.isSortBy)(props.sortBy) ? props.sortBy : undefined;
|
|
47
|
+
props.self.fsGridCurrentResponse.status = 'loading';
|
|
48
|
+
var params = {
|
|
49
|
+
cdn: cdnKey,
|
|
50
|
+
uuid: uuid,
|
|
51
|
+
storeID: storeID,
|
|
52
|
+
categoryID: categoryID,
|
|
53
|
+
sortBy: sortBy,
|
|
54
|
+
productsPerPage: productsPerPage,
|
|
55
|
+
searchWithinSearch: searchWithinSearch,
|
|
56
|
+
page: page,
|
|
57
|
+
narrowBy: narrowBy,
|
|
58
|
+
withAttributes: withAttributes,
|
|
59
|
+
recent: (0, updateRecentSearches_1.getRecentProducts)().join(","),
|
|
60
|
+
segments: segments,
|
|
61
|
+
companyLocationContext: companyLocationContext,
|
|
62
|
+
withProductTypes: props.withProductTypes,
|
|
63
|
+
disableMerchandising: props.disableMerchandising,
|
|
64
|
+
disableStrategies: props.disableStrategies,
|
|
65
|
+
disableMerchandisingRules: props.disableMerchandisingRules,
|
|
66
|
+
disableTurbolinks: props.disableTurbolinks
|
|
67
|
+
};
|
|
68
|
+
var filterData = facets && props.self.temp.smartCollections.facets && __spreadArray([], props.self.temp.smartCollections.facets, true);
|
|
69
|
+
var isFacetNeeded = (0, utils_1.facetNeeded)({ self: props.self, newNarrow: narrowBy, newPage: page, newCategoryID: categoryID });
|
|
70
|
+
(0, utils_1.emptyResults)(props.self, categoryID);
|
|
71
|
+
if (!isFacetNeeded || !facets) {
|
|
72
|
+
smartCollections_1.SmartCollections.getSmartCollections(__assign(__assign({}, params), { facetRequired: 0, sessionStart: sessionToken.start, userToken: userToken, abTestingVariations: props.self.data.abTestingVariations, hasShopifyMarkets: hasShopifyMarkets, isPersonalizedFiltersActive: ((_d = props.self.data.dashboard) === null || _d === void 0 ? void 0 : _d.is_personalized_filter) || false, collectionPersonalization: props.self.data.collectionsPersonalization })).then(function (data) {
|
|
73
|
+
props.self.fsGridCurrentResponse.data = data;
|
|
74
|
+
props.self.fsGridCurrentResponse.status = 'done';
|
|
75
|
+
var result = (0, utils_1.getData)(props.self, data);
|
|
76
|
+
if (props.infiniteScrollPage && props.productsPerPage) {
|
|
77
|
+
result.pageCount = Math.ceil(result.totalResults / (props.productsPerPage / props.infiniteScrollPage));
|
|
78
|
+
}
|
|
79
|
+
if (filterData) {
|
|
80
|
+
result.facets = filterData;
|
|
81
|
+
}
|
|
82
|
+
(0, utils_1.handleSmartCollection)({
|
|
83
|
+
event: filterData ? "facets and products" : "products",
|
|
84
|
+
callback: props.callback,
|
|
85
|
+
self: props.self,
|
|
86
|
+
personalized: data.use_personalized_collection,
|
|
87
|
+
time: data.personalization_recency_limit,
|
|
88
|
+
isNoResults: data.pop_products_no_results,
|
|
89
|
+
page: page,
|
|
90
|
+
sortBy: sortBy,
|
|
91
|
+
narrow: narrowBy,
|
|
92
|
+
result: result,
|
|
93
|
+
inventoryCallback: props.inventoryCallback,
|
|
94
|
+
access_token: props.access_token,
|
|
95
|
+
shop_url: props.shop_url,
|
|
96
|
+
onProductsLoaded: props.onProductsLoaded,
|
|
97
|
+
onFacetsLoaded: props.onFacetsLoaded,
|
|
98
|
+
callbackType: "products"
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
smartCollections_1.SmartCollections.getSmartCollections(__assign(__assign({}, params), { facetRequired: 1, sessionStart: sessionToken.start, userToken: userToken, abTestingVariations: props.self.data.abTestingVariations, hasShopifyMarkets: hasShopifyMarkets, isPersonalizedFiltersActive: ((_e = props.self.data.dashboard) === null || _e === void 0 ? void 0 : _e.is_personalized_filter) || false, collectionPersonalization: props.self.data.collectionsPersonalization })).then(function (data) {
|
|
104
|
+
var _a;
|
|
105
|
+
props.self.fsGridCurrentResponse.data = data;
|
|
106
|
+
props.self.fsGridCurrentResponse.status = 'done';
|
|
107
|
+
var result = (0, utils_1.getData)(props.self, data);
|
|
108
|
+
if (props.infiniteScrollPage && props.productsPerPage) {
|
|
109
|
+
result.pageCount = Math.ceil(result.totalResults / (props.productsPerPage / props.infiniteScrollPage));
|
|
110
|
+
}
|
|
111
|
+
if (data.facets_completed || data.pop_products_no_results) {
|
|
112
|
+
result.facets = data.facets;
|
|
113
|
+
(0, utils_1.handleSmartCollection)({
|
|
114
|
+
event: "facets and products",
|
|
115
|
+
callback: props.callback,
|
|
116
|
+
self: props.self,
|
|
117
|
+
personalized: data.use_personalized_collection,
|
|
118
|
+
time: data.personalization_recency_limit,
|
|
119
|
+
isNoResults: data.pop_products_no_results,
|
|
120
|
+
page: page,
|
|
121
|
+
sortBy: sortBy,
|
|
122
|
+
narrow: narrowBy,
|
|
123
|
+
result: result,
|
|
124
|
+
inventoryCallback: props.inventoryCallback,
|
|
125
|
+
access_token: props.access_token,
|
|
126
|
+
shop_url: props.shop_url,
|
|
127
|
+
onProductsLoaded: props.onProductsLoaded,
|
|
128
|
+
onFacetsLoaded: props.onFacetsLoaded,
|
|
129
|
+
callbackType: "facets and products"
|
|
130
|
+
});
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
(0, utils_1.handleSmartCollection)({
|
|
134
|
+
event: "products",
|
|
135
|
+
callback: props.callback,
|
|
136
|
+
self: props.self,
|
|
137
|
+
personalized: data.use_personalized_collection,
|
|
138
|
+
time: data.personalization_recency_limit,
|
|
139
|
+
page: page,
|
|
140
|
+
sortBy: sortBy,
|
|
141
|
+
narrow: narrowBy,
|
|
142
|
+
result: result,
|
|
143
|
+
onProductsLoaded: props.onProductsLoaded,
|
|
144
|
+
onFacetsLoaded: props.onFacetsLoaded,
|
|
145
|
+
callbackType: "products"
|
|
146
|
+
});
|
|
147
|
+
smartCollections_1.SmartCollections.getSmartCollections(__assign(__assign({}, params), { facetRequired: 2, sessionStart: sessionToken.start, userToken: userToken, abTestingVariations: props.self.data.abTestingVariations, hasShopifyMarkets: hasShopifyMarkets, isPersonalizedFiltersActive: ((_a = props.self.data.dashboard) === null || _a === void 0 ? void 0 : _a.is_personalized_filter) || false, collectionPersonalization: props.self.data.collectionsPersonalization })).then(function (data) {
|
|
148
|
+
result.facets = data.facets;
|
|
149
|
+
(0, utils_1.handleSmartCollection)({
|
|
150
|
+
event: "facets and products",
|
|
151
|
+
callback: props.callback,
|
|
152
|
+
self: props.self,
|
|
153
|
+
personalized: data.use_personalized_collection,
|
|
154
|
+
page: page,
|
|
155
|
+
sortBy: sortBy,
|
|
156
|
+
narrow: narrowBy,
|
|
157
|
+
result: result,
|
|
158
|
+
inventoryCallback: props.inventoryCallback,
|
|
159
|
+
access_token: props.access_token,
|
|
160
|
+
shop_url: props.shop_url,
|
|
161
|
+
onProductsLoaded: props.onProductsLoaded,
|
|
162
|
+
onFacetsLoaded: props.onFacetsLoaded,
|
|
163
|
+
callbackType: "facets"
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
exports.smartCollections = smartCollections;
|
|
164
170
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/sections/smartCollections/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iCAAkF;AAClF,oEAAiE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/sections/smartCollections/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iCAAkF;AAClF,oEAAiE;AAEjE,8DAAqD;AACrD,yEAAqE;AAM9D,IAAM,gBAAgB,GAAG,UAAC,EAAiB;;QAAb,KAAK,cAAT,EAAU,CAAD;IAChC,IAAA,KAAmD,KAAK,CAAC,IAAI,CAAC,IAAI,EAAjE,IAAI,UAAA,EAAE,OAAO,aA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IAAI,EAAE,KAAK,CAAC,IAAI;oBAChB,YAAY,EAAE,IAAI,CAAC,2BAA2B;oBAC9C,IAAI,MAAA;oBAAE,MAAM,QAAA;oBAAE,MAAM,EAAE,QAAQ;oBAC9B,MAAM,QAAA;oBACN,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;oBAC1C,YAAY,EAAE,KAAK,CAAC,YAAY;oBAChC,QAAQ,EAAE,KAAK,CAAC,QAAQ;oBACxB,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;oBACxC,cAAc,EAAE,KAAK,CAAC,cAAc;oBACpC,YAAY,EAAE,QAAQ;iBACzB,CAAC,CAAA;YACN,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;AACL,CAAC,CAAC;AA5JW,QAAA,gBAAgB,oBA4J3B"}
|
|
@@ -1,40 +1,41 @@
|
|
|
1
|
-
import { SDKUtils } from "../../models/common";
|
|
2
|
-
import { RecentSmartCollectionProduct, smartCollectionsCallback, SmartCollectionsResponse, smartCollectionsResults } from "../../models/smartCollections";
|
|
3
|
-
import { Narrow, Product, SortBy } from "../../models/fullTextSearch";
|
|
4
|
-
import { inventoryCallback } from "../../models/productsInventory";
|
|
5
|
-
export declare const emptyResults: (self: SDKUtils, categoryID: string) => void;
|
|
6
|
-
export declare const setInfiniteScroll: (self: SDKUtils, infiniteCount?: number, productsPerPage?: number) => void;
|
|
7
|
-
export declare const getData: (self: SDKUtils, response: SmartCollectionsResponse) => smartCollectionsResults;
|
|
8
|
-
interface HandleSmartCollectionProps {
|
|
9
|
-
self: SDKUtils;
|
|
10
|
-
personalized: boolean;
|
|
11
|
-
callback: smartCollectionsCallback;
|
|
12
|
-
event: "products" | "facets and products";
|
|
13
|
-
time?: number;
|
|
14
|
-
isNoResults?: boolean;
|
|
15
|
-
page: number;
|
|
16
|
-
narrow?: Narrow[];
|
|
17
|
-
sortBy?: SortBy;
|
|
18
|
-
result: smartCollectionsResults;
|
|
19
|
-
inventoryCallback?: inventoryCallback;
|
|
20
|
-
access_token?: string;
|
|
21
|
-
shop_url?: string;
|
|
22
|
-
onProductsLoaded?: smartCollectionsCallback;
|
|
23
|
-
onFacetsLoaded?: smartCollectionsCallback;
|
|
24
|
-
callbackType?: "products" | "facets and products" | "facets";
|
|
25
|
-
}
|
|
26
|
-
export declare const handleSmartCollection: ({ event, callback, self, personalized, time, isNoResults, page, sortBy, narrow, result, inventoryCallback, access_token, shop_url, onProductsLoaded, onFacetsLoaded, callbackType }: HandleSmartCollectionProps) => void;
|
|
27
|
-
export declare const getPersonalizedProducts: (self: SDKUtils, recent: Product[], products: Product[]) => Product[];
|
|
28
|
-
export declare const getCollectionName: (self: SDKUtils, id: string) => string;
|
|
29
|
-
export declare const getRecentCollectionProducts: () => RecentSmartCollectionProduct[];
|
|
30
|
-
export declare const updateRecentCollectionProducts: (productID: string, categoryID: string) => void;
|
|
31
|
-
export declare const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
export declare const
|
|
39
|
-
export declare const
|
|
40
|
-
export
|
|
1
|
+
import { SDKUtils } from "../../models/common";
|
|
2
|
+
import { RecentSmartCollectionProduct, smartCollectionsCallback, SmartCollectionsResponse, smartCollectionsResults } from "../../models/smartCollections";
|
|
3
|
+
import { Narrow, Product, SortBy } from "../../models/fullTextSearch";
|
|
4
|
+
import { inventoryCallback } from "../../models/productsInventory";
|
|
5
|
+
export declare const emptyResults: (self: SDKUtils, categoryID: string) => void;
|
|
6
|
+
export declare const setInfiniteScroll: (self: SDKUtils, infiniteCount?: number, productsPerPage?: number) => void;
|
|
7
|
+
export declare const getData: (self: SDKUtils, response: SmartCollectionsResponse) => smartCollectionsResults;
|
|
8
|
+
interface HandleSmartCollectionProps {
|
|
9
|
+
self: SDKUtils;
|
|
10
|
+
personalized: boolean;
|
|
11
|
+
callback: smartCollectionsCallback;
|
|
12
|
+
event: "products" | "facets and products";
|
|
13
|
+
time?: number;
|
|
14
|
+
isNoResults?: boolean;
|
|
15
|
+
page: number;
|
|
16
|
+
narrow?: Narrow[];
|
|
17
|
+
sortBy?: SortBy;
|
|
18
|
+
result: smartCollectionsResults;
|
|
19
|
+
inventoryCallback?: inventoryCallback;
|
|
20
|
+
access_token?: string;
|
|
21
|
+
shop_url?: string;
|
|
22
|
+
onProductsLoaded?: smartCollectionsCallback;
|
|
23
|
+
onFacetsLoaded?: smartCollectionsCallback;
|
|
24
|
+
callbackType?: "products" | "facets and products" | "facets";
|
|
25
|
+
}
|
|
26
|
+
export declare const handleSmartCollection: ({ event, callback, self, personalized, time, isNoResults, page, sortBy, narrow, result, inventoryCallback, access_token, shop_url, onProductsLoaded, onFacetsLoaded, callbackType }: HandleSmartCollectionProps) => void;
|
|
27
|
+
export declare const getPersonalizedProducts: (self: SDKUtils, recent: Product[], products: Product[]) => Product[];
|
|
28
|
+
export declare const getCollectionName: (self: SDKUtils, id: string) => string;
|
|
29
|
+
export declare const getRecentCollectionProducts: () => RecentSmartCollectionProduct[];
|
|
30
|
+
export declare const updateRecentCollectionProducts: (productID: string, categoryID: string) => void;
|
|
31
|
+
export declare const savePersonalizedProductsFromCollectionResponse: (data: number[]) => string;
|
|
32
|
+
export declare const facetNeeded: ({ self, newNarrow, newPage, newCategoryID }: {
|
|
33
|
+
self: SDKUtils;
|
|
34
|
+
newNarrow?: Narrow[];
|
|
35
|
+
newPage: number;
|
|
36
|
+
newCategoryID: string;
|
|
37
|
+
}) => boolean;
|
|
38
|
+
export declare const isRecommendedProduct: (productId: string) => boolean;
|
|
39
|
+
export declare const handleProductFacetsCallbacks: (result: smartCollectionsResults, action: "products" | "facets", onProductsLoaded?: smartCollectionsCallback, onFacetsLoaded?: smartCollectionsCallback) => void;
|
|
40
|
+
export declare const hasProductFacetsCallbacks: (onProductsLoaded?: smartCollectionsCallback, onFacetsLoaded?: smartCollectionsCallback) => boolean;
|
|
41
|
+
export {};
|