@apextelemed/partner-core 0.5.2 → 0.6.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 (44) hide show
  1. package/README.md +83 -14
  2. package/dist/api/index.d.ts +1 -1
  3. package/dist/api/index.js +3 -3
  4. package/dist/api/index.jsx +3 -3
  5. package/dist/chunk/{FUOUTRAO.jsx → 4ZSZHZQV.jsx} +2 -2
  6. package/dist/chunk/{ZJENZPAM.jsx → 5HNZ7SEM.jsx} +12 -8
  7. package/dist/chunk/{5D7SGF46.js → BEDW4XUM.js} +61 -5
  8. package/dist/chunk/BEDW4XUM.js.map +1 -0
  9. package/dist/chunk/{XHOD3HUQ.js → BVLA7ATM.js} +3 -3
  10. package/dist/chunk/{XHOD3HUQ.js.map → BVLA7ATM.js.map} +1 -1
  11. package/dist/chunk/{DQE4K55D.jsx → EVCGDF5D.jsx} +60 -4
  12. package/dist/chunk/{KO2JPCIP.js → HKNTNZRW.js} +3443 -1482
  13. package/dist/chunk/HKNTNZRW.js.map +1 -0
  14. package/dist/chunk/{JTG4H4I5.jsx → HXMLRDIJ.jsx} +92 -12
  15. package/dist/chunk/{C7TELVJF.js → MLXPHJLR.js} +3 -3
  16. package/dist/chunk/{C7TELVJF.js.map → MLXPHJLR.js.map} +1 -1
  17. package/dist/chunk/{2UWULNSX.jsx → NBB2VTQK.jsx} +2 -2
  18. package/dist/chunk/{ZD2MMEXL.js → NSRQXBHK.js} +13 -9
  19. package/dist/chunk/NSRQXBHK.js.map +1 -0
  20. package/dist/chunk/{7ZESUC4Q.js → QTGJY3YQ.js} +3 -3
  21. package/dist/chunk/{7ZESUC4Q.js.map → QTGJY3YQ.js.map} +1 -1
  22. package/dist/chunk/{I322BQIU.jsx → SSVJ27MR.jsx} +2650 -1224
  23. package/dist/chunk/{GNG53L37.jsx → WLEIDQ5M.jsx} +2 -2
  24. package/dist/chunk/{GPVYUP3H.js → WUE4VQBA.js} +92 -14
  25. package/dist/chunk/WUE4VQBA.js.map +1 -0
  26. package/dist/{client-BD9_HCZY.d.ts → client-B6Kt7LWo.d.ts} +129 -2
  27. package/dist/flows/index.d.ts +99 -7
  28. package/dist/flows/index.js +6 -6
  29. package/dist/flows/index.jsx +6 -6
  30. package/dist/index/index.d.ts +2 -2
  31. package/dist/index/index.js +7 -7
  32. package/dist/index/index.jsx +7 -7
  33. package/dist/pages/index.d.ts +13 -3
  34. package/dist/pages/index.js +5 -5
  35. package/dist/pages/index.jsx +5 -5
  36. package/dist/stores/index.d.ts +1 -1
  37. package/dist/stores/index.js +2 -2
  38. package/dist/stores/index.jsx +2 -2
  39. package/dist/theme/member-portal.css +213 -0
  40. package/package.json +1 -1
  41. package/dist/chunk/5D7SGF46.js.map +0 -1
  42. package/dist/chunk/GPVYUP3H.js.map +0 -1
  43. package/dist/chunk/KO2JPCIP.js.map +0 -1
  44. package/dist/chunk/ZD2MMEXL.js.map +0 -1
@@ -12,7 +12,7 @@ import {
12
12
  setAffiliateTokens,
13
13
  setTokens,
14
14
  usersApi
15
- } from "./DQE4K55D.jsx";
15
+ } from "./EVCGDF5D.jsx";
16
16
  import {
17
17
  getConfig,
18
18
  onConfigured
@@ -410,4 +410,4 @@ export {
410
410
  affiliateAuth_default,
411
411
  medication_default
412
412
  };
413
- //# sourceMappingURL=GNG53L37.jsx.map
413
+ //# sourceMappingURL=WLEIDQ5M.jsx.map
@@ -1,6 +1,6 @@
1
- import { fetchFunnelConfig, postFunnelEvent, readResumeToken, fetchResumedDraft, stripResumeToken, adoptFunnelSessionId, saveFunnelDraft } from './7ZESUC4Q.js';
2
- import { cart_default, medication_default, auth_default, affiliateAuth_default } from './C7TELVJF.js';
3
- import { newIdempotencyKey, apexApi, usersApi, addressesApi, paymentsApi, subscriptionsApi, membersApi, affiliatePortalApi, ApiError, ordersApi, supportApi, messagesApi, authApi } from './5D7SGF46.js';
1
+ import { fetchFunnelConfig, postFunnelEvent, readResumeToken, fetchResumedDraft, stripResumeToken, adoptFunnelSessionId, saveFunnelDraft } from './QTGJY3YQ.js';
2
+ import { cart_default, medication_default, auth_default, affiliateAuth_default } from './MLXPHJLR.js';
3
+ import { newIdempotencyKey, apexApi, usersApi, addressesApi, paymentsApi, subscriptionsApi, membersApi, affiliatePortalApi, ApiError, ordersApi, supportApi, messagesApi, authApi } from './BEDW4XUM.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';
@@ -1503,6 +1503,7 @@ function useSignupFlow(options) {
1503
1503
  quantity: i.quantity,
1504
1504
  dosage: i.dosage
1505
1505
  })) : void 0;
1506
+ const savingsMemberId = options.savingsMemberId?.() || void 0;
1506
1507
  await auth_default.signupAndSubscribe(
1507
1508
  {
1508
1509
  email: email().trim(),
@@ -1528,7 +1529,8 @@ function useSignupFlow(options) {
1528
1529
  state: state(),
1529
1530
  zip: zip().trim()
1530
1531
  },
1531
- promoCode: promoCode().trim() || void 0
1532
+ promoCode: promoCode().trim() || void 0,
1533
+ ...savingsMemberId ? { savingsMemberId } : {}
1532
1534
  },
1533
1535
  { idempotencyKey: idempotencyKey() }
1534
1536
  );
@@ -2247,6 +2249,12 @@ function buildShipment(rx) {
2247
2249
  etaLabel: "On its way \u2014 track it with the carrier for the latest updates."
2248
2250
  };
2249
2251
  }
2252
+ function approvedCaption(rx) {
2253
+ const generic = PIPELINE[PIPE.approved].subCaption;
2254
+ const due = parseBackendDate(rx.pharmacySendDate);
2255
+ if (!due) return generic;
2256
+ return `Your prescription is approved \u2014 it goes to the pharmacy on ${formatEventDate(due)}.`;
2257
+ }
2250
2258
  function buildTrackerView(rx) {
2251
2259
  if (rx.status === "call_requested") {
2252
2260
  const stages2 = [
@@ -2294,7 +2302,7 @@ function buildTrackerView(rx) {
2294
2302
  return {
2295
2303
  ...base,
2296
2304
  heroWord: step2.heroWord,
2297
- subCaption: step2.subCaption,
2305
+ subCaption: i === PIPE.approved ? approvedCaption(rx) : step2.subCaption,
2298
2306
  state: "active",
2299
2307
  timestamp: i === PIPE.submitted ? rx.createdAt : rx.updatedAt
2300
2308
  };
@@ -3029,6 +3037,7 @@ function toRx(r) {
3029
3037
  createdAt: r.createdAt ?? null,
3030
3038
  updatedAt: r.updatedAt ?? null,
3031
3039
  delivery: r.delivery,
3040
+ pharmacySendDate: r.pharmacySendDate ?? null,
3032
3041
  renewalId: r.renewal?.renewalId ?? null
3033
3042
  };
3034
3043
  }
@@ -3065,7 +3074,10 @@ function useMemberPortalData() {
3065
3074
  createdAt: rx.createdAt,
3066
3075
  updatedAt: rx.updatedAt,
3067
3076
  dosage: rx.dosage,
3068
- delivery: rx.delivery
3077
+ delivery: rx.delivery,
3078
+ // Must be forwarded, or the Approved bead falls back to generic copy and
3079
+ // the member is told nothing for the days the Rx spends waiting.
3080
+ pharmacySendDate: rx.pharmacySendDate
3069
3081
  });
3070
3082
  const trackerSubscription = () => {
3071
3083
  const s = primarySubscription2();
@@ -3243,6 +3255,20 @@ async function subscribeToSupportTopic(topic, onPing) {
3243
3255
  }
3244
3256
 
3245
3257
  // src/flows/messages.ts
3258
+ var SUPPORT_CATEGORIES = [
3259
+ { key: "billing", label: "Billing & payments" },
3260
+ { key: "orders", label: "Orders & shipping" },
3261
+ { key: "account", label: "My account" },
3262
+ { key: "technical", label: "Website or app problem" },
3263
+ { key: "other", label: "Something else" }
3264
+ ];
3265
+ var SUPPORT_CATEGORY_LABELS = SUPPORT_CATEGORIES.reduce(
3266
+ (acc, c) => ({ ...acc, [c.key]: c.label }),
3267
+ {}
3268
+ );
3269
+ function categoryLabel(category) {
3270
+ return category ? SUPPORT_CATEGORY_LABELS[category] : void 0;
3271
+ }
3246
3272
  function normalizeConversation(raw) {
3247
3273
  return {
3248
3274
  ...raw,
@@ -3261,7 +3287,8 @@ function normalizeSupportThread(raw) {
3261
3287
  lastMessage: raw.subject,
3262
3288
  lastMessageAt: raw.lastMessageAt,
3263
3289
  unreadCount: raw.customerUnread ? 1 : 0,
3264
- status: raw.status
3290
+ status: raw.status,
3291
+ category: raw.category ?? null
3265
3292
  };
3266
3293
  }
3267
3294
  function normalizeSupportMessage(raw) {
@@ -3344,6 +3371,7 @@ function useMessagesThread(options = {}) {
3344
3371
  const [loadingMessages, setLoadingMessages] = createSignal(false);
3345
3372
  const [sending, setSending] = createSignal(false);
3346
3373
  const [startingThread, setStartingThread] = createSignal(false);
3374
+ const [startingCareTeamThread, setStartingCareTeamThread] = createSignal(false);
3347
3375
  let pendingDeepLinkId = readDeepLinkedConversationId();
3348
3376
  let convoPollTimer;
3349
3377
  let msgPollTimer;
@@ -3372,6 +3400,7 @@ function useMessagesThread(options = {}) {
3372
3400
  }
3373
3401
  let pendingSend = null;
3374
3402
  let pendingThreadStart = null;
3403
+ let pendingCareTeamStart = null;
3375
3404
  async function fetchClinical() {
3376
3405
  try {
3377
3406
  const res = await messagesApi.listConversations();
@@ -3553,19 +3582,25 @@ function useMessagesThread(options = {}) {
3553
3582
  setSending(false);
3554
3583
  }
3555
3584
  }
3556
- async function startSupportThread(subject, body, file) {
3585
+ async function startSupportThread(subject, body, file, category) {
3557
3586
  const trimmedSubject = subject.trim();
3558
3587
  const trimmedBody = body.trim();
3588
+ const normalizedCategory = category ?? null;
3559
3589
  if (!trimmedSubject || !trimmedBody || startingThread()) {
3560
3590
  return { created: false, attachmentFailed: false };
3561
3591
  }
3562
- if (!pendingThreadStart || pendingThreadStart.subject !== trimmedSubject || pendingThreadStart.body !== trimmedBody) {
3563
- pendingThreadStart = { subject: trimmedSubject, body: trimmedBody, key: newIdempotencyKey() };
3592
+ if (!pendingThreadStart || pendingThreadStart.subject !== trimmedSubject || pendingThreadStart.body !== trimmedBody || pendingThreadStart.category !== normalizedCategory) {
3593
+ pendingThreadStart = {
3594
+ subject: trimmedSubject,
3595
+ body: trimmedBody,
3596
+ category: normalizedCategory,
3597
+ key: newIdempotencyKey()
3598
+ };
3564
3599
  }
3565
3600
  setStartingThread(true);
3566
3601
  try {
3567
3602
  const res = await supportApi.createThread(
3568
- { subject: trimmedSubject, body: trimmedBody },
3603
+ { subject: trimmedSubject, body: trimmedBody, category: normalizedCategory },
3569
3604
  { idempotencyKey: pendingThreadStart.key }
3570
3605
  );
3571
3606
  const thread = res.thread || res.data?.thread;
@@ -3587,6 +3622,47 @@ function useMessagesThread(options = {}) {
3587
3622
  setStartingThread(false);
3588
3623
  }
3589
3624
  }
3625
+ async function startCareTeamThread(text, file) {
3626
+ const trimmedText = text.trim();
3627
+ if (!trimmedText || startingCareTeamThread()) {
3628
+ return { created: false, attachmentFailed: false, reason: "error" };
3629
+ }
3630
+ if (!pendingCareTeamStart || pendingCareTeamStart.text !== trimmedText) {
3631
+ pendingCareTeamStart = { text: trimmedText, key: newIdempotencyKey() };
3632
+ }
3633
+ setStartingCareTeamThread(true);
3634
+ try {
3635
+ const res = await messagesApi.start(
3636
+ { text: trimmedText },
3637
+ { idempotencyKey: pendingCareTeamStart.key }
3638
+ );
3639
+ const rawConvo = res.conversation || res.data?.conversation;
3640
+ if (!rawConvo) {
3641
+ return { created: false, attachmentFailed: false, reason: "error" };
3642
+ }
3643
+ const conversation = normalizeConversation(rawConvo);
3644
+ pendingCareTeamStart = null;
3645
+ let attachmentFailed = false;
3646
+ if (file) {
3647
+ try {
3648
+ await messagesApi.uploadAttachment(conversation.id, file);
3649
+ } catch {
3650
+ attachmentFailed = true;
3651
+ }
3652
+ }
3653
+ await fetchConversations();
3654
+ await selectConversation(conversation.id);
3655
+ return { created: true, attachmentFailed };
3656
+ } catch (err) {
3657
+ if (err instanceof ApiError && err.status === 409) {
3658
+ pendingCareTeamStart = null;
3659
+ return { created: false, attachmentFailed: false, reason: "no_care_team" };
3660
+ }
3661
+ return { created: false, attachmentFailed: false, reason: "error" };
3662
+ } finally {
3663
+ setStartingCareTeamThread(false);
3664
+ }
3665
+ }
3590
3666
  onMount(() => {
3591
3667
  fetchConversations(true);
3592
3668
  if (autoPoll) {
@@ -3610,6 +3686,7 @@ function useMessagesThread(options = {}) {
3610
3686
  setDraft,
3611
3687
  sending,
3612
3688
  startingThread,
3689
+ startingCareTeamThread,
3613
3690
  selectedSource: () => {
3614
3691
  const id = selectedId();
3615
3692
  return id ? sourceOf(id) : null;
@@ -3619,6 +3696,7 @@ function useMessagesThread(options = {}) {
3619
3696
  send,
3620
3697
  refreshConversations: () => fetchConversations(false),
3621
3698
  startSupportThread,
3699
+ startCareTeamThread,
3622
3700
  sendAttachment,
3623
3701
  resolveAttachmentUrl
3624
3702
  };
@@ -3890,6 +3968,6 @@ async function uploadPrescriptionPhoto(file) {
3890
3968
  return { photoId: parsed.photoId };
3891
3969
  }
3892
3970
 
3893
- 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 };
3894
- //# sourceMappingURL=GPVYUP3H.js.map
3895
- //# sourceMappingURL=GPVYUP3H.js.map
3971
+ export { ACCOUNT_SOURCE_LABEL, LIFECYCLE_BUCKETS, LIFECYCLE_LABEL, LIFECYCLE_TONE, LIVE_SUBSCRIPTION_STATUSES, SUPPORT_CATEGORIES, TERMINAL_SUBSCRIPTION_STATUSES, US_STATES, US_STATE_OPTIONS, accountSource, availableStateOptions, availableStates, buildRefillView, buildTimeline, buildTrackerView, buildTrackingUrl, captureFunnelEmail, categoryLabel, 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 };
3972
+ //# sourceMappingURL=WUE4VQBA.js.map
3973
+ //# sourceMappingURL=WUE4VQBA.js.map