@dynamic-labs/utils 4.8.0 → 4.8.1

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,11 @@
1
1
 
2
+ ### [4.8.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.8.0...v4.8.1) (2025-02-25)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * wc redirect for safari inside iframe ([#8131](https://github.com/dynamic-labs/dynamic-auth/issues/8131)) ([8c74bea](https://github.com/dynamic-labs/dynamic-auth/commit/8c74beae505014eb85be4fd211909709d0a339dd))
8
+
2
9
  ## [4.8.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.7.2...v4.8.0) (2025-02-25)
3
10
 
4
11
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.8.0";
6
+ var version = "4.8.1";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.8.0";
2
+ var version = "4.8.1";
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.8.0",
3
+ "version": "4.8.1",
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.628",
22
22
  "tldts": "6.0.16",
23
- "@dynamic-labs/assert-package-version": "4.8.0",
24
- "@dynamic-labs/logger": "4.8.0",
25
- "@dynamic-labs/types": "4.8.0",
23
+ "@dynamic-labs/assert-package-version": "4.8.1",
24
+ "@dynamic-labs/logger": "4.8.1",
25
+ "@dynamic-labs/types": "4.8.1",
26
26
  "buffer": "6.0.3",
27
27
  "eventemitter3": "5.0.1"
28
28
  },
@@ -4,16 +4,19 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var isMobile = require('../isMobile/isMobile.cjs');
7
+ var PlatformService = require('../services/PlatformService/PlatformService.cjs');
8
+ require('../../_virtual/_tslib.cjs');
9
+ require('tldts');
7
10
 
8
11
  const handleMobileWalletRedirect = ({ nativeLink, universalLink, }) => {
9
12
  const url = encodeURIComponent(window.location.toString());
10
13
  const ref = encodeURIComponent(window.location.origin);
11
14
  // samsung browser only supports native links, not universal links
12
15
  if (isMobile.isSamsungBrowser()) {
13
- window.location.assign(`${nativeLink}/${url}?ref=${ref}`);
16
+ PlatformService.PlatformService.openURL(`${nativeLink}/${url}?ref=${ref}`);
14
17
  }
15
18
  else {
16
- window.location.assign(`${universalLink}/${url}?ref=${ref}`);
19
+ PlatformService.PlatformService.openURL(`${universalLink}/${url}?ref=${ref}`);
17
20
  }
18
21
  };
19
22
 
@@ -1,15 +1,18 @@
1
1
  'use client'
2
2
  import { isSamsungBrowser } from '../isMobile/isMobile.js';
3
+ import { PlatformService } from '../services/PlatformService/PlatformService.js';
4
+ import '../../_virtual/_tslib.js';
5
+ import 'tldts';
3
6
 
4
7
  const handleMobileWalletRedirect = ({ nativeLink, universalLink, }) => {
5
8
  const url = encodeURIComponent(window.location.toString());
6
9
  const ref = encodeURIComponent(window.location.origin);
7
10
  // samsung browser only supports native links, not universal links
8
11
  if (isSamsungBrowser()) {
9
- window.location.assign(`${nativeLink}/${url}?ref=${ref}`);
12
+ PlatformService.openURL(`${nativeLink}/${url}?ref=${ref}`);
10
13
  }
11
14
  else {
12
- window.location.assign(`${universalLink}/${url}?ref=${ref}`);
15
+ PlatformService.openURL(`${universalLink}/${url}?ref=${ref}`);
13
16
  }
14
17
  };
15
18
 
@@ -8,6 +8,8 @@ var types = require('@dynamic-labs/types');
8
8
  var logger = require('../../../logger/logger.cjs');
9
9
  var connectWithAppleId = require('../utils/connectWithAppleId/connectWithAppleId.cjs');
10
10
  var isMobile = require('../../../isMobile/isMobile.cjs');
11
+ var PlatformService = require('../../PlatformService/PlatformService.cjs');
12
+ require('tldts');
11
13
 
12
14
  let authWindowInterval;
13
15
  const createWindowOauth2Service = () => ({
@@ -35,7 +37,7 @@ const createWindowOauth2Service = () => ({
35
37
  initWebAuth({
36
38
  redirectUrl: redirectUrl || window.location.href,
37
39
  }).then(() => {
38
- window.location.assign(oauthLoginUrl);
40
+ PlatformService.PlatformService.openURL(oauthLoginUrl.toString());
39
41
  });
40
42
  return;
41
43
  }
@@ -4,6 +4,8 @@ import { ProviderEnum, SocialOAuthErrorCode } from '@dynamic-labs/types';
4
4
  import { logger } from '../../../logger/logger.js';
5
5
  import { connectWithAppleId } from '../utils/connectWithAppleId/connectWithAppleId.js';
6
6
  import { isSafariBrowser, isIOS } from '../../../isMobile/isMobile.js';
7
+ import { PlatformService } from '../../PlatformService/PlatformService.js';
8
+ import 'tldts';
7
9
 
8
10
  let authWindowInterval;
9
11
  const createWindowOauth2Service = () => ({
@@ -31,7 +33,7 @@ const createWindowOauth2Service = () => ({
31
33
  initWebAuth({
32
34
  redirectUrl: redirectUrl || window.location.href,
33
35
  }).then(() => {
34
- window.location.assign(oauthLoginUrl);
36
+ PlatformService.openURL(oauthLoginUrl.toString());
35
37
  });
36
38
  return;
37
39
  }
@@ -36,5 +36,5 @@ export declare class PlatformService {
36
36
  /**
37
37
  * Opens a URL. If possible, should avoid new windows.
38
38
  */
39
- static get openURL(): (url: string) => Promise<void>;
39
+ static get openURL(): (url: string, target?: "self" | "blank" | undefined, features?: string | undefined) => Promise<void>;
40
40
  }
@@ -24,8 +24,13 @@ const createBrowserPlatformService = (window) => ({
24
24
  return data.domain || undefined;
25
25
  },
26
26
  isNativeMobile: false,
27
- openURL: (url) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
28
- window.location.assign(url);
27
+ openURL: (url_1, ...args_1) => _tslib.__awaiter(void 0, [url_1, ...args_1], void 0, function* (url, target = 'self', features = '') {
28
+ if (target === 'blank') {
29
+ window.open(url, '_blank', features);
30
+ }
31
+ else {
32
+ window.location.assign(url);
33
+ }
29
34
  }),
30
35
  });
31
36
 
@@ -20,8 +20,13 @@ const createBrowserPlatformService = (window) => ({
20
20
  return data.domain || undefined;
21
21
  },
22
22
  isNativeMobile: false,
23
- openURL: (url) => __awaiter(void 0, void 0, void 0, function* () {
24
- window.location.assign(url);
23
+ openURL: (url_1, ...args_1) => __awaiter(void 0, [url_1, ...args_1], void 0, function* (url, target = 'self', features = '') {
24
+ if (target === 'blank') {
25
+ window.open(url, '_blank', features);
26
+ }
27
+ else {
28
+ window.location.assign(url);
29
+ }
25
30
  }),
26
31
  });
27
32
 
@@ -30,7 +30,15 @@ export interface IPlatformService {
30
30
  getDisplayOrigin(): string | undefined;
31
31
  getTLD(): string | undefined;
32
32
  /**
33
- * Opens a URL. If possible, should avoid new windows.
33
+ * Opens a URL.
34
+ *
35
+ * Target options:
36
+ * - 'self': Opens the URL in the current window (default).
37
+ * - 'blank': Opens the URL in a new window.
38
+ *
39
+ * The `features` parameter is passed to the `window.open` function when the target is 'blank'.
40
+ *
41
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/open
34
42
  */
35
- openURL(url: string): Promise<void>;
43
+ openURL(url: string, target?: 'self' | 'blank', features?: string): Promise<void>;
36
44
  }