@threekit-tools/treble 0.0.82 → 0.0.85
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 +9 -3
- package/dist/Treble/Treble.js +40 -11
- 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.js +3 -3
- package/dist/api/datatables.js +5 -5
- 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 +2 -12
- package/dist/components/Share/index.js +139 -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/datatables.js +0 -1
- 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 +0 -15
- package/dist/store/treble.js +31 -66
- package/dist/store/wishlist.d.ts +0 -12
- package/dist/store/wishlist.js +4 -17
- package/dist/types.d.ts +71 -58
- package/dist/types.js +54 -0
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +8 -16
- package/package.json +18 -4
- package/dist/Treble/Snapshots.js +0 -251
- package/dist/Treble/Wishlist.js +0 -136
package/dist/index.js
CHANGED
|
@@ -1,24 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = 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);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
4
|
};
|
|
19
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.
|
|
21
|
-
|
|
6
|
+
exports.ArrowLeftIcon = exports.AddIcon = exports.ProductLayout = exports.TrebleApp = exports.Share = exports.Wishlist = exports.Snapshots = exports.Zoom = exports.FlatForm = exports.AwaitThreekitLoad = exports.PortalToElement = exports.PortalToArOverlay = exports.Tabs = exports.Accordion = exports.Drawer = exports.Modal = exports.message = exports.TotalPrice = exports.AttributeValue = exports.AttributeTitle = exports.ProductDescription = exports.ProductName = exports.Switch = exports.Upload = exports.TilesGroup = exports.Tiles = exports.Swatch = exports.Strips = exports.Dropdown = exports.Cards = exports.Button = exports.Player = exports.ThreekitProvider = exports.usePlayer = exports.useLoadingProgress = exports.useNestedConfigurator = exports.useProductCache = exports.usePlayerPortal = exports.useShare = exports.useWishlist = exports.useSnapshot = exports.useZoom = exports.useThreekitInitStatus = exports.usePrice = exports.usePlayerLoadingStatus = exports.useName = exports.useMetadata = exports.useConfigurationLoader = exports.useConfigurator = exports.useAttribute = void 0;
|
|
7
|
+
exports.SpinnerIcon = exports.ZoomOutIcon = exports.ZoomInIcon = exports.WishlistIcon = exports.UndoIcon = exports.TagIcon = exports.SwitchIcon = exports.ShareIcon = exports.SettingsIcon = exports.SearchIcon = exports.RulerIcon = exports.RemoveIcon = exports.RedoIcon = exports.PlayIcon = exports.PauseIcon = exports.NewWindowIcon = exports.MoreIcon = exports.MenuIcon = exports.MailIcon = exports.InfoIcon = exports.ImageIcon = exports.HeartIcon = exports.EditIcon = exports.DragIcon = exports.DownloadIcon = exports.DoubleCaretRightIcon = exports.DoubleCaretLeftIcon = exports.DeleteIcon = exports.CopyIcon = exports.ColorPickerIcon = exports.ClipboardIcon = exports.CheckmateIcon = exports.CartIcon = exports.CaretRightIcon = exports.CaretLeftIcon = exports.CaretUpIcon = exports.CaretDownIcon = exports.CameraIcon = exports.ArrowRightIcon = void 0;
|
|
22
8
|
var useAttribute_1 = __importDefault(require("./hooks/useAttribute"));
|
|
23
9
|
exports.useAttribute = useAttribute_1.default;
|
|
24
10
|
var useConfigurator_1 = __importDefault(require("./hooks/useConfigurator"));
|
|
@@ -45,7 +31,6 @@ var useShare_1 = __importDefault(require("./hooks/useShare"));
|
|
|
45
31
|
exports.useShare = useShare_1.default;
|
|
46
32
|
var usePlayerPortal_1 = __importDefault(require("./hooks/usePlayerPortal"));
|
|
47
33
|
exports.usePlayerPortal = usePlayerPortal_1.default;
|
|
48
|
-
// import useSingleAnimation from './hooks/useSingleAnimation';
|
|
49
34
|
var useProductCache_1 = __importDefault(require("./hooks/useProductCache"));
|
|
50
35
|
exports.useProductCache = useProductCache_1.default;
|
|
51
36
|
var useNestedConfigurator_1 = __importDefault(require("./hooks/useNestedConfigurator"));
|
|
@@ -54,12 +39,10 @@ var useLoadingProgress_1 = __importDefault(require("./hooks/useLoadingProgress")
|
|
|
54
39
|
exports.useLoadingProgress = useLoadingProgress_1.default;
|
|
55
40
|
var usePlayer_1 = __importDefault(require("./hooks/usePlayer"));
|
|
56
41
|
exports.usePlayer = usePlayer_1.default;
|
|
57
|
-
// Components
|
|
58
42
|
var ThreekitProvider_1 = __importDefault(require("./components/ThreekitProvider"));
|
|
59
43
|
exports.ThreekitProvider = ThreekitProvider_1.default;
|
|
60
44
|
var Player_1 = __importDefault(require("./components/Player"));
|
|
61
45
|
exports.Player = Player_1.default;
|
|
62
|
-
// Form Components
|
|
63
46
|
var Button_1 = __importDefault(require("./components/Button"));
|
|
64
47
|
exports.Button = Button_1.default;
|
|
65
48
|
var Cards_1 = __importDefault(require("./components/Cards"));
|
|
@@ -78,7 +61,6 @@ var Upload_1 = __importDefault(require("./components/Upload"));
|
|
|
78
61
|
exports.Upload = Upload_1.default;
|
|
79
62
|
var Switch_1 = __importDefault(require("./components/Switch"));
|
|
80
63
|
exports.Switch = Switch_1.default;
|
|
81
|
-
// Display
|
|
82
64
|
var ProductName_1 = __importDefault(require("./components/ProductName"));
|
|
83
65
|
exports.ProductName = ProductName_1.default;
|
|
84
66
|
var ProductDescription_1 = __importDefault(require("./components/ProductDescription"));
|
|
@@ -89,10 +71,8 @@ var AttributeValue_1 = __importDefault(require("./components/AttributeValue"));
|
|
|
89
71
|
exports.AttributeValue = AttributeValue_1.default;
|
|
90
72
|
var TotalPrice_1 = __importDefault(require("./components/TotalPrice"));
|
|
91
73
|
exports.TotalPrice = TotalPrice_1.default;
|
|
92
|
-
// Messaging
|
|
93
74
|
var message_1 = __importDefault(require("./components/message"));
|
|
94
75
|
exports.message = message_1.default;
|
|
95
|
-
// Layouts
|
|
96
76
|
var Modal_1 = __importDefault(require("./components/Modal"));
|
|
97
77
|
exports.Modal = Modal_1.default;
|
|
98
78
|
var Drawer_1 = __importDefault(require("./components/Drawer"));
|
|
@@ -101,17 +81,14 @@ var Accordion_1 = __importDefault(require("./components/Accordion"));
|
|
|
101
81
|
exports.Accordion = Accordion_1.default;
|
|
102
82
|
var Tabs_1 = __importDefault(require("./components/Tabs"));
|
|
103
83
|
exports.Tabs = Tabs_1.default;
|
|
104
|
-
// Wrappers
|
|
105
84
|
var PortalToArOverlay_1 = __importDefault(require("./components/PortalToArOverlay"));
|
|
106
85
|
exports.PortalToArOverlay = PortalToArOverlay_1.default;
|
|
107
86
|
var PortalToElement_1 = __importDefault(require("./components/PortalToElement"));
|
|
108
87
|
exports.PortalToElement = PortalToElement_1.default;
|
|
109
88
|
var AwaitThreekitLoad_1 = __importDefault(require("./components/AwaitThreekitLoad"));
|
|
110
89
|
exports.AwaitThreekitLoad = AwaitThreekitLoad_1.default;
|
|
111
|
-
// Forms
|
|
112
90
|
var FlatForm_1 = __importDefault(require("./components/FlatForm"));
|
|
113
91
|
exports.FlatForm = FlatForm_1.default;
|
|
114
|
-
// Widgets
|
|
115
92
|
var Zoom_1 = __importDefault(require("./components/Zoom"));
|
|
116
93
|
exports.Zoom = Zoom_1.default;
|
|
117
94
|
var Snapshots_1 = __importDefault(require("./components/Snapshots"));
|
|
@@ -120,12 +97,89 @@ var Wishlist_1 = __importDefault(require("./components/Wishlist"));
|
|
|
120
97
|
exports.Wishlist = Wishlist_1.default;
|
|
121
98
|
var Share_1 = __importDefault(require("./components/Share"));
|
|
122
99
|
exports.Share = Share_1.default;
|
|
123
|
-
// Icons
|
|
124
|
-
var icons_1 = __importDefault(require("./icons"));
|
|
125
|
-
exports.icons = icons_1.default;
|
|
126
|
-
__exportStar(require("./icons"), exports);
|
|
127
|
-
// Products - Multi-configurtors
|
|
128
100
|
var TrebleApp_1 = __importDefault(require("./components/TrebleApp"));
|
|
129
101
|
exports.TrebleApp = TrebleApp_1.default;
|
|
130
102
|
var ProductLayout_1 = __importDefault(require("./components/ProductLayout"));
|
|
131
103
|
exports.ProductLayout = ProductLayout_1.default;
|
|
104
|
+
var Add_1 = __importDefault(require("./icons/Add"));
|
|
105
|
+
exports.AddIcon = Add_1.default;
|
|
106
|
+
var ArrowLeft_1 = __importDefault(require("./icons/ArrowLeft"));
|
|
107
|
+
exports.ArrowLeftIcon = ArrowLeft_1.default;
|
|
108
|
+
var ArrowRight_1 = __importDefault(require("./icons/ArrowRight"));
|
|
109
|
+
exports.ArrowRightIcon = ArrowRight_1.default;
|
|
110
|
+
var Camera_1 = __importDefault(require("./icons/Camera"));
|
|
111
|
+
exports.CameraIcon = Camera_1.default;
|
|
112
|
+
var CaretDown_1 = __importDefault(require("./icons/CaretDown"));
|
|
113
|
+
exports.CaretDownIcon = CaretDown_1.default;
|
|
114
|
+
var CaretUp_1 = __importDefault(require("./icons/CaretUp"));
|
|
115
|
+
exports.CaretUpIcon = CaretUp_1.default;
|
|
116
|
+
var CaretLeft_1 = __importDefault(require("./icons/CaretLeft"));
|
|
117
|
+
exports.CaretLeftIcon = CaretLeft_1.default;
|
|
118
|
+
var CaretRight_1 = __importDefault(require("./icons/CaretRight"));
|
|
119
|
+
exports.CaretRightIcon = CaretRight_1.default;
|
|
120
|
+
var Cart_1 = __importDefault(require("./icons/Cart"));
|
|
121
|
+
exports.CartIcon = Cart_1.default;
|
|
122
|
+
var Checkmate_1 = __importDefault(require("./icons/Checkmate"));
|
|
123
|
+
exports.CheckmateIcon = Checkmate_1.default;
|
|
124
|
+
var Clipboard_1 = __importDefault(require("./icons/Clipboard"));
|
|
125
|
+
exports.ClipboardIcon = Clipboard_1.default;
|
|
126
|
+
var ColorPicker_1 = __importDefault(require("./icons/ColorPicker"));
|
|
127
|
+
exports.ColorPickerIcon = ColorPicker_1.default;
|
|
128
|
+
var Copy_1 = __importDefault(require("./icons/Copy"));
|
|
129
|
+
exports.CopyIcon = Copy_1.default;
|
|
130
|
+
var Delete_1 = __importDefault(require("./icons/Delete"));
|
|
131
|
+
exports.DeleteIcon = Delete_1.default;
|
|
132
|
+
var DoubleCaretLeft_1 = __importDefault(require("./icons/DoubleCaretLeft"));
|
|
133
|
+
exports.DoubleCaretLeftIcon = DoubleCaretLeft_1.default;
|
|
134
|
+
var DoubleCaretRight_1 = __importDefault(require("./icons/DoubleCaretRight"));
|
|
135
|
+
exports.DoubleCaretRightIcon = DoubleCaretRight_1.default;
|
|
136
|
+
var Download_1 = __importDefault(require("./icons/Download"));
|
|
137
|
+
exports.DownloadIcon = Download_1.default;
|
|
138
|
+
var Drag_1 = __importDefault(require("./icons/Drag"));
|
|
139
|
+
exports.DragIcon = Drag_1.default;
|
|
140
|
+
var Edit_1 = __importDefault(require("./icons/Edit"));
|
|
141
|
+
exports.EditIcon = Edit_1.default;
|
|
142
|
+
var Heart_1 = __importDefault(require("./icons/Heart"));
|
|
143
|
+
exports.HeartIcon = Heart_1.default;
|
|
144
|
+
var Image_1 = __importDefault(require("./icons/Image"));
|
|
145
|
+
exports.ImageIcon = Image_1.default;
|
|
146
|
+
var Info_1 = __importDefault(require("./icons/Info"));
|
|
147
|
+
exports.InfoIcon = Info_1.default;
|
|
148
|
+
var Mail_1 = __importDefault(require("./icons/Mail"));
|
|
149
|
+
exports.MailIcon = Mail_1.default;
|
|
150
|
+
var Menu_1 = __importDefault(require("./icons/Menu"));
|
|
151
|
+
exports.MenuIcon = Menu_1.default;
|
|
152
|
+
var More_1 = __importDefault(require("./icons/More"));
|
|
153
|
+
exports.MoreIcon = More_1.default;
|
|
154
|
+
var NewWindow_1 = __importDefault(require("./icons/NewWindow"));
|
|
155
|
+
exports.NewWindowIcon = NewWindow_1.default;
|
|
156
|
+
var Pause_1 = __importDefault(require("./icons/Pause"));
|
|
157
|
+
exports.PauseIcon = Pause_1.default;
|
|
158
|
+
var Play_1 = __importDefault(require("./icons/Play"));
|
|
159
|
+
exports.PlayIcon = Play_1.default;
|
|
160
|
+
var Redo_1 = __importDefault(require("./icons/Redo"));
|
|
161
|
+
exports.RedoIcon = Redo_1.default;
|
|
162
|
+
var Remove_1 = __importDefault(require("./icons/Remove"));
|
|
163
|
+
exports.RemoveIcon = Remove_1.default;
|
|
164
|
+
var Ruler_1 = __importDefault(require("./icons/Ruler"));
|
|
165
|
+
exports.RulerIcon = Ruler_1.default;
|
|
166
|
+
var Search_1 = __importDefault(require("./icons/Search"));
|
|
167
|
+
exports.SearchIcon = Search_1.default;
|
|
168
|
+
var Settings_1 = __importDefault(require("./icons/Settings"));
|
|
169
|
+
exports.SettingsIcon = Settings_1.default;
|
|
170
|
+
var Share_2 = __importDefault(require("./icons/Share"));
|
|
171
|
+
exports.ShareIcon = Share_2.default;
|
|
172
|
+
var Switch_2 = __importDefault(require("./icons/Switch"));
|
|
173
|
+
exports.SwitchIcon = Switch_2.default;
|
|
174
|
+
var Tag_1 = __importDefault(require("./icons/Tag"));
|
|
175
|
+
exports.TagIcon = Tag_1.default;
|
|
176
|
+
var Undo_1 = __importDefault(require("./icons/Undo"));
|
|
177
|
+
exports.UndoIcon = Undo_1.default;
|
|
178
|
+
var Wishlist_2 = __importDefault(require("./icons/Wishlist"));
|
|
179
|
+
exports.WishlistIcon = Wishlist_2.default;
|
|
180
|
+
var ZoomIn_1 = __importDefault(require("./icons/ZoomIn"));
|
|
181
|
+
exports.ZoomInIcon = ZoomIn_1.default;
|
|
182
|
+
var ZoomOut_1 = __importDefault(require("./icons/ZoomOut"));
|
|
183
|
+
exports.ZoomOutIcon = ZoomOut_1.default;
|
|
184
|
+
var Spinner_1 = __importDefault(require("./icons/Spinner"));
|
|
185
|
+
exports.SpinnerIcon = Spinner_1.default;
|
|
@@ -1,21 +1,9 @@
|
|
|
1
1
|
import { RootState, ThreekitDispatch } from './index';
|
|
2
2
|
import { ISetConfiguration, IThreekitDisplayAttribute } from '../types';
|
|
3
3
|
import { ITranslationMap } from '../api/products';
|
|
4
|
-
/*****************************************************
|
|
5
|
-
* Types and Interfaces
|
|
6
|
-
****************************************************/
|
|
7
4
|
export declare type AttributesState = Record<string, IThreekitDisplayAttribute>;
|
|
8
|
-
/*****************************************************
|
|
9
|
-
* Actions
|
|
10
|
-
****************************************************/
|
|
11
5
|
export declare const setAttributes: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[attributes: IThreekitDisplayAttribute[]], Record<string, IThreekitDisplayAttribute>, "treble/attributes/set-attributes", never, never>;
|
|
12
|
-
/*****************************************************
|
|
13
|
-
* Slice
|
|
14
|
-
****************************************************/
|
|
15
6
|
declare const reducer: import("redux").Reducer<AttributesState, import("redux").AnyAction>;
|
|
16
|
-
/*****************************************************
|
|
17
|
-
* Standard Selectors
|
|
18
|
-
****************************************************/
|
|
19
7
|
export declare const getAttributes: (state: RootState) => AttributesState;
|
|
20
8
|
export declare const getHydrationData: ((state: {
|
|
21
9
|
treble: import("./treble").TrebleState;
|
package/dist/store/attributes.js
CHANGED
|
@@ -40,9 +40,6 @@ exports.setConfiguration = exports.getHydrationData = exports.getAttributes = ex
|
|
|
40
40
|
var toolkit_1 = require("@reduxjs/toolkit");
|
|
41
41
|
var treble_1 = require("./treble");
|
|
42
42
|
var translations_1 = require("./translations");
|
|
43
|
-
/*****************************************************
|
|
44
|
-
* Actions
|
|
45
|
-
****************************************************/
|
|
46
43
|
exports.setAttributes = (0, toolkit_1.createAction)('treble/attributes/set-attributes', function (attributes) {
|
|
47
44
|
var payload = attributes.reduce(function (output, attr) {
|
|
48
45
|
var _a;
|
|
@@ -50,13 +47,7 @@ exports.setAttributes = (0, toolkit_1.createAction)('treble/attributes/set-attri
|
|
|
50
47
|
}, {});
|
|
51
48
|
return { payload: payload };
|
|
52
49
|
});
|
|
53
|
-
/*****************************************************
|
|
54
|
-
* State and Data
|
|
55
|
-
****************************************************/
|
|
56
50
|
var initialState = {};
|
|
57
|
-
/*****************************************************
|
|
58
|
-
* Slice
|
|
59
|
-
****************************************************/
|
|
60
51
|
var reducer = (0, toolkit_1.createSlice)({
|
|
61
52
|
name: 'attributes',
|
|
62
53
|
initialState: initialState,
|
|
@@ -74,25 +65,21 @@ var reducer = (0, toolkit_1.createSlice)({
|
|
|
74
65
|
});
|
|
75
66
|
},
|
|
76
67
|
}).reducer;
|
|
77
|
-
/*****************************************************
|
|
78
|
-
* Standard Selectors
|
|
79
|
-
****************************************************/
|
|
80
68
|
var getAttributes = function (state) { return state.attributes; };
|
|
81
69
|
exports.getAttributes = getAttributes;
|
|
82
70
|
exports.getHydrationData = (0, toolkit_1.createSelector)(exports.getAttributes, translations_1.getLanguage, function (attributes, language) {
|
|
83
71
|
return [attributes, translations_1.TRANSLATIONS, language];
|
|
84
72
|
});
|
|
85
|
-
// Configurator
|
|
86
73
|
var setConfiguration = function (config) { return function (dispatch) { return __awaiter(void 0, void 0, void 0, function () {
|
|
87
74
|
return __generator(this, function (_a) {
|
|
88
75
|
switch (_a.label) {
|
|
89
76
|
case 0:
|
|
90
77
|
dispatch((0, treble_1.setPlayerLoading)(true));
|
|
91
|
-
return [4
|
|
78
|
+
return [4, window.threekit.configurator.setConfiguration(config)];
|
|
92
79
|
case 1:
|
|
93
80
|
_a.sent();
|
|
94
81
|
dispatch((0, treble_1.setPlayerLoading)(false));
|
|
95
|
-
return [2
|
|
82
|
+
return [2];
|
|
96
83
|
}
|
|
97
84
|
});
|
|
98
85
|
}); }; };
|
package/dist/store/price.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { RootState, ThreekitDispatch } from './index';
|
|
2
|
-
/*****************************************************
|
|
3
|
-
* Types and Interfaces
|
|
4
|
-
****************************************************/
|
|
5
2
|
export interface IPriceConfig {
|
|
6
3
|
id: string;
|
|
7
4
|
currency: string;
|
|
@@ -15,20 +12,11 @@ export interface PriceState {
|
|
|
15
12
|
currency: undefined | string;
|
|
16
13
|
price: undefined | number;
|
|
17
14
|
}
|
|
18
|
-
/*****************************************************
|
|
19
|
-
* Actions
|
|
20
|
-
****************************************************/
|
|
21
15
|
export declare const setPriceConfig: import("@reduxjs/toolkit").ActionCreatorWithPayload<IPriceConfig, string>;
|
|
22
16
|
export declare const setPrice: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, string>;
|
|
23
17
|
export declare const initPrice: () => (dispatch: ThreekitDispatch) => Promise<void>;
|
|
24
18
|
declare const reducer: import("redux").Reducer<PriceState, import("redux").AnyAction>;
|
|
25
|
-
/*****************************************************
|
|
26
|
-
* Standard Selectors
|
|
27
|
-
****************************************************/
|
|
28
19
|
export declare const getPrice: (state: RootState) => undefined | IPrice;
|
|
29
20
|
export declare const getPriceConfig: (state: RootState) => undefined | IPriceConfig;
|
|
30
|
-
/*****************************************************
|
|
31
|
-
* Complex Actions
|
|
32
|
-
****************************************************/
|
|
33
21
|
export declare const updatePrice: () => (dispatch: ThreekitDispatch, getState: () => RootState) => void;
|
|
34
22
|
export default reducer;
|
package/dist/store/price.js
CHANGED
|
@@ -42,17 +42,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
42
42
|
exports.updatePrice = exports.getPriceConfig = exports.getPrice = exports.initPrice = exports.setPrice = exports.setPriceConfig = void 0;
|
|
43
43
|
var toolkit_1 = require("@reduxjs/toolkit");
|
|
44
44
|
var api_1 = __importDefault(require("../api"));
|
|
45
|
-
/*****************************************************
|
|
46
|
-
* Actions
|
|
47
|
-
****************************************************/
|
|
48
|
-
// Actions to be used only internally
|
|
49
45
|
exports.setPriceConfig = (0, toolkit_1.createAction)('treble/price/set-price-config');
|
|
50
46
|
exports.setPrice = (0, toolkit_1.createAction)('treble/price/set-price');
|
|
51
47
|
var initPrice = function () { return function (dispatch) { return __awaiter(void 0, void 0, void 0, function () {
|
|
52
48
|
var pricebook, id, currency, price;
|
|
53
49
|
return __generator(this, function (_a) {
|
|
54
50
|
switch (_a.label) {
|
|
55
|
-
case 0: return [4
|
|
51
|
+
case 0: return [4, api_1.default.price.getPricebooksList()];
|
|
56
52
|
case 1:
|
|
57
53
|
pricebook = _a.sent();
|
|
58
54
|
if (pricebook.length) {
|
|
@@ -62,16 +58,12 @@ var initPrice = function () { return function (dispatch) { return __awaiter(void
|
|
|
62
58
|
price = window.threekit.configurator.getPrice(id, currency);
|
|
63
59
|
dispatch((0, exports.setPrice)(price));
|
|
64
60
|
}
|
|
65
|
-
return [2
|
|
61
|
+
return [2];
|
|
66
62
|
}
|
|
67
63
|
});
|
|
68
64
|
}); }; };
|
|
69
65
|
exports.initPrice = initPrice;
|
|
70
|
-
/*****************************************************
|
|
71
|
-
* State
|
|
72
|
-
****************************************************/
|
|
73
66
|
var initialState = {
|
|
74
|
-
// Selected language
|
|
75
67
|
id: undefined,
|
|
76
68
|
currency: undefined,
|
|
77
69
|
price: undefined,
|
|
@@ -93,9 +85,6 @@ var reducer = (0, toolkit_1.createSlice)({
|
|
|
93
85
|
},
|
|
94
86
|
reducers: {},
|
|
95
87
|
}).reducer;
|
|
96
|
-
/*****************************************************
|
|
97
|
-
* Standard Selectors
|
|
98
|
-
****************************************************/
|
|
99
88
|
var getPrice = function (state) {
|
|
100
89
|
var _a = state.price, price = _a.price, currency = _a.currency;
|
|
101
90
|
if (!price || !currency)
|
|
@@ -110,9 +99,6 @@ var getPriceConfig = function (state) {
|
|
|
110
99
|
return { id: id, currency: currency };
|
|
111
100
|
};
|
|
112
101
|
exports.getPriceConfig = getPriceConfig;
|
|
113
|
-
/*****************************************************
|
|
114
|
-
* Complex Actions
|
|
115
|
-
****************************************************/
|
|
116
102
|
var updatePrice = function () { return function (dispatch, getState) {
|
|
117
103
|
var price = getState().price;
|
|
118
104
|
if (!price.id || !price.currency)
|
package/dist/store/product.d.ts
CHANGED
|
@@ -2,9 +2,6 @@ import { RootState, ThreekitDispatch } from './index';
|
|
|
2
2
|
import { IMetadata, IConfiguration, IProduct } from '../types';
|
|
3
3
|
import { IConnectionConfig } from '../connection';
|
|
4
4
|
import { IReloadConfig } from './treble';
|
|
5
|
-
/*****************************************************
|
|
6
|
-
* Types and Interfaces
|
|
7
|
-
****************************************************/
|
|
8
5
|
export interface CachedProduct {
|
|
9
6
|
id: undefined | string;
|
|
10
7
|
name?: string;
|
|
@@ -30,16 +27,10 @@ export interface ProductState {
|
|
|
30
27
|
cache: Array<CachedProductState>;
|
|
31
28
|
activeCacheIdx: number;
|
|
32
29
|
}
|
|
33
|
-
/*****************************************************
|
|
34
|
-
* Constants
|
|
35
|
-
****************************************************/
|
|
36
30
|
export declare let PRODUCTS: IHydratedProducts;
|
|
37
|
-
/*****************************************************
|
|
38
|
-
* Actions
|
|
39
|
-
****************************************************/
|
|
40
31
|
export declare const setProductId: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, string>;
|
|
41
|
-
export declare const setName: import("@reduxjs/toolkit").
|
|
42
|
-
export declare const setMetadata: import("@reduxjs/toolkit").
|
|
32
|
+
export declare const setName: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, string>;
|
|
33
|
+
export declare const setMetadata: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<IMetadata | undefined, string>;
|
|
43
34
|
export declare const appendToCache: import("@reduxjs/toolkit").ActionCreatorWithPayload<CachedProductState, string>;
|
|
44
35
|
export declare const updateActiveProductCache: import("@reduxjs/toolkit").ActionCreatorWithPayload<CachedProductState, string>;
|
|
45
36
|
export declare const removeFromCache: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, string>;
|
|
@@ -47,17 +38,11 @@ export declare const setActiveCacheIdx: import("@reduxjs/toolkit").ActionCreator
|
|
|
47
38
|
export declare const incrementActiveCacheIdx: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<undefined, string>;
|
|
48
39
|
export declare const decrementActiveCacheIdx: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<undefined, string>;
|
|
49
40
|
declare const reducer: import("redux").Reducer<ProductState, import("redux").AnyAction>;
|
|
50
|
-
/*****************************************************
|
|
51
|
-
* Standard Selectors
|
|
52
|
-
****************************************************/
|
|
53
41
|
export declare const getProductId: (state: RootState) => undefined | string;
|
|
54
42
|
export declare const getName: (state: RootState) => undefined | string;
|
|
55
43
|
export declare const getMetadata: (state: RootState) => undefined | IMetadata;
|
|
56
44
|
export declare const getActiveCacheIdx: (state: RootState) => number;
|
|
57
45
|
export declare const getProductCache: (state: RootState) => Array<Pick<CachedProduct, 'name' | 'label' | 'thumbnail'>>;
|
|
58
|
-
/*****************************************************
|
|
59
|
-
* Complex Actions
|
|
60
|
-
****************************************************/
|
|
61
46
|
export declare const initProduct: (prods?: IHydratedProducts) => (dispatch: ThreekitDispatch, getState: () => RootState) => void;
|
|
62
47
|
export declare const cacheActiveProduct: (config?: Pick<IReloadConfig, 'label' | 'thumbnail'>) => (dispatch: ThreekitDispatch, getState: () => RootState) => {
|
|
63
48
|
payload: CachedProductState;
|
package/dist/store/product.js
CHANGED
|
@@ -52,12 +52,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
53
|
exports.removeProductIdx = exports.changeActiveCacheIdx = exports.loadNewProduct = exports.loadProduct = exports.cacheActiveProduct = exports.initProduct = exports.getProductCache = exports.getActiveCacheIdx = exports.getMetadata = exports.getName = exports.getProductId = exports.decrementActiveCacheIdx = exports.incrementActiveCacheIdx = exports.setActiveCacheIdx = exports.removeFromCache = exports.updateActiveProductCache = exports.appendToCache = exports.setMetadata = exports.setName = exports.setProductId = exports.PRODUCTS = void 0;
|
|
54
54
|
var toolkit_1 = require("@reduxjs/toolkit");
|
|
55
|
+
var types_1 = require("../types");
|
|
55
56
|
var connection_1 = __importDefault(require("../connection"));
|
|
56
57
|
var treble_1 = require("./treble");
|
|
57
|
-
/*****************************************************
|
|
58
|
-
* Actions
|
|
59
|
-
****************************************************/
|
|
60
|
-
// Actions to be used only internally
|
|
61
58
|
exports.setProductId = (0, toolkit_1.createAction)('treble/set-product-id');
|
|
62
59
|
exports.setName = (0, toolkit_1.createAction)('treble/set-product-name');
|
|
63
60
|
exports.setMetadata = (0, toolkit_1.createAction)('treble/set-metadata');
|
|
@@ -67,17 +64,10 @@ exports.removeFromCache = (0, toolkit_1.createAction)('treble/remove-from-cache'
|
|
|
67
64
|
exports.setActiveCacheIdx = (0, toolkit_1.createAction)('treble/set-active-cache-idx');
|
|
68
65
|
exports.incrementActiveCacheIdx = (0, toolkit_1.createAction)('treble/increment-active-cache-idx');
|
|
69
66
|
exports.decrementActiveCacheIdx = (0, toolkit_1.createAction)('treble/decrement-active-cache-idx');
|
|
70
|
-
/*****************************************************
|
|
71
|
-
* State
|
|
72
|
-
****************************************************/
|
|
73
67
|
var initialState = {
|
|
74
|
-
// ID of initialized item
|
|
75
68
|
id: undefined,
|
|
76
|
-
// Name of the Initialized Item
|
|
77
69
|
name: undefined,
|
|
78
|
-
// Initialized item's metadata
|
|
79
70
|
metadata: undefined,
|
|
80
|
-
// cached products. Does not include the active product
|
|
81
71
|
cache: [],
|
|
82
72
|
activeCacheIdx: 0,
|
|
83
73
|
};
|
|
@@ -89,10 +79,13 @@ var reducer = (0, toolkit_1.createSlice)({
|
|
|
89
79
|
return __assign(__assign({}, state), { id: action.payload });
|
|
90
80
|
});
|
|
91
81
|
builder.addCase(exports.setName, function (state, action) {
|
|
92
|
-
|
|
82
|
+
var name = window.threekit.player.scene.get({
|
|
83
|
+
id: window.threekit.player.assetId,
|
|
84
|
+
}).name;
|
|
85
|
+
return __assign(__assign({}, state), { name: action.payload || name });
|
|
93
86
|
});
|
|
94
87
|
builder.addCase(exports.setMetadata, function (state, action) {
|
|
95
|
-
return __assign(__assign({}, state), { metadata: action.payload });
|
|
88
|
+
return __assign(__assign({}, state), { metadata: action.payload || window.threekit.configurator.getMetadata() });
|
|
96
89
|
});
|
|
97
90
|
builder.addCase(exports.appendToCache, function (state, action) {
|
|
98
91
|
state.cache.push(action.payload);
|
|
@@ -125,9 +118,6 @@ var reducer = (0, toolkit_1.createSlice)({
|
|
|
125
118
|
},
|
|
126
119
|
reducers: {},
|
|
127
120
|
}).reducer;
|
|
128
|
-
/*****************************************************
|
|
129
|
-
* Standard Selectors
|
|
130
|
-
****************************************************/
|
|
131
121
|
var getProductId = function (state) {
|
|
132
122
|
return state.product.id;
|
|
133
123
|
};
|
|
@@ -136,12 +126,10 @@ var getName = function (state) {
|
|
|
136
126
|
return state.product.name;
|
|
137
127
|
};
|
|
138
128
|
exports.getName = getName;
|
|
139
|
-
// Metadata
|
|
140
129
|
var getMetadata = function (state) {
|
|
141
130
|
return state.product.metadata;
|
|
142
131
|
};
|
|
143
132
|
exports.getMetadata = getMetadata;
|
|
144
|
-
// Product Cache
|
|
145
133
|
var getActiveCacheIdx = function (state) {
|
|
146
134
|
return state.product.activeCacheIdx;
|
|
147
135
|
};
|
|
@@ -154,13 +142,12 @@ var getProductCache = function (state) {
|
|
|
154
142
|
});
|
|
155
143
|
};
|
|
156
144
|
exports.getProductCache = getProductCache;
|
|
157
|
-
/*****************************************************
|
|
158
|
-
* Complex Actions
|
|
159
|
-
****************************************************/
|
|
160
145
|
var initProduct = function (prods) {
|
|
161
146
|
return function (dispatch, getState) {
|
|
162
147
|
if (prods)
|
|
163
148
|
exports.PRODUCTS = prods;
|
|
149
|
+
if (!window.threekit)
|
|
150
|
+
return;
|
|
164
151
|
var state = getState();
|
|
165
152
|
var name = window.threekit.player.scene.get({
|
|
166
153
|
id: window.threekit.player.assetId,
|
|
@@ -182,7 +169,8 @@ var cacheActiveProduct = function (config) {
|
|
|
182
169
|
var thumbnail = config === null || config === void 0 ? void 0 : config.thumbnail;
|
|
183
170
|
var connectionObj = connection_1.default.getConnection();
|
|
184
171
|
delete connectionObj.threekitDomain;
|
|
185
|
-
var
|
|
172
|
+
var player = window.threekit.player.enableApi(types_1.PRIVATE_APIS.PLAYER);
|
|
173
|
+
var configuration = player.configurator.getFullConfiguration();
|
|
186
174
|
var data = { connection: connectionObj, configuration: configuration };
|
|
187
175
|
var product = Object.assign({
|
|
188
176
|
id: state.product.id,
|
|
@@ -203,19 +191,19 @@ var loadProduct = function (id, config) {
|
|
|
203
191
|
state = getState();
|
|
204
192
|
productsList = Object.keys(exports.PRODUCTS);
|
|
205
193
|
if (!productsList.includes(id))
|
|
206
|
-
return [2
|
|
194
|
+
return [2];
|
|
207
195
|
productConfig = exports.PRODUCTS[id][state.treble.threekitEnv];
|
|
208
196
|
dispatch((0, exports.setProductId)(id));
|
|
209
197
|
if (cacheProduct)
|
|
210
198
|
dispatch((0, exports.cacheActiveProduct)());
|
|
211
|
-
return [4
|
|
199
|
+
return [4, dispatch((0, treble_1.reloadPlayer)(productConfig))];
|
|
212
200
|
case 1:
|
|
213
201
|
_a.sent();
|
|
214
202
|
if (cacheProduct) {
|
|
215
203
|
dispatch((0, exports.incrementActiveCacheIdx)());
|
|
216
204
|
dispatch((0, exports.cacheActiveProduct)());
|
|
217
205
|
}
|
|
218
|
-
return [2
|
|
206
|
+
return [2];
|
|
219
207
|
}
|
|
220
208
|
});
|
|
221
209
|
}); };
|
|
@@ -238,14 +226,14 @@ var loadNewProduct = function (config) {
|
|
|
238
226
|
dispatch((0, exports.cacheActiveProduct)({ label: label, thumbnail: thumbnail }));
|
|
239
227
|
if (config)
|
|
240
228
|
dispatch((0, exports.setProductId)(undefined));
|
|
241
|
-
return [4
|
|
229
|
+
return [4, dispatch((0, treble_1.reloadPlayer)(config))];
|
|
242
230
|
case 1:
|
|
243
231
|
_a.sent();
|
|
244
232
|
if (shouldCacheProduct) {
|
|
245
233
|
dispatch((0, exports.incrementActiveCacheIdx)());
|
|
246
234
|
dispatch((0, exports.cacheActiveProduct)({ label: label, thumbnail: thumbnail }));
|
|
247
235
|
}
|
|
248
|
-
return [2
|
|
236
|
+
return [2];
|
|
249
237
|
}
|
|
250
238
|
});
|
|
251
239
|
}); };
|
|
@@ -260,20 +248,20 @@ var changeActiveCacheIdx = function (idx) {
|
|
|
260
248
|
state = getState();
|
|
261
249
|
cache = state.product.cache;
|
|
262
250
|
if (idx >= cache.length)
|
|
263
|
-
return [2
|
|
251
|
+
return [2, Promise.resolve()];
|
|
264
252
|
dispatch((0, exports.cacheActiveProduct)());
|
|
265
253
|
cachedProduct = __assign({}, state.product.cache[idx]);
|
|
266
254
|
data = JSON.parse(cachedProduct.data);
|
|
267
255
|
connection_1.default.connect(data.connection);
|
|
268
256
|
dispatch((0, exports.setActiveCacheIdx)(idx));
|
|
269
257
|
dispatch((0, exports.setProductId)(cachedProduct.id));
|
|
270
|
-
return [4
|
|
258
|
+
return [4, dispatch((0, treble_1.reloadPlayer)({
|
|
271
259
|
assetId: data.connection.assetId,
|
|
272
260
|
configuration: data.configuration,
|
|
273
261
|
}))];
|
|
274
262
|
case 1:
|
|
275
263
|
_a.sent();
|
|
276
|
-
return [2
|
|
264
|
+
return [2];
|
|
277
265
|
}
|
|
278
266
|
});
|
|
279
267
|
}); };
|
|
@@ -288,21 +276,21 @@ var removeProductIdx = function (idx) {
|
|
|
288
276
|
state = getState();
|
|
289
277
|
_a = state.product, cache = _a.cache, activeCacheIdx = _a.activeCacheIdx;
|
|
290
278
|
if (cache.length <= 1)
|
|
291
|
-
return [2
|
|
292
|
-
if (!(!idx || idx === activeCacheIdx)) return [3
|
|
293
|
-
if (!(activeCacheIdx === state.product.cache.length - 1)) return [3
|
|
294
|
-
return [4
|
|
279
|
+
return [2, Promise.resolve()];
|
|
280
|
+
if (!(!idx || idx === activeCacheIdx)) return [3, 5];
|
|
281
|
+
if (!(activeCacheIdx === state.product.cache.length - 1)) return [3, 2];
|
|
282
|
+
return [4, dispatch((0, exports.changeActiveCacheIdx)(activeCacheIdx - 1))];
|
|
295
283
|
case 1:
|
|
296
284
|
_b.sent();
|
|
297
285
|
dispatch((0, exports.removeFromCache)(activeCacheIdx));
|
|
298
|
-
return [3
|
|
286
|
+
return [3, 4];
|
|
299
287
|
case 2:
|
|
300
288
|
dispatch((0, exports.removeFromCache)(activeCacheIdx));
|
|
301
|
-
return [4
|
|
289
|
+
return [4, dispatch((0, exports.changeActiveCacheIdx)(activeCacheIdx))];
|
|
302
290
|
case 3:
|
|
303
291
|
_b.sent();
|
|
304
292
|
_b.label = 4;
|
|
305
|
-
case 4: return [3
|
|
293
|
+
case 4: return [3, 6];
|
|
306
294
|
case 5:
|
|
307
295
|
if (idx >= activeCacheIdx) {
|
|
308
296
|
dispatch((0, exports.removeFromCache)(idx));
|
|
@@ -312,7 +300,7 @@ var removeProductIdx = function (idx) {
|
|
|
312
300
|
dispatch((0, exports.removeFromCache)(idx));
|
|
313
301
|
}
|
|
314
302
|
_b.label = 6;
|
|
315
|
-
case 6: return [2
|
|
303
|
+
case 6: return [2, Promise.resolve()];
|
|
316
304
|
}
|
|
317
305
|
});
|
|
318
306
|
}); };
|
|
@@ -1,24 +1,12 @@
|
|
|
1
1
|
import { RootState, ThreekitDispatch } from './index';
|
|
2
2
|
import { ITranslationMap } from '../api/products';
|
|
3
|
-
/*****************************************************
|
|
4
|
-
* Types and Interfaces
|
|
5
|
-
****************************************************/
|
|
6
3
|
export interface TranslationsState {
|
|
7
4
|
language: string | undefined;
|
|
8
5
|
}
|
|
9
|
-
/*****************************************************
|
|
10
|
-
* Constants
|
|
11
|
-
****************************************************/
|
|
12
6
|
export declare let TRANSLATIONS: undefined | ITranslationMap;
|
|
13
|
-
/*****************************************************
|
|
14
|
-
* Actions
|
|
15
|
-
****************************************************/
|
|
16
7
|
export declare const setLanguage: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>;
|
|
17
8
|
export declare const initTranslations: (language?: string) => (dispatch: ThreekitDispatch) => Promise<void>;
|
|
18
9
|
declare const reducer: import("redux").Reducer<TranslationsState, import("redux").AnyAction>;
|
|
19
|
-
/*****************************************************
|
|
20
|
-
* Standard Selectors
|
|
21
|
-
****************************************************/
|
|
22
10
|
export declare const getLanguage: (state: RootState) => undefined | string;
|
|
23
11
|
export declare const getLanguageOptions: (state: RootState) => Array<string>;
|
|
24
12
|
export default reducer;
|
|
@@ -42,28 +42,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
42
42
|
exports.getLanguageOptions = exports.getLanguage = exports.initTranslations = exports.setLanguage = exports.TRANSLATIONS = void 0;
|
|
43
43
|
var toolkit_1 = require("@reduxjs/toolkit");
|
|
44
44
|
var api_1 = __importDefault(require("../api"));
|
|
45
|
-
/*****************************************************
|
|
46
|
-
* Actions
|
|
47
|
-
****************************************************/
|
|
48
45
|
exports.setLanguage = (0, toolkit_1.createAction)('treble/translations/set-language');
|
|
49
46
|
var initTranslations = function (language) { return function (dispatch) { return __awaiter(void 0, void 0, void 0, function () {
|
|
50
47
|
return __generator(this, function (_a) {
|
|
51
48
|
switch (_a.label) {
|
|
52
|
-
case 0: return [4
|
|
49
|
+
case 0: return [4, api_1.default.products.fetchTranslations()];
|
|
53
50
|
case 1:
|
|
54
51
|
exports.TRANSLATIONS = _a.sent();
|
|
55
52
|
if (language)
|
|
56
53
|
dispatch((0, exports.setLanguage)(language));
|
|
57
|
-
return [2
|
|
54
|
+
return [2];
|
|
58
55
|
}
|
|
59
56
|
});
|
|
60
57
|
}); }; };
|
|
61
58
|
exports.initTranslations = initTranslations;
|
|
62
|
-
/*****************************************************
|
|
63
|
-
* State
|
|
64
|
-
****************************************************/
|
|
65
59
|
var initialState = {
|
|
66
|
-
// Selected language
|
|
67
60
|
language: undefined,
|
|
68
61
|
};
|
|
69
62
|
var reducer = (0, toolkit_1.createSlice)({
|
|
@@ -76,9 +69,6 @@ var reducer = (0, toolkit_1.createSlice)({
|
|
|
76
69
|
},
|
|
77
70
|
reducers: {},
|
|
78
71
|
}).reducer;
|
|
79
|
-
/*****************************************************
|
|
80
|
-
* Standard Selectors
|
|
81
|
-
****************************************************/
|
|
82
72
|
var getLanguage = function (state) {
|
|
83
73
|
return state.translations.language;
|
|
84
74
|
};
|