@stackframe/js 2.7.8 → 2.7.14

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.
@@ -301,7 +301,7 @@ type UserUpdateOptions = {
301
301
  passkeyAuthEnabled?: boolean;
302
302
  };
303
303
  type ServerBaseUser = {
304
- setPrimaryEmail(email: string, options?: {
304
+ setPrimaryEmail(email: string | null, options?: {
305
305
  verified?: boolean | undefined;
306
306
  }): Promise<void>;
307
307
  readonly lastActiveAt: Date;
@@ -332,7 +332,7 @@ type ServerUser = ServerBaseUser & BaseUser & UserExtra;
332
332
  type CurrentServerUser = Auth & ServerUser;
333
333
  type CurrentInternalServerUser = CurrentServerUser & InternalUserExtra;
334
334
  type ServerUserUpdateOptions = {
335
- primaryEmail?: string;
335
+ primaryEmail?: string | null;
336
336
  primaryEmailVerified?: boolean;
337
337
  primaryEmailAuthEnabled?: boolean;
338
338
  clientReadOnlyMetadata?: ReadonlyJson;
@@ -340,7 +340,7 @@ type ServerUserUpdateOptions = {
340
340
  password?: string;
341
341
  } & UserUpdateOptions;
342
342
  type ServerUserCreateOptions = {
343
- primaryEmail?: string;
343
+ primaryEmail?: string | null;
344
344
  primaryEmailAuthEnabled?: boolean;
345
345
  password?: string;
346
346
  otpAuthEnabled?: boolean;
@@ -62,7 +62,7 @@ var import_url = require("../utils/url");
62
62
  var import_auth = require("./auth");
63
63
  var import_cookie = require("./cookie");
64
64
  var NextNavigation = (0, import_compile_time.scrambleDuringCompileTime)(NextNavigationUnscrambled);
65
- var clientVersion = "js @stackframe/js@2.7.8";
65
+ var clientVersion = "js @stackframe/js@2.7.14";
66
66
  function getUrls(partial) {
67
67
  const handler = partial.handler ?? "/handler";
68
68
  const home = partial.home ?? "/";
@@ -100,7 +100,8 @@ function getDefaultSuperSecretAdminKey() {
100
100
  return process.env.STACK_SUPER_SECRET_ADMIN_KEY || (0, import_errors.throwErr)(new Error("No super secret admin key provided. Please copy your key from the Stack dashboard and put it in the STACK_SUPER_SECRET_ADMIN_KEY environment variable."));
101
101
  }
102
102
  function getDefaultBaseUrl() {
103
- return process.env.NEXT_PUBLIC_STACK_API_URL || process.env.NEXT_PUBLIC_STACK_URL || defaultBaseUrl;
103
+ const url = process.env.NEXT_PUBLIC_STACK_API_URL || process.env.NEXT_PUBLIC_STACK_URL || defaultBaseUrl;
104
+ return url.endsWith("/") ? url.slice(0, -1) : url;
104
105
  }
105
106
  var defaultBaseUrl = "https://api.stack-auth.com";
106
107
  function createEmptyTokenStore() {
@@ -1172,8 +1173,10 @@ var _StackClientAppImpl = class __StackClientAppImpl {
1172
1173
  } catch (e) {
1173
1174
  if (e instanceof import_stack_shared.KnownErrors.InvalidTotpCode) {
1174
1175
  alert("Invalid TOTP code. Please try signing in again.");
1176
+ return false;
1177
+ } else {
1178
+ throw e;
1175
1179
  }
1176
- throw e;
1177
1180
  }
1178
1181
  if (result.status === "ok" && result.data) {
1179
1182
  await this._signInToAccountWithTokens(result.data);
@@ -1697,7 +1700,9 @@ var _StackServerAppImpl = class extends _StackClientAppImpl {
1697
1700
  async _refreshUsers() {
1698
1701
  await Promise.all([
1699
1702
  super._refreshUsers(),
1700
- this._serverUsersCache.refreshWhere(() => true)
1703
+ this._serverUserCache.refreshWhere(() => true),
1704
+ this._serverUsersCache.refreshWhere(() => true),
1705
+ this._serverContactChannelsCache.refreshWhere(() => true)
1701
1706
  ]);
1702
1707
  }
1703
1708
  };