@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 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), broker$1 = createBroker(), regionManager = x$a("primaria"), PrimariaRegionHost = d$o(regionManager), tokenManager = createTokenManager(), globalStateManager = createGlobalStateManager(broker$1), pluginBusyManager = new PluginBusyManagerImpl(broker$1), interactionService = new ParimariaInteractionServiceImpl(), notificationService = new PrimariaNotificationServiceImpl(), ecapEventManager = createEcapEventManager(), pdfViewerManager = createPdfViewerManager(broker$1, notificationService), primariaApiFactory = (te) => {
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()), isUserRoleAdministrative = (te) => te === "ADM";
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) => isUserRoleAdministrative(te) ? commonPlugins.concat(administrativeInternalPlugins) : commonPlugins.concat(doctorInternalPlugins), bootstrapPlugins = async (te, J) => {
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 = (te) => {
45028
- registerMainViews(), isUserRoleAdministrative(te) ? registerAdministrativeNavMenuViews() : registerDoctorNavMenuViews();
45029
- }, useUI = (te) => {
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(te);
45034
- }, initializeShell = (te, J) => {
45035
- useLocalization(shellApi), useUI(J), useFeatures(shellApi);
45036
- const X = new PrimariaShell();
45037
- te.appendChild(X);
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 = {}) {