fast-simon-sdk 1.6.8 → 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 -25
- package/lib/config.js +30 -30
- package/lib/index.d.ts +3 -3
- package/lib/index.js +72 -72
- package/lib/index.js.map +1 -1
- package/lib/models/autocomplete.d.ts +73 -73
- package/lib/models/autocomplete.js +2 -2
- package/lib/models/common.d.ts +267 -267
- package/lib/models/common.js +65 -65
- 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 -113
- 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 -130
- 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 -94
- package/lib/models/smartCollections.js +2 -2
- package/lib/models/visualDiscovery.d.ts +129 -129
- package/lib/models/visualDiscovery.js +30 -30
- package/lib/models/visualDiscovery.js.map +1 -1
- 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 -47
- package/lib/sections/enums/index.js +50 -50
- package/lib/sections/eventReporter/index.d.ts +10 -10
- package/lib/sections/eventReporter/index.js +628 -628
- 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 -31
- 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 -178
- 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 -181
- package/lib/sections/fullTextSearch/utils.js.map +1 -1
- package/lib/sections/index.d.ts +3 -3
- package/lib/sections/index.js +432 -434
- 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 -200
- 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 -96
- 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 -10
- package/lib/sections/recommendations/index.js +95 -95
- package/lib/sections/recommendations/index.js.map +1 -1
- package/lib/sections/recommendations/utils.d.ts +6 -6
- package/lib/sections/recommendations/utils.js +82 -82
- 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 -169
- package/lib/sections/smartCollections/index.js.map +1 -1
- package/lib/sections/smartCollections/utils.d.ts +41 -41
- package/lib/sections/smartCollections/utils.js +286 -281
- package/lib/sections/smartCollections/utils.js.map +1 -1
- package/lib/sections/visualDiscovery/index.d.ts +22 -22
- package/lib/sections/visualDiscovery/index.js +261 -265
- package/lib/sections/visualDiscovery/index.js.map +1 -1
- 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 -87
- 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 -48
- package/lib/services/related.js +114 -114
- package/lib/services/related.js.map +1 -1
- package/lib/services/reporting.d.ts +80 -80
- package/lib/services/reporting.js +258 -258
- package/lib/services/reporting.js.map +1 -1
- package/lib/services/smartCollections.d.ts +5 -5
- package/lib/services/smartCollections.js +93 -93
- 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 -9
- package/lib/services/visualDiscovery.js +166 -170
- package/lib/services/visualDiscovery.js.map +1 -1
- package/lib/utils/ABTesting.d.ts +2 -2
- package/lib/utils/ABTesting.js +27 -28
- 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 -23
- package/lib/utils/bindingBoxes.js +88 -89
- package/lib/utils/bindingBoxes.js.map +1 -1
- 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 -6
- package/lib/utils/image.js +153 -153
- package/lib/utils/image.js.map +1 -1
- 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 -2
- package/lib/utils/personalization.js +20 -20
- package/lib/utils/personalization.js.map +1 -1
- 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 -1
- package/lib/utils/sortUtil.js +24 -24
- package/lib/utils/sortUtil.js.map +1 -1
- package/lib/utils/updateRecentSearches.d.ts +2 -2
- package/lib/utils/updateRecentSearches.js +56 -57
- 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
package/lib/utils/location.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = getUserLocation;
|
|
4
|
+
var LS_KEY = "isp_location_";
|
|
5
|
+
function getUserLocation(uuid) {
|
|
6
|
+
var key = LS_KEY + uuid;
|
|
7
|
+
if (key in localStorage) {
|
|
8
|
+
return localStorage.getItem(key);
|
|
9
|
+
}
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
12
|
//# sourceMappingURL=location.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"location.js","sourceRoot":"","sources":["../../src/utils/location.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"location.js","sourceRoot":"","sources":["../../src/utils/location.ts"],"names":[],"mappings":";;AAEA,kCAMC;AARD,IAAM,MAAM,GAAG,eAAe,CAAC;AAE/B,SAAwB,eAAe,CAAC,IAAY;IAChD,IAAI,GAAG,GAAG,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,GAAG,IAAI,YAAY,EAAE,CAAC;QACtB,OAAO,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PopularSearch } from "../models/autocomplete";
|
|
2
|
-
export declare class MappingUtil {
|
|
3
|
-
static convertToPopularSearchesResponse(strings: string[]): PopularSearch[];
|
|
4
|
-
}
|
|
1
|
+
import { PopularSearch } from "../models/autocomplete";
|
|
2
|
+
export declare class MappingUtil {
|
|
3
|
+
static convertToPopularSearchesResponse(strings: string[]): PopularSearch[];
|
|
4
|
+
}
|
package/lib/utils/mappingUtil.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MappingUtil = void 0;
|
|
4
|
-
var MappingUtil = /** @class */ (function () {
|
|
5
|
-
function MappingUtil() {
|
|
6
|
-
}
|
|
7
|
-
MappingUtil.convertToPopularSearchesResponse = function (strings) {
|
|
8
|
-
var items = strings.map(function (str) { return ({
|
|
9
|
-
label: str,
|
|
10
|
-
type: 'p' // Assuming 'p' is a constant type for all items
|
|
11
|
-
}); });
|
|
12
|
-
return items;
|
|
13
|
-
};
|
|
14
|
-
return MappingUtil;
|
|
15
|
-
}());
|
|
16
|
-
exports.MappingUtil = MappingUtil;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MappingUtil = void 0;
|
|
4
|
+
var MappingUtil = /** @class */ (function () {
|
|
5
|
+
function MappingUtil() {
|
|
6
|
+
}
|
|
7
|
+
MappingUtil.convertToPopularSearchesResponse = function (strings) {
|
|
8
|
+
var items = strings.map(function (str) { return ({
|
|
9
|
+
label: str,
|
|
10
|
+
type: 'p' // Assuming 'p' is a constant type for all items
|
|
11
|
+
}); });
|
|
12
|
+
return items;
|
|
13
|
+
};
|
|
14
|
+
return MappingUtil;
|
|
15
|
+
}());
|
|
16
|
+
exports.MappingUtil = MappingUtil;
|
|
17
17
|
//# sourceMappingURL=mappingUtil.js.map
|
package/lib/utils/options.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
interface SDKOptionsProps {
|
|
2
|
-
ab_test_disable_merchandising?: boolean;
|
|
3
|
-
ab_test_disable_merchandising_strategies?: boolean;
|
|
4
|
-
ab_test_disable_merchandising_rules?: boolean;
|
|
5
|
-
ab_test_disable_semantics?: boolean;
|
|
6
|
-
ab_test_disable_search_personalization?: boolean;
|
|
7
|
-
ab_test_disable_collection_personalization?: boolean;
|
|
8
|
-
ab_test_disable_recommendations_personalization?: boolean;
|
|
9
|
-
reasoning?: string;
|
|
10
|
-
autocomplete_preview?: boolean;
|
|
11
|
-
show_popular_on_hover?: boolean;
|
|
12
|
-
merchandising_rules?: any[];
|
|
13
|
-
strategy: any;
|
|
14
|
-
disable_merchandising?: boolean;
|
|
15
|
-
disable_merchandising_rules?: boolean;
|
|
16
|
-
disable_strategies?: boolean;
|
|
17
|
-
request_serial_number?: number;
|
|
18
|
-
related_search?: number;
|
|
19
|
-
}
|
|
20
|
-
export declare const getSDKABTestingOptionExist: (flag: keyof SDKOptionsProps) => 1 | undefined;
|
|
21
|
-
export declare const getSDKABTestingOption: (flag: keyof SDKOptionsProps) => string | undefined;
|
|
22
|
-
export declare const getReasoningVectorSearch: () => boolean;
|
|
23
|
-
export {};
|
|
1
|
+
interface SDKOptionsProps {
|
|
2
|
+
ab_test_disable_merchandising?: boolean;
|
|
3
|
+
ab_test_disable_merchandising_strategies?: boolean;
|
|
4
|
+
ab_test_disable_merchandising_rules?: boolean;
|
|
5
|
+
ab_test_disable_semantics?: boolean;
|
|
6
|
+
ab_test_disable_search_personalization?: boolean;
|
|
7
|
+
ab_test_disable_collection_personalization?: boolean;
|
|
8
|
+
ab_test_disable_recommendations_personalization?: boolean;
|
|
9
|
+
reasoning?: string;
|
|
10
|
+
autocomplete_preview?: boolean;
|
|
11
|
+
show_popular_on_hover?: boolean;
|
|
12
|
+
merchandising_rules?: any[];
|
|
13
|
+
strategy: any;
|
|
14
|
+
disable_merchandising?: boolean;
|
|
15
|
+
disable_merchandising_rules?: boolean;
|
|
16
|
+
disable_strategies?: boolean;
|
|
17
|
+
request_serial_number?: number;
|
|
18
|
+
related_search?: number;
|
|
19
|
+
}
|
|
20
|
+
export declare const getSDKABTestingOptionExist: (flag: keyof SDKOptionsProps) => 1 | undefined;
|
|
21
|
+
export declare const getSDKABTestingOption: (flag: keyof SDKOptionsProps) => string | undefined;
|
|
22
|
+
export declare const getReasoningVectorSearch: () => boolean;
|
|
23
|
+
export {};
|
package/lib/utils/options.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getReasoningVectorSearch = exports.getSDKABTestingOption = exports.getSDKABTestingOptionExist = void 0;
|
|
4
|
-
// old backend expects 1 / undefined instead of a plane boolean
|
|
5
|
-
var getSDKABTestingOptionExist = function (flag) {
|
|
6
|
-
return "fastSDKOptions" in window && window.fastSDKOptions[flag] ? 1 : undefined;
|
|
7
|
-
};
|
|
8
|
-
exports.getSDKABTestingOptionExist = getSDKABTestingOptionExist;
|
|
9
|
-
var getSDKABTestingOption = function (flag) {
|
|
10
|
-
return "fastSDKOptions" in window && typeof window.fastSDKOptions[flag] !== "undefined" ? window.fastSDKOptions[flag] : undefined;
|
|
11
|
-
};
|
|
12
|
-
exports.getSDKABTestingOption = getSDKABTestingOption;
|
|
13
|
-
var getReasoningVectorSearch = function () {
|
|
14
|
-
return localStorage.getItem("reasoning_vector_search") === "true";
|
|
15
|
-
};
|
|
16
|
-
exports.getReasoningVectorSearch = getReasoningVectorSearch;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getReasoningVectorSearch = exports.getSDKABTestingOption = exports.getSDKABTestingOptionExist = void 0;
|
|
4
|
+
// old backend expects 1 / undefined instead of a plane boolean
|
|
5
|
+
var getSDKABTestingOptionExist = function (flag) {
|
|
6
|
+
return "fastSDKOptions" in window && window.fastSDKOptions[flag] ? 1 : undefined;
|
|
7
|
+
};
|
|
8
|
+
exports.getSDKABTestingOptionExist = getSDKABTestingOptionExist;
|
|
9
|
+
var getSDKABTestingOption = function (flag) {
|
|
10
|
+
return "fastSDKOptions" in window && typeof window.fastSDKOptions[flag] !== "undefined" ? window.fastSDKOptions[flag] : undefined;
|
|
11
|
+
};
|
|
12
|
+
exports.getSDKABTestingOption = getSDKABTestingOption;
|
|
13
|
+
var getReasoningVectorSearch = function () {
|
|
14
|
+
return localStorage.getItem("reasoning_vector_search") === "true";
|
|
15
|
+
};
|
|
16
|
+
exports.getReasoningVectorSearch = getReasoningVectorSearch;
|
|
17
17
|
//# sourceMappingURL=options.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CollectionsPersonalization } from "../models/common";
|
|
2
|
-
export declare const isCollectionPersonalization: (categoryId: string, personalizationSettings?: CollectionsPersonalization) => boolean;
|
|
1
|
+
import { CollectionsPersonalization } from "../models/common";
|
|
2
|
+
export declare const isCollectionPersonalization: (categoryId: string, personalizationSettings?: CollectionsPersonalization) => boolean;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isCollectionPersonalization = void 0;
|
|
4
|
-
var isCollectionPersonalization = function (categoryId, personalizationSettings) {
|
|
5
|
-
var isPersonalization = true;
|
|
6
|
-
if (!personalizationSettings || (typeof (personalizationSettings === null || personalizationSettings === void 0 ? void 0 : personalizationSettings.active) === 'undefined')) {
|
|
7
|
-
isPersonalization = false;
|
|
8
|
-
}
|
|
9
|
-
else if (!personalizationSettings.active) {
|
|
10
|
-
isPersonalization = false;
|
|
11
|
-
}
|
|
12
|
-
else if (personalizationSettings.avoidCategories.includes(categoryId)) {
|
|
13
|
-
isPersonalization = false;
|
|
14
|
-
}
|
|
15
|
-
else if (personalizationSettings.disableCategories.includes(categoryId)) {
|
|
16
|
-
isPersonalization = false;
|
|
17
|
-
}
|
|
18
|
-
return isPersonalization;
|
|
19
|
-
};
|
|
20
|
-
exports.isCollectionPersonalization = isCollectionPersonalization;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isCollectionPersonalization = void 0;
|
|
4
|
+
var isCollectionPersonalization = function (categoryId, personalizationSettings) {
|
|
5
|
+
var isPersonalization = true;
|
|
6
|
+
if (!personalizationSettings || (typeof (personalizationSettings === null || personalizationSettings === void 0 ? void 0 : personalizationSettings.active) === 'undefined')) {
|
|
7
|
+
isPersonalization = false;
|
|
8
|
+
}
|
|
9
|
+
else if (!personalizationSettings.active) {
|
|
10
|
+
isPersonalization = false;
|
|
11
|
+
}
|
|
12
|
+
else if (personalizationSettings.avoidCategories.includes(categoryId)) {
|
|
13
|
+
isPersonalization = false;
|
|
14
|
+
}
|
|
15
|
+
else if (personalizationSettings.disableCategories.includes(categoryId)) {
|
|
16
|
+
isPersonalization = false;
|
|
17
|
+
}
|
|
18
|
+
return isPersonalization;
|
|
19
|
+
};
|
|
20
|
+
exports.isCollectionPersonalization = isCollectionPersonalization;
|
|
21
21
|
//# sourceMappingURL=personalization.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"personalization.js","sourceRoot":"","sources":["../../src/utils/personalization.ts"],"names":[],"mappings":";;;AAEO,IAAM,2BAA2B,GAAG,UAAC,UAAkB,EAAE,uBAAoD;IAChH,IAAI,iBAAiB,GAAG,IAAI,CAAC;IAC7B,IAAG,CAAC,uBAAuB,IAAI,CAAC,OAAO,CAAA,uBAAuB,aAAvB,uBAAuB,uBAAvB,uBAAuB,CAAE,MAAM,CAAA,KAAK,WAAW,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"personalization.js","sourceRoot":"","sources":["../../src/utils/personalization.ts"],"names":[],"mappings":";;;AAEO,IAAM,2BAA2B,GAAG,UAAC,UAAkB,EAAE,uBAAoD;IAChH,IAAI,iBAAiB,GAAG,IAAI,CAAC;IAC7B,IAAG,CAAC,uBAAuB,IAAI,CAAC,OAAO,CAAA,uBAAuB,aAAvB,uBAAuB,uBAAvB,uBAAuB,CAAE,MAAM,CAAA,KAAK,WAAW,CAAC,EAAE,CAAC;QACtF,iBAAiB,GAAG,KAAK,CAAC;IAC9B,CAAC;SAAM,IAAG,CAAC,uBAAuB,CAAC,MAAM,EAAE,CAAC;QACxC,iBAAiB,GAAG,KAAK,CAAC;IAC9B,CAAC;SAAM,IAAG,uBAAuB,CAAC,eAAe,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QACrE,iBAAiB,GAAG,KAAK,CAAC;IAC9B,CAAC;SAAM,IAAG,uBAAuB,CAAC,iBAAiB,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QACvE,iBAAiB,GAAG,KAAK,CAAC;IAC9B,CAAC;IACD,OAAO,iBAAiB,CAAC;AAC7B,CAAC,CAAA;AAZY,QAAA,2BAA2B,+BAYvC"}
|
package/lib/utils/segments.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function setServingSegments(segmentRes?: boolean): void;
|
|
2
|
-
export declare function getSegments(): string | null | undefined;
|
|
1
|
+
export declare function setServingSegments(segmentRes?: boolean): void;
|
|
2
|
+
export declare function getSegments(): string | null | undefined;
|
package/lib/utils/segments.js
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function getSegments() {
|
|
16
|
-
var _a, _b;
|
|
17
|
-
var segments = (_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.getItem(ISP_SEGMENTS_SERVING_KEY);
|
|
18
|
-
return segments ? (_b = window === null || window === void 0 ? void 0 : window.localStorage) === null || _b === void 0 ? void 0 : _b.getItem(LS_KEY) : undefined;
|
|
19
|
-
}
|
|
20
|
-
exports.getSegments = getSegments;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setServingSegments = setServingSegments;
|
|
4
|
+
exports.getSegments = getSegments;
|
|
5
|
+
var ISP_SEGMENTS_SERVING_KEY = 'ISP_SEGMENTS_SERVING_KEY';
|
|
6
|
+
var LS_KEY = "isp_token_1";
|
|
7
|
+
function setServingSegments(segmentRes) {
|
|
8
|
+
if (segmentRes) {
|
|
9
|
+
localStorage.setItem(ISP_SEGMENTS_SERVING_KEY, String(segmentRes));
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
localStorage.removeItem(ISP_SEGMENTS_SERVING_KEY);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function getSegments() {
|
|
16
|
+
var _a, _b;
|
|
17
|
+
var segments = (_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.getItem(ISP_SEGMENTS_SERVING_KEY);
|
|
18
|
+
return segments ? (_b = window === null || window === void 0 ? void 0 : window.localStorage) === null || _b === void 0 ? void 0 : _b.getItem(LS_KEY) : undefined;
|
|
19
|
+
}
|
|
21
20
|
//# sourceMappingURL=segments.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segments.js","sourceRoot":"","sources":["../../src/utils/segments.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"segments.js","sourceRoot":"","sources":["../../src/utils/segments.ts"],"names":[],"mappings":";;AAGA,gDAMC;AAED,kCAGC;AAdD,IAAM,wBAAwB,GAAG,0BAA0B,CAAC;AAC5D,IAAM,MAAM,GAAG,aAAa,CAAC;AAE7B,SAAgB,kBAAkB,CAAC,UAAoB;IACnD,IAAG,UAAU,EAAE,CAAC;QACZ,YAAY,CAAC,OAAO,CAAC,wBAAwB,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;IACvE,CAAC;SAAM,CAAC;QACJ,YAAY,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAC;IACtD,CAAC;AACL,CAAC;AAED,SAAgB,WAAW;;IACvB,IAAM,QAAQ,GAAG,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,YAAY,0CAAE,OAAO,CAAC,wBAAwB,CAAC,CAAC;IACzE,OAAO,QAAQ,CAAC,CAAC,CAAC,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,YAAY,0CAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACxE,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export default class ShopifyMarkets {
|
|
2
|
-
static getCountry(): any;
|
|
3
|
-
}
|
|
1
|
+
export default class ShopifyMarkets {
|
|
2
|
+
static getCountry(): any;
|
|
3
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var ShopifyMarkets = /** @class */ (function () {
|
|
4
|
-
function ShopifyMarkets() {
|
|
5
|
-
}
|
|
6
|
-
ShopifyMarkets.getCountry = function () {
|
|
7
|
-
var _a;
|
|
8
|
-
return (_a = window === null || window === void 0 ? void 0 : window.Shopify) === null || _a === void 0 ? void 0 : _a.country;
|
|
9
|
-
};
|
|
10
|
-
return ShopifyMarkets;
|
|
11
|
-
}());
|
|
12
|
-
exports.default = ShopifyMarkets;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var ShopifyMarkets = /** @class */ (function () {
|
|
4
|
+
function ShopifyMarkets() {
|
|
5
|
+
}
|
|
6
|
+
ShopifyMarkets.getCountry = function () {
|
|
7
|
+
var _a;
|
|
8
|
+
return (_a = window === null || window === void 0 ? void 0 : window.Shopify) === null || _a === void 0 ? void 0 : _a.country;
|
|
9
|
+
};
|
|
10
|
+
return ShopifyMarkets;
|
|
11
|
+
}());
|
|
12
|
+
exports.default = ShopifyMarkets;
|
|
13
13
|
//# sourceMappingURL=shopifyMarkets.js.map
|
package/lib/utils/sortUtil.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function isPersonalizationAllowedForSort(sort?: string): boolean;
|
|
1
|
+
export default function isPersonalizationAllowedForSort(sort?: string): boolean;
|
package/lib/utils/sortUtil.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = isPersonalizationAllowedForSort;
|
|
4
|
+
var NotAllowedSortByOptions = {
|
|
5
|
+
"price_min_to_max": true,
|
|
6
|
+
"price_max_to_min": true,
|
|
7
|
+
"reviews": true,
|
|
8
|
+
"a_to_z": true,
|
|
9
|
+
"z_to_a": true,
|
|
10
|
+
"discount_min_to_max": true,
|
|
11
|
+
"discount_max_to_min": true
|
|
12
|
+
};
|
|
13
|
+
function isPersonalizationAllowedForSort(sort) {
|
|
14
|
+
try {
|
|
15
|
+
if (sort === undefined) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
return !(Object.prototype.hasOwnProperty.call(NotAllowedSortByOptions, sort));
|
|
19
|
+
}
|
|
20
|
+
catch (e) {
|
|
21
|
+
console.log("%c\u274C V-Next Error | Cannot Find If There Is A Need To Use Personalization With The Selected Sort Option", 'font-weight: bold; font-size: 12px; color: red');
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
25
|
//# sourceMappingURL=sortUtil.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sortUtil.js","sourceRoot":"","sources":["../../src/utils/sortUtil.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"sortUtil.js","sourceRoot":"","sources":["../../src/utils/sortUtil.ts"],"names":[],"mappings":";;AAUA,kDAWC;AArBD,IAAM,uBAAuB,GAAG;IAC9B,kBAAkB,EAAE,IAAI;IACxB,kBAAkB,EAAE,IAAI;IACxB,SAAS,EAAE,IAAI;IACf,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,IAAI;IACd,qBAAqB,EAAE,IAAI;IAC3B,qBAAqB,EAAE,IAAI;CAC5B,CAAC;AAEF,SAAwB,+BAA+B,CAAC,IAAa;IACnE,IAAI,CAAC;QACH,IAAG,IAAI,KAAK,SAAS,EAAC,CAAC;YACrB,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,uBAAuB,EAAE,IAAI,CAAC,CAAC,CAAC;IAChF,CAAC;IACD,OAAO,CAAC,EAAE,CAAC;QACT,OAAO,CAAC,GAAG,CAAC,6GAAwG,EAAE,gDAAgD,CAAC,CAAC;QACxK,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export default function updateRecentSearches(params: object): void;
|
|
2
|
-
export declare function getRecentProducts(): string[];
|
|
1
|
+
export default function updateRecentSearches(params: object): void;
|
|
2
|
+
export declare function getRecentProducts(): string[];
|
|
@@ -1,58 +1,57 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
function getRecentProducts() {
|
|
30
|
-
if (config_1.RECENT_PRODUCT_LS_KEY in localStorage) {
|
|
31
|
-
try {
|
|
32
|
-
var products = JSON.parse(localStorage.getItem(config_1.RECENT_PRODUCT_LS_KEY) || '[]');
|
|
33
|
-
var curSeconds = Math.round(Date.now() / 1000);
|
|
34
|
-
var expiryTimestamp_1 = curSeconds - (config_1.RECENT_PRODUCTS_EXPIRY_DAYS * 24 * 60 * 60); // 5 days in seconds
|
|
35
|
-
// Filter products viewed within the last 5 days
|
|
36
|
-
var recentProducts = products.filter(function (_a) {
|
|
37
|
-
var _ = _a[0], timestamp = _a[1];
|
|
38
|
-
return timestamp > expiryTimestamp_1;
|
|
39
|
-
});
|
|
40
|
-
// Sort by timestamp ascending and return the last RECENT_PRODUCTS_LENGTH_LIMIT products IDs
|
|
41
|
-
var productsArray = recentProducts
|
|
42
|
-
.sort(function (a, b) { return a[1] - b[1]; })
|
|
43
|
-
.slice(-config_1.RECENT_PRODUCTS_LENGTH_LIMIT)
|
|
44
|
-
.map(function (_a) {
|
|
45
|
-
var id = _a[0];
|
|
46
|
-
return id;
|
|
47
|
-
});
|
|
48
|
-
return Array.from(new Set(productsArray));
|
|
49
|
-
}
|
|
50
|
-
catch (error) {
|
|
51
|
-
console.error('Failed to parse or process localStorage data:', error);
|
|
52
|
-
return [];
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return [];
|
|
56
|
-
}
|
|
57
|
-
exports.getRecentProducts = getRecentProducts;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = updateRecentSearches;
|
|
4
|
+
exports.getRecentProducts = getRecentProducts;
|
|
5
|
+
var config_1 = require("../config");
|
|
6
|
+
var RELATED_KEY = "ISP_PRODUCTS_VIEWED_SESSION_2";
|
|
7
|
+
function updateRecentSearches(params) {
|
|
8
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
9
|
+
var anyParams = params;
|
|
10
|
+
var id = (_c = (_b = (_a = anyParams.id) !== null && _a !== void 0 ? _a : anyParams.product_id) !== null && _b !== void 0 ? _b : anyParams.pid) !== null && _c !== void 0 ? _c : null;
|
|
11
|
+
var query = (_f = (_e = (_d = anyParams.original_search_query) !== null && _d !== void 0 ? _d : anyParams.serp) !== null && _e !== void 0 ? _e : anyParams.original_smart_navigation) !== null && _f !== void 0 ? _f : null;
|
|
12
|
+
if (!id) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
var now = parseInt(String(Date.now() / 1000), 10); // sec since 1970...
|
|
16
|
+
var products = JSON.parse((_g = localStorage.getItem(RELATED_KEY)) !== null && _g !== void 0 ? _g : '[]');
|
|
17
|
+
var newProducts = [];
|
|
18
|
+
var ids = new Set();
|
|
19
|
+
newProducts.push([Number(id), now, query]);
|
|
20
|
+
ids.add(Number(id));
|
|
21
|
+
for (var i = 0; i < products.length && newProducts.length < config_1.RECENT_PRODUCTS_LENGTH_LIMIT; i++) {
|
|
22
|
+
if (!ids.has(Number(products[i][0])) && (now - products[i][1]) <= config_1.RECENT_PRODUCTS_EXPIRY_DAYS * 24 * 60 * 60) {
|
|
23
|
+
newProducts.push(products[i]);
|
|
24
|
+
ids.add(Number(products[i][0]));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
localStorage.setItem(RELATED_KEY, JSON.stringify(newProducts));
|
|
28
|
+
}
|
|
29
|
+
function getRecentProducts() {
|
|
30
|
+
if (config_1.RECENT_PRODUCT_LS_KEY in localStorage) {
|
|
31
|
+
try {
|
|
32
|
+
var products = JSON.parse(localStorage.getItem(config_1.RECENT_PRODUCT_LS_KEY) || '[]');
|
|
33
|
+
var curSeconds = Math.round(Date.now() / 1000);
|
|
34
|
+
var expiryTimestamp_1 = curSeconds - (config_1.RECENT_PRODUCTS_EXPIRY_DAYS * 24 * 60 * 60); // 5 days in seconds
|
|
35
|
+
// Filter products viewed within the last 5 days
|
|
36
|
+
var recentProducts = products.filter(function (_a) {
|
|
37
|
+
var _ = _a[0], timestamp = _a[1];
|
|
38
|
+
return timestamp > expiryTimestamp_1;
|
|
39
|
+
});
|
|
40
|
+
// Sort by timestamp ascending and return the last RECENT_PRODUCTS_LENGTH_LIMIT products IDs
|
|
41
|
+
var productsArray = recentProducts
|
|
42
|
+
.sort(function (a, b) { return a[1] - b[1]; })
|
|
43
|
+
.slice(-config_1.RECENT_PRODUCTS_LENGTH_LIMIT)
|
|
44
|
+
.map(function (_a) {
|
|
45
|
+
var id = _a[0];
|
|
46
|
+
return id;
|
|
47
|
+
});
|
|
48
|
+
return Array.from(new Set(productsArray));
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
console.error('Failed to parse or process localStorage data:', error);
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
58
57
|
//# sourceMappingURL=updateRecentSearches.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateRecentSearches.js","sourceRoot":"","sources":["../../src/utils/updateRecentSearches.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"updateRecentSearches.js","sourceRoot":"","sources":["../../src/utils/updateRecentSearches.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SDKUtils } from "../models/common";
|
|
2
|
-
export declare const validateUUID: (uuid: string) => boolean;
|
|
3
|
-
export declare const validateParams: (validators: string[], props: object) => boolean;
|
|
4
|
-
export declare const isValidAPIUser: (sdkUtils: SDKUtils) => boolean;
|
|
5
|
-
export declare const validateCallbackParams: (props: object) => boolean;
|
|
1
|
+
import { SDKUtils } from "../models/common";
|
|
2
|
+
export declare const validateUUID: (uuid: string) => boolean;
|
|
3
|
+
export declare const validateParams: (validators: string[], props: object) => boolean;
|
|
4
|
+
export declare const isValidAPIUser: (sdkUtils: SDKUtils) => boolean;
|
|
5
|
+
export declare const validateCallbackParams: (props: object) => boolean;
|
package/lib/utils/validation.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateCallbackParams = exports.isValidAPIUser = exports.validateParams = exports.validateUUID = void 0;
|
|
4
|
-
var config_1 = require("../config");
|
|
5
|
-
var validateUUID = function (uuid) {
|
|
6
|
-
if (uuid.split("-").length === 5) {
|
|
7
|
-
return true;
|
|
8
|
-
}
|
|
9
|
-
console.log("%c\u274C IS+ SDK Error | invalid UUID", 'font-weight: bold; font-size: 12px; color: red');
|
|
10
|
-
return false;
|
|
11
|
-
};
|
|
12
|
-
exports.validateUUID = validateUUID;
|
|
13
|
-
var validateParams = function (validators, props) {
|
|
14
|
-
for (var _i = 0, validators_1 = validators; _i < validators_1.length; _i++) {
|
|
15
|
-
var v = validators_1[_i];
|
|
16
|
-
if (!(v in props)) {
|
|
17
|
-
console.log("%c\u274C IS+ SDK Error | param: ".concat(v, " missing"), 'font-weight: bold; font-size: 12px; color: red');
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return true;
|
|
22
|
-
};
|
|
23
|
-
exports.validateParams = validateParams;
|
|
24
|
-
var isValidAPIUser = function (sdkUtils) {
|
|
25
|
-
if (!sdkUtils.data.dashboard.using_isp_api) {
|
|
26
|
-
console.log("%c".concat(config_1.API_ERROR_MSG), 'font-weight: bold; font-size: 12px; color: red');
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
return true;
|
|
30
|
-
};
|
|
31
|
-
exports.isValidAPIUser = isValidAPIUser;
|
|
32
|
-
var validateCallbackParams = function (props) {
|
|
33
|
-
var result = true;
|
|
34
|
-
for (var _i = 0, _a = ["onProductsLoaded", "onFacetsLoaded"]; _i < _a.length; _i++) {
|
|
35
|
-
var v = _a[_i];
|
|
36
|
-
if (!(v in props)) {
|
|
37
|
-
result = false;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
if (!result && ("callback" in props)) {
|
|
41
|
-
result = true;
|
|
42
|
-
}
|
|
43
|
-
!result ? console.log("%c\u274C IS+ SDK Error | params: \"onProductsLoaded\", \"onFacetsLoaded\" missing", "font-weight: bold; font-size: 12px; color: red") : null;
|
|
44
|
-
return result;
|
|
45
|
-
};
|
|
46
|
-
exports.validateCallbackParams = validateCallbackParams;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateCallbackParams = exports.isValidAPIUser = exports.validateParams = exports.validateUUID = void 0;
|
|
4
|
+
var config_1 = require("../config");
|
|
5
|
+
var validateUUID = function (uuid) {
|
|
6
|
+
if (uuid.split("-").length === 5) {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
console.log("%c\u274C IS+ SDK Error | invalid UUID", 'font-weight: bold; font-size: 12px; color: red');
|
|
10
|
+
return false;
|
|
11
|
+
};
|
|
12
|
+
exports.validateUUID = validateUUID;
|
|
13
|
+
var validateParams = function (validators, props) {
|
|
14
|
+
for (var _i = 0, validators_1 = validators; _i < validators_1.length; _i++) {
|
|
15
|
+
var v = validators_1[_i];
|
|
16
|
+
if (!(v in props)) {
|
|
17
|
+
console.log("%c\u274C IS+ SDK Error | param: ".concat(v, " missing"), 'font-weight: bold; font-size: 12px; color: red');
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return true;
|
|
22
|
+
};
|
|
23
|
+
exports.validateParams = validateParams;
|
|
24
|
+
var isValidAPIUser = function (sdkUtils) {
|
|
25
|
+
if (!sdkUtils.data.dashboard.using_isp_api) {
|
|
26
|
+
console.log("%c".concat(config_1.API_ERROR_MSG), 'font-weight: bold; font-size: 12px; color: red');
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
return true;
|
|
30
|
+
};
|
|
31
|
+
exports.isValidAPIUser = isValidAPIUser;
|
|
32
|
+
var validateCallbackParams = function (props) {
|
|
33
|
+
var result = true;
|
|
34
|
+
for (var _i = 0, _a = ["onProductsLoaded", "onFacetsLoaded"]; _i < _a.length; _i++) {
|
|
35
|
+
var v = _a[_i];
|
|
36
|
+
if (!(v in props)) {
|
|
37
|
+
result = false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (!result && ("callback" in props)) {
|
|
41
|
+
result = true;
|
|
42
|
+
}
|
|
43
|
+
!result ? console.log("%c\u274C IS+ SDK Error | params: \"onProductsLoaded\", \"onFacetsLoaded\" missing", "font-weight: bold; font-size: 12px; color: red") : null;
|
|
44
|
+
return result;
|
|
45
|
+
};
|
|
46
|
+
exports.validateCallbackParams = validateCallbackParams;
|
|
47
47
|
//# sourceMappingURL=validation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":";;;AACA,oCAAwC;AAEjC,IAAM,YAAY,GAAG,UAAC,IAAY;IACrC,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":";;;AACA,oCAAwC;AAEjC,IAAM,YAAY,GAAG,UAAC,IAAY;IACrC,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,uCAAkC,EAAE,gDAAgD,CAAC,CAAC;IAClG,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC;AANW,QAAA,YAAY,gBAMvB;AAEK,IAAM,cAAc,GAAG,UAAC,UAAoB,EAAE,KAAa;IAC9D,KAAgB,UAAU,EAAV,yBAAU,EAAV,wBAAU,EAAV,IAAU,EAAE,CAAC;QAAxB,IAAM,CAAC,mBAAA;QACR,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YAChB,OAAO,CAAC,GAAG,CAAC,0CAA8B,CAAC,aAAU,EAAE,gDAAgD,CAAC,CAAC;YACzG,OAAO,KAAK,CAAC;QACjB,CAAC;IACL,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AARW,QAAA,cAAc,kBAQzB;AAEK,IAAM,cAAc,GAAG,UAAC,QAAkB;IAC7C,IAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,aAAa,EAAC,CAAC;QACvC,OAAO,CAAC,GAAG,CAAC,YAAK,sBAAa,CAAE,EAAE,gDAAgD,CAAC,CAAC;QACpF,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AANW,QAAA,cAAc,kBAMzB;AAEK,IAAM,sBAAsB,GAAG,UAAC,KAAa;IAChD,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,KAAgB,UAAsC,EAAtC,MAAC,kBAAkB,EAAE,gBAAgB,CAAC,EAAtC,cAAsC,EAAtC,IAAsC,EAAE,CAAC;QAApD,IAAM,CAAC,SAAA;QACR,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YAChB,MAAM,GAAG,KAAK,CAAC;QACnB,CAAC;IACL,CAAC;IACD,IAAI,CAAC,MAAM,IAAI,CAAC,UAAU,IAAI,KAAK,CAAC,EAAE,CAAC;QACnC,MAAM,GAAG,IAAI,CAAC;IAClB,CAAC;IACD,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,mFAA0E,EAAE,gDAAgD,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAE3J,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAbW,QAAA,sBAAsB,0BAajC"}
|