@sovereignsquad/gds-core 3.9.0

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.
@@ -0,0 +1,672 @@
1
+ import {
2
+ GdsIcons,
3
+ StateBlock
4
+ } from "./chunk-TQ7ZYMEA.mjs";
5
+
6
+ // src/PartnerDiscovery.tsx
7
+ import {
8
+ Anchor,
9
+ Badge,
10
+ Box,
11
+ Button,
12
+ Card,
13
+ Divider,
14
+ Group,
15
+ Modal,
16
+ Paper,
17
+ SimpleGrid,
18
+ Stack,
19
+ Text,
20
+ TextInput,
21
+ ThemeIcon,
22
+ Title,
23
+ VisuallyHidden
24
+ } from "@mantine/core";
25
+ import { jsx, jsxs } from "react/jsx-runtime";
26
+ var partnerDiscoveryDefaultAmenities = [
27
+ { id: "high-chairs", label: "High chairs" },
28
+ { id: "booster-seats", label: "Booster seats" },
29
+ { id: "changing-table", label: "Changing table" },
30
+ { id: "menu-mods", label: "Menu mods" },
31
+ { id: "stroller-storage", label: "Stroller storage" },
32
+ { id: "kids-options", label: "Kids options" },
33
+ { id: "outdoor-seating", label: "Outdoor seating" },
34
+ { id: "reservations", label: "Reservations" }
35
+ ];
36
+ var partnerDiscoveryDefaultFilterState = {
37
+ query: "",
38
+ amenities: [],
39
+ prices: []
40
+ };
41
+ var partnerSurface = {
42
+ page: "light-dark(color-mix(in srgb, var(--mantine-color-white) 82%, var(--mantine-color-teal-0)), color-mix(in srgb, var(--mantine-color-teal-9) 18%, var(--mantine-color-dark-9)))",
43
+ card: "light-dark(var(--mantine-color-white), color-mix(in srgb, var(--mantine-color-teal-9) 28%, var(--mantine-color-dark-8)))",
44
+ cardActive: "light-dark(var(--mantine-color-teal-0), color-mix(in srgb, var(--mantine-color-teal-9) 48%, var(--mantine-color-dark-8)))",
45
+ border: "light-dark(var(--mantine-color-gray-3), color-mix(in srgb, var(--mantine-color-teal-4) 42%, var(--mantine-color-dark-5)))",
46
+ borderActive: "light-dark(var(--mantine-color-teal-7), var(--mantine-color-lime-2))",
47
+ text: "light-dark(var(--mantine-color-dark-9), var(--mantine-color-gray-0))",
48
+ muted: "light-dark(var(--mantine-color-dark-5), var(--mantine-color-gray-3))"
49
+ };
50
+ function safeExternalProps(item) {
51
+ return item.external ? { target: "_blank", rel: "noreferrer noopener" } : {};
52
+ }
53
+ function createPartnerEvent(name, component, metadata) {
54
+ return {
55
+ name,
56
+ component,
57
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
58
+ metadata: redactPartnerDiscoveryEventMetadata(metadata)
59
+ };
60
+ }
61
+ function redactPartnerDiscoveryEventMetadata(metadata = {}) {
62
+ const blocked = /* @__PURE__ */ new Set(["email", "phone", "query", "apiKey", "token", "location", "lat", "lng"]);
63
+ return Object.fromEntries(
64
+ Object.entries(metadata).map(([key, value]) => [
65
+ key,
66
+ blocked.has(key) ? "[redacted]" : value
67
+ ])
68
+ );
69
+ }
70
+ function emitPartnerDiscoveryEvent(handler, name, component, metadata) {
71
+ if (!handler) {
72
+ return;
73
+ }
74
+ try {
75
+ handler(createPartnerEvent(name, component, metadata));
76
+ } catch {
77
+ }
78
+ }
79
+ function togglePartnerAmenity(state, amenityId) {
80
+ const amenities = state.amenities.includes(amenityId) ? state.amenities.filter((id) => id !== amenityId) : [...state.amenities, amenityId];
81
+ return { ...state, amenities };
82
+ }
83
+ function togglePartnerPrice(state, price) {
84
+ const prices = state.prices.includes(price) ? state.prices.filter((value) => value !== price) : [...state.prices, price];
85
+ return { ...state, prices };
86
+ }
87
+ function resetPartnerDiscoveryFilters() {
88
+ return { ...partnerDiscoveryDefaultFilterState };
89
+ }
90
+ function filterPartnerPlaces(places, filters, viewport) {
91
+ const query = filters.query.trim().toLocaleLowerCase();
92
+ return places.filter((place) => {
93
+ const haystack = [place.title, place.category, place.neighborhood, place.price, ...place.amenities].filter(Boolean).join(" ").toLocaleLowerCase();
94
+ const queryMatch = !query || haystack.includes(query);
95
+ const amenityMatch = filters.amenities.every((amenity) => place.amenities.includes(amenity));
96
+ const priceMatch = !filters.prices.length || (place.price ? filters.prices.includes(place.price) : false);
97
+ const viewportMatch = !viewport || !place.coordinates || place.coordinates.lat <= viewport.north && place.coordinates.lat >= viewport.south && place.coordinates.lng <= viewport.east && place.coordinates.lng >= viewport.west;
98
+ return queryMatch && amenityMatch && priceMatch && viewportMatch;
99
+ });
100
+ }
101
+ function PartnerDiscoveryShell({
102
+ logo,
103
+ navItems,
104
+ footer,
105
+ children
106
+ }) {
107
+ return /* @__PURE__ */ jsx(
108
+ Box,
109
+ {
110
+ style: {
111
+ minHeight: "100vh",
112
+ color: partnerSurface.text,
113
+ background: partnerSurface.page
114
+ },
115
+ children: /* @__PURE__ */ jsxs(Stack, { gap: "lg", maw: 940, mx: "auto", px: { base: "md", sm: "lg" }, py: "md", children: [
116
+ /* @__PURE__ */ jsx(PartnerDiscoveryHeader, { logo, navItems }),
117
+ /* @__PURE__ */ jsx(Box, { component: "main", children }),
118
+ footer ? /* @__PURE__ */ jsx(PartnerDiscoveryFooter, { ...footer }) : null
119
+ ] })
120
+ }
121
+ );
122
+ }
123
+ function PartnerDiscoveryHeader({
124
+ logo,
125
+ navItems
126
+ }) {
127
+ return /* @__PURE__ */ jsx(Box, { component: "header", children: /* @__PURE__ */ jsxs(Group, { component: "nav", "aria-label": "Primary navigation", justify: "space-between", align: "center", gap: "md", wrap: "wrap", children: [
128
+ /* @__PURE__ */ jsx(Box, { style: { minWidth: 0 }, children: logo }),
129
+ /* @__PURE__ */ jsx(Group, { gap: "lg", wrap: "wrap", justify: "flex-end", children: navItems.map((item) => /* @__PURE__ */ jsx(
130
+ Anchor,
131
+ {
132
+ href: item.href,
133
+ c: item.current ? "teal.8" : void 0,
134
+ fw: item.current ? 700 : 500,
135
+ size: "sm",
136
+ "aria-current": item.current ? "page" : void 0,
137
+ ...safeExternalProps(item),
138
+ children: item.label
139
+ },
140
+ item.id
141
+ )) })
142
+ ] }) });
143
+ }
144
+ function PartnerDiscoveryFooter({
145
+ copyright,
146
+ legalLinks,
147
+ socialLinks = []
148
+ }) {
149
+ return /* @__PURE__ */ jsxs(Group, { component: "footer", gap: "md", wrap: "wrap", c: "dimmed", fz: "sm", pt: "md", children: [
150
+ /* @__PURE__ */ jsx(Text, { size: "sm", children: copyright }),
151
+ [...legalLinks, ...socialLinks].map((item) => /* @__PURE__ */ jsx(Anchor, { href: item.href, size: "sm", ...safeExternalProps(item), children: item.label }, item.id))
152
+ ] });
153
+ }
154
+ function AmenityChipGrid({
155
+ amenities,
156
+ selected,
157
+ onToggle
158
+ }) {
159
+ if (!amenities.length) {
160
+ return /* @__PURE__ */ jsx(StateBlock, { variant: "empty", title: "No amenities", description: "No amenity filters are available.", compact: true });
161
+ }
162
+ return /* @__PURE__ */ jsx(SimpleGrid, { cols: { base: 2, sm: 3, md: 4 }, spacing: "xs", children: amenities.map((amenity) => {
163
+ const active = selected.includes(amenity.id);
164
+ return /* @__PURE__ */ jsx(
165
+ Button,
166
+ {
167
+ type: "button",
168
+ variant: active ? "filled" : "outline",
169
+ color: active ? "teal" : "gray",
170
+ radius: "md",
171
+ h: "auto",
172
+ py: "xs",
173
+ px: "xs",
174
+ "aria-pressed": active,
175
+ leftSection: amenity.icon,
176
+ onClick: () => onToggle?.(amenity.id),
177
+ styles: {
178
+ label: {
179
+ whiteSpace: "normal",
180
+ lineHeight: 1.2,
181
+ textAlign: "center"
182
+ }
183
+ },
184
+ children: amenity.label
185
+ },
186
+ amenity.id
187
+ );
188
+ }) });
189
+ }
190
+ function PartnerDiscoveryFilters({
191
+ value,
192
+ amenities,
193
+ labels,
194
+ prices = ["$", "$$", "$$$", "$$$$"],
195
+ opened = false,
196
+ loading = false,
197
+ onQueryChange,
198
+ onAmenityToggle,
199
+ onPriceToggle,
200
+ onOpen,
201
+ onClose,
202
+ onReset,
203
+ onApply,
204
+ onEvent
205
+ }) {
206
+ const hasFilters = Boolean(value.query || value.amenities.length || value.prices.length);
207
+ return /* @__PURE__ */ jsxs(Stack, { gap: "sm", children: [
208
+ /* @__PURE__ */ jsxs(Group, { align: "flex-end", gap: "sm", wrap: "wrap", children: [
209
+ /* @__PURE__ */ jsx(
210
+ TextInput,
211
+ {
212
+ "aria-label": labels.search,
213
+ placeholder: labels.searchPlaceholder,
214
+ value: value.query,
215
+ onChange: (event) => onQueryChange?.(event.currentTarget.value),
216
+ leftSection: /* @__PURE__ */ jsx(GdsIcons.Search, { size: "1rem", "aria-hidden": true }),
217
+ disabled: loading,
218
+ style: { flex: "1 1 320px" }
219
+ }
220
+ ),
221
+ /* @__PURE__ */ jsx(
222
+ Button,
223
+ {
224
+ type: "button",
225
+ variant: "outline",
226
+ color: "teal",
227
+ leftSection: /* @__PURE__ */ jsx(GdsIcons.Filter, { size: "1rem", "aria-hidden": true }),
228
+ onClick: () => {
229
+ emitPartnerDiscoveryEvent(onEvent, "filter_open", "PartnerDiscoveryFilters");
230
+ onOpen?.();
231
+ },
232
+ disabled: loading,
233
+ children: labels.filters
234
+ }
235
+ ),
236
+ /* @__PURE__ */ jsx(
237
+ Button,
238
+ {
239
+ type: "button",
240
+ variant: "subtle",
241
+ color: "teal",
242
+ disabled: !hasFilters || loading,
243
+ onClick: () => {
244
+ emitPartnerDiscoveryEvent(onEvent, "filter_reset", "PartnerDiscoveryFilters");
245
+ onReset?.();
246
+ },
247
+ children: labels.reset
248
+ }
249
+ )
250
+ ] }),
251
+ hasFilters ? /* @__PURE__ */ jsxs(Group, { gap: "xs", "aria-label": labels.selected ?? "Selected filters", children: [
252
+ value.amenities.map((id) => /* @__PURE__ */ jsx(Badge, { color: "teal", variant: "light", children: amenities.find((item) => item.id === id)?.label ?? id }, id)),
253
+ value.prices.map((price) => /* @__PURE__ */ jsx(Badge, { color: "lime", variant: "light", children: price }, price))
254
+ ] }) : null,
255
+ /* @__PURE__ */ jsx(Modal, { opened, onClose: onClose ?? (() => {
256
+ }), title: labels.filters, centered: true, radius: "md", trapFocus: true, children: /* @__PURE__ */ jsxs(Stack, { gap: "md", children: [
257
+ /* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
258
+ /* @__PURE__ */ jsx(Text, { fw: 700, children: labels.amenities }),
259
+ /* @__PURE__ */ jsx(AmenityChipGrid, { amenities, selected: value.amenities, onToggle: onAmenityToggle })
260
+ ] }),
261
+ /* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
262
+ /* @__PURE__ */ jsx(Text, { fw: 700, children: labels.price }),
263
+ /* @__PURE__ */ jsx(Group, { gap: "xs", children: prices.map((price) => {
264
+ const active = value.prices.includes(price);
265
+ return /* @__PURE__ */ jsx(
266
+ Button,
267
+ {
268
+ type: "button",
269
+ variant: active ? "filled" : "outline",
270
+ color: active ? "teal" : "gray",
271
+ radius: "md",
272
+ "aria-pressed": active,
273
+ onClick: () => onPriceToggle?.(price),
274
+ children: price
275
+ },
276
+ price
277
+ );
278
+ }) })
279
+ ] }),
280
+ /* @__PURE__ */ jsxs(Group, { justify: "space-between", wrap: "wrap", children: [
281
+ /* @__PURE__ */ jsx(Button, { type: "button", variant: "subtle", onClick: onClose, children: labels.close }),
282
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
283
+ /* @__PURE__ */ jsx(Button, { type: "button", variant: "light", disabled: !hasFilters, onClick: onReset, children: labels.reset }),
284
+ /* @__PURE__ */ jsx(
285
+ Button,
286
+ {
287
+ type: "button",
288
+ color: "lime",
289
+ c: "dark.9",
290
+ onClick: () => {
291
+ emitPartnerDiscoveryEvent(onEvent, "filter_apply", "PartnerDiscoveryFilters", {
292
+ amenityCount: value.amenities.length,
293
+ priceCount: value.prices.length
294
+ });
295
+ onApply?.();
296
+ },
297
+ children: labels.apply
298
+ }
299
+ )
300
+ ] })
301
+ ] })
302
+ ] }) })
303
+ ] });
304
+ }
305
+ function PartnerPlaceResultCard({
306
+ place,
307
+ amenityLabels = {},
308
+ active = false,
309
+ detailLabel = "See details",
310
+ onSelect,
311
+ onEvent
312
+ }) {
313
+ return /* @__PURE__ */ jsx(
314
+ Card,
315
+ {
316
+ component: "article",
317
+ withBorder: true,
318
+ radius: "md",
319
+ p: "sm",
320
+ "data-active": active || void 0,
321
+ style: {
322
+ borderColor: active ? partnerSurface.borderActive : partnerSurface.border,
323
+ background: active ? partnerSurface.cardActive : partnerSurface.card
324
+ },
325
+ children: /* @__PURE__ */ jsxs(Stack, { gap: 4, children: [
326
+ /* @__PURE__ */ jsx(
327
+ Anchor,
328
+ {
329
+ href: place.href,
330
+ fw: 700,
331
+ c: "teal.8",
332
+ onClick: () => {
333
+ emitPartnerDiscoveryEvent(onEvent, "result_select", "PartnerPlaceResultCard", { placeId: place.id });
334
+ onSelect?.(place.id);
335
+ },
336
+ children: place.title
337
+ }
338
+ ),
339
+ /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: [place.category, place.neighborhood, place.price].filter(Boolean).join(" \xB7 ") }),
340
+ /* @__PURE__ */ jsx(Group, { gap: 4, "aria-label": "Amenities", wrap: "wrap", children: place.amenities.slice(0, 8).map((amenity) => /* @__PURE__ */ jsx(Badge, { variant: "light", color: "teal", radius: "md", children: amenityLabels[amenity] ?? amenity }, amenity)) }),
341
+ /* @__PURE__ */ jsx(Anchor, { href: place.href, size: "sm", c: "teal.8", children: /* @__PURE__ */ jsxs(Group, { component: "span", gap: 4, wrap: "nowrap", children: [
342
+ /* @__PURE__ */ jsx("span", { children: detailLabel }),
343
+ /* @__PURE__ */ jsx(GdsIcons.Forward, { size: "0.95rem", "aria-hidden": true })
344
+ ] }) })
345
+ ] })
346
+ }
347
+ );
348
+ }
349
+ function PartnerMapPin({
350
+ label,
351
+ active = false,
352
+ onSelect
353
+ }) {
354
+ return /* @__PURE__ */ jsxs(
355
+ Button,
356
+ {
357
+ type: "button",
358
+ "aria-pressed": active,
359
+ "aria-label": label,
360
+ onClick: onSelect,
361
+ variant: "filled",
362
+ color: active ? "gray" : "teal",
363
+ radius: "md",
364
+ w: 28,
365
+ h: 28,
366
+ p: 0,
367
+ style: { filter: "drop-shadow(0 2px 2px color-mix(in srgb, var(--mantine-color-black) 45%, transparent))" },
368
+ children: [
369
+ /* @__PURE__ */ jsx(VisuallyHidden, { children: label }),
370
+ /* @__PURE__ */ jsx(GdsIcons.Home, { size: "1rem", "aria-hidden": true })
371
+ ]
372
+ }
373
+ );
374
+ }
375
+ function PartnerMapControls({
376
+ onZoomIn,
377
+ onZoomOut,
378
+ zoomInLabel = "Zoom in",
379
+ zoomOutLabel = "Zoom out"
380
+ }) {
381
+ return /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
382
+ /* @__PURE__ */ jsx(Button, { type: "button", variant: "default", "aria-label": zoomInLabel, onClick: onZoomIn, w: 32, h: 32, p: 0, children: /* @__PURE__ */ jsx(GdsIcons.Add, { size: "1rem", "aria-hidden": true }) }),
383
+ /* @__PURE__ */ jsx(Button, { type: "button", variant: "default", "aria-label": zoomOutLabel, onClick: onZoomOut, w: 32, h: 32, p: 0, children: /* @__PURE__ */ jsx(GdsIcons.Remove, { size: "1rem", "aria-hidden": true }) })
384
+ ] });
385
+ }
386
+ function PartnerMapListShell({
387
+ places,
388
+ filters,
389
+ activePlaceId,
390
+ loading = false,
391
+ error,
392
+ empty,
393
+ onRetry,
394
+ onActivePlaceChange,
395
+ mapAdapter,
396
+ amenityLabels,
397
+ onEvent
398
+ }) {
399
+ const visiblePlaces = filterPartnerPlaces(places, filters);
400
+ const mapBody = loading ? /* @__PURE__ */ jsx(StateBlock, { variant: "loading", title: "Loading map", description: "Discovery results are loading.", compact: true }) : error ? /* @__PURE__ */ jsx(
401
+ StateBlock,
402
+ {
403
+ variant: "error",
404
+ title: "Map unavailable",
405
+ description: error,
406
+ compact: true,
407
+ action: onRetry ? /* @__PURE__ */ jsx(Button, { type: "button", onClick: onRetry, children: "Retry" }) : void 0
408
+ }
409
+ ) : mapAdapter ? mapAdapter({
410
+ places: visiblePlaces,
411
+ activePlaceId,
412
+ onPinSelect: (placeId) => {
413
+ emitPartnerDiscoveryEvent(onEvent, "pin_select", "PartnerMapListShell", { placeId });
414
+ onActivePlaceChange?.(placeId);
415
+ }
416
+ }) : /* @__PURE__ */ jsx(StateBlock, { variant: "empty", title: "List-only mode", description: "Connect a map adapter to render pins.", compact: true });
417
+ return /* @__PURE__ */ jsxs(SimpleGrid, { cols: { base: 1, md: 2 }, spacing: "md", style: { alignItems: "start" }, children: [
418
+ /* @__PURE__ */ jsx(
419
+ Paper,
420
+ {
421
+ withBorder: true,
422
+ radius: "md",
423
+ p: "sm",
424
+ style: {
425
+ minHeight: 360,
426
+ overflow: "hidden",
427
+ background: "light-dark(var(--mantine-color-gray-0), color-mix(in srgb, var(--mantine-color-teal-9) 36%, var(--mantine-color-dark-8)))"
428
+ },
429
+ children: mapBody
430
+ }
431
+ ),
432
+ /* @__PURE__ */ jsx(Stack, { gap: "xs", component: "section", "aria-label": "Results", children: loading ? /* @__PURE__ */ jsx(StateBlock, { variant: "loading", title: "Loading results", compact: true }) : error ? /* @__PURE__ */ jsx(StateBlock, { variant: "error", title: "Results unavailable", description: error, action: onRetry ? /* @__PURE__ */ jsx(Button, { type: "button", onClick: onRetry, children: "Retry" }) : void 0, compact: true }) : visiblePlaces.length ? visiblePlaces.map((place) => /* @__PURE__ */ jsx(
433
+ PartnerPlaceResultCard,
434
+ {
435
+ place,
436
+ amenityLabels,
437
+ active: place.id === activePlaceId,
438
+ onSelect: onActivePlaceChange,
439
+ onEvent
440
+ },
441
+ place.id
442
+ )) : /* @__PURE__ */ jsx(StateBlock, { variant: "empty", title: "No places found", description: empty ?? "Adjust the search or filters to see more places.", compact: true }) })
443
+ ] });
444
+ }
445
+ function PartnerPlaceDetailTemplate({
446
+ place,
447
+ backHref,
448
+ labels,
449
+ shareState = "idle",
450
+ onShare,
451
+ onEvent
452
+ }) {
453
+ const actions = [
454
+ place.links?.photos ? { id: "photos", label: labels.photos, href: place.links.photos } : null,
455
+ place.links?.website ? { id: "website", label: labels.website, href: place.links.website } : null,
456
+ place.links?.menu ? { id: "menu", label: labels.menu, href: place.links.menu } : null
457
+ ].filter(Boolean);
458
+ return /* @__PURE__ */ jsxs(Stack, { gap: "lg", children: [
459
+ /* @__PURE__ */ jsx(Anchor, { href: backHref, size: "sm", children: /* @__PURE__ */ jsxs(Group, { gap: 6, children: [
460
+ /* @__PURE__ */ jsx(GdsIcons.Back, { size: "1rem", "aria-hidden": true }),
461
+ labels.back
462
+ ] }) }),
463
+ /* @__PURE__ */ jsxs(Stack, { gap: "xs", align: "center", ta: "center", children: [
464
+ /* @__PURE__ */ jsx(Title, { order: 1, children: place.title }),
465
+ place.address ? /* @__PURE__ */ jsx(Text, { children: place.address }) : null,
466
+ place.phone ? /* @__PURE__ */ jsx(Anchor, { href: `tel:${place.phone.replace(/[^\d+]/g, "")}`, children: place.phone }) : null
467
+ ] }),
468
+ /* @__PURE__ */ jsxs(Group, { justify: "center", gap: "xs", wrap: "wrap", children: [
469
+ actions.map((action) => /* @__PURE__ */ jsx(
470
+ Button,
471
+ {
472
+ component: "a",
473
+ href: action.href,
474
+ variant: "outline",
475
+ onClick: () => emitPartnerDiscoveryEvent(onEvent, "detail_action_click", "PartnerPlaceDetailTemplate", { action: action.id }),
476
+ children: action.label
477
+ },
478
+ action.id
479
+ )),
480
+ place.links?.shareUrl ? /* @__PURE__ */ jsx(
481
+ Button,
482
+ {
483
+ type: "button",
484
+ leftSection: /* @__PURE__ */ jsx(GdsIcons.Refer, { size: "1rem", "aria-hidden": true }),
485
+ loading: shareState === "copying",
486
+ color: shareState === "failed" ? "red" : "teal",
487
+ onClick: () => {
488
+ if (shareState === "failed") {
489
+ emitPartnerDiscoveryEvent(onEvent, "share_failure", "PartnerPlaceDetailTemplate", { placeId: place.id });
490
+ }
491
+ onShare?.(place.links?.shareUrl ?? "");
492
+ },
493
+ children: shareState === "copied" ? labels.copied : shareState === "failed" ? labels.shareFailed : labels.share
494
+ }
495
+ ) : null
496
+ ] }),
497
+ /* @__PURE__ */ jsxs(Group, { justify: "center", gap: "xs", children: [
498
+ place.neighborhood ? /* @__PURE__ */ jsx(Badge, { variant: "light", children: place.neighborhood }) : null,
499
+ place.category ? /* @__PURE__ */ jsx(Badge, { variant: "light", children: place.category }) : null
500
+ ] }),
501
+ place.parentTip ? /* @__PURE__ */ jsx(PartnerParentTipPanel, { label: labels.parentTip, children: place.parentTip }) : null,
502
+ /* @__PURE__ */ jsx(PartnerAmenityBadgeGrid, { amenities: place.amenities })
503
+ ] });
504
+ }
505
+ function PartnerParentTipPanel({
506
+ label,
507
+ children
508
+ }) {
509
+ return /* @__PURE__ */ jsx(Paper, { withBorder: true, radius: "md", p: "md", children: /* @__PURE__ */ jsxs(Stack, { gap: "xs", align: "center", children: [
510
+ /* @__PURE__ */ jsx(Badge, { color: "teal", radius: "md", tt: "uppercase", lts: 1.5, children: label }),
511
+ /* @__PURE__ */ jsx(Text, { fs: "italic", ta: "center", children })
512
+ ] }) });
513
+ }
514
+ function PartnerAmenityBadgeGrid({ amenities }) {
515
+ if (!amenities.length) {
516
+ return /* @__PURE__ */ jsx(StateBlock, { variant: "empty", title: "No amenities listed", compact: true });
517
+ }
518
+ return /* @__PURE__ */ jsx(SimpleGrid, { cols: { base: 2, sm: 3, md: 4 }, spacing: "xs", children: amenities.map((amenity) => /* @__PURE__ */ jsx(Paper, { withBorder: true, radius: "md", p: "sm", children: /* @__PURE__ */ jsxs(Stack, { gap: 4, align: "center", ta: "center", children: [
519
+ amenity.icon ? /* @__PURE__ */ jsx(ThemeIcon, { variant: "light", radius: "xl", children: amenity.icon }) : null,
520
+ /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, children: amenity.label })
521
+ ] }) }, amenity.id)) });
522
+ }
523
+ function PartnerNewsletterCapture({
524
+ opened = false,
525
+ labels,
526
+ visual,
527
+ email = "",
528
+ state = "idle",
529
+ onEmailChange,
530
+ onSubmit,
531
+ onDismiss,
532
+ onEvent
533
+ }) {
534
+ return /* @__PURE__ */ jsx(Modal, { opened, onClose: onDismiss ?? (() => {
535
+ }), centered: true, radius: "md", title: labels.title, trapFocus: true, children: /* @__PURE__ */ jsx(
536
+ PartnerNewsletterForm,
537
+ {
538
+ labels,
539
+ visual,
540
+ email,
541
+ state,
542
+ onEmailChange,
543
+ onSubmit: () => {
544
+ emitPartnerDiscoveryEvent(onEvent, state === "error" ? "newsletter_submit_failure" : "newsletter_submit_success", "PartnerNewsletterCapture");
545
+ onSubmit?.();
546
+ },
547
+ onDismiss
548
+ }
549
+ ) });
550
+ }
551
+ function PartnerNewsletterForm({
552
+ labels,
553
+ visual,
554
+ email = "",
555
+ state = "idle",
556
+ onEmailChange,
557
+ onSubmit,
558
+ onDismiss
559
+ }) {
560
+ return /* @__PURE__ */ jsxs(Stack, { gap: "md", ta: "center", children: [
561
+ visual ? /* @__PURE__ */ jsx(Box, { "aria-hidden": true, children: visual }) : null,
562
+ labels.description ? /* @__PURE__ */ jsx(Text, { children: labels.description }) : null,
563
+ /* @__PURE__ */ jsx(
564
+ TextInput,
565
+ {
566
+ type: "email",
567
+ label: labels.emailLabel,
568
+ placeholder: labels.emailPlaceholder,
569
+ value: email,
570
+ onChange: (event) => onEmailChange?.(event.currentTarget.value),
571
+ error: state === "error" ? labels.errorMessage : void 0
572
+ }
573
+ ),
574
+ state === "success" ? /* @__PURE__ */ jsx(StateBlock, { variant: "success", title: labels.successMessage, compact: true }) : null,
575
+ /* @__PURE__ */ jsxs(Group, { justify: "space-between", wrap: "wrap", children: [
576
+ /* @__PURE__ */ jsx(Button, { type: "button", variant: "subtle", onClick: onDismiss, children: labels.dismissLabel }),
577
+ /* @__PURE__ */ jsx(Button, { type: "button", color: "lime", c: "dark.9", loading: state === "submitting", onClick: onSubmit, children: labels.submitLabel })
578
+ ] })
579
+ ] });
580
+ }
581
+ function PartnerListIndex({
582
+ title,
583
+ items,
584
+ empty
585
+ }) {
586
+ return /* @__PURE__ */ jsxs(Stack, { gap: "md", children: [
587
+ /* @__PURE__ */ jsx(Title, { order: 1, children: title }),
588
+ items.length ? items.map((item) => /* @__PURE__ */ jsx(Anchor, { href: item.href, fw: 700, ...safeExternalProps(item), children: /* @__PURE__ */ jsxs(Group, { component: "span", gap: 4, wrap: "nowrap", children: [
589
+ /* @__PURE__ */ jsx("span", { children: item.title }),
590
+ /* @__PURE__ */ jsx(GdsIcons.Forward, { size: "0.95rem", "aria-hidden": true })
591
+ ] }) }, item.id)) : /* @__PURE__ */ jsx(StateBlock, { variant: "empty", title: "No links yet", description: empty, compact: true })
592
+ ] });
593
+ }
594
+ function PartnerFaqList({ items }) {
595
+ if (!items.length) {
596
+ return /* @__PURE__ */ jsx(StateBlock, { variant: "empty", title: "No FAQ items", compact: true });
597
+ }
598
+ return /* @__PURE__ */ jsx(Stack, { gap: "md", children: items.map((item) => /* @__PURE__ */ jsxs(Stack, { gap: 4, children: [
599
+ /* @__PURE__ */ jsx(Title, { order: 3, children: item.question }),
600
+ /* @__PURE__ */ jsx(Text, { children: item.answer })
601
+ ] }, item.id)) });
602
+ }
603
+ function PartnerContactBlock({
604
+ title,
605
+ description,
606
+ email
607
+ }) {
608
+ return /* @__PURE__ */ jsx(Paper, { withBorder: true, radius: "md", p: "md", children: /* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
609
+ /* @__PURE__ */ jsx(Title, { order: 2, children: title }),
610
+ description ? /* @__PURE__ */ jsx(Text, { children: description }) : null,
611
+ email ? /* @__PURE__ */ jsx(Anchor, { href: `mailto:${email}`, children: email }) : null
612
+ ] }) });
613
+ }
614
+ function PartnerSubmissionEntry({
615
+ title,
616
+ description,
617
+ form,
618
+ success,
619
+ error
620
+ }) {
621
+ return /* @__PURE__ */ jsx(Paper, { withBorder: true, radius: "md", p: "lg", children: /* @__PURE__ */ jsxs(Stack, { gap: "md", children: [
622
+ /* @__PURE__ */ jsxs(Stack, { gap: 4, children: [
623
+ /* @__PURE__ */ jsx(Title, { order: 1, children: title }),
624
+ description ? /* @__PURE__ */ jsx(Text, { c: "dimmed", children: description }) : null
625
+ ] }),
626
+ error ? /* @__PURE__ */ jsx(StateBlock, { variant: "error", title: "Submission failed", description: error, compact: true }) : null,
627
+ success ? /* @__PURE__ */ jsx(StateBlock, { variant: "success", title: "Submission received", description: success, compact: true }) : form
628
+ ] }) });
629
+ }
630
+ function PartnerAboutPageSections({
631
+ title,
632
+ sections
633
+ }) {
634
+ return /* @__PURE__ */ jsxs(Stack, { gap: "xl", children: [
635
+ /* @__PURE__ */ jsx(Title, { order: 1, children: title }),
636
+ sections.map((section) => /* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
637
+ /* @__PURE__ */ jsx(Title, { order: 2, children: section.title }),
638
+ /* @__PURE__ */ jsx(Divider, {}),
639
+ /* @__PURE__ */ jsx(Text, { children: section.body })
640
+ ] }, section.id))
641
+ ] });
642
+ }
643
+
644
+ export {
645
+ partnerDiscoveryDefaultAmenities,
646
+ partnerDiscoveryDefaultFilterState,
647
+ redactPartnerDiscoveryEventMetadata,
648
+ emitPartnerDiscoveryEvent,
649
+ togglePartnerAmenity,
650
+ togglePartnerPrice,
651
+ resetPartnerDiscoveryFilters,
652
+ filterPartnerPlaces,
653
+ PartnerDiscoveryShell,
654
+ PartnerDiscoveryHeader,
655
+ PartnerDiscoveryFooter,
656
+ AmenityChipGrid,
657
+ PartnerDiscoveryFilters,
658
+ PartnerPlaceResultCard,
659
+ PartnerMapPin,
660
+ PartnerMapControls,
661
+ PartnerMapListShell,
662
+ PartnerPlaceDetailTemplate,
663
+ PartnerParentTipPanel,
664
+ PartnerAmenityBadgeGrid,
665
+ PartnerNewsletterCapture,
666
+ PartnerNewsletterForm,
667
+ PartnerListIndex,
668
+ PartnerFaqList,
669
+ PartnerContactBlock,
670
+ PartnerSubmissionEntry,
671
+ PartnerAboutPageSections
672
+ };