@iblai/web-utils 1.11.8 → 1.11.10

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 (300) hide show
  1. package/dist/auth/index.esm.js.map +1 -1
  2. package/dist/auth/index.js.map +1 -1
  3. package/dist/auth/web-utils/src/__tests__/index.mobile.test.d.ts +7 -0
  4. package/dist/auth/web-utils/src/__tests__/index.web.test.d.ts +8 -0
  5. package/dist/auth/web-utils/src/constants/__tests__/chat.test.d.ts +1 -0
  6. package/dist/auth/web-utils/src/constants/chat.d.ts +8 -0
  7. package/dist/auth/web-utils/src/features/apple-restriction/__tests__/slice.test.d.ts +1 -0
  8. package/dist/auth/web-utils/src/features/apple-restriction/slice.d.ts +7 -0
  9. package/dist/auth/web-utils/src/features/chat/__tests__/slice.test.d.ts +1 -0
  10. package/dist/auth/web-utils/src/features/chat/slice.d.ts +164 -0
  11. package/dist/auth/web-utils/src/features/chat-input/__tests__/api-slice.test.d.ts +1 -0
  12. package/dist/auth/web-utils/src/features/chat-input/api-slice.d.ts +12 -0
  13. package/dist/auth/web-utils/src/features/csv/combine-csv.d.ts +35 -0
  14. package/dist/auth/web-utils/src/features/csv/index.d.ts +1 -0
  15. package/dist/auth/web-utils/src/features/files/__tests__/filesSlice.test.d.ts +1 -0
  16. package/dist/auth/web-utils/src/features/files/filesSlice.d.ts +23 -0
  17. package/dist/auth/web-utils/src/features/host-chat/__tests__/slice.test.d.ts +1 -0
  18. package/dist/auth/web-utils/src/features/host-chat/slice.d.ts +17 -0
  19. package/dist/auth/web-utils/src/features/index.d.ts +11 -0
  20. package/dist/auth/web-utils/src/features/monetization/__tests__/slice.test.d.ts +1 -0
  21. package/dist/auth/web-utils/src/features/monetization/slice.d.ts +16 -0
  22. package/dist/auth/web-utils/src/features/rbac/__tests__/rbac-slice.test.d.ts +1 -0
  23. package/dist/auth/web-utils/src/features/rbac/rbac-slice.d.ts +13 -0
  24. package/dist/auth/web-utils/src/features/subscription/__tests__/slice.test.d.ts +1 -0
  25. package/dist/auth/web-utils/src/features/subscription/constants.d.ts +12 -0
  26. package/dist/auth/web-utils/src/features/subscription/slice.d.ts +28 -0
  27. package/dist/auth/web-utils/src/features/top-banner/__tests__/slice.test.d.ts +1 -0
  28. package/dist/auth/web-utils/src/features/top-banner/slice.d.ts +24 -0
  29. package/dist/auth/web-utils/src/features/tracking/__tests__/time-tracker.test.d.ts +1 -0
  30. package/dist/auth/web-utils/src/features/tracking/examples.d.ts +4 -0
  31. package/dist/auth/web-utils/src/features/tracking/index.d.ts +6 -0
  32. package/dist/auth/web-utils/src/features/tracking/time-tracker.d.ts +29 -0
  33. package/dist/auth/web-utils/src/features/tracking/use-time-tracker-native.d.ts +14 -0
  34. package/dist/auth/web-utils/src/features/tracking/use-time-tracker.d.ts +14 -0
  35. package/dist/auth/web-utils/src/hoc/index.d.ts +2 -0
  36. package/dist/auth/web-utils/src/hoc/with-permissions.d.ts +44 -0
  37. package/dist/auth/web-utils/src/hooks/__tests__/use-accessing-public-route.test.d.ts +1 -0
  38. package/dist/auth/web-utils/src/hooks/__tests__/use-cached-session-id.test.d.ts +1 -0
  39. package/dist/auth/web-utils/src/hooks/__tests__/use-chat-file-upload.test.d.ts +1 -0
  40. package/dist/auth/web-utils/src/hooks/__tests__/use-embed-mode.test.d.ts +1 -0
  41. package/dist/auth/web-utils/src/hooks/__tests__/use-event-callback.test.d.ts +1 -0
  42. package/dist/auth/web-utils/src/hooks/__tests__/use-event-listener.test.d.ts +1 -0
  43. package/dist/auth/web-utils/src/hooks/__tests__/use-file-drag-drop.test.d.ts +1 -0
  44. package/dist/auth/web-utils/src/hooks/__tests__/use-local-storage.test.d.ts +1 -0
  45. package/dist/auth/web-utils/src/hooks/__tests__/use-mentor-settings.test.d.ts +1 -0
  46. package/dist/auth/web-utils/src/hooks/__tests__/use-model-file-upload-capabilities.test.d.ts +1 -0
  47. package/dist/auth/web-utils/src/hooks/__tests__/use-os.test.d.ts +1 -0
  48. package/dist/auth/web-utils/src/hooks/__tests__/use-responsive.test.d.ts +1 -0
  49. package/dist/auth/web-utils/src/hooks/__tests__/use-show-attachment.test.d.ts +1 -0
  50. package/dist/auth/web-utils/src/hooks/__tests__/use-show-free-trial-dialog.test.d.ts +1 -0
  51. package/dist/auth/web-utils/src/hooks/__tests__/use-show-voice-call.test.d.ts +1 -0
  52. package/dist/auth/web-utils/src/hooks/__tests__/use-show-voice-recorder.test.d.ts +1 -0
  53. package/dist/auth/web-utils/src/hooks/__tests__/use-timer.test.d.ts +1 -0
  54. package/dist/auth/web-utils/src/hooks/__tests__/use-tokens.test.d.ts +1 -0
  55. package/dist/auth/web-utils/src/hooks/__tests__/use-user-agreement.test.d.ts +1 -0
  56. package/dist/auth/web-utils/src/hooks/__tests__/use-user.test.d.ts +1 -0
  57. package/dist/auth/web-utils/src/hooks/__tests__/use-voice-chat.test.d.ts +1 -0
  58. package/dist/auth/web-utils/src/hooks/__tests__/use-welcome-message.test.d.ts +1 -0
  59. package/dist/auth/web-utils/src/hooks/chat/__tests__/chat-history.utils.test.d.ts +1 -0
  60. package/dist/auth/web-utils/src/hooks/chat/chat-history.utils.d.ts +10 -0
  61. package/dist/auth/web-utils/src/hooks/chat/ollama-client.d.ts +57 -0
  62. package/dist/auth/web-utils/src/hooks/chat/use-advanced-chat.d.ts +61 -0
  63. package/dist/auth/web-utils/src/hooks/chat/use-advanced-chat.test.d.ts +1 -0
  64. package/dist/auth/web-utils/src/hooks/chat/use-chat-history.d.ts +17 -0
  65. package/dist/auth/web-utils/src/hooks/chat/use-chat-v2.d.ts +146 -0
  66. package/dist/auth/web-utils/src/hooks/chat/use-chat-v2.test.d.ts +1 -0
  67. package/dist/auth/web-utils/src/hooks/chat/use-chat.d.ts +53 -0
  68. package/dist/auth/web-utils/src/hooks/chat/use-get-chat-details.d.ts +14 -0
  69. package/dist/auth/web-utils/src/hooks/chat/use-get-chat-details.test.d.ts +1 -0
  70. package/dist/auth/web-utils/src/hooks/chat/use-mentor-tools.d.ts +24 -0
  71. package/dist/auth/web-utils/src/hooks/chat/use-mentor-tools.test.d.ts +1 -0
  72. package/dist/auth/web-utils/src/hooks/index.d.ts +42 -0
  73. package/dist/auth/web-utils/src/hooks/profile/use-profile-image-upload.d.ts +13 -0
  74. package/dist/auth/web-utils/src/hooks/profile/use-user-profile-update.d.ts +28 -0
  75. package/dist/auth/web-utils/src/hooks/stripe/__tests__/use-stripe-upgrade.test.d.ts +1 -0
  76. package/dist/auth/web-utils/src/hooks/stripe/use-stripe-upgrade.d.ts +14 -0
  77. package/dist/auth/web-utils/src/hooks/subscription/class-subscription-flow.d.ts +70 -0
  78. package/dist/auth/web-utils/src/hooks/subscription/constants.d.ts +4 -0
  79. package/dist/auth/web-utils/src/hooks/subscription/use-subscription-handler.d.ts +11 -0
  80. package/dist/auth/web-utils/src/hooks/subscription-v2/__tests__/use-402-error-check.test.d.ts +1 -0
  81. package/dist/auth/web-utils/src/hooks/subscription-v2/class-subscription-flow.d.ts +78 -0
  82. package/dist/auth/web-utils/src/hooks/subscription-v2/constants.d.ts +56 -0
  83. package/dist/auth/web-utils/src/hooks/subscription-v2/use-402-error-check.d.ts +22 -0
  84. package/dist/auth/web-utils/src/hooks/subscription-v2/use-external-pricing-plan.d.ts +7 -0
  85. package/dist/auth/web-utils/src/hooks/subscription-v2/use-subscription-handler.d.ts +71 -0
  86. package/dist/auth/web-utils/src/hooks/tenant-metadata/__tests__/config-loader.test.d.ts +10 -0
  87. package/dist/auth/web-utils/src/hooks/tenant-metadata/__tests__/use-tenant-metadata.test.d.ts +1 -0
  88. package/dist/auth/web-utils/src/hooks/tenant-metadata/config-loader.d.ts +41 -0
  89. package/dist/auth/web-utils/src/hooks/tenant-metadata/constants.d.ts +9 -0
  90. package/dist/auth/web-utils/src/hooks/tenant-metadata/index.d.ts +5 -0
  91. package/dist/auth/web-utils/src/hooks/tenant-metadata/types.d.ts +9 -0
  92. package/dist/auth/web-utils/src/hooks/tenant-metadata/use-tenant-metadata.d.ts +29 -0
  93. package/dist/auth/web-utils/src/hooks/use-accessing-public-route.d.ts +1 -0
  94. package/dist/auth/web-utils/src/hooks/use-cached-session-id.d.ts +8 -0
  95. package/dist/auth/web-utils/src/hooks/use-chat-file-upload.d.ts +17 -0
  96. package/dist/auth/web-utils/src/hooks/use-day-js.d.ts +7 -0
  97. package/dist/auth/web-utils/src/hooks/use-embed-mode.d.ts +1 -0
  98. package/dist/auth/web-utils/src/hooks/use-event-callback.d.ts +2 -0
  99. package/dist/auth/web-utils/src/hooks/use-event-listener.d.ts +6 -0
  100. package/dist/auth/web-utils/src/hooks/use-file-drag-drop.d.ts +15 -0
  101. package/dist/auth/web-utils/src/hooks/use-isomorphic-layout-effect.d.ts +2 -0
  102. package/dist/auth/web-utils/src/hooks/use-local-storage.d.ts +13 -0
  103. package/dist/auth/web-utils/src/hooks/use-mentor-settings.d.ts +46 -0
  104. package/dist/auth/web-utils/src/hooks/use-model-file-upload-capabilities.d.ts +21 -0
  105. package/dist/auth/web-utils/src/hooks/use-os.d.ts +8 -0
  106. package/dist/auth/web-utils/src/hooks/use-responsive.d.ts +13 -0
  107. package/dist/auth/web-utils/src/hooks/use-show-attachment.d.ts +7 -0
  108. package/dist/auth/web-utils/src/hooks/use-show-free-trial-dialog.d.ts +31 -0
  109. package/dist/auth/web-utils/src/hooks/use-show-voice-call.d.ts +7 -0
  110. package/dist/auth/web-utils/src/hooks/use-show-voice-recorder.d.ts +7 -0
  111. package/dist/auth/web-utils/src/hooks/use-tenant-switch-sync.d.ts +13 -0
  112. package/dist/auth/web-utils/src/hooks/use-timer.d.ts +7 -0
  113. package/dist/auth/web-utils/src/hooks/use-tokens.d.ts +2 -0
  114. package/dist/auth/web-utils/src/hooks/use-user-agreement.d.ts +18 -0
  115. package/dist/auth/web-utils/src/hooks/use-user.d.ts +23 -0
  116. package/dist/auth/web-utils/src/hooks/use-voice-chat.d.ts +11 -0
  117. package/dist/auth/web-utils/src/hooks/use-welcome-message.d.ts +16 -0
  118. package/dist/auth/web-utils/src/index.d.ts +8 -0
  119. package/dist/auth/web-utils/src/index.mobile.d.ts +86 -0
  120. package/dist/auth/web-utils/src/index.web.d.ts +142 -0
  121. package/dist/auth/web-utils/src/providers/__tests__/auth-provider.test.d.ts +1 -0
  122. package/dist/auth/web-utils/src/providers/__tests__/mentor-provider.test.d.ts +1 -0
  123. package/dist/auth/web-utils/src/providers/__tests__/service-worker-provider.test.d.ts +1 -0
  124. package/dist/auth/web-utils/src/providers/__tests__/tenant-provider.test.d.ts +1 -0
  125. package/dist/auth/web-utils/src/providers/auth-provider.d.ts +129 -0
  126. package/dist/auth/web-utils/src/providers/index.d.ts +4 -0
  127. package/dist/auth/web-utils/src/providers/mentor-provider.d.ts +44 -0
  128. package/dist/auth/web-utils/src/providers/service-worker-provider.d.ts +21 -0
  129. package/dist/auth/web-utils/src/providers/tenant-provider.d.ts +77 -0
  130. package/dist/auth/web-utils/src/services/__tests__/event-bus.test.d.ts +1 -0
  131. package/dist/auth/web-utils/src/services/__tests__/file-upload.test.d.ts +1 -0
  132. package/dist/auth/web-utils/src/services/__tests__/register-sw.test.d.ts +1 -0
  133. package/dist/auth/web-utils/src/services/event-bus.d.ts +6 -0
  134. package/dist/auth/web-utils/src/services/file-upload.d.ts +60 -0
  135. package/dist/auth/web-utils/src/services/index.d.ts +3 -0
  136. package/dist/auth/web-utils/src/services/register-sw.d.ts +71 -0
  137. package/dist/auth/web-utils/src/types/chat.d.ts +1 -0
  138. package/dist/auth/web-utils/src/types/file-upload.d.ts +62 -0
  139. package/dist/auth/web-utils/src/types/index.d.ts +68 -0
  140. package/dist/auth/web-utils/src/types/subscription.d.ts +40 -0
  141. package/dist/auth/web-utils/src/utils/__tests__/auth.test.d.ts +1 -0
  142. package/dist/auth/web-utils/src/utils/__tests__/constants.test.d.ts +1 -0
  143. package/dist/auth/web-utils/src/utils/__tests__/helpers.test.d.ts +1 -0
  144. package/dist/auth/web-utils/src/utils/__tests__/platform.test.d.ts +1 -0
  145. package/dist/auth/web-utils/src/utils/__tests__/tauri-api-cache.test.d.ts +1 -0
  146. package/dist/auth/web-utils/src/utils/__tests__/tenant-switch.test.d.ts +1 -0
  147. package/dist/auth/web-utils/src/utils/constants.d.ts +69 -0
  148. package/dist/auth/web-utils/src/utils/data/__tests__/advanced-tab.test.d.ts +1 -0
  149. package/dist/auth/web-utils/src/utils/data/advanced-tab.d.ts +62 -0
  150. package/dist/auth/web-utils/src/utils/helpers.d.ts +33 -0
  151. package/dist/auth/web-utils/src/utils/index.d.ts +6 -0
  152. package/dist/auth/web-utils/src/utils/platform.d.ts +9 -0
  153. package/dist/auth/web-utils/src/utils/tauri-api-cache.d.ts +19 -0
  154. package/dist/index.esm.js +575 -262
  155. package/dist/index.esm.js.map +1 -1
  156. package/dist/index.js +588 -275
  157. package/dist/index.js.map +1 -1
  158. package/dist/package.json +1 -2
  159. package/dist/web-utils/src/hooks/chat/use-advanced-chat.d.ts +4 -4
  160. package/dist/web-utils/src/hooks/subscription-v2/use-subscription-handler.d.ts +3 -3
  161. package/dist/web-utils/src/hooks/tenant-metadata/use-tenant-metadata.d.ts +3 -3
  162. package/dist/web-utils/src/hooks/use-isomorphic-layout-effect.d.ts +2 -2
  163. package/dist/web-utils/src/hooks/use-mentor-settings.d.ts +21 -21
  164. package/dist/web-utils/src/hooks/use-user-agreement.d.ts +3 -6
  165. package/dist/web-utils/tsconfig.tsbuildinfo +1 -0
  166. package/package.json +1 -2
  167. package/dist/data-layer/src/config.d.ts +0 -8
  168. package/dist/data-layer/src/constants.d.ts +0 -31
  169. package/dist/data-layer/src/core/index.d.ts +0 -11
  170. package/dist/data-layer/src/features/analytics/api-slice.d.ts +0 -3756
  171. package/dist/data-layer/src/features/analytics/constants.d.ts +0 -133
  172. package/dist/data-layer/src/features/analytics/custom-api-slice.d.ts +0 -8
  173. package/dist/data-layer/src/features/analytics/types.d.ts +0 -696
  174. package/dist/data-layer/src/features/api-keys/api-slice.d.ts +0 -702
  175. package/dist/data-layer/src/features/apps/api-slice.d.ts +0 -720
  176. package/dist/data-layer/src/features/artifacts/api-slice.d.ts +0 -1798
  177. package/dist/data-layer/src/features/artifacts/constants.d.ts +0 -42
  178. package/dist/data-layer/src/features/artifacts/types.d.ts +0 -37
  179. package/dist/data-layer/src/features/audit-logs/api-slice.d.ts +0 -268
  180. package/dist/data-layer/src/features/audit-logs/constants.d.ts +0 -11
  181. package/dist/data-layer/src/features/audit-logs/types.d.ts +0 -32
  182. package/dist/data-layer/src/features/auth/api-slice.d.ts +0 -639
  183. package/dist/data-layer/src/features/auth/constants.d.ts +0 -20
  184. package/dist/data-layer/src/features/auth/types.d.ts +0 -33
  185. package/dist/data-layer/src/features/billing/api-slice.d.ts +0 -359
  186. package/dist/data-layer/src/features/billing/constants.d.ts +0 -16
  187. package/dist/data-layer/src/features/billing/custom-api-slice.d.ts +0 -634
  188. package/dist/data-layer/src/features/billing/types.d.ts +0 -36
  189. package/dist/data-layer/src/features/call-configurations/api-slice.d.ts +0 -855
  190. package/dist/data-layer/src/features/call-configurations/constants.d.ts +0 -16
  191. package/dist/data-layer/src/features/call-configurations/types.d.ts +0 -49
  192. package/dist/data-layer/src/features/career/api-slice.d.ts +0 -3080
  193. package/dist/data-layer/src/features/catalog/api-slice.d.ts +0 -10260
  194. package/dist/data-layer/src/features/chat/api-slice.d.ts +0 -1977
  195. package/dist/data-layer/src/features/chat/constants.d.ts +0 -8
  196. package/dist/data-layer/src/features/chat/custom-api-slice.d.ts +0 -272
  197. package/dist/data-layer/src/features/chat-files/api-slice.d.ts +0 -185
  198. package/dist/data-layer/src/features/chat-files/types.d.ts +0 -32
  199. package/dist/data-layer/src/features/chat-history/api-slice.d.ts +0 -1528
  200. package/dist/data-layer/src/features/chat-privacy/api-slice.d.ts +0 -1398
  201. package/dist/data-layer/src/features/chat-privacy/constants.d.ts +0 -13
  202. package/dist/data-layer/src/features/claw/api-slice.d.ts +0 -5471
  203. package/dist/data-layer/src/features/claw/constants.d.ts +0 -126
  204. package/dist/data-layer/src/features/claw/types.d.ts +0 -275
  205. package/dist/data-layer/src/features/constants.d.ts +0 -3
  206. package/dist/data-layer/src/features/core/api-slice.d.ts +0 -9045
  207. package/dist/data-layer/src/features/core/constants.d.ts +0 -51
  208. package/dist/data-layer/src/features/core/custom-api-slice.d.ts +0 -1766
  209. package/dist/data-layer/src/features/core/custom-public-image-asset-api-slice.d.ts +0 -373
  210. package/dist/data-layer/src/features/core/types.d.ts +0 -73
  211. package/dist/data-layer/src/features/course-metadata/api-slice.d.ts +0 -1728
  212. package/dist/data-layer/src/features/course-metadata/types.d.ts +0 -179
  213. package/dist/data-layer/src/features/courses/api-slice.d.ts +0 -664
  214. package/dist/data-layer/src/features/courses/types.d.ts +0 -26
  215. package/dist/data-layer/src/features/credentials/api-slice.d.ts +0 -6360
  216. package/dist/data-layer/src/features/credentials/constants.d.ts +0 -36
  217. package/dist/data-layer/src/features/credentials/custom-api-slice.d.ts +0 -1839
  218. package/dist/data-layer/src/features/credentials/types.d.ts +0 -39
  219. package/dist/data-layer/src/features/custom-domain/api-slice.d.ts +0 -602
  220. package/dist/data-layer/src/features/custom-domain/constants.d.ts +0 -20
  221. package/dist/data-layer/src/features/custom-domain/types.d.ts +0 -46
  222. package/dist/data-layer/src/features/datasets/api-slice.d.ts +0 -439
  223. package/dist/data-layer/src/features/disclaimers/api-slice.d.ts +0 -912
  224. package/dist/data-layer/src/features/disclaimers/constants.d.ts +0 -27
  225. package/dist/data-layer/src/features/disclaimers/types.d.ts +0 -67
  226. package/dist/data-layer/src/features/edx-proctoring/api-slice.d.ts +0 -590
  227. package/dist/data-layer/src/features/edx-proctoring/constants.d.ts +0 -15
  228. package/dist/data-layer/src/features/edx-proctoring/types.d.ts +0 -61
  229. package/dist/data-layer/src/features/edx-sso/api-slice.d.ts +0 -334
  230. package/dist/data-layer/src/features/edx-sso/types.d.ts +0 -10
  231. package/dist/data-layer/src/features/llms/api-slice.d.ts +0 -373
  232. package/dist/data-layer/src/features/mcp/api-slice.d.ts +0 -2613
  233. package/dist/data-layer/src/features/mcp/constants.d.ts +0 -57
  234. package/dist/data-layer/src/features/mcp/types.d.ts +0 -176
  235. package/dist/data-layer/src/features/memory/api-slice.d.ts +0 -3462
  236. package/dist/data-layer/src/features/memory/constants.d.ts +0 -80
  237. package/dist/data-layer/src/features/memory/types.d.ts +0 -190
  238. package/dist/data-layer/src/features/mentor/api-slice.d.ts +0 -7984
  239. package/dist/data-layer/src/features/mentor/constants.d.ts +0 -45
  240. package/dist/data-layer/src/features/mentor/custom-api-slice.d.ts +0 -957
  241. package/dist/data-layer/src/features/mentor/privacy.d.ts +0 -61
  242. package/dist/data-layer/src/features/mentor/types.d.ts +0 -83
  243. package/dist/data-layer/src/features/mentor-categories/api-slice.d.ts +0 -785
  244. package/dist/data-layer/src/features/moderation-logs/api-slice.d.ts +0 -705
  245. package/dist/data-layer/src/features/monetization/constants.d.ts +0 -76
  246. package/dist/data-layer/src/features/monetization/custom-api-slice.d.ts +0 -5178
  247. package/dist/data-layer/src/features/monetization/types.d.ts +0 -229
  248. package/dist/data-layer/src/features/notifications/api-slice.d.ts +0 -1728
  249. package/dist/data-layer/src/features/notifications/constants.d.ts +0 -26
  250. package/dist/data-layer/src/features/notifications/custom-api-slice.d.ts +0 -996
  251. package/dist/data-layer/src/features/notifications/types.d.ts +0 -69
  252. package/dist/data-layer/src/features/per-learner/api-slice.d.ts +0 -1329
  253. package/dist/data-layer/src/features/periodic-agents/api-slice.d.ts +0 -2347
  254. package/dist/data-layer/src/features/platform/api-slice.d.ts +0 -2553
  255. package/dist/data-layer/src/features/platform/constants.d.ts +0 -17
  256. package/dist/data-layer/src/features/platform/custom-api-slice.d.ts +0 -493
  257. package/dist/data-layer/src/features/platform/types.d.ts +0 -61
  258. package/dist/data-layer/src/features/projects/api-slice.d.ts +0 -2026
  259. package/dist/data-layer/src/features/projects/constants.d.ts +0 -51
  260. package/dist/data-layer/src/features/projects/types.d.ts +0 -79
  261. package/dist/data-layer/src/features/prompts/api-slice.d.ts +0 -2464
  262. package/dist/data-layer/src/features/reports/api-slice.d.ts +0 -789
  263. package/dist/data-layer/src/features/retirement/api-slice.d.ts +0 -165
  264. package/dist/data-layer/src/features/retirement/constants.d.ts +0 -7
  265. package/dist/data-layer/src/features/retirement/types.d.ts +0 -3
  266. package/dist/data-layer/src/features/search/ai-search-api-slice.d.ts +0 -1413
  267. package/dist/data-layer/src/features/search/api-slice.d.ts +0 -2017
  268. package/dist/data-layer/src/features/search/constants.d.ts +0 -41
  269. package/dist/data-layer/src/features/search/types.d.ts +0 -161
  270. package/dist/data-layer/src/features/sessions/api-slice.d.ts +0 -969
  271. package/dist/data-layer/src/features/sessions/constants.d.ts +0 -3
  272. package/dist/data-layer/src/features/sessions/url.d.ts +0 -9
  273. package/dist/data-layer/src/features/skills/api-slice.d.ts +0 -1389
  274. package/dist/data-layer/src/features/stripe/api-slice.d.ts +0 -803
  275. package/dist/data-layer/src/features/stripe/constants.d.ts +0 -19
  276. package/dist/data-layer/src/features/stripe/types.d.ts +0 -19
  277. package/dist/data-layer/src/features/tenant/api-slice.d.ts +0 -832
  278. package/dist/data-layer/src/features/tenant/constants.d.ts +0 -11
  279. package/dist/data-layer/src/features/tenant/types.d.ts +0 -19
  280. package/dist/data-layer/src/features/tenant-logo/api-slice.d.ts +0 -349
  281. package/dist/data-layer/src/features/tenant-logo/constants.d.ts +0 -24
  282. package/dist/data-layer/src/features/tools/api-slice.d.ts +0 -417
  283. package/dist/data-layer/src/features/training-documents/api-slice.d.ts +0 -1523
  284. package/dist/data-layer/src/features/user/api-slice.d.ts +0 -2128
  285. package/dist/data-layer/src/features/user/constants.d.ts +0 -47
  286. package/dist/data-layer/src/features/user/types.d.ts +0 -134
  287. package/dist/data-layer/src/features/user-invitations/api-slice.d.ts +0 -762
  288. package/dist/data-layer/src/features/utils.d.ts +0 -94
  289. package/dist/data-layer/src/features/watched-groups/api-slice.d.ts +0 -2481
  290. package/dist/data-layer/src/features/watched-groups/constants.d.ts +0 -66
  291. package/dist/data-layer/src/features/watched-groups/types.d.ts +0 -143
  292. package/dist/data-layer/src/features/workflows/api-slice.d.ts +0 -2454
  293. package/dist/data-layer/src/features/workflows/constants.d.ts +0 -57
  294. package/dist/data-layer/src/features/workflows/types.d.ts +0 -130
  295. package/dist/data-layer/src/index.d.ts +0 -121
  296. package/dist/data-layer/src/reducers/index.d.ts +0 -2
  297. package/dist/data-layer/src/reducers/mentor.d.ts +0 -2
  298. package/dist/data-layer/src/reducers/skills.d.ts +0 -2
  299. package/dist/data-layer/src/services/StorageService.d.ts +0 -5
  300. package/dist/data-layer/src/utils/index.d.ts +0 -6
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../src/utils/auth.ts"],"sourcesContent":["/**\n * Authentication and Authorization Utilities\n *\n * This module provides utility functions for handling authentication flows,\n * including redirects to auth SPA, cookie management, and session handling.\n */\n\n/**\n * Check if the current window is inside an iframe\n * @returns {boolean} True if running in an iframe, false otherwise\n */\nexport function isInIframe(): boolean {\n if (typeof window === \"undefined\") {\n return false;\n }\n return window?.self !== window?.top;\n}\n\n/**\n * Send a message to the parent website (when in iframe)\n * @param payload - The data to send to parent window\n */\nexport function sendMessageToParentWebsite(payload: unknown): void {\n window.parent.postMessage(payload, \"*\");\n}\n\n/**\n * Delete a cookie with specific name, path, and domain\n * @param name - Cookie name\n * @param path - Cookie path\n * @param domain - Cookie domain\n */\nexport function deleteCookie(name: string, path: string, domain: string): void {\n const expires = \"expires=Thu, 01 Jan 1970 00:00:00 UTC;\";\n const cookieValue = `${name}=;`;\n const pathValue = path ? `path=${path};` : \"\";\n const domainValue = domain ? `domain=${domain};` : \"\";\n document.cookie = cookieValue + expires + pathValue + domainValue;\n}\n\n/**\n * Get all possible domain parts for cookie deletion\n * @param domain - The domain to split\n * @returns Array of domain parts\n * @example\n * getDomainParts('app.example.com') // returns ['app.example.com', 'example.com', 'com']\n */\nexport function getDomainParts(domain: string): string[] {\n const parts = domain.split(\".\");\n const domains: string[] = [];\n for (let i = parts.length - 1; i >= 0; i--) {\n domains.push(parts.slice(i).join(\".\"));\n }\n return domains;\n}\n\n/**\n * Delete a cookie across all possible domain variations\n * @param name - Cookie name to delete\n * @param childDomain - The current domain\n */\nexport function deleteCookieOnAllDomains(\n name: string,\n childDomain: string,\n): void {\n getDomainParts(childDomain).forEach((domainPart) => {\n deleteCookie(name, \"/\", domainPart);\n deleteCookie(name, \"\", domainPart);\n });\n}\n\n/**\n * Get the parent domain from a given domain\n * @param domain - The domain to process\n * @returns The parent domain (e.g., 'app.example.com' → '.example.com')\n */\nexport function getParentDomain(domain?: string): string {\n if (!domain) {\n return \"\";\n }\n const parts = domain.split(\".\");\n return parts.length > 1 ? `.${parts.slice(-2).join(\".\")}` : domain;\n}\n\n/**\n * Set a cookie for authentication with cross-domain support\n * @param name - Cookie name\n * @param value - Cookie value\n * @param days - Number of days until expiration (default: 365)\n */\nexport function setCookieForAuth(\n name: string,\n value: string,\n days: number = 365,\n): void {\n const expires = new Date();\n expires.setTime(expires.getTime() + days * 24 * 60 * 60 * 1000);\n\n const hostname = window.location.hostname;\n let baseDomain = hostname;\n\n // Calculate base domain (skip for localhost and IP addresses)\n if (hostname !== \"localhost\" && !/^\\d+\\.\\d+\\.\\d+\\.\\d+$/.test(hostname)) {\n const parts = hostname.split(\".\");\n if (parts.length > 2) {\n baseDomain = `.${parts.slice(-2).join(\".\")}`;\n }\n }\n\n const domainAttr = baseDomain ? `;domain=${baseDomain}` : \"\";\n document.cookie = `${name}=${encodeURIComponent(value)};expires=${expires.toUTCString()};path=/;SameSite=None;Secure${domainAttr}`;\n}\n\n/**\n * Clear all cookies for the current domain\n */\nexport function clearCookies(): void {\n const cookies = document.cookie.split(\";\");\n for (let i = 0; i < cookies.length; i++) {\n const cookie = cookies[i];\n const eqPos = cookie.indexOf(\"=\");\n const name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;\n deleteCookieOnAllDomains(name, window.location.hostname);\n document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;Domain=${getParentDomain(\n window.location.hostname,\n )}`;\n }\n}\n\n/**\n * Get the value of a cookie by name\n * @param name - Cookie name\n * @returns The cookie value or null if not found\n */\nexport function getCookieValue(name: string): string | null {\n const match = document.cookie.match(new RegExp(`(?:^|;\\\\s*)${name}=([^;]*)`));\n return match ? decodeURIComponent(match[1]) : null;\n}\n\n/**\n * Check if user is currently logged in\n * @param tokenKey - The localStorage key for the auth token (default: 'axd_token')\n * @returns True if logged in, false otherwise\n */\nexport function isLoggedIn(tokenKey: string = \"axd_token\"): boolean {\n return !!localStorage.getItem(tokenKey);\n}\n\n/**\n * Extract platform/tenant key from URL\n * @param url - The URL to parse\n * @param pattern - RegExp pattern to match platform key (default matches /platform/[key]/...)\n * @returns The platform key or null if not found\n */\nexport function getPlatformKey(\n url: string,\n pattern: RegExp = /\\/platform\\/([^/]+)/,\n): string | null {\n const match = url.match(pattern);\n return match ? match[1] : null;\n}\n\nexport interface RedirectToAuthSpaOptions {\n /** URL to redirect to after auth (defaults to current path + search) */\n redirectTo?: string;\n /** Platform/tenant key */\n platformKey?: string;\n /** Whether this is a logout action */\n logout?: boolean;\n /** Whether to save redirect path to localStorage (default: true) */\n saveRedirect?: boolean;\n /** Auth SPA base URL */\n authUrl: string;\n /** Current app/platform identifier (e.g., 'mentor', 'skills') */\n appName: string;\n /** Query param names */\n queryParams?: {\n app?: string;\n redirectTo?: string;\n tenant?: string;\n };\n /** localStorage key for saving redirect path */\n redirectPathStorageKey?: string;\n /** Cookie names for cross-SPA sync */\n cookieNames?: {\n currentTenant?: string;\n userData?: string;\n tenant?: string;\n logoutTimestamp?: string;\n loginTimestamp?: string;\n tenantSwitching?: string;\n };\n /** Function to check if auth token is valid and non-expired. Used to skip redirect when a recent login occurred. */\n hasNonExpiredAuthToken?: () => boolean;\n /** Function to check if the app is in offline mode (e.g., Tauri offline). Skips redirect when true. */\n isOffline?: () => boolean;\n /** localStorage key for a token to preserve before clearing storage (e.g., 'edx_jwt_token') */\n preserveTokenKey?: string;\n /** Path to an auth redirect proxy endpoint (e.g., '/api/auth-redirect'). When set, redirects via this proxy in browser. */\n authRedirectProxy?: string;\n /** Function to check if the app is running as a native app (e.g., Tauri). Affects redirect behavior. */\n isNativeApp?: () => boolean;\n forceRedirect?: boolean;\n scheme?: string;\n}\n\n/**\n * Redirect to authentication SPA for login/logout\n *\n * This function handles the complete authentication flow:\n * - Clears localStorage and cookies on logout\n * - Saves redirect path for post-auth return\n * - Handles iframe scenarios\n * - Syncs logout across multiple SPAs via cookies\n *\n * @param options - Configuration options for the redirect\n *\n * @example\n * ```tsx\n * // Basic usage\n * redirectToAuthSpa({\n * authUrl: 'https://auth.example.com',\n * appName: 'mentor',\n * });\n *\n * // With logout\n * redirectToAuthSpa({\n * authUrl: 'https://auth.example.com',\n * appName: 'mentor',\n * logout: true,\n * platformKey: 'my-tenant',\n * });\n *\n * // With custom redirect\n * redirectToAuthSpa({\n * authUrl: 'https://auth.example.com',\n * appName: 'mentor',\n * redirectTo: '/dashboard',\n * platformKey: 'my-tenant',\n * });\n * ```\n */\nexport async function redirectToAuthSpa(\n options: RedirectToAuthSpaOptions,\n): Promise<void> {\n const {\n redirectTo,\n platformKey,\n logout = false,\n saveRedirect = true,\n authUrl,\n appName,\n queryParams = {\n app: \"app\",\n redirectTo: \"redirect-to\",\n tenant: \"tenant\",\n },\n redirectPathStorageKey = \"redirect_to\",\n cookieNames = {\n currentTenant: \"ibl_current_tenant\",\n userData: \"ibl_user_data\",\n tenant: \"ibl_tenant\",\n logoutTimestamp: \"ibl_logout_timestamp\",\n loginTimestamp: \"ibl_login_timestamp\",\n tenantSwitching: \"ibl_tenant_switching\",\n },\n hasNonExpiredAuthToken,\n isOffline,\n preserveTokenKey,\n authRedirectProxy,\n isNativeApp,\n scheme = \"iblai-mentor\",\n forceRedirect = false,\n } = options;\n\n console.log(\n \"[redirectToAuthSpa] starting redirect to auth spa\",\n redirectTo,\n platformKey,\n logout,\n saveRedirect,\n forceRedirect,\n );\n\n // Skip if a tenant switch is already in progress\n if (\n !forceRedirect &&\n cookieNames.tenantSwitching &&\n document.cookie.includes(cookieNames.tenantSwitching)\n ) {\n console.log(\n \"[redirectToAuthSpa] Tenant switch in progress, skipping redirect\",\n );\n return;\n }\n\n // Skip if a login occurred after the last logout (login takes precedence)\n // but only if this app actually has a valid auth token\n if (\n !forceRedirect &&\n hasNonExpiredAuthToken &&\n cookieNames.loginTimestamp &&\n cookieNames.logoutTimestamp\n ) {\n const loginTs = getCookieValue(cookieNames.loginTimestamp);\n const logoutTs = getCookieValue(cookieNames.logoutTimestamp);\n const hasValidToken = hasNonExpiredAuthToken();\n console.log(\"[redirectToAuthSpa] Login/logout timestamp check\", {\n loginTs,\n logoutTs,\n hasValidToken,\n loginAhead:\n loginTs && logoutTs ? Number(loginTs) > Number(logoutTs) : false,\n });\n if (\n !forceRedirect &&\n hasValidToken &&\n loginTs &&\n logoutTs &&\n Number(loginTs) > Number(logoutTs)\n ) {\n console.log(\n \"[redirectToAuthSpa] Login timestamp is ahead of logout timestamp, skipping redirect\",\n { loginTs, logoutTs },\n );\n return;\n }\n }\n\n // Skip redirect in offline mode\n if (isOffline?.()) {\n console.log(\"[redirectToAuthSpa] Skipping redirect - offline mode\");\n return;\n }\n\n // Preserve a token before clearing localStorage if requested\n const preservedToken = preserveTokenKey\n ? window.localStorage.getItem(preserveTokenKey)\n : null;\n\n console.log(\"[redirectToAuthSpa] clearing local storage\");\n localStorage.clear();\n\n if (logout || isInIframe()) {\n // Delete authentication cookies for cross-SPA synchronization\n const currentDomain = window.location.hostname;\n if (cookieNames.currentTenant) {\n deleteCookieOnAllDomains(cookieNames.currentTenant, currentDomain);\n }\n if (cookieNames.userData) {\n deleteCookieOnAllDomains(cookieNames.userData, currentDomain);\n }\n if (cookieNames.tenant) {\n deleteCookieOnAllDomains(cookieNames.tenant, currentDomain);\n }\n\n // Set logout timestamp cookie to trigger logout on other SPAs\n if (cookieNames.logoutTimestamp && !isInIframe()) {\n setCookieForAuth(cookieNames.logoutTimestamp, Date.now().toString());\n }\n }\n\n // Handle iframe scenario\n if (isInIframe()) {\n console.log(\"[redirectToAuthSpa]: sending authExpired to parent\");\n sendMessageToParentWebsite({ authExpired: true });\n return;\n }\n\n const redirectPath =\n redirectTo ?? `${window.location.pathname}${window.location.search}`;\n\n // Never save sso-login routes as redirect paths\n if (\n !redirectPath.startsWith(\"/sso-login\") &&\n !redirectPath.startsWith(\"/sso-login-complete\") &&\n saveRedirect\n ) {\n window.localStorage.setItem(redirectPathStorageKey, redirectPath);\n }\n\n const platform = platformKey ?? getPlatformKey(redirectPath);\n\n const redirectToUrl = window.location.origin;\n\n let authRedirectUrl = `${authUrl}/login?${queryParams.app}=${appName}`;\n\n authRedirectUrl += `&${queryParams.redirectTo}=${redirectToUrl}`;\n\n if (platform) {\n authRedirectUrl += `&${queryParams.tenant}=${platform}`;\n }\n if (logout) {\n authRedirectUrl += \"&logout=1\";\n }\n if (isNativeApp?.() && scheme) {\n authRedirectUrl += `&scheme=${scheme}`;\n }\n\n // Small delay for any pending operations\n await new Promise((resolve) => setTimeout(resolve, 100));\n\n if (isNativeApp?.()) {\n // On native apps (e.g., Tauri), pass preserved token and navigate directly\n if (preservedToken && preserveTokenKey) {\n authRedirectUrl += `&token=${encodeURIComponent(preservedToken)}`;\n console.log(\"[redirectToAuthSpa] Added preserved token to auth URL\");\n }\n console.log(\n \"[redirectToAuthSpa] Native app, navigating to auth URL:\",\n authRedirectUrl,\n );\n window.location.href = authRedirectUrl;\n } else if (authRedirectProxy) {\n // Use auth redirect proxy endpoint\n window.location.href = `${authRedirectProxy}?to=${encodeURIComponent(authRedirectUrl)}`;\n } else {\n window.location.href = authRedirectUrl;\n }\n}\n\n/**\n * Get the URL for joining a tenant (sign up flow)\n * @param authUrl - Auth SPA base URL\n * @param tenantKey - Tenant to join\n * @param redirectUrl - URL to redirect to after joining (defaults to current URL)\n * @returns The join URL\n */\nexport function getAuthSpaJoinUrl(\n authUrl: string,\n tenantKey?: string,\n redirectUrl?: string,\n): string {\n const resolvedTenant =\n tenantKey || getPlatformKey(window.location.pathname) || \"\";\n\n if (!resolvedTenant) {\n return \"\";\n }\n\n const targetUrl = redirectUrl ?? window.location.href;\n const joinUrl = `${authUrl}/join?tenant=${encodeURIComponent(resolvedTenant)}&redirect-to=${encodeURIComponent(\n targetUrl,\n )}`;\n return joinUrl;\n}\n\n/**\n * Redirect to auth SPA's join/signup page for a specific tenant\n * @param authUrl - Auth SPA base URL\n * @param tenantKey - Tenant to join\n * @param redirectUrl - URL to redirect to after joining (defaults to current URL)\n */\nexport function redirectToAuthSpaJoinTenant(\n authUrl: string,\n tenantKey?: string,\n redirectUrl?: string,\n): void {\n const resolvedTenant =\n tenantKey || getPlatformKey(window.location.pathname) || \"\";\n\n if (!resolvedTenant) {\n console.log(\"[auth-redirect] Missing tenant key for join\", {\n tenantKey,\n redirectUrl,\n });\n redirectToAuthSpa({\n authUrl,\n appName: \"app\", // Will need to be configured\n redirectTo: redirectUrl,\n });\n return;\n }\n\n const targetUrl = redirectUrl ?? window.location.href;\n const joinUrl = `${authUrl}/join?tenant=${encodeURIComponent(resolvedTenant)}&redirect-to=${encodeURIComponent(\n targetUrl,\n )}`;\n\n window.location.href = joinUrl;\n}\n\nexport interface HandleLogoutOptions {\n /** URL to redirect to after logout (defaults to current origin) */\n redirectUrl?: string;\n /** Auth SPA base URL */\n authUrl: string;\n /** localStorage key for tenant */\n tenantStorageKey?: string;\n /** Cookie name for logout timestamp */\n logoutTimestampCookie?: string;\n /** Callback to execute before logout */\n callback?: () => void;\n}\n\n/**\n * Handle user logout\n *\n * This function:\n * - Clears localStorage (preserving tenant)\n * - Sets logout timestamp cookie for cross-SPA sync\n * - Clears all cookies\n * - Redirects to auth SPA logout endpoint\n *\n * @param options - Logout configuration options\n *\n * @example\n * ```tsx\n * handleLogout({\n * authUrl: 'https://auth.example.com',\n * redirectUrl: 'https://app.example.com',\n * });\n * ```\n */\nexport function handleLogout(options: HandleLogoutOptions): void {\n const {\n redirectUrl = window.location.origin,\n authUrl,\n tenantStorageKey = \"tenant\",\n logoutTimestampCookie = \"ibl_logout_timestamp\",\n callback,\n } = options;\n\n const tenant = window.localStorage.getItem(tenantStorageKey);\n window.localStorage.clear();\n if (tenant) {\n window.localStorage.setItem(tenantStorageKey, tenant);\n }\n\n // Set logout timestamp cookie to trigger logout on other SPAs\n setCookieForAuth(logoutTimestampCookie, Date.now().toString());\n\n clearCookies();\n callback?.();\n\n if (!isInIframe()) {\n window.location.href = `${authUrl}/logout?redirect-to=${redirectUrl}${tenant ? \"&tenant=\" + tenant : \"\"}`;\n }\n}\n\n// ── Tenant-switch coordination ─────────────────────────────────────────────\n// Cross-tab tenant switching: a TTL lock (shared via localStorage) plus a\n// BroadcastChannel signal let multiple tabs coordinate a switch and prevent the\n// \"ping-pong\" where a stale tab reverts the session to its own route's tenant.\nexport const TENANT_SWITCH_CHANNEL = \"ibl-tenant-switch\";\nexport const TENANT_SWITCH_LOCK_KEY = \"ibl_tenant_switch_lock\";\nexport const DEFAULT_TENANT_SWITCH_LOCK_TTL_MS = 8_000;\n\nexport interface TenantSwitchLock {\n tenant: string;\n /** `${ts}-${tabId}` — monotonic; newer wins. */\n token: string;\n ts: number;\n senderId: string;\n}\n\nlet _tabId: string | null = null;\n/**\n * Stable per-tab id. Uses sessionStorage so it survives same-tab reloads while\n * staying unique per tab/window.\n */\nexport function getTabId(): string {\n if (_tabId) return _tabId;\n try {\n const existing = sessionStorage.getItem(\"ibl_tab_id\");\n if (existing) return (_tabId = existing);\n const id = crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`;\n sessionStorage.setItem(\"ibl_tab_id\", id);\n return (_tabId = id);\n } catch {\n return (_tabId = `${Date.now()}-${Math.random()}`);\n }\n}\n\n/** The active (non-expired) tenant-switch lock, or null. */\nexport function readTenantSwitchLock(\n ttlMs: number = DEFAULT_TENANT_SWITCH_LOCK_TTL_MS,\n): TenantSwitchLock | null {\n try {\n const raw = localStorage.getItem(TENANT_SWITCH_LOCK_KEY);\n if (!raw) return null;\n const lock = JSON.parse(raw) as TenantSwitchLock;\n if (typeof lock?.ts !== \"number\") return null;\n if (Date.now() - lock.ts > ttlMs) return null;\n return lock;\n } catch {\n return null;\n }\n}\n\n/** Write a fresh lock for `tenant` (newest intent). Returns the lock written. */\nexport function writeTenantSwitchLock(tenant: string): TenantSwitchLock {\n const lock: TenantSwitchLock = {\n tenant,\n token: `${Date.now()}-${getTabId()}`,\n ts: Date.now(),\n senderId: getTabId(),\n };\n try {\n localStorage.setItem(TENANT_SWITCH_LOCK_KEY, JSON.stringify(lock));\n } catch {}\n return lock;\n}\n\n/** Extend an existing lock's window from \"now\" (no-op when no active lock). */\nexport function refreshTenantSwitchLock(): void {\n const lock = readTenantSwitchLock();\n if (!lock) return;\n try {\n localStorage.setItem(\n TENANT_SWITCH_LOCK_KEY,\n JSON.stringify({ ...lock, ts: Date.now() }),\n );\n } catch {}\n}\n\nexport function clearTenantSwitchLock(): void {\n try {\n localStorage.removeItem(TENANT_SWITCH_LOCK_KEY);\n } catch {}\n}\n\n/** True while a tenant switch is in flight — gate automatic reverts on this. */\nexport function isTenantSwitchInProgress(ttlMs?: number): boolean {\n return readTenantSwitchLock(ttlMs) !== null;\n}\n\nexport interface HandleTenantSwitchOptions {\n /** Auth SPA base URL (e.g. config.authUrl()). */\n authUrl: string;\n /** localStorage key for the saved redirect path (default \"redirect-to\"). */\n redirectPathStorageKey?: string;\n /** localStorage key for a JWT to forward through the switch (default \"edx_jwt_token\"). */\n preserveTokenKey?: string;\n /** localStorage key holding the tenant (default \"tenant\"). */\n tenantStorageKey?: string;\n /** Cookie name signalling a switch is in progress (default \"ibl_tenant_switching\"). */\n tenantSwitchingCookie?: string;\n /** Query-param names for the auth URL. */\n queryParams?: { tenant?: string; redirectTo?: string };\n /** Persist the current path so the app returns to it post-switch. */\n saveRedirect?: boolean;\n /** Explicit redirect target (defaults to window.location.origin). */\n redirectUrl?: string;\n /** Broadcast to other tabs + clear storage (true for user-initiated; default true). */\n broadcast?: boolean;\n /** Lock TTL override. */\n lockTtlMs?: number;\n /** Injected so this util stays React-free (mentorai passes the SDK's). */\n clearCurrentTenantCookie?: () => void;\n}\n\n/**\n * Switch the active tenant. Coordinates across tabs (TTL lock + BroadcastChannel),\n * clears storage, then redirects through the auth SPA's `/login/complete`.\n *\n * @example\n * await handleTenantSwitch(\"acme\", {\n * authUrl: config.authUrl(),\n * clearCurrentTenantCookie,\n * });\n */\nexport async function handleTenantSwitch(\n tenant: string,\n options: HandleTenantSwitchOptions,\n): Promise<void> {\n const {\n authUrl,\n redirectPathStorageKey = \"redirect-to\",\n preserveTokenKey = \"edx_jwt_token\",\n tenantStorageKey = \"tenant\",\n tenantSwitchingCookie = \"ibl_tenant_switching\",\n queryParams = {},\n saveRedirect = false,\n redirectUrl,\n broadcast = true,\n clearCurrentTenantCookie,\n } = options;\n const tenantParam = queryParams.tenant ?? \"tenant\";\n const redirectToParam = queryParams.redirectTo ?? \"redirect-to\";\n\n // Guard: don't start a new user switch while one is already in progress.\n if (broadcast && document.cookie.includes(tenantSwitchingCookie)) return;\n // Guard: already on the target tenant.\n if (tenant === localStorage.getItem(tenantStorageKey)) return;\n\n if (broadcast) {\n setCookieForAuth(tenantSwitchingCookie, \"true\");\n writeTenantSwitchLock(tenant);\n if (typeof BroadcastChannel !== \"undefined\") {\n const channel = new BroadcastChannel(TENANT_SWITCH_CHANNEL);\n const lock = readTenantSwitchLock(options.lockTtlMs);\n channel.postMessage({\n type: \"TENANT_SWITCHING\",\n tenant,\n senderId: lock?.senderId ?? getTabId(),\n token: lock?.token,\n });\n channel.close();\n }\n clearCurrentTenantCookie?.();\n }\n\n const currentPath = `${window.location.pathname}${window.location.search}`;\n const jwtToken = localStorage.getItem(preserveTokenKey);\n if (broadcast) localStorage.clear();\n\n const params: Record<string, string> = {\n [tenantParam]: tenant,\n [redirectToParam]: redirectUrl ?? window.location.origin,\n };\n if (jwtToken) params.token = jwtToken;\n\n localStorage.setItem(tenantStorageKey, tenant);\n if (saveRedirect) localStorage.setItem(redirectPathStorageKey, currentPath);\n // Re-persist: localStorage.clear() above wiped the pre-broadcast lock; this\n // copy survives the redirect so stale tabs honor the switch window.\n if (broadcast) writeTenantSwitchLock(tenant);\n\n await new Promise((resolve) => setTimeout(resolve, 100));\n window.location.href = `${authUrl}/login/complete?${new URLSearchParams(params)}`;\n}\n"],"names":[],"mappings":"AAAA;;;;;AAKG;AAEH;;;AAGG;SACa,UAAU,GAAA;AACxB,IAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AACjC,QAAA,OAAO,KAAK;IACd;AACA,IAAA,OAAO,CAAA,MAAM,KAAA,IAAA,IAAN,MAAM,KAAA,MAAA,GAAA,MAAA,GAAN,MAAM,CAAE,IAAI,OAAK,MAAM,aAAN,MAAM,KAAA,MAAA,GAAA,MAAA,GAAN,MAAM,CAAE,GAAG,CAAA;AACrC;AAEA;;;AAGG;AACG,SAAU,0BAA0B,CAAC,OAAgB,EAAA;IACzD,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,GAAG,CAAC;AACzC;AAEA;;;;;AAKG;SACa,YAAY,CAAC,IAAY,EAAE,IAAY,EAAE,MAAc,EAAA;IACrE,MAAM,OAAO,GAAG,wCAAwC;AACxD,IAAA,MAAM,WAAW,GAAG,CAAA,EAAG,IAAI,IAAI;AAC/B,IAAA,MAAM,SAAS,GAAG,IAAI,GAAG,CAAA,KAAA,EAAQ,IAAI,CAAA,CAAA,CAAG,GAAG,EAAE;AAC7C,IAAA,MAAM,WAAW,GAAG,MAAM,GAAG,CAAA,OAAA,EAAU,MAAM,CAAA,CAAA,CAAG,GAAG,EAAE;IACrD,QAAQ,CAAC,MAAM,GAAG,WAAW,GAAG,OAAO,GAAG,SAAS,GAAG,WAAW;AACnE;AAEA;;;;;;AAMG;AACG,SAAU,cAAc,CAAC,MAAc,EAAA;IAC3C,MAAM,KAAK,GAA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-1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/utils/auth.ts"],"sourcesContent":["/**\n * Authentication and Authorization Utilities\n *\n * This module provides utility functions for handling authentication flows,\n * including redirects to auth SPA, cookie management, and session handling.\n */\n\n/**\n * Check if the current window is inside an iframe\n * @returns {boolean} True if running in an iframe, false otherwise\n */\nexport function isInIframe(): boolean {\n if (typeof window === \"undefined\") {\n return false;\n }\n return window?.self !== window?.top;\n}\n\n/**\n * Send a message to the parent website (when in iframe)\n * @param payload - The data to send to parent window\n */\nexport function sendMessageToParentWebsite(payload: unknown): void {\n window.parent.postMessage(payload, \"*\");\n}\n\n/**\n * Delete a cookie with specific name, path, and domain\n * @param name - Cookie name\n * @param path - Cookie path\n * @param domain - Cookie domain\n */\nexport function deleteCookie(name: string, path: string, domain: string): void {\n const expires = \"expires=Thu, 01 Jan 1970 00:00:00 UTC;\";\n const cookieValue = `${name}=;`;\n const pathValue = path ? `path=${path};` : \"\";\n const domainValue = domain ? `domain=${domain};` : \"\";\n document.cookie = cookieValue + expires + pathValue + domainValue;\n}\n\n/**\n * Get all possible domain parts for cookie deletion\n * @param domain - The domain to split\n * @returns Array of domain parts\n * @example\n * getDomainParts('app.example.com') // returns ['app.example.com', 'example.com', 'com']\n */\nexport function getDomainParts(domain: string): string[] {\n const parts = domain.split(\".\");\n const domains: string[] = [];\n for (let i = parts.length - 1; i >= 0; i--) {\n domains.push(parts.slice(i).join(\".\"));\n }\n return domains;\n}\n\n/**\n * Delete a cookie across all possible domain variations\n * @param name - Cookie name to delete\n * @param childDomain - The current domain\n */\nexport function deleteCookieOnAllDomains(\n name: string,\n childDomain: string,\n): void {\n getDomainParts(childDomain).forEach((domainPart) => {\n deleteCookie(name, \"/\", domainPart);\n deleteCookie(name, \"\", domainPart);\n });\n}\n\n/**\n * Get the parent domain from a given domain\n * @param domain - The domain to process\n * @returns The parent domain (e.g., 'app.example.com' → '.example.com')\n */\nexport function getParentDomain(domain?: string): string {\n if (!domain) {\n return \"\";\n }\n const parts = domain.split(\".\");\n return parts.length > 1 ? `.${parts.slice(-2).join(\".\")}` : domain;\n}\n\n/**\n * Set a cookie for authentication with cross-domain support\n * @param name - Cookie name\n * @param value - Cookie value\n * @param days - Number of days until expiration (default: 365)\n */\nexport function setCookieForAuth(\n name: string,\n value: string,\n days: number = 365,\n): void {\n const expires = new Date();\n expires.setTime(expires.getTime() + days * 24 * 60 * 60 * 1000);\n\n const hostname = window.location.hostname;\n let baseDomain = hostname;\n\n // Calculate base domain (skip for localhost and IP addresses)\n if (hostname !== \"localhost\" && !/^\\d+\\.\\d+\\.\\d+\\.\\d+$/.test(hostname)) {\n const parts = hostname.split(\".\");\n if (parts.length > 2) {\n baseDomain = `.${parts.slice(-2).join(\".\")}`;\n }\n }\n\n const domainAttr = baseDomain ? `;domain=${baseDomain}` : \"\";\n document.cookie = `${name}=${encodeURIComponent(value)};expires=${expires.toUTCString()};path=/;SameSite=None;Secure${domainAttr}`;\n}\n\n/**\n * Clear all cookies for the current domain\n */\nexport function clearCookies(): void {\n const cookies = document.cookie.split(\";\");\n for (let i = 0; i < cookies.length; i++) {\n const cookie = cookies[i];\n const eqPos = cookie.indexOf(\"=\");\n const name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;\n deleteCookieOnAllDomains(name, window.location.hostname);\n document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;Domain=${getParentDomain(\n window.location.hostname,\n )}`;\n }\n}\n\n/**\n * Get the value of a cookie by name\n * @param name - Cookie name\n * @returns The cookie value or null if not found\n */\nexport function getCookieValue(name: string): string | null {\n const match = document.cookie.match(new RegExp(`(?:^|;\\\\s*)${name}=([^;]*)`));\n return match ? decodeURIComponent(match[1]) : null;\n}\n\n/**\n * Check if user is currently logged in\n * @param tokenKey - The localStorage key for the auth token (default: 'axd_token')\n * @returns True if logged in, false otherwise\n */\nexport function isLoggedIn(tokenKey: string = \"axd_token\"): boolean {\n return !!localStorage.getItem(tokenKey);\n}\n\n/**\n * Extract platform/tenant key from URL\n * @param url - The URL to parse\n * @param pattern - RegExp pattern to match platform key (default matches /platform/[key]/...)\n * @returns The platform key or null if not found\n */\nexport function getPlatformKey(\n url: string,\n pattern: RegExp = /\\/platform\\/([^/]+)/,\n): string | null {\n const match = url.match(pattern);\n return match ? match[1] : null;\n}\n\nexport interface RedirectToAuthSpaOptions {\n /** URL to redirect to after auth (defaults to current path + search) */\n redirectTo?: string;\n /** Platform/tenant key */\n platformKey?: string;\n /** Whether this is a logout action */\n logout?: boolean;\n /** Whether to save redirect path to localStorage (default: true) */\n saveRedirect?: boolean;\n /** Auth SPA base URL */\n authUrl: string;\n /** Current app/platform identifier (e.g., 'mentor', 'skills') */\n appName: string;\n /** Query param names */\n queryParams?: {\n app?: string;\n redirectTo?: string;\n tenant?: string;\n };\n /** localStorage key for saving redirect path */\n redirectPathStorageKey?: string;\n /** Cookie names for cross-SPA sync */\n cookieNames?: {\n currentTenant?: string;\n userData?: string;\n tenant?: string;\n logoutTimestamp?: string;\n loginTimestamp?: string;\n tenantSwitching?: string;\n };\n /** Function to check if auth token is valid and non-expired. Used to skip redirect when a recent login occurred. */\n hasNonExpiredAuthToken?: () => boolean;\n /** Function to check if the app is in offline mode (e.g., Tauri offline). Skips redirect when true. */\n isOffline?: () => boolean;\n /** localStorage key for a token to preserve before clearing storage (e.g., 'edx_jwt_token') */\n preserveTokenKey?: string;\n /** Path to an auth redirect proxy endpoint (e.g., '/api/auth-redirect'). When set, redirects via this proxy in browser. */\n authRedirectProxy?: string;\n /** Function to check if the app is running as a native app (e.g., Tauri). Affects redirect behavior. */\n isNativeApp?: () => boolean;\n forceRedirect?: boolean;\n scheme?: string;\n}\n\n/**\n * Redirect to authentication SPA for login/logout\n *\n * This function handles the complete authentication flow:\n * - Clears localStorage and cookies on logout\n * - Saves redirect path for post-auth return\n * - Handles iframe scenarios\n * - Syncs logout across multiple SPAs via cookies\n *\n * @param options - Configuration options for the redirect\n *\n * @example\n * ```tsx\n * // Basic usage\n * redirectToAuthSpa({\n * authUrl: 'https://auth.example.com',\n * appName: 'mentor',\n * });\n *\n * // With logout\n * redirectToAuthSpa({\n * authUrl: 'https://auth.example.com',\n * appName: 'mentor',\n * logout: true,\n * platformKey: 'my-tenant',\n * });\n *\n * // With custom redirect\n * redirectToAuthSpa({\n * authUrl: 'https://auth.example.com',\n * appName: 'mentor',\n * redirectTo: '/dashboard',\n * platformKey: 'my-tenant',\n * });\n * ```\n */\nexport async function redirectToAuthSpa(\n options: RedirectToAuthSpaOptions,\n): Promise<void> {\n const {\n redirectTo,\n platformKey,\n logout = false,\n saveRedirect = true,\n authUrl,\n appName,\n queryParams = {\n app: \"app\",\n redirectTo: \"redirect-to\",\n tenant: \"tenant\",\n },\n redirectPathStorageKey = \"redirect_to\",\n cookieNames = {\n currentTenant: \"ibl_current_tenant\",\n userData: \"ibl_user_data\",\n tenant: \"ibl_tenant\",\n logoutTimestamp: \"ibl_logout_timestamp\",\n loginTimestamp: \"ibl_login_timestamp\",\n tenantSwitching: \"ibl_tenant_switching\",\n },\n hasNonExpiredAuthToken,\n isOffline,\n preserveTokenKey,\n authRedirectProxy,\n isNativeApp,\n scheme = \"iblai-mentor\",\n forceRedirect = false,\n } = options;\n\n console.log(\n \"[redirectToAuthSpa] starting redirect to auth spa\",\n redirectTo,\n platformKey,\n logout,\n saveRedirect,\n forceRedirect,\n );\n\n // Skip if a tenant switch is already in progress\n if (\n !forceRedirect &&\n cookieNames.tenantSwitching &&\n document.cookie.includes(cookieNames.tenantSwitching)\n ) {\n console.log(\n \"[redirectToAuthSpa] Tenant switch in progress, skipping redirect\",\n );\n return;\n }\n\n // Skip if a login occurred after the last logout (login takes precedence)\n // but only if this app actually has a valid auth token\n if (\n !forceRedirect &&\n hasNonExpiredAuthToken &&\n cookieNames.loginTimestamp &&\n cookieNames.logoutTimestamp\n ) {\n const loginTs = getCookieValue(cookieNames.loginTimestamp);\n const logoutTs = getCookieValue(cookieNames.logoutTimestamp);\n const hasValidToken = hasNonExpiredAuthToken();\n console.log(\"[redirectToAuthSpa] Login/logout timestamp check\", {\n loginTs,\n logoutTs,\n hasValidToken,\n loginAhead:\n loginTs && logoutTs ? Number(loginTs) > Number(logoutTs) : false,\n });\n if (\n !forceRedirect &&\n hasValidToken &&\n loginTs &&\n logoutTs &&\n Number(loginTs) > Number(logoutTs)\n ) {\n console.log(\n \"[redirectToAuthSpa] Login timestamp is ahead of logout timestamp, skipping redirect\",\n { loginTs, logoutTs },\n );\n return;\n }\n }\n\n // Skip redirect in offline mode\n if (isOffline?.()) {\n console.log(\"[redirectToAuthSpa] Skipping redirect - offline mode\");\n return;\n }\n\n // Preserve a token before clearing localStorage if requested\n const preservedToken = preserveTokenKey\n ? window.localStorage.getItem(preserveTokenKey)\n : null;\n\n console.log(\"[redirectToAuthSpa] clearing local storage\");\n localStorage.clear();\n\n if (logout || isInIframe()) {\n // Delete authentication cookies for cross-SPA synchronization\n const currentDomain = window.location.hostname;\n if (cookieNames.currentTenant) {\n deleteCookieOnAllDomains(cookieNames.currentTenant, currentDomain);\n }\n if (cookieNames.userData) {\n deleteCookieOnAllDomains(cookieNames.userData, currentDomain);\n }\n if (cookieNames.tenant) {\n deleteCookieOnAllDomains(cookieNames.tenant, currentDomain);\n }\n\n // Set logout timestamp cookie to trigger logout on other SPAs\n if (cookieNames.logoutTimestamp && !isInIframe()) {\n setCookieForAuth(cookieNames.logoutTimestamp, Date.now().toString());\n }\n }\n\n // Handle iframe scenario\n if (isInIframe()) {\n console.log(\"[redirectToAuthSpa]: sending authExpired to parent\");\n sendMessageToParentWebsite({ authExpired: true });\n return;\n }\n\n const redirectPath =\n redirectTo ?? `${window.location.pathname}${window.location.search}`;\n\n // Never save sso-login routes as redirect paths\n if (\n !redirectPath.startsWith(\"/sso-login\") &&\n !redirectPath.startsWith(\"/sso-login-complete\") &&\n saveRedirect\n ) {\n window.localStorage.setItem(redirectPathStorageKey, redirectPath);\n }\n\n const platform = platformKey ?? getPlatformKey(redirectPath);\n\n const redirectToUrl = window.location.origin;\n\n let authRedirectUrl = `${authUrl}/login?${queryParams.app}=${appName}`;\n\n authRedirectUrl += `&${queryParams.redirectTo}=${redirectToUrl}`;\n\n if (platform) {\n authRedirectUrl += `&${queryParams.tenant}=${platform}`;\n }\n if (logout) {\n authRedirectUrl += \"&logout=1\";\n }\n if (isNativeApp?.() && scheme) {\n authRedirectUrl += `&scheme=${scheme}`;\n }\n\n // Small delay for any pending operations\n await new Promise((resolve) => setTimeout(resolve, 100));\n\n if (isNativeApp?.()) {\n // On native apps (e.g., Tauri), pass preserved token and navigate directly\n if (preservedToken && preserveTokenKey) {\n authRedirectUrl += `&token=${encodeURIComponent(preservedToken)}`;\n console.log(\"[redirectToAuthSpa] Added preserved token to auth URL\");\n }\n console.log(\n \"[redirectToAuthSpa] Native app, navigating to auth URL:\",\n authRedirectUrl,\n );\n window.location.href = authRedirectUrl;\n } else if (authRedirectProxy) {\n // Use auth redirect proxy endpoint\n window.location.href = `${authRedirectProxy}?to=${encodeURIComponent(authRedirectUrl)}`;\n } else {\n window.location.href = authRedirectUrl;\n }\n}\n\n/**\n * Get the URL for joining a tenant (sign up flow)\n * @param authUrl - Auth SPA base URL\n * @param tenantKey - Tenant to join\n * @param redirectUrl - URL to redirect to after joining (defaults to current URL)\n * @returns The join URL\n */\nexport function getAuthSpaJoinUrl(\n authUrl: string,\n tenantKey?: string,\n redirectUrl?: string,\n): string {\n const resolvedTenant =\n tenantKey || getPlatformKey(window.location.pathname) || \"\";\n\n if (!resolvedTenant) {\n return \"\";\n }\n\n const targetUrl = redirectUrl ?? window.location.href;\n const joinUrl = `${authUrl}/join?tenant=${encodeURIComponent(resolvedTenant)}&redirect-to=${encodeURIComponent(\n targetUrl,\n )}`;\n return joinUrl;\n}\n\n/**\n * Redirect to auth SPA's join/signup page for a specific tenant\n * @param authUrl - Auth SPA base URL\n * @param tenantKey - Tenant to join\n * @param redirectUrl - URL to redirect to after joining (defaults to current URL)\n */\nexport function redirectToAuthSpaJoinTenant(\n authUrl: string,\n tenantKey?: string,\n redirectUrl?: string,\n): void {\n const resolvedTenant =\n tenantKey || getPlatformKey(window.location.pathname) || \"\";\n\n if (!resolvedTenant) {\n console.log(\"[auth-redirect] Missing tenant key for join\", {\n tenantKey,\n redirectUrl,\n });\n redirectToAuthSpa({\n authUrl,\n appName: \"app\", // Will need to be configured\n redirectTo: redirectUrl,\n });\n return;\n }\n\n const targetUrl = redirectUrl ?? window.location.href;\n const joinUrl = `${authUrl}/join?tenant=${encodeURIComponent(resolvedTenant)}&redirect-to=${encodeURIComponent(\n targetUrl,\n )}`;\n\n window.location.href = joinUrl;\n}\n\nexport interface HandleLogoutOptions {\n /** URL to redirect to after logout (defaults to current origin) */\n redirectUrl?: string;\n /** Auth SPA base URL */\n authUrl: string;\n /** localStorage key for tenant */\n tenantStorageKey?: string;\n /** Cookie name for logout timestamp */\n logoutTimestampCookie?: string;\n /** Callback to execute before logout */\n callback?: () => void;\n}\n\n/**\n * Handle user logout\n *\n * This function:\n * - Clears localStorage (preserving tenant)\n * - Sets logout timestamp cookie for cross-SPA sync\n * - Clears all cookies\n * - Redirects to auth SPA logout endpoint\n *\n * @param options - Logout configuration options\n *\n * @example\n * ```tsx\n * handleLogout({\n * authUrl: 'https://auth.example.com',\n * redirectUrl: 'https://app.example.com',\n * });\n * ```\n */\nexport function handleLogout(options: HandleLogoutOptions): void {\n const {\n redirectUrl = window.location.origin,\n authUrl,\n tenantStorageKey = \"tenant\",\n logoutTimestampCookie = \"ibl_logout_timestamp\",\n callback,\n } = options;\n\n const tenant = window.localStorage.getItem(tenantStorageKey);\n window.localStorage.clear();\n if (tenant) {\n window.localStorage.setItem(tenantStorageKey, tenant);\n }\n\n // Set logout timestamp cookie to trigger logout on other SPAs\n setCookieForAuth(logoutTimestampCookie, Date.now().toString());\n\n clearCookies();\n callback?.();\n\n if (!isInIframe()) {\n window.location.href = `${authUrl}/logout?redirect-to=${redirectUrl}${tenant ? \"&tenant=\" + tenant : \"\"}`;\n }\n}\n\n// ── Tenant-switch coordination ─────────────────────────────────────────────\n// Cross-tab tenant switching: a TTL lock (shared via localStorage) plus a\n// BroadcastChannel signal let multiple tabs coordinate a switch and prevent the\n// \"ping-pong\" where a stale tab reverts the session to its own route's tenant.\nexport const TENANT_SWITCH_CHANNEL = \"ibl-tenant-switch\";\nexport const TENANT_SWITCH_LOCK_KEY = \"ibl_tenant_switch_lock\";\nexport const DEFAULT_TENANT_SWITCH_LOCK_TTL_MS = 8_000;\n\nexport interface TenantSwitchLock {\n tenant: string;\n /** `${ts}-${tabId}` — monotonic; newer wins. */\n token: string;\n ts: number;\n senderId: string;\n}\n\nlet _tabId: string | null = null;\n/**\n * Stable per-tab id. Uses sessionStorage so it survives same-tab reloads while\n * staying unique per tab/window.\n */\nexport function getTabId(): string {\n if (_tabId) return _tabId;\n try {\n const existing = sessionStorage.getItem(\"ibl_tab_id\");\n if (existing) return (_tabId = existing);\n const id = crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`;\n sessionStorage.setItem(\"ibl_tab_id\", id);\n return (_tabId = id);\n } catch {\n return (_tabId = `${Date.now()}-${Math.random()}`);\n }\n}\n\n/** The active (non-expired) tenant-switch lock, or null. */\nexport function readTenantSwitchLock(\n ttlMs: number = DEFAULT_TENANT_SWITCH_LOCK_TTL_MS,\n): TenantSwitchLock | null {\n try {\n const raw = localStorage.getItem(TENANT_SWITCH_LOCK_KEY);\n if (!raw) return null;\n const lock = JSON.parse(raw) as TenantSwitchLock;\n if (typeof lock?.ts !== \"number\") return null;\n if (Date.now() - lock.ts > ttlMs) return null;\n return lock;\n } catch {\n return null;\n }\n}\n\n/** Write a fresh lock for `tenant` (newest intent). Returns the lock written. */\nexport function writeTenantSwitchLock(tenant: string): TenantSwitchLock {\n const lock: TenantSwitchLock = {\n tenant,\n token: `${Date.now()}-${getTabId()}`,\n ts: Date.now(),\n senderId: getTabId(),\n };\n try {\n localStorage.setItem(TENANT_SWITCH_LOCK_KEY, JSON.stringify(lock));\n } catch {}\n return lock;\n}\n\n/** Extend an existing lock's window from \"now\" (no-op when no active lock). */\nexport function refreshTenantSwitchLock(): void {\n const lock = readTenantSwitchLock();\n if (!lock) return;\n try {\n localStorage.setItem(\n TENANT_SWITCH_LOCK_KEY,\n JSON.stringify({ ...lock, ts: Date.now() }),\n );\n } catch {}\n}\n\nexport function clearTenantSwitchLock(): void {\n try {\n localStorage.removeItem(TENANT_SWITCH_LOCK_KEY);\n } catch {}\n}\n\n/** True while a tenant switch is in flight — gate automatic reverts on this. */\nexport function isTenantSwitchInProgress(ttlMs?: number): boolean {\n return readTenantSwitchLock(ttlMs) !== null;\n}\n\nexport interface HandleTenantSwitchOptions {\n /** Auth SPA base URL (e.g. config.authUrl()). */\n authUrl: string;\n /** localStorage key for the saved redirect path (default \"redirect-to\"). */\n redirectPathStorageKey?: string;\n /** localStorage key for a JWT to forward through the switch (default \"edx_jwt_token\"). */\n preserveTokenKey?: string;\n /** localStorage key holding the tenant (default \"tenant\"). */\n tenantStorageKey?: string;\n /** Cookie name signalling a switch is in progress (default \"ibl_tenant_switching\"). */\n tenantSwitchingCookie?: string;\n /** Query-param names for the auth URL. */\n queryParams?: { tenant?: string; redirectTo?: string };\n /** Persist the current path so the app returns to it post-switch. */\n saveRedirect?: boolean;\n /** Explicit redirect target (defaults to window.location.origin). */\n redirectUrl?: string;\n /** Broadcast to other tabs + clear storage (true for user-initiated; default true). */\n broadcast?: boolean;\n /** Lock TTL override. */\n lockTtlMs?: number;\n /** Injected so this util stays React-free (mentorai passes the SDK's). */\n clearCurrentTenantCookie?: () => void;\n}\n\n/**\n * Switch the active tenant. Coordinates across tabs (TTL lock + BroadcastChannel),\n * clears storage, then redirects through the auth SPA's `/login/complete`.\n *\n * @example\n * await handleTenantSwitch(\"acme\", {\n * authUrl: config.authUrl(),\n * clearCurrentTenantCookie,\n * });\n */\nexport async function handleTenantSwitch(\n tenant: string,\n options: HandleTenantSwitchOptions,\n): Promise<void> {\n const {\n authUrl,\n redirectPathStorageKey = \"redirect-to\",\n preserveTokenKey = \"edx_jwt_token\",\n tenantStorageKey = \"tenant\",\n tenantSwitchingCookie = \"ibl_tenant_switching\",\n queryParams = {},\n saveRedirect = false,\n redirectUrl,\n broadcast = true,\n clearCurrentTenantCookie,\n } = options;\n const tenantParam = queryParams.tenant ?? \"tenant\";\n const redirectToParam = queryParams.redirectTo ?? \"redirect-to\";\n\n // Guard: don't start a new user switch while one is already in progress.\n if (broadcast && document.cookie.includes(tenantSwitchingCookie)) return;\n // Guard: already on the target tenant.\n if (tenant === localStorage.getItem(tenantStorageKey)) return;\n\n if (broadcast) {\n setCookieForAuth(tenantSwitchingCookie, \"true\");\n writeTenantSwitchLock(tenant);\n if (typeof BroadcastChannel !== \"undefined\") {\n const channel = new BroadcastChannel(TENANT_SWITCH_CHANNEL);\n const lock = readTenantSwitchLock(options.lockTtlMs);\n channel.postMessage({\n type: \"TENANT_SWITCHING\",\n tenant,\n senderId: lock?.senderId ?? getTabId(),\n token: lock?.token,\n });\n channel.close();\n }\n clearCurrentTenantCookie?.();\n }\n\n const currentPath = `${window.location.pathname}${window.location.search}`;\n const jwtToken = localStorage.getItem(preserveTokenKey);\n if (broadcast) localStorage.clear();\n\n const params: Record<string, string> = {\n [tenantParam]: tenant,\n [redirectToParam]: redirectUrl ?? window.location.origin,\n };\n if (jwtToken) params.token = jwtToken;\n\n localStorage.setItem(tenantStorageKey, tenant);\n if (saveRedirect) localStorage.setItem(redirectPathStorageKey, currentPath);\n // Re-persist: localStorage.clear() above wiped the pre-broadcast lock; this\n // copy survives the redirect so stale tabs honor the switch window.\n if (broadcast) writeTenantSwitchLock(tenant);\n\n await new Promise((resolve) => setTimeout(resolve, 100));\n window.location.href = `${authUrl}/login/complete?${new URLSearchParams(params)}`;\n}\n"],"names":[],"mappings":";;AAAA;;;;;AAKG;AAEH;;;AAGG;SACa,UAAU,GAAA;AACxB,IAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AACjC,QAAA,OA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M,CAAC,QAAQ,CAAC,MAAM,EAAE;IAC1E,MAAM,QAAQ,GAAG,YAAY,CAAC,OAAO,CAAC,gBAAgB,CAAC;AACvD,IAAA,IAAI,SAAS;QAAE,YAAY,CAAC,KAAK,EAAE;AAEnC,IAAA,MAAM,MAAM,GAA2B;QACrC,CAAC,WAAW,GAAG,MAAM;AACrB,QAAA,CAAC,eAAe,GAAG,WAAW,KAAA,IAAA,IAAX,WAAW,KAAA,MAAA,GAAX,WAAW,GAAI,MAAM,CAAC,QAAQ,CAAC,MAAM;KACzD;AACD,IAAA,IAAI,QAAQ;AAAE,QAAA,MAAM,CAAC,KAAK,GAAG,QAAQ;AAErC,IAAA,YAAY,CAAC,OAAO,CAAC,gBAAgB,EAAE,MAAM,CAAC;AAC9C,IAAA,IAAI,YAAY;AAAE,QAAA,YAAY,CAAC,OAAO,CAAC,sBAAsB,EAAE,WAAW,CAAC;;;AAG3E,IAAA,IAAI,SAAS;QAAE,qBAAqB,CAAC,MAAM,CAAC;AAE5C,IAAA,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACxD,IAAA,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAA,EAAG,OAAO,CAAA,gBAAA,EAAmB,IAAI,eAAe,CAAC,MAAM,CAAC,EAAE;AACnF;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Tests for packages/web-utils/src/index.mobile.ts
3
+ *
4
+ * This file tests the mobile-specific entry point for @iblai/web-utils.
5
+ * It verifies all exports are properly exposed and functional.
6
+ */
7
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Tests for packages/web-utils/src/index.web.ts
3
+ *
4
+ * This file tests the web-specific entry point for @iblai/web-utils.
5
+ * It verifies all exports are properly exposed and functional,
6
+ * including web-specific features like Next.js navigation hooks.
7
+ */
8
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Chat area size constants
3
+ */
4
+ export declare const CHAT_AREA_SIZE: {
5
+ readonly DEFAULT: 848;
6
+ readonly MIN: 672;
7
+ readonly MAX: 1024;
8
+ };
@@ -0,0 +1,7 @@
1
+ import { type Slice } from "@reduxjs/toolkit";
2
+ export interface AppleRestrictionState {
3
+ openAppleRestrictionModal: boolean;
4
+ }
5
+ export declare const appleRestrictionSlice: Slice<AppleRestrictionState>;
6
+ export declare const setOpenAppleRestrictionModal: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<`${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPayload<any, `${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, any> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, any>;
7
+ export declare const appleRestrictionReducer: import("@reduxjs/toolkit").Reducer<AppleRestrictionState>;
@@ -0,0 +1,164 @@
1
+ import { type Reducer } from "@reduxjs/toolkit";
2
+ import type { AdvancedTab } from "../../utils";
3
+ import type { Message, ToolCallInfo } from "../../hooks/chat/use-chat-v2";
4
+ export type ChatState = Record<AdvancedTab, Message[]>;
5
+ export type SessionIds = Record<AdvancedTab, string>;
6
+ export type StreamingMessage = {
7
+ id: string;
8
+ content: string;
9
+ reasoningContent: string;
10
+ toolCalls: ToolCallInfo[];
11
+ isReasoning: boolean;
12
+ };
13
+ export type StreamingArtifact = {
14
+ id?: number;
15
+ title: string;
16
+ fileExtension: string;
17
+ content: string;
18
+ isUpdate: boolean;
19
+ isPartial: boolean;
20
+ startIndex?: number;
21
+ endIndex?: number;
22
+ org?: string;
23
+ userId?: string;
24
+ sessionId?: string;
25
+ versionNumber?: number;
26
+ metadata?: Record<string, unknown>;
27
+ };
28
+ export declare const STREAMING_CONTENT_BUFFER_THRESHOLD = 300;
29
+ export declare const STREAMING_CONTENT_FLUSH_INTERVAL = 300;
30
+ export declare const defaultSessionIds: SessionIds;
31
+ export type ChatStatus = "idle" | "pending" | "streaming" | "stopped" | "error";
32
+ export type ChatSliceState = {
33
+ chats: ChatState;
34
+ isTyping: boolean;
35
+ streaming: boolean;
36
+ currentStreamingMessage: StreamingMessage;
37
+ currentStreamingArtifact: StreamingArtifact | null;
38
+ activeTab: AdvancedTab;
39
+ sessionId: string;
40
+ sessionIds: SessionIds;
41
+ status: ChatStatus;
42
+ tools: string[];
43
+ token: string | null;
44
+ tokenEnabled: boolean;
45
+ iframeContext: {
46
+ hostInfo: {
47
+ title: string;
48
+ href: string;
49
+ };
50
+ pageContent: string;
51
+ metadata: Record<string, string> | null;
52
+ };
53
+ documentFilter: Record<string, unknown> | null;
54
+ shouldStartNewChat: boolean;
55
+ showingSharedChat: boolean;
56
+ artifactsEnabled: boolean;
57
+ streamingArtifactContentBuffer: string;
58
+ lastArtifactContentFlushTime: number;
59
+ streamingReasoningContentBuffer: string;
60
+ lastReasoningContentFlushTime: number;
61
+ metadata: {
62
+ edxCourseId: string;
63
+ edxUsageId: string;
64
+ };
65
+ };
66
+ export declare const chatActions: import("@reduxjs/toolkit").CaseReducerActions<import("@reduxjs/toolkit").SliceCaseReducers<ChatSliceState>, string>;
67
+ export declare const chatSliceReducerShared: Reducer<ChatSliceState>;
68
+ export declare const selectChats: (state: {
69
+ chatSliceShared: ChatSliceState;
70
+ }) => ChatState;
71
+ export declare const selectIsTyping: (state: {
72
+ chatSliceShared: ChatSliceState;
73
+ }) => boolean;
74
+ export declare const selectStreaming: (state: {
75
+ chatSliceShared: ChatSliceState;
76
+ }) => boolean;
77
+ export declare const selectStatus: (state: {
78
+ chatSliceShared: ChatSliceState;
79
+ }) => ChatStatus;
80
+ export declare const selectIsPending: (state: {
81
+ chatSliceShared: ChatSliceState;
82
+ }) => boolean;
83
+ export declare const selectIsStopped: (state: {
84
+ chatSliceShared: ChatSliceState;
85
+ }) => boolean;
86
+ export declare const selectIsError: (state: {
87
+ chatSliceShared: ChatSliceState;
88
+ }) => boolean;
89
+ export declare const selectCurrentStreamingMessage: (state: {
90
+ chatSliceShared: ChatSliceState;
91
+ }) => StreamingMessage;
92
+ export declare const selectActiveTab: (state: {
93
+ chatSliceShared: ChatSliceState;
94
+ }) => "chat" | "summarize" | "translate" | "expand";
95
+ export declare const selectSessionId: (state: {
96
+ chatSliceShared: ChatSliceState;
97
+ }) => string;
98
+ export declare const selectSessionIds: (state: {
99
+ chatSliceShared: ChatSliceState;
100
+ }) => SessionIds;
101
+ export declare const selectIframeContext: (state: {
102
+ chatSliceShared: ChatSliceState;
103
+ }) => {
104
+ hostInfo: {
105
+ title: string;
106
+ href: string;
107
+ };
108
+ pageContent: string;
109
+ metadata: Record<string, string> | null;
110
+ };
111
+ export declare const selectMetadata: (state: {
112
+ chatSliceShared: ChatSliceState;
113
+ }) => {
114
+ edxCourseId: string;
115
+ edxUsageId: string;
116
+ };
117
+ export declare const selectDocumentFilter: (state: {
118
+ chatSliceShared: ChatSliceState;
119
+ }) => Record<string, unknown> | null;
120
+ export declare const selectTools: (state: {
121
+ chatSliceShared: ChatSliceState;
122
+ }) => string[];
123
+ export declare const selectToken: (state: {
124
+ chatSliceShared: ChatSliceState;
125
+ }) => string | null;
126
+ export declare const selectTokenEnabled: (state: {
127
+ chatSliceShared: ChatSliceState;
128
+ }) => boolean;
129
+ export declare const selectActiveChatMessages: (state: {
130
+ chatSliceShared: ChatSliceState;
131
+ }) => Message[];
132
+ export declare const selectNumberOfActiveChatMessages: (state: {
133
+ chatSliceShared: ChatSliceState;
134
+ }) => number;
135
+ export declare const selectShouldStartNewChat: (state: {
136
+ chatSliceShared: ChatSliceState;
137
+ }) => boolean;
138
+ export declare const selectShowingSharedChat: (state: {
139
+ chatSliceShared: ChatSliceState;
140
+ }) => boolean;
141
+ export declare const selectArtifactsEnabled: (state: {
142
+ chatSliceShared: ChatSliceState;
143
+ }) => boolean;
144
+ export declare const selectCurrentStreamingArtifact: (state: {
145
+ chatSliceShared: ChatSliceState;
146
+ }) => StreamingArtifact | null;
147
+ export declare const selectStreamingArtifactContentBuffer: (state: {
148
+ chatSliceShared: ChatSliceState;
149
+ }) => string;
150
+ export declare const selectLastArtifactContentFlushTime: (state: {
151
+ chatSliceShared: ChatSliceState;
152
+ }) => number;
153
+ export declare const selectStreamingArtifactFullContent: (state: {
154
+ chatSliceShared: ChatSliceState;
155
+ }) => string | null;
156
+ export declare const selectStreamingReasoningContent: (state: {
157
+ chatSliceShared: ChatSliceState;
158
+ }) => string;
159
+ export declare const selectIsReasoning: (state: {
160
+ chatSliceShared: ChatSliceState;
161
+ }) => boolean;
162
+ export declare const selectStreamingToolCalls: (state: {
163
+ chatSliceShared: ChatSliceState;
164
+ }) => ToolCallInfo[];
@@ -0,0 +1,12 @@
1
+ import { Slice, type Reducer } from "@reduxjs/toolkit/react";
2
+ export interface ChatInputState {
3
+ textareaInput: string;
4
+ }
5
+ export declare const chatInputSlice: Slice<ChatInputState>;
6
+ export declare const chatInputSliceSelectors: {
7
+ selectTextareaInput: (state: {
8
+ chatInput: ChatInputState;
9
+ }) => string;
10
+ };
11
+ export declare const chatInputSliceActions: import("@reduxjs/toolkit").CaseReducerActions<import("@reduxjs/toolkit").SliceCaseReducers<ChatInputState>, string>;
12
+ export declare const chatInputSliceReducer: Reducer<ChatInputState>;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Combines multiple CSV data objects by merging rows based on a common column.
3
+ * Duplicate columns across CSVs are included only once.
4
+ *
5
+ * @param csvDataArray - Array of CSV data objects with headers and rows
6
+ * @param joinColumn - Column name to use for joining (default: 'email')
7
+ * @returns Combined CSV data with merged headers and rows
8
+ */
9
+ export declare function combineCSVData(csvDataArray: Array<{
10
+ headers: string[];
11
+ rows: string[][];
12
+ }>, joinColumn?: string): {
13
+ headers: string[];
14
+ rows: string[][];
15
+ };
16
+ /**
17
+ * Parses CSV text into headers and rows
18
+ *
19
+ * @param csvText - Raw CSV text content
20
+ * @returns Object with headers and rows arrays
21
+ */
22
+ export declare function parseCSV(csvText: string): {
23
+ headers: string[];
24
+ rows: string[][];
25
+ };
26
+ /**
27
+ * Converts CSV data back to CSV text format
28
+ *
29
+ * @param data - Object with headers and rows
30
+ * @returns CSV text content
31
+ */
32
+ export declare function csvDataToText(data: {
33
+ headers: string[];
34
+ rows: string[][];
35
+ }): string;
@@ -0,0 +1 @@
1
+ export * from "./combine-csv";
@@ -0,0 +1,23 @@
1
+ import { type Slice, type Reducer } from "@reduxjs/toolkit";
2
+ export interface AttachedFile {
3
+ id: string;
4
+ fileName: string;
5
+ fileType: string;
6
+ fileSize: number;
7
+ uploadUrl: string;
8
+ uploadProgress: number;
9
+ uploadStatus: "pending" | "uploading" | "processing" | "success" | "error";
10
+ fileKey?: string;
11
+ fileId?: string;
12
+ retryCount?: number;
13
+ fileUrl?: string;
14
+ }
15
+ export interface FilesState {
16
+ attachedFiles: AttachedFile[];
17
+ }
18
+ export declare const filesSlice: Slice<FilesState>;
19
+ export declare const addFiles: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<`${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPayload<any, `${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, any> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, any>, removeFile: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<`${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPayload<any, `${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, any> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, any>, clearFiles: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<`${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPayload<any, `${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, any> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, any>, updateFileProgress: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<`${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPayload<any, `${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, any> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, any>, updateFileStatus: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<`${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPayload<any, `${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, any> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, any>, updateFileUrl: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<`${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPayload<any, `${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, any> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, any>, updateFileMetadata: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<`${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPayload<any, `${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, any> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, any>, updateFileRetryCount: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<`${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPayload<any, `${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, any> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, any>, updateFileUrlFromWebSocket: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<`${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPayload<any, `${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, any> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, any>;
20
+ export declare const filesReducer: Reducer<FilesState>;
21
+ export declare const selectAttachedFiles: (state: {
22
+ files: FilesState;
23
+ }) => AttachedFile[];
@@ -0,0 +1,17 @@
1
+ import { Slice } from "@reduxjs/toolkit";
2
+ interface Message {
3
+ role: "user" | "assistant";
4
+ content: string;
5
+ replyTo?: unknown;
6
+ }
7
+ export interface HostChatState {
8
+ messages: Message[];
9
+ enableChatActionsPopup: boolean;
10
+ }
11
+ export declare const hostChatSlice: Slice<HostChatState>;
12
+ export declare const addMessage: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<`${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPayload<any, `${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, any> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, any>, clearMessages: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<`${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPayload<any, `${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, any> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, any>, enableChatActionsPopup: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<`${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPayload<any, `${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, any> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, any>;
13
+ export declare const hostChatReducer: import("@reduxjs/toolkit").Reducer<HostChatState>;
14
+ export declare const selectEnableChatActionsPopup: (state: {
15
+ chat: HostChatState;
16
+ }) => boolean;
17
+ export {};
@@ -0,0 +1,11 @@
1
+ export * from "./chat/slice";
2
+ export * from "./tracking";
3
+ export * from "./files/filesSlice";
4
+ export * from "./csv";
5
+ export * from "./monetization/slice";
6
+ export * from "./rbac/rbac-slice";
7
+ export * from "./chat-input/api-slice";
8
+ export * from "./host-chat/slice";
9
+ export * from "./subscription/slice";
10
+ export * from "./apple-restriction/slice";
11
+ export * from "./top-banner/slice";
@@ -0,0 +1,16 @@
1
+ import { type Slice } from "@reduxjs/toolkit";
2
+ import type { AccessCheckResponse } from "@iblai/data-layer";
3
+ interface showMonetizationCheckoutModalPayload {
4
+ showModal?: boolean;
5
+ paywallClosable: boolean;
6
+ onClosePayload: string | undefined;
7
+ }
8
+ export interface MonetizationState {
9
+ displayMonetizationCheckoutModal: boolean;
10
+ accessCheckResponse: (AccessCheckResponse & showMonetizationCheckoutModalPayload) | null;
11
+ paywallClosable: boolean;
12
+ onClosePayload: string | undefined;
13
+ }
14
+ export declare const monetizationSlice: Slice;
15
+ export declare const setDisplayMonetizationCheckoutModal: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<`${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPayload<any, `${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, any> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, any>, setAccessCheckResponse: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<`${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPayload<any, `${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, any> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, any>, showMonetizationCheckoutModal: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<`${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPayload<any, `${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, any> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, any>, setAdvancedDisplayMonetizationCheckoutModal: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<`${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPayload<any, `${string}/${string}`> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, never, any> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, never> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<any[], any, `${string}/${string}`, any, any>;
16
+ export default monetizationSlice;