sevago-sso-fe 1.0.45 → 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.
@@ -42,3 +42,25 @@ export declare const APP_GROUP_COLOR: {
42
42
  Khác: string;
43
43
  };
44
44
  export declare const APP_OBJ: Record<string, AppInfo>;
45
+ export declare const APPS_ENV: {
46
+ FORMULA_PRICE: {
47
+ development: string;
48
+ staging: string;
49
+ production: string;
50
+ };
51
+ E_CATALOGUE: {
52
+ development: string;
53
+ staging: string;
54
+ production: string;
55
+ };
56
+ LANDING_PAGE: {
57
+ development: string;
58
+ staging: string;
59
+ production: string;
60
+ };
61
+ SSO: {
62
+ development: string;
63
+ staging: string;
64
+ production: string;
65
+ };
66
+ };
@@ -0,0 +1,9 @@
1
+ import { AppInfo } from '../../constant/apps.data';
2
+ export declare enum Environment {
3
+ DEVELOPMENT = "development",
4
+ STAGING = "staging",
5
+ PRODUCTION = "production"
6
+ }
7
+ export declare const getCurrentEnvironment: () => Environment;
8
+ export declare const getAppUrl: (app: AppInfo, env: Environment) => string | null;
9
+ export declare const getSsoUrl: (env: Environment) => string;
@@ -1 +1,2 @@
1
1
  export * from './get-limit-line-css.utils';
2
+ export * from './app.utils';
@@ -15,5 +15,6 @@ export interface AppGridProps {
15
15
  captionColor?: string;
16
16
  selectedAppId?: string;
17
17
  showPagination?: boolean;
18
+ getAppUrl?: (app: AppInfo) => string | null;
18
19
  }
19
20
  export declare const AppGrid: React.FC<AppGridProps>;
@@ -1,3 +1,2 @@
1
1
  export { IconButtonElement } from './icon-button.element';
2
- export { IconContentElement } from './icon-content.element';
3
2
  export { IconElement } from './icon.element';
@@ -1,2 +1 @@
1
1
  export { RadioElement } from './radio.element';
2
- export { RadioGroupElement } from './radio-group.element';
@@ -1,2 +1 @@
1
1
  export { TooltipOnClickElement } from './tooltip-on-click.element';
2
- export { TooltipOnHoverElement } from './tooltip-on-hover.element';
@@ -1,5 +1,7 @@
1
+ import { Environment } from '../../common/utils/other/app.utils';
1
2
  export interface SystemMonitorSidebarPartProps {
2
3
  position?: "left" | "right";
3
4
  blacklist?: string[];
5
+ env: Environment;
4
6
  }
5
7
  export declare const SystemMonitorSidebarPart: React.FC<SystemMonitorSidebarPartProps>;
package/dist/index.cjs.js CHANGED
@@ -8145,6 +8145,26 @@ var AppGroup = /* @__PURE__ */ ((AppGroup2) => {
8145
8145
  AppGroup2["CLIENT"] = "Web";
8146
8146
  return AppGroup2;
8147
8147
  })(AppGroup || {});
8148
+ var App = /* @__PURE__ */ ((App2) => {
8149
+ App2["E_HIRING"] = "Tuyển dụng";
8150
+ App2["HR"] = "Nhân sự";
8151
+ App2["PAYROLL"] = "Tính lương";
8152
+ App2["ORG"] = "Sơ đồ tổ chức";
8153
+ App2["CHECKIN"] = "Chấm công";
8154
+ App2["PROJECT"] = "Dự án";
8155
+ App2["REQUEST"] = "Đề xuất";
8156
+ App2["PROCESS"] = "Quy trình";
8157
+ App2["TRACKING"] = "Tiến trình";
8158
+ App2["CHAT"] = "Chat";
8159
+ App2["TRAINING"] = "Đào tạo";
8160
+ App2["FORM"] = "Biểu mẫu";
8161
+ App2["INSIDE"] = "Thông tin & CSNV";
8162
+ App2["BOOKING"] = "Tài nguyên";
8163
+ App2["FORMULA_PRICE"] = "Tính giá";
8164
+ App2["E_CATALOGUE"] = "E-Catalogue";
8165
+ App2["LANDING_PAGE"] = "Landing page";
8166
+ return App2;
8167
+ })(App || {});
8148
8168
  const APP_GROUP_COLOR = {
8149
8169
  [
8150
8170
  "Workflow Engine"
@@ -8335,7 +8355,7 @@ const APP_OBJ = {
8335
8355
  "Tiến trình"
8336
8356
  /* TRACKING */
8337
8357
  ]: {
8338
- path: "workflow",
8358
+ path: "process",
8339
8359
  //
8340
8360
  icon: sevagoIcon,
8341
8361
  //
@@ -8352,7 +8372,7 @@ const APP_OBJ = {
8352
8372
  "Quy trình"
8353
8373
  /* PROCESS */
8354
8374
  ]: {
8355
- path: "process",
8375
+ path: "workflow",
8356
8376
  // Quy trình
8357
8377
  icon: sevagoIcon,
8358
8378
  content: "Sevago - Quy trình",
@@ -8406,6 +8426,76 @@ const APP_OBJ = {
8406
8426
  ]
8407
8427
  }
8408
8428
  };
8429
+ const generateOfficeAppUrl = (path, baseUrl) => ({
8430
+ development: `${baseUrl.development}/${path}`,
8431
+ staging: `${baseUrl.staging}/${path}`,
8432
+ production: `${baseUrl.production}/${path}`
8433
+ });
8434
+ const OFFICE_BASE_URL = {
8435
+ development: "https://dev.admin.office.sevago.local",
8436
+ staging: "https://sta.admin.office.sevago.local",
8437
+ production: "https://admin.office.sevago.local"
8438
+ };
8439
+ const getAppEnvKey$1 = (appKey) => {
8440
+ const enumKey = Object.keys(App).find(
8441
+ (key) => App[key] === appKey
8442
+ );
8443
+ return enumKey || null;
8444
+ };
8445
+ const generateOfficeAppsEnv = () => {
8446
+ const officeApps = {};
8447
+ const officeAppKeys = [
8448
+ "Tuyển dụng",
8449
+ "Nhân sự",
8450
+ "Tính lương",
8451
+ "Sơ đồ tổ chức",
8452
+ "Chấm công",
8453
+ "Chat",
8454
+ "Đào tạo",
8455
+ "Biểu mẫu",
8456
+ "Thông tin & CSNV",
8457
+ "Tài nguyên",
8458
+ "Tiến trình",
8459
+ "Đề xuất",
8460
+ "Dự án",
8461
+ "Quy trình"
8462
+ /* PROCESS */
8463
+ ];
8464
+ officeAppKeys.forEach((appKey) => {
8465
+ const appInfo = APP_OBJ[appKey];
8466
+ const envKey = getAppEnvKey$1(appKey);
8467
+ if (appInfo && envKey) {
8468
+ officeApps[envKey] = generateOfficeAppUrl(appInfo.path, OFFICE_BASE_URL);
8469
+ }
8470
+ });
8471
+ return officeApps;
8472
+ };
8473
+ const APPS_ENV = {
8474
+ // url khi ấn đẩy về home sso
8475
+ SSO: {
8476
+ development: "https://dev.account.sevago.local",
8477
+ staging: "https://sta.account.sevago.local",
8478
+ production: "https://account.sevago.com.vn"
8479
+ },
8480
+ // Các url dành cho office - tự động generate từ APP_OBJ
8481
+ ...generateOfficeAppsEnv(),
8482
+ // Các url ở các app khác
8483
+ FORMULA_PRICE: {
8484
+ development: "https://dev.formula-price.sevago.local",
8485
+ staging: "https://sta.formula-price.sevago.local",
8486
+ production: "https://formula-price.sevago.local"
8487
+ },
8488
+ E_CATALOGUE: {
8489
+ development: "https://dev.admin.e-catalogue.sevago.local",
8490
+ staging: "https://sta.admin.e-catalogue.sevago.local",
8491
+ production: "https://admin.e-catalogue.sevago.local"
8492
+ },
8493
+ LANDING_PAGE: {
8494
+ development: "https://dev.admin.landing-page.sevago.local",
8495
+ staging: "https://sta.admin.landing-page.sevago.local",
8496
+ production: "https://admin.landing-page.sevago.com.vn"
8497
+ }
8498
+ };
8409
8499
  const findCurrentAccessByPath = (pathname) => {
8410
8500
  for (const module2 of Object.values(APP_OBJ)) {
8411
8501
  if (module2.path && pathname.includes(module2.path)) {
@@ -9100,6 +9190,36 @@ const truncateText = (text, maxLength = 27) => {
9100
9190
  }
9101
9191
  return `${text.substring(0, maxLength)}...`;
9102
9192
  };
9193
+ var Environment = /* @__PURE__ */ ((Environment2) => {
9194
+ Environment2["DEVELOPMENT"] = "development";
9195
+ Environment2["STAGING"] = "staging";
9196
+ Environment2["PRODUCTION"] = "production";
9197
+ return Environment2;
9198
+ })(Environment || {});
9199
+ const getAppEnvKey = (appKey) => {
9200
+ const enumKey = Object.keys(App).find(
9201
+ (key) => App[key] === appKey
9202
+ );
9203
+ return enumKey || null;
9204
+ };
9205
+ const getCurrentEnvironment = () => {
9206
+ const { hostname } = window.location;
9207
+ if (hostname.includes("dev.")) return "development";
9208
+ if (hostname.includes("sta.")) return "staging";
9209
+ return "production";
9210
+ };
9211
+ const getAppUrl = (app, env) => {
9212
+ const environment = env || getCurrentEnvironment();
9213
+ const appKey = Object.keys(APP_OBJ).find(
9214
+ (key) => APP_OBJ[key].path === app.path
9215
+ );
9216
+ if (!appKey) return null;
9217
+ const envKey = getAppEnvKey(appKey);
9218
+ if (!envKey || !(envKey in APPS_ENV)) return null;
9219
+ const envConfig = APPS_ENV[envKey];
9220
+ return envConfig[environment] || null;
9221
+ };
9222
+ const getSsoUrl = (env) => APPS_ENV.SSO[env || getCurrentEnvironment()];
9103
9223
  const timeUtils = timeUtilsMethods;
9104
9224
  const useApps = (tab = AppGroup.ALL) => {
9105
9225
  const listApp = React.useMemo(() => {
@@ -24206,7 +24326,8 @@ const AppGrid = ({
24206
24326
  titleVariant = "subtitle1",
24207
24327
  titleColor,
24208
24328
  selectedAppId,
24209
- showPagination = true
24329
+ showPagination = true,
24330
+ getAppUrl: getAppUrl2
24210
24331
  }) => {
24211
24332
  const theme = useTheme();
24212
24333
  const pageSize = Math.max(1, columns * Math.max(1, rows));
@@ -24219,7 +24340,7 @@ const AppGrid = ({
24219
24340
  const start = page * pageSize;
24220
24341
  const end = start + pageSize;
24221
24342
  const visibleApps = totalPages > 1 ? apps.slice(start, end) : apps;
24222
- const findLink = (app) => app.path;
24343
+ const findLink = (app) => getAppUrl2 ? getAppUrl2(app) : app.path;
24223
24344
  return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { position: "relative" }, children: [
24224
24345
  /* @__PURE__ */ jsxRuntime.jsx(
24225
24346
  material.Box,
@@ -24587,6 +24708,9 @@ const AppsSidebar = ({
24587
24708
  captionColor: theme.palette.grey[600],
24588
24709
  selectedAppId: currentApp?.path,
24589
24710
  onClickItem: async (app) => {
24711
+ if (app.path === currentApp?.path) {
24712
+ return;
24713
+ }
24590
24714
  await dispatch(
24591
24715
  ACTION_ACCOUNT.resetCurrentAccessToBase(app.path)
24592
24716
  ).unwrap();
@@ -24817,14 +24941,22 @@ const TypographyContentCaption = ({
24817
24941
  )
24818
24942
  ] });
24819
24943
  };
24820
- const SystemMonitorSidebarPart = ({ position, blacklist }) => {
24944
+ const SystemMonitorSidebarPart = ({ position, blacklist, env }) => {
24821
24945
  const { isSidebarOpen, openSidebar, closeSidebar } = useSidebarState();
24946
+ const handleIconClick = () => {
24947
+ const ssoUrl = getSsoUrl(env);
24948
+ if (ssoUrl) {
24949
+ window.location.href = ssoUrl;
24950
+ } else {
24951
+ openSidebar();
24952
+ }
24953
+ };
24822
24954
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
24823
24955
  /* @__PURE__ */ jsxRuntime.jsx(
24824
24956
  ImageElement,
24825
24957
  {
24826
24958
  url: IconAppsSidebar,
24827
- onClick: openSidebar,
24959
+ onClick: handleIconClick,
24828
24960
  sizeType: ImageSizeType.SQUARE,
24829
24961
  sx: { width: MAP_SIZE.medium.width, height: MAP_SIZE.medium.height }
24830
24962
  }
@@ -24851,7 +24983,8 @@ const TypographyFilter = material.styled(material.Typography)(({ theme }) => ({
24851
24983
  padding: `0px ${PADDING_GAP_LAYOUT}`
24852
24984
  }));
24853
24985
  const SystemMonitorScreen = ({
24854
- blacklist
24986
+ blacklist,
24987
+ env
24855
24988
  }) => {
24856
24989
  const theme = useTheme();
24857
24990
  const dispatch = useAppDispatch();
@@ -24948,6 +25081,7 @@ const SystemMonitorScreen = ({
24948
25081
  iconRadius: 7,
24949
25082
  gap: PADDING_GAP_TAB,
24950
25083
  selectedAppId: currentApp?.path,
25084
+ getAppUrl: (app) => getAppUrl(app, env) || app.path,
24951
25085
  onClickItem: async (app) => {
24952
25086
  await dispatch(
24953
25087
  ACTION_ACCOUNT.updateCurrentAccess(app.path)
@@ -25024,6 +25158,7 @@ exports.DASHBOARD_SCREEN = DASHBOARD_SCREEN;
25024
25158
  exports.DashboardPage = DashboardPage;
25025
25159
  exports.DefaultLayout = DefaultLayout;
25026
25160
  exports.EmptyComponent = EmptyComponent;
25161
+ exports.Environment = Environment;
25027
25162
  exports.ErrorPage = ErrorPage;
25028
25163
  exports.ForgotPasswordType = ForgotPasswordType;
25029
25164
  exports.Gender = Gender;
@@ -25121,6 +25256,8 @@ exports.deleteUser = deleteUser;
25121
25256
  exports.extractNumberAtStartString = extractNumberAtStartString;
25122
25257
  exports.findCurrentAccessByPath = findCurrentAccessByPath;
25123
25258
  exports.forgotPassword = forgotPassword;
25259
+ exports.getAppUrl = getAppUrl;
25260
+ exports.getCurrentEnvironment = getCurrentEnvironment;
25124
25261
  exports.getDate = getDate;
25125
25262
  exports.getDateTime = getDateTime;
25126
25263
  exports.getDayOffsetPx = getDayOffsetPx;
@@ -25131,6 +25268,7 @@ exports.getListNotificationSetting = getListNotificationSetting;
25131
25268
  exports.getListUser = getListUser;
25132
25269
  exports.getListUserRelations = getListUserRelations;
25133
25270
  exports.getMonthRangeForYear = getMonthRangeForYear;
25271
+ exports.getSsoUrl = getSsoUrl;
25134
25272
  exports.getTimeAgo = getTimeAgo;
25135
25273
  exports.getTimeDate = getTimeDate;
25136
25274
  exports.getUser = getUser;