@profullstack/waitlist 0.9.0 → 0.10.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.
- package/README.md +1 -0
- package/package.json +1 -1
- package/src/plugins.js +3 -1
- package/src/search.js +22 -6
package/README.md
CHANGED
|
@@ -139,6 +139,7 @@ Every page showcases all plugins by default. Pick per site in `sites.json`:
|
|
|
139
139
|
| `buyaday` | `<pf-buy-a-day>` from [@profullstack/marketing-widgets](https://github.com/profullstack/marketing-widgets): the next free doors on [holi.days](https://holi.days.pit.world/calendars) calendars (ones matching the site's keywords first), baked in and refreshed live, every sale credited to this site with `?ref=<host>`. Nothing shows when the feed is down. `buyadayKeywords` / `buyadayLimit` in `sites.json` override the keywords and count (default 3) |
|
|
140
140
|
| `book` | The Profullstack pitch (four solution lines) and `<book-a-call>`, our booking widget: open times from the OutreachGraph public calendar in the reader's own time zone, booked inline as a PairUX call. A plain link to the booking page without script. `"booking": {"handle": "chovy"}` picks the calendar |
|
|
141
141
|
| `promo` | "More from the network": sister properties from the live `@profullstack/cross-promo` catalog, tagged `utm_medium=waitlist`. `"promoAudience": "developers"` (or a list) overrides the audience picked from the hierarchy |
|
|
142
|
+
| (search, resources) | Every search item and resource carries pit.world's result tools from `https://pit.world/widgets.js`: vote, Summarize, Listen and Share. They work without an account; on a pit.world host, "Sign in with CoinPay" (OAuth 2.1 + PKCE through pit.world) raises the limits. From a terminal the same account is `pit login` |
|
|
142
143
|
| `affiliate` | Referrals (0.9). Every signup gets a personal link `https://<site>/?ref=<code>`, shown right after joining by `<pf-referral-share>` ("You are #X of Y, N people referred.", copy button, plain X/Bluesky/LinkedIn/email links) and in the confirmation email with a signed status page. A visitor who arrives with `?ref=` keeps a 30-day first-party, first-touch cookie `wl_ref`; their signup credits the referrer once they confirm. Each confirmed referral moves the referrer up `bumpPlaces`. A "Move up the list" section bakes `<pf-referral-leaderboard>` (handles or masked emails only). With `buyaday` on, a door sold to a referred visitor credits the referrer too (holi.days `ref=<code>.<site>`). See below |
|
|
143
144
|
|
|
144
145
|
### Referrals (`affiliate`)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@profullstack/waitlist",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Email waitlist for any launch page: a <waitlist-form> web component, a live signup chart, and a static-site builder on @profullstack/css + @profullstack/charts.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/src/plugins.js
CHANGED
|
@@ -131,7 +131,7 @@ export function resourcesHtml(s, res, { comments = false, share = false } = {})
|
|
|
131
131
|
if (!res?.results?.length) return '';
|
|
132
132
|
return `<section class="stack" aria-labelledby="resources"><h2 id="resources">Resources</h2>
|
|
133
133
|
<p class="muted">Useful reading on ${esc(s.title)} while you wait, from <a href="https://pit.world/search?q=${encodeURIComponent(res.query)}">pit.world search</a>.</p>
|
|
134
|
-
<ul role="list" class="grid" data-columns="2">${res.results.map((r) => `<li class="card stack" data-space="sm"><a href="${esc(r.url)}" rel="noopener"><strong>${esc(r.title)}</strong></a><small class="muted">${esc(r.host)}</small>${r.summary ? `<p>${esc(r.summary)}</p>` : ''}${thread(r)}</li>`).join('')}</ul>
|
|
134
|
+
<ul role="list" class="grid" data-columns="2">${res.results.map((r) => `<li class="card stack" data-space="sm" data-pit-result data-url="${esc(r.url)}" data-title="${esc(r.title)}" data-host="${esc(r.host)}" data-q="${esc(res.query)}" data-tab="web"><a href="${esc(r.url)}" rel="noopener"><strong>${esc(r.title)}</strong></a><small class="muted">${esc(r.host)}</small>${r.summary ? `<p>${esc(r.summary)}</p>` : ''}${thread(r)}</li>`).join('')}</ul>
|
|
135
135
|
</section>`;
|
|
136
136
|
}
|
|
137
137
|
|
|
@@ -184,6 +184,8 @@ export async function runPlugins(s, out, { fetchImpl, cacheDir, maxAgeMs, search
|
|
|
184
184
|
: await fetchResources(s, { fetchImpl, cacheDir, maxAgeMs });
|
|
185
185
|
slot.sections.push(resourcesHtml(s, res, { comments: on.has('board'), share: on.has('share') }));
|
|
186
186
|
if (res.results.length) await writeFile(join(out, 'resources.json'), JSON.stringify(res, null, 2) + '\n');
|
|
187
|
+
// pit.world's own tools under each resource: vote, Summarize, Listen (https://pit.world/widgets.js).
|
|
188
|
+
if (res.results.length) slot.scripts.push('<script type="module" src="https://pit.world/widgets.js"></script>');
|
|
187
189
|
}
|
|
188
190
|
if (on.has('board')) {
|
|
189
191
|
const dir = dirname(require.resolve('@profullstack/comments'));
|
package/src/search.js
CHANGED
|
@@ -91,6 +91,8 @@ export function normalizeHit(x) {
|
|
|
91
91
|
channel: str(x.channel, 80),
|
|
92
92
|
author: str(x.author, 160),
|
|
93
93
|
extra: str(x.extra, 80),
|
|
94
|
+
// pit.world's signed Share link for this hit (its own page there).
|
|
95
|
+
share: typeof x.share === 'string' && x.share.startsWith('https://pit.world/share?') ? x.share : undefined,
|
|
94
96
|
};
|
|
95
97
|
for (const k of Object.keys(hit)) if (hit[k] === undefined) delete hit[k];
|
|
96
98
|
return hit;
|
|
@@ -219,14 +221,26 @@ function fmtDate(h) {
|
|
|
219
221
|
return /^\d{4}$/.test(h.date) ? h.date : new Date(t).toISOString().slice(0, 10);
|
|
220
222
|
}
|
|
221
223
|
|
|
222
|
-
|
|
224
|
+
/** The script that draws pit.world's tools (vote, Summarize, Listen, Share) under every marked result. */
|
|
225
|
+
export const TOOLS_SCRIPT = '<script type="module" src="https://pit.world/widgets.js"></script>';
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Marks a result for pit.world's tools (https://pit.world/widgets.js). They work without an
|
|
229
|
+
* account; signing in with CoinPay (OAuth 2.1) on a pit.world host raises the limits.
|
|
230
|
+
*/
|
|
231
|
+
export function toolAttrs(h, { q = '', tab = 'web', tools = '' } = {}) {
|
|
232
|
+
return ` data-pit-result data-url="${esc(h.url)}" data-title="${esc(h.title)}" data-host="${esc(h.host)}" data-q="${esc(q)}" data-tab="${esc(tab)}"${h.share ? ` data-share="${esc(h.share)}"` : ''}${tools ? ` data-tools="${esc(tools)}"` : ''}`;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function hitHtml(h, tab, v, q = '') {
|
|
223
236
|
const meta = [h.host, h.author, h.channel, fmtDate(h), h.duration, h.extra].filter(Boolean).map(esc).join(' · ');
|
|
224
|
-
|
|
237
|
+
// Without script the count stands alone; with it, the vote buttons carry the live count.
|
|
238
|
+
const voted = v ? `<noscript> <span class="badge" title="pit.world votes">▲ ${v.up - v.down}</span></noscript>` : '';
|
|
225
239
|
if (tab === 'images') {
|
|
226
|
-
return `<li class="card wl-hit wl-hit-image"><a href="${esc(h.url)}" rel="noopener">${h.thumbnail ? `<img src="${esc(h.thumbnail)}" alt="${esc(h.title)}" loading="lazy" decoding="async" referrerpolicy="no-referrer">` : ''}<span>${esc(h.title)}</span></a><small class="muted">${esc(h.host)}</small></li>`;
|
|
240
|
+
return `<li class="card wl-hit wl-hit-image"${toolAttrs(h, { q, tab, tools: 'vote share' })}><a href="${esc(h.url)}" rel="noopener">${h.thumbnail ? `<img src="${esc(h.thumbnail)}" alt="${esc(h.title)}" loading="lazy" decoding="async" referrerpolicy="no-referrer">` : ''}<span>${esc(h.title)}</span></a><small class="muted">${esc(h.host)}</small></li>`;
|
|
227
241
|
}
|
|
228
242
|
const thumb = h.thumbnail ? `<img class="wl-thumb" src="${esc(h.thumbnail)}" alt="" loading="lazy" decoding="async" referrerpolicy="no-referrer" width="96" height="96">` : '';
|
|
229
|
-
return `<li class="card wl-hit">${thumb}<div class="stack" data-space="xs"><a href="${esc(h.url)}" rel="noopener"><strong>${esc(h.title)}</strong></a>${voted}<small class="muted">${meta}</small>${h.summary ? `<p>${esc(h.summary)}</p>` : ''}</div></li>`;
|
|
243
|
+
return `<li class="card wl-hit"${toolAttrs(h, { q, tab })}>${thumb}<div class="stack" data-space="xs" data-pit-tools><a href="${esc(h.url)}" rel="noopener"><strong>${esc(h.title)}</strong></a>${voted}<small class="muted">${meta}</small>${h.summary ? `<p>${esc(h.summary)}</p>` : ''}</div></li>`;
|
|
230
244
|
}
|
|
231
245
|
|
|
232
246
|
/** The SEO fields of one search page. */
|
|
@@ -306,9 +320,11 @@ export function searchPageHtml(s, search, tabId, sort, { chrome }) {
|
|
|
306
320
|
<nav class="wl-tabs" aria-label="Search tabs"><ul role="list">${tabs}</ul></nav>
|
|
307
321
|
<nav class="wl-sorts" aria-label="Sort"><ul role="list">${sorts}</ul></nav>
|
|
308
322
|
<section aria-labelledby="results" class="stack"><h2 id="results" class="visually-hidden">${esc(tabMeta.label)} results</h2>
|
|
309
|
-
<ol role="list" class="wl-results${tabId === 'images' ? ' wl-results-images' : ''}">${hits.map((h) => hitHtml(h, tabId, search.votes.get(h.url))).join('')}</ol>
|
|
323
|
+
<ol role="list" class="wl-results${tabId === 'images' ? ' wl-results-images' : ''}">${hits.map((h) => hitHtml(h, tabId, search.votes.get(h.url), data.query)).join('')}</ol>
|
|
324
|
+
<p data-pit-account></p>
|
|
310
325
|
<p class="muted">Results from <a href="https://pit.world/search?q=${encodeURIComponent(data.query)}${tabId === 'web' ? '' : `&t=${tabId}`}">pit.world search</a>${data.provider ? ` (${esc(data.provider)})` : ''}, updated ${esc(data.fetchedAt.slice(0, 10))}.</p>
|
|
311
|
-
</section
|
|
326
|
+
</section>
|
|
327
|
+
${TOOLS_SCRIPT}`;
|
|
312
328
|
return { html: rebase(chrome({ head, body, spec: ps }), up), path: tabPath(tabId, sort), meta: m };
|
|
313
329
|
}
|
|
314
330
|
|