@apextelemed/partner-core 0.6.1 → 0.6.2

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.
@@ -3875,7 +3875,7 @@ var US_STATES3 = [
3875
3875
  var US_STATE_OPTIONS3 = US_STATES3.map((s) => ({ value: s, label: s }));
3876
3876
 
3877
3877
  // src/pages/AdminDashboard.tsx
3878
- import { createEffect as createEffect10, createSignal as createSignal31, ErrorBoundary, Match as Match2, Show as Show46, Switch as Switch2, For as For34 } from "solid-js";
3878
+ import { createEffect as createEffect10, createSignal as createSignal31, ErrorBoundary, Match as Match3, Show as Show46, Switch as Switch3, For as For34 } from "solid-js";
3879
3879
 
3880
3880
  // src/pages/admin/Affiliates.tsx
3881
3881
  import { createSignal as createSignal10, For as For14, Match, Switch } from "solid-js";
@@ -14289,7 +14289,7 @@ function EmailTemplates() {
14289
14289
  import { createResource as createResource21, createSignal as createSignal29, For as For32, Show as Show44 } from "solid-js";
14290
14290
 
14291
14291
  // src/pages/admin/Sequences.tsx
14292
- import { createResource as createResource20, createSignal as createSignal28, For as For31, Index as Index2, Show as Show43 } from "solid-js";
14292
+ import { createResource as createResource20, createSignal as createSignal28, For as For31, Index as Index2, Match as Match2, Show as Show43, Switch as Switch2 } from "solid-js";
14293
14293
 
14294
14294
  // src/pages/admin/funnelShared.ts
14295
14295
  var SEGMENT_KEYS = {
@@ -14360,10 +14360,9 @@ var label = { "font-size": "0.8125rem", color: "var(--app-admin-fg-muted)" };
14360
14360
  var field = { display: "grid", gap: "0.25rem" };
14361
14361
  function SequenceQueue(props) {
14362
14362
  const nav = useAdminNav();
14363
- const [reload, setReload] = createSignal28(0);
14364
14363
  const [busy, setBusy] = createSignal28(null);
14365
- const [queue, { refetch }] = createResource20(reload, () => apiFetch("/admin/funnel/queue"));
14366
- const rows = () => (queue()?.due ?? []).filter((r) => r.sequenceId === props.sequence.id);
14364
+ const rows = () => props.rows ?? [];
14365
+ const refetch = () => props.refetch();
14367
14366
  const act = async (row, action) => {
14368
14367
  setBusy(row.enrollmentId);
14369
14368
  try {
@@ -14390,7 +14389,7 @@ function SequenceQueue(props) {
14390
14389
  toastSuccess(
14391
14390
  Object.entries(r.outcomes).map(([k, n]) => `${n} ${OUTCOME_LABEL[k] ?? k}`).join(", ") || "Nothing was due"
14392
14391
  );
14393
- setReload(reload() + 1);
14392
+ refetch();
14394
14393
  props.onChanged();
14395
14394
  } catch (e) {
14396
14395
  toastError(e.message);
@@ -14398,24 +14397,28 @@ function SequenceQueue(props) {
14398
14397
  setBusy(null);
14399
14398
  }
14400
14399
  };
14401
- return <div class="app-admin-card" style={{ "margin-top": "1.25rem", overflow: "hidden" }}>
14402
- <div style={{ padding: "1rem 1.25rem", "border-bottom": "1px solid var(--app-admin-border-soft)", display: "flex", "justify-content": "space-between", "align-items": "center", gap: "1rem" }}>
14403
- <div>
14404
- <h2 class="app-admin-heading" style={{ "font-size": "0.9375rem", "font-weight": "600", margin: 0 }}>
14405
- Waiting to send{queue() ? ` \u2014 ${rows().length} due` : ""}
14406
- </h2>
14407
- <p style={{ ...label, "font-size": "0.75rem", margin: "0.25rem 0 0" }}>
14408
- {props.sequence.autoSend ? "Sending is automatic: the hourly check mails these itself. Anything listed here is due before its next run." : "Due by this sequence's schedule. Nothing here has been emailed, and nothing will be until you send it or turn automatic sending on."}
14409
- </p>
14410
- </div>
14411
- <Show43 when={rows().length > 0}>
14400
+ return <Section
14401
+ title="Waiting to send"
14402
+ count={rows().length}
14403
+ flush
14404
+ action={<Show43 when={rows().length > 0}>
14412
14405
  <button type="button" class="app-admin-btn app-admin-btn-primary app-admin-btn-sm" disabled={busy() === "all"} onClick={() => void sendAll()}>
14413
14406
  Send all due
14414
14407
  </button>
14415
- </Show43>
14416
- </div>
14417
- <Show43 when={queue()} fallback={<LoadingSpinner />}>
14418
- <Show43 when={rows().length > 0} fallback={<EmptyState message="Nobody in this sequence is due right now." />}>
14408
+ </Show43>}
14409
+ >
14410
+ <Show43 when={!props.sequence.autoSend}>
14411
+ <p class="app-admin-text-muted" style={{ "font-size": "0.75rem", margin: 0, padding: "0.625rem 1.25rem 0" }}>
14412
+ Nothing here has been emailed, and nothing will be until you send it or turn automatic sending on.
14413
+ </p>
14414
+ </Show43>
14415
+ <Show43 when={props.rows} fallback={<LoadingSpinner />}>
14416
+ <Show43
14417
+ when={rows().length > 0}
14418
+ fallback={<EmptyState
14419
+ message={props.sequence.autoSend ? "Nothing due \u2014 the hourly check sends these itself." : "Nobody is due right now."}
14420
+ />}
14421
+ >
14419
14422
  <table class="app-admin-table">
14420
14423
  <thead>
14421
14424
  <tr><th>Person</th><th>Came from</th><th>Waiting</th><th>Step</th><th /></tr>
@@ -14430,13 +14433,13 @@ function SequenceQueue(props) {
14430
14433
  </td>
14431
14434
  <td data-label="Came from">{segmentLongLabel(row.segmentAtAdd)}</td>
14432
14435
  <td data-label="Waiting">{daysAgo(row.anchoredAt)}</td>
14433
- <td data-label="Step">Step {row.stepIndex + 1} of {row.stepCount}</td>
14434
- <td>
14435
- <div style={{ display: "flex", gap: "0.375rem", "flex-wrap": "wrap" }}>
14436
+ <td data-label="Step">{row.stepIndex + 1} of {row.stepCount}</td>
14437
+ <td class="app-admin-table-cell--end">
14438
+ <div style={{ display: "flex", gap: "0.375rem", "justify-content": "flex-end" }}>
14436
14439
  <button type="button" class="app-admin-btn app-admin-btn-primary app-admin-btn-sm" disabled={busy() === row.enrollmentId} onClick={() => void act(row, "send")}>
14437
14440
  {busy() === row.enrollmentId ? "Sending\u2026" : "Send"}
14438
14441
  </button>
14439
- <button type="button" class="app-admin-btn app-admin-btn-sm" disabled={busy() === row.enrollmentId} onClick={() => void act(row, "skip")} title="Move past this step without emailing. They stay in the sequence for the next one.">
14442
+ <button type="button" class="app-admin-btn app-admin-btn-ghost app-admin-btn-sm" disabled={busy() === row.enrollmentId} onClick={() => void act(row, "skip")} title="Move past this step without emailing. They stay in the sequence for the next one.">
14440
14443
  Skip
14441
14444
  </button>
14442
14445
  </div>
@@ -14447,7 +14450,7 @@ function SequenceQueue(props) {
14447
14450
  </table>
14448
14451
  </Show43>
14449
14452
  </Show43>
14450
- </div>;
14453
+ </Section>;
14451
14454
  }
14452
14455
  var OUTCOME_LABEL = {
14453
14456
  sent: "sent",
@@ -14494,64 +14497,62 @@ function AddToSequence(props) {
14494
14497
  </Show43>
14495
14498
  </div>;
14496
14499
  }
14497
- function StepEditor(props) {
14498
- const nav = useAdminNav();
14500
+ function StepRow(props) {
14499
14501
  const set = (k, v) => props.onChange({ ...props.step, [k]: v });
14500
14502
  const missingTemplate = () => props.step.templateId && !props.templates.some((t) => t.id === props.step.templateId);
14501
- return <div class="app-admin-card-soft" style={{ padding: "1rem", display: "grid", gap: "1rem" }}>
14502
- <div style={{ display: "flex", "justify-content": "space-between", "align-items": "center" }}>
14503
- <strong style={{ "font-size": "0.875rem" }}>Step {props.index + 1}</strong>
14504
- <div style={{ display: "flex", gap: "0.375rem" }}>
14505
- <button type="button" class="app-admin-btn app-admin-btn-sm" onClick={() => props.onTest()}>Send me a test</button>
14506
- <Show43 when={props.count > 1}>
14507
- <button type="button" class="app-admin-btn app-admin-btn-ghost app-admin-btn-sm" onClick={() => props.onRemove()}>Remove step</button>
14508
- </Show43>
14509
- </div>
14510
- </div>
14511
- <div style={{ display: "grid", "grid-template-columns": "repeat(auto-fit, minmax(12rem, 1fr))", gap: "0.75rem" }}>
14512
- <label style={field}>
14513
- <span style={label}>{props.index === 0 ? "Hours after they are added" : "Hours after the previous step"}</span>
14514
- <input class="app-admin-input" type="number" min="1" max="720" value={props.step.waitHours} onInput={(e) => set("waitHours", Number(e.currentTarget.value))} />
14515
- </label>
14516
- <label style={field}>
14517
- <span style={label}>Template</span>
14518
- <Show43
14519
- when={props.templates.length > 0}
14520
- fallback={<div style={{ display: "flex", gap: "0.5rem", "align-items": "center", "flex-wrap": "wrap" }}>
14521
- <span class="app-admin-text-muted" style={{ "font-size": "0.8125rem" }}>Create one under Email › Templates first.</span>
14522
- <Show43 when={nav}>
14523
- <button type="button" class="app-admin-btn app-admin-btn-sm" onClick={() => nav.selectTab("email-templates")}>Open Email › Templates</button>
14524
- </Show43>
14525
- </div>}
14526
- >
14527
- <select class="app-admin-input" value={props.step.templateId} onChange={(e) => set("templateId", e.currentTarget.value)}>
14528
- <option value="">Choose a template…</option>
14529
- <Show43 when={missingTemplate()}>
14530
- <option value={props.step.templateId}>(deleted template)</option>
14531
- </Show43>
14532
- <For31 each={props.templates}>{(t) => <option value={t.id}>{t.name}</option>}</For31>
14533
- </select>
14534
- </Show43>
14535
- </label>
14536
- <label style={field}>
14537
- <span style={label}>Link ({"{{link}}"})</span>
14538
- <select class="app-admin-input" value={props.step.link} onChange={(e) => set("link", e.currentTarget.value)}>
14539
- <For31 each={LINKS}>{(l) => <option value={l}>{LINK_LABEL[l]}</option>}</For31>
14540
- </select>
14541
- </label>
14503
+ return <div
14504
+ style={{
14505
+ display: "grid",
14506
+ "grid-template-columns": "2rem minmax(7rem, 9rem) minmax(12rem, 2fr) minmax(10rem, 1fr) auto",
14507
+ gap: "0.5rem",
14508
+ "align-items": "center",
14509
+ padding: "0.625rem 1.25rem",
14510
+ "border-top": props.index === 0 ? "none" : "1px solid var(--app-admin-border-soft)"
14511
+ }}
14512
+ >
14513
+ <span class="app-admin-text-muted" style={{ "font-size": "0.8125rem", "font-weight": "600" }}>{props.index + 1}</span>
14514
+ <label style={{ display: "flex", gap: "0.375rem", "align-items": "center", "font-size": "0.8125rem" }}>
14515
+ <span class="app-admin-text-muted">{props.index === 0 ? "after" : "+"}</span>
14516
+ <input class="app-admin-input" type="number" min="1" max="720" aria-label={`Step ${props.index + 1} wait hours`} value={props.step.waitHours} onInput={(e) => set("waitHours", Number(e.currentTarget.value))} style={{ width: "4.5rem" }} />
14517
+ <span class="app-admin-text-muted">h</span>
14518
+ </label>
14519
+ <select class="app-admin-input" aria-label={`Step ${props.index + 1} template`} value={props.step.templateId} onChange={(e) => set("templateId", e.currentTarget.value)}>
14520
+ <option value="">Choose a template…</option>
14521
+ <Show43 when={missingTemplate()}>
14522
+ <option value={props.step.templateId}>(deleted template)</option>
14523
+ </Show43>
14524
+ <For31 each={props.templates}>{(t) => <option value={t.id}>{t.name}</option>}</For31>
14525
+ </select>
14526
+ <select class="app-admin-input" aria-label={`Step ${props.index + 1} link`} value={props.step.link} onChange={(e) => set("link", e.currentTarget.value)}>
14527
+ <For31 each={LINKS}>{(l) => <option value={l}>{LINK_LABEL[l]}</option>}</For31>
14528
+ </select>
14529
+ <div style={{ display: "flex", gap: "0.25rem" }}>
14530
+ <button type="button" class="app-admin-btn app-admin-btn-ghost app-admin-btn-sm" disabled={!props.canTest} title={props.canTest ? "Email this step to me" : "Save first"} onClick={() => props.onTest()}>Test</button>
14531
+ <button type="button" class="app-admin-btn app-admin-btn-ghost app-admin-btn-sm" disabled={props.count <= 1} title="Remove step" aria-label={`Remove step ${props.index + 1}`} onClick={() => props.onRemove()}>×</button>
14542
14532
  </div>
14543
14533
  </div>;
14544
14534
  }
14535
+ var checkboxRow = { "font-size": "0.8125rem", display: "flex", gap: "0.5rem", "align-items": "flex-start" };
14545
14536
  function SequenceEditor(props) {
14546
14537
  const nav = useAdminNav();
14547
14538
  const [draft, setDraft] = createSignal28(JSON.parse(JSON.stringify(props.initial)));
14548
14539
  const [saving, setSaving] = createSignal28(false);
14549
14540
  const [error, setError] = createSignal28(null);
14550
14541
  const isNew = () => !draft().id;
14542
+ const dirty = () => JSON.stringify(draft()) !== JSON.stringify(props.initial);
14551
14543
  const [enrollments, { refetch: refetchEnrollments }] = createResource20(
14552
14544
  () => props.initial.id || null,
14553
14545
  (id) => apiFetch(`/admin/funnel/sequences/${id}/enrollments`)
14554
14546
  );
14547
+ const [queue, { refetch: refetchQueue }] = createResource20(
14548
+ () => props.initial.id || null,
14549
+ () => apiFetch("/admin/funnel/queue")
14550
+ );
14551
+ const dueRows = () => queue() ? queue().due.filter((r) => r.sequenceId === props.initial.id) : void 0;
14552
+ const [tab, setTab] = createSignal28(isNew() ? "settings" : "queue");
14553
+ const tabKeys = () => isNew() ? ["steps", "settings"] : ["queue", "steps", "people", "settings"];
14554
+ const TAB_LABEL = { queue: "Queue", steps: "Steps", people: "People", settings: "Settings" };
14555
+ const tabCount = (key) => key === "queue" ? dueRows()?.length : key === "steps" ? draft().steps.length : key === "people" ? enrollments()?.enrollments.length : void 0;
14555
14556
  const update = (patch) => setDraft({ ...draft(), ...patch });
14556
14557
  const setStep = (i, s) => update({ steps: draft().steps.map((x, j) => j === i ? s : x) });
14557
14558
  const payload = () => {
@@ -14591,10 +14592,6 @@ function SequenceEditor(props) {
14591
14592
  }
14592
14593
  };
14593
14594
  const test = async (stepIndex) => {
14594
- if (isNew()) {
14595
- toastError("Save the sequence first, then send a test.");
14596
- return;
14597
- }
14598
14595
  try {
14599
14596
  const r = await apiFetch(`/admin/funnel/sequences/${draft().id}/test`, { method: "POST", body: JSON.stringify({ stepIndex }) });
14600
14597
  toastSuccess(`Test sent to ${r.to} \u2014 uses the saved step and its template, not unsaved edits.`);
@@ -14615,137 +14612,200 @@ function SequenceEditor(props) {
14615
14612
  const cur = draft().feedSegments;
14616
14613
  update({ feedSegments: cur.includes(key) ? cur.filter((k) => k !== key) : [...cur, key] });
14617
14614
  };
14618
- return <div class="app-admin-card" style={{ "margin-top": "1.25rem" }}>
14619
- <div style={{ padding: "1rem 1.25rem", "border-bottom": "1px solid var(--app-admin-border-soft)", display: "flex", "justify-content": "space-between", "align-items": "center" }}>
14620
- <h2 class="app-admin-heading" style={{ "font-size": "0.9375rem", "font-weight": "600", margin: 0 }}>{isNew() ? "New sequence" : draft().name}</h2>
14621
- <button type="button" class="app-admin-btn app-admin-btn-ghost app-admin-btn-sm" onClick={() => props.onClose()}>Back to list</button>
14622
- </div>
14615
+ const feedSummary = () => draft().feedSegments.length > 0 ? `Fed by ${draft().feedSegments.length} segment${draft().feedSegments.length === 1 ? "" : "s"}, last ${draft().feedMaxAgeDays ?? 30} days` : "Enrolled by hand only";
14616
+ return <div>
14617
+ <DetailHeader
14618
+ backLabel="Sequences"
14619
+ onBack={() => props.onClose()}
14620
+ title={isNew() ? "New sequence" : draft().name || "Untitled sequence"}
14621
+ subtitle={draft().description || (isNew() ? "Timed emails for people who stopped short of a subscription." : void 0)}
14622
+ badges={<>
14623
+ <span class={`app-admin-badge app-admin-badge--${draft().autoSend ? "success" : "info"}`} style={{ "text-transform": "none" }}>{draft().autoSend ? "Sends automatically" : "Sends on review"}</span>
14624
+ <span class="app-admin-badge app-admin-badge--neutral" style={{ "text-transform": "none" }}>{feedSummary()}</span>
14625
+ <Show43 when={!isNew() && enrollments()}>
14626
+ <span class="app-admin-badge app-admin-badge--neutral" style={{ "text-transform": "none" }}>{enrollments().enrollments.length} in it</span>
14627
+ </Show43>
14628
+ </>}
14629
+ actions={<>
14630
+ <Show43 when={!isNew()}>
14631
+ <button type="button" class="app-admin-btn app-admin-btn-ghost app-admin-btn-sm" onClick={() => void archive()}>Archive</button>
14632
+ </Show43>
14633
+ <button type="button" class="app-admin-btn app-admin-btn-primary" disabled={saving() || !isNew() && !dirty()} onClick={() => void save()}>
14634
+ {saving() ? "Saving\u2026" : isNew() ? "Create sequence" : "Save changes"}
14635
+ </button>
14636
+ </>}
14637
+ />
14623
14638
 
14624
- <Show43 when={!isNew()}>
14625
- <div style={{ padding: "0 1.25rem" }}>
14626
- <SequenceQueue sequence={props.initial} onChanged={props.onChanged} />
14627
- </div>
14639
+ <Show43 when={error()}>
14640
+ <AlertItem severity="danger" title="Could not save" detail={error()} />
14628
14641
  </Show43>
14629
14642
 
14630
- <div style={{ padding: "1rem 1.25rem", display: "grid", gap: "1rem" }}>
14631
- <div style={{ display: "grid", "grid-template-columns": "repeat(auto-fit, minmax(14rem, 1fr))", gap: "0.75rem" }}>
14632
- <label style={field}>
14633
- <span style={label}>Name</span>
14634
- <input class="app-admin-input" value={draft().name} maxLength={120} onInput={(e) => update({ name: e.currentTarget.value })} placeholder="Finish your visit" />
14635
- </label>
14636
- <label style={field}>
14637
- <span style={label}>Description (internal)</span>
14638
- <input class="app-admin-input" value={draft().description ?? ""} maxLength={500} onInput={(e) => update({ description: e.currentTarget.value || null })} />
14639
- </label>
14640
- </div>
14641
-
14643
+ <nav
14644
+ role="tablist"
14645
+ aria-label="Sequence sections"
14646
+ style={{ display: "flex", gap: "0.25rem", "border-bottom": "1px solid var(--app-admin-border)", margin: "1rem 0 1.25rem" }}
14647
+ >
14648
+ <For31 each={tabKeys()}>
14649
+ {(key) => <button
14650
+ type="button"
14651
+ role="tab"
14652
+ aria-selected={tab() === key}
14653
+ onClick={() => setTab(key)}
14654
+ style={{
14655
+ padding: "0.625rem 1rem",
14656
+ "margin-bottom": "-1px",
14657
+ "font-size": "0.8125rem",
14658
+ "font-weight": "600",
14659
+ "text-transform": "uppercase",
14660
+ "letter-spacing": "0.05em",
14661
+ "border-bottom": "2px solid",
14662
+ "border-color": tab() === key ? "var(--app-admin-primary)" : "transparent",
14663
+ color: tab() === key ? "var(--app-admin-primary)" : "var(--app-admin-fg-muted)",
14664
+ background: "none",
14665
+ "border-top": "none",
14666
+ "border-left": "none",
14667
+ "border-right": "none",
14668
+ cursor: "pointer"
14669
+ }}
14670
+ >
14671
+ {TAB_LABEL[key]}
14672
+ <Show43 when={tabCount(key) !== void 0}>
14673
+ <span style={{ "margin-left": "0.375rem", opacity: 0.7 }}>{tabCount(key)}</span>
14674
+ </Show43>
14675
+ </button>}
14676
+ </For31>
14677
+ </nav>
14642
14678
 
14643
- <Index2 each={draft().steps}>
14644
- {(step, i) => <StepEditor
14679
+ <Switch2>
14680
+ <Match2 when={tab() === "queue"}>
14681
+ <SequenceQueue sequence={props.initial} rows={dueRows()} refetch={() => void refetchQueue()} onChanged={props.onChanged} />
14682
+ </Match2>
14683
+ <Match2 when={tab() === "steps"}>
14684
+ <Section
14685
+ title="Steps"
14686
+ count={draft().steps.length}
14687
+ flush
14688
+ action={<button type="button" class="app-admin-btn app-admin-btn-sm" disabled={draft().steps.length >= 8} onClick={() => update({ steps: [...draft().steps, { ...EMPTY_STEP, waitHours: 72 }] })}>
14689
+ Add step
14690
+ </button>}
14691
+ >
14692
+ <Show43
14693
+ when={props.templates.length > 0}
14694
+ fallback={<div style={{ padding: "1rem 1.25rem", display: "flex", gap: "0.75rem", "align-items": "center", "flex-wrap": "wrap" }}>
14695
+ <span class="app-admin-text-muted" style={{ "font-size": "0.8125rem" }}>A step sends a marketing template. Create one under Email › Templates first.</span>
14696
+ <Show43 when={nav}>
14697
+ <button type="button" class="app-admin-btn app-admin-btn-sm" onClick={() => nav.selectTab("email-templates")}>Open Email › Templates</button>
14698
+ </Show43>
14699
+ </div>}
14700
+ >
14701
+ <p class="app-admin-text-muted" style={{ "font-size": "0.75rem", margin: 0, padding: "0.625rem 1.25rem 0" }}>
14702
+ Each step waits the given hours after the previous one (the first, after enrollment), then sends its template with the chosen link.
14703
+ </p>
14704
+ <Index2 each={draft().steps}>
14705
+ {(step, i) => <StepRow
14645
14706
  index={i}
14646
14707
  step={step()}
14647
14708
  count={draft().steps.length}
14648
14709
  templates={props.templates}
14710
+ canTest={!isNew()}
14649
14711
  onChange={(s) => setStep(i, s)}
14650
14712
  onRemove={() => update({ steps: draft().steps.filter((_, j) => j !== i) })}
14651
14713
  onTest={() => void test(i)}
14652
14714
  />}
14653
- </Index2>
14654
- <div>
14655
- <button type="button" class="app-admin-btn app-admin-btn-sm" disabled={draft().steps.length >= 8} onClick={() => update({ steps: [...draft().steps, { ...EMPTY_STEP, waitHours: 72 }] })}>
14656
- Add a step
14657
- </button>
14658
- </div>
14659
-
14660
- <div class="app-admin-card-soft" style={{ padding: "1rem", display: "grid", gap: "0.75rem" }}>
14661
- <strong style={{ "font-size": "0.875rem" }}>Who gets enrolled</strong>
14662
- <p class="app-admin-text-muted" style={{ "font-size": "0.75rem", margin: 0 }}>
14663
- People you add from the Funnel tab are always enrolled. Tick segments below and the hourly check also enrolls anyone who enters them — and removes them when they leave. Their clock starts from their own entry.
14664
- </p>
14665
- <For31 each={["a", "b"]}>
14666
- {(g) => <div>
14667
- <div style={{ ...label, "margin-bottom": "0.25rem" }}>{GROUP_LABEL[g]}</div>
14668
- <div style={{ display: "flex", "flex-wrap": "wrap", gap: "0.5rem 1rem" }}>
14669
- <For31 each={SEGMENT_KEYS[g]}>
14670
- {(key) => <label style={{ "font-size": "0.8125rem", display: "flex", gap: "0.375rem", "align-items": "center" }}>
14671
- <input type="checkbox" checked={draft().feedSegments.includes(key)} onChange={() => toggleSegment(key)} />
14672
- {SEGMENT_LABEL[key]}
14673
- </label>}
14674
- </For31>
14675
- </div>
14676
- </div>}
14677
- </For31>
14678
- <Show43 when={draft().feedSegments.length > 0}>
14679
- <div style={{ display: "grid", "grid-template-columns": "repeat(auto-fit, minmax(14rem, 1fr))", gap: "0.75rem" }}>
14680
- <label style={field}>
14681
- <span style={label}>Only enroll people who entered in the last (days)</span>
14682
- <input class="app-admin-input" type="number" min="1" max="365" value={draft().feedMaxAgeDays ?? 30} onInput={(e) => update({ feedMaxAgeDays: Number(e.currentTarget.value) })} />
14683
- <span class="app-admin-text-muted" style={{ "font-size": "0.75rem" }}>So switching a feed on never mails months-old accounts. Add those by hand from the Funnel tab if you want them.</span>
14684
- </label>
14685
- <label style={{ "font-size": "0.8125rem", display: "flex", gap: "0.375rem", "align-items": "center" }}>
14686
- <input type="checkbox" checked={draft().feedQualifiedOnly} onChange={(e) => update({ feedQualifiedOnly: e.currentTarget.checked })} />
14687
- Skip people whose questionnaire did not qualify
14715
+ </Index2>
14716
+ </Show43>
14717
+ </Section>
14718
+ </Match2>
14719
+ <Match2 when={tab() === "people"}>
14720
+ <Section title="People in this sequence" count={enrollments()?.enrollments.length} flush>
14721
+ <Show43 when={enrollments()} fallback={<LoadingSpinner />}>
14722
+ <Show43 when={enrollments().enrollments.length > 0} fallback={<EmptyState message="Nobody yet. Add people from the Funnel tab, or feed the sequence from a segment." />}>
14723
+ <table class="app-admin-table">
14724
+ <thead>
14725
+ <tr><th>Person</th><th>Came from</th><th>Step</th><th>Next due</th><th /></tr>
14726
+ </thead>
14727
+ <tbody>
14728
+ <For31 each={enrollments().enrollments}>
14729
+ {(e) => <tr>
14730
+ <td data-label="Person">
14731
+ <Show43 when={e.userId && nav} fallback={e.email}>
14732
+ <button type="button" class="app-admin-link-btn" style={{ "font-size": "inherit" }} onClick={() => nav.openCustomer(e.userId)}>{e.email}</button>
14733
+ </Show43>
14734
+ <div class="app-admin-text-muted" style={{ "font-size": "0.75rem" }}>{e.source === "feed" ? "enrolled by the feed" : "added by hand"} · {formatDate(e.addedAt)}</div>
14735
+ </td>
14736
+ <td data-label="Came from">{segmentLongLabel(e.segmentAtAdd)}</td>
14737
+ <td data-label="Step">{Math.min(e.stepIndex + 1, draft().steps.length)} of {draft().steps.length}</td>
14738
+ <td data-label="Next due" class="app-admin-text-muted">{e.nextDueAt ? formatDate(e.nextDueAt) : "\u2014"}</td>
14739
+ <td class="app-admin-table-cell--end"><button type="button" class="app-admin-btn app-admin-btn-ghost app-admin-btn-sm" onClick={() => void remove(e)}>Remove</button></td>
14740
+ </tr>}
14741
+ </For31>
14742
+ </tbody>
14743
+ </table>
14744
+ </Show43>
14745
+ </Show43>
14746
+ </Section>
14747
+ </Match2>
14748
+ <Match2 when={tab() === "settings"}>
14749
+ <div style={{ "max-width": "40rem" }}>
14750
+ <Section title="About">
14751
+ <div style={{ display: "grid", gap: "0.75rem" }}>
14752
+ <label style={field}>
14753
+ <span style={label}>Name</span>
14754
+ <input class="app-admin-input" value={draft().name} maxLength={120} onInput={(e) => update({ name: e.currentTarget.value })} placeholder="Finish your visit" />
14755
+ </label>
14756
+ <label style={field}>
14757
+ <span style={label}>Notes (internal)</span>
14758
+ <input class="app-admin-input" value={draft().description ?? ""} maxLength={500} onInput={(e) => update({ description: e.currentTarget.value || null })} placeholder="Who this is for and why" />
14759
+ </label>
14760
+ </div>
14761
+ </Section>
14762
+
14763
+ <Section title="Sending">
14764
+ <label style={checkboxRow}>
14765
+ <input type="checkbox" aria-label="Send automatically when a step is due" checked={draft().autoSend} onChange={(e) => update({ autoSend: e.currentTarget.checked })} />
14766
+ <span>
14767
+ Send automatically when a step is due
14768
+ <span class="app-admin-text-muted" style={{ display: "block", "font-size": "0.75rem", "margin-top": "0.125rem" }}>
14769
+ {draft().autoSend ? "The hourly check emails due steps itself. Buyers and unsubscribes drop out first; one sequence email per person per day." : "Off: due steps wait under \u201CWaiting to send\u201D for you."}
14770
+ </span>
14771
+ </span>
14688
14772
  </label>
14689
- </div>
14690
- </Show43>
14691
- </div>
14692
-
14693
- <div class="app-admin-card-soft" style={{ padding: "1rem", display: "grid", gap: "0.5rem" }}>
14694
- <strong style={{ "font-size": "0.875rem" }}>How emails go out</strong>
14695
- <label style={{ "font-size": "0.8125rem", display: "flex", gap: "0.375rem", "align-items": "center" }}>
14696
- <input type="checkbox" checked={draft().autoSend} onChange={(e) => update({ autoSend: e.currentTarget.checked })} />
14697
- Send automatically when a step is due
14698
- </label>
14699
- <p class="app-admin-text-muted" style={{ "font-size": "0.75rem", margin: 0 }}>
14700
- {draft().autoSend ? "Due steps are emailed by the hourly check with no further review. Anyone who buys or unsubscribes drops out first; nobody gets more than one sequence email a day." : "Due steps wait under \u201CWaiting to send\u201D for you to send or skip them."}
14701
- </p>
14702
- </div>
14773
+ </Section>
14703
14774
 
14704
- <Show43 when={error()}>
14705
- <p style={{ color: "var(--app-admin-danger-fg)", "font-size": "0.8125rem", margin: 0 }}>{error()}</p>
14706
- </Show43>
14707
- <div style={{ display: "flex", gap: "0.5rem", "align-items": "center" }}>
14708
- <button type="button" class="app-admin-btn app-admin-btn-primary" disabled={saving()} onClick={() => void save()}>
14709
- {saving() ? "Saving\u2026" : isNew() ? "Create sequence" : "Save changes"}
14710
- </button>
14711
- <Show43 when={!isNew()}>
14712
- <button type="button" class="app-admin-btn app-admin-btn-danger app-admin-btn-sm" onClick={() => void archive()}>Archive</button>
14713
- </Show43>
14714
- </div>
14715
- </div>
14716
-
14717
- <Show43 when={!isNew()}>
14718
- <div style={{ "border-top": "1px solid var(--app-admin-border-soft)" }}>
14719
- <div style={{ padding: "0.75rem 1.25rem" }}>
14720
- <strong style={{ "font-size": "0.875rem" }}>In this sequence — {enrollments()?.enrollments.length ?? "\u2026"}</strong>
14775
+ <Section title="Who gets enrolled">
14776
+ <div style={{ display: "grid", gap: "0.75rem" }}>
14777
+ <p class="app-admin-text-muted" style={{ "font-size": "0.75rem", margin: 0 }}>
14778
+ Anyone you add from the Funnel tab. Tick segments to also enroll whoever enters them (the hourly check adds and removes them; their clock starts at their own entry).
14779
+ </p>
14780
+ <For31 each={["a", "b"]}>
14781
+ {(g) => <div>
14782
+ <div style={{ ...label, "font-size": "0.75rem", "margin-bottom": "0.25rem" }}>{GROUP_LABEL[g]}</div>
14783
+ <div style={{ display: "grid", gap: "0.25rem" }}>
14784
+ <For31 each={SEGMENT_KEYS[g]}>
14785
+ {(key) => <label style={{ "font-size": "0.8125rem", display: "flex", gap: "0.375rem", "align-items": "center" }}>
14786
+ <input type="checkbox" checked={draft().feedSegments.includes(key)} onChange={() => toggleSegment(key)} />
14787
+ {SEGMENT_LABEL[key]}
14788
+ </label>}
14789
+ </For31>
14790
+ </div>
14791
+ </div>}
14792
+ </For31>
14793
+ <Show43 when={draft().feedSegments.length > 0}>
14794
+ <label style={field}>
14795
+ <span style={label}>Only enroll people who entered in the last (days)</span>
14796
+ <input class="app-admin-input" type="number" min="1" max="365" value={draft().feedMaxAgeDays ?? 30} onInput={(e) => update({ feedMaxAgeDays: Number(e.currentTarget.value) })} />
14797
+ <span class="app-admin-text-muted" style={{ "font-size": "0.75rem" }}>So a feed never mails months-old accounts. Add those by hand if you want them.</span>
14798
+ </label>
14799
+ <label style={{ "font-size": "0.8125rem", display: "flex", gap: "0.375rem", "align-items": "center" }}>
14800
+ <input type="checkbox" checked={draft().feedQualifiedOnly} onChange={(e) => update({ feedQualifiedOnly: e.currentTarget.checked })} />
14801
+ Skip people whose questionnaire did not qualify
14802
+ </label>
14803
+ </Show43>
14804
+ </div>
14805
+ </Section>
14721
14806
  </div>
14722
- <Show43 when={enrollments()} fallback={<LoadingSpinner />}>
14723
- <Show43 when={enrollments().enrollments.length > 0} fallback={<EmptyState message="Nobody yet. Add people from the Funnel tab, or tick a segment above." />}>
14724
- <table class="app-admin-table">
14725
- <thead>
14726
- <tr><th>Person</th><th>Came from</th><th>Step</th><th>Next due</th><th /></tr>
14727
- </thead>
14728
- <tbody>
14729
- <For31 each={enrollments().enrollments}>
14730
- {(e) => <tr>
14731
- <td data-label="Person">
14732
- <Show43 when={e.userId && nav} fallback={e.email}>
14733
- <button type="button" class="app-admin-link-btn" style={{ "font-size": "inherit" }} onClick={() => nav.openCustomer(e.userId)}>{e.email}</button>
14734
- </Show43>
14735
- <div class="app-admin-text-muted" style={{ "font-size": "0.75rem" }}>{e.source === "feed" ? "enrolled by the feed" : "added by hand"} · {formatDate(e.addedAt)}</div>
14736
- </td>
14737
- <td data-label="Came from">{segmentLongLabel(e.segmentAtAdd)}</td>
14738
- <td data-label="Step">{Math.min(e.stepIndex + 1, draft().steps.length)} of {draft().steps.length}</td>
14739
- <td data-label="Next due" class="app-admin-text-muted">{e.nextDueAt ? formatDate(e.nextDueAt) : "\u2014"}</td>
14740
- <td><button type="button" class="app-admin-btn app-admin-btn-ghost app-admin-btn-sm" onClick={() => void remove(e)}>Remove</button></td>
14741
- </tr>}
14742
- </For31>
14743
- </tbody>
14744
- </table>
14745
- </Show43>
14746
- </Show43>
14747
- </div>
14748
- </Show43>
14807
+ </Match2>
14808
+ </Switch2>
14749
14809
  </div>;
14750
14810
  }
14751
14811
  function Sequences() {
@@ -14761,7 +14821,9 @@ function Sequences() {
14761
14821
  void refetchQueue();
14762
14822
  };
14763
14823
  return <div>
14764
- <PageTitle subtitle="Timed emails for people who stopped short of a subscription">Sequences</PageTitle>
14824
+ <Show43 when={!editing()}>
14825
+ <PageTitle subtitle="Timed emails for people who stopped short of a subscription">Sequences</PageTitle>
14826
+ </Show43>
14765
14827
 
14766
14828
  <Show43
14767
14829
  when={editing()}
@@ -15492,22 +15554,22 @@ function AdminDashboard(props) {
15492
15554
  }
15493
15555
  <Show46 when={currentTab()} keyed>
15494
15556
  <ErrorBoundary fallback={(err, reset) => <AdminTabError error={err} reset={reset} />}>
15495
- <Switch2 fallback={<Dashboard onSelectTab={handleTabClick} isTabEnabled={isTabEnabled} />}>
15496
- <Match2 when={currentTab() === "dashboard"}>
15557
+ <Switch3 fallback={<Dashboard onSelectTab={handleTabClick} isTabEnabled={isTabEnabled} />}>
15558
+ <Match3 when={currentTab() === "dashboard"}>
15497
15559
  <Dashboard onSelectTab={handleTabClick} isTabEnabled={isTabEnabled} />
15498
- </Match2>
15499
- <Match2 when={currentTab() === "customers"}>
15560
+ </Match3>
15561
+ <Match3 when={currentTab() === "customers"}>
15500
15562
  <Customers
15501
15563
  passwordResetRedirectUrl={props.passwordResetRedirectUrl}
15502
15564
  activeUid={props.customers?.activeUid}
15503
15565
  onSelectCustomer={props.customers?.onSelectCustomer}
15504
15566
  initialUid={pendingCustomerUid()}
15505
15567
  />
15506
- </Match2>
15507
- <Match2 when={currentTab() === "payments"}>
15568
+ </Match3>
15569
+ <Match3 when={currentTab() === "payments"}>
15508
15570
  <Payments />
15509
- </Match2>
15510
- <Match2 when={currentTab() === "subscriptions"}>
15571
+ </Match3>
15572
+ <Match3 when={currentTab() === "subscriptions"}>
15511
15573
  {
15512
15574
  /* Retired tab alias: the customer list, filtered to active subscribers. */
15513
15575
  }
@@ -15517,41 +15579,41 @@ function AdminDashboard(props) {
15517
15579
  activeUid={props.customers?.activeUid}
15518
15580
  onSelectCustomer={props.customers?.onSelectCustomer}
15519
15581
  />
15520
- </Match2>
15521
- <Match2 when={currentTab() === "products"}>
15582
+ </Match3>
15583
+ <Match3 when={currentTab() === "products"}>
15522
15584
  <Products productDefaultsLookup={props.productDefaultsLookup} />
15523
- </Match2>
15524
- <Match2 when={currentTab() === "categories"}>
15585
+ </Match3>
15586
+ <Match3 when={currentTab() === "categories"}>
15525
15587
  <Categories />
15526
- </Match2>
15527
- <Match2 when={currentTab() === "sales"}>
15588
+ </Match3>
15589
+ <Match3 when={currentTab() === "sales"}>
15528
15590
  <Sales />
15529
- </Match2>
15530
- <Match2 when={currentTab() === "promo-codes"}>
15591
+ </Match3>
15592
+ <Match3 when={currentTab() === "promo-codes"}>
15531
15593
  <PromoCodes affiliatesEnabled={affiliatesEnabled()} />
15532
- </Match2>
15533
- <Match2 when={currentTab() === "affiliates"}>
15594
+ </Match3>
15595
+ <Match3 when={currentTab() === "affiliates"}>
15534
15596
  <Affiliates {...props.affiliates ?? {}} />
15535
- </Match2>
15536
- <Match2 when={currentTab() === "support"}>
15597
+ </Match3>
15598
+ <Match3 when={currentTab() === "support"}>
15537
15599
  <Support initialThreadId={pendingThreadId()} />
15538
- </Match2>
15539
- <Match2 when={currentTab() === "webhooks"}>
15600
+ </Match3>
15601
+ <Match3 when={currentTab() === "webhooks"}>
15540
15602
  <Webhooks />
15541
- </Match2>
15542
- <Match2 when={currentTab() === "email-templates"}>
15603
+ </Match3>
15604
+ <Match3 when={currentTab() === "email-templates"}>
15543
15605
  <EmailTemplates />
15544
- </Match2>
15545
- <Match2 when={currentTab() === "funnel"}>
15606
+ </Match3>
15607
+ <Match3 when={currentTab() === "funnel"}>
15546
15608
  <Funnel />
15547
- </Match2>
15548
- <Match2 when={currentTab() === "sequences"}>
15609
+ </Match3>
15610
+ <Match3 when={currentTab() === "sequences"}>
15549
15611
  <Sequences />
15550
- </Match2>
15551
- <Match2 when={currentTab() === "email-notifications"}>
15612
+ </Match3>
15613
+ <Match3 when={currentTab() === "email-notifications"}>
15552
15614
  <EmailNotifications />
15553
- </Match2>
15554
- </Switch2>
15615
+ </Match3>
15616
+ </Switch3>
15555
15617
  </ErrorBoundary>
15556
15618
  </Show46>
15557
15619
  </div>
@@ -16028,7 +16090,7 @@ function UpdatePaymentMethod(props) {
16028
16090
  }
16029
16091
 
16030
16092
  // src/pages/MemberPortal.tsx
16031
- import { Show as Show56, Switch as Switch4, Match as Match4, For as For41, createSignal as createSignal38, onMount as onMount3 } from "solid-js";
16093
+ import { Show as Show56, Switch as Switch5, Match as Match5, For as For41, createSignal as createSignal38, onMount as onMount3 } from "solid-js";
16032
16094
 
16033
16095
  // src/pages/member/OrderTracker.tsx
16034
16096
  import { Show as Show49, For as For36, createSignal as createSignal32 } from "solid-js";
@@ -16693,7 +16755,7 @@ function MedicationGuide(props) {
16693
16755
  }
16694
16756
 
16695
16757
  // src/pages/member/MessagesPanel.tsx
16696
- import { Show as Show54, For as For39, Switch as Switch3, Match as Match3, createEffect as createEffect11, createSignal as createSignal36, on as on7 } from "solid-js";
16758
+ import { Show as Show54, For as For39, Switch as Switch4, Match as Match4, createEffect as createEffect11, createSignal as createSignal36, on as on7 } from "solid-js";
16697
16759
  import DOMPurify from "dompurify";
16698
16760
  function sanitizeMessageHtml(html) {
16699
16761
  return DOMPurify.sanitize(html, {
@@ -17528,17 +17590,17 @@ function MessagesPanel(props) {
17528
17590
  </div>
17529
17591
  <div class={`msg-panel__main${threadOpen() ? "" : " msg-panel__main--hidden-mobile"}`}>
17530
17592
  <Show54 when={composing()}>
17531
- <Switch3>
17532
- <Match3 when={composeStep() === "care"}>
17593
+ <Switch4>
17594
+ <Match4 when={composeStep() === "care"}>
17533
17595
  <NewCareTeamThread />
17534
- </Match3>
17535
- <Match3 when={composeStep() === "care-notice"}>
17596
+ </Match4>
17597
+ <Match4 when={composeStep() === "care-notice"}>
17536
17598
  <CareTeamNotice />
17537
- </Match3>
17538
- <Match3 when={composeStep() === "support"}>
17599
+ </Match4>
17600
+ <Match4 when={composeStep() === "support"}>
17539
17601
  <NewSupportThread />
17540
- </Match3>
17541
- </Switch3>
17602
+ </Match4>
17603
+ </Switch4>
17542
17604
  </Show54>
17543
17605
  <Show54 when={!composing()}>
17544
17606
  <Show54
@@ -17841,11 +17903,11 @@ function MemberPortal(props) {
17841
17903
  </button>
17842
17904
  </div>}
17843
17905
  >
17844
- <Switch4 fallback={<TrackerTab />}>
17845
- <Match4 when={tab() === "instructions" && guide()}>
17906
+ <Switch5 fallback={<TrackerTab />}>
17907
+ <Match5 when={tab() === "instructions" && guide()}>
17846
17908
  {(g) => <MedicationGuide guide={g()} currentDose={currentDose()} />}
17847
- </Match4>
17848
- <Match4 when={tab() === "plan"}>
17909
+ </Match5>
17910
+ <Match5 when={tab() === "plan"}>
17849
17911
  <PlanBilling
17850
17912
  subscriptions={data.subscriptions()}
17851
17913
  brandName={props.brand.name}
@@ -17855,11 +17917,11 @@ function MemberPortal(props) {
17855
17917
  onOpenMessages={openMessages}
17856
17918
  messagingEnabled={messagingEnabled()}
17857
17919
  />
17858
- </Match4>
17859
- <Match4 when={tab() === "history" && props.surveyHistory}>
17920
+ </Match5>
17921
+ <Match5 when={tab() === "history" && props.surveyHistory}>
17860
17922
  <SurveyHistory />
17861
- </Match4>
17862
- <Match4 when={tab() === "account"}>
17923
+ </Match5>
17924
+ <Match5 when={tab() === "account"}>
17863
17925
  <AccountPanel
17864
17926
  member={data.member()}
17865
17927
  legalLinks={props.legalLinks}
@@ -17867,11 +17929,11 @@ function MemberPortal(props) {
17867
17929
  onOpenMessages={openMessages}
17868
17930
  messagingEnabled={messagingEnabled()}
17869
17931
  />
17870
- </Match4>
17871
- <Match4 when={tab() === "messages"}>
17932
+ </Match5>
17933
+ <Match5 when={tab() === "messages"}>
17872
17934
  <MessagesPanel thread={messages} intent={intent()} />
17873
- </Match4>
17874
- </Switch4>
17935
+ </Match5>
17936
+ </Switch5>
17875
17937
  </Show56>
17876
17938
  </Show56>;
17877
17939
  return <main
@@ -17943,7 +18005,7 @@ function MemberPortal(props) {
17943
18005
  }
17944
18006
 
17945
18007
  // src/pages/AffiliatePortal.tsx
17946
- import { createEffect as createEffect12, createSignal as createSignal40, Match as Match5, Show as Show62, Switch as Switch5, For as For46 } from "solid-js";
18008
+ import { createEffect as createEffect12, createSignal as createSignal40, Match as Match6, Show as Show62, Switch as Switch6, For as For46 } from "solid-js";
17947
18009
 
17948
18010
  // src/pages/affiliate/Overview.tsx
17949
18011
  import { Show as Show57, For as For42 } from "solid-js";
@@ -18629,23 +18691,23 @@ function AffiliatePortal(props) {
18629
18691
  </aside>
18630
18692
 
18631
18693
  <div class="app-affiliate-content">
18632
- <Switch5 fallback={<AffiliateOverview />}>
18633
- <Match5 when={currentTab() === "overview"}>
18694
+ <Switch6 fallback={<AffiliateOverview />}>
18695
+ <Match6 when={currentTab() === "overview"}>
18634
18696
  <AffiliateOverview />
18635
- </Match5>
18636
- <Match5 when={currentTab() === "conversions"}>
18697
+ </Match6>
18698
+ <Match6 when={currentTab() === "conversions"}>
18637
18699
  <AffiliateConversions />
18638
- </Match5>
18639
- <Match5 when={currentTab() === "downline"}>
18700
+ </Match6>
18701
+ <Match6 when={currentTab() === "downline"}>
18640
18702
  <AffiliateDownline />
18641
- </Match5>
18642
- <Match5 when={currentTab() === "referral"}>
18703
+ </Match6>
18704
+ <Match6 when={currentTab() === "referral"}>
18643
18705
  <AffiliateReferralLink />
18644
- </Match5>
18645
- <Match5 when={currentTab() === "settings"}>
18706
+ </Match6>
18707
+ <Match6 when={currentTab() === "settings"}>
18646
18708
  <AffiliateSettings />
18647
- </Match5>
18648
- </Switch5>
18709
+ </Match6>
18710
+ </Switch6>
18649
18711
  </div>
18650
18712
  </div>
18651
18713
  </Show62>;
@@ -19839,4 +19901,4 @@ export {
19839
19901
  AffiliateForgotPassword,
19840
19902
  AffiliateResetPassword
19841
19903
  };
19842
- //# sourceMappingURL=5NWE3FVH.jsx.map
19904
+ //# sourceMappingURL=7ENL3GYZ.jsx.map