@iblai/web-utils 0.2.0 → 0.3.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.
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 +37 -22
  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/package.json CHANGED
@@ -1,56 +1,71 @@
1
1
  {
2
2
  "name": "@iblai/web-utils",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "files": [
8
8
  "dist"
9
9
  ],
10
+ "scripts": {
11
+ "build": "rollup -c",
12
+ "watch": "rollup -c -w",
13
+ "test": "vitest run",
14
+ "test:watch": "vitest",
15
+ "test:coverage": "vitest run --coverage",
16
+ "typecheck": "tsc --noEmit"
17
+ },
10
18
  "keywords": [],
11
19
  "author": "",
12
20
  "license": "ISC",
13
21
  "description": "IBL Web Utils",
14
22
  "devDependencies": {
15
- "@rollup/plugin-commonjs": "^28.0.3",
16
- "@rollup/plugin-node-resolve": "^16.0.1",
17
- "@rollup/plugin-typescript": "^12.1.2",
23
+ "@eslint/js": "^9.39.1",
24
+ "@rollup/plugin-commonjs": "^28.0.9",
25
+ "@rollup/plugin-json": "^6.1.0",
26
+ "@rollup/plugin-node-resolve": "^16.0.3",
27
+ "@rollup/plugin-typescript": "^12.3.0",
18
28
  "@testing-library/jest-dom": "6.6.3",
19
29
  "@testing-library/react": "16.3.0",
20
30
  "@types/jest": "29.5.14",
21
- "@types/node": "^22.15.20",
22
- "@types/react": "^19.0.10",
31
+ "@types/node": "^22.19.0",
32
+ "@types/react": "19.1.17",
33
+ "@typescript-eslint/eslint-plugin": "^8.46.3",
34
+ "@typescript-eslint/parser": "^8.46.3",
35
+ "@vitest/coverage-v8": "^3.2.4",
23
36
  "autoprefixer": "^10.4.21",
37
+ "eslint": "^9.39.1",
38
+ "eslint-config-prettier": "10.1.2",
39
+ "globals": "^16.5.0",
24
40
  "jest": "29.7.0",
25
41
  "jest-environment-jsdom": "29.7.0",
42
+ "jsdom": "^25.0.1",
43
+ "rollup-plugin-dts": "^6.2.3",
26
44
  "rollup-plugin-peer-deps-external": "^2.2.4",
27
45
  "rollup-plugin-strip-code": "^0.2.8",
28
46
  "rollup-plugin-typescript2": "^0.36.0",
29
47
  "ts-jest": "29.3.2",
30
- "typescript": "^5.8.3"
48
+ "typescript": "^5.9.3",
49
+ "vitest": "^3.2.4"
31
50
  },
32
51
  "dependencies": {
33
- "@reduxjs/toolkit": "^2.8.2",
34
- "dayjs": "^1.11.13",
35
- "rollup": "^4.41.0",
36
- "zod": "3.24.2",
52
+ "@iblai/data-layer": "workspace:*",
53
+ "@reduxjs/toolkit": "^2.10.0",
54
+ "axios": "^1.13.1",
55
+ "dayjs": "^1.11.19",
56
+ "jwt-decode": "^4.0.0",
37
57
  "react-redux": "^9.2.0",
58
+ "rollup": "^4.52.5",
38
59
  "rollup-plugin-copy": "^3.5.0",
39
- "@iblai/data-layer": "0.2.0"
60
+ "zod": "3.24.2"
40
61
  },
41
62
  "peerDependencies": {
42
- "@iblai/iblai-api": "4.11.1-ai",
43
- "react": "19.0.0"
63
+ "@iblai/iblai-api": "4.79.0-ai",
64
+ "react": "19.1.0"
44
65
  },
66
+ "packageManager": "pnpm@10.11.0",
45
67
  "publishConfig": {
46
68
  "access": "public",
47
69
  "registry": "https://registry.npmjs.org/"
48
- },
49
- "scripts": {
50
- "build": "rollup -c",
51
- "watch": "rollup -c -w",
52
- "test": "jest",
53
- "test:watch": "jest --watch",
54
- "test:coverage": "jest --coverage"
55
70
  }
56
- }
71
+ }
@@ -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 {};
@@ -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 {};
@@ -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,4 +0,0 @@
1
- export declare const SUBSCRIPTION_TRIGGERS: {
2
- PRICING_MODAL: string;
3
- SUBSCRIBE_USER: string;
4
- };
@@ -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,5 +0,0 @@
1
- export declare const SUBSCRIPTION_V2_TRIGGERS: {
2
- PRICING_MODAL: string;
3
- TOP_UP_CREDIT: string;
4
- CONTACT_ADMIN: string;
5
- };
@@ -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,3 +0,0 @@
1
- export * from "./auth-provider";
2
- export * from "./mentor-provider";
3
- export * from "./tenant-provider";
@@ -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 {};