@stackframe/js 2.7.19 → 2.7.21
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 +20 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/auth.js.map +1 -1
- package/dist/esm/lib/cookie.js +5 -8
- package/dist/esm/lib/cookie.js.map +1 -1
- package/dist/esm/lib/stack-app.js +20 -15
- package/dist/esm/lib/stack-app.js.map +1 -1
- package/dist/esm/utils/url.js +4 -13
- package/dist/esm/utils/url.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/auth.js.map +1 -1
- package/dist/lib/cookie.d.mts +2 -2
- package/dist/lib/cookie.d.ts +2 -2
- package/dist/lib/cookie.js +6 -9
- package/dist/lib/cookie.js.map +1 -1
- package/dist/lib/stack-app.d.mts +5 -1
- package/dist/lib/stack-app.d.ts +5 -1
- package/dist/lib/stack-app.js +19 -14
- package/dist/lib/stack-app.js.map +1 -1
- package/dist/utils/url.d.mts +1 -2
- package/dist/utils/url.d.ts +1 -2
- package/dist/utils/url.js +4 -14
- package/dist/utils/url.js.map +1 -1
- package/package.json +2 -3
- package/dist/esm/generated/global-css.js +0 -6
- package/dist/esm/generated/global-css.js.map +0 -1
- package/dist/esm/generated/quetzal-translations.js +0 -2397
- package/dist/esm/generated/quetzal-translations.js.map +0 -1
- package/dist/esm/global.d.js +0 -1
- package/dist/esm/global.d.js.map +0 -1
- package/dist/generated/global-css.d.mts +0 -3
- package/dist/generated/global-css.d.ts +0 -3
- package/dist/generated/global-css.js +0 -31
- package/dist/generated/global-css.js.map +0 -1
- package/dist/generated/quetzal-translations.d.mts +0 -4
- package/dist/generated/quetzal-translations.d.ts +0 -4
- package/dist/generated/quetzal-translations.js +0 -2423
- package/dist/generated/quetzal-translations.js.map +0 -1
- package/dist/global.d.d.mts +0 -2
- package/dist/global.d.d.ts +0 -2
- package/dist/global.d.js +0 -2
- package/dist/global.d.js.map +0 -1
|
@@ -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
|
-
import { createCookieHelper,
|
|
21
|
+
import { createCookieHelper, createPlaceholderCookieHelper, deleteCookieClient, getCookieClient, setOrDeleteCookie, setOrDeleteCookieClient } from "./cookie";
|
|
24
22
|
var isReactServer = false;
|
|
25
|
-
var
|
|
26
|
-
var clientVersion = "js @stackframe/js@2.7.19";
|
|
23
|
+
var clientVersion = "js @stackframe/js@2.7.21";
|
|
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
|
}
|
|
@@ -186,6 +183,7 @@ var _StackClientAppImpl = class __StackClientAppImpl {
|
|
|
186
183
|
}
|
|
187
184
|
);
|
|
188
185
|
this._memoryTokenStore = createEmptyTokenStore();
|
|
186
|
+
this._nextServerCookiesTokenStores = /* @__PURE__ */ new WeakMap();
|
|
189
187
|
this._requestTokenStores = /* @__PURE__ */ new WeakMap();
|
|
190
188
|
this._storedBrowserCookieTokenStore = null;
|
|
191
189
|
/**
|
|
@@ -204,7 +202,9 @@ var _StackClientAppImpl = class __StackClientAppImpl {
|
|
|
204
202
|
getBaseUrl: () => getBaseUrl(_options.baseUrl),
|
|
205
203
|
projectId: _options.projectId ?? getDefaultProjectId(),
|
|
206
204
|
clientVersion,
|
|
207
|
-
publishableClientKey: _options.publishableClientKey ?? getDefaultPublishableClientKey()
|
|
205
|
+
publishableClientKey: _options.publishableClientKey ?? getDefaultPublishableClientKey(),
|
|
206
|
+
prepareRequest: async () => {
|
|
207
|
+
}
|
|
208
208
|
});
|
|
209
209
|
}
|
|
210
210
|
this._tokenStoreInit = _options.tokenStore;
|
|
@@ -226,7 +226,7 @@ var _StackClientAppImpl = class __StackClientAppImpl {
|
|
|
226
226
|
if (this._tokenStoreInit === "nextjs-cookie" || this._tokenStoreInit === "cookie") {
|
|
227
227
|
return await createCookieHelper();
|
|
228
228
|
} else {
|
|
229
|
-
return await
|
|
229
|
+
return await createPlaceholderCookieHelper();
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
async _getUserOAuthConnectionCacheFn(options) {
|
|
@@ -815,17 +815,16 @@ var _StackClientAppImpl = class __StackClientAppImpl {
|
|
|
815
815
|
async _redirectTo(options) {
|
|
816
816
|
if (this._redirectMethod === "none") {
|
|
817
817
|
return;
|
|
818
|
-
}
|
|
819
|
-
|
|
820
|
-
NextNavigation.redirect(options.url.toString(), options.replace ? NextNavigation.RedirectType.replace : NextNavigation.RedirectType.push);
|
|
818
|
+
} else if (typeof this._redirectMethod === "object" && this._redirectMethod.navigate) {
|
|
819
|
+
this._redirectMethod.navigate(options.url.toString());
|
|
821
820
|
} else {
|
|
822
821
|
if (options.replace) {
|
|
823
822
|
window.location.replace(options.url);
|
|
824
823
|
} else {
|
|
825
824
|
window.location.assign(options.url);
|
|
826
825
|
}
|
|
827
|
-
await wait(2e3);
|
|
828
826
|
}
|
|
827
|
+
await wait(2e3);
|
|
829
828
|
}
|
|
830
829
|
async _redirectIfTrusted(url, options) {
|
|
831
830
|
if (!await this._isTrusted(url)) {
|
|
@@ -1065,7 +1064,7 @@ var _StackClientAppImpl = class __StackClientAppImpl {
|
|
|
1065
1064
|
async signUpWithCredential(options) {
|
|
1066
1065
|
this._ensurePersistentTokenStore();
|
|
1067
1066
|
const session = await this._getSession();
|
|
1068
|
-
const emailVerificationRedirectUrl = constructRedirectUrl(this.urls.emailVerification);
|
|
1067
|
+
const emailVerificationRedirectUrl = options.verificationCallbackUrl ?? constructRedirectUrl(this.urls.emailVerification);
|
|
1069
1068
|
const result = await this._interface.signUpWithCredential(
|
|
1070
1069
|
options.email,
|
|
1071
1070
|
options.password,
|
|
@@ -1252,6 +1251,9 @@ var _StackClientAppImpl = class __StackClientAppImpl {
|
|
|
1252
1251
|
if (!("publishableClientKey" in this._interface.options)) {
|
|
1253
1252
|
throw new StackAssertionError("Cannot serialize to JSON from an application without a publishable client key");
|
|
1254
1253
|
}
|
|
1254
|
+
if (typeof this._redirectMethod !== "string") {
|
|
1255
|
+
throw new StackAssertionError("Cannot serialize to JSON from an application with a non-string redirect method");
|
|
1256
|
+
}
|
|
1255
1257
|
return {
|
|
1256
1258
|
baseUrl: this._options.baseUrl,
|
|
1257
1259
|
projectId: this.projectId,
|
|
@@ -1259,7 +1261,8 @@ var _StackClientAppImpl = class __StackClientAppImpl {
|
|
|
1259
1261
|
tokenStore: this._tokenStoreInit,
|
|
1260
1262
|
urls: this._urlOptions,
|
|
1261
1263
|
oauthScopesOnSignIn: this._oauthScopesOnSignIn,
|
|
1262
|
-
uniqueIdentifier: this._getUniqueIdentifier()
|
|
1264
|
+
uniqueIdentifier: this._getUniqueIdentifier(),
|
|
1265
|
+
redirectMethod: this._redirectMethod
|
|
1263
1266
|
};
|
|
1264
1267
|
},
|
|
1265
1268
|
setCurrentUser: (userJsonPromise) => {
|
|
@@ -1293,7 +1296,8 @@ var _StackServerAppImpl = class extends _StackClientAppImpl {
|
|
|
1293
1296
|
publishableClientKey: options.publishableClientKey,
|
|
1294
1297
|
tokenStore: options.tokenStore,
|
|
1295
1298
|
urls: options.urls ?? {},
|
|
1296
|
-
oauthScopesOnSignIn: options.oauthScopesOnSignIn ?? {}
|
|
1299
|
+
oauthScopesOnSignIn: options.oauthScopesOnSignIn ?? {},
|
|
1300
|
+
redirectMethod: options.redirectMethod
|
|
1297
1301
|
});
|
|
1298
1302
|
// TODO override the client user cache to use the server user cache, so we save some requests
|
|
1299
1303
|
this._currentServerUserCache = createCacheBySession(async (session) => {
|
|
@@ -1708,7 +1712,8 @@ var _StackAdminAppImpl = class extends _StackServerAppImpl {
|
|
|
1708
1712
|
projectId: options.projectId,
|
|
1709
1713
|
tokenStore: options.tokenStore,
|
|
1710
1714
|
urls: options.urls,
|
|
1711
|
-
oauthScopesOnSignIn: options.oauthScopesOnSignIn
|
|
1715
|
+
oauthScopesOnSignIn: options.oauthScopesOnSignIn,
|
|
1716
|
+
redirectMethod: options.redirectMethod
|
|
1712
1717
|
});
|
|
1713
1718
|
this._adminProjectCache = createCache(async () => {
|
|
1714
1719
|
return await this._interface.getProject();
|