@turnkey/sdk-browser 0.0.1 → 0.2.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.
Files changed (49) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/__generated__/sdk-client-base.d.ts.map +1 -1
  3. package/dist/__generated__/sdk-client-base.js +173 -43
  4. package/dist/__generated__/sdk-client-base.js.map +1 -1
  5. package/dist/__generated__/sdk-client-base.mjs +173 -43
  6. package/dist/__generated__/sdk-client-base.mjs.map +1 -1
  7. package/dist/__generated__/version.d.ts +1 -1
  8. package/dist/__generated__/version.js +1 -1
  9. package/dist/__generated__/version.mjs +1 -1
  10. package/dist/__polyfills__/window.d.ts +15 -0
  11. package/dist/__polyfills__/window.d.ts.map +1 -0
  12. package/dist/__polyfills__/window.js +30 -0
  13. package/dist/__polyfills__/window.js.map +1 -0
  14. package/dist/__polyfills__/window.mjs +28 -0
  15. package/dist/__polyfills__/window.mjs.map +1 -0
  16. package/dist/__types__/base.d.ts +5 -1
  17. package/dist/__types__/base.d.ts.map +1 -1
  18. package/dist/index.d.ts +5 -5
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +6 -2
  21. package/dist/index.js.map +1 -1
  22. package/dist/index.mjs +2 -2
  23. package/dist/models.d.ts +0 -5
  24. package/dist/models.d.ts.map +1 -1
  25. package/dist/sdk-client.d.ts +23 -23
  26. package/dist/sdk-client.d.ts.map +1 -1
  27. package/dist/sdk-client.js +87 -133
  28. package/dist/sdk-client.js.map +1 -1
  29. package/dist/sdk-client.mjs +86 -134
  30. package/dist/sdk-client.mjs.map +1 -1
  31. package/dist/storage.d.ts +2 -6
  32. package/dist/storage.d.ts.map +1 -1
  33. package/dist/storage.js +5 -9
  34. package/dist/storage.js.map +1 -1
  35. package/dist/storage.mjs +5 -9
  36. package/dist/storage.mjs.map +1 -1
  37. package/dist/turnkey-helpers.d.ts +2 -0
  38. package/dist/turnkey-helpers.d.ts.map +1 -1
  39. package/dist/turnkey-helpers.js +13 -0
  40. package/dist/turnkey-helpers.js.map +1 -1
  41. package/dist/turnkey-helpers.mjs +12 -1
  42. package/dist/turnkey-helpers.mjs.map +1 -1
  43. package/package.json +4 -3
  44. package/dist/constants.d.ts +0 -4
  45. package/dist/constants.d.ts.map +0 -1
  46. package/dist/constants.js +0 -18
  47. package/dist/constants.js.map +0 -1
  48. package/dist/constants.mjs +0 -15
  49. package/dist/constants.mjs.map +0 -1
@@ -1,5 +1,6 @@
1
1
  import { TurnkeyRequestError } from '../__types__/base.mjs';
2
2
  import { VERSION } from './version.mjs';
3
+ import { getStorageValue, StorageKeys } from '../storage.mjs';
3
4
 
4
5
  /* @generated by codegen. DO NOT EDIT BY HAND */
5
6
  class TurnkeySDKClientBase {
@@ -126,387 +127,516 @@ class TurnkeySDKClientBase {
126
127
  };
127
128
  this.approveActivity = async (input) => {
128
129
  const { organizationId, timestampMs, ...rest } = input;
130
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
129
131
  return this.activityDecision("/public/v1/submit/approve_activity", {
130
132
  parameters: rest,
131
- organizationId: organizationId ?? this.config.organizationId,
133
+ organizationId: organizationId ??
134
+ currentUser?.organization?.organizationId ??
135
+ this.config.organizationId,
132
136
  timestampMs: timestampMs ?? String(Date.now()),
133
137
  type: "ACTIVITY_TYPE_APPROVE_ACTIVITY",
134
138
  });
135
139
  };
136
140
  this.createApiKeys = async (input) => {
137
141
  const { organizationId, timestampMs, ...rest } = input;
142
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
138
143
  return this.command("/public/v1/submit/create_api_keys", {
139
144
  parameters: rest,
140
- organizationId: organizationId ?? this.config.organizationId,
145
+ organizationId: organizationId ??
146
+ currentUser?.organization?.organizationId ??
147
+ this.config.organizationId,
141
148
  timestampMs: timestampMs ?? String(Date.now()),
142
149
  type: "ACTIVITY_TYPE_CREATE_API_KEYS",
143
150
  }, "createApiKeysResult");
144
151
  };
145
152
  this.createApiOnlyUsers = async (input) => {
146
153
  const { organizationId, timestampMs, ...rest } = input;
154
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
147
155
  return this.command("/public/v1/submit/create_api_only_users", {
148
156
  parameters: rest,
149
- organizationId: organizationId ?? this.config.organizationId,
157
+ organizationId: organizationId ??
158
+ currentUser?.organization?.organizationId ??
159
+ this.config.organizationId,
150
160
  timestampMs: timestampMs ?? String(Date.now()),
151
161
  type: "ACTIVITY_TYPE_CREATE_API_ONLY_USERS",
152
162
  }, "createApiOnlyUsersResult");
153
163
  };
154
164
  this.createAuthenticators = async (input) => {
155
165
  const { organizationId, timestampMs, ...rest } = input;
166
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
156
167
  return this.command("/public/v1/submit/create_authenticators", {
157
168
  parameters: rest,
158
- organizationId: organizationId ?? this.config.organizationId,
169
+ organizationId: organizationId ??
170
+ currentUser?.organization?.organizationId ??
171
+ this.config.organizationId,
159
172
  timestampMs: timestampMs ?? String(Date.now()),
160
173
  type: "ACTIVITY_TYPE_CREATE_AUTHENTICATORS_V2",
161
174
  }, "createAuthenticatorsResult");
162
175
  };
163
176
  this.createInvitations = async (input) => {
164
177
  const { organizationId, timestampMs, ...rest } = input;
178
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
165
179
  return this.command("/public/v1/submit/create_invitations", {
166
180
  parameters: rest,
167
- organizationId: organizationId ?? this.config.organizationId,
181
+ organizationId: organizationId ??
182
+ currentUser?.organization?.organizationId ??
183
+ this.config.organizationId,
168
184
  timestampMs: timestampMs ?? String(Date.now()),
169
185
  type: "ACTIVITY_TYPE_CREATE_INVITATIONS",
170
186
  }, "createInvitationsResult");
171
187
  };
172
188
  this.createPolicies = async (input) => {
173
189
  const { organizationId, timestampMs, ...rest } = input;
190
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
174
191
  return this.command("/public/v1/submit/create_policies", {
175
192
  parameters: rest,
176
- organizationId: organizationId ?? this.config.organizationId,
193
+ organizationId: organizationId ??
194
+ currentUser?.organization?.organizationId ??
195
+ this.config.organizationId,
177
196
  timestampMs: timestampMs ?? String(Date.now()),
178
197
  type: "ACTIVITY_TYPE_CREATE_POLICIES",
179
198
  }, "createPoliciesResult");
180
199
  };
181
200
  this.createPolicy = async (input) => {
182
201
  const { organizationId, timestampMs, ...rest } = input;
202
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
183
203
  return this.command("/public/v1/submit/create_policy", {
184
204
  parameters: rest,
185
- organizationId: organizationId ?? this.config.organizationId,
205
+ organizationId: organizationId ??
206
+ currentUser?.organization?.organizationId ??
207
+ this.config.organizationId,
186
208
  timestampMs: timestampMs ?? String(Date.now()),
187
209
  type: "ACTIVITY_TYPE_CREATE_POLICY_V3",
188
210
  }, "createPolicyResult");
189
211
  };
190
212
  this.createPrivateKeyTag = async (input) => {
191
213
  const { organizationId, timestampMs, ...rest } = input;
214
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
192
215
  return this.command("/public/v1/submit/create_private_key_tag", {
193
216
  parameters: rest,
194
- organizationId: organizationId ?? this.config.organizationId,
217
+ organizationId: organizationId ??
218
+ currentUser?.organization?.organizationId ??
219
+ this.config.organizationId,
195
220
  timestampMs: timestampMs ?? String(Date.now()),
196
221
  type: "ACTIVITY_TYPE_CREATE_PRIVATE_KEY_TAG",
197
222
  }, "createPrivateKeyTagResult");
198
223
  };
199
224
  this.createPrivateKeys = async (input) => {
200
225
  const { organizationId, timestampMs, ...rest } = input;
226
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
201
227
  return this.command("/public/v1/submit/create_private_keys", {
202
228
  parameters: rest,
203
- organizationId: organizationId ?? this.config.organizationId,
229
+ organizationId: organizationId ??
230
+ currentUser?.organization?.organizationId ??
231
+ this.config.organizationId,
204
232
  timestampMs: timestampMs ?? String(Date.now()),
205
233
  type: "ACTIVITY_TYPE_CREATE_PRIVATE_KEYS_V2",
206
234
  }, "createPrivateKeysResultV2");
207
235
  };
208
236
  this.createReadOnlySession = async (input) => {
209
237
  const { organizationId, timestampMs, ...rest } = input;
238
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
210
239
  return this.command("/public/v1/submit/create_read_only_session", {
211
240
  parameters: rest,
212
- organizationId: organizationId ?? this.config.organizationId,
241
+ organizationId: organizationId ??
242
+ currentUser?.organization?.organizationId ??
243
+ this.config.organizationId,
213
244
  timestampMs: timestampMs ?? String(Date.now()),
214
245
  type: "ACTIVITY_TYPE_CREATE_READ_ONLY_SESSION",
215
246
  }, "createReadOnlySessionResult");
216
247
  };
217
248
  this.createSubOrganization = async (input) => {
218
249
  const { organizationId, timestampMs, ...rest } = input;
250
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
219
251
  return this.command("/public/v1/submit/create_sub_organization", {
220
252
  parameters: rest,
221
- organizationId: organizationId ?? this.config.organizationId,
253
+ organizationId: organizationId ??
254
+ currentUser?.organization?.organizationId ??
255
+ this.config.organizationId,
222
256
  timestampMs: timestampMs ?? String(Date.now()),
223
257
  type: "ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V4",
224
258
  }, "createSubOrganizationResultV4");
225
259
  };
226
260
  this.createUserTag = async (input) => {
227
261
  const { organizationId, timestampMs, ...rest } = input;
262
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
228
263
  return this.command("/public/v1/submit/create_user_tag", {
229
264
  parameters: rest,
230
- organizationId: organizationId ?? this.config.organizationId,
265
+ organizationId: organizationId ??
266
+ currentUser?.organization?.organizationId ??
267
+ this.config.organizationId,
231
268
  timestampMs: timestampMs ?? String(Date.now()),
232
269
  type: "ACTIVITY_TYPE_CREATE_USER_TAG",
233
270
  }, "createUserTagResult");
234
271
  };
235
272
  this.createUsers = async (input) => {
236
273
  const { organizationId, timestampMs, ...rest } = input;
274
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
237
275
  return this.command("/public/v1/submit/create_users", {
238
276
  parameters: rest,
239
- organizationId: organizationId ?? this.config.organizationId,
277
+ organizationId: organizationId ??
278
+ currentUser?.organization?.organizationId ??
279
+ this.config.organizationId,
240
280
  timestampMs: timestampMs ?? String(Date.now()),
241
281
  type: "ACTIVITY_TYPE_CREATE_USERS_V2",
242
282
  }, "createUsersResult");
243
283
  };
244
284
  this.createWallet = async (input) => {
245
285
  const { organizationId, timestampMs, ...rest } = input;
286
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
246
287
  return this.command("/public/v1/submit/create_wallet", {
247
288
  parameters: rest,
248
- organizationId: organizationId ?? this.config.organizationId,
289
+ organizationId: organizationId ??
290
+ currentUser?.organization?.organizationId ??
291
+ this.config.organizationId,
249
292
  timestampMs: timestampMs ?? String(Date.now()),
250
293
  type: "ACTIVITY_TYPE_CREATE_WALLET",
251
294
  }, "createWalletResult");
252
295
  };
253
296
  this.createWalletAccounts = async (input) => {
254
297
  const { organizationId, timestampMs, ...rest } = input;
298
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
255
299
  return this.command("/public/v1/submit/create_wallet_accounts", {
256
300
  parameters: rest,
257
- organizationId: organizationId ?? this.config.organizationId,
301
+ organizationId: organizationId ??
302
+ currentUser?.organization?.organizationId ??
303
+ this.config.organizationId,
258
304
  timestampMs: timestampMs ?? String(Date.now()),
259
305
  type: "ACTIVITY_TYPE_CREATE_WALLET_ACCOUNTS",
260
306
  }, "createWalletAccountsResult");
261
307
  };
262
308
  this.deleteApiKeys = async (input) => {
263
309
  const { organizationId, timestampMs, ...rest } = input;
310
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
264
311
  return this.command("/public/v1/submit/delete_api_keys", {
265
312
  parameters: rest,
266
- organizationId: organizationId ?? this.config.organizationId,
313
+ organizationId: organizationId ??
314
+ currentUser?.organization?.organizationId ??
315
+ this.config.organizationId,
267
316
  timestampMs: timestampMs ?? String(Date.now()),
268
317
  type: "ACTIVITY_TYPE_DELETE_API_KEYS",
269
318
  }, "deleteApiKeysResult");
270
319
  };
271
320
  this.deleteAuthenticators = async (input) => {
272
321
  const { organizationId, timestampMs, ...rest } = input;
322
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
273
323
  return this.command("/public/v1/submit/delete_authenticators", {
274
324
  parameters: rest,
275
- organizationId: organizationId ?? this.config.organizationId,
325
+ organizationId: organizationId ??
326
+ currentUser?.organization?.organizationId ??
327
+ this.config.organizationId,
276
328
  timestampMs: timestampMs ?? String(Date.now()),
277
329
  type: "ACTIVITY_TYPE_DELETE_AUTHENTICATORS",
278
330
  }, "deleteAuthenticatorsResult");
279
331
  };
280
332
  this.deleteInvitation = async (input) => {
281
333
  const { organizationId, timestampMs, ...rest } = input;
334
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
282
335
  return this.command("/public/v1/submit/delete_invitation", {
283
336
  parameters: rest,
284
- organizationId: organizationId ?? this.config.organizationId,
337
+ organizationId: organizationId ??
338
+ currentUser?.organization?.organizationId ??
339
+ this.config.organizationId,
285
340
  timestampMs: timestampMs ?? String(Date.now()),
286
341
  type: "ACTIVITY_TYPE_DELETE_INVITATION",
287
342
  }, "deleteInvitationResult");
288
343
  };
289
344
  this.deletePolicy = async (input) => {
290
345
  const { organizationId, timestampMs, ...rest } = input;
346
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
291
347
  return this.command("/public/v1/submit/delete_policy", {
292
348
  parameters: rest,
293
- organizationId: organizationId ?? this.config.organizationId,
349
+ organizationId: organizationId ??
350
+ currentUser?.organization?.organizationId ??
351
+ this.config.organizationId,
294
352
  timestampMs: timestampMs ?? String(Date.now()),
295
353
  type: "ACTIVITY_TYPE_DELETE_POLICY",
296
354
  }, "deletePolicyResult");
297
355
  };
298
356
  this.deletePrivateKeyTags = async (input) => {
299
357
  const { organizationId, timestampMs, ...rest } = input;
358
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
300
359
  return this.command("/public/v1/submit/delete_private_key_tags", {
301
360
  parameters: rest,
302
- organizationId: organizationId ?? this.config.organizationId,
361
+ organizationId: organizationId ??
362
+ currentUser?.organization?.organizationId ??
363
+ this.config.organizationId,
303
364
  timestampMs: timestampMs ?? String(Date.now()),
304
365
  type: "ACTIVITY_TYPE_DELETE_PRIVATE_KEY_TAGS",
305
366
  }, "deletePrivateKeyTagsResult");
306
367
  };
307
368
  this.deleteUserTags = async (input) => {
308
369
  const { organizationId, timestampMs, ...rest } = input;
370
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
309
371
  return this.command("/public/v1/submit/delete_user_tags", {
310
372
  parameters: rest,
311
- organizationId: organizationId ?? this.config.organizationId,
373
+ organizationId: organizationId ??
374
+ currentUser?.organization?.organizationId ??
375
+ this.config.organizationId,
312
376
  timestampMs: timestampMs ?? String(Date.now()),
313
377
  type: "ACTIVITY_TYPE_DELETE_USER_TAGS",
314
378
  }, "deleteUserTagsResult");
315
379
  };
316
380
  this.deleteUsers = async (input) => {
317
381
  const { organizationId, timestampMs, ...rest } = input;
382
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
318
383
  return this.command("/public/v1/submit/delete_users", {
319
384
  parameters: rest,
320
- organizationId: organizationId ?? this.config.organizationId,
385
+ organizationId: organizationId ??
386
+ currentUser?.organization?.organizationId ??
387
+ this.config.organizationId,
321
388
  timestampMs: timestampMs ?? String(Date.now()),
322
389
  type: "ACTIVITY_TYPE_DELETE_USERS",
323
390
  }, "deleteUsersResult");
324
391
  };
325
392
  this.emailAuth = async (input) => {
326
393
  const { organizationId, timestampMs, ...rest } = input;
394
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
327
395
  return this.command("/public/v1/submit/email_auth", {
328
396
  parameters: rest,
329
- organizationId: organizationId ?? this.config.organizationId,
397
+ organizationId: organizationId ??
398
+ currentUser?.organization?.organizationId ??
399
+ this.config.organizationId,
330
400
  timestampMs: timestampMs ?? String(Date.now()),
331
401
  type: "ACTIVITY_TYPE_EMAIL_AUTH",
332
402
  }, "emailAuthResult");
333
403
  };
334
404
  this.exportPrivateKey = async (input) => {
335
405
  const { organizationId, timestampMs, ...rest } = input;
406
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
336
407
  return this.command("/public/v1/submit/export_private_key", {
337
408
  parameters: rest,
338
- organizationId: organizationId ?? this.config.organizationId,
409
+ organizationId: organizationId ??
410
+ currentUser?.organization?.organizationId ??
411
+ this.config.organizationId,
339
412
  timestampMs: timestampMs ?? String(Date.now()),
340
413
  type: "ACTIVITY_TYPE_EXPORT_PRIVATE_KEY",
341
414
  }, "exportPrivateKeyResult");
342
415
  };
343
416
  this.exportWallet = async (input) => {
344
417
  const { organizationId, timestampMs, ...rest } = input;
418
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
345
419
  return this.command("/public/v1/submit/export_wallet", {
346
420
  parameters: rest,
347
- organizationId: organizationId ?? this.config.organizationId,
421
+ organizationId: organizationId ??
422
+ currentUser?.organization?.organizationId ??
423
+ this.config.organizationId,
348
424
  timestampMs: timestampMs ?? String(Date.now()),
349
425
  type: "ACTIVITY_TYPE_EXPORT_WALLET",
350
426
  }, "exportWalletResult");
351
427
  };
352
428
  this.exportWalletAccount = async (input) => {
353
429
  const { organizationId, timestampMs, ...rest } = input;
430
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
354
431
  return this.command("/public/v1/submit/export_wallet_account", {
355
432
  parameters: rest,
356
- organizationId: organizationId ?? this.config.organizationId,
433
+ organizationId: organizationId ??
434
+ currentUser?.organization?.organizationId ??
435
+ this.config.organizationId,
357
436
  timestampMs: timestampMs ?? String(Date.now()),
358
437
  type: "ACTIVITY_TYPE_EXPORT_WALLET_ACCOUNT",
359
438
  }, "exportWalletAccountResult");
360
439
  };
361
440
  this.importPrivateKey = async (input) => {
362
441
  const { organizationId, timestampMs, ...rest } = input;
442
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
363
443
  return this.command("/public/v1/submit/import_private_key", {
364
444
  parameters: rest,
365
- organizationId: organizationId ?? this.config.organizationId,
445
+ organizationId: organizationId ??
446
+ currentUser?.organization?.organizationId ??
447
+ this.config.organizationId,
366
448
  timestampMs: timestampMs ?? String(Date.now()),
367
449
  type: "ACTIVITY_TYPE_IMPORT_PRIVATE_KEY",
368
450
  }, "importPrivateKeyResult");
369
451
  };
370
452
  this.importWallet = async (input) => {
371
453
  const { organizationId, timestampMs, ...rest } = input;
454
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
372
455
  return this.command("/public/v1/submit/import_wallet", {
373
456
  parameters: rest,
374
- organizationId: organizationId ?? this.config.organizationId,
457
+ organizationId: organizationId ??
458
+ currentUser?.organization?.organizationId ??
459
+ this.config.organizationId,
375
460
  timestampMs: timestampMs ?? String(Date.now()),
376
461
  type: "ACTIVITY_TYPE_IMPORT_WALLET",
377
462
  }, "importWalletResult");
378
463
  };
379
464
  this.initImportPrivateKey = async (input) => {
380
465
  const { organizationId, timestampMs, ...rest } = input;
466
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
381
467
  return this.command("/public/v1/submit/init_import_private_key", {
382
468
  parameters: rest,
383
- organizationId: organizationId ?? this.config.organizationId,
469
+ organizationId: organizationId ??
470
+ currentUser?.organization?.organizationId ??
471
+ this.config.organizationId,
384
472
  timestampMs: timestampMs ?? String(Date.now()),
385
473
  type: "ACTIVITY_TYPE_INIT_IMPORT_PRIVATE_KEY",
386
474
  }, "initImportPrivateKeyResult");
387
475
  };
388
476
  this.initImportWallet = async (input) => {
389
477
  const { organizationId, timestampMs, ...rest } = input;
478
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
390
479
  return this.command("/public/v1/submit/init_import_wallet", {
391
480
  parameters: rest,
392
- organizationId: organizationId ?? this.config.organizationId,
481
+ organizationId: organizationId ??
482
+ currentUser?.organization?.organizationId ??
483
+ this.config.organizationId,
393
484
  timestampMs: timestampMs ?? String(Date.now()),
394
485
  type: "ACTIVITY_TYPE_INIT_IMPORT_WALLET",
395
486
  }, "initImportWalletResult");
396
487
  };
397
488
  this.initUserEmailRecovery = async (input) => {
398
489
  const { organizationId, timestampMs, ...rest } = input;
490
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
399
491
  return this.command("/public/v1/submit/init_user_email_recovery", {
400
492
  parameters: rest,
401
- organizationId: organizationId ?? this.config.organizationId,
493
+ organizationId: organizationId ??
494
+ currentUser?.organization?.organizationId ??
495
+ this.config.organizationId,
402
496
  timestampMs: timestampMs ?? String(Date.now()),
403
497
  type: "ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY",
404
498
  }, "initUserEmailRecoveryResult");
405
499
  };
406
500
  this.recoverUser = async (input) => {
407
501
  const { organizationId, timestampMs, ...rest } = input;
502
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
408
503
  return this.command("/public/v1/submit/recover_user", {
409
504
  parameters: rest,
410
- organizationId: organizationId ?? this.config.organizationId,
505
+ organizationId: organizationId ??
506
+ currentUser?.organization?.organizationId ??
507
+ this.config.organizationId,
411
508
  timestampMs: timestampMs ?? String(Date.now()),
412
509
  type: "ACTIVITY_TYPE_RECOVER_USER",
413
510
  }, "recoverUserResult");
414
511
  };
415
512
  this.rejectActivity = async (input) => {
416
513
  const { organizationId, timestampMs, ...rest } = input;
514
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
417
515
  return this.activityDecision("/public/v1/submit/reject_activity", {
418
516
  parameters: rest,
419
- organizationId: organizationId ?? this.config.organizationId,
517
+ organizationId: organizationId ??
518
+ currentUser?.organization?.organizationId ??
519
+ this.config.organizationId,
420
520
  timestampMs: timestampMs ?? String(Date.now()),
421
521
  type: "ACTIVITY_TYPE_REJECT_ACTIVITY",
422
522
  });
423
523
  };
424
524
  this.removeOrganizationFeature = async (input) => {
425
525
  const { organizationId, timestampMs, ...rest } = input;
526
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
426
527
  return this.command("/public/v1/submit/remove_organization_feature", {
427
528
  parameters: rest,
428
- organizationId: organizationId ?? this.config.organizationId,
529
+ organizationId: organizationId ??
530
+ currentUser?.organization?.organizationId ??
531
+ this.config.organizationId,
429
532
  timestampMs: timestampMs ?? String(Date.now()),
430
533
  type: "ACTIVITY_TYPE_REMOVE_ORGANIZATION_FEATURE",
431
534
  }, "removeOrganizationFeatureResult");
432
535
  };
433
536
  this.setOrganizationFeature = async (input) => {
434
537
  const { organizationId, timestampMs, ...rest } = input;
538
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
435
539
  return this.command("/public/v1/submit/set_organization_feature", {
436
540
  parameters: rest,
437
- organizationId: organizationId ?? this.config.organizationId,
541
+ organizationId: organizationId ??
542
+ currentUser?.organization?.organizationId ??
543
+ this.config.organizationId,
438
544
  timestampMs: timestampMs ?? String(Date.now()),
439
545
  type: "ACTIVITY_TYPE_SET_ORGANIZATION_FEATURE",
440
546
  }, "setOrganizationFeatureResult");
441
547
  };
442
548
  this.signRawPayload = async (input) => {
443
549
  const { organizationId, timestampMs, ...rest } = input;
550
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
444
551
  return this.command("/public/v1/submit/sign_raw_payload", {
445
552
  parameters: rest,
446
- organizationId: organizationId ?? this.config.organizationId,
553
+ organizationId: organizationId ??
554
+ currentUser?.organization?.organizationId ??
555
+ this.config.organizationId,
447
556
  timestampMs: timestampMs ?? String(Date.now()),
448
557
  type: "ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2",
449
558
  }, "signRawPayloadResult");
450
559
  };
451
560
  this.signRawPayloads = async (input) => {
452
561
  const { organizationId, timestampMs, ...rest } = input;
562
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
453
563
  return this.command("/public/v1/submit/sign_raw_payloads", {
454
564
  parameters: rest,
455
- organizationId: organizationId ?? this.config.organizationId,
565
+ organizationId: organizationId ??
566
+ currentUser?.organization?.organizationId ??
567
+ this.config.organizationId,
456
568
  timestampMs: timestampMs ?? String(Date.now()),
457
569
  type: "ACTIVITY_TYPE_SIGN_RAW_PAYLOADS",
458
570
  }, "signRawPayloadsResult");
459
571
  };
460
572
  this.signTransaction = async (input) => {
461
573
  const { organizationId, timestampMs, ...rest } = input;
574
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
462
575
  return this.command("/public/v1/submit/sign_transaction", {
463
576
  parameters: rest,
464
- organizationId: organizationId ?? this.config.organizationId,
577
+ organizationId: organizationId ??
578
+ currentUser?.organization?.organizationId ??
579
+ this.config.organizationId,
465
580
  timestampMs: timestampMs ?? String(Date.now()),
466
581
  type: "ACTIVITY_TYPE_SIGN_TRANSACTION_V2",
467
582
  }, "signTransactionResult");
468
583
  };
469
584
  this.updatePolicy = async (input) => {
470
585
  const { organizationId, timestampMs, ...rest } = input;
586
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
471
587
  return this.command("/public/v1/submit/update_policy", {
472
588
  parameters: rest,
473
- organizationId: organizationId ?? this.config.organizationId,
589
+ organizationId: organizationId ??
590
+ currentUser?.organization?.organizationId ??
591
+ this.config.organizationId,
474
592
  timestampMs: timestampMs ?? String(Date.now()),
475
593
  type: "ACTIVITY_TYPE_UPDATE_POLICY",
476
594
  }, "updatePolicyResult");
477
595
  };
478
596
  this.updatePrivateKeyTag = async (input) => {
479
597
  const { organizationId, timestampMs, ...rest } = input;
598
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
480
599
  return this.command("/public/v1/submit/update_private_key_tag", {
481
600
  parameters: rest,
482
- organizationId: organizationId ?? this.config.organizationId,
601
+ organizationId: organizationId ??
602
+ currentUser?.organization?.organizationId ??
603
+ this.config.organizationId,
483
604
  timestampMs: timestampMs ?? String(Date.now()),
484
605
  type: "ACTIVITY_TYPE_UPDATE_PRIVATE_KEY_TAG",
485
606
  }, "updatePrivateKeyTagResult");
486
607
  };
487
608
  this.updateRootQuorum = async (input) => {
488
609
  const { organizationId, timestampMs, ...rest } = input;
610
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
489
611
  return this.command("/public/v1/submit/update_root_quorum", {
490
612
  parameters: rest,
491
- organizationId: organizationId ?? this.config.organizationId,
613
+ organizationId: organizationId ??
614
+ currentUser?.organization?.organizationId ??
615
+ this.config.organizationId,
492
616
  timestampMs: timestampMs ?? String(Date.now()),
493
617
  type: "ACTIVITY_TYPE_UPDATE_ROOT_QUORUM",
494
618
  }, "updateRootQuorumResult");
495
619
  };
496
620
  this.updateUser = async (input) => {
497
621
  const { organizationId, timestampMs, ...rest } = input;
622
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
498
623
  return this.command("/public/v1/submit/update_user", {
499
624
  parameters: rest,
500
- organizationId: organizationId ?? this.config.organizationId,
625
+ organizationId: organizationId ??
626
+ currentUser?.organization?.organizationId ??
627
+ this.config.organizationId,
501
628
  timestampMs: timestampMs ?? String(Date.now()),
502
629
  type: "ACTIVITY_TYPE_UPDATE_USER",
503
630
  }, "updateUserResult");
504
631
  };
505
632
  this.updateUserTag = async (input) => {
506
633
  const { organizationId, timestampMs, ...rest } = input;
634
+ const currentUser = await getStorageValue(StorageKeys.CurrentUser);
507
635
  return this.command("/public/v1/submit/update_user_tag", {
508
636
  parameters: rest,
509
- organizationId: organizationId ?? this.config.organizationId,
637
+ organizationId: organizationId ??
638
+ currentUser?.organization?.organizationId ??
639
+ this.config.organizationId,
510
640
  timestampMs: timestampMs ?? String(Date.now()),
511
641
  type: "ACTIVITY_TYPE_UPDATE_USER_TAG",
512
642
  }, "updateUserTagResult");