@threekit-tools/treble 0.0.49 → 0.0.53
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 +0 -26
- package/dist/Treble/Treble.d.ts +7 -2
- package/dist/Treble/Treble.js +20 -3
- package/dist/Treble/Wishlist.d.ts +3 -2
- package/dist/Treble/Wishlist.js +12 -12
- package/dist/api/catalog.d.ts +1 -0
- package/dist/api/catalog.js +86 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.js +2 -0
- package/dist/components/Accordion/index.d.ts +1 -1
- package/dist/components/FlatForm/index.js +9 -3
- package/dist/components/ThreekitProvider/index.d.ts +3 -1
- package/dist/components/ThreekitProvider/index.js +3 -3
- package/dist/components/Upload/index.d.ts +12 -0
- package/dist/components/Upload/index.js +114 -0
- package/dist/components/Upload/upload.styles.d.ts +6 -0
- package/dist/components/Upload/upload.styles.js +15 -0
- package/dist/components/containers/formInputContainer.d.ts +8 -16
- package/dist/components/formComponents.d.ts +2 -0
- package/dist/components/formComponents.js +5 -1
- package/dist/constants.d.ts +4 -0
- package/dist/constants.js +5 -1
- package/dist/hooks/useArrayAttribute/index.d.ts +2 -0
- package/dist/hooks/useArrayAttribute/index.js +184 -0
- package/dist/hooks/useAttribute/index.d.ts +3 -3
- package/dist/hooks/useAttribute/index.js +67 -8
- package/dist/hooks/useConfigurator/index.js +3 -3
- package/dist/hooks/useMetadata/index.js +2 -2
- package/dist/hooks/useName/index.js +2 -2
- package/dist/hooks/usePlayerLoadingStatus/index.js +2 -2
- package/dist/hooks/usePlayerPortal/index.js +2 -2
- package/dist/hooks/usePrice/index.d.ts +1 -1
- package/dist/hooks/usePrice/index.js +2 -2
- package/dist/hooks/useShare/index.js +2 -2
- package/dist/hooks/useSnapshot/index.js +2 -2
- package/dist/hooks/useThreekitInitStatus/index.js +2 -2
- package/dist/hooks/useWishlist/index.d.ts +1 -1
- package/dist/hooks/useWishlist/index.js +8 -7
- package/dist/http/catalog.d.ts +53 -2
- package/dist/http/catalog.js +3 -3
- package/dist/http/index.d.ts +2 -0
- package/dist/http/index.js +2 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -1
- package/dist/store/attributes.d.ts +20 -0
- package/dist/store/attributes.js +139 -0
- package/dist/store/index.d.ts +67 -7
- package/dist/store/index.js +36 -4
- package/dist/store/price.d.ts +33 -0
- package/dist/store/price.js +116 -0
- package/dist/store/product.d.ts +22 -0
- package/dist/store/product.js +65 -0
- package/dist/store/translations.d.ts +22 -0
- package/dist/store/translations.js +100 -0
- package/dist/store/treble.d.ts +41 -0
- package/dist/store/treble.js +259 -0
- package/dist/store/wishlist.d.ts +23 -0
- package/dist/store/wishlist.js +114 -0
- package/dist/threekit.d.ts +18 -3
- package/dist/utils.d.ts +4 -3
- package/package.json +1 -1
- package/dist/store/threekit.d.ts +0 -68
- package/dist/store/threekit.js +0 -453
|
@@ -18,7 +18,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
|
-
var _a, _b, _c;
|
|
21
|
+
var _a, _b, _c, _d;
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
23
|
exports.formComponents = void 0;
|
|
24
24
|
var constants_1 = require("../constants");
|
|
@@ -28,6 +28,7 @@ var Strips_1 = __importStar(require("./Strips"));
|
|
|
28
28
|
var Swatch_1 = __importStar(require("./Swatch"));
|
|
29
29
|
var Tiles_1 = __importStar(require("./Tiles"));
|
|
30
30
|
var TilesGroup_1 = __importStar(require("./TilesGroup"));
|
|
31
|
+
var Upload_1 = __importStar(require("./Upload"));
|
|
31
32
|
exports.formComponents = (_a = {},
|
|
32
33
|
_a[constants_1.ATTRIBUTE_TYPES.asset] = (_b = {},
|
|
33
34
|
// First option is default
|
|
@@ -47,5 +48,8 @@ exports.formComponents = (_a = {},
|
|
|
47
48
|
_c[Swatch_1.Swatch.componentName] = Swatch_1.default,
|
|
48
49
|
_c[TilesGroup_1.TilesGroup.componentName] = TilesGroup_1.default,
|
|
49
50
|
_c),
|
|
51
|
+
_a[constants_1.ASSET_TYPES.upload] = (_d = {},
|
|
52
|
+
_d[Upload_1.Upload.componentName] = Upload_1.default,
|
|
53
|
+
_d),
|
|
50
54
|
_a);
|
|
51
55
|
exports.default = exports.formComponents;
|
package/dist/constants.d.ts
CHANGED
package/dist/constants.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
****************************************************/
|
|
5
5
|
var _a;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.WISHLIST_LOCALSTORAGE_KEY = exports.SNAPSHOT_OUTPUTS = exports.SNAPSHOT_FORMATS = exports.METADATA_RESERVED = exports.ATTRIBUTES_RESERVED = exports.SORT_OPTIONS = 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.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;
|
|
8
8
|
exports.DEFAULT_CLASS_NAME = 'threekit-react';
|
|
9
9
|
exports.CLASS_NAME_PREFIX = 'tk';
|
|
10
10
|
exports.INPUT_COMPONENT_CLASS_NAME = "".concat(exports.DEFAULT_CLASS_NAME, " ").concat(exports.CLASS_NAME_PREFIX, "-input");
|
|
@@ -54,6 +54,10 @@ exports.ATTRIBUTE_TYPES = {
|
|
|
54
54
|
color: 'Color',
|
|
55
55
|
boolean: 'Boolean',
|
|
56
56
|
};
|
|
57
|
+
exports.ASSET_TYPES = {
|
|
58
|
+
item: 'item',
|
|
59
|
+
upload: 'upload',
|
|
60
|
+
};
|
|
57
61
|
exports.SORT_OPTIONS = {
|
|
58
62
|
ascending: 'ascending',
|
|
59
63
|
descending: 'descending',
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { useThreekitSelector, useThreekitDispatch } from '../../store';
|
|
3
|
+
// import { getAttributes, setConfiguration } from '../../store/attributes';
|
|
4
|
+
// import { selectionToConfiguration } from '../../utils';
|
|
5
|
+
// import {
|
|
6
|
+
// IConfigurationColor,
|
|
7
|
+
// ISetConfiguration,
|
|
8
|
+
// IThreekitDisplayAttribute,
|
|
9
|
+
// } from '../../threekit';
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.useArrayAttribute = void 0;
|
|
12
|
+
// export type AttributeValue = string | number | boolean | IConfigurationColor;
|
|
13
|
+
// type UseAttributeError = [undefined, undefined];
|
|
14
|
+
// type UseAttributeSuccess = [
|
|
15
|
+
// IThreekitDisplayAttribute,
|
|
16
|
+
// (val: AttributeValue) => void
|
|
17
|
+
// ];
|
|
18
|
+
var useArrayAttribute = function (attributeIdentifier) {
|
|
19
|
+
if (!attributeIdentifier)
|
|
20
|
+
return [];
|
|
21
|
+
return attributeIdentifier;
|
|
22
|
+
};
|
|
23
|
+
exports.useArrayAttribute = useArrayAttribute;
|
|
24
|
+
// Ordinal Configurator (Psuedo-Array type attribute)
|
|
25
|
+
// export const addItemToArray = (arrayLabel) => (
|
|
26
|
+
// assetId,
|
|
27
|
+
// addToIdx = undefined
|
|
28
|
+
// ) => async (dispatch, getState) => {
|
|
29
|
+
// if (!assetId?.length) return;
|
|
30
|
+
// const { threekit } = getState();
|
|
31
|
+
// const attributesRegExp = new RegExp(`${arrayLabel} [0-9]`);
|
|
32
|
+
// const arrayAttributes = filterAttributesArray(
|
|
33
|
+
// attributesRegExp,
|
|
34
|
+
// threekit.attributes
|
|
35
|
+
// );
|
|
36
|
+
// let updateAttrIdx = addToIdx;
|
|
37
|
+
// let attributeToUpdate;
|
|
38
|
+
// if (isNaN(updateAttrIdx))
|
|
39
|
+
// attributeToUpdate = Object.values(arrayAttributes).find((el, idx) => {
|
|
40
|
+
// if (!el.value.assetId?.length) {
|
|
41
|
+
// updateAttrIdx = idx;
|
|
42
|
+
// return true;
|
|
43
|
+
// }
|
|
44
|
+
// });
|
|
45
|
+
// else attributeToUpdate = arrayAttributes[updateAttrIdx];
|
|
46
|
+
// if (!attributeToUpdate) return message.info('Max items reached');
|
|
47
|
+
// let error;
|
|
48
|
+
// const options = Object.values(arrayAttributes)[0].values.reduce(
|
|
49
|
+
// (output, item) => Object.assign(output, { [item.assetId]: item }),
|
|
50
|
+
// {}
|
|
51
|
+
// );
|
|
52
|
+
// const updatedArray = Object.values(arrayAttributes).reduce(
|
|
53
|
+
// (output, attr, i) => {
|
|
54
|
+
// if (i !== updateAttrIdx) output.push(attr);
|
|
55
|
+
// else output.push({ ...attr, value: { assetId } });
|
|
56
|
+
// return output;
|
|
57
|
+
// },
|
|
58
|
+
// []
|
|
59
|
+
// );
|
|
60
|
+
// // Default Validator
|
|
61
|
+
// error = arrayValidator(options, updatedArray);
|
|
62
|
+
// if (error) return message.info(error);
|
|
63
|
+
// // Custom Validator
|
|
64
|
+
// if (MIDDLEWARE.arrayValidation?.[arrayLabel])
|
|
65
|
+
// error = MIDDLEWARE.arrayValidation?.[arrayLabel](options, updatedArray);
|
|
66
|
+
// if (error) return message.info(error);
|
|
67
|
+
// dispatch(setConfiguration({ [attributeToUpdate.name]: { assetId } }));
|
|
68
|
+
// };
|
|
69
|
+
// export const deleteItemFromArray = (arrayLabel) => (idx) => async (
|
|
70
|
+
// dispatch,
|
|
71
|
+
// getState
|
|
72
|
+
// ) => {
|
|
73
|
+
// if (isNaN(idx)) return;
|
|
74
|
+
// const { threekit } = getState();
|
|
75
|
+
// const attributesRegExp = new RegExp(`${arrayLabel} [0-9]`);
|
|
76
|
+
// const arrayAttributes = filterAttributesArray(
|
|
77
|
+
// attributesRegExp,
|
|
78
|
+
// threekit.attributes
|
|
79
|
+
// );
|
|
80
|
+
// let error;
|
|
81
|
+
// const options = Object.values(arrayAttributes)[0].values.reduce(
|
|
82
|
+
// (output, item) => Object.assign(output, { [item.assetId]: item }),
|
|
83
|
+
// {}
|
|
84
|
+
// );
|
|
85
|
+
// const updatedArray = Object.values(arrayAttributes).filter(
|
|
86
|
+
// (_, i) => i !== idx
|
|
87
|
+
// );
|
|
88
|
+
// // Default Validator
|
|
89
|
+
// error = arrayValidator(options, updatedArray);
|
|
90
|
+
// if (error) return message.info(error);
|
|
91
|
+
// // Custom Validator
|
|
92
|
+
// if (MIDDLEWARE.arrayValidation?.[arrayLabel])
|
|
93
|
+
// error = MIDDLEWARE.arrayValidation?.[arrayLabel](options, updatedArray);
|
|
94
|
+
// if (error) return message.info(error);
|
|
95
|
+
// const arrayConfigurationObj = filterAttributesArray(
|
|
96
|
+
// attributesRegExp,
|
|
97
|
+
// window.threekit.configurator.getConfiguration()
|
|
98
|
+
// );
|
|
99
|
+
// const arrayConfiguration = Object.entries(arrayConfigurationObj);
|
|
100
|
+
// const updatedConfiguration = arrayConfiguration.reduce(
|
|
101
|
+
// (output, [attributeName], i) => {
|
|
102
|
+
// if (i < idx) return output;
|
|
103
|
+
// if (!arrayConfiguration[i + 1])
|
|
104
|
+
// return Object.assign(output, { [attributeName]: { assetId: '' } });
|
|
105
|
+
// return Object.assign(output, {
|
|
106
|
+
// [attributeName]: arrayConfiguration[i + 1][1],
|
|
107
|
+
// });
|
|
108
|
+
// },
|
|
109
|
+
// {}
|
|
110
|
+
// );
|
|
111
|
+
// dispatch(setConfiguration(updatedConfiguration));
|
|
112
|
+
// };
|
|
113
|
+
// export const moveItemWithinArray = (arrayLabel) => (
|
|
114
|
+
// fromIdx,
|
|
115
|
+
// toIdx,
|
|
116
|
+
// config
|
|
117
|
+
// ) => async (dispatch, getState) => {
|
|
118
|
+
// if (isNaN(fromIdx) || isNaN(fromIdx)) return;
|
|
119
|
+
// const { threekit } = getState();
|
|
120
|
+
// const { method } = Object.assign({ method: 'move' }, config);
|
|
121
|
+
// const attributesRegExp =
|
|
122
|
+
// typeof arrayLabel === 'string'
|
|
123
|
+
// ? new RegExp(`${arrayLabel} [0-9]`)
|
|
124
|
+
// : arrayLabel;
|
|
125
|
+
// const arrayAttributes = filterAttributesArray(
|
|
126
|
+
// attributesRegExp,
|
|
127
|
+
// threekit.attributes
|
|
128
|
+
// );
|
|
129
|
+
// let error;
|
|
130
|
+
// const options = Object.values(arrayAttributes)[0].values.reduce(
|
|
131
|
+
// (output, item) => Object.assign(output, { [item.assetId]: item }),
|
|
132
|
+
// {}
|
|
133
|
+
// );
|
|
134
|
+
// let updatedArray;
|
|
135
|
+
// switch (method) {
|
|
136
|
+
// case 'move':
|
|
137
|
+
// updatedArray = Object.values(arrayAttributes).reduce(
|
|
138
|
+
// (output, attr, idx, srcArray) => {
|
|
139
|
+
// if (idx === fromIdx) return output;
|
|
140
|
+
// output.push(attr);
|
|
141
|
+
// if (idx === toIdx) output.push(srcArray[fromIdx]);
|
|
142
|
+
// return output;
|
|
143
|
+
// },
|
|
144
|
+
// []
|
|
145
|
+
// );
|
|
146
|
+
// break;
|
|
147
|
+
// default:
|
|
148
|
+
// break;
|
|
149
|
+
// }
|
|
150
|
+
// // Default Validator
|
|
151
|
+
// error = arrayValidator(options, updatedArray);
|
|
152
|
+
// if (error) return message.info(error);
|
|
153
|
+
// // Custom Validator
|
|
154
|
+
// if (MIDDLEWARE.arrayValidation?.[arrayLabel])
|
|
155
|
+
// error = MIDDLEWARE.arrayValidation?.[arrayLabel](options, updatedArray);
|
|
156
|
+
// if (error) return message.info(error);
|
|
157
|
+
// const arrayConfigurationObj = filterAttributesArray(
|
|
158
|
+
// attributesRegExp,
|
|
159
|
+
// window.threekit.configurator.getConfiguration()
|
|
160
|
+
// );
|
|
161
|
+
// const attributeKeys = Object.keys(arrayConfigurationObj);
|
|
162
|
+
// const arrayConfiguration = Object.values(arrayConfigurationObj);
|
|
163
|
+
// let updatedConfiguration;
|
|
164
|
+
// switch (method) {
|
|
165
|
+
// case 'move':
|
|
166
|
+
// updatedConfiguration = arrayConfiguration.reduce(
|
|
167
|
+
// (output, configuration, idx, srcArray) => {
|
|
168
|
+
// if (idx === fromIdx) return output;
|
|
169
|
+
// output = Object.assign(output, {
|
|
170
|
+
// [attributeKeys.shift()]: configuration,
|
|
171
|
+
// });
|
|
172
|
+
// if (idx === toIdx)
|
|
173
|
+
// output = Object.assign(output, {
|
|
174
|
+
// [attributeKeys.shift()]: srcArray[fromIdx],
|
|
175
|
+
// });
|
|
176
|
+
// return output;
|
|
177
|
+
// },
|
|
178
|
+
// {}
|
|
179
|
+
// );
|
|
180
|
+
// break;
|
|
181
|
+
// default:
|
|
182
|
+
// break;
|
|
183
|
+
// }
|
|
184
|
+
// dispatch(setConfiguration(updatedConfiguration));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare type
|
|
1
|
+
import { IThreekitDisplayAttribute, IConfigurationColor } from '../../threekit';
|
|
2
|
+
export declare type RawAttributeValue = string | number | boolean | IConfigurationColor | File;
|
|
3
3
|
declare type UseAttributeError = [undefined, undefined];
|
|
4
4
|
declare type UseAttributeSuccess = [
|
|
5
5
|
IThreekitDisplayAttribute,
|
|
6
|
-
(val:
|
|
6
|
+
(val: RawAttributeValue) => Promise<void>
|
|
7
7
|
];
|
|
8
8
|
declare type UseAttributeHook = UseAttributeError | UseAttributeSuccess;
|
|
9
9
|
declare const useAttribute: (attributeName?: string | undefined) => UseAttributeHook;
|
|
@@ -1,25 +1,84 @@
|
|
|
1
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
|
+
};
|
|
2
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
42
|
var store_1 = require("../../store");
|
|
4
|
-
var
|
|
43
|
+
var attributes_1 = require("../../store/attributes");
|
|
5
44
|
var utils_1 = require("../../utils");
|
|
45
|
+
var constants_1 = require("../../constants");
|
|
46
|
+
var api_1 = __importDefault(require("../../api"));
|
|
6
47
|
var useAttribute = function (attributeName) {
|
|
7
48
|
if (!attributeName)
|
|
8
49
|
return [undefined, undefined];
|
|
9
50
|
var dispatch = (0, store_1.useThreekitDispatch)();
|
|
10
|
-
var attributes = (0, store_1.useThreekitSelector)(
|
|
51
|
+
var attributes = (0, store_1.useThreekitSelector)(attributes_1.getAttributes);
|
|
11
52
|
if (!attributeName || !attributes)
|
|
12
53
|
return [undefined, undefined];
|
|
13
54
|
var attribute = attributes[attributeName];
|
|
14
55
|
if (!attribute)
|
|
15
56
|
return [undefined, undefined];
|
|
16
|
-
var handleChange = function (value) {
|
|
57
|
+
var handleChange = function (value) { return __awaiter(void 0, void 0, void 0, function () {
|
|
58
|
+
var preppedValue, assetId;
|
|
17
59
|
var _a;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
60
|
+
return __generator(this, function (_b) {
|
|
61
|
+
switch (_b.label) {
|
|
62
|
+
case 0:
|
|
63
|
+
if (!(attribute.type === 'Asset' &&
|
|
64
|
+
attribute.assetType === constants_1.ASSET_TYPES.upload)) return [3 /*break*/, 2];
|
|
65
|
+
return [4 /*yield*/, api_1.default.catalog.uploadAsset(value)];
|
|
66
|
+
case 1:
|
|
67
|
+
assetId = _b.sent();
|
|
68
|
+
if (assetId)
|
|
69
|
+
preppedValue = (0, utils_1.selectionToConfiguration)(assetId, attribute.type);
|
|
70
|
+
return [3 /*break*/, 3];
|
|
71
|
+
case 2:
|
|
72
|
+
preppedValue = (0, utils_1.selectionToConfiguration)(value, attribute.type);
|
|
73
|
+
_b.label = 3;
|
|
74
|
+
case 3:
|
|
75
|
+
dispatch((0, attributes_1.setConfiguration)((_a = {},
|
|
76
|
+
_a[attributeName] = preppedValue,
|
|
77
|
+
_a)));
|
|
78
|
+
return [2 /*return*/];
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}); };
|
|
23
82
|
return [attribute, handleChange];
|
|
24
83
|
};
|
|
25
84
|
exports.default = useAttribute;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var
|
|
3
|
+
var attributes_1 = require("../../store/attributes");
|
|
4
4
|
var store_1 = require("../../store");
|
|
5
5
|
var useConfigurator = function () {
|
|
6
6
|
var dispatch = (0, store_1.useThreekitDispatch)();
|
|
7
|
-
var attributes = (0, store_1.useThreekitSelector)(
|
|
7
|
+
var attributes = (0, store_1.useThreekitSelector)(attributes_1.getAttributes);
|
|
8
8
|
if (!attributes)
|
|
9
9
|
return [undefined, undefined];
|
|
10
10
|
var handleChange = function (configuration) {
|
|
11
|
-
return dispatch((0,
|
|
11
|
+
return dispatch((0, attributes_1.setConfiguration)(configuration));
|
|
12
12
|
};
|
|
13
13
|
return [attributes, handleChange];
|
|
14
14
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var store_1 = require("../../store");
|
|
4
|
-
var
|
|
4
|
+
var product_1 = require("../../store/product");
|
|
5
5
|
var useMetadata = function () {
|
|
6
|
-
var metadata = (0, store_1.useThreekitSelector)(
|
|
6
|
+
var metadata = (0, store_1.useThreekitSelector)(product_1.getMetadata);
|
|
7
7
|
return metadata;
|
|
8
8
|
};
|
|
9
9
|
exports.default = useMetadata;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var store_1 = require("../../store");
|
|
4
|
-
var
|
|
5
|
-
var useName = function () { return (0, store_1.useThreekitSelector)(
|
|
4
|
+
var product_1 = require("../../store/product");
|
|
5
|
+
var useName = function () { return (0, store_1.useThreekitSelector)(product_1.getName); };
|
|
6
6
|
exports.default = useName;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var store_1 = require("../../store");
|
|
4
|
-
var
|
|
4
|
+
var treble_1 = require("../../store/treble");
|
|
5
5
|
var usePlayerLoadingStatus = function () {
|
|
6
|
-
return (0, store_1.useThreekitSelector)(
|
|
6
|
+
return (0, store_1.useThreekitSelector)(treble_1.isPlayerLoading);
|
|
7
7
|
};
|
|
8
8
|
exports.default = usePlayerLoadingStatus;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var react_1 = require("react");
|
|
4
4
|
var react_redux_1 = require("react-redux");
|
|
5
|
-
var
|
|
5
|
+
var treble_1 = require("../../store/treble");
|
|
6
6
|
var constants_1 = require("../../constants");
|
|
7
7
|
var usePlayerPortal = function () {
|
|
8
8
|
var htmlElements = (0, react_1.useRef)({
|
|
@@ -10,7 +10,7 @@ var usePlayerPortal = function () {
|
|
|
10
10
|
playerLoader: null,
|
|
11
11
|
playerWrapper: null,
|
|
12
12
|
});
|
|
13
|
-
var playerElementId = (0, react_redux_1.useSelector)(
|
|
13
|
+
var playerElementId = (0, react_redux_1.useSelector)(treble_1.getPlayerElementId);
|
|
14
14
|
if (!playerElementId)
|
|
15
15
|
return [undefined, undefined];
|
|
16
16
|
var portalPlayerTo = function (toEl) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var store_1 = require("../../store");
|
|
4
|
-
var
|
|
5
|
-
var usePrice = function () { return (0, store_1.useThreekitSelector)(
|
|
4
|
+
var price_1 = require("../../store/price");
|
|
5
|
+
var usePrice = function () { return (0, store_1.useThreekitSelector)(price_1.getPrice); };
|
|
6
6
|
exports.default = usePrice;
|
|
@@ -40,11 +40,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
42
|
var store_1 = require("../../store");
|
|
43
|
-
var
|
|
43
|
+
var treble_1 = require("../../store/treble");
|
|
44
44
|
var message_1 = __importDefault(require("../../components/message"));
|
|
45
45
|
var utils_1 = require("../../utils");
|
|
46
46
|
var useShare = function () {
|
|
47
|
-
var isLoaded = (0, store_1.useThreekitSelector)(
|
|
47
|
+
var isLoaded = (0, store_1.useThreekitSelector)(treble_1.isThreekitInitialized);
|
|
48
48
|
if (!isLoaded)
|
|
49
49
|
return undefined;
|
|
50
50
|
var handleShare = function (msg) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var store_1 = require("../../store");
|
|
4
|
-
var
|
|
4
|
+
var treble_1 = require("../../store/treble");
|
|
5
5
|
var useSnapshot = function (cameras, config) {
|
|
6
|
-
var isLoaded = (0, store_1.useThreekitSelector)(
|
|
6
|
+
var isLoaded = (0, store_1.useThreekitSelector)(treble_1.isThreekitInitialized);
|
|
7
7
|
if (!isLoaded)
|
|
8
8
|
return undefined;
|
|
9
9
|
var takeSnapshot = function () {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var store_1 = require("../../store");
|
|
4
|
-
var
|
|
4
|
+
var treble_1 = require("../../store/treble");
|
|
5
5
|
var useThreekitInitStatus = function () {
|
|
6
|
-
return (0, store_1.useThreekitSelector)(
|
|
6
|
+
return (0, store_1.useThreekitSelector)(treble_1.isThreekitInitialized);
|
|
7
7
|
};
|
|
8
8
|
exports.default = useThreekitInitStatus;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ISaveConfigurationConfig, WishlistArray } from '../../Treble';
|
|
2
2
|
declare type UseWishlistHook = [
|
|
3
3
|
WishlistArray,
|
|
4
|
-
(config?: ISaveConfigurationConfig) =>
|
|
4
|
+
(config?: ISaveConfigurationConfig) => void,
|
|
5
5
|
(idx: number) => void,
|
|
6
6
|
(idx: number) => void,
|
|
7
7
|
(idx: number) => void,
|
|
@@ -3,25 +3,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var
|
|
6
|
+
var wishlist_1 = require("../../store/wishlist");
|
|
7
|
+
var treble_1 = require("../../store/treble");
|
|
7
8
|
var store_1 = require("../../store");
|
|
8
9
|
var utils_1 = require("../../utils");
|
|
9
10
|
var message_1 = __importDefault(require("../../components/message"));
|
|
10
11
|
var useWishlist = function () {
|
|
11
12
|
var dispatch = (0, store_1.useThreekitDispatch)();
|
|
12
|
-
var isLoaded = (0, store_1.useThreekitSelector)(
|
|
13
|
-
var wishlist = (0, store_1.useThreekitSelector)(
|
|
13
|
+
var isLoaded = (0, store_1.useThreekitSelector)(treble_1.isThreekitInitialized);
|
|
14
|
+
var wishlist = (0, store_1.useThreekitSelector)(wishlist_1.getWishlist);
|
|
14
15
|
if (!isLoaded)
|
|
15
16
|
return [undefined, undefined, undefined, undefined, undefined, undefined];
|
|
16
17
|
var handleAddToWishlist = function (config) {
|
|
17
|
-
return dispatch((0,
|
|
18
|
+
return dispatch((0, wishlist_1.addToWishlist)(config));
|
|
18
19
|
};
|
|
19
20
|
var handleRemoveFromWishlist = function (idx) {
|
|
20
|
-
dispatch((0,
|
|
21
|
+
dispatch((0, wishlist_1.removeFromWishlist)(idx));
|
|
21
22
|
message_1.default.info('Item removed from wishlist');
|
|
22
23
|
};
|
|
23
24
|
var handleResumeItem = function (idx) {
|
|
24
|
-
dispatch((0,
|
|
25
|
+
dispatch((0, wishlist_1.resumeFromWishlist)(idx));
|
|
25
26
|
};
|
|
26
27
|
var handleShareItem = function (idx) {
|
|
27
28
|
var url = (0, utils_1.getResumableUrl)(wishlist[idx].shortId);
|
|
@@ -29,7 +30,7 @@ var useWishlist = function () {
|
|
|
29
30
|
message_1.default.info('Link copied!');
|
|
30
31
|
};
|
|
31
32
|
var handleClearWishlist = function () {
|
|
32
|
-
dispatch(
|
|
33
|
+
dispatch(wishlist_1.clearWishlist);
|
|
33
34
|
};
|
|
34
35
|
return [
|
|
35
36
|
wishlist,
|
package/dist/http/catalog.d.ts
CHANGED
|
@@ -1,2 +1,53 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
1
|
+
export interface IJob {
|
|
2
|
+
createdAt: string;
|
|
3
|
+
createdBy: string;
|
|
4
|
+
duration: null;
|
|
5
|
+
id: string;
|
|
6
|
+
orgId: string;
|
|
7
|
+
parameters: {
|
|
8
|
+
files: Array<any>;
|
|
9
|
+
image: string;
|
|
10
|
+
};
|
|
11
|
+
priority: number;
|
|
12
|
+
schedulerState: string | 'active';
|
|
13
|
+
status: string | 'pending' | 'stopped';
|
|
14
|
+
taskCount: number;
|
|
15
|
+
taskProgress: null | number;
|
|
16
|
+
taskResultFailures: number;
|
|
17
|
+
taskResultSuccesses: number;
|
|
18
|
+
taskStatusPending: number;
|
|
19
|
+
taskStatusRunning: number;
|
|
20
|
+
taskStatusStopped: number;
|
|
21
|
+
tasks: Array<any>;
|
|
22
|
+
timeElapsed: string;
|
|
23
|
+
timeRemaining: string;
|
|
24
|
+
title: string;
|
|
25
|
+
type: string | 'import';
|
|
26
|
+
updatedAt: string;
|
|
27
|
+
}
|
|
28
|
+
export interface IUploadAsset {
|
|
29
|
+
name: string;
|
|
30
|
+
assetId: string;
|
|
31
|
+
}
|
|
32
|
+
export interface IUploadResponse {
|
|
33
|
+
job: IJob;
|
|
34
|
+
jobId: string;
|
|
35
|
+
msg: string;
|
|
36
|
+
}
|
|
37
|
+
export interface IJobResponse {
|
|
38
|
+
job: IJob;
|
|
39
|
+
output?: {
|
|
40
|
+
font: Array<any>;
|
|
41
|
+
lut: Array<any>;
|
|
42
|
+
material: Array<any>;
|
|
43
|
+
model: Array<any>;
|
|
44
|
+
scene: Array<any>;
|
|
45
|
+
texture: Array<IUploadAsset>;
|
|
46
|
+
upload: Array<any>;
|
|
47
|
+
vector: Array<IUploadAsset>;
|
|
48
|
+
vfb: Array<any>;
|
|
49
|
+
video: Array<any>;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export declare const uploadAsset: (formData: FormData) => Promise<import("axios").AxiosResponse<IUploadResponse[]>>;
|
|
53
|
+
export declare const getJobStatus: (jobId: string) => Promise<import("axios").AxiosResponse<IJobResponse>>;
|
package/dist/http/catalog.js
CHANGED
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getJobStatus = exports.uploadAsset = void 0;
|
|
7
7
|
var request_1 = __importDefault(require("./request"));
|
|
8
|
-
var
|
|
8
|
+
var CATALOG_API_ROUTE = "/api/catalog";
|
|
9
9
|
var uploadAsset = function (formData) {
|
|
10
10
|
var error;
|
|
11
11
|
if (!formData)
|
|
@@ -13,7 +13,7 @@ var uploadAsset = function (formData) {
|
|
|
13
13
|
if (error)
|
|
14
14
|
throw new Error(error);
|
|
15
15
|
return request_1.default.post({
|
|
16
|
-
url: "".concat(
|
|
16
|
+
url: "".concat(CATALOG_API_ROUTE, "/assets/upload"),
|
|
17
17
|
formData: formData,
|
|
18
18
|
});
|
|
19
19
|
};
|
|
@@ -24,6 +24,6 @@ var getJobStatus = function (jobId) {
|
|
|
24
24
|
error = 'Requires a jobId';
|
|
25
25
|
if (error)
|
|
26
26
|
throw new Error(error);
|
|
27
|
-
return request_1.default.get("".concat(
|
|
27
|
+
return request_1.default.get("".concat(CATALOG_API_ROUTE, "/jobs/").concat(jobId));
|
|
28
28
|
};
|
|
29
29
|
exports.getJobStatus = getJobStatus;
|
package/dist/http/index.d.ts
CHANGED
|
@@ -2,10 +2,12 @@ import * as orders from './orders';
|
|
|
2
2
|
import * as products from './products';
|
|
3
3
|
import * as configurations from './configurations';
|
|
4
4
|
import * as pricebook from './pricebook';
|
|
5
|
+
import * as catalog from './catalog';
|
|
5
6
|
declare const _default: {
|
|
6
7
|
orders: typeof orders;
|
|
7
8
|
products: typeof products;
|
|
8
9
|
configurations: typeof configurations;
|
|
9
10
|
pricebook: typeof pricebook;
|
|
11
|
+
catalog: typeof catalog;
|
|
10
12
|
};
|
|
11
13
|
export default _default;
|
package/dist/http/index.js
CHANGED
|
@@ -23,9 +23,11 @@ var orders = __importStar(require("./orders"));
|
|
|
23
23
|
var products = __importStar(require("./products"));
|
|
24
24
|
var configurations = __importStar(require("./configurations"));
|
|
25
25
|
var pricebook = __importStar(require("./pricebook"));
|
|
26
|
+
var catalog = __importStar(require("./catalog"));
|
|
26
27
|
exports.default = {
|
|
27
28
|
orders: orders,
|
|
28
29
|
products: products,
|
|
29
30
|
configurations: configurations,
|
|
30
31
|
pricebook: pricebook,
|
|
32
|
+
catalog: catalog,
|
|
31
33
|
};
|