@openedx/frontend-base 1.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (356) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +112 -0
  3. package/config/babel/babel.config.js +28 -0
  4. package/config/config-helpers/createConfig.js +13 -0
  5. package/config/config-helpers/createLintConfig.js +16 -0
  6. package/config/config-helpers/getBaseConfig.js +12 -0
  7. package/config/defaultConfigPaths.js +35 -0
  8. package/config/eslint/base.eslint.config.js +113 -0
  9. package/config/index.js +12 -0
  10. package/config/jest/jest.config.js +30 -0
  11. package/config/tsconfig.json +32 -0
  12. package/config/types.js +25 -0
  13. package/config/webpack/common-config/all/getCodeRules.js +52 -0
  14. package/config/webpack/common-config/all/getFileLoaderRules.js +26 -0
  15. package/config/webpack/common-config/all/getIgnoreWarnings.js +14 -0
  16. package/config/webpack/common-config/all/getImageMinimizer.js +25 -0
  17. package/config/webpack/common-config/all/getStylesheetRule.js +112 -0
  18. package/config/webpack/common-config/dev/getDevServer.js +38 -0
  19. package/config/webpack/common-config/index.js +18 -0
  20. package/config/webpack/common-config/site/getHtmlWebpackPlugin.js +16 -0
  21. package/config/webpack/plugins/html-webpack-new-relic-plugin/HtmlWebpackNewRelicPlugin.js +91 -0
  22. package/config/webpack/plugins/html-webpack-new-relic-plugin/index.js +7 -0
  23. package/config/webpack/plugins/html-webpack-new-relic-plugin/test/fixtures/entry.js +3 -0
  24. package/config/webpack/plugins/paragon-webpack-plugin/ParagonWebpackPlugin.js +108 -0
  25. package/config/webpack/plugins/paragon-webpack-plugin/index.js +7 -0
  26. package/config/webpack/plugins/paragon-webpack-plugin/utils/assetUtils.js +64 -0
  27. package/config/webpack/plugins/paragon-webpack-plugin/utils/htmlUtils.js +53 -0
  28. package/config/webpack/plugins/paragon-webpack-plugin/utils/index.js +9 -0
  29. package/config/webpack/plugins/paragon-webpack-plugin/utils/paragonStylesheetUtils.js +114 -0
  30. package/config/webpack/plugins/paragon-webpack-plugin/utils/scriptUtils.js +146 -0
  31. package/config/webpack/plugins/paragon-webpack-plugin/utils/stylesheetUtils.js +126 -0
  32. package/config/webpack/plugins/paragon-webpack-plugin/utils/tagUtils.js +57 -0
  33. package/config/webpack/types.js +2 -0
  34. package/config/webpack/utils/getLocalAliases.js +65 -0
  35. package/config/webpack/utils/getPublicPath.js +6 -0
  36. package/config/webpack/utils/getResolvedSiteConfigPath.js +32 -0
  37. package/config/webpack/utils/paragonUtils.js +138 -0
  38. package/config/webpack/webpack.config.build.js +80 -0
  39. package/config/webpack/webpack.config.dev.js +76 -0
  40. package/config/webpack/webpack.config.dev.shell.js +110 -0
  41. package/eslint.config.js +18 -0
  42. package/frontend-base.d.ts +8 -0
  43. package/index.ts +7 -0
  44. package/jest.config.js +7 -0
  45. package/openedx-frontend-base.tgz +0 -0
  46. package/package.json +149 -0
  47. package/runtime/analytics/MockAnalyticsService.js +71 -0
  48. package/runtime/analytics/SegmentAnalyticsService.js +243 -0
  49. package/runtime/analytics/index.ts +12 -0
  50. package/runtime/analytics/interface.js +145 -0
  51. package/runtime/auth/AxiosCsrfTokenService.js +60 -0
  52. package/runtime/auth/AxiosJwtAuthService.js +363 -0
  53. package/runtime/auth/AxiosJwtTokenService.js +134 -0
  54. package/runtime/auth/LocalForageCache.js +76 -0
  55. package/runtime/auth/MockAuthService.js +278 -0
  56. package/runtime/auth/index.ts +19 -0
  57. package/runtime/auth/interceptors/createCsrfTokenProviderInterceptor.js +36 -0
  58. package/runtime/auth/interceptors/createJwtTokenProviderInterceptor.js +37 -0
  59. package/runtime/auth/interceptors/createProcessAxiosRequestErrorInterceptor.js +20 -0
  60. package/runtime/auth/interceptors/createRetryInterceptor.js +74 -0
  61. package/runtime/auth/interface.js +309 -0
  62. package/runtime/auth/utils.js +105 -0
  63. package/runtime/babel.config.js +3 -0
  64. package/runtime/config/index.ts +295 -0
  65. package/runtime/constants.ts +68 -0
  66. package/runtime/i18n/index.js +118 -0
  67. package/runtime/i18n/injectIntlWithShim.jsx +48 -0
  68. package/runtime/i18n/lib.ts +272 -0
  69. package/runtime/index.ts +134 -0
  70. package/runtime/initialize.js +352 -0
  71. package/runtime/jest.config.js +32 -0
  72. package/runtime/logging/MockLoggingService.js +31 -0
  73. package/runtime/logging/NewRelicLoggingService.js +184 -0
  74. package/runtime/logging/index.ts +9 -0
  75. package/runtime/logging/interface.js +109 -0
  76. package/runtime/logging/types.ts +4 -0
  77. package/runtime/react/AuthenticatedPageRoute.jsx +43 -0
  78. package/runtime/react/CombinedAppProvider.tsx +46 -0
  79. package/runtime/react/CurrentAppContext.tsx +25 -0
  80. package/runtime/react/CurrentAppProvider.tsx +46 -0
  81. package/runtime/react/Divider.tsx +5 -0
  82. package/runtime/react/ErrorBoundary.jsx +47 -0
  83. package/runtime/react/ErrorPage.jsx +72 -0
  84. package/runtime/react/LoginRedirect.jsx +16 -0
  85. package/runtime/react/PageWrap.jsx +24 -0
  86. package/runtime/react/SiteContext.tsx +32 -0
  87. package/runtime/react/SiteProvider.tsx +78 -0
  88. package/runtime/react/hooks.ts +106 -0
  89. package/runtime/react/index.ts +19 -0
  90. package/runtime/routing/index.ts +1 -0
  91. package/runtime/routing/utils.ts +34 -0
  92. package/runtime/scripts/GoogleAnalyticsLoader.ts +59 -0
  93. package/runtime/scripts/index.ts +1 -0
  94. package/runtime/setupTest.js +49 -0
  95. package/runtime/slots/Slot.tsx +32 -0
  96. package/runtime/slots/SlotContext.tsx +8 -0
  97. package/runtime/slots/hooks.ts +35 -0
  98. package/runtime/slots/index.ts +7 -0
  99. package/runtime/slots/layout/DefaultSlotLayout.tsx +9 -0
  100. package/runtime/slots/layout/hooks.ts +65 -0
  101. package/runtime/slots/layout/index.ts +5 -0
  102. package/runtime/slots/layout/types.ts +45 -0
  103. package/runtime/slots/layout/utils.ts +14 -0
  104. package/runtime/slots/types.ts +23 -0
  105. package/runtime/slots/utils.ts +59 -0
  106. package/runtime/slots/widget/WidgetContext.tsx +9 -0
  107. package/runtime/slots/widget/WidgetProvider.tsx +30 -0
  108. package/runtime/slots/widget/hooks.ts +105 -0
  109. package/runtime/slots/widget/iframe/IFrameContentWrapper.messages.tsx +16 -0
  110. package/runtime/slots/widget/iframe/IFrameContentWrapper.tsx +84 -0
  111. package/runtime/slots/widget/iframe/IFrameWidget.tsx +59 -0
  112. package/runtime/slots/widget/iframe/constants.ts +19 -0
  113. package/runtime/slots/widget/iframe/hooks.ts +179 -0
  114. package/runtime/slots/widget/iframe/index.ts +6 -0
  115. package/runtime/slots/widget/iframe/types.ts +7 -0
  116. package/runtime/slots/widget/index.ts +6 -0
  117. package/runtime/slots/widget/types.ts +134 -0
  118. package/runtime/slots/widget/utils.tsx +201 -0
  119. package/runtime/subscriptions.ts +60 -0
  120. package/runtime/testing/index.ts +9 -0
  121. package/runtime/testing/initializeMockApp.ts +81 -0
  122. package/runtime/testing/mockMessages.ts +23 -0
  123. package/runtime/utils.js +178 -0
  124. package/shell/DefaultLayout.tsx +18 -0
  125. package/shell/DefaultMain.tsx +7 -0
  126. package/shell/Logo.tsx +28 -0
  127. package/shell/Shell.messages.ts +61 -0
  128. package/shell/Shell.tsx +18 -0
  129. package/shell/app.scss +149 -0
  130. package/shell/app.ts +24 -0
  131. package/shell/babel.config.js +3 -0
  132. package/shell/dev/devFooter/app.tsx +43 -0
  133. package/shell/dev/devFooter/index.ts +1 -0
  134. package/shell/dev/devHeader/BarContext.tsx +13 -0
  135. package/shell/dev/devHeader/BarLink.tsx +16 -0
  136. package/shell/dev/devHeader/BarProvider.tsx +25 -0
  137. package/shell/dev/devHeader/CoursesLink.tsx +16 -0
  138. package/shell/dev/devHeader/FooContext.tsx +13 -0
  139. package/shell/dev/devHeader/FooLink.tsx +16 -0
  140. package/shell/dev/devHeader/FooProvider.tsx +25 -0
  141. package/shell/dev/devHeader/app.tsx +53 -0
  142. package/shell/dev/devHeader/index.ts +1 -0
  143. package/shell/dev/devHeader/providers.tsx +11 -0
  144. package/shell/dev/devHome/HomePage.tsx +28 -0
  145. package/shell/dev/devHome/app.ts +18 -0
  146. package/shell/dev/devHome/i18n/index.ts +27 -0
  147. package/shell/dev/devHome/index.ts +1 -0
  148. package/shell/dev/devHome/messages.ts +11 -0
  149. package/shell/dev/devUser/app.tsx +24 -0
  150. package/shell/dev/devUser/index.ts +1 -0
  151. package/shell/dev/index.ts +5 -0
  152. package/shell/dev/slotShowcase/HorizontalSlotLayout.tsx +11 -0
  153. package/shell/dev/slotShowcase/LayoutWithOptions.tsx +17 -0
  154. package/shell/dev/slotShowcase/SlotShowcasePage.tsx +66 -0
  155. package/shell/dev/slotShowcase/WidgetWithOptions.tsx +11 -0
  156. package/shell/dev/slotShowcase/app.tsx +373 -0
  157. package/shell/dev/slotShowcase/index.ts +1 -0
  158. package/shell/footer/CenterLinks.tsx +11 -0
  159. package/shell/footer/CopyrightNotice.tsx +36 -0
  160. package/shell/footer/Footer.tsx +34 -0
  161. package/shell/footer/LabeledLinkColumn.tsx +19 -0
  162. package/shell/footer/LanguageMenu.tsx +35 -0
  163. package/shell/footer/LanguageMenuItem.tsx +23 -0
  164. package/shell/footer/LeftLinks.tsx +11 -0
  165. package/shell/footer/LegalNotices.tsx +17 -0
  166. package/shell/footer/PoweredBy.tsx +17 -0
  167. package/shell/footer/RevealLinks.tsx +43 -0
  168. package/shell/footer/RightLinks.tsx +11 -0
  169. package/shell/footer/app.tsx +73 -0
  170. package/shell/footer/data/api.ts +48 -0
  171. package/shell/footer/index.ts +2 -0
  172. package/shell/header/AuthenticatedMenu.tsx +32 -0
  173. package/shell/header/Header.tsx +17 -0
  174. package/shell/header/anonymous-menu/AnonymousMenu.tsx +14 -0
  175. package/shell/header/anonymous-menu/LoginButton.tsx +14 -0
  176. package/shell/header/anonymous-menu/RegisterButton.tsx +15 -0
  177. package/shell/header/app.tsx +142 -0
  178. package/shell/header/desktop/DesktopLayout.tsx +22 -0
  179. package/shell/header/desktop/PrimaryNavLinks.tsx +10 -0
  180. package/shell/header/desktop/SecondaryNavLinks.tsx +10 -0
  181. package/shell/header/index.ts +2 -0
  182. package/shell/header/mobile/MobileLayout.tsx +47 -0
  183. package/shell/header/mobile/MobileNavLinks.tsx +10 -0
  184. package/shell/i18n/index.ts +25 -0
  185. package/shell/index.ts +7 -0
  186. package/shell/jest.config.js +30 -0
  187. package/shell/menus/LinkMenuItem.tsx +64 -0
  188. package/shell/menus/NavDropdownMenuSlot.tsx +29 -0
  189. package/shell/menus/ProfileLinkMenuItem.tsx +33 -0
  190. package/shell/menus/data/utils.ts +19 -0
  191. package/shell/public/index.html +10 -0
  192. package/shell/router/createRouter.ts +17 -0
  193. package/shell/router/getAppRoutes.ts +21 -0
  194. package/shell/setupTest.js +48 -0
  195. package/shell/site.config.dev.tsx +49 -0
  196. package/shell/site.tsx +41 -0
  197. package/test-site/app.d.ts +15 -0
  198. package/test-site/dist/176.436443549ebb858db483.js +2 -0
  199. package/test-site/dist/176.436443549ebb858db483.js.map +1 -0
  200. package/test-site/dist/362.536eff787d2380fe246c.js +2 -0
  201. package/test-site/dist/362.536eff787d2380fe246c.js.map +1 -0
  202. package/test-site/dist/653.486966b108d224551296.js +2 -0
  203. package/test-site/dist/653.486966b108d224551296.js.map +1 -0
  204. package/test-site/dist/74e025d3fe9a7b7f8503054e2563b353.jpg +0 -0
  205. package/test-site/dist/806.323cf6496ad0a7fe73a7.js +3 -0
  206. package/test-site/dist/806.323cf6496ad0a7fe73a7.js.LICENSE.txt +106 -0
  207. package/test-site/dist/806.323cf6496ad0a7fe73a7.js.map +1 -0
  208. package/test-site/dist/95ec738c0b7faac5b5c9126794446bbd.svg +4 -0
  209. package/test-site/dist/app.612058b36c74787759ac.css +61 -0
  210. package/test-site/dist/app.612058b36c74787759ac.css.map +1 -0
  211. package/test-site/dist/app.612058b36c74787759ac.js +2 -0
  212. package/test-site/dist/app.612058b36c74787759ac.js.map +1 -0
  213. package/test-site/dist/cb28cdb1468c915e27e5cec9af64f22f.svg +1 -0
  214. package/test-site/dist/index.html +1 -0
  215. package/test-site/dist/report.html +39 -0
  216. package/test-site/dist/runtime.c7aeaf7b967496cb076f.js +2 -0
  217. package/test-site/dist/runtime.c7aeaf7b967496cb076f.js.map +1 -0
  218. package/test-site/eslint.config.js +12 -0
  219. package/test-site/package-lock.json +19226 -0
  220. package/test-site/package.json +29 -0
  221. package/test-site/public/index.html +10 -0
  222. package/test-site/site.config.build.tsx +27 -0
  223. package/test-site/site.config.dev.tsx +27 -0
  224. package/test-site/src/authenticated-page/AuthenticatedPage.tsx +18 -0
  225. package/test-site/src/authenticated-page/i18n/index.ts +27 -0
  226. package/test-site/src/authenticated-page/index.tsx +28 -0
  227. package/test-site/src/example-page/ExamplePage.tsx +79 -0
  228. package/test-site/src/example-page/Image.tsx +11 -0
  229. package/test-site/src/example-page/ParagonPreview.jsx +66 -0
  230. package/test-site/src/example-page/apple.jpg +0 -0
  231. package/test-site/src/example-page/apple.svg +1 -0
  232. package/test-site/src/example-page/index.ts +16 -0
  233. package/test-site/src/i18n/README.md +3 -0
  234. package/test-site/src/i18n/messages/frontend-app-sample/ar.json +4 -0
  235. package/test-site/src/i18n/messages/frontend-app-sample/eo.json +1 -0
  236. package/test-site/src/i18n/messages/frontend-app-sample/es_419.json +4 -0
  237. package/test-site/src/i18n/messages/frontend-component-emptylangs/ar.json +1 -0
  238. package/test-site/src/i18n/messages/frontend-component-singlelang/ar.json +3 -0
  239. package/test-site/src/iframe-widget/IframeWidget.tsx +14 -0
  240. package/test-site/src/iframe-widget/index.ts +16 -0
  241. package/test-site/src/index.tsx +3 -0
  242. package/test-site/src/messages.js +11 -0
  243. package/test-site/src/site.scss +11 -0
  244. package/test-site/tsconfig.json +14 -0
  245. package/tools/babel/babel.config.js +27 -0
  246. package/tools/babel.config.js +3 -0
  247. package/tools/cli/README.md +29 -0
  248. package/tools/cli/commands/pack.ts +9 -0
  249. package/tools/cli/commands/release.ts +27 -0
  250. package/tools/cli/commands/serve.ts +43 -0
  251. package/tools/cli/intl-imports.ts +274 -0
  252. package/tools/cli/openedx.ts +101 -0
  253. package/tools/cli/transifex-utils.ts +75 -0
  254. package/tools/cli/utils/ensureConfigFilenameOption.ts +40 -0
  255. package/tools/cli/utils/formatter.ts +10 -0
  256. package/tools/cli/utils/getResolvedConfigPath.ts +23 -0
  257. package/tools/cli/utils/prettyPrintTitle.ts +15 -0
  258. package/tools/cli/utils/printUsage.ts +53 -0
  259. package/tools/config-helpers/createConfig.ts +8 -0
  260. package/tools/config-helpers/createLintConfig.ts +14 -0
  261. package/tools/config-helpers/getBaseConfig.ts +11 -0
  262. package/tools/defaultConfigPaths.ts +30 -0
  263. package/tools/dist/babel/babel.config.js +28 -0
  264. package/tools/dist/cli/commands/pack.js +14 -0
  265. package/tools/dist/cli/commands/release.js +28 -0
  266. package/tools/dist/cli/commands/serve.js +44 -0
  267. package/tools/dist/cli/intl-imports.js +233 -0
  268. package/tools/dist/cli/openedx.js +100 -0
  269. package/tools/dist/cli/transifex-utils.js +68 -0
  270. package/tools/dist/cli/utils/ensureConfigFilenameOption.js +42 -0
  271. package/tools/dist/cli/utils/formatter.js +10 -0
  272. package/tools/dist/cli/utils/getResolvedConfigPath.js +28 -0
  273. package/tools/dist/cli/utils/prettyPrintTitle.js +17 -0
  274. package/tools/dist/cli/utils/printUsage.js +48 -0
  275. package/tools/dist/config-helpers/createConfig.js +13 -0
  276. package/tools/dist/config-helpers/createLintConfig.js +16 -0
  277. package/tools/dist/config-helpers/getBaseConfig.js +12 -0
  278. package/tools/dist/defaultConfigPaths.js +35 -0
  279. package/tools/dist/eslint/base.eslint.config.js +113 -0
  280. package/tools/dist/eslint.config.js +11 -0
  281. package/tools/dist/index.js +12 -0
  282. package/tools/dist/jest/jest.config.js +30 -0
  283. package/tools/dist/jest.config.js +20 -0
  284. package/tools/dist/types.js +25 -0
  285. package/tools/dist/typescript/tsconfig.json +32 -0
  286. package/tools/dist/webpack/common-config/all/getCodeRules.js +52 -0
  287. package/tools/dist/webpack/common-config/all/getFileLoaderRules.js +26 -0
  288. package/tools/dist/webpack/common-config/all/getIgnoreWarnings.js +14 -0
  289. package/tools/dist/webpack/common-config/all/getImageMinimizer.js +25 -0
  290. package/tools/dist/webpack/common-config/all/getStylesheetRule.js +112 -0
  291. package/tools/dist/webpack/common-config/dev/getDevServer.js +38 -0
  292. package/tools/dist/webpack/common-config/index.js +18 -0
  293. package/tools/dist/webpack/common-config/site/getHtmlWebpackPlugin.js +16 -0
  294. package/tools/dist/webpack/plugins/html-webpack-new-relic-plugin/HtmlWebpackNewRelicPlugin.js +91 -0
  295. package/tools/dist/webpack/plugins/html-webpack-new-relic-plugin/index.js +7 -0
  296. package/tools/dist/webpack/plugins/html-webpack-new-relic-plugin/test/fixtures/entry.js +3 -0
  297. package/tools/dist/webpack/plugins/paragon-webpack-plugin/ParagonWebpackPlugin.js +108 -0
  298. package/tools/dist/webpack/plugins/paragon-webpack-plugin/index.js +7 -0
  299. package/tools/dist/webpack/plugins/paragon-webpack-plugin/utils/assetUtils.js +64 -0
  300. package/tools/dist/webpack/plugins/paragon-webpack-plugin/utils/htmlUtils.js +53 -0
  301. package/tools/dist/webpack/plugins/paragon-webpack-plugin/utils/index.js +9 -0
  302. package/tools/dist/webpack/plugins/paragon-webpack-plugin/utils/paragonStylesheetUtils.js +114 -0
  303. package/tools/dist/webpack/plugins/paragon-webpack-plugin/utils/scriptUtils.js +146 -0
  304. package/tools/dist/webpack/plugins/paragon-webpack-plugin/utils/stylesheetUtils.js +126 -0
  305. package/tools/dist/webpack/plugins/paragon-webpack-plugin/utils/tagUtils.js +57 -0
  306. package/tools/dist/webpack/types.js +2 -0
  307. package/tools/dist/webpack/utils/getLocalAliases.js +65 -0
  308. package/tools/dist/webpack/utils/getPublicPath.js +6 -0
  309. package/tools/dist/webpack/utils/getResolvedSiteConfigPath.js +32 -0
  310. package/tools/dist/webpack/utils/paragonUtils.js +138 -0
  311. package/tools/dist/webpack/webpack.config.build.js +80 -0
  312. package/tools/dist/webpack/webpack.config.dev.js +76 -0
  313. package/tools/dist/webpack/webpack.config.dev.shell.js +110 -0
  314. package/tools/eslint/base.eslint.config.js +124 -0
  315. package/tools/eslint/modules.d.ts +5 -0
  316. package/tools/eslint.config.js +15 -0
  317. package/tools/index.ts +3 -0
  318. package/tools/jest/jest.config.js +30 -0
  319. package/tools/jest.config.js +19 -0
  320. package/tools/tsconfig.json +24 -0
  321. package/tools/types.ts +21 -0
  322. package/tools/typescript/tsconfig.json +32 -0
  323. package/tools/webpack/common-config/README.md +15 -0
  324. package/tools/webpack/common-config/all/getCodeRules.ts +51 -0
  325. package/tools/webpack/common-config/all/getFileLoaderRules.ts +23 -0
  326. package/tools/webpack/common-config/all/getIgnoreWarnings.ts +13 -0
  327. package/tools/webpack/common-config/all/getImageMinimizer.ts +26 -0
  328. package/tools/webpack/common-config/all/getStylesheetRule.ts +111 -0
  329. package/tools/webpack/common-config/dev/getDevServer.ts +35 -0
  330. package/tools/webpack/common-config/index.ts +6 -0
  331. package/tools/webpack/common-config/site/getHtmlWebpackPlugin.ts +11 -0
  332. package/tools/webpack/modules.d.ts +6 -0
  333. package/tools/webpack/plugins/html-webpack-new-relic-plugin/HtmlWebpackNewRelicPlugin.ts +102 -0
  334. package/tools/webpack/plugins/html-webpack-new-relic-plugin/LICENSE +21 -0
  335. package/tools/webpack/plugins/html-webpack-new-relic-plugin/README.md +7 -0
  336. package/tools/webpack/plugins/html-webpack-new-relic-plugin/index.js +3 -0
  337. package/tools/webpack/plugins/html-webpack-new-relic-plugin/test/fixtures/entry.js +1 -0
  338. package/tools/webpack/plugins/paragon-webpack-plugin/ParagonWebpackPlugin.ts +134 -0
  339. package/tools/webpack/plugins/paragon-webpack-plugin/index.ts +3 -0
  340. package/tools/webpack/plugins/paragon-webpack-plugin/utils/assetUtils.ts +71 -0
  341. package/tools/webpack/plugins/paragon-webpack-plugin/utils/htmlUtils.ts +72 -0
  342. package/tools/webpack/plugins/paragon-webpack-plugin/utils/index.ts +6 -0
  343. package/tools/webpack/plugins/paragon-webpack-plugin/utils/paragonStylesheetUtils.ts +131 -0
  344. package/tools/webpack/plugins/paragon-webpack-plugin/utils/scriptUtils.ts +144 -0
  345. package/tools/webpack/plugins/paragon-webpack-plugin/utils/stylesheetUtils.ts +106 -0
  346. package/tools/webpack/plugins/paragon-webpack-plugin/utils/tagUtils.ts +54 -0
  347. package/tools/webpack/types.ts +69 -0
  348. package/tools/webpack/utils/getLocalAliases.ts +65 -0
  349. package/tools/webpack/utils/getPublicPath.ts +3 -0
  350. package/tools/webpack/utils/getResolvedSiteConfigPath.ts +28 -0
  351. package/tools/webpack/utils/paragonUtils.ts +152 -0
  352. package/tools/webpack/webpack.config.build.ts +93 -0
  353. package/tools/webpack/webpack.config.dev.shell.ts +122 -0
  354. package/tools/webpack/webpack.config.dev.ts +90 -0
  355. package/tsconfig.json +23 -0
  356. package/types.ts +99 -0
@@ -0,0 +1,363 @@
1
+ import axios from 'axios';
2
+ import PropTypes from 'prop-types';
3
+ import { camelCaseObject } from '../utils';
4
+ import AxiosCsrfTokenService from './AxiosCsrfTokenService';
5
+ import AxiosJwtTokenService from './AxiosJwtTokenService';
6
+ import createCsrfTokenProviderInterceptor from './interceptors/createCsrfTokenProviderInterceptor';
7
+ import createJwtTokenProviderInterceptor from './interceptors/createJwtTokenProviderInterceptor';
8
+ import createProcessAxiosRequestErrorInterceptor from './interceptors/createProcessAxiosRequestErrorInterceptor';
9
+ import configureCache from './LocalForageCache';
10
+ import { logFrontendAuthError } from './utils';
11
+
12
+ const optionsPropTypes = {
13
+ config: PropTypes.shape({
14
+ baseUrl: PropTypes.string.isRequired,
15
+ lmsBaseUrl: PropTypes.string.isRequired,
16
+ loginUrl: PropTypes.string.isRequired,
17
+ logoutUrl: PropTypes.string.isRequired,
18
+ refreshAccessTokenApiPath: PropTypes.string.isRequired,
19
+ accessTokenCookieName: PropTypes.string.isRequired,
20
+ csrfTokenApiPath: PropTypes.string.isRequired,
21
+ }).isRequired,
22
+ loggingService: PropTypes.shape({
23
+ logError: PropTypes.func.isRequired,
24
+ logInfo: PropTypes.func.isRequired,
25
+ }).isRequired,
26
+ };
27
+
28
+ /**
29
+ * @implements {AuthService}
30
+ * @memberof module:Auth
31
+ */
32
+ class AxiosJwtAuthService {
33
+ /**
34
+ * @param {Object} options
35
+ * @param {Object} options.config
36
+ * @param {string} options.config.baseUrl
37
+ * @param {string} options.config.lmsBaseUrl
38
+ * @param {string} options.config.loginUrl
39
+ * @param {string} options.config.logoutUrl
40
+ * @param {string} options.config.refreshAccessTokenApiPath
41
+ * @param {string} options.config.accessTokenCookieName
42
+ * @param {string} options.config.csrfTokenApiPath
43
+ * @param {Object} options.loggingService requires logError and logInfo methods
44
+ */
45
+ constructor(options) {
46
+ this.authenticatedHttpClient = null;
47
+ this.httpClient = null;
48
+ this.cachedAuthenticatedHttpClient = null;
49
+ this.cachedHttpClient = null;
50
+ this.authenticatedUser = null;
51
+
52
+ PropTypes.checkPropTypes(optionsPropTypes, options, 'options', 'AuthService');
53
+
54
+ this.config = options.config;
55
+ this.loggingService = options.loggingService;
56
+ this.jwtTokenService = new AxiosJwtTokenService(
57
+ this.loggingService,
58
+ this.config.accessTokenCookieName,
59
+ this.config.lmsBaseUrl,
60
+ this.config.refreshAccessTokenApiPath,
61
+ );
62
+ this.csrfTokenService = new AxiosCsrfTokenService(this.config.csrfTokenApiPath);
63
+ this.authenticatedHttpClient = this.addAuthenticationToHttpClient(axios.create());
64
+ this.httpClient = axios.create();
65
+ configureCache()
66
+ .then((cachedAxiosClient) => {
67
+ this.cachedAuthenticatedHttpClient = this.addAuthenticationToHttpClient(cachedAxiosClient);
68
+ this.cachedHttpClient = cachedAxiosClient;
69
+ })
70
+ .catch((e) => {
71
+ // fallback to non-cached HTTP clients and log error
72
+ this.cachedAuthenticatedHttpClient = this.authenticatedHttpClient;
73
+ this.cachedHttpClient = this.httpClient;
74
+ logFrontendAuthError(this.loggingService, `configureCache failed with error: ${e.message}`);
75
+ }).finally(() => {
76
+ this.middleware = options.middleware;
77
+ this.applyMiddleware(options.middleware);
78
+ });
79
+ }
80
+
81
+ /**
82
+ * Applies middleware to the axios instances in this service.
83
+ *
84
+ * @param {Array} middleware Middleware to apply.
85
+ */
86
+ applyMiddleware(middleware = []) {
87
+ const clients = [
88
+ this.authenticatedHttpClient, this.httpClient,
89
+ this.cachedAuthenticatedHttpClient, this.cachedHttpClient,
90
+ ];
91
+ try {
92
+ (middleware).forEach((middlewareFn) => {
93
+ clients.forEach((client) => client && middlewareFn(client));
94
+ });
95
+ } catch (error) {
96
+ logFrontendAuthError(this.loggingService, error);
97
+ throw error;
98
+ }
99
+ }
100
+
101
+ /**
102
+ * Gets the authenticated HTTP client for the service. This is an axios instance.
103
+ *
104
+ * @param {Object} [options] Optional options for how the HTTP client should be configured.
105
+ * @param {boolean} [options.useCache] Whether to use front end caching for all requests made
106
+ * with the returned client.
107
+ *
108
+ * @returns {HttpClient} A configured axios http client which can be used for authenticated
109
+ * requests.
110
+ */
111
+ getAuthenticatedHttpClient(options = {}) {
112
+ if (options.useCache) {
113
+ return this.cachedAuthenticatedHttpClient;
114
+ }
115
+
116
+ return this.authenticatedHttpClient;
117
+ }
118
+
119
+ /**
120
+ * Gets the unauthenticated HTTP client for the service. This is an axios instance.
121
+ *
122
+ * @param {Object} [options] Optional options for how the HTTP client should be configured.
123
+ * @param {boolean} [options.useCache] Whether to use front end caching for all requests made
124
+ * with the returned client.
125
+ * @returns {HttpClient} A configured axios http client.
126
+ */
127
+ getHttpClient(options = {}) {
128
+ if (options.useCache) {
129
+ return this.cachedHttpClient;
130
+ }
131
+
132
+ return this.httpClient;
133
+ }
134
+
135
+ /**
136
+ * Used primarily for testing.
137
+ *
138
+ * @ignore
139
+ */
140
+ getJwtTokenService() {
141
+ return this.jwtTokenService;
142
+ }
143
+
144
+ /**
145
+ * Used primarily for testing.
146
+ *
147
+ * @ignore
148
+ */
149
+ getCsrfTokenService() {
150
+ return this.csrfTokenService;
151
+ }
152
+
153
+ /**
154
+ * Builds a URL to the login page with a post-login redirect URL attached as a query parameter.
155
+ *
156
+ * ```
157
+ * const url = getLoginRedirectUrl('http://localhost/mypage');
158
+ * console.log(url); // http://localhost/login?next=http%3A%2F%2Flocalhost%2Fmypage
159
+ * ```
160
+ *
161
+ * @param {string} redirectUrl The URL the user should be redirected to after logging in.
162
+ */
163
+ getLoginRedirectUrl(redirectUrl = this.config.baseUrl) {
164
+ return `${this.config.loginUrl}?next=${encodeURIComponent(redirectUrl)}`;
165
+ }
166
+
167
+ /**
168
+ * Redirects the user to the login page.
169
+ *
170
+ * @param {string} redirectUrl The URL the user should be redirected to after logging in.
171
+ */
172
+ redirectToLogin(redirectUrl = this.config.baseUrl) {
173
+ global.location.assign(this.getLoginRedirectUrl(redirectUrl));
174
+ }
175
+
176
+ /**
177
+ * Builds a URL to the logout page with a post-logout redirect URL attached as a query parameter.
178
+ *
179
+ * ```
180
+ * const url = getLogoutRedirectUrl('http://localhost/mypage');
181
+ * console.log(url); // http://localhost/logout?next=http%3A%2F%2Flocalhost%2Fmypage
182
+ * ```
183
+ *
184
+ * @param {string} redirectUrl The URL the user should be redirected to after logging out.
185
+ */
186
+ getLogoutRedirectUrl(redirectUrl = this.config.baseUrl) {
187
+ return `${this.config.logoutUrl}?redirect_url=${encodeURIComponent(redirectUrl)}`;
188
+ }
189
+
190
+ /**
191
+ * Redirects the user to the logout page.
192
+ *
193
+ * @param {string} redirectUrl The URL the user should be redirected to after logging out.
194
+ */
195
+ redirectToLogout(redirectUrl = this.config.baseUrl) {
196
+ global.location.assign(this.getLogoutRedirectUrl(redirectUrl));
197
+ }
198
+
199
+ /**
200
+ * If it exists, returns the user data representing the currently authenticated user. If the
201
+ * user is anonymous, returns null.
202
+ *
203
+ * @returns {UserData|null}
204
+ */
205
+ getAuthenticatedUser() {
206
+ return this.authenticatedUser;
207
+ }
208
+
209
+ /**
210
+ * Sets the authenticated user to the provided value.
211
+ *
212
+ * @param {UserData} authUser
213
+ */
214
+ setAuthenticatedUser(authUser) {
215
+ this.authenticatedUser = authUser;
216
+ }
217
+
218
+ /**
219
+ * Reads the authenticated user's access token. Resolves to null if the user is
220
+ * unauthenticated.
221
+ *
222
+ * @returns {Promise<UserData>|Promise<null>} Resolves to the user's access token if they are
223
+ * logged in.
224
+ */
225
+ async fetchAuthenticatedUser(options = {}) {
226
+ const decodedAccessToken = await this.jwtTokenService.getJwtToken(options.forceRefresh || false);
227
+
228
+ if (decodedAccessToken !== null) {
229
+ this.setAuthenticatedUser({
230
+ email: decodedAccessToken.email,
231
+ userId: decodedAccessToken.user_id,
232
+ username: decodedAccessToken.preferred_username,
233
+ roles: decodedAccessToken.roles || [],
234
+ administrator: decodedAccessToken.administrator,
235
+ name: decodedAccessToken.name,
236
+ });
237
+ // Sets userId as a custom attribute that will be included with all subsequent log messages.
238
+ // Very helpful for debugging.
239
+ this.loggingService.setCustomAttribute('userId', decodedAccessToken.user_id);
240
+ } else {
241
+ this.setAuthenticatedUser(null);
242
+ // Intentionally not setting `userId` in the logging service here because it would be useful
243
+ // to know the previously logged in user for debugging refresh issues.
244
+ }
245
+
246
+ return this.getAuthenticatedUser();
247
+ }
248
+
249
+ /**
250
+ * Ensures a user is authenticated. It will redirect to login when not
251
+ * authenticated.
252
+ *
253
+ * @param {string} [redirectUrl=config.baseUrl] to return user after login when not
254
+ * authenticated.
255
+ * @returns {Promise<UserData>}
256
+ */
257
+ async ensureAuthenticatedUser(redirectUrl = this.config.baseUrl) {
258
+ await this.fetchAuthenticatedUser();
259
+
260
+ if (this.getAuthenticatedUser() === null) {
261
+ const isRedirectFromLoginPage = global.document.referrer?.startsWith(this.config.loginUrl);
262
+
263
+ if (isRedirectFromLoginPage) {
264
+ const redirectLoopError = new Error('Redirect from login page. Rejecting to avoid infinite redirect loop.');
265
+ logFrontendAuthError(this.loggingService, redirectLoopError);
266
+ throw redirectLoopError;
267
+ }
268
+
269
+ // The user is not authenticated, send them to the login page.
270
+ this.redirectToLogin(redirectUrl);
271
+
272
+ const unauthorizedError = new Error('Failed to ensure the user is authenticated');
273
+ unauthorizedError.isRedirecting = true;
274
+ throw unauthorizedError;
275
+ }
276
+
277
+ return this.getAuthenticatedUser();
278
+ }
279
+
280
+ /**
281
+ * Fetches additional user account information for the authenticated user and merges it into the
282
+ * existing authenticatedUser object, available via getAuthenticatedUser().
283
+ *
284
+ * ```
285
+ * console.log(authenticatedUser); // Will be sparse and only contain basic information.
286
+ * await hydrateAuthenticatedUser()
287
+ * const authenticatedUser = getAuthenticatedUser();
288
+ * console.log(authenticatedUser); // Will contain additional user information
289
+ * ```
290
+ *
291
+ * @returns {Promise<null>}
292
+ */
293
+ async hydrateAuthenticatedUser() {
294
+ const user = this.getAuthenticatedUser();
295
+ if (user !== null) {
296
+ const response = await this.authenticatedHttpClient
297
+ .get(`${this.config.lmsBaseUrl}/api/user/v1/accounts/${user.username}`);
298
+ this.setAuthenticatedUser({ ...user, ...camelCaseObject(response.data) });
299
+ }
300
+ }
301
+
302
+ /**
303
+ * Adds authentication defaults and interceptors to an HTTP client instance.
304
+ *
305
+ * @param {HttpClient} newHttpClient
306
+ * @param {Object} config
307
+ * @param {string} [config.refreshAccessTokenApiPath]
308
+ * @param {string} [config.accessTokenCookieName]
309
+ * @param {string} [config.csrfTokenApiPath]
310
+ * @returns {HttpClient} A configured Axios HTTP client.
311
+ */
312
+ addAuthenticationToHttpClient(newHttpClient) {
313
+ const httpClient = Object.create(newHttpClient);
314
+ // Set withCredentials to true. Enables cross-site Access-Control requests
315
+ // to be made using cookies, authorization headers or TLS client
316
+ // certificates. More on MDN:
317
+ // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials
318
+ httpClient.defaults.withCredentials = true;
319
+
320
+ // Axios interceptors
321
+
322
+ // The JWT access token interceptor attempts to refresh the user's jwt token
323
+ // before any request unless the isPublic flag is set on the request config.
324
+ const refreshAccessTokenInterceptor = createJwtTokenProviderInterceptor({
325
+ jwtTokenService: this.jwtTokenService,
326
+ shouldSkip: axiosRequestConfig => axiosRequestConfig.isPublic,
327
+ });
328
+ // The CSRF token intercepter fetches and caches a csrf token for any post,
329
+ // put, patch, or delete request. That token is then added to the request
330
+ // headers.
331
+ const attachCsrfTokenInterceptor = createCsrfTokenProviderInterceptor({
332
+ csrfTokenService: this.csrfTokenService,
333
+ csrfTokenApiPath: this.config.csrfTokenApiPath,
334
+ shouldSkip: (axiosRequestConfig) => {
335
+ const { method, isCsrfExempt } = axiosRequestConfig;
336
+ const CSRF_PROTECTED_METHODS = ['post', 'put', 'patch', 'delete'];
337
+ return isCsrfExempt || !CSRF_PROTECTED_METHODS.includes(method);
338
+ },
339
+ });
340
+
341
+ const processAxiosRequestErrorInterceptor = createProcessAxiosRequestErrorInterceptor({
342
+ loggingService: this.loggingService,
343
+ });
344
+
345
+ // Request interceptors: Axios runs the interceptors in reverse order from
346
+ // how they are listed. After fetching csrf tokens no longer require jwt
347
+ // authentication, it won't matter which happens first. This change is
348
+ // coming soon in edx-platform. Nov. 2019
349
+ httpClient.interceptors.request.use(attachCsrfTokenInterceptor);
350
+ httpClient.interceptors.request.use(refreshAccessTokenInterceptor);
351
+
352
+ // Response interceptor: moves axios response error data into the error
353
+ // object at error.customAttributes
354
+ httpClient.interceptors.response.use(
355
+ response => response,
356
+ processAxiosRequestErrorInterceptor,
357
+ );
358
+
359
+ return httpClient;
360
+ }
361
+ }
362
+
363
+ export default AxiosJwtAuthService;
@@ -0,0 +1,134 @@
1
+ import axios from 'axios';
2
+ import jwtDecode from 'jwt-decode';
3
+ import Cookies from 'universal-cookie';
4
+ import createRetryInterceptor from './interceptors/createRetryInterceptor';
5
+ import { logFrontendAuthError, processAxiosErrorAndThrow } from './utils';
6
+
7
+ export default class AxiosJwtTokenService {
8
+ static isTokenExpired(token) {
9
+ return !token || token.exp < Date.now() / 1000;
10
+ }
11
+
12
+ constructor(loggingService, tokenCookieName, tokenRefreshBaseUrl, tokenRefreshPath) {
13
+ this.loggingService = loggingService;
14
+ this.tokenCookieName = tokenCookieName;
15
+ this.tokenRefreshBaseUrl = tokenRefreshBaseUrl;
16
+ this.tokenRefreshPath = tokenRefreshPath;
17
+
18
+ this.httpClient = axios.create();
19
+ // Set withCredentials to true. Enables cross-site Access-Control requests
20
+ // to be made using cookies, authorization headers or TLS client
21
+ // certificates. More on MDN:
22
+ // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials
23
+ this.httpClient.defaults.withCredentials = true;
24
+ // Add retries to this axios instance
25
+ this.httpClient.interceptors.response.use(
26
+ response => response,
27
+ createRetryInterceptor({ httpClient: this.httpClient }),
28
+ );
29
+
30
+ this.cookies = new Cookies();
31
+ this.refreshRequestPromises = {};
32
+ }
33
+
34
+ getHttpClient() {
35
+ return this.httpClient;
36
+ }
37
+
38
+ decodeJwtCookie() {
39
+ const cookieValue = this.cookies.get(this.tokenCookieName);
40
+
41
+ if (cookieValue) {
42
+ try {
43
+ return jwtDecode(cookieValue);
44
+ } catch (e) {
45
+ const error = Object.create(e);
46
+ error.message = 'Error decoding JWT token';
47
+ error.customAttributes = { cookieValue };
48
+ throw error;
49
+ }
50
+ }
51
+
52
+ return null;
53
+ }
54
+
55
+ refresh() {
56
+ let responseServerEpochSeconds = 0;
57
+
58
+ if (this.refreshRequestPromises[this.tokenCookieName] === undefined) {
59
+ const makeRefreshRequest = async () => {
60
+ let axiosResponse;
61
+ try {
62
+ try {
63
+ axiosResponse = await this.httpClient.post(`${this.tokenRefreshBaseUrl}${this.tokenRefreshPath}`);
64
+ if (axiosResponse.data?.response_epoch_seconds) {
65
+ responseServerEpochSeconds = axiosResponse.data.response_epoch_seconds;
66
+ }
67
+ } catch (error) {
68
+ processAxiosErrorAndThrow(error);
69
+ }
70
+ } catch (error) {
71
+ const userIsUnauthenticated = error.response && error.response.status === 401;
72
+ if (userIsUnauthenticated) {
73
+ // Clean up the cookie if it exists to eliminate any situation
74
+ // where the cookie is not expired but the jwt is expired.
75
+ this.cookies.remove(this.tokenCookieName);
76
+ const decodedJwtToken = null;
77
+ return decodedJwtToken;
78
+ }
79
+
80
+ // TODO: Network timeouts and other problems will end up in
81
+ // this block of code. We could add logic for retrying token
82
+ // refreshes if we wanted to.
83
+ throw error;
84
+ }
85
+
86
+ const browserEpochSeconds = Date.now() / 1000;
87
+ const browserDriftSeconds = responseServerEpochSeconds > 0
88
+ ? Math.abs(browserEpochSeconds - responseServerEpochSeconds)
89
+ : null;
90
+
91
+ const decodedJwtToken = this.decodeJwtCookie();
92
+
93
+ if (!decodedJwtToken) {
94
+ // This is an unexpected case. The refresh endpoint should set the
95
+ // cookie that is needed.
96
+ // For more details, see:
97
+ // docs/decisions/0005-token-null-after-successful-refresh.rst
98
+ const error = new Error('Access token is still null after successful refresh.');
99
+ error.customAttributes = { axiosResponse, browserDriftSeconds, browserEpochSeconds };
100
+ throw error;
101
+ }
102
+
103
+ return decodedJwtToken;
104
+ };
105
+
106
+ this.refreshRequestPromises[this.tokenCookieName] = makeRefreshRequest().finally(() => {
107
+ delete this.refreshRequestPromises[this.tokenCookieName];
108
+ });
109
+ }
110
+
111
+ return this.refreshRequestPromises[this.tokenCookieName];
112
+ }
113
+
114
+ async getJwtToken(forceRefresh = false) {
115
+ try {
116
+ const decodedJwtToken = this.decodeJwtCookie(this.tokenCookieName);
117
+ if (!AxiosJwtTokenService.isTokenExpired(decodedJwtToken) && !forceRefresh) {
118
+ return decodedJwtToken;
119
+ }
120
+ } catch (e) {
121
+ // Log unexpected error and continue with attempt to refresh it.
122
+ // TODO: Fix these. They're still using loggingService as a singleton.
123
+ logFrontendAuthError(this.loggingService, e);
124
+ }
125
+
126
+ try {
127
+ return await this.refresh();
128
+ } catch (e) {
129
+ // TODO: Fix these. They're still using loggingService as a singleton.
130
+ logFrontendAuthError(this.loggingService, e);
131
+ throw e;
132
+ }
133
+ }
134
+ }
@@ -0,0 +1,76 @@
1
+ import axios from 'axios';
2
+ import {
3
+ buildStorage,
4
+ defaultHeaderInterpreter,
5
+ defaultKeyGenerator,
6
+ setupCache,
7
+ } from 'axios-cache-interceptor';
8
+ import localforage from 'localforage';
9
+ import memoryDriver from 'localforage-memoryStorageDriver';
10
+
11
+ /**
12
+ * Async function to configure localforage and setup the cache
13
+ *
14
+ * @returns {Promise} A promise that, when resolved, returns an axios instance configured to
15
+ * use localforage as a cache.
16
+ */
17
+ export default async function configureCache() {
18
+ // Register the imported `memoryDriver` to `localforage`
19
+ await localforage.defineDriver(memoryDriver);
20
+
21
+ // Create `localforage` instance
22
+ const forageStore = localforage.createInstance({
23
+ // List of drivers used
24
+ driver: [
25
+ localforage.INDEXEDDB,
26
+ localforage.LOCALSTORAGE,
27
+ memoryDriver._driver,
28
+ ],
29
+ name: 'edx-cache',
30
+ });
31
+
32
+ const forageStoreAdapter = buildStorage({
33
+ async find(key) {
34
+ const result = await forageStore.getItem(`axios-cache:${key}`);
35
+ return JSON.parse(result);
36
+ },
37
+
38
+ async set(key, value) {
39
+ await forageStore.setItem(`axios-cache:${key}`, JSON.stringify(value));
40
+ },
41
+
42
+ async remove(key) {
43
+ await forageStore.removeItem(`axios-cache:${key}`);
44
+ },
45
+ });
46
+
47
+ // only GET methods are cached by default
48
+ return setupCache(
49
+ // axios instance
50
+ axios.create(),
51
+ {
52
+ ttl: 5 * 60 * 1000, // default maxAge of 5 minutes
53
+ // The storage to save the cache data. There are more available by default.
54
+ //
55
+ // https://axios-cache-interceptor.js.org/#/pages/storages
56
+ storage: forageStoreAdapter,
57
+
58
+ // The mechanism to generate a unique key for each request.
59
+ //
60
+ // https://axios-cache-interceptor.js.org/#/pages/request-id
61
+ generateKey: defaultKeyGenerator,
62
+
63
+ // The mechanism to interpret headers (when cache.interpretHeader is true).
64
+ //
65
+ // https://axios-cache-interceptor.js.org/#/pages/global-configuration?id=headerinterpreter
66
+ headerInterpreter: defaultHeaderInterpreter,
67
+
68
+ // The function that will receive debug information.
69
+ // NOTE: For this to work, you need to enable development mode.
70
+ //
71
+ // https://axios-cache-interceptor.js.org/#/pages/development-mode
72
+ // https://axios-cache-interceptor.js.org/#/pages/global-configuration?id=debug
73
+ debug: console.log,
74
+ },
75
+ );
76
+ }