@threekit-tools/treble 0.0.80 → 0.0.83

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.
Files changed (105) hide show
  1. package/dist/Treble/Snapshots.d.ts +2 -2
  2. package/dist/Treble/Snapshots.js +31 -32
  3. package/dist/Treble/Treble.d.ts +2 -2
  4. package/dist/Treble/Treble.js +4 -5
  5. package/dist/Treble/Wishlist.d.ts +2 -2
  6. package/dist/Treble/Wishlist.js +19 -21
  7. package/dist/Treble/index.js +5 -1
  8. package/dist/api/catalog.js +6 -6
  9. package/dist/api/configurations.js +3 -3
  10. package/dist/api/datatables.js +5 -5
  11. package/dist/api/index.js +5 -1
  12. package/dist/api/orders.js +12 -12
  13. package/dist/api/price.js +2 -2
  14. package/dist/api/products.js +2 -2
  15. package/dist/components/Accordion/index.js +6 -7
  16. package/dist/components/AttributeTitle/index.d.ts +0 -9
  17. package/dist/components/AttributeTitle/index.js +0 -9
  18. package/dist/components/AttributeValue/index.d.ts +0 -6
  19. package/dist/components/AttributeValue/index.js +0 -6
  20. package/dist/components/Button/index.d.ts +0 -27
  21. package/dist/components/Button/index.js +0 -27
  22. package/dist/components/Cards/index.d.ts +0 -54
  23. package/dist/components/Cards/index.js +0 -57
  24. package/dist/components/Drawer/index.js +7 -16
  25. package/dist/components/Dropdown/index.d.ts +0 -58
  26. package/dist/components/Dropdown/index.js +8 -69
  27. package/dist/components/FlatForm/index.d.ts +0 -21
  28. package/dist/components/FlatForm/index.js +5 -22
  29. package/dist/components/Modal/index.js +2 -15
  30. package/dist/components/Player/index.d.ts +0 -1
  31. package/dist/components/Player/index.js +4 -38
  32. package/dist/components/PortalToArOverlay/index.js +5 -1
  33. package/dist/components/PortalToElement/index.js +0 -8
  34. package/dist/components/ProductDescription/index.d.ts +0 -6
  35. package/dist/components/ProductDescription/index.js +0 -6
  36. package/dist/components/ProductName/index.d.ts +0 -9
  37. package/dist/components/ProductName/index.js +0 -9
  38. package/dist/components/Share/index.d.ts +0 -12
  39. package/dist/components/Share/index.js +2 -14
  40. package/dist/components/Snapshots/index.d.ts +0 -8
  41. package/dist/components/Snapshots/index.js +2 -10
  42. package/dist/components/Strips/index.d.ts +0 -54
  43. package/dist/components/Strips/index.js +0 -57
  44. package/dist/components/Swatch/index.d.ts +0 -63
  45. package/dist/components/Swatch/index.js +0 -66
  46. package/dist/components/Switch/index.d.ts +0 -33
  47. package/dist/components/Switch/index.js +0 -36
  48. package/dist/components/Tabs/index.js +5 -1
  49. package/dist/components/TextInput/index.js +0 -1
  50. package/dist/components/ThreekitProvider/index.js +7 -2
  51. package/dist/components/Tiles/index.d.ts +0 -28
  52. package/dist/components/Tiles/index.js +0 -30
  53. package/dist/components/TilesGroup/index.d.ts +0 -25
  54. package/dist/components/TilesGroup/index.js +0 -27
  55. package/dist/components/TotalPrice/index.d.ts +0 -6
  56. package/dist/components/TotalPrice/index.js +0 -6
  57. package/dist/components/TrebleApp/index.js +5 -1
  58. package/dist/components/Upload/index.js +19 -15
  59. package/dist/components/UploadArea/index.js +16 -13
  60. package/dist/components/Wishlist/index.d.ts +0 -3
  61. package/dist/components/Wishlist/index.js +12 -10
  62. package/dist/components/Zoom/index.d.ts +0 -17
  63. package/dist/components/Zoom/index.js +5 -21
  64. package/dist/components/formComponents.js +5 -3
  65. package/dist/components/message/index.d.ts +0 -9
  66. package/dist/components/message/index.js +4 -31
  67. package/dist/connection.js +2 -2
  68. package/dist/constants.d.ts +0 -27
  69. package/dist/constants.js +0 -36
  70. package/dist/hooks/useAttribute/index.d.ts +1 -1
  71. package/dist/hooks/useAttribute/index.js +6 -6
  72. package/dist/hooks/useConfigurationLoader/index.js +5 -5
  73. package/dist/hooks/useLoadingProgress/index.d.ts +2 -0
  74. package/dist/hooks/useLoadingProgress/index.js +9 -0
  75. package/dist/hooks/useNestedConfigurator/index.js +2 -2
  76. package/dist/hooks/usePlayer/index.d.ts +3 -0
  77. package/dist/hooks/usePlayer/index.js +38 -0
  78. package/dist/hooks/useShare/index.js +3 -3
  79. package/dist/hooks/useSingleAnimation/index.js +5 -11
  80. package/dist/hooks/useSnapshot/index.d.ts +1 -1
  81. package/dist/hooks/useWishlist/index.d.ts +1 -1
  82. package/dist/http/datatables.js +0 -1
  83. package/dist/http/index.js +5 -1
  84. package/dist/icons/Spinner.js +5 -1
  85. package/dist/icons/index.d.ts +0 -41
  86. package/dist/icons/index.js +0 -42
  87. package/dist/index.d.ts +44 -3
  88. package/dist/index.js +88 -26
  89. package/dist/store/attributes.d.ts +0 -12
  90. package/dist/store/attributes.js +2 -15
  91. package/dist/store/index.d.ts +1 -1
  92. package/dist/store/price.d.ts +0 -12
  93. package/dist/store/price.js +2 -16
  94. package/dist/store/product.d.ts +6 -21
  95. package/dist/store/product.js +23 -37
  96. package/dist/store/translations.d.ts +1 -13
  97. package/dist/store/translations.js +2 -12
  98. package/dist/store/treble.d.ts +4 -16
  99. package/dist/store/treble.js +47 -66
  100. package/dist/store/wishlist.d.ts +1 -13
  101. package/dist/store/wishlist.js +4 -17
  102. package/dist/types.d.ts +47 -41
  103. package/dist/utils.d.ts +8 -8
  104. package/dist/utils.js +3 -12
  105. package/package.json +16 -4
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -65,14 +69,14 @@ var FormComponentTitle_1 = __importDefault(require("../FormComponentTitle"));
65
69
  var FormComponentDescription_1 = __importDefault(require("../FormComponentDescription"));
66
70
  var shared_styles_1 = require("../shared.styles");
67
71
  var utils_1 = require("../../utils");
68
- var icons_1 = require("../../icons");
72
+ var Spinner_1 = __importDefault(require("../../icons/Spinner"));
73
+ var Image_1 = __importDefault(require("../../icons/Image"));
69
74
  var formInputContainer_1 = __importDefault(require("../containers/formInputContainer"));
70
75
  var uploadArea_styles_1 = require("./uploadArea.styles");
71
76
  var UploadArea = function (props) {
72
- var _a;
73
77
  var title = props.title, description = props.description, value = props.value, onChange = props.onChange, customClassName = props.className;
74
- var _b = (0, react_1.useState)(false), isUploading = _b[0], setIsUploading = _b[1];
75
- var _c = (0, react_1.useState)(undefined), filename = _c[0], setFilename = _c[1];
78
+ var _a = (0, react_1.useState)(false), isUploading = _a[0], setIsUploading = _a[1];
79
+ var _b = (0, react_1.useState)(undefined), filename = _b[0], setFilename = _b[1];
76
80
  var inputRef = (0, react_1.useRef)(null);
77
81
  var imgRef = (0, react_1.useRef)(null);
78
82
  var cls = (0, utils_1.generateInputClassName)('upload', customClassName, title);
@@ -88,7 +92,7 @@ var UploadArea = function (props) {
88
92
  switch (_a.label) {
89
93
  case 0:
90
94
  setIsUploading(true);
91
- return [4 /*yield*/, onChange(file)];
95
+ return [4, onChange(file)];
92
96
  case 1:
93
97
  _a.sent();
94
98
  setIsUploading(false);
@@ -97,11 +101,10 @@ var UploadArea = function (props) {
97
101
  reader.onload = function () {
98
102
  if (!imgRef.current)
99
103
  return;
100
- // @ts-ignore
101
104
  imgRef.current.src = reader.result;
102
105
  };
103
106
  reader.readAsDataURL(file);
104
- return [2 /*return*/];
107
+ return [2];
105
108
  }
106
109
  });
107
110
  }); };
@@ -113,22 +116,22 @@ var UploadArea = function (props) {
113
116
  var _a;
114
117
  return __generator(this, function (_b) {
115
118
  if (!((_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0]) || !onChange)
116
- return [2 /*return*/];
119
+ return [2];
117
120
  handleUpload(e.target.files[0]);
118
- return [2 /*return*/];
121
+ return [2];
119
122
  });
120
123
  }); } }),
121
124
  react_1.default.createElement("button", { type: "button", onClick: handleClick }, isUploading ? (react_1.default.createElement(uploadArea_styles_1.UploadingWrapper, null,
122
125
  react_1.default.createElement("div", null,
123
- react_1.default.createElement(icons_1.SpinnerIcon, { size: "28px" })),
124
- react_1.default.createElement("div", null, "Uploading..."))) : ((_a = value) === null || _a === void 0 ? void 0 : _a.length) ? (react_1.default.createElement(uploadArea_styles_1.UploadingWrapper, null,
126
+ react_1.default.createElement(Spinner_1.default, { size: "28px" })),
127
+ react_1.default.createElement("div", null, "Uploading..."))) : (value === null || value === void 0 ? void 0 : value.length) ? (react_1.default.createElement(uploadArea_styles_1.UploadingWrapper, null,
125
128
  react_1.default.createElement("div", null,
126
129
  react_1.default.createElement("img", { ref: imgRef, src: "#" })),
127
130
  react_1.default.createElement("div", null,
128
131
  react_1.default.createElement("div", null, filename),
129
132
  react_1.default.createElement("div", null, "Upload another file.")))) : (react_1.default.createElement("div", null,
130
133
  react_1.default.createElement("div", null,
131
- react_1.default.createElement(icons_1.ImageIcon, null)),
134
+ react_1.default.createElement(Image_1.default, null)),
132
135
  react_1.default.createElement("div", null, "Click to upload"),
133
136
  react_1.default.createElement("div", null, "Supported file types: PNG, JPEG, SVG")))))));
134
137
  };
@@ -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: {
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -61,7 +65,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
61
65
  exports.Wishlist = exports.WishlistButton = exports.AddWishlistButton = void 0;
62
66
  var react_1 = __importStar(require("react"));
63
67
  var prop_types_1 = __importDefault(require("prop-types"));
64
- var icons_1 = require("../../icons");
68
+ var Heart_1 = __importDefault(require("../../icons/Heart"));
69
+ var Wishlist_1 = __importDefault(require("../../icons/Wishlist"));
65
70
  var Button_1 = require("../Button");
66
71
  var Drawer_1 = __importDefault(require("../Drawer"));
67
72
  var shared_styles_1 = require("../shared.styles");
@@ -71,12 +76,12 @@ var wishlist_styles_1 = require("./wishlist.styles");
71
76
  var useWishlist_1 = __importDefault(require("../../hooks/useWishlist"));
72
77
  var AddWishlistButton = function (props) {
73
78
  var title = props.title, type = props.type, shape = props.shape, className = props.className, onClick = props.onClick;
74
- return (react_1.default.createElement(Button_1.Button, { title: title, icon: icons_1.HeartIcon.iconName, className: className, onClick: onClick, type: type, shape: shape }));
79
+ return (react_1.default.createElement(Button_1.Button, { title: title, icon: Heart_1.default.iconName, className: className, onClick: onClick, type: type, shape: shape }));
75
80
  };
76
81
  exports.AddWishlistButton = AddWishlistButton;
77
82
  var WishlistButton = function (props) {
78
83
  var title = props.title, type = props.type, shape = props.shape, className = props.className, onClick = props.onClick;
79
- return (react_1.default.createElement(Button_1.Button, { title: title, icon: icons_1.WishlistIcon.iconName, className: className, onClick: onClick, type: type, shape: shape }));
84
+ return (react_1.default.createElement(Button_1.Button, { title: title, icon: Wishlist_1.default.iconName, className: className, onClick: onClick, type: type, shape: shape }));
80
85
  };
81
86
  exports.WishlistButton = WishlistButton;
82
87
  var Wishlist = function (props) {
@@ -91,11 +96,11 @@ var Wishlist = function (props) {
91
96
  var handleAddToWishlist = function () { return __awaiter(void 0, void 0, void 0, function () {
92
97
  return __generator(this, function (_a) {
93
98
  switch (_a.label) {
94
- case 0: return [4 /*yield*/, addToWishlist()];
99
+ case 0: return [4, addToWishlist()];
95
100
  case 1:
96
101
  _a.sent();
97
102
  setShowWishlist(true);
98
- return [2 /*return*/];
103
+ return [2];
99
104
  }
100
105
  });
101
106
  }); };
@@ -111,9 +116,6 @@ var Wishlist = function (props) {
111
116
  };
112
117
  exports.Wishlist = Wishlist;
113
118
  exports.Wishlist.propTypes = {
114
- /**
115
- * Custom classNames applied to the HTML Element to apply custom CSS styling.
116
- */
117
119
  className: prop_types_1.default.string,
118
120
  };
119
121
  exports.Wishlist.defaultProps = {
@@ -122,5 +124,5 @@ exports.Wishlist.defaultProps = {
122
124
  type: 'threekit',
123
125
  };
124
126
  exports.Wishlist.componentName = 'wishlist';
125
- exports.Wishlist.Icon = icons_1.WishlistIcon;
127
+ exports.Wishlist.Icon = Wishlist_1.default;
126
128
  exports.default = exports.Wishlist;
@@ -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: {
@@ -19,7 +19,8 @@ var react_1 = __importDefault(require("react"));
19
19
  var prop_types_1 = __importDefault(require("prop-types"));
20
20
  var shared_styles_1 = require("../shared.styles");
21
21
  var Button_1 = __importDefault(require("../Button"));
22
- var icons_1 = require("../../icons");
22
+ var ZoomIn_1 = __importDefault(require("../../icons/ZoomIn"));
23
+ var ZoomOut_1 = __importDefault(require("../../icons/ZoomOut"));
23
24
  var useThreekitInitStatus_1 = __importDefault(require("../../hooks/useThreekitInitStatus"));
24
25
  var useZoom_1 = __importDefault(require("../../hooks/useZoom"));
25
26
  var utils_1 = require("../../utils");
@@ -40,7 +41,7 @@ var ZoomOutComponent = function (props) {
40
41
  return null;
41
42
  var handleZoomOut = function () { return zoomOut(Math.abs(step)); };
42
43
  var cls = (0, utils_1.generateWidgetClassName)('zoom', className);
43
- return (react_1.default.createElement(Button_1.default, { className: "".concat(cls, " zoom-out"), shape: shape, type: type, icon: icons_1.ZoomOutIcon.iconName, onClick: handleZoomOut }));
44
+ return (react_1.default.createElement(Button_1.default, { className: "".concat(cls, " zoom-out"), shape: shape, type: type, icon: ZoomOut_1.default.iconName, onClick: handleZoomOut }));
44
45
  };
45
46
  exports.ZoomOutComponent = ZoomOutComponent;
46
47
  var ZoomInComponent = function (props) {
@@ -55,7 +56,7 @@ var ZoomInComponent = function (props) {
55
56
  return null;
56
57
  var handleZoomOut = function () { return zoomIn(Math.abs(step)); };
57
58
  var cls = (0, utils_1.generateWidgetClassName)('zoom', className);
58
- return (react_1.default.createElement(Button_1.default, { className: "".concat(cls, " zoom-in"), shape: shape, type: type, icon: icons_1.ZoomInIcon.iconName, onClick: handleZoomOut }));
59
+ return (react_1.default.createElement(Button_1.default, { className: "".concat(cls, " zoom-in"), shape: shape, type: type, icon: ZoomIn_1.default.iconName, onClick: handleZoomOut }));
59
60
  };
60
61
  exports.ZoomInComponent = ZoomInComponent;
61
62
  var Zoom = function (props) {
@@ -82,27 +83,10 @@ var Zoom = function (props) {
82
83
  };
83
84
  exports.Zoom = Zoom;
84
85
  exports.Zoom.propTypes = {
85
- /**
86
- * The number of steps, for both zoom-in and out, that we want to increment the zoom by.
87
- */
88
86
  step: prop_types_1.default.number,
89
- /**
90
- * Used to the set the orientation/alignment of the buttons.
91
- */
92
87
  orientation: prop_types_1.default.string,
93
- /**
94
- * Custom classNames applied to the HTML Element to apply custom CSS styling.
95
- */
96
88
  className: prop_types_1.default.string,
97
- /**
98
- * The presentational type of the input component. Options
99
- * include: `hollow`, `standard`, `accent`, `primary`
100
- */
101
89
  type: prop_types_1.default.string,
102
- /**
103
- * Used to set the shape of the Widget button. Options
104
- * include: `square`, `round`
105
- */
106
90
  shape: prop_types_1.default.string,
107
91
  };
108
92
  exports.Zoom.defaultProps = {
@@ -113,7 +97,7 @@ exports.Zoom.defaultProps = {
113
97
  type: 'threekit',
114
98
  };
115
99
  exports.Zoom.componentName = 'zoom';
116
- exports.Zoom.Icon = icons_1.ZoomInIcon;
100
+ exports.Zoom.Icon = ZoomIn_1.default;
117
101
  exports.Zoom.ZoomOut = exports.ZoomOutComponent;
118
102
  exports.Zoom.ZoomIn = exports.ZoomInComponent;
119
103
  exports.default = exports.Zoom;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -29,13 +33,11 @@ var Swatch_1 = __importStar(require("./Swatch"));
29
33
  var Tiles_1 = __importStar(require("./Tiles"));
30
34
  var TilesGroup_1 = __importStar(require("./TilesGroup"));
31
35
  var Upload_1 = __importStar(require("./Upload"));
32
- // import UploadArea, { UploadArea as UploadAreaComponent } from './UploadArea';
33
36
  var TextInput_1 = __importStar(require("./TextInput"));
34
37
  var Switch_1 = __importStar(require("./Switch"));
35
38
  exports.FORM_COMPONENT_TYPES = {
36
39
  stringInput: 'string-input',
37
40
  };
38
- // First option for each attribute type is the default value
39
41
  exports.formComponents = (_a = {},
40
42
  _a[constants_1.ATTRIBUTE_TYPES.asset] = (_b = {},
41
43
  _b[Strips_1.Strips.componentName] = Strips_1.default,
@@ -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: {
@@ -1,23 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
22
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
23
4
  };
@@ -27,7 +8,8 @@ var react_1 = __importDefault(require("react"));
27
8
  var react_dom_1 = __importDefault(require("react-dom"));
28
9
  var prop_types_1 = __importDefault(require("prop-types"));
29
10
  var message_styles_1 = require("./message.styles");
30
- var icons_1 = __importStar(require("../../icons"));
11
+ var icons_1 = __importDefault(require("../../icons"));
12
+ var Info_1 = __importDefault(require("../../icons/Info"));
31
13
  var styled_components_1 = require("styled-components");
32
14
  var theme_1 = __importDefault(require("../../theme"));
33
15
  var messagesEl;
@@ -57,7 +39,7 @@ var MessageComponent = function (props) {
57
39
  var content = props.content, icon = props.icon;
58
40
  if (!content)
59
41
  return null;
60
- var Icon = icon ? icons_1.default[icon] : icons_1.InfoIcon;
42
+ var Icon = icon ? icons_1.default[icon] : Info_1.default;
61
43
  return (react_1.default.createElement(styled_components_1.ThemeProvider, { theme: theme_1.default },
62
44
  react_1.default.createElement(message_styles_1.Wrapper, null,
63
45
  react_1.default.createElement(message_styles_1.IconWrapper, null,
@@ -90,22 +72,13 @@ var info = function (content, icon) {
90
72
  }, (messagesConfig.duration || 2 + (typeof content === 'string' ? 0.05 * content.length : 0.5)) * 1000);
91
73
  };
92
74
  exports.MessageComponent.propTypes = {
93
- /**
94
- * The content to be displayed in the message
95
- */
96
75
  content: prop_types_1.default.string,
97
- /**
98
- * The icon to display before the message
99
- */
100
76
  icon: prop_types_1.default.string,
101
- /**
102
- * Used to add a custom class name to each of the components html elements
103
- */
104
77
  className: prop_types_1.default.string,
105
78
  };
106
79
  exports.MessageComponent.defaultProps = {
107
80
  content: undefined,
108
- icon: icons_1.InfoIcon.iconName,
81
+ icon: Info_1.default.iconName,
109
82
  className: undefined,
110
83
  };
111
84
  exports.default = { config: config, info: info };
@@ -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 = /** @class */ (function () {
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 /*return*/];
61
+ return [2];
62
62
  });
63
63
  });
64
64
  };
@@ -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,9 +20,6 @@ export declare const DEFAULT_PLAYER_CONFIG: {
32
20
  showShare: boolean;
33
21
  allowMobileVerticalOrbit: boolean;
34
22
  };
35
- /*****************************************************
36
- * Attributes
37
- ****************************************************/
38
23
  export declare const ATTRIBUTE_TYPES: {
39
24
  asset: string;
40
25
  string: string;
@@ -53,9 +38,6 @@ export declare const SORT_OPTIONS: {
53
38
  export declare const ATTRIBUTES_RESERVED: {
54
39
  camera: string;
55
40
  };
56
- /*****************************************************
57
- * Reserved Catalog Item Metadata Properties
58
- ****************************************************/
59
41
  export declare const METADATA_RESERVED: {
60
42
  description: string;
61
43
  thumbnail: string;
@@ -67,9 +49,6 @@ export declare const METADATA_RESERVED: {
67
49
  rotate: string;
68
50
  scale: string;
69
51
  };
70
- /*****************************************************
71
- * Snapshot
72
- ****************************************************/
73
52
  export declare const SNAPSHOT_FORMATS: {
74
53
  png: string;
75
54
  jpeg: string;
@@ -81,13 +60,7 @@ export declare const SNAPSHOT_OUTPUTS: {
81
60
  blob: string;
82
61
  file: string;
83
62
  };
84
- /*****************************************************
85
- * Wishlist
86
- ****************************************************/
87
63
  export declare const WISHLIST_LOCALSTORAGE_KEY = "tk_wishlist";
88
- /*****************************************************
89
- * Datatables
90
- ****************************************************/
91
64
  export declare const DATATABLE_FORMATS: {
92
65
  csv: string;
93
66
  json: string;
package/dist/constants.js CHANGED
@@ -1,7 +1,4 @@
1
1
  "use strict";
2
- /*****************************************************
3
- * Treble Config
4
- ****************************************************/
5
2
  var _a;
6
3
  Object.defineProperty(exports, "__esModule", { value: true });
7
4
  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;
@@ -15,39 +12,18 @@ 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
26
  };
48
- /*****************************************************
49
- * Attributes
50
- ****************************************************/
51
27
  exports.ATTRIBUTE_TYPES = {
52
28
  asset: 'Asset',
53
29
  string: 'String',
@@ -66,9 +42,6 @@ exports.SORT_OPTIONS = {
66
42
  exports.ATTRIBUTES_RESERVED = {
67
43
  camera: '_camera',
68
44
  };
69
- /*****************************************************
70
- * Reserved Catalog Item Metadata Properties
71
- ****************************************************/
72
45
  exports.METADATA_RESERVED = {
73
46
  description: '_description',
74
47
  thumbnail: '_thumbnail',
@@ -80,9 +53,6 @@ exports.METADATA_RESERVED = {
80
53
  rotate: '_rotate',
81
54
  scale: '_scale',
82
55
  };
83
- /*****************************************************
84
- * Snapshot
85
- ****************************************************/
86
56
  exports.SNAPSHOT_FORMATS = {
87
57
  png: 'png',
88
58
  jpeg: 'jpeg',
@@ -94,13 +64,7 @@ exports.SNAPSHOT_OUTPUTS = {
94
64
  blob: 'blob',
95
65
  file: 'file',
96
66
  };
97
- /*****************************************************
98
- * Wishlist
99
- ****************************************************/
100
67
  exports.WISHLIST_LOCALSTORAGE_KEY = 'tk_wishlist';
101
- /*****************************************************
102
- * Datatables
103
- ****************************************************/
104
68
  exports.DATATABLE_FORMATS = {
105
69
  csv: 'csv',
106
70
  json: 'json',
@@ -6,5 +6,5 @@ declare type UseAttributeSuccess = [
6
6
  (val: RawAttributeValue) => Promise<void>
7
7
  ];
8
8
  declare type UseAttributeHook = UseAttributeError | UseAttributeSuccess;
9
- declare const useAttribute: (attributeName?: string | undefined) => UseAttributeHook;
9
+ declare const useAttribute: (attributeName?: string) => UseAttributeHook;
10
10
  export default useAttribute;
@@ -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 /*break*/, 4];
66
- if (!!value) return [3 /*break*/, 1];
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 /*break*/, 3];
69
- case 1: return [4 /*yield*/, api_1.default.catalog.uploadAsset(value)];
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 /*break*/, 5];
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 /*return*/];
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 /*return*/];
54
- return [4 /*yield*/, api_1.default.configurations.fetch(configurationId)];
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 /*return*/];
59
- return [4 /*yield*/, dispatch((0, attributes_1.setConfiguration)(configuration.data.variant))];
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 /*return*/, Promise.resolve()];
62
+ return [2, Promise.resolve()];
63
63
  }
64
64
  });
65
65
  }); };
@@ -0,0 +1,2 @@
1
+ declare const useLoadingProgress: () => number;
2
+ export default useLoadingProgress;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var store_1 = require("../../store");
4
+ var treble_1 = require("../../store/treble");
5
+ var useLoadingProgress = function () {
6
+ var progress = (0, store_1.useThreekitSelector)(treble_1.getLoadingProgress);
7
+ return progress;
8
+ };
9
+ exports.default = useLoadingProgress;
@@ -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 /*yield*/, ((_a = configurator.current) === null || _a === void 0 ? void 0 : _a.setConfiguration(config))];
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 /*return*/];
85
+ return [2];
86
86
  }
87
87
  });
88
88
  }); };
@@ -0,0 +1,3 @@
1
+ declare type UsePlayer = [undefined] | [(node: null | HTMLDivElement) => void];
2
+ declare const usePlayer: () => UsePlayer;
3
+ export default usePlayer;