@burdenoff/microfe-ggnomad 2026.830.1 → 2026.1016.1

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.
Files changed (31) hide show
  1. package/dist/ggnomad/components/CreateProviderDialog.d.ts +22 -0
  2. package/dist/ggnomad/components/CreateProviderDialog.d.ts.map +1 -0
  3. package/dist/ggnomad/components/CreateProviderDialog.js +209 -0
  4. package/dist/ggnomad/components/CreateProviderDialog.js.map +1 -0
  5. package/dist/ggnomad/components/ProviderDashboardCard.d.ts +28 -0
  6. package/dist/ggnomad/components/ProviderDashboardCard.d.ts.map +1 -0
  7. package/dist/ggnomad/components/ProviderDashboardCard.js +222 -0
  8. package/dist/ggnomad/components/ProviderDashboardCard.js.map +1 -0
  9. package/dist/ggnomad/components/index.d.ts +2 -0
  10. package/dist/ggnomad/components/index.d.ts.map +1 -1
  11. package/dist/ggnomad/components/index.js +2 -0
  12. package/dist/ggnomad/graphql.d.ts +1 -0
  13. package/dist/ggnomad/graphql.d.ts.map +1 -1
  14. package/dist/ggnomad/graphql.js +65 -47
  15. package/dist/ggnomad/graphql.js.map +1 -1
  16. package/dist/ggnomad/pages/ProviderPage.d.ts.map +1 -1
  17. package/dist/ggnomad/pages/ProviderPage.js +249 -134
  18. package/dist/ggnomad/pages/ProviderPage.js.map +1 -1
  19. package/dist/ggnomad/utils/format.d.ts +18 -0
  20. package/dist/ggnomad/utils/format.d.ts.map +1 -1
  21. package/dist/ggnomad/utils/format.js +23 -7
  22. package/dist/ggnomad/utils/format.js.map +1 -1
  23. package/dist/ggnomad/utils/providerListControls.d.ts +53 -0
  24. package/dist/ggnomad/utils/providerListControls.d.ts.map +1 -0
  25. package/dist/ggnomad/utils/providerListControls.js +50 -0
  26. package/dist/ggnomad/utils/providerListControls.js.map +1 -0
  27. package/dist/ggnomad/utils/providerTypeMeta.d.ts +79 -0
  28. package/dist/ggnomad/utils/providerTypeMeta.d.ts.map +1 -0
  29. package/dist/ggnomad/utils/providerTypeMeta.js +81 -0
  30. package/dist/ggnomad/utils/providerTypeMeta.js.map +1 -0
  31. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"format.js","names":[],"sources":["../../../src/ggnomad/utils/format.ts"],"sourcesContent":["/**\n * Presentation helpers shared across GGNomad pages.\n *\n * Several GGNomad fields are `JSON!` on the service schema (`GgnomadProperty.address`,\n * `GgnomadTour.location`, `GgnomadEvent.venue`, `GgnomadTrip.origin`/`destination`,\n * `GgnomadTrip.stops`, `GgnomadAnalytics.monthlyTrends`/`topDestinations`) with no\n * enforced shape — the reference transport provider writes `{ name, code }`, listing\n * mutations pass whatever the caller supplied, and an unset column is `{}`. These\n * helpers therefore read defensively: anything they cannot resolve to a real scalar is\n * dropped rather than guessed, so a page never presents an invented value as fact.\n */\n\n/** `PENDING_REVIEW` / `step_free_entrance` → `Pending review` / `Step free entrance`. */\nexport function humanizeEnum(value: string): string {\n const spaced = value.replace(/[_-]+/g, ' ').trim().toLowerCase();\n if (!spaced) return value;\n return spaced.charAt(0).toUpperCase() + spaced.slice(1);\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/** Scalar entries of a JSON object, in declaration order, with empty values dropped. */\nexport function jsonFacts(value: unknown): Array<{ key: string; label: string; value: string }> {\n if (!isPlainObject(value)) return [];\n const facts: Array<{ key: string; label: string; value: string }> = [];\n for (const [key, raw] of Object.entries(value)) {\n if (typeof raw === 'string') {\n const trimmed = raw.trim();\n if (trimmed) facts.push({ key, label: humanizeEnum(key), value: trimmed });\n } else if (typeof raw === 'number' && Number.isFinite(raw)) {\n facts.push({ key, label: humanizeEnum(key), value: String(raw) });\n } else if (typeof raw === 'boolean') {\n facts.push({ key, label: humanizeEnum(key), value: raw ? 'Yes' : 'No' });\n }\n }\n return facts;\n}\n\nconst LABEL_KEYS = ['name', 'label', 'city', 'title', 'address', 'code'];\n\n/**\n * A single human label for a JSON location-ish value: the first recognised naming key,\n * else the first scalar entry, else null (never a stringified object).\n */\nexport function jsonLabel(value: unknown): string | null {\n if (typeof value === 'string') return value.trim() || null;\n const facts = jsonFacts(value);\n if (facts.length === 0) return null;\n for (const key of LABEL_KEYS) {\n const match = facts.find((fact) => fact.key.toLowerCase() === key);\n if (match) return match.value;\n }\n return facts[0].value;\n}\n\n/** Number of entries in a JSON array field (e.g. `GgnomadTrip.stops`), or null. */\nexport function jsonArrayLength(value: unknown): number | null {\n return Array.isArray(value) ? value.length : null;\n}\n\nexport function formatMoney(amount: number, currency: string): string {\n return `${currency} ${Number(amount).toFixed(2)}`;\n}\n\nexport function formatDate(value?: string | null): string | null {\n if (!value) return null;\n const date = new Date(value);\n if (Number.isNaN(date.getTime())) return null;\n return date.toLocaleDateString(undefined, { day: 'numeric', month: 'short', year: 'numeric' });\n}\n\nexport function formatDateTime(value?: string | null): string | null {\n if (!value) return null;\n const date = new Date(value);\n if (Number.isNaN(date.getTime())) return null;\n return date.toLocaleString(undefined, {\n day: 'numeric',\n month: 'short',\n year: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n });\n}\n\nexport function formatTimeOnly(value?: string | null): string | null {\n if (!value) return null;\n const date = new Date(value);\n if (Number.isNaN(date.getTime())) return null;\n return date.toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit' });\n}\n\n/** `95` → `1h 35m`. */\nexport function formatDurationMinutes(minutes: number): string {\n const safe = Math.max(0, Math.round(minutes));\n const hours = Math.floor(safe / 60);\n const rest = safe % 60;\n if (hours === 0) return `${rest}m`;\n if (rest === 0) return `${hours}h`;\n return `${hours}h ${rest}m`;\n}\n\n/** Whole nights between two `<input type=\"date\">` values; 0 when unusable. */\nexport function nightsBetween(checkIn: string, checkOut: string): number {\n if (!checkIn || !checkOut) return 0;\n const from = new Date(checkIn).getTime();\n const to = new Date(checkOut).getTime();\n if (Number.isNaN(from) || Number.isNaN(to) || to <= from) return 0;\n return Math.round((to - from) / 86_400_000);\n}\n\n/**\n * Reads a `label → count` series out of an unshaped JSON field such as\n * `GgnomadAnalytics.topDestinations`, which the service passes straight through from\n * the latest analytics snapshot. Accepts either an array of objects (a string-valued\n * key is the label, the first numeric key is the count) or a flat `{ label: count }`\n * map. Entries that yield neither a label nor a finite number are dropped, so a\n * snapshot written in an unexpected shape renders as \"no data\" rather than as noise.\n */\nexport function parseNamedCounts(value: unknown): Array<{ label: string; value: number }> {\n const out: Array<{ label: string; value: number }> = [];\n\n if (Array.isArray(value)) {\n for (const entry of value) {\n if (!isPlainObject(entry)) continue;\n let label: string | null = null;\n let count: number | null = null;\n for (const key of LABEL_KEYS) {\n const candidate = entry[key];\n if (typeof candidate === 'string' && candidate.trim()) {\n label = candidate.trim();\n break;\n }\n }\n if (label === null) {\n const firstString = Object.values(entry).find(\n (item): item is string => typeof item === 'string' && item.trim().length > 0\n );\n label = firstString?.trim() ?? null;\n }\n for (const item of Object.values(entry)) {\n if (typeof item === 'number' && Number.isFinite(item)) {\n count = item;\n break;\n }\n }\n if (label !== null && count !== null) out.push({ label, value: count });\n }\n return out;\n }\n\n if (isPlainObject(value)) {\n for (const [key, item] of Object.entries(value)) {\n if (typeof item === 'number' && Number.isFinite(item)) {\n out.push({ label: humanizeEnum(key), value: item });\n }\n }\n }\n\n return out;\n}\n"],"mappings":";AAaA,SAAgB,EAAa,GAAuB;CAClD,IAAM,IAAS,EAAM,QAAQ,UAAU,GAAG,EAAE,KAAK,EAAE,YAAY;CAE/D,OADK,IACE,EAAO,OAAO,CAAC,EAAE,YAAY,IAAI,EAAO,MAAM,CAAC,IADlC;AAEtB;AAEA,SAAS,EAAc,GAAkD;CACvE,OAAO,OAAO,KAAU,cAAY,KAAkB,CAAC,MAAM,QAAQ,CAAK;AAC5E;AAGA,SAAgB,EAAU,GAAsE;CAC9F,IAAI,CAAC,EAAc,CAAK,GAAG,OAAO,CAAC;CACnC,IAAM,IAA8D,CAAC;CACrE,KAAK,IAAM,CAAC,GAAK,MAAQ,OAAO,QAAQ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;IACxB,IAAI,OAAO,KAAc,YAAY,EAAU,KAAK,GAAG;KACrD,IAAQ,EAAU,KAAK;KACvB;IACF;GACF;GACA,AAAI,MAAU,SAIZ,IAHoB,OAAO,OAAO,CAAK,EAAE,MACtC,MAAyB,OAAO,KAAS,YAAY,EAAK,KAAK,EAAE,SAAS,CAErE,GAAa,KAAK,KAAK;GAEjC,KAAK,IAAM,KAAQ,OAAO,OAAO,CAAK,GACpC,IAAI,OAAO,KAAS,YAAY,OAAO,SAAS,CAAI,GAAG;IACrD,IAAQ;IACR;GACF;GAEF,AAAI,MAAU,QAAQ,MAAU,QAAM,EAAI,KAAK;IAAE;IAAO,OAAO;GAAM,CAAC;EACxE;EACA,OAAO;CACT;CAEA,IAAI,EAAc,CAAK,QAChB,IAAM,CAAC,GAAK,MAAS,OAAO,QAAQ,CAAK,GAC5C,AAAI,OAAO,KAAS,YAAY,OAAO,SAAS,CAAI,KAClD,EAAI,KAAK;EAAE,OAAO,EAAa,CAAG;EAAG,OAAO;CAAK,CAAC;CAKxD,OAAO;AACT"}
1
+ {"version":3,"file":"format.js","names":[],"sources":["../../../src/ggnomad/utils/format.ts"],"sourcesContent":["/**\n * Presentation helpers shared across GGNomad pages.\n *\n * Several GGNomad fields are `JSON!` on the service schema (`GgnomadProperty.address`,\n * `GgnomadTour.location`, `GgnomadEvent.venue`, `GgnomadTrip.origin`/`destination`,\n * `GgnomadTrip.stops`, `GgnomadAnalytics.monthlyTrends`/`topDestinations`) with no\n * enforced shape — the reference transport provider writes `{ name, code }`, listing\n * mutations pass whatever the caller supplied, and an unset column is `{}`. These\n * helpers therefore read defensively: anything they cannot resolve to a real scalar is\n * dropped rather than guessed, so a page never presents an invented value as fact.\n */\n\n/** `PENDING_REVIEW` / `step_free_entrance` → `Pending review` / `Step free entrance`. */\nexport function humanizeEnum(value: string): string {\n const spaced = value.replace(/[_-]+/g, ' ').trim().toLowerCase();\n if (!spaced) return value;\n return spaced.charAt(0).toUpperCase() + spaced.slice(1);\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/** Scalar entries of a JSON object, in declaration order, with empty values dropped. */\nexport function jsonFacts(value: unknown): Array<{ key: string; label: string; value: string }> {\n if (!isPlainObject(value)) return [];\n const facts: Array<{ key: string; label: string; value: string }> = [];\n for (const [key, raw] of Object.entries(value)) {\n if (typeof raw === 'string') {\n const trimmed = raw.trim();\n if (trimmed) facts.push({ key, label: humanizeEnum(key), value: trimmed });\n } else if (typeof raw === 'number' && Number.isFinite(raw)) {\n facts.push({ key, label: humanizeEnum(key), value: String(raw) });\n } else if (typeof raw === 'boolean') {\n facts.push({ key, label: humanizeEnum(key), value: raw ? 'Yes' : 'No' });\n }\n }\n return facts;\n}\n\nconst LABEL_KEYS = ['name', 'label', 'city', 'title', 'address', 'code'];\n\n/**\n * A single human label for a JSON location-ish value: the first recognised naming key,\n * else the first scalar entry, else null (never a stringified object).\n */\nexport function jsonLabel(value: unknown): string | null {\n if (typeof value === 'string') return value.trim() || null;\n const facts = jsonFacts(value);\n if (facts.length === 0) return null;\n for (const key of LABEL_KEYS) {\n const match = facts.find((fact) => fact.key.toLowerCase() === key);\n if (match) return match.value;\n }\n return facts[0].value;\n}\n\n/** Number of entries in a JSON array field (e.g. `GgnomadTrip.stops`), or null. */\nexport function jsonArrayLength(value: unknown): number | null {\n return Array.isArray(value) ? value.length : null;\n}\n\nexport function formatMoney(amount: number, currency: string): string {\n return `${currency} ${Number(amount).toFixed(2)}`;\n}\n\n/**\n * Currency-formatted number with compact notation at >=10,000. Used by\n * the Provider Dashboard card so large revenues don't break the stats\n * row. The full unformatted amount is returned in a `title` attribute\n * via the second tuple element when callers need the exact value.\n *\n * `GgnomadProvider` does not currently expose a `currency` field in the\n * GraphQL schema, so callers pass `'USD'` as the default until the\n * backend adds the field. Keeping the parameter preserves the call site\n * for when it does.\n *\n * Returns `{ display, exact }` so the card can render `$98.5K` and\n * keep the full `$98,450` in the tooltip.\n */\nexport function formatRevenue(\n amount: number,\n currency = 'USD'\n): { display: string; exact: string } {\n const safe = Number.isFinite(amount) ? amount : 0;\n const useCompact = Math.abs(safe) >= 10_000;\n const formatter = new Intl.NumberFormat('en-US', {\n style: 'currency',\n currency,\n notation: useCompact ? 'compact' : 'standard',\n maximumFractionDigits: useCompact ? 1 : 0,\n });\n const exact = new Intl.NumberFormat('en-US', {\n style: 'currency',\n currency,\n maximumFractionDigits: 0,\n }).format(safe);\n return { display: formatter.format(safe), exact };\n}\n\nexport function formatDate(value?: string | null): string | null {\n if (!value) return null;\n const date = new Date(value);\n if (Number.isNaN(date.getTime())) return null;\n return date.toLocaleDateString(undefined, { day: 'numeric', month: 'short', year: 'numeric' });\n}\n\nexport function formatDateTime(value?: string | null): string | null {\n if (!value) return null;\n const date = new Date(value);\n if (Number.isNaN(date.getTime())) return null;\n return date.toLocaleString(undefined, {\n day: 'numeric',\n month: 'short',\n year: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n });\n}\n\nexport function formatTimeOnly(value?: string | null): string | null {\n if (!value) return null;\n const date = new Date(value);\n if (Number.isNaN(date.getTime())) return null;\n return date.toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit' });\n}\n\n/** `95` → `1h 35m`. */\nexport function formatDurationMinutes(minutes: number): string {\n const safe = Math.max(0, Math.round(minutes));\n const hours = Math.floor(safe / 60);\n const rest = safe % 60;\n if (hours === 0) return `${rest}m`;\n if (rest === 0) return `${hours}h`;\n return `${hours}h ${rest}m`;\n}\n\n/** Whole nights between two `<input type=\"date\">` values; 0 when unusable. */\nexport function nightsBetween(checkIn: string, checkOut: string): number {\n if (!checkIn || !checkOut) return 0;\n const from = new Date(checkIn).getTime();\n const to = new Date(checkOut).getTime();\n if (Number.isNaN(from) || Number.isNaN(to) || to <= from) return 0;\n return Math.round((to - from) / 86_400_000);\n}\n\n/**\n * Reads a `label → count` series out of an unshaped JSON field such as\n * `GgnomadAnalytics.topDestinations`, which the service passes straight through from\n * the latest analytics snapshot. Accepts either an array of objects (a string-valued\n * key is the label, the first numeric key is the count) or a flat `{ label: count }`\n * map. Entries that yield neither a label nor a finite number are dropped, so a\n * snapshot written in an unexpected shape renders as \"no data\" rather than as noise.\n */\nexport function parseNamedCounts(value: unknown): Array<{ label: string; value: number }> {\n const out: Array<{ label: string; value: number }> = [];\n\n if (Array.isArray(value)) {\n for (const entry of value) {\n if (!isPlainObject(entry)) continue;\n let label: string | null = null;\n let count: number | null = null;\n for (const key of LABEL_KEYS) {\n const candidate = entry[key];\n if (typeof candidate === 'string' && candidate.trim()) {\n label = candidate.trim();\n break;\n }\n }\n if (label === null) {\n const firstString = Object.values(entry).find(\n (item): item is string => typeof item === 'string' && item.trim().length > 0\n );\n label = firstString?.trim() ?? null;\n }\n for (const item of Object.values(entry)) {\n if (typeof item === 'number' && Number.isFinite(item)) {\n count = item;\n break;\n }\n }\n if (label !== null && count !== null) out.push({ label, value: count });\n }\n return out;\n }\n\n if (isPlainObject(value)) {\n for (const [key, item] of Object.entries(value)) {\n if (typeof item === 'number' && Number.isFinite(item)) {\n out.push({ label: humanizeEnum(key), value: item });\n }\n }\n }\n\n return out;\n}\n"],"mappings":";AAaA,SAAgB,EAAa,GAAuB;CAClD,IAAM,IAAS,EAAM,QAAQ,UAAU,GAAG,EAAE,KAAK,EAAE,YAAY;CAE/D,OADK,IACE,EAAO,OAAO,CAAC,EAAE,YAAY,IAAI,EAAO,MAAM,CAAC,IADlC;AAEtB;AAEA,SAAS,EAAc,GAAkD;CACvE,OAAO,OAAO,KAAU,cAAY,KAAkB,CAAC,MAAM,QAAQ,CAAK;AAC5E;AAGA,SAAgB,EAAU,GAAsE;CAC9F,IAAI,CAAC,EAAc,CAAK,GAAG,OAAO,CAAC;CACnC,IAAM,IAA8D,CAAC;CACrE,KAAK,IAAM,CAAC,GAAK,MAAQ,OAAO,QAAQ,CAAK,GAC3C,IAAI,OAAO,KAAQ,UAAU;EAC3B,IAAM,IAAU,EAAI,KA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AAE,KAAK,KAAM,IAAa,IAC1D,KAAK,OAAO,IAAK,KAAQ,KAAU;AAC5C;AAUA,SAAgB,EAAiB,GAAyD;CACxF,IAAM,IAA+C,CAAC;CAEtD,IAAI,MAAM,QAAQ,CAAK,GAAG;EACxB,KAAK,IAAM,KAAS,GAAO;GACzB,IAAI,CAAC,EAAc,CAAK,GAAG;GAC3B,IAAI,IAAuB,MACvB,IAAuB;GAC3B,KAAK,IAAM,KAAO,GAAY;IAC5B,IAAM,IAAY,EAAM;IACxB,IAAI,OAAO,KAAc,YAAY,EAAU,KAAK,GAAG;KACrD,IAAQ,EAAU,KAAK;KACvB;IACF;GACF;GACA,AAAI,MAAU,SAIZ,IAHoB,OAAO,OAAO,CAAK,EAAE,MACtC,MAAyB,OAAO,KAAS,YAAY,EAAK,KAAK,EAAE,SAAS,CAErE,GAAa,KAAK,KAAK;GAEjC,KAAK,IAAM,KAAQ,OAAO,OAAO,CAAK,GACpC,IAAI,OAAO,KAAS,YAAY,OAAO,SAAS,CAAI,GAAG;IACrD,IAAQ;IACR;GACF;GAEF,AAAI,MAAU,QAAQ,MAAU,QAAM,EAAI,KAAK;IAAE;IAAO,OAAO;GAAM,CAAC;EACxE;EACA,OAAO;CACT;CAEA,IAAI,EAAc,CAAK,QAChB,IAAM,CAAC,GAAK,MAAS,OAAO,QAAQ,CAAK,GAC5C,AAAI,OAAO,KAAS,YAAY,OAAO,SAAS,CAAI,KAClD,EAAI,KAAK;EAAE,OAAO,EAAa,CAAG;EAAG,OAAO;CAAK,CAAC;CAKxD,OAAO;AACT"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Pure filter / sort / paging logic for the Provider Dashboard toolbar
3
+ * (BOFF-8177 follow-up). Kept out of the component so the behavior is
4
+ * trivially exercisable and the page stays presentational. No React
5
+ * imports here.
6
+ *
7
+ * The backend `ggnomadProviders` query exposes offset paging only — no
8
+ * filter args and no totalCount — and caps one request at MAX_LIMIT=100
9
+ * rows. Callers therefore fetch EVERY page up front and run the toolbar
10
+ * controls over the full loaded list here. That is correct for a fleet
11
+ * of hundreds; past ~a thousand providers the backend should grow filter
12
+ * args + totalCount and this logic moves server-side.
13
+ */
14
+ /** Number of provider cards shown before "Load more" offers the next batch. */
15
+ export declare const PROVIDER_PAGE_SIZE = 12;
16
+ export type ProviderSort = 'newest' | 'oldest' | 'nameAsc' | 'nameDesc' | 'revenueDesc';
17
+ /** The minimum shape the controls need from a provider row. */
18
+ export interface ProviderListItem {
19
+ id: string;
20
+ name: string;
21
+ type: string;
22
+ status: string;
23
+ totalRevenue: number;
24
+ createdAt: string;
25
+ }
26
+ export interface ProviderListQuery {
27
+ /** Case-insensitive substring matched anywhere in the provider name. */
28
+ search: string;
29
+ /** Provider type enum value; null = all types. */
30
+ type: string | null;
31
+ sort: ProviderSort;
32
+ }
33
+ /** Toolbar rest state — also what "Clear filters" returns to. */
34
+ export declare const DEFAULT_PROVIDER_QUERY: ProviderListQuery;
35
+ export interface ProviderControlsResult<T> {
36
+ /** Filtered + sorted slice, cut to `visibleCount`. */
37
+ shown: T[];
38
+ /** Rows matching the current filters (before the visible-count cut). */
39
+ total: number;
40
+ /** True when search/type/status differ from their defaults. */
41
+ isFiltered: boolean;
42
+ /** True when matching rows exist beyond what `shown` contains. */
43
+ hasMore: boolean;
44
+ }
45
+ /** A query counts as "filtered" when search/type are non-default; sort never does. */
46
+ export declare function isProviderQueryFiltered(query: ProviderListQuery): boolean;
47
+ /**
48
+ * Apply the toolbar search/type/status filters and sort, then cut the
49
+ * result to the visible page. `items` MUST be the complete loaded list —
50
+ * callers page through every backend batch first (see the module note).
51
+ */
52
+ export declare function applyProviderControls<T extends ProviderListItem>(items: readonly T[], query: ProviderListQuery, visibleCount: number): ProviderControlsResult<T>;
53
+ //# sourceMappingURL=providerListControls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"providerListControls.d.ts","sourceRoot":"","sources":["../../../src/ggnomad/utils/providerListControls.ts"],"names":[],"mappings":"AAAA;;;;;;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
+ return e.search.trim() !== "" || e.type !== null;
9
+ }
10
+ function n(e) {
11
+ let t = Date.parse(e);
12
+ return Number.isFinite(t) ? t : 0;
13
+ }
14
+ function r(e) {
15
+ return Number.isFinite(e) ? e : 0;
16
+ }
17
+ function i(e, t) {
18
+ let i = [...e];
19
+ switch (t) {
20
+ case "oldest":
21
+ i.sort((e, t) => n(e.createdAt) - n(t.createdAt));
22
+ break;
23
+ case "nameAsc":
24
+ i.sort((e, t) => e.name.localeCompare(t.name));
25
+ break;
26
+ case "nameDesc":
27
+ i.sort((e, t) => t.name.localeCompare(e.name));
28
+ break;
29
+ case "revenueDesc":
30
+ i.sort((e, t) => r(t.totalRevenue) - r(e.totalRevenue));
31
+ break;
32
+ default:
33
+ i.sort((e, t) => n(t.createdAt) - n(e.createdAt));
34
+ break;
35
+ }
36
+ return i;
37
+ }
38
+ function a(e, n, r) {
39
+ let a = n.search.trim().toLowerCase(), o = i(e.filter((e) => !(a && !e.name.toLowerCase().includes(a) || n.type !== null && e.type !== n.type)), n.sort), s = Math.max(1, Math.floor(r));
40
+ return {
41
+ shown: o.slice(0, s),
42
+ total: o.length,
43
+ isFiltered: t(n),
44
+ hasMore: o.length > s
45
+ };
46
+ }
47
+ //#endregion
48
+ export { e as DEFAULT_PROVIDER_QUERY, a as applyProviderControls };
49
+
50
+ //# sourceMappingURL=providerListControls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"providerListControls.js","names":[],"sources":["../../../src/ggnomad/utils/providerListControls.ts"],"sourcesContent":["/**\n * Pure filter / sort / paging logic for the Provider Dashboard toolbar\n * (BOFF-8177 follow-up). Kept out of the component so the behavior is\n * trivially exercisable and the page stays presentational. No React\n * imports here.\n *\n * The backend `ggnomadProviders` query exposes offset paging only — no\n * filter args and no totalCount — and caps one request at MAX_LIMIT=100\n * rows. Callers therefore fetch EVERY page up front and run the toolbar\n * controls over the full loaded list here. That is correct for a fleet\n * of hundreds; past ~a thousand providers the backend should grow filter\n * args + totalCount and this logic moves server-side.\n */\n\n/** Number of provider cards shown before \"Load more\" offers the next batch. */\nexport const PROVIDER_PAGE_SIZE = 12;\n\nexport type ProviderSort = 'newest' | 'oldest' | 'nameAsc' | 'nameDesc' | 'revenueDesc';\n\n/** The minimum shape the controls need from a provider row. */\nexport interface ProviderListItem {\n id: string;\n name: string;\n type: string;\n status: string;\n totalRevenue: number;\n createdAt: string;\n}\n\nexport interface ProviderListQuery {\n /** Case-insensitive substring matched anywhere in the provider name. */\n search: string;\n /** Provider type enum value; null = all types. */\n type: string | null;\n sort: ProviderSort;\n}\n\n/** Toolbar rest state — also what \"Clear filters\" returns to. */\nexport const DEFAULT_PROVIDER_QUERY: ProviderListQuery = {\n search: '',\n type: null,\n sort: 'newest',\n};\n\nexport interface ProviderControlsResult<T> {\n /** Filtered + sorted slice, cut to `visibleCount`. */\n shown: T[];\n /** Rows matching the current filters (before the visible-count cut). */\n total: number;\n /** True when search/type/status differ from their defaults. */\n isFiltered: boolean;\n /** True when matching rows exist beyond what `shown` contains. */\n hasMore: boolean;\n}\n\n/** A query counts as \"filtered\" when search/type are non-default; sort never does. */\nexport function isProviderQueryFiltered(query: ProviderListQuery): boolean {\n return query.search.trim() !== '' || query.type !== null;\n}\n\nfunction timestamp(value: string): number {\n const parsed = Date.parse(value);\n return Number.isFinite(parsed) ? parsed : 0;\n}\n\nfunction revenue(value: number): number {\n return Number.isFinite(value) ? value : 0;\n}\n\nfunction sortItems<T extends ProviderListItem>(items: readonly T[], sort: ProviderSort): T[] {\n const copy = [...items];\n switch (sort) {\n case 'oldest':\n copy.sort((a, b) => timestamp(a.createdAt) - timestamp(b.createdAt));\n break;\n case 'nameAsc':\n copy.sort((a, b) => a.name.localeCompare(b.name));\n break;\n case 'nameDesc':\n copy.sort((a, b) => b.name.localeCompare(a.name));\n break;\n case 'revenueDesc':\n copy.sort((a, b) => revenue(b.totalRevenue) - revenue(a.totalRevenue));\n break;\n case 'newest':\n default:\n // Mirrors the backend's orderBy: { createdAt: 'desc' } default.\n copy.sort((a, b) => timestamp(b.createdAt) - timestamp(a.createdAt));\n break;\n }\n return copy;\n}\n\n/**\n * Apply the toolbar search/type/status filters and sort, then cut the\n * result to the visible page. `items` MUST be the complete loaded list —\n * callers page through every backend batch first (see the module note).\n */\nexport function applyProviderControls<T extends ProviderListItem>(\n items: readonly T[],\n query: ProviderListQuery,\n visibleCount: number\n): ProviderControlsResult<T> {\n const needle = query.search.trim().toLowerCase();\n const filtered = items.filter((item) => {\n if (needle && !item.name.toLowerCase().includes(needle)) return false;\n if (query.type !== null && item.type !== query.type) return false;\n return true;\n });\n\n const sorted = sortItems(filtered, query.sort);\n const cap = Math.max(1, Math.floor(visibleCount));\n return {\n shown: sorted.slice(0, cap),\n total: sorted.length,\n isFiltered: isProviderQueryFiltered(query),\n hasMore: sorted.length > cap,\n };\n}\n"],"mappings":";AAsCA,IAAa,IAA4C;CACvD,QAAQ;CACR,MAAM;CACN,MAAM;AACR;AAcA,SAAgB,EAAwB,GAAmC;CACzE,OAAO,EAAM,OAAO,KAAK,MAAM,MAAM,EAAM,SAAS;AACtD;AAEA,SAAS,EAAU,GAAuB;CACxC,IAAM,IAAS,KAAK,MAAM,CAAK;CAC/B,OAAO,OAAO,SAAS,CAAM,IAAI,IAAS;AAC5C;AAEA,SAAS,EAAQ,GAAuB;CACtC,OAAO,OAAO,SAAS,CAAK,IAAI,IAAQ;AAC1C;AAEA,SAAS,EAAsC,GAAqB,GAAyB;CAC3F,IAAM,IAAO,CAAC,GAAG,CAAK;CACtB,QAAQ,GAAR;EACE,KAAK;GACH,EAAK,MAAM,GAAG,MAAM,EAAU,EAAE,SAAS,IAAI,EAAU,EAAE,SAAS,CAAC;GACnE;EACF,KAAK;GACH,EAAK,MAAM,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,IAAI,CAAC;GAChD;EACF,KAAK;GACH,EAAK,MAAM,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,IAAI,CAAC;GAChD;EACF,KAAK;GACH,EAAK,MAAM,GAAG,MAAM,EAAQ,EAAE,YAAY,IAAI,EAAQ,EAAE,YAAY,CAAC;GACrE;EAEF;GAEE,EAAK,MAAM,GAAG,MAAM,EAAU,EAAE,SAAS,IAAI,EAAU,EAAE,SAAS,CAAC;GACnE;CACJ;CACA,OAAO;AACT;AAOA,SAAgB,EACd,GACA,GACA,GAC2B;CAC3B,IAAM,IAAS,EAAM,OAAO,KAAK,EAAE,YAAY,GAOzC,IAAS,EANE,EAAM,QAAQ,MAE7B,EADI,KAAU,CAAC,EAAK,KAAK,YAAY,EAAE,SAAS,CAAM,KAClD,EAAM,SAAS,QAAQ,EAAK,SAAS,EAAM,KAIxB,GAAU,EAAM,IAAI,GACvC,IAAM,KAAK,IAAI,GAAG,KAAK,MAAM,CAAY,CAAC;CAChD,OAAO;EACL,OAAO,EAAO,MAAM,GAAG,CAAG;EAC1B,OAAO,EAAO;EACd,YAAY,EAAwB,CAAK;EACzC,SAAS,EAAO,SAAS;CAC3B;AACF"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Shared metadata for the GgnomadProviderType enum + provider visual
3
+ * helpers.
4
+ *
5
+ * The single source of truth for the translation key + English fallback
6
+ * for each provider type label, reused by both ProviderDashboardCard.tsx
7
+ * (rendering) and CreateProviderDialog.tsx (form dropdown) so the wording
8
+ * cannot drift between the two surfaces.
9
+ *
10
+ * If the backend ever adds a new value to GgnomadProviderType, add a
11
+ * row here — anything unlisted falls back to a sentence-cased version of
12
+ * the enum ("HOTEL_OPERATOR" -> "Hotel operator").
13
+ *
14
+ * Type-specific icons were intentionally removed: a single type
15
+ * ("Transport provider") can cover buses, taxis, ferries and airlines,
16
+ * so one icon per type is wrong. The card's banner is tinted by type
17
+ * instead (see bannerTintFor) so the tint works as a type indicator.
18
+ */
19
+ /**
20
+ * Local enum declaration. The published supergraph on Hive CDN still
21
+ * declares `GgnomadProvider.type` as `String`, so the codegen-derived
22
+ * types in src/generated/wspace-types.ts don't carry this enum yet. The
23
+ * backend change (BOFF-8207) adds the enum to ggnomad.gql; once it ships
24
+ * to alpha, the next codegen run will export this enum from
25
+ * wspace-types and the local fallback below becomes a no-op. Keep the
26
+ * two declarations in sync.
27
+ */
28
+ export type GgnomadProviderType = 'HOTEL_OPERATOR' | 'TOUR_OPERATOR' | 'ACTIVITY_PROVIDER' | 'TRANSPORT_PROVIDER' | 'EVENT_ORGANIZER';
29
+ /**
30
+ * Build the dropdown options. `translate` should be the `t` from `useI18n()` in
31
+ * the calling component so each label resolves in the active locale; the
32
+ * fallback string is used otherwise (or when the translator is omitted).
33
+ */
34
+ export declare function getProviderTypeOptions(translate?: (key: string, fallback: string) => string): Array<{
35
+ value: GgnomadProviderType;
36
+ label: string;
37
+ }>;
38
+ /** Human-facing label for a provider type, with a safe fallback. */
39
+ export declare function labelForProviderType(type: string, translate?: (key: string, fallback: string) => string): string;
40
+ /**
41
+ * Two-letter initials for the avatar fallback.
42
+ *
43
+ * - "Indigo" -> "IN" (first two letters of the single word)
44
+ * - "Blue Sky" -> "BS" (first letter of each of the first two words)
45
+ * - "A" -> "A" (single character preserved as-is)
46
+ * - "" -> "??" (sentinel for empty names)
47
+ */
48
+ export declare function initialsFor(name: string): string;
49
+ /** "alpine" -> "Alpine", "SUSPENDED" -> "Suspended". Lowercases the input
50
+ * first so the function normalizes backend enum values (which arrive
51
+ * in UPPER_SNAKE_CASE) to a sentence-case display label. */
52
+ export declare function sentenceCase(value: string): string;
53
+ export declare function titleCase(value: string): string;
54
+ /**
55
+ * Banner tint as a CSS `style` object. The banner band uses the hue
56
+ * at 16% alpha over the card surface so the band reads as colored in
57
+ * both light and dark mode; the avatar initials use
58
+ * `var(--color-text-primary)` so contrast holds against the card
59
+ * surface in both themes. (Previously the per-type hue was used
60
+ * directly for the initials, which was too low-contrast for some
61
+ * chart-N slots in light mode.)
62
+ *
63
+ * Structurally compatible with React.CSSProperties — we don't import
64
+ * React here to keep this util free of UI dependencies.
65
+ *
66
+ * Implementation note: colors are applied via inline `style` (not
67
+ * Tailwind classes) because the host shell's Tailwind v4 build does
68
+ * not emit utility classes for the theme's custom palette
69
+ * (`bg-chart-N`, `bg-accent-*`, ...). The tokens resolve against the
70
+ * active theme so contrast holds in light and dark mode without us
71
+ * hard-coding hex values per theme.
72
+ */
73
+ export interface BannerTintStyle {
74
+ backgroundColor: string;
75
+ color: string;
76
+ }
77
+ /** Banner tint for a provider type; unknown types get neutral slate. */
78
+ export declare function bannerTintFor(type: string): BannerTintStyle;
79
+ //# sourceMappingURL=providerTypeMeta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"providerTypeMeta.d.ts","sourceRoot":"","sources":["../../../src/ggnomad/utils/providerTypeMeta.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;GAQG;AACH,MAAM,MAAM,mBAAmB,GAC3B,gBAAgB,GAChB,eAAe,GACf,mBAAmB,GACnB,oBAAoB,GACpB,iBAAiB,CAAC;AA+BtB;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,MAAM,GACpD,KAAK,CAAC;IACP,KAAK,EAAE,mBAAmB,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC,CAKD;AAED,oEAAoE;AACpE,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,MAAM,GACpD,MAAM,CAMR;AASD;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAYhD;AAED;;6DAE6D;AAC7D,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKlD;AA2BD,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAiB/C;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,eAAe;IAC9B,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf;AAsCD,wEAAwE;AACxE,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAK3D"}
@@ -0,0 +1,81 @@
1
+ //#region src/ggnomad/utils/providerTypeMeta.ts
2
+ var e = {
3
+ HOTEL_OPERATOR: {
4
+ key: "ggnomad.provider.type.hotelOperator",
5
+ fallback: "Hotel operator"
6
+ },
7
+ TOUR_OPERATOR: {
8
+ key: "ggnomad.provider.type.tourOperator",
9
+ fallback: "Tour operator"
10
+ },
11
+ ACTIVITY_PROVIDER: {
12
+ key: "ggnomad.provider.type.activityProvider",
13
+ fallback: "Activity provider"
14
+ },
15
+ TRANSPORT_PROVIDER: {
16
+ key: "ggnomad.provider.type.transportProvider",
17
+ fallback: "Transport provider"
18
+ },
19
+ EVENT_ORGANIZER: {
20
+ key: "ggnomad.provider.type.eventOrganizer",
21
+ fallback: "Event organizer"
22
+ }
23
+ }, t = [
24
+ "HOTEL_OPERATOR",
25
+ "TOUR_OPERATOR",
26
+ "ACTIVITY_PROVIDER",
27
+ "TRANSPORT_PROVIDER",
28
+ "EVENT_ORGANIZER"
29
+ ];
30
+ function n(n) {
31
+ return t.map((t) => {
32
+ let { key: r, fallback: i } = e[t];
33
+ return {
34
+ value: t,
35
+ label: n ? n(r, i) : i
36
+ };
37
+ });
38
+ }
39
+ function r(t, n) {
40
+ if (t in e) {
41
+ let { key: r, fallback: i } = e[t];
42
+ return n ? n(r, i) : i;
43
+ }
44
+ return i(t);
45
+ }
46
+ function i(e) {
47
+ let t = e.replace(/_+/g, " ").trim().toLowerCase();
48
+ return t ? t.charAt(0).toUpperCase() + t.slice(1) : e;
49
+ }
50
+ function a(e) {
51
+ let t = e.trim();
52
+ if (!t) return "??";
53
+ let n = t.split(/\s+/).filter(Boolean), r;
54
+ return r = n.length >= 2 ? (n[0].charAt(0) + n[1].charAt(0)).toUpperCase() : n[0].slice(0, 2).toUpperCase(), r || "??";
55
+ }
56
+ function o(e) {
57
+ let t = e.trim();
58
+ if (!t) return "";
59
+ let n = t.toLowerCase();
60
+ return n.charAt(0).toUpperCase() + n.slice(1);
61
+ }
62
+ function s(e) {
63
+ return {
64
+ backgroundColor: `color-mix(in srgb, ${e} 16%, transparent)`,
65
+ color: "var(--color-text-primary)"
66
+ };
67
+ }
68
+ var c = {
69
+ HOTEL_OPERATOR: "var(--color-chart-3)",
70
+ TOUR_OPERATOR: "var(--color-chart-4)",
71
+ ACTIVITY_PROVIDER: "var(--color-chart-5)",
72
+ TRANSPORT_PROVIDER: "var(--color-chart-6)",
73
+ EVENT_ORGANIZER: "var(--color-chart-7)"
74
+ }, l = "var(--color-border-seam)";
75
+ function u(e) {
76
+ return s((e in c ? c[e] : void 0) ?? l);
77
+ }
78
+ //#endregion
79
+ export { u as bannerTintFor, n as getProviderTypeOptions, a as initialsFor, r as labelForProviderType, o as sentenceCase };
80
+
81
+ //# sourceMappingURL=providerTypeMeta.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"providerTypeMeta.js","names":[],"sources":["../../../src/ggnomad/utils/providerTypeMeta.ts"],"sourcesContent":["/**\n * Shared metadata for the GgnomadProviderType enum + provider visual\n * helpers.\n *\n * The single source of truth for the translation key + English fallback\n * for each provider type label, reused by both ProviderDashboardCard.tsx\n * (rendering) and CreateProviderDialog.tsx (form dropdown) so the wording\n * cannot drift between the two surfaces.\n *\n * If the backend ever adds a new value to GgnomadProviderType, add a\n * row here — anything unlisted falls back to a sentence-cased version of\n * the enum (\"HOTEL_OPERATOR\" -> \"Hotel operator\").\n *\n * Type-specific icons were intentionally removed: a single type\n * (\"Transport provider\") can cover buses, taxis, ferries and airlines,\n * so one icon per type is wrong. The card's banner is tinted by type\n * instead (see bannerTintFor) so the tint works as a type indicator.\n */\n\n/**\n * Local enum declaration. The published supergraph on Hive CDN still\n * declares `GgnomadProvider.type` as `String`, so the codegen-derived\n * types in src/generated/wspace-types.ts don't carry this enum yet. The\n * backend change (BOFF-8207) adds the enum to ggnomad.gql; once it ships\n * to alpha, the next codegen run will export this enum from\n * wspace-types and the local fallback below becomes a no-op. Keep the\n * two declarations in sync.\n */\nexport type GgnomadProviderType =\n | 'HOTEL_OPERATOR'\n | 'TOUR_OPERATOR'\n | 'ACTIVITY_PROVIDER'\n | 'TRANSPORT_PROVIDER'\n | 'EVENT_ORGANIZER';\n\n/**\n * Per-type translation keys + English fallbacks. The dropdown/filter chips\n * show these labels, and the same keys are reused by CreateProviderDialog.\n * If you add a value to GgnomadProviderType, add a key here and (eventually)\n * a translation in the locale files; the fallback covers English-only\n * locales.\n */\nconst KNOWN_LABEL_KEYS: Record<GgnomadProviderType, { key: string; fallback: string }> = {\n HOTEL_OPERATOR: { key: 'ggnomad.provider.type.hotelOperator', fallback: 'Hotel operator' },\n TOUR_OPERATOR: { key: 'ggnomad.provider.type.tourOperator', fallback: 'Tour operator' },\n ACTIVITY_PROVIDER: {\n key: 'ggnomad.provider.type.activityProvider',\n fallback: 'Activity provider',\n },\n TRANSPORT_PROVIDER: {\n key: 'ggnomad.provider.type.transportProvider',\n fallback: 'Transport provider',\n },\n EVENT_ORGANIZER: { key: 'ggnomad.provider.type.eventOrganizer', fallback: 'Event organizer' },\n};\n\nconst ORDER: GgnomadProviderType[] = [\n 'HOTEL_OPERATOR',\n 'TOUR_OPERATOR',\n 'ACTIVITY_PROVIDER',\n 'TRANSPORT_PROVIDER',\n 'EVENT_ORGANIZER',\n];\n\n/**\n * Build the dropdown options. `translate` should be the `t` from `useI18n()` in\n * the calling component so each label resolves in the active locale; the\n * fallback string is used otherwise (or when the translator is omitted).\n */\nexport function getProviderTypeOptions(\n translate?: (key: string, fallback: string) => string\n): Array<{\n value: GgnomadProviderType;\n label: string;\n}> {\n return ORDER.map((value) => {\n const { key, fallback } = KNOWN_LABEL_KEYS[value];\n return { value, label: translate ? translate(key, fallback) : fallback };\n });\n}\n\n/** Human-facing label for a provider type, with a safe fallback. */\nexport function labelForProviderType(\n type: string,\n translate?: (key: string, fallback: string) => string\n): string {\n if (type in KNOWN_LABEL_KEYS) {\n const { key, fallback } = KNOWN_LABEL_KEYS[type as GgnomadProviderType];\n return translate ? translate(key, fallback) : fallback;\n }\n return enumToSentence(type);\n}\n\n/** \"HOTEL_OPERATOR\" -> \"Hotel operator\", \"OTHER\" -> \"Other\". */\nfunction enumToSentence(value: string): string {\n const spaced = value.replace(/_+/g, ' ').trim().toLowerCase();\n if (!spaced) return value;\n return spaced.charAt(0).toUpperCase() + spaced.slice(1);\n}\n\n/**\n * Two-letter initials for the avatar fallback.\n *\n * - \"Indigo\" -> \"IN\" (first two letters of the single word)\n * - \"Blue Sky\" -> \"BS\" (first letter of each of the first two words)\n * - \"A\" -> \"A\" (single character preserved as-is)\n * - \"\" -> \"??\" (sentinel for empty names)\n */\nexport function initialsFor(name: string): string {\n const cleaned = name.trim();\n if (!cleaned) return '??';\n\n const words = cleaned.split(/\\s+/).filter(Boolean);\n let result: string;\n if (words.length >= 2) {\n result = (words[0].charAt(0) + words[1].charAt(0)).toUpperCase();\n } else {\n result = words[0].slice(0, 2).toUpperCase();\n }\n return result || '??';\n}\n\n/** \"alpine\" -> \"Alpine\", \"SUSPENDED\" -> \"Suspended\". Lowercases the input\n * first so the function normalizes backend enum values (which arrive\n * in UPPER_SNAKE_CASE) to a sentence-case display label. */\nexport function sentenceCase(value: string): string {\n const trimmed = value.trim();\n if (!trimmed) return '';\n const lower = trimmed.toLowerCase();\n return lower.charAt(0).toUpperCase() + lower.slice(1);\n}\n\n/** \"blue sky adventures\" -> \"Blue Sky Adventures\". Title-cases each word,\n * leaving small connector words (\"of\", \"the\", \"and\", \"a\", \"an\", \"in\", \"on\",\n * \"for\", \"to\") lowercase unless they are the first word. Used to display\n * user-entered provider names. */\nconst TITLE_CASE_SMALL_WORDS = new Set([\n 'a',\n 'an',\n 'and',\n 'as',\n 'at',\n 'but',\n 'by',\n 'for',\n 'in',\n 'nor',\n 'of',\n 'on',\n 'or',\n 'so',\n 'the',\n 'to',\n 'up',\n 'yet',\n]);\n\nexport function titleCase(value: string): string {\n const trimmed = value.trim();\n if (!trimmed) return '';\n // Preserve acronyms and proper nouns the user has already chosen the\n // casing for (\"McDonald's\", \"DHL Express\"): only short-circuit on\n // *mixed-case* input. Pure all-caps input like \"ALPINE TREKS CO\" is\n // still title-cased so the user gets \"Alpine Treks Co\".\n if (/[A-Z]/.test(trimmed.slice(1)) && /[a-z]/.test(trimmed)) return trimmed;\n const words = trimmed.split(/\\s+/);\n return words\n .map((word, index) => {\n const lower = word.toLowerCase();\n if (index > 0 && TITLE_CASE_SMALL_WORDS.has(lower)) return lower;\n if (word.length === 0) return word;\n return lower.charAt(0).toUpperCase() + lower.slice(1);\n })\n .join(' ');\n}\n\n/**\n * Banner tint as a CSS `style` object. The banner band uses the hue\n * at 16% alpha over the card surface so the band reads as colored in\n * both light and dark mode; the avatar initials use\n * `var(--color-text-primary)` so contrast holds against the card\n * surface in both themes. (Previously the per-type hue was used\n * directly for the initials, which was too low-contrast for some\n * chart-N slots in light mode.)\n *\n * Structurally compatible with React.CSSProperties — we don't import\n * React here to keep this util free of UI dependencies.\n *\n * Implementation note: colors are applied via inline `style` (not\n * Tailwind classes) because the host shell's Tailwind v4 build does\n * not emit utility classes for the theme's custom palette\n * (`bg-chart-N`, `bg-accent-*`, ...). The tokens resolve against the\n * active theme so contrast holds in light and dark mode without us\n * hard-coding hex values per theme.\n */\nexport interface BannerTintStyle {\n backgroundColor: string;\n color: string;\n}\n\n/** Build the style object for a hue token. */\nfunction tint(token: string): BannerTintStyle {\n return {\n backgroundColor: `color-mix(in srgb, ${token} 16%, transparent)`,\n color: 'var(--color-text-primary)',\n };\n}\n\n/**\n * Fixed banner hue per provider type. Color is keyed by type (not by\n * id), so every provider of a given type reads the same — the tint\n * becomes a type indicator at a glance. No green (reserved for the\n * \"Active\" status) and no red (reserved for errors).\n */\n/**\n * Chart-token slot per provider type. The actual hue is theme-dependent\n * (Forest/Ocean/Sunset/HC themes ship different chart-1..12 palettes), so\n * the card's banner reads as a type indicator via the design system rather\n * than a fixed hex. Light/dark contrast is the theme tokens' responsibility.\n *\n * Slots 3..7 are used so slots 1/2 stay free for brand accents and chart-\n * positive stays free for status success. If you add a new provider type,\n * pick the next free slot from this range; chart-8..12 stay reserved for\n * later additions.\n */\nconst TYPE_TINT_VAR: Record<GgnomadProviderType, string> = {\n HOTEL_OPERATOR: 'var(--color-chart-3)',\n TOUR_OPERATOR: 'var(--color-chart-4)',\n ACTIVITY_PROVIDER: 'var(--color-chart-5)',\n TRANSPORT_PROVIDER: 'var(--color-chart-6)',\n EVENT_ORGANIZER: 'var(--color-chart-7)',\n};\n\n/** Fallback for types outside the known enum (incl. future additions). */\nconst FALLBACK_TINT_VAR = 'var(--color-border-seam)';\n\n/** Banner tint for a provider type; unknown types get neutral slate. */\nexport function bannerTintFor(type: string): BannerTintStyle {\n // `in` guard mirrors labelForProviderType so an arbitrary string never\n // indexes the enum-keyed record without a check.\n const token = type in TYPE_TINT_VAR ? TYPE_TINT_VAR[type as GgnomadProviderType] : undefined;\n return tint(token ?? FALLBACK_TINT_VAR);\n}\n"],"mappings":";AA0CA,IAAM,IAAmF;CACvF,gBAAgB;EAAE,KAAK;EAAuC,UAAU;CAAiB;CACzF,eAAe;EAAE,KAAK;EAAsC,UAAU;CAAgB;CACtF,mBAAmB;EACjB,KAAK;EACL,UAAU;CACZ;CACA,oBAAoB;EAClB,KAAK;EACL,UAAU;CACZ;CACA,iBAAiB;EAAE,KAAK;EAAwC,UAAU;CAAkB;AAC9F,GAEM,IAA+B;CACnC;CACA;CACA;CACA;CACA;AACF;AAOA,SAAgB,EACd,GAIC;CACD,OAAO,EAAM,KAAK,MAAU;EAC1B,IAAM,EAAE,QAAK,gBAAa,EAAiB;EAC3C,OAAO;GAAE;GAAO,OAAO,IAAY,EAAU,GAAK,CAAQ,IAAI;EAAS;CACzE,CAAC;AACH;AAGA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ggnomad",
3
- "version": "2026.830.1",
3
+ "version": "2026.1016.1",
4
4
  "description": "Burdenoff GGNomad Microfrontend",
5
5
  "type": "module",
6
6
  "files": [