customer-module-frontend 1.0.1-beta.1
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/.cursor/rules/context.md +306 -0
- package/.cursor/rules/guardrails.md +35 -0
- package/.env +1 -0
- package/.github/workflows/publish-to-npm-beta.yml +51 -0
- package/.github/workflows/publish-to-npm.yml +58 -0
- package/README.md +73 -0
- package/eslint.config.js +23 -0
- package/index.html +13 -0
- package/package.json +43 -0
- package/postcss-unwrap-layers.js +31 -0
- package/postcss.config.js +11 -0
- package/public/vite.svg +1 -0
- package/src/App.css +40 -0
- package/src/App.tsx +58 -0
- package/src/assets/accounts.svg +3 -0
- package/src/assets/at_the_rate.svg +10 -0
- package/src/assets/buildings.svg +3 -0
- package/src/assets/chat.svg +3 -0
- package/src/assets/close.svg +3 -0
- package/src/assets/contacts.svg +3 -0
- package/src/assets/conversation.svg +10 -0
- package/src/assets/customers.svg +10 -0
- package/src/assets/details.svg +3 -0
- package/src/assets/domain.svg +10 -0
- package/src/assets/edit.svg +15 -0
- package/src/assets/email.svg +3 -0
- package/src/assets/google.svg +8 -0
- package/src/assets/inbox.svg +0 -0
- package/src/assets/message.svg +3 -0
- package/src/assets/no-data.svg +9 -0
- package/src/assets/open_in_a_new_tab.svg +10 -0
- package/src/assets/phone.svg +3 -0
- package/src/assets/react.svg +1 -0
- package/src/assets/search.svg +3 -0
- package/src/assets/search_typing.svg +4 -0
- package/src/assets/sm_contacts.svg +3 -0
- package/src/assets/sm_inbox.svg +3 -0
- package/src/assets/sm_slider.svg +3 -0
- package/src/assets/status-resolved.svg +3 -0
- package/src/assets/status-snoozed.svg +4 -0
- package/src/assets/status_open.svg +1 -0
- package/src/components/AccountContacts/index.tsx +107 -0
- package/src/components/AccountDetails/index.tsx +102 -0
- package/src/components/AccountsConversation/index.tsx +75 -0
- package/src/components/Avatar/constants.tsx +45 -0
- package/src/components/Avatar/index.tsx +42 -0
- package/src/components/BreadcrumbsSection/index.tsx +16 -0
- package/src/components/Card/index.tsx +31 -0
- package/src/components/Card/types.ts +10 -0
- package/src/components/ContactConversation/Converation.tsx +14 -0
- package/src/components/ContactConversation/index.tsx +81 -0
- package/src/components/ContactDetails/index.tsx +111 -0
- package/src/components/Contacts/EditContact.tsx +213 -0
- package/src/components/Contacts/constants/index.tsx +24 -0
- package/src/components/Contacts/index.tsx +171 -0
- package/src/components/ConversationBox/constants.tsx +99 -0
- package/src/components/ConversationBox/index.tsx +147 -0
- package/src/components/ConversationBox/types.ts +20 -0
- package/src/components/CustomersLayout/index.tsx +20 -0
- package/src/components/DetailsCard/index.tsx +31 -0
- package/src/components/DetailsCard/types.ts +10 -0
- package/src/components/EmptyData/NoDataFound.tsx +31 -0
- package/src/components/Header/index.tsx +55 -0
- package/src/components/Icon/index.tsx +93 -0
- package/src/components/Icon/types.ts +13 -0
- package/src/components/Listing/AccountTable.tsx +47 -0
- package/src/components/Listing/ContactTable.tsx +76 -0
- package/src/components/RightPanel/AccountPanel.tsx +123 -0
- package/src/components/RightPanel/ContactPanel.tsx +142 -0
- package/src/components/RightPanel/index.tsx +167 -0
- package/src/components/Search/SearchDialog.tsx +150 -0
- package/src/components/TabsSection/index.tsx +49 -0
- package/src/constants/index.tsx +645 -0
- package/src/hooks/useBreadcrumb.tsx +93 -0
- package/src/index.css +315 -0
- package/src/main.tsx +14 -0
- package/src/pages/AccountDetail.tsx +68 -0
- package/src/pages/Accounts.tsx +12 -0
- package/src/pages/ContactDetail.tsx +55 -0
- package/src/pages/Contacts.tsx +12 -0
- package/src/stores/count.tsx +17 -0
- package/src/types/index.ts +0 -0
- package/tailwind.config.js +179 -0
- package/tsconfig.app.json +36 -0
- package/tsconfig.json +7 -0
- package/tsconfig.node.json +26 -0
- package/vite.config.ts +31 -0
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
# Cursor Rules for Customer Module Frontend
|
|
2
|
+
|
|
3
|
+
## Tech Stack & Architecture
|
|
4
|
+
|
|
5
|
+
- **Framework**: React 19.2+ with TypeScript
|
|
6
|
+
- **Build Tool**: Vite 7+
|
|
7
|
+
- **State Management**:
|
|
8
|
+
- Client state: Zustand
|
|
9
|
+
- Component state: React built-in hooks (useState, useReducer) for local component state
|
|
10
|
+
- **API Client**: Bifrost JS (@hiver/bifrost-js)
|
|
11
|
+
- **Routing**: React Router DOM (supports MemoryRouter for testing/embedded scenarios)
|
|
12
|
+
- **Styling**:
|
|
13
|
+
- Tailwind CSS v4 with `@tailwindcss/postcss` plugin
|
|
14
|
+
- PostCSS with autoprefixer
|
|
15
|
+
- Custom prefix support (e.g., `cm:` prefix for customer module)
|
|
16
|
+
- Use `tailwind-merge` for merging Tailwind classes
|
|
17
|
+
- **Code Quality**: ESLint with TypeScript support
|
|
18
|
+
|
|
19
|
+
## Code Style & Conventions
|
|
20
|
+
|
|
21
|
+
### TypeScript
|
|
22
|
+
- Use strict TypeScript typing - avoid `any` types
|
|
23
|
+
- Define types in `src/types/` directory
|
|
24
|
+
- Use type imports: `import type { ... }` for type-only imports
|
|
25
|
+
- Prefer interfaces for component props and object shapes
|
|
26
|
+
- Use type aliases for unions, primitives, and utility types
|
|
27
|
+
- Export types alongside their implementations
|
|
28
|
+
|
|
29
|
+
### React Components
|
|
30
|
+
- Use functional components with TypeScript
|
|
31
|
+
- Use PascalCase for component names and file names
|
|
32
|
+
- Define component props as interfaces extending React HTML attributes when needed
|
|
33
|
+
- Use default exports for components
|
|
34
|
+
- Prefer named exports for utilities, hooks, and types
|
|
35
|
+
- Use React.FC or explicit return types for components
|
|
36
|
+
- Always destructure props in function signature
|
|
37
|
+
|
|
38
|
+
### File Organization
|
|
39
|
+
```
|
|
40
|
+
src/
|
|
41
|
+
├── components/ # React components organized by feature (to be created)
|
|
42
|
+
│ ├── core/ # Reusable UI components (if needed)
|
|
43
|
+
│ └── [Feature]/ # Feature-specific components
|
|
44
|
+
├── hooks/ # Custom React hooks (prefixed with "use") (to be created)
|
|
45
|
+
├── services/ # API service functions (to be created)
|
|
46
|
+
├── stores/ # Zustand stores
|
|
47
|
+
├── types/ # TypeScript type definitions (to be created)
|
|
48
|
+
├── utils/ # Utility functions (to be created)
|
|
49
|
+
├── constants/ # Application constants (to be created)
|
|
50
|
+
├── assets/ # Static assets (images, icons, etc.)
|
|
51
|
+
├── App.tsx # Main application component
|
|
52
|
+
├── main.tsx # Application entry point
|
|
53
|
+
└── index.css # Global styles
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Naming Conventions
|
|
57
|
+
- **Components**: PascalCase (e.g., `PaymentFailedBanner.tsx`, `SCButton.tsx`)
|
|
58
|
+
- **Hooks**: camelCase starting with "use" (e.g., `usePlans.ts`, `useSubscription.ts`)
|
|
59
|
+
- **Services**: camelCase (e.g., `subscriptionApi.ts`, `fetchData.ts`)
|
|
60
|
+
- **Types/Interfaces**: PascalCase (e.g., `SubscriptionData`, `PlansApiResponse`)
|
|
61
|
+
- **Utils**: camelCase (e.g., `error.ts`, `planMapper.ts`)
|
|
62
|
+
- **Stores**: camelCase ending with "Store" (e.g., `subscriptionStore.ts`)
|
|
63
|
+
- **Constants**: UPPER_SNAKE_CASE for exported constants, camelCase for files
|
|
64
|
+
|
|
65
|
+
## Component Patterns
|
|
66
|
+
|
|
67
|
+
### UI Components
|
|
68
|
+
- Create reusable UI components in `src/components/core/` directory
|
|
69
|
+
- Use standard HTML elements with Tailwind CSS for styling
|
|
70
|
+
- Build custom components as needed for the application
|
|
71
|
+
- Components should be composable and reusable
|
|
72
|
+
|
|
73
|
+
### Tailwind CSS Usage
|
|
74
|
+
- Use Tailwind CSS v4 with `@tailwindcss/postcss` plugin
|
|
75
|
+
- Tailwind classes can use custom prefixes (e.g., `cm:` for customer module)
|
|
76
|
+
- Use Tailwind utility classes instead of inline styles
|
|
77
|
+
- Use `twMerge` from `tailwind-merge` when merging classes manually
|
|
78
|
+
- For component-specific styles, use CSS modules or regular CSS files
|
|
79
|
+
- Configure Tailwind in `tailwind.config.js`
|
|
80
|
+
|
|
81
|
+
### Styling Guidelines
|
|
82
|
+
- Prefer Tailwind utilities over custom CSS
|
|
83
|
+
- Use CSS modules or regular CSS files for complex component-specific styles
|
|
84
|
+
- Never use inline styles (`style={{ ... }}`)
|
|
85
|
+
- Use CSS variables when needed
|
|
86
|
+
- Maintain consistent spacing using Tailwind spacing scale
|
|
87
|
+
- PostCSS configuration is in `postcss.config.js` with `@tailwindcss/postcss` and `autoprefixer`
|
|
88
|
+
|
|
89
|
+
## State Management Patterns
|
|
90
|
+
|
|
91
|
+
### Client State (Zustand)
|
|
92
|
+
- Use Zustand stores for global client state
|
|
93
|
+
- Store files in `src/stores/` directory
|
|
94
|
+
- Use devtools middleware for development
|
|
95
|
+
- Follow the pattern:
|
|
96
|
+
```typescript
|
|
97
|
+
interface State {
|
|
98
|
+
data: DataType | null;
|
|
99
|
+
isLoading: boolean;
|
|
100
|
+
error: string | null;
|
|
101
|
+
setData: (data: DataType | null) => void;
|
|
102
|
+
fetchData: () => Promise<void>;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export const useStore = create<State>((set) => ({
|
|
106
|
+
data: null,
|
|
107
|
+
isLoading: false,
|
|
108
|
+
error: null,
|
|
109
|
+
setData: (data) => set({ data }),
|
|
110
|
+
fetchData: async () => {
|
|
111
|
+
set({ isLoading: true, error: null });
|
|
112
|
+
// Fetch logic here
|
|
113
|
+
},
|
|
114
|
+
}));
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Component State
|
|
118
|
+
- Use React built-in hooks for local component state:
|
|
119
|
+
- `useState` for simple component state
|
|
120
|
+
- `useReducer` for complex component state
|
|
121
|
+
- `useContext` for shared state within a component tree (prefer Zustand for global state)
|
|
122
|
+
|
|
123
|
+
## API & Service Layer
|
|
124
|
+
|
|
125
|
+
### Service Functions
|
|
126
|
+
- All API calls go through Bifrost JS (@hiver/bifrost-js)
|
|
127
|
+
- Create service files in `src/services/` directory
|
|
128
|
+
- Use Bifrost JS client for HTTP requests
|
|
129
|
+
- Service functions should be pure and not contain business logic
|
|
130
|
+
- Wrap API calls with error handling utilities
|
|
131
|
+
|
|
132
|
+
### Bifrost JS Usage
|
|
133
|
+
- Initialize Bifrost client in `src/services/bifrost.ts` or similar
|
|
134
|
+
- Use Bifrost for all API communication
|
|
135
|
+
- Follow Bifrost JS patterns and conventions
|
|
136
|
+
- Handle authentication and request/response interceptors through Bifrost
|
|
137
|
+
|
|
138
|
+
### Error Handling
|
|
139
|
+
- Always check for errors before using data
|
|
140
|
+
- Handle errors at the hook/component level, not in service functions
|
|
141
|
+
- Use try-catch blocks for error handling
|
|
142
|
+
- Display user-friendly error messages
|
|
143
|
+
- Leverage Bifrost JS error handling capabilities
|
|
144
|
+
|
|
145
|
+
### API Response Types
|
|
146
|
+
- Define all API response types in `src/types/api.ts`
|
|
147
|
+
- Follow consistent patterns for API responses
|
|
148
|
+
- Align types with Bifrost JS response structures
|
|
149
|
+
|
|
150
|
+
## Routing Patterns
|
|
151
|
+
|
|
152
|
+
### React Router
|
|
153
|
+
- Use React Router DOM for routing
|
|
154
|
+
- Support both BrowserRouter (production) and MemoryRouter (testing/embedded scenarios)
|
|
155
|
+
- **BrowserRouter**: Use for standalone applications with browser history
|
|
156
|
+
- **MemoryRouter**: Use for embedded scenarios, testing, or when you need to control history programmatically
|
|
157
|
+
- Define routes in `src/App.tsx` or a dedicated routes file
|
|
158
|
+
- Use `useNavigate`, `useParams`, `useLocation` hooks for navigation
|
|
159
|
+
|
|
160
|
+
## Hooks Patterns
|
|
161
|
+
|
|
162
|
+
### Custom Hooks
|
|
163
|
+
- Create hooks in `src/hooks/` directory
|
|
164
|
+
- Name hooks starting with "use" (e.g., `useCustomer`, `useData`)
|
|
165
|
+
- Hooks should encapsulate reusable logic
|
|
166
|
+
- Export hooks from `src/hooks/index.ts`
|
|
167
|
+
- Hooks can encapsulate:
|
|
168
|
+
- API calls using Bifrost JS
|
|
169
|
+
- Zustand store interactions
|
|
170
|
+
- React Router navigation
|
|
171
|
+
- Side effects and state logic
|
|
172
|
+
|
|
173
|
+
### Hook Structure
|
|
174
|
+
```typescript
|
|
175
|
+
export const useResource = () => {
|
|
176
|
+
const { data, isLoading, error, fetchData } = useStore();
|
|
177
|
+
|
|
178
|
+
useEffect(() => {
|
|
179
|
+
fetchData();
|
|
180
|
+
}, []);
|
|
181
|
+
|
|
182
|
+
return { data, isLoading, error };
|
|
183
|
+
};
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Type Safety
|
|
187
|
+
|
|
188
|
+
### Type Definitions
|
|
189
|
+
- Define types in `src/types/` directory
|
|
190
|
+
- Use descriptive type names ending with appropriate suffixes:
|
|
191
|
+
- `*ApiResponse` for API response types
|
|
192
|
+
- `*Request` for API request types
|
|
193
|
+
- `*Data` for data structures
|
|
194
|
+
- `*Props` for component props
|
|
195
|
+
- Export types alongside implementations
|
|
196
|
+
- Use discriminated unions for variant types
|
|
197
|
+
|
|
198
|
+
### Type Guards
|
|
199
|
+
- Create type guards for runtime type checking when needed
|
|
200
|
+
- Use TypeScript's type narrowing features
|
|
201
|
+
|
|
202
|
+
## Code Quality & Best Practices
|
|
203
|
+
|
|
204
|
+
### General Rules
|
|
205
|
+
- **NEVER** use `console.log` in production code (remove before committing)
|
|
206
|
+
- **NEVER** commit commented-out code unless it's clearly marked as temporary
|
|
207
|
+
- **NEVER** use `any` type - use `unknown` if type is truly unknown
|
|
208
|
+
- **NEVER** mutate state directly - always use immutable updates
|
|
209
|
+
- **NEVER** bypass error handling - always handle errors appropriately
|
|
210
|
+
- **ALWAYS** use TypeScript strict mode features
|
|
211
|
+
- **ALWAYS** handle loading and error states in components
|
|
212
|
+
- **ALWAYS** use proper TypeScript types
|
|
213
|
+
- **ALWAYS** use Zustand for global client state
|
|
214
|
+
- **ALWAYS** use Bifrost JS for API calls
|
|
215
|
+
|
|
216
|
+
### Performance
|
|
217
|
+
- Use `useMemo` for expensive computations
|
|
218
|
+
- Use `useCallback` for functions passed as props to memoized components
|
|
219
|
+
- Avoid unnecessary re-renders by properly managing dependencies
|
|
220
|
+
- Use Zustand selectors to prevent unnecessary re-renders
|
|
221
|
+
- Leverage Bifrost JS caching if available
|
|
222
|
+
|
|
223
|
+
### Accessibility
|
|
224
|
+
- Use semantic HTML elements
|
|
225
|
+
- Include proper ARIA labels when needed
|
|
226
|
+
- Ensure keyboard navigation works
|
|
227
|
+
- Maintain proper focus management in modals
|
|
228
|
+
|
|
229
|
+
### Testing Considerations
|
|
230
|
+
- Code should be testable - avoid side effects in pure functions
|
|
231
|
+
- Consider using MSW (Mock Service Worker) for API mocking in tests if needed
|
|
232
|
+
- Mock data should be in `src/mock/` or `src/mocks/` (to be created)
|
|
233
|
+
|
|
234
|
+
## Import Organization
|
|
235
|
+
|
|
236
|
+
### Import Order
|
|
237
|
+
1. React and React-related imports
|
|
238
|
+
2. Third-party library imports
|
|
239
|
+
3. Internal imports (components, hooks, services, utils, types, constants)
|
|
240
|
+
4. Type-only imports (use `import type`)
|
|
241
|
+
|
|
242
|
+
### Import Paths
|
|
243
|
+
- Use relative imports for files in the same directory or nearby
|
|
244
|
+
- Use absolute imports with path aliases if configured in `tsconfig.json` or `vite.config.ts`
|
|
245
|
+
- Prefer named imports over default imports for utilities
|
|
246
|
+
- Use default imports for components
|
|
247
|
+
|
|
248
|
+
## Best Practices
|
|
249
|
+
|
|
250
|
+
### ✅ DO
|
|
251
|
+
- Use Tailwind CSS utility classes for styling
|
|
252
|
+
- Use Zustand for global client state
|
|
253
|
+
- Use Bifrost JS for all API calls
|
|
254
|
+
- Use React Router for routing (BrowserRouter or MemoryRouter as needed)
|
|
255
|
+
- Handle loading and error states appropriately
|
|
256
|
+
- Use TypeScript strictly
|
|
257
|
+
- Follow the existing file structure
|
|
258
|
+
- Export types alongside implementations
|
|
259
|
+
- Use descriptive names for functions and variables
|
|
260
|
+
- Keep components small and focused
|
|
261
|
+
- Extract reusable logic into hooks or utils
|
|
262
|
+
- Use Zustand selectors to optimize re-renders
|
|
263
|
+
|
|
264
|
+
## Configuration Files
|
|
265
|
+
|
|
266
|
+
### Important Configs
|
|
267
|
+
- `tailwind.config.js` - Tailwind CSS v4 configuration
|
|
268
|
+
- `postcss.config.js` - PostCSS configuration with `@tailwindcss/postcss` and `autoprefixer`
|
|
269
|
+
- `vite.config.ts` - Vite build configuration
|
|
270
|
+
- `tsconfig.json` - TypeScript configuration (project references)
|
|
271
|
+
- `tsconfig.app.json` - TypeScript configuration for app code
|
|
272
|
+
- `tsconfig.node.json` - TypeScript configuration for Node.js files (vite.config.ts)
|
|
273
|
+
- `package.json` - Project dependencies and scripts
|
|
274
|
+
- `src/services/bifrost.ts` - Bifrost JS client configuration
|
|
275
|
+
|
|
276
|
+
## Environment & Build
|
|
277
|
+
|
|
278
|
+
- Use environment variables through Vite's `import.meta.env`
|
|
279
|
+
- Build outputs go to `dist/` directory
|
|
280
|
+
- Use Vite for development (`yarn dev`) and production builds (`yarn build`)
|
|
281
|
+
- PostCSS processes CSS with Tailwind and Autoprefixer
|
|
282
|
+
- Configure Bifrost JS with appropriate base URLs from environment variables
|
|
283
|
+
|
|
284
|
+
## Documentation
|
|
285
|
+
|
|
286
|
+
- Add JSDoc comments for complex functions and utilities
|
|
287
|
+
- Document component props with TypeScript interfaces
|
|
288
|
+
- Include usage examples in complex component files
|
|
289
|
+
- Keep README files updated
|
|
290
|
+
|
|
291
|
+
## Git & Version Control
|
|
292
|
+
|
|
293
|
+
- Follow conventional commit messages
|
|
294
|
+
- Use meaningful branch names
|
|
295
|
+
- Don't commit large files or build artifacts
|
|
296
|
+
- Don't commit `node_modules/` or `dist/` directories
|
|
297
|
+
- Consider using lint-staged for pre-commit checks if needed
|
|
298
|
+
|
|
299
|
+
## Package Management
|
|
300
|
+
|
|
301
|
+
- Uses `yarn` as the package manager
|
|
302
|
+
- Key dependencies:
|
|
303
|
+
- `zustand` - State management
|
|
304
|
+
- `@hiver/bifrost-js` - API client
|
|
305
|
+
- `react-router-dom` - Routing
|
|
306
|
+
- `tailwindcss` v4 - Styling
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Guardrails - Strict Rules & Constraints
|
|
2
|
+
|
|
3
|
+
These are **MANDATORY** rules that must be followed. Violations of these rules should be caught during code review.
|
|
4
|
+
|
|
5
|
+
## ❌ DO NOT
|
|
6
|
+
|
|
7
|
+
### Styling
|
|
8
|
+
- **Don't use inline styles** - use Tailwind or CSS
|
|
9
|
+
- **Don't forget the Tailwind prefix** - use custom prefixes (e.g., `cm:`) when configured
|
|
10
|
+
|
|
11
|
+
### API & Service Layer
|
|
12
|
+
- **Don't bypass the service layer** - always use service functions with Bifrost JS
|
|
13
|
+
- **Don't use `fetch` directly** - always use Bifrost JS for API calls
|
|
14
|
+
- **Don't hardcode API URLs** - use config from environment variables or config files
|
|
15
|
+
|
|
16
|
+
### State Management
|
|
17
|
+
- **Don't mutate Zustand state directly** - use setter functions
|
|
18
|
+
- **Don't create global state with Context API** - use Zustand instead
|
|
19
|
+
|
|
20
|
+
### TypeScript & Code Quality
|
|
21
|
+
- **Don't create components without proper TypeScript types**
|
|
22
|
+
- **Don't ignore TypeScript errors** - fix them properly
|
|
23
|
+
- **Don't use `any` type** - use `unknown` if type is truly unknown
|
|
24
|
+
- **Don't use `console.log` in production code** - remove before committing
|
|
25
|
+
|
|
26
|
+
### Code Organization
|
|
27
|
+
- **Don't create duplicate types** - reuse existing types
|
|
28
|
+
- **Don't commit debug code or commented-out code** - unless clearly marked as temporary
|
|
29
|
+
|
|
30
|
+
### Routing
|
|
31
|
+
- **Don't mix routing solutions** - use React Router consistently
|
|
32
|
+
|
|
33
|
+
### General
|
|
34
|
+
- **Don't mutate state directly** - always use immutable updates
|
|
35
|
+
- **Don't bypass error handling** - always handle errors appropriately
|
package/.env
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
UI_FRAMEWORK=primereact
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: "Beta Release Process"
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
# Allows manual triggering on ANY branch — including your feature branch
|
|
5
|
+
workflow_dispatch:
|
|
6
|
+
inputs:
|
|
7
|
+
version:
|
|
8
|
+
description: "Beta version number (e.g. 1.0.0-beta.1)"
|
|
9
|
+
required: true
|
|
10
|
+
type: string
|
|
11
|
+
|
|
12
|
+
env:
|
|
13
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
publish_beta:
|
|
17
|
+
name: Publish Beta to NPM Registry
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
steps:
|
|
20
|
+
- name: Checkout code
|
|
21
|
+
uses: actions/checkout@v2
|
|
22
|
+
|
|
23
|
+
- name: Use Node.js 20
|
|
24
|
+
uses: actions/setup-node@v3
|
|
25
|
+
with:
|
|
26
|
+
node-version: 20
|
|
27
|
+
registry-url: https://registry.npmjs.org/
|
|
28
|
+
always-auth: true
|
|
29
|
+
|
|
30
|
+
- name: Configure Git
|
|
31
|
+
run: |
|
|
32
|
+
git config --global user.name "engg-hiver"
|
|
33
|
+
git config --global user.email "engineering-dev@grexit.com"
|
|
34
|
+
|
|
35
|
+
- name: Configure NPM
|
|
36
|
+
run: |
|
|
37
|
+
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
|
|
38
|
+
npm config set git-tag-version=false
|
|
39
|
+
|
|
40
|
+
- name: Install dependencies
|
|
41
|
+
run: yarn install
|
|
42
|
+
|
|
43
|
+
- name: Build package
|
|
44
|
+
run: npm run build
|
|
45
|
+
|
|
46
|
+
- name: Update version
|
|
47
|
+
run: npm version ${{ inputs.version }} --no-git-tag-version
|
|
48
|
+
|
|
49
|
+
- name: Publish beta to NPM
|
|
50
|
+
run: npm publish --tag beta
|
|
51
|
+
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
name: "Release process initiated"
|
|
2
|
+
on:
|
|
3
|
+
release:
|
|
4
|
+
types: [published]
|
|
5
|
+
env:
|
|
6
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
changelog_prerelease:
|
|
10
|
+
name: Publish to NPM registry
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout code
|
|
14
|
+
uses: actions/checkout@v2
|
|
15
|
+
with:
|
|
16
|
+
ref: main
|
|
17
|
+
token: ${{ secrets.CI_SYSTEM_GITHUB_WORKFLOW }}
|
|
18
|
+
|
|
19
|
+
- name: Use Node.js 20
|
|
20
|
+
uses: actions/setup-node@v3
|
|
21
|
+
with:
|
|
22
|
+
node-version: 20
|
|
23
|
+
registry-url: https://registry.npmjs.org/
|
|
24
|
+
always-auth: true
|
|
25
|
+
|
|
26
|
+
- run: git config --global user.name "engg-hiver"
|
|
27
|
+
- run: git config --global user.email "engineering-dev@grexit.com"
|
|
28
|
+
- run: npm config set '//registry.npmjs.org/:_authToken'="${NPM_TOKEN}"
|
|
29
|
+
- run: npm config set git-tag-version=false
|
|
30
|
+
- run: yarn install
|
|
31
|
+
- run: npm run build
|
|
32
|
+
- run: npm version ${{ github.event.release.tag_name }}
|
|
33
|
+
|
|
34
|
+
- name: Publish to NPM
|
|
35
|
+
run: npm publish
|
|
36
|
+
|
|
37
|
+
- run: git pull
|
|
38
|
+
- run: git push
|
|
39
|
+
env:
|
|
40
|
+
github-token: ${{ secrets.CI_SYSTEM_GITHUB_WORKFLOW }}
|
|
41
|
+
|
|
42
|
+
- name: Update Changelog
|
|
43
|
+
uses: heinrichreimer/github-changelog-generator-action@v2.1.1
|
|
44
|
+
with:
|
|
45
|
+
token: ${{ secrets.CI_SYSTEM_GITHUB_WORKFLOW }}
|
|
46
|
+
issues: true
|
|
47
|
+
issuesWoLabels: true
|
|
48
|
+
pullRequests: true
|
|
49
|
+
prWoLabels: true
|
|
50
|
+
unreleased: true
|
|
51
|
+
addSections: '{"documentation":{"prefix":"**Documentation:**","labels":["documentation"]}}'
|
|
52
|
+
|
|
53
|
+
- uses: stefanzweifel/git-auto-commit-action@v4
|
|
54
|
+
with:
|
|
55
|
+
commit_message: Update Changelog for PR
|
|
56
|
+
file_pattern: CHANGELOG.md package.json
|
|
57
|
+
env:
|
|
58
|
+
github-token: ${{ secrets.CI_SYSTEM_GITHUB_WORKFLOW }}
|
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# React + TypeScript + Vite
|
|
2
|
+
|
|
3
|
+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
4
|
+
|
|
5
|
+
Currently, two official plugins are available:
|
|
6
|
+
|
|
7
|
+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
|
|
8
|
+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
9
|
+
|
|
10
|
+
## React Compiler
|
|
11
|
+
|
|
12
|
+
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
|
|
13
|
+
|
|
14
|
+
## Expanding the ESLint configuration
|
|
15
|
+
|
|
16
|
+
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
export default defineConfig([
|
|
20
|
+
globalIgnores(['dist']),
|
|
21
|
+
{
|
|
22
|
+
files: ['**/*.{ts,tsx}'],
|
|
23
|
+
extends: [
|
|
24
|
+
// Other configs...
|
|
25
|
+
|
|
26
|
+
// Remove tseslint.configs.recommended and replace with this
|
|
27
|
+
tseslint.configs.recommendedTypeChecked,
|
|
28
|
+
// Alternatively, use this for stricter rules
|
|
29
|
+
tseslint.configs.strictTypeChecked,
|
|
30
|
+
// Optionally, add this for stylistic rules
|
|
31
|
+
tseslint.configs.stylisticTypeChecked,
|
|
32
|
+
|
|
33
|
+
// Other configs...
|
|
34
|
+
],
|
|
35
|
+
languageOptions: {
|
|
36
|
+
parserOptions: {
|
|
37
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
38
|
+
tsconfigRootDir: import.meta.dirname,
|
|
39
|
+
},
|
|
40
|
+
// other options...
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
])
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
// eslint.config.js
|
|
50
|
+
import reactX from 'eslint-plugin-react-x'
|
|
51
|
+
import reactDom from 'eslint-plugin-react-dom'
|
|
52
|
+
|
|
53
|
+
export default defineConfig([
|
|
54
|
+
globalIgnores(['dist']),
|
|
55
|
+
{
|
|
56
|
+
files: ['**/*.{ts,tsx}'],
|
|
57
|
+
extends: [
|
|
58
|
+
// Other configs...
|
|
59
|
+
// Enable lint rules for React
|
|
60
|
+
reactX.configs['recommended-typescript'],
|
|
61
|
+
// Enable lint rules for React DOM
|
|
62
|
+
reactDom.configs.recommended,
|
|
63
|
+
],
|
|
64
|
+
languageOptions: {
|
|
65
|
+
parserOptions: {
|
|
66
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
67
|
+
tsconfigRootDir: import.meta.dirname,
|
|
68
|
+
},
|
|
69
|
+
// other options...
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
])
|
|
73
|
+
```
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import js from '@eslint/js'
|
|
2
|
+
import globals from 'globals'
|
|
3
|
+
import reactHooks from 'eslint-plugin-react-hooks'
|
|
4
|
+
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
5
|
+
import tseslint from 'typescript-eslint'
|
|
6
|
+
import { defineConfig, globalIgnores } from 'eslint/config'
|
|
7
|
+
|
|
8
|
+
export default defineConfig([
|
|
9
|
+
globalIgnores(['dist']),
|
|
10
|
+
{
|
|
11
|
+
files: ['**/*.{ts,tsx}'],
|
|
12
|
+
extends: [
|
|
13
|
+
js.configs.recommended,
|
|
14
|
+
tseslint.configs.recommended,
|
|
15
|
+
reactHooks.configs.flat.recommended,
|
|
16
|
+
reactRefresh.configs.vite,
|
|
17
|
+
],
|
|
18
|
+
languageOptions: {
|
|
19
|
+
ecmaVersion: 2020,
|
|
20
|
+
globals: globals.browser,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
])
|
package/index.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>customer-module-frontend</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "customer-module-frontend",
|
|
3
|
+
"version": "1.0.1-beta.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "vite",
|
|
7
|
+
"build": "tsc -b && vite build",
|
|
8
|
+
"lint": "eslint .",
|
|
9
|
+
"preview": "vite preview"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"hiver-ui-kit-extended": "1.0.0-beta.6",
|
|
13
|
+
"primeicons": "7.0.0",
|
|
14
|
+
"primereact": "10.9.7",
|
|
15
|
+
"react": "18.2.0",
|
|
16
|
+
"react-dom": "18.2.0",
|
|
17
|
+
"react-router-dom": "^7.10.1",
|
|
18
|
+
"zustand": "^5.0.9"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@eslint/js": "^9.39.1",
|
|
22
|
+
"@tailwindcss/cli": "^4.1.17",
|
|
23
|
+
"@tailwindcss/postcss": "^4.1.17",
|
|
24
|
+
"@types/node": "^24.10.1",
|
|
25
|
+
"@types/react": "^18.2.0",
|
|
26
|
+
"@types/react-dom": "^18.2.0",
|
|
27
|
+
"@vitejs/plugin-react": "^5.1.1",
|
|
28
|
+
"autoprefixer": "^10.4.22",
|
|
29
|
+
"eslint": "^9.39.1",
|
|
30
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
31
|
+
"eslint-plugin-react-refresh": "^0.4.24",
|
|
32
|
+
"globals": "^16.5.0",
|
|
33
|
+
"postcss": "^8.5.6",
|
|
34
|
+
"tailwindcss": "^4.1.17",
|
|
35
|
+
"typescript": "~5.9.3",
|
|
36
|
+
"typescript-eslint": "^8.46.4",
|
|
37
|
+
"vite": "^7.2.4"
|
|
38
|
+
},
|
|
39
|
+
"resolutions": {
|
|
40
|
+
"react": "18.2.0",
|
|
41
|
+
"react-dom": "18.2.0"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PostCSS plugin to unwrap @layer directives and extract their contents
|
|
3
|
+
* This is needed because host applications may not support CSS cascade layers
|
|
4
|
+
*/
|
|
5
|
+
export default function unwrapLayersPlugin() {
|
|
6
|
+
return {
|
|
7
|
+
postcssPlugin: 'unwrap-layers',
|
|
8
|
+
AtRule: {
|
|
9
|
+
layer(atRule) {
|
|
10
|
+
// If the layer has no nodes (empty layer), remove it entirely
|
|
11
|
+
if (!atRule.nodes || atRule.nodes.length === 0) {
|
|
12
|
+
atRule.remove();
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Extract all child nodes from the @layer
|
|
17
|
+
const nodes = atRule.nodes;
|
|
18
|
+
|
|
19
|
+
// Insert all child nodes before the @layer rule
|
|
20
|
+
nodes.forEach(node => {
|
|
21
|
+
atRule.parent.insertBefore(atRule, node);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// Remove the now-empty @layer wrapper
|
|
25
|
+
atRule.remove();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
unwrapLayersPlugin.postcss = true;
|
package/public/vite.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|