@hexclave/js 1.0.21 → 1.0.22

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.
Files changed (46) hide show
  1. package/README.md +187 -7
  2. package/dist/esm/lib/auth.d.ts.map +1 -1
  3. package/dist/esm/lib/auth.js +32 -11
  4. package/dist/esm/lib/auth.js.map +1 -1
  5. package/dist/esm/lib/auth.test.js +25 -10
  6. package/dist/esm/lib/auth.test.js.map +1 -1
  7. package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts +1 -0
  8. package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts.map +1 -1
  9. package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.js +1 -0
  10. package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.js.map +1 -1
  11. package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.cross-domain.test.js +54 -0
  12. package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.cross-domain.test.js.map +1 -1
  13. package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.d.ts +4 -1
  14. package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.d.ts.map +1 -1
  15. package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.js +28 -4
  16. package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.js.map +1 -1
  17. package/dist/esm/lib/hexclave-app/apps/implementations/common.js +1 -1
  18. package/dist/esm/lib/hexclave-app/apps/interfaces/admin-app.d.ts +1 -0
  19. package/dist/esm/lib/hexclave-app/apps/interfaces/admin-app.d.ts.map +1 -1
  20. package/dist/esm/lib/hexclave-app/apps/interfaces/admin-app.js.map +1 -1
  21. package/dist/lib/auth.d.ts.map +1 -1
  22. package/dist/lib/auth.js +31 -10
  23. package/dist/lib/auth.js.map +1 -1
  24. package/dist/lib/auth.test.js +23 -8
  25. package/dist/lib/auth.test.js.map +1 -1
  26. package/dist/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts +1 -0
  27. package/dist/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts.map +1 -1
  28. package/dist/lib/hexclave-app/apps/implementations/admin-app-impl.js +1 -0
  29. package/dist/lib/hexclave-app/apps/implementations/admin-app-impl.js.map +1 -1
  30. package/dist/lib/hexclave-app/apps/implementations/client-app-impl.cross-domain.test.js +54 -0
  31. package/dist/lib/hexclave-app/apps/implementations/client-app-impl.cross-domain.test.js.map +1 -1
  32. package/dist/lib/hexclave-app/apps/implementations/client-app-impl.d.ts +4 -1
  33. package/dist/lib/hexclave-app/apps/implementations/client-app-impl.d.ts.map +1 -1
  34. package/dist/lib/hexclave-app/apps/implementations/client-app-impl.js +27 -3
  35. package/dist/lib/hexclave-app/apps/implementations/client-app-impl.js.map +1 -1
  36. package/dist/lib/hexclave-app/apps/implementations/common.js +1 -1
  37. package/dist/lib/hexclave-app/apps/interfaces/admin-app.d.ts +1 -0
  38. package/dist/lib/hexclave-app/apps/interfaces/admin-app.d.ts.map +1 -1
  39. package/dist/lib/hexclave-app/apps/interfaces/admin-app.js.map +1 -1
  40. package/package.json +2 -2
  41. package/src/lib/auth.test.ts +32 -10
  42. package/src/lib/auth.ts +41 -7
  43. package/src/lib/hexclave-app/apps/implementations/admin-app-impl.ts +2 -1
  44. package/src/lib/hexclave-app/apps/implementations/client-app-impl.cross-domain.test.ts +66 -0
  45. package/src/lib/hexclave-app/apps/implementations/client-app-impl.ts +39 -3
  46. package/src/lib/hexclave-app/apps/interfaces/admin-app.ts +1 -0
@@ -14,7 +14,7 @@ let _hexclave_shared_dist_utils_caches = require("@hexclave/shared/dist/utils/ca
14
14
  let _hexclave_shared_dist_utils_globals = require("@hexclave/shared/dist/utils/globals");
15
15
 
16
16
  //#region src/lib/hexclave-app/apps/implementations/common.ts
17
- const clientVersion = "js @hexclave/js@1.0.21";
17
+ const clientVersion = "js @hexclave/js@1.0.22";
18
18
  if (clientVersion.startsWith("STACK_COMPILE_TIME")) throw new _hexclave_shared_dist_utils_errors.HexclaveAssertionError("Client version was not replaced. Something went wrong during build!");
19
19
  const replaceHexclavePortPrefix = (input) => {
20
20
  if (!input) return input;
@@ -17,6 +17,7 @@ import { MoneyAmount } from "@hexclave/shared/dist/utils/currency-constants";
17
17
  type EmailOutboxListOptions = {
18
18
  status?: string;
19
19
  simpleStatus?: string;
20
+ userId?: string;
20
21
  limit?: number;
21
22
  cursor?: string;
22
23
  };
@@ -1 +1 @@
1
- {"version":3,"file":"admin-app.d.ts","names":[],"sources":["../../../../../src/lib/hexclave-app/apps/interfaces/admin-app.ts"],"mappings":";;;;;;;;;;;;;;;;KAmBY,sBAAA;EACV,MAAA;EACA,YAAA;EACA,KAAA;EACA,MAAA;AAAA;AAAA,KAGU,qBAAA;EACV,KAAA,EAAO,gBAAA;EACP,UAAA;AAAA;AAAA,KAGU,wBAAA;EACV,QAAA;EACA,iBAAA;EACA,MAAA;EACA,SAAA;EACA,OAAA;AAAA;AAAA,KAGU,+BAAA;EACV,QAAA;EACA,SAAA;EACA,eAAA;EACA,iBAAA;EACA,MAAA,EAAQ,0BAAA;AAAA;AAAA,KAGE,0BAAA;EACV,MAAA;AAAA;AAAA,KAGU,4BAAA;EACV,QAAA;EACA,SAAA;EACA,eAAA;EACA,MAAA,EAAQ,0BAAA;EACR,iBAAA;AAAA;;KAQU,+BAAA,6DACR,gCAAA,CAAiC,aAAA,EAAe,SAAA;EAEhD,mBAAA;EACA,mBAAA,GAAsB,eAAA,UAAyB,OAAA;AAAA;;KAMvC,aAAA,gFACR,kBAAA,gBAAkC,YAAA,WAClC,kBAAA,wBAA0C,cAAA,YAC1C,kBAAA,kCAAoD,6BAAA,YACpD,kBAAA,qCAAuD,gCAAA,YACvD,kBAAA;EAAwC,EAAA;EAAY,WAAA;AAAA,aACpD,kBAAA;EAAsC,OAAA;EAAiC,cAAA;EAAyB,UAAA;EAAqB,iBAAA;AAAA,qBACrH,kBAAA;EAA2C,EAAA;EAAY,WAAA;EAAqB,OAAA;EAAk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AAA,CAAiB,eAAA,WAA0B,OAAA,CAAQ,kBAAA;EACnD,uBAAA,CAAwB,eAAA,UAAyB,OAAA,GAAU,8BAAA,GAAiC,OAAA,CAAQ,6BAAA;EACpG,2BAAA,CAA4B,eAAA,UAAyB,OAAA,WAAkB,OAAA,CAAQ,wCAAA;EAC/E,sBAAA,CAAuB,eAAA,UAAyB,OAAA;IAAY,MAAA;IAAiB,KAAA;EAAA,IAAmB,OAAA,CAAQ,4BAAA;EAGxG,gBAAA,CAAiB,OAAA,GAAU,sBAAA,GAAyB,OAAA,CAAQ,qBAAA;EAC5D,cAAA,CAAe,EAAA,WAAa,OAAA,CAAQ,gBAAA;EACpC,iBAAA,CAAkB,EAAA,UAAY,OAAA,EAAS,wBAAA,GAA2B,OAAA,CAAQ,gBAAA;EAC1E,gBAAA,CAAiB,EAAA,WAAa,OAAA,CAAQ,gBAAA;EACtC,kBAAA,CAAmB,EAAA,WAAa,OAAA,CAAQ,gBAAA;EACxC,iBAAA,CAAkB,EAAA,WAAa,OAAA,CAAQ,gBAAA;AAAA,IAEvC,cAAA,CAAe,aAAA,EAAe,SAAA;;KAGtB,wBAAA;EAAA,8DAIR,OAAA,EAAS,+BAAA,CAAgC,aAAA,EAAe,SAAA,IAAa,aAAA,CAAc,aAAA,EAAe,SAAA;EAAA,KAChG,OAAA,EAAS,+BAAA,oBAAmD,aAAA;AAAA;AAAA,KAEtD,kCAAA,4DAA8F,+BAAA,CAAgC,aAAA,EAAe,SAAA;AAAA,KAC7I,gBAAA,+EAA+F,aAAA,CAAc,aAAA,EAAe,SAAA;AAAA,KAC5H,2BAAA,GAA8B,wBAAA;AAAA,cAC7B,gBAAA,EAAkB,2BAAA;;cAElB,aAAA,EAAe,wBAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"admin-app.js","names":["_HexclaveAdminAppImpl"],"sources":["../../../../../src/lib/hexclave-app/apps/interfaces/admin-app.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\nimport type { AnalyticsClickmapOptions, AnalyticsClickmapResponse, AnalyticsClickmapTokenResponse } from \"@hexclave/shared/dist/interface/admin-metrics\";\nimport { AnalyticsQueryOptions, AnalyticsQueryResponse } from \"@hexclave/shared/dist/interface/crud/analytics\";\nimport type { AdminGetSessionReplayChunkEventsResponse, AdminGetSessionReplayAllEventsResponse } from \"@hexclave/shared/dist/interface/crud/session-replays\";\nimport type { Transaction, TransactionType } from \"@hexclave/shared/dist/interface/crud/transactions\";\nimport { InternalSession } from \"@hexclave/shared/dist/sessions\";\nimport type { MoneyAmount } from \"@hexclave/shared/dist/utils/currency-constants\";\nimport { Result } from \"@hexclave/shared/dist/utils/results\";\nimport { AsyncStoreProperty, EmailConfig } from \"../../common\";\nimport { AdminEmailOutbox, AdminSentEmail } from \"../../email\";\nimport { InternalApiKey, InternalApiKeyCreateOptions, InternalApiKeyFirstView } from \"../../internal-api-keys\";\nimport { AdminProjectPermission, AdminProjectPermissionDefinition, AdminProjectPermissionDefinitionCreateOptions, AdminProjectPermissionDefinitionUpdateOptions, AdminTeamPermission, AdminTeamPermissionDefinition, AdminTeamPermissionDefinitionCreateOptions, AdminTeamPermissionDefinitionUpdateOptions } from \"../../permissions\";\nimport { AdminProject } from \"../../projects\";\nimport { _HexclaveAdminAppImpl } from \"../implementations\";\nimport { StackServerApp, StackServerAppConstructorOptions } from \"./server-app\";\n\nexport type EmailOutboxListOptions = {\n status?: string,\n simpleStatus?: string,\n limit?: number,\n cursor?: string,\n};\n\nexport type EmailOutboxListResult = {\n items: AdminEmailOutbox[],\n nextCursor: string | null,\n};\n\nexport type EmailOutboxUpdateOptions = {\n isPaused?: boolean,\n scheduledAtMillis?: number,\n cancel?: boolean,\n tsxSource?: string,\n themeId?: string | null,\n};\n\nexport type ManagedEmailProviderSetupResult = {\n domainId: string,\n subdomain: string,\n senderLocalPart: string,\n nameServerRecords: string[],\n status: ManagedEmailProviderStatus[\"status\"],\n};\n\nexport type ManagedEmailProviderStatus = {\n status: \"pending_dns\" | \"pending_verification\" | \"verified\" | \"applied\" | \"failed\",\n};\n\nexport type ManagedEmailProviderListItem = {\n domainId: string,\n subdomain: string,\n senderLocalPart: string,\n status: ManagedEmailProviderStatus[\"status\"],\n nameServerRecords: string[],\n};\n\nimport type { AdminSessionReplay, ListSessionReplayChunksOptions, ListSessionReplayChunksResult, ListSessionReplaysOptions, ListSessionReplaysResult, SessionReplayAllEventsResult } from \"../../session-replays\";\nexport type { AdminSessionReplay, AdminSessionReplayChunk, ListSessionReplaysOptions, ListSessionReplaysResult, ListSessionReplayChunksOptions, ListSessionReplayChunksResult, SessionReplayAllEventsResult } from \"../../session-replays\";\n\n\n/** @deprecated Use `HexclaveAdminAppConstructorOptions` from the `@hexclave/*` package instead — same symbol, new brand name. See https://docs.hexclave.com/migration. */\nexport type StackAdminAppConstructorOptions<HasTokenStore extends boolean, ProjectId extends string> = (\n & StackServerAppConstructorOptions<HasTokenStore, ProjectId>\n & {\n superSecretAdminKey?: string,\n projectOwnerSession?: InternalSession | (() => Promise<string | null>),\n }\n);\n\n\n/** @deprecated Use `HexclaveAdminApp` from the `@hexclave/*` package instead — same symbol, new brand name. See https://docs.hexclave.com/migration. */\nexport type StackAdminApp<HasTokenStore extends boolean = boolean, ProjectId extends string = string> = (\n & AsyncStoreProperty<\"project\", [], AdminProject, false>\n & AsyncStoreProperty<\"internalApiKeys\", [], InternalApiKey[], true>\n & AsyncStoreProperty<\"teamPermissionDefinitions\", [], AdminTeamPermissionDefinition[], true>\n & AsyncStoreProperty<\"projectPermissionDefinitions\", [], AdminProjectPermissionDefinition[], true>\n & AsyncStoreProperty<\"emailThemes\", [], { id: string, displayName: string }[], true>\n & AsyncStoreProperty<\"emailPreview\", [{ themeId?: string | null | false, themeTsxSource?: string, templateId?: string, templateTsxSource?: string }], string, false>\n & AsyncStoreProperty<\"emailTemplates\", [], { id: string, displayName: string, themeId?: string, tsxSource: string }[], true>\n & AsyncStoreProperty<\"emailDrafts\", [], { id: string, displayName: string, themeId: string | undefined | false, tsxSource: string, sentAt: Date | null }[], true>\n & AsyncStoreProperty<\"stripeAccountInfo\", [], { account_id: string, charges_enabled: boolean, details_submitted: boolean, payouts_enabled: boolean } | null, false>\n & AsyncStoreProperty<\n \"transactions\",\n [{\n cursor?: string,\n limit?: number,\n type?: TransactionType,\n customerType?: 'user' | 'team' | 'custom',\n customerId?: string,\n }],\n { transactions: Transaction[], nextCursor: string | null },\n true\n >\n & {\n createInternalApiKey(options: InternalApiKeyCreateOptions): Promise<InternalApiKeyFirstView>,\n\n createTeamPermissionDefinition(data: AdminTeamPermissionDefinitionCreateOptions): Promise<AdminTeamPermission>,\n updateTeamPermissionDefinition(permissionId: string, data: AdminTeamPermissionDefinitionUpdateOptions): Promise<void>,\n deleteTeamPermissionDefinition(permissionId: string): Promise<void>,\n /**\n * @param options.query Free-text search; matches against permission ID and description.\n */\n listTeamPermissionDefinitionsPaginated(options: { limit: number, cursor?: string, query?: string }): Promise<{ items: AdminTeamPermissionDefinition[], nextCursor: string | null }>,\n\n createProjectPermissionDefinition(data: AdminProjectPermissionDefinitionCreateOptions): Promise<AdminProjectPermission>,\n updateProjectPermissionDefinition(permissionId: string, data: AdminProjectPermissionDefinitionUpdateOptions): Promise<void>,\n deleteProjectPermissionDefinition(permissionId: string): Promise<void>,\n\n\n sendTestEmail(options: {\n recipientEmail: string,\n emailConfig: EmailConfig,\n }): Promise<Result<undefined, { errorMessage: string }>>,\n\n sendTestWebhook(options: { endpointId: string }): Promise<Result<undefined, { errorMessage: string }>>,\n\n sendSignInInvitationEmail(email: string, callbackUrl: string): Promise<void>,\n\n listSentEmails(): Promise<AdminSentEmail[]>,\n setupManagedEmailProvider(options: { subdomain: string, senderLocalPart: string }): Promise<ManagedEmailProviderSetupResult>,\n checkManagedEmailStatus(options: { domainId: string, subdomain: string, senderLocalPart: string }): Promise<ManagedEmailProviderStatus>,\n listManagedEmailDomains(): Promise<ManagedEmailProviderListItem[]>,\n applyManagedEmailProvider(options: { domainId: string }): Promise<{ status: \"applied\" }>,\n deleteManagedEmailDomain(options: { resendDomainId: string }): Promise<{ status: \"deleted\" }>,\n\n createEmailTheme(displayName: string): Promise<{ id: string }>,\n updateEmailTheme(id: string, tsxSource: string): Promise<void>,\n deleteEmailTheme(id: string): Promise<void>,\n saveChatMessage(threadId: string, message: any): Promise<void>,\n listChatMessages(threadId: string): Promise<{ messages: Array<any> }>,\n rewriteTemplateSourceWithAI(templateTsxSource: string): Promise<{ tsxSource: string }>,\n updateEmailTemplate(id: string, tsxSource: string, themeId: string | null | false): Promise<{ renderedHtml: string }>,\n createEmailTemplate(displayName: string): Promise<{ id: string }>,\n deleteEmailTemplate(id: string): Promise<void>,\n\n setupPayments(): Promise<{ url: string }>,\n createStripeWidgetAccountSession(): Promise<{ client_secret: string }>,\n getPaymentMethodConfigs(): Promise<{ configId: string, methods: Array<{ id: string, name: string, enabled: boolean, available: boolean, overridable: boolean }> } | null>,\n updatePaymentMethodConfigs(configId: string, updates: Record<string, 'on' | 'off'>): Promise<void>,\n createEmailDraft(options: { displayName: string, themeId?: string | undefined | false, tsxSource?: string }): Promise<{ id: string }>,\n updateEmailDraft(id: string, data: { displayName?: string, themeId?: string | undefined | false, tsxSource?: string }): Promise<void>,\n deleteEmailDraft(id: string): Promise<void>,\n refreshEmailDrafts(): Promise<void>,\n createItemQuantityChange(options: (\n { userId: string, itemId: string, quantity: number, expiresAt?: string, description?: string } |\n { teamId: string, itemId: string, quantity: number, expiresAt?: string, description?: string } |\n { customCustomerId: string, itemId: string, quantity: number, expiresAt?: string, description?: string }\n )): Promise<void>,\n refundTransaction(options: {\n type: \"subscription\" | \"one-time-purchase\",\n id: string,\n invoiceId?: string,\n amountUsd: MoneyAmount,\n endAction?: \"now\" | \"at-period-end\",\n }): Promise<{ refundTransactionId: string }>,\n queryAnalytics(options: AnalyticsQueryOptions): Promise<AnalyticsQueryResponse>,\n getAnalyticsClickmap(options: AnalyticsClickmapOptions): Promise<AnalyticsClickmapResponse>,\n createAnalyticsClickmapToken(options: { origin: string }): Promise<AnalyticsClickmapTokenResponse>,\n\n listSessionReplays(options?: ListSessionReplaysOptions): Promise<ListSessionReplaysResult>,\n getSessionReplay(sessionReplayId: string): Promise<AdminSessionReplay>,\n listSessionReplayChunks(sessionReplayId: string, options?: ListSessionReplayChunksOptions): Promise<ListSessionReplayChunksResult>,\n getSessionReplayChunkEvents(sessionReplayId: string, chunkId: string): Promise<AdminGetSessionReplayChunkEventsResponse>,\n getSessionReplayEvents(sessionReplayId: string, options?: { offset?: number, limit?: number }): Promise<SessionReplayAllEventsResult>,\n\n // Email Outbox methods\n listOutboxEmails(options?: EmailOutboxListOptions): Promise<EmailOutboxListResult>,\n getOutboxEmail(id: string): Promise<AdminEmailOutbox>,\n updateOutboxEmail(id: string, options: EmailOutboxUpdateOptions): Promise<AdminEmailOutbox>,\n pauseOutboxEmail(id: string): Promise<AdminEmailOutbox>,\n unpauseOutboxEmail(id: string): Promise<AdminEmailOutbox>,\n cancelOutboxEmail(id: string): Promise<AdminEmailOutbox>,\n }\n & StackServerApp<HasTokenStore, ProjectId>\n);\n/** @deprecated Use `HexclaveAdminAppConstructor` from the `@hexclave/*` package instead — same symbol, new brand name. See https://docs.hexclave.com/migration. */\nexport type StackAdminAppConstructor = {\n new <\n HasTokenStore extends boolean,\n ProjectId extends string\n >(options: StackAdminAppConstructorOptions<HasTokenStore, ProjectId>): StackAdminApp<HasTokenStore, ProjectId>,\n new(options: StackAdminAppConstructorOptions<boolean, string>): StackAdminApp<boolean, string>,\n};\nexport type HexclaveAdminAppConstructorOptions<HasTokenStore extends boolean, ProjectId extends string> = StackAdminAppConstructorOptions<HasTokenStore, ProjectId>;\nexport type HexclaveAdminApp<HasTokenStore extends boolean = boolean, ProjectId extends string = string> = StackAdminApp<HasTokenStore, ProjectId>;\nexport type HexclaveAdminAppConstructor = StackAdminAppConstructor;\nexport const HexclaveAdminApp: HexclaveAdminAppConstructor = _HexclaveAdminAppImpl;\n/** @deprecated Use `HexclaveAdminApp` from the `@hexclave/*` package instead — same symbol, new brand name. See https://docs.hexclave.com/migration. */\nexport const StackAdminApp: StackAdminAppConstructor = HexclaveAdminApp;\n"],"mappings":";;;;;AA6LA,MAAa,mBAAgDA;;AAE7D,MAAa,gBAA0C"}
1
+ {"version":3,"file":"admin-app.js","names":["_HexclaveAdminAppImpl"],"sources":["../../../../../src/lib/hexclave-app/apps/interfaces/admin-app.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\nimport type { AnalyticsClickmapOptions, AnalyticsClickmapResponse, AnalyticsClickmapTokenResponse } from \"@hexclave/shared/dist/interface/admin-metrics\";\nimport { AnalyticsQueryOptions, AnalyticsQueryResponse } from \"@hexclave/shared/dist/interface/crud/analytics\";\nimport type { AdminGetSessionReplayChunkEventsResponse, AdminGetSessionReplayAllEventsResponse } from \"@hexclave/shared/dist/interface/crud/session-replays\";\nimport type { Transaction, TransactionType } from \"@hexclave/shared/dist/interface/crud/transactions\";\nimport { InternalSession } from \"@hexclave/shared/dist/sessions\";\nimport type { MoneyAmount } from \"@hexclave/shared/dist/utils/currency-constants\";\nimport { Result } from \"@hexclave/shared/dist/utils/results\";\nimport { AsyncStoreProperty, EmailConfig } from \"../../common\";\nimport { AdminEmailOutbox, AdminSentEmail } from \"../../email\";\nimport { InternalApiKey, InternalApiKeyCreateOptions, InternalApiKeyFirstView } from \"../../internal-api-keys\";\nimport { AdminProjectPermission, AdminProjectPermissionDefinition, AdminProjectPermissionDefinitionCreateOptions, AdminProjectPermissionDefinitionUpdateOptions, AdminTeamPermission, AdminTeamPermissionDefinition, AdminTeamPermissionDefinitionCreateOptions, AdminTeamPermissionDefinitionUpdateOptions } from \"../../permissions\";\nimport { AdminProject } from \"../../projects\";\nimport { _HexclaveAdminAppImpl } from \"../implementations\";\nimport { StackServerApp, StackServerAppConstructorOptions } from \"./server-app\";\n\nexport type EmailOutboxListOptions = {\n status?: string,\n simpleStatus?: string,\n userId?: string,\n limit?: number,\n cursor?: string,\n};\n\nexport type EmailOutboxListResult = {\n items: AdminEmailOutbox[],\n nextCursor: string | null,\n};\n\nexport type EmailOutboxUpdateOptions = {\n isPaused?: boolean,\n scheduledAtMillis?: number,\n cancel?: boolean,\n tsxSource?: string,\n themeId?: string | null,\n};\n\nexport type ManagedEmailProviderSetupResult = {\n domainId: string,\n subdomain: string,\n senderLocalPart: string,\n nameServerRecords: string[],\n status: ManagedEmailProviderStatus[\"status\"],\n};\n\nexport type ManagedEmailProviderStatus = {\n status: \"pending_dns\" | \"pending_verification\" | \"verified\" | \"applied\" | \"failed\",\n};\n\nexport type ManagedEmailProviderListItem = {\n domainId: string,\n subdomain: string,\n senderLocalPart: string,\n status: ManagedEmailProviderStatus[\"status\"],\n nameServerRecords: string[],\n};\n\nimport type { AdminSessionReplay, ListSessionReplayChunksOptions, ListSessionReplayChunksResult, ListSessionReplaysOptions, ListSessionReplaysResult, SessionReplayAllEventsResult } from \"../../session-replays\";\nexport type { AdminSessionReplay, AdminSessionReplayChunk, ListSessionReplaysOptions, ListSessionReplaysResult, ListSessionReplayChunksOptions, ListSessionReplayChunksResult, SessionReplayAllEventsResult } from \"../../session-replays\";\n\n\n/** @deprecated Use `HexclaveAdminAppConstructorOptions` from the `@hexclave/*` package instead — same symbol, new brand name. See https://docs.hexclave.com/migration. */\nexport type StackAdminAppConstructorOptions<HasTokenStore extends boolean, ProjectId extends string> = (\n & StackServerAppConstructorOptions<HasTokenStore, ProjectId>\n & {\n superSecretAdminKey?: string,\n projectOwnerSession?: InternalSession | (() => Promise<string | null>),\n }\n);\n\n\n/** @deprecated Use `HexclaveAdminApp` from the `@hexclave/*` package instead — same symbol, new brand name. See https://docs.hexclave.com/migration. */\nexport type StackAdminApp<HasTokenStore extends boolean = boolean, ProjectId extends string = string> = (\n & AsyncStoreProperty<\"project\", [], AdminProject, false>\n & AsyncStoreProperty<\"internalApiKeys\", [], InternalApiKey[], true>\n & AsyncStoreProperty<\"teamPermissionDefinitions\", [], AdminTeamPermissionDefinition[], true>\n & AsyncStoreProperty<\"projectPermissionDefinitions\", [], AdminProjectPermissionDefinition[], true>\n & AsyncStoreProperty<\"emailThemes\", [], { id: string, displayName: string }[], true>\n & AsyncStoreProperty<\"emailPreview\", [{ themeId?: string | null | false, themeTsxSource?: string, templateId?: string, templateTsxSource?: string }], string, false>\n & AsyncStoreProperty<\"emailTemplates\", [], { id: string, displayName: string, themeId?: string, tsxSource: string }[], true>\n & AsyncStoreProperty<\"emailDrafts\", [], { id: string, displayName: string, themeId: string | undefined | false, tsxSource: string, sentAt: Date | null }[], true>\n & AsyncStoreProperty<\"stripeAccountInfo\", [], { account_id: string, charges_enabled: boolean, details_submitted: boolean, payouts_enabled: boolean } | null, false>\n & AsyncStoreProperty<\n \"transactions\",\n [{\n cursor?: string,\n limit?: number,\n type?: TransactionType,\n customerType?: 'user' | 'team' | 'custom',\n customerId?: string,\n }],\n { transactions: Transaction[], nextCursor: string | null },\n true\n >\n & {\n createInternalApiKey(options: InternalApiKeyCreateOptions): Promise<InternalApiKeyFirstView>,\n\n createTeamPermissionDefinition(data: AdminTeamPermissionDefinitionCreateOptions): Promise<AdminTeamPermission>,\n updateTeamPermissionDefinition(permissionId: string, data: AdminTeamPermissionDefinitionUpdateOptions): Promise<void>,\n deleteTeamPermissionDefinition(permissionId: string): Promise<void>,\n /**\n * @param options.query Free-text search; matches against permission ID and description.\n */\n listTeamPermissionDefinitionsPaginated(options: { limit: number, cursor?: string, query?: string }): Promise<{ items: AdminTeamPermissionDefinition[], nextCursor: string | null }>,\n\n createProjectPermissionDefinition(data: AdminProjectPermissionDefinitionCreateOptions): Promise<AdminProjectPermission>,\n updateProjectPermissionDefinition(permissionId: string, data: AdminProjectPermissionDefinitionUpdateOptions): Promise<void>,\n deleteProjectPermissionDefinition(permissionId: string): Promise<void>,\n\n\n sendTestEmail(options: {\n recipientEmail: string,\n emailConfig: EmailConfig,\n }): Promise<Result<undefined, { errorMessage: string }>>,\n\n sendTestWebhook(options: { endpointId: string }): Promise<Result<undefined, { errorMessage: string }>>,\n\n sendSignInInvitationEmail(email: string, callbackUrl: string): Promise<void>,\n\n listSentEmails(): Promise<AdminSentEmail[]>,\n setupManagedEmailProvider(options: { subdomain: string, senderLocalPart: string }): Promise<ManagedEmailProviderSetupResult>,\n checkManagedEmailStatus(options: { domainId: string, subdomain: string, senderLocalPart: string }): Promise<ManagedEmailProviderStatus>,\n listManagedEmailDomains(): Promise<ManagedEmailProviderListItem[]>,\n applyManagedEmailProvider(options: { domainId: string }): Promise<{ status: \"applied\" }>,\n deleteManagedEmailDomain(options: { resendDomainId: string }): Promise<{ status: \"deleted\" }>,\n\n createEmailTheme(displayName: string): Promise<{ id: string }>,\n updateEmailTheme(id: string, tsxSource: string): Promise<void>,\n deleteEmailTheme(id: string): Promise<void>,\n saveChatMessage(threadId: string, message: any): Promise<void>,\n listChatMessages(threadId: string): Promise<{ messages: Array<any> }>,\n rewriteTemplateSourceWithAI(templateTsxSource: string): Promise<{ tsxSource: string }>,\n updateEmailTemplate(id: string, tsxSource: string, themeId: string | null | false): Promise<{ renderedHtml: string }>,\n createEmailTemplate(displayName: string): Promise<{ id: string }>,\n deleteEmailTemplate(id: string): Promise<void>,\n\n setupPayments(): Promise<{ url: string }>,\n createStripeWidgetAccountSession(): Promise<{ client_secret: string }>,\n getPaymentMethodConfigs(): Promise<{ configId: string, methods: Array<{ id: string, name: string, enabled: boolean, available: boolean, overridable: boolean }> } | null>,\n updatePaymentMethodConfigs(configId: string, updates: Record<string, 'on' | 'off'>): Promise<void>,\n createEmailDraft(options: { displayName: string, themeId?: string | undefined | false, tsxSource?: string }): Promise<{ id: string }>,\n updateEmailDraft(id: string, data: { displayName?: string, themeId?: string | undefined | false, tsxSource?: string }): Promise<void>,\n deleteEmailDraft(id: string): Promise<void>,\n refreshEmailDrafts(): Promise<void>,\n createItemQuantityChange(options: (\n { userId: string, itemId: string, quantity: number, expiresAt?: string, description?: string } |\n { teamId: string, itemId: string, quantity: number, expiresAt?: string, description?: string } |\n { customCustomerId: string, itemId: string, quantity: number, expiresAt?: string, description?: string }\n )): Promise<void>,\n refundTransaction(options: {\n type: \"subscription\" | \"one-time-purchase\",\n id: string,\n invoiceId?: string,\n amountUsd: MoneyAmount,\n endAction?: \"now\" | \"at-period-end\",\n }): Promise<{ refundTransactionId: string }>,\n queryAnalytics(options: AnalyticsQueryOptions): Promise<AnalyticsQueryResponse>,\n getAnalyticsClickmap(options: AnalyticsClickmapOptions): Promise<AnalyticsClickmapResponse>,\n createAnalyticsClickmapToken(options: { origin: string }): Promise<AnalyticsClickmapTokenResponse>,\n\n listSessionReplays(options?: ListSessionReplaysOptions): Promise<ListSessionReplaysResult>,\n getSessionReplay(sessionReplayId: string): Promise<AdminSessionReplay>,\n listSessionReplayChunks(sessionReplayId: string, options?: ListSessionReplayChunksOptions): Promise<ListSessionReplayChunksResult>,\n getSessionReplayChunkEvents(sessionReplayId: string, chunkId: string): Promise<AdminGetSessionReplayChunkEventsResponse>,\n getSessionReplayEvents(sessionReplayId: string, options?: { offset?: number, limit?: number }): Promise<SessionReplayAllEventsResult>,\n\n // Email Outbox methods\n listOutboxEmails(options?: EmailOutboxListOptions): Promise<EmailOutboxListResult>,\n getOutboxEmail(id: string): Promise<AdminEmailOutbox>,\n updateOutboxEmail(id: string, options: EmailOutboxUpdateOptions): Promise<AdminEmailOutbox>,\n pauseOutboxEmail(id: string): Promise<AdminEmailOutbox>,\n unpauseOutboxEmail(id: string): Promise<AdminEmailOutbox>,\n cancelOutboxEmail(id: string): Promise<AdminEmailOutbox>,\n }\n & StackServerApp<HasTokenStore, ProjectId>\n);\n/** @deprecated Use `HexclaveAdminAppConstructor` from the `@hexclave/*` package instead — same symbol, new brand name. See https://docs.hexclave.com/migration. */\nexport type StackAdminAppConstructor = {\n new <\n HasTokenStore extends boolean,\n ProjectId extends string\n >(options: StackAdminAppConstructorOptions<HasTokenStore, ProjectId>): StackAdminApp<HasTokenStore, ProjectId>,\n new(options: StackAdminAppConstructorOptions<boolean, string>): StackAdminApp<boolean, string>,\n};\nexport type HexclaveAdminAppConstructorOptions<HasTokenStore extends boolean, ProjectId extends string> = StackAdminAppConstructorOptions<HasTokenStore, ProjectId>;\nexport type HexclaveAdminApp<HasTokenStore extends boolean = boolean, ProjectId extends string = string> = StackAdminApp<HasTokenStore, ProjectId>;\nexport type HexclaveAdminAppConstructor = StackAdminAppConstructor;\nexport const HexclaveAdminApp: HexclaveAdminAppConstructor = _HexclaveAdminAppImpl;\n/** @deprecated Use `HexclaveAdminApp` from the `@hexclave/*` package instead — same symbol, new brand name. See https://docs.hexclave.com/migration. */\nexport const StackAdminApp: StackAdminAppConstructor = HexclaveAdminApp;\n"],"mappings":";;;;;AA8LA,MAAa,mBAAgDA;;AAE7D,MAAa,gBAA0C"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "//": "THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template (FOR package.json FILES, PLEASE EDIT package-template.json)",
3
3
  "name": "@hexclave/js",
4
- "version": "1.0.21",
4
+ "version": "1.0.22",
5
5
  "repository": "https://github.com/hexclave/hexclave",
6
6
  "sideEffects": false,
7
7
  "main": "./dist/index.js",
@@ -66,7 +66,7 @@
66
66
  "rrweb": "^1.1.3",
67
67
  "tsx": "^4.21.0",
68
68
  "yup": "^1.7.1",
69
- "@hexclave/shared": "1.0.21"
69
+ "@hexclave/shared": "1.0.22"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@quetzallabs/i18n": "^0.1.19",
@@ -4,9 +4,9 @@
4
4
  //===========================================
5
5
  // @vitest-environment jsdom
6
6
 
7
- import { HexclaveClientInterface } from "@hexclave/shared";
7
+ import { HexclaveClientInterface, KnownErrors } from "@hexclave/shared";
8
8
  import { describe, expect, it, vi } from "vitest";
9
- import { getNewOAuthProviderOrScopeUrl } from "./auth";
9
+ import { callOAuthCallback, getNewOAuthProviderOrScopeUrl } from "./auth";
10
10
 
11
11
  vi.mock("./cookie", async (importOriginal) => {
12
12
  const actual = await importOriginal<typeof import("./cookie")>();
@@ -19,18 +19,22 @@ vi.mock("./cookie", async (importOriginal) => {
19
19
  };
20
20
  });
21
21
 
22
+ function createTestInterface() {
23
+ return new HexclaveClientInterface({
24
+ clientVersion: "test",
25
+ getBaseUrl: () => "https://api.example.com",
26
+ getApiUrls: () => ["https://api.example.com"],
27
+ extraRequestHeaders: {},
28
+ projectId: "00000000-0000-4000-8000-000000000000",
29
+ publishableClientKey: "pck_test",
30
+ });
31
+ }
32
+
22
33
  describe("getNewOAuthProviderOrScopeUrl", () => {
23
34
  it("returns the OAuth URL without performing navigation", async () => {
24
35
  window.history.replaceState({}, "", "/account?after_auth_return_to=%2Fsettings");
25
36
 
26
- const iface = new HexclaveClientInterface({
27
- clientVersion: "test",
28
- getBaseUrl: () => "https://api.example.com",
29
- getApiUrls: () => ["https://api.example.com"],
30
- extraRequestHeaders: {},
31
- projectId: "00000000-0000-4000-8000-000000000000",
32
- publishableClientKey: "pck_test",
33
- });
37
+ const iface = createTestInterface();
34
38
  const session = iface.createSession({ refreshToken: null, accessToken: null });
35
39
 
36
40
  const location = await getNewOAuthProviderOrScopeUrl(
@@ -65,3 +69,21 @@ describe("getNewOAuthProviderOrScopeUrl", () => {
65
69
  `);
66
70
  });
67
71
  });
72
+
73
+ describe("callOAuthCallback", () => {
74
+ it("turns provider access denial callback params into a known error", async () => {
75
+ window.history.replaceState({}, "", "/handler/oauth-callback?error=access_denied&error_description=User+cancelled");
76
+
77
+ await expect(callOAuthCallback(createTestInterface(), "/handler/oauth-callback"))
78
+ .rejects.toSatisfy((error: unknown) => KnownErrors.OAuthProviderAccessDenied.isInstance(error));
79
+ expect(window.location.href).toBe("http://localhost:3000/handler/oauth-callback");
80
+ });
81
+
82
+ it("turns generic provider error callback params into a known error", async () => {
83
+ window.history.replaceState({}, "", "/handler/oauth-callback?error=server_error&error_description=Provider+failed");
84
+
85
+ await expect(callOAuthCallback(createTestInterface(), "/handler/oauth-callback"))
86
+ .rejects.toSatisfy((error: unknown) => KnownErrors.OAuthProviderTemporarilyUnavailable.isInstance(error));
87
+ expect(window.location.href).toBe("http://localhost:3000/handler/oauth-callback");
88
+ });
89
+ });
package/src/lib/auth.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  //===========================================
3
3
  // THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template
4
4
  //===========================================
5
- import { KnownError, HexclaveClientInterface } from "@hexclave/shared";
5
+ import { KnownError, KnownErrors, HexclaveClientInterface } from "@hexclave/shared";
6
6
  import { InternalSession } from "@hexclave/shared/dist/sessions";
7
7
  import { HexclaveAssertionError, throwErr } from "@hexclave/shared/dist/utils/errors";
8
8
  import { Result } from "@hexclave/shared/dist/utils/results";
@@ -50,10 +50,39 @@ type OAuthCallbackConsumptionResult =
50
50
  error: KnownError,
51
51
  };
52
52
 
53
+ const oauthErrorParams = ["error", "error_description", "errorCode", "message", "details"] as const;
54
+
55
+ function removeOAuthErrorParamsFromHistory(originalUrl: URL): void {
56
+ const newUrl = new URL(originalUrl);
57
+ for (const param of oauthErrorParams) {
58
+ newUrl.searchParams.delete(param);
59
+ }
60
+ window.history.replaceState({}, "", newUrl.toString());
61
+ }
62
+
63
+ function getProviderOAuthErrorFromUrl(originalUrl: URL): KnownError | null {
64
+ const providerError = originalUrl.searchParams.get("error");
65
+ const providerErrorDescription = originalUrl.searchParams.get("error_description");
66
+ if (providerError == null && providerErrorDescription == null) {
67
+ return null;
68
+ }
69
+
70
+ switch (providerError) {
71
+ case "access_denied":
72
+ case "consent_required": {
73
+ return new KnownErrors.OAuthProviderAccessDenied();
74
+ }
75
+ case "server_error":
76
+ case "temporarily_unavailable":
77
+ default: {
78
+ return new KnownErrors.OAuthProviderTemporarilyUnavailable();
79
+ }
80
+ }
81
+ }
82
+
53
83
  function consumeOAuthCallbackQueryParams(options?: {
54
84
  dontWarnAboutMissingQueryParams?: boolean,
55
85
  }): OAuthCallbackConsumptionResult | null {
56
- const oauthErrorParams = ["error", "error_description", "errorCode", "message", "details"] as const;
57
86
  const requiredParams = ["code", "state"];
58
87
  const originalUrl = new URL(window.location.href);
59
88
  const knownErrorCode = originalUrl.searchParams.get("errorCode");
@@ -72,11 +101,7 @@ function consumeOAuthCallbackQueryParams(options?: {
72
101
  }
73
102
  }
74
103
 
75
- const newUrl = new URL(originalUrl);
76
- for (const param of oauthErrorParams) {
77
- newUrl.searchParams.delete(param);
78
- }
79
- window.history.replaceState({}, "", newUrl.toString());
104
+ removeOAuthErrorParamsFromHistory(originalUrl);
80
105
 
81
106
  return {
82
107
  type: "known-error",
@@ -88,6 +113,15 @@ function consumeOAuthCallbackQueryParams(options?: {
88
113
  };
89
114
  }
90
115
 
116
+ const providerOAuthError = getProviderOAuthErrorFromUrl(originalUrl);
117
+ if (providerOAuthError != null && !requiredParams.every(param => originalUrl.searchParams.has(param))) {
118
+ removeOAuthErrorParamsFromHistory(originalUrl);
119
+ return {
120
+ type: "known-error",
121
+ error: providerOAuthError,
122
+ };
123
+ }
124
+
91
125
  for (const param of requiredParams) {
92
126
  if (!originalUrl.searchParams.has(param)) {
93
127
  if (!options?.dontWarnAboutMissingQueryParams) {
@@ -986,10 +986,11 @@ export class _HexclaveAdminAppImplIncomplete<HasTokenStore extends boolean, Proj
986
986
  return result as AdminEmailOutbox;
987
987
  }
988
988
 
989
- async listOutboxEmails(options?: { status?: string, simpleStatus?: string, limit?: number, cursor?: string }): Promise<{ items: AdminEmailOutbox[], nextCursor: string | null }> {
989
+ async listOutboxEmails(options?: { status?: string, simpleStatus?: string, userId?: string, limit?: number, cursor?: string }): Promise<{ items: AdminEmailOutbox[], nextCursor: string | null }> {
990
990
  const response = await this._interface.listOutboxEmails({
991
991
  status: options?.status,
992
992
  simple_status: options?.simpleStatus,
993
+ user_id: options?.userId,
993
994
  limit: options?.limit,
994
995
  cursor: options?.cursor,
995
996
  });
@@ -439,6 +439,72 @@ describe("StackClientApp cross-domain auth", () => {
439
439
  }
440
440
  });
441
441
 
442
+ it("redirects hosted current-page OAuth callback errors to the hosted error handler during startup", async () => {
443
+ const projectId = "00000000-0000-4000-8000-000000000010";
444
+ const previousWindow = globalThis.window;
445
+ const previousDocument = globalThis.document;
446
+ const callbackUrl = new URL("https://demo.stack-auth.com/dashboard");
447
+ callbackUrl.searchParams.set("errorCode", "SIGN_UP_REJECTED");
448
+ callbackUrl.searchParams.set("message", "Your sign up was rejected by an administrator's sign-up rule.");
449
+ callbackUrl.searchParams.set("details", JSON.stringify({
450
+ message: "Your sign up was rejected by an administrator's sign-up rule.",
451
+ }));
452
+ let currentHref = callbackUrl.toString();
453
+ let redirectedUrl = "";
454
+ const redirectSpy = vi.spyOn(StackClientApp.prototype as any, "_redirectTo").mockImplementation(async (...args: unknown[]) => {
455
+ const options = args[0] as { url: string | URL };
456
+ redirectedUrl = options.url.toString();
457
+ });
458
+
459
+ globalThis.document = createMockDocument();
460
+ globalThis.window = {
461
+ location: {
462
+ get href() {
463
+ return currentHref;
464
+ },
465
+ set href(value: string) {
466
+ currentHref = value;
467
+ },
468
+ origin: callbackUrl.origin,
469
+ },
470
+ history: {
471
+ replaceState: (_state: unknown, _title: string, url: string) => {
472
+ currentHref = new URL(url, currentHref).toString();
473
+ },
474
+ },
475
+ addEventListener: () => {},
476
+ removeEventListener: () => {},
477
+ } as any;
478
+
479
+ try {
480
+ new StackClientApp({
481
+ baseUrl: "http://localhost:12345",
482
+ projectId,
483
+ publishableClientKey: "stack-pk-test",
484
+ tokenStore: "memory",
485
+ redirectMethod: "window",
486
+ urls: {
487
+ default: { type: "hosted" },
488
+ },
489
+ noAutomaticPrefetch: true,
490
+ });
491
+
492
+ await new Promise((resolve) => setTimeout(resolve, 0));
493
+ await new Promise((resolve) => setTimeout(resolve, 0));
494
+ } finally {
495
+ redirectSpy.mockRestore();
496
+ globalThis.window = previousWindow;
497
+ globalThis.document = previousDocument;
498
+ }
499
+
500
+ const errorUrl = new URL(redirectedUrl);
501
+ expect(errorUrl.origin).toBe(`https://${projectId}.built-with-stack-auth.com`);
502
+ expect(errorUrl.pathname).toBe("/handler/error");
503
+ expect(errorUrl.searchParams.get("errorCode")).toBe("SIGN_UP_REJECTED");
504
+ expect(errorUrl.searchParams.get("message")).toBe("Your sign up was rejected by an administrator's sign-up rule.");
505
+ expect(new URL(currentHref).searchParams.has("errorCode")).toBe(false);
506
+ });
507
+
442
508
  it("uses direct sign-out instead of hosted sign-out redirects when code execution is available", async () => {
443
509
  const clientApp = new StackClientApp({
444
510
  baseUrl: "http://localhost:12345",
@@ -3,7 +3,7 @@
3
3
  // THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template
4
4
  //===========================================
5
5
  import { WebAuthnError, startAuthentication, startRegistration } from "@simplewebauthn/browser";
6
- import { KnownErrors, HexclaveClientInterface } from "@hexclave/shared";
6
+ import { KnownError, KnownErrors, HexclaveClientInterface } from "@hexclave/shared";
7
7
  import type { RequestListener } from "@hexclave/shared/dist/interface/client-interface";
8
8
  import { ContactChannelsCrud } from "@hexclave/shared/dist/interface/crud/contact-channels";
9
9
  import { CurrentUserCrud } from "@hexclave/shared/dist/interface/crud/current-user";
@@ -685,11 +685,11 @@ export class _HexclaveClientAppImplIncomplete<HasTokenStore extends boolean, Pro
685
685
  if (
686
686
  isBrowserLike()
687
687
  && (this._isOAuthCallbackUrlHosted() || this._currentUrlLooksLikeNestedCrossDomainOAuthCallback())
688
- && this._currentUrlLooksLikeHexclaveOAuthCallback()
688
+ && (this._currentUrlLooksLikeHexclaveOAuthCallback() || this._currentUrlLooksLikeOAuthCallbackError())
689
689
  ) {
690
690
  this._trackPendingAuthResolution(async () => {
691
691
  if (isBrowserLike()) {
692
- await this.callOAuthCallback({ dontWarnAboutMissingQueryParams: true });
692
+ await this._handleHostedOAuthCallbackDuringStartup();
693
693
  }
694
694
  });
695
695
  }
@@ -779,6 +779,22 @@ export class _HexclaveClientAppImplIncomplete<HasTokenStore extends boolean, Pro
779
779
  currentUrl.searchParams.has("code") && currentUrl.searchParams.has("state")
780
780
  ) || (
781
781
  currentUrl.searchParams.has("errorCode") && currentUrl.searchParams.has("message")
782
+ ) || (
783
+ this._currentUrlLooksLikeOAuthCallbackError()
784
+ );
785
+ }
786
+
787
+ protected _currentUrlLooksLikeOAuthCallbackError(): boolean {
788
+ if (typeof window === "undefined") {
789
+ return false;
790
+ }
791
+ const currentUrl = new URL(window.location.href);
792
+ if (currentUrl.searchParams.has("errorCode") && currentUrl.searchParams.has("message")) {
793
+ return true;
794
+ }
795
+ return (
796
+ (currentUrl.searchParams.has("error") || currentUrl.searchParams.has("error_description"))
797
+ && !(currentUrl.searchParams.has("code") && currentUrl.searchParams.has("state"))
782
798
  );
783
799
  }
784
800
 
@@ -820,6 +836,26 @@ export class _HexclaveClientAppImplIncomplete<HasTokenStore extends boolean, Pro
820
836
  return currentUrl.toString();
821
837
  }
822
838
 
839
+ protected async _redirectToOAuthCallbackError(error: KnownError): Promise<void> {
840
+ const errorUrl = new URL(this._getUrls().error, window.location.href);
841
+ errorUrl.searchParams.set("errorCode", error.errorCode);
842
+ errorUrl.searchParams.set("message", error.message);
843
+ errorUrl.searchParams.set("details", JSON.stringify(error.details ?? {}));
844
+ await this._redirectIfTrusted(errorUrl.toString(), { replace: true });
845
+ }
846
+
847
+ protected async _handleHostedOAuthCallbackDuringStartup(): Promise<void> {
848
+ try {
849
+ await this.callOAuthCallback({ dontWarnAboutMissingQueryParams: true });
850
+ } catch (error) {
851
+ if (KnownError.isKnownError(error)) {
852
+ await this._redirectToOAuthCallbackError(error);
853
+ return;
854
+ }
855
+ throw error;
856
+ }
857
+ }
858
+
823
859
  protected async _fetchCurrentRefreshTokenIdIfSignedIn(options?: {
824
860
  awaitPendingAuthResolutions?: boolean,
825
861
  overrideTokenStoreInit?: TokenStoreInit,
@@ -20,6 +20,7 @@ import { StackServerApp, StackServerAppConstructorOptions } from "./server-app";
20
20
  export type EmailOutboxListOptions = {
21
21
  status?: string,
22
22
  simpleStatus?: string,
23
+ userId?: string,
23
24
  limit?: number,
24
25
  cursor?: string,
25
26
  };