@profullstack/waitlist 0.6.0 → 0.7.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 +3 -1
- package/package.json +5 -3
- package/src/book.js +224 -0
- package/src/build.js +2 -0
- package/src/plugins.js +84 -1
- package/src/waitlist.css +11 -0
package/README.md
CHANGED
|
@@ -101,7 +101,7 @@ The page reports one exposure a day; a signup is the conversion. Both go through
|
|
|
101
101
|
waitlist API, which holds the CrawlProof token. Stop the experiment with a winner in
|
|
102
102
|
CrawlProof and every page switches to it. Turn it off per site with `"ab": false`.
|
|
103
103
|
|
|
104
|
-
## Plugins (0.4)
|
|
104
|
+
## Plugins (0.4; buyaday 0.6; book + promo 0.7)
|
|
105
105
|
|
|
106
106
|
Every page showcases all plugins by default. Pick per site in `sites.json`:
|
|
107
107
|
`"plugins": ["form", "board"]` keeps only those, `"plugins": { "faq": false }` drops some.
|
|
@@ -117,6 +117,8 @@ Every page showcases all plugins by default. Pick per site in `sites.json`:
|
|
|
117
117
|
| `share` | a Share button on the board, also behind CoinPay sign-in |
|
|
118
118
|
| `feed` | `feed.xml` (RSS) and `feed.json` (JSON Feed) of the page and its resources, for syndication |
|
|
119
119
|
| `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) |
|
|
120
|
+
| `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 |
|
|
121
|
+
| `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 |
|
|
120
122
|
|
|
121
123
|
`keywords` (also the `<meta name="keywords">`) default to the name's labels plus the tagline's
|
|
122
124
|
meaningful words; set `keywords` or `resourcesQuery` per site to steer the resources.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@profullstack/waitlist",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.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",
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
"./build": "./src/build.js",
|
|
28
28
|
"./seo": "./src/seo.js",
|
|
29
29
|
"./waitlist.css": "./src/waitlist.css",
|
|
30
|
-
"./package.json": "./package.json"
|
|
30
|
+
"./package.json": "./package.json",
|
|
31
|
+
"./book": "./src/book.js"
|
|
31
32
|
},
|
|
32
33
|
"bin": {
|
|
33
34
|
"waitlist": "bin/waitlist.js"
|
|
@@ -50,7 +51,8 @@
|
|
|
50
51
|
"@profullstack/footer": "^0.7.3",
|
|
51
52
|
"@resvg/resvg-js": "^2.6.2",
|
|
52
53
|
"@profullstack/comments": "^0.2.0",
|
|
53
|
-
"@profullstack/marketing-widgets": "^0.1.0"
|
|
54
|
+
"@profullstack/marketing-widgets": "^0.1.0",
|
|
55
|
+
"@profullstack/cross-promo": "^0.2.1"
|
|
54
56
|
},
|
|
55
57
|
"devDependencies": {
|
|
56
58
|
"@profullstack/abtest": "^0.1.0"
|
package/src/book.js
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* <book-a-call>: our booking widget for any static page.
|
|
3
|
+
*
|
|
4
|
+
* <book-a-call handle="chovy"><a href="https://outreachgraph.com/calendar/chovy">Book a call</a></book-a-call>
|
|
5
|
+
* <script type="module" src="assets/book.js"></script>
|
|
6
|
+
*
|
|
7
|
+
* It is the guest side of an OutreachGraph booking page (outreachgraph.com/calendar/<handle>):
|
|
8
|
+
* pick a time in your own time zone, give a name and an email, get a PairUX video call. The
|
|
9
|
+
* booking lands in the host's OutreachGraph CRM. Whatever is inside the element is the
|
|
10
|
+
* no-script fallback, and it comes back if the calendar cannot be reached.
|
|
11
|
+
*
|
|
12
|
+
* Talks to OutreachGraph's keyless public API (CORS open):
|
|
13
|
+
* GET {api}/api/v1/public/calendar/{handle} -> {page}
|
|
14
|
+
* GET {api}/api/v1/public/calendar/{handle}/slots?from=&days= -> {slots:[{start,end}]}
|
|
15
|
+
* POST {api}/api/v1/public/calendar/{handle}/book {start,name,email,note,timezone} -> {booking}
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export const DEFAULT_BOOKING_API = 'https://outreachgraph.com';
|
|
19
|
+
export const DEFAULT_HANDLE = 'chovy';
|
|
20
|
+
const DAY_MS = 86_400_000;
|
|
21
|
+
const EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/;
|
|
22
|
+
|
|
23
|
+
/** "YYYY-MM-DD" for an instant as seen in a zone. */
|
|
24
|
+
export function ymd(ms, zone) {
|
|
25
|
+
return new Intl.DateTimeFormat('en-CA', { timeZone: zone, year: 'numeric', month: '2-digit', day: '2-digit' }).format(new Date(ms));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function addDays(date, days) {
|
|
29
|
+
const [y, m, d] = date.split('-').map(Number);
|
|
30
|
+
return new Date(Date.UTC(y, m - 1, d + days)).toISOString().slice(0, 10);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Slots grouped by the date the guest sees, in order: [[ 'YYYY-MM-DD', [slot...] ], ...]. */
|
|
34
|
+
export function groupByDay(slots, zone) {
|
|
35
|
+
const days = new Map();
|
|
36
|
+
for (const slot of slots) {
|
|
37
|
+
const key = ymd(Date.parse(slot.start), zone);
|
|
38
|
+
if (!days.has(key)) days.set(key, []);
|
|
39
|
+
days.get(key).push(slot);
|
|
40
|
+
}
|
|
41
|
+
return [...days.entries()].sort(([a], [b]) => (a < b ? -1 : 1));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function guestZone() {
|
|
45
|
+
try {
|
|
46
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone || 'UTC';
|
|
47
|
+
} catch {
|
|
48
|
+
return 'UTC';
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const fmt = (opts, zone) => new Intl.DateTimeFormat(undefined, { timeZone: zone, ...opts });
|
|
53
|
+
|
|
54
|
+
/** Small client for the public calendar API. */
|
|
55
|
+
export function bookingClient({ api = DEFAULT_BOOKING_API, handle = DEFAULT_HANDLE, fetchImpl = globalThis.fetch } = {}) {
|
|
56
|
+
const base = `${api.replace(/\/$/, '')}/api/v1/public/calendar/${encodeURIComponent(handle)}`;
|
|
57
|
+
const json = async (res) => ({ res, body: await res.json().catch(() => ({})) });
|
|
58
|
+
return {
|
|
59
|
+
async page() {
|
|
60
|
+
const { res, body } = await json(await fetchImpl(base, { headers: { accept: 'application/json' } }));
|
|
61
|
+
if (!res.ok || !body.page) throw new Error('booking page not found');
|
|
62
|
+
return body.page;
|
|
63
|
+
},
|
|
64
|
+
async slots(from, days = 7) {
|
|
65
|
+
const { res, body } = await json(await fetchImpl(`${base}/slots?from=${from}&days=${days}`, { headers: { accept: 'application/json' } }));
|
|
66
|
+
if (!res.ok) throw new Error('could not load times');
|
|
67
|
+
return Array.isArray(body.slots) ? body.slots : [];
|
|
68
|
+
},
|
|
69
|
+
async book({ start, name, email, note = '', timezone = guestZone() }) {
|
|
70
|
+
const { res, body } = await json(
|
|
71
|
+
await fetchImpl(`${base}/book`, {
|
|
72
|
+
method: 'POST',
|
|
73
|
+
headers: { 'content-type': 'application/json', accept: 'application/json' },
|
|
74
|
+
body: JSON.stringify({ start, name, email, note, timezone }),
|
|
75
|
+
}),
|
|
76
|
+
);
|
|
77
|
+
if (!res.ok || !body.booking) {
|
|
78
|
+
const err = new Error(body.error?.message ?? body.message ?? 'That did not work. Try another time.');
|
|
79
|
+
err.status = res.status;
|
|
80
|
+
throw err;
|
|
81
|
+
}
|
|
82
|
+
return body.booking;
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const HTMLElementBase = globalThis.HTMLElement ?? class {};
|
|
88
|
+
|
|
89
|
+
function el(tag, attrs = {}, ...children) {
|
|
90
|
+
const node = document.createElement(tag);
|
|
91
|
+
for (const [k, v] of Object.entries(attrs)) {
|
|
92
|
+
if (v === undefined || v === null || v === false) continue;
|
|
93
|
+
if (k === 'text') node.textContent = v;
|
|
94
|
+
else if (k.startsWith('on')) node.addEventListener(k.slice(2), v);
|
|
95
|
+
else node.setAttribute(k, v === true ? '' : String(v));
|
|
96
|
+
}
|
|
97
|
+
for (const c of children.flat()) if (c != null && c !== false) node.append(c);
|
|
98
|
+
return node;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** <book-a-call [handle] [api] [heading]>: light DOM, styled by @profullstack/css. */
|
|
102
|
+
export class BookACall extends HTMLElementBase {
|
|
103
|
+
connectedCallback() {
|
|
104
|
+
if (this.dataset.ready) return;
|
|
105
|
+
this.dataset.ready = '1';
|
|
106
|
+
this.fallback = [...this.childNodes];
|
|
107
|
+
this.zone = guestZone();
|
|
108
|
+
this.client = bookingClient({ api: this.getAttribute('api') || DEFAULT_BOOKING_API, handle: this.getAttribute('handle') || DEFAULT_HANDLE });
|
|
109
|
+
this.state = { page: null, from: null, days: null, day: null, chosen: null, booked: null, error: null, busy: false };
|
|
110
|
+
this.start();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
async start() {
|
|
114
|
+
try {
|
|
115
|
+
const page = await this.client.page();
|
|
116
|
+
this.state.page = page;
|
|
117
|
+
this.today = ymd(Date.now(), page.timezone);
|
|
118
|
+
this.lastDay = ymd(Date.now() + page.maxDaysAhead * DAY_MS, page.timezone);
|
|
119
|
+
await this.load(this.today);
|
|
120
|
+
} catch {
|
|
121
|
+
this.replaceChildren(...this.fallback); // the plain link still works
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
async load(from) {
|
|
126
|
+
this.state.from = from;
|
|
127
|
+
this.state.days = null;
|
|
128
|
+
this.state.chosen = null;
|
|
129
|
+
this.render();
|
|
130
|
+
try {
|
|
131
|
+
// One day either side, so slots near midnight regroup into the guest's own day.
|
|
132
|
+
const slots = await this.client.slots(addDays(from, -1), 9);
|
|
133
|
+
const now = Date.now();
|
|
134
|
+
this.state.days = groupByDay(slots.filter((s) => Date.parse(s.start) > now), this.zone);
|
|
135
|
+
this.state.day = this.state.days[0]?.[0] ?? null;
|
|
136
|
+
} catch {
|
|
137
|
+
this.state.days = [];
|
|
138
|
+
this.state.error = 'Could not load times. Try again in a moment.';
|
|
139
|
+
}
|
|
140
|
+
this.render();
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
async submit(form) {
|
|
144
|
+
const data = new FormData(form);
|
|
145
|
+
const name = String(data.get('name') ?? '').trim();
|
|
146
|
+
const email = String(data.get('email') ?? '').trim();
|
|
147
|
+
if (!name || !EMAIL_RE.test(email)) {
|
|
148
|
+
this.state.error = 'Enter your name and a valid email.';
|
|
149
|
+
return this.render();
|
|
150
|
+
}
|
|
151
|
+
this.state.busy = true;
|
|
152
|
+
this.state.error = null;
|
|
153
|
+
this.render();
|
|
154
|
+
try {
|
|
155
|
+
this.state.booked = await this.client.book({ start: this.state.chosen.start, name, email, note: String(data.get('note') ?? ''), timezone: this.zone });
|
|
156
|
+
this.state.email = email;
|
|
157
|
+
} catch (err) {
|
|
158
|
+
this.state.error = err.message;
|
|
159
|
+
if (err.status === 409) return this.load(this.state.from);
|
|
160
|
+
} finally {
|
|
161
|
+
this.state.busy = false;
|
|
162
|
+
}
|
|
163
|
+
this.render();
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
render() {
|
|
167
|
+
const { page, days, day, chosen, booked, error, busy } = this.state;
|
|
168
|
+
const zone = this.zone;
|
|
169
|
+
const long = (iso) => fmt({ weekday: 'long', month: 'long', day: 'numeric', hour: 'numeric', minute: '2-digit', timeZoneName: 'short' }, zone).format(new Date(iso));
|
|
170
|
+
const head = el('div', { class: 'book-head' },
|
|
171
|
+
el('strong', { text: `${page.title} with ${page.hostName || page.handle}` }),
|
|
172
|
+
el('small', { class: 'muted', text: `${page.durationMinutes} minutes · PairUX video call · times in ${zone}` }));
|
|
173
|
+
|
|
174
|
+
if (booked) {
|
|
175
|
+
return this.replaceChildren(el('div', { class: 'book-call stack', 'data-state': 'booked' },
|
|
176
|
+
el('p', { class: 'badge', text: 'Booked' }),
|
|
177
|
+
el('h3', { text: long(booked.startsAt) }),
|
|
178
|
+
el('p', { text: `${page.title} with ${page.hostName || page.handle}. A confirmation is on its way to ${this.state.email}.` }),
|
|
179
|
+
el('div', { class: 'cluster' },
|
|
180
|
+
el('a', { class: 'button', href: booked.meetingUrl, rel: 'noopener', text: 'Call link' }),
|
|
181
|
+
el('a', { href: booked.icsUrl, rel: 'noopener', text: 'Add to calendar' }),
|
|
182
|
+
el('a', { href: booked.manageUrl, rel: 'noopener', text: 'Reschedule or cancel' }))));
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const status = error ? el('p', { class: 'alert', role: 'status', 'data-tone': 'error', text: error }) : null;
|
|
186
|
+
|
|
187
|
+
if (chosen) {
|
|
188
|
+
const form = el('form', { class: 'stack', novalidate: true, onsubmit: (e) => { e.preventDefault(); this.submit(form); } },
|
|
189
|
+
el('p', {}, el('strong', { text: long(chosen.start) }), ' ', el('button', { type: 'button', class: 'link', onclick: () => { this.state.chosen = null; this.state.error = null; this.render(); }, text: 'change' })),
|
|
190
|
+
el('label', { for: 'bk-name', text: 'Your name' }), el('input', { id: 'bk-name', name: 'name', autocomplete: 'name', required: true }),
|
|
191
|
+
el('label', { for: 'bk-email', text: 'Email' }), el('input', { id: 'bk-email', name: 'email', type: 'email', autocomplete: 'email', required: true }),
|
|
192
|
+
el('label', { for: 'bk-note', text: 'What do you want to talk about? (optional)' }), el('textarea', { id: 'bk-note', name: 'note', rows: 3, maxlength: 1000 }),
|
|
193
|
+
status,
|
|
194
|
+
el('button', { type: 'submit', disabled: busy, text: busy ? 'Booking…' : 'Book this time' }));
|
|
195
|
+
return this.replaceChildren(el('div', { class: 'book-call stack' }, head, form));
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const canBack = this.state.from > this.today;
|
|
199
|
+
const canNext = addDays(this.state.from, 7) <= this.lastDay;
|
|
200
|
+
const nav = el('div', { class: 'cluster book-nav' },
|
|
201
|
+
el('button', { type: 'button', 'data-variant': 'ghost', disabled: !canBack, onclick: () => this.load(addDays(this.state.from, -7)), text: '← Earlier' }),
|
|
202
|
+
el('button', { type: 'button', 'data-variant': 'ghost', disabled: !canNext, onclick: () => this.load(addDays(this.state.from, 7)), text: 'Later →' }));
|
|
203
|
+
|
|
204
|
+
let body;
|
|
205
|
+
if (days === null) body = el('p', { class: 'muted', role: 'status', text: 'Loading open times…' });
|
|
206
|
+
else if (!days.length) body = el('p', { class: 'muted', text: 'No open times this week. Try later.' });
|
|
207
|
+
else {
|
|
208
|
+
const dayLabel = (key) => fmt({ weekday: 'short', month: 'short', day: 'numeric' }, 'UTC').format(new Date(`${key}T12:00:00Z`));
|
|
209
|
+
const current = days.find(([k]) => k === day) ?? days[0];
|
|
210
|
+
body = el('div', { class: 'stack', 'data-space': 'sm' },
|
|
211
|
+
el('div', { class: 'cluster book-days', role: 'group', 'aria-label': 'Day' },
|
|
212
|
+
days.map(([key]) => el('button', { type: 'button', 'data-variant': key === current[0] ? null : 'secondary', 'aria-pressed': String(key === current[0]), onclick: () => { this.state.day = key; this.render(); }, text: dayLabel(key) }))),
|
|
213
|
+
el('div', { class: 'cluster book-times', role: 'group', 'aria-label': 'Time' },
|
|
214
|
+
current[1].map((slot) => el('button', { type: 'button', 'data-variant': 'secondary', onclick: () => { this.state.chosen = slot; this.state.error = null; this.render(); }, text: fmt({ hour: 'numeric', minute: '2-digit' }, zone).format(new Date(slot.start)) }))));
|
|
215
|
+
}
|
|
216
|
+
this.replaceChildren(el('div', { class: 'book-call stack' }, head, body, status, nav));
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export function defineBooking() {
|
|
221
|
+
if (globalThis.customElements && !customElements.get('book-a-call')) customElements.define('book-a-call', BookACall);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
defineBooking();
|
package/src/build.js
CHANGED
|
@@ -122,6 +122,8 @@ export function normalize(spec) {
|
|
|
122
122
|
publisher: spec.publisher === undefined ? { name: 'Profullstack', url: 'https://profullstack.com' } : spec.publisher,
|
|
123
123
|
schema: spec.schema || null,
|
|
124
124
|
audience: spec.audience || '',
|
|
125
|
+
promoAudience: spec.promoAudience || null,
|
|
126
|
+
booking: spec.booking && typeof spec.booking === 'object' ? spec.booking : null,
|
|
125
127
|
indexnowKey: spec.indexnowKey || indexNowKey(name),
|
|
126
128
|
updated: spec.updated || new Date().toISOString().slice(0, 10),
|
|
127
129
|
};
|
package/src/plugins.js
CHANGED
|
@@ -7,6 +7,11 @@
|
|
|
7
7
|
*
|
|
8
8
|
* A plugin adds HTML to named slots of the page and may write files:
|
|
9
9
|
* head, hero, cards, sections, scripts.
|
|
10
|
+
*
|
|
11
|
+
* book the Profullstack pitch and our booking widget (<book-a-call>, OutreachGraph
|
|
12
|
+
* calendar, PairUX call). `"booking": {"handle": "chovy"}` picks the calendar.
|
|
13
|
+
* promo "More from the network": sister properties from @profullstack/cross-promo.
|
|
14
|
+
* `"promoAudience": "developers"` (or a list) picks who the reader is.
|
|
10
15
|
*/
|
|
11
16
|
import { mkdir, readFile, writeFile, copyFile } from 'node:fs/promises';
|
|
12
17
|
import { createRequire } from 'node:module';
|
|
@@ -16,7 +21,7 @@ import { esc } from './seo.js';
|
|
|
16
21
|
|
|
17
22
|
const require = createRequire(import.meta.url);
|
|
18
23
|
|
|
19
|
-
export const PLUGINS = ['form', 'stats', 'ab', 'faq', 'resources', 'board', 'share', 'feed', 'buyaday'];
|
|
24
|
+
export const PLUGINS = ['form', 'stats', 'ab', 'faq', 'resources', 'board', 'share', 'feed', 'buyaday', 'book', 'promo'];
|
|
20
25
|
|
|
21
26
|
/** Resolve a site's `plugins` setting to a Set (default: all of them). */
|
|
22
27
|
export function pluginSet(setting) {
|
|
@@ -141,6 +146,12 @@ export async function runPlugins(s, out, { fetchImpl, cacheDir, maxAgeMs } = {})
|
|
|
141
146
|
slot.scripts.push('<script type="module" src="assets/mw-widgets.js"></script>');
|
|
142
147
|
}
|
|
143
148
|
}
|
|
149
|
+
if (on.has('book')) {
|
|
150
|
+
await copyFile(join(dirname(new URL(import.meta.url).pathname), 'book.js'), join(out, 'assets', 'book.js'));
|
|
151
|
+
slot.sections.push(bookHtml(s));
|
|
152
|
+
slot.scripts.push('<script type="module" src="assets/book.js"></script>');
|
|
153
|
+
}
|
|
154
|
+
if (on.has('promo')) slot.sections.push(promoHtml(await fetchPromo(s)));
|
|
144
155
|
if (on.has('feed')) {
|
|
145
156
|
const f = feeds(s, res);
|
|
146
157
|
await writeFile(join(out, 'feed.xml'), f.rss);
|
|
@@ -149,3 +160,75 @@ export async function runPlugins(s, out, { fetchImpl, cacheDir, maxAgeMs } = {})
|
|
|
149
160
|
}
|
|
150
161
|
return { slot, resources: res };
|
|
151
162
|
}
|
|
163
|
+
|
|
164
|
+
// --- book: the Profullstack pitch + our booking widget ------------------------
|
|
165
|
+
|
|
166
|
+
/** What Profullstack sells, in four lines. Short and true; the source is profullstack.com. */
|
|
167
|
+
export const PITCH = {
|
|
168
|
+
heading: 'Need something built? Talk to the people who built this.',
|
|
169
|
+
lead: 'Profullstack is an agentic engineering firm: senior engineers run fleets of AI coding agents on your codebase, and every change ships through review, tests and CI.',
|
|
170
|
+
lines: [
|
|
171
|
+
{ title: 'Rent hardware', text: 'CPU, GPU and storage without a sales call or a long contract.', href: 'https://r4ck.dev' },
|
|
172
|
+
{ title: 'Cyber security', text: 'Catch attacks on your servers, with fixes shipped as pull requests.', href: 'https://threatcrush.com' },
|
|
173
|
+
{ title: 'Sales', text: 'Turn the people already engaging with you into a pipeline.', href: 'https://outreachgraph.com' },
|
|
174
|
+
{ title: 'Automation', text: 'Hand repeatable work to agents that check their own results.', href: 'https://profullstack.com' },
|
|
175
|
+
],
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export function bookingFor(s) {
|
|
179
|
+
const b = s.booking && typeof s.booking === 'object' ? s.booking : {};
|
|
180
|
+
const handle = String(b.handle || 'chovy');
|
|
181
|
+
const api = String(b.api || 'https://outreachgraph.com').replace(/\/$/, '');
|
|
182
|
+
return { handle, api, url: `${api}/calendar/${encodeURIComponent(handle)}` };
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const utm = (href, s, campaign) => {
|
|
186
|
+
try {
|
|
187
|
+
const u = new URL(href);
|
|
188
|
+
u.searchParams.set('utm_source', s.host || s.name);
|
|
189
|
+
u.searchParams.set('utm_medium', 'waitlist');
|
|
190
|
+
u.searchParams.set('utm_campaign', campaign);
|
|
191
|
+
return u.toString();
|
|
192
|
+
} catch {
|
|
193
|
+
return href;
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
export function bookHtml(s) {
|
|
198
|
+
const b = bookingFor(s);
|
|
199
|
+
return `<section class="card stack waitlist-book" aria-labelledby="book"><h2 id="book">${esc(PITCH.heading)}</h2>
|
|
200
|
+
<p>${esc(PITCH.lead)}</p>
|
|
201
|
+
<ul role="list" class="grid waitlist-pitch" data-columns="2">${PITCH.lines.map((l) => `<li><a href="${esc(utm(l.href, s, 'pitch'))}" rel="noopener"><strong>${esc(l.title)}</strong></a><br><small class="muted">${esc(l.text)}</small></li>`).join('')}</ul>
|
|
202
|
+
<h3>Book a free 30-minute call</h3>
|
|
203
|
+
<book-a-call handle="${esc(b.handle)}" api="${esc(b.api)}"><p><a class="button" href="${esc(b.url)}" rel="noopener">Pick a time for a call</a></p></book-a-call>
|
|
204
|
+
</section>`;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// --- promo: more from the network ------------------------------------------------
|
|
208
|
+
|
|
209
|
+
/** Who reads this site, for the cross-promo catalog: the spec's own, else by hierarchy. */
|
|
210
|
+
export function audienceFor(s) {
|
|
211
|
+
if (s.promoAudience) return [].concat(s.promoAudience);
|
|
212
|
+
const top = String(s.name).split('.')[0];
|
|
213
|
+
if (top === 'comp' || top === 'sci') return ['developers', 'makers'];
|
|
214
|
+
if (top === 'news' || top === 'talk') return ['publishers', 'makers'];
|
|
215
|
+
return ['makers', 'publishers'];
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export async function fetchPromo(s, { limit = 6 } = {}) {
|
|
219
|
+
try {
|
|
220
|
+
const { promoBlock } = await import('@profullstack/cross-promo');
|
|
221
|
+
const block = await promoBlock({ site: s.host, audience: audienceFor(s), limit, utm: false });
|
|
222
|
+
return block.items.map((i) => ({ ...i, href: utm(i.href, s, 'cross-promo') }));
|
|
223
|
+
} catch (err) {
|
|
224
|
+
process.emitWarning(`cross-promo skipped for ${s.host}: ${err.message}`);
|
|
225
|
+
return [];
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export function promoHtml(items) {
|
|
230
|
+
if (!items?.length) return '';
|
|
231
|
+
return `<section class="stack waitlist-promo" aria-labelledby="network"><h2 id="network">More from the network</h2>
|
|
232
|
+
<ul role="list" class="grid" data-columns="3">${items.map((i) => `<li class="card stack" data-space="sm"><a href="${esc(i.href)}" rel="noopener"><strong>${esc(i.name)}</strong></a><p>${esc(i.pitch)}</p></li>`).join('')}</ul>
|
|
233
|
+
</section>`;
|
|
234
|
+
}
|
package/src/waitlist.css
CHANGED
|
@@ -19,3 +19,14 @@
|
|
|
19
19
|
/* Looks (neon, matrix, terminal, amber, synthwave, geocities, vaporwave) come from
|
|
20
20
|
@profullstack/css/looks: <html data-look="...">. Only page tweaks live here. */
|
|
21
21
|
[data-look] .waitlist-hero h1 { font-size: clamp(2.2rem, 7vw, 4.5rem); }
|
|
22
|
+
|
|
23
|
+
/* book: the Profullstack pitch and <book-a-call> (0.6.0) */
|
|
24
|
+
.waitlist-book .waitlist-pitch li { padding-block: 0.25rem; }
|
|
25
|
+
.book-call { border: 1px solid var(--border, currentColor); border-radius: var(--radius, 0.5rem); padding: 1rem; }
|
|
26
|
+
.book-head { display: flex; flex-direction: column; gap: 0.125rem; }
|
|
27
|
+
.book-days, .book-times { display: flex; flex-wrap: wrap; gap: 0.375rem; }
|
|
28
|
+
.book-days button, .book-times button { min-width: 5.5rem; }
|
|
29
|
+
.book-nav { display: flex; justify-content: space-between; gap: 0.5rem; }
|
|
30
|
+
.book-call button.link { background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; color: inherit; }
|
|
31
|
+
.book-call[data-state="booked"] .cluster { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
|
|
32
|
+
.waitlist-book, .waitlist-promo { margin-block: 2rem; }
|