sevago-sso-fe 1.0.46 → 1.0.47

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.esm.js CHANGED
@@ -8127,6 +8127,26 @@ var AppGroup = /* @__PURE__ */ ((AppGroup2) => {
8127
8127
  AppGroup2["CLIENT"] = "Web";
8128
8128
  return AppGroup2;
8129
8129
  })(AppGroup || {});
8130
+ var App = /* @__PURE__ */ ((App2) => {
8131
+ App2["E_HIRING"] = "Tuyển dụng";
8132
+ App2["HR"] = "Nhân sự";
8133
+ App2["PAYROLL"] = "Tính lương";
8134
+ App2["ORG"] = "Sơ đồ tổ chức";
8135
+ App2["CHECKIN"] = "Chấm công";
8136
+ App2["PROJECT"] = "Dự án";
8137
+ App2["REQUEST"] = "Đề xuất";
8138
+ App2["PROCESS"] = "Quy trình";
8139
+ App2["TRACKING"] = "Tiến trình";
8140
+ App2["CHAT"] = "Chat";
8141
+ App2["TRAINING"] = "Đào tạo";
8142
+ App2["FORM"] = "Biểu mẫu";
8143
+ App2["INSIDE"] = "Thông tin & CSNV";
8144
+ App2["BOOKING"] = "Tài nguyên";
8145
+ App2["FORMULA_PRICE"] = "Tính giá";
8146
+ App2["E_CATALOGUE"] = "E-Catalogue";
8147
+ App2["LANDING_PAGE"] = "Landing page";
8148
+ return App2;
8149
+ })(App || {});
8130
8150
  const APP_GROUP_COLOR = {
8131
8151
  [
8132
8152
  "Workflow Engine"
@@ -8388,6 +8408,76 @@ const APP_OBJ = {
8388
8408
  ]
8389
8409
  }
8390
8410
  };
8411
+ const generateOfficeAppUrl = (path, baseUrl) => ({
8412
+ development: `${baseUrl.development}/${path}`,
8413
+ staging: `${baseUrl.staging}/${path}`,
8414
+ production: `${baseUrl.production}/${path}`
8415
+ });
8416
+ const OFFICE_BASE_URL = {
8417
+ development: "https://dev.admin.office.sevago.local",
8418
+ staging: "https://sta.admin.office.sevago.local",
8419
+ production: "https://admin.office.sevago.local"
8420
+ };
8421
+ const getAppEnvKey$1 = (appKey) => {
8422
+ const enumKey = Object.keys(App).find(
8423
+ (key) => App[key] === appKey
8424
+ );
8425
+ return enumKey || null;
8426
+ };
8427
+ const generateOfficeAppsEnv = () => {
8428
+ const officeApps = {};
8429
+ const officeAppKeys = [
8430
+ "Tuyển dụng",
8431
+ "Nhân sự",
8432
+ "Tính lương",
8433
+ "Sơ đồ tổ chức",
8434
+ "Chấm công",
8435
+ "Chat",
8436
+ "Đào tạo",
8437
+ "Biểu mẫu",
8438
+ "Thông tin & CSNV",
8439
+ "Tài nguyên",
8440
+ "Tiến trình",
8441
+ "Đề xuất",
8442
+ "Dự án",
8443
+ "Quy trình"
8444
+ /* PROCESS */
8445
+ ];
8446
+ officeAppKeys.forEach((appKey) => {
8447
+ const appInfo = APP_OBJ[appKey];
8448
+ const envKey = getAppEnvKey$1(appKey);
8449
+ if (appInfo && envKey) {
8450
+ officeApps[envKey] = generateOfficeAppUrl(appInfo.path, OFFICE_BASE_URL);
8451
+ }
8452
+ });
8453
+ return officeApps;
8454
+ };
8455
+ const APPS_ENV = {
8456
+ // url khi ấn đẩy về home sso
8457
+ SSO: {
8458
+ development: "https://dev.account.sevago.local",
8459
+ staging: "https://sta.account.sevago.local",
8460
+ production: "https://account.sevago.com.vn"
8461
+ },
8462
+ // Các url dành cho office - tự động generate từ APP_OBJ
8463
+ ...generateOfficeAppsEnv(),
8464
+ // Các url ở các app khác
8465
+ FORMULA_PRICE: {
8466
+ development: "https://dev.formula-price.sevago.local",
8467
+ staging: "https://sta.formula-price.sevago.local",
8468
+ production: "https://formula-price.sevago.local"
8469
+ },
8470
+ E_CATALOGUE: {
8471
+ development: "https://dev.admin.e-catalogue.sevago.local",
8472
+ staging: "https://sta.admin.e-catalogue.sevago.local",
8473
+ production: "https://admin.e-catalogue.sevago.local"
8474
+ },
8475
+ LANDING_PAGE: {
8476
+ development: "https://dev.admin.landing-page.sevago.local",
8477
+ staging: "https://sta.admin.landing-page.sevago.local",
8478
+ production: "https://admin.landing-page.sevago.com.vn"
8479
+ }
8480
+ };
8391
8481
  const findCurrentAccessByPath = (pathname) => {
8392
8482
  for (const module of Object.values(APP_OBJ)) {
8393
8483
  if (module.path && pathname.includes(module.path)) {
@@ -9082,6 +9172,36 @@ const truncateText = (text, maxLength = 27) => {
9082
9172
  }
9083
9173
  return `${text.substring(0, maxLength)}...`;
9084
9174
  };
9175
+ var Environment = /* @__PURE__ */ ((Environment2) => {
9176
+ Environment2["DEVELOPMENT"] = "development";
9177
+ Environment2["STAGING"] = "staging";
9178
+ Environment2["PRODUCTION"] = "production";
9179
+ return Environment2;
9180
+ })(Environment || {});
9181
+ const getAppEnvKey = (appKey) => {
9182
+ const enumKey = Object.keys(App).find(
9183
+ (key) => App[key] === appKey
9184
+ );
9185
+ return enumKey || null;
9186
+ };
9187
+ const getCurrentEnvironment = () => {
9188
+ const { hostname } = window.location;
9189
+ if (hostname.includes("dev.")) return "development";
9190
+ if (hostname.includes("sta.")) return "staging";
9191
+ return "production";
9192
+ };
9193
+ const getAppUrl = (app, env) => {
9194
+ const environment = env || getCurrentEnvironment();
9195
+ const appKey = Object.keys(APP_OBJ).find(
9196
+ (key) => APP_OBJ[key].path === app.path
9197
+ );
9198
+ if (!appKey) return null;
9199
+ const envKey = getAppEnvKey(appKey);
9200
+ if (!envKey || !(envKey in APPS_ENV)) return null;
9201
+ const envConfig = APPS_ENV[envKey];
9202
+ return envConfig[environment] || null;
9203
+ };
9204
+ const getSsoUrl = (env) => APPS_ENV.SSO[env || getCurrentEnvironment()];
9085
9205
  const timeUtils = timeUtilsMethods;
9086
9206
  const useApps = (tab = AppGroup.ALL) => {
9087
9207
  const listApp = useMemo(() => {
@@ -24188,7 +24308,8 @@ const AppGrid = ({
24188
24308
  titleVariant = "subtitle1",
24189
24309
  titleColor,
24190
24310
  selectedAppId,
24191
- showPagination = true
24311
+ showPagination = true,
24312
+ getAppUrl: getAppUrl2
24192
24313
  }) => {
24193
24314
  const theme = useTheme();
24194
24315
  const pageSize = Math.max(1, columns * Math.max(1, rows));
@@ -24201,7 +24322,7 @@ const AppGrid = ({
24201
24322
  const start = page * pageSize;
24202
24323
  const end = start + pageSize;
24203
24324
  const visibleApps = totalPages > 1 ? apps.slice(start, end) : apps;
24204
- const findLink = (app) => app.path;
24325
+ const findLink = (app) => getAppUrl2 ? getAppUrl2(app) : app.path;
24205
24326
  return /* @__PURE__ */ jsxs(Box, { sx: { position: "relative" }, children: [
24206
24327
  /* @__PURE__ */ jsx(
24207
24328
  Box,
@@ -24802,14 +24923,22 @@ const TypographyContentCaption = ({
24802
24923
  )
24803
24924
  ] });
24804
24925
  };
24805
- const SystemMonitorSidebarPart = ({ position, blacklist }) => {
24926
+ const SystemMonitorSidebarPart = ({ position, blacklist, env }) => {
24806
24927
  const { isSidebarOpen, openSidebar, closeSidebar } = useSidebarState();
24928
+ const handleIconClick = () => {
24929
+ const ssoUrl = getSsoUrl(env);
24930
+ if (ssoUrl) {
24931
+ window.location.href = ssoUrl;
24932
+ } else {
24933
+ openSidebar();
24934
+ }
24935
+ };
24807
24936
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
24808
24937
  /* @__PURE__ */ jsx(
24809
24938
  ImageElement,
24810
24939
  {
24811
24940
  url: IconAppsSidebar,
24812
- onClick: openSidebar,
24941
+ onClick: handleIconClick,
24813
24942
  sizeType: ImageSizeType.SQUARE,
24814
24943
  sx: { width: MAP_SIZE.medium.width, height: MAP_SIZE.medium.height }
24815
24944
  }
@@ -24836,7 +24965,8 @@ const TypographyFilter = styled$2(Typography)(({ theme }) => ({
24836
24965
  padding: `0px ${PADDING_GAP_LAYOUT}`
24837
24966
  }));
24838
24967
  const SystemMonitorScreen = ({
24839
- blacklist
24968
+ blacklist,
24969
+ env
24840
24970
  }) => {
24841
24971
  const theme = useTheme();
24842
24972
  const dispatch = useAppDispatch();
@@ -24933,6 +25063,7 @@ const SystemMonitorScreen = ({
24933
25063
  iconRadius: 7,
24934
25064
  gap: PADDING_GAP_TAB,
24935
25065
  selectedAppId: currentApp?.path,
25066
+ getAppUrl: (app) => getAppUrl(app, env) || app.path,
24936
25067
  onClickItem: async (app) => {
24937
25068
  await dispatch(
24938
25069
  ACTION_ACCOUNT.updateCurrentAccess(app.path)
@@ -25010,6 +25141,7 @@ export {
25010
25141
  DashboardPage,
25011
25142
  DefaultLayout,
25012
25143
  EmptyComponent,
25144
+ Environment,
25013
25145
  ErrorPage,
25014
25146
  ForgotPasswordType,
25015
25147
  Gender,
@@ -25107,6 +25239,8 @@ export {
25107
25239
  extractNumberAtStartString,
25108
25240
  findCurrentAccessByPath,
25109
25241
  forgotPassword,
25242
+ getAppUrl,
25243
+ getCurrentEnvironment,
25110
25244
  getDate,
25111
25245
  getDateTime,
25112
25246
  getDayOffsetPx,
@@ -25117,6 +25251,7 @@ export {
25117
25251
  getListUser,
25118
25252
  getListUserRelations,
25119
25253
  getMonthRangeForYear,
25254
+ getSsoUrl,
25120
25255
  getTimeAgo,
25121
25256
  getTimeDate,
25122
25257
  getUser,