@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,628 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Context injected into the UI Builder system prompt.
|
|
3
|
-
* Covers cross-tile eventing: Redux store, route eventing (publish/subscribe),
|
|
4
|
-
* custom slices, broadcast channel, and subscribeKey.
|
|
5
|
-
*/
|
|
6
|
-
export const FUI_EVENTING_TAGS = [
|
|
7
|
-
'cross-tile',
|
|
8
|
-
'cross tile',
|
|
9
|
-
'tile event',
|
|
10
|
-
'filter another',
|
|
11
|
-
'drives another',
|
|
12
|
-
'selection event',
|
|
13
|
-
'row selection',
|
|
14
|
-
'master-detail',
|
|
15
|
-
'master detail',
|
|
16
|
-
'publish event',
|
|
17
|
-
'subscribe event',
|
|
18
|
-
'publishEventName',
|
|
19
|
-
'eventing.slice',
|
|
20
|
-
'redux',
|
|
21
|
-
'createSlice',
|
|
22
|
-
'useSelector',
|
|
23
|
-
'subscribeKey',
|
|
24
|
-
'inter-tile',
|
|
25
|
-
'selected row',
|
|
26
|
-
'filter grid by selection',
|
|
27
|
-
'when row selected',
|
|
28
|
-
'on row select',
|
|
29
|
-
'broadcast channel',
|
|
30
|
-
'typed broadcast channel',
|
|
31
|
-
'store slice',
|
|
32
|
-
'custom slice',
|
|
33
|
-
'actions are pre-bound',
|
|
34
|
-
'dispatch',
|
|
35
|
-
];
|
|
36
|
-
export const FUI_EVENTING_CONTEXT = `
|
|
37
|
-
## GENESIS EVENTING — PUBLISH / LISTEN PATTERNS
|
|
38
|
-
|
|
39
|
-
The generated app uses a Redux-based eventing store for inter-tile communication.
|
|
40
|
-
Publishing tiles broadcast selected-row data; listening tiles filter their datasource by criteria.
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
### IMPORT PATHS (verified)
|
|
45
|
-
|
|
46
|
-
\`\`\`ts
|
|
47
|
-
// Redux store utilities — all from @genesislcap/foundation-redux
|
|
48
|
-
import { createStore, createSlice } from '@genesislcap/foundation-redux';
|
|
49
|
-
import type { PayloadAction } from '@genesislcap/foundation-redux';
|
|
50
|
-
|
|
51
|
-
// React-Redux selector hook
|
|
52
|
-
import { useSelector } from 'react-redux';
|
|
53
|
-
|
|
54
|
-
// App-level store (generated / VFS)
|
|
55
|
-
import { reduxStore, store, actions, selectors, subscribeKey } from '../../../store/store';
|
|
56
|
-
|
|
57
|
-
// Criteria builders for listener selectors
|
|
58
|
-
import { CriteriaBuilder, ExpressionBuilder, Serialisers } from '@genesislcap/foundation-criteria';
|
|
59
|
-
|
|
60
|
-
// Typed broadcast channel (browser-tab cross-frame messaging)
|
|
61
|
-
import {
|
|
62
|
-
createTypedBroadcastChannel,
|
|
63
|
-
registerTypedBroadcastChannel,
|
|
64
|
-
TypedBroadcastChannel,
|
|
65
|
-
TypedMessageEvent,
|
|
66
|
-
} from '@genesislcap/foundation-broadcast-channel';
|
|
67
|
-
|
|
68
|
-
// EventDetailMap type (base type for broadcast channel event maps)
|
|
69
|
-
import type { EventDetailMap } from '@genesislcap/foundation-events';
|
|
70
|
-
|
|
71
|
-
// DatasourceConfiguration — required type for listener datasourceConfig prop
|
|
72
|
-
import { DatasourceConfiguration } from '@genesislcap/foundation-entity-management';
|
|
73
|
-
\`\`\`
|
|
74
|
-
|
|
75
|
-
---
|
|
76
|
-
|
|
77
|
-
### CHOOSE FLOW: ROUTE EVENTING VS CUSTOM SLICE
|
|
78
|
-
|
|
79
|
-
- Inspect the route that contains both tiles (query_project_schema('routes'), then read the route's generated source with read_source/vfs_read) before implementing any inter-tile row → criteria behaviour.
|
|
80
|
-
- **Use \`actions.eventing\` / \`selectors.eventing\`** when the publisher tile has \`eventing.publishEventName\` and the listener tile has \`eventing.listener\` (matching event names) in that config. Follow **PUBLISHER** / **LISTENER** sections below.
|
|
81
|
-
- **Use a custom VFS slice** when the user wants pub-sub using a **concrete row field** (e.g. \`TRADE_ID\`) and the route's generated eventing config shows **no** suitable paired eventing for those tiles, or when the user asks for a small dedicated slice (e.g. TradeManager → AllocationManager by \`TRADE_ID\`).
|
|
82
|
-
|
|
83
|
-
---
|
|
84
|
-
|
|
85
|
-
### PUBLISHER — tile that broadcasts selected row data (route eventing)
|
|
86
|
-
|
|
87
|
-
\`\`\`tsx
|
|
88
|
-
import { actions } from '../../../store/store';
|
|
89
|
-
|
|
90
|
-
// Inside the React component:
|
|
91
|
-
const handleRowSelection = (e: any) => {
|
|
92
|
-
// EntityManagement: event comes from e.detail.api
|
|
93
|
-
// RapidGridPro: event comes from e.api
|
|
94
|
-
const selectedRows = e.detail.api.getSelectedRows(); // EntityManagement
|
|
95
|
-
// const selectedRows = e.api.getSelectedRows(); // RapidGridPro
|
|
96
|
-
|
|
97
|
-
if (!selectedRows?.length) {
|
|
98
|
-
actions.eventing.publishSelectedTrade(null); // clear on deselect
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
const { TIMESTAMP, RECORD_ID, ROW_REF, ...data } = selectedRows[0];
|
|
102
|
-
actions.eventing.publishSelectedTrade(data);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
// EntityManagement: pass onSelectionChanged as a direct prop (NOT inside gridOptions)
|
|
106
|
-
<EntityManagement onSelectionChanged={handleRowSelection} ... />
|
|
107
|
-
// CRITICAL: e.detail is the ag-grid EVENT, never the row (typed CustomEvent<unknown>, so e.detail as
|
|
108
|
-
// Row compiles but is WRONG). PREFER onSelectionChanged (whole current selection: e.detail.api
|
|
109
|
-
// .getSelectedRows()). If you use onRowSelected, its row is e.detail.data (gate e.detail.node
|
|
110
|
-
// .isSelected()) — never bare e.detail.
|
|
111
|
-
|
|
112
|
-
// RapidGridPro: pass via gridOptions
|
|
113
|
-
const gridOptions: GridOptionsConfig = {
|
|
114
|
-
onSelectionChanged: handleRowSelection,
|
|
115
|
-
rowSelection: 'single',
|
|
116
|
-
};
|
|
117
|
-
<RapidGridPro ...>
|
|
118
|
-
<GridProGenesisDatasource deferredGridOptions={gridOptions} ... />
|
|
119
|
-
</RapidGridPro>
|
|
120
|
-
\`\`\`
|
|
121
|
-
|
|
122
|
-
The publish action name is: \`actions.eventing.publish{PascalCase(eventName)}\`
|
|
123
|
-
Get the actual eventName from the tile's eventing config in the route's generated source (read_source/vfs_read) — it is the \`publishEventName\` on the tile's eventing config.
|
|
124
|
-
|
|
125
|
-
---
|
|
126
|
-
|
|
127
|
-
### LISTENER — tile whose datasource filters based on published data (route eventing)
|
|
128
|
-
|
|
129
|
-
\`\`\`tsx
|
|
130
|
-
import { useSelector } from 'react-redux';
|
|
131
|
-
import { selectors } from '../../../store/store';
|
|
132
|
-
import { DatasourceConfiguration } from '@genesislcap/foundation-entity-management';
|
|
133
|
-
|
|
134
|
-
// Inside the React component:
|
|
135
|
-
const criteria = useSelector(selectors.eventing.getCriteriaForTileName);
|
|
136
|
-
const datasourceConfig: DatasourceConfiguration = { criteria, requestAutoSetup: false };
|
|
137
|
-
|
|
138
|
-
// EntityManagement: direct prop
|
|
139
|
-
<EntityManagement datasourceConfig={datasourceConfig} ... />
|
|
140
|
-
|
|
141
|
-
// RapidGridPro / GridProGenesisDatasource: spread criteria directly
|
|
142
|
-
<GridProGenesisDatasource criteria={datasourceConfig.criteria} requestAutoSetup={false} ... />
|
|
143
|
-
\`\`\`
|
|
144
|
-
|
|
145
|
-
The selector name is: \`selectors.eventing.getCriteriaFor{PascalCase(tileName)}\`
|
|
146
|
-
|
|
147
|
-
Pass \`datasourceConfig\` as a **direct prop** — no \`useEffect\`, no DOM traversal.
|
|
148
|
-
|
|
149
|
-
---
|
|
150
|
-
|
|
151
|
-
### GENERATED EVENTING SLICE (eventing.slice.ts)
|
|
152
|
-
|
|
153
|
-
The generated \`store/slices/eventing.slice.ts\` contains a \`CriteriaBuilder\`/\`ExpressionBuilder\` selector for each listener tile:
|
|
154
|
-
|
|
155
|
-
\`\`\`ts
|
|
156
|
-
import { CriteriaBuilder, ExpressionBuilder, Serialisers } from '@genesislcap/foundation-criteria';
|
|
157
|
-
import { createSlice } from '@genesislcap/foundation-redux';
|
|
158
|
-
|
|
159
|
-
export const eventingSlice = createSlice({
|
|
160
|
-
name: 'eventing',
|
|
161
|
-
initialState: {
|
|
162
|
-
selectedTrade: null,
|
|
163
|
-
},
|
|
164
|
-
reducers: {
|
|
165
|
-
publishSelectedTrade: (state, action) => {
|
|
166
|
-
state.selectedTrade = action.payload;
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
selectors: {
|
|
170
|
-
getCriteriaForAllocations: (state) => {
|
|
171
|
-
const criteriaBuilder = new CriteriaBuilder();
|
|
172
|
-
const data = state.selectedTrade;
|
|
173
|
-
if (!data) return '';
|
|
174
|
-
|
|
175
|
-
if (data.TRADE_ID) {
|
|
176
|
-
criteriaBuilder.And(
|
|
177
|
-
new ExpressionBuilder()
|
|
178
|
-
.withField('TRADE_ID')
|
|
179
|
-
.withValue(data.TRADE_ID)
|
|
180
|
-
.withSerialiser(Serialisers.EQ)
|
|
181
|
-
.build()
|
|
182
|
-
);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
return criteriaBuilder.build();
|
|
186
|
-
},
|
|
187
|
-
},
|
|
188
|
-
});
|
|
189
|
-
\`\`\`
|
|
190
|
-
|
|
191
|
-
**Never VFS-edit \`store/slices/eventing.slice.ts\`** — it is regenerated from Genesis Create route/tile eventing config.
|
|
192
|
-
|
|
193
|
-
---
|
|
194
|
-
|
|
195
|
-
### CROSS-TILE FILTERING VIA CUSTOM SLICE (VFS)
|
|
196
|
-
|
|
197
|
-
**Recipe — two entity-management tiles on one route, no route eventing:**
|
|
198
|
-
|
|
199
|
-
**Step 1: \`store/slices/<feature>.slice.ts\`**
|
|
200
|
-
|
|
201
|
-
\`\`\`ts
|
|
202
|
-
import { createSlice } from '@genesislcap/foundation-redux';
|
|
203
|
-
import type { PayloadAction } from '@genesislcap/foundation-redux';
|
|
204
|
-
|
|
205
|
-
export interface TradeSelectionState {
|
|
206
|
-
selectedTradeId: string | null;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
const initialState: TradeSelectionState = { selectedTradeId: null };
|
|
210
|
-
|
|
211
|
-
const tradeSelectionSlice = createSlice({
|
|
212
|
-
name: 'tradeSelection',
|
|
213
|
-
initialState,
|
|
214
|
-
reducers: {
|
|
215
|
-
publishSelectedTradeId: (state, action: PayloadAction<string | null>) => {
|
|
216
|
-
state.selectedTradeId = action.payload;
|
|
217
|
-
},
|
|
218
|
-
},
|
|
219
|
-
selectors: {
|
|
220
|
-
getSelectedTradeId: (state: TradeSelectionState) => state.selectedTradeId,
|
|
221
|
-
},
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
export default tradeSelectionSlice;
|
|
225
|
-
\`\`\`
|
|
226
|
-
|
|
227
|
-
**Step 2: \`store/store.ts\`** — add the new slice.
|
|
228
|
-
|
|
229
|
-
\`\`\`ts
|
|
230
|
-
import { createStore } from '@genesislcap/foundation-redux';
|
|
231
|
-
import { eventingSlice } from './slices/eventing.slice';
|
|
232
|
-
import tradeSelectionSlice from './slices/tradeSelection.slice';
|
|
233
|
-
|
|
234
|
-
export const { reduxStore, store, actions, selectors } = createStore(
|
|
235
|
-
[eventingSlice, tradeSelectionSlice], // 1. slice array
|
|
236
|
-
{
|
|
237
|
-
eventing: {}, // 2. preloaded state
|
|
238
|
-
tradeSelection: tradeSelectionSlice.getInitialState(),
|
|
239
|
-
},
|
|
240
|
-
);
|
|
241
|
-
\`\`\`
|
|
242
|
-
|
|
243
|
-
**Step 3: Publisher tile** — call the action directly (never useDispatch):
|
|
244
|
-
|
|
245
|
-
\`\`\`tsx
|
|
246
|
-
import { actions } from '../../../store/store';
|
|
247
|
-
|
|
248
|
-
const handleRowSelection = (e: any) => {
|
|
249
|
-
const selectedRows = e.detail.api.getSelectedRows(); // EntityManagement
|
|
250
|
-
if (!selectedRows?.length) {
|
|
251
|
-
actions.tradeSelection.publishSelectedTradeId(null);
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
const { TRADE_ID } = selectedRows[0];
|
|
255
|
-
actions.tradeSelection.publishSelectedTradeId(TRADE_ID);
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
<EntityManagement onSelectionChanged={handleRowSelection} ... />
|
|
259
|
-
\`\`\`
|
|
260
|
-
|
|
261
|
-
**Step 4: Listener tile** — read via useSelector, build criteria:
|
|
262
|
-
|
|
263
|
-
\`\`\`tsx
|
|
264
|
-
import { useSelector } from 'react-redux';
|
|
265
|
-
import { selectors } from '../../../store/store';
|
|
266
|
-
import { DatasourceConfiguration } from '@genesislcap/foundation-entity-management';
|
|
267
|
-
|
|
268
|
-
const selectedTradeId = useSelector(selectors.tradeSelection.getSelectedTradeId);
|
|
269
|
-
const datasourceConfig: DatasourceConfiguration = {
|
|
270
|
-
criteria: selectedTradeId ? \`TRADE_ID == '\${selectedTradeId}'\` : undefined,
|
|
271
|
-
requestAutoSetup: false,
|
|
272
|
-
};
|
|
273
|
-
|
|
274
|
-
<EntityManagement datasourceConfig={datasourceConfig} ... />
|
|
275
|
-
\`\`\`
|
|
276
|
-
|
|
277
|
-
---
|
|
278
|
-
|
|
279
|
-
### createStore — correct 2-argument call
|
|
280
|
-
|
|
281
|
-
\`foundation-redux\`'s \`createStore\` takes **two** arguments. Selectors are **automatically** extracted from each slice's \`selectors\` field — no third argument:
|
|
282
|
-
|
|
283
|
-
\`\`\`ts
|
|
284
|
-
export const { reduxStore, store, actions, selectors, subscribeKey } = createStore(
|
|
285
|
-
[eventingSlice, myFeatureSlice], // 1. slice array
|
|
286
|
-
{
|
|
287
|
-
eventing: {}, // 2. preloaded state
|
|
288
|
-
myFeature: myFeatureSlice.getInitialState(),
|
|
289
|
-
},
|
|
290
|
-
);
|
|
291
|
-
\`\`\`
|
|
292
|
-
|
|
293
|
-
- Only 2 arguments — do NOT pass a third selectors-map argument.
|
|
294
|
-
- \`getInitialState()\` is a method: \`mySlice.getInitialState()\`, NOT \`mySlice.initialState\`.
|
|
295
|
-
- \`eventingSlice\` must always stay in the array.
|
|
296
|
-
|
|
297
|
-
---
|
|
298
|
-
|
|
299
|
-
### WHITESPACE TRAP — safe vfs_edit anchors for store.ts
|
|
300
|
-
|
|
301
|
-
The generated \`store/store.ts\` has multi-line whitespace inside the preloaded state object:
|
|
302
|
-
|
|
303
|
-
\`\`\`ts
|
|
304
|
-
// Generated file looks like this (note the inner newline — NOT eventing: {}):
|
|
305
|
-
export const { reduxStore, store, actions, selectors } = createStore([eventingSlice], {
|
|
306
|
-
eventing: {
|
|
307
|
-
},
|
|
308
|
-
});
|
|
309
|
-
\`\`\`
|
|
310
|
-
|
|
311
|
-
Searching for \`eventing: {}\` will fail. Use anchors that do NOT span the whitespace-sensitive block:
|
|
312
|
-
|
|
313
|
-
\`\`\`
|
|
314
|
-
// Safe — target the import line to add a new import
|
|
315
|
-
old_string: "import { eventingSlice } from './slices/eventing.slice';"
|
|
316
|
-
new_string: "import { eventingSlice } from './slices/eventing.slice';\\nimport myFeatureSlice from './slices/myFeature.slice';"
|
|
317
|
-
|
|
318
|
-
// Safe — target the closing line to expand the createStore call
|
|
319
|
-
old_string: "});"
|
|
320
|
-
new_string: " myFeature: myFeatureSlice.getInitialState(),\\n});"
|
|
321
|
-
\`\`\`
|
|
322
|
-
|
|
323
|
-
If a vfs_edit returns "old_string not found", call vfs_read again and inspect exact whitespace, then pick a shorter anchor.
|
|
324
|
-
|
|
325
|
-
---
|
|
326
|
-
|
|
327
|
-
### ACTIONS ARE PRE-BOUND — never use useDispatch
|
|
328
|
-
|
|
329
|
-
\`foundation-redux\` \`createStore\` returns \`actions\` where **every action is already bound**: calling \`actions.sliceName.reducerName(payload)\` internally dispatches to the Redux store and notifies FAST observables. Do NOT wrap in \`dispatch()\`.
|
|
330
|
-
|
|
331
|
-
\`\`\`tsx
|
|
332
|
-
// CORRECT — actions are pre-bound, call directly
|
|
333
|
-
import { actions } from '../../../store/store';
|
|
334
|
-
actions.tradeSelection.publishSelectedTradeId(tradeId);
|
|
335
|
-
|
|
336
|
-
// WRONG — never import or use useDispatch with foundation-redux actions
|
|
337
|
-
import { useDispatch } from 'react-redux';
|
|
338
|
-
const dispatch = useDispatch();
|
|
339
|
-
dispatch(actions.tradeSelection.publishSelectedTradeId(tradeId)); // TS error
|
|
340
|
-
\`\`\`
|
|
341
|
-
|
|
342
|
-
\`useSelector\` from \`react-redux\` is still correct for reading state — only \`useDispatch\` is wrong.
|
|
343
|
-
|
|
344
|
-
---
|
|
345
|
-
|
|
346
|
-
### REACT-REDUX PROVIDER — required for useSelector
|
|
347
|
-
|
|
348
|
-
\`createStore\` returns \`reduxStore\` which MUST be passed to react-redux \`<Provider>\`. Without it, \`useSelector\` throws at runtime.
|
|
349
|
-
|
|
350
|
-
\`\`\`tsx
|
|
351
|
-
// main.tsx or App.tsx — app root:
|
|
352
|
-
import { Provider } from 'react-redux';
|
|
353
|
-
import { reduxStore } from './store/store';
|
|
354
|
-
|
|
355
|
-
root.render(
|
|
356
|
-
<Provider store={reduxStore}>
|
|
357
|
-
<App />
|
|
358
|
-
</Provider>
|
|
359
|
-
);
|
|
360
|
-
\`\`\`
|
|
361
|
-
|
|
362
|
-
Do not confuse \`store\` (FAST proxy) and \`reduxStore\` (standard Redux store) — pass \`reduxStore\` to \`<Provider>\`.
|
|
363
|
-
|
|
364
|
-
---
|
|
365
|
-
|
|
366
|
-
### subscribeKey — non-React change subscriptions
|
|
367
|
-
|
|
368
|
-
Use \`subscribeKey\` when you need to react to store changes outside React (e.g. in a utility or WC):
|
|
369
|
-
|
|
370
|
-
\`\`\`ts
|
|
371
|
-
import { subscribeKey } from '../../../store/store';
|
|
372
|
-
|
|
373
|
-
const unsubscribe = subscribeKey(
|
|
374
|
-
(state) => state.globalFilters.criteria, // selector MUST return a STRING
|
|
375
|
-
(state) => {
|
|
376
|
-
updateExternalComponent(state.globalFilters.criteria);
|
|
377
|
-
},
|
|
378
|
-
);
|
|
379
|
-
// Clean up when done:
|
|
380
|
-
unsubscribe();
|
|
381
|
-
\`\`\`
|
|
382
|
-
|
|
383
|
-
**CRITICAL**: The checkerFn (first arg) **must return a string**. If it returns an object, array, or undefined, change detection silently fails and the callback is never called. Convert to string if needed: \`JSON.stringify(state.mySlice.someObject)\`.
|
|
384
|
-
|
|
385
|
-
---
|
|
386
|
-
|
|
387
|
-
### TYPED BROADCAST CHANNEL (cross-tab / cross-frame messaging)
|
|
388
|
-
|
|
389
|
-
Use \`createTypedBroadcastChannel\` (or the DI-registered \`registerTypedBroadcastChannel\`) when you need to send typed messages across browser tabs or iframes. This is independent of the Redux store.
|
|
390
|
-
|
|
391
|
-
\`\`\`ts
|
|
392
|
-
import {
|
|
393
|
-
createTypedBroadcastChannel,
|
|
394
|
-
TypedBroadcastChannel,
|
|
395
|
-
TypedMessageEvent,
|
|
396
|
-
} from '@genesislcap/foundation-broadcast-channel';
|
|
397
|
-
import type { EventDetailMap } from '@genesislcap/foundation-events';
|
|
398
|
-
|
|
399
|
-
// 1. Define the event detail map
|
|
400
|
-
type TradeEvents = {
|
|
401
|
-
'trade-selected': { TRADE_ID: string; TRADE_STATUS: string };
|
|
402
|
-
'trade-cleared': void;
|
|
403
|
-
};
|
|
404
|
-
|
|
405
|
-
// 2. Create the channel (provide a unique channel name)
|
|
406
|
-
const tradeChannel: TypedBroadcastChannel<TradeEvents> =
|
|
407
|
-
createTypedBroadcastChannel<TradeEvents>('trade-channel');
|
|
408
|
-
|
|
409
|
-
// 3. Post messages (strongly typed)
|
|
410
|
-
tradeChannel.postMessage('trade-selected', { TRADE_ID: 'T123', TRADE_STATUS: 'PENDING' });
|
|
411
|
-
tradeChannel.postMessage('trade-cleared'); // void — no detail argument needed
|
|
412
|
-
|
|
413
|
-
// 4. Listen to messages (use isMessageType to narrow)
|
|
414
|
-
tradeChannel.onmessage = (ev) => {
|
|
415
|
-
if (tradeChannel.isMessageType('trade-selected', ev)) {
|
|
416
|
-
console.log(ev.data.detail.TRADE_ID); // fully typed
|
|
417
|
-
}
|
|
418
|
-
};
|
|
419
|
-
|
|
420
|
-
// 5. Always close when done to avoid memory leaks
|
|
421
|
-
tradeChannel.close();
|
|
422
|
-
\`\`\`
|
|
423
|
-
|
|
424
|
-
For DI-registered channels (used in WC patterns, not typical in React tiles):
|
|
425
|
-
|
|
426
|
-
\`\`\`ts
|
|
427
|
-
import {
|
|
428
|
-
registerTypedBroadcastChannel,
|
|
429
|
-
TypedBroadcastChannel,
|
|
430
|
-
} from '@genesislcap/foundation-broadcast-channel';
|
|
431
|
-
|
|
432
|
-
export interface TradeChannel extends TypedBroadcastChannel<TradeEvents> {}
|
|
433
|
-
export const TradeChannel = registerTypedBroadcastChannel<TradeEvents>('trade-channel');
|
|
434
|
-
// Inject with @TradeChannel decorator in a FASTElement class
|
|
435
|
-
\`\`\`
|
|
436
|
-
|
|
437
|
-
---
|
|
438
|
-
|
|
439
|
-
### CUSTOM ACTIONS (per-row menu items & toolbar buttons)
|
|
440
|
-
|
|
441
|
-
**CRITICAL — \`customEvent\` from \`@genesislcap/foundation-events\` is NOT a \`CustomAction\` builder.**
|
|
442
|
-
It is a DOM \`CustomEvent\` accessor from FAST template context — it returns a \`CustomEvent<void>\`, NOT a \`CustomAction\` object. **Never use \`customEvent(...)\` inside a \`customActions\` array.** Doing so causes TS2739: \`Type 'CustomEvent<void>' is missing the following properties from type 'CustomAction': name, action\`.
|
|
443
|
-
|
|
444
|
-
The correct \`CustomAction\` pattern is a plain object literal with \`name\` and \`action\`, plus an
|
|
445
|
-
optional \`position\` that controls WHERE it renders. **Omitting \`position\` does NOT mean toolbar —
|
|
446
|
-
it defaults to a per-row placement.** For a button above the rows, set
|
|
447
|
-
\`position: CrudMenuPosition.Top\`; never wrap \`<EntityManagement>\` in a hand-built div to fake it.
|
|
448
|
-
|
|
449
|
-
\`\`\`tsx
|
|
450
|
-
import { CrudMenuPosition, type CustomAction } from '@genesislcap/foundation-entity-management';
|
|
451
|
-
import { submitFailureNotification } from '../../../utils';
|
|
452
|
-
|
|
453
|
-
const customActions: CustomAction[] = [
|
|
454
|
-
// position omitted = PER-ROW menu item (the platform resolves it as CrudMenuPosition.Column):
|
|
455
|
-
{
|
|
456
|
-
name: 'Approve',
|
|
457
|
-
action: {
|
|
458
|
-
type: 'callback',
|
|
459
|
-
callback: async (rowData: any) => {
|
|
460
|
-
const result = await doApprove(rowData);
|
|
461
|
-
if (!result.success) submitFailureNotification('Approve', result.error);
|
|
462
|
-
},
|
|
463
|
-
},
|
|
464
|
-
},
|
|
465
|
-
{
|
|
466
|
-
name: 'Send Event',
|
|
467
|
-
action: {
|
|
468
|
-
type: 'event',
|
|
469
|
-
event: 'EVENT_APPROVE_TRADE',
|
|
470
|
-
hasForm: false,
|
|
471
|
-
},
|
|
472
|
-
},
|
|
473
|
-
// Toolbar button, above the rows and not tied to a row — REQUIRES position:
|
|
474
|
-
{
|
|
475
|
-
name: 'Add RFQ',
|
|
476
|
-
position: CrudMenuPosition.Top,
|
|
477
|
-
requiresSelection: false,
|
|
478
|
-
appearance: 'primary',
|
|
479
|
-
action: { type: 'callback', callback: () => actions.createRfqModal.openBlank() },
|
|
480
|
-
},
|
|
481
|
-
];
|
|
482
|
-
// Pass to EntityManagement: customActions={customActions}
|
|
483
|
-
\`\`\`
|
|
484
|
-
|
|
485
|
-
Before writing any \`CustomAction[]\`, call \`vfs_read\` on \`@genesislcap/foundation-entity-management/types.d.ts\` to confirm the exact \`CustomAction\` interface shape — the \`action\` union has \`type: 'callback'\` (with \`callback: (rowData: any) => void\`) and \`type: 'event'\` (with \`event: string\`, \`hasForm: boolean\`) variants. …and a separate optional \`position?: CrudMenuPosition\` field (\`Column | Top | Bottom | Action | None\`) that controls placement. Omitting \`position\` does NOT default to a toolbar button — it defaults to a per-row placement. Use \`position: CrudMenuPosition.Top\` with \`requiresSelection: false\` for a button in the grid's toolbar.
|
|
486
|
-
|
|
487
|
-
---
|
|
488
|
-
|
|
489
|
-
### REDUX / STORE VFS PATHS
|
|
490
|
-
|
|
491
|
-
- **Writable paths (preview, raw TypeScript):**
|
|
492
|
-
- \`store/store.ts\` — register slices: import, pass into \`createStore\`, add initial-state and selectors entries.
|
|
493
|
-
- \`store/slices/<name>.ts\` — one file per slice, only under \`store/slices/\` (no nested folders), **except** \`eventing.slice.ts\`.
|
|
494
|
-
- \`components/{Name}/{Name}.tsx\` — shared component placed under \`client/src/components/{Name}/\` when used across multiple routes.
|
|
495
|
-
- \`layouts/default/DefaultLayout.tsx\` — for injecting shared UI into the header or content area.
|
|
496
|
-
- **Never VFS-edit:** \`store/slices/eventing.slice.ts\` — generated from Genesis Create route/tile eventing config.
|
|
497
|
-
|
|
498
|
-
---
|
|
499
|
-
|
|
500
|
-
### ACTION NAME UNIQUENESS — runtime throw
|
|
501
|
-
|
|
502
|
-
All action names must be **unique across ALL slices** in the store. Duplicates throw at store creation:
|
|
503
|
-
|
|
504
|
-
\`\`\`
|
|
505
|
-
Error: Action name not unique: <name>
|
|
506
|
-
\`\`\`
|
|
507
|
-
|
|
508
|
-
Always namespace action names to prevent collisions:
|
|
509
|
-
|
|
510
|
-
\`\`\`ts
|
|
511
|
-
// WRONG — both slices have 'reset' — throws at runtime:
|
|
512
|
-
const tradesSlice = createSlice({ reducers: { reset: ... } });
|
|
513
|
-
const positionsSlice = createSlice({ reducers: { reset: ... } }); // collision!
|
|
514
|
-
|
|
515
|
-
// CORRECT — namespaced:
|
|
516
|
-
const tradesSlice = createSlice({ reducers: { resetTrades: ... } });
|
|
517
|
-
const positionsSlice = createSlice({ reducers: { resetPositions: ... } });
|
|
518
|
-
\`\`\`
|
|
519
|
-
|
|
520
|
-
---
|
|
521
|
-
|
|
522
|
-
### KEY RULES
|
|
523
|
-
|
|
524
|
-
- Always read the existing component file with vfs_read before adding eventing — preserve existing imports and logic.
|
|
525
|
-
- Import paths are always relative: \`'../../../store/store'\` from a tile component file.
|
|
526
|
-
- Pass \`datasourceConfig\` as a **direct prop** to EntityManagement / GridProGenesisDatasource — never via \`useEffect\` + DOM traversal.
|
|
527
|
-
- For **route eventing**, action/selector names come from generated code — read them from the route's generated source (read_source/vfs_read); do not invent \`actions.eventing.*\` names.
|
|
528
|
-
- For **custom slices**, define **\`selectors\` inside \`createSlice\`** and use \`useSelector(selectors.<sliceName>.<selectorKey>)\` in listeners — selector keys must match the \`selectors\` object in the slice file.
|
|
529
|
-
- **Never use \`useDispatch\`** from \`react-redux\` to call \`actions.*\` — actions are pre-bound (see above).
|
|
530
|
-
- **\`createStore\` takes 2 arguments** (slices, preloadedState) — selectors auto-extracted. No third argument.
|
|
531
|
-
- **\`getInitialState()\`** is a method: \`mySlice.getInitialState()\`, not \`mySlice.initialState\`.
|
|
532
|
-
- **\`store.ts\` whitespace trap**: generated file has \`eventing: {\n }\` not \`eventing: {}\`. Use safe vfs_edit anchors.
|
|
533
|
-
- **\`subscribeKey\` checkerFn** must return a string; object/array return silently breaks change detection.
|
|
534
|
-
|
|
535
|
-
---
|
|
536
|
-
|
|
537
|
-
### DANGEROUS PATTERNS
|
|
538
|
-
|
|
539
|
-
#### DP-1: useDispatch with pre-bound actions (bypasses FAST Observable)
|
|
540
|
-
|
|
541
|
-
\`\`\`tsx
|
|
542
|
-
// WRONG:
|
|
543
|
-
const dispatch = useDispatch();
|
|
544
|
-
dispatch(mySlice.actions.doThing(payload)); // FAST reactivity broken, TS error
|
|
545
|
-
|
|
546
|
-
// CORRECT:
|
|
547
|
-
import { actions } from '../../../store/store';
|
|
548
|
-
actions.mySlice.doThing(payload);
|
|
549
|
-
\`\`\`
|
|
550
|
-
|
|
551
|
-
#### DP-2: Missing \`<Provider>\` with reduxStore
|
|
552
|
-
|
|
553
|
-
\`\`\`tsx
|
|
554
|
-
// WRONG — useSelector throws "could not find react-redux context value":
|
|
555
|
-
root.render(<App />);
|
|
556
|
-
|
|
557
|
-
// CORRECT:
|
|
558
|
-
root.render(<Provider store={reduxStore}><App /></Provider>);
|
|
559
|
-
\`\`\`
|
|
560
|
-
|
|
561
|
-
#### DP-3: Duplicate action names across slices
|
|
562
|
-
|
|
563
|
-
\`\`\`ts
|
|
564
|
-
// WRONG — throws 'Error: Action name not unique: reset' at store init:
|
|
565
|
-
const tradesSlice = createSlice({ name: 'trades', reducers: { reset: ... } });
|
|
566
|
-
const positionsSlice = createSlice({ name: 'positions', reducers: { reset: ... } }); // collision!
|
|
567
|
-
|
|
568
|
-
// CORRECT — namespace reducer names:
|
|
569
|
-
const tradesSlice = createSlice({ name: 'trades', reducers: { resetTrades: ... } });
|
|
570
|
-
const positionsSlice = createSlice({ name: 'positions', reducers: { resetPositions: ... } });
|
|
571
|
-
\`\`\`
|
|
572
|
-
|
|
573
|
-
#### DP-4: subscribeKey checkerFn returning non-string
|
|
574
|
-
|
|
575
|
-
\`\`\`ts
|
|
576
|
-
// WRONG — object return; change detection silently broken:
|
|
577
|
-
subscribeKey((state) => state.mySlice.items, callback); // items is an array
|
|
578
|
-
|
|
579
|
-
// CORRECT — return string:
|
|
580
|
-
subscribeKey((state) => JSON.stringify(state.mySlice.items), callback);
|
|
581
|
-
\`\`\`
|
|
582
|
-
|
|
583
|
-
#### DP-5: Selectors defined outside createSlice
|
|
584
|
-
|
|
585
|
-
\`\`\`ts
|
|
586
|
-
// WRONG — not accessible as selectors.mySlice.*:
|
|
587
|
-
export const selectItems = (state: RootState) => state.mySlice.items;
|
|
588
|
-
|
|
589
|
-
// CORRECT — define inside createSlice's selectors field:
|
|
590
|
-
const mySlice = createSlice({
|
|
591
|
-
selectors: { selectItems: (state) => state.items },
|
|
592
|
-
});
|
|
593
|
-
// Usage: useSelector(selectors.mySlice.selectItems)
|
|
594
|
-
\`\`\`
|
|
595
|
-
|
|
596
|
-
#### DP-6: mySlice.initialState vs getInitialState()
|
|
597
|
-
|
|
598
|
-
\`\`\`ts
|
|
599
|
-
// WRONG:
|
|
600
|
-
createStore([mySlice], { mySlice: mySlice.initialState });
|
|
601
|
-
|
|
602
|
-
// CORRECT:
|
|
603
|
-
createStore([mySlice], { mySlice: mySlice.getInitialState() });
|
|
604
|
-
\`\`\`
|
|
605
|
-
|
|
606
|
-
#### DP-7: customEvent() used inside customActions array
|
|
607
|
-
|
|
608
|
-
\`\`\`ts
|
|
609
|
-
// WRONG — customEvent() returns a DOM CustomEvent, not a CustomAction:
|
|
610
|
-
import { customEvent } from '@genesislcap/foundation-events';
|
|
611
|
-
const customActions = [customEvent(ctx)]; // TS2739: missing name, action properties
|
|
612
|
-
|
|
613
|
-
// CORRECT — use a plain object literal:
|
|
614
|
-
const customActions: CustomAction[] = [
|
|
615
|
-
{ name: 'Approve', action: { type: 'callback', callback: async (row) => { ... } } },
|
|
616
|
-
];
|
|
617
|
-
\`\`\`
|
|
618
|
-
|
|
619
|
-
#### DP-8: Three-argument createStore call
|
|
620
|
-
|
|
621
|
-
\`\`\`ts
|
|
622
|
-
// WRONG — createStore does not accept a third argument; selectors come from slice.selectors:
|
|
623
|
-
createStore([mySlice], { mySlice: mySlice.getInitialState() }, { mySlice: { selectFoo: ... } });
|
|
624
|
-
|
|
625
|
-
// CORRECT — define selectors inside createSlice and createStore with 2 args:
|
|
626
|
-
createStore([mySlice], { mySlice: mySlice.getInitialState() });
|
|
627
|
-
\`\`\`
|
|
628
|
-
`.trim();
|