@iblai/web-utils 0.2.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 (127) hide show
  1. package/dist/data-layer/src/config.d.ts +7 -0
  2. package/dist/data-layer/src/constants.d.ts +30 -0
  3. package/dist/data-layer/src/core/index.d.ts +4 -0
  4. package/dist/data-layer/src/features/analytics/api-slice.d.ts +1600 -0
  5. package/dist/data-layer/src/features/analytics/constants.d.ts +66 -0
  6. package/dist/data-layer/src/features/analytics/types.d.ts +100 -0
  7. package/dist/data-layer/src/features/api-keys/api-slice.d.ts +665 -0
  8. package/dist/data-layer/src/features/apps/api-slice.d.ts +683 -0
  9. package/dist/data-layer/src/features/auth/api-slice.d.ts +137 -0
  10. package/dist/data-layer/src/features/auth/constants.d.ts +8 -0
  11. package/dist/data-layer/src/features/auth/types.d.ts +13 -0
  12. package/dist/data-layer/src/features/billing/api-slice.d.ts +349 -0
  13. package/dist/data-layer/src/features/career/api-slice.d.ts +687 -0
  14. package/dist/data-layer/src/features/catalog/api-slice.d.ts +6602 -0
  15. package/dist/data-layer/src/features/chat/api-slice.d.ts +1832 -0
  16. package/dist/data-layer/src/features/chat-history/api-slice.d.ts +1386 -0
  17. package/dist/data-layer/src/features/constants.d.ts +3 -0
  18. package/dist/data-layer/src/features/core/api-slice.d.ts +653 -0
  19. package/dist/data-layer/src/features/core/constants.d.ts +4 -0
  20. package/dist/data-layer/src/features/credentials/api-slice.d.ts +2129 -0
  21. package/dist/data-layer/src/features/credentials/constants.d.ts +28 -0
  22. package/dist/data-layer/src/features/credentials/custom-api-slice.d.ts +1284 -0
  23. package/dist/data-layer/src/features/credentials/types.d.ts +16 -0
  24. package/dist/data-layer/src/features/datasets/api-slice.d.ts +576 -0
  25. package/dist/data-layer/src/features/llms/api-slice.d.ts +333 -0
  26. package/dist/data-layer/src/features/mentor/api-slice.d.ts +4298 -0
  27. package/dist/data-layer/src/features/mentor/constants.d.ts +31 -0
  28. package/dist/data-layer/src/features/mentor/custom-api-slice.d.ts +268 -0
  29. package/dist/data-layer/src/features/mentor/types.d.ts +38 -0
  30. package/dist/data-layer/src/features/mentor-categories/api-slice.d.ts +311 -0
  31. package/dist/data-layer/src/features/notifications/api-slice.d.ts +946 -0
  32. package/dist/data-layer/src/features/per-learner/api-slice.d.ts +1213 -0
  33. package/dist/data-layer/src/features/platform/api-slice.d.ts +1124 -0
  34. package/dist/data-layer/src/features/prompts/api-slice.d.ts +2276 -0
  35. package/dist/data-layer/src/features/search/api-slice.d.ts +1939 -0
  36. package/dist/data-layer/src/features/sessions/api-slice.d.ts +705 -0
  37. package/dist/data-layer/src/features/skills/api-slice.d.ts +1235 -0
  38. package/dist/data-layer/src/features/stripe/api-slice.d.ts +620 -0
  39. package/dist/data-layer/src/features/stripe/constants.d.ts +15 -0
  40. package/dist/data-layer/src/features/stripe/types.d.ts +9 -0
  41. package/dist/data-layer/src/features/tenant/api-slice.d.ts +759 -0
  42. package/dist/data-layer/src/features/tenant/constants.d.ts +11 -0
  43. package/dist/data-layer/src/features/tenant/types.d.ts +18 -0
  44. package/dist/data-layer/src/features/tenant-logo/api-slice.d.ts +349 -0
  45. package/dist/data-layer/src/features/tenant-logo/constants.d.ts +24 -0
  46. package/dist/data-layer/src/features/tools/api-slice.d.ts +333 -0
  47. package/dist/data-layer/src/features/training-documents/api-slice.d.ts +922 -0
  48. package/dist/data-layer/src/features/user/api-slice.d.ts +1703 -0
  49. package/dist/data-layer/src/features/user/constants.d.ts +40 -0
  50. package/dist/data-layer/src/features/user/types.d.ts +107 -0
  51. package/dist/data-layer/src/features/user-invitations/api-slice.d.ts +718 -0
  52. package/dist/data-layer/src/features/utils.d.ts +66 -0
  53. package/dist/data-layer/src/index.d.ts +47 -0
  54. package/dist/data-layer/src/reducers/index.d.ts +2 -0
  55. package/dist/data-layer/src/reducers/mentor.d.ts +2 -0
  56. package/dist/data-layer/src/reducers/skills.d.ts +1148 -0
  57. package/dist/data-layer/src/services/StorageService.d.ts +5 -0
  58. package/dist/data-layer/src/utils/index.d.ts +2 -0
  59. package/dist/features/chat/slice.d.ts +59 -0
  60. package/dist/features/index.d.ts +1 -0
  61. package/dist/hooks/chat/use-advanced-chat.d.ts +41 -0
  62. package/dist/hooks/chat/use-chat-v2.d.ts +53 -0
  63. package/dist/hooks/chat/use-chat.d.ts +52 -0
  64. package/dist/hooks/chat/use-get-chat-details.d.ts +13 -0
  65. package/dist/hooks/index.d.ts +10 -0
  66. package/dist/hooks/subscription/class-subscription-flow.d.ts +70 -0
  67. package/dist/hooks/subscription/constants.d.ts +4 -0
  68. package/dist/hooks/subscription/use-subscription-handler.d.ts +11 -0
  69. package/dist/hooks/subscription-v2/class-subscription-flow.d.ts +62 -0
  70. package/dist/hooks/subscription-v2/constants.d.ts +5 -0
  71. package/dist/hooks/subscription-v2/use-external-pricing-plan.d.ts +7 -0
  72. package/dist/hooks/subscription-v2/use-subscription-handler.d.ts +12 -0
  73. package/dist/hooks/use-day-js.d.ts +7 -0
  74. package/dist/index.d.ts +5 -0
  75. package/dist/index.esm.js +15076 -0
  76. package/dist/index.esm.js.map +1 -0
  77. package/dist/index.js +15160 -0
  78. package/dist/index.js.map +1 -0
  79. package/dist/package.json +53 -0
  80. package/dist/providers/auth-provider.d.ts +63 -0
  81. package/dist/providers/index.d.ts +3 -0
  82. package/dist/providers/mentor-provider.d.ts +40 -0
  83. package/dist/providers/tenant-provider.d.ts +60 -0
  84. package/dist/types/chat.d.ts +1 -0
  85. package/dist/types/index.d.ts +55 -0
  86. package/dist/types/subscription.d.ts +18 -0
  87. package/dist/utils/constants.d.ts +13 -0
  88. package/dist/utils/data/advanced-tab.d.ts +62 -0
  89. package/dist/utils/helpers.d.ts +1 -0
  90. package/dist/utils/index.d.ts +3 -0
  91. package/dist/web-utils/src/features/chat/slice.d.ts +91 -0
  92. package/dist/web-utils/src/features/index.d.ts +1 -0
  93. package/dist/web-utils/src/hooks/chat/use-advanced-chat.d.ts +48 -0
  94. package/dist/web-utils/src/hooks/chat/use-chat-v2.d.ts +56 -0
  95. package/dist/web-utils/src/hooks/chat/use-chat.d.ts +52 -0
  96. package/dist/web-utils/src/hooks/chat/use-get-chat-details.d.ts +13 -0
  97. package/dist/web-utils/src/hooks/chat/use-mentor-tools.d.ts +18 -0
  98. package/dist/web-utils/src/hooks/index.d.ts +15 -0
  99. package/dist/web-utils/src/hooks/profile/use-profile-image-upload.d.ts +13 -0
  100. package/dist/web-utils/src/hooks/profile/use-user-profile-update.d.ts +28 -0
  101. package/dist/web-utils/src/hooks/subscription/class-subscription-flow.d.ts +70 -0
  102. package/dist/web-utils/src/hooks/subscription/constants.d.ts +4 -0
  103. package/dist/web-utils/src/hooks/subscription/use-subscription-handler.d.ts +11 -0
  104. package/dist/web-utils/src/hooks/subscription-v2/class-subscription-flow.d.ts +77 -0
  105. package/dist/web-utils/src/hooks/subscription-v2/constants.d.ts +51 -0
  106. package/dist/web-utils/src/hooks/subscription-v2/use-external-pricing-plan.d.ts +7 -0
  107. package/dist/web-utils/src/hooks/subscription-v2/use-subscription-handler.d.ts +16 -0
  108. package/dist/web-utils/src/hooks/tenant-metadata/config-loader.d.ts +41 -0
  109. package/dist/web-utils/src/hooks/tenant-metadata/constants.d.ts +9 -0
  110. package/dist/web-utils/src/hooks/tenant-metadata/index.d.ts +5 -0
  111. package/dist/web-utils/src/hooks/tenant-metadata/types.d.ts +9 -0
  112. package/dist/web-utils/src/hooks/tenant-metadata/use-tenant-metadata.d.ts +24 -0
  113. package/dist/web-utils/src/hooks/use-day-js.d.ts +7 -0
  114. package/dist/web-utils/src/hooks/use-mentor-settings.d.ts +21 -0
  115. package/dist/web-utils/src/index.d.ts +5 -0
  116. package/dist/web-utils/src/providers/auth-provider.d.ts +64 -0
  117. package/dist/web-utils/src/providers/index.d.ts +3 -0
  118. package/dist/web-utils/src/providers/mentor-provider.d.ts +40 -0
  119. package/dist/web-utils/src/providers/tenant-provider.d.ts +63 -0
  120. package/dist/web-utils/src/types/chat.d.ts +1 -0
  121. package/dist/web-utils/src/types/index.d.ts +55 -0
  122. package/dist/web-utils/src/types/subscription.d.ts +18 -0
  123. package/dist/web-utils/src/utils/constants.d.ts +37 -0
  124. package/dist/web-utils/src/utils/data/advanced-tab.d.ts +62 -0
  125. package/dist/web-utils/src/utils/helpers.d.ts +6 -0
  126. package/dist/web-utils/src/utils/index.d.ts +3 -0
  127. package/package.json +56 -0
@@ -0,0 +1,15 @@
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-advanced-chat";
10
+ export * from "./chat/use-mentor-tools";
11
+ export * from "./profile/use-user-profile-update";
12
+ export * from "./profile/use-profile-image-upload";
13
+ export * from "./chat/use-chat-v2";
14
+ export * from "./tenant-metadata/use-tenant-metadata";
15
+ export * from "./tenant-metadata/constants";
@@ -0,0 +1,13 @@
1
+ import { UploadProfileImageResponse, RemoveProfileImageResponse } from '@iblai/data-layer';
2
+ export interface UseProfileImageUploadOptions {
3
+ onSuccess?: (imageUrl: string) => void;
4
+ onError?: (error: any) => void;
5
+ }
6
+ export interface UseProfileImageUploadReturn {
7
+ uploadImage: (file: File, username: string) => Promise<UploadProfileImageResponse>;
8
+ removeImage: (username: string) => Promise<RemoveProfileImageResponse>;
9
+ isLoading: boolean;
10
+ isRemoving: boolean;
11
+ error: any;
12
+ }
13
+ export declare function useProfileImageUpload(options?: UseProfileImageUploadOptions): UseProfileImageUploadReturn;
@@ -0,0 +1,28 @@
1
+ export interface UserProfileUpdateData {
2
+ name?: string;
3
+ title?: string;
4
+ about?: string;
5
+ social_links?: {
6
+ platform: string;
7
+ social_link: string;
8
+ }[];
9
+ public_metadata?: {
10
+ bio?: string;
11
+ name?: string;
12
+ about?: string;
13
+ language?: string;
14
+ social_links?: {
15
+ platform: string;
16
+ social_link: string;
17
+ }[];
18
+ [key: string]: any;
19
+ };
20
+ enable_sidebar_ai_mentor_display?: boolean;
21
+ enable_skills_leaderboard_display?: boolean;
22
+ }
23
+ export interface UseUserProfileUpdateResult {
24
+ updateProfile: (data: UserProfileUpdateData) => Promise<void>;
25
+ isLoading: boolean;
26
+ error: any;
27
+ }
28
+ export declare function useUserProfileUpdate(username: string): UseUserProfileUpdateResult;
@@ -0,0 +1,70 @@
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 {};
@@ -0,0 +1,4 @@
1
+ export declare const SUBSCRIPTION_TRIGGERS: {
2
+ PRICING_MODAL: string;
3
+ SUBSCRIBE_USER: string;
4
+ };
@@ -0,0 +1,11 @@
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
+ };
@@ -0,0 +1,77 @@
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
+ handleBeforeBillingPageTriggerFlow(): void;
45
+ /**
46
+ * Handles the flow when user reaches their free usage limit
47
+ * Updates banner with appropriate message based on remaining usage count
48
+ */
49
+ handleFreeUsageCountFlow(hasCredits: boolean, appExists: boolean): void;
50
+ /**
51
+ * Displays the pricing modal for subscription options
52
+ */
53
+ handlePricingPageDisplayFlow(stripeContext: StripeContextResponse): void;
54
+ /**
55
+ * Displays error notification when payment flow fails
56
+ */
57
+ handleFailureOnPaymentFlow(): void;
58
+ handleBeforePricingPageDisplayFlow(): void;
59
+ handleFailureOnTopUpCreditTriggerFlow(): void;
60
+ handlePaidPlanCreditExhaustedFlow(): void;
61
+ handleProPlanCreditExhaustedFlow(): void;
62
+ handleStudentOnPaidPlanCreditExhaustedFlow(): void;
63
+ handleOpenContactAdminFlow(adminEmail: string): void;
64
+ handleCreditExhaustedWithUserOnFreePackageFlow({ subscriptionId, expiryDate }: {
65
+ subscriptionId: string;
66
+ expiryDate: string;
67
+ }): void;
68
+ handleCreditExhaustedWithUserOnStarterPackageFlow({ subscriptionId, expiryDate }: {
69
+ subscriptionId: string;
70
+ expiryDate: string;
71
+ }): void;
72
+ handleCreditExhaustedWithUserOnProPackageFlow({ expiryDate }: {
73
+ expiryDate: string;
74
+ }): void;
75
+ handleFailureOnBillingPageTriggerFlow(): void;
76
+ }
77
+ export {};
@@ -0,0 +1,51 @@
1
+ export declare const SUBSCRIPTION_V2_TRIGGERS: {
2
+ PRICING_MODAL: string;
3
+ TOP_UP_CREDIT: string;
4
+ CONTACT_ADMIN: string;
5
+ BILLING_PAGE: string;
6
+ };
7
+ export declare const SUBSCRIPTION_MESSAGES: {
8
+ CREDIT_EXHAUSTED: {
9
+ FREE_PACKAGE: ({ expiryDate }: {
10
+ expiryDate: string;
11
+ }) => string;
12
+ STARTER_PACKAGE: ({ expiryDate }: {
13
+ expiryDate: string;
14
+ }) => string;
15
+ PRO_PACKAGE: ({ expiryDate }: {
16
+ expiryDate: string;
17
+ }) => string;
18
+ STUDENT_UNDER_PAID_PACKAGE_EMAIL_BODY: ({ currentTenantOrg, userEmail, }: {
19
+ currentTenantOrg: string;
20
+ userEmail: string;
21
+ }) => string;
22
+ STUDENT_UNDER_PAID_PACKAGE_EMAIL_SUBJECT: ({ currentTenantOrg, }: {
23
+ currentTenantOrg: string;
24
+ }) => string;
25
+ ADMIN: string;
26
+ STUDENT: string;
27
+ FREE_TRIAL_LIMIT: string;
28
+ NO_APP: string;
29
+ };
30
+ ACTION_BUTTONS: {
31
+ FREE_PACKAGE: string;
32
+ STARTER_PACKAGE: string;
33
+ PRO_PACKAGE: string;
34
+ UPGRADE: string;
35
+ TOP_UP: string;
36
+ CONTACT_ADMIN: string;
37
+ ADD_CREDITS: string;
38
+ };
39
+ TOAST_MESSAGES: {
40
+ PRICING_PAGE_LOAD_ERROR: string;
41
+ TOP_UP_CREDIT_TRIGGER_LOAD_ERROR: string;
42
+ REDIRECTING_BILLING_PAGE: string;
43
+ BILLING_PAGE_TRIGGER_LOAD_ERROR: string;
44
+ };
45
+ };
46
+ export declare const SUBSCRIPTION_PACKAGES: {
47
+ PRE_FREE_PACKAGE: string;
48
+ FREE_PACKAGE: (productName: string) => string;
49
+ STARTER_PACKAGE: (productName: string) => string;
50
+ PRO_PACKAGE: (productName: string) => string;
51
+ };
@@ -0,0 +1,7 @@
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
+ };
@@ -0,0 +1,16 @@
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) => ((returnURL?: string) => Promise<void>) | (() => void);
9
+ CREDIT_INTERVAL_CHECK_COUNTER: number;
10
+ getBillingURL: ({ returnURL, includeSubscriptionIdIfNeeded, }: {
11
+ returnURL: string;
12
+ includeSubscriptionIdIfNeeded?: boolean;
13
+ }) => Promise<string | null | undefined>;
14
+ getTopUpURL: (obtainBillingPageURLIfNeeded?: boolean) => Promise<string | null | undefined>;
15
+ getUserSubscriptionPackage: () => Promise<string | null>;
16
+ };
@@ -0,0 +1,41 @@
1
+ import { TenantMetadata } from "./types";
2
+ declare const CONFIG_MAP: {
3
+ base: ConfigFile;
4
+ skillsAI: ConfigFile;
5
+ mentorAI: ConfigFile;
6
+ };
7
+ export interface ConfigSetting {
8
+ slug: string;
9
+ label: string;
10
+ defaultValue: any;
11
+ description: string;
12
+ type: "boolean" | "string" | "number";
13
+ SPA?: string;
14
+ }
15
+ export interface ConfigFile {
16
+ spa?: string;
17
+ settings: ConfigSetting[];
18
+ }
19
+ /**
20
+ * Loads all metadata configurations for a given SPA
21
+ * @param spa - The SPA identifier (e.g., 'mentorAI', 'skillsAI', 'mentor', 'skills'). If not provided, returns all SPAs
22
+ * @returns Array of TenantMetadata objects
23
+ */
24
+ export declare function loadMetadataConfig(spa?: string): TenantMetadata[];
25
+ /**
26
+ * Gets all available SPAs from the configuration
27
+ * @returns Array of SPA identifiers
28
+ */
29
+ export declare function getAvailableSPAs(): string[];
30
+ /**
31
+ * Gets configuration for a specific SPA
32
+ * @param spa - The SPA identifier
33
+ * @returns ConfigFile object or null if not found
34
+ */
35
+ export declare function getSPAConfig(spa: string): ConfigFile | null;
36
+ /**
37
+ * Gets all configurations
38
+ * @returns Object with all configurations
39
+ */
40
+ export declare function getAllConfigs(): typeof CONFIG_MAP;
41
+ export {};
@@ -0,0 +1,9 @@
1
+ export interface TenantMetadata {
2
+ slug: string;
3
+ label: string;
4
+ defaultValue: any;
5
+ SPA?: string;
6
+ value?: any;
7
+ }
8
+ export declare const METADATAS: import("./types").TenantMetadata[];
9
+ export { loadMetadataConfig } from './config-loader';
@@ -0,0 +1,5 @@
1
+ export { useTenantMetadata } from './use-tenant-metadata';
2
+ export { loadMetadataConfig, getAvailableSPAs, getSPAConfig, getAllConfigs } from './config-loader';
3
+ export type { TenantMetadata } from './types';
4
+ export type { ConfigSetting, ConfigFile } from './config-loader';
5
+ export { METADATAS } from './constants';
@@ -0,0 +1,9 @@
1
+ export interface TenantMetadata {
2
+ slug: string;
3
+ label: string;
4
+ defaultValue: any;
5
+ SPA?: string;
6
+ value?: any;
7
+ description?: string;
8
+ type?: "boolean" | "string" | "number";
9
+ }
@@ -0,0 +1,24 @@
1
+ export declare const useTenantMetadata: ({ org, spa }: {
2
+ org: string;
3
+ spa?: string;
4
+ }) => {
5
+ metadata: any;
6
+ isLoading: boolean;
7
+ isError: boolean;
8
+ isSkillsAssignmentsFeatureHidden: () => boolean;
9
+ isSkillsResumeFeatureHidden: () => boolean;
10
+ isMentorAIEnabled: () => boolean;
11
+ isSkillsLeaderBoardEnabled: () => boolean;
12
+ getEmbeddedMentorToUse: () => any;
13
+ metadataLoaded: any;
14
+ getAllMetadatas: () => {
15
+ value: any;
16
+ slug: string;
17
+ label: string;
18
+ defaultValue: any;
19
+ SPA?: string;
20
+ description?: string;
21
+ type?: "boolean" | "string" | "number";
22
+ }[];
23
+ getSupportEmail: () => any;
24
+ };
@@ -0,0 +1,7 @@
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
+ };
@@ -0,0 +1,21 @@
1
+ type Props = {
2
+ mentorId: string;
3
+ tenantKey: string;
4
+ username: string;
5
+ };
6
+ export declare function useMentorSettings({ mentorId, tenantKey, username }: Props): {
7
+ data: {
8
+ profileImage: string | null | undefined;
9
+ greetingMethod: string | undefined;
10
+ proactiveResponse: string | undefined;
11
+ llmProvider: any;
12
+ llmName: string | undefined;
13
+ mentorUniqueId: string | undefined;
14
+ mentorName: string | undefined;
15
+ enableGuidedPrompts: boolean | undefined;
16
+ mentorSlug: string | undefined;
17
+ safetyDisclaimer: any;
18
+ mentorTools: any;
19
+ };
20
+ };
21
+ export {};
@@ -0,0 +1,5 @@
1
+ export * from "./hooks";
2
+ export * from "./providers";
3
+ export * from "./utils";
4
+ export * from "./types";
5
+ export * from "./features";
@@ -0,0 +1,64 @@
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, token, }: 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
+ token?: string;
52
+ };
53
+ /**
54
+ * AuthProvider Component
55
+ *
56
+ * Main authentication provider that:
57
+ * 1. Checks if the current route requires authentication
58
+ * 2. Validates the auth token
59
+ * 3. Fetches user metadata to verify authentication
60
+ * 4. Handles redirects to auth SPA when needed
61
+ * 5. Manages public route access state
62
+ */
63
+ export declare function AuthProvider({ children, fallback, middleware, onAuthSuccess, onAuthFailure, redirectToAuthSpa, hasNonExpiredAuthToken, username, pathname, skipAuthCheck, storageService, token, }: 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;
64
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from "./auth-provider";
2
+ export * from "./mentor-provider";
3
+ export * from "./tenant-provider";
@@ -0,0 +1,40 @@
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
+ isAdmin: boolean;
26
+ mainTenantKey: string;
27
+ requestedMentorId?: string;
28
+ handleMentorNotFound?: () => Promise<void>;
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, isAdmin, mainTenantKey, requestedMentorId, handleMentorNotFound, }: Props): React.ReactNode;
40
+ export {};
@@ -0,0 +1,63 @@
1
+ /**
2
+ * TenantProvider
3
+ *
4
+ * Provider that manages tenant-related state and access control.
5
+ * It handles:
6
+ * - Tenant validation and access control
7
+ * - Tenant switching logic
8
+ * - Tenant metadata retrieval
9
+ * - User-tenant relationship verification
10
+ */
11
+ import React from "react";
12
+ import { z } from "zod";
13
+ import { tenantSchema } from "@web-utils/types";
14
+ /**
15
+ * Type definition for the tenant context
16
+ * Tracks whether the user's path needs to be determined and provides a setter
17
+ */
18
+ export type TenantContextType = {
19
+ determineUserPath: boolean;
20
+ setDetermineUserPath: (value: boolean) => void;
21
+ tenantKey: string;
22
+ metadata: Record<string, any>;
23
+ setMetadata: (metadata: Record<string, any>) => void;
24
+ };
25
+ export declare const TenantContext: React.Context<TenantContextType | undefined>;
26
+ /**
27
+ * Context Provider component that wraps children with tenant context
28
+ */
29
+ export declare const TenantContextProvider: React.FC<{
30
+ value: TenantContextType;
31
+ children: React.ReactNode;
32
+ }>;
33
+ /**
34
+ * Hook to access the tenant context
35
+ * @returns TenantContextType
36
+ */
37
+ export declare const useTenantContext: () => TenantContextType;
38
+ /**
39
+ * Props for the TenantProvider component
40
+ */
41
+ type Props = {
42
+ children?: React.ReactNode;
43
+ fallback?: React.ReactNode;
44
+ onAuthSuccess?: () => void;
45
+ onAuthFailure?: (reason: string) => void;
46
+ currentTenant: string;
47
+ requestedTenant: string;
48
+ handleTenantSwitch: (tenant: string, saveRedirect: boolean) => Promise<void>;
49
+ saveCurrentTenant: (tenant: z.infer<typeof tenantSchema>) => void;
50
+ saveUserTenants: (tenants: z.infer<typeof tenantSchema>[]) => void;
51
+ };
52
+ /**
53
+ * TenantProvider Component
54
+ *
55
+ * Main tenant provider that:
56
+ * 1. Validates user's access to requested tenant
57
+ * 2. Manages tenant switching
58
+ * 3. Retrieves and validates tenant metadata
59
+ * 4. Handles tenant-specific domain redirects
60
+ * 5. Maintains tenant access state
61
+ */
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;
63
+ export {};
@@ -0,0 +1 @@
1
+ export type ChatMode = "advanced" | "default";
@@ -0,0 +1,55 @@
1
+ import { z } from "zod";
2
+ export declare const userDataSchema: z.ZodObject<{
3
+ user_display_name: z.ZodString;
4
+ user_email: z.ZodString;
5
+ user_fullname: z.ZodString;
6
+ user_id: z.ZodNumber;
7
+ user_nicename: z.ZodString;
8
+ }, "strip", z.ZodTypeAny, {
9
+ user_display_name: string;
10
+ user_email: string;
11
+ user_fullname: string;
12
+ user_id: number;
13
+ user_nicename: string;
14
+ }, {
15
+ user_display_name: string;
16
+ user_email: string;
17
+ user_fullname: string;
18
+ user_id: number;
19
+ user_nicename: string;
20
+ }>;
21
+ export declare const tenantSchema: z.ZodObject<{
22
+ key: z.ZodString;
23
+ is_admin: z.ZodBoolean;
24
+ org: z.ZodString;
25
+ }, "strip", z.ZodTypeAny, {
26
+ key: string;
27
+ is_admin: boolean;
28
+ org: string;
29
+ }, {
30
+ key: string;
31
+ is_admin: boolean;
32
+ org: string;
33
+ }>;
34
+ export declare const tenantKeySchema: z.ZodString;
35
+ export type TenantKeyMentorIdParams = {
36
+ tenantKey: string;
37
+ mentorId: string;
38
+ };
39
+ export interface TopTrialBannerProps {
40
+ parentContainer: string;
41
+ bannerText?: string;
42
+ onUpgrade?: string;
43
+ loading?: boolean;
44
+ tooltipText?: string;
45
+ }
46
+ export interface Prompt {
47
+ type: "static" | "human" | "ai";
48
+ icon?: string;
49
+ summary?: string;
50
+ content?: string;
51
+ proactive?: boolean;
52
+ hide?: boolean;
53
+ tag?: string;
54
+ }
55
+ export * from "./chat";