@dynamic-labs/utils 2.1.0-alpha.25 → 2.1.0-alpha.26

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,17 @@
1
1
 
2
+ ## [2.1.0-alpha.26](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.25...v2.1.0-alpha.26) (2024-05-29)
3
+
4
+
5
+ ### Features
6
+
7
+ * add farcaster login to react native ([#5713](https://github.com/dynamic-labs/DynamicAuth/issues/5713)) ([08f4473](https://github.com/dynamic-labs/DynamicAuth/commit/08f4473eec9b32b82b6f703fa4d5136514a61b25))
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * better error handling of invalid mfa otp ([#5759](https://github.com/dynamic-labs/DynamicAuth/issues/5759)) ([72ab01f](https://github.com/dynamic-labs/DynamicAuth/commit/72ab01f8f919f147eeedfabf8b4838802abf308a))
13
+ * show correct status for magic eden btc wallets after ([#5748](https://github.com/dynamic-labs/DynamicAuth/issues/5748)) ([b8f20bb](https://github.com/dynamic-labs/DynamicAuth/commit/b8f20bb796b9a2e88817ef3b0da6ac32e9012b18))
14
+
2
15
  ## [2.1.0-alpha.25](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.24...v2.1.0-alpha.25) (2024-05-27)
3
16
 
4
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/utils",
3
- "version": "2.1.0-alpha.25",
3
+ "version": "2.1.0-alpha.26",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
@@ -28,8 +28,8 @@
28
28
  "dependencies": {
29
29
  "@dynamic-labs/sdk-api-core": "0.0.453",
30
30
  "tldts": "6.0.16",
31
- "@dynamic-labs/logger": "2.1.0-alpha.25",
32
- "@dynamic-labs/types": "2.1.0-alpha.25",
31
+ "@dynamic-labs/logger": "2.1.0-alpha.26",
32
+ "@dynamic-labs/types": "2.1.0-alpha.26",
33
33
  "buffer": "6.0.3"
34
34
  },
35
35
  "peerDependencies": {
@@ -0,0 +1,14 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var DynamicError = require('./DynamicError.cjs');
7
+
8
+ class MfaInvalidOtpError extends DynamicError.DynamicError {
9
+ constructor() {
10
+ super('Invalid MFA OTP');
11
+ }
12
+ }
13
+
14
+ exports.MfaInvalidOtpError = MfaInvalidOtpError;
@@ -0,0 +1,4 @@
1
+ import { DynamicError } from './DynamicError';
2
+ export declare class MfaInvalidOtpError extends DynamicError {
3
+ constructor();
4
+ }
@@ -0,0 +1,10 @@
1
+ 'use client'
2
+ import { DynamicError } from './DynamicError.js';
3
+
4
+ class MfaInvalidOtpError extends DynamicError {
5
+ constructor() {
6
+ super('Invalid MFA OTP');
7
+ }
8
+ }
9
+
10
+ export { MfaInvalidOtpError };
@@ -28,3 +28,4 @@ export * from './CustomFieldNotUniqueError';
28
28
  export * from './CookieInvalidError';
29
29
  export * from './AccessBlockedError';
30
30
  export * from './EmbeddedWalletException';
31
+ export * from './MfaInvalidOtpError';
@@ -4,6 +4,7 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var PlatformService = require('../services/PlatformService/PlatformService.cjs');
7
+ require('../../_virtual/_tslib.cjs');
7
8
  require('tldts');
8
9
 
9
10
  const getTLD = () => PlatformService.PlatformService.getTLD();
@@ -1,5 +1,6 @@
1
1
  'use client'
2
2
  import { PlatformService } from '../services/PlatformService/PlatformService.js';
3
+ import '../../_virtual/_tslib.js';
3
4
  import 'tldts';
4
5
 
5
6
  const getTLD = () => PlatformService.getTLD();
package/src/index.cjs CHANGED
@@ -34,6 +34,7 @@ var CustomFieldNotUniqueError = require('./errors/CustomFieldNotUniqueError.cjs'
34
34
  var CookieInvalidError = require('./errors/CookieInvalidError.cjs');
35
35
  var AccessBlockedError = require('./errors/AccessBlockedError.cjs');
36
36
  var EmbeddedWalletException = require('./errors/EmbeddedWalletException.cjs');
37
+ var MfaInvalidOtpError = require('./errors/MfaInvalidOtpError.cjs');
37
38
  var CancellablePromise = require('./CancellablePromise/CancellablePromise.cjs');
38
39
  var isFunction = require('./isFunction/isFunction.cjs');
39
40
  var isMobile = require('./isMobile.cjs');
@@ -92,6 +93,7 @@ exports.CustomFieldNotUniqueError = CustomFieldNotUniqueError.CustomFieldNotUniq
92
93
  exports.CookieInvalidError = CookieInvalidError.CookieInvalidError;
93
94
  exports.AccessBlockedError = AccessBlockedError.AccessBlockedError;
94
95
  exports.EmbeddedWalletException = EmbeddedWalletException.EmbeddedWalletException;
96
+ exports.MfaInvalidOtpError = MfaInvalidOtpError.MfaInvalidOtpError;
95
97
  exports.CancellablePromise = CancellablePromise.CancellablePromise;
96
98
  exports.isFunction = isFunction.isFunction;
97
99
  exports.getAndroidVersion = isMobile.getAndroidVersion;
package/src/index.js CHANGED
@@ -30,6 +30,7 @@ export { CustomFieldNotUniqueError } from './errors/CustomFieldNotUniqueError.js
30
30
  export { CookieInvalidError } from './errors/CookieInvalidError.js';
31
31
  export { AccessBlockedError } from './errors/AccessBlockedError.js';
32
32
  export { EmbeddedWalletException } from './errors/EmbeddedWalletException.js';
33
+ export { MfaInvalidOtpError } from './errors/MfaInvalidOtpError.js';
33
34
  export { CancellablePromise } from './CancellablePromise/CancellablePromise.js';
34
35
  export { isFunction } from './isFunction/isFunction.js';
35
36
  export { getAndroidVersion, isAndroid, isIOS, isIPad, isIPhone, isIPhone8OrEarlier, isLegacySafari, isMobile, isSamsungBrowser, isWindows } from './isMobile.js';
@@ -21,6 +21,12 @@ class PlatformService {
21
21
  static get getTLD() {
22
22
  return PlatformService.implementation.getTLD;
23
23
  }
24
+ static get openURL() {
25
+ return PlatformService.implementation.openURL;
26
+ }
27
+ static get openNewWindow() {
28
+ return PlatformService.implementation.openNewWindow;
29
+ }
24
30
  }
25
31
 
26
32
  exports.PlatformService = PlatformService;
@@ -5,4 +5,6 @@ export declare class PlatformService {
5
5
  static setImplementation(implementation: IPlatformService): void;
6
6
  static get getHostname(): () => string;
7
7
  static get getTLD(): () => string | undefined;
8
+ static get openURL(): (url: string) => Promise<void>;
9
+ static get openNewWindow(): (url: string) => Promise<void>;
8
10
  }
@@ -17,6 +17,12 @@ class PlatformService {
17
17
  static get getTLD() {
18
18
  return PlatformService.implementation.getTLD;
19
19
  }
20
+ static get openURL() {
21
+ return PlatformService.implementation.openURL;
22
+ }
23
+ static get openNewWindow() {
24
+ return PlatformService.implementation.openNewWindow;
25
+ }
20
26
  }
21
27
 
22
28
  export { PlatformService };
@@ -3,6 +3,7 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
+ var _tslib = require('../../../../_virtual/_tslib.cjs');
6
7
  var tldts = require('tldts');
7
8
 
8
9
  const createBrowserPlatformService = (window) => ({
@@ -19,6 +20,12 @@ const createBrowserPlatformService = (window) => ({
19
20
  });
20
21
  return data.domain || undefined;
21
22
  },
23
+ openNewWindow: (url) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
24
+ window.open(url);
25
+ }),
26
+ openURL: (url) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
27
+ window.location.assign(url);
28
+ }),
22
29
  });
23
30
 
24
31
  exports.createBrowserPlatformService = createBrowserPlatformService;
@@ -1,4 +1,5 @@
1
1
  'use client'
2
+ import { __awaiter } from '../../../../_virtual/_tslib.js';
2
3
  import { parse } from 'tldts';
3
4
 
4
5
  const createBrowserPlatformService = (window) => ({
@@ -15,6 +16,12 @@ const createBrowserPlatformService = (window) => ({
15
16
  });
16
17
  return data.domain || undefined;
17
18
  },
19
+ openNewWindow: (url) => __awaiter(void 0, void 0, void 0, function* () {
20
+ window.open(url);
21
+ }),
22
+ openURL: (url) => __awaiter(void 0, void 0, void 0, function* () {
23
+ window.location.assign(url);
24
+ }),
18
25
  });
19
26
 
20
27
  export { createBrowserPlatformService };
@@ -1,4 +1,17 @@
1
1
  export interface IPlatformService {
2
+ /**
3
+ * Gets the hostname of the current location.
4
+ *
5
+ * @example window.location.hostname
6
+ */
2
7
  getHostname(): string;
3
8
  getTLD(): string | undefined;
9
+ /**
10
+ * Opens a URL. If possible, should avoid new windows.
11
+ */
12
+ openURL(url: string): Promise<void>;
13
+ /**
14
+ * Opens a given URL in a new window.
15
+ */
16
+ openNewWindow(url: string): Promise<void>;
4
17
  }