@zdrops/ai-assistants-sdk 1.5.1 → 1.6.0
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 +14 -0
- package/dist/index.cjs +39 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +71 -32
- package/dist/index.d.ts +71 -32
- package/dist/index.js +39 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.6.0](https://github.com/ZDrops/ai-assistants-sdk/compare/ai-assistants-sdk-v1.5.1...ai-assistants-sdk-v1.6.0) (2026-06-21)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add contact resource ([122204d](https://github.com/ZDrops/ai-assistants-sdk/commit/122204dfdee0dfe328227a93ef0dcbc2836740ab))
|
|
9
|
+
* add contact resource for contact-form email ([02a540e](https://github.com/ZDrops/ai-assistants-sdk/commit/02a540e39b9b9b09f76ce985450a6c433dfd9dd8))
|
|
10
|
+
* add emailPreferences resource ([c3eb56b](https://github.com/ZDrops/ai-assistants-sdk/commit/c3eb56b53e0c8d827807b4357459d6f6d003b93d))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* regenerate types from current spec, drop obsolete credit/receipts types ([cf4c92d](https://github.com/ZDrops/ai-assistants-sdk/commit/cf4c92dedc23dab99550e23ba90e826415f49670))
|
|
16
|
+
|
|
3
17
|
## [1.5.1](https://github.com/ZDrops/ai-assistants-sdk/compare/ai-assistants-sdk-v1.5.0...ai-assistants-sdk-v1.5.1) (2026-06-20)
|
|
4
18
|
|
|
5
19
|
|
package/dist/index.cjs
CHANGED
|
@@ -216,9 +216,6 @@ var CreditsResource = class {
|
|
|
216
216
|
getTransactions(query) {
|
|
217
217
|
return this.http.get("/api/v1/credits/transactions", { query });
|
|
218
218
|
}
|
|
219
|
-
purchase(data) {
|
|
220
|
-
return this.http.post("/api/v1/credits/purchase", data);
|
|
221
|
-
}
|
|
222
219
|
};
|
|
223
220
|
|
|
224
221
|
// src/resources/billing.ts
|
|
@@ -392,6 +389,43 @@ var ReceiptsResource = class {
|
|
|
392
389
|
}
|
|
393
390
|
};
|
|
394
391
|
|
|
392
|
+
// src/resources/email-preferences.ts
|
|
393
|
+
var EmailPreferencesResource = class {
|
|
394
|
+
constructor(http) {
|
|
395
|
+
this.http = http;
|
|
396
|
+
}
|
|
397
|
+
/** Public, token-based: fetch subscription state via an unsubscribe link token. */
|
|
398
|
+
getByToken(token) {
|
|
399
|
+
return this.http.get("/api/v1/email-preferences", {
|
|
400
|
+
authenticated: false,
|
|
401
|
+
query: { token }
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
/** Public, token-based: update subscription state via an unsubscribe link token. */
|
|
405
|
+
updateByToken(data) {
|
|
406
|
+
return this.http.patch("/api/v1/email-preferences", data, { authenticated: false });
|
|
407
|
+
}
|
|
408
|
+
/** Authenticated: fetch the current user's subscription state. */
|
|
409
|
+
getMine() {
|
|
410
|
+
return this.http.get("/api/v1/email-preferences/me");
|
|
411
|
+
}
|
|
412
|
+
/** Authenticated: update the current user's subscription state. */
|
|
413
|
+
updateMine(data) {
|
|
414
|
+
return this.http.patch("/api/v1/email-preferences/me", data);
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
// src/resources/contact.ts
|
|
419
|
+
var ContactResource = class {
|
|
420
|
+
constructor(http) {
|
|
421
|
+
this.http = http;
|
|
422
|
+
}
|
|
423
|
+
/** Send a contact-form message to the tenant's contact inbox. Public — no auth required. */
|
|
424
|
+
send(data) {
|
|
425
|
+
return this.http.post("/api/v1/contact", data, { authenticated: false });
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
|
|
395
429
|
// src/client.ts
|
|
396
430
|
function createClient(options) {
|
|
397
431
|
let accessToken = options.accessToken ?? null;
|
|
@@ -420,6 +454,8 @@ function createClient(options) {
|
|
|
420
454
|
payments: new PaymentsResource(http),
|
|
421
455
|
tenants: new TenantsResource(http),
|
|
422
456
|
receipts: new ReceiptsResource(http),
|
|
457
|
+
emailPreferences: new EmailPreferencesResource(http),
|
|
458
|
+
contact: new ContactResource(http),
|
|
423
459
|
ping() {
|
|
424
460
|
return http.get("/api/v1/ping", { authenticated: false });
|
|
425
461
|
},
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/http.ts","../src/resources/auth.ts","../src/resources/plans.ts","../src/resources/credits.ts","../src/resources/billing.ts","../src/resources/preferences.ts","../src/resources/conversations.ts","../src/resources/generation.ts","../src/resources/images.ts","../src/resources/payments.ts","../src/resources/tenants.ts","../src/resources/receipts.ts","../src/client.ts"],"sourcesContent":["export { createClient } from \"./client\";\nexport type { ClientOptions, AiAssistantsClient } from \"./client\";\n\nexport type {\n RegisterDto,\n LoginDto,\n VerifyOtpDto,\n RefreshTokenDto,\n UpdateProfileDto,\n RequestEmailChangeDto,\n ConfirmEmailChangeDto,\n PurchaseCreditsDto,\n UpsertBillingDto,\n UpdatePreferencesDto,\n CreateConversationDto,\n AddMessageDto,\n GenerateDto,\n TriggerImageDto,\n CreateCheckoutDto,\n CreateCustomCheckoutDto,\n MessageResponseDto,\n AuthResponseDto,\n TokensResponseDto,\n UserResponseDto,\n PlanResponseDto,\n CreditBalanceResponseDto,\n CreditTransactionResponseDto,\n PurchaseCreditsResponseDto,\n CreditBalanceEntityResponseDto,\n BillingResponseDto,\n PreferenceResponseDto,\n ConversationResponseDto,\n ConversationMessageResponseDto,\n ImageStatusResponseDto,\n CheckoutResponseDto,\n CreditPricingResponseDto,\n TenantPublicInfoDto,\n PingResponseDto,\n StartAuthResponseDto,\n PaginatedResponse,\n\n OtpType,\n UserRole,\n PlanType,\n CreditTransactionType,\n ConversationStatus,\n MessageRole,\n ImageGenerationStatus,\n} from \"./types\";\n\nexport type { SseStreamOptions, GenerationDoneData } from \"./resources/generation\";\n\nexport { ApiError } from \"./errors\";\n","export class ApiError extends Error {\n constructor(\n public readonly statusCode: number,\n public readonly code: string,\n message: string | string[],\n public readonly requestId?: string,\n ) {\n super(Array.isArray(message) ? message.join(\", \") : message);\n this.name = \"ApiError\";\n }\n}\n","import { ApiError } from \"./errors\";\nimport type { TokensResponseDto } from \"./types\";\n\nexport interface HttpClientConfig {\n baseUrl: string;\n tenantKey: string;\n getAccessToken: () => string | null;\n getRefreshToken: () => string | null;\n onTokenRefreshed: (tokens: TokensResponseDto) => void | Promise<void>;\n fetch?: typeof globalThis.fetch;\n}\n\ntype HttpMethod = \"GET\" | \"POST\" | \"PUT\" | \"PATCH\" | \"DELETE\";\n\ninterface RequestOptions {\n body?: unknown;\n query?: Record<string, string | number | boolean | undefined | null>;\n authenticated?: boolean;\n}\n\ninterface InternalRequestOptions extends RequestOptions {\n isRetry?: boolean;\n}\n\nexport class HttpClient {\n private refreshPromise: Promise<boolean> | null = null;\n private readonly baseUrl: URL;\n private readonly fetchFn: typeof globalThis.fetch;\n\n constructor(private config: HttpClientConfig) {\n this.baseUrl = new URL(config.baseUrl);\n this.fetchFn = config.fetch ?? globalThis.fetch;\n }\n\n private buildAndFetch(\n method: HttpMethod,\n path: string,\n options: RequestOptions = {},\n ): Promise<Response> {\n const { body, query, authenticated = true } = options;\n\n const url = new URL(path, this.baseUrl);\n if (query) {\n for (const [key, value] of Object.entries(query)) {\n if (value !== undefined && value !== null) {\n url.searchParams.set(key, String(value));\n }\n }\n }\n\n const headers: Record<string, string> = {\n \"X-Tenant-Key\": this.config.tenantKey,\n };\n if (body !== undefined) {\n headers[\"Content-Type\"] = \"application/json\";\n }\n if (authenticated) {\n const token = this.config.getAccessToken();\n if (token) {\n headers[\"Authorization\"] = `Bearer ${token}`;\n }\n }\n\n return this.fetchFn(url.toString(), {\n method,\n headers,\n body: body !== undefined ? JSON.stringify(body) : undefined,\n });\n }\n\n private async throwIfError(response: Response): Promise<void> {\n if (!response.ok) {\n const errorBody = await response.json().catch(() => null);\n throw new ApiError(\n response.status,\n errorBody?.error?.code ?? \"UNKNOWN_ERROR\",\n errorBody?.error?.message ?? response.statusText,\n errorBody?.meta?.requestId,\n );\n }\n }\n\n private async request<T>(\n method: HttpMethod,\n path: string,\n options: InternalRequestOptions = {},\n ): Promise<T> {\n const { isRetry = false, authenticated = true } = options;\n\n const response = await this.buildAndFetch(method, path, options);\n\n if (response.status === 401 && !isRetry && authenticated) {\n const refreshed = await this.attemptTokenRefresh();\n if (refreshed) {\n return this.request<T>(method, path, { ...options, isRetry: true });\n }\n }\n\n await this.throwIfError(response);\n\n const contentType = response.headers.get(\"content-type\");\n if (!contentType?.includes(\"application/json\")) {\n return undefined as T;\n }\n\n const json = await response.json();\n return (json && \"data\" in json && \"meta\" in json ? json.data : json) as T;\n }\n\n private attemptTokenRefresh(): Promise<boolean> {\n if (this.refreshPromise) return this.refreshPromise;\n this.refreshPromise = this.doRefresh().finally(() => {\n this.refreshPromise = null;\n });\n return this.refreshPromise;\n }\n\n private async doRefresh(): Promise<boolean> {\n const refreshToken = this.config.getRefreshToken();\n if (!refreshToken) return false;\n\n try {\n const tokens = await this.request<TokensResponseDto>(\n \"POST\",\n \"/api/v1/auth/refresh\",\n {\n body: { refreshToken },\n authenticated: false,\n isRetry: true,\n },\n );\n await this.config.onTokenRefreshed(tokens);\n return true;\n } catch {\n return false;\n }\n }\n\n get<T>(path: string, options?: RequestOptions): Promise<T> {\n return this.request<T>(\"GET\", path, options);\n }\n\n post<T>(path: string, body?: unknown, options?: Omit<RequestOptions, \"body\">): Promise<T> {\n return this.request<T>(\"POST\", path, { ...options, body });\n }\n\n patch<T>(path: string, body?: unknown, options?: Omit<RequestOptions, \"body\">): Promise<T> {\n return this.request<T>(\"PATCH\", path, { ...options, body });\n }\n\n put<T>(path: string, body?: unknown, options?: Omit<RequestOptions, \"body\">): Promise<T> {\n return this.request<T>(\"PUT\", path, { ...options, body });\n }\n\n delete<T>(path: string, options?: RequestOptions): Promise<T> {\n return this.request<T>(\"DELETE\", path, options);\n }\n\n async rawRequest(method: HttpMethod, path: string, options: RequestOptions = {}): Promise<Response> {\n const { authenticated = true } = options;\n\n let response = await this.buildAndFetch(method, path, options);\n\n if (response.status === 401 && authenticated) {\n const refreshed = await this.attemptTokenRefresh();\n if (refreshed) {\n response = await this.buildAndFetch(method, path, options);\n }\n }\n\n await this.throwIfError(response);\n\n return response;\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n RegisterDto,\n LoginDto,\n VerifyOtpDto,\n RefreshTokenDto,\n UpdateProfileDto,\n RequestEmailChangeDto,\n ConfirmEmailChangeDto,\n MessageResponseDto,\n AuthResponseDto,\n TokensResponseDto,\n UserResponseDto,\n StartAuthResponseDto,\n} from \"../types\";\n\nexport class AuthResource {\n constructor(private http: HttpClient) {}\n\n register(data: RegisterDto): Promise<MessageResponseDto> {\n return this.http.post(\"/api/v1/auth/register\", data, { authenticated: false });\n }\n\n login(data: LoginDto): Promise<MessageResponseDto> {\n return this.http.post(\"/api/v1/auth/login\", data, { authenticated: false });\n }\n\n startAuth(data: LoginDto): Promise<StartAuthResponseDto> {\n return this.http.post(\"/api/v1/auth/start\", data, { authenticated: false });\n }\n\n verifyOtp(data: VerifyOtpDto): Promise<AuthResponseDto> {\n return this.http.post(\"/api/v1/auth/verify-otp\", data, { authenticated: false });\n }\n\n refresh(data: RefreshTokenDto): Promise<TokensResponseDto> {\n return this.http.post(\"/api/v1/auth/refresh\", data, { authenticated: false });\n }\n\n logout(): Promise<void> {\n return this.http.post(\"/api/v1/auth/logout\");\n }\n\n getProfile(): Promise<UserResponseDto> {\n return this.http.get(\"/api/v1/auth/me\");\n }\n\n updateProfile(data: UpdateProfileDto): Promise<UserResponseDto> {\n return this.http.patch(\"/api/v1/auth/me\", data);\n }\n\n deleteAccount(): Promise<void> {\n return this.http.delete(\"/api/v1/auth/me\");\n }\n\n requestEmailChange(data: RequestEmailChangeDto): Promise<MessageResponseDto> {\n return this.http.post(\"/api/v1/auth/request-email-change\", data);\n }\n\n confirmEmailChange(data: ConfirmEmailChangeDto): Promise<MessageResponseDto> {\n return this.http.post(\"/api/v1/auth/confirm-email-change\", data);\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type { PlanResponseDto } from \"../types\";\n\nexport class PlansResource {\n constructor(private http: HttpClient) {}\n\n list(): Promise<PlanResponseDto[]> {\n return this.http.get(\"/api/v1/public/plans\", { authenticated: false });\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n CreditBalanceResponseDto,\n CreditTransactionResponseDto,\n CreditTransactionType,\n PurchaseCreditsDto,\n PurchaseCreditsResponseDto,\n} from \"../types\";\n\nexport class CreditsResource {\n constructor(private http: HttpClient) {}\n\n getBalance(): Promise<CreditBalanceResponseDto> {\n return this.http.get(\"/api/v1/credits/balance\");\n }\n\n getTransactions(query?: {\n cursor?: string;\n limit?: number;\n type?: CreditTransactionType;\n }): Promise<CreditTransactionResponseDto[]> {\n return this.http.get(\"/api/v1/credits/transactions\", { query });\n }\n\n purchase(data: PurchaseCreditsDto): Promise<PurchaseCreditsResponseDto> {\n return this.http.post(\"/api/v1/credits/purchase\", data);\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type { BillingResponseDto, UpsertBillingDto } from \"../types\";\n\nexport class BillingResource {\n constructor(private http: HttpClient) {}\n\n get(): Promise<BillingResponseDto> {\n return this.http.get(\"/api/v1/billing\");\n }\n\n upsert(data: UpsertBillingDto): Promise<BillingResponseDto> {\n return this.http.put(\"/api/v1/billing\", data);\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n PreferenceResponseDto,\n UpdatePreferencesDto,\n} from \"../types\";\n\nexport class PreferencesResource {\n constructor(private http: HttpClient) {}\n\n getAll(): Promise<PreferenceResponseDto[]> {\n return this.http.get(\"/api/v1/preferences\");\n }\n\n getByAppKey(appKey: string): Promise<PreferenceResponseDto> {\n return this.http.get(`/api/v1/preferences/${appKey}`);\n }\n\n upsert(appKey: string, data: UpdatePreferencesDto): Promise<PreferenceResponseDto> {\n return this.http.put(`/api/v1/preferences/${appKey}`, data);\n }\n\n remove(appKey: string): Promise<void> {\n return this.http.delete(`/api/v1/preferences/${appKey}`);\n }\n\n merge(appKey: string, data: UpdatePreferencesDto): Promise<PreferenceResponseDto> {\n return this.http.patch(`/api/v1/preferences/${appKey}`, data);\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n CreateConversationDto,\n ConversationResponseDto,\n ConversationMessageResponseDto,\n AddMessageDto,\n ConversationStatus,\n} from \"../types\";\n\nexport class ConversationsResource {\n constructor(private http: HttpClient) {}\n\n create(data: CreateConversationDto): Promise<ConversationResponseDto> {\n return this.http.post(\"/api/v1/conversations\", data);\n }\n\n list(query?: {\n cursor?: string;\n limit?: number;\n status?: ConversationStatus;\n appKey?: string;\n }): Promise<ConversationResponseDto[]> {\n return this.http.get(\"/api/v1/conversations\", { query });\n }\n\n get(id: string): Promise<ConversationResponseDto> {\n return this.http.get(`/api/v1/conversations/${id}`);\n }\n\n archive(id: string): Promise<ConversationResponseDto> {\n return this.http.patch(`/api/v1/conversations/${id}/archive`);\n }\n\n listMessages(conversationId: string, query?: {\n cursor?: string;\n limit?: number;\n }): Promise<ConversationMessageResponseDto[]> {\n return this.http.get(`/api/v1/conversations/${conversationId}/messages`, { query });\n }\n\n addMessage(conversationId: string, data: AddMessageDto): Promise<ConversationMessageResponseDto> {\n return this.http.post(`/api/v1/conversations/${conversationId}/messages`, data);\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type { GenerateDto } from \"../types\";\n\nexport interface GenerationDoneData {\n messageId: string;\n usage?: { inputTokens: number; outputTokens: number };\n structuredOutput?: Record<string, unknown>;\n}\n\nexport interface SseStreamOptions {\n onTextDelta?: (text: string) => void;\n onDone?: (data: GenerationDoneData) => void;\n onError?: (error: string) => void;\n signal?: AbortSignal;\n}\n\ntype SseEvent =\n | { type: \"text_delta\"; text: string }\n | { type: \"done\"; messageId: string; usage?: { inputTokens: number; outputTokens: number }; structuredOutput?: Record<string, unknown> }\n | { type: \"error\"; error: string };\n\nexport class GenerationResource {\n constructor(private http: HttpClient) {}\n\n async generate(conversationId: string, data: GenerateDto, options?: SseStreamOptions): Promise<string> {\n const response = await this.http.rawRequest(\"POST\", `/api/v1/conversations/${conversationId}/generate`, {\n body: data,\n });\n\n const reader = response.body?.getReader();\n if (!reader) throw new Error(\"No response body\");\n\n const decoder = new TextDecoder();\n const parts: string[] = [];\n let buffer = \"\";\n\n try {\n while (true) {\n if (options?.signal?.aborted) {\n reader.cancel();\n break;\n }\n\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split(\"\\n\");\n buffer = lines.pop() ?? \"\";\n\n for (const line of lines) {\n if (!line.startsWith(\"data: \")) continue;\n const jsonStr = line.slice(6).trim();\n if (!jsonStr) continue;\n\n let event: SseEvent;\n try {\n event = JSON.parse(jsonStr);\n } catch {\n continue;\n }\n\n if (event.type === \"text_delta\") {\n parts.push(event.text);\n options?.onTextDelta?.(event.text);\n } else if (event.type === \"done\") {\n options?.onDone?.(event);\n } else if (event.type === \"error\") {\n options?.onError?.(event.error);\n }\n }\n }\n } finally {\n reader.releaseLock();\n }\n\n return parts.join(\"\");\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n TriggerImageDto,\n ImageStatusResponseDto,\n} from \"../types\";\n\nexport class ImagesResource {\n constructor(private http: HttpClient) {}\n\n trigger(messageId: string, data: TriggerImageDto): Promise<ImageStatusResponseDto> {\n return this.http.post(`/api/v1/messages/${messageId}/images`, data);\n }\n\n getAll(messageId: string): Promise<ImageStatusResponseDto[]> {\n return this.http.get(`/api/v1/messages/${messageId}/images`);\n }\n\n getBySlot(messageId: string, slot: string): Promise<ImageStatusResponseDto> {\n return this.http.get(`/api/v1/messages/${messageId}/images/${slot}`);\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n CreateCheckoutDto,\n CreateCustomCheckoutDto,\n CheckoutResponseDto,\n CreditPricingResponseDto,\n} from \"../types\";\n\nexport class PaymentsResource {\n constructor(private http: HttpClient) {}\n\n checkout(data: CreateCheckoutDto): Promise<CheckoutResponseDto> {\n return this.http.post(\"/api/v1/payments/checkout\", data);\n }\n\n checkoutCustom(data: CreateCustomCheckoutDto): Promise<CheckoutResponseDto> {\n return this.http.post(\"/api/v1/payments/checkout/custom\", data);\n }\n\n creditPricing(): Promise<CreditPricingResponseDto> {\n return this.http.get(\"/api/v1/payments/credit-pricing\");\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type { TenantPublicInfoDto } from \"../types\";\n\nexport class TenantsResource {\n constructor(private http: HttpClient) {}\n\n getPublicInfo(tenantId: string): Promise<TenantPublicInfoDto> {\n return this.http.get(\"/api/v1/tenants/public-info\", {\n authenticated: false,\n query: { tenantId },\n });\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type { PaginatedResponse } from \"../types\";\n\nexport class ReceiptsResource {\n constructor(private http: HttpClient) {}\n\n list(query?: { cursor?: string; limit?: number }): Promise<PaginatedResponse> {\n return this.http.get(\"/api/v1/receipts\", { query });\n }\n\n async download(id: string): Promise<Blob> {\n const response = await this.http.rawRequest(\"GET\", `/api/v1/receipts/${id}/download`);\n return response.blob();\n }\n}\n","import { HttpClient } from \"./http\";\nimport type { TokensResponseDto, PingResponseDto } from \"./types\";\nimport { AuthResource } from \"./resources/auth\";\nimport { PlansResource } from \"./resources/plans\";\nimport { CreditsResource } from \"./resources/credits\";\nimport { BillingResource } from \"./resources/billing\";\nimport { PreferencesResource } from \"./resources/preferences\";\nimport { ConversationsResource } from \"./resources/conversations\";\nimport { GenerationResource } from \"./resources/generation\";\nimport { ImagesResource } from \"./resources/images\";\nimport { PaymentsResource } from \"./resources/payments\";\nimport { TenantsResource } from \"./resources/tenants\";\nimport { ReceiptsResource } from \"./resources/receipts\";\n\nexport interface ClientOptions {\n baseUrl: string;\n tenantKey: string;\n accessToken?: string;\n refreshToken?: string;\n onTokenRefreshed?: (tokens: TokensResponseDto) => void | Promise<void>;\n fetch?: typeof globalThis.fetch;\n}\n\nexport interface AiAssistantsClient {\n auth: AuthResource;\n plans: PlansResource;\n credits: CreditsResource;\n billing: BillingResource;\n preferences: PreferencesResource;\n conversations: ConversationsResource;\n generation: GenerationResource;\n images: ImagesResource;\n payments: PaymentsResource;\n tenants: TenantsResource;\n receipts: ReceiptsResource;\n /**\n * Verify the client is configured correctly: confirms the base URL is\n * reachable and the tenant key is valid. Resolves with the tenant identity\n * when the SDK is ready to use, and rejects with an {@link ApiError} otherwise.\n */\n ping(): Promise<PingResponseDto>;\n setAccessToken(token: string): void;\n setRefreshToken(token: string): void;\n}\n\nexport function createClient(options: ClientOptions): AiAssistantsClient {\n let accessToken = options.accessToken ?? null;\n let refreshToken = options.refreshToken ?? null;\n\n const http = new HttpClient({\n baseUrl: options.baseUrl,\n tenantKey: options.tenantKey,\n fetch: options.fetch,\n getAccessToken: () => accessToken,\n getRefreshToken: () => refreshToken,\n onTokenRefreshed: async (tokens) => {\n accessToken = tokens.accessToken;\n refreshToken = tokens.refreshToken;\n await options.onTokenRefreshed?.(tokens);\n },\n });\n\n return {\n auth: new AuthResource(http),\n plans: new PlansResource(http),\n credits: new CreditsResource(http),\n billing: new BillingResource(http),\n preferences: new PreferencesResource(http),\n conversations: new ConversationsResource(http),\n generation: new GenerationResource(http),\n images: new ImagesResource(http),\n payments: new PaymentsResource(http),\n tenants: new TenantsResource(http),\n receipts: new ReceiptsResource(http),\n ping() {\n return http.get<PingResponseDto>(\"/api/v1/ping\", { authenticated: false });\n },\n setAccessToken(token: string) {\n accessToken = token;\n },\n setRefreshToken(token: string) {\n refreshToken = token;\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,WAAN,cAAuB,MAAM;AAAA,EAClC,YAC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C3E;AAAA,IACA,eAAe,OAAe;AAC5B,oBAAc;AAAA,IAChB;AAAA,IACA,gBAAgB,OAAe;AAC7B,qBAAe;AAAA,IACjB;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/http.ts","../src/resources/auth.ts","../src/resources/plans.ts","../src/resources/credits.ts","../src/resources/billing.ts","../src/resources/preferences.ts","../src/resources/conversations.ts","../src/resources/generation.ts","../src/resources/images.ts","../src/resources/payments.ts","../src/resources/tenants.ts","../src/resources/receipts.ts","../src/resources/email-preferences.ts","../src/resources/contact.ts","../src/client.ts"],"sourcesContent":["export { createClient } from \"./client\";\nexport type { ClientOptions, AiAssistantsClient } from \"./client\";\n\nexport type {\n RegisterDto,\n LoginDto,\n VerifyOtpDto,\n RefreshTokenDto,\n UpdateProfileDto,\n RequestEmailChangeDto,\n ConfirmEmailChangeDto,\n UpsertBillingDto,\n UpdatePreferencesDto,\n CreateConversationDto,\n AddMessageDto,\n GenerateDto,\n TriggerImageDto,\n CreateCheckoutDto,\n CreateCustomCheckoutDto,\n ContactDto,\n MessageResponseDto,\n AuthResponseDto,\n TokensResponseDto,\n UserResponseDto,\n PlanResponseDto,\n CreditBalanceResponseDto,\n CreditTransactionResponseDto,\n BillingResponseDto,\n PreferenceResponseDto,\n ConversationResponseDto,\n ConversationMessageResponseDto,\n ImageStatusResponseDto,\n CheckoutResponseDto,\n CreditPricingResponseDto,\n TenantPublicInfoDto,\n PingResponseDto,\n StartAuthResponseDto,\n ReceiptItemDto,\n\n OtpType,\n UserRole,\n PlanType,\n CreditTransactionType,\n ConversationStatus,\n MessageRole,\n ImageGenerationStatus,\n EmailPreferencesResponseDto,\n EmailCategoryDto,\n UpdateEmailPreferencesDto,\n UpdateEmailPreferencesTokenDto,\n} from \"./types\";\n\nexport type { SseStreamOptions, GenerationDoneData } from \"./resources/generation\";\n\nexport { ApiError } from \"./errors\";\n","export class ApiError extends Error {\n constructor(\n public readonly statusCode: number,\n public readonly code: string,\n message: string | string[],\n public readonly requestId?: string,\n ) {\n super(Array.isArray(message) ? message.join(\", \") : message);\n this.name = \"ApiError\";\n }\n}\n","import { ApiError } from \"./errors\";\nimport type { TokensResponseDto } from \"./types\";\n\nexport interface HttpClientConfig {\n baseUrl: string;\n tenantKey: string;\n getAccessToken: () => string | null;\n getRefreshToken: () => string | null;\n onTokenRefreshed: (tokens: TokensResponseDto) => void | Promise<void>;\n fetch?: typeof globalThis.fetch;\n}\n\ntype HttpMethod = \"GET\" | \"POST\" | \"PUT\" | \"PATCH\" | \"DELETE\";\n\ninterface RequestOptions {\n body?: unknown;\n query?: Record<string, string | number | boolean | undefined | null>;\n authenticated?: boolean;\n}\n\ninterface InternalRequestOptions extends RequestOptions {\n isRetry?: boolean;\n}\n\nexport class HttpClient {\n private refreshPromise: Promise<boolean> | null = null;\n private readonly baseUrl: URL;\n private readonly fetchFn: typeof globalThis.fetch;\n\n constructor(private config: HttpClientConfig) {\n this.baseUrl = new URL(config.baseUrl);\n this.fetchFn = config.fetch ?? globalThis.fetch;\n }\n\n private buildAndFetch(\n method: HttpMethod,\n path: string,\n options: RequestOptions = {},\n ): Promise<Response> {\n const { body, query, authenticated = true } = options;\n\n const url = new URL(path, this.baseUrl);\n if (query) {\n for (const [key, value] of Object.entries(query)) {\n if (value !== undefined && value !== null) {\n url.searchParams.set(key, String(value));\n }\n }\n }\n\n const headers: Record<string, string> = {\n \"X-Tenant-Key\": this.config.tenantKey,\n };\n if (body !== undefined) {\n headers[\"Content-Type\"] = \"application/json\";\n }\n if (authenticated) {\n const token = this.config.getAccessToken();\n if (token) {\n headers[\"Authorization\"] = `Bearer ${token}`;\n }\n }\n\n return this.fetchFn(url.toString(), {\n method,\n headers,\n body: body !== undefined ? JSON.stringify(body) : undefined,\n });\n }\n\n private async throwIfError(response: Response): Promise<void> {\n if (!response.ok) {\n const errorBody = await response.json().catch(() => null);\n throw new ApiError(\n response.status,\n errorBody?.error?.code ?? \"UNKNOWN_ERROR\",\n errorBody?.error?.message ?? response.statusText,\n errorBody?.meta?.requestId,\n );\n }\n }\n\n private async request<T>(\n method: HttpMethod,\n path: string,\n options: InternalRequestOptions = {},\n ): Promise<T> {\n const { isRetry = false, authenticated = true } = options;\n\n const response = await this.buildAndFetch(method, path, options);\n\n if (response.status === 401 && !isRetry && authenticated) {\n const refreshed = await this.attemptTokenRefresh();\n if (refreshed) {\n return this.request<T>(method, path, { ...options, isRetry: true });\n }\n }\n\n await this.throwIfError(response);\n\n const contentType = response.headers.get(\"content-type\");\n if (!contentType?.includes(\"application/json\")) {\n return undefined as T;\n }\n\n const json = await response.json();\n return (json && \"data\" in json && \"meta\" in json ? json.data : json) as T;\n }\n\n private attemptTokenRefresh(): Promise<boolean> {\n if (this.refreshPromise) return this.refreshPromise;\n this.refreshPromise = this.doRefresh().finally(() => {\n this.refreshPromise = null;\n });\n return this.refreshPromise;\n }\n\n private async doRefresh(): Promise<boolean> {\n const refreshToken = this.config.getRefreshToken();\n if (!refreshToken) return false;\n\n try {\n const tokens = await this.request<TokensResponseDto>(\n \"POST\",\n \"/api/v1/auth/refresh\",\n {\n body: { refreshToken },\n authenticated: false,\n isRetry: true,\n },\n );\n await this.config.onTokenRefreshed(tokens);\n return true;\n } catch {\n return false;\n }\n }\n\n get<T>(path: string, options?: RequestOptions): Promise<T> {\n return this.request<T>(\"GET\", path, options);\n }\n\n post<T>(path: string, body?: unknown, options?: Omit<RequestOptions, \"body\">): Promise<T> {\n return this.request<T>(\"POST\", path, { ...options, body });\n }\n\n patch<T>(path: string, body?: unknown, options?: Omit<RequestOptions, \"body\">): Promise<T> {\n return this.request<T>(\"PATCH\", path, { ...options, body });\n }\n\n put<T>(path: string, body?: unknown, options?: Omit<RequestOptions, \"body\">): Promise<T> {\n return this.request<T>(\"PUT\", path, { ...options, body });\n }\n\n delete<T>(path: string, options?: RequestOptions): Promise<T> {\n return this.request<T>(\"DELETE\", path, options);\n }\n\n async rawRequest(method: HttpMethod, path: string, options: RequestOptions = {}): Promise<Response> {\n const { authenticated = true } = options;\n\n let response = await this.buildAndFetch(method, path, options);\n\n if (response.status === 401 && authenticated) {\n const refreshed = await this.attemptTokenRefresh();\n if (refreshed) {\n response = await this.buildAndFetch(method, path, options);\n }\n }\n\n await this.throwIfError(response);\n\n return response;\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n RegisterDto,\n LoginDto,\n VerifyOtpDto,\n RefreshTokenDto,\n UpdateProfileDto,\n RequestEmailChangeDto,\n ConfirmEmailChangeDto,\n MessageResponseDto,\n AuthResponseDto,\n TokensResponseDto,\n UserResponseDto,\n StartAuthResponseDto,\n} from \"../types\";\n\nexport class AuthResource {\n constructor(private http: HttpClient) {}\n\n register(data: RegisterDto): Promise<MessageResponseDto> {\n return this.http.post(\"/api/v1/auth/register\", data, { authenticated: false });\n }\n\n login(data: LoginDto): Promise<MessageResponseDto> {\n return this.http.post(\"/api/v1/auth/login\", data, { authenticated: false });\n }\n\n startAuth(data: LoginDto): Promise<StartAuthResponseDto> {\n return this.http.post(\"/api/v1/auth/start\", data, { authenticated: false });\n }\n\n verifyOtp(data: VerifyOtpDto): Promise<AuthResponseDto> {\n return this.http.post(\"/api/v1/auth/verify-otp\", data, { authenticated: false });\n }\n\n refresh(data: RefreshTokenDto): Promise<TokensResponseDto> {\n return this.http.post(\"/api/v1/auth/refresh\", data, { authenticated: false });\n }\n\n logout(): Promise<void> {\n return this.http.post(\"/api/v1/auth/logout\");\n }\n\n getProfile(): Promise<UserResponseDto> {\n return this.http.get(\"/api/v1/auth/me\");\n }\n\n updateProfile(data: UpdateProfileDto): Promise<UserResponseDto> {\n return this.http.patch(\"/api/v1/auth/me\", data);\n }\n\n deleteAccount(): Promise<void> {\n return this.http.delete(\"/api/v1/auth/me\");\n }\n\n requestEmailChange(data: RequestEmailChangeDto): Promise<MessageResponseDto> {\n return this.http.post(\"/api/v1/auth/request-email-change\", data);\n }\n\n confirmEmailChange(data: ConfirmEmailChangeDto): Promise<MessageResponseDto> {\n return this.http.post(\"/api/v1/auth/confirm-email-change\", data);\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type { PlanResponseDto } from \"../types\";\n\nexport class PlansResource {\n constructor(private http: HttpClient) {}\n\n list(): Promise<PlanResponseDto[]> {\n return this.http.get(\"/api/v1/public/plans\", { authenticated: false });\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n CreditBalanceResponseDto,\n CreditTransactionResponseDto,\n CreditTransactionType,\n} from \"../types\";\n\nexport class CreditsResource {\n constructor(private http: HttpClient) {}\n\n getBalance(): Promise<CreditBalanceResponseDto> {\n return this.http.get(\"/api/v1/credits/balance\");\n }\n\n getTransactions(query?: {\n cursor?: string;\n limit?: number;\n type?: CreditTransactionType;\n }): Promise<CreditTransactionResponseDto[]> {\n return this.http.get(\"/api/v1/credits/transactions\", { query });\n }\n\n}\n","import type { HttpClient } from \"../http\";\nimport type { BillingResponseDto, UpsertBillingDto } from \"../types\";\n\nexport class BillingResource {\n constructor(private http: HttpClient) {}\n\n get(): Promise<BillingResponseDto> {\n return this.http.get(\"/api/v1/billing\");\n }\n\n upsert(data: UpsertBillingDto): Promise<BillingResponseDto> {\n return this.http.put(\"/api/v1/billing\", data);\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n PreferenceResponseDto,\n UpdatePreferencesDto,\n} from \"../types\";\n\nexport class PreferencesResource {\n constructor(private http: HttpClient) {}\n\n getAll(): Promise<PreferenceResponseDto[]> {\n return this.http.get(\"/api/v1/preferences\");\n }\n\n getByAppKey(appKey: string): Promise<PreferenceResponseDto> {\n return this.http.get(`/api/v1/preferences/${appKey}`);\n }\n\n upsert(appKey: string, data: UpdatePreferencesDto): Promise<PreferenceResponseDto> {\n return this.http.put(`/api/v1/preferences/${appKey}`, data);\n }\n\n remove(appKey: string): Promise<void> {\n return this.http.delete(`/api/v1/preferences/${appKey}`);\n }\n\n merge(appKey: string, data: UpdatePreferencesDto): Promise<PreferenceResponseDto> {\n return this.http.patch(`/api/v1/preferences/${appKey}`, data);\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n CreateConversationDto,\n ConversationResponseDto,\n ConversationMessageResponseDto,\n AddMessageDto,\n ConversationStatus,\n} from \"../types\";\n\nexport class ConversationsResource {\n constructor(private http: HttpClient) {}\n\n create(data: CreateConversationDto): Promise<ConversationResponseDto> {\n return this.http.post(\"/api/v1/conversations\", data);\n }\n\n list(query?: {\n cursor?: string;\n limit?: number;\n status?: ConversationStatus;\n appKey?: string;\n }): Promise<ConversationResponseDto[]> {\n return this.http.get(\"/api/v1/conversations\", { query });\n }\n\n get(id: string): Promise<ConversationResponseDto> {\n return this.http.get(`/api/v1/conversations/${id}`);\n }\n\n archive(id: string): Promise<ConversationResponseDto> {\n return this.http.patch(`/api/v1/conversations/${id}/archive`);\n }\n\n listMessages(conversationId: string, query?: {\n cursor?: string;\n limit?: number;\n }): Promise<ConversationMessageResponseDto[]> {\n return this.http.get(`/api/v1/conversations/${conversationId}/messages`, { query });\n }\n\n addMessage(conversationId: string, data: AddMessageDto): Promise<ConversationMessageResponseDto> {\n return this.http.post(`/api/v1/conversations/${conversationId}/messages`, data);\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type { GenerateDto } from \"../types\";\n\nexport interface GenerationDoneData {\n messageId: string;\n usage?: { inputTokens: number; outputTokens: number };\n structuredOutput?: Record<string, unknown>;\n}\n\nexport interface SseStreamOptions {\n onTextDelta?: (text: string) => void;\n onDone?: (data: GenerationDoneData) => void;\n onError?: (error: string) => void;\n signal?: AbortSignal;\n}\n\ntype SseEvent =\n | { type: \"text_delta\"; text: string }\n | { type: \"done\"; messageId: string; usage?: { inputTokens: number; outputTokens: number }; structuredOutput?: Record<string, unknown> }\n | { type: \"error\"; error: string };\n\nexport class GenerationResource {\n constructor(private http: HttpClient) {}\n\n async generate(conversationId: string, data: GenerateDto, options?: SseStreamOptions): Promise<string> {\n const response = await this.http.rawRequest(\"POST\", `/api/v1/conversations/${conversationId}/generate`, {\n body: data,\n });\n\n const reader = response.body?.getReader();\n if (!reader) throw new Error(\"No response body\");\n\n const decoder = new TextDecoder();\n const parts: string[] = [];\n let buffer = \"\";\n\n try {\n while (true) {\n if (options?.signal?.aborted) {\n reader.cancel();\n break;\n }\n\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split(\"\\n\");\n buffer = lines.pop() ?? \"\";\n\n for (const line of lines) {\n if (!line.startsWith(\"data: \")) continue;\n const jsonStr = line.slice(6).trim();\n if (!jsonStr) continue;\n\n let event: SseEvent;\n try {\n event = JSON.parse(jsonStr);\n } catch {\n continue;\n }\n\n if (event.type === \"text_delta\") {\n parts.push(event.text);\n options?.onTextDelta?.(event.text);\n } else if (event.type === \"done\") {\n options?.onDone?.(event);\n } else if (event.type === \"error\") {\n options?.onError?.(event.error);\n }\n }\n }\n } finally {\n reader.releaseLock();\n }\n\n return parts.join(\"\");\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n TriggerImageDto,\n ImageStatusResponseDto,\n} from \"../types\";\n\nexport class ImagesResource {\n constructor(private http: HttpClient) {}\n\n trigger(messageId: string, data: TriggerImageDto): Promise<ImageStatusResponseDto> {\n return this.http.post(`/api/v1/messages/${messageId}/images`, data);\n }\n\n getAll(messageId: string): Promise<ImageStatusResponseDto[]> {\n return this.http.get(`/api/v1/messages/${messageId}/images`);\n }\n\n getBySlot(messageId: string, slot: string): Promise<ImageStatusResponseDto> {\n return this.http.get(`/api/v1/messages/${messageId}/images/${slot}`);\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n CreateCheckoutDto,\n CreateCustomCheckoutDto,\n CheckoutResponseDto,\n CreditPricingResponseDto,\n} from \"../types\";\n\nexport class PaymentsResource {\n constructor(private http: HttpClient) {}\n\n checkout(data: CreateCheckoutDto): Promise<CheckoutResponseDto> {\n return this.http.post(\"/api/v1/payments/checkout\", data);\n }\n\n checkoutCustom(data: CreateCustomCheckoutDto): Promise<CheckoutResponseDto> {\n return this.http.post(\"/api/v1/payments/checkout/custom\", data);\n }\n\n creditPricing(): Promise<CreditPricingResponseDto> {\n return this.http.get(\"/api/v1/payments/credit-pricing\");\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type { TenantPublicInfoDto } from \"../types\";\n\nexport class TenantsResource {\n constructor(private http: HttpClient) {}\n\n getPublicInfo(tenantId: string): Promise<TenantPublicInfoDto> {\n return this.http.get(\"/api/v1/tenants/public-info\", {\n authenticated: false,\n query: { tenantId },\n });\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type { ReceiptItemDto } from \"../types\";\n\nexport class ReceiptsResource {\n constructor(private http: HttpClient) {}\n\n list(query?: { cursor?: string; limit?: number }): Promise<ReceiptItemDto[]> {\n return this.http.get(\"/api/v1/receipts\", { query });\n }\n\n async download(id: string): Promise<Blob> {\n const response = await this.http.rawRequest(\"GET\", `/api/v1/receipts/${id}/download`);\n return response.blob();\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n EmailPreferencesResponseDto,\n UpdateEmailPreferencesDto,\n UpdateEmailPreferencesTokenDto,\n} from \"../types\";\n\nexport class EmailPreferencesResource {\n constructor(private http: HttpClient) {}\n\n /** Public, token-based: fetch subscription state via an unsubscribe link token. */\n getByToken(token: string): Promise<EmailPreferencesResponseDto> {\n return this.http.get(\"/api/v1/email-preferences\", {\n authenticated: false,\n query: { token },\n });\n }\n\n /** Public, token-based: update subscription state via an unsubscribe link token. */\n updateByToken(data: UpdateEmailPreferencesTokenDto): Promise<EmailPreferencesResponseDto> {\n return this.http.patch(\"/api/v1/email-preferences\", data, { authenticated: false });\n }\n\n /** Authenticated: fetch the current user's subscription state. */\n getMine(): Promise<EmailPreferencesResponseDto> {\n return this.http.get(\"/api/v1/email-preferences/me\");\n }\n\n /** Authenticated: update the current user's subscription state. */\n updateMine(data: UpdateEmailPreferencesDto): Promise<EmailPreferencesResponseDto> {\n return this.http.patch(\"/api/v1/email-preferences/me\", data);\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type { ContactDto, MessageResponseDto } from \"../types\";\n\nexport class ContactResource {\n constructor(private http: HttpClient) {}\n\n /** Send a contact-form message to the tenant's contact inbox. Public — no auth required. */\n send(data: ContactDto): Promise<MessageResponseDto> {\n return this.http.post(\"/api/v1/contact\", data, { authenticated: false });\n }\n}\n","import { HttpClient } from \"./http\";\nimport type { TokensResponseDto, PingResponseDto } from \"./types\";\nimport { AuthResource } from \"./resources/auth\";\nimport { PlansResource } from \"./resources/plans\";\nimport { CreditsResource } from \"./resources/credits\";\nimport { BillingResource } from \"./resources/billing\";\nimport { PreferencesResource } from \"./resources/preferences\";\nimport { ConversationsResource } from \"./resources/conversations\";\nimport { GenerationResource } from \"./resources/generation\";\nimport { ImagesResource } from \"./resources/images\";\nimport { PaymentsResource } from \"./resources/payments\";\nimport { TenantsResource } from \"./resources/tenants\";\nimport { ReceiptsResource } from \"./resources/receipts\";\nimport { EmailPreferencesResource } from \"./resources/email-preferences\";\nimport { ContactResource } from \"./resources/contact\";\n\nexport interface ClientOptions {\n baseUrl: string;\n tenantKey: string;\n accessToken?: string;\n refreshToken?: string;\n onTokenRefreshed?: (tokens: TokensResponseDto) => void | Promise<void>;\n fetch?: typeof globalThis.fetch;\n}\n\nexport interface AiAssistantsClient {\n auth: AuthResource;\n plans: PlansResource;\n credits: CreditsResource;\n billing: BillingResource;\n preferences: PreferencesResource;\n conversations: ConversationsResource;\n generation: GenerationResource;\n images: ImagesResource;\n payments: PaymentsResource;\n tenants: TenantsResource;\n receipts: ReceiptsResource;\n emailPreferences: EmailPreferencesResource;\n contact: ContactResource;\n /**\n * Verify the client is configured correctly: confirms the base URL is\n * reachable and the tenant key is valid. Resolves with the tenant identity\n * when the SDK is ready to use, and rejects with an {@link ApiError} otherwise.\n */\n ping(): Promise<PingResponseDto>;\n setAccessToken(token: string): void;\n setRefreshToken(token: string): void;\n}\n\nexport function createClient(options: ClientOptions): AiAssistantsClient {\n let accessToken = options.accessToken ?? null;\n let refreshToken = options.refreshToken ?? null;\n\n const http = new HttpClient({\n baseUrl: options.baseUrl,\n tenantKey: options.tenantKey,\n fetch: options.fetch,\n getAccessToken: () => accessToken,\n getRefreshToken: () => refreshToken,\n onTokenRefreshed: async (tokens) => {\n accessToken = tokens.accessToken;\n refreshToken = tokens.refreshToken;\n await options.onTokenRefreshed?.(tokens);\n },\n });\n\n return {\n auth: new AuthResource(http),\n plans: new PlansResource(http),\n credits: new CreditsResource(http),\n billing: new BillingResource(http),\n preferences: new PreferencesResource(http),\n conversations: new ConversationsResource(http),\n generation: new GenerationResource(http),\n images: new ImagesResource(http),\n payments: new PaymentsResource(http),\n tenants: new TenantsResource(http),\n receipts: new ReceiptsResource(http),\n emailPreferences: new EmailPreferencesResource(http),\n contact: new ContactResource(http),\n ping() {\n return http.get<PingResponseDto>(\"/api/v1/ping\", { authenticated: false });\n },\n setAccessToken(token: string) {\n accessToken = token;\n },\n setRefreshToken(token: string) {\n refreshToken = token;\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,WAAN,cAAuB,MAAM;AAAA,EAClC,YACkB,YACA,MAChB,SACgB,WAChB;AACA,UAAM,MAAM,QAAQ,OAAO,IAAI,QAAQ,KAAK,IAAI,IAAI,OAAO;AAL3C;AACA;AAEA;AAGhB,SAAK,OAAO;AAAA,EACd;AACF;;;ACcO,IAAM,aAAN,MAAiB;AAAA,EAKtB,YAAoB,QAA0B;AAA1B;AAJpB,SAAQ,iBAA0C;AAKhD,SAAK,UAAU,IAAI,IAAI,OAAO,OAAO;AACrC,SAAK,UAAU,OAAO,SAAS,WAAW;AAAA,EAC5C;AAAA,EAEQ,cACN,QACA,MACA,UAA0B,CAAC,GACR;AACnB,UAAM,EAAE,MAAM,OAAO,gBAAgB,KAAK,IAAI;AAE9C,UAAM,MAAM,IAAI,IAAI,MAAM,KAAK,OAAO;AACtC,QAAI,OAAO;AACT,iBAAW,CAAC,KAAK,KA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AU,IAAI,iBAAiB,IAAI;AAAA,IACnC,kBAAkB,IAAI,yBAAyB,IAAI;AAAA,IACnD,SAAS,IAAI,gBAAgB,IAAI;AAAA,IACjC,OAAO;AACL,aAAO,KAAK,IAAqB,gBAAgB,EAAE,eAAe,MAAM,CAAC;AAAA,IAC3E;AAAA,IACA,eAAe,OAAe;AAC5B,oBAAc;AAAA,IAChB;AAAA,IACA,gBAAgB,OAAe;AAC7B,qBAAe;AAAA,IACjB;AAAA,EACF;AACF;","names":[]}
|
package/dist/index.d.cts
CHANGED
|
@@ -151,26 +151,6 @@ interface components {
|
|
|
151
151
|
referenceId: Record<string, never> | null;
|
|
152
152
|
description: Record<string, never> | null;
|
|
153
153
|
};
|
|
154
|
-
PurchaseCreditsDto: {
|
|
155
|
-
/** Format: uuid */
|
|
156
|
-
planId: string;
|
|
157
|
-
};
|
|
158
|
-
CreditBalanceEntityResponseDto: {
|
|
159
|
-
/** Format: uuid */
|
|
160
|
-
id: string;
|
|
161
|
-
/** Format: date-time */
|
|
162
|
-
createdAt: string;
|
|
163
|
-
/** Format: date-time */
|
|
164
|
-
updatedAt: string;
|
|
165
|
-
/** Format: uuid */
|
|
166
|
-
userId: string;
|
|
167
|
-
/** @example 500 */
|
|
168
|
-
balance: number;
|
|
169
|
-
};
|
|
170
|
-
PurchaseCreditsResponseDto: {
|
|
171
|
-
transaction: components["schemas"]["CreditTransactionResponseDto"];
|
|
172
|
-
balance: components["schemas"]["CreditBalanceEntityResponseDto"];
|
|
173
|
-
};
|
|
174
154
|
BillingResponseDto: {
|
|
175
155
|
/** Format: uuid */
|
|
176
156
|
id: string;
|
|
@@ -255,6 +235,47 @@ interface components {
|
|
|
255
235
|
*/
|
|
256
236
|
preferences: Record<string, never>;
|
|
257
237
|
};
|
|
238
|
+
EmailCategoryDto: {
|
|
239
|
+
/** @example marketing */
|
|
240
|
+
key: string;
|
|
241
|
+
/** @example Marketing & promotional emails */
|
|
242
|
+
label: string;
|
|
243
|
+
/** @example true */
|
|
244
|
+
subscribed: boolean;
|
|
245
|
+
};
|
|
246
|
+
EmailPreferencesResponseDto: {
|
|
247
|
+
/** @example j•••@example.com */
|
|
248
|
+
email: string;
|
|
249
|
+
categories: components["schemas"]["EmailCategoryDto"][];
|
|
250
|
+
};
|
|
251
|
+
UpdateEmailPreferencesTokenDto: {
|
|
252
|
+
/** @example eyJhbGciOi... */
|
|
253
|
+
token: string;
|
|
254
|
+
/**
|
|
255
|
+
* @example {
|
|
256
|
+
* "marketing": false
|
|
257
|
+
* }
|
|
258
|
+
*/
|
|
259
|
+
preferences: Record<string, never>;
|
|
260
|
+
};
|
|
261
|
+
UpdateEmailPreferencesDto: {
|
|
262
|
+
/**
|
|
263
|
+
* @example {
|
|
264
|
+
* "marketing": false
|
|
265
|
+
* }
|
|
266
|
+
*/
|
|
267
|
+
preferences: Record<string, never>;
|
|
268
|
+
};
|
|
269
|
+
ContactDto: {
|
|
270
|
+
/** @example Jane Doe */
|
|
271
|
+
name: string;
|
|
272
|
+
/** @example jane@example.com */
|
|
273
|
+
email: string;
|
|
274
|
+
/** @example Question about my booking */
|
|
275
|
+
subject: string;
|
|
276
|
+
/** @example Hello, I would like to ask about... */
|
|
277
|
+
body: string;
|
|
278
|
+
};
|
|
258
279
|
CreateConversationDto: {
|
|
259
280
|
title?: string;
|
|
260
281
|
/** @example travel */
|
|
@@ -301,11 +322,6 @@ interface components {
|
|
|
301
322
|
metadata: Record<string, never>;
|
|
302
323
|
tokenCount?: Record<string, never> | null;
|
|
303
324
|
};
|
|
304
|
-
PaginatedResponse: {
|
|
305
|
-
hasMore: boolean;
|
|
306
|
-
nextCursor: string | null;
|
|
307
|
-
total?: number;
|
|
308
|
-
};
|
|
309
325
|
GenerateDto: {
|
|
310
326
|
content: string;
|
|
311
327
|
/** @default false */
|
|
@@ -406,7 +422,6 @@ type RefreshTokenDto = components["schemas"]["RefreshTokenDto"];
|
|
|
406
422
|
type UpdateProfileDto = components["schemas"]["UpdateProfileDto"];
|
|
407
423
|
type RequestEmailChangeDto = components["schemas"]["RequestEmailChangeDto"];
|
|
408
424
|
type ConfirmEmailChangeDto = components["schemas"]["ConfirmEmailChangeDto"];
|
|
409
|
-
type PurchaseCreditsDto = components["schemas"]["PurchaseCreditsDto"];
|
|
410
425
|
type UpsertBillingDto = components["schemas"]["UpsertBillingDto"];
|
|
411
426
|
type UpdatePreferencesDto = components["schemas"]["UpdatePreferencesDto"];
|
|
412
427
|
type CreateConversationDto = components["schemas"]["CreateConversationDto"];
|
|
@@ -415,6 +430,7 @@ type GenerateDto = components["schemas"]["GenerateDto"];
|
|
|
415
430
|
type TriggerImageDto = components["schemas"]["TriggerImageDto"];
|
|
416
431
|
type CreateCheckoutDto = components["schemas"]["CreateCheckoutDto"];
|
|
417
432
|
type CreateCustomCheckoutDto = components["schemas"]["CreateCustomCheckoutDto"];
|
|
433
|
+
type ContactDto = components["schemas"]["ContactDto"];
|
|
418
434
|
type MessageResponseDto = components["schemas"]["MessageResponseDto"];
|
|
419
435
|
type StartAuthResponseDto = MessageResponseDto & {
|
|
420
436
|
type: OtpType;
|
|
@@ -425,8 +441,6 @@ type UserResponseDto = components["schemas"]["UserResponseDto"];
|
|
|
425
441
|
type PlanResponseDto = components["schemas"]["PlanResponseDto"];
|
|
426
442
|
type CreditBalanceResponseDto = components["schemas"]["CreditBalanceResponseDto"];
|
|
427
443
|
type CreditTransactionResponseDto = components["schemas"]["CreditTransactionResponseDto"];
|
|
428
|
-
type PurchaseCreditsResponseDto = components["schemas"]["PurchaseCreditsResponseDto"];
|
|
429
|
-
type CreditBalanceEntityResponseDto = components["schemas"]["CreditBalanceEntityResponseDto"];
|
|
430
444
|
type BillingResponseDto = components["schemas"]["BillingResponseDto"];
|
|
431
445
|
type PreferenceResponseDto = components["schemas"]["PreferenceResponseDto"];
|
|
432
446
|
type ConversationResponseDto = components["schemas"]["ConversationResponseDto"] & {
|
|
@@ -439,7 +453,7 @@ type CheckoutResponseDto = components["schemas"]["CheckoutResponseDto"];
|
|
|
439
453
|
type CreditPricingResponseDto = components["schemas"]["CreditPricingResponseDto"];
|
|
440
454
|
type TenantPublicInfoDto = components["schemas"]["TenantPublicInfoDto"];
|
|
441
455
|
type PingResponseDto = components["schemas"]["PingResponseDto"];
|
|
442
|
-
type
|
|
456
|
+
type ReceiptItemDto = components["schemas"]["ReceiptItemDto"];
|
|
443
457
|
type OtpType = components["schemas"]["OtpType"];
|
|
444
458
|
type UserRole = components["schemas"]["UserRole"];
|
|
445
459
|
type PlanType = components["schemas"]["PlanType"];
|
|
@@ -447,6 +461,10 @@ type CreditTransactionType = components["schemas"]["CreditTransactionType"];
|
|
|
447
461
|
type ConversationStatus = ConversationResponseDto["status"];
|
|
448
462
|
type MessageRole = ConversationMessageResponseDto["role"];
|
|
449
463
|
type ImageGenerationStatus = ImageStatusResponseDto["status"];
|
|
464
|
+
type EmailPreferencesResponseDto = components["schemas"]["EmailPreferencesResponseDto"];
|
|
465
|
+
type EmailCategoryDto = components["schemas"]["EmailCategoryDto"];
|
|
466
|
+
type UpdateEmailPreferencesDto = components["schemas"]["UpdateEmailPreferencesDto"];
|
|
467
|
+
type UpdateEmailPreferencesTokenDto = components["schemas"]["UpdateEmailPreferencesTokenDto"];
|
|
450
468
|
|
|
451
469
|
interface HttpClientConfig {
|
|
452
470
|
baseUrl: string;
|
|
@@ -512,7 +530,6 @@ declare class CreditsResource {
|
|
|
512
530
|
limit?: number;
|
|
513
531
|
type?: CreditTransactionType;
|
|
514
532
|
}): Promise<CreditTransactionResponseDto[]>;
|
|
515
|
-
purchase(data: PurchaseCreditsDto): Promise<PurchaseCreditsResponseDto>;
|
|
516
533
|
}
|
|
517
534
|
|
|
518
535
|
declare class BillingResource {
|
|
@@ -599,10 +616,30 @@ declare class ReceiptsResource {
|
|
|
599
616
|
list(query?: {
|
|
600
617
|
cursor?: string;
|
|
601
618
|
limit?: number;
|
|
602
|
-
}): Promise<
|
|
619
|
+
}): Promise<ReceiptItemDto[]>;
|
|
603
620
|
download(id: string): Promise<Blob>;
|
|
604
621
|
}
|
|
605
622
|
|
|
623
|
+
declare class EmailPreferencesResource {
|
|
624
|
+
private http;
|
|
625
|
+
constructor(http: HttpClient);
|
|
626
|
+
/** Public, token-based: fetch subscription state via an unsubscribe link token. */
|
|
627
|
+
getByToken(token: string): Promise<EmailPreferencesResponseDto>;
|
|
628
|
+
/** Public, token-based: update subscription state via an unsubscribe link token. */
|
|
629
|
+
updateByToken(data: UpdateEmailPreferencesTokenDto): Promise<EmailPreferencesResponseDto>;
|
|
630
|
+
/** Authenticated: fetch the current user's subscription state. */
|
|
631
|
+
getMine(): Promise<EmailPreferencesResponseDto>;
|
|
632
|
+
/** Authenticated: update the current user's subscription state. */
|
|
633
|
+
updateMine(data: UpdateEmailPreferencesDto): Promise<EmailPreferencesResponseDto>;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
declare class ContactResource {
|
|
637
|
+
private http;
|
|
638
|
+
constructor(http: HttpClient);
|
|
639
|
+
/** Send a contact-form message to the tenant's contact inbox. Public — no auth required. */
|
|
640
|
+
send(data: ContactDto): Promise<MessageResponseDto>;
|
|
641
|
+
}
|
|
642
|
+
|
|
606
643
|
interface ClientOptions {
|
|
607
644
|
baseUrl: string;
|
|
608
645
|
tenantKey: string;
|
|
@@ -623,6 +660,8 @@ interface AiAssistantsClient {
|
|
|
623
660
|
payments: PaymentsResource;
|
|
624
661
|
tenants: TenantsResource;
|
|
625
662
|
receipts: ReceiptsResource;
|
|
663
|
+
emailPreferences: EmailPreferencesResource;
|
|
664
|
+
contact: ContactResource;
|
|
626
665
|
/**
|
|
627
666
|
* Verify the client is configured correctly: confirms the base URL is
|
|
628
667
|
* reachable and the tenant key is valid. Resolves with the tenant identity
|
|
@@ -641,4 +680,4 @@ declare class ApiError extends Error {
|
|
|
641
680
|
constructor(statusCode: number, code: string, message: string | string[], requestId?: string | undefined);
|
|
642
681
|
}
|
|
643
682
|
|
|
644
|
-
export { type AddMessageDto, type AiAssistantsClient, ApiError, type AuthResponseDto, type BillingResponseDto, type CheckoutResponseDto, type ClientOptions, type ConfirmEmailChangeDto, type ConversationMessageResponseDto, type ConversationResponseDto, type ConversationStatus, type CreateCheckoutDto, type CreateConversationDto, type CreateCustomCheckoutDto, type
|
|
683
|
+
export { type AddMessageDto, type AiAssistantsClient, ApiError, type AuthResponseDto, type BillingResponseDto, type CheckoutResponseDto, type ClientOptions, type ConfirmEmailChangeDto, type ContactDto, type ConversationMessageResponseDto, type ConversationResponseDto, type ConversationStatus, type CreateCheckoutDto, type CreateConversationDto, type CreateCustomCheckoutDto, type CreditBalanceResponseDto, type CreditPricingResponseDto, type CreditTransactionResponseDto, type CreditTransactionType, type EmailCategoryDto, type EmailPreferencesResponseDto, type GenerateDto, type GenerationDoneData, type ImageGenerationStatus, type ImageStatusResponseDto, type LoginDto, type MessageResponseDto, type MessageRole, type OtpType, type PingResponseDto, type PlanResponseDto, type PlanType, type PreferenceResponseDto, type ReceiptItemDto, type RefreshTokenDto, type RegisterDto, type RequestEmailChangeDto, type SseStreamOptions, type StartAuthResponseDto, type TenantPublicInfoDto, type TokensResponseDto, type TriggerImageDto, type UpdateEmailPreferencesDto, type UpdateEmailPreferencesTokenDto, type UpdatePreferencesDto, type UpdateProfileDto, type UpsertBillingDto, type UserResponseDto, type UserRole, type VerifyOtpDto, createClient };
|
package/dist/index.d.ts
CHANGED
|
@@ -151,26 +151,6 @@ interface components {
|
|
|
151
151
|
referenceId: Record<string, never> | null;
|
|
152
152
|
description: Record<string, never> | null;
|
|
153
153
|
};
|
|
154
|
-
PurchaseCreditsDto: {
|
|
155
|
-
/** Format: uuid */
|
|
156
|
-
planId: string;
|
|
157
|
-
};
|
|
158
|
-
CreditBalanceEntityResponseDto: {
|
|
159
|
-
/** Format: uuid */
|
|
160
|
-
id: string;
|
|
161
|
-
/** Format: date-time */
|
|
162
|
-
createdAt: string;
|
|
163
|
-
/** Format: date-time */
|
|
164
|
-
updatedAt: string;
|
|
165
|
-
/** Format: uuid */
|
|
166
|
-
userId: string;
|
|
167
|
-
/** @example 500 */
|
|
168
|
-
balance: number;
|
|
169
|
-
};
|
|
170
|
-
PurchaseCreditsResponseDto: {
|
|
171
|
-
transaction: components["schemas"]["CreditTransactionResponseDto"];
|
|
172
|
-
balance: components["schemas"]["CreditBalanceEntityResponseDto"];
|
|
173
|
-
};
|
|
174
154
|
BillingResponseDto: {
|
|
175
155
|
/** Format: uuid */
|
|
176
156
|
id: string;
|
|
@@ -255,6 +235,47 @@ interface components {
|
|
|
255
235
|
*/
|
|
256
236
|
preferences: Record<string, never>;
|
|
257
237
|
};
|
|
238
|
+
EmailCategoryDto: {
|
|
239
|
+
/** @example marketing */
|
|
240
|
+
key: string;
|
|
241
|
+
/** @example Marketing & promotional emails */
|
|
242
|
+
label: string;
|
|
243
|
+
/** @example true */
|
|
244
|
+
subscribed: boolean;
|
|
245
|
+
};
|
|
246
|
+
EmailPreferencesResponseDto: {
|
|
247
|
+
/** @example j•••@example.com */
|
|
248
|
+
email: string;
|
|
249
|
+
categories: components["schemas"]["EmailCategoryDto"][];
|
|
250
|
+
};
|
|
251
|
+
UpdateEmailPreferencesTokenDto: {
|
|
252
|
+
/** @example eyJhbGciOi... */
|
|
253
|
+
token: string;
|
|
254
|
+
/**
|
|
255
|
+
* @example {
|
|
256
|
+
* "marketing": false
|
|
257
|
+
* }
|
|
258
|
+
*/
|
|
259
|
+
preferences: Record<string, never>;
|
|
260
|
+
};
|
|
261
|
+
UpdateEmailPreferencesDto: {
|
|
262
|
+
/**
|
|
263
|
+
* @example {
|
|
264
|
+
* "marketing": false
|
|
265
|
+
* }
|
|
266
|
+
*/
|
|
267
|
+
preferences: Record<string, never>;
|
|
268
|
+
};
|
|
269
|
+
ContactDto: {
|
|
270
|
+
/** @example Jane Doe */
|
|
271
|
+
name: string;
|
|
272
|
+
/** @example jane@example.com */
|
|
273
|
+
email: string;
|
|
274
|
+
/** @example Question about my booking */
|
|
275
|
+
subject: string;
|
|
276
|
+
/** @example Hello, I would like to ask about... */
|
|
277
|
+
body: string;
|
|
278
|
+
};
|
|
258
279
|
CreateConversationDto: {
|
|
259
280
|
title?: string;
|
|
260
281
|
/** @example travel */
|
|
@@ -301,11 +322,6 @@ interface components {
|
|
|
301
322
|
metadata: Record<string, never>;
|
|
302
323
|
tokenCount?: Record<string, never> | null;
|
|
303
324
|
};
|
|
304
|
-
PaginatedResponse: {
|
|
305
|
-
hasMore: boolean;
|
|
306
|
-
nextCursor: string | null;
|
|
307
|
-
total?: number;
|
|
308
|
-
};
|
|
309
325
|
GenerateDto: {
|
|
310
326
|
content: string;
|
|
311
327
|
/** @default false */
|
|
@@ -406,7 +422,6 @@ type RefreshTokenDto = components["schemas"]["RefreshTokenDto"];
|
|
|
406
422
|
type UpdateProfileDto = components["schemas"]["UpdateProfileDto"];
|
|
407
423
|
type RequestEmailChangeDto = components["schemas"]["RequestEmailChangeDto"];
|
|
408
424
|
type ConfirmEmailChangeDto = components["schemas"]["ConfirmEmailChangeDto"];
|
|
409
|
-
type PurchaseCreditsDto = components["schemas"]["PurchaseCreditsDto"];
|
|
410
425
|
type UpsertBillingDto = components["schemas"]["UpsertBillingDto"];
|
|
411
426
|
type UpdatePreferencesDto = components["schemas"]["UpdatePreferencesDto"];
|
|
412
427
|
type CreateConversationDto = components["schemas"]["CreateConversationDto"];
|
|
@@ -415,6 +430,7 @@ type GenerateDto = components["schemas"]["GenerateDto"];
|
|
|
415
430
|
type TriggerImageDto = components["schemas"]["TriggerImageDto"];
|
|
416
431
|
type CreateCheckoutDto = components["schemas"]["CreateCheckoutDto"];
|
|
417
432
|
type CreateCustomCheckoutDto = components["schemas"]["CreateCustomCheckoutDto"];
|
|
433
|
+
type ContactDto = components["schemas"]["ContactDto"];
|
|
418
434
|
type MessageResponseDto = components["schemas"]["MessageResponseDto"];
|
|
419
435
|
type StartAuthResponseDto = MessageResponseDto & {
|
|
420
436
|
type: OtpType;
|
|
@@ -425,8 +441,6 @@ type UserResponseDto = components["schemas"]["UserResponseDto"];
|
|
|
425
441
|
type PlanResponseDto = components["schemas"]["PlanResponseDto"];
|
|
426
442
|
type CreditBalanceResponseDto = components["schemas"]["CreditBalanceResponseDto"];
|
|
427
443
|
type CreditTransactionResponseDto = components["schemas"]["CreditTransactionResponseDto"];
|
|
428
|
-
type PurchaseCreditsResponseDto = components["schemas"]["PurchaseCreditsResponseDto"];
|
|
429
|
-
type CreditBalanceEntityResponseDto = components["schemas"]["CreditBalanceEntityResponseDto"];
|
|
430
444
|
type BillingResponseDto = components["schemas"]["BillingResponseDto"];
|
|
431
445
|
type PreferenceResponseDto = components["schemas"]["PreferenceResponseDto"];
|
|
432
446
|
type ConversationResponseDto = components["schemas"]["ConversationResponseDto"] & {
|
|
@@ -439,7 +453,7 @@ type CheckoutResponseDto = components["schemas"]["CheckoutResponseDto"];
|
|
|
439
453
|
type CreditPricingResponseDto = components["schemas"]["CreditPricingResponseDto"];
|
|
440
454
|
type TenantPublicInfoDto = components["schemas"]["TenantPublicInfoDto"];
|
|
441
455
|
type PingResponseDto = components["schemas"]["PingResponseDto"];
|
|
442
|
-
type
|
|
456
|
+
type ReceiptItemDto = components["schemas"]["ReceiptItemDto"];
|
|
443
457
|
type OtpType = components["schemas"]["OtpType"];
|
|
444
458
|
type UserRole = components["schemas"]["UserRole"];
|
|
445
459
|
type PlanType = components["schemas"]["PlanType"];
|
|
@@ -447,6 +461,10 @@ type CreditTransactionType = components["schemas"]["CreditTransactionType"];
|
|
|
447
461
|
type ConversationStatus = ConversationResponseDto["status"];
|
|
448
462
|
type MessageRole = ConversationMessageResponseDto["role"];
|
|
449
463
|
type ImageGenerationStatus = ImageStatusResponseDto["status"];
|
|
464
|
+
type EmailPreferencesResponseDto = components["schemas"]["EmailPreferencesResponseDto"];
|
|
465
|
+
type EmailCategoryDto = components["schemas"]["EmailCategoryDto"];
|
|
466
|
+
type UpdateEmailPreferencesDto = components["schemas"]["UpdateEmailPreferencesDto"];
|
|
467
|
+
type UpdateEmailPreferencesTokenDto = components["schemas"]["UpdateEmailPreferencesTokenDto"];
|
|
450
468
|
|
|
451
469
|
interface HttpClientConfig {
|
|
452
470
|
baseUrl: string;
|
|
@@ -512,7 +530,6 @@ declare class CreditsResource {
|
|
|
512
530
|
limit?: number;
|
|
513
531
|
type?: CreditTransactionType;
|
|
514
532
|
}): Promise<CreditTransactionResponseDto[]>;
|
|
515
|
-
purchase(data: PurchaseCreditsDto): Promise<PurchaseCreditsResponseDto>;
|
|
516
533
|
}
|
|
517
534
|
|
|
518
535
|
declare class BillingResource {
|
|
@@ -599,10 +616,30 @@ declare class ReceiptsResource {
|
|
|
599
616
|
list(query?: {
|
|
600
617
|
cursor?: string;
|
|
601
618
|
limit?: number;
|
|
602
|
-
}): Promise<
|
|
619
|
+
}): Promise<ReceiptItemDto[]>;
|
|
603
620
|
download(id: string): Promise<Blob>;
|
|
604
621
|
}
|
|
605
622
|
|
|
623
|
+
declare class EmailPreferencesResource {
|
|
624
|
+
private http;
|
|
625
|
+
constructor(http: HttpClient);
|
|
626
|
+
/** Public, token-based: fetch subscription state via an unsubscribe link token. */
|
|
627
|
+
getByToken(token: string): Promise<EmailPreferencesResponseDto>;
|
|
628
|
+
/** Public, token-based: update subscription state via an unsubscribe link token. */
|
|
629
|
+
updateByToken(data: UpdateEmailPreferencesTokenDto): Promise<EmailPreferencesResponseDto>;
|
|
630
|
+
/** Authenticated: fetch the current user's subscription state. */
|
|
631
|
+
getMine(): Promise<EmailPreferencesResponseDto>;
|
|
632
|
+
/** Authenticated: update the current user's subscription state. */
|
|
633
|
+
updateMine(data: UpdateEmailPreferencesDto): Promise<EmailPreferencesResponseDto>;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
declare class ContactResource {
|
|
637
|
+
private http;
|
|
638
|
+
constructor(http: HttpClient);
|
|
639
|
+
/** Send a contact-form message to the tenant's contact inbox. Public — no auth required. */
|
|
640
|
+
send(data: ContactDto): Promise<MessageResponseDto>;
|
|
641
|
+
}
|
|
642
|
+
|
|
606
643
|
interface ClientOptions {
|
|
607
644
|
baseUrl: string;
|
|
608
645
|
tenantKey: string;
|
|
@@ -623,6 +660,8 @@ interface AiAssistantsClient {
|
|
|
623
660
|
payments: PaymentsResource;
|
|
624
661
|
tenants: TenantsResource;
|
|
625
662
|
receipts: ReceiptsResource;
|
|
663
|
+
emailPreferences: EmailPreferencesResource;
|
|
664
|
+
contact: ContactResource;
|
|
626
665
|
/**
|
|
627
666
|
* Verify the client is configured correctly: confirms the base URL is
|
|
628
667
|
* reachable and the tenant key is valid. Resolves with the tenant identity
|
|
@@ -641,4 +680,4 @@ declare class ApiError extends Error {
|
|
|
641
680
|
constructor(statusCode: number, code: string, message: string | string[], requestId?: string | undefined);
|
|
642
681
|
}
|
|
643
682
|
|
|
644
|
-
export { type AddMessageDto, type AiAssistantsClient, ApiError, type AuthResponseDto, type BillingResponseDto, type CheckoutResponseDto, type ClientOptions, type ConfirmEmailChangeDto, type ConversationMessageResponseDto, type ConversationResponseDto, type ConversationStatus, type CreateCheckoutDto, type CreateConversationDto, type CreateCustomCheckoutDto, type
|
|
683
|
+
export { type AddMessageDto, type AiAssistantsClient, ApiError, type AuthResponseDto, type BillingResponseDto, type CheckoutResponseDto, type ClientOptions, type ConfirmEmailChangeDto, type ContactDto, type ConversationMessageResponseDto, type ConversationResponseDto, type ConversationStatus, type CreateCheckoutDto, type CreateConversationDto, type CreateCustomCheckoutDto, type CreditBalanceResponseDto, type CreditPricingResponseDto, type CreditTransactionResponseDto, type CreditTransactionType, type EmailCategoryDto, type EmailPreferencesResponseDto, type GenerateDto, type GenerationDoneData, type ImageGenerationStatus, type ImageStatusResponseDto, type LoginDto, type MessageResponseDto, type MessageRole, type OtpType, type PingResponseDto, type PlanResponseDto, type PlanType, type PreferenceResponseDto, type ReceiptItemDto, type RefreshTokenDto, type RegisterDto, type RequestEmailChangeDto, type SseStreamOptions, type StartAuthResponseDto, type TenantPublicInfoDto, type TokensResponseDto, type TriggerImageDto, type UpdateEmailPreferencesDto, type UpdateEmailPreferencesTokenDto, type UpdatePreferencesDto, type UpdateProfileDto, type UpsertBillingDto, type UserResponseDto, type UserRole, type VerifyOtpDto, createClient };
|
package/dist/index.js
CHANGED
|
@@ -189,9 +189,6 @@ var CreditsResource = class {
|
|
|
189
189
|
getTransactions(query) {
|
|
190
190
|
return this.http.get("/api/v1/credits/transactions", { query });
|
|
191
191
|
}
|
|
192
|
-
purchase(data) {
|
|
193
|
-
return this.http.post("/api/v1/credits/purchase", data);
|
|
194
|
-
}
|
|
195
192
|
};
|
|
196
193
|
|
|
197
194
|
// src/resources/billing.ts
|
|
@@ -365,6 +362,43 @@ var ReceiptsResource = class {
|
|
|
365
362
|
}
|
|
366
363
|
};
|
|
367
364
|
|
|
365
|
+
// src/resources/email-preferences.ts
|
|
366
|
+
var EmailPreferencesResource = class {
|
|
367
|
+
constructor(http) {
|
|
368
|
+
this.http = http;
|
|
369
|
+
}
|
|
370
|
+
/** Public, token-based: fetch subscription state via an unsubscribe link token. */
|
|
371
|
+
getByToken(token) {
|
|
372
|
+
return this.http.get("/api/v1/email-preferences", {
|
|
373
|
+
authenticated: false,
|
|
374
|
+
query: { token }
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
/** Public, token-based: update subscription state via an unsubscribe link token. */
|
|
378
|
+
updateByToken(data) {
|
|
379
|
+
return this.http.patch("/api/v1/email-preferences", data, { authenticated: false });
|
|
380
|
+
}
|
|
381
|
+
/** Authenticated: fetch the current user's subscription state. */
|
|
382
|
+
getMine() {
|
|
383
|
+
return this.http.get("/api/v1/email-preferences/me");
|
|
384
|
+
}
|
|
385
|
+
/** Authenticated: update the current user's subscription state. */
|
|
386
|
+
updateMine(data) {
|
|
387
|
+
return this.http.patch("/api/v1/email-preferences/me", data);
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
// src/resources/contact.ts
|
|
392
|
+
var ContactResource = class {
|
|
393
|
+
constructor(http) {
|
|
394
|
+
this.http = http;
|
|
395
|
+
}
|
|
396
|
+
/** Send a contact-form message to the tenant's contact inbox. Public — no auth required. */
|
|
397
|
+
send(data) {
|
|
398
|
+
return this.http.post("/api/v1/contact", data, { authenticated: false });
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
|
|
368
402
|
// src/client.ts
|
|
369
403
|
function createClient(options) {
|
|
370
404
|
let accessToken = options.accessToken ?? null;
|
|
@@ -393,6 +427,8 @@ function createClient(options) {
|
|
|
393
427
|
payments: new PaymentsResource(http),
|
|
394
428
|
tenants: new TenantsResource(http),
|
|
395
429
|
receipts: new ReceiptsResource(http),
|
|
430
|
+
emailPreferences: new EmailPreferencesResource(http),
|
|
431
|
+
contact: new ContactResource(http),
|
|
396
432
|
ping() {
|
|
397
433
|
return http.get("/api/v1/ping", { authenticated: false });
|
|
398
434
|
},
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/errors.ts","../src/http.ts","../src/resources/auth.ts","../src/resources/plans.ts","../src/resources/credits.ts","../src/resources/billing.ts","../src/resources/preferences.ts","../src/resources/conversations.ts","../src/resources/generation.ts","../src/resources/images.ts","../src/resources/payments.ts","../src/resources/tenants.ts","../src/resources/receipts.ts","../src/client.ts"],"sourcesContent":["export class ApiError extends Error {\n constructor(\n public readonly statusCode: number,\n public readonly code: string,\n message: string | string[],\n public readonly requestId?: string,\n ) {\n super(Array.isArray(message) ? message.join(\", \") : message);\n this.name = \"ApiError\";\n }\n}\n","import { ApiError } from \"./errors\";\nimport type { TokensResponseDto } from \"./types\";\n\nexport interface HttpClientConfig {\n baseUrl: string;\n tenantKey: string;\n getAccessToken: () => string | null;\n getRefreshToken: () => string | null;\n onTokenRefreshed: (tokens: TokensResponseDto) => void | Promise<void>;\n fetch?: typeof globalThis.fetch;\n}\n\ntype HttpMethod = \"GET\" | \"POST\" | \"PUT\" | \"PATCH\" | \"DELETE\";\n\ninterface RequestOptions {\n body?: unknown;\n query?: Record<string, string | number | boolean | undefined | null>;\n authenticated?: boolean;\n}\n\ninterface InternalRequestOptions extends RequestOptions {\n isRetry?: boolean;\n}\n\nexport class HttpClient {\n private refreshPromise: Promise<boolean> | null = null;\n private readonly baseUrl: URL;\n private readonly fetchFn: typeof globalThis.fetch;\n\n constructor(private config: HttpClientConfig) {\n this.baseUrl = new URL(config.baseUrl);\n this.fetchFn = config.fetch ?? globalThis.fetch;\n }\n\n private buildAndFetch(\n method: HttpMethod,\n path: string,\n options: RequestOptions = {},\n ): Promise<Response> {\n const { body, query, authenticated = true } = options;\n\n const url = new URL(path, this.baseUrl);\n if (query) {\n for (const [key, value] of Object.entries(query)) {\n if (value !== undefined && value !== null) {\n url.searchParams.set(key, String(value));\n }\n }\n }\n\n const headers: Record<string, string> = {\n \"X-Tenant-Key\": this.config.tenantKey,\n };\n if (body !== undefined) {\n headers[\"Content-Type\"] = \"application/json\";\n }\n if (authenticated) {\n const token = this.config.getAccessToken();\n if (token) {\n headers[\"Authorization\"] = `Bearer ${token}`;\n }\n }\n\n return this.fetchFn(url.toString(), {\n method,\n headers,\n body: body !== undefined ? JSON.stringify(body) : undefined,\n });\n }\n\n private async throwIfError(response: Response): Promise<void> {\n if (!response.ok) {\n const errorBody = await response.json().catch(() => null);\n throw new ApiError(\n response.status,\n errorBody?.error?.code ?? \"UNKNOWN_ERROR\",\n errorBody?.error?.message ?? response.statusText,\n errorBody?.meta?.requestId,\n );\n }\n }\n\n private async request<T>(\n method: HttpMethod,\n path: string,\n options: InternalRequestOptions = {},\n ): Promise<T> {\n const { isRetry = false, authenticated = true } = options;\n\n const response = await this.buildAndFetch(method, path, options);\n\n if (response.status === 401 && !isRetry && authenticated) {\n const refreshed = await this.attemptTokenRefresh();\n if (refreshed) {\n return this.request<T>(method, path, { ...options, isRetry: true });\n }\n }\n\n await this.throwIfError(response);\n\n const contentType = response.headers.get(\"content-type\");\n if (!contentType?.includes(\"application/json\")) {\n return undefined as T;\n }\n\n const json = await response.json();\n return (json && \"data\" in json && \"meta\" in json ? json.data : json) as T;\n }\n\n private attemptTokenRefresh(): Promise<boolean> {\n if (this.refreshPromise) return this.refreshPromise;\n this.refreshPromise = this.doRefresh().finally(() => {\n this.refreshPromise = null;\n });\n return this.refreshPromise;\n }\n\n private async doRefresh(): Promise<boolean> {\n const refreshToken = this.config.getRefreshToken();\n if (!refreshToken) return false;\n\n try {\n const tokens = await this.request<TokensResponseDto>(\n \"POST\",\n \"/api/v1/auth/refresh\",\n {\n body: { refreshToken },\n authenticated: false,\n isRetry: true,\n },\n );\n await this.config.onTokenRefreshed(tokens);\n return true;\n } catch {\n return false;\n }\n }\n\n get<T>(path: string, options?: RequestOptions): Promise<T> {\n return this.request<T>(\"GET\", path, options);\n }\n\n post<T>(path: string, body?: unknown, options?: Omit<RequestOptions, \"body\">): Promise<T> {\n return this.request<T>(\"POST\", path, { ...options, body });\n }\n\n patch<T>(path: string, body?: unknown, options?: Omit<RequestOptions, \"body\">): Promise<T> {\n return this.request<T>(\"PATCH\", path, { ...options, body });\n }\n\n put<T>(path: string, body?: unknown, options?: Omit<RequestOptions, \"body\">): Promise<T> {\n return this.request<T>(\"PUT\", path, { ...options, body });\n }\n\n delete<T>(path: string, options?: RequestOptions): Promise<T> {\n return this.request<T>(\"DELETE\", path, options);\n }\n\n async rawRequest(method: HttpMethod, path: string, options: RequestOptions = {}): Promise<Response> {\n const { authenticated = true } = options;\n\n let response = await this.buildAndFetch(method, path, options);\n\n if (response.status === 401 && authenticated) {\n const refreshed = await this.attemptTokenRefresh();\n if (refreshed) {\n response = await this.buildAndFetch(method, path, options);\n }\n }\n\n await this.throwIfError(response);\n\n return response;\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n RegisterDto,\n LoginDto,\n VerifyOtpDto,\n RefreshTokenDto,\n UpdateProfileDto,\n RequestEmailChangeDto,\n ConfirmEmailChangeDto,\n MessageResponseDto,\n AuthResponseDto,\n TokensResponseDto,\n UserResponseDto,\n StartAuthResponseDto,\n} from \"../types\";\n\nexport class AuthResource {\n constructor(private http: HttpClient) {}\n\n register(data: RegisterDto): Promise<MessageResponseDto> {\n return this.http.post(\"/api/v1/auth/register\", data, { authenticated: false });\n }\n\n login(data: LoginDto): Promise<MessageResponseDto> {\n return this.http.post(\"/api/v1/auth/login\", data, { authenticated: false });\n }\n\n startAuth(data: LoginDto): Promise<StartAuthResponseDto> {\n return this.http.post(\"/api/v1/auth/start\", data, { authenticated: false });\n }\n\n verifyOtp(data: VerifyOtpDto): Promise<AuthResponseDto> {\n return this.http.post(\"/api/v1/auth/verify-otp\", data, { authenticated: false });\n }\n\n refresh(data: RefreshTokenDto): Promise<TokensResponseDto> {\n return this.http.post(\"/api/v1/auth/refresh\", data, { authenticated: false });\n }\n\n logout(): Promise<void> {\n return this.http.post(\"/api/v1/auth/logout\");\n }\n\n getProfile(): Promise<UserResponseDto> {\n return this.http.get(\"/api/v1/auth/me\");\n }\n\n updateProfile(data: UpdateProfileDto): Promise<UserResponseDto> {\n return this.http.patch(\"/api/v1/auth/me\", data);\n }\n\n deleteAccount(): Promise<void> {\n return this.http.delete(\"/api/v1/auth/me\");\n }\n\n requestEmailChange(data: RequestEmailChangeDto): Promise<MessageResponseDto> {\n return this.http.post(\"/api/v1/auth/request-email-change\", data);\n }\n\n confirmEmailChange(data: ConfirmEmailChangeDto): Promise<MessageResponseDto> {\n return this.http.post(\"/api/v1/auth/confirm-email-change\", data);\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type { PlanResponseDto } from \"../types\";\n\nexport class PlansResource {\n constructor(private http: HttpClient) {}\n\n list(): Promise<PlanResponseDto[]> {\n return this.http.get(\"/api/v1/public/plans\", { authenticated: false });\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n CreditBalanceResponseDto,\n CreditTransactionResponseDto,\n CreditTransactionType,\n PurchaseCreditsDto,\n PurchaseCreditsResponseDto,\n} from \"../types\";\n\nexport class CreditsResource {\n constructor(private http: HttpClient) {}\n\n getBalance(): Promise<CreditBalanceResponseDto> {\n return this.http.get(\"/api/v1/credits/balance\");\n }\n\n getTransactions(query?: {\n cursor?: string;\n limit?: number;\n type?: CreditTransactionType;\n }): Promise<CreditTransactionResponseDto[]> {\n return this.http.get(\"/api/v1/credits/transactions\", { query });\n }\n\n purchase(data: PurchaseCreditsDto): Promise<PurchaseCreditsResponseDto> {\n return this.http.post(\"/api/v1/credits/purchase\", data);\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type { BillingResponseDto, UpsertBillingDto } from \"../types\";\n\nexport class BillingResource {\n constructor(private http: HttpClient) {}\n\n get(): Promise<BillingResponseDto> {\n return this.http.get(\"/api/v1/billing\");\n }\n\n upsert(data: UpsertBillingDto): Promise<BillingResponseDto> {\n return this.http.put(\"/api/v1/billing\", data);\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n PreferenceResponseDto,\n UpdatePreferencesDto,\n} from \"../types\";\n\nexport class PreferencesResource {\n constructor(private http: HttpClient) {}\n\n getAll(): Promise<PreferenceResponseDto[]> {\n return this.http.get(\"/api/v1/preferences\");\n }\n\n getByAppKey(appKey: string): Promise<PreferenceResponseDto> {\n return this.http.get(`/api/v1/preferences/${appKey}`);\n }\n\n upsert(appKey: string, data: UpdatePreferencesDto): Promise<PreferenceResponseDto> {\n return this.http.put(`/api/v1/preferences/${appKey}`, data);\n }\n\n remove(appKey: string): Promise<void> {\n return this.http.delete(`/api/v1/preferences/${appKey}`);\n }\n\n merge(appKey: string, data: UpdatePreferencesDto): Promise<PreferenceResponseDto> {\n return this.http.patch(`/api/v1/preferences/${appKey}`, data);\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n CreateConversationDto,\n ConversationResponseDto,\n ConversationMessageResponseDto,\n AddMessageDto,\n ConversationStatus,\n} from \"../types\";\n\nexport class ConversationsResource {\n constructor(private http: HttpClient) {}\n\n create(data: CreateConversationDto): Promise<ConversationResponseDto> {\n return this.http.post(\"/api/v1/conversations\", data);\n }\n\n list(query?: {\n cursor?: string;\n limit?: number;\n status?: ConversationStatus;\n appKey?: string;\n }): Promise<ConversationResponseDto[]> {\n return this.http.get(\"/api/v1/conversations\", { query });\n }\n\n get(id: string): Promise<ConversationResponseDto> {\n return this.http.get(`/api/v1/conversations/${id}`);\n }\n\n archive(id: string): Promise<ConversationResponseDto> {\n return this.http.patch(`/api/v1/conversations/${id}/archive`);\n }\n\n listMessages(conversationId: string, query?: {\n cursor?: string;\n limit?: number;\n }): Promise<ConversationMessageResponseDto[]> {\n return this.http.get(`/api/v1/conversations/${conversationId}/messages`, { query });\n }\n\n addMessage(conversationId: string, data: AddMessageDto): Promise<ConversationMessageResponseDto> {\n return this.http.post(`/api/v1/conversations/${conversationId}/messages`, data);\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type { GenerateDto } from \"../types\";\n\nexport interface GenerationDoneData {\n messageId: string;\n usage?: { inputTokens: number; outputTokens: number };\n structuredOutput?: Record<string, unknown>;\n}\n\nexport interface SseStreamOptions {\n onTextDelta?: (text: string) => void;\n onDone?: (data: GenerationDoneData) => void;\n onError?: (error: string) => void;\n signal?: AbortSignal;\n}\n\ntype SseEvent =\n | { type: \"text_delta\"; text: string }\n | { type: \"done\"; messageId: string; usage?: { inputTokens: number; outputTokens: number }; structuredOutput?: Record<string, unknown> }\n | { type: \"error\"; error: string };\n\nexport class GenerationResource {\n constructor(private http: HttpClient) {}\n\n async generate(conversationId: string, data: GenerateDto, options?: SseStreamOptions): Promise<string> {\n const response = await this.http.rawRequest(\"POST\", `/api/v1/conversations/${conversationId}/generate`, {\n body: data,\n });\n\n const reader = response.body?.getReader();\n if (!reader) throw new Error(\"No response body\");\n\n const decoder = new TextDecoder();\n const parts: string[] = [];\n let buffer = \"\";\n\n try {\n while (true) {\n if (options?.signal?.aborted) {\n reader.cancel();\n break;\n }\n\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split(\"\\n\");\n buffer = lines.pop() ?? \"\";\n\n for (const line of lines) {\n if (!line.startsWith(\"data: \")) continue;\n const jsonStr = line.slice(6).trim();\n if (!jsonStr) continue;\n\n let event: SseEvent;\n try {\n event = JSON.parse(jsonStr);\n } catch {\n continue;\n }\n\n if (event.type === \"text_delta\") {\n parts.push(event.text);\n options?.onTextDelta?.(event.text);\n } else if (event.type === \"done\") {\n options?.onDone?.(event);\n } else if (event.type === \"error\") {\n options?.onError?.(event.error);\n }\n }\n }\n } finally {\n reader.releaseLock();\n }\n\n return parts.join(\"\");\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n TriggerImageDto,\n ImageStatusResponseDto,\n} from \"../types\";\n\nexport class ImagesResource {\n constructor(private http: HttpClient) {}\n\n trigger(messageId: string, data: TriggerImageDto): Promise<ImageStatusResponseDto> {\n return this.http.post(`/api/v1/messages/${messageId}/images`, data);\n }\n\n getAll(messageId: string): Promise<ImageStatusResponseDto[]> {\n return this.http.get(`/api/v1/messages/${messageId}/images`);\n }\n\n getBySlot(messageId: string, slot: string): Promise<ImageStatusResponseDto> {\n return this.http.get(`/api/v1/messages/${messageId}/images/${slot}`);\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n CreateCheckoutDto,\n CreateCustomCheckoutDto,\n CheckoutResponseDto,\n CreditPricingResponseDto,\n} from \"../types\";\n\nexport class PaymentsResource {\n constructor(private http: HttpClient) {}\n\n checkout(data: CreateCheckoutDto): Promise<CheckoutResponseDto> {\n return this.http.post(\"/api/v1/payments/checkout\", data);\n }\n\n checkoutCustom(data: CreateCustomCheckoutDto): Promise<CheckoutResponseDto> {\n return this.http.post(\"/api/v1/payments/checkout/custom\", data);\n }\n\n creditPricing(): Promise<CreditPricingResponseDto> {\n return this.http.get(\"/api/v1/payments/credit-pricing\");\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type { TenantPublicInfoDto } from \"../types\";\n\nexport class TenantsResource {\n constructor(private http: HttpClient) {}\n\n getPublicInfo(tenantId: string): Promise<TenantPublicInfoDto> {\n return this.http.get(\"/api/v1/tenants/public-info\", {\n authenticated: false,\n query: { tenantId },\n });\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type { PaginatedResponse } from \"../types\";\n\nexport class ReceiptsResource {\n constructor(private http: HttpClient) {}\n\n list(query?: { cursor?: string; limit?: number }): Promise<PaginatedResponse> {\n return this.http.get(\"/api/v1/receipts\", { query });\n }\n\n async download(id: string): Promise<Blob> {\n const response = await this.http.rawRequest(\"GET\", `/api/v1/receipts/${id}/download`);\n return response.blob();\n }\n}\n","import { HttpClient } from \"./http\";\nimport type { TokensResponseDto, PingResponseDto } from \"./types\";\nimport { AuthResource } from \"./resources/auth\";\nimport { PlansResource } from \"./resources/plans\";\nimport { CreditsResource } from \"./resources/credits\";\nimport { BillingResource } from \"./resources/billing\";\nimport { PreferencesResource } from \"./resources/preferences\";\nimport { ConversationsResource } from \"./resources/conversations\";\nimport { GenerationResource } from \"./resources/generation\";\nimport { ImagesResource } from \"./resources/images\";\nimport { PaymentsResource } from \"./resources/payments\";\nimport { TenantsResource } from \"./resources/tenants\";\nimport { ReceiptsResource } from \"./resources/receipts\";\n\nexport interface ClientOptions {\n baseUrl: string;\n tenantKey: string;\n accessToken?: string;\n refreshToken?: string;\n onTokenRefreshed?: (tokens: TokensResponseDto) => void | Promise<void>;\n fetch?: typeof globalThis.fetch;\n}\n\nexport interface AiAssistantsClient {\n auth: AuthResource;\n plans: PlansResource;\n credits: CreditsResource;\n billing: BillingResource;\n preferences: PreferencesResource;\n conversations: ConversationsResource;\n generation: GenerationResource;\n images: ImagesResource;\n payments: PaymentsResource;\n tenants: TenantsResource;\n receipts: ReceiptsResource;\n /**\n * Verify the client is configured correctly: confirms the base URL is\n * reachable and the tenant key is valid. Resolves with the tenant identity\n * when the SDK is ready to use, and rejects with an {@link ApiError} otherwise.\n */\n ping(): Promise<PingResponseDto>;\n setAccessToken(token: string): void;\n setRefreshToken(token: string): void;\n}\n\nexport function createClient(options: ClientOptions): AiAssistantsClient {\n let accessToken = options.accessToken ?? null;\n let refreshToken = options.refreshToken ?? null;\n\n const http = new HttpClient({\n baseUrl: options.baseUrl,\n tenantKey: options.tenantKey,\n fetch: options.fetch,\n getAccessToken: () => accessToken,\n getRefreshToken: () => refreshToken,\n onTokenRefreshed: async (tokens) => {\n accessToken = tokens.accessToken;\n refreshToken = tokens.refreshToken;\n await options.onTokenRefreshed?.(tokens);\n },\n });\n\n return {\n auth: new AuthResource(http),\n plans: new PlansResource(http),\n credits: new CreditsResource(http),\n billing: new BillingResource(http),\n preferences: new PreferencesResource(http),\n conversations: new ConversationsResource(http),\n generation: new GenerationResource(http),\n images: new ImagesResource(http),\n payments: new PaymentsResource(http),\n tenants: new TenantsResource(http),\n receipts: new ReceiptsResource(http),\n ping() {\n return http.get<PingResponseDto>(\"/api/v1/ping\", { authenticated: false });\n },\n setAccessToken(token: string) {\n accessToken = token;\n },\n setRefreshToken(token: string) {\n refreshToken = token;\n },\n };\n}\n"],"mappings":";AAAO,IAAM,WAAN,cAAuB,MAAM;AAAA,EAClC,YACkB,YACA,MAChB,SACgB,WAChB;AACA,UAAM,MAAM,QAAQ,OAAO,IAAI,QAAQ,KAAK,IAAI,IAAI,OAAO;AAL3C;AACA;AAEA;AAGhB,SAAK,OAAO;AAAA,EACd;AACF;;;ACcO,IAAM,aAAN,MAAiB;AAAA,EAKtB,YAAoB,QAA0B;AAA1B;AAJpB,SAAQ,iBAA0C;AAKhD,SAAK,UAAU,IAAI,IAAI,OAAO,OAAO;AACrC,SAAK,UAAU,OAAO,SAAS,WAAW;AAAA,EAC5C;AAAA,EAEQ,cACN,QACA,MACA,UAA0B,CAAC,GACR;AACnB,UAAM,EAAE,MAAM,OAAO,gBAAgB,KAAK,IAAI;AAE9C,UAAM,MAAM,IAAI,IAAI,MAAM,KAAK,OAAO;AACtC,QAAI,OAAO;AACT,iBAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,KAAK,GAAG;AAChD,YAAI,UAAU,UAAa,UAAU,MAAM;AACzC,cAAI,aAAa,IAAI,KAAK,OAAO,KAAK,CAAC;AAAA,QACz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AAe,OAAO;AACtB,YAAM,QAAQ,mBAAmB,MAAM;AAAA,IACzC;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL,MAAM,IAAI,aAAa,IAAI;AAAA,IAC3B,OAAO,IAAI,cAAc,IAAI;AAAA,IAC7B,SAAS,IAAI,gBAAgB,IAAI;AAAA,IACjC,SAAS,IAAI,gBAAgB,IAAI;AAAA,IACjC,aAAa,IAAI,oBAAoB,IAAI;AAAA,IACzC,eAAe,IAAI,sBAAsB,IAAI;AAAA,IAC7C,YAAY,IAAI,mBAAmB,IAAI;AAAA,IACvC,QAAQ,IAAI,eAAe,IAAI;AAAA,IAC/B,UAAU,IAAI,iBAAiB,IAAI;AAAA,IACnC,SAAS,IAAI,gBAAgB,IAAI;AAAA,IACjC,UAAU,IAAI,iBAAiB,IAAI;AAAA,IACnC,OAAO;AACL,aAAO,KAAK,IAAqB,gBAAgB,EAAE,eAAe,MAAM,CAAC;AAAA,IAC3E;AAAA,IACA,eAAe,OAAe;AAC5B,oBAAc;AAAA,IAChB;AAAA,IACA,gBAAgB,OAAe;AAC7B,qBAAe;AAAA,IACjB;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/errors.ts","../src/http.ts","../src/resources/auth.ts","../src/resources/plans.ts","../src/resources/credits.ts","../src/resources/billing.ts","../src/resources/preferences.ts","../src/resources/conversations.ts","../src/resources/generation.ts","../src/resources/images.ts","../src/resources/payments.ts","../src/resources/tenants.ts","../src/resources/receipts.ts","../src/resources/email-preferences.ts","../src/resources/contact.ts","../src/client.ts"],"sourcesContent":["export class ApiError extends Error {\n constructor(\n public readonly statusCode: number,\n public readonly code: string,\n message: string | string[],\n public readonly requestId?: string,\n ) {\n super(Array.isArray(message) ? message.join(\", \") : message);\n this.name = \"ApiError\";\n }\n}\n","import { ApiError } from \"./errors\";\nimport type { TokensResponseDto } from \"./types\";\n\nexport interface HttpClientConfig {\n baseUrl: string;\n tenantKey: string;\n getAccessToken: () => string | null;\n getRefreshToken: () => string | null;\n onTokenRefreshed: (tokens: TokensResponseDto) => void | Promise<void>;\n fetch?: typeof globalThis.fetch;\n}\n\ntype HttpMethod = \"GET\" | \"POST\" | \"PUT\" | \"PATCH\" | \"DELETE\";\n\ninterface RequestOptions {\n body?: unknown;\n query?: Record<string, string | number | boolean | undefined | null>;\n authenticated?: boolean;\n}\n\ninterface InternalRequestOptions extends RequestOptions {\n isRetry?: boolean;\n}\n\nexport class HttpClient {\n private refreshPromise: Promise<boolean> | null = null;\n private readonly baseUrl: URL;\n private readonly fetchFn: typeof globalThis.fetch;\n\n constructor(private config: HttpClientConfig) {\n this.baseUrl = new URL(config.baseUrl);\n this.fetchFn = config.fetch ?? globalThis.fetch;\n }\n\n private buildAndFetch(\n method: HttpMethod,\n path: string,\n options: RequestOptions = {},\n ): Promise<Response> {\n const { body, query, authenticated = true } = options;\n\n const url = new URL(path, this.baseUrl);\n if (query) {\n for (const [key, value] of Object.entries(query)) {\n if (value !== undefined && value !== null) {\n url.searchParams.set(key, String(value));\n }\n }\n }\n\n const headers: Record<string, string> = {\n \"X-Tenant-Key\": this.config.tenantKey,\n };\n if (body !== undefined) {\n headers[\"Content-Type\"] = \"application/json\";\n }\n if (authenticated) {\n const token = this.config.getAccessToken();\n if (token) {\n headers[\"Authorization\"] = `Bearer ${token}`;\n }\n }\n\n return this.fetchFn(url.toString(), {\n method,\n headers,\n body: body !== undefined ? JSON.stringify(body) : undefined,\n });\n }\n\n private async throwIfError(response: Response): Promise<void> {\n if (!response.ok) {\n const errorBody = await response.json().catch(() => null);\n throw new ApiError(\n response.status,\n errorBody?.error?.code ?? \"UNKNOWN_ERROR\",\n errorBody?.error?.message ?? response.statusText,\n errorBody?.meta?.requestId,\n );\n }\n }\n\n private async request<T>(\n method: HttpMethod,\n path: string,\n options: InternalRequestOptions = {},\n ): Promise<T> {\n const { isRetry = false, authenticated = true } = options;\n\n const response = await this.buildAndFetch(method, path, options);\n\n if (response.status === 401 && !isRetry && authenticated) {\n const refreshed = await this.attemptTokenRefresh();\n if (refreshed) {\n return this.request<T>(method, path, { ...options, isRetry: true });\n }\n }\n\n await this.throwIfError(response);\n\n const contentType = response.headers.get(\"content-type\");\n if (!contentType?.includes(\"application/json\")) {\n return undefined as T;\n }\n\n const json = await response.json();\n return (json && \"data\" in json && \"meta\" in json ? json.data : json) as T;\n }\n\n private attemptTokenRefresh(): Promise<boolean> {\n if (this.refreshPromise) return this.refreshPromise;\n this.refreshPromise = this.doRefresh().finally(() => {\n this.refreshPromise = null;\n });\n return this.refreshPromise;\n }\n\n private async doRefresh(): Promise<boolean> {\n const refreshToken = this.config.getRefreshToken();\n if (!refreshToken) return false;\n\n try {\n const tokens = await this.request<TokensResponseDto>(\n \"POST\",\n \"/api/v1/auth/refresh\",\n {\n body: { refreshToken },\n authenticated: false,\n isRetry: true,\n },\n );\n await this.config.onTokenRefreshed(tokens);\n return true;\n } catch {\n return false;\n }\n }\n\n get<T>(path: string, options?: RequestOptions): Promise<T> {\n return this.request<T>(\"GET\", path, options);\n }\n\n post<T>(path: string, body?: unknown, options?: Omit<RequestOptions, \"body\">): Promise<T> {\n return this.request<T>(\"POST\", path, { ...options, body });\n }\n\n patch<T>(path: string, body?: unknown, options?: Omit<RequestOptions, \"body\">): Promise<T> {\n return this.request<T>(\"PATCH\", path, { ...options, body });\n }\n\n put<T>(path: string, body?: unknown, options?: Omit<RequestOptions, \"body\">): Promise<T> {\n return this.request<T>(\"PUT\", path, { ...options, body });\n }\n\n delete<T>(path: string, options?: RequestOptions): Promise<T> {\n return this.request<T>(\"DELETE\", path, options);\n }\n\n async rawRequest(method: HttpMethod, path: string, options: RequestOptions = {}): Promise<Response> {\n const { authenticated = true } = options;\n\n let response = await this.buildAndFetch(method, path, options);\n\n if (response.status === 401 && authenticated) {\n const refreshed = await this.attemptTokenRefresh();\n if (refreshed) {\n response = await this.buildAndFetch(method, path, options);\n }\n }\n\n await this.throwIfError(response);\n\n return response;\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n RegisterDto,\n LoginDto,\n VerifyOtpDto,\n RefreshTokenDto,\n UpdateProfileDto,\n RequestEmailChangeDto,\n ConfirmEmailChangeDto,\n MessageResponseDto,\n AuthResponseDto,\n TokensResponseDto,\n UserResponseDto,\n StartAuthResponseDto,\n} from \"../types\";\n\nexport class AuthResource {\n constructor(private http: HttpClient) {}\n\n register(data: RegisterDto): Promise<MessageResponseDto> {\n return this.http.post(\"/api/v1/auth/register\", data, { authenticated: false });\n }\n\n login(data: LoginDto): Promise<MessageResponseDto> {\n return this.http.post(\"/api/v1/auth/login\", data, { authenticated: false });\n }\n\n startAuth(data: LoginDto): Promise<StartAuthResponseDto> {\n return this.http.post(\"/api/v1/auth/start\", data, { authenticated: false });\n }\n\n verifyOtp(data: VerifyOtpDto): Promise<AuthResponseDto> {\n return this.http.post(\"/api/v1/auth/verify-otp\", data, { authenticated: false });\n }\n\n refresh(data: RefreshTokenDto): Promise<TokensResponseDto> {\n return this.http.post(\"/api/v1/auth/refresh\", data, { authenticated: false });\n }\n\n logout(): Promise<void> {\n return this.http.post(\"/api/v1/auth/logout\");\n }\n\n getProfile(): Promise<UserResponseDto> {\n return this.http.get(\"/api/v1/auth/me\");\n }\n\n updateProfile(data: UpdateProfileDto): Promise<UserResponseDto> {\n return this.http.patch(\"/api/v1/auth/me\", data);\n }\n\n deleteAccount(): Promise<void> {\n return this.http.delete(\"/api/v1/auth/me\");\n }\n\n requestEmailChange(data: RequestEmailChangeDto): Promise<MessageResponseDto> {\n return this.http.post(\"/api/v1/auth/request-email-change\", data);\n }\n\n confirmEmailChange(data: ConfirmEmailChangeDto): Promise<MessageResponseDto> {\n return this.http.post(\"/api/v1/auth/confirm-email-change\", data);\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type { PlanResponseDto } from \"../types\";\n\nexport class PlansResource {\n constructor(private http: HttpClient) {}\n\n list(): Promise<PlanResponseDto[]> {\n return this.http.get(\"/api/v1/public/plans\", { authenticated: false });\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n CreditBalanceResponseDto,\n CreditTransactionResponseDto,\n CreditTransactionType,\n} from \"../types\";\n\nexport class CreditsResource {\n constructor(private http: HttpClient) {}\n\n getBalance(): Promise<CreditBalanceResponseDto> {\n return this.http.get(\"/api/v1/credits/balance\");\n }\n\n getTransactions(query?: {\n cursor?: string;\n limit?: number;\n type?: CreditTransactionType;\n }): Promise<CreditTransactionResponseDto[]> {\n return this.http.get(\"/api/v1/credits/transactions\", { query });\n }\n\n}\n","import type { HttpClient } from \"../http\";\nimport type { BillingResponseDto, UpsertBillingDto } from \"../types\";\n\nexport class BillingResource {\n constructor(private http: HttpClient) {}\n\n get(): Promise<BillingResponseDto> {\n return this.http.get(\"/api/v1/billing\");\n }\n\n upsert(data: UpsertBillingDto): Promise<BillingResponseDto> {\n return this.http.put(\"/api/v1/billing\", data);\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n PreferenceResponseDto,\n UpdatePreferencesDto,\n} from \"../types\";\n\nexport class PreferencesResource {\n constructor(private http: HttpClient) {}\n\n getAll(): Promise<PreferenceResponseDto[]> {\n return this.http.get(\"/api/v1/preferences\");\n }\n\n getByAppKey(appKey: string): Promise<PreferenceResponseDto> {\n return this.http.get(`/api/v1/preferences/${appKey}`);\n }\n\n upsert(appKey: string, data: UpdatePreferencesDto): Promise<PreferenceResponseDto> {\n return this.http.put(`/api/v1/preferences/${appKey}`, data);\n }\n\n remove(appKey: string): Promise<void> {\n return this.http.delete(`/api/v1/preferences/${appKey}`);\n }\n\n merge(appKey: string, data: UpdatePreferencesDto): Promise<PreferenceResponseDto> {\n return this.http.patch(`/api/v1/preferences/${appKey}`, data);\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n CreateConversationDto,\n ConversationResponseDto,\n ConversationMessageResponseDto,\n AddMessageDto,\n ConversationStatus,\n} from \"../types\";\n\nexport class ConversationsResource {\n constructor(private http: HttpClient) {}\n\n create(data: CreateConversationDto): Promise<ConversationResponseDto> {\n return this.http.post(\"/api/v1/conversations\", data);\n }\n\n list(query?: {\n cursor?: string;\n limit?: number;\n status?: ConversationStatus;\n appKey?: string;\n }): Promise<ConversationResponseDto[]> {\n return this.http.get(\"/api/v1/conversations\", { query });\n }\n\n get(id: string): Promise<ConversationResponseDto> {\n return this.http.get(`/api/v1/conversations/${id}`);\n }\n\n archive(id: string): Promise<ConversationResponseDto> {\n return this.http.patch(`/api/v1/conversations/${id}/archive`);\n }\n\n listMessages(conversationId: string, query?: {\n cursor?: string;\n limit?: number;\n }): Promise<ConversationMessageResponseDto[]> {\n return this.http.get(`/api/v1/conversations/${conversationId}/messages`, { query });\n }\n\n addMessage(conversationId: string, data: AddMessageDto): Promise<ConversationMessageResponseDto> {\n return this.http.post(`/api/v1/conversations/${conversationId}/messages`, data);\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type { GenerateDto } from \"../types\";\n\nexport interface GenerationDoneData {\n messageId: string;\n usage?: { inputTokens: number; outputTokens: number };\n structuredOutput?: Record<string, unknown>;\n}\n\nexport interface SseStreamOptions {\n onTextDelta?: (text: string) => void;\n onDone?: (data: GenerationDoneData) => void;\n onError?: (error: string) => void;\n signal?: AbortSignal;\n}\n\ntype SseEvent =\n | { type: \"text_delta\"; text: string }\n | { type: \"done\"; messageId: string; usage?: { inputTokens: number; outputTokens: number }; structuredOutput?: Record<string, unknown> }\n | { type: \"error\"; error: string };\n\nexport class GenerationResource {\n constructor(private http: HttpClient) {}\n\n async generate(conversationId: string, data: GenerateDto, options?: SseStreamOptions): Promise<string> {\n const response = await this.http.rawRequest(\"POST\", `/api/v1/conversations/${conversationId}/generate`, {\n body: data,\n });\n\n const reader = response.body?.getReader();\n if (!reader) throw new Error(\"No response body\");\n\n const decoder = new TextDecoder();\n const parts: string[] = [];\n let buffer = \"\";\n\n try {\n while (true) {\n if (options?.signal?.aborted) {\n reader.cancel();\n break;\n }\n\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split(\"\\n\");\n buffer = lines.pop() ?? \"\";\n\n for (const line of lines) {\n if (!line.startsWith(\"data: \")) continue;\n const jsonStr = line.slice(6).trim();\n if (!jsonStr) continue;\n\n let event: SseEvent;\n try {\n event = JSON.parse(jsonStr);\n } catch {\n continue;\n }\n\n if (event.type === \"text_delta\") {\n parts.push(event.text);\n options?.onTextDelta?.(event.text);\n } else if (event.type === \"done\") {\n options?.onDone?.(event);\n } else if (event.type === \"error\") {\n options?.onError?.(event.error);\n }\n }\n }\n } finally {\n reader.releaseLock();\n }\n\n return parts.join(\"\");\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n TriggerImageDto,\n ImageStatusResponseDto,\n} from \"../types\";\n\nexport class ImagesResource {\n constructor(private http: HttpClient) {}\n\n trigger(messageId: string, data: TriggerImageDto): Promise<ImageStatusResponseDto> {\n return this.http.post(`/api/v1/messages/${messageId}/images`, data);\n }\n\n getAll(messageId: string): Promise<ImageStatusResponseDto[]> {\n return this.http.get(`/api/v1/messages/${messageId}/images`);\n }\n\n getBySlot(messageId: string, slot: string): Promise<ImageStatusResponseDto> {\n return this.http.get(`/api/v1/messages/${messageId}/images/${slot}`);\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n CreateCheckoutDto,\n CreateCustomCheckoutDto,\n CheckoutResponseDto,\n CreditPricingResponseDto,\n} from \"../types\";\n\nexport class PaymentsResource {\n constructor(private http: HttpClient) {}\n\n checkout(data: CreateCheckoutDto): Promise<CheckoutResponseDto> {\n return this.http.post(\"/api/v1/payments/checkout\", data);\n }\n\n checkoutCustom(data: CreateCustomCheckoutDto): Promise<CheckoutResponseDto> {\n return this.http.post(\"/api/v1/payments/checkout/custom\", data);\n }\n\n creditPricing(): Promise<CreditPricingResponseDto> {\n return this.http.get(\"/api/v1/payments/credit-pricing\");\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type { TenantPublicInfoDto } from \"../types\";\n\nexport class TenantsResource {\n constructor(private http: HttpClient) {}\n\n getPublicInfo(tenantId: string): Promise<TenantPublicInfoDto> {\n return this.http.get(\"/api/v1/tenants/public-info\", {\n authenticated: false,\n query: { tenantId },\n });\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type { ReceiptItemDto } from \"../types\";\n\nexport class ReceiptsResource {\n constructor(private http: HttpClient) {}\n\n list(query?: { cursor?: string; limit?: number }): Promise<ReceiptItemDto[]> {\n return this.http.get(\"/api/v1/receipts\", { query });\n }\n\n async download(id: string): Promise<Blob> {\n const response = await this.http.rawRequest(\"GET\", `/api/v1/receipts/${id}/download`);\n return response.blob();\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type {\n EmailPreferencesResponseDto,\n UpdateEmailPreferencesDto,\n UpdateEmailPreferencesTokenDto,\n} from \"../types\";\n\nexport class EmailPreferencesResource {\n constructor(private http: HttpClient) {}\n\n /** Public, token-based: fetch subscription state via an unsubscribe link token. */\n getByToken(token: string): Promise<EmailPreferencesResponseDto> {\n return this.http.get(\"/api/v1/email-preferences\", {\n authenticated: false,\n query: { token },\n });\n }\n\n /** Public, token-based: update subscription state via an unsubscribe link token. */\n updateByToken(data: UpdateEmailPreferencesTokenDto): Promise<EmailPreferencesResponseDto> {\n return this.http.patch(\"/api/v1/email-preferences\", data, { authenticated: false });\n }\n\n /** Authenticated: fetch the current user's subscription state. */\n getMine(): Promise<EmailPreferencesResponseDto> {\n return this.http.get(\"/api/v1/email-preferences/me\");\n }\n\n /** Authenticated: update the current user's subscription state. */\n updateMine(data: UpdateEmailPreferencesDto): Promise<EmailPreferencesResponseDto> {\n return this.http.patch(\"/api/v1/email-preferences/me\", data);\n }\n}\n","import type { HttpClient } from \"../http\";\nimport type { ContactDto, MessageResponseDto } from \"../types\";\n\nexport class ContactResource {\n constructor(private http: HttpClient) {}\n\n /** Send a contact-form message to the tenant's contact inbox. Public — no auth required. */\n send(data: ContactDto): Promise<MessageResponseDto> {\n return this.http.post(\"/api/v1/contact\", data, { authenticated: false });\n }\n}\n","import { HttpClient } from \"./http\";\nimport type { TokensResponseDto, PingResponseDto } from \"./types\";\nimport { AuthResource } from \"./resources/auth\";\nimport { PlansResource } from \"./resources/plans\";\nimport { CreditsResource } from \"./resources/credits\";\nimport { BillingResource } from \"./resources/billing\";\nimport { PreferencesResource } from \"./resources/preferences\";\nimport { ConversationsResource } from \"./resources/conversations\";\nimport { GenerationResource } from \"./resources/generation\";\nimport { ImagesResource } from \"./resources/images\";\nimport { PaymentsResource } from \"./resources/payments\";\nimport { TenantsResource } from \"./resources/tenants\";\nimport { ReceiptsResource } from \"./resources/receipts\";\nimport { EmailPreferencesResource } from \"./resources/email-preferences\";\nimport { ContactResource } from \"./resources/contact\";\n\nexport interface ClientOptions {\n baseUrl: string;\n tenantKey: string;\n accessToken?: string;\n refreshToken?: string;\n onTokenRefreshed?: (tokens: TokensResponseDto) => void | Promise<void>;\n fetch?: typeof globalThis.fetch;\n}\n\nexport interface AiAssistantsClient {\n auth: AuthResource;\n plans: PlansResource;\n credits: CreditsResource;\n billing: BillingResource;\n preferences: PreferencesResource;\n conversations: ConversationsResource;\n generation: GenerationResource;\n images: ImagesResource;\n payments: PaymentsResource;\n tenants: TenantsResource;\n receipts: ReceiptsResource;\n emailPreferences: EmailPreferencesResource;\n contact: ContactResource;\n /**\n * Verify the client is configured correctly: confirms the base URL is\n * reachable and the tenant key is valid. Resolves with the tenant identity\n * when the SDK is ready to use, and rejects with an {@link ApiError} otherwise.\n */\n ping(): Promise<PingResponseDto>;\n setAccessToken(token: string): void;\n setRefreshToken(token: string): void;\n}\n\nexport function createClient(options: ClientOptions): AiAssistantsClient {\n let accessToken = options.accessToken ?? null;\n let refreshToken = options.refreshToken ?? null;\n\n const http = new HttpClient({\n baseUrl: options.baseUrl,\n tenantKey: options.tenantKey,\n fetch: options.fetch,\n getAccessToken: () => accessToken,\n getRefreshToken: () => refreshToken,\n onTokenRefreshed: async (tokens) => {\n accessToken = tokens.accessToken;\n refreshToken = tokens.refreshToken;\n await options.onTokenRefreshed?.(tokens);\n },\n });\n\n return {\n auth: new AuthResource(http),\n plans: new PlansResource(http),\n credits: new CreditsResource(http),\n billing: new BillingResource(http),\n preferences: new PreferencesResource(http),\n conversations: new ConversationsResource(http),\n generation: new GenerationResource(http),\n images: new ImagesResource(http),\n payments: new PaymentsResource(http),\n tenants: new TenantsResource(http),\n receipts: new ReceiptsResource(http),\n emailPreferences: new EmailPreferencesResource(http),\n contact: new ContactResource(http),\n ping() {\n return http.get<PingResponseDto>(\"/api/v1/ping\", { authenticated: false });\n },\n setAccessToken(token: string) {\n accessToken = token;\n },\n setRefreshToken(token: string) {\n refreshToken = token;\n },\n };\n}\n"],"mappings":";AAAO,IAAM,WAAN,cAAuB,MAAM;AAAA,EAClC,YACkB,YACA,MAChB,SACgB,WAChB;AACA,UAAM,MAAM,QAAQ,OAAO,IAAI,QAAQ,KAAK,IAAI,IAAI,OAAO;AAL3C;AACA;AAEA;AAGhB,SAAK,OAAO;AAAA,EACd;AACF;;;ACcO,IAAM,aAAN,MAAiB;AAAA,EAKtB,YAAoB,QAA0B;AAA1B;AAJpB,SAAQ,iBAA0C;AAKhD,SAAK,UAAU,IAAI,IAAI,OAAO,OAAO;AACrC,SAAK,UAAU,OAAO,SAAS,WAAW;AAAA,EAC5C;AAAA,EAEQ,cACN,QACA,MACA,UAA0B,CAAC,GACR;AACnB,UAAM,EAAE,MAAM,OAAO,gBAAgB,KAAK,IAAI;AAE9C,UAAM,MAAM,IAAI,IAAI,MAAM,KAAK,OAAO;AACtC,QAAI,OAAO;AACT,iBAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,KAAK,GAAG;AAChD,YAAI,UAAU,UAAa,UAAU,MAAM;AACzC,cAAI,aAAa,IAAI,KAAK,OAAO,KAAK,CAAC;AAAA,QACzC;AAAA,MACF;AAAA,IACF;AAEA,UAAM,UAAkC;AAAA,MACtC,gBAAgB,KAAK,OAAO;AAAA,IAC9B;AACA,QAAI,SAAS,QAAW;AACtB,cAAQ,cAAc,IAAI;AAAA,IAC5B;A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