@iblai/web-utils 0.2.0 → 0.2.1
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/data-layer/src/core/index.d.ts +2 -1
- package/dist/data-layer/src/features/analytics/api-slice.d.ts +1879 -122
- package/dist/data-layer/src/features/analytics/constants.d.ts +56 -1
- package/dist/data-layer/src/features/analytics/types.d.ts +327 -1
- package/dist/data-layer/src/features/api-keys/api-slice.d.ts +59 -70
- package/dist/data-layer/src/features/apps/api-slice.d.ts +73 -84
- package/dist/data-layer/src/features/auth/api-slice.d.ts +504 -2
- package/dist/data-layer/src/features/auth/constants.d.ts +13 -1
- package/dist/data-layer/src/features/auth/types.d.ts +20 -0
- package/dist/data-layer/src/features/billing/api-slice.d.ts +33 -33
- package/dist/data-layer/src/features/career/api-slice.d.ts +2345 -180
- package/dist/data-layer/src/features/catalog/api-slice.d.ts +2578 -562
- package/dist/data-layer/src/features/chat/api-slice.d.ts +150 -150
- package/dist/data-layer/src/features/chat-history/api-slice.d.ts +134 -134
- package/dist/data-layer/src/features/core/api-slice.d.ts +3484 -75
- package/dist/data-layer/src/features/core/constants.d.ts +40 -0
- package/dist/data-layer/src/features/core/custom-api-slice.d.ts +1458 -0
- package/dist/data-layer/src/features/core/types.d.ts +27 -0
- package/dist/data-layer/src/features/credentials/api-slice.d.ts +859 -221
- package/dist/data-layer/src/features/custom-domain/api-slice.d.ts +602 -0
- package/dist/data-layer/src/features/custom-domain/constants.d.ts +20 -0
- package/dist/data-layer/src/features/custom-domain/types.d.ts +46 -0
- package/dist/data-layer/src/features/datasets/api-slice.d.ts +56 -56
- package/dist/data-layer/src/features/disclaimers/api-slice.d.ts +912 -0
- package/dist/data-layer/src/features/disclaimers/constants.d.ts +27 -0
- package/dist/data-layer/src/features/disclaimers/types.d.ts +67 -0
- package/dist/data-layer/src/features/edx-proctoring/api-slice.d.ts +590 -0
- package/dist/data-layer/src/features/edx-proctoring/constants.d.ts +15 -0
- package/dist/data-layer/src/features/edx-proctoring/types.d.ts +61 -0
- package/dist/data-layer/src/features/llms/api-slice.d.ts +40 -40
- package/dist/data-layer/src/features/memory/api-slice.d.ts +2129 -0
- package/dist/data-layer/src/features/memory/constants.d.ts +50 -0
- package/dist/data-layer/src/features/memory/types.d.ts +122 -0
- package/dist/data-layer/src/features/mentor/api-slice.d.ts +1176 -470
- package/dist/data-layer/src/features/mentor/constants.d.ts +8 -0
- package/dist/data-layer/src/features/mentor/custom-api-slice.d.ts +529 -1
- package/dist/data-layer/src/features/mentor/types.d.ts +39 -0
- package/dist/data-layer/src/features/mentor-categories/api-slice.d.ts +436 -40
- package/dist/data-layer/src/features/notifications/api-slice.d.ts +750 -96
- package/dist/data-layer/src/features/notifications/constants.d.ts +20 -0
- package/dist/data-layer/src/features/notifications/custom-api-slice.d.ts +996 -0
- package/dist/data-layer/src/features/notifications/types.d.ts +46 -0
- package/dist/data-layer/src/features/per-learner/api-slice.d.ts +118 -118
- package/dist/data-layer/src/features/platform/api-slice.d.ts +345 -191
- package/dist/data-layer/src/features/platform/constants.d.ts +17 -0
- package/dist/data-layer/src/features/platform/custom-api-slice.d.ts +493 -0
- package/dist/data-layer/src/features/platform/types.d.ts +48 -0
- package/dist/data-layer/src/features/projects/api-slice.d.ts +2026 -0
- package/dist/data-layer/src/features/projects/constants.d.ts +51 -0
- package/dist/data-layer/src/features/projects/types.d.ts +79 -0
- package/dist/data-layer/src/features/prompts/api-slice.d.ts +193 -171
- package/dist/data-layer/src/features/reports/api-slice.d.ts +814 -0
- package/dist/data-layer/src/features/search/ai-search-api-slice.d.ts +1015 -0
- package/dist/data-layer/src/features/search/api-slice.d.ts +59 -59
- package/dist/data-layer/src/features/search/constants.d.ts +31 -0
- package/dist/data-layer/src/features/search/types.d.ts +89 -0
- package/dist/data-layer/src/features/sessions/api-slice.d.ts +72 -72
- package/dist/data-layer/src/features/skills/api-slice.d.ts +157 -157
- package/dist/data-layer/src/features/stripe/api-slice.d.ts +201 -40
- package/dist/data-layer/src/features/stripe/constants.d.ts +5 -1
- package/dist/data-layer/src/features/stripe/types.d.ts +10 -0
- package/dist/data-layer/src/features/tenant/api-slice.d.ts +77 -86
- package/dist/data-layer/src/features/tenant/types.d.ts +1 -0
- package/dist/data-layer/src/features/tools/api-slice.d.ts +84 -40
- package/dist/data-layer/src/features/training-documents/api-slice.d.ts +582 -75
- package/dist/data-layer/src/features/user/api-slice.d.ts +124 -124
- package/dist/data-layer/src/features/user/constants.d.ts +3 -1
- package/dist/data-layer/src/features/user-invitations/api-slice.d.ts +56 -56
- package/dist/data-layer/src/features/utils.d.ts +8 -5
- package/dist/data-layer/src/index.d.ts +75 -47
- package/dist/data-layer/src/reducers/skills.d.ts +2 -1148
- package/dist/data-layer/src/services/StorageService.d.ts +1 -1
- package/dist/index.d.ts +1021 -5
- package/dist/index.esm.js +3299 -453
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +3305 -448
- package/dist/index.js.map +1 -1
- package/dist/package.json +34 -18
- package/dist/web-utils/src/features/chat/slice.d.ts +12 -0
- package/dist/web-utils/src/features/index.d.ts +1 -0
- package/dist/web-utils/src/features/tracking/__tests__/time-tracker.test.d.ts +1 -0
- package/dist/web-utils/src/features/tracking/examples.d.ts +4 -0
- package/dist/web-utils/src/features/tracking/index.d.ts +6 -0
- package/dist/web-utils/src/features/tracking/time-tracker.d.ts +29 -0
- package/dist/web-utils/src/features/tracking/use-time-tracker-native.d.ts +14 -0
- package/dist/web-utils/src/features/tracking/use-time-tracker.d.ts +14 -0
- package/dist/web-utils/src/hooks/chat/use-advanced-chat.d.ts +2 -2
- package/dist/web-utils/src/hooks/chat/use-chat-v2.d.ts +9 -1
- package/dist/web-utils/src/hooks/chat/use-get-chat-details.d.ts +2 -1
- package/dist/web-utils/src/hooks/chat/use-mentor-tools.d.ts +3 -0
- package/dist/web-utils/src/hooks/index.d.ts +1 -0
- package/dist/web-utils/src/hooks/subscription/class-subscription-flow.d.ts +6 -6
- package/dist/web-utils/src/hooks/subscription-v2/class-subscription-flow.d.ts +9 -8
- package/dist/web-utils/src/hooks/subscription-v2/use-external-pricing-plan.d.ts +1 -1
- package/dist/web-utils/src/hooks/tenant-metadata/use-tenant-metadata.d.ts +2 -1
- package/dist/web-utils/src/hooks/use-mentor-settings.d.ts +1 -0
- package/dist/web-utils/src/index.mobile.d.ts +10 -0
- package/dist/web-utils/src/index.web.d.ts +12 -0
- package/dist/web-utils/src/providers/auth-provider.d.ts +55 -1
- package/dist/web-utils/src/providers/mentor-provider.d.ts +3 -1
- package/dist/web-utils/src/providers/tenant-provider.d.ts +10 -5
- package/dist/web-utils/src/types/index.d.ts +9 -0
- package/dist/web-utils/src/utils/constants.d.ts +4 -0
- package/dist/web-utils/src/utils/helpers.d.ts +1 -0
- package/dist/web-utils/src/utils/platform.d.ts +7 -0
- package/dist/web-utils/tests/hooks/subscription/class-subscription-flow.test.d.ts +1 -0
- package/dist/web-utils/tests/hooks/subscription/constants.test.d.ts +1 -0
- package/dist/web-utils/tests/hooks/subscription/use-subscription-handler.test.d.ts +1 -0
- package/dist/web-utils/tests/hooks/use-day-js.test.d.ts +1 -0
- package/dist/web-utils/tests/setupTests.d.ts +5 -0
- package/dist/web-utils/tsconfig.tsbuildinfo +1 -0
- package/package.json +31 -17
- package/dist/features/chat/slice.d.ts +0 -59
- package/dist/features/index.d.ts +0 -1
- package/dist/hooks/chat/use-advanced-chat.d.ts +0 -41
- package/dist/hooks/chat/use-chat-v2.d.ts +0 -53
- package/dist/hooks/chat/use-chat.d.ts +0 -52
- package/dist/hooks/chat/use-get-chat-details.d.ts +0 -13
- package/dist/hooks/index.d.ts +0 -10
- package/dist/hooks/subscription/class-subscription-flow.d.ts +0 -70
- package/dist/hooks/subscription/constants.d.ts +0 -4
- package/dist/hooks/subscription/use-subscription-handler.d.ts +0 -11
- package/dist/hooks/subscription-v2/class-subscription-flow.d.ts +0 -62
- package/dist/hooks/subscription-v2/constants.d.ts +0 -5
- package/dist/hooks/subscription-v2/use-external-pricing-plan.d.ts +0 -7
- package/dist/hooks/subscription-v2/use-subscription-handler.d.ts +0 -12
- package/dist/hooks/use-day-js.d.ts +0 -7
- package/dist/providers/auth-provider.d.ts +0 -63
- package/dist/providers/index.d.ts +0 -3
- package/dist/providers/mentor-provider.d.ts +0 -40
- package/dist/providers/tenant-provider.d.ts +0 -60
- package/dist/types/chat.d.ts +0 -1
- package/dist/types/index.d.ts +0 -55
- package/dist/types/subscription.d.ts +0 -18
- package/dist/utils/constants.d.ts +0 -13
- package/dist/utils/data/advanced-tab.d.ts +0 -62
- package/dist/utils/helpers.d.ts +0 -1
- package/dist/utils/index.d.ts +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iblai/web-utils",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.esm.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -12,35 +12,48 @@
|
|
|
12
12
|
"license": "ISC",
|
|
13
13
|
"description": "IBL Web Utils",
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@
|
|
16
|
-
"@rollup/plugin-
|
|
17
|
-
"@rollup/plugin-
|
|
15
|
+
"@eslint/js": "^9.39.1",
|
|
16
|
+
"@rollup/plugin-commonjs": "^28.0.9",
|
|
17
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
18
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
19
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
18
20
|
"@testing-library/jest-dom": "6.6.3",
|
|
19
21
|
"@testing-library/react": "16.3.0",
|
|
20
22
|
"@types/jest": "29.5.14",
|
|
21
|
-
"@types/node": "^22.
|
|
22
|
-
"@types/react": "
|
|
23
|
+
"@types/node": "^22.19.0",
|
|
24
|
+
"@types/react": "19.1.17",
|
|
25
|
+
"@typescript-eslint/eslint-plugin": "^8.46.3",
|
|
26
|
+
"@typescript-eslint/parser": "^8.46.3",
|
|
27
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
23
28
|
"autoprefixer": "^10.4.21",
|
|
29
|
+
"eslint": "^9.39.1",
|
|
30
|
+
"eslint-config-prettier": "10.1.2",
|
|
31
|
+
"globals": "^16.5.0",
|
|
24
32
|
"jest": "29.7.0",
|
|
25
33
|
"jest-environment-jsdom": "29.7.0",
|
|
34
|
+
"jsdom": "^25.0.1",
|
|
35
|
+
"rollup-plugin-dts": "^6.2.3",
|
|
26
36
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
27
37
|
"rollup-plugin-strip-code": "^0.2.8",
|
|
28
38
|
"rollup-plugin-typescript2": "^0.36.0",
|
|
29
39
|
"ts-jest": "29.3.2",
|
|
30
|
-
"typescript": "^5.
|
|
40
|
+
"typescript": "^5.9.3",
|
|
41
|
+
"vitest": "^3.2.4"
|
|
31
42
|
},
|
|
32
43
|
"dependencies": {
|
|
33
|
-
"@reduxjs/toolkit": "^2.
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
44
|
+
"@reduxjs/toolkit": "^2.10.0",
|
|
45
|
+
"axios": "^1.13.1",
|
|
46
|
+
"dayjs": "^1.11.19",
|
|
47
|
+
"jwt-decode": "^4.0.0",
|
|
37
48
|
"react-redux": "^9.2.0",
|
|
49
|
+
"rollup": "^4.52.5",
|
|
38
50
|
"rollup-plugin-copy": "^3.5.0",
|
|
39
|
-
"
|
|
51
|
+
"zod": "3.24.2",
|
|
52
|
+
"@iblai/data-layer": "0.3.1"
|
|
40
53
|
},
|
|
41
54
|
"peerDependencies": {
|
|
42
|
-
"@iblai/iblai-api": "4.
|
|
43
|
-
"react": "19.
|
|
55
|
+
"@iblai/iblai-api": "4.79.0-ai",
|
|
56
|
+
"react": "19.1.0"
|
|
44
57
|
},
|
|
45
58
|
"publishConfig": {
|
|
46
59
|
"access": "public",
|
|
@@ -49,8 +62,9 @@
|
|
|
49
62
|
"scripts": {
|
|
50
63
|
"build": "rollup -c",
|
|
51
64
|
"watch": "rollup -c -w",
|
|
52
|
-
"test": "
|
|
53
|
-
"test:watch": "
|
|
54
|
-
"test:coverage": "
|
|
65
|
+
"test": "vitest run",
|
|
66
|
+
"test:watch": "vitest",
|
|
67
|
+
"test:coverage": "vitest run --coverage",
|
|
68
|
+
"typecheck": "tsc --noEmit"
|
|
55
69
|
}
|
|
56
70
|
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import type { AdvancedTab } from "../../utils";
|
|
2
|
-
import type { Message } from "../../hooks/chat/use-chat-v2";
|
|
3
|
-
export type ChatState = Record<AdvancedTab, Message[]>;
|
|
4
|
-
export interface SessionIds extends Record<AdvancedTab, string> {
|
|
5
|
-
}
|
|
6
|
-
export type StreamingMessage = {
|
|
7
|
-
id: string;
|
|
8
|
-
content: string;
|
|
9
|
-
};
|
|
10
|
-
export declare const defaultSessionIds: SessionIds;
|
|
11
|
-
type ChatSliceState = {
|
|
12
|
-
chats: ChatState;
|
|
13
|
-
isTyping: boolean;
|
|
14
|
-
streaming: boolean;
|
|
15
|
-
currentStreamingMessage: StreamingMessage;
|
|
16
|
-
activeTab: AdvancedTab;
|
|
17
|
-
sessionId: string;
|
|
18
|
-
sessionIds: SessionIds;
|
|
19
|
-
iframeContext: {
|
|
20
|
-
hostInfo: {
|
|
21
|
-
title: string;
|
|
22
|
-
href: string;
|
|
23
|
-
};
|
|
24
|
-
pageContent: string;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
export declare const chatActions: import("@reduxjs/toolkit").CaseReducerActions<import("@reduxjs/toolkit").SliceCaseReducers<ChatSliceState>, string>;
|
|
28
|
-
export declare const chatSliceReducerShared: import("@reduxjs/toolkit").Reducer<ChatSliceState>;
|
|
29
|
-
export declare const selectChats: (state: {
|
|
30
|
-
chatSliceShared: ChatSliceState;
|
|
31
|
-
}) => ChatState;
|
|
32
|
-
export declare const selectIsTyping: (state: {
|
|
33
|
-
chatSliceShared: ChatSliceState;
|
|
34
|
-
}) => boolean;
|
|
35
|
-
export declare const selectStreaming: (state: {
|
|
36
|
-
chatSliceShared: ChatSliceState;
|
|
37
|
-
}) => boolean;
|
|
38
|
-
export declare const selectCurrentStreamingMessage: (state: {
|
|
39
|
-
chatSliceShared: ChatSliceState;
|
|
40
|
-
}) => StreamingMessage;
|
|
41
|
-
export declare const selectActiveTab: (state: {
|
|
42
|
-
chatSliceShared: ChatSliceState;
|
|
43
|
-
}) => "chat" | "summarize" | "translate" | "expand";
|
|
44
|
-
export declare const selectSessionId: (state: {
|
|
45
|
-
chatSliceShared: ChatSliceState;
|
|
46
|
-
}) => string;
|
|
47
|
-
export declare const selectSessionIds: (state: {
|
|
48
|
-
chatSliceShared: ChatSliceState;
|
|
49
|
-
}) => SessionIds;
|
|
50
|
-
export declare const selectIframeContext: (state: {
|
|
51
|
-
chatSliceShared: ChatSliceState;
|
|
52
|
-
}) => {
|
|
53
|
-
hostInfo: {
|
|
54
|
-
title: string;
|
|
55
|
-
href: string;
|
|
56
|
-
};
|
|
57
|
-
pageContent: string;
|
|
58
|
-
};
|
|
59
|
-
export {};
|
package/dist/features/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./chat/slice";
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { ChatMode } from "../../types";
|
|
3
|
-
import { type AdvancedTab } from "../../utils";
|
|
4
|
-
import { Message } from "./use-chat-v2";
|
|
5
|
-
type Props = {
|
|
6
|
-
mode: ChatMode;
|
|
7
|
-
tenantKey: string;
|
|
8
|
-
mentorId: string;
|
|
9
|
-
username: string;
|
|
10
|
-
token: string;
|
|
11
|
-
wsUrl: string;
|
|
12
|
-
redirectToAuthSpa: () => void;
|
|
13
|
-
stopGenerationWsUrl: string;
|
|
14
|
-
sendMessageToParentWebsite?: (payload: unknown) => void;
|
|
15
|
-
errorHandler?: (error: string) => void;
|
|
16
|
-
isPreviewMode?: boolean;
|
|
17
|
-
};
|
|
18
|
-
export declare function useAdvancedChat({ mode, tenantKey, mentorId, username, token, wsUrl, stopGenerationWsUrl, redirectToAuthSpa, errorHandler, sendMessageToParentWebsite, isPreviewMode, }: Props): {
|
|
19
|
-
messages: Message[];
|
|
20
|
-
isStreaming: boolean;
|
|
21
|
-
currentStreamingMessage: import("../../features/chat/slice").StreamingMessage;
|
|
22
|
-
activeTab: "chat" | "summarize" | "translate" | "expand";
|
|
23
|
-
uniqueMentorId: string;
|
|
24
|
-
mentorName: string;
|
|
25
|
-
profileImage: string;
|
|
26
|
-
enabledGuidedPrompts: boolean;
|
|
27
|
-
sendMessage: (tab: AdvancedTab, text: string, options?: import("./use-chat-v2").SendMessageOptions) => Promise<void>;
|
|
28
|
-
stopGenerating: () => void;
|
|
29
|
-
setMessages: (messages: Message[]) => void;
|
|
30
|
-
changeTab: (tab: AdvancedTab) => Promise<void>;
|
|
31
|
-
sessionId: string;
|
|
32
|
-
startNewChat: () => Promise<void>;
|
|
33
|
-
isLoadingSessionIds: boolean;
|
|
34
|
-
ws: React.MutableRefObject<WebSocket | null>;
|
|
35
|
-
isConnected: React.MutableRefObject<boolean>;
|
|
36
|
-
messageQueue: React.MutableRefObject<any[]>;
|
|
37
|
-
enableWebBrowsing: boolean;
|
|
38
|
-
sessionIds: import("../../features/chat/slice").SessionIds;
|
|
39
|
-
enableSafetyDisclaimer: any;
|
|
40
|
-
};
|
|
41
|
-
export {};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { AdvancedTab } from "../../utils/data/advanced-tab";
|
|
2
|
-
export interface Message {
|
|
3
|
-
id: string;
|
|
4
|
-
role: "user" | "assistant" | "system";
|
|
5
|
-
content: string;
|
|
6
|
-
timestamp: string;
|
|
7
|
-
url?: string;
|
|
8
|
-
fileType?: string;
|
|
9
|
-
contentType?: string;
|
|
10
|
-
visible: boolean;
|
|
11
|
-
}
|
|
12
|
-
export type SendMessageOptions = {
|
|
13
|
-
visible?: boolean;
|
|
14
|
-
} | undefined;
|
|
15
|
-
export interface UseChatProps {
|
|
16
|
-
wsUrl: string;
|
|
17
|
-
wsToken: string;
|
|
18
|
-
flowConfig: {
|
|
19
|
-
name: string;
|
|
20
|
-
tenant: string;
|
|
21
|
-
username: string;
|
|
22
|
-
pathway: string;
|
|
23
|
-
};
|
|
24
|
-
sessionId: string;
|
|
25
|
-
stopGenerationWsUrl: string;
|
|
26
|
-
activeTab: AdvancedTab;
|
|
27
|
-
enableHaptics?: boolean;
|
|
28
|
-
hapticFeedback?: {
|
|
29
|
-
impactAsync: (style: any) => Promise<void>;
|
|
30
|
-
};
|
|
31
|
-
redirectToAuthSpa: () => void;
|
|
32
|
-
store?: {
|
|
33
|
-
sendMessage?: (text: string) => Promise<void>;
|
|
34
|
-
};
|
|
35
|
-
WebSocketImpl?: typeof WebSocket;
|
|
36
|
-
errorHandler?: (error: string) => void;
|
|
37
|
-
onStreamingChange: (streaming: boolean) => void;
|
|
38
|
-
onStreamingMessageUpdate: (message: {
|
|
39
|
-
id: string | null;
|
|
40
|
-
content: string;
|
|
41
|
-
}) => void;
|
|
42
|
-
onAddUserMessage?: (activeTab: AdvancedTab, message: Message) => void;
|
|
43
|
-
sendMessageToParentWebsite?: (payload: unknown) => void;
|
|
44
|
-
}
|
|
45
|
-
export interface UseChatReturn {
|
|
46
|
-
sendMessage: (tab: AdvancedTab, text: string, options?: SendMessageOptions) => Promise<void>;
|
|
47
|
-
ws: React.MutableRefObject<WebSocket | null>;
|
|
48
|
-
isConnected: React.MutableRefObject<boolean>;
|
|
49
|
-
messageQueue: React.MutableRefObject<any[]>;
|
|
50
|
-
stopGenerating: () => void;
|
|
51
|
-
resetConnection: () => void;
|
|
52
|
-
}
|
|
53
|
-
export declare const useChat: ({ wsUrl, wsToken, flowConfig, sessionId, stopGenerationWsUrl, activeTab, enableHaptics, hapticFeedback, store, errorHandler, onStreamingChange, onStreamingMessageUpdate, onAddUserMessage, WebSocketImpl, redirectToAuthSpa, sendMessageToParentWebsite, }: UseChatProps) => UseChatReturn;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { AdvancedTab } from "../../utils/data/advanced-tab";
|
|
2
|
-
export interface Message {
|
|
3
|
-
id: string;
|
|
4
|
-
role: "user" | "assistant" | "system";
|
|
5
|
-
content: string;
|
|
6
|
-
timestamp: string;
|
|
7
|
-
url?: string;
|
|
8
|
-
fileType?: string;
|
|
9
|
-
contentType?: string;
|
|
10
|
-
visible?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export type SendMessageOptions = {
|
|
13
|
-
visible?: boolean;
|
|
14
|
-
};
|
|
15
|
-
export interface UseChatProps {
|
|
16
|
-
wsUrl: string;
|
|
17
|
-
wsToken: string;
|
|
18
|
-
flowConfig: {
|
|
19
|
-
name: string;
|
|
20
|
-
tenant: string;
|
|
21
|
-
username: string;
|
|
22
|
-
pathway: string;
|
|
23
|
-
};
|
|
24
|
-
sessionId: string;
|
|
25
|
-
stopGenerationWsUrl: string;
|
|
26
|
-
activeTab: AdvancedTab;
|
|
27
|
-
enableHaptics?: boolean;
|
|
28
|
-
hapticFeedback?: {
|
|
29
|
-
impactAsync: (style: any) => Promise<void>;
|
|
30
|
-
};
|
|
31
|
-
store?: {
|
|
32
|
-
sendMessage?: (text: string) => Promise<void>;
|
|
33
|
-
};
|
|
34
|
-
WebSocketImpl?: typeof WebSocket;
|
|
35
|
-
errorHandler?: (error: string) => void;
|
|
36
|
-
}
|
|
37
|
-
export interface UseChatReturn {
|
|
38
|
-
messages: Message[];
|
|
39
|
-
isTyping: boolean;
|
|
40
|
-
sendMessage: (text: string, options?: SendMessageOptions) => Promise<void>;
|
|
41
|
-
currentStreamingMessage: {
|
|
42
|
-
id: string | null;
|
|
43
|
-
content: string;
|
|
44
|
-
};
|
|
45
|
-
ws: React.MutableRefObject<WebSocket | null>;
|
|
46
|
-
isConnected: React.MutableRefObject<boolean>;
|
|
47
|
-
messageQueue: React.MutableRefObject<any[]>;
|
|
48
|
-
stopGenerating: () => void;
|
|
49
|
-
streaming: boolean;
|
|
50
|
-
setMessages: (messages: Message[]) => void;
|
|
51
|
-
}
|
|
52
|
-
export declare const useChat: ({ wsUrl, wsToken, flowConfig, sessionId, stopGenerationWsUrl, activeTab, enableHaptics, hapticFeedback, store, errorHandler, WebSocketImpl, }: UseChatProps) => UseChatReturn;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ChatMode } from "../../types";
|
|
2
|
-
type Props = {
|
|
3
|
-
mode: ChatMode;
|
|
4
|
-
tenantKey: string;
|
|
5
|
-
mentorId: string;
|
|
6
|
-
username: string;
|
|
7
|
-
errorHandler?: (error: string) => void;
|
|
8
|
-
};
|
|
9
|
-
export declare function useGetChatDetails({ mode, tenantKey, mentorId, username, errorHandler, }: Props): {
|
|
10
|
-
isLoadingSessionIds: boolean;
|
|
11
|
-
refetchSessionIds: () => Promise<void>;
|
|
12
|
-
};
|
|
13
|
-
export {};
|
package/dist/hooks/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from "./subscription/use-subscription-handler";
|
|
2
|
-
export * from "./subscription/constants";
|
|
3
|
-
export * from "./subscription/class-subscription-flow";
|
|
4
|
-
export * from "./subscription-v2/use-subscription-handler";
|
|
5
|
-
export * from "./subscription-v2/class-subscription-flow";
|
|
6
|
-
export * from "./subscription-v2/use-external-pricing-plan";
|
|
7
|
-
export * from "./subscription-v2/constants";
|
|
8
|
-
export * from "./use-day-js";
|
|
9
|
-
export * from "./chat/use-chat";
|
|
10
|
-
export * from "./chat/use-advanced-chat";
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { FreeUsageCount } from "@iblai/iblai-api";
|
|
2
|
-
interface Tenant {
|
|
3
|
-
key: string;
|
|
4
|
-
is_admin: boolean;
|
|
5
|
-
org: string;
|
|
6
|
-
}
|
|
7
|
-
export interface SubscriptionFlowConfig {
|
|
8
|
-
platformName: string;
|
|
9
|
-
currentTenantKey: string;
|
|
10
|
-
username: string;
|
|
11
|
-
currentTenantOrg: string;
|
|
12
|
-
userTenants: Tenant[];
|
|
13
|
-
isAdmin: boolean;
|
|
14
|
-
mainTenantKey: string;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* SubscriptionFlow class manages all subscription-related flows and user interactions
|
|
18
|
-
* Handles free trial, usage limits, and subscription management
|
|
19
|
-
*/
|
|
20
|
-
export declare class SubscriptionFlow {
|
|
21
|
-
protected platformName: string;
|
|
22
|
-
protected currentTenantKey: string;
|
|
23
|
-
protected username: string;
|
|
24
|
-
protected currentTenantOrg: string;
|
|
25
|
-
protected userTenants: Tenant[];
|
|
26
|
-
protected isAdmin: boolean;
|
|
27
|
-
protected mainTenantKey: string;
|
|
28
|
-
constructor(config: SubscriptionFlowConfig);
|
|
29
|
-
getPlatformName(): string;
|
|
30
|
-
getCurrentTenantKey(): string;
|
|
31
|
-
getUsername(): string;
|
|
32
|
-
getCurrentTenantOrg(): string;
|
|
33
|
-
getUserTenants(): Tenant[];
|
|
34
|
-
isUserAdmin(): boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Handles the flow when user reaches their free usage limit
|
|
37
|
-
* Updates banner with appropriate message based on remaining usage count
|
|
38
|
-
*/
|
|
39
|
-
handleFreeUsageCountFlow(freeUsageCount: FreeUsageCount): void;
|
|
40
|
-
/**
|
|
41
|
-
* Handles the flow when user's free trial period has ended
|
|
42
|
-
* Updates banner and clears any existing trial interval
|
|
43
|
-
*/
|
|
44
|
-
handleTrialEndedFlow(freeTrialIntervalID?: number): void;
|
|
45
|
-
/**
|
|
46
|
-
* Handles the flow for ongoing subscription period
|
|
47
|
-
* Updates banner with remaining trial time and subscription options
|
|
48
|
-
*/
|
|
49
|
-
handleSubscriptionOnGoingFlow(timeRemainingInString: string): void;
|
|
50
|
-
/**
|
|
51
|
-
* Handles redirection to external URLs with optional toast notification
|
|
52
|
-
*/
|
|
53
|
-
handleRedirectToURLFlow(redirectUrl: string, toastMessage?: string): void;
|
|
54
|
-
/**
|
|
55
|
-
* Displays the pricing modal for subscription options
|
|
56
|
-
*/
|
|
57
|
-
handlePricingPageDisplayFlow(): void;
|
|
58
|
-
/**
|
|
59
|
-
* Handles the pre-subscription state
|
|
60
|
-
* Updates banner to show loading state
|
|
61
|
-
*/
|
|
62
|
-
handleBeforeSubscribeUserTriggerFlow(): void;
|
|
63
|
-
/**
|
|
64
|
-
* Handles successful subscription completion
|
|
65
|
-
* Shows success message and disables subscription banner
|
|
66
|
-
*/
|
|
67
|
-
handleSuccessfullySubscribedFlow(message?: string): void;
|
|
68
|
-
getMainTenantKey(): string;
|
|
69
|
-
}
|
|
70
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { SubscriptionFlow } from "./class-subscription-flow";
|
|
2
|
-
/**
|
|
3
|
-
* Hook to handle subscription logic
|
|
4
|
-
* @param subscriptionFlow Instance of SubscriptionFlow that manages different subscription states and actions
|
|
5
|
-
*/
|
|
6
|
-
export declare const useSubscriptionHandler: (subscriptionFlow: SubscriptionFlow) => {
|
|
7
|
-
handleSubscriptionCheck: () => Promise<void>;
|
|
8
|
-
handleIntervalSubscriptionCheck: () => (() => void) | undefined;
|
|
9
|
-
trialCounterStarted: boolean;
|
|
10
|
-
bannerButtonTriggerCallback: (trigger: string) => () => void;
|
|
11
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { StripeContextResponse } from "@iblai/data-layer";
|
|
2
|
-
interface Tenant {
|
|
3
|
-
key: string;
|
|
4
|
-
is_admin: boolean;
|
|
5
|
-
org: string;
|
|
6
|
-
}
|
|
7
|
-
export interface SubscriptionFlowConfigV2 {
|
|
8
|
-
platformName: string;
|
|
9
|
-
currentTenantKey: string;
|
|
10
|
-
username: string;
|
|
11
|
-
currentTenantOrg: string;
|
|
12
|
-
userTenants: Tenant[];
|
|
13
|
-
isAdmin: boolean;
|
|
14
|
-
mainTenantKey: string;
|
|
15
|
-
userEmail: string;
|
|
16
|
-
mentorUrl: string;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* SubscriptionFlow class manages all subscription-related flows and user interactions
|
|
20
|
-
* Handles free trial, usage limits, and subscription management
|
|
21
|
-
*/
|
|
22
|
-
export declare class SubscriptionFlowV2 {
|
|
23
|
-
protected platformName: string;
|
|
24
|
-
protected currentTenantKey: string;
|
|
25
|
-
protected username: string;
|
|
26
|
-
protected currentTenantOrg: string;
|
|
27
|
-
protected userTenants: Tenant[];
|
|
28
|
-
protected isAdmin: boolean;
|
|
29
|
-
protected mainTenantKey: string;
|
|
30
|
-
protected userEmail: string;
|
|
31
|
-
protected mentorUrl: string;
|
|
32
|
-
constructor(config: SubscriptionFlowConfigV2);
|
|
33
|
-
getPlatformName(): string;
|
|
34
|
-
getCurrentTenantKey(): string;
|
|
35
|
-
getUsername(): string;
|
|
36
|
-
getCurrentTenantOrg(): string;
|
|
37
|
-
getUserTenants(): Tenant[];
|
|
38
|
-
isUserAdmin(): boolean;
|
|
39
|
-
getUserEmail(): string;
|
|
40
|
-
getMainTenantKey(): string;
|
|
41
|
-
getMentorUrl(): string;
|
|
42
|
-
handleRedirectToBillingPageFlow(billingUrl: string): void;
|
|
43
|
-
handleBeforeTopUpCreditTriggerFlow(): void;
|
|
44
|
-
/**
|
|
45
|
-
* Handles the flow when user reaches their free usage limit
|
|
46
|
-
* Updates banner with appropriate message based on remaining usage count
|
|
47
|
-
*/
|
|
48
|
-
handleFreeUsageCountFlow(hasCredits: boolean, appExists: boolean): void;
|
|
49
|
-
/**
|
|
50
|
-
* Displays the pricing modal for subscription options
|
|
51
|
-
*/
|
|
52
|
-
handlePricingPageDisplayFlow(stripeContext: StripeContextResponse): void;
|
|
53
|
-
/**
|
|
54
|
-
* Displays error notification when payment flow fails
|
|
55
|
-
*/
|
|
56
|
-
handleFailureOnPaymentFlow(): void;
|
|
57
|
-
handleBeforePricingPageDisplayFlow(): void;
|
|
58
|
-
handleFailureOnTopUpCreditTriggerFlow(): void;
|
|
59
|
-
handleCreditExhaustedFlow(isTenantOwnerAdmin: boolean): void;
|
|
60
|
-
handleOpenContactAdminFlow(adminEmail: string): void;
|
|
61
|
-
}
|
|
62
|
-
export {};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { PricingModalData } from "@web-utils/types/subscription";
|
|
2
|
-
export declare const useExternalPricingPlan: ({ pricingModalData, userEmail }: {
|
|
3
|
-
pricingModalData: PricingModalData;
|
|
4
|
-
userEmail: string;
|
|
5
|
-
}) => {
|
|
6
|
-
pricingBoxIframeRef: import("react").RefObject<null>;
|
|
7
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { SubscriptionFlowV2 } from "./class-subscription-flow";
|
|
2
|
-
/**
|
|
3
|
-
* Hook to handle subscription logic
|
|
4
|
-
* @param subscriptionFlow Instance of SubscriptionFlow that manages different subscription states and actions
|
|
5
|
-
*/
|
|
6
|
-
export declare const useSubscriptionHandlerV2: (subscriptionFlow: SubscriptionFlowV2) => {
|
|
7
|
-
handleSubscriptionCheck: () => Promise<void>;
|
|
8
|
-
bannerButtonTriggerCallback: (trigger: string) => () => void;
|
|
9
|
-
CREDIT_INTERVAL_CHECK_COUNTER: number;
|
|
10
|
-
getBillingURL: (returnURL?: string) => Promise<string | null | undefined>;
|
|
11
|
-
getTopUpURL: () => Promise<string | null>;
|
|
12
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { OpUnitType } from "dayjs";
|
|
2
|
-
import duration from "dayjs/plugin/duration";
|
|
3
|
-
export declare const useDayJs: () => {
|
|
4
|
-
getTimeDifferenceBetweenTwoDates: (futureDate: string, pastDate: string, format?: OpUnitType) => number;
|
|
5
|
-
getDayJSDurationObjFromSeconds: (seconds: number) => duration.Duration;
|
|
6
|
-
generateFutureDateForNMinutes: (minute?: number) => string;
|
|
7
|
-
};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AuthProvider Component
|
|
3
|
-
*
|
|
4
|
-
* Provider that handles authentication state and route protection.
|
|
5
|
-
* It manages authentication checks, public route access, and redirects to auth SPA when needed.
|
|
6
|
-
*/
|
|
7
|
-
import React from "react";
|
|
8
|
-
import { StorageService } from "@iblai/data-layer";
|
|
9
|
-
export declare function getUserName(storageService: StorageService): Promise<any>;
|
|
10
|
-
export declare function useAuthProvider({ middleware, onAuthSuccess, onAuthFailure, redirectToAuthSpa, hasNonExpiredAuthToken, username, pathname, storageService, skipAuthCheck, }: Props): {
|
|
11
|
-
isAuthenticating: boolean;
|
|
12
|
-
userIsAccessingPublicRoute: boolean;
|
|
13
|
-
setUserIsAccessingPublicRoute: React.Dispatch<React.SetStateAction<boolean>>;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Type definition for the authentication context
|
|
17
|
-
* Tracks whether the user is accessing a public route and provides a setter
|
|
18
|
-
*/
|
|
19
|
-
export type AuthContextType = {
|
|
20
|
-
userIsAccessingPublicRoute: boolean;
|
|
21
|
-
setUserIsAccessingPublicRoute: (iuserIsAccessingPublicRoute: boolean) => void;
|
|
22
|
-
};
|
|
23
|
-
export declare const AuthContext: React.Context<AuthContextType | undefined>;
|
|
24
|
-
/**
|
|
25
|
-
* Hook to access the auth context
|
|
26
|
-
* @throws Error if used outside of AuthContextProvider
|
|
27
|
-
*/
|
|
28
|
-
export declare const useAuthContext: () => AuthContextType;
|
|
29
|
-
/**
|
|
30
|
-
* Context Provider component that wraps children with auth context
|
|
31
|
-
*/
|
|
32
|
-
export declare const AuthContextProvider: ({ value, children, }: {
|
|
33
|
-
value: AuthContextType;
|
|
34
|
-
children: React.ReactNode;
|
|
35
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
36
|
-
/**
|
|
37
|
-
* Props for the AuthProvider component
|
|
38
|
-
*/
|
|
39
|
-
type Props = {
|
|
40
|
-
children?: React.ReactNode;
|
|
41
|
-
fallback?: React.ReactNode;
|
|
42
|
-
middleware?: Map<string | RegExp, () => Promise<boolean>>;
|
|
43
|
-
onAuthSuccess?: () => void;
|
|
44
|
-
onAuthFailure?: (reason: string) => void;
|
|
45
|
-
redirectToAuthSpa: () => void;
|
|
46
|
-
hasNonExpiredAuthToken: () => boolean;
|
|
47
|
-
username: string;
|
|
48
|
-
pathname: string;
|
|
49
|
-
skipAuthCheck?: boolean;
|
|
50
|
-
storageService?: StorageService;
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* AuthProvider Component
|
|
54
|
-
*
|
|
55
|
-
* Main authentication provider that:
|
|
56
|
-
* 1. Checks if the current route requires authentication
|
|
57
|
-
* 2. Validates the auth token
|
|
58
|
-
* 3. Fetches user metadata to verify authentication
|
|
59
|
-
* 4. Handles redirects to auth SPA when needed
|
|
60
|
-
* 5. Manages public route access state
|
|
61
|
-
*/
|
|
62
|
-
export declare function AuthProvider({ children, fallback, middleware, onAuthSuccess, onAuthFailure, redirectToAuthSpa, hasNonExpiredAuthToken, username, pathname, skipAuthCheck, storageService, }: Props): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
63
|
-
export {};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MentorProvider Component
|
|
3
|
-
*
|
|
4
|
-
* Provider that manages AI mentor selection and redirection logic.
|
|
5
|
-
* It handles:
|
|
6
|
-
* - Mentor selection based on user preferences and history
|
|
7
|
-
* - Mentor seeding for new tenants
|
|
8
|
-
* - Redirection to appropriate mentor or creation flow
|
|
9
|
-
* - Integration with tenant context for access control
|
|
10
|
-
*/
|
|
11
|
-
import React from "react";
|
|
12
|
-
/**
|
|
13
|
-
* Props for the MentorProvider component
|
|
14
|
-
*/
|
|
15
|
-
type Props = {
|
|
16
|
-
children?: React.ReactNode;
|
|
17
|
-
fallback?: React.ReactNode;
|
|
18
|
-
onAuthSuccess?: () => void;
|
|
19
|
-
onAuthFailure?: (reason: string) => void;
|
|
20
|
-
redirectToAuthSpa: () => void;
|
|
21
|
-
redirectToMentor: (tenantKey: string, mentorId: string) => void;
|
|
22
|
-
redirectToNoMentorsPage: () => void;
|
|
23
|
-
redirectToCreateMentor: () => void;
|
|
24
|
-
username: string;
|
|
25
|
-
tenantKey: string;
|
|
26
|
-
isAdmin: boolean;
|
|
27
|
-
isMainTenant: boolean;
|
|
28
|
-
requestedMentorId?: string;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* MentorProvider Component
|
|
32
|
-
*
|
|
33
|
-
* Main mentor provider that:
|
|
34
|
-
* 1. Determines the most appropriate mentor for the user
|
|
35
|
-
* 2. Handles mentor seeding for new tenants
|
|
36
|
-
* 3. Manages redirection based on mentor availability
|
|
37
|
-
* 4. Integrates with tenant context for access control
|
|
38
|
-
*/
|
|
39
|
-
export declare function MentorProvider({ children, fallback, onAuthSuccess, onAuthFailure, redirectToAuthSpa, redirectToMentor, redirectToNoMentorsPage, redirectToCreateMentor, username, tenantKey, isAdmin, isMainTenant, requestedMentorId, }: Props): React.ReactNode;
|
|
40
|
-
export {};
|