akeyless-client-commons 1.0.173 → 1.0.175

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.
@@ -216,7 +216,7 @@ declare const isInternationalIsraelPhone: CheckFunction;
216
216
  declare const local_israel_phone_format: ConvertFunction;
217
217
  declare const international_israel_phone_format: ConvertFunction;
218
218
  declare const get_international_phone_number: ConvertFunction;
219
- declare const displayFormatPhoneNumber: ConvertFunction;
219
+ declare const displayFormatPhoneNumber: (phoneNumber: string, separator?: string) => string;
220
220
  declare const is_iccid: (number: string) => boolean;
221
221
 
222
222
  declare function cn(...inputs: ClassValue[]): string;
@@ -216,7 +216,7 @@ declare const isInternationalIsraelPhone: CheckFunction;
216
216
  declare const local_israel_phone_format: ConvertFunction;
217
217
  declare const international_israel_phone_format: ConvertFunction;
218
218
  declare const get_international_phone_number: ConvertFunction;
219
- declare const displayFormatPhoneNumber: ConvertFunction;
219
+ declare const displayFormatPhoneNumber: (phoneNumber: string, separator?: string) => string;
220
220
  declare const is_iccid: (number: string) => boolean;
221
221
 
222
222
  declare function cn(...inputs: ClassValue[]): string;
@@ -596,13 +596,13 @@ var get_international_phone_number = function(phone) {
596
596
  if (!phone) return "+972";
597
597
  return isInternational(phone) ? phone : international_israel_phone_format(phone);
598
598
  };
599
- var displayFormatPhoneNumber = function(phoneNumber) {
599
+ var displayFormatPhoneNumber = function(phoneNumber, separator) {
600
600
  if (isInternational(phoneNumber)) {
601
601
  var phoneNumberObject = (0, import_libphonenumber_js.parsePhoneNumberFromString)(phoneNumber);
602
602
  if (!phoneNumberObject) {
603
603
  return phoneNumber;
604
604
  }
605
- return phoneNumberObject.formatInternational().replace(/\s/g, "");
605
+ return phoneNumberObject.formatInternational().replace(/\s/g, separator !== null && separator !== void 0 ? separator : "");
606
606
  }
607
607
  return phoneNumber.replace(/(\d{3})(\d{3})(\d{4})/, "$1-$2-$3");
608
608
  };
@@ -264,13 +264,13 @@ var get_international_phone_number = function(phone) {
264
264
  if (!phone) return "+972";
265
265
  return isInternational(phone) ? phone : international_israel_phone_format(phone);
266
266
  };
267
- var displayFormatPhoneNumber = function(phoneNumber) {
267
+ var displayFormatPhoneNumber = function(phoneNumber, separator) {
268
268
  if (isInternational(phoneNumber)) {
269
269
  var phoneNumberObject = parsePhoneNumberFromString(phoneNumber);
270
270
  if (!phoneNumberObject) {
271
271
  return phoneNumber;
272
272
  }
273
- return phoneNumberObject.formatInternational().replace(/\s/g, "");
273
+ return phoneNumberObject.formatInternational().replace(/\s/g, separator !== null && separator !== void 0 ? separator : "");
274
274
  }
275
275
  return phoneNumber.replace(/(\d{3})(\d{3})(\d{4})/, "$1-$2-$3");
276
276
  };
@@ -25,7 +25,7 @@ interface OnSnapshotConfig extends OnSnapshotParsers {
25
25
  }
26
26
 
27
27
  declare const useDocumentTitle: (title: string) => any;
28
- declare const useSnapshotBulk: (configs: OnSnapshotConfig[], label?: string) => void;
28
+ declare const useSnapshotBulk: (configs: OnSnapshotConfig[], label?: string, cleanupForConfigChange?: boolean) => void;
29
29
  declare const useSetUserCountry: (setUserCountry: Dispatch<SetStateAction<CountryOptions>>, changLang: (lang: string) => void) => any;
30
30
 
31
31
  declare function useSafeEffect(callback: () => void, dependencies: any[], error_message?: string): void;
@@ -25,7 +25,7 @@ interface OnSnapshotConfig extends OnSnapshotParsers {
25
25
  }
26
26
 
27
27
  declare const useDocumentTitle: (title: string) => any;
28
- declare const useSnapshotBulk: (configs: OnSnapshotConfig[], label?: string) => void;
28
+ declare const useSnapshotBulk: (configs: OnSnapshotConfig[], label?: string, cleanupForConfigChange?: boolean) => void;
29
29
  declare const useSetUserCountry: (setUserCountry: Dispatch<SetStateAction<CountryOptions>>, changLang: (lang: string) => void) => any;
30
30
 
31
31
  declare function useSafeEffect(callback: () => void, dependencies: any[], error_message?: string): void;
@@ -528,6 +528,7 @@ var useDocumentTitle = function(title) {
528
528
  return null;
529
529
  };
530
530
  var useSnapshotBulk = function(configs, label) {
531
+ var cleanupForConfigChange = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
531
532
  var snapshotsFirstTime = (0, import_react3.useRef)([]);
532
533
  var unsubscribeFunctions = (0, import_react3.useRef)([]);
533
534
  useDeepCompareEffect(function() {
@@ -544,9 +545,20 @@ var useSnapshotBulk = function(configs, label) {
544
545
  })).then(function() {
545
546
  console.log("==> ".concat(label || "Custom snapshots", " ended. It took ").concat((performance.now() - start).toFixed(2), " ms"));
546
547
  });
548
+ if (cleanupForConfigChange) {
549
+ return function() {
550
+ unsubscribeFunctions.current.forEach(function(unsubscribe) {
551
+ if (unsubscribe) {
552
+ unsubscribe();
553
+ }
554
+ });
555
+ console.log("==> ".concat(label || "Custom snapshots", " unsubscribed"));
556
+ };
557
+ }
547
558
  }, [
548
559
  configs,
549
- label
560
+ label,
561
+ cleanupForConfigChange
550
562
  ]);
551
563
  (0, import_react3.useEffect)(function() {
552
564
  return function() {
@@ -440,6 +440,7 @@ var useDocumentTitle = function(title) {
440
440
  return null;
441
441
  };
442
442
  var useSnapshotBulk = function(configs, label) {
443
+ var cleanupForConfigChange = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
443
444
  var snapshotsFirstTime = useRef2([]);
444
445
  var unsubscribeFunctions = useRef2([]);
445
446
  useDeepCompareEffect(function() {
@@ -456,9 +457,20 @@ var useSnapshotBulk = function(configs, label) {
456
457
  })).then(function() {
457
458
  console.log("==> ".concat(label || "Custom snapshots", " ended. It took ").concat((performance.now() - start).toFixed(2), " ms"));
458
459
  });
460
+ if (cleanupForConfigChange) {
461
+ return function() {
462
+ unsubscribeFunctions.current.forEach(function(unsubscribe) {
463
+ if (unsubscribe) {
464
+ unsubscribe();
465
+ }
466
+ });
467
+ console.log("==> ".concat(label || "Custom snapshots", " unsubscribed"));
468
+ };
469
+ }
459
470
  }, [
460
471
  configs,
461
- label
472
+ label,
473
+ cleanupForConfigChange
462
474
  ]);
463
475
  useEffect2(function() {
464
476
  return function() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akeyless-client-commons",
3
- "version": "1.0.173",
3
+ "version": "1.0.175",
4
4
  "scripts": {
5
5
  "build": "tsup",
6
6
  "deploy": "npm run build && npm version patch --no-git-tag-version && npm publish",