@iblai/web-utils 0.2.1 → 1.0.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/README.md +504 -0
- package/dist/data-layer/src/features/chat-files/api-slice.d.ts +185 -0
- package/dist/data-layer/src/features/chat-files/types.d.ts +32 -0
- package/dist/data-layer/src/features/core/api-slice.d.ts +419 -61
- package/dist/data-layer/src/features/core/constants.d.ts +3 -0
- package/dist/data-layer/src/features/core/custom-api-slice.d.ts +50 -50
- package/dist/data-layer/src/features/core/custom-public-image-asset-api-slice.d.ts +333 -0
- package/dist/data-layer/src/features/core/types.d.ts +33 -0
- package/dist/data-layer/src/features/credentials/api-slice.d.ts +62 -39
- package/dist/data-layer/src/features/mentor/api-slice.d.ts +980 -188
- package/dist/data-layer/src/features/notifications/constants.d.ts +6 -0
- package/dist/data-layer/src/features/notifications/custom-api-slice.d.ts +43 -43
- package/dist/data-layer/src/features/notifications/types.d.ts +25 -2
- package/dist/data-layer/src/index.d.ts +3 -0
- package/dist/index.d.ts +425 -66
- package/dist/index.esm.js +999 -109
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1030 -107
- package/dist/index.js.map +1 -1
- package/dist/package.json +4 -2
- package/dist/web-utils/src/constants/chat.d.ts +8 -0
- package/dist/web-utils/src/features/files/filesSlice.d.ts +20 -0
- package/dist/web-utils/src/features/index.d.ts +1 -0
- package/dist/web-utils/src/hooks/chat/use-advanced-chat.d.ts +6 -4
- package/dist/web-utils/src/hooks/chat/use-chat-v2.d.ts +11 -1
- package/dist/web-utils/src/index.d.ts +2 -0
- package/dist/web-utils/src/index.web.d.ts +14 -12
- package/dist/web-utils/src/providers/auth-provider.d.ts +9 -1
- package/dist/web-utils/src/providers/tenant-provider.d.ts +2 -1
- package/dist/web-utils/src/services/__tests__/file-upload.test.d.ts +1 -0
- package/dist/web-utils/src/services/file-upload.d.ts +60 -0
- package/dist/web-utils/src/services/index.d.ts +1 -0
- package/dist/web-utils/src/types/file-upload.d.ts +62 -0
- package/dist/web-utils/src/types/index.d.ts +1 -0
- package/dist/web-utils/src/utils/auth.d.ts +180 -0
- package/dist/web-utils/src/utils/index.d.ts +1 -0
- package/dist/web-utils/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FreeUsageCount, StripeCustomerPortalRequest } from '@iblai/iblai-api';
|
|
2
|
-
import { StripeContextResponse, UploadProfileImageResponse, RemoveProfileImageResponse, StorageService, TokenResponse } from '@iblai/data-layer';
|
|
2
|
+
import { StripeContextResponse, UploadProfileImageResponse, RemoveProfileImageResponse, StorageService, TokenResponse, FileUploadURLResponse } from '@iblai/data-layer';
|
|
3
3
|
import * as React$1 from 'react';
|
|
4
4
|
import React__default from 'react';
|
|
5
5
|
import { PricingModalData as PricingModalData$1 } from '@web-utils/types/subscription';
|
|
@@ -7,6 +7,7 @@ import { OpUnitType } from 'dayjs';
|
|
|
7
7
|
import duration from 'dayjs/plugin/duration';
|
|
8
8
|
import { ChatStatus as ChatStatus$1 } from '@web-utils/features';
|
|
9
9
|
import * as _reduxjs_toolkit from '@reduxjs/toolkit';
|
|
10
|
+
import { Slice } from '@reduxjs/toolkit';
|
|
10
11
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
11
12
|
import { Tenant as Tenant$3 } from '@web-utils/types';
|
|
12
13
|
import { z } from 'zod';
|
|
@@ -317,12 +318,82 @@ declare const advancedTabs: ("chat" | "summarize" | "translate" | "expand")[];
|
|
|
317
318
|
type AdvancedTab = keyof typeof advancedTabsProperties;
|
|
318
319
|
declare const translatePrompt: (language: string) => string;
|
|
319
320
|
|
|
321
|
+
/**
|
|
322
|
+
* File reference sent via WebSocket to backend
|
|
323
|
+
* Backend uses this to retrieve file from S3
|
|
324
|
+
*/
|
|
325
|
+
interface FileReference {
|
|
326
|
+
/** Unique identifier for the ChatFile record */
|
|
327
|
+
file_id: string;
|
|
328
|
+
/** S3 object key for the uploaded file */
|
|
329
|
+
file_key: string;
|
|
330
|
+
/** Original filename */
|
|
331
|
+
file_name: string;
|
|
332
|
+
/** MIME type of the file */
|
|
333
|
+
content_type: string;
|
|
334
|
+
/** File size in bytes */
|
|
335
|
+
file_size: number;
|
|
336
|
+
/** Presigned URL for displaying the file (optional, for UI) */
|
|
337
|
+
upload_url?: string;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* File upload state for UI tracking
|
|
341
|
+
*/
|
|
342
|
+
interface FileUploadState {
|
|
343
|
+
/** Original File object */
|
|
344
|
+
file: File;
|
|
345
|
+
/** Upload/processing status */
|
|
346
|
+
status: "pending" | "uploading" | "processing" | "success" | "error";
|
|
347
|
+
/** Upload progress (0-100) */
|
|
348
|
+
progress: number;
|
|
349
|
+
/** File reference after successful upload */
|
|
350
|
+
fileReference?: FileReference;
|
|
351
|
+
/** Error message if upload failed */
|
|
352
|
+
error?: string;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* File processing event from WebSocket
|
|
356
|
+
*/
|
|
357
|
+
type FileProcessingEvent = {
|
|
358
|
+
type: "file_processing_progress";
|
|
359
|
+
file_name: string;
|
|
360
|
+
progress: string;
|
|
361
|
+
} | {
|
|
362
|
+
type: "file_processing_success";
|
|
363
|
+
file_name: string;
|
|
364
|
+
file_url: string;
|
|
365
|
+
} | {
|
|
366
|
+
type: "file_error";
|
|
367
|
+
file_name?: string;
|
|
368
|
+
error: string;
|
|
369
|
+
developer_error?: string;
|
|
370
|
+
};
|
|
371
|
+
/**
|
|
372
|
+
* Upload progress callback
|
|
373
|
+
*/
|
|
374
|
+
type UploadProgressCallback = (progress: number) => void;
|
|
375
|
+
/**
|
|
376
|
+
* File info extracted from File object
|
|
377
|
+
*/
|
|
378
|
+
interface FileInfo {
|
|
379
|
+
fileName: string;
|
|
380
|
+
contentType: string;
|
|
381
|
+
fileSize: number;
|
|
382
|
+
}
|
|
383
|
+
|
|
320
384
|
type MessageActionTypes = "redirectToAuthSpaJoinTenant";
|
|
321
385
|
interface MessageAction {
|
|
322
386
|
text: string;
|
|
323
387
|
type: "primary" | "danger";
|
|
324
388
|
actionType: MessageActionTypes;
|
|
325
389
|
}
|
|
390
|
+
interface FileAttachment {
|
|
391
|
+
fileName: string;
|
|
392
|
+
fileType: string;
|
|
393
|
+
fileSize: number;
|
|
394
|
+
uploadUrl?: string;
|
|
395
|
+
fileId?: string;
|
|
396
|
+
}
|
|
326
397
|
interface Message {
|
|
327
398
|
id: string;
|
|
328
399
|
role: "user" | "assistant" | "system";
|
|
@@ -333,9 +404,11 @@ interface Message {
|
|
|
333
404
|
contentType?: string;
|
|
334
405
|
visible: boolean;
|
|
335
406
|
actions?: MessageAction[];
|
|
407
|
+
fileAttachments?: FileAttachment[];
|
|
336
408
|
}
|
|
337
409
|
type SendMessageOptions = {
|
|
338
410
|
visible?: boolean;
|
|
411
|
+
fileReferences?: FileReference[];
|
|
339
412
|
} | undefined;
|
|
340
413
|
interface UseChatProps {
|
|
341
414
|
wsUrl: string;
|
|
@@ -353,7 +426,7 @@ interface UseChatProps {
|
|
|
353
426
|
hapticFeedback?: {
|
|
354
427
|
impactAsync: (style: any) => Promise<void>;
|
|
355
428
|
};
|
|
356
|
-
redirectToAuthSpa: () => void;
|
|
429
|
+
redirectToAuthSpa: (redirectTo?: string, platformKey?: string, logout?: boolean) => void;
|
|
357
430
|
store?: {
|
|
358
431
|
sendMessage?: (text: string) => Promise<void>;
|
|
359
432
|
};
|
|
@@ -429,6 +502,187 @@ declare const addProtocolToUrl: (url: string) => string;
|
|
|
429
502
|
declare function getTimeAgo(createdAt: string): string;
|
|
430
503
|
declare const formatRelativeTime: (timestamp: string) => string;
|
|
431
504
|
|
|
505
|
+
/**
|
|
506
|
+
* Authentication and Authorization Utilities
|
|
507
|
+
*
|
|
508
|
+
* This module provides utility functions for handling authentication flows,
|
|
509
|
+
* including redirects to auth SPA, cookie management, and session handling.
|
|
510
|
+
*/
|
|
511
|
+
/**
|
|
512
|
+
* Check if the current window is inside an iframe
|
|
513
|
+
* @returns {boolean} True if running in an iframe, false otherwise
|
|
514
|
+
*/
|
|
515
|
+
declare function isInIframe(): boolean;
|
|
516
|
+
/**
|
|
517
|
+
* Send a message to the parent website (when in iframe)
|
|
518
|
+
* @param payload - The data to send to parent window
|
|
519
|
+
*/
|
|
520
|
+
declare function sendMessageToParentWebsite(payload: unknown): void;
|
|
521
|
+
/**
|
|
522
|
+
* Delete a cookie with specific name, path, and domain
|
|
523
|
+
* @param name - Cookie name
|
|
524
|
+
* @param path - Cookie path
|
|
525
|
+
* @param domain - Cookie domain
|
|
526
|
+
*/
|
|
527
|
+
declare function deleteCookie(name: string, path: string, domain: string): void;
|
|
528
|
+
/**
|
|
529
|
+
* Get all possible domain parts for cookie deletion
|
|
530
|
+
* @param domain - The domain to split
|
|
531
|
+
* @returns Array of domain parts
|
|
532
|
+
* @example
|
|
533
|
+
* getDomainParts('app.example.com') // returns ['app.example.com', 'example.com', 'com']
|
|
534
|
+
*/
|
|
535
|
+
declare function getDomainParts(domain: string): string[];
|
|
536
|
+
/**
|
|
537
|
+
* Delete a cookie across all possible domain variations
|
|
538
|
+
* @param name - Cookie name to delete
|
|
539
|
+
* @param childDomain - The current domain
|
|
540
|
+
*/
|
|
541
|
+
declare function deleteCookieOnAllDomains(name: string, childDomain: string): void;
|
|
542
|
+
/**
|
|
543
|
+
* Get the parent domain from a given domain
|
|
544
|
+
* @param domain - The domain to process
|
|
545
|
+
* @returns The parent domain (e.g., 'app.example.com' → '.example.com')
|
|
546
|
+
*/
|
|
547
|
+
declare function getParentDomain(domain?: string): string;
|
|
548
|
+
/**
|
|
549
|
+
* Set a cookie for authentication with cross-domain support
|
|
550
|
+
* @param name - Cookie name
|
|
551
|
+
* @param value - Cookie value
|
|
552
|
+
* @param days - Number of days until expiration (default: 365)
|
|
553
|
+
*/
|
|
554
|
+
declare function setCookieForAuth(name: string, value: string, days?: number): void;
|
|
555
|
+
/**
|
|
556
|
+
* Clear all cookies for the current domain
|
|
557
|
+
*/
|
|
558
|
+
declare function clearCookies(): void;
|
|
559
|
+
/**
|
|
560
|
+
* Check if user is currently logged in
|
|
561
|
+
* @param tokenKey - The localStorage key for the auth token (default: 'axd_token')
|
|
562
|
+
* @returns True if logged in, false otherwise
|
|
563
|
+
*/
|
|
564
|
+
declare function isLoggedIn(tokenKey?: string): boolean;
|
|
565
|
+
/**
|
|
566
|
+
* Extract platform/tenant key from URL
|
|
567
|
+
* @param url - The URL to parse
|
|
568
|
+
* @param pattern - RegExp pattern to match platform key (default matches /platform/[key]/...)
|
|
569
|
+
* @returns The platform key or null if not found
|
|
570
|
+
*/
|
|
571
|
+
declare function getPlatformKey(url: string, pattern?: RegExp): string | null;
|
|
572
|
+
interface RedirectToAuthSpaOptions {
|
|
573
|
+
/** URL to redirect to after auth (defaults to current path + search) */
|
|
574
|
+
redirectTo?: string;
|
|
575
|
+
/** Platform/tenant key */
|
|
576
|
+
platformKey?: string;
|
|
577
|
+
/** Whether this is a logout action */
|
|
578
|
+
logout?: boolean;
|
|
579
|
+
/** Whether to save redirect path to localStorage (default: true) */
|
|
580
|
+
saveRedirect?: boolean;
|
|
581
|
+
/** Auth SPA base URL */
|
|
582
|
+
authUrl: string;
|
|
583
|
+
/** Current app/platform identifier (e.g., 'mentor', 'skills') */
|
|
584
|
+
appName: string;
|
|
585
|
+
/** Query param names */
|
|
586
|
+
queryParams?: {
|
|
587
|
+
app?: string;
|
|
588
|
+
redirectTo?: string;
|
|
589
|
+
tenant?: string;
|
|
590
|
+
};
|
|
591
|
+
/** localStorage key for saving redirect path */
|
|
592
|
+
redirectPathStorageKey?: string;
|
|
593
|
+
/** Cookie names for cross-SPA sync */
|
|
594
|
+
cookieNames?: {
|
|
595
|
+
currentTenant?: string;
|
|
596
|
+
userData?: string;
|
|
597
|
+
tenant?: string;
|
|
598
|
+
logoutTimestamp?: string;
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Redirect to authentication SPA for login/logout
|
|
603
|
+
*
|
|
604
|
+
* This function handles the complete authentication flow:
|
|
605
|
+
* - Clears localStorage and cookies on logout
|
|
606
|
+
* - Saves redirect path for post-auth return
|
|
607
|
+
* - Handles iframe scenarios
|
|
608
|
+
* - Syncs logout across multiple SPAs via cookies
|
|
609
|
+
*
|
|
610
|
+
* @param options - Configuration options for the redirect
|
|
611
|
+
*
|
|
612
|
+
* @example
|
|
613
|
+
* ```tsx
|
|
614
|
+
* // Basic usage
|
|
615
|
+
* redirectToAuthSpa({
|
|
616
|
+
* authUrl: 'https://auth.example.com',
|
|
617
|
+
* appName: 'mentor',
|
|
618
|
+
* });
|
|
619
|
+
*
|
|
620
|
+
* // With logout
|
|
621
|
+
* redirectToAuthSpa({
|
|
622
|
+
* authUrl: 'https://auth.example.com',
|
|
623
|
+
* appName: 'mentor',
|
|
624
|
+
* logout: true,
|
|
625
|
+
* platformKey: 'my-tenant',
|
|
626
|
+
* });
|
|
627
|
+
*
|
|
628
|
+
* // With custom redirect
|
|
629
|
+
* redirectToAuthSpa({
|
|
630
|
+
* authUrl: 'https://auth.example.com',
|
|
631
|
+
* appName: 'mentor',
|
|
632
|
+
* redirectTo: '/dashboard',
|
|
633
|
+
* platformKey: 'my-tenant',
|
|
634
|
+
* });
|
|
635
|
+
* ```
|
|
636
|
+
*/
|
|
637
|
+
declare function redirectToAuthSpa(options: RedirectToAuthSpaOptions): Promise<void>;
|
|
638
|
+
/**
|
|
639
|
+
* Get the URL for joining a tenant (sign up flow)
|
|
640
|
+
* @param authUrl - Auth SPA base URL
|
|
641
|
+
* @param tenantKey - Tenant to join
|
|
642
|
+
* @param redirectUrl - URL to redirect to after joining (defaults to current URL)
|
|
643
|
+
* @returns The join URL
|
|
644
|
+
*/
|
|
645
|
+
declare function getAuthSpaJoinUrl(authUrl: string, tenantKey?: string, redirectUrl?: string): string;
|
|
646
|
+
/**
|
|
647
|
+
* Redirect to auth SPA's join/signup page for a specific tenant
|
|
648
|
+
* @param authUrl - Auth SPA base URL
|
|
649
|
+
* @param tenantKey - Tenant to join
|
|
650
|
+
* @param redirectUrl - URL to redirect to after joining (defaults to current URL)
|
|
651
|
+
*/
|
|
652
|
+
declare function redirectToAuthSpaJoinTenant(authUrl: string, tenantKey?: string, redirectUrl?: string): void;
|
|
653
|
+
interface HandleLogoutOptions {
|
|
654
|
+
/** URL to redirect to after logout (defaults to current origin) */
|
|
655
|
+
redirectUrl?: string;
|
|
656
|
+
/** Auth SPA base URL */
|
|
657
|
+
authUrl: string;
|
|
658
|
+
/** localStorage key for tenant */
|
|
659
|
+
tenantStorageKey?: string;
|
|
660
|
+
/** Cookie name for logout timestamp */
|
|
661
|
+
logoutTimestampCookie?: string;
|
|
662
|
+
/** Callback to execute before logout */
|
|
663
|
+
callback?: () => void;
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* Handle user logout
|
|
667
|
+
*
|
|
668
|
+
* This function:
|
|
669
|
+
* - Clears localStorage (preserving tenant)
|
|
670
|
+
* - Sets logout timestamp cookie for cross-SPA sync
|
|
671
|
+
* - Clears all cookies
|
|
672
|
+
* - Redirects to auth SPA logout endpoint
|
|
673
|
+
*
|
|
674
|
+
* @param options - Logout configuration options
|
|
675
|
+
*
|
|
676
|
+
* @example
|
|
677
|
+
* ```tsx
|
|
678
|
+
* handleLogout({
|
|
679
|
+
* authUrl: 'https://auth.example.com',
|
|
680
|
+
* redirectUrl: 'https://app.example.com',
|
|
681
|
+
* });
|
|
682
|
+
* ```
|
|
683
|
+
*/
|
|
684
|
+
declare function handleLogout(options: HandleLogoutOptions): void;
|
|
685
|
+
|
|
432
686
|
type ChatState = Record<AdvancedTab, Message[]>;
|
|
433
687
|
interface SessionIds extends Record<AdvancedTab, string> {
|
|
434
688
|
}
|
|
@@ -530,6 +784,94 @@ declare const selectShowingSharedChat: (state: {
|
|
|
530
784
|
chatSliceShared: ChatSliceState;
|
|
531
785
|
}) => boolean;
|
|
532
786
|
|
|
787
|
+
interface TimeTrackerConfig {
|
|
788
|
+
intervalSeconds: number;
|
|
789
|
+
onTimeUpdate: (url: string, timeSpent: number) => void;
|
|
790
|
+
getCurrentUrl: () => string;
|
|
791
|
+
onRouteChange?: (callback: () => void) => () => void;
|
|
792
|
+
}
|
|
793
|
+
interface TimeTrackerState {
|
|
794
|
+
currentUrl: string;
|
|
795
|
+
startTime: number;
|
|
796
|
+
intervalId: number | null;
|
|
797
|
+
routeUnsubscribe: (() => void) | null;
|
|
798
|
+
}
|
|
799
|
+
declare class TimeTracker {
|
|
800
|
+
private state;
|
|
801
|
+
private config;
|
|
802
|
+
constructor(config: TimeTrackerConfig);
|
|
803
|
+
private initialize;
|
|
804
|
+
private startTracking;
|
|
805
|
+
private clearInterval;
|
|
806
|
+
private resetTimer;
|
|
807
|
+
private getTimeSpent;
|
|
808
|
+
private sendTimeUpdate;
|
|
809
|
+
private handleRouteChange;
|
|
810
|
+
pause(): void;
|
|
811
|
+
resume(): void;
|
|
812
|
+
destroy(): void;
|
|
813
|
+
getCurrentUrl(): string;
|
|
814
|
+
getTimeSpentSinceLastReset(): number;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
interface UseTimeTrackerConfig {
|
|
818
|
+
intervalSeconds: number;
|
|
819
|
+
onTimeUpdate: (url: string, timeSpent: number) => void;
|
|
820
|
+
enabled?: boolean;
|
|
821
|
+
getCurrentUrl?: () => string;
|
|
822
|
+
onRouteChange?: (callback: () => void) => () => void;
|
|
823
|
+
}
|
|
824
|
+
interface UseTimeTrackerReturn {
|
|
825
|
+
pause: () => void;
|
|
826
|
+
resume: () => void;
|
|
827
|
+
getCurrentUrl: () => string;
|
|
828
|
+
getTimeSpentSinceLastReset: () => number;
|
|
829
|
+
}
|
|
830
|
+
declare function useTimeTracker(config: UseTimeTrackerConfig): UseTimeTrackerReturn;
|
|
831
|
+
|
|
832
|
+
interface UseTimeTrackerNativeConfig {
|
|
833
|
+
intervalSeconds: number;
|
|
834
|
+
onTimeUpdate: (url: string, timeSpent: number) => void;
|
|
835
|
+
getCurrentRoute: () => string;
|
|
836
|
+
onRouteChange?: (callback: () => void) => () => void;
|
|
837
|
+
enabled?: boolean;
|
|
838
|
+
}
|
|
839
|
+
interface UseTimeTrackerNativeReturn {
|
|
840
|
+
pause: () => void;
|
|
841
|
+
resume: () => void;
|
|
842
|
+
getCurrentUrl: () => string;
|
|
843
|
+
getTimeSpentSinceLastReset: () => number;
|
|
844
|
+
}
|
|
845
|
+
declare function useTimeTrackerNative(config: UseTimeTrackerNativeConfig): UseTimeTrackerNativeReturn;
|
|
846
|
+
|
|
847
|
+
interface AttachedFile {
|
|
848
|
+
id: string;
|
|
849
|
+
fileName: string;
|
|
850
|
+
fileType: string;
|
|
851
|
+
fileSize: number;
|
|
852
|
+
uploadUrl: string;
|
|
853
|
+
uploadProgress: number;
|
|
854
|
+
uploadStatus: "pending" | "uploading" | "processing" | "success" | "error";
|
|
855
|
+
fileKey?: string;
|
|
856
|
+
fileId?: string;
|
|
857
|
+
retryCount?: number;
|
|
858
|
+
fileUrl?: string;
|
|
859
|
+
}
|
|
860
|
+
interface FilesState {
|
|
861
|
+
attachedFiles: AttachedFile[];
|
|
862
|
+
}
|
|
863
|
+
declare const filesSlice: Slice<FilesState>;
|
|
864
|
+
declare const addFiles: _reduxjs_toolkit.ActionCreatorWithoutPayload<`${string}/${string}`> | _reduxjs_toolkit.ActionCreatorWithPayload<any, `${string}/${string}`> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, never> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, any> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, never> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, any>;
|
|
865
|
+
declare const removeFile: _reduxjs_toolkit.ActionCreatorWithoutPayload<`${string}/${string}`> | _reduxjs_toolkit.ActionCreatorWithPayload<any, `${string}/${string}`> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, never> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, any> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, never> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, any>;
|
|
866
|
+
declare const clearFiles: _reduxjs_toolkit.ActionCreatorWithoutPayload<`${string}/${string}`> | _reduxjs_toolkit.ActionCreatorWithPayload<any, `${string}/${string}`> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, never> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, any> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, never> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, any>;
|
|
867
|
+
declare const updateFileProgress: _reduxjs_toolkit.ActionCreatorWithoutPayload<`${string}/${string}`> | _reduxjs_toolkit.ActionCreatorWithPayload<any, `${string}/${string}`> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, never> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, any> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, never> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, any>;
|
|
868
|
+
declare const updateFileStatus: _reduxjs_toolkit.ActionCreatorWithoutPayload<`${string}/${string}`> | _reduxjs_toolkit.ActionCreatorWithPayload<any, `${string}/${string}`> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, never> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, any> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, never> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, any>;
|
|
869
|
+
declare const updateFileUrl: _reduxjs_toolkit.ActionCreatorWithoutPayload<`${string}/${string}`> | _reduxjs_toolkit.ActionCreatorWithPayload<any, `${string}/${string}`> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, never> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, any> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, never> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, any>;
|
|
870
|
+
declare const updateFileMetadata: _reduxjs_toolkit.ActionCreatorWithoutPayload<`${string}/${string}`> | _reduxjs_toolkit.ActionCreatorWithPayload<any, `${string}/${string}`> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, never> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, any> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, never> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, any>;
|
|
871
|
+
declare const updateFileRetryCount: _reduxjs_toolkit.ActionCreatorWithoutPayload<`${string}/${string}`> | _reduxjs_toolkit.ActionCreatorWithPayload<any, `${string}/${string}`> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, never> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, any> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, never> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, any>;
|
|
872
|
+
declare const updateFileUrlFromWebSocket: _reduxjs_toolkit.ActionCreatorWithoutPayload<`${string}/${string}`> | _reduxjs_toolkit.ActionCreatorWithPayload<any, `${string}/${string}`> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, never> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, any> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, never> | _reduxjs_toolkit.ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, any>;
|
|
873
|
+
declare const filesReducer: Reducer<State>;
|
|
874
|
+
|
|
533
875
|
type ChatMode = "advanced" | "default";
|
|
534
876
|
|
|
535
877
|
interface UseExternalPricingProps {
|
|
@@ -619,15 +961,17 @@ type Props$5 = {
|
|
|
619
961
|
username: string;
|
|
620
962
|
token: string;
|
|
621
963
|
wsUrl: string;
|
|
622
|
-
redirectToAuthSpa: () => void;
|
|
964
|
+
redirectToAuthSpa: (redirectTo?: string, platformKey?: string, logout?: boolean) => void;
|
|
623
965
|
stopGenerationWsUrl: string;
|
|
624
966
|
sendMessageToParentWebsite?: (payload: unknown) => void;
|
|
625
967
|
errorHandler?: (message: string, error?: any) => void;
|
|
626
968
|
isPreviewMode?: boolean;
|
|
627
969
|
mentorShareableToken?: string | null;
|
|
628
970
|
on402Error?: (message: Record<string, unknown>) => void;
|
|
971
|
+
cachedSessionId?: string;
|
|
972
|
+
onStartNewChat?: (sessionId: string) => void;
|
|
629
973
|
};
|
|
630
|
-
declare function useAdvancedChat({ tenantKey, mentorId, username, token, wsUrl, stopGenerationWsUrl, redirectToAuthSpa, errorHandler, sendMessageToParentWebsite, isPreviewMode, mentorShareableToken, on402Error, }: Props$5): {
|
|
974
|
+
declare function useAdvancedChat({ tenantKey, mentorId, username, token, wsUrl, stopGenerationWsUrl, redirectToAuthSpa, errorHandler, sendMessageToParentWebsite, isPreviewMode, mentorShareableToken, on402Error, cachedSessionId, onStartNewChat, }: Props$5): {
|
|
631
975
|
messages: Message[];
|
|
632
976
|
isStreaming: boolean;
|
|
633
977
|
status: ChatStatus;
|
|
@@ -798,6 +1142,12 @@ declare function useMentorSettings({ mentorId, tenantKey, username }: Props$3):
|
|
|
798
1142
|
* On React Native, this is a no-op
|
|
799
1143
|
*/
|
|
800
1144
|
declare function syncAuthToCookies(storageService: StorageService): Promise<void>;
|
|
1145
|
+
/**
|
|
1146
|
+
* Clear current tenant cookie only (web only)
|
|
1147
|
+
* Should be called before tenant switching
|
|
1148
|
+
* On React Native, this is a no-op
|
|
1149
|
+
*/
|
|
1150
|
+
declare function clearCurrentTenantCookie(): void;
|
|
801
1151
|
/**
|
|
802
1152
|
* Clear all authentication cookies (web only)
|
|
803
1153
|
* Should be called on logout
|
|
@@ -840,7 +1190,7 @@ type Props$2 = {
|
|
|
840
1190
|
middleware?: Map<string | RegExp, () => Promise<boolean>>;
|
|
841
1191
|
onAuthSuccess?: () => void;
|
|
842
1192
|
onAuthFailure?: (reason: string) => void;
|
|
843
|
-
redirectToAuthSpa: (redirectTo?: string, platformKey?: string, logout?: boolean) => void;
|
|
1193
|
+
redirectToAuthSpa: (redirectTo?: string, platformKey?: string, logout?: boolean, saveRedirect?: boolean) => void;
|
|
844
1194
|
hasNonExpiredAuthToken: () => boolean;
|
|
845
1195
|
username: string;
|
|
846
1196
|
pathname: string;
|
|
@@ -944,6 +1294,7 @@ type Props = {
|
|
|
944
1294
|
saveUserTokens?: (tokens: TokenResponse) => void;
|
|
945
1295
|
saveTenant?: (tenant: string) => void;
|
|
946
1296
|
onAutoJoinUserToTenant?: (platformName: string) => void;
|
|
1297
|
+
redirectToAuthSpa?: (redirectTo?: string, platformKey?: string, logout?: boolean, saveRedirect?: boolean) => void;
|
|
947
1298
|
};
|
|
948
1299
|
/**
|
|
949
1300
|
* TenantProvider Component
|
|
@@ -955,67 +1306,75 @@ type Props = {
|
|
|
955
1306
|
* 4. Handles tenant-specific domain redirects
|
|
956
1307
|
* 5. Maintains tenant access state
|
|
957
1308
|
*/
|
|
958
|
-
declare function TenantProvider({ children, fallback, onAuthSuccess, onAuthFailure, currentTenant, requestedTenant, saveCurrentTenant, saveUserTenants, handleTenantSwitch, saveVisitingTenant, removeVisitingTenant, saveUserTokens, saveTenant, onAutoJoinUserToTenant, }: Props): string | number | bigint | boolean | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
1309
|
+
declare function TenantProvider({ children, fallback, onAuthSuccess, onAuthFailure, currentTenant, requestedTenant, saveCurrentTenant, saveUserTenants, handleTenantSwitch, saveVisitingTenant, removeVisitingTenant, saveUserTokens, saveTenant, onAutoJoinUserToTenant, redirectToAuthSpa, }: Props): string | number | bigint | boolean | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
959
1310
|
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
startTime: number;
|
|
969
|
-
intervalId: number | null;
|
|
970
|
-
routeUnsubscribe: (() => void) | null;
|
|
971
|
-
}
|
|
972
|
-
declare class TimeTracker {
|
|
973
|
-
private state;
|
|
974
|
-
private config;
|
|
975
|
-
constructor(config: TimeTrackerConfig);
|
|
976
|
-
private initialize;
|
|
977
|
-
private startTracking;
|
|
978
|
-
private clearInterval;
|
|
979
|
-
private resetTimer;
|
|
980
|
-
private getTimeSpent;
|
|
981
|
-
private sendTimeUpdate;
|
|
982
|
-
private handleRouteChange;
|
|
983
|
-
pause(): void;
|
|
984
|
-
resume(): void;
|
|
985
|
-
destroy(): void;
|
|
986
|
-
getCurrentUrl(): string;
|
|
987
|
-
getTimeSpentSinceLastReset(): number;
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
interface UseTimeTrackerConfig {
|
|
991
|
-
intervalSeconds: number;
|
|
992
|
-
onTimeUpdate: (url: string, timeSpent: number) => void;
|
|
993
|
-
enabled?: boolean;
|
|
994
|
-
getCurrentUrl?: () => string;
|
|
995
|
-
onRouteChange?: (callback: () => void) => () => void;
|
|
996
|
-
}
|
|
997
|
-
interface UseTimeTrackerReturn {
|
|
998
|
-
pause: () => void;
|
|
999
|
-
resume: () => void;
|
|
1000
|
-
getCurrentUrl: () => string;
|
|
1001
|
-
getTimeSpentSinceLastReset: () => number;
|
|
1002
|
-
}
|
|
1003
|
-
declare function useTimeTracker(config: UseTimeTrackerConfig): UseTimeTrackerReturn;
|
|
1311
|
+
/**
|
|
1312
|
+
* Chat area size constants
|
|
1313
|
+
*/
|
|
1314
|
+
declare const CHAT_AREA_SIZE: {
|
|
1315
|
+
readonly DEFAULT: 672;
|
|
1316
|
+
readonly MIN: 672;
|
|
1317
|
+
readonly MAX: 1024;
|
|
1318
|
+
};
|
|
1004
1319
|
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1320
|
+
/**
|
|
1321
|
+
* Extract file information from File object
|
|
1322
|
+
*/
|
|
1323
|
+
declare function getFileInfo(file: File): FileInfo;
|
|
1324
|
+
/**
|
|
1325
|
+
* Request presigned S3 URL from backend
|
|
1326
|
+
* Note: This function should be called via the RTK Query mutation hook
|
|
1327
|
+
* This is a helper to show the data flow
|
|
1328
|
+
*/
|
|
1329
|
+
declare function requestPresignedUrl(sessionId: string, file: File, getUploadUrlFn: (params: {
|
|
1330
|
+
org: string;
|
|
1331
|
+
userId: string;
|
|
1332
|
+
requestBody: {
|
|
1333
|
+
session_id: string;
|
|
1334
|
+
file_name: string;
|
|
1335
|
+
content_type: string;
|
|
1336
|
+
file_size: number;
|
|
1337
|
+
};
|
|
1338
|
+
}) => Promise<FileUploadURLResponse>, org: string, userId: string): Promise<FileUploadURLResponse>;
|
|
1339
|
+
/**
|
|
1340
|
+
* Upload file directly to S3 using presigned URL
|
|
1341
|
+
* Uses axios for cross-platform support (web + React Native)
|
|
1342
|
+
*/
|
|
1343
|
+
declare function uploadToS3(presignedUrl: string, file: File, contentType: string, onProgress?: UploadProgressCallback): Promise<void>;
|
|
1344
|
+
/**
|
|
1345
|
+
* Complete file upload flow:
|
|
1346
|
+
* 1. Request presigned URL
|
|
1347
|
+
* 2. Upload to S3
|
|
1348
|
+
* 3. Return file reference
|
|
1349
|
+
*/
|
|
1350
|
+
declare function createFileReference(file: File, sessionId: string, getUploadUrlFn: (params: {
|
|
1351
|
+
org: string;
|
|
1352
|
+
userId: string;
|
|
1353
|
+
requestBody: {
|
|
1354
|
+
session_id: string;
|
|
1355
|
+
file_name: string;
|
|
1356
|
+
content_type: string;
|
|
1357
|
+
file_size: number;
|
|
1358
|
+
};
|
|
1359
|
+
}) => Promise<FileUploadURLResponse>, org: string, userId: string, onProgress?: UploadProgressCallback): Promise<FileReference>;
|
|
1360
|
+
/**
|
|
1361
|
+
* Upload multiple files and return their references
|
|
1362
|
+
*/
|
|
1363
|
+
declare function createMultipleFileReferences(files: File[], sessionId: string, getUploadUrlFn: (params: {
|
|
1364
|
+
org: string;
|
|
1365
|
+
userId: string;
|
|
1366
|
+
requestBody: {
|
|
1367
|
+
session_id: string;
|
|
1368
|
+
file_name: string;
|
|
1369
|
+
content_type: string;
|
|
1370
|
+
file_size: number;
|
|
1371
|
+
};
|
|
1372
|
+
}) => Promise<FileUploadURLResponse>, org: string, userId: string, onFileProgress?: (fileIndex: number, progress: number) => void): Promise<FileReference[]>;
|
|
1373
|
+
/**
|
|
1374
|
+
* Validate file before upload
|
|
1375
|
+
* Returns error message if invalid, null if valid
|
|
1376
|
+
*/
|
|
1377
|
+
declare function validateFile(file: File, maxSizeBytes?: number, allowedTypes?: string[]): string | null;
|
|
1019
1378
|
|
|
1020
|
-
export { ALPHANUMERIC_32_REGEX, ANONYMOUS_USERNAME, AuthContext, AuthContextProvider, AuthProvider, LOCAL_STORAGE_KEYS, MAX_INITIAL_WEBSOCKET_CONNECTION_ATTEMPTS, MENTOR_CHAT_DOCUMENTS_EXTENSIONS, METADATAS, MentorProvider, SUBSCRIPTION_MESSAGES, SUBSCRIPTION_PACKAGES, SUBSCRIPTION_TRIGGERS, SUBSCRIPTION_V2_TRIGGERS, SubscriptionFlow, SubscriptionFlowV2, TOOLS, TenantContext, TenantContextProvider, TenantProvider, TimeTracker, addProtocolToUrl, advancedTabs, advancedTabsProperties, chatActions, chatSliceReducerShared, clearAuthCookies, defaultSessionIds, formatRelativeTime, getInitials, getTimeAgo, getUserName, isAlphaNumeric32, isJSON, loadMetadataConfig, selectActiveChatMessages, selectActiveTab, selectChats, selectCurrentStreamingMessage, selectDocumentFilter, selectIframeContext, selectIsError, selectIsPending, selectIsStopped, selectIsTyping, selectNumberOfActiveChatMessages, selectSessionId, selectSessionIds, selectShouldStartNewChat, selectShowingSharedChat, selectStatus, selectStreaming, selectToken, selectTokenEnabled, selectTools, syncAuthToCookies, tenantKeySchema, tenantSchema, translatePrompt, useAdvancedChat, useAuthContext, useAuthProvider, useChat, useDayJs, useExternalPricingPlan, useMentorSettings, useMentorTools, useProfileImageUpload, useSubscriptionHandler, useSubscriptionHandlerV2, useTenantContext, useTenantMetadata, useTimeTracker, useTimeTrackerNative, useUserProfileUpdate, userDataSchema };
|
|
1021
|
-
export type { AdvancedTab, AuthContextType, ChatMode, ChatState, ChatStatus, CreateStripeCustomerPortalRequest, Message, MessageAction, PricingModalData, Prompt, SendMessageOptions, SessionIds, StreamingMessage, SubscriptionFlowConfig, SubscriptionFlowConfigV2, Tenant, TenantContextType, TenantKeyMentorIdParams, TenantMetadata, TimeTrackerConfig, TimeTrackerState, TopTrialBannerProps, UseChatProps, UseChatReturn, UseExternalPricingProps, UseProfileImageUploadOptions, UseProfileImageUploadReturn, UseTimeTrackerConfig, UseTimeTrackerNativeConfig, UseTimeTrackerNativeReturn, UseTimeTrackerReturn, UseUserProfileUpdateResult, UserProfileUpdateData };
|
|
1379
|
+
export { ALPHANUMERIC_32_REGEX, ANONYMOUS_USERNAME, AuthContext, AuthContextProvider, AuthProvider, CHAT_AREA_SIZE, LOCAL_STORAGE_KEYS, MAX_INITIAL_WEBSOCKET_CONNECTION_ATTEMPTS, MENTOR_CHAT_DOCUMENTS_EXTENSIONS, METADATAS, MentorProvider, SUBSCRIPTION_MESSAGES, SUBSCRIPTION_PACKAGES, SUBSCRIPTION_TRIGGERS, SUBSCRIPTION_V2_TRIGGERS, SubscriptionFlow, SubscriptionFlowV2, TOOLS, TenantContext, TenantContextProvider, TenantProvider, TimeTracker, addFiles, addProtocolToUrl, advancedTabs, advancedTabsProperties, chatActions, chatSliceReducerShared, clearAuthCookies, clearCookies, clearCurrentTenantCookie, clearFiles, createFileReference, createMultipleFileReferences, defaultSessionIds, deleteCookie, deleteCookieOnAllDomains, filesReducer, filesSlice, formatRelativeTime, getAuthSpaJoinUrl, getDomainParts, getFileInfo, getInitials, getParentDomain, getPlatformKey, getTimeAgo, getUserName, handleLogout, isAlphaNumeric32, isInIframe, isJSON, isLoggedIn, loadMetadataConfig, redirectToAuthSpa, redirectToAuthSpaJoinTenant, removeFile, requestPresignedUrl, selectActiveChatMessages, selectActiveTab, selectChats, selectCurrentStreamingMessage, selectDocumentFilter, selectIframeContext, selectIsError, selectIsPending, selectIsStopped, selectIsTyping, selectNumberOfActiveChatMessages, selectSessionId, selectSessionIds, selectShouldStartNewChat, selectShowingSharedChat, selectStatus, selectStreaming, selectToken, selectTokenEnabled, selectTools, sendMessageToParentWebsite, setCookieForAuth, syncAuthToCookies, tenantKeySchema, tenantSchema, translatePrompt, updateFileMetadata, updateFileProgress, updateFileRetryCount, updateFileStatus, updateFileUrl, updateFileUrlFromWebSocket, uploadToS3, useAdvancedChat, useAuthContext, useAuthProvider, useChat, useDayJs, useExternalPricingPlan, useMentorSettings, useMentorTools, useProfileImageUpload, useSubscriptionHandler, useSubscriptionHandlerV2, useTenantContext, useTenantMetadata, useTimeTracker, useTimeTrackerNative, useUserProfileUpdate, userDataSchema, validateFile };
|
|
1380
|
+
export type { AdvancedTab, AttachedFile, AuthContextType, ChatMode, ChatState, ChatStatus, CreateStripeCustomerPortalRequest, FileAttachment, FileInfo, FileProcessingEvent, FileReference, FileUploadState, FilesState, HandleLogoutOptions, Message, MessageAction, PricingModalData, Prompt, RedirectToAuthSpaOptions, SendMessageOptions, SessionIds, StreamingMessage, SubscriptionFlowConfig, SubscriptionFlowConfigV2, Tenant, TenantContextType, TenantKeyMentorIdParams, TenantMetadata, TimeTrackerConfig, TimeTrackerState, TopTrialBannerProps, UploadProgressCallback, UseChatProps, UseChatReturn, UseExternalPricingProps, UseProfileImageUploadOptions, UseProfileImageUploadReturn, UseTimeTrackerConfig, UseTimeTrackerNativeConfig, UseTimeTrackerNativeReturn, UseTimeTrackerReturn, UseUserProfileUpdateResult, UserProfileUpdateData };
|