toga-ai 1.0.410 → 1.0.412
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.
|
@@ -28,7 +28,9 @@ updated: 2026-07-21
|
|
|
28
28
|
- **Share button made real** (src/lib/shareMailto.ts, CallSummary.tsx): Send opens the visitor's mail client via mailto: with recipient/subject/summary body. BDR suite 131 tests green, tsc + eslint clean.
|
|
29
29
|
- **Parity audit (info → BDR)**: everything ported; enrichment was net-new in BOTH repos; visit route intentionally dropped; TOGA_PUBLIC_TOKEN_URL and NEXT_PUBLIC_ENV are dead even in info.
|
|
30
30
|
- **Vapi API diagnostics work** with the bearer const at worker2/Worker/Ai/Bdr/Vapi.php:6 (GET /call/{id} endedReason, GET /assistant/{id} config).
|
|
31
|
-
- /capture published 4 doc updates (web-funnel-app, safe-call-loop-testing, vapi-webhook-handler, vapi-integration).
|
|
31
|
+
- /capture published 4 doc updates (web-funnel-app, safe-call-loop-testing, vapi-webhook-handler, vapi-integration) + a delta capture for the deploy findings below.
|
|
32
|
+
- **Amplify app EXISTS now** (tcox deployed): branch `_dev-sandbox` at dev-sandbox.d65bvvjrww97g.amplifyapp.com. **Root cause of "guard notice despite valid ?hsContactId" found and fixed**: old amplify.yml only handled `_production`/`_beta` with `cp` of committed .env files (which rightly don't exist) and had no `_dev-sandbox` case — every deploy shipped with ZERO server env vars → HubSpot prefetch throws → empty lead ref → guard blocks. Fix committed (`e17d804`): official Amplify recipe `env | grep -E '^(HUBSPOT_|TOGA_|NEXT_PUBLIC_|RATE_LIMIT_)' >> .env.production` at build; the 7 vars live in the Amplify console (values: info/.env.local + TOGA_WORKER_URL=https://worker.togahub.com/ + GA id).
|
|
33
|
+
- **Deployed-site triage method** proven: probe `GET <site>/api/contact?hsContactId=<id>` — 500 "Failed to fetch contact" = server env missing; 400 = bad id; contact JSON = env fine (then suspect the rate-limiter's hsContactId-stripping soft-degrade).
|
|
32
34
|
|
|
33
35
|
## What did NOT work — DO NOT RETRY THESE
|
|
34
36
|
- **Answering the test call silently** → 8 seconds of mutual silence, Vapi `endedReason=customer-ended-call`, empty transcript. The healthcare assistant uses `firstMessageMode=assistant-waits-for-user` (deliberate: first-phoneme timing for voicemail/iPhone screening). **Testers must say "Hello?" first.**
|
|
@@ -48,8 +50,9 @@ updated: 2026-07-21
|
|
|
48
50
|
## Current file state
|
|
49
51
|
| File | Status | Notes |
|
|
50
52
|
|------|--------|-------|
|
|
51
|
-
| BDR enrichment + prefill
|
|
52
|
-
| BDR fast-dial + anon guard + share
|
|
53
|
+
| BDR enrichment + prefill | committed `6a97dd1` on `_dev-sandbox` | live-proven on contact 248 |
|
|
54
|
+
| BDR fast-dial + anon guard + share | committed `6d52b53` on `_dev-sandbox` | 131 tests green |
|
|
55
|
+
| BDR amplify.yml env fix | committed `e17d804` on `_dev-sandbox`, pushed (build triggered) | official env-passthrough recipe; branch model: **_dev-sandbox is source of truth, BDR-Phase-2 retired** |
|
|
53
56
|
| BDR/.env.local | TOGA_WORKER_URL added (local only) | dev server restart needed to load |
|
|
54
57
|
| dbchanges2 feature/ai-bdr-test-campaign (e99a367) | pushed; PR must be CLOSED UNMERGED | superseded + buggy (see above) |
|
|
55
58
|
| Prod Client_True data | campaign 2 dateEnd=2026-07-28; all campaign-2 contacts isOkayToCall=0 EXCEPT 248 | restore = go-live switch; exclude ids 120/132/134/146/155 |
|
|
@@ -62,12 +65,12 @@ updated: 2026-07-21
|
|
|
62
65
|
- **Anonymous submits blocked with notice** (matches info) per tcox's directive that anything diverging from info needs correcting.
|
|
63
66
|
|
|
64
67
|
## Blockers
|
|
65
|
-
- **Amplify
|
|
68
|
+
- **Amplify env vars must be saved in the console BEFORE a build starts** (vars added mid-build don't reach it — "Redeploy this version" required). At save time: awaiting tcox confirming the 7 vars are in the console + a green build of `e17d804`. Deployed `/api/contact` still returned 500 at last probe.
|
|
66
69
|
- **ContactAttempts ACL grant** (backend, DB config only) — gates real summaries + live status.
|
|
67
|
-
- **Business decision on the restore SQL** (resumes cold-calling ~70 prospects).
|
|
70
|
+
- **Business decision on the restore SQL** (resumes cold-calling ~70 prospects; exclude DNC ids 120/132/134/146/155).
|
|
68
71
|
|
|
69
72
|
## Exact next step
|
|
70
|
-
>
|
|
73
|
+
> Confirm the 7 env vars are saved in the Amplify console, then redeploy branch `_dev-sandbox` (build must START after the vars are saved). When green, probe `https://dev-sandbox.d65bvvjrww97g.amplifyapp.com/api/contact?hsContactId=131770626674` — contact JSON = fixed. Then open `https://dev-sandbox.d65bvvjrww97g.amplifyapp.com/?hsContactId=131770626674` and submit Call Now: this is simultaneously the deployed smoke test AND the fast-dial first live run (phone rings in seconds from +1 331-244-5958 — ANSWER AND SPEAK FIRST).
|
|
71
74
|
|
|
72
75
|
---
|
|
73
76
|
_Saved by /session-save on 2026-07-21_
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: session
|
|
3
|
+
slug: surface-decision-modal
|
|
4
|
+
title: Surface-driven Sales Order decision modal (approve + deny)
|
|
5
|
+
author: apeterson
|
|
6
|
+
repos: [toga25-supply, dbchanges2]
|
|
7
|
+
framework: "2.0"
|
|
8
|
+
client: shared
|
|
9
|
+
status: active
|
|
10
|
+
created: 2026-07-21
|
|
11
|
+
updated: 2026-07-21
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Session: surface-decision-modal
|
|
15
|
+
**Date:** 2026-07-21
|
|
16
|
+
**Project/Repo:** toga25-supply + dbchanges2 (2.0)
|
|
17
|
+
**Task:** Migrate the per-client Sales Order approve/deny modal config (`approvalActionFields.json`) from static per-client JSON to metadata-driven Surfaces + SurfaceElements resolved per-role server-side — Core neutral default first, client SurfaceOverrides after.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## What WORKED
|
|
22
|
+
<!-- Include specific file paths and evidence -->
|
|
23
|
+
- **Core seed 2026-07-21a** (`dbchanges2/Core/2026-07-21a - SalesOrderDecisionSummarySurfaceSeed.sql`) — creates surface `sales-order-decision-summary` (SECTION, config cardType 'decisionSummary'), SHARED across approve+deny; 8 read-only FIELD elements (recordFieldId NULL + config.valueKey), Total is CURRENCY, all isVisible=1; messages keyed `salesOrder.decision.field.*`. Confirmed run in local Core; meta-group endpoint returns the surface + 8 elements + messages.
|
|
24
|
+
- **Core seed 2026-07-21b** (`dbchanges2/Core/2026-07-21b - SalesOrderDecisionActionSurfaceSeed.sql`) — creates `sales-order-approve-action` + `sales-order-deny-action` (config cardType 'decisionAction', action approve/deny), 7 role-tagged elements each (config.role: title/guardrail/reasonInput/confirmButton/cancelButton/successToast/errorToast). Approve reason OPTIONAL (charLimit 255, check/mint-700); deny reason REQUIRED (showRequiredIndicator, xmark). Confirmed run + reload → both surfaces now resolve populated (verified via meta-group JSON).
|
|
25
|
+
- Both seeds ADDITIVE / id-agnostic / re-runnable (NOT EXISTS-guarded per surface slug + config.role/valueKey; messages guarded by messageKey; surfaces inherit appId/recordId from `order-details` sibling). Re-running 21a inserted nothing (verified — no dupes).
|
|
26
|
+
- **FE adapter** (`toga25-supply/.../SalesOrderApprovalModalsLayout/helpers/surfaceBundlesToDecisionFields.ts`) — maps 3 resolved bundles → `{ orderContentDetails, approve, deny }`; exports DECISION_SURFACE_SLUGS, surfaceBundlesToDecisionFields(), isDecisionSurfaceEnabled(), overlayDecisionSurfaceFields(). decisionSurfaceFields output verified correct against the JSON shape (user pasted matching output).
|
|
27
|
+
- **FE view-model wiring** (`.../viewModel/useApprovalModalViewModel.tsx`) — fetches via useFetchSurfaceMetaGroup(DECISION_SURFACE_SLUGS); builds `resolvedTenantFields` overlaying the 3 Surface keys onto patched JSON; returned as `tenantFields`. `SalesOrderApprovalModalsLayout.tsx` needs NO change (still reads `tenantFields.recordActionFields`).
|
|
28
|
+
- Full `npx tsc --noEmit` clean; `npx eslint` clean after the any→unknown fix.
|
|
29
|
+
- KB captured/pushed: `surface-frontend.md` + `surface-layer-schema.md` updated on _main.
|
|
30
|
+
|
|
31
|
+
## What did NOT work — DO NOT RETRY THESE
|
|
32
|
+
<!-- Exact failure reasons — do not vague-ify -->
|
|
33
|
+
- **Assuming a full JSON→Surface replacement.** The 3 surfaces cover only 3 of the 7 `recordActionFields` keys. `guardrailCopy`, `actionOptions` (approve step-two enable rule), `approvalWorkflow`, `orderContentDetailsWorkflow` are NOT modeled in surfaces; and JSON approve/deny carry functional attrs the surface never emits (`characterLimit: 255`, `inputContainerWidth`, submit valueKeys `approveOrder`/`confirmApproveOrder`/`cancel`). A straight replace would drop these → had to overlay instead.
|
|
34
|
+
- **Naive object spread for the overlay.** The adapter emits keys with value `undefined` (e.g. approve reasonTextBox.characterLimit), so `{...json, ...surface}` would overwrite JSON's 255 with undefined. Fixed with `overlayDefined()` (copies only defined values).
|
|
35
|
+
- **`any` in overlay helpers.** ESLint `@typescript-eslint/no-explicit-any` failed (6 errors) — `tsc` was clean but the repo's ESLint blocks `any`. Replaced with `Record<string, unknown>` + explicit casts at the JSON boundary.
|
|
36
|
+
- **Expecting DB seed changes to show without a reload.** useFetchSurfaceMetaGroup is session-cached (staleTime/gcTime Infinity). 21b appeared to "not work" until a hard reload / re-login. Not a bug.
|
|
37
|
+
|
|
38
|
+
## Not tried yet (candidates for next session)
|
|
39
|
+
- **Client SurfaceOverride seeds** (the whole point of the migration): Compass + Compass Canada — CONFIG override on Total element to add `isConcatenated` (`_totalLease` + "/mo", stacked). Quad — IS_VISIBLE=0 on summary fields 1 (Assigned Manager), 7 (Cost Center), 8 (Reason for Request). Register in dbchanges2 README run-order.
|
|
40
|
+
- **Move `characterLimit` / `inputType` into surface element `config` JSON** in 21b so the adapter reads them from surface (currently read from JSON via overlay). Prerequisite to deleting the JSON.
|
|
41
|
+
- **`orderContentDetailsWorkflow`** — user set it to reuse `decision.orderContentDetails`; note the workflow view historically used labels WITHOUT trailing colon and dropped "Assigned Manager". Decide whether a separate `sales-order-decision-summary-workflow` surface is needed.
|
|
42
|
+
- **Remove the two debug `console.log`s** in useApprovalModalViewModel.tsx before commit (house rule: no dead code).
|
|
43
|
+
- **Delete the per-client `approvalActionFields.json`** once all functional attrs are surface-modeled and clients verified (kept as reference for now — user explicitly said not to delete).
|
|
44
|
+
|
|
45
|
+
## Current file state
|
|
46
|
+
| File | Status | Notes |
|
|
47
|
+
|------|--------|-------|
|
|
48
|
+
| dbchanges2/Core/2026-07-21a - SalesOrderDecisionSummarySurfaceSeed.sql | created, RUN in local Core | shared decision summary surface + 8 elements |
|
|
49
|
+
| dbchanges2/Core/2026-07-21b - SalesOrderDecisionActionSurfaceSeed.sql | created, RUN in local Core | approve + deny action-chrome surfaces (7 elements each) |
|
|
50
|
+
| dbchanges2/Core/2026-07-17 - README - RUN ORDER.md | edited | 21a/21b registered under "TWO - ADDITIONAL CORE RESETS"; Quad ENUM-widener ordered before 21a; Compass/CC 21a/21b override entries |
|
|
51
|
+
| toga25-supply/.../helpers/surfaceBundlesToDecisionFields.ts | created | adapter + overlayDecisionSurfaceFields(); any→unknown; tsc+eslint clean |
|
|
52
|
+
| toga25-supply/.../viewModel/useApprovalModalViewModel.tsx | edited (additive) | fetch + resolvedTenantFields overlay; 2 debug console.logs still present |
|
|
53
|
+
| toga25-supply/.../SalesOrderApprovalModalsLayout.tsx | unchanged | still reads tenantFields.recordActionFields — no change needed |
|
|
54
|
+
| toga25-supply/.../viewModel/FIELDS/*/approvalActionFields.json | unchanged | kept as reference; NOT to be deleted yet |
|
|
55
|
+
|
|
56
|
+
## Decisions made
|
|
57
|
+
- **Overlay (merge), not full replacement.** Surface owns display attrs of the 3 migrated keys; JSON fills unmigrated keys + functional attrs. Rejected: full replace (would drop characterLimit/guardrailCopy/actionOptions/workflow). Gated by `isDecisionSurfaceEnabled` → unseeded clients fall back to pure JSON.
|
|
58
|
+
- **Shared summary surface + two per-action chrome surfaces.** The 8 summary rows are identical across approve/deny → one `sales-order-decision-summary`; the chrome diverges (title text, reason required-ness, icons, toasts) → two action surfaces. Renamed the summary from an approval-only slug to `sales-order-decision-summary`.
|
|
59
|
+
- **Core neutral default = all summary fields visible, plain Total (no concat), action buttons carry standard English labels.** Per-client differences (concat, field hides, wording) belong in SurfaceOverrides, not Core. Matches house rule: display fields default visible; only action buttons default OFF.
|
|
60
|
+
- **Elements found by `config.role`, not id.** No ADMIN/MANAGER branching in the FE — surfaces resolve per-authenticated-role server-side.
|
|
61
|
+
|
|
62
|
+
## Blockers
|
|
63
|
+
none
|
|
64
|
+
|
|
65
|
+
## Exact next step
|
|
66
|
+
> Author the client SurfaceOverride seeds in dbchanges2: Compass + Compass Canada CONFIG override on the `sales-order-decision-summary` Total element (add isConcatenated `_totalLease` "+ "/"/mo" stacked), and Quad IS_VISIBLE=0 overrides on summary fields 1/7/8 (Assigned Manager / Cost Center / Reason for Request). Follow the additive NOT EXISTS-guarded override pattern and register them in `Core/2026-07-17 - README - RUN ORDER.md`.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
_Saved by /session-save on 2026-07-21_
|
package/package.json
CHANGED