@stackframe/stack 2.8.30 → 2.8.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/components/selected-team-switcher.js +19 -95
- package/dist/components/selected-team-switcher.js.map +1 -1
- package/dist/components/team-switcher.js +153 -0
- package/dist/components/team-switcher.js.map +1 -0
- package/dist/esm/components/selected-team-switcher.js +22 -108
- package/dist/esm/components/selected-team-switcher.js.map +1 -1
- package/dist/esm/components/team-switcher.js +142 -0
- package/dist/esm/components/team-switcher.js.map +1 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/stack-app/apps/implementations/admin-app-impl.js +12 -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 +38 -1
- 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 +1 -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 +60 -0
- 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/projects/index.js +2 -1
- 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.map +1 -1
- package/dist/index.d.mts +78 -10
- package/dist/index.d.ts +78 -10
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/stack-app/apps/implementations/admin-app-impl.js +12 -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 +38 -1
- package/dist/lib/stack-app/apps/implementations/client-app-impl.js.map +1 -1
- package/dist/lib/stack-app/apps/implementations/common.js +1 -1
- package/dist/lib/stack-app/apps/implementations/common.js.map +1 -1
- package/dist/lib/stack-app/apps/implementations/server-app-impl.js +60 -0
- 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/customers/index.js.map +1 -1
- package/dist/lib/stack-app/projects/index.js +2 -1
- 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.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/lib/stack-app/users/index.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { KnownErrors } from \"@stackframe/stack-shared\";\nimport { CurrentUserCrud } from \"@stackframe/stack-shared/dist/interface/crud/current-user\";\nimport { UsersCrud } from \"@stackframe/stack-shared/dist/interface/crud/users\";\nimport { InternalSession } from \"@stackframe/stack-shared/dist/sessions\";\nimport { encodeBase64 } from \"@stackframe/stack-shared/dist/utils/bytes\";\nimport { GeoInfo } from \"@stackframe/stack-shared/dist/utils/geo\";\nimport { ReadonlyJson } from \"@stackframe/stack-shared/dist/utils/json\";\nimport { ProviderType } from \"@stackframe/stack-shared/dist/utils/oauth\";\nimport { Result } from \"@stackframe/stack-shared/dist/utils/results\";\nimport { ApiKeyCreationOptions, UserApiKey, UserApiKeyFirstView } from \"../api-keys\";\nimport { AsyncStoreProperty } from \"../common\";\nimport { OAuthConnection } from \"../connected-accounts\";\nimport { ContactChannel, ContactChannelCreateOptions, ServerContactChannel, ServerContactChannelCreateOptions } from \"../contact-channels\";\nimport { AdminTeamPermission, TeamPermission } from \"../permissions\";\nimport { AdminOwnedProject, AdminProjectUpdateOptions } from \"../projects\";\nimport { EditableTeamMemberProfile, ServerTeam, ServerTeamCreateOptions, Team, TeamCreateOptions } from \"../teams\";\nimport { NotificationCategory } from \"../notification-categories\";\n\n\nexport type Session = {\n getTokens(): Promise<{ accessToken: string | null, refreshToken: string | null }>,\n};\n\n/**\n * Contains everything related to the current user session.\n */\nexport type Auth = {\n readonly _internalSession: InternalSession,\n readonly currentSession: Session,\n signOut(options?: { redirectUrl?: URL | string }): Promise<void>,\n\n /**\n * Returns headers for sending authenticated HTTP requests to external servers. Most commonly used in cross-origin\n * requests. Similar to `getAuthJson`, but specifically for HTTP requests.\n *\n * If you are using `tokenStore: \"cookie\"`, you don't need this for same-origin requests. However, most\n * browsers now disable third-party cookies by default, so we must pass authentication tokens by header instead\n * if the client and server are on different origins.\n *\n * This function returns a header object that can be used with `fetch` or other HTTP request libraries to send\n * authenticated requests.\n *\n * On the server, you can then pass in the `Request` object to the `tokenStore` option\n * of your Stack app. Please note that CORS does not allow most headers by default, so you\n * 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)\n * of the CORS preflight response.\n *\n * If you are not using HTTP (and hence cannot set headers), you will need to use the `getAuthJson()` function\n * instead.\n *\n * Example:\n *\n * ```ts\n * // client\n * const res = await fetch(\"https://api.example.com\", {\n * headers: {\n * ...await stackApp.getAuthHeaders()\n * // you can also add your own headers here\n * },\n * });\n *\n * // server\n * function handleRequest(req: Request) {\n * const user = await stackServerApp.getUser({ tokenStore: req });\n * return new Response(\"Welcome, \" + user.displayName);\n * }\n * ```\n */\n getAuthHeaders(): Promise<{ \"x-stack-auth\": string }>,\n\n /**\n * Creates a JSON-serializable object containing the information to authenticate a user on an external server.\n * Similar to `getAuthHeaders`, but returns an object that can be sent over any protocol instead of just\n * HTTP headers.\n *\n * While `getAuthHeaders` is the recommended way to send authentication tokens over HTTP, your app may use\n * a different protocol, for example WebSockets or gRPC. This function returns a token object that can be JSON-serialized and sent to the server in any way you like.\n *\n * On the server, you can pass in this token object into the `tokenStore` option to fetch user details.\n *\n * Example:\n *\n * ```ts\n * // client\n * const res = await rpcCall(rpcEndpoint, {\n * data: {\n * auth: await stackApp.getAuthJson(),\n * },\n * });\n *\n * // server\n * function handleRequest(data) {\n * const user = await stackServerApp.getUser({ tokenStore: data.auth });\n * return new Response(\"Welcome, \" + user.displayName);\n * }\n * ```\n */\n getAuthJson(): Promise<{ accessToken: string | null, refreshToken: string | null }>,\n registerPasskey(options?: { hostname?: string }): Promise<Result<undefined, KnownErrors[\"PasskeyRegistrationFailed\"] | KnownErrors[\"PasskeyWebAuthnError\"]>>,\n};\n\n/**\n * ```\n * +----------+-------------+-------------------+\n * | \\ | !Server | Server |\n * +----------+-------------+-------------------+\n * | !Session | User | ServerUser |\n * | Session | CurrentUser | CurrentServerUser |\n * +----------+-------------+-------------------+\n * ```\n *\n * The fields on each of these types are available iff:\n * BaseUser: true\n * Auth: Session\n * ServerBaseUser: Server\n * UserExtra: Session OR Server\n *\n * The types are defined as follows (in the typescript manner):\n * User = BaseUser\n * CurrentUser = BaseUser & Auth & UserExtra\n * ServerUser = BaseUser & ServerBaseUser & UserExtra\n * CurrentServerUser = BaseUser & ServerBaseUser & Auth & UserExtra\n **/\n\nexport type BaseUser = {\n readonly id: string,\n\n readonly displayName: string | null,\n\n /**\n * The user's email address.\n *\n * Note: This might NOT be unique across multiple users, so always use `id` for unique identification.\n */\n readonly primaryEmail: string | null,\n readonly primaryEmailVerified: boolean,\n readonly profileImageUrl: string | null,\n\n readonly signedUpAt: Date,\n\n readonly clientMetadata: any,\n readonly clientReadOnlyMetadata: any,\n\n /**\n * Whether the user has a password set.\n */\n readonly hasPassword: boolean,\n readonly otpAuthEnabled: boolean,\n readonly passkeyAuthEnabled: boolean,\n\n readonly isMultiFactorRequired: boolean,\n readonly isAnonymous: boolean,\n toClientJson(): CurrentUserCrud[\"Client\"][\"Read\"],\n\n /**\n * @deprecated, use contact channel's usedForAuth instead\n */\n readonly emailAuthEnabled: boolean,\n /**\n * @deprecated\n */\n readonly oauthProviders: readonly { id: string }[],\n}\n\nexport type UserExtra = {\n setDisplayName(displayName: string): Promise<void>,\n /** @deprecated Use contact channel's sendVerificationEmail instead */\n sendVerificationEmail(): Promise<KnownErrors[\"EmailAlreadyVerified\"] | void>,\n setClientMetadata(metadata: any): Promise<void>,\n updatePassword(options: { oldPassword: string, newPassword: string}): Promise<KnownErrors[\"PasswordConfirmationMismatch\"] | KnownErrors[\"PasswordRequirementsNotMet\"] | void>,\n setPassword(options: { password: string }): Promise<KnownErrors[\"PasswordRequirementsNotMet\"] | void>,\n\n /**\n * A shorthand method to update multiple fields of the user at once.\n */\n update(update: UserUpdateOptions): Promise<void>,\n\n useContactChannels(): ContactChannel[], // THIS_LINE_PLATFORM react-like\n listContactChannels(): Promise<ContactChannel[]>,\n createContactChannel(data: ContactChannelCreateOptions): Promise<ContactChannel>,\n\n useNotificationCategories(): NotificationCategory[], // THIS_LINE_PLATFORM react-like\n listNotificationCategories(): Promise<NotificationCategory[]>,\n\n delete(): Promise<void>,\n\n getConnectedAccount(id: ProviderType, options: { or: 'redirect', scopes?: string[] }): Promise<OAuthConnection>,\n getConnectedAccount(id: ProviderType, options?: { or?: 'redirect' | 'throw' | 'return-null', scopes?: string[] }): Promise<OAuthConnection | null>,\n\n useConnectedAccount(id: ProviderType, options: { or: 'redirect', scopes?: string[] }): OAuthConnection,\n useConnectedAccount(id: ProviderType, options?: { or?: 'redirect' | 'throw' | 'return-null', scopes?: string[] }): OAuthConnection | null,\n\n hasPermission(scope: Team, permissionId: string): Promise<boolean>,\n hasPermission(permissionId: string): Promise<boolean>,\n\n getPermission(scope: Team, permissionId: string): Promise<TeamPermission | null>,\n getPermission(permissionId: string): Promise<TeamPermission | null>,\n\n listPermissions(scope: Team, options?: { recursive?: boolean }): Promise<TeamPermission[]>,\n listPermissions(options?: { recursive?: boolean }): Promise<TeamPermission[]>,\n\n usePermissions(scope: Team, options?: { recursive?: boolean }): TeamPermission[],\n usePermissions(options?: { recursive?: boolean }): TeamPermission[],\n\n usePermission(scope: Team, permissionId: string): TeamPermission | null,\n usePermission(permissionId: string): TeamPermission | null,\n\n readonly selectedTeam: Team | null,\n setSelectedTeam(team: Team | null): Promise<void>,\n createTeam(data: TeamCreateOptions): Promise<Team>,\n leaveTeam(team: Team): Promise<void>,\n\n getActiveSessions(): Promise<ActiveSession[]>,\n revokeSession(sessionId: string): Promise<void>,\n getTeamProfile(team: Team): Promise<EditableTeamMemberProfile>,\n useTeamProfile(team: Team): EditableTeamMemberProfile, // THIS_LINE_PLATFORM react-like\n\n createApiKey(options: ApiKeyCreationOptions<\"user\">): Promise<UserApiKeyFirstView>,\n}\n& AsyncStoreProperty<\"apiKeys\", [], UserApiKey[], true>\n& AsyncStoreProperty<\"team\", [id: string], Team | null, false>\n& AsyncStoreProperty<\"teams\", [], Team[], true>\n& AsyncStoreProperty<\"permission\", [scope: Team, permissionId: string, options?: { recursive?: boolean }], TeamPermission | null, false>\n& AsyncStoreProperty<\"permissions\", [scope: Team, options?: { recursive?: boolean }], TeamPermission[], true>;\n\nexport type InternalUserExtra =\n & {\n createProject(newProject: AdminProjectUpdateOptions & { displayName: string }): Promise<AdminOwnedProject>,\n }\n & AsyncStoreProperty<\"ownedProjects\", [], AdminOwnedProject[], true>\n\nexport type User = BaseUser;\n\nexport type CurrentUser = BaseUser & Auth & UserExtra;\n\nexport type CurrentInternalUser = CurrentUser & InternalUserExtra;\n\nexport type ProjectCurrentUser<ProjectId> = ProjectId extends \"internal\" ? CurrentInternalUser : CurrentUser;\n\n\nexport type ActiveSession = {\n id: string,\n userId: string,\n createdAt: Date,\n isImpersonation: boolean,\n lastUsedAt: Date | undefined,\n isCurrentSession: boolean,\n geoInfo?: GeoInfo,\n};\n\nexport type UserUpdateOptions = {\n displayName?: string,\n clientMetadata?: ReadonlyJson,\n selectedTeamId?: string | null,\n totpMultiFactorSecret?: Uint8Array | null,\n profileImageUrl?: string | null,\n otpAuthEnabled?: boolean,\n passkeyAuthEnabled?:boolean,\n}\nexport function userUpdateOptionsToCrud(options: UserUpdateOptions): CurrentUserCrud[\"Client\"][\"Update\"] {\n return {\n display_name: options.displayName,\n client_metadata: options.clientMetadata,\n selected_team_id: options.selectedTeamId,\n totp_secret_base64: options.totpMultiFactorSecret != null ? encodeBase64(options.totpMultiFactorSecret) : options.totpMultiFactorSecret,\n profile_image_url: options.profileImageUrl,\n otp_auth_enabled: options.otpAuthEnabled,\n passkey_auth_enabled: options.passkeyAuthEnabled,\n };\n}\n\n\nexport type ServerBaseUser = {\n setPrimaryEmail(email: string | null, options?: { verified?: boolean | undefined }): Promise<void>,\n\n readonly lastActiveAt: Date,\n\n readonly serverMetadata: any,\n setServerMetadata(metadata: any): Promise<void>,\n setClientReadOnlyMetadata(metadata: any): Promise<void>,\n\n createTeam(data: Omit<ServerTeamCreateOptions, \"creatorUserId\">): Promise<ServerTeam>,\n\n useContactChannels(): ServerContactChannel[], // THIS_LINE_PLATFORM react-like\n listContactChannels(): Promise<ServerContactChannel[]>,\n createContactChannel(data: ServerContactChannelCreateOptions): Promise<ServerContactChannel>,\n\n update(user: ServerUserUpdateOptions): Promise<void>,\n\n grantPermission(scope: Team, permissionId: string): Promise<void>,\n grantPermission(permissionId: string): Promise<void>,\n\n revokePermission(scope: Team, permissionId: string): Promise<void>,\n revokePermission(permissionId: string): Promise<void>,\n\n getPermission(scope: Team, permissionId: string): Promise<TeamPermission | null>,\n getPermission(permissionId: string): Promise<TeamPermission | null>,\n\n hasPermission(scope: Team, permissionId: string): Promise<boolean>,\n hasPermission(permissionId: string): Promise<boolean>,\n\n listPermissions(scope: Team, options?: { recursive?: boolean }): Promise<TeamPermission[]>,\n listPermissions(options?: { recursive?: boolean }): Promise<TeamPermission[]>,\n\n usePermissions(scope: Team, options?: { recursive?: boolean }): TeamPermission[],\n usePermissions(options?: { recursive?: boolean }): TeamPermission[],\n\n usePermission(scope: Team, permissionId: string): TeamPermission | null,\n usePermission(permissionId: string): TeamPermission | null,\n\n /**\n * Creates a new session object with a refresh token for this user. Can be used to impersonate them.\n */\n createSession(options?: { expiresInMillis?: number, isImpersonation?: boolean }): Promise<Session>,\n}\n& AsyncStoreProperty<\"team\", [id: string], ServerTeam | null, false>\n& AsyncStoreProperty<\"teams\", [], ServerTeam[], true>\n& AsyncStoreProperty<\"permission\", [scope: Team, permissionId: string, options?: { direct?: boolean }], AdminTeamPermission | null, false>\n& AsyncStoreProperty<\"permissions\", [scope: Team, options?: { direct?: boolean }], AdminTeamPermission[], true>;\n\n/**\n * A user including sensitive fields that should only be used on the server, never sent to the client\n * (such as sensitive information and serverMetadata).\n */\nexport type ServerUser = ServerBaseUser & BaseUser & UserExtra;\n\nexport type CurrentServerUser = Auth & ServerUser;\n\nexport type CurrentInternalServerUser = CurrentServerUser & InternalUserExtra;\n\nexport type ProjectCurrentServerUser<ProjectId> = ProjectId extends \"internal\" ? CurrentInternalServerUser : CurrentServerUser;\n\n\nexport type ServerUserUpdateOptions = {\n primaryEmail?: string | null,\n primaryEmailVerified?: boolean,\n primaryEmailAuthEnabled?: boolean,\n clientReadOnlyMetadata?: ReadonlyJson,\n serverMetadata?: ReadonlyJson,\n password?: string,\n} & UserUpdateOptions;\nexport function serverUserUpdateOptionsToCrud(options: ServerUserUpdateOptions): CurrentUserCrud[\"Server\"][\"Update\"] {\n return {\n display_name: options.displayName,\n primary_email: options.primaryEmail,\n client_metadata: options.clientMetadata,\n client_read_only_metadata: options.clientReadOnlyMetadata,\n server_metadata: options.serverMetadata,\n selected_team_id: options.selectedTeamId,\n primary_email_auth_enabled: options.primaryEmailAuthEnabled,\n primary_email_verified: options.primaryEmailVerified,\n password: options.password,\n profile_image_url: options.profileImageUrl,\n totp_secret_base64: options.totpMultiFactorSecret != null ? encodeBase64(options.totpMultiFactorSecret) : options.totpMultiFactorSecret,\n };\n}\n\n\nexport type ServerUserCreateOptions = {\n primaryEmail?: string | null,\n primaryEmailAuthEnabled?: boolean,\n password?: string,\n otpAuthEnabled?: boolean,\n displayName?: string,\n primaryEmailVerified?: boolean,\n clientMetadata?: any,\n clientReadOnlyMetadata?: any,\n serverMetadata?: any,\n}\nexport function serverUserCreateOptionsToCrud(options: ServerUserCreateOptions): UsersCrud[\"Server\"][\"Create\"] {\n return {\n primary_email: options.primaryEmail,\n password: options.password,\n otp_auth_enabled: options.otpAuthEnabled,\n primary_email_auth_enabled: options.primaryEmailAuthEnabled,\n display_name: options.displayName,\n primary_email_verified: options.primaryEmailVerified,\n client_metadata: options.clientMetadata,\n client_read_only_metadata: options.clientReadOnlyMetadata,\n server_metadata: options.serverMetadata,\n };\n}\n"],"mappings":";AAQA,SAAS,oBAAoB;AA+PtB,SAAS,wBAAwB,SAAiE;AACvG,SAAO;AAAA,IACL,cAAc,QAAQ;AAAA,IACtB,iBAAiB,QAAQ;AAAA,IACzB,kBAAkB,QAAQ;AAAA,IAC1B,oBAAoB,QAAQ,yBAAyB,OAAO,aAAa,QAAQ,qBAAqB,IAAI,QAAQ;AAAA,IAClH,mBAAmB,QAAQ;AAAA,IAC3B,kBAAkB,QAAQ;AAAA,IAC1B,sBAAsB,QAAQ;AAAA,EAChC;AACF;AAwEO,SAAS,8BAA8B,SAAuE;AACnH,SAAO;AAAA,IACL,cAAc,QAAQ;AAAA,IACtB,eAAe,QAAQ;AAAA,IACvB,iBAAiB,QAAQ;AAAA,IACzB,2BAA2B,QAAQ;AAAA,IACnC,iBAAiB,QAAQ;AAAA,IACzB,kBAAkB,QAAQ;AAAA,IAC1B,4BAA4B,QAAQ;AAAA,IACpC,wBAAwB,QAAQ;AAAA,IAChC,UAAU,QAAQ;AAAA,IAClB,mBAAmB,QAAQ;AAAA,IAC3B,oBAAoB,QAAQ,yBAAyB,OAAO,aAAa,QAAQ,qBAAqB,IAAI,QAAQ;AAAA,EACpH;AACF;AAcO,SAAS,8BAA8B,SAAiE;AAC7G,SAAO;AAAA,IACL,eAAe,QAAQ;AAAA,IACvB,UAAU,QAAQ;AAAA,IAClB,kBAAkB,QAAQ;AAAA,IAC1B,4BAA4B,QAAQ;AAAA,IACpC,cAAc,QAAQ;AAAA,IACtB,wBAAwB,QAAQ;AAAA,IAChC,iBAAiB,QAAQ;AAAA,IACzB,2BAA2B,QAAQ;AAAA,IACnC,iBAAiB,QAAQ;AAAA,EAC3B;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/lib/stack-app/users/index.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { KnownErrors } from \"@stackframe/stack-shared\";\nimport { CurrentUserCrud } from \"@stackframe/stack-shared/dist/interface/crud/current-user\";\nimport { UsersCrud } from \"@stackframe/stack-shared/dist/interface/crud/users\";\nimport { InternalSession } from \"@stackframe/stack-shared/dist/sessions\";\nimport { encodeBase64 } from \"@stackframe/stack-shared/dist/utils/bytes\";\nimport { GeoInfo } from \"@stackframe/stack-shared/dist/utils/geo\";\nimport { ReadonlyJson } from \"@stackframe/stack-shared/dist/utils/json\";\nimport { ProviderType } from \"@stackframe/stack-shared/dist/utils/oauth\";\nimport { Result } from \"@stackframe/stack-shared/dist/utils/results\";\nimport { ApiKeyCreationOptions, UserApiKey, UserApiKeyFirstView } from \"../api-keys\";\nimport { AsyncStoreProperty } from \"../common\";\nimport { OAuthConnection } from \"../connected-accounts\";\nimport { ContactChannel, ContactChannelCreateOptions, ServerContactChannel, ServerContactChannelCreateOptions } from \"../contact-channels\";\nimport { AdminTeamPermission, TeamPermission } from \"../permissions\";\nimport { AdminOwnedProject, AdminProjectCreateOptions, AdminProjectUpdateOptions } from \"../projects\";\nimport { EditableTeamMemberProfile, ServerTeam, ServerTeamCreateOptions, Team, TeamCreateOptions } from \"../teams\";\nimport { NotificationCategory } from \"../notification-categories\";\nimport { Customer } from \"../customers\";\n\n\nexport type Session = {\n getTokens(): Promise<{ accessToken: string | null, refreshToken: string | null }>,\n};\n\n/**\n * Contains everything related to the current user session.\n */\nexport type Auth = {\n readonly _internalSession: InternalSession,\n readonly currentSession: Session,\n signOut(options?: { redirectUrl?: URL | string }): Promise<void>,\n\n /**\n * Returns headers for sending authenticated HTTP requests to external servers. Most commonly used in cross-origin\n * requests. Similar to `getAuthJson`, but specifically for HTTP requests.\n *\n * If you are using `tokenStore: \"cookie\"`, you don't need this for same-origin requests. However, most\n * browsers now disable third-party cookies by default, so we must pass authentication tokens by header instead\n * if the client and server are on different origins.\n *\n * This function returns a header object that can be used with `fetch` or other HTTP request libraries to send\n * authenticated requests.\n *\n * On the server, you can then pass in the `Request` object to the `tokenStore` option\n * of your Stack app. Please note that CORS does not allow most headers by default, so you\n * 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)\n * of the CORS preflight response.\n *\n * If you are not using HTTP (and hence cannot set headers), you will need to use the `getAuthJson()` function\n * instead.\n *\n * Example:\n *\n * ```ts\n * // client\n * const res = await fetch(\"https://api.example.com\", {\n * headers: {\n * ...await stackApp.getAuthHeaders()\n * // you can also add your own headers here\n * },\n * });\n *\n * // server\n * function handleRequest(req: Request) {\n * const user = await stackServerApp.getUser({ tokenStore: req });\n * return new Response(\"Welcome, \" + user.displayName);\n * }\n * ```\n */\n getAuthHeaders(): Promise<{ \"x-stack-auth\": string }>,\n\n /**\n * Creates a JSON-serializable object containing the information to authenticate a user on an external server.\n * Similar to `getAuthHeaders`, but returns an object that can be sent over any protocol instead of just\n * HTTP headers.\n *\n * While `getAuthHeaders` is the recommended way to send authentication tokens over HTTP, your app may use\n * a different protocol, for example WebSockets or gRPC. This function returns a token object that can be JSON-serialized and sent to the server in any way you like.\n *\n * On the server, you can pass in this token object into the `tokenStore` option to fetch user details.\n *\n * Example:\n *\n * ```ts\n * // client\n * const res = await rpcCall(rpcEndpoint, {\n * data: {\n * auth: await stackApp.getAuthJson(),\n * },\n * });\n *\n * // server\n * function handleRequest(data) {\n * const user = await stackServerApp.getUser({ tokenStore: data.auth });\n * return new Response(\"Welcome, \" + user.displayName);\n * }\n * ```\n */\n getAuthJson(): Promise<{ accessToken: string | null, refreshToken: string | null }>,\n registerPasskey(options?: { hostname?: string }): Promise<Result<undefined, KnownErrors[\"PasskeyRegistrationFailed\"] | KnownErrors[\"PasskeyWebAuthnError\"]>>,\n};\n\n/**\n * ```\n * +----------+-------------+-------------------+\n * | \\ | !Server | Server |\n * +----------+-------------+-------------------+\n * | !Session | User | ServerUser |\n * | Session | CurrentUser | CurrentServerUser |\n * +----------+-------------+-------------------+\n * ```\n *\n * The fields on each of these types are available iff:\n * BaseUser: true\n * Auth: Session\n * ServerBaseUser: Server\n * UserExtra: Session OR Server\n *\n * The types are defined as follows (in the typescript manner):\n * User = BaseUser\n * CurrentUser = BaseUser & Auth & UserExtra\n * ServerUser = BaseUser & ServerBaseUser & UserExtra\n * CurrentServerUser = BaseUser & ServerBaseUser & Auth & UserExtra\n **/\n\nexport type BaseUser = {\n readonly id: string,\n\n readonly displayName: string | null,\n\n /**\n * The user's email address.\n *\n * Note: This might NOT be unique across multiple users, so always use `id` for unique identification.\n */\n readonly primaryEmail: string | null,\n readonly primaryEmailVerified: boolean,\n readonly profileImageUrl: string | null,\n\n readonly signedUpAt: Date,\n\n readonly clientMetadata: any,\n readonly clientReadOnlyMetadata: any,\n\n /**\n * Whether the user has a password set.\n */\n readonly hasPassword: boolean,\n readonly otpAuthEnabled: boolean,\n readonly passkeyAuthEnabled: boolean,\n\n readonly isMultiFactorRequired: boolean,\n readonly isAnonymous: boolean,\n toClientJson(): CurrentUserCrud[\"Client\"][\"Read\"],\n\n /**\n * @deprecated, use contact channel's usedForAuth instead\n */\n readonly emailAuthEnabled: boolean,\n /**\n * @deprecated\n */\n readonly oauthProviders: readonly { id: string }[],\n}\n\nexport type UserExtra = {\n setDisplayName(displayName: string): Promise<void>,\n /** @deprecated Use contact channel's sendVerificationEmail instead */\n sendVerificationEmail(): Promise<KnownErrors[\"EmailAlreadyVerified\"] | void>,\n setClientMetadata(metadata: any): Promise<void>,\n updatePassword(options: { oldPassword: string, newPassword: string}): Promise<KnownErrors[\"PasswordConfirmationMismatch\"] | KnownErrors[\"PasswordRequirementsNotMet\"] | void>,\n setPassword(options: { password: string }): Promise<KnownErrors[\"PasswordRequirementsNotMet\"] | void>,\n\n /**\n * A shorthand method to update multiple fields of the user at once.\n */\n update(update: UserUpdateOptions): Promise<void>,\n\n useContactChannels(): ContactChannel[], // THIS_LINE_PLATFORM react-like\n listContactChannels(): Promise<ContactChannel[]>,\n createContactChannel(data: ContactChannelCreateOptions): Promise<ContactChannel>,\n\n useNotificationCategories(): NotificationCategory[], // THIS_LINE_PLATFORM react-like\n listNotificationCategories(): Promise<NotificationCategory[]>,\n\n delete(): Promise<void>,\n\n getConnectedAccount(id: ProviderType, options: { or: 'redirect', scopes?: string[] }): Promise<OAuthConnection>,\n getConnectedAccount(id: ProviderType, options?: { or?: 'redirect' | 'throw' | 'return-null', scopes?: string[] }): Promise<OAuthConnection | null>,\n\n useConnectedAccount(id: ProviderType, options: { or: 'redirect', scopes?: string[] }): OAuthConnection,\n useConnectedAccount(id: ProviderType, options?: { or?: 'redirect' | 'throw' | 'return-null', scopes?: string[] }): OAuthConnection | null,\n\n hasPermission(scope: Team, permissionId: string): Promise<boolean>,\n hasPermission(permissionId: string): Promise<boolean>,\n\n getPermission(scope: Team, permissionId: string): Promise<TeamPermission | null>,\n getPermission(permissionId: string): Promise<TeamPermission | null>,\n\n listPermissions(scope: Team, options?: { recursive?: boolean }): Promise<TeamPermission[]>,\n listPermissions(options?: { recursive?: boolean }): Promise<TeamPermission[]>,\n\n usePermissions(scope: Team, options?: { recursive?: boolean }): TeamPermission[],\n usePermissions(options?: { recursive?: boolean }): TeamPermission[],\n\n usePermission(scope: Team, permissionId: string): TeamPermission | null,\n usePermission(permissionId: string): TeamPermission | null,\n\n readonly selectedTeam: Team | null,\n setSelectedTeam(team: Team | null): Promise<void>,\n createTeam(data: TeamCreateOptions): Promise<Team>,\n leaveTeam(team: Team): Promise<void>,\n\n getActiveSessions(): Promise<ActiveSession[]>,\n revokeSession(sessionId: string): Promise<void>,\n getTeamProfile(team: Team): Promise<EditableTeamMemberProfile>,\n useTeamProfile(team: Team): EditableTeamMemberProfile, // THIS_LINE_PLATFORM react-like\n\n createApiKey(options: ApiKeyCreationOptions<\"user\">): Promise<UserApiKeyFirstView>,\n}\n& AsyncStoreProperty<\"apiKeys\", [], UserApiKey[], true>\n& AsyncStoreProperty<\"team\", [id: string], Team | null, false>\n& AsyncStoreProperty<\"teams\", [], Team[], true>\n& AsyncStoreProperty<\"permission\", [scope: Team, permissionId: string, options?: { recursive?: boolean }], TeamPermission | null, false>\n& AsyncStoreProperty<\"permissions\", [scope: Team, options?: { recursive?: boolean }], TeamPermission[], true>;\n\nexport type InternalUserExtra =\n & {\n createProject(newProject: AdminProjectCreateOptions): Promise<AdminOwnedProject>,\n }\n & AsyncStoreProperty<\"ownedProjects\", [], AdminOwnedProject[], true>\n\nexport type User = BaseUser;\n\nexport type CurrentUser = BaseUser & Auth & UserExtra & Customer;\n\nexport type CurrentInternalUser = CurrentUser & InternalUserExtra;\n\nexport type ProjectCurrentUser<ProjectId> = ProjectId extends \"internal\" ? CurrentInternalUser : CurrentUser;\n\n\nexport type ActiveSession = {\n id: string,\n userId: string,\n createdAt: Date,\n isImpersonation: boolean,\n lastUsedAt: Date | undefined,\n isCurrentSession: boolean,\n geoInfo?: GeoInfo,\n};\n\nexport type UserUpdateOptions = {\n displayName?: string,\n clientMetadata?: ReadonlyJson,\n selectedTeamId?: string | null,\n totpMultiFactorSecret?: Uint8Array | null,\n profileImageUrl?: string | null,\n otpAuthEnabled?: boolean,\n passkeyAuthEnabled?:boolean,\n}\nexport function userUpdateOptionsToCrud(options: UserUpdateOptions): CurrentUserCrud[\"Client\"][\"Update\"] {\n return {\n display_name: options.displayName,\n client_metadata: options.clientMetadata,\n selected_team_id: options.selectedTeamId,\n totp_secret_base64: options.totpMultiFactorSecret != null ? encodeBase64(options.totpMultiFactorSecret) : options.totpMultiFactorSecret,\n profile_image_url: options.profileImageUrl,\n otp_auth_enabled: options.otpAuthEnabled,\n passkey_auth_enabled: options.passkeyAuthEnabled,\n };\n}\n\n\nexport type ServerBaseUser = {\n setPrimaryEmail(email: string | null, options?: { verified?: boolean | undefined }): Promise<void>,\n\n readonly lastActiveAt: Date,\n\n readonly serverMetadata: any,\n setServerMetadata(metadata: any): Promise<void>,\n setClientReadOnlyMetadata(metadata: any): Promise<void>,\n\n createTeam(data: Omit<ServerTeamCreateOptions, \"creatorUserId\">): Promise<ServerTeam>,\n\n useContactChannels(): ServerContactChannel[], // THIS_LINE_PLATFORM react-like\n listContactChannels(): Promise<ServerContactChannel[]>,\n createContactChannel(data: ServerContactChannelCreateOptions): Promise<ServerContactChannel>,\n\n update(user: ServerUserUpdateOptions): Promise<void>,\n\n grantPermission(scope: Team, permissionId: string): Promise<void>,\n grantPermission(permissionId: string): Promise<void>,\n\n revokePermission(scope: Team, permissionId: string): Promise<void>,\n revokePermission(permissionId: string): Promise<void>,\n\n getPermission(scope: Team, permissionId: string): Promise<TeamPermission | null>,\n getPermission(permissionId: string): Promise<TeamPermission | null>,\n\n hasPermission(scope: Team, permissionId: string): Promise<boolean>,\n hasPermission(permissionId: string): Promise<boolean>,\n\n listPermissions(scope: Team, options?: { recursive?: boolean }): Promise<TeamPermission[]>,\n listPermissions(options?: { recursive?: boolean }): Promise<TeamPermission[]>,\n\n usePermissions(scope: Team, options?: { recursive?: boolean }): TeamPermission[],\n usePermissions(options?: { recursive?: boolean }): TeamPermission[],\n\n usePermission(scope: Team, permissionId: string): TeamPermission | null,\n usePermission(permissionId: string): TeamPermission | null,\n\n /**\n * Creates a new session object with a refresh token for this user. Can be used to impersonate them.\n */\n createSession(options?: { expiresInMillis?: number, isImpersonation?: boolean }): Promise<Session>,\n}\n& AsyncStoreProperty<\"team\", [id: string], ServerTeam | null, false>\n& AsyncStoreProperty<\"teams\", [], ServerTeam[], true>\n& AsyncStoreProperty<\"permission\", [scope: Team, permissionId: string, options?: { direct?: boolean }], AdminTeamPermission | null, false>\n& AsyncStoreProperty<\"permissions\", [scope: Team, options?: { direct?: boolean }], AdminTeamPermission[], true>;\n\n/**\n * A user including sensitive fields that should only be used on the server, never sent to the client\n * (such as sensitive information and serverMetadata).\n */\nexport type ServerUser = ServerBaseUser & BaseUser & UserExtra & Customer<true>;\n\nexport type CurrentServerUser = Auth & ServerUser;\n\nexport type CurrentInternalServerUser = CurrentServerUser & InternalUserExtra;\n\nexport type ProjectCurrentServerUser<ProjectId> = ProjectId extends \"internal\" ? CurrentInternalServerUser : CurrentServerUser;\n\n\nexport type ServerUserUpdateOptions = {\n primaryEmail?: string | null,\n primaryEmailVerified?: boolean,\n primaryEmailAuthEnabled?: boolean,\n clientReadOnlyMetadata?: ReadonlyJson,\n serverMetadata?: ReadonlyJson,\n password?: string,\n} & UserUpdateOptions;\nexport function serverUserUpdateOptionsToCrud(options: ServerUserUpdateOptions): CurrentUserCrud[\"Server\"][\"Update\"] {\n return {\n display_name: options.displayName,\n primary_email: options.primaryEmail,\n client_metadata: options.clientMetadata,\n client_read_only_metadata: options.clientReadOnlyMetadata,\n server_metadata: options.serverMetadata,\n selected_team_id: options.selectedTeamId,\n primary_email_auth_enabled: options.primaryEmailAuthEnabled,\n primary_email_verified: options.primaryEmailVerified,\n password: options.password,\n profile_image_url: options.profileImageUrl,\n totp_secret_base64: options.totpMultiFactorSecret != null ? encodeBase64(options.totpMultiFactorSecret) : options.totpMultiFactorSecret,\n };\n}\n\n\nexport type ServerUserCreateOptions = {\n primaryEmail?: string | null,\n primaryEmailAuthEnabled?: boolean,\n password?: string,\n otpAuthEnabled?: boolean,\n displayName?: string,\n primaryEmailVerified?: boolean,\n clientMetadata?: any,\n clientReadOnlyMetadata?: any,\n serverMetadata?: any,\n}\nexport function serverUserCreateOptionsToCrud(options: ServerUserCreateOptions): UsersCrud[\"Server\"][\"Create\"] {\n return {\n primary_email: options.primaryEmail,\n password: options.password,\n otp_auth_enabled: options.otpAuthEnabled,\n primary_email_auth_enabled: options.primaryEmailAuthEnabled,\n display_name: options.displayName,\n primary_email_verified: options.primaryEmailVerified,\n client_metadata: options.clientMetadata,\n client_read_only_metadata: options.clientReadOnlyMetadata,\n server_metadata: options.serverMetadata,\n };\n}\n"],"mappings":";AAQA,SAAS,oBAAoB;AAgQtB,SAAS,wBAAwB,SAAiE;AACvG,SAAO;AAAA,IACL,cAAc,QAAQ;AAAA,IACtB,iBAAiB,QAAQ;AAAA,IACzB,kBAAkB,QAAQ;AAAA,IAC1B,oBAAoB,QAAQ,yBAAyB,OAAO,aAAa,QAAQ,qBAAqB,IAAI,QAAQ;AAAA,IAClH,mBAAmB,QAAQ;AAAA,IAC3B,kBAAkB,QAAQ;AAAA,IAC1B,sBAAsB,QAAQ;AAAA,EAChC;AACF;AAwEO,SAAS,8BAA8B,SAAuE;AACnH,SAAO;AAAA,IACL,cAAc,QAAQ;AAAA,IACtB,eAAe,QAAQ;AAAA,IACvB,iBAAiB,QAAQ;AAAA,IACzB,2BAA2B,QAAQ;AAAA,IACnC,iBAAiB,QAAQ;AAAA,IACzB,kBAAkB,QAAQ;AAAA,IAC1B,4BAA4B,QAAQ;AAAA,IACpC,wBAAwB,QAAQ;AAAA,IAChC,UAAU,QAAQ;AAAA,IAClB,mBAAmB,QAAQ;AAAA,IAC3B,oBAAoB,QAAQ,yBAAyB,OAAO,aAAa,QAAQ,qBAAqB,IAAI,QAAQ;AAAA,EACpH;AACF;AAcO,SAAS,8BAA8B,SAAiE;AAC7G,SAAO;AAAA,IACL,eAAe,QAAQ;AAAA,IACvB,UAAU,QAAQ;AAAA,IAClB,kBAAkB,QAAQ;AAAA,IAC1B,4BAA4B,QAAQ;AAAA,IACpC,cAAc,QAAQ;AAAA,IACtB,wBAAwB,QAAQ;AAAA,IAChC,iBAAiB,QAAQ;AAAA,IACzB,2BAA2B,QAAQ;AAAA,IACnC,iBAAiB,QAAQ;AAAA,EAC3B;AACF;","names":[]}
|
package/dist/index.d.mts
CHANGED
|
@@ -10,6 +10,8 @@ import { InternalApiKeysCrud } from '@stackframe/stack-shared/dist/interface/cru
|
|
|
10
10
|
import { ReadonlyJson } from '@stackframe/stack-shared/dist/utils/json';
|
|
11
11
|
import { PrettifyType, IfAndOnlyIf } from '@stackframe/stack-shared/dist/utils/types';
|
|
12
12
|
import { GeoInfo } from '@stackframe/stack-shared/dist/utils/geo';
|
|
13
|
+
import { inlineOfferSchema } from '@stackframe/stack-shared/dist/schema-fields';
|
|
14
|
+
import * as yup from 'yup';
|
|
13
15
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
14
16
|
import * as lucide_react from 'lucide-react';
|
|
15
17
|
import React$1 from 'react';
|
|
@@ -257,6 +259,40 @@ type NotificationCategory = {
|
|
|
257
259
|
setEnabled(enabled: boolean): Promise<void>;
|
|
258
260
|
};
|
|
259
261
|
|
|
262
|
+
type InlineOffer = yup.InferType<typeof inlineOfferSchema>;
|
|
263
|
+
type Item = {
|
|
264
|
+
displayName: string;
|
|
265
|
+
/**
|
|
266
|
+
* May be negative.
|
|
267
|
+
*/
|
|
268
|
+
quantity: number;
|
|
269
|
+
/**
|
|
270
|
+
* Equal to Math.max(0, quantity).
|
|
271
|
+
*/
|
|
272
|
+
nonNegativeQuantity: number;
|
|
273
|
+
};
|
|
274
|
+
type ServerItem = Item & {
|
|
275
|
+
increaseQuantity(amount: number): Promise<void>;
|
|
276
|
+
/**
|
|
277
|
+
* Decreases the quantity by the given amount.
|
|
278
|
+
*
|
|
279
|
+
* Note that you may want to use tryDecreaseQuantity instead, as it will prevent the quantity from going below 0 in a race-condition-free way.
|
|
280
|
+
*/
|
|
281
|
+
decreaseQuantity(amount: number): Promise<void>;
|
|
282
|
+
/**
|
|
283
|
+
* Decreases the quantity by the given amount and returns true if the result is non-negative; returns false and does nothing if the result would be negative.
|
|
284
|
+
*
|
|
285
|
+
* Most useful for pre-paid credits.
|
|
286
|
+
*/
|
|
287
|
+
tryDecreaseQuantity(amount: number): Promise<boolean>;
|
|
288
|
+
};
|
|
289
|
+
type Customer<IsServer extends boolean = false> = {
|
|
290
|
+
readonly id: string;
|
|
291
|
+
createCheckoutUrl(offerIdOrInline: string | InlineOffer): Promise<string>;
|
|
292
|
+
} & AsyncStoreProperty<"item", [
|
|
293
|
+
itemId: string
|
|
294
|
+
], IsServer extends true ? ServerItem : Item, false>;
|
|
295
|
+
|
|
260
296
|
type Session = {
|
|
261
297
|
getTokens(): Promise<{
|
|
262
298
|
accessToken: string | null;
|
|
@@ -474,12 +510,10 @@ type UserExtra = {
|
|
|
474
510
|
recursive?: boolean;
|
|
475
511
|
}], TeamPermission[], true>;
|
|
476
512
|
type InternalUserExtra = {
|
|
477
|
-
createProject(newProject:
|
|
478
|
-
displayName: string;
|
|
479
|
-
}): Promise<AdminOwnedProject>;
|
|
513
|
+
createProject(newProject: AdminProjectCreateOptions): Promise<AdminOwnedProject>;
|
|
480
514
|
} & AsyncStoreProperty<"ownedProjects", [], AdminOwnedProject[], true>;
|
|
481
515
|
type User = BaseUser;
|
|
482
|
-
type CurrentUser = BaseUser & Auth & UserExtra;
|
|
516
|
+
type CurrentUser = BaseUser & Auth & UserExtra & Customer;
|
|
483
517
|
type CurrentInternalUser = CurrentUser & InternalUserExtra;
|
|
484
518
|
type ProjectCurrentUser<ProjectId> = ProjectId extends "internal" ? CurrentInternalUser : CurrentUser;
|
|
485
519
|
type ActiveSession = {
|
|
@@ -551,7 +585,7 @@ type ServerBaseUser = {
|
|
|
551
585
|
* A user including sensitive fields that should only be used on the server, never sent to the client
|
|
552
586
|
* (such as sensitive information and serverMetadata).
|
|
553
587
|
*/
|
|
554
|
-
type ServerUser = ServerBaseUser & BaseUser & UserExtra
|
|
588
|
+
type ServerUser = ServerBaseUser & BaseUser & UserExtra & Customer<true>;
|
|
555
589
|
type CurrentServerUser = Auth & ServerUser;
|
|
556
590
|
type CurrentInternalServerUser = CurrentServerUser & InternalUserExtra;
|
|
557
591
|
type ProjectCurrentServerUser<ProjectId> = ProjectId extends "internal" ? CurrentInternalServerUser : CurrentServerUser;
|
|
@@ -613,7 +647,7 @@ type Team = {
|
|
|
613
647
|
update(update: TeamUpdateOptions): Promise<void>;
|
|
614
648
|
delete(): Promise<void>;
|
|
615
649
|
createApiKey(options: ApiKeyCreationOptions<"team">): Promise<TeamApiKeyFirstView>;
|
|
616
|
-
} & AsyncStoreProperty<"apiKeys", [], TeamApiKey[], true
|
|
650
|
+
} & AsyncStoreProperty<"apiKeys", [], TeamApiKey[], true> & Customer;
|
|
617
651
|
type TeamUpdateOptions = {
|
|
618
652
|
displayName?: string;
|
|
619
653
|
profileImageUrl?: string | null;
|
|
@@ -799,6 +833,13 @@ type StackAdminApp<HasTokenStore extends boolean = boolean, ProjectId extends st
|
|
|
799
833
|
customerId: string;
|
|
800
834
|
offerId: string;
|
|
801
835
|
}): Promise<string>;
|
|
836
|
+
createItemQuantityChange(options: {
|
|
837
|
+
customerId: string;
|
|
838
|
+
itemId: string;
|
|
839
|
+
quantity: number;
|
|
840
|
+
expiresAt?: string;
|
|
841
|
+
description?: string;
|
|
842
|
+
}): Promise<void>;
|
|
802
843
|
} & StackServerApp<HasTokenStore, ProjectId>);
|
|
803
844
|
declare const StackAdminApp: StackAdminAppConstructor;
|
|
804
845
|
|
|
@@ -903,6 +944,7 @@ type AdminProject = {
|
|
|
903
944
|
readonly description: string | null;
|
|
904
945
|
readonly createdAt: Date;
|
|
905
946
|
readonly isProductionMode: boolean;
|
|
947
|
+
readonly ownerTeamId: string | null;
|
|
906
948
|
readonly logoUrl: string | null | undefined;
|
|
907
949
|
readonly fullLogoUrl: string | null | undefined;
|
|
908
950
|
readonly config: AdminProjectConfig;
|
|
@@ -927,6 +969,7 @@ type AdminProjectUpdateOptions = {
|
|
|
927
969
|
};
|
|
928
970
|
type AdminProjectCreateOptions = Omit<AdminProjectUpdateOptions, 'displayName'> & {
|
|
929
971
|
displayName: string;
|
|
972
|
+
teamId: string;
|
|
930
973
|
};
|
|
931
974
|
|
|
932
975
|
type StackClientAppConstructorOptions<HasTokenStore extends boolean, ProjectId extends string> = {
|
|
@@ -1344,7 +1387,7 @@ declare function OAuthButtonGroup({ type, mockProject, }: {
|
|
|
1344
1387
|
};
|
|
1345
1388
|
}): react_jsx_runtime.JSX.Element;
|
|
1346
1389
|
|
|
1347
|
-
type MockTeam = {
|
|
1390
|
+
type MockTeam$1 = {
|
|
1348
1391
|
id: string;
|
|
1349
1392
|
displayName: string;
|
|
1350
1393
|
profileImageUrl?: string | null;
|
|
@@ -1356,10 +1399,11 @@ type SelectedTeamSwitcherProps<AllowNull extends boolean = false> = {
|
|
|
1356
1399
|
allowNull?: AllowNull;
|
|
1357
1400
|
nullLabel?: string;
|
|
1358
1401
|
onChange?: (team: AllowNull extends true ? Team | null : Team) => void;
|
|
1402
|
+
triggerClassName?: string;
|
|
1359
1403
|
mockUser?: {
|
|
1360
|
-
selectedTeam?: MockTeam;
|
|
1404
|
+
selectedTeam?: MockTeam$1;
|
|
1361
1405
|
};
|
|
1362
|
-
mockTeams?: MockTeam[];
|
|
1406
|
+
mockTeams?: MockTeam$1[];
|
|
1363
1407
|
mockProject?: {
|
|
1364
1408
|
config: {
|
|
1365
1409
|
clientTeamCreationEnabled: boolean;
|
|
@@ -1368,6 +1412,30 @@ type SelectedTeamSwitcherProps<AllowNull extends boolean = false> = {
|
|
|
1368
1412
|
};
|
|
1369
1413
|
declare function SelectedTeamSwitcher<AllowNull extends boolean = false>(props: SelectedTeamSwitcherProps<AllowNull>): react_jsx_runtime.JSX.Element;
|
|
1370
1414
|
|
|
1415
|
+
type MockTeam = {
|
|
1416
|
+
id: string;
|
|
1417
|
+
displayName: string;
|
|
1418
|
+
profileImageUrl?: string | null;
|
|
1419
|
+
};
|
|
1420
|
+
type TeamSwitcherProps<AllowNull extends boolean = false> = {
|
|
1421
|
+
team?: Team;
|
|
1422
|
+
teamId?: string;
|
|
1423
|
+
allowNull?: AllowNull;
|
|
1424
|
+
nullLabel?: string;
|
|
1425
|
+
triggerClassName?: string;
|
|
1426
|
+
onChange?: (team: AllowNull extends true ? Team | null : Team) => Promise<void>;
|
|
1427
|
+
mockUser?: {
|
|
1428
|
+
team?: MockTeam;
|
|
1429
|
+
};
|
|
1430
|
+
mockTeams?: MockTeam[];
|
|
1431
|
+
mockProject?: {
|
|
1432
|
+
config: {
|
|
1433
|
+
clientTeamCreationEnabled: boolean;
|
|
1434
|
+
};
|
|
1435
|
+
};
|
|
1436
|
+
};
|
|
1437
|
+
declare function TeamSwitcher<AllowNull extends boolean = false>(props: TeamSwitcherProps<AllowNull>): react_jsx_runtime.JSX.Element;
|
|
1438
|
+
|
|
1371
1439
|
type UserButtonProps = {
|
|
1372
1440
|
showUserInfo?: boolean;
|
|
1373
1441
|
colorModeToggle?: () => void | Promise<void>;
|
|
@@ -1384,4 +1452,4 @@ type UserButtonProps = {
|
|
|
1384
1452
|
};
|
|
1385
1453
|
declare function UserButton(props: UserButtonProps): react_jsx_runtime.JSX.Element;
|
|
1386
1454
|
|
|
1387
|
-
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 GetUserOptions$1 as GetUserOptions, type HandlerUrls, type InternalApiKey, type InternalApiKeyBase, type InternalApiKeyBaseCrudRead, type InternalApiKeyCreateOptions, type InternalApiKeyFirstView, MagicLinkSignIn, MessageCard, OAuthButton, OAuthButtonGroup, type OAuthConnection, type OAuthProviderConfig, type OAuthScopesOnSignIn, PasswordReset, type Project, type ProjectConfig, SelectedTeamSwitcher, type ServerContactChannel, type ServerListUsersOptions, type ServerTeam, type ServerTeamCreateOptions, type ServerTeamMemberProfile, type ServerTeamUpdateOptions, type ServerTeamUser, type ServerUser, type Session, SignIn, SignUp, StackAdminApp, type StackAdminAppConstructor, type StackAdminAppConstructorOptions, StackClientApp, type StackClientAppConstructor, type StackClientAppConstructorOptions, type StackClientAppJson, NextStackHandler as StackHandler, NextStackProvider as StackProvider, StackServerApp, type StackServerAppConstructor, type StackServerAppConstructorOptions, StackTheme, type Team, type TeamCreateOptions, type TeamInvitation$1 as TeamInvitation, type TeamMemberProfile, type TeamUpdateOptions, type TeamUser, type User, UserAvatar, UserButton, stackAppInternalsSymbol, useStackApp, useUser };
|
|
1455
|
+
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 GetUserOptions$1 as GetUserOptions, type HandlerUrls, type InternalApiKey, type InternalApiKeyBase, type InternalApiKeyBaseCrudRead, type InternalApiKeyCreateOptions, type InternalApiKeyFirstView, MagicLinkSignIn, MessageCard, OAuthButton, OAuthButtonGroup, type OAuthConnection, type OAuthProviderConfig, type OAuthScopesOnSignIn, PasswordReset, type Project, type ProjectConfig, SelectedTeamSwitcher, type ServerContactChannel, type ServerListUsersOptions, type ServerTeam, type ServerTeamCreateOptions, type ServerTeamMemberProfile, type ServerTeamUpdateOptions, type ServerTeamUser, type ServerUser, type Session, SignIn, SignUp, StackAdminApp, type StackAdminAppConstructor, type StackAdminAppConstructorOptions, StackClientApp, type StackClientAppConstructor, type StackClientAppConstructorOptions, type StackClientAppJson, NextStackHandler as StackHandler, NextStackProvider 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/index.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ import { InternalApiKeysCrud } from '@stackframe/stack-shared/dist/interface/cru
|
|
|
10
10
|
import { ReadonlyJson } from '@stackframe/stack-shared/dist/utils/json';
|
|
11
11
|
import { PrettifyType, IfAndOnlyIf } from '@stackframe/stack-shared/dist/utils/types';
|
|
12
12
|
import { GeoInfo } from '@stackframe/stack-shared/dist/utils/geo';
|
|
13
|
+
import { inlineOfferSchema } from '@stackframe/stack-shared/dist/schema-fields';
|
|
14
|
+
import * as yup from 'yup';
|
|
13
15
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
14
16
|
import * as lucide_react from 'lucide-react';
|
|
15
17
|
import React$1 from 'react';
|
|
@@ -257,6 +259,40 @@ type NotificationCategory = {
|
|
|
257
259
|
setEnabled(enabled: boolean): Promise<void>;
|
|
258
260
|
};
|
|
259
261
|
|
|
262
|
+
type InlineOffer = yup.InferType<typeof inlineOfferSchema>;
|
|
263
|
+
type Item = {
|
|
264
|
+
displayName: string;
|
|
265
|
+
/**
|
|
266
|
+
* May be negative.
|
|
267
|
+
*/
|
|
268
|
+
quantity: number;
|
|
269
|
+
/**
|
|
270
|
+
* Equal to Math.max(0, quantity).
|
|
271
|
+
*/
|
|
272
|
+
nonNegativeQuantity: number;
|
|
273
|
+
};
|
|
274
|
+
type ServerItem = Item & {
|
|
275
|
+
increaseQuantity(amount: number): Promise<void>;
|
|
276
|
+
/**
|
|
277
|
+
* Decreases the quantity by the given amount.
|
|
278
|
+
*
|
|
279
|
+
* Note that you may want to use tryDecreaseQuantity instead, as it will prevent the quantity from going below 0 in a race-condition-free way.
|
|
280
|
+
*/
|
|
281
|
+
decreaseQuantity(amount: number): Promise<void>;
|
|
282
|
+
/**
|
|
283
|
+
* Decreases the quantity by the given amount and returns true if the result is non-negative; returns false and does nothing if the result would be negative.
|
|
284
|
+
*
|
|
285
|
+
* Most useful for pre-paid credits.
|
|
286
|
+
*/
|
|
287
|
+
tryDecreaseQuantity(amount: number): Promise<boolean>;
|
|
288
|
+
};
|
|
289
|
+
type Customer<IsServer extends boolean = false> = {
|
|
290
|
+
readonly id: string;
|
|
291
|
+
createCheckoutUrl(offerIdOrInline: string | InlineOffer): Promise<string>;
|
|
292
|
+
} & AsyncStoreProperty<"item", [
|
|
293
|
+
itemId: string
|
|
294
|
+
], IsServer extends true ? ServerItem : Item, false>;
|
|
295
|
+
|
|
260
296
|
type Session = {
|
|
261
297
|
getTokens(): Promise<{
|
|
262
298
|
accessToken: string | null;
|
|
@@ -474,12 +510,10 @@ type UserExtra = {
|
|
|
474
510
|
recursive?: boolean;
|
|
475
511
|
}], TeamPermission[], true>;
|
|
476
512
|
type InternalUserExtra = {
|
|
477
|
-
createProject(newProject:
|
|
478
|
-
displayName: string;
|
|
479
|
-
}): Promise<AdminOwnedProject>;
|
|
513
|
+
createProject(newProject: AdminProjectCreateOptions): Promise<AdminOwnedProject>;
|
|
480
514
|
} & AsyncStoreProperty<"ownedProjects", [], AdminOwnedProject[], true>;
|
|
481
515
|
type User = BaseUser;
|
|
482
|
-
type CurrentUser = BaseUser & Auth & UserExtra;
|
|
516
|
+
type CurrentUser = BaseUser & Auth & UserExtra & Customer;
|
|
483
517
|
type CurrentInternalUser = CurrentUser & InternalUserExtra;
|
|
484
518
|
type ProjectCurrentUser<ProjectId> = ProjectId extends "internal" ? CurrentInternalUser : CurrentUser;
|
|
485
519
|
type ActiveSession = {
|
|
@@ -551,7 +585,7 @@ type ServerBaseUser = {
|
|
|
551
585
|
* A user including sensitive fields that should only be used on the server, never sent to the client
|
|
552
586
|
* (such as sensitive information and serverMetadata).
|
|
553
587
|
*/
|
|
554
|
-
type ServerUser = ServerBaseUser & BaseUser & UserExtra
|
|
588
|
+
type ServerUser = ServerBaseUser & BaseUser & UserExtra & Customer<true>;
|
|
555
589
|
type CurrentServerUser = Auth & ServerUser;
|
|
556
590
|
type CurrentInternalServerUser = CurrentServerUser & InternalUserExtra;
|
|
557
591
|
type ProjectCurrentServerUser<ProjectId> = ProjectId extends "internal" ? CurrentInternalServerUser : CurrentServerUser;
|
|
@@ -613,7 +647,7 @@ type Team = {
|
|
|
613
647
|
update(update: TeamUpdateOptions): Promise<void>;
|
|
614
648
|
delete(): Promise<void>;
|
|
615
649
|
createApiKey(options: ApiKeyCreationOptions<"team">): Promise<TeamApiKeyFirstView>;
|
|
616
|
-
} & AsyncStoreProperty<"apiKeys", [], TeamApiKey[], true
|
|
650
|
+
} & AsyncStoreProperty<"apiKeys", [], TeamApiKey[], true> & Customer;
|
|
617
651
|
type TeamUpdateOptions = {
|
|
618
652
|
displayName?: string;
|
|
619
653
|
profileImageUrl?: string | null;
|
|
@@ -799,6 +833,13 @@ type StackAdminApp<HasTokenStore extends boolean = boolean, ProjectId extends st
|
|
|
799
833
|
customerId: string;
|
|
800
834
|
offerId: string;
|
|
801
835
|
}): Promise<string>;
|
|
836
|
+
createItemQuantityChange(options: {
|
|
837
|
+
customerId: string;
|
|
838
|
+
itemId: string;
|
|
839
|
+
quantity: number;
|
|
840
|
+
expiresAt?: string;
|
|
841
|
+
description?: string;
|
|
842
|
+
}): Promise<void>;
|
|
802
843
|
} & StackServerApp<HasTokenStore, ProjectId>);
|
|
803
844
|
declare const StackAdminApp: StackAdminAppConstructor;
|
|
804
845
|
|
|
@@ -903,6 +944,7 @@ type AdminProject = {
|
|
|
903
944
|
readonly description: string | null;
|
|
904
945
|
readonly createdAt: Date;
|
|
905
946
|
readonly isProductionMode: boolean;
|
|
947
|
+
readonly ownerTeamId: string | null;
|
|
906
948
|
readonly logoUrl: string | null | undefined;
|
|
907
949
|
readonly fullLogoUrl: string | null | undefined;
|
|
908
950
|
readonly config: AdminProjectConfig;
|
|
@@ -927,6 +969,7 @@ type AdminProjectUpdateOptions = {
|
|
|
927
969
|
};
|
|
928
970
|
type AdminProjectCreateOptions = Omit<AdminProjectUpdateOptions, 'displayName'> & {
|
|
929
971
|
displayName: string;
|
|
972
|
+
teamId: string;
|
|
930
973
|
};
|
|
931
974
|
|
|
932
975
|
type StackClientAppConstructorOptions<HasTokenStore extends boolean, ProjectId extends string> = {
|
|
@@ -1344,7 +1387,7 @@ declare function OAuthButtonGroup({ type, mockProject, }: {
|
|
|
1344
1387
|
};
|
|
1345
1388
|
}): react_jsx_runtime.JSX.Element;
|
|
1346
1389
|
|
|
1347
|
-
type MockTeam = {
|
|
1390
|
+
type MockTeam$1 = {
|
|
1348
1391
|
id: string;
|
|
1349
1392
|
displayName: string;
|
|
1350
1393
|
profileImageUrl?: string | null;
|
|
@@ -1356,10 +1399,11 @@ type SelectedTeamSwitcherProps<AllowNull extends boolean = false> = {
|
|
|
1356
1399
|
allowNull?: AllowNull;
|
|
1357
1400
|
nullLabel?: string;
|
|
1358
1401
|
onChange?: (team: AllowNull extends true ? Team | null : Team) => void;
|
|
1402
|
+
triggerClassName?: string;
|
|
1359
1403
|
mockUser?: {
|
|
1360
|
-
selectedTeam?: MockTeam;
|
|
1404
|
+
selectedTeam?: MockTeam$1;
|
|
1361
1405
|
};
|
|
1362
|
-
mockTeams?: MockTeam[];
|
|
1406
|
+
mockTeams?: MockTeam$1[];
|
|
1363
1407
|
mockProject?: {
|
|
1364
1408
|
config: {
|
|
1365
1409
|
clientTeamCreationEnabled: boolean;
|
|
@@ -1368,6 +1412,30 @@ type SelectedTeamSwitcherProps<AllowNull extends boolean = false> = {
|
|
|
1368
1412
|
};
|
|
1369
1413
|
declare function SelectedTeamSwitcher<AllowNull extends boolean = false>(props: SelectedTeamSwitcherProps<AllowNull>): react_jsx_runtime.JSX.Element;
|
|
1370
1414
|
|
|
1415
|
+
type MockTeam = {
|
|
1416
|
+
id: string;
|
|
1417
|
+
displayName: string;
|
|
1418
|
+
profileImageUrl?: string | null;
|
|
1419
|
+
};
|
|
1420
|
+
type TeamSwitcherProps<AllowNull extends boolean = false> = {
|
|
1421
|
+
team?: Team;
|
|
1422
|
+
teamId?: string;
|
|
1423
|
+
allowNull?: AllowNull;
|
|
1424
|
+
nullLabel?: string;
|
|
1425
|
+
triggerClassName?: string;
|
|
1426
|
+
onChange?: (team: AllowNull extends true ? Team | null : Team) => Promise<void>;
|
|
1427
|
+
mockUser?: {
|
|
1428
|
+
team?: MockTeam;
|
|
1429
|
+
};
|
|
1430
|
+
mockTeams?: MockTeam[];
|
|
1431
|
+
mockProject?: {
|
|
1432
|
+
config: {
|
|
1433
|
+
clientTeamCreationEnabled: boolean;
|
|
1434
|
+
};
|
|
1435
|
+
};
|
|
1436
|
+
};
|
|
1437
|
+
declare function TeamSwitcher<AllowNull extends boolean = false>(props: TeamSwitcherProps<AllowNull>): react_jsx_runtime.JSX.Element;
|
|
1438
|
+
|
|
1371
1439
|
type UserButtonProps = {
|
|
1372
1440
|
showUserInfo?: boolean;
|
|
1373
1441
|
colorModeToggle?: () => void | Promise<void>;
|
|
@@ -1384,4 +1452,4 @@ type UserButtonProps = {
|
|
|
1384
1452
|
};
|
|
1385
1453
|
declare function UserButton(props: UserButtonProps): react_jsx_runtime.JSX.Element;
|
|
1386
1454
|
|
|
1387
|
-
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 GetUserOptions$1 as GetUserOptions, type HandlerUrls, type InternalApiKey, type InternalApiKeyBase, type InternalApiKeyBaseCrudRead, type InternalApiKeyCreateOptions, type InternalApiKeyFirstView, MagicLinkSignIn, MessageCard, OAuthButton, OAuthButtonGroup, type OAuthConnection, type OAuthProviderConfig, type OAuthScopesOnSignIn, PasswordReset, type Project, type ProjectConfig, SelectedTeamSwitcher, type ServerContactChannel, type ServerListUsersOptions, type ServerTeam, type ServerTeamCreateOptions, type ServerTeamMemberProfile, type ServerTeamUpdateOptions, type ServerTeamUser, type ServerUser, type Session, SignIn, SignUp, StackAdminApp, type StackAdminAppConstructor, type StackAdminAppConstructorOptions, StackClientApp, type StackClientAppConstructor, type StackClientAppConstructorOptions, type StackClientAppJson, NextStackHandler as StackHandler, NextStackProvider as StackProvider, StackServerApp, type StackServerAppConstructor, type StackServerAppConstructorOptions, StackTheme, type Team, type TeamCreateOptions, type TeamInvitation$1 as TeamInvitation, type TeamMemberProfile, type TeamUpdateOptions, type TeamUser, type User, UserAvatar, UserButton, stackAppInternalsSymbol, useStackApp, useUser };
|
|
1455
|
+
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 GetUserOptions$1 as GetUserOptions, type HandlerUrls, type InternalApiKey, type InternalApiKeyBase, type InternalApiKeyBaseCrudRead, type InternalApiKeyCreateOptions, type InternalApiKeyFirstView, MagicLinkSignIn, MessageCard, OAuthButton, OAuthButtonGroup, type OAuthConnection, type OAuthProviderConfig, type OAuthScopesOnSignIn, PasswordReset, type Project, type ProjectConfig, SelectedTeamSwitcher, type ServerContactChannel, type ServerListUsersOptions, type ServerTeam, type ServerTeamCreateOptions, type ServerTeamMemberProfile, type ServerTeamUpdateOptions, type ServerTeamUser, type ServerUser, type Session, SignIn, SignUp, StackAdminApp, type StackAdminAppConstructor, type StackAdminAppConstructorOptions, StackClientApp, type StackClientAppConstructor, type StackClientAppConstructorOptions, type StackClientAppJson, NextStackHandler as StackHandler, NextStackProvider 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/index.js
CHANGED
|
@@ -49,6 +49,7 @@ __export(src_exports, {
|
|
|
49
49
|
StackHandler: () => import_stack_handler.default,
|
|
50
50
|
StackProvider: () => import_stack_provider.default,
|
|
51
51
|
StackTheme: () => import_theme_provider.StackTheme,
|
|
52
|
+
TeamSwitcher: () => import_team_switcher.TeamSwitcher,
|
|
52
53
|
UserAvatar: () => import_user_avatar.UserAvatar,
|
|
53
54
|
UserButton: () => import_user_button.UserButton,
|
|
54
55
|
useStackApp: () => import_hooks.useStackApp,
|
|
@@ -75,6 +76,7 @@ var import_message_card = require("./components/message-cards/message-card.js");
|
|
|
75
76
|
var import_oauth_button = require("./components/oauth-button.js");
|
|
76
77
|
var import_oauth_button_group = require("./components/oauth-button-group.js");
|
|
77
78
|
var import_selected_team_switcher = require("./components/selected-team-switcher.js");
|
|
79
|
+
var import_team_switcher = require("./components/team-switcher.js");
|
|
78
80
|
var import_user_button = require("./components/user-button.js");
|
|
79
81
|
var import_cli_auth_confirm = require("./components-page/cli-auth-confirm.js");
|
|
80
82
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -97,6 +99,7 @@ var import_cli_auth_confirm = require("./components-page/cli-auth-confirm.js");
|
|
|
97
99
|
StackHandler,
|
|
98
100
|
StackProvider,
|
|
99
101
|
StackTheme,
|
|
102
|
+
TeamSwitcher,
|
|
100
103
|
UserAvatar,
|
|
101
104
|
UserButton,
|
|
102
105
|
useStackApp,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nexport * from './lib/stack-app';\n\nexport { default as StackHandler } from \"./components-page/stack-handler\";\nexport { useStackApp, useUser } from \"./lib/hooks\";\nexport { default as StackProvider } from \"./providers/stack-provider\";\nexport { StackTheme } from './providers/theme-provider';\n\nexport { AccountSettings } from \"./components-page/account-settings\";\nexport { AuthPage } from \"./components-page/auth-page\";\nexport { EmailVerification } from \"./components-page/email-verification\";\nexport { ForgotPassword } from \"./components-page/forgot-password\";\nexport { PasswordReset } from \"./components-page/password-reset\";\nexport { SignIn } from \"./components-page/sign-in\";\nexport { SignUp } from \"./components-page/sign-up\";\nexport { CredentialSignIn as CredentialSignIn } from \"./components/credential-sign-in\";\nexport { CredentialSignUp as CredentialSignUp } from \"./components/credential-sign-up\";\nexport { UserAvatar } from \"./components/elements/user-avatar\";\nexport { MagicLinkSignIn as MagicLinkSignIn } from \"./components/magic-link-sign-in\";\nexport { MessageCard } from \"./components/message-cards/message-card\";\nexport { OAuthButton } from \"./components/oauth-button\";\nexport { OAuthButtonGroup } from \"./components/oauth-button-group\";\nexport { SelectedTeamSwitcher } from \"./components/selected-team-switcher\";\nexport { UserButton } from \"./components/user-button\";\nexport { CliAuthConfirmation } from \"./components-page/cli-auth-confirm\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,wBAAc,qCAJd;AAMA,2BAAwC;AACxC,mBAAqC;AACrC,4BAAyC;AACzC,4BAA2B;AAE3B,8BAAgC;AAChC,uBAAyB;AACzB,gCAAkC;AAClC,6BAA+B;AAC/B,4BAA8B;AAC9B,qBAAuB;AACvB,qBAAuB;AACvB,gCAAqD;AACrD,gCAAqD;AACrD,yBAA2B;AAC3B,gCAAmD;AACnD,0BAA4B;AAC5B,0BAA4B;AAC5B,gCAAiC;AACjC,oCAAqC;AACrC,yBAA2B;AAC3B,8BAAoC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nexport * from './lib/stack-app';\n\nexport { default as StackHandler } from \"./components-page/stack-handler\";\nexport { useStackApp, useUser } from \"./lib/hooks\";\nexport { default as StackProvider } from \"./providers/stack-provider\";\nexport { StackTheme } from './providers/theme-provider';\n\nexport { AccountSettings } from \"./components-page/account-settings\";\nexport { AuthPage } from \"./components-page/auth-page\";\nexport { EmailVerification } from \"./components-page/email-verification\";\nexport { ForgotPassword } from \"./components-page/forgot-password\";\nexport { PasswordReset } from \"./components-page/password-reset\";\nexport { SignIn } from \"./components-page/sign-in\";\nexport { SignUp } from \"./components-page/sign-up\";\nexport { CredentialSignIn as CredentialSignIn } from \"./components/credential-sign-in\";\nexport { CredentialSignUp as CredentialSignUp } from \"./components/credential-sign-up\";\nexport { UserAvatar } from \"./components/elements/user-avatar\";\nexport { MagicLinkSignIn as MagicLinkSignIn } from \"./components/magic-link-sign-in\";\nexport { MessageCard } from \"./components/message-cards/message-card\";\nexport { OAuthButton } from \"./components/oauth-button\";\nexport { OAuthButtonGroup } from \"./components/oauth-button-group\";\nexport { SelectedTeamSwitcher } from \"./components/selected-team-switcher\";\nexport { TeamSwitcher } from \"./components/team-switcher\";\nexport { UserButton } from \"./components/user-button\";\nexport { CliAuthConfirmation } from \"./components-page/cli-auth-confirm\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,wBAAc,qCAJd;AAMA,2BAAwC;AACxC,mBAAqC;AACrC,4BAAyC;AACzC,4BAA2B;AAE3B,8BAAgC;AAChC,uBAAyB;AACzB,gCAAkC;AAClC,6BAA+B;AAC/B,4BAA8B;AAC9B,qBAAuB;AACvB,qBAAuB;AACvB,gCAAqD;AACrD,gCAAqD;AACrD,yBAA2B;AAC3B,gCAAmD;AACnD,0BAA4B;AAC5B,0BAA4B;AAC5B,gCAAiC;AACjC,oCAAqC;AACrC,2BAA6B;AAC7B,yBAA2B;AAC3B,8BAAoC;","names":[]}
|
|
@@ -118,6 +118,7 @@ var _StackAdminAppImplIncomplete = class extends import_server_app_impl._StackSe
|
|
|
118
118
|
description: data.description,
|
|
119
119
|
createdAt: new Date(data.created_at_millis),
|
|
120
120
|
isProductionMode: data.is_production_mode,
|
|
121
|
+
ownerTeamId: data.owner_team_id,
|
|
121
122
|
logoUrl: data.logo_url,
|
|
122
123
|
fullLogoUrl: data.full_logo_url,
|
|
123
124
|
config: {
|
|
@@ -450,6 +451,17 @@ var _StackAdminAppImplIncomplete = class extends import_server_app_impl._StackSe
|
|
|
450
451
|
offer_id: options.offerId
|
|
451
452
|
});
|
|
452
453
|
}
|
|
454
|
+
async createItemQuantityChange(options) {
|
|
455
|
+
await this._interface.updateItemQuantity(
|
|
456
|
+
options.customerId,
|
|
457
|
+
options.itemId,
|
|
458
|
+
{
|
|
459
|
+
delta: options.quantity,
|
|
460
|
+
expires_at: options.expiresAt,
|
|
461
|
+
description: options.description
|
|
462
|
+
}
|
|
463
|
+
);
|
|
464
|
+
}
|
|
453
465
|
};
|
|
454
466
|
// Annotate the CommonJS export names for ESM import in node:
|
|
455
467
|
0 && (module.exports = {
|