kitchen-simulator 1.1.1-test.6 → 1.1.1-test.60
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/es/KitchenConfigurator.js +8 -15
- package/es/KitchenConfiguratorApp.js +11 -27
- package/es/actions/holes-actions.js +1 -1
- package/es/actions/items-actions.js +1 -1
- package/es/actions/lines-actions.js +1 -1
- package/es/actions/project-actions.js +1 -1
- package/es/actions/scene-actions.js +1 -1
- package/es/actions/vertices-actions.js +1 -1
- package/es/actions/viewer2d-actions.js +1 -1
- package/es/actions/viewer3d-actions.js +1 -1
- package/es/catalog/areas/area/planner-element.js +10 -7
- package/es/catalog/factories/wall-factory-3d.js +1 -1
- package/es/catalog/holes/export.js +13 -13
- package/es/catalog/lines/wall/planner-element.js +13 -10
- package/es/catalog/properties/property-checkbox.js +63 -18
- package/es/catalog/properties/property-enum.js +51 -9
- package/es/catalog/properties/property-lenght-measure.js +2 -2
- package/es/catalog/properties/property-length-measure.js +58 -9
- package/es/catalog/properties/property-length-measure_hole.js +2 -2
- package/es/catalog/utils/exporter.js +1 -1
- package/es/catalog/utils/item-loader.js +1 -1
- package/es/catalog/utils/mtl-loader.js +3 -2
- package/es/catalog/utils/obj-loader.js +3 -2
- package/es/class/area.js +1 -1
- package/es/class/group.js +3 -3
- package/es/class/hole.js +5 -6
- package/es/class/item.js +8 -10
- package/es/class/layer.js +2 -2
- package/es/class/project.js +4 -4
- package/es/components/content.js +1 -0
- package/es/components/disclaimer/disclaimer.js +66 -86
- package/es/components/style/form-number-input.js +31 -7
- package/es/components/style/form-select.js +56 -8
- package/es/components/style/form-slider.js +22 -6
- package/es/components/style/form-text-input.js +31 -12
- package/es/components/viewer2d/area.js +4 -4
- package/es/components/viewer2d/grids/grid-horizontal-streak.js +0 -1
- package/es/components/viewer2d/grids/grid-streak.js +0 -1
- package/es/components/viewer2d/grids/grid-vertical-streak.js +0 -1
- package/es/components/viewer2d/item.js +3 -5
- package/es/components/viewer2d/line.js +2 -5
- package/es/components/viewer2d/ruler.js +2 -3
- package/es/components/viewer2d/rulerDist.js +1 -1
- package/es/components/viewer2d/scene.js +2 -2
- package/es/components/viewer2d/utils.js +37 -1
- package/es/components/viewer2d/viewer2d.js +10 -4
- package/es/components/viewer3d/libs/mtl-loader.js +2 -2
- package/es/components/viewer3d/libs/obj-loader.js +2 -2
- package/es/components/viewer3d/libs/orbit-controls.js +6 -5
- package/es/components/viewer3d/libs/pointer-lock-controls.js +5 -4
- package/es/components/viewer3d/ruler-utils/itemRect.js +1 -1
- package/es/components/viewer3d/ruler-utils/layer3D.js +2 -2
- package/es/components/viewer3d/ruler-utils/scene3D.js +2 -3
- package/es/components/viewer3d/scene-creator.js +1 -1
- package/es/components/viewer3d/viewer3d.js +12 -13
- package/es/index.js +20 -14
- package/es/models.js +4 -3
- package/es/plugins/keyboard.js +2 -2
- package/es/reducers/holes-reducer.js +1 -1
- package/es/reducers/items-reducer.js +2 -5
- package/es/reducers/lines-reducer.js +1 -1
- package/es/reducers/project-reducer.js +1 -1
- package/es/reducers/reducer.js +2 -2
- package/es/reducers/scene-reducer.js +1 -1
- package/es/reducers/user-reducer.js +1 -2
- package/es/reducers/vertices-reducer.js +1 -1
- package/es/reducers/viewer2d-reducer.js +2 -2
- package/es/reducers/viewer3d-reducer.js +2 -2
- package/es/utils/convert-units-lite.js +29 -0
- package/es/utils/geometry.js +4 -4
- package/es/utils/get-edges-of-subgraphs.js +2 -1
- package/es/utils/graph-cycles.js +2 -3
- package/es/utils/graph.js +2 -1
- package/es/utils/helper.js +1 -69
- package/es/utils/id-broker.js +2 -2
- package/es/utils/molding.js +34 -34
- package/lib/KitchenConfigurator.js +33 -40
- package/lib/KitchenConfiguratorApp.js +34 -49
- package/lib/catalog/areas/area/planner-element.js +12 -8
- package/lib/catalog/factories/wall-factory-3d.js +2 -2
- package/lib/catalog/holes/export.js +13 -13
- package/lib/catalog/lines/wall/planner-element.js +15 -11
- package/lib/catalog/properties/property-checkbox.js +64 -19
- package/lib/catalog/properties/property-enum.js +49 -7
- package/lib/catalog/properties/property-lenght-measure.js +3 -3
- package/lib/catalog/properties/property-length-measure.js +60 -11
- package/lib/catalog/properties/property-length-measure_hole.js +3 -3
- package/lib/catalog/utils/exporter.js +5 -6
- package/lib/catalog/utils/item-loader.js +20 -21
- package/lib/catalog/utils/mtl-loader.js +7 -3
- package/lib/catalog/utils/obj-loader.js +7 -3
- package/lib/class/item.js +13 -16
- package/lib/components/content.js +1 -0
- package/lib/components/disclaimer/disclaimer.js +66 -86
- package/lib/components/style/form-number-input.js +30 -6
- package/lib/components/style/form-select.js +54 -8
- package/lib/components/style/form-slider.js +22 -6
- package/lib/components/style/form-text-input.js +30 -12
- package/lib/components/viewer2d/area.js +5 -5
- package/lib/components/viewer2d/grids/grid-horizontal-streak.js +0 -1
- package/lib/components/viewer2d/grids/grid-streak.js +0 -1
- package/lib/components/viewer2d/grids/grid-vertical-streak.js +0 -1
- package/lib/components/viewer2d/item.js +7 -8
- package/lib/components/viewer2d/line.js +2 -5
- package/lib/components/viewer2d/ruler.js +6 -7
- package/lib/components/viewer2d/rulerDist.js +4 -4
- package/lib/components/viewer2d/scene.js +1 -1
- package/lib/components/viewer2d/utils.js +37 -0
- package/lib/components/viewer2d/viewer2d.js +25 -17
- package/lib/components/viewer3d/libs/mtl-loader.js +6 -2
- package/lib/components/viewer3d/libs/obj-loader.js +6 -2
- package/lib/components/viewer3d/libs/orbit-controls.js +10 -5
- package/lib/components/viewer3d/libs/pointer-lock-controls.js +9 -4
- package/lib/components/viewer3d/ruler-utils/itemRect.js +7 -7
- package/lib/components/viewer3d/ruler-utils/layer3D.js +32 -32
- package/lib/components/viewer3d/ruler-utils/scene3D.js +3 -4
- package/lib/components/viewer3d/scene-creator.js +24 -24
- package/lib/components/viewer3d/viewer3d.js +17 -17
- package/lib/index.js +22 -88
- package/lib/models.js +7 -7
- package/lib/reducers/user-reducer.js +0 -1
- package/lib/reducers/viewer2d-reducer.js +3 -4
- package/lib/reducers/viewer3d-reducer.js +3 -4
- package/lib/utils/convert-units-lite.js +35 -0
- package/lib/utils/geometry.js +9 -10
- package/lib/utils/get-edges-of-subgraphs.js +7 -1
- package/lib/utils/graph-cycles.js +9 -9
- package/lib/utils/graph.js +9 -3
- package/lib/utils/helper.js +7 -76
- package/lib/utils/id-broker.js +2 -2
- package/lib/utils/molding.js +52 -52
- package/package.json +34 -70
- package/es/analytics/ga4.js +0 -191
- package/es/analytics/posthog.js +0 -60
- package/lib/analytics/ga4.js +0 -197
- package/lib/analytics/posthog.js +0 -68
package/lib/utils/molding.js
CHANGED
|
@@ -23,7 +23,7 @@ exports.sortItemsByDistance = sortItemsByDistance;
|
|
|
23
23
|
exports.tryMergeMDItem = tryMergeMDItem;
|
|
24
24
|
var _constants = require("../constants");
|
|
25
25
|
var Three = _interopRequireWildcard(require("three"));
|
|
26
|
-
var
|
|
26
|
+
var _convertUnitsLite = require("./convert-units-lite");
|
|
27
27
|
var _idBroker = _interopRequireDefault(require("./id-broker"));
|
|
28
28
|
var _utils = require("../components/viewer2d/utils");
|
|
29
29
|
var _export = require("./export");
|
|
@@ -48,10 +48,10 @@ function getItemRect(item) {
|
|
|
48
48
|
var rotRad = item.rotation / 180 * Math.PI;
|
|
49
49
|
var itemWidth = item.properties.get('width').get('_length');
|
|
50
50
|
var itemWidthUnit = item.properties.get('width').get('_unit') || 'cm';
|
|
51
|
-
itemWidth = (0,
|
|
51
|
+
itemWidth = (0, _convertUnitsLite.convert)(itemWidth / 2).from(itemWidthUnit).to('cm');
|
|
52
52
|
var itemDepth = item.properties.get('depth').get('_length');
|
|
53
53
|
var itemDepthUnit = item.properties.get('depth').get('_unit') || 'cm';
|
|
54
|
-
itemDepth = (0,
|
|
54
|
+
itemDepth = (0, _convertUnitsLite.convert)(itemDepth / 2).from(itemDepthUnit).to('cm');
|
|
55
55
|
var mx = x - itemWidth * Math.cos(rotRad);
|
|
56
56
|
var my = y - itemWidth * Math.sin(rotRad);
|
|
57
57
|
var x0 = mx + itemDepth * Math.sin(rotRad);
|
|
@@ -93,16 +93,16 @@ function isEnableItemForMolding(layer, selItem) {
|
|
|
93
93
|
else return result && hasMoldingLayout(molding, selItem.layoutpos);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
/**
|
|
97
|
-
* Check two line segments are overlap. The direction of the two line segments must be opposite.
|
|
98
|
-
* s1 c2 s2 c1
|
|
99
|
-
* |--------|------|-----------|
|
|
100
|
-
* Decision Formular: L(s1,c1) + L(s2, c2) = L(s1, s2) + L(c1, c2)
|
|
101
|
-
* @param {*} selRectPos1
|
|
102
|
-
* @param {*} selRectPos2
|
|
103
|
-
* @param {*} curRectPos1
|
|
104
|
-
* @param {*} curRectPos2
|
|
105
|
-
* @returns L(s1,c1) + L(s2, c2) - L(s1, s2) - L(c1, c2)
|
|
96
|
+
/**
|
|
97
|
+
* Check two line segments are overlap. The direction of the two line segments must be opposite.
|
|
98
|
+
* s1 c2 s2 c1
|
|
99
|
+
* |--------|------|-----------|
|
|
100
|
+
* Decision Formular: L(s1,c1) + L(s2, c2) = L(s1, s2) + L(c1, c2)
|
|
101
|
+
* @param {*} selRectPos1
|
|
102
|
+
* @param {*} selRectPos2
|
|
103
|
+
* @param {*} curRectPos1
|
|
104
|
+
* @param {*} curRectPos2
|
|
105
|
+
* @returns L(s1,c1) + L(s2, c2) - L(s1, s2) - L(c1, c2)
|
|
106
106
|
*/
|
|
107
107
|
function getDelta(selRectPos1, selRectPos2, curRectPos1, curRectPos2) {
|
|
108
108
|
return (
|
|
@@ -142,16 +142,16 @@ function isSameMoldingLayoutpos(curItem, item) {
|
|
|
142
142
|
function isItemSameItemByLocation(item1, item2, location) {
|
|
143
143
|
var item1Altitude = item1.properties.get('altitude').get('_length');
|
|
144
144
|
var item1AltitudeUnit = item1.properties.get('altitude').get('_unit');
|
|
145
|
-
item1Altitude = (0,
|
|
145
|
+
item1Altitude = (0, _convertUnitsLite.convert)(item1Altitude).from(item1AltitudeUnit).to('cm');
|
|
146
146
|
var item1Height = item1.properties.get('height').get('_length');
|
|
147
147
|
var item1HeightUnit = item1.properties.get('height').get('_unit');
|
|
148
|
-
item1Height = (0,
|
|
148
|
+
item1Height = (0, _convertUnitsLite.convert)(item1Height).from(item1HeightUnit).to('cm');
|
|
149
149
|
var item2Altitude = item2.properties.get('altitude').get('_length');
|
|
150
150
|
var item2AltitudeUnit = item2.properties.get('altitude').get('_unit');
|
|
151
|
-
item2Altitude = (0,
|
|
151
|
+
item2Altitude = (0, _convertUnitsLite.convert)(item2Altitude).from(item2AltitudeUnit).to('cm');
|
|
152
152
|
var item2Height = item2.properties.get('height').get('_length');
|
|
153
153
|
var item2HeightUnit = item2.properties.get('height').get('_unit');
|
|
154
|
-
item2Height = (0,
|
|
154
|
+
item2Height = (0, _convertUnitsLite.convert)(item2Height).from(item2HeightUnit).to('cm');
|
|
155
155
|
var flag = false;
|
|
156
156
|
switch (location) {
|
|
157
157
|
case _constants.TOP_MOLDING_LOCATION:
|
|
@@ -192,11 +192,11 @@ function tryMergeItemWithLocation(curItem, itemGroup, location) {
|
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
/**
|
|
196
|
-
* Make the molding group array with [items].
|
|
197
|
-
* @param {*} layer
|
|
198
|
-
* @param {*} items - Mergable snapped item group, if [items] is null then get all MG array of layer
|
|
199
|
-
* @returns MG array
|
|
195
|
+
/**
|
|
196
|
+
* Make the molding group array with [items].
|
|
197
|
+
* @param {*} layer
|
|
198
|
+
* @param {*} items - Mergable snapped item group, if [items] is null then get all MG array of layer
|
|
199
|
+
* @returns MG array
|
|
200
200
|
*/
|
|
201
201
|
function getAllMoldingGroups(layer) {
|
|
202
202
|
var items = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
@@ -268,10 +268,10 @@ function getLinesOfItem(item, allLineRects, catalog) {
|
|
|
268
268
|
// get edge lines
|
|
269
269
|
var newWidth = item.properties.get('width').get('_length');
|
|
270
270
|
var wUnit = item.properties.get('width').get('_unit') || 'cm';
|
|
271
|
-
newWidth = (0,
|
|
271
|
+
newWidth = (0, _convertUnitsLite.convert)(newWidth).from(wUnit).to('cm');
|
|
272
272
|
var newDepth = item.properties.get('depth').get('_length');
|
|
273
273
|
var hUnit = item.properties.get('depth').get('_unit') || 'cm';
|
|
274
|
-
newDepth = (0,
|
|
274
|
+
newDepth = (0, _convertUnitsLite.convert)(newDepth).from(hUnit).to('cm');
|
|
275
275
|
if (item) {
|
|
276
276
|
// Get Outline Data of Selected Item
|
|
277
277
|
outline = element.info.outline;
|
|
@@ -371,12 +371,12 @@ function mergeOverlappedLines(line1, line2) {
|
|
|
371
371
|
}
|
|
372
372
|
}
|
|
373
373
|
|
|
374
|
-
/**
|
|
375
|
-
* Get the contour line array of moldingGroup items
|
|
376
|
-
* @param {*} moldingGroup
|
|
377
|
-
* @param {*} layer
|
|
378
|
-
* @param {*} catalog
|
|
379
|
-
* @returns contour line array of moldingGroup items
|
|
374
|
+
/**
|
|
375
|
+
* Get the contour line array of moldingGroup items
|
|
376
|
+
* @param {*} moldingGroup
|
|
377
|
+
* @param {*} layer
|
|
378
|
+
* @param {*} catalog
|
|
379
|
+
* @returns contour line array of moldingGroup items
|
|
380
380
|
*/
|
|
381
381
|
function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
382
382
|
// wall lines
|
|
@@ -393,10 +393,10 @@ function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
|
393
393
|
var itemLines = getLinesOfItem(item, allLineRects, catalog);
|
|
394
394
|
var itemAltitude = item.properties.get('altitude').get('_length');
|
|
395
395
|
var itemAltitudeUnit = item.properties.get('altitude').get('_unit');
|
|
396
|
-
itemAltitude = (0,
|
|
396
|
+
itemAltitude = (0, _convertUnitsLite.convert)(itemAltitude).from(itemAltitudeUnit).to('cm');
|
|
397
397
|
var itemHeight = item.properties.get('height').get('_length');
|
|
398
398
|
var itemHeightUnit = item.properties.get('height').get('_unit');
|
|
399
|
-
itemHeight = (0,
|
|
399
|
+
itemHeight = (0, _convertUnitsLite.convert)(itemHeight).from(itemHeightUnit).to('cm');
|
|
400
400
|
itemLines.forEach(function (line) {
|
|
401
401
|
line.push({
|
|
402
402
|
altitude: itemAltitude,
|
|
@@ -412,10 +412,10 @@ function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
|
412
412
|
items.forEach(function (item) {
|
|
413
413
|
var itemAltitude = item.properties.get('altitude').get('_length');
|
|
414
414
|
var itemAltitudeUnit = item.properties.get('altitude').get('_unit');
|
|
415
|
-
itemAltitude = (0,
|
|
415
|
+
itemAltitude = (0, _convertUnitsLite.convert)(itemAltitude).from(itemAltitudeUnit).to('cm');
|
|
416
416
|
var itemHeight = item.properties.get('height').get('_length');
|
|
417
417
|
var itemHeightUnit = item.properties.get('height').get('_unit');
|
|
418
|
-
itemHeight = (0,
|
|
418
|
+
itemHeight = (0, _convertUnitsLite.convert)(itemHeight).from(itemHeightUnit).to('cm');
|
|
419
419
|
var itemLines = getLinesOfItem(item, allLineRects, catalog);
|
|
420
420
|
|
|
421
421
|
// remove the edge that overlapped with other snapped items
|
|
@@ -531,13 +531,13 @@ function getLinesFromItems2(moldingGroup, layer, catalog) {
|
|
|
531
531
|
return newMGlines;
|
|
532
532
|
}
|
|
533
533
|
|
|
534
|
-
/**
|
|
535
|
-
* Get the line that colinear linked with [line], and merge them to a new line
|
|
536
|
-
* @param {*} line
|
|
537
|
-
* @param {*} MGlines
|
|
538
|
-
* @returns
|
|
539
|
-
* - returns merged new line
|
|
540
|
-
* - returns filtered new line group (remove linked line from [MGlines])
|
|
534
|
+
/**
|
|
535
|
+
* Get the line that colinear linked with [line], and merge them to a new line
|
|
536
|
+
* @param {*} line
|
|
537
|
+
* @param {*} MGlines
|
|
538
|
+
* @returns
|
|
539
|
+
* - returns merged new line
|
|
540
|
+
* - returns filtered new line group (remove linked line from [MGlines])
|
|
541
541
|
*/
|
|
542
542
|
function getMergedLine(line, MGlines, cnt) {
|
|
543
543
|
try {
|
|
@@ -590,11 +590,11 @@ function getMergedLine(line, MGlines, cnt) {
|
|
|
590
590
|
}
|
|
591
591
|
}
|
|
592
592
|
|
|
593
|
-
/**
|
|
594
|
-
* Get the contour line segments from [lineSegs]
|
|
595
|
-
* @param {*} lineSegs
|
|
596
|
-
* @param {*} otherLines
|
|
597
|
-
* @returns
|
|
593
|
+
/**
|
|
594
|
+
* Get the contour line segments from [lineSegs]
|
|
595
|
+
* @param {*} lineSegs
|
|
596
|
+
* @param {*} otherLines
|
|
597
|
+
* @returns
|
|
598
598
|
*/
|
|
599
599
|
function getTrimmedContourLineSegs(lineSegs, otherLines, cnt) {
|
|
600
600
|
try {
|
|
@@ -692,16 +692,16 @@ function getLinesFromItems(moldingGroup, layer, catalog) {
|
|
|
692
692
|
snapped_other_items.forEach(function (item) {
|
|
693
693
|
var itemAltitude = item.properties.get('altitude').get('_length');
|
|
694
694
|
var itemAltitudeUnit = item.properties.get('altitude').get('_unit');
|
|
695
|
-
itemAltitude = (0,
|
|
695
|
+
itemAltitude = (0, _convertUnitsLite.convert)(itemAltitude).from(itemAltitudeUnit).to('cm');
|
|
696
696
|
var itemHeight = item.properties.get('height').get('_length');
|
|
697
697
|
var itemHeightUnit = item.properties.get('height').get('_unit');
|
|
698
|
-
itemHeight = (0,
|
|
698
|
+
itemHeight = (0, _convertUnitsLite.convert)(itemHeight).from(itemHeightUnit).to('cm');
|
|
699
699
|
var mgroupAltitude = items[0].properties.get('altitude').get('_length');
|
|
700
700
|
var mgroupAltitudeUnit = items[0].properties.get('altitude').get('_unit');
|
|
701
|
-
mgroupAltitude = (0,
|
|
701
|
+
mgroupAltitude = (0, _convertUnitsLite.convert)(mgroupAltitude).from(mgroupAltitudeUnit).to('cm');
|
|
702
702
|
var mgroupHeight = items[0].properties.get('height').get('_length');
|
|
703
703
|
var mgroupHeightUnit = items[0].properties.get('height').get('_unit');
|
|
704
|
-
mgroupHeight = (0,
|
|
704
|
+
mgroupHeight = (0, _convertUnitsLite.convert)(mgroupHeight).from(mgroupHeightUnit).to('cm');
|
|
705
705
|
var flag = false;
|
|
706
706
|
switch (moldingGroup.location_type) {
|
|
707
707
|
case _constants.TOP_MOLDING_LOCATION:
|
|
@@ -860,10 +860,10 @@ function getMDPoints(newMD) {
|
|
|
860
860
|
}
|
|
861
861
|
var z = newMD.items[0].properties.get('altitude').get('_length');
|
|
862
862
|
var zUnit = newMD.items[0].properties.get('altitude').get('_unit') || 'cm';
|
|
863
|
-
z = (0,
|
|
863
|
+
z = (0, _convertUnitsLite.convert)(z).from(zUnit).to('cm');
|
|
864
864
|
var height = newMD.items[0].properties.get('height').get('_length');
|
|
865
865
|
var heightUnit = newMD.items[0].properties.get('height').get('_unit') || 'cm';
|
|
866
|
-
height = (0,
|
|
866
|
+
height = (0, _convertUnitsLite.convert)(height).from(heightUnit).to('cm');
|
|
867
867
|
switch (newMD.location_type) {
|
|
868
868
|
case _constants.TOP_MOLDING_LOCATION:
|
|
869
869
|
z += height;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kitchen-simulator",
|
|
3
|
-
"version": "1.1.1-test.
|
|
4
|
-
"description": "It is a kitchen simulator.",
|
|
3
|
+
"version": "1.1.1-test.60",
|
|
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",
|
|
@@ -11,16 +11,9 @@
|
|
|
11
11
|
"require": "./lib/index.js"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
-
"files": [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"README.md",
|
|
18
|
-
"LICENSE"
|
|
19
|
-
],
|
|
20
|
-
"sideEffects": [
|
|
21
|
-
"*.css",
|
|
22
|
-
"*.scss"
|
|
23
|
-
],
|
|
14
|
+
"files": ["lib", "es", "README.md", "LICENSE"],
|
|
15
|
+
"sideEffects": ["*.css", "*.scss"],
|
|
16
|
+
|
|
24
17
|
"scripts": {
|
|
25
18
|
"start": "webpack-dev-server --config demo/webpack.config.js --port 9000 --mode development",
|
|
26
19
|
"start9010": "webpack-dev-server --config demo/webpack.config.js --port 9010 --mode development",
|
|
@@ -31,9 +24,10 @@
|
|
|
31
24
|
"clean": "rimraf lib es",
|
|
32
25
|
"update-version-file": "const-version ./package.json ./src/version.js",
|
|
33
26
|
"version": "npm run update-version-file && npm run build",
|
|
34
|
-
"prepublishOnly": "npm run build",
|
|
27
|
+
"prepublishOnly": "cross-env NODE_ENV=production npm run build",
|
|
35
28
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
36
29
|
},
|
|
30
|
+
|
|
37
31
|
"repository": {
|
|
38
32
|
"type": "git",
|
|
39
33
|
"url": "git+https://github.com/orgs/4DPixel/teams/kitchen-simulator.git"
|
|
@@ -57,84 +51,54 @@
|
|
|
57
51
|
"component",
|
|
58
52
|
"redux"
|
|
59
53
|
],
|
|
60
|
-
|
|
61
|
-
"react": ">=16.9 <19",
|
|
62
|
-
"react-dom": ">=16.9 <19"
|
|
63
|
-
},
|
|
54
|
+
|
|
64
55
|
"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
56
|
"@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
57
|
"axios": "^0.20.0",
|
|
75
58
|
"browserify-zlib": "^0.2.0",
|
|
76
|
-
"buffer": "^6.0.3",
|
|
77
59
|
"camera-controls": "^2.8.5",
|
|
78
|
-
"convert-units": "2.3.4",
|
|
79
60
|
"dotenv": "^16.4.7",
|
|
80
61
|
"history": "4.10.1",
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"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",
|
|
62
|
+
"localstorage-slim": "^1.3.0",
|
|
63
|
+
"nanoid": "^5.1.6",
|
|
90
64
|
"path-browserify": "^1.0.1",
|
|
91
|
-
"polylabel": "1.0.2",
|
|
92
65
|
"posthog-js": "^1.271.0",
|
|
93
|
-
"
|
|
94
|
-
"react-
|
|
95
|
-
"react-ga4": "^1.4.1",
|
|
96
|
-
"react-hotjar": "^1.0.11",
|
|
97
|
-
"react-icons": "3.5.0",
|
|
98
|
-
"react-player": "2.8.0",
|
|
99
|
-
"react-query": "^3.39.3",
|
|
100
|
-
"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",
|
|
66
|
+
"react": "^16.9.0",
|
|
67
|
+
"react-dom": "16.9.0",
|
|
105
68
|
"redux": "4.0.1",
|
|
106
|
-
"redux
|
|
107
|
-
"
|
|
69
|
+
"react-redux": "5.0.7",
|
|
70
|
+
"react-icons": "3.5.0",
|
|
71
|
+
"react-container-dimensions": "1.4.1",
|
|
72
|
+
"react-svg-pan-zoom": "^3.13.1",
|
|
108
73
|
"stream-browserify": "^3.0.0",
|
|
109
|
-
"
|
|
110
|
-
"
|
|
74
|
+
"three": "0.166.0",
|
|
75
|
+
"hoist-non-react-statics": "2.5.5",
|
|
76
|
+
"immutable": "3.8.2",
|
|
77
|
+
"immutablediff": "0.4.4",
|
|
78
|
+
"immutablepatch": "0.5.0",
|
|
79
|
+
"invariant": "^2.0.0",
|
|
80
|
+
"polylabel": "1.0.2",
|
|
81
|
+
"prop-types": "^15.8.1"
|
|
111
82
|
},
|
|
83
|
+
|
|
112
84
|
"devDependencies": {
|
|
113
|
-
"@babel/cli": "^7.
|
|
114
|
-
"@babel/core": "^7.
|
|
115
|
-
"@babel/preset-env": "^7.
|
|
116
|
-
"@babel/preset-react": "^7.
|
|
85
|
+
"@babel/cli": "^7.28.3",
|
|
86
|
+
"@babel/core": "^7.28.4",
|
|
87
|
+
"@babel/preset-env": "^7.28.3",
|
|
88
|
+
"@babel/preset-react": "^7.27.1",
|
|
117
89
|
"@sentry/webpack-plugin": "^3.2.4",
|
|
118
90
|
"babel-loader": "^9.1.3",
|
|
119
91
|
"babel-plugin-import-glob": "^2.0.0",
|
|
120
92
|
"babel-plugin-module-resolver": "^5.0.2",
|
|
121
93
|
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
|
94
|
+
"babel-plugin-transform-rename-import": "^2.3.0",
|
|
122
95
|
"const-version": "2.0.0",
|
|
123
|
-
"cross-env": "5.2.0",
|
|
124
|
-
"css-loader": "
|
|
96
|
+
"cross-env": "^5.2.0",
|
|
97
|
+
"css-loader": "*",
|
|
125
98
|
"file-loader": "6.2.0",
|
|
126
|
-
"gh-pages": "2.0.1",
|
|
127
99
|
"html-webpack-plugin": "5.6.0",
|
|
128
|
-
"
|
|
129
|
-
"
|
|
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",
|
|
100
|
+
"rimraf": "^2.6.3",
|
|
101
|
+
"style-loader": "*",
|
|
138
102
|
"webpack": "5.92.1",
|
|
139
103
|
"webpack-cli": "5.1.4",
|
|
140
104
|
"webpack-dev-server": "5.0.4"
|
package/es/analytics/ga4.js
DELETED
|
@@ -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
|
-
};
|
package/es/analytics/posthog.js
DELETED
|
@@ -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
|
-
};
|