← back to Dw Pitch Followup
DW client/vendor follow-up pitch viewer: 3 read-only FileMaker lists + George-grounded letters + select/export (no sends)
a518ea640cdcba06fce7e0efed522ee8af360a3b · 2026-06-30 13:35:57 -0700 · Steve Abrams
Files touched
A .gitignoreA lib/fm.jsA package-lock.jsonA package.jsonA public/index.htmlA scripts/build-lists.jsA server.js
Diff
commit a518ea640cdcba06fce7e0efed522ee8af360a3b
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Tue Jun 30 13:35:57 2026 -0700
DW client/vendor follow-up pitch viewer: 3 read-only FileMaker lists + George-grounded letters + select/export (no sends)
---
.gitignore | 10 +
lib/fm.js | 78 +++++
package-lock.json | 828 +++++++++++++++++++++++++++++++++++++++++++++++++
package.json | 14 +
public/index.html | 251 +++++++++++++++
scripts/build-lists.js | 220 +++++++++++++
server.js | 147 +++++++++
7 files changed, 1548 insertions(+)
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..408e474
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+node_modules/
+.env*
+tmp/
+*.log
+.DS_Store
+dist/
+build/
+.next/
+data/lists.json
+data/*.jsonl
diff --git a/lib/fm.js b/lib/fm.js
new file mode 100644
index 0000000..bc2ad96
--- /dev/null
+++ b/lib/fm.js
@@ -0,0 +1,78 @@
+// Thin wrapper around the existing filemaker-mcp Data API client.
+// We REUSE that project's client + config + node_modules by importing it via
+// absolute path (ESM resolves its bare deps against its own node_modules), and
+// load its .env so FM_CLOUD_HOST / Cognito creds are present. READ-ONLY here:
+// we force FM_READONLY=1 so this tool can never write to FileMaker.
+
+import fs from 'node:fs';
+
+const FM_MCP_DIR = '/Users/stevestudio2/Projects/filemaker-mcp';
+
+// Load filemaker-mcp/.env into process.env (no dotenv dep).
+function loadFmEnv() {
+ const envPath = `${FM_MCP_DIR}/.env`;
+ if (!fs.existsSync(envPath)) throw new Error(`filemaker-mcp .env not found at ${envPath}`);
+ for (const line of fs.readFileSync(envPath, 'utf8').split('\n')) {
+ const m = line.match(/^\s*([A-Z0-9_]+)\s*=\s*(.*)\s*$/);
+ if (m && process.env[m[1]] === undefined) process.env[m[1]] = m[2].replace(/^["']|["']$/g, '');
+ }
+ process.env.FM_READONLY = '1'; // hard read-only for this tool
+}
+loadFmEnv();
+
+const client = await import(`${FM_MCP_DIR}/src/fm-client.js`);
+export const { findRecords, getRecord, listRecords, fieldMetadata, layouts } = client;
+
+// Page through a find query, accumulating up to `cap` records.
+// query = a single find-request object or an array (OR'd) per the Data API.
+export async function findAll(db, layout, query, { pageSize = 100, cap = 5000, sort } = {}) {
+ const out = [];
+ let offset = 1;
+ while (out.length < cap) {
+ let res;
+ try {
+ res = await findRecords(db, layout, query, { limit: pageSize, offset, sort });
+ } catch (e) {
+ // FileMaker code 401 = "no records match" → clean empty result, not an error.
+ if (String(e.fmCode) === '401') break;
+ throw e;
+ }
+ const recs = res.records || [];
+ out.push(...recs);
+ if (recs.length < pageSize) break;
+ offset += pageSize;
+ }
+ return out.slice(0, cap);
+}
+
+// Fetch many accounts' parent project records in chunks via OR-queries.
+export async function findProjectsByAccounts(accounts, { layout = 'Projects', chunk = 60 } = {}) {
+ const map = new Map();
+ for (let i = 0; i < accounts.length; i += chunk) {
+ const slice = accounts.slice(i, i + chunk);
+ const query = slice.map((a) => ({ 'Account Number': `==${a}` }));
+ let recs = [];
+ try {
+ recs = (await findRecords('Clients', layout, query, { limit: slice.length * 3 })).records || [];
+ } catch (e) {
+ if (String(e.fmCode) !== '401') throw e;
+ }
+ for (const r of recs) {
+ const acct = r.fieldData['Account Number'];
+ if (acct && !map.has(String(acct))) map.set(String(acct), r);
+ }
+ }
+ return map;
+}
+
+// US-format date helper for FileMaker find criteria (MM/DD/YYYY).
+export function fmDate(d) {
+ const mm = String(d.getMonth() + 1).padStart(2, '0');
+ const dd = String(d.getDate()).padStart(2, '0');
+ return `${mm}/${dd}/${d.getFullYear()}`;
+}
+export function daysAgo(n, base = new Date('2026-06-30T12:00:00')) {
+ const d = new Date(base);
+ d.setDate(d.getDate() - n);
+ return d;
+}
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000..24fee5a
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,828 @@
+{
+ "name": "dw-pitch-followup",
+ "version": "0.1.0",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "dw-pitch-followup",
+ "version": "0.1.0",
+ "dependencies": {
+ "express": "^4.22.2"
+ }
+ },
+ "node_modules/accepts": {
+ "version": "1.3.8",
+ "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
+ "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
+ "license": "MIT",
+ "dependencies": {
+ "mime-types": "~2.1.34",
+ "negotiator": "0.6.3"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/array-flatten": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
+ "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==",
+ "license": "MIT"
+ },
+ "node_modules/body-parser": {
+ "version": "1.20.5",
+ "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.5.tgz",
+ "integrity": "sha512-3grm+/2tUOvu2cjJkvsIxrv/wVpfXQW4PsQHYm7yk4vfpu7Ekl6nEsYBoJUL6qDwZUx8wUhQ8tR2qz+ad9c9OA==",
+ "license": "MIT",
+ "dependencies": {
+ "bytes": "~3.1.2",
+ "content-type": "~1.0.5",
+ "debug": "2.6.9",
+ "depd": "2.0.0",
+ "destroy": "~1.2.0",
+ "http-errors": "~2.0.1",
+ "iconv-lite": "~0.4.24",
+ "on-finished": "~2.4.1",
+ "qs": "~6.15.1",
+ "raw-body": "~2.5.3",
+ "type-is": "~1.6.18",
+ "unpipe": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8",
+ "npm": "1.2.8000 || >= 1.4.16"
+ }
+ },
+ "node_modules/bytes": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
+ "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/call-bind-apply-helpers": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
+ "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "function-bind": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/call-bound": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",
+ "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.2",
+ "get-intrinsic": "^1.3.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/content-disposition": {
+ "version": "0.5.4",
+ "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
+ "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
+ "license": "MIT",
+ "dependencies": {
+ "safe-buffer": "5.2.1"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/content-type": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
+ "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/cookie": {
+ "version": "0.7.2",
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
+ "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/cookie-signature": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz",
+ "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==",
+ "license": "MIT"
+ },
+ "node_modules/debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "license": "MIT",
+ "dependencies": {
+ "ms": "2.0.0"
+ }
+ },
+ "node_modules/depd": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
+ "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/destroy": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
+ "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8",
+ "npm": "1.2.8000 || >= 1.4.16"
+ }
+ },
+ "node_modules/dunder-proto": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
+ "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.1",
+ "es-errors": "^1.3.0",
+ "gopd": "^1.2.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/ee-first": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
+ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
+ "license": "MIT"
+ },
+ "node_modules/encodeurl": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
+ "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/es-define-property": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
+ "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-errors": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
+ "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-object-atoms": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz",
+ "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/escape-html": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
+ "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
+ "license": "MIT"
+ },
+ "node_modules/etag": {
+ "version": "1.8.1",
+ "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
+ "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/express": {
+ "version": "4.22.2",
+ "resolved": "https://registry.npmjs.org/express/-/express-4.22.2.tgz",
+ "integrity": "sha512-IuL+Elrou2ZvCFHs18/CIzy2Nzvo25nZ1/D2eIZlz7c+QUayAcYoiM2BthCjs+EBHVpjYjcuLDAiCWgeIX3X1Q==",
+ "license": "MIT",
+ "dependencies": {
+ "accepts": "~1.3.8",
+ "array-flatten": "1.1.1",
+ "body-parser": "~1.20.5",
+ "content-disposition": "~0.5.4",
+ "content-type": "~1.0.4",
+ "cookie": "~0.7.1",
+ "cookie-signature": "~1.0.6",
+ "debug": "2.6.9",
+ "depd": "2.0.0",
+ "encodeurl": "~2.0.0",
+ "escape-html": "~1.0.3",
+ "etag": "~1.8.1",
+ "finalhandler": "~1.3.1",
+ "fresh": "~0.5.2",
+ "http-errors": "~2.0.0",
+ "merge-descriptors": "1.0.3",
+ "methods": "~1.1.2",
+ "on-finished": "~2.4.1",
+ "parseurl": "~1.3.3",
+ "path-to-regexp": "~0.1.12",
+ "proxy-addr": "~2.0.7",
+ "qs": "~6.15.1",
+ "range-parser": "~1.2.1",
+ "safe-buffer": "5.2.1",
+ "send": "~0.19.0",
+ "serve-static": "~1.16.2",
+ "setprototypeof": "1.2.0",
+ "statuses": "~2.0.1",
+ "type-is": "~1.6.18",
+ "utils-merge": "1.0.1",
+ "vary": "~1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.10.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/finalhandler": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz",
+ "integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "2.6.9",
+ "encodeurl": "~2.0.0",
+ "escape-html": "~1.0.3",
+ "on-finished": "~2.4.1",
+ "parseurl": "~1.3.3",
+ "statuses": "~2.0.2",
+ "unpipe": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/forwarded": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
+ "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/fresh": {
+ "version": "0.5.2",
+ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
+ "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/function-bind": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
+ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/get-intrinsic": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
+ "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.2",
+ "es-define-property": "^1.0.1",
+ "es-errors": "^1.3.0",
+ "es-object-atoms": "^1.1.1",
+ "function-bind": "^1.1.2",
+ "get-proto": "^1.0.1",
+ "gopd": "^1.2.0",
+ "has-symbols": "^1.1.0",
+ "hasown": "^2.0.2",
+ "math-intrinsics": "^1.1.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/get-proto": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
+ "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
+ "license": "MIT",
+ "dependencies": {
+ "dunder-proto": "^1.0.1",
+ "es-object-atoms": "^1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/gopd": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
+ "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/has-symbols": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
+ "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/hasown": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz",
+ "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==",
+ "license": "MIT",
+ "dependencies": {
+ "function-bind": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/http-errors": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",
+ "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",
+ "license": "MIT",
+ "dependencies": {
+ "depd": "~2.0.0",
+ "inherits": "~2.0.4",
+ "setprototypeof": "~1.2.0",
+ "statuses": "~2.0.2",
+ "toidentifier": "~1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/iconv-lite": {
+ "version": "0.4.24",
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
+ "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
+ "license": "MIT",
+ "dependencies": {
+ "safer-buffer": ">= 2.1.2 < 3"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/inherits": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
+ "license": "ISC"
+ },
+ "node_modules/ipaddr.js": {
+ "version": "1.9.1",
+ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
+ "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
+ "node_modules/math-intrinsics": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
+ "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/media-typer": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
+ "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/merge-descriptors": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz",
+ "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/methods": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
+ "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mime": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
+ "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
+ "license": "MIT",
+ "bin": {
+ "mime": "cli.js"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/mime-db": {
+ "version": "1.52.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
+ "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mime-types": {
+ "version": "2.1.35",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
+ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
+ "license": "MIT",
+ "dependencies": {
+ "mime-db": "1.52.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
+ "license": "MIT"
+ },
+ "node_modules/negotiator": {
+ "version": "0.6.3",
+ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
+ "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/object-inspect": {
+ "version": "1.13.4",
+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
+ "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/on-finished": {
+ "version": "2.4.1",
+ "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
+ "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
+ "license": "MIT",
+ "dependencies": {
+ "ee-first": "1.1.1"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/parseurl": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
+ "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/path-to-regexp": {
+ "version": "0.1.13",
+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.13.tgz",
+ "integrity": "sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA==",
+ "license": "MIT"
+ },
+ "node_modules/proxy-addr": {
+ "version": "2.0.7",
+ "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
+ "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
+ "license": "MIT",
+ "dependencies": {
+ "forwarded": "0.2.0",
+ "ipaddr.js": "1.9.1"
+ },
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
+ "node_modules/qs": {
+ "version": "6.15.3",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.3.tgz",
+ "integrity": "sha512-O9gl3zCl5h5blw1KGUzQKhA5oUXSl8rwUIM5o0S3nCXMliSvy5Dzx7/DJcI+SwgICv+IneSZwhBh1oSyEHA71A==",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "es-define-property": "^1.0.1",
+ "side-channel": "^1.1.1"
+ },
+ "engines": {
+ "node": ">=0.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/range-parser": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
+ "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/raw-body": {
+ "version": "2.5.3",
+ "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz",
+ "integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==",
+ "license": "MIT",
+ "dependencies": {
+ "bytes": "~3.1.2",
+ "http-errors": "~2.0.1",
+ "iconv-lite": "~0.4.24",
+ "unpipe": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/safe-buffer": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "MIT"
+ },
+ "node_modules/safer-buffer": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
+ "license": "MIT"
+ },
+ "node_modules/send": {
+ "version": "0.19.2",
+ "resolved": "https://registry.npmjs.org/send/-/send-0.19.2.tgz",
+ "integrity": "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "2.6.9",
+ "depd": "2.0.0",
+ "destroy": "1.2.0",
+ "encodeurl": "~2.0.0",
+ "escape-html": "~1.0.3",
+ "etag": "~1.8.1",
+ "fresh": "~0.5.2",
+ "http-errors": "~2.0.1",
+ "mime": "1.6.0",
+ "ms": "2.1.3",
+ "on-finished": "~2.4.1",
+ "range-parser": "~1.2.1",
+ "statuses": "~2.0.2"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/send/node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "license": "MIT"
+ },
+ "node_modules/serve-static": {
+ "version": "1.16.3",
+ "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.3.tgz",
+ "integrity": "sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==",
+ "license": "MIT",
+ "dependencies": {
+ "encodeurl": "~2.0.0",
+ "escape-html": "~1.0.3",
+ "parseurl": "~1.3.3",
+ "send": "~0.19.1"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/setprototypeof": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
+ "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
+ "license": "ISC"
+ },
+ "node_modules/side-channel": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz",
+ "integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "object-inspect": "^1.13.4",
+ "side-channel-list": "^1.0.1",
+ "side-channel-map": "^1.0.1",
+ "side-channel-weakmap": "^1.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/side-channel-list": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz",
+ "integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "object-inspect": "^1.13.4"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/side-channel-map": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",
+ "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.2",
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.5",
+ "object-inspect": "^1.13.3"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/side-channel-weakmap": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
+ "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.2",
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.5",
+ "object-inspect": "^1.13.3",
+ "side-channel-map": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/statuses": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
+ "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/toidentifier": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
+ "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.6"
+ }
+ },
+ "node_modules/type-is": {
+ "version": "1.6.18",
+ "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
+ "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
+ "license": "MIT",
+ "dependencies": {
+ "media-typer": "0.3.0",
+ "mime-types": "~2.1.24"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/unpipe": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
+ "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/utils-merge": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
+ "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4.0"
+ }
+ },
+ "node_modules/vary": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
+ "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ }
+ }
+}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..1ac45ea
--- /dev/null
+++ b/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "dw-pitch-followup",
+ "version": "0.1.0",
+ "private": true,
+ "type": "module",
+ "description": "DW client follow-up pitch lists + selection viewer. Read-only over FileMaker (Clients/WALLPAPER/invoice) + George (Gmail thread context). No sends, no Gmail drafts — Steve selects pitches from the viewer.",
+ "scripts": {
+ "build": "node scripts/build-lists.js",
+ "start": "node server.js"
+ },
+ "dependencies": {
+ "express": "^4.22.2"
+ }
+}
diff --git a/public/index.html b/public/index.html
new file mode 100644
index 0000000..6b15820
--- /dev/null
+++ b/public/index.html
@@ -0,0 +1,251 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8" />
+<meta name="viewport" content="width=device-width, initial-scale=1" />
+<title>DW Client Follow-Up · Pitch Viewer</title>
+<style>
+ :root{
+ --bg:#13110e; --panel:#1c1915; --panel2:#211d18; --line:#34302a;
+ --ink:#efeae1; --mut:#a59c8d; --gold:#c8a96a; --green:#7fae6a; --amber:#d9a441; --red:#cf6a5a;
+ --cols:3;
+ }
+ *{box-sizing:border-box}
+ body{margin:0;font:15px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif;background:var(--bg);color:var(--ink)}
+ header{padding:18px 24px 10px;border-bottom:1px solid var(--line);background:linear-gradient(180deg,#181511,#13110e)}
+ h1{margin:0;font-size:19px;letter-spacing:.04em;font-weight:600}
+ h1 small{color:var(--mut);font-weight:400;font-size:13px;letter-spacing:0}
+ .tabs{display:flex;gap:6px;margin-top:14px;flex-wrap:wrap}
+ .tab{padding:9px 16px;border:1px solid var(--line);border-bottom:none;border-radius:8px 8px 0 0;background:var(--panel);color:var(--mut);cursor:pointer;font-size:13.5px}
+ .tab.active{background:var(--panel2);color:var(--ink);border-color:var(--gold)}
+ .tab .n{display:inline-block;margin-left:7px;padding:0 7px;border-radius:10px;background:#2c2822;color:var(--gold);font-size:12px}
+ .toolbar{position:sticky;top:0;z-index:5;display:flex;gap:14px;align-items:center;flex-wrap:wrap;padding:12px 24px;background:var(--panel2);border-bottom:1px solid var(--line)}
+ .toolbar label{color:var(--mut);font-size:12.5px;margin-right:5px}
+ select,input[type=search]{background:#15120f;color:var(--ink);border:1px solid var(--line);border-radius:7px;padding:7px 9px;font-size:13px}
+ input[type=range]{vertical-align:middle}
+ .btn{background:#2a2620;color:var(--ink);border:1px solid var(--line);border-radius:7px;padding:7px 12px;cursor:pointer;font-size:13px}
+ .btn:hover{border-color:var(--gold)}
+ .btn.gold{background:var(--gold);color:#1a1611;border-color:var(--gold);font-weight:600}
+ .spacer{flex:1}
+ .selcount{color:var(--gold);font-size:13px}
+ main{padding:18px 24px 80px}
+ .grid{display:grid;grid-template-columns:repeat(var(--cols),minmax(0,1fr));gap:14px}
+ .card{background:var(--panel);border:1px solid var(--line);border-radius:11px;padding:13px 14px;display:flex;flex-direction:column;gap:8px;position:relative}
+ .card.sel{border-color:var(--gold);box-shadow:0 0 0 1px var(--gold) inset}
+ .card .top{display:flex;align-items:flex-start;gap:9px}
+ .card input[type=checkbox]{width:18px;height:18px;margin-top:2px;accent-color:var(--gold);cursor:pointer;flex:0 0 auto}
+ .co{font-weight:600;font-size:15px}
+ .sub{color:var(--mut);font-size:12.5px;word-break:break-word}
+ .chips{display:flex;flex-wrap:wrap;gap:6px}
+ .chip{font-size:11.5px;padding:2px 8px;border-radius:11px;background:#26221c;color:var(--mut);border:1px solid var(--line)}
+ .chip.k{color:var(--gold)}
+ .chip.g{color:var(--green)} .chip.a{color:var(--amber)} .chip.r{color:var(--red)}
+ .when{font-size:11.5px;color:var(--mut)}
+ .pats{font-size:12px;color:var(--mut)}
+ .acts{display:flex;gap:8px;margin-top:2px}
+ .letter{margin-top:6px;border-top:1px dashed var(--line);padding-top:8px;display:none}
+ .letter.show{display:block}
+ .letter .subj{font-size:12.5px;color:var(--gold);margin-bottom:5px}
+ textarea{width:100%;min-height:180px;background:#15120f;color:var(--ink);border:1px solid var(--line);border-radius:7px;padding:9px;font:13px/1.5 ui-monospace,Menlo,monospace;resize:vertical}
+ .ctxnote{font-size:11.5px;color:var(--mut);margin:5px 0}
+ .ctxnote.found{color:var(--green)}
+ #sentinel{height:40px}
+ .empty{color:var(--mut);padding:40px;text-align:center}
+ .note{font-size:12px;color:var(--mut);margin-top:6px}
+ .meta{color:var(--mut);font-size:12px}
+ a{color:var(--gold)}
+</style>
+</head>
+<body>
+<header>
+ <h1>Designer Wallcoverings — Client Follow-Up <small>· select pitches · nothing sends from here</small></h1>
+ <div class="tabs" id="tabs"></div>
+</header>
+
+<div class="toolbar">
+ <span><label>Sort</label><select id="sort"></select></span>
+ <span><label>Density</label><input type="range" id="density" min="1" max="5" step="1" /></span>
+ <span><input type="search" id="q" placeholder="filter…" /></span>
+ <span class="spacer"></span>
+ <span class="selcount" id="selcount">0 selected</span>
+ <button class="btn" id="copyBtn">Copy selected</button>
+ <button class="btn gold" id="exportBtn">Export selected ▾</button>
+ <span class="meta" id="built"></span>
+</div>
+
+<main>
+ <div class="grid" id="grid"></div>
+ <div id="sentinel"></div>
+ <div class="empty" id="empty" style="display:none">No rows.</div>
+ <div class="note" id="defn"></div>
+</main>
+
+<script>
+const LISTS = ['list1','list2','list3'];
+const TAB_META = {
+ list1:{title:'Samples Sent ≥90%', defn:'Projects where ≥90% of the samples the client ordered have shipped — they have the goods in hand; follow up to convert.'},
+ list2:{title:'Invoiced · No Order', defn:'Clients invoiced in the last ~4 months whose invoices were all sample-only (no order over $50) — never converted to a firm order.'},
+ list3:{title:'Vendor Memos Overdue', defn:'Sample memos WE requested from a vendor 8–180 days ago that still have not been received — chase the vendor.'},
+};
+const SORTS = {
+ list1:[['Newest sent','created_at:desc'],['Oldest sent','created_at:asc'],['Company A→Z','company:asc'],['Most samples','ordered:desc']],
+ list2:[['Newest invoiced','created_at:desc'],['Oldest invoiced','created_at:asc'],['Company A→Z','company:asc'],['Most invoices','invoice_count:desc']],
+ list3:[['Most overdue','days_overdue:desc'],['Least overdue','days_overdue:asc'],['Vendor A→Z','vendor:asc'],['Client A→Z','company:asc']],
+};
+let DATA=null, cur='list1', rendered=0, view=[], io=null;
+const LS = (k,d)=>{try{return JSON.parse(localStorage.getItem('dwpf:'+k))??d}catch{return d}};
+const setLS=(k,v)=>localStorage.setItem('dwpf:'+k, JSON.stringify(v));
+const fmtWhen = iso => { if(!iso) return ''; const d=new Date(iso); return d.toLocaleString(undefined,{year:'numeric',month:'short',day:'numeric',hour:'numeric',minute:'2-digit'}); };
+const esc = s => String(s??'').replace(/[&<>"]/g,c=>({'&':'&','<':'<','>':'>','"':'"'}[c]));
+
+function selSet(){ return new Set(LS('sel:'+cur, [])); }
+function saveSel(set){ setLS('sel:'+cur, [...set]); paintSelCount(); }
+function rowKey(r){ return cur==='list3' ? `${r.account}|${r.sku}` : r.account; }
+
+function paintSelCount(){
+ const n = selSet().size;
+ document.getElementById('selcount').textContent = `${n} selected`;
+}
+
+function applySortFilter(){
+ const rows = (DATA[cur]||[]).slice();
+ const q = document.getElementById('q').value.trim().toLowerCase();
+ let v = q ? rows.filter(r=>JSON.stringify(r).toLowerCase().includes(q)) : rows;
+ const [f,dir] = (LS('sort:'+cur, SORTS[cur][0][1])).split(':');
+ v.sort((a,b)=>{
+ let x=a[f], y=b[f];
+ if(typeof x==='number'||typeof y==='number'){ x=+x||0;y=+y||0; return dir==='asc'?x-y:y-x; }
+ x=String(x||'');y=String(y||''); return dir==='asc'?x.localeCompare(y):y.localeCompare(x);
+ });
+ return v;
+}
+
+function cardHTML(r){
+ const k = rowKey(r), sel = selSet().has(k);
+ let head, facts='';
+ if(cur==='list3'){
+ head = `<div><div class="co">${esc(r.vendor)} <span class="chip r">${r.days_overdue}d overdue</span></div>
+ <div class="sub">${esc(r.company||('account '+r.account))} · acct ${esc(r.account)}</div></div>`;
+ facts = `<div class="chips"><span class="chip k">${esc(r.sku||'—')}</span><span class="chip">${esc(r.pattern||'—')}</span></div>`;
+ } else if(cur==='list2'){
+ head = `<div><div class="co">${esc(r.company)}</div><div class="sub">${esc(r.email||'no email')} · acct ${esc(r.account)}</div></div>`;
+ facts = `<div class="chips"><span class="chip a">${r.invoice_count} sample inv</span><span class="chip">max $${r.max_total}</span></div>
+ ${r.details&&r.details[0]?`<div class="pats">${esc(r.details[0])}</div>`:''}`;
+ } else {
+ head = `<div><div class="co">${esc(r.company)} <span class="chip g">${r.ratio}% sent</span></div>
+ <div class="sub">${esc(r.email||'no email')} · acct ${esc(r.account)}</div></div>`;
+ facts = `<div class="chips"><span class="chip">${r.sent}/${r.ordered} sent</span>${r.missing?`<span class="chip a">${r.missing} missing</span>`:''}</div>
+ ${r.patterns&&r.patterns.length?`<div class="pats">${esc(r.patterns.slice(0,3).join(' · '))}</div>`:''}`;
+ }
+ return `<div class="card ${sel?'sel':''}" data-k="${esc(k)}">
+ <div class="top"><input type="checkbox" ${sel?'checked':''} data-sel/>${head}</div>
+ ${facts}
+ <div class="when" title="${esc(r.when_iso||'')}">🕓 ${esc(r.when_label||'when')}: ${esc(fmtWhen(r.when_iso))}</div>
+ <div class="acts"><button class="btn" data-gen>Generate letter</button></div>
+ <div class="letter"><div class="subj"></div><div class="ctxnote"></div><textarea spellcheck="false"></textarea>
+ <div class="acts"><button class="btn" data-copy>Copy letter</button></div></div>
+ </div>`;
+}
+
+function renderChunk(){
+ const grid=document.getElementById('grid');
+ const slice = view.slice(rendered, rendered+30);
+ if(!slice.length) return;
+ const frag=document.createElement('div'); frag.innerHTML = slice.map(cardHTML).join('');
+ // attach row data
+ [...frag.children].forEach((el,i)=>{ el._row = slice[i]; grid.appendChild(el); });
+ rendered += slice.length;
+}
+
+function rerender(){
+ view = applySortFilter();
+ rendered = 0;
+ const grid=document.getElementById('grid'); grid.innerHTML='';
+ document.getElementById('empty').style.display = view.length?'none':'block';
+ renderChunk();
+}
+
+async function genLetter(card){
+ const r = card._row;
+ const box = card.querySelector('.letter');
+ if(box.classList.contains('show')){ box.classList.remove('show'); return; }
+ box.classList.add('show');
+ const ta = card.querySelector('textarea'); const subj=card.querySelector('.subj'); const note=card.querySelector('.ctxnote');
+ const cacheK = 'letter:'+cur+':'+rowKey(r);
+ const cached = LS(cacheK,null);
+ if(cached){ subj.textContent='Subject: '+cached.subject; ta.value=cached.body; note.textContent=cached.ctx; note.className='ctxnote '+(cached.found?'found':''); return; }
+ subj.textContent='composing…'; ta.value='';
+ try{
+ const res = await fetch('/api/letter',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({list:cur,row:r})});
+ const j = await res.json();
+ if(j.error) throw new Error(j.error);
+ subj.textContent='Subject: '+j.subject; ta.value=j.body;
+ const ctx = j.context?.found ? `✓ grounded in last Gmail thread (${j.context.account}${j.context.subject?': "'+j.context.subject+'"':''})` : 'no prior Gmail thread found — composed from project data';
+ note.textContent=ctx; note.className='ctxnote '+(j.context?.found?'found':'');
+ setLS(cacheK,{subject:j.subject,body:j.body,ctx,found:!!j.context?.found});
+ }catch(e){ subj.textContent='error'; note.textContent=e.message; }
+}
+
+function selectedRows(){
+ const set=selSet();
+ return (DATA[cur]||[]).filter(r=>set.has(rowKey(r)));
+}
+function selectedAsText(){
+ return selectedRows().map(r=>{
+ const k='letter:'+cur+':'+rowKey(r); const L=LS(k,null);
+ const who = cur==='list3'?`${r.vendor} (re: ${r.company||r.account}, ${r.sku})`:`${r.company} <${r.email||'no-email'}>`;
+ const hdr = `=== ${who} ===`;
+ return L ? `${hdr}\nSubject: ${L.subject}\n\n${L.body}\n` : `${hdr}\n(no letter generated)\n`;
+ }).join('\n----------------------------------------\n\n');
+}
+
+// --- wiring ---
+function buildTabs(){
+ document.getElementById('tabs').innerHTML = LISTS.map(l=>`<div class="tab ${l===cur?'active':''}" data-l="${l}">${TAB_META[l].title}<span class="n">${(DATA[l]||[]).length}</span></div>`).join('');
+}
+function buildSort(){
+ const sel=document.getElementById('sort'); const saved=LS('sort:'+cur, SORTS[cur][0][1]);
+ sel.innerHTML = SORTS[cur].map(([t,v])=>`<option value="${v}" ${v===saved?'selected':''}>${t}</option>`).join('');
+}
+function switchTab(l){ cur=l; setLS('lastTab',l); buildTabs(); buildSort(); document.getElementById('defn').textContent=TAB_META[l].defn; paintSelCount(); rerender(); }
+
+document.getElementById('tabs').addEventListener('click',e=>{const t=e.target.closest('.tab'); if(t) switchTab(t.dataset.l);});
+document.getElementById('sort').addEventListener('change',e=>{ setLS('sort:'+cur, e.target.value); rerender(); });
+document.getElementById('q').addEventListener('input',()=>rerender());
+const dens=document.getElementById('density');
+dens.value = LS('density',3); document.documentElement.style.setProperty('--cols', LS('density',3));
+dens.addEventListener('input',e=>{ setLS('density',+e.target.value); document.documentElement.style.setProperty('--cols', e.target.value); });
+
+document.getElementById('grid').addEventListener('click',e=>{
+ const card=e.target.closest('.card'); if(!card) return;
+ if(e.target.matches('[data-gen]')) return genLetter(card);
+ if(e.target.matches('[data-copy]')){ const ta=card.querySelector('textarea'); navigator.clipboard.writeText(`Subject: ${card.querySelector('.subj').textContent.replace(/^Subject: /,'')}\n\n${ta.value}`); e.target.textContent='Copied ✓'; setTimeout(()=>e.target.textContent='Copy letter',1200); }
+});
+document.getElementById('grid').addEventListener('change',e=>{
+ if(!e.target.matches('[data-sel]')) return;
+ const card=e.target.closest('.card'); const k=card.dataset.k; const set=selSet();
+ if(e.target.checked){ set.add(k); card.classList.add('sel'); } else { set.delete(k); card.classList.remove('sel'); }
+ saveSel(set);
+});
+document.getElementById('copyBtn').addEventListener('click',()=>{
+ const t=selectedAsText(); if(!t){alert('Nothing selected.');return;}
+ navigator.clipboard.writeText(t); const b=document.getElementById('copyBtn'); b.textContent='Copied ✓'; setTimeout(()=>b.textContent='Copy selected',1400);
+});
+document.getElementById('exportBtn').addEventListener('click',()=>{
+ const rows=selectedRows(); if(!rows.length){alert('Nothing selected.');return;}
+ const md = `# DW Follow-Up — ${TAB_META[cur].title}\n_${rows.length} selected · ${new Date().toLocaleString()}_\n\n`+selectedAsText();
+ const blob=new Blob([md],{type:'text/markdown'}); const a=document.createElement('a');
+ a.href=URL.createObjectURL(blob); a.download=`dw-followup-${cur}-${Date.now()}.md`; a.click();
+});
+
+io = new IntersectionObserver(es=>{ if(es.some(x=>x.isIntersecting)) renderChunk(); }, {rootMargin:'400px'});
+io.observe(document.getElementById('sentinel'));
+
+fetch('/api/lists').then(r=>r.json()).then(j=>{
+ DATA=j; cur = LS('lastTab','list1'); if(!LISTS.includes(cur)) cur='list1';
+ document.getElementById('built').textContent = 'built '+new Date(j.generatedAt).toLocaleString();
+ switchTab(cur);
+}).catch(e=>{ document.getElementById('grid').innerHTML='<div class="empty">Could not load lists: '+e.message+'<br>Run <code>npm run build</code>.</div>'; });
+</script>
+</body>
+</html>
diff --git a/scripts/build-lists.js b/scripts/build-lists.js
new file mode 100644
index 0000000..fb8bb8d
--- /dev/null
+++ b/scripts/build-lists.js
@@ -0,0 +1,220 @@
+// build-lists.js — READ-ONLY FileMaker → data/lists.json
+//
+// Three follow-up "pitch" populations for Designer Wallcoverings:
+// List 1 Samples-sent clients — >=90% of ordered samples have shipped (follow up to convert).
+// List 2 Stale invoices (4mo) — invoiced in the last 4 months, NO firm order (all sample-only).
+// List 3 Overdue vendor memos — samples WE requested >8 days ago, not yet received (chase vendor).
+//
+// No writes anywhere (lib/fm.js forces FM_READONLY=1). No email. Pure read → JSON.
+
+import fs from 'node:fs';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { findAll, findProjectsByAccounts, fmDate, daysAgo } from '../lib/fm.js';
+
+const __dirname = path.dirname(fileURLToPath(import.meta.url));
+const DATA_DIR = path.join(__dirname, '..', 'data');
+fs.mkdirSync(DATA_DIR, { recursive: true });
+
+const TODAY = new Date('2026-06-30T12:00:00');
+const LOOKBACK_SENT_DAYS = Number(process.env.LOOKBACK_SENT_DAYS || 120); // List 1 recency window
+const INVOICE_SINCE = process.env.INVOICE_SINCE || '03/01/2026'; // List 2: last ~4 months
+const FIRM_ORDER_MIN = Number(process.env.FIRM_ORDER_MIN || 50); // List 2: TOTAL 1 > this = firm order
+const OVERDUE_DAYS = Number(process.env.OVERDUE_DAYS || 8); // List 3: requested > N days ago
+const OVERDUE_MAX_DAYS = Number(process.env.OVERDUE_MAX_DAYS || 180); // List 3: ignore ghost memos older than this
+const CAP = Number(process.env.LIST_CAP || 600);
+
+// --- generic helpers ------------------------------------------------
+// Pick the first populated value whose key matches any of the regexes.
+function pick(fd, regexes) {
+ for (const re of regexes) {
+ for (const [k, v] of Object.entries(fd)) {
+ if (re.test(k) && v !== '' && v != null) return v;
+ }
+ }
+ return '';
+}
+function nval(v) { const n = Number(String(v).replace(/[^0-9.\-]/g, '')); return Number.isFinite(n) ? n : 0; }
+function clean(s) { return String(s || '').replace(/[\r\n]+/g, ' ').trim(); }
+// FileMaker MM/DD/YYYY → ISO (for sorting + the viewer's date chip). '' on parse fail.
+function fmToISO(s) {
+ const m = clean(s).match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);
+ if (!m) return '';
+ const [, mm, dd, yyyy] = m;
+ const year = Number(yyyy);
+ if (year < 2000 || year > 2100) return ''; // reject source typos like "04/30/0225"
+ const d = new Date(year, Number(mm) - 1, Number(dd), 9, 0, 0);
+ return isNaN(d) ? '' : d.toISOString();
+}
+function daysSince(iso) {
+ if (!iso) return null;
+ return Math.round((TODAY - new Date(iso)) / 86400000);
+}
+function nameFromEmail(email) {
+ const lp = String(email || '').split('@')[0] || '';
+ return lp.replace(/[._-]+/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase()).trim();
+}
+
+// ====================================================================
+// LIST 1 — >=90% of ordered samples sent (drive off recent sends, then ratio)
+// ====================================================================
+async function buildList1() {
+ const since = fmDate(daysAgo(LOOKBACK_SENT_DAYS, TODAY));
+ const rows = await findAll(
+ 'WALLPAPER', 'REPORT ON SAMPLES ORDERED',
+ { 'Date WP Sample Sent': `>=${since}` },
+ { pageSize: 100, cap: 6000, sort: [{ fieldName: 'Date WP Sample Sent', sortOrder: 'descend' }] }
+ );
+ // Group sent samples by account.
+ const byAcct = new Map();
+ for (const r of rows) {
+ const fd = r.fieldData;
+ const acct = String(pick(fd, [/^account$/i, /account *#/i, /account number/i]) || '').trim();
+ if (!acct) continue;
+ const sentISO = fmToISO(pick(fd, [/date wp sample sent/i]));
+ const sku = clean(pick(fd, [/combo sku/i, /^sku/i]));
+ const pattern = clean(pick(fd, [/name of pattern/i, /mfr pattern/i, /^pattern/i]));
+ const company = clean(pick(fd, [/clients::company/i, /company for client/i]));
+ const g = byAcct.get(acct) || { account: acct, lastSentISO: '', patterns: [], company: '' };
+ if (sentISO > g.lastSentISO) g.lastSentISO = sentISO;
+ if (company && !g.company) g.company = company;
+ if (sku || pattern) g.patterns.push([pattern, sku].filter(Boolean).join(' '));
+ byAcct.set(acct, g);
+ }
+ const accounts = [...byAcct.keys()];
+ const parents = await findProjectsByAccounts(accounts);
+
+ const out = [];
+ for (const [acct, g] of byAcct) {
+ const p = parents.get(acct);
+ if (!p) continue;
+ const fd = p.fieldData;
+ const sent = nval(fd['Count # Samples Sent']);
+ const ordered = nval(fd['Count # Client Samples Ordered']);
+ if (ordered < 1) continue;
+ const ratio = sent / ordered;
+ if (ratio < 0.9) continue;
+ const email = clean(pick(fd, [/^email address$/i, /email for gmail/i, /e-?mail/i]));
+ const company = g.company || nameFromEmail(email) || `Account ${acct}`;
+ out.push({
+ account: acct,
+ company,
+ email,
+ sent, ordered, missing: nval(fd['Number of Samples Missing']),
+ ratio: Math.round(ratio * 100),
+ patterns: [...new Set(g.patterns)].slice(0, 8),
+ when_iso: g.lastSentISO,
+ when_label: 'last sample sent',
+ created_at: g.lastSentISO,
+ });
+ }
+ out.sort((a, b) => (b.created_at || '').localeCompare(a.created_at || ''));
+ return out.slice(0, CAP);
+}
+
+// ====================================================================
+// LIST 2 — invoiced in last ~4 months, NO firm order (all sample-only)
+// ====================================================================
+async function buildList2() {
+ const rows = await findAll(
+ 'invoice', 'main menu Print menu in invoice',
+ { 'Date': `>=${INVOICE_SINCE}` },
+ { pageSize: 100, cap: 4000, sort: [{ fieldName: 'Date', sortOrder: 'descend' }] }
+ );
+ const byAcct = new Map();
+ for (const r of rows) {
+ const fd = r.fieldData;
+ const acct = String(pick(fd, [/account *#/i, /^account$/i, /account number/i]) || '').trim();
+ if (!acct) continue;
+ const total = nval(pick(fd, [/grand total 2/i, /^total 1/i, /total/i]));
+ const detail = clean(pick(fd, [/^detail 1/i, /detail/i]));
+ const dISO = fmToISO(pick(fd, [/^date$/i, /date order booked/i]));
+ const inv = clean(pick(fd, [/^invoice$/i]));
+ const company = clean(pick(fd, [/sold company name/i, /company/i, /^name$/i]));
+ const g = byAcct.get(acct) || { account: acct, company, lastISO: '', count: 0, maxTotal: 0, details: [] };
+ g.count++;
+ if (company && !g.company) g.company = company;
+ if (total > g.maxTotal) g.maxTotal = total;
+ if (dISO > g.lastISO) g.lastISO = dISO;
+ if (detail) g.details.push(detail.slice(0, 80));
+ byAcct.set(acct, g);
+ }
+ // Keep accounts with NO firm order (every invoice in window <= FIRM_ORDER_MIN).
+ const kept = [...byAcct.values()].filter((g) => g.maxTotal <= FIRM_ORDER_MIN);
+ const parents = await findProjectsByAccounts(kept.map((g) => g.account));
+
+ const out = kept.map((g) => {
+ const p = parents.get(g.account);
+ const email = p ? clean(pick(p.fieldData, [/^email address$/i, /email for gmail/i, /e-?mail/i])) : '';
+ return {
+ account: g.account,
+ company: clean(g.company) || nameFromEmail(email) || `Account ${g.account}`,
+ email,
+ invoice_count: g.count,
+ max_total: g.maxTotal,
+ details: [...new Set(g.details)].slice(0, 6),
+ when_iso: g.lastISO,
+ when_label: 'last invoiced',
+ created_at: g.lastISO,
+ };
+ });
+ out.sort((a, b) => (b.created_at || '').localeCompare(a.created_at || ''));
+ return out.slice(0, CAP);
+}
+
+// ====================================================================
+// LIST 3 — samples WE requested >8 days ago, not yet received (chase vendor)
+// ====================================================================
+async function buildList3() {
+ // Actionable window: requested between OVERDUE_DAYS and OVERDUE_MAX_DAYS ago.
+ // A 2-year-old un-received memo is a dead ghost, not a vendor to chase today.
+ const before = fmDate(daysAgo(OVERDUE_DAYS, TODAY));
+ const after = fmDate(daysAgo(OVERDUE_MAX_DAYS, TODAY));
+ // NOTE: this layout returns 0 data rows unless an explicit sort is supplied
+ // (empty-match `=` criterion triggers the quirk). Drop the duplicate-on-layout
+ // `Date Discontinued` clause (it breaks the find).
+ const rows = await findAll(
+ 'WALLPAPER', 'REPORT ON SAMPLES ORDERED',
+ { 'Date Sample Request printed for vendor': `${after}...${before}`, 'Date WP Sample Sent': '=' },
+ { pageSize: 100, cap: 4000, sort: [{ fieldName: 'Date Sample Request printed for vendor', sortOrder: 'ascend' }] }
+ );
+ const out = [];
+ for (const r of rows) {
+ const fd = r.fieldData;
+ const reqISO = fmToISO(pick(fd, [/date sample request printed for vendor/i]));
+ if (!reqISO) continue;
+ const acct = String(pick(fd, [/^account$/i, /account *#/i]) || '').trim();
+ out.push({
+ account: acct,
+ vendor: clean(pick(fd, [/^supplier$/i, /^vid$/i, /vendor/i])) || 'Unknown vendor',
+ company: clean(pick(fd, [/clients::company/i, /company for client/i, /company/i])),
+ sku: clean(pick(fd, [/combo sku/i])),
+ pattern: clean(pick(fd, [/name of pattern/i, /mfr pattern/i, /^pattern/i])),
+ req_iso: reqISO,
+ days_overdue: daysSince(reqISO),
+ when_iso: reqISO,
+ when_label: 'requested',
+ created_at: reqISO,
+ });
+ }
+ // Oldest-overdue first within vendor grouping.
+ out.sort((a, b) => (b.days_overdue || 0) - (a.days_overdue || 0));
+ return out.slice(0, CAP);
+}
+
+// ====================================================================
+async function main() {
+ const t0 = Date.now();
+ console.log('[build-lists] FileMaker reads (read-only)…');
+ const [list1, list2, list3] = [await buildList1(), await buildList2(), await buildList3()];
+ const payload = {
+ generatedAt: new Date().toISOString(),
+ thresholds: { ratio_min: 0.9, lookback_sent_days: LOOKBACK_SENT_DAYS, invoice_since: INVOICE_SINCE, firm_order_min: FIRM_ORDER_MIN, overdue_days: OVERDUE_DAYS, cap: CAP },
+ counts: { list1: list1.length, list2: list2.length, list3: list3.length },
+ list1, list2, list3,
+ };
+ fs.writeFileSync(path.join(DATA_DIR, 'lists.json'), JSON.stringify(payload, null, 2));
+ console.log(`[build-lists] done in ${((Date.now() - t0) / 1000).toFixed(1)}s →`, payload.counts, '($0 — local FileMaker reads)');
+}
+
+main().catch((e) => { console.error('[build-lists] FATAL', e); process.exit(1); });
diff --git a/server.js b/server.js
new file mode 100644
index 0000000..df94aab
--- /dev/null
+++ b/server.js
@@ -0,0 +1,147 @@
+// dw-pitch-followup viewer — READ-ONLY.
+// GET / → the 3-tab pitch viewer (public/index.html)
+// GET /healthz → liveness
+// GET /api/lists → data/lists.json (the 3 built lists)
+// POST /api/letter → compose a concise follow-up letter for one row,
+// grounded in the client's last Gmail thread (George READ).
+// Returns { subject, body, context } — NEVER sends/drafts.
+//
+// No Gmail drafts, no sends. Steve SELECTS pitches in the viewer; selection is
+// local (localStorage) + an optional export. George is used read-only for context.
+
+import express from 'express';
+import fs from 'node:fs';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+const __dirname = path.dirname(fileURLToPath(import.meta.url));
+const PORT = Number(process.env.PORT || 9768);
+const DATA_DIR = path.join(__dirname, 'data');
+const LISTS = path.join(DATA_DIR, 'lists.json');
+const GEORGE = process.env.GEORGE_URL || 'http://127.0.0.1:9850';
+// Local George basic auth is admin:<empty> unless GEORGE_BASIC_AUTH_PASS is set.
+const GEORGE_AUTH = 'Basic ' + Buffer.from(`admin:${process.env.GEORGE_BASIC_AUTH_PASS || ''}`).toString('base64');
+
+const app = express();
+app.use(express.json({ limit: '512kb' }));
+
+// Basic auth (admin / DW2024!) — every route except /healthz.
+const BASIC_AUTH = process.env.BASIC_AUTH || 'admin:DW2024!';
+const AUTH_HEADER = 'Basic ' + Buffer.from(BASIC_AUTH).toString('base64');
+app.use((req, res, next) => {
+ if (req.path === '/healthz') return next();
+ if (req.get('authorization') === AUTH_HEADER) return next();
+ res.set('WWW-Authenticate', 'Basic realm="dw-pitch-followup"');
+ res.status(401).send('auth required');
+});
+app.get('/healthz', (_req, res) => res.json({ ok: true, ts: new Date().toISOString() }));
+
+app.use(express.static(path.join(__dirname, 'public')));
+app.get('/', (_req, res) => res.sendFile(path.join(__dirname, 'public', 'index.html')));
+
+app.get('/api/lists', (_req, res) => {
+ if (!fs.existsSync(LISTS)) return res.status(503).json({ error: 'lists not built yet — run npm run build' });
+ res.type('application/json').send(fs.readFileSync(LISTS, 'utf8'));
+});
+
+// --- George read-only context ---------------------------------------
+async function georgeContext(email) {
+ if (!email) return { found: false };
+ const q = encodeURIComponent(`from:${email} OR to:${email}`);
+ for (const account of ['info', 'steve-office']) {
+ try {
+ const r = await fetch(`${GEORGE}/api/search?q=${q}&account=${account}&maxResults=3`, {
+ headers: { Authorization: GEORGE_AUTH }, signal: AbortSignal.timeout(8000),
+ });
+ if (!r.ok) continue;
+ const j = await r.json();
+ const msgs = (j.messages || []).filter((m) => m.subject || m.snippet);
+ if (msgs.length) {
+ const m = msgs[0];
+ return { found: true, account, subject: m.subject || '', snippet: (m.snippet || '').slice(0, 240), date: m.date || '' };
+ }
+ } catch { /* try next account */ }
+ }
+ return { found: false };
+}
+
+// --- letter composition (deterministic, editable, $0 local) ----------
+function firstName(company) {
+ const t = String(company || '').trim().split(/[\s,]+/)[0] || 'there';
+ return /^account$/i.test(t) ? 'there' : t;
+}
+function composeLetter(list, row, ctx) {
+ const name = firstName(row.company);
+ const ref = ctx.found
+ ? `\n\nWhen we last connected${ctx.subject ? ` about "${ctx.subject}"` : ''}, I wanted to make sure nothing fell through the cracks.`
+ : '';
+ if (list === 'list3') {
+ // Vendor-facing chase note.
+ const vendor = row.vendor || 'team';
+ return {
+ subject: `Sample memo follow-up — ${row.sku || row.pattern || 'pending request'}`,
+ body:
+`Hi ${vendor},
+
+Following up on a sample memo we requested ${row.req_iso ? `on ${new Date(row.req_iso).toLocaleDateString()}` : 'recently'} — it's now ${row.days_overdue} days out and we haven't received it.
+
+ • Pattern: ${row.pattern || '—'}
+ • SKU: ${row.sku || '—'}
+ • For our client: ${row.company || `account ${row.account}`}
+
+Could you confirm whether this shipped, and if not, the expected ship date? Our client is waiting on it. Happy to resend the request if it didn't come through.
+
+Thank you,
+Designer Wallcoverings`,
+ };
+ }
+ if (list === 'list2') {
+ return {
+ subject: `Following up on your Designer Wallcoverings samples`,
+ body:
+`Hi ${name},
+
+I wanted to follow up on the samples we recently sent over${row.details && row.details[0] ? ` (${row.details[0].replace(/\s*-\s*Sample\s*$/i, '')})` : ''}. I hope they arrived safely and gave you a good feel for the material.${ref}
+
+Have you had a chance to review them? If you're ready to move forward I can confirm current stock and pricing, and if you'd like to see anything else — a different colorway, scale, or coordinating pattern — just say the word and I'll get options out to you.
+
+Always happy to help however is easiest for you.
+
+Warm regards,
+Designer Wallcoverings`,
+ };
+ }
+ // list1 — samples sent, near-complete
+ const pats = (row.patterns || []).slice(0, 4).join(', ');
+ return {
+ subject: `Following up on your wallpaper samples`,
+ body:
+`Hi ${name},
+
+Just checking in on the samples we sent your way${pats ? ` — ${pats}` : ''}. I hope you've had a chance to live with them and see how they read in your space.${ref}
+
+If any of them feel right, I'd love to help with the next step — I can confirm stock, pull current pricing, or send a few coordinating options to round out the look. And if none quite landed, tell me what's missing and I'll curate a fresh set.
+
+No rush at all — just here whenever you're ready.
+
+Warm regards,
+Designer Wallcoverings`,
+ };
+}
+
+app.post('/api/letter', async (req, res) => {
+ try {
+ const { list, row } = req.body || {};
+ if (!list || !row) return res.status(400).json({ error: 'list + row required' });
+ // Vendor chase (list3) doesn't have a client email to search.
+ const ctx = list === 'list3' ? { found: false } : await georgeContext(row.email);
+ const { subject, body } = composeLetter(list, row, ctx);
+ res.json({ subject, body, context: ctx, cost: '$0 (local + George read)' });
+ } catch (e) {
+ res.status(500).json({ error: e.message });
+ }
+});
+
+app.listen(PORT, '127.0.0.1', () => {
+ console.log(`[dw-pitch-followup] listening on http://127.0.0.1:${PORT} (auth ${BASIC_AUTH.split(':')[0]} / …)`);
+});
(oldest)
·
back to Dw Pitch Followup
·
auto-save: 2026-06-30T14:41:08 (1 files) — deploy/ 91a8b82 →