toga-ai 1.0.339 → 1.0.340

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.
@@ -6,7 +6,7 @@ project: TOGa Commerce
6
6
  client: shared
7
7
  type: feature
8
8
  status: active
9
- updated: 2026-07-14
9
+ updated: 2026-07-15
10
10
  owners: ["apeterson", "tcox"]
11
11
  files:
12
12
  - src/fieldsConfig/index.ts
@@ -48,7 +48,8 @@ resolved per tenant, per language, and per role**. There are **two layers**:
48
48
  {
49
49
  "languageSwitcher": { "uuid": "1", "isEnabled": true|false },
50
50
  "userApiFields": ["firstName", "lastName", "email", "uuid", "_isAdmin", ...],
51
- "fetchUsersApiFields": ["firstName", "lastName", "email", "uuid", ...]
51
+ "fetchUsersApiFields": ["firstName", "lastName", "email", "uuid", ...],
52
+ "fetchUserApiFields": ["firstName", "lastName", "email", "uuid", "supervisorUser.uuid", ...]
52
53
  }
53
54
  ```
54
55
 
@@ -65,12 +66,18 @@ resolved per tenant, per language, and per role**. There are **two layers**:
65
66
  (`fetchUsers()` in `src/pages/Cart/api/CartApi.ts`, driven from `NavIconList.tsx`). Distinct from
66
67
  `userApiFields` (which is the login fetch). COMPASS/COMPASSCANADA use the 14-field default list;
67
68
  **QUAD uses an 8-field list that intentionally omits `supervisorUser.*`** (see gotcha).
69
+ - `fetchUserApiFields` — the allow-list of user columns fetched by the **singular detail fetch**
70
+ (`fetchUser()` in `src/pages/Cart/api/CartApi.ts`, driven from `NavIconList.tsx` and
71
+ `fetchUserByContactUuid()`). COMPASS/COMPASSCANADA use the 19-field default list;
72
+ **QUAD uses a 13-field list that — unlike the plural `fetchUsersApiFields` — *does* include
73
+ `supervisorUser.*`** (reporting-chain data comes from the detail fetch, not the search list;
74
+ see gotcha).
68
75
 
69
76
  Resolved by **`src/fieldsConfig/getClientLoginFields.ts`** — a `switch(client)` returning the JSON;
70
77
  **default is `COMPASS`** (not DEFAULT). Called from `AuthContext` as `getClientLoginFields(host)`.
71
78
  The `languageSwitcher.isEnabled` value feeds the login-settings branch in `getLoginSettings.ts`.
72
79
 
73
- ### `fetchUsersApiFields` and the config-driven view-as search (C6)
80
+ ### `fetchUsersApiFields` / `fetchUserApiFields` and the config-driven Cart fetches (C6)
74
81
 
75
82
  `fetchUsers()` in `src/pages/Cart/api/CartApi.ts` no longer hardcodes its field list. It resolves it
76
83
  via `getClientLoginFields(fieldKey ?? "").fetchUsersApiFields`, replacing a former
@@ -82,9 +89,25 @@ tenant JSONs are **statically imported**, a tenant missing `fetchUsersApiFields`
82
89
  compile error — not a silent empty fetch — so the list is client-editable via config without
83
90
  touching Cart code.
84
91
 
85
- **Follow-up candidate (not yet done):** `fetchUser()` (singular, same `CartApi.ts`) still holds the
86
- same hardcoded QUAD-vs-default field-list pattern and is a candidate for the identical config
87
- treatment in a future ticket.
92
+ **Singular `fetchUser()` — same treatment (TRUE-80016).** `fetchUser()` (the detail fetch, same
93
+ `CartApi.ts`) now hoists its default field list from config too:
94
+
95
+ ```ts
96
+ const fields = singleUserFields ?? getClientLoginFields(fieldKey).fetchUserApiFields;
97
+ ```
98
+
99
+ The former hardcoded default lists moved byte-for-byte into `fetchUserApiFields` in each tenant JSON
100
+ (COMPASS/COMPASSCANADA = the old 19-field default; QUAD = the old 13-field list). Precedence is
101
+ preserved: a caller-supplied **`singleUserFields`** override (Layer B `fields?.getSingleUserFields?.fields`,
102
+ passed by `useEditOrderViewModel.ts` and `useEditCartViewModel.ts`) still wins; `NavIconList.tsx` and
103
+ `fetchUserByContactUuid()` take the config defaults.
104
+
105
+ Unlike `fetchUsers`, the `fieldKey === "QUAD"` vs default **branch was retained** — it encodes
106
+ genuine behavior differences beyond the field list: the default branch uses `depth: 5` and enriches
107
+ the result with `fetchCostCenter()` (cost-center name); the QUAD branch does neither. Only the field
108
+ *lists* were externalized to config; the structural difference stays in code. Naming convention now
109
+ established: **`fetch<X>ApiFields` in `clientFields/<TENANT>.json` mirrors the CartApi function name**
110
+ (`fetchUsers` → `fetchUsersApiFields`, `fetchUser` → `fetchUserApiFields`).
88
111
 
89
112
  ### `userApiFields` and the SAML post-auth fetch (`useAuthenticationFlow`)
90
113
 
@@ -232,6 +255,11 @@ Common field attributes: `uuid`, `label`, `valueKey` (path into the data object)
232
255
  `fetchUser()` after selection. QUAD also uses the `_isGlobalAdmin`/`_isBuyer`/`_isItShopper` role
233
256
  model, not the supervisor hierarchy. Aligning the two lists would smuggle a behavior change into a
234
257
  refactor.
258
+ - **The two QUAD lists intentionally differ on `supervisorUser.*`.** QUAD's `fetchUserApiFields`
259
+ (singular detail fetch) **includes** `supervisorUser.*`, while its `fetchUsersApiFields` (plural
260
+ search list) **omits** them. This is the same fact from both directions: reporting-chain data is
261
+ loaded on the detail fetch, not the search list — so the asymmetry is correct, not a copy-paste
262
+ slip. Do not "reconcile" the two lists.
235
263
 
236
264
  ## Change history
237
265
  - 2026-06-23 — Initial: documented the two-layer field system (global `clientFields/<TENANT>.json`
@@ -249,4 +277,13 @@ Common field attributes: `uuid`, `label`, `valueKey` (path into the data object)
249
277
  TRUE-80015 `fetchUsers` refactor). All user-field lists now flow through config;
250
278
  COMPASSCANADA now resolves its own JSON rather than the generic `else`. Behavior-identical, `tsc`
251
279
  clean. (tcox)
280
+ - 2026-07-15 — Completed the `fetchUser()` follow-up (TRUE-80016): added a `fetchUserApiFields` key
281
+ to each tenant JSON (COMPASS/COMPASSCANADA = former 19-field default, QUAD = former 13-field list,
282
+ byte-for-byte) and made the singular detail fetch hoist `singleUserFields ??
283
+ getClientLoginFields(fieldKey).fetchUserApiFields`. Caller override precedence preserved; the
284
+ `fieldKey === "QUAD"` branch retained (it also gates `depth: 5` + `fetchCostCenter()` enrichment,
285
+ not just fields). Established the `fetch<X>ApiFields` ↔ CartApi-function naming convention. Intended
286
+ refactor-only, no behavior change — not yet verified with `tsc`. Landed standalone on branch
287
+ TRUE-80016 (not stacked on the unmerged TRUE-80015); whichever PR merges second takes minor "keep
288
+ both" conflicts on the shared import line and adjacent JSON keys. (tcox)
252
289
  </content>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toga-ai",
3
- "version": "1.0.339",
3
+ "version": "1.0.340",
4
4
  "description": "TOGA Technology Team Claude Knowledge System — shared AI coding harness with skills, knowledge base CLI, and project installer for Claude Code.",
5
5
  "keywords": [
6
6
  "claude",