@turnkey/react-wallet-kit 1.0.0-beta.2 → 1.0.0-beta.5
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/README.MD +2 -1
- package/dist/components/auth/Wallet.js +3 -3
- package/dist/components/auth/Wallet.js.map +1 -1
- package/dist/components/auth/Wallet.mjs +6 -6
- package/dist/components/auth/Wallet.mjs.map +1 -1
- package/dist/components/export/Export.d.ts +2 -2
- package/dist/components/export/Export.d.ts.map +1 -1
- package/dist/components/export/Export.js +10 -3
- package/dist/components/export/Export.js.map +1 -1
- package/dist/components/export/Export.mjs +11 -4
- package/dist/components/export/Export.mjs.map +1 -1
- package/dist/components/export/ExportWarning.d.ts +2 -2
- package/dist/components/export/ExportWarning.d.ts.map +1 -1
- package/dist/components/export/ExportWarning.js +54 -14
- package/dist/components/export/ExportWarning.js.map +1 -1
- package/dist/components/export/ExportWarning.mjs +73 -22
- package/dist/components/export/ExportWarning.mjs.map +1 -1
- package/dist/components/import/Import.d.ts +0 -4
- package/dist/components/import/Import.d.ts.map +1 -1
- package/dist/components/import/Import.js +0 -5
- package/dist/components/import/Import.js.map +1 -1
- package/dist/components/import/Import.mjs +1 -6
- package/dist/components/import/Import.mjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/providers/TurnkeyProvider.d.ts +1 -0
- package/dist/providers/TurnkeyProvider.d.ts.map +1 -1
- package/dist/providers/TurnkeyProvider.js +1 -0
- package/dist/providers/TurnkeyProvider.js.map +1 -1
- package/dist/providers/TurnkeyProvider.mjs +1 -0
- package/dist/providers/TurnkeyProvider.mjs.map +1 -1
- package/dist/providers/client/Hook.d.ts +1 -0
- package/dist/providers/client/Hook.d.ts.map +1 -1
- package/dist/providers/client/Hook.js +1 -0
- package/dist/providers/client/Hook.js.map +1 -1
- package/dist/providers/client/Hook.mjs +1 -0
- package/dist/providers/client/Hook.mjs.map +1 -1
- package/dist/providers/client/Provider.d.ts.map +1 -1
- package/dist/providers/client/Provider.js +428 -290
- package/dist/providers/client/Provider.js.map +1 -1
- package/dist/providers/client/Provider.mjs +2006 -1818
- package/dist/providers/client/Provider.mjs.map +1 -1
- package/dist/providers/client/Types.d.ts +96 -45
- package/dist/providers/client/Types.d.ts.map +1 -1
- package/dist/providers/client/Types.js +1 -0
- package/dist/providers/client/Types.js.map +1 -1
- package/dist/providers/client/Types.mjs +1 -0
- package/dist/providers/client/Types.mjs.map +1 -1
- package/dist/providers/modal/Hook.d.ts +1 -0
- package/dist/providers/modal/Hook.d.ts.map +1 -1
- package/dist/providers/modal/Hook.js +1 -0
- package/dist/providers/modal/Hook.js.map +1 -1
- package/dist/providers/modal/Hook.mjs +1 -0
- package/dist/providers/modal/Hook.mjs.map +1 -1
- package/dist/providers/modal/Root.d.ts.map +1 -1
- package/dist/providers/modal/Root.js +40 -24
- package/dist/providers/modal/Root.js.map +1 -1
- package/dist/providers/modal/Root.mjs +39 -27
- package/dist/providers/modal/Root.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/base.d.ts +59 -1
- package/dist/types/base.d.ts.map +1 -1
- package/dist/types/base.js +13 -0
- package/dist/types/base.js.map +1 -1
- package/dist/types/base.mjs +13 -0
- package/dist/types/base.mjs.map +1 -1
- package/dist/utils.d.ts +1 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +31 -2
- package/dist/utils.js.map +1 -1
- package/dist/utils.mjs +38 -4
- package/dist/utils.mjs.map +1 -1
- package/package.json +12 -4
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { TurnkeySDKClientBase, TurnkeyClientMethods, Wallet, StamperType, WalletAccount } from "@turnkey/core";
|
|
3
3
|
import type { OAuthProviders, Session, v1AddressFormat, v1HashFunction, v1PayloadEncoding, v1SignRawPayloadResult, v1User, v1WalletAccountParams } from "@turnkey/sdk-types";
|
|
4
|
-
import type { TurnkeyProviderConfig,
|
|
4
|
+
import type { TurnkeyProviderConfig, AuthState, ClientState } from "../../types/base";
|
|
5
5
|
export interface ClientContextType extends TurnkeyClientMethods {
|
|
6
|
+
/** @internal */
|
|
6
7
|
httpClient: TurnkeySDKClientBase | undefined;
|
|
8
|
+
/** @internal */
|
|
7
9
|
session: Session | undefined;
|
|
10
|
+
/** @internal */
|
|
8
11
|
allSessions?: Record<string, Session> | undefined;
|
|
12
|
+
/** @internal */
|
|
9
13
|
clientState: ClientState | undefined;
|
|
14
|
+
/** @internal */
|
|
10
15
|
authState: AuthState;
|
|
16
|
+
/** @internal */
|
|
11
17
|
config?: TurnkeyProviderConfig | undefined;
|
|
18
|
+
/** @internal */
|
|
12
19
|
user: v1User | undefined;
|
|
20
|
+
/** @internal */
|
|
13
21
|
wallets: Wallet[];
|
|
14
22
|
/**
|
|
15
23
|
* Refreshes the user details.
|
|
@@ -25,9 +33,9 @@ export interface ClientContextType extends TurnkeyClientMethods {
|
|
|
25
33
|
* @returns A promise that resolves when the user details are successfully refreshed and state is updated.
|
|
26
34
|
* @throws {TurnkeyError} If the client is not initialized or if there is an error refreshing the user details.
|
|
27
35
|
*/
|
|
28
|
-
refreshUser(params?: {
|
|
36
|
+
refreshUser: (params?: {
|
|
29
37
|
stampWith?: StamperType | undefined;
|
|
30
|
-
})
|
|
38
|
+
}) => Promise<void>;
|
|
31
39
|
/**
|
|
32
40
|
* Refreshes the wallets state for the current user session.
|
|
33
41
|
*
|
|
@@ -44,9 +52,9 @@ export interface ClientContextType extends TurnkeyClientMethods {
|
|
|
44
52
|
* @returns A promise that resolves when the wallets are successfully refreshed and state is updated.
|
|
45
53
|
* @throws {TurnkeyError} If the client is not initialized or if there is an error refreshing the wallets.
|
|
46
54
|
*/
|
|
47
|
-
refreshWallets(params?: {
|
|
55
|
+
refreshWallets: (params?: {
|
|
48
56
|
stampWith?: StamperType | undefined;
|
|
49
|
-
})
|
|
57
|
+
}) => Promise<void>;
|
|
50
58
|
/**
|
|
51
59
|
* Handles the login or sign-up flow.
|
|
52
60
|
*
|
|
@@ -58,7 +66,7 @@ export interface ClientContextType extends TurnkeyClientMethods {
|
|
|
58
66
|
*
|
|
59
67
|
* @returns A void promise.
|
|
60
68
|
*/
|
|
61
|
-
handleLogin()
|
|
69
|
+
handleLogin: () => Promise<void>;
|
|
62
70
|
/**
|
|
63
71
|
* Handles the Google OAuth flow.
|
|
64
72
|
*
|
|
@@ -84,7 +92,7 @@ export interface ClientContextType extends TurnkeyClientMethods {
|
|
|
84
92
|
* @returns A promise that resolves when the OAuth flow is successfully initiated and completed, or rejects on error or timeout.
|
|
85
93
|
* @throws {TurnkeyError} If the configuration is not ready, required parameters are missing, or if there is an error initiating or completing the OAuth flow.
|
|
86
94
|
*/
|
|
87
|
-
handleGoogleOauth(params?: {
|
|
95
|
+
handleGoogleOauth: (params?: {
|
|
88
96
|
clientId?: string;
|
|
89
97
|
additionalState?: Record<string, string>;
|
|
90
98
|
openInPage?: boolean;
|
|
@@ -92,7 +100,7 @@ export interface ClientContextType extends TurnkeyClientMethods {
|
|
|
92
100
|
oidcToken: string;
|
|
93
101
|
providerName: string;
|
|
94
102
|
}) => any;
|
|
95
|
-
})
|
|
103
|
+
}) => Promise<void>;
|
|
96
104
|
/**
|
|
97
105
|
* Handles the Apple OAuth flow.
|
|
98
106
|
*
|
|
@@ -118,7 +126,7 @@ export interface ClientContextType extends TurnkeyClientMethods {
|
|
|
118
126
|
* @returns A promise that resolves when the OAuth flow is successfully initiated and completed, or rejects on error or timeout.
|
|
119
127
|
* @throws {TurnkeyError} If the configuration is not ready, required parameters are missing, or if there is an error initiating or completing the OAuth flow.
|
|
120
128
|
*/
|
|
121
|
-
handleAppleOauth(params?: {
|
|
129
|
+
handleAppleOauth: (params?: {
|
|
122
130
|
clientId?: string;
|
|
123
131
|
additionalState?: Record<string, string>;
|
|
124
132
|
openInPage?: boolean;
|
|
@@ -126,7 +134,7 @@ export interface ClientContextType extends TurnkeyClientMethods {
|
|
|
126
134
|
oidcToken: string;
|
|
127
135
|
providerName: string;
|
|
128
136
|
}) => any;
|
|
129
|
-
})
|
|
137
|
+
}) => Promise<void>;
|
|
130
138
|
/**
|
|
131
139
|
* Handles the Facebook OAuth flow.
|
|
132
140
|
*
|
|
@@ -153,7 +161,7 @@ export interface ClientContextType extends TurnkeyClientMethods {
|
|
|
153
161
|
* @returns A promise that resolves when the OAuth flow is successfully initiated and completed, or rejects on error or timeout.
|
|
154
162
|
* @throws {TurnkeyError} If the configuration is not ready, required parameters are missing, or if there is an error initiating or completing the OAuth flow.
|
|
155
163
|
*/
|
|
156
|
-
handleFacebookOauth(params?: {
|
|
164
|
+
handleFacebookOauth: (params?: {
|
|
157
165
|
clientId?: string;
|
|
158
166
|
additionalState?: Record<string, string>;
|
|
159
167
|
openInPage?: boolean;
|
|
@@ -161,33 +169,75 @@ export interface ClientContextType extends TurnkeyClientMethods {
|
|
|
161
169
|
oidcToken: string;
|
|
162
170
|
providerName: string;
|
|
163
171
|
}) => any;
|
|
164
|
-
})
|
|
172
|
+
}) => Promise<void>;
|
|
165
173
|
/**
|
|
166
|
-
* Handles the export flow.
|
|
174
|
+
* Handles the export wallet flow.
|
|
167
175
|
*
|
|
168
|
-
* - This function opens a modal with the ExportComponent for exporting a wallet
|
|
169
|
-
* - Uses Turnkey's export iframe flow to securely export wallet
|
|
176
|
+
* - This function opens a modal with the ExportComponent for exporting a wallet.
|
|
177
|
+
* - Uses Turnkey's export iframe flow to securely export wallet material.
|
|
170
178
|
* - The export process encrypts the exported bundle to a target public key, which is generated and managed inside the iframe for maximum security.
|
|
171
|
-
* - A request is made to the Turnkey API to export the wallet
|
|
179
|
+
* - A request is made to the Turnkey API to export the wallet, encrypted to the target public key.
|
|
172
180
|
* - The resulting export bundle is injected into the iframe, where it is decrypted and displayed to the user.
|
|
173
|
-
* - Supports both full wallet exports (ExportType.Wallet) and single private key exports (ExportType.PrivateKey).
|
|
174
181
|
* - If a custom iframe URL is used, a target public key can be provided explicitly.
|
|
175
182
|
* - Optionally allows specifying the stamper to use for the export (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet) for granular authentication control.
|
|
176
183
|
* - The modal-driven UI ensures the user is guided through the export process and can securely retrieve their exported material.
|
|
177
184
|
*
|
|
178
185
|
* @param params.walletId - The ID of the wallet to export.
|
|
179
|
-
* @param params.exportType - The type of export to perform (ExportType.Wallet or ExportType.PrivateKey).
|
|
180
186
|
* @param params.targetPublicKey - The target public key to encrypt the export bundle to (required for custom iframe flows).
|
|
181
187
|
* @param params.stampWith - The stamper to use for the export (Passkey, ApiKey, or Wallet).
|
|
182
188
|
*
|
|
183
189
|
* @returns A void promise.
|
|
184
190
|
*/
|
|
185
|
-
|
|
191
|
+
handleExportWallet: (params: {
|
|
186
192
|
walletId: string;
|
|
187
|
-
exportType: ExportType;
|
|
188
193
|
targetPublicKey?: string;
|
|
189
194
|
stampWith?: StamperType | undefined;
|
|
190
|
-
})
|
|
195
|
+
}) => Promise<void>;
|
|
196
|
+
/**
|
|
197
|
+
* handles the export private key flow.
|
|
198
|
+
*
|
|
199
|
+
* - This function opens a modal with the ExportComponent for exporting a private key.
|
|
200
|
+
* - Uses Turnkey's export iframe flow to securely export private key material.
|
|
201
|
+
* - The export process encrypts the exported bundle to a target public key, which is generated and managed inside the iframe for maximum security.
|
|
202
|
+
* - A request is made to the Turnkey API to export the private key, encrypted to the target public key.
|
|
203
|
+
* - The resulting export bundle is injected into the iframe, where it is decrypted and displayed to the user.
|
|
204
|
+
* - If a custom iframe URL is used, a target public key can be provided explicitly.
|
|
205
|
+
* - Optionally allows specifying the stamper to use for the export (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet) for granular authentication control.
|
|
206
|
+
* - The modal-driven UI ensures the user is guided through the export process and can securely retrieve their exported material.
|
|
207
|
+
*
|
|
208
|
+
* @param params.privateKeyId - The ID of the private key to export.
|
|
209
|
+
* @param params.targetPublicKey - The target public key to encrypt the export bundle to (required for custom iframe flows).
|
|
210
|
+
* @param params.stampWith - The stamper to use for the export (Passkey, ApiKey, or Wallet).
|
|
211
|
+
* @return A void promise.
|
|
212
|
+
*/
|
|
213
|
+
handleExportPrivateKey: (params: {
|
|
214
|
+
privateKeyId: string;
|
|
215
|
+
targetPublicKey?: string;
|
|
216
|
+
stampWith?: StamperType | undefined;
|
|
217
|
+
}) => Promise<void>;
|
|
218
|
+
/**
|
|
219
|
+
* Handles the export wallet account flow.
|
|
220
|
+
*
|
|
221
|
+
* - This function opens a modal with the ExportComponent for exporting a wallet account.
|
|
222
|
+
* - Uses Turnkey's export iframe flow to securely export wallet account material.
|
|
223
|
+
* - The export process encrypts the exported bundle to a target public key, which is generated and managed inside the iframe for maximum security.
|
|
224
|
+
* - A request is made to the Turnkey API to export the wallet account, encrypted to the target public key.
|
|
225
|
+
* - The resulting export bundle is injected into the iframe, where it is decrypted and displayed to the user.
|
|
226
|
+
* - If a custom iframe URL is used, a target public key can be provided explicitly.
|
|
227
|
+
* - Optionally allows specifying the stamper to use for the export (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet) for granular authentication control.
|
|
228
|
+
* - The modal-driven UI ensures the user is guided through the export process and can securely retrieve their exported material.
|
|
229
|
+
*
|
|
230
|
+
* @param params.address - The address of the wallet account to export.
|
|
231
|
+
* @param params.targetPublicKey - The target public key to encrypt the export bundle to (required for custom iframe flows).
|
|
232
|
+
* @param params.stampWith - The stamper to use for the export (Passkey, ApiKey, or Wallet).
|
|
233
|
+
*
|
|
234
|
+
* @returns A void promise.
|
|
235
|
+
*/
|
|
236
|
+
handleExportWalletAccount: (params: {
|
|
237
|
+
address: string;
|
|
238
|
+
targetPublicKey?: string;
|
|
239
|
+
stampWith?: StamperType | undefined;
|
|
240
|
+
}) => Promise<void>;
|
|
191
241
|
/**
|
|
192
242
|
* Handles the import flow.
|
|
193
243
|
*
|
|
@@ -204,11 +254,11 @@ export interface ClientContextType extends TurnkeyClientMethods {
|
|
|
204
254
|
*
|
|
205
255
|
* @returns A promise that resolves to the new wallet's ID.
|
|
206
256
|
*/
|
|
207
|
-
|
|
257
|
+
handleImportWallet: (params?: {
|
|
208
258
|
defaultWalletAccounts?: v1AddressFormat[] | v1WalletAccountParams[];
|
|
209
259
|
successPageDuration?: number | undefined;
|
|
210
260
|
stampWith?: StamperType | undefined;
|
|
211
|
-
})
|
|
261
|
+
}) => Promise<string>;
|
|
212
262
|
/**
|
|
213
263
|
* Handles the update user name flow.
|
|
214
264
|
*
|
|
@@ -228,12 +278,12 @@ export interface ClientContextType extends TurnkeyClientMethods {
|
|
|
228
278
|
* @returns A promise that resolves to the userId of the user that was changed.
|
|
229
279
|
* @throws {TurnkeyError} If the client is not initialized, no active session is found, or if there is an error updating the user name.
|
|
230
280
|
*/
|
|
231
|
-
handleUpdateUserEmail(params?: {
|
|
281
|
+
handleUpdateUserEmail: (params?: {
|
|
232
282
|
email?: string;
|
|
233
283
|
title?: string;
|
|
234
284
|
subTitle?: string;
|
|
235
285
|
successPageDuration?: number | undefined;
|
|
236
|
-
})
|
|
286
|
+
}) => Promise<string>;
|
|
237
287
|
/**
|
|
238
288
|
* Handles the update user phone number flow.
|
|
239
289
|
*
|
|
@@ -254,13 +304,13 @@ export interface ClientContextType extends TurnkeyClientMethods {
|
|
|
254
304
|
* @returns A promise that resolves to the userId of the user that was changed.
|
|
255
305
|
* @throws {TurnkeyError} If the client is not initialized, no active session is found, SMS OTP is not enabled, or if there is an error updating the phone number.
|
|
256
306
|
*/
|
|
257
|
-
handleUpdateUserPhoneNumber(params?: {
|
|
307
|
+
handleUpdateUserPhoneNumber: (params?: {
|
|
258
308
|
phoneNumber?: string;
|
|
259
309
|
formattedPhone?: string;
|
|
260
310
|
title?: string;
|
|
261
311
|
subTitle?: string;
|
|
262
312
|
successPageDuration?: number | undefined;
|
|
263
|
-
})
|
|
313
|
+
}) => Promise<string>;
|
|
264
314
|
/**
|
|
265
315
|
* Handles the update user email flow.
|
|
266
316
|
*
|
|
@@ -333,13 +383,13 @@ export interface ClientContextType extends TurnkeyClientMethods {
|
|
|
333
383
|
* @returns A promise that resolves to the userId of the user that was changed.
|
|
334
384
|
* @throws {TurnkeyError} If the client is not initialized, no active session is found, or if there is an error adding the phone number.
|
|
335
385
|
*/
|
|
336
|
-
handleAddPhoneNumber(params?: {
|
|
386
|
+
handleAddPhoneNumber: (params?: {
|
|
337
387
|
phoneNumber?: string;
|
|
338
388
|
formattedPhone?: string;
|
|
339
389
|
title?: string;
|
|
340
390
|
subTitle?: string;
|
|
341
391
|
successPageDuration?: number | undefined;
|
|
342
|
-
})
|
|
392
|
+
}) => Promise<string>;
|
|
343
393
|
/**
|
|
344
394
|
* Handles the addition of an OAuth provider for the user.
|
|
345
395
|
*
|
|
@@ -357,10 +407,10 @@ export interface ClientContextType extends TurnkeyClientMethods {
|
|
|
357
407
|
* @returns A void promise.
|
|
358
408
|
* @throws {TurnkeyError} If the client is not initialized, no active session is found, or if there is an error adding the provider.
|
|
359
409
|
*/
|
|
360
|
-
handleAddOauthProvider(params: {
|
|
410
|
+
handleAddOauthProvider: (params: {
|
|
361
411
|
providerName: OAuthProviders;
|
|
362
412
|
stampWith?: StamperType | undefined;
|
|
363
|
-
})
|
|
413
|
+
}) => Promise<void>;
|
|
364
414
|
/**
|
|
365
415
|
* Handles the removal of an OAuth provider.
|
|
366
416
|
*
|
|
@@ -381,13 +431,13 @@ export interface ClientContextType extends TurnkeyClientMethods {
|
|
|
381
431
|
* @returns A promise that resolves to an array of provider IDs that were removed.
|
|
382
432
|
* @throws {TurnkeyError} If the client is not initialized, no active session is found, or if there is an error removing the provider.
|
|
383
433
|
*/
|
|
384
|
-
handleRemoveOauthProvider(params: {
|
|
434
|
+
handleRemoveOauthProvider: (params: {
|
|
385
435
|
providerId: string;
|
|
386
436
|
title?: string;
|
|
387
437
|
subTitle?: string;
|
|
388
438
|
successPageDuration?: number | undefined;
|
|
389
439
|
stampWith?: StamperType | undefined;
|
|
390
|
-
})
|
|
440
|
+
}) => Promise<string[]>;
|
|
391
441
|
/**
|
|
392
442
|
* Handles the addition of a passkey (authenticator) for the user.
|
|
393
443
|
*
|
|
@@ -408,13 +458,13 @@ export interface ClientContextType extends TurnkeyClientMethods {
|
|
|
408
458
|
* @returns A promise that resolves to the user's updated passkeys.
|
|
409
459
|
* @throws {TurnkeyError} If the client is not initialized, no active session is found, or if there is an error adding the passkey.
|
|
410
460
|
*/
|
|
411
|
-
handleAddPasskey(params?: {
|
|
461
|
+
handleAddPasskey: (params?: {
|
|
412
462
|
name?: string;
|
|
413
463
|
displayName?: string;
|
|
414
464
|
userId?: string;
|
|
415
465
|
successPageDuration?: number | undefined;
|
|
416
466
|
stampWith?: StamperType | undefined;
|
|
417
|
-
})
|
|
467
|
+
}) => Promise<string[]>;
|
|
418
468
|
/**
|
|
419
469
|
* Handles the removal of a passkey (authenticator) for the user.
|
|
420
470
|
*
|
|
@@ -435,14 +485,14 @@ export interface ClientContextType extends TurnkeyClientMethods {
|
|
|
435
485
|
* @returns A promise that resolves to an array of authenticator IDs that were removed.
|
|
436
486
|
* @throws {TurnkeyError} If the client is not initialized, no active session is found, or if there is an error removing the passkey.
|
|
437
487
|
*/
|
|
438
|
-
handleRemovePasskey(params: {
|
|
488
|
+
handleRemovePasskey: (params: {
|
|
439
489
|
authenticatorId: string;
|
|
440
490
|
userId?: string;
|
|
441
491
|
title?: string;
|
|
442
492
|
subTitle?: string;
|
|
443
493
|
successPageDuration?: number | undefined;
|
|
444
494
|
stampWith?: StamperType | undefined;
|
|
445
|
-
})
|
|
495
|
+
}) => Promise<string[]>;
|
|
446
496
|
/**
|
|
447
497
|
* Handles the signing of a message by displaying a modal for user interaction.
|
|
448
498
|
*
|
|
@@ -463,7 +513,7 @@ export interface ClientContextType extends TurnkeyClientMethods {
|
|
|
463
513
|
* @returns A promise that resolves to a `v1SignRawPayloadResult` object containing the signed message.
|
|
464
514
|
* @throws {TurnkeyError} If the client is not initialized or if there is an error during the signing process.
|
|
465
515
|
*/
|
|
466
|
-
handleSignMessage(params: {
|
|
516
|
+
handleSignMessage: (params: {
|
|
467
517
|
message: string;
|
|
468
518
|
walletAccount: WalletAccount;
|
|
469
519
|
encoding?: v1PayloadEncoding;
|
|
@@ -472,7 +522,7 @@ export interface ClientContextType extends TurnkeyClientMethods {
|
|
|
472
522
|
subText?: string;
|
|
473
523
|
successPageDuration?: number | undefined;
|
|
474
524
|
stampWith?: StamperType | undefined;
|
|
475
|
-
})
|
|
525
|
+
}) => Promise<v1SignRawPayloadResult>;
|
|
476
526
|
/**
|
|
477
527
|
* Handles the linking of an external wallet account to the user's Turnkey account.
|
|
478
528
|
*
|
|
@@ -488,9 +538,9 @@ export interface ClientContextType extends TurnkeyClientMethods {
|
|
|
488
538
|
* @returns A void promise.
|
|
489
539
|
* @throws {TurnkeyError} If the client is not initialized or if no active session is found.
|
|
490
540
|
*/
|
|
491
|
-
handleLinkExternalWallet(params?: {
|
|
541
|
+
handleLinkExternalWallet: (params?: {
|
|
492
542
|
successPageDuration?: number | undefined;
|
|
493
|
-
})
|
|
543
|
+
}) => Promise<void>;
|
|
494
544
|
/**
|
|
495
545
|
* Handles the removal of a user's email address from their Turnkey account.
|
|
496
546
|
*
|
|
@@ -500,11 +550,11 @@ export interface ClientContextType extends TurnkeyClientMethods {
|
|
|
500
550
|
* @param params.successPageDuration - duration (in ms) for the success page after removal (default: 0, no success page).
|
|
501
551
|
* @param params.stampWith - parameter to specify the stamper to use for the removal (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet).
|
|
502
552
|
*/
|
|
503
|
-
handleRemoveUserEmail(params?: {
|
|
553
|
+
handleRemoveUserEmail: (params?: {
|
|
504
554
|
userId?: string;
|
|
505
555
|
successPageDuration?: number | undefined;
|
|
506
556
|
stampWith?: StamperType | undefined;
|
|
507
|
-
})
|
|
557
|
+
}) => Promise<string>;
|
|
508
558
|
/**
|
|
509
559
|
* Handles the removal of a user's phone number from their Turnkey account.
|
|
510
560
|
*
|
|
@@ -514,11 +564,12 @@ export interface ClientContextType extends TurnkeyClientMethods {
|
|
|
514
564
|
* @param params.successPageDuration - duration (in ms) for the success page after removal (default: 0, no success page).
|
|
515
565
|
* @param params.stampWith - parameter to specify the stamper to use for the removal (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet).
|
|
516
566
|
*/
|
|
517
|
-
handleRemoveUserPhoneNumber(params?: {
|
|
567
|
+
handleRemoveUserPhoneNumber: (params?: {
|
|
518
568
|
userId?: string;
|
|
519
569
|
successPageDuration?: number | undefined;
|
|
520
570
|
stampWith?: StamperType | undefined;
|
|
521
|
-
})
|
|
571
|
+
}) => Promise<string>;
|
|
522
572
|
}
|
|
573
|
+
/** @internal */
|
|
523
574
|
export declare const ClientContext: import("react").Context<ClientContextType | undefined>;
|
|
524
575
|
//# sourceMappingURL=Types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Types.d.ts","sourceRoot":"","sources":["../../../src/providers/client/Types.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,MAAM,EACN,WAAW,EACX,aAAa,EACd,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,cAAc,EACd,OAAO,EACP,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,sBAAsB,EACtB,MAAM,EACN,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,qBAAqB,EACrB,
|
|
1
|
+
{"version":3,"file":"Types.d.ts","sourceRoot":"","sources":["../../../src/providers/client/Types.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,MAAM,EACN,WAAW,EACX,aAAa,EACd,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,cAAc,EACd,OAAO,EACP,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,sBAAsB,EACtB,MAAM,EACN,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,qBAAqB,EACrB,SAAS,EACT,WAA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AAS,CAAC;QACzC,SAAS,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;KACrC,KAAK,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAEtC;;;;;;;;;;;;;;OAcG;IACH,wBAAwB,EAAE,CAAC,MAAM,CAAC,EAAE;QAClC,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAC1C,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpB;;;;;;;;OAQG;IACH,qBAAqB,EAAE,CAAC,MAAM,CAAC,EAAE;QAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QACzC,SAAS,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;KACrC,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAEtB;;;;;;;;OAQG;IACH,2BAA2B,EAAE,CAAC,MAAM,CAAC,EAAE;QACrC,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QACzC,SAAS,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;KACrC,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACvB;AAED,gBAAgB;AAChB,eAAO,MAAM,aAAa,wDAEzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Types.js","sources":["../../../src/providers/client/Types.tsx"],"sourcesContent":[null],"names":["ClientContext","createContext","undefined"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"Types.js","sources":["../../../src/providers/client/Types.tsx"],"sourcesContent":[null],"names":["ClientContext","createContext","undefined"],"mappings":";;;;;AAsnBA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;MACaA,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAGC,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACxCC,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Types.mjs","sources":["../../../src/providers/client/Types.tsx"],"sourcesContent":[null],"names":["ClientContext","createContext","undefined"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Types.mjs","sources":["../../../src/providers/client/Types.tsx"],"sourcesContent":[null],"names":["ClientContext","createContext","undefined"],"mappings":";;;AAsnBA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;IACaA,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAGC,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACxCC,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Hook.d.ts","sourceRoot":"","sources":["../../../src/providers/modal/Hook.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAgB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE5D,eAAO,MAAM,QAAQ,QAAO,gBAI3B,CAAC"}
|
|
1
|
+
{"version":3,"file":"Hook.d.ts","sourceRoot":"","sources":["../../../src/providers/modal/Hook.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAgB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE5D,gBAAgB;AAChB,eAAO,MAAM,QAAQ,QAAO,gBAI3B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Hook.js","sources":["../../../src/providers/modal/Hook.tsx"],"sourcesContent":[null],"names":["useModal","context","useContext","ModalContext","Error"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"Hook.js","sources":["../../../src/providers/modal/Hook.tsx"],"sourcesContent":[null],"names":["useModal","context","useContext","ModalContext","Error"],"mappings":";;;;;;AAKA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACaA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAQ,GAAGA,CAAuB,CAAA,CAAA,CAAA,CAAA,CAAA;AAC7C,CAAA,CAAA,MAAMC,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAGC,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAACC,qBAAY,CAAC;CACxC,CAAA,CAAA,CAAA,CAAA,CAAI,CAACF,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAE,MAAM,CAAIG,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAK,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA4C,CAAC;AAC3E,CAAA,CAAA,OAAOH,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAChB,CAAA;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Hook.mjs","sources":["../../../src/providers/modal/Hook.tsx"],"sourcesContent":[null],"names":["useModal","context","useContext","ModalContext","Error"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"Hook.mjs","sources":["../../../src/providers/modal/Hook.tsx"],"sourcesContent":[null],"names":["useModal","context","useContext","ModalContext","Error"],"mappings":";;;;AAKA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;IACaA,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,CAAXA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAQA,CAA0B,CAAA,CAAA;AAC7C,CAAA,CAAA,IAAMC,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAGC,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAACC,YAAY,CAAC;CACxC,CAAA,CAAA,CAAA,CAAA,CAAI,CAACF,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAE,MAAM,CAAIG,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAK,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA4C,CAAC;AAC3E,CAAA,CAAA,OAAOH,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAChB,CAAA;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Root.d.ts","sourceRoot":"","sources":["../../../src/providers/modal/Root.tsx"],"names":[],"mappings":"AASA,OAAO,EAAe,KAAK,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAK3E,UAAU,cAAc;IACtB,MAAM,EAAE,qBAAqB,CAAC;CAC/B;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"Root.d.ts","sourceRoot":"","sources":["../../../src/providers/modal/Root.tsx"],"names":[],"mappings":"AASA,OAAO,EAAe,KAAK,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAK3E,UAAU,cAAc;IACtB,MAAM,EAAE,qBAAqB,CAAC;CAC/B;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,2CA4O9C"}
|
|
@@ -35,7 +35,7 @@ function ModalRoot(props) {
|
|
|
35
35
|
const [height, setHeight] = react.useState(300);
|
|
36
36
|
const [width, setWidth] = react.useState(300);
|
|
37
37
|
const [observeResize, setObserveResize] = react.useState(true);
|
|
38
|
-
useCssLoaded(modalStack); // triggers warning overlay if CSS missing
|
|
38
|
+
useCssLoaded(modalStack, config); // triggers warning overlay if CSS missing
|
|
39
39
|
const maxMobileScreenWidth = screenWidth * 0.9; // Only take up 90% of the screen width on mobile
|
|
40
40
|
const getBorderRadius = () => {
|
|
41
41
|
// Border radius can be passed in as either a number or a string, so we need to handle both cases
|
|
@@ -49,8 +49,9 @@ function ModalRoot(props) {
|
|
|
49
49
|
// This only needs to run when the content is changing size without the page being swapped out
|
|
50
50
|
const node = containerRef.current;
|
|
51
51
|
if (!node || !observeResize) return;
|
|
52
|
+
let cancelled = false; // To prevent setting state on unmounted component
|
|
52
53
|
const observer = new ResizeObserver(([entry]) => {
|
|
53
|
-
if (!entry) return;
|
|
54
|
+
if (!entry || cancelled) return;
|
|
54
55
|
setContentBlur(10);
|
|
55
56
|
const {
|
|
56
57
|
width: newWidth,
|
|
@@ -58,28 +59,31 @@ function ModalRoot(props) {
|
|
|
58
59
|
} = entry.contentRect;
|
|
59
60
|
setHeight(newHeight);
|
|
60
61
|
setWidth(newWidth);
|
|
61
|
-
setTimeout(() => setContentBlur(0), 100);
|
|
62
|
+
setTimeout(() => !cancelled && setContentBlur(0), 100);
|
|
62
63
|
});
|
|
63
64
|
observer.observe(node);
|
|
64
|
-
return () =>
|
|
65
|
+
return () => {
|
|
66
|
+
cancelled = true;
|
|
67
|
+
observer.disconnect();
|
|
68
|
+
};
|
|
65
69
|
}, [containerRef.current, observeResize]);
|
|
66
70
|
react.useEffect(() => {
|
|
71
|
+
let cancelled = false; // To prevent setting state on unmounted component
|
|
67
72
|
const resize = () => {
|
|
68
|
-
if (containerRef.current)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
73
|
+
if (cancelled || !containerRef.current) return;
|
|
74
|
+
setContentBlur(10);
|
|
75
|
+
const rect = containerRef.current.getBoundingClientRect();
|
|
76
|
+
setHeight(rect.height);
|
|
77
|
+
setWidth(rect.width);
|
|
78
|
+
setTimeout(() => !cancelled && setContentBlur(0), 100);
|
|
75
79
|
};
|
|
76
80
|
if (current) {
|
|
77
81
|
setObserveResize(true);
|
|
78
82
|
requestAnimationFrame(resize);
|
|
79
|
-
|
|
80
|
-
const originalStyle = window.getComputedStyle(document.body).overflow;
|
|
83
|
+
const originalStyle = document.body.style.overflow;
|
|
81
84
|
document.body.style.overflow = "hidden";
|
|
82
85
|
return () => {
|
|
86
|
+
cancelled = true;
|
|
83
87
|
document.body.style.overflow = originalStyle;
|
|
84
88
|
};
|
|
85
89
|
} else {
|
|
@@ -88,7 +92,7 @@ function ModalRoot(props) {
|
|
|
88
92
|
setWidth(isMobile ? width : width / 1.3);
|
|
89
93
|
return;
|
|
90
94
|
}
|
|
91
|
-
}, [current]);
|
|
95
|
+
}, [current, isMobile]);
|
|
92
96
|
return jsxRuntime.jsx(react$1.Transition, {
|
|
93
97
|
appear: true,
|
|
94
98
|
show: !!current,
|
|
@@ -112,7 +116,7 @@ function ModalRoot(props) {
|
|
|
112
116
|
}
|
|
113
117
|
})
|
|
114
118
|
}), jsxRuntime.jsx("div", {
|
|
115
|
-
className: clsx("tk-modal fixed inset-0 flex justify-center transition-colors
|
|
119
|
+
className: clsx("tk-modal fixed inset-0 flex justify-center transition-colors", {
|
|
116
120
|
dark: config?.ui?.darkMode
|
|
117
121
|
}, {
|
|
118
122
|
"items-end": isMobile
|
|
@@ -206,16 +210,19 @@ function ModalRoot(props) {
|
|
|
206
210
|
})
|
|
207
211
|
});
|
|
208
212
|
}
|
|
209
|
-
function useCssLoaded(modalStack) {
|
|
213
|
+
function useCssLoaded(modalStack, config) {
|
|
210
214
|
react.useEffect(() => {
|
|
211
215
|
if (process.env.NODE_ENV !== "development") return; // Only check in development mode
|
|
212
|
-
const
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
216
|
+
const testElement = document.createElement("div");
|
|
217
|
+
testElement.className = "tk-modal"; // Use a class that should definitely be styled
|
|
218
|
+
testElement.style.position = "absolute";
|
|
219
|
+
testElement.style.visibility = "hidden";
|
|
220
|
+
document.body.appendChild(testElement);
|
|
221
|
+
// Check if the styles have been applied by inspecting a computed style
|
|
222
|
+
const computedStyle = window.getComputedStyle(testElement);
|
|
223
|
+
const hasStyles = computedStyle.lineHeight === "normal";
|
|
224
|
+
document.body.removeChild(testElement);
|
|
225
|
+
if (!hasStyles && modalStack.length === 1 && !config.ui?.supressMissingStylesError) renderMissingStylesOverlay();
|
|
219
226
|
}, [modalStack]);
|
|
220
227
|
}
|
|
221
228
|
function renderMissingStylesOverlay() {
|
|
@@ -244,14 +251,23 @@ function renderMissingStylesOverlay() {
|
|
|
244
251
|
<div style="font-size: 1rem; max-width: 600px;">
|
|
245
252
|
You must import the Turnkey React Wallet Kit styles in your app:
|
|
246
253
|
<pre style="background-color: #f3f4f6; color: #111827; padding: 0.5rem 1rem; margin-top: 1rem; border-radius: 6px; font-size: 0.875rem;">
|
|
247
|
-
import "@turnkey/react-wallet-kit/
|
|
254
|
+
import "@turnkey/react-wallet-kit/styles.css";
|
|
248
255
|
</pre>
|
|
249
256
|
<p style="margin-top: 1rem; font-size: 0.875rem; color: #6b7280;">
|
|
250
257
|
This warning only shows in development mode.
|
|
251
258
|
</p>
|
|
259
|
+
<button id="turnkey-missing-css-close" style="margin-top: 2rem; padding: 0.5rem 1.5rem; font-size: 1rem; background: #b91c1c; color: white; border: none; border-radius: 6px; cursor: pointer;">
|
|
260
|
+
Close
|
|
261
|
+
</button>
|
|
252
262
|
</div>
|
|
253
263
|
`;
|
|
254
264
|
document.body.appendChild(div);
|
|
265
|
+
const closeBtn = div.querySelector("#turnkey-missing-css-close");
|
|
266
|
+
if (closeBtn) {
|
|
267
|
+
closeBtn.addEventListener("click", () => {
|
|
268
|
+
div.remove();
|
|
269
|
+
});
|
|
270
|
+
}
|
|
255
271
|
}
|
|
256
272
|
|
|
257
273
|
exports.ModalRoot = ModalRoot;
|