@apextelemed/partner-core 0.5.2 → 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/{I322BQIU.jsx → IWWUVNBB.jsx} +282 -42
- 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/{KO2JPCIP.js → XKCIXSN4.js} +425 -228
- 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/KO2JPCIP.js.map +0 -1
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
LIFECYCLE_BUCKETS,
|
|
8
8
|
LIFECYCLE_LABEL,
|
|
9
9
|
LIFECYCLE_TONE,
|
|
10
|
+
SUPPORT_CATEGORIES,
|
|
10
11
|
US_STATE_OPTIONS,
|
|
11
12
|
accountSource,
|
|
12
13
|
availableStateOptions,
|
|
@@ -15,6 +16,7 @@ import {
|
|
|
15
16
|
buildTrackerView,
|
|
16
17
|
buildTrackingUrl,
|
|
17
18
|
captureFunnelEmail,
|
|
19
|
+
categoryLabel,
|
|
18
20
|
deriveAttention,
|
|
19
21
|
deriveJourney,
|
|
20
22
|
emailGateAnswered,
|
|
@@ -48,10 +50,10 @@ import {
|
|
|
48
50
|
useSurveyFlow,
|
|
49
51
|
useSurveyV2Flow,
|
|
50
52
|
useUpdatePaymentMethodFlow
|
|
51
|
-
} from "./
|
|
53
|
+
} from "./OLLSJX7B.jsx";
|
|
52
54
|
import {
|
|
53
55
|
fetchFunnelConfig
|
|
54
|
-
} from "./
|
|
56
|
+
} from "./BVHNZLDK.jsx";
|
|
55
57
|
import {
|
|
56
58
|
usePrimitives
|
|
57
59
|
} from "./J63XPQP4.jsx";
|
|
@@ -59,7 +61,7 @@ import {
|
|
|
59
61
|
affiliateAuth_default,
|
|
60
62
|
auth_default,
|
|
61
63
|
cart_default
|
|
62
|
-
} from "./
|
|
64
|
+
} from "./FNOEL4FK.jsx";
|
|
63
65
|
import {
|
|
64
66
|
ApiError,
|
|
65
67
|
SUPPORT_ATTACHMENT_MAX_BYTES,
|
|
@@ -73,7 +75,7 @@ import {
|
|
|
73
75
|
membersApi,
|
|
74
76
|
subscriptionsApi,
|
|
75
77
|
usersApi
|
|
76
|
-
} from "./
|
|
78
|
+
} from "./2MRJESYW.jsx";
|
|
77
79
|
|
|
78
80
|
// src/pages/Survey.tsx
|
|
79
81
|
import { Show, For, createEffect, on } from "solid-js";
|
|
@@ -15079,7 +15081,7 @@ function UpdatePaymentMethod(props) {
|
|
|
15079
15081
|
}
|
|
15080
15082
|
|
|
15081
15083
|
// src/pages/MemberPortal.tsx
|
|
15082
|
-
import { Show as Show53, Switch as
|
|
15084
|
+
import { Show as Show53, Switch as Switch4, Match as Match4, For as For38, createSignal as createSignal35, onMount as onMount3 } from "solid-js";
|
|
15083
15085
|
|
|
15084
15086
|
// src/pages/member/OrderTracker.tsx
|
|
15085
15087
|
import { Show as Show46, For as For33, createSignal as createSignal29 } from "solid-js";
|
|
@@ -15706,7 +15708,7 @@ function MedicationGuide(props) {
|
|
|
15706
15708
|
}
|
|
15707
15709
|
|
|
15708
15710
|
// src/pages/member/MessagesPanel.tsx
|
|
15709
|
-
import { Show as Show51, For as For36, createEffect as createEffect11, createSignal as createSignal33 } from "solid-js";
|
|
15711
|
+
import { Show as Show51, For as For36, Switch as Switch3, Match as Match3, createEffect as createEffect11, createSignal as createSignal33 } from "solid-js";
|
|
15710
15712
|
import DOMPurify from "dompurify";
|
|
15711
15713
|
function sanitizeMessageHtml(html) {
|
|
15712
15714
|
return DOMPurify.sanitize(html, {
|
|
@@ -15762,8 +15764,12 @@ function rejectionReason(file) {
|
|
|
15762
15764
|
function MessagesPanel(props) {
|
|
15763
15765
|
const thread = () => props.thread;
|
|
15764
15766
|
const [composing, setComposing] = createSignal33(false);
|
|
15767
|
+
const [composeStep, setComposeStep] = createSignal33(
|
|
15768
|
+
"choice"
|
|
15769
|
+
);
|
|
15765
15770
|
const [newSubject, setNewSubject] = createSignal33("");
|
|
15766
15771
|
const [newBody, setNewBody] = createSignal33("");
|
|
15772
|
+
const [newCategory, setNewCategory] = createSignal33(null);
|
|
15767
15773
|
const [composeError, setComposeError] = createSignal33(null);
|
|
15768
15774
|
const [pendingFile, setPendingFile] = createSignal33(null);
|
|
15769
15775
|
const [newFile, setNewFile] = createSignal33(null);
|
|
@@ -15797,13 +15803,54 @@ function MessagesPanel(props) {
|
|
|
15797
15803
|
thread().clearSelection();
|
|
15798
15804
|
setNewSubject("");
|
|
15799
15805
|
setNewBody("");
|
|
15806
|
+
setNewCategory(null);
|
|
15800
15807
|
setComposeError(null);
|
|
15808
|
+
setComposeStep("choice");
|
|
15801
15809
|
setComposing(true);
|
|
15802
15810
|
}
|
|
15811
|
+
let composerRef;
|
|
15812
|
+
async function pickCareTeam() {
|
|
15813
|
+
const convo = thread().conversations().find((c) => c.source === "clinical");
|
|
15814
|
+
if (!convo) {
|
|
15815
|
+
setComposeStep("care");
|
|
15816
|
+
return;
|
|
15817
|
+
}
|
|
15818
|
+
setComposing(false);
|
|
15819
|
+
await thread().selectConversation(convo.id);
|
|
15820
|
+
requestAnimationFrame(() => composerRef?.focus());
|
|
15821
|
+
}
|
|
15803
15822
|
async function submitCompose(e) {
|
|
15804
15823
|
e.preventDefault();
|
|
15805
15824
|
setComposeError(null);
|
|
15806
|
-
const result = await thread().startSupportThread(
|
|
15825
|
+
const result = await thread().startSupportThread(
|
|
15826
|
+
newSubject(),
|
|
15827
|
+
newBody(),
|
|
15828
|
+
newFile() ?? void 0,
|
|
15829
|
+
newCategory()
|
|
15830
|
+
);
|
|
15831
|
+
if (!result.created) {
|
|
15832
|
+
setComposeError("That didn't send. Please try again.");
|
|
15833
|
+
return;
|
|
15834
|
+
}
|
|
15835
|
+
setComposing(false);
|
|
15836
|
+
setNewSubject("");
|
|
15837
|
+
setNewBody("");
|
|
15838
|
+
setNewCategory(null);
|
|
15839
|
+
const file = newFile();
|
|
15840
|
+
setNewFile(null);
|
|
15841
|
+
if (result.attachmentFailed && file) {
|
|
15842
|
+
setPendingFile(file);
|
|
15843
|
+
setAttachError("Your message was sent, but the file didn\u2019t attach. Try sending it again.");
|
|
15844
|
+
}
|
|
15845
|
+
}
|
|
15846
|
+
async function submitCareCompose(e) {
|
|
15847
|
+
e.preventDefault();
|
|
15848
|
+
setComposeError(null);
|
|
15849
|
+
const result = await thread().startCareTeamThread(newBody(), newFile() ?? void 0);
|
|
15850
|
+
if (result.reason === "no_care_team") {
|
|
15851
|
+
setComposeStep("care-notice");
|
|
15852
|
+
return;
|
|
15853
|
+
}
|
|
15807
15854
|
if (!result.created) {
|
|
15808
15855
|
setComposeError("That didn't send. Please try again.");
|
|
15809
15856
|
return;
|
|
@@ -15811,6 +15858,7 @@ function MessagesPanel(props) {
|
|
|
15811
15858
|
setComposing(false);
|
|
15812
15859
|
setNewSubject("");
|
|
15813
15860
|
setNewBody("");
|
|
15861
|
+
setNewCategory(null);
|
|
15814
15862
|
const file = newFile();
|
|
15815
15863
|
setNewFile(null);
|
|
15816
15864
|
if (result.attachmentFailed && file) {
|
|
@@ -15830,6 +15878,16 @@ function MessagesPanel(props) {
|
|
|
15830
15878
|
void handleSend();
|
|
15831
15879
|
}
|
|
15832
15880
|
}
|
|
15881
|
+
const ChannelChip = (p) => <span
|
|
15882
|
+
class={`channel-chip channel-chip--${p.source}`}
|
|
15883
|
+
data-testid="channel-chip"
|
|
15884
|
+
data-channel={p.source}
|
|
15885
|
+
>
|
|
15886
|
+
{p.source === "clinical" ? "Care team" : "Support"}
|
|
15887
|
+
<Show51 when={p.source === "support" && categoryLabel(p.category)}>
|
|
15888
|
+
{(label) => <span class="channel-chip__category">{label()}</span>}
|
|
15889
|
+
</Show51>
|
|
15890
|
+
</span>;
|
|
15833
15891
|
const ConversationList = () => <>
|
|
15834
15892
|
<div class="msg-list__header">
|
|
15835
15893
|
<h2 class="msg-list__title">Messages</h2>
|
|
@@ -15840,7 +15898,7 @@ function MessagesPanel(props) {
|
|
|
15840
15898
|
onClick={openCompose}
|
|
15841
15899
|
>
|
|
15842
15900
|
<i class="ph-thin ph-plus" aria-hidden="true" />
|
|
15843
|
-
|
|
15901
|
+
New message
|
|
15844
15902
|
</button>
|
|
15845
15903
|
</div>
|
|
15846
15904
|
|
|
@@ -15856,8 +15914,9 @@ function MessagesPanel(props) {
|
|
|
15856
15914
|
<i class="ph-thin ph-chat-circle msg-list__empty-icon" aria-hidden="true" />
|
|
15857
15915
|
<p class="msg-list__empty-title">No conversations yet.</p>
|
|
15858
15916
|
<p class="msg-list__empty-hint">
|
|
15859
|
-
Your care team
|
|
15860
|
-
|
|
15917
|
+
Your care team reviews and responds to anything about your treatment, medication or
|
|
15918
|
+
side effects. For questions about your account, an order, billing or the site,
|
|
15919
|
+
message support instead.
|
|
15861
15920
|
</p>
|
|
15862
15921
|
</div>
|
|
15863
15922
|
</Show51>
|
|
@@ -15870,7 +15929,10 @@ function MessagesPanel(props) {
|
|
|
15870
15929
|
onClick={() => thread().selectConversation(convo.id)}
|
|
15871
15930
|
>
|
|
15872
15931
|
<div class="msg-list__row">
|
|
15873
|
-
<span class="msg-list__name">
|
|
15932
|
+
<span class="msg-list__name-group">
|
|
15933
|
+
<span class="msg-list__name">{convo.participantName ?? "Provider"}</span>
|
|
15934
|
+
<ChannelChip source={convo.source} category={convo.category} />
|
|
15935
|
+
</span>
|
|
15874
15936
|
<span class="msg-list__time">{formatConversationTime(convo.lastMessageAt)}</span>
|
|
15875
15937
|
</div>
|
|
15876
15938
|
<div class="msg-list__row">
|
|
@@ -15991,8 +16053,9 @@ function MessagesPanel(props) {
|
|
|
15991
16053
|
<button
|
|
15992
16054
|
type="button"
|
|
15993
16055
|
class="msg-thread__back-btn"
|
|
15994
|
-
aria-label="Back
|
|
15995
|
-
|
|
16056
|
+
aria-label="Back"
|
|
16057
|
+
data-testid="support-compose-back"
|
|
16058
|
+
onClick={() => setComposeStep("choice")}
|
|
15996
16059
|
>
|
|
15997
16060
|
<i class="ph-thin ph-arrow-left" aria-hidden="true" />
|
|
15998
16061
|
</button>
|
|
@@ -16003,8 +16066,25 @@ function MessagesPanel(props) {
|
|
|
16003
16066
|
</div>
|
|
16004
16067
|
|
|
16005
16068
|
<div class="msg-compose__new">
|
|
16069
|
+
<label class="msg-compose__label" id="support-category-label">
|
|
16070
|
+
What's this about? <span class="msg-compose__label-optional">(optional)</span>
|
|
16071
|
+
</label>
|
|
16072
|
+
<div class="msg-compose__categories" role="group" aria-labelledby="support-category-label">
|
|
16073
|
+
<For36 each={SUPPORT_CATEGORIES}>
|
|
16074
|
+
{(c) => <button
|
|
16075
|
+
type="button"
|
|
16076
|
+
class={`msg-compose__category-chip${newCategory() === c.key ? " is-selected" : ""}`}
|
|
16077
|
+
data-testid={`compose-category-${c.key}`}
|
|
16078
|
+
aria-pressed={newCategory() === c.key}
|
|
16079
|
+
onClick={() => setNewCategory((prev) => prev === c.key ? null : c.key)}
|
|
16080
|
+
>
|
|
16081
|
+
{c.label}
|
|
16082
|
+
</button>}
|
|
16083
|
+
</For36>
|
|
16084
|
+
</div>
|
|
16085
|
+
|
|
16006
16086
|
<label class="msg-compose__label" for="support-subject">
|
|
16007
|
-
|
|
16087
|
+
Subject
|
|
16008
16088
|
</label>
|
|
16009
16089
|
<input
|
|
16010
16090
|
id="support-subject"
|
|
@@ -16070,6 +16150,147 @@ function MessagesPanel(props) {
|
|
|
16070
16150
|
</button>
|
|
16071
16151
|
</div>
|
|
16072
16152
|
</form>;
|
|
16153
|
+
const NewCareTeamThread = () => <form class="msg-thread msg-thread--compose" onSubmit={submitCareCompose} data-testid="care-compose">
|
|
16154
|
+
<div class="msg-thread__header">
|
|
16155
|
+
<button
|
|
16156
|
+
type="button"
|
|
16157
|
+
class="msg-thread__back-btn"
|
|
16158
|
+
aria-label="Back"
|
|
16159
|
+
data-testid="care-compose-back"
|
|
16160
|
+
onClick={() => setComposeStep("choice")}
|
|
16161
|
+
>
|
|
16162
|
+
<i class="ph-thin ph-arrow-left" aria-hidden="true" />
|
|
16163
|
+
</button>
|
|
16164
|
+
<div>
|
|
16165
|
+
<h3 class="msg-thread__name">Message your care team</h3>
|
|
16166
|
+
<p class="msg-thread__role">Your prescriber or their team will reply</p>
|
|
16167
|
+
</div>
|
|
16168
|
+
</div>
|
|
16169
|
+
|
|
16170
|
+
<div class="msg-compose__new">
|
|
16171
|
+
<label class="msg-compose__label" for="care-body">
|
|
16172
|
+
Message
|
|
16173
|
+
</label>
|
|
16174
|
+
<textarea
|
|
16175
|
+
id="care-body"
|
|
16176
|
+
class="msg-compose__body"
|
|
16177
|
+
rows={6}
|
|
16178
|
+
maxLength={5e3}
|
|
16179
|
+
required
|
|
16180
|
+
placeholder="Tell your care team what's going on…"
|
|
16181
|
+
value={newBody()}
|
|
16182
|
+
onInput={(e) => setNewBody(e.currentTarget.value)}
|
|
16183
|
+
/>
|
|
16184
|
+
|
|
16185
|
+
<label class="msg-compose__attach msg-compose__attach--block" title="Attach a file">
|
|
16186
|
+
<i class="ph-thin ph-paperclip" aria-hidden="true" />
|
|
16187
|
+
<span class="msg-compose__attach-label">
|
|
16188
|
+
{newFile()?.name ?? "Attach a file (optional)"}
|
|
16189
|
+
</span>
|
|
16190
|
+
<input
|
|
16191
|
+
class="msg-compose__file-input"
|
|
16192
|
+
type="file"
|
|
16193
|
+
accept={SUPPORT_ATTACHMENT_MIME_TYPES.join(",")}
|
|
16194
|
+
data-testid="care-compose-attach"
|
|
16195
|
+
onChange={(e) => stageFile(e.currentTarget, setNewFile)}
|
|
16196
|
+
/>
|
|
16197
|
+
</label>
|
|
16198
|
+
<Show51 when={newFile()}>
|
|
16199
|
+
<button
|
|
16200
|
+
type="button"
|
|
16201
|
+
class="msg-compose__staged-remove msg-compose__staged-remove--inline"
|
|
16202
|
+
onClick={() => setNewFile(null)}
|
|
16203
|
+
>
|
|
16204
|
+
Remove file
|
|
16205
|
+
</button>
|
|
16206
|
+
</Show51>
|
|
16207
|
+
|
|
16208
|
+
<Show51 when={attachError() || composeError()}>
|
|
16209
|
+
<p class="msg-compose__error" role="alert">
|
|
16210
|
+
{attachError() ?? composeError()}
|
|
16211
|
+
</p>
|
|
16212
|
+
</Show51>
|
|
16213
|
+
|
|
16214
|
+
<button
|
|
16215
|
+
type="submit"
|
|
16216
|
+
class="msg-compose__send"
|
|
16217
|
+
data-testid="care-compose-send"
|
|
16218
|
+
disabled={thread().startingCareTeamThread() || !newBody().trim()}
|
|
16219
|
+
>
|
|
16220
|
+
{thread().startingCareTeamThread() ? "Sending\u2026" : "Send"}
|
|
16221
|
+
</button>
|
|
16222
|
+
</div>
|
|
16223
|
+
</form>;
|
|
16224
|
+
const ChannelChoice = () => <div class="msg-thread msg-choice" data-testid="messages-channel-choice">
|
|
16225
|
+
<div class="msg-thread__header">
|
|
16226
|
+
<button
|
|
16227
|
+
type="button"
|
|
16228
|
+
class="msg-thread__back-btn"
|
|
16229
|
+
aria-label="Back to conversations"
|
|
16230
|
+
onClick={() => setComposing(false)}
|
|
16231
|
+
>
|
|
16232
|
+
<i class="ph-thin ph-arrow-left" aria-hidden="true" />
|
|
16233
|
+
</button>
|
|
16234
|
+
<div>
|
|
16235
|
+
<h3 class="msg-thread__name">New message</h3>
|
|
16236
|
+
<p class="msg-thread__role">What's this about?</p>
|
|
16237
|
+
</div>
|
|
16238
|
+
</div>
|
|
16239
|
+
|
|
16240
|
+
<div class="msg-choice__options">
|
|
16241
|
+
<button
|
|
16242
|
+
type="button"
|
|
16243
|
+
class="msg-choice__option"
|
|
16244
|
+
data-testid="choice-care-team"
|
|
16245
|
+
onClick={() => void pickCareTeam()}
|
|
16246
|
+
>
|
|
16247
|
+
<i class="ph-thin ph-heartbeat msg-choice__option-icon" aria-hidden="true" />
|
|
16248
|
+
<span class="msg-choice__option-title">My treatment, medication or side effects</span>
|
|
16249
|
+
<span class="msg-choice__option-sub">Goes to your care team</span>
|
|
16250
|
+
</button>
|
|
16251
|
+
<button
|
|
16252
|
+
type="button"
|
|
16253
|
+
class="msg-choice__option"
|
|
16254
|
+
data-testid="choice-support"
|
|
16255
|
+
onClick={() => setComposeStep("support")}
|
|
16256
|
+
>
|
|
16257
|
+
<i class="ph-thin ph-lifebuoy msg-choice__option-icon" aria-hidden="true" />
|
|
16258
|
+
<span class="msg-choice__option-title">My account, order, billing or the website</span>
|
|
16259
|
+
<span class="msg-choice__option-sub">Goes to support</span>
|
|
16260
|
+
</button>
|
|
16261
|
+
</div>
|
|
16262
|
+
</div>;
|
|
16263
|
+
const CareTeamNotice = () => <div class="msg-thread msg-choice" data-testid="care-team-notice">
|
|
16264
|
+
<div class="msg-thread__header">
|
|
16265
|
+
<button
|
|
16266
|
+
type="button"
|
|
16267
|
+
class="msg-thread__back-btn"
|
|
16268
|
+
aria-label="Back"
|
|
16269
|
+
onClick={() => setComposeStep("choice")}
|
|
16270
|
+
>
|
|
16271
|
+
<i class="ph-thin ph-arrow-left" aria-hidden="true" />
|
|
16272
|
+
</button>
|
|
16273
|
+
<div>
|
|
16274
|
+
<h3 class="msg-thread__name">Care team</h3>
|
|
16275
|
+
<p class="msg-thread__role">Goes to your care team</p>
|
|
16276
|
+
</div>
|
|
16277
|
+
</div>
|
|
16278
|
+
|
|
16279
|
+
<div class="msg-choice__notice">
|
|
16280
|
+
<p class="msg-choice__notice-text">
|
|
16281
|
+
Your care team will reach out after reviewing your case. If you have a question about
|
|
16282
|
+
your account or order in the meantime, send it to support.
|
|
16283
|
+
</p>
|
|
16284
|
+
<button
|
|
16285
|
+
type="button"
|
|
16286
|
+
class="portal-btn portal-btn--primary"
|
|
16287
|
+
data-testid="care-team-notice-switch"
|
|
16288
|
+
onClick={() => setComposeStep("support")}
|
|
16289
|
+
>
|
|
16290
|
+
Message support instead
|
|
16291
|
+
</button>
|
|
16292
|
+
</div>
|
|
16293
|
+
</div>;
|
|
16073
16294
|
const Thread = () => <>
|
|
16074
16295
|
<div class="msg-thread__header">
|
|
16075
16296
|
<button
|
|
@@ -16082,7 +16303,12 @@ function MessagesPanel(props) {
|
|
|
16082
16303
|
<i class="ph-thin ph-arrow-left" aria-hidden="true" />
|
|
16083
16304
|
</button>
|
|
16084
16305
|
<div>
|
|
16085
|
-
<
|
|
16306
|
+
<div class="msg-thread__title-row">
|
|
16307
|
+
<h3 class="msg-thread__name">{selectedConvo()?.participantName ?? "Provider"}</h3>
|
|
16308
|
+
<Show51 when={selectedConvo()}>
|
|
16309
|
+
{(convo) => <ChannelChip source={convo().source} category={convo().category} />}
|
|
16310
|
+
</Show51>
|
|
16311
|
+
</div>
|
|
16086
16312
|
<p class="msg-thread__role">{selectedConvo()?.participantRole ?? "Prescriber"}</p>
|
|
16087
16313
|
</div>
|
|
16088
16314
|
{
|
|
@@ -16150,6 +16376,7 @@ function MessagesPanel(props) {
|
|
|
16150
16376
|
</label>
|
|
16151
16377
|
</Show51>
|
|
16152
16378
|
<textarea
|
|
16379
|
+
ref={composerRef}
|
|
16153
16380
|
class="msg-compose__input"
|
|
16154
16381
|
rows={1}
|
|
16155
16382
|
placeholder="Type a message…"
|
|
@@ -16176,7 +16403,20 @@ function MessagesPanel(props) {
|
|
|
16176
16403
|
</div>
|
|
16177
16404
|
<div class={`msg-panel__main${threadOpen() ? "" : " msg-panel__main--hidden-mobile"}`}>
|
|
16178
16405
|
<Show51 when={composing()}>
|
|
16179
|
-
<
|
|
16406
|
+
<Switch3>
|
|
16407
|
+
<Match3 when={composeStep() === "choice"}>
|
|
16408
|
+
<ChannelChoice />
|
|
16409
|
+
</Match3>
|
|
16410
|
+
<Match3 when={composeStep() === "care"}>
|
|
16411
|
+
<NewCareTeamThread />
|
|
16412
|
+
</Match3>
|
|
16413
|
+
<Match3 when={composeStep() === "care-notice"}>
|
|
16414
|
+
<CareTeamNotice />
|
|
16415
|
+
</Match3>
|
|
16416
|
+
<Match3 when={composeStep() === "support"}>
|
|
16417
|
+
<NewSupportThread />
|
|
16418
|
+
</Match3>
|
|
16419
|
+
</Switch3>
|
|
16180
16420
|
</Show51>
|
|
16181
16421
|
<Show51 when={!composing()}>
|
|
16182
16422
|
<Show51
|
|
@@ -16442,11 +16682,11 @@ function MemberPortal(props) {
|
|
|
16442
16682
|
</button>
|
|
16443
16683
|
</div>}
|
|
16444
16684
|
>
|
|
16445
|
-
<
|
|
16446
|
-
<
|
|
16685
|
+
<Switch4 fallback={<TrackerTab />}>
|
|
16686
|
+
<Match4 when={tab() === "instructions" && guide()}>
|
|
16447
16687
|
{(g) => <MedicationGuide guide={g()} currentDose={currentDose()} />}
|
|
16448
|
-
</
|
|
16449
|
-
<
|
|
16688
|
+
</Match4>
|
|
16689
|
+
<Match4 when={tab() === "plan"}>
|
|
16450
16690
|
<PlanBilling
|
|
16451
16691
|
subscriptions={data.subscriptions()}
|
|
16452
16692
|
brandName={props.brand.name}
|
|
@@ -16454,11 +16694,11 @@ function MemberPortal(props) {
|
|
|
16454
16694
|
intakeHref={props.routes.intake}
|
|
16455
16695
|
onChanged={() => data.refetch()}
|
|
16456
16696
|
/>
|
|
16457
|
-
</
|
|
16458
|
-
<
|
|
16697
|
+
</Match4>
|
|
16698
|
+
<Match4 when={tab() === "history" && props.surveyHistory}>
|
|
16459
16699
|
<SurveyHistory />
|
|
16460
|
-
</
|
|
16461
|
-
<
|
|
16700
|
+
</Match4>
|
|
16701
|
+
<Match4 when={tab() === "account"}>
|
|
16462
16702
|
<AccountPanel
|
|
16463
16703
|
member={data.member()}
|
|
16464
16704
|
legalLinks={props.legalLinks}
|
|
@@ -16466,11 +16706,11 @@ function MemberPortal(props) {
|
|
|
16466
16706
|
onOpenMessages={openMessages}
|
|
16467
16707
|
messagingEnabled={messagingEnabled()}
|
|
16468
16708
|
/>
|
|
16469
|
-
</
|
|
16470
|
-
<
|
|
16709
|
+
</Match4>
|
|
16710
|
+
<Match4 when={tab() === "messages"}>
|
|
16471
16711
|
<MessagesPanel thread={messages} />
|
|
16472
|
-
</
|
|
16473
|
-
</
|
|
16712
|
+
</Match4>
|
|
16713
|
+
</Switch4>
|
|
16474
16714
|
</Show53>
|
|
16475
16715
|
</Show53>;
|
|
16476
16716
|
return <main
|
|
@@ -16542,7 +16782,7 @@ function MemberPortal(props) {
|
|
|
16542
16782
|
}
|
|
16543
16783
|
|
|
16544
16784
|
// src/pages/AffiliatePortal.tsx
|
|
16545
|
-
import { createEffect as createEffect12, createSignal as createSignal37, Match as
|
|
16785
|
+
import { createEffect as createEffect12, createSignal as createSignal37, Match as Match5, Show as Show59, Switch as Switch5, For as For43 } from "solid-js";
|
|
16546
16786
|
|
|
16547
16787
|
// src/pages/affiliate/Overview.tsx
|
|
16548
16788
|
import { Show as Show54, For as For39 } from "solid-js";
|
|
@@ -17228,23 +17468,23 @@ function AffiliatePortal(props) {
|
|
|
17228
17468
|
</aside>
|
|
17229
17469
|
|
|
17230
17470
|
<div class="app-affiliate-content">
|
|
17231
|
-
<
|
|
17232
|
-
<
|
|
17471
|
+
<Switch5 fallback={<AffiliateOverview />}>
|
|
17472
|
+
<Match5 when={currentTab() === "overview"}>
|
|
17233
17473
|
<AffiliateOverview />
|
|
17234
|
-
</
|
|
17235
|
-
<
|
|
17474
|
+
</Match5>
|
|
17475
|
+
<Match5 when={currentTab() === "conversions"}>
|
|
17236
17476
|
<AffiliateConversions />
|
|
17237
|
-
</
|
|
17238
|
-
<
|
|
17477
|
+
</Match5>
|
|
17478
|
+
<Match5 when={currentTab() === "downline"}>
|
|
17239
17479
|
<AffiliateDownline />
|
|
17240
|
-
</
|
|
17241
|
-
<
|
|
17480
|
+
</Match5>
|
|
17481
|
+
<Match5 when={currentTab() === "referral"}>
|
|
17242
17482
|
<AffiliateReferralLink />
|
|
17243
|
-
</
|
|
17244
|
-
<
|
|
17483
|
+
</Match5>
|
|
17484
|
+
<Match5 when={currentTab() === "settings"}>
|
|
17245
17485
|
<AffiliateSettings />
|
|
17246
|
-
</
|
|
17247
|
-
</
|
|
17486
|
+
</Match5>
|
|
17487
|
+
</Switch5>
|
|
17248
17488
|
</div>
|
|
17249
17489
|
</div>
|
|
17250
17490
|
</Show59>;
|
|
@@ -18416,4 +18656,4 @@ export {
|
|
|
18416
18656
|
AffiliateForgotPassword,
|
|
18417
18657
|
AffiliateResetPassword
|
|
18418
18658
|
};
|
|
18419
|
-
//# sourceMappingURL=
|
|
18659
|
+
//# sourceMappingURL=IWWUVNBB.jsx.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getTokens } from './
|
|
1
|
+
import { getTokens } from './7AJQ5SVA.js';
|
|
2
2
|
import { getConfig } from './5XGPFYIJ.js';
|
|
3
3
|
|
|
4
4
|
// src/api/funnel.ts
|
|
@@ -138,5 +138,5 @@ function stripResumeToken() {
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
export { adoptFunnelSessionId, captureAuthHeader, fetchFunnelConfig, fetchResumedDraft, funnelSessionId, peekFunnelSessionId, postFunnelEvent, readResumeToken, resetFunnelConfigCache, saveFunnelDraft, stripResumeToken };
|
|
141
|
-
//# sourceMappingURL=
|
|
142
|
-
//# sourceMappingURL=
|
|
141
|
+
//# sourceMappingURL=LVGOEJHQ.js.map
|
|
142
|
+
//# sourceMappingURL=LVGOEJHQ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/funnel.ts"],"names":[],"mappings":";;;;AAmBA,IAAM,WAAyB,EAAE,SAAA,EAAW,OAAO,SAAA,EAAW,KAAA,EAAO,mBAAmB,KAAA,EAAM;AAE9F,IAAI,aAAA,GAA8C,IAAA;AAM3C,SAAS,iBAAA,GAA2C;AACzD,EAAA,IAAI,CAAC,aAAA,EAAe;AAClB,IAAA,aAAA,GAAA,CAAiB,YAAY;AAC3B,MAAA,IAAI;AACF,QAAA,MAAM,MAAM,SAAA,EAAU;AACtB,QAAA,MAAM,MAAM,MAAM,KAAA,CAAM,CAAA,EAAG,GAAA,CAAI,OAAO,CAAA,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A;AAC1D,IAAA,OAAO;AAAA,MACL,SAAA,EAAW,MAAA,CAAO,IAAA,CAAK,SAAA,IAAa,EAAE,CAAA;AAAA,MACtC,SAAS,IAAA,CAAK,OAAA;AAAA,MACd,SAAS,IAAA,CAAK,OAAA;AAAA,MACd,WAAW,OAAO,IAAA,CAAK,SAAA,KAAc,QAAA,GAAW,KAAK,SAAA,GAAY;AAAA,KACnE;AAAA,EACF,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAGO,SAAS,eAAA,GAAiC;AAC/C,EAAA,IAAI;AACF,IAAA,MAAM,KAAA,GAAQ,IAAI,eAAA,CAAgB,MAAA,CAAO,SAAS,MAAM,CAAA,CAAE,IAAI,QAAQ,CAAA;AACtE,IAAA,OAAO,KAAA,IAAS,KAAA,CAAM,MAAA,GAAS,CAAA,GAAI,KAAA,GAAQ,IAAA;AAAA,EAC7C,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAYO,SAAS,gBAAA,GAAyB;AACvC,EAAA,IAAI;AACF,IAAA,MAAM,GAAA,GAAM,IAAI,GAAA,CAAI,MAAA,CAAO,SAAS,IAAI,CAAA;AACxC,IAAA,IAAI,CAAC,GAAA,CAAI,YAAA,CAAa,GAAA,CAAI,QAAQ,CAAA,EAAG;AACrC,IAAA,GAAA,CAAI,YAAA,CAAa,OAAO,QAAQ,CAAA;AAChC,IAAA,MAAA,CAAO,QAAQ,YAAA,CAAa,IAAI,EAAA,EAAI,GAAA,CAAI,UAAU,CAAA;AAAA,EACpD,CAAA,CAAA,MAAQ;AAAA,EAER;AACF","file":"7ZESUC4Q.js","sourcesContent":["import { getConfig } from '../config';\nimport { getTokens } from './client';\n\n// ── Funnel telemetry transport ──────────────────────────────────────────────\n//\n// Thin client for the-backend's abandoned-funnel capture endpoints:\n// GET /config/funnel → which capture features this tenant enabled\n// POST /funnel/events → survey-session telemetry sink\n//\n// Everything here is fire-and-forget and fail-silent: funnel capture is\n// marketing instrumentation, and it must never break or slow the survey.\n\nexport interface FunnelConfig {\n telemetry: boolean;\n emailGate: boolean;\n /** When true (tenant features.funnelEmailGateRequired), the gate offers no skip. */\n emailGateRequired: boolean;\n}\n\nconst DISABLED: FunnelConfig = { telemetry: false, emailGate: false, emailGateRequired: false };\n\nlet configPromise: Promise<FunnelConfig> | null = null;\n\n/**\n * The tenant's funnel-capture posture, fetched once per page load and cached.\n * Fails closed: any error reads as \"both off\".\n */\nexport function fetchFunnelConfig(): Promise<FunnelConfig> {\n if (!configPromise) {\n configPromise = (async () => {\n try {\n const cfg = getConfig();\n const res = await fetch(`${cfg.apiBase}/config/funnel`, {\n headers: { 'X-Tenant-Key': cfg.tenantKey },\n });\n if (!res.ok) return DISABLED;\n const body = (await res.json()) as Partial<FunnelConfig>;\n return {\n telemetry: body.telemetry === true,\n emailGate: body.emailGate === true,\n emailGateRequired: body.emailGateRequired === true,\n };\n } catch {\n return DISABLED;\n }\n })();\n }\n return configPromise;\n}\n\n/**\n * Continue an existing funnel session (resume-from-email): the emailed link\n * identifies the session that already holds this person's email and reminder\n * history, so adopting its id keeps everything on one row instead of forking a\n * new one that looks like a brand-new visitor.\n */\nexport function adoptFunnelSessionId(id: string): void {\n if (!id) return;\n try {\n sessionStorage.setItem(sessionIdKey(), id);\n } catch {\n /* storage unavailable — the session stays ephemeral */\n }\n}\n\n/** Test seam: forget the cached config so the next fetch re-resolves. */\nexport function resetFunnelConfigCache(): void {\n configPromise = null;\n}\n\nconst sessionIdKey = () => `${getConfig().storagePrefix}-funnel-session`;\n\n/**\n * Stable id for this survey session, minted on first use and kept in\n * sessionStorage — a refresh continues the same session (matching the survey\n * draft's resume behavior); a new tab or browser session starts a new one.\n */\nexport function funnelSessionId(): string {\n let id: string | null = null;\n try {\n id = sessionStorage.getItem(sessionIdKey());\n } catch {\n /* storage unavailable (private mode) — fall through to ephemeral id */\n }\n if (!id) {\n id =\n typeof crypto !== 'undefined' && 'randomUUID' in crypto\n ? crypto.randomUUID()\n : `${Date.now()}-${Math.random().toString(36).slice(2)}`;\n try {\n sessionStorage.setItem(sessionIdKey(), id);\n } catch {\n /* ephemeral it is */\n }\n }\n return id;\n}\n\n/**\n * The current survey session id, or null — WITHOUT minting one.\n *\n * `funnelSessionId()` creates an id on first read, which is right for the\n * survey (asking means a survey is starting) and wrong for anything else. Cart\n * capture uses this to say \"if this shopper also has a survey session, here it\n * is\" — letting the backend borrow the email the gate already collected —\n * without conjuring survey sessions on a storefront that never runs one.\n */\nexport function peekFunnelSessionId(): string | null {\n try {\n return sessionStorage.getItem(sessionIdKey());\n } catch {\n return null;\n }\n}\n\n/**\n * The member's access token, when this browser has one.\n *\n * Read raw and never refreshed: these are fire-and-forget telemetry posts, and\n * a token refresh is a real network round-trip on the unload path. An expired\n * token is not a failure either — the sinks take it with `optionalAuth`, so a\n * stale one simply reads as an anonymous visitor, which is what we had before.\n */\nexport function captureAuthHeader(): Record<string, string> {\n try {\n const token = getTokens()?.accessToken;\n return token ? { Authorization: `Bearer ${token}` } : {};\n } catch {\n return {};\n }\n}\n\n/**\n * Fire-and-forget event post. `keepalive` lets the request survive a page\n * unload — which is exactly when the `abandoned` event is sent. (This is why\n * it's `fetch` and not `navigator.sendBeacon`: beacons can't carry the\n * X-Tenant-Key header the tenant-scoped mount requires — nor the bearer token\n * below.)\n *\n * The token identifies a signed-in member to the sink. Without it a member's\n * session is stored anonymously, and the pre-survey email gate — the only\n * other writer of a session's identity — is deliberately never shown to\n * someone already signed in, so their drop-off could never be attributed to\n * them. That is the whole population of a site where the account is created\n * before the questionnaire (savings-program signups, returning members\n * starting a second intake).\n */\nexport function postFunnelEvent(type: string, data?: Record<string, unknown>): void {\n try {\n const cfg = getConfig();\n void fetch(`${cfg.apiBase}/funnel/events`, {\n method: 'POST',\n keepalive: true,\n headers: {\n 'Content-Type': 'application/json',\n 'X-Tenant-Key': cfg.tenantKey,\n ...captureAuthHeader(),\n },\n body: JSON.stringify({ sessionId: funnelSessionId(), type, data }),\n }).catch(() => {});\n } catch {\n /* not configured yet — drop */\n }\n}\n\n// ── Survey drafts (cross-device resume) ─────────────────────────────────────\n\nexport interface FunnelDraftPayload {\n answers: Array<{ questionId: string; value: unknown }>;\n stepIndex: number;\n}\n\n/**\n * Save in-progress answers to Apex (through the-backend's embed proxy) and\n * return the draft id, so the next save updates the same row.\n *\n * Answers travel to the CLINICAL system — the partner backend stores only the\n * returned pointer. Returns null on any failure: a draft is best-effort, and\n * losing one costs a retype, never correctness.\n */\nexport async function saveFunnelDraft(\n draft: FunnelDraftPayload & { draftId?: string; drugIds?: string[]; templateId?: string; mode?: string },\n): Promise<string | null> {\n try {\n const cfg = getConfig();\n if (!cfg.apexEmbedApiBase) return null;\n const res = await fetch(`${cfg.apexEmbedApiBase}/v2/embed/surveys/drafts`, {\n method: 'PUT',\n headers: { 'Content-Type': 'application/json', 'X-Tenant-Key': cfg.tenantKey },\n body: JSON.stringify(draft),\n });\n if (!res.ok) return null;\n const body = (await res.json()) as { draftId?: string };\n return body.draftId ?? null;\n } catch {\n return null;\n }\n}\n\nexport interface ResumedDraft extends FunnelDraftPayload {\n sessionId: string;\n draftId: string;\n}\n\n/**\n * Exchange an emailed resume token for the saved answers.\n *\n * The token is the ONLY thing authorizing this read — the-backend verifies its\n * HMAC before fetching from Apex with credentials the browser never sees. A\n * 404 (expired, already submitted, tampered) resolves to null so the caller\n * simply starts a fresh survey.\n */\nexport async function fetchResumedDraft(token: string): Promise<ResumedDraft | null> {\n try {\n const cfg = getConfig();\n const res = await fetch(`${cfg.apiBase}/funnel/resume?token=${encodeURIComponent(token)}`, {\n headers: { 'X-Tenant-Key': cfg.tenantKey },\n });\n if (!res.ok) return null;\n const body = (await res.json()) as Partial<ResumedDraft>;\n if (!body.draftId || !Array.isArray(body.answers)) return null;\n return {\n sessionId: String(body.sessionId ?? ''),\n draftId: body.draftId,\n answers: body.answers,\n stepIndex: typeof body.stepIndex === 'number' ? body.stepIndex : 0,\n };\n } catch {\n return null;\n }\n}\n\n/** Read the `?resume=` token from the current URL. */\nexport function readResumeToken(): string | null {\n try {\n const token = new URLSearchParams(window.location.search).get('resume');\n return token && token.length > 0 ? token : null;\n } catch {\n return null;\n }\n}\n\n/**\n * Drop `?resume=` from the address bar once it has been redeemed.\n *\n * This token authorizes a read of someone's clinical answers, so leaving it in\n * the address bar is worse than leaving the cart's there: it gets bookmarked,\n * pasted into a support chat, or captured by whatever the patient's browser\n * syncs. The answers are mirrored into local storage on redemption, so a\n * refresh resumes from this device without it. History is replaced, not\n * pushed — the token was never a page.\n */\nexport function stripResumeToken(): void {\n try {\n const url = new URL(window.location.href);\n if (!url.searchParams.has('resume')) return;\n url.searchParams.delete('resume');\n window.history.replaceState({}, '', url.toString());\n } catch {\n /* no history API — leaving the param is harmless */\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/api/funnel.ts"],"names":[],"mappings":";;;;AAmBA,IAAM,WAAyB,EAAE,SAAA,EAAW,OAAO,SAAA,EAAW,KAAA,EAAO,mBAAmB,KAAA,EAAM;AAE9F,IAAI,aAAA,GAA8C,IAAA;AAM3C,SAAS,iBAAA,GAA2C;AACzD,EAAA,IAAI,CAAC,aAAA,EAAe;AAClB,IAAA,aAAA,GAAA,CAAiB,YAAY;AAC3B,MAAA,IAAI;AACF,QAAA,MAAM,MAAM,SAAA,EAAU;AACtB,QAAA,MAAM,MAAM,MAAM,KAAA,CAAM,CAAA,EAAG,GAAA,CAAI,OAAO,CAAA,cAAA,CAAA,EAAkB;AAAA,UACtD,OAAA,EAAS,EAAE,cAAA,EAAgB,GAAA,CAAI,SAAA;AAAU,SAC1C,CAAA;AACD,QAAA,IAAI,CAAC,GAAA,CAAI,EAAA,EAAI,OAAO,QAAA;AACpB,QAAA,MAAM,IAAA,GAAQ,MAAM,GAAA,CAAI,IAAA,EAAK;AAC7B,QAAA,OAAO;AAAA,UACL,SAAA,EAAW,KAAK,SAAA,KAAc,IAAA;AAAA,UAC9B,SAAA,EAAW,K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ACT;AACF;AAGO,SAAS,eAAA,GAAiC;AAC/C,EAAA,IAAI;AACF,IAAA,MAAM,KAAA,GAAQ,IAAI,eAAA,CAAgB,MAAA,CAAO,SAAS,MAAM,CAAA,CAAE,IAAI,QAAQ,CAAA;AACtE,IAAA,OAAO,KAAA,IAAS,KAAA,CAAM,MAAA,GAAS,CAAA,GAAI,KAAA,GAAQ,IAAA;AAAA,EAC7C,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAYO,SAAS,gBAAA,GAAyB;AACvC,EAAA,IAAI;AACF,IAAA,MAAM,GAAA,GAAM,IAAI,GAAA,CAAI,MAAA,CAAO,SAAS,IAAI,CAAA;AACxC,IAAA,IAAI,CAAC,GAAA,CAAI,YAAA,CAAa,GAAA,CAAI,QAAQ,CAAA,EAAG;AACrC,IAAA,GAAA,CAAI,YAAA,CAAa,OAAO,QAAQ,CAAA;AAChC,IAAA,MAAA,CAAO,QAAQ,YAAA,CAAa,IAAI,EAAA,EAAI,GAAA,CAAI,UAAU,CAAA;AAAA,EACpD,CAAA,CAAA,MAAQ;AAAA,EAER;AACF","file":"LVGOEJHQ.js","sourcesContent":["import { getConfig } from '../config';\nimport { getTokens } from './client';\n\n// ── Funnel telemetry transport ──────────────────────────────────────────────\n//\n// Thin client for the-backend's abandoned-funnel capture endpoints:\n// GET /config/funnel → which capture features this tenant enabled\n// POST /funnel/events → survey-session telemetry sink\n//\n// Everything here is fire-and-forget and fail-silent: funnel capture is\n// marketing instrumentation, and it must never break or slow the survey.\n\nexport interface FunnelConfig {\n telemetry: boolean;\n emailGate: boolean;\n /** When true (tenant features.funnelEmailGateRequired), the gate offers no skip. */\n emailGateRequired: boolean;\n}\n\nconst DISABLED: FunnelConfig = { telemetry: false, emailGate: false, emailGateRequired: false };\n\nlet configPromise: Promise<FunnelConfig> | null = null;\n\n/**\n * The tenant's funnel-capture posture, fetched once per page load and cached.\n * Fails closed: any error reads as \"both off\".\n */\nexport function fetchFunnelConfig(): Promise<FunnelConfig> {\n if (!configPromise) {\n configPromise = (async () => {\n try {\n const cfg = getConfig();\n const res = await fetch(`${cfg.apiBase}/config/funnel`, {\n headers: { 'X-Tenant-Key': cfg.tenantKey },\n });\n if (!res.ok) return DISABLED;\n const body = (await res.json()) as Partial<FunnelConfig>;\n return {\n telemetry: body.telemetry === true,\n emailGate: body.emailGate === true,\n emailGateRequired: body.emailGateRequired === true,\n };\n } catch {\n return DISABLED;\n }\n })();\n }\n return configPromise;\n}\n\n/**\n * Continue an existing funnel session (resume-from-email): the emailed link\n * identifies the session that already holds this person's email and reminder\n * history, so adopting its id keeps everything on one row instead of forking a\n * new one that looks like a brand-new visitor.\n */\nexport function adoptFunnelSessionId(id: string): void {\n if (!id) return;\n try {\n sessionStorage.setItem(sessionIdKey(), id);\n } catch {\n /* storage unavailable — the session stays ephemeral */\n }\n}\n\n/** Test seam: forget the cached config so the next fetch re-resolves. */\nexport function resetFunnelConfigCache(): void {\n configPromise = null;\n}\n\nconst sessionIdKey = () => `${getConfig().storagePrefix}-funnel-session`;\n\n/**\n * Stable id for this survey session, minted on first use and kept in\n * sessionStorage — a refresh continues the same session (matching the survey\n * draft's resume behavior); a new tab or browser session starts a new one.\n */\nexport function funnelSessionId(): string {\n let id: string | null = null;\n try {\n id = sessionStorage.getItem(sessionIdKey());\n } catch {\n /* storage unavailable (private mode) — fall through to ephemeral id */\n }\n if (!id) {\n id =\n typeof crypto !== 'undefined' && 'randomUUID' in crypto\n ? crypto.randomUUID()\n : `${Date.now()}-${Math.random().toString(36).slice(2)}`;\n try {\n sessionStorage.setItem(sessionIdKey(), id);\n } catch {\n /* ephemeral it is */\n }\n }\n return id;\n}\n\n/**\n * The current survey session id, or null — WITHOUT minting one.\n *\n * `funnelSessionId()` creates an id on first read, which is right for the\n * survey (asking means a survey is starting) and wrong for anything else. Cart\n * capture uses this to say \"if this shopper also has a survey session, here it\n * is\" — letting the backend borrow the email the gate already collected —\n * without conjuring survey sessions on a storefront that never runs one.\n */\nexport function peekFunnelSessionId(): string | null {\n try {\n return sessionStorage.getItem(sessionIdKey());\n } catch {\n return null;\n }\n}\n\n/**\n * The member's access token, when this browser has one.\n *\n * Read raw and never refreshed: these are fire-and-forget telemetry posts, and\n * a token refresh is a real network round-trip on the unload path. An expired\n * token is not a failure either — the sinks take it with `optionalAuth`, so a\n * stale one simply reads as an anonymous visitor, which is what we had before.\n */\nexport function captureAuthHeader(): Record<string, string> {\n try {\n const token = getTokens()?.accessToken;\n return token ? { Authorization: `Bearer ${token}` } : {};\n } catch {\n return {};\n }\n}\n\n/**\n * Fire-and-forget event post. `keepalive` lets the request survive a page\n * unload — which is exactly when the `abandoned` event is sent. (This is why\n * it's `fetch` and not `navigator.sendBeacon`: beacons can't carry the\n * X-Tenant-Key header the tenant-scoped mount requires — nor the bearer token\n * below.)\n *\n * The token identifies a signed-in member to the sink. Without it a member's\n * session is stored anonymously, and the pre-survey email gate — the only\n * other writer of a session's identity — is deliberately never shown to\n * someone already signed in, so their drop-off could never be attributed to\n * them. That is the whole population of a site where the account is created\n * before the questionnaire (savings-program signups, returning members\n * starting a second intake).\n */\nexport function postFunnelEvent(type: string, data?: Record<string, unknown>): void {\n try {\n const cfg = getConfig();\n void fetch(`${cfg.apiBase}/funnel/events`, {\n method: 'POST',\n keepalive: true,\n headers: {\n 'Content-Type': 'application/json',\n 'X-Tenant-Key': cfg.tenantKey,\n ...captureAuthHeader(),\n },\n body: JSON.stringify({ sessionId: funnelSessionId(), type, data }),\n }).catch(() => {});\n } catch {\n /* not configured yet — drop */\n }\n}\n\n// ── Survey drafts (cross-device resume) ─────────────────────────────────────\n\nexport interface FunnelDraftPayload {\n answers: Array<{ questionId: string; value: unknown }>;\n stepIndex: number;\n}\n\n/**\n * Save in-progress answers to Apex (through the-backend's embed proxy) and\n * return the draft id, so the next save updates the same row.\n *\n * Answers travel to the CLINICAL system — the partner backend stores only the\n * returned pointer. Returns null on any failure: a draft is best-effort, and\n * losing one costs a retype, never correctness.\n */\nexport async function saveFunnelDraft(\n draft: FunnelDraftPayload & { draftId?: string; drugIds?: string[]; templateId?: string; mode?: string },\n): Promise<string | null> {\n try {\n const cfg = getConfig();\n if (!cfg.apexEmbedApiBase) return null;\n const res = await fetch(`${cfg.apexEmbedApiBase}/v2/embed/surveys/drafts`, {\n method: 'PUT',\n headers: { 'Content-Type': 'application/json', 'X-Tenant-Key': cfg.tenantKey },\n body: JSON.stringify(draft),\n });\n if (!res.ok) return null;\n const body = (await res.json()) as { draftId?: string };\n return body.draftId ?? null;\n } catch {\n return null;\n }\n}\n\nexport interface ResumedDraft extends FunnelDraftPayload {\n sessionId: string;\n draftId: string;\n}\n\n/**\n * Exchange an emailed resume token for the saved answers.\n *\n * The token is the ONLY thing authorizing this read — the-backend verifies its\n * HMAC before fetching from Apex with credentials the browser never sees. A\n * 404 (expired, already submitted, tampered) resolves to null so the caller\n * simply starts a fresh survey.\n */\nexport async function fetchResumedDraft(token: string): Promise<ResumedDraft | null> {\n try {\n const cfg = getConfig();\n const res = await fetch(`${cfg.apiBase}/funnel/resume?token=${encodeURIComponent(token)}`, {\n headers: { 'X-Tenant-Key': cfg.tenantKey },\n });\n if (!res.ok) return null;\n const body = (await res.json()) as Partial<ResumedDraft>;\n if (!body.draftId || !Array.isArray(body.answers)) return null;\n return {\n sessionId: String(body.sessionId ?? ''),\n draftId: body.draftId,\n answers: body.answers,\n stepIndex: typeof body.stepIndex === 'number' ? body.stepIndex : 0,\n };\n } catch {\n return null;\n }\n}\n\n/** Read the `?resume=` token from the current URL. */\nexport function readResumeToken(): string | null {\n try {\n const token = new URLSearchParams(window.location.search).get('resume');\n return token && token.length > 0 ? token : null;\n } catch {\n return null;\n }\n}\n\n/**\n * Drop `?resume=` from the address bar once it has been redeemed.\n *\n * This token authorizes a read of someone's clinical answers, so leaving it in\n * the address bar is worse than leaving the cart's there: it gets bookmarked,\n * pasted into a support chat, or captured by whatever the patient's browser\n * syncs. The answers are mirrored into local storage on redemption, so a\n * refresh resumes from this device without it. History is replaced, not\n * pushed — the token was never a page.\n */\nexport function stripResumeToken(): void {\n try {\n const url = new URL(window.location.href);\n if (!url.searchParams.has('resume')) return;\n url.searchParams.delete('resume');\n window.history.replaceState({}, '', url.toString());\n } catch {\n /* no history API — leaving the param is harmless */\n }\n}\n"]}
|