@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.
Files changed (138) hide show
  1. package/dist/data-layer/src/core/index.d.ts +2 -1
  2. package/dist/data-layer/src/features/analytics/api-slice.d.ts +1879 -122
  3. package/dist/data-layer/src/features/analytics/constants.d.ts +56 -1
  4. package/dist/data-layer/src/features/analytics/types.d.ts +327 -1
  5. package/dist/data-layer/src/features/api-keys/api-slice.d.ts +59 -70
  6. package/dist/data-layer/src/features/apps/api-slice.d.ts +73 -84
  7. package/dist/data-layer/src/features/auth/api-slice.d.ts +504 -2
  8. package/dist/data-layer/src/features/auth/constants.d.ts +13 -1
  9. package/dist/data-layer/src/features/auth/types.d.ts +20 -0
  10. package/dist/data-layer/src/features/billing/api-slice.d.ts +33 -33
  11. package/dist/data-layer/src/features/career/api-slice.d.ts +2345 -180
  12. package/dist/data-layer/src/features/catalog/api-slice.d.ts +2578 -562
  13. package/dist/data-layer/src/features/chat/api-slice.d.ts +150 -150
  14. package/dist/data-layer/src/features/chat-history/api-slice.d.ts +134 -134
  15. package/dist/data-layer/src/features/core/api-slice.d.ts +3484 -75
  16. package/dist/data-layer/src/features/core/constants.d.ts +40 -0
  17. package/dist/data-layer/src/features/core/custom-api-slice.d.ts +1458 -0
  18. package/dist/data-layer/src/features/core/types.d.ts +27 -0
  19. package/dist/data-layer/src/features/credentials/api-slice.d.ts +859 -221
  20. package/dist/data-layer/src/features/custom-domain/api-slice.d.ts +602 -0
  21. package/dist/data-layer/src/features/custom-domain/constants.d.ts +20 -0
  22. package/dist/data-layer/src/features/custom-domain/types.d.ts +46 -0
  23. package/dist/data-layer/src/features/datasets/api-slice.d.ts +56 -56
  24. package/dist/data-layer/src/features/disclaimers/api-slice.d.ts +912 -0
  25. package/dist/data-layer/src/features/disclaimers/constants.d.ts +27 -0
  26. package/dist/data-layer/src/features/disclaimers/types.d.ts +67 -0
  27. package/dist/data-layer/src/features/edx-proctoring/api-slice.d.ts +590 -0
  28. package/dist/data-layer/src/features/edx-proctoring/constants.d.ts +15 -0
  29. package/dist/data-layer/src/features/edx-proctoring/types.d.ts +61 -0
  30. package/dist/data-layer/src/features/llms/api-slice.d.ts +40 -40
  31. package/dist/data-layer/src/features/memory/api-slice.d.ts +2129 -0
  32. package/dist/data-layer/src/features/memory/constants.d.ts +50 -0
  33. package/dist/data-layer/src/features/memory/types.d.ts +122 -0
  34. package/dist/data-layer/src/features/mentor/api-slice.d.ts +1176 -470
  35. package/dist/data-layer/src/features/mentor/constants.d.ts +8 -0
  36. package/dist/data-layer/src/features/mentor/custom-api-slice.d.ts +529 -1
  37. package/dist/data-layer/src/features/mentor/types.d.ts +39 -0
  38. package/dist/data-layer/src/features/mentor-categories/api-slice.d.ts +436 -40
  39. package/dist/data-layer/src/features/notifications/api-slice.d.ts +750 -96
  40. package/dist/data-layer/src/features/notifications/constants.d.ts +20 -0
  41. package/dist/data-layer/src/features/notifications/custom-api-slice.d.ts +996 -0
  42. package/dist/data-layer/src/features/notifications/types.d.ts +46 -0
  43. package/dist/data-layer/src/features/per-learner/api-slice.d.ts +118 -118
  44. package/dist/data-layer/src/features/platform/api-slice.d.ts +345 -191
  45. package/dist/data-layer/src/features/platform/constants.d.ts +17 -0
  46. package/dist/data-layer/src/features/platform/custom-api-slice.d.ts +493 -0
  47. package/dist/data-layer/src/features/platform/types.d.ts +48 -0
  48. package/dist/data-layer/src/features/projects/api-slice.d.ts +2026 -0
  49. package/dist/data-layer/src/features/projects/constants.d.ts +51 -0
  50. package/dist/data-layer/src/features/projects/types.d.ts +79 -0
  51. package/dist/data-layer/src/features/prompts/api-slice.d.ts +193 -171
  52. package/dist/data-layer/src/features/reports/api-slice.d.ts +814 -0
  53. package/dist/data-layer/src/features/search/ai-search-api-slice.d.ts +1015 -0
  54. package/dist/data-layer/src/features/search/api-slice.d.ts +59 -59
  55. package/dist/data-layer/src/features/search/constants.d.ts +31 -0
  56. package/dist/data-layer/src/features/search/types.d.ts +89 -0
  57. package/dist/data-layer/src/features/sessions/api-slice.d.ts +72 -72
  58. package/dist/data-layer/src/features/skills/api-slice.d.ts +157 -157
  59. package/dist/data-layer/src/features/stripe/api-slice.d.ts +201 -40
  60. package/dist/data-layer/src/features/stripe/constants.d.ts +5 -1
  61. package/dist/data-layer/src/features/stripe/types.d.ts +10 -0
  62. package/dist/data-layer/src/features/tenant/api-slice.d.ts +77 -86
  63. package/dist/data-layer/src/features/tenant/types.d.ts +1 -0
  64. package/dist/data-layer/src/features/tools/api-slice.d.ts +84 -40
  65. package/dist/data-layer/src/features/training-documents/api-slice.d.ts +582 -75
  66. package/dist/data-layer/src/features/user/api-slice.d.ts +124 -124
  67. package/dist/data-layer/src/features/user/constants.d.ts +3 -1
  68. package/dist/data-layer/src/features/user-invitations/api-slice.d.ts +56 -56
  69. package/dist/data-layer/src/features/utils.d.ts +8 -5
  70. package/dist/data-layer/src/index.d.ts +75 -47
  71. package/dist/data-layer/src/reducers/skills.d.ts +2 -1148
  72. package/dist/data-layer/src/services/StorageService.d.ts +1 -1
  73. package/dist/index.d.ts +1021 -5
  74. package/dist/index.esm.js +3299 -453
  75. package/dist/index.esm.js.map +1 -1
  76. package/dist/index.js +3305 -448
  77. package/dist/index.js.map +1 -1
  78. package/dist/package.json +34 -18
  79. package/dist/web-utils/src/features/chat/slice.d.ts +12 -0
  80. package/dist/web-utils/src/features/index.d.ts +1 -0
  81. package/dist/web-utils/src/features/tracking/__tests__/time-tracker.test.d.ts +1 -0
  82. package/dist/web-utils/src/features/tracking/examples.d.ts +4 -0
  83. package/dist/web-utils/src/features/tracking/index.d.ts +6 -0
  84. package/dist/web-utils/src/features/tracking/time-tracker.d.ts +29 -0
  85. package/dist/web-utils/src/features/tracking/use-time-tracker-native.d.ts +14 -0
  86. package/dist/web-utils/src/features/tracking/use-time-tracker.d.ts +14 -0
  87. package/dist/web-utils/src/hooks/chat/use-advanced-chat.d.ts +2 -2
  88. package/dist/web-utils/src/hooks/chat/use-chat-v2.d.ts +9 -1
  89. package/dist/web-utils/src/hooks/chat/use-get-chat-details.d.ts +2 -1
  90. package/dist/web-utils/src/hooks/chat/use-mentor-tools.d.ts +3 -0
  91. package/dist/web-utils/src/hooks/index.d.ts +1 -0
  92. package/dist/web-utils/src/hooks/subscription/class-subscription-flow.d.ts +6 -6
  93. package/dist/web-utils/src/hooks/subscription-v2/class-subscription-flow.d.ts +9 -8
  94. package/dist/web-utils/src/hooks/subscription-v2/use-external-pricing-plan.d.ts +1 -1
  95. package/dist/web-utils/src/hooks/tenant-metadata/use-tenant-metadata.d.ts +2 -1
  96. package/dist/web-utils/src/hooks/use-mentor-settings.d.ts +1 -0
  97. package/dist/web-utils/src/index.mobile.d.ts +10 -0
  98. package/dist/web-utils/src/index.web.d.ts +12 -0
  99. package/dist/web-utils/src/providers/auth-provider.d.ts +55 -1
  100. package/dist/web-utils/src/providers/mentor-provider.d.ts +3 -1
  101. package/dist/web-utils/src/providers/tenant-provider.d.ts +10 -5
  102. package/dist/web-utils/src/types/index.d.ts +9 -0
  103. package/dist/web-utils/src/utils/constants.d.ts +4 -0
  104. package/dist/web-utils/src/utils/helpers.d.ts +1 -0
  105. package/dist/web-utils/src/utils/platform.d.ts +7 -0
  106. package/dist/web-utils/tests/hooks/subscription/class-subscription-flow.test.d.ts +1 -0
  107. package/dist/web-utils/tests/hooks/subscription/constants.test.d.ts +1 -0
  108. package/dist/web-utils/tests/hooks/subscription/use-subscription-handler.test.d.ts +1 -0
  109. package/dist/web-utils/tests/hooks/use-day-js.test.d.ts +1 -0
  110. package/dist/web-utils/tests/setupTests.d.ts +5 -0
  111. package/dist/web-utils/tsconfig.tsbuildinfo +1 -0
  112. package/package.json +31 -17
  113. package/dist/features/chat/slice.d.ts +0 -59
  114. package/dist/features/index.d.ts +0 -1
  115. package/dist/hooks/chat/use-advanced-chat.d.ts +0 -41
  116. package/dist/hooks/chat/use-chat-v2.d.ts +0 -53
  117. package/dist/hooks/chat/use-chat.d.ts +0 -52
  118. package/dist/hooks/chat/use-get-chat-details.d.ts +0 -13
  119. package/dist/hooks/index.d.ts +0 -10
  120. package/dist/hooks/subscription/class-subscription-flow.d.ts +0 -70
  121. package/dist/hooks/subscription/constants.d.ts +0 -4
  122. package/dist/hooks/subscription/use-subscription-handler.d.ts +0 -11
  123. package/dist/hooks/subscription-v2/class-subscription-flow.d.ts +0 -62
  124. package/dist/hooks/subscription-v2/constants.d.ts +0 -5
  125. package/dist/hooks/subscription-v2/use-external-pricing-plan.d.ts +0 -7
  126. package/dist/hooks/subscription-v2/use-subscription-handler.d.ts +0 -12
  127. package/dist/hooks/use-day-js.d.ts +0 -7
  128. package/dist/providers/auth-provider.d.ts +0 -63
  129. package/dist/providers/index.d.ts +0 -3
  130. package/dist/providers/mentor-provider.d.ts +0 -40
  131. package/dist/providers/tenant-provider.d.ts +0 -60
  132. package/dist/types/chat.d.ts +0 -1
  133. package/dist/types/index.d.ts +0 -55
  134. package/dist/types/subscription.d.ts +0 -18
  135. package/dist/utils/constants.d.ts +0 -13
  136. package/dist/utils/data/advanced-tab.d.ts +0 -62
  137. package/dist/utils/helpers.d.ts +0 -1
  138. package/dist/utils/index.d.ts +0 -3
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iblai/web-utils",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",
@@ -10,44 +10,60 @@
10
10
  "scripts": {
11
11
  "build": "rollup -c",
12
12
  "watch": "rollup -c -w",
13
- "test": "jest",
14
- "test:watch": "jest --watch",
15
- "test:coverage": "jest --coverage"
13
+ "test": "vitest run",
14
+ "test:watch": "vitest",
15
+ "test:coverage": "vitest run --coverage",
16
+ "typecheck": "tsc --noEmit"
16
17
  },
17
18
  "keywords": [],
18
19
  "author": "",
19
20
  "license": "ISC",
20
21
  "description": "IBL Web Utils",
21
22
  "devDependencies": {
22
- "@rollup/plugin-commonjs": "^28.0.3",
23
- "@rollup/plugin-node-resolve": "^16.0.1",
24
- "@rollup/plugin-typescript": "^12.1.2",
23
+ "@eslint/js": "^9.39.1",
24
+ "@rollup/plugin-commonjs": "^28.0.9",
25
+ "@rollup/plugin-node-resolve": "^16.0.3",
26
+ "@rollup/plugin-typescript": "^12.3.0",
25
27
  "@testing-library/jest-dom": "6.6.3",
26
28
  "@testing-library/react": "16.3.0",
27
29
  "@types/jest": "29.5.14",
28
- "@types/node": "^22.15.20",
29
- "@types/react": "^19.0.10",
30
+ "@types/node": "^22.19.0",
31
+ "@types/react": "19.1.17",
32
+ "@typescript-eslint/eslint-plugin": "^8.46.3",
33
+ "@typescript-eslint/parser": "^8.46.3",
34
+ "@vitest/coverage-v8": "^3.2.4",
30
35
  "autoprefixer": "^10.4.21",
36
+ "eslint": "^9.39.1",
37
+ "eslint-config-prettier": "10.1.2",
38
+ "globals": "^16.5.0",
31
39
  "jest": "29.7.0",
32
40
  "jest-environment-jsdom": "29.7.0",
41
+ "jsdom": "^25.0.1",
42
+ "rollup-plugin-dts": "^6.2.3",
33
43
  "rollup-plugin-peer-deps-external": "^2.2.4",
34
44
  "rollup-plugin-strip-code": "^0.2.8",
35
45
  "rollup-plugin-typescript2": "^0.36.0",
36
46
  "ts-jest": "29.3.2",
37
- "typescript": "^5.8.3"
47
+ "typescript": "^5.9.3",
48
+ "vitest": "^3.2.4"
38
49
  },
39
50
  "dependencies": {
40
51
  "@iblai/data-layer": "workspace:*",
41
- "@reduxjs/toolkit": "^2.8.2",
42
- "dayjs": "^1.11.13",
43
- "rollup": "^4.41.0",
44
- "zod": "3.24.2",
52
+ "@reduxjs/toolkit": "^2.10.0",
53
+ "dayjs": "^1.11.19",
54
+ "jwt-decode": "^4.0.0",
45
55
  "react-redux": "^9.2.0",
46
- "rollup-plugin-copy": "^3.5.0"
56
+ "rollup": "^4.52.5",
57
+ "rollup-plugin-copy": "^3.5.0",
58
+ "zod": "3.24.2"
47
59
  },
48
60
  "peerDependencies": {
49
- "@iblai/iblai-api": "4.11.1-ai",
50
- "react": "19.0.0"
61
+ "@iblai/iblai-api": "4.79.0-ai",
62
+ "react": "19.1.0"
51
63
  },
52
- "packageManager": "pnpm@10.11.0"
64
+ "packageManager": "pnpm@10.11.0",
65
+ "publishConfig": {
66
+ "access": "public",
67
+ "registry": "https://registry.npmjs.org/"
68
+ }
53
69
  }
@@ -20,6 +20,7 @@ type ChatSliceState = {
20
20
  status: ChatStatus;
21
21
  tools: string[];
22
22
  token: string | null;
23
+ tokenEnabled: boolean;
23
24
  iframeContext: {
24
25
  hostInfo: {
25
26
  title: string;
@@ -28,6 +29,8 @@ type ChatSliceState = {
28
29
  pageContent: string;
29
30
  };
30
31
  documentFilter: Record<string, unknown> | null;
32
+ shouldStartNewChat: boolean;
33
+ showingSharedChat: boolean;
31
34
  };
32
35
  export declare const chatActions: import("@reduxjs/toolkit").CaseReducerActions<import("@reduxjs/toolkit").SliceCaseReducers<ChatSliceState>, string>;
33
36
  export declare const chatSliceReducerShared: import("@reduxjs/toolkit").Reducer<ChatSliceState>;
@@ -82,10 +85,19 @@ export declare const selectTools: (state: {
82
85
  export declare const selectToken: (state: {
83
86
  chatSliceShared: ChatSliceState;
84
87
  }) => string | null;
88
+ export declare const selectTokenEnabled: (state: {
89
+ chatSliceShared: ChatSliceState;
90
+ }) => boolean;
85
91
  export declare const selectActiveChatMessages: (state: {
86
92
  chatSliceShared: ChatSliceState;
87
93
  }) => Message[];
88
94
  export declare const selectNumberOfActiveChatMessages: (state: {
89
95
  chatSliceShared: ChatSliceState;
90
96
  }) => number;
97
+ export declare const selectShouldStartNewChat: (state: {
98
+ chatSliceShared: ChatSliceState;
99
+ }) => boolean;
100
+ export declare const selectShowingSharedChat: (state: {
101
+ chatSliceShared: ChatSliceState;
102
+ }) => boolean;
91
103
  export {};
@@ -1 +1,2 @@
1
1
  export * from "./chat/slice";
2
+ export * from "./tracking";
@@ -0,0 +1,4 @@
1
+ export declare function NextJsExample(): import("react/jsx-runtime").JSX.Element;
2
+ export declare function ReactNativeExample(): import("react/jsx-runtime").JSX.Element;
3
+ export declare function ApiIntegrationExample(): import("react/jsx-runtime").JSX.Element;
4
+ export declare function ConditionalTrackingExample(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ export { TimeTracker } from "./time-tracker";
2
+ export type { TimeTrackerConfig, TimeTrackerState } from "./time-tracker";
3
+ export { useTimeTracker } from "./use-time-tracker";
4
+ export type { UseTimeTrackerConfig, UseTimeTrackerReturn, } from "./use-time-tracker";
5
+ export { useTimeTrackerNative } from "./use-time-tracker-native";
6
+ export type { UseTimeTrackerNativeConfig, UseTimeTrackerNativeReturn, } from "./use-time-tracker-native";
@@ -0,0 +1,29 @@
1
+ export interface TimeTrackerConfig {
2
+ intervalSeconds: number;
3
+ onTimeUpdate: (url: string, timeSpent: number) => void;
4
+ getCurrentUrl: () => string;
5
+ onRouteChange?: (callback: () => void) => () => void;
6
+ }
7
+ export interface TimeTrackerState {
8
+ currentUrl: string;
9
+ startTime: number;
10
+ intervalId: number | null;
11
+ routeUnsubscribe: (() => void) | null;
12
+ }
13
+ export declare class TimeTracker {
14
+ private state;
15
+ private config;
16
+ constructor(config: TimeTrackerConfig);
17
+ private initialize;
18
+ private startTracking;
19
+ private clearInterval;
20
+ private resetTimer;
21
+ private getTimeSpent;
22
+ private sendTimeUpdate;
23
+ private handleRouteChange;
24
+ pause(): void;
25
+ resume(): void;
26
+ destroy(): void;
27
+ getCurrentUrl(): string;
28
+ getTimeSpentSinceLastReset(): number;
29
+ }
@@ -0,0 +1,14 @@
1
+ export interface UseTimeTrackerNativeConfig {
2
+ intervalSeconds: number;
3
+ onTimeUpdate: (url: string, timeSpent: number) => void;
4
+ getCurrentRoute: () => string;
5
+ onRouteChange?: (callback: () => void) => () => void;
6
+ enabled?: boolean;
7
+ }
8
+ export interface UseTimeTrackerNativeReturn {
9
+ pause: () => void;
10
+ resume: () => void;
11
+ getCurrentUrl: () => string;
12
+ getTimeSpentSinceLastReset: () => number;
13
+ }
14
+ export declare function useTimeTrackerNative(config: UseTimeTrackerNativeConfig): UseTimeTrackerNativeReturn;
@@ -0,0 +1,14 @@
1
+ export interface UseTimeTrackerConfig {
2
+ intervalSeconds: number;
3
+ onTimeUpdate: (url: string, timeSpent: number) => void;
4
+ enabled?: boolean;
5
+ getCurrentUrl?: () => string;
6
+ onRouteChange?: (callback: () => void) => () => void;
7
+ }
8
+ export interface UseTimeTrackerReturn {
9
+ pause: () => void;
10
+ resume: () => void;
11
+ getCurrentUrl: () => string;
12
+ getTimeSpentSinceLastReset: () => number;
13
+ }
14
+ export declare function useTimeTracker(config: UseTimeTrackerConfig): UseTimeTrackerReturn;
@@ -4,7 +4,7 @@ import { type AdvancedTab } from "../../utils";
4
4
  import { Message } from "./use-chat-v2";
5
5
  import { ChatStatus } from "../../features/chat/slice";
6
6
  type Props = {
7
- mode: ChatMode;
7
+ mode?: ChatMode;
8
8
  tenantKey: string;
9
9
  mentorId: string;
10
10
  username: string;
@@ -18,7 +18,7 @@ type Props = {
18
18
  mentorShareableToken?: string | null;
19
19
  on402Error?: (message: Record<string, unknown>) => void;
20
20
  };
21
- export declare function useAdvancedChat({ mode, tenantKey, mentorId, username, token, wsUrl, stopGenerationWsUrl, redirectToAuthSpa, errorHandler, sendMessageToParentWebsite, isPreviewMode, mentorShareableToken, on402Error, }: Props): {
21
+ export declare function useAdvancedChat({ tenantKey, mentorId, username, token, wsUrl, stopGenerationWsUrl, redirectToAuthSpa, errorHandler, sendMessageToParentWebsite, isPreviewMode, mentorShareableToken, on402Error, }: Props): {
22
22
  messages: Message[];
23
23
  isStreaming: boolean;
24
24
  status: ChatStatus;
@@ -1,5 +1,11 @@
1
1
  import type { AdvancedTab } from "../../utils/data/advanced-tab";
2
2
  import { ChatStatus } from "@web-utils/features";
3
+ type MessageActionTypes = "redirectToAuthSpaJoinTenant";
4
+ export interface MessageAction {
5
+ text: string;
6
+ type: "primary" | "danger";
7
+ actionType: MessageActionTypes;
8
+ }
3
9
  export interface Message {
4
10
  id: string;
5
11
  role: "user" | "assistant" | "system";
@@ -9,6 +15,7 @@ export interface Message {
9
15
  fileType?: string;
10
16
  contentType?: string;
11
17
  visible: boolean;
18
+ actions?: MessageAction[];
12
19
  }
13
20
  export type SendMessageOptions = {
14
21
  visible?: boolean;
@@ -53,4 +60,5 @@ export interface UseChatReturn {
53
60
  stopGenerating: () => void;
54
61
  resetConnection: () => void;
55
62
  }
56
- export declare const useChat: ({ wsUrl, wsToken, flowConfig, sessionId, stopGenerationWsUrl, activeTab, enableHaptics, hapticFeedback, store, errorHandler, onStatusChange, onStreamingChange, onStreamingMessageUpdate, onAddUserMessage, WebSocketImpl, redirectToAuthSpa, sendMessageToParentWebsite, on402Error, }: UseChatProps) => UseChatReturn;
63
+ export declare const useChat: ({ wsUrl, wsToken, flowConfig, sessionId, stopGenerationWsUrl, enableHaptics, hapticFeedback, store, errorHandler, onStatusChange, onStreamingChange, onStreamingMessageUpdate, WebSocketImpl, redirectToAuthSpa, sendMessageToParentWebsite, on402Error, }: UseChatProps) => UseChatReturn;
64
+ export {};
@@ -5,8 +5,9 @@ type Props = {
5
5
  mentorId: string;
6
6
  username: string;
7
7
  errorHandler?: (error: string) => void;
8
+ searchParams?: URLSearchParams | null;
8
9
  };
9
- export declare function useGetChatDetails({ mode, tenantKey, mentorId, username, errorHandler, }: Props): {
10
+ export declare function useGetChatDetails({ mode, tenantKey, mentorId, username, errorHandler, searchParams, }: Props): {
10
11
  isLoadingSessionIds: boolean;
11
12
  refetchSessionIds: () => Promise<void>;
12
13
  };
@@ -8,11 +8,14 @@ export declare function useMentorTools({ tenantKey, mentorId, username, errorHan
8
8
  tools: any;
9
9
  activeTools: string[];
10
10
  updateSessionTools: (tool: string) => Promise<void>;
11
+ setSessionTools: (tools: string[]) => Promise<void>;
11
12
  enableWebBrowsing: boolean;
12
13
  screenSharing: boolean;
13
14
  deepResearch: boolean;
14
15
  imageGeneration: boolean;
15
16
  codeInterpreter: boolean;
16
17
  promptsIsEnabled: boolean;
18
+ googleSlidesIsEnabled: boolean;
19
+ googleDocumentIsEnabled: boolean;
17
20
  };
18
21
  export {};
@@ -13,3 +13,4 @@ export * from "./profile/use-profile-image-upload";
13
13
  export * from "./chat/use-chat-v2";
14
14
  export * from "./tenant-metadata/use-tenant-metadata";
15
15
  export * from "./tenant-metadata/constants";
16
+ export * from "./use-mentor-settings";
@@ -17,7 +17,7 @@ export interface SubscriptionFlowConfig {
17
17
  * SubscriptionFlow class manages all subscription-related flows and user interactions
18
18
  * Handles free trial, usage limits, and subscription management
19
19
  */
20
- export declare class SubscriptionFlow {
20
+ export declare abstract class SubscriptionFlow {
21
21
  protected platformName: string;
22
22
  protected currentTenantKey: string;
23
23
  protected username: string;
@@ -36,21 +36,21 @@ export declare class SubscriptionFlow {
36
36
  * Handles the flow when user reaches their free usage limit
37
37
  * Updates banner with appropriate message based on remaining usage count
38
38
  */
39
- handleFreeUsageCountFlow(freeUsageCount: FreeUsageCount): void;
39
+ abstract handleFreeUsageCountFlow(freeUsageCount: FreeUsageCount): void;
40
40
  /**
41
41
  * Handles the flow when user's free trial period has ended
42
42
  * Updates banner and clears any existing trial interval
43
43
  */
44
- handleTrialEndedFlow(freeTrialIntervalID?: number): void;
44
+ abstract handleTrialEndedFlow(freeTrialIntervalID?: number): void;
45
45
  /**
46
46
  * Handles the flow for ongoing subscription period
47
47
  * Updates banner with remaining trial time and subscription options
48
48
  */
49
- handleSubscriptionOnGoingFlow(timeRemainingInString: string): void;
49
+ abstract handleSubscriptionOnGoingFlow(timeRemainingInString: string): void;
50
50
  /**
51
51
  * Handles redirection to external URLs with optional toast notification
52
52
  */
53
- handleRedirectToURLFlow(redirectUrl: string, toastMessage?: string): void;
53
+ abstract handleRedirectToURLFlow(redirectUrl: string, toastMessage?: string): void;
54
54
  /**
55
55
  * Displays the pricing modal for subscription options
56
56
  */
@@ -64,7 +64,7 @@ export declare class SubscriptionFlow {
64
64
  * Handles successful subscription completion
65
65
  * Shows success message and disables subscription banner
66
66
  */
67
- handleSuccessfullySubscribedFlow(message?: string): void;
67
+ abstract handleSuccessfullySubscribedFlow(message?: string): void;
68
68
  getMainTenantKey(): string;
69
69
  }
70
70
  export {};
@@ -3,6 +3,7 @@ interface Tenant {
3
3
  key: string;
4
4
  is_admin: boolean;
5
5
  org: string;
6
+ is_advertising?: boolean;
6
7
  }
7
8
  export interface SubscriptionFlowConfigV2 {
8
9
  platformName: string;
@@ -19,7 +20,7 @@ export interface SubscriptionFlowConfigV2 {
19
20
  * SubscriptionFlow class manages all subscription-related flows and user interactions
20
21
  * Handles free trial, usage limits, and subscription management
21
22
  */
22
- export declare class SubscriptionFlowV2 {
23
+ export declare abstract class SubscriptionFlowV2 {
23
24
  protected platformName: string;
24
25
  protected currentTenantKey: string;
25
26
  protected username: string;
@@ -39,18 +40,18 @@ export declare class SubscriptionFlowV2 {
39
40
  getUserEmail(): string;
40
41
  getMainTenantKey(): string;
41
42
  getMentorUrl(): string;
42
- handleRedirectToBillingPageFlow(billingUrl: string): void;
43
+ abstract handleRedirectToBillingPageFlow(billingUrl: string): void;
43
44
  handleBeforeTopUpCreditTriggerFlow(): void;
44
45
  handleBeforeBillingPageTriggerFlow(): void;
45
46
  /**
46
47
  * Handles the flow when user reaches their free usage limit
47
48
  * Updates banner with appropriate message based on remaining usage count
48
49
  */
49
- handleFreeUsageCountFlow(hasCredits: boolean, appExists: boolean): void;
50
+ abstract handleFreeUsageCountFlow(hasCredits: boolean, appExists: boolean): void;
50
51
  /**
51
52
  * Displays the pricing modal for subscription options
52
53
  */
53
- handlePricingPageDisplayFlow(stripeContext: StripeContextResponse): void;
54
+ abstract handlePricingPageDisplayFlow(stripeContext: StripeContextResponse, creditExhausted: boolean): void;
54
55
  /**
55
56
  * Displays error notification when payment flow fails
56
57
  */
@@ -60,16 +61,16 @@ export declare class SubscriptionFlowV2 {
60
61
  handlePaidPlanCreditExhaustedFlow(): void;
61
62
  handleProPlanCreditExhaustedFlow(): void;
62
63
  handleStudentOnPaidPlanCreditExhaustedFlow(): void;
63
- handleOpenContactAdminFlow(adminEmail: string): void;
64
- handleCreditExhaustedWithUserOnFreePackageFlow({ subscriptionId, expiryDate }: {
64
+ abstract handleOpenContactAdminFlow(adminEmail: string): void;
65
+ abstract handleCreditExhaustedWithUserOnFreePackageFlow({ subscriptionId, expiryDate, }: {
65
66
  subscriptionId: string;
66
67
  expiryDate: string;
67
68
  }): void;
68
- handleCreditExhaustedWithUserOnStarterPackageFlow({ subscriptionId, expiryDate }: {
69
+ abstract handleCreditExhaustedWithUserOnStarterPackageFlow({ subscriptionId, expiryDate, }: {
69
70
  subscriptionId: string;
70
71
  expiryDate: string;
71
72
  }): void;
72
- handleCreditExhaustedWithUserOnProPackageFlow({ expiryDate }: {
73
+ abstract handleCreditExhaustedWithUserOnProPackageFlow({ expiryDate, }: {
73
74
  expiryDate: string;
74
75
  }): void;
75
76
  handleFailureOnBillingPageTriggerFlow(): void;
@@ -1,5 +1,5 @@
1
1
  import { PricingModalData } from "@web-utils/types/subscription";
2
- export declare const useExternalPricingPlan: ({ pricingModalData, userEmail }: {
2
+ export declare const useExternalPricingPlan: ({ pricingModalData, userEmail, }: {
3
3
  pricingModalData: PricingModalData;
4
4
  userEmail: string;
5
5
  }) => {
@@ -1,8 +1,9 @@
1
- export declare const useTenantMetadata: ({ org, spa }: {
1
+ export declare const useTenantMetadata: ({ org, spa, }: {
2
2
  org: string;
3
3
  spa?: string;
4
4
  }) => {
5
5
  metadata: any;
6
+ platformName: string | undefined;
6
7
  isLoading: boolean;
7
8
  isError: boolean;
8
9
  isSkillsAssignmentsFeatureHidden: () => boolean;
@@ -16,6 +16,7 @@ export declare function useMentorSettings({ mentorId, tenantKey, username }: Pro
16
16
  mentorSlug: string | undefined;
17
17
  safetyDisclaimer: any;
18
18
  mentorTools: any;
19
+ allowAnonymous: boolean | undefined;
19
20
  };
20
21
  };
21
22
  export {};
@@ -0,0 +1,10 @@
1
+ export { useGetChatDetails } from './hooks/chat/use-get-chat-details';
2
+ export { useAdvancedChat } from './hooks/chat/use-advanced-chat';
3
+ export { useTimeTracker } from './features/tracking/use-time-tracker';
4
+ export { useMentorSettings } from './hooks/use-mentor-settings';
5
+ export type { ChatMode } from './types';
6
+ export { advancedTabsProperties, ANONYMOUS_USERNAME } from './utils';
7
+ export { isAlphaNumeric32 } from './utils';
8
+ export { getTimeAgo } from './utils';
9
+ export { getInitials } from './utils';
10
+ export { chatActions, selectSessionId } from './features/chat/slice';
@@ -0,0 +1,12 @@
1
+ export { useGetChatDetails } from './hooks/chat/use-get-chat-details';
2
+ export { useAdvancedChat } from './hooks/chat/use-advanced-chat';
3
+ export { useTimeTracker } from './features/tracking/use-time-tracker';
4
+ export { useMentorSettings } from './hooks/use-mentor-settings';
5
+ export type { ChatMode } from './types';
6
+ export { advancedTabsProperties, ANONYMOUS_USERNAME } from './utils';
7
+ export { isAlphaNumeric32 } from './utils';
8
+ export { getTimeAgo } from './utils';
9
+ export { getInitials } from './utils';
10
+ export { chatActions, selectSessionId } from './features/chat/slice';
11
+ export { AuthProvider, TenantProvider, MentorProvider } from './providers';
12
+ export { useSearchParams, useParams, useRouter, usePathname } from 'next/navigation';
@@ -3,9 +3,63 @@
3
3
  *
4
4
  * Provider that handles authentication state and route protection.
5
5
  * It manages authentication checks, public route access, and redirects to auth SPA when needed.
6
+ *
7
+ * Platform Support:
8
+ * - Web (Next.js): Uses cookies for cross-SPA synchronization
9
+ * - React Native (Expo): Uses AsyncStorage only (no cookies)
10
+ *
11
+ * IMPORTANT: Cross-SPA Synchronization (Web Only)
12
+ * ================================================
13
+ * On web platforms, this component uses cookies to keep authentication state synchronized
14
+ * across multiple SPAs (e.g., skills and mentor) that share the same domain.
15
+ *
16
+ * To ensure proper synchronization on web, you MUST call the following functions:
17
+ *
18
+ * 1. On Login:
19
+ * ```typescript
20
+ * await storageService.setItem(LOCAL_STORAGE_KEYS.USER_DATA, userData);
21
+ * await storageService.setItem(LOCAL_STORAGE_KEYS.CURRENT_TENANT, tenantKey);
22
+ * await storageService.setItem(LOCAL_STORAGE_KEYS.TENANTS, tenants);
23
+ * await syncAuthToCookies(storageService);
24
+ * ```
25
+ *
26
+ * 2. On Logout:
27
+ * ```typescript
28
+ * await storageService.clear();
29
+ * clearAuthCookies();
30
+ * ```
31
+ *
32
+ * 3. On Tenant Switch:
33
+ * ```typescript
34
+ * await storageService.setItem(LOCAL_STORAGE_KEYS.CURRENT_TENANT, newTenantKey);
35
+ * await syncAuthToCookies(storageService);
36
+ * ```
37
+ *
38
+ * The AuthProvider automatically (web only):
39
+ * - Syncs cookies to localStorage on mount
40
+ * - Polls for cookie changes every 2 seconds
41
+ * - Refreshes the page when cross-SPA changes are detected
42
+ * - Listens for storage events to update cookies when localStorage changes
43
+ *
44
+ * For React Native:
45
+ * - Relies on AsyncStorage only (handled by StorageService)
46
+ * - No cookie synchronization
47
+ * - No cross-app automatic sync
6
48
  */
7
49
  import React from "react";
8
50
  import { StorageService } from "@iblai/data-layer";
51
+ /**
52
+ * Sync authentication state to cookies (web only)
53
+ * Should be called on login, logout, and tenant switch
54
+ * On React Native, this is a no-op
55
+ */
56
+ export declare function syncAuthToCookies(storageService: StorageService): Promise<void>;
57
+ /**
58
+ * Clear all authentication cookies (web only)
59
+ * Should be called on logout
60
+ * On React Native, this is a no-op
61
+ */
62
+ export declare function clearAuthCookies(): void;
9
63
  export declare function getUserName(storageService: StorageService): Promise<any>;
10
64
  export declare function useAuthProvider({ middleware, onAuthSuccess, onAuthFailure, redirectToAuthSpa, hasNonExpiredAuthToken, username, pathname, storageService, skipAuthCheck, token, }: Props): {
11
65
  isAuthenticating: boolean;
@@ -42,7 +96,7 @@ type Props = {
42
96
  middleware?: Map<string | RegExp, () => Promise<boolean>>;
43
97
  onAuthSuccess?: () => void;
44
98
  onAuthFailure?: (reason: string) => void;
45
- redirectToAuthSpa: () => void;
99
+ redirectToAuthSpa: (redirectTo?: string, platformKey?: string, logout?: boolean) => void;
46
100
  hasNonExpiredAuthToken: () => boolean;
47
101
  username: string;
48
102
  pathname: string;
@@ -19,6 +19,7 @@ type Props = {
19
19
  onAuthFailure?: (reason: string) => void;
20
20
  redirectToAuthSpa: () => void;
21
21
  redirectToMentor: (tenantKey: string, mentorId: string) => void;
22
+ onLoadMentorsPermissions?: (rbacPermissions: Record<string, unknown> | undefined) => void;
22
23
  redirectToNoMentorsPage: () => void;
23
24
  redirectToCreateMentor: () => void;
24
25
  username: string;
@@ -26,6 +27,7 @@ type Props = {
26
27
  mainTenantKey: string;
27
28
  requestedMentorId?: string;
28
29
  handleMentorNotFound?: () => Promise<void>;
30
+ forceDetermineMentor?: boolean;
29
31
  };
30
32
  /**
31
33
  * MentorProvider Component
@@ -36,5 +38,5 @@ type Props = {
36
38
  * 3. Manages redirection based on mentor availability
37
39
  * 4. Integrates with tenant context for access control
38
40
  */
39
- export declare function MentorProvider({ children, fallback, onAuthSuccess, onAuthFailure, redirectToAuthSpa, redirectToMentor, redirectToNoMentorsPage, redirectToCreateMentor, username, isAdmin, mainTenantKey, requestedMentorId, handleMentorNotFound, }: Props): React.ReactNode;
41
+ export declare function MentorProvider({ children, fallback, onAuthSuccess, onAuthFailure, redirectToAuthSpa, redirectToMentor, onLoadMentorsPermissions, redirectToNoMentorsPage, redirectToCreateMentor, username, isAdmin, mainTenantKey, requestedMentorId, handleMentorNotFound, forceDetermineMentor, }: Props): React.ReactNode;
40
42
  export {};
@@ -9,8 +9,8 @@
9
9
  * - User-tenant relationship verification
10
10
  */
11
11
  import React from "react";
12
- import { z } from "zod";
13
- import { tenantSchema } from "@web-utils/types";
12
+ import { TokenResponse } from "@iblai/data-layer";
13
+ import { Tenant } from "@web-utils/types";
14
14
  /**
15
15
  * Type definition for the tenant context
16
16
  * Tracks whether the user's path needs to be determined and provides a setter
@@ -46,8 +46,13 @@ type Props = {
46
46
  currentTenant: string;
47
47
  requestedTenant: string;
48
48
  handleTenantSwitch: (tenant: string, saveRedirect: boolean) => Promise<void>;
49
- saveCurrentTenant: (tenant: z.infer<typeof tenantSchema>) => void;
50
- saveUserTenants: (tenants: z.infer<typeof tenantSchema>[]) => void;
49
+ saveCurrentTenant: (tenant: Tenant) => void;
50
+ saveUserTenants: (tenants: Tenant[]) => void;
51
+ saveVisitingTenant?: (tenant: Tenant) => void;
52
+ removeVisitingTenant?: () => void;
53
+ saveUserTokens?: (tokens: TokenResponse) => void;
54
+ saveTenant?: (tenant: string) => void;
55
+ onAutoJoinUserToTenant?: (platformName: string) => void;
51
56
  };
52
57
  /**
53
58
  * TenantProvider Component
@@ -59,5 +64,5 @@ type Props = {
59
64
  * 4. Handles tenant-specific domain redirects
60
65
  * 5. Maintains tenant access state
61
66
  */
62
- export declare function TenantProvider({ children, fallback, onAuthSuccess, onAuthFailure, currentTenant, requestedTenant, saveCurrentTenant, saveUserTenants, handleTenantSwitch, }: 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;
67
+ export declare function TenantProvider({ children, fallback, onAuthSuccess, onAuthFailure, currentTenant, requestedTenant, saveCurrentTenant, saveUserTenants, handleTenantSwitch, saveVisitingTenant, removeVisitingTenant, saveUserTokens, saveTenant, onAutoJoinUserToTenant, }: 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
68
  export {};
@@ -52,4 +52,13 @@ export interface Prompt {
52
52
  hide?: boolean;
53
53
  tag?: string;
54
54
  }
55
+ export interface Tenant {
56
+ key: string;
57
+ is_admin: boolean;
58
+ org: string;
59
+ name?: string;
60
+ platform_name: string;
61
+ is_advertising?: boolean;
62
+ }
55
63
  export * from "./chat";
64
+ export * from "./subscription";
@@ -1,5 +1,6 @@
1
1
  export declare const MENTOR_CHAT_DOCUMENTS_EXTENSIONS: string[];
2
2
  export declare const ANONYMOUS_USERNAME = "anonymous";
3
+ export declare const MAX_INITIAL_WEBSOCKET_CONNECTION_ATTEMPTS = 3;
3
4
  export declare const LOCAL_STORAGE_KEYS: {
4
5
  CURRENT_TENANT: string;
5
6
  TENANTS: string;
@@ -10,6 +11,7 @@ export declare const LOCAL_STORAGE_KEYS: {
10
11
  USER_TENANTS: string;
11
12
  EDX_TOKEN_KEY: string;
12
13
  DM_TOKEN_KEY: string;
14
+ DM_TOKEN_EXPIRES: string;
13
15
  };
14
16
  export declare const TOOLS: {
15
17
  readonly WEB_SEARCH: "web-search";
@@ -34,4 +36,6 @@ export declare const TOOLS: {
34
36
  readonly LESSON_PLAN: "lesson-plan";
35
37
  readonly SYLLABUS: "syllabus";
36
38
  readonly CANVAS: "canvas";
39
+ readonly GOOGLE_SLIDES: "google-slides";
40
+ readonly GOOGLE_DOCUMENT: "google-docs";
37
41
  };
@@ -4,3 +4,4 @@ export declare const ALPHANUMERIC_32_REGEX: RegExp;
4
4
  export declare const isAlphaNumeric32: (text: string) => boolean;
5
5
  export declare const addProtocolToUrl: (url: string) => string;
6
6
  export declare function getTimeAgo(createdAt: string): string;
7
+ export declare const formatRelativeTime: (timestamp: string) => string;
@@ -0,0 +1,7 @@
1
+ export declare const isReactNative: () => boolean;
2
+ export declare const isWeb: () => boolean;
3
+ export declare const isNode: () => string | false;
4
+ export declare const isExpo: () => any;
5
+ export declare const getPlatform: () => "react-native" | "web" | "node" | "unknown";
6
+ export declare const safeRequire: (moduleName: string) => any;
7
+ export declare const getNextNavigation: () => any;
@@ -0,0 +1 @@
1
+ export {};