@karta.io/utils 1.0.0-beta.4 → 1.0.0-beta.41

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/index.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  import camelCase from 'lodash/camelCase.js';
2
+ import flatMap from 'lodash/flatMap.js';
2
3
  import { CURRENCY_DEFAULT, BREAKPOINTS } from '@karta.io/common-data';
3
4
  import { parsePhoneNumberFromString } from 'libphonenumber-js';
4
5
  import snakeCase from 'lodash/snakeCase.js';
@@ -24,14 +25,16 @@ function AppComponentsResolver(options = {}) {
24
25
  return (name) => {
25
26
  const componentName = prefix && name.startsWith(prefix) ? name.substring(prefix.length) : name;
26
27
  const isAppComponent = componentName.startsWith("App");
27
- if (isAppComponent)
28
+ if (isAppComponent) {
28
29
  return { name: componentName, from: "@karta.io/app-components" };
30
+ }
29
31
  };
30
32
  }
31
33
 
32
34
  function camelizeKeys(object) {
33
- if (Array.isArray(object))
35
+ if (Array.isArray(object)) {
34
36
  return object.map((v) => camelizeKeys(v));
37
+ }
35
38
  if (object !== null && object.constructor === Object) {
36
39
  return Object.keys(object).reduce(
37
40
  (result, key) => ({
@@ -58,6 +61,109 @@ function convertEnumToOptions(obj, options) {
58
61
  }));
59
62
  }
60
63
 
64
+ class EnrichError extends Error {
65
+ constructor(data) {
66
+ super(data.message);
67
+ Object.assign(this, data);
68
+ }
69
+ }
70
+
71
+ function isHtml(data) {
72
+ try {
73
+ if (typeof DOMParser !== "undefined") {
74
+ const parser = new DOMParser();
75
+ const doc = parser.parseFromString(data, "text/html");
76
+ return Array.from(doc.body.childNodes).some(
77
+ (node) => node.nodeType === Node.ELEMENT_NODE
78
+ );
79
+ }
80
+ const htmlPattern = /<\/?[a-z][\s\S]*>/i;
81
+ return htmlPattern.test(data);
82
+ } catch (_) {
83
+ return false;
84
+ }
85
+ }
86
+
87
+ function getStatusMessage(status) {
88
+ let message = "";
89
+ switch (status) {
90
+ case 200:
91
+ message = "All done. Request successfully executed";
92
+ break;
93
+ case 201:
94
+ message = "Data successfully created";
95
+ break;
96
+ case 400:
97
+ message = "Bad request";
98
+ break;
99
+ case 401:
100
+ message = "Need auth";
101
+ break;
102
+ case 404:
103
+ message = "Not found";
104
+ break;
105
+ case 500:
106
+ message = "Something wrong. Internal server error";
107
+ break;
108
+ case 501:
109
+ message = "501: Not implemented";
110
+ break;
111
+ case 502:
112
+ message = "502: Bad gateway";
113
+ break;
114
+ case 503:
115
+ message = "Service unavailable. Try again later";
116
+ break;
117
+ default:
118
+ message = "Something wrong. Client default error message";
119
+ break;
120
+ }
121
+ return message;
122
+ }
123
+ function formatErrorDataMessage(data) {
124
+ if (!data)
125
+ return "";
126
+ return Object.values(data).reduce((accum, current) => {
127
+ if (current && typeof current === "string")
128
+ return accum ? `${accum} | ${current}` : current;
129
+ if (Array.isArray(current) && current.length) {
130
+ const value = `${flatMap(current).join(" | ")}`;
131
+ return accum ? `${accum} | ${value}` : value;
132
+ }
133
+ return accum;
134
+ }, "");
135
+ }
136
+ function formatErrorForNotify(error) {
137
+ if (!error)
138
+ return;
139
+ if (error.status >= 400 && error.status < 500) {
140
+ let message = "";
141
+ if (!error.data || typeof error.data === "string" && isHtml(error.data)) {
142
+ message = error.statusMessage || error.message || getStatusMessage(error.status);
143
+ } else if (typeof error.data === "string" && !isHtml(error.data)) {
144
+ message = error.data;
145
+ } else {
146
+ message = formatErrorDataMessage(error.data);
147
+ }
148
+ return {
149
+ title: "Request error",
150
+ message
151
+ };
152
+ }
153
+ if (error.status >= 500) {
154
+ return {
155
+ title: "Internal server error",
156
+ message: error.statusMessage || error.message || getStatusMessage(error.status)
157
+ };
158
+ }
159
+ if (error instanceof Error) {
160
+ return {
161
+ title: "Internal client error",
162
+ message: error.message
163
+ };
164
+ }
165
+ }
166
+
61
167
  function formatMoney(value, currency = CURRENCY_DEFAULT, options = {}) {
62
168
  const { locale = "en-US", defaultValue = 0, ...otherOptions } = options;
63
169
  try {
@@ -75,7 +181,7 @@ function formatMoney(value, currency = CURRENCY_DEFAULT, options = {}) {
75
181
  ...otherOptions
76
182
  });
77
183
  return formatter.format(convertedValue);
78
- } catch (error) {
184
+ } catch (_error) {
79
185
  return defaultValue;
80
186
  }
81
187
  }
@@ -105,7 +211,7 @@ function genUUID() {
105
211
  r = (d2 + r) % 16 | 0;
106
212
  d2 = Math.floor(d2 / 16);
107
213
  }
108
- return (c == "x" ? r : r & 7 | 8).toString(16);
214
+ return (c === "x" ? r : r & 7 | 8).toString(16);
109
215
  });
110
216
  }
111
217
 
@@ -185,7 +291,9 @@ function getPaginationParams({
185
291
  offset: validatedPage * validatedLimit - validatedLimit
186
292
  };
187
293
  }
188
- function getPaginationLimit({ limit }) {
294
+ function getPaginationLimit({
295
+ limit
296
+ }) {
189
297
  return validateNumber(limit, LIMIT_DEFAULT);
190
298
  }
191
299
  function getPaginationOffset({
@@ -207,15 +315,17 @@ function parsePhone(phone) {
207
315
  if (!phone || typeof phone !== "string")
208
316
  return "";
209
317
  const replacedPhone = phone.replace(/[a-zA-Z]/g, "");
210
- if (replacedPhone.length === 1 && replacedPhone !== "+")
318
+ if (replacedPhone.length === 1 && replacedPhone !== "+") {
211
319
  return `+${replacedPhone}`;
320
+ }
212
321
  const phoneNumber = parsePhoneNumberFromString(replacedPhone);
213
322
  return phoneNumber ? phoneNumber.formatInternational() : replacedPhone;
214
323
  }
215
324
 
216
325
  function snakelizeKeys(prop) {
217
- if (Array.isArray(prop))
326
+ if (Array.isArray(prop)) {
218
327
  return prop.map((item) => snakelizeKeys(item));
328
+ }
219
329
  if (prop !== null && prop !== void 0 && prop.constructor === Object) {
220
330
  return Object.keys(prop).reduce(
221
331
  (accum, current) => ({
@@ -255,8 +365,9 @@ function unformatNumber(value) {
255
365
  if (commasCount === 1 && !hasSpace && !hasDot) {
256
366
  locale = string.length - 1 - commaIndex === 3 ? LOCALE_EN : LOCALE_RU;
257
367
  }
258
- if (locale === LOCALE_RU)
368
+ if (locale === LOCALE_RU) {
259
369
  return Number(string.replaceAll(" ", "").replace(",", "."));
370
+ }
260
371
  if (locale === LOCALE_EN)
261
372
  return Number(string.replaceAll(",", ""));
262
373
  return value;
@@ -267,8 +378,9 @@ function UiComponentsResolver(options = {}) {
267
378
  return (name) => {
268
379
  const componentName = prefix && name.startsWith(prefix) ? name.substring(prefix.length) : name;
269
380
  const isUiComponent = componentName.startsWith("Ui");
270
- if (isUiComponent)
381
+ if (isUiComponent) {
271
382
  return { name: componentName, from: "@karta.io/ui-components" };
383
+ }
272
384
  };
273
385
  }
274
386
 
@@ -316,7 +428,9 @@ function useAsyncItems({
316
428
  queryKey: getQueryKey(),
317
429
  queryFn: () => call(toValue(params), config)
318
430
  });
319
- const items = computed(() => data.value?.results || []);
431
+ const items = computed(
432
+ () => data.value?.results || []
433
+ );
320
434
  const count = ref(0);
321
435
  watch(
322
436
  data,
@@ -393,7 +507,12 @@ function useAsyncMultiselect({
393
507
  color: "#b54708",
394
508
  debug: true
395
509
  });
396
- const paramsForLogger = { queryKey, dataItemsKey, dataItemIdKey, dataCountKey };
510
+ const paramsForLogger = {
511
+ queryKey,
512
+ dataItemsKey,
513
+ dataItemIdKey,
514
+ dataCountKey
515
+ };
397
516
  const reactiveData = reactive({
398
517
  search: "",
399
518
  page: 1,
@@ -439,8 +558,9 @@ function useAsyncMultiselect({
439
558
  );
440
559
  return;
441
560
  }
442
- if (!get(newValue, dataItemsKey) || get(newValue, dataCountKey) === void 0)
561
+ if (!get(newValue, dataItemsKey) || get(newValue, dataCountKey) === void 0) {
443
562
  return;
563
+ }
444
564
  count.value = get(newValue, dataCountKey, 0);
445
565
  const newItems = get(newValue, dataItemsKey);
446
566
  itemsByPages.value = {
@@ -471,8 +591,9 @@ function useAsyncMultiselect({
471
591
  const items = computed(() => {
472
592
  if (!itemsByPages.value)
473
593
  return selectedItemsCached.value;
474
- if (!Object.keys(itemsByPages.value).length)
594
+ if (!Object.keys(itemsByPages.value).length) {
475
595
  return selectedItemsCached.value;
596
+ }
476
597
  const itemsByPagesAsArray = Object.values(itemsByPages.value).reduce(
477
598
  (acc, item) => [...acc, ...item],
478
599
  []
@@ -488,7 +609,7 @@ function useAsyncMultiselect({
488
609
  if (!items.value.length)
489
610
  return [];
490
611
  if (!mapOptionCallback)
491
- return this.items.value;
612
+ return items.value;
492
613
  return items.value.map(mapOptionCallback);
493
614
  });
494
615
  const hasNextPage = computed(() => count.value > items.value.length);
@@ -507,6 +628,28 @@ function useAsyncMultiselect({
507
628
  search.value = value;
508
629
  updateSearchWithDebounce(value);
509
630
  };
631
+ const queryClient = useQueryClient();
632
+ const refetch = () => {
633
+ if (reactiveData.page !== 1) {
634
+ queryClient.invalidateQueries({
635
+ queryKey: [queryKey],
636
+ refetchType: "none"
637
+ });
638
+ loadPage(1);
639
+ } else {
640
+ queryClient.invalidateQueries({
641
+ queryKey: [queryKey]
642
+ });
643
+ }
644
+ };
645
+ const reload = () => {
646
+ if (reactiveData.page !== 1) {
647
+ queryClient.removeQueries({ queryKey: [queryKey] });
648
+ loadPage(1);
649
+ } else {
650
+ queryClient.resetQueries({ queryKey: [queryKey] });
651
+ }
652
+ };
510
653
  if (isRef(selectedValues)) {
511
654
  watch(selectedValues, async (newSelectedValues) => {
512
655
  if (!newSelectedValues.length) {
@@ -547,7 +690,9 @@ function useAsyncMultiselect({
547
690
  isFetching,
548
691
  isLoading,
549
692
  loadPage,
550
- updateSearch
693
+ updateSearch,
694
+ refetch,
695
+ reload
551
696
  };
552
697
  }
553
698
 
@@ -579,7 +724,9 @@ function useAsyncSelect({
579
724
  const loadWAC = () => call({
580
725
  page: reactiveData.page,
581
726
  search: reactiveData.search,
582
- ...reactiveData.selectedValue && { includedIds: [reactiveData.selectedValue] },
727
+ ...reactiveData.selectedValue && {
728
+ includedIds: [reactiveData.selectedValue]
729
+ },
583
730
  ...reactiveData.params && { ...JSON.parse(reactiveData.params) }
584
731
  });
585
732
  const { data, isFetching, isLoading } = useQuery({
@@ -607,8 +754,9 @@ function useAsyncSelect({
607
754
  );
608
755
  return;
609
756
  }
610
- if (!get(newValue, dataItemsKey) || get(newValue, dataCountKey) === void 0)
757
+ if (!get(newValue, dataItemsKey) || get(newValue, dataCountKey) === void 0) {
611
758
  return;
759
+ }
612
760
  count.value = get(newValue, dataCountKey, 0);
613
761
  const newItems = get(newValue, dataItemsKey);
614
762
  itemsByPages.value = {
@@ -638,7 +786,7 @@ function useAsyncSelect({
638
786
  if (!items.value.length)
639
787
  return [];
640
788
  if (!mapOptionCallback)
641
- return this.items.value;
789
+ return items.value;
642
790
  return items.value.map(mapOptionCallback);
643
791
  });
644
792
  const hasNextPage = computed(() => count.value > items.value.length);
@@ -653,6 +801,28 @@ function useAsyncSelect({
653
801
  search.value = value;
654
802
  updateSearchWithDebounce(value);
655
803
  };
804
+ const queryClient = useQueryClient();
805
+ const refetch = () => {
806
+ if (reactiveData.page !== 1) {
807
+ queryClient.invalidateQueries({
808
+ queryKey: [queryKey],
809
+ refetchType: "none"
810
+ });
811
+ loadPage(1);
812
+ } else {
813
+ queryClient.invalidateQueries({
814
+ queryKey: [queryKey]
815
+ });
816
+ }
817
+ };
818
+ const reload = () => {
819
+ if (reactiveData.page !== 1) {
820
+ queryClient.removeQueries({ queryKey: [queryKey] });
821
+ loadPage(1);
822
+ } else {
823
+ queryClient.resetQueries({ queryKey: [queryKey] });
824
+ }
825
+ };
656
826
  if (isRef(selectedValue)) {
657
827
  watch(selectedValue, (newSelectedValue) => {
658
828
  reactiveData.page = 1;
@@ -676,20 +846,22 @@ function useAsyncSelect({
676
846
  isFetching,
677
847
  isLoading,
678
848
  loadPage,
679
- updateSearch
849
+ updateSearch,
850
+ refetch,
851
+ reload
680
852
  };
681
853
  }
682
854
 
683
855
  function useBreakpoint() {
684
856
  const breakpoints = useBreakpoints(BREAKPOINTS);
685
857
  const isMobile = breakpoints.smaller("sm");
686
- const isDesktop = breakpoints.greater("md");
687
- const isGreaterXxs = breakpoints.greater("xxs");
688
- const isGreaterXs = breakpoints.greater("xs");
689
- const isGreaterSm = breakpoints.greater("sm");
690
- const isGreaterMd = breakpoints.greater("md");
691
- const isGreaterLg = breakpoints.greater("lg");
692
- const isGreaterXl = breakpoints.greater("xl");
858
+ const isDesktop = breakpoints.greaterOrEqual("md");
859
+ const isGreaterXxs = breakpoints.greaterOrEqual("xxs");
860
+ const isGreaterXs = breakpoints.greaterOrEqual("xs");
861
+ const isGreaterSm = breakpoints.greaterOrEqual("sm");
862
+ const isGreaterMd = breakpoints.greaterOrEqual("md");
863
+ const isGreaterLg = breakpoints.greaterOrEqual("lg");
864
+ const isGreaterXl = breakpoints.greaterOrEqual("xl");
693
865
  return {
694
866
  isMobile,
695
867
  isDesktop,
@@ -756,7 +928,9 @@ function useDayjs(timezone) {
756
928
 
757
929
  function parseVersion(version) {
758
930
  if (typeof version !== "string" && typeof version !== "number") {
759
- throw new TypeError("Browser version must be type of string, number or negative boolean");
931
+ throw new TypeError(
932
+ "Browser version must be type of string, number or negative boolean"
933
+ );
760
934
  }
761
935
  const [major, minor = 0, patch = 0, build = 0] = typeof version === "string" ? version.split(".").map(Number) : [version];
762
936
  return {
@@ -817,9 +991,20 @@ function useGlobalScroll() {
817
991
 
818
992
  const CONFIRM_TEXT = "Are you sure you want to close? \nAll changes will be lost.";
819
993
  let dialogs = [];
820
- function useDialog() {
821
- let appContext;
994
+ const HASH_PREFIX = "#ud_";
995
+ function useDialog(options) {
822
996
  const logger = useLogger("use-dialog");
997
+ let hashPrefix = HASH_PREFIX;
998
+ if (options?.hashPrefix) {
999
+ if (options.hashPrefix.charAt(0) === "#") {
1000
+ hashPrefix = options?.hashPrefix;
1001
+ } else {
1002
+ logger.warn(
1003
+ `*hashPrefix* must start with "#". The default prefix "${HASH_PREFIX}" will be used`
1004
+ );
1005
+ }
1006
+ }
1007
+ let appContext;
823
1008
  const {
824
1009
  isLocked: isGlobalScrollLocked,
825
1010
  lock: lockGlobalScroll,
@@ -827,16 +1012,27 @@ function useDialog() {
827
1012
  } = useGlobalScroll();
828
1013
  const route = useRoute();
829
1014
  const router = useRouter();
830
- const HASH_PREFIX = "#ud_";
1015
+ const genHash = ({
1016
+ layer = 0,
1017
+ componentName,
1018
+ props
1019
+ }) => {
1020
+ const data = {
1021
+ name: componentName,
1022
+ layer,
1023
+ props
1024
+ };
1025
+ return `${hashPrefix}${window.btoa(JSON.stringify(data))}`;
1026
+ };
831
1027
  const parseHash = (hash, componentName) => {
832
1028
  if (!hash)
833
1029
  return void 0;
834
- if (!hash.includes(HASH_PREFIX))
1030
+ if (!hash.includes(hashPrefix))
835
1031
  return void 0;
836
1032
  let dataFromHash;
837
1033
  try {
838
- dataFromHash = JSON.parse(window.atob(hash.slice(HASH_PREFIX.length)));
839
- } catch (error) {
1034
+ dataFromHash = JSON.parse(window.atob(hash.slice(hashPrefix.length)));
1035
+ } catch (_error) {
840
1036
  logger.warn("*parseHash* cant parse hash");
841
1037
  }
842
1038
  if (typeof dataFromHash !== "object")
@@ -883,7 +1079,7 @@ function useDialog() {
883
1079
  vnode2.component.props.modelValue = value;
884
1080
  if (!value && route?.hash) {
885
1081
  const dataFromHash = parseHash(route.hash, component.name);
886
- if (dataFromHash)
1082
+ if (dataFromHash?.layer === layer)
887
1083
  clearHash();
888
1084
  }
889
1085
  if (!value && (dialogs.length === 1 || layer === 0) && isGlobalScrollLocked.value) {
@@ -899,7 +1095,7 @@ function useDialog() {
899
1095
  if (!route?.hash)
900
1096
  return;
901
1097
  const dataFromHash = parseHash(route.hash, component.name);
902
- if (dataFromHash)
1098
+ if (dataFromHash?.layer === layer)
903
1099
  clearHash();
904
1100
  };
905
1101
  vnode2.props.onDestroy = () => {
@@ -973,6 +1169,11 @@ function useDialog() {
973
1169
  const getInstance = (uuid) => {
974
1170
  return dialogs.find((item) => item.uuid === uuid)?.vnode;
975
1171
  };
1172
+ const getLayer = (uuid) => {
1173
+ if (!dialogs.length)
1174
+ return 0;
1175
+ return dialogs.find((dialog) => dialog.uuid === uuid)?.layer || 0;
1176
+ };
976
1177
  const isOnTop = (uuid) => {
977
1178
  if (!dialogs.length)
978
1179
  return false;
@@ -987,15 +1188,10 @@ function useDialog() {
987
1188
  component,
988
1189
  props
989
1190
  }) => {
990
- const data = {
991
- name: component.name,
992
- layer,
993
- props
994
- };
995
1191
  router.push({
996
1192
  name: route.name || void 0,
997
1193
  query: route.query,
998
- hash: `${HASH_PREFIX}${window.btoa(JSON.stringify(data))}`
1194
+ hash: genHash({ layer, props, componentName: component.name })
999
1195
  });
1000
1196
  };
1001
1197
  const watchHash = ({
@@ -1040,10 +1236,14 @@ function useDialog() {
1040
1236
  return {
1041
1237
  open,
1042
1238
  getInstance,
1239
+ getLayer,
1043
1240
  close,
1044
1241
  closeAll,
1045
1242
  showConfirm,
1046
1243
  isOnTop,
1244
+ genHash,
1245
+ parseHash,
1246
+ clearHash,
1047
1247
  openByHash,
1048
1248
  watchHash
1049
1249
  };
@@ -1056,10 +1256,7 @@ const QS_STRINGIFY_PARAMS = {
1056
1256
  addQueryPrefix: true
1057
1257
  };
1058
1258
  const isOpen = ref(false);
1059
- function useFilters({
1060
- config,
1061
- initialFilters
1062
- }) {
1259
+ function useFilters({ config, initialFilters }) {
1063
1260
  const router = useRouter();
1064
1261
  const route = useRoute();
1065
1262
  const parseRouteQuery = (query) => qs.parse(query ?? route.query);
@@ -1067,35 +1264,43 @@ function useFilters({
1067
1264
  const parsedRouteQuery = parseRouteQuery();
1068
1265
  if (!parsedRouteQuery.filters)
1069
1266
  return void 0;
1070
- return Object.entries(config).reduce((accum, [currentKey, currentValue]) => {
1071
- if (!parsedRouteQuery.filters[currentKey])
1072
- return accum;
1073
- if (currentValue.type === "ARRAY" /* Array */) {
1074
- const splitValues = parsedRouteQuery.filters[currentKey].split(",");
1075
- const checkedValue = currentValue?.possibleValues ? splitValues.filter((k) => currentValue?.possibleValues?.includes(k)) : splitValues;
1076
- if (!checkedValue?.length)
1267
+ return Object.entries(config).reduce(
1268
+ (accum, [currentKey, currentValue]) => {
1269
+ if (!parsedRouteQuery.filters[currentKey])
1077
1270
  return accum;
1271
+ if (currentValue.type === "ARRAY" /* Array */) {
1272
+ const splitValues = parsedRouteQuery.filters[currentKey].split(",");
1273
+ const checkedValue = currentValue?.possibleValues ? splitValues.filter(
1274
+ (k) => currentValue?.possibleValues?.includes(k)
1275
+ ) : splitValues;
1276
+ if (!checkedValue?.length)
1277
+ return accum;
1278
+ return {
1279
+ ...accum,
1280
+ [currentKey]: checkedValue
1281
+ };
1282
+ }
1078
1283
  return {
1079
1284
  ...accum,
1080
- [currentKey]: checkedValue
1285
+ [currentKey]: parsedRouteQuery.filters[currentKey]
1081
1286
  };
1082
- }
1083
- return {
1084
- ...accum,
1085
- [currentKey]: parsedRouteQuery.filters[currentKey]
1086
- };
1087
- }, {});
1287
+ },
1288
+ {}
1289
+ );
1088
1290
  });
1089
1291
  const filtersCount = computed(
1090
1292
  () => filtersFromQuery.value ? Object.keys(filtersFromQuery.value).length : 0
1091
1293
  );
1092
1294
  const setQueryFromFilters = (filters) => {
1093
1295
  const parsedRouteQuery = parseRouteQuery();
1094
- const filteredValue = Object.entries(filters).reduce((accum, [currentKey, currentValue]) => {
1095
- if (!currentValue?.length)
1096
- return accum;
1097
- return { ...accum, [currentKey]: currentValue };
1098
- }, {});
1296
+ const filteredValue = Object.entries(filters).reduce(
1297
+ (accum, [currentKey, currentValue]) => {
1298
+ if (!currentValue?.length)
1299
+ return accum;
1300
+ return { ...accum, [currentKey]: currentValue };
1301
+ },
1302
+ {}
1303
+ );
1099
1304
  const query = qs.stringify(
1100
1305
  {
1101
1306
  ...parsedRouteQuery,
@@ -1104,7 +1309,7 @@ function useFilters({
1104
1309
  },
1105
1310
  QS_STRINGIFY_PARAMS
1106
1311
  );
1107
- router.push(query);
1312
+ router.push(query.replaceAll("#", ""));
1108
1313
  };
1109
1314
  const getValidatedParams = (query) => {
1110
1315
  const parsedRouteQuery = parseRouteQuery(query);
@@ -1132,12 +1337,15 @@ function useFilters({
1132
1337
  });
1133
1338
  };
1134
1339
  const updateMany = (filters) => {
1135
- const newFilters = Object.entries(filters).reduce((accum, [currentKey, currentValue]) => {
1136
- return {
1137
- ...accum,
1138
- [currentKey]: currentValue ? String(currentValue) : void 0
1139
- };
1140
- }, {});
1340
+ const newFilters = Object.entries(filters).reduce(
1341
+ (accum, [currentKey, currentValue]) => {
1342
+ return {
1343
+ ...accum,
1344
+ [currentKey]: currentValue ? String(currentValue) : void 0
1345
+ };
1346
+ },
1347
+ {}
1348
+ );
1141
1349
  setQueryFromFilters({
1142
1350
  ...filtersModel.value,
1143
1351
  ...newFilters
@@ -1313,7 +1521,7 @@ function usePanel() {
1313
1521
  let dataFromHash;
1314
1522
  try {
1315
1523
  dataFromHash = JSON.parse(window.atob(newHash.slice(1)));
1316
- } catch (error) {
1524
+ } catch (_error) {
1317
1525
  logger.error("*watchHash* cant parse hash");
1318
1526
  }
1319
1527
  if (typeof dataFromHash !== "object")
@@ -1416,4 +1624,4 @@ function isStrictLength(value = 3, message) {
1416
1624
  };
1417
1625
  }
1418
1626
 
1419
- export { AppComponentsResolver, UiComponentsResolver, camelizeKeys, convertEnumToOptions, formatMoney, genHash, genRandomNumber, genUUID, getCardNumber, getCountryFromPhone, getPaginationLimit, getPaginationOffset, getPaginationPages, getPaginationParams, isElementIgnored, isEmptyObject, isMax, isMin, isRequired, isStrictLength, isTypeEmail, isTypeNumber, isTypeUrl, mapDataObjectForFilters, parsePhone, snakelizeKeys, unformatNumber, useAbortController, useAsyncItems, useAsyncMultiselect, useAsyncSelect, useBreakpoint, useClassName, useDayjs, useDetectBrowser, useDialog, useFilters, useGlobalScroll, useLogger, usePanel, validateNumber, validatePhone };
1627
+ export { AppComponentsResolver, EnrichError, UiComponentsResolver, camelizeKeys, convertEnumToOptions, formatErrorDataMessage, formatErrorForNotify, formatMoney, genHash, genRandomNumber, genUUID, getCardNumber, getCountryFromPhone, getPaginationLimit, getPaginationOffset, getPaginationPages, getPaginationParams, getStatusMessage, isElementIgnored, isEmptyObject, isHtml, isMax, isMin, isRequired, isStrictLength, isTypeEmail, isTypeNumber, isTypeUrl, mapDataObjectForFilters, parsePhone, snakelizeKeys, unformatNumber, useAbortController, useAsyncItems, useAsyncMultiselect, useAsyncSelect, useBreakpoint, useClassName, useDayjs, useDetectBrowser, useDialog, useFilters, useGlobalScroll, useLogger, usePanel, validateNumber, validatePhone };