@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
@@ -12,7 +12,7 @@ import {
12
12
  auth_default,
13
13
  cart_default,
14
14
  medication_default
15
- } from "./KMHMT6YP.jsx";
15
+ } from "./STEVQZ6U.jsx";
16
16
  import {
17
17
  ApiError,
18
18
  addressesApi,
@@ -27,7 +27,7 @@ import {
27
27
  subscriptionsApi,
28
28
  supportApi,
29
29
  usersApi
30
- } from "./DUVW24DM.jsx";
30
+ } from "./MEF3FUQB.jsx";
31
31
  import {
32
32
  getConfig
33
33
  } from "./LDZIUFDM.jsx";
@@ -69,8 +69,8 @@ function flattenSurveyToSteps(data) {
69
69
  const sortedSections = [...data.sections || []].sort((a, b) => a.order - b.order);
70
70
  sortedSections.forEach((section, sectionIndex) => {
71
71
  const sortedSteps = [...section.steps || []].sort((a, b) => a.order - b.order);
72
- sortedSteps.forEach((step, stepIndex) => {
73
- const sortedQuestions = [...step.questions || []].sort((a, b) => a.order - b.order);
72
+ sortedSteps.forEach((step2, stepIndex) => {
73
+ const sortedQuestions = [...step2.questions || []].sort((a, b) => a.order - b.order);
74
74
  const questions = sortedQuestions.map((q) => ({
75
75
  id: q.questionId,
76
76
  type: q.type,
@@ -89,8 +89,8 @@ function flattenSurveyToSteps(data) {
89
89
  sectionIndex,
90
90
  stepIndex,
91
91
  sectionTitle: section.title,
92
- stepTitle: step.title,
93
- stepDescription: step.description,
92
+ stepTitle: step2.title,
93
+ stepDescription: step2.description,
94
94
  questions
95
95
  });
96
96
  }
@@ -145,9 +145,9 @@ function useSurveyFlow(options = {}) {
145
145
  const [hydrated, setHydrated] = createSignal(false);
146
146
  const totalSteps = () => steps().length;
147
147
  const isLastStep = () => currentStep() >= totalSteps() - 1;
148
- const step = () => steps()[currentStep()] ?? null;
148
+ const step2 = () => steps()[currentStep()] ?? null;
149
149
  const visibleQuestions = () => {
150
- const s = step();
150
+ const s = step2();
151
151
  if (!s) return [];
152
152
  return s.questions.filter((q) => isQuestionVisible(q, answers()));
153
153
  };
@@ -486,7 +486,7 @@ function useSurveyFlow(options = {}) {
486
486
  surveyTitle,
487
487
  totalSteps,
488
488
  currentStep,
489
- step,
489
+ step: step2,
490
490
  visibleQuestions,
491
491
  answers,
492
492
  setAnswer,
@@ -606,10 +606,10 @@ var ZIP_RE = /^\d{5}(-\d{4})?$/;
606
606
  var EMPTY = { street: "", street2: "", city: "", state: "", zip: "" };
607
607
  var VERIFY_TIMEOUT_MS = 3500;
608
608
  var UNCHECKED_RESULT = { status: "unchecked", corrected: false, messages: [] };
609
- function withTimeout(p, ms, fallback) {
609
+ function withTimeout(p, ms2, fallback) {
610
610
  let timer;
611
611
  const timeout = new Promise((resolve) => {
612
- timer = setTimeout(() => resolve(fallback), ms);
612
+ timer = setTimeout(() => resolve(fallback), ms2);
613
613
  });
614
614
  return Promise.race([p, timeout]).finally(() => clearTimeout(timer));
615
615
  }
@@ -919,8 +919,8 @@ function useCheckoutFlow(options = {}) {
919
919
  const baseMedicationCents = (() => {
920
920
  const cents = rx?.priceCents;
921
921
  if (typeof cents === "number") return cents;
922
- const dollars = rx?.price;
923
- return typeof dollars === "number" ? Math.round(dollars * 100) : 0;
922
+ const dollars2 = rx?.price;
923
+ return typeof dollars2 === "number" ? Math.round(dollars2 * 100) : 0;
924
924
  })();
925
925
  const promoDiscountCents = (() => {
926
926
  const locked = rx?.discountCents;
@@ -1404,7 +1404,7 @@ function useSignupFlow(options) {
1404
1404
  const accept = useCardTokenizer();
1405
1405
  let restored = {};
1406
1406
  if (typeof window !== "undefined") restored = loadDraft();
1407
- const [step, setStep] = createSignal6(Math.min(restored.step ?? 0, MAX_RESTORABLE_STEP));
1407
+ const [step2, setStep] = createSignal6(Math.min(restored.step ?? 0, MAX_RESTORABLE_STEP));
1408
1408
  const [error, setError] = createSignal6(null);
1409
1409
  const [tokenizing, setTokenizing] = createSignal6(false);
1410
1410
  const [submitting, setSubmitting] = createSignal6(false);
@@ -1428,7 +1428,7 @@ function useSignupFlow(options) {
1428
1428
  onMount5(() => {
1429
1429
  createEffect4(() => {
1430
1430
  saveDraft({
1431
- step: step(),
1431
+ step: step2(),
1432
1432
  firstName: firstName(),
1433
1433
  lastName: lastName(),
1434
1434
  dateOfBirth: dateOfBirth(),
@@ -1480,7 +1480,7 @@ function useSignupFlow(options) {
1480
1480
  }
1481
1481
  }
1482
1482
  async function advance() {
1483
- const startStep = step();
1483
+ const startStep = step2();
1484
1484
  const err = validateStep(startStep);
1485
1485
  if (err) {
1486
1486
  setError(err);
@@ -1519,7 +1519,7 @@ function useSignupFlow(options) {
1519
1519
  }
1520
1520
  function back() {
1521
1521
  setError(null);
1522
- if (step() === 3) setTokenizedData(null);
1522
+ if (step2() === 3) setTokenizedData(null);
1523
1523
  setStep((s) => Math.max(0, s - 1));
1524
1524
  }
1525
1525
  function finishIfAuthenticated() {
@@ -1607,8 +1607,8 @@ function useSignupFlow(options) {
1607
1607
  return finishIfAuthenticated();
1608
1608
  }
1609
1609
  return {
1610
- step,
1611
- isConfirmStep: () => step() === 3,
1610
+ step: step2,
1611
+ isConfirmStep: () => step2() === 3,
1612
1612
  next,
1613
1613
  back,
1614
1614
  error,
@@ -1687,7 +1687,7 @@ function clearDraft2() {
1687
1687
  function useRegisterFlow() {
1688
1688
  let restored = {};
1689
1689
  if (typeof window !== "undefined") restored = loadDraft2();
1690
- const [step, setStep] = createSignal7(Math.min(restored.step ?? 0, MAX_RESTORABLE_STEP2));
1690
+ const [step2, setStep] = createSignal7(Math.min(restored.step ?? 0, MAX_RESTORABLE_STEP2));
1691
1691
  const [error, setError] = createSignal7(null);
1692
1692
  const [submitting, setSubmitting] = createSignal7(false);
1693
1693
  const [outcome, setOutcome] = createSignal7({ kind: "in_progress" });
@@ -1708,7 +1708,7 @@ function useRegisterFlow() {
1708
1708
  }
1709
1709
  createEffect5(() => {
1710
1710
  saveDraft2({
1711
- step: step(),
1711
+ step: step2(),
1712
1712
  firstName: firstName(),
1713
1713
  lastName: lastName(),
1714
1714
  dateOfBirth: dateOfBirth(),
@@ -1756,7 +1756,7 @@ function useRegisterFlow() {
1756
1756
  }
1757
1757
  }
1758
1758
  async function advance() {
1759
- const startStep = step();
1759
+ const startStep = step2();
1760
1760
  if (startStep >= 2) return;
1761
1761
  const err = validateStep(startStep);
1762
1762
  if (err) {
@@ -1845,8 +1845,8 @@ function useRegisterFlow() {
1845
1845
  return finishIfAuthenticated();
1846
1846
  }
1847
1847
  return {
1848
- step,
1849
- isConfirmStep: () => step() === 2,
1848
+ step: step2,
1849
+ isConfirmStep: () => step2() === 2,
1850
1850
  next,
1851
1851
  back,
1852
1852
  error,
@@ -2233,6 +2233,21 @@ function buildTrackingUrl(delivery) {
2233
2233
  return builder ? builder(delivery.trackingNumber) : null;
2234
2234
  }
2235
2235
 
2236
+ // src/utils/calendarDate.ts
2237
+ var DATE_ONLY = /^(\d{4})-(\d{2})-(\d{2})$/;
2238
+ function parseCalendarDate(value) {
2239
+ if (!value) return null;
2240
+ const m = DATE_ONLY.exec(value.trim());
2241
+ const d = m ? new Date(Number(m[1]), Number(m[2]) - 1, Number(m[3])) : new Date(value);
2242
+ return Number.isNaN(d.getTime()) ? null : d;
2243
+ }
2244
+ function formatCalendarDate(value, options = { year: "numeric", month: "long", day: "numeric" }) {
2245
+ if (!value) return "";
2246
+ const d = parseCalendarDate(value);
2247
+ if (!d) return value;
2248
+ return d.toLocaleDateString("en-US", options);
2249
+ }
2250
+
2236
2251
  // src/flows/tracker.ts
2237
2252
  var PIPELINE = [
2238
2253
  { key: "submitted", label: "Submitted", heroWord: "Received", subCaption: "We\u2019ve received your request." },
@@ -2318,8 +2333,8 @@ function buildTrackerView(rx) {
2318
2333
  return { stages: stages2, activeIndex: 2, shipment: null, branch: "denied" };
2319
2334
  }
2320
2335
  const activeIndex = resolveActiveIndex(rx);
2321
- const stages = PIPELINE.map((step, i) => {
2322
- const base = { key: step.key, label: step.label };
2336
+ const stages = PIPELINE.map((step2, i) => {
2337
+ const base = { key: step2.key, label: step2.label };
2323
2338
  if (i < activeIndex) {
2324
2339
  return {
2325
2340
  ...base,
@@ -2330,8 +2345,8 @@ function buildTrackerView(rx) {
2330
2345
  if (i === activeIndex) {
2331
2346
  return {
2332
2347
  ...base,
2333
- heroWord: step.heroWord,
2334
- subCaption: step.subCaption,
2348
+ heroWord: step2.heroWord,
2349
+ subCaption: step2.subCaption,
2335
2350
  state: "active",
2336
2351
  timestamp: i === PIPE.submitted ? rx.createdAt : rx.updatedAt
2337
2352
  };
@@ -2351,12 +2366,7 @@ function softRelative(date, now) {
2351
2366
  const weeks = Math.round(diffDays / 7);
2352
2367
  return `in ${weeks} weeks`;
2353
2368
  }
2354
- function parseBackendDate(value) {
2355
- if (!value) return null;
2356
- const dateOnly = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value);
2357
- const d = dateOnly ? new Date(Number(dateOnly[1]), Number(dateOnly[2]) - 1, Number(dateOnly[3])) : new Date(value);
2358
- return Number.isNaN(d.getTime()) ? null : d;
2359
- }
2369
+ var parseBackendDate = parseCalendarDate;
2360
2370
  function buildRefillView(sub, now = Date.now()) {
2361
2371
  if (!sub) return null;
2362
2372
  if (sub.status === "cancelled" || sub.status === "expired" || sub.status === "suspended") {
@@ -2402,6 +2412,646 @@ function formatEventDate(date) {
2402
2412
  return date.toLocaleDateString("en-US", { month: "short", day: "numeric" });
2403
2413
  }
2404
2414
 
2415
+ // src/flows/customer360.ts
2416
+ var LIFECYCLE_LABEL = {
2417
+ active: "Active",
2418
+ past_due: "Past due",
2419
+ paused: "Paused",
2420
+ incomplete: "Incomplete signup",
2421
+ cancelled: "Cancelled",
2422
+ card_declined: "Card declined",
2423
+ awaiting_prescriber: "Awaiting prescriber",
2424
+ never_subscribed: "Never subscribed"
2425
+ };
2426
+ var LIFECYCLE_TONE = {
2427
+ active: "success",
2428
+ past_due: "warning",
2429
+ paused: "neutral",
2430
+ incomplete: "warning",
2431
+ cancelled: "neutral",
2432
+ card_declined: "danger",
2433
+ awaiting_prescriber: "info",
2434
+ never_subscribed: "neutral"
2435
+ };
2436
+ var LIFECYCLE_BUCKETS = [
2437
+ "never_subscribed",
2438
+ "card_declined",
2439
+ "awaiting_prescriber",
2440
+ "incomplete",
2441
+ "active",
2442
+ "past_due",
2443
+ "paused",
2444
+ "cancelled"
2445
+ ];
2446
+ var ACCOUNT_SOURCE_LABEL = {
2447
+ savings: "Savings program registration",
2448
+ register_and_subscribe: "Signed up and subscribed in one step",
2449
+ register: "Created an account first",
2450
+ unknown: "Unknown"
2451
+ };
2452
+ var DAY_MS2 = 864e5;
2453
+ var LIVE = /* @__PURE__ */ new Set(["active", "paused", "past_due"]);
2454
+ function ms(iso) {
2455
+ if (!iso) return null;
2456
+ const t = Date.parse(iso);
2457
+ return Number.isNaN(t) ? null : t;
2458
+ }
2459
+ function fmtDay(iso) {
2460
+ const t = ms(iso);
2461
+ if (t === null) return "an unknown date";
2462
+ return new Date(t).toLocaleDateString("en-US", {
2463
+ month: "short",
2464
+ day: "numeric",
2465
+ year: "numeric",
2466
+ timeZone: "UTC"
2467
+ });
2468
+ }
2469
+ function sentence(text) {
2470
+ const t = text.trim();
2471
+ return /[.!?]$/.test(t) ? t : `${t}.`;
2472
+ }
2473
+ function dollars(cents) {
2474
+ if (cents == null) return "$0.00";
2475
+ return `$${(cents / 100).toFixed(2)}`;
2476
+ }
2477
+ function newestFirst(items, at2) {
2478
+ return [...items].sort((a, b) => (ms(at2(b)) ?? 0) - (ms(at2(a)) ?? 0));
2479
+ }
2480
+ function latestSubscription(subs) {
2481
+ return newestFirst(subs, (s) => s.createdAt)[0] ?? null;
2482
+ }
2483
+ function primarySubscription(subs) {
2484
+ const live = newestFirst(
2485
+ subs.filter((s) => LIVE.has(s.status)),
2486
+ (s) => s.createdAt
2487
+ );
2488
+ return live[0] ?? latestSubscription(subs);
2489
+ }
2490
+ function latestRequest(reqs) {
2491
+ return newestFirst(reqs, (r) => r.createdAt)[0] ?? null;
2492
+ }
2493
+ function latestFailedPayment(payments) {
2494
+ return newestFirst(
2495
+ payments.filter((p) => p.status === "failed"),
2496
+ (p) => p.createdAt
2497
+ )[0] ?? null;
2498
+ }
2499
+ function hasTracking(r) {
2500
+ return !!(r.tracking?.trackingNumber || r.delivery?.trackingNumber);
2501
+ }
2502
+ function accountSource(o) {
2503
+ if (o.customer.savingsMemberId) return "savings";
2504
+ const created = ms(o.customer.createdAt);
2505
+ if (created === null) return "unknown";
2506
+ const oldest = [...o.subscriptions].sort(
2507
+ (a, b) => (ms(a.createdAt) ?? 0) - (ms(b.createdAt) ?? 0)
2508
+ )[0];
2509
+ if (oldest) {
2510
+ const subAt = ms(oldest.createdAt);
2511
+ if (subAt !== null && Math.abs(subAt - created) < 2 * 6e4) return "register_and_subscribe";
2512
+ }
2513
+ return "register";
2514
+ }
2515
+ function lifecycleReason(o) {
2516
+ const { bucket } = o.lifecycle;
2517
+ const facts = o.lifecycle.facts;
2518
+ const sub = primarySubscription(o.subscriptions);
2519
+ const source = accountSource(o);
2520
+ const joined = fmtDay(o.customer.createdAt);
2521
+ const captures = newestFirst(o.funnel.captures, (c) => c.capturedAt);
2522
+ const capture = captures[0] ?? null;
2523
+ switch (bucket) {
2524
+ case "never_subscribed": {
2525
+ const opener = source === "savings" ? `Joined through the savings program on ${joined}.` : `Created an account on ${joined}.`;
2526
+ if (capture) {
2527
+ if (!capture.qualified) {
2528
+ return `${opener} Completed the intake survey on ${fmtDay(capture.capturedAt)} but did not qualify.`;
2529
+ }
2530
+ return `${opener} Completed the intake survey on ${fmtDay(capture.capturedAt)} but never checked out.`;
2531
+ }
2532
+ if (facts?.hasFunnelCapture) {
2533
+ return `${opener} Completed the intake survey but never checked out.`;
2534
+ }
2535
+ if (facts?.hasOpenCart) {
2536
+ return `${opener} Never completed the intake survey; has an abandoned cart.`;
2537
+ }
2538
+ return `${opener} Never completed the intake survey.`;
2539
+ }
2540
+ case "card_declined": {
2541
+ const failed = latestFailedPayment(o.payments);
2542
+ const when = failed ? fmtDay(failed.createdAt) : fmtDay(facts?.lastPaymentAt);
2543
+ const why = failed?.failureReason ? `: ${failed.failureReason}` : "";
2544
+ return `Card declined at checkout on ${when}${why}. No subscription was created.`;
2545
+ }
2546
+ case "awaiting_prescriber": {
2547
+ const req = latestRequest(o.requests.items);
2548
+ const when = req ? fmtDay(req.createdAt) : fmtDay(facts?.latestRequestApexStatus ? null : null);
2549
+ return req ? `Prescription request submitted ${when}; awaiting prescriber review.` : "A prescription request is awaiting prescriber review.";
2550
+ }
2551
+ case "incomplete":
2552
+ return "Checkout payment outcome is unknown; the subscription is on hold until the charge is verified.";
2553
+ case "active": {
2554
+ if (!sub) return "Active subscription.";
2555
+ const next = sub.nextChargeAt ? ` Next charge ${fmtDay(sub.nextChargeAt)}.` : "";
2556
+ return `Subscribed ${fmtDay(sub.createdAt)}.${next}`;
2557
+ }
2558
+ case "past_due": {
2559
+ const s = o.subscriptions.find((x) => x.status === "past_due") ?? sub;
2560
+ const attempt = s ? newestFirst(s.billingAttempts ?? [], (a) => a.createdAt).find((a) => a.status === "failed") : null;
2561
+ const n = s?.retryCount ? ` (retry ${s.retryCount})` : "";
2562
+ const why = attempt?.errorMessage ? `: ${sentence(attempt.errorMessage)}` : ".";
2563
+ const retry = s?.nextChargeAt ? ` Next retry ${fmtDay(s.nextChargeAt)}.` : "";
2564
+ return `Renewal charge failed${n}${why}${retry}`;
2565
+ }
2566
+ case "paused": {
2567
+ const s = o.subscriptions.find((x) => x.status === "paused") ?? sub;
2568
+ return s?.pausedAt ? `Paused on ${fmtDay(s.pausedAt)}.` : "Subscription paused.";
2569
+ }
2570
+ case "cancelled": {
2571
+ const s = newestFirst(
2572
+ o.subscriptions.filter((x) => x.status === "cancelled"),
2573
+ (x) => x.cancelledAt
2574
+ )[0] ?? sub;
2575
+ if (!s) return "Subscription cancelled.";
2576
+ const started = ms(s.createdAt);
2577
+ const ended = ms(s.cancelledAt);
2578
+ const months = started !== null && ended !== null ? Math.max(0, Math.round((ended - started) / (30 * DAY_MS2))) : null;
2579
+ const tenure = months !== null && months > 0 ? ` after ${months} month${months === 1 ? "" : "s"}` : "";
2580
+ return `Cancelled on ${fmtDay(s.cancelledAt)}${tenure}.`;
2581
+ }
2582
+ default:
2583
+ return o.lifecycle.label || "";
2584
+ }
2585
+ }
2586
+ var SEVERITY_RANK = { danger: 0, warning: 1, info: 2 };
2587
+ var STALE_REVIEW_DAYS = 3;
2588
+ function deriveAttention(o, now = /* @__PURE__ */ new Date()) {
2589
+ const items = [];
2590
+ const nowMs = now.getTime();
2591
+ const liveSubs = o.subscriptions.filter((s) => LIVE.has(s.status));
2592
+ for (const p of o.payments) {
2593
+ if (p.status === "refund_pending") {
2594
+ items.push({
2595
+ id: `refund-pending-${p.id}`,
2596
+ severity: "danger",
2597
+ title: `Refund of ${dollars(p.amountCents)} did not complete at the gateway`,
2598
+ detail: p.failureReason ?? "Finish the refund manually in the gateway, then resolve here.",
2599
+ action: { kind: "open_payment", label: "View payment", paymentId: p.id }
2600
+ });
2601
+ }
2602
+ }
2603
+ for (const s of o.subscriptions) {
2604
+ for (const a of s.billingAttempts ?? []) {
2605
+ if (a.status === "indeterminate") {
2606
+ items.push({
2607
+ id: `attempt-indeterminate-${a.id}`,
2608
+ severity: "danger",
2609
+ title: "A charge outcome is unknown; billing is blocked until it is resolved",
2610
+ detail: `${dollars(a.amountCents)} for period ${(a.billingPeriod ?? 0) + 1}${a.errorMessage ? ` \u2014 ${a.errorMessage}` : ""}`,
2611
+ action: { kind: "resolve_attempt", label: "Resolve", subscriptionId: s.id, attemptId: a.id }
2612
+ });
2613
+ }
2614
+ }
2615
+ if (s.status === "past_due") {
2616
+ const failed = newestFirst(s.billingAttempts ?? [], (a) => a.createdAt).find((a) => a.status === "failed");
2617
+ items.push({
2618
+ id: `past-due-${s.id}`,
2619
+ severity: "warning",
2620
+ title: `Renewal charge failed${s.retryCount ? ` (retry ${s.retryCount})` : ""}`,
2621
+ detail: [
2622
+ failed?.errorMessage ? sentence(failed.errorMessage) : failed?.errorCode ? `Code ${failed.errorCode}.` : null,
2623
+ s.nextChargeAt ? `Next retry ${fmtDay(s.nextChargeAt)}.` : "No retry scheduled."
2624
+ ].filter(Boolean).join(" "),
2625
+ action: { kind: "edit_schedule", label: "Edit schedule", subscriptionId: s.id }
2626
+ });
2627
+ }
2628
+ if (s.status === "incomplete") {
2629
+ items.push({
2630
+ id: `incomplete-${s.id}`,
2631
+ severity: "warning",
2632
+ title: "Checkout payment is unverified",
2633
+ detail: "The gateway did not confirm the first charge. The subscription is held and will not bill until resolved.",
2634
+ action: { kind: "open_subscription", label: "View subscription", subscriptionId: s.id }
2635
+ });
2636
+ }
2637
+ }
2638
+ if (liveSubs.length === 0) {
2639
+ const declined = latestFailedPayment(o.payments.filter((p) => p.detached));
2640
+ if (declined) {
2641
+ items.push({
2642
+ id: `declined-${declined.id}`,
2643
+ severity: "warning",
2644
+ title: `Card declined at checkout on ${fmtDay(declined.createdAt)}`,
2645
+ detail: declined.failureReason ?? void 0,
2646
+ action: { kind: "open_payment", label: "View payment", paymentId: declined.id }
2647
+ });
2648
+ }
2649
+ }
2650
+ if (o.subscriptions.length === 0 && o.payments.every((p) => p.status !== "failed")) {
2651
+ const captured = o.funnel.captures.length > 0 || o.lifecycle.facts?.hasFunnelCapture;
2652
+ if (o.customer.savingsMemberId && !captured) {
2653
+ items.push({
2654
+ id: "savings-no-intake",
2655
+ severity: "info",
2656
+ title: "Registered through the savings program but never started the intake survey",
2657
+ detail: o.tenant.requirePaidSubscription ? "This site requires a paid subscription before a prescription request can be created." : void 0
2658
+ });
2659
+ } else if (captured) {
2660
+ const c = newestFirst(o.funnel.captures, (x) => x.capturedAt)[0];
2661
+ items.push({
2662
+ id: "intake-no-checkout",
2663
+ severity: "info",
2664
+ title: c ? `Completed the intake survey on ${fmtDay(c.capturedAt)} but never checked out` : "Completed the intake survey but never checked out",
2665
+ detail: c && !c.qualified ? "Did not qualify." : void 0
2666
+ });
2667
+ }
2668
+ }
2669
+ for (const r of o.requests.items) {
2670
+ if (r.status === "call_requested") {
2671
+ items.push({
2672
+ id: `consult-${r.requestId}`,
2673
+ severity: "info",
2674
+ title: `Prescriber requested a consultation${r.drugName ? ` for ${r.drugName}` : ""}`,
2675
+ action: { kind: "open_request", label: "View request", requestId: r.requestId }
2676
+ });
2677
+ }
2678
+ if (r.status === "pending") {
2679
+ const created = ms(r.createdAt);
2680
+ const days = created !== null ? Math.floor((nowMs - created) / DAY_MS2) : null;
2681
+ if (days !== null && days >= STALE_REVIEW_DAYS) {
2682
+ items.push({
2683
+ id: `stale-review-${r.requestId}`,
2684
+ severity: "info",
2685
+ title: `Awaiting prescriber review for ${days} days${r.drugName ? ` (${r.drugName})` : ""}`,
2686
+ action: { kind: "open_request", label: "View request", requestId: r.requestId }
2687
+ });
2688
+ }
2689
+ }
2690
+ if (r.renewal?.needsReviewAt) {
2691
+ items.push({
2692
+ id: `renewal-review-${r.renewal.id}`,
2693
+ severity: "warning",
2694
+ title: "Renewal needs review",
2695
+ detail: r.renewal.reviewReason ?? void 0,
2696
+ action: { kind: "open_request", label: "View request", requestId: r.requestId }
2697
+ });
2698
+ }
2699
+ }
2700
+ const pending = o.requests.items.filter((r) => r.status === "pending");
2701
+ if (liveSubs.length === 0 && o.subscriptions.some((s) => s.status === "cancelled") && pending.length > 0) {
2702
+ items.push({
2703
+ id: "cancelled-with-pending",
2704
+ severity: "warning",
2705
+ title: `${pending.length} unapproved prescription request${pending.length === 1 ? " is" : "s are"} still in the prescriber queue after cancellation`,
2706
+ detail: "A cancelled customer should not be prescribed. Cancel the pending requests.",
2707
+ action: { kind: "cancel_unapproved", label: "Cancel unapproved requests" }
2708
+ });
2709
+ }
2710
+ for (const t of o.support.threads) {
2711
+ if (t.adminUnread && t.status !== "closed") {
2712
+ items.push({
2713
+ id: `support-${t.id}`,
2714
+ severity: "info",
2715
+ title: `Support message awaiting reply${t.subject ? `: ${t.subject}` : ""}`,
2716
+ detail: t.lastMessageAt ? `Last message ${fmtDay(t.lastMessageAt)}` : void 0,
2717
+ action: { kind: "open_thread", label: "Open thread", threadId: t.id }
2718
+ });
2719
+ }
2720
+ }
2721
+ return items.sort((a, b) => SEVERITY_RANK[a.severity] - SEVERITY_RANK[b.severity]);
2722
+ }
2723
+ var JOURNEY_LABEL = {
2724
+ account: "Account",
2725
+ intake: "Intake",
2726
+ checkout: "Checkout",
2727
+ prescriber: "Prescriber",
2728
+ pharmacy: "Pharmacy",
2729
+ shipped: "Shipped",
2730
+ renewing: "Renewing"
2731
+ };
2732
+ function step(key, state, date = null, detail = null) {
2733
+ return { key, label: JOURNEY_LABEL[key], state, date, detail };
2734
+ }
2735
+ function deriveJourney(o) {
2736
+ const steps = [];
2737
+ const source = accountSource(o);
2738
+ const subs = o.subscriptions;
2739
+ const liveSub = primarySubscription(subs.filter((s) => LIVE.has(s.status)));
2740
+ const anySub = subs.length > 0;
2741
+ const req = latestRequest(o.requests.items);
2742
+ const capture = newestFirst(o.funnel.captures, (c) => c.capturedAt)[0] ?? null;
2743
+ const session = newestFirst(o.funnel.sessions, (s) => s.lastSeenAt)[0] ?? null;
2744
+ const declined = latestFailedPayment(o.payments);
2745
+ const paid = newestFirst(
2746
+ o.payments.filter((p) => p.status === "succeeded" || p.status === "refunded"),
2747
+ (p) => p.createdAt
2748
+ )[0];
2749
+ steps.push(step("account", "done", o.customer.createdAt, ACCOUNT_SOURCE_LABEL[source]));
2750
+ const intakeDone = !!capture || o.lifecycle.facts?.hasFunnelCapture || anySub || o.requests.items.length > 0;
2751
+ if (intakeDone) {
2752
+ steps.push(
2753
+ step(
2754
+ "intake",
2755
+ "done",
2756
+ capture?.capturedAt ?? null,
2757
+ capture ? capture.qualified ? "Completed and qualified" : "Completed, did not qualify" : "Completed"
2758
+ )
2759
+ );
2760
+ } else if (session) {
2761
+ steps.push(
2762
+ step(
2763
+ "intake",
2764
+ "active",
2765
+ session.lastSeenAt,
2766
+ session.lastStep != null && session.stepCount ? `Stopped at step ${session.lastStep} of ${session.stepCount}` : "Started, not completed"
2767
+ )
2768
+ );
2769
+ } else {
2770
+ steps.push(
2771
+ step(
2772
+ "intake",
2773
+ "active",
2774
+ null,
2775
+ o.funnel.telemetryEnabled ? "Not started" : "Not completed (step data not collected on this site)"
2776
+ )
2777
+ );
2778
+ }
2779
+ if (anySub || paid) {
2780
+ const first = [...subs].sort((a, b) => (ms(a.createdAt) ?? 0) - (ms(b.createdAt) ?? 0))[0];
2781
+ steps.push(step("checkout", "done", first?.createdAt ?? paid?.createdAt ?? null, first ? `${dollars(first.amountCents)} subscription` : "One-time purchase"));
2782
+ } else if (subs.some((s) => s.status === "incomplete")) {
2783
+ steps.push(step("checkout", "blocked", null, "Payment outcome unverified"));
2784
+ } else if (declined) {
2785
+ steps.push(step("checkout", "blocked", declined.createdAt, declined.failureReason ? `Declined: ${declined.failureReason}` : "Card declined"));
2786
+ } else if (intakeDone) {
2787
+ steps.push(step("checkout", "active", null, "Not started"));
2788
+ } else {
2789
+ steps.push(step("checkout", "upcoming"));
2790
+ }
2791
+ const checkoutDone = anySub || !!paid;
2792
+ if (req) {
2793
+ switch (req.status) {
2794
+ case "pending":
2795
+ steps.push(step("prescriber", "active", req.createdAt, "Awaiting review"));
2796
+ break;
2797
+ case "call_requested":
2798
+ steps.push(step("prescriber", "blocked", req.updatedAt ?? req.createdAt, "Consultation requested"));
2799
+ break;
2800
+ case "denied":
2801
+ steps.push(step("prescriber", "blocked", req.updatedAt ?? req.createdAt, "Not approved"));
2802
+ break;
2803
+ default:
2804
+ steps.push(step("prescriber", "done", req.updatedAt ?? req.createdAt, "Approved"));
2805
+ }
2806
+ } else if (liveSub) {
2807
+ steps.push(step("prescriber", "blocked", null, "No prescription request on file"));
2808
+ } else if (checkoutDone) {
2809
+ steps.push(step("prescriber", "upcoming", null, "No prescription request"));
2810
+ } else {
2811
+ steps.push(step("prescriber", "upcoming"));
2812
+ }
2813
+ const approvedStatuses = /* @__PURE__ */ new Set(["approved", "pharmacy", "processing", "completed", "shipped"]);
2814
+ if (req && (req.status === "pharmacy" || req.status === "processing" || req.status === "completed" || req.status === "shipped" || hasTracking(req))) {
2815
+ steps.push(step("pharmacy", "done", req.updatedAt ?? null, req.pharmacySent ? "Sent to pharmacy" : "At the pharmacy"));
2816
+ } else if (req && req.status === "approved") {
2817
+ steps.push(
2818
+ step(
2819
+ "pharmacy",
2820
+ "active",
2821
+ null,
2822
+ o.tenant.fulfillmentMode === "deferred" && !req.paymentConfirmed ? "Approved; waiting on payment confirmation" : "Approved; waiting for pharmacy hand-off"
2823
+ )
2824
+ );
2825
+ } else if (req && approvedStatuses.has(req.status)) {
2826
+ steps.push(step("pharmacy", "active"));
2827
+ } else {
2828
+ steps.push(step("pharmacy", "upcoming"));
2829
+ }
2830
+ if (req && hasTracking(req)) {
2831
+ const carrier = req.tracking?.shipCarrier ?? req.delivery?.shipCarrier ?? null;
2832
+ const number = req.tracking?.trackingNumber ?? req.delivery?.trackingNumber ?? null;
2833
+ const delivered = (req.tracking?.deliveryStatus ?? req.delivery?.status ?? "").toLowerCase() === "delivered";
2834
+ steps.push(
2835
+ step(
2836
+ "shipped",
2837
+ "done",
2838
+ req.tracking?.shippedAt ?? null,
2839
+ delivered ? "Delivered" : [carrier, number].filter(Boolean).join(" ") || "Shipped"
2840
+ )
2841
+ );
2842
+ } else if (req && (req.status === "pharmacy" || req.status === "processing" || req.status === "completed")) {
2843
+ steps.push(step("shipped", "active", null, "Awaiting shipment"));
2844
+ } else {
2845
+ steps.push(step("shipped", "upcoming"));
2846
+ }
2847
+ if (liveSub) {
2848
+ if (liveSub.status === "past_due") {
2849
+ steps.push(step("renewing", "blocked", liveSub.nextChargeAt, `Renewal charge failed${liveSub.retryCount ? `, retry ${liveSub.retryCount}` : ""}`));
2850
+ } else if (liveSub.status === "paused") {
2851
+ steps.push(step("renewing", "blocked", liveSub.pausedAt, "Paused"));
2852
+ } else {
2853
+ const checkIn = req?.renewal?.status ?? null;
2854
+ steps.push(
2855
+ step(
2856
+ "renewing",
2857
+ "done",
2858
+ liveSub.nextChargeAt,
2859
+ liveSub.nextChargeAt ? `Next charge ${fmtDay(liveSub.nextChargeAt)}${checkIn ? ` \xB7 check-in ${checkIn.replace(/_/g, " ")}` : ""}` : "No next charge scheduled"
2860
+ )
2861
+ );
2862
+ }
2863
+ } else if (subs.some((s) => s.status === "cancelled")) {
2864
+ const c = newestFirst(subs.filter((s) => s.status === "cancelled"), (s) => s.cancelledAt)[0];
2865
+ steps.push(step("renewing", "blocked", c?.cancelledAt ?? null, "Cancelled"));
2866
+ } else {
2867
+ steps.push(step("renewing", "upcoming"));
2868
+ }
2869
+ let seenActive = false;
2870
+ for (const s of steps) {
2871
+ if (s.state === "active" || s.state === "blocked") {
2872
+ if (seenActive && s.state === "active") s.state = "upcoming";
2873
+ seenActive = true;
2874
+ }
2875
+ }
2876
+ return steps;
2877
+ }
2878
+ var TRACKER_STATUS = {
2879
+ pending: "pending",
2880
+ approved: "approved",
2881
+ denied: "denied",
2882
+ call_requested: "call_requested",
2883
+ pharmacy: "pharmacy",
2884
+ processing: "pharmacy",
2885
+ completed: "pharmacy",
2886
+ shipped: "shipped"
2887
+ };
2888
+ function toTrackerRequest(r) {
2889
+ const delivery = r.delivery ?? (r.tracking?.trackingNumber ? {
2890
+ status: r.tracking.deliveryStatus,
2891
+ trackingNumber: r.tracking.trackingNumber,
2892
+ shipCarrier: r.tracking.shipCarrier ?? "",
2893
+ trackingUrl: null
2894
+ } : null);
2895
+ const status = delivery?.trackingNumber ? "shipped" : TRACKER_STATUS[r.status] ?? "pending";
2896
+ return {
2897
+ status,
2898
+ createdAt: r.createdAt,
2899
+ updatedAt: r.updatedAt,
2900
+ dosage: r.dosage ?? void 0,
2901
+ delivery
2902
+ };
2903
+ }
2904
+ var at = (iso) => iso ?? "";
2905
+ function attemptTone(a) {
2906
+ if (a.status === "failed") return "danger";
2907
+ if (a.status === "indeterminate") return "warning";
2908
+ if (a.status === "succeeded") return "success";
2909
+ return "neutral";
2910
+ }
2911
+ function buildTimeline(o, limit = 200) {
2912
+ const ev = [];
2913
+ ev.push({
2914
+ id: "account",
2915
+ at: o.customer.createdAt,
2916
+ kind: "account",
2917
+ title: "Account created",
2918
+ detail: ACCOUNT_SOURCE_LABEL[accountSource(o)],
2919
+ tone: "neutral"
2920
+ });
2921
+ for (const c of o.funnel.captures) {
2922
+ ev.push({
2923
+ id: `capture-${c.responseId}`,
2924
+ at: at(c.capturedAt),
2925
+ kind: "intake",
2926
+ title: c.qualified ? "Completed intake survey (qualified)" : "Completed intake survey (did not qualify)",
2927
+ detail: c.remindersSent ? `${c.remindersSent} recovery reminder${c.remindersSent === 1 ? "" : "s"} sent` : null,
2928
+ tone: c.qualified ? "success" : "neutral"
2929
+ });
2930
+ }
2931
+ for (const s of o.funnel.sessions) {
2932
+ ev.push({
2933
+ id: `session-${s.sessionId}`,
2934
+ at: at(s.startedAt),
2935
+ kind: "intake",
2936
+ title: "Started intake survey",
2937
+ detail: s.lastStep != null && s.stepCount ? `Reached step ${s.lastStep} of ${s.stepCount}` : null,
2938
+ tone: "neutral"
2939
+ });
2940
+ }
2941
+ for (const c of o.funnel.carts) {
2942
+ ev.push({
2943
+ id: `cart-${c.cartId}`,
2944
+ at: at(c.updatedAt),
2945
+ kind: "cart",
2946
+ title: c.convertedAt ? "Cart checked out" : "Cart left open",
2947
+ detail: `${c.itemCount} item${c.itemCount === 1 ? "" : "s"} \xB7 ${dollars(c.subtotalCents)}`,
2948
+ tone: "neutral"
2949
+ });
2950
+ }
2951
+ for (const s of o.subscriptions) {
2952
+ ev.push({
2953
+ id: `sub-created-${s.id}`,
2954
+ at: at(s.createdAt),
2955
+ kind: "subscription",
2956
+ title: `Subscribed${s.medication ? ` to ${s.medication}` : ""}`,
2957
+ detail: `${dollars(s.amountCents)} every ${s.intervalDays} days`,
2958
+ tone: "success"
2959
+ });
2960
+ if (s.pausedAt && s.status === "paused") {
2961
+ ev.push({ id: `sub-paused-${s.id}`, at: s.pausedAt, kind: "subscription", title: "Subscription paused", tone: "neutral" });
2962
+ }
2963
+ if (s.cancelledAt) {
2964
+ ev.push({ id: `sub-cancelled-${s.id}`, at: s.cancelledAt, kind: "subscription", title: "Subscription cancelled", tone: "danger" });
2965
+ }
2966
+ for (const a of s.billingAttempts ?? []) {
2967
+ if (a.status === "succeeded") continue;
2968
+ ev.push({
2969
+ id: `attempt-${a.id}`,
2970
+ at: at(a.createdAt),
2971
+ kind: "attempt",
2972
+ 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)})`,
2973
+ detail: a.errorMessage ?? a.errorCode ?? null,
2974
+ tone: attemptTone(a)
2975
+ });
2976
+ }
2977
+ }
2978
+ for (const p of o.payments) {
2979
+ const detached = p.detached ? " at checkout (no subscription created)" : "";
2980
+ 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)})`;
2981
+ ev.push({
2982
+ id: `payment-${p.id}`,
2983
+ at: at(p.createdAt),
2984
+ kind: "payment",
2985
+ title,
2986
+ detail: p.failureReason ?? (p.type ? p.type.replace(/_/g, " ") : null),
2987
+ tone: p.status === "succeeded" ? "success" : p.status === "failed" || p.status === "refund_pending" ? "danger" : p.status === "refunded" || p.status === "voided" ? "warning" : "neutral"
2988
+ });
2989
+ if (p.refundedAt && p.refundedAmountCents > 0 && p.status === "succeeded") {
2990
+ ev.push({
2991
+ id: `payment-partial-${p.id}`,
2992
+ at: at(p.refundedAt),
2993
+ kind: "payment",
2994
+ title: `Partially refunded ${dollars(p.refundedAmountCents)} of ${dollars(p.amountCents)}`,
2995
+ tone: "warning"
2996
+ });
2997
+ }
2998
+ }
2999
+ for (const r of o.requests.items) {
3000
+ if (r.createdAt) {
3001
+ ev.push({
3002
+ id: `request-${r.requestId}`,
3003
+ at: r.createdAt,
3004
+ kind: "request",
3005
+ title: `Prescription request submitted${r.drugName ? ` for ${r.drugName}` : ""}`,
3006
+ detail: r.dosage ?? null,
3007
+ tone: "neutral"
3008
+ });
3009
+ }
3010
+ if (r.updatedAt && r.updatedAt !== r.createdAt && r.status !== "pending") {
3011
+ ev.push({
3012
+ id: `request-status-${r.requestId}`,
3013
+ at: r.updatedAt,
3014
+ kind: "request",
3015
+ title: `Request ${r.status.replace(/_/g, " ")}${r.drugName ? ` (${r.drugName})` : ""}`,
3016
+ tone: r.status === "denied" ? "danger" : r.status === "call_requested" ? "warning" : "success"
3017
+ });
3018
+ }
3019
+ if (r.tracking?.shippedAt) {
3020
+ ev.push({
3021
+ id: `shipped-${r.requestId}`,
3022
+ at: r.tracking.shippedAt,
3023
+ kind: "shipment",
3024
+ title: `Shipped${r.drugName ? ` ${r.drugName}` : ""}`,
3025
+ detail: [r.tracking.shipCarrier, r.tracking.trackingNumber].filter(Boolean).join(" ") || null,
3026
+ tone: "success"
3027
+ });
3028
+ }
3029
+ if (r.renewal?.triggerAt) {
3030
+ ev.push({
3031
+ id: `renewal-${r.renewal.id}`,
3032
+ at: r.renewal.triggerAt,
3033
+ kind: "renewal",
3034
+ title: `Refill check-in ${r.renewal.status.replace(/_/g, " ")}`,
3035
+ detail: r.renewal.pharmacyFillDate ? `Fill date ${r.renewal.pharmacyFillDate}` : null,
3036
+ tone: r.renewal.status === "request_failed" ? "danger" : "neutral"
3037
+ });
3038
+ }
3039
+ }
3040
+ for (const t of o.support.threads) {
3041
+ if (t.lastMessageAt) {
3042
+ ev.push({
3043
+ id: `support-${t.id}`,
3044
+ at: t.lastMessageAt,
3045
+ kind: "support",
3046
+ title: t.adminUnread ? "Support message awaiting reply" : `Support thread ${t.status}`,
3047
+ detail: t.subject,
3048
+ tone: t.adminUnread ? "info" : "neutral"
3049
+ });
3050
+ }
3051
+ }
3052
+ return ev.filter((e) => ms(e.at) !== null).sort((a, b) => (ms(b.at) ?? 0) - (ms(a.at) ?? 0)).slice(0, limit);
3053
+ }
3054
+
2405
3055
  // src/flows/memberPortal.ts
2406
3056
  import { createResource as createResource2 } from "solid-js";
2407
3057
  async function fetchPendingSurveys2() {
@@ -2450,7 +3100,7 @@ function useMemberPortalData() {
2450
3100
  const [pendingSurveys] = createResource2(fetchPendingSurveys2);
2451
3101
  const member = () => me.error ? null : me()?.member ?? null;
2452
3102
  const subscriptions = () => me.error ? [] : me()?.subscriptions ?? [];
2453
- const primarySubscription = () => pickPrimarySub(subscriptions());
3103
+ const primarySubscription2 = () => pickPrimarySub(subscriptions());
2454
3104
  const hasBilling = () => subscriptions().length > 0;
2455
3105
  const rxRequests = () => rxRes.error ? [] : rxRes() ?? [];
2456
3106
  const primaryRx = () => {
@@ -2464,7 +3114,7 @@ function useMemberPortalData() {
2464
3114
  const firstName = () => readFirstName(member());
2465
3115
  const loading = () => me.loading || rxRes.loading;
2466
3116
  const error = () => rxRes.error || me.error ? "We couldn\u2019t load your portal. Please try again." : null;
2467
- const toTrackerRequest = (rx) => ({
3117
+ const toTrackerRequest2 = (rx) => ({
2468
3118
  status: rx.status,
2469
3119
  createdAt: rx.createdAt,
2470
3120
  updatedAt: rx.updatedAt,
@@ -2472,7 +3122,7 @@ function useMemberPortalData() {
2472
3122
  delivery: rx.delivery
2473
3123
  });
2474
3124
  const trackerSubscription = () => {
2475
- const s = primarySubscription();
3125
+ const s = primarySubscription2();
2476
3126
  if (!s) return null;
2477
3127
  return {
2478
3128
  status: s.status,
@@ -2488,7 +3138,7 @@ function useMemberPortalData() {
2488
3138
  return {
2489
3139
  member,
2490
3140
  subscriptions,
2491
- primarySubscription,
3141
+ primarySubscription: primarySubscription2,
2492
3142
  hasBilling,
2493
3143
  rxRequests,
2494
3144
  primaryRx,
@@ -2501,7 +3151,7 @@ function useMemberPortalData() {
2501
3151
  void refetchMe();
2502
3152
  void refetchRx();
2503
3153
  },
2504
- toTrackerRequest,
3154
+ toTrackerRequest: toTrackerRequest2,
2505
3155
  trackerSubscription
2506
3156
  };
2507
3157
  }
@@ -3190,9 +3840,9 @@ function createFunnelDraftStore(opts) {
3190
3840
  draftId = saved;
3191
3841
  if (isNew) postFunnelEvent("draft:saved", { draftId: saved });
3192
3842
  }
3193
- function scheduleFlush(ms) {
3843
+ function scheduleFlush(ms2) {
3194
3844
  if (timer) clearTimeout(timer);
3195
- timer = setTimeout(() => void flush(), ms);
3845
+ timer = setTimeout(() => void flush(), ms2);
3196
3846
  }
3197
3847
  if (typeof window !== "undefined" && typeof window.addEventListener === "function") {
3198
3848
  window.addEventListener("pagehide", () => void flush());
@@ -3339,10 +3989,23 @@ export {
3339
3989
  formatRelativeTime,
3340
3990
  useDashboardData,
3341
3991
  buildTrackingUrl,
3992
+ formatCalendarDate,
3342
3993
  buildTrackerView,
3343
3994
  buildRefillView,
3344
3995
  formatStageDate,
3345
3996
  formatEventDate,
3997
+ LIFECYCLE_LABEL,
3998
+ LIFECYCLE_TONE,
3999
+ LIFECYCLE_BUCKETS,
4000
+ ACCOUNT_SOURCE_LABEL,
4001
+ fmtDay,
4002
+ primarySubscription,
4003
+ accountSource,
4004
+ lifecycleReason,
4005
+ deriveAttention,
4006
+ deriveJourney,
4007
+ toTrackerRequest,
4008
+ buildTimeline,
3346
4009
  useMemberPortalData,
3347
4010
  useUpdatePaymentMethodFlow,
3348
4011
  isImageAttachment,
@@ -3363,4 +4026,4 @@ export {
3363
4026
  useSurveyV2Flow,
3364
4027
  uploadPrescriptionPhoto
3365
4028
  };
3366
- //# sourceMappingURL=B63K5R7M.jsx.map
4029
+ //# sourceMappingURL=NYLIUR7O.jsx.map