@threekit-tools/treble 0.0.75 → 0.0.78

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.
@@ -9,6 +9,7 @@ export interface ITakeSnapshotsConfig {
9
9
  format?: string;
10
10
  size?: SnapshotSize;
11
11
  filename?: string;
12
+ useStage?: boolean;
12
13
  }
13
14
  interface IGetSnapshot {
14
15
  size: SnapshotSize;
@@ -16,13 +17,11 @@ interface IGetSnapshot {
16
17
  }
17
18
  interface ISnapshots {
18
19
  getSnapshot(snapshotConfig: IGetSnapshot): Promise<string>;
19
- getSnapshots(cameras: Array<string | undefined>, snapshotConfig: Pick<ITakeSnapshotsConfig, 'attributeName' | 'format' | 'size'>): Promise<Array<string>>;
20
20
  takeSnapshots(cameras: ISnapshotsCameras, config: ITakeSnapshotsConfig): Promise<void | string[] | Blob[] | null>;
21
21
  }
22
22
  declare class Snapshots implements ISnapshots {
23
23
  constructor();
24
24
  getSnapshot: ({ size, format }: IGetSnapshot) => Promise<string>;
25
- getSnapshots: (cameras: Array<string | undefined>, snapshotConfig: Pick<ITakeSnapshotsConfig, 'attributeName' | 'format' | 'size'>) => Promise<string[]>;
26
25
  takeSnapshots: (camerasList: ISnapshotsCameras, snapshotsConfig: ITakeSnapshotsConfig) => Promise<void | string[] | Blob[] | null>;
27
26
  }
28
27
  export default Snapshots;
@@ -49,22 +49,23 @@ var DEFAULT_CAMERA_CONFIG = {
49
49
  format: constants_1.SNAPSHOT_FORMATS.png,
50
50
  attributeName: constants_1.ATTRIBUTES_RESERVED.camera,
51
51
  output: constants_1.SNAPSHOT_OUTPUTS.blob,
52
+ useStage: false,
52
53
  };
53
54
  var cameraValues;
54
- var getCameraValue = function (cameraAttrName) {
55
+ var getCameraValue = function (configurator, cameraAttrName) {
55
56
  if (cameraAttrName === void 0) { cameraAttrName = constants_1.ATTRIBUTES_RESERVED.camera; }
56
- var attribute = window.threekit.configurator
57
+ var attribute = configurator
57
58
  .getDisplayAttributes()
58
59
  .find(function (el) { return el.name === cameraAttrName; });
59
60
  if (!attribute)
60
61
  return undefined;
61
62
  return attribute.value;
62
63
  };
63
- var getCamerasMap = function (cameraAttrName) {
64
+ var getCamerasMap = function (configurator, cameraAttrName) {
64
65
  if (cameraAttrName === void 0) { cameraAttrName = constants_1.ATTRIBUTES_RESERVED.camera; }
65
66
  if (cameraValues)
66
67
  return cameraValues;
67
- var attribute = window.threekit.configurator
68
+ var attribute = configurator
68
69
  .getDisplayAttributes()
69
70
  .find(function (el) { return el.name === cameraAttrName; });
70
71
  if (!attribute) {
@@ -83,97 +84,124 @@ var getCamerasMap = function (cameraAttrName) {
83
84
  }, {});
84
85
  return cameraValues;
85
86
  };
87
+ var getSnapshot = function (_a) {
88
+ var size = _a.size, format = _a.format;
89
+ return window.threekit.player.snapshotAsync({
90
+ size: size,
91
+ mimeType: "image/".concat(constants_1.SNAPSHOT_FORMATS[format]),
92
+ });
93
+ };
94
+ var getSnapshots = function (cameras, snapshotConfig) { return __awaiter(void 0, void 0, void 0, function () {
95
+ var attributeName, size, format, configurator, _a, camerasMap, snapshots;
96
+ return __generator(this, function (_b) {
97
+ switch (_b.label) {
98
+ case 0:
99
+ attributeName = snapshotConfig.attributeName || DEFAULT_CAMERA_CONFIG.attributeName;
100
+ size = snapshotConfig.size || DEFAULT_CAMERA_CONFIG.size;
101
+ format = snapshotConfig.format || DEFAULT_CAMERA_CONFIG.format;
102
+ if (!(snapshotConfig === null || snapshotConfig === void 0 ? void 0 : snapshotConfig.useStage)) return [3 /*break*/, 2];
103
+ return [4 /*yield*/, window.threekit.player.getStageConfigurator()];
104
+ case 1:
105
+ _a = _b.sent();
106
+ return [3 /*break*/, 3];
107
+ case 2:
108
+ _a = window.threekit.configurator;
109
+ _b.label = 3;
110
+ case 3:
111
+ configurator = _a;
112
+ camerasMap = getCamerasMap(configurator, attributeName);
113
+ if (!camerasMap)
114
+ return [2 /*return*/, Promise.resolve([])];
115
+ snapshots = [];
116
+ return [2 /*return*/, cameras.reduce(function (snapshotPromise, camera) {
117
+ return snapshotPromise.then(function () {
118
+ return new Promise(function (resolve) { return __awaiter(void 0, void 0, void 0, function () {
119
+ var snapshotStr;
120
+ var _a;
121
+ return __generator(this, function (_b) {
122
+ switch (_b.label) {
123
+ case 0:
124
+ if (!camera) return [3 /*break*/, 2];
125
+ return [4 /*yield*/, configurator.setConfiguration((_a = {},
126
+ _a[attributeName] = camerasMap[camera],
127
+ _a))];
128
+ case 1:
129
+ _b.sent();
130
+ _b.label = 2;
131
+ case 2: return [4 /*yield*/, getSnapshot({ size: size, format: format })];
132
+ case 3:
133
+ snapshotStr = _b.sent();
134
+ snapshots.push(snapshotStr);
135
+ resolve(snapshots);
136
+ return [2 /*return*/];
137
+ }
138
+ });
139
+ }); });
140
+ });
141
+ }, Promise.resolve(snapshots))];
142
+ }
143
+ });
144
+ }); };
86
145
  var Snapshots = /** @class */ (function () {
87
146
  function Snapshots() {
88
147
  var _this = this;
89
- this.getSnapshot = function (_a) {
90
- var size = _a.size, format = _a.format;
91
- return window.threekit.player.snapshotAsync({
92
- size: size,
93
- mimeType: "image/".concat(constants_1.SNAPSHOT_FORMATS[format]),
94
- });
95
- };
96
- this.getSnapshots = function (cameras, snapshotConfig) {
97
- var attributeName = snapshotConfig.attributeName || DEFAULT_CAMERA_CONFIG.attributeName;
98
- var size = snapshotConfig.size || DEFAULT_CAMERA_CONFIG.size;
99
- var format = snapshotConfig.format || DEFAULT_CAMERA_CONFIG.format;
100
- var camerasMap = getCamerasMap(attributeName);
101
- if (!camerasMap)
102
- return Promise.resolve([]);
103
- var snapshots = [];
104
- return cameras.reduce(function (snapshotPromise, camera) {
105
- return snapshotPromise.then(function () {
106
- return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
107
- var snapshotStr;
108
- var _a;
109
- return __generator(this, function (_b) {
110
- switch (_b.label) {
111
- case 0:
112
- if (!camera) return [3 /*break*/, 2];
113
- return [4 /*yield*/, window.threekit.configurator.setConfiguration((_a = {},
114
- _a[attributeName] = camerasMap[camera],
115
- _a))];
116
- case 1:
117
- _b.sent();
118
- _b.label = 2;
119
- case 2: return [4 /*yield*/, this.getSnapshot({ size: size, format: format })];
120
- case 3:
121
- snapshotStr = _b.sent();
122
- snapshots.push(snapshotStr);
123
- resolve(snapshots);
124
- return [2 /*return*/];
125
- }
126
- });
127
- }); });
128
- });
129
- }, Promise.resolve(snapshots));
130
- };
148
+ this.getSnapshot = getSnapshot;
131
149
  this.takeSnapshots = function (camerasList, snapshotsConfig) { return __awaiter(_this, void 0, void 0, function () {
132
- var filename, size, format, attributeName, output, cameras, snapshotsRaw, snapshotData, camerasMap_1, currentCamera, cameraPosition, _a, attachments, response, urlsArray, snapshotBlobs, snapshotFiles;
133
- var _b;
134
- return __generator(this, function (_c) {
135
- switch (_c.label) {
150
+ var filename, size, format, attributeName, output, configurator, _a, cameras, snapshotsRaw, snapshotData, camerasMap_1, currentCamera, cameraPosition, _b, attachments, response, urlsArray, snapshotBlobs, snapshotFiles;
151
+ var _c;
152
+ return __generator(this, function (_d) {
153
+ switch (_d.label) {
136
154
  case 0:
137
155
  filename = (snapshotsConfig === null || snapshotsConfig === void 0 ? void 0 : snapshotsConfig.filename) || DEFAULT_CAMERA_CONFIG.filename;
138
156
  size = (snapshotsConfig === null || snapshotsConfig === void 0 ? void 0 : snapshotsConfig.size) || DEFAULT_CAMERA_CONFIG.size;
139
157
  format = (snapshotsConfig === null || snapshotsConfig === void 0 ? void 0 : snapshotsConfig.format) || DEFAULT_CAMERA_CONFIG.format;
140
158
  attributeName = (snapshotsConfig === null || snapshotsConfig === void 0 ? void 0 : snapshotsConfig.attributeName) || DEFAULT_CAMERA_CONFIG.attributeName;
141
159
  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 /*break*/, 2];
161
+ return [4 /*yield*/, window.threekit.player.getStageConfigurator()];
162
+ case 1:
163
+ _a = _d.sent();
164
+ return [3 /*break*/, 3];
165
+ case 2:
166
+ _a = window.threekit.configurator;
167
+ _d.label = 3;
168
+ case 3:
169
+ configurator = _a;
142
170
  cameras = Array.isArray(camerasList) ? camerasList : [camerasList];
143
- if (!(cameras.length === 1 && cameras[0] === undefined)) return [3 /*break*/, 2];
171
+ if (!(cameras.length === 1 && cameras[0] === undefined)) return [3 /*break*/, 5];
144
172
  return [4 /*yield*/, this.getSnapshot({ size: size, format: format })];
145
- case 1:
146
- snapshotData = _c.sent();
173
+ case 4:
174
+ snapshotData = _d.sent();
147
175
  snapshotsRaw = [snapshotData];
148
- return [3 /*break*/, 5];
149
- case 2:
150
- camerasMap_1 = getCamerasMap(attributeName);
176
+ return [3 /*break*/, 8];
177
+ case 5:
178
+ camerasMap_1 = getCamerasMap(configurator, attributeName);
151
179
  if (!camerasMap_1)
152
180
  return [2 /*return*/, null];
153
181
  cameras = cameras.filter(function (el) { return el === undefined || Object.keys(camerasMap_1).includes(el); });
154
- currentCamera = getCameraValue(attributeName);
182
+ currentCamera = getCameraValue(configurator, attributeName);
155
183
  cameraPosition = (0, utils_1.getCameraPosition)(window.threekit.player.camera);
156
- return [4 /*yield*/, this.getSnapshots(cameras, camerasMap_1)];
157
- case 3:
158
- snapshotsRaw = _c.sent();
159
- return [4 /*yield*/, window.threekit.configurator.setConfiguration((_b = {},
160
- _b[attributeName] = currentCamera,
161
- _b))];
162
- case 4:
163
- _c.sent();
184
+ return [4 /*yield*/, getSnapshots(cameras, snapshotsConfig)];
185
+ case 6:
186
+ snapshotsRaw = _d.sent();
187
+ return [4 /*yield*/, configurator.setConfiguration((_c = {},
188
+ _c[attributeName] = currentCamera,
189
+ _c))];
190
+ case 7:
191
+ _d.sent();
164
192
  (0, utils_1.setCameraPosition)(window.threekit.player.camera, cameraPosition);
165
- _c.label = 5;
166
- case 5:
167
- _a = output;
168
- switch (_a) {
169
- case constants_1.SNAPSHOT_OUTPUTS.url: return [3 /*break*/, 6];
170
- case constants_1.SNAPSHOT_OUTPUTS.download: return [3 /*break*/, 8];
171
- case constants_1.SNAPSHOT_OUTPUTS.blob: return [3 /*break*/, 9];
172
- case constants_1.SNAPSHOT_OUTPUTS.file: return [3 /*break*/, 10];
173
- case constants_1.SNAPSHOT_OUTPUTS.dataUrl: return [3 /*break*/, 11];
193
+ _d.label = 8;
194
+ case 8:
195
+ _b = output;
196
+ switch (_b) {
197
+ case constants_1.SNAPSHOT_OUTPUTS.url: return [3 /*break*/, 9];
198
+ case constants_1.SNAPSHOT_OUTPUTS.download: return [3 /*break*/, 11];
199
+ case constants_1.SNAPSHOT_OUTPUTS.blob: return [3 /*break*/, 12];
200
+ case constants_1.SNAPSHOT_OUTPUTS.file: return [3 /*break*/, 13];
201
+ case constants_1.SNAPSHOT_OUTPUTS.dataUrl: return [3 /*break*/, 14];
174
202
  }
175
- return [3 /*break*/, 11];
176
- case 6:
203
+ return [3 /*break*/, 14];
204
+ case 9:
177
205
  attachments = snapshotsRaw.reduce(function (output, el, idx) {
178
206
  var _a;
179
207
  var cameraName = (camerasList === null || camerasList === void 0 ? void 0 : camerasList[idx])
@@ -190,11 +218,11 @@ var Snapshots = /** @class */ (function () {
190
218
  configuration: window.threekit.configurator.getConfiguration(),
191
219
  attachments: attachments,
192
220
  })];
193
- case 7:
194
- response = _c.sent();
221
+ case 10:
222
+ response = _d.sent();
195
223
  urlsArray = Object.values(response.data.attachments);
196
224
  return [2 /*return*/, Promise.resolve(urlsArray)];
197
- case 8:
225
+ case 11:
198
226
  snapshotsRaw.forEach(function (snapshotBlob, idx) {
199
227
  var cameraName = (camerasList === null || camerasList === void 0 ? void 0 : camerasList[idx])
200
228
  ? "-".concat((0, utils_1.regularToKebabCase)(camerasList[idx] || 'default'))
@@ -202,10 +230,10 @@ var Snapshots = /** @class */ (function () {
202
230
  (0, utils_1.downloadSnapshot)(snapshotBlob, "".concat(filename).concat(cameraName, ".").concat(format));
203
231
  });
204
232
  return [2 /*return*/, Promise.resolve()];
205
- case 9:
233
+ case 12:
206
234
  snapshotBlobs = snapshotsRaw.map(function (el) { return (0, utils_1.dataURItoBlob)(el); });
207
235
  return [2 /*return*/, Promise.resolve(snapshotBlobs)];
208
- case 10:
236
+ case 13:
209
237
  snapshotFiles = snapshotsRaw.map(function (el, idx) {
210
238
  var cameraName = (camerasList === null || camerasList === void 0 ? void 0 : camerasList[idx])
211
239
  ? "-".concat((0, utils_1.regularToKebabCase)(camerasList[idx] || 'default'))
@@ -213,7 +241,7 @@ var Snapshots = /** @class */ (function () {
213
241
  return (0, utils_1.dataURItoFile)(el, "".concat(filename).concat(cameraName, ".").concat(format));
214
242
  });
215
243
  return [2 /*return*/, Promise.resolve(snapshotFiles)];
216
- case 11: return [2 /*return*/, Promise.resolve(snapshotsRaw)];
244
+ case 14: return [2 /*return*/, Promise.resolve(snapshotsRaw)];
217
245
  }
218
246
  });
219
247
  }); };
@@ -1,4 +1,4 @@
1
- import { IThreekitPlayer, IConfiguration, ISetConfiguration, IThreekitPrivateConfigurator } from '../types';
1
+ import { IThreekitPlayer, IThreekitPrivatePlayer, IConfiguration, ISetConfiguration, IThreekitPrivateConfigurator } from '../types';
2
2
  import { IWishlist } from './Wishlist';
3
3
  import Snapshots from './Snapshots';
4
4
  import { ISaveConfiguration } from '../api/configurations';
@@ -13,11 +13,12 @@ interface IEmailShareCredentials {
13
13
  templateId: string;
14
14
  }
15
15
  declare class Treble {
16
- _player: IThreekitPlayer;
16
+ _player: IThreekitPrivatePlayer;
17
17
  wishlist: IWishlist;
18
18
  private _initialConfiguration;
19
19
  private _snapshots;
20
20
  takeSnapshots: Snapshots['takeSnapshots'];
21
+ _debugMode: boolean;
21
22
  constructor({ player, orgId, initialConfiguration }: ITreble);
22
23
  saveConfiguration: (config?: Omit<ISaveConfiguration, "configuration"> | undefined) => Promise<{
23
24
  resumableUrl: string;
@@ -121,12 +121,12 @@ var Treble = /** @class */ (function () {
121
121
  return api_1.default.server.sendEmail(data);
122
122
  };
123
123
  // Threekit API
124
- this._player = player;
125
124
  this.wishlist = (0, Wishlist_1.default)(orgId);
126
125
  this._snapshots = new Snapshots_1.default();
127
126
  this.takeSnapshots = this._snapshots.takeSnapshots;
128
- // this._player = player.enableApi('player');
127
+ this._player = player.enableApi('player');
129
128
  this._initialConfiguration = JSON.stringify(initialConfiguration);
129
+ this._debugMode = constants_1.TREBLE_DEBUG;
130
130
  }
131
131
  return Treble;
132
132
  }());
@@ -1,6 +1,7 @@
1
1
  /*****************************************************
2
2
  * Treble Config
3
3
  ****************************************************/
4
+ export declare const TREBLE_DEBUG: boolean;
4
5
  export declare const DEFAULT_CLASS_NAME = "threekit-react";
5
6
  export declare const CLASS_NAME_PREFIX = "tk";
6
7
  export declare const INPUT_COMPONENT_CLASS_NAME: string;
package/dist/constants.js CHANGED
@@ -4,7 +4,8 @@
4
4
  ****************************************************/
5
5
  var _a;
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.DATATABLE_FORMATS = exports.WISHLIST_LOCALSTORAGE_KEY = exports.SNAPSHOT_OUTPUTS = exports.SNAPSHOT_FORMATS = exports.METADATA_RESERVED = exports.ATTRIBUTES_RESERVED = exports.SORT_OPTIONS = exports.ASSET_TYPES = exports.ATTRIBUTE_TYPES = exports.DEFAULT_PLAYER_CONFIG = exports.TK_PLAYER_ROOT_DIV = exports.TK_PLAYER_LOADER_DIV = exports.TK_SAVED_CONFIG_PARAM_KEY = exports.TK_PRODUCT_ID_PARAM_KEY = exports.IS_TREBLE_SCRIPTS = exports.FORM_CLASS_NAME = exports.DISPLAY_CLASS_NAME = exports.TOOL_CLASS_NAME = exports.LAYOUT_CLASS_NAME = exports.WIDGET_CLASS_NAME = exports.INPUT_COMPONENT_CLASS_NAME = exports.CLASS_NAME_PREFIX = exports.DEFAULT_CLASS_NAME = void 0;
7
+ exports.DATATABLE_FORMATS = exports.WISHLIST_LOCALSTORAGE_KEY = exports.SNAPSHOT_OUTPUTS = exports.SNAPSHOT_FORMATS = exports.METADATA_RESERVED = exports.ATTRIBUTES_RESERVED = exports.SORT_OPTIONS = exports.ASSET_TYPES = exports.ATTRIBUTE_TYPES = exports.DEFAULT_PLAYER_CONFIG = exports.TK_PLAYER_ROOT_DIV = exports.TK_PLAYER_LOADER_DIV = exports.TK_SAVED_CONFIG_PARAM_KEY = exports.TK_PRODUCT_ID_PARAM_KEY = exports.IS_TREBLE_SCRIPTS = exports.FORM_CLASS_NAME = exports.DISPLAY_CLASS_NAME = exports.TOOL_CLASS_NAME = exports.LAYOUT_CLASS_NAME = exports.WIDGET_CLASS_NAME = exports.INPUT_COMPONENT_CLASS_NAME = exports.CLASS_NAME_PREFIX = exports.DEFAULT_CLASS_NAME = exports.TREBLE_DEBUG = void 0;
8
+ exports.TREBLE_DEBUG = !!process.env.TREBLE_DEBUG;
8
9
  exports.DEFAULT_CLASS_NAME = 'threekit-react';
9
10
  exports.CLASS_NAME_PREFIX = 'tk';
10
11
  exports.INPUT_COMPONENT_CLASS_NAME = "".concat(exports.DEFAULT_CLASS_NAME, " ").concat(exports.CLASS_NAME_PREFIX, "-input");
@@ -65,7 +65,7 @@ var useNestedConfigurator = function (address) {
65
65
  setAttributes(updatedAttrs);
66
66
  metadataRef.current = configurator.current.getMetadata();
67
67
  })();
68
- }, [address, hasInitialized, playerLoading]);
68
+ }, [JSON.stringify(address), hasInitialized, playerLoading]);
69
69
  if (!hasInitialized || !configurator.current || !attributes)
70
70
  return [undefined, undefined, undefined, undefined];
71
71
  var handleSelect = function (config) { return __awaiter(void 0, void 0, void 0, function () {
@@ -18,6 +18,7 @@ exports.useThreekitSelector = exports.useThreekitDispatch = exports.createStore
18
18
  var toolkit_1 = require("@reduxjs/toolkit");
19
19
  var react_redux_1 = require("react-redux");
20
20
  var redux_logger_1 = __importDefault(require("redux-logger"));
21
+ var constants_1 = require("../constants");
21
22
  var treble_1 = __importDefault(require("./treble"));
22
23
  var product_1 = __importDefault(require("./product"));
23
24
  var attributes_1 = __importDefault(require("./attributes"));
@@ -33,14 +34,18 @@ var store = (0, toolkit_1.configureStore)({
33
34
  wishlist: wishlist_1.default,
34
35
  price: price_1.default,
35
36
  },
36
- middleware: function (getDefaultMiddleware) { return getDefaultMiddleware().concat(redux_logger_1.default); },
37
+ middleware: constants_1.TREBLE_DEBUG
38
+ ? function (getDefaultMiddleware) { return getDefaultMiddleware().concat(redux_logger_1.default); }
39
+ : function (getDefaultMiddleware) { return getDefaultMiddleware(); },
37
40
  });
38
41
  var createStore = function (reducer) {
39
42
  if (!reducer)
40
43
  return store;
41
44
  return (0, toolkit_1.configureStore)({
42
45
  reducer: __assign(__assign({}, reducer), { treble: treble_1.default, product: product_1.default, attributes: attributes_1.default, translations: translations_1.default, wishlist: wishlist_1.default, price: price_1.default }),
43
- middleware: function (getDefaultMiddleware) { return getDefaultMiddleware().concat(redux_logger_1.default); },
46
+ middleware: constants_1.TREBLE_DEBUG
47
+ ? function (getDefaultMiddleware) { return getDefaultMiddleware().concat(redux_logger_1.default); }
48
+ : function (getDefaultMiddleware) { return getDefaultMiddleware(); },
44
49
  });
45
50
  };
46
51
  exports.createStore = createStore;
@@ -200,6 +200,8 @@ var initPlayer = function (config) {
200
200
  };
201
201
  dispatch((0, exports.setThreekitInitialized)(true));
202
202
  dispatch((0, exports.setPlayerLoading)(false));
203
+ if (window.threekit.treble._debugMode)
204
+ (0, utils_1.runDebugger)();
203
205
  window.threekit.player.on('setConfiguration', function () { return __awaiter(void 0, void 0, void 0, function () {
204
206
  var attributes, previousAttributes, updatedAttributes;
205
207
  var _a;
@@ -209,6 +211,8 @@ var initPlayer = function (config) {
209
211
  attributes = getState().attributes;
210
212
  previousAttributes = Object.values(attributes);
211
213
  updatedAttributes = window.threekit.configurator.getDisplayAttributes();
214
+ if (window.threekit.treble._debugMode)
215
+ (0, utils_1.runDebugger)();
212
216
  dispatch((0, attributes_1.setAttributes)(updatedAttributes));
213
217
  return [4 /*yield*/, ((_a = EVENTS.postConfigurationChange) === null || _a === void 0 ? void 0 : _a.call(EVENTS, updatedAttributes, {}, previousAttributes))];
214
218
  case 1:
package/dist/types.d.ts CHANGED
@@ -218,6 +218,7 @@ export interface IThreekitPlayer {
218
218
  setActiveCamera: () => void;
219
219
  on: (phase: SCENE_PHASES | string, callback: (args: any) => void) => void;
220
220
  getConfigurator: () => Promise<IThreekitConfigurator>;
221
+ getStageConfigurator: () => Promise<IThreekitConfigurator>;
221
222
  enableApi: (api: PRIVATE_APIS) => any;
222
223
  snapshotAsync: (snapshotConfig: ISnapshotConfig) => Promise<string>;
223
224
  unload: () => Promise<string>;
@@ -230,6 +231,7 @@ export interface IThreekitPrivatePlayer {
230
231
  configurator: {
231
232
  getFullConfiguration: () => IConfiguration;
232
233
  };
234
+ calculateLogs: () => Promise<Record<string, any>>;
233
235
  }
234
236
  export interface ThreekitInitConfig {
235
237
  authToken: string;
package/dist/utils.d.ts CHANGED
@@ -22,6 +22,7 @@ export declare const generateLayoutClassName: (component: string, customClassNam
22
22
  export declare const generateToolClassName: (component: string, customClassName?: string | undefined, title?: string | undefined) => string;
23
23
  export declare const generateDisplayClassName: (component: string, customClassName?: string | undefined, title?: string | undefined) => string;
24
24
  export declare const generateFormClassName: (component: string, customClassName?: string | undefined, title?: string | undefined) => string;
25
+ export declare const isIOS: () => RegExpMatchArray | null;
25
26
  export declare const isJsonString: (str: string) => boolean;
26
27
  export declare const objectToQueryStr: (obj: Record<string, any>) => string;
27
28
  export declare const getParams: () => Record<string, string | {
@@ -57,5 +58,6 @@ export declare const selectionToConfiguration: (value: RawAttributeValue, attrib
57
58
  } | undefined;
58
59
  export declare const filterFormAttributes: (attributes: Record<string, IThreekitDisplayAttribute>, attributeComponentProps: IAttributesComponentProps, includeReservedAttributes: boolean) => IThreekitDisplayAttribute[];
59
60
  export declare const isUuid: (str?: string | undefined) => boolean;
61
+ export declare const runDebugger: () => Promise<void>;
60
62
  export declare const loadTrebleConfig: () => Partial<ITrebleConfig>;
61
63
  export {};
package/dist/utils.js CHANGED
@@ -45,7 +45,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
45
45
  return to.concat(ar || Array.prototype.slice.call(from));
46
46
  };
47
47
  Object.defineProperty(exports, "__esModule", { value: true });
48
- exports.loadTrebleConfig = exports.isUuid = exports.filterFormAttributes = exports.selectionToConfiguration = exports.hydrateAttribute = exports.metadataValueToObject = exports.easeInOutCubic = exports.copyToClipboard = exports.downloadSnapshot = exports.dataURItoFile = exports.dataURItoBlob = exports.setCameraPosition = exports.getCameraPosition = exports.findHitNode = exports.deflateRgb = exports.inflateRgb = exports.rgbToHex = exports.hexToRgb = exports.regularToKebabCase = exports.deepCompare = exports.shallowCompare = exports.getResumableUrl = exports.getParams = exports.objectToQueryStr = exports.isJsonString = exports.generateFormClassName = exports.generateDisplayClassName = exports.generateToolClassName = exports.generateLayoutClassName = exports.generateWidgetClassName = exports.generateInputClassName = exports.generateClassName = void 0;
48
+ exports.loadTrebleConfig = exports.runDebugger = exports.isUuid = exports.filterFormAttributes = exports.selectionToConfiguration = exports.hydrateAttribute = exports.metadataValueToObject = exports.easeInOutCubic = exports.copyToClipboard = exports.downloadSnapshot = exports.dataURItoFile = exports.dataURItoBlob = exports.setCameraPosition = exports.getCameraPosition = exports.findHitNode = exports.deflateRgb = exports.inflateRgb = exports.rgbToHex = exports.hexToRgb = exports.regularToKebabCase = exports.deepCompare = exports.shallowCompare = exports.getResumableUrl = exports.getParams = exports.objectToQueryStr = exports.isJsonString = exports.isIOS = exports.generateFormClassName = exports.generateDisplayClassName = exports.generateToolClassName = exports.generateLayoutClassName = exports.generateWidgetClassName = exports.generateInputClassName = exports.generateClassName = void 0;
49
49
  var constants_1 = require("./constants");
50
50
  var generateClassName = function (baseClass) {
51
51
  return function (component, customClassName, title) {
@@ -65,6 +65,8 @@ exports.generateLayoutClassName = (0, exports.generateClassName)(constants_1.LAY
65
65
  exports.generateToolClassName = (0, exports.generateClassName)(constants_1.TOOL_CLASS_NAME);
66
66
  exports.generateDisplayClassName = (0, exports.generateClassName)(constants_1.DISPLAY_CLASS_NAME);
67
67
  exports.generateFormClassName = (0, exports.generateClassName)(constants_1.FORM_CLASS_NAME);
68
+ var isIOS = function () { return navigator.userAgent.match(/ipad|iphone/i); };
69
+ exports.isIOS = isIOS;
68
70
  var isJsonString = function (str) {
69
71
  try {
70
72
  JSON.parse(str);
@@ -403,6 +405,20 @@ var isUuid = function (str) {
403
405
  return check.test(str);
404
406
  };
405
407
  exports.isUuid = isUuid;
408
+ var runDebugger = function () { return __awaiter(void 0, void 0, void 0, function () {
409
+ var logs;
410
+ return __generator(this, function (_a) {
411
+ switch (_a.label) {
412
+ case 0: return [4 /*yield*/, window.threekit.treble._player.calculateLogs()];
413
+ case 1:
414
+ logs = _a.sent();
415
+ if (logs.length)
416
+ console.log("Threekit Debugger: \n", logs);
417
+ return [2 /*return*/];
418
+ }
419
+ });
420
+ }); };
421
+ exports.runDebugger = runDebugger;
406
422
  var loadTrebleConfig = function () {
407
423
  var config = {};
408
424
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threekit-tools/treble",
3
- "version": "0.0.75",
3
+ "version": "0.0.78",
4
4
  "author": "Amaan Saeed",
5
5
  "license": "MIT",
6
6
  "files": [