kitchen-simulator 1.1.1-test.77 → 1.1.1-test.78
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/package.json +4 -4
- package/es/CrossSignOn.js +0 -84
- package/es/KitchenConfigurator.js +0 -1395
- package/es/renderer.js +0 -474
- package/lib/CrossSignOn.js +0 -93
- package/lib/KitchenConfigurator.js +0 -1405
- package/lib/renderer.js +0 -478
package/es/renderer.js
DELETED
|
@@ -1,474 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
-
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
4
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import ReactDOM from 'react-dom';
|
|
9
|
-
import ContainerDimensions from 'react-container-dimensions';
|
|
10
|
-
import Immutable, { Map } from 'immutable';
|
|
11
|
-
import immutableDevtools from 'immutable-devtools';
|
|
12
|
-
import { createStore } from 'redux';
|
|
13
|
-
import { Provider } from 'react-redux';
|
|
14
|
-
import { hotjar } from 'react-hotjar';
|
|
15
|
-
import * as Sentry from '@sentry/react';
|
|
16
|
-
import browserHistory from "./@history";
|
|
17
|
-
import * as history from 'history';
|
|
18
|
-
import * as Areas from "./catalog/areas/area/planner-element";
|
|
19
|
-
import * as Lines from "./catalog/lines/wall/planner-element";
|
|
20
|
-
import * as Holes from "./catalog/holes/export";
|
|
21
|
-
import AppContext from "./AppContext";
|
|
22
|
-
import { HashRouter, Route, Router, Switch } from 'react-router-dom';
|
|
23
|
-
import { render2DItem, render3DApplianceItem, render3DItem, render3DLightingItem } from "./catalog/utils/item-loader";
|
|
24
|
-
import exporter from "./catalog/utils/exporter";
|
|
25
|
-
import axios from 'axios';
|
|
26
|
-
import Login from "./components/login/Login";
|
|
27
|
-
import Register from "./components/login/Register";
|
|
28
|
-
import { API_SERVER_URL, ERROR_DATABASE, MODE, NO_DATA_DATABASE, TOE_KICK_MOLDING } from "./constants";
|
|
29
|
-
import MobileDetect from 'mobile-detect';
|
|
30
|
-
import * as zlib from 'browserify-zlib';
|
|
31
|
-
import Buffer from 'buffer';
|
|
32
|
-
import { getPathInfo, isEmpty } from "./utils/helper";
|
|
33
|
-
import Catalog from "./catalog/catalog";
|
|
34
|
-
import KitchenConfigurator from "./KitchenConfigurator";
|
|
35
|
-
import PlannerReducer from "./reducers/reducer";
|
|
36
|
-
import { newProject } from "./actions/project-actions";
|
|
37
|
-
import { SVGLoader } from 'three/examples/jsm/loaders/SVGLoader';
|
|
38
|
-
import CrossSignOn from "./CrossSignOn";
|
|
39
|
-
import { QueryClient, QueryClientProvider } from 'react-query';
|
|
40
|
-
import { ReactQueryDevtools } from 'react-query/devtools';
|
|
41
|
-
import { GA } from "./analytics/ga4";
|
|
42
|
-
import { PostHogProvider } from 'posthog-js/react';
|
|
43
|
-
import DisclaimerScreen from "./components/disclaimer/disclaimer";
|
|
44
|
-
import ToolbarScreenshotButton from "./components/toolbar/button/toolbar-screenshot-button";
|
|
45
|
-
import * as PlannerModels from "./models";
|
|
46
|
-
import { ConsoleDebugger, Keyboard } from "./plugins/export";
|
|
47
|
-
|
|
48
|
-
// Axios config
|
|
49
|
-
axios.defaults.baseURL = API_SERVER_URL;
|
|
50
|
-
var md = new MobileDetect(window.navigator.userAgent);
|
|
51
|
-
var isMobile = md.mobile();
|
|
52
|
-
//define state
|
|
53
|
-
var AppState = Map({
|
|
54
|
-
KitchenConfigurator: new PlannerModels.State()
|
|
55
|
-
});
|
|
56
|
-
console.log('Version: 378.58-202510_DIY-425-window-snap');
|
|
57
|
-
GA.resetSessionKeys();
|
|
58
|
-
if (MODE === 'staging') {
|
|
59
|
-
GA.init({
|
|
60
|
-
measurementId: 'G-H2BYBW7V6H'
|
|
61
|
-
});
|
|
62
|
-
} else {
|
|
63
|
-
GA.init({
|
|
64
|
-
measurementId: 'G-YK2JCC9F9G'
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
hotjar.initialize('3010506', '6');
|
|
68
|
-
isProduction && Sentry.init({
|
|
69
|
-
dsn: process.env.SENTRY_DSN,
|
|
70
|
-
environment: process.env.SENTRY_ENVIRONMENT
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
//define reducer
|
|
74
|
-
var reducer = function reducer(state, action) {
|
|
75
|
-
state = state || AppState;
|
|
76
|
-
state = state.update('KitchenConfigurator', function (plannerState) {
|
|
77
|
-
return PlannerReducer(plannerState, action);
|
|
78
|
-
});
|
|
79
|
-
return state;
|
|
80
|
-
};
|
|
81
|
-
var catalog = new Catalog();
|
|
82
|
-
var blackList = isProduction === true ? [] : ['UPDATE_MOUSE_COORDS', 'UPDATE_ZOOM_SCALE', 'UPDATE_2D_CAMERA'];
|
|
83
|
-
if (!isProduction) {
|
|
84
|
-
console.info('Environment is in development and these actions will be blacklisted', blackList);
|
|
85
|
-
console.info('Enable Chrome custom formatter for Immutable pretty print');
|
|
86
|
-
immutableDevtools(Immutable);
|
|
87
|
-
}
|
|
88
|
-
var options = {
|
|
89
|
-
api_host: process.env.VITE_PUBLIC_POSTHOG_HOST,
|
|
90
|
-
// important for 3D/canvas replays
|
|
91
|
-
session_recording: {
|
|
92
|
-
recordCanvas: true
|
|
93
|
-
},
|
|
94
|
-
// we'll capture pageviews manually if needed
|
|
95
|
-
capture_pageview: false
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
//init store
|
|
99
|
-
var store = createStore(reducer, null, !isProduction && window.devToolsExtension ? window.devToolsExtension({
|
|
100
|
-
features: {
|
|
101
|
-
pause: true,
|
|
102
|
-
// start/pause recording of dispatched actions
|
|
103
|
-
lock: true,
|
|
104
|
-
// lock/unlock dispatching actions and side effects
|
|
105
|
-
persist: true,
|
|
106
|
-
// persist states on page reloading
|
|
107
|
-
"export": true,
|
|
108
|
-
// export history of actions in a file
|
|
109
|
-
"import": 'custom',
|
|
110
|
-
// import history of actions from a file
|
|
111
|
-
jump: true,
|
|
112
|
-
// jump back and forth (time travelling)
|
|
113
|
-
skip: true,
|
|
114
|
-
// skip (cancel) actions
|
|
115
|
-
reorder: true,
|
|
116
|
-
// drag and drop actions in the history list
|
|
117
|
-
dispatch: true,
|
|
118
|
-
// dispatch custom actions or action creators
|
|
119
|
-
test: true // generate tests for the selected actions
|
|
120
|
-
},
|
|
121
|
-
actionsBlacklist: blackList,
|
|
122
|
-
maxAge: 999999
|
|
123
|
-
}) : function (f) {
|
|
124
|
-
return f;
|
|
125
|
-
});
|
|
126
|
-
var plugins = [Keyboard(), ConsoleDebugger()];
|
|
127
|
-
var toolbarButtons = [ToolbarScreenshotButton];
|
|
128
|
-
var categoryData;
|
|
129
|
-
sessionStorage.setItem('visualizerName', getPathInfo(1));
|
|
130
|
-
if (!isMobile) {
|
|
131
|
-
axios.get("".concat(API_SERVER_URL, "/api/dealer/").concat(getPathInfo(1), "/config")).then(/*#__PURE__*/function () {
|
|
132
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(res) {
|
|
133
|
-
var _res$data, success, id, logoImg, companyUrl, config, configdata;
|
|
134
|
-
return _regeneratorRuntime.wrap(function (_context3) {
|
|
135
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
136
|
-
case 0:
|
|
137
|
-
_res$data = res.data, success = _res$data.success, id = _res$data.id, logoImg = _res$data.logoImg, companyUrl = _res$data.companyUrl, config = _res$data.config;
|
|
138
|
-
configdata = JSON.parse(config);
|
|
139
|
-
if (!(success === false || id === 0 && logoImg === '' && companyUrl === '')) {
|
|
140
|
-
_context3.next = 1;
|
|
141
|
-
break;
|
|
142
|
-
}
|
|
143
|
-
alert('No Catalog');
|
|
144
|
-
return _context3.abrupt("return");
|
|
145
|
-
case 1:
|
|
146
|
-
_context3.next = 2;
|
|
147
|
-
return axios.post("".concat(API_SERVER_URL, "/api/planner/read/planner"), {
|
|
148
|
-
type: MODE === 'staging' ? 2 : 1
|
|
149
|
-
}, {
|
|
150
|
-
responseType: 'arraybuffer'
|
|
151
|
-
}).then(/*#__PURE__*/function () {
|
|
152
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(response) {
|
|
153
|
-
var unzip_data, data, appliances, lighting, furnishing, success, svgLoadPromises, outlineSVGData, Item, x, _x4, _x5, _x6, MainComponent, queryClient, MainApp;
|
|
154
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
155
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
156
|
-
case 0:
|
|
157
|
-
unzip_data = JSON.parse(zlib.unzipSync(new Buffer.Buffer.from(response.data)).toString());
|
|
158
|
-
data = unzip_data.data, appliances = unzip_data.appliances, lighting = unzip_data.lighting, furnishing = unzip_data.furnishing, success = unzip_data.success;
|
|
159
|
-
if (success === false) {
|
|
160
|
-
console.log(NO_DATA_DATABASE);
|
|
161
|
-
}
|
|
162
|
-
if (success === 'error') {
|
|
163
|
-
alert(ERROR_DATABASE);
|
|
164
|
-
}
|
|
165
|
-
_context2.next = 1;
|
|
166
|
-
return axios.post("".concat(API_SERVER_URL, "/api/toolbar/getCategoryData"), {
|
|
167
|
-
type: MODE === 'staging' ? 2 : 1
|
|
168
|
-
}, {
|
|
169
|
-
responseType: 'arraybuffer'
|
|
170
|
-
}).then(function (response) {
|
|
171
|
-
categoryData = JSON.parse(zlib.unzipSync(new Buffer.Buffer.from(response.data)).toString());
|
|
172
|
-
var _categoryData$data = categoryData.data,
|
|
173
|
-
catalogs = _categoryData$data.catalogs,
|
|
174
|
-
colorAlias = _categoryData$data.colorAlias,
|
|
175
|
-
subgroups = _categoryData$data.subgroups;
|
|
176
|
-
var door_color_alias = [];
|
|
177
|
-
var subgroup_ids = catalogs.filter(function (item) {
|
|
178
|
-
return item.id == id;
|
|
179
|
-
})[0].manufacturer_subgroup_ids.split(',');
|
|
180
|
-
var door_color_alias_ids = [];
|
|
181
|
-
subgroups.forEach(function (subgroup) {
|
|
182
|
-
if (subgroup_ids.some(function (id) {
|
|
183
|
-
return id == subgroup.id.toString();
|
|
184
|
-
})) {
|
|
185
|
-
subgroup.door_color_alias_ids.split(',').forEach(function (item) {
|
|
186
|
-
item != '' && door_color_alias_ids.push(item);
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
colorAlias.forEach(function (color) {
|
|
191
|
-
return door_color_alias_ids.some(function (id) {
|
|
192
|
-
return id == color.id.toString();
|
|
193
|
-
}) && door_color_alias.push(color);
|
|
194
|
-
});
|
|
195
|
-
var doorStyleData = categoryData.data.doorStyles.items;
|
|
196
|
-
categoryData.data.doorStyles.items = doorStyleData.treeStruct;
|
|
197
|
-
// construct a doorStyle variable
|
|
198
|
-
door_color_alias.forEach(function (dca) {
|
|
199
|
-
doorStyleData.doorColorData.forEach(function (dc) {
|
|
200
|
-
// convert string into integer.
|
|
201
|
-
dc.door_style_id = parseInt(dc.door_style_id);
|
|
202
|
-
|
|
203
|
-
// find the original for the alias.
|
|
204
|
-
if (dc.id !== dca.door_color_id) return;
|
|
205
|
-
dc.name = dca.alias_name;
|
|
206
|
-
dc.color_sku_alias = dca.sku_alias_name;
|
|
207
|
-
|
|
208
|
-
// judge the door style of the current door color
|
|
209
|
-
doorStyleData.treeStruct.forEach(function (el) {
|
|
210
|
-
el.items.forEach(function (elem) {
|
|
211
|
-
return dc.door_style_id === elem.id && (dc.door_style_name = elem.name);
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
// convert string into array
|
|
216
|
-
dca.alias_installation_type = isEmpty(dca.alias_installation_type) ? [] : dca.alias_installation_type.split(',').map(function (item) {
|
|
217
|
-
return parseInt(item);
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
// add door color to doorStyle variable according to 'alias_installation_type' of its alias
|
|
221
|
-
categoryData.data.doorStyles.items.forEach(function (item) {
|
|
222
|
-
if (dca.alias_installation_type.some(function (ait) {
|
|
223
|
-
return ait === item.id;
|
|
224
|
-
})) item.items.forEach(function (ds) {
|
|
225
|
-
if (ds.name === dc.door_style_name) ds.items.push(dc);
|
|
226
|
-
});
|
|
227
|
-
});
|
|
228
|
-
});
|
|
229
|
-
});
|
|
230
|
-
var molding = [];
|
|
231
|
-
var toeMoldingData = [];
|
|
232
|
-
var cabinets = categoryData.data.cabinets;
|
|
233
|
-
cabinets[cabinets.length - 1].items.forEach(function (index) {
|
|
234
|
-
if (index.name.toLowerCase().includes('molding')) {
|
|
235
|
-
index.items.forEach(function (item) {
|
|
236
|
-
molding.push(item);
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
// store all toe kick molding templates
|
|
240
|
-
if (index.name.includes(TOE_KICK_MOLDING)) {
|
|
241
|
-
index.items.forEach(function (item) {
|
|
242
|
-
toeMoldingData.push(item);
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
categoryData.data.toeMoldingData = toeMoldingData;
|
|
247
|
-
var promises = molding.map(function (child) {
|
|
248
|
-
return new Promise(function (resolve, reject) {
|
|
249
|
-
var url = child === null || child === void 0 ? void 0 : child.shape_svg;
|
|
250
|
-
if (!url) {
|
|
251
|
-
// Skip if no SVG URL available
|
|
252
|
-
return resolve();
|
|
253
|
-
}
|
|
254
|
-
var loader = new SVGLoader();
|
|
255
|
-
loader.load(url, function (data) {
|
|
256
|
-
var _data$xml$viewBox$ani, _data$xml, _data$xml$viewBox$ani2, _data$xml2;
|
|
257
|
-
child.data = {
|
|
258
|
-
paths: data.paths,
|
|
259
|
-
svg_width: (_data$xml$viewBox$ani = (_data$xml = data.xml) === null || _data$xml === void 0 || (_data$xml = _data$xml.viewBox) === null || _data$xml === void 0 || (_data$xml = _data$xml.animVal) === null || _data$xml === void 0 ? void 0 : _data$xml.width) !== null && _data$xml$viewBox$ani !== void 0 ? _data$xml$viewBox$ani : 0,
|
|
260
|
-
svg_height: (_data$xml$viewBox$ani2 = (_data$xml2 = data.xml) === null || _data$xml2 === void 0 || (_data$xml2 = _data$xml2.viewBox) === null || _data$xml2 === void 0 || (_data$xml2 = _data$xml2.animVal) === null || _data$xml2 === void 0 ? void 0 : _data$xml2.height) !== null && _data$xml$viewBox$ani2 !== void 0 ? _data$xml$viewBox$ani2 : 0
|
|
261
|
-
};
|
|
262
|
-
resolve();
|
|
263
|
-
}, null, function (error) {
|
|
264
|
-
console.error(error);
|
|
265
|
-
reject(error);
|
|
266
|
-
});
|
|
267
|
-
});
|
|
268
|
-
});
|
|
269
|
-
return Promise.all(promises);
|
|
270
|
-
});
|
|
271
|
-
case 1:
|
|
272
|
-
// Load Outline SVG Data
|
|
273
|
-
svgLoadPromises = data.map(/*#__PURE__*/function () {
|
|
274
|
-
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(item) {
|
|
275
|
-
var _parsed$xml$viewBox, _parsed$xml$viewBox2, _response, svgText, loader, parsed, _t;
|
|
276
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
277
|
-
while (1) switch (_context.prev = _context.next) {
|
|
278
|
-
case 0:
|
|
279
|
-
if (!item.outline) {
|
|
280
|
-
_context.next = 6;
|
|
281
|
-
break;
|
|
282
|
-
}
|
|
283
|
-
_context.prev = 1;
|
|
284
|
-
_context.next = 2;
|
|
285
|
-
return fetch(item.outline, {
|
|
286
|
-
cache: 'no-store'
|
|
287
|
-
});
|
|
288
|
-
case 2:
|
|
289
|
-
_response = _context.sent;
|
|
290
|
-
_context.next = 3;
|
|
291
|
-
return _response.text();
|
|
292
|
-
case 3:
|
|
293
|
-
svgText = _context.sent;
|
|
294
|
-
loader = new SVGLoader();
|
|
295
|
-
parsed = loader.parse(svgText);
|
|
296
|
-
if (!isEmpty(parsed.paths)) {
|
|
297
|
-
_context.next = 4;
|
|
298
|
-
break;
|
|
299
|
-
}
|
|
300
|
-
return _context.abrupt("return", null);
|
|
301
|
-
case 4:
|
|
302
|
-
return _context.abrupt("return", {
|
|
303
|
-
paths: parsed.paths,
|
|
304
|
-
svgWidth: parseFloat(parsed.xml.getAttribute('width')) || ((_parsed$xml$viewBox = parsed.xml.viewBox) === null || _parsed$xml$viewBox === void 0 || (_parsed$xml$viewBox = _parsed$xml$viewBox.animVal) === null || _parsed$xml$viewBox === void 0 ? void 0 : _parsed$xml$viewBox.width) || 0,
|
|
305
|
-
svgHeight: parseFloat(parsed.xml.getAttribute('height')) || ((_parsed$xml$viewBox2 = parsed.xml.viewBox) === null || _parsed$xml$viewBox2 === void 0 || (_parsed$xml$viewBox2 = _parsed$xml$viewBox2.animVal) === null || _parsed$xml$viewBox2 === void 0 ? void 0 : _parsed$xml$viewBox2.height) || 0,
|
|
306
|
-
reverse: !!parseFloat(parsed.xml.getAttribute('height')) ? false : true
|
|
307
|
-
});
|
|
308
|
-
case 5:
|
|
309
|
-
_context.prev = 5;
|
|
310
|
-
_t = _context["catch"](1);
|
|
311
|
-
console.error('Failed to load SVG:', item.outline, _t);
|
|
312
|
-
return _context.abrupt("return", null);
|
|
313
|
-
case 6:
|
|
314
|
-
return _context.abrupt("return", null);
|
|
315
|
-
case 7:
|
|
316
|
-
case "end":
|
|
317
|
-
return _context.stop();
|
|
318
|
-
}
|
|
319
|
-
}, _callee, null, [[1, 5]]);
|
|
320
|
-
}));
|
|
321
|
-
return function (_x3) {
|
|
322
|
-
return _ref3.apply(this, arguments);
|
|
323
|
-
};
|
|
324
|
-
}());
|
|
325
|
-
_context2.next = 2;
|
|
326
|
-
return Promise.all(svgLoadPromises);
|
|
327
|
-
case 2:
|
|
328
|
-
outlineSVGData = _context2.sent;
|
|
329
|
-
// End: Load Outline SVG Data
|
|
330
|
-
Item = [];
|
|
331
|
-
data.forEach(function (obj, index) {
|
|
332
|
-
Item.push(exporter(_objectSpread(_objectSpread({}, obj), {}, {
|
|
333
|
-
type: 'cabinet',
|
|
334
|
-
outlineSVGData: outlineSVGData[index],
|
|
335
|
-
render2DItem: render2DItem,
|
|
336
|
-
render3DItem: render3DItem
|
|
337
|
-
})));
|
|
338
|
-
});
|
|
339
|
-
appliances.forEach(function (obj) {
|
|
340
|
-
Item.push(exporter(_objectSpread(_objectSpread({}, obj), {}, {
|
|
341
|
-
render2DItem: render2DItem,
|
|
342
|
-
render3DItem: render3DApplianceItem,
|
|
343
|
-
type: 'appliance'
|
|
344
|
-
})));
|
|
345
|
-
});
|
|
346
|
-
lighting.forEach(function (obj) {
|
|
347
|
-
Item.push(exporter(_objectSpread(_objectSpread({}, obj), {}, {
|
|
348
|
-
type: 'lighting',
|
|
349
|
-
render2DItem: render2DItem,
|
|
350
|
-
render3DItem: render3DLightingItem
|
|
351
|
-
})));
|
|
352
|
-
});
|
|
353
|
-
furnishing.forEach(function (obj) {
|
|
354
|
-
Item.push(exporter(_objectSpread(_objectSpread({}, obj), {}, {
|
|
355
|
-
type: 'furnishing',
|
|
356
|
-
render2DItem: render2DItem,
|
|
357
|
-
render3DItem: render3DApplianceItem
|
|
358
|
-
})));
|
|
359
|
-
});
|
|
360
|
-
for (x in Areas) catalog.registerElement(Areas[x]);
|
|
361
|
-
for (_x4 in Lines) catalog.registerElement(Lines[_x4]);
|
|
362
|
-
for (_x5 in Holes) catalog.registerElement(Holes[_x5]);
|
|
363
|
-
catalog.registerCategory('Windows', 'Windows', [Holes.windowClear, Holes.windowCross, Holes.windowDoubleHung, Holes.windowVertical]);
|
|
364
|
-
catalog.registerCategory('Doors', 'Doors', [Holes.doorInterior, Holes.doorExterior, Holes.doorCloset, Holes.doorSliding, Holes.doorwayFramed, Holes.doorwayFrameless]);
|
|
365
|
-
for (_x6 in Item) catalog.registerElement(Item[_x6]);
|
|
366
|
-
MainComponent = function MainComponent(props, width, height) {
|
|
367
|
-
return /*#__PURE__*/React.createElement(KitchenConfigurator, _extends({
|
|
368
|
-
catalog: catalog,
|
|
369
|
-
width: width,
|
|
370
|
-
height: height
|
|
371
|
-
}, props, {
|
|
372
|
-
logoImage: logoImg,
|
|
373
|
-
companyURL: companyUrl,
|
|
374
|
-
plugins: plugins,
|
|
375
|
-
toolbarButtons: toolbarButtons,
|
|
376
|
-
stateExtractor: function stateExtractor(state) {
|
|
377
|
-
return state.get('KitchenConfigurator');
|
|
378
|
-
},
|
|
379
|
-
categoryData: categoryData,
|
|
380
|
-
data: data,
|
|
381
|
-
configData: configdata
|
|
382
|
-
}));
|
|
383
|
-
};
|
|
384
|
-
queryClient = new QueryClient();
|
|
385
|
-
MainApp = function MainApp(props) {
|
|
386
|
-
return /*#__PURE__*/React.createElement(QueryClientProvider, {
|
|
387
|
-
client: queryClient
|
|
388
|
-
}, /*#__PURE__*/React.createElement(ReactQueryDevtools, {
|
|
389
|
-
initialIsOpen: false
|
|
390
|
-
}), /*#__PURE__*/React.createElement(AppContext.Provider, null, /*#__PURE__*/React.createElement(Provider, {
|
|
391
|
-
store: store
|
|
392
|
-
}, /*#__PURE__*/React.createElement(PostHogProvider, {
|
|
393
|
-
apiKey: process.env.VITE_PUBLIC_POSTHOG_KEY,
|
|
394
|
-
options: options
|
|
395
|
-
}, /*#__PURE__*/React.createElement(ContainerDimensions, null, function (_ref4) {
|
|
396
|
-
var width = _ref4.width,
|
|
397
|
-
height = _ref4.height;
|
|
398
|
-
return /*#__PURE__*/React.createElement(HashRouter, {
|
|
399
|
-
history: history.createHashHistory()
|
|
400
|
-
}, /*#__PURE__*/React.createElement(Router, {
|
|
401
|
-
history: browserHistory
|
|
402
|
-
}, /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(Route, {
|
|
403
|
-
exact: true,
|
|
404
|
-
path: "/:visualizerName/",
|
|
405
|
-
name: "kc",
|
|
406
|
-
render: function render(routeProps) {
|
|
407
|
-
return /*#__PURE__*/React.createElement(MainComponent, _extends({}, routeProps, props, {
|
|
408
|
-
width: width,
|
|
409
|
-
height: height
|
|
410
|
-
}));
|
|
411
|
-
}
|
|
412
|
-
}), /*#__PURE__*/React.createElement(Route, {
|
|
413
|
-
path: "/login",
|
|
414
|
-
render: function render() {
|
|
415
|
-
return /*#__PURE__*/React.createElement(Login, null);
|
|
416
|
-
}
|
|
417
|
-
}), /*#__PURE__*/React.createElement(Route, {
|
|
418
|
-
path: "/register",
|
|
419
|
-
render: function render() {
|
|
420
|
-
return /*#__PURE__*/React.createElement(Register, null);
|
|
421
|
-
}
|
|
422
|
-
}), /*#__PURE__*/React.createElement(Route, {
|
|
423
|
-
path: "/:visualizerName/project/:role/:token/:pid",
|
|
424
|
-
render: function render(routeProps) {
|
|
425
|
-
return /*#__PURE__*/React.createElement(MainComponent, _extends({}, routeProps, props, {
|
|
426
|
-
width: width,
|
|
427
|
-
height: height
|
|
428
|
-
}));
|
|
429
|
-
}
|
|
430
|
-
}))));
|
|
431
|
-
})))));
|
|
432
|
-
};
|
|
433
|
-
setTimeout(function () {
|
|
434
|
-
ReactDOM.render(/*#__PURE__*/React.createElement(CrossSignOn, {
|
|
435
|
-
App: MainApp
|
|
436
|
-
}), document.getElementById('app'));
|
|
437
|
-
}, 100);
|
|
438
|
-
case 3:
|
|
439
|
-
case "end":
|
|
440
|
-
return _context2.stop();
|
|
441
|
-
}
|
|
442
|
-
}, _callee2);
|
|
443
|
-
}));
|
|
444
|
-
return function (_x2) {
|
|
445
|
-
return _ref2.apply(this, arguments);
|
|
446
|
-
};
|
|
447
|
-
}())["catch"](function (err) {
|
|
448
|
-
alert('Something wrong happened. Do you want to clear the cache and restart the app?');
|
|
449
|
-
console.log('Failed to load Category Data in src/renderer.jsx', err);
|
|
450
|
-
sessionStorage.clear();
|
|
451
|
-
store.dispatch(newProject());
|
|
452
|
-
});
|
|
453
|
-
case 2:
|
|
454
|
-
case "end":
|
|
455
|
-
return _context3.stop();
|
|
456
|
-
}
|
|
457
|
-
}, _callee3);
|
|
458
|
-
}));
|
|
459
|
-
return function (_x) {
|
|
460
|
-
return _ref.apply(this, arguments);
|
|
461
|
-
};
|
|
462
|
-
}());
|
|
463
|
-
} else {
|
|
464
|
-
ReactDOM.render(/*#__PURE__*/React.createElement(DisclaimerScreen, {
|
|
465
|
-
open: true,
|
|
466
|
-
onClose: function onClose() {
|
|
467
|
-
if (window.history.length > 1) {
|
|
468
|
-
window.history.back();
|
|
469
|
-
} else {
|
|
470
|
-
window.location.href = 'https://addovisuals.com/'; // fallback to home
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
}), document.getElementById('app'));
|
|
474
|
-
}
|
package/lib/CrossSignOn.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = exports.QUERY_PARAM_TOKEN = exports.LOG_PREFIX = exports.ENCODED_QUERY_PARAM_TOKEN = void 0;
|
|
9
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _localstorageSlim = _interopRequireDefault(require("localstorage-slim"));
|
|
12
|
-
var _constants = require("./constants");
|
|
13
|
-
var _helper = require("./utils/helper");
|
|
14
|
-
var _posthog = require("./analytics/posthog");
|
|
15
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
16
|
-
var LOG_PREFIX = exports.LOG_PREFIX = "[Cross Sign On]";
|
|
17
|
-
var QUERY_PARAM_TOKEN = exports.QUERY_PARAM_TOKEN = 'token';
|
|
18
|
-
var ENCODED_QUERY_PARAM_TOKEN = exports.ENCODED_QUERY_PARAM_TOKEN = 'details';
|
|
19
|
-
try {
|
|
20
|
-
console.log("".concat(LOG_PREFIX, " Clearing local storage"));
|
|
21
|
-
_localstorageSlim["default"].clear();
|
|
22
|
-
} catch (e) {
|
|
23
|
-
console.log("".concat(LOG_PREFIX, " Error clearing local storage"), e);
|
|
24
|
-
}
|
|
25
|
-
function extractAccessTokenFromUrl() {
|
|
26
|
-
try {
|
|
27
|
-
var url = new URL(window.location.href);
|
|
28
|
-
var token = url.searchParams.get(QUERY_PARAM_TOKEN);
|
|
29
|
-
var encodedToken = url.searchParams.get(ENCODED_QUERY_PARAM_TOKEN);
|
|
30
|
-
if (!token && !encodedToken) {
|
|
31
|
-
console.log("".concat(LOG_PREFIX, " No access token found in URL"));
|
|
32
|
-
return undefined;
|
|
33
|
-
}
|
|
34
|
-
if (token) {
|
|
35
|
-
_localstorageSlim["default"].set(_constants.LOCAL_STORAGE_ORIGINAL_TOKEN, token);
|
|
36
|
-
_localstorageSlim["default"].set(_constants.LOCAL_STORAGE_TOKEN_VALUE, token);
|
|
37
|
-
_localstorageSlim["default"].set(_constants.LOCAL_STORAGE_TOKEN_NAME, 'token=');
|
|
38
|
-
return token;
|
|
39
|
-
}
|
|
40
|
-
try {
|
|
41
|
-
var decoded = (0, _helper.base64Decode)(encodedToken);
|
|
42
|
-
var parsed = JSON.parse(decoded);
|
|
43
|
-
_localstorageSlim["default"].set(_constants.LOCAL_STORAGE_ORIGINAL_TOKEN, encodedToken);
|
|
44
|
-
if (parsed.token) {
|
|
45
|
-
_localstorageSlim["default"].set(_constants.LOCAL_STORAGE_TOKEN_VALUE, parsed.token);
|
|
46
|
-
}
|
|
47
|
-
_localstorageSlim["default"].set(_constants.LOCAL_STORAGE_TOKEN_NAME, 'details=');
|
|
48
|
-
var customerInfo = {
|
|
49
|
-
email: parsed.email,
|
|
50
|
-
firstName: parsed.first_name,
|
|
51
|
-
lastName: parsed.last_name
|
|
52
|
-
};
|
|
53
|
-
_localstorageSlim["default"].set(_constants.LOCAL_STORAGE_CUSTOMER_INFO, customerInfo);
|
|
54
|
-
return parsed;
|
|
55
|
-
} catch (e) {
|
|
56
|
-
return undefined;
|
|
57
|
-
}
|
|
58
|
-
} catch (e) {
|
|
59
|
-
console.error("".concat(LOG_PREFIX, " Error extracting access token from URL"), e);
|
|
60
|
-
return undefined;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
function extractAccessTokenFromLocalStorage() {
|
|
64
|
-
var token = _localstorageSlim["default"].get(_constants.LOCAL_STORAGE_ORIGINAL_TOKEN);
|
|
65
|
-
if (!token || typeof token !== 'string') return undefined;
|
|
66
|
-
return token;
|
|
67
|
-
}
|
|
68
|
-
var CrossSignOn = function CrossSignOn(_ref) {
|
|
69
|
-
var App = _ref.App;
|
|
70
|
-
var _useState = (0, _react.useState)(function () {
|
|
71
|
-
return extractAccessTokenFromUrl() || extractAccessTokenFromLocalStorage();
|
|
72
|
-
}),
|
|
73
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
74
|
-
accessToken = _useState2[0],
|
|
75
|
-
setAccessToken = _useState2[1];
|
|
76
|
-
(0, _react.useEffect)(function () {
|
|
77
|
-
(0, _posthog.bootSessionContext)();
|
|
78
|
-
}, []);
|
|
79
|
-
(0, _react.useEffect)(function () {
|
|
80
|
-
var handleTokenChange = function handleTokenChange() {
|
|
81
|
-
var newToken = extractAccessTokenFromUrl() || extractAccessTokenFromLocalStorage();
|
|
82
|
-
setAccessToken(newToken);
|
|
83
|
-
};
|
|
84
|
-
window.addEventListener('token-changed', handleTokenChange);
|
|
85
|
-
return function () {
|
|
86
|
-
window.removeEventListener('token-changed', handleTokenChange);
|
|
87
|
-
};
|
|
88
|
-
}, []);
|
|
89
|
-
return /*#__PURE__*/_react["default"].createElement(App, {
|
|
90
|
-
accessToken: accessToken
|
|
91
|
-
});
|
|
92
|
-
};
|
|
93
|
-
var _default = exports["default"] = CrossSignOn;
|