@uxland/primary-shell 7.3.0 → 7.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +29 -12
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +3 -3
- package/dist/index.umd.cjs.map +1 -1
- package/dist/primary/shell/src/UI/bootstrapper.d.ts +1 -1
- package/dist/primary/shell/src/UI/internal-views/handle-views.d.ts +1 -1
- package/dist/primary/shell/src/api/api.d.ts +2 -0
- package/dist/primary/shell/src/api/user-manager/user-manager.d.ts +12 -0
- package/dist/primary/shell/src/bootstrapper.d.ts +1 -1
- package/dist/primary/shell/src/handle-plugins.d.ts +1 -1
- package/package.json +1 -1
- package/src/UI/bootstrapper.ts +2 -2
- package/src/UI/internal-views/handle-views.ts +4 -3
- package/src/api/api.ts +4 -0
- package/src/api/user-manager/user-manager.ts +45 -0
- package/src/bootstrapper.ts +2 -2
- package/src/handle-plugins.ts +6 -6
- package/dist/primary/shell/src/domain/is-user-role-administrative.d.ts +0 -1
- package/src/domain/is-user-role-administrative.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -9641,7 +9641,23 @@ class TokenManagerImpl {
|
|
|
9641
9641
|
}
|
|
9642
9642
|
}
|
|
9643
9643
|
let tokenManager$1;
|
|
9644
|
-
const createTokenManager = () => tokenManager$1 || (tokenManager$1 = new TokenManagerImpl(), tokenManager$1.initToken(), tokenManager$1)
|
|
9644
|
+
const createTokenManager = () => tokenManager$1 || (tokenManager$1 = new TokenManagerImpl(), tokenManager$1.initToken(), tokenManager$1);
|
|
9645
|
+
class UserManagerImpl {
|
|
9646
|
+
constructor(J) {
|
|
9647
|
+
this.tokenManager = J, this.getRole = () => {
|
|
9648
|
+
const X = this.tokenManager.getToken();
|
|
9649
|
+
if (X)
|
|
9650
|
+
try {
|
|
9651
|
+
return jwtDecode(X).access_info?.role_type;
|
|
9652
|
+
} catch (re) {
|
|
9653
|
+
console.error("Error decoding JWT token:", re);
|
|
9654
|
+
return;
|
|
9655
|
+
}
|
|
9656
|
+
}, this.isUserRoleAdministrative = () => this.getRole() === "ADM";
|
|
9657
|
+
}
|
|
9658
|
+
}
|
|
9659
|
+
let userManager$1;
|
|
9660
|
+
const createUserManager = (te) => userManager$1 || (userManager$1 = new UserManagerImpl(te), userManager$1), broker$1 = createBroker(), regionManager = x$a("primaria"), PrimariaRegionHost = d$o(regionManager), tokenManager = createTokenManager(), userManager = createUserManager(tokenManager), globalStateManager = createGlobalStateManager(broker$1), pluginBusyManager = new PluginBusyManagerImpl(broker$1), interactionService = new ParimariaInteractionServiceImpl(), notificationService = new PrimariaNotificationServiceImpl(), ecapEventManager = createEcapEventManager(), pdfViewerManager = createPdfViewerManager(broker$1, notificationService), primariaApiFactory = (te) => {
|
|
9645
9661
|
const J = createRegionManagerProxy(te, regionManager, broker$1);
|
|
9646
9662
|
return {
|
|
9647
9663
|
pluginInfo: te,
|
|
@@ -9651,6 +9667,7 @@ const createTokenManager = () => tokenManager$1 || (tokenManager$1 = new TokenMa
|
|
|
9651
9667
|
createLocaleManager: createLocaleManager(te.pluginId),
|
|
9652
9668
|
globalStateManager,
|
|
9653
9669
|
tokenManager,
|
|
9670
|
+
userManager,
|
|
9654
9671
|
ecapEventManager,
|
|
9655
9672
|
pluginBusyManager,
|
|
9656
9673
|
interactionService,
|
|
@@ -16132,7 +16149,7 @@ const registerViews = async (te) => {
|
|
|
16132
16149
|
te.regionManager.removeView(te.regionManager.regions.shell.main, te.pluginInfo.pluginId), te.regionManager.removeView(te.regionManager.regions.shell.navigationMenu, te.pluginInfo.pluginId);
|
|
16133
16150
|
}, activateClinicalMonitoringView = (te) => {
|
|
16134
16151
|
te.regionManager.activateMainView(te.pluginInfo.pluginId);
|
|
16135
|
-
}, initialize = async (te) => (registerViews(te), Promise.resolve()), dispose = (te) => (unregisterViews(te), Promise.resolve())
|
|
16152
|
+
}, initialize = async (te) => (registerViews(te), Promise.resolve()), dispose = (te) => (unregisterViews(te), Promise.resolve());
|
|
16136
16153
|
let bootstrappedPlugins = [];
|
|
16137
16154
|
const commonPlugins = [
|
|
16138
16155
|
{
|
|
@@ -16158,8 +16175,8 @@ const commonPlugins = [
|
|
|
16158
16175
|
dispose
|
|
16159
16176
|
})
|
|
16160
16177
|
}
|
|
16161
|
-
], getPluginsByUserRole = (te) =>
|
|
16162
|
-
const re = getPluginsByUserRole(J).concat(te || []);
|
|
16178
|
+
], getPluginsByUserRole = (te) => te ? commonPlugins.concat(administrativeInternalPlugins) : commonPlugins.concat(doctorInternalPlugins), bootstrapPlugins = async (te) => {
|
|
16179
|
+
const J = shellApi.userManager.isUserRoleAdministrative(), re = getPluginsByUserRole(J).concat(te || []);
|
|
16163
16180
|
bootstrappedPlugins = await v$i(re, primariaApiFactory);
|
|
16164
16181
|
}, disposePlugins = async () => Promise.all(bootstrappedPlugins.map((te) => te?.dispose()));
|
|
16165
16182
|
var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor, __decorateClass$g = (te, J, X, re) => {
|
|
@@ -45024,17 +45041,17 @@ const commonNavMenuItems = [{
|
|
|
45024
45041
|
});
|
|
45025
45042
|
}, registerMainViews = () => {
|
|
45026
45043
|
registerPDFVisorMainView();
|
|
45027
|
-
}, useInternalViews = (
|
|
45028
|
-
registerMainViews(), isUserRoleAdministrative(
|
|
45029
|
-
}, useUI = (
|
|
45044
|
+
}, useInternalViews = () => {
|
|
45045
|
+
registerMainViews(), shellApi.userManager.isUserRoleAdministrative() ? registerAdministrativeNavMenuViews() : registerDoctorNavMenuViews();
|
|
45046
|
+
}, useUI = () => {
|
|
45030
45047
|
p$f.registerAdapterFactory(
|
|
45031
45048
|
"primaria-content-switcher",
|
|
45032
45049
|
d$u
|
|
45033
|
-
), useSharedUI(), useComponents(), useInternalViews(
|
|
45034
|
-
}, initializeShell = (te
|
|
45035
|
-
useLocalization(shellApi), useUI(
|
|
45036
|
-
const
|
|
45037
|
-
te.appendChild(
|
|
45050
|
+
), useSharedUI(), useComponents(), useInternalViews();
|
|
45051
|
+
}, initializeShell = (te) => {
|
|
45052
|
+
useLocalization(shellApi), useUI(), useFeatures(shellApi);
|
|
45053
|
+
const J = new PrimariaShell();
|
|
45054
|
+
te.appendChild(J);
|
|
45038
45055
|
};
|
|
45039
45056
|
class n extends HTMLElement {
|
|
45040
45057
|
constructor(J, X, re = {}) {
|