@threekit-tools/treble 0.0.82 → 0.0.85-next-1
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 +15 -6
- package/dist/Treble/Treble.js +58 -20
- package/dist/Treble/index.d.ts +2 -2
- package/dist/Treble/index.js +2 -2
- package/dist/Treble/{Snapshots.d.ts → snapshots.d.ts} +4 -9
- package/dist/Treble/snapshots.js +247 -0
- package/dist/Treble/{Wishlist.d.ts → wishlist.d.ts} +2 -6
- package/dist/Treble/wishlist.js +135 -0
- package/dist/api/catalog.js +6 -6
- package/dist/api/configurations.d.ts +2 -0
- package/dist/api/configurations.js +7 -5
- package/dist/api/datatables.js +5 -5
- package/dist/api/files.d.ts +1 -0
- package/dist/api/files.js +63 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.js +2 -0
- package/dist/api/orders.d.ts +5 -7
- package/dist/api/orders.js +12 -12
- package/dist/api/price.js +2 -2
- package/dist/api/products.js +2 -2
- package/dist/components/Accordion/index.js +1 -6
- package/dist/components/AttributeTitle/index.d.ts +0 -9
- package/dist/components/AttributeTitle/index.js +0 -9
- package/dist/components/AttributeValue/index.d.ts +0 -6
- package/dist/components/AttributeValue/index.js +2 -8
- package/dist/components/Button/index.d.ts +0 -27
- package/dist/components/Button/index.js +0 -27
- package/dist/components/Cards/index.d.ts +2 -55
- package/dist/components/Cards/index.js +3 -60
- package/dist/components/Drawer/index.js +0 -13
- package/dist/components/Dropdown/index.d.ts +2 -59
- package/dist/components/Dropdown/index.js +4 -69
- package/dist/components/FlatForm/index.d.ts +0 -21
- package/dist/components/FlatForm/index.js +5 -24
- package/dist/components/Modal/index.js +0 -13
- package/dist/components/Player/index.d.ts +1 -1
- package/dist/components/PortalToElement/index.js +0 -8
- package/dist/components/ProductDescription/index.d.ts +0 -6
- package/dist/components/ProductDescription/index.js +0 -6
- package/dist/components/ProductName/index.d.ts +0 -9
- package/dist/components/ProductName/index.js +0 -9
- package/dist/components/Share/index.d.ts +4 -12
- package/dist/components/Share/index.js +143 -21
- package/dist/components/Share/share.styles.d.ts +9 -0
- package/dist/components/Share/share.styles.js +23 -0
- package/dist/components/Snapshots/index.d.ts +0 -8
- package/dist/components/Snapshots/index.js +0 -8
- package/dist/components/Strips/index.d.ts +2 -55
- package/dist/components/Strips/index.js +3 -60
- package/dist/components/Swatch/index.d.ts +2 -64
- package/dist/components/Swatch/index.js +3 -69
- package/dist/components/Switch/index.d.ts +2 -34
- package/dist/components/Switch/index.js +2 -38
- package/dist/components/TextInput/index.d.ts +2 -1
- package/dist/components/TextInput/index.js +2 -3
- package/dist/components/Tiles/index.d.ts +2 -29
- package/dist/components/Tiles/index.js +3 -33
- package/dist/components/TilesGroup/index.d.ts +2 -26
- package/dist/components/TilesGroup/index.js +3 -30
- package/dist/components/TotalPrice/index.d.ts +0 -6
- package/dist/components/TotalPrice/index.js +0 -6
- package/dist/components/Upload/index.d.ts +2 -1
- package/dist/components/Upload/index.js +7 -8
- package/dist/components/UploadArea/index.d.ts +2 -1
- package/dist/components/UploadArea/index.js +6 -7
- package/dist/components/Wishlist/index.d.ts +1 -4
- package/dist/components/Wishlist/index.js +2 -5
- package/dist/components/Zoom/index.d.ts +1 -18
- package/dist/components/Zoom/index.js +0 -17
- package/dist/components/formComponents.d.ts +12 -0
- package/dist/components/formComponents.js +5 -7
- package/dist/components/message/index.d.ts +0 -9
- package/dist/components/message/index.js +0 -9
- package/dist/connection.js +2 -2
- package/dist/constants.d.ts +0 -49
- package/dist/constants.js +1 -59
- package/dist/hooks/useAttribute/index.js +6 -6
- package/dist/hooks/useConfigurationLoader/index.js +5 -5
- package/dist/hooks/useNestedConfigurator/index.js +2 -2
- package/dist/hooks/useShare/index.js +3 -3
- package/dist/hooks/useSingleAnimation/index.js +20 -25
- package/dist/http/configurations.d.ts +1 -0
- package/dist/http/datatables.js +0 -1
- package/dist/http/files.d.ts +21 -0
- package/dist/http/files.js +26 -0
- package/dist/http/index.d.ts +2 -0
- package/dist/http/index.js +2 -0
- package/dist/http/orders.d.ts +6 -8
- package/dist/icons/index.d.ts +0 -41
- package/dist/icons/index.js +0 -42
- package/dist/index.d.ts +42 -3
- package/dist/index.js +84 -30
- package/dist/store/attributes.d.ts +0 -12
- package/dist/store/attributes.js +2 -15
- package/dist/store/price.d.ts +0 -12
- package/dist/store/price.js +2 -16
- package/dist/store/product.d.ts +2 -17
- package/dist/store/product.js +26 -38
- package/dist/store/translations.d.ts +0 -12
- package/dist/store/translations.js +2 -12
- package/dist/store/treble.d.ts +1 -15
- package/dist/store/treble.js +34 -68
- package/dist/store/wishlist.d.ts +0 -12
- package/dist/store/wishlist.js +4 -17
- package/dist/types.d.ts +73 -58
- package/dist/types.js +54 -0
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +8 -16
- package/package.json +20 -4
- package/dist/Treble/Snapshots.js +0 -251
- package/dist/Treble/Wishlist.js +0 -136
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { ATTRIBUTE_TYPES } from '../../types';
|
|
2
3
|
import { IFormComponentProps, IOptionShared } from '../containers/formInputContainer';
|
|
3
4
|
export interface IUpload extends Pick<IFormComponentProps<IOptionShared>, 'title' | 'description' | 'className' | 'value'> {
|
|
4
5
|
onChange: (file: File) => Promise<void>;
|
|
@@ -6,7 +7,7 @@ export interface IUpload extends Pick<IFormComponentProps<IOptionShared>, 'title
|
|
|
6
7
|
export declare const UploadArea: {
|
|
7
8
|
(props: IUpload): JSX.Element;
|
|
8
9
|
componentName: string;
|
|
9
|
-
compatibleAttributes: Set<
|
|
10
|
+
compatibleAttributes: Set<ATTRIBUTE_TYPES>;
|
|
10
11
|
};
|
|
11
12
|
declare const _default: (props: IUpload) => JSX.Element | null;
|
|
12
13
|
export default _default;
|
|
@@ -64,10 +64,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
64
64
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
65
|
exports.UploadArea = void 0;
|
|
66
66
|
var react_1 = __importStar(require("react"));
|
|
67
|
-
var constants_1 = require("../../constants");
|
|
68
67
|
var FormComponentTitle_1 = __importDefault(require("../FormComponentTitle"));
|
|
69
68
|
var FormComponentDescription_1 = __importDefault(require("../FormComponentDescription"));
|
|
70
69
|
var shared_styles_1 = require("../shared.styles");
|
|
70
|
+
var types_1 = require("../../types");
|
|
71
71
|
var utils_1 = require("../../utils");
|
|
72
72
|
var Spinner_1 = __importDefault(require("../../icons/Spinner"));
|
|
73
73
|
var Image_1 = __importDefault(require("../../icons/Image"));
|
|
@@ -92,7 +92,7 @@ var UploadArea = function (props) {
|
|
|
92
92
|
switch (_a.label) {
|
|
93
93
|
case 0:
|
|
94
94
|
setIsUploading(true);
|
|
95
|
-
return [4
|
|
95
|
+
return [4, onChange(file)];
|
|
96
96
|
case 1:
|
|
97
97
|
_a.sent();
|
|
98
98
|
setIsUploading(false);
|
|
@@ -101,11 +101,10 @@ var UploadArea = function (props) {
|
|
|
101
101
|
reader.onload = function () {
|
|
102
102
|
if (!imgRef.current)
|
|
103
103
|
return;
|
|
104
|
-
// @ts-ignore
|
|
105
104
|
imgRef.current.src = reader.result;
|
|
106
105
|
};
|
|
107
106
|
reader.readAsDataURL(file);
|
|
108
|
-
return [2
|
|
107
|
+
return [2];
|
|
109
108
|
}
|
|
110
109
|
});
|
|
111
110
|
}); };
|
|
@@ -117,9 +116,9 @@ var UploadArea = function (props) {
|
|
|
117
116
|
var _a;
|
|
118
117
|
return __generator(this, function (_b) {
|
|
119
118
|
if (!((_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0]) || !onChange)
|
|
120
|
-
return [2
|
|
119
|
+
return [2];
|
|
121
120
|
handleUpload(e.target.files[0]);
|
|
122
|
-
return [2
|
|
121
|
+
return [2];
|
|
123
122
|
});
|
|
124
123
|
}); } }),
|
|
125
124
|
react_1.default.createElement("button", { type: "button", onClick: handleClick }, isUploading ? (react_1.default.createElement(uploadArea_styles_1.UploadingWrapper, null,
|
|
@@ -138,5 +137,5 @@ var UploadArea = function (props) {
|
|
|
138
137
|
};
|
|
139
138
|
exports.UploadArea = UploadArea;
|
|
140
139
|
exports.UploadArea.componentName = 'upload-area';
|
|
141
|
-
exports.UploadArea.compatibleAttributes = new Set([
|
|
140
|
+
exports.UploadArea.compatibleAttributes = new Set([types_1.ATTRIBUTE_TYPES.ASSET]);
|
|
142
141
|
exports.default = (0, formInputContainer_1.default)(exports.UploadArea);
|
|
@@ -19,9 +19,6 @@ export declare const WishlistButton: (props: WidgetButtonProps) => JSX.Element;
|
|
|
19
19
|
export declare const Wishlist: {
|
|
20
20
|
(props: WishlistProps): JSX.Element | null;
|
|
21
21
|
propTypes: {
|
|
22
|
-
/**
|
|
23
|
-
* Custom classNames applied to the HTML Element to apply custom CSS styling.
|
|
24
|
-
*/
|
|
25
22
|
className: PropTypes.Requireable<string>;
|
|
26
23
|
};
|
|
27
24
|
defaultProps: {
|
|
@@ -30,6 +27,6 @@ export declare const Wishlist: {
|
|
|
30
27
|
type: string;
|
|
31
28
|
};
|
|
32
29
|
componentName: string;
|
|
33
|
-
Icon: import("
|
|
30
|
+
Icon: import("../../icons").IIcon;
|
|
34
31
|
};
|
|
35
32
|
export default Wishlist;
|
|
@@ -96,11 +96,11 @@ var Wishlist = function (props) {
|
|
|
96
96
|
var handleAddToWishlist = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
97
97
|
return __generator(this, function (_a) {
|
|
98
98
|
switch (_a.label) {
|
|
99
|
-
case 0: return [4
|
|
99
|
+
case 0: return [4, addToWishlist()];
|
|
100
100
|
case 1:
|
|
101
101
|
_a.sent();
|
|
102
102
|
setShowWishlist(true);
|
|
103
|
-
return [2
|
|
103
|
+
return [2];
|
|
104
104
|
}
|
|
105
105
|
});
|
|
106
106
|
}); };
|
|
@@ -116,9 +116,6 @@ var Wishlist = function (props) {
|
|
|
116
116
|
};
|
|
117
117
|
exports.Wishlist = Wishlist;
|
|
118
118
|
exports.Wishlist.propTypes = {
|
|
119
|
-
/**
|
|
120
|
-
* Custom classNames applied to the HTML Element to apply custom CSS styling.
|
|
121
|
-
*/
|
|
122
119
|
className: prop_types_1.default.string,
|
|
123
120
|
};
|
|
124
121
|
exports.Wishlist.defaultProps = {
|
|
@@ -15,27 +15,10 @@ export declare const ZoomInComponent: (props: ZoomComponentProps) => JSX.Element
|
|
|
15
15
|
export declare const Zoom: {
|
|
16
16
|
(props: ZoomProps): JSX.Element;
|
|
17
17
|
propTypes: {
|
|
18
|
-
/**
|
|
19
|
-
* The number of steps, for both zoom-in and out, that we want to increment the zoom by.
|
|
20
|
-
*/
|
|
21
18
|
step: PropTypes.Requireable<number>;
|
|
22
|
-
/**
|
|
23
|
-
* Used to the set the orientation/alignment of the buttons.
|
|
24
|
-
*/
|
|
25
19
|
orientation: PropTypes.Requireable<string>;
|
|
26
|
-
/**
|
|
27
|
-
* Custom classNames applied to the HTML Element to apply custom CSS styling.
|
|
28
|
-
*/
|
|
29
20
|
className: PropTypes.Requireable<string>;
|
|
30
|
-
/**
|
|
31
|
-
* The presentational type of the input component. Options
|
|
32
|
-
* include: `hollow`, `standard`, `accent`, `primary`
|
|
33
|
-
*/
|
|
34
21
|
type: PropTypes.Requireable<string>;
|
|
35
|
-
/**
|
|
36
|
-
* Used to set the shape of the Widget button. Options
|
|
37
|
-
* include: `square`, `round`
|
|
38
|
-
*/
|
|
39
22
|
shape: PropTypes.Requireable<string>;
|
|
40
23
|
};
|
|
41
24
|
defaultProps: {
|
|
@@ -46,7 +29,7 @@ export declare const Zoom: {
|
|
|
46
29
|
type: string;
|
|
47
30
|
};
|
|
48
31
|
componentName: string;
|
|
49
|
-
Icon: import("
|
|
32
|
+
Icon: import("../../icons").IIcon;
|
|
50
33
|
ZoomOut: (props: ZoomComponentProps) => JSX.Element | null;
|
|
51
34
|
ZoomIn: (props: ZoomComponentProps) => JSX.Element | null;
|
|
52
35
|
};
|
|
@@ -83,27 +83,10 @@ var Zoom = function (props) {
|
|
|
83
83
|
};
|
|
84
84
|
exports.Zoom = Zoom;
|
|
85
85
|
exports.Zoom.propTypes = {
|
|
86
|
-
/**
|
|
87
|
-
* The number of steps, for both zoom-in and out, that we want to increment the zoom by.
|
|
88
|
-
*/
|
|
89
86
|
step: prop_types_1.default.number,
|
|
90
|
-
/**
|
|
91
|
-
* Used to the set the orientation/alignment of the buttons.
|
|
92
|
-
*/
|
|
93
87
|
orientation: prop_types_1.default.string,
|
|
94
|
-
/**
|
|
95
|
-
* Custom classNames applied to the HTML Element to apply custom CSS styling.
|
|
96
|
-
*/
|
|
97
88
|
className: prop_types_1.default.string,
|
|
98
|
-
/**
|
|
99
|
-
* The presentational type of the input component. Options
|
|
100
|
-
* include: `hollow`, `standard`, `accent`, `primary`
|
|
101
|
-
*/
|
|
102
89
|
type: prop_types_1.default.string,
|
|
103
|
-
/**
|
|
104
|
-
* Used to set the shape of the Widget button. Options
|
|
105
|
-
* include: `square`, `round`
|
|
106
|
-
*/
|
|
107
90
|
shape: prop_types_1.default.string,
|
|
108
91
|
};
|
|
109
92
|
exports.Zoom.defaultProps = {
|
|
@@ -8,5 +8,17 @@ export declare const formComponents: {
|
|
|
8
8
|
} | {
|
|
9
9
|
[x: string]: (props: import("./Upload").IUpload) => JSX.Element | null;
|
|
10
10
|
};
|
|
11
|
+
Asset: {
|
|
12
|
+
[x: string]: ((props: import("./Cards").ICards) => JSX.Element | null) | ((props: import("./Tiles").ITiles) => JSX.Element | null);
|
|
13
|
+
};
|
|
14
|
+
String: {
|
|
15
|
+
[x: string]: ((props: import("./Cards").ICards) => JSX.Element | null) | ((props: import("./Tiles").ITiles) => JSX.Element | null) | ((props: import("./TextInput").ITextInput) => JSX.Element | null);
|
|
16
|
+
};
|
|
17
|
+
upload: {
|
|
18
|
+
[x: string]: (props: import("./Upload").IUpload) => JSX.Element | null;
|
|
19
|
+
};
|
|
20
|
+
Boolean: {
|
|
21
|
+
[x: string]: (props: import("./Switch").ISwitch) => JSX.Element | null;
|
|
22
|
+
};
|
|
11
23
|
};
|
|
12
24
|
export default formComponents;
|
|
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
var _a, _b, _c, _d, _e, _f;
|
|
26
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
27
|
exports.formComponents = exports.FORM_COMPONENT_TYPES = void 0;
|
|
28
|
-
var
|
|
28
|
+
var types_1 = require("../types");
|
|
29
29
|
var Cards_1 = __importStar(require("./Cards"));
|
|
30
30
|
var Dropdown_1 = __importStar(require("./Dropdown"));
|
|
31
31
|
var Strips_1 = __importStar(require("./Strips"));
|
|
@@ -33,15 +33,13 @@ var Swatch_1 = __importStar(require("./Swatch"));
|
|
|
33
33
|
var Tiles_1 = __importStar(require("./Tiles"));
|
|
34
34
|
var TilesGroup_1 = __importStar(require("./TilesGroup"));
|
|
35
35
|
var Upload_1 = __importStar(require("./Upload"));
|
|
36
|
-
// import UploadArea, { UploadArea as UploadAreaComponent } from './UploadArea';
|
|
37
36
|
var TextInput_1 = __importStar(require("./TextInput"));
|
|
38
37
|
var Switch_1 = __importStar(require("./Switch"));
|
|
39
38
|
exports.FORM_COMPONENT_TYPES = {
|
|
40
39
|
stringInput: 'string-input',
|
|
41
40
|
};
|
|
42
|
-
// First option for each attribute type is the default value
|
|
43
41
|
exports.formComponents = (_a = {},
|
|
44
|
-
_a[
|
|
42
|
+
_a[types_1.ATTRIBUTE_TYPES.ASSET] = (_b = {},
|
|
45
43
|
_b[Strips_1.Strips.componentName] = Strips_1.default,
|
|
46
44
|
_b[Cards_1.Cards.componentName] = Cards_1.default,
|
|
47
45
|
_b[Dropdown_1.Dropdown.componentName] = Dropdown_1.default,
|
|
@@ -49,7 +47,7 @@ exports.formComponents = (_a = {},
|
|
|
49
47
|
_b[Tiles_1.Tiles.componentName] = Tiles_1.default,
|
|
50
48
|
_b[TilesGroup_1.TilesGroup.componentName] = TilesGroup_1.default,
|
|
51
49
|
_b),
|
|
52
|
-
_a[
|
|
50
|
+
_a[types_1.ATTRIBUTE_TYPES.STRING] = (_c = {},
|
|
53
51
|
_c[Tiles_1.Tiles.componentName] = Tiles_1.default,
|
|
54
52
|
_c[Dropdown_1.Dropdown.componentName] = Dropdown_1.default,
|
|
55
53
|
_c[Cards_1.Cards.componentName] = Cards_1.default,
|
|
@@ -61,10 +59,10 @@ exports.formComponents = (_a = {},
|
|
|
61
59
|
_a[exports.FORM_COMPONENT_TYPES.stringInput] = (_d = {},
|
|
62
60
|
_d[TextInput_1.TextInput.componentName] = TextInput_1.default,
|
|
63
61
|
_d),
|
|
64
|
-
_a[
|
|
62
|
+
_a[types_1.ASSET_TYPES.UPLOAD] = (_e = {},
|
|
65
63
|
_e[Upload_1.Upload.componentName] = Upload_1.default,
|
|
66
64
|
_e),
|
|
67
|
-
_a[
|
|
65
|
+
_a[types_1.ATTRIBUTE_TYPES.BOOLEAN] = (_f = {},
|
|
68
66
|
_f[Switch_1.Switch.componentName] = Switch_1.default,
|
|
69
67
|
_f),
|
|
70
68
|
_a);
|
|
@@ -12,17 +12,8 @@ interface MessageComponentProps {
|
|
|
12
12
|
export declare const MessageComponent: {
|
|
13
13
|
(props: MessageComponentProps): JSX.Element | null;
|
|
14
14
|
propTypes: {
|
|
15
|
-
/**
|
|
16
|
-
* The content to be displayed in the message
|
|
17
|
-
*/
|
|
18
15
|
content: PropTypes.Requireable<string>;
|
|
19
|
-
/**
|
|
20
|
-
* The icon to display before the message
|
|
21
|
-
*/
|
|
22
16
|
icon: PropTypes.Requireable<string>;
|
|
23
|
-
/**
|
|
24
|
-
* Used to add a custom class name to each of the components html elements
|
|
25
|
-
*/
|
|
26
17
|
className: PropTypes.Requireable<string>;
|
|
27
18
|
};
|
|
28
19
|
defaultProps: {
|
|
@@ -72,17 +72,8 @@ var info = function (content, icon) {
|
|
|
72
72
|
}, (messagesConfig.duration || 2 + (typeof content === 'string' ? 0.05 * content.length : 0.5)) * 1000);
|
|
73
73
|
};
|
|
74
74
|
exports.MessageComponent.propTypes = {
|
|
75
|
-
/**
|
|
76
|
-
* The content to be displayed in the message
|
|
77
|
-
*/
|
|
78
75
|
content: prop_types_1.default.string,
|
|
79
|
-
/**
|
|
80
|
-
* The icon to display before the message
|
|
81
|
-
*/
|
|
82
76
|
icon: prop_types_1.default.string,
|
|
83
|
-
/**
|
|
84
|
-
* Used to add a custom class name to each of the components html elements
|
|
85
|
-
*/
|
|
86
77
|
className: prop_types_1.default.string,
|
|
87
78
|
};
|
|
88
79
|
exports.MessageComponent.defaultProps = {
|
package/dist/connection.js
CHANGED
|
@@ -37,7 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.ThreekitConnection = void 0;
|
|
40
|
-
var ThreekitConnection =
|
|
40
|
+
var ThreekitConnection = (function () {
|
|
41
41
|
function ThreekitConnection() {
|
|
42
42
|
this._authToken = '';
|
|
43
43
|
this._orgId = '';
|
|
@@ -58,7 +58,7 @@ var ThreekitConnection = /** @class */ (function () {
|
|
|
58
58
|
this._serverUrl = config.serverUrl;
|
|
59
59
|
if (config.threekitDomain)
|
|
60
60
|
this._threekitDomain = "https://".concat(config.threekitDomain);
|
|
61
|
-
return [2
|
|
61
|
+
return [2];
|
|
62
62
|
});
|
|
63
63
|
});
|
|
64
64
|
};
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/*****************************************************
|
|
2
|
-
* Treble Config
|
|
3
|
-
****************************************************/
|
|
4
1
|
export declare const TREBLE_DEBUG: boolean;
|
|
5
2
|
export declare const DEFAULT_CLASS_NAME = "threekit-react";
|
|
6
3
|
export declare const CLASS_NAME_PREFIX = "tk";
|
|
@@ -11,17 +8,8 @@ export declare const TOOL_CLASS_NAME: string;
|
|
|
11
8
|
export declare const DISPLAY_CLASS_NAME: string;
|
|
12
9
|
export declare const FORM_CLASS_NAME: string;
|
|
13
10
|
export declare const IS_TREBLE_SCRIPTS: boolean;
|
|
14
|
-
/*****************************************************
|
|
15
|
-
* Treble Products Workflow
|
|
16
|
-
****************************************************/
|
|
17
11
|
export declare const TK_PRODUCT_ID_PARAM_KEY = "tkProduct";
|
|
18
|
-
/*****************************************************
|
|
19
|
-
* Saved Configuration Workflow
|
|
20
|
-
****************************************************/
|
|
21
12
|
export declare const TK_SAVED_CONFIG_PARAM_KEY = "tkConfigId";
|
|
22
|
-
/*****************************************************
|
|
23
|
-
* Threekit Player Initialization Defaults
|
|
24
|
-
****************************************************/
|
|
25
13
|
export declare const TK_PLAYER_LOADER_DIV = "tk-ply-loader";
|
|
26
14
|
export declare const TK_PLAYER_ROOT_DIV = "tk-ply-root";
|
|
27
15
|
export declare const DEFAULT_PLAYER_CONFIG: {
|
|
@@ -32,20 +20,6 @@ export declare const DEFAULT_PLAYER_CONFIG: {
|
|
|
32
20
|
showShare: boolean;
|
|
33
21
|
allowMobileVerticalOrbit: boolean;
|
|
34
22
|
};
|
|
35
|
-
/*****************************************************
|
|
36
|
-
* Attributes
|
|
37
|
-
****************************************************/
|
|
38
|
-
export declare const ATTRIBUTE_TYPES: {
|
|
39
|
-
asset: string;
|
|
40
|
-
string: string;
|
|
41
|
-
number: string;
|
|
42
|
-
color: string;
|
|
43
|
-
boolean: string;
|
|
44
|
-
};
|
|
45
|
-
export declare const ASSET_TYPES: {
|
|
46
|
-
item: string;
|
|
47
|
-
upload: string;
|
|
48
|
-
};
|
|
49
23
|
export declare const SORT_OPTIONS: {
|
|
50
24
|
ascending: string;
|
|
51
25
|
descending: string;
|
|
@@ -53,9 +27,6 @@ export declare const SORT_OPTIONS: {
|
|
|
53
27
|
export declare const ATTRIBUTES_RESERVED: {
|
|
54
28
|
camera: string;
|
|
55
29
|
};
|
|
56
|
-
/*****************************************************
|
|
57
|
-
* Reserved Catalog Item Metadata Properties
|
|
58
|
-
****************************************************/
|
|
59
30
|
export declare const METADATA_RESERVED: {
|
|
60
31
|
description: string;
|
|
61
32
|
thumbnail: string;
|
|
@@ -67,27 +38,7 @@ export declare const METADATA_RESERVED: {
|
|
|
67
38
|
rotate: string;
|
|
68
39
|
scale: string;
|
|
69
40
|
};
|
|
70
|
-
/*****************************************************
|
|
71
|
-
* Snapshot
|
|
72
|
-
****************************************************/
|
|
73
|
-
export declare const SNAPSHOT_FORMATS: {
|
|
74
|
-
png: string;
|
|
75
|
-
jpeg: string;
|
|
76
|
-
};
|
|
77
|
-
export declare const SNAPSHOT_OUTPUTS: {
|
|
78
|
-
url: string;
|
|
79
|
-
download: string;
|
|
80
|
-
dataUrl: string;
|
|
81
|
-
blob: string;
|
|
82
|
-
file: string;
|
|
83
|
-
};
|
|
84
|
-
/*****************************************************
|
|
85
|
-
* Wishlist
|
|
86
|
-
****************************************************/
|
|
87
41
|
export declare const WISHLIST_LOCALSTORAGE_KEY = "tk_wishlist";
|
|
88
|
-
/*****************************************************
|
|
89
|
-
* Datatables
|
|
90
|
-
****************************************************/
|
|
91
42
|
export declare const DATATABLE_FORMATS: {
|
|
92
43
|
csv: string;
|
|
93
44
|
json: string;
|
package/dist/constants.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/*****************************************************
|
|
3
|
-
* Treble Config
|
|
4
|
-
****************************************************/
|
|
5
2
|
var _a;
|
|
6
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.DATATABLE_FORMATS = exports.WISHLIST_LOCALSTORAGE_KEY = exports.
|
|
4
|
+
exports.DATATABLE_FORMATS = exports.WISHLIST_LOCALSTORAGE_KEY = exports.METADATA_RESERVED = exports.ATTRIBUTES_RESERVED = exports.SORT_OPTIONS = 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
5
|
exports.TREBLE_DEBUG = !!process.env.TREBLE_DEBUG;
|
|
9
6
|
exports.DEFAULT_CLASS_NAME = 'threekit-react';
|
|
10
7
|
exports.CLASS_NAME_PREFIX = 'tk';
|
|
@@ -15,49 +12,17 @@ exports.TOOL_CLASS_NAME = "".concat(exports.DEFAULT_CLASS_NAME, " ").concat(expo
|
|
|
15
12
|
exports.DISPLAY_CLASS_NAME = "".concat(exports.DEFAULT_CLASS_NAME, " ").concat(exports.CLASS_NAME_PREFIX, "-display");
|
|
16
13
|
exports.FORM_CLASS_NAME = "".concat(exports.DEFAULT_CLASS_NAME, " ").concat(exports.CLASS_NAME_PREFIX, "-form");
|
|
17
14
|
exports.IS_TREBLE_SCRIPTS = ((_a = process.env.TREBLE_SCRIPTS) === null || _a === void 0 ? void 0 : _a.toString()) === 'true';
|
|
18
|
-
/*****************************************************
|
|
19
|
-
* Treble Products Workflow
|
|
20
|
-
****************************************************/
|
|
21
15
|
exports.TK_PRODUCT_ID_PARAM_KEY = 'tkProduct';
|
|
22
|
-
/*****************************************************
|
|
23
|
-
* Saved Configuration Workflow
|
|
24
|
-
****************************************************/
|
|
25
16
|
exports.TK_SAVED_CONFIG_PARAM_KEY = 'tkConfigId';
|
|
26
|
-
/*****************************************************
|
|
27
|
-
* Threekit Player Initialization Defaults
|
|
28
|
-
****************************************************/
|
|
29
17
|
exports.TK_PLAYER_LOADER_DIV = 'tk-ply-loader';
|
|
30
18
|
exports.TK_PLAYER_ROOT_DIV = 'tk-ply-root';
|
|
31
19
|
exports.DEFAULT_PLAYER_CONFIG = {
|
|
32
|
-
// authToken: undefined,
|
|
33
|
-
// elementId: undefined,
|
|
34
|
-
// cache: undefined,
|
|
35
|
-
// stageId: undefined,
|
|
36
|
-
// assetId: undefined,
|
|
37
20
|
showConfigurator: false,
|
|
38
|
-
// initialConfiguration: undefined,
|
|
39
21
|
showLoadingThumbnail: false,
|
|
40
22
|
showLoadingProgress: true,
|
|
41
|
-
// onLoadingProgress: undefined,
|
|
42
23
|
showAR: false,
|
|
43
24
|
showShare: false,
|
|
44
|
-
// locale: undefined,
|
|
45
25
|
allowMobileVerticalOrbit: false,
|
|
46
|
-
// publishStage: undefined,
|
|
47
|
-
};
|
|
48
|
-
/*****************************************************
|
|
49
|
-
* Attributes
|
|
50
|
-
****************************************************/
|
|
51
|
-
exports.ATTRIBUTE_TYPES = {
|
|
52
|
-
asset: 'Asset',
|
|
53
|
-
string: 'String',
|
|
54
|
-
number: 'Number',
|
|
55
|
-
color: 'Color',
|
|
56
|
-
boolean: 'Boolean',
|
|
57
|
-
};
|
|
58
|
-
exports.ASSET_TYPES = {
|
|
59
|
-
item: 'item',
|
|
60
|
-
upload: 'upload',
|
|
61
26
|
};
|
|
62
27
|
exports.SORT_OPTIONS = {
|
|
63
28
|
ascending: 'ascending',
|
|
@@ -66,9 +31,6 @@ exports.SORT_OPTIONS = {
|
|
|
66
31
|
exports.ATTRIBUTES_RESERVED = {
|
|
67
32
|
camera: '_camera',
|
|
68
33
|
};
|
|
69
|
-
/*****************************************************
|
|
70
|
-
* Reserved Catalog Item Metadata Properties
|
|
71
|
-
****************************************************/
|
|
72
34
|
exports.METADATA_RESERVED = {
|
|
73
35
|
description: '_description',
|
|
74
36
|
thumbnail: '_thumbnail',
|
|
@@ -80,27 +42,7 @@ exports.METADATA_RESERVED = {
|
|
|
80
42
|
rotate: '_rotate',
|
|
81
43
|
scale: '_scale',
|
|
82
44
|
};
|
|
83
|
-
/*****************************************************
|
|
84
|
-
* Snapshot
|
|
85
|
-
****************************************************/
|
|
86
|
-
exports.SNAPSHOT_FORMATS = {
|
|
87
|
-
png: 'png',
|
|
88
|
-
jpeg: 'jpeg',
|
|
89
|
-
};
|
|
90
|
-
exports.SNAPSHOT_OUTPUTS = {
|
|
91
|
-
url: 'url',
|
|
92
|
-
download: 'download',
|
|
93
|
-
dataUrl: 'dataUrl',
|
|
94
|
-
blob: 'blob',
|
|
95
|
-
file: 'file',
|
|
96
|
-
};
|
|
97
|
-
/*****************************************************
|
|
98
|
-
* Wishlist
|
|
99
|
-
****************************************************/
|
|
100
45
|
exports.WISHLIST_LOCALSTORAGE_KEY = 'tk_wishlist';
|
|
101
|
-
/*****************************************************
|
|
102
|
-
* Datatables
|
|
103
|
-
****************************************************/
|
|
104
46
|
exports.DATATABLE_FORMATS = {
|
|
105
47
|
csv: 'csv',
|
|
106
48
|
json: 'json',
|
|
@@ -62,17 +62,17 @@ var useAttribute = function (attributeName) {
|
|
|
62
62
|
return __generator(this, function (_b) {
|
|
63
63
|
switch (_b.label) {
|
|
64
64
|
case 0:
|
|
65
|
-
if (!(attribute.type === 'Asset' && attribute.assetType === 'upload')) return [3
|
|
66
|
-
if (!!value) return [3
|
|
65
|
+
if (!(attribute.type === 'Asset' && attribute.assetType === 'upload')) return [3, 4];
|
|
66
|
+
if (!!value) return [3, 1];
|
|
67
67
|
preppedValue = (0, utils_1.selectionToConfiguration)('', attribute.type);
|
|
68
|
-
return [3
|
|
69
|
-
case 1: return [4
|
|
68
|
+
return [3, 3];
|
|
69
|
+
case 1: return [4, api_1.default.catalog.uploadAsset(value)];
|
|
70
70
|
case 2:
|
|
71
71
|
assetId = _b.sent();
|
|
72
72
|
if (assetId)
|
|
73
73
|
preppedValue = (0, utils_1.selectionToConfiguration)(assetId, attribute.type);
|
|
74
74
|
_b.label = 3;
|
|
75
|
-
case 3: return [3
|
|
75
|
+
case 3: return [3, 5];
|
|
76
76
|
case 4:
|
|
77
77
|
preppedValue = (0, utils_1.selectionToConfiguration)(value, attribute.type);
|
|
78
78
|
_b.label = 5;
|
|
@@ -80,7 +80,7 @@ var useAttribute = function (attributeName) {
|
|
|
80
80
|
dispatch((0, attributes_1.setConfiguration)((_a = {},
|
|
81
81
|
_a[attributeName] = preppedValue,
|
|
82
82
|
_a)));
|
|
83
|
-
return [2
|
|
83
|
+
return [2];
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
86
|
}); };
|
|
@@ -50,16 +50,16 @@ var useConfigurationLoader = function () {
|
|
|
50
50
|
switch (_a.label) {
|
|
51
51
|
case 0:
|
|
52
52
|
if (!configurationId)
|
|
53
|
-
return [2
|
|
54
|
-
return [4
|
|
53
|
+
return [2];
|
|
54
|
+
return [4, api_1.default.configurations.fetch(configurationId)];
|
|
55
55
|
case 1:
|
|
56
56
|
configuration = _a.sent();
|
|
57
57
|
if (!configuration)
|
|
58
|
-
return [2
|
|
59
|
-
return [4
|
|
58
|
+
return [2];
|
|
59
|
+
return [4, dispatch((0, attributes_1.setConfiguration)(configuration.data.variant))];
|
|
60
60
|
case 2:
|
|
61
61
|
_a.sent();
|
|
62
|
-
return [2
|
|
62
|
+
return [2, Promise.resolve()];
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
}); };
|
|
@@ -75,14 +75,14 @@ var useNestedConfigurator = function (address) {
|
|
|
75
75
|
switch (_c.label) {
|
|
76
76
|
case 0:
|
|
77
77
|
dispatch((0, treble_1.setPlayerLoading)(true));
|
|
78
|
-
return [4
|
|
78
|
+
return [4, ((_a = configurator.current) === null || _a === void 0 ? void 0 : _a.setConfiguration(config))];
|
|
79
79
|
case 1:
|
|
80
80
|
_c.sent();
|
|
81
81
|
dispatch((0, treble_1.setPlayerLoading)(false));
|
|
82
82
|
updatedAttrs = (_b = configurator.current) === null || _b === void 0 ? void 0 : _b.getDisplayAttributes();
|
|
83
83
|
if (updatedAttrs)
|
|
84
84
|
setAttributes(updatedAttrs);
|
|
85
|
-
return [2
|
|
85
|
+
return [2];
|
|
86
86
|
}
|
|
87
87
|
});
|
|
88
88
|
}); };
|
|
@@ -53,15 +53,15 @@ var useShare = function () {
|
|
|
53
53
|
var configuration;
|
|
54
54
|
return __generator(this, function (_a) {
|
|
55
55
|
switch (_a.label) {
|
|
56
|
-
case 0: return [4
|
|
56
|
+
case 0: return [4, window.threekit.treble.saveConfiguration()];
|
|
57
57
|
case 1:
|
|
58
58
|
configuration = _a.sent();
|
|
59
59
|
if (!configuration)
|
|
60
|
-
return [2
|
|
60
|
+
return [2, Promise.resolve(undefined)];
|
|
61
61
|
(0, utils_1.copyToClipboard)(configuration.resumableUrl);
|
|
62
62
|
if (msg === null || msg === void 0 ? void 0 : msg.length)
|
|
63
63
|
message_1.default.info(msg);
|
|
64
|
-
return [2
|
|
64
|
+
return [2, Promise.resolve((configuration === null || configuration === void 0 ? void 0 : configuration.resumableUrl) || undefined)];
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
67
|
});
|