@openedx/frontend-base 2.0.0-alpha.1 → 2.0.0-alpha.3
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/dist/runtime/config/index.js +2 -0
- package/dist/runtime/config/index.js.map +1 -1
- package/dist/runtime/i18n/index.d.ts +6 -8
- package/dist/runtime/i18n/index.js +6 -8
- package/dist/runtime/i18n/index.js.map +1 -1
- package/dist/runtime/i18n/lib.d.ts +38 -8
- package/dist/runtime/i18n/lib.js +88 -22
- package/dist/runtime/i18n/lib.js.map +1 -1
- package/dist/runtime/i18n/updateSiteLanguage.d.ts +17 -0
- package/dist/runtime/i18n/updateSiteLanguage.js +91 -0
- package/dist/runtime/i18n/updateSiteLanguage.js.map +1 -0
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +1 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/logging/types.js.map +1 -1
- package/dist/runtime/react/CombinedAppProvider.js.map +1 -1
- package/dist/runtime/react/CurrentAppContext.js.map +1 -1
- package/dist/runtime/react/CurrentAppProvider.js.map +1 -1
- package/dist/runtime/react/SiteContext.js.map +1 -1
- package/dist/runtime/react/SiteProvider.js.map +1 -1
- package/dist/runtime/react/hooks/theme/useThemeVariants.js.map +1 -1
- package/dist/runtime/slots/Slot.js.map +1 -1
- package/dist/runtime/slots/SlotContext.js.map +1 -1
- package/dist/runtime/slots/layout/types.js.map +1 -1
- package/dist/runtime/slots/types.js.map +1 -1
- package/dist/runtime/slots/widget/WidgetContext.js.map +1 -1
- package/dist/runtime/slots/widget/WidgetProvider.js.map +1 -1
- package/dist/runtime/slots/widget/iframe/IFrameContentWrapper.js.map +1 -1
- package/dist/runtime/slots/widget/iframe/IFrameWidget.js.map +1 -1
- package/dist/runtime/slots/widget/iframe/hooks.js.map +1 -1
- package/dist/runtime/slots/widget/iframe/types.js.map +1 -1
- package/dist/runtime/slots/widget/types.js.map +1 -1
- package/dist/runtime/testing/initializeMockApp.js.map +1 -1
- package/dist/shell/Logo.js.map +1 -1
- package/dist/shell/dev/devHeader/BarContext.js.map +1 -1
- package/dist/shell/dev/devHeader/BarProvider.js.map +1 -1
- package/dist/shell/dev/devHeader/FooContext.js.map +1 -1
- package/dist/shell/dev/devHeader/FooProvider.js.map +1 -1
- package/dist/shell/dev/slotShowcase/SlotShowcasePage.js.map +1 -1
- package/dist/shell/dev/slotShowcase/app.js.map +1 -1
- package/dist/shell/footer/CopyrightNotice.js.map +1 -1
- package/dist/shell/footer/LanguageMenu.js +36 -6
- package/dist/shell/footer/LanguageMenu.js.map +1 -1
- package/dist/shell/footer/LanguageMenuItem.d.ts +4 -1
- package/dist/shell/footer/LanguageMenuItem.js +4 -5
- package/dist/shell/footer/LanguageMenuItem.js.map +1 -1
- package/dist/shell/footer/messages.d.ts +8 -0
- package/dist/shell/footer/messages.js +10 -0
- package/dist/shell/footer/messages.js.map +1 -0
- package/dist/shell/header/AuthenticatedMenu.js.map +1 -1
- package/dist/shell/header/HelpButton.js.map +1 -1
- package/dist/shell/header/anonymous-menu/AnonymousMenu.js.map +1 -1
- package/dist/shell/header/course-bar/data/service.js.map +1 -1
- package/dist/shell/header/course-bar/masquerade/StudioLink.js.map +1 -1
- package/dist/shell/header/course-bar/masquerade/data/api.js.map +1 -1
- package/dist/shell/header/course-bar/masquerade/hooks.js.map +1 -1
- package/dist/shell/header/course-bar/masquerade/masquerade-widget/MasqueradeUserNameInput.js.map +1 -1
- package/dist/shell/header/course-bar/masquerade/masquerade-widget/MasqueradeWidgetOption.js.map +1 -1
- package/dist/shell/header/course-bar/navigation/CourseTabsNavigation.js.map +1 -1
- package/dist/shell/header/helpButtonSlotOperation.js.map +1 -1
- package/dist/shell/menus/LinkMenuItem.js.map +1 -1
- package/dist/shell/menus/NavDropdownMenuSlot.js.map +1 -1
- package/dist/shell/menus/ProfileLinkMenuItem.js.map +1 -1
- package/dist/tools/eslint/base.eslint.config.js +2 -2
- package/dist/types.d.ts +2 -0
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/dist/shell/footer/data/api.d.ts +0 -1
- package/dist/shell/footer/data/api.js +0 -45
- package/dist/shell/footer/data/api.js.map +0 -1
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { getAuthenticatedHttpClient, getAuthenticatedUser, } from '../auth';
|
|
11
|
+
import { getSiteConfig } from '../config';
|
|
12
|
+
import { updateLocale } from './lib';
|
|
13
|
+
/**
|
|
14
|
+
* Changes the user's site language. This is the supported way to switch languages.
|
|
15
|
+
*
|
|
16
|
+
* - Updates the UI locale immediately via updateLocale(), so the change is reflected
|
|
17
|
+
* without waiting for the network requests to complete.
|
|
18
|
+
* - For authenticated users, persists the preference to the LMS API.
|
|
19
|
+
* - For all users (authenticated and anonymous), sets the language cookie via the LMS language preference endpoint.
|
|
20
|
+
*
|
|
21
|
+
* Both requests are attempted regardless of whether the other one fails, so a failed
|
|
22
|
+
* preference save doesn't prevent the session cookie from being set, and vice versa.
|
|
23
|
+
*
|
|
24
|
+
* @param {string} locale The locale code to switch to (e.g. 'es-419', 'ar').
|
|
25
|
+
* @returns {Promise<void>} Resolves when the switch is complete. Rejects with an
|
|
26
|
+
* AggregateError of the failures if any request fails.
|
|
27
|
+
* @memberof module:Internationalization
|
|
28
|
+
*/
|
|
29
|
+
export function updateSiteLanguage(locale) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
const user = getAuthenticatedUser();
|
|
32
|
+
// Update the UI locale and RTL direction immediately, before waiting on any
|
|
33
|
+
// network requests. This ensures that the UI reflects the change without delay.
|
|
34
|
+
updateLocale(locale);
|
|
35
|
+
const requests = [setSessionLanguage(locale)];
|
|
36
|
+
// Save the preference for authenticated users.
|
|
37
|
+
if (user !== null) {
|
|
38
|
+
requests.push(patchUserPreferences(user.username, locale));
|
|
39
|
+
}
|
|
40
|
+
const results = yield Promise.allSettled(requests);
|
|
41
|
+
const failures = results
|
|
42
|
+
.filter((result) => result.status === 'rejected')
|
|
43
|
+
.map((result) => result.reason);
|
|
44
|
+
if (failures.length > 0) {
|
|
45
|
+
throw new AggregateError(failures, `Failed to persist the site language '${locale}'.`);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Updates user language preferences via the preferences API.
|
|
51
|
+
*
|
|
52
|
+
* @param {string} username - The username of the authenticated user.
|
|
53
|
+
* @param {string} locale - The selected language locale code (e.g., 'en', 'es-419', 'ar', 'de-de').
|
|
54
|
+
* Should be a valid ISO language code supported by the platform. For reference:
|
|
55
|
+
* https://github.com/openedx/openedx-platform/blob/master/openedx/envs/common.py#L231
|
|
56
|
+
* @returns {Promise} - A promise that resolves when the API call completes successfully,
|
|
57
|
+
* or rejects if there's an error with the request.
|
|
58
|
+
*/
|
|
59
|
+
function patchUserPreferences(username, locale) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
const { lmsBaseUrl } = getSiteConfig();
|
|
62
|
+
yield getAuthenticatedHttpClient().patch(`${lmsBaseUrl}/api/user/v1/preferences/${username}`, {
|
|
63
|
+
'pref-lang': locale,
|
|
64
|
+
}, {
|
|
65
|
+
headers: {
|
|
66
|
+
'Content-Type': 'application/merge-patch+json',
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Sets the language for the current session using the lang preference endpoint.
|
|
73
|
+
*
|
|
74
|
+
* This function sends a PATCH request to the LMS update_language endpoint to change
|
|
75
|
+
* the language for the current user session.
|
|
76
|
+
*
|
|
77
|
+
* @param {string} locale - The selected language locale code (e.g., 'en', 'es-419', 'ar', 'de-de').
|
|
78
|
+
* Should be a valid ISO language code supported by the platform. For reference:
|
|
79
|
+
* https://github.com/openedx/openedx-platform/blob/master/openedx/envs/common.py#L231
|
|
80
|
+
* @returns {Promise} - A promise that resolves when the API call completes successfully,
|
|
81
|
+
* or rejects if there's an error with the request.
|
|
82
|
+
*/
|
|
83
|
+
function setSessionLanguage(locale) {
|
|
84
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
const { lmsBaseUrl } = getSiteConfig();
|
|
86
|
+
// Use the authenticated HTTP client to ensure that the request includes the CSRF token.
|
|
87
|
+
// Works for both authenticated and anonymous users, since the endpoint is public.
|
|
88
|
+
yield getAuthenticatedHttpClient().patch(`${lmsBaseUrl}/lang_pref/update_language`, { 'pref-lang': locale }, { isPublic: true });
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=updateSiteLanguage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateSiteLanguage.js","sourceRoot":"","sources":["../../../runtime/i18n/updateSiteLanguage.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAgB,kBAAkB,CAAC,MAAc;;QACrD,MAAM,IAAI,GAAG,oBAAoB,EAAE,CAAC;QAEpC,4EAA4E;QAC5E,gFAAgF;QAChF,YAAY,CAAC,MAAM,CAA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AAE,EACvB,EAAE,QAAQ,EAAE,IAAI,EAAE,CACnB,CAAC;IACJ,CAAC;CAAA","sourcesContent":["import {\n getAuthenticatedHttpClient,\n getAuthenticatedUser,\n} from '../auth';\nimport { getSiteConfig } from '../config';\nimport { updateLocale } from './lib';\n\n/**\n * Changes the user's site language. This is the supported way to switch languages.\n *\n * - Updates the UI locale immediately via updateLocale(), so the change is reflected\n * without waiting for the network requests to complete.\n * - For authenticated users, persists the preference to the LMS API.\n * - For all users (authenticated and anonymous), sets the language cookie via the LMS language preference endpoint.\n *\n * Both requests are attempted regardless of whether the other one fails, so a failed\n * preference save doesn't prevent the session cookie from being set, and vice versa.\n *\n * @param {string} locale The locale code to switch to (e.g. 'es-419', 'ar').\n * @returns {Promise<void>} Resolves when the switch is complete. Rejects with an\n * AggregateError of the failures if any request fails.\n * @memberof module:Internationalization\n */\nexport async function updateSiteLanguage(locale: string): Promise<void> {\n const user = getAuthenticatedUser();\n\n // Update the UI locale and RTL direction immediately, before waiting on any\n // network requests. This ensures that the UI reflects the change without delay.\n updateLocale(locale);\n\n const requests = [setSessionLanguage(locale)];\n\n // Save the preference for authenticated users.\n if (user !== null) {\n requests.push(patchUserPreferences(user.username, locale));\n }\n\n const results = await Promise.allSettled(requests);\n const failures = results\n .filter((result) => result.status === 'rejected')\n .map((result) => (result as PromiseRejectedResult).reason);\n\n if (failures.length > 0) {\n throw new AggregateError(failures, `Failed to persist the site language '${locale}'.`);\n }\n}\n\n/**\n * Updates user language preferences via the preferences API.\n *\n * @param {string} username - The username of the authenticated user.\n * @param {string} locale - The selected language locale code (e.g., 'en', 'es-419', 'ar', 'de-de').\n * Should be a valid ISO language code supported by the platform. For reference:\n * https://github.com/openedx/openedx-platform/blob/master/openedx/envs/common.py#L231\n * @returns {Promise} - A promise that resolves when the API call completes successfully,\n * or rejects if there's an error with the request.\n */\nasync function patchUserPreferences(username: string, locale: string) {\n const { lmsBaseUrl } = getSiteConfig();\n await getAuthenticatedHttpClient().patch(\n `${lmsBaseUrl}/api/user/v1/preferences/${username}`,\n {\n 'pref-lang': locale,\n },\n {\n headers: {\n 'Content-Type': 'application/merge-patch+json',\n },\n },\n );\n}\n\n/**\n * Sets the language for the current session using the lang preference endpoint.\n *\n * This function sends a PATCH request to the LMS update_language endpoint to change\n * the language for the current user session.\n *\n * @param {string} locale - The selected language locale code (e.g., 'en', 'es-419', 'ar', 'de-de').\n * Should be a valid ISO language code supported by the platform. For reference:\n * https://github.com/openedx/openedx-platform/blob/master/openedx/envs/common.py#L231\n * @returns {Promise} - A promise that resolves when the API call completes successfully,\n * or rejects if there's an error with the request.\n */\nasync function setSessionLanguage(locale: string) {\n const { lmsBaseUrl } = getSiteConfig();\n\n // Use the authenticated HTTP client to ensure that the request includes the CSRF token.\n // Works for both authenticated and anonymous users, since the endpoint is public.\n await getAuthenticatedHttpClient().patch(\n `${lmsBaseUrl}/lang_pref/update_language`,\n { 'pref-lang': locale },\n { isPublic: true },\n );\n}\n"]}
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { configureAnalytics, getAnalyticsService, identifyAnonymousUser, identif
|
|
|
2
2
|
export { AUTHENTICATED_USER_CHANGED, AUTHENTICATED_USER_TOPIC, AxiosJwtAuthService, configureAuth, ensureAuthenticatedUser, fetchAuthenticatedUser, getAuthenticatedHttpClient, getAuthenticatedUser, getAuthService, getHttpClient, getLoginRedirectUrl, getLogoutRedirectUrl, hydrateAuthenticatedUser, MockAuthService, redirectToLogin, redirectToLogout, setAuthenticatedUser } from './auth';
|
|
3
3
|
export { getSiteConfig, setSiteConfig, mergeSiteConfig, addAppConfigs, getAppConfig, mergeAppConfig, setActiveRouteRoles, getActiveRouteRoles, addActiveWidgetRole, removeActiveWidgetRole, getActiveWidgetRoles, getActiveRoles, getExternalLinkUrl, getProvides, getProvidesAsStrings } from './config';
|
|
4
4
|
export * from './constants';
|
|
5
|
-
export { configureI18n, createIntl, defineMessages, FormattedDate, FormattedMessage, FormattedNumber, FormattedPlural, FormattedRelativeTime, FormattedTime, getLocale, getLocalizedLanguageName, getMessages, getPrimaryLanguageSubtag, getSupportedLanguageList, handleRtl, IntlProvider, isRtl, LOCALE_CHANGED, LOCALE_TOPIC, mergeMessages, updateLocale, useIntl, type IntlConfig, type ResolvedIntlConfig, type IntlShape, } from './i18n';
|
|
5
|
+
export { configureI18n, createIntl, defineMessages, FormattedDate, FormattedMessage, FormattedNumber, FormattedPlural, FormattedRelativeTime, FormattedTime, getLocale, getLocalizedLanguageName, getMessages, getPrimaryLanguageSubtag, getSupportedLanguageList, handleRtl, IntlProvider, isRtl, LOCALE_CHANGED, LOCALE_TOPIC, mergeMessages, updateLocale, useIntl, updateSiteLanguage, type IntlConfig, type ResolvedIntlConfig, type IntlShape, } from './i18n';
|
|
6
6
|
export { auth, getBasename, initError, initialize } from './initialize';
|
|
7
7
|
export { loadExternalScripts } from './scripts';
|
|
8
8
|
export { configureLogging, getLoggingService, logError, logInfo, MockLoggingService, NewRelicLoggingService, resetLoggingService } from './logging';
|
package/dist/runtime/index.js
CHANGED
|
@@ -2,7 +2,7 @@ export { configureAnalytics, getAnalyticsService, identifyAnonymousUser, identif
|
|
|
2
2
|
export { AUTHENTICATED_USER_CHANGED, AUTHENTICATED_USER_TOPIC, AxiosJwtAuthService, configureAuth, ensureAuthenticatedUser, fetchAuthenticatedUser, getAuthenticatedHttpClient, getAuthenticatedUser, getAuthService, getHttpClient, getLoginRedirectUrl, getLogoutRedirectUrl, hydrateAuthenticatedUser, MockAuthService, redirectToLogin, redirectToLogout, setAuthenticatedUser } from './auth';
|
|
3
3
|
export { getSiteConfig, setSiteConfig, mergeSiteConfig, addAppConfigs, getAppConfig, mergeAppConfig, setActiveRouteRoles, getActiveRouteRoles, addActiveWidgetRole, removeActiveWidgetRole, getActiveWidgetRoles, getActiveRoles, getExternalLinkUrl, getProvides, getProvidesAsStrings } from './config';
|
|
4
4
|
export * from './constants';
|
|
5
|
-
export { configureI18n, createIntl, defineMessages, FormattedDate, FormattedMessage, FormattedNumber, FormattedPlural, FormattedRelativeTime, FormattedTime, getLocale, getLocalizedLanguageName, getMessages, getPrimaryLanguageSubtag, getSupportedLanguageList, handleRtl, IntlProvider, isRtl, LOCALE_CHANGED, LOCALE_TOPIC, mergeMessages, updateLocale, useIntl, } from './i18n';
|
|
5
|
+
export { configureI18n, createIntl, defineMessages, FormattedDate, FormattedMessage, FormattedNumber, FormattedPlural, FormattedRelativeTime, FormattedTime, getLocale, getLocalizedLanguageName, getMessages, getPrimaryLanguageSubtag, getSupportedLanguageList, handleRtl, IntlProvider, isRtl, LOCALE_CHANGED, LOCALE_TOPIC, mergeMessages, updateLocale, useIntl, updateSiteLanguage, } from './i18n';
|
|
6
6
|
export { auth, getBasename, initError, initialize } from './initialize';
|
|
7
7
|
export { loadExternalScripts } from './scripts';
|
|
8
8
|
export { configureLogging, getLoggingService, logError, logInfo, MockLoggingService, NewRelicLoggingService, resetLoggingService } from './logging';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../runtime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,aAAa,EACb,cAAc,EACd,oBAAoB,EACrB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,mBAAmB,EACnB,aAAa,EACb,uBAAuB,EACvB,sBAAsB,EACtB,0BAA0B,EAC1B,oBAAoB,EACpB,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,QAAQ,CAAC;AAEhB,OAAO,EACL,aAAa,EACb,aAAa,EACb,eAAe,EACf,aAAa,EACb,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,oBAAoB,EACrB,MAAM,UAAU,CAAC;AAElB,cAAc,aAAa,CAAC;AAE5B,OAAO,EACL,aAAa,EACb,UAAU,EACV,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,SAAS,EACT,wBAAwB,EACxB,WAAW,EACX,wBAAwB,EACxB,wBAAwB,EACxB,SAAS,EACT,YAAY,EACZ,KAAK,EACL,cAAc,EACd,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../runtime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,aAAa,EACb,cAAc,EACd,oBAAoB,EACrB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,mBAAmB,EACnB,aAAa,EACb,uBAAuB,EACvB,sBAAsB,EACtB,0BAA0B,EAC1B,oBAAoB,EACpB,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,QAAQ,CAAC;AAEhB,OAAO,EACL,aAAa,EACb,aAAa,EACb,eAAe,EACf,aAAa,EACb,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,oBAAoB,EACrB,MAAM,UAAU,CAAC;AAElB,cAAc,aAAa,CAAC;AAE5B,OAAO,EACL,aAAa,EACb,UAAU,EACV,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,SAAS,EACT,wBAAwB,EACxB,WAAW,EACX,wBAAwB,EACxB,wBAAwB,EACxB,SAAS,EACT,YAAY,EACZ,KAAK,EACL,cAAc,EACd,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,OAAO,EACP,kBAAkB,GAInB,MAAM,QAAQ,CAAC;AAEhB,OAAO,EACL,IAAI,EACJ,WAAW,EACX,SAAS,EACT,UAAU,EACX,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,mBAAmB,EACpB,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,QAAQ,EACR,OAAO,EACP,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,EACpB,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,sBAAsB,EACtB,OAAO,EACP,aAAa,EACb,SAAS,EACT,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,YAAY,EACb,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,qBAAqB,EACrB,OAAO,EACP,SAAS,EACT,WAAW,EACZ,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,iBAAiB,EACjB,YAAY,EACb,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB,cAAc,SAAS,CAAC","sourcesContent":["export {\n configureAnalytics,\n getAnalyticsService,\n identifyAnonymousUser,\n identifyAuthenticatedUser,\n MockAnalyticsService,\n resetAnalyticsService,\n SegmentAnalyticsService,\n sendPageEvent,\n sendTrackEvent,\n sendTrackingLogEvent\n} from './analytics';\n\nexport {\n AUTHENTICATED_USER_CHANGED,\n AUTHENTICATED_USER_TOPIC,\n AxiosJwtAuthService,\n configureAuth,\n ensureAuthenticatedUser,\n fetchAuthenticatedUser,\n getAuthenticatedHttpClient,\n getAuthenticatedUser,\n getAuthService,\n getHttpClient,\n getLoginRedirectUrl,\n getLogoutRedirectUrl,\n hydrateAuthenticatedUser,\n MockAuthService,\n redirectToLogin,\n redirectToLogout,\n setAuthenticatedUser\n} from './auth';\n\nexport {\n getSiteConfig,\n setSiteConfig,\n mergeSiteConfig,\n addAppConfigs,\n getAppConfig,\n mergeAppConfig,\n setActiveRouteRoles,\n getActiveRouteRoles,\n addActiveWidgetRole,\n removeActiveWidgetRole,\n getActiveWidgetRoles,\n getActiveRoles,\n getExternalLinkUrl,\n getProvides,\n getProvidesAsStrings\n} from './config';\n\nexport * from './constants';\n\nexport {\n configureI18n,\n createIntl,\n defineMessages,\n FormattedDate,\n FormattedMessage,\n FormattedNumber,\n FormattedPlural,\n FormattedRelativeTime,\n FormattedTime,\n getLocale,\n getLocalizedLanguageName,\n getMessages,\n getPrimaryLanguageSubtag,\n getSupportedLanguageList,\n handleRtl,\n IntlProvider,\n isRtl,\n LOCALE_CHANGED,\n LOCALE_TOPIC,\n mergeMessages,\n updateLocale,\n useIntl,\n updateSiteLanguage,\n type IntlConfig,\n type ResolvedIntlConfig,\n type IntlShape,\n} from './i18n';\n\nexport {\n auth,\n getBasename,\n initError,\n initialize\n} from './initialize';\n\nexport {\n loadExternalScripts\n} from './scripts';\n\nexport {\n configureLogging,\n getLoggingService,\n logError,\n logInfo,\n MockLoggingService,\n NewRelicLoggingService,\n resetLoggingService\n} from './logging';\n\nexport {\n CurrentAppContext,\n CurrentAppProvider,\n SiteContext,\n SiteProvider,\n AuthenticatedPageRoute,\n Divider,\n ErrorBoundary,\n ErrorPage,\n LoginRedirect,\n PageWrap,\n useSiteEvent,\n useAuthenticatedUser,\n useSiteConfig,\n useAppConfig\n} from './react';\n\nexport {\n authenticatedLoader,\n getUrlByRouteRole,\n isRoleRouteObject\n} from './routing';\n\nexport {\n clearAllSubscriptions,\n publish,\n subscribe,\n unsubscribe\n} from './subscriptions';\n\nexport {\n initializeMockApp,\n mockMessages\n} from './testing';\n\nexport {\n camelCaseObject,\n convertKeyNames,\n getQueryParameters,\n isValidVariableName,\n modifyObjectKeys,\n snakeCaseObject\n} from './utils';\n\nexport * from './slots';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../runtime/logging/types.ts"],"names":[],"mappings":"","sourcesContent":["export interface LoggingService {\n logError: (errorStringOrObject: string | Error, customAttributes: any) => void
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../runtime/logging/types.ts"],"names":[],"mappings":"","sourcesContent":["export interface LoggingService {\n logError: (errorStringOrObject: string | Error, customAttributes: any) => void;\n logInfo: (infoStringOrErrorObject: string | Error, customAttributes: any) => void;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CombinedAppProvider.js","sourceRoot":"","sources":["../../../runtime/react/CombinedAppProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAa,OAAO,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAM1C,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAAE,QAAQ,EAA4B;IAChF,MAAM,EAAE,IAAI,EAAE,GAAG,aAAa,EAAE,CAAC;IAEjC,MAAM,SAAS,GAAG,OAAO,CAAgB,GAAG,EAAE;QAC5C,MAAM,IAAI,GAAkB,EAAE,CAAC;QAC/B,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,CAAC,OAAO,CAAC,CAAC,GAAQ,EAAE,EAAE;gBACxB,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;oBACjC,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC;gBAC9B,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,OAAO,SAAS,CAAC,WAAW,CAC1B,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE,CAAC,KAAC,QAAQ,cAAE,GAAG,GAAY,EAC7C,QAAQ,CACT,CAAC;AACJ,CAAC;AAAA,CAAC","sourcesContent":["import { ReactNode, useMemo } from 'react';\nimport { App, AppProvider } from '../../types';\nimport { getSiteConfig } from '../config';\n\ninterface CombinedAppProviderProps {\n children: ReactNode
|
|
1
|
+
{"version":3,"file":"CombinedAppProvider.js","sourceRoot":"","sources":["../../../runtime/react/CombinedAppProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAa,OAAO,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAM1C,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAAE,QAAQ,EAA4B;IAChF,MAAM,EAAE,IAAI,EAAE,GAAG,aAAa,EAAE,CAAC;IAEjC,MAAM,SAAS,GAAG,OAAO,CAAgB,GAAG,EAAE;QAC5C,MAAM,IAAI,GAAkB,EAAE,CAAC;QAC/B,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,CAAC,OAAO,CAAC,CAAC,GAAQ,EAAE,EAAE;gBACxB,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;oBACjC,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC;gBAC9B,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,OAAO,SAAS,CAAC,WAAW,CAC1B,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE,CAAC,KAAC,QAAQ,cAAE,GAAG,GAAY,EAC7C,QAAQ,CACT,CAAC;AACJ,CAAC;AAAA,CAAC","sourcesContent":["import { ReactNode, useMemo } from 'react';\nimport { App, AppProvider } from '../../types';\nimport { getSiteConfig } from '../config';\n\ninterface CombinedAppProviderProps {\n children: ReactNode;\n}\n\nexport default function CombinedAppProvider({ children }: CombinedAppProviderProps) {\n const { apps } = getSiteConfig();\n\n const providers = useMemo<AppProvider[]>(() => {\n const list: AppProvider[] = [];\n if (apps) {\n apps.forEach((app: App) => {\n if (Array.isArray(app.providers)) {\n list.push(...app.providers);\n }\n });\n }\n return list;\n }, [apps]);\n\n return providers.reduceRight<ReactNode>(\n (acc, Provider) => <Provider>{acc}</Provider>,\n children,\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrentAppContext.js","sourceRoot":"","sources":["../../../runtime/react/CurrentAppContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC;;;;;;;;;;;;;;GAcG;AACH,MAAM,iBAAiB,GAAG,aAAa,CAEpC;IACD,SAAS,EAAE,EAAE;CACd,CAAC,CAAC;AAEH,eAAe,iBAAiB,CAAC","sourcesContent":["import { createContext } from 'react';\nimport { AppConfig } from '../../types';\n\n/**\n * `CurrentAppContext` provides data from `App` in a way that React components can readily consume.\n * if it's mutable data. `CurrentAppContext` contains the following data structure:\n *\n * ```\n * {\n * config: <THE App.config OBJECT>\n * }\n * ```\n * If the `App.config` data changes, `CurrentAppContext` will be updated\n * accordingly and pass those changes onto React components using the context.\n *\n * `CurrentAppContext` is used in a React application like any other `[React Context](https://reactjs.org/docs/context.html)\n * @memberof module:React\n */\nconst CurrentAppContext = createContext<{\n appConfig: AppConfig
|
|
1
|
+
{"version":3,"file":"CurrentAppContext.js","sourceRoot":"","sources":["../../../runtime/react/CurrentAppContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC;;;;;;;;;;;;;;GAcG;AACH,MAAM,iBAAiB,GAAG,aAAa,CAEpC;IACD,SAAS,EAAE,EAAE;CACd,CAAC,CAAC;AAEH,eAAe,iBAAiB,CAAC","sourcesContent":["import { createContext } from 'react';\nimport { AppConfig } from '../../types';\n\n/**\n * `CurrentAppContext` provides data from `App` in a way that React components can readily consume.\n * if it's mutable data. `CurrentAppContext` contains the following data structure:\n *\n * ```\n * {\n * config: <THE App.config OBJECT>\n * }\n * ```\n * If the `App.config` data changes, `CurrentAppContext` will be updated\n * accordingly and pass those changes onto React components using the context.\n *\n * `CurrentAppContext` is used in a React application like any other `[React Context](https://reactjs.org/docs/context.html)\n * @memberof module:React\n */\nconst CurrentAppContext = createContext<{\n appConfig: AppConfig;\n}>({\n appConfig: {},\n});\n\nexport default CurrentAppContext;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrentAppProvider.js","sourceRoot":"","sources":["../../../runtime/react/CurrentAppProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAa,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAOvC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAA2B;IACrF,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IAEhE,YAAY,CAAC,cAAc,EAAE,GAAG,EAAE;QAChC,YAAY,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACrC,SAAS;KACV,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEjB,OAAO,CACL,KAAC,iBAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,eAAe,YAC/C,QAAQ,GACkB,CAC9B,CAAC;AACJ,CAAC","sourcesContent":["import { ReactNode, useMemo, useState } from 'react';\n\nimport { getAppConfig } from '../config';\nimport { CONFIG_CHANGED } from '../constants';\n\nimport CurrentAppContext from './CurrentAppContext';\nimport { useSiteEvent } from './hooks';\n\ninterface CurrentAppProviderProps {\n appId: string
|
|
1
|
+
{"version":3,"file":"CurrentAppProvider.js","sourceRoot":"","sources":["../../../runtime/react/CurrentAppProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAa,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAOvC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAA2B;IACrF,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IAEhE,YAAY,CAAC,cAAc,EAAE,GAAG,EAAE;QAChC,YAAY,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACrC,SAAS;KACV,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEjB,OAAO,CACL,KAAC,iBAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,eAAe,YAC/C,QAAQ,GACkB,CAC9B,CAAC;AACJ,CAAC","sourcesContent":["import { ReactNode, useMemo, useState } from 'react';\n\nimport { getAppConfig } from '../config';\nimport { CONFIG_CHANGED } from '../constants';\n\nimport CurrentAppContext from './CurrentAppContext';\nimport { useSiteEvent } from './hooks';\n\ninterface CurrentAppProviderProps {\n appId: string;\n children: ReactNode;\n}\n\n/**\n * A wrapper component for React-based micro-frontends to initialize a number of common data/\n * context providers.\n *\n * ```\n * <CurrentAppProvider appId=\"my.app\">\n * <HelloWorld />\n * </CurrentAppProvider>\n * ```\n *\n * This will provide the following to HelloWorld:\n * - A `CurrentAppContext` provider for React context data.\n *\n * @param {Object} props\n * @memberof module:React\n */\nexport default function CurrentAppProvider({ appId, children }: CurrentAppProviderProps) {\n const [appConfig, setAppConfig] = useState(getAppConfig(appId));\n\n useSiteEvent(CONFIG_CHANGED, () => {\n setAppConfig(getAppConfig(appId));\n });\n\n const appContextValue = useMemo(() => ({\n appConfig,\n }), [appConfig]);\n\n return (\n <CurrentAppContext.Provider value={appContextValue}>\n {children}\n </CurrentAppContext.Provider>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SiteContext.js","sourceRoot":"","sources":["../../../runtime/react/SiteContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,GAAG,aAAa,CAI9B;IACD,iBAAiB,EAAE,IAAI;IACvB,UAAU,EAAE,aAAa,EAAE;IAC3B,MAAM,EAAE,IAAI;CACb,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC","sourcesContent":["import { createContext } from 'react';\nimport { SiteConfig, User } from '../../types';\nimport { getSiteConfig } from '../config';\n\n/**\n * `SiteContext` provides data from `App` in a way that React components can readily consume, even\n * if it's mutable data. `SiteContext` contains the following data structure:\n *\n * ```\n * {\n * authenticatedUser\n * siteConfig\n * locale\n * }\n * ```\n * If `authenticatedUser`, `siteConfig`, or `locale` data changes, `SiteContext` will be updated\n * accordingly and pass those changes onto React components using the context.\n *\n * `SiteContext` is used in a React application like any other `[React Context](https://reactjs.org/docs/context.html)\n * @memberof module:React\n */\nconst SiteContext = createContext<{\n authenticatedUser: User | null
|
|
1
|
+
{"version":3,"file":"SiteContext.js","sourceRoot":"","sources":["../../../runtime/react/SiteContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,GAAG,aAAa,CAI9B;IACD,iBAAiB,EAAE,IAAI;IACvB,UAAU,EAAE,aAAa,EAAE;IAC3B,MAAM,EAAE,IAAI;CACb,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC","sourcesContent":["import { createContext } from 'react';\nimport { SiteConfig, User } from '../../types';\nimport { getSiteConfig } from '../config';\n\n/**\n * `SiteContext` provides data from `App` in a way that React components can readily consume, even\n * if it's mutable data. `SiteContext` contains the following data structure:\n *\n * ```\n * {\n * authenticatedUser\n * siteConfig\n * locale\n * }\n * ```\n * If `authenticatedUser`, `siteConfig`, or `locale` data changes, `SiteContext` will be updated\n * accordingly and pass those changes onto React components using the context.\n *\n * `SiteContext` is used in a React application like any other `[React Context](https://reactjs.org/docs/context.html)\n * @memberof module:React\n */\nconst SiteContext = createContext<{\n authenticatedUser: User | null;\n siteConfig: SiteConfig;\n locale: string;\n}>({\n authenticatedUser: null,\n siteConfig: getSiteConfig(),\n locale: 'en',\n});\n\nexport default SiteContext;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SiteProvider.js","sourceRoot":"","sources":["../../../runtime/react/Si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cAAc,EAAE,GAAG,EAAE;QAChC,SAAS,CAAC,SAAS,EAAE,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;IAEH,yBAAyB,EAAE,CAAC;IAC5B,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,EAAE,CAAC;IAE/C,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACtC,iBAAiB;QACjB,UAAU;QACV,MAAM;QACN,KAAK,EAAE;YACL,KAAK,EAAE,UAAU;YACjB,eAAe,EAAE,CAAC,YAAoB,EAAE,EAAE;gBACxC,aAAa,CAAC,YAAY,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC;gBAE1D,kDAAkD;gBAClD,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,0BAA0B,EAAE,YAAY,CAAC,CAAC;YACxE,CAAC;SACF;KACF,CAAC,EAAE,CAAC,iBAAiB,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC,CAAC;IAExE,IAAI,CAAC,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,aAAa,CAAA,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,KAAC,YAAY,IAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,YACnD,KAAC,aAAa,cACZ,KAAC,WAAW,CAAC,QAAQ,IAAC,KAAK,EAAE,gBAAgB,YAC3C,KAAC,mBAAmB,cACjB,QAAQ,GACW,GACD,GACT,GACH,CAChB,CAAC;AACJ,CAAC","sourcesContent":["import { ReactNode, useMemo, useState } from 'react';\n\nimport { AUTHENTICATED_USER_CHANGED, getAuthenticatedUser } from '../auth';\nimport { getSiteConfig } from '../config';\nimport { CONFIG_CHANGED } from '../constants';\nimport {\n getLocale,\n getMessages,\n IntlProvider,\n LOCALE_CHANGED,\n} from '../i18n';\n\nimport CombinedAppProvider from './CombinedAppProvider';\nimport ErrorBoundary from './ErrorBoundary';\nimport SiteContext from './SiteContext';\nimport { SELECTED_THEME_VARIANT_KEY } from './constants';\nimport {\n useTheme,\n useSiteEvent,\n useTrackColorSchemeChoice\n} from './hooks';\nimport { themeActions } from './reducers';\n\ninterface SiteProviderProps {\n children: ReactNode
|
|
1
|
+
{"version":3,"file":"SiteProvider.js","sourceRoot":"","sources":["../../../runtime/react/SiteProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAa,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EACL,SAAS,EACT,WAAW,EACX,YAAY,EACZ,cAAc,GACf,MAAM,SAAS,CAAC;AAEjB,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,yBAAyB,EAC1B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAM1C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAAE,QAAQ,EAAqB;IAClE,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC;IAC9D,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,QAAQ,CAAC,oBAAoB,EAAE,CAAC,CAAC;IACnF,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,SAAS,EAAE,C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,CAChB,CAAC;AACJ,CAAC","sourcesContent":["import { ReactNode, useMemo, useState } from 'react';\n\nimport { AUTHENTICATED_USER_CHANGED, getAuthenticatedUser } from '../auth';\nimport { getSiteConfig } from '../config';\nimport { CONFIG_CHANGED } from '../constants';\nimport {\n getLocale,\n getMessages,\n IntlProvider,\n LOCALE_CHANGED,\n} from '../i18n';\n\nimport CombinedAppProvider from './CombinedAppProvider';\nimport ErrorBoundary from './ErrorBoundary';\nimport SiteContext from './SiteContext';\nimport { SELECTED_THEME_VARIANT_KEY } from './constants';\nimport {\n useTheme,\n useSiteEvent,\n useTrackColorSchemeChoice\n} from './hooks';\nimport { themeActions } from './reducers';\n\ninterface SiteProviderProps {\n children: ReactNode;\n}\n\n/**\n * A wrapper component for React-based micro-frontends to initialize a number of common data/\n * context providers.\n *\n * ```\n * subscribe(SITE_READY, () => {\n * ReactDOM.render(\n * <SiteProvider>\n * <HelloWorld />\n * </SiteProvider>\n * )\n * });\n * ```\n *\n * This will provide the following to HelloWorld:\n * - An error boundary as described above.\n * - An `SiteContext` provider for React context data.\n * - IntlProvider for @edx/frontend-i18n internationalization\n * - A theme manager for Paragon.\n *\n * @param {Object} props\n * @memberof module:React\n */\nexport default function SiteProvider({ children }: SiteProviderProps) {\n const [siteConfig, setSiteConfig] = useState(getSiteConfig());\n const [authenticatedUser, setAuthenticatedUser] = useState(getAuthenticatedUser());\n const [locale, setLocale] = useState(getLocale());\n\n useSiteEvent(AUTHENTICATED_USER_CHANGED, () => {\n setAuthenticatedUser(getAuthenticatedUser());\n });\n\n useSiteEvent(CONFIG_CHANGED, () => {\n setSiteConfig(getSiteConfig());\n });\n\n useSiteEvent(LOCALE_CHANGED, () => {\n setLocale(getLocale());\n });\n\n useTrackColorSchemeChoice();\n const [themeState, themeDispatch] = useTheme();\n\n const siteContextValue = useMemo(() => ({\n authenticatedUser,\n siteConfig,\n locale,\n theme: {\n state: themeState,\n setThemeVariant: (themeVariant: string) => {\n themeDispatch(themeActions.setThemeVariant(themeVariant));\n\n // Persist selected theme variant to localStorage.\n window.localStorage.setItem(SELECTED_THEME_VARIANT_KEY, themeVariant);\n },\n },\n }), [authenticatedUser, siteConfig, locale, themeState, themeDispatch]);\n\n if (!themeState?.isThemeLoaded) {\n return null;\n }\n\n return (\n <IntlProvider locale={locale} messages={getMessages()}>\n <ErrorBoundary>\n <SiteContext.Provider value={siteContextValue}>\n <CombinedAppProvider>\n {children}\n </CombinedAppProvider>\n </SiteContext.Provider>\n </ErrorBoundary>\n </IntlProvider>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useThemeVariants.js","sourceRoot":"","sources":["../../../../../runtime/react/hooks/theme/useThemeVariants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAI5C;;;;;;;;GAQG;AACH,MAAM,gBAAgB,GAAG,CAAC,EACxB,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,gCAAgC,GAMjC,EAAE,EAAE;IACH,MAAM,CAAC,sBAAsB,EAAE,yBAAyB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE5E,6EAA6E;IAC7E,SAAS,CAAC,GAAG,EAAE;;QACb,MAAM,iBAAiB,GAAG,CAAC,gBAAgB,EAAE,EAAE;YAC7C,gCAAgC,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAC7D,CAAC,CAAC;QACF,MAAM,gBAAgB,GAAG,MAAA,MAAM,CAAC,UAAU,uDAAG,8BAA8B,CAAC,CAAC;QAC7E,IAAI,gBAAgB,EAAE,CAAC;YACrB,gBAAgB,CAAC,gBAAgB,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;QACjE,CAAC;QACD,OAAO,GAAG,EAAE;YACV,IAAI,gBAAgB,EAAE,CAAC;gBACrB,gBAAgB,CAAC,mBAAmB,CAA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} 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
|
|
1
|
+
{"version":3,"file":"useThemeVariants.js","sourceRoot":"","sources":["../../../../../runtime/react/hooks/theme/useThemeVariants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAI5C;;;;;;;;GAQG;AACH,MAAM,gBAAgB,GAAG,CAAC,EACxB,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,gCAAgC,GAMjC,EAAE,EAAE;IACH,MAAM,CAAC,sBAAsB,EAAE,yBAAyB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE5E,6EAA6E;IAC7E,SAAS,CAAC,GAAG,EAAE;;QACb,MAAM,iBAAiB,GAAG,CAAC,gBAAgB,EAAE,EAAE;YAC7C,gCAAgC,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAC7D,CAAC,CAAC;QACF,MAAM,gBAAgB,GAAG,MAAA,MAAM,CAAC,UAAU,uDAAG,8BAA8B,CAAC,CAAC;QAC7E,IAAI,gBAAgB,EAAE,CAAC;YACrB,gBAAgB,CAAC,gBAAgB,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;QACjE,CAAC;QACD,OAAO,GAAG,EAAE;YACV,IAAI,gBAA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C;AAEF,eAAe,gBAAgB,CAAC","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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slot.js","sourceRoot":"","sources":["../../../runtime/slots/Slot.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAiB,aAAa,EAAE,cAAc,EAAE,IAAI,EAAa,MAAM,OAAO,CAAC;AACtF,OAAO,iBAAiB,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAUzC,SAAS,YAAY,CAAC,EAAE,MAAM,EAAyC;IACrE,MAAM,EAAE,EAAE,EAAE,GAAG,cAAc,EAAE,CAAC;IAChC,IAAI,aAAa,GAA8B,MAAM,CAAC;IAEtD,MAAM,cAAc,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC;IAE9C,yDAAyD;IACzD,IAAI,cAAc,IAAI,cAAc,KAAK,IAAI,IAAI,cAAc,KAAK,SAAS,IAAI,OAAO,cAAc,KAAK,SAAS,EAAE,CAAC;QACrH,aAAa,GAAG,cAAc,CAAC;IACjC,CAAC;IAED,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,CAAC;QACnC,aAAa,GAAG,aAAa,CAAC,aAA8B,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,4BAAG,aAAa,GAAI,CAAC;AAC9B,CAAC;AAED,SAAS,IAAI,CAAC,EAA4E;QAA5E,EAAE,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,iBAAiB,OAAuB,EAAlB,KAAK,cAA/D,yCAAiE,CAAF;IAC3E,OAAO,CACL,KAAC,WAAW,CAAC,QAAQ,IAAC,KAAK,kBAAI,EAAE,EAAE,SAAS,EAAE,QAAQ,IAAK,KAAK,aAC9D,KAAC,YAAY,IAAC,MAAM,EAAE,MAAM,GAAI,GACX,CACxB,CAAC;AACJ,CAAC;AAED,wFAAwF;AACxF,eAAe,IAAI,CAAC,IAAI,CAAC,CAAC","sourcesContent":["import { ComponentType, createElement, isValidElement, memo, ReactNode } from 'react';\nimport DefaultSlotLayout from './layout/DefaultSlotLayout';\nimport { useLayoutForSlotId } from './layout/hooks';\nimport SlotContext from './SlotContext';\nimport { useSlotContext } from './hooks';\n\ninterface SlotProps {\n id: string
|
|
1
|
+
{"version":3,"file":"Slot.js","sourceRoot":"","sources":["../../../run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ement, memo, ReactNode } from 'react';\nimport DefaultSlotLayout from './layout/DefaultSlotLayout';\nimport { useLayoutForSlotId } from './layout/hooks';\nimport SlotContext from './SlotContext';\nimport { useSlotContext } from './hooks';\n\ninterface SlotProps {\n id: string;\n idAliases?: string[];\n children?: ReactNode;\n layout?: ComponentType | ReactNode;\n [key: string]: unknown;\n}\n\nfunction SlotRenderer({ layout }: { layout: ComponentType | ReactNode }) {\n const { id } = useSlotContext();\n let layoutElement: ComponentType | ReactNode = layout;\n\n const overrideLayout = useLayoutForSlotId(id);\n\n // Weed out any ReactNode types that aren't actually JSX.\n if (overrideLayout && overrideLayout !== null && overrideLayout !== undefined && typeof overrideLayout !== 'boolean') {\n layoutElement = overrideLayout;\n }\n\n if (!isValidElement(layoutElement)) {\n layoutElement = createElement(layoutElement as ComponentType);\n }\n\n return <>{layoutElement}</>;\n}\n\nfunction Slot({ id, idAliases, children, layout = DefaultSlotLayout, ...props }: SlotProps) {\n return (\n <SlotContext.Provider value={{ id, idAliases, children, ...props }}>\n <SlotRenderer layout={layout} />\n </SlotContext.Provider>\n );\n}\n\n/* memo so parent re-renders don't cascade through Slot when props are shallow-equal. */\nexport default memo(Slot);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlotContext.js","sourceRoot":"","sources":["../../../runtime/slots/SlotContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAa,MAAM,OAAO,CAAC;AAEjD,MAAM,WAAW,GAAG,aAAa,CAAqF;IACpH,EAAE,EAAE,EAAE;IACN,QAAQ,EAAE,IAAI;CACf,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC","sourcesContent":["import { createContext, ReactNode } from 'react';\n\nconst SlotContext = createContext<{ id: string
|
|
1
|
+
{"version":3,"file":"SlotContext.js","sourceRoot":"","sources":["../../../runtime/slots/SlotContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAa,MAAM,OAAO,CAAC;AAEjD,MAAM,WAAW,GAAG,aAAa,CAAqF;IACpH,EAAE,EAAE,EAAE;IACN,QAAQ,EAAE,IAAI;CACf,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC","sourcesContent":["import { createContext, ReactNode } from 'react';\n\nconst SlotContext = createContext<{ id: string; idAliases?: string[]; children?: ReactNode; [key: string]: unknown }>({\n id: '',\n children: null,\n});\n\nexport default SlotContext;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../runtime/slots/layout/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,MAAM,CAAN,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAC9B,iDAAyB,CAAA;IACzB,iDAAyB,CAAA;AAC3B,CAAC,EAHW,oBAAoB,KAApB,oBAAoB,QAG/B","sourcesContent":["/**\n * Base UI Layout Operations\n *\n * \"Layout\" operations are a sub-type of UI operations which affect the layout component of a UI\n * slot. They have no effect on the widgets loaded into a UI slot.\n */\n\nimport { ReactNode } from 'react';\nimport { BaseSlotOperation } from '../types';\n\nexport enum LayoutOperationTypes {\n OPTIONS = 'layoutOptions',\n REPLACE = 'layoutReplace',\n}\n\nexport interface BaseLayoutOperation extends BaseSlotOperation {\n op: LayoutOperationTypes
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../runtime/slots/layout/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,MAAM,CAAN,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAC9B,iDAAyB,CAAA;IACzB,iDAAyB,CAAA;AAC3B,CAAC,EAHW,oBAAoB,KAApB,oBAAoB,QAG/B","sourcesContent":["/**\n * Base UI Layout Operations\n *\n * \"Layout\" operations are a sub-type of UI operations which affect the layout component of a UI\n * slot. They have no effect on the widgets loaded into a UI slot.\n */\n\nimport { ReactNode } from 'react';\nimport { BaseSlotOperation } from '../types';\n\nexport enum LayoutOperationTypes {\n OPTIONS = 'layoutOptions',\n REPLACE = 'layoutReplace',\n}\n\nexport interface BaseLayoutOperation extends BaseSlotOperation {\n op: LayoutOperationTypes;\n}\n\n// Concrete UI Layout Operations\n\nexport type LayoutOptionsOperation = BaseLayoutOperation & {\n op: LayoutOperationTypes.OPTIONS;\n options: Record<string, unknown>;\n};\n\nexport interface LayoutComponentProps {\n component: React.ComponentType;\n}\n\nexport interface LayoutElementProps {\n element: ReactNode;\n}\n\nexport type LayoutRendererProps = (\n LayoutComponentProps | LayoutElementProps\n);\n\nexport type LayoutReplaceOperation = BaseLayoutOperation & LayoutRendererProps & {\n op: LayoutOperationTypes.REPLACE;\n};\n\n// Aggregate UI Layout Operations\n\nexport type LayoutOperation = LayoutOptionsOperation | LayoutReplaceOperation;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../runtime/slots/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG","sourcesContent":["/**\n * Base Slot Operations\n *\n * These are properties shared by all slot operations defined below.\n */\n\nimport { LayoutOperation } from './layout/types';\nimport { WidgetOperation } from './widget/types';\n\nexport interface SlotOperationCondition {\n active?: string[]
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../runtime/slots/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG","sourcesContent":["/**\n * Base Slot Operations\n *\n * These are properties shared by all slot operations defined below.\n */\n\nimport { LayoutOperation } from './layout/types';\nimport { WidgetOperation } from './widget/types';\n\nexport interface SlotOperationCondition {\n active?: string[];\n inactive?: string[];\n authenticated?: boolean;\n callback?: () => boolean;\n}\n\nexport interface BaseSlotOperation {\n slotId: string;\n condition?: SlotOperationCondition;\n}\n\n// Aggregate Slot Operations\n\nexport type SlotOperation = WidgetOperation | LayoutOperation;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WidgetContext.js","sourceRoot":"","sources":["../../../../runtime/slots/widget/WidgetContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,MAAM,aAAa,GAAG,aAAa,CAAsD;IACvF,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE,SAAS;CAChB,CAAC,CAAC;AAEH,eAAe,aAAa,CAAC","sourcesContent":["import { createContext } from 'react';\n\nconst WidgetContext = createContext<{ slotId: string
|
|
1
|
+
{"version":3,"file":"WidgetContext.js","sourceRoot":"","sources":["../../../../runtime/slots/widget/WidgetContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,MAAM,aAAa,GAAG,aAAa,CAAsD;IACvF,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE,SAAS;CAChB,CAAC,CAAC;AAEH,eAAe,aAAa,CAAC","sourcesContent":["import { createContext } from 'react';\n\nconst WidgetContext = createContext<{ slotId: string; widgetId: string; role?: string }>({\n slotId: '',\n widgetId: '',\n role: undefined,\n});\n\nexport default WidgetContext;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WidgetProvider.js","sourceRoot":"","sources":["../../../../runtime/slots/widget/WidgetProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAa,SAAS,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAS5C,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAuB;IAC9F,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC;QACD,OAAO,GAAG,EAAE;YACV,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACvB,sBAAsB,CAAC,IAAI,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,OAAO,CACL,KAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,YACtD,QAAQ,GACc,CAC1B,CAAC;AACJ,CAAC","sourcesContent":["import { ReactNode, useEffect } from 'react';\n\nimport { addActiveWidgetRole, removeActiveWidgetRole } from '../../config';\nimport WidgetContext from './WidgetContext';\n\ninterface WidgetProviderProps {\n children: ReactNode
|
|
1
|
+
{"version":3,"file":"WidgetProvider.js","sourceRoot":"","sources":["../../../../runtime/slots/widget/WidgetProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAa,SAAS,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAS5C,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAuB;IAC9F,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC;QACD,OAAO,GAAG,EAAE;YACV,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACvB,sBAAsB,CAAC,IAAI,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,OAAO,CACL,KAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,YACtD,QAAQ,GACc,CAC1B,CAAC;AACJ,CAAC","sourcesContent":["import { ReactNode, useEffect } from 'react';\n\nimport { addActiveWidgetRole, removeActiveWidgetRole } from '../../config';\nimport WidgetContext from './WidgetContext';\n\ninterface WidgetProviderProps {\n children: ReactNode;\n slotId: string;\n widgetId: string;\n role?: string;\n}\n\nexport default function WidgetProvider({ children, slotId, widgetId, role }: WidgetProviderProps) {\n useEffect(() => {\n if (role !== undefined) {\n addActiveWidgetRole(role);\n }\n return () => {\n if (role !== undefined) {\n removeActiveWidgetRole(role);\n }\n };\n }, [role]);\n\n return (\n <WidgetContext.Provider value={{ slotId, widgetId, role }}>\n {children}\n </WidgetContext.Provider>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IFrameContentWrapper.js","sourceRoot":"","sources":["../../../../../runtime/slots/widget/iframe/IFrameContentWrapper.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,SAAS,EAAE,OAAO,EAAE,QAAQ,GAC7B,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,YAAY,EACb,MAAM,SAAS,CAAC;AACjB,OAAO,QAAQ,MAAM,iCAAiC,CAAC;AAEvD,MAAM,oBAAoB,GAAG,GAAG,EAAE;IAChC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpC,OAAO,CACL,wBACE,uBACG,aAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,GACrC,GACD,CACP,CAAC;AACJ,CAAC,CAAC;AAUF,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAC3C,QAAQ,EAAE,SAAS,EAAE,KAAK,GAAG,EAAE,EAAE,KAAK,GAAG,IAAI,EAAE,sBAAsB,GAC3C;IAC1B,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC;QAC3C,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;KACV,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,iCAC5B,UAAU,GACV,KAAK,EACR,EAAE,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC;IAEzB,6GAA6G;IAE7G,MAAM,aAAa,GAAG,sBAAsB,aAAtB,sBAAsB,cAAtB,sBAAsB,GAAI,oBAAoB,CAAC;IAErE,YAAY,CAAC,aAAa,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;QAC1C,aAAa,CAAC;YACZ,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,oBAAoB,EAAE,CAAC;QAEvB,OAAO,GAAG,EAAE;YACV,sBAAsB,EAAE,CAAC;QAC3B,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,GAAG,EAAE;QACb,gGAAgG;QAChG,4CAA4C;QAC5C,IAAI,KAAK,EAAE,CAAC;YACV,kBAAkB,EAAE,CAAC;QACvB,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,CACL,cAAK,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,YAC1C,KAAC,aAAa,IAAC,iBAAiB,EAAE,KAAC,aAAa,KAAG,YAChD,QAAQ,GACK,GACZ,CACP,CAAC;AACJ,CAAC;AAAA,CAAC","sourcesContent":["import {\n FunctionComponent,\n ReactNode,\n useEffect, useMemo, useState,\n} from 'react';\n\nimport { useIntl } from '../../../i18n';\nimport { ErrorBoundary } from '../../../react';\nimport { IFRAME_RESIZE } from './constants';\nimport {\n dispatchMountedEvent,\n dispatchReadyEvent,\n dispatchUnmountedEvent,\n useHostEvent\n} from './hooks';\nimport messages from './IFrameContentWrapper.messages';\n\nconst ErrorFallbackDefault = () => {\n const { formatMessage } = useIntl();\n return (\n <div>\n <h2>\n {formatMessage(messages.unexpectedError)}\n </h2>\n </div>\n );\n};\n\ninterface IFrameContentWrapperProps {\n children: ReactNode
|
|
1
|
+
{"version":3,"file":"IFrameContentWrapper.js","sourceRoot":"","sources":["../../../../../runtime/slots/widget/iframe/IFrameContentWrapper.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,SAAS,EAAE,OAAO,EAAE,QAAQ,GAC7B,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,YAAY,EACb,MAAM,SAAS,CAAC;AACjB,OAAO,QAAQ,MAAM,iCAAiC,CAAC;AAEvD,MAAM,oBAAoB,GAAG,GAAG,EAAE;IAChC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpC,OAAO,CACL,wBACE,uBACG,aAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,GACrC,GACD,CACP,CAAC;AACJ,CAAC,CAAC;AAUF,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAC3C,QAAQ,EAAE,SAAS,EAAE,KAAK,GAAG,EAAE,EAAE,KAAK,GAAG,IAAI,EAAE,sBAAsB,GAC3C;IAC1B,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC;QAC3C,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;KACV,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,iCAC5B,UAAU,GACV,KAAK,EACR,EAAE,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC;IAEzB,6GAA6G;IAE7G,MAAM,aAAa,GAAG,sBAAsB,aAAtB,sBAAsB,cAAtB,sBAAsB,GAAI,oBAAoB,CAAC;IAErE,YAAY,CAAC,aAAa,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;QAC1C,aAAa,CAAC;YACZ,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,oBAAoB,EAAE,CAAC;QAEvB,OAAO,GAAG,EAAE;YACV,sBAAsB,EAAE,CAAC;QAC3B,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,GAAG,EAAE;QACb,gGAAgG;QAChG,4CAA4C;QAC5C,IAAI,KAAK,EAAE,CAAC;YACV,kBAAkB,EAAE,CAAC;QACvB,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,CACL,cAAK,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,YAC1C,KAAC,aAAa,IAAC,iBAAiB,EAAE,KAAC,aAAa,KAAG,YAChD,QAAQ,GACK,GACZ,CACP,CAAC;AACJ,CAAC;AAAA,CAAC","sourcesContent":["import {\n FunctionComponent,\n ReactNode,\n useEffect, useMemo, useState,\n} from 'react';\n\nimport { useIntl } from '../../../i18n';\nimport { ErrorBoundary } from '../../../react';\nimport { IFRAME_RESIZE } from './constants';\nimport {\n dispatchMountedEvent,\n dispatchReadyEvent,\n dispatchUnmountedEvent,\n useHostEvent\n} from './hooks';\nimport messages from './IFrameContentWrapper.messages';\n\nconst ErrorFallbackDefault = () => {\n const { formatMessage } = useIntl();\n return (\n <div>\n <h2>\n {formatMessage(messages.unexpectedError)}\n </h2>\n </div>\n );\n};\n\ninterface IFrameContentWrapperProps {\n children: ReactNode;\n className?: string;\n style?: Record<string, string>;\n ready?: boolean;\n errorFallbackComponent?: FunctionComponent;\n}\n\nexport default function IFrameContentWrapper({\n children, className, style = {}, ready = true, errorFallbackComponent,\n}: IFrameContentWrapperProps) {\n const [dimensions, setDimensions] = useState({\n width: 0,\n height: 0,\n });\n\n const finalStyle = useMemo(() => ({\n ...dimensions,\n ...style,\n }), [dimensions, style]);\n\n // Need to confirm: When an error is caught here, the logging will be sent to the child MFE's logging service\n\n const ErrorFallback = errorFallbackComponent ?? ErrorFallbackDefault;\n\n useHostEvent(IFRAME_RESIZE, ({ payload }) => {\n setDimensions({\n width: payload.width,\n height: payload.height,\n });\n });\n\n useEffect(() => {\n dispatchMountedEvent();\n\n return () => {\n dispatchUnmountedEvent();\n };\n }, []);\n\n useEffect(() => {\n // Ready defaults to true, but can be used to defer rendering the Plugin until certain processes\n // have occurred or conditions have been met\n if (ready) {\n dispatchReadyEvent();\n }\n }, [ready]);\n\n return (\n <div className={className} style={finalStyle}>\n <ErrorBoundary fallbackComponent={<ErrorFallback />}>\n {children}\n </ErrorBoundary>\n </div>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IFrameWidget.js","sourceRoot":"","sources":["../../../../../runtime/slots/widget/iframe/IFrameWidget.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAOjG,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAAE,GAAG,EAAE,KAAK,EAAqB;IACpE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GA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Spinner } from '@openedx/paragon';\nimport { useEffect, useState } from 'react';\n\nimport classNames from 'classnames';\nimport { dispatchPluginEvent, useElementSize, usePluginEvent } from './hooks';\nimport { IFRAME_FEATURE_POLICY, IFRAME_MOUNTED, IFRAME_READY, IFRAME_RESIZE } from './constants';\n\ninterface IFrameWidgetProps {\n url: string
|
|
1
|
+
{"version":3,"file":"IFrameWidget.js","sourceRoot":"","sources":["../../../../../runtime/slots/widget/iframe/IFrameWidget.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAOjG,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAAE,GAAG,EAAE,KAAK,EAAqB;IACpE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE1C,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,CAAC;IAEnF,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,EAAE,CAAC;YACZ,mBAAmB,CAAC,aAAkC,EAAE;gBACtD,IAAI,EAAE,aAAa;gBACnB,OAAO,EAAE;oBACP,KAAK;oBACL,MAAM;iBACP;aACF,EAAE,GAAG,CAAC,CAAC;QACV,CAAC;IACH,CAAC,EAAE,CAAC,aAAa,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IAEjD,cAAc,CAAC,aAAa,EAAE,cAAc,EAAE,GAAG,EAAE;QACjD,UAAU,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC,CAAC,CAAC;IAEH,cAAc,CAAC,aAAa,EAAE,YAAY,EAAE,GAAG,EAAE;QAC/C,QAAQ,CAAC,IAAI,CAAC,CAAC;IACjB,CAAC,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,CACf,KAAC,OAAO,IAAC,SAAS,EAAC,QAAQ,EAAC,OAAO,EAAC,OAAO,EAAC,gBAAgB,EAAC,SAAS,GAAG,CAC1E,CAAC;IAEF,OAAO,CACL,8BACE,iBACE,GAAG,EAAE,SAAS,EACd,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,qBAAqB,EAC5B,cAAc,EAAC,QAAQ,CAAC,qGAAqG;kBAC7H,SAAS,EAAE,UAAU,CACnB,uBAAuB,EACvB,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,CACrB,GACD,EACD,CAAC,KAAK,IAAI,QAAQ,IAClB,CACJ,CAAC;AACJ,CAAC","sourcesContent":["import { Spinner } from '@openedx/paragon';\nimport { useEffect, useState } from 'react';\n\nimport classNames from 'classnames';\nimport { dispatchPluginEvent, useElementSize, usePluginEvent } from './hooks';\nimport { IFRAME_FEATURE_POLICY, IFRAME_MOUNTED, IFRAME_READY, IFRAME_RESIZE } from './constants';\n\ninterface IFrameWidgetProps {\n url: string;\n title: string;\n}\n\nexport default function IFrameWidget({ url, title }: IFrameWidgetProps) {\n const [mounted, setMounted] = useState(false);\n const [ready, setReady] = useState(false);\n\n const { ref: iframeRef, element: iframeElement, width, height } = useElementSize();\n\n useEffect(() => {\n if (mounted) {\n dispatchPluginEvent(iframeElement as HTMLIFrameElement, {\n type: IFRAME_RESIZE,\n payload: {\n width,\n height,\n },\n }, url);\n }\n }, [iframeElement, mounted, width, height, url]);\n\n usePluginEvent(iframeElement, IFRAME_MOUNTED, () => {\n setMounted(true);\n });\n\n usePluginEvent(iframeElement, IFRAME_READY, () => {\n setReady(true);\n });\n\n const fallback = (\n <Spinner animation=\"border\" variant=\"light\" screenReaderText=\"Loading\" />\n );\n\n return (\n <>\n <iframe\n ref={iframeRef}\n title={title}\n src={url}\n allow={IFRAME_FEATURE_POLICY}\n referrerPolicy=\"origin\" // The sent referrer will be limited to the origin of the referring page: its scheme, host, and port.\n className={classNames(\n 'border border-0 w-100',\n { 'd-none': !ready },\n )}\n />\n {!ready && fallback}\n </>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../../../runtime/slots/widget/iframe/hooks.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAEL,WAAW,EACX,SAAS,EACT,eAAe,EACf,OAAO,EACP,MAAM,EACN,QAAQ,EACT,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG7E,0BAA0B;AAE1B;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,SAAwB,EAAE,IAAY,EAAE,QAA8B;IACpG,mEAAmE;IACnE,eAAe,CAAC,GAAG,EAAE;QACnB,sCAAsC;QACtC,MAAM,QAAQ,GAAG,CAAC,KAAmD,EAAE,EAAE;YACvE,mDAAmD;YACnD,6FAA6F;YAC7F,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;gBAC/B,4FAA4F;gBAC5F,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;oBAC7B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;gBAClD,CAAC;YACH,CAAC;QACH,CAAC,CAAC;QACF,qEAAqE;QACrE,IAAI,SAAS,KAAK,IAAI,EA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AAE,OAAO,CAAC,UAAU;oBACrB,CAAC,EAAE,OAAO,CAAC,SAAS;iBACrB,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;QACH,IAAI,OAAO,EAAE,CAAC;YACZ,mGAAmG;YACnG,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACvC,CAAC;IACH,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,OAAO,OAAO,CAQZ,GAAG,EAAE,CAAC,CAAC;QACL,GAAG,EAAE,WAAW;QAChB,OAAO,EAAE,OAAO;QAChB,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,MAAM,EAAE,UAAU,CAAC,MAAM;QACzB,CAAC,EAAE,MAAM,CAAC,CAAC;QACX,CAAC,EAAE,MAAM,CAAC,CAAC;KACZ,CAAC,EACF,CAAC,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,CAC3C,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Hooks file for functions that handle the communication between a Plugin and its Host\n */\n\nimport {\n LegacyRef,\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState\n} from 'react';\n\nimport { IFRAME_MOUNTED, IFRAME_READY, IFRAME_UNMOUNTED } from './constants';\nimport { MessageEventCallback } from './types';\n\n/* Listening for events */\n\n/**\n * Dynamically add an event listener to the provided source window.\n * The source window can be the global parent (ie. the \"window\" object in the browser)\n * or it can be the content window of an individual element (ie. iFrame plugin container)\n */\nexport function useMessageEvent(srcWindow: Window | null, type: string, callback: MessageEventCallback) {\n // useLayoutEffect is called before the browser repaints the screen\n useLayoutEffect(() => {\n // Create a listener callback function\n const listener = (event: MessageEvent<{ type: string
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../../../runtime/slots/widget/iframe/hooks.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAEL,WAAW,EACX,SAAS,EACT,eAAe,EACf,OAAO,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AO,EAAE,UAAU,EAAE,MAAM,CAAC,CAC3C,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Hooks file for functions that handle the communication between a Plugin and its Host\n */\n\nimport {\n LegacyRef,\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState\n} from 'react';\n\nimport { IFRAME_MOUNTED, IFRAME_READY, IFRAME_UNMOUNTED } from './constants';\nimport { MessageEventCallback } from './types';\n\n/* Listening for events */\n\n/**\n * Dynamically add an event listener to the provided source window.\n * The source window can be the global parent (ie. the \"window\" object in the browser)\n * or it can be the content window of an individual element (ie. iFrame plugin container)\n */\nexport function useMessageEvent(srcWindow: Window | null, type: string, callback: MessageEventCallback) {\n // useLayoutEffect is called before the browser repaints the screen\n useLayoutEffect(() => {\n // Create a listener callback function\n const listener = (event: MessageEvent<{ type: string; payload: any }>) => {\n // Filter messages to those from our source window.\n // NOTE: the \"srcWindow\" is determined by the below useHostEvent and usePluginEvent functions\n if (event.source === srcWindow) {\n // Fire callback if the type from the listened event matches the type from the message event\n if (event.data.type === type) {\n callback({ type, payload: event.data.payload });\n }\n }\n };\n // Add the listener to the global object if the srcWindow is not null\n if (srcWindow !== null) {\n global.addEventListener('message', listener);\n }\n // useEffect cleanup\n return () => {\n global.removeEventListener('message', listener);\n };\n }, [srcWindow, type, callback]);\n}\n\n/**\n * Called by the Plugin component to use events that were listened to (ie. PLUGIN_RESIZE)\n */\nexport function useHostEvent(type: string, callback: MessageEventCallback) {\n useMessageEvent(global.parent, type, callback);\n}\n\n/**\n * Used to listen for events from a wrapped Plugin element (eg. PluginContainerIframe)\n *\n * @param element - Plugin element (eg. <iframe>)\n * @param type - Event type (eg. PLUGIN_RESIZE)\n * @param callback - Function to call when the event is triggered\n */\nexport function usePluginEvent(element: HTMLIFrameElement | undefined, type: string, callback: MessageEventCallback) {\n const contentWindow = element ? element.contentWindow : null;\n useMessageEvent(contentWindow, type, callback);\n}\n\n/** Dispatching events */\n\n/**\n * Base dispatch function called by dispatchHostEvent and dispatchPluginEvent.\n * Uses the `postMessage` method to enable cross-origin communication between Window objects\n *\n * @param targetWindow - Window that the message event is being dispatched to\n * @param message - Data object for the message\n * @param targetOrigin - URL for the window that the message event is being dispatched from\n */\nexport function dispatchMessageEvent(targetWindow: Window | null, message: any, targetOrigin: string) {\n /** Checking targetOrigin falsiness here since '', null or undefined would all be\n * reasons not to try to post a message to the origin.\n */\n if (targetWindow && targetOrigin) {\n targetWindow.postMessage(message, targetOrigin);\n }\n}\n\n/**\n * Used to dispatch events for a Plugin\n *\n * @param element - Plugin element (eg. <iframe>)\n * @param message - Data object for the message\n * @param targetOrigin - URL for the window that the message event is being dispatched from\n */\nexport function dispatchPluginEvent(element: HTMLIFrameElement, message: any, targetOrigin: string) {\n dispatchMessageEvent(element.contentWindow, message, targetOrigin);\n}\n\n/**\n * Used to dispatch events for the Host\n *\n * @param message - Data object for the message\n */\nexport function dispatchHostEvent(message: any) {\n dispatchMessageEvent(global.parent, message, global.document.referrer);\n}\n\n// Called inside Plugin when 'ready' prop is true\nexport function dispatchReadyEvent() {\n dispatchHostEvent({ type: IFRAME_READY });\n}\n\n// Below mounted events are called in a useEffect inside Plugin with [] dependencies — https://react.dev/learn/synchronizing-with-effects\nexport function dispatchMountedEvent() {\n dispatchHostEvent({ type: IFRAME_MOUNTED });\n}\n\nexport function dispatchUnmountedEvent() {\n dispatchHostEvent({ type: IFRAME_UNMOUNTED });\n}\n\n/**\n * Used to determine the size of an element as it is being resized in the browser.\n * ResizeObserver (https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver) is used to maintain a reference to the element's content/border box.\n *\n * @returns Memoized value that contains a reference to the Plugin element (eg. iframe)\n */\nexport function useElementSize() {\n // Holds a reference to the ResizeObserver\n const observerRef = useRef<ResizeObserver | null>(null);\n\n const [dimensions, setDimensions] = useState({ width: 0, height: 0 });\n const [offset, setOffset] = useState({ x: 0, y: 0 });\n const [element, setElement] = useState<HTMLIFrameElement | undefined>();\n // Sets a reference to the Plugin element when passed to the Plugin element as a \"ref\" attribute (eg. <iframe>)\n const measuredRef: LegacyRef<HTMLIFrameElement> = useCallback(_element => {\n setElement(_element);\n }, []);\n\n useEffect(() => {\n // Create a new ResizeObserver\n observerRef.current = new ResizeObserver(() => {\n if (element) {\n // Set dimensions and any offset\n setDimensions({\n width: element.clientWidth,\n height: element.clientHeight,\n });\n setOffset({\n x: element.offsetLeft,\n y: element.offsetTop,\n });\n }\n });\n if (element) {\n // Tell the ResizeObserver to start watching the element — this enables the hook to detect resizing\n observerRef.current.observe(element);\n }\n }, [element]);\n\n return useMemo<{\n ref: LegacyRef<HTMLIFrameElement>;\n element: HTMLIFrameElement | undefined;\n width: number;\n height: number;\n x: number;\n y: number;\n }>(\n () => ({\n ref: measuredRef,\n element: element,\n width: dimensions.width,\n height: dimensions.height,\n x: offset.x,\n y: offset.y\n }),\n [measuredRef, element, dimensions, offset],\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../runtime/slots/widget/iframe/types.ts"],"names":[],"mappings":"AAMA,CAAC","sourcesContent":["export interface MessageEventCallbackParams {\n type: string
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../runtime/slots/widget/iframe/types.ts"],"names":[],"mappings":"AAMA,CAAC","sourcesContent":["export interface MessageEventCallbackParams {\n type: string;\n payload: any;\n}\n\nexport type MessageEventCallback = ({ type, payload }: MessageEventCallbackParams) => void;\n;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../runtime/slots/widget/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,MAAM,CAAN,IAAY,oBAmCX;AAnCD,WAAY,oBAAoB;IAC9B;;OAEG;IACH,+CAAuB,CAAA;IAEvB;;OAEG;IACH,iDAAyB,CAAA;IAEzB;;OAEG;IACH,0DAAkC,CAAA;IAElC;;OAEG;IACH,4DAAoC,CAAA;IAEpC;;OAEG;IACH,iDAAyB,CAAA;IAEzB;;OAEG;IACH,+CAAuB,CAAA;IAEvB;;OAEG;IACH,iDAAyB,CAAA;AAC3B,CAAC,EAnCW,oBAAoB,KAApB,oBAAoB,QAmC/B","sourcesContent":["/**\n * Base UI Widget Operations\n *\n * \"Widget\" operations are a sub-type of UI operations which allow manipulation of the list of widgets (UI components) loaded into the slot. Widget operations are divided further into two sub-types: absolute and relative.\n *\n * Absolute widget operations allow simple list operations like appending and prepending which don't depend on any other list elements.\n *\n * Relative widget operations depend on a relationship to some other list element, such as \"insert before\" and \"insert after\". Some affect those elements, some add something to the list near them.\n */\n\nimport { ReactNode } from 'react';\nimport { BaseSlotOperation } from '../types';\n\nexport enum WidgetOperationTypes {\n /**\n * Adds a widget to the end of the slot's list of widgets.\n */\n APPEND = 'widgetAppend',\n\n /**\n * Adds a widget to the beginning of the slot's list of widgets.\n */\n PREPEND = 'widgetPrepend',\n\n /**\n * Adds a widget after the specified widget ID. Multiple \"insert after\" operations on the same widget ID occur in the order they were declared.\n */\n INSERT_AFTER = 'widgetInsertAfter',\n\n /**\n * Adds a widget before the specified widget ID. Multiple \"insert after\" operations on the same widget ID occur in the order they were declared.\n */\n INSERT_BEFORE = 'widgetInsertBefore',\n\n /**\n * Removes the specified widget ID and adds a widget in its place. Multiple \"replace\" operations on the same widget ID occur in the order they were declared, and only the first will succeed unless the new widget's ID is the same as the one that was removed.\n */\n REPLACE = 'widgetReplace',\n\n /**\n * Removes the specified widget ID from the slot's list of widgets. Subsequent relative widget operations on that widget ID will not be applied.\n */\n REMOVE = 'widgetRemove',\n\n /**\n * Provides options to the specified widget ID. Multiple \"options\" operations on the same widget ID will merge with and override any duplicate properties in the options object - last one in wins.\n */\n OPTIONS = 'widgetOptions',\n}\n\nexport type AbsoluteWidgetOperationTypes = WidgetOperationTypes.APPEND | WidgetOperationTypes.PREPEND;\n\nexport type RelativeWidgetOperationTypes = WidgetOperationTypes.INSERT_AFTER | WidgetOperationTypes.INSERT_BEFORE | WidgetOperationTypes.REPLACE | WidgetOperationTypes.OPTIONS;\n\nexport interface BaseWidgetOperation extends BaseSlotOperation {\n op: WidgetOperationTypes
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../runtime/slots/widget/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,MAAM,CAAN,IAAY,oBAmCX;AAnCD,WAAY,oBAAoB;IAC9B;;OAEG;IACH,+CAAuB,CAAA;IAEvB;;OAEG;IACH,iDAAyB,CAAA;IAEzB;;OAEG;IACH,0DAAkC,CAAA;IAElC;;OAEG;IACH,4DAAoC,CAAA;IAEpC;;OAEG;IACH,iDAAyB,CAAA;IAEzB;;OAEG;IACH,+CAAuB,CAAA;IAEvB;;OAEG;IACH,iDAAyB,CAAA;AAC3B,CAAC,EAnCW,oBAAoB,KAApB,oBAAoB,QAmC/B","sourcesContent":["/**\n * Base UI Widget Operations\n *\n * \"Widget\" operations are a sub-type of UI operations which allow manipulation of the list of widgets (UI components) loaded into the slot. Widget operations are divided further into two sub-types: absolute and relative.\n *\n * Absolute widget operations allow simple list operations like appending and prepending which don't depend on any other list elements.\n *\n * Relative widget operations depend on a relationship to some other list element, such as \"insert before\" and \"insert after\". Some affect those elements, some add something to the list near them.\n */\n\nimport { ReactNode } from 'react';\nimport { BaseSlotOperation } from '../types';\n\nexport enum WidgetOperationTypes {\n /**\n * Adds a widget to the end of the slot's list of widgets.\n */\n APPEND = 'widgetAppend',\n\n /**\n * Adds a widget to the beginning of the slot's list of widgets.\n */\n PREPEND = 'widgetPrepend',\n\n /**\n * Adds a widget after the specified widget ID. Multiple \"insert after\" operations on the same widget ID occur in the order they were declared.\n */\n INSERT_AFTER = 'widgetInsertAfter',\n\n /**\n * Adds a widget before the specified widget ID. Multiple \"insert after\" operations on the same widget ID occur in the order they were declared.\n */\n INSERT_BEFORE = 'widgetInsertBefore',\n\n /**\n * Removes the specified widget ID and adds a widget in its place. Multiple \"replace\" operations on the same widget ID occur in the order they were declared, and only the first will succeed unless the new widget's ID is the same as the one that was removed.\n */\n REPLACE = 'widgetReplace',\n\n /**\n * Removes the specified widget ID from the slot's list of widgets. Subsequent relative widget operations on that widget ID will not be applied.\n */\n REMOVE = 'widgetRemove',\n\n /**\n * Provides options to the specified widget ID. Multiple \"options\" operations on the same widget ID will merge with and override any duplicate properties in the options object - last one in wins.\n */\n OPTIONS = 'widgetOptions',\n}\n\nexport type AbsoluteWidgetOperationTypes = WidgetOperationTypes.APPEND | WidgetOperationTypes.PREPEND;\n\nexport type RelativeWidgetOperationTypes = WidgetOperationTypes.INSERT_AFTER | WidgetOperationTypes.INSERT_BEFORE | WidgetOperationTypes.REPLACE | WidgetOperationTypes.OPTIONS;\n\nexport interface BaseWidgetOperation extends BaseSlotOperation {\n op: WidgetOperationTypes;\n}\n\n// Widget renderer props\n\nexport interface WidgetComponentProps {\n component: React.ComponentType;\n}\n\nexport interface WidgetElementProps {\n element: ReactNode;\n}\n\nexport interface WidgetIFrameProps {\n url: string;\n title: string;\n}\n\nexport type WidgetRendererProps = (\n WidgetComponentProps | WidgetElementProps | WidgetIFrameProps\n);\n\nexport interface WidgetIdentityProps {\n id: string;\n role?: string;\n}\n\nexport interface WidgetRelationshipProps {\n relatedId: string;\n}\n\n// Concrete UI Widget Operations\n\nexport type WidgetAppendOperation = BaseWidgetOperation & WidgetIdentityProps & WidgetRendererProps & {\n op: WidgetOperationTypes.APPEND;\n};\n\nexport type WidgetPrependOperation = BaseWidgetOperation & WidgetIdentityProps & WidgetRendererProps & {\n op: WidgetOperationTypes.PREPEND;\n};\n\nexport type WidgetInsertAfterOperation = BaseWidgetOperation & WidgetIdentityProps & WidgetRendererProps & WidgetRelationshipProps & {\n op: WidgetOperationTypes.INSERT_AFTER;\n};\n\nexport type WidgetInsertBeforeOperation = BaseWidgetOperation & WidgetIdentityProps & WidgetRendererProps & WidgetRelationshipProps & {\n op: WidgetOperationTypes.INSERT_BEFORE;\n};\n\nexport type WidgetRemoveOperation = BaseWidgetOperation & WidgetRelationshipProps & {\n op: WidgetOperationTypes.REMOVE;\n};\n\nexport type WidgetOptionsOperation = BaseWidgetOperation & WidgetRelationshipProps & {\n op: WidgetOperationTypes.OPTIONS;\n options: Record<string, unknown>;\n};\n\nexport type WidgetReplaceOperation = BaseWidgetOperation & WidgetIdentityProps & WidgetRendererProps & WidgetRelationshipProps & { op: WidgetOperationTypes.REPLACE };\n\nexport type WidgetAbsoluteOperation = WidgetAppendOperation | WidgetPrependOperation;\n\nexport type WidgetRelativeRendererOperation = WidgetInsertAfterOperation | WidgetInsertBeforeOperation | WidgetReplaceOperation;\n\nexport type WidgetRelativeOperation = WidgetRelativeRendererOperation | WidgetRemoveOperation | WidgetOptionsOperation;\n\nexport type WidgetRendererOperation = WidgetAbsoluteOperation | WidgetRelativeRendererOperation;\n\nexport type WidgetOperation = WidgetAbsoluteOperation | WidgetRelativeOperation;\n\n/**\n * An identified widget is a simple data structure to associate an ID with a ReactNode so we can\n * apply widget operations to our list of widgets. It helps us find a ReactNode with a particular\n * ID for relative widget operations.\n */\nexport interface IdentifiedWidget {\n id: string;\n role?: string;\n node: ReactNode;\n}\n\nexport interface WidgetList extends Array<ReactNode> {\n identified: IdentifiedWidget[];\n byId(id: string): ReactNode[];\n withoutId(id: string): ReactNode[];\n byRole(role: string): ReactNode[];\n withoutRole(role: string): ReactNode[];\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initializeMockApp.js","sourceRoot":"","sources":["../../../runtime/testing/initializeMockApp.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,aAAa,CAAC;AAIrC,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,QAAQ,GAAG,YAAY,EACvB,iBAAiB,GAAG,IAAI,MAItB,EAAE;IACJ,MAAM,MAAM,GAAG,UAAU,CAAC;IAC1B,eAAe,CAAC,MAAM,CAAC,CAAC;IAExB,MAAM,cAAc,GAAG,gBAAgB,CAAC,kBAAkB,EAAE;QAC1D,MAAM,EAAE,aAAa,EAAE;KACxB,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,aAAa,CAAC,eAAe,EAAE;QACjD,MAAM,EAAE,aAAa,EAAE;QACvB,cAAc;KACf,CAAC,CAAC;IAEH,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;IAExC,MAAM,gBAAgB,GAAG,kBAAkB,CAAC,oBAAoB,EAAE;QAChE,MAAM,EAAE,aAAa,EAAE;QACvB,UAAU,EAAE,WAAW,CAAC,0BAA0B,EAAE;QACpD,cAAc;KACf,CAAC,CAAC;IAEH,kGAAkG;IAClG,aAAa,CAAC;QACZ,QAAQ;KACT,CAAC,CAAC;IAEH,OAAO;QACL,gBAAgB;QAChB,WAAW;QACX,cAAc;KACf,CAAC;AACJ,CAAC","sourcesContent":["import siteConfig from 'site.config';\n\nimport { LocalizedMessages, User } from '../../types';\n\nimport { configureAnalytics, MockAnalyticsService } from '../analytics';\nimport { configureAuth, MockAuthService, setAuthenticatedUser } from '../auth';\nimport { getSiteConfig, mergeSiteConfig } from '../config';\nimport { configureI18n } from '../i18n';\nimport { configureLogging, MockLoggingService } from '../logging';\nimport mockMessages from './mockMessages';\n\n/**\n * Initializes a mock application for component testing. The mock application includes\n * mock analytics, auth, and logging services, and the real i18n service.\n *\n * See MockAnalyticsService, MockAuthService, and MockLoggingService for mock implementation\n * details. For the most part, the analytics and logging services just implement their functions\n * with jest.fn() and do nothing else, whereas the MockAuthService actually has some behavior\n * implemented, it just doesn't make any HTTP calls.\n *\n * Note that this mock application is not sufficient for testing the full application lifecycle or\n * initialization callbacks/custom handlers as described in the 'initialize' function's\n * documentation. It exists merely to set up the mock services that components themselves tend to\n * interact with most often. It could be extended to allow for setting up custom handlers fairly\n * easily, as this functionality would be more-or-less identical to what the real initialize\n * function does.\n *\n * Example:\n *\n * ```\n * import { initializeMockApp, logInfo } from '@openedx/frontend-base';\n *\n * describe('initializeMockApp', () => {\n * it('mocks things correctly', () => {\n * const { loggingService } = initializeMockApp();\n * logInfo('test', {});\n * expect(loggingService.logInfo).toHaveBeenCalledWith('test', {});\n * });\n * });\n * ```\n *\n * @param {Object} [options]\n * @param {*} [options.messages] A i18n-compatible messages object, or an array of such objects. If\n * an array is provided, duplicate keys are resolved with the last-one-in winning.\n * @param {UserData|null} [options.authenticatedUser] A UserData object representing the\n * authenticated user. This is passed directly to MockAuthService.\n * @memberof module:Testing\n */\nexport default function initializeMockApp({\n messages = mockMessages,\n authenticatedUser = null,\n}: {\n messages?: LocalizedMessages
|
|
1
|
+
{"version":3,"file":"initializeMockApp.js","sourceRoot":"","sources":["../../../runtime/testing/initializeMockApp.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,aAAa,CAAC;AAIrC,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,QAAQ,GAAG,YAAY,EACvB,iBAAiB,GAAG,IAAI,MAItB,EAAE;IACJ,MAAM,MAAM,GAAG,UAAU,CAAC;IAC1B,eAAe,CAAC,MAAM,CAAC,CAAC;IAExB,MAAM,cAAc,GAAG,gBAAgB,CAAC,kBAAkB,EAAE;QAC1D,MAAM,EAAE,aAAa,EAAE;KACxB,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,aAAa,CAAC,eAAe,EAAE;QACjD,MAAM,EAAE,aAAa,EAAE;QACvB,cAAc;KACf,CAAC,CAAC;IAEH,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;IAExC,MAAM,gBAAgB,GAAG,kBAAkB,CAAC,oBAAoB,EAAE;QAChE,MAAM,EAAE,aAAa,EAAE;QACvB,UAAU,EAAE,WAAW,CAAC,0BAA0B,EAAE;QACpD,cAAc;KACf,CAAC,CAAC;IAEH,kGAAkG;IAClG,aAAa,CAAC;QACZ,QAAQ;KACT,CAAC,CAAC;IAEH,OAAO;QACL,gBAAgB;QAChB,WAAW;QACX,cAAc;KACf,CAAC;AACJ,CAAC","sourcesContent":["import siteConfig from 'site.config';\n\nimport { LocalizedMessages, User } from '../../types';\n\nimport { configureAnalytics, MockAnalyticsService } from '../analytics';\nimport { configureAuth, MockAuthService, setAuthenticatedUser } from '../auth';\nimport { getSiteConfig, mergeSiteConfig } from '../config';\nimport { configureI18n } from '../i18n';\nimport { configureLogging, MockLoggingService } from '../logging';\nimport mockMessages from './mockMessages';\n\n/**\n * Initializes a mock application for component testing. The mock application includes\n * mock analytics, auth, and logging services, and the real i18n service.\n *\n * See MockAnalyticsService, MockAuthService, and MockLoggingService for mock implementation\n * details. For the most part, the analytics and logging services just implement their functions\n * with jest.fn() and do nothing else, whereas the MockAuthService actually has some behavior\n * implemented, it just doesn't make any HTTP calls.\n *\n * Note that this mock application is not sufficient for testing the full application lifecycle or\n * initialization callbacks/custom handlers as described in the 'initialize' function's\n * documentation. It exists merely to set up the mock services that components themselves tend to\n * interact with most often. It could be extended to allow for setting up custom handlers fairly\n * easily, as this functionality would be more-or-less identical to what the real initialize\n * function does.\n *\n * Example:\n *\n * ```\n * import { initializeMockApp, logInfo } from '@openedx/frontend-base';\n *\n * describe('initializeMockApp', () => {\n * it('mocks things correctly', () => {\n * const { loggingService } = initializeMockApp();\n * logInfo('test', {});\n * expect(loggingService.logInfo).toHaveBeenCalledWith('test', {});\n * });\n * });\n * ```\n *\n * @param {Object} [options]\n * @param {*} [options.messages] A i18n-compatible messages object, or an array of such objects. If\n * an array is provided, duplicate keys are resolved with the last-one-in winning.\n * @param {UserData|null} [options.authenticatedUser] A UserData object representing the\n * authenticated user. This is passed directly to MockAuthService.\n * @memberof module:Testing\n */\nexport default function initializeMockApp({\n messages = mockMessages,\n authenticatedUser = null,\n}: {\n messages?: LocalizedMessages;\n authenticatedUser?: User | null;\n} = {}) {\n const config = siteConfig;\n mergeSiteConfig(config);\n\n const loggingService = configureLogging(MockLoggingService, {\n config: getSiteConfig(),\n });\n\n const authService = configureAuth(MockAuthService, {\n config: getSiteConfig(),\n loggingService,\n });\n\n setAuthenticatedUser(authenticatedUser);\n\n const analyticsService = configureAnalytics(MockAnalyticsService, {\n config: getSiteConfig(),\n httpClient: authService.getAuthenticatedHttpClient(),\n loggingService,\n });\n\n // The i18n service configureI18n function has no return value, since there isn't a service class.\n configureI18n({\n messages,\n });\n\n return {\n analyticsService,\n authService,\n loggingService,\n };\n}\n"]}
|
package/dist/shell/Logo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Logo.js","sourceRoot":"","sources":["../../shell/Logo.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAOvC,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EAGjB;;QAHiB,EAC3B,QAAQ,GAAG,MAAA,aAAa,EAAE,CAAC,kBAAkB,mCAAI,yCAAyC,EAC1F,cAAc,GAAG,iBAAiB,CAAC,QAAQ,CAAC,IAAI,GAAG;IAEnD,MAAM,KAAK,GAAG,CACZ,KAAC,KAAK,IAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,GAAI,CACvD,CAAC;IAEF,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CACL,KAAC,YAAY,IAAC,MAAM,EAAC,IAAI,YACvB,KAAC,SAAS,IAAC,WAAW,EAAE,cAAc,EAAE,SAAS,EAAC,KAAK,YACpD,KAAK,GACI,GACC,CAChB,CAAC;AACJ,CAAC","sourcesContent":["import { IntlProvider } from 'react-intl';\nimport { Hyperlink, Image } from '@openedx/paragon';\nimport { getSiteConfig } from '../runtime/config';\nimport { getUrlByRouteRole } from '../runtime/routing';\nimport { homeRole } from './constants';\n\ninterface LogoProps {\n imageUrl?: string
|
|
1
|
+
{"version":3,"file":"Logo.js","sourceRoot":"","sources":["../../shell/Logo.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAOvC,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EAGjB;;QAHiB,EAC3B,QAAQ,GAAG,MAAA,aAAa,EAAE,CAAC,kBAAkB,mCAAI,yCAAyC,EAC1F,cAAc,GAAG,iBAAiB,CAAC,QAAQ,CAAC,IAAI,GAAG;IAEnD,MAAM,KAAK,GAAG,CACZ,KAAC,KAAK,IAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,GAAI,CACvD,CAAC;IAEF,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CACL,KAAC,YAAY,IAAC,MAAM,EAAC,IAAI,YACvB,KAAC,SAAS,IAAC,WAAW,EAAE,cAAc,EAAE,SAAS,EAAC,KAAK,YACpD,KAAK,GACI,GACC,CAChB,CAAC;AACJ,CAAC","sourcesContent":["import { IntlProvider } from 'react-intl';\nimport { Hyperlink, Image } from '@openedx/paragon';\nimport { getSiteConfig } from '../runtime/config';\nimport { getUrlByRouteRole } from '../runtime/routing';\nimport { homeRole } from './constants';\n\ninterface LogoProps {\n imageUrl?: string;\n destinationUrl?: string;\n}\n\nexport default function Logo({\n imageUrl = getSiteConfig().headerLogoImageUrl ?? 'https://edx-cdn.org/v3/default/logo.svg',\n destinationUrl = getUrlByRouteRole(homeRole) || '/'\n}: LogoProps) {\n const image = (\n <Image src={imageUrl} style={{ maxHeight: '2rem' }} />\n );\n\n if (destinationUrl === undefined) {\n return image;\n }\n\n return (\n <IntlProvider locale=\"en\">\n <Hyperlink destination={destinationUrl} className=\"p-0\">\n {image}\n </Hyperlink>\n </IntlProvider>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BarContext.js","sourceRoot":"","sources":["../../../../shell/dev/devHeader/BarContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA4B,MAAM,OAAO,CAAC;AAK/D,CAAC;AAEF,MAAM,UAAU,GAAG,aAAa,CAAsB;IACpD,GAAG,EAAE,EAAE;IACP,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC;CAClB,CAAC,CAAC;AAEH,eAAe,UAAU,CAAC","sourcesContent":["import { createContext, Dispatch, SetStateAction } from 'react';\n\ninterface BarContextInterface {\n bar: string
|
|
1
|
+
{"version":3,"file":"BarContext.js","sourceRoot":"","sources":["../../../../shell/dev/devHeader/BarContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA4B,MAAM,OAAO,CAAC;AAK/D,CAAC;AAEF,MAAM,UAAU,GAAG,aAAa,CAAsB;IACpD,GAAG,EAAE,EAAE;IACP,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC;CAClB,CAAC,CAAC;AAEH,eAAe,UAAU,CAAC","sourcesContent":["import { createContext, Dispatch, SetStateAction } from 'react';\n\ninterface BarContextInterface {\n bar: string;\n setBar: Dispatch<SetStateAction<string>>;\n};\n\nconst BarContext = createContext<BarContextInterface>({\n bar: '',\n setBar: () => { }\n});\n\nexport default BarContext;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BarProvider.js","sourceRoot":"","sources":["../../../../shell/dev/devHeader/BarProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAa,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,SAAS,MAAM;IACb,OAAO,KAAK,CAAC;AACf,CAAC;AAMD,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,QAAQ,EAAoB;IAChE,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IAEzC,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACrC,GAAG;QACH,MAAM;KACP,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;IAEnB,OAAO,CACL,KAAC,UAAU,CAAC,QAAQ,IAAC,KAAK,EAAE,eAAe,YACxC,QAAQ,GACW,CACvB,CAAC;AACJ,CAAC;AAAA,CAAC","sourcesContent":["import { ReactNode, useMemo, useState } from 'react';\nimport BarContext from './BarContext';\n\nfunction getBar() {\n return 'Bar';\n}\n\ninterface BarProviderProps {\n children?: ReactNode
|
|
1
|
+
{"version":3,"file":"BarProvider.js","sourceRoot":"","sources":["../../../../shell/dev/devHeader/BarProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAa,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,SAAS,MAAM;IACb,OAAO,KAAK,CAAC;AACf,CAAC;AAMD,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,QAAQ,EAAoB;IAChE,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IAEzC,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACrC,GAAG;QACH,MAAM;KACP,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;IAEnB,OAAO,CACL,KAAC,UAAU,CAAC,QAAQ,IAAC,KAAK,EAAE,eAAe,YACxC,QAAQ,GACW,CACvB,CAAC;AACJ,CAAC;AAAA,CAAC","sourcesContent":["import { ReactNode, useMemo, useState } from 'react';\nimport BarContext from './BarContext';\n\nfunction getBar() {\n return 'Bar';\n}\n\ninterface BarProviderProps {\n children?: ReactNode;\n}\n\nexport default function BarProvider({ children }: BarProviderProps) {\n const [bar, setBar] = useState(getBar());\n\n const barContextValue = useMemo(() => ({\n bar,\n setBar,\n }), [bar, setBar]);\n\n return (\n <BarContext.Provider value={barContextValue}>\n {children}\n </BarContext.Provider>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FooContext.js","sourceRoot":"","sources":["../../../../shell/dev/devHeader/FooContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA4B,MAAM,OAAO,CAAC;AAK/D,CAAC;AAEF,MAAM,UAAU,GAAG,aAAa,CAAsB;IACpD,GAAG,EAAE,EAAE;IACP,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC;CAClB,CAAC,CAAC;AAEH,eAAe,UAAU,CAAC","sourcesContent":["import { createContext, Dispatch, SetStateAction } from 'react';\n\ninterface FooContextInterface {\n foo: string
|
|
1
|
+
{"version":3,"file":"FooContext.js","sourceRoot":"","sources":["../../../../shell/dev/devHeader/FooContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA4B,MAAM,OAAO,CAAC;AAK/D,CAAC;AAEF,MAAM,UAAU,GAAG,aAAa,CAAsB;IACpD,GAAG,EAAE,EAAE;IACP,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC;CAClB,CAAC,CAAC;AAEH,eAAe,UAAU,CAAC","sourcesContent":["import { createContext, Dispatch, SetStateAction } from 'react';\n\ninterface FooContextInterface {\n foo: string;\n setFoo: Dispatch<SetStateAction<string>>;\n};\n\nconst FooContext = createContext<FooContextInterface>({\n foo: '',\n setFoo: () => { }\n});\n\nexport default FooContext;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FooProvider.js","sourceRoot":"","sources":["../../../../shell/dev/devHeader/FooProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAa,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,SAAS,MAAM;IACb,OAAO,KAAK,CAAC;AACf,CAAC;AAMD,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,QAAQ,EAAoB;IAChE,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IAEzC,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACrC,GAAG;QACH,MAAM;KACP,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;IAEnB,OAAO,CACL,KAAC,UAAU,CAAC,QAAQ,IAAC,KAAK,EAAE,eAAe,YACxC,QAAQ,GACW,CACvB,CAAC;AACJ,CAAC;AAAA,CAAC","sourcesContent":["import { ReactNode, useMemo, useState } from 'react';\nimport FooContext from './FooContext';\n\nfunction getFoo() {\n return 'Foo';\n}\n\ninterface FooProviderProps {\n children?: ReactNode
|
|
1
|
+
{"version":3,"file":"FooProvider.js","sourceRoot":"","sources":["../../../../shell/dev/devHeader/FooProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAa,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,SAAS,MAAM;IACb,OAAO,KAAK,CAAC;AACf,CAAC;AAMD,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,QAAQ,EAAoB;IAChE,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IAEzC,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACrC,GAAG;QACH,MAAM;KACP,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;IAEnB,OAAO,CACL,KAAC,UAAU,CAAC,QAAQ,IAAC,KAAK,EAAE,eAAe,YACxC,QAAQ,GACW,CACvB,CAAC;AACJ,CAAC;AAAA,CAAC","sourcesContent":["import { ReactNode, useMemo, useState } from 'react';\nimport FooContext from './FooContext';\n\nfunction getFoo() {\n return 'Foo';\n}\n\ninterface FooProviderProps {\n children?: ReactNode;\n}\n\nexport default function FooProvider({ children }: FooProviderProps) {\n const [foo, setFoo] = useState(getFoo());\n\n const fooContextValue = useMemo(() => ({\n foo,\n setFoo,\n }), [foo, setFoo]);\n\n return (\n <FooContext.Provider value={fooContextValue}>\n {children}\n </FooContext.Provider>\n );\n};\n"]}
|