@edx/frontend-platform 4.6.0 → 4.6.2
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.
- package/.env.development +30 -0
- package/.env.test +30 -0
- package/.eslintignore +6 -0
- package/.eslintrc.js +28 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +13 -0
- package/.github/workflows/add-depr-ticket-to-depr-board.yml +19 -0
- package/.github/workflows/add-remove-label-on-comment.yml +20 -0
- package/.github/workflows/ci.yml +42 -0
- package/.github/workflows/commitlint.yml +10 -0
- package/.github/workflows/lockfileversion-check.yml +13 -0
- package/.github/workflows/manual-publish.yml +43 -0
- package/.github/workflows/npm-deprecate.yml +22 -0
- package/.github/workflows/release.yml +45 -0
- package/.github/workflows/self-assign-issue.yml +12 -0
- package/.github/workflows/update-browserslist-db.yml +12 -0
- package/.nvmrc +1 -0
- package/.releaserc +32 -0
- package/catalog-info.yaml +21 -0
- package/dist/LICENSE +661 -0
- package/dist/README.md +155 -0
- package/dist/package.json +86 -0
- package/docs/addTagsPlugin.js +10 -0
- package/docs/auth-API.md +114 -0
- package/docs/decisions/0001-record-architecture-decisions.rst +32 -0
- package/docs/decisions/0002-frontend-base-design-goals.rst +222 -0
- package/docs/decisions/0003-consolidation-into-frontend-platform.rst +71 -0
- package/docs/decisions/0004-axios-caching-implementation.rst +88 -0
- package/docs/decisions/0005-token-null-after-successful-refresh.rst +69 -0
- package/docs/decisions/0006-middleware-support-for-http-clients.rst +44 -0
- package/docs/decisions/0007-javascript-file-configuration.rst +143 -0
- package/docs/how_tos/automatic-case-conversion.rst +58 -0
- package/docs/how_tos/caching.rst +93 -0
- package/docs/how_tos/i18n.rst +305 -0
- package/docs/removeExport.js +24 -0
- package/docs/template/edx/README.md +12 -0
- package/docs/template/edx/publish.js +713 -0
- package/docs/template/edx/static/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/docs/template/edx/static/fonts/OpenSans-Bold-webfont.svg +1830 -0
- package/docs/template/edx/static/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/docs/template/edx/static/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
- package/docs/template/edx/static/fonts/OpenSans-BoldItalic-webfont.svg +1830 -0
- package/docs/template/edx/static/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
- package/docs/template/edx/static/fonts/OpenSans-Italic-webfont.eot +0 -0
- package/docs/template/edx/static/fonts/OpenSans-Italic-webfont.svg +1830 -0
- package/docs/template/edx/static/fonts/OpenSans-Italic-webfont.woff +0 -0
- package/docs/template/edx/static/fonts/OpenSans-Light-webfont.eot +0 -0
- package/docs/template/edx/static/fonts/OpenSans-Light-webfont.svg +1831 -0
- package/docs/template/edx/static/fonts/OpenSans-Light-webfont.woff +0 -0
- package/docs/template/edx/static/fonts/OpenSans-LightItalic-webfont.eot +0 -0
- package/docs/template/edx/static/fonts/OpenSans-LightItalic-webfont.svg +1835 -0
- package/docs/template/edx/static/fonts/OpenSans-LightItalic-webfont.woff +0 -0
- package/docs/template/edx/static/fonts/OpenSans-Regular-webfont.eot +0 -0
- package/docs/template/edx/static/fonts/OpenSans-Regular-webfont.svg +1831 -0
- package/docs/template/edx/static/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/docs/template/edx/static/scripts/linenumber.js +25 -0
- package/docs/template/edx/static/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/docs/template/edx/static/scripts/prettify/lang-css.js +2 -0
- package/docs/template/edx/static/scripts/prettify/prettify.js +28 -0
- package/docs/template/edx/static/styles/jsdoc-default.css +356 -0
- package/docs/template/edx/static/styles/prettify-jsdoc.css +111 -0
- package/docs/template/edx/static/styles/prettify-tomorrow.css +132 -0
- package/docs/template/edx/tmpl/augments.tmpl +10 -0
- package/docs/template/edx/tmpl/container.tmpl +196 -0
- package/docs/template/edx/tmpl/details.tmpl +143 -0
- package/docs/template/edx/tmpl/example.tmpl +2 -0
- package/docs/template/edx/tmpl/examples.tmpl +13 -0
- package/docs/template/edx/tmpl/exceptions.tmpl +32 -0
- package/docs/template/edx/tmpl/layout.tmpl +39 -0
- package/docs/template/edx/tmpl/mainpage.tmpl +10 -0
- package/docs/template/edx/tmpl/members.tmpl +38 -0
- package/docs/template/edx/tmpl/method.tmpl +131 -0
- package/docs/template/edx/tmpl/modifies.tmpl +14 -0
- package/docs/template/edx/tmpl/params.tmpl +131 -0
- package/docs/template/edx/tmpl/properties.tmpl +108 -0
- package/docs/template/edx/tmpl/returns.tmpl +19 -0
- package/docs/template/edx/tmpl/source.tmpl +8 -0
- package/docs/template/edx/tmpl/tutorial.tmpl +19 -0
- package/docs/template/edx/tmpl/type.tmpl +7 -0
- package/env.config.js +8 -0
- package/jsdoc.json +36 -0
- package/openedx.yaml +12 -0
- package/package.json +6 -6
- package/service-interface.png +0 -0
- package/src/analytics/MockAnalyticsService.js +71 -0
- package/src/analytics/SegmentAnalyticsService.js +243 -0
- package/src/analytics/index.js +12 -0
- package/src/analytics/interface.js +142 -0
- package/src/auth/AxiosCsrfTokenService.js +60 -0
- package/src/auth/AxiosJwtAuthService.js +364 -0
- package/src/auth/AxiosJwtTokenService.js +134 -0
- package/src/auth/LocalForageCache.js +78 -0
- package/src/auth/MockAuthService.js +285 -0
- package/src/auth/index.js +19 -0
- package/src/auth/interceptors/createCsrfTokenProviderInterceptor.js +37 -0
- package/src/auth/interceptors/createJwtTokenProviderInterceptor.js +38 -0
- package/src/auth/interceptors/createProcessAxiosRequestErrorInterceptor.js +20 -0
- package/src/auth/interceptors/createRetryInterceptor.js +72 -0
- package/src/auth/interface.js +309 -0
- package/src/auth/utils.js +105 -0
- package/src/config.js +327 -0
- package/src/constants.js +66 -0
- package/src/i18n/countries.js +57 -0
- package/src/i18n/index.js +123 -0
- package/src/i18n/injectIntlWithShim.jsx +45 -0
- package/src/i18n/languages.js +60 -0
- package/src/i18n/lib.js +282 -0
- package/src/i18n/scripts/README.md +29 -0
- package/src/i18n/scripts/intl-imports.js +259 -0
- package/src/i18n/scripts/transifex-utils.js +75 -0
- package/src/index.js +42 -0
- package/src/initialize.js +357 -0
- package/src/logging/MockLoggingService.js +31 -0
- package/src/logging/NewRelicLoggingService.js +181 -0
- package/src/logging/index.js +9 -0
- package/src/logging/interface.js +110 -0
- package/src/pubSub.js +47 -0
- package/src/react/AppContext.jsx +24 -0
- package/src/react/AppProvider.jsx +93 -0
- package/src/react/AuthenticatedPageRoute.jsx +60 -0
- package/src/react/ErrorBoundary.jsx +44 -0
- package/src/react/ErrorPage.jsx +76 -0
- package/src/react/LoginRedirect.jsx +16 -0
- package/src/react/OptionalReduxProvider.jsx +28 -0
- package/src/react/PageRoute.jsx +31 -0
- package/src/react/hooks.js +50 -0
- package/src/react/index.js +16 -0
- package/src/scripts/GoogleAnalyticsLoader.js +53 -0
- package/src/scripts/index.js +2 -0
- package/src/testing/index.js +9 -0
- package/src/testing/initializeMockApp.js +77 -0
- package/src/testing/mockMessages.js +21 -0
- package/src/utils.js +167 -0
- /package/{analytics → dist/analytics}/MockAnalyticsService.js +0 -0
- /package/{analytics → dist/analytics}/MockAnalyticsService.js.map +0 -0
- /package/{analytics → dist/analytics}/SegmentAnalyticsService.js +0 -0
- /package/{analytics → dist/analytics}/SegmentAnalyticsService.js.map +0 -0
- /package/{analytics → dist/analytics}/index.js +0 -0
- /package/{analytics → dist/analytics}/index.js.map +0 -0
- /package/{analytics → dist/analytics}/interface.js +0 -0
- /package/{analytics → dist/analytics}/interface.js.map +0 -0
- /package/{auth → dist/auth}/AxiosCsrfTokenService.js +0 -0
- /package/{auth → dist/auth}/AxiosCsrfTokenService.js.map +0 -0
- /package/{auth → dist/auth}/AxiosJwtAuthService.js +0 -0
- /package/{auth → dist/auth}/AxiosJwtAuthService.js.map +0 -0
- /package/{auth → dist/auth}/AxiosJwtTokenService.js +0 -0
- /package/{auth → dist/auth}/AxiosJwtTokenService.js.map +0 -0
- /package/{auth → dist/auth}/LocalForageCache.js +0 -0
- /package/{auth → dist/auth}/LocalForageCache.js.map +0 -0
- /package/{auth → dist/auth}/MockAuthService.js +0 -0
- /package/{auth → dist/auth}/MockAuthService.js.map +0 -0
- /package/{auth → dist/auth}/index.js +0 -0
- /package/{auth → dist/auth}/index.js.map +0 -0
- /package/{auth → dist/auth}/interceptors/createCsrfTokenProviderInterceptor.js +0 -0
- /package/{auth → dist/auth}/interceptors/createCsrfTokenProviderInterceptor.js.map +0 -0
- /package/{auth → dist/auth}/interceptors/createJwtTokenProviderInterceptor.js +0 -0
- /package/{auth → dist/auth}/interceptors/createJwtTokenProviderInterceptor.js.map +0 -0
- /package/{auth → dist/auth}/interceptors/createProcessAxiosRequestErrorInterceptor.js +0 -0
- /package/{auth → dist/auth}/interceptors/createProcessAxiosRequestErrorInterceptor.js.map +0 -0
- /package/{auth → dist/auth}/interceptors/createRetryInterceptor.js +0 -0
- /package/{auth → dist/auth}/interceptors/createRetryInterceptor.js.map +0 -0
- /package/{auth → dist/auth}/interface.js +0 -0
- /package/{auth → dist/auth}/interface.js.map +0 -0
- /package/{auth → dist/auth}/utils.js +0 -0
- /package/{auth → dist/auth}/utils.js.map +0 -0
- /package/{config.js → dist/config.js} +0 -0
- /package/{config.js.map → dist/config.js.map} +0 -0
- /package/{constants.js → dist/constants.js} +0 -0
- /package/{constants.js.map → dist/constants.js.map} +0 -0
- /package/{i18n → dist/i18n}/countries.js +0 -0
- /package/{i18n → dist/i18n}/countries.js.map +0 -0
- /package/{i18n → dist/i18n}/index.js +0 -0
- /package/{i18n → dist/i18n}/index.js.map +0 -0
- /package/{i18n → dist/i18n}/injectIntlWithShim.js +0 -0
- /package/{i18n → dist/i18n}/injectIntlWithShim.js.map +0 -0
- /package/{i18n → dist/i18n}/languages.js +0 -0
- /package/{i18n → dist/i18n}/languages.js.map +0 -0
- /package/{i18n → dist/i18n}/lib.js +0 -0
- /package/{i18n → dist/i18n}/lib.js.map +0 -0
- /package/{i18n → dist/i18n}/scripts/README.md +0 -0
- /package/{i18n → dist/i18n}/scripts/intl-imports.js +0 -0
- /package/{i18n → dist/i18n}/scripts/intl-imports.js.map +0 -0
- /package/{i18n → dist/i18n}/scripts/transifex-utils.js +0 -0
- /package/{i18n → dist/i18n}/scripts/transifex-utils.js.map +0 -0
- /package/{index.js → dist/index.js} +0 -0
- /package/{index.js.map → dist/index.js.map} +0 -0
- /package/{initialize.js → dist/initialize.js} +0 -0
- /package/{initialize.js.map → dist/initialize.js.map} +0 -0
- /package/{logging → dist/logging}/MockLoggingService.js +0 -0
- /package/{logging → dist/logging}/MockLoggingService.js.map +0 -0
- /package/{logging → dist/logging}/NewRelicLoggingService.js +0 -0
- /package/{logging → dist/logging}/NewRelicLoggingService.js.map +0 -0
- /package/{logging → dist/logging}/index.js +0 -0
- /package/{logging → dist/logging}/index.js.map +0 -0
- /package/{logging → dist/logging}/interface.js +0 -0
- /package/{logging → dist/logging}/interface.js.map +0 -0
- /package/{pubSub.js → dist/pubSub.js} +0 -0
- /package/{pubSub.js.map → dist/pubSub.js.map} +0 -0
- /package/{react → dist/react}/AppContext.js +0 -0
- /package/{react → dist/react}/AppContext.js.map +0 -0
- /package/{react → dist/react}/AppProvider.js +0 -0
- /package/{react → dist/react}/AppProvider.js.map +0 -0
- /package/{react → dist/react}/AuthenticatedPageRoute.js +0 -0
- /package/{react → dist/react}/AuthenticatedPageRoute.js.map +0 -0
- /package/{react → dist/react}/ErrorBoundary.js +0 -0
- /package/{react → dist/react}/ErrorBoundary.js.map +0 -0
- /package/{react → dist/react}/ErrorPage.js +0 -0
- /package/{react → dist/react}/ErrorPage.js.map +0 -0
- /package/{react → dist/react}/LoginRedirect.js +0 -0
- /package/{react → dist/react}/LoginRedirect.js.map +0 -0
- /package/{react → dist/react}/OptionalReduxProvider.js +0 -0
- /package/{react → dist/react}/OptionalReduxProvider.js.map +0 -0
- /package/{react → dist/react}/PageRoute.js +0 -0
- /package/{react → dist/react}/PageRoute.js.map +0 -0
- /package/{react → dist/react}/hooks.js +0 -0
- /package/{react → dist/react}/hooks.js.map +0 -0
- /package/{react → dist/react}/index.js +0 -0
- /package/{react → dist/react}/index.js.map +0 -0
- /package/{scripts → dist/scripts}/GoogleAnalyticsLoader.js +0 -0
- /package/{scripts → dist/scripts}/GoogleAnalyticsLoader.js.map +0 -0
- /package/{scripts → dist/scripts}/index.js +0 -0
- /package/{scripts → dist/scripts}/index.js.map +0 -0
- /package/{testing → dist/testing}/index.js +0 -0
- /package/{testing → dist/testing}/index.js.map +0 -0
- /package/{testing → dist/testing}/initializeMockApp.js +0 -0
- /package/{testing → dist/testing}/initializeMockApp.js.map +0 -0
- /package/{testing → dist/testing}/mockMessages.js +0 -0
- /package/{testing → dist/testing}/mockMessages.js.map +0 -0
- /package/{utils.js → dist/utils.js} +0 -0
- /package/{utils.js.map → dist/utils.js.map} +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<?js
|
|
2
|
+
var data = obj;
|
|
3
|
+
var self = this;
|
|
4
|
+
?>
|
|
5
|
+
<h4 class="name" id="<?js= id ?>"><?js= data.attribs + name + (data.signature ? data.signature : '') ?></h4>
|
|
6
|
+
|
|
7
|
+
<?js if (data.summary) { ?>
|
|
8
|
+
<p class="summary"><?js= summary ?></p>
|
|
9
|
+
<?js } ?>
|
|
10
|
+
|
|
11
|
+
<?js if (data.description) { ?>
|
|
12
|
+
<div class="description">
|
|
13
|
+
<?js= data.description ?>
|
|
14
|
+
</div>
|
|
15
|
+
<?js } ?>
|
|
16
|
+
|
|
17
|
+
<?js if (data.type && data.type.names) {?>
|
|
18
|
+
<h5>Type:</h5>
|
|
19
|
+
<ul>
|
|
20
|
+
<li>
|
|
21
|
+
<?js= self.partial('type.tmpl', data.type.names) ?>
|
|
22
|
+
</li>
|
|
23
|
+
</ul>
|
|
24
|
+
<?js } ?>
|
|
25
|
+
|
|
26
|
+
<?js= this.partial('details.tmpl', data) ?>
|
|
27
|
+
|
|
28
|
+
<?js if (data.fires && fires.length) { ?>
|
|
29
|
+
<h5>Fires:</h5>
|
|
30
|
+
<ul><?js fires.forEach(function(f) { ?>
|
|
31
|
+
<li><?js= self.linkto(f) ?></li>
|
|
32
|
+
<?js }); ?></ul>
|
|
33
|
+
<?js } ?>
|
|
34
|
+
|
|
35
|
+
<?js if (data.examples && examples.length) { ?>
|
|
36
|
+
<h5>Example<?js= examples.length > 1? 's':'' ?></h5>
|
|
37
|
+
<?js= this.partial('examples.tmpl', examples) ?>
|
|
38
|
+
<?js } ?>
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
<?js
|
|
2
|
+
var data = obj;
|
|
3
|
+
var self = this;
|
|
4
|
+
?>
|
|
5
|
+
<?js if (data.kind !== 'module' && !data.hideconstructor) { ?>
|
|
6
|
+
<?js if (data.kind === 'class' && data.classdesc) { ?>
|
|
7
|
+
<h2>Constructor</h2>
|
|
8
|
+
<?js } ?>
|
|
9
|
+
|
|
10
|
+
<?js if (data.kind !== 'namespace') { ?>
|
|
11
|
+
<h4 class="name" id="<?js= id ?>"><?js= data.attribs + (kind === 'class' ? 'new ' : '') +
|
|
12
|
+
name + (data.signature || '') ?></h4>
|
|
13
|
+
<?js } ?>
|
|
14
|
+
|
|
15
|
+
<?js if (data.summary) { ?>
|
|
16
|
+
<p class="summary"><?js= summary ?></p>
|
|
17
|
+
<?js } ?>
|
|
18
|
+
<?js } ?>
|
|
19
|
+
|
|
20
|
+
<?js if (data.kind !== 'module' && data.description && !data.hideconstructor) { ?>
|
|
21
|
+
<div class="description">
|
|
22
|
+
<?js= data.description ?>
|
|
23
|
+
</div>
|
|
24
|
+
<?js } ?>
|
|
25
|
+
|
|
26
|
+
<?js if (data.augments && data.alias && data.alias.indexOf('module:') === 0) { ?>
|
|
27
|
+
<h5>Extends:</h5>
|
|
28
|
+
<?js= self.partial('augments.tmpl', data) ?>
|
|
29
|
+
<?js } ?>
|
|
30
|
+
|
|
31
|
+
<?js if (kind === 'event' && data.type && data.type.names) {?>
|
|
32
|
+
<h5>Type:</h5>
|
|
33
|
+
<ul>
|
|
34
|
+
<li>
|
|
35
|
+
<?js= self.partial('type.tmpl', data.type.names) ?>
|
|
36
|
+
</li>
|
|
37
|
+
</ul>
|
|
38
|
+
<?js } ?>
|
|
39
|
+
|
|
40
|
+
<?js if (data['this']) { ?>
|
|
41
|
+
<h5>This:</h5>
|
|
42
|
+
<ul><li><?js= this.linkto(data['this'], data['this']) ?></li></ul>
|
|
43
|
+
<?js } ?>
|
|
44
|
+
|
|
45
|
+
<?js if (data.params && params.length && !data.hideconstructor) { ?>
|
|
46
|
+
<h5>Parameters:</h5>
|
|
47
|
+
<?js= this.partial('params.tmpl', params) ?>
|
|
48
|
+
<?js } ?>
|
|
49
|
+
|
|
50
|
+
<?js= this.partial('details.tmpl', data) ?>
|
|
51
|
+
|
|
52
|
+
<?js if (data.kind !== 'module' && data.requires && data.requires.length) { ?>
|
|
53
|
+
<h5>Requires:</h5>
|
|
54
|
+
<ul><?js data.requires.forEach(function(r) { ?>
|
|
55
|
+
<li><?js= self.linkto(r) ?></li>
|
|
56
|
+
<?js }); ?></ul>
|
|
57
|
+
<?js } ?>
|
|
58
|
+
|
|
59
|
+
<?js if (data.fires && fires.length) { ?>
|
|
60
|
+
<h5>Fires:</h5>
|
|
61
|
+
<ul><?js fires.forEach(function(f) { ?>
|
|
62
|
+
<li><?js= self.linkto(f) ?></li>
|
|
63
|
+
<?js }); ?></ul>
|
|
64
|
+
<?js } ?>
|
|
65
|
+
|
|
66
|
+
<?js if (data.listens && listens.length) { ?>
|
|
67
|
+
<h5>Listens to Events:</h5>
|
|
68
|
+
<ul><?js listens.forEach(function(f) { ?>
|
|
69
|
+
<li><?js= self.linkto(f) ?></li>
|
|
70
|
+
<?js }); ?></ul>
|
|
71
|
+
<?js } ?>
|
|
72
|
+
|
|
73
|
+
<?js if (data.listeners && listeners.length) { ?>
|
|
74
|
+
<h5>Listeners of This Event:</h5>
|
|
75
|
+
<ul><?js listeners.forEach(function(f) { ?>
|
|
76
|
+
<li><?js= self.linkto(f) ?></li>
|
|
77
|
+
<?js }); ?></ul>
|
|
78
|
+
<?js } ?>
|
|
79
|
+
|
|
80
|
+
<?js if (data.modifies && modifies.length) {?>
|
|
81
|
+
<h5>Modifies:</h5>
|
|
82
|
+
<?js if (modifies.length > 1) { ?><ul><?js
|
|
83
|
+
modifies.forEach(function(m) { ?>
|
|
84
|
+
<li><?js= self.partial('modifies.tmpl', m) ?></li>
|
|
85
|
+
<?js });
|
|
86
|
+
?></ul><?js } else {
|
|
87
|
+
modifies.forEach(function(m) { ?>
|
|
88
|
+
<?js= self.partial('modifies.tmpl', m) ?>
|
|
89
|
+
<?js });
|
|
90
|
+
} } ?>
|
|
91
|
+
|
|
92
|
+
<?js if (data.exceptions && exceptions.length) { ?>
|
|
93
|
+
<h5>Throws:</h5>
|
|
94
|
+
<?js if (exceptions.length > 1) { ?><ul><?js
|
|
95
|
+
exceptions.forEach(function(r) { ?>
|
|
96
|
+
<li><?js= self.partial('exceptions.tmpl', r) ?></li>
|
|
97
|
+
<?js });
|
|
98
|
+
?></ul><?js } else {
|
|
99
|
+
exceptions.forEach(function(r) { ?>
|
|
100
|
+
<?js= self.partial('exceptions.tmpl', r) ?>
|
|
101
|
+
<?js });
|
|
102
|
+
} } ?>
|
|
103
|
+
|
|
104
|
+
<?js if (data.returns && returns.length) { ?>
|
|
105
|
+
<h5>Returns:</h5>
|
|
106
|
+
<?js if (returns.length > 1) { ?><ul><?js
|
|
107
|
+
returns.forEach(function(r) { ?>
|
|
108
|
+
<li><?js= self.partial('returns.tmpl', r) ?></li>
|
|
109
|
+
<?js });
|
|
110
|
+
?></ul><?js } else {
|
|
111
|
+
returns.forEach(function(r) { ?>
|
|
112
|
+
<?js= self.partial('returns.tmpl', r) ?>
|
|
113
|
+
<?js });
|
|
114
|
+
} } ?>
|
|
115
|
+
|
|
116
|
+
<?js if (data.yields && yields.length) { ?>
|
|
117
|
+
<h5>Yields:</h5>
|
|
118
|
+
<?js if (yields.length > 1) { ?><ul><?js
|
|
119
|
+
yields.forEach(function(r) { ?>
|
|
120
|
+
<li><?js= self.partial('returns.tmpl', r) ?></li>
|
|
121
|
+
<?js });
|
|
122
|
+
?></ul><?js } else {
|
|
123
|
+
yields.forEach(function(r) { ?>
|
|
124
|
+
<?js= self.partial('returns.tmpl', r) ?>
|
|
125
|
+
<?js });
|
|
126
|
+
} } ?>
|
|
127
|
+
|
|
128
|
+
<?js if (data.examples && examples.length) { ?>
|
|
129
|
+
<h5>Example<?js= examples.length > 1? 's':'' ?></h5>
|
|
130
|
+
<?js= this.partial('examples.tmpl', examples) ?>
|
|
131
|
+
<?js } ?>
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
<?js
|
|
2
|
+
var params = obj;
|
|
3
|
+
|
|
4
|
+
/* sort subparams under their parent params (like opts.classname) */
|
|
5
|
+
var parentParam = null;
|
|
6
|
+
params.forEach(function(param, i) {
|
|
7
|
+
var paramRegExp;
|
|
8
|
+
|
|
9
|
+
if (!param) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (parentParam && parentParam.name && param.name) {
|
|
14
|
+
try {
|
|
15
|
+
paramRegExp = new RegExp('^(?:' + parentParam.name + '(?:\\[\\])*)\\.(.+)$');
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
// there's probably a typo in the JSDoc comment that resulted in a weird
|
|
19
|
+
// parameter name
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if ( paramRegExp.test(param.name) ) {
|
|
24
|
+
param.name = RegExp.$1;
|
|
25
|
+
parentParam.subparams = parentParam.subparams || [];
|
|
26
|
+
parentParam.subparams.push(param);
|
|
27
|
+
params[i] = null;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
parentParam = param;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
parentParam = param;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
/* determine if we need extra columns, "attributes" and "default" */
|
|
39
|
+
params.hasAttributes = false;
|
|
40
|
+
params.hasDefault = false;
|
|
41
|
+
params.hasName = false;
|
|
42
|
+
|
|
43
|
+
params.forEach(function(param) {
|
|
44
|
+
if (!param) { return; }
|
|
45
|
+
|
|
46
|
+
if (param.optional || param.nullable || param.variable) {
|
|
47
|
+
params.hasAttributes = true;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (param.name) {
|
|
51
|
+
params.hasName = true;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (typeof param.defaultvalue !== 'undefined') {
|
|
55
|
+
params.hasDefault = true;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
?>
|
|
59
|
+
|
|
60
|
+
<table class="params">
|
|
61
|
+
<thead>
|
|
62
|
+
<tr>
|
|
63
|
+
<?js if (params.hasName) {?>
|
|
64
|
+
<th>Name</th>
|
|
65
|
+
<?js } ?>
|
|
66
|
+
|
|
67
|
+
<th>Type</th>
|
|
68
|
+
|
|
69
|
+
<?js if (params.hasAttributes) {?>
|
|
70
|
+
<th>Attributes</th>
|
|
71
|
+
<?js } ?>
|
|
72
|
+
|
|
73
|
+
<?js if (params.hasDefault) {?>
|
|
74
|
+
<th>Default</th>
|
|
75
|
+
<?js } ?>
|
|
76
|
+
|
|
77
|
+
<th class="last">Description</th>
|
|
78
|
+
</tr>
|
|
79
|
+
</thead>
|
|
80
|
+
|
|
81
|
+
<tbody>
|
|
82
|
+
<?js
|
|
83
|
+
var self = this;
|
|
84
|
+
params.forEach(function(param) {
|
|
85
|
+
if (!param) { return; }
|
|
86
|
+
?>
|
|
87
|
+
|
|
88
|
+
<tr>
|
|
89
|
+
<?js if (params.hasName) {?>
|
|
90
|
+
<td class="name"><code><?js= param.name ?></code></td>
|
|
91
|
+
<?js } ?>
|
|
92
|
+
|
|
93
|
+
<td class="type">
|
|
94
|
+
<?js if (param.type && param.type.names) {?>
|
|
95
|
+
<?js= self.partial('type.tmpl', param.type.names) ?>
|
|
96
|
+
<?js } ?>
|
|
97
|
+
</td>
|
|
98
|
+
|
|
99
|
+
<?js if (params.hasAttributes) {?>
|
|
100
|
+
<td class="attributes">
|
|
101
|
+
<?js if (param.optional) { ?>
|
|
102
|
+
<optional><br>
|
|
103
|
+
<?js } ?>
|
|
104
|
+
|
|
105
|
+
<?js if (param.nullable) { ?>
|
|
106
|
+
<nullable><br>
|
|
107
|
+
<?js } ?>
|
|
108
|
+
|
|
109
|
+
<?js if (param.variable) { ?>
|
|
110
|
+
<repeatable><br>
|
|
111
|
+
<?js } ?>
|
|
112
|
+
</td>
|
|
113
|
+
<?js } ?>
|
|
114
|
+
|
|
115
|
+
<?js if (params.hasDefault) {?>
|
|
116
|
+
<td class="default">
|
|
117
|
+
<?js if (typeof param.defaultvalue !== 'undefined') { ?>
|
|
118
|
+
<?js= self.htmlsafe(param.defaultvalue) ?>
|
|
119
|
+
<?js } ?>
|
|
120
|
+
</td>
|
|
121
|
+
<?js } ?>
|
|
122
|
+
|
|
123
|
+
<td class="description last"><?js= param.description ?><?js if (param.subparams) { ?>
|
|
124
|
+
<h6>Properties</h6>
|
|
125
|
+
<?js= self.partial('params.tmpl', param.subparams) ?>
|
|
126
|
+
<?js } ?></td>
|
|
127
|
+
</tr>
|
|
128
|
+
|
|
129
|
+
<?js }); ?>
|
|
130
|
+
</tbody>
|
|
131
|
+
</table>
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<?js
|
|
2
|
+
var data = obj;
|
|
3
|
+
var props = data.subprops || data.properties;
|
|
4
|
+
|
|
5
|
+
/* sort subprops under their parent props (like opts.classname) */
|
|
6
|
+
var parentProp = null;
|
|
7
|
+
props.forEach(function(prop, i) {
|
|
8
|
+
if (!prop) { return; }
|
|
9
|
+
if ( parentProp && prop.name && prop.name.indexOf(parentProp.name + '.') === 0 ) {
|
|
10
|
+
prop.name = prop.name.substr(parentProp.name.length+1);
|
|
11
|
+
parentProp.subprops = parentProp.subprops || [];
|
|
12
|
+
parentProp.subprops.push(prop);
|
|
13
|
+
props[i] = null;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
parentProp = prop;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
/* determine if we need extra columns, "attributes" and "default" */
|
|
21
|
+
props.hasAttributes = false;
|
|
22
|
+
props.hasDefault = false;
|
|
23
|
+
props.hasName = false;
|
|
24
|
+
|
|
25
|
+
props.forEach(function(prop) {
|
|
26
|
+
if (!prop) { return; }
|
|
27
|
+
|
|
28
|
+
if (prop.optional || prop.nullable) {
|
|
29
|
+
props.hasAttributes = true;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (prop.name) {
|
|
33
|
+
props.hasName = true;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (typeof prop.defaultvalue !== 'undefined' && !data.isEnum) {
|
|
37
|
+
props.hasDefault = true;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
?>
|
|
41
|
+
|
|
42
|
+
<table class="props">
|
|
43
|
+
<thead>
|
|
44
|
+
<tr>
|
|
45
|
+
<?js if (props.hasName) {?>
|
|
46
|
+
<th>Name</th>
|
|
47
|
+
<?js } ?>
|
|
48
|
+
|
|
49
|
+
<th>Type</th>
|
|
50
|
+
|
|
51
|
+
<?js if (props.hasAttributes) {?>
|
|
52
|
+
<th>Attributes</th>
|
|
53
|
+
<?js } ?>
|
|
54
|
+
|
|
55
|
+
<?js if (props.hasDefault) {?>
|
|
56
|
+
<th>Default</th>
|
|
57
|
+
<?js } ?>
|
|
58
|
+
|
|
59
|
+
<th class="last">Description</th>
|
|
60
|
+
</tr>
|
|
61
|
+
</thead>
|
|
62
|
+
|
|
63
|
+
<tbody>
|
|
64
|
+
<?js
|
|
65
|
+
var self = this;
|
|
66
|
+
props.forEach(function(prop) {
|
|
67
|
+
if (!prop) { return; }
|
|
68
|
+
?>
|
|
69
|
+
|
|
70
|
+
<tr>
|
|
71
|
+
<?js if (props.hasName) {?>
|
|
72
|
+
<td class="name"><code><?js= prop.name ?></code></td>
|
|
73
|
+
<?js } ?>
|
|
74
|
+
|
|
75
|
+
<td class="type">
|
|
76
|
+
<?js if (prop.type && prop.type.names) {?>
|
|
77
|
+
<?js= self.partial('type.tmpl', prop.type.names) ?>
|
|
78
|
+
<?js } ?>
|
|
79
|
+
</td>
|
|
80
|
+
|
|
81
|
+
<?js if (props.hasAttributes) {?>
|
|
82
|
+
<td class="attributes">
|
|
83
|
+
<?js if (prop.optional) { ?>
|
|
84
|
+
<optional><br>
|
|
85
|
+
<?js } ?>
|
|
86
|
+
|
|
87
|
+
<?js if (prop.nullable) { ?>
|
|
88
|
+
<nullable><br>
|
|
89
|
+
<?js } ?>
|
|
90
|
+
</td>
|
|
91
|
+
<?js } ?>
|
|
92
|
+
|
|
93
|
+
<?js if (props.hasDefault) {?>
|
|
94
|
+
<td class="default">
|
|
95
|
+
<?js if (typeof prop.defaultvalue !== 'undefined') { ?>
|
|
96
|
+
<?js= self.htmlsafe(prop.defaultvalue) ?>
|
|
97
|
+
<?js } ?>
|
|
98
|
+
</td>
|
|
99
|
+
<?js } ?>
|
|
100
|
+
|
|
101
|
+
<td class="description last"><?js= prop.description ?><?js if (prop.subprops) { ?>
|
|
102
|
+
<h6>Properties</h6><?js= self.partial('properties.tmpl', prop) ?>
|
|
103
|
+
<?js } ?></td>
|
|
104
|
+
</tr>
|
|
105
|
+
|
|
106
|
+
<?js }); ?>
|
|
107
|
+
</tbody>
|
|
108
|
+
</table>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<?js
|
|
2
|
+
var data = obj || {};
|
|
3
|
+
if (data.description) {
|
|
4
|
+
?>
|
|
5
|
+
<div class="param-desc">
|
|
6
|
+
<?js= description ?>
|
|
7
|
+
</div>
|
|
8
|
+
<?js } ?>
|
|
9
|
+
|
|
10
|
+
<?js if (data.type && data.type.names) {?>
|
|
11
|
+
<dl>
|
|
12
|
+
<dt>
|
|
13
|
+
Type
|
|
14
|
+
</dt>
|
|
15
|
+
<dd>
|
|
16
|
+
<?js= this.partial('type.tmpl', data.type.names) ?>
|
|
17
|
+
</dd>
|
|
18
|
+
</dl>
|
|
19
|
+
<?js } ?>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<section>
|
|
2
|
+
|
|
3
|
+
<header>
|
|
4
|
+
<?js if (children.length > 0) { ?>
|
|
5
|
+
<ul><?js
|
|
6
|
+
var self = this;
|
|
7
|
+
children.forEach(function(t) { ?>
|
|
8
|
+
<li><?js= self.tutoriallink(t.name) ?></li>
|
|
9
|
+
<?js }); ?></ul>
|
|
10
|
+
<?js } ?>
|
|
11
|
+
|
|
12
|
+
<h2><?js= header ?></h2>
|
|
13
|
+
</header>
|
|
14
|
+
|
|
15
|
+
<article>
|
|
16
|
+
<?js= content ?>
|
|
17
|
+
</article>
|
|
18
|
+
|
|
19
|
+
</section>
|
package/env.config.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// NOTE: This file is used by the example app. frontend-build expects the file
|
|
2
|
+
// to be in the root of the repository. This is not used by the actual frontend-platform library.
|
|
3
|
+
// Also note that in an actual application this file would be added to .gitignore.
|
|
4
|
+
const config = {
|
|
5
|
+
JS_FILE_VAR: 'JS_FILE_VAR_VALUE_FOR_EXAMPLE_APP',
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export default config;
|
package/jsdoc.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tags": {
|
|
3
|
+
"allowUnknownTags": true,
|
|
4
|
+
"dictionaries": ["jsdoc"]
|
|
5
|
+
},
|
|
6
|
+
"source": {
|
|
7
|
+
"include": ["src", "package.json", "README.md"],
|
|
8
|
+
"includePattern": ".+\\.js(doc|x)?$",
|
|
9
|
+
"excludePattern": "(node_modules/|docs)"
|
|
10
|
+
},
|
|
11
|
+
"plugins": [
|
|
12
|
+
"plugins/markdown",
|
|
13
|
+
"docs/addTagsPlugin",
|
|
14
|
+
"docs/removeExport"
|
|
15
|
+
],
|
|
16
|
+
"templates": {
|
|
17
|
+
"cleverLinks": false,
|
|
18
|
+
"monospaceLinks": true,
|
|
19
|
+
"useLongnameInNav": false,
|
|
20
|
+
"showInheritedInNav": true,
|
|
21
|
+
"default": {
|
|
22
|
+
"staticFiles": {
|
|
23
|
+
"include": [
|
|
24
|
+
"./service-interface.png"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"opts": {
|
|
30
|
+
"destination": "./docs/api",
|
|
31
|
+
"encoding": "utf8",
|
|
32
|
+
"private": true,
|
|
33
|
+
"recurse": true,
|
|
34
|
+
"template": "docs/template/edx"
|
|
35
|
+
}
|
|
36
|
+
}
|
package/openedx.yaml
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edx/frontend-platform",
|
|
3
|
-
"version": "4.6.
|
|
3
|
+
"version": "4.6.2",
|
|
4
4
|
"description": "Foundational application framework for Open edX micro-frontend applications.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@edx/brand": "npm:@edx/brand-openedx@1.2.0",
|
|
36
36
|
"@edx/browserslist-config": "1.2.0",
|
|
37
|
-
"@edx/frontend-build": "12.
|
|
37
|
+
"@edx/frontend-build": "12.9.3",
|
|
38
38
|
"@edx/paragon": "^20.44.0",
|
|
39
39
|
"@testing-library/react-hooks": "^8.0.1",
|
|
40
40
|
"@wojtekmaj/enzyme-adapter-react-17": "0.8.0",
|
|
41
|
-
"axios-mock-adapter": "^1.21.
|
|
42
|
-
"core-js": "3.
|
|
41
|
+
"axios-mock-adapter": "^1.21.5",
|
|
42
|
+
"core-js": "3.32.0",
|
|
43
43
|
"enzyme": "3.11.0",
|
|
44
44
|
"husky": "8.0.3",
|
|
45
45
|
"jsdoc": "^4.0.0",
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
"universal-cookie": "4.0.4"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"@edx/frontend-build": ">= 8.1.0",
|
|
78
|
-
"@edx/paragon": ">= 10.0.0 <
|
|
77
|
+
"@edx/frontend-build": ">= 8.1.0 || ^12.9.0-alpha.1",
|
|
78
|
+
"@edx/paragon": ">= 10.0.0 < 22.0.0",
|
|
79
79
|
"prop-types": "^15.7.2",
|
|
80
80
|
"react": "^16.9.0 || ^17.0.0",
|
|
81
81
|
"react-dom": "^16.9.0 || ^17.0.0",
|
|
Binary file
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The MockAnalyticsService implements all functions of AnalyticsService as Jest mocks (jest.fn())).
|
|
3
|
+
* It emulates the behavior of a real analytics service but witohut making any requests. It has no
|
|
4
|
+
* other functionality.
|
|
5
|
+
*
|
|
6
|
+
* @implements {AnalyticsService}
|
|
7
|
+
* @memberof module:Analytics
|
|
8
|
+
*/
|
|
9
|
+
class MockAnalyticsService {
|
|
10
|
+
static hasIdentifyBeenCalled = false;
|
|
11
|
+
|
|
12
|
+
constructor({ httpClient, loggingService }) {
|
|
13
|
+
this.loggingService = loggingService;
|
|
14
|
+
this.httpClient = httpClient;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
checkIdentifyCalled = jest.fn(() => {
|
|
18
|
+
if (!this.hasIdentifyBeenCalled) {
|
|
19
|
+
this.loggingService.logError('Identify must be called before other tracking events.');
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Returns a resolved promise.
|
|
25
|
+
*
|
|
26
|
+
* @returns {Promise} The promise returned by HttpClient.post.
|
|
27
|
+
*/
|
|
28
|
+
sendTrackingLogEvent = jest.fn(() => Promise.resolve());
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* No-op, but records that identify has been called.
|
|
32
|
+
*
|
|
33
|
+
* @param {string} userId
|
|
34
|
+
* @throws {Error} If userId argument is not supplied.
|
|
35
|
+
*/
|
|
36
|
+
identifyAuthenticatedUser = jest.fn((userId) => {
|
|
37
|
+
if (!userId) {
|
|
38
|
+
throw new Error('UserId is required for identifyAuthenticatedUser.');
|
|
39
|
+
}
|
|
40
|
+
this.hasIdentifyBeenCalled = true;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* No-op, but records that it has been called to prevent double-identification.
|
|
45
|
+
* @returns {Promise} A resolved promise.
|
|
46
|
+
*/
|
|
47
|
+
identifyAnonymousUser = jest.fn(() => {
|
|
48
|
+
this.hasIdentifyBeenCalled = true;
|
|
49
|
+
return Promise.resolve();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Logs the event to the console.
|
|
54
|
+
*
|
|
55
|
+
* Checks whether identify has been called, logging an error to the logging service if not.
|
|
56
|
+
*/
|
|
57
|
+
sendTrackEvent = jest.fn(() => {
|
|
58
|
+
this.checkIdentifyCalled();
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Logs the event to the console.
|
|
63
|
+
*
|
|
64
|
+
* Checks whether identify has been called, logging an error to the logging service if not.
|
|
65
|
+
*/
|
|
66
|
+
sendPageEvent = jest.fn(() => {
|
|
67
|
+
this.checkIdentifyCalled();
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export default MockAnalyticsService;
|