@scalemule/news-publication 0.0.61 → 0.0.63

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 (68) 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-DM4KQNJH.js → chunk-FWEYKWKP.js} +1 -1
  7. package/dist/{chunk-FMCHQI7K.js → chunk-KYUVXEJY.js} +34 -12
  8. package/dist/{chunk-F53CPZQO.js → chunk-Q77T2S7B.js} +1 -1
  9. package/dist/chunk-SKG5C3MS.js +379 -0
  10. package/dist/{chunk-GYYUJYI4.js → chunk-X7AU7DV6.js} +2 -3
  11. package/dist/{chunk-XPOZGZTM.js → chunk-XSAVJJVW.js} +11 -4
  12. package/dist/{chunk-6S5FARL3.js → chunk-XWXPERLK.js} +2 -2
  13. package/dist/cookie-consent-banner.cjs +10 -3
  14. package/dist/cookie-consent-banner.d.cts +1 -1
  15. package/dist/cookie-consent-banner.d.ts +1 -1
  16. package/dist/cookie-consent-banner.js +2 -2
  17. package/dist/cookie-settings-view.cjs +2 -3
  18. package/dist/cookie-settings-view.js +2 -2
  19. package/dist/index.cjs +60 -18
  20. package/dist/index.d.cts +8 -7
  21. package/dist/index.d.ts +8 -7
  22. package/dist/index.js +10 -8
  23. package/dist/meet-view.d.cts +1 -1
  24. package/dist/meet-view.d.ts +1 -1
  25. package/dist/network-bar.js +2 -2
  26. package/dist/network-copyright.js +2 -2
  27. package/dist/network.js +1 -1
  28. package/dist/pets-plugin.js +4 -347
  29. package/dist/{snapshot-DmRw8G_B.d.ts → snapshot-CjP7bSXJ.d.ts} +1 -1
  30. package/dist/snapshot-file.d.cts +2 -2
  31. package/dist/snapshot-file.d.ts +2 -2
  32. package/dist/{snapshot-Dx4Lv-lB.d.cts → snapshot-qj4BeNzB.d.cts} +1 -1
  33. package/dist/toys-forms.cjs +609 -0
  34. package/dist/toys-forms.d.cts +35 -0
  35. package/dist/toys-forms.d.ts +35 -0
  36. package/dist/toys-forms.js +4 -0
  37. package/dist/toys-interactions.cjs +594 -0
  38. package/dist/toys-interactions.d.cts +54 -0
  39. package/dist/toys-interactions.d.ts +54 -0
  40. package/dist/toys-interactions.js +520 -0
  41. package/dist/toys-plugin.cjs +713 -0
  42. package/dist/toys-plugin.d.cts +88 -0
  43. package/dist/toys-plugin.d.ts +88 -0
  44. package/dist/toys-plugin.js +10 -0
  45. package/dist/toys-publication.cjs +437 -0
  46. package/dist/toys-publication.d.cts +26 -0
  47. package/dist/toys-publication.d.ts +26 -0
  48. package/dist/toys-publication.js +72 -0
  49. package/dist/toys-server.cjs +275 -0
  50. package/dist/toys-server.d.cts +28 -0
  51. package/dist/toys-server.d.ts +28 -0
  52. package/dist/toys-server.js +4 -0
  53. package/dist/toys-view.cjs +420 -0
  54. package/dist/toys-view.d.cts +55 -0
  55. package/dist/toys-view.d.ts +55 -0
  56. package/dist/toys-view.js +2 -0
  57. package/dist/toys.cjs +196 -0
  58. package/dist/toys.d.cts +278 -0
  59. package/dist/toys.d.ts +278 -0
  60. package/dist/toys.js +1 -0
  61. package/dist/{types-BJFCWWi0.d.cts → types-DBi49N8m.d.cts} +12 -3
  62. package/dist/{types-BJFCWWi0.d.ts → types-DBi49N8m.d.ts} +12 -3
  63. package/dist/verified-card.cjs +34 -12
  64. package/dist/verified-card.d.cts +1 -1
  65. package/dist/verified-card.d.ts +1 -1
  66. package/dist/verified-card.js +1 -1
  67. package/package.json +41 -4
  68. package/toys.css +823 -0
@@ -1,349 +1,6 @@
1
- import { LostPetNotice, PetCelebrationCard, AdoptionListingCard, PetEventCard, PetProfileCard, PawMark } from './chunk-7HXSQY4T.js';
1
+ export { PetAccountPage, PetBrowsePage, PetStoryPage, PetSubmitPage, petBrowseLabels, petCollectionRequest, petReaderAuthenticated, publicationPetPaths, standalonePetPaths } from './chunk-6SBK3D3B.js';
2
+ import './chunk-7HXSQY4T.js';
2
3
  import './chunk-4JRWZXAP.js';
3
4
  import './chunk-66GI2IX6.js';
4
- import { petRequest } from './chunk-ABPJMDUG.js';
5
- import { PET_UUID, safePetLink, PET_SAFETY, resolvePetCommunity } from './chunk-AFJ6S5WJ.js';
6
- import { PetSignIn, PetOwnerActions, PetSubmissionForm } from '@scalemule/news-publication/pets-forms';
7
- import { PetPreferencesForm, PetResourceActions, PetSignOut } from '@scalemule/news-publication/pets-interactions';
8
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
9
-
10
- var publicationPetPaths = {
11
- home: "/pets",
12
- account: "/pets/account",
13
- submit: "/pets/submit",
14
- resource: "/pets",
15
- browse: "/pets/browse"
16
- };
17
- var standalonePetPaths = {
18
- home: "/",
19
- account: "/account",
20
- submit: "/submit",
21
- resource: "/pets",
22
- browse: "/browse"
23
- };
24
- function petCollectionRequest(scope, suffix = "") {
25
- return petRequest(
26
- scope,
27
- `/v1/knowledge/community-maps/collections/${scope.collectionSlug}${suffix}`
28
- );
29
- }
30
- async function petReaderAuthenticated(scope) {
31
- if (!scope.accessToken) return false;
32
- try {
33
- const me = await petRequest(
34
- scope,
35
- "/v1/auth/me"
36
- );
37
- return Boolean(me.id && me.email_verified);
38
- } catch {
39
- return false;
40
- }
41
- }
42
- function Shell({
43
- paths,
44
- children,
45
- signedIn
46
- }) {
47
- return /* @__PURE__ */ jsxs("div", { className: "paw", children: [
48
- /* @__PURE__ */ jsxs("header", { className: "paw-page-heading", children: [
49
- /* @__PURE__ */ jsxs("a", { className: "paw-brand", href: paths.home, children: [
50
- /* @__PURE__ */ jsx(PawMark, {}),
51
- "Bay Area Paw"
52
- ] }),
53
- /* @__PURE__ */ jsxs("div", { className: "paw-form-actions", children: [
54
- /* @__PURE__ */ jsx("a", { href: paths.account, children: "My pets" }),
55
- signedIn && /* @__PURE__ */ jsx(PetSignOut, { returnTo: paths.home })
56
- ] })
57
- ] }),
58
- children,
59
- /* @__PURE__ */ jsxs("footer", { className: "paw-footer paw-page-footer", children: [
60
- /* @__PURE__ */ jsxs("a", { href: paths.home, className: "paw-brand", children: [
61
- /* @__PURE__ */ jsx(PawMark, { size: 28 }),
62
- "Bay Area Paw"
63
- ] }),
64
- /* @__PURE__ */ jsx("p", { children: "Happier pets. Closer communities." }),
65
- /* @__PURE__ */ jsx("a", { href: paths.home, children: "Back to your community" })
66
- ] })
67
- ] });
68
- }
69
- function LoadError({
70
- error,
71
- retry,
72
- account
73
- }) {
74
- const status = error && typeof error === "object" && "status" in error ? error.status : void 0;
75
- if (status === 401 || status === 403)
76
- return /* @__PURE__ */ jsxs("div", { className: "paw-load-error", role: "status", children: [
77
- /* @__PURE__ */ jsx("h2", { children: "Reconnect your community account." }),
78
- /* @__PURE__ */ jsx("p", { children: "Your network sign-in gives you access to your pets across participating publications." }),
79
- /* @__PURE__ */ jsx(PetSignIn, { returnTo: retry })
80
- ] });
81
- return /* @__PURE__ */ jsxs("div", { className: "paw-load-error", role: "status", children: [
82
- /* @__PURE__ */ jsx("h2", { children: "We couldn\u2019t open your pet community." }),
83
- /* @__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 to continue." }),
84
- /* @__PURE__ */ jsxs("div", { className: "paw-form-actions", children: [
85
- /* @__PURE__ */ jsx("a", { className: "paw-button", href: retry, children: "Try again" }),
86
- retry !== account && /* @__PURE__ */ jsx("a", { className: "paw-text-link", href: account, children: "Back to My pets" })
87
- ] })
88
- ] });
89
- }
90
- async function PetAccountPage({
91
- scope,
92
- signedIn,
93
- paths = publicationPetPaths,
94
- after,
95
- signInEnabled = true
96
- }) {
97
- let body;
98
- if (!signedIn)
99
- body = signInEnabled ? /* @__PURE__ */ jsx(PetSignIn, { returnTo: paths.account }) : /* @__PURE__ */ jsx("p", { children: "Community sign-in is being prepared. Public browsing is open." });
100
- else
101
- try {
102
- const [own, preferences, collection] = await Promise.all([
103
- petCollectionRequest(
104
- scope,
105
- "/pets/mine" + (after && PET_UUID.test(after) ? "?after=" + after : "")
106
- ),
107
- petCollectionRequest(scope, "/pets/preferences"),
108
- petCollectionRequest(scope)
109
- ]);
110
- body = /* @__PURE__ */ jsxs(Fragment, { children: [
111
- /* @__PURE__ */ jsx("p", { className: "paw-intro", children: "A home for their stories, wherever you read your local news." }),
112
- !own.items.length && /* @__PURE__ */ jsx("p", { children: "Your pet\u2019s story starts here. Create a private profile or share a contribution with the community." }),
113
- own.items.map((resource) => /* @__PURE__ */ jsxs("article", { className: "paw-account-row", children: [
114
- /* @__PURE__ */ jsx("h2", { children: resource.content.name }),
115
- /* @__PURE__ */ jsx("p", { children: resource.visibility === "private" ? "Private \u2014 only you" : resource.status === "published" ? "Editorially published; visibility follows its scheduled dates" : resource.status.replaceAll("_", " ") }),
116
- resource.review_note && /* @__PURE__ */ jsxs("p", { children: [
117
- "Editorial note: ",
118
- resource.review_note
119
- ] }),
120
- /* @__PURE__ */ jsx(PetOwnerActions, { resource, submitUrl: paths.submit })
121
- ] }, resource.id)),
122
- own.next_cursor && /* @__PURE__ */ jsx("a", { href: paths.account + "?after=" + own.next_cursor, children: "More contributions" }),
123
- /* @__PURE__ */ jsx("p", { children: /* @__PURE__ */ jsx("a", { className: "paw-button", href: paths.submit, children: "Add a pet or story" }) }),
124
- /* @__PURE__ */ jsx(
125
- PetPreferencesForm,
126
- {
127
- record: preferences,
128
- communities: preferences.communities || collection.areas
129
- }
130
- )
131
- ] });
132
- } catch (error) {
133
- body = /* @__PURE__ */ jsx(
134
- LoadError,
135
- {
136
- error,
137
- retry: paths.account,
138
- account: paths.account
139
- }
140
- );
141
- }
142
- return /* @__PURE__ */ jsx(Shell, { paths, signedIn, children: /* @__PURE__ */ jsxs("section", { className: "paw-story", children: [
143
- /* @__PURE__ */ jsx("p", { className: "paw-eyebrow", children: "Your community account" }),
144
- /* @__PURE__ */ jsx("h1", { children: "A home for your pets." }),
145
- body
146
- ] }) });
147
- }
148
- async function PetSubmitPage({
149
- scope,
150
- signedIn,
151
- paths = publicationPetPaths,
152
- edit,
153
- community,
154
- submissionsEnabled = true
155
- }) {
156
- let form;
157
- const next = paths.submit + "?" + new URLSearchParams({
158
- ...edit ? { edit } : {},
159
- ...community ? { community } : {}
160
- });
161
- if (!submissionsEnabled)
162
- form = /* @__PURE__ */ jsxs("section", { className: "paw-form", children: [
163
- /* @__PURE__ */ jsx("h1", { children: "We\u2019re getting ready to meet your pets." }),
164
- /* @__PURE__ */ jsx("p", { children: "Contributions will open when our local review team and photo-sharing experience are ready." })
165
- ] });
166
- else if (!signedIn)
167
- form = /* @__PURE__ */ jsxs("section", { className: "paw-form", children: [
168
- /* @__PURE__ */ jsxs("h1", { children: [
169
- "A familiar sign-in.",
170
- /* @__PURE__ */ jsx("br", {}),
171
- "A new place to belong."
172
- ] }),
173
- /* @__PURE__ */ jsx(PetSignIn, { returnTo: next })
174
- ] });
175
- else
176
- try {
177
- const [collection, own, initial, preferences] = await Promise.all([
178
- petCollectionRequest(scope),
179
- petCollectionRequest(scope, "/pets/mine"),
180
- edit && PET_UUID.test(edit) ? petCollectionRequest(scope, "/pets/mine/" + edit) : void 0,
181
- edit ? petCollectionRequest(scope, "/pets/preferences") : void 0
182
- ]);
183
- const currentHome = preferences?.communities?.find(
184
- (a) => a.id === initial?.area_id
185
- );
186
- const editCommunities = currentHome && !collection.areas.some((a) => a.id === currentHome.id) ? [...collection.areas, currentHome] : collection.areas;
187
- form = edit && !initial ? /* @__PURE__ */ jsx("p", { children: "This contribution is unavailable. Open it from My pets." }) : /* @__PURE__ */ jsx(
188
- PetSubmissionForm,
189
- {
190
- communities: editCommunities,
191
- policy: collection.submission_policy,
192
- profiles: own.items.filter((p) => p.kind === "profile"),
193
- initial,
194
- defaultCommunity: collection.areas.find((a) => a.slug === community)?.id,
195
- accountUrl: paths.account
196
- }
197
- );
198
- } catch (error) {
199
- form = /* @__PURE__ */ jsxs("section", { className: "paw-form", children: [
200
- /* @__PURE__ */ jsx("h1", { children: "Let\u2019s meet your pet." }),
201
- /* @__PURE__ */ jsx(LoadError, { error, retry: next, account: paths.account })
202
- ] });
203
- }
204
- return /* @__PURE__ */ jsx(Shell, { paths, children: form });
205
- }
206
- function PetStoryPage({
207
- resource,
208
- communities,
209
- signedIn,
210
- paths = publicationPetPaths,
211
- canonicalOrigin
212
- }) {
213
- const c = resource.content, photoUrl = (photo) => `/api/pets/${resource.id}/media/${photo}`, source = c.source && safePetLink(c.source.official_url);
214
- return /* @__PURE__ */ jsx(Shell, { paths, children: /* @__PURE__ */ jsxs(
215
- "article",
216
- {
217
- className: `paw-story${c.category === "memorial" ? " paw-memorial" : ""}`,
218
- children: [
219
- /* @__PURE__ */ jsx("p", { className: "paw-context", children: communities.find((a) => a.id === resource.area_id)?.name }),
220
- /* @__PURE__ */ jsxs("h1", { children: [
221
- c.category === "memorial" ? "Remembering " : "Meet ",
222
- c.name,
223
- "."
224
- ] }),
225
- resource.media.map((photo, index) => /* @__PURE__ */ jsxs("figure", { children: [
226
- /* @__PURE__ */ jsxs("picture", { children: [
227
- /* @__PURE__ */ jsx(
228
- "source",
229
- {
230
- type: "image/webp",
231
- srcSet: `${photoUrl(photo.id)}?width=640&format=webp 640w, ${photoUrl(photo.id)}?width=1280&format=webp 1280w`,
232
- sizes: "(max-width: 850px) 100vw, 800px"
233
- }
234
- ),
235
- /* @__PURE__ */ jsx(
236
- "img",
237
- {
238
- src: `${photoUrl(photo.id)}?width=1280&format=jpeg`,
239
- alt: photo.caption || c.name,
240
- width: 1200,
241
- height: 900,
242
- loading: index ? "lazy" : "eager"
243
- }
244
- )
245
- ] }),
246
- /* @__PURE__ */ jsx("figcaption", { children: photo.attribution })
247
- ] }, photo.id)),
248
- /* @__PURE__ */ jsx("p", { children: c.story }),
249
- c.personality && /* @__PURE__ */ jsx("p", { children: c.personality }),
250
- c.activities.length > 0 && /* @__PURE__ */ jsxs("p", { children: [
251
- "Favorite things: ",
252
- c.activities.join(", "),
253
- "."
254
- ] }),
255
- c.attribution && /* @__PURE__ */ jsxs("p", { className: "paw-credit", children: [
256
- "Shared by ",
257
- c.attribution
258
- ] }),
259
- ["lost", "found"].includes(resource.kind) && /* @__PURE__ */ jsxs("aside", { className: "paw-safety", children: [
260
- /* @__PURE__ */ jsx("p", { children: resource.reunited_at ? "Reported reunited." : "A community report." }),
261
- /* @__PURE__ */ jsx("p", { children: PET_SAFETY.recovery }),
262
- /* @__PURE__ */ jsx("p", { children: "Private recovery contact is not available yet. Do not post contact details in public." })
263
- ] }),
264
- source && /* @__PURE__ */ jsxs("a", { href: source, rel: "noopener noreferrer", children: [
265
- "Visit ",
266
- c.source.organization,
267
- " for current information"
268
- ] }),
269
- /* @__PURE__ */ jsx("p", { children: /* @__PURE__ */ jsx("a", { href: canonicalOrigin + "/pets/" + resource.id, children: "Permanent link to this story" }) }),
270
- /* @__PURE__ */ jsx(
271
- PetResourceActions,
272
- {
273
- resource,
274
- signedIn,
275
- accountUrl: paths.account
276
- }
277
- ),
278
- /* @__PURE__ */ jsx("a", { href: paths.home, children: "More community pets" })
279
- ]
280
- }
281
- ) });
282
- }
283
- var petBrowseLabels = {
284
- neighbors: "Friends around the corner",
285
- profile: "Meet our pets",
286
- photo: "The community photo board",
287
- lost_found: "Let\u2019s help them get home.",
288
- celebration: "Little milestones. Lasting memories.",
289
- adoption: "A new chapter starts with hello.",
290
- event: "Good things to get together for."
291
- };
292
- async function PetBrowsePage({
293
- scope,
294
- kind,
295
- query,
296
- paths = publicationPetPaths
297
- }) {
298
- let body;
299
- try {
300
- const collection = await petCollectionRequest(scope), chosen = resolvePetCommunity(collection.areas, query.community);
301
- const filter = new URLSearchParams({ kind });
302
- if (chosen) filter.set("area_id", chosen.id);
303
- for (const key of ["after", "species", "category"])
304
- if (query[key]) filter.set(key, query[key]);
305
- const result = await petCollectionRequest(scope, "/pets?" + filter);
306
- const Card = kind === "lost_found" ? LostPetNotice : kind === "celebration" ? PetCelebrationCard : kind === "adoption" ? AdoptionListingCard : kind === "event" ? PetEventCard : PetProfileCard;
307
- const next = new URLSearchParams(
308
- Object.entries(query).filter(
309
- (e) => typeof e[1] === "string"
310
- )
311
- );
312
- if (result.next_cursor) next.set("after", result.next_cursor);
313
- body = /* @__PURE__ */ jsxs(Fragment, { children: [
314
- /* @__PURE__ */ jsxs("form", { className: "paw-filters", method: "get", children: [
315
- /* @__PURE__ */ jsxs("label", { children: [
316
- "Community",
317
- /* @__PURE__ */ jsxs("select", { name: "community", defaultValue: chosen?.slug || "", children: [
318
- /* @__PURE__ */ jsx("option", { value: "", children: "All local communities" }),
319
- collection.areas.map((a) => /* @__PURE__ */ jsx("option", { value: a.slug, children: a.name }, a.id))
320
- ] })
321
- ] }),
322
- /* @__PURE__ */ jsxs("label", { children: [
323
- "Species",
324
- /* @__PURE__ */ jsx("input", { name: "species", maxLength: 50, defaultValue: query.species })
325
- ] }),
326
- /* @__PURE__ */ jsx("button", { children: "Browse" })
327
- ] }),
328
- result.items.length ? /* @__PURE__ */ jsx("div", { className: "paw-gallery", children: result.items.map((r) => /* @__PURE__ */ jsx(
329
- Card,
330
- {
331
- resource: r,
332
- community: collection.areas.find((a) => a.id === r.area_id)?.name || "Our community",
333
- href: paths.resource + "/" + r.id,
334
- mediaUrl: (id, media) => `/api/pets/${id}/media/${media}`
335
- },
336
- r.id
337
- )) }) : /* @__PURE__ */ jsx("p", { className: "paw-empty", children: "No reviewed public contributions match these filters." }),
338
- result.next_cursor && /* @__PURE__ */ jsx("a", { className: "paw-button", href: "?" + next, children: "Next page" })
339
- ] });
340
- } catch {
341
- body = /* @__PURE__ */ jsx("p", { role: "status", children: "The community board is temporarily unavailable. Please try again shortly." });
342
- }
343
- return /* @__PURE__ */ jsx(Shell, { paths, children: /* @__PURE__ */ jsxs("section", { className: "paw-section", children: [
344
- /* @__PURE__ */ jsx("h1", { children: petBrowseLabels[kind] || "Community pets" }),
345
- body
346
- ] }) });
347
- }
348
-
349
- export { PetAccountPage, PetBrowsePage, PetStoryPage, PetSubmitPage, petBrowseLabels, petCollectionRequest, petReaderAuthenticated, publicationPetPaths, standalonePetPaths };
5
+ import './chunk-ABPJMDUG.js';
6
+ import './chunk-AFJ6S5WJ.js';
@@ -1,4 +1,4 @@
1
- import { P as PublicationInput, N as NewsPublication } from './types-BJFCWWi0.js';
1
+ import { P as PublicationInput, N as NewsPublication } from './types-DBi49N8m.js';
2
2
 
3
3
  /**
4
4
  * Serializable application config. Code hooks (`matchTag`, `coupons.resolve`)
@@ -1,5 +1,5 @@
1
- import { P as PublicationSnapshot, S as SnapshotHooks, a as SyncedPublication } from './snapshot-Dx4Lv-lB.cjs';
2
- import './types-BJFCWWi0.cjs';
1
+ import { P as PublicationSnapshot, S as SnapshotHooks, a as SyncedPublication } from './snapshot-qj4BeNzB.cjs';
2
+ import './types-DBi49N8m.cjs';
3
3
 
4
4
  declare function readSnapshotFile(file: string): Promise<PublicationSnapshot | null>;
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { P as PublicationSnapshot, S as SnapshotHooks, a as SyncedPublication } from './snapshot-DmRw8G_B.js';
2
- import './types-BJFCWWi0.js';
1
+ import { P as PublicationSnapshot, S as SnapshotHooks, a as SyncedPublication } from './snapshot-CjP7bSXJ.js';
2
+ import './types-DBi49N8m.js';
3
3
 
4
4
  declare function readSnapshotFile(file: string): Promise<PublicationSnapshot | null>;
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { P as PublicationInput, N as NewsPublication } from './types-BJFCWWi0.cjs';
1
+ import { P as PublicationInput, N as NewsPublication } from './types-DBi49N8m.cjs';
2
2
 
3
3
  /**
4
4
  * Serializable application config. Code hooks (`matchTag`, `coupons.resolve`)