akeyless-client-commons 1.0.180 → 1.0.182
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.d.mts +3 -3
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.js +37 -36
- package/dist/components/index.mjs +28 -27
- package/dist/helpers/index.d.mts +17 -14
- package/dist/helpers/index.d.ts +17 -14
- package/dist/helpers/index.js +175 -153
- package/dist/helpers/index.mjs +162 -144
- package/dist/hooks/index.js +58 -58
- package/dist/hooks/index.mjs +49 -49
- package/package.json +2 -2
package/dist/helpers/index.mjs
CHANGED
|
@@ -280,73 +280,24 @@ var is_iccid = function(number) {
|
|
|
280
280
|
if (!number.startsWith("89")) return false;
|
|
281
281
|
return true;
|
|
282
282
|
};
|
|
283
|
-
// src/helpers/
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
if (startLat === endLat || startLng === endLng) {
|
|
289
|
-
return 0;
|
|
283
|
+
// src/helpers/permissions.ts
|
|
284
|
+
var checkUserPermissions = function(userPermissions, entity, permissions, mode2) {
|
|
285
|
+
var userValues = userPermissions[entity];
|
|
286
|
+
if (!userValues) {
|
|
287
|
+
return false;
|
|
290
288
|
}
|
|
291
|
-
if (
|
|
292
|
-
return
|
|
289
|
+
if (!(permissions === null || permissions === void 0 ? void 0 : permissions.length)) {
|
|
290
|
+
return true;
|
|
293
291
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
var endLngRad = endLng * Math.PI / 180;
|
|
298
|
-
var dLon = endLngRad - startLngRad;
|
|
299
|
-
var y = Math.sin(dLon) * Math.cos(endLatRad);
|
|
300
|
-
var x = Math.cos(startLatRad) * Math.sin(endLatRad) - Math.sin(startLatRad) * Math.cos(endLatRad) * Math.cos(dLon);
|
|
301
|
-
var bearing = Math.atan2(y, x) * 180 / Math.PI;
|
|
302
|
-
return (bearing + 360) % 360;
|
|
303
|
-
};
|
|
304
|
-
var renderOnce = function() {
|
|
305
|
-
return true;
|
|
306
|
-
};
|
|
307
|
-
var propsAreEqual = function(prevProps, nextProps) {
|
|
308
|
-
return isEqual(prevProps, nextProps);
|
|
309
|
-
};
|
|
310
|
-
var getUserCountryByIp = /*#__PURE__*/ function() {
|
|
311
|
-
var _ref = _async_to_generator(function() {
|
|
312
|
-
var response, error;
|
|
313
|
-
return _ts_generator(this, function(_state) {
|
|
314
|
-
switch(_state.label){
|
|
315
|
-
case 0:
|
|
316
|
-
_state.trys.push([
|
|
317
|
-
0,
|
|
318
|
-
2,
|
|
319
|
-
,
|
|
320
|
-
3
|
|
321
|
-
]);
|
|
322
|
-
return [
|
|
323
|
-
4,
|
|
324
|
-
axios.get("https://ipapi.co/json/")
|
|
325
|
-
];
|
|
326
|
-
case 1:
|
|
327
|
-
response = _state.sent();
|
|
328
|
-
return [
|
|
329
|
-
2,
|
|
330
|
-
(response.data.country_code || CountryOptions.IL).toLowerCase()
|
|
331
|
-
];
|
|
332
|
-
case 2:
|
|
333
|
-
error = _state.sent();
|
|
334
|
-
console.error("Error fetching Country:", error);
|
|
335
|
-
return [
|
|
336
|
-
2,
|
|
337
|
-
CountryOptions.IL
|
|
338
|
-
];
|
|
339
|
-
case 3:
|
|
340
|
-
return [
|
|
341
|
-
2
|
|
342
|
-
];
|
|
343
|
-
}
|
|
292
|
+
if (mode2 === "every") {
|
|
293
|
+
return permissions.every(function(permission) {
|
|
294
|
+
return userValues[permission];
|
|
344
295
|
});
|
|
296
|
+
}
|
|
297
|
+
return permissions.some(function(permission) {
|
|
298
|
+
return userValues[permission];
|
|
345
299
|
});
|
|
346
|
-
|
|
347
|
-
return _ref.apply(this, arguments);
|
|
348
|
-
};
|
|
349
|
-
}();
|
|
300
|
+
};
|
|
350
301
|
var parsePermissions = function(object) {
|
|
351
302
|
if (!(object === null || object === void 0 ? void 0 : object.features)) {
|
|
352
303
|
return {};
|
|
@@ -445,82 +396,6 @@ var initializeUserPermissions = /*#__PURE__*/ function() {
|
|
|
445
396
|
return _ref.apply(this, arguments);
|
|
446
397
|
};
|
|
447
398
|
}();
|
|
448
|
-
var userNameFormat = function(user) {
|
|
449
|
-
return "".concat((user === null || user === void 0 ? void 0 : user.first_name) || "", " ").concat((user === null || user === void 0 ? void 0 : user.last_name) || "").trim();
|
|
450
|
-
};
|
|
451
|
-
var multiStringFormat = function(str1, str2, str3) {
|
|
452
|
-
return "".concat(str1, " ").concat(str2 || "", " ").concat(str3 || "").trim();
|
|
453
|
-
};
|
|
454
|
-
var getLocationUrl = function(lng, lat) {
|
|
455
|
-
return "https://www.google.com/maps?q=".concat(lat, ",").concat(lng);
|
|
456
|
-
};
|
|
457
|
-
var isNodeEnv = typeof process !== "undefined" && process.env;
|
|
458
|
-
var _ref = {
|
|
459
|
-
mode: isNodeEnv ? process.env.NEXT_PUBLIC_MODE : import.meta.env.VITE_MODE,
|
|
460
|
-
isLocal: (isNodeEnv ? process.env.NEXT_PUBLIC_IS_LOCAL : import.meta.env.VITE_is_local) === "true"
|
|
461
|
-
}, mode = _ref.mode, isLocal = _ref.isLocal;
|
|
462
|
-
var getFixedNumber = function() {
|
|
463
|
-
var number = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0, fix = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 4;
|
|
464
|
-
var sum_value = number % 1 === 0 ? number : number.toFixed(fix).replace(/\.?0+$/, "");
|
|
465
|
-
return String(sum_value);
|
|
466
|
-
};
|
|
467
|
-
var getAddressByGeo = /*#__PURE__*/ function() {
|
|
468
|
-
var _ref = _async_to_generator(function(param, currentLanguage) {
|
|
469
|
-
var lat, lng, language, apiKey, url, _response_data, response, error;
|
|
470
|
-
return _ts_generator(this, function(_state) {
|
|
471
|
-
switch(_state.label){
|
|
472
|
-
case 0:
|
|
473
|
-
lat = param.lat, lng = param.lng;
|
|
474
|
-
language = currentLanguage === LanguageOptions.He ? "iw" : "en";
|
|
475
|
-
apiKey = isNodeEnv ? process.env.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY : import.meta.env.VITE_api_google_key;
|
|
476
|
-
url = "https://maps.googleapis.com/maps/api/geocode/json?latlng=".concat(lat, ",").concat(lng, "&key=").concat(apiKey, "&language=").concat(language);
|
|
477
|
-
_state.label = 1;
|
|
478
|
-
case 1:
|
|
479
|
-
_state.trys.push([
|
|
480
|
-
1,
|
|
481
|
-
3,
|
|
482
|
-
,
|
|
483
|
-
4
|
|
484
|
-
]);
|
|
485
|
-
return [
|
|
486
|
-
4,
|
|
487
|
-
axios.get(url)
|
|
488
|
-
];
|
|
489
|
-
case 2:
|
|
490
|
-
response = _state.sent();
|
|
491
|
-
if (response === null || response === void 0 ? void 0 : (_response_data = response.data) === null || _response_data === void 0 ? void 0 : _response_data.results[0]) {
|
|
492
|
-
return [
|
|
493
|
-
2,
|
|
494
|
-
response.data.results[0].formatted_address.slice(0, 35)
|
|
495
|
-
];
|
|
496
|
-
} else {
|
|
497
|
-
return [
|
|
498
|
-
2,
|
|
499
|
-
"address not found"
|
|
500
|
-
];
|
|
501
|
-
}
|
|
502
|
-
return [
|
|
503
|
-
3,
|
|
504
|
-
4
|
|
505
|
-
];
|
|
506
|
-
case 3:
|
|
507
|
-
error = _state.sent();
|
|
508
|
-
console.error("getAddressByGeo error:", error);
|
|
509
|
-
return [
|
|
510
|
-
3,
|
|
511
|
-
4
|
|
512
|
-
];
|
|
513
|
-
case 4:
|
|
514
|
-
return [
|
|
515
|
-
2
|
|
516
|
-
];
|
|
517
|
-
}
|
|
518
|
-
});
|
|
519
|
-
});
|
|
520
|
-
return function getAddressByGeo(_, currentLanguage) {
|
|
521
|
-
return _ref.apply(this, arguments);
|
|
522
|
-
};
|
|
523
|
-
}();
|
|
524
399
|
// src/helpers/firebase.ts
|
|
525
400
|
var initApp = function() {
|
|
526
401
|
var isNodeEnv2 = typeof process !== "undefined" && process.env;
|
|
@@ -940,7 +815,7 @@ var delete_document = /*#__PURE__*/ function() {
|
|
|
940
815
|
return _ref.apply(this, arguments);
|
|
941
816
|
};
|
|
942
817
|
}();
|
|
943
|
-
var
|
|
818
|
+
var query_document = /*#__PURE__*/ function() {
|
|
944
819
|
var _ref = _async_to_generator(function(collection_path, field_name, operator, value) {
|
|
945
820
|
var ignore_log, q, query_snapshot, documents, error;
|
|
946
821
|
var _arguments = arguments;
|
|
@@ -989,7 +864,7 @@ var query_document2 = /*#__PURE__*/ function() {
|
|
|
989
864
|
}
|
|
990
865
|
});
|
|
991
866
|
});
|
|
992
|
-
return function
|
|
867
|
+
return function query_document(collection_path, field_name, operator, value) {
|
|
993
868
|
return _ref.apply(this, arguments);
|
|
994
869
|
};
|
|
995
870
|
}();
|
|
@@ -1364,7 +1239,7 @@ var getUserByPhone = /*#__PURE__*/ function() {
|
|
|
1364
1239
|
];
|
|
1365
1240
|
return [
|
|
1366
1241
|
4,
|
|
1367
|
-
|
|
1242
|
+
query_document("nx-users", "phone_number", "in", phones, true)
|
|
1368
1243
|
];
|
|
1369
1244
|
case 1:
|
|
1370
1245
|
return [
|
|
@@ -1385,7 +1260,7 @@ var getUserByEmail = /*#__PURE__*/ function() {
|
|
|
1385
1260
|
case 0:
|
|
1386
1261
|
return [
|
|
1387
1262
|
4,
|
|
1388
|
-
|
|
1263
|
+
query_document("nx-users", "email", "==", email, true)
|
|
1389
1264
|
];
|
|
1390
1265
|
case 1:
|
|
1391
1266
|
return [
|
|
@@ -1533,6 +1408,149 @@ var validateUserStatusAndPermissions = function(user, app2) {
|
|
|
1533
1408
|
}
|
|
1534
1409
|
return userPermissions;
|
|
1535
1410
|
};
|
|
1411
|
+
// src/helpers/global.ts
|
|
1412
|
+
import { CountryOptions, LanguageOptions } from "akeyless-types-commons";
|
|
1413
|
+
import axios from "axios";
|
|
1414
|
+
import { isEqual } from "lodash";
|
|
1415
|
+
var calculateBearing = function(startLat, startLng, endLat, endLng) {
|
|
1416
|
+
if (startLat === endLat || startLng === endLng) {
|
|
1417
|
+
return 0;
|
|
1418
|
+
}
|
|
1419
|
+
if (startLat === void 0 || startLng === void 0 || endLat === void 0 || endLng === void 0) {
|
|
1420
|
+
return 0;
|
|
1421
|
+
}
|
|
1422
|
+
var startLatRad = startLat * Math.PI / 180;
|
|
1423
|
+
var startLngRad = startLng * Math.PI / 180;
|
|
1424
|
+
var endLatRad = endLat * Math.PI / 180;
|
|
1425
|
+
var endLngRad = endLng * Math.PI / 180;
|
|
1426
|
+
var dLon = endLngRad - startLngRad;
|
|
1427
|
+
var y = Math.sin(dLon) * Math.cos(endLatRad);
|
|
1428
|
+
var x = Math.cos(startLatRad) * Math.sin(endLatRad) - Math.sin(startLatRad) * Math.cos(endLatRad) * Math.cos(dLon);
|
|
1429
|
+
var bearing = Math.atan2(y, x) * 180 / Math.PI;
|
|
1430
|
+
return (bearing + 360) % 360;
|
|
1431
|
+
};
|
|
1432
|
+
var renderOnce = function() {
|
|
1433
|
+
return true;
|
|
1434
|
+
};
|
|
1435
|
+
var propsAreEqual = function(prevProps, nextProps) {
|
|
1436
|
+
return isEqual(prevProps, nextProps);
|
|
1437
|
+
};
|
|
1438
|
+
var getUserCountryByIp = /*#__PURE__*/ function() {
|
|
1439
|
+
var _ref = _async_to_generator(function() {
|
|
1440
|
+
var response, error;
|
|
1441
|
+
return _ts_generator(this, function(_state) {
|
|
1442
|
+
switch(_state.label){
|
|
1443
|
+
case 0:
|
|
1444
|
+
_state.trys.push([
|
|
1445
|
+
0,
|
|
1446
|
+
2,
|
|
1447
|
+
,
|
|
1448
|
+
3
|
|
1449
|
+
]);
|
|
1450
|
+
return [
|
|
1451
|
+
4,
|
|
1452
|
+
axios.get("https://ipapi.co/json/")
|
|
1453
|
+
];
|
|
1454
|
+
case 1:
|
|
1455
|
+
response = _state.sent();
|
|
1456
|
+
return [
|
|
1457
|
+
2,
|
|
1458
|
+
(response.data.country_code || CountryOptions.IL).toLowerCase()
|
|
1459
|
+
];
|
|
1460
|
+
case 2:
|
|
1461
|
+
error = _state.sent();
|
|
1462
|
+
console.error("Error fetching Country:", error);
|
|
1463
|
+
return [
|
|
1464
|
+
2,
|
|
1465
|
+
CountryOptions.IL
|
|
1466
|
+
];
|
|
1467
|
+
case 3:
|
|
1468
|
+
return [
|
|
1469
|
+
2
|
|
1470
|
+
];
|
|
1471
|
+
}
|
|
1472
|
+
});
|
|
1473
|
+
});
|
|
1474
|
+
return function getUserCountryByIp() {
|
|
1475
|
+
return _ref.apply(this, arguments);
|
|
1476
|
+
};
|
|
1477
|
+
}();
|
|
1478
|
+
var userNameFormat = function(user) {
|
|
1479
|
+
return "".concat((user === null || user === void 0 ? void 0 : user.first_name) || "", " ").concat((user === null || user === void 0 ? void 0 : user.last_name) || "").trim();
|
|
1480
|
+
};
|
|
1481
|
+
var multiStringFormat = function(str1, str2, str3) {
|
|
1482
|
+
return "".concat(str1, " ").concat(str2 || "", " ").concat(str3 || "").trim();
|
|
1483
|
+
};
|
|
1484
|
+
var getLocationUrl = function(lng, lat) {
|
|
1485
|
+
return "https://www.google.com/maps?q=".concat(lat, ",").concat(lng);
|
|
1486
|
+
};
|
|
1487
|
+
var isNodeEnv = typeof process !== "undefined" && process.env;
|
|
1488
|
+
var _ref = {
|
|
1489
|
+
mode: isNodeEnv ? process.env.NEXT_PUBLIC_MODE : import.meta.env.VITE_MODE,
|
|
1490
|
+
isLocal: (isNodeEnv ? process.env.NEXT_PUBLIC_IS_LOCAL : import.meta.env.VITE_is_local) === "true"
|
|
1491
|
+
}, mode = _ref.mode, isLocal = _ref.isLocal;
|
|
1492
|
+
var getFixedNumber = function() {
|
|
1493
|
+
var number = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0, fix = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 4;
|
|
1494
|
+
var sum_value = number % 1 === 0 ? number : number.toFixed(fix).replace(/\.?0+$/, "");
|
|
1495
|
+
return String(sum_value);
|
|
1496
|
+
};
|
|
1497
|
+
var getAddressByGeo = /*#__PURE__*/ function() {
|
|
1498
|
+
var _ref = _async_to_generator(function(param, currentLanguage) {
|
|
1499
|
+
var lat, lng, language, apiKey, url, _response_data, response, error;
|
|
1500
|
+
return _ts_generator(this, function(_state) {
|
|
1501
|
+
switch(_state.label){
|
|
1502
|
+
case 0:
|
|
1503
|
+
lat = param.lat, lng = param.lng;
|
|
1504
|
+
language = currentLanguage === LanguageOptions.He ? "iw" : "en";
|
|
1505
|
+
apiKey = isNodeEnv ? process.env.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY : import.meta.env.VITE_api_google_key;
|
|
1506
|
+
url = "https://maps.googleapis.com/maps/api/geocode/json?latlng=".concat(lat, ",").concat(lng, "&key=").concat(apiKey, "&language=").concat(language);
|
|
1507
|
+
_state.label = 1;
|
|
1508
|
+
case 1:
|
|
1509
|
+
_state.trys.push([
|
|
1510
|
+
1,
|
|
1511
|
+
3,
|
|
1512
|
+
,
|
|
1513
|
+
4
|
|
1514
|
+
]);
|
|
1515
|
+
return [
|
|
1516
|
+
4,
|
|
1517
|
+
axios.get(url)
|
|
1518
|
+
];
|
|
1519
|
+
case 2:
|
|
1520
|
+
response = _state.sent();
|
|
1521
|
+
if (response === null || response === void 0 ? void 0 : (_response_data = response.data) === null || _response_data === void 0 ? void 0 : _response_data.results[0]) {
|
|
1522
|
+
return [
|
|
1523
|
+
2,
|
|
1524
|
+
response.data.results[0].formatted_address.slice(0, 35)
|
|
1525
|
+
];
|
|
1526
|
+
} else {
|
|
1527
|
+
return [
|
|
1528
|
+
2,
|
|
1529
|
+
"address not found"
|
|
1530
|
+
];
|
|
1531
|
+
}
|
|
1532
|
+
return [
|
|
1533
|
+
3,
|
|
1534
|
+
4
|
|
1535
|
+
];
|
|
1536
|
+
case 3:
|
|
1537
|
+
error = _state.sent();
|
|
1538
|
+
console.error("getAddressByGeo error:", error);
|
|
1539
|
+
return [
|
|
1540
|
+
3,
|
|
1541
|
+
4
|
|
1542
|
+
];
|
|
1543
|
+
case 4:
|
|
1544
|
+
return [
|
|
1545
|
+
2
|
|
1546
|
+
];
|
|
1547
|
+
}
|
|
1548
|
+
});
|
|
1549
|
+
});
|
|
1550
|
+
return function getAddressByGeo(_, currentLanguage) {
|
|
1551
|
+
return _ref.apply(this, arguments);
|
|
1552
|
+
};
|
|
1553
|
+
}();
|
|
1536
1554
|
// src/helpers/forms.ts
|
|
1537
1555
|
import XRegExp from "xregexp";
|
|
1538
1556
|
var textRegex = XRegExp("[^\\p{L}\\s-]", "gu");
|
|
@@ -1800,5 +1818,5 @@ var nx_api_call = /*#__PURE__*/ function() {
|
|
|
1800
1818
|
return _ref.apply(this, arguments);
|
|
1801
1819
|
};
|
|
1802
1820
|
}();
|
|
1803
|
-
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, getAddressByGeo, getFixedNumber, getFormCheckboxValue, getFormElementValue, getLocationUrl, getUserByEmail, getUserByIdentifier, getUserByPhone, getUserCountryByIp, get_all_documents, get_document_by_id, get_international_phone_number, 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,
|
|
1821
|
+
export { addAuditRecord, addLoginAudit, add_document, addressRegex, akeylessOnlineDomain, app, appCheck, auth, baseDomain, biDomain, calculateBearing, callCenterDomain, carsRegex, chartsRegex, checkUserPermissions, cleanNxSites, cn, collections, colorRegex, createSelectors, db, delete_document, devicesDomain, displayFormatPhoneNumber, emailRegex, extractAlertsData, extractBoardsData, extractCanbusData, extractCarsData, extractClientData, extractLocationData, extractSiteData, fire_base_TIME_TEMP, formatCarNumber, getAddressByGeo, getFixedNumber, getFormCheckboxValue, getFormElementValue, getLocationUrl, getUserByEmail, getUserByIdentifier, getUserByPhone, getUserCountryByIp, get_all_documents, get_document_by_id, get_international_phone_number, 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, setFormElementValue, setState, set_document, simpleExtractData, snapshot, snapshotDocument, sort_by_timestamp, storage, textNumbersRegex, textRegex, timestamp_to_millis, timestamp_to_string, useLoginWithGoogle, useStoreValues, useValidation, userNameFormat, validateUserStatusAndPermissions };
|
|
1804
1822
|
//# sourceMappingURL=index.mjs.map
|
package/dist/hooks/index.js
CHANGED
|
@@ -273,67 +273,17 @@ 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/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");
|
|
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
276
|
// src/helpers/firebase.ts
|
|
327
|
-
var
|
|
277
|
+
var import_meta = {};
|
|
328
278
|
var initApp = function() {
|
|
329
279
|
var isNodeEnv2 = typeof process !== "undefined" && process.env;
|
|
330
280
|
var firebaseConfig = {
|
|
331
|
-
apiKey: isNodeEnv2 ? process.env.NEXT_PUBLIC_API_KEY :
|
|
332
|
-
authDomain: isNodeEnv2 ? process.env.NEXT_PUBLIC_AUTH_DOMAIN :
|
|
333
|
-
projectId: isNodeEnv2 ? process.env.NEXT_PUBLIC_PROJECT_ID :
|
|
334
|
-
storageBucket: isNodeEnv2 ? process.env.NEXT_PUBLIC_STORAGE_BUCKET :
|
|
335
|
-
messagingSenderId: isNodeEnv2 ? process.env.NEXT_PUBLIC_MESSAGING_SENDER_ID :
|
|
336
|
-
appId: isNodeEnv2 ? process.env.NEXT_PUBLIC_APP_ID :
|
|
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
|
|
337
287
|
};
|
|
338
288
|
try {
|
|
339
289
|
var app2 = (0, import_app.initializeApp)(firebaseConfig);
|
|
@@ -342,7 +292,7 @@ var initApp = function() {
|
|
|
342
292
|
var db2 = (0, import_firestore.getFirestore)(app2);
|
|
343
293
|
var storage2 = (0, import_storage.getStorage)(app2);
|
|
344
294
|
var googleLoginProvider2 = new import_auth.GoogleAuthProvider();
|
|
345
|
-
var recaptchaSiteKey = isNodeEnv2 ? process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY :
|
|
295
|
+
var recaptchaSiteKey = isNodeEnv2 ? process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY : import_meta.env.VITE_RECAPTCHA_SITE_KEY;
|
|
346
296
|
var result = {
|
|
347
297
|
db: db2,
|
|
348
298
|
auth: auth2,
|
|
@@ -466,6 +416,56 @@ var snapshot = function(config, snapshotsFirstTime) {
|
|
|
466
416
|
unsubscribe: unsubscribe
|
|
467
417
|
};
|
|
468
418
|
};
|
|
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");
|
package/dist/hooks/index.mjs
CHANGED
|
@@ -187,55 +187,6 @@ 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, LanguageOptions } 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;
|
|
239
190
|
// src/helpers/firebase.ts
|
|
240
191
|
var initApp = function() {
|
|
241
192
|
var isNodeEnv2 = typeof process !== "undefined" && process.env;
|
|
@@ -378,6 +329,55 @@ var snapshot = function(config, snapshotsFirstTime) {
|
|
|
378
329
|
unsubscribe: unsubscribe
|
|
379
330
|
};
|
|
380
331
|
};
|
|
332
|
+
// src/helpers/global.ts
|
|
333
|
+
import { CountryOptions, LanguageOptions } 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");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "akeyless-client-commons",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.182",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "tsup",
|
|
6
6
|
"deploy": "npm run build && npm version patch --no-git-tag-version && npm publish",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"@radix-ui/react-progress": "^1.1.1",
|
|
17
17
|
"@radix-ui/react-slot": "^1.1.2",
|
|
18
18
|
"@types/lodash": "^4.17.13",
|
|
19
|
-
"akeyless-types-commons": "^1.0.
|
|
19
|
+
"akeyless-types-commons": "^1.0.18",
|
|
20
20
|
"assets": "^3.0.1",
|
|
21
21
|
"axios": "^1.7.9",
|
|
22
22
|
"class-variance-authority": "^0.7.0",
|