@threekit-tools/treble 0.0.83 → 0.0.85-next-2

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.
Files changed (78) hide show
  1. package/dist/Treble/Treble.d.ts +9 -3
  2. package/dist/Treble/Treble.js +37 -7
  3. package/dist/Treble/index.d.ts +2 -2
  4. package/dist/Treble/index.js +2 -2
  5. package/dist/Treble/{Snapshots.d.ts → snapshots.d.ts} +4 -9
  6. package/dist/Treble/snapshots.js +247 -0
  7. package/dist/Treble/{Wishlist.d.ts → wishlist.d.ts} +2 -6
  8. package/dist/Treble/wishlist.js +135 -0
  9. package/dist/api/orders.d.ts +5 -7
  10. package/dist/components/AttributeValue/index.js +2 -2
  11. package/dist/components/AwaitThreekitLoad/index.d.ts +3 -2
  12. package/dist/components/AwaitThreekitLoad/index.js +7 -2
  13. package/dist/components/Cards/index.d.ts +2 -1
  14. package/dist/components/Cards/index.js +3 -3
  15. package/dist/components/DraggableHint/draggableIndicator.styles.d.ts +5 -0
  16. package/dist/components/DraggableHint/draggableIndicator.styles.js +35 -0
  17. package/dist/components/DraggableHint/index.d.ts +8 -0
  18. package/dist/components/DraggableHint/index.js +49 -0
  19. package/dist/components/Dropdown/index.d.ts +2 -1
  20. package/dist/components/Dropdown/index.js +3 -3
  21. package/dist/components/FlatForm/index.js +5 -3
  22. package/dist/components/Player/index.d.ts +1 -1
  23. package/dist/components/PlayerLoadingCircular/index.d.ts +6 -0
  24. package/dist/components/PlayerLoadingCircular/index.js +18 -0
  25. package/dist/components/PlayerLoadingCircular/playerLoadingCircular.styles.d.ts +7 -0
  26. package/dist/components/PlayerLoadingCircular/playerLoadingCircular.styles.js +17 -0
  27. package/dist/components/PlayerLoadingSpinner/index.d.ts +7 -0
  28. package/dist/components/PlayerLoadingSpinner/index.js +17 -0
  29. package/dist/components/PlayerLoadingSpinner/playerLoadingSpinner.styles.d.ts +4 -0
  30. package/dist/components/PlayerLoadingSpinner/playerLoadingSpinner.styles.js +35 -0
  31. package/dist/components/Share/index.d.ts +2 -0
  32. package/dist/components/Share/index.js +139 -9
  33. package/dist/components/Share/share.styles.d.ts +9 -0
  34. package/dist/components/Share/share.styles.js +23 -0
  35. package/dist/components/Skeleton/index.d.ts +18 -0
  36. package/dist/components/Skeleton/index.js +73 -0
  37. package/dist/components/Skeleton/skeleton.styles.d.ts +14 -0
  38. package/dist/components/Skeleton/skeleton.styles.js +43 -0
  39. package/dist/components/Strips/index.d.ts +2 -1
  40. package/dist/components/Strips/index.js +3 -3
  41. package/dist/components/Swatch/index.d.ts +2 -1
  42. package/dist/components/Swatch/index.js +3 -3
  43. package/dist/components/Switch/index.d.ts +2 -1
  44. package/dist/components/Switch/index.js +2 -2
  45. package/dist/components/TextInput/index.d.ts +2 -1
  46. package/dist/components/TextInput/index.js +2 -2
  47. package/dist/components/Tiles/index.d.ts +2 -1
  48. package/dist/components/Tiles/index.js +3 -3
  49. package/dist/components/TilesGroup/index.d.ts +2 -1
  50. package/dist/components/TilesGroup/index.js +3 -3
  51. package/dist/components/Upload/index.d.ts +2 -1
  52. package/dist/components/Upload/index.js +2 -2
  53. package/dist/components/UploadArea/index.d.ts +2 -1
  54. package/dist/components/UploadArea/index.js +2 -2
  55. package/dist/components/formComponents.d.ts +12 -0
  56. package/dist/components/formComponents.js +5 -5
  57. package/dist/constants.d.ts +0 -22
  58. package/dist/constants.js +1 -23
  59. package/dist/hooks/useFirstPlayerInteraction/index.d.ts +6 -0
  60. package/dist/hooks/useFirstPlayerInteraction/index.js +9 -0
  61. package/dist/hooks/useLoadingProgress/index.d.ts +1 -1
  62. package/dist/hooks/useSingleAnimation/index.js +15 -14
  63. package/dist/http/orders.d.ts +6 -8
  64. package/dist/icons/Draggable.d.ts +3 -0
  65. package/dist/icons/Draggable.js +23 -0
  66. package/dist/icons/index.js +2 -0
  67. package/dist/index.d.ts +6 -1
  68. package/dist/index.js +12 -2
  69. package/dist/store/product.js +3 -1
  70. package/dist/store/treble.d.ts +5 -2
  71. package/dist/store/treble.js +30 -3
  72. package/dist/types.d.ts +71 -24
  73. package/dist/types.js +54 -0
  74. package/dist/utils.d.ts +2 -2
  75. package/dist/utils.js +5 -4
  76. package/package.json +3 -1
  77. package/dist/Treble/Snapshots.js +0 -250
  78. package/dist/Treble/Wishlist.js +0 -136
@@ -1,250 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- 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;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- var __importDefault = (this && this.__importDefault) || function (mod) {
39
- return (mod && mod.__esModule) ? mod : { "default": mod };
40
- };
41
- Object.defineProperty(exports, "__esModule", { value: true });
42
- var api_1 = __importDefault(require("../api"));
43
- var constants_1 = require("../constants");
44
- var utils_1 = require("../utils");
45
- var DEFAULT_CAMERA_CONFIG = {
46
- filename: "snapshot",
47
- size: { width: 1920, height: 1080 },
48
- format: constants_1.SNAPSHOT_FORMATS.png,
49
- attributeName: constants_1.ATTRIBUTES_RESERVED.camera,
50
- output: constants_1.SNAPSHOT_OUTPUTS.blob,
51
- useStage: false,
52
- };
53
- var cameraValues;
54
- var getCameraValue = function (configurator, cameraAttrName) {
55
- if (cameraAttrName === void 0) { cameraAttrName = constants_1.ATTRIBUTES_RESERVED.camera; }
56
- var attribute = configurator
57
- .getDisplayAttributes()
58
- .find(function (el) { return el.name === cameraAttrName; });
59
- if (!attribute)
60
- return undefined;
61
- return attribute.value;
62
- };
63
- var getCamerasMap = function (configurator, cameraAttrName) {
64
- if (cameraAttrName === void 0) { cameraAttrName = constants_1.ATTRIBUTES_RESERVED.camera; }
65
- if (cameraValues)
66
- return cameraValues;
67
- var attribute = configurator
68
- .getDisplayAttributes()
69
- .find(function (el) { return el.name === cameraAttrName; });
70
- if (!attribute) {
71
- cameraValues = {};
72
- return cameraValues;
73
- }
74
- var cameraAttribute = attribute;
75
- cameraAttribute.values.forEach(function (el) {
76
- var _a;
77
- var value = cameraAttribute.type === constants_1.ATTRIBUTE_TYPES.asset
78
- ? { assetId: el.assetId }
79
- : el.value;
80
- cameraValues = Object.assign(cameraValues || {}, (_a = {},
81
- _a[el.label] = value,
82
- _a));
83
- }, {});
84
- return cameraValues;
85
- };
86
- var getSnapshot = function (_a) {
87
- var size = _a.size, format = _a.format;
88
- return window.threekit.player.snapshotAsync({
89
- size: size,
90
- mimeType: "image/".concat(constants_1.SNAPSHOT_FORMATS[format]),
91
- });
92
- };
93
- var getSnapshots = function (cameras, snapshotConfig) { return __awaiter(void 0, void 0, void 0, function () {
94
- var attributeName, size, format, configurator, _a, camerasMap, snapshots;
95
- return __generator(this, function (_b) {
96
- switch (_b.label) {
97
- case 0:
98
- attributeName = snapshotConfig.attributeName || DEFAULT_CAMERA_CONFIG.attributeName;
99
- size = snapshotConfig.size || DEFAULT_CAMERA_CONFIG.size;
100
- format = snapshotConfig.format || DEFAULT_CAMERA_CONFIG.format;
101
- if (!(snapshotConfig === null || snapshotConfig === void 0 ? void 0 : snapshotConfig.useStage)) return [3, 2];
102
- return [4, window.threekit.player.getStageConfigurator()];
103
- case 1:
104
- _a = _b.sent();
105
- return [3, 3];
106
- case 2:
107
- _a = window.threekit.configurator;
108
- _b.label = 3;
109
- case 3:
110
- configurator = _a;
111
- camerasMap = getCamerasMap(configurator, attributeName);
112
- if (!camerasMap)
113
- return [2, Promise.resolve([])];
114
- snapshots = [];
115
- return [2, cameras.reduce(function (snapshotPromise, camera) {
116
- return snapshotPromise.then(function () {
117
- return new Promise(function (resolve) { return __awaiter(void 0, void 0, void 0, function () {
118
- var snapshotStr;
119
- var _a;
120
- return __generator(this, function (_b) {
121
- switch (_b.label) {
122
- case 0:
123
- if (!camera) return [3, 2];
124
- return [4, configurator.setConfiguration((_a = {},
125
- _a[attributeName] = camerasMap[camera],
126
- _a))];
127
- case 1:
128
- _b.sent();
129
- _b.label = 2;
130
- case 2: return [4, getSnapshot({ size: size, format: format })];
131
- case 3:
132
- snapshotStr = _b.sent();
133
- snapshots.push(snapshotStr);
134
- resolve(snapshots);
135
- return [2];
136
- }
137
- });
138
- }); });
139
- });
140
- }, Promise.resolve(snapshots))];
141
- }
142
- });
143
- }); };
144
- var Snapshots = (function () {
145
- function Snapshots() {
146
- var _this = this;
147
- this.getSnapshot = getSnapshot;
148
- this.takeSnapshots = function (camerasList, snapshotsConfig) { return __awaiter(_this, void 0, void 0, function () {
149
- var filename, size, format, attributeName, output, configurator, _a, cameras, snapshotsRaw, snapshotData, camerasMap_1, currentCamera, cameraPosition, _b, attachments, response, urlsArray, snapshotBlobs, snapshotFiles;
150
- var _c;
151
- return __generator(this, function (_d) {
152
- switch (_d.label) {
153
- case 0:
154
- filename = (snapshotsConfig === null || snapshotsConfig === void 0 ? void 0 : snapshotsConfig.filename) || DEFAULT_CAMERA_CONFIG.filename;
155
- size = (snapshotsConfig === null || snapshotsConfig === void 0 ? void 0 : snapshotsConfig.size) || DEFAULT_CAMERA_CONFIG.size;
156
- format = (snapshotsConfig === null || snapshotsConfig === void 0 ? void 0 : snapshotsConfig.format) || DEFAULT_CAMERA_CONFIG.format;
157
- attributeName = (snapshotsConfig === null || snapshotsConfig === void 0 ? void 0 : snapshotsConfig.attributeName) || DEFAULT_CAMERA_CONFIG.attributeName;
158
- output = (snapshotsConfig === null || snapshotsConfig === void 0 ? void 0 : snapshotsConfig.output) || DEFAULT_CAMERA_CONFIG.output;
159
- if (!(snapshotsConfig === null || snapshotsConfig === void 0 ? void 0 : snapshotsConfig.useStage)) return [3, 2];
160
- return [4, window.threekit.player.getStageConfigurator()];
161
- case 1:
162
- _a = _d.sent();
163
- return [3, 3];
164
- case 2:
165
- _a = window.threekit.configurator;
166
- _d.label = 3;
167
- case 3:
168
- configurator = _a;
169
- cameras = Array.isArray(camerasList) ? camerasList : [camerasList];
170
- if (!(cameras.length === 1 && cameras[0] === undefined)) return [3, 5];
171
- return [4, this.getSnapshot({ size: size, format: format })];
172
- case 4:
173
- snapshotData = _d.sent();
174
- snapshotsRaw = [snapshotData];
175
- return [3, 8];
176
- case 5:
177
- camerasMap_1 = getCamerasMap(configurator, attributeName);
178
- if (!camerasMap_1)
179
- return [2, null];
180
- cameras = cameras.filter(function (el) { return el === undefined || Object.keys(camerasMap_1).includes(el); });
181
- currentCamera = getCameraValue(configurator, attributeName);
182
- cameraPosition = (0, utils_1.getCameraPosition)(window.threekit.player.camera);
183
- return [4, getSnapshots(cameras, snapshotsConfig)];
184
- case 6:
185
- snapshotsRaw = _d.sent();
186
- return [4, configurator.setConfiguration((_c = {},
187
- _c[attributeName] = currentCamera,
188
- _c))];
189
- case 7:
190
- _d.sent();
191
- (0, utils_1.setCameraPosition)(window.threekit.player.camera, cameraPosition);
192
- _d.label = 8;
193
- case 8:
194
- _b = output;
195
- switch (_b) {
196
- case constants_1.SNAPSHOT_OUTPUTS.url: return [3, 9];
197
- case constants_1.SNAPSHOT_OUTPUTS.download: return [3, 11];
198
- case constants_1.SNAPSHOT_OUTPUTS.blob: return [3, 12];
199
- case constants_1.SNAPSHOT_OUTPUTS.file: return [3, 13];
200
- case constants_1.SNAPSHOT_OUTPUTS.dataUrl: return [3, 14];
201
- }
202
- return [3, 14];
203
- case 9:
204
- attachments = snapshotsRaw.reduce(function (output, el, idx) {
205
- var _a;
206
- var cameraName = (camerasList === null || camerasList === void 0 ? void 0 : camerasList[idx])
207
- ? (0, utils_1.regularToKebabCase)(camerasList[idx] || 'default')
208
- : filename;
209
- var preppedFilename = cameraName === filename
210
- ? "".concat(filename, ".").concat(format)
211
- : "".concat(filename, "-").concat(cameraName, ".").concat(format);
212
- var file = (0, utils_1.dataURItoFile)(el, preppedFilename);
213
- return Object.assign(output, (_a = {}, _a[cameraName] = file, _a));
214
- }, {});
215
- return [4, api_1.default.configurations.save({
216
- assetId: window.threekit.player.assetId,
217
- configuration: window.threekit.configurator.getConfiguration(),
218
- attachments: attachments,
219
- })];
220
- case 10:
221
- response = _d.sent();
222
- urlsArray = Object.values(response.data.attachments);
223
- return [2, Promise.resolve(urlsArray)];
224
- case 11:
225
- snapshotsRaw.forEach(function (snapshotBlob, idx) {
226
- var cameraName = (camerasList === null || camerasList === void 0 ? void 0 : camerasList[idx])
227
- ? "-".concat((0, utils_1.regularToKebabCase)(camerasList[idx] || 'default'))
228
- : '';
229
- (0, utils_1.downloadSnapshot)(snapshotBlob, "".concat(filename).concat(cameraName, ".").concat(format));
230
- });
231
- return [2, Promise.resolve()];
232
- case 12:
233
- snapshotBlobs = snapshotsRaw.map(function (el) { return (0, utils_1.dataURItoBlob)(el); });
234
- return [2, Promise.resolve(snapshotBlobs)];
235
- case 13:
236
- snapshotFiles = snapshotsRaw.map(function (el, idx) {
237
- var cameraName = (camerasList === null || camerasList === void 0 ? void 0 : camerasList[idx])
238
- ? "-".concat((0, utils_1.regularToKebabCase)(camerasList[idx] || 'default'))
239
- : '';
240
- return (0, utils_1.dataURItoFile)(el, "".concat(filename).concat(cameraName, ".").concat(format));
241
- });
242
- return [2, Promise.resolve(snapshotFiles)];
243
- case 14: return [2, Promise.resolve(snapshotsRaw)];
244
- }
245
- });
246
- }); };
247
- }
248
- return Snapshots;
249
- }());
250
- exports.default = Snapshots;
@@ -1,136 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- 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;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
39
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
40
- if (ar || !(i in from)) {
41
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
42
- ar[i] = from[i];
43
- }
44
- }
45
- return to.concat(ar || Array.prototype.slice.call(from));
46
- };
47
- var __importDefault = (this && this.__importDefault) || function (mod) {
48
- return (mod && mod.__esModule) ? mod : { "default": mod };
49
- };
50
- Object.defineProperty(exports, "__esModule", { value: true });
51
- var api_1 = __importDefault(require("../api"));
52
- var constants_1 = require("../constants");
53
- var wishlistData;
54
- var Wishlist = (function () {
55
- function Wishlist(orgId) {
56
- var _this = this;
57
- this.getWishlist = function () { return __awaiter(_this, void 0, void 0, function () {
58
- var wishlistListStr, wishlistList, wishlistDataRaw;
59
- return __generator(this, function (_a) {
60
- switch (_a.label) {
61
- case 0:
62
- if (wishlistData)
63
- return [2, wishlistData];
64
- wishlistListStr = localStorage.getItem(this._wishlistKey);
65
- wishlistList = JSON.parse(wishlistListStr || '[]');
66
- return [4, Promise.all(wishlistList.map(function (el) { return api_1.default.configurations.fetch(el); }))];
67
- case 1:
68
- wishlistDataRaw = _a.sent();
69
- wishlistData = wishlistDataRaw.map(function (el) { return el.data; });
70
- return [2, wishlistData];
71
- }
72
- });
73
- }); };
74
- this.addItem = function () { return __awaiter(_this, void 0, void 0, function () {
75
- var thumbnails, savedConfiguration, wishlistListStr, wishlistList;
76
- return __generator(this, function (_a) {
77
- switch (_a.label) {
78
- case 0:
79
- if (!wishlistData) {
80
- wishlistData = [];
81
- localStorage.setItem(this._wishlistKey, JSON.stringify([]));
82
- }
83
- return [4, window.threekit.treble.takeSnapshots(undefined, {
84
- output: 'file',
85
- filename: 'thumbnail',
86
- })];
87
- case 1:
88
- thumbnails = (_a.sent());
89
- return [4, window.threekit.treble.saveConfiguration({
90
- attachments: { thumbnail: thumbnails[0] },
91
- })];
92
- case 2:
93
- savedConfiguration = _a.sent();
94
- if (!savedConfiguration)
95
- return [2, wishlistData];
96
- wishlistData = __spreadArray(__spreadArray([], wishlistData, true), [savedConfiguration], false);
97
- wishlistListStr = localStorage.getItem(this._wishlistKey);
98
- wishlistList = JSON.parse(wishlistListStr || '[]');
99
- wishlistList.push(savedConfiguration.shortId);
100
- localStorage.setItem(this._wishlistKey, JSON.stringify(wishlistList));
101
- return [2, this.getWishlist()];
102
- }
103
- });
104
- }); };
105
- this.removeItemByIdx = function (idx) {
106
- if (!(wishlistData === null || wishlistData === void 0 ? void 0 : wishlistData.length)) {
107
- wishlistData = [];
108
- localStorage.setItem(_this._wishlistKey, JSON.stringify([]));
109
- return wishlistData;
110
- }
111
- if (idx > (wishlistData === null || wishlistData === void 0 ? void 0 : wishlistData.length) - 1)
112
- return wishlistData;
113
- var updatedWishlist = __spreadArray([], wishlistData, true);
114
- updatedWishlist.splice(idx, 1);
115
- wishlistData = updatedWishlist;
116
- var wishlistListStr = localStorage.getItem(_this._wishlistKey);
117
- var wishlistList = JSON.parse(wishlistListStr || '[]');
118
- wishlistList.splice(idx, 1);
119
- localStorage.setItem(_this._wishlistKey, JSON.stringify(wishlistList));
120
- return wishlistData;
121
- };
122
- this.clearWishlist = function () {
123
- wishlistData = [];
124
- localStorage.setItem(_this._wishlistKey, JSON.stringify([]));
125
- return wishlistData;
126
- };
127
- this._wishlistKey = "".concat(constants_1.WISHLIST_LOCALSTORAGE_KEY, "_").concat(orgId);
128
- this.getWishlist();
129
- return this;
130
- }
131
- return Wishlist;
132
- }());
133
- function createWishlist(orgId) {
134
- return new Wishlist(orgId);
135
- }
136
- exports.default = createWishlist;