@orsetra/shared-ui 1.1.19 → 1.1.20

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/api/user.ts ADDED
@@ -0,0 +1,48 @@
1
+ import type { NameAlias } from './env';
2
+
3
+ export type User = {
4
+ name: string;
5
+ alias?: string;
6
+ email?: string;
7
+ createTime?: string;
8
+ lastLoginTime?: string;
9
+ enable?: boolean;
10
+ password?: string;
11
+ disabled?: boolean;
12
+ roles?: NameAlias[];
13
+ };
14
+
15
+ export interface LoginUserInfo {
16
+ name: string;
17
+ alias?: string;
18
+ email?: string;
19
+ createTime?: string;
20
+ lastLoginTime?: string;
21
+ disabled?: boolean;
22
+ projects: UserProject[];
23
+ platformPermissions?: PermissionBase[];
24
+ projectPermissions?: Record<string, PermissionBase[]>;
25
+ }
26
+
27
+ export interface UserProject {
28
+ name: string;
29
+ alias?: string;
30
+ owner: string;
31
+ joinTime: string;
32
+ roles?: NameAlias[];
33
+ }
34
+
35
+ export interface PermissionBase {
36
+ name: string;
37
+ alias?: string;
38
+ resources?: string[];
39
+ actions: string[];
40
+ effect: string;
41
+ createTime: string;
42
+ updateTime: string;
43
+ }
44
+
45
+ export interface CloudShellPrepare {
46
+ status: string;
47
+ message?: string;
48
+ }
@@ -34,7 +34,7 @@ export { Collapsible, CollapsibleTrigger, CollapsibleContent } from './collapsib
34
34
  export { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator } from './command'
35
35
  export { ContextMenu, ContextMenuTrigger, ContextMenuContent, ContextMenuItem, ContextMenuCheckboxItem, ContextMenuRadioItem, ContextMenuLabel, ContextMenuSeparator, ContextMenuShortcut, ContextMenuGroup, ContextMenuPortal, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuRadioGroup } from './context-menu'
36
36
  export { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription } from './dialog'
37
- export { ProjectSelectorModal, type Project, type ProjectSelectorModalProps } from './project-selector-modal'
37
+ export { ProjectSelectorModal, type Project as ProjectSelectorItem, type ProjectSelectorModalProps } from './project-selector-modal'
38
38
  export { Drawer, DrawerTrigger, DrawerContent, DrawerHeader, DrawerFooter, DrawerTitle, DrawerDescription } from './drawer'
39
39
  export { Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField } from './form'
40
40
  export { HoverCard, HoverCardTrigger, HoverCardContent } from './hover-card'
@@ -0,0 +1,39 @@
1
+ "use client";
2
+
3
+ import React from 'react';
4
+
5
+ import type { WorkflowMode , WorkflowStep } from '../api';
6
+
7
+ export interface UISchemaContextState {
8
+ appName?: string;
9
+ appNamespace?: string;
10
+ projectName?: string;
11
+ envName?: string;
12
+ }
13
+
14
+ export const UISchemaContext = React.createContext<UISchemaContextState>({});
15
+
16
+ export type WorkflowData = {
17
+ alias?: string;
18
+ name: string;
19
+ description?: string;
20
+ createTime?: string;
21
+ steps: WorkflowStep[];
22
+ mode: WorkflowMode;
23
+ subMode: WorkflowMode;
24
+ };
25
+
26
+ type workflowContext = {
27
+ appName?: string;
28
+ projectName?: string;
29
+ workflow?: WorkflowData;
30
+ };
31
+
32
+ export const WorkflowContext = React.createContext<workflowContext>({});
33
+
34
+ type workflowEditContext = {
35
+ steps?: WorkflowStep[];
36
+ stepName?: string;
37
+ };
38
+
39
+ export const WorkflowEditContext = React.createContext<workflowEditContext>({});
package/i18n.tsx ADDED
@@ -0,0 +1,39 @@
1
+ "use client";
2
+
3
+ import i18n from 'i18next';
4
+ import { initReactI18next } from 'react-i18next';
5
+
6
+ import En from './locals/En/en.json';
7
+ import Zh from './locals/Zh/zh.json';
8
+ import { getLanguage } from './utils/common';
9
+
10
+ const resources = {
11
+ en: {
12
+ translation: En,
13
+ },
14
+ zh: {
15
+ translation: Zh,
16
+ },
17
+ };
18
+
19
+ // Initialize i18n with default language, will be updated on client side
20
+ i18n
21
+ .use(initReactI18next) // passes i18n down to react-i18next
22
+ .init({
23
+ resources,
24
+ lng: 'en', // Default to 'en' for SSR
25
+ keySeparator: false, // we do not use keys in form messages.welcome
26
+ interpolation: {
27
+ escapeValue: false, // react already safes from xss
28
+ },
29
+ });
30
+
31
+ // Update language on client side
32
+ if (typeof window !== 'undefined') {
33
+ const currentLanguage = getLanguage();
34
+ if (currentLanguage !== i18n.language) {
35
+ i18n.changeLanguage(currentLanguage);
36
+ }
37
+ }
38
+
39
+ export default i18n;
package/index.ts CHANGED
@@ -18,10 +18,16 @@ export * from './components/layout'
18
18
  export * from './hooks'
19
19
 
20
20
  // Context
21
- export * from './context'
21
+ export * from './context/index'
22
22
 
23
23
  // Internationalization
24
24
  export { default as i18n } from './i18n'
25
25
 
26
26
  // Utilities (additional exports)
27
27
  export { locale } from './utils/locale'
28
+ export * from './utils/common'
29
+ export * from './utils/storage'
30
+ export * from './utils/permission'
31
+ export * from './utils/resetLogin'
32
+ export * from './utils/cache'
33
+ export * from './utils/errors'
@@ -0,0 +1 @@
1
+ {}