@scalemule/news-publication 0.0.61 → 0.0.62

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 (41) hide show
  1. package/dist/chunk-3QU6BJVF.js +540 -0
  2. package/dist/chunk-4WVAT5M2.js +213 -0
  3. package/dist/chunk-6SBK3D3B.js +347 -0
  4. package/dist/chunk-CHF3YPDV.js +314 -0
  5. package/dist/chunk-FHRO2Z3F.js +174 -0
  6. package/dist/chunk-SKG5C3MS.js +379 -0
  7. package/dist/index.cjs +1 -0
  8. package/dist/index.js +3 -2
  9. package/dist/meet-view.d.cts +1 -1
  10. package/dist/meet-view.d.ts +1 -1
  11. package/dist/pets-plugin.js +4 -347
  12. package/dist/toys-forms.cjs +609 -0
  13. package/dist/toys-forms.d.cts +35 -0
  14. package/dist/toys-forms.d.ts +35 -0
  15. package/dist/toys-forms.js +4 -0
  16. package/dist/toys-interactions.cjs +594 -0
  17. package/dist/toys-interactions.d.cts +54 -0
  18. package/dist/toys-interactions.d.ts +54 -0
  19. package/dist/toys-interactions.js +520 -0
  20. package/dist/toys-plugin.cjs +713 -0
  21. package/dist/toys-plugin.d.cts +88 -0
  22. package/dist/toys-plugin.d.ts +88 -0
  23. package/dist/toys-plugin.js +10 -0
  24. package/dist/toys-publication.cjs +437 -0
  25. package/dist/toys-publication.d.cts +26 -0
  26. package/dist/toys-publication.d.ts +26 -0
  27. package/dist/toys-publication.js +72 -0
  28. package/dist/toys-server.cjs +275 -0
  29. package/dist/toys-server.d.cts +28 -0
  30. package/dist/toys-server.d.ts +28 -0
  31. package/dist/toys-server.js +4 -0
  32. package/dist/toys-view.cjs +420 -0
  33. package/dist/toys-view.d.cts +55 -0
  34. package/dist/toys-view.d.ts +55 -0
  35. package/dist/toys-view.js +2 -0
  36. package/dist/toys.cjs +196 -0
  37. package/dist/toys.d.cts +278 -0
  38. package/dist/toys.d.ts +278 -0
  39. package/dist/toys.js +1 -0
  40. package/package.json +40 -3
  41. package/toys.css +823 -0
@@ -0,0 +1,379 @@
1
+ import { ToyWordmark, ToyPhoto, ToyBadges, ToyListingCard, ToyLocationCard, ToyRulesContent } from './chunk-CHF3YPDV.js';
2
+ import { toyCollectionRequest } from './chunk-4WVAT5M2.js';
3
+ import { TOY_BRAND, TOY_STATUS_LABELS, TOY_REQUEST_STATUS_LABELS, formatLocalStart, TOY_UUID, toyOptionLabel, TOY_CATEGORIES, TOY_CONDITIONS, TOY_AGE_RANGES, TOY_SAFETY, resolveToyCommunity } from './chunk-FHRO2Z3F.js';
4
+ import { petReaderAuthenticated } from './chunk-6SBK3D3B.js';
5
+ import { ToySignIn, ToyMemberSetup, ToyOwnerActions, ToyListingForm } from '@scalemule/news-publication/toys-forms';
6
+ import { ToySignOut, ToyAccountDelete, ToyRequestPanel, ToyListingActions, ToyExchangeThread, ToyLocationSuggestForm } from '@scalemule/news-publication/toys-interactions';
7
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
8
+
9
+ var publicationToyPaths = {
10
+ home: "/toys",
11
+ account: "/toys/account",
12
+ submit: "/toys/submit",
13
+ listing: "/toys",
14
+ exchanges: "/toys/exchanges",
15
+ locations: "/toys/places",
16
+ rules: "/toys/rules",
17
+ profiles: "/toys/neighbors",
18
+ api: "/api/toys",
19
+ auth: "/api/paw-auth",
20
+ community: "/api/toy-community"
21
+ };
22
+ var standaloneToyPaths = {
23
+ home: "/",
24
+ account: "/account",
25
+ submit: "/give",
26
+ listing: "/toys",
27
+ exchanges: "/exchanges",
28
+ locations: "/places",
29
+ rules: "/rules",
30
+ profiles: "/neighbors",
31
+ api: "/api/toys",
32
+ auth: "/api/paw-auth",
33
+ community: "/api/toy-community"
34
+ };
35
+ var toyReaderAuthenticated = petReaderAuthenticated;
36
+ var toyMediaUrl = (api) => (listing, media) => `${api}/${encodeURIComponent(listing)}/media/${encodeURIComponent(media)}`;
37
+ function Shell({ paths, children, signedIn, embedded = false }) {
38
+ return /* @__PURE__ */ jsxs("div", { className: `toy${embedded ? " toy-embedded" : ""}`, children: [
39
+ /* @__PURE__ */ jsxs("header", { className: "toy-page-heading", children: [
40
+ /* @__PURE__ */ jsx(ToyWordmark, { href: paths.home }),
41
+ /* @__PURE__ */ jsxs("nav", { className: "toy-masthead-links", "aria-label": "ToyRound", children: [
42
+ /* @__PURE__ */ jsx("a", { href: paths.submit, children: "Give or swap" }),
43
+ /* @__PURE__ */ jsx("a", { href: paths.account, children: signedIn ? "My toys" : "Sign in" }),
44
+ signedIn && /* @__PURE__ */ jsx(ToySignOut, { returnTo: paths.home, authPath: paths.auth })
45
+ ] })
46
+ ] }),
47
+ children,
48
+ /* @__PURE__ */ jsxs("footer", { className: "toy-footer toy-page-footer", children: [
49
+ /* @__PURE__ */ jsxs("div", { children: [
50
+ /* @__PURE__ */ jsx(ToyWordmark, { size: 28, href: paths.home }),
51
+ /* @__PURE__ */ jsx("p", { children: TOY_BRAND.tagline })
52
+ ] }),
53
+ /* @__PURE__ */ jsxs("p", { children: [
54
+ embedded && /* @__PURE__ */ jsxs(Fragment, { children: [
55
+ /* @__PURE__ */ jsx("a", { href: TOY_BRAND.origin, children: TOY_BRAND.poweredBy }),
56
+ /* @__PURE__ */ jsx("br", {})
57
+ ] }),
58
+ "A community toy exchange by ",
59
+ /* @__PURE__ */ jsx("a", { href: TOY_BRAND.networkUrl, children: "Bay Area News Network" }),
60
+ "."
61
+ ] }),
62
+ /* @__PURE__ */ jsxs("p", { className: "toy-footer-links", children: [
63
+ /* @__PURE__ */ jsx("a", { href: paths.rules, children: "Rules, prohibited items, privacy & safety" }),
64
+ /* @__PURE__ */ jsx("a", { href: paths.locations, children: "Meeting places" })
65
+ ] })
66
+ ] })
67
+ ] });
68
+ }
69
+ function LoadError({ error, retry, account, auth }) {
70
+ const status = error && typeof error === "object" && "status" in error ? error.status : void 0;
71
+ if (status === 401 || status === 403)
72
+ return /* @__PURE__ */ jsxs("div", { className: "toy-load-error", role: "status", children: [
73
+ /* @__PURE__ */ jsx("h2", { children: "Reconnect your network account." }),
74
+ /* @__PURE__ */ jsx(ToySignIn, { returnTo: retry, authPath: auth })
75
+ ] });
76
+ return /* @__PURE__ */ jsxs("div", { className: "toy-load-error", role: "status", children: [
77
+ /* @__PURE__ */ jsx("h2", { children: "We couldn't open ToyRound." }),
78
+ /* @__PURE__ */ jsx("p", { children: status === 429 ? "There have been several requests in a short time. Wait a moment, then try again." : "The connection is temporarily unavailable. Try loading this page again." }),
79
+ /* @__PURE__ */ jsxs("div", { className: "toy-form-actions", children: [
80
+ /* @__PURE__ */ jsx("a", { className: "toy-button", href: retry, children: "Try again" }),
81
+ retry !== account && /* @__PURE__ */ jsx("a", { className: "toy-text-link", href: account, children: "My toys" })
82
+ ] })
83
+ ] });
84
+ }
85
+ async function policy(scope) {
86
+ return toyCollectionRequest({ ...scope, accessToken: void 0 }, "/policy");
87
+ }
88
+ async function ToyAccountPage({ scope, signedIn, paths = publicationToyPaths, signInEnabled = true, embedded = false }) {
89
+ let body;
90
+ if (!signedIn) body = signInEnabled ? /* @__PURE__ */ jsx(ToySignIn, { returnTo: paths.account, authPath: paths.auth }) : /* @__PURE__ */ jsx("p", { children: "Community sign-in is being prepared. Browsing is open." });
91
+ else
92
+ try {
93
+ const [member, mine, inbox] = await Promise.all([
94
+ toyCollectionRequest(scope, "/member"),
95
+ toyCollectionRequest(scope, "/mine"),
96
+ toyCollectionRequest(scope, "/requests")
97
+ ]);
98
+ const open = inbox.items.filter((r) => ["pending", "accepted"].includes(r.status));
99
+ const closed = inbox.items.filter((r) => !["pending", "accepted"].includes(r.status));
100
+ body = /* @__PURE__ */ jsxs(Fragment, { children: [
101
+ /* @__PURE__ */ jsx(ToyMemberSetup, { member, apiPath: paths.api }),
102
+ /* @__PURE__ */ jsxs("section", { className: "toy-section", "aria-labelledby": "toy-my-listings", children: [
103
+ /* @__PURE__ */ jsxs("div", { className: "toy-section-heading", children: [
104
+ /* @__PURE__ */ jsx("h2", { id: "toy-my-listings", children: "My listings" }),
105
+ /* @__PURE__ */ jsx("a", { className: "toy-button", href: paths.submit, children: "Give or swap a toy" })
106
+ ] }),
107
+ !mine.items.length && /* @__PURE__ */ jsx("p", { className: "toy-note", children: "Nothing listed yet. Outgrown toys, puzzles and games are welcome." }),
108
+ mine.items.map((listing) => /* @__PURE__ */ jsxs("article", { className: "toy-account-row", children: [
109
+ /* @__PURE__ */ jsx(ToyPhoto, { listing, mediaUrl: toyMediaUrl(paths.api) }),
110
+ /* @__PURE__ */ jsxs("div", { children: [
111
+ /* @__PURE__ */ jsx("h3", { children: listing.status === "available" || listing.status === "reserved" ? /* @__PURE__ */ jsx("a", { href: `${paths.listing}/${listing.id}`, children: listing.content.title }) : listing.content.title }),
112
+ /* @__PURE__ */ jsxs("p", { className: "toy-context", children: [
113
+ TOY_STATUS_LABELS[listing.status] || listing.status,
114
+ listing.open_requests ? ` \xB7 ${listing.open_requests} open request${listing.open_requests === 1 ? "" : "s"}` : ""
115
+ ] }),
116
+ listing.review_note && /* @__PURE__ */ jsxs("p", { className: "toy-note", children: [
117
+ "Editor's note: ",
118
+ listing.review_note
119
+ ] }),
120
+ listing.suspension && /* @__PURE__ */ jsxs("p", { className: "toy-note", children: [
121
+ "Suspended for safety review",
122
+ listing.suspension.note ? `: ${listing.suspension.note}` : "."
123
+ ] }),
124
+ /* @__PURE__ */ jsx(ToyOwnerActions, { listing, apiPath: paths.api, submitUrl: paths.submit })
125
+ ] })
126
+ ] }, listing.id))
127
+ ] }),
128
+ /* @__PURE__ */ jsxs("section", { className: "toy-section", "aria-labelledby": "toy-exchanges-title", children: [
129
+ /* @__PURE__ */ jsx("div", { className: "toy-section-heading", children: /* @__PURE__ */ jsx("h2", { id: "toy-exchanges-title", children: "Exchanges" }) }),
130
+ !open.length && /* @__PURE__ */ jsx("p", { className: "toy-note", children: "No open requests or offers." }),
131
+ /* @__PURE__ */ jsx("ul", { className: "toy-inbox", children: [...open, ...closed.slice(0, 10)].map((r) => /* @__PURE__ */ jsx("li", { className: ["pending", "accepted"].includes(r.status) ? "open" : "closed", children: /* @__PURE__ */ jsxs("a", { href: `${paths.exchanges}/${r.id}`, children: [
132
+ /* @__PURE__ */ jsx("strong", { children: r.listing.title }),
133
+ /* @__PURE__ */ jsxs("span", { children: [
134
+ r.role === "owner" ? "From" : "To",
135
+ " ",
136
+ r.counterpart_deleted ? "a closed account" : r.counterpart?.display_name || "a neighbor",
137
+ " \xB7 ",
138
+ TOY_REQUEST_STATUS_LABELS[r.status] || r.status,
139
+ r.appointment?.status === "confirmed" ? ` \xB7 meeting ${formatLocalStart(r.appointment.local_start, r.appointment.timezone)}` : r.appointment?.status === "proposed" ? " \xB7 meeting proposed" : ""
140
+ ] })
141
+ ] }) }, r.id)) })
142
+ ] }),
143
+ /* @__PURE__ */ jsx(ToyAccountDelete, { revision: member.revision, apiPath: paths.api, returnTo: paths.home })
144
+ ] });
145
+ } catch (error) {
146
+ body = /* @__PURE__ */ jsx(LoadError, { error, retry: paths.account, account: paths.account, auth: paths.auth });
147
+ }
148
+ return /* @__PURE__ */ jsx(Shell, { paths, signedIn, embedded, children: /* @__PURE__ */ jsxs("section", { className: "toy-story", children: [
149
+ /* @__PURE__ */ jsx("p", { className: "toy-eyebrow", children: "Your ToyRound account" }),
150
+ /* @__PURE__ */ jsx("h1", { children: "My toys" }),
151
+ body
152
+ ] }) });
153
+ }
154
+ async function ToySubmitPage({ scope, signedIn, paths = publicationToyPaths, edit, community, submissionsEnabled = true, embedded = false }) {
155
+ let form;
156
+ const next = paths.submit + "?" + new URLSearchParams({ ...edit ? { edit } : {}, ...community ? { community } : {} });
157
+ if (!submissionsEnabled)
158
+ form = /* @__PURE__ */ jsxs("section", { className: "toy-form", children: [
159
+ /* @__PURE__ */ jsx("h1", { children: "Listings open soon." }),
160
+ /* @__PURE__ */ jsx("p", { children: "New listings are paused while our local review team gets ready. Browsing stays open." })
161
+ ] });
162
+ else if (!signedIn)
163
+ form = /* @__PURE__ */ jsxs("section", { className: "toy-form", children: [
164
+ /* @__PURE__ */ jsx("h1", { children: "Give or swap a toy." }),
165
+ /* @__PURE__ */ jsx("p", { children: "Sign in with your network account to list a toy. Listing needs an adult account with verified email and phone." }),
166
+ /* @__PURE__ */ jsx(ToySignIn, { returnTo: next, authPath: paths.auth })
167
+ ] });
168
+ else
169
+ try {
170
+ const [rules, member, initial] = await Promise.all([
171
+ policy(scope),
172
+ toyCollectionRequest(scope, "/member"),
173
+ edit && TOY_UUID.test(edit) ? toyCollectionRequest(scope, "/mine/" + edit) : void 0
174
+ ]);
175
+ if (!member.verification.ready || member.status === "suspended")
176
+ form = /* @__PURE__ */ jsxs("section", { className: "toy-form", children: [
177
+ /* @__PURE__ */ jsx("h1", { children: "Almost there." }),
178
+ /* @__PURE__ */ jsx("p", { children: "Finish these steps, then come back to list your toy." }),
179
+ /* @__PURE__ */ jsx(ToyMemberSetup, { member, apiPath: paths.api, compact: true }),
180
+ /* @__PURE__ */ jsx("p", { children: /* @__PURE__ */ jsx("a", { className: "toy-button", href: next, children: "Continue to the listing form" }) })
181
+ ] });
182
+ else if (edit && !initial) form = /* @__PURE__ */ jsx("p", { children: "This listing is unavailable. Open it from My toys." });
183
+ else {
184
+ const home = member.community && rules.areas.some((a) => a.id === member.community.id) ? member.community.id : void 0;
185
+ form = /* @__PURE__ */ jsx(ToyListingForm, { communities: rules.areas, policy: rules.submission_policy, initial, defaultCommunity: rules.areas.find((a) => a.slug === community)?.id || home, apiPath: paths.api, accountUrl: paths.account, listingBasePath: paths.listing });
186
+ }
187
+ } catch (error) {
188
+ form = /* @__PURE__ */ jsxs("section", { className: "toy-form", children: [
189
+ /* @__PURE__ */ jsx("h1", { children: "Give or swap a toy." }),
190
+ /* @__PURE__ */ jsx(LoadError, { error, retry: next, account: paths.account, auth: paths.auth })
191
+ ] });
192
+ }
193
+ return /* @__PURE__ */ jsx(Shell, { paths, signedIn, embedded, children: form });
194
+ }
195
+ async function fetchToyListing(scope, id) {
196
+ if (!TOY_UUID.test(id)) return null;
197
+ try {
198
+ return await toyCollectionRequest({ ...scope, accessToken: void 0 }, "/" + id);
199
+ } catch (error) {
200
+ if (error && typeof error === "object" && "status" in error && error.status === 404) return null;
201
+ throw error;
202
+ }
203
+ }
204
+ async function ToyListingPage({ scope, listing, signedIn, paths = publicationToyPaths, canonicalOrigin, embedded = false }) {
205
+ const c = listing.content;
206
+ let ready = false, own = [];
207
+ if (signedIn)
208
+ try {
209
+ const [member, mine] = await Promise.all([toyCollectionRequest(scope, "/member"), toyCollectionRequest(scope, "/mine")]);
210
+ ready = member.verification.ready && member.status === "active";
211
+ own = mine.items;
212
+ } catch {
213
+ }
214
+ const listingPath = `${paths.listing}/${listing.id}`;
215
+ const mediaUrl = toyMediaUrl(paths.api);
216
+ return /* @__PURE__ */ jsx(Shell, { paths, signedIn, embedded, children: /* @__PURE__ */ jsxs("article", { className: "toy-listing", children: [
217
+ /* @__PURE__ */ jsx("div", { className: "toy-listing-gallery", children: listing.media.map((photo, index) => /* @__PURE__ */ jsx(ToyPhoto, { listing, mediaUrl, large: index === 0, index }, photo.id)) }),
218
+ /* @__PURE__ */ jsxs("div", { className: "toy-listing-copy", children: [
219
+ /* @__PURE__ */ jsxs("p", { className: "toy-context", children: [
220
+ toyOptionLabel(TOY_CATEGORIES, listing.category),
221
+ listing.community ? ` \xB7 ${listing.community}` : ""
222
+ ] }),
223
+ /* @__PURE__ */ jsx("h1", { children: c.title }),
224
+ /* @__PURE__ */ jsx(ToyBadges, { listing }),
225
+ /* @__PURE__ */ jsx("p", { style: { whiteSpace: "pre-wrap" }, children: c.description }),
226
+ /* @__PURE__ */ jsxs("dl", { className: "toy-facts", children: [
227
+ (c.brand || c.model) && /* @__PURE__ */ jsxs(Fragment, { children: [
228
+ /* @__PURE__ */ jsx("dt", { children: "Brand / model" }),
229
+ /* @__PURE__ */ jsx("dd", { children: [c.brand, c.model].filter(Boolean).join(" \xB7 ") })
230
+ ] }),
231
+ /* @__PURE__ */ jsx("dt", { children: "Completeness" }),
232
+ /* @__PURE__ */ jsx("dd", { children: c.completeness === "complete" ? "Complete, per the owner" : c.completeness === "missing_parts" ? `Missing parts: ${c.missing_parts}` : "Not sure, per the owner" }),
233
+ /* @__PURE__ */ jsx("dt", { children: "Condition" }),
234
+ /* @__PURE__ */ jsx("dd", { children: toyOptionLabel(TOY_CONDITIONS, listing.condition) }),
235
+ /* @__PURE__ */ jsx("dt", { children: "Manufacturer age guidance" }),
236
+ /* @__PURE__ */ jsxs("dd", { children: [
237
+ toyOptionLabel(TOY_AGE_RANGES, listing.age_range),
238
+ c.age_guidance ? ` \u2014 "${c.age_guidance}"` : ""
239
+ ] }),
240
+ c.warnings && /* @__PURE__ */ jsxs(Fragment, { children: [
241
+ /* @__PURE__ */ jsx("dt", { children: "Manufacturer warnings" }),
242
+ /* @__PURE__ */ jsx("dd", { children: c.warnings })
243
+ ] }),
244
+ listing.exchange_type === "swap" && c.swap_wishes && /* @__PURE__ */ jsxs(Fragment, { children: [
245
+ /* @__PURE__ */ jsx("dt", { children: "Hoping to swap for" }),
246
+ /* @__PURE__ */ jsx("dd", { children: c.swap_wishes })
247
+ ] })
248
+ ] }),
249
+ /* @__PURE__ */ jsxs("aside", { className: "toy-recall-statement", children: [
250
+ /* @__PURE__ */ jsx("h2", { children: "Recall check \u2014 the owner's statement" }),
251
+ /* @__PURE__ */ jsxs("p", { children: [
252
+ c.recall_check.searched_cpsc ? /* @__PURE__ */ jsxs(Fragment, { children: [
253
+ "The owner reports searching the CPSC recall database",
254
+ c.recall_check.searched_at ? ` on ${new Date(c.recall_check.searched_at).toLocaleDateString()}` : "",
255
+ c.recall_check.search_terms ? ` for "${c.recall_check.search_terms}"` : "",
256
+ " and ",
257
+ c.recall_check.result === "no_match_found" ? "found no recall" : "was not sure",
258
+ "."
259
+ ] }) : "No recall search was reported.",
260
+ " ",
261
+ "An editor reviewed this listing before publication. ",
262
+ TOY_SAFETY.recall
263
+ ] }),
264
+ /* @__PURE__ */ jsx("p", { className: "toy-note", children: TOY_SAFETY.children })
265
+ ] }),
266
+ listing.owner && /* @__PURE__ */ jsxs("aside", { className: "toy-owner-card", children: [
267
+ /* @__PURE__ */ jsx("p", { className: "toy-context", children: "Offered by" }),
268
+ /* @__PURE__ */ jsx("h2", { children: /* @__PURE__ */ jsx("a", { href: `${paths.profiles}/${listing.owner.id}`, children: listing.owner.display_name }) }),
269
+ /* @__PURE__ */ jsxs("p", { children: [
270
+ listing.owner.community?.name ? `${listing.owner.community.name} \xB7 ` : "",
271
+ "member since ",
272
+ listing.owner.member_since,
273
+ " \xB7 ",
274
+ listing.owner.completed_exchanges,
275
+ " completed exchange",
276
+ listing.owner.completed_exchanges === 1 ? "" : "s"
277
+ ] }),
278
+ /* @__PURE__ */ jsx("small", { children: "Completed exchanges are participant-confirmed counts, not a rating." })
279
+ ] }),
280
+ /* @__PURE__ */ jsx(ToyRequestPanel, { listing, signedIn, ready, ownListings: own, apiPath: paths.api, accountUrl: paths.account, exchangeBasePath: paths.exchanges, listingPath, locationsAvailable: listing.exchange_locations_available !== false }),
281
+ /* @__PURE__ */ jsx("p", { className: "toy-safety", children: TOY_SAFETY.meeting }),
282
+ /* @__PURE__ */ jsx(ToyListingActions, { listing, signedIn, apiPath: paths.api, accountUrl: paths.account, listingPath }),
283
+ /* @__PURE__ */ jsxs("p", { children: [
284
+ /* @__PURE__ */ jsx("a", { href: canonicalOrigin + "/toys/" + listing.id, children: "Permanent link" }),
285
+ " \xB7 ",
286
+ /* @__PURE__ */ jsx("a", { href: paths.home, children: "More toys" })
287
+ ] })
288
+ ] })
289
+ ] }) });
290
+ }
291
+ async function ToyProfilePage({ scope, id, paths = publicationToyPaths, signedIn, embedded = false }) {
292
+ if (!TOY_UUID.test(id)) return null;
293
+ let profile = null;
294
+ try {
295
+ profile = await toyCollectionRequest({ ...scope, accessToken: void 0 }, "/profiles/" + id);
296
+ } catch (error) {
297
+ if (!(error && typeof error === "object" && "status" in error && error.status === 404)) throw error;
298
+ }
299
+ if (!profile) return null;
300
+ return /* @__PURE__ */ jsx(Shell, { paths, signedIn, embedded, children: /* @__PURE__ */ jsxs("section", { className: "toy-story", children: [
301
+ /* @__PURE__ */ jsx("p", { className: "toy-eyebrow", children: "Neighbor" }),
302
+ /* @__PURE__ */ jsx("h1", { children: profile.display_name }),
303
+ /* @__PURE__ */ jsxs("p", { children: [
304
+ profile.community?.name ? `${profile.community.name} \xB7 ` : "",
305
+ "member since ",
306
+ profile.member_since,
307
+ " \xB7 ",
308
+ profile.completed_exchanges,
309
+ " completed exchange",
310
+ profile.completed_exchanges === 1 ? "" : "s",
311
+ " (participant-confirmed)"
312
+ ] }),
313
+ /* @__PURE__ */ jsx("div", { className: "toy-grid", children: profile.listings.map((listing) => /* @__PURE__ */ jsx(ToyListingCard, { listing, href: `${paths.listing}/${listing.id}`, mediaUrl: toyMediaUrl(paths.api) }, listing.id)) }),
314
+ !profile.listings.length && /* @__PURE__ */ jsx("p", { className: "toy-note", children: "No available listings right now." })
315
+ ] }) });
316
+ }
317
+ async function ToyExchangePage({ scope, signedIn, id, paths = publicationToyPaths, embedded = false }) {
318
+ let body;
319
+ if (!signedIn) body = /* @__PURE__ */ jsx(ToySignIn, { returnTo: `${paths.exchanges}/${id}`, authPath: paths.auth });
320
+ else if (!TOY_UUID.test(id)) body = /* @__PURE__ */ jsx("p", { children: "This exchange is unavailable." });
321
+ else
322
+ try {
323
+ const thread = await toyCollectionRequest(scope, "/requests/" + id);
324
+ body = /* @__PURE__ */ jsx(ToyExchangeThread, { thread, apiPath: paths.api, listingBasePath: paths.listing, locationsUrl: paths.locations });
325
+ } catch (error) {
326
+ body = error && typeof error === "object" && "status" in error && error.status === 404 ? /* @__PURE__ */ jsx("p", { children: "This exchange is unavailable." }) : /* @__PURE__ */ jsx(LoadError, { error, retry: `${paths.exchanges}/${id}`, account: paths.account, auth: paths.auth });
327
+ }
328
+ return /* @__PURE__ */ jsx(Shell, { paths, signedIn, embedded, children: /* @__PURE__ */ jsxs("section", { className: "toy-story", children: [
329
+ /* @__PURE__ */ jsxs("p", { className: "toy-eyebrow", children: [
330
+ /* @__PURE__ */ jsx("a", { href: paths.account, children: "My toys" }),
331
+ " \xB7 Exchange"
332
+ ] }),
333
+ body
334
+ ] }) });
335
+ }
336
+ async function ToyLocationsPage({ scope, community, signedIn, paths = publicationToyPaths, embedded = false }) {
337
+ let body;
338
+ try {
339
+ const rules = await policy(scope);
340
+ const chosen = resolveToyCommunity(rules.areas, community);
341
+ const places = await toyCollectionRequest({ ...scope, accessToken: void 0 }, "/locations" + (chosen ? "?area_id=" + chosen.id : ""));
342
+ body = /* @__PURE__ */ jsxs(Fragment, { children: [
343
+ /* @__PURE__ */ jsxs("form", { method: "get", className: "toy-filters", children: [
344
+ /* @__PURE__ */ jsxs("label", { children: [
345
+ "Community",
346
+ /* @__PURE__ */ jsxs("select", { name: "community", defaultValue: chosen?.slug || "", children: [
347
+ /* @__PURE__ */ jsx("option", { value: "", children: "All communities" }),
348
+ rules.areas.map((a) => /* @__PURE__ */ jsx("option", { value: a.slug, children: a.name }, a.id))
349
+ ] })
350
+ ] }),
351
+ /* @__PURE__ */ jsx("button", { type: "submit", children: "Show places" })
352
+ ] }),
353
+ /* @__PURE__ */ jsx("p", { className: "toy-safety", children: places.note }),
354
+ places.items.length ? /* @__PURE__ */ jsx("div", { className: "toy-grid", children: places.items.map((location) => /* @__PURE__ */ jsx(ToyLocationCard, { location }, location.id)) }) : /* @__PURE__ */ jsxs("p", { className: "toy-note", children: [
355
+ "No checked meeting places are listed ",
356
+ chosen ? `for ${chosen.name}` : "yet",
357
+ ". Exchanges can't be scheduled until an editor adds one. You can suggest a public place below."
358
+ ] }),
359
+ signedIn ? /* @__PURE__ */ jsx(ToyLocationSuggestForm, { communities: rules.areas, apiPath: paths.api, defaultCommunity: chosen?.id }) : /* @__PURE__ */ jsx("p", { className: "toy-note", children: "Sign in to suggest a public meeting place for editorial review." })
360
+ ] });
361
+ } catch (error) {
362
+ body = /* @__PURE__ */ jsx(LoadError, { error, retry: paths.locations, account: paths.account, auth: paths.auth });
363
+ }
364
+ return /* @__PURE__ */ jsx(Shell, { paths, signedIn, embedded, children: /* @__PURE__ */ jsxs("section", { className: "toy-story", children: [
365
+ /* @__PURE__ */ jsx("p", { className: "toy-eyebrow", children: "Where exchanges happen" }),
366
+ /* @__PURE__ */ jsx("h1", { children: "Public meeting places" }),
367
+ /* @__PURE__ */ jsx("p", { children: "Every place here was checked by an editor against a public source. Listed hours and any facts about lighting, cameras or staffing come from that source and are not guarantees." }),
368
+ body
369
+ ] }) });
370
+ }
371
+ function ToyRulesPage({ paths = publicationToyPaths, signedIn = false, embedded = false }) {
372
+ return /* @__PURE__ */ jsx(Shell, { paths, signedIn, embedded, children: /* @__PURE__ */ jsxs("section", { className: "toy-story", children: [
373
+ /* @__PURE__ */ jsx("p", { className: "toy-eyebrow", children: "ToyRound" }),
374
+ /* @__PURE__ */ jsx("h1", { children: "Rules, prohibited items, privacy & safety" }),
375
+ /* @__PURE__ */ jsx(ToyRulesContent, {})
376
+ ] }) });
377
+ }
378
+
379
+ export { Shell, ToyAccountPage, ToyExchangePage, ToyListingPage, ToyLocationsPage, ToyProfilePage, ToyRulesPage, ToySubmitPage, fetchToyListing, publicationToyPaths, standaloneToyPaths, toyMediaUrl, toyReaderAuthenticated };
package/dist/index.cjs CHANGED
@@ -672,6 +672,7 @@ var NETWORK_NAVIGATION = [
672
672
  editorial("transportation", "Transportation", { group: "news-knowledge", order: 50, more: true }),
673
673
  // More — Local life.
674
674
  { id: "pets", label: "Pets", href: "/pets", kind: "product", group: "local-life", order: 10, more: true },
675
+ { id: "toys", label: "Toy Swap", href: "/toys", kind: "product", group: "local-life", order: 15, more: true },
675
676
  { id: "celebrations", label: "Celebrations", href: "/sections/celebrations", kind: "product", group: "local-life", order: 20, more: true, enabled: false },
676
677
  { id: "community-maps", label: "Community maps", href: "/community-maps", kind: "product", group: "local-life", order: 30, more: true },
677
678
  { id: "town-chat", label: "Town chat", href: "/chat", kind: "product", group: "local-life", order: 40, more: true, feature: "chat" },
package/dist/index.js CHANGED
@@ -1,10 +1,9 @@
1
- export { NetworkCopyrightNotice } from './chunk-DM4KQNJH.js';
2
1
  export { CURATED_COMMUNITY_CARDS, VerifiedCardComponent, VerifiedCardSection, getArticleCards, isSafeActionUrl } from './chunk-FMCHQI7K.js';
3
- export { MEET_ACTIVITIES, activityLabel, canHostMeetup, isAdult, prepareMeetup, screenMessage } from './chunk-AMLVCZDP.js';
4
2
  export { CookieConsentBanner } from './chunk-XPOZGZTM.js';
5
3
  export { CookieSettingsView } from './chunk-GYYUJYI4.js';
6
4
  export { THEME_COOKIE, THEME_EVENT, THEME_MAX_AGE_SECONDS, THEME_STORAGE_KEY, ThemeToggle, applyTheme, clearTheme, getStoredTheme, getSystemTheme, resolveEffectiveTheme, setTheme, subscribeTheme, themeInitScript } from './chunk-NQD3M7ZY.js';
7
5
  export { LocalNetworkBar } from './chunk-F53CPZQO.js';
6
+ export { NetworkCopyrightNotice } from './chunk-DM4KQNJH.js';
8
7
  import { localPublications } from './chunk-6S5FARL3.js';
9
8
  export { COOKIE_CATEGORIES, COOKIE_CONSENT_BACKUP_KEY, COOKIE_CONSENT_EVENT, COOKIE_CONSENT_KEY, COOKIE_CONSENT_MAX_AGE_SECONDS, DEFAULT_CONSENT_HUB_URL, DEFAULT_PREFERENCES_ACCEPTED, DEFAULT_PREFERENCES_REJECTED, EDITORIAL_PRINCIPLES, EU_EEA_UK_COUNTRIES, NETWORK_CONSENT_STORAGE_KEY, NETWORK_PARENT, acceptAllCookies, checkUrlConsentBridge, clearCookieConsent, communityPublications, decorateNetworkUrl, findPublicationByHost, findPublicationBySlug, getCookieConsent, getNetworkPublicationUrl, hasConsented, isCategoryAllowed, isGeoConsentRequired, listedPublications, localPublications, queryNetworkConsentHub, recordConsentToCompliance, rejectOptionalCookies, setCookieConsent, setNetworkConsentHub, topicalPublications } from './chunk-6S5FARL3.js';
10
9
  export { communityMapEmbeds } from './chunk-IMYBSG7J.js';
@@ -12,6 +11,7 @@ export { formatArtworkCaption, parseDocumentBlocks, renderArticleBlocksToHtml, s
12
11
  import { definePublication } from './chunk-57YVL6BD.js';
13
12
  export { BROADSHEET_THEME, FEATURE_NAMES, LAYOUT_COOKIE, acceptRemoteRecord, acceptSnapshot, definePublication, featureEnabled, parseSnapshot, publicationFromSnapshot, publicationRecord, resolveLayout, snapshotFromRecord, syncPublication } from './chunk-57YVL6BD.js';
14
13
  export { CLASSIFIED_CATEGORIES, JOB_EMPLOYMENT_TYPES, categoryLabel, classifiedPath, classifiedSearchPath, clipChars, dealDollars, dealGoPath, dealsFeedPath, employmentLabel, isClassifiedCategory, isEmploymentType, jobEmployerBody, jobOpeningBody, jobPostingBody, prepareClassified, prepareJobPost, publicJobPath, publicJobsPath } from './chunk-C7ZPLH2K.js';
14
+ export { MEET_ACTIVITIES, activityLabel, canHostMeetup, isAdult, prepareMeetup, screenMessage } from './chunk-AMLVCZDP.js';
15
15
  export { SPONSORSHIP_OFFERINGS, SPONSORSHIP_POLICY, placementAvailable, safeSponsorUrl } from './chunk-66GI2IX6.js';
16
16
  import './chunk-AFJ6S5WJ.js';
17
17
  import { jsxs, jsx } from 'react/jsx-runtime';
@@ -615,6 +615,7 @@ var NETWORK_NAVIGATION = [
615
615
  editorial("transportation", "Transportation", { group: "news-knowledge", order: 50, more: true }),
616
616
  // More — Local life.
617
617
  { id: "pets", label: "Pets", href: "/pets", kind: "product", group: "local-life", order: 10, more: true },
618
+ { id: "toys", label: "Toy Swap", href: "/toys", kind: "product", group: "local-life", order: 15, more: true },
618
619
  { id: "celebrations", label: "Celebrations", href: "/sections/celebrations", kind: "product", group: "local-life", order: 20, more: true, enabled: false },
619
620
  { id: "community-maps", label: "Community maps", href: "/community-maps", kind: "product", group: "local-life", order: 30, more: true },
620
621
  { id: "town-chat", label: "Town chat", href: "/chat", kind: "product", group: "local-life", order: 40, more: true, feature: "chat" },
@@ -18,7 +18,7 @@ declare function MeetupDetail({ meetup, joined }: {
18
18
  joined: boolean;
19
19
  }): React.JSX.Element;
20
20
  declare function activityChoices(): {
21
- value: "walk" | "other" | "coffee" | "hike" | "pickleball" | "tennis" | "soccer" | "bike" | "dogs" | "books" | "games" | "kids" | "volunteer";
21
+ value: "walk" | "other" | "games" | "coffee" | "hike" | "pickleball" | "tennis" | "soccer" | "bike" | "dogs" | "books" | "kids" | "volunteer";
22
22
  label: string;
23
23
  }[];
24
24
 
@@ -18,7 +18,7 @@ declare function MeetupDetail({ meetup, joined }: {
18
18
  joined: boolean;
19
19
  }): React.JSX.Element;
20
20
  declare function activityChoices(): {
21
- value: "walk" | "other" | "coffee" | "hike" | "pickleball" | "tennis" | "soccer" | "bike" | "dogs" | "books" | "games" | "kids" | "volunteer";
21
+ value: "walk" | "other" | "games" | "coffee" | "hike" | "pickleball" | "tennis" | "soccer" | "bike" | "dogs" | "books" | "kids" | "volunteer";
22
22
  label: string;
23
23
  }[];
24
24