@dynamic-labs/utils 4.0.0-alpha.10 → 4.0.0-alpha.12
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 +25 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +5 -5
- package/src/index.cjs +4 -0
- package/src/index.d.ts +2 -1
- package/src/index.js +2 -0
- package/src/isInIframe/index.d.ts +1 -0
- package/src/isInIframe/isInIframe.cjs +8 -0
- package/src/isInIframe/isInIframe.d.ts +1 -0
- package/src/isInIframe/isInIframe.js +4 -0
- package/src/services/Oauth2Service/Oauth2Service.d.ts +0 -1
- package/src/services/Oauth2Service/createWindowOauth2Service/createWindowOauth2Service.cjs +8 -0
- package/src/services/Oauth2Service/createWindowOauth2Service/createWindowOauth2Service.js +8 -0
- package/src/services/StorageService/StorageService.d.ts +1 -1
- package/src/services/StorageService/applyPostfixToStorageService/applyPostfixToStorageService.cjs +11 -0
- package/src/services/StorageService/applyPostfixToStorageService/applyPostfixToStorageService.d.ts +7 -0
- package/src/services/StorageService/applyPostfixToStorageService/applyPostfixToStorageService.js +7 -0
- package/src/services/StorageService/applyPostfixToStorageService/index.d.ts +1 -0
- package/src/services/StorageService/createStorageService/createStorageService.cjs +4 -5
- package/src/services/StorageService/createStorageService/createStorageService.d.ts +1 -2
- package/src/services/StorageService/createStorageService/createStorageService.js +4 -5
- package/src/services/StorageService/index.d.ts +1 -0
- package/src/services/StorageService/types.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,29 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.0.0-alpha.12](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.11...v4.0.0-alpha.12) (2024-10-18)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add support for xverse account change event ([#7114](https://github.com/dynamic-labs/dynamic-auth/issues/7114)) ([79df047](https://github.com/dynamic-labs/dynamic-auth/commit/79df04775edb297a339e2d74adcc873584a6d8af))
|
|
8
|
+
* solana embedded signall headless ([#7132](https://github.com/dynamic-labs/dynamic-auth/issues/7132)) ([fe16b71](https://github.com/dynamic-labs/dynamic-auth/commit/fe16b71a4c0ad775f8de87ca899cfdd1071f11d6))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* bug where embeddedWalletCreated event was fired before listener … ([#7151](https://github.com/dynamic-labs/dynamic-auth/issues/7151)) ([ae9da56](https://github.com/dynamic-labs/dynamic-auth/commit/ae9da56850130491384a2d5f47c1617815dcce5b))
|
|
14
|
+
* edge case where wallet book fails to load ([#7148](https://github.com/dynamic-labs/dynamic-auth/issues/7148)) ([805dc6d](https://github.com/dynamic-labs/dynamic-auth/commit/805dc6d7cc4cdf0b23748d82b3bd8216d88d55b5))
|
|
15
|
+
* issues where native currency icons were incorrect ([#7126](https://github.com/dynamic-labs/dynamic-auth/issues/7126)) ([8b8891a](https://github.com/dynamic-labs/dynamic-auth/commit/8b8891a52397e17cc127ea3a09ade14c4b70a8ee))
|
|
16
|
+
* remove now-unused sessionTimeout from useSocial ([#7123](https://github.com/dynamic-labs/dynamic-auth/issues/7123)) ([7959a8a](https://github.com/dynamic-labs/dynamic-auth/commit/7959a8a4c8ceb76c5c4f1ae91af204bf9c5cae7b))
|
|
17
|
+
* Revert: Update Exodus extension version " ([#7130](https://github.com/dynamic-labs/dynamic-auth/issues/7130)) ([f2274ae](https://github.com/dynamic-labs/dynamic-auth/commit/f2274aefd29bb9f3fb6de8493e4a5f73946a5600)), closes [#7129](https://github.com/dynamic-labs/dynamic-auth/issues/7129)
|
|
18
|
+
* use embedded primaryChain when passing undefined chains list to createTurnkeyWallet ([#7149](https://github.com/dynamic-labs/dynamic-auth/issues/7149)) ([c73a3ae](https://github.com/dynamic-labs/dynamic-auth/commit/c73a3aeeda8045b936d218f7078ad79967c321ef))
|
|
19
|
+
|
|
20
|
+
## [4.0.0-alpha.11](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.10...v4.0.0-alpha.11) (2024-10-15)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* missing null check in property accessor ([#7122](https://github.com/dynamic-labs/dynamic-auth/issues/7122)) ([bbb5e76](https://github.com/dynamic-labs/dynamic-auth/commit/bbb5e76c1284edad2829605444dda24971027a57))
|
|
26
|
+
|
|
2
27
|
## [4.0.0-alpha.10](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.9...v4.0.0-alpha.10) (2024-10-15)
|
|
3
28
|
|
|
4
29
|
|
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.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.12",
|
|
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",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://www.dynamic.xyz/",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
21
|
+
"@dynamic-labs/sdk-api-core": "0.0.547",
|
|
22
22
|
"tldts": "6.0.16",
|
|
23
|
-
"@dynamic-labs/assert-package-version": "4.0.0-alpha.
|
|
24
|
-
"@dynamic-labs/logger": "4.0.0-alpha.
|
|
25
|
-
"@dynamic-labs/types": "4.0.0-alpha.
|
|
23
|
+
"@dynamic-labs/assert-package-version": "4.0.0-alpha.12",
|
|
24
|
+
"@dynamic-labs/logger": "4.0.0-alpha.12",
|
|
25
|
+
"@dynamic-labs/types": "4.0.0-alpha.12",
|
|
26
26
|
"buffer": "6.0.3",
|
|
27
27
|
"eventemitter3": "5.0.1"
|
|
28
28
|
},
|
package/src/index.cjs
CHANGED
|
@@ -76,8 +76,10 @@ var hexToString = require('./hexToString/hexToString.cjs');
|
|
|
76
76
|
var isHex = require('./isHex/isHex.cjs');
|
|
77
77
|
var StorageService = require('./services/StorageService/StorageService.cjs');
|
|
78
78
|
var createStorageService = require('./services/StorageService/createStorageService/createStorageService.cjs');
|
|
79
|
+
var applyPostfixToStorageService = require('./services/StorageService/applyPostfixToStorageService/applyPostfixToStorageService.cjs');
|
|
79
80
|
var cloneObjectWithOverrides = require('./cloneObjectWithOverrides/cloneObjectWithOverrides.cjs');
|
|
80
81
|
var promiseWithTimeout = require('./promiseWithTimeout/promiseWithTimeout.cjs');
|
|
82
|
+
var isInIframe = require('./isInIframe/isInIframe.cjs');
|
|
81
83
|
|
|
82
84
|
assertPackageVersion.assertPackageVersion('@dynamic-labs/utils', _package.version);
|
|
83
85
|
|
|
@@ -166,5 +168,7 @@ exports.hexToString = hexToString.hexToString;
|
|
|
166
168
|
exports.isHex = isHex.isHex;
|
|
167
169
|
exports.StorageService = StorageService.StorageService;
|
|
168
170
|
exports.createStorageService = createStorageService.createStorageService;
|
|
171
|
+
exports.applyPostfixToStorageService = applyPostfixToStorageService.applyPostfixToStorageService;
|
|
169
172
|
exports.cloneObjectWithOverrides = cloneObjectWithOverrides.cloneObjectWithOverrides;
|
|
170
173
|
exports.promiseWithTimeout = promiseWithTimeout.promiseWithTimeout;
|
|
174
|
+
exports.isInIframe = isInIframe.isInIframe;
|
package/src/index.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export { template } from './template';
|
|
|
29
29
|
export { get } from './get';
|
|
30
30
|
export { hexToString } from './hexToString';
|
|
31
31
|
export { isHex } from './isHex';
|
|
32
|
-
export { type IStorageService, type StorageOptions, StorageService, createStorageService, } from './services/StorageService';
|
|
32
|
+
export { type IStorageService, type StorageOptions, StorageService, createStorageService, applyPostfixToStorageService, } from './services/StorageService';
|
|
33
33
|
export { cloneObjectWithOverrides } from './cloneObjectWithOverrides';
|
|
34
34
|
export { promiseWithTimeout } from './promiseWithTimeout';
|
|
35
|
+
export { isInIframe } from './isInIframe';
|
package/src/index.js
CHANGED
|
@@ -72,7 +72,9 @@ export { hexToString } from './hexToString/hexToString.js';
|
|
|
72
72
|
export { isHex } from './isHex/isHex.js';
|
|
73
73
|
export { StorageService } from './services/StorageService/StorageService.js';
|
|
74
74
|
export { createStorageService } from './services/StorageService/createStorageService/createStorageService.js';
|
|
75
|
+
export { applyPostfixToStorageService } from './services/StorageService/applyPostfixToStorageService/applyPostfixToStorageService.js';
|
|
75
76
|
export { cloneObjectWithOverrides } from './cloneObjectWithOverrides/cloneObjectWithOverrides.js';
|
|
76
77
|
export { promiseWithTimeout } from './promiseWithTimeout/promiseWithTimeout.js';
|
|
78
|
+
export { isInIframe } from './isInIframe/isInIframe.js';
|
|
77
79
|
|
|
78
80
|
assertPackageVersion('@dynamic-labs/utils', version);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { isInIframe } from './isInIframe';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isInIframe: () => boolean;
|
|
@@ -46,6 +46,14 @@ const createWindowOauth2Service = () => ({
|
|
|
46
46
|
clearInterval(authWindowInterval);
|
|
47
47
|
const providersWaitingOauthMessage = {};
|
|
48
48
|
const authWindow = window.open('', '_blank', 'width=500,height=600');
|
|
49
|
+
if (authWindow === null || typeof authWindow === 'undefined') {
|
|
50
|
+
// Pop-ups are blocked
|
|
51
|
+
typedReject({
|
|
52
|
+
code: types.SocialOAuthErrorCode.OAUTH_WINDOW_BLOCKED,
|
|
53
|
+
message: 'Please allow popups and try again.',
|
|
54
|
+
});
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
49
57
|
const clearListeners = () => {
|
|
50
58
|
window.removeEventListener('message', handleWindowMessage);
|
|
51
59
|
providersWaitingOauthMessage[provider] = false;
|
|
@@ -42,6 +42,14 @@ const createWindowOauth2Service = () => ({
|
|
|
42
42
|
clearInterval(authWindowInterval);
|
|
43
43
|
const providersWaitingOauthMessage = {};
|
|
44
44
|
const authWindow = window.open('', '_blank', 'width=500,height=600');
|
|
45
|
+
if (authWindow === null || typeof authWindow === 'undefined') {
|
|
46
|
+
// Pop-ups are blocked
|
|
47
|
+
typedReject({
|
|
48
|
+
code: SocialOAuthErrorCode.OAUTH_WINDOW_BLOCKED,
|
|
49
|
+
message: 'Please allow popups and try again.',
|
|
50
|
+
});
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
45
53
|
const clearListeners = () => {
|
|
46
54
|
window.removeEventListener('message', handleWindowMessage);
|
|
47
55
|
providersWaitingOauthMessage[provider] = false;
|
|
@@ -20,7 +20,7 @@ export declare class StorageService {
|
|
|
20
20
|
static registerSourceStorage(source: StorageSource, implementation: IStorageService): void;
|
|
21
21
|
static getSourceStorage(source: StorageSource): IStorageService | undefined;
|
|
22
22
|
static resolveStorage(options?: StorageOptions): IStorageService;
|
|
23
|
-
static getItem<T = string>(key: string, options?: StorageOptions): T |
|
|
23
|
+
static getItem<T = string>(key: string, options?: StorageOptions): T | null;
|
|
24
24
|
static setItem<T>(key: string, value: T, options?: StorageOptions): void;
|
|
25
25
|
static removeItem(key: string, options?: StorageOptions): void;
|
|
26
26
|
static getKeys(options?: StorageOptions): string[];
|
package/src/services/StorageService/applyPostfixToStorageService/applyPostfixToStorageService.cjs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
const applyPostfixToStorageService = ({ storage, postfix, }) => {
|
|
7
|
+
const getKeyWithPostfix = (key) => postfix ? `${key}_${postfix}` : key;
|
|
8
|
+
return Object.assign(Object.assign({}, storage), { getItem: (key) => storage.getItem(getKeyWithPostfix(key)), removeItem: (key) => storage.removeItem(getKeyWithPostfix(key)), setItem: (key, data) => storage.setItem(getKeyWithPostfix(key), data) });
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
exports.applyPostfixToStorageService = applyPostfixToStorageService;
|
package/src/services/StorageService/applyPostfixToStorageService/applyPostfixToStorageService.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IStorageService } from '../types';
|
|
2
|
+
type ApplyPostfixToStorageServiceProps<T extends IStorageService> = {
|
|
3
|
+
storage: T;
|
|
4
|
+
postfix: string | undefined;
|
|
5
|
+
};
|
|
6
|
+
export declare const applyPostfixToStorageService: <T extends IStorageService>({ storage, postfix, }: ApplyPostfixToStorageServiceProps<T>) => T;
|
|
7
|
+
export {};
|
package/src/services/StorageService/applyPostfixToStorageService/applyPostfixToStorageService.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
const applyPostfixToStorageService = ({ storage, postfix, }) => {
|
|
3
|
+
const getKeyWithPostfix = (key) => postfix ? `${key}_${postfix}` : key;
|
|
4
|
+
return Object.assign(Object.assign({}, storage), { getItem: (key) => storage.getItem(getKeyWithPostfix(key)), removeItem: (key) => storage.removeItem(getKeyWithPostfix(key)), setItem: (key, data) => storage.setItem(getKeyWithPostfix(key), data) });
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export { applyPostfixToStorageService };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { applyPostfixToStorageService } from './applyPostfixToStorageService';
|
|
@@ -6,13 +6,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var logger = require('../../../logger/logger.cjs');
|
|
7
7
|
var StorageService = require('../StorageService.cjs');
|
|
8
8
|
|
|
9
|
-
const createStorageService = ({
|
|
10
|
-
const getKey = (key) => (postfix ? `${key}_${postfix}` : key);
|
|
9
|
+
const createStorageService = ({ storage, }) => {
|
|
11
10
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
11
|
const packValue = (value) => JSON.stringify(value);
|
|
13
12
|
const unpackValue = (value) => JSON.parse(value);
|
|
14
13
|
const getItem = (key) => {
|
|
15
|
-
const value = storage.getItem(
|
|
14
|
+
const value = storage.getItem(key);
|
|
16
15
|
if (!value) {
|
|
17
16
|
return undefined;
|
|
18
17
|
}
|
|
@@ -29,10 +28,10 @@ const createStorageService = ({ postfix, storage, }) => {
|
|
|
29
28
|
return undefined;
|
|
30
29
|
};
|
|
31
30
|
const setItem = (key, value) => {
|
|
32
|
-
storage.setItem(
|
|
31
|
+
storage.setItem(key, packValue(value));
|
|
33
32
|
};
|
|
34
33
|
const removeItem = (key) => {
|
|
35
|
-
storage.removeItem(
|
|
34
|
+
storage.removeItem(key);
|
|
36
35
|
};
|
|
37
36
|
const getKeys = () => Object.keys(storage);
|
|
38
37
|
return {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { IStorageService } from '../types';
|
|
2
2
|
type CreateStorageServiceProps = {
|
|
3
|
-
postfix?: string;
|
|
4
3
|
storage: Storage;
|
|
5
4
|
};
|
|
6
|
-
export declare const createStorageService: ({
|
|
5
|
+
export declare const createStorageService: ({ storage, }: CreateStorageServiceProps) => IStorageService;
|
|
7
6
|
export {};
|
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
import { logger } from '../../../logger/logger.js';
|
|
3
3
|
import { StorageService } from '../StorageService.js';
|
|
4
4
|
|
|
5
|
-
const createStorageService = ({
|
|
6
|
-
const getKey = (key) => (postfix ? `${key}_${postfix}` : key);
|
|
5
|
+
const createStorageService = ({ storage, }) => {
|
|
7
6
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
7
|
const packValue = (value) => JSON.stringify(value);
|
|
9
8
|
const unpackValue = (value) => JSON.parse(value);
|
|
10
9
|
const getItem = (key) => {
|
|
11
|
-
const value = storage.getItem(
|
|
10
|
+
const value = storage.getItem(key);
|
|
12
11
|
if (!value) {
|
|
13
12
|
return undefined;
|
|
14
13
|
}
|
|
@@ -25,10 +24,10 @@ const createStorageService = ({ postfix, storage, }) => {
|
|
|
25
24
|
return undefined;
|
|
26
25
|
};
|
|
27
26
|
const setItem = (key, value) => {
|
|
28
|
-
storage.setItem(
|
|
27
|
+
storage.setItem(key, packValue(value));
|
|
29
28
|
};
|
|
30
29
|
const removeItem = (key) => {
|
|
31
|
-
storage.removeItem(
|
|
30
|
+
storage.removeItem(key);
|
|
32
31
|
};
|
|
33
32
|
const getKeys = () => Object.keys(storage);
|
|
34
33
|
return {
|