toga-ai 1.0.336 → 1.0.338

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 @@
6
6
  | [Cart Bundle Submission & the bundleUuid Identity Contract](features/cart-bundle-submission-and-identity.md) | How cart **bundles** (kits) are turned into `SalesOrderItems` when a cart is submitted or an existing order is edited, and the **identity-field contract** every | src/api/syncSalesOrderItemsFromLocalStorageCartToApi.ts, src/utils/formatSalesOrderBundlesFromApi.ts, src/stores/useCartStoreZu.ts, src/pages/OrderDetails/helpers/formatSalesOrderDataFromLocalStorage.ts, src/pages/OrderDetails/view/components/OrderItems.tsx |
7
7
  | [Cart Notification Emails — duplicate prevention](features/cart-notification-emails.md) | On the cart "Notifications" section a user can add CC email addresses to an order. | src/pages/Cart/CartPage.tsx, src/pages/Cart/view/cartForm/CartForm.tsx, src/stores/useEmailOptionsStore.ts, src/stores/useCartSalesQuoteZu.ts, src/pages/Cart/viewModel/FIELDS/*/*/*/CARTPAGE.ts |
8
8
  | [Cart Page — config-driven form architecture (current state + planned refactor)](features/cart-page-config-architecture.md) | The Cart page (`src/pages/Cart/`) is the most config-heavy page in `toga2-commerce`. | src/pages/Cart/CartPage.tsx, src/pages/Cart/view/cartForm/CartForm.tsx, src/pages/Cart/view/cartForm/CartFormSection.tsx, src/pages/Cart/view/cartForm/CartFormRenderer.tsx, src/pages/Cart/view/EditCart.tsx, src/pages/Cart/view/EditOrder.tsx, src/pages/Cart/viewModel/useEditOrderOrEditCartViewModel.ts, src/pages/Cart/viewModel/FIELDS/*/*/*/CARTPAGE.ts, src/hooks/useAssignClientFields.ts |
9
- | [Client Fields — per-tenant / language / role content & config](features/client-fields.md) | Almost no user-facing text, field layout, or page config is hard-coded in `toga2-commerce`. | src/fieldsConfig/index.ts, src/fieldsConfig/getClientLoginFields.ts, src/fieldsConfig/clientFields/COMPASS.json, src/fieldsConfig/clientFields/COMPASSCANADA.json, src/fieldsConfig/clientFields/QUAD.json, src/pages/Cart/api/CartApi.ts, src/hooks/useAssignClientFields.ts, src/hooks/useDynamicConditionalFieldOptions.ts, src/stores/useFieldsStore.ts, src/components/BaseDetailField/BaseDetailField.tsx |
9
+ | [Client Fields — per-tenant / language / role content & config](features/client-fields.md) | Almost no user-facing text, field layout, or page config is hard-coded in `toga2-commerce`. | src/fieldsConfig/index.ts, src/fieldsConfig/getClientLoginFields.ts, src/fieldsConfig/clientFields/COMPASS.json, src/fieldsConfig/clientFields/COMPASSCANADA.json, src/fieldsConfig/clientFields/QUAD.json, src/pages/Cart/api/CartApi.ts, src/hooks/useAuthenticationFlow.ts, src/contexts/AuthContext.tsx, src/pages/Login/viewModel/useLoginPageViewModel.ts, src/hooks/useAssignClientFields.ts, src/hooks/useDynamicConditionalFieldOptions.ts, src/stores/useFieldsStore.ts, src/components/BaseDetailField/BaseDetailField.tsx |
10
10
  | [Config-Driven Expedited Shipping Gating (Cart)](features/expedited-shipping-gating.md) | On the toga2-commerce **Cart** page, expedited shipping options (**"2nd Day EOB"** and **"Next Day Air"**) are only offered in the *Shipping Method* dropdown wh | toga2-commerce/src/pages/Cart/helpers/shippingOptionGates.ts, toga2-commerce/src/pages/Cart/viewModel/FIELDS/shared/shippingOptionGates.ts, toga2-commerce/src/pages/Cart/view/cartForm/CartForm.tsx, toga2-commerce/src/pages/Cart/CartPage.tsx |
11
11
  | [Multi-Tenant Resolution & Theming](features/multi-tenant-theming.md) | `toga2-commerce` serves multiple clients from one codebase. | src/themeConfig/themes.json, src/themeConfig/ThemeContext.tsx, src/themeConfig/types.ts, src/components/ThemeSwitcher/ThemeSwitcher.tsx, src/components/AuthLayout/AuthLayout.tsx, src/api/axiosInstance.ts, src/contexts/AuthContext.tsx, tailwind.config.js |
12
12
  | [AWS Amplify Build & Deploy (non-prod environments)](workflows/amplify-build-and-deploy.md) | How `toga2-commerce` (React + Vite, "commerce2-react") builds and deploys on **AWS Amplify**. | toga2-commerce/amplify.yml, toga2-commerce/.gitattributes, toga2-commerce/package.json, toga2-commerce/.github/workflows/sync-stage-environments.yml |
@@ -6,7 +6,7 @@ project: TOGa Commerce
6
6
  client: shared
7
7
  type: feature
8
8
  status: active
9
- updated: 2026-07-10
9
+ updated: 2026-07-14
10
10
  owners: ["apeterson", "tcox"]
11
11
  files:
12
12
  - src/fieldsConfig/index.ts
@@ -15,6 +15,9 @@ files:
15
15
  - src/fieldsConfig/clientFields/COMPASSCANADA.json
16
16
  - src/fieldsConfig/clientFields/QUAD.json
17
17
  - src/pages/Cart/api/CartApi.ts
18
+ - src/hooks/useAuthenticationFlow.ts
19
+ - src/contexts/AuthContext.tsx
20
+ - src/pages/Login/viewModel/useLoginPageViewModel.ts
18
21
  - src/hooks/useAssignClientFields.ts
19
22
  - src/hooks/useDynamicConditionalFieldOptions.ts
20
23
  - src/stores/useFieldsStore.ts
@@ -53,7 +56,11 @@ resolved per tenant, per language, and per role**. There are **two layers**:
53
56
  QUAD are `false`.
54
57
  - `userApiFields` — the allow-list of user columns fetched at login; importantly it includes the
55
58
  tenant's **role flags**: COMPASS/COMPASSCANADA carry `_isAdmin`, `_isSupervisor`, `_isSuperAdmin`;
56
- QUAD carries `_isGlobalAdmin`, `_isItShopper`, `_isBuyer`. All include `_personaIds`.
59
+ QUAD carries `_isGlobalAdmin`, `_isItShopper`, `_isBuyer`. All include `_personaIds`. This key is
60
+ now the **single source** for every auth-flow user fetch: `AuthContext.tsx`,
61
+ `useLoginPageViewModel.ts`, and `useAuthenticationFlow.ts` (the SAML post-auth fetch) all resolve
62
+ it via `getClientLoginFields(host).userApiFields` — there is no longer any hardcoded copy of the
63
+ user field list anywhere in the app (see the `useAuthenticationFlow` note below).
57
64
  - `fetchUsersApiFields` — the allow-list of user columns fetched by the **view-as user search**
58
65
  (`fetchUsers()` in `src/pages/Cart/api/CartApi.ts`, driven from `NavIconList.tsx`). Distinct from
59
66
  `userApiFields` (which is the login fetch). COMPASS/COMPASSCANADA use the 14-field default list;
@@ -79,6 +86,23 @@ touching Cart code.
79
86
  same hardcoded QUAD-vs-default field-list pattern and is a candidate for the identical config
80
87
  treatment in a future ticket.
81
88
 
89
+ ### `userApiFields` and the SAML post-auth fetch (`useAuthenticationFlow`)
90
+
91
+ `src/hooks/useAuthenticationFlow.ts` no longer hardcodes the user field list for the SAML post-auth
92
+ user fetch. It previously carried an `if (hostNameCode === "QUAD") […] else […]` branch whose two
93
+ lists were **exact element-for-element duplicates** (same order) of the `userApiFields` already in
94
+ `COMPASS.json` / `COMPASSCANADA.json` / `QUAD.json`. It now resolves the list via
95
+ `getClientLoginFields(hostNameCode).userApiFields` — no JSON changes were needed. This is the same
96
+ "config, not `if (client === …)` branches" centralization as the `fetchUsersApiFields`/C6 refactor
97
+ above (sibling ticket TRUE-80015 did the identical treatment for `fetchUsers()` in `CartApi.ts`;
98
+ `useAuthenticationFlow` was TRUE-80017). With this change, `useAuthenticationFlow` was the **last
99
+ remaining hardcoded duplicate** of the user field list — `AuthContext.tsx` and
100
+ `useLoginPageViewModel.ts` already consumed config — so all user-field lists in the app now flow
101
+ through `getClientLoginFields`. Behavior-identical for all tenants, `tsc` clean.
102
+
103
+ Note: **COMPASSCANADA** previously fell into the generic `else` branch and now resolves to its own
104
+ `COMPASSCANADA.json` (currently identical content to COMPASS — a future divergence point).
105
+
82
106
  ## Layer B — the per-page FIELDS registry
83
107
 
84
108
  `src/fieldsConfig/index.ts` (~1100 lines) imports every page's per-tenant field constants (which
@@ -219,4 +243,10 @@ Common field attributes: `uuid`, `label`, `valueKey` (path into the data object)
219
243
  QUAD = 8-field), replacing the `if (fieldKey === "QUAD")` branch with a config lookup (C6). Noted
220
244
  the deliberate QUAD `supervisorUser.*` omission and the `fetchUser()` follow-up candidate. Refactor
221
245
  only, no behavior change; `tsc --noEmit` clean. (tcox)
246
+ - 2026-07-14 — Removed the last hardcoded user-field list: `useAuthenticationFlow.ts` (SAML post-auth
247
+ fetch) now reads `getClientLoginFields(hostNameCode).userApiFields` instead of an
248
+ `if (hostNameCode === "QUAD") … else …` duplicate of the JSON lists (TRUE-80017; sibling of the
249
+ TRUE-80015 `fetchUsers` refactor). All user-field lists now flow through config;
250
+ COMPASSCANADA now resolves its own JSON rather than the generic `else`. Behavior-identical, `tsc`
251
+ clean. (tcox)
222
252
  </content>
@@ -6,7 +6,7 @@
6
6
  | [Cost Centers — Unit Locations, numeric-only policy](features/cost-centers.md) | 2.0 | A Compass "cost center" — the value a user picks in commerce and that lands on an order — is **not** a `CostCenters` row. | toga2-commerce/src/pages/Cart/api/CartApi.ts, worker1.5/crons/toga2/compass/import_locations.php, _underscore/Model/Compass/SalesOrder.php, api2/Component/Api/V2/V2.php, dbchanges2/Client_Compass/2026-07-06 - RemoveNonNumericCostCenters.sql |
7
7
  | [Compass: Item-Fulfillment TableViews (for-sales-order-items & for-sales-orders, tracking via bridge)](features/item-fulfillment-tracking-tableview.md) | 2.0 | Two sibling Compass TableViews in `Client_Compass` display fulfilled items in toga2-supply, both driven by `TableViews` / `TableViewJoins` / `TableViewFields` c | dbchanges2/Client_Compass/2026-06-10 - ItemFulfillmentsForSalesOrderItemsTableView.sql, dbchanges2/Client_Compass/2026-06-11 - ItemFulfillmentsForSalesOrdersTableView.sql, dbchanges2/Client_Compass/2026-06-15a - FixItemFulfillmentTrackingNumberJoins.sql |
8
8
  | [Compass MITS PO → SO Item Linking](features/mits-po-to-so-item-linking.md) | 2.0 | MITS sends Compass inbound Purchase Orders (`POST /v2/purchase-orders`) against a Sales Order (`mitsSalesOrder`). | _underscore/Model/Compass/PurchaseOrder.php, worker/crons/toga2/compass/workflow/3a_import_office_depot_purchase_orders.php |
9
- | [Compass MITS PO Transmission to Vendors](features/mits-po-transmission-to-vendors.md) | 2.0 | The 1.0 worker cron `2_transmit_mits_purchase_orders_to_vendors.php` transmits Compass PurchaseOrders to their vendors (Office Depot, Strategic Systems, Compass | worker/crons/toga2/compass/workflow/2_transmit_mits_purchase_orders_to_vendors.php, library/app/client/compass.php |
9
+ | [Compass MITS PO Transmission to Vendors](features/mits-po-transmission-to-vendors.md) | 2.0 | The 1.0 worker cron `2_transmit_mits_purchase_orders_to_vendors.php` transmits Compass PurchaseOrders to their vendors (Office Depot, Strategic Systems, Compass | worker/crons/toga2/compass/workflow/2_transmit_mits_purchase_orders_to_vendors.php, worker/crons/toga2/compasscanada/workflow/2_transmit_mits_purchase_orders_to_vendors.php, library/app/client/compass.php |
10
10
  | [Compass MR/MA Order Auto-Approval & Status Gate](features/mr-ma-order-approval-and-status.md) | 2.0 | Compass **MR** and **MA** sales orders are system-generated from the MITS / Office Depot EDI pipeline (they do not originate as user-entered SA orders) and must | _underscore/Model/Compass/SalesOrder.php, _underscore/Model/Compass/PurchaseOrder.php, worker/crons/toga2/compass/workflow/3a_import_office_depot_purchase_orders.php |
11
11
  | [Compass USA](profile.md) | 2.0 | Compass USA is a TOGA client running a multi-tier supply-chain commerce operation. | |
12
12
  | [Compass Cross-Kit Bundle Corruption — Detection & Repair](workflows/cross-kit-bundle-corruption.md) | 2.0 | A frontend regression in `toga2-commerce`'s edit-order bundle submission mis-attributed bundle (kit) line items and **fees/warranties** to the **wrong kit**, pe | src/api/syncSalesOrderItemsFromLocalStorageCartToApi.ts |
@@ -5,10 +5,11 @@ project: _Underscore
5
5
  client: compass-usa
6
6
  type: client-feature
7
7
  status: active
8
- updated: 2026-06-22
9
- owners: ["rgirish"]
8
+ updated: 2026-07-14
9
+ owners: ["rgirish", "bala"]
10
10
  files:
11
11
  - worker/crons/toga2/compass/workflow/2_transmit_mits_purchase_orders_to_vendors.php
12
+ - worker/crons/toga2/compasscanada/workflow/2_transmit_mits_purchase_orders_to_vendors.php
12
13
  - library/app/client/compass.php
13
14
  related:
14
15
  - mits-po-to-so-item-linking.md
@@ -47,6 +48,34 @@ Routing note: Office Depot (vendor 1) `defaultPoSubmissionIntegrationId = 2`, wh
47
48
  cXML, unless a `VendorItem` overrides it. There is also a CXML integration (id 1,
48
49
  "Office Depot / No") that is NOT the default.
49
50
 
51
+ **A single PO can split across channels.** Because grouping is per item
52
+ (`VendorItems.overridePoSubmissionIntegrationId`), the same PO can have some items on the
53
+ EMAIL integration (id 2) and others on the CXML integration (id 1). The emailed PDF therefore
54
+ contains only the **subset** of line items on the EMAIL integration — the CXML items go to
55
+ Office Depot separately with no PDF. Note the PDF's "Order Total" cell prints the whole-PO
56
+ `_total`, **not** a per-integration subtotal, so it can exceed the sum of the items shown.
57
+
58
+ ## PDF rendering (EMAIL branch)
59
+ The EMAIL branch renders the PO with **ezpdf** (`Cezpdf`). The "MAIN ITEM LISTING" draws one
60
+ row per line item; the DESCRIPTION cell is 150pt wide and wraps to multiple lines for long
61
+ descriptions.
62
+ - **Row height must be measured, not assumed.** Each row's true height is taken from the
63
+ lowest y any cell reached (`ezText` returns the y it finished wrapping at). A row advances
64
+ by `max($spacingY, ($rowStartY - $rowLowestY) + ($spacingY - $pdf->getFontHeight(11)))` with
65
+ `$spacingY = 40`: single-line rows stay at 40pt (no regression), multi-line rows grow to fit,
66
+ and the `($spacingY - getFontHeight)` term gives every row the same trailing gap a
67
+ single-line row has so tall rows are not cramped.
68
+ - **Pagination is height-aware, not count-based.** Before drawing each row, its wrapped line
69
+ count is pre-measured and a new page is started before the row would spill past the item box
70
+ (first page ≈420pt, extra pages ≈625pt). Count-based chunking (8 then 10 per page) overflowed
71
+ once rows took their true taller height, which made ezpdf's internal `ezText` auto-page-break
72
+ fire per cell and scatter each cell of the overflowing item onto its own blank page.
73
+ - **Measuring wrapped height without drawing (ezpdf):** call
74
+ `$pdf->addTextWrap($x, $y, $columnWidth, $size, $text, 'left', 0, 1)` with the last arg
75
+ (`$test`) = `1`. In test mode `addTextWrap` does not draw (guarded by `if (!$test)`) but wraps
76
+ identically to `ezText` and returns the remainder, so looping it mirrors `ezText`'s own
77
+ wrapping exactly — the reliable way to pre-measure a row for pagination decisions.
78
+
50
79
  ## Data model
51
80
  - `Client_Compass.PurchaseOrders.dtSubmitted` — set by step 4; the outer query's `IS NULL`
52
81
  guard means a PO is only ever picked up once.
@@ -80,6 +109,12 @@ Compass Canada has a parallel `compasscanada/workflow/2_transmit_...` keyed on
80
109
  `dtSubmitted` stamped without a log (separate, previously-observed failure mode).
81
110
 
82
111
  ## Change history
112
+ - 2026-07-14 — Fixed the emailed-PO PDF for both US Compass and Compass Canada: line-item
113
+ rows now advance by their measured wrapped height (long descriptions no longer overwritten),
114
+ and pagination is height-aware (a real 21-item PO went from a broken 17-page PDF to a clean
115
+ 3-page one). Recorded the ezpdf `addTextWrap($test=1)` line-height measurement technique and
116
+ the single-PO EMAIL/CXML channel split (emailed PDF shows only the EMAIL-integration subset;
117
+ Order Total prints the whole-PO `_total`). (bala)
83
118
  - 2026-06-22 — Documented the cron and the unconditional-`dtSubmitted` gotcha: item-less POs
84
119
  get marked submitted without transmitting or logging; diagnosed via MR241298 inbound MITS
85
120
  payload showing empty item arrays. No code change made (diagnosis only). (rgirish)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toga-ai",
3
- "version": "1.0.336",
3
+ "version": "1.0.338",
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",