@stackframe/js 2.7.19 → 2.7.20

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.
@@ -44,7 +44,6 @@ var import_production_mode = require("@stackframe/stack-shared/dist/helpers/prod
44
44
  var import_sessions = require("@stackframe/stack-shared/dist/sessions");
45
45
  var import_bytes = require("@stackframe/stack-shared/dist/utils/bytes");
46
46
  var import_caches = require("@stackframe/stack-shared/dist/utils/caches");
47
- var import_compile_time = require("@stackframe/stack-shared/dist/utils/compile-time");
48
47
  var import_env = require("@stackframe/stack-shared/dist/utils/env");
49
48
  var import_errors = require("@stackframe/stack-shared/dist/utils/errors");
50
49
  var import_maps = require("@stackframe/stack-shared/dist/utils/maps");
@@ -56,13 +55,11 @@ var import_strings = require("@stackframe/stack-shared/dist/utils/strings");
56
55
  var import_urls = require("@stackframe/stack-shared/dist/utils/urls");
57
56
  var import_uuids = require("@stackframe/stack-shared/dist/utils/uuids");
58
57
  var cookie = __toESM(require("cookie"));
59
- var NextNavigationUnscrambled = __toESM(require("next/navigation"));
60
58
  var import_url = require("../utils/url");
61
59
  var import_auth = require("./auth");
62
60
  var import_cookie = require("./cookie");
63
61
  var isReactServer = false;
64
- var NextNavigation = (0, import_compile_time.scrambleDuringCompileTime)(NextNavigationUnscrambled);
65
- var clientVersion = "js @stackframe/js@2.7.19";
62
+ var clientVersion = "js @stackframe/js@2.7.20";
66
63
  if (clientVersion.startsWith("STACK_COMPILE_TIME")) {
67
64
  throw new import_errors.StackAssertionError("Client version was not replaced. Something went wrong during build!");
68
65
  }
@@ -243,7 +240,9 @@ var _StackClientAppImpl = class __StackClientAppImpl {
243
240
  getBaseUrl: () => getBaseUrl(_options.baseUrl),
244
241
  projectId: _options.projectId ?? getDefaultProjectId(),
245
242
  clientVersion,
246
- publishableClientKey: _options.publishableClientKey ?? getDefaultPublishableClientKey()
243
+ publishableClientKey: _options.publishableClientKey ?? getDefaultPublishableClientKey(),
244
+ prepareRequest: async () => {
245
+ }
247
246
  });
248
247
  }
249
248
  this._tokenStoreInit = _options.tokenStore;
@@ -854,17 +853,16 @@ var _StackClientAppImpl = class __StackClientAppImpl {
854
853
  async _redirectTo(options) {
855
854
  if (this._redirectMethod === "none") {
856
855
  return;
857
- }
858
- if (isReactServer && this._redirectMethod === "nextjs") {
859
- NextNavigation.redirect(options.url.toString(), options.replace ? NextNavigation.RedirectType.replace : NextNavigation.RedirectType.push);
856
+ } else if (typeof this._redirectMethod === "object" && this._redirectMethod.navigate) {
857
+ this._redirectMethod.navigate(options.url.toString());
860
858
  } else {
861
859
  if (options.replace) {
862
860
  window.location.replace(options.url);
863
861
  } else {
864
862
  window.location.assign(options.url);
865
863
  }
866
- await (0, import_promises.wait)(2e3);
867
864
  }
865
+ await (0, import_promises.wait)(2e3);
868
866
  }
869
867
  async _redirectIfTrusted(url, options) {
870
868
  if (!await this._isTrusted(url)) {
@@ -1291,6 +1289,9 @@ var _StackClientAppImpl = class __StackClientAppImpl {
1291
1289
  if (!("publishableClientKey" in this._interface.options)) {
1292
1290
  throw new import_errors.StackAssertionError("Cannot serialize to JSON from an application without a publishable client key");
1293
1291
  }
1292
+ if (typeof this._redirectMethod !== "string") {
1293
+ throw new import_errors.StackAssertionError("Cannot serialize to JSON from an application with a non-string redirect method");
1294
+ }
1294
1295
  return {
1295
1296
  baseUrl: this._options.baseUrl,
1296
1297
  projectId: this.projectId,
@@ -1298,7 +1299,8 @@ var _StackClientAppImpl = class __StackClientAppImpl {
1298
1299
  tokenStore: this._tokenStoreInit,
1299
1300
  urls: this._urlOptions,
1300
1301
  oauthScopesOnSignIn: this._oauthScopesOnSignIn,
1301
- uniqueIdentifier: this._getUniqueIdentifier()
1302
+ uniqueIdentifier: this._getUniqueIdentifier(),
1303
+ redirectMethod: this._redirectMethod
1302
1304
  };
1303
1305
  },
1304
1306
  setCurrentUser: (userJsonPromise) => {
@@ -1332,7 +1334,8 @@ var _StackServerAppImpl = class extends _StackClientAppImpl {
1332
1334
  publishableClientKey: options.publishableClientKey,
1333
1335
  tokenStore: options.tokenStore,
1334
1336
  urls: options.urls ?? {},
1335
- oauthScopesOnSignIn: options.oauthScopesOnSignIn ?? {}
1337
+ oauthScopesOnSignIn: options.oauthScopesOnSignIn ?? {},
1338
+ redirectMethod: options.redirectMethod
1336
1339
  });
1337
1340
  // TODO override the client user cache to use the server user cache, so we save some requests
1338
1341
  this._currentServerUserCache = createCacheBySession(async (session) => {
@@ -1747,7 +1750,8 @@ var _StackAdminAppImpl = class extends _StackServerAppImpl {
1747
1750
  projectId: options.projectId,
1748
1751
  tokenStore: options.tokenStore,
1749
1752
  urls: options.urls,
1750
- oauthScopesOnSignIn: options.oauthScopesOnSignIn
1753
+ oauthScopesOnSignIn: options.oauthScopesOnSignIn,
1754
+ redirectMethod: options.redirectMethod
1751
1755
  });
1752
1756
  this._adminProjectCache = createCache(async () => {
1753
1757
  return await this._interface.getProject();