akeyless-client-commons 1.1.107 → 1.1.109
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/helpers/index.js +13 -7
- package/dist/helpers/index.mjs +13 -7
- package/dist/hooks/index.js +38 -35
- package/dist/hooks/index.mjs +38 -35
- package/package.json +1 -1
package/dist/helpers/index.js
CHANGED
|
@@ -2266,34 +2266,40 @@ var propsAreEqual = function(prevProps, nextProps) {
|
|
|
2266
2266
|
};
|
|
2267
2267
|
var getUserCountryByIp = /*#__PURE__*/ function() {
|
|
2268
2268
|
var _ref = _async_to_generator(function() {
|
|
2269
|
-
var response, error;
|
|
2269
|
+
var response, data, error;
|
|
2270
2270
|
return _ts_generator(this, function(_state) {
|
|
2271
2271
|
switch(_state.label){
|
|
2272
2272
|
case 0:
|
|
2273
2273
|
_state.trys.push([
|
|
2274
2274
|
0,
|
|
2275
|
-
|
|
2275
|
+
3,
|
|
2276
2276
|
,
|
|
2277
|
-
|
|
2277
|
+
4
|
|
2278
2278
|
]);
|
|
2279
2279
|
return [
|
|
2280
2280
|
4,
|
|
2281
|
-
|
|
2281
|
+
fetch("https://ipapi.co/json/")
|
|
2282
2282
|
];
|
|
2283
2283
|
case 1:
|
|
2284
2284
|
response = _state.sent();
|
|
2285
2285
|
return [
|
|
2286
|
-
|
|
2287
|
-
|
|
2286
|
+
4,
|
|
2287
|
+
response.json()
|
|
2288
2288
|
];
|
|
2289
2289
|
case 2:
|
|
2290
|
+
data = _state.sent();
|
|
2291
|
+
return [
|
|
2292
|
+
2,
|
|
2293
|
+
(data.country_code || import_akeyless_types_commons.CountryOptions.IL).toLowerCase()
|
|
2294
|
+
];
|
|
2295
|
+
case 3:
|
|
2290
2296
|
error = _state.sent();
|
|
2291
2297
|
console.error("Error fetching Country:", error);
|
|
2292
2298
|
return [
|
|
2293
2299
|
2,
|
|
2294
2300
|
import_akeyless_types_commons.CountryOptions.IL
|
|
2295
2301
|
];
|
|
2296
|
-
case
|
|
2302
|
+
case 4:
|
|
2297
2303
|
return [
|
|
2298
2304
|
2
|
|
2299
2305
|
];
|
package/dist/helpers/index.mjs
CHANGED
|
@@ -1875,34 +1875,40 @@ var propsAreEqual = function(prevProps, nextProps) {
|
|
|
1875
1875
|
};
|
|
1876
1876
|
var getUserCountryByIp = /*#__PURE__*/ function() {
|
|
1877
1877
|
var _ref = _async_to_generator(function() {
|
|
1878
|
-
var response, error;
|
|
1878
|
+
var response, data, error;
|
|
1879
1879
|
return _ts_generator(this, function(_state) {
|
|
1880
1880
|
switch(_state.label){
|
|
1881
1881
|
case 0:
|
|
1882
1882
|
_state.trys.push([
|
|
1883
1883
|
0,
|
|
1884
|
-
|
|
1884
|
+
3,
|
|
1885
1885
|
,
|
|
1886
|
-
|
|
1886
|
+
4
|
|
1887
1887
|
]);
|
|
1888
1888
|
return [
|
|
1889
1889
|
4,
|
|
1890
|
-
|
|
1890
|
+
fetch("https://ipapi.co/json/")
|
|
1891
1891
|
];
|
|
1892
1892
|
case 1:
|
|
1893
1893
|
response = _state.sent();
|
|
1894
1894
|
return [
|
|
1895
|
-
|
|
1896
|
-
|
|
1895
|
+
4,
|
|
1896
|
+
response.json()
|
|
1897
1897
|
];
|
|
1898
1898
|
case 2:
|
|
1899
|
+
data = _state.sent();
|
|
1900
|
+
return [
|
|
1901
|
+
2,
|
|
1902
|
+
(data.country_code || CountryOptions.IL).toLowerCase()
|
|
1903
|
+
];
|
|
1904
|
+
case 3:
|
|
1899
1905
|
error = _state.sent();
|
|
1900
1906
|
console.error("Error fetching Country:", error);
|
|
1901
1907
|
return [
|
|
1902
1908
|
2,
|
|
1903
1909
|
CountryOptions.IL
|
|
1904
1910
|
];
|
|
1905
|
-
case
|
|
1911
|
+
case 4:
|
|
1906
1912
|
return [
|
|
1907
1913
|
2
|
|
1908
1914
|
];
|
package/dist/hooks/index.js
CHANGED
|
@@ -718,34 +718,40 @@ var import_lodash = require("lodash");
|
|
|
718
718
|
var import_meta2 = {};
|
|
719
719
|
var getUserCountryByIp = /*#__PURE__*/ function() {
|
|
720
720
|
var _ref = _async_to_generator(function() {
|
|
721
|
-
var response, error;
|
|
721
|
+
var response, data, error;
|
|
722
722
|
return _ts_generator(this, function(_state) {
|
|
723
723
|
switch(_state.label){
|
|
724
724
|
case 0:
|
|
725
725
|
_state.trys.push([
|
|
726
726
|
0,
|
|
727
|
-
|
|
727
|
+
3,
|
|
728
728
|
,
|
|
729
|
-
|
|
729
|
+
4
|
|
730
730
|
]);
|
|
731
731
|
return [
|
|
732
732
|
4,
|
|
733
|
-
|
|
733
|
+
fetch("https://ipapi.co/json/")
|
|
734
734
|
];
|
|
735
735
|
case 1:
|
|
736
736
|
response = _state.sent();
|
|
737
737
|
return [
|
|
738
|
-
|
|
739
|
-
|
|
738
|
+
4,
|
|
739
|
+
response.json()
|
|
740
740
|
];
|
|
741
741
|
case 2:
|
|
742
|
+
data = _state.sent();
|
|
743
|
+
return [
|
|
744
|
+
2,
|
|
745
|
+
(data.country_code || import_akeyless_types_commons.CountryOptions.IL).toLowerCase()
|
|
746
|
+
];
|
|
747
|
+
case 3:
|
|
742
748
|
error = _state.sent();
|
|
743
749
|
console.error("Error fetching Country:", error);
|
|
744
750
|
return [
|
|
745
751
|
2,
|
|
746
752
|
import_akeyless_types_commons.CountryOptions.IL
|
|
747
753
|
];
|
|
748
|
-
case
|
|
754
|
+
case 4:
|
|
749
755
|
return [
|
|
750
756
|
2
|
|
751
757
|
];
|
|
@@ -1124,35 +1130,32 @@ var useDocumentTitle = function(title) {
|
|
|
1124
1130
|
};
|
|
1125
1131
|
var useSetUserCountry = function(setUserCountry, changLang) {
|
|
1126
1132
|
(0, import_react2.useLayoutEffect)(function() {
|
|
1127
|
-
var
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
];
|
|
1147
|
-
}
|
|
1148
|
-
});
|
|
1133
|
+
var updateCountry = /*#__PURE__*/ function() {
|
|
1134
|
+
var _ref = _async_to_generator(function() {
|
|
1135
|
+
var country;
|
|
1136
|
+
return _ts_generator(this, function(_state) {
|
|
1137
|
+
switch(_state.label){
|
|
1138
|
+
case 0:
|
|
1139
|
+
return [
|
|
1140
|
+
4,
|
|
1141
|
+
getUserCountryByIp()
|
|
1142
|
+
];
|
|
1143
|
+
case 1:
|
|
1144
|
+
country = _state.sent();
|
|
1145
|
+
changLang(country === import_akeyless_types_commons2.CountryOptions.IL ? "he" : "en");
|
|
1146
|
+
setUserCountry(country);
|
|
1147
|
+
localStorage.setItem("userCountry", country);
|
|
1148
|
+
return [
|
|
1149
|
+
2
|
|
1150
|
+
];
|
|
1151
|
+
}
|
|
1149
1152
|
});
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
}
|
|
1154
|
-
|
|
1155
|
-
|
|
1153
|
+
});
|
|
1154
|
+
return function updateCountry() {
|
|
1155
|
+
return _ref.apply(this, arguments);
|
|
1156
|
+
};
|
|
1157
|
+
}();
|
|
1158
|
+
updateCountry();
|
|
1156
1159
|
}, []);
|
|
1157
1160
|
return null;
|
|
1158
1161
|
};
|
package/dist/hooks/index.mjs
CHANGED
|
@@ -622,34 +622,40 @@ import axios from "axios";
|
|
|
622
622
|
import { isEqual } from "lodash";
|
|
623
623
|
var getUserCountryByIp = /*#__PURE__*/ function() {
|
|
624
624
|
var _ref = _async_to_generator(function() {
|
|
625
|
-
var response, error;
|
|
625
|
+
var response, data, error;
|
|
626
626
|
return _ts_generator(this, function(_state) {
|
|
627
627
|
switch(_state.label){
|
|
628
628
|
case 0:
|
|
629
629
|
_state.trys.push([
|
|
630
630
|
0,
|
|
631
|
-
|
|
631
|
+
3,
|
|
632
632
|
,
|
|
633
|
-
|
|
633
|
+
4
|
|
634
634
|
]);
|
|
635
635
|
return [
|
|
636
636
|
4,
|
|
637
|
-
|
|
637
|
+
fetch("https://ipapi.co/json/")
|
|
638
638
|
];
|
|
639
639
|
case 1:
|
|
640
640
|
response = _state.sent();
|
|
641
641
|
return [
|
|
642
|
-
|
|
643
|
-
|
|
642
|
+
4,
|
|
643
|
+
response.json()
|
|
644
644
|
];
|
|
645
645
|
case 2:
|
|
646
|
+
data = _state.sent();
|
|
647
|
+
return [
|
|
648
|
+
2,
|
|
649
|
+
(data.country_code || CountryOptions.IL).toLowerCase()
|
|
650
|
+
];
|
|
651
|
+
case 3:
|
|
646
652
|
error = _state.sent();
|
|
647
653
|
console.error("Error fetching Country:", error);
|
|
648
654
|
return [
|
|
649
655
|
2,
|
|
650
656
|
CountryOptions.IL
|
|
651
657
|
];
|
|
652
|
-
case
|
|
658
|
+
case 4:
|
|
653
659
|
return [
|
|
654
660
|
2
|
|
655
661
|
];
|
|
@@ -1028,35 +1034,32 @@ var useDocumentTitle = function(title) {
|
|
|
1028
1034
|
};
|
|
1029
1035
|
var useSetUserCountry = function(setUserCountry, changLang) {
|
|
1030
1036
|
useLayoutEffect(function() {
|
|
1031
|
-
var
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
];
|
|
1051
|
-
}
|
|
1052
|
-
});
|
|
1037
|
+
var updateCountry = /*#__PURE__*/ function() {
|
|
1038
|
+
var _ref = _async_to_generator(function() {
|
|
1039
|
+
var country;
|
|
1040
|
+
return _ts_generator(this, function(_state) {
|
|
1041
|
+
switch(_state.label){
|
|
1042
|
+
case 0:
|
|
1043
|
+
return [
|
|
1044
|
+
4,
|
|
1045
|
+
getUserCountryByIp()
|
|
1046
|
+
];
|
|
1047
|
+
case 1:
|
|
1048
|
+
country = _state.sent();
|
|
1049
|
+
changLang(country === CountryOptions2.IL ? "he" : "en");
|
|
1050
|
+
setUserCountry(country);
|
|
1051
|
+
localStorage.setItem("userCountry", country);
|
|
1052
|
+
return [
|
|
1053
|
+
2
|
|
1054
|
+
];
|
|
1055
|
+
}
|
|
1053
1056
|
});
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
|
|
1057
|
+
});
|
|
1058
|
+
return function updateCountry() {
|
|
1059
|
+
return _ref.apply(this, arguments);
|
|
1060
|
+
};
|
|
1061
|
+
}();
|
|
1062
|
+
updateCountry();
|
|
1060
1063
|
}, []);
|
|
1061
1064
|
return null;
|
|
1062
1065
|
};
|