tsv2-library 1.0.61-alpha.122 → 1.0.61-alpha.124

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.
@@ -6544,8 +6544,8 @@ const getLoggedInUser = () => {
6544
6544
  timeFormat: true
6545
6545
  }
6546
6546
  };
6547
- const user2 = localStorage.getItem("user");
6548
- const loggedInUser = user2 ? JSON.parse(user2) : defaultUserSettings;
6547
+ const user = localStorage.getItem("user");
6548
+ const loggedInUser = user ? JSON.parse(user) : defaultUserSettings;
6549
6549
  return loggedInUser;
6550
6550
  };
6551
6551
  const getUserLocale = () => {
@@ -6851,10 +6851,10 @@ const formatDateReadable = (date, maxSeconds) => {
6851
6851
  return "just now";
6852
6852
  };
6853
6853
  const reportErrors = (error, activity) => {
6854
- const user2 = JSON.parse(localStorage.getItem("user") ?? "{}");
6854
+ const user = JSON.parse(localStorage.getItem("user") ?? "{}");
6855
6855
  const userRoles = JSON.parse(localStorage.getItem("user_roles") ?? "{}");
6856
6856
  ({
6857
- ...user2,
6857
+ ...user,
6858
6858
  userRoles
6859
6859
  });
6860
6860
  };
@@ -6917,8 +6917,8 @@ const getFilenameFromResponse = (response) => {
6917
6917
  }
6918
6918
  };
6919
6919
  const getAuthToken = () => {
6920
- const user2 = JSON.parse(localStorage.getItem("user") ?? "{}");
6921
- return user2.jwt ?? user2.token ?? "";
6920
+ const user = JSON.parse(localStorage.getItem("user") ?? "{}");
6921
+ return user.jwt ?? user.token ?? "";
6922
6922
  };
6923
6923
  const fetchFile = async (name) => {
6924
6924
  const token = getAuthToken();
@@ -13150,12 +13150,12 @@ const reLogin$1 = (body) => {
13150
13150
  };
13151
13151
  const AuthAPIs = { reLogin: reLogin$1 };
13152
13152
  const reLogin = async () => {
13153
- const user2 = localStorage.getItem("user");
13154
- if (!user2) {
13153
+ const user = localStorage.getItem("user");
13154
+ if (!user) {
13155
13155
  forceLogout();
13156
13156
  }
13157
13157
  try {
13158
- const parsedUser = JSON.parse(user2);
13158
+ const parsedUser = JSON.parse(user);
13159
13159
  const { token } = parsedUser;
13160
13160
  const response = await AuthAPIs.reLogin({ jwt: token });
13161
13161
  if (response == null ? void 0 : response.data) {
@@ -13342,13 +13342,13 @@ const API$f = ({
13342
13342
  params = {},
13343
13343
  usePrefix = true
13344
13344
  } = {}) => {
13345
- const user2 = JSON.parse(localStorage.getItem("user") ?? "{}");
13345
+ const user = JSON.parse(localStorage.getItem("user") ?? "{}");
13346
13346
  const BASE_URL2 = "https://dev-api.tagsamurai.com/fam";
13347
13347
  const instance = axios.create({
13348
13348
  baseURL: `${BASE_URL2}/assets/v2${usePrefix ? "/assets" : ""}`,
13349
13349
  headers: {
13350
13350
  "Content-type": "application/json",
13351
- "Authorization": `Bearer ${user2.token}`,
13351
+ "Authorization": `Bearer ${user.token}`,
13352
13352
  ...headers
13353
13353
  },
13354
13354
  params
@@ -13428,13 +13428,13 @@ const API$e = ({
13428
13428
  headers = {},
13429
13429
  params = {}
13430
13430
  } = {}) => {
13431
- const user2 = JSON.parse(localStorage.getItem("user") ?? "{}");
13431
+ const user = JSON.parse(localStorage.getItem("user") ?? "{}");
13432
13432
  const BASE_URL2 = "https://dev-api.tagsamurai.com/fam";
13433
13433
  const instance = axios.create({
13434
13434
  baseURL: `${BASE_URL2}/settings-attribute/v2/asset-name`,
13435
13435
  headers: {
13436
13436
  "Content-type": "application/json",
13437
- "Authorization": `Bearer ${user2.token}`,
13437
+ "Authorization": `Bearer ${user.token}`,
13438
13438
  ...headers
13439
13439
  },
13440
13440
  params
@@ -13471,13 +13471,13 @@ const API$d = ({
13471
13471
  headers = {},
13472
13472
  params = {}
13473
13473
  } = {}) => {
13474
- const user2 = JSON.parse(localStorage.getItem("user") ?? "{}");
13474
+ const user = JSON.parse(localStorage.getItem("user") ?? "{}");
13475
13475
  const BASE_URL2 = "https://dev-api.tagsamurai.com/fam";
13476
13476
  const instance = axios.create({
13477
13477
  baseURL: `${BASE_URL2}/settings-attribute/v2/brands`,
13478
13478
  headers: {
13479
13479
  "Content-type": "application/json",
13480
- "Authorization": `Bearer ${user2.token}`,
13480
+ "Authorization": `Bearer ${user.token}`,
13481
13481
  ...headers
13482
13482
  },
13483
13483
  params
@@ -13490,13 +13490,13 @@ const AssetBrandService = {
13490
13490
  }
13491
13491
  };
13492
13492
  const API$c = ({ headers = {}, params = {} } = {}) => {
13493
- const user2 = JSON.parse(localStorage.getItem("user")) ?? {};
13493
+ const user = JSON.parse(localStorage.getItem("user")) ?? {};
13494
13494
  const BASE_URL2 = "https://dev-api.tagsamurai.com/fam";
13495
13495
  const instance = axios.create({
13496
13496
  baseURL: `${BASE_URL2}/disposal/v2`,
13497
13497
  headers: {
13498
13498
  "Content-type": "application/json",
13499
- "Authorization": `Bearer ${user2.token}`,
13499
+ "Authorization": `Bearer ${user.token}`,
13500
13500
  ...headers
13501
13501
  },
13502
13502
  params
@@ -13519,13 +13519,13 @@ const API$b = ({
13519
13519
  headers = {},
13520
13520
  params = {}
13521
13521
  } = {}) => {
13522
- const user2 = JSON.parse(localStorage.getItem("user") ?? "{}");
13522
+ const user = JSON.parse(localStorage.getItem("user") ?? "{}");
13523
13523
  const BASE_URL2 = "https://dev-api.tagsamurai.com/fam";
13524
13524
  const instance = axios.create({
13525
13525
  baseURL: `${BASE_URL2}/settings-attribute/v2/`,
13526
13526
  headers: {
13527
13527
  "Content-type": "application/json",
13528
- "Authorization": `Bearer ${user2.token}`,
13528
+ "Authorization": `Bearer ${user.token}`,
13529
13529
  ...headers
13530
13530
  },
13531
13531
  params
@@ -13543,12 +13543,12 @@ const TreeServices = {
13543
13543
  }
13544
13544
  };
13545
13545
  const API$a = ({ headers = {}, params = {} } = {}) => {
13546
- const user2 = JSON.parse(localStorage.getItem("user") ?? "{}");
13546
+ const user = JSON.parse(localStorage.getItem("user") ?? "{}");
13547
13547
  const instance = axios.create({
13548
13548
  baseURL: "https://dev-api.tagsamurai.com/fam/routine/v2/",
13549
13549
  headers: {
13550
13550
  "Content-type": "application/json",
13551
- "Authorization": `Bearer ${user2.token}`,
13551
+ "Authorization": `Bearer ${user.token}`,
13552
13552
  ...headers
13553
13553
  },
13554
13554
  params
@@ -27262,11 +27262,11 @@ const VueHtmlToPaper = {
27262
27262
  const apiEnv = "https://dev-api.tagsamurai.com/fam";
27263
27263
  const BASE_URL = window.Cypress ? "https://localhost:9080" : apiEnv;
27264
27264
  const api = ({ headers = {}, params = {} } = {}) => {
27265
- const user2 = JSON.parse(localStorage.getItem("user") ?? "{}");
27265
+ const user = JSON.parse(localStorage.getItem("user") ?? "{}");
27266
27266
  const instance = axios.create({
27267
27267
  baseURL: `${BASE_URL}/transfer/v2/transaction`,
27268
27268
  headers: {
27269
- "Authorization": `Bearer ${user2.token}`,
27269
+ "Authorization": `Bearer ${user.token}`,
27270
27270
  "Content-type": "application/json",
27271
27271
  ...headers
27272
27272
  },
@@ -27592,13 +27592,13 @@ const getBaseURL$1 = (env) => {
27592
27592
  return process.env["VUE_" + env];
27593
27593
  };
27594
27594
  const API$9 = ({ headers = {}, params = {} } = {}) => {
27595
- const user2 = JSON.parse(localStorage.getItem("user")) ?? {};
27595
+ const user = JSON.parse(localStorage.getItem("user")) ?? {};
27596
27596
  const BASE_URL2 = getBaseURL$1("APP_TAGSAMURAI_API");
27597
27597
  const instance = axios.create({
27598
27598
  baseURL: `${BASE_URL2}/repair/v2/damage`,
27599
27599
  headers: {
27600
27600
  "Content-type": "application/json",
27601
- "Authorization": `Bearer ${user2.token}`,
27601
+ "Authorization": `Bearer ${user.token}`,
27602
27602
  ...headers
27603
27603
  },
27604
27604
  params
@@ -27911,13 +27911,13 @@ const getBaseURL = (env) => {
27911
27911
  return process.env["VUE_" + env];
27912
27912
  };
27913
27913
  const API$8 = ({ headers = {}, params = {} } = {}) => {
27914
- const user2 = JSON.parse(localStorage.getItem("user")) ?? {};
27914
+ const user = JSON.parse(localStorage.getItem("user")) ?? {};
27915
27915
  const BASE_URL2 = getBaseURL("APP_TAGSAMURAI_API");
27916
27916
  const instance = axios.create({
27917
27917
  baseURL: `${BASE_URL2}/tracking/v2/missing`,
27918
27918
  headers: {
27919
27919
  "Content-type": "application/json",
27920
- "Authorization": `Bearer ${user2.token}`,
27920
+ "Authorization": `Bearer ${user.token}`,
27921
27921
  ...headers
27922
27922
  },
27923
27923
  params
@@ -36322,13 +36322,13 @@ const getErrorCode = (error) => {
36322
36322
  return void 0;
36323
36323
  };
36324
36324
  const API$7 = ({ headers = {}, params = {} } = {}) => {
36325
- const user2 = JSON.parse(localStorage.getItem("user")) ?? {};
36325
+ const user = JSON.parse(localStorage.getItem("user")) ?? {};
36326
36326
  const BASE_URL2 = "https://dev-api.tagsamurai.com/fam";
36327
36327
  const instance = axios.create({
36328
36328
  baseURL: `${BASE_URL2}/iot/v2`,
36329
36329
  headers: {
36330
36330
  "Content-type": "application/json",
36331
- "Authorization": `Bearer ${user2.token}`,
36331
+ "Authorization": `Bearer ${user.token}`,
36332
36332
  ...headers
36333
36333
  },
36334
36334
  params
@@ -36699,13 +36699,13 @@ const API$6 = ({
36699
36699
  headers = {},
36700
36700
  params = {}
36701
36701
  } = {}) => {
36702
- const user2 = JSON.parse(localStorage.getItem("user") ?? "{}");
36702
+ const user = JSON.parse(localStorage.getItem("user") ?? "{}");
36703
36703
  const BASE_URL2 = "https://dev-api.tagsamurai.com/fam";
36704
36704
  const instance = axios.create({
36705
36705
  baseURL: `${BASE_URL2}/tag/v2/scan-log`,
36706
36706
  headers: {
36707
36707
  "Content-type": "application/json",
36708
- "Authorization": `Bearer ${user2.token}`,
36708
+ "Authorization": `Bearer ${user.token}`,
36709
36709
  ...headers
36710
36710
  },
36711
36711
  params
@@ -51742,8 +51742,9 @@ function cloneDeep(value) {
51742
51742
  }
51743
51743
  var cloneDeep_1 = cloneDeep;
51744
51744
  const cloneDeep$1 = /* @__PURE__ */ getDefaultExportFromCjs(cloneDeep_1);
51745
- const user = JSON.parse(localStorage.getItem("user") ?? "{}");
51745
+ const getUser = () => JSON.parse(localStorage.getItem("user") ?? "{}");
51746
51746
  const API$5 = ({ headers = {}, params = {} } = {}) => {
51747
+ const user = getUser();
51747
51748
  const BASE_URL2 = "https://dev-api.global-settings.tagsamurai.com";
51748
51749
  const instance = axios.create({
51749
51750
  baseURL: `${BASE_URL2}/v1/global-settings`,
@@ -51758,26 +51759,34 @@ const API$5 = ({ headers = {}, params = {} } = {}) => {
51758
51759
  };
51759
51760
  const ColumnServices = {
51760
51761
  getColumnSetup: (tableId) => {
51762
+ const user = getUser();
51761
51763
  return API$5().get(`/columns/${user._id}/${tableId}`);
51762
51764
  },
51763
51765
  editColumnSetup: (tableId, body) => {
51766
+ const user = getUser();
51764
51767
  return API$5().put(`/columns/${user._id}/${tableId}`, { data: body });
51765
51768
  }
51766
51769
  };
51767
51770
  async function readConfig(tableId, defaultColumns) {
51768
- const {
51769
- data: { data: tableConfig }
51770
- } = await ColumnServices.getColumnSetup(tableId);
51771
- if (tableConfig) {
51772
- return tableConfig.map((conf) => {
51773
- const foundCol = defaultColumns.find((col) => col.field === conf.field);
51774
- if (!foundCol || foundCol.visible === false)
51775
- return void 0;
51776
- return {
51777
- ...foundCol,
51778
- ...conf
51779
- };
51780
- }).filter((col) => !!col);
51771
+ try {
51772
+ const {
51773
+ data: { data: tableConfig }
51774
+ } = await ColumnServices.getColumnSetup(tableId);
51775
+ if (tableConfig && tableConfig.length > 0) {
51776
+ return tableConfig.map((conf) => {
51777
+ const foundCol = defaultColumns.find(
51778
+ (col) => col.field === conf.field
51779
+ );
51780
+ if (!foundCol || foundCol.visible === false)
51781
+ return void 0;
51782
+ return {
51783
+ ...foundCol,
51784
+ ...conf
51785
+ };
51786
+ }).filter((col) => !!col);
51787
+ }
51788
+ } catch (error) {
51789
+ console.error(error);
51781
51790
  }
51782
51791
  return defaultColumns;
51783
51792
  }
@@ -52023,12 +52032,15 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
52023
52032
  field: col.field,
52024
52033
  width: col.width ?? "max-content",
52025
52034
  visible: col.visible !== false,
52026
- fixed: !!col.fixed,
52027
52035
  pinned: !!col.pinned
52028
52036
  };
52029
52037
  }
52030
52038
  );
52031
- await ColumnServices.editColumnSetup(props.tableId, columnsConfig);
52039
+ try {
52040
+ await ColumnServices.editColumnSetup(props.tableId, columnsConfig);
52041
+ } catch (error) {
52042
+ console.error(error);
52043
+ }
52032
52044
  }
52033
52045
  };
52034
52046
  const teleportColumnList = (source, target) => {
@@ -52835,12 +52847,15 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
52835
52847
  return {
52836
52848
  field: column.field,
52837
52849
  visible: column.visible !== false,
52838
- fixed: !!column.fixed,
52839
52850
  pinned: !!column.pinned,
52840
52851
  width: colElement ? getComputedStyle(colElement).width : column.width ?? "max-content"
52841
52852
  };
52842
52853
  });
52843
- await ColumnServices.editColumnSetup(dataTableID.value, columnConfig);
52854
+ try {
52855
+ await ColumnServices.editColumnSetup(dataTableID.value, columnConfig);
52856
+ } catch (error) {
52857
+ console.error(error);
52858
+ }
52844
52859
  }
52845
52860
  };
52846
52861
  const getColumnStyle = (col) => {
@@ -64582,8 +64597,8 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
64582
64597
  const roleData = props.user ?? props.asset;
64583
64598
  if (!roleData)
64584
64599
  return [];
64585
- const user2 = JSON.parse(localStorage.user ?? "{}");
64586
- const companyAddons = user2.addOn;
64600
+ const user = JSON.parse(localStorage.user ?? "{}");
64601
+ const companyAddons = user.addOn;
64587
64602
  const transaction = [
64588
64603
  {
64589
64604
  label: "Borrowing",
@@ -69047,13 +69062,13 @@ const API$4 = ({
69047
69062
  headers = {},
69048
69063
  params = {}
69049
69064
  } = {}) => {
69050
- const user2 = JSON.parse(localStorage.getItem("user") ?? "{}");
69065
+ const user = JSON.parse(localStorage.getItem("user") ?? "{}");
69051
69066
  const BASE_URL2 = "https://dev-api.tagsamurai.com/fam";
69052
69067
  const instance = axios.create({
69053
69068
  baseURL: `${BASE_URL2}/tag/v2/qr`,
69054
69069
  headers: {
69055
69070
  "Content-type": "application/json",
69056
- "Authorization": `Bearer ${user2.token}`,
69071
+ "Authorization": `Bearer ${user.token}`,
69057
69072
  ...headers
69058
69073
  },
69059
69074
  params
@@ -69465,12 +69480,12 @@ const API$3 = ({
69465
69480
  headers = {},
69466
69481
  params = {}
69467
69482
  } = {}) => {
69468
- const user2 = JSON.parse(localStorage.getItem("user") ?? "{}");
69483
+ const user = JSON.parse(localStorage.getItem("user") ?? "{}");
69469
69484
  const BASE_URL2 = "https://dev-api.tagsamurai.com/fam";
69470
69485
  const instance = axios.create({
69471
69486
  baseURL: `${BASE_URL2}/damage-repair-ticketing/v2/damage`,
69472
69487
  headers: {
69473
- Authorization: `Bearer ${user2.token}`,
69488
+ Authorization: `Bearer ${user.token}`,
69474
69489
  ...headers
69475
69490
  },
69476
69491
  params
@@ -69767,13 +69782,13 @@ const API$2 = ({
69767
69782
  headers = {},
69768
69783
  params = {}
69769
69784
  } = {}) => {
69770
- const user2 = JSON.parse(localStorage.getItem("user") ?? "{}");
69785
+ const user = JSON.parse(localStorage.getItem("user") ?? "{}");
69771
69786
  const BASE_URL2 = "https://dev-api.tagsamurai.com/fam";
69772
69787
  const instance = axios.create({
69773
69788
  baseURL: `${BASE_URL2}/missing-tracking/v2/missing`,
69774
69789
  headers: {
69775
69790
  "Content-type": "application/json",
69776
- "Authorization": `Bearer ${user2.token}`,
69791
+ "Authorization": `Bearer ${user.token}`,
69777
69792
  ...headers
69778
69793
  },
69779
69794
  params
@@ -69790,13 +69805,13 @@ const API$1 = ({
69790
69805
  headers = {},
69791
69806
  params = {}
69792
69807
  } = {}) => {
69793
- const user2 = JSON.parse(localStorage.getItem("user") ?? "{}");
69808
+ const user = JSON.parse(localStorage.getItem("user") ?? "{}");
69794
69809
  const BASE_URL2 = "https://dev-api.tagsamurai.com/fam";
69795
69810
  const instance = axios.create({
69796
69811
  baseURL: `${BASE_URL2}/missing-tracking/v2/tracking`,
69797
69812
  headers: {
69798
69813
  "Content-type": "application/json",
69799
- "Authorization": `Bearer ${user2.token}`,
69814
+ "Authorization": `Bearer ${user.token}`,
69800
69815
  ...headers
69801
69816
  },
69802
69817
  params
@@ -69949,13 +69964,13 @@ const API = ({
69949
69964
  headers = {},
69950
69965
  params = {}
69951
69966
  } = {}) => {
69952
- const user2 = JSON.parse(localStorage.getItem("user") ?? "{}");
69967
+ const user = JSON.parse(localStorage.getItem("user") ?? "{}");
69953
69968
  const BASE_URL2 = "https://dev-api.tagsamurai.com/fam";
69954
69969
  const instance = axios.create({
69955
69970
  baseURL: `${BASE_URL2}/tag/v2/tag-transaction`,
69956
69971
  headers: {
69957
69972
  "Content-type": "application/json",
69958
- "Authorization": `Bearer ${user2.token}`,
69973
+ "Authorization": `Bearer ${user.token}`,
69959
69974
  ...headers
69960
69975
  },
69961
69976
  params