@litianxiang/portal-core 0.1.18 → 0.1.19

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.d.ts CHANGED
@@ -318,4 +318,30 @@ declare function createLoadingStoreOptions(): {
318
318
  };
319
319
  };
320
320
 
321
- export { type AppRouterOptions, type BreadcrumbItem, type CoreMenuItem, type CoreUserStoreLike, type CreateAuthHttpClientOptions, DEFAULT_HOME_PATH, type FetchUserMenuForStoreOptions, type FontSize, type InactivityConfig, type InactivityResult, type LoadingState, type LogoutToAuthOptions, type MenuHelper, type MenuHelperOptions, type PermissionHelper, type PermissionHelperOptions, type PresetRangeKey, type SidebarMenuFilterOptions, type SyncFromAuthStoreOptions, type TabItem, type ThemeConfig, type ThemeMode, type TimeInput, type TimeRange, type TransformMenuOptions, addTab, applyTheme, buildAllMenuTree, buildPageMenuList, calcInactivityAction, closeAll, closeLeft, closeOthers, closeRight, createAppRouter, createAuthHttpClient, createLoadingStoreOptions, createLogoutToAuth, createMenuHelper, createPermissionHelper, createRange, fetchUserMenuForStore, filterSidebarMenu, findFirstPagePath, formatRange, formatTime, formatToMonthDay, formatToWanShou, formatToYi, formatWanYuanToYi, getPresetRange, humanizeTime, initTheme, isInRange, removeTab, syncFromAuthStoreToStore, timeDiff, transformMenuTree, useThemeWatcher, useTime };
321
+ /**
322
+ * 统一登录、SSO 相关的配置常量
323
+ *
324
+ * - DEFAULT_SSO_STORAGE_KEY: 统一登录站点在 localStorage 中使用的 key
325
+ * - DEFAULT_AUTH_LOGIN_ENV_KEY: 前端项目中约定的统一登录地址环境变量名
326
+ * - DEFAULT_AUTH_LOGIN_PATH: 统一登录站点在当前域下的默认路径
327
+ */
328
+ declare const DEFAULT_SSO_STORAGE_KEY = "user-store";
329
+ declare const DEFAULT_AUTH_LOGIN_ENV_KEY = "VITE_AUTH_LOGIN_URL";
330
+ declare const DEFAULT_AUTH_LOGIN_PATH = "/auth/#/login";
331
+ /**
332
+ * 根据当前 window.location 生成统一登录地址
333
+ *
334
+ * 在 SSR 环境下会返回空字符串,前端项目可自行兜底。
335
+ */
336
+ declare function getDefaultAuthLoginUrl(): string;
337
+ interface AuthConfig {
338
+ /** 统一登录站点在 localStorage 中使用的 key,默认 user-store */
339
+ ssoStorageKey: string;
340
+ /** 前端项目中约定的统一登录地址环境变量名,默认 VITE_AUTH_LOGIN_URL */
341
+ authLoginEnvKey: string;
342
+ /** 统一登录站点在当前域下的默认路径,默认 /auth/#/login */
343
+ authLoginPath: string;
344
+ }
345
+ declare const AUTH_CONFIG: AuthConfig;
346
+
347
+ export { AUTH_CONFIG, type AppRouterOptions, type AuthConfig, type BreadcrumbItem, type CoreMenuItem, type CoreUserStoreLike, type CreateAuthHttpClientOptions, DEFAULT_AUTH_LOGIN_ENV_KEY, DEFAULT_AUTH_LOGIN_PATH, DEFAULT_HOME_PATH, DEFAULT_SSO_STORAGE_KEY, type FetchUserMenuForStoreOptions, type FontSize, type InactivityConfig, type InactivityResult, type LoadingState, type LogoutToAuthOptions, type MenuHelper, type MenuHelperOptions, type PermissionHelper, type PermissionHelperOptions, type PresetRangeKey, type SidebarMenuFilterOptions, type SyncFromAuthStoreOptions, type TabItem, type ThemeConfig, type ThemeMode, type TimeInput, type TimeRange, type TransformMenuOptions, addTab, applyTheme, buildAllMenuTree, buildPageMenuList, calcInactivityAction, closeAll, closeLeft, closeOthers, closeRight, createAppRouter, createAuthHttpClient, createLoadingStoreOptions, createLogoutToAuth, createMenuHelper, createPermissionHelper, createRange, fetchUserMenuForStore, filterSidebarMenu, findFirstPagePath, formatRange, formatTime, formatToMonthDay, formatToWanShou, formatToYi, formatWanYuanToYi, getDefaultAuthLoginUrl, getPresetRange, humanizeTime, initTheme, isInRange, removeTab, syncFromAuthStoreToStore, timeDiff, transformMenuTree, useThemeWatcher, useTime };
package/dist/index.js CHANGED
@@ -842,8 +842,27 @@ function createLoadingStoreOptions() {
842
842
  }
843
843
  };
844
844
  }
845
+
846
+ // src/config/auth-config.ts
847
+ var DEFAULT_SSO_STORAGE_KEY = "user-store";
848
+ var DEFAULT_AUTH_LOGIN_ENV_KEY = "VITE_AUTH_LOGIN_URL";
849
+ var DEFAULT_AUTH_LOGIN_PATH = "/auth/#/login";
850
+ function getDefaultAuthLoginUrl() {
851
+ if (typeof window === "undefined") return "";
852
+ const origin = window.location.origin || "";
853
+ return `${origin}${DEFAULT_AUTH_LOGIN_PATH}`;
854
+ }
855
+ var AUTH_CONFIG = {
856
+ ssoStorageKey: DEFAULT_SSO_STORAGE_KEY,
857
+ authLoginEnvKey: DEFAULT_AUTH_LOGIN_ENV_KEY,
858
+ authLoginPath: DEFAULT_AUTH_LOGIN_PATH
859
+ };
845
860
  export {
861
+ AUTH_CONFIG,
862
+ DEFAULT_AUTH_LOGIN_ENV_KEY,
863
+ DEFAULT_AUTH_LOGIN_PATH,
846
864
  DEFAULT_HOME_PATH,
865
+ DEFAULT_SSO_STORAGE_KEY,
847
866
  addTab,
848
867
  applyTheme,
849
868
  buildAllMenuTree,
@@ -869,6 +888,7 @@ export {
869
888
  formatToWanShou,
870
889
  formatToYi,
871
890
  formatWanYuanToYi,
891
+ getDefaultAuthLoginUrl,
872
892
  getPresetRange,
873
893
  humanizeTime,
874
894
  initTheme,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@litianxiang/portal-core",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",