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/API.js
CHANGED
|
@@ -1,82 +1,82 @@
|
|
|
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g =
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.API = void 0;
|
|
51
|
-
var axios_1 = require("axios");
|
|
52
|
-
exports.API = {
|
|
53
|
-
get: function (_a) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
var
|
|
57
|
-
return __generator(this, function (
|
|
58
|
-
switch (
|
|
59
|
-
case 0: return [4 /*yield*/, axios_1.default.get(url, __assign({ params: params }, config))];
|
|
60
|
-
case 1:
|
|
61
|
-
response =
|
|
62
|
-
return [2 /*return*/, response.data];
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
},
|
|
67
|
-
post: function (_a) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
var
|
|
71
|
-
return __generator(this, function (
|
|
72
|
-
switch (
|
|
73
|
-
case 0: return [4 /*yield*/, axios_1.default.post(url, data, config)];
|
|
74
|
-
case 1:
|
|
75
|
-
response =
|
|
76
|
-
return [2 /*return*/, response.data];
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
},
|
|
81
|
-
};
|
|
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.API = void 0;
|
|
51
|
+
var axios_1 = require("axios");
|
|
52
|
+
exports.API = {
|
|
53
|
+
get: function (_a) {
|
|
54
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
55
|
+
var response;
|
|
56
|
+
var url = _b.url, params = _b.params, config = _b.config;
|
|
57
|
+
return __generator(this, function (_c) {
|
|
58
|
+
switch (_c.label) {
|
|
59
|
+
case 0: return [4 /*yield*/, axios_1.default.get(url, __assign({ params: params }, config))];
|
|
60
|
+
case 1:
|
|
61
|
+
response = _c.sent();
|
|
62
|
+
return [2 /*return*/, response.data];
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
},
|
|
67
|
+
post: function (_a) {
|
|
68
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
69
|
+
var response;
|
|
70
|
+
var url = _b.url, config = _b.config, data = _b.data;
|
|
71
|
+
return __generator(this, function (_c) {
|
|
72
|
+
switch (_c.label) {
|
|
73
|
+
case 0: return [4 /*yield*/, axios_1.default.post(url, data, config)];
|
|
74
|
+
case 1:
|
|
75
|
+
response = _c.sent();
|
|
76
|
+
return [2 /*return*/, response.data];
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
82
|
//# sourceMappingURL=API.js.map
|
package/lib/utils/API.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"API.js","sourceRoot":"","sources":["../../src/utils/API.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA+D;AAkBlD,QAAA,GAAG,GAAG;IACf,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"API.js","sourceRoot":"","sources":["../../src/utils/API.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA+D;AAkBlD,QAAA,GAAG,GAAG;IACf,GAAG,EAAE;4DAAmB,EAA+B;;gBAA9B,GAAG,SAAA,EAAE,MAAM,YAAA,EAAE,MAAM,YAAA;;;4BACvB,qBAAM,eAAK,CAAC,GAAG,CAAwB,GAAG,aACvD,MAAM,QAAA,IACH,MAAM,EACX,EAAA;;wBAHI,QAAQ,GAAG,SAGf;wBAEF,sBAAO,QAAQ,CAAC,IAAI,EAAC;;;;KACxB;IAED,IAAI,EAAE;4DAAmB,EAA8B;;gBAA7B,GAAG,SAAA,EAAE,MAAM,YAAA,EAAE,IAAI,UAAA;;;4BACtB,qBAAM,eAAK,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,EAAA;;wBAA9C,QAAQ,GAAG,SAAmC;wBAEpD,sBAAO,QAAQ,CAAC,IAAI,EAAC;;;;KACxB;CACJ,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function arrayMove(arr: any[], oldIndex: number, newIndex: number): void;
|
|
2
|
-
export declare function insert<T>(arr: T[], index: number, item: T): void;
|
|
1
|
+
export declare function arrayMove(arr: any[], oldIndex: number, newIndex: number): void;
|
|
2
|
+
export declare function insert<T>(arr: T[], index: number, item: T): void;
|
package/lib/utils/ArrayUtils.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
function insert(arr, index, item) {
|
|
15
|
-
arr.splice(index, 0, item);
|
|
16
|
-
}
|
|
17
|
-
exports.insert = insert;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.arrayMove = arrayMove;
|
|
4
|
+
exports.insert = insert;
|
|
5
|
+
function arrayMove(arr, oldIndex, newIndex) {
|
|
6
|
+
if (newIndex >= arr.length) {
|
|
7
|
+
var k = newIndex - arr.length + 1;
|
|
8
|
+
while (k--) {
|
|
9
|
+
arr.push(undefined);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
arr.splice(newIndex, 0, arr.splice(oldIndex, 1)[0]);
|
|
13
|
+
}
|
|
14
|
+
function insert(arr, index, item) {
|
|
15
|
+
arr.splice(index, 0, item);
|
|
16
|
+
}
|
|
18
17
|
//# sourceMappingURL=ArrayUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayUtils.js","sourceRoot":"","sources":["../../src/utils/ArrayUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ArrayUtils.js","sourceRoot":"","sources":["../../src/utils/ArrayUtils.ts"],"names":[],"mappings":";;AAAA,8BAQC;AAED,wBAEC;AAZD,SAAgB,SAAS,CAAC,GAAU,EAAE,QAAgB,EAAE,QAAgB;IACpE,IAAI,QAAQ,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;QACzB,IAAI,CAAC,GAAG,QAAQ,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;QAClC,OAAO,CAAC,EAAE,EAAE,CAAC;YACT,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxB,CAAC;IACL,CAAC;IACD,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACxD,CAAC;AAED,SAAgB,MAAM,CAAI,GAAQ,EAAE,KAAa,EAAE,IAAO;IACtD,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export interface Box {
|
|
2
|
-
name: string;
|
|
3
|
-
position: Position;
|
|
4
|
-
dot: Dot;
|
|
5
|
-
coords: number[];
|
|
6
|
-
person: string;
|
|
7
|
-
}
|
|
8
|
-
interface Position {
|
|
9
|
-
width: number;
|
|
10
|
-
height: number;
|
|
11
|
-
top: number;
|
|
12
|
-
left: number;
|
|
13
|
-
}
|
|
14
|
-
interface Dot {
|
|
15
|
-
name: string;
|
|
16
|
-
x: number;
|
|
17
|
-
y: number;
|
|
18
|
-
productSuggestions: any[];
|
|
19
|
-
person: string;
|
|
20
|
-
id: string;
|
|
21
|
-
}
|
|
22
|
-
export declare function getBoxesFromData(data: any, showDotsWithoutItems: boolean): Box[];
|
|
23
|
-
export {};
|
|
1
|
+
export interface Box {
|
|
2
|
+
name: string;
|
|
3
|
+
position: Position;
|
|
4
|
+
dot: Dot;
|
|
5
|
+
coords: number[];
|
|
6
|
+
person: string;
|
|
7
|
+
}
|
|
8
|
+
interface Position {
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
top: number;
|
|
12
|
+
left: number;
|
|
13
|
+
}
|
|
14
|
+
interface Dot {
|
|
15
|
+
name: string;
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
productSuggestions: any[];
|
|
19
|
+
person: string;
|
|
20
|
+
id: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function getBoxesFromData(data: any, showDotsWithoutItems: boolean): Box[];
|
|
23
|
+
export {};
|
|
@@ -1,90 +1,89 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getBoxesFromData =
|
|
4
|
-
// Functions
|
|
5
|
-
function getBoxesFromData(data, showDotsWithoutItems) {
|
|
6
|
-
var bbs = (data.bbox || []).filter(function (apiBoundingBox) {
|
|
7
|
-
if (showDotsWithoutItems) {
|
|
8
|
-
return true;
|
|
9
|
-
}
|
|
10
|
-
var isPrimaryProduct = apiBoundingBox.name === data.product_label;
|
|
11
|
-
var completeTheLook = data.complete_the_look || {};
|
|
12
|
-
return isPrimaryProduct
|
|
13
|
-
? (data.similar || []).length > 0
|
|
14
|
-
: (completeTheLook[apiBoundingBox.name] || []).length > 0;
|
|
15
|
-
});
|
|
16
|
-
return removeDuplicateBoxes(bbs.map(function (box) { return normalizeBox(box, data); }));
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
var
|
|
40
|
-
var
|
|
41
|
-
var
|
|
42
|
-
var
|
|
43
|
-
var
|
|
44
|
-
var
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
function
|
|
49
|
-
var
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
var
|
|
55
|
-
var
|
|
56
|
-
var
|
|
57
|
-
var
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
var
|
|
70
|
-
var
|
|
71
|
-
var
|
|
72
|
-
var
|
|
73
|
-
var
|
|
74
|
-
var
|
|
75
|
-
var
|
|
76
|
-
var
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBoxesFromData = getBoxesFromData;
|
|
4
|
+
// Functions
|
|
5
|
+
function getBoxesFromData(data, showDotsWithoutItems) {
|
|
6
|
+
var bbs = (data.bbox || []).filter(function (apiBoundingBox) {
|
|
7
|
+
if (showDotsWithoutItems) {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
var isPrimaryProduct = apiBoundingBox.name === data.product_label;
|
|
11
|
+
var completeTheLook = data.complete_the_look || {};
|
|
12
|
+
return isPrimaryProduct
|
|
13
|
+
? (data.similar || []).length > 0
|
|
14
|
+
: (completeTheLook[apiBoundingBox.name] || []).length > 0;
|
|
15
|
+
});
|
|
16
|
+
return removeDuplicateBoxes(bbs.map(function (box) { return normalizeBox(box, data); }));
|
|
17
|
+
}
|
|
18
|
+
function removeDuplicateBoxes(products) {
|
|
19
|
+
return products.filter(function (product, index, arr) {
|
|
20
|
+
return arr
|
|
21
|
+
.map(function (mapProduct) {
|
|
22
|
+
if (mapProduct.person === product.person)
|
|
23
|
+
return mapProduct.name;
|
|
24
|
+
return null; // Ensure all map iterations return a value
|
|
25
|
+
})
|
|
26
|
+
.indexOf(product.name) === index;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function normalizeBox(dotData, data) {
|
|
30
|
+
var name = dotData.name;
|
|
31
|
+
var position = getBoxPosition(dotData.bb);
|
|
32
|
+
var dot = normalizeDot(dotData, data);
|
|
33
|
+
var coords = dotData.bb;
|
|
34
|
+
var person = dotData.person;
|
|
35
|
+
return { name: name, position: position, dot: dot, coords: coords, person: person };
|
|
36
|
+
}
|
|
37
|
+
function getBoxPosition(boxCoords) {
|
|
38
|
+
var _a = getXYValues(boxCoords), xValues = _a.xValues, yValues = _a.yValues;
|
|
39
|
+
var xMax = Math.max.apply(Math, xValues);
|
|
40
|
+
var xMin = Math.min.apply(Math, xValues);
|
|
41
|
+
var width = (xMax - xMin) * 100;
|
|
42
|
+
var yMax = Math.max.apply(Math, yValues);
|
|
43
|
+
var yMin = Math.min.apply(Math, yValues);
|
|
44
|
+
var height = (yMax - yMin) * 100;
|
|
45
|
+
return { width: width, height: height, top: yMin * 100, left: xMin * 100 };
|
|
46
|
+
}
|
|
47
|
+
function getXYValues(coords) {
|
|
48
|
+
var xValues = Array.from(new Set(coords.filter(function (_, index) { return index % 2 === 0; }))); // Get only the unique X values
|
|
49
|
+
var yValues = Array.from(new Set(coords.filter(function (_, index) { return index % 2 === 1; }))); // Get only the unique Y values
|
|
50
|
+
return { xValues: xValues, yValues: yValues };
|
|
51
|
+
}
|
|
52
|
+
function normalizeDot(dotData, data) {
|
|
53
|
+
var name = dotData.name;
|
|
54
|
+
var coords = getDotPosition(dotData.bb);
|
|
55
|
+
var productSuggestions = getProductSuggestions(name, name === data.product_label, data);
|
|
56
|
+
var person = dotData.person;
|
|
57
|
+
var boxId = dotData.name + dotData.person;
|
|
58
|
+
return {
|
|
59
|
+
name: name,
|
|
60
|
+
x: coords.x,
|
|
61
|
+
y: coords.y,
|
|
62
|
+
productSuggestions: productSuggestions,
|
|
63
|
+
person: person,
|
|
64
|
+
id: boxId,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function getDotPosition(boxCoords) {
|
|
68
|
+
var _a = getXYValues(boxCoords), xValues = _a.xValues, yValues = _a.yValues;
|
|
69
|
+
var xSegment = 0.5; // Determines the horizontal position of the dot within the box
|
|
70
|
+
var ySegment = 0.5; // Determines the vertical position of the dot within the box
|
|
71
|
+
var xMax = Math.max.apply(Math, xValues);
|
|
72
|
+
var xMin = Math.min.apply(Math, xValues);
|
|
73
|
+
var x = ((xMax - xMin) * xSegment + xMin) * 100;
|
|
74
|
+
var yMax = Math.max.apply(Math, yValues);
|
|
75
|
+
var yMin = Math.min.apply(Math, yValues);
|
|
76
|
+
var y = ((yMax - yMin) * ySegment + yMin) * 100;
|
|
77
|
+
return { x: x, y: y };
|
|
78
|
+
}
|
|
79
|
+
function getProductSuggestions(name, isPrimary, data) {
|
|
80
|
+
var products;
|
|
81
|
+
if (isPrimary) {
|
|
82
|
+
products = data.similar || [];
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
products = (data.complete_the_look && data.complete_the_look[name]) || [];
|
|
86
|
+
}
|
|
87
|
+
return products;
|
|
88
|
+
}
|
|
90
89
|
//# sourceMappingURL=bindingBoxes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bindingBoxes.js","sourceRoot":"","sources":["../../src/utils/bindingBoxes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bindingBoxes.js","sourceRoot":"","sources":["../../src/utils/bindingBoxes.ts"],"names":[],"mappings":";;AAyCA,4CAiBC;AAlBD,YAAY;AACZ,SAAgB,gBAAgB,CAAC,IAAS,EAAE,oBAA6B;IACrE,IAA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G,OAAR,IAAI,EAAQ,OAAO,CAAC,CAAC;IAClC,IAAM,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,QAAQ,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC;IAElD,IAAM,IAAI,GAAG,IAAI,CAAC,GAAG,OAAR,IAAI,EAAQ,OAAO,CAAC,CAAC;IAClC,IAAM,IAAI,GAAG,IAAI,CAAC,GAAG,OAAR,IAAI,EAAQ,OAAO,CAAC,CAAC;IAClC,IAAM,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,QAAQ,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC;IAElD,OAAO,EAAE,CAAC,GAAA,EAAE,CAAC,GAAA,EAAE,CAAC;AACpB,CAAC;AAED,SAAS,qBAAqB,CAC1B,IAAY,EACZ,SAAkB,EAClB,IAAS;IAET,IAAI,QAAQ,CAAC;IAEb,IAAI,SAAS,EAAE,CAAC;QACZ,QAAQ,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;IAClC,CAAC;SAAM,CAAC;QACJ,QAAQ,GAAG,CAAC,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9E,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC"}
|
package/lib/utils/cookies.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export default class Cookies {
|
|
2
|
-
private readonly cookies;
|
|
3
|
-
constructor();
|
|
4
|
-
private getCookies;
|
|
5
|
-
has(key: string): boolean;
|
|
6
|
-
private static getActualKey;
|
|
7
|
-
private static getActualValue;
|
|
8
|
-
get(key: string): string;
|
|
9
|
-
set(key: string, value: string): {
|
|
10
|
-
actualKey: string;
|
|
11
|
-
actualValue: string;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
1
|
+
export default class Cookies {
|
|
2
|
+
private readonly cookies;
|
|
3
|
+
constructor();
|
|
4
|
+
private getCookies;
|
|
5
|
+
has(key: string): boolean;
|
|
6
|
+
private static getActualKey;
|
|
7
|
+
private static getActualValue;
|
|
8
|
+
get(key: string): string;
|
|
9
|
+
set(key: string, value: string): {
|
|
10
|
+
actualKey: string;
|
|
11
|
+
actualValue: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
package/lib/utils/cookies.js
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
var Cookies = /** @class */ (function () {
|
|
15
|
-
function Cookies() {
|
|
16
|
-
this.cookies = this.getCookies();
|
|
17
|
-
}
|
|
18
|
-
Cookies.prototype.getCookies = function () {
|
|
19
|
-
return document.cookie.split("; ").reduce(function (a, c) {
|
|
20
|
-
var _a;
|
|
21
|
-
var _b = c.split("="), n = _b[0], v = _b[1];
|
|
22
|
-
return __assign(__assign({}, a), (_a = {}, _a[n] = decodeURIComponent(v), _a));
|
|
23
|
-
}, {});
|
|
24
|
-
};
|
|
25
|
-
Cookies.prototype.has = function (key) {
|
|
26
|
-
return Boolean(this.cookies[key]);
|
|
27
|
-
};
|
|
28
|
-
Cookies.getActualKey = function (key) {
|
|
29
|
-
return encodeURIComponent(key)
|
|
30
|
-
.replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)
|
|
31
|
-
.replace(/[()]/g, escape);
|
|
32
|
-
};
|
|
33
|
-
Cookies.getActualValue = function (value) {
|
|
34
|
-
return encodeURIComponent(value).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent);
|
|
35
|
-
};
|
|
36
|
-
Cookies.prototype.get = function (key) {
|
|
37
|
-
var _a, _b;
|
|
38
|
-
var actualKey = Cookies.getActualKey(key);
|
|
39
|
-
return (_b = (_a = this.cookies[key]) !== null && _a !== void 0 ? _a : this.cookies[actualKey]) !== null && _b !== void 0 ? _b : "";
|
|
40
|
-
};
|
|
41
|
-
Cookies.prototype.set = function (key, value) {
|
|
42
|
-
var actualKey = Cookies.getActualKey(key);
|
|
43
|
-
var actualValue = Cookies.getActualValue(value);
|
|
44
|
-
this.cookies[actualKey] = actualValue;
|
|
45
|
-
document.cookie += "".concat(actualKey, "=").concat(actualValue, "; ");
|
|
46
|
-
return { actualKey: actualKey, actualValue: actualValue };
|
|
47
|
-
};
|
|
48
|
-
return Cookies;
|
|
49
|
-
}());
|
|
50
|
-
exports.default = Cookies;
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
var Cookies = /** @class */ (function () {
|
|
15
|
+
function Cookies() {
|
|
16
|
+
this.cookies = this.getCookies();
|
|
17
|
+
}
|
|
18
|
+
Cookies.prototype.getCookies = function () {
|
|
19
|
+
return document.cookie.split("; ").reduce(function (a, c) {
|
|
20
|
+
var _a;
|
|
21
|
+
var _b = c.split("="), n = _b[0], v = _b[1];
|
|
22
|
+
return __assign(__assign({}, a), (_a = {}, _a[n] = decodeURIComponent(v), _a));
|
|
23
|
+
}, {});
|
|
24
|
+
};
|
|
25
|
+
Cookies.prototype.has = function (key) {
|
|
26
|
+
return Boolean(this.cookies[key]);
|
|
27
|
+
};
|
|
28
|
+
Cookies.getActualKey = function (key) {
|
|
29
|
+
return encodeURIComponent(key)
|
|
30
|
+
.replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)
|
|
31
|
+
.replace(/[()]/g, escape);
|
|
32
|
+
};
|
|
33
|
+
Cookies.getActualValue = function (value) {
|
|
34
|
+
return encodeURIComponent(value).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent);
|
|
35
|
+
};
|
|
36
|
+
Cookies.prototype.get = function (key) {
|
|
37
|
+
var _a, _b;
|
|
38
|
+
var actualKey = Cookies.getActualKey(key);
|
|
39
|
+
return (_b = (_a = this.cookies[key]) !== null && _a !== void 0 ? _a : this.cookies[actualKey]) !== null && _b !== void 0 ? _b : "";
|
|
40
|
+
};
|
|
41
|
+
Cookies.prototype.set = function (key, value) {
|
|
42
|
+
var actualKey = Cookies.getActualKey(key);
|
|
43
|
+
var actualValue = Cookies.getActualValue(value);
|
|
44
|
+
this.cookies[actualKey] = actualValue;
|
|
45
|
+
document.cookie += "".concat(actualKey, "=").concat(actualValue, "; ");
|
|
46
|
+
return { actualKey: actualKey, actualValue: actualValue };
|
|
47
|
+
};
|
|
48
|
+
return Cookies;
|
|
49
|
+
}());
|
|
50
|
+
exports.default = Cookies;
|
|
51
51
|
//# sourceMappingURL=cookies.js.map
|
package/lib/utils/debug.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const getDebugEndpoint: () => string;
|
|
2
|
-
export declare const isDebugCaching: () => boolean;
|
|
3
|
-
export declare const debugSDK: (endpoint: string, disableCaching?: boolean) => void;
|
|
4
|
-
export declare const clearDebugSDK: () => void;
|
|
1
|
+
export declare const getDebugEndpoint: () => string;
|
|
2
|
+
export declare const isDebugCaching: () => boolean;
|
|
3
|
+
export declare const debugSDK: (endpoint: string, disableCaching?: boolean) => void;
|
|
4
|
+
export declare const clearDebugSDK: () => void;
|