namirasoft-account-react 1.4.424 → 1.4.425

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.
Files changed (124) hide show
  1. package/.env.template +15 -15
  2. package/SKILLS.md +514 -514
  3. package/config-overrides.js +72 -72
  4. package/dist/App.css +32 -0
  5. package/dist/App.d.ts +1 -1
  6. package/dist/UseParams.d.ts +1 -1
  7. package/dist/components/NSAAccessListDialog.d.ts +2 -2
  8. package/dist/components/NSAAccessListDialog.module.css +71 -71
  9. package/dist/components/NSAMasterMenu.d.ts +1 -1
  10. package/dist/components/NSAMasterMenu.module.css +248 -248
  11. package/dist/components/NSAMasterMenuItem.d.ts +1 -1
  12. package/dist/components/NSAMessageListDialog.d.ts +1 -1
  13. package/dist/components/NSAMessageListDialog.module.css +99 -99
  14. package/dist/components/NSAProductListDialog.d.ts +1 -1
  15. package/dist/components/NSAProductListDialog.module.css +44 -44
  16. package/dist/components/NSAReorderDialog.d.ts +1 -1
  17. package/dist/components/NSAReorderDialog.module.css +49 -49
  18. package/dist/components/NSASortDialog.d.ts +1 -1
  19. package/dist/components/NSAUserDialog.d.ts +1 -1
  20. package/dist/components/NSAUserDialog.module.css +67 -67
  21. package/dist/components/NSAWorkspaceListDialog.d.ts +1 -1
  22. package/dist/components/NSAWorkspaceListDialog.module.css +41 -41
  23. package/dist/components/NSBoxSecret.d.ts +1 -1
  24. package/dist/components/NSBoxSecret.module.css +23 -23
  25. package/dist/components/NSLabelSecret.d.ts +1 -1
  26. package/dist/components/quickfilter/NSAFilterBoxEnum.module.css +45 -0
  27. package/dist/components/quickfilter/NSAQuickFilterBar.d.ts +1 -1
  28. package/dist/components/quickfilter/NSAQuickFilterBar.module.css +20 -0
  29. package/dist/components/quickfilter/NSAQuickFilterDialog.d.ts +1 -1
  30. package/dist/components/quickfilter/NSAQuickFilterDialog.module.css +75 -0
  31. package/dist/index.css +0 -0
  32. package/dist/layouts/NSALayout.d.ts +1 -1
  33. package/dist/layouts/NSASectionEdit.d.ts +1 -1
  34. package/dist/layouts/NSASectionEditTabPage.d.ts +1 -1
  35. package/dist/layouts/NSASectionEditTabPage.module.css +4 -4
  36. package/dist/layouts/NSASectionList.d.ts +1 -1
  37. package/dist/layouts/NSASectionList.module.css +18 -18
  38. package/dist/layouts/NSASectionView.d.ts +1 -1
  39. package/dist/layouts/NSASectionViewTabMore.d.ts +1 -1
  40. package/dist/layouts/NSASectionViewTabPage.d.ts +1 -1
  41. package/dist/layouts/NSASectionViewTabPage.module.css +47 -47
  42. package/dist/pages/NSAConsentPage.module.css +26 -26
  43. package/dist/pages/NSAEmailVerificationPage.d.ts +1 -1
  44. package/dist/pages/NSAHomePage.d.ts +1 -1
  45. package/dist/pages/NSAHomePage.module.css +41 -41
  46. package/dist/pages/NSALoginPage.d.ts +1 -1
  47. package/dist/pages/NSALoginPage.module.css +26 -26
  48. package/dist/pages/NSAPhoneVerificationPage.d.ts +1 -1
  49. package/dist/pages/NSAVerificationPage.d.ts +1 -1
  50. package/dist/pages/NSAVerificationPage.module.css +31 -31
  51. package/package.json +94 -94
  52. package/public/index.html +21 -21
  53. package/src/App.css +31 -31
  54. package/src/App.tsx +19 -19
  55. package/src/CTFRow.ts +7 -7
  56. package/src/IEntityInfo.ts +33 -33
  57. package/src/NSACacheService.ts +120 -120
  58. package/src/NSAFilterOperators.ts +92 -92
  59. package/src/NSARouterMaker.tsx +139 -139
  60. package/src/NSARouterMakerConfig.ts +15 -15
  61. package/src/NSARouterMakerProps.ts +22 -22
  62. package/src/Router.tsx +45 -45
  63. package/src/UseParams.tsx +18 -18
  64. package/src/components/NSAAccessListDialog.module.css +71 -71
  65. package/src/components/NSAAccessListDialog.tsx +178 -178
  66. package/src/components/NSAMasterMenu.module.css +248 -248
  67. package/src/components/NSAMasterMenu.tsx +169 -169
  68. package/src/components/NSAMasterMenuItem.tsx +250 -250
  69. package/src/components/NSAMessageListDialog.module.css +99 -99
  70. package/src/components/NSAMessageListDialog.tsx +141 -141
  71. package/src/components/NSAProductListDialog.module.css +44 -44
  72. package/src/components/NSAProductListDialog.tsx +88 -88
  73. package/src/components/NSAReorderDialog.module.css +49 -49
  74. package/src/components/NSAReorderDialog.tsx +149 -149
  75. package/src/components/NSASortDialog.tsx +117 -117
  76. package/src/components/NSATable.tsx +489 -489
  77. package/src/components/NSAUserDialog.module.css +67 -67
  78. package/src/components/NSAUserDialog.tsx +122 -122
  79. package/src/components/NSAWorkspaceListDialog.module.css +41 -41
  80. package/src/components/NSAWorkspaceListDialog.tsx +147 -147
  81. package/src/components/NSBoxSecret.module.css +23 -23
  82. package/src/components/NSBoxSecret.tsx +258 -258
  83. package/src/components/NSLabelSecret.tsx +37 -37
  84. package/src/components/quickfilter/NSAFilterBoxBase.tsx +55 -55
  85. package/src/components/quickfilter/NSAFilterBoxBoolean.tsx +54 -54
  86. package/src/components/quickfilter/NSAFilterBoxDate.tsx +104 -104
  87. package/src/components/quickfilter/NSAFilterBoxDateTime.tsx +105 -105
  88. package/src/components/quickfilter/NSAFilterBoxEnum.module.css +44 -44
  89. package/src/components/quickfilter/NSAFilterBoxEnum.tsx +79 -79
  90. package/src/components/quickfilter/NSAFilterBoxNumber.tsx +136 -136
  91. package/src/components/quickfilter/NSAFilterBoxString.tsx +81 -81
  92. package/src/components/quickfilter/NSAFilterBoxTime.tsx +101 -101
  93. package/src/components/quickfilter/NSAQuickFilterBar.module.css +19 -19
  94. package/src/components/quickfilter/NSAQuickFilterBar.tsx +114 -114
  95. package/src/components/quickfilter/NSAQuickFilterDialog.module.css +74 -74
  96. package/src/components/quickfilter/NSAQuickFilterDialog.tsx +260 -260
  97. package/src/css.d.ts +13 -13
  98. package/src/formatters/SecretFormatter.tsx +24 -24
  99. package/src/index.tsx +24 -24
  100. package/src/layouts/Actions.ts +145 -145
  101. package/src/layouts/CFTUtil.ts +18 -18
  102. package/src/layouts/NSALayout.tsx +765 -765
  103. package/src/layouts/NSASectionEdit.tsx +250 -250
  104. package/src/layouts/NSASectionEditTabPage.module.css +4 -4
  105. package/src/layouts/NSASectionEditTabPage.tsx +250 -250
  106. package/src/layouts/NSASectionList.module.css +18 -18
  107. package/src/layouts/NSASectionList.tsx +143 -143
  108. package/src/layouts/NSASectionView.tsx +100 -100
  109. package/src/layouts/NSASectionViewTabMore.tsx +77 -77
  110. package/src/layouts/NSASectionViewTabPage.module.css +47 -47
  111. package/src/layouts/NSASectionViewTabPage.tsx +419 -419
  112. package/src/main.ts +46 -46
  113. package/src/pages/NSAConsentPage.module.css +26 -26
  114. package/src/pages/NSAConsentPage.tsx +120 -120
  115. package/src/pages/NSAEmailVerificationPage.tsx +30 -30
  116. package/src/pages/NSAHomePage.module.css +41 -41
  117. package/src/pages/NSAHomePage.tsx +102 -102
  118. package/src/pages/NSALoginPage.module.css +26 -26
  119. package/src/pages/NSALoginPage.tsx +87 -87
  120. package/src/pages/NSAPhoneVerificationPage.tsx +94 -94
  121. package/src/pages/NSAVerificationPage.module.css +31 -31
  122. package/src/pages/NSAVerificationPage.tsx +186 -186
  123. package/src/pages/PaymentRequired.tsx +74 -74
  124. package/tsconfig.json +43 -43
package/SKILLS.md CHANGED
@@ -1,514 +1,514 @@
1
- ---
2
- name: namirasoft-account-react
3
- description: Use when working with the namirasoft-account-react npm package — a React UI library providing auth flows, workspace/access/product dialogs, CRUD layouts (list/view/edit), secret field components, and an auth-gated router for Namirasoft Console frontends.
4
- triggers:
5
- - namirasoft-account-react
6
- - NSARouterMaker
7
- - NSALayout
8
- - NSASectionList
9
- - NSASectionEdit
10
- - NSASectionView
11
- - NSBoxSecret
12
- - account react
13
- ---
14
-
15
- # namirasoft-account-react
16
-
17
- **Package:** `namirasoft-account-react` v1.4.413
18
- **Purpose:** Enterprise React UI library for Namirasoft products. Provides the complete authentication flow (login, verification, consent), workspace/access/product management dialogs, generic CRUD layouts (list/view/edit), secret field components, and a router framework that gates pages behind authentication state.
19
- **Stack:** React 18, TypeScript, React Router 7, Bootstrap 5, CSS Modules.
20
-
21
- ---
22
-
23
- ## When to use this package
24
-
25
- Use `namirasoft-account-react` in every **frontend Console** (React SPA) that needs to:
26
- - Authenticate users via the Namirasoft Account service
27
- - Enforce email and phone verification before access
28
- - Show a consent/terms page when policies change
29
- - Provide workspace switching, access (impersonation), and product navigation
30
- - Render generic entity list / view / edit pages
31
- - Store and display sensitive secrets (encrypted fields)
32
- - Poll and display in-app messages
33
-
34
- ---
35
-
36
- ## Environment Variables
37
-
38
- Copy `.env.template` and fill in all values before running:
39
-
40
- ```bash
41
- REACT_APP_BASE_PATH="" # sub-path if not at root
42
- REACT_APP_BASE_URL_ACCESS="https://access.namirasoft.com/api/v1"
43
- REACT_APP_BASE_URL_ACCOUNT="https://account.namirasoft.com/api/v1"
44
- REACT_APP_BASE_URL_ACCOUNT_CONSOLE="https://account.namirasoft.com"
45
- REACT_APP_BASE_URL_API_LINK="https://namirasoft.com/api/link/v1"
46
- REACT_APP_BASE_URL_API_PRODUCT="https://namirasoft.com/api/product/v1"
47
- REACT_APP_BASE_URL_FIELD="https://field.namirasoft.com/api/v1"
48
- REACT_APP_BASE_URL_HISTORY="https://history.namirasoft.com/api/v1"
49
- REACT_APP_BASE_URL_HISTORY_CONSOLE="https://history.namirasoft.com"
50
- REACT_APP_BASE_URL_MESSAGE="https://message.namirasoft.com/api/v1"
51
- REACT_APP_BASE_URL_MESSAGE_CONSOLE="https://message.namirasoft.com"
52
- REACT_APP_BASE_URL_SECRET="https://secret.namirasoft.com/api/v1"
53
- REACT_APP_BASE_URL_WORKSPACE="https://workspace.namirasoft.com/api/v1"
54
- ```
55
-
56
- ---
57
-
58
- ## Exports (`main.ts`)
59
-
60
- ### Components
61
-
62
- | Export | File | Description |
63
- |--------|------|-------------|
64
- | `NSAAccessListDialog` | `components/NSAAccessListDialog.tsx` | Incoming permissions / impersonation switcher |
65
- | `NSAMessageListDialog` | `components/NSAMessageListDialog.tsx` | Unread message center (max 4, mark-all-seen) |
66
- | `NSAProductListDialog` | `components/NSAProductListDialog.tsx` | Searchable product list |
67
- | `NSAWorkspaceListDialog` | `components/NSAWorkspaceListDialog.tsx` | Workspace switcher |
68
- | `NSAUserDialog` | `components/NSAUserDialog.tsx` | User profile and settings dialog |
69
- | `NSAMasterMenu` | `components/NSAMasterMenu.tsx` | Sidebar navigation with search and collapse |
70
- | `NSAMasterMenuItem` | `components/NSAMasterMenuItem.tsx` | Individual menu item |
71
- | `NSBoxSecret` | `components/NSBoxSecret.tsx` | Secret/encrypted value input |
72
- | `NSLabelSecret` | `components/NSLabelSecret.tsx` | Secret/encrypted value display label |
73
-
74
- ### Layouts
75
-
76
- | Export | File | Description |
77
- |--------|------|-------------|
78
- | `NSALayout` | `layouts/NSALayout.tsx` | Root layout: header, master menu, all dialogs, delete confirm |
79
- | `NSASectionList` | `layouts/NSASectionList.tsx` | Entity table with filter/sort/select |
80
- | `NSASectionEdit` | `layouts/NSASectionEdit.tsx` | Entity create/update form (tabbed) |
81
- | `NSASectionView` | `layouts/NSASectionView.tsx` | Entity read-only detail view (tabbed) |
82
- | `NSASectionViewTabPage` | `layouts/NSASectionViewTabPage.tsx` | Single tab inside `NSASectionView` |
83
- | `NSASectionEditTabPage` | `layouts/NSASectionEditTabPage.tsx` | Single tab inside `NSASectionEdit` |
84
-
85
- ### Pages
86
-
87
- | Export | File | Description |
88
- |--------|------|-------------|
89
- | `NSALoginPage` | `pages/NSALoginPage.tsx` | Login page — opens OAuth flow |
90
- | `NSAConsentPage` | `pages/NSAConsentPage.tsx` | Terms/privacy acceptance |
91
- | `NSAEmailVerificationPage` | `pages/NSAEmailVerificationPage.tsx` | Email verification (send + verify code) |
92
- | `NSAPhoneVerificationPage` | `pages/NSAPhoneVerificationPage.tsx` | Phone verification (enter number + SMS code) |
93
- | `NSAVerificationPage` | `pages/NSAVerificationPage.tsx` | Generic verification base component |
94
- | `NSAHomePage` | `pages/NSAHomePage.tsx` | Product grid home page |
95
- | `PaymentRequired` | `pages/PaymentRequired.tsx` | Subscription gate wrapper |
96
-
97
- ### Formatters
98
-
99
- | Export | File | Description |
100
- |--------|------|-------------|
101
- | `SecretFormatter` | `formatters/SecretFormatter.tsx` | Table cell formatter for encrypted secret values |
102
-
103
- ### Router & Config
104
-
105
- | Export | File | Description |
106
- |--------|------|-------------|
107
- | `NSARouterMaker` | `NSARouterMaker.tsx` | Auth-aware router — gates pages by login/verification state |
108
- | `NSARouterMakerProps` | `NSARouterMakerProps.ts` | Props injected into routed components |
109
- | `NSARouterMakerConfig` | `NSARouterMakerConfig.ts` | Config callbacks for `NSARouterMaker` |
110
-
111
- ### Utilities
112
-
113
- | Export | File | Description |
114
- |--------|------|-------------|
115
- | `IEntityInfo` | `IEntityInfo.ts` | Entity definition interface for CRUD pages |
116
- | `Actions` | `layouts/Actions.ts` | Menu action builder (new, view, edit, delete, …) |
117
- | `CFTUtil` | `layouts/CFTUtil.ts` | Custom Table Fields get/set helpers |
118
- | `UseParams` | `UseParams.tsx` | Hook wrapper for URL params |
119
-
120
- ---
121
-
122
- ## Key Types & Interfaces
123
-
124
- ### `NSARouterMakerConfig`
125
-
126
- Callbacks that configure the router's rendering behaviour:
127
-
128
- ```typescript
129
- interface NSARouterMakerConfig {
130
- // Called when user is authenticated and all verifications pass
131
- onRenderOnLogin(props: NSARouterMakerProps): ReactNode;
132
-
133
- // Called when user is not authenticated (banned = account suspended)
134
- onRenderOnLogout(props: NSARouterMakerProps, banned: boolean): ReactNode;
135
-
136
- // Wraps any page in NSALayout (called for all authenticated renders)
137
- renderOnNSALayout(props: NSARouterMakerProps, children: ReactNode): ReactNode;
138
-
139
- // Optional: custom render override
140
- getCustomRender?(props: NSARouterMakerProps): ReactNode | null;
141
-
142
- // Which verifications are required before granting access
143
- requirement: {
144
- verification: {
145
- email: boolean;
146
- phone: boolean;
147
- };
148
- };
149
- }
150
- ```
151
-
152
- ### `NSARouterMakerProps`
153
-
154
- Injected into every routed component. Extends `NSRouterMakerProps` from `namirasoft-site-react`.
155
-
156
- ```typescript
157
- interface NSARouterMakerProps {
158
- product_id: string;
159
- account: {
160
- token_manager: TokenManager;
161
- server: NamirasoftAccountServer;
162
- };
163
- url: {
164
- getQueryStrings(): Record<string, string>;
165
- getQuery(key: string): string | null;
166
- getLink(path: string): string;
167
- redirect(path: string): void;
168
- };
169
- renderer: {
170
- renderOnNSALayout(children: ReactNode): ReactNode;
171
- };
172
- // ... inherited from NSRouterMakerProps
173
- }
174
- ```
175
-
176
- ### `IEntityInfo<EntityType, EntityTypeInput>`
177
-
178
- Defines everything needed to build a list/view/edit page for an entity:
179
-
180
- ```typescript
181
- interface IEntityInfo<EntityType, EntityTypeInput> {
182
- product_id: string;
183
- name: string;
184
- tables: { table: BaseMetaTable; required: boolean }[];
185
-
186
- server: {
187
- value_list(column: string, table: string, ...): Promise<string[]>;
188
- get(id: string): Promise<EntityType>;
189
- list(query: any): Promise<EntityType[]>;
190
- create(input: EntityTypeInput): Promise<EntityType>;
191
- update(id: string, input: EntityTypeInput): Promise<EntityType>;
192
- delete(id: string): Promise<EntityType>;
193
- };
194
-
195
- client: {
196
- getListURL(): string;
197
- getNewURL(): string;
198
- getCopyURL(row: EntityType): string;
199
- getEditURL(row: EntityType): string;
200
- getViewURL(row: EntityType): string;
201
- getColumns(): ColumnDefinition[];
202
- onCreate?(row: EntityType): void;
203
- onUpdate?(row: EntityType): void;
204
- onSuccess?(row: EntityType): void;
205
- getMenus?(row: EntityType): MenuItem[];
206
- };
207
- }
208
- ```
209
-
210
- ### `CTFRow`
211
-
212
- Custom Table Fields structure attached to entities that support dynamic field definitions:
213
-
214
- ```typescript
215
- interface CTFRow {
216
- categories: EntityCategoryInputRow[];
217
- fields: EntityFieldInputRow[];
218
- tags: EntityTagInputRow[];
219
- }
220
- ```
221
-
222
- ---
223
-
224
- ## Router Authentication Flow
225
-
226
- `NSARouterMaker` automatically routes the user through these states in order:
227
-
228
- 1. **Not authenticated** → renders `NSALoginPage` (opens OAuth popup via `NamirasoftAccountClient`)
229
- 2. **Banned** → renders error; `onRenderOnLogout(props, true)` is called
230
- 3. **Consent outdated** → renders `NSAConsentPage`
231
- 4. **Email not verified** (if `requirement.verification.email`) → renders `NSAEmailVerificationPage`
232
- 5. **Phone not verified** (if `requirement.verification.phone`) → renders `NSAPhoneVerificationPage`
233
- 6. **All checks pass** → calls `onRenderOnLogin(props)`
234
-
235
- ---
236
-
237
- ## Components — Details
238
-
239
- ### `NSALayout`
240
-
241
- Root layout for all authenticated pages. Wraps content and mounts:
242
- - Top header with icon buttons for messages, access, workspaces, products, and user
243
- - `NSAMasterMenu` sidebar
244
- - `NSAAccessListDialog`, `NSAMessageListDialog`, `NSAProductListDialog`, `NSAWorkspaceListDialog`, `NSAUserDialog`
245
- - Delete confirmation dialog
246
- - Message count polling
247
-
248
- Props include the full `NSARouterMakerProps` plus section state managers for list/edit/view.
249
-
250
- ### `NSASectionList`
251
-
252
- Table-based listing with:
253
- - Server-driven column schema
254
- - Client-side column override (custom renderers, formatters)
255
- - Multi-select checkboxes
256
- - Filter/sort query params
257
- - Action menus per row
258
- - Custom mode rendering (e.g. search-and-select mode)
259
-
260
- ### `NSASectionEdit`
261
-
262
- Form for create and update:
263
- - Tab-based field groups (`NSASectionEditTabPage` per tab)
264
- - Validation from server schema
265
- - Handles create vs update automatically
266
-
267
- ### `NSASectionView`
268
-
269
- Read-only detail page:
270
- - Tab-based layout (`NSASectionViewTabPage` per tab)
271
- - `NSASectionViewTabMore` for overflow tabs
272
- - Optional hooks before/after render
273
-
274
- ### `NSBoxSecret`
275
-
276
- Encrypted input for passwords, API keys, or tokens:
277
- - Toggle between masked and plain text
278
- - Save value to Secret service (returns an ID)
279
- - Reference existing secret by ID
280
- - Handles encryption/decryption automatically
281
-
282
- ### `NSLabelSecret`
283
-
284
- Display label for encrypted secrets:
285
- - Shows masked value by default
286
- - Decrypts and reveals on toggle
287
- - Reads from Secret service by ID
288
-
289
- ### `NSAMasterMenu`
290
-
291
- Sidebar navigation:
292
- - Hierarchical menu items from `namirasoft-api-link`
293
- - Debounced search filter
294
- - Collapse/expand toggle (state persisted in `NSACacheService`)
295
-
296
- ### `NSAMessageListDialog`
297
-
298
- - Fetches up to 4 unread messages
299
- - Mark all as seen button
300
- - Opens full message in new window
301
- - Integrates with message count badge in header
302
-
303
- ### `NSAAccessListDialog`
304
-
305
- - Lists incoming permissions (accounts that can act as the user)
306
- - Switch to an impersonated account
307
- - Shows who is currently being impersonated
308
-
309
- ### `NSAWorkspaceListDialog`
310
-
311
- - Lists all workspaces for the current product
312
- - Highlights default and current workspace
313
- - Switching workspace triggers page reload
314
-
315
- ### `PaymentRequired`
316
-
317
- Wraps content and checks subscription status. If not subscribed:
318
- - Shows payment offer
319
- - Opens payment URL with return callback
320
- - Blocks child content until subscription confirmed
321
-
322
- ### `SecretFormatter`
323
-
324
- A table column formatter factory:
325
-
326
- ```typescript
327
- SecretFormatter(width?: number): ColumnFormatter
328
- // Returns a formatter that decrypts and masks secret cell values.
329
- ```
330
-
331
- ---
332
-
333
- ## Utilities
334
-
335
- ### `Actions` — static menu item builders
336
-
337
- ```typescript
338
- Actions.apply(onClick: () => void): MenuItem // Apply button
339
- Actions._new(): MenuItem // "New" — navigate to create page
340
- Actions.list(): MenuItem // "List" — navigate to list page
341
- Actions.view(): MenuItem // "View" — view selected entity
342
- Actions.viewHistory(): MenuItem // "History" — view entity history
343
- Actions.copy(): MenuItem // "Copy" — copy selected entity
344
- Actions.edit(): MenuItem // "Edit" — edit selected entity
345
- Actions.delete(): MenuItem // "Delete" — trigger delete confirm dialog
346
- ```
347
-
348
- ### `CFTUtil` — custom field helpers
349
-
350
- ```typescript
351
- CFTUtil.get(name: string, row: any): CTFRow
352
- // Extract CTF data from an entity row.
353
-
354
- CFTUtil.set(name: string, row: any, ctf: CTFRow): void
355
- // Store CTF data back into a row.
356
- ```
357
-
358
- ### `NSACacheService` — cached API calls
359
-
360
- All caches use `namirasoft-core` storage. These are called internally by components but can be used directly:
361
-
362
- ```typescript
363
- NSACacheService.getProducts(server, current_product_id)
364
- // Cache: 7 days. Fetches all products, excludes current.
365
-
366
- NSACacheService.getConsent(server, product_id, user_id)
367
- // Cache: 7 days. Fetches user consent for a product.
368
-
369
- NSACacheService.getFilterLinks(server, product_id, search?)
370
- // Cache: 7 days. Fetches navigation links for sidebar.
371
-
372
- NSACacheService.getMasterMenuStatus()
373
- // Cache: 30 days. Persists sidebar open/closed state.
374
- ```
375
-
376
- ---
377
-
378
- ## Usage Pattern — Setting up a Console
379
-
380
- ### 1 — Configure the router
381
-
382
- ```tsx
383
- // src/index.tsx
384
- import { BrowserRouter } from 'react-router-dom';
385
- import { NSARouterMaker, NSARouterMakerConfig } from 'namirasoft-account-react';
386
-
387
- const config: NSARouterMakerConfig = {
388
- requirement: { verification: { email: true, phone: false } },
389
- onRenderOnLogout: (props, banned) => <div>Please log in</div>,
390
- renderOnNSALayout: (props, children) => (
391
- <NSALayout {...props}>{children}</NSALayout>
392
- ),
393
- onRenderOnLogin: (props) => <MyAppRoutes {...props} />,
394
- };
395
-
396
- const router = new NSARouterMaker('my-product-id', config);
397
-
398
- ReactDOM.createRoot(document.getElementById('root')!).render(
399
- <BrowserRouter>
400
- <router.Component />
401
- </BrowserRouter>
402
- );
403
- ```
404
-
405
- ### 2 — Define an entity
406
-
407
- ```typescript
408
- import { IEntityInfo } from 'namirasoft-account-react';
409
-
410
- const ProjectEntity: IEntityInfo<ProjectRow, ProjectInputRow> = {
411
- product_id: 'my-product-id',
412
- name: 'Project',
413
- tables: [{ table: ProjectTable, required: true }],
414
- server: {
415
- get: (id) => projectServer.get(id),
416
- list: (query) => projectServer.list(query),
417
- create: (input) => projectServer.create(input),
418
- update: (id, input) => projectServer.update(id, input),
419
- delete: (id) => projectServer.delete(id),
420
- value_list: (col, table, ...) => projectServer.valueList(col, table),
421
- },
422
- client: {
423
- getListURL: () => '/projects',
424
- getNewURL: () => '/projects/new',
425
- getEditURL: (row) => `/projects/${row.id}/edit`,
426
- getViewURL: (row) => `/projects/${row.id}`,
427
- getCopyURL: (row) => `/projects/${row.id}/copy`,
428
- getColumns: () => [ /* column definitions */ ],
429
- },
430
- };
431
- ```
432
-
433
- ### 3 — Use layout sections
434
-
435
- ```tsx
436
- // List page
437
- <NSASectionList entity={ProjectEntity} props={routerProps} />
438
-
439
- // Edit page
440
- <NSASectionEdit entity={ProjectEntity} props={routerProps} id={params.id} />
441
-
442
- // View page
443
- <NSASectionView entity={ProjectEntity} props={routerProps} id={params.id} />
444
- ```
445
-
446
- ### 4 — Use secret fields
447
-
448
- ```tsx
449
- // In a form
450
- <NSBoxSecret
451
- label="API Key"
452
- value={form.api_key}
453
- onChange={(val) => setForm({ ...form, api_key: val })}
454
- server={secretServer}
455
- />
456
-
457
- // In a detail view
458
- <NSLabelSecret value={row.api_key} server={secretServer} />
459
-
460
- // In a table column
461
- columns.push({
462
- field: 'api_key',
463
- formatter: SecretFormatter(200),
464
- });
465
- ```
466
-
467
- ### 5 — Subscription gate
468
-
469
- ```tsx
470
- <PaymentRequired product_id="my-product-id" props={routerProps}>
471
- <PremiumFeatureComponent />
472
- </PaymentRequired>
473
- ```
474
-
475
- ---
476
-
477
- ## Source Files
478
-
479
- | File | Responsibility |
480
- |------|---------------|
481
- | `src/main.ts` | All public exports |
482
- | `src/NSARouterMaker.tsx` | Auth-state router |
483
- | `src/NSARouterMakerConfig.ts` | Router config interface |
484
- | `src/NSARouterMakerProps.ts` | Injected props interface |
485
- | `src/IEntityInfo.ts` | Entity definition interface |
486
- | `src/NSACacheService.ts` | Cached API calls |
487
- | `src/CTFRow.ts` | CTF data structure |
488
- | `src/UseParams.tsx` | URL params hook wrapper |
489
- | `src/components/NSALayout.tsx` | Root layout |
490
- | `src/components/NSAMasterMenu.tsx` | Sidebar navigation |
491
- | `src/components/NSAAccessListDialog.tsx` | Access/impersonation dialog |
492
- | `src/components/NSAMessageListDialog.tsx` | Message center dialog |
493
- | `src/components/NSAProductListDialog.tsx` | Product picker dialog |
494
- | `src/components/NSAWorkspaceListDialog.tsx` | Workspace switcher dialog |
495
- | `src/components/NSAUserDialog.tsx` | User profile dialog |
496
- | `src/components/NSBoxSecret.tsx` | Secret input |
497
- | `src/components/NSLabelSecret.tsx` | Secret display label |
498
- | `src/layouts/NSALayout.tsx` | Layout with all dialogs |
499
- | `src/layouts/NSASectionList.tsx` | Entity list section |
500
- | `src/layouts/NSASectionEdit.tsx` | Entity edit section |
501
- | `src/layouts/NSASectionView.tsx` | Entity view section |
502
- | `src/layouts/NSASectionViewTabPage.tsx` | View tab |
503
- | `src/layouts/NSASectionEditTabPage.tsx` | Edit tab |
504
- | `src/layouts/Actions.ts` | Menu action builders |
505
- | `src/layouts/CFTUtil.ts` | CTF get/set helpers |
506
- | `src/formatters/SecretFormatter.tsx` | Table column secret formatter |
507
- | `src/pages/NSALoginPage.tsx` | Login page |
508
- | `src/pages/NSAConsentPage.tsx` | Consent page |
509
- | `src/pages/NSAEmailVerificationPage.tsx` | Email verification |
510
- | `src/pages/NSAPhoneVerificationPage.tsx` | Phone verification |
511
- | `src/pages/NSAVerificationPage.tsx` | Verification base |
512
- | `src/pages/NSAHomePage.tsx` | Home/product grid |
513
- | `src/pages/PaymentRequired.tsx` | Payment gate |
514
- | `.env.template` | Required environment variables |
1
+ ---
2
+ name: namirasoft-account-react
3
+ description: Use when working with the namirasoft-account-react npm package — a React UI library providing auth flows, workspace/access/product dialogs, CRUD layouts (list/view/edit), secret field components, and an auth-gated router for Namirasoft Console frontends.
4
+ triggers:
5
+ - namirasoft-account-react
6
+ - NSARouterMaker
7
+ - NSALayout
8
+ - NSASectionList
9
+ - NSASectionEdit
10
+ - NSASectionView
11
+ - NSBoxSecret
12
+ - account react
13
+ ---
14
+
15
+ # namirasoft-account-react
16
+
17
+ **Package:** `namirasoft-account-react` v1.4.413
18
+ **Purpose:** Enterprise React UI library for Namirasoft products. Provides the complete authentication flow (login, verification, consent), workspace/access/product management dialogs, generic CRUD layouts (list/view/edit), secret field components, and a router framework that gates pages behind authentication state.
19
+ **Stack:** React 18, TypeScript, React Router 7, Bootstrap 5, CSS Modules.
20
+
21
+ ---
22
+
23
+ ## When to use this package
24
+
25
+ Use `namirasoft-account-react` in every **frontend Console** (React SPA) that needs to:
26
+ - Authenticate users via the Namirasoft Account service
27
+ - Enforce email and phone verification before access
28
+ - Show a consent/terms page when policies change
29
+ - Provide workspace switching, access (impersonation), and product navigation
30
+ - Render generic entity list / view / edit pages
31
+ - Store and display sensitive secrets (encrypted fields)
32
+ - Poll and display in-app messages
33
+
34
+ ---
35
+
36
+ ## Environment Variables
37
+
38
+ Copy `.env.template` and fill in all values before running:
39
+
40
+ ```bash
41
+ REACT_APP_BASE_PATH="" # sub-path if not at root
42
+ REACT_APP_BASE_URL_ACCESS="https://access.namirasoft.com/api/v1"
43
+ REACT_APP_BASE_URL_ACCOUNT="https://account.namirasoft.com/api/v1"
44
+ REACT_APP_BASE_URL_ACCOUNT_CONSOLE="https://account.namirasoft.com"
45
+ REACT_APP_BASE_URL_API_LINK="https://namirasoft.com/api/link/v1"
46
+ REACT_APP_BASE_URL_API_PRODUCT="https://namirasoft.com/api/product/v1"
47
+ REACT_APP_BASE_URL_FIELD="https://field.namirasoft.com/api/v1"
48
+ REACT_APP_BASE_URL_HISTORY="https://history.namirasoft.com/api/v1"
49
+ REACT_APP_BASE_URL_HISTORY_CONSOLE="https://history.namirasoft.com"
50
+ REACT_APP_BASE_URL_MESSAGE="https://message.namirasoft.com/api/v1"
51
+ REACT_APP_BASE_URL_MESSAGE_CONSOLE="https://message.namirasoft.com"
52
+ REACT_APP_BASE_URL_SECRET="https://secret.namirasoft.com/api/v1"
53
+ REACT_APP_BASE_URL_WORKSPACE="https://workspace.namirasoft.com/api/v1"
54
+ ```
55
+
56
+ ---
57
+
58
+ ## Exports (`main.ts`)
59
+
60
+ ### Components
61
+
62
+ | Export | File | Description |
63
+ |--------|------|-------------|
64
+ | `NSAAccessListDialog` | `components/NSAAccessListDialog.tsx` | Incoming permissions / impersonation switcher |
65
+ | `NSAMessageListDialog` | `components/NSAMessageListDialog.tsx` | Unread message center (max 4, mark-all-seen) |
66
+ | `NSAProductListDialog` | `components/NSAProductListDialog.tsx` | Searchable product list |
67
+ | `NSAWorkspaceListDialog` | `components/NSAWorkspaceListDialog.tsx` | Workspace switcher |
68
+ | `NSAUserDialog` | `components/NSAUserDialog.tsx` | User profile and settings dialog |
69
+ | `NSAMasterMenu` | `components/NSAMasterMenu.tsx` | Sidebar navigation with search and collapse |
70
+ | `NSAMasterMenuItem` | `components/NSAMasterMenuItem.tsx` | Individual menu item |
71
+ | `NSBoxSecret` | `components/NSBoxSecret.tsx` | Secret/encrypted value input |
72
+ | `NSLabelSecret` | `components/NSLabelSecret.tsx` | Secret/encrypted value display label |
73
+
74
+ ### Layouts
75
+
76
+ | Export | File | Description |
77
+ |--------|------|-------------|
78
+ | `NSALayout` | `layouts/NSALayout.tsx` | Root layout: header, master menu, all dialogs, delete confirm |
79
+ | `NSASectionList` | `layouts/NSASectionList.tsx` | Entity table with filter/sort/select |
80
+ | `NSASectionEdit` | `layouts/NSASectionEdit.tsx` | Entity create/update form (tabbed) |
81
+ | `NSASectionView` | `layouts/NSASectionView.tsx` | Entity read-only detail view (tabbed) |
82
+ | `NSASectionViewTabPage` | `layouts/NSASectionViewTabPage.tsx` | Single tab inside `NSASectionView` |
83
+ | `NSASectionEditTabPage` | `layouts/NSASectionEditTabPage.tsx` | Single tab inside `NSASectionEdit` |
84
+
85
+ ### Pages
86
+
87
+ | Export | File | Description |
88
+ |--------|------|-------------|
89
+ | `NSALoginPage` | `pages/NSALoginPage.tsx` | Login page — opens OAuth flow |
90
+ | `NSAConsentPage` | `pages/NSAConsentPage.tsx` | Terms/privacy acceptance |
91
+ | `NSAEmailVerificationPage` | `pages/NSAEmailVerificationPage.tsx` | Email verification (send + verify code) |
92
+ | `NSAPhoneVerificationPage` | `pages/NSAPhoneVerificationPage.tsx` | Phone verification (enter number + SMS code) |
93
+ | `NSAVerificationPage` | `pages/NSAVerificationPage.tsx` | Generic verification base component |
94
+ | `NSAHomePage` | `pages/NSAHomePage.tsx` | Product grid home page |
95
+ | `PaymentRequired` | `pages/PaymentRequired.tsx` | Subscription gate wrapper |
96
+
97
+ ### Formatters
98
+
99
+ | Export | File | Description |
100
+ |--------|------|-------------|
101
+ | `SecretFormatter` | `formatters/SecretFormatter.tsx` | Table cell formatter for encrypted secret values |
102
+
103
+ ### Router & Config
104
+
105
+ | Export | File | Description |
106
+ |--------|------|-------------|
107
+ | `NSARouterMaker` | `NSARouterMaker.tsx` | Auth-aware router — gates pages by login/verification state |
108
+ | `NSARouterMakerProps` | `NSARouterMakerProps.ts` | Props injected into routed components |
109
+ | `NSARouterMakerConfig` | `NSARouterMakerConfig.ts` | Config callbacks for `NSARouterMaker` |
110
+
111
+ ### Utilities
112
+
113
+ | Export | File | Description |
114
+ |--------|------|-------------|
115
+ | `IEntityInfo` | `IEntityInfo.ts` | Entity definition interface for CRUD pages |
116
+ | `Actions` | `layouts/Actions.ts` | Menu action builder (new, view, edit, delete, …) |
117
+ | `CFTUtil` | `layouts/CFTUtil.ts` | Custom Table Fields get/set helpers |
118
+ | `UseParams` | `UseParams.tsx` | Hook wrapper for URL params |
119
+
120
+ ---
121
+
122
+ ## Key Types & Interfaces
123
+
124
+ ### `NSARouterMakerConfig`
125
+
126
+ Callbacks that configure the router's rendering behaviour:
127
+
128
+ ```typescript
129
+ interface NSARouterMakerConfig {
130
+ // Called when user is authenticated and all verifications pass
131
+ onRenderOnLogin(props: NSARouterMakerProps): ReactNode;
132
+
133
+ // Called when user is not authenticated (banned = account suspended)
134
+ onRenderOnLogout(props: NSARouterMakerProps, banned: boolean): ReactNode;
135
+
136
+ // Wraps any page in NSALayout (called for all authenticated renders)
137
+ renderOnNSALayout(props: NSARouterMakerProps, children: ReactNode): ReactNode;
138
+
139
+ // Optional: custom render override
140
+ getCustomRender?(props: NSARouterMakerProps): ReactNode | null;
141
+
142
+ // Which verifications are required before granting access
143
+ requirement: {
144
+ verification: {
145
+ email: boolean;
146
+ phone: boolean;
147
+ };
148
+ };
149
+ }
150
+ ```
151
+
152
+ ### `NSARouterMakerProps`
153
+
154
+ Injected into every routed component. Extends `NSRouterMakerProps` from `namirasoft-site-react`.
155
+
156
+ ```typescript
157
+ interface NSARouterMakerProps {
158
+ product_id: string;
159
+ account: {
160
+ token_manager: TokenManager;
161
+ server: NamirasoftAccountServer;
162
+ };
163
+ url: {
164
+ getQueryStrings(): Record<string, string>;
165
+ getQuery(key: string): string | null;
166
+ getLink(path: string): string;
167
+ redirect(path: string): void;
168
+ };
169
+ renderer: {
170
+ renderOnNSALayout(children: ReactNode): ReactNode;
171
+ };
172
+ // ... inherited from NSRouterMakerProps
173
+ }
174
+ ```
175
+
176
+ ### `IEntityInfo<EntityType, EntityTypeInput>`
177
+
178
+ Defines everything needed to build a list/view/edit page for an entity:
179
+
180
+ ```typescript
181
+ interface IEntityInfo<EntityType, EntityTypeInput> {
182
+ product_id: string;
183
+ name: string;
184
+ tables: { table: BaseMetaTable; required: boolean }[];
185
+
186
+ server: {
187
+ value_list(column: string, table: string, ...): Promise<string[]>;
188
+ get(id: string): Promise<EntityType>;
189
+ list(query: any): Promise<EntityType[]>;
190
+ create(input: EntityTypeInput): Promise<EntityType>;
191
+ update(id: string, input: EntityTypeInput): Promise<EntityType>;
192
+ delete(id: string): Promise<EntityType>;
193
+ };
194
+
195
+ client: {
196
+ getListURL(): string;
197
+ getNewURL(): string;
198
+ getCopyURL(row: EntityType): string;
199
+ getEditURL(row: EntityType): string;
200
+ getViewURL(row: EntityType): string;
201
+ getColumns(): ColumnDefinition[];
202
+ onCreate?(row: EntityType): void;
203
+ onUpdate?(row: EntityType): void;
204
+ onSuccess?(row: EntityType): void;
205
+ getMenus?(row: EntityType): MenuItem[];
206
+ };
207
+ }
208
+ ```
209
+
210
+ ### `CTFRow`
211
+
212
+ Custom Table Fields structure attached to entities that support dynamic field definitions:
213
+
214
+ ```typescript
215
+ interface CTFRow {
216
+ categories: EntityCategoryInputRow[];
217
+ fields: EntityFieldInputRow[];
218
+ tags: EntityTagInputRow[];
219
+ }
220
+ ```
221
+
222
+ ---
223
+
224
+ ## Router Authentication Flow
225
+
226
+ `NSARouterMaker` automatically routes the user through these states in order:
227
+
228
+ 1. **Not authenticated** → renders `NSALoginPage` (opens OAuth popup via `NamirasoftAccountClient`)
229
+ 2. **Banned** → renders error; `onRenderOnLogout(props, true)` is called
230
+ 3. **Consent outdated** → renders `NSAConsentPage`
231
+ 4. **Email not verified** (if `requirement.verification.email`) → renders `NSAEmailVerificationPage`
232
+ 5. **Phone not verified** (if `requirement.verification.phone`) → renders `NSAPhoneVerificationPage`
233
+ 6. **All checks pass** → calls `onRenderOnLogin(props)`
234
+
235
+ ---
236
+
237
+ ## Components — Details
238
+
239
+ ### `NSALayout`
240
+
241
+ Root layout for all authenticated pages. Wraps content and mounts:
242
+ - Top header with icon buttons for messages, access, workspaces, products, and user
243
+ - `NSAMasterMenu` sidebar
244
+ - `NSAAccessListDialog`, `NSAMessageListDialog`, `NSAProductListDialog`, `NSAWorkspaceListDialog`, `NSAUserDialog`
245
+ - Delete confirmation dialog
246
+ - Message count polling
247
+
248
+ Props include the full `NSARouterMakerProps` plus section state managers for list/edit/view.
249
+
250
+ ### `NSASectionList`
251
+
252
+ Table-based listing with:
253
+ - Server-driven column schema
254
+ - Client-side column override (custom renderers, formatters)
255
+ - Multi-select checkboxes
256
+ - Filter/sort query params
257
+ - Action menus per row
258
+ - Custom mode rendering (e.g. search-and-select mode)
259
+
260
+ ### `NSASectionEdit`
261
+
262
+ Form for create and update:
263
+ - Tab-based field groups (`NSASectionEditTabPage` per tab)
264
+ - Validation from server schema
265
+ - Handles create vs update automatically
266
+
267
+ ### `NSASectionView`
268
+
269
+ Read-only detail page:
270
+ - Tab-based layout (`NSASectionViewTabPage` per tab)
271
+ - `NSASectionViewTabMore` for overflow tabs
272
+ - Optional hooks before/after render
273
+
274
+ ### `NSBoxSecret`
275
+
276
+ Encrypted input for passwords, API keys, or tokens:
277
+ - Toggle between masked and plain text
278
+ - Save value to Secret service (returns an ID)
279
+ - Reference existing secret by ID
280
+ - Handles encryption/decryption automatically
281
+
282
+ ### `NSLabelSecret`
283
+
284
+ Display label for encrypted secrets:
285
+ - Shows masked value by default
286
+ - Decrypts and reveals on toggle
287
+ - Reads from Secret service by ID
288
+
289
+ ### `NSAMasterMenu`
290
+
291
+ Sidebar navigation:
292
+ - Hierarchical menu items from `namirasoft-api-link`
293
+ - Debounced search filter
294
+ - Collapse/expand toggle (state persisted in `NSACacheService`)
295
+
296
+ ### `NSAMessageListDialog`
297
+
298
+ - Fetches up to 4 unread messages
299
+ - Mark all as seen button
300
+ - Opens full message in new window
301
+ - Integrates with message count badge in header
302
+
303
+ ### `NSAAccessListDialog`
304
+
305
+ - Lists incoming permissions (accounts that can act as the user)
306
+ - Switch to an impersonated account
307
+ - Shows who is currently being impersonated
308
+
309
+ ### `NSAWorkspaceListDialog`
310
+
311
+ - Lists all workspaces for the current product
312
+ - Highlights default and current workspace
313
+ - Switching workspace triggers page reload
314
+
315
+ ### `PaymentRequired`
316
+
317
+ Wraps content and checks subscription status. If not subscribed:
318
+ - Shows payment offer
319
+ - Opens payment URL with return callback
320
+ - Blocks child content until subscription confirmed
321
+
322
+ ### `SecretFormatter`
323
+
324
+ A table column formatter factory:
325
+
326
+ ```typescript
327
+ SecretFormatter(width?: number): ColumnFormatter
328
+ // Returns a formatter that decrypts and masks secret cell values.
329
+ ```
330
+
331
+ ---
332
+
333
+ ## Utilities
334
+
335
+ ### `Actions` — static menu item builders
336
+
337
+ ```typescript
338
+ Actions.apply(onClick: () => void): MenuItem // Apply button
339
+ Actions._new(): MenuItem // "New" — navigate to create page
340
+ Actions.list(): MenuItem // "List" — navigate to list page
341
+ Actions.view(): MenuItem // "View" — view selected entity
342
+ Actions.viewHistory(): MenuItem // "History" — view entity history
343
+ Actions.copy(): MenuItem // "Copy" — copy selected entity
344
+ Actions.edit(): MenuItem // "Edit" — edit selected entity
345
+ Actions.delete(): MenuItem // "Delete" — trigger delete confirm dialog
346
+ ```
347
+
348
+ ### `CFTUtil` — custom field helpers
349
+
350
+ ```typescript
351
+ CFTUtil.get(name: string, row: any): CTFRow
352
+ // Extract CTF data from an entity row.
353
+
354
+ CFTUtil.set(name: string, row: any, ctf: CTFRow): void
355
+ // Store CTF data back into a row.
356
+ ```
357
+
358
+ ### `NSACacheService` — cached API calls
359
+
360
+ All caches use `namirasoft-core` storage. These are called internally by components but can be used directly:
361
+
362
+ ```typescript
363
+ NSACacheService.getProducts(server, current_product_id)
364
+ // Cache: 7 days. Fetches all products, excludes current.
365
+
366
+ NSACacheService.getConsent(server, product_id, user_id)
367
+ // Cache: 7 days. Fetches user consent for a product.
368
+
369
+ NSACacheService.getFilterLinks(server, product_id, search?)
370
+ // Cache: 7 days. Fetches navigation links for sidebar.
371
+
372
+ NSACacheService.getMasterMenuStatus()
373
+ // Cache: 30 days. Persists sidebar open/closed state.
374
+ ```
375
+
376
+ ---
377
+
378
+ ## Usage Pattern — Setting up a Console
379
+
380
+ ### 1 — Configure the router
381
+
382
+ ```tsx
383
+ // src/index.tsx
384
+ import { BrowserRouter } from 'react-router-dom';
385
+ import { NSARouterMaker, NSARouterMakerConfig } from 'namirasoft-account-react';
386
+
387
+ const config: NSARouterMakerConfig = {
388
+ requirement: { verification: { email: true, phone: false } },
389
+ onRenderOnLogout: (props, banned) => <div>Please log in</div>,
390
+ renderOnNSALayout: (props, children) => (
391
+ <NSALayout {...props}>{children}</NSALayout>
392
+ ),
393
+ onRenderOnLogin: (props) => <MyAppRoutes {...props} />,
394
+ };
395
+
396
+ const router = new NSARouterMaker('my-product-id', config);
397
+
398
+ ReactDOM.createRoot(document.getElementById('root')!).render(
399
+ <BrowserRouter>
400
+ <router.Component />
401
+ </BrowserRouter>
402
+ );
403
+ ```
404
+
405
+ ### 2 — Define an entity
406
+
407
+ ```typescript
408
+ import { IEntityInfo } from 'namirasoft-account-react';
409
+
410
+ const ProjectEntity: IEntityInfo<ProjectRow, ProjectInputRow> = {
411
+ product_id: 'my-product-id',
412
+ name: 'Project',
413
+ tables: [{ table: ProjectTable, required: true }],
414
+ server: {
415
+ get: (id) => projectServer.get(id),
416
+ list: (query) => projectServer.list(query),
417
+ create: (input) => projectServer.create(input),
418
+ update: (id, input) => projectServer.update(id, input),
419
+ delete: (id) => projectServer.delete(id),
420
+ value_list: (col, table, ...) => projectServer.valueList(col, table),
421
+ },
422
+ client: {
423
+ getListURL: () => '/projects',
424
+ getNewURL: () => '/projects/new',
425
+ getEditURL: (row) => `/projects/${row.id}/edit`,
426
+ getViewURL: (row) => `/projects/${row.id}`,
427
+ getCopyURL: (row) => `/projects/${row.id}/copy`,
428
+ getColumns: () => [ /* column definitions */ ],
429
+ },
430
+ };
431
+ ```
432
+
433
+ ### 3 — Use layout sections
434
+
435
+ ```tsx
436
+ // List page
437
+ <NSASectionList entity={ProjectEntity} props={routerProps} />
438
+
439
+ // Edit page
440
+ <NSASectionEdit entity={ProjectEntity} props={routerProps} id={params.id} />
441
+
442
+ // View page
443
+ <NSASectionView entity={ProjectEntity} props={routerProps} id={params.id} />
444
+ ```
445
+
446
+ ### 4 — Use secret fields
447
+
448
+ ```tsx
449
+ // In a form
450
+ <NSBoxSecret
451
+ label="API Key"
452
+ value={form.api_key}
453
+ onChange={(val) => setForm({ ...form, api_key: val })}
454
+ server={secretServer}
455
+ />
456
+
457
+ // In a detail view
458
+ <NSLabelSecret value={row.api_key} server={secretServer} />
459
+
460
+ // In a table column
461
+ columns.push({
462
+ field: 'api_key',
463
+ formatter: SecretFormatter(200),
464
+ });
465
+ ```
466
+
467
+ ### 5 — Subscription gate
468
+
469
+ ```tsx
470
+ <PaymentRequired product_id="my-product-id" props={routerProps}>
471
+ <PremiumFeatureComponent />
472
+ </PaymentRequired>
473
+ ```
474
+
475
+ ---
476
+
477
+ ## Source Files
478
+
479
+ | File | Responsibility |
480
+ |------|---------------|
481
+ | `src/main.ts` | All public exports |
482
+ | `src/NSARouterMaker.tsx` | Auth-state router |
483
+ | `src/NSARouterMakerConfig.ts` | Router config interface |
484
+ | `src/NSARouterMakerProps.ts` | Injected props interface |
485
+ | `src/IEntityInfo.ts` | Entity definition interface |
486
+ | `src/NSACacheService.ts` | Cached API calls |
487
+ | `src/CTFRow.ts` | CTF data structure |
488
+ | `src/UseParams.tsx` | URL params hook wrapper |
489
+ | `src/components/NSALayout.tsx` | Root layout |
490
+ | `src/components/NSAMasterMenu.tsx` | Sidebar navigation |
491
+ | `src/components/NSAAccessListDialog.tsx` | Access/impersonation dialog |
492
+ | `src/components/NSAMessageListDialog.tsx` | Message center dialog |
493
+ | `src/components/NSAProductListDialog.tsx` | Product picker dialog |
494
+ | `src/components/NSAWorkspaceListDialog.tsx` | Workspace switcher dialog |
495
+ | `src/components/NSAUserDialog.tsx` | User profile dialog |
496
+ | `src/components/NSBoxSecret.tsx` | Secret input |
497
+ | `src/components/NSLabelSecret.tsx` | Secret display label |
498
+ | `src/layouts/NSALayout.tsx` | Layout with all dialogs |
499
+ | `src/layouts/NSASectionList.tsx` | Entity list section |
500
+ | `src/layouts/NSASectionEdit.tsx` | Entity edit section |
501
+ | `src/layouts/NSASectionView.tsx` | Entity view section |
502
+ | `src/layouts/NSASectionViewTabPage.tsx` | View tab |
503
+ | `src/layouts/NSASectionEditTabPage.tsx` | Edit tab |
504
+ | `src/layouts/Actions.ts` | Menu action builders |
505
+ | `src/layouts/CFTUtil.ts` | CTF get/set helpers |
506
+ | `src/formatters/SecretFormatter.tsx` | Table column secret formatter |
507
+ | `src/pages/NSALoginPage.tsx` | Login page |
508
+ | `src/pages/NSAConsentPage.tsx` | Consent page |
509
+ | `src/pages/NSAEmailVerificationPage.tsx` | Email verification |
510
+ | `src/pages/NSAPhoneVerificationPage.tsx` | Phone verification |
511
+ | `src/pages/NSAVerificationPage.tsx` | Verification base |
512
+ | `src/pages/NSAHomePage.tsx` | Home/product grid |
513
+ | `src/pages/PaymentRequired.tsx` | Payment gate |
514
+ | `.env.template` | Required environment variables |