@threekit-tools/treble 0.0.42 → 0.0.46
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/components/ThreekitProvider/index.js +1 -1
- package/dist/hooks/useAttribute/index.d.ts +1 -1
- package/dist/hooks/useAttribute/index.js +0 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/store/threekit.d.ts +1 -1
- package/dist/store/threekit.js +9 -6
- package/dist/threekit.d.ts +1 -0
- package/dist/utils.d.ts +3 -3
- package/dist/utils.js +0 -2
- package/package.json +1 -1
|
@@ -45,6 +45,6 @@ var ThreekitProvider = function (props) {
|
|
|
45
45
|
return (react_1.default.createElement(react_redux_1.Provider, { store: store_1.default },
|
|
46
46
|
react_1.default.createElement(styled_components_1.ThemeProvider, { theme: theme_1.default },
|
|
47
47
|
react_1.default.createElement(GlobalStyles_styles_1.default, null),
|
|
48
|
-
react_1.default.createElement(App, { locale: props.locale, project: props.project, playerConfig: props.playerConfig, threekitEnv: props.threekitEnv }, props.children))));
|
|
48
|
+
react_1.default.createElement(App, { locale: props.locale, project: props.project, playerConfig: props.playerConfig, threekitEnv: props.threekitEnv, eventHandlers: props.eventHandlers }, props.children))));
|
|
49
49
|
};
|
|
50
50
|
exports.default = ThreekitProvider;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IConfigurationColor, IThreekitDisplayAttribute } from '../../threekit';
|
|
2
|
-
export declare type AttributeValue = string | number | IConfigurationColor;
|
|
2
|
+
export declare type AttributeValue = string | number | boolean | IConfigurationColor;
|
|
3
3
|
declare type UseAttributeError = [undefined, undefined];
|
|
4
4
|
declare type UseAttributeSuccess = [
|
|
5
5
|
IThreekitDisplayAttribute,
|
|
@@ -16,8 +16,6 @@ var useAttribute = function (attributeName) {
|
|
|
16
16
|
var handleChange = function (value) {
|
|
17
17
|
var _a;
|
|
18
18
|
var preppedValue = (0, utils_1.selectionToConfiguration)(value, attribute.type);
|
|
19
|
-
if (!preppedValue)
|
|
20
|
-
return;
|
|
21
19
|
dispatch((0, threekit_1.setConfiguration)((_a = {},
|
|
22
20
|
_a[attributeName] = preppedValue,
|
|
23
21
|
_a)));
|
package/dist/index.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ import AttributeTitle from './components/AttributeTitle';
|
|
|
25
25
|
import AttributeValue from './components/AttributeValue';
|
|
26
26
|
import TotalPrice from './components/TotalPrice';
|
|
27
27
|
import message from './components/message';
|
|
28
|
-
import Modal from './components/
|
|
28
|
+
import Modal from './components/Modal';
|
|
29
29
|
import Drawer from './components/Drawer';
|
|
30
30
|
import Accordion from './components/Accordion';
|
|
31
31
|
import Tabs from './components/Tabs';
|
package/dist/index.js
CHANGED
|
@@ -74,8 +74,8 @@ exports.TotalPrice = TotalPrice_1.default;
|
|
|
74
74
|
var message_1 = __importDefault(require("./components/message"));
|
|
75
75
|
exports.message = message_1.default;
|
|
76
76
|
// Layouts
|
|
77
|
-
var
|
|
78
|
-
exports.Modal =
|
|
77
|
+
var Modal_1 = __importDefault(require("./components/Modal"));
|
|
78
|
+
exports.Modal = Modal_1.default;
|
|
79
79
|
var Drawer_1 = __importDefault(require("./components/Drawer"));
|
|
80
80
|
exports.Drawer = Drawer_1.default;
|
|
81
81
|
var Accordion_1 = __importDefault(require("./components/Accordion"));
|
package/dist/store/threekit.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { ISaveConfigurationConfig, WishlistArray } from '../Treble';
|
|
|
6
6
|
* Types and Interfaces
|
|
7
7
|
****************************************************/
|
|
8
8
|
interface EventHandlers {
|
|
9
|
-
postConfigurationChange?: (
|
|
9
|
+
postConfigurationChange?: (updatedAttributes: Array<IThreekitDisplayAttribute>, configurationChange: ISetConfiguration, previousConfiguration: Array<IThreekitDisplayAttribute>) => void | Promise<void>;
|
|
10
10
|
}
|
|
11
11
|
export interface ILaunchConfig {
|
|
12
12
|
threekitEnv: string;
|
package/dist/store/threekit.js
CHANGED
|
@@ -292,11 +292,13 @@ var launch = function (launchConfig) {
|
|
|
292
292
|
configurationId = product;
|
|
293
293
|
}
|
|
294
294
|
else {
|
|
295
|
-
|
|
295
|
+
stageId = product.stageId;
|
|
296
|
+
if (product.configurationId)
|
|
297
|
+
configurationId = product.configurationId;
|
|
298
|
+
else if ((0, utils_1.isUuid)(product.assetId))
|
|
296
299
|
assetId = product.assetId;
|
|
297
300
|
else
|
|
298
301
|
configurationId = product.assetId;
|
|
299
|
-
stageId = product.stageId;
|
|
300
302
|
}
|
|
301
303
|
if (playerConfig.elementId) {
|
|
302
304
|
el = document.getElementById(playerConfig.elementId);
|
|
@@ -340,9 +342,9 @@ var launch = function (launchConfig) {
|
|
|
340
342
|
// We create the threekit script
|
|
341
343
|
_j.sent();
|
|
342
344
|
return [4 /*yield*/, Promise.all([
|
|
343
|
-
window.threekitPlayer(__assign({ el: el,
|
|
345
|
+
window.threekitPlayer(__assign(__assign({ el: el,
|
|
344
346
|
// Variables to sort out
|
|
345
|
-
authToken: authToken, stageId: stageId, assetId: updatedAssetId, initialConfiguration: initialConfiguration }
|
|
347
|
+
authToken: authToken, stageId: stageId, assetId: updatedAssetId }, playerConfig), { initialConfiguration: initialConfiguration })),
|
|
346
348
|
api_1.default.products.fetchTranslations(),
|
|
347
349
|
api_1.default.price.getPricebooksList(),
|
|
348
350
|
])];
|
|
@@ -390,17 +392,18 @@ var launch = function (launchConfig) {
|
|
|
390
392
|
exports.launch = launch;
|
|
391
393
|
// Configurator
|
|
392
394
|
var setConfiguration = function (config) { return function (dispatch) { return __awaiter(void 0, void 0, void 0, function () {
|
|
393
|
-
var updatedAttributes;
|
|
395
|
+
var previousConfiguration, updatedAttributes;
|
|
394
396
|
return __generator(this, function (_a) {
|
|
395
397
|
switch (_a.label) {
|
|
396
398
|
case 0:
|
|
399
|
+
previousConfiguration = window.threekit.configurator.getDisplayAttributes();
|
|
397
400
|
dispatch(setPlayerLoading(true));
|
|
398
401
|
return [4 /*yield*/, window.threekit.configurator.setConfiguration(config)];
|
|
399
402
|
case 1:
|
|
400
403
|
_a.sent();
|
|
401
404
|
updatedAttributes = window.threekit.configurator.getDisplayAttributes();
|
|
402
405
|
if (!EVENTS.postConfigurationChange) return [3 /*break*/, 3];
|
|
403
|
-
return [4 /*yield*/, EVENTS.postConfigurationChange(updatedAttributes)];
|
|
406
|
+
return [4 /*yield*/, EVENTS.postConfigurationChange(updatedAttributes, config, previousConfiguration)];
|
|
404
407
|
case 2:
|
|
405
408
|
_a.sent();
|
|
406
409
|
_a.label = 3;
|
package/dist/threekit.d.ts
CHANGED
|
@@ -237,6 +237,7 @@ export interface IPlayerConfig extends Omit<ThreekitInitConfig, 'el' | 'authToke
|
|
|
237
237
|
elementId?: string;
|
|
238
238
|
}
|
|
239
239
|
export interface IProduct extends Pick<ThreekitInitConfig, 'assetId' | 'stageId' | 'initialConfiguration'> {
|
|
240
|
+
configurationId?: string;
|
|
240
241
|
}
|
|
241
242
|
export interface IProducts extends Record<string, string | Partial<IProduct>> {
|
|
242
243
|
}
|
package/dist/utils.d.ts
CHANGED
|
@@ -53,9 +53,9 @@ export declare const metadataValueToObject: (data: string) => Record<string, str
|
|
|
53
53
|
*/
|
|
54
54
|
export declare const createThreekitScriptEl: (threekitDomain: string) => Promise<void>;
|
|
55
55
|
export declare const translateAttribute: (attributes: Array<IThreekitDisplayAttribute>, translations?: ITranslationMap | undefined, language?: string | undefined) => IThreekitDisplayAttribute;
|
|
56
|
-
export declare const selectionToConfiguration: (value: string | number | IConfigurationColor, attributeType: string) => string | number | IConfigurationColor | {
|
|
57
|
-
assetId: string | number | IConfigurationColor;
|
|
58
|
-
}
|
|
56
|
+
export declare const selectionToConfiguration: (value: string | number | boolean | IConfigurationColor, attributeType: string) => string | number | boolean | IConfigurationColor | {
|
|
57
|
+
assetId: string | number | boolean | IConfigurationColor;
|
|
58
|
+
};
|
|
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
61
|
export declare const loadTrebleConfig: () => Partial<ITrebleConfig>;
|
package/dist/utils.js
CHANGED
|
@@ -306,8 +306,6 @@ var translateAttribute = function (attributes, translations, language) {
|
|
|
306
306
|
};
|
|
307
307
|
exports.translateAttribute = translateAttribute;
|
|
308
308
|
var selectionToConfiguration = function (value, attributeType) {
|
|
309
|
-
if (!value)
|
|
310
|
-
return undefined;
|
|
311
309
|
switch (attributeType) {
|
|
312
310
|
case constants_1.ATTRIBUTE_TYPES.number:
|
|
313
311
|
case constants_1.ATTRIBUTE_TYPES.string:
|