@threekit-tools/treble 0.0.69 → 0.0.70
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 +21 -21
- package/dist/components/ProductDescription/index.d.ts +3 -2
- package/dist/components/ProductDescription/index.js +17 -11
- package/dist/components/ProductDescription/{description.styles.d.ts → productDescription.styles.d.ts} +0 -0
- package/dist/components/ProductDescription/{description.styles.js → productDescription.styles.js} +0 -0
- package/dist/components/ProductName/index.d.ts +3 -2
- package/dist/components/ProductName/index.js +11 -6
- package/dist/components/TotalPrice/index.d.ts +3 -2
- package/dist/components/TotalPrice/index.js +11 -6
- package/package.json +3 -2
package/dist/Treble/Snapshots.js
CHANGED
|
@@ -40,7 +40,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
42
|
var api_1 = __importDefault(require("../api"));
|
|
43
|
-
|
|
43
|
+
// import connection from '../connection';
|
|
44
44
|
var constants_1 = require("../constants");
|
|
45
45
|
var utils_1 = require("../utils");
|
|
46
46
|
var DEFAULT_CAMERA_CONFIG = {
|
|
@@ -129,12 +129,11 @@ var Snapshots = /** @class */ (function () {
|
|
|
129
129
|
}, Promise.resolve(snapshots));
|
|
130
130
|
};
|
|
131
131
|
this.takeSnapshots = function (camerasList, snapshotsConfig) { return __awaiter(_this, void 0, void 0, function () {
|
|
132
|
-
var
|
|
133
|
-
var
|
|
134
|
-
return __generator(this, function (
|
|
135
|
-
switch (
|
|
132
|
+
var filename, size, format, attributeName, output, cameras, snapshotsRaw, snapshotData, camerasMap_1, currentCamera, cameraPosition, _a, attachments, response, urlsArray, snapshotBlobs, snapshotFiles;
|
|
133
|
+
var _b;
|
|
134
|
+
return __generator(this, function (_c) {
|
|
135
|
+
switch (_c.label) {
|
|
136
136
|
case 0:
|
|
137
|
-
_a = connection_1.default.getConnection(), threekitDomain = _a.threekitDomain, orgId = _a.orgId;
|
|
138
137
|
filename = (snapshotsConfig === null || snapshotsConfig === void 0 ? void 0 : snapshotsConfig.filename) || DEFAULT_CAMERA_CONFIG.filename;
|
|
139
138
|
size = (snapshotsConfig === null || snapshotsConfig === void 0 ? void 0 : snapshotsConfig.size) || DEFAULT_CAMERA_CONFIG.size;
|
|
140
139
|
format = (snapshotsConfig === null || snapshotsConfig === void 0 ? void 0 : snapshotsConfig.format) || DEFAULT_CAMERA_CONFIG.format;
|
|
@@ -144,7 +143,7 @@ var Snapshots = /** @class */ (function () {
|
|
|
144
143
|
if (!(cameras.length === 1 && cameras[0] === undefined)) return [3 /*break*/, 2];
|
|
145
144
|
return [4 /*yield*/, this.getSnapshot({ size: size, format: format })];
|
|
146
145
|
case 1:
|
|
147
|
-
snapshotData =
|
|
146
|
+
snapshotData = _c.sent();
|
|
148
147
|
snapshotsRaw = [snapshotData];
|
|
149
148
|
return [3 /*break*/, 5];
|
|
150
149
|
case 2:
|
|
@@ -156,17 +155,17 @@ var Snapshots = /** @class */ (function () {
|
|
|
156
155
|
cameraPosition = (0, utils_1.getCameraPosition)(window.threekit.player.camera);
|
|
157
156
|
return [4 /*yield*/, this.getSnapshots(cameras, camerasMap_1)];
|
|
158
157
|
case 3:
|
|
159
|
-
snapshotsRaw =
|
|
160
|
-
return [4 /*yield*/, window.threekit.configurator.setConfiguration((
|
|
161
|
-
|
|
162
|
-
|
|
158
|
+
snapshotsRaw = _c.sent();
|
|
159
|
+
return [4 /*yield*/, window.threekit.configurator.setConfiguration((_b = {},
|
|
160
|
+
_b[attributeName] = currentCamera,
|
|
161
|
+
_b))];
|
|
163
162
|
case 4:
|
|
164
|
-
|
|
163
|
+
_c.sent();
|
|
165
164
|
(0, utils_1.setCameraPosition)(window.threekit.player.camera, cameraPosition);
|
|
166
|
-
|
|
165
|
+
_c.label = 5;
|
|
167
166
|
case 5:
|
|
168
|
-
|
|
169
|
-
switch (
|
|
167
|
+
_a = output;
|
|
168
|
+
switch (_a) {
|
|
170
169
|
case constants_1.SNAPSHOT_OUTPUTS.url: return [3 /*break*/, 6];
|
|
171
170
|
case constants_1.SNAPSHOT_OUTPUTS.download: return [3 /*break*/, 8];
|
|
172
171
|
case constants_1.SNAPSHOT_OUTPUTS.blob: return [3 /*break*/, 9];
|
|
@@ -179,8 +178,11 @@ var Snapshots = /** @class */ (function () {
|
|
|
179
178
|
var _a;
|
|
180
179
|
var cameraName = (camerasList === null || camerasList === void 0 ? void 0 : camerasList[idx])
|
|
181
180
|
? (0, utils_1.regularToKebabCase)(camerasList[idx] || 'default')
|
|
182
|
-
:
|
|
183
|
-
var
|
|
181
|
+
: filename;
|
|
182
|
+
var preppedFilename = cameraName === filename
|
|
183
|
+
? "".concat(filename, ".").concat(format)
|
|
184
|
+
: "".concat(filename, "-").concat(cameraName, ".").concat(format);
|
|
185
|
+
var file = (0, utils_1.dataURItoFile)(el, preppedFilename);
|
|
184
186
|
return Object.assign(output, (_a = {}, _a[cameraName] = file, _a));
|
|
185
187
|
}, {});
|
|
186
188
|
return [4 /*yield*/, api_1.default.configurations.save({
|
|
@@ -189,10 +191,8 @@ var Snapshots = /** @class */ (function () {
|
|
|
189
191
|
attachments: attachments,
|
|
190
192
|
})];
|
|
191
193
|
case 7:
|
|
192
|
-
|
|
193
|
-
urlsArray = Object.
|
|
194
|
-
return "".concat(threekitDomain, "/api/configurations/").concat(response_1.data.shortId, "/files/").concat(key, "?orgId=").concat(orgId);
|
|
195
|
-
});
|
|
194
|
+
response = _c.sent();
|
|
195
|
+
urlsArray = Object.values(response.data.attachments);
|
|
196
196
|
return [2 /*return*/, Promise.resolve(urlsArray)];
|
|
197
197
|
case 8:
|
|
198
198
|
snapshotsRaw.forEach(function (snapshotBlob, idx) {
|
|
@@ -4,8 +4,8 @@ interface IProductDescription {
|
|
|
4
4
|
description?: string;
|
|
5
5
|
className?: string;
|
|
6
6
|
}
|
|
7
|
-
export declare const
|
|
8
|
-
(props: IProductDescription): JSX.Element
|
|
7
|
+
export declare const ProductDescriptionComponent: {
|
|
8
|
+
(props: IProductDescription): JSX.Element;
|
|
9
9
|
propTypes: {
|
|
10
10
|
/**
|
|
11
11
|
* The description displayed to the user
|
|
@@ -21,4 +21,5 @@ export declare const ProductDescription: {
|
|
|
21
21
|
className: string;
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
|
+
declare const ProductDescription: (props: IProductDescription) => JSX.Element | null;
|
|
24
25
|
export default ProductDescription;
|
|
@@ -3,25 +3,31 @@ 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
|
-
exports.
|
|
6
|
+
exports.ProductDescriptionComponent = void 0;
|
|
7
7
|
var react_1 = __importDefault(require("react"));
|
|
8
8
|
var prop_types_1 = __importDefault(require("prop-types"));
|
|
9
|
-
var
|
|
9
|
+
var productDescription_styles_1 = require("./productDescription.styles");
|
|
10
10
|
var useMetadata_1 = __importDefault(require("../../hooks/useMetadata"));
|
|
11
11
|
var utils_1 = require("../../utils");
|
|
12
|
+
var ProductDescriptionComponent = function (props) {
|
|
13
|
+
var _a = Object.assign({ className: '' }, props), description = _a.description, customClassName = _a.className;
|
|
14
|
+
var cls = (0, utils_1.generateDisplayClassName)('description', customClassName);
|
|
15
|
+
return react_1.default.createElement(productDescription_styles_1.Wrapper, { className: cls }, description);
|
|
16
|
+
};
|
|
17
|
+
exports.ProductDescriptionComponent = ProductDescriptionComponent;
|
|
12
18
|
var ProductDescription = function (props) {
|
|
13
|
-
var _a
|
|
19
|
+
var _a;
|
|
20
|
+
var _b = Object.assign({
|
|
14
21
|
description: undefined,
|
|
15
|
-
|
|
16
|
-
}, props), description = _a.description, customClassName = _a.className;
|
|
22
|
+
}, props), description = _b.description, className = _b.className;
|
|
17
23
|
var metadata = (0, useMetadata_1.default)();
|
|
18
24
|
if (!description && !(metadata === null || metadata === void 0 ? void 0 : metadata._description))
|
|
19
25
|
return null;
|
|
20
|
-
|
|
21
|
-
|
|
26
|
+
if (!description)
|
|
27
|
+
return null;
|
|
28
|
+
return (react_1.default.createElement(exports.ProductDescriptionComponent, { className: className, description: ((_a = metadata === null || metadata === void 0 ? void 0 : metadata._description) === null || _a === void 0 ? void 0 : _a.toString()) || description }));
|
|
22
29
|
};
|
|
23
|
-
exports.
|
|
24
|
-
exports.ProductDescription.propTypes = {
|
|
30
|
+
exports.ProductDescriptionComponent.propTypes = {
|
|
25
31
|
/**
|
|
26
32
|
* The description displayed to the user
|
|
27
33
|
*/
|
|
@@ -31,8 +37,8 @@ exports.ProductDescription.propTypes = {
|
|
|
31
37
|
*/
|
|
32
38
|
className: prop_types_1.default.string,
|
|
33
39
|
};
|
|
34
|
-
exports.
|
|
40
|
+
exports.ProductDescriptionComponent.defaultProps = {
|
|
35
41
|
description: undefined,
|
|
36
42
|
className: '',
|
|
37
43
|
};
|
|
38
|
-
exports.default =
|
|
44
|
+
exports.default = ProductDescription;
|
|
File without changes
|
package/dist/components/ProductDescription/{description.styles.js → productDescription.styles.js}
RENAMED
|
File without changes
|
|
@@ -5,8 +5,8 @@ interface ITitle {
|
|
|
5
5
|
className?: string;
|
|
6
6
|
align?: string;
|
|
7
7
|
}
|
|
8
|
-
export declare const
|
|
9
|
-
(props: ITitle): JSX.Element
|
|
8
|
+
export declare const ProductNameComponent: {
|
|
9
|
+
(props: ITitle): JSX.Element;
|
|
10
10
|
propTypes: {
|
|
11
11
|
/**
|
|
12
12
|
* The title displayed to the user
|
|
@@ -26,4 +26,5 @@ export declare const ProductName: {
|
|
|
26
26
|
align: string;
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
|
+
export declare const ProductName: (props: ITitle) => JSX.Element | null;
|
|
29
30
|
export default ProductName;
|
|
@@ -3,22 +3,27 @@ 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
|
-
exports.ProductName = void 0;
|
|
6
|
+
exports.ProductName = exports.ProductNameComponent = void 0;
|
|
7
7
|
var react_1 = __importDefault(require("react"));
|
|
8
8
|
var prop_types_1 = __importDefault(require("prop-types"));
|
|
9
9
|
var productName_styles_1 = require("./productName.styles");
|
|
10
10
|
var useName_1 = __importDefault(require("../../hooks/useName"));
|
|
11
11
|
var utils_1 = require("../../utils");
|
|
12
|
-
var
|
|
12
|
+
var ProductNameComponent = function (props) {
|
|
13
13
|
var _a = Object.assign({ className: '', align: 'left' }, props), title = _a.title, customClassName = _a.className, align = _a.align;
|
|
14
|
+
var cls = (0, utils_1.generateDisplayClassName)('title', customClassName);
|
|
15
|
+
return (react_1.default.createElement(productName_styles_1.Wrapper, { align: align, className: cls }, title));
|
|
16
|
+
};
|
|
17
|
+
exports.ProductNameComponent = ProductNameComponent;
|
|
18
|
+
var ProductName = function (props) {
|
|
19
|
+
var title = props.title, className = props.className, align = props.align;
|
|
14
20
|
var name = (0, useName_1.default)();
|
|
15
21
|
if (!(title === null || title === void 0 ? void 0 : title.length) && !name)
|
|
16
22
|
return null;
|
|
17
|
-
|
|
18
|
-
return (react_1.default.createElement(productName_styles_1.Wrapper, { align: align, className: cls }, title || name));
|
|
23
|
+
return (react_1.default.createElement(exports.ProductNameComponent, { align: align, className: className, title: title || name }));
|
|
19
24
|
};
|
|
20
25
|
exports.ProductName = ProductName;
|
|
21
|
-
exports.
|
|
26
|
+
exports.ProductNameComponent.propTypes = {
|
|
22
27
|
/**
|
|
23
28
|
* The title displayed to the user
|
|
24
29
|
*/
|
|
@@ -32,7 +37,7 @@ exports.ProductName.propTypes = {
|
|
|
32
37
|
*/
|
|
33
38
|
align: prop_types_1.default.string,
|
|
34
39
|
};
|
|
35
|
-
exports.
|
|
40
|
+
exports.ProductNameComponent.defaultProps = {
|
|
36
41
|
className: '',
|
|
37
42
|
align: 'left',
|
|
38
43
|
};
|
|
@@ -4,8 +4,8 @@ interface IPrice {
|
|
|
4
4
|
price?: string;
|
|
5
5
|
className?: string;
|
|
6
6
|
}
|
|
7
|
-
export declare const
|
|
8
|
-
(props: IPrice): JSX.Element
|
|
7
|
+
export declare const TotalPriceComponent: {
|
|
8
|
+
(props: IPrice): JSX.Element;
|
|
9
9
|
propTypes: {
|
|
10
10
|
/**
|
|
11
11
|
* The price displayed to the user
|
|
@@ -21,4 +21,5 @@ export declare const TotalPrice: {
|
|
|
21
21
|
className: string;
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
|
+
export declare const TotalPrice: (props: IPrice) => JSX.Element | null;
|
|
24
25
|
export default TotalPrice;
|
|
@@ -3,25 +3,30 @@ 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
|
-
exports.TotalPrice = void 0;
|
|
6
|
+
exports.TotalPrice = exports.TotalPriceComponent = void 0;
|
|
7
7
|
var react_1 = __importDefault(require("react"));
|
|
8
8
|
var prop_types_1 = __importDefault(require("prop-types"));
|
|
9
9
|
var totalPrice_styles_1 = require("./totalPrice.styles");
|
|
10
10
|
var usePrice_1 = __importDefault(require("../../hooks/usePrice"));
|
|
11
11
|
var utils_1 = require("../../utils");
|
|
12
|
-
var
|
|
12
|
+
var TotalPriceComponent = function (props) {
|
|
13
13
|
var price = props.price, customClassName = props.className;
|
|
14
|
-
var priceData = (0, usePrice_1.default)();
|
|
15
14
|
var cls = (0, utils_1.generateDisplayClassName)('price', customClassName);
|
|
15
|
+
return react_1.default.createElement(totalPrice_styles_1.Wrapper, { className: cls }, price);
|
|
16
|
+
};
|
|
17
|
+
exports.TotalPriceComponent = TotalPriceComponent;
|
|
18
|
+
var TotalPrice = function (props) {
|
|
19
|
+
var price = props.price, className = props.className;
|
|
20
|
+
var priceData = (0, usePrice_1.default)();
|
|
16
21
|
var preppedPrice = props.price;
|
|
17
22
|
if (priceData)
|
|
18
23
|
preppedPrice = "".concat(priceData.price, " ").concat(priceData.currency);
|
|
19
24
|
if (!price && !priceData)
|
|
20
25
|
return null;
|
|
21
|
-
return react_1.default.createElement(
|
|
26
|
+
return react_1.default.createElement(exports.TotalPriceComponent, { className: className, price: preppedPrice });
|
|
22
27
|
};
|
|
23
28
|
exports.TotalPrice = TotalPrice;
|
|
24
|
-
exports.
|
|
29
|
+
exports.TotalPriceComponent.propTypes = {
|
|
25
30
|
/**
|
|
26
31
|
* The price displayed to the user
|
|
27
32
|
*/
|
|
@@ -31,7 +36,7 @@ exports.TotalPrice.propTypes = {
|
|
|
31
36
|
*/
|
|
32
37
|
className: prop_types_1.default.string,
|
|
33
38
|
};
|
|
34
|
-
exports.
|
|
39
|
+
exports.TotalPriceComponent.defaultProps = {
|
|
35
40
|
price: undefined,
|
|
36
41
|
className: '',
|
|
37
42
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@threekit-tools/treble",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.70",
|
|
4
4
|
"author": "Amaan Saeed",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -60,12 +60,13 @@
|
|
|
60
60
|
"@types/webpack-env": "^1.16.3",
|
|
61
61
|
"babel-jest": "^27.5.1",
|
|
62
62
|
"babel-loader": "^8.2.2",
|
|
63
|
+
"chromatic": "^6.5.3",
|
|
63
64
|
"jest": "^27.5.1",
|
|
64
65
|
"react": ">=17.0.2",
|
|
65
66
|
"react-dom": ">=17.0.2",
|
|
66
67
|
"rimraf": "^3.0.2",
|
|
67
68
|
"serve": "^12.0.1",
|
|
68
|
-
"storybook
|
|
69
|
+
"themeprovider-storybook": "^1.8.0",
|
|
69
70
|
"ts-jest": "^27.1.3",
|
|
70
71
|
"typescript": ">=4.4.4"
|
|
71
72
|
},
|