@threekit-tools/treble 0.0.82 → 0.0.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Treble/Snapshots.js +31 -32
- package/dist/Treble/Treble.js +3 -4
- package/dist/Treble/Wishlist.js +8 -8
- package/dist/api/catalog.js +6 -6
- package/dist/api/configurations.js +3 -3
- package/dist/api/datatables.js +5 -5
- package/dist/api/orders.js +12 -12
- package/dist/api/price.js +2 -2
- package/dist/api/products.js +2 -2
- package/dist/components/Accordion/index.js +1 -6
- package/dist/components/AttributeTitle/index.d.ts +0 -9
- package/dist/components/AttributeTitle/index.js +0 -9
- package/dist/components/AttributeValue/index.d.ts +0 -6
- package/dist/components/AttributeValue/index.js +0 -6
- package/dist/components/Button/index.d.ts +0 -27
- package/dist/components/Button/index.js +0 -27
- package/dist/components/Cards/index.d.ts +0 -54
- package/dist/components/Cards/index.js +0 -57
- package/dist/components/Drawer/index.js +0 -13
- package/dist/components/Dropdown/index.d.ts +0 -58
- package/dist/components/Dropdown/index.js +1 -66
- package/dist/components/FlatForm/index.d.ts +0 -21
- package/dist/components/FlatForm/index.js +0 -21
- package/dist/components/Modal/index.js +0 -13
- package/dist/components/PortalToElement/index.js +0 -8
- package/dist/components/ProductDescription/index.d.ts +0 -6
- package/dist/components/ProductDescription/index.js +0 -6
- package/dist/components/ProductName/index.d.ts +0 -9
- package/dist/components/ProductName/index.js +0 -9
- package/dist/components/Share/index.d.ts +0 -12
- package/dist/components/Share/index.js +0 -12
- package/dist/components/Snapshots/index.d.ts +0 -8
- package/dist/components/Snapshots/index.js +0 -8
- package/dist/components/Strips/index.d.ts +0 -54
- package/dist/components/Strips/index.js +0 -57
- package/dist/components/Swatch/index.d.ts +0 -63
- package/dist/components/Swatch/index.js +0 -66
- package/dist/components/Switch/index.d.ts +0 -33
- package/dist/components/Switch/index.js +0 -36
- package/dist/components/TextInput/index.js +0 -1
- package/dist/components/Tiles/index.d.ts +0 -28
- package/dist/components/Tiles/index.js +0 -30
- package/dist/components/TilesGroup/index.d.ts +0 -25
- package/dist/components/TilesGroup/index.js +0 -27
- package/dist/components/TotalPrice/index.d.ts +0 -6
- package/dist/components/TotalPrice/index.js +0 -6
- package/dist/components/Upload/index.js +5 -6
- package/dist/components/UploadArea/index.js +4 -5
- package/dist/components/Wishlist/index.d.ts +1 -4
- package/dist/components/Wishlist/index.js +2 -5
- package/dist/components/Zoom/index.d.ts +1 -18
- package/dist/components/Zoom/index.js +0 -17
- package/dist/components/formComponents.js +0 -2
- package/dist/components/message/index.d.ts +0 -9
- package/dist/components/message/index.js +0 -9
- package/dist/connection.js +2 -2
- package/dist/constants.d.ts +0 -27
- package/dist/constants.js +0 -36
- package/dist/hooks/useAttribute/index.js +6 -6
- package/dist/hooks/useConfigurationLoader/index.js +5 -5
- package/dist/hooks/useNestedConfigurator/index.js +2 -2
- package/dist/hooks/useShare/index.js +3 -3
- package/dist/hooks/useSingleAnimation/index.js +5 -11
- package/dist/http/datatables.js +0 -1
- package/dist/icons/index.d.ts +0 -41
- package/dist/icons/index.js +0 -42
- package/dist/index.d.ts +42 -3
- package/dist/index.js +84 -30
- package/dist/store/attributes.d.ts +0 -12
- package/dist/store/attributes.js +2 -15
- package/dist/store/price.d.ts +0 -12
- package/dist/store/price.js +2 -16
- package/dist/store/product.d.ts +2 -17
- package/dist/store/product.js +23 -37
- package/dist/store/translations.d.ts +0 -12
- package/dist/store/translations.js +2 -12
- package/dist/store/treble.d.ts +0 -15
- package/dist/store/treble.js +31 -66
- package/dist/store/wishlist.d.ts +0 -12
- package/dist/store/wishlist.js +4 -17
- package/dist/types.d.ts +0 -34
- package/dist/utils.js +3 -12
- package/package.json +16 -4
package/dist/Treble/Snapshots.js
CHANGED
|
@@ -40,7 +40,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
42
|
var api_1 = __importDefault(require("../api"));
|
|
43
|
-
// import connection from '../connection';
|
|
44
43
|
var constants_1 = require("../constants");
|
|
45
44
|
var utils_1 = require("../utils");
|
|
46
45
|
var DEFAULT_CAMERA_CONFIG = {
|
|
@@ -99,11 +98,11 @@ var getSnapshots = function (cameras, snapshotConfig) { return __awaiter(void 0,
|
|
|
99
98
|
attributeName = snapshotConfig.attributeName || DEFAULT_CAMERA_CONFIG.attributeName;
|
|
100
99
|
size = snapshotConfig.size || DEFAULT_CAMERA_CONFIG.size;
|
|
101
100
|
format = snapshotConfig.format || DEFAULT_CAMERA_CONFIG.format;
|
|
102
|
-
if (!(snapshotConfig === null || snapshotConfig === void 0 ? void 0 : snapshotConfig.useStage)) return [3
|
|
103
|
-
return [4
|
|
101
|
+
if (!(snapshotConfig === null || snapshotConfig === void 0 ? void 0 : snapshotConfig.useStage)) return [3, 2];
|
|
102
|
+
return [4, window.threekit.player.getStageConfigurator()];
|
|
104
103
|
case 1:
|
|
105
104
|
_a = _b.sent();
|
|
106
|
-
return [3
|
|
105
|
+
return [3, 3];
|
|
107
106
|
case 2:
|
|
108
107
|
_a = window.threekit.configurator;
|
|
109
108
|
_b.label = 3;
|
|
@@ -111,9 +110,9 @@ var getSnapshots = function (cameras, snapshotConfig) { return __awaiter(void 0,
|
|
|
111
110
|
configurator = _a;
|
|
112
111
|
camerasMap = getCamerasMap(configurator, attributeName);
|
|
113
112
|
if (!camerasMap)
|
|
114
|
-
return [2
|
|
113
|
+
return [2, Promise.resolve([])];
|
|
115
114
|
snapshots = [];
|
|
116
|
-
return [2
|
|
115
|
+
return [2, cameras.reduce(function (snapshotPromise, camera) {
|
|
117
116
|
return snapshotPromise.then(function () {
|
|
118
117
|
return new Promise(function (resolve) { return __awaiter(void 0, void 0, void 0, function () {
|
|
119
118
|
var snapshotStr;
|
|
@@ -121,19 +120,19 @@ var getSnapshots = function (cameras, snapshotConfig) { return __awaiter(void 0,
|
|
|
121
120
|
return __generator(this, function (_b) {
|
|
122
121
|
switch (_b.label) {
|
|
123
122
|
case 0:
|
|
124
|
-
if (!camera) return [3
|
|
125
|
-
return [4
|
|
123
|
+
if (!camera) return [3, 2];
|
|
124
|
+
return [4, configurator.setConfiguration((_a = {},
|
|
126
125
|
_a[attributeName] = camerasMap[camera],
|
|
127
126
|
_a))];
|
|
128
127
|
case 1:
|
|
129
128
|
_b.sent();
|
|
130
129
|
_b.label = 2;
|
|
131
|
-
case 2: return [4
|
|
130
|
+
case 2: return [4, getSnapshot({ size: size, format: format })];
|
|
132
131
|
case 3:
|
|
133
132
|
snapshotStr = _b.sent();
|
|
134
133
|
snapshots.push(snapshotStr);
|
|
135
134
|
resolve(snapshots);
|
|
136
|
-
return [2
|
|
135
|
+
return [2];
|
|
137
136
|
}
|
|
138
137
|
});
|
|
139
138
|
}); });
|
|
@@ -142,7 +141,7 @@ var getSnapshots = function (cameras, snapshotConfig) { return __awaiter(void 0,
|
|
|
142
141
|
}
|
|
143
142
|
});
|
|
144
143
|
}); };
|
|
145
|
-
var Snapshots =
|
|
144
|
+
var Snapshots = (function () {
|
|
146
145
|
function Snapshots() {
|
|
147
146
|
var _this = this;
|
|
148
147
|
this.getSnapshot = getSnapshot;
|
|
@@ -157,34 +156,34 @@ var Snapshots = /** @class */ (function () {
|
|
|
157
156
|
format = (snapshotsConfig === null || snapshotsConfig === void 0 ? void 0 : snapshotsConfig.format) || DEFAULT_CAMERA_CONFIG.format;
|
|
158
157
|
attributeName = (snapshotsConfig === null || snapshotsConfig === void 0 ? void 0 : snapshotsConfig.attributeName) || DEFAULT_CAMERA_CONFIG.attributeName;
|
|
159
158
|
output = (snapshotsConfig === null || snapshotsConfig === void 0 ? void 0 : snapshotsConfig.output) || DEFAULT_CAMERA_CONFIG.output;
|
|
160
|
-
if (!(snapshotsConfig === null || snapshotsConfig === void 0 ? void 0 : snapshotsConfig.useStage)) return [3
|
|
161
|
-
return [4
|
|
159
|
+
if (!(snapshotsConfig === null || snapshotsConfig === void 0 ? void 0 : snapshotsConfig.useStage)) return [3, 2];
|
|
160
|
+
return [4, window.threekit.player.getStageConfigurator()];
|
|
162
161
|
case 1:
|
|
163
162
|
_a = _d.sent();
|
|
164
|
-
return [3
|
|
163
|
+
return [3, 3];
|
|
165
164
|
case 2:
|
|
166
165
|
_a = window.threekit.configurator;
|
|
167
166
|
_d.label = 3;
|
|
168
167
|
case 3:
|
|
169
168
|
configurator = _a;
|
|
170
169
|
cameras = Array.isArray(camerasList) ? camerasList : [camerasList];
|
|
171
|
-
if (!(cameras.length === 1 && cameras[0] === undefined)) return [3
|
|
172
|
-
return [4
|
|
170
|
+
if (!(cameras.length === 1 && cameras[0] === undefined)) return [3, 5];
|
|
171
|
+
return [4, this.getSnapshot({ size: size, format: format })];
|
|
173
172
|
case 4:
|
|
174
173
|
snapshotData = _d.sent();
|
|
175
174
|
snapshotsRaw = [snapshotData];
|
|
176
|
-
return [3
|
|
175
|
+
return [3, 8];
|
|
177
176
|
case 5:
|
|
178
177
|
camerasMap_1 = getCamerasMap(configurator, attributeName);
|
|
179
178
|
if (!camerasMap_1)
|
|
180
|
-
return [2
|
|
179
|
+
return [2, null];
|
|
181
180
|
cameras = cameras.filter(function (el) { return el === undefined || Object.keys(camerasMap_1).includes(el); });
|
|
182
181
|
currentCamera = getCameraValue(configurator, attributeName);
|
|
183
182
|
cameraPosition = (0, utils_1.getCameraPosition)(window.threekit.player.camera);
|
|
184
|
-
return [4
|
|
183
|
+
return [4, getSnapshots(cameras, snapshotsConfig)];
|
|
185
184
|
case 6:
|
|
186
185
|
snapshotsRaw = _d.sent();
|
|
187
|
-
return [4
|
|
186
|
+
return [4, configurator.setConfiguration((_c = {},
|
|
188
187
|
_c[attributeName] = currentCamera,
|
|
189
188
|
_c))];
|
|
190
189
|
case 7:
|
|
@@ -194,13 +193,13 @@ var Snapshots = /** @class */ (function () {
|
|
|
194
193
|
case 8:
|
|
195
194
|
_b = output;
|
|
196
195
|
switch (_b) {
|
|
197
|
-
case constants_1.SNAPSHOT_OUTPUTS.url: return [3
|
|
198
|
-
case constants_1.SNAPSHOT_OUTPUTS.download: return [3
|
|
199
|
-
case constants_1.SNAPSHOT_OUTPUTS.blob: return [3
|
|
200
|
-
case constants_1.SNAPSHOT_OUTPUTS.file: return [3
|
|
201
|
-
case constants_1.SNAPSHOT_OUTPUTS.dataUrl: return [3
|
|
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];
|
|
202
201
|
}
|
|
203
|
-
return [3
|
|
202
|
+
return [3, 14];
|
|
204
203
|
case 9:
|
|
205
204
|
attachments = snapshotsRaw.reduce(function (output, el, idx) {
|
|
206
205
|
var _a;
|
|
@@ -213,7 +212,7 @@ var Snapshots = /** @class */ (function () {
|
|
|
213
212
|
var file = (0, utils_1.dataURItoFile)(el, preppedFilename);
|
|
214
213
|
return Object.assign(output, (_a = {}, _a[cameraName] = file, _a));
|
|
215
214
|
}, {});
|
|
216
|
-
return [4
|
|
215
|
+
return [4, api_1.default.configurations.save({
|
|
217
216
|
assetId: window.threekit.player.assetId,
|
|
218
217
|
configuration: window.threekit.configurator.getConfiguration(),
|
|
219
218
|
attachments: attachments,
|
|
@@ -221,7 +220,7 @@ var Snapshots = /** @class */ (function () {
|
|
|
221
220
|
case 10:
|
|
222
221
|
response = _d.sent();
|
|
223
222
|
urlsArray = Object.values(response.data.attachments);
|
|
224
|
-
return [2
|
|
223
|
+
return [2, Promise.resolve(urlsArray)];
|
|
225
224
|
case 11:
|
|
226
225
|
snapshotsRaw.forEach(function (snapshotBlob, idx) {
|
|
227
226
|
var cameraName = (camerasList === null || camerasList === void 0 ? void 0 : camerasList[idx])
|
|
@@ -229,10 +228,10 @@ var Snapshots = /** @class */ (function () {
|
|
|
229
228
|
: '';
|
|
230
229
|
(0, utils_1.downloadSnapshot)(snapshotBlob, "".concat(filename).concat(cameraName, ".").concat(format));
|
|
231
230
|
});
|
|
232
|
-
return [2
|
|
231
|
+
return [2, Promise.resolve()];
|
|
233
232
|
case 12:
|
|
234
233
|
snapshotBlobs = snapshotsRaw.map(function (el) { return (0, utils_1.dataURItoBlob)(el); });
|
|
235
|
-
return [2
|
|
234
|
+
return [2, Promise.resolve(snapshotBlobs)];
|
|
236
235
|
case 13:
|
|
237
236
|
snapshotFiles = snapshotsRaw.map(function (el, idx) {
|
|
238
237
|
var cameraName = (camerasList === null || camerasList === void 0 ? void 0 : camerasList[idx])
|
|
@@ -240,8 +239,8 @@ var Snapshots = /** @class */ (function () {
|
|
|
240
239
|
: '';
|
|
241
240
|
return (0, utils_1.dataURItoFile)(el, "".concat(filename).concat(cameraName, ".").concat(format));
|
|
242
241
|
});
|
|
243
|
-
return [2
|
|
244
|
-
case 14: return [2
|
|
242
|
+
return [2, Promise.resolve(snapshotFiles)];
|
|
243
|
+
case 14: return [2, Promise.resolve(snapshotsRaw)];
|
|
245
244
|
}
|
|
246
245
|
});
|
|
247
246
|
}); };
|
package/dist/Treble/Treble.js
CHANGED
|
@@ -45,7 +45,7 @@ var constants_1 = require("../constants");
|
|
|
45
45
|
var utils_1 = require("../utils");
|
|
46
46
|
var Wishlist_1 = __importDefault(require("./Wishlist"));
|
|
47
47
|
var Snapshots_1 = __importDefault(require("./Snapshots"));
|
|
48
|
-
var Treble =
|
|
48
|
+
var Treble = (function () {
|
|
49
49
|
function Treble(_a) {
|
|
50
50
|
var player = _a.player, orgId = _a.orgId, initialConfiguration = _a.initialConfiguration;
|
|
51
51
|
var _this = this;
|
|
@@ -59,7 +59,7 @@ var Treble = /** @class */ (function () {
|
|
|
59
59
|
threekitDomain = connection_1.default.getConnection().threekitDomain;
|
|
60
60
|
_a = Object.assign({}, config), customerId = _a.customerId, metadata = _a.metadata, productVersion = _a.productVersion, attachments = _a.attachments;
|
|
61
61
|
player = window.threekit.player.enableApi('player');
|
|
62
|
-
return [4
|
|
62
|
+
return [4, api_1.default.configurations.save({
|
|
63
63
|
assetId: window.threekit.player.assetId,
|
|
64
64
|
configuration: player.getConfigurator().getFullConfiguration(),
|
|
65
65
|
customerId: customerId,
|
|
@@ -73,7 +73,7 @@ var Treble = /** @class */ (function () {
|
|
|
73
73
|
_b[constants_1.TK_SAVED_CONFIG_PARAM_KEY] = response.data.shortId,
|
|
74
74
|
_b));
|
|
75
75
|
url = window.location.href.replace(window.location.search, '');
|
|
76
|
-
return [2
|
|
76
|
+
return [2, Object.assign({
|
|
77
77
|
resumableUrl: "".concat(url).concat((0, utils_1.objectToQueryStr)(params)),
|
|
78
78
|
}, response.data, ((_c = response.data.thumbnail) === null || _c === void 0 ? void 0 : _c.length)
|
|
79
79
|
? {
|
|
@@ -120,7 +120,6 @@ var Treble = /** @class */ (function () {
|
|
|
120
120
|
}, { TemplateModel: templateData });
|
|
121
121
|
return api_1.default.server.sendEmail(data);
|
|
122
122
|
};
|
|
123
|
-
// Threekit API
|
|
124
123
|
this._api = api_1.default;
|
|
125
124
|
this.wishlist = (0, Wishlist_1.default)(orgId);
|
|
126
125
|
this._snapshots = new Snapshots_1.default();
|
package/dist/Treble/Wishlist.js
CHANGED
|
@@ -51,7 +51,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
51
51
|
var api_1 = __importDefault(require("../api"));
|
|
52
52
|
var constants_1 = require("../constants");
|
|
53
53
|
var wishlistData;
|
|
54
|
-
var Wishlist =
|
|
54
|
+
var Wishlist = (function () {
|
|
55
55
|
function Wishlist(orgId) {
|
|
56
56
|
var _this = this;
|
|
57
57
|
this.getWishlist = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -60,14 +60,14 @@ var Wishlist = /** @class */ (function () {
|
|
|
60
60
|
switch (_a.label) {
|
|
61
61
|
case 0:
|
|
62
62
|
if (wishlistData)
|
|
63
|
-
return [2
|
|
63
|
+
return [2, wishlistData];
|
|
64
64
|
wishlistListStr = localStorage.getItem(this._wishlistKey);
|
|
65
65
|
wishlistList = JSON.parse(wishlistListStr || '[]');
|
|
66
|
-
return [4
|
|
66
|
+
return [4, Promise.all(wishlistList.map(function (el) { return api_1.default.configurations.fetch(el); }))];
|
|
67
67
|
case 1:
|
|
68
68
|
wishlistDataRaw = _a.sent();
|
|
69
69
|
wishlistData = wishlistDataRaw.map(function (el) { return el.data; });
|
|
70
|
-
return [2
|
|
70
|
+
return [2, wishlistData];
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
73
|
}); };
|
|
@@ -80,25 +80,25 @@ var Wishlist = /** @class */ (function () {
|
|
|
80
80
|
wishlistData = [];
|
|
81
81
|
localStorage.setItem(this._wishlistKey, JSON.stringify([]));
|
|
82
82
|
}
|
|
83
|
-
return [4
|
|
83
|
+
return [4, window.threekit.treble.takeSnapshots(undefined, {
|
|
84
84
|
output: 'file',
|
|
85
85
|
filename: 'thumbnail',
|
|
86
86
|
})];
|
|
87
87
|
case 1:
|
|
88
88
|
thumbnails = (_a.sent());
|
|
89
|
-
return [4
|
|
89
|
+
return [4, window.threekit.treble.saveConfiguration({
|
|
90
90
|
attachments: { thumbnail: thumbnails[0] },
|
|
91
91
|
})];
|
|
92
92
|
case 2:
|
|
93
93
|
savedConfiguration = _a.sent();
|
|
94
94
|
if (!savedConfiguration)
|
|
95
|
-
return [2
|
|
95
|
+
return [2, wishlistData];
|
|
96
96
|
wishlistData = __spreadArray(__spreadArray([], wishlistData, true), [savedConfiguration], false);
|
|
97
97
|
wishlistListStr = localStorage.getItem(this._wishlistKey);
|
|
98
98
|
wishlistList = JSON.parse(wishlistListStr || '[]');
|
|
99
99
|
wishlistList.push(savedConfiguration.shortId);
|
|
100
100
|
localStorage.setItem(this._wishlistKey, JSON.stringify(wishlistList));
|
|
101
|
-
return [2
|
|
101
|
+
return [2, this.getWishlist()];
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
104
|
}); };
|
package/dist/api/catalog.js
CHANGED
|
@@ -52,20 +52,20 @@ var uploadAsset = function (file) { return __awaiter(void 0, void 0, void 0, fun
|
|
|
52
52
|
throw new Error(error);
|
|
53
53
|
formData = new FormData();
|
|
54
54
|
formData.append('files', file, file.name);
|
|
55
|
-
return [4
|
|
55
|
+
return [4, http_1.default.catalog.uploadAsset(formData)];
|
|
56
56
|
case 1:
|
|
57
57
|
uploadResponse = _a.sent();
|
|
58
58
|
jobId = uploadResponse.data[0].jobId;
|
|
59
59
|
count = 30;
|
|
60
60
|
_a.label = 2;
|
|
61
61
|
case 2:
|
|
62
|
-
if (!(count > 1 && !assetId)) return [3
|
|
63
|
-
return [4
|
|
62
|
+
if (!(count > 1 && !assetId)) return [3, 5];
|
|
63
|
+
return [4, new Promise(function (resolve) {
|
|
64
64
|
return setTimeout(function () { return resolve(undefined); }, 0.5 * 1000);
|
|
65
65
|
})];
|
|
66
66
|
case 3:
|
|
67
67
|
_a.sent();
|
|
68
|
-
return [4
|
|
68
|
+
return [4, http_1.default.catalog.getJobStatus(jobId)];
|
|
69
69
|
case 4:
|
|
70
70
|
checkRes = _a.sent();
|
|
71
71
|
++count;
|
|
@@ -78,8 +78,8 @@ var uploadAsset = function (file) { return __awaiter(void 0, void 0, void 0, fun
|
|
|
78
78
|
assetId = output.vector[0].assetId;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
return [3
|
|
82
|
-
case 5: return [2
|
|
81
|
+
return [3, 2];
|
|
82
|
+
case 5: return [2, assetId];
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
85
|
}); };
|
|
@@ -71,7 +71,7 @@ var save = function (saveConfig) { return __awaiter(void 0, void 0, void 0, func
|
|
|
71
71
|
});
|
|
72
72
|
fd.append('attachments', JSON.stringify(attachmentsPrepped_1));
|
|
73
73
|
}
|
|
74
|
-
return [2
|
|
74
|
+
return [2, http_1.default.configurations.postConfiguration(fd)];
|
|
75
75
|
});
|
|
76
76
|
}); };
|
|
77
77
|
exports.save = save;
|
|
@@ -89,11 +89,11 @@ var fetchAll = function () {
|
|
|
89
89
|
var configurations;
|
|
90
90
|
return __generator(this, function (_a) {
|
|
91
91
|
switch (_a.label) {
|
|
92
|
-
case 0: return [4
|
|
92
|
+
case 0: return [4, http_1.default.configurations.getConfigurations()];
|
|
93
93
|
case 1:
|
|
94
94
|
configurations = _a.sent();
|
|
95
95
|
resolve(configurations.data.configurations);
|
|
96
|
-
return [2
|
|
96
|
+
return [2];
|
|
97
97
|
}
|
|
98
98
|
});
|
|
99
99
|
}); });
|
package/dist/api/datatables.js
CHANGED
|
@@ -51,15 +51,15 @@ var getDatatable = function (datatableId, config) { return __awaiter(void 0, voi
|
|
|
51
51
|
if (!datatableId)
|
|
52
52
|
message = 'Requires a datatable ID';
|
|
53
53
|
if (message)
|
|
54
|
-
return [2
|
|
54
|
+
return [2, Promise.resolve(undefined)];
|
|
55
55
|
format = Object.assign({ format: constants_1.DATATABLE_FORMATS.json }, config).format;
|
|
56
|
-
return [4
|
|
56
|
+
return [4, http_1.default.datatables.getDatatable(datatableId)];
|
|
57
57
|
case 1:
|
|
58
58
|
response = _a.sent();
|
|
59
59
|
if (response.status !== 200)
|
|
60
|
-
return [2
|
|
60
|
+
return [2, Promise.resolve(undefined)];
|
|
61
61
|
if (format.toLowerCase() === constants_1.DATATABLE_FORMATS.csv)
|
|
62
|
-
return [2
|
|
62
|
+
return [2, Promise.resolve(response.data)];
|
|
63
63
|
csvData = response.data
|
|
64
64
|
.replace(/"/g, '')
|
|
65
65
|
.split('\n')
|
|
@@ -81,7 +81,7 @@ var getDatatable = function (datatableId, config) { return __awaiter(void 0, voi
|
|
|
81
81
|
output.push(rowOutput);
|
|
82
82
|
return output;
|
|
83
83
|
}, []);
|
|
84
|
-
return [2
|
|
84
|
+
return [2, Promise.resolve(datatableJson)];
|
|
85
85
|
}
|
|
86
86
|
});
|
|
87
87
|
}); };
|
package/dist/api/orders.js
CHANGED
|
@@ -44,15 +44,15 @@ var http_1 = __importDefault(require("../http"));
|
|
|
44
44
|
var connection_1 = __importDefault(require("../connection"));
|
|
45
45
|
var getOrder = function (orderId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
46
46
|
return __generator(this, function (_a) {
|
|
47
|
-
return [2
|
|
47
|
+
return [2, new Promise(function (resolve) { return __awaiter(void 0, void 0, void 0, function () {
|
|
48
48
|
var orders;
|
|
49
49
|
return __generator(this, function (_a) {
|
|
50
50
|
switch (_a.label) {
|
|
51
|
-
case 0: return [4
|
|
51
|
+
case 0: return [4, http_1.default.orders.getOrder(orderId)];
|
|
52
52
|
case 1:
|
|
53
53
|
orders = _a.sent();
|
|
54
54
|
resolve(orders.data);
|
|
55
|
-
return [2
|
|
55
|
+
return [2];
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
58
|
}); })];
|
|
@@ -61,11 +61,11 @@ var getOrder = function (orderId) { return __awaiter(void 0, void 0, void 0, fun
|
|
|
61
61
|
exports.getOrder = getOrder;
|
|
62
62
|
var fetchOrders = function (metadataQuery) { return __awaiter(void 0, void 0, void 0, function () {
|
|
63
63
|
return __generator(this, function (_a) {
|
|
64
|
-
return [2
|
|
64
|
+
return [2, new Promise(function (resolve) { return __awaiter(void 0, void 0, void 0, function () {
|
|
65
65
|
var orders, output, _a, key_1, value_1;
|
|
66
66
|
return __generator(this, function (_b) {
|
|
67
67
|
switch (_b.label) {
|
|
68
|
-
case 0: return [4
|
|
68
|
+
case 0: return [4, http_1.default.orders.fetchOrders()];
|
|
69
69
|
case 1:
|
|
70
70
|
orders = _b.sent();
|
|
71
71
|
output = orders.data.orders;
|
|
@@ -74,7 +74,7 @@ var fetchOrders = function (metadataQuery) { return __awaiter(void 0, void 0, vo
|
|
|
74
74
|
output = orders.data.orders.filter(function (order) { var _a; return ((_a = order.metadata) === null || _a === void 0 ? void 0 : _a[key_1]) === value_1; });
|
|
75
75
|
}
|
|
76
76
|
resolve(output);
|
|
77
|
-
return [2
|
|
77
|
+
return [2];
|
|
78
78
|
}
|
|
79
79
|
});
|
|
80
80
|
}); })];
|
|
@@ -83,7 +83,7 @@ var fetchOrders = function (metadataQuery) { return __awaiter(void 0, void 0, vo
|
|
|
83
83
|
exports.fetchOrders = fetchOrders;
|
|
84
84
|
var createOrder = function (order) { return __awaiter(void 0, void 0, void 0, function () {
|
|
85
85
|
return __generator(this, function (_a) {
|
|
86
|
-
return [2
|
|
86
|
+
return [2, new Promise(function (resolve) { return __awaiter(void 0, void 0, void 0, function () {
|
|
87
87
|
var orgId, name, cart, metadata, platform, status, data, createOrder;
|
|
88
88
|
return __generator(this, function (_a) {
|
|
89
89
|
switch (_a.label) {
|
|
@@ -98,11 +98,11 @@ var createOrder = function (order) { return __awaiter(void 0, void 0, void 0, fu
|
|
|
98
98
|
metadata: metadata || {},
|
|
99
99
|
status: status || 'List',
|
|
100
100
|
};
|
|
101
|
-
return [4
|
|
101
|
+
return [4, http_1.default.orders.createOrder(data)];
|
|
102
102
|
case 1:
|
|
103
103
|
createOrder = _a.sent();
|
|
104
104
|
resolve(createOrder.data);
|
|
105
|
-
return [2
|
|
105
|
+
return [2];
|
|
106
106
|
}
|
|
107
107
|
});
|
|
108
108
|
}); })];
|
|
@@ -111,7 +111,7 @@ var createOrder = function (order) { return __awaiter(void 0, void 0, void 0, fu
|
|
|
111
111
|
exports.createOrder = createOrder;
|
|
112
112
|
var editOrder = function (orderId, data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
113
113
|
return __generator(this, function (_a) {
|
|
114
|
-
return [2
|
|
114
|
+
return [2, new Promise(function (resolve) { return __awaiter(void 0, void 0, void 0, function () {
|
|
115
115
|
var cart;
|
|
116
116
|
return __generator(this, function (_a) {
|
|
117
117
|
switch (_a.label) {
|
|
@@ -120,11 +120,11 @@ var editOrder = function (orderId, data) { return __awaiter(void 0, void 0, void
|
|
|
120
120
|
throw new Error('Missing Order ID');
|
|
121
121
|
if (!data)
|
|
122
122
|
throw new Error('Missing New Cart data for Cart Order update.');
|
|
123
|
-
return [4
|
|
123
|
+
return [4, http_1.default.orders.editOrderCart(orderId, data)];
|
|
124
124
|
case 1:
|
|
125
125
|
cart = _a.sent();
|
|
126
126
|
resolve(cart.data);
|
|
127
|
-
return [2
|
|
127
|
+
return [2];
|
|
128
128
|
}
|
|
129
129
|
});
|
|
130
130
|
}); })];
|
package/dist/api/price.js
CHANGED
|
@@ -45,10 +45,10 @@ var getPricebooksList = function () { return __awaiter(void 0, void 0, void 0, f
|
|
|
45
45
|
var response;
|
|
46
46
|
return __generator(this, function (_a) {
|
|
47
47
|
switch (_a.label) {
|
|
48
|
-
case 0: return [4
|
|
48
|
+
case 0: return [4, http_1.default.pricebook.getList()];
|
|
49
49
|
case 1:
|
|
50
50
|
response = _a.sent();
|
|
51
|
-
return [2
|
|
51
|
+
return [2, response.data.pricebooks];
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
}); };
|
package/dist/api/products.js
CHANGED
|
@@ -46,7 +46,7 @@ var fetchTranslations = function () {
|
|
|
46
46
|
var translations, csvData, languages, translationMap;
|
|
47
47
|
return __generator(this, function (_a) {
|
|
48
48
|
switch (_a.label) {
|
|
49
|
-
case 0: return [4
|
|
49
|
+
case 0: return [4, http_1.default.products.getTranslations()];
|
|
50
50
|
case 1:
|
|
51
51
|
translations = _a.sent();
|
|
52
52
|
csvData = translations.data
|
|
@@ -68,7 +68,7 @@ var fetchTranslations = function () {
|
|
|
68
68
|
return output;
|
|
69
69
|
}, {});
|
|
70
70
|
resolve(translationMap);
|
|
71
|
-
return [2
|
|
71
|
+
return [2];
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
74
|
}); });
|
|
@@ -37,12 +37,7 @@ var AccordionItem = function (props) {
|
|
|
37
37
|
react_1.default.createElement("div", null, label),
|
|
38
38
|
react_1.default.createElement("div", null),
|
|
39
39
|
react_1.default.createElement("div", null,
|
|
40
|
-
react_1.default.createElement(CaretDown_1.default
|
|
41
|
-
// style={{
|
|
42
|
-
// transition: `all 0.3s`,
|
|
43
|
-
// transform: selected ? 'rotate(180deg)' : 'rotate(0)',
|
|
44
|
-
// }}
|
|
45
|
-
, null))),
|
|
40
|
+
react_1.default.createElement(CaretDown_1.default, null))),
|
|
46
41
|
react_1.default.createElement("div", null,
|
|
47
42
|
react_1.default.createElement("div", null, children))));
|
|
48
43
|
};
|
|
@@ -8,17 +8,8 @@ interface IAttributeTitle {
|
|
|
8
8
|
export declare const AttributeTitle: {
|
|
9
9
|
(props: IAttributeTitle): JSX.Element | null;
|
|
10
10
|
propTypes: {
|
|
11
|
-
/**
|
|
12
|
-
* The attribute's title/label displayed to the user
|
|
13
|
-
*/
|
|
14
11
|
attribute: PropTypes.Requireable<string>;
|
|
15
|
-
/**
|
|
16
|
-
* An override value to display instead of the attribute title.
|
|
17
|
-
*/
|
|
18
12
|
title: PropTypes.Requireable<string>;
|
|
19
|
-
/**
|
|
20
|
-
* Custom classNames applied to the HTML Element to apply custom CSS styling.
|
|
21
|
-
*/
|
|
22
13
|
className: PropTypes.Requireable<string>;
|
|
23
14
|
};
|
|
24
15
|
defaultProps: {
|
|
@@ -20,17 +20,8 @@ var AttributeTitle = function (props) {
|
|
|
20
20
|
};
|
|
21
21
|
exports.AttributeTitle = AttributeTitle;
|
|
22
22
|
exports.AttributeTitle.propTypes = {
|
|
23
|
-
/**
|
|
24
|
-
* The attribute's title/label displayed to the user
|
|
25
|
-
*/
|
|
26
23
|
attribute: prop_types_1.default.string,
|
|
27
|
-
/**
|
|
28
|
-
* An override value to display instead of the attribute title.
|
|
29
|
-
*/
|
|
30
24
|
title: prop_types_1.default.string,
|
|
31
|
-
/**
|
|
32
|
-
* Custom classNames applied to the HTML Element to apply custom CSS styling.
|
|
33
|
-
*/
|
|
34
25
|
className: prop_types_1.default.string,
|
|
35
26
|
};
|
|
36
27
|
exports.AttributeTitle.defaultProps = {
|
|
@@ -7,13 +7,7 @@ interface IAttributeValue {
|
|
|
7
7
|
export declare const AttributeValue: {
|
|
8
8
|
(props: IAttributeValue): JSX.Element | null;
|
|
9
9
|
propTypes: {
|
|
10
|
-
/**
|
|
11
|
-
* The attribute's title/label displayed to the user
|
|
12
|
-
*/
|
|
13
10
|
attribute: PropTypes.Requireable<string>;
|
|
14
|
-
/**
|
|
15
|
-
* Custom classNames applied to the HTML Element to apply custom CSS styling.
|
|
16
|
-
*/
|
|
17
11
|
className: PropTypes.Requireable<string>;
|
|
18
12
|
};
|
|
19
13
|
defaultProps: {
|
|
@@ -32,13 +32,7 @@ var AttributeValue = function (props) {
|
|
|
32
32
|
};
|
|
33
33
|
exports.AttributeValue = AttributeValue;
|
|
34
34
|
exports.AttributeValue.propTypes = {
|
|
35
|
-
/**
|
|
36
|
-
* The attribute's title/label displayed to the user
|
|
37
|
-
*/
|
|
38
35
|
attribute: prop_types_1.default.string,
|
|
39
|
-
/**
|
|
40
|
-
* Custom classNames applied to the HTML Element to apply custom CSS styling.
|
|
41
|
-
*/
|
|
42
36
|
className: prop_types_1.default.string,
|
|
43
37
|
};
|
|
44
38
|
exports.AttributeValue.defaultProps = {
|
|
@@ -25,39 +25,12 @@ export declare const SHAPES: {
|
|
|
25
25
|
export declare const Button: {
|
|
26
26
|
(props: IButton): JSX.Element | null;
|
|
27
27
|
propTypes: {
|
|
28
|
-
/**
|
|
29
|
-
* Used to add a title to the input
|
|
30
|
-
*/
|
|
31
28
|
title: PropTypes.Requireable<string>;
|
|
32
|
-
/**
|
|
33
|
-
* Threekit Icon to use as the prefix to the button title
|
|
34
|
-
*/
|
|
35
29
|
icon: PropTypes.Requireable<string>;
|
|
36
|
-
/**
|
|
37
|
-
* The presentational type of the input component. Options
|
|
38
|
-
* include: `hollow`, `standard`, `accent`, `primary`
|
|
39
|
-
*/
|
|
40
30
|
type: PropTypes.Requireable<string>;
|
|
41
|
-
/**
|
|
42
|
-
* Used to set the shape of the Button component. Options
|
|
43
|
-
* include: `square`, `round`
|
|
44
|
-
*/
|
|
45
31
|
shape: PropTypes.Requireable<string>;
|
|
46
|
-
/**
|
|
47
|
-
* NOTE: Input wide hide disabled will be deprecated in favour of option
|
|
48
|
-
* specific control of both 'disabled' and 'visible'.
|
|
49
|
-
*
|
|
50
|
-
* Used to hide the options that have the 'disabled' equal to true.
|
|
51
|
-
*/
|
|
52
32
|
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
53
|
-
/**
|
|
54
|
-
* Allows the Button's width to be set to 100%.
|
|
55
|
-
*/
|
|
56
33
|
fullWidth: PropTypes.Requireable<boolean>;
|
|
57
|
-
/**
|
|
58
|
-
*
|
|
59
|
-
* Used to add a custom class name to each of the components html elements
|
|
60
|
-
*/
|
|
61
34
|
className: PropTypes.Requireable<string>;
|
|
62
35
|
};
|
|
63
36
|
defaultProps: {
|
|
@@ -39,39 +39,12 @@ var Button = function (props) {
|
|
|
39
39
|
};
|
|
40
40
|
exports.Button = Button;
|
|
41
41
|
exports.Button.propTypes = {
|
|
42
|
-
/**
|
|
43
|
-
* Used to add a title to the input
|
|
44
|
-
*/
|
|
45
42
|
title: prop_types_1.default.string,
|
|
46
|
-
/**
|
|
47
|
-
* Threekit Icon to use as the prefix to the button title
|
|
48
|
-
*/
|
|
49
43
|
icon: prop_types_1.default.string,
|
|
50
|
-
/**
|
|
51
|
-
* The presentational type of the input component. Options
|
|
52
|
-
* include: `hollow`, `standard`, `accent`, `primary`
|
|
53
|
-
*/
|
|
54
44
|
type: prop_types_1.default.string,
|
|
55
|
-
/**
|
|
56
|
-
* Used to set the shape of the Button component. Options
|
|
57
|
-
* include: `square`, `round`
|
|
58
|
-
*/
|
|
59
45
|
shape: prop_types_1.default.string,
|
|
60
|
-
/**
|
|
61
|
-
* NOTE: Input wide hide disabled will be deprecated in favour of option
|
|
62
|
-
* specific control of both 'disabled' and 'visible'.
|
|
63
|
-
*
|
|
64
|
-
* Used to hide the options that have the 'disabled' equal to true.
|
|
65
|
-
*/
|
|
66
46
|
onClick: prop_types_1.default.func,
|
|
67
|
-
/**
|
|
68
|
-
* Allows the Button's width to be set to 100%.
|
|
69
|
-
*/
|
|
70
47
|
fullWidth: prop_types_1.default.bool,
|
|
71
|
-
/**
|
|
72
|
-
*
|
|
73
|
-
* Used to add a custom class name to each of the components html elements
|
|
74
|
-
*/
|
|
75
48
|
className: prop_types_1.default.string,
|
|
76
49
|
};
|
|
77
50
|
exports.Button.defaultProps = {
|