@dynamic-labs/utils 4.49.0 → 4.50.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 +15 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +4 -4
- package/src/index.d.ts +1 -1
- package/src/services/PlatformService/PlatformService.cjs +17 -0
- package/src/services/PlatformService/PlatformService.d.ts +13 -1
- package/src/services/PlatformService/PlatformService.js +17 -0
- package/src/services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.cjs +9 -0
- package/src/services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.js +9 -0
- package/src/services/PlatformService/types.d.ts +16 -0
- package/src/services/StorageService/StorageService.cjs +0 -4
- package/src/services/StorageService/StorageService.js +0 -4
- package/src/setupInsideIframe/utils/setupPlatformService/setupPlatformService.cjs +9 -0
- package/src/setupInsideIframe/utils/setupPlatformService/setupPlatformService.js +9 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.50.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.49.0...v4.50.0) (2025-12-09)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add usePhantomRedirectEvents hook ([#10030](https://github.com/dynamic-labs/dynamic-auth/issues/10030)) ([fb8585e](https://github.com/dynamic-labs/dynamic-auth/commit/fb8585eec9847cd350be71d28291e9831a3f31b1))
|
|
8
|
+
* introduce embedded wallet reveal complete events ([#10068](https://github.com/dynamic-labs/dynamic-auth/issues/10068)) ([8ea79ce](https://github.com/dynamic-labs/dynamic-auth/commit/8ea79ceaba36745d46759c8e8c6681895b092096))
|
|
9
|
+
* **react-native:** add download file ([#9954](https://github.com/dynamic-labs/dynamic-auth/issues/9954)) ([408b00f](https://github.com/dynamic-labs/dynamic-auth/commit/408b00fabd2afbd87d12efb51e78ecbd89a323d3))
|
|
10
|
+
* **react-native:** add solana Phantom support with client module for listening to events ([#10033](https://github.com/dynamic-labs/dynamic-auth/issues/10033)) ([a5a2d11](https://github.com/dynamic-labs/dynamic-auth/commit/a5a2d11ccd3c102e22dece808a0ba4116155a582))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* remove overflow from token balance dropdown ([#10044](https://github.com/dynamic-labs/dynamic-auth/issues/10044)) ([b37c5bb](https://github.com/dynamic-labs/dynamic-auth/commit/b37c5bb8e8c916b8d685b495555a3a3481cd5f0d))
|
|
16
|
+
|
|
2
17
|
## [4.49.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.48.2...v4.49.0) (2025-12-05)
|
|
3
18
|
|
|
4
19
|
|
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.50.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.831",
|
|
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.50.1",
|
|
24
|
+
"@dynamic-labs/logger": "4.50.1",
|
|
25
|
+
"@dynamic-labs/types": "4.50.1",
|
|
26
26
|
"buffer": "6.0.3",
|
|
27
27
|
"eventemitter3": "5.0.1"
|
|
28
28
|
},
|
package/src/index.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export { runSafe } from './runSafe';
|
|
|
39
39
|
export { template } from './template';
|
|
40
40
|
export { tracing } from './tracing';
|
|
41
41
|
export { PHANTOM_REDIRECT_CONNECTION_TYPE_KEY, type PhantomRedirectConnectionType, } from './consts/phantomRedirect';
|
|
42
|
-
export { PlatformService, createBrowserPlatformService, type IPlatformService, } from './services/PlatformService';
|
|
42
|
+
export { PlatformService, createBrowserPlatformService, type IPlatformService, type PlatformServiceUrlUpdateListener, } from './services/PlatformService';
|
|
43
43
|
export { PlatformEventsService, type IPlatformEvents, type IPlatformEventsService, } from './services/PlatformEventsService';
|
|
44
44
|
export { FetchService } from './services/FetchService';
|
|
45
45
|
export { Oauth2Service, type GetOauthCodeError, type GetOauthCodeProps, type IOauth2Service, createWindowOauth2Service, } from './services/Oauth2Service';
|
|
@@ -73,6 +73,23 @@ class PlatformService {
|
|
|
73
73
|
static get openURL() {
|
|
74
74
|
return _a.implementation.openURL;
|
|
75
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Downloads a file with the given filename and content.
|
|
78
|
+
*/
|
|
79
|
+
static get downloadFile() {
|
|
80
|
+
return _a.implementation.downloadFile;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Registers a listener for URL updates.
|
|
84
|
+
* This is primarily used in native mobile environments where deep links
|
|
85
|
+
* can update the current URL asynchronously.
|
|
86
|
+
*
|
|
87
|
+
* @returns A function to unsubscribe the listener, or undefined if not supported.
|
|
88
|
+
*/
|
|
89
|
+
static onUrlUpdate(listener) {
|
|
90
|
+
var _b, _c;
|
|
91
|
+
return (_c = (_b = _a.implementation).onUrlUpdate) === null || _c === void 0 ? void 0 : _c.call(_b, listener);
|
|
92
|
+
}
|
|
76
93
|
}
|
|
77
94
|
_a = PlatformService;
|
|
78
95
|
_PlatformService_implementation = { value: void 0 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IPlatformService } from './types';
|
|
1
|
+
import { IPlatformService, PlatformServiceUrlUpdateListener } from './types';
|
|
2
2
|
export declare class PlatformService {
|
|
3
3
|
#private;
|
|
4
4
|
static get implementation(): IPlatformService;
|
|
@@ -43,4 +43,16 @@ export declare class PlatformService {
|
|
|
43
43
|
* Opens a URL. If possible, should avoid new windows.
|
|
44
44
|
*/
|
|
45
45
|
static get openURL(): (url: string, target?: "self" | "blank" | undefined, features?: string | undefined) => Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Downloads a file with the given filename and content.
|
|
48
|
+
*/
|
|
49
|
+
static get downloadFile(): (fileName: string, file: Blob) => Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Registers a listener for URL updates.
|
|
52
|
+
* This is primarily used in native mobile environments where deep links
|
|
53
|
+
* can update the current URL asynchronously.
|
|
54
|
+
*
|
|
55
|
+
* @returns A function to unsubscribe the listener, or undefined if not supported.
|
|
56
|
+
*/
|
|
57
|
+
static onUrlUpdate(listener: PlatformServiceUrlUpdateListener): (() => void) | undefined;
|
|
46
58
|
}
|
|
@@ -69,6 +69,23 @@ class PlatformService {
|
|
|
69
69
|
static get openURL() {
|
|
70
70
|
return _a.implementation.openURL;
|
|
71
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Downloads a file with the given filename and content.
|
|
74
|
+
*/
|
|
75
|
+
static get downloadFile() {
|
|
76
|
+
return _a.implementation.downloadFile;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Registers a listener for URL updates.
|
|
80
|
+
* This is primarily used in native mobile environments where deep links
|
|
81
|
+
* can update the current URL asynchronously.
|
|
82
|
+
*
|
|
83
|
+
* @returns A function to unsubscribe the listener, or undefined if not supported.
|
|
84
|
+
*/
|
|
85
|
+
static onUrlUpdate(listener) {
|
|
86
|
+
var _b, _c;
|
|
87
|
+
return (_c = (_b = _a.implementation).onUrlUpdate) === null || _c === void 0 ? void 0 : _c.call(_b, listener);
|
|
88
|
+
}
|
|
72
89
|
}
|
|
73
90
|
_a = PlatformService;
|
|
74
91
|
_PlatformService_implementation = { value: void 0 };
|
package/src/services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.cjs
CHANGED
|
@@ -7,6 +7,15 @@ var _tslib = require('../../../../_virtual/_tslib.cjs');
|
|
|
7
7
|
var tldts = require('tldts');
|
|
8
8
|
|
|
9
9
|
const createBrowserPlatformService = (window) => ({
|
|
10
|
+
downloadFile: (fileName, file) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
+
const element = document.createElement('a');
|
|
12
|
+
element.href = URL.createObjectURL(file);
|
|
13
|
+
element.download = fileName;
|
|
14
|
+
document.body.appendChild(element);
|
|
15
|
+
element.click();
|
|
16
|
+
document.body.removeChild(element);
|
|
17
|
+
URL.revokeObjectURL(element.href);
|
|
18
|
+
}),
|
|
10
19
|
getDisplayOrigin: () => window.location.origin,
|
|
11
20
|
getHost: () => window.location.host,
|
|
12
21
|
getHostname: () => window.location.hostname,
|
package/src/services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.js
CHANGED
|
@@ -3,6 +3,15 @@ import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
|
3
3
|
import { parse } from 'tldts';
|
|
4
4
|
|
|
5
5
|
const createBrowserPlatformService = (window) => ({
|
|
6
|
+
downloadFile: (fileName, file) => __awaiter(void 0, void 0, void 0, function* () {
|
|
7
|
+
const element = document.createElement('a');
|
|
8
|
+
element.href = URL.createObjectURL(file);
|
|
9
|
+
element.download = fileName;
|
|
10
|
+
document.body.appendChild(element);
|
|
11
|
+
element.click();
|
|
12
|
+
document.body.removeChild(element);
|
|
13
|
+
URL.revokeObjectURL(element.href);
|
|
14
|
+
}),
|
|
6
15
|
getDisplayOrigin: () => window.location.origin,
|
|
7
16
|
getHost: () => window.location.host,
|
|
8
17
|
getHostname: () => window.location.hostname,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type PlatformServiceUrlUpdateListener = (url: URL) => void;
|
|
1
2
|
export interface IPlatformService {
|
|
2
3
|
/**
|
|
3
4
|
* Indicates if the current platform is a native mobile app
|
|
@@ -47,4 +48,19 @@ export interface IPlatformService {
|
|
|
47
48
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/open
|
|
48
49
|
*/
|
|
49
50
|
openURL(url: string, target?: 'self' | 'blank', features?: string): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Downloads a file with the given filename and content.
|
|
53
|
+
*
|
|
54
|
+
* @param fileName - The name of the file to download
|
|
55
|
+
* @param file - The file content as a Blob
|
|
56
|
+
*/
|
|
57
|
+
downloadFile(fileName: string, file: Blob): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Registers a listener for URL updates.
|
|
60
|
+
* This is primarily used in native mobile environments where deep links
|
|
61
|
+
* can update the current URL asynchronously.
|
|
62
|
+
*
|
|
63
|
+
* @returns A function to unsubscribe the listener.
|
|
64
|
+
*/
|
|
65
|
+
onUrlUpdate?(listener: PlatformServiceUrlUpdateListener): () => void;
|
|
50
66
|
}
|
|
@@ -31,10 +31,6 @@ class StorageService {
|
|
|
31
31
|
}
|
|
32
32
|
static resolveStorage(options) {
|
|
33
33
|
const priority = (options === null || options === void 0 ? void 0 : options.priority) || ['localStorage'];
|
|
34
|
-
logger.logger.logVerboseTroubleshootingMessage('StorageService.resolveStorage', {
|
|
35
|
-
options,
|
|
36
|
-
priority,
|
|
37
|
-
});
|
|
38
34
|
for (const source of priority) {
|
|
39
35
|
const storage = StorageService.getSourceStorage(source);
|
|
40
36
|
if (storage) {
|
|
@@ -23,10 +23,6 @@ class StorageService {
|
|
|
23
23
|
}
|
|
24
24
|
static resolveStorage(options) {
|
|
25
25
|
const priority = (options === null || options === void 0 ? void 0 : options.priority) || ['localStorage'];
|
|
26
|
-
logger.logVerboseTroubleshootingMessage('StorageService.resolveStorage', {
|
|
27
|
-
options,
|
|
28
|
-
priority,
|
|
29
|
-
});
|
|
30
26
|
for (const source of priority) {
|
|
31
27
|
const storage = StorageService.getSourceStorage(source);
|
|
32
28
|
if (storage) {
|
|
@@ -14,6 +14,15 @@ const setupPlatformService = (initialParentURL) => {
|
|
|
14
14
|
const messageHandler = createMessageHandler.createMessageHandler(initialParentURL.origin);
|
|
15
15
|
const messageSender = createMessageSender.createMessageSender(initialParentURL.origin);
|
|
16
16
|
PlatformService.PlatformService.implementation = {
|
|
17
|
+
downloadFile: (fileName, file) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
const element = document.createElement('a');
|
|
19
|
+
element.href = URL.createObjectURL(file);
|
|
20
|
+
element.download = fileName;
|
|
21
|
+
document.body.appendChild(element);
|
|
22
|
+
element.click();
|
|
23
|
+
document.body.removeChild(element);
|
|
24
|
+
URL.revokeObjectURL(element.href);
|
|
25
|
+
}),
|
|
17
26
|
getDisplayOrigin: () => parentURL.origin,
|
|
18
27
|
getHost: () => parentURL.host,
|
|
19
28
|
getHostname: () => parentURL.hostname,
|
|
@@ -10,6 +10,15 @@ const setupPlatformService = (initialParentURL) => {
|
|
|
10
10
|
const messageHandler = createMessageHandler(initialParentURL.origin);
|
|
11
11
|
const messageSender = createMessageSender(initialParentURL.origin);
|
|
12
12
|
PlatformService.implementation = {
|
|
13
|
+
downloadFile: (fileName, file) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
+
const element = document.createElement('a');
|
|
15
|
+
element.href = URL.createObjectURL(file);
|
|
16
|
+
element.download = fileName;
|
|
17
|
+
document.body.appendChild(element);
|
|
18
|
+
element.click();
|
|
19
|
+
document.body.removeChild(element);
|
|
20
|
+
URL.revokeObjectURL(element.href);
|
|
21
|
+
}),
|
|
13
22
|
getDisplayOrigin: () => parentURL.origin,
|
|
14
23
|
getHost: () => parentURL.host,
|
|
15
24
|
getHostname: () => parentURL.hostname,
|