@lv-x-software-house/x_view 1.2.8-dev.13 → 1.2.8-dev.15

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 CHANGED
@@ -2302,9 +2302,10 @@ var userActionHandlers = {
2302
2302
  }
2303
2303
  },
2304
2304
  handleSaveNodeDetails: async (context, updatedNode, keepOpen = false) => {
2305
- var _a, _b, _c;
2305
+ var _a, _b, _c, _d;
2306
2306
  const { graphDataRef, sceneDataRef, stateRef, setters } = context;
2307
2307
  if (!graphDataRef.current || !sceneDataRef.current) return;
2308
+ const isView = ((_a = context.viewType) == null ? void 0 : _a.toLowerCase()) === "view";
2308
2309
  const {
2309
2310
  _baseEmissiveIntensity,
2310
2311
  _baseScale,
@@ -2349,7 +2350,7 @@ var userActionHandlers = {
2349
2350
  const oldNode = specificParentData.nodes[nodeIndex];
2350
2351
  const isNewDone = oldNode.status !== "Done" && nodeToSave.status === "Done";
2351
2352
  specificParentData.nodes[nodeIndex] = { ...nodeToSave };
2352
- if (isNewDone && nodeToSave.is_quest && ((_a = nodeToSave.recurrence_config) == null ? void 0 : _a.enabled)) {
2353
+ if (isNewDone && nodeToSave.is_quest && ((_b = nodeToSave.recurrence_config) == null ? void 0 : _b.enabled)) {
2353
2354
  const nextDateObj = calculateNextRecurrenceDate(
2354
2355
  nodeToSave.recurrence_config
2355
2356
  );
@@ -2394,7 +2395,7 @@ var userActionHandlers = {
2394
2395
  ],
2395
2396
  version_node: {
2396
2397
  is_version: true,
2397
- parent_node: ((_b = nodeToSave.version_node) == null ? void 0 : _b.parent_node) || nodeToSave.id
2398
+ parent_node: ((_c = nodeToSave.version_node) == null ? void 0 : _c.parent_node) || nodeToSave.id
2398
2399
  },
2399
2400
  reviewStack: (nodeToSave.reviewStack || []).map((r) => ({
2400
2401
  ...r,
@@ -2402,16 +2403,38 @@ var userActionHandlers = {
2402
2403
  })),
2403
2404
  recurrence_config: nextRecurrenceConfig
2404
2405
  };
2406
+ const rootId = ((_d = nodeToSave.version_node) == null ? void 0 : _d.parent_node) || nodeToSave.id;
2407
+ const nextQuestLink = {
2408
+ id: `link_${import_short_uuid.default.generate()}`,
2409
+ source: rootId,
2410
+ target: nextQuestNode.id
2411
+ };
2405
2412
  await context.actions.upsert_quest_firestore(
2406
2413
  context.ownerId,
2407
2414
  context.sceneConfigId,
2408
2415
  nextQuestNode
2409
2416
  );
2417
+ await context.actions.upsert_quest_link_firestore(
2418
+ context.ownerId,
2419
+ context.sceneConfigId,
2420
+ nextQuestLink
2421
+ );
2410
2422
  await context.actions.update_view_counter(
2411
2423
  context.ownerId,
2412
2424
  context.sceneConfigId,
2413
2425
  nextCounter
2414
2426
  );
2427
+ if (specificParentData.links) {
2428
+ specificParentData.links.push(nextQuestLink);
2429
+ }
2430
+ if (specificParentData.nodes) {
2431
+ specificParentData.nodes.push(nextQuestNode);
2432
+ }
2433
+ if (isView && parentFileId === context.sceneConfigId) {
2434
+ if (!sceneDataRef.current.links) sceneDataRef.current.links = [];
2435
+ sceneDataRef.current.links.push(nextQuestLink);
2436
+ sceneDataRef.current.quest_nodes = [...specificParentData.nodes];
2437
+ }
2415
2438
  if (stateRef.current.nodeObjects[String(nodeToSave.id)]) {
2416
2439
  const oldMeshPosition = stateRef.current.nodeObjects[String(nodeToSave.id)].position.clone();
2417
2440
  setTimeout(() => {
@@ -2430,7 +2453,6 @@ var userActionHandlers = {
2430
2453
  }
2431
2454
  }
2432
2455
  try {
2433
- const isView = ((_c = context.viewType) == null ? void 0 : _c.toLowerCase()) === "view";
2434
2456
  if (isView && parentFileId === context.sceneConfigId) {
2435
2457
  const visualNodeIndex = sceneDataRef.current.nodes.findIndex(
2436
2458
  (n) => String(n.id) === String(nodeToSave.id)
package/dist/index.mjs CHANGED
@@ -2263,9 +2263,10 @@ var userActionHandlers = {
2263
2263
  }
2264
2264
  },
2265
2265
  handleSaveNodeDetails: async (context, updatedNode, keepOpen = false) => {
2266
- var _a, _b, _c;
2266
+ var _a, _b, _c, _d;
2267
2267
  const { graphDataRef, sceneDataRef, stateRef, setters } = context;
2268
2268
  if (!graphDataRef.current || !sceneDataRef.current) return;
2269
+ const isView = ((_a = context.viewType) == null ? void 0 : _a.toLowerCase()) === "view";
2269
2270
  const {
2270
2271
  _baseEmissiveIntensity,
2271
2272
  _baseScale,
@@ -2310,7 +2311,7 @@ var userActionHandlers = {
2310
2311
  const oldNode = specificParentData.nodes[nodeIndex];
2311
2312
  const isNewDone = oldNode.status !== "Done" && nodeToSave.status === "Done";
2312
2313
  specificParentData.nodes[nodeIndex] = { ...nodeToSave };
2313
- if (isNewDone && nodeToSave.is_quest && ((_a = nodeToSave.recurrence_config) == null ? void 0 : _a.enabled)) {
2314
+ if (isNewDone && nodeToSave.is_quest && ((_b = nodeToSave.recurrence_config) == null ? void 0 : _b.enabled)) {
2314
2315
  const nextDateObj = calculateNextRecurrenceDate(
2315
2316
  nodeToSave.recurrence_config
2316
2317
  );
@@ -2355,7 +2356,7 @@ var userActionHandlers = {
2355
2356
  ],
2356
2357
  version_node: {
2357
2358
  is_version: true,
2358
- parent_node: ((_b = nodeToSave.version_node) == null ? void 0 : _b.parent_node) || nodeToSave.id
2359
+ parent_node: ((_c = nodeToSave.version_node) == null ? void 0 : _c.parent_node) || nodeToSave.id
2359
2360
  },
2360
2361
  reviewStack: (nodeToSave.reviewStack || []).map((r) => ({
2361
2362
  ...r,
@@ -2363,16 +2364,38 @@ var userActionHandlers = {
2363
2364
  })),
2364
2365
  recurrence_config: nextRecurrenceConfig
2365
2366
  };
2367
+ const rootId = ((_d = nodeToSave.version_node) == null ? void 0 : _d.parent_node) || nodeToSave.id;
2368
+ const nextQuestLink = {
2369
+ id: `link_${short.generate()}`,
2370
+ source: rootId,
2371
+ target: nextQuestNode.id
2372
+ };
2366
2373
  await context.actions.upsert_quest_firestore(
2367
2374
  context.ownerId,
2368
2375
  context.sceneConfigId,
2369
2376
  nextQuestNode
2370
2377
  );
2378
+ await context.actions.upsert_quest_link_firestore(
2379
+ context.ownerId,
2380
+ context.sceneConfigId,
2381
+ nextQuestLink
2382
+ );
2371
2383
  await context.actions.update_view_counter(
2372
2384
  context.ownerId,
2373
2385
  context.sceneConfigId,
2374
2386
  nextCounter
2375
2387
  );
2388
+ if (specificParentData.links) {
2389
+ specificParentData.links.push(nextQuestLink);
2390
+ }
2391
+ if (specificParentData.nodes) {
2392
+ specificParentData.nodes.push(nextQuestNode);
2393
+ }
2394
+ if (isView && parentFileId === context.sceneConfigId) {
2395
+ if (!sceneDataRef.current.links) sceneDataRef.current.links = [];
2396
+ sceneDataRef.current.links.push(nextQuestLink);
2397
+ sceneDataRef.current.quest_nodes = [...specificParentData.nodes];
2398
+ }
2376
2399
  if (stateRef.current.nodeObjects[String(nodeToSave.id)]) {
2377
2400
  const oldMeshPosition = stateRef.current.nodeObjects[String(nodeToSave.id)].position.clone();
2378
2401
  setTimeout(() => {
@@ -2391,7 +2414,6 @@ var userActionHandlers = {
2391
2414
  }
2392
2415
  }
2393
2416
  try {
2394
- const isView = ((_c = context.viewType) == null ? void 0 : _c.toLowerCase()) === "view";
2395
2417
  if (isView && parentFileId === context.sceneConfigId) {
2396
2418
  const visualNodeIndex = sceneDataRef.current.nodes.findIndex(
2397
2419
  (n) => String(n.id) === String(nodeToSave.id)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lv-x-software-house/x_view",
3
- "version": "1.2.8-dev.13",
3
+ "version": "1.2.8-dev.15",
4
4
  "description": "Pacote privado contendo os componentes e lógica de renderização 3D do X View.",
5
5
  "author": "iv.x - Engenharia de Software - ivxsoftwarehouse@gmail.com",
6
6
  "license": "UNLICENSED",