@stackframe/js 2.7.18 → 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.
- package/CHANGELOG.md +18 -0
- package/dist/esm/generated/global-css.js +1 -1
- package/dist/esm/generated/global-css.js.map +1 -1
- package/dist/esm/lib/stack-app.js +17 -15
- package/dist/esm/lib/stack-app.js.map +1 -1
- package/dist/generated/global-css.d.mts +1 -1
- package/dist/generated/global-css.d.ts +1 -1
- package/dist/generated/global-css.js +1 -1
- package/dist/generated/global-css.js.map +1 -1
- package/dist/lib/stack-app.d.mts +4 -3
- package/dist/lib/stack-app.d.ts +4 -3
- package/dist/lib/stack-app.js +17 -15
- package/dist/lib/stack-app.js.map +1 -1
- package/package.json +2 -3
|
@@ -5,7 +5,6 @@ import { getProductionModeErrors } from "@stackframe/stack-shared/dist/helpers/p
|
|
|
5
5
|
import { InternalSession } from "@stackframe/stack-shared/dist/sessions";
|
|
6
6
|
import { encodeBase64 } from "@stackframe/stack-shared/dist/utils/bytes";
|
|
7
7
|
import { AsyncCache } from "@stackframe/stack-shared/dist/utils/caches";
|
|
8
|
-
import { scrambleDuringCompileTime } from "@stackframe/stack-shared/dist/utils/compile-time";
|
|
9
8
|
import { isBrowserLike } from "@stackframe/stack-shared/dist/utils/env";
|
|
10
9
|
import { StackAssertionError, throwErr } from "@stackframe/stack-shared/dist/utils/errors";
|
|
11
10
|
import { DependenciesMap } from "@stackframe/stack-shared/dist/utils/maps";
|
|
@@ -17,13 +16,11 @@ import { mergeScopeStrings } from "@stackframe/stack-shared/dist/utils/strings";
|
|
|
17
16
|
import { getRelativePart, isRelative } from "@stackframe/stack-shared/dist/utils/urls";
|
|
18
17
|
import { generateUuid } from "@stackframe/stack-shared/dist/utils/uuids";
|
|
19
18
|
import * as cookie from "cookie";
|
|
20
|
-
import * as NextNavigationUnscrambled from "next/navigation";
|
|
21
19
|
import { constructRedirectUrl } from "../utils/url";
|
|
22
20
|
import { addNewOAuthProviderOrScope, callOAuthCallback, signInWithOAuth } from "./auth";
|
|
23
21
|
import { createCookieHelper, createEmptyCookieHelper, deleteCookieClient, getCookieClient, setOrDeleteCookie, setOrDeleteCookieClient } from "./cookie";
|
|
24
22
|
var isReactServer = false;
|
|
25
|
-
var
|
|
26
|
-
var clientVersion = "js @stackframe/js@2.7.18";
|
|
23
|
+
var clientVersion = "js @stackframe/js@2.7.20";
|
|
27
24
|
if (clientVersion.startsWith("STACK_COMPILE_TIME")) {
|
|
28
25
|
throw new StackAssertionError("Client version was not replaced. Something went wrong during build!");
|
|
29
26
|
}
|
|
@@ -204,7 +201,9 @@ var _StackClientAppImpl = class __StackClientAppImpl {
|
|
|
204
201
|
getBaseUrl: () => getBaseUrl(_options.baseUrl),
|
|
205
202
|
projectId: _options.projectId ?? getDefaultProjectId(),
|
|
206
203
|
clientVersion,
|
|
207
|
-
publishableClientKey: _options.publishableClientKey ?? getDefaultPublishableClientKey()
|
|
204
|
+
publishableClientKey: _options.publishableClientKey ?? getDefaultPublishableClientKey(),
|
|
205
|
+
prepareRequest: async () => {
|
|
206
|
+
}
|
|
208
207
|
});
|
|
209
208
|
}
|
|
210
209
|
this._tokenStoreInit = _options.tokenStore;
|
|
@@ -815,17 +814,16 @@ var _StackClientAppImpl = class __StackClientAppImpl {
|
|
|
815
814
|
async _redirectTo(options) {
|
|
816
815
|
if (this._redirectMethod === "none") {
|
|
817
816
|
return;
|
|
818
|
-
}
|
|
819
|
-
|
|
820
|
-
NextNavigation.redirect(options.url.toString(), options.replace ? NextNavigation.RedirectType.replace : NextNavigation.RedirectType.push);
|
|
817
|
+
} else if (typeof this._redirectMethod === "object" && this._redirectMethod.navigate) {
|
|
818
|
+
this._redirectMethod.navigate(options.url.toString());
|
|
821
819
|
} else {
|
|
822
820
|
if (options.replace) {
|
|
823
821
|
window.location.replace(options.url);
|
|
824
822
|
} else {
|
|
825
823
|
window.location.assign(options.url);
|
|
826
824
|
}
|
|
827
|
-
await wait(2e3);
|
|
828
825
|
}
|
|
826
|
+
await wait(2e3);
|
|
829
827
|
}
|
|
830
828
|
async _redirectIfTrusted(url, options) {
|
|
831
829
|
if (!await this._isTrusted(url)) {
|
|
@@ -1252,6 +1250,9 @@ var _StackClientAppImpl = class __StackClientAppImpl {
|
|
|
1252
1250
|
if (!("publishableClientKey" in this._interface.options)) {
|
|
1253
1251
|
throw new StackAssertionError("Cannot serialize to JSON from an application without a publishable client key");
|
|
1254
1252
|
}
|
|
1253
|
+
if (typeof this._redirectMethod !== "string") {
|
|
1254
|
+
throw new StackAssertionError("Cannot serialize to JSON from an application with a non-string redirect method");
|
|
1255
|
+
}
|
|
1255
1256
|
return {
|
|
1256
1257
|
baseUrl: this._options.baseUrl,
|
|
1257
1258
|
projectId: this.projectId,
|
|
@@ -1259,7 +1260,8 @@ var _StackClientAppImpl = class __StackClientAppImpl {
|
|
|
1259
1260
|
tokenStore: this._tokenStoreInit,
|
|
1260
1261
|
urls: this._urlOptions,
|
|
1261
1262
|
oauthScopesOnSignIn: this._oauthScopesOnSignIn,
|
|
1262
|
-
uniqueIdentifier: this._getUniqueIdentifier()
|
|
1263
|
+
uniqueIdentifier: this._getUniqueIdentifier(),
|
|
1264
|
+
redirectMethod: this._redirectMethod
|
|
1263
1265
|
};
|
|
1264
1266
|
},
|
|
1265
1267
|
setCurrentUser: (userJsonPromise) => {
|
|
@@ -1293,7 +1295,8 @@ var _StackServerAppImpl = class extends _StackClientAppImpl {
|
|
|
1293
1295
|
publishableClientKey: options.publishableClientKey,
|
|
1294
1296
|
tokenStore: options.tokenStore,
|
|
1295
1297
|
urls: options.urls ?? {},
|
|
1296
|
-
oauthScopesOnSignIn: options.oauthScopesOnSignIn ?? {}
|
|
1298
|
+
oauthScopesOnSignIn: options.oauthScopesOnSignIn ?? {},
|
|
1299
|
+
redirectMethod: options.redirectMethod
|
|
1297
1300
|
});
|
|
1298
1301
|
// TODO override the client user cache to use the server user cache, so we save some requests
|
|
1299
1302
|
this._currentServerUserCache = createCacheBySession(async (session) => {
|
|
@@ -1708,7 +1711,8 @@ var _StackAdminAppImpl = class extends _StackServerAppImpl {
|
|
|
1708
1711
|
projectId: options.projectId,
|
|
1709
1712
|
tokenStore: options.tokenStore,
|
|
1710
1713
|
urls: options.urls,
|
|
1711
|
-
oauthScopesOnSignIn: options.oauthScopesOnSignIn
|
|
1714
|
+
oauthScopesOnSignIn: options.oauthScopesOnSignIn,
|
|
1715
|
+
redirectMethod: options.redirectMethod
|
|
1712
1716
|
});
|
|
1713
1717
|
this._adminProjectCache = createCache(async () => {
|
|
1714
1718
|
return await this._interface.getProject();
|
|
@@ -1757,7 +1761,6 @@ var _StackAdminAppImpl = class extends _StackServerAppImpl {
|
|
|
1757
1761
|
credentialEnabled: data.config.credential_enabled,
|
|
1758
1762
|
magicLinkEnabled: data.config.magic_link_enabled,
|
|
1759
1763
|
passkeyEnabled: data.config.passkey_enabled,
|
|
1760
|
-
legacyGlobalJwtSigning: data.config.legacy_global_jwt_signing,
|
|
1761
1764
|
clientTeamCreationEnabled: data.config.client_team_creation_enabled,
|
|
1762
1765
|
clientUserDeletionEnabled: data.config.client_user_deletion_enabled,
|
|
1763
1766
|
allowLocalhost: data.config.allow_localhost,
|
|
@@ -2040,8 +2043,7 @@ function adminProjectUpdateOptionsToCrud(options) {
|
|
|
2040
2043
|
client_team_creation_enabled: options.config?.clientTeamCreationEnabled,
|
|
2041
2044
|
client_user_deletion_enabled: options.config?.clientUserDeletionEnabled,
|
|
2042
2045
|
team_creator_default_permissions: options.config?.teamCreatorDefaultPermissions,
|
|
2043
|
-
team_member_default_permissions: options.config?.teamMemberDefaultPermissions
|
|
2044
|
-
legacy_global_jwt_signing: options.config?.legacyGlobalJwtSigning
|
|
2046
|
+
team_member_default_permissions: options.config?.teamMemberDefaultPermissions
|
|
2045
2047
|
}
|
|
2046
2048
|
};
|
|
2047
2049
|
}
|