@stackframe/stack 2.8.1 → 2.8.2

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.
@@ -519,14 +519,11 @@ var __StackClientAppImplIncomplete = class __StackClientAppImplIncomplete {
519
519
  clientMetadata: crud.client_metadata,
520
520
  clientReadOnlyMetadata: crud.client_read_only_metadata,
521
521
  async inviteUser(options) {
522
- if (!options.callbackUrl && !await app._getCurrentUrl()) {
523
- throw new Error("Cannot invite user without a callback URL from the server or without a redirect method. Make sure you pass the `callbackUrl` option: `inviteUser({ email, callbackUrl: ... })`");
524
- }
525
522
  await app._interface.sendTeamInvitation({
526
523
  teamId: crud.id,
527
524
  email: options.email,
528
525
  session,
529
- callbackUrl: options.callbackUrl ?? (0, import_url.constructRedirectUrl)(app.urls.teamInvitation)
526
+ callbackUrl: options.callbackUrl ?? (0, import_url.constructRedirectUrl)(app.urls.teamInvitation, "callbackUrl")
530
527
  });
531
528
  await app._teamInvitationsCache.refresh([session, crud.id]);
532
529
  },
@@ -565,8 +562,12 @@ var __StackClientAppImplIncomplete = class __StackClientAppImplIncomplete {
565
562
  isVerified: crud.is_verified,
566
563
  isPrimary: crud.is_primary,
567
564
  usedForAuth: crud.used_for_auth,
568
- async sendVerificationEmail() {
569
- await app._interface.sendCurrentUserContactChannelVerificationEmail(crud.id, (0, import_url.constructRedirectUrl)(app.urls.emailVerification), session);
565
+ async sendVerificationEmail(options) {
566
+ await app._interface.sendCurrentUserContactChannelVerificationEmail(
567
+ crud.id,
568
+ options?.callbackUrl || (0, import_url.constructRedirectUrl)(app.urls.emailVerification, "callbackUrl"),
569
+ session
570
+ );
570
571
  },
571
572
  async update(data) {
572
573
  await app._interface.updateClientContactChannel(crud.id, (0, import_contact_channels.contactChannelUpdateOptionsToCrud)(data), session);
@@ -668,6 +669,7 @@ var __StackClientAppImplIncomplete = class __StackClientAppImplIncomplete {
668
669
  oauthProviders: crud.oauth_providers,
669
670
  passkeyAuthEnabled: crud.passkey_auth_enabled,
670
671
  isMultiFactorRequired: crud.requires_totp_mfa,
672
+ isAnonymous: crud.is_anonymous,
671
673
  toClientJson() {
672
674
  return crud;
673
675
  }
@@ -794,10 +796,11 @@ var __StackClientAppImplIncomplete = class __StackClientAppImplIncomplete {
794
796
  if (!crud.primary_email) {
795
797
  throw new import_errors.StackAssertionError("User does not have a primary email");
796
798
  }
797
- if (!options?.callbackUrl && !await app._getCurrentUrl()) {
798
- throw new Error("Cannot send verification email without a callback URL from the server or without a redirect method. Make sure you pass the `callbackUrl` option: `sendVerificationEmail({ callbackUrl: ... })`");
799
- }
800
- return await app._interface.sendVerificationEmail(crud.primary_email, options?.callbackUrl ?? (0, import_url.constructRedirectUrl)(app.urls.emailVerification), session);
799
+ return await app._interface.sendVerificationEmail(
800
+ crud.primary_email,
801
+ options?.callbackUrl ?? (0, import_url.constructRedirectUrl)(app.urls.emailVerification, "callbackUrl"),
802
+ session
803
+ );
801
804
  },
802
805
  async updatePassword(options) {
803
806
  const result = await app._interface.updatePassword(options, session);
@@ -1017,16 +1020,10 @@ var __StackClientAppImplIncomplete = class __StackClientAppImplIncomplete {
1017
1020
  return await this._redirectToHandler("teamInvitation", options);
1018
1021
  }
1019
1022
  async sendForgotPasswordEmail(email, options) {
1020
- if (!options?.callbackUrl && !await this._getCurrentUrl()) {
1021
- throw new Error("Cannot send forgot password email without a callback URL from the server or without a redirect method. Make sure you pass the `callbackUrl` option: `sendForgotPasswordEmail({ email, callbackUrl: ... })`");
1022
- }
1023
- return await this._interface.sendForgotPasswordEmail(email, options?.callbackUrl ?? (0, import_url.constructRedirectUrl)(this.urls.passwordReset));
1023
+ return await this._interface.sendForgotPasswordEmail(email, options?.callbackUrl ?? (0, import_url.constructRedirectUrl)(this.urls.passwordReset, "callbackUrl"));
1024
1024
  }
1025
1025
  async sendMagicLinkEmail(email, options) {
1026
- if (!options?.callbackUrl && !await this._getCurrentUrl()) {
1027
- throw new Error("Cannot send magic link email without a callback URL from the server or without a redirect method. Make sure you pass the `callbackUrl` option: `sendMagicLinkEmail({ email, callbackUrl: ... })`");
1028
- }
1029
- return await this._interface.sendMagicLinkEmail(email, options?.callbackUrl ?? (0, import_url.constructRedirectUrl)(this.urls.magicLinkCallback));
1026
+ return await this._interface.sendMagicLinkEmail(email, options?.callbackUrl ?? (0, import_url.constructRedirectUrl)(this.urls.magicLinkCallback, "callbackUrl"));
1030
1027
  }
1031
1028
  async resetPassword(options) {
1032
1029
  return await this._interface.resetPassword(options);
@@ -1213,7 +1210,7 @@ var __StackClientAppImplIncomplete = class __StackClientAppImplIncomplete {
1213
1210
  async signUpWithCredential(options) {
1214
1211
  this._ensurePersistentTokenStore();
1215
1212
  const session = await this._getSession();
1216
- const emailVerificationRedirectUrl = options.verificationCallbackUrl ?? (0, import_url.constructRedirectUrl)(this.urls.emailVerification);
1213
+ const emailVerificationRedirectUrl = options.verificationCallbackUrl ?? (0, import_url.constructRedirectUrl)(this.urls.emailVerification, "verificationCallbackUrl");
1217
1214
  const result = await this._interface.signUpWithCredential(
1218
1215
  options.email,
1219
1216
  options.password,