@apextelemed/partner-core 0.6.0 → 0.6.1

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.
@@ -14358,11 +14358,12 @@ function blankSequence() {
14358
14358
  }
14359
14359
  var label = { "font-size": "0.8125rem", color: "var(--app-admin-fg-muted)" };
14360
14360
  var field = { display: "grid", gap: "0.25rem" };
14361
- function Queue(props) {
14361
+ function SequenceQueue(props) {
14362
14362
  const nav = useAdminNav();
14363
14363
  const [reload, setReload] = createSignal28(0);
14364
14364
  const [busy, setBusy] = createSignal28(null);
14365
14365
  const [queue, { refetch }] = createResource20(reload, () => apiFetch("/admin/funnel/queue"));
14366
+ const rows = () => (queue()?.due ?? []).filter((r) => r.sequenceId === props.sequence.id);
14366
14367
  const act = async (row, action) => {
14367
14368
  setBusy(row.enrollmentId);
14368
14369
  try {
@@ -14380,11 +14381,12 @@ function Queue(props) {
14380
14381
  setBusy(null);
14381
14382
  }
14382
14383
  };
14383
- const sendAll = async (sequenceId, name, count) => {
14384
- if (!window.confirm(`Send ${count} due email${count === 1 ? "" : "s"} for \u201C${name}\u201D now?`)) return;
14385
- setBusy(sequenceId);
14384
+ const sendAll = async () => {
14385
+ const count = rows().length;
14386
+ if (!window.confirm(`Send ${count} due email${count === 1 ? "" : "s"} for \u201C${props.sequence.name}\u201D now?`)) return;
14387
+ setBusy("all");
14386
14388
  try {
14387
- const r = await apiFetch(`/admin/funnel/sequences/${sequenceId}/send-due`, { method: "POST" });
14389
+ const r = await apiFetch(`/admin/funnel/sequences/${props.sequence.id}/send-due`, { method: "POST" });
14388
14390
  toastSuccess(
14389
14391
  Object.entries(r.outcomes).map(([k, n]) => `${n} ${OUTCOME_LABEL[k] ?? k}`).join(", ") || "Nothing was due"
14390
14392
  );
@@ -14396,66 +14398,53 @@ function Queue(props) {
14396
14398
  setBusy(null);
14397
14399
  }
14398
14400
  };
14399
- const bySequence = () => {
14400
- const groups = /* @__PURE__ */ new Map();
14401
- for (const row of queue()?.due ?? []) {
14402
- const g = groups.get(row.sequenceId);
14403
- if (g) g.push(row);
14404
- else groups.set(row.sequenceId, [row]);
14405
- }
14406
- return [...groups.entries()];
14407
- };
14408
14401
  return <div class="app-admin-card" style={{ "margin-top": "1.25rem", overflow: "hidden" }}>
14409
- <div style={{ padding: "1rem 1.25rem", "border-bottom": "1px solid var(--app-admin-border-soft)" }}>
14410
- <h2 class="app-admin-heading" style={{ "font-size": "0.9375rem", "font-weight": "600", margin: 0 }}>Waiting to send</h2>
14411
- <p style={{ ...label, "font-size": "0.75rem", margin: "0.25rem 0 0" }}>
14412
- Due by each sequence's schedule. Nothing here has been emailed, and nothing will be until you send it or switch the sequence to automatic.
14413
- </p>
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}>
14412
+ <button type="button" class="app-admin-btn app-admin-btn-primary app-admin-btn-sm" disabled={busy() === "all"} onClick={() => void sendAll()}>
14413
+ Send all due
14414
+ </button>
14415
+ </Show43>
14414
14416
  </div>
14415
14417
  <Show43 when={queue()} fallback={<LoadingSpinner />}>
14416
- <Show43 when={(queue().due.length ?? 0) > 0} fallback={<EmptyState message="Nobody is due an email right now." />}>
14417
- <For31 each={bySequence()}>
14418
- {([sequenceId, rows]) => <>
14419
- <div style={{ display: "flex", "justify-content": "space-between", "align-items": "center", padding: "0.75rem 1.25rem", background: "var(--app-admin-card-soft-bg, transparent)" }}>
14420
- <strong style={{ "font-size": "0.875rem" }}>{rows[0].sequenceName} — {rows.length} due</strong>
14421
- <button type="button" class="app-admin-btn app-admin-btn-sm" disabled={busy() === sequenceId} onClick={() => void sendAll(sequenceId, rows[0].sequenceName, rows.length)}>
14422
- Send all due
14423
- </button>
14424
- </div>
14425
- <table class="app-admin-table">
14426
- <thead>
14427
- <tr><th>Person</th><th>Came from</th><th>Waiting</th><th>Email</th><th /></tr>
14428
- </thead>
14429
- <tbody>
14430
- <For31 each={rows}>
14431
- {(row) => <tr>
14432
- <td data-label="Person">
14433
- <Show43 when={row.userId && nav} fallback={row.email}>
14434
- <button type="button" class="app-admin-link-btn" style={{ "font-size": "inherit" }} onClick={() => nav.openCustomer(row.userId)}>{row.email}</button>
14435
- </Show43>
14436
- </td>
14437
- <td data-label="Came from">{segmentLongLabel(row.segmentAtAdd)}</td>
14438
- <td data-label="Waiting">{daysAgo(row.anchoredAt)}</td>
14439
- <td data-label="Email">
14440
- <div>{row.subject}</div>
14441
- <div class="app-admin-text-muted" style={{ "font-size": "0.75rem" }}>Step {row.stepIndex + 1} of {row.stepCount}</div>
14442
- </td>
14443
- <td>
14444
- <div style={{ display: "flex", gap: "0.375rem", "flex-wrap": "wrap" }}>
14445
- <button type="button" class="app-admin-btn app-admin-btn-primary app-admin-btn-sm" disabled={busy() === row.enrollmentId} onClick={() => void act(row, "send")}>
14446
- {busy() === row.enrollmentId ? "Sending\u2026" : "Send"}
14447
- </button>
14448
- <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.">
14449
- Skip
14450
- </button>
14451
- </div>
14452
- </td>
14453
- </tr>}
14454
- </For31>
14455
- </tbody>
14456
- </table>
14457
- </>}
14458
- </For31>
14418
+ <Show43 when={rows().length > 0} fallback={<EmptyState message="Nobody in this sequence is due right now." />}>
14419
+ <table class="app-admin-table">
14420
+ <thead>
14421
+ <tr><th>Person</th><th>Came from</th><th>Waiting</th><th>Step</th><th /></tr>
14422
+ </thead>
14423
+ <tbody>
14424
+ <For31 each={rows()}>
14425
+ {(row) => <tr>
14426
+ <td data-label="Person">
14427
+ <Show43 when={row.userId && nav} fallback={row.email}>
14428
+ <button type="button" class="app-admin-link-btn" style={{ "font-size": "inherit" }} onClick={() => nav.openCustomer(row.userId)}>{row.email}</button>
14429
+ </Show43>
14430
+ </td>
14431
+ <td data-label="Came from">{segmentLongLabel(row.segmentAtAdd)}</td>
14432
+ <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
+ <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
+ {busy() === row.enrollmentId ? "Sending\u2026" : "Send"}
14438
+ </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.">
14440
+ Skip
14441
+ </button>
14442
+ </div>
14443
+ </td>
14444
+ </tr>}
14445
+ </For31>
14446
+ </tbody>
14447
+ </table>
14459
14448
  </Show43>
14460
14449
  </Show43>
14461
14450
  </div>;
@@ -14632,6 +14621,12 @@ function SequenceEditor(props) {
14632
14621
  <button type="button" class="app-admin-btn app-admin-btn-ghost app-admin-btn-sm" onClick={() => props.onClose()}>Back to list</button>
14633
14622
  </div>
14634
14623
 
14624
+ <Show43 when={!isNew()}>
14625
+ <div style={{ padding: "0 1.25rem" }}>
14626
+ <SequenceQueue sequence={props.initial} onChanged={props.onChanged} />
14627
+ </div>
14628
+ </Show43>
14629
+
14635
14630
  <div style={{ padding: "1rem 1.25rem", display: "grid", gap: "1rem" }}>
14636
14631
  <div style={{ display: "grid", "grid-template-columns": "repeat(auto-fit, minmax(14rem, 1fr))", gap: "0.75rem" }}>
14637
14632
  <label style={field}>
@@ -14759,14 +14754,15 @@ function Sequences() {
14759
14754
  const [emailTemplates] = createResource20(() => adminApi.getEmailTemplates());
14760
14755
  const customTemplates = () => emailTemplates()?.customTemplates ?? [];
14761
14756
  const [editing, setEditing] = createSignal28(null);
14762
- const changed = () => void refetch();
14757
+ const [queue, { refetch: refetchQueue }] = createResource20(reload, () => apiFetch("/admin/funnel/queue").catch(() => ({ due: [] })));
14758
+ const dueFor = (id) => (queue()?.due ?? []).filter((d) => d.sequenceId === id).length;
14759
+ const changed = () => {
14760
+ void refetch();
14761
+ void refetchQueue();
14762
+ };
14763
14763
  return <div>
14764
14764
  <PageTitle subtitle="Timed emails for people who stopped short of a subscription">Sequences</PageTitle>
14765
14765
 
14766
- <Show43 when={list()} fallback={<LoadingSpinner />}>
14767
- <Queue sequences={list().sequences} onChanged={changed} />
14768
- </Show43>
14769
-
14770
14766
  <Show43
14771
14767
  when={editing()}
14772
14768
  fallback={<div class="app-admin-card" style={{ "margin-top": "1.25rem", overflow: "hidden" }}>
@@ -14778,7 +14774,7 @@ function Sequences() {
14778
14774
  <Show43 when={list().sequences.length > 0} fallback={<EmptyState message="No sequences yet. Create one, then add people from the Funnel tab." />}>
14779
14775
  <table class="app-admin-table">
14780
14776
  <thead>
14781
- <tr><th>Name</th><th>Steps</th><th>Fed by</th><th>Sending</th><th>In it</th><th>Sent</th><th>Bought</th><th>Unsubscribed</th></tr>
14777
+ <tr><th>Name</th><th>Steps</th><th>Fed by</th><th>Sending</th><th>In it</th><th>Due now</th><th>Sent</th><th>Bought</th><th>Unsubscribed</th></tr>
14782
14778
  </thead>
14783
14779
  <tbody>
14784
14780
  <For31 each={list().sequences}>
@@ -14791,6 +14787,7 @@ function Sequences() {
14791
14787
  <td data-label="Fed by">{s.feedSegments.length > 0 ? `${s.feedSegments.length} segment${s.feedSegments.length === 1 ? "" : "s"}, \u2264${s.feedMaxAgeDays}d` : <span class="app-admin-text-muted">by hand</span>}</td>
14792
14788
  <td data-label="Sending">{s.autoSend ? "Automatic" : "Review"}</td>
14793
14789
  <td data-label="In it">{s.stats.active}</td>
14790
+ <td data-label="Due now">{dueFor(s.id) > 0 ? <strong>{dueFor(s.id)}</strong> : <span class="app-admin-text-muted">0</span>}</td>
14794
14791
  <td data-label="Sent">{s.stats.sent}</td>
14795
14792
  <td data-label="Bought">{s.stats.boughtAfterEnroll}</td>
14796
14793
  <td data-label="Unsubscribed">{s.stats.unsubscribed}</td>
@@ -19842,4 +19839,4 @@ export {
19842
19839
  AffiliateForgotPassword,
19843
19840
  AffiliateResetPassword
19844
19841
  };
19845
- //# sourceMappingURL=SSVJ27MR.jsx.map
19842
+ //# sourceMappingURL=5NWE3FVH.jsx.map