@threekit-tools/treble 0.0.47 → 0.0.51
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 +0 -26
- package/dist/Treble/Treble.d.ts +3 -1
- package/dist/Treble/Treble.js +14 -3
- package/dist/Treble/Wishlist.d.ts +3 -2
- package/dist/Treble/Wishlist.js +12 -12
- package/dist/components/Accordion/index.d.ts +1 -1
- package/dist/components/Player/index.js +5 -3
- package/dist/components/ThreekitProvider/index.d.ts +3 -1
- package/dist/components/ThreekitProvider/index.js +3 -3
- package/dist/components/containers/formInputContainer.d.ts +1 -1
- package/dist/hooks/useAttribute/index.js +3 -3
- package/dist/hooks/useConfigurator/index.js +3 -3
- package/dist/hooks/useMetadata/index.js +2 -2
- package/dist/hooks/useName/index.js +2 -2
- package/dist/hooks/usePlayerLoadingStatus/index.js +2 -2
- package/dist/hooks/usePlayerPortal/index.js +2 -3
- package/dist/hooks/usePrice/index.d.ts +1 -1
- package/dist/hooks/usePrice/index.js +2 -2
- package/dist/hooks/useShare/index.js +2 -2
- package/dist/hooks/useSnapshot/index.js +2 -2
- package/dist/hooks/useThreekitInitStatus/index.js +2 -2
- package/dist/hooks/useWishlist/index.d.ts +1 -1
- package/dist/hooks/useWishlist/index.js +8 -7
- package/dist/store/attributes.d.ts +20 -0
- package/dist/store/attributes.js +139 -0
- package/dist/store/index.d.ts +67 -7
- package/dist/store/index.js +36 -4
- package/dist/store/price.d.ts +33 -0
- package/dist/store/price.js +116 -0
- package/dist/store/product.d.ts +22 -0
- package/dist/store/product.js +65 -0
- package/dist/store/translations.d.ts +22 -0
- package/dist/store/translations.js +100 -0
- package/dist/store/treble.d.ts +41 -0
- package/dist/store/treble.js +257 -0
- package/dist/store/wishlist.d.ts +23 -0
- package/dist/store/wishlist.js +114 -0
- package/dist/threekit.d.ts +1 -1
- package/package.json +1 -1
- package/dist/store/threekit.d.ts +0 -68
- package/dist/store/threekit.js +0 -450
package/dist/Treble/Snapshots.js
CHANGED
|
@@ -129,32 +129,6 @@ 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
|
-
// function getSnapshot() {
|
|
133
|
-
// return window.threekit.player.snapshotAsync({
|
|
134
|
-
// size,
|
|
135
|
-
// mimeType: `image/${SNAPSHOT_FORMATS[format]}`,
|
|
136
|
-
// })
|
|
137
|
-
// }
|
|
138
|
-
// function getSnapshots(
|
|
139
|
-
// cameras: Array<string | undefined>,
|
|
140
|
-
// camerasMap: CamerasMap
|
|
141
|
-
// ) {
|
|
142
|
-
// let snapshots: Array<string> = []
|
|
143
|
-
// return cameras.reduce((snapshotPromise, camera) => {
|
|
144
|
-
// return snapshotPromise.then(
|
|
145
|
-
// () =>
|
|
146
|
-
// new Promise(async (resolve) => {
|
|
147
|
-
// if (camera)
|
|
148
|
-
// await window.threekit.configurator.setConfiguration({
|
|
149
|
-
// [attributeName]: camerasMap[camera],
|
|
150
|
-
// })
|
|
151
|
-
// const snapshotStr = await getSnapshot()
|
|
152
|
-
// snapshots.push(snapshotStr)
|
|
153
|
-
// resolve(snapshots)
|
|
154
|
-
// })
|
|
155
|
-
// )
|
|
156
|
-
// }, Promise.resolve(snapshots))
|
|
157
|
-
// }
|
|
158
132
|
function saveSnapshotToPlatform(snapshot, filename) {
|
|
159
133
|
return __awaiter(this, void 0, void 0, function () {
|
|
160
134
|
var files, response;
|
package/dist/Treble/Treble.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { IWishlist } from './Wishlist';
|
|
|
4
4
|
import Snapshots from './Snapshots';
|
|
5
5
|
interface ITreble {
|
|
6
6
|
player: IThreekitPlayer;
|
|
7
|
+
orgId: string;
|
|
7
8
|
}
|
|
8
9
|
export interface ISaveConfigurationConfig {
|
|
9
10
|
customerId?: string;
|
|
@@ -16,11 +17,12 @@ declare class Treble {
|
|
|
16
17
|
wishlist: IWishlist;
|
|
17
18
|
private _snapshots;
|
|
18
19
|
takeSnapshots: Snapshots['takeSnapshots'];
|
|
19
|
-
constructor({ player }: ITreble);
|
|
20
|
+
constructor({ player, orgId }: ITreble);
|
|
20
21
|
saveConfiguration: (config?: ISaveConfigurationConfig | undefined) => Promise<{
|
|
21
22
|
resumableUrl: string;
|
|
22
23
|
} & import("../http/configurations").IConfigurationResponse & {
|
|
23
24
|
thumbnail: string;
|
|
24
25
|
}>;
|
|
26
|
+
getNestedConfigurator: (address: string | Array<string>) => any;
|
|
25
27
|
}
|
|
26
28
|
export default Treble;
|
package/dist/Treble/Treble.js
CHANGED
|
@@ -48,7 +48,7 @@ var Snapshots_1 = __importDefault(require("./Snapshots"));
|
|
|
48
48
|
var Treble = /** @class */ (function () {
|
|
49
49
|
function Treble(_a) {
|
|
50
50
|
var _this = this;
|
|
51
|
-
var player = _a.player;
|
|
51
|
+
var player = _a.player, orgId = _a.orgId;
|
|
52
52
|
this.saveConfiguration = function (config) { return __awaiter(_this, void 0, void 0, function () {
|
|
53
53
|
var threekitDomain, _a, customerId, metadata, productVersion, files, response, params, url;
|
|
54
54
|
var _b;
|
|
@@ -83,13 +83,24 @@ var Treble = /** @class */ (function () {
|
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
85
|
}); };
|
|
86
|
+
this.getNestedConfigurator = function (address) {
|
|
87
|
+
var player = window.threekit.player.enableApi('player');
|
|
88
|
+
var addressArr = Array.isArray(address) ? address : [address];
|
|
89
|
+
return addressArr.reduce(function (configurator, attributeName) {
|
|
90
|
+
var itemId = configurator.getAppliedConfiguration(attributeName);
|
|
91
|
+
return window.threekit.player.scene.get({
|
|
92
|
+
id: itemId,
|
|
93
|
+
evalNode: true,
|
|
94
|
+
}).configurator;
|
|
95
|
+
}, player.getConfigurator());
|
|
96
|
+
};
|
|
86
97
|
// Threekit API
|
|
87
98
|
this._api = api_1.default;
|
|
88
99
|
this._player = player;
|
|
89
|
-
this.wishlist = (0, Wishlist_1.default)();
|
|
100
|
+
this.wishlist = (0, Wishlist_1.default)(orgId);
|
|
90
101
|
this._snapshots = new Snapshots_1.default();
|
|
91
102
|
this.takeSnapshots = this._snapshots.takeSnapshots;
|
|
92
|
-
// this._player = player.enableApi('player')
|
|
103
|
+
// this._player = player.enableApi('player');
|
|
93
104
|
}
|
|
94
105
|
return Treble;
|
|
95
106
|
}());
|
|
@@ -8,11 +8,12 @@ export interface IWishlist {
|
|
|
8
8
|
clearWishlist(): Array<IConfigurationResponse>;
|
|
9
9
|
}
|
|
10
10
|
declare class Wishlist implements IWishlist {
|
|
11
|
-
|
|
11
|
+
_wishlistKey: string;
|
|
12
|
+
constructor(orgId: string);
|
|
12
13
|
getWishlist: () => Promise<WishlistArray>;
|
|
13
14
|
addItem: (config?: ISaveConfigurationConfig | undefined) => Promise<WishlistArray>;
|
|
14
15
|
removeItemByIdx: (idx: number) => WishlistArray;
|
|
15
16
|
clearWishlist: () => WishlistArray;
|
|
16
17
|
}
|
|
17
|
-
export default function createWishlist(): Wishlist;
|
|
18
|
+
export default function createWishlist(orgId: string): Wishlist;
|
|
18
19
|
export {};
|
package/dist/Treble/Wishlist.js
CHANGED
|
@@ -53,7 +53,7 @@ var connection_1 = __importDefault(require("../connection"));
|
|
|
53
53
|
var constants_1 = require("../constants");
|
|
54
54
|
var wishlistData;
|
|
55
55
|
var Wishlist = /** @class */ (function () {
|
|
56
|
-
function Wishlist() {
|
|
56
|
+
function Wishlist(orgId) {
|
|
57
57
|
var _this = this;
|
|
58
58
|
this.getWishlist = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
59
59
|
var threekitDomain, wishlistListStr, wishlistList, wishlistDataRaw;
|
|
@@ -63,7 +63,7 @@ var Wishlist = /** @class */ (function () {
|
|
|
63
63
|
if (wishlistData)
|
|
64
64
|
return [2 /*return*/, wishlistData];
|
|
65
65
|
threekitDomain = connection_1.default.getConnection().threekitDomain;
|
|
66
|
-
wishlistListStr = localStorage.getItem(
|
|
66
|
+
wishlistListStr = localStorage.getItem(this._wishlistKey);
|
|
67
67
|
wishlistList = JSON.parse(wishlistListStr || '[]');
|
|
68
68
|
return [4 /*yield*/, Promise.all(wishlistList.map(function (el) { return api_1.default.configurations.fetch(el); }))];
|
|
69
69
|
case 1:
|
|
@@ -87,20 +87,19 @@ var Wishlist = /** @class */ (function () {
|
|
|
87
87
|
case 0:
|
|
88
88
|
if (!wishlistData) {
|
|
89
89
|
wishlistData = [];
|
|
90
|
-
localStorage.setItem(
|
|
90
|
+
localStorage.setItem(this._wishlistKey, JSON.stringify([]));
|
|
91
91
|
}
|
|
92
92
|
configPrepped = Object.assign({ snapshot: true }, config);
|
|
93
93
|
return [4 /*yield*/, window.threekit.treble.saveConfiguration(configPrepped)];
|
|
94
94
|
case 1:
|
|
95
95
|
savedConfiguration = _a.sent();
|
|
96
|
-
// const savedConfiguration = await this.saveConfiguration(configPrepped)
|
|
97
96
|
if (!savedConfiguration)
|
|
98
97
|
return [2 /*return*/, wishlistData];
|
|
99
98
|
wishlistData = __spreadArray(__spreadArray([], wishlistData, true), [savedConfiguration], false);
|
|
100
|
-
wishlistListStr = localStorage.getItem(
|
|
99
|
+
wishlistListStr = localStorage.getItem(this._wishlistKey);
|
|
101
100
|
wishlistList = JSON.parse(wishlistListStr || '[]');
|
|
102
101
|
wishlistList.push(savedConfiguration.shortId);
|
|
103
|
-
localStorage.setItem(
|
|
102
|
+
localStorage.setItem(this._wishlistKey, JSON.stringify(wishlistList));
|
|
104
103
|
return [2 /*return*/, this.getWishlist()];
|
|
105
104
|
}
|
|
106
105
|
});
|
|
@@ -108,7 +107,7 @@ var Wishlist = /** @class */ (function () {
|
|
|
108
107
|
this.removeItemByIdx = function (idx) {
|
|
109
108
|
if (!(wishlistData === null || wishlistData === void 0 ? void 0 : wishlistData.length)) {
|
|
110
109
|
wishlistData = [];
|
|
111
|
-
localStorage.setItem(
|
|
110
|
+
localStorage.setItem(_this._wishlistKey, JSON.stringify([]));
|
|
112
111
|
return wishlistData;
|
|
113
112
|
}
|
|
114
113
|
if (idx > (wishlistData === null || wishlistData === void 0 ? void 0 : wishlistData.length) - 1)
|
|
@@ -116,22 +115,23 @@ var Wishlist = /** @class */ (function () {
|
|
|
116
115
|
var updatedWishlist = __spreadArray([], wishlistData, true);
|
|
117
116
|
updatedWishlist.splice(idx, 1);
|
|
118
117
|
wishlistData = updatedWishlist;
|
|
119
|
-
var wishlistListStr = localStorage.getItem(
|
|
118
|
+
var wishlistListStr = localStorage.getItem(_this._wishlistKey);
|
|
120
119
|
var wishlistList = JSON.parse(wishlistListStr || '[]');
|
|
121
120
|
wishlistList.splice(idx, 1);
|
|
122
|
-
localStorage.setItem(
|
|
121
|
+
localStorage.setItem(_this._wishlistKey, JSON.stringify(wishlistList));
|
|
123
122
|
return wishlistData;
|
|
124
123
|
};
|
|
125
124
|
this.clearWishlist = function () {
|
|
126
125
|
wishlistData = [];
|
|
127
|
-
localStorage.setItem(
|
|
126
|
+
localStorage.setItem(_this._wishlistKey, JSON.stringify([]));
|
|
128
127
|
return wishlistData;
|
|
129
128
|
};
|
|
129
|
+
this._wishlistKey = "".concat(constants_1.WISHLIST_LOCALSTORAGE_KEY, "_").concat(orgId);
|
|
130
130
|
this.getWishlist();
|
|
131
131
|
}
|
|
132
132
|
return Wishlist;
|
|
133
133
|
}());
|
|
134
|
-
function createWishlist() {
|
|
135
|
-
return new Wishlist();
|
|
134
|
+
function createWishlist(orgId) {
|
|
135
|
+
return new Wishlist(orgId);
|
|
136
136
|
}
|
|
137
137
|
exports.default = createWishlist;
|
|
@@ -6,7 +6,7 @@ interface AccordionItemProps extends React.FC {
|
|
|
6
6
|
onClick: () => void;
|
|
7
7
|
}
|
|
8
8
|
interface AccordionProps<T> {
|
|
9
|
-
children: React.FunctionComponentElement<T
|
|
9
|
+
children: React.FunctionComponentElement<T> | Array<React.FunctionComponentElement<T>>;
|
|
10
10
|
}
|
|
11
11
|
export declare const Accordion: {
|
|
12
12
|
(props: AccordionProps<AccordionItemProps>): React.FunctionComponentElement<AccordionItemProps>[] | null;
|
|
@@ -35,18 +35,20 @@ var Player = function (props) {
|
|
|
35
35
|
minHeight: '600px',
|
|
36
36
|
width: '100%',
|
|
37
37
|
}, props), height = _a.height, width = _a.width, minHeight = _a.minHeight, children = _a.children;
|
|
38
|
-
var hasMoved = (0, react_1.useRef)(false);
|
|
39
38
|
var _b = (0, usePlayerPortal_1.default)(), portalPlayerTo = _b[0], portalBack = _b[1];
|
|
39
|
+
var hasMoved = (0, react_1.useRef)(false);
|
|
40
40
|
(0, react_1.useEffect)(function () {
|
|
41
41
|
if (portalPlayerTo && !hasMoved.current) {
|
|
42
42
|
portalPlayerTo(exports.PLAYER_DIV_ID);
|
|
43
43
|
hasMoved.current = true;
|
|
44
44
|
}
|
|
45
45
|
return function () {
|
|
46
|
-
if (portalBack)
|
|
46
|
+
if (portalBack) {
|
|
47
47
|
portalBack();
|
|
48
|
+
hasMoved.current = false;
|
|
49
|
+
}
|
|
48
50
|
};
|
|
49
|
-
});
|
|
51
|
+
}, [portalPlayerTo]);
|
|
50
52
|
return (react_1.default.createElement(player_styles_1.Wrapper, { height: height, width: width, minHeight: minHeight, className: className },
|
|
51
53
|
react_1.default.createElement("div", { id: exports.PLAYER_DIV_ID }),
|
|
52
54
|
children));
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { Reducer } from 'redux';
|
|
3
|
+
import { ILaunchConfig } from '../../store/treble';
|
|
3
4
|
interface Theme {
|
|
4
5
|
[key: string]: string | number;
|
|
5
6
|
}
|
|
6
7
|
export interface ThreekitProviderProps extends Partial<ILaunchConfig> {
|
|
7
8
|
theme?: Theme;
|
|
9
|
+
reducer?: Record<string, Reducer>;
|
|
8
10
|
children: React.ReactNode;
|
|
9
11
|
}
|
|
10
12
|
declare const ThreekitProvider: (props: ThreekitProviderProps) => JSX.Element;
|
|
@@ -24,7 +24,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
var react_1 = __importStar(require("react"));
|
|
26
26
|
var store_1 = __importStar(require("../../store"));
|
|
27
|
-
var
|
|
27
|
+
var treble_1 = require("../../store/treble");
|
|
28
28
|
var react_redux_1 = require("react-redux");
|
|
29
29
|
var styled_components_1 = require("styled-components");
|
|
30
30
|
var theme_1 = __importDefault(require("../../theme"));
|
|
@@ -34,7 +34,7 @@ var App = function (props) {
|
|
|
34
34
|
(0, react_1.useEffect)(function () {
|
|
35
35
|
var init = function () {
|
|
36
36
|
var playerConfig = props.playerConfig, project = props.project, locale = props.locale, threekitEnv = props.threekitEnv, eventHandlers = props.eventHandlers;
|
|
37
|
-
dispatch((0,
|
|
37
|
+
dispatch((0, treble_1.launch)({ playerConfig: playerConfig, project: project, locale: locale, threekitEnv: threekitEnv, eventHandlers: eventHandlers }));
|
|
38
38
|
};
|
|
39
39
|
init();
|
|
40
40
|
return;
|
|
@@ -42,7 +42,7 @@ var App = function (props) {
|
|
|
42
42
|
return react_1.default.createElement(react_1.default.Fragment, null, props.children);
|
|
43
43
|
};
|
|
44
44
|
var ThreekitProvider = function (props) {
|
|
45
|
-
return (react_1.default.createElement(react_redux_1.Provider, { store: store_1.default },
|
|
45
|
+
return (react_1.default.createElement(react_redux_1.Provider, { store: (0, store_1.default)(props.reducer) },
|
|
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
48
|
react_1.default.createElement(App, { locale: props.locale, project: props.project, playerConfig: props.playerConfig, threekitEnv: props.threekitEnv, eventHandlers: props.eventHandlers }, props.children))));
|
|
@@ -45,7 +45,7 @@ interface IPrepAttributeConfig {
|
|
|
45
45
|
sort?: string;
|
|
46
46
|
}
|
|
47
47
|
export declare const prepAttributeForComponent: (attribute: IThreekitDisplayAttribute, config: IPrepAttributeConfig) => {
|
|
48
|
-
selected: string | number | import("../../threekit").
|
|
48
|
+
selected: string | number | import("../../threekit").IConfigurationAsset | import("../../threekit").IConfigurationColor;
|
|
49
49
|
options: IDisplayAttributeAssetValue[] | {
|
|
50
50
|
name: string;
|
|
51
51
|
label: string;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var store_1 = require("../../store");
|
|
4
|
-
var
|
|
4
|
+
var attributes_1 = require("../../store/attributes");
|
|
5
5
|
var utils_1 = require("../../utils");
|
|
6
6
|
var useAttribute = function (attributeName) {
|
|
7
7
|
if (!attributeName)
|
|
8
8
|
return [undefined, undefined];
|
|
9
9
|
var dispatch = (0, store_1.useThreekitDispatch)();
|
|
10
|
-
var attributes = (0, store_1.useThreekitSelector)(
|
|
10
|
+
var attributes = (0, store_1.useThreekitSelector)(attributes_1.getAttributes);
|
|
11
11
|
if (!attributeName || !attributes)
|
|
12
12
|
return [undefined, undefined];
|
|
13
13
|
var attribute = attributes[attributeName];
|
|
@@ -16,7 +16,7 @@ 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
|
-
dispatch((0,
|
|
19
|
+
dispatch((0, attributes_1.setConfiguration)((_a = {},
|
|
20
20
|
_a[attributeName] = preppedValue,
|
|
21
21
|
_a)));
|
|
22
22
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var
|
|
3
|
+
var attributes_1 = require("../../store/attributes");
|
|
4
4
|
var store_1 = require("../../store");
|
|
5
5
|
var useConfigurator = function () {
|
|
6
6
|
var dispatch = (0, store_1.useThreekitDispatch)();
|
|
7
|
-
var attributes = (0, store_1.useThreekitSelector)(
|
|
7
|
+
var attributes = (0, store_1.useThreekitSelector)(attributes_1.getAttributes);
|
|
8
8
|
if (!attributes)
|
|
9
9
|
return [undefined, undefined];
|
|
10
10
|
var handleChange = function (configuration) {
|
|
11
|
-
return dispatch((0,
|
|
11
|
+
return dispatch((0, attributes_1.setConfiguration)(configuration));
|
|
12
12
|
};
|
|
13
13
|
return [attributes, handleChange];
|
|
14
14
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var store_1 = require("../../store");
|
|
4
|
-
var
|
|
4
|
+
var product_1 = require("../../store/product");
|
|
5
5
|
var useMetadata = function () {
|
|
6
|
-
var metadata = (0, store_1.useThreekitSelector)(
|
|
6
|
+
var metadata = (0, store_1.useThreekitSelector)(product_1.getMetadata);
|
|
7
7
|
return metadata;
|
|
8
8
|
};
|
|
9
9
|
exports.default = useMetadata;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var store_1 = require("../../store");
|
|
4
|
-
var
|
|
5
|
-
var useName = function () { return (0, store_1.useThreekitSelector)(
|
|
4
|
+
var product_1 = require("../../store/product");
|
|
5
|
+
var useName = function () { return (0, store_1.useThreekitSelector)(product_1.getName); };
|
|
6
6
|
exports.default = useName;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var store_1 = require("../../store");
|
|
4
|
-
var
|
|
4
|
+
var treble_1 = require("../../store/treble");
|
|
5
5
|
var usePlayerLoadingStatus = function () {
|
|
6
|
-
return (0, store_1.useThreekitSelector)(
|
|
6
|
+
return (0, store_1.useThreekitSelector)(treble_1.isPlayerLoading);
|
|
7
7
|
};
|
|
8
8
|
exports.default = usePlayerLoadingStatus;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var react_1 = require("react");
|
|
4
4
|
var react_redux_1 = require("react-redux");
|
|
5
|
-
var
|
|
5
|
+
var treble_1 = require("../../store/treble");
|
|
6
6
|
var constants_1 = require("../../constants");
|
|
7
7
|
var usePlayerPortal = function () {
|
|
8
8
|
var htmlElements = (0, react_1.useRef)({
|
|
@@ -10,7 +10,7 @@ var usePlayerPortal = function () {
|
|
|
10
10
|
playerLoader: null,
|
|
11
11
|
playerWrapper: null,
|
|
12
12
|
});
|
|
13
|
-
var playerElementId = (0, react_redux_1.useSelector)(
|
|
13
|
+
var playerElementId = (0, react_redux_1.useSelector)(treble_1.getPlayerElementId);
|
|
14
14
|
if (!playerElementId)
|
|
15
15
|
return [undefined, undefined];
|
|
16
16
|
var portalPlayerTo = function (toEl) {
|
|
@@ -26,7 +26,6 @@ var usePlayerPortal = function () {
|
|
|
26
26
|
htmlElements.current.playerWrapper.appendChild(htmlElements.current.player);
|
|
27
27
|
};
|
|
28
28
|
var returnPlayer = function () {
|
|
29
|
-
constants_1.TK_PLAYER_LOADER_DIV;
|
|
30
29
|
if (!htmlElements.current.player)
|
|
31
30
|
htmlElements.current.player = document.getElementById(playerElementId);
|
|
32
31
|
if (!htmlElements.current.playerLoader)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var store_1 = require("../../store");
|
|
4
|
-
var
|
|
5
|
-
var usePrice = function () { return (0, store_1.useThreekitSelector)(
|
|
4
|
+
var price_1 = require("../../store/price");
|
|
5
|
+
var usePrice = function () { return (0, store_1.useThreekitSelector)(price_1.getPrice); };
|
|
6
6
|
exports.default = usePrice;
|
|
@@ -40,11 +40,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
42
|
var store_1 = require("../../store");
|
|
43
|
-
var
|
|
43
|
+
var treble_1 = require("../../store/treble");
|
|
44
44
|
var message_1 = __importDefault(require("../../components/message"));
|
|
45
45
|
var utils_1 = require("../../utils");
|
|
46
46
|
var useShare = function () {
|
|
47
|
-
var isLoaded = (0, store_1.useThreekitSelector)(
|
|
47
|
+
var isLoaded = (0, store_1.useThreekitSelector)(treble_1.isThreekitInitialized);
|
|
48
48
|
if (!isLoaded)
|
|
49
49
|
return undefined;
|
|
50
50
|
var handleShare = function (msg) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var store_1 = require("../../store");
|
|
4
|
-
var
|
|
4
|
+
var treble_1 = require("../../store/treble");
|
|
5
5
|
var useSnapshot = function (cameras, config) {
|
|
6
|
-
var isLoaded = (0, store_1.useThreekitSelector)(
|
|
6
|
+
var isLoaded = (0, store_1.useThreekitSelector)(treble_1.isThreekitInitialized);
|
|
7
7
|
if (!isLoaded)
|
|
8
8
|
return undefined;
|
|
9
9
|
var takeSnapshot = function () {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var store_1 = require("../../store");
|
|
4
|
-
var
|
|
4
|
+
var treble_1 = require("../../store/treble");
|
|
5
5
|
var useThreekitInitStatus = function () {
|
|
6
|
-
return (0, store_1.useThreekitSelector)(
|
|
6
|
+
return (0, store_1.useThreekitSelector)(treble_1.isThreekitInitialized);
|
|
7
7
|
};
|
|
8
8
|
exports.default = useThreekitInitStatus;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ISaveConfigurationConfig, WishlistArray } from '../../Treble';
|
|
2
2
|
declare type UseWishlistHook = [
|
|
3
3
|
WishlistArray,
|
|
4
|
-
(config?: ISaveConfigurationConfig) =>
|
|
4
|
+
(config?: ISaveConfigurationConfig) => void,
|
|
5
5
|
(idx: number) => void,
|
|
6
6
|
(idx: number) => void,
|
|
7
7
|
(idx: number) => void,
|
|
@@ -3,25 +3,26 @@ 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
|
-
var
|
|
6
|
+
var wishlist_1 = require("../../store/wishlist");
|
|
7
|
+
var treble_1 = require("../../store/treble");
|
|
7
8
|
var store_1 = require("../../store");
|
|
8
9
|
var utils_1 = require("../../utils");
|
|
9
10
|
var message_1 = __importDefault(require("../../components/message"));
|
|
10
11
|
var useWishlist = function () {
|
|
11
12
|
var dispatch = (0, store_1.useThreekitDispatch)();
|
|
12
|
-
var isLoaded = (0, store_1.useThreekitSelector)(
|
|
13
|
-
var wishlist = (0, store_1.useThreekitSelector)(
|
|
13
|
+
var isLoaded = (0, store_1.useThreekitSelector)(treble_1.isThreekitInitialized);
|
|
14
|
+
var wishlist = (0, store_1.useThreekitSelector)(wishlist_1.getWishlist);
|
|
14
15
|
if (!isLoaded)
|
|
15
16
|
return [undefined, undefined, undefined, undefined, undefined, undefined];
|
|
16
17
|
var handleAddToWishlist = function (config) {
|
|
17
|
-
return dispatch((0,
|
|
18
|
+
return dispatch((0, wishlist_1.addToWishlist)(config));
|
|
18
19
|
};
|
|
19
20
|
var handleRemoveFromWishlist = function (idx) {
|
|
20
|
-
dispatch((0,
|
|
21
|
+
dispatch((0, wishlist_1.removeFromWishlist)(idx));
|
|
21
22
|
message_1.default.info('Item removed from wishlist');
|
|
22
23
|
};
|
|
23
24
|
var handleResumeItem = function (idx) {
|
|
24
|
-
dispatch((0,
|
|
25
|
+
dispatch((0, wishlist_1.resumeFromWishlist)(idx));
|
|
25
26
|
};
|
|
26
27
|
var handleShareItem = function (idx) {
|
|
27
28
|
var url = (0, utils_1.getResumableUrl)(wishlist[idx].shortId);
|
|
@@ -29,7 +30,7 @@ var useWishlist = function () {
|
|
|
29
30
|
message_1.default.info('Link copied!');
|
|
30
31
|
};
|
|
31
32
|
var handleClearWishlist = function () {
|
|
32
|
-
dispatch(
|
|
33
|
+
dispatch(wishlist_1.clearWishlist);
|
|
33
34
|
};
|
|
34
35
|
return [
|
|
35
36
|
wishlist,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RootState, ThreekitDispatch } from './index';
|
|
2
|
+
import { ISetConfiguration, IThreekitDisplayAttribute } from '../threekit';
|
|
3
|
+
/*****************************************************
|
|
4
|
+
* Types and Interfaces
|
|
5
|
+
****************************************************/
|
|
6
|
+
export declare type AttributesState = Record<string, IThreekitDisplayAttribute>;
|
|
7
|
+
/*****************************************************
|
|
8
|
+
* Actions
|
|
9
|
+
****************************************************/
|
|
10
|
+
export declare const setAttributes: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[attributes: IThreekitDisplayAttribute[]], Record<string, IThreekitDisplayAttribute>, "treble/attributes/set-attributes", never, never>;
|
|
11
|
+
/*****************************************************
|
|
12
|
+
* Slice
|
|
13
|
+
****************************************************/
|
|
14
|
+
declare const reducer: import("redux").Reducer<AttributesState, import("redux").AnyAction>;
|
|
15
|
+
/*****************************************************
|
|
16
|
+
* Standard Selectors
|
|
17
|
+
****************************************************/
|
|
18
|
+
export declare const getAttributes: (state: RootState) => undefined | Record<string, IThreekitDisplayAttribute>;
|
|
19
|
+
export declare const setConfiguration: (config: ISetConfiguration) => (dispatch: ThreekitDispatch) => Promise<void>;
|
|
20
|
+
export default reducer;
|