akeyless-client-commons 1.0.66 → 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.
@@ -276,6 +276,185 @@ var is_iccid = function(number) {
276
276
  if (!number.startsWith("89")) return false;
277
277
  return true;
278
278
  };
279
+ // src/helpers/global.ts
280
+ import { CountryOptions } from "akeyless-types-commons";
281
+ import axios from "axios";
282
+ import { isEqual } from "lodash";
283
+ var calculateBearing = function(startLat, startLng, endLat, endLng) {
284
+ if (startLat === endLat || startLng === endLng) {
285
+ return 0;
286
+ }
287
+ if (startLat === void 0 || startLng === void 0 || endLat === void 0 || endLng === void 0) {
288
+ return 0;
289
+ }
290
+ var startLatRad = startLat * Math.PI / 180;
291
+ var startLngRad = startLng * Math.PI / 180;
292
+ var endLatRad = endLat * Math.PI / 180;
293
+ var endLngRad = endLng * Math.PI / 180;
294
+ var dLon = endLngRad - startLngRad;
295
+ var y = Math.sin(dLon) * Math.cos(endLatRad);
296
+ var x = Math.cos(startLatRad) * Math.sin(endLatRad) - Math.sin(startLatRad) * Math.cos(endLatRad) * Math.cos(dLon);
297
+ var bearing = Math.atan2(y, x) * 180 / Math.PI;
298
+ return (bearing + 360) % 360;
299
+ };
300
+ var renderOnce = function() {
301
+ return true;
302
+ };
303
+ var propsAreEqual = function(prevProps, nextProps) {
304
+ return isEqual(prevProps, nextProps);
305
+ };
306
+ var getUserCountryByIp = /*#__PURE__*/ function() {
307
+ var _ref = _async_to_generator(function() {
308
+ var response, error;
309
+ return _ts_generator(this, function(_state) {
310
+ switch(_state.label){
311
+ case 0:
312
+ _state.trys.push([
313
+ 0,
314
+ 2,
315
+ ,
316
+ 3
317
+ ]);
318
+ return [
319
+ 4,
320
+ axios.get("https://ipapi.co/json/")
321
+ ];
322
+ case 1:
323
+ response = _state.sent();
324
+ return [
325
+ 2,
326
+ (response.data.country_code || CountryOptions.IL).toLowerCase()
327
+ ];
328
+ case 2:
329
+ error = _state.sent();
330
+ console.error("Error fetching Country:", error);
331
+ return [
332
+ 2,
333
+ CountryOptions.IL
334
+ ];
335
+ case 3:
336
+ return [
337
+ 2
338
+ ];
339
+ }
340
+ });
341
+ });
342
+ return function getUserCountryByIp() {
343
+ return _ref.apply(this, arguments);
344
+ };
345
+ }();
346
+ var parsePermissions = function(object) {
347
+ if (!(object === null || object === void 0 ? void 0 : object.features)) {
348
+ return {};
349
+ }
350
+ var features = object.features;
351
+ var result = {};
352
+ features.forEach(function(feature) {
353
+ if (!feature.includes("__")) {
354
+ return;
355
+ }
356
+ var _feature_split = _sliced_to_array(feature.split("__"), 2), featureType = _feature_split[0], featureName = _feature_split[1];
357
+ if (!featureType || !featureName) {
358
+ return;
359
+ }
360
+ if (!result[featureType]) {
361
+ result[featureType] = {};
362
+ }
363
+ result[featureType][featureName] = true;
364
+ });
365
+ return result;
366
+ };
367
+ var initializeUserPermissions = /*#__PURE__*/ function() {
368
+ var _ref = _async_to_generator(function(param) {
369
+ var phoneNumber, email, firstTimeArray, getUpdatePermissions, unsubscribe, permissions, queryConditions, _snapshot, promise, unsubscribeSnapshot, error;
370
+ return _ts_generator(this, function(_state) {
371
+ switch(_state.label){
372
+ case 0:
373
+ phoneNumber = param.phoneNumber, email = param.email, firstTimeArray = param.firstTimeArray, getUpdatePermissions = param.getUpdatePermissions;
374
+ unsubscribe = null;
375
+ permissions = {};
376
+ _state.label = 1;
377
+ case 1:
378
+ _state.trys.push([
379
+ 1,
380
+ 3,
381
+ ,
382
+ 4
383
+ ]);
384
+ queryConditions = [
385
+ phoneNumber ? {
386
+ field_name: "phone_number",
387
+ operator: "in",
388
+ value: [
389
+ phoneNumber,
390
+ local_israel_phone_format(phoneNumber)
391
+ ]
392
+ } : {
393
+ field_name: "email",
394
+ operator: "==",
395
+ value: email
396
+ }
397
+ ];
398
+ _snapshot = snapshot({
399
+ collectionName: "nx-users",
400
+ conditions: queryConditions,
401
+ onFirstTime: function(docs) {
402
+ if (!docs.length) {
403
+ throw new Error("User not found");
404
+ }
405
+ permissions = parsePermissions(docs[0]);
406
+ getUpdatePermissions(parsePermissions(docs[0]));
407
+ },
408
+ onModify: function(docs) {
409
+ getUpdatePermissions(parsePermissions(docs[0]));
410
+ }
411
+ }, firstTimeArray), promise = _snapshot.promise, unsubscribeSnapshot = _snapshot.unsubscribe;
412
+ unsubscribe = unsubscribeSnapshot;
413
+ return [
414
+ 4,
415
+ promise
416
+ ];
417
+ case 2:
418
+ _state.sent();
419
+ return [
420
+ 2,
421
+ {
422
+ unsubscribe: unsubscribe,
423
+ permissions: permissions
424
+ }
425
+ ];
426
+ case 3:
427
+ error = _state.sent();
428
+ if (unsubscribe) {
429
+ unsubscribe();
430
+ }
431
+ console.error("Error initializing user permissions:", error.message);
432
+ throw error;
433
+ case 4:
434
+ return [
435
+ 2
436
+ ];
437
+ }
438
+ });
439
+ });
440
+ return function initializeUserPermissions(_) {
441
+ return _ref.apply(this, arguments);
442
+ };
443
+ }();
444
+ var userNameFormat = function(user) {
445
+ return "".concat((user === null || user === void 0 ? void 0 : user.first_name) || "", " ").concat((user === null || user === void 0 ? void 0 : user.last_name) || "").trim();
446
+ };
447
+ var multiStringFormat = function(str1, str2, str3) {
448
+ return "".concat(str1, " ").concat(str2 || "", " ").concat(str3 || "").trim();
449
+ };
450
+ var getLocationUrl = function(lng, lat) {
451
+ return "https://www.google.com/maps?q=".concat(lat, ",").concat(lng);
452
+ };
453
+ var isNodeEnv = typeof process !== "undefined" && process.env;
454
+ var _ref = {
455
+ mode: isNodeEnv ? process.env.NEXT_PUBLIC_MODE : import.meta.env.VITE_MODE,
456
+ isLocal: (isNodeEnv ? process.env.NEXT_PUBLIC_IS_LOCAL : import.meta.env.VITE_is_local) === "true"
457
+ }, mode = _ref.mode, isLocal = _ref.isLocal;
279
458
  // src/helpers/firebase.ts
280
459
  var initApp = function() {
281
460
  var isNodeEnv2 = typeof process !== "undefined" && process.env;
@@ -695,7 +874,7 @@ var delete_document = /*#__PURE__*/ function() {
695
874
  return _ref.apply(this, arguments);
696
875
  };
697
876
  }();
698
- var query_document = /*#__PURE__*/ function() {
877
+ var query_document2 = /*#__PURE__*/ function() {
699
878
  var _ref = _async_to_generator(function(collection_path, field_name, operator, value) {
700
879
  var ignore_log, q, query_snapshot, documents, error;
701
880
  var _arguments = arguments;
@@ -744,7 +923,7 @@ var query_document = /*#__PURE__*/ function() {
744
923
  }
745
924
  });
746
925
  });
747
- return function query_document(collection_path, field_name, operator, value) {
926
+ return function query_document2(collection_path, field_name, operator, value) {
748
927
  return _ref.apply(this, arguments);
749
928
  };
750
929
  }();
@@ -1119,7 +1298,7 @@ var getUserByPhone = /*#__PURE__*/ function() {
1119
1298
  ];
1120
1299
  return [
1121
1300
  4,
1122
- query_document("nx-users", "phone_number", "in", phones, true)
1301
+ query_document2("nx-users", "phone_number", "in", phones, true)
1123
1302
  ];
1124
1303
  case 1:
1125
1304
  return [
@@ -1140,7 +1319,7 @@ var getUserByEmail = /*#__PURE__*/ function() {
1140
1319
  case 0:
1141
1320
  return [
1142
1321
  4,
1143
- query_document("nx-users", "email", "==", email, true)
1322
+ query_document2("nx-users", "email", "==", email, true)
1144
1323
  ];
1145
1324
  case 1:
1146
1325
  return [
@@ -1276,185 +1455,16 @@ var addAuditRecord = /*#__PURE__*/ function() {
1276
1455
  return _ref.apply(this, arguments);
1277
1456
  };
1278
1457
  }();
1279
- // src/helpers/global.ts
1280
- import { CountryOptions } from "akeyless-types-commons";
1281
- import axios from "axios";
1282
- import { isEqual } from "lodash";
1283
- var calculateBearing = function(startLat, startLng, endLat, endLng) {
1284
- if (startLat === endLat || startLng === endLng) {
1285
- return 0;
1458
+ var validateUserStatusAndPermissions = function(user, app2) {
1459
+ if (!user || user.status === "deleted") {
1460
+ throw new Error("number_not_in_system");
1286
1461
  }
1287
- if (startLat === void 0 || startLng === void 0 || endLat === void 0 || endLng === void 0) {
1288
- return 0;
1462
+ var userPermissions = parsePermissions(user);
1463
+ if (!userPermissions[app2]) {
1464
+ throw new Error("user_without_permission");
1289
1465
  }
1290
- var startLatRad = startLat * Math.PI / 180;
1291
- var startLngRad = startLng * Math.PI / 180;
1292
- var endLatRad = endLat * Math.PI / 180;
1293
- var endLngRad = endLng * Math.PI / 180;
1294
- var dLon = endLngRad - startLngRad;
1295
- var y = Math.sin(dLon) * Math.cos(endLatRad);
1296
- var x = Math.cos(startLatRad) * Math.sin(endLatRad) - Math.sin(startLatRad) * Math.cos(endLatRad) * Math.cos(dLon);
1297
- var bearing = Math.atan2(y, x) * 180 / Math.PI;
1298
- return (bearing + 360) % 360;
1466
+ return userPermissions;
1299
1467
  };
1300
- var renderOnce = function() {
1301
- return true;
1302
- };
1303
- var propsAreEqual = function(prevProps, nextProps) {
1304
- return isEqual(prevProps, nextProps);
1305
- };
1306
- var getUserCountryByIp = /*#__PURE__*/ function() {
1307
- var _ref = _async_to_generator(function() {
1308
- var response, error;
1309
- return _ts_generator(this, function(_state) {
1310
- switch(_state.label){
1311
- case 0:
1312
- _state.trys.push([
1313
- 0,
1314
- 2,
1315
- ,
1316
- 3
1317
- ]);
1318
- return [
1319
- 4,
1320
- axios.get("https://ipapi.co/json/")
1321
- ];
1322
- case 1:
1323
- response = _state.sent();
1324
- return [
1325
- 2,
1326
- (response.data.country_code || CountryOptions.IL).toLowerCase()
1327
- ];
1328
- case 2:
1329
- error = _state.sent();
1330
- console.error("Error fetching Country:", error);
1331
- return [
1332
- 2,
1333
- CountryOptions.IL
1334
- ];
1335
- case 3:
1336
- return [
1337
- 2
1338
- ];
1339
- }
1340
- });
1341
- });
1342
- return function getUserCountryByIp() {
1343
- return _ref.apply(this, arguments);
1344
- };
1345
- }();
1346
- var parsePermissions = function(object) {
1347
- if (!(object === null || object === void 0 ? void 0 : object.features)) {
1348
- return {};
1349
- }
1350
- var features = object.features;
1351
- var result = {};
1352
- features.forEach(function(feature) {
1353
- if (!feature.includes("__")) {
1354
- return;
1355
- }
1356
- var _feature_split = _sliced_to_array(feature.split("__"), 2), featureType = _feature_split[0], featureName = _feature_split[1];
1357
- if (!featureType || !featureName) {
1358
- return;
1359
- }
1360
- if (!result[featureType]) {
1361
- result[featureType] = {};
1362
- }
1363
- result[featureType][featureName] = true;
1364
- });
1365
- return result;
1366
- };
1367
- var initializeUserPermissions = /*#__PURE__*/ function() {
1368
- var _ref = _async_to_generator(function(param) {
1369
- var phoneNumber, email, firstTimeArray, getUpdatePermissions, unsubscribe, permissions, queryConditions, _snapshot, promise, unsubscribeSnapshot, error;
1370
- return _ts_generator(this, function(_state) {
1371
- switch(_state.label){
1372
- case 0:
1373
- phoneNumber = param.phoneNumber, email = param.email, firstTimeArray = param.firstTimeArray, getUpdatePermissions = param.getUpdatePermissions;
1374
- unsubscribe = null;
1375
- permissions = {};
1376
- _state.label = 1;
1377
- case 1:
1378
- _state.trys.push([
1379
- 1,
1380
- 3,
1381
- ,
1382
- 4
1383
- ]);
1384
- queryConditions = [
1385
- phoneNumber ? {
1386
- field_name: "phone_number",
1387
- operator: "in",
1388
- value: [
1389
- phoneNumber,
1390
- local_israel_phone_format(phoneNumber)
1391
- ]
1392
- } : {
1393
- field_name: "email",
1394
- operator: "==",
1395
- value: email
1396
- }
1397
- ];
1398
- _snapshot = snapshot({
1399
- collectionName: "nx-users",
1400
- conditions: queryConditions,
1401
- onFirstTime: function(docs) {
1402
- if (!docs.length) {
1403
- throw new Error("User not found");
1404
- }
1405
- permissions = parsePermissions(docs[0]);
1406
- getUpdatePermissions(parsePermissions(docs[0]));
1407
- },
1408
- onModify: function(docs) {
1409
- getUpdatePermissions(parsePermissions(docs[0]));
1410
- }
1411
- }, firstTimeArray), promise = _snapshot.promise, unsubscribeSnapshot = _snapshot.unsubscribe;
1412
- unsubscribe = unsubscribeSnapshot;
1413
- return [
1414
- 4,
1415
- promise
1416
- ];
1417
- case 2:
1418
- _state.sent();
1419
- return [
1420
- 2,
1421
- {
1422
- unsubscribe: unsubscribe,
1423
- permissions: permissions
1424
- }
1425
- ];
1426
- case 3:
1427
- error = _state.sent();
1428
- if (unsubscribe) {
1429
- unsubscribe();
1430
- }
1431
- console.error("Error initializing user permissions:", error.message);
1432
- throw error;
1433
- case 4:
1434
- return [
1435
- 2
1436
- ];
1437
- }
1438
- });
1439
- });
1440
- return function initializeUserPermissions(_) {
1441
- return _ref.apply(this, arguments);
1442
- };
1443
- }();
1444
- var userNameFormat = function(user) {
1445
- return "".concat((user === null || user === void 0 ? void 0 : user.first_name) || "", " ").concat((user === null || user === void 0 ? void 0 : user.last_name) || "").trim();
1446
- };
1447
- var multiStringFormat = function(str1, str2, str3) {
1448
- return "".concat(str1, " ").concat(str2 || "", " ").concat(str3 || "").trim();
1449
- };
1450
- var getLocationUrl = function(lng, lat) {
1451
- return "https://www.google.com/maps?q=".concat(lat, ",").concat(lng);
1452
- };
1453
- var isNodeEnv = typeof process !== "undefined" && process.env;
1454
- var _ref = {
1455
- mode: isNodeEnv ? process.env.NEXT_PUBLIC_MODE : import.meta.env.VITE_MODE,
1456
- isLocal: (isNodeEnv ? process.env.NEXT_PUBLIC_IS_LOCAL : import.meta.env.VITE_is_local) === "true"
1457
- }, mode = _ref.mode, isLocal = _ref.isLocal;
1458
1468
  // src/helpers/forms.ts
1459
1469
  import XRegExp from "xregexp";
1460
1470
  var textRegex = XRegExp("[^\\p{L}\\s-]", "gu");
@@ -1704,5 +1714,5 @@ var nx_api_call = /*#__PURE__*/ function() {
1704
1714
  return _ref.apply(this, arguments);
1705
1715
  };
1706
1716
  }();
1707
- export { 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 };
1717
+ export { 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_document2 as 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 };
1708
1718
  //# sourceMappingURL=index.mjs.map
@@ -273,17 +273,67 @@ var import_firestore = require("firebase/firestore");
273
273
  var import_react = require("react");
274
274
  // src/helpers/phoneNumber.ts
275
275
  var import_libphonenumber_js = require("libphonenumber-js");
276
- // src/helpers/firebase.ts
276
+ // src/helpers/global.ts
277
+ var import_akeyless_types_commons = require("akeyless-types-commons");
278
+ var import_axios = __toESM(require("axios"));
279
+ var import_lodash = require("lodash");
277
280
  var import_meta = {};
281
+ var getUserCountryByIp = /*#__PURE__*/ function() {
282
+ var _ref = _async_to_generator(function() {
283
+ var response, error;
284
+ return _ts_generator(this, function(_state) {
285
+ switch(_state.label){
286
+ case 0:
287
+ _state.trys.push([
288
+ 0,
289
+ 2,
290
+ ,
291
+ 3
292
+ ]);
293
+ return [
294
+ 4,
295
+ import_axios.default.get("https://ipapi.co/json/")
296
+ ];
297
+ case 1:
298
+ response = _state.sent();
299
+ return [
300
+ 2,
301
+ (response.data.country_code || import_akeyless_types_commons.CountryOptions.IL).toLowerCase()
302
+ ];
303
+ case 2:
304
+ error = _state.sent();
305
+ console.error("Error fetching Country:", error);
306
+ return [
307
+ 2,
308
+ import_akeyless_types_commons.CountryOptions.IL
309
+ ];
310
+ case 3:
311
+ return [
312
+ 2
313
+ ];
314
+ }
315
+ });
316
+ });
317
+ return function getUserCountryByIp() {
318
+ return _ref.apply(this, arguments);
319
+ };
320
+ }();
321
+ var isNodeEnv = typeof process !== "undefined" && process.env;
322
+ var _ref = {
323
+ mode: isNodeEnv ? process.env.NEXT_PUBLIC_MODE : import_meta.env.VITE_MODE,
324
+ isLocal: (isNodeEnv ? process.env.NEXT_PUBLIC_IS_LOCAL : import_meta.env.VITE_is_local) === "true"
325
+ }, mode = _ref.mode, isLocal = _ref.isLocal;
326
+ // src/helpers/firebase.ts
327
+ var import_meta2 = {};
278
328
  var initApp = function() {
279
329
  var isNodeEnv2 = typeof process !== "undefined" && process.env;
280
330
  var firebaseConfig = {
281
- apiKey: isNodeEnv2 ? process.env.NEXT_PUBLIC_API_KEY : import_meta.env.VITE_API_KEY,
282
- authDomain: isNodeEnv2 ? process.env.NEXT_PUBLIC_AUTH_DOMAIN : import_meta.env.VITE_AUTH_DOMAIN,
283
- projectId: isNodeEnv2 ? process.env.NEXT_PUBLIC_PROJECT_ID : import_meta.env.VITE_PROJECT_ID,
284
- storageBucket: isNodeEnv2 ? process.env.NEXT_PUBLIC_STORAGE_BUCKET : import_meta.env.VITE_STORAGE_BUCKET,
285
- messagingSenderId: isNodeEnv2 ? process.env.NEXT_PUBLIC_MESSAGING_SENDER_ID : import_meta.env.VITE_MESSAGING_SENDER_ID,
286
- appId: isNodeEnv2 ? process.env.NEXT_PUBLIC_APP_ID : import_meta.env.VITE_APP_ID
331
+ apiKey: isNodeEnv2 ? process.env.NEXT_PUBLIC_API_KEY : import_meta2.env.VITE_API_KEY,
332
+ authDomain: isNodeEnv2 ? process.env.NEXT_PUBLIC_AUTH_DOMAIN : import_meta2.env.VITE_AUTH_DOMAIN,
333
+ projectId: isNodeEnv2 ? process.env.NEXT_PUBLIC_PROJECT_ID : import_meta2.env.VITE_PROJECT_ID,
334
+ storageBucket: isNodeEnv2 ? process.env.NEXT_PUBLIC_STORAGE_BUCKET : import_meta2.env.VITE_STORAGE_BUCKET,
335
+ messagingSenderId: isNodeEnv2 ? process.env.NEXT_PUBLIC_MESSAGING_SENDER_ID : import_meta2.env.VITE_MESSAGING_SENDER_ID,
336
+ appId: isNodeEnv2 ? process.env.NEXT_PUBLIC_APP_ID : import_meta2.env.VITE_APP_ID
287
337
  };
288
338
  try {
289
339
  var app2 = (0, import_app.initializeApp)(firebaseConfig);
@@ -292,7 +342,7 @@ var initApp = function() {
292
342
  var db2 = (0, import_firestore.getFirestore)(app2);
293
343
  var storage2 = (0, import_storage.getStorage)(app2);
294
344
  var googleLoginProvider2 = new import_auth.GoogleAuthProvider();
295
- var recaptchaSiteKey = isNodeEnv2 ? process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY : import_meta.env.VITE_RECAPTCHA_SITE_KEY;
345
+ var recaptchaSiteKey = isNodeEnv2 ? process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY : import_meta2.env.VITE_RECAPTCHA_SITE_KEY;
296
346
  var result = {
297
347
  db: db2,
298
348
  auth: auth2,
@@ -416,56 +466,6 @@ var snapshot = function(config, snapshotsFirstTime) {
416
466
  unsubscribe: unsubscribe
417
467
  };
418
468
  };
419
- // src/helpers/global.ts
420
- var import_akeyless_types_commons = require("akeyless-types-commons");
421
- var import_axios = __toESM(require("axios"));
422
- var import_lodash = require("lodash");
423
- var import_meta2 = {};
424
- var getUserCountryByIp = /*#__PURE__*/ function() {
425
- var _ref = _async_to_generator(function() {
426
- var response, error;
427
- return _ts_generator(this, function(_state) {
428
- switch(_state.label){
429
- case 0:
430
- _state.trys.push([
431
- 0,
432
- 2,
433
- ,
434
- 3
435
- ]);
436
- return [
437
- 4,
438
- import_axios.default.get("https://ipapi.co/json/")
439
- ];
440
- case 1:
441
- response = _state.sent();
442
- return [
443
- 2,
444
- (response.data.country_code || import_akeyless_types_commons.CountryOptions.IL).toLowerCase()
445
- ];
446
- case 2:
447
- error = _state.sent();
448
- console.error("Error fetching Country:", error);
449
- return [
450
- 2,
451
- import_akeyless_types_commons.CountryOptions.IL
452
- ];
453
- case 3:
454
- return [
455
- 2
456
- ];
457
- }
458
- });
459
- });
460
- return function getUserCountryByIp() {
461
- return _ref.apply(this, arguments);
462
- };
463
- }();
464
- var isNodeEnv = typeof process !== "undefined" && process.env;
465
- var _ref = {
466
- mode: isNodeEnv ? process.env.NEXT_PUBLIC_MODE : import_meta2.env.VITE_MODE,
467
- isLocal: (isNodeEnv ? process.env.NEXT_PUBLIC_IS_LOCAL : import_meta2.env.VITE_is_local) === "true"
468
- }, mode = _ref.mode, isLocal = _ref.isLocal;
469
469
  // src/helpers/forms.ts
470
470
  var import_xregexp = __toESM(require("xregexp"));
471
471
  var textRegex = (0, import_xregexp.default)("[^\\p{L}\\s-]", "gu");
@@ -187,6 +187,55 @@ import { addDoc, collection, deleteDoc, doc, getDoc, getDocs, query, setDoc, Tim
187
187
  import { useCallback } from "react";
188
188
  // src/helpers/phoneNumber.ts
189
189
  import { parsePhoneNumberFromString } from "libphonenumber-js";
190
+ // src/helpers/global.ts
191
+ import { CountryOptions } from "akeyless-types-commons";
192
+ import axios from "axios";
193
+ import { isEqual } from "lodash";
194
+ var getUserCountryByIp = /*#__PURE__*/ function() {
195
+ var _ref = _async_to_generator(function() {
196
+ var response, error;
197
+ return _ts_generator(this, function(_state) {
198
+ switch(_state.label){
199
+ case 0:
200
+ _state.trys.push([
201
+ 0,
202
+ 2,
203
+ ,
204
+ 3
205
+ ]);
206
+ return [
207
+ 4,
208
+ axios.get("https://ipapi.co/json/")
209
+ ];
210
+ case 1:
211
+ response = _state.sent();
212
+ return [
213
+ 2,
214
+ (response.data.country_code || CountryOptions.IL).toLowerCase()
215
+ ];
216
+ case 2:
217
+ error = _state.sent();
218
+ console.error("Error fetching Country:", error);
219
+ return [
220
+ 2,
221
+ CountryOptions.IL
222
+ ];
223
+ case 3:
224
+ return [
225
+ 2
226
+ ];
227
+ }
228
+ });
229
+ });
230
+ return function getUserCountryByIp() {
231
+ return _ref.apply(this, arguments);
232
+ };
233
+ }();
234
+ var isNodeEnv = typeof process !== "undefined" && process.env;
235
+ var _ref = {
236
+ mode: isNodeEnv ? process.env.NEXT_PUBLIC_MODE : import.meta.env.VITE_MODE,
237
+ isLocal: (isNodeEnv ? process.env.NEXT_PUBLIC_IS_LOCAL : import.meta.env.VITE_is_local) === "true"
238
+ }, mode = _ref.mode, isLocal = _ref.isLocal;
190
239
  // src/helpers/firebase.ts
191
240
  var initApp = function() {
192
241
  var isNodeEnv2 = typeof process !== "undefined" && process.env;
@@ -329,55 +378,6 @@ var snapshot = function(config, snapshotsFirstTime) {
329
378
  unsubscribe: unsubscribe
330
379
  };
331
380
  };
332
- // src/helpers/global.ts
333
- import { CountryOptions } from "akeyless-types-commons";
334
- import axios from "axios";
335
- import { isEqual } from "lodash";
336
- var getUserCountryByIp = /*#__PURE__*/ function() {
337
- var _ref = _async_to_generator(function() {
338
- var response, error;
339
- return _ts_generator(this, function(_state) {
340
- switch(_state.label){
341
- case 0:
342
- _state.trys.push([
343
- 0,
344
- 2,
345
- ,
346
- 3
347
- ]);
348
- return [
349
- 4,
350
- axios.get("https://ipapi.co/json/")
351
- ];
352
- case 1:
353
- response = _state.sent();
354
- return [
355
- 2,
356
- (response.data.country_code || CountryOptions.IL).toLowerCase()
357
- ];
358
- case 2:
359
- error = _state.sent();
360
- console.error("Error fetching Country:", error);
361
- return [
362
- 2,
363
- CountryOptions.IL
364
- ];
365
- case 3:
366
- return [
367
- 2
368
- ];
369
- }
370
- });
371
- });
372
- return function getUserCountryByIp() {
373
- return _ref.apply(this, arguments);
374
- };
375
- }();
376
- var isNodeEnv = typeof process !== "undefined" && process.env;
377
- var _ref = {
378
- mode: isNodeEnv ? process.env.NEXT_PUBLIC_MODE : import.meta.env.VITE_MODE,
379
- isLocal: (isNodeEnv ? process.env.NEXT_PUBLIC_IS_LOCAL : import.meta.env.VITE_is_local) === "true"
380
- }, mode = _ref.mode, isLocal = _ref.isLocal;
381
381
  // src/helpers/forms.ts
382
382
  import XRegExp from "xregexp";
383
383
  var textRegex = XRegExp("[^\\p{L}\\s-]", "gu");