@lv-x-software-house/x_view 1.2.8-dev.4 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +553 -423
- package/dist/index.mjs +591 -461
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -322,7 +322,12 @@ var updateExistingNodeVisuals = (state, updatedNode) => {
|
|
|
322
322
|
if (oldLabelObject.material) oldLabelObject.material.dispose();
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
|
-
const newMesh = createNodeMesh(
|
|
325
|
+
const newMesh = createNodeMesh(
|
|
326
|
+
updatedNode,
|
|
327
|
+
position,
|
|
328
|
+
state.glowTexture,
|
|
329
|
+
hadQuestDateLabel
|
|
330
|
+
);
|
|
326
331
|
if (oldTimelineBar) {
|
|
327
332
|
newMesh.userData.timelineIntervalBar = oldTimelineBar;
|
|
328
333
|
}
|
|
@@ -874,7 +879,12 @@ var removeNodeFromScene = (state, nodeId) => {
|
|
|
874
879
|
var addStandaloneNodeToScene = (state, nodeData, position, forceShowQuestDate = false) => {
|
|
875
880
|
const { graphGroup, nodeObjects, clickableNodes, glowTexture } = state;
|
|
876
881
|
if (!graphGroup) return;
|
|
877
|
-
const mesh = createNodeMesh(
|
|
882
|
+
const mesh = createNodeMesh(
|
|
883
|
+
nodeData,
|
|
884
|
+
position,
|
|
885
|
+
glowTexture,
|
|
886
|
+
forceShowQuestDate
|
|
887
|
+
);
|
|
878
888
|
mesh.scale.set(0.01, 0.01, 0.01);
|
|
879
889
|
graphGroup.add(mesh);
|
|
880
890
|
if (mesh.userData.labelObject) {
|
|
@@ -1092,7 +1102,9 @@ var userActionHandlers = {
|
|
|
1092
1102
|
if (isCrossDataset) {
|
|
1093
1103
|
graphDataRef.current[finalTargetDatasetId] = targetDataToUpdate;
|
|
1094
1104
|
}
|
|
1095
|
-
if (sceneDataRef.current.parent_dbs.some(
|
|
1105
|
+
if (sceneDataRef.current.parent_dbs.some(
|
|
1106
|
+
(db) => String(db.db_id) === String(sourceParentInfo.parentFileId)
|
|
1107
|
+
)) {
|
|
1096
1108
|
}
|
|
1097
1109
|
const finalPosition = stateRef.current.ghostElements.node.position.clone();
|
|
1098
1110
|
addNewNodeToScene(stateRef.current, newNode, newLink, finalPosition);
|
|
@@ -1287,7 +1299,10 @@ var userActionHandlers = {
|
|
|
1287
1299
|
context.sceneSaveUrl,
|
|
1288
1300
|
viewFilePayload
|
|
1289
1301
|
);
|
|
1290
|
-
const questSaveUrl = context.sceneSaveUrl.replace(
|
|
1302
|
+
const questSaveUrl = context.sceneSaveUrl.replace(
|
|
1303
|
+
"x_view_scenes",
|
|
1304
|
+
"x_view_quests"
|
|
1305
|
+
);
|
|
1291
1306
|
await context.actions.save_view_data(questSaveUrl, questFilePayload);
|
|
1292
1307
|
} else {
|
|
1293
1308
|
const filenameForSpecificParent = `x_view_dbs/${ownerId}/${parentFileId}`;
|
|
@@ -1363,7 +1378,12 @@ var userActionHandlers = {
|
|
|
1363
1378
|
)
|
|
1364
1379
|
);
|
|
1365
1380
|
targetFinalPositions.push(endPosition);
|
|
1366
|
-
const targetMesh = createNodeMesh(
|
|
1381
|
+
const targetMesh = createNodeMesh(
|
|
1382
|
+
nodeData,
|
|
1383
|
+
startPosition,
|
|
1384
|
+
glowTexture,
|
|
1385
|
+
!!nodeData.is_quest
|
|
1386
|
+
);
|
|
1367
1387
|
targetMesh.scale.set(0.01, 0.01, 0.01);
|
|
1368
1388
|
graphGroup.add(targetMesh);
|
|
1369
1389
|
if (targetMesh.userData.labelObject) {
|
|
@@ -1515,10 +1535,16 @@ var userActionHandlers = {
|
|
|
1515
1535
|
context.sceneConfigId,
|
|
1516
1536
|
context.ownerId
|
|
1517
1537
|
);
|
|
1518
|
-
|
|
1538
|
+
const targetParentInfo = getParentFileInfoForNode(
|
|
1539
|
+
graphDataRef.current,
|
|
1540
|
+
sceneDataRef.current,
|
|
1541
|
+
targetNodeData.id,
|
|
1542
|
+
context.sceneConfigId,
|
|
1543
|
+
context.ownerId
|
|
1544
|
+
);
|
|
1545
|
+
if (!sourceParentInfo || !sourceParentInfo.ownerId || !targetParentInfo) {
|
|
1519
1546
|
console.error(
|
|
1520
|
-
"N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para
|
|
1521
|
-
sourceNodeData.id
|
|
1547
|
+
"N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para os Nodes da conex\xE3o."
|
|
1522
1548
|
);
|
|
1523
1549
|
alert(
|
|
1524
1550
|
"Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio."
|
|
@@ -1526,9 +1552,13 @@ var userActionHandlers = {
|
|
|
1526
1552
|
userActionHandlers.handleCancelConnection(context);
|
|
1527
1553
|
return;
|
|
1528
1554
|
}
|
|
1529
|
-
|
|
1530
|
-
const
|
|
1531
|
-
const
|
|
1555
|
+
let parentInfoToSave = sourceParentInfo;
|
|
1556
|
+
const isSourceQuest = sourceParentInfo.parentFileId === context.sceneConfigId;
|
|
1557
|
+
const isTargetQuest = targetParentInfo.parentFileId === context.sceneConfigId;
|
|
1558
|
+
if (isSourceQuest || isTargetQuest) {
|
|
1559
|
+
parentInfoToSave = { parentFileId: context.sceneConfigId, ownerId: context.ownerId };
|
|
1560
|
+
}
|
|
1561
|
+
const { parentFileId: parentFileIdToSave, ownerId: ownerIdToSave } = parentInfoToSave;
|
|
1532
1562
|
const newLink = {
|
|
1533
1563
|
id: `link_${import_short_uuid.default.generate()}`,
|
|
1534
1564
|
source: sourceNodeData.id,
|
|
@@ -1542,14 +1572,19 @@ var userActionHandlers = {
|
|
|
1542
1572
|
const viewFilePayload = {
|
|
1543
1573
|
parent_dbs: sceneDataRef.current.parent_dbs,
|
|
1544
1574
|
nodes: sceneDataRef.current.nodes,
|
|
1545
|
-
links: sceneDataRef.current.links
|
|
1546
|
-
quest_counter: sceneDataRef.current.quest_counter || 1
|
|
1575
|
+
links: sceneDataRef.current.links
|
|
1547
1576
|
};
|
|
1548
1577
|
await context.actions.save_view_data(
|
|
1549
1578
|
context.sceneSaveUrl,
|
|
1550
1579
|
viewFilePayload
|
|
1551
1580
|
);
|
|
1552
|
-
|
|
1581
|
+
if (context.actions.upsert_quest_link_firestore) {
|
|
1582
|
+
await context.actions.upsert_quest_link_firestore(
|
|
1583
|
+
context.ownerId,
|
|
1584
|
+
context.sceneConfigId,
|
|
1585
|
+
newLink
|
|
1586
|
+
);
|
|
1587
|
+
}
|
|
1553
1588
|
} else {
|
|
1554
1589
|
const specificParentData = JSON.parse(
|
|
1555
1590
|
JSON.stringify(graphDataRef.current[parentFileIdToSave])
|
|
@@ -1698,18 +1733,12 @@ var userActionHandlers = {
|
|
|
1698
1733
|
const viewFilePayload = {
|
|
1699
1734
|
parent_dbs: sceneDataRef.current.parent_dbs,
|
|
1700
1735
|
nodes: sceneDataRef.current.nodes,
|
|
1701
|
-
links: sceneDataRef.current.links
|
|
1702
|
-
quest_counter: sceneDataRef.current.quest_counter || 1
|
|
1703
|
-
};
|
|
1704
|
-
const questFilePayload = {
|
|
1705
|
-
nodes: data.nodes,
|
|
1706
|
-
links: data.links,
|
|
1707
|
-
milestones: sceneDataRef.current.milestones || []
|
|
1736
|
+
links: sceneDataRef.current.links
|
|
1708
1737
|
};
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1738
|
+
return context.actions.save_view_data(
|
|
1739
|
+
context.sceneSaveUrl,
|
|
1740
|
+
viewFilePayload
|
|
1741
|
+
);
|
|
1713
1742
|
} else {
|
|
1714
1743
|
return context.actions.save_view_data(
|
|
1715
1744
|
`x_view_dbs/${fileOwnerId}/${fileId}`,
|
|
@@ -1734,6 +1763,15 @@ var userActionHandlers = {
|
|
|
1734
1763
|
updatedOriginalParentData
|
|
1735
1764
|
)
|
|
1736
1765
|
);
|
|
1766
|
+
if (oldGoverningFileId === context.sceneConfigId && context.actions.delete_quest_link_firestore) {
|
|
1767
|
+
savePromises.push(
|
|
1768
|
+
context.actions.delete_quest_link_firestore(
|
|
1769
|
+
context.ownerId,
|
|
1770
|
+
context.sceneConfigId,
|
|
1771
|
+
linkId
|
|
1772
|
+
)
|
|
1773
|
+
);
|
|
1774
|
+
}
|
|
1737
1775
|
const updatedNewParentData = JSON.parse(
|
|
1738
1776
|
JSON.stringify(graphDataRef.current[newGoverningFileId])
|
|
1739
1777
|
);
|
|
@@ -1747,6 +1785,15 @@ var userActionHandlers = {
|
|
|
1747
1785
|
updatedNewParentData
|
|
1748
1786
|
)
|
|
1749
1787
|
);
|
|
1788
|
+
if (newGoverningFileId === context.sceneConfigId && context.actions.upsert_quest_link_firestore) {
|
|
1789
|
+
savePromises.push(
|
|
1790
|
+
context.actions.upsert_quest_link_firestore(
|
|
1791
|
+
context.ownerId,
|
|
1792
|
+
context.sceneConfigId,
|
|
1793
|
+
newLinkData
|
|
1794
|
+
)
|
|
1795
|
+
);
|
|
1796
|
+
}
|
|
1750
1797
|
} else {
|
|
1751
1798
|
const updatedParentData = JSON.parse(
|
|
1752
1799
|
JSON.stringify(graphDataRef.current[oldGoverningFileId])
|
|
@@ -1763,6 +1810,15 @@ var userActionHandlers = {
|
|
|
1763
1810
|
updatedParentData
|
|
1764
1811
|
)
|
|
1765
1812
|
);
|
|
1813
|
+
if (oldGoverningFileId === context.sceneConfigId && context.actions.upsert_quest_link_firestore) {
|
|
1814
|
+
savePromises.push(
|
|
1815
|
+
context.actions.upsert_quest_link_firestore(
|
|
1816
|
+
context.ownerId,
|
|
1817
|
+
context.sceneConfigId,
|
|
1818
|
+
newLinkData
|
|
1819
|
+
)
|
|
1820
|
+
);
|
|
1821
|
+
}
|
|
1766
1822
|
}
|
|
1767
1823
|
try {
|
|
1768
1824
|
await Promise.all(savePromises);
|
|
@@ -1793,14 +1849,21 @@ var userActionHandlers = {
|
|
|
1793
1849
|
);
|
|
1794
1850
|
return;
|
|
1795
1851
|
}
|
|
1796
|
-
const
|
|
1852
|
+
const sourceParentInfo = getParentFileInfoForNode(
|
|
1797
1853
|
graphDataRef.current,
|
|
1798
1854
|
sceneDataRef.current,
|
|
1799
1855
|
linkObject.userData.source,
|
|
1800
1856
|
context.sceneConfigId,
|
|
1801
1857
|
context.ownerId
|
|
1802
1858
|
);
|
|
1803
|
-
|
|
1859
|
+
const targetParentInfo = getParentFileInfoForNode(
|
|
1860
|
+
graphDataRef.current,
|
|
1861
|
+
sceneDataRef.current,
|
|
1862
|
+
linkObject.userData.target,
|
|
1863
|
+
context.sceneConfigId,
|
|
1864
|
+
context.ownerId
|
|
1865
|
+
);
|
|
1866
|
+
if (!sourceParentInfo || !sourceParentInfo.ownerId) {
|
|
1804
1867
|
console.error(
|
|
1805
1868
|
"N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o link:",
|
|
1806
1869
|
linkIdToDelete
|
|
@@ -1810,6 +1873,12 @@ var userActionHandlers = {
|
|
|
1810
1873
|
);
|
|
1811
1874
|
return;
|
|
1812
1875
|
}
|
|
1876
|
+
let parentInfo = sourceParentInfo;
|
|
1877
|
+
const isSourceQuest = sourceParentInfo.parentFileId === context.sceneConfigId;
|
|
1878
|
+
const isTargetQuest = (targetParentInfo == null ? void 0 : targetParentInfo.parentFileId) === context.sceneConfigId;
|
|
1879
|
+
if (isSourceQuest || isTargetQuest) {
|
|
1880
|
+
parentInfo = { parentFileId: context.sceneConfigId, ownerId: context.ownerId };
|
|
1881
|
+
}
|
|
1813
1882
|
const { parentFileId, ownerId } = parentInfo;
|
|
1814
1883
|
const srcName = ((_c = (_b = (_a = linkObject.userData) == null ? void 0 : _a.sourceNode) == null ? void 0 : _b.userData) == null ? void 0 : _c.name) ?? linkObject.userData.source;
|
|
1815
1884
|
const tgtName = ((_f = (_e = (_d = linkObject.userData) == null ? void 0 : _d.targetNode) == null ? void 0 : _e.userData) == null ? void 0 : _f.name) ?? linkObject.userData.target;
|
|
@@ -1822,8 +1891,6 @@ var userActionHandlers = {
|
|
|
1822
1891
|
specificParentData.links = newLinks;
|
|
1823
1892
|
let filenameToSave;
|
|
1824
1893
|
let payloadToSave;
|
|
1825
|
-
let questSaveUrl;
|
|
1826
|
-
let questFilePayload;
|
|
1827
1894
|
const isView = ((_g = context.viewType) == null ? void 0 : _g.toLowerCase()) === "view";
|
|
1828
1895
|
if (isView && parentFileId === context.sceneConfigId) {
|
|
1829
1896
|
filenameToSave = context.sceneSaveUrl;
|
|
@@ -1833,8 +1900,7 @@ var userActionHandlers = {
|
|
|
1833
1900
|
payloadToSave = {
|
|
1834
1901
|
parent_dbs: sceneDataRef.current.parent_dbs,
|
|
1835
1902
|
nodes: sceneDataRef.current.nodes,
|
|
1836
|
-
links: sceneDataRef.current.links
|
|
1837
|
-
quest_counter: sceneDataRef.current.quest_counter || 1
|
|
1903
|
+
links: sceneDataRef.current.links
|
|
1838
1904
|
};
|
|
1839
1905
|
} else {
|
|
1840
1906
|
filenameToSave = `x_view_dbs/${ownerId}/${parentFileId}`;
|
|
@@ -1842,8 +1908,12 @@ var userActionHandlers = {
|
|
|
1842
1908
|
}
|
|
1843
1909
|
try {
|
|
1844
1910
|
await context.actions.save_view_data(filenameToSave, payloadToSave);
|
|
1845
|
-
if (isView && parentFileId === context.sceneConfigId && context.actions.
|
|
1846
|
-
await context.actions.
|
|
1911
|
+
if (isView && parentFileId === context.sceneConfigId && context.actions.delete_quest_link_firestore) {
|
|
1912
|
+
await context.actions.delete_quest_link_firestore(
|
|
1913
|
+
context.ownerId,
|
|
1914
|
+
context.sceneConfigId,
|
|
1915
|
+
linkIdToDelete
|
|
1916
|
+
);
|
|
1847
1917
|
}
|
|
1848
1918
|
graphDataRef.current[parentFileId] = specificParentData;
|
|
1849
1919
|
setters.setDetailsLink(
|
|
@@ -2072,18 +2142,30 @@ var userActionHandlers = {
|
|
|
2072
2142
|
payloadToSave = {
|
|
2073
2143
|
parent_dbs: sceneDataRef.current.parent_dbs,
|
|
2074
2144
|
nodes: sceneDataRef.current.nodes,
|
|
2075
|
-
links: sceneDataRef.current.links
|
|
2076
|
-
quest_counter: sceneDataRef.current.quest_counter || 1
|
|
2145
|
+
links: sceneDataRef.current.links
|
|
2077
2146
|
};
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2147
|
+
if (context.actions.delete_quest_firestore) {
|
|
2148
|
+
nodesToDelete.forEach((nodeIdToDelete) => {
|
|
2149
|
+
savePromises.push(
|
|
2150
|
+
context.actions.delete_quest_firestore(
|
|
2151
|
+
context.ownerId,
|
|
2152
|
+
context.sceneConfigId,
|
|
2153
|
+
nodeIdToDelete
|
|
2154
|
+
)
|
|
2155
|
+
);
|
|
2156
|
+
});
|
|
2157
|
+
if (context.actions.delete_quest_link_firestore) {
|
|
2158
|
+
linksToDelete.forEach((linkIdToDelete) => {
|
|
2159
|
+
savePromises.push(
|
|
2160
|
+
context.actions.delete_quest_link_firestore(
|
|
2161
|
+
context.ownerId,
|
|
2162
|
+
context.sceneConfigId,
|
|
2163
|
+
linkIdToDelete
|
|
2164
|
+
)
|
|
2165
|
+
);
|
|
2166
|
+
});
|
|
2082
2167
|
}
|
|
2083
2168
|
}
|
|
2084
|
-
for (const linkId of linksToDelete) {
|
|
2085
|
-
await context.actions.delete_quest_link(ownerId, context.sceneConfigId, linkId);
|
|
2086
|
-
}
|
|
2087
2169
|
} else {
|
|
2088
2170
|
filenameToSave = `x_view_dbs/${ownerId}/${parentFileId}`;
|
|
2089
2171
|
payloadToSave = originalData;
|
|
@@ -2154,6 +2236,9 @@ var userActionHandlers = {
|
|
|
2154
2236
|
const newLinks = (specificParentData.links || []).filter(
|
|
2155
2237
|
(l) => String(l.source) !== strNodeId && String(l.target) !== strNodeId
|
|
2156
2238
|
);
|
|
2239
|
+
const linksToDelete = (specificParentData.links || []).filter(
|
|
2240
|
+
(l) => String(l.source) === strNodeId || String(l.target) === strNodeId
|
|
2241
|
+
);
|
|
2157
2242
|
specificParentData.nodes = newNodes;
|
|
2158
2243
|
specificParentData.links = newLinks;
|
|
2159
2244
|
let filenameToSave;
|
|
@@ -2172,12 +2257,27 @@ var userActionHandlers = {
|
|
|
2172
2257
|
payloadToSave = {
|
|
2173
2258
|
parent_dbs: sceneDataRef.current.parent_dbs,
|
|
2174
2259
|
nodes: newVisualNodes,
|
|
2175
|
-
links: newVisualLinks
|
|
2176
|
-
quest_counter: sceneDataRef.current.quest_counter || 1
|
|
2260
|
+
links: newVisualLinks
|
|
2177
2261
|
};
|
|
2178
2262
|
try {
|
|
2179
2263
|
await context.actions.save_view_data(filenameToSave, payloadToSave);
|
|
2180
|
-
|
|
2264
|
+
if (context.actions.delete_quest_firestore) {
|
|
2265
|
+
await context.actions.delete_quest_firestore(
|
|
2266
|
+
context.ownerId,
|
|
2267
|
+
context.sceneConfigId,
|
|
2268
|
+
nodeIdToDelete
|
|
2269
|
+
);
|
|
2270
|
+
if (context.actions.delete_quest_link_firestore && linksToDelete.length > 0) {
|
|
2271
|
+
const linkDeletePromises = linksToDelete.map(
|
|
2272
|
+
(link) => context.actions.delete_quest_link_firestore(
|
|
2273
|
+
context.ownerId,
|
|
2274
|
+
context.sceneConfigId,
|
|
2275
|
+
link.id
|
|
2276
|
+
)
|
|
2277
|
+
);
|
|
2278
|
+
await Promise.all(linkDeletePromises);
|
|
2279
|
+
}
|
|
2280
|
+
}
|
|
2181
2281
|
graphDataRef.current[parentFileId] = specificParentData;
|
|
2182
2282
|
setters.setDetailsNode(
|
|
2183
2283
|
(prev) => String(prev == null ? void 0 : prev.id) === String(nodeIdToDelete) ? null : prev
|
|
@@ -2207,9 +2307,10 @@ var userActionHandlers = {
|
|
|
2207
2307
|
}
|
|
2208
2308
|
},
|
|
2209
2309
|
handleSaveNodeDetails: async (context, updatedNode, keepOpen = false) => {
|
|
2210
|
-
var _a, _b, _c;
|
|
2310
|
+
var _a, _b, _c, _d;
|
|
2211
2311
|
const { graphDataRef, sceneDataRef, stateRef, setters } = context;
|
|
2212
2312
|
if (!graphDataRef.current || !sceneDataRef.current) return;
|
|
2313
|
+
const isView = ((_a = context.viewType) == null ? void 0 : _a.toLowerCase()) === "view";
|
|
2213
2314
|
const {
|
|
2214
2315
|
_baseEmissiveIntensity,
|
|
2215
2316
|
_baseScale,
|
|
@@ -2254,7 +2355,7 @@ var userActionHandlers = {
|
|
|
2254
2355
|
const oldNode = specificParentData.nodes[nodeIndex];
|
|
2255
2356
|
const isNewDone = oldNode.status !== "Done" && nodeToSave.status === "Done";
|
|
2256
2357
|
specificParentData.nodes[nodeIndex] = { ...nodeToSave };
|
|
2257
|
-
if (isNewDone && nodeToSave.is_quest && ((
|
|
2358
|
+
if (isNewDone && nodeToSave.is_quest && ((_b = nodeToSave.recurrence_config) == null ? void 0 : _b.enabled)) {
|
|
2258
2359
|
const nextDateObj = calculateNextRecurrenceDate(
|
|
2259
2360
|
nodeToSave.recurrence_config
|
|
2260
2361
|
);
|
|
@@ -2279,12 +2380,10 @@ var userActionHandlers = {
|
|
|
2279
2380
|
}
|
|
2280
2381
|
const nextQuestNode = {
|
|
2281
2382
|
...JSON.parse(JSON.stringify(nodeToSave)),
|
|
2282
|
-
// Deep copy properties
|
|
2283
2383
|
id: import_short_uuid.default.generate(),
|
|
2284
2384
|
name: nextName,
|
|
2285
2385
|
status: "Backlog",
|
|
2286
2386
|
color: "#64748b",
|
|
2287
|
-
// QUEST_STATUS_COLORS["Backlog"]
|
|
2288
2387
|
assignee_id: nodeToSave.recurrence_config.next_assignee_id || "",
|
|
2289
2388
|
Date: nextDateObj,
|
|
2290
2389
|
timeline: [
|
|
@@ -2301,7 +2400,7 @@ var userActionHandlers = {
|
|
|
2301
2400
|
],
|
|
2302
2401
|
version_node: {
|
|
2303
2402
|
is_version: true,
|
|
2304
|
-
parent_node: ((
|
|
2403
|
+
parent_node: ((_c = nodeToSave.version_node) == null ? void 0 : _c.parent_node) || nodeToSave.id
|
|
2305
2404
|
},
|
|
2306
2405
|
reviewStack: (nodeToSave.reviewStack || []).map((r) => ({
|
|
2307
2406
|
...r,
|
|
@@ -2309,21 +2408,56 @@ var userActionHandlers = {
|
|
|
2309
2408
|
})),
|
|
2310
2409
|
recurrence_config: nextRecurrenceConfig
|
|
2311
2410
|
};
|
|
2312
|
-
|
|
2411
|
+
const rootId = ((_d = nodeToSave.version_node) == null ? void 0 : _d.parent_node) || nodeToSave.id;
|
|
2412
|
+
const nextQuestLink = {
|
|
2413
|
+
id: `link_${import_short_uuid.default.generate()}`,
|
|
2414
|
+
source: rootId,
|
|
2415
|
+
target: nextQuestNode.id
|
|
2416
|
+
};
|
|
2417
|
+
await context.actions.upsert_quest_firestore(
|
|
2418
|
+
context.ownerId,
|
|
2419
|
+
context.sceneConfigId,
|
|
2420
|
+
nextQuestNode
|
|
2421
|
+
);
|
|
2422
|
+
await context.actions.upsert_quest_link_firestore(
|
|
2423
|
+
context.ownerId,
|
|
2424
|
+
context.sceneConfigId,
|
|
2425
|
+
nextQuestLink
|
|
2426
|
+
);
|
|
2427
|
+
await context.actions.update_view_counter(
|
|
2428
|
+
context.ownerId,
|
|
2429
|
+
context.sceneConfigId,
|
|
2430
|
+
nextCounter
|
|
2431
|
+
);
|
|
2432
|
+
if (specificParentData.links) {
|
|
2433
|
+
specificParentData.links.push(nextQuestLink);
|
|
2434
|
+
}
|
|
2435
|
+
if (specificParentData.nodes) {
|
|
2436
|
+
specificParentData.nodes.push(nextQuestNode);
|
|
2437
|
+
}
|
|
2438
|
+
if (isView && parentFileId === context.sceneConfigId) {
|
|
2439
|
+
if (!sceneDataRef.current.links) sceneDataRef.current.links = [];
|
|
2440
|
+
sceneDataRef.current.links.push(nextQuestLink);
|
|
2441
|
+
sceneDataRef.current.quest_nodes = [...specificParentData.nodes];
|
|
2442
|
+
}
|
|
2313
2443
|
if (stateRef.current.nodeObjects[String(nodeToSave.id)]) {
|
|
2314
2444
|
const oldMeshPosition = stateRef.current.nodeObjects[String(nodeToSave.id)].position.clone();
|
|
2315
2445
|
setTimeout(() => {
|
|
2316
2446
|
if (stateRef.current && stateRef.current.graphGroup) {
|
|
2317
2447
|
const pos = oldMeshPosition.clone();
|
|
2318
2448
|
pos.x += 12;
|
|
2319
|
-
addStandaloneNodeToScene(
|
|
2449
|
+
addStandaloneNodeToScene(
|
|
2450
|
+
stateRef.current,
|
|
2451
|
+
nextQuestNode,
|
|
2452
|
+
pos,
|
|
2453
|
+
true
|
|
2454
|
+
);
|
|
2320
2455
|
}
|
|
2321
2456
|
}, 2e3);
|
|
2322
2457
|
}
|
|
2323
2458
|
}
|
|
2324
2459
|
}
|
|
2325
2460
|
try {
|
|
2326
|
-
const isView = ((_c = context.viewType) == null ? void 0 : _c.toLowerCase()) === "view";
|
|
2327
2461
|
if (isView && parentFileId === context.sceneConfigId) {
|
|
2328
2462
|
const visualNodeIndex = sceneDataRef.current.nodes.findIndex(
|
|
2329
2463
|
(n) => String(n.id) === String(nodeToSave.id)
|
|
@@ -2337,14 +2471,24 @@ var userActionHandlers = {
|
|
|
2337
2471
|
const viewFilePayload = {
|
|
2338
2472
|
parent_dbs: sceneDataRef.current.parent_dbs,
|
|
2339
2473
|
nodes: sceneDataRef.current.nodes,
|
|
2340
|
-
links: sceneDataRef.current.links
|
|
2341
|
-
|
|
2474
|
+
links: sceneDataRef.current.links
|
|
2475
|
+
};
|
|
2476
|
+
const questFilePayload = {
|
|
2477
|
+
nodes: specificParentData.nodes,
|
|
2478
|
+
links: specificParentData.links,
|
|
2479
|
+
milestones: sceneDataRef.current.milestones || []
|
|
2342
2480
|
};
|
|
2343
2481
|
await context.actions.save_view_data(
|
|
2344
2482
|
context.sceneSaveUrl,
|
|
2345
2483
|
viewFilePayload
|
|
2346
2484
|
);
|
|
2347
|
-
|
|
2485
|
+
if (context.actions.upsert_quest_firestore) {
|
|
2486
|
+
await context.actions.upsert_quest_firestore(
|
|
2487
|
+
context.ownerId,
|
|
2488
|
+
context.sceneConfigId,
|
|
2489
|
+
nodeToSave
|
|
2490
|
+
);
|
|
2491
|
+
}
|
|
2348
2492
|
} else {
|
|
2349
2493
|
const filenameForSpecificParent = `x_view_dbs/${ownerId}/${parentFileId}`;
|
|
2350
2494
|
await context.actions.save_view_data(
|
|
@@ -2355,7 +2499,6 @@ var userActionHandlers = {
|
|
|
2355
2499
|
graphDataRef.current[parentFileId] = specificParentData;
|
|
2356
2500
|
if (isView && parentFileId === context.sceneConfigId) {
|
|
2357
2501
|
sceneDataRef.current.quest_nodes = [...specificParentData.nodes];
|
|
2358
|
-
sceneDataRef.current.quest_counter = specificParentData.quest_counter || sceneDataRef.current.quest_counter;
|
|
2359
2502
|
}
|
|
2360
2503
|
updateExistingNodeVisuals(stateRef.current, nodeToSave);
|
|
2361
2504
|
setters.setSceneVersion((v) => v + 1);
|
|
@@ -2412,8 +2555,7 @@ var userActionHandlers = {
|
|
|
2412
2555
|
const viewFilePayload = {
|
|
2413
2556
|
parent_dbs: sceneDataRef.current.parent_dbs,
|
|
2414
2557
|
nodes: sceneDataRef.current.nodes,
|
|
2415
|
-
links: sceneDataRef.current.links
|
|
2416
|
-
quest_counter: sceneDataRef.current.quest_counter || 1
|
|
2558
|
+
links: sceneDataRef.current.links
|
|
2417
2559
|
};
|
|
2418
2560
|
const questFilePayload = {
|
|
2419
2561
|
nodes: specificParentData.nodes,
|
|
@@ -2424,8 +2566,13 @@ var userActionHandlers = {
|
|
|
2424
2566
|
context.sceneSaveUrl,
|
|
2425
2567
|
viewFilePayload
|
|
2426
2568
|
);
|
|
2427
|
-
|
|
2428
|
-
|
|
2569
|
+
if (context.actions.upsert_quest_link_firestore) {
|
|
2570
|
+
await context.actions.upsert_quest_link_firestore(
|
|
2571
|
+
context.ownerId,
|
|
2572
|
+
context.sceneConfigId,
|
|
2573
|
+
linkToSave
|
|
2574
|
+
);
|
|
2575
|
+
}
|
|
2429
2576
|
} else {
|
|
2430
2577
|
const filenameForSpecificParent = `x_view_dbs/${ownerId}/${parentFileId}`;
|
|
2431
2578
|
await context.actions.save_view_data(
|
|
@@ -2520,7 +2667,7 @@ function createNewCustomProperty(existingProps = []) {
|
|
|
2520
2667
|
nextValue = [{ id: (0, import_uuid.v4)(), name: "1", value: "" }];
|
|
2521
2668
|
break;
|
|
2522
2669
|
case "date":
|
|
2523
|
-
nextKey = "
|
|
2670
|
+
nextKey = "Data";
|
|
2524
2671
|
nextValue = { type: "Data", value: "" };
|
|
2525
2672
|
break;
|
|
2526
2673
|
case "number":
|
|
@@ -2774,7 +2921,7 @@ var IGNORED_KEYS = [
|
|
|
2774
2921
|
];
|
|
2775
2922
|
function extractCustomPropsFromNode(node) {
|
|
2776
2923
|
const customPropTypes = node._customPropTypes || {};
|
|
2777
|
-
return Object.keys(node).filter((k) => !IGNORED_KEYS.includes(k)).map((key) => {
|
|
2924
|
+
return Object.keys(node).filter((k) => !IGNORED_KEYS.includes(k) || customPropTypes[k]).map((key) => {
|
|
2778
2925
|
const val = node[key];
|
|
2779
2926
|
const t = customPropTypes[key] || inferPropType(val);
|
|
2780
2927
|
if (t === "date") {
|
|
@@ -3290,6 +3437,17 @@ var parseDate = (str) => {
|
|
|
3290
3437
|
}
|
|
3291
3438
|
return null;
|
|
3292
3439
|
};
|
|
3440
|
+
function extractDatePropFromNode(node) {
|
|
3441
|
+
if (!node) return null;
|
|
3442
|
+
if (node.Date) return node.Date;
|
|
3443
|
+
if (node._customPropTypes) {
|
|
3444
|
+
const dateKey = Object.keys(node._customPropTypes).find(
|
|
3445
|
+
(k) => node._customPropTypes[k] === "date"
|
|
3446
|
+
);
|
|
3447
|
+
if (dateKey && node[dateKey]) return node[dateKey];
|
|
3448
|
+
}
|
|
3449
|
+
return null;
|
|
3450
|
+
}
|
|
3293
3451
|
var parseDateProp = (dateProp) => {
|
|
3294
3452
|
let info = { isUndated: true, label: "", type: "point" };
|
|
3295
3453
|
if (!dateProp) return info;
|
|
@@ -4963,7 +5121,7 @@ function CustomPropertyDisplay({
|
|
|
4963
5121
|
links: "Links",
|
|
4964
5122
|
images: "Images",
|
|
4965
5123
|
documents: "Documents",
|
|
4966
|
-
date: "
|
|
5124
|
+
date: "Data"
|
|
4967
5125
|
};
|
|
4968
5126
|
const oldKeyIsFixed = Object.values(fixedKeyMap).includes(tempProp.key);
|
|
4969
5127
|
if (fixedKeyMap[value]) {
|
|
@@ -8908,6 +9066,7 @@ function CreateQuestTreePanel({
|
|
|
8908
9066
|
const [isSaving, setIsSaving] = (0, import_react12.useState)(false);
|
|
8909
9067
|
const [hasUnsavedChanges, setHasUnsavedChanges] = (0, import_react12.useState)(false);
|
|
8910
9068
|
const [activeTab, setActiveTab] = (0, import_react12.useState)("tree");
|
|
9069
|
+
const isInitialLoad = (0, import_react12.useRef)(true);
|
|
8911
9070
|
const maxPanelW = typeof window !== "undefined" ? window.innerWidth * 0.92 : 1200;
|
|
8912
9071
|
const { width: panelWidth, isResizing, handlePointerDown: handleResize } = useResizablePanel({
|
|
8913
9072
|
initialWidth: 440,
|
|
@@ -8941,10 +9100,11 @@ function CreateQuestTreePanel({
|
|
|
8941
9100
|
const indexToRemove = pathToRemove[pathToRemove.length - 1];
|
|
8942
9101
|
if (currentParent.children && currentParent.children.length > indexToRemove) {
|
|
8943
9102
|
currentParent.children.splice(indexToRemove, 1);
|
|
8944
|
-
|
|
9103
|
+
return { ...prev, [treeKey]: newTree };
|
|
8945
9104
|
}
|
|
8946
|
-
return
|
|
9105
|
+
return prev;
|
|
8947
9106
|
});
|
|
9107
|
+
setHasUnsavedChanges(true);
|
|
8948
9108
|
}, [setQuestTreeMode, activeTab]);
|
|
8949
9109
|
const handleMoveNode = (sourceId, targetId) => {
|
|
8950
9110
|
const isAbstraction = activeTab === "abstraction";
|
|
@@ -9021,6 +9181,15 @@ function CreateQuestTreePanel({
|
|
|
9021
9181
|
}));
|
|
9022
9182
|
}
|
|
9023
9183
|
}, [tree, abstraction_tree, questTreeMode.questNodeId, setQuestTreeMode]);
|
|
9184
|
+
(0, import_react12.useEffect)(() => {
|
|
9185
|
+
if (tree || abstraction_tree) {
|
|
9186
|
+
if (isInitialLoad.current) {
|
|
9187
|
+
isInitialLoad.current = false;
|
|
9188
|
+
return;
|
|
9189
|
+
}
|
|
9190
|
+
setHasUnsavedChanges(true);
|
|
9191
|
+
}
|
|
9192
|
+
}, [tree, abstraction_tree]);
|
|
9024
9193
|
return /* @__PURE__ */ import_react12.default.createElement(
|
|
9025
9194
|
"div",
|
|
9026
9195
|
{
|
|
@@ -12331,7 +12500,6 @@ function QuestDetailsPanel({
|
|
|
12331
12500
|
setIsSaving(false);
|
|
12332
12501
|
}
|
|
12333
12502
|
};
|
|
12334
|
-
const filteredCustomProps = customProps.filter((p) => p.key !== "Date" && p.key !== "Data");
|
|
12335
12503
|
const handleAddTimelineNote = async () => {
|
|
12336
12504
|
if (!noteText.trim() && noteLinks.length === 0 && noteImages.length === 0 || isSaving) return;
|
|
12337
12505
|
setIsSaving(true);
|
|
@@ -15456,12 +15624,12 @@ function XViewScene({
|
|
|
15456
15624
|
get_view_members,
|
|
15457
15625
|
create_google_doc_action,
|
|
15458
15626
|
open_google_picker_action,
|
|
15459
|
-
|
|
15460
|
-
|
|
15461
|
-
|
|
15462
|
-
|
|
15463
|
-
|
|
15464
|
-
|
|
15627
|
+
upsert_quest_firestore,
|
|
15628
|
+
delete_quest_firestore,
|
|
15629
|
+
upsert_quest_link_firestore,
|
|
15630
|
+
delete_quest_link_firestore,
|
|
15631
|
+
upsert_milestone_firestore,
|
|
15632
|
+
update_view_counter
|
|
15465
15633
|
}) {
|
|
15466
15634
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
15467
15635
|
const { data: session, status } = (0, import_react34.useSession)();
|
|
@@ -16021,11 +16189,19 @@ function XViewScene({
|
|
|
16021
16189
|
}
|
|
16022
16190
|
}
|
|
16023
16191
|
Object.values(nodeObjects).forEach((mesh) => {
|
|
16024
|
-
const
|
|
16025
|
-
if (
|
|
16026
|
-
mesh.remove(
|
|
16027
|
-
if (
|
|
16028
|
-
|
|
16192
|
+
const oldTimelineLabel = mesh.getObjectByName("timelineLabel");
|
|
16193
|
+
if (oldTimelineLabel) {
|
|
16194
|
+
mesh.remove(oldTimelineLabel);
|
|
16195
|
+
if (oldTimelineLabel.material.map)
|
|
16196
|
+
oldTimelineLabel.material.map.dispose();
|
|
16197
|
+
oldTimelineLabel.material.dispose();
|
|
16198
|
+
}
|
|
16199
|
+
const oldQuestDateLabel = mesh.getObjectByName("questDateLabel");
|
|
16200
|
+
if (oldQuestDateLabel) {
|
|
16201
|
+
mesh.remove(oldQuestDateLabel);
|
|
16202
|
+
if (oldQuestDateLabel.material.map)
|
|
16203
|
+
oldQuestDateLabel.material.map.dispose();
|
|
16204
|
+
oldQuestDateLabel.material.dispose();
|
|
16029
16205
|
}
|
|
16030
16206
|
delete mesh.userData.timelineIntervalBar;
|
|
16031
16207
|
delete mesh.userData.timelineEndLabel;
|
|
@@ -16045,42 +16221,18 @@ function XViewScene({
|
|
|
16045
16221
|
return null;
|
|
16046
16222
|
};
|
|
16047
16223
|
Object.values(nodeObjects).forEach((mesh) => {
|
|
16048
|
-
const dateProp = mesh.userData
|
|
16224
|
+
const dateProp = extractDatePropFromNode(mesh.userData);
|
|
16049
16225
|
let nodeInfo = { mesh, type: "point", label: "", isUndated: true };
|
|
16050
16226
|
if (dateProp) {
|
|
16051
|
-
|
|
16052
|
-
|
|
16053
|
-
|
|
16054
|
-
|
|
16055
|
-
|
|
16056
|
-
|
|
16057
|
-
|
|
16058
|
-
|
|
16059
|
-
|
|
16060
|
-
} else if (dateProp.year) {
|
|
16061
|
-
const year = parseInt(dateProp.year, 10);
|
|
16062
|
-
if (!isNaN(year)) {
|
|
16063
|
-
const date = new Date(year, 0, 1);
|
|
16064
|
-
nodeInfo.startDate = date;
|
|
16065
|
-
nodeInfo.endDate = date;
|
|
16066
|
-
nodeInfo.label = String(year);
|
|
16067
|
-
nodeInfo.isUndated = false;
|
|
16068
|
-
allTimePoints.add(date.getTime());
|
|
16069
|
-
}
|
|
16070
|
-
} else if (dateProp.date_interval && dateProp.date_interval.start) {
|
|
16071
|
-
const startYear = parseInt(dateProp.date_interval.start, 10);
|
|
16072
|
-
const endYear = parseInt(dateProp.date_interval.end, 10) || startYear;
|
|
16073
|
-
if (!isNaN(startYear)) {
|
|
16074
|
-
const startDate = new Date(startYear, 0, 1);
|
|
16075
|
-
const endDate = new Date(endYear, 11, 31);
|
|
16076
|
-
nodeInfo.type = "interval";
|
|
16077
|
-
nodeInfo.startDate = startDate;
|
|
16078
|
-
nodeInfo.endDate = endDate;
|
|
16079
|
-
nodeInfo.label = `${startYear} - ${endYear}`;
|
|
16080
|
-
nodeInfo.isUndated = false;
|
|
16081
|
-
allTimePoints.add(startDate.getTime());
|
|
16082
|
-
allTimePoints.add(endDate.getTime());
|
|
16083
|
-
}
|
|
16227
|
+
const info = parseDateProp(dateProp);
|
|
16228
|
+
if (!info.isUndated) {
|
|
16229
|
+
nodeInfo.startDate = info.startDate;
|
|
16230
|
+
nodeInfo.endDate = info.endDate;
|
|
16231
|
+
nodeInfo.label = info.label;
|
|
16232
|
+
nodeInfo.type = info.type;
|
|
16233
|
+
nodeInfo.isUndated = false;
|
|
16234
|
+
allTimePoints.add(info.startDate.getTime());
|
|
16235
|
+
if (info.endDate) allTimePoints.add(info.endDate.getTime());
|
|
16084
16236
|
}
|
|
16085
16237
|
}
|
|
16086
16238
|
timelineNodes.push(nodeInfo);
|
|
@@ -16208,50 +16360,29 @@ function XViewScene({
|
|
|
16208
16360
|
return null;
|
|
16209
16361
|
};
|
|
16210
16362
|
versionMeshes.forEach((mesh) => {
|
|
16211
|
-
const dateProp = mesh.userData
|
|
16363
|
+
const dateProp = extractDatePropFromNode(mesh.userData);
|
|
16212
16364
|
if (!dateProp) return;
|
|
16213
|
-
|
|
16214
|
-
if (
|
|
16215
|
-
const
|
|
16216
|
-
|
|
16217
|
-
|
|
16218
|
-
|
|
16219
|
-
|
|
16220
|
-
|
|
16221
|
-
|
|
16222
|
-
|
|
16223
|
-
|
|
16224
|
-
|
|
16225
|
-
if (!isNaN(year)) {
|
|
16226
|
-
const date = new Date(year, 0, 1);
|
|
16227
|
-
nodeInfo.startDate = date;
|
|
16228
|
-
nodeInfo.endDate = date;
|
|
16229
|
-
nodeInfo.label = String(year);
|
|
16230
|
-
allTimePoints.add(date.getTime());
|
|
16231
|
-
timelineNodes.push(nodeInfo);
|
|
16232
|
-
}
|
|
16233
|
-
} else if (dateProp.date_interval && dateProp.date_interval.start) {
|
|
16234
|
-
const startYear = parseInt(dateProp.date_interval.start, 10);
|
|
16235
|
-
const endYear = parseInt(dateProp.date_interval.end, 10) || startYear;
|
|
16236
|
-
if (!isNaN(startYear)) {
|
|
16237
|
-
const startDate = new Date(startYear, 0, 1);
|
|
16238
|
-
const endDate = new Date(endYear, 11, 31);
|
|
16239
|
-
nodeInfo.type = "interval";
|
|
16240
|
-
nodeInfo.startDate = startDate;
|
|
16241
|
-
nodeInfo.endDate = endDate;
|
|
16242
|
-
nodeInfo.label = `${startYear} - ${endYear}`;
|
|
16243
|
-
allTimePoints.add(startDate.getTime());
|
|
16244
|
-
allTimePoints.add(endDate.getTime());
|
|
16245
|
-
timelineNodes.push(nodeInfo);
|
|
16246
|
-
}
|
|
16365
|
+
const info = parseDateProp(dateProp);
|
|
16366
|
+
if (!info.isUndated) {
|
|
16367
|
+
const nodeInfo = {
|
|
16368
|
+
mesh,
|
|
16369
|
+
type: info.type,
|
|
16370
|
+
startDate: info.startDate,
|
|
16371
|
+
endDate: info.endDate,
|
|
16372
|
+
label: info.label
|
|
16373
|
+
};
|
|
16374
|
+
allTimePoints.add(info.startDate.getTime());
|
|
16375
|
+
if (info.endDate) allTimePoints.add(info.endDate.getTime());
|
|
16376
|
+
timelineNodes.push(nodeInfo);
|
|
16247
16377
|
}
|
|
16248
16378
|
});
|
|
16249
16379
|
if (timelineNodes.length === 0) return;
|
|
16250
16380
|
const sortedTimePoints = Array.from(allTimePoints).sort((a, b) => a - b);
|
|
16381
|
+
const maxTimeIndex = sortedTimePoints.length - 1;
|
|
16251
16382
|
const timeToYMap = new Map(
|
|
16252
16383
|
sortedTimePoints.map((time, index) => [
|
|
16253
16384
|
time,
|
|
16254
|
-
index * TIMELINE_LAYER_SPACING_Y
|
|
16385
|
+
(index - maxTimeIndex) * TIMELINE_LAYER_SPACING_Y
|
|
16255
16386
|
])
|
|
16256
16387
|
);
|
|
16257
16388
|
timelineNodes.sort(
|
|
@@ -16259,18 +16390,38 @@ function XViewScene({
|
|
|
16259
16390
|
);
|
|
16260
16391
|
const baseX = sourceMesh.position.x + TIMELINE_NODE_SPACING_X;
|
|
16261
16392
|
const baseY = sourceMesh.position.y;
|
|
16262
|
-
const
|
|
16263
|
-
|
|
16393
|
+
const columns = [];
|
|
16394
|
+
const allFinalPoints = [sourceMesh.position.clone()];
|
|
16395
|
+
timelineNodes.forEach((node) => {
|
|
16264
16396
|
const { mesh, type, startDate, endDate, label } = node;
|
|
16265
|
-
const
|
|
16266
|
-
const
|
|
16397
|
+
const startY = timeToYMap.get(startDate.getTime());
|
|
16398
|
+
const endY = timeToYMap.get(endDate.getTime()) || startY;
|
|
16399
|
+
let foundColumn = false;
|
|
16400
|
+
for (let i = 0; i < columns.length; i++) {
|
|
16401
|
+
if (columns[i].endY < startY) {
|
|
16402
|
+
node.columnIndex = i;
|
|
16403
|
+
columns[i].endY = endY;
|
|
16404
|
+
foundColumn = true;
|
|
16405
|
+
break;
|
|
16406
|
+
}
|
|
16407
|
+
}
|
|
16408
|
+
if (!foundColumn) {
|
|
16409
|
+
node.columnIndex = columns.length;
|
|
16410
|
+
columns.push({ endY });
|
|
16411
|
+
}
|
|
16412
|
+
const x = baseX + node.columnIndex * TIMELINE_NODE_SPACING_X;
|
|
16413
|
+
const y = baseY + startY;
|
|
16414
|
+
allFinalPoints.push(new THREE3.Vector3(x, y, 0));
|
|
16415
|
+
const versionTween = new import_tween2.Tween(mesh.position).to({ x, y, z: 0 }, 1500).easing(import_tween2.Easing.Cubic.InOut);
|
|
16267
16416
|
tweenGroup.add(versionTween);
|
|
16268
16417
|
versionTween.start();
|
|
16269
|
-
|
|
16270
|
-
|
|
16271
|
-
|
|
16272
|
-
|
|
16273
|
-
|
|
16418
|
+
if (!mesh.getObjectByName("questDateLabel")) {
|
|
16419
|
+
const startLabelText = type === "interval" ? startDate.getFullYear().toString() : label;
|
|
16420
|
+
const startLabel = createTextSprite(startLabelText, 48);
|
|
16421
|
+
startLabel.name = "timelineLabel";
|
|
16422
|
+
startLabel.position.set(0, -2.5, 0);
|
|
16423
|
+
mesh.add(startLabel);
|
|
16424
|
+
}
|
|
16274
16425
|
if (type === "interval") {
|
|
16275
16426
|
const relativeEndY = timeToYMap.get(endDate.getTime()) - timeToYMap.get(startDate.getTime());
|
|
16276
16427
|
if (relativeEndY > 0) {
|
|
@@ -16304,7 +16455,21 @@ function XViewScene({
|
|
|
16304
16455
|
}
|
|
16305
16456
|
}
|
|
16306
16457
|
});
|
|
16307
|
-
|
|
16458
|
+
if (allFinalPoints.length > 0) {
|
|
16459
|
+
const boundingBox = new THREE3.Box3().setFromPoints(allFinalPoints);
|
|
16460
|
+
const center = new THREE3.Vector3();
|
|
16461
|
+
boundingBox.getCenter(center);
|
|
16462
|
+
const size = new THREE3.Vector3();
|
|
16463
|
+
boundingBox.getSize(size);
|
|
16464
|
+
const spread = Math.max(size.x, size.y, size.z, 1);
|
|
16465
|
+
const desiredDistance = Math.max(
|
|
16466
|
+
x_view_config.CAMERA_ZOOM_DISTANCE,
|
|
16467
|
+
spread * 1.5
|
|
16468
|
+
);
|
|
16469
|
+
const zoomFactor = x_view_config.CAMERA_ZOOM_DISTANCE / desiredDistance;
|
|
16470
|
+
tweenToTarget(center, zoomFactor);
|
|
16471
|
+
}
|
|
16472
|
+
}, [tweenToTarget]);
|
|
16308
16473
|
(0, import_react33.useEffect)(() => {
|
|
16309
16474
|
async function fetchAllData(configPath, ownerId2) {
|
|
16310
16475
|
var _a2, _b2;
|
|
@@ -16325,32 +16490,11 @@ function XViewScene({
|
|
|
16325
16490
|
focusAncestryId
|
|
16326
16491
|
);
|
|
16327
16492
|
const boardPromise = get_boards_action && session ? get_boards_action(configPath, sceneType, session, ownerId2) : Promise.resolve({ success: false, data: [] });
|
|
16328
|
-
const
|
|
16329
|
-
const [sceneResponse, boardResponse, questResponse] = await Promise.all([
|
|
16493
|
+
const [sceneResponse, boardResponse] = await Promise.all([
|
|
16330
16494
|
scenePromise,
|
|
16331
|
-
boardPromise
|
|
16332
|
-
questPromise
|
|
16495
|
+
boardPromise
|
|
16333
16496
|
]);
|
|
16334
16497
|
if ((sceneResponse == null ? void 0 : sceneResponse.success) && ((_a2 = sceneResponse.data) == null ? void 0 : _a2.scene) && ((_b2 = sceneResponse.data) == null ? void 0 : _b2.parent)) {
|
|
16335
|
-
const sceneData = sceneResponse.data.scene;
|
|
16336
|
-
let firestoreQuests = (questResponse == null ? void 0 : questResponse.success) ? questResponse.quests : [];
|
|
16337
|
-
let firestoreLinks = (questResponse == null ? void 0 : questResponse.success) ? questResponse.links : [];
|
|
16338
|
-
if (!sceneData.quests_migrated && firestoreQuests.length === 0) {
|
|
16339
|
-
const legacyQuests = sceneData.quest_nodes || [];
|
|
16340
|
-
const legacyLinks = sceneData.quest_links || [];
|
|
16341
|
-
if ((legacyQuests.length > 0 || legacyLinks.length > 0) && migrate_legacy_quests_action) {
|
|
16342
|
-
console.log(
|
|
16343
|
-
"X-View: Iniciando Lazy Migration de Quests para Firestore..."
|
|
16344
|
-
);
|
|
16345
|
-
await migrate_legacy_quests_action(ownerId2, sceneConfigId, {
|
|
16346
|
-
nodes: legacyQuests,
|
|
16347
|
-
links: legacyLinks
|
|
16348
|
-
});
|
|
16349
|
-
firestoreQuests = legacyQuests;
|
|
16350
|
-
firestoreLinks = legacyLinks;
|
|
16351
|
-
sceneData.quests_migrated = true;
|
|
16352
|
-
}
|
|
16353
|
-
}
|
|
16354
16498
|
if (focusNodeId) {
|
|
16355
16499
|
let targetNode = sceneResponse.data.scene.nodes.find(
|
|
16356
16500
|
(n) => String(n.id) === String(focusNodeId)
|
|
@@ -16372,29 +16516,10 @@ function XViewScene({
|
|
|
16372
16516
|
sceneResponse.data.scene.links = [];
|
|
16373
16517
|
}
|
|
16374
16518
|
sceneDataRef.current = {
|
|
16375
|
-
...
|
|
16376
|
-
|
|
16377
|
-
milestones: sceneData.milestones || []
|
|
16519
|
+
...sceneResponse.data.scene,
|
|
16520
|
+
milestones: sceneResponse.data.scene.milestones || []
|
|
16378
16521
|
};
|
|
16379
|
-
|
|
16380
|
-
if (currentParentData && currentParentData[sceneConfigId]) {
|
|
16381
|
-
const existingNodes = currentParentData[sceneConfigId].nodes || [];
|
|
16382
|
-
const firestoreQuestIds = new Set(firestoreQuests.map((q) => String(q.id)));
|
|
16383
|
-
const filteredExisting = existingNodes.filter(
|
|
16384
|
-
(n) => !firestoreQuestIds.has(String(n.id))
|
|
16385
|
-
);
|
|
16386
|
-
currentParentData[sceneConfigId].nodes = [
|
|
16387
|
-
...filteredExisting,
|
|
16388
|
-
...firestoreQuests
|
|
16389
|
-
];
|
|
16390
|
-
if (firestoreLinks && firestoreLinks.length > 0) {
|
|
16391
|
-
currentParentData[sceneConfigId].links = [
|
|
16392
|
-
...currentParentData[sceneConfigId].links || [],
|
|
16393
|
-
...firestoreLinks
|
|
16394
|
-
];
|
|
16395
|
-
}
|
|
16396
|
-
}
|
|
16397
|
-
parentDataRef.current = currentParentData;
|
|
16522
|
+
parentDataRef.current = sceneResponse.data.parent;
|
|
16398
16523
|
ancestryDataRef.current = sceneResponse.data.ancestry;
|
|
16399
16524
|
console.log(
|
|
16400
16525
|
"Console de sceneResponse.data.scene:",
|
|
@@ -18009,12 +18134,13 @@ function XViewScene({
|
|
|
18009
18134
|
get_scene_view_data,
|
|
18010
18135
|
upload_file: upload_file_action,
|
|
18011
18136
|
delete_file: delete_file_action,
|
|
18012
|
-
|
|
18013
|
-
|
|
18014
|
-
|
|
18015
|
-
|
|
18016
|
-
|
|
18017
|
-
|
|
18137
|
+
// Adicionado novas importações aqui
|
|
18138
|
+
upsert_quest_firestore,
|
|
18139
|
+
delete_quest_firestore,
|
|
18140
|
+
upsert_quest_link_firestore,
|
|
18141
|
+
delete_quest_link_firestore,
|
|
18142
|
+
upsert_milestone_firestore,
|
|
18143
|
+
update_view_counter
|
|
18018
18144
|
}
|
|
18019
18145
|
};
|
|
18020
18146
|
},
|
|
@@ -18034,12 +18160,12 @@ function XViewScene({
|
|
|
18034
18160
|
get_scene_view_data,
|
|
18035
18161
|
upload_file_action,
|
|
18036
18162
|
delete_file_action,
|
|
18037
|
-
|
|
18038
|
-
|
|
18039
|
-
|
|
18040
|
-
|
|
18041
|
-
|
|
18042
|
-
|
|
18163
|
+
upsert_quest_firestore,
|
|
18164
|
+
delete_quest_firestore,
|
|
18165
|
+
upsert_quest_link_firestore,
|
|
18166
|
+
delete_quest_link_firestore,
|
|
18167
|
+
upsert_milestone_firestore,
|
|
18168
|
+
update_view_counter
|
|
18043
18169
|
]
|
|
18044
18170
|
);
|
|
18045
18171
|
const handleStartVersioning = (nodeData) => {
|
|
@@ -18245,36 +18371,30 @@ function XViewScene({
|
|
|
18245
18371
|
parentDataRef.current[sceneConfigId].nodes[parentIndex].quest_abstraction_tree = formattedAbstractionTree;
|
|
18246
18372
|
}
|
|
18247
18373
|
}
|
|
18248
|
-
const
|
|
18249
|
-
|
|
18250
|
-
|
|
18251
|
-
|
|
18252
|
-
|
|
18253
|
-
|
|
18254
|
-
|
|
18255
|
-
|
|
18256
|
-
|
|
18257
|
-
|
|
18258
|
-
|
|
18259
|
-
|
|
18260
|
-
|
|
18261
|
-
|
|
18262
|
-
|
|
18263
|
-
|
|
18264
|
-
|
|
18265
|
-
|
|
18266
|
-
|
|
18267
|
-
|
|
18268
|
-
|
|
18269
|
-
|
|
18270
|
-
|
|
18271
|
-
setDetailsNode((prev) => ({
|
|
18272
|
-
...prev,
|
|
18273
|
-
quest_tree: formattedTree,
|
|
18274
|
-
quest_abstraction_tree: formattedAbstractionTree
|
|
18275
|
-
}));
|
|
18374
|
+
const updatedNodeData = sceneData.quest_nodes[questIndex];
|
|
18375
|
+
if (upsert_quest_firestore) {
|
|
18376
|
+
await upsert_quest_firestore(
|
|
18377
|
+
ownerId,
|
|
18378
|
+
sceneConfigId,
|
|
18379
|
+
updatedNodeData
|
|
18380
|
+
);
|
|
18381
|
+
}
|
|
18382
|
+
const nodeMesh = (_a2 = stateRef.current.nodeObjects) == null ? void 0 : _a2[String(questNodeId)];
|
|
18383
|
+
if (nodeMesh) {
|
|
18384
|
+
nodeMesh.userData = {
|
|
18385
|
+
...nodeMesh.userData,
|
|
18386
|
+
...updatedNodeData
|
|
18387
|
+
};
|
|
18388
|
+
}
|
|
18389
|
+
if (detailsNode && String(detailsNode.id) === String(questNodeId)) {
|
|
18390
|
+
setDetailsNode((prev) => ({
|
|
18391
|
+
...prev,
|
|
18392
|
+
quest_tree: formattedTree,
|
|
18393
|
+
quest_abstraction_tree: formattedAbstractionTree
|
|
18394
|
+
}));
|
|
18395
|
+
}
|
|
18396
|
+
setSceneVersion((v) => v + 1);
|
|
18276
18397
|
}
|
|
18277
|
-
setSceneVersion((v) => v + 1);
|
|
18278
18398
|
}
|
|
18279
18399
|
}
|
|
18280
18400
|
};
|
|
@@ -18323,7 +18443,6 @@ function XViewScene({
|
|
|
18323
18443
|
ownerId: ownerId2
|
|
18324
18444
|
} = context;
|
|
18325
18445
|
if (!graphDataRef2.current || (viewType == null ? void 0 : viewType.toLowerCase()) !== "view") return;
|
|
18326
|
-
const currentCounter = sceneDataRef2.current.quest_counter || 1;
|
|
18327
18446
|
const newNode = {
|
|
18328
18447
|
id: import_short_uuid2.default.generate(),
|
|
18329
18448
|
...newQuestData,
|
|
@@ -18334,19 +18453,16 @@ function XViewScene({
|
|
|
18334
18453
|
graphDataRef2.current[sceneConfigId2] = { nodes: [], links: [] };
|
|
18335
18454
|
}
|
|
18336
18455
|
graphDataRef2.current[sceneConfigId2].nodes.push(newNode);
|
|
18337
|
-
const
|
|
18338
|
-
|
|
18339
|
-
quest_counter: currentCounter + 1
|
|
18340
|
-
};
|
|
18341
|
-
const questFileData = {
|
|
18342
|
-
nodes: graphDataRef2.current[sceneConfigId2].nodes,
|
|
18343
|
-
links: graphDataRef2.current[sceneConfigId2].links,
|
|
18344
|
-
milestones: sceneDataRef2.current.milestones || []
|
|
18345
|
-
};
|
|
18456
|
+
const currentCounter = sceneDataRef2.current.quest_counter || 1;
|
|
18457
|
+
const nextCounter = currentCounter + 1;
|
|
18346
18458
|
try {
|
|
18347
|
-
|
|
18348
|
-
|
|
18349
|
-
|
|
18459
|
+
if (actions.upsert_quest_firestore) {
|
|
18460
|
+
await actions.upsert_quest_firestore(ownerId2, sceneConfigId2, newNode);
|
|
18461
|
+
}
|
|
18462
|
+
if (actions.update_view_counter) {
|
|
18463
|
+
await actions.update_view_counter(ownerId2, sceneConfigId2, nextCounter);
|
|
18464
|
+
}
|
|
18465
|
+
sceneDataRef2.current.quest_counter = nextCounter;
|
|
18350
18466
|
stateRef2.current.nodeIdToParentFileMap.set(String(newNode.id), {
|
|
18351
18467
|
parentFileId: sceneConfigId2,
|
|
18352
18468
|
ownerId: ownerId2,
|
|
@@ -18377,84 +18493,6 @@ function XViewScene({
|
|
|
18377
18493
|
alert("Ocorreu um erro ao criar a Quest.");
|
|
18378
18494
|
}
|
|
18379
18495
|
};
|
|
18380
|
-
userActionHandlers.handleCompleteConnection = async (context, targetNodeData) => {
|
|
18381
|
-
const {
|
|
18382
|
-
stateRef: stateRef2,
|
|
18383
|
-
graphDataRef: graphDataRef2,
|
|
18384
|
-
sceneDataRef: sceneDataRef2,
|
|
18385
|
-
sceneConfigId: sceneConfigId2,
|
|
18386
|
-
sceneSaveUrl: sceneSaveUrl2,
|
|
18387
|
-
ownerId: ownerId2
|
|
18388
|
-
} = context;
|
|
18389
|
-
const { sourceNodeData } = stateRef2.current.connection;
|
|
18390
|
-
if (!graphDataRef2.current || !sceneDataRef2.current || !sourceNodeData || !targetNodeData) {
|
|
18391
|
-
userActionHandlers.handleCancelConnection(context);
|
|
18392
|
-
return;
|
|
18393
|
-
}
|
|
18394
|
-
const sourceParentInfo = getParentFileInfoForNode(
|
|
18395
|
-
graphDataRef2.current,
|
|
18396
|
-
sceneDataRef2.current,
|
|
18397
|
-
sourceNodeData.id,
|
|
18398
|
-
sceneConfigId2,
|
|
18399
|
-
ownerId2
|
|
18400
|
-
);
|
|
18401
|
-
const targetParentInfo = getParentFileInfoForNode(
|
|
18402
|
-
graphDataRef2.current,
|
|
18403
|
-
sceneDataRef2.current,
|
|
18404
|
-
targetNodeData.id,
|
|
18405
|
-
sceneConfigId2,
|
|
18406
|
-
ownerId2
|
|
18407
|
-
);
|
|
18408
|
-
let parentInfoToSave = sourceParentInfo;
|
|
18409
|
-
const isSourceQuest = sourceParentInfo.parentFileId === sceneConfigId2;
|
|
18410
|
-
const isTargetQuest = targetParentInfo.parentFileId === sceneConfigId2;
|
|
18411
|
-
if (isSourceQuest || isTargetQuest) {
|
|
18412
|
-
parentInfoToSave = { parentFileId: sceneConfigId2, ownerId: ownerId2 };
|
|
18413
|
-
}
|
|
18414
|
-
const { parentFileId: parentFileIdToSave, ownerId: ownerIdToSave } = parentInfoToSave;
|
|
18415
|
-
const newLink = {
|
|
18416
|
-
id: `link_${import_short_uuid2.default.generate()}`,
|
|
18417
|
-
source: sourceNodeData.id,
|
|
18418
|
-
target: targetNodeData.id
|
|
18419
|
-
};
|
|
18420
|
-
try {
|
|
18421
|
-
if (parentFileIdToSave === sceneConfigId2) {
|
|
18422
|
-
const specificParentData = graphDataRef2.current[sceneConfigId2];
|
|
18423
|
-
specificParentData.links.push(newLink);
|
|
18424
|
-
const viewFilePayload = {
|
|
18425
|
-
...sceneDataRef2.current,
|
|
18426
|
-
quest_counter: sceneDataRef2.current.quest_counter || 1
|
|
18427
|
-
};
|
|
18428
|
-
const questFilePayload = {
|
|
18429
|
-
nodes: specificParentData.nodes,
|
|
18430
|
-
links: specificParentData.links,
|
|
18431
|
-
milestones: sceneDataRef2.current.milestones || []
|
|
18432
|
-
};
|
|
18433
|
-
await context.actions.save_view_data(sceneSaveUrl2, viewFilePayload);
|
|
18434
|
-
const questSaveUrl = sceneSaveUrl2.replace(
|
|
18435
|
-
"x_view_scenes",
|
|
18436
|
-
"x_view_quests"
|
|
18437
|
-
);
|
|
18438
|
-
await context.actions.save_view_data(questSaveUrl, questFilePayload);
|
|
18439
|
-
} else {
|
|
18440
|
-
const specificParentData = JSON.parse(
|
|
18441
|
-
JSON.stringify(graphDataRef2.current[parentFileIdToSave])
|
|
18442
|
-
);
|
|
18443
|
-
specificParentData.links.push(newLink);
|
|
18444
|
-
const filenameForSpecificParent = `x_view_dbs/${ownerIdToSave}/${parentFileIdToSave}`;
|
|
18445
|
-
await context.actions.save_view_data(
|
|
18446
|
-
filenameForSpecificParent,
|
|
18447
|
-
specificParentData
|
|
18448
|
-
);
|
|
18449
|
-
graphDataRef2.current[parentFileIdToSave] = specificParentData;
|
|
18450
|
-
}
|
|
18451
|
-
addNewLinkToScene(stateRef2.current, newLink);
|
|
18452
|
-
} catch (error) {
|
|
18453
|
-
console.error("Falha ao salvar a nova conex\xE3o:", error);
|
|
18454
|
-
alert("Ocorreu um erro ao salvar a nova conex\xE3o.");
|
|
18455
|
-
}
|
|
18456
|
-
userActionHandlers.handleCancelConnection(context);
|
|
18457
|
-
};
|
|
18458
18496
|
const handleClearAncestryVisuals = (0, import_react33.useCallback)((ancestryId) => {
|
|
18459
18497
|
const { renderedAncestries, ancestryGroup } = stateRef.current;
|
|
18460
18498
|
const renderIndex = renderedAncestries.findIndex(
|
|
@@ -20157,24 +20195,19 @@ function XViewScene({
|
|
|
20157
20195
|
setSceneVersion((v) => v + 1);
|
|
20158
20196
|
const isView = ((_a2 = viewParams == null ? void 0 : viewParams.type) == null ? void 0 : _a2.toLowerCase()) === "view";
|
|
20159
20197
|
if (!isView || !save_view_data || !sceneSaveUrl) return;
|
|
20160
|
-
const sceneFileData = {
|
|
20161
|
-
...sceneDataRef.current,
|
|
20162
|
-
nodes: sceneDataRef.current.nodes || [],
|
|
20163
|
-
links: sceneDataRef.current.links || [],
|
|
20164
|
-
quest_counter: sceneDataRef.current.quest_counter || 1
|
|
20165
|
-
};
|
|
20166
20198
|
const questFileData = {
|
|
20167
20199
|
nodes: ((_b2 = parentDataRef.current[sceneConfigId]) == null ? void 0 : _b2.nodes) || sceneDataRef.current.quest_nodes || [],
|
|
20168
20200
|
links: ((_c2 = parentDataRef.current[sceneConfigId]) == null ? void 0 : _c2.links) || sceneDataRef.current.quest_links || [],
|
|
20169
20201
|
milestones: newMilestones
|
|
20170
20202
|
};
|
|
20171
20203
|
try {
|
|
20172
|
-
|
|
20173
|
-
|
|
20174
|
-
|
|
20175
|
-
|
|
20176
|
-
|
|
20177
|
-
|
|
20204
|
+
if (upsert_milestone_firestore) {
|
|
20205
|
+
await upsert_milestone_firestore(
|
|
20206
|
+
ownerId,
|
|
20207
|
+
sceneConfigId,
|
|
20208
|
+
newMilestones
|
|
20209
|
+
);
|
|
20210
|
+
}
|
|
20178
20211
|
} catch (error) {
|
|
20179
20212
|
console.error("Erro ao salvar milestones:", error);
|
|
20180
20213
|
}
|
|
@@ -20182,7 +20215,7 @@ function XViewScene({
|
|
|
20182
20215
|
[sceneConfigId, sceneSaveUrl, save_view_data, viewParams == null ? void 0 : viewParams.type]
|
|
20183
20216
|
);
|
|
20184
20217
|
const handleSaveCurrentView = (0, import_react33.useCallback)(async () => {
|
|
20185
|
-
var _a2
|
|
20218
|
+
var _a2;
|
|
20186
20219
|
const { nodeObjects, allLinks } = stateRef.current;
|
|
20187
20220
|
if (!nodeObjects || !allLinks || !sceneSaveUrl || !parentDataRef.current) {
|
|
20188
20221
|
console.warn(
|
|
@@ -20212,23 +20245,10 @@ function XViewScene({
|
|
|
20212
20245
|
const sceneFileData = {
|
|
20213
20246
|
...sceneDataRef.current,
|
|
20214
20247
|
nodes: currentNodes,
|
|
20215
|
-
links: currentLinks
|
|
20216
|
-
quest_counter: sceneDataRef.current.quest_counter || 1
|
|
20217
|
-
};
|
|
20218
|
-
const questFileData = {
|
|
20219
|
-
nodes: isView ? ((_b2 = parentDataRef.current[sceneConfigId]) == null ? void 0 : _b2.nodes) || [] : sceneDataRef.current.quest_nodes || [],
|
|
20220
|
-
links: isView ? ((_c2 = parentDataRef.current[sceneConfigId]) == null ? void 0 : _c2.links) || [] : sceneDataRef.current.quest_links || [],
|
|
20221
|
-
milestones: sceneDataRef.current.milestones || []
|
|
20248
|
+
links: currentLinks
|
|
20222
20249
|
};
|
|
20223
20250
|
try {
|
|
20224
20251
|
await save_view_data(sceneSaveUrl, sceneFileData);
|
|
20225
|
-
if (isView) {
|
|
20226
|
-
const questSaveUrl = sceneSaveUrl.replace(
|
|
20227
|
-
"x_view_scenes",
|
|
20228
|
-
"x_view_quests"
|
|
20229
|
-
);
|
|
20230
|
-
await save_view_data(questSaveUrl, questFileData);
|
|
20231
|
-
}
|
|
20232
20252
|
} catch (error) {
|
|
20233
20253
|
console.error("Erro na chamada de save_view_data:", error);
|
|
20234
20254
|
}
|
|
@@ -21091,25 +21111,40 @@ async function save_view_data_logic(db_services, filename, data) {
|
|
|
21091
21111
|
}
|
|
21092
21112
|
}
|
|
21093
21113
|
async function get_scene_view_data_logic(db_services, scene_config, owner_id, type, session, focusNodeId = null, focusAncestryId = null) {
|
|
21094
|
-
var _a, _b;
|
|
21114
|
+
var _a, _b, _c;
|
|
21095
21115
|
try {
|
|
21096
21116
|
if (!session || !session.user) {
|
|
21097
21117
|
return { success: false, error: "Usu\xE1rio n\xE3o autenticado." };
|
|
21098
21118
|
}
|
|
21099
|
-
const membershipCheck = await db_services.check_membership(
|
|
21119
|
+
const membershipCheck = await db_services.check_membership(
|
|
21120
|
+
owner_id,
|
|
21121
|
+
type,
|
|
21122
|
+
scene_config,
|
|
21123
|
+
session.user.id
|
|
21124
|
+
);
|
|
21100
21125
|
const isFullMember = membershipCheck.success && membershipCheck.isValidMember;
|
|
21101
21126
|
if (!isFullMember && !focusNodeId && !focusAncestryId) {
|
|
21102
|
-
return {
|
|
21127
|
+
return {
|
|
21128
|
+
success: false,
|
|
21129
|
+
error: "Acesso Negado: Voc\xEA n\xE3o possui permiss\xE3o para acessar este cen\xE1rio."
|
|
21130
|
+
};
|
|
21103
21131
|
}
|
|
21104
|
-
const sceneResponse = await db_services.get_file(
|
|
21132
|
+
const sceneResponse = await db_services.get_file(
|
|
21133
|
+
`x_view_scenes/${owner_id}/${scene_config}`
|
|
21134
|
+
);
|
|
21105
21135
|
if (!sceneResponse || !sceneResponse.success) {
|
|
21106
21136
|
console.error("Falha ao buscar dados da cena:", sceneResponse == null ? void 0 : sceneResponse.error);
|
|
21107
|
-
return {
|
|
21137
|
+
return {
|
|
21138
|
+
success: false,
|
|
21139
|
+
error: `N\xE3o foi poss\xEDvel carregar o arquivo da cena: ${scene_config}`
|
|
21140
|
+
};
|
|
21108
21141
|
}
|
|
21109
21142
|
const sceneData = sceneResponse.data;
|
|
21110
21143
|
const parentDbObjects = sceneData.parent_dbs || [];
|
|
21111
21144
|
if (type && type.toLowerCase().includes("database")) {
|
|
21112
|
-
const selfExists = parentDbObjects.some(
|
|
21145
|
+
const selfExists = parentDbObjects.some(
|
|
21146
|
+
(db) => String(db.db_id) === String(scene_config)
|
|
21147
|
+
);
|
|
21113
21148
|
if (!selfExists) {
|
|
21114
21149
|
parentDbObjects.push({ db_id: scene_config, owner_id });
|
|
21115
21150
|
}
|
|
@@ -21118,43 +21153,70 @@ async function get_scene_view_data_logic(db_services, scene_config, owner_id, ty
|
|
|
21118
21153
|
const parentResponsesPromises = parentDbObjects.map(
|
|
21119
21154
|
(db_info) => db_services.get_file(`x_view_dbs/${db_info.owner_id}/${db_info.db_id}`)
|
|
21120
21155
|
);
|
|
21121
|
-
const parentResponsesResults = await Promise.allSettled(parentResponsesPromises);
|
|
21122
|
-
const parentData = {};
|
|
21123
|
-
let currentQuestNodes = [];
|
|
21124
|
-
let currentQuestLinks = [];
|
|
21125
|
-
let currentMilestones = [];
|
|
21126
21156
|
if (isView) {
|
|
21127
|
-
const
|
|
21128
|
-
|
|
21129
|
-
|
|
21130
|
-
|
|
21131
|
-
|
|
21132
|
-
|
|
21133
|
-
|
|
21134
|
-
|
|
21135
|
-
|
|
21136
|
-
|
|
21137
|
-
|
|
21138
|
-
|
|
21139
|
-
|
|
21140
|
-
|
|
21141
|
-
|
|
21142
|
-
|
|
21157
|
+
const questFetchWithMigrationPromise = (async () => {
|
|
21158
|
+
try {
|
|
21159
|
+
const questsResponse = await db_services.get_view_quests_firestore(
|
|
21160
|
+
owner_id,
|
|
21161
|
+
scene_config
|
|
21162
|
+
);
|
|
21163
|
+
if (questsResponse.success && questsResponse.hasQuests) {
|
|
21164
|
+
return {
|
|
21165
|
+
success: true,
|
|
21166
|
+
data: questsResponse.data,
|
|
21167
|
+
quest_counter: questsResponse.quest_counter
|
|
21168
|
+
};
|
|
21169
|
+
} else {
|
|
21170
|
+
const legacyResponse = await db_services.get_file(
|
|
21171
|
+
`x_view_quests/${owner_id}/${scene_config}`
|
|
21172
|
+
);
|
|
21173
|
+
if (legacyResponse.success && legacyResponse.data) {
|
|
21174
|
+
await db_services.migrate_json_to_firestore(
|
|
21175
|
+
owner_id,
|
|
21176
|
+
scene_config,
|
|
21177
|
+
legacyResponse.data,
|
|
21178
|
+
sceneData.quest_counter
|
|
21179
|
+
);
|
|
21180
|
+
legacyResponse.quest_counter = sceneData.quest_counter || 1;
|
|
21181
|
+
return legacyResponse;
|
|
21182
|
+
}
|
|
21183
|
+
return legacyResponse;
|
|
21184
|
+
}
|
|
21185
|
+
} catch (err) {
|
|
21186
|
+
return { success: false, error: err.message };
|
|
21143
21187
|
}
|
|
21144
|
-
}
|
|
21188
|
+
})();
|
|
21189
|
+
parentResponsesPromises.push(questFetchWithMigrationPromise);
|
|
21145
21190
|
}
|
|
21191
|
+
const parentResponsesResults = await Promise.allSettled(
|
|
21192
|
+
parentResponsesPromises
|
|
21193
|
+
);
|
|
21194
|
+
const parentData = {};
|
|
21195
|
+
let questDataObj = null;
|
|
21146
21196
|
for (let i = 0; i < parentResponsesResults.length; i++) {
|
|
21147
21197
|
const result = parentResponsesResults[i];
|
|
21198
|
+
if (isView && i === parentResponsesResults.length - 1) {
|
|
21199
|
+
if (result.status === "fulfilled" && ((_a = result.value) == null ? void 0 : _a.success)) {
|
|
21200
|
+
questDataObj = result.value.data;
|
|
21201
|
+
if (result.value.quest_counter !== void 0) {
|
|
21202
|
+
sceneData.quest_counter = result.value.quest_counter;
|
|
21203
|
+
}
|
|
21204
|
+
}
|
|
21205
|
+
continue;
|
|
21206
|
+
}
|
|
21148
21207
|
const db_info = parentDbObjects[i];
|
|
21149
|
-
if (result.status === "fulfilled" && ((
|
|
21208
|
+
if (result.status === "fulfilled" && ((_b = result.value) == null ? void 0 : _b.success)) {
|
|
21150
21209
|
parentData[db_info.db_id] = result.value.data;
|
|
21151
21210
|
} else {
|
|
21152
21211
|
console.warn(
|
|
21153
21212
|
`Arquivo pai n\xE3o carregado: ${db_info.db_id}. Pode ter sido deletado.`,
|
|
21154
|
-
result.status === "rejected" ? result.reason : (
|
|
21213
|
+
result.status === "rejected" ? result.reason : (_c = result.value) == null ? void 0 : _c.error
|
|
21155
21214
|
);
|
|
21156
21215
|
}
|
|
21157
21216
|
}
|
|
21217
|
+
const currentQuestNodes = (questDataObj == null ? void 0 : questDataObj.nodes) || [];
|
|
21218
|
+
const currentQuestLinks = (questDataObj == null ? void 0 : questDataObj.links) || [];
|
|
21219
|
+
const currentMilestones = (questDataObj == null ? void 0 : questDataObj.milestones) || [];
|
|
21158
21220
|
if (isView) {
|
|
21159
21221
|
parentData[scene_config] = {
|
|
21160
21222
|
dataset_name: "Quests Internas (View)",
|
|
@@ -21164,13 +21226,19 @@ async function get_scene_view_data_logic(db_services, scene_config, owner_id, ty
|
|
|
21164
21226
|
}
|
|
21165
21227
|
const allNodes = Object.values(parentData).flatMap((db) => db.nodes || []);
|
|
21166
21228
|
const allLinks = Object.values(parentData).flatMap((db) => db.links || []);
|
|
21167
|
-
const parentNodeMap = new Map(
|
|
21168
|
-
|
|
21229
|
+
const parentNodeMap = new Map(
|
|
21230
|
+
allNodes.map((node) => [String(node.id), node])
|
|
21231
|
+
);
|
|
21232
|
+
const parentLinkMap = new Map(
|
|
21233
|
+
allLinks.map((link) => [`${link.source}-${link.target}`, link])
|
|
21234
|
+
);
|
|
21169
21235
|
const validatedNodes = (sceneData.nodes || []).map((sceneNode) => {
|
|
21170
21236
|
var _a2, _b2;
|
|
21171
21237
|
const nodeTypes = Array.isArray(sceneNode.type) ? sceneNode.type : [sceneNode.type];
|
|
21172
21238
|
if (nodeTypes.includes("quest")) {
|
|
21173
|
-
const dbQuestNode = (_b2 = (_a2 = parentData[scene_config]) == null ? void 0 : _a2.nodes) == null ? void 0 : _b2.find(
|
|
21239
|
+
const dbQuestNode = (_b2 = (_a2 = parentData[scene_config]) == null ? void 0 : _a2.nodes) == null ? void 0 : _b2.find(
|
|
21240
|
+
(qn) => String(qn.id) === String(sceneNode.id)
|
|
21241
|
+
);
|
|
21174
21242
|
if (dbQuestNode) {
|
|
21175
21243
|
return { ...sceneNode, ...dbQuestNode };
|
|
21176
21244
|
}
|
|
@@ -21182,18 +21250,22 @@ async function get_scene_view_data_logic(db_services, scene_config, owner_id, ty
|
|
|
21182
21250
|
}
|
|
21183
21251
|
return null;
|
|
21184
21252
|
}).filter(Boolean);
|
|
21185
|
-
const validNodeIdsInScene = new Set(
|
|
21253
|
+
const validNodeIdsInScene = new Set(
|
|
21254
|
+
validatedNodes.map((node) => String(node.id))
|
|
21255
|
+
);
|
|
21186
21256
|
const validatedLinks = (sceneData.links || []).filter((sceneLink) => {
|
|
21187
|
-
const linkExistsInParent = parentLinkMap.has(
|
|
21257
|
+
const linkExistsInParent = parentLinkMap.has(
|
|
21258
|
+
`${sceneLink.source}-${sceneLink.target}`
|
|
21259
|
+
);
|
|
21188
21260
|
const nodesAreValidForScene = validNodeIdsInScene.has(String(sceneLink.source)) && validNodeIdsInScene.has(String(sceneLink.target));
|
|
21189
21261
|
return linkExistsInParent && nodesAreValidForScene;
|
|
21190
|
-
}).map(
|
|
21262
|
+
}).map(
|
|
21263
|
+
(sceneLink) => parentLinkMap.get(`${sceneLink.source}-${sceneLink.target}`)
|
|
21264
|
+
);
|
|
21191
21265
|
const validatedSceneData = {
|
|
21192
21266
|
...sceneData,
|
|
21193
21267
|
nodes: validatedNodes,
|
|
21194
21268
|
links: validatedLinks,
|
|
21195
|
-
// Re-injetando no validated para que o restante do sistema (e.g. XViewScene local state)
|
|
21196
|
-
// continue acessando as quests sem perceber a separação física
|
|
21197
21269
|
quest_nodes: currentQuestNodes,
|
|
21198
21270
|
quest_links: currentQuestLinks,
|
|
21199
21271
|
milestones: currentMilestones
|
|
@@ -21213,7 +21285,9 @@ async function get_scene_view_data_logic(db_services, scene_config, owner_id, ty
|
|
|
21213
21285
|
isSceneFile: false
|
|
21214
21286
|
});
|
|
21215
21287
|
});
|
|
21216
|
-
const ancestryPromises = ancestryFilePaths.map(
|
|
21288
|
+
const ancestryPromises = ancestryFilePaths.map(
|
|
21289
|
+
(file) => db_services.get_file(file.path)
|
|
21290
|
+
);
|
|
21217
21291
|
const ancestryResults = await Promise.allSettled(ancestryPromises);
|
|
21218
21292
|
const ancestriesFromSceneFile = [];
|
|
21219
21293
|
const ancestriesFromDbFiles = [];
|
|
@@ -21239,15 +21313,21 @@ async function get_scene_view_data_logic(db_services, scene_config, owner_id, ty
|
|
|
21239
21313
|
}
|
|
21240
21314
|
});
|
|
21241
21315
|
const ancestryMap = /* @__PURE__ */ new Map();
|
|
21242
|
-
ancestriesFromDbFiles.forEach(
|
|
21243
|
-
|
|
21316
|
+
ancestriesFromDbFiles.forEach(
|
|
21317
|
+
(anc) => ancestryMap.set(anc.ancestry_id, anc)
|
|
21318
|
+
);
|
|
21319
|
+
ancestriesFromSceneFile.forEach(
|
|
21320
|
+
(anc) => ancestryMap.set(anc.ancestry_id, anc)
|
|
21321
|
+
);
|
|
21244
21322
|
let ancestryData = Array.from(ancestryMap.values());
|
|
21245
21323
|
const externalSourcesToRefresh = /* @__PURE__ */ new Map();
|
|
21246
21324
|
ancestryData.forEach((anc) => {
|
|
21247
21325
|
const targetSourceId = anc._source_file_id || anc._imported_from_view_id;
|
|
21248
21326
|
const targetOwnerId = anc._source_owner_id || anc._imported_from_view_owner_id;
|
|
21249
21327
|
if (targetSourceId && targetSourceId !== scene_config && targetOwnerId) {
|
|
21250
|
-
const isAlreadyLoadedAsParent = parentDbObjects.some(
|
|
21328
|
+
const isAlreadyLoadedAsParent = parentDbObjects.some(
|
|
21329
|
+
(db) => String(db.db_id) === String(targetSourceId)
|
|
21330
|
+
);
|
|
21251
21331
|
if (!isAlreadyLoadedAsParent) {
|
|
21252
21332
|
const key = `${targetOwnerId}/${targetSourceId}`;
|
|
21253
21333
|
externalSourcesToRefresh.set(key, {
|
|
@@ -21288,12 +21368,16 @@ async function get_scene_view_data_logic(db_services, scene_config, owner_id, ty
|
|
|
21288
21368
|
return false;
|
|
21289
21369
|
}
|
|
21290
21370
|
if (externalSourcesToRefresh.has(key) && successfullyFetchedSources.has(key)) {
|
|
21291
|
-
const stillExists = freshAncestryMap.has(
|
|
21371
|
+
const stillExists = freshAncestryMap.has(
|
|
21372
|
+
String(localAnc.ancestry_id)
|
|
21373
|
+
);
|
|
21292
21374
|
return stillExists;
|
|
21293
21375
|
}
|
|
21294
21376
|
return true;
|
|
21295
21377
|
}).map((localAnc) => {
|
|
21296
|
-
const freshVersion = freshAncestryMap.get(
|
|
21378
|
+
const freshVersion = freshAncestryMap.get(
|
|
21379
|
+
String(localAnc.ancestry_id)
|
|
21380
|
+
);
|
|
21297
21381
|
if (freshVersion) {
|
|
21298
21382
|
return {
|
|
21299
21383
|
...freshVersion,
|
|
@@ -21332,7 +21416,9 @@ async function get_scene_view_data_logic(db_services, scene_config, owner_id, ty
|
|
|
21332
21416
|
parallel_branches: validBranches
|
|
21333
21417
|
};
|
|
21334
21418
|
};
|
|
21335
|
-
const originalAncestryDataString = JSON.stringify(
|
|
21419
|
+
const originalAncestryDataString = JSON.stringify(
|
|
21420
|
+
Array.from(ancestryMap.values())
|
|
21421
|
+
);
|
|
21336
21422
|
const cleanedAncestryData = ancestryData.map((ancestry) => {
|
|
21337
21423
|
if (!parentNodeIds.has(String(ancestry.ancestral_node))) return null;
|
|
21338
21424
|
const cleanedTree = pruneTree(ancestry.tree);
|
|
@@ -21352,7 +21438,10 @@ async function get_scene_view_data_logic(db_services, scene_config, owner_id, ty
|
|
|
21352
21438
|
try {
|
|
21353
21439
|
await db_services.save_file(ancestryFilePath, ancestryData);
|
|
21354
21440
|
} catch (saveError) {
|
|
21355
|
-
console.error(
|
|
21441
|
+
console.error(
|
|
21442
|
+
"Falha ao salvar o arquivo de ancestralidade da cena atualizado:",
|
|
21443
|
+
saveError
|
|
21444
|
+
);
|
|
21356
21445
|
}
|
|
21357
21446
|
}
|
|
21358
21447
|
if (!isFullMember) {
|
|
@@ -21360,7 +21449,9 @@ async function get_scene_view_data_logic(db_services, scene_config, owner_id, ty
|
|
|
21360
21449
|
const requiredAncestryIds = /* @__PURE__ */ new Set();
|
|
21361
21450
|
if (focusNodeId) requiredNodeIds.add(String(focusNodeId));
|
|
21362
21451
|
if (focusAncestryId) requiredAncestryIds.add(String(focusAncestryId));
|
|
21363
|
-
const allNodesFromDb = Object.values(parentData).flatMap(
|
|
21452
|
+
const allNodesFromDb = Object.values(parentData).flatMap(
|
|
21453
|
+
(db) => db.nodes || []
|
|
21454
|
+
);
|
|
21364
21455
|
const extractDependenciesFromText = (text) => {
|
|
21365
21456
|
if (!text) return;
|
|
21366
21457
|
const mentionRegex = /\[\[MENTION:node:([a-zA-Z0-9\-_]+)\]\]/g;
|
|
@@ -21387,9 +21478,12 @@ async function get_scene_view_data_logic(db_services, scene_config, owner_id, ty
|
|
|
21387
21478
|
if (branch.linked_ancestry_id) {
|
|
21388
21479
|
requiredAncestryIds.add(String(branch.linked_ancestry_id));
|
|
21389
21480
|
}
|
|
21390
|
-
if (branch.description)
|
|
21481
|
+
if (branch.description)
|
|
21482
|
+
extractDependenciesFromText(branch.description);
|
|
21391
21483
|
if (branch.description_sections) {
|
|
21392
|
-
branch.description_sections.forEach(
|
|
21484
|
+
branch.description_sections.forEach(
|
|
21485
|
+
(s) => extractDependenciesFromText(s.content)
|
|
21486
|
+
);
|
|
21393
21487
|
}
|
|
21394
21488
|
extractTreeDependencies(branch.tree);
|
|
21395
21489
|
});
|
|
@@ -21403,7 +21497,9 @@ async function get_scene_view_data_logic(db_services, scene_config, owner_id, ty
|
|
|
21403
21497
|
if (anc && !anc.is_private) {
|
|
21404
21498
|
if (anc.description) extractDependenciesFromText(anc.description);
|
|
21405
21499
|
if (anc.description_sections) {
|
|
21406
|
-
anc.description_sections.forEach(
|
|
21500
|
+
anc.description_sections.forEach(
|
|
21501
|
+
(s) => extractDependenciesFromText(s.content)
|
|
21502
|
+
);
|
|
21407
21503
|
}
|
|
21408
21504
|
extractTreeDependencies(anc.tree);
|
|
21409
21505
|
extractTreeDependencies(anc.abstraction_tree);
|
|
@@ -21414,22 +21510,38 @@ async function get_scene_view_data_logic(db_services, scene_config, owner_id, ty
|
|
|
21414
21510
|
if (node) {
|
|
21415
21511
|
if (node.description) extractDependenciesFromText(node.description);
|
|
21416
21512
|
if (node.description_sections) {
|
|
21417
|
-
node.description_sections.forEach(
|
|
21513
|
+
node.description_sections.forEach(
|
|
21514
|
+
(s) => extractDependenciesFromText(s.content)
|
|
21515
|
+
);
|
|
21418
21516
|
}
|
|
21419
21517
|
}
|
|
21420
21518
|
});
|
|
21421
21519
|
} while (requiredNodeIds.size + requiredAncestryIds.size > previousSize);
|
|
21422
|
-
const restrictedSceneData = {
|
|
21520
|
+
const restrictedSceneData = {
|
|
21521
|
+
...validatedSceneData,
|
|
21522
|
+
nodes: [],
|
|
21523
|
+
links: []
|
|
21524
|
+
};
|
|
21423
21525
|
const restrictedParentData = {};
|
|
21424
|
-
const restrictedAncestryData = ancestryData.filter(
|
|
21526
|
+
const restrictedAncestryData = ancestryData.filter(
|
|
21527
|
+
(a) => requiredAncestryIds.has(String(a.ancestry_id)) && !a.is_private
|
|
21528
|
+
);
|
|
21425
21529
|
for (const [dbId, dbContent] of Object.entries(parentData)) {
|
|
21426
|
-
const filteredNodes = (dbContent.nodes || []).filter(
|
|
21530
|
+
const filteredNodes = (dbContent.nodes || []).filter(
|
|
21531
|
+
(n) => requiredNodeIds.has(String(n.id))
|
|
21532
|
+
);
|
|
21427
21533
|
if (filteredNodes.length > 0) {
|
|
21428
|
-
restrictedParentData[dbId] = {
|
|
21534
|
+
restrictedParentData[dbId] = {
|
|
21535
|
+
...dbContent,
|
|
21536
|
+
nodes: filteredNodes,
|
|
21537
|
+
links: []
|
|
21538
|
+
};
|
|
21429
21539
|
}
|
|
21430
21540
|
}
|
|
21431
21541
|
if (focusNodeId) {
|
|
21432
|
-
const mainNode = allNodesFromDb.find(
|
|
21542
|
+
const mainNode = allNodesFromDb.find(
|
|
21543
|
+
(n) => String(n.id) === String(focusNodeId)
|
|
21544
|
+
);
|
|
21433
21545
|
if (mainNode) {
|
|
21434
21546
|
restrictedSceneData.nodes = [mainNode];
|
|
21435
21547
|
}
|
|
@@ -21445,7 +21557,11 @@ async function get_scene_view_data_logic(db_services, scene_config, owner_id, ty
|
|
|
21445
21557
|
}
|
|
21446
21558
|
return {
|
|
21447
21559
|
success: true,
|
|
21448
|
-
data: {
|
|
21560
|
+
data: {
|
|
21561
|
+
scene: validatedSceneData,
|
|
21562
|
+
parent: parentData,
|
|
21563
|
+
ancestry: ancestryData
|
|
21564
|
+
}
|
|
21449
21565
|
};
|
|
21450
21566
|
} catch (error) {
|
|
21451
21567
|
console.error("Erro em get_scene_view_data_logic:", error);
|
|
@@ -21465,13 +21581,18 @@ async function import_parent_file_modal_get_logic(db_services, session) {
|
|
|
21465
21581
|
}
|
|
21466
21582
|
};
|
|
21467
21583
|
} catch (error) {
|
|
21468
|
-
console.error(
|
|
21584
|
+
console.error(
|
|
21585
|
+
"catch (error) em import_parent_file_modal_get_logic:",
|
|
21586
|
+
error
|
|
21587
|
+
);
|
|
21469
21588
|
return { success: false, error: error.message };
|
|
21470
21589
|
}
|
|
21471
21590
|
}
|
|
21472
21591
|
async function get_single_parent_file_logic(db_services, file_id, session) {
|
|
21473
21592
|
try {
|
|
21474
|
-
const call_GCP_cloud_storage_get_file = await db_services.get_file(
|
|
21593
|
+
const call_GCP_cloud_storage_get_file = await db_services.get_file(
|
|
21594
|
+
`x_view_dbs/${session.user.id}/${file_id}`
|
|
21595
|
+
);
|
|
21475
21596
|
return call_GCP_cloud_storage_get_file;
|
|
21476
21597
|
} catch (error) {
|
|
21477
21598
|
console.error("catch (error) em get_single_parent_file_logic:", error);
|
|
@@ -21505,7 +21626,13 @@ async function get_ancestry_file_logic(db_services, file_id, owner_id) {
|
|
|
21505
21626
|
async function save_boards_logic(db_services, scene_id, type, boardItems, session, owner_id) {
|
|
21506
21627
|
try {
|
|
21507
21628
|
const targetOwnerId = owner_id || session.user.id;
|
|
21508
|
-
return await db_services.save_boards(
|
|
21629
|
+
return await db_services.save_boards(
|
|
21630
|
+
session,
|
|
21631
|
+
scene_id,
|
|
21632
|
+
type,
|
|
21633
|
+
boardItems,
|
|
21634
|
+
targetOwnerId
|
|
21635
|
+
);
|
|
21509
21636
|
} catch (error) {
|
|
21510
21637
|
console.error("Erro em save_boards_logic:", error);
|
|
21511
21638
|
return { success: false, error: error.message };
|
|
@@ -21534,7 +21661,10 @@ async function delete_uploaded_file_logic(db_services, fileUrl) {
|
|
|
21534
21661
|
async function get_view_members_logic(db_services, ownerId, type, itemId) {
|
|
21535
21662
|
try {
|
|
21536
21663
|
if (!db_services.get_view_members) {
|
|
21537
|
-
return {
|
|
21664
|
+
return {
|
|
21665
|
+
success: false,
|
|
21666
|
+
error: "Servi\xE7o de busca de membros n\xE3o configurado."
|
|
21667
|
+
};
|
|
21538
21668
|
}
|
|
21539
21669
|
return await db_services.get_view_members(ownerId, type, itemId);
|
|
21540
21670
|
} catch (error) {
|