@dynamic-labs/message-transport 2.1.0-alpha.9 → 2.1.0
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 +257 -0
- package/_virtual/_tslib.cjs +13 -0
- package/_virtual/_tslib.js +13 -1
- package/package.json +3 -3
- package/src/index.cjs +4 -0
- package/src/index.d.ts +4 -2
- package/src/index.js +2 -0
- package/src/messageTypes/ConsoleMessages.d.ts +11 -0
- package/src/messageTypes/EmbeddedWalletsModuleMessages.d.ts +8 -0
- package/src/messageTypes/EthMessages.d.ts +13 -0
- package/src/messageTypes/FetchMessages.d.ts +8 -0
- package/src/messageTypes/NetworksModuleMessages.d.ts +4 -0
- package/src/messageTypes/PasskeyMessages.d.ts +32 -0
- package/src/messageTypes/PlatformServiceMessages.d.ts +12 -0
- package/src/messageTypes/SdkModuleMessages.d.ts +5 -3
- package/src/messageTypes/SocialAuthModuleMessages.d.ts +13 -0
- package/src/messageTypes/UserInterfaceModuleMessages.d.ts +4 -0
- package/src/messageTypes/WalletsModuleMessages.d.ts +22 -0
- package/src/messageTypes/WebViewVisibilityMessages.d.ts +3 -0
- package/src/messageTypes/index.d.ts +10 -0
- package/src/requestChannel/requestChannel.cjs +10 -2
- package/src/requestChannel/requestChannel.js +10 -2
- package/src/store/types.d.ts +1 -1
- package/src/utils/isSerializedError/index.d.ts +1 -0
- package/src/utils/isSerializedError/isSerializedError.cjs +14 -0
- package/src/utils/isSerializedError/isSerializedError.d.ts +2 -0
- package/src/utils/isSerializedError/isSerializedError.js +10 -0
- package/src/utils/parseErrorFromTransport/index.d.ts +1 -0
- package/src/utils/parseErrorFromTransport/parseErrorFromTransport.cjs +54 -0
- package/src/utils/parseErrorFromTransport/parseErrorFromTransport.d.ts +11 -0
- package/src/utils/parseErrorFromTransport/parseErrorFromTransport.js +50 -0
- package/src/utils/serializeErrorForTransport/index.d.ts +1 -0
- package/src/utils/serializeErrorForTransport/serializeErrorForTransport.cjs +33 -0
- package/src/utils/serializeErrorForTransport/serializeErrorForTransport.d.ts +19 -0
- package/src/utils/serializeErrorForTransport/serializeErrorForTransport.js +29 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,261 @@
|
|
|
1
1
|
|
|
2
|
+
## [2.1.0](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.32...v2.1.0) (2024-06-04)
|
|
3
|
+
|
|
4
|
+
## Features
|
|
5
|
+
|
|
6
|
+
### General Availability
|
|
7
|
+
|
|
8
|
+
- Support for Coinbase Smart Wallet comes as a default with V2.1, check out [the configuration guide and overview](https://docs.dynamic.xyz/wallets/advanced-wallets/coinbase-smart-wallet)
|
|
9
|
+
|
|
10
|
+
### New closed betas ([talk to us](https://dynamic.xyz/slack) for access)
|
|
11
|
+
|
|
12
|
+
- React Native - You can now build mobile-first onboarding experiences with the same Dynamic magic but for React Native, get started [here](https://docs.dynamic.xyz/react-native/introduction)
|
|
13
|
+
|
|
14
|
+
- Cookie Authentication - Dynamic can now be configured to set a secure, HttpOnly cookie that can be used for authenticating with Dynamic’s backend. This will contain a minified version of our JWT token.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## Improvements
|
|
18
|
+
|
|
19
|
+
### General Wallets
|
|
20
|
+
- Phantom integration now supports Bitcoin out of the box
|
|
21
|
+
|
|
22
|
+
### Headless
|
|
23
|
+
- Social Sign-in is now available, learn more in the [guide here](https://docs.dynamic.xyz/headless/headless-social)
|
|
24
|
+
|
|
25
|
+
### Hooks
|
|
26
|
+
- [useSwitchWallet](https://docs.dynamic.xyz/react-sdk/hooks/useswitchwallet) now means you can easily switch between wallets for an authenticated user.
|
|
27
|
+
|
|
28
|
+
### Signup UI
|
|
29
|
+
- Farcaster QR code shows by default if the only login option, learn more [here](https://docs.dynamic.xyz/guides/integrations/farcaster/sign-in-with-farcaster)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## [2.1.0-alpha.32](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.31...v2.1.0-alpha.32) (2024-06-04)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Features
|
|
36
|
+
|
|
37
|
+
* favor base mainnet when using coinbase sdk ([#5834](https://github.com/dynamic-labs/DynamicAuth/issues/5834)) ([fee5294](https://github.com/dynamic-labs/DynamicAuth/commit/fee529461e6b033938d3ec044c139f5efcb24f6d))
|
|
38
|
+
* open OKX deep link for Bitcoin ([#5818](https://github.com/dynamic-labs/DynamicAuth/issues/5818)) ([c33e93c](https://github.com/dynamic-labs/DynamicAuth/commit/c33e93c81b384d8cd91b3bd0414dd9ea669405c4))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Bug Fixes
|
|
42
|
+
|
|
43
|
+
* change Bitget Wallet to Bitget ([#5824](https://github.com/dynamic-labs/DynamicAuth/issues/5824)) ([23b8813](https://github.com/dynamic-labs/DynamicAuth/commit/23b8813e233be07392f5a3e283226b238b9fd99b))
|
|
44
|
+
* coinbase isInstalled ([#5821](https://github.com/dynamic-labs/DynamicAuth/issues/5821)) ([d0e5a37](https://github.com/dynamic-labs/DynamicAuth/commit/d0e5a37c6dd0cb6b85a5704767c93d495aa22854))
|
|
45
|
+
* filter window.solana in solProviderHelper if no extensionLocators are set ([#5819](https://github.com/dynamic-labs/DynamicAuth/issues/5819)) ([ca098ad](https://github.com/dynamic-labs/DynamicAuth/commit/ca098adb787365f9969c1a1f853d3c65ddd40d54))
|
|
46
|
+
* only send ordinal address if only one address retrieved from btc wallet ([#5817](https://github.com/dynamic-labs/DynamicAuth/issues/5817)) ([d54cef4](https://github.com/dynamic-labs/DynamicAuth/commit/d54cef424368b804fde0a4e607fefce22877a304))
|
|
47
|
+
|
|
48
|
+
## [2.1.0-alpha.31](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.30...v2.1.0-alpha.31) (2024-05-31)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### Bug Fixes
|
|
52
|
+
|
|
53
|
+
* export solana private keys in the correct format ([#5809](https://github.com/dynamic-labs/DynamicAuth/issues/5809)) ([08ac1f8](https://github.com/dynamic-labs/DynamicAuth/commit/08ac1f87bb02ad07fd1fc1f544fdcc64ebe635b8))
|
|
54
|
+
* magiceden evm network switching ([#5800](https://github.com/dynamic-labs/DynamicAuth/issues/5800)) ([9b86797](https://github.com/dynamic-labs/DynamicAuth/commit/9b8679735f3db4b33bb57409c3a69adf2beb82aa))
|
|
55
|
+
* pass all signing inputs to createPsbtOptions ([#5798](https://github.com/dynamic-labs/DynamicAuth/issues/5798)) ([628ad4f](https://github.com/dynamic-labs/DynamicAuth/commit/628ad4f8c161496a0610ecbc3052735f8ceae98d))
|
|
56
|
+
* trigger onboarding async ([#5805](https://github.com/dynamic-labs/DynamicAuth/issues/5805)) ([2c1f98c](https://github.com/dynamic-labs/DynamicAuth/commit/2c1f98c0d91422f75e2d6d32ea4a27c2bc8d8376))
|
|
57
|
+
|
|
58
|
+
## [2.1.0-alpha.30](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.29...v2.1.0-alpha.30) (2024-05-31)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
### Bug Fixes
|
|
62
|
+
|
|
63
|
+
* ensure initExpirationTime is called automatically after authenticating ([#5797](https://github.com/dynamic-labs/DynamicAuth/issues/5797)) ([87eb802](https://github.com/dynamic-labs/DynamicAuth/commit/87eb802e0c2d3af2ca116e07099bfef426d30a1f))
|
|
64
|
+
* initExpirationTime should use expiresAt from storage ([#5799](https://github.com/dynamic-labs/DynamicAuth/issues/5799)) ([384ed17](https://github.com/dynamic-labs/DynamicAuth/commit/384ed1747d9b813ac0d34aaee36eb6480cb256d3))
|
|
65
|
+
* only run useValidateSession once on rerender ([#5795](https://github.com/dynamic-labs/DynamicAuth/issues/5795)) ([ba4446d](https://github.com/dynamic-labs/DynamicAuth/commit/ba4446df95726248b877a84def959cabe81ad9b6))
|
|
66
|
+
* store expiresAt timestamp from VerifyResponse in local storage for use in initExpirationTime ([#5796](https://github.com/dynamic-labs/DynamicAuth/issues/5796)) ([5f8aaeb](https://github.com/dynamic-labs/DynamicAuth/commit/5f8aaeb1cd45b10cb007f9eac25d18f50f142d8f))
|
|
67
|
+
|
|
68
|
+
## [2.1.0-alpha.29](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.28...v2.1.0-alpha.29) (2024-05-30)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
### Features
|
|
72
|
+
|
|
73
|
+
* add account and chain to coinbase walletClient ([#5776](https://github.com/dynamic-labs/DynamicAuth/issues/5776)) ([557091c](https://github.com/dynamic-labs/DynamicAuth/commit/557091c0efaec11273bd40b53c8bcd633c1bf48d))
|
|
74
|
+
* add support for phantom btc ([#5717](https://github.com/dynamic-labs/DynamicAuth/issues/5717)) ([c61ca4f](https://github.com/dynamic-labs/DynamicAuth/commit/c61ca4f437796be2b420902de7e7de730725d122))
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
### Bug Fixes
|
|
78
|
+
|
|
79
|
+
* add phantom btc mobile redirect ([#5789](https://github.com/dynamic-labs/DynamicAuth/issues/5789)) ([aaa2654](https://github.com/dynamic-labs/DynamicAuth/commit/aaa26548668b0733e7930c1d7f5cc3937b3dfb50))
|
|
80
|
+
* clear settings and configurations when logged out on page load ([#5787](https://github.com/dynamic-labs/DynamicAuth/issues/5787)) ([53c4d0b](https://github.com/dynamic-labs/DynamicAuth/commit/53c4d0b4686debdb43b1ab1b8b9e296ed4dd74b6))
|
|
81
|
+
* lookup projectSettings from store to check if cookie enabled ([#5790](https://github.com/dynamic-labs/DynamicAuth/issues/5790)) ([6f2314b](https://github.com/dynamic-labs/DynamicAuth/commit/6f2314b0afef984e6caea79ead73d12c5c6d83f0))
|
|
82
|
+
|
|
83
|
+
## [2.1.0-alpha.28](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.27...v2.1.0-alpha.28) (2024-05-29)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
### Features
|
|
87
|
+
|
|
88
|
+
* adds solana standard wallet connector ([#5752](https://github.com/dynamic-labs/DynamicAuth/issues/5752)) ([0040940](https://github.com/dynamic-labs/DynamicAuth/commit/0040940fd1adb37ab3106bb0e4dfe79403bc41f2))
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
### Bug Fixes
|
|
92
|
+
|
|
93
|
+
* farcaster fetch url fix ([#5767](https://github.com/dynamic-labs/DynamicAuth/issues/5767)) ([1408ba9](https://github.com/dynamic-labs/DynamicAuth/commit/1408ba92680363b9db7820a63d5e3d15dc26ad22))
|
|
94
|
+
|
|
95
|
+
## [2.1.0-alpha.27](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.26...v2.1.0-alpha.27) (2024-05-29)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
### Bug Fixes
|
|
99
|
+
|
|
100
|
+
* coinbase connection ([#5764](https://github.com/dynamic-labs/DynamicAuth/issues/5764)) ([aeacd1c](https://github.com/dynamic-labs/DynamicAuth/commit/aeacd1c55dc471fbf8c14eb05ab356b0a90aa239))
|
|
101
|
+
|
|
102
|
+
## [2.1.0-alpha.26](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.25...v2.1.0-alpha.26) (2024-05-29)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
### Features
|
|
106
|
+
|
|
107
|
+
* add farcaster login to react native ([#5713](https://github.com/dynamic-labs/DynamicAuth/issues/5713)) ([08f4473](https://github.com/dynamic-labs/DynamicAuth/commit/08f4473eec9b32b82b6f703fa4d5136514a61b25))
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
### Bug Fixes
|
|
111
|
+
|
|
112
|
+
* better error handling of invalid mfa otp ([#5759](https://github.com/dynamic-labs/DynamicAuth/issues/5759)) ([72ab01f](https://github.com/dynamic-labs/DynamicAuth/commit/72ab01f8f919f147eeedfabf8b4838802abf308a))
|
|
113
|
+
* show correct status for magic eden btc wallets after ([#5748](https://github.com/dynamic-labs/DynamicAuth/issues/5748)) ([b8f20bb](https://github.com/dynamic-labs/DynamicAuth/commit/b8f20bb796b9a2e88817ef3b0da6ac32e9012b18))
|
|
114
|
+
|
|
115
|
+
## [2.1.0-alpha.25](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.24...v2.1.0-alpha.25) (2024-05-27)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
### Bug Fixes
|
|
119
|
+
|
|
120
|
+
* btc balance calculation ([#5737](https://github.com/dynamic-labs/DynamicAuth/issues/5737)) ([9b5ceb3](https://github.com/dynamic-labs/DynamicAuth/commit/9b5ceb32d543037f60d7104f0b81b3abc86ebd10))
|
|
121
|
+
|
|
122
|
+
## [2.1.0-alpha.24](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.23...v2.1.0-alpha.24) (2024-05-26)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
### Features
|
|
126
|
+
|
|
127
|
+
* add onMfaCompleteOnce to useMfa ([#5702](https://github.com/dynamic-labs/DynamicAuth/issues/5702)) ([6451e33](https://github.com/dynamic-labs/DynamicAuth/commit/6451e3369ef1b4ba116378f0dd3fe4e82007e670))
|
|
128
|
+
* prompt custom fields during onboarding ([#5302](https://github.com/dynamic-labs/DynamicAuth/issues/5302)) ([8664223](https://github.com/dynamic-labs/DynamicAuth/commit/86642232cf2b490a820169f48ba8dc093010e1a0))
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
### Bug Fixes
|
|
132
|
+
|
|
133
|
+
* correct text on pending signature screen to match the embedded widget modal text ([#5707](https://github.com/dynamic-labs/DynamicAuth/issues/5707)) ([44a6a06](https://github.com/dynamic-labs/DynamicAuth/commit/44a6a0664e08d4b9fc25dd86c0e30f8d585558e0))
|
|
134
|
+
* pass captcha token for farcaster login ([#5706](https://github.com/dynamic-labs/DynamicAuth/issues/5706)) ([32bcb6e](https://github.com/dynamic-labs/DynamicAuth/commit/32bcb6e0e06c6e273c07f32893dfd550deeb6a19))
|
|
135
|
+
* use coinbase provider to get connected accounts for consistency ([#5711](https://github.com/dynamic-labs/DynamicAuth/issues/5711)) ([b9e9170](https://github.com/dynamic-labs/DynamicAuth/commit/b9e9170dad1ac27a85a44a7177b82055ce0035cb))
|
|
136
|
+
|
|
137
|
+
## [2.1.0-alpha.23](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.22...v2.1.0-alpha.23) (2024-05-23)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
### Features
|
|
141
|
+
|
|
142
|
+
* add authFailure and authInit events ([#5659](https://github.com/dynamic-labs/DynamicAuth/issues/5659)) ([f4f592a](https://github.com/dynamic-labs/DynamicAuth/commit/f4f592aaacd96fae9333b803c235c5f1fea0e20e))
|
|
143
|
+
* prompt mfa on signup and signin ([#5599](https://github.com/dynamic-labs/DynamicAuth/issues/5599)) ([8d4ecf4](https://github.com/dynamic-labs/DynamicAuth/commit/8d4ecf4c69c59c1fb14e79511fb2f9b33a7e3d89))
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
### Bug Fixes
|
|
147
|
+
|
|
148
|
+
* close auth modal if create embedded wallet throws ([#5683](https://github.com/dynamic-labs/DynamicAuth/issues/5683)) ([5331d73](https://github.com/dynamic-labs/DynamicAuth/commit/5331d731a171bb52a598eb5b25f7ba80cef7a64c))
|
|
149
|
+
* prevent state update when the webview is unmounted ([#5688](https://github.com/dynamic-labs/DynamicAuth/issues/5688)) ([8e4ecbd](https://github.com/dynamic-labs/DynamicAuth/commit/8e4ecbdcdb5f48c57ecaad90d663c66529013192))
|
|
150
|
+
* show phone number in use error message ([#5681](https://github.com/dynamic-labs/DynamicAuth/issues/5681)) ([e62f7b7](https://github.com/dynamic-labs/DynamicAuth/commit/e62f7b7b6a5e217944346faf2410028433cecad4))
|
|
151
|
+
|
|
152
|
+
## [2.1.0-alpha.22](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.21...v2.1.0-alpha.22) (2024-05-21)
|
|
153
|
+
|
|
154
|
+
## [2.1.0-alpha.21](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.20...v2.1.0-alpha.21) (2024-05-21)
|
|
155
|
+
|
|
156
|
+
## [2.1.0-alpha.20](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.19...v2.1.0-alpha.20) (2024-05-21)
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
### Features
|
|
160
|
+
|
|
161
|
+
* adds client.networks module ([#5650](https://github.com/dynamic-labs/DynamicAuth/issues/5650)) ([70f7fe5](https://github.com/dynamic-labs/DynamicAuth/commit/70f7fe5f437756c51e787ac12183be0a23c51b89))
|
|
162
|
+
* user fields supports custom fields ([#5639](https://github.com/dynamic-labs/DynamicAuth/issues/5639)) ([8eb5788](https://github.com/dynamic-labs/DynamicAuth/commit/8eb5788fc3e1286929f5949ecb57736b21b13fb5))
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
### Bug Fixes
|
|
166
|
+
|
|
167
|
+
* add webcredentials to expo ([#5640](https://github.com/dynamic-labs/DynamicAuth/issues/5640)) ([9026fbf](https://github.com/dynamic-labs/DynamicAuth/commit/9026fbf0108537e884588f3adcdb9f0db04a159b))
|
|
168
|
+
* init ethers web3provider without a network if selected network is unsupported ([#5651](https://github.com/dynamic-labs/DynamicAuth/issues/5651)) ([e82040f](https://github.com/dynamic-labs/DynamicAuth/commit/e82040f424b17a70fac4400ab5b85a0dc6c0e35a))
|
|
169
|
+
|
|
170
|
+
## [2.1.0-alpha.19](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.18...v2.1.0-alpha.19) (2024-05-17)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
### Features
|
|
174
|
+
|
|
175
|
+
* add createUserProfileFromSDKUser ([#5596](https://github.com/dynamic-labs/DynamicAuth/issues/5596)) ([d37a1b4](https://github.com/dynamic-labs/DynamicAuth/commit/d37a1b4119f5ff4fff1e987d157f6d5abf105a8b))
|
|
176
|
+
* add headless social sign-in ([#5439](https://github.com/dynamic-labs/DynamicAuth/issues/5439)) ([e32fdf8](https://github.com/dynamic-labs/DynamicAuth/commit/e32fdf863718d661b90b592c8df734e92386ddf3))
|
|
177
|
+
* fetch custom fields in profile and update user ([#5627](https://github.com/dynamic-labs/DynamicAuth/issues/5627)) ([3940c25](https://github.com/dynamic-labs/DynamicAuth/commit/3940c2542bb330f3ed9a8eb98eed9d05c8fcb03a))
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
### Bug Fixes
|
|
181
|
+
|
|
182
|
+
* include applinks details to AASA ([#5635](https://github.com/dynamic-labs/DynamicAuth/issues/5635)) ([ce94fec](https://github.com/dynamic-labs/DynamicAuth/commit/ce94fec80adbb3eb4efcb79d1aa2cc6eb35eab6f))
|
|
183
|
+
* include the appOrigin to every api call to create correct passkey ([#5636](https://github.com/dynamic-labs/DynamicAuth/issues/5636)) ([ee64df3](https://github.com/dynamic-labs/DynamicAuth/commit/ee64df3b90037bd29cca161e601973ef202c58f0))
|
|
184
|
+
* use PromptModal when using the DynamicMultiWalletPromptsWidget for pending connection views ([#5594](https://github.com/dynamic-labs/DynamicAuth/issues/5594)) ([c095b6e](https://github.com/dynamic-labs/DynamicAuth/commit/c095b6e4c974f02cfe632963be92d16bb201dfa5))
|
|
185
|
+
|
|
186
|
+
## [2.1.0-alpha.18](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.17...v2.1.0-alpha.18) (2024-05-15)
|
|
187
|
+
|
|
188
|
+
## [2.1.0-alpha.17](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.16...v2.1.0-alpha.17) (2024-05-15)
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
### Features
|
|
192
|
+
|
|
193
|
+
* add coinbaseWalletPreference prop ([#5607](https://github.com/dynamic-labs/DynamicAuth/issues/5607)) ([1ac3b2c](https://github.com/dynamic-labs/DynamicAuth/commit/1ac3b2ce7abb136465f4aa88b045dfb70d99aad7))
|
|
194
|
+
|
|
195
|
+
## [2.1.0-alpha.16](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.15...v2.1.0-alpha.16) (2024-05-14)
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
### Features
|
|
199
|
+
|
|
200
|
+
* add client.sdk.error with errors from the webview ([#5520](https://github.com/dynamic-labs/DynamicAuth/issues/5520)) ([a886927](https://github.com/dynamic-labs/DynamicAuth/commit/a8869273bf361c870d6e3cb82a28d9ccec65905b))
|
|
201
|
+
* add setDefaultTabIndex to default the selected wallets tab ([#5593](https://github.com/dynamic-labs/DynamicAuth/issues/5593)) ([6e8ce05](https://github.com/dynamic-labs/DynamicAuth/commit/6e8ce053c4f6f009acc57dac55a8e9c74fbcc73b))
|
|
202
|
+
* add visibility/auth-flow/user-profile to react-native ([#5564](https://github.com/dynamic-labs/DynamicAuth/issues/5564)) ([d93cea8](https://github.com/dynamic-labs/DynamicAuth/commit/d93cea82a123c6ec4d3d594a7dc064f4db2981c2))
|
|
203
|
+
|
|
204
|
+
## [2.1.0-alpha.15](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.14...v2.1.0-alpha.15) (2024-05-13)
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
### Bug Fixes
|
|
208
|
+
|
|
209
|
+
* when a pregen is created, primaryWallet is not being setup ([#5584](https://github.com/dynamic-labs/DynamicAuth/issues/5584)) ([de08721](https://github.com/dynamic-labs/DynamicAuth/commit/de0872151e09f91dcbfaf1d043cf830f9df8d799))
|
|
210
|
+
|
|
211
|
+
## [2.1.0-alpha.14](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.13...v2.1.0-alpha.14) (2024-05-09)
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
### Features
|
|
215
|
+
|
|
216
|
+
* add useSwitchWallet ([#5575](https://github.com/dynamic-labs/DynamicAuth/issues/5575)) ([d3053d9](https://github.com/dynamic-labs/DynamicAuth/commit/d3053d920110c26ef8052e77bf59e07dedc7c683))
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
### Bug Fixes
|
|
220
|
+
|
|
221
|
+
* linking phantom wallets in mobile ([#5524](https://github.com/dynamic-labs/DynamicAuth/issues/5524)) ([28d90f5](https://github.com/dynamic-labs/DynamicAuth/commit/28d90f5126b9c22535b63a3797cc060ef089fc63))
|
|
222
|
+
* only show farcaster QR code if Social Login is enabled ([#5559](https://github.com/dynamic-labs/DynamicAuth/issues/5559)) ([fa71aaf](https://github.com/dynamic-labs/DynamicAuth/commit/fa71aaf0f80da31d397600b2fd0cbea99b3689a4))
|
|
223
|
+
* remove goerli testnets and add sepolia ([#5565](https://github.com/dynamic-labs/DynamicAuth/issues/5565)) ([888eb03](https://github.com/dynamic-labs/DynamicAuth/commit/888eb031ef6f4dbbdc3015265cce8647d2c720b0))
|
|
224
|
+
|
|
225
|
+
## [2.1.0-alpha.13](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.12...v2.1.0-alpha.13) (2024-05-03)
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
### Bug Fixes
|
|
229
|
+
|
|
230
|
+
* ensure Farcaster QR uses useSocialAuth hook ([#5550](https://github.com/dynamic-labs/DynamicAuth/issues/5550)) ([57fcd97](https://github.com/dynamic-labs/DynamicAuth/commit/57fcd97c44e3f52065dcf856acf7bca7b24fabc7))
|
|
231
|
+
|
|
232
|
+
## [2.1.0-alpha.12](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.11...v2.1.0-alpha.12) (2024-05-02)
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
### Features
|
|
236
|
+
|
|
237
|
+
* display Farcaster QR code when it is the only login option ([#5514](https://github.com/dynamic-labs/DynamicAuth/issues/5514)) ([7b166d9](https://github.com/dynamic-labs/DynamicAuth/commit/7b166d9a30c581746f0e2edb71c44fc015dc128e))
|
|
238
|
+
|
|
239
|
+
## [2.1.0-alpha.11](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.10...v2.1.0-alpha.11) (2024-05-02)
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
### Features
|
|
243
|
+
|
|
244
|
+
* **GVTY-1050:** add account token balances hook ([#5521](https://github.com/dynamic-labs/DynamicAuth/issues/5521)) ([5a6f937](https://github.com/dynamic-labs/DynamicAuth/commit/5a6f93733019f3b8d5c7a2c7a5537172a1e7eba4))
|
|
245
|
+
* headless reveal embedded wallet key ([#5518](https://github.com/dynamic-labs/DynamicAuth/issues/5518)) ([77c1536](https://github.com/dynamic-labs/DynamicAuth/commit/77c15360b2b28c52cbdeafb3ce8ca7e80dbecf57))
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
### Bug Fixes
|
|
249
|
+
|
|
250
|
+
* fallback to walletconnect for zerion on mobile ([#5536](https://github.com/dynamic-labs/DynamicAuth/issues/5536)) ([f0e5bfe](https://github.com/dynamic-labs/DynamicAuth/commit/f0e5bfea0b2ab271fd4c1475c8ce708ecb1a5926))
|
|
251
|
+
|
|
252
|
+
## [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)
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
### Features
|
|
256
|
+
|
|
257
|
+
* 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))
|
|
258
|
+
|
|
2
259
|
## [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)
|
|
3
260
|
|
|
4
261
|
|
package/_virtual/_tslib.cjs
CHANGED
|
@@ -18,6 +18,18 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
18
18
|
PERFORMANCE OF THIS SOFTWARE.
|
|
19
19
|
***************************************************************************** */
|
|
20
20
|
|
|
21
|
+
function __rest(s, e) {
|
|
22
|
+
var t = {};
|
|
23
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
24
|
+
t[p] = s[p];
|
|
25
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
26
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
27
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
28
|
+
t[p[i]] = s[p[i]];
|
|
29
|
+
}
|
|
30
|
+
return t;
|
|
31
|
+
}
|
|
32
|
+
|
|
21
33
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
22
34
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
35
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -34,3 +46,4 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
34
46
|
};
|
|
35
47
|
|
|
36
48
|
exports.__awaiter = __awaiter;
|
|
49
|
+
exports.__rest = __rest;
|
package/_virtual/_tslib.js
CHANGED
|
@@ -14,6 +14,18 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
15
|
***************************************************************************** */
|
|
16
16
|
|
|
17
|
+
function __rest(s, e) {
|
|
18
|
+
var t = {};
|
|
19
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
20
|
+
t[p] = s[p];
|
|
21
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
22
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
23
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
24
|
+
t[p[i]] = s[p[i]];
|
|
25
|
+
}
|
|
26
|
+
return t;
|
|
27
|
+
}
|
|
28
|
+
|
|
17
29
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
18
30
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
31
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -29,4 +41,4 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
29
41
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
30
42
|
};
|
|
31
43
|
|
|
32
|
-
export { __awaiter };
|
|
44
|
+
export { __awaiter, __rest };
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/message-transport",
|
|
3
|
-
"version": "2.1.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
|
-
"url": "https://github.com/dynamic-labs/
|
|
6
|
+
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
7
7
|
"directory": "packages/message-transport"
|
|
8
8
|
},
|
|
9
9
|
"description": "Defines the interface to communicate with dynamic's webview",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@vue/reactivity": "3.4.21",
|
|
30
|
-
"@dynamic-labs/types": "2.1.0
|
|
30
|
+
"@dynamic-labs/types": "2.1.0",
|
|
31
31
|
"eventemitter3": "5.0.1"
|
|
32
32
|
}
|
|
33
33
|
}
|
package/src/index.cjs
CHANGED
|
@@ -8,7 +8,9 @@ var applyDefaultMessageOrigin = require('./messageTransport/decorators/applyDefa
|
|
|
8
8
|
var makeWaitForInitEvent = require('./messageTransport/decorators/makeWaitForInitEvent/makeWaitForInitEvent.cjs');
|
|
9
9
|
var makeWaitForUnblock = require('./messageTransport/decorators/makeWaitForUnblock/makeWaitForUnblock.cjs');
|
|
10
10
|
var requestChannel = require('./requestChannel/requestChannel.cjs');
|
|
11
|
+
var parseErrorFromTransport = require('./utils/parseErrorFromTransport/parseErrorFromTransport.cjs');
|
|
11
12
|
var parseMessageTransportData = require('./utils/parseMessageTransportData/parseMessageTransportData.cjs');
|
|
13
|
+
var serializeErrorForTransport = require('./utils/serializeErrorForTransport/serializeErrorForTransport.cjs');
|
|
12
14
|
var createEventEmitterForMessages = require('./store/createEventEmitterForMessages/createEventEmitterForMessages.cjs');
|
|
13
15
|
var store = require('./store/store.cjs');
|
|
14
16
|
var storeSetter = require('./store/storeSetter/storeSetter.cjs');
|
|
@@ -21,7 +23,9 @@ exports.applyDefaultMessageOrigin = applyDefaultMessageOrigin.applyDefaultMessag
|
|
|
21
23
|
exports.makeWaitForInitEvent = makeWaitForInitEvent.makeWaitForInitEvent;
|
|
22
24
|
exports.makeWaitForUnblock = makeWaitForUnblock.makeWaitForUnblock;
|
|
23
25
|
exports.createRequestChannel = requestChannel.createRequestChannel;
|
|
26
|
+
exports.parseErrorFromTransport = parseErrorFromTransport.parseErrorFromTransport;
|
|
24
27
|
exports.parseMessageTransportData = parseMessageTransportData.parseMessageTransportData;
|
|
28
|
+
exports.serializeErrorForTransport = serializeErrorForTransport.serializeErrorForTransport;
|
|
25
29
|
exports.createEventEmitterForMessages = createEventEmitterForMessages.createEventEmitterForMessages;
|
|
26
30
|
exports.createStore = store.createStore;
|
|
27
31
|
exports.createStoreSetter = storeSetter.createStoreSetter;
|
package/src/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { applyDefaultMessageOrigin, createMessageTransport, makeWaitForInitEvent, makeWaitForUnblock, type BypassBlockCallback, type MessageTransport, type MessageTransportCallback, type MessageTransportData, type MessageTransportDataOptionalOrigin, type MessageTransportWithDefaultOrigin, } from './messageTransport';
|
|
2
2
|
export { createRequestChannel, type RequestChannel } from './requestChannel';
|
|
3
|
+
export { parseErrorFromTransport } from './utils/parseErrorFromTransport';
|
|
3
4
|
export { parseMessageTransportData } from './utils/parseMessageTransportData';
|
|
5
|
+
export { serializeErrorForTransport } from './utils/serializeErrorForTransport';
|
|
4
6
|
export { createEventEmitterForMessages, createStore, createStoreSetter, type MessagesForEventEmitter, } from './store';
|
|
5
|
-
export type { Store, StoreKeys, StoreSetter, StoreStateEvents, StoreStateGetters,
|
|
6
|
-
export { sdkHasLoadedEventName, type AuthModuleMessages, type AuthModuleState, type ClientManifest, type OtpMessages, type SdkModuleMessages, type SdkModuleState, type WalletsModuleState, } from './messageTypes';
|
|
7
|
+
export type { Store, StoreEventListeners, StoreKeys, StoreSetter, StoreStateEvents, StoreStateGetters, } from './store/types';
|
|
8
|
+
export { sdkHasLoadedEventName, type AuthModuleMessages, type AuthModuleState, type ClientManifest, type ConsoleMessages, type EmbeddedWalletsModuleMessages, type EmbeddedWalletsModuleState, type EthMessages, type FetchMessages, type NetworksModuleState, type OtpMessages, type PasskeyMessages, type PlatformServiceMessages, type SdkModuleMessages, type SdkModuleState, type SocialAuthModuleMessages, type SocialProvider, type UserInterfaceModuleMessages, type WalletsModuleMessages, type WalletsModuleState, type WebViewVisibilityMessages, } from './messageTypes';
|
package/src/index.js
CHANGED
|
@@ -4,7 +4,9 @@ export { applyDefaultMessageOrigin } from './messageTransport/decorators/applyDe
|
|
|
4
4
|
export { makeWaitForInitEvent } from './messageTransport/decorators/makeWaitForInitEvent/makeWaitForInitEvent.js';
|
|
5
5
|
export { makeWaitForUnblock } from './messageTransport/decorators/makeWaitForUnblock/makeWaitForUnblock.js';
|
|
6
6
|
export { createRequestChannel } from './requestChannel/requestChannel.js';
|
|
7
|
+
export { parseErrorFromTransport } from './utils/parseErrorFromTransport/parseErrorFromTransport.js';
|
|
7
8
|
export { parseMessageTransportData } from './utils/parseMessageTransportData/parseMessageTransportData.js';
|
|
9
|
+
export { serializeErrorForTransport } from './utils/serializeErrorForTransport/serializeErrorForTransport.js';
|
|
8
10
|
export { createEventEmitterForMessages } from './store/createEventEmitterForMessages/createEventEmitterForMessages.js';
|
|
9
11
|
export { createStore } from './store/store.js';
|
|
10
12
|
export { createStoreSetter } from './store/storeSetter/storeSetter.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SerializedError } from '../utils/serializeErrorForTransport';
|
|
2
|
+
export type ConsoleMessages = {
|
|
3
|
+
error: (serializedError: SerializedError, props: {
|
|
4
|
+
/**
|
|
5
|
+
* Describes the severity of the error sent to the host.
|
|
6
|
+
* fatal: The error has not been handled and the SDK is unusable.
|
|
7
|
+
* log-only: The error has been handled but should still be logged.
|
|
8
|
+
*/
|
|
9
|
+
severity: 'fatal' | 'log-only';
|
|
10
|
+
}) => void;
|
|
11
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
type CustomPublicKeyCredentialUserEntity = Omit<PublicKeyCredentialUserEntity, 'id'> & {
|
|
2
|
+
id: string;
|
|
3
|
+
};
|
|
4
|
+
type CustomPublicKeyCredentialRpEntity = Omit<PublicKeyCredentialRpEntity, 'id'> & {
|
|
5
|
+
id: string;
|
|
6
|
+
};
|
|
7
|
+
export type PasskeyMessages = {
|
|
8
|
+
createPasskey: (params: {
|
|
9
|
+
publicKey: {
|
|
10
|
+
authenticatorName: string;
|
|
11
|
+
attestation?: AttestationConveyancePreference;
|
|
12
|
+
authenticatorSelection?: AuthenticatorSelectionCriteria;
|
|
13
|
+
challenge?: string;
|
|
14
|
+
pubKeyCredParams: PublicKeyCredentialParameters[];
|
|
15
|
+
rp: CustomPublicKeyCredentialRpEntity;
|
|
16
|
+
timeout?: number;
|
|
17
|
+
user: CustomPublicKeyCredentialUserEntity;
|
|
18
|
+
};
|
|
19
|
+
}) => Promise<{
|
|
20
|
+
attestation: {
|
|
21
|
+
credentialId: string;
|
|
22
|
+
clientDataJson: string;
|
|
23
|
+
attestationObject: string;
|
|
24
|
+
transports: ('AUTHENTICATOR_TRANSPORT_BLE' | 'AUTHENTICATOR_TRANSPORT_INTERNAL' | 'AUTHENTICATOR_TRANSPORT_NFC' | 'AUTHENTICATOR_TRANSPORT_USB' | 'AUTHENTICATOR_TRANSPORT_HYBRID')[];
|
|
25
|
+
};
|
|
26
|
+
}>;
|
|
27
|
+
passkeyStamp: (rdId: string, payload: string) => Promise<{
|
|
28
|
+
stampHeaderName: string;
|
|
29
|
+
stampHeaderValue: string;
|
|
30
|
+
}>;
|
|
31
|
+
};
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type PlatformServiceMessages = {
|
|
2
|
+
/**
|
|
3
|
+
* Origin: Webview.
|
|
4
|
+
* Requests that a deeplink be open by whichever platform the client is running in.
|
|
5
|
+
*/
|
|
6
|
+
openURL: (url: string) => Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* Origin: Webview.
|
|
9
|
+
* Requests that a deeplink be open in a new page by whichever platform the client is running in.
|
|
10
|
+
*/
|
|
11
|
+
openNewWindow: (url: string) => Promise<void>;
|
|
12
|
+
};
|
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
* inside the webview
|
|
4
4
|
*/
|
|
5
5
|
export type ClientManifest = {
|
|
6
|
-
environmentId: string;
|
|
7
|
-
clientVersion: string;
|
|
8
6
|
apiBaseUrl?: string;
|
|
9
|
-
appName?: string;
|
|
10
7
|
appLogoUrl?: string;
|
|
8
|
+
appName?: string;
|
|
9
|
+
appOrigin?: string;
|
|
10
|
+
clientVersion: string;
|
|
11
11
|
cssOverrides?: string;
|
|
12
|
+
environmentId: string;
|
|
13
|
+
platform: 'browser' | 'react-native';
|
|
12
14
|
};
|
|
13
15
|
export type SdkModuleState = {
|
|
14
16
|
/** Indicates the SDK is set up and ready for requests */
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type SocialProvider = 'apple' | 'coinbaseSocial' | 'discord' | 'facebook' | 'farcaster' | 'github' | 'google' | 'twitch' | 'twitter';
|
|
2
|
+
export type SocialAuthModuleMessages = {
|
|
3
|
+
connectWithSocial: (args: {
|
|
4
|
+
provider: SocialProvider;
|
|
5
|
+
}) => Promise<void>;
|
|
6
|
+
/**
|
|
7
|
+
* Temporary — requests the URL to use to deeplink back to the app.
|
|
8
|
+
*
|
|
9
|
+
* This won't be safe for use with oauth2, so we need to replace this by asking the app URL
|
|
10
|
+
* in the dashboard before social connections are allowed.
|
|
11
|
+
*/
|
|
12
|
+
getRedirectUrl: () => Promise<string>;
|
|
13
|
+
};
|
|
@@ -3,3 +3,25 @@ export type WalletsModuleState = {
|
|
|
3
3
|
userWallets: BaseWallet[];
|
|
4
4
|
primary: BaseWallet | undefined;
|
|
5
5
|
};
|
|
6
|
+
export type WalletsModuleMessages = {
|
|
7
|
+
getBalance: (params: {
|
|
8
|
+
wallet: BaseWallet;
|
|
9
|
+
}) => Promise<{
|
|
10
|
+
balance: string;
|
|
11
|
+
}>;
|
|
12
|
+
signMessage: (params: {
|
|
13
|
+
wallet: BaseWallet;
|
|
14
|
+
message: string;
|
|
15
|
+
}) => Promise<{
|
|
16
|
+
signedMessage: string;
|
|
17
|
+
}>;
|
|
18
|
+
getNetwork: (params: {
|
|
19
|
+
wallet: BaseWallet;
|
|
20
|
+
}) => Promise<{
|
|
21
|
+
network: string | number;
|
|
22
|
+
}>;
|
|
23
|
+
switchNetwork: (params: {
|
|
24
|
+
wallet: BaseWallet;
|
|
25
|
+
chainId: string | number;
|
|
26
|
+
}) => Promise<void>;
|
|
27
|
+
};
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
export * from './AuthModuleMessages';
|
|
2
|
+
export * from './ConsoleMessages';
|
|
3
|
+
export * from './EmbeddedWalletsModuleMessages';
|
|
4
|
+
export * from './EthMessages';
|
|
5
|
+
export * from './FetchMessages';
|
|
6
|
+
export * from './NetworksModuleMessages';
|
|
2
7
|
export * from './OtpMessages';
|
|
8
|
+
export * from './PasskeyMessages';
|
|
9
|
+
export * from './PlatformServiceMessages';
|
|
3
10
|
export * from './SdkModuleMessages';
|
|
11
|
+
export * from './SocialAuthModuleMessages';
|
|
12
|
+
export * from './UserInterfaceModuleMessages';
|
|
4
13
|
export * from './WalletsModuleMessages';
|
|
14
|
+
export * from './WebViewVisibilityMessages';
|
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
7
|
+
var parseErrorFromTransport = require('../utils/parseErrorFromTransport/parseErrorFromTransport.cjs');
|
|
8
|
+
var serializeErrorForTransport = require('../utils/serializeErrorForTransport/serializeErrorForTransport.cjs');
|
|
9
|
+
var isSerializedError = require('../utils/isSerializedError/isSerializedError.cjs');
|
|
7
10
|
|
|
8
11
|
/** Given a request event name, returns the event name for its resolve */
|
|
9
12
|
const getResolveMessageType = (type) => `${type}__resolve`;
|
|
@@ -65,7 +68,7 @@ const createRequestChannel = (messageTransport) => {
|
|
|
65
68
|
}
|
|
66
69
|
catch (error) {
|
|
67
70
|
messageTransport.emit({
|
|
68
|
-
args: [error],
|
|
71
|
+
args: [serializeErrorForTransport.serializeErrorForTransport(error)],
|
|
69
72
|
messageSessionId,
|
|
70
73
|
type: getRejectMessageType(requestType),
|
|
71
74
|
});
|
|
@@ -92,7 +95,12 @@ const createRequestChannel = (messageTransport) => {
|
|
|
92
95
|
cleanup();
|
|
93
96
|
}
|
|
94
97
|
if (incomingType === rejectMessageType) {
|
|
95
|
-
|
|
98
|
+
if (isSerializedError.isSerializedError(result)) {
|
|
99
|
+
reject(parseErrorFromTransport.parseErrorFromTransport(result));
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
reject(result);
|
|
103
|
+
}
|
|
96
104
|
cleanup();
|
|
97
105
|
}
|
|
98
106
|
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
3
|
+
import { parseErrorFromTransport } from '../utils/parseErrorFromTransport/parseErrorFromTransport.js';
|
|
4
|
+
import { serializeErrorForTransport } from '../utils/serializeErrorForTransport/serializeErrorForTransport.js';
|
|
5
|
+
import { isSerializedError } from '../utils/isSerializedError/isSerializedError.js';
|
|
3
6
|
|
|
4
7
|
/** Given a request event name, returns the event name for its resolve */
|
|
5
8
|
const getResolveMessageType = (type) => `${type}__resolve`;
|
|
@@ -61,7 +64,7 @@ const createRequestChannel = (messageTransport) => {
|
|
|
61
64
|
}
|
|
62
65
|
catch (error) {
|
|
63
66
|
messageTransport.emit({
|
|
64
|
-
args: [error],
|
|
67
|
+
args: [serializeErrorForTransport(error)],
|
|
65
68
|
messageSessionId,
|
|
66
69
|
type: getRejectMessageType(requestType),
|
|
67
70
|
});
|
|
@@ -88,7 +91,12 @@ const createRequestChannel = (messageTransport) => {
|
|
|
88
91
|
cleanup();
|
|
89
92
|
}
|
|
90
93
|
if (incomingType === rejectMessageType) {
|
|
91
|
-
|
|
94
|
+
if (isSerializedError(result)) {
|
|
95
|
+
reject(parseErrorFromTransport(result));
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
reject(result);
|
|
99
|
+
}
|
|
92
100
|
cleanup();
|
|
93
101
|
}
|
|
94
102
|
};
|
package/src/store/types.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { isSerializedError } from './isSerializedError';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
const isSerializedError = (serializedError) => {
|
|
7
|
+
if (typeof serializedError !== 'object' || serializedError === null) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
const { message, stack } = serializedError;
|
|
11
|
+
return typeof message === 'string' && typeof stack === 'string';
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.isSerializedError = isSerializedError;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
const isSerializedError = (serializedError) => {
|
|
3
|
+
if (typeof serializedError !== 'object' || serializedError === null) {
|
|
4
|
+
return false;
|
|
5
|
+
}
|
|
6
|
+
const { message, stack } = serializedError;
|
|
7
|
+
return typeof message === 'string' && typeof stack === 'string';
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { isSerializedError };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { parseErrorFromTransport } from './parseErrorFromTransport';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../_virtual/_tslib.cjs');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Parses a serialized error object back into an Error instance.
|
|
10
|
+
* This function will recreate an Error or a specific subclass of Error
|
|
11
|
+
* based on the name property if it matches known error types.
|
|
12
|
+
* Additional properties are added back to the reconstructed error object.
|
|
13
|
+
*
|
|
14
|
+
* @param {SerializedError} serializedError - The serialized error object to parse.
|
|
15
|
+
* @returns {Error} - The reconstructed Error instance.
|
|
16
|
+
*/
|
|
17
|
+
const parseErrorFromTransport = (serializedError) => {
|
|
18
|
+
const { message, name, stack } = serializedError, otherProps = _tslib.__rest(serializedError, ["message", "name", "stack"]);
|
|
19
|
+
let error;
|
|
20
|
+
// Determine the type of the error based on the 'name' property and instantiate accordingly
|
|
21
|
+
switch (name) {
|
|
22
|
+
case 'TypeError':
|
|
23
|
+
error = new TypeError(message);
|
|
24
|
+
break;
|
|
25
|
+
case 'ReferenceError':
|
|
26
|
+
error = new ReferenceError(message);
|
|
27
|
+
break;
|
|
28
|
+
case 'SyntaxError':
|
|
29
|
+
error = new SyntaxError(message);
|
|
30
|
+
break;
|
|
31
|
+
case 'RangeError':
|
|
32
|
+
error = new RangeError(message);
|
|
33
|
+
break;
|
|
34
|
+
case 'EvalError':
|
|
35
|
+
error = new EvalError(message);
|
|
36
|
+
break;
|
|
37
|
+
case 'URIError':
|
|
38
|
+
error = new URIError(message);
|
|
39
|
+
break;
|
|
40
|
+
default:
|
|
41
|
+
// Default to a generic Error if the specific type isn't recognized
|
|
42
|
+
error = new Error(message);
|
|
43
|
+
error.name = name || 'Error'; // Ensure the name is set, defaulting to 'Error' if not provided
|
|
44
|
+
}
|
|
45
|
+
// Reattach the stack trace and any other enumerable properties
|
|
46
|
+
if (stack) {
|
|
47
|
+
error.stack = [message, stack].join('\n');
|
|
48
|
+
}
|
|
49
|
+
// Reattach other custom properties that may have been serialized
|
|
50
|
+
Object.assign(error, otherProps);
|
|
51
|
+
return error;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
exports.parseErrorFromTransport = parseErrorFromTransport;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SerializedError } from '../serializeErrorForTransport';
|
|
2
|
+
/**
|
|
3
|
+
* Parses a serialized error object back into an Error instance.
|
|
4
|
+
* This function will recreate an Error or a specific subclass of Error
|
|
5
|
+
* based on the name property if it matches known error types.
|
|
6
|
+
* Additional properties are added back to the reconstructed error object.
|
|
7
|
+
*
|
|
8
|
+
* @param {SerializedError} serializedError - The serialized error object to parse.
|
|
9
|
+
* @returns {Error} - The reconstructed Error instance.
|
|
10
|
+
*/
|
|
11
|
+
export declare const parseErrorFromTransport: (serializedError: SerializedError) => Error;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __rest } from '../../../_virtual/_tslib.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Parses a serialized error object back into an Error instance.
|
|
6
|
+
* This function will recreate an Error or a specific subclass of Error
|
|
7
|
+
* based on the name property if it matches known error types.
|
|
8
|
+
* Additional properties are added back to the reconstructed error object.
|
|
9
|
+
*
|
|
10
|
+
* @param {SerializedError} serializedError - The serialized error object to parse.
|
|
11
|
+
* @returns {Error} - The reconstructed Error instance.
|
|
12
|
+
*/
|
|
13
|
+
const parseErrorFromTransport = (serializedError) => {
|
|
14
|
+
const { message, name, stack } = serializedError, otherProps = __rest(serializedError, ["message", "name", "stack"]);
|
|
15
|
+
let error;
|
|
16
|
+
// Determine the type of the error based on the 'name' property and instantiate accordingly
|
|
17
|
+
switch (name) {
|
|
18
|
+
case 'TypeError':
|
|
19
|
+
error = new TypeError(message);
|
|
20
|
+
break;
|
|
21
|
+
case 'ReferenceError':
|
|
22
|
+
error = new ReferenceError(message);
|
|
23
|
+
break;
|
|
24
|
+
case 'SyntaxError':
|
|
25
|
+
error = new SyntaxError(message);
|
|
26
|
+
break;
|
|
27
|
+
case 'RangeError':
|
|
28
|
+
error = new RangeError(message);
|
|
29
|
+
break;
|
|
30
|
+
case 'EvalError':
|
|
31
|
+
error = new EvalError(message);
|
|
32
|
+
break;
|
|
33
|
+
case 'URIError':
|
|
34
|
+
error = new URIError(message);
|
|
35
|
+
break;
|
|
36
|
+
default:
|
|
37
|
+
// Default to a generic Error if the specific type isn't recognized
|
|
38
|
+
error = new Error(message);
|
|
39
|
+
error.name = name || 'Error'; // Ensure the name is set, defaulting to 'Error' if not provided
|
|
40
|
+
}
|
|
41
|
+
// Reattach the stack trace and any other enumerable properties
|
|
42
|
+
if (stack) {
|
|
43
|
+
error.stack = [message, stack].join('\n');
|
|
44
|
+
}
|
|
45
|
+
// Reattach other custom properties that may have been serialized
|
|
46
|
+
Object.assign(error, otherProps);
|
|
47
|
+
return error;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export { parseErrorFromTransport };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { serializeErrorForTransport, type SerializedError, } from './serializeErrorForTransport';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Serializes an error to a JSON object to be sent by transport.
|
|
8
|
+
* This function checks if the input is an instance of Error to capture
|
|
9
|
+
* standard properties like message, name, and stack. It also attempts to
|
|
10
|
+
* serialize any enumerable properties that are present on error-like objects.
|
|
11
|
+
*
|
|
12
|
+
* @param {unknown} err - The error or error-like object to serialize.
|
|
13
|
+
* @returns {SerializedError} - The serialized error object.
|
|
14
|
+
*/
|
|
15
|
+
const serializeErrorForTransport = (err) => {
|
|
16
|
+
if (err instanceof Error) {
|
|
17
|
+
return Object.assign({
|
|
18
|
+
// @ts-expect-error message is a standard property of Error
|
|
19
|
+
message: err.message,
|
|
20
|
+
// @ts-expect-error name is a standard property of Error
|
|
21
|
+
name: err.name, stack: err.stack }, err);
|
|
22
|
+
}
|
|
23
|
+
else if (typeof err === 'object' && err !== null) {
|
|
24
|
+
const plainObject = {};
|
|
25
|
+
for (const [key, value] of Object.entries(err)) {
|
|
26
|
+
plainObject[key] = value;
|
|
27
|
+
}
|
|
28
|
+
return plainObject;
|
|
29
|
+
}
|
|
30
|
+
return { message: String(err) };
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.serializeErrorForTransport = serializeErrorForTransport;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines the shape of a serialized error object.
|
|
3
|
+
*/
|
|
4
|
+
export type SerializedError = {
|
|
5
|
+
message?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
stack?: string;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Serializes an error to a JSON object to be sent by transport.
|
|
12
|
+
* This function checks if the input is an instance of Error to capture
|
|
13
|
+
* standard properties like message, name, and stack. It also attempts to
|
|
14
|
+
* serialize any enumerable properties that are present on error-like objects.
|
|
15
|
+
*
|
|
16
|
+
* @param {unknown} err - The error or error-like object to serialize.
|
|
17
|
+
* @returns {SerializedError} - The serialized error object.
|
|
18
|
+
*/
|
|
19
|
+
export declare const serializeErrorForTransport: (err: unknown) => SerializedError;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
/**
|
|
3
|
+
* Serializes an error to a JSON object to be sent by transport.
|
|
4
|
+
* This function checks if the input is an instance of Error to capture
|
|
5
|
+
* standard properties like message, name, and stack. It also attempts to
|
|
6
|
+
* serialize any enumerable properties that are present on error-like objects.
|
|
7
|
+
*
|
|
8
|
+
* @param {unknown} err - The error or error-like object to serialize.
|
|
9
|
+
* @returns {SerializedError} - The serialized error object.
|
|
10
|
+
*/
|
|
11
|
+
const serializeErrorForTransport = (err) => {
|
|
12
|
+
if (err instanceof Error) {
|
|
13
|
+
return Object.assign({
|
|
14
|
+
// @ts-expect-error message is a standard property of Error
|
|
15
|
+
message: err.message,
|
|
16
|
+
// @ts-expect-error name is a standard property of Error
|
|
17
|
+
name: err.name, stack: err.stack }, err);
|
|
18
|
+
}
|
|
19
|
+
else if (typeof err === 'object' && err !== null) {
|
|
20
|
+
const plainObject = {};
|
|
21
|
+
for (const [key, value] of Object.entries(err)) {
|
|
22
|
+
plainObject[key] = value;
|
|
23
|
+
}
|
|
24
|
+
return plainObject;
|
|
25
|
+
}
|
|
26
|
+
return { message: String(err) };
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { serializeErrorForTransport };
|