@threekit-tools/treble 0.0.77 → 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.
- package/dist/Treble/Treble.d.ts +3 -2
- package/dist/Treble/Treble.js +2 -2
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +2 -1
- package/dist/store/index.js +7 -2
- package/dist/store/treble.js +4 -0
- package/dist/types.d.ts +1 -0
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +15 -1
- package/package.json +1 -1
package/dist/Treble/Treble.d.ts
CHANGED
|
@@ -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:
|
|
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;
|
package/dist/Treble/Treble.js
CHANGED
|
@@ -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
|
-
|
|
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
|
}());
|
package/dist/constants.d.ts
CHANGED
|
@@ -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");
|
package/dist/store/index.js
CHANGED
|
@@ -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:
|
|
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:
|
|
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;
|
package/dist/store/treble.js
CHANGED
|
@@ -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
package/dist/utils.d.ts
CHANGED
|
@@ -58,5 +58,6 @@ export declare const selectionToConfiguration: (value: RawAttributeValue, attrib
|
|
|
58
58
|
} | undefined;
|
|
59
59
|
export declare const filterFormAttributes: (attributes: Record<string, IThreekitDisplayAttribute>, attributeComponentProps: IAttributesComponentProps, includeReservedAttributes: boolean) => IThreekitDisplayAttribute[];
|
|
60
60
|
export declare const isUuid: (str?: string | undefined) => boolean;
|
|
61
|
+
export declare const runDebugger: () => Promise<void>;
|
|
61
62
|
export declare const loadTrebleConfig: () => Partial<ITrebleConfig>;
|
|
62
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.isIOS = 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) {
|
|
@@ -405,6 +405,20 @@ var isUuid = function (str) {
|
|
|
405
405
|
return check.test(str);
|
|
406
406
|
};
|
|
407
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;
|
|
408
422
|
var loadTrebleConfig = function () {
|
|
409
423
|
var config = {};
|
|
410
424
|
try {
|