@m13v/seo-components 0.32.2 → 0.33.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m13v/seo-components",
3
- "version": "0.32.2",
3
+ "version": "0.33.0",
4
4
  "scripts": {
5
5
  "build:css": "tailwind -i src/_build.css -o dist/styles.css --minify",
6
6
  "lint:mobile-spans": "node scripts/lint-mobile-spans.mjs",
@@ -69,9 +69,22 @@ export interface InstallEmailGateProps {
69
69
  newsletterPath?: string;
70
70
  /** Render a custom trigger element instead of the default button. Receives an onClick handler. */
71
71
  renderTrigger?: (props: { onClick: () => void; disabled?: boolean }) => React.ReactNode;
72
+ /**
73
+ * Email-only delivery mode. When true, the command is NEVER revealed in the
74
+ * modal; instead, after a successful email submit the user sees a
75
+ * "Check your inbox" success state. The newsletter route is responsible for
76
+ * sending the install command via email. Forces a re-submit on every click
77
+ * (no localStorage skip) so each click drives a fresh send and a clean
78
+ * `newsletter_subscribed` + `get_started_click` signal.
79
+ */
80
+ emailOnly?: boolean;
81
+ /** Stage 2 (sent) heading when emailOnly is true. */
82
+ sentTitle?: string;
83
+ /** Stage 2 (sent) body copy when emailOnly is true. Receives the submitted email. */
84
+ sentDescription?: (email: string) => React.ReactNode;
72
85
  }
73
86
 
74
- type Stage = "closed" | "email" | "command";
87
+ type Stage = "closed" | "email" | "command" | "sent";
75
88
 
76
89
  export function InstallEmailGate({
77
90
  command,
@@ -92,10 +105,14 @@ export function InstallEmailGate({
92
105
  storageKey = DEFAULT_STORAGE_KEY,
93
106
  newsletterPath = "/api/newsletter",
94
107
  renderTrigger,
108
+ emailOnly = false,
109
+ sentTitle = "Check your inbox",
110
+ sentDescription,
95
111
  }: InstallEmailGateProps) {
96
112
  const capture = useCapture();
97
113
  const [stage, setStage] = useState<Stage>("closed");
98
114
  const [email, setEmail] = useState("");
115
+ const [submittedEmail, setSubmittedEmail] = useState("");
99
116
  const [submitting, setSubmitting] = useState(false);
100
117
  const [error, setError] = useState("");
101
118
  const [copied, setCopied] = useState<"command" | "config" | null>(null);
@@ -119,7 +136,10 @@ export function InstallEmailGate({
119
136
  }, [stage]);
120
137
 
121
138
  const onOpen = () => {
122
- const skip = remember && hasCapturedInstallEmail(storageKey);
139
+ // emailOnly mode: never skip via localStorage, never reveal the command.
140
+ // Every click goes through the email form so the user gets a fresh email
141
+ // and the funnel records a fresh signal.
142
+ const skip = !emailOnly && remember && hasCapturedInstallEmail(storageKey);
123
143
  if (skip) {
124
144
  // Gate already passed previously: fire the canonical funnel event for
125
145
  // the gated-passed click. No event when the gate is fresh and we're
@@ -168,20 +188,23 @@ export function InstallEmailGate({
168
188
  site,
169
189
  section,
170
190
  source: "install_gate",
191
+ delivery: emailOnly ? "email_only" : "page_reveal",
171
192
  });
172
193
  trackGetStartedClick({
173
- destination: "modal:command",
194
+ destination: emailOnly ? "email:install" : "modal:command",
174
195
  site,
175
196
  section,
176
197
  text: "email-submitted",
177
198
  component: "InstallEmailGate",
178
- extra: { email: trimmed },
199
+ extra: { email: trimmed, delivery: emailOnly ? "email_only" : "page_reveal" },
179
200
  });
180
- setStage("command");
201
+ setSubmittedEmail(trimmed);
202
+ setStage(emailOnly ? "sent" : "command");
181
203
  } catch (err) {
182
204
  console.warn("[InstallEmailGate] newsletter POST network error", err);
183
205
  if (remember) markInstallEmailCaptured(trimmed, storageKey);
184
- setStage("command");
206
+ setSubmittedEmail(trimmed);
207
+ setStage(emailOnly ? "sent" : "command");
185
208
  } finally {
186
209
  setSubmitting(false);
187
210
  }
@@ -291,11 +314,72 @@ export function InstallEmailGate({
291
314
  </button>
292
315
  </form>
293
316
  <p className="mt-4 text-xs text-zinc-500">
294
- Already subscribed? Submit anyway, the command unlocks either way.
317
+ {emailOnly
318
+ ? "Already subscribed? Submit anyway, we'll resend the install link."
319
+ : "Already subscribed? Submit anyway, the command unlocks either way."}
295
320
  </p>
296
321
  </div>
297
322
  )}
298
323
 
324
+ {stage === "sent" && (
325
+ <div className="p-7">
326
+ <div className="mb-5 flex items-start justify-between gap-4">
327
+ <div>
328
+ <div className="mb-3 inline-flex h-10 w-10 items-center justify-center rounded-full bg-teal-50 text-teal-600">
329
+ <svg
330
+ className="h-5 w-5"
331
+ fill="none"
332
+ viewBox="0 0 24 24"
333
+ stroke="currentColor"
334
+ strokeWidth={2}
335
+ aria-hidden="true"
336
+ >
337
+ <path strokeLinecap="round" strokeLinejoin="round" d="M3 8l7.5 5.25a3 3 0 003 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />
338
+ </svg>
339
+ </div>
340
+ <h2 className="text-xl font-semibold tracking-tight text-zinc-900">
341
+ {sentTitle}
342
+ </h2>
343
+ <p className="mt-1 text-sm leading-relaxed text-zinc-600">
344
+ {sentDescription
345
+ ? sentDescription(submittedEmail)
346
+ : (
347
+ <>
348
+ Sent the install command to{" "}
349
+ <span className="font-medium text-zinc-900">{submittedEmail}</span>.
350
+ It usually arrives in under a minute. If you don&apos;t see it, check
351
+ spam or promotions.
352
+ </>
353
+ )}
354
+ </p>
355
+ </div>
356
+ <CloseButton onClick={() => setStage("closed")} />
357
+ </div>
358
+
359
+ <div className="mt-5 flex items-center justify-between gap-3">
360
+ {githubUrl ? (
361
+ <a
362
+ href={githubUrl}
363
+ target="_blank"
364
+ rel="noopener noreferrer"
365
+ className="text-sm font-medium text-teal-700 hover:text-teal-800"
366
+ >
367
+ View on GitHub →
368
+ </a>
369
+ ) : (
370
+ <span />
371
+ )}
372
+ <button
373
+ type="button"
374
+ onClick={() => setStage("closed")}
375
+ className="rounded-md border border-zinc-300 bg-white px-4 py-2 text-sm font-medium text-zinc-900 hover:bg-zinc-50"
376
+ >
377
+ Done
378
+ </button>
379
+ </div>
380
+ </div>
381
+ )}
382
+
299
383
  {stage === "command" && (
300
384
  <div className="p-7">
301
385
  <div className="mb-5 flex items-start justify-between gap-4">