akeyless-client-commons 1.1.70 → 1.1.72

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.
@@ -350,7 +350,7 @@ var import_app = require("firebase/app");
350
350
  var import_storage = require("firebase/storage");
351
351
  var import_auth = require("firebase/auth");
352
352
  var import_app_check = require("firebase/app-check");
353
- var import_firestore = require("firebase/firestore");
353
+ var import_firestore2 = require("firebase/firestore");
354
354
  var import_react = require("react");
355
355
  // src/helpers/phoneNumber.ts
356
356
  var import_libphonenumber_js = require("libphonenumber-js");
@@ -375,6 +375,10 @@ var checkUserPermissions = function(userPermissions, entity, permissions, mode2)
375
375
  checkUserPermissions({}, "dashboard", []);
376
376
  // src/helpers/firebase.ts
377
377
  var import_storage2 = require("firebase/storage");
378
+ // src/helpers/time_helpers.ts
379
+ var import_firestore = require("firebase/firestore");
380
+ var import_moment_timezone = __toESM(require("moment-timezone"));
381
+ // src/helpers/firebase.ts
378
382
  var import_meta = {};
379
383
  var initApp = function() {
380
384
  var isNodeEnv2 = typeof process !== "undefined" && process.env;
@@ -390,7 +394,7 @@ var initApp = function() {
390
394
  var app2 = (0, import_app.initializeApp)(firebaseConfig);
391
395
  var auth2 = (0, import_auth.getAuth)(app2);
392
396
  auth2.settings.appVerificationDisabledForTesting = false;
393
- var db2 = (0, import_firestore.getFirestore)(app2);
397
+ var db2 = (0, import_firestore2.getFirestore)(app2);
394
398
  var storage2 = (0, import_storage.getStorage)(app2);
395
399
  var googleLoginProvider2 = new import_auth.GoogleAuthProvider();
396
400
  var recaptchaSiteKey = isNodeEnv2 ? process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY : import_meta.env.VITE_RECAPTCHA_SITE_KEY;
@@ -415,33 +419,33 @@ var initApp = function() {
415
419
  };
416
420
  var _initApp = initApp(), db = _initApp.db, auth = _initApp.auth, storage = _initApp.storage, app = _initApp.app, appCheck = _initApp.appCheck, googleLoginProvider = _initApp.googleLoginProvider;
417
421
  var collections = {
418
- clients: (0, import_firestore.collection)(db, "nx-clients"),
419
- sites: (0, import_firestore.collection)(db, "nx-sites"),
420
- cars: (0, import_firestore.collection)(db, "units"),
421
- users: (0, import_firestore.collection)(db, "nx-users"),
422
- lastLocations: (0, import_firestore.collection)(db, "last_locations"),
423
- ermEvents: (0, import_firestore.collection)(db, "erm_events_general"),
424
- erm2Events: (0, import_firestore.collection)(db, "erm2_events_general"),
425
- ruptelaEvents: (0, import_firestore.collection)(db, "ruptela_events_general"),
426
- polygons: (0, import_firestore.collection)(db, "nx-polygons"),
427
- polygonEvents: (0, import_firestore.collection)(db, "polygon_events"),
428
- polygonCars: (0, import_firestore.collection)(db, "polygon_cars"),
429
- canbus: (0, import_firestore.collection)(db, "erm_canbus_parameters"),
430
- states: (0, import_firestore.collection)(db, "erm_states"),
431
- app_pro_commands_queue: (0, import_firestore.collection)(db, "app_pro_commands_queue"),
432
- trips: (0, import_firestore.collection)(db, "erm2_trip"),
433
- tripsDetails: (0, import_firestore.collection)(db, "erm2_trip_details"),
434
- audit: (0, import_firestore.collection)(db, "nx-audit"),
435
- nx_settings: (0, import_firestore.collection)(db, "nx-settings"),
436
- settings: (0, import_firestore.collection)(db, "settings"),
437
- translations: (0, import_firestore.collection)(db, "nx-translations"),
438
- nx_cars: (0, import_firestore.collection)(db, "nx-cars"),
439
- boards: (0, import_firestore.collection)(db, "boards"),
440
- protection_types: (0, import_firestore.collection)(db, "protectionTypes"),
441
- board_types: (0, import_firestore.collection)(db, "boardTypes"),
442
- charge_capacities: (0, import_firestore.collection)(db, "nx-charge-capacities")
422
+ clients: (0, import_firestore2.collection)(db, "nx-clients"),
423
+ sites: (0, import_firestore2.collection)(db, "nx-sites"),
424
+ cars: (0, import_firestore2.collection)(db, "units"),
425
+ users: (0, import_firestore2.collection)(db, "nx-users"),
426
+ lastLocations: (0, import_firestore2.collection)(db, "last_locations"),
427
+ ermEvents: (0, import_firestore2.collection)(db, "erm_events_general"),
428
+ erm2Events: (0, import_firestore2.collection)(db, "erm2_events_general"),
429
+ ruptelaEvents: (0, import_firestore2.collection)(db, "ruptela_events_general"),
430
+ polygons: (0, import_firestore2.collection)(db, "nx-polygons"),
431
+ polygonEvents: (0, import_firestore2.collection)(db, "polygon_events"),
432
+ polygonCars: (0, import_firestore2.collection)(db, "polygon_cars"),
433
+ canbus: (0, import_firestore2.collection)(db, "erm_canbus_parameters"),
434
+ states: (0, import_firestore2.collection)(db, "erm_states"),
435
+ app_pro_commands_queue: (0, import_firestore2.collection)(db, "app_pro_commands_queue"),
436
+ trips: (0, import_firestore2.collection)(db, "erm2_trip"),
437
+ tripsDetails: (0, import_firestore2.collection)(db, "erm2_trip_details"),
438
+ audit: (0, import_firestore2.collection)(db, "nx-audit"),
439
+ nx_settings: (0, import_firestore2.collection)(db, "nx-settings"),
440
+ settings: (0, import_firestore2.collection)(db, "settings"),
441
+ translations: (0, import_firestore2.collection)(db, "nx-translations"),
442
+ nx_cars: (0, import_firestore2.collection)(db, "nx-cars"),
443
+ boards: (0, import_firestore2.collection)(db, "boards"),
444
+ protection_types: (0, import_firestore2.collection)(db, "protectionTypes"),
445
+ board_types: (0, import_firestore2.collection)(db, "boardTypes"),
446
+ charge_capacities: (0, import_firestore2.collection)(db, "nx-charge-capacities")
443
447
  };
444
- var fire_base_TIME_TEMP = import_firestore.Timestamp.now;
448
+ var fire_base_TIME_TEMP = import_firestore2.Timestamp.now;
445
449
  var simpleExtractData = function(doc2) {
446
450
  var docData = doc2.data();
447
451
  return _object_spread_props(_object_spread({}, docData), {
@@ -460,10 +464,10 @@ var get_document_by_id = /*#__PURE__*/ function() {
460
464
  ,
461
465
  3
462
466
  ]);
463
- doc_ref = (0, import_firestore.doc)(db, collection_path, doc_id);
467
+ doc_ref = (0, import_firestore2.doc)(db, collection_path, doc_id);
464
468
  return [
465
469
  4,
466
- (0, import_firestore.getDoc)(doc_ref)
470
+ (0, import_firestore2.getDoc)(doc_ref)
467
471
  ];
468
472
  case 1:
469
473
  doc_snap = _state.sent();
@@ -506,18 +510,18 @@ var snapshot = function(config, snapshotsFirstTime, settings) {
506
510
  }
507
511
  };
508
512
  });
509
- var collectionRef = (0, import_firestore.collection)(db, config.collectionName);
513
+ var collectionRef = (0, import_firestore2.collection)(db, config.collectionName);
510
514
  if (config.conditions) {
511
515
  config.conditions.forEach(function(condition) {
512
- collectionRef = (0, import_firestore.query)(collectionRef, (0, import_firestore.where)(condition.field_name, condition.operator, condition.value));
516
+ collectionRef = (0, import_firestore2.query)(collectionRef, (0, import_firestore2.where)(condition.field_name, condition.operator, condition.value));
513
517
  });
514
518
  }
515
519
  if (config.orderBy) {
516
520
  config.orderBy.forEach(function(order) {
517
- collectionRef = (0, import_firestore.query)(collectionRef, (0, import_firestore.orderBy)(order.fieldName, order.direction));
521
+ collectionRef = (0, import_firestore2.query)(collectionRef, (0, import_firestore2.orderBy)(order.fieldName, order.direction));
518
522
  });
519
523
  }
520
- var unsubscribe = (0, import_firestore.onSnapshot)(collectionRef, function(snapshot3) {
524
+ var unsubscribe = (0, import_firestore2.onSnapshot)(collectionRef, function(snapshot3) {
521
525
  var firstTimeKey = JSON.stringify({
522
526
  collectionName: config.collectionName,
523
527
  conditions: config.conditions || [],
@@ -633,9 +637,6 @@ var chartsRegex = (0, import_xregexp.default)("[^\\p{L}0-9\\s.,_@!+-\\-]", "gu")
633
637
  // src/lib/utils.ts
634
638
  var import_clsx = require("clsx");
635
639
  var import_tailwind_merge = require("tailwind-merge");
636
- // src/helpers/time_helpers.ts
637
- var import_firestore2 = require("firebase/firestore");
638
- var import_moment_timezone = __toESM(require("moment-timezone"));
639
640
  // src/helpers/api.ts
640
641
  var import_axios2 = __toESM(require("axios"));
641
642
  var baseDomain = mode === "qa" ? "https://nx-api.xyz/api" : "https://nx-api.info/api";
@@ -652,57 +653,6 @@ var import_axios3 = __toESM(require("axios"));
652
653
  // src/helpers/socket.ts
653
654
  var import_socket = require("socket.io-client");
654
655
  var SESSION_STORAGE_KEY = "sessionId";
655
- var safeSessionStorage = function() {
656
- var memoryValue;
657
- var canUseStorage = function() {
658
- if (typeof window === "undefined") return false;
659
- try {
660
- var testKey = "".concat(SESSION_STORAGE_KEY, "_test");
661
- window.localStorage.setItem(testKey, "1");
662
- window.localStorage.removeItem(testKey);
663
- return true;
664
- } catch (error) {
665
- console.warn("localStorage check failed, falling back to memory store", error);
666
- return false;
667
- }
668
- };
669
- var storageAvailable = canUseStorage();
670
- return {
671
- read: function read() {
672
- if (!storageAvailable) {
673
- return memoryValue;
674
- }
675
- try {
676
- return window.localStorage.getItem(SESSION_STORAGE_KEY) || memoryValue;
677
- } catch (error) {
678
- console.warn("localStorage read failed, using memory store", error);
679
- return memoryValue;
680
- }
681
- },
682
- write: function write(value) {
683
- memoryValue = value;
684
- if (!storageAvailable || typeof value === "undefined") {
685
- return;
686
- }
687
- try {
688
- window.localStorage.setItem(SESSION_STORAGE_KEY, value);
689
- } catch (error) {
690
- console.warn("localStorage write failed, persisting in memory store", error);
691
- }
692
- },
693
- clear: function clear() {
694
- memoryValue = void 0;
695
- if (!storageAvailable) {
696
- return;
697
- }
698
- try {
699
- window.localStorage.removeItem(SESSION_STORAGE_KEY);
700
- } catch (error) {
701
- console.warn("localStorage clear failed", error);
702
- }
703
- }
704
- };
705
- }();
706
656
  var SocketService = /*#__PURE__*/ function() {
707
657
  "use strict";
708
658
  function _SocketService() {
@@ -723,7 +673,7 @@ var SocketService = /*#__PURE__*/ function() {
723
673
  this.socket = (0, import_socket.io)(socketUrl, {
724
674
  path: "/api/data-socket/connect",
725
675
  auth: function(cb) {
726
- var sessionId = safeSessionStorage.read();
676
+ var sessionId = localStorage.getItem(SESSION_STORAGE_KEY) || void 0;
727
677
  var token = _this.authToken;
728
678
  var authPayload = {};
729
679
  if (token) authPayload.token = token;
@@ -765,7 +715,7 @@ var SocketService = /*#__PURE__*/ function() {
765
715
  this.socket.on("session", function(param) {
766
716
  var session_id = param.session_id;
767
717
  if (session_id) {
768
- safeSessionStorage.write(session_id);
718
+ localStorage.setItem(SESSION_STORAGE_KEY, session_id);
769
719
  }
770
720
  });
771
721
  this.socket.on("connect_error", function(error) {
@@ -250,12 +250,12 @@ function _ts_generator(thisArg, body) {
250
250
  import { CountryOptions as CountryOptions2 } from "akeyless-types-commons";
251
251
  import { useEffect, useLayoutEffect } from "react";
252
252
  // src/helpers/firebase.ts
253
- import moment from "moment";
253
+ import moment2 from "moment";
254
254
  import { initializeApp } from "firebase/app";
255
255
  import { getStorage } from "firebase/storage";
256
256
  import { getAuth, GoogleAuthProvider, signInWithPopup } from "firebase/auth";
257
257
  import { initializeAppCheck, ReCaptchaEnterpriseProvider } from "firebase/app-check";
258
- import { addDoc, collection, deleteDoc, doc, getDoc, getDocs, query, setDoc, Timestamp, where, getFirestore, onSnapshot, orderBy } from "firebase/firestore";
258
+ import { addDoc, collection, deleteDoc, doc, getDoc, getDocs, query, setDoc, Timestamp as Timestamp2, where, getFirestore, onSnapshot, orderBy } from "firebase/firestore";
259
259
  import { useCallback } from "react";
260
260
  // src/helpers/phoneNumber.ts
261
261
  import { parsePhoneNumberFromString } from "libphonenumber-js";
@@ -280,6 +280,10 @@ var checkUserPermissions = function(userPermissions, entity, permissions, mode2)
280
280
  checkUserPermissions({}, "dashboard", []);
281
281
  // src/helpers/firebase.ts
282
282
  import { ref, getDownloadURL, uploadBytes } from "firebase/storage";
283
+ // src/helpers/time_helpers.ts
284
+ import { Timestamp } from "firebase/firestore";
285
+ import moment from "moment-timezone";
286
+ // src/helpers/firebase.ts
283
287
  var initApp = function() {
284
288
  var isNodeEnv2 = typeof process !== "undefined" && process.env;
285
289
  var firebaseConfig = {
@@ -345,7 +349,7 @@ var collections = {
345
349
  board_types: collection(db, "boardTypes"),
346
350
  charge_capacities: collection(db, "nx-charge-capacities")
347
351
  };
348
- var fire_base_TIME_TEMP = Timestamp.now;
352
+ var fire_base_TIME_TEMP = Timestamp2.now;
349
353
  var simpleExtractData = function(doc2) {
350
354
  var docData = doc2.data();
351
355
  return _object_spread_props(_object_spread({}, docData), {
@@ -536,9 +540,6 @@ var chartsRegex = XRegExp("[^\\p{L}0-9\\s.,_@!+-\\-]", "gu");
536
540
  // src/lib/utils.ts
537
541
  import { clsx } from "clsx";
538
542
  import { twMerge } from "tailwind-merge";
539
- // src/helpers/time_helpers.ts
540
- import { Timestamp as Timestamp2 } from "firebase/firestore";
541
- import moment2 from "moment-timezone";
542
543
  // src/helpers/api.ts
543
544
  import axios2 from "axios";
544
545
  var baseDomain = mode === "qa" ? "https://nx-api.xyz/api" : "https://nx-api.info/api";
@@ -555,57 +556,6 @@ import axios3 from "axios";
555
556
  // src/helpers/socket.ts
556
557
  import { io } from "socket.io-client";
557
558
  var SESSION_STORAGE_KEY = "sessionId";
558
- var safeSessionStorage = function() {
559
- var memoryValue;
560
- var canUseStorage = function() {
561
- if (typeof window === "undefined") return false;
562
- try {
563
- var testKey = "".concat(SESSION_STORAGE_KEY, "_test");
564
- window.localStorage.setItem(testKey, "1");
565
- window.localStorage.removeItem(testKey);
566
- return true;
567
- } catch (error) {
568
- console.warn("localStorage check failed, falling back to memory store", error);
569
- return false;
570
- }
571
- };
572
- var storageAvailable = canUseStorage();
573
- return {
574
- read: function read() {
575
- if (!storageAvailable) {
576
- return memoryValue;
577
- }
578
- try {
579
- return window.localStorage.getItem(SESSION_STORAGE_KEY) || memoryValue;
580
- } catch (error) {
581
- console.warn("localStorage read failed, using memory store", error);
582
- return memoryValue;
583
- }
584
- },
585
- write: function write(value) {
586
- memoryValue = value;
587
- if (!storageAvailable || typeof value === "undefined") {
588
- return;
589
- }
590
- try {
591
- window.localStorage.setItem(SESSION_STORAGE_KEY, value);
592
- } catch (error) {
593
- console.warn("localStorage write failed, persisting in memory store", error);
594
- }
595
- },
596
- clear: function clear() {
597
- memoryValue = void 0;
598
- if (!storageAvailable) {
599
- return;
600
- }
601
- try {
602
- window.localStorage.removeItem(SESSION_STORAGE_KEY);
603
- } catch (error) {
604
- console.warn("localStorage clear failed", error);
605
- }
606
- }
607
- };
608
- }();
609
559
  var SocketService = /*#__PURE__*/ function() {
610
560
  "use strict";
611
561
  function _SocketService() {
@@ -626,7 +576,7 @@ var SocketService = /*#__PURE__*/ function() {
626
576
  this.socket = io(socketUrl, {
627
577
  path: "/api/data-socket/connect",
628
578
  auth: function(cb) {
629
- var sessionId = safeSessionStorage.read();
579
+ var sessionId = localStorage.getItem(SESSION_STORAGE_KEY) || void 0;
630
580
  var token = _this.authToken;
631
581
  var authPayload = {};
632
582
  if (token) authPayload.token = token;
@@ -668,7 +618,7 @@ var SocketService = /*#__PURE__*/ function() {
668
618
  this.socket.on("session", function(param) {
669
619
  var session_id = param.session_id;
670
620
  if (session_id) {
671
- safeSessionStorage.write(session_id);
621
+ localStorage.setItem(SESSION_STORAGE_KEY, session_id);
672
622
  }
673
623
  });
674
624
  this.socket.on("connect_error", function(error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akeyless-client-commons",
3
- "version": "1.1.70",
3
+ "version": "1.1.72",
4
4
  "scripts": {
5
5
  "build": "tsup",
6
6
  "deploy": "npm run build && npm version patch --no-git-tag-version && npm publish",