@apextelemed/partner-core 0.5.1 → 0.5.3
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.
- package/README.md +65 -14
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.js +3 -3
- package/dist/api/index.jsx +3 -3
- package/dist/chunk/{DQE4K55D.jsx → 2MRJESYW.jsx} +15 -1
- package/dist/chunk/{XHOD3HUQ.js → 3MRCEVWC.js} +3 -3
- package/dist/chunk/{XHOD3HUQ.js.map → 3MRCEVWC.js.map} +1 -1
- package/dist/chunk/{ZJENZPAM.jsx → 4A2CPTUM.jsx} +5 -5
- package/dist/chunk/{5D7SGF46.js → 7AJQ5SVA.js} +16 -2
- package/dist/chunk/7AJQ5SVA.js.map +1 -0
- package/dist/chunk/{ZD2MMEXL.js → AH2VJK7Q.js} +6 -6
- package/dist/chunk/{ZD2MMEXL.js.map → AH2VJK7Q.js.map} +1 -1
- package/dist/chunk/{2UWULNSX.jsx → BVHNZLDK.jsx} +2 -2
- package/dist/chunk/{GNG53L37.jsx → FNOEL4FK.jsx} +2 -2
- package/dist/chunk/{AH3PJBED.jsx → IWWUVNBB.jsx} +306 -49
- package/dist/chunk/{7ZESUC4Q.js → LVGOEJHQ.js} +3 -3
- package/dist/chunk/{7ZESUC4Q.js.map → LVGOEJHQ.js.map} +1 -1
- package/dist/chunk/{JTG4H4I5.jsx → OLLSJX7B.jsx} +89 -11
- package/dist/chunk/{FUOUTRAO.jsx → OWTKSSYT.jsx} +2 -2
- package/dist/chunk/{GPVYUP3H.js → QCYSYBQ7.js} +89 -13
- package/dist/chunk/QCYSYBQ7.js.map +1 -0
- package/dist/chunk/{C7TELVJF.js → RFDMPQG4.js} +3 -3
- package/dist/chunk/{C7TELVJF.js.map → RFDMPQG4.js.map} +1 -1
- package/dist/chunk/{JXPPJF2V.js → XKCIXSN4.js} +513 -280
- package/dist/chunk/XKCIXSN4.js.map +1 -0
- package/dist/{client-BD9_HCZY.d.ts → client-CY8nbizi.d.ts} +27 -1
- package/dist/flows/index.d.ts +54 -6
- package/dist/flows/index.js +6 -6
- package/dist/flows/index.jsx +6 -6
- package/dist/index/index.d.ts +1 -1
- package/dist/index/index.js +7 -7
- package/dist/index/index.jsx +7 -7
- package/dist/pages/index.d.ts +6 -1
- package/dist/pages/index.js +5 -5
- package/dist/pages/index.jsx +5 -5
- package/dist/stores/index.d.ts +1 -1
- package/dist/stores/index.js +2 -2
- package/dist/stores/index.jsx +2 -2
- package/dist/theme/member-portal.css +130 -0
- package/package.json +1 -1
- package/dist/chunk/5D7SGF46.js.map +0 -1
- package/dist/chunk/GPVYUP3H.js.map +0 -1
- package/dist/chunk/JXPPJF2V.js.map +0 -1
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
readResumeToken,
|
|
7
7
|
saveFunnelDraft,
|
|
8
8
|
stripResumeToken
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./BVHNZLDK.jsx";
|
|
10
10
|
import {
|
|
11
11
|
affiliateAuth_default,
|
|
12
12
|
auth_default,
|
|
13
13
|
cart_default,
|
|
14
14
|
medication_default
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./FNOEL4FK.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 "./
|
|
30
|
+
} from "./2MRJESYW.jsx";
|
|
31
31
|
import {
|
|
32
32
|
getConfig
|
|
33
33
|
} from "./LDZIUFDM.jsx";
|
|
@@ -2299,6 +2299,12 @@ function buildShipment(rx) {
|
|
|
2299
2299
|
etaLabel: "On its way \u2014 track it with the carrier for the latest updates."
|
|
2300
2300
|
};
|
|
2301
2301
|
}
|
|
2302
|
+
function approvedCaption(rx) {
|
|
2303
|
+
const generic = PIPELINE[PIPE.approved].subCaption;
|
|
2304
|
+
const due = parseBackendDate(rx.pharmacySendDate);
|
|
2305
|
+
if (!due) return generic;
|
|
2306
|
+
return `Your prescription is approved \u2014 it goes to the pharmacy on ${formatEventDate(due)}.`;
|
|
2307
|
+
}
|
|
2302
2308
|
function buildTrackerView(rx) {
|
|
2303
2309
|
if (rx.status === "call_requested") {
|
|
2304
2310
|
const stages2 = [
|
|
@@ -2346,7 +2352,7 @@ function buildTrackerView(rx) {
|
|
|
2346
2352
|
return {
|
|
2347
2353
|
...base,
|
|
2348
2354
|
heroWord: step2.heroWord,
|
|
2349
|
-
subCaption: step2.subCaption,
|
|
2355
|
+
subCaption: i === PIPE.approved ? approvedCaption(rx) : step2.subCaption,
|
|
2350
2356
|
state: "active",
|
|
2351
2357
|
timestamp: i === PIPE.submitted ? rx.createdAt : rx.updatedAt
|
|
2352
2358
|
};
|
|
@@ -3084,6 +3090,7 @@ function toRx(r) {
|
|
|
3084
3090
|
createdAt: r.createdAt ?? null,
|
|
3085
3091
|
updatedAt: r.updatedAt ?? null,
|
|
3086
3092
|
delivery: r.delivery,
|
|
3093
|
+
pharmacySendDate: r.pharmacySendDate ?? null,
|
|
3087
3094
|
renewalId: r.renewal?.renewalId ?? null
|
|
3088
3095
|
};
|
|
3089
3096
|
}
|
|
@@ -3120,7 +3127,10 @@ function useMemberPortalData() {
|
|
|
3120
3127
|
createdAt: rx.createdAt,
|
|
3121
3128
|
updatedAt: rx.updatedAt,
|
|
3122
3129
|
dosage: rx.dosage,
|
|
3123
|
-
delivery: rx.delivery
|
|
3130
|
+
delivery: rx.delivery,
|
|
3131
|
+
// Must be forwarded, or the Approved bead falls back to generic copy and
|
|
3132
|
+
// the member is told nothing for the days the Rx spends waiting.
|
|
3133
|
+
pharmacySendDate: rx.pharmacySendDate
|
|
3124
3134
|
});
|
|
3125
3135
|
const trackerSubscription = () => {
|
|
3126
3136
|
const s = primarySubscription2();
|
|
@@ -3304,6 +3314,20 @@ async function subscribeToSupportTopic(topic, onPing) {
|
|
|
3304
3314
|
}
|
|
3305
3315
|
|
|
3306
3316
|
// src/flows/messages.ts
|
|
3317
|
+
var SUPPORT_CATEGORIES = [
|
|
3318
|
+
{ key: "billing", label: "Billing & payments" },
|
|
3319
|
+
{ key: "orders", label: "Orders & shipping" },
|
|
3320
|
+
{ key: "account", label: "My account" },
|
|
3321
|
+
{ key: "technical", label: "Website or app problem" },
|
|
3322
|
+
{ key: "other", label: "Something else" }
|
|
3323
|
+
];
|
|
3324
|
+
var SUPPORT_CATEGORY_LABELS = SUPPORT_CATEGORIES.reduce(
|
|
3325
|
+
(acc, c) => ({ ...acc, [c.key]: c.label }),
|
|
3326
|
+
{}
|
|
3327
|
+
);
|
|
3328
|
+
function categoryLabel(category) {
|
|
3329
|
+
return category ? SUPPORT_CATEGORY_LABELS[category] : void 0;
|
|
3330
|
+
}
|
|
3307
3331
|
function normalizeConversation(raw) {
|
|
3308
3332
|
return {
|
|
3309
3333
|
...raw,
|
|
@@ -3322,7 +3346,8 @@ function normalizeSupportThread(raw) {
|
|
|
3322
3346
|
lastMessage: raw.subject,
|
|
3323
3347
|
lastMessageAt: raw.lastMessageAt,
|
|
3324
3348
|
unreadCount: raw.customerUnread ? 1 : 0,
|
|
3325
|
-
status: raw.status
|
|
3349
|
+
status: raw.status,
|
|
3350
|
+
category: raw.category ?? null
|
|
3326
3351
|
};
|
|
3327
3352
|
}
|
|
3328
3353
|
function normalizeSupportMessage(raw) {
|
|
@@ -3405,6 +3430,7 @@ function useMessagesThread(options = {}) {
|
|
|
3405
3430
|
const [loadingMessages, setLoadingMessages] = createSignal10(false);
|
|
3406
3431
|
const [sending, setSending] = createSignal10(false);
|
|
3407
3432
|
const [startingThread, setStartingThread] = createSignal10(false);
|
|
3433
|
+
const [startingCareTeamThread, setStartingCareTeamThread] = createSignal10(false);
|
|
3408
3434
|
let pendingDeepLinkId = readDeepLinkedConversationId();
|
|
3409
3435
|
let convoPollTimer;
|
|
3410
3436
|
let msgPollTimer;
|
|
@@ -3433,6 +3459,7 @@ function useMessagesThread(options = {}) {
|
|
|
3433
3459
|
}
|
|
3434
3460
|
let pendingSend = null;
|
|
3435
3461
|
let pendingThreadStart = null;
|
|
3462
|
+
let pendingCareTeamStart = null;
|
|
3436
3463
|
async function fetchClinical() {
|
|
3437
3464
|
try {
|
|
3438
3465
|
const res = await messagesApi.listConversations();
|
|
@@ -3614,19 +3641,25 @@ function useMessagesThread(options = {}) {
|
|
|
3614
3641
|
setSending(false);
|
|
3615
3642
|
}
|
|
3616
3643
|
}
|
|
3617
|
-
async function startSupportThread(subject, body, file) {
|
|
3644
|
+
async function startSupportThread(subject, body, file, category) {
|
|
3618
3645
|
const trimmedSubject = subject.trim();
|
|
3619
3646
|
const trimmedBody = body.trim();
|
|
3647
|
+
const normalizedCategory = category ?? null;
|
|
3620
3648
|
if (!trimmedSubject || !trimmedBody || startingThread()) {
|
|
3621
3649
|
return { created: false, attachmentFailed: false };
|
|
3622
3650
|
}
|
|
3623
|
-
if (!pendingThreadStart || pendingThreadStart.subject !== trimmedSubject || pendingThreadStart.body !== trimmedBody) {
|
|
3624
|
-
pendingThreadStart = {
|
|
3651
|
+
if (!pendingThreadStart || pendingThreadStart.subject !== trimmedSubject || pendingThreadStart.body !== trimmedBody || pendingThreadStart.category !== normalizedCategory) {
|
|
3652
|
+
pendingThreadStart = {
|
|
3653
|
+
subject: trimmedSubject,
|
|
3654
|
+
body: trimmedBody,
|
|
3655
|
+
category: normalizedCategory,
|
|
3656
|
+
key: newIdempotencyKey()
|
|
3657
|
+
};
|
|
3625
3658
|
}
|
|
3626
3659
|
setStartingThread(true);
|
|
3627
3660
|
try {
|
|
3628
3661
|
const res = await supportApi.createThread(
|
|
3629
|
-
{ subject: trimmedSubject, body: trimmedBody },
|
|
3662
|
+
{ subject: trimmedSubject, body: trimmedBody, category: normalizedCategory },
|
|
3630
3663
|
{ idempotencyKey: pendingThreadStart.key }
|
|
3631
3664
|
);
|
|
3632
3665
|
const thread = res.thread || res.data?.thread;
|
|
@@ -3648,6 +3681,47 @@ function useMessagesThread(options = {}) {
|
|
|
3648
3681
|
setStartingThread(false);
|
|
3649
3682
|
}
|
|
3650
3683
|
}
|
|
3684
|
+
async function startCareTeamThread(text, file) {
|
|
3685
|
+
const trimmedText = text.trim();
|
|
3686
|
+
if (!trimmedText || startingCareTeamThread()) {
|
|
3687
|
+
return { created: false, attachmentFailed: false, reason: "error" };
|
|
3688
|
+
}
|
|
3689
|
+
if (!pendingCareTeamStart || pendingCareTeamStart.text !== trimmedText) {
|
|
3690
|
+
pendingCareTeamStart = { text: trimmedText, key: newIdempotencyKey() };
|
|
3691
|
+
}
|
|
3692
|
+
setStartingCareTeamThread(true);
|
|
3693
|
+
try {
|
|
3694
|
+
const res = await messagesApi.start(
|
|
3695
|
+
{ text: trimmedText },
|
|
3696
|
+
{ idempotencyKey: pendingCareTeamStart.key }
|
|
3697
|
+
);
|
|
3698
|
+
const rawConvo = res.conversation || res.data?.conversation;
|
|
3699
|
+
if (!rawConvo) {
|
|
3700
|
+
return { created: false, attachmentFailed: false, reason: "error" };
|
|
3701
|
+
}
|
|
3702
|
+
const conversation = normalizeConversation(rawConvo);
|
|
3703
|
+
pendingCareTeamStart = null;
|
|
3704
|
+
let attachmentFailed = false;
|
|
3705
|
+
if (file) {
|
|
3706
|
+
try {
|
|
3707
|
+
await messagesApi.uploadAttachment(conversation.id, file);
|
|
3708
|
+
} catch {
|
|
3709
|
+
attachmentFailed = true;
|
|
3710
|
+
}
|
|
3711
|
+
}
|
|
3712
|
+
await fetchConversations();
|
|
3713
|
+
await selectConversation(conversation.id);
|
|
3714
|
+
return { created: true, attachmentFailed };
|
|
3715
|
+
} catch (err) {
|
|
3716
|
+
if (err instanceof ApiError && err.status === 409) {
|
|
3717
|
+
pendingCareTeamStart = null;
|
|
3718
|
+
return { created: false, attachmentFailed: false, reason: "no_care_team" };
|
|
3719
|
+
}
|
|
3720
|
+
return { created: false, attachmentFailed: false, reason: "error" };
|
|
3721
|
+
} finally {
|
|
3722
|
+
setStartingCareTeamThread(false);
|
|
3723
|
+
}
|
|
3724
|
+
}
|
|
3651
3725
|
onMount8(() => {
|
|
3652
3726
|
fetchConversations(true);
|
|
3653
3727
|
if (autoPoll) {
|
|
@@ -3671,6 +3745,7 @@ function useMessagesThread(options = {}) {
|
|
|
3671
3745
|
setDraft,
|
|
3672
3746
|
sending,
|
|
3673
3747
|
startingThread,
|
|
3748
|
+
startingCareTeamThread,
|
|
3674
3749
|
selectedSource: () => {
|
|
3675
3750
|
const id = selectedId();
|
|
3676
3751
|
return id ? sourceOf(id) : null;
|
|
@@ -3680,6 +3755,7 @@ function useMessagesThread(options = {}) {
|
|
|
3680
3755
|
send,
|
|
3681
3756
|
refreshConversations: () => fetchConversations(false),
|
|
3682
3757
|
startSupportThread,
|
|
3758
|
+
startCareTeamThread,
|
|
3683
3759
|
sendAttachment,
|
|
3684
3760
|
resolveAttachmentUrl
|
|
3685
3761
|
};
|
|
@@ -4009,6 +4085,8 @@ export {
|
|
|
4009
4085
|
buildTimeline,
|
|
4010
4086
|
useMemberPortalData,
|
|
4011
4087
|
useUpdatePaymentMethodFlow,
|
|
4088
|
+
SUPPORT_CATEGORIES,
|
|
4089
|
+
categoryLabel,
|
|
4012
4090
|
isImageAttachment,
|
|
4013
4091
|
formatConversationTime,
|
|
4014
4092
|
formatMessageTime,
|
|
@@ -4027,4 +4105,4 @@ export {
|
|
|
4027
4105
|
useSurveyV2Flow,
|
|
4028
4106
|
uploadPrescriptionPhoto
|
|
4029
4107
|
};
|
|
4030
|
-
//# sourceMappingURL=
|
|
4108
|
+
//# sourceMappingURL=OLLSJX7B.jsx.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
captureAuthHeader,
|
|
3
3
|
peekFunnelSessionId
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./BVHNZLDK.jsx";
|
|
5
5
|
import {
|
|
6
6
|
getConfig
|
|
7
7
|
} from "./LDZIUFDM.jsx";
|
|
@@ -174,4 +174,4 @@ export {
|
|
|
174
174
|
readCartToken,
|
|
175
175
|
stripCartToken
|
|
176
176
|
};
|
|
177
|
-
//# sourceMappingURL=
|
|
177
|
+
//# sourceMappingURL=OWTKSSYT.jsx.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { fetchFunnelConfig, postFunnelEvent, readResumeToken, fetchResumedDraft, stripResumeToken, adoptFunnelSessionId, saveFunnelDraft } from './
|
|
2
|
-
import { cart_default, medication_default, auth_default, affiliateAuth_default } from './
|
|
3
|
-
import { newIdempotencyKey, apexApi, usersApi, addressesApi, paymentsApi, subscriptionsApi, membersApi, affiliatePortalApi, ApiError, ordersApi, supportApi, messagesApi, authApi } from './
|
|
1
|
+
import { fetchFunnelConfig, postFunnelEvent, readResumeToken, fetchResumedDraft, stripResumeToken, adoptFunnelSessionId, saveFunnelDraft } from './LVGOEJHQ.js';
|
|
2
|
+
import { cart_default, medication_default, auth_default, affiliateAuth_default } from './RFDMPQG4.js';
|
|
3
|
+
import { newIdempotencyKey, apexApi, usersApi, addressesApi, paymentsApi, subscriptionsApi, membersApi, affiliatePortalApi, ApiError, ordersApi, supportApi, messagesApi, authApi } from './7AJQ5SVA.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';
|
|
@@ -2247,6 +2247,12 @@ function buildShipment(rx) {
|
|
|
2247
2247
|
etaLabel: "On its way \u2014 track it with the carrier for the latest updates."
|
|
2248
2248
|
};
|
|
2249
2249
|
}
|
|
2250
|
+
function approvedCaption(rx) {
|
|
2251
|
+
const generic = PIPELINE[PIPE.approved].subCaption;
|
|
2252
|
+
const due = parseBackendDate(rx.pharmacySendDate);
|
|
2253
|
+
if (!due) return generic;
|
|
2254
|
+
return `Your prescription is approved \u2014 it goes to the pharmacy on ${formatEventDate(due)}.`;
|
|
2255
|
+
}
|
|
2250
2256
|
function buildTrackerView(rx) {
|
|
2251
2257
|
if (rx.status === "call_requested") {
|
|
2252
2258
|
const stages2 = [
|
|
@@ -2294,7 +2300,7 @@ function buildTrackerView(rx) {
|
|
|
2294
2300
|
return {
|
|
2295
2301
|
...base,
|
|
2296
2302
|
heroWord: step2.heroWord,
|
|
2297
|
-
subCaption: step2.subCaption,
|
|
2303
|
+
subCaption: i === PIPE.approved ? approvedCaption(rx) : step2.subCaption,
|
|
2298
2304
|
state: "active",
|
|
2299
2305
|
timestamp: i === PIPE.submitted ? rx.createdAt : rx.updatedAt
|
|
2300
2306
|
};
|
|
@@ -3029,6 +3035,7 @@ function toRx(r) {
|
|
|
3029
3035
|
createdAt: r.createdAt ?? null,
|
|
3030
3036
|
updatedAt: r.updatedAt ?? null,
|
|
3031
3037
|
delivery: r.delivery,
|
|
3038
|
+
pharmacySendDate: r.pharmacySendDate ?? null,
|
|
3032
3039
|
renewalId: r.renewal?.renewalId ?? null
|
|
3033
3040
|
};
|
|
3034
3041
|
}
|
|
@@ -3065,7 +3072,10 @@ function useMemberPortalData() {
|
|
|
3065
3072
|
createdAt: rx.createdAt,
|
|
3066
3073
|
updatedAt: rx.updatedAt,
|
|
3067
3074
|
dosage: rx.dosage,
|
|
3068
|
-
delivery: rx.delivery
|
|
3075
|
+
delivery: rx.delivery,
|
|
3076
|
+
// Must be forwarded, or the Approved bead falls back to generic copy and
|
|
3077
|
+
// the member is told nothing for the days the Rx spends waiting.
|
|
3078
|
+
pharmacySendDate: rx.pharmacySendDate
|
|
3069
3079
|
});
|
|
3070
3080
|
const trackerSubscription = () => {
|
|
3071
3081
|
const s = primarySubscription2();
|
|
@@ -3243,6 +3253,20 @@ async function subscribeToSupportTopic(topic, onPing) {
|
|
|
3243
3253
|
}
|
|
3244
3254
|
|
|
3245
3255
|
// src/flows/messages.ts
|
|
3256
|
+
var SUPPORT_CATEGORIES = [
|
|
3257
|
+
{ key: "billing", label: "Billing & payments" },
|
|
3258
|
+
{ key: "orders", label: "Orders & shipping" },
|
|
3259
|
+
{ key: "account", label: "My account" },
|
|
3260
|
+
{ key: "technical", label: "Website or app problem" },
|
|
3261
|
+
{ key: "other", label: "Something else" }
|
|
3262
|
+
];
|
|
3263
|
+
var SUPPORT_CATEGORY_LABELS = SUPPORT_CATEGORIES.reduce(
|
|
3264
|
+
(acc, c) => ({ ...acc, [c.key]: c.label }),
|
|
3265
|
+
{}
|
|
3266
|
+
);
|
|
3267
|
+
function categoryLabel(category) {
|
|
3268
|
+
return category ? SUPPORT_CATEGORY_LABELS[category] : void 0;
|
|
3269
|
+
}
|
|
3246
3270
|
function normalizeConversation(raw) {
|
|
3247
3271
|
return {
|
|
3248
3272
|
...raw,
|
|
@@ -3261,7 +3285,8 @@ function normalizeSupportThread(raw) {
|
|
|
3261
3285
|
lastMessage: raw.subject,
|
|
3262
3286
|
lastMessageAt: raw.lastMessageAt,
|
|
3263
3287
|
unreadCount: raw.customerUnread ? 1 : 0,
|
|
3264
|
-
status: raw.status
|
|
3288
|
+
status: raw.status,
|
|
3289
|
+
category: raw.category ?? null
|
|
3265
3290
|
};
|
|
3266
3291
|
}
|
|
3267
3292
|
function normalizeSupportMessage(raw) {
|
|
@@ -3344,6 +3369,7 @@ function useMessagesThread(options = {}) {
|
|
|
3344
3369
|
const [loadingMessages, setLoadingMessages] = createSignal(false);
|
|
3345
3370
|
const [sending, setSending] = createSignal(false);
|
|
3346
3371
|
const [startingThread, setStartingThread] = createSignal(false);
|
|
3372
|
+
const [startingCareTeamThread, setStartingCareTeamThread] = createSignal(false);
|
|
3347
3373
|
let pendingDeepLinkId = readDeepLinkedConversationId();
|
|
3348
3374
|
let convoPollTimer;
|
|
3349
3375
|
let msgPollTimer;
|
|
@@ -3372,6 +3398,7 @@ function useMessagesThread(options = {}) {
|
|
|
3372
3398
|
}
|
|
3373
3399
|
let pendingSend = null;
|
|
3374
3400
|
let pendingThreadStart = null;
|
|
3401
|
+
let pendingCareTeamStart = null;
|
|
3375
3402
|
async function fetchClinical() {
|
|
3376
3403
|
try {
|
|
3377
3404
|
const res = await messagesApi.listConversations();
|
|
@@ -3553,19 +3580,25 @@ function useMessagesThread(options = {}) {
|
|
|
3553
3580
|
setSending(false);
|
|
3554
3581
|
}
|
|
3555
3582
|
}
|
|
3556
|
-
async function startSupportThread(subject, body, file) {
|
|
3583
|
+
async function startSupportThread(subject, body, file, category) {
|
|
3557
3584
|
const trimmedSubject = subject.trim();
|
|
3558
3585
|
const trimmedBody = body.trim();
|
|
3586
|
+
const normalizedCategory = category ?? null;
|
|
3559
3587
|
if (!trimmedSubject || !trimmedBody || startingThread()) {
|
|
3560
3588
|
return { created: false, attachmentFailed: false };
|
|
3561
3589
|
}
|
|
3562
|
-
if (!pendingThreadStart || pendingThreadStart.subject !== trimmedSubject || pendingThreadStart.body !== trimmedBody) {
|
|
3563
|
-
pendingThreadStart = {
|
|
3590
|
+
if (!pendingThreadStart || pendingThreadStart.subject !== trimmedSubject || pendingThreadStart.body !== trimmedBody || pendingThreadStart.category !== normalizedCategory) {
|
|
3591
|
+
pendingThreadStart = {
|
|
3592
|
+
subject: trimmedSubject,
|
|
3593
|
+
body: trimmedBody,
|
|
3594
|
+
category: normalizedCategory,
|
|
3595
|
+
key: newIdempotencyKey()
|
|
3596
|
+
};
|
|
3564
3597
|
}
|
|
3565
3598
|
setStartingThread(true);
|
|
3566
3599
|
try {
|
|
3567
3600
|
const res = await supportApi.createThread(
|
|
3568
|
-
{ subject: trimmedSubject, body: trimmedBody },
|
|
3601
|
+
{ subject: trimmedSubject, body: trimmedBody, category: normalizedCategory },
|
|
3569
3602
|
{ idempotencyKey: pendingThreadStart.key }
|
|
3570
3603
|
);
|
|
3571
3604
|
const thread = res.thread || res.data?.thread;
|
|
@@ -3587,6 +3620,47 @@ function useMessagesThread(options = {}) {
|
|
|
3587
3620
|
setStartingThread(false);
|
|
3588
3621
|
}
|
|
3589
3622
|
}
|
|
3623
|
+
async function startCareTeamThread(text, file) {
|
|
3624
|
+
const trimmedText = text.trim();
|
|
3625
|
+
if (!trimmedText || startingCareTeamThread()) {
|
|
3626
|
+
return { created: false, attachmentFailed: false, reason: "error" };
|
|
3627
|
+
}
|
|
3628
|
+
if (!pendingCareTeamStart || pendingCareTeamStart.text !== trimmedText) {
|
|
3629
|
+
pendingCareTeamStart = { text: trimmedText, key: newIdempotencyKey() };
|
|
3630
|
+
}
|
|
3631
|
+
setStartingCareTeamThread(true);
|
|
3632
|
+
try {
|
|
3633
|
+
const res = await messagesApi.start(
|
|
3634
|
+
{ text: trimmedText },
|
|
3635
|
+
{ idempotencyKey: pendingCareTeamStart.key }
|
|
3636
|
+
);
|
|
3637
|
+
const rawConvo = res.conversation || res.data?.conversation;
|
|
3638
|
+
if (!rawConvo) {
|
|
3639
|
+
return { created: false, attachmentFailed: false, reason: "error" };
|
|
3640
|
+
}
|
|
3641
|
+
const conversation = normalizeConversation(rawConvo);
|
|
3642
|
+
pendingCareTeamStart = null;
|
|
3643
|
+
let attachmentFailed = false;
|
|
3644
|
+
if (file) {
|
|
3645
|
+
try {
|
|
3646
|
+
await messagesApi.uploadAttachment(conversation.id, file);
|
|
3647
|
+
} catch {
|
|
3648
|
+
attachmentFailed = true;
|
|
3649
|
+
}
|
|
3650
|
+
}
|
|
3651
|
+
await fetchConversations();
|
|
3652
|
+
await selectConversation(conversation.id);
|
|
3653
|
+
return { created: true, attachmentFailed };
|
|
3654
|
+
} catch (err) {
|
|
3655
|
+
if (err instanceof ApiError && err.status === 409) {
|
|
3656
|
+
pendingCareTeamStart = null;
|
|
3657
|
+
return { created: false, attachmentFailed: false, reason: "no_care_team" };
|
|
3658
|
+
}
|
|
3659
|
+
return { created: false, attachmentFailed: false, reason: "error" };
|
|
3660
|
+
} finally {
|
|
3661
|
+
setStartingCareTeamThread(false);
|
|
3662
|
+
}
|
|
3663
|
+
}
|
|
3590
3664
|
onMount(() => {
|
|
3591
3665
|
fetchConversations(true);
|
|
3592
3666
|
if (autoPoll) {
|
|
@@ -3610,6 +3684,7 @@ function useMessagesThread(options = {}) {
|
|
|
3610
3684
|
setDraft,
|
|
3611
3685
|
sending,
|
|
3612
3686
|
startingThread,
|
|
3687
|
+
startingCareTeamThread,
|
|
3613
3688
|
selectedSource: () => {
|
|
3614
3689
|
const id = selectedId();
|
|
3615
3690
|
return id ? sourceOf(id) : null;
|
|
@@ -3619,6 +3694,7 @@ function useMessagesThread(options = {}) {
|
|
|
3619
3694
|
send,
|
|
3620
3695
|
refreshConversations: () => fetchConversations(false),
|
|
3621
3696
|
startSupportThread,
|
|
3697
|
+
startCareTeamThread,
|
|
3622
3698
|
sendAttachment,
|
|
3623
3699
|
resolveAttachmentUrl
|
|
3624
3700
|
};
|
|
@@ -3890,6 +3966,6 @@ async function uploadPrescriptionPhoto(file) {
|
|
|
3890
3966
|
return { photoId: parsed.photoId };
|
|
3891
3967
|
}
|
|
3892
3968
|
|
|
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=
|
|
3895
|
-
//# sourceMappingURL=
|
|
3969
|
+
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 };
|
|
3970
|
+
//# sourceMappingURL=QCYSYBQ7.js.map
|
|
3971
|
+
//# sourceMappingURL=QCYSYBQ7.js.map
|