@scalemule/news-publication 0.0.49 → 0.0.51
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.
- package/README.md +26 -0
- package/dist/{chunk-ZXH3O537.js → chunk-ABPJMDUG.js} +1 -1
- package/dist/{chunk-MBBPEFDA.js → chunk-AFJ6S5WJ.js} +1 -1
- package/dist/{chunk-2MEYHM7M.js → chunk-AMLVCZDP.js} +1 -1
- package/dist/{chunk-TTLM7YOH.js → chunk-QW3OZB22.js} +183 -11
- package/dist/index.js +3 -3
- package/dist/meet-forms.js +2 -2
- package/dist/meet-view.d.cts +1 -1
- package/dist/meet-view.d.ts +1 -1
- package/dist/meet-view.js +2 -2
- package/dist/pets-auth-server.cjs +59 -14
- package/dist/pets-auth-server.d.cts +7 -1
- package/dist/pets-auth-server.d.ts +7 -1
- package/dist/pets-auth-server.js +60 -17
- package/dist/pets-forms.cjs +8 -4
- package/dist/pets-forms.d.cts +4 -2
- package/dist/pets-forms.d.ts +4 -2
- package/dist/pets-forms.js +10 -6
- package/dist/pets-interactions.cjs +6 -5
- package/dist/pets-interactions.d.cts +5 -2
- package/dist/pets-interactions.d.ts +5 -2
- package/dist/pets-interactions.js +7 -6
- package/dist/pets-plugin.cjs +551 -0
- package/dist/pets-plugin.d.cts +50 -0
- package/dist/pets-plugin.d.ts +50 -0
- package/dist/pets-plugin.js +317 -0
- package/dist/pets-publication.cjs +230 -34
- package/dist/pets-publication.d.cts +7 -3
- package/dist/pets-publication.d.ts +7 -3
- package/dist/pets-publication.js +51 -27
- package/dist/pets-server.js +2 -2
- package/dist/pets-view.cjs +182 -9
- package/dist/pets-view.d.cts +3 -1
- package/dist/pets-view.d.ts +3 -1
- package/dist/pets-view.js +2 -2
- package/dist/pets.cjs +1 -1
- package/dist/pets.js +1 -1
- package/package.json +6 -1
- package/pets.css +215 -7
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import { LostPetNotice, PetCelebrationCard, AdoptionListingCard, PetEventCard, PetProfileCard, PawMark } from './chunk-QW3OZB22.js';
|
|
2
|
+
import './chunk-4JRWZXAP.js';
|
|
3
|
+
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
|
+
] });
|
|
60
|
+
}
|
|
61
|
+
async function PetAccountPage({
|
|
62
|
+
scope,
|
|
63
|
+
signedIn,
|
|
64
|
+
paths = publicationPetPaths,
|
|
65
|
+
after,
|
|
66
|
+
signInEnabled = true
|
|
67
|
+
}) {
|
|
68
|
+
let body;
|
|
69
|
+
if (!signedIn)
|
|
70
|
+
body = signInEnabled ? /* @__PURE__ */ jsx(PetSignIn, { returnTo: paths.account }) : /* @__PURE__ */ jsx("p", { children: "Community sign-in is being prepared. Public browsing is open." });
|
|
71
|
+
else
|
|
72
|
+
try {
|
|
73
|
+
const [own, preferences, collection] = await Promise.all([
|
|
74
|
+
petCollectionRequest(
|
|
75
|
+
scope,
|
|
76
|
+
"/pets/mine" + (after && PET_UUID.test(after) ? "?after=" + after : "")
|
|
77
|
+
),
|
|
78
|
+
petCollectionRequest(scope, "/pets/preferences"),
|
|
79
|
+
petCollectionRequest(scope)
|
|
80
|
+
]);
|
|
81
|
+
body = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
82
|
+
/* @__PURE__ */ jsx("p", { className: "paw-intro", children: "A home for their stories, wherever you read your local news." }),
|
|
83
|
+
!own.items.length && /* @__PURE__ */ jsx("p", { children: "Your pet\u2019s story starts here. Create a private profile or share a contribution with the community." }),
|
|
84
|
+
own.items.map((resource) => /* @__PURE__ */ jsxs("article", { className: "paw-account-row", children: [
|
|
85
|
+
/* @__PURE__ */ jsx("h2", { children: resource.content.name }),
|
|
86
|
+
/* @__PURE__ */ jsx("p", { children: resource.visibility === "private" ? "Private \u2014 only you" : resource.status === "published" ? "Editorially published; visibility follows its scheduled dates" : resource.status.replaceAll("_", " ") }),
|
|
87
|
+
resource.review_note && /* @__PURE__ */ jsxs("p", { children: [
|
|
88
|
+
"Editorial note: ",
|
|
89
|
+
resource.review_note
|
|
90
|
+
] }),
|
|
91
|
+
/* @__PURE__ */ jsx(PetOwnerActions, { resource, submitUrl: paths.submit })
|
|
92
|
+
] }, resource.id)),
|
|
93
|
+
own.next_cursor && /* @__PURE__ */ jsx("a", { href: paths.account + "?after=" + own.next_cursor, children: "More contributions" }),
|
|
94
|
+
/* @__PURE__ */ jsx("p", { children: /* @__PURE__ */ jsx("a", { className: "paw-button", href: paths.submit, children: "Add a pet or story" }) }),
|
|
95
|
+
/* @__PURE__ */ jsx(
|
|
96
|
+
PetPreferencesForm,
|
|
97
|
+
{
|
|
98
|
+
record: preferences,
|
|
99
|
+
communities: preferences.communities || collection.areas
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
] });
|
|
103
|
+
} catch (error) {
|
|
104
|
+
body = error && typeof error === "object" && "status" in error && error.status === 403 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
105
|
+
/* @__PURE__ */ jsx("p", { children: "Connect your network sign-in to open this pet community." }),
|
|
106
|
+
/* @__PURE__ */ jsx(PetSignIn, { returnTo: paths.account })
|
|
107
|
+
] }) : /* @__PURE__ */ jsx("p", { role: "status", children: "Your pets could not be loaded. Please try again shortly." });
|
|
108
|
+
}
|
|
109
|
+
return /* @__PURE__ */ jsx(Shell, { paths, signedIn, children: /* @__PURE__ */ jsxs("section", { className: "paw-story", children: [
|
|
110
|
+
/* @__PURE__ */ jsx("p", { className: "paw-eyebrow", children: "Your community account" }),
|
|
111
|
+
/* @__PURE__ */ jsxs("h1", { children: [
|
|
112
|
+
"Your pets.",
|
|
113
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
114
|
+
"Your little corner."
|
|
115
|
+
] }),
|
|
116
|
+
body
|
|
117
|
+
] }) });
|
|
118
|
+
}
|
|
119
|
+
async function PetSubmitPage({
|
|
120
|
+
scope,
|
|
121
|
+
signedIn,
|
|
122
|
+
paths = publicationPetPaths,
|
|
123
|
+
edit,
|
|
124
|
+
community,
|
|
125
|
+
submissionsEnabled = true
|
|
126
|
+
}) {
|
|
127
|
+
let form;
|
|
128
|
+
const next = paths.submit + "?" + new URLSearchParams({
|
|
129
|
+
...edit ? { edit } : {},
|
|
130
|
+
...community ? { community } : {}
|
|
131
|
+
});
|
|
132
|
+
if (!submissionsEnabled)
|
|
133
|
+
form = /* @__PURE__ */ jsxs("section", { className: "paw-form", children: [
|
|
134
|
+
/* @__PURE__ */ jsx("h1", { children: "We\u2019re getting ready to meet your pets." }),
|
|
135
|
+
/* @__PURE__ */ jsx("p", { children: "Contributions will open when our local review team and photo-sharing experience are ready." })
|
|
136
|
+
] });
|
|
137
|
+
else if (!signedIn)
|
|
138
|
+
form = /* @__PURE__ */ jsxs("section", { className: "paw-form", children: [
|
|
139
|
+
/* @__PURE__ */ jsxs("h1", { children: [
|
|
140
|
+
"A familiar sign-in.",
|
|
141
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
142
|
+
"A new place to belong."
|
|
143
|
+
] }),
|
|
144
|
+
/* @__PURE__ */ jsx(PetSignIn, { returnTo: next })
|
|
145
|
+
] });
|
|
146
|
+
else
|
|
147
|
+
try {
|
|
148
|
+
const [collection, own, initial, preferences] = await Promise.all([
|
|
149
|
+
petCollectionRequest(scope),
|
|
150
|
+
petCollectionRequest(scope, "/pets/mine"),
|
|
151
|
+
edit && PET_UUID.test(edit) ? petCollectionRequest(scope, "/pets/mine/" + edit) : void 0,
|
|
152
|
+
edit ? petCollectionRequest(scope, "/pets/preferences") : void 0
|
|
153
|
+
]);
|
|
154
|
+
const currentHome = preferences?.communities?.find(
|
|
155
|
+
(a) => a.id === initial?.area_id
|
|
156
|
+
);
|
|
157
|
+
const editCommunities = currentHome && !collection.areas.some((a) => a.id === currentHome.id) ? [...collection.areas, currentHome] : collection.areas;
|
|
158
|
+
form = edit && !initial ? /* @__PURE__ */ jsx("p", { children: "This contribution is unavailable. Open it from My pets." }) : /* @__PURE__ */ jsx(
|
|
159
|
+
PetSubmissionForm,
|
|
160
|
+
{
|
|
161
|
+
communities: editCommunities,
|
|
162
|
+
policy: collection.submission_policy,
|
|
163
|
+
profiles: own.items.filter((p) => p.kind === "profile"),
|
|
164
|
+
initial,
|
|
165
|
+
defaultCommunity: collection.areas.find((a) => a.slug === community)?.id,
|
|
166
|
+
accountUrl: paths.account
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
} catch {
|
|
170
|
+
form = /* @__PURE__ */ jsx("p", { role: "status", children: "This contribution could not be loaded. Open it from My pets or try again shortly." });
|
|
171
|
+
}
|
|
172
|
+
return /* @__PURE__ */ jsx(Shell, { paths, children: form });
|
|
173
|
+
}
|
|
174
|
+
function PetStoryPage({
|
|
175
|
+
resource,
|
|
176
|
+
communities,
|
|
177
|
+
signedIn,
|
|
178
|
+
paths = publicationPetPaths,
|
|
179
|
+
canonicalOrigin
|
|
180
|
+
}) {
|
|
181
|
+
const c = resource.content, photoUrl = (photo) => `/api/pets/${resource.id}/media/${photo}`, source = c.source && safePetLink(c.source.official_url);
|
|
182
|
+
return /* @__PURE__ */ jsx(Shell, { paths, children: /* @__PURE__ */ jsxs(
|
|
183
|
+
"article",
|
|
184
|
+
{
|
|
185
|
+
className: `paw-story${c.category === "memorial" ? " paw-memorial" : ""}`,
|
|
186
|
+
children: [
|
|
187
|
+
/* @__PURE__ */ jsx("p", { className: "paw-context", children: communities.find((a) => a.id === resource.area_id)?.name }),
|
|
188
|
+
/* @__PURE__ */ jsxs("h1", { children: [
|
|
189
|
+
c.category === "memorial" ? "Remembering " : "Meet ",
|
|
190
|
+
c.name,
|
|
191
|
+
"."
|
|
192
|
+
] }),
|
|
193
|
+
resource.media.map((photo, index) => /* @__PURE__ */ jsxs("figure", { children: [
|
|
194
|
+
/* @__PURE__ */ jsxs("picture", { children: [
|
|
195
|
+
/* @__PURE__ */ jsx(
|
|
196
|
+
"source",
|
|
197
|
+
{
|
|
198
|
+
type: "image/webp",
|
|
199
|
+
srcSet: `${photoUrl(photo.id)}?width=640&format=webp 640w, ${photoUrl(photo.id)}?width=1280&format=webp 1280w`,
|
|
200
|
+
sizes: "(max-width: 850px) 100vw, 800px"
|
|
201
|
+
}
|
|
202
|
+
),
|
|
203
|
+
/* @__PURE__ */ jsx(
|
|
204
|
+
"img",
|
|
205
|
+
{
|
|
206
|
+
src: `${photoUrl(photo.id)}?width=1280&format=jpeg`,
|
|
207
|
+
alt: photo.caption || c.name,
|
|
208
|
+
width: 1200,
|
|
209
|
+
height: 900,
|
|
210
|
+
loading: index ? "lazy" : "eager"
|
|
211
|
+
}
|
|
212
|
+
)
|
|
213
|
+
] }),
|
|
214
|
+
/* @__PURE__ */ jsx("figcaption", { children: photo.attribution })
|
|
215
|
+
] }, photo.id)),
|
|
216
|
+
/* @__PURE__ */ jsx("p", { children: c.story }),
|
|
217
|
+
c.personality && /* @__PURE__ */ jsx("p", { children: c.personality }),
|
|
218
|
+
c.activities.length > 0 && /* @__PURE__ */ jsxs("p", { children: [
|
|
219
|
+
"Favorite things: ",
|
|
220
|
+
c.activities.join(", "),
|
|
221
|
+
"."
|
|
222
|
+
] }),
|
|
223
|
+
c.attribution && /* @__PURE__ */ jsxs("p", { className: "paw-credit", children: [
|
|
224
|
+
"Shared by ",
|
|
225
|
+
c.attribution
|
|
226
|
+
] }),
|
|
227
|
+
["lost", "found"].includes(resource.kind) && /* @__PURE__ */ jsxs("aside", { className: "paw-safety", children: [
|
|
228
|
+
/* @__PURE__ */ jsx("p", { children: resource.reunited_at ? "Reported reunited." : "A community report." }),
|
|
229
|
+
/* @__PURE__ */ jsx("p", { children: PET_SAFETY.recovery }),
|
|
230
|
+
/* @__PURE__ */ jsx("p", { children: "Private recovery contact is not available yet. Do not post contact details in public." })
|
|
231
|
+
] }),
|
|
232
|
+
source && /* @__PURE__ */ jsxs("a", { href: source, rel: "noopener noreferrer", children: [
|
|
233
|
+
"Visit ",
|
|
234
|
+
c.source.organization,
|
|
235
|
+
" for current information"
|
|
236
|
+
] }),
|
|
237
|
+
/* @__PURE__ */ jsx("p", { children: /* @__PURE__ */ jsx("a", { href: canonicalOrigin + "/pets/" + resource.id, children: "Permanent link to this story" }) }),
|
|
238
|
+
/* @__PURE__ */ jsx(
|
|
239
|
+
PetResourceActions,
|
|
240
|
+
{
|
|
241
|
+
resource,
|
|
242
|
+
signedIn,
|
|
243
|
+
accountUrl: paths.account
|
|
244
|
+
}
|
|
245
|
+
),
|
|
246
|
+
/* @__PURE__ */ jsx("a", { href: paths.home, children: "More community pets" })
|
|
247
|
+
]
|
|
248
|
+
}
|
|
249
|
+
) });
|
|
250
|
+
}
|
|
251
|
+
var petBrowseLabels = {
|
|
252
|
+
neighbors: "Friends around the corner",
|
|
253
|
+
profile: "Meet our pets",
|
|
254
|
+
photo: "The community photo board",
|
|
255
|
+
lost_found: "Let\u2019s help them get home.",
|
|
256
|
+
celebration: "Little milestones. Lasting memories.",
|
|
257
|
+
adoption: "A new chapter starts with hello.",
|
|
258
|
+
event: "Good things to get together for."
|
|
259
|
+
};
|
|
260
|
+
async function PetBrowsePage({
|
|
261
|
+
scope,
|
|
262
|
+
kind,
|
|
263
|
+
query,
|
|
264
|
+
paths = publicationPetPaths
|
|
265
|
+
}) {
|
|
266
|
+
let body;
|
|
267
|
+
try {
|
|
268
|
+
const collection = await petCollectionRequest(scope), chosen = resolvePetCommunity(collection.areas, query.community);
|
|
269
|
+
const filter = new URLSearchParams({ kind });
|
|
270
|
+
if (chosen) filter.set("area_id", chosen.id);
|
|
271
|
+
for (const key of ["after", "species", "category"])
|
|
272
|
+
if (query[key]) filter.set(key, query[key]);
|
|
273
|
+
const result = await petCollectionRequest(scope, "/pets?" + filter);
|
|
274
|
+
const Card = kind === "lost_found" ? LostPetNotice : kind === "celebration" ? PetCelebrationCard : kind === "adoption" ? AdoptionListingCard : kind === "event" ? PetEventCard : PetProfileCard;
|
|
275
|
+
const next = new URLSearchParams(
|
|
276
|
+
Object.entries(query).filter(
|
|
277
|
+
(e) => typeof e[1] === "string"
|
|
278
|
+
)
|
|
279
|
+
);
|
|
280
|
+
if (result.next_cursor) next.set("after", result.next_cursor);
|
|
281
|
+
body = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
282
|
+
/* @__PURE__ */ jsxs("form", { className: "paw-filters", method: "get", children: [
|
|
283
|
+
/* @__PURE__ */ jsxs("label", { children: [
|
|
284
|
+
"Community",
|
|
285
|
+
/* @__PURE__ */ jsxs("select", { name: "community", defaultValue: chosen?.slug || "", children: [
|
|
286
|
+
/* @__PURE__ */ jsx("option", { value: "", children: "All local communities" }),
|
|
287
|
+
collection.areas.map((a) => /* @__PURE__ */ jsx("option", { value: a.slug, children: a.name }, a.id))
|
|
288
|
+
] })
|
|
289
|
+
] }),
|
|
290
|
+
/* @__PURE__ */ jsxs("label", { children: [
|
|
291
|
+
"Species",
|
|
292
|
+
/* @__PURE__ */ jsx("input", { name: "species", maxLength: 50, defaultValue: query.species })
|
|
293
|
+
] }),
|
|
294
|
+
/* @__PURE__ */ jsx("button", { children: "Browse" })
|
|
295
|
+
] }),
|
|
296
|
+
result.items.length ? /* @__PURE__ */ jsx("div", { className: "paw-gallery", children: result.items.map((r) => /* @__PURE__ */ jsx(
|
|
297
|
+
Card,
|
|
298
|
+
{
|
|
299
|
+
resource: r,
|
|
300
|
+
community: collection.areas.find((a) => a.id === r.area_id)?.name || "Our community",
|
|
301
|
+
href: paths.resource + "/" + r.id,
|
|
302
|
+
mediaUrl: (id, media) => `/api/pets/${id}/media/${media}`
|
|
303
|
+
},
|
|
304
|
+
r.id
|
|
305
|
+
)) }) : /* @__PURE__ */ jsx("p", { className: "paw-empty", children: "No reviewed public contributions match these filters." }),
|
|
306
|
+
result.next_cursor && /* @__PURE__ */ jsx("a", { className: "paw-button", href: "?" + next, children: "Next page" })
|
|
307
|
+
] });
|
|
308
|
+
} catch {
|
|
309
|
+
body = /* @__PURE__ */ jsx("p", { role: "status", children: "The community board is temporarily unavailable. Please try again shortly." });
|
|
310
|
+
}
|
|
311
|
+
return /* @__PURE__ */ jsx(Shell, { paths, children: /* @__PURE__ */ jsxs("section", { className: "paw-section", children: [
|
|
312
|
+
/* @__PURE__ */ jsx("h1", { children: petBrowseLabels[kind] || "Community pets" }),
|
|
313
|
+
body
|
|
314
|
+
] }) });
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
export { PetAccountPage, PetBrowsePage, PetStoryPage, PetSubmitPage, petBrowseLabels, petCollectionRequest, petReaderAuthenticated, publicationPetPaths, standalonePetPaths };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var petsInteractions = require('@scalemule/news-publication/pets-interactions');
|
|
3
4
|
var sdk = require('@scalemule/sdk');
|
|
4
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
6
|
var react = require('react');
|
|
6
7
|
|
|
7
|
-
// src/pets-
|
|
8
|
+
// src/pets-publication.tsx
|
|
8
9
|
|
|
9
10
|
// src/pets.ts
|
|
10
11
|
var PET_KINDS = [
|
|
@@ -38,7 +39,7 @@ function petReferences(metadata) {
|
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
41
|
function resolvePetCommunity(areas, selected, preference, publicationDefault) {
|
|
41
|
-
if (selected === "") return void 0;
|
|
42
|
+
if (selected === "" || selected === void 0 && preference === "all") return void 0;
|
|
42
43
|
for (const candidate of [selected, preference, publicationDefault]) {
|
|
43
44
|
const found = areas.find(
|
|
44
45
|
(area) => area.id === candidate || area.slug === candidate
|
|
@@ -253,6 +254,181 @@ function PawMark({ size = 36 }) {
|
|
|
253
254
|
}
|
|
254
255
|
);
|
|
255
256
|
}
|
|
257
|
+
function PawNeighborhoodIllustration() {
|
|
258
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
259
|
+
"svg",
|
|
260
|
+
{
|
|
261
|
+
className: "paw-neighborhood-art",
|
|
262
|
+
viewBox: "0 0 520 460",
|
|
263
|
+
fill: "none",
|
|
264
|
+
"aria-hidden": "true",
|
|
265
|
+
children: [
|
|
266
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
267
|
+
"path",
|
|
268
|
+
{
|
|
269
|
+
d: "M42 233C42 111 124 29 257 29c134 0 220 102 220 218v153H42V233Z",
|
|
270
|
+
fill: "var(--paw-art-sky)"
|
|
271
|
+
}
|
|
272
|
+
),
|
|
273
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "366", cy: "112", r: "44", fill: "var(--paw-sun)" }),
|
|
274
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
275
|
+
"path",
|
|
276
|
+
{
|
|
277
|
+
d: "M42 262c93-99 132-19 203-52 91-43 145-27 232 52v138H42V262Z",
|
|
278
|
+
fill: "var(--paw-art-hill)"
|
|
279
|
+
}
|
|
280
|
+
),
|
|
281
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
282
|
+
"path",
|
|
283
|
+
{
|
|
284
|
+
d: "M42 331c89-59 161-27 216-3 81 36 145-47 219-21v93H42v-69Z",
|
|
285
|
+
fill: "var(--paw-art-ground)"
|
|
286
|
+
}
|
|
287
|
+
),
|
|
288
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
289
|
+
"path",
|
|
290
|
+
{
|
|
291
|
+
d: "M310 239c34-18 68-21 103-14M311 249c34-18 68-21 103-14",
|
|
292
|
+
stroke: "var(--paw-art-line)",
|
|
293
|
+
strokeWidth: "2",
|
|
294
|
+
strokeLinecap: "round",
|
|
295
|
+
opacity: ".45"
|
|
296
|
+
}
|
|
297
|
+
),
|
|
298
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
299
|
+
"path",
|
|
300
|
+
{
|
|
301
|
+
d: "M90 190v75m29-85v75m-44-46h61m-57 31c14-15 32-15 51-7",
|
|
302
|
+
stroke: "var(--paw-art-line)",
|
|
303
|
+
strokeWidth: "3",
|
|
304
|
+
strokeLinecap: "round",
|
|
305
|
+
opacity: ".45"
|
|
306
|
+
}
|
|
307
|
+
),
|
|
308
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
309
|
+
"path",
|
|
310
|
+
{
|
|
311
|
+
d: "M167 341c-29-24-33-67-5-88 16-12 44-6 59 17l27 47c15 26 36 38 58 44H167v-20Z",
|
|
312
|
+
fill: "var(--paw-terracotta)"
|
|
313
|
+
}
|
|
314
|
+
),
|
|
315
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
316
|
+
"path",
|
|
317
|
+
{
|
|
318
|
+
d: "M173 340c-17-9-39-15-54-31-14-16-13-27-11-38",
|
|
319
|
+
stroke: "var(--paw-terracotta)",
|
|
320
|
+
strokeWidth: "17",
|
|
321
|
+
strokeLinecap: "round"
|
|
322
|
+
}
|
|
323
|
+
),
|
|
324
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
325
|
+
"path",
|
|
326
|
+
{
|
|
327
|
+
d: "M229 283c26-17 39-43 31-67-8-25-35-34-57-18-23 17-13 49 1 68",
|
|
328
|
+
fill: "var(--paw-terracotta)"
|
|
329
|
+
}
|
|
330
|
+
),
|
|
331
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
332
|
+
"path",
|
|
333
|
+
{
|
|
334
|
+
d: "M251 224l34 5c14 2 13 23 0 28l-36 13",
|
|
335
|
+
fill: "var(--paw-terracotta)"
|
|
336
|
+
}
|
|
337
|
+
),
|
|
338
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
339
|
+
"path",
|
|
340
|
+
{
|
|
341
|
+
d: "M206 203c-15 1-31 13-29 33 1 11 6 18 15 17 13-1 21-18 25-37",
|
|
342
|
+
fill: "var(--paw-art-line)"
|
|
343
|
+
}
|
|
344
|
+
),
|
|
345
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
346
|
+
"path",
|
|
347
|
+
{
|
|
348
|
+
d: "M231 285l-10 67c-1 7 9 11 28 11M264 280l2 70c0 10 10 13 25 13",
|
|
349
|
+
stroke: "var(--paw-terracotta)",
|
|
350
|
+
strokeWidth: "19",
|
|
351
|
+
strokeLinecap: "round"
|
|
352
|
+
}
|
|
353
|
+
),
|
|
354
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
355
|
+
"path",
|
|
356
|
+
{
|
|
357
|
+
d: "M215 273l38-7",
|
|
358
|
+
stroke: "var(--paw-art-line)",
|
|
359
|
+
strokeWidth: "9",
|
|
360
|
+
strokeLinecap: "round"
|
|
361
|
+
}
|
|
362
|
+
),
|
|
363
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "248", cy: "223", r: "3.5", fill: "var(--paw-art-line)" }),
|
|
364
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M283 229h9c1 8-3 13-9 13", fill: "var(--paw-art-line)" }),
|
|
365
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
366
|
+
"path",
|
|
367
|
+
{
|
|
368
|
+
d: "M292 348c-9-46 1-79 33-79 33 0 47 37 48 77l-1 17h-80v-15Z",
|
|
369
|
+
fill: "var(--paw-art-cat)"
|
|
370
|
+
}
|
|
371
|
+
),
|
|
372
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M303 277l-6-43 26 20 23-22 2 48", fill: "var(--paw-art-cat)" }),
|
|
373
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
374
|
+
"path",
|
|
375
|
+
{
|
|
376
|
+
d: "M365 351c27-4 45-15 41-39-2-11-15-16-24-10",
|
|
377
|
+
stroke: "var(--paw-art-cat)",
|
|
378
|
+
strokeWidth: "12",
|
|
379
|
+
strokeLinecap: "round"
|
|
380
|
+
}
|
|
381
|
+
),
|
|
382
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
383
|
+
"path",
|
|
384
|
+
{
|
|
385
|
+
d: "M316 277h3m17-2h3m-13 10 3 2-3 3m-21-5-15-3m16 9-17 2m54-10 16-5m-14 13 15 1",
|
|
386
|
+
stroke: "var(--paw-art-line)",
|
|
387
|
+
strokeWidth: "2.5",
|
|
388
|
+
strokeLinecap: "round"
|
|
389
|
+
}
|
|
390
|
+
),
|
|
391
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
392
|
+
"path",
|
|
393
|
+
{
|
|
394
|
+
d: "M145 378h245",
|
|
395
|
+
stroke: "var(--paw-art-line)",
|
|
396
|
+
strokeWidth: "2",
|
|
397
|
+
strokeLinecap: "round",
|
|
398
|
+
opacity: ".3"
|
|
399
|
+
}
|
|
400
|
+
),
|
|
401
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "99", cy: "365", r: "16", fill: "var(--paw-sun)" }),
|
|
402
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
403
|
+
"path",
|
|
404
|
+
{
|
|
405
|
+
d: "M93 351c16 8 18 18 12 28",
|
|
406
|
+
stroke: "var(--paw-art-line)",
|
|
407
|
+
strokeWidth: "2"
|
|
408
|
+
}
|
|
409
|
+
),
|
|
410
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
411
|
+
"path",
|
|
412
|
+
{
|
|
413
|
+
d: "M426 352v-43m0 22c-14-1-20-10-20-20 15 2 21 11 20 20m0-9c0-15 6-25 20-28 2 13-6 24-20 28",
|
|
414
|
+
stroke: "var(--paw-art-line)",
|
|
415
|
+
strokeWidth: "3",
|
|
416
|
+
strokeLinecap: "round"
|
|
417
|
+
}
|
|
418
|
+
),
|
|
419
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
420
|
+
"path",
|
|
421
|
+
{
|
|
422
|
+
d: "m406 153 8-6 8 6m-234-33 8-6 8 6",
|
|
423
|
+
stroke: "var(--paw-art-line)",
|
|
424
|
+
strokeWidth: "2.5",
|
|
425
|
+
strokeLinecap: "round"
|
|
426
|
+
}
|
|
427
|
+
)
|
|
428
|
+
]
|
|
429
|
+
}
|
|
430
|
+
);
|
|
431
|
+
}
|
|
256
432
|
function Photo({
|
|
257
433
|
resource,
|
|
258
434
|
mediaUrl,
|
|
@@ -506,22 +682,19 @@ function PetsSection({
|
|
|
506
682
|
}
|
|
507
683
|
) : /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "paw-welcome", children: [
|
|
508
684
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
685
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "paw-eyebrow", children: "Life is better together" }),
|
|
509
686
|
/* @__PURE__ */ jsxRuntime.jsxs("h1", { children: [
|
|
510
|
-
"Every pet
|
|
687
|
+
"Every pet.",
|
|
511
688
|
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
512
|
-
"
|
|
689
|
+
/* @__PURE__ */ jsxRuntime.jsx("em", { children: "A local story." })
|
|
513
690
|
] }),
|
|
514
691
|
/* @__PURE__ */ jsxRuntime.jsx("p", { children: "A place for familiar faces, happy reunions and the everyday joy of life with pets." }),
|
|
515
692
|
contributeUrl && /* @__PURE__ */ jsxRuntime.jsx("a", { className: "paw-button", href: safePetLink(contributeUrl), children: "Submit for Paw of the Week" }),
|
|
516
693
|
/* @__PURE__ */ jsxRuntime.jsx("small", { children: "Free to enter. Thoughtfully selected by local editors." })
|
|
517
694
|
] }),
|
|
518
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "paw-
|
|
519
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
520
|
-
/* @__PURE__ */ jsxRuntime.
|
|
521
|
-
"Good neighbors.",
|
|
522
|
-
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
523
|
-
"Great companions."
|
|
524
|
-
] })
|
|
695
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "paw-illustration", children: [
|
|
696
|
+
/* @__PURE__ */ jsxRuntime.jsx(PawNeighborhoodIllustration, {}),
|
|
697
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { children: "Good neighbors. Great companions." })
|
|
525
698
|
] })
|
|
526
699
|
] }),
|
|
527
700
|
!unavailable && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -651,7 +824,9 @@ async function PublicationPetsSection({
|
|
|
651
824
|
region,
|
|
652
825
|
canonicalOrigin,
|
|
653
826
|
defaultCommunity,
|
|
827
|
+
rememberedCommunity,
|
|
654
828
|
walksUrl,
|
|
829
|
+
native = false,
|
|
655
830
|
cleanCaption = (v) => v
|
|
656
831
|
}) {
|
|
657
832
|
const root = `/v1/knowledge/community-maps/collections/${scope.collectionSlug}`;
|
|
@@ -661,10 +836,19 @@ async function PublicationPetsSection({
|
|
|
661
836
|
const home = defaultCommunity || collection.areas.find(
|
|
662
837
|
(area) => area.name.toLocaleLowerCase() === region.toLocaleLowerCase()
|
|
663
838
|
)?.id;
|
|
839
|
+
let remembered = rememberedCommunity, signedIn = false;
|
|
840
|
+
if (native && scope.accessToken) {
|
|
841
|
+
try {
|
|
842
|
+
const saved = await petRequest(scope, root + "/pets/preferences");
|
|
843
|
+
remembered = saved.preferences.home_area_id || (saved.revision > 0 ? "all" : void 0);
|
|
844
|
+
signedIn = true;
|
|
845
|
+
} catch {
|
|
846
|
+
}
|
|
847
|
+
}
|
|
664
848
|
const chosen = resolvePetCommunity(
|
|
665
849
|
collection.areas,
|
|
666
850
|
query.community,
|
|
667
|
-
|
|
851
|
+
remembered,
|
|
668
852
|
home
|
|
669
853
|
);
|
|
670
854
|
const filter = new URLSearchParams();
|
|
@@ -706,25 +890,35 @@ async function PublicationPetsSection({
|
|
|
706
890
|
}))
|
|
707
891
|
});
|
|
708
892
|
const local = chosen ? "?community=" + encodeURIComponent(chosen.slug) : "";
|
|
709
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
893
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
894
|
+
native && /* @__PURE__ */ jsxRuntime.jsx(
|
|
895
|
+
petsInteractions.PetCommunityMemory,
|
|
896
|
+
{
|
|
897
|
+
signedIn,
|
|
898
|
+
selected: query.community === void 0 ? void 0 : chosen?.id || null
|
|
899
|
+
}
|
|
900
|
+
),
|
|
901
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
902
|
+
PetsSection,
|
|
903
|
+
{
|
|
904
|
+
basePath: "/pets",
|
|
905
|
+
regionLabel: region,
|
|
906
|
+
resourceBasePath: native ? "/pets" : canonicalOrigin + "/pets",
|
|
907
|
+
accountUrl: native ? "/pets/account" : void 0,
|
|
908
|
+
communities: collection.areas,
|
|
909
|
+
community: chosen,
|
|
910
|
+
acknowledgments: await petAcknowledgments(scope, chosen?.slug),
|
|
911
|
+
resources: feeds.flatMap((feed) => feed.items).map(clean),
|
|
912
|
+
spotlight: spotlights.items[0] && clean(spotlights.items[0]),
|
|
913
|
+
mediaUrl,
|
|
914
|
+
contributeUrl: (native ? "/pets/submit" : canonicalOrigin + "/submit") + local,
|
|
915
|
+
placesUrl: canonicalOrigin + "/places" + local,
|
|
916
|
+
walksUrl,
|
|
917
|
+
browseBasePath: native ? "/pets/browse" : canonicalOrigin + "/browse",
|
|
918
|
+
eventsUrl: native ? "/pets/browse/event" : canonicalOrigin + "/events"
|
|
919
|
+
}
|
|
920
|
+
)
|
|
921
|
+
] });
|
|
728
922
|
} catch {
|
|
729
923
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
730
924
|
PetsSection,
|
|
@@ -742,6 +936,7 @@ async function PublicationPetReferences({
|
|
|
742
936
|
scope,
|
|
743
937
|
metadata,
|
|
744
938
|
canonicalOrigin,
|
|
939
|
+
native = false,
|
|
745
940
|
communities,
|
|
746
941
|
cleanCaption = (v) => v
|
|
747
942
|
}) {
|
|
@@ -763,7 +958,7 @@ async function PublicationPetReferences({
|
|
|
763
958
|
}))
|
|
764
959
|
},
|
|
765
960
|
community: communities?.find((c) => c.id === resource.area_id)?.name || "Our community",
|
|
766
|
-
href: `${canonicalOrigin}/pets/${resource.id}`,
|
|
961
|
+
href: `${native ? "" : canonicalOrigin}/pets/${resource.id}`,
|
|
767
962
|
mediaUrl: (id, photo) => `/api/pets/${id}/media/${photo}`
|
|
768
963
|
};
|
|
769
964
|
const Card = resource.kind === "spotlight" ? PawOfTheWeekCard : resource.kind === "adoption" ? AdoptionListingCard : resource.kind === "event" ? PetEventCard : resource.kind === "celebration" ? PetCelebrationCard : ["lost", "found"].includes(resource.kind) ? LostPetNotice : PetProfileCard;
|
|
@@ -773,6 +968,7 @@ async function PublicationPetReferences({
|
|
|
773
968
|
async function PublicationPetEvents({
|
|
774
969
|
scope,
|
|
775
970
|
canonicalOrigin,
|
|
971
|
+
native = false,
|
|
776
972
|
cleanCaption = (value) => value
|
|
777
973
|
}) {
|
|
778
974
|
try {
|
|
@@ -801,12 +997,12 @@ async function PublicationPetEvents({
|
|
|
801
997
|
}))
|
|
802
998
|
},
|
|
803
999
|
community: "Our community",
|
|
804
|
-
href: `${canonicalOrigin}/pets/${resource.id}`,
|
|
1000
|
+
href: `${native ? "" : canonicalOrigin}/pets/${resource.id}`,
|
|
805
1001
|
mediaUrl: (id, media) => `/api/pets/${id}/media/${media}`
|
|
806
1002
|
},
|
|
807
1003
|
resource.id
|
|
808
1004
|
)) }),
|
|
809
|
-
/* @__PURE__ */ jsxRuntime.jsx("a", { href: canonicalOrigin + "/events", children: "Browse the pet community calendar" })
|
|
1005
|
+
/* @__PURE__ */ jsxRuntime.jsx("a", { href: native ? "/pets/browse/event" : canonicalOrigin + "/events", children: "Browse the pet community calendar" })
|
|
810
1006
|
] });
|
|
811
1007
|
} catch {
|
|
812
1008
|
return /* @__PURE__ */ jsxRuntime.jsx("p", { role: "status", children: "Pet event listings are temporarily unavailable." });
|