@stackframe/stack 2.7.14 → 2.7.16
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 +19 -0
- package/dist/components/iframe-preventer.d.mts +8 -0
- package/dist/components/iframe-preventer.d.ts +8 -0
- package/dist/components/iframe-preventer.js +52 -0
- package/dist/components/iframe-preventer.js.map +1 -0
- package/dist/components-page/stack-handler.js +3 -2
- package/dist/components-page/stack-handler.js.map +1 -1
- package/dist/esm/components/iframe-preventer.js +28 -0
- package/dist/esm/components/iframe-preventer.js.map +1 -0
- package/dist/esm/components-page/stack-handler.js +3 -2
- package/dist/esm/components-page/stack-handler.js.map +1 -1
- package/dist/esm/lib/stack-app.js +27 -22
- package/dist/esm/lib/stack-app.js.map +1 -1
- package/dist/lib/stack-app.d.mts +7 -1
- package/dist/lib/stack-app.d.ts +7 -1
- package/dist/lib/stack-app.js +26 -21
- package/dist/lib/stack-app.js.map +1 -1
- package/package.json +4 -4
package/dist/lib/stack-app.d.mts
CHANGED
|
@@ -318,6 +318,7 @@ type ServerBaseUser = {
|
|
|
318
318
|
readonly serverMetadata: any;
|
|
319
319
|
setServerMetadata(metadata: any): Promise<void>;
|
|
320
320
|
setClientReadOnlyMetadata(metadata: any): Promise<void>;
|
|
321
|
+
createTeam(data: Omit<ServerTeamCreateOptions, "creatorUserId">): Promise<ServerTeam>;
|
|
321
322
|
useContactChannels(): ServerContactChannel[];
|
|
322
323
|
listContactChannels(): Promise<ServerContactChannel[]>;
|
|
323
324
|
createContactChannel(data: ServerContactChannelCreateOptions): Promise<ServerContactChannel>;
|
|
@@ -357,6 +358,9 @@ type ServerUserCreateOptions = {
|
|
|
357
358
|
otpAuthEnabled?: boolean;
|
|
358
359
|
displayName?: string;
|
|
359
360
|
primaryEmailVerified?: boolean;
|
|
361
|
+
clientMetadata?: any;
|
|
362
|
+
clientReadOnlyMetadata?: any;
|
|
363
|
+
serverMetadata?: any;
|
|
360
364
|
};
|
|
361
365
|
type Project = {
|
|
362
366
|
readonly id: string;
|
|
@@ -573,7 +577,9 @@ type ServerListUsersOptions = {
|
|
|
573
577
|
desc?: boolean;
|
|
574
578
|
query?: string;
|
|
575
579
|
};
|
|
576
|
-
type ServerTeamCreateOptions = TeamCreateOptions
|
|
580
|
+
type ServerTeamCreateOptions = TeamCreateOptions & {
|
|
581
|
+
creatorUserId?: string;
|
|
582
|
+
};
|
|
577
583
|
type ServerTeamUpdateOptions = TeamUpdateOptions & {
|
|
578
584
|
clientReadOnlyMetadata?: ReadonlyJson;
|
|
579
585
|
serverMetadata?: ReadonlyJson;
|
package/dist/lib/stack-app.d.ts
CHANGED
|
@@ -318,6 +318,7 @@ type ServerBaseUser = {
|
|
|
318
318
|
readonly serverMetadata: any;
|
|
319
319
|
setServerMetadata(metadata: any): Promise<void>;
|
|
320
320
|
setClientReadOnlyMetadata(metadata: any): Promise<void>;
|
|
321
|
+
createTeam(data: Omit<ServerTeamCreateOptions, "creatorUserId">): Promise<ServerTeam>;
|
|
321
322
|
useContactChannels(): ServerContactChannel[];
|
|
322
323
|
listContactChannels(): Promise<ServerContactChannel[]>;
|
|
323
324
|
createContactChannel(data: ServerContactChannelCreateOptions): Promise<ServerContactChannel>;
|
|
@@ -357,6 +358,9 @@ type ServerUserCreateOptions = {
|
|
|
357
358
|
otpAuthEnabled?: boolean;
|
|
358
359
|
displayName?: string;
|
|
359
360
|
primaryEmailVerified?: boolean;
|
|
361
|
+
clientMetadata?: any;
|
|
362
|
+
clientReadOnlyMetadata?: any;
|
|
363
|
+
serverMetadata?: any;
|
|
360
364
|
};
|
|
361
365
|
type Project = {
|
|
362
366
|
readonly id: string;
|
|
@@ -573,7 +577,9 @@ type ServerListUsersOptions = {
|
|
|
573
577
|
desc?: boolean;
|
|
574
578
|
query?: string;
|
|
575
579
|
};
|
|
576
|
-
type ServerTeamCreateOptions = TeamCreateOptions
|
|
580
|
+
type ServerTeamCreateOptions = TeamCreateOptions & {
|
|
581
|
+
creatorUserId?: string;
|
|
582
|
+
};
|
|
577
583
|
type ServerTeamUpdateOptions = TeamUpdateOptions & {
|
|
578
584
|
clientReadOnlyMetadata?: ReadonlyJson;
|
|
579
585
|
serverMetadata?: ReadonlyJson;
|
package/dist/lib/stack-app.js
CHANGED
|
@@ -64,7 +64,7 @@ var import_url = require("../utils/url");
|
|
|
64
64
|
var import_auth = require("./auth");
|
|
65
65
|
var import_cookie = require("./cookie");
|
|
66
66
|
var NextNavigation = (0, import_compile_time.scrambleDuringCompileTime)(NextNavigationUnscrambled);
|
|
67
|
-
var clientVersion = "js @stackframe/stack@2.7.
|
|
67
|
+
var clientVersion = "js @stackframe/stack@2.7.16";
|
|
68
68
|
function getUrls(partial) {
|
|
69
69
|
const handler = partial.handler ?? "/handler";
|
|
70
70
|
const home = partial.home ?? "/";
|
|
@@ -90,10 +90,10 @@ function getUrls(partial) {
|
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
92
|
function getDefaultProjectId() {
|
|
93
|
-
return
|
|
93
|
+
return (0, import_env.getPublicEnvVar)("NEXT_PUBLIC_STACK_PROJECT_ID") || (0, import_errors.throwErr)(new Error("Welcome to Stack Auth! It seems that you haven't provided a project ID. Please create a project on the Stack dashboard at https://app.stack-auth.com and put it in the NEXT_PUBLIC_STACK_PROJECT_ID environment variable."));
|
|
94
94
|
}
|
|
95
95
|
function getDefaultPublishableClientKey() {
|
|
96
|
-
return
|
|
96
|
+
return (0, import_env.getPublicEnvVar)("NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY") || (0, import_errors.throwErr)(new Error("Welcome to Stack Auth! It seems that you haven't provided a publishable client key. Please create an API key for your project on the Stack dashboard at https://app.stack-auth.com and copy your publishable client key into the NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY environment variable."));
|
|
97
97
|
}
|
|
98
98
|
function getDefaultSecretServerKey() {
|
|
99
99
|
return process.env.STACK_SECRET_SERVER_KEY || (0, import_errors.throwErr)(new Error("No secret server key provided. Please copy your key from the Stack dashboard and put your it in the STACK_SECRET_SERVER_KEY environment variable."));
|
|
@@ -102,7 +102,7 @@ function getDefaultSuperSecretAdminKey() {
|
|
|
102
102
|
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."));
|
|
103
103
|
}
|
|
104
104
|
function getDefaultBaseUrl() {
|
|
105
|
-
const url =
|
|
105
|
+
const url = (0, import_env.getPublicEnvVar)("NEXT_PUBLIC_STACK_API_URL") || (0, import_env.getPublicEnvVar)("NEXT_PUBLIC_STACK_URL") || defaultBaseUrl;
|
|
106
106
|
return url.endsWith("/") ? url.slice(0, -1) : url;
|
|
107
107
|
}
|
|
108
108
|
var defaultBaseUrl = "https://api.stack-auth.com";
|
|
@@ -254,7 +254,7 @@ var _StackClientAppImpl = class __StackClientAppImpl {
|
|
|
254
254
|
this._interface = _options.interface;
|
|
255
255
|
} else {
|
|
256
256
|
this._interface = new import_stack_shared.StackClientInterface({
|
|
257
|
-
|
|
257
|
+
getBaseUrl: () => _options.baseUrl ?? getDefaultBaseUrl(),
|
|
258
258
|
projectId: _options.projectId ?? getDefaultProjectId(),
|
|
259
259
|
clientVersion,
|
|
260
260
|
publishableClientKey: _options.publishableClientKey ?? getDefaultPublishableClientKey()
|
|
@@ -803,10 +803,7 @@ var _StackClientAppImpl = class __StackClientAppImpl {
|
|
|
803
803
|
return (0, import_react2.useMemo)(() => teams.map((crud2) => app._clientTeamFromCrud(crud2, session)), [teams]);
|
|
804
804
|
},
|
|
805
805
|
async createTeam(data) {
|
|
806
|
-
const crud2 = await app._interface.createClientTeam(
|
|
807
|
-
...teamCreateOptionsToCrud(data),
|
|
808
|
-
creator_user_id: "me"
|
|
809
|
-
}, session);
|
|
806
|
+
const crud2 = await app._interface.createClientTeam(teamCreateOptionsToCrud(data, "me"), session);
|
|
810
807
|
await app._currentUserTeamsCache.refresh([session]);
|
|
811
808
|
return app._clientTeamFromCrud(crud2, session);
|
|
812
809
|
},
|
|
@@ -912,7 +909,7 @@ var _StackClientAppImpl = class __StackClientAppImpl {
|
|
|
912
909
|
_getOwnedAdminApp(forProjectId, session) {
|
|
913
910
|
if (!this._ownedAdminApps.has([session, forProjectId])) {
|
|
914
911
|
this._ownedAdminApps.set([session, forProjectId], new _StackAdminAppImpl({
|
|
915
|
-
baseUrl: this._interface.options.
|
|
912
|
+
baseUrl: this._interface.options.getBaseUrl(),
|
|
916
913
|
projectId: forProjectId,
|
|
917
914
|
tokenStore: null,
|
|
918
915
|
projectOwnerSession: session,
|
|
@@ -1413,7 +1410,7 @@ var _StackClientAppImpl = class __StackClientAppImpl {
|
|
|
1413
1410
|
throw new import_errors.StackAssertionError("Cannot serialize to JSON from an application without a publishable client key");
|
|
1414
1411
|
}
|
|
1415
1412
|
return {
|
|
1416
|
-
baseUrl: this.
|
|
1413
|
+
baseUrl: this._options.baseUrl,
|
|
1417
1414
|
projectId: this.projectId,
|
|
1418
1415
|
publishableClientKey: this._interface.options.publishableClientKey,
|
|
1419
1416
|
tokenStore: this._tokenStoreInit,
|
|
@@ -1442,7 +1439,7 @@ var _StackServerAppImpl = class extends _StackClientAppImpl {
|
|
|
1442
1439
|
oauthScopesOnSignIn: options.oauthScopesOnSignIn
|
|
1443
1440
|
} : {
|
|
1444
1441
|
interface: new import_stack_shared.StackServerInterface({
|
|
1445
|
-
|
|
1442
|
+
getBaseUrl: () => options.baseUrl ?? getDefaultBaseUrl(),
|
|
1446
1443
|
projectId: options.projectId ?? getDefaultProjectId(),
|
|
1447
1444
|
clientVersion,
|
|
1448
1445
|
publishableClientKey: options.publishableClientKey ?? getDefaultPublishableClientKey(),
|
|
@@ -1644,10 +1641,10 @@ var _StackServerAppImpl = class extends _StackClientAppImpl {
|
|
|
1644
1641
|
return (0, import_react2.useMemo)(() => teams.map((t) => app._serverTeamFromCrud(t)), [teams]);
|
|
1645
1642
|
},
|
|
1646
1643
|
createTeam: async (data) => {
|
|
1647
|
-
const team = await app._interface.createServerTeam({
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
});
|
|
1644
|
+
const team = await app._interface.createServerTeam(serverTeamCreateOptionsToCrud({
|
|
1645
|
+
creatorUserId: crud.id,
|
|
1646
|
+
...data
|
|
1647
|
+
}));
|
|
1651
1648
|
await app._serverTeamsCache.refresh([void 0]);
|
|
1652
1649
|
return app._serverTeamFromCrud(team);
|
|
1653
1650
|
},
|
|
@@ -1943,7 +1940,7 @@ var _StackAdminAppImpl = class extends _StackServerAppImpl {
|
|
|
1943
1940
|
constructor(options) {
|
|
1944
1941
|
super({
|
|
1945
1942
|
interface: new import_stack_shared.StackAdminInterface({
|
|
1946
|
-
|
|
1943
|
+
getBaseUrl: () => options.baseUrl ?? getDefaultBaseUrl(),
|
|
1947
1944
|
projectId: options.projectId ?? getDefaultProjectId(),
|
|
1948
1945
|
clientVersion,
|
|
1949
1946
|
..."projectOwnerSession" in options ? {
|
|
@@ -2273,7 +2270,10 @@ function serverUserCreateOptionsToCrud(options) {
|
|
|
2273
2270
|
otp_auth_enabled: options.otpAuthEnabled,
|
|
2274
2271
|
primary_email_auth_enabled: options.primaryEmailAuthEnabled,
|
|
2275
2272
|
display_name: options.displayName,
|
|
2276
|
-
primary_email_verified: options.primaryEmailVerified
|
|
2273
|
+
primary_email_verified: options.primaryEmailVerified,
|
|
2274
|
+
client_metadata: options.clientMetadata,
|
|
2275
|
+
client_read_only_metadata: options.clientReadOnlyMetadata,
|
|
2276
|
+
server_metadata: options.serverMetadata
|
|
2277
2277
|
};
|
|
2278
2278
|
}
|
|
2279
2279
|
function adminProjectUpdateOptionsToCrud(options) {
|
|
@@ -2344,14 +2344,19 @@ function teamUpdateOptionsToCrud(options) {
|
|
|
2344
2344
|
client_metadata: options.clientMetadata
|
|
2345
2345
|
};
|
|
2346
2346
|
}
|
|
2347
|
-
function teamCreateOptionsToCrud(options) {
|
|
2347
|
+
function teamCreateOptionsToCrud(options, creatorUserId) {
|
|
2348
2348
|
return {
|
|
2349
2349
|
display_name: options.displayName,
|
|
2350
|
-
profile_image_url: options.profileImageUrl
|
|
2350
|
+
profile_image_url: options.profileImageUrl,
|
|
2351
|
+
creator_user_id: creatorUserId
|
|
2351
2352
|
};
|
|
2352
2353
|
}
|
|
2353
2354
|
function serverTeamCreateOptionsToCrud(options) {
|
|
2354
|
-
return
|
|
2355
|
+
return {
|
|
2356
|
+
display_name: options.displayName,
|
|
2357
|
+
profile_image_url: options.profileImageUrl,
|
|
2358
|
+
creator_user_id: options.creatorUserId
|
|
2359
|
+
};
|
|
2355
2360
|
}
|
|
2356
2361
|
function serverTeamUpdateOptionsToCrud(options) {
|
|
2357
2362
|
return {
|