@openedx/frontend-base 1.0.0-alpha.2 → 1.0.0-alpha.21

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 (782) hide show
  1. package/README.md +27 -0
  2. package/{index.ts → dist/index.d.ts} +0 -3
  3. package/dist/index.js +4 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/runtime/analytics/MockAnalyticsService.d.ts +50 -0
  6. package/dist/runtime/analytics/MockAnalyticsService.js +64 -0
  7. package/dist/runtime/analytics/MockAnalyticsService.js.map +1 -0
  8. package/dist/runtime/analytics/SegmentAnalyticsService.d.ts +64 -0
  9. package/dist/runtime/analytics/SegmentAnalyticsService.js +218 -0
  10. package/dist/runtime/analytics/SegmentAnalyticsService.js.map +1 -0
  11. package/dist/runtime/analytics/index.d.ts +3 -0
  12. package/dist/runtime/analytics/index.js +4 -0
  13. package/dist/runtime/analytics/index.js.map +1 -0
  14. package/dist/runtime/analytics/interface.d.ts +53 -0
  15. package/{runtime → dist/runtime}/analytics/interface.js +26 -38
  16. package/dist/runtime/analytics/interface.js.map +1 -0
  17. package/dist/runtime/auth/AxiosCsrfTokenService.d.ts +10 -0
  18. package/dist/runtime/auth/AxiosCsrfTokenService.js +64 -0
  19. package/dist/runtime/auth/AxiosCsrfTokenService.js.map +1 -0
  20. package/dist/runtime/auth/AxiosJwtAuthService.d.ts +182 -0
  21. package/dist/runtime/auth/AxiosJwtAuthService.js +339 -0
  22. package/dist/runtime/auth/AxiosJwtAuthService.js.map +1 -0
  23. package/dist/runtime/auth/AxiosJwtTokenService.d.ts +16 -0
  24. package/dist/runtime/auth/AxiosJwtTokenService.js +130 -0
  25. package/dist/runtime/auth/AxiosJwtTokenService.js.map +1 -0
  26. package/dist/runtime/auth/LocalForageCache.d.ts +7 -0
  27. package/dist/runtime/auth/LocalForageCache.js +78 -0
  28. package/dist/runtime/auth/LocalForageCache.js.map +1 -0
  29. package/dist/runtime/auth/MockAuthService.d.ts +209 -0
  30. package/dist/runtime/auth/MockAuthService.js +256 -0
  31. package/dist/runtime/auth/MockAuthService.js.map +1 -0
  32. package/dist/runtime/auth/index.d.ts +3 -0
  33. package/dist/runtime/auth/index.js +4 -0
  34. package/dist/runtime/auth/index.js.map +1 -0
  35. package/dist/runtime/auth/interceptors/createCsrfTokenProviderInterceptor.d.ts +2 -0
  36. package/dist/runtime/auth/interceptors/createCsrfTokenProviderInterceptor.js +42 -0
  37. package/dist/runtime/auth/interceptors/createCsrfTokenProviderInterceptor.js.map +1 -0
  38. package/dist/runtime/auth/interceptors/createJwtTokenProviderInterceptor.d.ts +2 -0
  39. package/dist/runtime/auth/interceptors/createJwtTokenProviderInterceptor.js +40 -0
  40. package/dist/runtime/auth/interceptors/createJwtTokenProviderInterceptor.js.map +1 -0
  41. package/dist/runtime/auth/interceptors/createProcessAxiosRequestErrorInterceptor.d.ts +2 -0
  42. package/dist/runtime/auth/interceptors/createProcessAxiosRequestErrorInterceptor.js +26 -0
  43. package/dist/runtime/auth/interceptors/createProcessAxiosRequestErrorInterceptor.js.map +1 -0
  44. package/dist/runtime/auth/interceptors/createRetryInterceptor.d.ts +3 -0
  45. package/dist/runtime/auth/interceptors/createRetryInterceptor.js +67 -0
  46. package/dist/runtime/auth/interceptors/createRetryInterceptor.js.map +1 -0
  47. package/dist/runtime/auth/interface.d.ts +133 -0
  48. package/{runtime → dist/runtime}/auth/interface.js +65 -72
  49. package/dist/runtime/auth/interface.js.map +1 -0
  50. package/dist/runtime/auth/utils.d.ts +13 -0
  51. package/dist/runtime/auth/utils.js +66 -0
  52. package/dist/runtime/auth/utils.js.map +1 -0
  53. package/dist/runtime/babel.config.d.ts +2 -0
  54. package/{runtime → dist/runtime}/babel.config.js +2 -1
  55. package/dist/runtime/babel.config.js.map +1 -0
  56. package/{runtime/config/index.ts → dist/runtime/config/index.d.ts} +28 -124
  57. package/dist/runtime/config/index.js +327 -0
  58. package/dist/runtime/config/index.js.map +1 -0
  59. package/dist/runtime/constants.d.ts +57 -0
  60. package/{runtime/constants.ts → dist/runtime/constants.js} +1 -11
  61. package/dist/runtime/constants.js.map +1 -0
  62. package/dist/runtime/i18n/index.d.ts +3 -0
  63. package/{runtime → dist/runtime}/i18n/index.js +4 -44
  64. package/dist/runtime/i18n/index.js.map +1 -0
  65. package/dist/runtime/i18n/injectIntlWithShim.d.ts +11 -0
  66. package/dist/runtime/i18n/injectIntlWithShim.js +45 -0
  67. package/dist/runtime/i18n/injectIntlWithShim.js.map +1 -0
  68. package/dist/runtime/i18n/lib.d.ts +119 -0
  69. package/dist/runtime/i18n/lib.js +236 -0
  70. package/dist/runtime/i18n/lib.js.map +1 -0
  71. package/dist/runtime/index.d.ts +13 -0
  72. package/dist/runtime/index.js +14 -0
  73. package/dist/runtime/index.js.map +1 -0
  74. package/dist/runtime/initialize.d.ts +91 -0
  75. package/dist/runtime/initialize.js +315 -0
  76. package/dist/runtime/initialize.js.map +1 -0
  77. package/dist/runtime/jest.config.d.ts +16 -0
  78. package/dist/runtime/jest.config.js +34 -0
  79. package/dist/runtime/jest.config.js.map +1 -0
  80. package/dist/runtime/logging/MockLoggingService.d.ts +28 -0
  81. package/dist/runtime/logging/MockLoggingService.js +31 -0
  82. package/dist/runtime/logging/MockLoggingService.js.map +1 -0
  83. package/dist/runtime/logging/NewRelicLoggingService.d.ts +67 -0
  84. package/dist/runtime/logging/NewRelicLoggingService.js +175 -0
  85. package/dist/runtime/logging/NewRelicLoggingService.js.map +1 -0
  86. package/{runtime/logging/index.ts → dist/runtime/logging/index.d.ts} +1 -7
  87. package/dist/runtime/logging/index.js +4 -0
  88. package/dist/runtime/logging/index.js.map +1 -0
  89. package/dist/runtime/logging/interface.d.ts +38 -0
  90. package/{runtime → dist/runtime}/logging/interface.js +16 -26
  91. package/dist/runtime/logging/interface.js.map +1 -0
  92. package/dist/runtime/logging/types.d.ts +4 -0
  93. package/dist/runtime/logging/types.js +2 -0
  94. package/dist/runtime/logging/types.js.map +1 -0
  95. package/dist/runtime/react/AuthenticatedPageRoute.d.ts +30 -0
  96. package/{runtime/react/AuthenticatedPageRoute.jsx → dist/runtime/react/AuthenticatedPageRoute.js} +13 -18
  97. package/dist/runtime/react/AuthenticatedPageRoute.js.map +1 -0
  98. package/dist/runtime/react/CombinedAppProvider.d.ts +6 -0
  99. package/dist/runtime/react/CombinedAppProvider.js +24 -0
  100. package/dist/runtime/react/CombinedAppProvider.js.map +1 -0
  101. package/dist/runtime/react/CurrentAppContext.d.ts +20 -0
  102. package/{runtime/react/CurrentAppContext.tsx → dist/runtime/react/CurrentAppContext.js} +3 -7
  103. package/dist/runtime/react/CurrentAppContext.js.map +1 -0
  104. package/dist/runtime/react/CurrentAppProvider.d.ts +23 -0
  105. package/dist/runtime/react/CurrentAppProvider.js +33 -0
  106. package/dist/runtime/react/CurrentAppProvider.js.map +1 -0
  107. package/dist/runtime/react/Divider.d.ts +1 -0
  108. package/dist/runtime/react/Divider.js +5 -0
  109. package/dist/runtime/react/Divider.js.map +1 -0
  110. package/dist/runtime/react/ErrorBoundary.d.ts +32 -0
  111. package/dist/runtime/react/ErrorBoundary.js +40 -0
  112. package/dist/runtime/react/ErrorBoundary.js.map +1 -0
  113. package/dist/runtime/react/ErrorPage.d.ts +17 -0
  114. package/dist/runtime/react/ErrorPage.js +29 -0
  115. package/dist/runtime/react/ErrorPage.js.map +1 -0
  116. package/dist/runtime/react/LoginRedirect.d.ts +8 -0
  117. package/{runtime/react/LoginRedirect.jsx → dist/runtime/react/LoginRedirect.js} +5 -5
  118. package/dist/runtime/react/LoginRedirect.js.map +1 -0
  119. package/dist/runtime/react/NotFoundPage.d.ts +2 -0
  120. package/dist/runtime/react/NotFoundPage.js +14 -0
  121. package/dist/runtime/react/NotFoundPage.js.map +1 -0
  122. package/dist/runtime/react/PageWrap.d.ts +8 -0
  123. package/{runtime/react/PageWrap.jsx → dist/runtime/react/PageWrap.js} +7 -10
  124. package/dist/runtime/react/PageWrap.js.map +1 -0
  125. package/dist/runtime/react/SiteContext.d.ts +24 -0
  126. package/{runtime/react/SiteContext.tsx → dist/runtime/react/SiteContext.js} +5 -11
  127. package/dist/runtime/react/SiteContext.js.map +1 -0
  128. package/dist/runtime/react/SiteProvider.d.ts +29 -0
  129. package/dist/runtime/react/SiteProvider.js +69 -0
  130. package/dist/runtime/react/SiteProvider.js.map +1 -0
  131. package/dist/runtime/react/constants.d.ts +3 -0
  132. package/dist/runtime/react/constants.js +4 -0
  133. package/dist/runtime/react/constants.js.map +1 -0
  134. package/dist/runtime/react/hooks/index.d.ts +7 -0
  135. package/dist/runtime/react/hooks/index.js +8 -0
  136. package/dist/runtime/react/hooks/index.js.map +1 -0
  137. package/dist/runtime/react/hooks/theme/index.d.ts +2 -0
  138. package/dist/runtime/react/hooks/theme/index.js +3 -0
  139. package/dist/runtime/react/hooks/theme/index.js.map +1 -0
  140. package/dist/runtime/react/hooks/theme/useTheme.d.ts +35 -0
  141. package/dist/runtime/react/hooks/theme/useTheme.js +153 -0
  142. package/dist/runtime/react/hooks/theme/useTheme.js.map +1 -0
  143. package/dist/runtime/react/hooks/theme/useThemeConfig.d.ts +16 -0
  144. package/dist/runtime/react/hooks/theme/useThemeConfig.js +29 -0
  145. package/dist/runtime/react/hooks/theme/useThemeConfig.js.map +1 -0
  146. package/dist/runtime/react/hooks/theme/useThemeCore.d.ts +10 -0
  147. package/dist/runtime/react/hooks/theme/useThemeCore.js +40 -0
  148. package/dist/runtime/react/hooks/theme/useThemeCore.js.map +1 -0
  149. package/dist/runtime/react/hooks/theme/useThemeVariants.d.ts +17 -0
  150. package/dist/runtime/react/hooks/theme/useThemeVariants.js +90 -0
  151. package/dist/runtime/react/hooks/theme/useThemeVariants.js.map +1 -0
  152. package/dist/runtime/react/hooks/theme/useTrackColorSchemeChoice.d.ts +8 -0
  153. package/dist/runtime/react/hooks/theme/useTrackColorSchemeChoice.js +30 -0
  154. package/dist/runtime/react/hooks/theme/useTrackColorSchemeChoice.js.map +1 -0
  155. package/dist/runtime/react/hooks/theme/utils.d.ts +6 -0
  156. package/dist/runtime/react/hooks/theme/utils.js +11 -0
  157. package/dist/runtime/react/hooks/theme/utils.js.map +1 -0
  158. package/dist/runtime/react/hooks/useActiveRoles.d.ts +2 -0
  159. package/dist/runtime/react/hooks/useActiveRoles.js +13 -0
  160. package/dist/runtime/react/hooks/useActiveRoles.js.map +1 -0
  161. package/dist/runtime/react/hooks/useActiveRouteRoleWatcher.d.ts +2 -0
  162. package/dist/runtime/react/hooks/useActiveRouteRoleWatcher.js +26 -0
  163. package/dist/runtime/react/hooks/useActiveRouteRoleWatcher.js.map +1 -0
  164. package/dist/runtime/react/hooks/useAppConfig.d.ts +2 -0
  165. package/dist/runtime/react/hooks/useAppConfig.js +8 -0
  166. package/dist/runtime/react/hooks/useAppConfig.js.map +1 -0
  167. package/dist/runtime/react/hooks/useAuthenticatedUser.d.ts +2 -0
  168. package/dist/runtime/react/hooks/useAuthenticatedUser.js +8 -0
  169. package/dist/runtime/react/hooks/useAuthenticatedUser.js.map +1 -0
  170. package/dist/runtime/react/hooks/useSiteConfig.d.ts +2 -0
  171. package/dist/runtime/react/hooks/useSiteConfig.js +8 -0
  172. package/dist/runtime/react/hooks/useSiteConfig.js.map +1 -0
  173. package/dist/runtime/react/hooks/useSiteEvent.d.ts +12 -0
  174. package/dist/runtime/react/hooks/useSiteEvent.js +22 -0
  175. package/dist/runtime/react/hooks/useSiteEvent.js.map +1 -0
  176. package/{runtime/react/index.ts → dist/runtime/react/index.d.ts} +1 -1
  177. package/dist/runtime/react/index.js +20 -0
  178. package/dist/runtime/react/index.js.map +1 -0
  179. package/dist/runtime/react/reducers.d.ts +11 -0
  180. package/dist/runtime/react/reducers.js +28 -0
  181. package/dist/runtime/react/reducers.js.map +1 -0
  182. package/dist/runtime/routing/authenticatedLoader.d.ts +2 -0
  183. package/dist/runtime/routing/authenticatedLoader.js +27 -0
  184. package/dist/runtime/routing/authenticatedLoader.js.map +1 -0
  185. package/dist/runtime/routing/index.d.ts +2 -0
  186. package/dist/runtime/routing/index.js +3 -0
  187. package/dist/runtime/routing/index.js.map +1 -0
  188. package/dist/runtime/routing/utils.d.ts +4 -0
  189. package/dist/runtime/routing/utils.js +43 -0
  190. package/dist/runtime/routing/utils.js.map +1 -0
  191. package/dist/runtime/scripts/GoogleAnalyticsLoader.d.ts +12 -0
  192. package/dist/runtime/scripts/GoogleAnalyticsLoader.js +49 -0
  193. package/dist/runtime/scripts/GoogleAnalyticsLoader.js.map +1 -0
  194. package/dist/runtime/scripts/index.js +2 -0
  195. package/dist/runtime/scripts/index.js.map +1 -0
  196. package/dist/runtime/setupTest.d.ts +1 -0
  197. package/dist/runtime/setupTest.js +12 -0
  198. package/dist/runtime/setupTest.js.map +1 -0
  199. package/dist/runtime/slots/Slot.d.ts +10 -0
  200. package/dist/runtime/slots/Slot.js +35 -0
  201. package/dist/runtime/slots/Slot.js.map +1 -0
  202. package/dist/runtime/slots/SlotContext.d.ts +8 -0
  203. package/dist/runtime/slots/SlotContext.js +7 -0
  204. package/dist/runtime/slots/SlotContext.js.map +1 -0
  205. package/dist/runtime/slots/hooks.d.ts +13 -0
  206. package/dist/runtime/slots/hooks.js +29 -0
  207. package/dist/runtime/slots/hooks.js.map +1 -0
  208. package/dist/runtime/slots/index.js +7 -0
  209. package/dist/runtime/slots/index.js.map +1 -0
  210. package/dist/runtime/slots/layout/DefaultSlotLayout.d.ts +1 -0
  211. package/dist/runtime/slots/layout/DefaultSlotLayout.js +7 -0
  212. package/dist/runtime/slots/layout/DefaultSlotLayout.js.map +1 -0
  213. package/dist/runtime/slots/layout/hooks.d.ts +10 -0
  214. package/dist/runtime/slots/layout/hooks.js +57 -0
  215. package/dist/runtime/slots/layout/hooks.js.map +1 -0
  216. package/dist/runtime/slots/layout/index.js +5 -0
  217. package/dist/runtime/slots/layout/index.js.map +1 -0
  218. package/{runtime/slots/layout/types.ts → dist/runtime/slots/layout/types.d.ts} +10 -25
  219. package/dist/runtime/slots/layout/types.js +12 -0
  220. package/dist/runtime/slots/layout/types.js.map +1 -0
  221. package/dist/runtime/slots/layout/utils.d.ts +5 -0
  222. package/dist/runtime/slots/layout/utils.js +11 -0
  223. package/dist/runtime/slots/layout/utils.js.map +1 -0
  224. package/{runtime/slots/types.ts → dist/runtime/slots/types.d.ts} +6 -12
  225. package/dist/runtime/slots/types.js +7 -0
  226. package/dist/runtime/slots/types.js.map +1 -0
  227. package/dist/runtime/slots/utils.d.ts +3 -0
  228. package/dist/runtime/slots/utils.js +66 -0
  229. package/dist/runtime/slots/utils.js.map +1 -0
  230. package/dist/runtime/slots/widget/WidgetContext.d.ts +6 -0
  231. package/dist/runtime/slots/widget/WidgetContext.js +8 -0
  232. package/dist/runtime/slots/widget/WidgetContext.js.map +1 -0
  233. package/dist/runtime/slots/widget/WidgetProvider.d.ts +9 -0
  234. package/dist/runtime/slots/widget/WidgetProvider.js +18 -0
  235. package/dist/runtime/slots/widget/WidgetProvider.js.map +1 -0
  236. package/dist/runtime/slots/widget/hooks.d.ts +13 -0
  237. package/dist/runtime/slots/widget/hooks.js +104 -0
  238. package/dist/runtime/slots/widget/hooks.js.map +1 -0
  239. package/dist/runtime/slots/widget/iframe/IFrameContentWrapper.d.ts +10 -0
  240. package/dist/runtime/slots/widget/iframe/IFrameContentWrapper.js +42 -0
  241. package/dist/runtime/slots/widget/iframe/IFrameContentWrapper.js.map +1 -0
  242. package/dist/runtime/slots/widget/iframe/IFrameContentWrapper.messages.d.ts +13 -0
  243. package/dist/runtime/slots/widget/iframe/IFrameContentWrapper.messages.js +15 -0
  244. package/dist/runtime/slots/widget/iframe/IFrameContentWrapper.messages.js.map +1 -0
  245. package/dist/runtime/slots/widget/iframe/IFrameWidget.d.ts +6 -0
  246. package/dist/runtime/slots/widget/iframe/IFrameWidget.js +32 -0
  247. package/dist/runtime/slots/widget/iframe/IFrameWidget.js.map +1 -0
  248. package/dist/runtime/slots/widget/iframe/constants.d.ts +15 -0
  249. package/{runtime/slots/widget/iframe/constants.ts → dist/runtime/slots/widget/iframe/constants.js} +2 -4
  250. package/dist/runtime/slots/widget/iframe/constants.js.map +1 -0
  251. package/dist/runtime/slots/widget/iframe/hooks.d.ts +64 -0
  252. package/dist/runtime/slots/widget/iframe/hooks.js +144 -0
  253. package/dist/runtime/slots/widget/iframe/hooks.js.map +1 -0
  254. package/{runtime/slots/widget/iframe/index.ts → dist/runtime/slots/widget/iframe/index.d.ts} +1 -4
  255. package/dist/runtime/slots/widget/iframe/index.js +3 -0
  256. package/dist/runtime/slots/widget/iframe/index.js.map +1 -0
  257. package/{runtime/slots/widget/iframe/types.ts → dist/runtime/slots/widget/iframe/types.d.ts} +2 -4
  258. package/dist/runtime/slots/widget/iframe/types.js +3 -0
  259. package/dist/runtime/slots/widget/iframe/types.js.map +1 -0
  260. package/dist/runtime/slots/widget/index.js +6 -0
  261. package/dist/runtime/slots/widget/index.js.map +1 -0
  262. package/{runtime/slots/widget/types.ts → dist/runtime/slots/widget/types.d.ts} +58 -84
  263. package/dist/runtime/slots/widget/types.js +41 -0
  264. package/dist/runtime/slots/widget/types.js.map +1 -0
  265. package/dist/runtime/slots/widget/utils.d.ts +22 -0
  266. package/dist/runtime/slots/widget/utils.js +184 -0
  267. package/dist/runtime/slots/widget/utils.js.map +1 -0
  268. package/{runtime/subscriptions.ts → dist/runtime/subscriptions.d.ts} +5 -41
  269. package/dist/runtime/subscriptions.js +48 -0
  270. package/dist/runtime/subscriptions.js.map +1 -0
  271. package/{runtime/testing/index.ts → dist/runtime/testing/index.d.ts} +0 -1
  272. package/dist/runtime/testing/index.js +9 -0
  273. package/dist/runtime/testing/index.js.map +1 -0
  274. package/dist/runtime/testing/initializeMockApp.d.ts +46 -0
  275. package/{runtime/testing/initializeMockApp.ts → dist/runtime/testing/initializeMockApp.js} +26 -36
  276. package/dist/runtime/testing/initializeMockApp.js.map +1 -0
  277. package/dist/runtime/testing/mockMessages.d.ts +22 -0
  278. package/dist/runtime/testing/mockMessages.js +23 -0
  279. package/dist/runtime/testing/mockMessages.js.map +1 -0
  280. package/dist/runtime/utils.d.ts +95 -0
  281. package/{runtime → dist/runtime}/utils.js +55 -70
  282. package/dist/runtime/utils.js.map +1 -0
  283. package/dist/shell/DefaultLayout.d.ts +1 -0
  284. package/dist/shell/DefaultLayout.js +7 -0
  285. package/dist/shell/DefaultLayout.js.map +1 -0
  286. package/dist/shell/DefaultMain.d.ts +1 -0
  287. package/dist/shell/DefaultMain.js +6 -0
  288. package/dist/shell/DefaultMain.js.map +1 -0
  289. package/dist/shell/Logo.d.ts +6 -0
  290. package/dist/shell/Logo.js +14 -0
  291. package/dist/shell/Logo.js.map +1 -0
  292. package/dist/shell/Shell.d.ts +1 -0
  293. package/dist/shell/Shell.js +10 -0
  294. package/dist/shell/Shell.js.map +1 -0
  295. package/dist/shell/Shell.messages.d.ts +58 -0
  296. package/dist/shell/Shell.messages.js +60 -0
  297. package/dist/shell/Shell.messages.js.map +1 -0
  298. package/dist/shell/app.d.ts +3 -0
  299. package/dist/shell/app.js +35 -0
  300. package/dist/shell/app.js.map +1 -0
  301. package/{shell → dist/shell}/app.scss +2 -1
  302. package/dist/shell/babel.config.d.ts +2 -0
  303. package/{shell → dist/shell}/babel.config.js +2 -1
  304. package/dist/shell/babel.config.js.map +1 -0
  305. package/dist/shell/dev/devFooter/app.d.ts +3 -0
  306. package/dist/shell/dev/devFooter/app.js +36 -0
  307. package/dist/shell/dev/devFooter/app.js.map +1 -0
  308. package/dist/shell/dev/devFooter/index.js +2 -0
  309. package/dist/shell/dev/devFooter/index.js.map +1 -0
  310. package/dist/shell/dev/devHeader/BarContext.d.ts +7 -0
  311. package/dist/shell/dev/devHeader/BarContext.js +8 -0
  312. package/dist/shell/dev/devHeader/BarContext.js.map +1 -0
  313. package/dist/shell/dev/devHeader/BarLink.d.ts +1 -0
  314. package/dist/shell/dev/devHeader/BarLink.js +10 -0
  315. package/dist/shell/dev/devHeader/BarLink.js.map +1 -0
  316. package/dist/shell/dev/devHeader/BarProvider.d.ts +6 -0
  317. package/dist/shell/dev/devHeader/BarProvider.js +16 -0
  318. package/dist/shell/dev/devHeader/BarProvider.js.map +1 -0
  319. package/dist/shell/dev/devHeader/CoursesLink.d.ts +1 -0
  320. package/dist/shell/dev/devHeader/CoursesLink.js +10 -0
  321. package/dist/shell/dev/devHeader/CoursesLink.js.map +1 -0
  322. package/dist/shell/dev/devHeader/FooContext.d.ts +7 -0
  323. package/dist/shell/dev/devHeader/FooContext.js +8 -0
  324. package/dist/shell/dev/devHeader/FooContext.js.map +1 -0
  325. package/dist/shell/dev/devHeader/FooLink.d.ts +1 -0
  326. package/dist/shell/dev/devHeader/FooLink.js +10 -0
  327. package/dist/shell/dev/devHeader/FooLink.js.map +1 -0
  328. package/dist/shell/dev/devHeader/FooProvider.d.ts +6 -0
  329. package/dist/shell/dev/devHeader/FooProvider.js +16 -0
  330. package/dist/shell/dev/devHeader/FooProvider.js.map +1 -0
  331. package/dist/shell/dev/devHeader/app.d.ts +3 -0
  332. package/dist/shell/dev/devHeader/app.js +34 -0
  333. package/dist/shell/dev/devHeader/app.js.map +1 -0
  334. package/dist/shell/dev/devHeader/index.js +2 -0
  335. package/dist/shell/dev/devHeader/index.js.map +1 -0
  336. package/dist/shell/dev/devHeader/providers.d.ts +3 -0
  337. package/dist/shell/dev/devHeader/providers.js +8 -0
  338. package/dist/shell/dev/devHeader/providers.js.map +1 -0
  339. package/dist/shell/dev/devHome/HomePage.d.ts +1 -0
  340. package/dist/shell/dev/devHome/HomePage.js +13 -0
  341. package/dist/shell/dev/devHome/HomePage.js.map +1 -0
  342. package/dist/shell/dev/devHome/app.d.ts +3 -0
  343. package/dist/shell/dev/devHome/app.js +16 -0
  344. package/dist/shell/dev/devHome/app.js.map +1 -0
  345. package/dist/shell/dev/devHome/i18n/index.d.ts +27 -0
  346. package/dist/shell/dev/devHome/i18n/index.js +28 -0
  347. package/dist/shell/dev/devHome/i18n/index.js.map +1 -0
  348. package/dist/shell/dev/devHome/index.js +2 -0
  349. package/dist/shell/dev/devHome/index.js.map +1 -0
  350. package/dist/shell/dev/devHome/messages.d.ts +8 -0
  351. package/dist/shell/dev/devHome/messages.js +10 -0
  352. package/dist/shell/dev/devHome/messages.js.map +1 -0
  353. package/dist/shell/dev/devUser/app.d.ts +3 -0
  354. package/dist/shell/dev/devUser/app.js +22 -0
  355. package/dist/shell/dev/devUser/app.js.map +1 -0
  356. package/dist/shell/dev/devUser/index.js +2 -0
  357. package/dist/shell/dev/devUser/index.js.map +1 -0
  358. package/dist/shell/dev/index.js +6 -0
  359. package/dist/shell/dev/index.js.map +1 -0
  360. package/dist/shell/dev/slotShowcase/HorizontalSlotLayout.d.ts +1 -0
  361. package/dist/shell/dev/slotShowcase/HorizontalSlotLayout.js +8 -0
  362. package/dist/shell/dev/slotShowcase/HorizontalSlotLayout.js.map +1 -0
  363. package/dist/shell/dev/slotShowcase/LayoutWithOptions.d.ts +1 -0
  364. package/dist/shell/dev/slotShowcase/LayoutWithOptions.js +9 -0
  365. package/dist/shell/dev/slotShowcase/LayoutWithOptions.js.map +1 -0
  366. package/dist/shell/dev/slotShowcase/SlotShowcasePage.d.ts +2 -0
  367. package/dist/shell/dev/slotShowcase/SlotShowcasePage.js +17 -0
  368. package/dist/shell/dev/slotShowcase/SlotShowcasePage.js.map +1 -0
  369. package/dist/shell/dev/slotShowcase/ToggleByRoleLayout.d.ts +1 -0
  370. package/dist/shell/dev/slotShowcase/ToggleByRoleLayout.js +11 -0
  371. package/dist/shell/dev/slotShowcase/ToggleByRoleLayout.js.map +1 -0
  372. package/dist/shell/dev/slotShowcase/WidgetWithOptions.d.ts +1 -0
  373. package/dist/shell/dev/slotShowcase/WidgetWithOptions.js +8 -0
  374. package/dist/shell/dev/slotShowcase/WidgetWithOptions.js.map +1 -0
  375. package/dist/shell/dev/slotShowcase/app.d.ts +3 -0
  376. package/dist/shell/dev/slotShowcase/app.js +372 -0
  377. package/dist/shell/dev/slotShowcase/app.js.map +1 -0
  378. package/dist/shell/dev/slotShowcase/index.js +2 -0
  379. package/dist/shell/dev/slotShowcase/index.js.map +1 -0
  380. package/dist/shell/footer/CenterLinks.d.ts +1 -0
  381. package/dist/shell/footer/CenterLinks.js +7 -0
  382. package/dist/shell/footer/CenterLinks.js.map +1 -0
  383. package/dist/shell/footer/CopyrightNotice.d.ts +10 -0
  384. package/dist/shell/footer/CopyrightNotice.js +10 -0
  385. package/dist/shell/footer/CopyrightNotice.js.map +1 -0
  386. package/dist/shell/footer/Footer.d.ts +1 -0
  387. package/dist/shell/footer/Footer.js +12 -0
  388. package/dist/shell/footer/Footer.js.map +1 -0
  389. package/dist/shell/footer/LabeledLinkColumn.d.ts +1 -0
  390. package/dist/shell/footer/LabeledLinkColumn.js +11 -0
  391. package/dist/shell/footer/LabeledLinkColumn.js.map +1 -0
  392. package/dist/shell/footer/LanguageMenu.d.ts +1 -0
  393. package/dist/shell/footer/LanguageMenu.js +16 -0
  394. package/dist/shell/footer/LanguageMenu.js.map +1 -0
  395. package/dist/shell/footer/LanguageMenuItem.d.ts +8 -0
  396. package/dist/shell/footer/LanguageMenuItem.js +11 -0
  397. package/dist/shell/footer/LanguageMenuItem.js.map +1 -0
  398. package/dist/shell/footer/LeftLinks.d.ts +1 -0
  399. package/dist/shell/footer/LeftLinks.js +7 -0
  400. package/dist/shell/footer/LeftLinks.js.map +1 -0
  401. package/dist/shell/footer/LegalNotices.d.ts +1 -0
  402. package/dist/shell/footer/LegalNotices.js +10 -0
  403. package/dist/shell/footer/LegalNotices.js.map +1 -0
  404. package/dist/shell/footer/PoweredBy.d.ts +1 -0
  405. package/dist/shell/footer/PoweredBy.js +9 -0
  406. package/dist/shell/footer/PoweredBy.js.map +1 -0
  407. package/dist/shell/footer/RevealLinks.d.ts +1 -0
  408. package/dist/shell/footer/RevealLinks.js +16 -0
  409. package/dist/shell/footer/RevealLinks.js.map +1 -0
  410. package/dist/shell/footer/RightLinks.d.ts +1 -0
  411. package/dist/shell/footer/RightLinks.js +7 -0
  412. package/dist/shell/footer/RightLinks.js.map +1 -0
  413. package/dist/shell/footer/app.d.ts +3 -0
  414. package/dist/shell/footer/app.js +59 -0
  415. package/dist/shell/footer/app.js.map +1 -0
  416. package/dist/shell/footer/data/api.d.ts +1 -0
  417. package/dist/shell/footer/data/api.js +45 -0
  418. package/dist/shell/footer/data/api.js.map +1 -0
  419. package/dist/shell/footer/index.js +3 -0
  420. package/dist/shell/footer/index.js.map +1 -0
  421. package/dist/shell/header/AuthenticatedMenu.d.ts +5 -0
  422. package/dist/shell/header/AuthenticatedMenu.js +11 -0
  423. package/dist/shell/header/AuthenticatedMenu.js.map +1 -0
  424. package/dist/shell/header/Header.d.ts +1 -0
  425. package/dist/shell/header/Header.js +8 -0
  426. package/dist/shell/header/Header.js.map +1 -0
  427. package/dist/shell/header/anonymous-menu/AnonymousMenu.d.ts +5 -0
  428. package/dist/shell/header/anonymous-menu/AnonymousMenu.js +7 -0
  429. package/dist/shell/header/anonymous-menu/AnonymousMenu.js.map +1 -0
  430. package/dist/shell/header/anonymous-menu/LoginButton.d.ts +3 -0
  431. package/dist/shell/header/anonymous-menu/LoginButton.js +22 -0
  432. package/dist/shell/header/anonymous-menu/LoginButton.js.map +1 -0
  433. package/dist/shell/header/anonymous-menu/RegisterButton.d.ts +3 -0
  434. package/dist/shell/header/anonymous-menu/RegisterButton.js +22 -0
  435. package/dist/shell/header/anonymous-menu/RegisterButton.js.map +1 -0
  436. package/dist/shell/header/app.d.ts +3 -0
  437. package/dist/shell/header/app.js +119 -0
  438. package/dist/shell/header/app.js.map +1 -0
  439. package/dist/shell/header/desktop/DesktopLayout.d.ts +1 -0
  440. package/dist/shell/header/desktop/DesktopLayout.js +9 -0
  441. package/dist/shell/header/desktop/DesktopLayout.js.map +1 -0
  442. package/dist/shell/header/desktop/PrimaryNavLinks.d.ts +1 -0
  443. package/dist/shell/header/desktop/PrimaryNavLinks.js +7 -0
  444. package/dist/shell/header/desktop/PrimaryNavLinks.js.map +1 -0
  445. package/dist/shell/header/desktop/SecondaryNavLinks.d.ts +1 -0
  446. package/dist/shell/header/desktop/SecondaryNavLinks.js +7 -0
  447. package/dist/shell/header/desktop/SecondaryNavLinks.js.map +1 -0
  448. package/dist/shell/header/index.js +3 -0
  449. package/dist/shell/header/index.js.map +1 -0
  450. package/dist/shell/header/mobile/MobileLayout.d.ts +1 -0
  451. package/dist/shell/header/mobile/MobileLayout.js +17 -0
  452. package/dist/shell/header/mobile/MobileLayout.js.map +1 -0
  453. package/dist/shell/header/mobile/MobileNavLinks.d.ts +1 -0
  454. package/dist/shell/header/mobile/MobileNavLinks.js +7 -0
  455. package/dist/shell/header/mobile/MobileNavLinks.js.map +1 -0
  456. package/dist/shell/i18n/index.d.ts +25 -0
  457. package/dist/shell/i18n/index.js +26 -0
  458. package/dist/shell/i18n/index.js.map +1 -0
  459. package/dist/shell/index.js +8 -0
  460. package/dist/shell/index.js.map +1 -0
  461. package/dist/shell/jest.config.d.ts +15 -0
  462. package/{tools/dist/jest → dist/shell}/jest.config.js +12 -10
  463. package/dist/shell/jest.config.js.map +1 -0
  464. package/dist/shell/menus/LinkMenuItem.d.ts +9 -0
  465. package/dist/shell/menus/LinkMenuItem.js +36 -0
  466. package/dist/shell/menus/LinkMenuItem.js.map +1 -0
  467. package/dist/shell/menus/NavDropdownMenuSlot.d.ts +7 -0
  468. package/dist/shell/menus/NavDropdownMenuSlot.js +14 -0
  469. package/dist/shell/menus/NavDropdownMenuSlot.js.map +1 -0
  470. package/dist/shell/menus/ProfileLinkMenuItem.d.ts +8 -0
  471. package/dist/shell/menus/ProfileLinkMenuItem.js +16 -0
  472. package/dist/shell/menus/ProfileLinkMenuItem.js.map +1 -0
  473. package/dist/shell/menus/data/utils.d.ts +4 -0
  474. package/dist/shell/menus/data/utils.js +13 -0
  475. package/dist/shell/menus/data/utils.js.map +1 -0
  476. package/dist/shell/router/createRouter.d.ts +1 -0
  477. package/dist/shell/router/createRouter.js +26 -0
  478. package/dist/shell/router/createRouter.js.map +1 -0
  479. package/dist/shell/router/getAppRoutes.d.ts +2 -0
  480. package/dist/shell/router/getAppRoutes.js +14 -0
  481. package/dist/shell/router/getAppRoutes.js.map +1 -0
  482. package/dist/shell/setupTest.d.ts +1 -0
  483. package/dist/shell/setupTest.js +12 -0
  484. package/dist/shell/setupTest.js.map +1 -0
  485. package/dist/shell/site.config.dev.d.ts +4 -0
  486. package/dist/shell/site.config.dev.js +43 -0
  487. package/dist/shell/site.config.dev.js.map +1 -0
  488. package/dist/shell/site.d.ts +1 -0
  489. package/dist/shell/site.js +35 -0
  490. package/dist/shell/site.js.map +1 -0
  491. package/dist/tools/babel/babel.config.d.ts +12 -0
  492. package/dist/tools/babel.config.d.ts +2 -0
  493. package/dist/tools/babel.config.js +3 -0
  494. package/dist/tools/cli/commands/serve.d.ts +1 -0
  495. package/dist/tools/cli/intl-imports.d.ts +7 -0
  496. package/{tools/dist → dist/tools}/cli/intl-imports.js +0 -0
  497. package/dist/tools/cli/intl-imports.test.d.ts +1 -0
  498. package/dist/tools/cli/openedx.d.ts +2 -0
  499. package/{tools/dist → dist/tools}/cli/openedx.js +27 -8
  500. package/dist/tools/cli/transifex-utils.d.ts +2 -0
  501. package/{tools/dist → dist/tools}/cli/transifex-utils.js +0 -0
  502. package/dist/tools/cli/utils/ensureConfigFilenameOption.d.ts +2 -0
  503. package/dist/tools/cli/utils/formatter.d.ts +1 -0
  504. package/dist/tools/cli/utils/formatter.js +3 -0
  505. package/dist/tools/cli/utils/getResolvedConfigPath.d.ts +2 -0
  506. package/dist/tools/cli/utils/prettyPrintTitle.d.ts +1 -0
  507. package/dist/tools/cli/utils/printUsage.d.ts +1 -0
  508. package/dist/tools/config-helpers/createConfig.d.ts +2 -0
  509. package/dist/tools/config-helpers/createLintConfig.d.ts +2 -0
  510. package/dist/tools/config-helpers/getBaseConfig.d.ts +2 -0
  511. package/dist/tools/defaultConfigPaths.d.ts +8 -0
  512. package/dist/tools/eslint/base.eslint.config.d.ts +3 -0
  513. package/{config → dist/tools}/eslint/base.eslint.config.js +5 -4
  514. package/dist/tools/eslint.config.d.ts +3 -0
  515. package/dist/tools/index.d.ts +3 -0
  516. package/dist/tools/jest/jest.config.d.ts +14 -0
  517. package/dist/tools/jest.config.d.ts +8 -0
  518. package/dist/tools/types.d.ts +18 -0
  519. package/{tools/dist → dist/tools}/typescript/tsconfig.json +2 -1
  520. package/dist/tools/webpack/common-config/all/getCodeRules.d.ts +2 -0
  521. package/dist/tools/webpack/common-config/all/getFileLoaderRules.d.ts +11 -0
  522. package/dist/tools/webpack/common-config/all/getImageMinimizer.d.ts +5 -0
  523. package/dist/tools/webpack/common-config/all/getStylesheetRule.d.ts +8 -0
  524. package/{config → dist/tools}/webpack/common-config/all/getStylesheetRule.js +1 -1
  525. package/dist/tools/webpack/common-config/dev/getDevServer.d.ts +2 -0
  526. package/{tools/dist → dist/tools}/webpack/common-config/dev/getDevServer.js +3 -5
  527. package/dist/tools/webpack/common-config/index.d.ts +6 -0
  528. package/dist/tools/webpack/common-config/site/getHtmlWebpackPlugin.d.ts +2 -0
  529. package/dist/tools/webpack/plugins/html-webpack-new-relic-plugin/HtmlWebpackNewRelicPlugin.d.ts +16 -0
  530. package/dist/tools/webpack/plugins/html-webpack-new-relic-plugin/index.d.ts +2 -0
  531. package/dist/tools/webpack/plugins/html-webpack-new-relic-plugin/test/HtmlWebpackNewRelicPlugin.test.d.ts +1 -0
  532. package/dist/tools/webpack/plugins/html-webpack-new-relic-plugin/test/fixtures/entry.d.ts +1 -0
  533. package/dist/tools/webpack/utils/getPublicPath.d.ts +1 -0
  534. package/{tools/dist → dist/tools}/webpack/utils/getPublicPath.js +1 -1
  535. package/dist/tools/webpack/utils/getResolvedSiteConfigPath.d.ts +1 -0
  536. package/dist/tools/webpack/webpack.config.build.d.ts +3 -0
  537. package/{config → dist/tools}/webpack/webpack.config.build.js +8 -15
  538. package/dist/tools/webpack/webpack.config.dev.d.ts +3 -0
  539. package/{tools/dist → dist/tools}/webpack/webpack.config.dev.js +12 -15
  540. package/dist/tools/webpack/webpack.config.dev.shell.d.ts +3 -0
  541. package/{config → dist/tools}/webpack/webpack.config.dev.shell.js +4 -14
  542. package/dist/types.d.ts +84 -0
  543. package/dist/types.js +7 -0
  544. package/dist/types.js.map +1 -0
  545. package/package.json +28 -17
  546. package/config/tsconfig.json +0 -32
  547. package/config/webpack/common-config/all/getIgnoreWarnings.js +0 -14
  548. package/config/webpack/common-config/dev/getDevServer.js +0 -38
  549. package/config/webpack/plugins/paragon-webpack-plugin/ParagonWebpackPlugin.js +0 -108
  550. package/config/webpack/plugins/paragon-webpack-plugin/index.js +0 -7
  551. package/config/webpack/plugins/paragon-webpack-plugin/utils/assetUtils.js +0 -64
  552. package/config/webpack/plugins/paragon-webpack-plugin/utils/htmlUtils.js +0 -53
  553. package/config/webpack/plugins/paragon-webpack-plugin/utils/index.js +0 -9
  554. package/config/webpack/plugins/paragon-webpack-plugin/utils/paragonStylesheetUtils.js +0 -114
  555. package/config/webpack/plugins/paragon-webpack-plugin/utils/scriptUtils.js +0 -146
  556. package/config/webpack/plugins/paragon-webpack-plugin/utils/stylesheetUtils.js +0 -126
  557. package/config/webpack/plugins/paragon-webpack-plugin/utils/tagUtils.js +0 -57
  558. package/config/webpack/types.js +0 -2
  559. package/config/webpack/utils/getLocalAliases.js +0 -65
  560. package/config/webpack/utils/getPublicPath.js +0 -6
  561. package/config/webpack/utils/paragonUtils.js +0 -138
  562. package/config/webpack/webpack.config.dev.js +0 -76
  563. package/runtime/__mocks__/file.js +0 -1
  564. package/runtime/__mocks__/svg.js +0 -1
  565. package/runtime/__mocks__/universal-cookie.js +0 -6
  566. package/runtime/analytics/MockAnalyticsService.js +0 -71
  567. package/runtime/analytics/SegmentAnalyticsService.js +0 -243
  568. package/runtime/analytics/index.ts +0 -12
  569. package/runtime/analytics/interface.test.js +0 -242
  570. package/runtime/auth/AxiosCsrfTokenService.js +0 -60
  571. package/runtime/auth/AxiosJwtAuthService.js +0 -363
  572. package/runtime/auth/AxiosJwtAuthService.test.jsx +0 -1076
  573. package/runtime/auth/AxiosJwtTokenService.js +0 -134
  574. package/runtime/auth/LocalForageCache.js +0 -76
  575. package/runtime/auth/MockAuthService.js +0 -278
  576. package/runtime/auth/index.ts +0 -19
  577. package/runtime/auth/interceptors/createCsrfTokenProviderInterceptor.js +0 -36
  578. package/runtime/auth/interceptors/createJwtTokenProviderInterceptor.js +0 -37
  579. package/runtime/auth/interceptors/createProcessAxiosRequestErrorInterceptor.js +0 -20
  580. package/runtime/auth/interceptors/createRetryInterceptor.js +0 -74
  581. package/runtime/auth/interceptors/createRetryInterceptor.test.js +0 -23
  582. package/runtime/auth/utils.js +0 -105
  583. package/runtime/config/getExternalLinkUrl.test.js +0 -76
  584. package/runtime/i18n/injectIntlWithShim.jsx +0 -48
  585. package/runtime/i18n/lib.test.js +0 -230
  586. package/runtime/i18n/lib.ts +0 -272
  587. package/runtime/index.ts +0 -134
  588. package/runtime/initialize.async.function.config.test.js +0 -43
  589. package/runtime/initialize.const.config.test.js +0 -41
  590. package/runtime/initialize.function.config.test.js +0 -41
  591. package/runtime/initialize.js +0 -352
  592. package/runtime/initialize.test.js +0 -356
  593. package/runtime/jest.config.js +0 -32
  594. package/runtime/logging/MockLoggingService.js +0 -31
  595. package/runtime/logging/NewRelicLoggingService.js +0 -184
  596. package/runtime/logging/NewRelicLoggingService.test.js +0 -214
  597. package/runtime/logging/types.ts +0 -4
  598. package/runtime/react/AuthenticatedPageRoute.test.jsx +0 -135
  599. package/runtime/react/CombinedAppProvider.tsx +0 -46
  600. package/runtime/react/CurrentAppProvider.tsx +0 -46
  601. package/runtime/react/Divider.tsx +0 -5
  602. package/runtime/react/ErrorBoundary.jsx +0 -47
  603. package/runtime/react/ErrorBoundary.test.jsx +0 -83
  604. package/runtime/react/ErrorPage.jsx +0 -72
  605. package/runtime/react/SiteProvider.test.jsx +0 -66
  606. package/runtime/react/SiteProvider.tsx +0 -78
  607. package/runtime/react/hooks.test.jsx +0 -104
  608. package/runtime/react/hooks.ts +0 -106
  609. package/runtime/routing/index.ts +0 -1
  610. package/runtime/routing/utils.test.ts +0 -7
  611. package/runtime/routing/utils.ts +0 -34
  612. package/runtime/scripts/GoogleAnalyticsLoader.test.ts +0 -77
  613. package/runtime/scripts/GoogleAnalyticsLoader.ts +0 -59
  614. package/runtime/setupTest.js +0 -49
  615. package/runtime/site.config.test.tsx +0 -33
  616. package/runtime/slots/Slot.test.tsx +0 -40
  617. package/runtime/slots/Slot.tsx +0 -32
  618. package/runtime/slots/SlotContext.tsx +0 -8
  619. package/runtime/slots/hooks.ts +0 -35
  620. package/runtime/slots/layout/DefaultSlotLayout.test.tsx +0 -31
  621. package/runtime/slots/layout/DefaultSlotLayout.tsx +0 -9
  622. package/runtime/slots/layout/hooks.test.tsx +0 -178
  623. package/runtime/slots/layout/hooks.ts +0 -65
  624. package/runtime/slots/layout/utils.test.ts +0 -67
  625. package/runtime/slots/layout/utils.ts +0 -14
  626. package/runtime/slots/utils.test.ts +0 -64
  627. package/runtime/slots/utils.ts +0 -78
  628. package/runtime/slots/widget/WidgetContext.tsx +0 -9
  629. package/runtime/slots/widget/WidgetProvider.tsx +0 -30
  630. package/runtime/slots/widget/hooks.ts +0 -105
  631. package/runtime/slots/widget/iframe/IFrameContentWrapper.messages.tsx +0 -16
  632. package/runtime/slots/widget/iframe/IFrameContentWrapper.tsx +0 -84
  633. package/runtime/slots/widget/iframe/IFrameWidget.tsx +0 -59
  634. package/runtime/slots/widget/iframe/hooks.ts +0 -179
  635. package/runtime/slots/widget/utils.tsx +0 -201
  636. package/runtime/testing/initializeMockApp.test.ts +0 -66
  637. package/runtime/testing/mockMessages.ts +0 -23
  638. package/runtime/utils.test.js +0 -116
  639. package/shell/DefaultLayout.tsx +0 -18
  640. package/shell/DefaultMain.tsx +0 -7
  641. package/shell/Logo.test.tsx +0 -32
  642. package/shell/Logo.tsx +0 -28
  643. package/shell/Shell.messages.ts +0 -61
  644. package/shell/Shell.tsx +0 -18
  645. package/shell/__mocks__/file.js +0 -1
  646. package/shell/__mocks__/svg.js +0 -1
  647. package/shell/__mocks__/universal-cookie.js +0 -6
  648. package/shell/app.ts +0 -38
  649. package/shell/dev/devFooter/app.tsx +0 -43
  650. package/shell/dev/devHeader/BarContext.tsx +0 -13
  651. package/shell/dev/devHeader/BarLink.tsx +0 -16
  652. package/shell/dev/devHeader/BarProvider.tsx +0 -25
  653. package/shell/dev/devHeader/CoursesLink.tsx +0 -16
  654. package/shell/dev/devHeader/FooContext.tsx +0 -13
  655. package/shell/dev/devHeader/FooLink.tsx +0 -16
  656. package/shell/dev/devHeader/FooProvider.tsx +0 -25
  657. package/shell/dev/devHeader/app.tsx +0 -53
  658. package/shell/dev/devHeader/providers.tsx +0 -11
  659. package/shell/dev/devHome/HomePage.tsx +0 -28
  660. package/shell/dev/devHome/app.ts +0 -18
  661. package/shell/dev/devHome/i18n/index.ts +0 -27
  662. package/shell/dev/devHome/messages.ts +0 -11
  663. package/shell/dev/devUser/app.tsx +0 -24
  664. package/shell/dev/slotShowcase/HorizontalSlotLayout.tsx +0 -11
  665. package/shell/dev/slotShowcase/LayoutWithOptions.tsx +0 -17
  666. package/shell/dev/slotShowcase/SlotShowcasePage.tsx +0 -66
  667. package/shell/dev/slotShowcase/WidgetWithOptions.tsx +0 -11
  668. package/shell/dev/slotShowcase/app.tsx +0 -373
  669. package/shell/footer/CenterLinks.tsx +0 -11
  670. package/shell/footer/CopyrightNotice.tsx +0 -36
  671. package/shell/footer/Footer.tsx +0 -34
  672. package/shell/footer/LabeledLinkColumn.tsx +0 -19
  673. package/shell/footer/LanguageMenu.tsx +0 -35
  674. package/shell/footer/LanguageMenuItem.tsx +0 -23
  675. package/shell/footer/LeftLinks.tsx +0 -11
  676. package/shell/footer/LegalNotices.tsx +0 -17
  677. package/shell/footer/PoweredBy.tsx +0 -17
  678. package/shell/footer/RevealLinks.tsx +0 -43
  679. package/shell/footer/RightLinks.tsx +0 -11
  680. package/shell/footer/app.tsx +0 -73
  681. package/shell/footer/data/api.ts +0 -48
  682. package/shell/header/AuthenticatedMenu.tsx +0 -32
  683. package/shell/header/Header.tsx +0 -17
  684. package/shell/header/anonymous-menu/AnonymousMenu.tsx +0 -14
  685. package/shell/header/anonymous-menu/LoginButton.tsx +0 -14
  686. package/shell/header/anonymous-menu/RegisterButton.tsx +0 -15
  687. package/shell/header/app.tsx +0 -142
  688. package/shell/header/desktop/DesktopLayout.tsx +0 -22
  689. package/shell/header/desktop/PrimaryNavLinks.tsx +0 -10
  690. package/shell/header/desktop/SecondaryNavLinks.tsx +0 -10
  691. package/shell/header/mobile/MobileLayout.tsx +0 -47
  692. package/shell/header/mobile/MobileNavLinks.tsx +0 -10
  693. package/shell/i18n/index.ts +0 -25
  694. package/shell/jest.config.js +0 -30
  695. package/shell/menus/LinkMenuItem.tsx +0 -64
  696. package/shell/menus/NavDropdownMenuSlot.tsx +0 -29
  697. package/shell/menus/ProfileLinkMenuItem.tsx +0 -33
  698. package/shell/menus/data/utils.ts +0 -19
  699. package/shell/public/index.html +0 -10
  700. package/shell/router/createRouter.test.tsx +0 -50
  701. package/shell/router/createRouter.ts +0 -17
  702. package/shell/router/getAppRoutes.test.tsx +0 -59
  703. package/shell/router/getAppRoutes.ts +0 -21
  704. package/shell/setupTest.js +0 -48
  705. package/shell/site.config.dev.tsx +0 -49
  706. package/shell/site.config.test.tsx +0 -16
  707. package/shell/site.tsx +0 -41
  708. package/tools/dist/babel/babel.config.js +0 -28
  709. package/tools/dist/cli/utils/formatter.js +0 -10
  710. package/tools/dist/config-helpers/createConfig.js +0 -13
  711. package/tools/dist/config-helpers/createLintConfig.js +0 -16
  712. package/tools/dist/config-helpers/getBaseConfig.js +0 -12
  713. package/tools/dist/defaultConfigPaths.js +0 -35
  714. package/tools/dist/eslint/base.eslint.config.js +0 -113
  715. package/tools/dist/index.js +0 -12
  716. package/tools/dist/types.js +0 -23
  717. package/tools/dist/webpack/common-config/all/getCodeRules.js +0 -52
  718. package/tools/dist/webpack/common-config/all/getFileLoaderRules.js +0 -26
  719. package/tools/dist/webpack/common-config/all/getIgnoreWarnings.js +0 -14
  720. package/tools/dist/webpack/common-config/all/getImageMinimizer.js +0 -25
  721. package/tools/dist/webpack/common-config/all/getStylesheetRule.js +0 -112
  722. package/tools/dist/webpack/common-config/index.js +0 -18
  723. package/tools/dist/webpack/common-config/site/getHtmlWebpackPlugin.js +0 -16
  724. package/tools/dist/webpack/plugins/html-webpack-new-relic-plugin/HtmlWebpackNewRelicPlugin.js +0 -91
  725. package/tools/dist/webpack/plugins/html-webpack-new-relic-plugin/index.js +0 -7
  726. package/tools/dist/webpack/plugins/html-webpack-new-relic-plugin/test/HtmlWebpackNewRelicPlugin.test.js +0 -66
  727. package/tools/dist/webpack/plugins/html-webpack-new-relic-plugin/test/fixtures/entry.js +0 -3
  728. package/tools/dist/webpack/plugins/paragon-webpack-plugin/ParagonWebpackPlugin.js +0 -108
  729. package/tools/dist/webpack/plugins/paragon-webpack-plugin/index.js +0 -7
  730. package/tools/dist/webpack/plugins/paragon-webpack-plugin/utils/assetUtils.js +0 -64
  731. package/tools/dist/webpack/plugins/paragon-webpack-plugin/utils/htmlUtils.js +0 -53
  732. package/tools/dist/webpack/plugins/paragon-webpack-plugin/utils/index.js +0 -9
  733. package/tools/dist/webpack/plugins/paragon-webpack-plugin/utils/paragonStylesheetUtils.js +0 -114
  734. package/tools/dist/webpack/plugins/paragon-webpack-plugin/utils/scriptUtils.js +0 -146
  735. package/tools/dist/webpack/plugins/paragon-webpack-plugin/utils/stylesheetUtils.js +0 -126
  736. package/tools/dist/webpack/plugins/paragon-webpack-plugin/utils/tagUtils.js +0 -57
  737. package/tools/dist/webpack/types.js +0 -2
  738. package/tools/dist/webpack/utils/getLocalAliases.js +0 -65
  739. package/tools/dist/webpack/utils/getResolvedSiteConfigPath.js +0 -32
  740. package/tools/dist/webpack/utils/paragonUtils.js +0 -138
  741. package/tools/dist/webpack/webpack.config.build.js +0 -80
  742. package/tools/dist/webpack/webpack.config.dev.shell.js +0 -110
  743. package/types.ts +0 -99
  744. /package/{runtime/scripts/index.ts → dist/runtime/scripts/index.d.ts} +0 -0
  745. /package/{runtime/slots/index.ts → dist/runtime/slots/index.d.ts} +0 -0
  746. /package/{runtime/slots/layout/index.ts → dist/runtime/slots/layout/index.d.ts} +0 -0
  747. /package/{runtime/slots/widget/index.ts → dist/runtime/slots/widget/index.d.ts} +0 -0
  748. /package/{shell/dev/devFooter/index.ts → dist/shell/dev/devFooter/index.d.ts} +0 -0
  749. /package/{shell/dev/devHeader/index.ts → dist/shell/dev/devHeader/index.d.ts} +0 -0
  750. /package/{shell/dev/devHome/index.ts → dist/shell/dev/devHome/index.d.ts} +0 -0
  751. /package/{shell/dev/devUser/index.ts → dist/shell/dev/devUser/index.d.ts} +0 -0
  752. /package/{shell/dev/index.ts → dist/shell/dev/index.d.ts} +0 -0
  753. /package/{shell/dev/slotShowcase/index.ts → dist/shell/dev/slotShowcase/index.d.ts} +0 -0
  754. /package/{shell/footer/index.ts → dist/shell/footer/index.d.ts} +0 -0
  755. /package/{shell/header/index.ts → dist/shell/header/index.d.ts} +0 -0
  756. /package/{shell/index.ts → dist/shell/index.d.ts} +0 -0
  757. /package/{config → dist/tools}/babel/babel.config.js +0 -0
  758. /package/{tools/dist → dist/tools}/cli/commands/serve.js +0 -0
  759. /package/{tools/dist → dist/tools}/cli/intl-imports.test.js +0 -0
  760. /package/{tools/dist → dist/tools}/cli/utils/ensureConfigFilenameOption.js +0 -0
  761. /package/{tools/dist → dist/tools}/cli/utils/getResolvedConfigPath.js +0 -0
  762. /package/{tools/dist → dist/tools}/cli/utils/prettyPrintTitle.js +0 -0
  763. /package/{tools/dist → dist/tools}/cli/utils/printUsage.js +0 -0
  764. /package/{config → dist/tools}/config-helpers/createConfig.js +0 -0
  765. /package/{config → dist/tools}/config-helpers/createLintConfig.js +0 -0
  766. /package/{config → dist/tools}/config-helpers/getBaseConfig.js +0 -0
  767. /package/{config → dist/tools}/defaultConfigPaths.js +0 -0
  768. /package/{tools/dist → dist/tools}/eslint.config.js +0 -0
  769. /package/{config → dist/tools}/index.js +0 -0
  770. /package/{config → dist/tools}/jest/jest.config.js +0 -0
  771. /package/{tools/dist → dist/tools}/jest.config.js +0 -0
  772. /package/{config → dist/tools}/types.js +0 -0
  773. /package/{config → dist/tools}/webpack/common-config/all/getCodeRules.js +0 -0
  774. /package/{config → dist/tools}/webpack/common-config/all/getFileLoaderRules.js +0 -0
  775. /package/{config → dist/tools}/webpack/common-config/all/getImageMinimizer.js +0 -0
  776. /package/{config → dist/tools}/webpack/common-config/index.js +0 -0
  777. /package/{config → dist/tools}/webpack/common-config/site/getHtmlWebpackPlugin.js +0 -0
  778. /package/{config → dist/tools}/webpack/plugins/html-webpack-new-relic-plugin/HtmlWebpackNewRelicPlugin.js +0 -0
  779. /package/{config → dist/tools}/webpack/plugins/html-webpack-new-relic-plugin/index.js +0 -0
  780. /package/{config → dist/tools}/webpack/plugins/html-webpack-new-relic-plugin/test/HtmlWebpackNewRelicPlugin.test.js +0 -0
  781. /package/{config → dist/tools}/webpack/plugins/html-webpack-new-relic-plugin/test/fixtures/entry.js +0 -0
  782. /package/{config → dist/tools}/webpack/utils/getResolvedSiteConfigPath.js +0 -0
@@ -0,0 +1,153 @@
1
+ import { useCallback, useEffect, useReducer, useState, } from 'react';
2
+ import { SELECTED_THEME_VARIANT_KEY } from '../../constants';
3
+ import { logError } from '../../../logging';
4
+ import { themeActions, themeReducer } from '../../reducers';
5
+ import { isEmptyObject } from './utils';
6
+ import useThemeCore from './useThemeCore';
7
+ import useThemeConfig from './useThemeConfig';
8
+ import useThemeVariants from './useThemeVariants';
9
+ /**
10
+ * Finds the default theme variant from the given theme variants object. If no default theme exists, the light theme
11
+ * variant is returned as a fallback.
12
+ *
13
+ * It prioritizes:
14
+ * 1. A persisted theme variant from localStorage.
15
+ * 2. A system preference (`prefers-color-scheme`).
16
+ * 3. The configured default theme variant.
17
+ *
18
+ * Returns the default theme variant, or `undefined` if no valid theme variant is found.
19
+ */
20
+ export const getDefaultThemeVariant = (themeVariants, themeDefaults = {}) => {
21
+ var _a, _b, _c, _d;
22
+ if (!themeVariants) {
23
+ return undefined;
24
+ }
25
+ const themeVariantKeys = Object.keys(themeVariants);
26
+ // If there is only one theme variant, return it since it's the only one that may be used.
27
+ if (themeVariantKeys.length === 1) {
28
+ const themeVariantKey = themeVariantKeys[0];
29
+ return {
30
+ name: themeVariantKey,
31
+ metadata: themeVariants[themeVariantKey],
32
+ };
33
+ }
34
+ // Prioritize persisted localStorage theme variant preference.
35
+ const persistedSelectedThemeVariant = localStorage.getItem(SELECTED_THEME_VARIANT_KEY);
36
+ if (persistedSelectedThemeVariant && themeVariants[persistedSelectedThemeVariant]) {
37
+ return {
38
+ name: persistedSelectedThemeVariant,
39
+ metadata: themeVariants[persistedSelectedThemeVariant],
40
+ };
41
+ }
42
+ // Then, detect system preference via `prefers-color-scheme` media query and use
43
+ // the default dark theme variant, if one exists.
44
+ const hasDarkSystemPreference = !!((_b = (_a = window.matchMedia) === null || _a === void 0 ? void 0 : _a.call(window, '(prefers-color-scheme: dark)')) === null || _b === void 0 ? void 0 : _b.matches);
45
+ const defaultDarkThemeVariant = (_c = themeDefaults.dark) !== null && _c !== void 0 ? _c : 'dark';
46
+ const darkThemeVariantMetadata = themeVariants[defaultDarkThemeVariant];
47
+ if (hasDarkSystemPreference && defaultDarkThemeVariant && darkThemeVariantMetadata) {
48
+ return {
49
+ name: defaultDarkThemeVariant,
50
+ metadata: darkThemeVariantMetadata,
51
+ };
52
+ }
53
+ const defaultLightThemeVariant = (_d = themeDefaults.light) !== null && _d !== void 0 ? _d : 'light';
54
+ const lightThemeVariantMetadata = themeVariants[defaultLightThemeVariant];
55
+ // Handle edge case where the default light theme variant is not configured or provided.
56
+ if (!lightThemeVariantMetadata) {
57
+ return undefined;
58
+ }
59
+ // Otherwise, fallback to using the default light theme variant as configured.
60
+ return {
61
+ name: defaultLightThemeVariant,
62
+ metadata: lightThemeVariantMetadata,
63
+ };
64
+ };
65
+ /**
66
+ * A custom React hook that manages the application's theme state and injects the appropriate CSS for the theme core
67
+ * and theme variants (e.g., light and dark modes) into the HTML document. It handles dynamically loading the theme
68
+ * CSS based on the current theme variant, and ensures that the theme variant's CSS is preloaded for runtime theme
69
+ * switching. This is done using "alternate" stylesheets. That is, the browser will download the CSS for the
70
+ * non-current theme variants with a lower priority than the current one.
71
+ *
72
+ * The hook also responds to system theme preference changes (e.g., via the `prefers-color-scheme` media query),
73
+ * and can automatically switch the theme based on the system's dark mode or light mode preference.
74
+ *
75
+ * * @example
76
+ * const [themeState, dispatch] = useTheme();
77
+ * console.log(themeState.isThemeLoaded); // true when the theme has been successfully loaded.
78
+ *
79
+ * // Dispatch an action to change the theme variant
80
+ * dispatch(themeActions.setThemeVariant('dark'));
81
+ */
82
+ const useTheme = () => {
83
+ var _a;
84
+ const themeConfig = useThemeConfig();
85
+ const { core: themeCore, defaults: themeVariantDefaults, variants: themeVariants, } = themeConfig;
86
+ const initialThemeState = {
87
+ isThemeLoaded: false,
88
+ themeVariant: (_a = getDefaultThemeVariant(themeVariants, themeVariantDefaults)) === null || _a === void 0 ? void 0 : _a.name,
89
+ };
90
+ const [themeState, dispatch] = useReducer(themeReducer, initialThemeState);
91
+ const [isThemeCoreLoaded, setIsThemeCoreLoaded] = useState(false);
92
+ const onLoadThemeCore = useCallback(() => {
93
+ setIsThemeCoreLoaded(true);
94
+ }, []);
95
+ const [hasLoadedThemeVariants, setHasLoadedThemeVariants] = useState(false);
96
+ const onLoadThemeVariants = useCallback(() => {
97
+ setHasLoadedThemeVariants(true);
98
+ }, []);
99
+ // load the theme's core CSS
100
+ useThemeCore({
101
+ themeCore,
102
+ onComplete: onLoadThemeCore,
103
+ });
104
+ // respond to system preference changes with regard to `prefers-color-scheme: dark`.
105
+ const handleDarkModeSystemPreferenceChange = useCallback((prefersDarkMode) => {
106
+ // Ignore system preference change if the theme variant is already set in localStorage.
107
+ if (localStorage.getItem(SELECTED_THEME_VARIANT_KEY)) {
108
+ return;
109
+ }
110
+ if (prefersDarkMode && (themeVariantDefaults === null || themeVariantDefaults === void 0 ? void 0 : themeVariantDefaults.dark)) {
111
+ dispatch(themeActions.setThemeVariant(themeVariantDefaults.dark));
112
+ }
113
+ else if (!prefersDarkMode && (themeVariantDefaults === null || themeVariantDefaults === void 0 ? void 0 : themeVariantDefaults.light)) {
114
+ dispatch(themeActions.setThemeVariant(themeVariantDefaults.light));
115
+ }
116
+ else {
117
+ logError(`Could not set theme variant based on system preference (prefers dark mode: ${prefersDarkMode})`);
118
+ }
119
+ }, [themeVariantDefaults]);
120
+ // load the theme variant(s) CSS
121
+ useThemeVariants({
122
+ themeVariants,
123
+ onComplete: onLoadThemeVariants,
124
+ currentThemeVariant: themeState.themeVariant,
125
+ onDarkModeSystemPreferenceChange: handleDarkModeSystemPreferenceChange,
126
+ });
127
+ useEffect(() => {
128
+ // theme is already loaded, do nothing
129
+ if (themeState.isThemeLoaded) {
130
+ return;
131
+ }
132
+ const hasThemeConfig = ((themeCore === null || themeCore === void 0 ? void 0 : themeCore.url) && !isEmptyObject(themeVariants));
133
+ if (!hasThemeConfig) {
134
+ // no theme URLs to load, set loading to false.
135
+ dispatch(themeActions.setThemeLoaded(true));
136
+ }
137
+ // Return early if neither the core theme CSS nor any theme variant CSS is loaded.
138
+ if (!isThemeCoreLoaded || !hasLoadedThemeVariants) {
139
+ return;
140
+ }
141
+ // All application theme URLs are loaded
142
+ dispatch(themeActions.setThemeLoaded(true));
143
+ }, [
144
+ themeState.isThemeLoaded,
145
+ isThemeCoreLoaded,
146
+ hasLoadedThemeVariants,
147
+ themeCore === null || themeCore === void 0 ? void 0 : themeCore.url,
148
+ themeVariants,
149
+ ]);
150
+ return [themeState, dispatch];
151
+ };
152
+ export default useTheme;
153
+ //# sourceMappingURL=useTheme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTheme.js","sourceRoot":"","sources":["../../../../../runtime/react/hooks/theme/useTheme.ts"],"names":[],"mappings":"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","sourcesContent":["import {\n useCallback, useEffect, useReducer, useState,\n} from 'react';\n\nimport { SELECTED_THEME_VARIANT_KEY } from '../../constants';\nimport { logError } from '../../../logging';\nimport { themeActions, themeReducer } from '../../reducers';\nimport { ThemeVariants, ThemeDefaults } from '../../../../types';\nimport { isEmptyObject } from './utils';\n\nimport useThemeCore from './useThemeCore';\nimport useThemeConfig from './useThemeConfig';\nimport useThemeVariants from './useThemeVariants';\n\n/**\n* Finds the default theme variant from the given theme variants object. If no default theme exists, the light theme\n* variant is returned as a fallback.\n*\n* It prioritizes:\n* 1. A persisted theme variant from localStorage.\n* 2. A system preference (`prefers-color-scheme`).\n* 3. The configured default theme variant.\n*\n* Returns the default theme variant, or `undefined` if no valid theme variant is found.\n*/\nexport const getDefaultThemeVariant = (themeVariants: ThemeVariants | undefined, themeDefaults: ThemeDefaults = {}) => {\n if (!themeVariants) {\n return undefined;\n }\n\n const themeVariantKeys = Object.keys(themeVariants);\n\n // If there is only one theme variant, return it since it's the only one that may be used.\n if (themeVariantKeys.length === 1) {\n const themeVariantKey = themeVariantKeys[0];\n return {\n name: themeVariantKey,\n metadata: themeVariants[themeVariantKey],\n };\n }\n\n // Prioritize persisted localStorage theme variant preference.\n const persistedSelectedThemeVariant = localStorage.getItem(SELECTED_THEME_VARIANT_KEY);\n if (persistedSelectedThemeVariant && themeVariants[persistedSelectedThemeVariant]) {\n return {\n name: persistedSelectedThemeVariant,\n metadata: themeVariants[persistedSelectedThemeVariant],\n };\n }\n\n // Then, detect system preference via `prefers-color-scheme` media query and use\n // the default dark theme variant, if one exists.\n const hasDarkSystemPreference = !!window.matchMedia?.('(prefers-color-scheme: dark)')?.matches;\n const defaultDarkThemeVariant = themeDefaults.dark ?? 'dark';\n const darkThemeVariantMetadata = themeVariants[defaultDarkThemeVariant];\n\n if (hasDarkSystemPreference && defaultDarkThemeVariant && darkThemeVariantMetadata) {\n return {\n name: defaultDarkThemeVariant,\n metadata: darkThemeVariantMetadata,\n };\n }\n\n const defaultLightThemeVariant = themeDefaults.light ?? 'light';\n const lightThemeVariantMetadata = themeVariants[defaultLightThemeVariant];\n\n // Handle edge case where the default light theme variant is not configured or provided.\n if (!lightThemeVariantMetadata) {\n return undefined;\n }\n\n // Otherwise, fallback to using the default light theme variant as configured.\n return {\n name: defaultLightThemeVariant,\n metadata: lightThemeVariantMetadata,\n };\n};\n\n/**\n * A custom React hook that manages the application's theme state and injects the appropriate CSS for the theme core\n * and theme variants (e.g., light and dark modes) into the HTML document. It handles dynamically loading the theme\n * CSS based on the current theme variant, and ensures that the theme variant's CSS is preloaded for runtime theme\n * switching. This is done using \"alternate\" stylesheets. That is, the browser will download the CSS for the\n * non-current theme variants with a lower priority than the current one.\n *\n * The hook also responds to system theme preference changes (e.g., via the `prefers-color-scheme` media query),\n * and can automatically switch the theme based on the system's dark mode or light mode preference.\n *\n * * @example\n * const [themeState, dispatch] = useTheme();\n * console.log(themeState.isThemeLoaded); // true when the theme has been successfully loaded.\n *\n * // Dispatch an action to change the theme variant\n * dispatch(themeActions.setThemeVariant('dark'));\n */\nconst useTheme = () => {\n const themeConfig = useThemeConfig();\n const {\n core: themeCore,\n defaults: themeVariantDefaults,\n variants: themeVariants,\n } = themeConfig;\n const initialThemeState = {\n isThemeLoaded: false,\n themeVariant: getDefaultThemeVariant(themeVariants, themeVariantDefaults)?.name,\n };\n const [themeState, dispatch] = useReducer(themeReducer, initialThemeState);\n\n const [isThemeCoreLoaded, setIsThemeCoreLoaded] = useState(false);\n const onLoadThemeCore = useCallback(() => {\n setIsThemeCoreLoaded(true);\n }, []);\n\n const [hasLoadedThemeVariants, setHasLoadedThemeVariants] = useState(false);\n const onLoadThemeVariants = useCallback(() => {\n setHasLoadedThemeVariants(true);\n }, []);\n\n // load the theme's core CSS\n useThemeCore({\n themeCore,\n onComplete: onLoadThemeCore,\n });\n\n // respond to system preference changes with regard to `prefers-color-scheme: dark`.\n const handleDarkModeSystemPreferenceChange = useCallback((prefersDarkMode: boolean) => {\n // Ignore system preference change if the theme variant is already set in localStorage.\n if (localStorage.getItem(SELECTED_THEME_VARIANT_KEY)) {\n return;\n }\n\n if (prefersDarkMode && themeVariantDefaults?.dark) {\n dispatch(themeActions.setThemeVariant(themeVariantDefaults.dark));\n } else if (!prefersDarkMode && themeVariantDefaults?.light) {\n dispatch(themeActions.setThemeVariant(themeVariantDefaults.light));\n } else {\n logError(`Could not set theme variant based on system preference (prefers dark mode: ${prefersDarkMode})`);\n }\n }, [themeVariantDefaults]);\n\n // load the theme variant(s) CSS\n useThemeVariants({\n themeVariants,\n onComplete: onLoadThemeVariants,\n currentThemeVariant: themeState.themeVariant,\n onDarkModeSystemPreferenceChange: handleDarkModeSystemPreferenceChange,\n });\n\n useEffect(() => {\n // theme is already loaded, do nothing\n if (themeState.isThemeLoaded) {\n return;\n }\n\n const hasThemeConfig = (themeCore?.url && !isEmptyObject(themeVariants));\n if (!hasThemeConfig) {\n // no theme URLs to load, set loading to false.\n dispatch(themeActions.setThemeLoaded(true));\n }\n\n // Return early if neither the core theme CSS nor any theme variant CSS is loaded.\n if (!isThemeCoreLoaded || !hasLoadedThemeVariants) {\n return;\n }\n\n // All application theme URLs are loaded\n dispatch(themeActions.setThemeLoaded(true));\n }, [\n themeState.isThemeLoaded,\n isThemeCoreLoaded,\n hasLoadedThemeVariants,\n themeCore?.url,\n themeVariants,\n ]);\n\n return [themeState, dispatch];\n};\n\nexport default useTheme;\n"]}
@@ -0,0 +1,16 @@
1
+ import { Theme } from '../../../../types';
2
+ /**
3
+ * Custom React hook that retrieves the theme configuration.
4
+ *
5
+ * Configuration is considered entirely invalid if it doesn't define at least one variant, including core.
6
+ *
7
+ * Example:
8
+ *
9
+ * const themeConfig = useThemeConfig();
10
+ * if (themeConfig) {
11
+ * console.log(themeConfig.core.url); // Outputs the URL of theme's core CSS
12
+ * console.log(themeConfig.variants['dark'].url); // Outputs the URL of the theme's dark variant CSS
13
+ * }
14
+ */
15
+ declare const useThemeConfig: () => Theme;
16
+ export default useThemeConfig;
@@ -0,0 +1,29 @@
1
+ import { useMemo } from 'react';
2
+ import { getSiteConfig } from '../../../config';
3
+ import { isEmptyObject } from './utils';
4
+ /**
5
+ * Custom React hook that retrieves the theme configuration.
6
+ *
7
+ * Configuration is considered entirely invalid if it doesn't define at least one variant, including core.
8
+ *
9
+ * Example:
10
+ *
11
+ * const themeConfig = useThemeConfig();
12
+ * if (themeConfig) {
13
+ * console.log(themeConfig.core.url); // Outputs the URL of theme's core CSS
14
+ * console.log(themeConfig.variants['dark'].url); // Outputs the URL of the theme's dark variant CSS
15
+ * }
16
+ */
17
+ const useThemeConfig = () => useMemo(() => {
18
+ const { theme } = getSiteConfig();
19
+ if (!theme || (isEmptyObject(theme.core) && isEmptyObject(theme.variants))) {
20
+ return {};
21
+ }
22
+ return {
23
+ core: theme.core,
24
+ defaults: theme.defaults,
25
+ variants: theme.variants,
26
+ };
27
+ }, []);
28
+ export default useThemeConfig;
29
+ //# sourceMappingURL=useThemeConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useThemeConfig.js","sourceRoot":"","sources":["../../../../../runtime/react/hooks/theme/useThemeConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAGhC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC;;;;;;;;;;;;GAYG;AACH,MAAM,cAAc,GAAG,GAAU,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE;IAC/C,MAAM,EAAE,KAAK,EAAE,GAAG,aAAa,EAAE,CAAC;IAElC,IAAI,CAAC,KAAK,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;QAC3E,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAC;AACJ,CAAC,EAAE,EAAE,CAAC,CAAC;AAEP,eAAe,cAAc,CAAC","sourcesContent":["import { useMemo } from 'react';\n\nimport { Theme } from '../../../../types';\nimport { getSiteConfig } from '../../../config';\nimport { isEmptyObject } from './utils';\n\n/**\n * Custom React hook that retrieves the theme configuration.\n *\n * Configuration is considered entirely invalid if it doesn't define at least one variant, including core.\n *\n * Example:\n *\n * const themeConfig = useThemeConfig();\n * if (themeConfig) {\n * console.log(themeConfig.core.url); // Outputs the URL of theme's core CSS\n * console.log(themeConfig.variants['dark'].url); // Outputs the URL of the theme's dark variant CSS\n * }\n */\nconst useThemeConfig = (): Theme => useMemo(() => {\n const { theme } = getSiteConfig();\n\n if (!theme || (isEmptyObject(theme.core) && isEmptyObject(theme.variants))) {\n return {};\n }\n\n return {\n core: theme.core,\n defaults: theme.defaults,\n variants: theme.variants,\n };\n}, []);\n\nexport default useThemeConfig;\n"]}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Custom React hook that manages the loading and updating of a theme's core
3
+ * CSS, ensuring the theme's core CSS is added to the document `<head>` as a
4
+ * `<link>` element.
5
+ */
6
+ declare const useThemeCore: ({ themeCore, onComplete, }: {
7
+ themeCore: any;
8
+ onComplete: any;
9
+ }) => void;
10
+ export default useThemeCore;
@@ -0,0 +1,40 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { logError } from '../../../logging';
3
+ import { removeExistingLinks } from './utils';
4
+ /**
5
+ * Custom React hook that manages the loading and updating of a theme's core
6
+ * CSS, ensuring the theme's core CSS is added to the document `<head>` as a
7
+ * `<link>` element.
8
+ */
9
+ const useThemeCore = ({ themeCore, onComplete, }) => {
10
+ const [isThemeCoreComplete, setIsThemeCoreComplete] = useState(false);
11
+ useEffect(() => {
12
+ if (isThemeCoreComplete) {
13
+ onComplete();
14
+ }
15
+ }, [isThemeCoreComplete, onComplete]);
16
+ useEffect(() => {
17
+ // If there is no theme core config, do nothing.
18
+ if (!(themeCore === null || themeCore === void 0 ? void 0 : themeCore.url)) {
19
+ setIsThemeCoreComplete(true);
20
+ return;
21
+ }
22
+ const themeCoreLink = document.createElement('link');
23
+ themeCoreLink.href = themeCore.url;
24
+ themeCoreLink.rel = 'stylesheet';
25
+ themeCoreLink.dataset.themeCore = 'true';
26
+ themeCoreLink.onload = () => {
27
+ setIsThemeCoreComplete(true);
28
+ };
29
+ themeCoreLink.onerror = () => {
30
+ setIsThemeCoreComplete(true);
31
+ const otherExistingLinks = document.head.querySelectorAll('link[data-theme-core="true"]');
32
+ removeExistingLinks(otherExistingLinks);
33
+ logError(`Failed to load core theme CSS from ${themeCore.url}. Aborting.`);
34
+ return;
35
+ };
36
+ document.head.insertAdjacentElement('beforeend', themeCoreLink);
37
+ }, [themeCore === null || themeCore === void 0 ? void 0 : themeCore.url, onComplete]);
38
+ };
39
+ export default useThemeCore;
40
+ //# sourceMappingURL=useThemeCore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useThemeCore.js","sourceRoot":"","sources":["../../../../../runtime/react/hooks/theme/useThemeCore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C;;;;GAIG;AACH,MAAM,YAAY,GAAG,CAAC,EACpB,SAAS,EACT,UAAU,GACX,EAAE,EAAE;IACH,MAAM,CAAC,mBAAmB,EAAE,sBAAsB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEtE,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,mBAAmB,EAAE,CAAC;YACxB,UAAU,EAAE,CAAC;QACf,CAAC;IACH,CAAC,EAAE,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC,CAAC;IAEtC,SAAS,CAAC,GAAG,EAAE;QACb,gDAAgD;QAChD,IAAI,CAAC,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,GAAG,CAAA,EAAE,CAAC;YACpB,sBAAsB,CAAC,IAAI,CAAC,CAAC;YAC7B,OAAO;QACT,CAAC;QAED,MAAM,aAAa,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QACrD,aAAa,CAAC,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC;QACnC,aAAa,CAAC,GAAG,GAAG,YAAY,CAAC;QACjC,aAAa,CAAC,OAAO,CAAC,SAAS,GAAG,MAAM,CAAC;QACzC,aAAa,CAAC,MAAM,GAAG,GAAG,EAAE;YAC1B,sBAAsB,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC,CAAC;QACF,aAAa,CAAC,OAAO,GAAG,GAAG,EAAE;YAC3B,sBAAsB,CAAC,IAAI,CAAC,CAAC;YAC7B,MAAM,kBAAkB,GAAG,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,8BAA8B,CAAC,CAAC;YAC1F,mBAAmB,CAAC,kBAAkB,CAAC,CAAC;YACxC,QAAQ,CAAC,sCAAsC,SAAS,CAAC,GAAG,aAAa,CAAC,CAAC;YAC3E,OAAO;QACT,CAAC,CAAC;QAEF,QAAQ,CAAC,IAAI,CAAC,qBAAqB,CACjC,WAAW,EACX,aAAa,CACd,CAAC;IACJ,CAAC,EAAE,CAAC,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { useEffect, useState } from 'react';\n\nimport { logError } from '../../../logging';\nimport { removeExistingLinks } from './utils';\n\n/**\n * Custom React hook that manages the loading and updating of a theme's core\n * CSS, ensuring the theme's core CSS is added to the document `<head>` as a\n * `<link>` element.\n */\nconst useThemeCore = ({\n themeCore,\n onComplete,\n}) => {\n const [isThemeCoreComplete, setIsThemeCoreComplete] = useState(false);\n\n useEffect(() => {\n if (isThemeCoreComplete) {\n onComplete();\n }\n }, [isThemeCoreComplete, onComplete]);\n\n useEffect(() => {\n // If there is no theme core config, do nothing.\n if (!themeCore?.url) {\n setIsThemeCoreComplete(true);\n return;\n }\n\n const themeCoreLink = document.createElement('link');\n themeCoreLink.href = themeCore.url;\n themeCoreLink.rel = 'stylesheet';\n themeCoreLink.dataset.themeCore = 'true';\n themeCoreLink.onload = () => {\n setIsThemeCoreComplete(true);\n };\n themeCoreLink.onerror = () => {\n setIsThemeCoreComplete(true);\n const otherExistingLinks = document.head.querySelectorAll('link[data-theme-core=\"true\"]');\n removeExistingLinks(otherExistingLinks);\n logError(`Failed to load core theme CSS from ${themeCore.url}. Aborting.`);\n return;\n };\n\n document.head.insertAdjacentElement(\n 'beforeend',\n themeCoreLink,\n );\n }, [themeCore?.url, onComplete]);\n};\n\nexport default useThemeCore;\n"]}
@@ -0,0 +1,17 @@
1
+ import { ThemeVariants } from '../../../../types';
2
+ /**
3
+ * A custom React hook that manages the loading of theme variant CSS files dynamically.
4
+ * Adds/updates a `<link>` element in the HTML document to load each theme variant's CSS, setting the
5
+ * non-current theme variants as "alternate" stylesheets. That is, the browser will download
6
+ * the CSS for the non-current theme variants, but at a lower priority than the current one.
7
+ * This ensures that if the theme variant is changed at runtime, the new theme's CSS will already be loaded.
8
+ *
9
+ * The hook also listens for changes in the system's preference and triggers the provided callback accordingly.
10
+ */
11
+ declare const useThemeVariants: ({ themeVariants, currentThemeVariant, onComplete, onDarkModeSystemPreferenceChange, }: {
12
+ themeVariants: ThemeVariants | undefined;
13
+ currentThemeVariant: string;
14
+ onComplete: () => void;
15
+ onDarkModeSystemPreferenceChange: (prefersDarkMode: boolean) => void;
16
+ }) => void;
17
+ export default useThemeVariants;
@@ -0,0 +1,90 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { logError } from '../../../logging';
3
+ /**
4
+ * A custom React hook that manages the loading of theme variant CSS files dynamically.
5
+ * Adds/updates a `<link>` element in the HTML document to load each theme variant's CSS, setting the
6
+ * non-current theme variants as "alternate" stylesheets. That is, the browser will download
7
+ * the CSS for the non-current theme variants, but at a lower priority than the current one.
8
+ * This ensures that if the theme variant is changed at runtime, the new theme's CSS will already be loaded.
9
+ *
10
+ * The hook also listens for changes in the system's preference and triggers the provided callback accordingly.
11
+ */
12
+ const useThemeVariants = ({ themeVariants, currentThemeVariant, onComplete, onDarkModeSystemPreferenceChange, }) => {
13
+ const [isThemeVariantComplete, setIsThemeVariantComplete] = useState(false);
14
+ // Effect hook that listens for changes in the system's dark mode preference.
15
+ useEffect(() => {
16
+ var _a;
17
+ const changeColorScheme = (colorSchemeQuery) => {
18
+ onDarkModeSystemPreferenceChange(colorSchemeQuery.matches);
19
+ };
20
+ const colorSchemeQuery = (_a = window.matchMedia) === null || _a === void 0 ? void 0 : _a.call(window, '(prefers-color-scheme: dark)');
21
+ if (colorSchemeQuery) {
22
+ colorSchemeQuery.addEventListener('change', changeColorScheme);
23
+ }
24
+ return () => {
25
+ if (colorSchemeQuery) {
26
+ colorSchemeQuery.removeEventListener('change', changeColorScheme);
27
+ }
28
+ };
29
+ }, [onDarkModeSystemPreferenceChange]);
30
+ // Effect hook to set the theme current variant on the HTML element.
31
+ useEffect(() => {
32
+ var _a;
33
+ if (currentThemeVariant && (themeVariants === null || themeVariants === void 0 ? void 0 : themeVariants[currentThemeVariant])) {
34
+ const htmlDataThemeVariantAttr = 'data-theme-variant';
35
+ (_a = document.querySelector('html')) === null || _a === void 0 ? void 0 : _a.setAttribute(htmlDataThemeVariantAttr, currentThemeVariant);
36
+ return () => {
37
+ var _a;
38
+ (_a = document.querySelector('html')) === null || _a === void 0 ? void 0 : _a.removeAttribute(htmlDataThemeVariantAttr);
39
+ };
40
+ }
41
+ return () => { }; // Cleanup: no action needed when theme variant is not set
42
+ }, [themeVariants, currentThemeVariant]);
43
+ // Effect hook that calls `onComplete` when brand theme variant processing is complete.
44
+ useEffect(() => {
45
+ if (isThemeVariantComplete) {
46
+ onComplete();
47
+ }
48
+ }, [isThemeVariantComplete, onComplete]);
49
+ useEffect(() => {
50
+ if (!themeVariants) {
51
+ return;
52
+ }
53
+ /**
54
+ * Determines the value for the `rel` attribute for a given theme variant based
55
+ * on if its the currently applied variant.
56
+ */
57
+ const getActiveOrAlternateRel = (themeVariant) => (currentThemeVariant === themeVariant ? 'stylesheet' : 'alternate stylesheet');
58
+ // Iterate over each theme variant URLs and inject them into the HTML document, if each doesn't already exist.
59
+ Object.entries(themeVariants).forEach(([themeVariant, { url }]) => {
60
+ // If the config for the theme variant does not have a URL, set the variant to complete and continue.
61
+ if (!url) {
62
+ setIsThemeVariantComplete(true);
63
+ return;
64
+ }
65
+ const existingThemeVariantLink = document.head.querySelector(`link[href='${url}']`);
66
+ if (existingThemeVariantLink) {
67
+ existingThemeVariantLink.rel = getActiveOrAlternateRel(themeVariant);
68
+ existingThemeVariantLink.dataset.themeVariant = themeVariant;
69
+ return;
70
+ }
71
+ const themeVariantLink = document.createElement('link');
72
+ themeVariantLink.href = url;
73
+ themeVariantLink.rel = getActiveOrAlternateRel(themeVariant);
74
+ themeVariantLink.dataset.themeVariant = themeVariant;
75
+ themeVariantLink.onload = () => {
76
+ if (themeVariant === currentThemeVariant) {
77
+ setIsThemeVariantComplete(true);
78
+ }
79
+ };
80
+ themeVariantLink.onerror = () => {
81
+ logError(`Failed to load theme variant (${themeVariant}) CSS from ${url}. Aborting.`);
82
+ setIsThemeVariantComplete(true);
83
+ };
84
+ document.head.insertAdjacentElement('beforeend', themeVariantLink);
85
+ setIsThemeVariantComplete(true);
86
+ });
87
+ }, [themeVariants, currentThemeVariant, onComplete]);
88
+ };
89
+ export default useThemeVariants;
90
+ //# sourceMappingURL=useThemeVariants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useThemeVariants.js","sourceRoot":"","sources":["../../../../../runtime/react/hooks/theme/useThemeVariants.ts"],"names":[],"mappings":"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","sourcesContent":["import { useEffect, useState } from 'react';\n\nimport { logError } from '../../../logging';\n\nimport { ThemeVariants } from '../../../../types';\n\n/**\n * A custom React hook that manages the loading of theme variant CSS files dynamically.\n * Adds/updates a `<link>` element in the HTML document to load each theme variant's CSS, setting the\n * non-current theme variants as \"alternate\" stylesheets. That is, the browser will download\n * the CSS for the non-current theme variants, but at a lower priority than the current one.\n * This ensures that if the theme variant is changed at runtime, the new theme's CSS will already be loaded.\n *\n * The hook also listens for changes in the system's preference and triggers the provided callback accordingly.\n */\nconst useThemeVariants = ({\n themeVariants,\n currentThemeVariant,\n onComplete,\n onDarkModeSystemPreferenceChange,\n}: {\n themeVariants: ThemeVariants | undefined,\n currentThemeVariant: string,\n onComplete: () => void,\n onDarkModeSystemPreferenceChange: (prefersDarkMode: boolean) => void,\n}) => {\n const [isThemeVariantComplete, setIsThemeVariantComplete] = useState(false);\n\n // Effect hook that listens for changes in the system's dark mode preference.\n useEffect(() => {\n const changeColorScheme = (colorSchemeQuery) => {\n onDarkModeSystemPreferenceChange(colorSchemeQuery.matches);\n };\n const colorSchemeQuery = window.matchMedia?.('(prefers-color-scheme: dark)');\n if (colorSchemeQuery) {\n colorSchemeQuery.addEventListener('change', changeColorScheme);\n }\n return () => {\n if (colorSchemeQuery) {\n colorSchemeQuery.removeEventListener('change', changeColorScheme);\n }\n };\n }, [onDarkModeSystemPreferenceChange]);\n\n // Effect hook to set the theme current variant on the HTML element.\n useEffect(() => {\n if (currentThemeVariant && themeVariants?.[currentThemeVariant]) {\n const htmlDataThemeVariantAttr = 'data-theme-variant';\n document.querySelector('html')?.setAttribute(htmlDataThemeVariantAttr, currentThemeVariant);\n return () => {\n document.querySelector('html')?.removeAttribute(htmlDataThemeVariantAttr);\n };\n }\n return () => { }; // Cleanup: no action needed when theme variant is not set\n }, [themeVariants, currentThemeVariant]);\n\n // Effect hook that calls `onComplete` when brand theme variant processing is complete.\n useEffect(() => {\n if (isThemeVariantComplete) {\n onComplete();\n }\n }, [isThemeVariantComplete, onComplete]);\n\n useEffect(() => {\n if (!themeVariants) {\n return;\n }\n\n /**\n * Determines the value for the `rel` attribute for a given theme variant based\n * on if its the currently applied variant.\n */\n const getActiveOrAlternateRel = (themeVariant: string): string => (currentThemeVariant === themeVariant ? 'stylesheet' : 'alternate stylesheet');\n\n // Iterate over each theme variant URLs and inject them into the HTML document, if each doesn't already exist.\n Object.entries(themeVariants).forEach(([themeVariant, { url }]) => {\n // If the config for the theme variant does not have a URL, set the variant to complete and continue.\n if (!url) {\n setIsThemeVariantComplete(true);\n return;\n }\n\n const existingThemeVariantLink: HTMLAnchorElement | null = document.head.querySelector(`link[href='${url}']`);\n if (existingThemeVariantLink) {\n existingThemeVariantLink.rel = getActiveOrAlternateRel(themeVariant);\n existingThemeVariantLink.dataset.themeVariant = themeVariant;\n return;\n }\n\n const themeVariantLink = document.createElement('link');\n themeVariantLink.href = url;\n themeVariantLink.rel = getActiveOrAlternateRel(themeVariant);\n themeVariantLink.dataset.themeVariant = themeVariant;\n\n themeVariantLink.onload = () => {\n if (themeVariant === currentThemeVariant) {\n setIsThemeVariantComplete(true);\n }\n };\n\n themeVariantLink.onerror = () => {\n logError(`Failed to load theme variant (${themeVariant}) CSS from ${url}. Aborting.`);\n setIsThemeVariantComplete(true);\n };\n\n document.head.insertAdjacentElement(\n 'beforeend',\n themeVariantLink,\n );\n\n setIsThemeVariantComplete(true);\n });\n }, [themeVariants, currentThemeVariant, onComplete]);\n};\n\nexport default useThemeVariants;\n"]}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * A React hook that tracks user's preferred color scheme (light or dark) and sends respective
3
+ * event to the tracking service.
4
+ *
5
+ * @memberof module:React
6
+ */
7
+ declare const useTrackColorSchemeChoice: () => void;
8
+ export default useTrackColorSchemeChoice;
@@ -0,0 +1,30 @@
1
+ import { useEffect } from 'react';
2
+ import { sendTrackEvent } from '../../../analytics';
3
+ /**
4
+ * A React hook that tracks user's preferred color scheme (light or dark) and sends respective
5
+ * event to the tracking service.
6
+ *
7
+ * @memberof module:React
8
+ */
9
+ const useTrackColorSchemeChoice = () => {
10
+ useEffect(() => {
11
+ var _a;
12
+ const trackColorSchemeChoice = ({ matches }) => {
13
+ const preferredColorScheme = matches ? 'dark' : 'light';
14
+ sendTrackEvent('openedx.ui.frontend-base.prefers-color-scheme.selected', { preferredColorScheme });
15
+ };
16
+ const colorSchemeQuery = (_a = window.matchMedia) === null || _a === void 0 ? void 0 : _a.call(window, '(prefers-color-scheme: dark)');
17
+ if (colorSchemeQuery) {
18
+ // send user's initial choice
19
+ trackColorSchemeChoice(colorSchemeQuery);
20
+ colorSchemeQuery.addEventListener('change', trackColorSchemeChoice);
21
+ }
22
+ return () => {
23
+ if (colorSchemeQuery) {
24
+ colorSchemeQuery.removeEventListener('change', trackColorSchemeChoice);
25
+ }
26
+ };
27
+ }, []);
28
+ };
29
+ export default useTrackColorSchemeChoice;
30
+ //# sourceMappingURL=useTrackColorSchemeChoice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTrackColorSchemeChoice.js","sourceRoot":"","sources":["../../../../../runtime/react/hooks/theme/useTrackColorSchemeChoice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,yBAAyB,GAAG,GAAG,EAAE;IACrC,SAAS,CAAC,GAAG,EAAE;;QACb,MAAM,sBAAsB,GAAG,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;YAC7C,MAAM,oBAAoB,GAAG,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;YACxD,cAAc,CAAC,wDAAwD,EAAE,EAAE,oBAAoB,EAAE,CAAC,CAAC;QACrG,CAAC,CAAC;QACF,MAAM,gBAAgB,GAAG,MAAA,MAAM,CAAC,UAAU,uDAAG,8BAA8B,CAAC,CAAC;QAC7E,IAAI,gBAAgB,EAAE,CAAC;YACrB,6BAA6B;YAC7B,sBAAsB,CAAC,gBAAgB,CAAC,CAAC;YACzC,gBAAgB,CAAC,gBAAgB,CAAC,QAAQ,EAAE,sBAAsB,CAAC,CAAC;QACtE,CAAC;QACD,OAAO,GAAG,EAAE;YACV,IAAI,gBAAgB,EAAE,CAAC;gBACrB,gBAAgB,CAAC,mBAAmB,CAAC,QAAQ,EAAE,sBAAsB,CAAC,CAAC;YACzE,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC,CAAC;AAEF,eAAe,yBAAyB,CAAC","sourcesContent":["import { useEffect } from 'react';\nimport { sendTrackEvent } from '../../../analytics';\n\n/**\n * A React hook that tracks user's preferred color scheme (light or dark) and sends respective\n * event to the tracking service.\n *\n * @memberof module:React\n */\nconst useTrackColorSchemeChoice = () => {\n useEffect(() => {\n const trackColorSchemeChoice = ({ matches }) => {\n const preferredColorScheme = matches ? 'dark' : 'light';\n sendTrackEvent('openedx.ui.frontend-base.prefers-color-scheme.selected', { preferredColorScheme });\n };\n const colorSchemeQuery = window.matchMedia?.('(prefers-color-scheme: dark)');\n if (colorSchemeQuery) {\n // send user's initial choice\n trackColorSchemeChoice(colorSchemeQuery);\n colorSchemeQuery.addEventListener('change', trackColorSchemeChoice);\n }\n return () => {\n if (colorSchemeQuery) {\n colorSchemeQuery.removeEventListener('change', trackColorSchemeChoice);\n }\n };\n }, []);\n};\n\nexport default useTrackColorSchemeChoice;\n"]}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Iterates through each given `<link>` element and removes it from the DOM.
3
+ * @param {HTMLLinkElement[]} existingLinks
4
+ */
5
+ export declare const removeExistingLinks: (existingLinks: any) => void;
6
+ export declare const isEmptyObject: (obj: any) => boolean;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Iterates through each given `<link>` element and removes it from the DOM.
3
+ * @param {HTMLLinkElement[]} existingLinks
4
+ */
5
+ export const removeExistingLinks = (existingLinks) => {
6
+ existingLinks.forEach((link) => {
7
+ link.remove();
8
+ });
9
+ };
10
+ export const isEmptyObject = (obj) => !obj || Object.keys(obj).length === 0;
11
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../runtime/react/hooks/theme/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,aAAa,EAAE,EAAE;IACnD,aAAa,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAC7B,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC","sourcesContent":["/**\n * Iterates through each given `<link>` element and removes it from the DOM.\n * @param {HTMLLinkElement[]} existingLinks\n */\nexport const removeExistingLinks = (existingLinks) => {\n existingLinks.forEach((link) => {\n link.remove();\n });\n};\n\nexport const isEmptyObject = (obj) => !obj || Object.keys(obj).length === 0;\n"]}
@@ -0,0 +1,2 @@
1
+ declare const useActiveRoles: () => string[];
2
+ export default useActiveRoles;
@@ -0,0 +1,13 @@
1
+ import { useState } from 'react';
2
+ import { getActiveRoles } from '../../config';
3
+ import { ACTIVE_ROLES_CHANGED } from '../../constants';
4
+ import useSiteEvent from './useSiteEvent';
5
+ const useActiveRoles = () => {
6
+ const [roles, setRoles] = useState(getActiveRoles());
7
+ useSiteEvent(ACTIVE_ROLES_CHANGED, () => {
8
+ setRoles(getActiveRoles());
9
+ });
10
+ return roles;
11
+ };
12
+ export default useActiveRoles;
13
+ //# sourceMappingURL=useActiveRoles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useActiveRoles.js","sourceRoot":"","sources":["../../../../runtime/react/hooks/useActiveRoles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C,MAAM,cAAc,GAAG,GAAG,EAAE;IAC1B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAW,cAAc,EAAE,CAAC,CAAC;IAC/D,YAAY,CAAC,oBAAoB,EAAE,GAAG,EAAE;QACtC,QAAQ,CAAC,cAAc,EAAE,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { useState } from 'react';\nimport { getActiveRoles } from '../../config';\nimport { ACTIVE_ROLES_CHANGED } from '../../constants';\nimport useSiteEvent from './useSiteEvent';\n\nconst useActiveRoles = () => {\n const [roles, setRoles] = useState<string[]>(getActiveRoles());\n useSiteEvent(ACTIVE_ROLES_CHANGED, () => {\n setRoles(getActiveRoles());\n });\n\n return roles;\n};\n\nexport default useActiveRoles;\n"]}
@@ -0,0 +1,2 @@
1
+ declare const useActiveRouteRoleWatcher: () => void;
2
+ export default useActiveRouteRoleWatcher;
@@ -0,0 +1,26 @@
1
+ import { useCallback, useEffect } from 'react';
2
+ import { useMatches } from 'react-router';
3
+ import { setActiveRouteRoles } from '../../config';
4
+ import { isRoleRouteObject } from '../../routing';
5
+ const useActiveRouteRoleWatcher = () => {
6
+ const matches = useMatches();
7
+ // We create this callback so we can use it right away to populate the default state value.
8
+ const findActiveRouteRoles = useCallback(() => {
9
+ // Starts with the widget roles and adds the others in.
10
+ const roles = [];
11
+ // Route roles
12
+ for (const match of matches) {
13
+ if (isRoleRouteObject(match)) {
14
+ if (!roles.includes(match.handle.role)) {
15
+ roles.push(match.handle.role);
16
+ }
17
+ }
18
+ }
19
+ return roles;
20
+ }, [matches]);
21
+ useEffect(() => {
22
+ setActiveRouteRoles(findActiveRouteRoles());
23
+ }, [matches, findActiveRouteRoles]);
24
+ };
25
+ export default useActiveRouteRoleWatcher;
26
+ //# sourceMappingURL=useActiveRouteRoleWatcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useActiveRouteRoleWatcher.js","sourceRoot":"","sources":["../../../../runtime/react/hooks/useActiveRouteRoleWatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,MAAM,yBAAyB,GAAG,GAAG,EAAE;IACrC,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAE7B,2FAA2F;IAC3F,MAAM,oBAAoB,GAAG,WAAW,CAAC,GAAG,EAAE;QAC5C,uDAAuD;QACvD,MAAM,KAAK,GAAa,EAAE,CAAC;QAE3B,cAAc;QACd,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,IAAI,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC7B,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;oBACvC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBAChC,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,SAAS,CAAC,GAAG,EAAE;QACb,mBAAmB,CAAC,oBAAoB,EAAE,CAAC,CAAC;IAC9C,CAAC,EAAE,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC;AACtC,CAAC,CAAC;AAEF,eAAe,yBAAyB,CAAC","sourcesContent":["import { useCallback, useEffect } from 'react';\nimport { useMatches } from 'react-router';\nimport { setActiveRouteRoles } from '../../config';\nimport { isRoleRouteObject } from '../../routing';\n\nconst useActiveRouteRoleWatcher = () => {\n const matches = useMatches();\n\n // We create this callback so we can use it right away to populate the default state value.\n const findActiveRouteRoles = useCallback(() => {\n // Starts with the widget roles and adds the others in.\n const roles: string[] = [];\n\n // Route roles\n for (const match of matches) {\n if (isRoleRouteObject(match)) {\n if (!roles.includes(match.handle.role)) {\n roles.push(match.handle.role);\n }\n }\n }\n\n return roles;\n }, [matches]);\n\n useEffect(() => {\n setActiveRouteRoles(findActiveRouteRoles());\n }, [matches, findActiveRouteRoles]);\n};\n\nexport default useActiveRouteRoleWatcher;\n"]}
@@ -0,0 +1,2 @@
1
+ declare const useAppConfig: () => import("../../..").AppConfig;
2
+ export default useAppConfig;
@@ -0,0 +1,8 @@
1
+ import { useContext } from 'react';
2
+ import CurrentAppContext from '../CurrentAppContext';
3
+ const useAppConfig = () => {
4
+ const { appConfig } = useContext(CurrentAppContext);
5
+ return appConfig;
6
+ };
7
+ export default useAppConfig;
8
+ //# sourceMappingURL=useAppConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAppConfig.js","sourceRoot":"","sources":["../../../../runtime/react/hooks/useAppConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,iBAAiB,MAAM,sBAAsB,CAAC;AAErD,MAAM,YAAY,GAAG,GAAG,EAAE;IACxB,MAAM,EAAE,SAAS,EAAE,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;IACpD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { useContext } from 'react';\nimport CurrentAppContext from '../CurrentAppContext';\n\nconst useAppConfig = () => {\n const { appConfig } = useContext(CurrentAppContext);\n return appConfig;\n};\n\nexport default useAppConfig;\n"]}
@@ -0,0 +1,2 @@
1
+ declare const useAuthenticatedUser: () => import("../../..").User | null;
2
+ export default useAuthenticatedUser;
@@ -0,0 +1,8 @@
1
+ import { useContext } from 'react';
2
+ import SiteContext from '../SiteContext';
3
+ const useAuthenticatedUser = () => {
4
+ const { authenticatedUser } = useContext(SiteContext);
5
+ return authenticatedUser;
6
+ };
7
+ export default useAuthenticatedUser;
8
+ //# sourceMappingURL=useAuthenticatedUser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAuthenticatedUser.js","sourceRoot":"","sources":["../../../../runtime/react/hooks/useAuthenticatedUser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAEzC,MAAM,oBAAoB,GAAG,GAAG,EAAE;IAChC,MAAM,EAAE,iBAAiB,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IACtD,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC","sourcesContent":["import { useContext } from 'react';\nimport SiteContext from '../SiteContext';\n\nconst useAuthenticatedUser = () => {\n const { authenticatedUser } = useContext(SiteContext);\n return authenticatedUser;\n};\n\nexport default useAuthenticatedUser;\n"]}
@@ -0,0 +1,2 @@
1
+ declare const useSiteConfig: () => import("../../..").SiteConfig;
2
+ export default useSiteConfig;
@@ -0,0 +1,8 @@
1
+ import { useContext } from 'react';
2
+ import SiteContext from '../SiteContext';
3
+ const useSiteConfig = () => {
4
+ const { siteConfig } = useContext(SiteContext);
5
+ return siteConfig;
6
+ };
7
+ export default useSiteConfig;
8
+ //# sourceMappingURL=useSiteConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSiteConfig.js","sourceRoot":"","sources":["../../../../runtime/react/hooks/useSiteConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAEzC,MAAM,aAAa,GAAG,GAAG,EAAE;IACzB,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IAC/C,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { useContext } from 'react';\nimport SiteContext from '../SiteContext';\n\nconst useSiteConfig = () => {\n const { siteConfig } = useContext(SiteContext);\n return siteConfig;\n};\n\nexport default useSiteConfig;\n"]}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * A React hook that allows functional components to subscribe to application events. This should
3
+ * be used sparingly - for the most part, Context should be used higher-up in the application to
4
+ * provide necessary data to a given component, rather than utilizing a non-React-like Pub/Sub
5
+ * mechanism.
6
+ *
7
+ * @memberof module:React
8
+ * @param {string} type
9
+ * @param {function} callback
10
+ */
11
+ declare const useSiteEvent: (type: any, callback: any) => void;
12
+ export default useSiteEvent;