@stackframe/react 2.8.54 → 2.8.58
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/dist/components/credential-sign-up.js.map +1 -1
- package/dist/components/user-button.js +4 -4
- package/dist/components/user-button.js.map +1 -1
- package/dist/components-page/account-settings/email-and-auth/emails-section.js +4 -3
- package/dist/components-page/account-settings/email-and-auth/emails-section.js.map +1 -1
- package/dist/components-page/onboarding.js +170 -0
- package/dist/components-page/onboarding.js.map +1 -0
- package/dist/components-page/stack-handler-client.js +13 -1
- package/dist/components-page/stack-handler-client.js.map +1 -1
- package/dist/components-page/stack-handler.js.map +1 -1
- package/dist/components-page/team-invitation.js +15 -1
- package/dist/components-page/team-invitation.js.map +1 -1
- package/dist/esm/components/credential-sign-up.js.map +1 -1
- package/dist/esm/components/user-button.js +4 -4
- package/dist/esm/components/user-button.js.map +1 -1
- package/dist/esm/components-page/account-settings/email-and-auth/emails-section.js +4 -3
- package/dist/esm/components-page/account-settings/email-and-auth/emails-section.js.map +1 -1
- package/dist/esm/components-page/onboarding.js +146 -0
- package/dist/esm/components-page/onboarding.js.map +1 -0
- package/dist/esm/components-page/stack-handler-client.js +13 -1
- package/dist/esm/components-page/stack-handler-client.js.map +1 -1
- package/dist/esm/components-page/stack-handler.js.map +1 -1
- package/dist/esm/components-page/team-invitation.js +15 -1
- package/dist/esm/components-page/team-invitation.js.map +1 -1
- package/dist/esm/generated/global-css.js +1 -1
- package/dist/esm/generated/global-css.js.map +1 -1
- package/dist/esm/lib/cookie.js +50 -15
- package/dist/esm/lib/cookie.js.map +1 -1
- package/dist/esm/lib/stack-app/apps/implementations/admin-app-impl.js +235 -0
- package/dist/esm/lib/stack-app/apps/implementations/admin-app-impl.js.map +1 -1
- package/dist/esm/lib/stack-app/apps/implementations/client-app-impl.js +154 -31
- package/dist/esm/lib/stack-app/apps/implementations/client-app-impl.js.map +1 -1
- package/dist/esm/lib/stack-app/apps/implementations/common.js +2 -1
- package/dist/esm/lib/stack-app/apps/implementations/common.js.map +1 -1
- package/dist/esm/lib/stack-app/apps/implementations/server-app-impl.js +40 -27
- package/dist/esm/lib/stack-app/apps/implementations/server-app-impl.js.map +1 -1
- package/dist/esm/lib/stack-app/apps/interfaces/admin-app.js.map +1 -1
- package/dist/esm/lib/stack-app/apps/interfaces/client-app.js.map +1 -1
- package/dist/esm/lib/stack-app/apps/interfaces/server-app.js.map +1 -1
- package/dist/esm/lib/stack-app/common.js.map +1 -1
- package/dist/esm/lib/stack-app/index.js.map +1 -1
- package/dist/esm/lib/stack-app/projects/index.js +4 -0
- package/dist/esm/lib/stack-app/projects/index.js.map +1 -1
- package/dist/esm/lib/stack-app/teams/index.js.map +1 -1
- package/dist/esm/lib/stack-app/users/index.js +13 -12
- package/dist/esm/lib/stack-app/users/index.js.map +1 -1
- package/dist/generated/global-css.js +1 -1
- package/dist/generated/global-css.js.map +1 -1
- package/dist/index.d.mts +269 -16
- package/dist/index.d.ts +269 -16
- package/dist/lib/cookie.js +50 -15
- package/dist/lib/cookie.js.map +1 -1
- package/dist/lib/stack-app/apps/implementations/admin-app-impl.js +235 -0
- package/dist/lib/stack-app/apps/implementations/admin-app-impl.js.map +1 -1
- package/dist/lib/stack-app/apps/implementations/client-app-impl.js +151 -28
- package/dist/lib/stack-app/apps/implementations/client-app-impl.js.map +1 -1
- package/dist/lib/stack-app/apps/implementations/common.js +2 -1
- package/dist/lib/stack-app/apps/implementations/common.js.map +1 -1
- package/dist/lib/stack-app/apps/implementations/server-app-impl.js +38 -25
- package/dist/lib/stack-app/apps/implementations/server-app-impl.js.map +1 -1
- package/dist/lib/stack-app/apps/interfaces/admin-app.js.map +1 -1
- package/dist/lib/stack-app/apps/interfaces/client-app.js.map +1 -1
- package/dist/lib/stack-app/apps/interfaces/server-app.js.map +1 -1
- package/dist/lib/stack-app/common.js.map +1 -1
- package/dist/lib/stack-app/email/index.js.map +1 -1
- package/dist/lib/stack-app/index.js.map +1 -1
- package/dist/lib/stack-app/project-configs/index.js.map +1 -1
- package/dist/lib/stack-app/projects/index.js +4 -0
- package/dist/lib/stack-app/projects/index.js.map +1 -1
- package/dist/lib/stack-app/teams/index.js.map +1 -1
- package/dist/lib/stack-app/users/index.js +15 -14
- package/dist/lib/stack-app/users/index.js.map +1 -1
- package/package.json +4 -3
- package/CHANGELOG.md +0 -2052
package/dist/index.d.ts
CHANGED
|
@@ -42,6 +42,15 @@ type RedirectMethod = "window" | "none" | {
|
|
|
42
42
|
};
|
|
43
43
|
type GetCurrentUserOptions<HasTokenStore> = {
|
|
44
44
|
or?: 'redirect' | 'throw' | 'return-null' | 'anonymous' | /** @deprecated */ 'anonymous-if-exists[deprecated]';
|
|
45
|
+
/**
|
|
46
|
+
* Whether to include restricted users (users who haven't completed onboarding requirements like email verification).
|
|
47
|
+
* By default, restricted users are filtered out (treated similar to anonymous users).
|
|
48
|
+
*
|
|
49
|
+
* Note: This option cannot be set to false when `or: 'anonymous'` is used, as all anonymous users are also restricted.
|
|
50
|
+
*
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
|
+
includeRestricted?: boolean;
|
|
45
54
|
tokenStore?: TokenStoreInit;
|
|
46
55
|
} & (HasTokenStore extends false ? {
|
|
47
56
|
tokenStore: TokenStoreInit;
|
|
@@ -89,6 +98,7 @@ type HandlerUrls = {
|
|
|
89
98
|
teamInvitation: string;
|
|
90
99
|
mfa: string;
|
|
91
100
|
error: string;
|
|
101
|
+
onboarding: string;
|
|
92
102
|
};
|
|
93
103
|
type OAuthScopesOnSignIn = {
|
|
94
104
|
[key in ProviderType]: string[];
|
|
@@ -104,6 +114,22 @@ type AuthLike<ExtraOptions = {}> = {
|
|
|
104
114
|
signOut(options?: {
|
|
105
115
|
redirectUrl?: URL | string;
|
|
106
116
|
}): Promise<void>;
|
|
117
|
+
/**
|
|
118
|
+
* Returns the current access token, or null if the user is not signed in.
|
|
119
|
+
*
|
|
120
|
+
* The access token is a short-lived JWT that can be used to authenticate requests to external servers.
|
|
121
|
+
* It will be automatically refreshed when it expires.
|
|
122
|
+
*/
|
|
123
|
+
getAccessToken(options?: {} & ExtraOptions): Promise<string | null>;
|
|
124
|
+
useAccessToken(options?: {} & ExtraOptions): string | null;
|
|
125
|
+
/**
|
|
126
|
+
* Returns the current refresh token, or null if the user is not signed in.
|
|
127
|
+
*
|
|
128
|
+
* The refresh token is a long-lived token that can be used to obtain new access tokens.
|
|
129
|
+
* It should be kept secret and never exposed to the client.
|
|
130
|
+
*/
|
|
131
|
+
getRefreshToken(options?: {} & ExtraOptions): Promise<string | null>;
|
|
132
|
+
useRefreshToken(options?: {} & ExtraOptions): string | null;
|
|
107
133
|
/**
|
|
108
134
|
* Returns headers for sending authenticated HTTP requests to external servers. Most commonly used in cross-origin
|
|
109
135
|
* requests. Similar to `getAuthJson`, but specifically for HTTP requests.
|
|
@@ -120,8 +146,8 @@ type AuthLike<ExtraOptions = {}> = {
|
|
|
120
146
|
* must include `x-stack-auth` in the [`Access-Control-Allow-Headers` header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers)
|
|
121
147
|
* of the CORS preflight response.
|
|
122
148
|
*
|
|
123
|
-
* If you are not using HTTP (and hence cannot set headers), you will need to use the `
|
|
124
|
-
* instead.
|
|
149
|
+
* If you are not using HTTP (and hence cannot set headers), you will need to use the `getAccessToken()` and
|
|
150
|
+
* `getRefreshToken()` functions instead.
|
|
125
151
|
*
|
|
126
152
|
* Example:
|
|
127
153
|
*
|
|
@@ -144,7 +170,12 @@ type AuthLike<ExtraOptions = {}> = {
|
|
|
144
170
|
getAuthHeaders(options?: {} & ExtraOptions): Promise<{
|
|
145
171
|
"x-stack-auth": string;
|
|
146
172
|
}>;
|
|
173
|
+
useAuthHeaders(options?: {} & ExtraOptions): {
|
|
174
|
+
"x-stack-auth": string;
|
|
175
|
+
};
|
|
147
176
|
/**
|
|
177
|
+
* @deprecated Use `getAccessToken()` and `getRefreshToken()` instead.
|
|
178
|
+
*
|
|
148
179
|
* Creates a JSON-serializable object containing the information to authenticate a user on an external server.
|
|
149
180
|
* Similar to `getAuthHeaders`, but returns an object that can be sent over any protocol instead of just
|
|
150
181
|
* HTTP headers.
|
|
@@ -175,6 +206,11 @@ type AuthLike<ExtraOptions = {}> = {
|
|
|
175
206
|
accessToken: string | null;
|
|
176
207
|
refreshToken: string | null;
|
|
177
208
|
}>;
|
|
209
|
+
/** @deprecated Use `useAccessToken()` and `useRefreshToken()` instead. */
|
|
210
|
+
useAuthJson(options?: {} & ExtraOptions): {
|
|
211
|
+
accessToken: string | null;
|
|
212
|
+
refreshToken: string | null;
|
|
213
|
+
};
|
|
178
214
|
};
|
|
179
215
|
/** @internal */
|
|
180
216
|
declare const stackAppInternalsSymbol: unique symbol;
|
|
@@ -259,6 +295,137 @@ type AdminSentEmail = {
|
|
|
259
295
|
sentAt: Date;
|
|
260
296
|
error?: unknown;
|
|
261
297
|
};
|
|
298
|
+
type AdminEmailOutboxRecipient = {
|
|
299
|
+
type: "user-primary-email";
|
|
300
|
+
userId: string;
|
|
301
|
+
} | {
|
|
302
|
+
type: "user-custom-emails";
|
|
303
|
+
userId: string;
|
|
304
|
+
emails: string[];
|
|
305
|
+
} | {
|
|
306
|
+
type: "custom-emails";
|
|
307
|
+
emails: string[];
|
|
308
|
+
};
|
|
309
|
+
type AdminEmailOutboxStatus = "paused" | "preparing" | "rendering" | "render-error" | "scheduled" | "queued" | "sending" | "server-error" | "skipped" | "bounced" | "delivery-delayed" | "sent" | "opened" | "clicked" | "marked-as-spam";
|
|
310
|
+
type AdminEmailOutboxSimpleStatus = "in-progress" | "ok" | "error";
|
|
311
|
+
type AdminEmailOutboxBase = {
|
|
312
|
+
id: string;
|
|
313
|
+
createdAt: Date;
|
|
314
|
+
updatedAt: Date;
|
|
315
|
+
to: AdminEmailOutboxRecipient;
|
|
316
|
+
scheduledAt: Date;
|
|
317
|
+
isPaused: false;
|
|
318
|
+
hasRendered: false;
|
|
319
|
+
hasDelivered: false;
|
|
320
|
+
};
|
|
321
|
+
type AdminEmailOutboxRenderedFields = Omit<AdminEmailOutboxBase, "hasRendered"> & {
|
|
322
|
+
hasRendered: true;
|
|
323
|
+
startedRenderingAt: Date;
|
|
324
|
+
renderedAt: Date;
|
|
325
|
+
subject: string;
|
|
326
|
+
html: string | null;
|
|
327
|
+
text: string | null;
|
|
328
|
+
isTransactional: boolean;
|
|
329
|
+
isHighPriority: boolean;
|
|
330
|
+
notificationCategoryId: string | null;
|
|
331
|
+
};
|
|
332
|
+
type AdminEmailOutboxStartedSendingFields = AdminEmailOutboxRenderedFields & {
|
|
333
|
+
startedSendingAt: Date;
|
|
334
|
+
};
|
|
335
|
+
type AdminEmailOutboxFinishedDeliveringFields = Omit<AdminEmailOutboxStartedSendingFields, "hasDelivered"> & {
|
|
336
|
+
hasDelivered: true;
|
|
337
|
+
deliveredAt: Date;
|
|
338
|
+
};
|
|
339
|
+
type AdminEmailOutboxPaused = Omit<AdminEmailOutboxBase, "isPaused"> & {
|
|
340
|
+
status: "paused";
|
|
341
|
+
simpleStatus: "in-progress";
|
|
342
|
+
isPaused: true;
|
|
343
|
+
};
|
|
344
|
+
type AdminEmailOutboxPreparing = AdminEmailOutboxBase & {
|
|
345
|
+
status: "preparing";
|
|
346
|
+
simpleStatus: "in-progress";
|
|
347
|
+
};
|
|
348
|
+
type AdminEmailOutboxRendering = AdminEmailOutboxBase & {
|
|
349
|
+
status: "rendering";
|
|
350
|
+
simpleStatus: "in-progress";
|
|
351
|
+
startedRenderingAt: Date;
|
|
352
|
+
};
|
|
353
|
+
type AdminEmailOutboxRenderError = AdminEmailOutboxBase & {
|
|
354
|
+
status: "render-error";
|
|
355
|
+
simpleStatus: "error";
|
|
356
|
+
startedRenderingAt: Date;
|
|
357
|
+
renderedAt: Date;
|
|
358
|
+
renderError: string;
|
|
359
|
+
};
|
|
360
|
+
type AdminEmailOutboxScheduled = AdminEmailOutboxRenderedFields & {
|
|
361
|
+
status: "scheduled";
|
|
362
|
+
simpleStatus: "in-progress";
|
|
363
|
+
};
|
|
364
|
+
type AdminEmailOutboxQueued = AdminEmailOutboxRenderedFields & {
|
|
365
|
+
status: "queued";
|
|
366
|
+
simpleStatus: "in-progress";
|
|
367
|
+
};
|
|
368
|
+
type AdminEmailOutboxSending = AdminEmailOutboxStartedSendingFields & {
|
|
369
|
+
status: "sending";
|
|
370
|
+
simpleStatus: "in-progress";
|
|
371
|
+
};
|
|
372
|
+
type AdminEmailOutboxServerError = AdminEmailOutboxStartedSendingFields & {
|
|
373
|
+
status: "server-error";
|
|
374
|
+
simpleStatus: "error";
|
|
375
|
+
errorAt: Date;
|
|
376
|
+
serverError: string;
|
|
377
|
+
};
|
|
378
|
+
type AdminEmailOutboxSkipped = Omit<AdminEmailOutboxBase, "hasRendered"> & {
|
|
379
|
+
status: "skipped";
|
|
380
|
+
simpleStatus: "ok";
|
|
381
|
+
hasRendered: boolean;
|
|
382
|
+
skippedAt: Date;
|
|
383
|
+
skippedReason: string;
|
|
384
|
+
skippedDetails: Record<string, unknown>;
|
|
385
|
+
startedRenderingAt?: Date;
|
|
386
|
+
renderedAt?: Date;
|
|
387
|
+
subject?: string;
|
|
388
|
+
html?: string | null;
|
|
389
|
+
text?: string | null;
|
|
390
|
+
isTransactional?: boolean;
|
|
391
|
+
isHighPriority?: boolean;
|
|
392
|
+
notificationCategoryId?: string | null;
|
|
393
|
+
startedSendingAt?: Date;
|
|
394
|
+
};
|
|
395
|
+
type AdminEmailOutboxBounced = AdminEmailOutboxStartedSendingFields & {
|
|
396
|
+
status: "bounced";
|
|
397
|
+
simpleStatus: "error";
|
|
398
|
+
bouncedAt: Date;
|
|
399
|
+
};
|
|
400
|
+
type AdminEmailOutboxDeliveryDelayed = AdminEmailOutboxStartedSendingFields & {
|
|
401
|
+
status: "delivery-delayed";
|
|
402
|
+
simpleStatus: "ok";
|
|
403
|
+
deliveryDelayedAt: Date;
|
|
404
|
+
};
|
|
405
|
+
type AdminEmailOutboxSent = AdminEmailOutboxFinishedDeliveringFields & {
|
|
406
|
+
status: "sent";
|
|
407
|
+
simpleStatus: "ok";
|
|
408
|
+
canHaveDeliveryInfo: boolean;
|
|
409
|
+
};
|
|
410
|
+
type AdminEmailOutboxOpened = AdminEmailOutboxFinishedDeliveringFields & {
|
|
411
|
+
status: "opened";
|
|
412
|
+
simpleStatus: "ok";
|
|
413
|
+
openedAt: Date;
|
|
414
|
+
canHaveDeliveryInfo: true;
|
|
415
|
+
};
|
|
416
|
+
type AdminEmailOutboxClicked = AdminEmailOutboxFinishedDeliveringFields & {
|
|
417
|
+
status: "clicked";
|
|
418
|
+
simpleStatus: "ok";
|
|
419
|
+
clickedAt: Date;
|
|
420
|
+
canHaveDeliveryInfo: true;
|
|
421
|
+
};
|
|
422
|
+
type AdminEmailOutboxMarkedAsSpam = AdminEmailOutboxFinishedDeliveringFields & {
|
|
423
|
+
status: "marked-as-spam";
|
|
424
|
+
simpleStatus: "ok";
|
|
425
|
+
markedAsSpamAt: Date;
|
|
426
|
+
canHaveDeliveryInfo: true;
|
|
427
|
+
};
|
|
428
|
+
type AdminEmailOutbox = AdminEmailOutboxPaused | AdminEmailOutboxPreparing | AdminEmailOutboxRendering | AdminEmailOutboxRenderError | AdminEmailOutboxScheduled | AdminEmailOutboxQueued | AdminEmailOutboxSending | AdminEmailOutboxServerError | AdminEmailOutboxSkipped | AdminEmailOutboxBounced | AdminEmailOutboxDeliveryDelayed | AdminEmailOutboxSent | AdminEmailOutboxOpened | AdminEmailOutboxClicked | AdminEmailOutboxMarkedAsSpam;
|
|
262
429
|
type SendEmailOptionsBase = {
|
|
263
430
|
themeId?: string | null | false;
|
|
264
431
|
subject?: string;
|
|
@@ -283,6 +450,25 @@ type SendEmailOptions = SendEmailOptionsBase & XOR<[
|
|
|
283
450
|
draftId: string;
|
|
284
451
|
}
|
|
285
452
|
]>;
|
|
453
|
+
type EmailDeliveryWindowStats = {
|
|
454
|
+
sent: number;
|
|
455
|
+
bounced: number;
|
|
456
|
+
marked_as_spam: number;
|
|
457
|
+
};
|
|
458
|
+
type EmailDeliveryStats = {
|
|
459
|
+
hour: EmailDeliveryWindowStats;
|
|
460
|
+
day: EmailDeliveryWindowStats;
|
|
461
|
+
week: EmailDeliveryWindowStats;
|
|
462
|
+
month: EmailDeliveryWindowStats;
|
|
463
|
+
};
|
|
464
|
+
type EmailDeliveryCapacity = {
|
|
465
|
+
rate_per_second: number;
|
|
466
|
+
penalty_factor: number;
|
|
467
|
+
};
|
|
468
|
+
type EmailDeliveryInfo = {
|
|
469
|
+
stats: EmailDeliveryStats;
|
|
470
|
+
capacity: EmailDeliveryCapacity;
|
|
471
|
+
};
|
|
286
472
|
|
|
287
473
|
type InternalApiKeyBase = {
|
|
288
474
|
id: string;
|
|
@@ -485,18 +671,21 @@ type ServerOAuthProvider = {
|
|
|
485
671
|
}): Promise<Result<void, InstanceType<typeof KnownErrors.OAuthProviderAccountIdAlreadyUsedForSignIn>>>;
|
|
486
672
|
delete(): Promise<void>;
|
|
487
673
|
};
|
|
488
|
-
type Session = {
|
|
489
|
-
getTokens(): Promise<{
|
|
490
|
-
accessToken: string | null;
|
|
491
|
-
refreshToken: string | null;
|
|
492
|
-
}>;
|
|
493
|
-
};
|
|
494
674
|
/**
|
|
495
675
|
* Contains everything related to the current user session.
|
|
496
676
|
*/
|
|
497
677
|
type Auth = AuthLike<{}> & {
|
|
498
678
|
readonly _internalSession: InternalSession;
|
|
499
|
-
readonly currentSession:
|
|
679
|
+
readonly currentSession: {
|
|
680
|
+
getTokens(): Promise<{
|
|
681
|
+
accessToken: string | null;
|
|
682
|
+
refreshToken: string | null;
|
|
683
|
+
}>;
|
|
684
|
+
useTokens(): {
|
|
685
|
+
accessToken: string | null;
|
|
686
|
+
refreshToken: string | null;
|
|
687
|
+
};
|
|
688
|
+
};
|
|
500
689
|
};
|
|
501
690
|
/**
|
|
502
691
|
* ```
|
|
@@ -542,6 +731,18 @@ type BaseUser = {
|
|
|
542
731
|
readonly passkeyAuthEnabled: boolean;
|
|
543
732
|
readonly isMultiFactorRequired: boolean;
|
|
544
733
|
readonly isAnonymous: boolean;
|
|
734
|
+
/**
|
|
735
|
+
* Whether the user is in restricted state (signed up but hasn't completed onboarding requirements).
|
|
736
|
+
* For example, if email verification is required but the user hasn't verified their email yet.
|
|
737
|
+
*/
|
|
738
|
+
readonly isRestricted: boolean;
|
|
739
|
+
/**
|
|
740
|
+
* The reason why the user is restricted, e.g., { type: "email_not_verified" } or { type: "anonymous" }.
|
|
741
|
+
* Null if the user is not restricted.
|
|
742
|
+
*/
|
|
743
|
+
readonly restrictedReason: {
|
|
744
|
+
type: "anonymous" | "email_not_verified";
|
|
745
|
+
} | null;
|
|
545
746
|
toClientJson(): CurrentUserCrud["Client"]["Read"];
|
|
546
747
|
/**
|
|
547
748
|
* @deprecated, use contact channel's usedForAuth instead
|
|
@@ -555,7 +756,7 @@ type BaseUser = {
|
|
|
555
756
|
}[];
|
|
556
757
|
};
|
|
557
758
|
type UserExtra = {
|
|
558
|
-
setDisplayName(displayName: string): Promise<void>;
|
|
759
|
+
setDisplayName(displayName: string | null): Promise<void>;
|
|
559
760
|
/** @deprecated Use contact channel's sendVerificationEmail instead */
|
|
560
761
|
sendVerificationEmail(): Promise<KnownErrors["EmailAlreadyVerified"] | void>;
|
|
561
762
|
setClientMetadata(metadata: any): Promise<void>;
|
|
@@ -611,7 +812,7 @@ type UserExtra = {
|
|
|
611
812
|
usePermission(scope: Team, permissionId: string): TeamPermission | null;
|
|
612
813
|
usePermission(permissionId: string): TeamPermission | null;
|
|
613
814
|
readonly selectedTeam: Team | null;
|
|
614
|
-
setSelectedTeam(
|
|
815
|
+
setSelectedTeam(teamOrId: string | Team | null): Promise<void>;
|
|
615
816
|
createTeam(data: TeamCreateOptions): Promise<Team>;
|
|
616
817
|
leaveTeam(team: Team): Promise<void>;
|
|
617
818
|
getActiveSessions(): Promise<ActiveSession[]>;
|
|
@@ -639,8 +840,8 @@ type User = BaseUser;
|
|
|
639
840
|
type CurrentUser = BaseUser & Auth & UserExtra & Customer;
|
|
640
841
|
type CurrentInternalUser = CurrentUser & InternalUserExtra;
|
|
641
842
|
type ProjectCurrentUser<ProjectId> = ProjectId extends "internal" ? CurrentInternalUser : CurrentUser;
|
|
642
|
-
type TokenPartialUser = Pick<User, "id" | "displayName" | "primaryEmail" | "primaryEmailVerified" | "isAnonymous">;
|
|
643
|
-
type SyncedPartialUser = TokenPartialUser & Pick<User, "id" | "displayName" | "primaryEmail" | "primaryEmailVerified" | "profileImageUrl" | "signedUpAt" | "clientMetadata" | "clientReadOnlyMetadata" | "isAnonymous" | "hasPassword">;
|
|
843
|
+
type TokenPartialUser = Pick<User, "id" | "displayName" | "primaryEmail" | "primaryEmailVerified" | "isAnonymous" | "isRestricted" | "restrictedReason">;
|
|
844
|
+
type SyncedPartialUser = TokenPartialUser & Pick<User, "id" | "displayName" | "primaryEmail" | "primaryEmailVerified" | "profileImageUrl" | "signedUpAt" | "clientMetadata" | "clientReadOnlyMetadata" | "isAnonymous" | "hasPassword" | "isRestricted" | "restrictedReason">;
|
|
644
845
|
type ActiveSession = {
|
|
645
846
|
id: string;
|
|
646
847
|
userId: string;
|
|
@@ -651,13 +852,14 @@ type ActiveSession = {
|
|
|
651
852
|
geoInfo?: GeoInfo;
|
|
652
853
|
};
|
|
653
854
|
type UserUpdateOptions = {
|
|
654
|
-
displayName?: string;
|
|
855
|
+
displayName?: string | null;
|
|
655
856
|
clientMetadata?: ReadonlyJson;
|
|
656
857
|
selectedTeamId?: string | null;
|
|
657
858
|
totpMultiFactorSecret?: Uint8Array | null;
|
|
658
859
|
profileImageUrl?: string | null;
|
|
659
860
|
otpAuthEnabled?: boolean;
|
|
660
861
|
passkeyAuthEnabled?: boolean;
|
|
862
|
+
primaryEmail?: string | null;
|
|
661
863
|
};
|
|
662
864
|
type ServerBaseUser = {
|
|
663
865
|
setPrimaryEmail(email: string | null, options?: {
|
|
@@ -704,7 +906,12 @@ type ServerBaseUser = {
|
|
|
704
906
|
createSession(options?: {
|
|
705
907
|
expiresInMillis?: number;
|
|
706
908
|
isImpersonation?: boolean;
|
|
707
|
-
}): Promise<
|
|
909
|
+
}): Promise<{
|
|
910
|
+
getTokens(): Promise<{
|
|
911
|
+
accessToken: string | null;
|
|
912
|
+
refreshToken: string | null;
|
|
913
|
+
}>;
|
|
914
|
+
}>;
|
|
708
915
|
} & AsyncStoreProperty<"team", [id: string], ServerTeam | null, false> & AsyncStoreProperty<"teams", [], ServerTeam[], true> & AsyncStoreProperty<"permission", [scope: Team, permissionId: string, options?: {
|
|
709
916
|
direct?: boolean;
|
|
710
917
|
}], AdminTeamPermission | null, false> & AsyncStoreProperty<"permissions", [scope: Team, options?: {
|
|
@@ -811,6 +1018,15 @@ type ServerListUsersOptions = {
|
|
|
811
1018
|
orderBy?: 'signedUpAt';
|
|
812
1019
|
desc?: boolean;
|
|
813
1020
|
query?: string;
|
|
1021
|
+
/**
|
|
1022
|
+
* Whether to include restricted users (users who haven't completed onboarding requirements).
|
|
1023
|
+
* Defaults to false.
|
|
1024
|
+
*/
|
|
1025
|
+
includeRestricted?: boolean;
|
|
1026
|
+
/**
|
|
1027
|
+
* Whether to include anonymous users (and restricted users).
|
|
1028
|
+
* Defaults to false.
|
|
1029
|
+
*/
|
|
814
1030
|
includeAnonymous?: boolean;
|
|
815
1031
|
};
|
|
816
1032
|
type ServerTeamCreateOptions = TeamCreateOptions & {
|
|
@@ -925,6 +1141,8 @@ type StackServerApp<HasTokenStore extends boolean = boolean, ProjectId extends s
|
|
|
925
1141
|
allowConnectedAccounts: boolean;
|
|
926
1142
|
}): Promise<Result<ServerOAuthProvider, InstanceType<typeof KnownErrors.OAuthProviderAccountIdAlreadyUsedForSignIn>>>;
|
|
927
1143
|
sendEmail(options: SendEmailOptions): Promise<void>;
|
|
1144
|
+
getEmailDeliveryStats(): Promise<EmailDeliveryInfo>;
|
|
1145
|
+
useEmailDeliveryStats(): EmailDeliveryInfo;
|
|
928
1146
|
} & AsyncStoreProperty<"user", [id: string], ServerUser | null, false> & Omit<AsyncStoreProperty<"users", [], ServerUser[], true>, "listUsers" | "useUsers"> & AsyncStoreProperty<"teams", [], ServerTeam[], true> & AsyncStoreProperty<"dataVaultStore", [id: string], DataVaultStore, false> & AsyncStoreProperty<"item", [
|
|
929
1147
|
{
|
|
930
1148
|
itemId: string;
|
|
@@ -941,6 +1159,21 @@ type StackServerApp<HasTokenStore extends boolean = boolean, ProjectId extends s
|
|
|
941
1159
|
], CustomerProductsList, true> & StackClientApp<HasTokenStore, ProjectId>);
|
|
942
1160
|
declare const StackServerApp: StackServerAppConstructor;
|
|
943
1161
|
|
|
1162
|
+
type EmailOutboxListOptions = {
|
|
1163
|
+
status?: string;
|
|
1164
|
+
simpleStatus?: string;
|
|
1165
|
+
limit?: number;
|
|
1166
|
+
cursor?: string;
|
|
1167
|
+
};
|
|
1168
|
+
type EmailOutboxListResult = {
|
|
1169
|
+
items: AdminEmailOutbox[];
|
|
1170
|
+
nextCursor: string | null;
|
|
1171
|
+
};
|
|
1172
|
+
type EmailOutboxUpdateOptions = {
|
|
1173
|
+
isPaused?: boolean;
|
|
1174
|
+
scheduledAtMillis?: number;
|
|
1175
|
+
cancel?: boolean;
|
|
1176
|
+
};
|
|
944
1177
|
type StackAdminAppConstructorOptions<HasTokenStore extends boolean, ProjectId extends string> = (StackServerAppConstructorOptions<HasTokenStore, ProjectId> & {
|
|
945
1178
|
superSecretAdminKey?: string;
|
|
946
1179
|
projectOwnerSession?: InternalSession;
|
|
@@ -1073,6 +1306,12 @@ type StackAdminApp<HasTokenStore extends boolean = boolean, ProjectId extends st
|
|
|
1073
1306
|
type: "subscription" | "one-time-purchase";
|
|
1074
1307
|
id: string;
|
|
1075
1308
|
}): Promise<void>;
|
|
1309
|
+
listOutboxEmails(options?: EmailOutboxListOptions): Promise<EmailOutboxListResult>;
|
|
1310
|
+
getOutboxEmail(id: string): Promise<AdminEmailOutbox>;
|
|
1311
|
+
updateOutboxEmail(id: string, options: EmailOutboxUpdateOptions): Promise<AdminEmailOutbox>;
|
|
1312
|
+
pauseOutboxEmail(id: string): Promise<AdminEmailOutbox>;
|
|
1313
|
+
unpauseOutboxEmail(id: string): Promise<AdminEmailOutbox>;
|
|
1314
|
+
cancelOutboxEmail(id: string): Promise<AdminEmailOutbox>;
|
|
1076
1315
|
} & StackServerApp<HasTokenStore, ProjectId>);
|
|
1077
1316
|
declare const StackAdminApp: StackAdminAppConstructor;
|
|
1078
1317
|
|
|
@@ -1090,6 +1329,9 @@ type ProjectConfig = {
|
|
|
1090
1329
|
type OAuthProviderConfig = {
|
|
1091
1330
|
readonly id: string;
|
|
1092
1331
|
};
|
|
1332
|
+
/**
|
|
1333
|
+
* @deprecated This type is deprecated. Use the new config override setup instead.
|
|
1334
|
+
*/
|
|
1093
1335
|
type AdminProjectConfig = {
|
|
1094
1336
|
readonly signUpEnabled: boolean;
|
|
1095
1337
|
readonly credentialEnabled: boolean;
|
|
@@ -1335,6 +1577,12 @@ type StackClientApp<HasTokenStore extends boolean = boolean, ProjectId extends s
|
|
|
1335
1577
|
or: 'anonymous';
|
|
1336
1578
|
}): Promise<ProjectCurrentUser<ProjectId>>;
|
|
1337
1579
|
getUser(options?: GetCurrentUserOptions<HasTokenStore>): Promise<ProjectCurrentUser<ProjectId> | null>;
|
|
1580
|
+
cancelSubscription(options: {
|
|
1581
|
+
productId: string;
|
|
1582
|
+
} | {
|
|
1583
|
+
productId: string;
|
|
1584
|
+
teamId: string;
|
|
1585
|
+
}): Promise<void>;
|
|
1338
1586
|
getPartialUser(options: GetCurrentPartialUserOptions<HasTokenStore> & {
|
|
1339
1587
|
from: 'token';
|
|
1340
1588
|
}): Promise<TokenPartialUser | null>;
|
|
@@ -1462,6 +1710,10 @@ declare function OAuthCallback({ fullPage }: {
|
|
|
1462
1710
|
fullPage?: boolean;
|
|
1463
1711
|
}): react_jsx_runtime.JSX.Element;
|
|
1464
1712
|
|
|
1713
|
+
declare function Onboarding(props: {
|
|
1714
|
+
fullPage?: boolean;
|
|
1715
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
1716
|
+
|
|
1465
1717
|
declare function PasswordReset({ searchParams, fullPage, }: {
|
|
1466
1718
|
searchParams: Record<string, string>;
|
|
1467
1719
|
fullPage?: boolean;
|
|
@@ -1490,6 +1742,7 @@ type Components = {
|
|
|
1490
1742
|
AccountSettings: typeof AccountSettings;
|
|
1491
1743
|
CliAuthConfirmation: typeof CliAuthConfirmation;
|
|
1492
1744
|
MFA: typeof MFA;
|
|
1745
|
+
Onboarding: typeof Onboarding;
|
|
1493
1746
|
};
|
|
1494
1747
|
type BaseHandlerProps = {
|
|
1495
1748
|
fullPage: boolean;
|
|
@@ -1761,4 +2014,4 @@ type UserButtonProps = {
|
|
|
1761
2014
|
};
|
|
1762
2015
|
declare function UserButton(props: UserButtonProps): react_jsx_runtime.JSX.Element;
|
|
1763
2016
|
|
|
1764
|
-
export { AccountSettings, type AdminDomainConfig, type AdminEmailConfig, type AdminOAuthProviderConfig, type AdminOwnedProject, type AdminProject, type AdminProjectConfig, type AdminProjectConfigUpdateOptions, type AdminProjectCreateOptions, type AdminProjectPermission, type AdminProjectPermissionDefinition, type AdminProjectPermissionDefinitionCreateOptions, type AdminProjectPermissionDefinitionUpdateOptions, type AdminProjectUpdateOptions, type AdminSentEmail, type AdminTeamPermission, type AdminTeamPermissionDefinition, type AdminTeamPermissionDefinitionCreateOptions, type AdminTeamPermissionDefinitionUpdateOptions, type Auth, AuthPage, CliAuthConfirmation, type Connection, type ContactChannel, CredentialSignIn, CredentialSignUp, type CurrentInternalServerUser, type CurrentInternalUser, type CurrentServerUser, type CurrentUser, type EditableTeamMemberProfile, EmailVerification, ForgotPassword, type GetCurrentUserOptions, type GetCurrentUserOptions as GetUserOptions, type HandlerUrls, type InternalApiKey, type InternalApiKeyBase, type InternalApiKeyBaseCrudRead, type InternalApiKeyCreateOptions, type InternalApiKeyFirstView, MagicLinkSignIn, MessageCard, OAuthButton, OAuthButtonGroup, type OAuthConnection, type OAuthProvider, type OAuthProviderConfig, type OAuthScopesOnSignIn, PasswordReset, type Project, type ProjectConfig, SelectedTeamSwitcher, type ServerContactChannel, type ServerListUsersOptions, type ServerOAuthProvider, type ServerTeam, type ServerTeamCreateOptions, type ServerTeamMemberProfile, type ServerTeamUpdateOptions, type ServerTeamUser, type ServerUser,
|
|
2017
|
+
export { AccountSettings, type AdminDomainConfig, type AdminEmailConfig, type AdminEmailOutbox, type AdminEmailOutboxRecipient, type AdminEmailOutboxSimpleStatus, type AdminEmailOutboxStatus, type AdminOAuthProviderConfig, type AdminOwnedProject, type AdminProject, type AdminProjectConfig, type AdminProjectConfigUpdateOptions, type AdminProjectCreateOptions, type AdminProjectPermission, type AdminProjectPermissionDefinition, type AdminProjectPermissionDefinitionCreateOptions, type AdminProjectPermissionDefinitionUpdateOptions, type AdminProjectUpdateOptions, type AdminSentEmail, type AdminTeamPermission, type AdminTeamPermissionDefinition, type AdminTeamPermissionDefinitionCreateOptions, type AdminTeamPermissionDefinitionUpdateOptions, type Auth, AuthPage, CliAuthConfirmation, type Connection, type ContactChannel, CredentialSignIn, CredentialSignUp, type CurrentInternalServerUser, type CurrentInternalUser, type CurrentServerUser, type CurrentUser, type EditableTeamMemberProfile, type EmailOutboxListOptions, type EmailOutboxListResult, type EmailOutboxUpdateOptions, EmailVerification, ForgotPassword, type GetCurrentUserOptions, type GetCurrentUserOptions as GetUserOptions, type HandlerUrls, type InternalApiKey, type InternalApiKeyBase, type InternalApiKeyBaseCrudRead, type InternalApiKeyCreateOptions, type InternalApiKeyFirstView, MagicLinkSignIn, MessageCard, OAuthButton, OAuthButtonGroup, type OAuthConnection, type OAuthProvider, type OAuthProviderConfig, type OAuthScopesOnSignIn, PasswordReset, type Project, type ProjectConfig, SelectedTeamSwitcher, type ServerContactChannel, type ServerListUsersOptions, type ServerOAuthProvider, type ServerTeam, type ServerTeamCreateOptions, type ServerTeamMemberProfile, type ServerTeamUpdateOptions, type ServerTeamUser, type ServerUser, SignIn, SignUp, StackAdminApp, type StackAdminAppConstructor, type StackAdminAppConstructorOptions, StackClientApp, type StackClientAppConstructor, type StackClientAppConstructorOptions, type StackClientAppJson, StackHandler, ReactStackProvider as StackProvider, StackServerApp, type StackServerAppConstructor, type StackServerAppConstructorOptions, StackTheme, type Team, type TeamCreateOptions, type TeamInvitation$1 as TeamInvitation, type TeamMemberProfile, TeamSwitcher, type TeamUpdateOptions, type TeamUser, type User, UserAvatar, UserButton, stackAppInternalsSymbol, useStackApp, useUser };
|
package/dist/lib/cookie.js
CHANGED
|
@@ -90,7 +90,7 @@ function getCookieClient(name) {
|
|
|
90
90
|
}
|
|
91
91
|
function getAllCookiesClient() {
|
|
92
92
|
ensureClient();
|
|
93
|
-
import_js_cookie.default.set("stack-is-https", "true", { secure: true });
|
|
93
|
+
import_js_cookie.default.set("stack-is-https", "true", { secure: true, expires: new Date(Date.now() + 1e3 * 60 * 60 * 24 * 365) });
|
|
94
94
|
return import_js_cookie.default.get();
|
|
95
95
|
}
|
|
96
96
|
async function getCookie(name) {
|
|
@@ -106,21 +106,56 @@ async function isSecure() {
|
|
|
106
106
|
function determineSecureFromClientContext() {
|
|
107
107
|
return typeof window !== "undefined" && window.location.protocol === "https:";
|
|
108
108
|
}
|
|
109
|
-
|
|
109
|
+
var _shouldSetPartitionedClientCache = void 0;
|
|
110
|
+
function shouldSetPartitionedClient() {
|
|
111
|
+
return _shouldSetPartitionedClientCache ??= _internalShouldSetPartitionedClient();
|
|
112
|
+
}
|
|
113
|
+
function _internalShouldSetPartitionedClient() {
|
|
114
|
+
ensureClient();
|
|
115
|
+
if (!determineSecureFromClientContext()) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
const cookie1Name = "__Host-stack-temporary-chips-test-" + Math.random().toString(36).substring(2, 15);
|
|
119
|
+
document.cookie = `${cookie1Name}=value1; Secure; path=/`;
|
|
120
|
+
const cookies1 = document.cookie.split("; ");
|
|
121
|
+
document.cookie = `${cookie1Name}=delete1; Secure; path=/; expires=Thu, 01 Jan 1970 00:00:00 UTC;`;
|
|
122
|
+
if (cookies1.some((c) => c.startsWith(cookie1Name + "="))) {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
const cookie2Name = "__Host-stack-temporary-chips-test-" + Math.random().toString(36).substring(2, 15);
|
|
126
|
+
document.cookie = `${cookie2Name}=delete1; Secure; SameSite=None; Partitioned; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/`;
|
|
127
|
+
document.cookie = `${cookie2Name}=delete2; Secure; SameSite=None; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/`;
|
|
128
|
+
document.cookie = `${cookie2Name}=set1; Secure; SameSite=None; Partitioned; path=/`;
|
|
129
|
+
document.cookie = `${cookie2Name}=set2; Secure; SameSite=None; path=/`;
|
|
130
|
+
const cookies2 = document.cookie.split("; ");
|
|
131
|
+
const numberOfCookiesWithThisName = cookies2.filter((c) => c.startsWith(cookie2Name + "=")).length;
|
|
132
|
+
document.cookie = `${cookie2Name}=delete3; Secure; SameSite=None; Partitioned; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/`;
|
|
133
|
+
document.cookie = `${cookie2Name}=delete4; Secure; SameSite=None; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/`;
|
|
134
|
+
return numberOfCookiesWithThisName === 2;
|
|
135
|
+
}
|
|
136
|
+
function setCookieClientInternal(name, value, options) {
|
|
110
137
|
const secure = options.secure ?? determineSecureFromClientContext();
|
|
138
|
+
const partitioned = shouldSetPartitionedClient();
|
|
111
139
|
import_js_cookie.default.set(name, value, {
|
|
112
|
-
expires: options.maxAge ===
|
|
140
|
+
expires: options.maxAge === "session" ? void 0 : new Date(Date.now() + options.maxAge * 1e3),
|
|
113
141
|
domain: options.domain,
|
|
114
|
-
secure
|
|
142
|
+
secure,
|
|
143
|
+
sameSite: "Lax",
|
|
144
|
+
...partitioned ? {
|
|
145
|
+
partitioned,
|
|
146
|
+
sameSite: "None"
|
|
147
|
+
} : {}
|
|
115
148
|
});
|
|
116
149
|
}
|
|
117
|
-
function deleteCookieClientInternal(name, options
|
|
118
|
-
|
|
119
|
-
|
|
150
|
+
function deleteCookieClientInternal(name, options) {
|
|
151
|
+
for (const partitioned of [true, false]) {
|
|
152
|
+
if (options.domain !== void 0) {
|
|
153
|
+
import_js_cookie.default.remove(name, { domain: options.domain, secure: determineSecureFromClientContext(), partitioned });
|
|
154
|
+
}
|
|
155
|
+
import_js_cookie.default.remove(name, { secure: determineSecureFromClientContext(), partitioned });
|
|
120
156
|
}
|
|
121
|
-
import_js_cookie.default.remove(name, { secure: determineSecureFromClientContext() });
|
|
122
157
|
}
|
|
123
|
-
function setOrDeleteCookieClient(name, value, options
|
|
158
|
+
function setOrDeleteCookieClient(name, value, options) {
|
|
124
159
|
ensureClient();
|
|
125
160
|
if (value === null) {
|
|
126
161
|
deleteCookieClientInternal(name, options);
|
|
@@ -128,23 +163,23 @@ function setOrDeleteCookieClient(name, value, options = {}) {
|
|
|
128
163
|
setCookieClientInternal(name, value, options);
|
|
129
164
|
}
|
|
130
165
|
}
|
|
131
|
-
async function setOrDeleteCookie(name, value, options
|
|
166
|
+
async function setOrDeleteCookie(name, value, options) {
|
|
132
167
|
const cookieHelper = await createCookieHelper();
|
|
133
168
|
cookieHelper.setOrDelete(name, value, options);
|
|
134
169
|
}
|
|
135
|
-
function deleteCookieClient(name, options
|
|
170
|
+
function deleteCookieClient(name, options) {
|
|
136
171
|
ensureClient();
|
|
137
172
|
deleteCookieClientInternal(name, options);
|
|
138
173
|
}
|
|
139
|
-
async function deleteCookie(name, options
|
|
174
|
+
async function deleteCookie(name, options) {
|
|
140
175
|
const cookieHelper = await createCookieHelper();
|
|
141
176
|
cookieHelper.delete(name, options);
|
|
142
177
|
}
|
|
143
|
-
function setCookieClient(name, value, options
|
|
178
|
+
function setCookieClient(name, value, options) {
|
|
144
179
|
ensureClient();
|
|
145
180
|
setCookieClientInternal(name, value, options);
|
|
146
181
|
}
|
|
147
|
-
async function setCookie(name, value, options
|
|
182
|
+
async function setCookie(name, value, options) {
|
|
148
183
|
const cookieHelper = await createCookieHelper();
|
|
149
184
|
cookieHelper.set(name, value, options);
|
|
150
185
|
}
|
|
@@ -165,7 +200,7 @@ function consumeVerifierAndStateCookie(state) {
|
|
|
165
200
|
if (!codeVerifier) {
|
|
166
201
|
return null;
|
|
167
202
|
}
|
|
168
|
-
deleteCookieClient(cookieName);
|
|
203
|
+
deleteCookieClient(cookieName, {});
|
|
169
204
|
return {
|
|
170
205
|
codeVerifier
|
|
171
206
|
};
|
package/dist/lib/cookie.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/cookie.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { isBrowserLike } from '@stackframe/stack-shared/dist/utils/env';\nimport { StackAssertionError } from '@stackframe/stack-shared/dist/utils/errors';\nimport Cookies from \"js-cookie\";\nimport { calculatePKCECodeChallenge, generateRandomCodeVerifier, generateRandomState } from \"oauth4webapi\";\n\ntype SetCookieOptions = { maxAge?: number, noOpIfServerComponent?: boolean, domain?: string, secure?: boolean };\ntype DeleteCookieOptions = { noOpIfServerComponent?: boolean, domain?: string };\n\nfunction ensureClient() {\n if (!isBrowserLike()) {\n throw new Error(\"cookieClient functions can only be called in a browser environment, yet window is undefined\");\n }\n}\n\nexport type CookieHelper = {\n get: (name: string) => string | null,\n getAll: () => Record<string, string>,\n set: (name: string, value: string, options: SetCookieOptions) => void,\n setOrDelete: (name: string, value: string | null, options: SetCookieOptions & DeleteCookieOptions) => void,\n delete: (name: string, options: DeleteCookieOptions) => void,\n};\n\nconst placeholderCookieHelperIdentity = { \"placeholder cookie helper identity\": true };\nexport async function createPlaceholderCookieHelper(): Promise<CookieHelper> {\n function throwError(): never {\n throw new StackAssertionError(\"Throwing cookie helper is just a placeholder. This should never be called\");\n }\n return {\n get: throwError,\n getAll: throwError,\n set: throwError,\n setOrDelete: throwError,\n delete: throwError,\n };\n}\n\nexport async function createCookieHelper(): Promise<CookieHelper> {\n if (isBrowserLike()) {\n return createBrowserCookieHelper();\n } else {\n return await createPlaceholderCookieHelper();\n }\n}\n\nexport function createBrowserCookieHelper(): CookieHelper {\n return {\n get: getCookieClient,\n getAll: getAllCookiesClient,\n set: setCookieClient,\n setOrDelete: setOrDeleteCookieClient,\n delete: deleteCookieClient,\n };\n}\n\nfunction handleCookieError(e: unknown, options: DeleteCookieOptions | SetCookieOptions) {\n if (e instanceof Error && e.message.includes(\"Cookies can only be modified in\")) {\n if (options.noOpIfServerComponent) {\n // ignore\n } else {\n throw new StackAssertionError(\"Attempted to set cookie in server component. Pass { noOpIfServerComponent: true } in the options of Stack's cookie functions if this is intentional and you want to ignore this error. Read more: https://nextjs.org/docs/app/api-reference/functions/cookies#options\");\n }\n } else {\n throw e;\n }\n}\n\n\nexport function getCookieClient(name: string): string | null {\n const all = getAllCookiesClient();\n return all[name] ?? null;\n}\n\nexport function getAllCookiesClient(): Record<string, string> {\n ensureClient();\n // set a helper cookie, see comment in `NextCookieHelper.set` above\n Cookies.set(\"stack-is-https\", \"true\", { secure: true });\n return Cookies.get();\n}\n\nexport async function getCookie(name: string): Promise<string | null> {\n const cookieHelper = await createCookieHelper();\n return cookieHelper.get(name);\n}\n\nexport async function isSecure(): Promise<boolean> {\n if (isBrowserLike()) {\n return determineSecureFromClientContext();\n }\n return false;\n}\n\nfunction determineSecureFromClientContext(): boolean {\n return typeof window !== \"undefined\" && window.location.protocol === \"https:\";\n}\n\nfunction setCookieClientInternal(name: string, value: string, options: SetCookieOptions = {}) {\n const secure = options.secure ?? determineSecureFromClientContext();\n Cookies.set(name, value, {\n expires: options.maxAge === undefined ? undefined : new Date(Date.now() + (options.maxAge) * 1000),\n domain: options.domain,\n secure,\n });\n}\n\nfunction deleteCookieClientInternal(name: string, options: DeleteCookieOptions = {}) {\n if (options.domain !== undefined) {\n Cookies.remove(name, { domain: options.domain, secure: determineSecureFromClientContext() });\n }\n Cookies.remove(name, { secure: determineSecureFromClientContext() });\n}\n\nexport function setOrDeleteCookieClient(name: string, value: string | null, options: SetCookieOptions & DeleteCookieOptions = {}) {\n ensureClient();\n if (value === null) {\n deleteCookieClientInternal(name, options);\n } else {\n setCookieClientInternal(name, value, options);\n }\n}\n\nexport async function setOrDeleteCookie(name: string, value: string | null, options: SetCookieOptions & DeleteCookieOptions = {}) {\n const cookieHelper = await createCookieHelper();\n cookieHelper.setOrDelete(name, value, options);\n}\n\nexport function deleteCookieClient(name: string, options: DeleteCookieOptions = {}) {\n ensureClient();\n deleteCookieClientInternal(name, options);\n}\n\nexport async function deleteCookie(name: string, options: DeleteCookieOptions = {}) {\n const cookieHelper = await createCookieHelper();\n cookieHelper.delete(name, options);\n}\n\nexport function setCookieClient(name: string, value: string, options: SetCookieOptions = {}) {\n ensureClient();\n setCookieClientInternal(name, value, options);\n}\n\nexport async function setCookie(name: string, value: string, options: SetCookieOptions = {}) {\n const cookieHelper = await createCookieHelper();\n cookieHelper.set(name, value, options);\n}\n\nexport async function saveVerifierAndState() {\n const codeVerifier = generateRandomCodeVerifier();\n const codeChallenge = await calculatePKCECodeChallenge(codeVerifier);\n const state = generateRandomState();\n\n await setCookie(\"stack-oauth-outer-\" + state, codeVerifier, { maxAge: 60 * 60 });\n\n return {\n codeChallenge,\n state,\n };\n}\n\nexport function consumeVerifierAndStateCookie(state: string) {\n ensureClient();\n const cookieName = \"stack-oauth-outer-\" + state;\n const codeVerifier = getCookieClient(cookieName);\n if (!codeVerifier) {\n return null;\n }\n deleteCookieClient(cookieName);\n return {\n codeVerifier,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,iBAA8B;AAC9B,oBAAoC;AACpC,uBAAoB;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nE,QAAM,YAAQ,yCAAoB;AAElC,QAAM,UAAU,uBAAuB,OAAO,cAAc,EAAE,QAAQ,KAAK,GAAG,CAAC;AAE/E,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,8BAA8B,OAAe;AAC3D,eAAa;AACb,QAAM,aAAa,uBAAuB;AAC1C,QAAM,eAAe,gBAAgB,UAAU;AAC/C,MAAI,CAAC,cAAc;AACjB,WAAO;AAAA,EACT;AACA,qBAAmB,UAAU;AAC7B,SAAO;AAAA,IACL;AAAA,EACF;AACF;","names":["Cookies"]}
|
|
1
|
+
{"version":3,"sources":["../../src/lib/cookie.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { isBrowserLike } from '@stackframe/stack-shared/dist/utils/env';\nimport { StackAssertionError } from '@stackframe/stack-shared/dist/utils/errors';\nimport Cookies from \"js-cookie\";\nimport { calculatePKCECodeChallenge, generateRandomCodeVerifier, generateRandomState } from \"oauth4webapi\";\n\n\n// INFO: This file is used to manage cookies. It also sets some cookie flags automatically, see this description.\n//\n// It provides asynchronous setCookie, getCookie, deleteCookie, etc. functions that can be used in various environments\n// (browser + Next.js for now). Under the hood, they just get a CookieHelper object and then set the cookies there.\n//\n// The CookieHelper object is a simple object that lets you set, get and delete cookies synchronously. Acquiring one\n// is asynchronous (except for browser environments, where they can be acquired synchronously), but once you have it,\n// you can use it synchronously. This function is useful if you cannot await in the calling code, but otherwise you\n// should prefer to await the functions directly.\n//\n// Some cookie flags are set automatically by the CookieHelper (and hence also the <xyz>Cookie functions).\n// In particular:\n// - SameSite is set to `Lax` by default, which is already true in Chromium-based browsers, so this creates\n// compatibility with other browsers that use either Strict or None (particularly Safari and Firefox, and older\n// versions of Chrome). If Partitioned is automatically set (as described below), then this value is set to `None`\n// instead.\n// - Secure is set depending on whether we could successfully determine that the client is on HTTPS. For this, we use a\n// set of heuristics:\n// - In a browser environment, we check window.location.protocol which is always accurate\n// - In a Next.js server environment:\n// - First we check the `stack-is-https` cookie, which is set in various places on the\n// client with a Secure attribute. If that one is passed on to the server, we know that the client is on HTTPS\n// and we can set the Secure flag on the cookie. TODO: Should we also do this with a second cookie with a\n// __Host- prefix, so a malicious subdomain of the current domain cannot forcibly enable HTTPS mode and\n// therefore prevent new cookies from being set?\n// - Otherwise, we check the X-Forwarded-Proto header. If that one is `https`, we know that the client is\n// (pretending to be) on HTTPS and we can set the Secure flag on the cookie. Note that this header is\n// spoofable by malicious clients (so is the cookie actually), but since setting this value can only *increase*\n// security (and therefore prevent setting of a cookie), and requires a malicious client, this is still safe.\n// - If neither of the above is true, we don't set the Secure flag on the cookie.\n// - Partitioned is set depending on whether it is needed & supported. Unfortunately, the fact that Partitioned\n// cookies require SameSite=None, browsers that don't support it will still set them as normal third-party cookies,\n// which are fundamentally unsafe. Therefore, we need to take extra care that we only ever set Partitioned cookies\n// if we know for sure that the browser supports it.\n// - In a browser environment, we check:\n// - Whether `Secure` is set. If it's not, we don't set Partitioned.\n// - Whether we can set & retrieve cookies without Partitioned being set. If this is the case, we are likely in a\n// top-level context or a browser that partitions cookies by default (eg. Firefox). In this case, we don't need\n// Partitioned and can just proceed as normal.\n// - Whether CHIPS is supported. To prevent the case where CHIPS is not supported but third-party cookies are (in\n// which we would accidentally set SameSite=None without Partitioned as the latter requires the former), we\n// check this by running a simple test with document.cookie.\n// - Whether the browser supports Partitioned cookies. If yes, set Partitioned. Otherwise, don't set Partitioned.\n// Since there's no easy cross-compat way to do this (CookieStore and document.cookie do not return whether a\n// cookie is partitioned on some/all versions of Safari and Firefox), we use a heuristic; we run this test by\n// creating two cookies with the same name: One with Partitioned and one without. If there are two resulting\n// cookies, that means they were put into different jars, implying that the browser supports Partitioned cookies\n// (but doesn't partition cookies by default). If they result in just one cookie, that could mean that the\n// browser doesn't support Partitioned cookies, or that the browser doesn't put partitioned cookies into\n// different jars by default, in which case we still don't know. This heuristic works on Chrome, but may\n// incorrectly conclude that some other browsers don't support Partitioned. But from a security perspective,\n// that is better than accidentally setting SameSite=None without Partitioned. TODO: Find a better heuristic to\n// to determine whether the browser supports Partitioned cookies or not.\n// - In a Next.js server environment, right now we do nothing because of the complexity involved :( TODO: In the\n// future, we could improve this for example by setting hint cookies from the client, but we need to make sure that\n// no malicious actor (eg. on a malicious subdomain) can forcefully enable Partitioned cookies on a browser that\n// does not support it.\n\n\ntype SetCookieOptions = { maxAge: number | \"session\", noOpIfServerComponent?: boolean, domain?: string, secure?: boolean };\ntype DeleteCookieOptions = { noOpIfServerComponent?: boolean, domain?: string };\n\nfunction ensureClient() {\n if (!isBrowserLike()) {\n throw new Error(\"cookieClient functions can only be called in a browser environment, yet window is undefined\");\n }\n}\n\nexport type CookieHelper = {\n get: (name: string) => string | null,\n getAll: () => Record<string, string>,\n set: (name: string, value: string, options: SetCookieOptions) => void,\n setOrDelete: (name: string, value: string | null, options: SetCookieOptions & DeleteCookieOptions) => void,\n delete: (name: string, options: DeleteCookieOptions) => void,\n};\n\nconst placeholderCookieHelperIdentity = { \"placeholder cookie helper identity\": true };\nexport async function createPlaceholderCookieHelper(): Promise<CookieHelper> {\n function throwError(): never {\n throw new StackAssertionError(\"Throwing cookie helper is just a placeholder. This should never be called\");\n }\n return {\n get: throwError,\n getAll: throwError,\n set: throwError,\n setOrDelete: throwError,\n delete: throwError,\n };\n}\n\nexport async function createCookieHelper(): Promise<CookieHelper> {\n if (isBrowserLike()) {\n return createBrowserCookieHelper();\n } else {\n return await createPlaceholderCookieHelper();\n }\n}\n\nexport function createBrowserCookieHelper(): CookieHelper {\n return {\n get: getCookieClient,\n getAll: getAllCookiesClient,\n set: setCookieClient,\n setOrDelete: setOrDeleteCookieClient,\n delete: deleteCookieClient,\n };\n}\n\nfunction handleCookieError(e: unknown, options: DeleteCookieOptions | SetCookieOptions) {\n if (e instanceof Error && e.message.includes(\"Cookies can only be modified in\")) {\n if (options.noOpIfServerComponent) {\n // ignore\n } else {\n throw new StackAssertionError(\"Attempted to set cookie in server component. Pass { noOpIfServerComponent: true } in the options of Stack's cookie functions if this is intentional and you want to ignore this error. Read more: https://nextjs.org/docs/app/api-reference/functions/cookies#options\");\n }\n } else {\n throw e;\n }\n}\n\n\nexport function getCookieClient(name: string): string | null {\n const all = getAllCookiesClient();\n return all[name] ?? null;\n}\n\nexport function getAllCookiesClient(): Record<string, string> {\n ensureClient();\n // set a helper cookie, see comment in `NextCookieHelper.set` above\n Cookies.set(\"stack-is-https\", \"true\", { secure: true, expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365) });\n return Cookies.get();\n}\n\nexport async function getCookie(name: string): Promise<string | null> {\n const cookieHelper = await createCookieHelper();\n return cookieHelper.get(name);\n}\n\nexport async function isSecure(): Promise<boolean> {\n if (isBrowserLike()) {\n return determineSecureFromClientContext();\n }\n return false;\n}\n\nfunction determineSecureFromClientContext(): boolean {\n return typeof window !== \"undefined\" && window.location.protocol === \"https:\";\n}\n\n\nlet _shouldSetPartitionedClientCache: boolean | undefined = undefined;\nfunction shouldSetPartitionedClient() {\n return _shouldSetPartitionedClientCache ??= _internalShouldSetPartitionedClient();\n}\nfunction _internalShouldSetPartitionedClient() {\n ensureClient();\n\n if (!(determineSecureFromClientContext())) {\n return false;\n }\n\n // check whether we can set & retrieve normal cookies (either because we're on a top-level/same-origin context or the browser partitions cookies by default)\n const cookie1Name = \"__Host-stack-temporary-chips-test-\" + Math.random().toString(36).substring(2, 15);\n document.cookie = `${cookie1Name}=value1; Secure; path=/`;\n const cookies1 = document.cookie.split(\"; \");\n document.cookie = `${cookie1Name}=delete1; Secure; path=/; expires=Thu, 01 Jan 1970 00:00:00 UTC;`;\n if (cookies1.some((c) => c.startsWith(cookie1Name + \"=\"))) {\n return false;\n }\n\n\n // check whether Partitioned cookies are supported by the browser\n // TODO: See comment at the top. Feels like we should find a better way to do this\n const cookie2Name = \"__Host-stack-temporary-chips-test-\" + Math.random().toString(36).substring(2, 15);\n\n // just to be safe, delete the cookie first to avoid weird RNG-prediction attacks\n // I don't know what they look like (since this is a host cookie) but better safe than sorry\n // (this function should be 100% bulletproof so we don't accidentally fall back to non-partitioned third party cookies on unsupported browsers)\n document.cookie = `${cookie2Name}=delete1; Secure; SameSite=None; Partitioned; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/`;\n document.cookie = `${cookie2Name}=delete2; Secure; SameSite=None; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/`;\n\n // set the cookie, once partitioned and once not partitioned\n document.cookie = `${cookie2Name}=set1; Secure; SameSite=None; Partitioned; path=/`;\n document.cookie = `${cookie2Name}=set2; Secure; SameSite=None; path=/`;\n\n // check if there are two cookies\n const cookies2 = document.cookie.split(\"; \");\n const numberOfCookiesWithThisName = cookies2.filter((c) => c.startsWith(cookie2Name + \"=\")).length;\n\n // clean up\n document.cookie = `${cookie2Name}=delete3; Secure; SameSite=None; Partitioned; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/`;\n document.cookie = `${cookie2Name}=delete4; Secure; SameSite=None; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/`;\n\n return numberOfCookiesWithThisName === 2;\n}\n\nfunction setCookieClientInternal(name: string, value: string, options: SetCookieOptions) {\n const secure = options.secure ?? determineSecureFromClientContext();\n const partitioned = shouldSetPartitionedClient();\n Cookies.set(name, value, {\n expires: options.maxAge === \"session\" ? undefined : new Date(Date.now() + (options.maxAge) * 1000),\n domain: options.domain,\n secure,\n sameSite: \"Lax\",\n ...(partitioned ? {\n partitioned,\n sameSite: \"None\",\n } : {}),\n });\n}\n\nfunction deleteCookieClientInternal(name: string, options: DeleteCookieOptions) {\n for (const partitioned of [true, false]) {\n if (options.domain !== undefined) {\n Cookies.remove(name, { domain: options.domain, secure: determineSecureFromClientContext(), partitioned });\n }\n Cookies.remove(name, { secure: determineSecureFromClientContext(), partitioned });\n }\n}\n\nexport function setOrDeleteCookieClient(name: string, value: string | null, options: SetCookieOptions & DeleteCookieOptions) {\n ensureClient();\n if (value === null) {\n deleteCookieClientInternal(name, options);\n } else {\n setCookieClientInternal(name, value, options);\n }\n}\n\nexport async function setOrDeleteCookie(name: string, value: string | null, options: SetCookieOptions & DeleteCookieOptions) {\n const cookieHelper = await createCookieHelper();\n cookieHelper.setOrDelete(name, value, options);\n}\n\nexport function deleteCookieClient(name: string, options: DeleteCookieOptions) {\n ensureClient();\n deleteCookieClientInternal(name, options);\n}\n\nexport async function deleteCookie(name: string, options: DeleteCookieOptions) {\n const cookieHelper = await createCookieHelper();\n cookieHelper.delete(name, options);\n}\n\nexport function setCookieClient(name: string, value: string, options: SetCookieOptions) {\n ensureClient();\n setCookieClientInternal(name, value, options);\n}\n\nexport async function setCookie(name: string, value: string, options: SetCookieOptions) {\n const cookieHelper = await createCookieHelper();\n cookieHelper.set(name, value, options);\n}\n\nexport async function saveVerifierAndState() {\n const codeVerifier = generateRandomCodeVerifier();\n const codeChallenge = await calculatePKCECodeChallenge(codeVerifier);\n const state = generateRandomState();\n\n await setCookie(\"stack-oauth-outer-\" + state, codeVerifier, { maxAge: 60 * 60 });\n\n return {\n codeChallenge,\n state,\n };\n}\n\nexport function consumeVerifierAndStateCookie(state: string) {\n ensureClient();\n const cookieName = \"stack-oauth-outer-\" + state;\n const codeVerifier = getCookieClient(cookieName);\n if (!codeVerifier) {\n return null;\n }\n deleteCookieClient(cookieName, {});\n return {\n codeVerifier,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,iBAA8B;AAC9B,oBAAoC;AACpC,uBAAoB;AACpB,0BAA4F;AAiE5F,SAAS,eAAe;AACtB,MAAI,KAAC,0BAAc,GAAG;AACpB,UAAM,IAAI,MAAM,6FAA6F;AAAA,EAC/G;AACF;AAWA,eAAsB,gCAAuD;AAC3E,WAAS,aAAoB;A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