@dynamic-labs/utils 4.7.2 → 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 +21 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +4 -4
- package/src/handleMobileWalletRedirect/handleMobileWalletRedirect.cjs +5 -2
- package/src/handleMobileWalletRedirect/handleMobileWalletRedirect.js +5 -2
- package/src/services/Oauth2Service/createWindowOauth2Service/createWindowOauth2Service.cjs +3 -1
- package/src/services/Oauth2Service/createWindowOauth2Service/createWindowOauth2Service.js +3 -1
- package/src/services/PlatformService/PlatformService.d.ts +1 -1
- package/src/services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.cjs +7 -2
- package/src/services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.js +7 -2
- package/src/services/PlatformService/types.d.ts +10 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,25 @@
|
|
|
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
|
+
|
|
9
|
+
## [4.8.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.7.2...v4.8.0) (2025-02-25)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* add support for network switching for SOL wallets ([#8095](https://github.com/dynamic-labs/dynamic-auth/issues/8095)) ([8997b39](https://github.com/dynamic-labs/dynamic-auth/commit/8997b399e1e5cd294aad8b719d39928eed5e911d))
|
|
15
|
+
* add support for solNetworks override ([#8138](https://github.com/dynamic-labs/dynamic-auth/issues/8138)) ([8c3f374](https://github.com/dynamic-labs/dynamic-auth/commit/8c3f374a9b2b451f984aed98e7ce506552e2a6c5))
|
|
16
|
+
* **react-native:** add account abstraction multi-chain ([#8132](https://github.com/dynamic-labs/dynamic-auth/issues/8132)) ([c64a26e](https://github.com/dynamic-labs/dynamic-auth/commit/c64a26e16943d913edf4683084f59592a9aeedfc))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* ensure zero dev network cache use project id ([#8133](https://github.com/dynamic-labs/dynamic-auth/issues/8133)) ([408c4ed](https://github.com/dynamic-labs/dynamic-auth/commit/408c4ed764a623b6d870cd24973320e5ca4a74c7))
|
|
22
|
+
|
|
2
23
|
### [4.7.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.7.1...v4.7.2) (2025-02-22)
|
|
3
24
|
|
|
4
25
|
### Features
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/utils",
|
|
3
|
-
"version": "4.
|
|
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.
|
|
24
|
-
"@dynamic-labs/logger": "4.
|
|
25
|
-
"@dynamic-labs/types": "4.
|
|
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
|
-
|
|
16
|
+
PlatformService.PlatformService.openURL(`${nativeLink}/${url}?ref=${ref}`);
|
|
14
17
|
}
|
|
15
18
|
else {
|
|
16
|
-
|
|
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
|
-
|
|
12
|
+
PlatformService.openURL(`${nativeLink}/${url}?ref=${ref}`);
|
|
10
13
|
}
|
|
11
14
|
else {
|
|
12
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
}
|
package/src/services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.cjs
CHANGED
|
@@ -24,8 +24,13 @@ const createBrowserPlatformService = (window) => ({
|
|
|
24
24
|
return data.domain || undefined;
|
|
25
25
|
},
|
|
26
26
|
isNativeMobile: false,
|
|
27
|
-
openURL: (
|
|
28
|
-
|
|
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
|
|
package/src/services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.js
CHANGED
|
@@ -20,8 +20,13 @@ const createBrowserPlatformService = (window) => ({
|
|
|
20
20
|
return data.domain || undefined;
|
|
21
21
|
},
|
|
22
22
|
isNativeMobile: false,
|
|
23
|
-
openURL: (
|
|
24
|
-
|
|
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.
|
|
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
|
}
|