@threekit-tools/treble 0.0.43 → 0.0.47
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/Tabs/index.d.ts +4 -7
- package/dist/components/TrebleApp/index.js +2 -2
- 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.js +6 -4
- 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
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
interface
|
|
2
|
+
interface ITabPaneProps {
|
|
3
3
|
label: string;
|
|
4
4
|
onClick: () => void;
|
|
5
5
|
}
|
|
6
|
-
interface
|
|
7
|
-
|
|
6
|
+
interface ITabs {
|
|
7
|
+
TabPane: React.FC<ITabPaneProps>;
|
|
8
8
|
}
|
|
9
|
-
export declare const Tabs:
|
|
10
|
-
({ children }: TabsProps<TabPaneProps>): JSX.Element | null;
|
|
11
|
-
TabPane: React.FC<{}>;
|
|
12
|
-
};
|
|
9
|
+
export declare const Tabs: ITabs;
|
|
13
10
|
export default Tabs;
|
|
@@ -31,7 +31,7 @@ var productComponents = [];
|
|
|
31
31
|
var productToComponentMap = {};
|
|
32
32
|
function TrebleApp(props) {
|
|
33
33
|
var _a;
|
|
34
|
-
var project = props.project, productId = props.productId, playerConfig = props.playerConfig, threekitEnv = props.threekitEnv, locale = props.locale, theme = props.theme;
|
|
34
|
+
var project = props.project, productId = props.productId, playerConfig = props.playerConfig, threekitEnv = props.threekitEnv, locale = props.locale, theme = props.theme, eventHandlers = props.eventHandlers;
|
|
35
35
|
var config = constants_1.IS_TREBLE_SCRIPTS ? (0, utils_1.loadTrebleConfig)() : {};
|
|
36
36
|
if (!((_a = config.treble) === null || _a === void 0 ? void 0 : _a.productsCtx)) {
|
|
37
37
|
console.error('Treble Config is not setup correctly');
|
|
@@ -75,7 +75,7 @@ function TrebleApp(props) {
|
|
|
75
75
|
var preppedProject = Object.assign({}, project, {
|
|
76
76
|
products: productsMap[id],
|
|
77
77
|
});
|
|
78
|
-
return (react_1.default.createElement(ThreekitProvider_1.default, { project: preppedProject, locale: locale, playerConfig: playerConfig, theme: theme, threekitEnv: threekitEnv },
|
|
78
|
+
return (react_1.default.createElement(ThreekitProvider_1.default, { project: preppedProject, locale: locale, playerConfig: playerConfig, theme: theme, threekitEnv: threekitEnv, eventHandlers: eventHandlers },
|
|
79
79
|
react_1.default.createElement(Product, null)));
|
|
80
80
|
}
|
|
81
81
|
exports.default = TrebleApp;
|
|
@@ -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.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
|
])];
|
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:
|