@lv-x-software-house/x_view 1.2.6-dev.67 → 1.2.6-dev.68

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
@@ -14928,6 +14928,18 @@ function MilestoneManager({
14928
14928
  // src/XViewScene.jsx
14929
14929
  var import_short_uuid2 = __toESM(require("short-uuid"));
14930
14930
  var secretKey = process.env.NEXT_PUBLIC_CRYPTO_KEY;
14931
+ var encryptData = (data) => {
14932
+ try {
14933
+ const encrypted = import_crypto_js.default.AES.encrypt(
14934
+ JSON.stringify(data),
14935
+ secretKey
14936
+ ).toString().replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
14937
+ return encrypted;
14938
+ } catch (error) {
14939
+ console.error("Falha ao encriptar os dados:", error);
14940
+ return null;
14941
+ }
14942
+ };
14931
14943
  var decryptData = (encryptedText) => {
14932
14944
  try {
14933
14945
  let base64Text = encryptedText.replace(/-/g, "+").replace(/_/g, "/");
@@ -15258,7 +15270,14 @@ function XViewScene({
15258
15270
  const handleNavigateBack = (0, import_react32.useCallback)(() => {
15259
15271
  const type = viewParams == null ? void 0 : viewParams.type;
15260
15272
  const tab = type === "database" ? "datasets" : "views";
15261
- router.push(`/dashboard/xview?tab=${tab}`);
15273
+ const targetUrl = `/dashboard/xview?tab=${tab}`;
15274
+ console.log("X-View: Navegando para o Dashboard", { type, tab, targetUrl });
15275
+ try {
15276
+ router.push(targetUrl);
15277
+ } catch (e) {
15278
+ console.warn("X-View: router.push falhou, tentando window.location", e);
15279
+ window.location.href = targetUrl;
15280
+ }
15262
15281
  }, [router, viewParams]);
15263
15282
  const handleConfirmImport = (0, import_react32.useCallback)(
15264
15283
  async (importPayload) => {
@@ -15395,12 +15414,25 @@ function XViewScene({
15395
15414
  sceneDataRef.current = updatedData;
15396
15415
  try {
15397
15416
  await save_view_data(sceneSaveUrl, updatedData);
15417
+ if (viewParams) {
15418
+ const newDataToEncrypt = {
15419
+ ...viewParams,
15420
+ ...newConfig
15421
+ };
15422
+ const newEncrypted = encryptData(newDataToEncrypt);
15423
+ if (newEncrypted) {
15424
+ const currentUrl = window.location.pathname;
15425
+ const newUrl = currentUrl.replace(encryptedConfig, newEncrypted);
15426
+ window.history.replaceState(null, "", newUrl);
15427
+ console.log("X-View Config: URL atualizada para persist\xEAncia.");
15428
+ }
15429
+ }
15398
15430
  setSceneVersion((v) => v + 1);
15399
15431
  } catch (error) {
15400
15432
  console.error("Erro ao salvar configura\xE7\xE3o da View:", error);
15401
15433
  }
15402
15434
  },
15403
- [save_view_data, sceneSaveUrl]
15435
+ [save_view_data, sceneSaveUrl, viewParams, encryptedConfig]
15404
15436
  );
15405
15437
  const handleOpenImageViewer = (images, startIndex) => {
15406
15438
  setImageViewer({ visible: true, images, startIndex });
package/dist/index.mjs CHANGED
@@ -14985,6 +14985,18 @@ function MilestoneManager({
14985
14985
  // src/XViewScene.jsx
14986
14986
  import short2 from "short-uuid";
14987
14987
  var secretKey = process.env.NEXT_PUBLIC_CRYPTO_KEY;
14988
+ var encryptData = (data) => {
14989
+ try {
14990
+ const encrypted = CryptoJS.AES.encrypt(
14991
+ JSON.stringify(data),
14992
+ secretKey
14993
+ ).toString().replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
14994
+ return encrypted;
14995
+ } catch (error) {
14996
+ console.error("Falha ao encriptar os dados:", error);
14997
+ return null;
14998
+ }
14999
+ };
14988
15000
  var decryptData = (encryptedText) => {
14989
15001
  try {
14990
15002
  let base64Text = encryptedText.replace(/-/g, "+").replace(/_/g, "/");
@@ -15315,7 +15327,14 @@ function XViewScene({
15315
15327
  const handleNavigateBack = useCallback6(() => {
15316
15328
  const type = viewParams == null ? void 0 : viewParams.type;
15317
15329
  const tab = type === "database" ? "datasets" : "views";
15318
- router.push(`/dashboard/xview?tab=${tab}`);
15330
+ const targetUrl = `/dashboard/xview?tab=${tab}`;
15331
+ console.log("X-View: Navegando para o Dashboard", { type, tab, targetUrl });
15332
+ try {
15333
+ router.push(targetUrl);
15334
+ } catch (e) {
15335
+ console.warn("X-View: router.push falhou, tentando window.location", e);
15336
+ window.location.href = targetUrl;
15337
+ }
15319
15338
  }, [router, viewParams]);
15320
15339
  const handleConfirmImport = useCallback6(
15321
15340
  async (importPayload) => {
@@ -15452,12 +15471,25 @@ function XViewScene({
15452
15471
  sceneDataRef.current = updatedData;
15453
15472
  try {
15454
15473
  await save_view_data(sceneSaveUrl, updatedData);
15474
+ if (viewParams) {
15475
+ const newDataToEncrypt = {
15476
+ ...viewParams,
15477
+ ...newConfig
15478
+ };
15479
+ const newEncrypted = encryptData(newDataToEncrypt);
15480
+ if (newEncrypted) {
15481
+ const currentUrl = window.location.pathname;
15482
+ const newUrl = currentUrl.replace(encryptedConfig, newEncrypted);
15483
+ window.history.replaceState(null, "", newUrl);
15484
+ console.log("X-View Config: URL atualizada para persist\xEAncia.");
15485
+ }
15486
+ }
15455
15487
  setSceneVersion((v) => v + 1);
15456
15488
  } catch (error) {
15457
15489
  console.error("Erro ao salvar configura\xE7\xE3o da View:", error);
15458
15490
  }
15459
15491
  },
15460
- [save_view_data, sceneSaveUrl]
15492
+ [save_view_data, sceneSaveUrl, viewParams, encryptedConfig]
15461
15493
  );
15462
15494
  const handleOpenImageViewer = (images, startIndex) => {
15463
15495
  setImageViewer({ visible: true, images, startIndex });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lv-x-software-house/x_view",
3
- "version": "1.2.6-dev.67",
3
+ "version": "1.2.6-dev.68",
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",