@genesislcap/ai-assistant 15.71.0-FUI-2650.1 → 15.71.0
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/ai-assistant.api.json +0 -97
- package/dist/ai-assistant.d.ts +0 -65
- package/dist/chat-driver.cjs +0 -18031
- package/dist/chat-driver.cjs.map +4 -4
- package/dist/chat-driver.mjs +0 -18024
- package/dist/chat-driver.mjs.map +4 -4
- package/dist/custom-elements.json +6856 -9696
- package/dist/dts/chat-driver-node.d.ts +0 -2
- package/dist/dts/chat-driver-node.d.ts.map +1 -1
- package/dist/dts/index.d.ts +0 -1
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/react.d.ts +0 -10
- package/dist/esm/chat-driver-node.js +0 -6
- package/dist/esm/index.js +0 -3
- package/dist/react.cjs +0 -7
- package/dist/react.mjs +0 -6
- package/package.json +17 -24
- package/scripts/smoke-chat-driver-node.mjs +0 -15
- package/dist/dts/code-review/code-review.types.d.ts +0 -76
- package/dist/dts/code-review/code-review.types.d.ts.map +0 -1
- package/dist/dts/code-review/code-reviewer.agent.d.ts +0 -77
- package/dist/dts/code-review/code-reviewer.agent.d.ts.map +0 -1
- package/dist/dts/code-review/code-reviewer.prompt.d.ts +0 -23
- package/dist/dts/code-review/code-reviewer.prompt.d.ts.map +0 -1
- package/dist/dts/code-review/gate.d.ts +0 -44
- package/dist/dts/code-review/gate.d.ts.map +0 -1
- package/dist/dts/code-review/index.d.ts +0 -27
- package/dist/dts/code-review/index.d.ts.map +0 -1
- package/dist/dts/code-review/review-changes.d.ts +0 -70
- package/dist/dts/code-review/review-changes.d.ts.map +0 -1
- package/dist/dts/code-review/rules/context-trigger-map.d.ts +0 -6
- package/dist/dts/code-review/rules/context-trigger-map.d.ts.map +0 -1
- package/dist/dts/code-review/rules/context.registry.d.ts +0 -123
- package/dist/dts/code-review/rules/context.registry.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-ai-extensions.d.ts +0 -13
- package/dist/dts/code-review/rules/fui-ai-extensions.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-blotter.d.ts +0 -16
- package/dist/dts/code-review/rules/fui-blotter.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-chart.d.ts +0 -20
- package/dist/dts/code-review/rules/fui-chart.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-column-defs.d.ts +0 -21
- package/dist/dts/code-review/rules/fui-column-defs.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-components.d.ts +0 -9
- package/dist/dts/code-review/rules/fui-components.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-criteria.d.ts +0 -32
- package/dist/dts/code-review/rules/fui-criteria.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-custom-renderer.d.ts +0 -15
- package/dist/dts/code-review/rules/fui-custom-renderer.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-dashboard.d.ts +0 -19
- package/dist/dts/code-review/rules/fui-dashboard.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-dialogs.d.ts +0 -19
- package/dist/dts/code-review/rules/fui-dialogs.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-entity-management.d.ts +0 -19
- package/dist/dts/code-review/rules/fui-entity-management.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-error-boundary.d.ts +0 -9
- package/dist/dts/code-review/rules/fui-error-boundary.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-eventing.d.ts +0 -8
- package/dist/dts/code-review/rules/fui-eventing.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-flexlayout.d.ts +0 -17
- package/dist/dts/code-review/rules/fui-flexlayout.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-flyout-panel.d.ts +0 -10
- package/dist/dts/code-review/rules/fui-flyout-panel.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-form-component.d.ts +0 -9
- package/dist/dts/code-review/rules/fui-form-component.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-formatters.d.ts +0 -12
- package/dist/dts/code-review/rules/fui-formatters.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-foundation-comms.d.ts +0 -10
- package/dist/dts/code-review/rules/fui-foundation-comms.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-global-filters.d.ts +0 -33
- package/dist/dts/code-review/rules/fui-global-filters.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-import-surface.d.ts +0 -37
- package/dist/dts/code-review/rules/fui-import-surface.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-inline-editing.d.ts +0 -10
- package/dist/dts/code-review/rules/fui-inline-editing.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-layout.d.ts +0 -7
- package/dist/dts/code-review/rules/fui-layout.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-notifications.d.ts +0 -12
- package/dist/dts/code-review/rules/fui-notifications.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-primitives.d.ts +0 -26
- package/dist/dts/code-review/rules/fui-primitives.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-rapid-grid-pro.d.ts +0 -18
- package/dist/dts/code-review/rules/fui-rapid-grid-pro.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-redux-store.d.ts +0 -8
- package/dist/dts/code-review/rules/fui-redux-store.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-reporting.d.ts +0 -19
- package/dist/dts/code-review/rules/fui-reporting.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-styling.d.ts +0 -15
- package/dist/dts/code-review/rules/fui-styling.d.ts.map +0 -1
- package/dist/dts/code-review/rules/fui-trade-form.d.ts +0 -13
- package/dist/dts/code-review/rules/fui-trade-form.d.ts.map +0 -1
- package/dist/dts/code-review/submit-code-review.tool.d.ts +0 -12
- package/dist/dts/code-review/submit-code-review.tool.d.ts.map +0 -1
- package/dist/dts/code-review/unified-diff.d.ts +0 -7
- package/dist/dts/code-review/unified-diff.d.ts.map +0 -1
- package/dist/dts/code-review/verdict.d.ts +0 -23
- package/dist/dts/code-review/verdict.d.ts.map +0 -1
- package/dist/dts/components/code-review-result/code-review-result.d.ts +0 -26
- package/dist/dts/components/code-review-result/code-review-result.d.ts.map +0 -1
- package/dist/esm/code-review/code-review.types.js +0 -6
- package/dist/esm/code-review/code-reviewer.agent.js +0 -167
- package/dist/esm/code-review/code-reviewer.prompt.js +0 -103
- package/dist/esm/code-review/gate.js +0 -93
- package/dist/esm/code-review/index.js +0 -28
- package/dist/esm/code-review/review-changes.js +0 -123
- package/dist/esm/code-review/rules/context-trigger-map.js +0 -20
- package/dist/esm/code-review/rules/context.registry.js +0 -772
- package/dist/esm/code-review/rules/fui-ai-extensions.js +0 -306
- package/dist/esm/code-review/rules/fui-blotter.js +0 -596
- package/dist/esm/code-review/rules/fui-chart.js +0 -669
- package/dist/esm/code-review/rules/fui-column-defs.js +0 -862
- package/dist/esm/code-review/rules/fui-components.js +0 -245
- package/dist/esm/code-review/rules/fui-criteria.js +0 -538
- package/dist/esm/code-review/rules/fui-custom-renderer.js +0 -612
- package/dist/esm/code-review/rules/fui-dashboard.js +0 -604
- package/dist/esm/code-review/rules/fui-dialogs.js +0 -588
- package/dist/esm/code-review/rules/fui-entity-management.js +0 -1014
- package/dist/esm/code-review/rules/fui-error-boundary.js +0 -244
- package/dist/esm/code-review/rules/fui-eventing.js +0 -628
- package/dist/esm/code-review/rules/fui-flexlayout.js +0 -860
- package/dist/esm/code-review/rules/fui-flyout-panel.js +0 -432
- package/dist/esm/code-review/rules/fui-form-component.js +0 -898
- package/dist/esm/code-review/rules/fui-formatters.js +0 -415
- package/dist/esm/code-review/rules/fui-foundation-comms.js +0 -518
- package/dist/esm/code-review/rules/fui-global-filters.js +0 -778
- package/dist/esm/code-review/rules/fui-import-surface.js +0 -452
- package/dist/esm/code-review/rules/fui-inline-editing.js +0 -445
- package/dist/esm/code-review/rules/fui-layout.js +0 -431
- package/dist/esm/code-review/rules/fui-notifications.js +0 -439
- package/dist/esm/code-review/rules/fui-primitives.js +0 -1216
- package/dist/esm/code-review/rules/fui-rapid-grid-pro.js +0 -650
- package/dist/esm/code-review/rules/fui-redux-store.js +0 -522
- package/dist/esm/code-review/rules/fui-reporting.js +0 -506
- package/dist/esm/code-review/rules/fui-styling.js +0 -1229
- package/dist/esm/code-review/rules/fui-trade-form.js +0 -618
- package/dist/esm/code-review/submit-code-review.tool.js +0 -43
- package/dist/esm/code-review/unified-diff.js +0 -96
- package/dist/esm/code-review/verdict.js +0 -24
- package/dist/esm/components/code-review-result/code-review-result.js +0 -89
- package/docs/code-review.md +0 -137
|
@@ -1,439 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Context injected into the UI Builder system prompt.
|
|
3
|
-
* Covers the foundation-notifications imperative API: toast, snackbar, banner, dialog, alert,
|
|
4
|
-
* and the notify-container configuration for stacking / positioning.
|
|
5
|
-
*
|
|
6
|
-
* NOTE: foundation-notifications has NO React web-component wrapper and no /react subpath.
|
|
7
|
-
* It is a pure imperative TypeScript API — import functions directly from the package root.
|
|
8
|
-
* All functions are safe to call from React event handlers, useEffect, etc.
|
|
9
|
-
*/
|
|
10
|
-
export const FUI_NOTIFICATIONS_TAGS = [
|
|
11
|
-
'toast',
|
|
12
|
-
'notification',
|
|
13
|
-
'notify',
|
|
14
|
-
'snackbar',
|
|
15
|
-
'banner',
|
|
16
|
-
'alert',
|
|
17
|
-
'show a message',
|
|
18
|
-
'show a popup message',
|
|
19
|
-
'success message',
|
|
20
|
-
'error message',
|
|
21
|
-
'warning message',
|
|
22
|
-
'info message',
|
|
23
|
-
'toast message',
|
|
24
|
-
'show notification',
|
|
25
|
-
'display notification',
|
|
26
|
-
'notification dialog',
|
|
27
|
-
'confirmation dialog',
|
|
28
|
-
'confirm before action',
|
|
29
|
-
'show a dialog',
|
|
30
|
-
'dismissible notification',
|
|
31
|
-
'auto close',
|
|
32
|
-
'auto-close notification',
|
|
33
|
-
'notification with actions',
|
|
34
|
-
'notification position',
|
|
35
|
-
'top-right toast',
|
|
36
|
-
'notification stack',
|
|
37
|
-
'configureNotifications',
|
|
38
|
-
'showNotificationToast',
|
|
39
|
-
'showNotificationSnackbar',
|
|
40
|
-
'showNotificationBanner',
|
|
41
|
-
'showNotificationDialog',
|
|
42
|
-
];
|
|
43
|
-
// No dependsOn — this module is self-contained (pure imperative functions, no sibling modules required)
|
|
44
|
-
export const FUI_NOTIFICATIONS_CONTEXT = `
|
|
45
|
-
## NOTIFICATIONS (toast / snackbar / banner / dialog / alert)
|
|
46
|
-
|
|
47
|
-
### Overview
|
|
48
|
-
|
|
49
|
-
\`foundation-notifications\` is a **pure imperative API** — there are no React web components to
|
|
50
|
-
render, no JSX, and no \`/react\` subpath. Call the exported functions directly from event handlers,
|
|
51
|
-
\`useEffect\`, async callbacks, etc.
|
|
52
|
-
|
|
53
|
-
The design-system prefix (always \`'rapid'\` in this project) is the second argument of every
|
|
54
|
-
function and drives the tag name of the UI component that gets created in the DOM.
|
|
55
|
-
|
|
56
|
-
### Import paths (verified from package source and real usage)
|
|
57
|
-
|
|
58
|
-
\`\`\`ts
|
|
59
|
-
// All notification functions — import from the package root (NOT /react, there is none)
|
|
60
|
-
import {
|
|
61
|
-
showNotificationToast,
|
|
62
|
-
showNotificationSnackbar,
|
|
63
|
-
showNotificationBanner,
|
|
64
|
-
showNotificationDialog,
|
|
65
|
-
showNotificationAlert,
|
|
66
|
-
showNotification,
|
|
67
|
-
configureNotifications,
|
|
68
|
-
sortNotificationBySeverity,
|
|
69
|
-
} from '@genesislcap/foundation-notifications';
|
|
70
|
-
|
|
71
|
-
// Types — also from the package root
|
|
72
|
-
import type {
|
|
73
|
-
ToastStructure,
|
|
74
|
-
SnackbarStructure,
|
|
75
|
-
BannerStructure,
|
|
76
|
-
DialogStructure,
|
|
77
|
-
AlertStructure,
|
|
78
|
-
NotificationStructure,
|
|
79
|
-
NotificationType,
|
|
80
|
-
ToastPosition,
|
|
81
|
-
Toast,
|
|
82
|
-
Snackbar,
|
|
83
|
-
Banner,
|
|
84
|
-
Dialog,
|
|
85
|
-
ToastButton,
|
|
86
|
-
NotificationDataRow,
|
|
87
|
-
NotifyContainerConfig,
|
|
88
|
-
} from '@genesislcap/foundation-notifications';
|
|
89
|
-
\`\`\`
|
|
90
|
-
|
|
91
|
-
> **CRITICAL:** Do NOT import from \`@genesislcap/foundation-notifications/react\` — this subpath
|
|
92
|
-
> does not exist. Do NOT add JSX for notification components.
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
### API reference (source-verified)
|
|
97
|
-
|
|
98
|
-
#### \`showNotificationToast(config: ToastStructure, tagName: string, container?: HTMLElement): void\`
|
|
99
|
-
|
|
100
|
-
Displays a toast overlay. Required: \`title\` + \`body\`.
|
|
101
|
-
|
|
102
|
-
| Field | Type | Required | Notes |
|
|
103
|
-
|---|---|---|---|
|
|
104
|
-
| \`title\` | \`string\` | yes | |
|
|
105
|
-
| \`body\` | \`string\` | yes | |
|
|
106
|
-
| \`iconName\` | \`string\` | no | icon name string (e.g. \`'check'\`, \`'bell'\`) |
|
|
107
|
-
| \`createdAt\` | \`Date\` | no | shown in date slot |
|
|
108
|
-
| \`logLevel\` | \`LogLevel\` | no | |
|
|
109
|
-
| \`toast\` | \`Toast\` | no | see Toast interface below |
|
|
110
|
-
|
|
111
|
-
**\`Toast\` interface:**
|
|
112
|
-
|
|
113
|
-
| Field | Type | Default | Notes |
|
|
114
|
-
|---|---|---|---|
|
|
115
|
-
| \`type\` | \`'error' | 'warning' | 'success'\` | none | visual style |
|
|
116
|
-
| \`position\` | \`'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'\` | \`'top-right'\` | |
|
|
117
|
-
| \`autoClose\` | \`boolean\` | \`false\` | auto-dismiss on timeout |
|
|
118
|
-
| \`closeTimeout\` | \`number\` | — | milliseconds until auto-close |
|
|
119
|
-
| \`buttons\` | \`ToastButton[]\` | — | action buttons in the toast footer |
|
|
120
|
-
| \`details\` | \`NotificationDataRow\` | — | passed to button action callbacks |
|
|
121
|
-
|
|
122
|
-
#### \`showNotificationSnackbar(config: SnackbarStructure, tagName: string): void\`
|
|
123
|
-
|
|
124
|
-
Displays a snackbar at the bottom-left. Required: \`body\`. No \`title\` field.
|
|
125
|
-
|
|
126
|
-
| Field | Type | Required | Notes |
|
|
127
|
-
|---|---|---|---|
|
|
128
|
-
| \`body\` | \`string\` | yes | |
|
|
129
|
-
| \`logLevel\` | \`LogLevel\` | no | |
|
|
130
|
-
| \`snackbar\` | \`Snackbar\` | no | |
|
|
131
|
-
|
|
132
|
-
**\`Snackbar\` interface:**
|
|
133
|
-
|
|
134
|
-
| Field | Type | Notes |
|
|
135
|
-
|---|---|---|
|
|
136
|
-
| \`type\` | \`'error' | 'success'\` | visual style (only 2 values — no \`'warning'\`) |
|
|
137
|
-
| \`autoClose\` | \`boolean\` | |
|
|
138
|
-
| \`closeTimeout\` | \`number\` | ms |
|
|
139
|
-
| \`confirmingActions\` | \`ConfirmingAction[]\` | action buttons |
|
|
140
|
-
|
|
141
|
-
#### \`showNotificationBanner(config: BannerStructure, tagName: string, boundary?: HTMLElement): void\`
|
|
142
|
-
|
|
143
|
-
Inline banner anchored inside a container. Required: \`body\`. No \`title\` field.
|
|
144
|
-
|
|
145
|
-
| Field | Type | Notes |
|
|
146
|
-
|---|---|---|
|
|
147
|
-
| \`body\` | \`string\` | required |
|
|
148
|
-
| \`logLevel\` | \`LogLevel\` | |
|
|
149
|
-
| \`banner\` | \`Banner\` | |
|
|
150
|
-
|
|
151
|
-
**\`Banner\` interface:** \`dismissingAction?: DismissingAction\`, \`confirmingActions?: ConfirmingAction[]\`
|
|
152
|
-
|
|
153
|
-
#### \`showNotificationDialog(config: DialogStructure, tagName: string, boundary?: HTMLElement): void\`
|
|
154
|
-
|
|
155
|
-
Modal-style dialog requiring user action. Required: \`title\` + \`body\`.
|
|
156
|
-
|
|
157
|
-
| Field | Type | Notes |
|
|
158
|
-
|---|---|---|
|
|
159
|
-
| \`title\` | \`string\` | required |
|
|
160
|
-
| \`body\` | \`string\` | required |
|
|
161
|
-
| \`logLevel\` | \`LogLevel\` | |
|
|
162
|
-
| \`dialog\` | \`Dialog\` | |
|
|
163
|
-
|
|
164
|
-
**\`Dialog\` interface:** \`confirmingActions?: ConfirmingAction[]\`, \`dismissingAction?: DismissingAction\`
|
|
165
|
-
|
|
166
|
-
**\`ConfirmingAction\`:** \`{ label: string; action: Function }\`
|
|
167
|
-
**\`DismissingAction\`:** \`{ label: string; action?: Function }\`
|
|
168
|
-
|
|
169
|
-
#### \`showNotificationAlert(config: AlertStructure): void\`
|
|
170
|
-
|
|
171
|
-
Calls the browser's native \`alert()\`. Required: \`title\` + \`body\`. No \`tagName\` argument.
|
|
172
|
-
Avoid this — prefer toast or dialog for a better user experience.
|
|
173
|
-
|
|
174
|
-
#### \`showNotification(structure: NotificationStructure, tagName: string, boundary?: HTMLElement): void\`
|
|
175
|
-
|
|
176
|
-
Low-level dispatcher that reads \`structure.config\` keys (\`toast\`, \`snackbar\`, \`banner\`, \`dialog\`,
|
|
177
|
-
\`alert\`) and delegates to the appropriate launcher. Use the typed helpers above instead.
|
|
178
|
-
|
|
179
|
-
#### \`configureNotifications(config: Partial<NotifyContainerConfig>): void\`
|
|
180
|
-
|
|
181
|
-
Creates or updates a \`notify-container\` in the DOM for stacking toast behaviour.
|
|
182
|
-
Call once during app initialisation (e.g. in \`useEffect(() => { ... }, [])\` or app root).
|
|
183
|
-
|
|
184
|
-
**\`NotifyContainerConfig\`** key fields:
|
|
185
|
-
|
|
186
|
-
| Field | Type | Default | Notes |
|
|
187
|
-
|---|---|---|---|
|
|
188
|
-
| \`position\` | \`ToastPosition\` | \`'top-right'\` | only \`top-left\` / \`top-right\` supported currently |
|
|
189
|
-
| \`stackThreshold\` | \`number\` | \`5\` | visible count that triggers auto-collapse |
|
|
190
|
-
| \`allowManualCollapse\` | \`boolean\` | \`true\` | shows Expand/Collapse header button |
|
|
191
|
-
| \`allowCloseAll\` | \`boolean\` | \`true\` | shows Close All header button |
|
|
192
|
-
| \`showCount\` | \`boolean\` | \`true\` | shows count in header |
|
|
193
|
-
| \`notificationInterval\` | \`number\` | \`0\` | ms delay between sequentially revealed notifications |
|
|
194
|
-
| \`designSystemPrefix\` | \`string\` | \`'rapid'\` | |
|
|
195
|
-
| \`sortFn\` | \`(a, b) => number\` | none | custom sort; use \`sortNotificationBySeverity\` for severity order |
|
|
196
|
-
|
|
197
|
-
---
|
|
198
|
-
|
|
199
|
-
### Example 1 — Toast on button click (most common pattern)
|
|
200
|
-
|
|
201
|
-
\`\`\`tsx
|
|
202
|
-
import { showNotificationToast } from '@genesislcap/foundation-notifications';
|
|
203
|
-
import { Button } from '@genesislcap/rapid-design-system/react';
|
|
204
|
-
|
|
205
|
-
function TradeActions() {
|
|
206
|
-
const handleSubmit = async () => {
|
|
207
|
-
try {
|
|
208
|
-
// ... submit logic ...
|
|
209
|
-
showNotificationToast(
|
|
210
|
-
{
|
|
211
|
-
title: 'Trade submitted',
|
|
212
|
-
body: 'Your trade has been sent for execution.',
|
|
213
|
-
toast: { type: 'success', autoClose: true, closeTimeout: 4000 },
|
|
214
|
-
},
|
|
215
|
-
'rapid',
|
|
216
|
-
);
|
|
217
|
-
} catch (err) {
|
|
218
|
-
showNotificationToast(
|
|
219
|
-
{
|
|
220
|
-
title: 'Submission failed',
|
|
221
|
-
body: err instanceof Error ? err.message : String(err),
|
|
222
|
-
toast: { type: 'error', autoClose: false },
|
|
223
|
-
},
|
|
224
|
-
'rapid',
|
|
225
|
-
);
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
return <Button appearance="primary" onClick={handleSubmit}>Submit</Button>;
|
|
230
|
-
}
|
|
231
|
-
\`\`\`
|
|
232
|
-
|
|
233
|
-
---
|
|
234
|
-
|
|
235
|
-
### Example 2 — Confirmation dialog before a destructive action
|
|
236
|
-
|
|
237
|
-
\`\`\`tsx
|
|
238
|
-
import { showNotificationDialog } from '@genesislcap/foundation-notifications';
|
|
239
|
-
import { getConnect, commitGenesisEvent } from '@genesislcap/foundation-comms';
|
|
240
|
-
import { Button } from '@genesislcap/rapid-design-system/react';
|
|
241
|
-
import { EventTradeDelete } from '../generated/genesis-event-types'; // typed DETAILS — when listed (depth like store imports — e.g. ../../ from a route page)
|
|
242
|
-
|
|
243
|
-
function DeleteButton({ tradeId }: { tradeId: string }) {
|
|
244
|
-
const handleDelete = () => {
|
|
245
|
-
showNotificationDialog(
|
|
246
|
-
{
|
|
247
|
-
title: 'Delete trade',
|
|
248
|
-
body: \`Are you sure you want to delete trade \${tradeId}? This cannot be undone.\`,
|
|
249
|
-
dialog: {
|
|
250
|
-
confirmingActions: [
|
|
251
|
-
{
|
|
252
|
-
label: 'Delete',
|
|
253
|
-
action: async () => {
|
|
254
|
-
// typed-first (import EventTradeDelete from ../generated/genesis-event-types when listed — depth like store imports; never create or edit that generated file):
|
|
255
|
-
await commitGenesisEvent(getConnect(), new EventTradeDelete({ TRADE_ID: tradeId }));
|
|
256
|
-
// Plain fallback when the generated map is absent or lacks this event (see fui-foundation-comms):
|
|
257
|
-
// await getConnect().commitEvent('EVENT_TRADE_DELETE', { DETAILS: { TRADE_ID: tradeId } });
|
|
258
|
-
showNotificationToast(
|
|
259
|
-
{ title: 'Deleted', body: \`Trade \${tradeId} deleted.\`, toast: { type: 'success', autoClose: true } },
|
|
260
|
-
'rapid',
|
|
261
|
-
);
|
|
262
|
-
},
|
|
263
|
-
},
|
|
264
|
-
],
|
|
265
|
-
dismissingAction: { label: 'Cancel' },
|
|
266
|
-
},
|
|
267
|
-
},
|
|
268
|
-
'rapid',
|
|
269
|
-
);
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
return <Button appearance="danger" onClick={handleDelete}>Delete</Button>;
|
|
273
|
-
}
|
|
274
|
-
\`\`\`
|
|
275
|
-
|
|
276
|
-
---
|
|
277
|
-
|
|
278
|
-
### Example 3 — Configure notification stacking at app startup
|
|
279
|
-
|
|
280
|
-
\`\`\`tsx
|
|
281
|
-
import { useEffect } from 'react';
|
|
282
|
-
import {
|
|
283
|
-
configureNotifications,
|
|
284
|
-
sortNotificationBySeverity,
|
|
285
|
-
} from '@genesislcap/foundation-notifications';
|
|
286
|
-
|
|
287
|
-
function App() {
|
|
288
|
-
useEffect(() => {
|
|
289
|
-
// Set up stacking toast container once on mount
|
|
290
|
-
configureNotifications({
|
|
291
|
-
position: 'top-right',
|
|
292
|
-
stackThreshold: 3,
|
|
293
|
-
allowCloseAll: true,
|
|
294
|
-
sortFn: sortNotificationBySeverity, // errors rise to top
|
|
295
|
-
});
|
|
296
|
-
}, []);
|
|
297
|
-
|
|
298
|
-
return <div>{/* ... */}</div>;
|
|
299
|
-
}
|
|
300
|
-
\`\`\`
|
|
301
|
-
|
|
302
|
-
---
|
|
303
|
-
|
|
304
|
-
### Example 4 — Snackbar for non-blocking feedback
|
|
305
|
-
|
|
306
|
-
\`\`\`tsx
|
|
307
|
-
import { showNotificationSnackbar } from '@genesislcap/foundation-notifications';
|
|
308
|
-
|
|
309
|
-
showNotificationSnackbar(
|
|
310
|
-
{
|
|
311
|
-
body: 'Changes saved successfully.',
|
|
312
|
-
snackbar: {
|
|
313
|
-
type: 'success',
|
|
314
|
-
autoClose: true,
|
|
315
|
-
closeTimeout: 3000,
|
|
316
|
-
confirmingActions: [{ label: 'OK', action: () => {} }],
|
|
317
|
-
},
|
|
318
|
-
},
|
|
319
|
-
'rapid',
|
|
320
|
-
);
|
|
321
|
-
\`\`\`
|
|
322
|
-
|
|
323
|
-
---
|
|
324
|
-
|
|
325
|
-
### Example 5 — Reusable toast helper (pattern from sales-trader-hub)
|
|
326
|
-
|
|
327
|
-
\`\`\`ts
|
|
328
|
-
// utils/toast.ts
|
|
329
|
-
import { showNotificationToast } from '@genesislcap/foundation-notifications';
|
|
330
|
-
|
|
331
|
-
export function showErrorToast(title: string, body: string) {
|
|
332
|
-
showNotificationToast(
|
|
333
|
-
{ title, body, toast: { type: 'error', autoClose: true } },
|
|
334
|
-
'rapid',
|
|
335
|
-
);
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
export function showSuccessToast(title: string, body: string) {
|
|
339
|
-
showNotificationToast(
|
|
340
|
-
{ title, body, toast: { type: 'success', autoClose: true } },
|
|
341
|
-
'rapid',
|
|
342
|
-
);
|
|
343
|
-
}
|
|
344
|
-
\`\`\`
|
|
345
|
-
|
|
346
|
-
---
|
|
347
|
-
|
|
348
|
-
### DANGEROUS PATTERNS
|
|
349
|
-
|
|
350
|
-
#### DP-1: Importing from /react (subpath does not exist)
|
|
351
|
-
|
|
352
|
-
\`\`\`ts
|
|
353
|
-
// WRONG — /react subpath does not exist for foundation-notifications:
|
|
354
|
-
import { showNotificationToast } from '@genesislcap/foundation-notifications/react';
|
|
355
|
-
|
|
356
|
-
// CORRECT — import from the package root:
|
|
357
|
-
import { showNotificationToast } from '@genesislcap/foundation-notifications';
|
|
358
|
-
\`\`\`
|
|
359
|
-
|
|
360
|
-
#### DP-2: Using 'warning' as a SnackbarType
|
|
361
|
-
|
|
362
|
-
\`\`\`ts
|
|
363
|
-
// WRONG — SnackbarType is 'error' | 'success' only; 'warning' does not exist:
|
|
364
|
-
showNotificationSnackbar(
|
|
365
|
-
{ body: 'Something went wrong', snackbar: { type: 'warning' } },
|
|
366
|
-
'rapid',
|
|
367
|
-
);
|
|
368
|
-
|
|
369
|
-
// CORRECT — use 'error' for warning/error-level snackbars:
|
|
370
|
-
showNotificationSnackbar(
|
|
371
|
-
{ body: 'Something went wrong', snackbar: { type: 'error' } },
|
|
372
|
-
'rapid',
|
|
373
|
-
);
|
|
374
|
-
\`\`\`
|
|
375
|
-
|
|
376
|
-
#### DP-3: Calling showNotificationAlert with a tagName argument
|
|
377
|
-
|
|
378
|
-
\`\`\`ts
|
|
379
|
-
// WRONG — showNotificationAlert takes only the AlertStructure, no tagName:
|
|
380
|
-
showNotificationAlert({ title: 'Error', body: 'Something failed' }, 'rapid');
|
|
381
|
-
|
|
382
|
-
// CORRECT — no tagName argument; it calls the native browser alert():
|
|
383
|
-
showNotificationAlert({ title: 'Error', body: 'Something failed' });
|
|
384
|
-
\`\`\`
|
|
385
|
-
|
|
386
|
-
#### DP-4: Missing required fields
|
|
387
|
-
|
|
388
|
-
\`\`\`ts
|
|
389
|
-
// WRONG — showNotificationToast requires both title AND body:
|
|
390
|
-
showNotificationToast({ body: 'Saved' }, 'rapid'); // missing title → throws
|
|
391
|
-
showNotificationToast({ title: 'Saved' }, 'rapid'); // missing body → throws
|
|
392
|
-
|
|
393
|
-
// WRONG — showNotificationDialog requires both title AND body:
|
|
394
|
-
showNotificationDialog({ body: 'Are you sure?' }, 'rapid'); // missing title → throws
|
|
395
|
-
|
|
396
|
-
// CORRECT:
|
|
397
|
-
showNotificationToast({ title: 'Saved', body: 'Trade saved.' }, 'rapid');
|
|
398
|
-
showNotificationDialog({ title: 'Confirm', body: 'Are you sure?' }, 'rapid');
|
|
399
|
-
\`\`\`
|
|
400
|
-
|
|
401
|
-
#### DP-5: Using the deprecated NotificationBuilder class
|
|
402
|
-
|
|
403
|
-
\`\`\`ts
|
|
404
|
-
// WRONG — NotificationBuilder and getNotificationBuilder are deprecated:
|
|
405
|
-
import { getNotificationBuilder } from '@genesislcap/foundation-notifications';
|
|
406
|
-
const n = getNotificationBuilder().withTitle('Error').withBody('...').build();
|
|
407
|
-
|
|
408
|
-
// CORRECT — use the dedicated show* helpers directly:
|
|
409
|
-
import { showNotificationToast } from '@genesislcap/foundation-notifications';
|
|
410
|
-
showNotificationToast({ title: 'Error', body: '...' }, 'rapid');
|
|
411
|
-
\`\`\`
|
|
412
|
-
|
|
413
|
-
#### DP-6: Rendering notification components as JSX elements
|
|
414
|
-
|
|
415
|
-
\`\`\`tsx
|
|
416
|
-
// WRONG — these are not React components; there is no JSX API:
|
|
417
|
-
return (
|
|
418
|
-
<rapid-toast title="Success" body="Done" />
|
|
419
|
-
);
|
|
420
|
-
|
|
421
|
-
// CORRECT — call the imperative function from an event handler or useEffect:
|
|
422
|
-
import { showNotificationToast } from '@genesislcap/foundation-notifications';
|
|
423
|
-
showNotificationToast({ title: 'Success', body: 'Done' }, 'rapid');
|
|
424
|
-
\`\`\`
|
|
425
|
-
|
|
426
|
-
#### DP-7: Calling configureNotifications with bottom corner positions
|
|
427
|
-
|
|
428
|
-
\`ToastPosition\` is typed with all four corners, but the container's JSDoc
|
|
429
|
-
(\`NotifyContainerConfig.position\`) states bottom-left and bottom-right are **not currently
|
|
430
|
-
supported** — a bottom value will not position the stack as expected.
|
|
431
|
-
|
|
432
|
-
\`\`\`ts
|
|
433
|
-
// WRONG — bottom-left and bottom-right are not currently supported:
|
|
434
|
-
configureNotifications({ position: 'bottom-right' });
|
|
435
|
-
|
|
436
|
-
// CORRECT — use only top-left or top-right:
|
|
437
|
-
configureNotifications({ position: 'top-right' });
|
|
438
|
-
\`\`\`
|
|
439
|
-
`.trim();
|