kitchen-simulator 1.1.1-test.6 → 1.1.1-test.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (337) hide show
  1. package/es/@history.js +10 -2
  2. package/es/AppContext.js +10 -3
  3. package/es/KitchenConfigurator.js +95 -106
  4. package/es/KitchenConfiguratorApp.js +145 -154
  5. package/es/actions/area-actions.js +12 -5
  6. package/es/actions/export.js +29 -12
  7. package/es/actions/groups-actions.js +45 -27
  8. package/es/actions/holes-actions.js +55 -34
  9. package/es/actions/items-actions.js +145 -94
  10. package/es/actions/lines-actions.js +36 -21
  11. package/es/actions/project-actions.js +145 -94
  12. package/es/actions/scene-actions.js +21 -11
  13. package/es/actions/vertices-actions.js +15 -7
  14. package/es/actions/viewer2d-actions.js +36 -21
  15. package/es/actions/viewer3d-actions.js +18 -9
  16. package/es/catalog/areas/area/planner-element.js +18 -8
  17. package/es/catalog/catalog.js +21 -24
  18. package/es/catalog/factories/area-factory-3d.js +31 -22
  19. package/es/catalog/factories/area-factory.js +20 -14
  20. package/es/catalog/factories/export.js +24 -6
  21. package/es/catalog/factories/wall-factory-3d.js +41 -31
  22. package/es/catalog/factories/wall-factory.js +31 -21
  23. package/es/catalog/holes/door-closet/planner-element.js +24 -15
  24. package/es/catalog/holes/door-double/planner-element.js +24 -15
  25. package/es/catalog/holes/door-exterior/planner-element.js +25 -16
  26. package/es/catalog/holes/door-interior/planner-element.js +25 -16
  27. package/es/catalog/holes/door-panic/planner-element.js +16 -7
  28. package/es/catalog/holes/door-panic-double/planner-element.js +24 -15
  29. package/es/catalog/holes/door-sliding/planner-element.js +25 -16
  30. package/es/catalog/holes/doorway-framed/planner-element.js +20 -11
  31. package/es/catalog/holes/doorway-frameless/planner-element.js +16 -7
  32. package/es/catalog/holes/export.js +97 -13
  33. package/es/catalog/holes/window-clear/planner-element.js +19 -10
  34. package/es/catalog/holes/window-cross/planner-element.js +19 -10
  35. package/es/catalog/holes/window-double-hung/planner-element.js +19 -10
  36. package/es/catalog/holes/window-vertical/planner-element.js +19 -10
  37. package/es/catalog/lines/wall/planner-element.js +21 -11
  38. package/es/catalog/molding/molding-dcm/planner-element.js +14 -5
  39. package/es/catalog/molding/molding-fbm/planner-element.js +14 -5
  40. package/es/catalog/molding/molding-lrm/planner-element.js +14 -5
  41. package/es/catalog/properties/export.js +80 -20
  42. package/es/catalog/properties/property-checkbox.js +84 -35
  43. package/es/catalog/properties/property-color.js +23 -16
  44. package/es/catalog/properties/property-enum.js +72 -28
  45. package/es/catalog/properties/property-hidden.js +16 -9
  46. package/es/catalog/properties/property-lenght-measure.js +45 -39
  47. package/es/catalog/properties/property-length-measure.js +84 -34
  48. package/es/catalog/properties/property-length-measure_hole.js +45 -39
  49. package/es/catalog/properties/property-number.js +24 -17
  50. package/es/catalog/properties/property-read-only.js +23 -16
  51. package/es/catalog/properties/property-string.js +23 -16
  52. package/es/catalog/properties/property-toggle.js +23 -16
  53. package/es/catalog/properties/shared-property-style.js +7 -1
  54. package/es/catalog/utils/FuseUtils.js +15 -11
  55. package/es/catalog/utils/exporter.js +15 -11
  56. package/es/catalog/utils/geom-utils.js +29 -13
  57. package/es/catalog/utils/item-loader.js +97 -91
  58. package/es/catalog/utils/load-obj.js +28 -20
  59. package/es/catalog/utils/mtl-loader.js +9 -3
  60. package/es/catalog/utils/obj-loader.js +9 -3
  61. package/es/class/FuseUtils.js +15 -11
  62. package/es/class/area.js +28 -26
  63. package/es/class/export.js +95 -23
  64. package/es/class/group.js +59 -62
  65. package/es/class/guide.js +21 -19
  66. package/es/class/hole.js +89 -88
  67. package/es/class/item.js +150 -155
  68. package/es/class/layer.js +65 -63
  69. package/es/class/line.js +143 -144
  70. package/es/class/project.js +98 -94
  71. package/es/class/vertex.js +35 -33
  72. package/es/components/content.js +29 -19
  73. package/es/components/disclaimer/disclaimer.js +80 -92
  74. package/es/components/export.js +32 -8
  75. package/es/components/style/button.js +31 -30
  76. package/es/components/style/cancel-button.js +14 -8
  77. package/es/components/style/content-container.js +16 -12
  78. package/es/components/style/content-title.js +20 -15
  79. package/es/components/style/delete-button.js +17 -9
  80. package/es/components/style/export.js +120 -30
  81. package/es/components/style/form-block.js +15 -12
  82. package/es/components/style/form-color-input.js +14 -8
  83. package/es/components/style/form-label.js +15 -12
  84. package/es/components/style/form-number-input.js +73 -47
  85. package/es/components/style/form-number-input_2.js +44 -42
  86. package/es/components/style/form-select.js +60 -14
  87. package/es/components/style/form-slider.js +38 -16
  88. package/es/components/style/form-submit-button.js +17 -9
  89. package/es/components/style/form-text-input.js +57 -37
  90. package/es/components/viewer2d/area.js +24 -17
  91. package/es/components/viewer2d/export.js +120 -30
  92. package/es/components/viewer2d/grids/grid-horizontal-streak.js +17 -11
  93. package/es/components/viewer2d/grids/grid-streak.js +17 -11
  94. package/es/components/viewer2d/grids/grid-vertical-streak.js +17 -11
  95. package/es/components/viewer2d/grids/grids.js +19 -15
  96. package/es/components/viewer2d/group.js +24 -15
  97. package/es/components/viewer2d/item.js +70 -68
  98. package/es/components/viewer2d/layer.js +30 -23
  99. package/es/components/viewer2d/line.js +111 -104
  100. package/es/components/viewer2d/ruler.js +29 -23
  101. package/es/components/viewer2d/rulerDist.js +28 -21
  102. package/es/components/viewer2d/rulerX.js +47 -45
  103. package/es/components/viewer2d/rulerY.js +45 -43
  104. package/es/components/viewer2d/scene.js +42 -46
  105. package/es/components/viewer2d/snap.js +22 -13
  106. package/es/components/viewer2d/state.js +27 -23
  107. package/es/components/viewer2d/utils.js +65 -21
  108. package/es/components/viewer2d/vertex.js +17 -8
  109. package/es/components/viewer2d/viewer2d.js +171 -166
  110. package/es/components/viewer3d/camera-controls-module/camera-controls.module.js +23 -24
  111. package/es/components/viewer3d/dcm.js +7 -1
  112. package/es/components/viewer3d/fbm.js +7 -1
  113. package/es/components/viewer3d/front3D.js +21 -17
  114. package/es/components/viewer3d/grid-creator.js +17 -8
  115. package/es/components/viewer3d/grids/grid-horizontal-streak.js +14 -6
  116. package/es/components/viewer3d/grids/grid-streak.js +13 -5
  117. package/es/components/viewer3d/grids/grid-vertical-streak.js +14 -6
  118. package/es/components/viewer3d/libs/first-person-controls.js +9 -2
  119. package/es/components/viewer3d/libs/helvetiker_regular.typeface.js +7 -1
  120. package/es/components/viewer3d/libs/mtl-loader.js +8 -2
  121. package/es/components/viewer3d/libs/obj-loader.js +8 -2
  122. package/es/components/viewer3d/libs/orbit-controls.js +12 -5
  123. package/es/components/viewer3d/libs/pointer-lock-controls.js +11 -4
  124. package/es/components/viewer3d/lrm.js +7 -1
  125. package/es/components/viewer3d/model.js +7 -1
  126. package/es/components/viewer3d/pointer-lock-navigation.js +10 -3
  127. package/es/components/viewer3d/ruler-utils/itemRect.js +25 -18
  128. package/es/components/viewer3d/ruler-utils/layer3D.js +66 -59
  129. package/es/components/viewer3d/ruler-utils/ruler3D.js +46 -42
  130. package/es/components/viewer3d/ruler-utils/scene3D.js +18 -11
  131. package/es/components/viewer3d/ruler-utils/state3D.js +11 -4
  132. package/es/components/viewer3d/scene-creator.js +227 -198
  133. package/es/components/viewer3d/three-memory-cleaner.js +12 -3
  134. package/es/components/viewer3d/viewer3d-first-person.js +46 -46
  135. package/es/components/viewer3d/viewer3d.js +208 -209
  136. package/es/constants.js +358 -349
  137. package/es/index.js +28 -15
  138. package/es/models.js +185 -183
  139. package/es/plugins/SVGLoader.js +53 -48
  140. package/es/plugins/autosave.js +9 -3
  141. package/es/plugins/console-debugger.js +12 -8
  142. package/es/plugins/export.js +32 -8
  143. package/es/plugins/keyboard.js +35 -29
  144. package/es/reducers/areas-reducer.js +13 -7
  145. package/es/reducers/export.js +96 -24
  146. package/es/reducers/groups-reducer.js +37 -31
  147. package/es/reducers/holes-reducer.js +49 -43
  148. package/es/reducers/items-reducer.js +112 -109
  149. package/es/reducers/lines-reducer.js +34 -28
  150. package/es/reducers/project-reducer.js +111 -105
  151. package/es/reducers/reducer.js +23 -16
  152. package/es/reducers/scene-reducer.js +21 -15
  153. package/es/reducers/user-reducer.js +11 -6
  154. package/es/reducers/vertices-reducer.js +17 -11
  155. package/es/reducers/viewer2d-reducer.js +24 -18
  156. package/es/reducers/viewer3d-reducer.js +22 -16
  157. package/es/shared-style.js +16 -10
  158. package/es/styles/export.js +11 -3
  159. package/es/translator/en.js +7 -1
  160. package/es/translator/it.js +7 -1
  161. package/es/translator/ru.js +7 -1
  162. package/es/translator/translator.js +19 -17
  163. package/es/utils/browser.js +9 -2
  164. package/es/utils/convert-units-lite.js +35 -0
  165. package/es/utils/email-validator.js +7 -1
  166. package/es/utils/export.js +46 -15
  167. package/es/utils/geometry.js +279 -191
  168. package/es/utils/get-edges-of-subgraphs.js +9 -1
  169. package/es/utils/graph-cycles.js +11 -9
  170. package/es/utils/graph-inner-cycles.js +18 -10
  171. package/es/utils/graph.js +17 -12
  172. package/es/utils/helper.js +63 -109
  173. package/es/utils/history.js +15 -8
  174. package/es/utils/id-broker.js +15 -12
  175. package/es/utils/logger.js +7 -1
  176. package/es/utils/math.js +12 -5
  177. package/es/utils/molding.js +177 -158
  178. package/es/utils/name-generator.js +13 -11
  179. package/es/utils/objects-utils.js +19 -7
  180. package/es/utils/phone-validator.js +7 -1
  181. package/es/utils/process-black-list.js +10 -6
  182. package/es/utils/react-if.js +12 -6
  183. package/es/utils/snap-scene.js +34 -32
  184. package/es/utils/snap.js +59 -51
  185. package/es/utils/summarizeCart.js +7 -1
  186. package/es/utils/threeCSG.es6.js +22 -17
  187. package/es/version.js +7 -1
  188. package/lib/@history.js +1 -1
  189. package/lib/AppContext.js +1 -1
  190. package/lib/KitchenConfigurator.js +68 -87
  191. package/lib/KitchenConfiguratorApp.js +94 -110
  192. package/lib/actions/export.js +1 -1
  193. package/lib/catalog/areas/area/planner-element.js +12 -8
  194. package/lib/catalog/catalog.js +7 -15
  195. package/lib/catalog/factories/area-factory-3d.js +1 -1
  196. package/lib/catalog/factories/area-factory.js +4 -6
  197. package/lib/catalog/factories/export.js +1 -1
  198. package/lib/catalog/factories/wall-factory-3d.js +4 -4
  199. package/lib/catalog/factories/wall-factory.js +2 -2
  200. package/lib/catalog/holes/door-closet/planner-element.js +2 -2
  201. package/lib/catalog/holes/door-double/planner-element.js +2 -2
  202. package/lib/catalog/holes/door-exterior/planner-element.js +2 -2
  203. package/lib/catalog/holes/door-interior/planner-element.js +2 -2
  204. package/lib/catalog/holes/door-panic/planner-element.js +2 -2
  205. package/lib/catalog/holes/door-panic-double/planner-element.js +2 -2
  206. package/lib/catalog/holes/door-sliding/planner-element.js +2 -2
  207. package/lib/catalog/holes/doorway-framed/planner-element.js +2 -2
  208. package/lib/catalog/holes/doorway-frameless/planner-element.js +2 -2
  209. package/lib/catalog/holes/export.js +14 -14
  210. package/lib/catalog/holes/window-clear/planner-element.js +2 -2
  211. package/lib/catalog/holes/window-cross/planner-element.js +2 -2
  212. package/lib/catalog/holes/window-double-hung/planner-element.js +2 -2
  213. package/lib/catalog/holes/window-vertical/planner-element.js +2 -2
  214. package/lib/catalog/lines/wall/planner-element.js +15 -11
  215. package/lib/catalog/molding/molding-dcm/planner-element.js +2 -2
  216. package/lib/catalog/molding/molding-fbm/planner-element.js +2 -2
  217. package/lib/catalog/molding/molding-lrm/planner-element.js +2 -2
  218. package/lib/catalog/properties/export.js +1 -1
  219. package/lib/catalog/properties/property-checkbox.js +66 -24
  220. package/lib/catalog/properties/property-color.js +1 -1
  221. package/lib/catalog/properties/property-enum.js +52 -15
  222. package/lib/catalog/properties/property-hidden.js +1 -1
  223. package/lib/catalog/properties/property-lenght-measure.js +8 -9
  224. package/lib/catalog/properties/property-length-measure.js +59 -16
  225. package/lib/catalog/properties/property-length-measure_hole.js +8 -9
  226. package/lib/catalog/properties/property-number.js +1 -1
  227. package/lib/catalog/properties/property-read-only.js +1 -1
  228. package/lib/catalog/properties/property-string.js +1 -1
  229. package/lib/catalog/properties/property-toggle.js +1 -1
  230. package/lib/catalog/utils/FuseUtils.js +8 -10
  231. package/lib/catalog/utils/exporter.js +8 -11
  232. package/lib/catalog/utils/geom-utils.js +1 -1
  233. package/lib/catalog/utils/item-loader.js +29 -35
  234. package/lib/catalog/utils/mtl-loader.js +7 -3
  235. package/lib/catalog/utils/obj-loader.js +7 -3
  236. package/lib/class/FuseUtils.js +8 -10
  237. package/lib/class/area.js +7 -10
  238. package/lib/class/export.js +1 -1
  239. package/lib/class/group.js +11 -19
  240. package/lib/class/guide.js +9 -12
  241. package/lib/class/hole.js +5 -8
  242. package/lib/class/item.js +23 -34
  243. package/lib/class/layer.js +5 -8
  244. package/lib/class/line.js +12 -19
  245. package/lib/class/project.js +8 -10
  246. package/lib/class/vertex.js +7 -10
  247. package/lib/components/content.js +3 -2
  248. package/lib/components/disclaimer/disclaimer.js +67 -87
  249. package/lib/components/export.js +1 -1
  250. package/lib/components/style/button.js +15 -21
  251. package/lib/components/style/cancel-button.js +5 -6
  252. package/lib/components/style/content-container.js +3 -6
  253. package/lib/components/style/content-title.js +8 -11
  254. package/lib/components/style/delete-button.js +6 -7
  255. package/lib/components/style/export.js +1 -1
  256. package/lib/components/style/form-block.js +7 -11
  257. package/lib/components/style/form-color-input.js +5 -6
  258. package/lib/components/style/form-label.js +7 -11
  259. package/lib/components/style/form-number-input.js +41 -22
  260. package/lib/components/style/form-number-input_2.js +13 -18
  261. package/lib/components/style/form-select.js +51 -14
  262. package/lib/components/style/form-slider.js +26 -11
  263. package/lib/components/style/form-submit-button.js +6 -7
  264. package/lib/components/style/form-text-input.js +44 -31
  265. package/lib/components/viewer2d/area.js +6 -6
  266. package/lib/components/viewer2d/export.js +1 -1
  267. package/lib/components/viewer2d/grids/grid-horizontal-streak.js +1 -2
  268. package/lib/components/viewer2d/grids/grid-streak.js +1 -2
  269. package/lib/components/viewer2d/grids/grid-vertical-streak.js +1 -2
  270. package/lib/components/viewer2d/grids/grids.js +4 -9
  271. package/lib/components/viewer2d/group.js +2 -2
  272. package/lib/components/viewer2d/item.js +12 -18
  273. package/lib/components/viewer2d/layer.js +1 -1
  274. package/lib/components/viewer2d/line.js +4 -7
  275. package/lib/components/viewer2d/ruler.js +7 -8
  276. package/lib/components/viewer2d/rulerDist.js +5 -5
  277. package/lib/components/viewer2d/rulerX.js +13 -18
  278. package/lib/components/viewer2d/rulerY.js +13 -18
  279. package/lib/components/viewer2d/scene.js +22 -33
  280. package/lib/components/viewer2d/snap.js +2 -2
  281. package/lib/components/viewer2d/state.js +5 -10
  282. package/lib/components/viewer2d/utils.js +35 -2
  283. package/lib/components/viewer2d/vertex.js +2 -2
  284. package/lib/components/viewer2d/viewer2d.js +38 -40
  285. package/lib/components/viewer3d/camera-controls-module/camera-controls.module.js +14 -20
  286. package/lib/components/viewer3d/front3D.js +4 -9
  287. package/lib/components/viewer3d/grid-creator.js +2 -2
  288. package/lib/components/viewer3d/grids/grid-horizontal-streak.js +1 -1
  289. package/lib/components/viewer3d/grids/grid-streak.js +1 -1
  290. package/lib/components/viewer3d/grids/grid-vertical-streak.js +1 -1
  291. package/lib/components/viewer3d/libs/mtl-loader.js +6 -2
  292. package/lib/components/viewer3d/libs/obj-loader.js +6 -2
  293. package/lib/components/viewer3d/libs/orbit-controls.js +10 -5
  294. package/lib/components/viewer3d/libs/pointer-lock-controls.js +9 -4
  295. package/lib/components/viewer3d/pointer-lock-navigation.js +1 -1
  296. package/lib/components/viewer3d/ruler-utils/itemRect.js +8 -8
  297. package/lib/components/viewer3d/ruler-utils/layer3D.js +33 -33
  298. package/lib/components/viewer3d/ruler-utils/ruler3D.js +3 -6
  299. package/lib/components/viewer3d/ruler-utils/scene3D.js +4 -5
  300. package/lib/components/viewer3d/ruler-utils/state3D.js +1 -1
  301. package/lib/components/viewer3d/scene-creator.js +40 -45
  302. package/lib/components/viewer3d/three-memory-cleaner.js +1 -1
  303. package/lib/components/viewer3d/viewer3d-first-person.js +11 -16
  304. package/lib/components/viewer3d/viewer3d.js +32 -37
  305. package/lib/index.js +22 -88
  306. package/lib/models.js +58 -63
  307. package/lib/plugins/console-debugger.js +3 -6
  308. package/lib/plugins/export.js +1 -1
  309. package/lib/reducers/export.js +1 -1
  310. package/lib/reducers/user-reducer.js +0 -1
  311. package/lib/reducers/viewer2d-reducer.js +3 -4
  312. package/lib/reducers/viewer3d-reducer.js +3 -4
  313. package/lib/styles/export.js +1 -1
  314. package/lib/translator/translator.js +5 -9
  315. package/lib/utils/convert-units-lite.js +35 -0
  316. package/lib/utils/export.js +2 -2
  317. package/lib/utils/geometry.js +20 -28
  318. package/lib/utils/get-edges-of-subgraphs.js +7 -1
  319. package/lib/utils/graph-cycles.js +9 -9
  320. package/lib/utils/graph-inner-cycles.js +1 -1
  321. package/lib/utils/graph.js +15 -12
  322. package/lib/utils/helper.js +14 -83
  323. package/lib/utils/history.js +1 -1
  324. package/lib/utils/id-broker.js +7 -10
  325. package/lib/utils/molding.js +66 -71
  326. package/lib/utils/name-generator.js +5 -8
  327. package/lib/utils/objects-utils.js +5 -3
  328. package/lib/utils/process-black-list.js +3 -5
  329. package/lib/utils/react-if.js +1 -1
  330. package/lib/utils/snap-scene.js +3 -7
  331. package/lib/utils/snap.js +22 -26
  332. package/lib/utils/threeCSG.es6.js +14 -14
  333. package/package.json +24 -54
  334. package/es/analytics/ga4.js +0 -191
  335. package/es/analytics/posthog.js +0 -60
  336. package/lib/analytics/ga4.js +0 -197
  337. package/lib/analytics/posthog.js +0 -68
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  exports["default"] = void 0;
9
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
7
11
  var THREE = _interopRequireWildcard(require("three"));
8
12
  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); }
9
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
10
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
11
- function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
12
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
13
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
14
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /*jshint esversion: 6 */
13
+ /*jshint esversion: 6 */
14
+
15
15
  var EPSILON = 1e-5,
16
16
  COPLANAR = 0,
17
17
  FRONT = 1,
@@ -19,7 +19,7 @@ var EPSILON = 1e-5,
19
19
  SPANNING = 3;
20
20
  var ThreeBSP = exports["default"] = /*#__PURE__*/function () {
21
21
  function ThreeBSP(geometry) {
22
- _classCallCheck(this, ThreeBSP);
22
+ (0, _classCallCheck2["default"])(this, ThreeBSP);
23
23
  // Convert THREE.Geometry to ThreeBSP
24
24
  var i,
25
25
  _length_i,
@@ -68,7 +68,7 @@ var ThreeBSP = exports["default"] = /*#__PURE__*/function () {
68
68
  }
69
69
  this.tree = new Node(polygons);
70
70
  }
71
- return _createClass(ThreeBSP, [{
71
+ return (0, _createClass2["default"])(ThreeBSP, [{
72
72
  key: "subtract",
73
73
  value: function subtract(other_tree) {
74
74
  var a = this.tree.clone(),
@@ -165,7 +165,7 @@ var ThreeBSP = exports["default"] = /*#__PURE__*/function () {
165
165
  }();
166
166
  var Polygon = /*#__PURE__*/function () {
167
167
  function Polygon(vertices, normal, w) {
168
- _classCallCheck(this, Polygon);
168
+ (0, _classCallCheck2["default"])(this, Polygon);
169
169
  if (!(vertices instanceof Array)) {
170
170
  vertices = [];
171
171
  }
@@ -176,7 +176,7 @@ var Polygon = /*#__PURE__*/function () {
176
176
  this.normal = this.w = undefined;
177
177
  }
178
178
  }
179
- return _createClass(Polygon, [{
179
+ return (0, _createClass2["default"])(Polygon, [{
180
180
  key: "calculateProperties",
181
181
  value: function calculateProperties() {
182
182
  var a = this.vertices[0],
@@ -296,14 +296,14 @@ var Polygon = /*#__PURE__*/function () {
296
296
  }();
297
297
  var Vertex = /*#__PURE__*/function () {
298
298
  function Vertex(x, y, z, normal, uv) {
299
- _classCallCheck(this, Vertex);
299
+ (0, _classCallCheck2["default"])(this, Vertex);
300
300
  this.x = x;
301
301
  this.y = y;
302
302
  this.z = z;
303
303
  this.normal = normal || new THREE.Vector3();
304
304
  this.uv = uv || new THREE.Vector2();
305
305
  }
306
- return _createClass(Vertex, [{
306
+ return (0, _createClass2["default"])(Vertex, [{
307
307
  key: "clone",
308
308
  value: function clone() {
309
309
  return new Vertex(this.x, this.y, this.z, this.normal.clone(), this.uv.clone());
@@ -388,7 +388,7 @@ var Vertex = /*#__PURE__*/function () {
388
388
  }();
389
389
  var Node = /*#__PURE__*/function () {
390
390
  function Node(polygons) {
391
- _classCallCheck(this, Node);
391
+ (0, _classCallCheck2["default"])(this, Node);
392
392
  var i,
393
393
  polygon_count,
394
394
  front = [],
@@ -407,7 +407,7 @@ var Node = /*#__PURE__*/function () {
407
407
  this.back = new Node(back);
408
408
  }
409
409
  }
410
- return _createClass(Node, [{
410
+ return (0, _createClass2["default"])(Node, [{
411
411
  key: "isConvex",
412
412
  value: function isConvex(polygons) {
413
413
  var i, j;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kitchen-simulator",
3
- "version": "1.1.1-test.6",
4
- "description": "It is a kitchen simulator.",
3
+ "version": "1.1.1-test.61",
4
+ "description": "It is a kitchen simulator (self-contained micro-frontend).",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -31,7 +31,7 @@
31
31
  "clean": "rimraf lib es",
32
32
  "update-version-file": "const-version ./package.json ./src/version.js",
33
33
  "version": "npm run update-version-file && npm run build",
34
- "prepublishOnly": "npm run build",
34
+ "prepublishOnly": "cross-env NODE_ENV=production npm run build",
35
35
  "test": "echo \"Error: no test specified\" && exit 1"
36
36
  },
37
37
  "repository": {
@@ -57,84 +57,54 @@
57
57
  "component",
58
58
  "redux"
59
59
  ],
60
- "peerDependencies": {
61
- "react": ">=16.9 <19",
62
- "react-dom": ">=16.9 <19"
63
- },
64
60
  "dependencies": {
65
- "@mapbox/react-range": "0.0.7",
66
- "@material-ui/core": "^4.12.3",
67
- "@material-ui/icons": "^4.11.2",
68
- "@material-ui/lab": "^4.0.0-alpha.61",
69
61
  "@sentry/react": "^9.10.1",
70
- "antd": "^4.24.16",
71
- "area-polygon": "1.0.1",
72
- "assert": "^2.1.0",
73
- "aws-sdk": "^2.984.0",
74
62
  "axios": "^0.20.0",
75
63
  "browserify-zlib": "^0.2.0",
76
- "buffer": "^6.0.3",
77
64
  "camera-controls": "^2.8.5",
78
- "convert-units": "2.3.4",
79
65
  "dotenv": "^16.4.7",
80
66
  "history": "4.10.1",
67
+ "hoist-non-react-statics": "2.5.5",
81
68
  "immutable": "3.8.2",
82
69
  "immutablediff": "0.4.4",
83
70
  "immutablepatch": "0.5.0",
84
- "infinite-react-carousel": "^1.2.11",
85
- "jwt-decode": "^2.2.0",
86
- "localstorage-slim": "^2.7.1",
87
- "lodash": "^4.17.21",
88
- "material-ui": "^0.20.2",
89
- "mobile-detect": "^1.4.5",
71
+ "invariant": "^2.0.0",
72
+ "localstorage-slim": "^1.3.0",
73
+ "nanoid": "^5.1.6",
90
74
  "path-browserify": "^1.0.1",
91
75
  "polylabel": "1.0.2",
92
76
  "posthog-js": "^1.271.0",
93
- "prop-types": "15.7.2",
94
- "react-collapse": "^4.0.3",
95
- "react-ga4": "^1.4.1",
96
- "react-hotjar": "^1.0.11",
77
+ "prop-types": "^15.8.1",
78
+ "react": "^16.9.0",
79
+ "react-container-dimensions": "1.4.1",
80
+ "react-dom": "16.9.0",
97
81
  "react-icons": "3.5.0",
98
- "react-player": "2.8.0",
99
- "react-query": "^3.39.3",
100
82
  "react-redux": "5.0.7",
101
- "react-router-dom": "5.1.2",
102
- "react-svg-pan-zoom": "2.18.0",
103
- "react-tabs": "3.0.0",
104
- "reactjs-popup": "^2.0.4",
83
+ "react-svg-pan-zoom": "^3.13.1",
105
84
  "redux": "4.0.1",
106
- "redux-thunk": "2.3.0",
107
- "shortid": "2.2.14",
108
85
  "stream-browserify": "^3.0.0",
109
- "styled-components": "^5.2.0",
110
- "velocity-react": "1.4.3"
86
+ "three": "0.166.0"
111
87
  },
112
88
  "devDependencies": {
113
- "@babel/cli": "^7.24.8",
114
- "@babel/core": "^7.24.7",
115
- "@babel/preset-env": "^7.24.7",
116
- "@babel/preset-react": "^7.24.7",
89
+ "@babel/cli": "^7.28.3",
90
+ "@babel/core": "^7.28.4",
91
+ "@babel/plugin-transform-modules-commonjs": "^7.27.1",
92
+ "@babel/plugin-transform-runtime": "^7.28.3",
93
+ "@babel/preset-env": "^7.28.3",
94
+ "@babel/preset-react": "^7.27.1",
117
95
  "@sentry/webpack-plugin": "^3.2.4",
118
96
  "babel-loader": "^9.1.3",
119
97
  "babel-plugin-import-glob": "^2.0.0",
120
98
  "babel-plugin-module-resolver": "^5.0.2",
121
99
  "babel-plugin-transform-object-rest-spread": "^6.26.0",
100
+ "babel-plugin-transform-rename-import": "^2.3.0",
122
101
  "const-version": "2.0.0",
123
- "cross-env": "5.2.0",
124
- "css-loader": "^5.0.1",
102
+ "cross-env": "^5.2.0",
103
+ "css-loader": "*",
125
104
  "file-loader": "6.2.0",
126
- "gh-pages": "2.0.1",
127
105
  "html-webpack-plugin": "5.6.0",
128
- "immutable-devtools": "0.1.4",
129
- "prettier": "^3.5.3",
130
- "react": "^16.9.0",
131
- "react-container-dimensions": "1.4.1",
132
- "react-dom": "16.9.0",
133
- "rimraf": "2.6.3",
134
- "sass": "^1.29.0",
135
- "sass-loader": "^10.0.5",
136
- "style-loader": "0.23.1",
137
- "three": "0.166.0",
106
+ "rimraf": "^2.6.3",
107
+ "style-loader": "*",
138
108
  "webpack": "5.92.1",
139
109
  "webpack-cli": "5.1.4",
140
110
  "webpack-dev-server": "5.0.4"
@@ -1,191 +0,0 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- 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; }
3
- 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; }
4
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
5
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
- import ReactGA from 'react-ga4';
8
-
9
- // ---------- Helpers ----------
10
- function nowMs() {
11
- return Date.now();
12
- }
13
- function getClientName() {
14
- return sessionStorage.getItem('visualizerName');
15
- }
16
- function isDesktopUA() {
17
- // Lightweight heuristic; GA4 also provides device.category. This flag can help ad-hoc filtering.
18
- var ua = navigator.userAgent.toLowerCase();
19
- var isMobile = /mobi|android|iphone|ipad|ipod|windows phone/.test(ua);
20
- return !isMobile;
21
- }
22
-
23
- // ---------- Keys for storage ----------
24
- var SSN_KEYS = {
25
- sessionStartMs: 'ga4_session_start_ms',
26
- introChoiceMs: 'ga4_intro_choice_ms',
27
- firstCabinetPlaced: 'ga4_first_cabinet_placed',
28
- contextBooted: 'ga4_context_booted',
29
- enteredCanvasSent: 'ga4_entered_canvas_sent'
30
- };
31
-
32
- // ---------- Core GA wrapper ----------
33
- export var GA = {
34
- init: function init(_ref) {
35
- var measurementId = _ref.measurementId;
36
- ReactGA.initialize([{
37
- trackingId: measurementId
38
- }], {
39
- testMode: false
40
- });
41
- },
42
- resetSessionKeys: function resetSessionKeys() {
43
- Object.values(SSN_KEYS).forEach(function (key) {
44
- sessionStorage.removeItem(key);
45
- });
46
- },
47
- /**
48
- * Must be called ONCE per page load, *before* other events.
49
- * Sets user properties (project_entry, cross_auth) and sends an initial page_view with client_name.
50
- */
51
- bootSessionContext: function bootSessionContext(_ref2) {
52
- var projectEntry = _ref2.projectEntry,
53
- crossAuth = _ref2.crossAuth;
54
- try {
55
- var resolvedClient = getClientName();
56
-
57
- // Persist session start for timing metrics (if not already set for this tab)
58
- if (!sessionStorage.getItem(SSN_KEYS.sessionStartMs)) {
59
- sessionStorage.setItem(SSN_KEYS.sessionStartMs, String(nowMs()));
60
- }
61
-
62
- // Mark context as booted to avoid duplicate property sets on hot reloads
63
- if (!sessionStorage.getItem(SSN_KEYS.contextBooted)) {
64
- sessionStorage.setItem(SSN_KEYS.contextBooted, '1');
65
-
66
- // Set GA4 user_properties (user-scoped dimensions)
67
- ReactGA.gtag('set', 'user_properties', {
68
- project_entry: projectEntry,
69
- // user scope dimension
70
- cross_auth: crossAuth // user scope dimension (boolean serialized)
71
- });
72
- }
73
-
74
- // Send first page_view hit enriched with event-scoped client_name
75
- ReactGA.send({
76
- hitType: 'pageview',
77
- page: window.location.pathname + window.location.search,
78
- // @ts-expect-error react-ga4 passes along additional params into gtag
79
- client_name: resolvedClient
80
- });
81
- } catch (e) {
82
- // eslint-disable-next-line no-console
83
- console.warn('GA.bootSessionContext error', e);
84
- }
85
- },
86
- // Utility to derive cross_auth from URL (token or details query params)
87
- deriveCrossAuthFromUrl: function deriveCrossAuthFromUrl(search) {
88
- var sp = new URLSearchParams(search);
89
- return sp.has('token') || sp.has('details');
90
- },
91
- // Utility to derive project entry (best-effort). You can also pass explicitly from router logic.
92
- deriveProjectEntry: function deriveProjectEntry() {
93
- var projectId = sessionStorage.getItem('projectId');
94
-
95
- // If a project id exists, consider it "open_existing"; otherwise fallback to "new"
96
- if (projectId) return 'open_existing';
97
- return 'new';
98
- },
99
- // ---------- Event API ----------
100
- events: {
101
- /**
102
- * intro_choice(option) — records the user's entry choice.
103
- * Also stores a timestamp for later time_to_canvas calculation.
104
- */
105
- introChoice: function introChoice(option, extra) {
106
- var client_name = getClientName();
107
- sessionStorage.setItem(SSN_KEYS.introChoiceMs, String(nowMs()));
108
- ReactGA.event('intro_choice', _objectSpread({
109
- client_name: client_name,
110
- option: option
111
- }, extra || {}));
112
- },
113
- /**
114
- * entered_canvas(time_to_canvas) — compute (now - intro_choice)
115
- */
116
- enteredCanvas: function enteredCanvas() {
117
- // fire only once per tab/session
118
- if (sessionStorage.getItem(SSN_KEYS.enteredCanvasSent)) return;
119
- var client_name = getClientName();
120
- var introMs = Number(sessionStorage.getItem(SSN_KEYS.introChoiceMs) || 0);
121
- var timeSec = introMs ? Math.max(0, Math.round((Date.now() - introMs) / 1000)) : undefined;
122
- ReactGA.event('entered_canvas', _objectSpread({
123
- client_name: client_name
124
- }, typeof timeSec === 'number' ? {
125
- time_to_canvas: timeSec
126
- } : {}));
127
- sessionStorage.setItem(SSN_KEYS.enteredCanvasSent, '1'); // 👈 lock it
128
- },
129
- /**
130
- * cabinet_placed(time_to_first_cabinet) — send only for the *first* cabinet of the session.
131
- */
132
- cabinetPlaced: function cabinetPlaced() {
133
- var already = sessionStorage.getItem(SSN_KEYS.firstCabinetPlaced);
134
- var client_name = getClientName();
135
- var params = {
136
- client_name: client_name
137
- };
138
- if (!already) {
139
- var startMs = Number(sessionStorage.getItem(SSN_KEYS.sessionStartMs) || 0);
140
- var timeSec = startMs ? Math.max(0, Math.round((nowMs() - startMs) / 1000)) : undefined;
141
- if (typeof timeSec === 'number') params.time_to_first_cabinet = timeSec; // custom metric (seconds)
142
- sessionStorage.setItem(SSN_KEYS.firstCabinetPlaced, '1');
143
- }
144
- ReactGA.event('cabinet_placed', params);
145
- },
146
- /**
147
- * door_changed(door_id)
148
- */
149
- doorChanged: function doorChanged(door_id) {
150
- var client_name = getClientName();
151
- ReactGA.event('door_changed', {
152
- client_name: client_name,
153
- door_id: door_id
154
- });
155
- },
156
- /**
157
- * project_saved(project_id, save_method) — mark as conversion in GA UI.
158
- */
159
- projectSaved: function projectSaved(project_id, save_method) {
160
- var client_name = getClientName();
161
- ReactGA.event('project_saved', {
162
- client_name: client_name,
163
- project_id: project_id,
164
- save_method: save_method
165
- });
166
- },
167
- /**
168
- * assistance_requested(method, project_id) — mark as conversion in GA UI.
169
- */
170
- assistanceRequested: function assistanceRequested(method, project_id) {
171
- var client_name = getClientName();
172
- ReactGA.event('assistance_requested', {
173
- client_name: client_name,
174
- method: method,
175
- project_id: project_id
176
- });
177
- },
178
- /**
179
- * add_to_cart(project_id, sku_count, price_total) — mark as conversion in GA UI.
180
- */
181
- addToCart: function addToCart(project_id, sku_count, price_total) {
182
- var client_name = getClientName();
183
- ReactGA.event('add_to_cart', {
184
- client_name: client_name,
185
- project_id: project_id,
186
- sku_count: sku_count,
187
- price_total: price_total
188
- });
189
- }
190
- }
191
- };
@@ -1,60 +0,0 @@
1
- import posthog from 'posthog-js';
2
-
3
- // ---- session context ----
4
- export function bootSessionContext() {
5
- var url = new URL(window.location.href);
6
- var client_name = sessionStorage.getItem('visualizerName');
7
- var project_entry = sessionStorage.getItem('projectId') ? 'open_existing' : 'new';
8
- var cross_auth = url.searchParams.has('token') || url.searchParams.has('details');
9
-
10
- // Persist context on the client/session
11
- posthog.register({
12
- client_name: client_name,
13
- project_entry: project_entry,
14
- cross_auth: cross_auth
15
- });
16
-
17
- // First-hit event for qualitative flow
18
- posthog.capture('session_started', {
19
- client_name: client_name,
20
- project_entry: project_entry,
21
- cross_auth: cross_auth
22
- });
23
- }
24
-
25
- // Optional: expose session id for replay linkage
26
- export function getSessionId() {
27
- try {
28
- return posthog.get_session_id();
29
- } catch (_unused) {
30
- return null;
31
- }
32
- }
33
-
34
- // ---- event wrappers (mirror GA4 conversions) ----
35
- export var PH = {
36
- projectSaved: function projectSaved(project_id) {
37
- posthog.capture('project_saved', {
38
- project_id: project_id,
39
- client_name: sessionStorage.getItem('visualizerName'),
40
- session_id: getSessionId()
41
- });
42
- },
43
- assistanceRequested: function assistanceRequested(method, project_id) {
44
- posthog.capture('assistance_requested', {
45
- method: method,
46
- project_id: project_id,
47
- client_name: sessionStorage.getItem('visualizerName'),
48
- session_id: getSessionId()
49
- });
50
- },
51
- addToCart: function addToCart(project_id, sku_count, price_total) {
52
- posthog.capture('add_to_cart', {
53
- project_id: project_id,
54
- sku_count: sku_count,
55
- price_total: price_total,
56
- client_name: sessionStorage.getItem('visualizerName'),
57
- session_id: getSessionId()
58
- });
59
- }
60
- };
@@ -1,197 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.GA = void 0;
7
- var _reactGa = _interopRequireDefault(require("react-ga4"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
9
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
10
- 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; }
11
- 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; }
12
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
13
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
14
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
15
- // ---------- Helpers ----------
16
- function nowMs() {
17
- return Date.now();
18
- }
19
- function getClientName() {
20
- return sessionStorage.getItem('visualizerName');
21
- }
22
- function isDesktopUA() {
23
- // Lightweight heuristic; GA4 also provides device.category. This flag can help ad-hoc filtering.
24
- var ua = navigator.userAgent.toLowerCase();
25
- var isMobile = /mobi|android|iphone|ipad|ipod|windows phone/.test(ua);
26
- return !isMobile;
27
- }
28
-
29
- // ---------- Keys for storage ----------
30
- var SSN_KEYS = {
31
- sessionStartMs: 'ga4_session_start_ms',
32
- introChoiceMs: 'ga4_intro_choice_ms',
33
- firstCabinetPlaced: 'ga4_first_cabinet_placed',
34
- contextBooted: 'ga4_context_booted',
35
- enteredCanvasSent: 'ga4_entered_canvas_sent'
36
- };
37
-
38
- // ---------- Core GA wrapper ----------
39
- var GA = exports.GA = {
40
- init: function init(_ref) {
41
- var measurementId = _ref.measurementId;
42
- _reactGa["default"].initialize([{
43
- trackingId: measurementId
44
- }], {
45
- testMode: false
46
- });
47
- },
48
- resetSessionKeys: function resetSessionKeys() {
49
- Object.values(SSN_KEYS).forEach(function (key) {
50
- sessionStorage.removeItem(key);
51
- });
52
- },
53
- /**
54
- * Must be called ONCE per page load, *before* other events.
55
- * Sets user properties (project_entry, cross_auth) and sends an initial page_view with client_name.
56
- */
57
- bootSessionContext: function bootSessionContext(_ref2) {
58
- var projectEntry = _ref2.projectEntry,
59
- crossAuth = _ref2.crossAuth;
60
- try {
61
- var resolvedClient = getClientName();
62
-
63
- // Persist session start for timing metrics (if not already set for this tab)
64
- if (!sessionStorage.getItem(SSN_KEYS.sessionStartMs)) {
65
- sessionStorage.setItem(SSN_KEYS.sessionStartMs, String(nowMs()));
66
- }
67
-
68
- // Mark context as booted to avoid duplicate property sets on hot reloads
69
- if (!sessionStorage.getItem(SSN_KEYS.contextBooted)) {
70
- sessionStorage.setItem(SSN_KEYS.contextBooted, '1');
71
-
72
- // Set GA4 user_properties (user-scoped dimensions)
73
- _reactGa["default"].gtag('set', 'user_properties', {
74
- project_entry: projectEntry,
75
- // user scope dimension
76
- cross_auth: crossAuth // user scope dimension (boolean serialized)
77
- });
78
- }
79
-
80
- // Send first page_view hit enriched with event-scoped client_name
81
- _reactGa["default"].send({
82
- hitType: 'pageview',
83
- page: window.location.pathname + window.location.search,
84
- // @ts-expect-error react-ga4 passes along additional params into gtag
85
- client_name: resolvedClient
86
- });
87
- } catch (e) {
88
- // eslint-disable-next-line no-console
89
- console.warn('GA.bootSessionContext error', e);
90
- }
91
- },
92
- // Utility to derive cross_auth from URL (token or details query params)
93
- deriveCrossAuthFromUrl: function deriveCrossAuthFromUrl(search) {
94
- var sp = new URLSearchParams(search);
95
- return sp.has('token') || sp.has('details');
96
- },
97
- // Utility to derive project entry (best-effort). You can also pass explicitly from router logic.
98
- deriveProjectEntry: function deriveProjectEntry() {
99
- var projectId = sessionStorage.getItem('projectId');
100
-
101
- // If a project id exists, consider it "open_existing"; otherwise fallback to "new"
102
- if (projectId) return 'open_existing';
103
- return 'new';
104
- },
105
- // ---------- Event API ----------
106
- events: {
107
- /**
108
- * intro_choice(option) — records the user's entry choice.
109
- * Also stores a timestamp for later time_to_canvas calculation.
110
- */
111
- introChoice: function introChoice(option, extra) {
112
- var client_name = getClientName();
113
- sessionStorage.setItem(SSN_KEYS.introChoiceMs, String(nowMs()));
114
- _reactGa["default"].event('intro_choice', _objectSpread({
115
- client_name: client_name,
116
- option: option
117
- }, extra || {}));
118
- },
119
- /**
120
- * entered_canvas(time_to_canvas) — compute (now - intro_choice)
121
- */
122
- enteredCanvas: function enteredCanvas() {
123
- // fire only once per tab/session
124
- if (sessionStorage.getItem(SSN_KEYS.enteredCanvasSent)) return;
125
- var client_name = getClientName();
126
- var introMs = Number(sessionStorage.getItem(SSN_KEYS.introChoiceMs) || 0);
127
- var timeSec = introMs ? Math.max(0, Math.round((Date.now() - introMs) / 1000)) : undefined;
128
- _reactGa["default"].event('entered_canvas', _objectSpread({
129
- client_name: client_name
130
- }, typeof timeSec === 'number' ? {
131
- time_to_canvas: timeSec
132
- } : {}));
133
- sessionStorage.setItem(SSN_KEYS.enteredCanvasSent, '1'); // 👈 lock it
134
- },
135
- /**
136
- * cabinet_placed(time_to_first_cabinet) — send only for the *first* cabinet of the session.
137
- */
138
- cabinetPlaced: function cabinetPlaced() {
139
- var already = sessionStorage.getItem(SSN_KEYS.firstCabinetPlaced);
140
- var client_name = getClientName();
141
- var params = {
142
- client_name: client_name
143
- };
144
- if (!already) {
145
- var startMs = Number(sessionStorage.getItem(SSN_KEYS.sessionStartMs) || 0);
146
- var timeSec = startMs ? Math.max(0, Math.round((nowMs() - startMs) / 1000)) : undefined;
147
- if (typeof timeSec === 'number') params.time_to_first_cabinet = timeSec; // custom metric (seconds)
148
- sessionStorage.setItem(SSN_KEYS.firstCabinetPlaced, '1');
149
- }
150
- _reactGa["default"].event('cabinet_placed', params);
151
- },
152
- /**
153
- * door_changed(door_id)
154
- */
155
- doorChanged: function doorChanged(door_id) {
156
- var client_name = getClientName();
157
- _reactGa["default"].event('door_changed', {
158
- client_name: client_name,
159
- door_id: door_id
160
- });
161
- },
162
- /**
163
- * project_saved(project_id, save_method) — mark as conversion in GA UI.
164
- */
165
- projectSaved: function projectSaved(project_id, save_method) {
166
- var client_name = getClientName();
167
- _reactGa["default"].event('project_saved', {
168
- client_name: client_name,
169
- project_id: project_id,
170
- save_method: save_method
171
- });
172
- },
173
- /**
174
- * assistance_requested(method, project_id) — mark as conversion in GA UI.
175
- */
176
- assistanceRequested: function assistanceRequested(method, project_id) {
177
- var client_name = getClientName();
178
- _reactGa["default"].event('assistance_requested', {
179
- client_name: client_name,
180
- method: method,
181
- project_id: project_id
182
- });
183
- },
184
- /**
185
- * add_to_cart(project_id, sku_count, price_total) — mark as conversion in GA UI.
186
- */
187
- addToCart: function addToCart(project_id, sku_count, price_total) {
188
- var client_name = getClientName();
189
- _reactGa["default"].event('add_to_cart', {
190
- client_name: client_name,
191
- project_id: project_id,
192
- sku_count: sku_count,
193
- price_total: price_total
194
- });
195
- }
196
- }
197
- };