akeyless-client-commons 1.0.44 → 1.0.46
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.css.map +1 -1
- package/dist/components/index.js +77 -74
- package/dist/components/index.mjs +15 -12
- package/dist/helpers/index.d.mts +5 -2
- package/dist/helpers/index.d.ts +5 -2
- package/dist/helpers/index.js +36 -0
- package/dist/helpers/index.mjs +30 -2
- package/dist/hooks/index.js +16 -13
- package/dist/hooks/index.mjs +5 -2
- package/package.json +1 -1
package/dist/helpers/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import * as _firebase_auth from '@firebase/auth';
|
|
1
2
|
import { FirebaseApp } from 'firebase/app';
|
|
2
3
|
import { FirebaseStorage } from 'firebase/storage';
|
|
3
|
-
import { Auth } from 'firebase/auth';
|
|
4
|
+
import { Auth, GoogleAuthProvider } from 'firebase/auth';
|
|
4
5
|
import { AppCheck } from 'firebase/app-check';
|
|
5
6
|
import { WhereFilterOp, Unsubscribe, Firestore, Timestamp, DocumentSnapshot, DocumentData, CollectionReference } from 'firebase/firestore';
|
|
6
7
|
import { TObject, CountryOptions, NxUser, Client } from 'akeyless-types-commons';
|
|
@@ -46,6 +47,8 @@ declare const auth: Auth;
|
|
|
46
47
|
declare const storage: FirebaseStorage;
|
|
47
48
|
declare const app: FirebaseApp;
|
|
48
49
|
declare const appCheck: AppCheck;
|
|
50
|
+
declare const googleLoginProvider: GoogleAuthProvider;
|
|
51
|
+
declare const useLoginWithGoogle: () => () => Promise<_firebase_auth.User>;
|
|
49
52
|
interface Collections {
|
|
50
53
|
[key: string]: CollectionReference<DocumentData>;
|
|
51
54
|
clients: CollectionReference<DocumentData>;
|
|
@@ -208,4 +211,4 @@ type Method = "GET" | "POST" | "PUT" | "DELETE";
|
|
|
208
211
|
type ServerName = "devices" | "bi" | "call-center";
|
|
209
212
|
declare const nx_api_call: (serverName: ServerName, method: Method, url: string, data?: TObject<any>) => Promise<any>;
|
|
210
213
|
|
|
211
|
-
export { type ValidationType, 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, getUserCountryByIp, get_all_documents, get_document_by_id, 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, useStoreValues, useValidation, userNameFormat };
|
|
214
|
+
export { type ValidationType, 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, 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 };
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import * as _firebase_auth from '@firebase/auth';
|
|
1
2
|
import { FirebaseApp } from 'firebase/app';
|
|
2
3
|
import { FirebaseStorage } from 'firebase/storage';
|
|
3
|
-
import { Auth } from 'firebase/auth';
|
|
4
|
+
import { Auth, GoogleAuthProvider } from 'firebase/auth';
|
|
4
5
|
import { AppCheck } from 'firebase/app-check';
|
|
5
6
|
import { WhereFilterOp, Unsubscribe, Firestore, Timestamp, DocumentSnapshot, DocumentData, CollectionReference } from 'firebase/firestore';
|
|
6
7
|
import { TObject, CountryOptions, NxUser, Client } from 'akeyless-types-commons';
|
|
@@ -46,6 +47,8 @@ declare const auth: Auth;
|
|
|
46
47
|
declare const storage: FirebaseStorage;
|
|
47
48
|
declare const app: FirebaseApp;
|
|
48
49
|
declare const appCheck: AppCheck;
|
|
50
|
+
declare const googleLoginProvider: GoogleAuthProvider;
|
|
51
|
+
declare const useLoginWithGoogle: () => () => Promise<_firebase_auth.User>;
|
|
49
52
|
interface Collections {
|
|
50
53
|
[key: string]: CollectionReference<DocumentData>;
|
|
51
54
|
clients: CollectionReference<DocumentData>;
|
|
@@ -208,4 +211,4 @@ type Method = "GET" | "POST" | "PUT" | "DELETE";
|
|
|
208
211
|
type ServerName = "devices" | "bi" | "call-center";
|
|
209
212
|
declare const nx_api_call: (serverName: ServerName, method: Method, url: string, data?: TObject<any>) => Promise<any>;
|
|
210
213
|
|
|
211
|
-
export { type ValidationType, 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, getUserCountryByIp, get_all_documents, get_document_by_id, 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, useStoreValues, useValidation, userNameFormat };
|
|
214
|
+
export { type ValidationType, 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, 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 };
|
package/dist/helpers/index.js
CHANGED
|
@@ -401,6 +401,9 @@ __export(helpers_exports, {
|
|
|
401
401
|
get_document_by_id: function() {
|
|
402
402
|
return get_document_by_id;
|
|
403
403
|
},
|
|
404
|
+
googleLoginProvider: function() {
|
|
405
|
+
return googleLoginProvider;
|
|
406
|
+
},
|
|
404
407
|
handleChange: function() {
|
|
405
408
|
return handleChange;
|
|
406
409
|
},
|
|
@@ -509,6 +512,9 @@ __export(helpers_exports, {
|
|
|
509
512
|
timestamp_to_string: function() {
|
|
510
513
|
return timestamp_to_string;
|
|
511
514
|
},
|
|
515
|
+
useLoginWithGoogle: function() {
|
|
516
|
+
return useLoginWithGoogle;
|
|
517
|
+
},
|
|
512
518
|
useStoreValues: function() {
|
|
513
519
|
return useStoreValues;
|
|
514
520
|
},
|
|
@@ -537,6 +543,7 @@ var formatCarNumber = function(car_number) {
|
|
|
537
543
|
return cn2;
|
|
538
544
|
};
|
|
539
545
|
// src/helpers/firebase.ts
|
|
546
|
+
var import_react = require("react");
|
|
540
547
|
var import_meta = {};
|
|
541
548
|
var initApp = function() {
|
|
542
549
|
var isNodeEnv2 = typeof process !== "undefined" && process.env;
|
|
@@ -551,6 +558,7 @@ var initApp = function() {
|
|
|
551
558
|
try {
|
|
552
559
|
var app2 = (0, import_app.initializeApp)(firebaseConfig);
|
|
553
560
|
var auth2 = (0, import_auth.getAuth)(app2);
|
|
561
|
+
auth2.settings.appVerificationDisabledForTesting = false;
|
|
554
562
|
var db2 = (0, import_firestore.getFirestore)(app2);
|
|
555
563
|
var storage2 = (0, import_storage.getStorage)(app2);
|
|
556
564
|
var recaptchaSiteKey = isNodeEnv2 ? process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY : import_meta.env.VITE_RECAPTCHA_SITE_KEY;
|
|
@@ -573,6 +581,32 @@ var initApp = function() {
|
|
|
573
581
|
}
|
|
574
582
|
};
|
|
575
583
|
var _initApp = initApp(), db = _initApp.db, auth = _initApp.auth, storage = _initApp.storage, app = _initApp.app, appCheck = _initApp.appCheck;
|
|
584
|
+
var googleLoginProvider = new import_auth.GoogleAuthProvider();
|
|
585
|
+
var useLoginWithGoogle = function() {
|
|
586
|
+
var signInWithGoogle = (0, import_react.useCallback)(/*#__PURE__*/ _async_to_generator(function() {
|
|
587
|
+
var result, user;
|
|
588
|
+
return _ts_generator(this, function(_state) {
|
|
589
|
+
switch(_state.label){
|
|
590
|
+
case 0:
|
|
591
|
+
return [
|
|
592
|
+
4,
|
|
593
|
+
(0, import_auth.signInWithPopup)(auth, googleLoginProvider)
|
|
594
|
+
];
|
|
595
|
+
case 1:
|
|
596
|
+
result = _state.sent();
|
|
597
|
+
user = result.user;
|
|
598
|
+
return [
|
|
599
|
+
2,
|
|
600
|
+
user
|
|
601
|
+
];
|
|
602
|
+
}
|
|
603
|
+
});
|
|
604
|
+
}), [
|
|
605
|
+
auth,
|
|
606
|
+
googleLoginProvider
|
|
607
|
+
]);
|
|
608
|
+
return signInWithGoogle;
|
|
609
|
+
};
|
|
576
610
|
var collections = {
|
|
577
611
|
clients: (0, import_firestore.collection)(db, "nx-clients"),
|
|
578
612
|
sites: (0, import_firestore.collection)(db, "nx-sites"),
|
|
@@ -1833,6 +1867,7 @@ var nx_api_call = /*#__PURE__*/ function() {
|
|
|
1833
1867
|
getUserCountryByIp: getUserCountryByIp,
|
|
1834
1868
|
get_all_documents: get_all_documents,
|
|
1835
1869
|
get_document_by_id: get_document_by_id,
|
|
1870
|
+
googleLoginProvider: googleLoginProvider,
|
|
1836
1871
|
handleChange: handleChange,
|
|
1837
1872
|
handleInvalid: handleInvalid,
|
|
1838
1873
|
handlePaste: handlePaste,
|
|
@@ -1869,6 +1904,7 @@ var nx_api_call = /*#__PURE__*/ function() {
|
|
|
1869
1904
|
textRegex: textRegex,
|
|
1870
1905
|
timestamp_to_millis: timestamp_to_millis,
|
|
1871
1906
|
timestamp_to_string: timestamp_to_string,
|
|
1907
|
+
useLoginWithGoogle: useLoginWithGoogle,
|
|
1872
1908
|
useStoreValues: useStoreValues,
|
|
1873
1909
|
useValidation: useValidation,
|
|
1874
1910
|
userNameFormat: userNameFormat
|
package/dist/helpers/index.mjs
CHANGED
|
@@ -231,7 +231,7 @@ function _ts_generator(thisArg, body) {
|
|
|
231
231
|
import moment from "moment";
|
|
232
232
|
import { initializeApp } from "firebase/app";
|
|
233
233
|
import { getStorage } from "firebase/storage";
|
|
234
|
-
import { getAuth } from "firebase/auth";
|
|
234
|
+
import { getAuth, GoogleAuthProvider, signInWithPopup } from "firebase/auth";
|
|
235
235
|
import { initializeAppCheck, ReCaptchaEnterpriseProvider } from "firebase/app-check";
|
|
236
236
|
import { addDoc, collection, deleteDoc, doc, getDoc, getDocs, query, setDoc, Timestamp, where, getFirestore, onSnapshot, orderBy } from "firebase/firestore";
|
|
237
237
|
// src/helpers/cars.ts
|
|
@@ -244,6 +244,7 @@ var formatCarNumber = function(car_number) {
|
|
|
244
244
|
return cn2;
|
|
245
245
|
};
|
|
246
246
|
// src/helpers/firebase.ts
|
|
247
|
+
import { useCallback } from "react";
|
|
247
248
|
var initApp = function() {
|
|
248
249
|
var isNodeEnv2 = typeof process !== "undefined" && process.env;
|
|
249
250
|
var firebaseConfig = {
|
|
@@ -257,6 +258,7 @@ var initApp = function() {
|
|
|
257
258
|
try {
|
|
258
259
|
var app2 = initializeApp(firebaseConfig);
|
|
259
260
|
var auth2 = getAuth(app2);
|
|
261
|
+
auth2.settings.appVerificationDisabledForTesting = false;
|
|
260
262
|
var db2 = getFirestore(app2);
|
|
261
263
|
var storage2 = getStorage(app2);
|
|
262
264
|
var recaptchaSiteKey = isNodeEnv2 ? process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY : import.meta.env.VITE_RECAPTCHA_SITE_KEY;
|
|
@@ -279,6 +281,32 @@ var initApp = function() {
|
|
|
279
281
|
}
|
|
280
282
|
};
|
|
281
283
|
var _initApp = initApp(), db = _initApp.db, auth = _initApp.auth, storage = _initApp.storage, app = _initApp.app, appCheck = _initApp.appCheck;
|
|
284
|
+
var googleLoginProvider = new GoogleAuthProvider();
|
|
285
|
+
var useLoginWithGoogle = function() {
|
|
286
|
+
var signInWithGoogle = useCallback(/*#__PURE__*/ _async_to_generator(function() {
|
|
287
|
+
var result, user;
|
|
288
|
+
return _ts_generator(this, function(_state) {
|
|
289
|
+
switch(_state.label){
|
|
290
|
+
case 0:
|
|
291
|
+
return [
|
|
292
|
+
4,
|
|
293
|
+
signInWithPopup(auth, googleLoginProvider)
|
|
294
|
+
];
|
|
295
|
+
case 1:
|
|
296
|
+
result = _state.sent();
|
|
297
|
+
user = result.user;
|
|
298
|
+
return [
|
|
299
|
+
2,
|
|
300
|
+
user
|
|
301
|
+
];
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
}), [
|
|
305
|
+
auth,
|
|
306
|
+
googleLoginProvider
|
|
307
|
+
]);
|
|
308
|
+
return signInWithGoogle;
|
|
309
|
+
};
|
|
282
310
|
var collections = {
|
|
283
311
|
clients: collection(db, "nx-clients"),
|
|
284
312
|
sites: collection(db, "nx-sites"),
|
|
@@ -1500,5 +1528,5 @@ var nx_api_call = /*#__PURE__*/ function() {
|
|
|
1500
1528
|
return _ref.apply(this, arguments);
|
|
1501
1529
|
};
|
|
1502
1530
|
}();
|
|
1503
|
-
export { 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, getUserCountryByIp, get_all_documents, get_document_by_id, 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, useStoreValues, useValidation, userNameFormat };
|
|
1531
|
+
export { 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, 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 };
|
|
1504
1532
|
//# sourceMappingURL=index.mjs.map
|
package/dist/hooks/index.js
CHANGED
|
@@ -262,7 +262,7 @@ __export(hooks_exports, {
|
|
|
262
262
|
module.exports = __toCommonJS(hooks_exports);
|
|
263
263
|
// src/hooks/global.ts
|
|
264
264
|
var import_akeyless_types_commons2 = require("akeyless-types-commons");
|
|
265
|
-
var
|
|
265
|
+
var import_react3 = require("react");
|
|
266
266
|
// src/helpers/firebase.ts
|
|
267
267
|
var import_moment = __toESM(require("moment"));
|
|
268
268
|
var import_app = require("firebase/app");
|
|
@@ -270,6 +270,7 @@ var import_storage = require("firebase/storage");
|
|
|
270
270
|
var import_auth = require("firebase/auth");
|
|
271
271
|
var import_app_check = require("firebase/app-check");
|
|
272
272
|
var import_firestore = require("firebase/firestore");
|
|
273
|
+
var import_react = require("react");
|
|
273
274
|
var import_meta = {};
|
|
274
275
|
var initApp = function() {
|
|
275
276
|
var isNodeEnv2 = typeof process !== "undefined" && process.env;
|
|
@@ -284,6 +285,7 @@ var initApp = function() {
|
|
|
284
285
|
try {
|
|
285
286
|
var app2 = (0, import_app.initializeApp)(firebaseConfig);
|
|
286
287
|
var auth2 = (0, import_auth.getAuth)(app2);
|
|
288
|
+
auth2.settings.appVerificationDisabledForTesting = false;
|
|
287
289
|
var db2 = (0, import_firestore.getFirestore)(app2);
|
|
288
290
|
var storage2 = (0, import_storage.getStorage)(app2);
|
|
289
291
|
var recaptchaSiteKey = isNodeEnv2 ? process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY : import_meta.env.VITE_RECAPTCHA_SITE_KEY;
|
|
@@ -306,6 +308,7 @@ var initApp = function() {
|
|
|
306
308
|
}
|
|
307
309
|
};
|
|
308
310
|
var _initApp = initApp(), db = _initApp.db, auth = _initApp.auth, storage = _initApp.storage, app = _initApp.app, appCheck = _initApp.appCheck;
|
|
311
|
+
var googleLoginProvider = new import_auth.GoogleAuthProvider();
|
|
309
312
|
var collections = {
|
|
310
313
|
clients: (0, import_firestore.collection)(db, "nx-clients"),
|
|
311
314
|
sites: (0, import_firestore.collection)(db, "nx-sites"),
|
|
@@ -488,9 +491,9 @@ var biDomain = isLocal ? "http://localhost:9002/api/bi" : baseDomain + "/bi";
|
|
|
488
491
|
var callCenterDomain = isLocal ? "http://localhost:9003/api/call-center" : baseDomain + "/call-center";
|
|
489
492
|
// src/hooks/react.ts
|
|
490
493
|
var import_lodash2 = require("lodash");
|
|
491
|
-
var
|
|
494
|
+
var import_react2 = require("react");
|
|
492
495
|
function useSafeEffect(callback, dependencies, error_message) {
|
|
493
|
-
(0,
|
|
496
|
+
(0, import_react2.useEffect)(function() {
|
|
494
497
|
try {
|
|
495
498
|
callback();
|
|
496
499
|
} catch (error) {
|
|
@@ -499,24 +502,24 @@ function useSafeEffect(callback, dependencies, error_message) {
|
|
|
499
502
|
}, dependencies);
|
|
500
503
|
}
|
|
501
504
|
var useDeepCompareMemo = function(factory, dependencies) {
|
|
502
|
-
var previousDepsRef = (0,
|
|
505
|
+
var previousDepsRef = (0, import_react2.useRef)([]);
|
|
503
506
|
if (!(0, import_lodash2.isEqual)(dependencies, previousDepsRef.current)) {
|
|
504
507
|
previousDepsRef.current = dependencies;
|
|
505
508
|
}
|
|
506
|
-
return (0,
|
|
509
|
+
return (0, import_react2.useMemo)(factory, previousDepsRef.current);
|
|
507
510
|
};
|
|
508
511
|
function useDeepCompareEffect(effect, dependencies) {
|
|
509
|
-
var previousDepsRef = (0,
|
|
512
|
+
var previousDepsRef = (0, import_react2.useRef)();
|
|
510
513
|
if (!(0, import_lodash2.isEqual)(previousDepsRef.current, dependencies)) {
|
|
511
514
|
previousDepsRef.current = dependencies;
|
|
512
515
|
}
|
|
513
|
-
(0,
|
|
516
|
+
(0, import_react2.useEffect)(effect, [
|
|
514
517
|
previousDepsRef.current
|
|
515
518
|
]);
|
|
516
519
|
}
|
|
517
520
|
// src/hooks/global.ts
|
|
518
521
|
var useDocumentTitle = function(title) {
|
|
519
|
-
(0,
|
|
522
|
+
(0, import_react3.useEffect)(function() {
|
|
520
523
|
document.title = title;
|
|
521
524
|
}, [
|
|
522
525
|
title
|
|
@@ -524,8 +527,8 @@ var useDocumentTitle = function(title) {
|
|
|
524
527
|
return null;
|
|
525
528
|
};
|
|
526
529
|
var useSnapshotBulk = function(configs, label) {
|
|
527
|
-
var snapshotsFirstTime = (0,
|
|
528
|
-
var unsubscribeFunctions = (0,
|
|
530
|
+
var snapshotsFirstTime = (0, import_react3.useRef)([]);
|
|
531
|
+
var unsubscribeFunctions = (0, import_react3.useRef)([]);
|
|
529
532
|
useDeepCompareEffect(function() {
|
|
530
533
|
var start = performance.now();
|
|
531
534
|
console.log("==> ".concat(label || "Custom snapshots", " started... "));
|
|
@@ -544,7 +547,7 @@ var useSnapshotBulk = function(configs, label) {
|
|
|
544
547
|
configs,
|
|
545
548
|
label
|
|
546
549
|
]);
|
|
547
|
-
(0,
|
|
550
|
+
(0, import_react3.useEffect)(function() {
|
|
548
551
|
return function() {
|
|
549
552
|
unsubscribeFunctions.current.forEach(function(unsubscribe) {
|
|
550
553
|
if (unsubscribe) {
|
|
@@ -555,7 +558,7 @@ var useSnapshotBulk = function(configs, label) {
|
|
|
555
558
|
}, []);
|
|
556
559
|
};
|
|
557
560
|
var useSetUserCountry = function(setUserCountry, changLang) {
|
|
558
|
-
(0,
|
|
561
|
+
(0, import_react3.useLayoutEffect)(function() {
|
|
559
562
|
var currentCountry = localStorage.getItem("userCountry");
|
|
560
563
|
if (!currentCountry) {
|
|
561
564
|
var updateCountry = /*#__PURE__*/ function() {
|
|
@@ -589,7 +592,7 @@ var useSetUserCountry = function(setUserCountry, changLang) {
|
|
|
589
592
|
return null;
|
|
590
593
|
};
|
|
591
594
|
// src/hooks/WebWorker.ts
|
|
592
|
-
var
|
|
595
|
+
var import_react5 = require("react");
|
|
593
596
|
// Annotate the CommonJS export names for ESM import in node:
|
|
594
597
|
0 && (module.exports = {
|
|
595
598
|
useDeepCompareEffect: useDeepCompareEffect,
|
package/dist/hooks/index.mjs
CHANGED
|
@@ -181,9 +181,10 @@ import { useEffect as useEffect2, useLayoutEffect, useRef as useRef2 } from "rea
|
|
|
181
181
|
import moment from "moment";
|
|
182
182
|
import { initializeApp } from "firebase/app";
|
|
183
183
|
import { getStorage } from "firebase/storage";
|
|
184
|
-
import { getAuth } from "firebase/auth";
|
|
184
|
+
import { getAuth, GoogleAuthProvider, signInWithPopup } from "firebase/auth";
|
|
185
185
|
import { initializeAppCheck, ReCaptchaEnterpriseProvider } from "firebase/app-check";
|
|
186
186
|
import { addDoc, collection, deleteDoc, doc, getDoc, getDocs, query, setDoc, Timestamp, where, getFirestore, onSnapshot, orderBy } from "firebase/firestore";
|
|
187
|
+
import { useCallback } from "react";
|
|
187
188
|
var initApp = function() {
|
|
188
189
|
var isNodeEnv2 = typeof process !== "undefined" && process.env;
|
|
189
190
|
var firebaseConfig = {
|
|
@@ -197,6 +198,7 @@ var initApp = function() {
|
|
|
197
198
|
try {
|
|
198
199
|
var app2 = initializeApp(firebaseConfig);
|
|
199
200
|
var auth2 = getAuth(app2);
|
|
201
|
+
auth2.settings.appVerificationDisabledForTesting = false;
|
|
200
202
|
var db2 = getFirestore(app2);
|
|
201
203
|
var storage2 = getStorage(app2);
|
|
202
204
|
var recaptchaSiteKey = isNodeEnv2 ? process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY : import.meta.env.VITE_RECAPTCHA_SITE_KEY;
|
|
@@ -219,6 +221,7 @@ var initApp = function() {
|
|
|
219
221
|
}
|
|
220
222
|
};
|
|
221
223
|
var _initApp = initApp(), db = _initApp.db, auth = _initApp.auth, storage = _initApp.storage, app = _initApp.app, appCheck = _initApp.appCheck;
|
|
224
|
+
var googleLoginProvider = new GoogleAuthProvider();
|
|
222
225
|
var collections = {
|
|
223
226
|
clients: collection(db, "nx-clients"),
|
|
224
227
|
sites: collection(db, "nx-sites"),
|
|
@@ -501,6 +504,6 @@ var useSetUserCountry = function(setUserCountry, changLang) {
|
|
|
501
504
|
return null;
|
|
502
505
|
};
|
|
503
506
|
// src/hooks/WebWorker.ts
|
|
504
|
-
import { useCallback, useEffect as useEffect3, useRef as useRef3 } from "react";
|
|
507
|
+
import { useCallback as useCallback2, useEffect as useEffect3, useRef as useRef3 } from "react";
|
|
505
508
|
export { useDeepCompareEffect, useDeepCompareMemo, useDocumentTitle, useSafeEffect, useSetUserCountry, useSnapshotBulk };
|
|
506
509
|
//# sourceMappingURL=index.mjs.map
|