akeyless-client-commons 1.0.65 → 1.0.67
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/components/index.js +28 -28
- package/dist/components/index.mjs +19 -19
- package/dist/helpers/index.d.mts +6 -2
- package/dist/helpers/index.d.ts +6 -2
- package/dist/helpers/index.js +205 -191
- package/dist/helpers/index.mjs +191 -181
- package/dist/hooks/index.js +58 -58
- package/dist/hooks/index.mjs +49 -49
- package/dist/types/index.d.mts +3 -1
- package/dist/types/index.d.ts +3 -1
- package/package.json +1 -1
package/dist/components/index.js
CHANGED
|
@@ -677,17 +677,33 @@ var import_libphonenumber_js = require("libphonenumber-js");
|
|
|
677
677
|
var local_israel_phone_format = function(international_number) {
|
|
678
678
|
return international_number.replace("+972", "0");
|
|
679
679
|
};
|
|
680
|
-
// src/helpers/
|
|
680
|
+
// src/helpers/global.ts
|
|
681
|
+
var import_akeyless_types_commons = require("akeyless-types-commons");
|
|
682
|
+
var import_axios = __toESM(require("axios"));
|
|
683
|
+
var import_lodash = require("lodash");
|
|
681
684
|
var import_meta = {};
|
|
685
|
+
var renderOnce = function() {
|
|
686
|
+
return true;
|
|
687
|
+
};
|
|
688
|
+
var getLocationUrl = function(lng, lat) {
|
|
689
|
+
return "https://www.google.com/maps?q=".concat(lat, ",").concat(lng);
|
|
690
|
+
};
|
|
691
|
+
var isNodeEnv = typeof process !== "undefined" && process.env;
|
|
692
|
+
var _ref = {
|
|
693
|
+
mode: isNodeEnv ? process.env.NEXT_PUBLIC_MODE : import_meta.env.VITE_MODE,
|
|
694
|
+
isLocal: (isNodeEnv ? process.env.NEXT_PUBLIC_IS_LOCAL : import_meta.env.VITE_is_local) === "true"
|
|
695
|
+
}, mode = _ref.mode, isLocal = _ref.isLocal;
|
|
696
|
+
// src/helpers/firebase.ts
|
|
697
|
+
var import_meta2 = {};
|
|
682
698
|
var initApp = function() {
|
|
683
699
|
var isNodeEnv2 = typeof process !== "undefined" && process.env;
|
|
684
700
|
var firebaseConfig = {
|
|
685
|
-
apiKey: isNodeEnv2 ? process.env.NEXT_PUBLIC_API_KEY :
|
|
686
|
-
authDomain: isNodeEnv2 ? process.env.NEXT_PUBLIC_AUTH_DOMAIN :
|
|
687
|
-
projectId: isNodeEnv2 ? process.env.NEXT_PUBLIC_PROJECT_ID :
|
|
688
|
-
storageBucket: isNodeEnv2 ? process.env.NEXT_PUBLIC_STORAGE_BUCKET :
|
|
689
|
-
messagingSenderId: isNodeEnv2 ? process.env.NEXT_PUBLIC_MESSAGING_SENDER_ID :
|
|
690
|
-
appId: isNodeEnv2 ? process.env.NEXT_PUBLIC_APP_ID :
|
|
701
|
+
apiKey: isNodeEnv2 ? process.env.NEXT_PUBLIC_API_KEY : import_meta2.env.VITE_API_KEY,
|
|
702
|
+
authDomain: isNodeEnv2 ? process.env.NEXT_PUBLIC_AUTH_DOMAIN : import_meta2.env.VITE_AUTH_DOMAIN,
|
|
703
|
+
projectId: isNodeEnv2 ? process.env.NEXT_PUBLIC_PROJECT_ID : import_meta2.env.VITE_PROJECT_ID,
|
|
704
|
+
storageBucket: isNodeEnv2 ? process.env.NEXT_PUBLIC_STORAGE_BUCKET : import_meta2.env.VITE_STORAGE_BUCKET,
|
|
705
|
+
messagingSenderId: isNodeEnv2 ? process.env.NEXT_PUBLIC_MESSAGING_SENDER_ID : import_meta2.env.VITE_MESSAGING_SENDER_ID,
|
|
706
|
+
appId: isNodeEnv2 ? process.env.NEXT_PUBLIC_APP_ID : import_meta2.env.VITE_APP_ID
|
|
691
707
|
};
|
|
692
708
|
try {
|
|
693
709
|
var app2 = (0, import_app.initializeApp)(firebaseConfig);
|
|
@@ -696,7 +712,7 @@ var initApp = function() {
|
|
|
696
712
|
var db2 = (0, import_firestore.getFirestore)(app2);
|
|
697
713
|
var storage2 = (0, import_storage.getStorage)(app2);
|
|
698
714
|
var googleLoginProvider2 = new import_auth.GoogleAuthProvider();
|
|
699
|
-
var recaptchaSiteKey = isNodeEnv2 ? process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY :
|
|
715
|
+
var recaptchaSiteKey = isNodeEnv2 ? process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY : import_meta2.env.VITE_RECAPTCHA_SITE_KEY;
|
|
700
716
|
var result = {
|
|
701
717
|
db: db2,
|
|
702
718
|
auth: auth2,
|
|
@@ -776,7 +792,7 @@ var simpleExtractData = function(doc2) {
|
|
|
776
792
|
id: doc2.id
|
|
777
793
|
});
|
|
778
794
|
};
|
|
779
|
-
var
|
|
795
|
+
var query_document2 = /*#__PURE__*/ function() {
|
|
780
796
|
var _ref = _async_to_generator(function(collection_path, field_name, operator, value) {
|
|
781
797
|
var ignore_log, q, query_snapshot, documents, error;
|
|
782
798
|
var _arguments = arguments;
|
|
@@ -825,7 +841,7 @@ var query_document = /*#__PURE__*/ function() {
|
|
|
825
841
|
}
|
|
826
842
|
});
|
|
827
843
|
});
|
|
828
|
-
return function
|
|
844
|
+
return function query_document2(collection_path, field_name, operator, value) {
|
|
829
845
|
return _ref.apply(this, arguments);
|
|
830
846
|
};
|
|
831
847
|
}();
|
|
@@ -841,7 +857,7 @@ var getUserByPhone = /*#__PURE__*/ function() {
|
|
|
841
857
|
];
|
|
842
858
|
return [
|
|
843
859
|
4,
|
|
844
|
-
|
|
860
|
+
query_document2("nx-users", "phone_number", "in", phones, true)
|
|
845
861
|
];
|
|
846
862
|
case 1:
|
|
847
863
|
return [
|
|
@@ -862,7 +878,7 @@ var getUserByEmail = /*#__PURE__*/ function() {
|
|
|
862
878
|
case 0:
|
|
863
879
|
return [
|
|
864
880
|
4,
|
|
865
|
-
|
|
881
|
+
query_document2("nx-users", "email", "==", email, true)
|
|
866
882
|
];
|
|
867
883
|
case 1:
|
|
868
884
|
return [
|
|
@@ -911,22 +927,6 @@ var getUserByIdentifier = /*#__PURE__*/ function() {
|
|
|
911
927
|
return _ref.apply(this, arguments);
|
|
912
928
|
};
|
|
913
929
|
}();
|
|
914
|
-
// src/helpers/global.ts
|
|
915
|
-
var import_akeyless_types_commons = require("akeyless-types-commons");
|
|
916
|
-
var import_axios = __toESM(require("axios"));
|
|
917
|
-
var import_lodash = require("lodash");
|
|
918
|
-
var import_meta2 = {};
|
|
919
|
-
var renderOnce = function() {
|
|
920
|
-
return true;
|
|
921
|
-
};
|
|
922
|
-
var getLocationUrl = function(lng, lat) {
|
|
923
|
-
return "https://www.google.com/maps?q=".concat(lat, ",").concat(lng);
|
|
924
|
-
};
|
|
925
|
-
var isNodeEnv = typeof process !== "undefined" && process.env;
|
|
926
|
-
var _ref = {
|
|
927
|
-
mode: isNodeEnv ? process.env.NEXT_PUBLIC_MODE : import_meta2.env.VITE_MODE,
|
|
928
|
-
isLocal: (isNodeEnv ? process.env.NEXT_PUBLIC_IS_LOCAL : import_meta2.env.VITE_is_local) === "true"
|
|
929
|
-
}, mode = _ref.mode, isLocal = _ref.isLocal;
|
|
930
930
|
// src/helpers/forms.ts
|
|
931
931
|
var import_xregexp = __toESM(require("xregexp"));
|
|
932
932
|
var textRegex = (0, import_xregexp.default)("[^\\p{L}\\s-]", "gu");
|
|
@@ -478,6 +478,21 @@ import { parsePhoneNumberFromString } from "libphonenumber-js";
|
|
|
478
478
|
var local_israel_phone_format = function(international_number) {
|
|
479
479
|
return international_number.replace("+972", "0");
|
|
480
480
|
};
|
|
481
|
+
// src/helpers/global.ts
|
|
482
|
+
import { CountryOptions } from "akeyless-types-commons";
|
|
483
|
+
import axios from "axios";
|
|
484
|
+
import { isEqual } from "lodash";
|
|
485
|
+
var renderOnce = function() {
|
|
486
|
+
return true;
|
|
487
|
+
};
|
|
488
|
+
var getLocationUrl = function(lng, lat) {
|
|
489
|
+
return "https://www.google.com/maps?q=".concat(lat, ",").concat(lng);
|
|
490
|
+
};
|
|
491
|
+
var isNodeEnv = typeof process !== "undefined" && process.env;
|
|
492
|
+
var _ref = {
|
|
493
|
+
mode: isNodeEnv ? process.env.NEXT_PUBLIC_MODE : import.meta.env.VITE_MODE,
|
|
494
|
+
isLocal: (isNodeEnv ? process.env.NEXT_PUBLIC_IS_LOCAL : import.meta.env.VITE_is_local) === "true"
|
|
495
|
+
}, mode = _ref.mode, isLocal = _ref.isLocal;
|
|
481
496
|
// src/helpers/firebase.ts
|
|
482
497
|
var initApp = function() {
|
|
483
498
|
var isNodeEnv2 = typeof process !== "undefined" && process.env;
|
|
@@ -576,7 +591,7 @@ var simpleExtractData = function(doc2) {
|
|
|
576
591
|
id: doc2.id
|
|
577
592
|
});
|
|
578
593
|
};
|
|
579
|
-
var
|
|
594
|
+
var query_document2 = /*#__PURE__*/ function() {
|
|
580
595
|
var _ref = _async_to_generator(function(collection_path, field_name, operator, value) {
|
|
581
596
|
var ignore_log, q, query_snapshot, documents, error;
|
|
582
597
|
var _arguments = arguments;
|
|
@@ -625,7 +640,7 @@ var query_document = /*#__PURE__*/ function() {
|
|
|
625
640
|
}
|
|
626
641
|
});
|
|
627
642
|
});
|
|
628
|
-
return function
|
|
643
|
+
return function query_document2(collection_path, field_name, operator, value) {
|
|
629
644
|
return _ref.apply(this, arguments);
|
|
630
645
|
};
|
|
631
646
|
}();
|
|
@@ -641,7 +656,7 @@ var getUserByPhone = /*#__PURE__*/ function() {
|
|
|
641
656
|
];
|
|
642
657
|
return [
|
|
643
658
|
4,
|
|
644
|
-
|
|
659
|
+
query_document2("nx-users", "phone_number", "in", phones, true)
|
|
645
660
|
];
|
|
646
661
|
case 1:
|
|
647
662
|
return [
|
|
@@ -662,7 +677,7 @@ var getUserByEmail = /*#__PURE__*/ function() {
|
|
|
662
677
|
case 0:
|
|
663
678
|
return [
|
|
664
679
|
4,
|
|
665
|
-
|
|
680
|
+
query_document2("nx-users", "email", "==", email, true)
|
|
666
681
|
];
|
|
667
682
|
case 1:
|
|
668
683
|
return [
|
|
@@ -711,21 +726,6 @@ var getUserByIdentifier = /*#__PURE__*/ function() {
|
|
|
711
726
|
return _ref.apply(this, arguments);
|
|
712
727
|
};
|
|
713
728
|
}();
|
|
714
|
-
// src/helpers/global.ts
|
|
715
|
-
import { CountryOptions } from "akeyless-types-commons";
|
|
716
|
-
import axios from "axios";
|
|
717
|
-
import { isEqual } from "lodash";
|
|
718
|
-
var renderOnce = function() {
|
|
719
|
-
return true;
|
|
720
|
-
};
|
|
721
|
-
var getLocationUrl = function(lng, lat) {
|
|
722
|
-
return "https://www.google.com/maps?q=".concat(lat, ",").concat(lng);
|
|
723
|
-
};
|
|
724
|
-
var isNodeEnv = typeof process !== "undefined" && process.env;
|
|
725
|
-
var _ref = {
|
|
726
|
-
mode: isNodeEnv ? process.env.NEXT_PUBLIC_MODE : import.meta.env.VITE_MODE,
|
|
727
|
-
isLocal: (isNodeEnv ? process.env.NEXT_PUBLIC_IS_LOCAL : import.meta.env.VITE_is_local) === "true"
|
|
728
|
-
}, mode = _ref.mode, isLocal = _ref.isLocal;
|
|
729
729
|
// src/helpers/forms.ts
|
|
730
730
|
import XRegExp from "xregexp";
|
|
731
731
|
var textRegex = XRegExp("[^\\p{L}\\s-]", "gu");
|
package/dist/helpers/index.d.mts
CHANGED
|
@@ -7,6 +7,9 @@ import { TObject, NxUser, CountryOptions, Client } from 'akeyless-types-commons'
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { ClassValue } from 'clsx';
|
|
9
9
|
|
|
10
|
+
type AppName = "installer" | "toolbox" | "dashboard";
|
|
11
|
+
type LoginOption = "google" | "phone";
|
|
12
|
+
|
|
10
13
|
type OnSnapshotCallback = (documents: any[], config: OnSnapshotConfig) => void;
|
|
11
14
|
interface OnSnapshotParsers {
|
|
12
15
|
onFirstTime?: OnSnapshotCallback;
|
|
@@ -131,7 +134,7 @@ declare const cleanNxSites: () => Promise<void>;
|
|
|
131
134
|
declare const getUserByPhone: (phone: string) => Promise<TObject<any>>;
|
|
132
135
|
declare const getUserByEmail: (email: string) => Promise<TObject<any>>;
|
|
133
136
|
declare const getUserByIdentifier: (identifier: string) => Promise<TObject<any>>;
|
|
134
|
-
declare const addLoginAudit: (user: NxUser | null, app:
|
|
137
|
+
declare const addLoginAudit: (user: NxUser | null, app: AppName, loginBy: LoginOption) => Promise<void>;
|
|
135
138
|
declare const addAuditRecord: (action: string, entity: string, details: TObject<any>, user?: NxUser | null) => Promise<{
|
|
136
139
|
action: string;
|
|
137
140
|
entity: string;
|
|
@@ -142,6 +145,7 @@ declare const addAuditRecord: (action: string, entity: string, details: TObject<
|
|
|
142
145
|
clients: string[];
|
|
143
146
|
};
|
|
144
147
|
}>;
|
|
148
|
+
declare const validateUserStatusAndPermissions: (user: NxUser, app: AppName) => TObject<TObject<boolean>>;
|
|
145
149
|
|
|
146
150
|
declare const calculateBearing: (startLat: any, startLng: any, endLat: any, endLng: any) => number;
|
|
147
151
|
declare const renderOnce: () => boolean;
|
|
@@ -225,4 +229,4 @@ type Method = "GET" | "POST" | "PUT" | "DELETE";
|
|
|
225
229
|
type ServerName = "devices" | "bi" | "call-center";
|
|
226
230
|
declare const nx_api_call: (serverName: ServerName, method: Method, url: string, data?: TObject<any>) => Promise<any>;
|
|
227
231
|
|
|
228
|
-
export { type ValidationType, addAuditRecord, addLoginAudit, add_document, addressRegex, akeylessOnlineDomain, app, appCheck, auth, baseDomain, biDomain, calculateBearing, callCenterDomain, carsRegex, chartsRegex, cleanNxSites, cn, collections, colorRegex, createSelectors, db, delete_document, devicesDomain, displayFormatPhoneNumber, emailRegex, extractAlertsData, extractBoardsData, extractCanbusData, extractCarsData, extractClientData, extractLocationData, extractSiteData, fire_base_TIME_TEMP, formatCarNumber, getFormElementValue, getLocationUrl, getUserByEmail, getUserByIdentifier, getUserByPhone, getUserCountryByIp, get_all_documents, get_document_by_id, googleLoginProvider, handleChange, handleInvalid, handlePaste, initializeUserPermissions, international_israel_phone_format, isInternational, isInternationalIsraelPhone, isLocal, isNodeEnv, is_iccid, local_israel_phone_format, mode, multiStringFormat, numbersOnlyRegex, numbersRegex, nx_api_call, parseMultiSelectInput, parsePermissions, priceRegex, propsAreEqual, query_document, query_document_by_conditions, query_documents, query_documents_by_conditions, renderOnce, setState, set_document, simpleExtractData, snapshot, snapshotDocument, sort_by_timestamp, storage, textNumbersRegex, textRegex, timestamp_to_millis, timestamp_to_string, useLoginWithGoogle, useStoreValues, useValidation, userNameFormat };
|
|
232
|
+
export { type ValidationType, addAuditRecord, addLoginAudit, add_document, addressRegex, akeylessOnlineDomain, app, appCheck, auth, baseDomain, biDomain, calculateBearing, callCenterDomain, carsRegex, chartsRegex, cleanNxSites, cn, collections, colorRegex, createSelectors, db, delete_document, devicesDomain, displayFormatPhoneNumber, emailRegex, extractAlertsData, extractBoardsData, extractCanbusData, extractCarsData, extractClientData, extractLocationData, extractSiteData, fire_base_TIME_TEMP, formatCarNumber, getFormElementValue, getLocationUrl, getUserByEmail, getUserByIdentifier, getUserByPhone, getUserCountryByIp, get_all_documents, get_document_by_id, googleLoginProvider, handleChange, handleInvalid, handlePaste, initializeUserPermissions, international_israel_phone_format, isInternational, isInternationalIsraelPhone, isLocal, isNodeEnv, is_iccid, local_israel_phone_format, mode, multiStringFormat, numbersOnlyRegex, numbersRegex, nx_api_call, parseMultiSelectInput, parsePermissions, priceRegex, propsAreEqual, query_document, query_document_by_conditions, query_documents, query_documents_by_conditions, renderOnce, setState, set_document, simpleExtractData, snapshot, snapshotDocument, sort_by_timestamp, storage, textNumbersRegex, textRegex, timestamp_to_millis, timestamp_to_string, useLoginWithGoogle, useStoreValues, useValidation, userNameFormat, validateUserStatusAndPermissions };
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -7,6 +7,9 @@ import { TObject, NxUser, CountryOptions, Client } from 'akeyless-types-commons'
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { ClassValue } from 'clsx';
|
|
9
9
|
|
|
10
|
+
type AppName = "installer" | "toolbox" | "dashboard";
|
|
11
|
+
type LoginOption = "google" | "phone";
|
|
12
|
+
|
|
10
13
|
type OnSnapshotCallback = (documents: any[], config: OnSnapshotConfig) => void;
|
|
11
14
|
interface OnSnapshotParsers {
|
|
12
15
|
onFirstTime?: OnSnapshotCallback;
|
|
@@ -131,7 +134,7 @@ declare const cleanNxSites: () => Promise<void>;
|
|
|
131
134
|
declare const getUserByPhone: (phone: string) => Promise<TObject<any>>;
|
|
132
135
|
declare const getUserByEmail: (email: string) => Promise<TObject<any>>;
|
|
133
136
|
declare const getUserByIdentifier: (identifier: string) => Promise<TObject<any>>;
|
|
134
|
-
declare const addLoginAudit: (user: NxUser | null, app:
|
|
137
|
+
declare const addLoginAudit: (user: NxUser | null, app: AppName, loginBy: LoginOption) => Promise<void>;
|
|
135
138
|
declare const addAuditRecord: (action: string, entity: string, details: TObject<any>, user?: NxUser | null) => Promise<{
|
|
136
139
|
action: string;
|
|
137
140
|
entity: string;
|
|
@@ -142,6 +145,7 @@ declare const addAuditRecord: (action: string, entity: string, details: TObject<
|
|
|
142
145
|
clients: string[];
|
|
143
146
|
};
|
|
144
147
|
}>;
|
|
148
|
+
declare const validateUserStatusAndPermissions: (user: NxUser, app: AppName) => TObject<TObject<boolean>>;
|
|
145
149
|
|
|
146
150
|
declare const calculateBearing: (startLat: any, startLng: any, endLat: any, endLng: any) => number;
|
|
147
151
|
declare const renderOnce: () => boolean;
|
|
@@ -225,4 +229,4 @@ type Method = "GET" | "POST" | "PUT" | "DELETE";
|
|
|
225
229
|
type ServerName = "devices" | "bi" | "call-center";
|
|
226
230
|
declare const nx_api_call: (serverName: ServerName, method: Method, url: string, data?: TObject<any>) => Promise<any>;
|
|
227
231
|
|
|
228
|
-
export { type ValidationType, addAuditRecord, addLoginAudit, add_document, addressRegex, akeylessOnlineDomain, app, appCheck, auth, baseDomain, biDomain, calculateBearing, callCenterDomain, carsRegex, chartsRegex, cleanNxSites, cn, collections, colorRegex, createSelectors, db, delete_document, devicesDomain, displayFormatPhoneNumber, emailRegex, extractAlertsData, extractBoardsData, extractCanbusData, extractCarsData, extractClientData, extractLocationData, extractSiteData, fire_base_TIME_TEMP, formatCarNumber, getFormElementValue, getLocationUrl, getUserByEmail, getUserByIdentifier, getUserByPhone, getUserCountryByIp, get_all_documents, get_document_by_id, googleLoginProvider, handleChange, handleInvalid, handlePaste, initializeUserPermissions, international_israel_phone_format, isInternational, isInternationalIsraelPhone, isLocal, isNodeEnv, is_iccid, local_israel_phone_format, mode, multiStringFormat, numbersOnlyRegex, numbersRegex, nx_api_call, parseMultiSelectInput, parsePermissions, priceRegex, propsAreEqual, query_document, query_document_by_conditions, query_documents, query_documents_by_conditions, renderOnce, setState, set_document, simpleExtractData, snapshot, snapshotDocument, sort_by_timestamp, storage, textNumbersRegex, textRegex, timestamp_to_millis, timestamp_to_string, useLoginWithGoogle, useStoreValues, useValidation, userNameFormat };
|
|
232
|
+
export { type ValidationType, addAuditRecord, addLoginAudit, add_document, addressRegex, akeylessOnlineDomain, app, appCheck, auth, baseDomain, biDomain, calculateBearing, callCenterDomain, carsRegex, chartsRegex, cleanNxSites, cn, collections, colorRegex, createSelectors, db, delete_document, devicesDomain, displayFormatPhoneNumber, emailRegex, extractAlertsData, extractBoardsData, extractCanbusData, extractCarsData, extractClientData, extractLocationData, extractSiteData, fire_base_TIME_TEMP, formatCarNumber, getFormElementValue, getLocationUrl, getUserByEmail, getUserByIdentifier, getUserByPhone, getUserCountryByIp, get_all_documents, get_document_by_id, googleLoginProvider, handleChange, handleInvalid, handlePaste, initializeUserPermissions, international_israel_phone_format, isInternational, isInternationalIsraelPhone, isLocal, isNodeEnv, is_iccid, local_israel_phone_format, mode, multiStringFormat, numbersOnlyRegex, numbersRegex, nx_api_call, parseMultiSelectInput, parsePermissions, priceRegex, propsAreEqual, query_document, query_document_by_conditions, query_documents, query_documents_by_conditions, renderOnce, setState, set_document, simpleExtractData, snapshot, snapshotDocument, sort_by_timestamp, storage, textNumbersRegex, textRegex, timestamp_to_millis, timestamp_to_string, useLoginWithGoogle, useStoreValues, useValidation, userNameFormat, validateUserStatusAndPermissions };
|