@dynamic-labs/utils 4.2.2 → 4.3.0

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/CHANGELOG.md CHANGED
@@ -1,4 +1,23 @@
1
1
 
2
+ ## [4.3.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.2.3...v4.3.0) (2025-01-21)
3
+
4
+
5
+ ### Features
6
+
7
+ * add support for Nightly wallet on Eclipse ([#7848](https://github.com/dynamic-labs/dynamic-auth/issues/7848)) ([dd6e8d4](https://github.com/dynamic-labs/dynamic-auth/commit/dd6e8d41daf632a1b55137f903b6fc99a148c071))
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * fix storage sync issues when upgrade to sdk v4 while user is logged in ([#7835](https://github.com/dynamic-labs/dynamic-auth/issues/7835)) ([528b6f9](https://github.com/dynamic-labs/dynamic-auth/commit/528b6f9ce5d0e77d518dcfb7021fc711d2a9e503))
13
+
14
+ ### [4.2.3](https://github.com/dynamic-labs/dynamic-auth/compare/v4.2.2...v4.2.3) (2025-01-16)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * properly raise userUpdated event when updating email and phone ([#7817](https://github.com/dynamic-labs/dynamic-auth/issues/7817)) ([f129aa1](https://github.com/dynamic-labs/dynamic-auth/commit/f129aa1cd0360394ea3b500a829e378bdf5b7c64))
20
+
2
21
  ### [4.2.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.2.1...v4.2.2) (2025-01-15)
3
22
 
4
23
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.2.2";
6
+ var version = "4.3.0";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.2.2";
2
+ var version = "4.3.0";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/utils",
3
- "version": "4.2.2",
3
+ "version": "4.3.0",
4
4
  "description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
5
5
  "author": "Dynamic Labs, Inc.",
6
6
  "license": "MIT",
@@ -20,9 +20,9 @@
20
20
  "dependencies": {
21
21
  "@dynamic-labs/sdk-api-core": "0.0.586",
22
22
  "tldts": "6.0.16",
23
- "@dynamic-labs/assert-package-version": "4.2.2",
24
- "@dynamic-labs/logger": "4.2.2",
25
- "@dynamic-labs/types": "4.2.2",
23
+ "@dynamic-labs/assert-package-version": "4.3.0",
24
+ "@dynamic-labs/logger": "4.3.0",
25
+ "@dynamic-labs/types": "4.3.0",
26
26
  "buffer": "6.0.3",
27
27
  "eventemitter3": "5.0.1"
28
28
  },
@@ -0,0 +1,29 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ /**
7
+ * Formats a version string according to the specified format pattern.
8
+ *
9
+ * @param version - The version string in the format "x.y.z" (e.g., "1.2.3")
10
+ * @param format - The desired output format using combinations of "major", "minor", and "patch"
11
+ * @returns The formatted version string
12
+ *
13
+ * @example
14
+ * formatVersion("1.2.3", "major.minor") // returns "1.2"
15
+ * formatVersion("1.2.3", "major") // returns "1"
16
+ * formatVersion("1.2.3", "major.minor.patch") // returns "1.2.3"
17
+ */
18
+ const formatVersion = (version, format) => {
19
+ const versionMap = Object.fromEntries(['major', 'minor', 'patch'].map((unit, index) => [
20
+ unit,
21
+ version.split('.')[index],
22
+ ]));
23
+ return format
24
+ .split('.')
25
+ .map((unit) => versionMap[unit])
26
+ .join('.');
27
+ };
28
+
29
+ exports.formatVersion = formatVersion;
@@ -0,0 +1,16 @@
1
+ type VersionFormatUnit = 'major' | 'minor' | 'patch';
2
+ type Format = `${VersionFormatUnit}.${VersionFormatUnit}.${VersionFormatUnit}` | `${VersionFormatUnit}.${VersionFormatUnit}` | `${VersionFormatUnit}`;
3
+ /**
4
+ * Formats a version string according to the specified format pattern.
5
+ *
6
+ * @param version - The version string in the format "x.y.z" (e.g., "1.2.3")
7
+ * @param format - The desired output format using combinations of "major", "minor", and "patch"
8
+ * @returns The formatted version string
9
+ *
10
+ * @example
11
+ * formatVersion("1.2.3", "major.minor") // returns "1.2"
12
+ * formatVersion("1.2.3", "major") // returns "1"
13
+ * formatVersion("1.2.3", "major.minor.patch") // returns "1.2.3"
14
+ */
15
+ export declare const formatVersion: (version: string, format: Format) => string;
16
+ export {};
@@ -0,0 +1,25 @@
1
+ 'use client'
2
+ /**
3
+ * Formats a version string according to the specified format pattern.
4
+ *
5
+ * @param version - The version string in the format "x.y.z" (e.g., "1.2.3")
6
+ * @param format - The desired output format using combinations of "major", "minor", and "patch"
7
+ * @returns The formatted version string
8
+ *
9
+ * @example
10
+ * formatVersion("1.2.3", "major.minor") // returns "1.2"
11
+ * formatVersion("1.2.3", "major") // returns "1"
12
+ * formatVersion("1.2.3", "major.minor.patch") // returns "1.2.3"
13
+ */
14
+ const formatVersion = (version, format) => {
15
+ const versionMap = Object.fromEntries(['major', 'minor', 'patch'].map((unit, index) => [
16
+ unit,
17
+ version.split('.')[index],
18
+ ]));
19
+ return format
20
+ .split('.')
21
+ .map((unit) => versionMap[unit])
22
+ .join('.');
23
+ };
24
+
25
+ export { formatVersion };
@@ -0,0 +1 @@
1
+ export { formatVersion } from './formatVersion';
package/src/index.cjs CHANGED
@@ -76,6 +76,7 @@ var decryptMessage = require('./encryption/decryptMessage/decryptMessage.cjs');
76
76
  var encryptMessage = require('./encryption/encryptMessage/encryptMessage.cjs');
77
77
  var isEncryptedMessage = require('./encryption/isEncryptedMessage/isEncryptedMessage.cjs');
78
78
  var uint8ArrayToBase64 = require('./uint8ArrayToBase64/uint8ArrayToBase64.cjs');
79
+ var formatVersion = require('./formatVersion/formatVersion.cjs');
79
80
  var cloneObjectWithOverrides = require('./cloneObjectWithOverrides/cloneObjectWithOverrides.cjs');
80
81
  var get = require('./get/get.cjs');
81
82
  var hexToString = require('./hexToString/hexToString.cjs');
@@ -186,6 +187,7 @@ exports.encryptMessage = encryptMessage.encryptMessage;
186
187
  exports.isEncryptedMessage = isEncryptedMessage.isEncryptedMessage;
187
188
  exports.uint8ArrayFromBase64 = uint8ArrayToBase64.uint8ArrayFromBase64;
188
189
  exports.uint8ArrayToBase64 = uint8ArrayToBase64.uint8ArrayToBase64;
190
+ exports.formatVersion = formatVersion.formatVersion;
189
191
  exports.cloneObjectWithOverrides = cloneObjectWithOverrides.cloneObjectWithOverrides;
190
192
  exports.get = get.get;
191
193
  exports.hexToString = hexToString.hexToString;
package/src/index.d.ts CHANGED
@@ -27,6 +27,7 @@ export * from './uniq';
27
27
  export * from './wrapMethodWithCallback';
28
28
  export * from './encryption';
29
29
  export * from './uint8ArrayToBase64';
30
+ export * from './formatVersion';
30
31
  export { cloneObjectWithOverrides } from './cloneObjectWithOverrides';
31
32
  export { get } from './get';
32
33
  export { hexToString } from './hexToString';
package/src/index.js CHANGED
@@ -72,6 +72,7 @@ export { decryptMessage } from './encryption/decryptMessage/decryptMessage.js';
72
72
  export { encryptMessage } from './encryption/encryptMessage/encryptMessage.js';
73
73
  export { isEncryptedMessage } from './encryption/isEncryptedMessage/isEncryptedMessage.js';
74
74
  export { uint8ArrayFromBase64, uint8ArrayToBase64 } from './uint8ArrayToBase64/uint8ArrayToBase64.js';
75
+ export { formatVersion } from './formatVersion/formatVersion.js';
75
76
  export { cloneObjectWithOverrides } from './cloneObjectWithOverrides/cloneObjectWithOverrides.js';
76
77
  export { get } from './get/get.js';
77
78
  export { hexToString } from './hexToString/hexToString.js';