@dynamic-labs/client 2.1.0-alpha.0 → 2.1.0-alpha.10
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 +100 -0
- package/_virtual/_tslib.cjs +1 -0
- package/_virtual/_tslib.js +1 -0
- package/package.cjs +2 -1
- package/package.js +2 -1
- package/package.json +5 -3
- package/src/client/client.cjs +1 -0
- package/src/client/client.d.ts +3 -5
- package/src/client/client.js +1 -0
- package/src/client/core/core.cjs +15 -9
- package/src/client/core/core.js +14 -8
- package/src/index.cjs +1 -0
- package/src/index.d.ts +3 -0
- package/src/index.js +1 -0
- package/src/modules/authModule/authModule.cjs +8 -1
- package/src/modules/authModule/authModule.d.ts +7 -4
- package/src/modules/authModule/authModule.js +8 -1
- package/src/modules/emailAuthModule/emailAuthModule.cjs +17 -0
- package/src/modules/emailAuthModule/emailAuthModule.d.ts +7 -0
- package/src/modules/emailAuthModule/emailAuthModule.js +13 -0
- package/src/modules/emailAuthModule/index.d.ts +1 -0
- package/src/modules/sdkModule/manifest/manifest.cjs +1 -0
- package/src/modules/sdkModule/manifest/manifest.js +1 -0
- package/src/modules/sdkModule/sdkModule.cjs +3 -1
- package/src/modules/sdkModule/sdkModule.d.ts +3 -2
- package/src/modules/sdkModule/sdkModule.js +3 -1
- package/src/modules/smsAuthModule/index.d.ts +1 -0
- package/src/modules/smsAuthModule/smsAuthModule.cjs +17 -0
- package/src/modules/smsAuthModule/smsAuthModule.d.ts +8 -0
- package/src/modules/smsAuthModule/smsAuthModule.js +13 -0
- package/src/modules/walletsModule/walletsModule.cjs +1 -0
- package/src/modules/walletsModule/walletsModule.d.ts +3 -3
- package/src/modules/walletsModule/walletsModule.js +1 -0
- package/src/utils/Extendable/Extendable.cjs +4 -1
- package/src/utils/Extendable/Extendable.js +4 -1
- package/src/utils/Extendable/deepMerge/deepMergeInto.cjs +26 -0
- package/src/utils/Extendable/deepMerge/deepMergeInto.d.ts +6 -0
- package/src/utils/Extendable/deepMerge/deepMergeInto.js +22 -0
- package/src/utils/Extendable/deepMerge/index.d.ts +1 -0
- package/src/utils/pickListenerActions/pickListenerActions.cjs +1 -0
- package/src/utils/pickListenerActions/pickListenerActions.d.ts +1 -1
- package/src/utils/pickListenerActions/pickListenerActions.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,104 @@
|
|
|
1
1
|
|
|
2
|
+
## [2.1.0-alpha.10](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.9...v2.1.0-alpha.10) (2024-04-30)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* bump @coinbase/wallet-sdk to latest beta ([#5388](https://github.com/dynamic-labs/DynamicAuth/issues/5388)) ([9225546](https://github.com/dynamic-labs/DynamicAuth/commit/922554630ccf2ef98bc297521309918f922bc671))
|
|
8
|
+
|
|
9
|
+
## [2.1.0-alpha.9](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.8...v2.1.0-alpha.9) (2024-04-30)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* headless create embedded wallet with optional passkey data parameter ([#5487](https://github.com/dynamic-labs/DynamicAuth/issues/5487)) ([891c3d7](https://github.com/dynamic-labs/DynamicAuth/commit/891c3d77a02a019140bcb8dd03b62b1afd69710e))
|
|
15
|
+
|
|
16
|
+
## [2.1.0-alpha.8](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.7...v2.1.0-alpha.8) (2024-04-26)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* display wallet tabs when linking a wallet ([#5491](https://github.com/dynamic-labs/DynamicAuth/issues/5491)) ([10fd6b4](https://github.com/dynamic-labs/DynamicAuth/commit/10fd6b4d9aec7596338c50e17f79f6be534cf2c1))
|
|
22
|
+
* ensure zerodev viem client handles eth_accounts call ([#5477](https://github.com/dynamic-labs/DynamicAuth/issues/5477)) ([1132e1e](https://github.com/dynamic-labs/DynamicAuth/commit/1132e1e8655b58e81cb56789453ba56a059f52ec))
|
|
23
|
+
* network with keplr ([#5485](https://github.com/dynamic-labs/DynamicAuth/issues/5485)) ([b86f2fc](https://github.com/dynamic-labs/DynamicAuth/commit/b86f2fce491f9752e80a86643916da9ac7fb9276))
|
|
24
|
+
* refetch nameservice data and display properly ([#5476](https://github.com/dynamic-labs/DynamicAuth/issues/5476)) ([2aee798](https://github.com/dynamic-labs/DynamicAuth/commit/2aee798846f69496201bec7aa52e7ec1f370b7c3))
|
|
25
|
+
* use embeddedWallet create response authToken in embeddedWalletCreated ([#5478](https://github.com/dynamic-labs/DynamicAuth/issues/5478)) ([51772da](https://github.com/dynamic-labs/DynamicAuth/commit/51772daf557a72984c757efd8301e2b510dc37f1))
|
|
26
|
+
|
|
27
|
+
## [2.1.0-alpha.7](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.6...v2.1.0-alpha.7) (2024-04-25)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
* restore embedded wallet session iframe element conflict ([#5474](https://github.com/dynamic-labs/DynamicAuth/issues/5474)) ([c157477](https://github.com/dynamic-labs/DynamicAuth/commit/c157477ea126b3130b13b711796bdd06215e7af1))
|
|
33
|
+
|
|
34
|
+
## [2.1.0-alpha.6](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.5...v2.1.0-alpha.6) (2024-04-24)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Bug Fixes
|
|
38
|
+
|
|
39
|
+
* embedded wallets headless session control fixes ([#5469](https://github.com/dynamic-labs/DynamicAuth/issues/5469)) ([92e6c35](https://github.com/dynamic-labs/DynamicAuth/commit/92e6c359d2710fd4f5f5a6fedc4acf6c4bab78ba))
|
|
40
|
+
|
|
41
|
+
## [2.1.0-alpha.5](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.4...v2.1.0-alpha.5) (2024-04-23)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
### Bug Fixes
|
|
45
|
+
|
|
46
|
+
* get embedded wallet checking the wrong chain enum ([#5458](https://github.com/dynamic-labs/DynamicAuth/issues/5458)) ([ed1c523](https://github.com/dynamic-labs/DynamicAuth/commit/ed1c523ca14cd4d21c00181ab40802f876c02b80))
|
|
47
|
+
|
|
48
|
+
## [2.1.0-alpha.4](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.3...v2.1.0-alpha.4) (2024-04-23)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### Features
|
|
52
|
+
|
|
53
|
+
* add email and sms to client auth module ([#5436](https://github.com/dynamic-labs/DynamicAuth/issues/5436)) ([5420476](https://github.com/dynamic-labs/DynamicAuth/commit/5420476d1ba38fd4f987f28e9aefbfb3e61ea2bf))
|
|
54
|
+
* headless create passkeys for embedded wallets ([#5395](https://github.com/dynamic-labs/DynamicAuth/issues/5395)) ([0b64099](https://github.com/dynamic-labs/DynamicAuth/commit/0b6409968457f65886248f0a0879e39ec3803fd0))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
### Bug Fixes
|
|
58
|
+
|
|
59
|
+
* prevent wagmi from reconnect when DynamicContextProvider rerender ([#5446](https://github.com/dynamic-labs/DynamicAuth/issues/5446)) ([33337af](https://github.com/dynamic-labs/DynamicAuth/commit/33337af76786963cb3db7fa7c58c1292c529d0ac))
|
|
60
|
+
|
|
61
|
+
## [2.1.0-alpha.3](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.2...v2.1.0-alpha.3) (2024-04-23)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
### Features
|
|
65
|
+
|
|
66
|
+
* add merge user accounts flow ([#5429](https://github.com/dynamic-labs/DynamicAuth/issues/5429)) ([41d4239](https://github.com/dynamic-labs/DynamicAuth/commit/41d423906625e28004ba8f20baf57847ed8bf5d0))
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
### Bug Fixes
|
|
70
|
+
|
|
71
|
+
* disconnect wallet on lock in connect-only ([#5422](https://github.com/dynamic-labs/DynamicAuth/issues/5422)) ([a26f9fe](https://github.com/dynamic-labs/DynamicAuth/commit/a26f9fe93cf8568f1482e10b831de98c77fb2a2d))
|
|
72
|
+
* useReactiveProxy to stop proxing when it finds a reactive value ([#5428](https://github.com/dynamic-labs/DynamicAuth/issues/5428)) ([838dce9](https://github.com/dynamic-labs/DynamicAuth/commit/838dce9ee953361e41772239a91adb1dd8d40234))
|
|
73
|
+
|
|
74
|
+
## [2.1.0-alpha.2](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.1...v2.1.0-alpha.2) (2024-04-19)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
### Bug Fixes
|
|
78
|
+
|
|
79
|
+
* buffer polyfill for utils package ([#5404](https://github.com/dynamic-labs/DynamicAuth/issues/5404)) ([bd40441](https://github.com/dynamic-labs/DynamicAuth/commit/bd404414a2e51d79fad86d7603dae89628c225b9))
|
|
80
|
+
|
|
81
|
+
## [2.1.0-alpha.1](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.0...v2.1.0-alpha.1) (2024-04-18)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
### Features
|
|
85
|
+
|
|
86
|
+
* add frame metadata to demo index page ([#5327](https://github.com/dynamic-labs/DynamicAuth/issues/5327)) ([34a071a](https://github.com/dynamic-labs/DynamicAuth/commit/34a071af8faa8a867ad747ec2a607056a883568d))
|
|
87
|
+
* add MfaChooseDeviceView and MfaSecureDeviceView ([#5343](https://github.com/dynamic-labs/DynamicAuth/issues/5343)) ([4c39b1c](https://github.com/dynamic-labs/DynamicAuth/commit/4c39b1c34b5091190b095770e95a733c8f458ca2)), closes [#5356](https://github.com/dynamic-labs/DynamicAuth/issues/5356)
|
|
88
|
+
* add redirectUri to farcaster connect ([#5373](https://github.com/dynamic-labs/DynamicAuth/issues/5373)) ([ed13fc2](https://github.com/dynamic-labs/DynamicAuth/commit/ed13fc2948e06df0017ac122db54aca44f264a6d))
|
|
89
|
+
* add useMfa hook ([#5337](https://github.com/dynamic-labs/DynamicAuth/issues/5337)) ([a7682ba](https://github.com/dynamic-labs/DynamicAuth/commit/a7682ba10fd0f0809af802e0172154726f1bd857))
|
|
90
|
+
* headless create session and is session active ([#5346](https://github.com/dynamic-labs/DynamicAuth/issues/5346)) ([a787bbc](https://github.com/dynamic-labs/DynamicAuth/commit/a787bbcbb44104d2d0bd263579bd87a78453681d))
|
|
91
|
+
* secure enclave wallet generate one-time code headless ([#5329](https://github.com/dynamic-labs/DynamicAuth/issues/5329)) ([cab80a2](https://github.com/dynamic-labs/DynamicAuth/commit/cab80a2bfa77e48263d47cdcb813c54ef5b831d5))
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
### Bug Fixes
|
|
95
|
+
|
|
96
|
+
* always stringify the message before signing a message using walletUiUtils ([#5325](https://github.com/dynamic-labs/DynamicAuth/issues/5325)) ([7abf094](https://github.com/dynamic-labs/DynamicAuth/commit/7abf09456e30ad0657892e9ba58d7391f0f430e6))
|
|
97
|
+
* bitcoin network connector sendBitcoin methods updates ([#5369](https://github.com/dynamic-labs/DynamicAuth/issues/5369)) ([e9bf444](https://github.com/dynamic-labs/DynamicAuth/commit/e9bf444122ee86030d85b84ede96bdfb9772425e))
|
|
98
|
+
* buffer missing when using buffer util function ([#5360](https://github.com/dynamic-labs/DynamicAuth/issues/5360)) ([e998e46](https://github.com/dynamic-labs/DynamicAuth/commit/e998e464bd2671a82aa271b407a7d8fc49a16bd0))
|
|
99
|
+
* embedded solana send transaction shouldn't sign a signed transaction ([#5357](https://github.com/dynamic-labs/DynamicAuth/issues/5357)) ([c2ae2fa](https://github.com/dynamic-labs/DynamicAuth/commit/c2ae2faa509b62fc5ceb345fbc0f0b47217bf4b0))
|
|
100
|
+
* use network.name if vanity name is missing ([#5338](https://github.com/dynamic-labs/DynamicAuth/issues/5338)) ([34ec2ae](https://github.com/dynamic-labs/DynamicAuth/commit/34ec2ae5c4dad5376a3b9c5a07221f68a2f7756c))
|
|
101
|
+
|
|
2
102
|
## [2.1.0-alpha.0](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.32...v2.1.0-alpha.0) (2024-04-15)
|
|
3
103
|
|
|
4
104
|
## [2.0.0-alpha.32](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.31...v2.0.0-alpha.32) (2024-04-15)
|
package/_virtual/_tslib.cjs
CHANGED
package/_virtual/_tslib.js
CHANGED
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/client",
|
|
3
|
-
"version": "2.1.0-alpha.
|
|
3
|
+
"version": "2.1.0-alpha.10",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -25,9 +25,11 @@
|
|
|
25
25
|
},
|
|
26
26
|
"./package.json": "./package.json"
|
|
27
27
|
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@dynamic-labs/message-transport": "2.1.0-alpha.10"
|
|
30
|
+
},
|
|
28
31
|
"peerDependencies": {
|
|
29
|
-
"@dynamic-labs/
|
|
30
|
-
"@dynamic-labs/types": "2.1.0-alpha.0",
|
|
32
|
+
"@dynamic-labs/types": "2.1.0-alpha.10",
|
|
31
33
|
"eventemitter3": "5.0.1"
|
|
32
34
|
}
|
|
33
35
|
}
|
package/src/client/client.cjs
CHANGED
package/src/client/client.d.ts
CHANGED
|
@@ -16,11 +16,9 @@ export type ClientProps = {
|
|
|
16
16
|
*/
|
|
17
17
|
export declare const createClient: (props: ClientProps) => {
|
|
18
18
|
/** Module that gives access over authentication state, such as the auth token and user */
|
|
19
|
-
auth: import("
|
|
20
|
-
logout: () => Promise<void>;
|
|
21
|
-
};
|
|
19
|
+
auth: import("../modules/authModule").AuthModule;
|
|
22
20
|
/** Module that gives insight over the state of the SDK */
|
|
23
|
-
sdk: import("
|
|
21
|
+
sdk: import("../modules/sdkModule").SdkModule;
|
|
24
22
|
/** Module that provides access to user's wallets */
|
|
25
|
-
wallets: import("
|
|
23
|
+
wallets: import("../modules/walletsModule").WalletsModule;
|
|
26
24
|
} & Extendable;
|
package/src/client/client.js
CHANGED
package/src/client/core/core.cjs
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
|
+
'use client'
|
|
1
2
|
'use strict';
|
|
2
3
|
|
|
3
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
5
|
|
|
5
|
-
var messageTransport = require('@dynamic-labs/message-transport');
|
|
6
|
+
var messageTransport$1 = require('@dynamic-labs/message-transport');
|
|
6
7
|
|
|
8
|
+
const messageTransport = messageTransport$1.applyDefaultMessageOrigin({
|
|
9
|
+
defaultOrigin: 'host',
|
|
10
|
+
messageTransport: messageTransport$1.makeWaitForInitEvent({
|
|
11
|
+
bypassBlockIf: (message) => message.origin === 'webview',
|
|
12
|
+
initializeMessageType: messageTransport$1.sdkHasLoadedEventName,
|
|
13
|
+
messageTransport: messageTransport$1.createMessageTransport(),
|
|
14
|
+
}),
|
|
15
|
+
});
|
|
16
|
+
// Uncomment this to easily debug incoming/outgoing messages to webview
|
|
17
|
+
// messageTransport.on((message) =>
|
|
18
|
+
// console.log('message', JSON.stringify(message, null, 2)),
|
|
19
|
+
// );
|
|
7
20
|
const createCore = () => ({
|
|
8
21
|
/**
|
|
9
22
|
* Allows an extension to add its name to the list, such that
|
|
@@ -20,14 +33,7 @@ const createCore = () => ({
|
|
|
20
33
|
* Note: Doesn't implement forwarding messages to/from webview yet.
|
|
21
34
|
* The user is expected to extend the client with an Extension that implements that.
|
|
22
35
|
*/
|
|
23
|
-
messageTransport
|
|
24
|
-
defaultOrigin: 'host',
|
|
25
|
-
messageTransport: messageTransport.makeWaitForInitEvent({
|
|
26
|
-
bypassBlockIf: (message) => message.origin === 'webview',
|
|
27
|
-
initializeMessageType: messageTransport.sdkHasLoadedEventName,
|
|
28
|
-
messageTransport: messageTransport.createMessageTransport(),
|
|
29
|
-
}),
|
|
30
|
-
}),
|
|
36
|
+
messageTransport,
|
|
31
37
|
});
|
|
32
38
|
|
|
33
39
|
exports.createCore = createCore;
|
package/src/client/core/core.js
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
|
+
'use client'
|
|
1
2
|
import { applyDefaultMessageOrigin, makeWaitForInitEvent, sdkHasLoadedEventName, createMessageTransport } from '@dynamic-labs/message-transport';
|
|
2
3
|
|
|
4
|
+
const messageTransport = applyDefaultMessageOrigin({
|
|
5
|
+
defaultOrigin: 'host',
|
|
6
|
+
messageTransport: makeWaitForInitEvent({
|
|
7
|
+
bypassBlockIf: (message) => message.origin === 'webview',
|
|
8
|
+
initializeMessageType: sdkHasLoadedEventName,
|
|
9
|
+
messageTransport: createMessageTransport(),
|
|
10
|
+
}),
|
|
11
|
+
});
|
|
12
|
+
// Uncomment this to easily debug incoming/outgoing messages to webview
|
|
13
|
+
// messageTransport.on((message) =>
|
|
14
|
+
// console.log('message', JSON.stringify(message, null, 2)),
|
|
15
|
+
// );
|
|
3
16
|
const createCore = () => ({
|
|
4
17
|
/**
|
|
5
18
|
* Allows an extension to add its name to the list, such that
|
|
@@ -16,14 +29,7 @@ const createCore = () => ({
|
|
|
16
29
|
* Note: Doesn't implement forwarding messages to/from webview yet.
|
|
17
30
|
* The user is expected to extend the client with an Extension that implements that.
|
|
18
31
|
*/
|
|
19
|
-
messageTransport
|
|
20
|
-
defaultOrigin: 'host',
|
|
21
|
-
messageTransport: makeWaitForInitEvent({
|
|
22
|
-
bypassBlockIf: (message) => message.origin === 'webview',
|
|
23
|
-
initializeMessageType: sdkHasLoadedEventName,
|
|
24
|
-
messageTransport: createMessageTransport(),
|
|
25
|
-
}),
|
|
26
|
-
}),
|
|
32
|
+
messageTransport,
|
|
27
33
|
});
|
|
28
34
|
|
|
29
35
|
export { createCore };
|
package/src/index.cjs
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export { type Core } from './client/core';
|
|
2
2
|
export { Extendable, type Extension } from './utils/Extendable';
|
|
3
3
|
export { createClient, type BaseClient, type ClientProps } from './client';
|
|
4
|
+
export type { AuthModule } from './modules/authModule';
|
|
5
|
+
export type { SdkModule } from './modules/sdkModule';
|
|
6
|
+
export type { WalletsModule } from './modules/walletsModule';
|
package/src/index.js
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
|
+
'use client'
|
|
1
2
|
'use strict';
|
|
2
3
|
|
|
3
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
5
|
|
|
5
6
|
var messageTransport = require('@dynamic-labs/message-transport');
|
|
6
7
|
var pickListenerActions = require('../../utils/pickListenerActions/pickListenerActions.cjs');
|
|
8
|
+
var smsAuthModule = require('../smsAuthModule/smsAuthModule.cjs');
|
|
9
|
+
var emailAuthModule = require('../emailAuthModule/emailAuthModule.cjs');
|
|
7
10
|
|
|
8
11
|
const createAuthModule = (core) => {
|
|
12
|
+
const email = emailAuthModule.createEmailAuthModule(core);
|
|
13
|
+
const sms = smsAuthModule.createSmsAuthModule(core);
|
|
9
14
|
const store = messageTransport.createStore({
|
|
10
15
|
initialState: {
|
|
11
|
-
authToken: null,
|
|
12
16
|
authenticatedUser: null,
|
|
17
|
+
token: null,
|
|
13
18
|
},
|
|
14
19
|
key: 'auth',
|
|
15
20
|
messageTransport: core.messageTransport,
|
|
@@ -21,7 +26,9 @@ const createAuthModule = (core) => {
|
|
|
21
26
|
});
|
|
22
27
|
const requestChannel = messageTransport.createRequestChannel(core.messageTransport);
|
|
23
28
|
return Object.assign(store.getters, pickListenerActions.pickListenerActions(messageEvents), {
|
|
29
|
+
email,
|
|
24
30
|
logout: () => requestChannel.request('logout'),
|
|
31
|
+
sms,
|
|
25
32
|
});
|
|
26
33
|
};
|
|
27
34
|
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { AuthModuleMessages, AuthModuleState } from '@dynamic-labs/message-transport';
|
|
1
|
+
import { AuthModuleMessages, AuthModuleState, StoreEventListeners } from '@dynamic-labs/message-transport';
|
|
2
2
|
import { Core } from '../../client/core';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { SmsAuthModule } from '../smsAuthModule';
|
|
4
|
+
import { EmailAuthModule } from '../emailAuthModule';
|
|
5
|
+
export type AuthModule = AuthModuleState & StoreEventListeners<AuthModuleState> & Pick<AuthModuleMessages, 'logout'> & {
|
|
6
|
+
sms: SmsAuthModule;
|
|
7
|
+
email: EmailAuthModule;
|
|
6
8
|
};
|
|
9
|
+
export declare const createAuthModule: (core: Core) => AuthModule;
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
'use client'
|
|
1
2
|
import { createStore, createEventEmitterForMessages, createRequestChannel } from '@dynamic-labs/message-transport';
|
|
2
3
|
import { pickListenerActions } from '../../utils/pickListenerActions/pickListenerActions.js';
|
|
4
|
+
import { createSmsAuthModule } from '../smsAuthModule/smsAuthModule.js';
|
|
5
|
+
import { createEmailAuthModule } from '../emailAuthModule/emailAuthModule.js';
|
|
3
6
|
|
|
4
7
|
const createAuthModule = (core) => {
|
|
8
|
+
const email = createEmailAuthModule(core);
|
|
9
|
+
const sms = createSmsAuthModule(core);
|
|
5
10
|
const store = createStore({
|
|
6
11
|
initialState: {
|
|
7
|
-
authToken: null,
|
|
8
12
|
authenticatedUser: null,
|
|
13
|
+
token: null,
|
|
9
14
|
},
|
|
10
15
|
key: 'auth',
|
|
11
16
|
messageTransport: core.messageTransport,
|
|
@@ -17,7 +22,9 @@ const createAuthModule = (core) => {
|
|
|
17
22
|
});
|
|
18
23
|
const requestChannel = createRequestChannel(core.messageTransport);
|
|
19
24
|
return Object.assign(store.getters, pickListenerActions(messageEvents), {
|
|
25
|
+
email,
|
|
20
26
|
logout: () => requestChannel.request('logout'),
|
|
27
|
+
sms,
|
|
21
28
|
});
|
|
22
29
|
};
|
|
23
30
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var messageTransport = require('@dynamic-labs/message-transport');
|
|
7
|
+
|
|
8
|
+
const createEmailAuthModule = (core) => {
|
|
9
|
+
const requestChannel = messageTransport.createRequestChannel(core.messageTransport);
|
|
10
|
+
return {
|
|
11
|
+
resendOTP: () => requestChannel.request('resendOTP'),
|
|
12
|
+
sendOTP: (target) => requestChannel.request('sendOTP', { destination: 'email', target }),
|
|
13
|
+
verifyOTP: (token) => requestChannel.request('verifyOTP', token),
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.createEmailAuthModule = createEmailAuthModule;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Core } from '../../client/core';
|
|
2
|
+
export declare const createEmailAuthModule: (core: Core) => {
|
|
3
|
+
resendOTP: () => Promise<void>;
|
|
4
|
+
sendOTP: (target: string) => Promise<void>;
|
|
5
|
+
verifyOTP: (token: string) => Promise<void>;
|
|
6
|
+
};
|
|
7
|
+
export type EmailAuthModule = ReturnType<typeof createEmailAuthModule>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { createRequestChannel } from '@dynamic-labs/message-transport';
|
|
3
|
+
|
|
4
|
+
const createEmailAuthModule = (core) => {
|
|
5
|
+
const requestChannel = createRequestChannel(core.messageTransport);
|
|
6
|
+
return {
|
|
7
|
+
resendOTP: () => requestChannel.request('resendOTP'),
|
|
8
|
+
sendOTP: (target) => requestChannel.request('sendOTP', { destination: 'email', target }),
|
|
9
|
+
verifyOTP: (token) => requestChannel.request('verifyOTP', token),
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { createEmailAuthModule };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createEmailAuthModule, type EmailAuthModule } from './emailAuthModule';
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
'use client'
|
|
1
2
|
'use strict';
|
|
2
3
|
|
|
3
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
5
|
|
|
5
6
|
var _tslib = require('../../../_virtual/_tslib.cjs');
|
|
6
7
|
var messageTransport = require('@dynamic-labs/message-transport');
|
|
8
|
+
var pickListenerActions = require('../../utils/pickListenerActions/pickListenerActions.cjs');
|
|
7
9
|
var manifest = require('./manifest/manifest.cjs');
|
|
8
10
|
|
|
9
11
|
const createSdkModule = (core, props) => {
|
|
@@ -16,7 +18,7 @@ const createSdkModule = (core, props) => {
|
|
|
16
18
|
key: 'sdk',
|
|
17
19
|
messageTransport: core.messageTransport,
|
|
18
20
|
});
|
|
19
|
-
return store.getters;
|
|
21
|
+
return Object.assign(store.getters, pickListenerActions.pickListenerActions(store.eventEmitter));
|
|
20
22
|
};
|
|
21
23
|
|
|
22
24
|
exports.createSdkModule = createSdkModule;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { SdkModuleState } from '@dynamic-labs/message-transport';
|
|
1
|
+
import { SdkModuleState, StoreEventListeners } from '@dynamic-labs/message-transport';
|
|
2
2
|
import type { ClientProps } from '../../client';
|
|
3
3
|
import { Core } from '../../client/core';
|
|
4
|
-
export
|
|
4
|
+
export type SdkModule = SdkModuleState & StoreEventListeners<SdkModuleState>;
|
|
5
|
+
export declare const createSdkModule: (core: Core, props: ClientProps) => SdkModule;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
'use client'
|
|
1
2
|
import { __awaiter } from '../../../_virtual/_tslib.js';
|
|
2
3
|
import { createRequestChannel, createStore } from '@dynamic-labs/message-transport';
|
|
4
|
+
import { pickListenerActions } from '../../utils/pickListenerActions/pickListenerActions.js';
|
|
3
5
|
import { createManifest } from './manifest/manifest.js';
|
|
4
6
|
|
|
5
7
|
const createSdkModule = (core, props) => {
|
|
@@ -12,7 +14,7 @@ const createSdkModule = (core, props) => {
|
|
|
12
14
|
key: 'sdk',
|
|
13
15
|
messageTransport: core.messageTransport,
|
|
14
16
|
});
|
|
15
|
-
return store.getters;
|
|
17
|
+
return Object.assign(store.getters, pickListenerActions(store.eventEmitter));
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
export { createSdkModule };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createSmsAuthModule, type SmsAuthModule } from './smsAuthModule';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var messageTransport = require('@dynamic-labs/message-transport');
|
|
7
|
+
|
|
8
|
+
const createSmsAuthModule = (core) => {
|
|
9
|
+
const requestChannel = messageTransport.createRequestChannel(core.messageTransport);
|
|
10
|
+
return {
|
|
11
|
+
resendOTP: () => requestChannel.request('resendOTP'),
|
|
12
|
+
sendOTP: (target) => requestChannel.request('sendOTP', { destination: 'sms', target }),
|
|
13
|
+
verifyOTP: (token) => requestChannel.request('verifyOTP', token),
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.createSmsAuthModule = createSmsAuthModule;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PhoneData } from '@dynamic-labs/types';
|
|
2
|
+
import { Core } from '../../client/core';
|
|
3
|
+
export declare const createSmsAuthModule: (core: Core) => {
|
|
4
|
+
resendOTP: () => Promise<void>;
|
|
5
|
+
sendOTP: (target: PhoneData) => Promise<void>;
|
|
6
|
+
verifyOTP: (token: string) => Promise<void>;
|
|
7
|
+
};
|
|
8
|
+
export type SmsAuthModule = ReturnType<typeof createSmsAuthModule>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { createRequestChannel } from '@dynamic-labs/message-transport';
|
|
3
|
+
|
|
4
|
+
const createSmsAuthModule = (core) => {
|
|
5
|
+
const requestChannel = createRequestChannel(core.messageTransport);
|
|
6
|
+
return {
|
|
7
|
+
resendOTP: () => requestChannel.request('resendOTP'),
|
|
8
|
+
sendOTP: (target) => requestChannel.request('sendOTP', { destination: 'sms', target }),
|
|
9
|
+
verifyOTP: (token) => requestChannel.request('verifyOTP', token),
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { createSmsAuthModule };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalletsModuleState } from '@dynamic-labs/message-transport';
|
|
1
|
+
import { StoreEventListeners, WalletsModuleState } from '@dynamic-labs/message-transport';
|
|
2
2
|
import { Core } from '../../client/core';
|
|
3
|
-
export type WalletsModule =
|
|
4
|
-
export declare const createWalletsModule: (core: Core) =>
|
|
3
|
+
export type WalletsModule = WalletsModuleState & StoreEventListeners<WalletsModuleState>;
|
|
4
|
+
export declare const createWalletsModule: (core: Core) => WalletsModule;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
'use client'
|
|
1
2
|
'use strict';
|
|
2
3
|
|
|
3
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
5
|
|
|
6
|
+
var deepMergeInto = require('./deepMerge/deepMergeInto.cjs');
|
|
7
|
+
|
|
5
8
|
// Class here is necessary to have access to "this" keyword
|
|
6
9
|
/**
|
|
7
10
|
* An object that can be extended.
|
|
@@ -19,7 +22,7 @@ class Extendable {
|
|
|
19
22
|
this.core = core;
|
|
20
23
|
}
|
|
21
24
|
extend(extension) {
|
|
22
|
-
return
|
|
25
|
+
return deepMergeInto.deepMergeInto(this, extension(this, this.core));
|
|
23
26
|
}
|
|
24
27
|
}
|
|
25
28
|
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { deepMergeInto } from './deepMerge/deepMergeInto.js';
|
|
3
|
+
|
|
1
4
|
// Class here is necessary to have access to "this" keyword
|
|
2
5
|
/**
|
|
3
6
|
* An object that can be extended.
|
|
@@ -15,7 +18,7 @@ class Extendable {
|
|
|
15
18
|
this.core = core;
|
|
16
19
|
}
|
|
17
20
|
extend(extension) {
|
|
18
|
-
return
|
|
21
|
+
return deepMergeInto(this, extension(this, this.core));
|
|
19
22
|
}
|
|
20
23
|
}
|
|
21
24
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
/** Performs a deep merge into obj1 */
|
|
7
|
+
const deepMergeInto = (obj1, obj2) => {
|
|
8
|
+
// Merge obj2 into obj1, recursively if the property is an object
|
|
9
|
+
for (const key in obj2) {
|
|
10
|
+
if (!Object.prototype.hasOwnProperty.call(obj2, key))
|
|
11
|
+
continue;
|
|
12
|
+
// If key exists in obj1 and both are objects, recurse
|
|
13
|
+
if (Object.prototype.hasOwnProperty.call(obj1, key) &&
|
|
14
|
+
typeof obj1[key] === 'object' &&
|
|
15
|
+
typeof obj2[key] === 'object') {
|
|
16
|
+
obj1[key] = deepMergeInto(obj1[key], obj2[key]);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
// Otherwise, just overwrite/add the property from obj2
|
|
20
|
+
obj1[key] = obj2[key];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return obj1;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
exports.deepMergeInto = deepMergeInto;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
/** Performs a deep merge into obj1 */
|
|
3
|
+
const deepMergeInto = (obj1, obj2) => {
|
|
4
|
+
// Merge obj2 into obj1, recursively if the property is an object
|
|
5
|
+
for (const key in obj2) {
|
|
6
|
+
if (!Object.prototype.hasOwnProperty.call(obj2, key))
|
|
7
|
+
continue;
|
|
8
|
+
// If key exists in obj1 and both are objects, recurse
|
|
9
|
+
if (Object.prototype.hasOwnProperty.call(obj1, key) &&
|
|
10
|
+
typeof obj1[key] === 'object' &&
|
|
11
|
+
typeof obj2[key] === 'object') {
|
|
12
|
+
obj1[key] = deepMergeInto(obj1[key], obj2[key]);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
// Otherwise, just overwrite/add the property from obj2
|
|
16
|
+
obj1[key] = obj2[key];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return obj1;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { deepMergeInto };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './deepMergeInto';
|
|
@@ -3,4 +3,4 @@ import EventEmitter from 'eventemitter3';
|
|
|
3
3
|
* This only serves to limit the methods of an event emitter to
|
|
4
4
|
* only the ones necessary for event listening
|
|
5
5
|
*/
|
|
6
|
-
export declare const pickListenerActions: <T extends EventEmitter<any, any>>(emitter: T) => Pick<T,
|
|
6
|
+
export declare const pickListenerActions: <T extends EventEmitter<any, any>>(emitter: T) => Pick<T, 'on' | 'off' | 'once'>;
|