@apextelemed/partner-core 0.3.0 → 0.4.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.
Files changed (38) hide show
  1. package/README.md +47 -0
  2. package/dist/api/index.d.ts +1 -1
  3. package/dist/api/index.js +1 -1
  4. package/dist/api/index.jsx +1 -1
  5. package/dist/chunk/{UNAI6NBV.js → 2XJBOTK5.js} +50 -7
  6. package/dist/chunk/2XJBOTK5.js.map +1 -0
  7. package/dist/chunk/{FBVNUFJM.js → EIXZJX6R.js} +5 -5
  8. package/dist/chunk/{FBVNUFJM.js.map → EIXZJX6R.js.map} +1 -1
  9. package/dist/chunk/{AAWNUGML.jsx → HM27UGZM.jsx} +2740 -1485
  10. package/dist/chunk/{QSSVQ5PR.js → ID67FV6R.js} +4285 -1814
  11. package/dist/chunk/ID67FV6R.js.map +1 -0
  12. package/dist/chunk/{DUVW24DM.jsx → MEF3FUQB.jsx} +49 -6
  13. package/dist/chunk/{B63K5R7M.jsx → NYLIUR7O.jsx} +705 -42
  14. package/dist/chunk/{SE6JHCPZ.js → OJSQZEB3.js} +694 -44
  15. package/dist/chunk/OJSQZEB3.js.map +1 -0
  16. package/dist/chunk/{KMHMT6YP.jsx → STEVQZ6U.jsx} +19 -15
  17. package/dist/chunk/{6HLXYY4F.jsx → T6IKS76T.jsx} +4 -4
  18. package/dist/chunk/{FWUBNK42.js → YHWX4NMV.js} +19 -15
  19. package/dist/chunk/YHWX4NMV.js.map +1 -0
  20. package/dist/{client-CWYoMmla.d.ts → client-DUrhrzOG.d.ts} +318 -9
  21. package/dist/flows/index.d.ts +99 -2
  22. package/dist/flows/index.js +4 -4
  23. package/dist/flows/index.jsx +24 -4
  24. package/dist/index/index.d.ts +2 -2
  25. package/dist/index/index.js +5 -5
  26. package/dist/index/index.jsx +25 -5
  27. package/dist/pages/index.d.ts +35 -2
  28. package/dist/pages/index.js +4 -4
  29. package/dist/pages/index.jsx +4 -4
  30. package/dist/stores/index.d.ts +1 -1
  31. package/dist/stores/index.js +2 -2
  32. package/dist/stores/index.jsx +2 -2
  33. package/dist/theme/admin.css +434 -0
  34. package/package.json +1 -1
  35. package/dist/chunk/FWUBNK42.js.map +0 -1
  36. package/dist/chunk/QSSVQ5PR.js.map +0 -1
  37. package/dist/chunk/SE6JHCPZ.js.map +0 -1
  38. package/dist/chunk/UNAI6NBV.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { fetchFunnelConfig, postFunnelEvent, readResumeToken, fetchResumedDraft, stripResumeToken, adoptFunnelSessionId, saveFunnelDraft } from './DS4E7FAI.js';
2
- import { cart_default, medication_default, auth_default, affiliateAuth_default } from './FWUBNK42.js';
3
- import { newIdempotencyKey, apexApi, usersApi, addressesApi, paymentsApi, subscriptionsApi, membersApi, affiliatePortalApi, ApiError, ordersApi, supportApi, messagesApi, authApi } from './UNAI6NBV.js';
2
+ import { cart_default, medication_default, auth_default, affiliateAuth_default } from './YHWX4NMV.js';
3
+ import { newIdempotencyKey, apexApi, usersApi, addressesApi, paymentsApi, subscriptionsApi, membersApi, affiliatePortalApi, ApiError, ordersApi, supportApi, messagesApi, authApi } from './2XJBOTK5.js';
4
4
  import { getConfig } from './5XGPFYIJ.js';
5
5
  import { createSignal, onMount, createEffect, onCleanup, createResource } from 'solid-js';
6
6
  import { useSurveyV2Flow as useSurveyV2Flow$1 } from '@apextelemed/survey-solid';
@@ -41,8 +41,8 @@ function flattenSurveyToSteps(data) {
41
41
  const sortedSections = [...data.sections || []].sort((a, b) => a.order - b.order);
42
42
  sortedSections.forEach((section, sectionIndex) => {
43
43
  const sortedSteps = [...section.steps || []].sort((a, b) => a.order - b.order);
44
- sortedSteps.forEach((step, stepIndex) => {
45
- const sortedQuestions = [...step.questions || []].sort((a, b) => a.order - b.order);
44
+ sortedSteps.forEach((step2, stepIndex) => {
45
+ const sortedQuestions = [...step2.questions || []].sort((a, b) => a.order - b.order);
46
46
  const questions = sortedQuestions.map((q) => ({
47
47
  id: q.questionId,
48
48
  type: q.type,
@@ -61,8 +61,8 @@ function flattenSurveyToSteps(data) {
61
61
  sectionIndex,
62
62
  stepIndex,
63
63
  sectionTitle: section.title,
64
- stepTitle: step.title,
65
- stepDescription: step.description,
64
+ stepTitle: step2.title,
65
+ stepDescription: step2.description,
66
66
  questions
67
67
  });
68
68
  }
@@ -117,9 +117,9 @@ function useSurveyFlow(options = {}) {
117
117
  const [hydrated, setHydrated] = createSignal(false);
118
118
  const totalSteps = () => steps().length;
119
119
  const isLastStep = () => currentStep() >= totalSteps() - 1;
120
- const step = () => steps()[currentStep()] ?? null;
120
+ const step2 = () => steps()[currentStep()] ?? null;
121
121
  const visibleQuestions = () => {
122
- const s = step();
122
+ const s = step2();
123
123
  if (!s) return [];
124
124
  return s.questions.filter((q) => isQuestionVisible(q, answers()));
125
125
  };
@@ -458,7 +458,7 @@ function useSurveyFlow(options = {}) {
458
458
  surveyTitle,
459
459
  totalSteps,
460
460
  currentStep,
461
- step,
461
+ step: step2,
462
462
  visibleQuestions,
463
463
  answers,
464
464
  setAnswer,
@@ -575,10 +575,10 @@ var ZIP_RE = /^\d{5}(-\d{4})?$/;
575
575
  var EMPTY = { street: "", street2: "", city: "", state: "", zip: "" };
576
576
  var VERIFY_TIMEOUT_MS = 3500;
577
577
  var UNCHECKED_RESULT = { status: "unchecked", corrected: false, messages: [] };
578
- function withTimeout(p, ms, fallback) {
578
+ function withTimeout(p, ms2, fallback) {
579
579
  let timer;
580
580
  const timeout = new Promise((resolve) => {
581
- timer = setTimeout(() => resolve(fallback), ms);
581
+ timer = setTimeout(() => resolve(fallback), ms2);
582
582
  });
583
583
  return Promise.race([p, timeout]).finally(() => clearTimeout(timer));
584
584
  }
@@ -882,8 +882,8 @@ function useCheckoutFlow(options = {}) {
882
882
  const baseMedicationCents = (() => {
883
883
  const cents = rx?.priceCents;
884
884
  if (typeof cents === "number") return cents;
885
- const dollars = rx?.price;
886
- return typeof dollars === "number" ? Math.round(dollars * 100) : 0;
885
+ const dollars2 = rx?.price;
886
+ return typeof dollars2 === "number" ? Math.round(dollars2 * 100) : 0;
887
887
  })();
888
888
  const promoDiscountCents = (() => {
889
889
  const locked = rx?.discountCents;
@@ -1361,7 +1361,7 @@ function useSignupFlow(options) {
1361
1361
  const accept = useCardTokenizer();
1362
1362
  let restored = {};
1363
1363
  if (typeof window !== "undefined") restored = loadDraft();
1364
- const [step, setStep] = createSignal(Math.min(restored.step ?? 0, MAX_RESTORABLE_STEP));
1364
+ const [step2, setStep] = createSignal(Math.min(restored.step ?? 0, MAX_RESTORABLE_STEP));
1365
1365
  const [error, setError] = createSignal(null);
1366
1366
  const [tokenizing, setTokenizing] = createSignal(false);
1367
1367
  const [submitting, setSubmitting] = createSignal(false);
@@ -1385,7 +1385,7 @@ function useSignupFlow(options) {
1385
1385
  onMount(() => {
1386
1386
  createEffect(() => {
1387
1387
  saveDraft({
1388
- step: step(),
1388
+ step: step2(),
1389
1389
  firstName: firstName(),
1390
1390
  lastName: lastName(),
1391
1391
  dateOfBirth: dateOfBirth(),
@@ -1437,7 +1437,7 @@ function useSignupFlow(options) {
1437
1437
  }
1438
1438
  }
1439
1439
  async function advance() {
1440
- const startStep = step();
1440
+ const startStep = step2();
1441
1441
  const err = validateStep(startStep);
1442
1442
  if (err) {
1443
1443
  setError(err);
@@ -1476,7 +1476,7 @@ function useSignupFlow(options) {
1476
1476
  }
1477
1477
  function back() {
1478
1478
  setError(null);
1479
- if (step() === 3) setTokenizedData(null);
1479
+ if (step2() === 3) setTokenizedData(null);
1480
1480
  setStep((s) => Math.max(0, s - 1));
1481
1481
  }
1482
1482
  function finishIfAuthenticated() {
@@ -1564,8 +1564,8 @@ function useSignupFlow(options) {
1564
1564
  return finishIfAuthenticated();
1565
1565
  }
1566
1566
  return {
1567
- step,
1568
- isConfirmStep: () => step() === 3,
1567
+ step: step2,
1568
+ isConfirmStep: () => step2() === 3,
1569
1569
  next,
1570
1570
  back,
1571
1571
  error,
@@ -1641,7 +1641,7 @@ function clearDraft2() {
1641
1641
  function useRegisterFlow() {
1642
1642
  let restored = {};
1643
1643
  if (typeof window !== "undefined") restored = loadDraft2();
1644
- const [step, setStep] = createSignal(Math.min(restored.step ?? 0, MAX_RESTORABLE_STEP2));
1644
+ const [step2, setStep] = createSignal(Math.min(restored.step ?? 0, MAX_RESTORABLE_STEP2));
1645
1645
  const [error, setError] = createSignal(null);
1646
1646
  const [submitting, setSubmitting] = createSignal(false);
1647
1647
  const [outcome, setOutcome] = createSignal({ kind: "in_progress" });
@@ -1662,7 +1662,7 @@ function useRegisterFlow() {
1662
1662
  }
1663
1663
  createEffect(() => {
1664
1664
  saveDraft2({
1665
- step: step(),
1665
+ step: step2(),
1666
1666
  firstName: firstName(),
1667
1667
  lastName: lastName(),
1668
1668
  dateOfBirth: dateOfBirth(),
@@ -1710,7 +1710,7 @@ function useRegisterFlow() {
1710
1710
  }
1711
1711
  }
1712
1712
  async function advance() {
1713
- const startStep = step();
1713
+ const startStep = step2();
1714
1714
  if (startStep >= 2) return;
1715
1715
  const err = validateStep(startStep);
1716
1716
  if (err) {
@@ -1799,8 +1799,8 @@ function useRegisterFlow() {
1799
1799
  return finishIfAuthenticated();
1800
1800
  }
1801
1801
  return {
1802
- step,
1803
- isConfirmStep: () => step() === 2,
1802
+ step: step2,
1803
+ isConfirmStep: () => step2() === 2,
1804
1804
  next,
1805
1805
  back,
1806
1806
  error,
@@ -2181,6 +2181,21 @@ function buildTrackingUrl(delivery) {
2181
2181
  return builder ? builder(delivery.trackingNumber) : null;
2182
2182
  }
2183
2183
 
2184
+ // src/utils/calendarDate.ts
2185
+ var DATE_ONLY = /^(\d{4})-(\d{2})-(\d{2})$/;
2186
+ function parseCalendarDate(value) {
2187
+ if (!value) return null;
2188
+ const m = DATE_ONLY.exec(value.trim());
2189
+ const d = m ? new Date(Number(m[1]), Number(m[2]) - 1, Number(m[3])) : new Date(value);
2190
+ return Number.isNaN(d.getTime()) ? null : d;
2191
+ }
2192
+ function formatCalendarDate(value, options = { year: "numeric", month: "long", day: "numeric" }) {
2193
+ if (!value) return "";
2194
+ const d = parseCalendarDate(value);
2195
+ if (!d) return value;
2196
+ return d.toLocaleDateString("en-US", options);
2197
+ }
2198
+
2184
2199
  // src/flows/tracker.ts
2185
2200
  var PIPELINE = [
2186
2201
  { key: "submitted", label: "Submitted", heroWord: "Received", subCaption: "We\u2019ve received your request." },
@@ -2266,8 +2281,8 @@ function buildTrackerView(rx) {
2266
2281
  return { stages: stages2, activeIndex: 2, shipment: null, branch: "denied" };
2267
2282
  }
2268
2283
  const activeIndex = resolveActiveIndex(rx);
2269
- const stages = PIPELINE.map((step, i) => {
2270
- const base = { key: step.key, label: step.label };
2284
+ const stages = PIPELINE.map((step2, i) => {
2285
+ const base = { key: step2.key, label: step2.label };
2271
2286
  if (i < activeIndex) {
2272
2287
  return {
2273
2288
  ...base,
@@ -2278,8 +2293,8 @@ function buildTrackerView(rx) {
2278
2293
  if (i === activeIndex) {
2279
2294
  return {
2280
2295
  ...base,
2281
- heroWord: step.heroWord,
2282
- subCaption: step.subCaption,
2296
+ heroWord: step2.heroWord,
2297
+ subCaption: step2.subCaption,
2283
2298
  state: "active",
2284
2299
  timestamp: i === PIPE.submitted ? rx.createdAt : rx.updatedAt
2285
2300
  };
@@ -2299,12 +2314,7 @@ function softRelative(date, now) {
2299
2314
  const weeks = Math.round(diffDays / 7);
2300
2315
  return `in ${weeks} weeks`;
2301
2316
  }
2302
- function parseBackendDate(value) {
2303
- if (!value) return null;
2304
- const dateOnly = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value);
2305
- const d = dateOnly ? new Date(Number(dateOnly[1]), Number(dateOnly[2]) - 1, Number(dateOnly[3])) : new Date(value);
2306
- return Number.isNaN(d.getTime()) ? null : d;
2307
- }
2317
+ var parseBackendDate = parseCalendarDate;
2308
2318
  function buildRefillView(sub, now = Date.now()) {
2309
2319
  if (!sub) return null;
2310
2320
  if (sub.status === "cancelled" || sub.status === "expired" || sub.status === "suspended") {
@@ -2349,6 +2359,646 @@ function formatEventDate(date) {
2349
2359
  if (!date) return "\u2014";
2350
2360
  return date.toLocaleDateString("en-US", { month: "short", day: "numeric" });
2351
2361
  }
2362
+
2363
+ // src/flows/customer360.ts
2364
+ var LIFECYCLE_LABEL = {
2365
+ active: "Active",
2366
+ past_due: "Past due",
2367
+ paused: "Paused",
2368
+ incomplete: "Incomplete signup",
2369
+ cancelled: "Cancelled",
2370
+ card_declined: "Card declined",
2371
+ awaiting_prescriber: "Awaiting prescriber",
2372
+ never_subscribed: "Never subscribed"
2373
+ };
2374
+ var LIFECYCLE_TONE = {
2375
+ active: "success",
2376
+ past_due: "warning",
2377
+ paused: "neutral",
2378
+ incomplete: "warning",
2379
+ cancelled: "neutral",
2380
+ card_declined: "danger",
2381
+ awaiting_prescriber: "info",
2382
+ never_subscribed: "neutral"
2383
+ };
2384
+ var LIFECYCLE_BUCKETS = [
2385
+ "never_subscribed",
2386
+ "card_declined",
2387
+ "awaiting_prescriber",
2388
+ "incomplete",
2389
+ "active",
2390
+ "past_due",
2391
+ "paused",
2392
+ "cancelled"
2393
+ ];
2394
+ var ACCOUNT_SOURCE_LABEL = {
2395
+ savings: "Savings program registration",
2396
+ register_and_subscribe: "Signed up and subscribed in one step",
2397
+ register: "Created an account first",
2398
+ unknown: "Unknown"
2399
+ };
2400
+ var DAY_MS2 = 864e5;
2401
+ var LIVE = /* @__PURE__ */ new Set(["active", "paused", "past_due"]);
2402
+ function ms(iso) {
2403
+ if (!iso) return null;
2404
+ const t = Date.parse(iso);
2405
+ return Number.isNaN(t) ? null : t;
2406
+ }
2407
+ function fmtDay(iso) {
2408
+ const t = ms(iso);
2409
+ if (t === null) return "an unknown date";
2410
+ return new Date(t).toLocaleDateString("en-US", {
2411
+ month: "short",
2412
+ day: "numeric",
2413
+ year: "numeric",
2414
+ timeZone: "UTC"
2415
+ });
2416
+ }
2417
+ function sentence(text) {
2418
+ const t = text.trim();
2419
+ return /[.!?]$/.test(t) ? t : `${t}.`;
2420
+ }
2421
+ function dollars(cents) {
2422
+ if (cents == null) return "$0.00";
2423
+ return `$${(cents / 100).toFixed(2)}`;
2424
+ }
2425
+ function newestFirst(items, at2) {
2426
+ return [...items].sort((a, b) => (ms(at2(b)) ?? 0) - (ms(at2(a)) ?? 0));
2427
+ }
2428
+ function latestSubscription(subs) {
2429
+ return newestFirst(subs, (s) => s.createdAt)[0] ?? null;
2430
+ }
2431
+ function primarySubscription(subs) {
2432
+ const live = newestFirst(
2433
+ subs.filter((s) => LIVE.has(s.status)),
2434
+ (s) => s.createdAt
2435
+ );
2436
+ return live[0] ?? latestSubscription(subs);
2437
+ }
2438
+ function latestRequest(reqs) {
2439
+ return newestFirst(reqs, (r) => r.createdAt)[0] ?? null;
2440
+ }
2441
+ function latestFailedPayment(payments) {
2442
+ return newestFirst(
2443
+ payments.filter((p) => p.status === "failed"),
2444
+ (p) => p.createdAt
2445
+ )[0] ?? null;
2446
+ }
2447
+ function hasTracking(r) {
2448
+ return !!(r.tracking?.trackingNumber || r.delivery?.trackingNumber);
2449
+ }
2450
+ function accountSource(o) {
2451
+ if (o.customer.savingsMemberId) return "savings";
2452
+ const created = ms(o.customer.createdAt);
2453
+ if (created === null) return "unknown";
2454
+ const oldest = [...o.subscriptions].sort(
2455
+ (a, b) => (ms(a.createdAt) ?? 0) - (ms(b.createdAt) ?? 0)
2456
+ )[0];
2457
+ if (oldest) {
2458
+ const subAt = ms(oldest.createdAt);
2459
+ if (subAt !== null && Math.abs(subAt - created) < 2 * 6e4) return "register_and_subscribe";
2460
+ }
2461
+ return "register";
2462
+ }
2463
+ function lifecycleReason(o) {
2464
+ const { bucket } = o.lifecycle;
2465
+ const facts = o.lifecycle.facts;
2466
+ const sub = primarySubscription(o.subscriptions);
2467
+ const source = accountSource(o);
2468
+ const joined = fmtDay(o.customer.createdAt);
2469
+ const captures = newestFirst(o.funnel.captures, (c) => c.capturedAt);
2470
+ const capture = captures[0] ?? null;
2471
+ switch (bucket) {
2472
+ case "never_subscribed": {
2473
+ const opener = source === "savings" ? `Joined through the savings program on ${joined}.` : `Created an account on ${joined}.`;
2474
+ if (capture) {
2475
+ if (!capture.qualified) {
2476
+ return `${opener} Completed the intake survey on ${fmtDay(capture.capturedAt)} but did not qualify.`;
2477
+ }
2478
+ return `${opener} Completed the intake survey on ${fmtDay(capture.capturedAt)} but never checked out.`;
2479
+ }
2480
+ if (facts?.hasFunnelCapture) {
2481
+ return `${opener} Completed the intake survey but never checked out.`;
2482
+ }
2483
+ if (facts?.hasOpenCart) {
2484
+ return `${opener} Never completed the intake survey; has an abandoned cart.`;
2485
+ }
2486
+ return `${opener} Never completed the intake survey.`;
2487
+ }
2488
+ case "card_declined": {
2489
+ const failed = latestFailedPayment(o.payments);
2490
+ const when = failed ? fmtDay(failed.createdAt) : fmtDay(facts?.lastPaymentAt);
2491
+ const why = failed?.failureReason ? `: ${failed.failureReason}` : "";
2492
+ return `Card declined at checkout on ${when}${why}. No subscription was created.`;
2493
+ }
2494
+ case "awaiting_prescriber": {
2495
+ const req = latestRequest(o.requests.items);
2496
+ const when = req ? fmtDay(req.createdAt) : fmtDay(facts?.latestRequestApexStatus ? null : null);
2497
+ return req ? `Prescription request submitted ${when}; awaiting prescriber review.` : "A prescription request is awaiting prescriber review.";
2498
+ }
2499
+ case "incomplete":
2500
+ return "Checkout payment outcome is unknown; the subscription is on hold until the charge is verified.";
2501
+ case "active": {
2502
+ if (!sub) return "Active subscription.";
2503
+ const next = sub.nextChargeAt ? ` Next charge ${fmtDay(sub.nextChargeAt)}.` : "";
2504
+ return `Subscribed ${fmtDay(sub.createdAt)}.${next}`;
2505
+ }
2506
+ case "past_due": {
2507
+ const s = o.subscriptions.find((x) => x.status === "past_due") ?? sub;
2508
+ const attempt = s ? newestFirst(s.billingAttempts ?? [], (a) => a.createdAt).find((a) => a.status === "failed") : null;
2509
+ const n = s?.retryCount ? ` (retry ${s.retryCount})` : "";
2510
+ const why = attempt?.errorMessage ? `: ${sentence(attempt.errorMessage)}` : ".";
2511
+ const retry = s?.nextChargeAt ? ` Next retry ${fmtDay(s.nextChargeAt)}.` : "";
2512
+ return `Renewal charge failed${n}${why}${retry}`;
2513
+ }
2514
+ case "paused": {
2515
+ const s = o.subscriptions.find((x) => x.status === "paused") ?? sub;
2516
+ return s?.pausedAt ? `Paused on ${fmtDay(s.pausedAt)}.` : "Subscription paused.";
2517
+ }
2518
+ case "cancelled": {
2519
+ const s = newestFirst(
2520
+ o.subscriptions.filter((x) => x.status === "cancelled"),
2521
+ (x) => x.cancelledAt
2522
+ )[0] ?? sub;
2523
+ if (!s) return "Subscription cancelled.";
2524
+ const started = ms(s.createdAt);
2525
+ const ended = ms(s.cancelledAt);
2526
+ const months = started !== null && ended !== null ? Math.max(0, Math.round((ended - started) / (30 * DAY_MS2))) : null;
2527
+ const tenure = months !== null && months > 0 ? ` after ${months} month${months === 1 ? "" : "s"}` : "";
2528
+ return `Cancelled on ${fmtDay(s.cancelledAt)}${tenure}.`;
2529
+ }
2530
+ default:
2531
+ return o.lifecycle.label || "";
2532
+ }
2533
+ }
2534
+ var SEVERITY_RANK = { danger: 0, warning: 1, info: 2 };
2535
+ var STALE_REVIEW_DAYS = 3;
2536
+ function deriveAttention(o, now = /* @__PURE__ */ new Date()) {
2537
+ const items = [];
2538
+ const nowMs = now.getTime();
2539
+ const liveSubs = o.subscriptions.filter((s) => LIVE.has(s.status));
2540
+ for (const p of o.payments) {
2541
+ if (p.status === "refund_pending") {
2542
+ items.push({
2543
+ id: `refund-pending-${p.id}`,
2544
+ severity: "danger",
2545
+ title: `Refund of ${dollars(p.amountCents)} did not complete at the gateway`,
2546
+ detail: p.failureReason ?? "Finish the refund manually in the gateway, then resolve here.",
2547
+ action: { kind: "open_payment", label: "View payment", paymentId: p.id }
2548
+ });
2549
+ }
2550
+ }
2551
+ for (const s of o.subscriptions) {
2552
+ for (const a of s.billingAttempts ?? []) {
2553
+ if (a.status === "indeterminate") {
2554
+ items.push({
2555
+ id: `attempt-indeterminate-${a.id}`,
2556
+ severity: "danger",
2557
+ title: "A charge outcome is unknown; billing is blocked until it is resolved",
2558
+ detail: `${dollars(a.amountCents)} for period ${(a.billingPeriod ?? 0) + 1}${a.errorMessage ? ` \u2014 ${a.errorMessage}` : ""}`,
2559
+ action: { kind: "resolve_attempt", label: "Resolve", subscriptionId: s.id, attemptId: a.id }
2560
+ });
2561
+ }
2562
+ }
2563
+ if (s.status === "past_due") {
2564
+ const failed = newestFirst(s.billingAttempts ?? [], (a) => a.createdAt).find((a) => a.status === "failed");
2565
+ items.push({
2566
+ id: `past-due-${s.id}`,
2567
+ severity: "warning",
2568
+ title: `Renewal charge failed${s.retryCount ? ` (retry ${s.retryCount})` : ""}`,
2569
+ detail: [
2570
+ failed?.errorMessage ? sentence(failed.errorMessage) : failed?.errorCode ? `Code ${failed.errorCode}.` : null,
2571
+ s.nextChargeAt ? `Next retry ${fmtDay(s.nextChargeAt)}.` : "No retry scheduled."
2572
+ ].filter(Boolean).join(" "),
2573
+ action: { kind: "edit_schedule", label: "Edit schedule", subscriptionId: s.id }
2574
+ });
2575
+ }
2576
+ if (s.status === "incomplete") {
2577
+ items.push({
2578
+ id: `incomplete-${s.id}`,
2579
+ severity: "warning",
2580
+ title: "Checkout payment is unverified",
2581
+ detail: "The gateway did not confirm the first charge. The subscription is held and will not bill until resolved.",
2582
+ action: { kind: "open_subscription", label: "View subscription", subscriptionId: s.id }
2583
+ });
2584
+ }
2585
+ }
2586
+ if (liveSubs.length === 0) {
2587
+ const declined = latestFailedPayment(o.payments.filter((p) => p.detached));
2588
+ if (declined) {
2589
+ items.push({
2590
+ id: `declined-${declined.id}`,
2591
+ severity: "warning",
2592
+ title: `Card declined at checkout on ${fmtDay(declined.createdAt)}`,
2593
+ detail: declined.failureReason ?? void 0,
2594
+ action: { kind: "open_payment", label: "View payment", paymentId: declined.id }
2595
+ });
2596
+ }
2597
+ }
2598
+ if (o.subscriptions.length === 0 && o.payments.every((p) => p.status !== "failed")) {
2599
+ const captured = o.funnel.captures.length > 0 || o.lifecycle.facts?.hasFunnelCapture;
2600
+ if (o.customer.savingsMemberId && !captured) {
2601
+ items.push({
2602
+ id: "savings-no-intake",
2603
+ severity: "info",
2604
+ title: "Registered through the savings program but never started the intake survey",
2605
+ detail: o.tenant.requirePaidSubscription ? "This site requires a paid subscription before a prescription request can be created." : void 0
2606
+ });
2607
+ } else if (captured) {
2608
+ const c = newestFirst(o.funnel.captures, (x) => x.capturedAt)[0];
2609
+ items.push({
2610
+ id: "intake-no-checkout",
2611
+ severity: "info",
2612
+ title: c ? `Completed the intake survey on ${fmtDay(c.capturedAt)} but never checked out` : "Completed the intake survey but never checked out",
2613
+ detail: c && !c.qualified ? "Did not qualify." : void 0
2614
+ });
2615
+ }
2616
+ }
2617
+ for (const r of o.requests.items) {
2618
+ if (r.status === "call_requested") {
2619
+ items.push({
2620
+ id: `consult-${r.requestId}`,
2621
+ severity: "info",
2622
+ title: `Prescriber requested a consultation${r.drugName ? ` for ${r.drugName}` : ""}`,
2623
+ action: { kind: "open_request", label: "View request", requestId: r.requestId }
2624
+ });
2625
+ }
2626
+ if (r.status === "pending") {
2627
+ const created = ms(r.createdAt);
2628
+ const days = created !== null ? Math.floor((nowMs - created) / DAY_MS2) : null;
2629
+ if (days !== null && days >= STALE_REVIEW_DAYS) {
2630
+ items.push({
2631
+ id: `stale-review-${r.requestId}`,
2632
+ severity: "info",
2633
+ title: `Awaiting prescriber review for ${days} days${r.drugName ? ` (${r.drugName})` : ""}`,
2634
+ action: { kind: "open_request", label: "View request", requestId: r.requestId }
2635
+ });
2636
+ }
2637
+ }
2638
+ if (r.renewal?.needsReviewAt) {
2639
+ items.push({
2640
+ id: `renewal-review-${r.renewal.id}`,
2641
+ severity: "warning",
2642
+ title: "Renewal needs review",
2643
+ detail: r.renewal.reviewReason ?? void 0,
2644
+ action: { kind: "open_request", label: "View request", requestId: r.requestId }
2645
+ });
2646
+ }
2647
+ }
2648
+ const pending = o.requests.items.filter((r) => r.status === "pending");
2649
+ if (liveSubs.length === 0 && o.subscriptions.some((s) => s.status === "cancelled") && pending.length > 0) {
2650
+ items.push({
2651
+ id: "cancelled-with-pending",
2652
+ severity: "warning",
2653
+ title: `${pending.length} unapproved prescription request${pending.length === 1 ? " is" : "s are"} still in the prescriber queue after cancellation`,
2654
+ detail: "A cancelled customer should not be prescribed. Cancel the pending requests.",
2655
+ action: { kind: "cancel_unapproved", label: "Cancel unapproved requests" }
2656
+ });
2657
+ }
2658
+ for (const t of o.support.threads) {
2659
+ if (t.adminUnread && t.status !== "closed") {
2660
+ items.push({
2661
+ id: `support-${t.id}`,
2662
+ severity: "info",
2663
+ title: `Support message awaiting reply${t.subject ? `: ${t.subject}` : ""}`,
2664
+ detail: t.lastMessageAt ? `Last message ${fmtDay(t.lastMessageAt)}` : void 0,
2665
+ action: { kind: "open_thread", label: "Open thread", threadId: t.id }
2666
+ });
2667
+ }
2668
+ }
2669
+ return items.sort((a, b) => SEVERITY_RANK[a.severity] - SEVERITY_RANK[b.severity]);
2670
+ }
2671
+ var JOURNEY_LABEL = {
2672
+ account: "Account",
2673
+ intake: "Intake",
2674
+ checkout: "Checkout",
2675
+ prescriber: "Prescriber",
2676
+ pharmacy: "Pharmacy",
2677
+ shipped: "Shipped",
2678
+ renewing: "Renewing"
2679
+ };
2680
+ function step(key, state, date = null, detail = null) {
2681
+ return { key, label: JOURNEY_LABEL[key], state, date, detail };
2682
+ }
2683
+ function deriveJourney(o) {
2684
+ const steps = [];
2685
+ const source = accountSource(o);
2686
+ const subs = o.subscriptions;
2687
+ const liveSub = primarySubscription(subs.filter((s) => LIVE.has(s.status)));
2688
+ const anySub = subs.length > 0;
2689
+ const req = latestRequest(o.requests.items);
2690
+ const capture = newestFirst(o.funnel.captures, (c) => c.capturedAt)[0] ?? null;
2691
+ const session = newestFirst(o.funnel.sessions, (s) => s.lastSeenAt)[0] ?? null;
2692
+ const declined = latestFailedPayment(o.payments);
2693
+ const paid = newestFirst(
2694
+ o.payments.filter((p) => p.status === "succeeded" || p.status === "refunded"),
2695
+ (p) => p.createdAt
2696
+ )[0];
2697
+ steps.push(step("account", "done", o.customer.createdAt, ACCOUNT_SOURCE_LABEL[source]));
2698
+ const intakeDone = !!capture || o.lifecycle.facts?.hasFunnelCapture || anySub || o.requests.items.length > 0;
2699
+ if (intakeDone) {
2700
+ steps.push(
2701
+ step(
2702
+ "intake",
2703
+ "done",
2704
+ capture?.capturedAt ?? null,
2705
+ capture ? capture.qualified ? "Completed and qualified" : "Completed, did not qualify" : "Completed"
2706
+ )
2707
+ );
2708
+ } else if (session) {
2709
+ steps.push(
2710
+ step(
2711
+ "intake",
2712
+ "active",
2713
+ session.lastSeenAt,
2714
+ session.lastStep != null && session.stepCount ? `Stopped at step ${session.lastStep} of ${session.stepCount}` : "Started, not completed"
2715
+ )
2716
+ );
2717
+ } else {
2718
+ steps.push(
2719
+ step(
2720
+ "intake",
2721
+ "active",
2722
+ null,
2723
+ o.funnel.telemetryEnabled ? "Not started" : "Not completed (step data not collected on this site)"
2724
+ )
2725
+ );
2726
+ }
2727
+ if (anySub || paid) {
2728
+ const first = [...subs].sort((a, b) => (ms(a.createdAt) ?? 0) - (ms(b.createdAt) ?? 0))[0];
2729
+ steps.push(step("checkout", "done", first?.createdAt ?? paid?.createdAt ?? null, first ? `${dollars(first.amountCents)} subscription` : "One-time purchase"));
2730
+ } else if (subs.some((s) => s.status === "incomplete")) {
2731
+ steps.push(step("checkout", "blocked", null, "Payment outcome unverified"));
2732
+ } else if (declined) {
2733
+ steps.push(step("checkout", "blocked", declined.createdAt, declined.failureReason ? `Declined: ${declined.failureReason}` : "Card declined"));
2734
+ } else if (intakeDone) {
2735
+ steps.push(step("checkout", "active", null, "Not started"));
2736
+ } else {
2737
+ steps.push(step("checkout", "upcoming"));
2738
+ }
2739
+ const checkoutDone = anySub || !!paid;
2740
+ if (req) {
2741
+ switch (req.status) {
2742
+ case "pending":
2743
+ steps.push(step("prescriber", "active", req.createdAt, "Awaiting review"));
2744
+ break;
2745
+ case "call_requested":
2746
+ steps.push(step("prescriber", "blocked", req.updatedAt ?? req.createdAt, "Consultation requested"));
2747
+ break;
2748
+ case "denied":
2749
+ steps.push(step("prescriber", "blocked", req.updatedAt ?? req.createdAt, "Not approved"));
2750
+ break;
2751
+ default:
2752
+ steps.push(step("prescriber", "done", req.updatedAt ?? req.createdAt, "Approved"));
2753
+ }
2754
+ } else if (liveSub) {
2755
+ steps.push(step("prescriber", "blocked", null, "No prescription request on file"));
2756
+ } else if (checkoutDone) {
2757
+ steps.push(step("prescriber", "upcoming", null, "No prescription request"));
2758
+ } else {
2759
+ steps.push(step("prescriber", "upcoming"));
2760
+ }
2761
+ const approvedStatuses = /* @__PURE__ */ new Set(["approved", "pharmacy", "processing", "completed", "shipped"]);
2762
+ if (req && (req.status === "pharmacy" || req.status === "processing" || req.status === "completed" || req.status === "shipped" || hasTracking(req))) {
2763
+ steps.push(step("pharmacy", "done", req.updatedAt ?? null, req.pharmacySent ? "Sent to pharmacy" : "At the pharmacy"));
2764
+ } else if (req && req.status === "approved") {
2765
+ steps.push(
2766
+ step(
2767
+ "pharmacy",
2768
+ "active",
2769
+ null,
2770
+ o.tenant.fulfillmentMode === "deferred" && !req.paymentConfirmed ? "Approved; waiting on payment confirmation" : "Approved; waiting for pharmacy hand-off"
2771
+ )
2772
+ );
2773
+ } else if (req && approvedStatuses.has(req.status)) {
2774
+ steps.push(step("pharmacy", "active"));
2775
+ } else {
2776
+ steps.push(step("pharmacy", "upcoming"));
2777
+ }
2778
+ if (req && hasTracking(req)) {
2779
+ const carrier = req.tracking?.shipCarrier ?? req.delivery?.shipCarrier ?? null;
2780
+ const number = req.tracking?.trackingNumber ?? req.delivery?.trackingNumber ?? null;
2781
+ const delivered = (req.tracking?.deliveryStatus ?? req.delivery?.status ?? "").toLowerCase() === "delivered";
2782
+ steps.push(
2783
+ step(
2784
+ "shipped",
2785
+ "done",
2786
+ req.tracking?.shippedAt ?? null,
2787
+ delivered ? "Delivered" : [carrier, number].filter(Boolean).join(" ") || "Shipped"
2788
+ )
2789
+ );
2790
+ } else if (req && (req.status === "pharmacy" || req.status === "processing" || req.status === "completed")) {
2791
+ steps.push(step("shipped", "active", null, "Awaiting shipment"));
2792
+ } else {
2793
+ steps.push(step("shipped", "upcoming"));
2794
+ }
2795
+ if (liveSub) {
2796
+ if (liveSub.status === "past_due") {
2797
+ steps.push(step("renewing", "blocked", liveSub.nextChargeAt, `Renewal charge failed${liveSub.retryCount ? `, retry ${liveSub.retryCount}` : ""}`));
2798
+ } else if (liveSub.status === "paused") {
2799
+ steps.push(step("renewing", "blocked", liveSub.pausedAt, "Paused"));
2800
+ } else {
2801
+ const checkIn = req?.renewal?.status ?? null;
2802
+ steps.push(
2803
+ step(
2804
+ "renewing",
2805
+ "done",
2806
+ liveSub.nextChargeAt,
2807
+ liveSub.nextChargeAt ? `Next charge ${fmtDay(liveSub.nextChargeAt)}${checkIn ? ` \xB7 check-in ${checkIn.replace(/_/g, " ")}` : ""}` : "No next charge scheduled"
2808
+ )
2809
+ );
2810
+ }
2811
+ } else if (subs.some((s) => s.status === "cancelled")) {
2812
+ const c = newestFirst(subs.filter((s) => s.status === "cancelled"), (s) => s.cancelledAt)[0];
2813
+ steps.push(step("renewing", "blocked", c?.cancelledAt ?? null, "Cancelled"));
2814
+ } else {
2815
+ steps.push(step("renewing", "upcoming"));
2816
+ }
2817
+ let seenActive = false;
2818
+ for (const s of steps) {
2819
+ if (s.state === "active" || s.state === "blocked") {
2820
+ if (seenActive && s.state === "active") s.state = "upcoming";
2821
+ seenActive = true;
2822
+ }
2823
+ }
2824
+ return steps;
2825
+ }
2826
+ var TRACKER_STATUS = {
2827
+ pending: "pending",
2828
+ approved: "approved",
2829
+ denied: "denied",
2830
+ call_requested: "call_requested",
2831
+ pharmacy: "pharmacy",
2832
+ processing: "pharmacy",
2833
+ completed: "pharmacy",
2834
+ shipped: "shipped"
2835
+ };
2836
+ function toTrackerRequest(r) {
2837
+ const delivery = r.delivery ?? (r.tracking?.trackingNumber ? {
2838
+ status: r.tracking.deliveryStatus,
2839
+ trackingNumber: r.tracking.trackingNumber,
2840
+ shipCarrier: r.tracking.shipCarrier ?? "",
2841
+ trackingUrl: null
2842
+ } : null);
2843
+ const status = delivery?.trackingNumber ? "shipped" : TRACKER_STATUS[r.status] ?? "pending";
2844
+ return {
2845
+ status,
2846
+ createdAt: r.createdAt,
2847
+ updatedAt: r.updatedAt,
2848
+ dosage: r.dosage ?? void 0,
2849
+ delivery
2850
+ };
2851
+ }
2852
+ var at = (iso) => iso ?? "";
2853
+ function attemptTone(a) {
2854
+ if (a.status === "failed") return "danger";
2855
+ if (a.status === "indeterminate") return "warning";
2856
+ if (a.status === "succeeded") return "success";
2857
+ return "neutral";
2858
+ }
2859
+ function buildTimeline(o, limit = 200) {
2860
+ const ev = [];
2861
+ ev.push({
2862
+ id: "account",
2863
+ at: o.customer.createdAt,
2864
+ kind: "account",
2865
+ title: "Account created",
2866
+ detail: ACCOUNT_SOURCE_LABEL[accountSource(o)],
2867
+ tone: "neutral"
2868
+ });
2869
+ for (const c of o.funnel.captures) {
2870
+ ev.push({
2871
+ id: `capture-${c.responseId}`,
2872
+ at: at(c.capturedAt),
2873
+ kind: "intake",
2874
+ title: c.qualified ? "Completed intake survey (qualified)" : "Completed intake survey (did not qualify)",
2875
+ detail: c.remindersSent ? `${c.remindersSent} recovery reminder${c.remindersSent === 1 ? "" : "s"} sent` : null,
2876
+ tone: c.qualified ? "success" : "neutral"
2877
+ });
2878
+ }
2879
+ for (const s of o.funnel.sessions) {
2880
+ ev.push({
2881
+ id: `session-${s.sessionId}`,
2882
+ at: at(s.startedAt),
2883
+ kind: "intake",
2884
+ title: "Started intake survey",
2885
+ detail: s.lastStep != null && s.stepCount ? `Reached step ${s.lastStep} of ${s.stepCount}` : null,
2886
+ tone: "neutral"
2887
+ });
2888
+ }
2889
+ for (const c of o.funnel.carts) {
2890
+ ev.push({
2891
+ id: `cart-${c.cartId}`,
2892
+ at: at(c.updatedAt),
2893
+ kind: "cart",
2894
+ title: c.convertedAt ? "Cart checked out" : "Cart left open",
2895
+ detail: `${c.itemCount} item${c.itemCount === 1 ? "" : "s"} \xB7 ${dollars(c.subtotalCents)}`,
2896
+ tone: "neutral"
2897
+ });
2898
+ }
2899
+ for (const s of o.subscriptions) {
2900
+ ev.push({
2901
+ id: `sub-created-${s.id}`,
2902
+ at: at(s.createdAt),
2903
+ kind: "subscription",
2904
+ title: `Subscribed${s.medication ? ` to ${s.medication}` : ""}`,
2905
+ detail: `${dollars(s.amountCents)} every ${s.intervalDays} days`,
2906
+ tone: "success"
2907
+ });
2908
+ if (s.pausedAt && s.status === "paused") {
2909
+ ev.push({ id: `sub-paused-${s.id}`, at: s.pausedAt, kind: "subscription", title: "Subscription paused", tone: "neutral" });
2910
+ }
2911
+ if (s.cancelledAt) {
2912
+ ev.push({ id: `sub-cancelled-${s.id}`, at: s.cancelledAt, kind: "subscription", title: "Subscription cancelled", tone: "danger" });
2913
+ }
2914
+ for (const a of s.billingAttempts ?? []) {
2915
+ if (a.status === "succeeded") continue;
2916
+ ev.push({
2917
+ id: `attempt-${a.id}`,
2918
+ at: at(a.createdAt),
2919
+ kind: "attempt",
2920
+ title: a.status === "failed" ? `Renewal charge failed (${dollars(a.amountCents)})` : a.status === "indeterminate" ? `Renewal charge outcome unknown (${dollars(a.amountCents)})` : `Renewal charge pending (${dollars(a.amountCents)})`,
2921
+ detail: a.errorMessage ?? a.errorCode ?? null,
2922
+ tone: attemptTone(a)
2923
+ });
2924
+ }
2925
+ }
2926
+ for (const p of o.payments) {
2927
+ const detached = p.detached ? " at checkout (no subscription created)" : "";
2928
+ const title = p.status === "succeeded" ? `Paid ${dollars(p.amountCents)}` : p.status === "failed" ? `Payment of ${dollars(p.amountCents)} declined${detached}` : p.status === "refunded" ? `Refunded ${dollars(p.refundedAmountCents || p.amountCents)}` : p.status === "refund_pending" ? `Refund of ${dollars(p.amountCents)} pending` : p.status === "voided" ? `Payment of ${dollars(p.amountCents)} voided` : `Payment ${p.status} (${dollars(p.amountCents)})`;
2929
+ ev.push({
2930
+ id: `payment-${p.id}`,
2931
+ at: at(p.createdAt),
2932
+ kind: "payment",
2933
+ title,
2934
+ detail: p.failureReason ?? (p.type ? p.type.replace(/_/g, " ") : null),
2935
+ tone: p.status === "succeeded" ? "success" : p.status === "failed" || p.status === "refund_pending" ? "danger" : p.status === "refunded" || p.status === "voided" ? "warning" : "neutral"
2936
+ });
2937
+ if (p.refundedAt && p.refundedAmountCents > 0 && p.status === "succeeded") {
2938
+ ev.push({
2939
+ id: `payment-partial-${p.id}`,
2940
+ at: at(p.refundedAt),
2941
+ kind: "payment",
2942
+ title: `Partially refunded ${dollars(p.refundedAmountCents)} of ${dollars(p.amountCents)}`,
2943
+ tone: "warning"
2944
+ });
2945
+ }
2946
+ }
2947
+ for (const r of o.requests.items) {
2948
+ if (r.createdAt) {
2949
+ ev.push({
2950
+ id: `request-${r.requestId}`,
2951
+ at: r.createdAt,
2952
+ kind: "request",
2953
+ title: `Prescription request submitted${r.drugName ? ` for ${r.drugName}` : ""}`,
2954
+ detail: r.dosage ?? null,
2955
+ tone: "neutral"
2956
+ });
2957
+ }
2958
+ if (r.updatedAt && r.updatedAt !== r.createdAt && r.status !== "pending") {
2959
+ ev.push({
2960
+ id: `request-status-${r.requestId}`,
2961
+ at: r.updatedAt,
2962
+ kind: "request",
2963
+ title: `Request ${r.status.replace(/_/g, " ")}${r.drugName ? ` (${r.drugName})` : ""}`,
2964
+ tone: r.status === "denied" ? "danger" : r.status === "call_requested" ? "warning" : "success"
2965
+ });
2966
+ }
2967
+ if (r.tracking?.shippedAt) {
2968
+ ev.push({
2969
+ id: `shipped-${r.requestId}`,
2970
+ at: r.tracking.shippedAt,
2971
+ kind: "shipment",
2972
+ title: `Shipped${r.drugName ? ` ${r.drugName}` : ""}`,
2973
+ detail: [r.tracking.shipCarrier, r.tracking.trackingNumber].filter(Boolean).join(" ") || null,
2974
+ tone: "success"
2975
+ });
2976
+ }
2977
+ if (r.renewal?.triggerAt) {
2978
+ ev.push({
2979
+ id: `renewal-${r.renewal.id}`,
2980
+ at: r.renewal.triggerAt,
2981
+ kind: "renewal",
2982
+ title: `Refill check-in ${r.renewal.status.replace(/_/g, " ")}`,
2983
+ detail: r.renewal.pharmacyFillDate ? `Fill date ${r.renewal.pharmacyFillDate}` : null,
2984
+ tone: r.renewal.status === "request_failed" ? "danger" : "neutral"
2985
+ });
2986
+ }
2987
+ }
2988
+ for (const t of o.support.threads) {
2989
+ if (t.lastMessageAt) {
2990
+ ev.push({
2991
+ id: `support-${t.id}`,
2992
+ at: t.lastMessageAt,
2993
+ kind: "support",
2994
+ title: t.adminUnread ? "Support message awaiting reply" : `Support thread ${t.status}`,
2995
+ detail: t.subject,
2996
+ tone: t.adminUnread ? "info" : "neutral"
2997
+ });
2998
+ }
2999
+ }
3000
+ return ev.filter((e) => ms(e.at) !== null).sort((a, b) => (ms(b.at) ?? 0) - (ms(a.at) ?? 0)).slice(0, limit);
3001
+ }
2352
3002
  async function fetchPendingSurveys2() {
2353
3003
  try {
2354
3004
  const res = await membersApi.getPendingSurveys();
@@ -2395,7 +3045,7 @@ function useMemberPortalData() {
2395
3045
  const [pendingSurveys] = createResource(fetchPendingSurveys2);
2396
3046
  const member = () => me.error ? null : me()?.member ?? null;
2397
3047
  const subscriptions = () => me.error ? [] : me()?.subscriptions ?? [];
2398
- const primarySubscription = () => pickPrimarySub(subscriptions());
3048
+ const primarySubscription2 = () => pickPrimarySub(subscriptions());
2399
3049
  const hasBilling = () => subscriptions().length > 0;
2400
3050
  const rxRequests = () => rxRes.error ? [] : rxRes() ?? [];
2401
3051
  const primaryRx = () => {
@@ -2409,7 +3059,7 @@ function useMemberPortalData() {
2409
3059
  const firstName = () => readFirstName(member());
2410
3060
  const loading = () => me.loading || rxRes.loading;
2411
3061
  const error = () => rxRes.error || me.error ? "We couldn\u2019t load your portal. Please try again." : null;
2412
- const toTrackerRequest = (rx) => ({
3062
+ const toTrackerRequest2 = (rx) => ({
2413
3063
  status: rx.status,
2414
3064
  createdAt: rx.createdAt,
2415
3065
  updatedAt: rx.updatedAt,
@@ -2417,7 +3067,7 @@ function useMemberPortalData() {
2417
3067
  delivery: rx.delivery
2418
3068
  });
2419
3069
  const trackerSubscription = () => {
2420
- const s = primarySubscription();
3070
+ const s = primarySubscription2();
2421
3071
  if (!s) return null;
2422
3072
  return {
2423
3073
  status: s.status,
@@ -2433,7 +3083,7 @@ function useMemberPortalData() {
2433
3083
  return {
2434
3084
  member,
2435
3085
  subscriptions,
2436
- primarySubscription,
3086
+ primarySubscription: primarySubscription2,
2437
3087
  hasBilling,
2438
3088
  rxRequests,
2439
3089
  primaryRx,
@@ -2446,7 +3096,7 @@ function useMemberPortalData() {
2446
3096
  void refetchMe();
2447
3097
  void refetchRx();
2448
3098
  },
2449
- toTrackerRequest,
3099
+ toTrackerRequest: toTrackerRequest2,
2450
3100
  trackerSubscription
2451
3101
  };
2452
3102
  }
@@ -3126,9 +3776,9 @@ function createFunnelDraftStore(opts) {
3126
3776
  draftId = saved;
3127
3777
  if (isNew) postFunnelEvent("draft:saved", { draftId: saved });
3128
3778
  }
3129
- function scheduleFlush(ms) {
3779
+ function scheduleFlush(ms2) {
3130
3780
  if (timer) clearTimeout(timer);
3131
- timer = setTimeout(() => void flush(), ms);
3781
+ timer = setTimeout(() => void flush(), ms2);
3132
3782
  }
3133
3783
  if (typeof window !== "undefined" && typeof window.addEventListener === "function") {
3134
3784
  window.addEventListener("pagehide", () => void flush());
@@ -3239,6 +3889,6 @@ async function uploadPrescriptionPhoto(file) {
3239
3889
  return { photoId: parsed.photoId };
3240
3890
  }
3241
3891
 
3242
- export { LIVE_SUBSCRIPTION_STATUSES, TERMINAL_SUBSCRIPTION_STATUSES, US_STATES, US_STATE_OPTIONS, availableStateOptions, availableStates, buildRefillView, buildTrackerView, buildTrackingUrl, captureFunnelEmail, createFunnelTelemetry, emailGateAnswered, firstAddressError, formatCardNumber, formatConversationTime, formatCvv, formatEventDate, formatExpiry, formatMessageTime, formatRelativeTime, formatStageDate, hasErrors, hasStateRestrictions, isImageAttachment, isLive, isQuestionVisible, isReconcilable, markEmailGateAnswered, normalizeState, redeemResumeLink, resetResumeRedemption, resolveSurveyV2DrugIntent, stateAvailabilityNote, uploadPrescriptionPhoto, useAddressPair, useAffiliateConversions, useAffiliateDownline, useAffiliateLinks, useAffiliateStats, useCardTokenizer, useCartCheckoutFlow, useCheckoutFlow, useDashboardData, useMemberPortalData, useMessagesThread, useRegisterFlow, useSignupFlow, useSubscribeFlow, useSurveyFlow, useSurveyV2Flow, useUpdatePaymentMethodFlow, validateAddress };
3243
- //# sourceMappingURL=SE6JHCPZ.js.map
3244
- //# sourceMappingURL=SE6JHCPZ.js.map
3892
+ export { ACCOUNT_SOURCE_LABEL, LIFECYCLE_BUCKETS, LIFECYCLE_LABEL, LIFECYCLE_TONE, LIVE_SUBSCRIPTION_STATUSES, TERMINAL_SUBSCRIPTION_STATUSES, US_STATES, US_STATE_OPTIONS, accountSource, availableStateOptions, availableStates, buildRefillView, buildTimeline, buildTrackerView, buildTrackingUrl, captureFunnelEmail, createFunnelTelemetry, deriveAttention, deriveJourney, emailGateAnswered, firstAddressError, fmtDay, formatCalendarDate, formatCardNumber, formatConversationTime, formatCvv, formatEventDate, formatExpiry, formatMessageTime, formatRelativeTime, formatStageDate, hasErrors, hasStateRestrictions, isImageAttachment, isLive, isQuestionVisible, isReconcilable, lifecycleReason, markEmailGateAnswered, normalizeState, primarySubscription, redeemResumeLink, resetResumeRedemption, resolveSurveyV2DrugIntent, stateAvailabilityNote, toTrackerRequest, uploadPrescriptionPhoto, useAddressPair, useAffiliateConversions, useAffiliateDownline, useAffiliateLinks, useAffiliateStats, useCardTokenizer, useCartCheckoutFlow, useCheckoutFlow, useDashboardData, useMemberPortalData, useMessagesThread, useRegisterFlow, useSignupFlow, useSubscribeFlow, useSurveyFlow, useSurveyV2Flow, useUpdatePaymentMethodFlow, validateAddress };
3893
+ //# sourceMappingURL=OJSQZEB3.js.map
3894
+ //# sourceMappingURL=OJSQZEB3.js.map