@dotbots-boutique/auth-sdk 1.0.18 → 1.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +55 -3
- package/dist/cjs/react/index.js +1 -1
- package/dist/esm/index.js +55 -3
- package/dist/esm/react/index.js +1 -1
- package/dist/types/DotBotsAuth.d.ts +5 -2
- package/dist/types/index.js +55 -3
- package/dist/types/react/DotBotsAuthProvider.d.ts +1 -1
- package/dist/types/react/index.js +1 -1
- package/dist/types/types.d.ts +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -258,10 +258,17 @@ class DotBotsAuth {
|
|
|
258
258
|
this.cachedUser = null;
|
|
259
259
|
this.initialized = false;
|
|
260
260
|
this.initializePromise = null;
|
|
261
|
+
// Original console methods stored for restore
|
|
262
|
+
this._console = {
|
|
263
|
+
log: console.log.bind(console),
|
|
264
|
+
info: console.info.bind(console),
|
|
265
|
+
warn: console.warn.bind(console),
|
|
266
|
+
error: console.error.bind(console),
|
|
267
|
+
};
|
|
261
268
|
this.config = config;
|
|
262
269
|
this.environment = this.detectEnvironment();
|
|
263
|
-
console.warn(`[DotBotsAuth] SDK v${DotBotsAuth.SDK_VERSION} — env: ${this.environment}, appId: ${config.appId}`);
|
|
264
270
|
this.marketplaceOrigin = config.marketplaceOrigin ?? 'https://dotbots.boutique';
|
|
271
|
+
console.warn(`[DotBotsAuth] SDK v${DotBotsAuth.SDK_VERSION} — env: ${this.environment}, appId: ${config.appId}`);
|
|
265
272
|
this.tokenManager = new TokenManager(config, this.environment, () => this.emit('tokenRefreshed'), () => this.emit('sessionExpired'), () => this.proxyConfigManager.getBaseUrl());
|
|
266
273
|
this.postMessageHandler = new PostMessageHandler(this.marketplaceOrigin);
|
|
267
274
|
this.proxyConfigManager = new ProxyConfigManager(config.apiUrl, config.appId, this.environment);
|
|
@@ -284,6 +291,10 @@ class DotBotsAuth {
|
|
|
284
291
|
await this.initializeStandalone();
|
|
285
292
|
}
|
|
286
293
|
this.initialized = true;
|
|
294
|
+
// Step 3 — Forward console output to marketplace when in iframe
|
|
295
|
+
if (this.postMessageHandler.isInIframe()) {
|
|
296
|
+
this.interceptConsole();
|
|
297
|
+
}
|
|
287
298
|
// Listen for user switch (new auth code from marketplace after init)
|
|
288
299
|
window.addEventListener('message', async (event) => {
|
|
289
300
|
if (event.origin !== this.marketplaceOrigin)
|
|
@@ -382,8 +393,14 @@ class DotBotsAuth {
|
|
|
382
393
|
this.emit('charged');
|
|
383
394
|
return data;
|
|
384
395
|
}
|
|
385
|
-
async ai(feature, request) {
|
|
396
|
+
async ai(feature, request, onDelta) {
|
|
386
397
|
this.assertInitialized();
|
|
398
|
+
const stream = onDelta !== undefined;
|
|
399
|
+
if (stream) {
|
|
400
|
+
return new Promise((resolve, reject) => {
|
|
401
|
+
this.aiStream(feature, request, onDelta, resolve).catch(reject);
|
|
402
|
+
});
|
|
403
|
+
}
|
|
387
404
|
const baseUrl = this.proxyConfigManager.getBaseUrl();
|
|
388
405
|
console.warn(`[DotBotsAuth] ai() — feature: ${feature}, messages: ${request.messages.length}`);
|
|
389
406
|
const response = await this.buildRequest(`${baseUrl}/ai/call`, {
|
|
@@ -489,6 +506,12 @@ class DotBotsAuth {
|
|
|
489
506
|
window.location.href = `${this.config.apiUrl}/api/auth/logout?redirectUri=${redirectUri}`;
|
|
490
507
|
}
|
|
491
508
|
}
|
|
509
|
+
destroy() {
|
|
510
|
+
console.log = this._console.log;
|
|
511
|
+
console.info = this._console.info;
|
|
512
|
+
console.warn = this._console.warn;
|
|
513
|
+
console.error = this._console.error;
|
|
514
|
+
}
|
|
492
515
|
on(event, handler) {
|
|
493
516
|
if (!this.listeners.has(event)) {
|
|
494
517
|
this.listeners.set(event, new Set());
|
|
@@ -537,6 +560,35 @@ class DotBotsAuth {
|
|
|
537
560
|
window.location.href = `${this.config.apiUrl}/api/auth/authorize?appId=${this.config.appId}&redirectUri=${redirectUri}`;
|
|
538
561
|
}
|
|
539
562
|
}
|
|
563
|
+
interceptConsole() {
|
|
564
|
+
const appId = this.config.appId;
|
|
565
|
+
const forward = (level, original) => {
|
|
566
|
+
return (...args) => {
|
|
567
|
+
original(...args);
|
|
568
|
+
window.parent.postMessage({
|
|
569
|
+
type: 'DOTBOTS_LOG',
|
|
570
|
+
level,
|
|
571
|
+
message: args.map(a => {
|
|
572
|
+
if (typeof a === 'object' && a !== null) {
|
|
573
|
+
try {
|
|
574
|
+
return JSON.stringify(a);
|
|
575
|
+
}
|
|
576
|
+
catch {
|
|
577
|
+
return String(a);
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
return String(a);
|
|
581
|
+
}).join(' '),
|
|
582
|
+
timestamp: new Date().toISOString(),
|
|
583
|
+
appId,
|
|
584
|
+
}, '*');
|
|
585
|
+
};
|
|
586
|
+
};
|
|
587
|
+
console.log = forward('info', this._console.log);
|
|
588
|
+
console.info = forward('info', this._console.info);
|
|
589
|
+
console.warn = forward('warn', this._console.warn);
|
|
590
|
+
console.error = forward('error', this._console.error);
|
|
591
|
+
}
|
|
540
592
|
async buildRequest(url, options) {
|
|
541
593
|
const headers = new Headers(options?.headers);
|
|
542
594
|
const accessToken = this.tokenManager.getAccessToken();
|
|
@@ -566,7 +618,7 @@ class DotBotsAuth {
|
|
|
566
618
|
}
|
|
567
619
|
}
|
|
568
620
|
}
|
|
569
|
-
DotBotsAuth.SDK_VERSION = '1.0.
|
|
621
|
+
DotBotsAuth.SDK_VERSION = '1.0.20';
|
|
570
622
|
|
|
571
623
|
exports.DotBotsAuth = DotBotsAuth;
|
|
572
624
|
exports.DotBotsAuthError = DotBotsAuthError;
|
package/dist/cjs/react/index.js
CHANGED
|
@@ -59,7 +59,7 @@ function DotBotsAuthProvider({ auth, children, loadingComponent, errorComponent,
|
|
|
59
59
|
hasRole: (role) => auth.hasRole(role),
|
|
60
60
|
fetch: (url, options) => auth.fetch(url, options),
|
|
61
61
|
charge: (featureCode, paidBy, quantity) => auth.charge(featureCode, paidBy, quantity),
|
|
62
|
-
ai: (feature, request) => auth.ai(feature, request),
|
|
62
|
+
ai: (feature, request, onDelta) => auth.ai(feature, request, onDelta),
|
|
63
63
|
aiStream: (feature, request, onDelta, onDone) => auth.aiStream(feature, request, onDelta, onDone),
|
|
64
64
|
logout: () => auth.logout(),
|
|
65
65
|
};
|
package/dist/esm/index.js
CHANGED
|
@@ -256,10 +256,17 @@ class DotBotsAuth {
|
|
|
256
256
|
this.cachedUser = null;
|
|
257
257
|
this.initialized = false;
|
|
258
258
|
this.initializePromise = null;
|
|
259
|
+
// Original console methods stored for restore
|
|
260
|
+
this._console = {
|
|
261
|
+
log: console.log.bind(console),
|
|
262
|
+
info: console.info.bind(console),
|
|
263
|
+
warn: console.warn.bind(console),
|
|
264
|
+
error: console.error.bind(console),
|
|
265
|
+
};
|
|
259
266
|
this.config = config;
|
|
260
267
|
this.environment = this.detectEnvironment();
|
|
261
|
-
console.warn(`[DotBotsAuth] SDK v${DotBotsAuth.SDK_VERSION} — env: ${this.environment}, appId: ${config.appId}`);
|
|
262
268
|
this.marketplaceOrigin = config.marketplaceOrigin ?? 'https://dotbots.boutique';
|
|
269
|
+
console.warn(`[DotBotsAuth] SDK v${DotBotsAuth.SDK_VERSION} — env: ${this.environment}, appId: ${config.appId}`);
|
|
263
270
|
this.tokenManager = new TokenManager(config, this.environment, () => this.emit('tokenRefreshed'), () => this.emit('sessionExpired'), () => this.proxyConfigManager.getBaseUrl());
|
|
264
271
|
this.postMessageHandler = new PostMessageHandler(this.marketplaceOrigin);
|
|
265
272
|
this.proxyConfigManager = new ProxyConfigManager(config.apiUrl, config.appId, this.environment);
|
|
@@ -282,6 +289,10 @@ class DotBotsAuth {
|
|
|
282
289
|
await this.initializeStandalone();
|
|
283
290
|
}
|
|
284
291
|
this.initialized = true;
|
|
292
|
+
// Step 3 — Forward console output to marketplace when in iframe
|
|
293
|
+
if (this.postMessageHandler.isInIframe()) {
|
|
294
|
+
this.interceptConsole();
|
|
295
|
+
}
|
|
285
296
|
// Listen for user switch (new auth code from marketplace after init)
|
|
286
297
|
window.addEventListener('message', async (event) => {
|
|
287
298
|
if (event.origin !== this.marketplaceOrigin)
|
|
@@ -380,8 +391,14 @@ class DotBotsAuth {
|
|
|
380
391
|
this.emit('charged');
|
|
381
392
|
return data;
|
|
382
393
|
}
|
|
383
|
-
async ai(feature, request) {
|
|
394
|
+
async ai(feature, request, onDelta) {
|
|
384
395
|
this.assertInitialized();
|
|
396
|
+
const stream = onDelta !== undefined;
|
|
397
|
+
if (stream) {
|
|
398
|
+
return new Promise((resolve, reject) => {
|
|
399
|
+
this.aiStream(feature, request, onDelta, resolve).catch(reject);
|
|
400
|
+
});
|
|
401
|
+
}
|
|
385
402
|
const baseUrl = this.proxyConfigManager.getBaseUrl();
|
|
386
403
|
console.warn(`[DotBotsAuth] ai() — feature: ${feature}, messages: ${request.messages.length}`);
|
|
387
404
|
const response = await this.buildRequest(`${baseUrl}/ai/call`, {
|
|
@@ -487,6 +504,12 @@ class DotBotsAuth {
|
|
|
487
504
|
window.location.href = `${this.config.apiUrl}/api/auth/logout?redirectUri=${redirectUri}`;
|
|
488
505
|
}
|
|
489
506
|
}
|
|
507
|
+
destroy() {
|
|
508
|
+
console.log = this._console.log;
|
|
509
|
+
console.info = this._console.info;
|
|
510
|
+
console.warn = this._console.warn;
|
|
511
|
+
console.error = this._console.error;
|
|
512
|
+
}
|
|
490
513
|
on(event, handler) {
|
|
491
514
|
if (!this.listeners.has(event)) {
|
|
492
515
|
this.listeners.set(event, new Set());
|
|
@@ -535,6 +558,35 @@ class DotBotsAuth {
|
|
|
535
558
|
window.location.href = `${this.config.apiUrl}/api/auth/authorize?appId=${this.config.appId}&redirectUri=${redirectUri}`;
|
|
536
559
|
}
|
|
537
560
|
}
|
|
561
|
+
interceptConsole() {
|
|
562
|
+
const appId = this.config.appId;
|
|
563
|
+
const forward = (level, original) => {
|
|
564
|
+
return (...args) => {
|
|
565
|
+
original(...args);
|
|
566
|
+
window.parent.postMessage({
|
|
567
|
+
type: 'DOTBOTS_LOG',
|
|
568
|
+
level,
|
|
569
|
+
message: args.map(a => {
|
|
570
|
+
if (typeof a === 'object' && a !== null) {
|
|
571
|
+
try {
|
|
572
|
+
return JSON.stringify(a);
|
|
573
|
+
}
|
|
574
|
+
catch {
|
|
575
|
+
return String(a);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
return String(a);
|
|
579
|
+
}).join(' '),
|
|
580
|
+
timestamp: new Date().toISOString(),
|
|
581
|
+
appId,
|
|
582
|
+
}, '*');
|
|
583
|
+
};
|
|
584
|
+
};
|
|
585
|
+
console.log = forward('info', this._console.log);
|
|
586
|
+
console.info = forward('info', this._console.info);
|
|
587
|
+
console.warn = forward('warn', this._console.warn);
|
|
588
|
+
console.error = forward('error', this._console.error);
|
|
589
|
+
}
|
|
538
590
|
async buildRequest(url, options) {
|
|
539
591
|
const headers = new Headers(options?.headers);
|
|
540
592
|
const accessToken = this.tokenManager.getAccessToken();
|
|
@@ -564,6 +616,6 @@ class DotBotsAuth {
|
|
|
564
616
|
}
|
|
565
617
|
}
|
|
566
618
|
}
|
|
567
|
-
DotBotsAuth.SDK_VERSION = '1.0.
|
|
619
|
+
DotBotsAuth.SDK_VERSION = '1.0.20';
|
|
568
620
|
|
|
569
621
|
export { DotBotsAuth, DotBotsAuthError };
|
package/dist/esm/react/index.js
CHANGED
|
@@ -57,7 +57,7 @@ function DotBotsAuthProvider({ auth, children, loadingComponent, errorComponent,
|
|
|
57
57
|
hasRole: (role) => auth.hasRole(role),
|
|
58
58
|
fetch: (url, options) => auth.fetch(url, options),
|
|
59
59
|
charge: (featureCode, paidBy, quantity) => auth.charge(featureCode, paidBy, quantity),
|
|
60
|
-
ai: (feature, request) => auth.ai(feature, request),
|
|
60
|
+
ai: (feature, request, onDelta) => auth.ai(feature, request, onDelta),
|
|
61
61
|
aiStream: (feature, request, onDelta, onDone) => auth.aiStream(feature, request, onDelta, onDone),
|
|
62
62
|
logout: () => auth.logout(),
|
|
63
63
|
};
|
|
@@ -10,7 +10,8 @@ export declare class DotBotsAuth {
|
|
|
10
10
|
private cachedUser;
|
|
11
11
|
private initialized;
|
|
12
12
|
private initializePromise;
|
|
13
|
-
|
|
13
|
+
private readonly _console;
|
|
14
|
+
static readonly SDK_VERSION = "1.0.20";
|
|
14
15
|
constructor(config: DotBotsConfig);
|
|
15
16
|
initialize(): Promise<void>;
|
|
16
17
|
private _doInitialize;
|
|
@@ -23,9 +24,10 @@ export declare class DotBotsAuth {
|
|
|
23
24
|
charge(featureCode: string, paidBy: 'org' | 'app', quantity?: number): Promise<{
|
|
24
25
|
transactionId: string;
|
|
25
26
|
}>;
|
|
26
|
-
ai(feature: string, request: AiRequest): Promise<AiResponse>;
|
|
27
|
+
ai(feature: string, request: AiRequest, onDelta?: (delta: string) => void): Promise<AiResponse>;
|
|
27
28
|
aiStream(feature: string, request: AiRequest, onDelta: (delta: string) => void, onDone?: (response: AiResponse) => void): Promise<void>;
|
|
28
29
|
logout(): Promise<void>;
|
|
30
|
+
destroy(): void;
|
|
29
31
|
on(event: DotBotsAuthEvent, handler: Function): void;
|
|
30
32
|
off(event: DotBotsAuthEvent, handler: Function): void;
|
|
31
33
|
/**
|
|
@@ -35,6 +37,7 @@ export declare class DotBotsAuth {
|
|
|
35
37
|
private detectEnvironment;
|
|
36
38
|
private initializeIframe;
|
|
37
39
|
private initializeStandalone;
|
|
40
|
+
private interceptConsole;
|
|
38
41
|
private buildRequest;
|
|
39
42
|
private assertInitialized;
|
|
40
43
|
private emit;
|
package/dist/types/index.js
CHANGED
|
@@ -256,10 +256,17 @@ class DotBotsAuth {
|
|
|
256
256
|
this.cachedUser = null;
|
|
257
257
|
this.initialized = false;
|
|
258
258
|
this.initializePromise = null;
|
|
259
|
+
// Original console methods stored for restore
|
|
260
|
+
this._console = {
|
|
261
|
+
log: console.log.bind(console),
|
|
262
|
+
info: console.info.bind(console),
|
|
263
|
+
warn: console.warn.bind(console),
|
|
264
|
+
error: console.error.bind(console),
|
|
265
|
+
};
|
|
259
266
|
this.config = config;
|
|
260
267
|
this.environment = this.detectEnvironment();
|
|
261
|
-
console.warn(`[DotBotsAuth] SDK v${DotBotsAuth.SDK_VERSION} — env: ${this.environment}, appId: ${config.appId}`);
|
|
262
268
|
this.marketplaceOrigin = config.marketplaceOrigin ?? 'https://dotbots.boutique';
|
|
269
|
+
console.warn(`[DotBotsAuth] SDK v${DotBotsAuth.SDK_VERSION} — env: ${this.environment}, appId: ${config.appId}`);
|
|
263
270
|
this.tokenManager = new TokenManager(config, this.environment, () => this.emit('tokenRefreshed'), () => this.emit('sessionExpired'), () => this.proxyConfigManager.getBaseUrl());
|
|
264
271
|
this.postMessageHandler = new PostMessageHandler(this.marketplaceOrigin);
|
|
265
272
|
this.proxyConfigManager = new ProxyConfigManager(config.apiUrl, config.appId, this.environment);
|
|
@@ -282,6 +289,10 @@ class DotBotsAuth {
|
|
|
282
289
|
await this.initializeStandalone();
|
|
283
290
|
}
|
|
284
291
|
this.initialized = true;
|
|
292
|
+
// Step 3 — Forward console output to marketplace when in iframe
|
|
293
|
+
if (this.postMessageHandler.isInIframe()) {
|
|
294
|
+
this.interceptConsole();
|
|
295
|
+
}
|
|
285
296
|
// Listen for user switch (new auth code from marketplace after init)
|
|
286
297
|
window.addEventListener('message', async (event) => {
|
|
287
298
|
if (event.origin !== this.marketplaceOrigin)
|
|
@@ -380,8 +391,14 @@ class DotBotsAuth {
|
|
|
380
391
|
this.emit('charged');
|
|
381
392
|
return data;
|
|
382
393
|
}
|
|
383
|
-
async ai(feature, request) {
|
|
394
|
+
async ai(feature, request, onDelta) {
|
|
384
395
|
this.assertInitialized();
|
|
396
|
+
const stream = onDelta !== undefined;
|
|
397
|
+
if (stream) {
|
|
398
|
+
return new Promise((resolve, reject) => {
|
|
399
|
+
this.aiStream(feature, request, onDelta, resolve).catch(reject);
|
|
400
|
+
});
|
|
401
|
+
}
|
|
385
402
|
const baseUrl = this.proxyConfigManager.getBaseUrl();
|
|
386
403
|
console.warn(`[DotBotsAuth] ai() — feature: ${feature}, messages: ${request.messages.length}`);
|
|
387
404
|
const response = await this.buildRequest(`${baseUrl}/ai/call`, {
|
|
@@ -487,6 +504,12 @@ class DotBotsAuth {
|
|
|
487
504
|
window.location.href = `${this.config.apiUrl}/api/auth/logout?redirectUri=${redirectUri}`;
|
|
488
505
|
}
|
|
489
506
|
}
|
|
507
|
+
destroy() {
|
|
508
|
+
console.log = this._console.log;
|
|
509
|
+
console.info = this._console.info;
|
|
510
|
+
console.warn = this._console.warn;
|
|
511
|
+
console.error = this._console.error;
|
|
512
|
+
}
|
|
490
513
|
on(event, handler) {
|
|
491
514
|
if (!this.listeners.has(event)) {
|
|
492
515
|
this.listeners.set(event, new Set());
|
|
@@ -535,6 +558,35 @@ class DotBotsAuth {
|
|
|
535
558
|
window.location.href = `${this.config.apiUrl}/api/auth/authorize?appId=${this.config.appId}&redirectUri=${redirectUri}`;
|
|
536
559
|
}
|
|
537
560
|
}
|
|
561
|
+
interceptConsole() {
|
|
562
|
+
const appId = this.config.appId;
|
|
563
|
+
const forward = (level, original) => {
|
|
564
|
+
return (...args) => {
|
|
565
|
+
original(...args);
|
|
566
|
+
window.parent.postMessage({
|
|
567
|
+
type: 'DOTBOTS_LOG',
|
|
568
|
+
level,
|
|
569
|
+
message: args.map(a => {
|
|
570
|
+
if (typeof a === 'object' && a !== null) {
|
|
571
|
+
try {
|
|
572
|
+
return JSON.stringify(a);
|
|
573
|
+
}
|
|
574
|
+
catch {
|
|
575
|
+
return String(a);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
return String(a);
|
|
579
|
+
}).join(' '),
|
|
580
|
+
timestamp: new Date().toISOString(),
|
|
581
|
+
appId,
|
|
582
|
+
}, '*');
|
|
583
|
+
};
|
|
584
|
+
};
|
|
585
|
+
console.log = forward('info', this._console.log);
|
|
586
|
+
console.info = forward('info', this._console.info);
|
|
587
|
+
console.warn = forward('warn', this._console.warn);
|
|
588
|
+
console.error = forward('error', this._console.error);
|
|
589
|
+
}
|
|
538
590
|
async buildRequest(url, options) {
|
|
539
591
|
const headers = new Headers(options?.headers);
|
|
540
592
|
const accessToken = this.tokenManager.getAccessToken();
|
|
@@ -564,6 +616,6 @@ class DotBotsAuth {
|
|
|
564
616
|
}
|
|
565
617
|
}
|
|
566
618
|
}
|
|
567
|
-
DotBotsAuth.SDK_VERSION = '1.0.
|
|
619
|
+
DotBotsAuth.SDK_VERSION = '1.0.20';
|
|
568
620
|
|
|
569
621
|
export { DotBotsAuth, DotBotsAuthError };
|
|
@@ -14,7 +14,7 @@ export interface DotBotsAuthContextValue {
|
|
|
14
14
|
charge: (featureCode: string, paidBy: 'org' | 'app', quantity?: number) => Promise<{
|
|
15
15
|
transactionId: string;
|
|
16
16
|
}>;
|
|
17
|
-
ai: (feature: string, request: AiRequest) => Promise<AiResponse>;
|
|
17
|
+
ai: (feature: string, request: AiRequest, onDelta?: (delta: string) => void) => Promise<AiResponse>;
|
|
18
18
|
aiStream: (feature: string, request: AiRequest, onDelta: (delta: string) => void, onDone?: (response: AiResponse) => void) => Promise<void>;
|
|
19
19
|
logout: () => Promise<void>;
|
|
20
20
|
}
|
|
@@ -57,7 +57,7 @@ function DotBotsAuthProvider({ auth, children, loadingComponent, errorComponent,
|
|
|
57
57
|
hasRole: (role) => auth.hasRole(role),
|
|
58
58
|
fetch: (url, options) => auth.fetch(url, options),
|
|
59
59
|
charge: (featureCode, paidBy, quantity) => auth.charge(featureCode, paidBy, quantity),
|
|
60
|
-
ai: (feature, request) => auth.ai(feature, request),
|
|
60
|
+
ai: (feature, request, onDelta) => auth.ai(feature, request, onDelta),
|
|
61
61
|
aiStream: (feature, request, onDelta, onDone) => auth.aiStream(feature, request, onDelta, onDone),
|
|
62
62
|
logout: () => auth.logout(),
|
|
63
63
|
};
|
package/dist/types/types.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ export interface DotBotsProxyConfig {
|
|
|
41
41
|
}
|
|
42
42
|
export type ProxyFeature = 'cache' | 'localdb' | 'webhooks' | 'ratelimit';
|
|
43
43
|
export type DotBotsAuthEvent = 'tokenRefreshed' | 'loggedOut' | 'sessionExpired' | 'userLoaded' | 'charged' | 'userChanged';
|
|
44
|
-
export type DotBotsAuthErrorCode = 'IFRAME_TIMEOUT' | 'CODE_EXPIRED' | 'UNAUTHORIZED' | 'REFRESH_FAILED' | 'NETWORK_ERROR' | 'NOT_INITIALIZED' | 'PROXY_UNAVAILABLE' | 'PAYMENT_FAILED' | 'AI_FEATURE_NOT_FOUND' | 'AI_PROVIDER_NOT_CONFIGURED' | 'AI_INSUFFICIENT_BALANCE' | 'AI_CALL_FAILED' | 'AI_STREAM_ERROR';
|
|
44
|
+
export type DotBotsAuthErrorCode = 'IFRAME_TIMEOUT' | 'CODE_EXPIRED' | 'UNAUTHORIZED' | 'REFRESH_FAILED' | 'NETWORK_ERROR' | 'NOT_INITIALIZED' | 'PROXY_UNAVAILABLE' | 'PAYMENT_FAILED' | 'AI_FEATURE_NOT_FOUND' | 'AI_PROVIDER_NOT_CONFIGURED' | 'AI_INSUFFICIENT_BALANCE' | 'AI_CALL_FAILED' | 'AI_CALL_TIMEOUT' | 'AI_STREAM_ERROR';
|
|
45
45
|
export interface TokenPair {
|
|
46
46
|
accessToken: string;
|
|
47
47
|
refreshToken: string;
|