@apextelemed/partner-core 0.23.0-dev.78 → 0.23.0-dev.81
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/dist/api/index.d.ts +1 -1
- package/dist/api/index.js +3 -3
- package/dist/api/index.jsx +3 -3
- package/dist/chunk/{AOU7JIZI.jsx → 2TGKQDQV.jsx} +2 -2
- package/dist/chunk/{XKMPKFQC.js → 74A4ERWQ.js} +3 -3
- package/dist/chunk/{XKMPKFQC.js.map → 74A4ERWQ.js.map} +1 -1
- package/dist/chunk/{4VJRXVJP.js → BXXGDTLE.js} +172 -281
- package/dist/chunk/BXXGDTLE.js.map +1 -0
- package/dist/chunk/{5OLQYZKT.jsx → GIJCNQCB.jsx} +2 -2
- package/dist/chunk/{6JUMUKSN.jsx → GWVFWHTO.jsx} +5 -6
- package/dist/chunk/{2M3CVZ2D.js → HHNXH573.js} +6 -6
- package/dist/chunk/{2M3CVZ2D.js.map → HHNXH573.js.map} +1 -1
- package/dist/chunk/{F7FXSXKR.jsx → IGIUMJ3F.jsx} +5 -5
- package/dist/chunk/{XFKYBR7X.js → K2TKMLIY.js} +3 -3
- package/dist/chunk/{XFKYBR7X.js.map → K2TKMLIY.js.map} +1 -1
- package/dist/chunk/{5L6VDC4W.jsx → PHN4IMRV.jsx} +41 -138
- package/dist/chunk/{5OMDD7HC.js → PK74TNA6.js} +3 -3
- package/dist/chunk/{5OMDD7HC.js.map → PK74TNA6.js.map} +1 -1
- package/dist/chunk/{Z7QE2PW6.jsx → PQUHVBZN.jsx} +4 -4
- package/dist/chunk/{XLJ7GEWD.js → UOD5EQ6T.js} +5 -5
- package/dist/chunk/{XLJ7GEWD.js.map → UOD5EQ6T.js.map} +1 -1
- package/dist/chunk/{DTXQYGIJ.js → Y74YTJXR.js} +6 -7
- package/dist/chunk/Y74YTJXR.js.map +1 -0
- package/dist/chunk/{UBUC63F3.jsx → Z33DIIG6.jsx} +2 -2
- package/dist/{client-C1pHvA6f.d.ts → client-BdY7wkDp.d.ts} +16 -16
- package/dist/flows/index.d.ts +1 -1
- 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 +1 -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/package.json +1 -1
- package/dist/chunk/4VJRXVJP.js.map +0 -1
- package/dist/chunk/DTXQYGIJ.js.map +0 -1
|
@@ -83,10 +83,10 @@ import {
|
|
|
83
83
|
useSurveyV2Flow,
|
|
84
84
|
useUpdatePaymentMethodFlow,
|
|
85
85
|
visibleWarnings
|
|
86
|
-
} from "./
|
|
86
|
+
} from "./PQUHVBZN.jsx";
|
|
87
87
|
import {
|
|
88
88
|
fetchFunnelConfig
|
|
89
|
-
} from "./
|
|
89
|
+
} from "./2TGKQDQV.jsx";
|
|
90
90
|
import {
|
|
91
91
|
usePrimitives
|
|
92
92
|
} from "./J63XPQP4.jsx";
|
|
@@ -94,7 +94,7 @@ import {
|
|
|
94
94
|
affiliateAuth_default,
|
|
95
95
|
auth_default,
|
|
96
96
|
cart_default
|
|
97
|
-
} from "./
|
|
97
|
+
} from "./Z33DIIG6.jsx";
|
|
98
98
|
import {
|
|
99
99
|
ADMIN_ROLES,
|
|
100
100
|
ApiError,
|
|
@@ -111,7 +111,7 @@ import {
|
|
|
111
111
|
offersApi,
|
|
112
112
|
subscriptionsApi,
|
|
113
113
|
usersApi
|
|
114
|
-
} from "./
|
|
114
|
+
} from "./GWVFWHTO.jsx";
|
|
115
115
|
|
|
116
116
|
// src/pages/Survey.tsx
|
|
117
117
|
import { Show, For, createEffect, on } from "solid-js";
|
|
@@ -13279,12 +13279,25 @@ function Dashboard(props) {
|
|
|
13279
13279
|
{ label: "Total Customers", value: s.totalCustomers.toLocaleString(), tint: "var(--app-admin-primary-soft-fg)", tab: "customers" },
|
|
13280
13280
|
// Subscriptions live inside the customer 360 now; the card drills into
|
|
13281
13281
|
// the customer list (which lands on the active-subscribers filter when
|
|
13282
|
-
// reached through the retired 'subscriptions' tab alias).
|
|
13282
|
+
// reached through the retired 'subscriptions' tab alias). Past due
|
|
13283
|
+
// counts: it hasn't ended, its card is being retried.
|
|
13283
13284
|
{ label: "Active Subscriptions", value: s.activeSubscriptions.toLocaleString(), tint: "var(--app-admin-success-fg)", tab: "customers" },
|
|
13285
|
+
// Who support should chase: opens the customer list on Past due.
|
|
13286
|
+
...s.pastDueCustomers !== void 0 ? [{
|
|
13287
|
+
label: "Past Due Customers",
|
|
13288
|
+
value: s.pastDueCustomers.toLocaleString(),
|
|
13289
|
+
tint: s.pastDueCustomers > 0 ? "var(--app-admin-danger-fg)" : "var(--app-admin-fg-muted)",
|
|
13290
|
+
tab: "customers",
|
|
13291
|
+
filter: "past_due"
|
|
13292
|
+
}] : [],
|
|
13284
13293
|
{ label: "Revenue (All Time)", value: centsToUsd(s.totalRevenueCents), tint: "var(--app-admin-info-fg)", tab: "payments" },
|
|
13285
13294
|
{ label: "Failed Payments (30d)", value: s.failedPayments30d.toLocaleString(), tint: "var(--app-admin-warning-fg)", tab: "payments" }
|
|
13286
13295
|
];
|
|
13287
13296
|
};
|
|
13297
|
+
const openCard = (card) => {
|
|
13298
|
+
if (card.filter && props.onOpenCustomers) props.onOpenCustomers(card.filter);
|
|
13299
|
+
else props.onSelectTab(card.tab);
|
|
13300
|
+
};
|
|
13288
13301
|
return <div>
|
|
13289
13302
|
<PageTitle>Dashboard</PageTitle>
|
|
13290
13303
|
<Show43 when={!stats.loading} fallback={<LoadingSpinner />}>
|
|
@@ -13303,7 +13316,7 @@ function Dashboard(props) {
|
|
|
13303
13316
|
return <Dynamic
|
|
13304
13317
|
component={clickable ? "button" : "div"}
|
|
13305
13318
|
type={clickable ? "button" : void 0}
|
|
13306
|
-
onClick={clickable ? () =>
|
|
13319
|
+
onClick={clickable ? () => openCard(card) : void 0}
|
|
13307
13320
|
title={clickable ? `View ${card.label}` : void 0}
|
|
13308
13321
|
class="app-admin-card"
|
|
13309
13322
|
style={{
|
|
@@ -13419,7 +13432,7 @@ function RecurringRevenue(props) {
|
|
|
13419
13432
|
</table>
|
|
13420
13433
|
</Show43>
|
|
13421
13434
|
<p style={{ margin: 0, padding: "0.75rem 1.25rem", "font-size": "0.75rem", color: "var(--app-admin-fg-subtle)" }}>
|
|
13422
|
-
Active, non-test subscriptions at what they're charged now, after discounts. Other billing cycles are converted to a 30-day month.
|
|
13435
|
+
Active and past-due, non-test subscriptions at what they're charged now, after discounts. Other billing cycles are converted to a 30-day month.
|
|
13423
13436
|
</p>
|
|
13424
13437
|
</Section>
|
|
13425
13438
|
</div>;
|
|
@@ -23492,58 +23505,6 @@ function SmsLogCard(props) {
|
|
|
23492
23505
|
|
|
23493
23506
|
// src/pages/admin/sms/SmsTemplatesCard.tsx
|
|
23494
23507
|
import { createResource as createResource30, createSignal as createSignal48, For as For53, Show as Show68 } from "solid-js";
|
|
23495
|
-
|
|
23496
|
-
// src/pages/admin/sms/smsSegments.ts
|
|
23497
|
-
var GSM_BASIC = `@\xA3$\xA5\xE8\xE9\xF9\xEC\xF2\xC7
|
|
23498
|
-
\xD8\xF8\r\xC5\xE5\u0394_\u03A6\u0393\u039B\u03A9\u03A0\u03A8\u03A3\u0398\u039E\xC6\xE6\xDF\xC9 !"#\xA4%&'()*+,-./0123456789:;<=>?\xA1ABCDEFGHIJKLMNOPQRSTUVWXYZ\xC4\xD6\xD1\xDC\xA7\xBFabcdefghijklmnopqrstuvwxyz\xE4\xF6\xF1\xFC\xE0`;
|
|
23499
|
-
var GSM_EXTENDED = "^{}\\[~]|\u20AC";
|
|
23500
|
-
var BASIC = new Set(GSM_BASIC);
|
|
23501
|
-
var EXTENDED = new Set(GSM_EXTENDED);
|
|
23502
|
-
var GSM7_SINGLE = 160;
|
|
23503
|
-
var GSM7_MULTI = 153;
|
|
23504
|
-
var UCS2_SINGLE = 70;
|
|
23505
|
-
var UCS2_MULTI = 67;
|
|
23506
|
-
function countSmsSegments(text) {
|
|
23507
|
-
let gsmUnits = 0;
|
|
23508
|
-
let gsm = true;
|
|
23509
|
-
for (const ch of text) {
|
|
23510
|
-
if (BASIC.has(ch)) gsmUnits += 1;
|
|
23511
|
-
else if (EXTENDED.has(ch)) gsmUnits += 2;
|
|
23512
|
-
else {
|
|
23513
|
-
gsm = false;
|
|
23514
|
-
break;
|
|
23515
|
-
}
|
|
23516
|
-
}
|
|
23517
|
-
if (gsm) {
|
|
23518
|
-
return {
|
|
23519
|
-
encoding: "GSM-7",
|
|
23520
|
-
units: gsmUnits,
|
|
23521
|
-
segments: gsmUnits === 0 ? 0 : gsmUnits <= GSM7_SINGLE ? 1 : Math.ceil(gsmUnits / GSM7_MULTI)
|
|
23522
|
-
};
|
|
23523
|
-
}
|
|
23524
|
-
const units = text.length;
|
|
23525
|
-
return {
|
|
23526
|
-
encoding: "UCS-2",
|
|
23527
|
-
units,
|
|
23528
|
-
segments: units <= UCS2_SINGLE ? 1 : Math.ceil(units / UCS2_MULTI)
|
|
23529
|
-
};
|
|
23530
|
-
}
|
|
23531
|
-
function segmentCapacity(info) {
|
|
23532
|
-
if (info.encoding === "GSM-7") return info.segments <= 1 ? GSM7_SINGLE : GSM7_MULTI * info.segments;
|
|
23533
|
-
return info.segments <= 1 ? UCS2_SINGLE : UCS2_MULTI * info.segments;
|
|
23534
|
-
}
|
|
23535
|
-
|
|
23536
|
-
// src/pages/admin/sms/smsTemplateDraft.ts
|
|
23537
|
-
function changeFor(saved, draft) {
|
|
23538
|
-
const change = {};
|
|
23539
|
-
if (draft.enabled !== saved.enabled) change.enabled = draft.enabled;
|
|
23540
|
-
if (draft.body !== saved.body) change.body = draft.body === saved.defaultBody ? null : draft.body;
|
|
23541
|
-
return Object.keys(change).length > 0 ? change : null;
|
|
23542
|
-
}
|
|
23543
|
-
var tokenText = (token) => `{{${token}}}`;
|
|
23544
|
-
|
|
23545
|
-
// src/pages/admin/sms/SmsTemplatesCard.tsx
|
|
23546
|
-
var MAX_BODY_LENGTH = 300;
|
|
23547
23508
|
function testMessage(res) {
|
|
23548
23509
|
switch (res.status) {
|
|
23549
23510
|
case "sent":
|
|
@@ -23558,41 +23519,23 @@ function testMessage(res) {
|
|
|
23558
23519
|
return { tone: "bad", text: `The test was not sent${res.reason ? `: ${res.reason}` : "."}` };
|
|
23559
23520
|
}
|
|
23560
23521
|
}
|
|
23561
|
-
function
|
|
23522
|
+
function TemplateRow(props) {
|
|
23562
23523
|
const saved = () => props.template;
|
|
23563
23524
|
const [enabled, setEnabled] = createSignal48(saved().enabled);
|
|
23564
|
-
const [body, setBody] = createSignal48(saved().body);
|
|
23565
23525
|
const [saving, setSaving] = createSignal48(false);
|
|
23566
23526
|
const [error, setError] = createSignal48(null);
|
|
23567
23527
|
const [testing, setTesting] = createSignal48(false);
|
|
23568
23528
|
const [test, setTest] = createSignal48(null);
|
|
23569
|
-
|
|
23570
|
-
const change = () => changeFor(saved(), { enabled: enabled(), body: body() });
|
|
23571
|
-
const dirty = () => change() !== null;
|
|
23572
|
-
const counts = () => countSmsSegments(body());
|
|
23573
|
-
const tooLong = () => body().length > MAX_BODY_LENGTH;
|
|
23574
|
-
const insertToken = (token) => {
|
|
23575
|
-
const text = tokenText(token);
|
|
23576
|
-
const start = area?.selectionStart ?? body().length;
|
|
23577
|
-
const end = area?.selectionEnd ?? start;
|
|
23578
|
-
setBody(body().slice(0, start) + text + body().slice(end));
|
|
23579
|
-
const caret = start + text.length;
|
|
23580
|
-
queueMicrotask(() => {
|
|
23581
|
-
area?.focus();
|
|
23582
|
-
area?.setSelectionRange(caret, caret);
|
|
23583
|
-
});
|
|
23584
|
-
};
|
|
23529
|
+
const dirty = () => enabled() !== saved().enabled;
|
|
23585
23530
|
const save = async () => {
|
|
23586
|
-
|
|
23587
|
-
if (!c || saving()) return;
|
|
23531
|
+
if (!dirty() || saving()) return;
|
|
23588
23532
|
setSaving(true);
|
|
23589
23533
|
setError(null);
|
|
23590
23534
|
try {
|
|
23591
|
-
const res = await adminApi.saveSmsTemplates({ [saved().key]:
|
|
23535
|
+
const res = await adminApi.saveSmsTemplates({ [saved().key]: { enabled: enabled() } });
|
|
23592
23536
|
const next = res.templates.find((t) => t.key === saved().key);
|
|
23593
23537
|
if (next) {
|
|
23594
23538
|
setEnabled(next.enabled);
|
|
23595
|
-
setBody(next.body);
|
|
23596
23539
|
props.onSaved(next);
|
|
23597
23540
|
}
|
|
23598
23541
|
toastSuccess(`${saved().label} text saved`);
|
|
@@ -23629,50 +23572,9 @@ function TemplateEditor(props) {
|
|
|
23629
23572
|
</label>
|
|
23630
23573
|
</div>
|
|
23631
23574
|
|
|
23632
|
-
<
|
|
23633
|
-
|
|
23634
|
-
class="app-admin-input"
|
|
23635
|
-
rows={3}
|
|
23636
|
-
aria-label={`${saved().label} text`}
|
|
23637
|
-
value={body()}
|
|
23638
|
-
onInput={(e) => setBody(e.currentTarget.value)}
|
|
23639
|
-
/>
|
|
23640
|
-
|
|
23641
|
-
<div style={{ display: "flex", "flex-wrap": "wrap", "justify-content": "space-between", gap: "0.5rem 1rem", ...muted3 }}>
|
|
23642
|
-
<span data-testid="sms-counter" style={tooLong() ? { color: "var(--app-admin-danger-fg)" } : void 0}>
|
|
23643
|
-
{body().length}/{MAX_BODY_LENGTH} characters · {counts().encoding} · {counts().units}/{segmentCapacity(counts())} ·{" "}
|
|
23644
|
-
{counts().segments} {counts().segments === 1 ? "segment" : "segments"}
|
|
23645
|
-
</span>
|
|
23646
|
-
<span>Must start with {tokenText("siteName")}.</span>
|
|
23575
|
+
<div data-testid="sms-preview" style={muted3}>
|
|
23576
|
+
Preview: <span style={{ color: "var(--app-admin-fg)" }}>{saved().preview}</span>
|
|
23647
23577
|
</div>
|
|
23648
|
-
<Show68 when={counts().encoding === "UCS-2" && body().length > 0}>
|
|
23649
|
-
<div class="app-admin-notice" role="note">
|
|
23650
|
-
This text has a character outside the basic SMS alphabet (a curly quote, an emoji or an accented letter), so it
|
|
23651
|
-
is sent in a form that fits only 70 characters per segment instead of 160.
|
|
23652
|
-
</div>
|
|
23653
|
-
</Show68>
|
|
23654
|
-
|
|
23655
|
-
<Show68 when={saved().tokens.length > 0}>
|
|
23656
|
-
<div style={{ display: "flex", "flex-wrap": "wrap", "align-items": "center", gap: "0.375rem" }}>
|
|
23657
|
-
<span style={muted3}>Insert:</span>
|
|
23658
|
-
<For53 each={saved().tokens}>
|
|
23659
|
-
{(token) => <button
|
|
23660
|
-
type="button"
|
|
23661
|
-
class="app-admin-btn app-admin-btn-sm"
|
|
23662
|
-
aria-label={`Insert ${tokenText(token)}`}
|
|
23663
|
-
onClick={() => insertToken(token)}
|
|
23664
|
-
>
|
|
23665
|
-
{tokenText(token)}
|
|
23666
|
-
</button>}
|
|
23667
|
-
</For53>
|
|
23668
|
-
</div>
|
|
23669
|
-
</Show68>
|
|
23670
|
-
|
|
23671
|
-
<Show68 when={!dirty() && saved().preview}>
|
|
23672
|
-
<div style={muted3}>
|
|
23673
|
-
Preview: <span style={{ color: "var(--app-admin-fg)" }}>{saved().preview}</span>
|
|
23674
|
-
</div>
|
|
23675
|
-
</Show68>
|
|
23676
23578
|
|
|
23677
23579
|
<Show68 when={error()}>
|
|
23678
23580
|
<div class="app-admin-notice" role="alert">{error()}</div>
|
|
@@ -23682,20 +23584,12 @@ function TemplateEditor(props) {
|
|
|
23682
23584
|
<button type="button" class="app-admin-btn app-admin-btn-primary app-admin-btn-sm" disabled={!dirty() || saving()} onClick={() => void save()}>
|
|
23683
23585
|
{saving() ? "Saving\u2026" : "Save"}
|
|
23684
23586
|
</button>
|
|
23685
|
-
<button
|
|
23686
|
-
type="button"
|
|
23687
|
-
class="app-admin-btn app-admin-btn-sm"
|
|
23688
|
-
disabled={body() === saved().defaultBody || saving()}
|
|
23689
|
-
onClick={() => setBody(saved().defaultBody)}
|
|
23690
|
-
>
|
|
23691
|
-
Reset to default
|
|
23692
|
-
</button>
|
|
23693
23587
|
<button type="button" class="app-admin-btn app-admin-btn-sm" disabled={testing()} onClick={() => void sendTest()}>
|
|
23694
23588
|
{testing() ? "Sending\u2026" : "Send test to my phone"}
|
|
23695
23589
|
</button>
|
|
23696
23590
|
</div>
|
|
23697
23591
|
<Show68 when={dirty()}>
|
|
23698
|
-
<div style={muted3}>The test
|
|
23592
|
+
<div style={muted3}>The test follows the saved setting. Save your change first.</div>
|
|
23699
23593
|
</Show68>
|
|
23700
23594
|
<Show68 when={test()}>
|
|
23701
23595
|
{(t) => <div
|
|
@@ -23718,7 +23612,7 @@ function SmsTemplatesCard(props) {
|
|
|
23718
23612
|
const replace = (next) => mutate({ templates: templates().map((t) => t.key === next.key ? next : t) });
|
|
23719
23613
|
return <SmsCard
|
|
23720
23614
|
title="What the texts say"
|
|
23721
|
-
note="
|
|
23615
|
+
note="The wording of each text is fixed. You can switch each one on or off."
|
|
23722
23616
|
>
|
|
23723
23617
|
<Show68 when={data.error}>
|
|
23724
23618
|
<div class="app-admin-notice" role="alert">
|
|
@@ -23728,7 +23622,7 @@ function SmsTemplatesCard(props) {
|
|
|
23728
23622
|
<Show68 when={!data.error && data.loading}>
|
|
23729
23623
|
<LoadingSpinner />
|
|
23730
23624
|
</Show68>
|
|
23731
|
-
<For53 each={templates()}>{(t) => <
|
|
23625
|
+
<For53 each={templates()}>{(t) => <TemplateRow template={t} onSaved={replace} />}</For53>
|
|
23732
23626
|
</SmsCard>;
|
|
23733
23627
|
}
|
|
23734
23628
|
|
|
@@ -24125,17 +24019,25 @@ function AdminDashboard(props) {
|
|
|
24125
24019
|
});
|
|
24126
24020
|
});
|
|
24127
24021
|
const [pendingCustomerUid, setPendingCustomerUid] = createSignal51(null);
|
|
24022
|
+
const [pendingCustomerFilter, setPendingCustomerFilter] = createSignal51(null);
|
|
24128
24023
|
const [pendingThreadId, setPendingThreadId] = createSignal51(null);
|
|
24129
24024
|
const [pendingTemplateId, setPendingTemplateId] = createSignal51(null);
|
|
24130
24025
|
const handleTabClick = (tab, opts) => {
|
|
24131
24026
|
if (!opts?.keepPending) {
|
|
24132
24027
|
setPendingCustomerUid(null);
|
|
24028
|
+
setPendingCustomerFilter(null);
|
|
24133
24029
|
setPendingThreadId(null);
|
|
24134
24030
|
}
|
|
24135
24031
|
setInternalTab(tab);
|
|
24136
24032
|
setDrawerOpen(false);
|
|
24137
24033
|
props.onTabChange?.(tab);
|
|
24138
24034
|
};
|
|
24035
|
+
const openCustomersFiltered = (filter) => {
|
|
24036
|
+
props.customers?.onSelectCustomer?.(null);
|
|
24037
|
+
setPendingCustomerUid(null);
|
|
24038
|
+
setPendingCustomerFilter(filter);
|
|
24039
|
+
handleTabClick("customers", { keepPending: true });
|
|
24040
|
+
};
|
|
24139
24041
|
const adminNav = {
|
|
24140
24042
|
selectTab: (tab) => handleTabClick(tab),
|
|
24141
24043
|
isTabEnabled,
|
|
@@ -24274,9 +24176,9 @@ function AdminDashboard(props) {
|
|
|
24274
24176
|
when={adminMe() === void 0 || roleAllows(currentTab())}
|
|
24275
24177
|
fallback={<RoleForbidden />}
|
|
24276
24178
|
>
|
|
24277
|
-
<Switch5 fallback={<Dashboard onSelectTab={handleTabClick} isTabEnabled={isTabEnabled} />}>
|
|
24179
|
+
<Switch5 fallback={<Dashboard onSelectTab={handleTabClick} isTabEnabled={isTabEnabled} onOpenCustomers={openCustomersFiltered} />}>
|
|
24278
24180
|
<Match5 when={currentTab() === "dashboard"}>
|
|
24279
|
-
<Dashboard onSelectTab={handleTabClick} isTabEnabled={isTabEnabled} />
|
|
24181
|
+
<Dashboard onSelectTab={handleTabClick} isTabEnabled={isTabEnabled} onOpenCustomers={openCustomersFiltered} />
|
|
24280
24182
|
</Match5>
|
|
24281
24183
|
<Match5 when={currentTab() === "customers"}>
|
|
24282
24184
|
<Customers
|
|
@@ -24284,6 +24186,7 @@ function AdminDashboard(props) {
|
|
|
24284
24186
|
activeUid={props.customers?.activeUid}
|
|
24285
24187
|
onSelectCustomer={props.customers?.onSelectCustomer}
|
|
24286
24188
|
initialUid={pendingCustomerUid()}
|
|
24189
|
+
initialFilter={pendingCustomerFilter()}
|
|
24287
24190
|
/>
|
|
24288
24191
|
</Match5>
|
|
24289
24192
|
<Match5 when={currentTab() === "payments"}>
|
|
@@ -29114,4 +29017,4 @@ export {
|
|
|
29114
29017
|
AffiliateForgotPassword,
|
|
29115
29018
|
AffiliateResetPassword
|
|
29116
29019
|
};
|
|
29117
|
-
//# sourceMappingURL=
|
|
29020
|
+
//# sourceMappingURL=PHN4IMRV.jsx.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getTokens } from './
|
|
1
|
+
import { getTokens } from './Y74YTJXR.js';
|
|
2
2
|
import { getConfig } from './2IFPDU4D.js';
|
|
3
3
|
|
|
4
4
|
// src/api/funnel.ts
|
|
@@ -174,5 +174,5 @@ function resetSmsConfigCache() {
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
export { adoptFunnelSessionId, captureAuthHeader, fetchFunnelConfig, fetchResumedDraft, fetchSmsConfig, funnelSessionId, peekFunnelSessionId, postFunnelEvent, readResumeToken, resetFunnelConfigCache, resetSmsConfigCache, saveFunnelDraft, stripResumeToken };
|
|
177
|
-
//# sourceMappingURL=
|
|
178
|
-
//# sourceMappingURL=
|
|
177
|
+
//# sourceMappingURL=PK74TNA6.js.map
|
|
178
|
+
//# sourceMappingURL=PK74TNA6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/funnel.ts","../../src/api/sms.ts"],"names":["DISABLED","configPromise"],"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,CAA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BAAA,GAA4B;AAC1C,EAAAA,cAAAA,GAAgB,IAAA;AAClB","file":"5OMDD7HC.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","import { getConfig } from '../config';\n\n// ── Customer text-message config ────────────────────────────────────────────\n//\n// Thin client for the-backend's tenant-level SMS posture:\n// GET /config/sms → whether this tenant texts customers at all, and the exact\n// consent wording (and its version) to show beside the box\n//\n// Sibling of ./cart and ./funnel, and the same posture: unauthenticated, cached\n// once per page load, fail-closed. Unlike those two it gates something a person\n// is asked to AGREE to, so \"any doubt\" reads as \"off\" — a consent box with no\n// wording to show must never render.\n\nexport interface SmsConfig {\n /** Tenant texts customers (feature on, number registered, switched on). false = show nothing. */\n enabled: boolean;\n /** The sender the consent wording names, e.g. \"Acme Health\". */\n brandName?: string;\n /** The consent wording, verbatim. Never reword it: what the person saw is what the record holds. */\n consentText?: string;\n /** Identifies `consentText`; sent back with a grant so the server knows which words were shown. */\n consentTextVersion?: string;\n termsUrl?: string;\n privacyUrl?: string;\n}\n\nconst DISABLED: SmsConfig = { enabled: false };\n\nconst str = (v: unknown): string | undefined => (typeof v === 'string' && v.trim() ? v : undefined);\n\nlet configPromise: Promise<SmsConfig> | null = null;\n\n/**\n * The tenant's text-message posture, fetched once per page load and cached.\n * Fails closed: any error — and an \"enabled\" reply that arrives without the\n * wording or its version — reads as \"off\".\n */\nexport function fetchSmsConfig(): Promise<SmsConfig> {\n if (!configPromise) {\n configPromise = (async () => {\n try {\n const cfg = getConfig();\n const res = await fetch(`${cfg.apiBase}/config/sms`, {\n headers: { 'X-Tenant-Key': cfg.tenantKey },\n });\n if (!res.ok) return DISABLED;\n const body = (await res.json()) as Partial<Record<keyof SmsConfig, unknown>>;\n const consentText = str(body.consentText);\n const consentTextVersion = str(body.consentTextVersion);\n if (body.enabled !== true || !consentText || !consentTextVersion) return DISABLED;\n return {\n enabled: true,\n brandName: str(body.brandName),\n consentText,\n consentTextVersion,\n termsUrl: str(body.termsUrl),\n privacyUrl: str(body.privacyUrl),\n };\n } catch {\n return DISABLED;\n }\n })();\n }\n return configPromise;\n}\n\n/** Test seam: forget the cached config so the next fetch re-resolves. */\nexport function resetSmsConfigCache(): void {\n configPromise = null;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/api/funnel.ts","../../src/api/sms.ts"],"names":["DISABLED","configPromise"],"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,OA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IAAA;AAOxC,SAAS,cAAA,GAAqC;AACnD,EAAA,IAAI,CAACA,cAAAA,EAAe;AAClB,IAAAA,kBAAiB,YAAY;AAC3B,MAAA,IAAI;AACF,QAAA,MAAM,MAAM,SAAA,EAAU;AACtB,QAAA,MAAM,MAAM,MAAM,KAAA,CAAM,CAAA,EAAG,GAAA,CAAI,OAAO,CAAA,WAAA,CAAA,EAAe;AAAA,UACnD,OAAA,EAAS,EAAE,cAAA,EAAgB,GAAA,CAAI,SAAA;AAAU,SAC1C,CAAA;AACD,QAAA,IAAI,CAAC,GAAA,CAAI,EAAA,EAAI,OAAOD,SAAAA;AACpB,QAAA,MAAM,IAAA,GAAQ,MAAM,GAAA,CAAI,IAAA,EAAK;AAC7B,QAAA,MAAM,WAAA,GAAc,GAAA,CAAI,IAAA,CAAK,WAAW,CAAA;AACxC,QAAA,MAAM,kBAAA,GAAqB,GAAA,CAAI,IAAA,CAAK,kBAAkB,CAAA;AACtD,QAAA,IAAI,KAAK,OAAA,KAAY,IAAA,IAAQ,CAAC,WAAA,IAAe,CAAC,oBAAoB,OAAOA,SAAAA;AACzE,QAAA,OAAO;AAAA,UACL,OAAA,EAAS,IAAA;AAAA,UACT,SAAA,EAAW,GAAA,CAAI,IAAA,CAAK,SAAS,CAAA;AAAA,UAC7B,WAAA;AAAA,UACA,kBAAA;AAAA,UACA,QAAA,EAAU,GAAA,CAAI,IAAA,CAAK,QAAQ,CAAA;AAAA,UAC3B,UAAA,EAAY,GAAA,CAAI,IAAA,CAAK,UAAU;AAAA,SACjC;AAAA,MACF,CAAA,CAAA,MAAQ;AACN,QAAA,OAAOA,SAAAA;AAAA,MACT;AAAA,IACF,CAAA,GAAG;AAAA,EACL;AACA,EAAA,OAAOC,cAAAA;AACT;AAGO,SAAS,mBAAA,GAA4B;AAC1C,EAAAA,cAAAA,GAAgB,IAAA;AAClB","file":"PK74TNA6.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","import { getConfig } from '../config';\n\n// ── Customer text-message config ────────────────────────────────────────────\n//\n// Thin client for the-backend's tenant-level SMS posture:\n// GET /config/sms → whether this tenant texts customers at all, and the exact\n// consent wording (and its version) to show beside the box\n//\n// Sibling of ./cart and ./funnel, and the same posture: unauthenticated, cached\n// once per page load, fail-closed. Unlike those two it gates something a person\n// is asked to AGREE to, so \"any doubt\" reads as \"off\" — a consent box with no\n// wording to show must never render.\n\nexport interface SmsConfig {\n /** Tenant texts customers (feature on, number registered, switched on). false = show nothing. */\n enabled: boolean;\n /** The sender the consent wording names, e.g. \"Acme Health\". */\n brandName?: string;\n /** The consent wording, verbatim. Never reword it: what the person saw is what the record holds. */\n consentText?: string;\n /** Identifies `consentText`; sent back with a grant so the server knows which words were shown. */\n consentTextVersion?: string;\n termsUrl?: string;\n privacyUrl?: string;\n}\n\nconst DISABLED: SmsConfig = { enabled: false };\n\nconst str = (v: unknown): string | undefined => (typeof v === 'string' && v.trim() ? v : undefined);\n\nlet configPromise: Promise<SmsConfig> | null = null;\n\n/**\n * The tenant's text-message posture, fetched once per page load and cached.\n * Fails closed: any error — and an \"enabled\" reply that arrives without the\n * wording or its version — reads as \"off\".\n */\nexport function fetchSmsConfig(): Promise<SmsConfig> {\n if (!configPromise) {\n configPromise = (async () => {\n try {\n const cfg = getConfig();\n const res = await fetch(`${cfg.apiBase}/config/sms`, {\n headers: { 'X-Tenant-Key': cfg.tenantKey },\n });\n if (!res.ok) return DISABLED;\n const body = (await res.json()) as Partial<Record<keyof SmsConfig, unknown>>;\n const consentText = str(body.consentText);\n const consentTextVersion = str(body.consentTextVersion);\n if (body.enabled !== true || !consentText || !consentTextVersion) return DISABLED;\n return {\n enabled: true,\n brandName: str(body.brandName),\n consentText,\n consentTextVersion,\n termsUrl: str(body.termsUrl),\n privacyUrl: str(body.privacyUrl),\n };\n } catch {\n return DISABLED;\n }\n })();\n }\n return configPromise;\n}\n\n/** Test seam: forget the cached config so the next fetch re-resolves. */\nexport function resetSmsConfigCache(): void {\n configPromise = null;\n}\n"]}
|
|
@@ -8,13 +8,13 @@ import {
|
|
|
8
8
|
resetSmsConfigCache,
|
|
9
9
|
saveFunnelDraft,
|
|
10
10
|
stripResumeToken
|
|
11
|
-
} from "./
|
|
11
|
+
} from "./2TGKQDQV.jsx";
|
|
12
12
|
import {
|
|
13
13
|
affiliateAuth_default,
|
|
14
14
|
auth_default,
|
|
15
15
|
cart_default,
|
|
16
16
|
medication_default
|
|
17
|
-
} from "./
|
|
17
|
+
} from "./Z33DIIG6.jsx";
|
|
18
18
|
import {
|
|
19
19
|
ApiError,
|
|
20
20
|
addressesApi,
|
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
subscriptionsApi,
|
|
36
36
|
supportApi,
|
|
37
37
|
usersApi
|
|
38
|
-
} from "./
|
|
38
|
+
} from "./GWVFWHTO.jsx";
|
|
39
39
|
import {
|
|
40
40
|
getConfig
|
|
41
41
|
} from "./QVZ7BRNO.jsx";
|
|
@@ -6807,4 +6807,4 @@ export {
|
|
|
6807
6807
|
useAddPharmacy,
|
|
6808
6808
|
useSmsPreferences
|
|
6809
6809
|
};
|
|
6810
|
-
//# sourceMappingURL=
|
|
6810
|
+
//# sourceMappingURL=PQUHVBZN.jsx.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { fetchSmsConfig, fetchFunnelConfig, postFunnelEvent, readResumeToken, fetchResumedDraft, stripResumeToken, adoptFunnelSessionId, saveFunnelDraft, resetSmsConfigCache } from './
|
|
2
|
-
import { cart_default, medication_default, auth_default, affiliateAuth_default } from './
|
|
3
|
-
import { newIdempotencyKey, apexApi, usersApi, addressesApi, catalogApi, paymentsApi, subscriptionsApi, membersApi, supportApi, productsApi, affiliatePortalApi, adminApi, adminCatalogApi, adminProductPharmaciesApi, ApiError, ordersApi, adminCatalogConversionApi, messagesApi, authApi } from './
|
|
1
|
+
import { fetchSmsConfig, fetchFunnelConfig, postFunnelEvent, readResumeToken, fetchResumedDraft, stripResumeToken, adoptFunnelSessionId, saveFunnelDraft, resetSmsConfigCache } from './PK74TNA6.js';
|
|
2
|
+
import { cart_default, medication_default, auth_default, affiliateAuth_default } from './74A4ERWQ.js';
|
|
3
|
+
import { newIdempotencyKey, apexApi, usersApi, addressesApi, catalogApi, paymentsApi, subscriptionsApi, membersApi, supportApi, productsApi, affiliatePortalApi, adminApi, adminCatalogApi, adminProductPharmaciesApi, ApiError, ordersApi, adminCatalogConversionApi, messagesApi, authApi } from './Y74YTJXR.js';
|
|
4
4
|
import { getConfig } from './2IFPDU4D.js';
|
|
5
5
|
import { createSignal, onMount, createEffect, on, onCleanup, createResource, createMemo } from 'solid-js';
|
|
6
6
|
import { useSurveyV2Flow as useSurveyV2Flow$1 } from '@apextelemed/survey-solid';
|
|
@@ -6557,5 +6557,5 @@ function useSmsPreferences() {
|
|
|
6557
6557
|
}
|
|
6558
6558
|
|
|
6559
6559
|
export { ACCOUNT_SOURCE_LABEL, DEFAULT_COLOR_PALETTE, LIFECYCLE_BUCKETS, LIFECYCLE_LABEL, LIFECYCLE_TONE, LIVE_SUBSCRIPTION_STATUSES, MATCH_DEPENDENT_WARNINGS, MATCH_HOW_LABEL, ORPHAN_REASON, PHONE_ERROR, READINESS_LABEL, SOURCE_FIELD_NOTE, SUPPORT_CATEGORIES, TERMINAL_SUBSCRIPTION_STATUSES, US_STATES, US_STATE_OPTIONS, accountSource, addCatalogItemAsProduct, applyPriceDrafts, availableStateOptions, availableStates, bestOfferDiscount, buildFulfillmentRows, buildMatrixView, buildRefillView, buildSaveBody, buildStrengthRows, buildTimeline, buildTrackerView, buildTrackingUrl, canLeaveUnmatched, canOfferConversion, captureFunnelEmail, catalogUnavailableMessage, categoryColor, categoryLabel, classifyAddPharmacyError, classifyCatalogError, classifyConversionError, compareStrengths, createCatalogProduct, createFunnelTelemetry, deriveAttention, deriveCatalogAvailabilityDecision, deriveJourney, describeConversion, emailGateAnswered, explainFinding, findStoredDosePrice, firstAddressError, flaggedSubscribers, fmtDay, formatCalendarDate, formatCardNumber, formatConversationTime, formatCvv, formatEventDate, formatExpiry, formatMessageTime, formatRelativeTime, formatStageDate, formatUsPhone, groupDrugsByPharmacy, hasBlockers, hasConversion, hasErrors, hasStateRestrictions, initialMatches, intakeEvidence, invalidDraftKeys, isCatalogItemId, isCssColorValue, isImageAttachment, isLive, isQuestionVisible, isReconcilable, isValidUsPhone, lifecycleReason, liveDoses, lowestPrice, lowestSalePrice, markEmailGateAnswered, matchKey, matchProblem, matchesComplete, missingPrices, moveInOrder, needsReview, normalizeState, normalizeStates, offerBeatsPromo, offerDurationText, offerSummaryText, orphanKey, parseMoney, pharmacyIsOnProduct, pharmacyLabel, primarySubscription, readinessStatus, reconcileCartAgainstCatalog, reconcileCartLines, redeemResumeLink, removeStoredDosePrice, resetResumeRedemption, resolveCategoryColor, resolveStrengthPrices, resolveSurveyV2DrugIntent, salePriceForBase, skuBindingModeFor, sourceKey, sourceLabel, stateAvailabilityNote, strengthsChanged, subscribeToSupportTopic, toChoices, toTrackerRequest, uploadPrescriptionPhoto, upsertDosePrice, useAddPharmacy, useAddressPair, useAffiliateConversions, useAffiliateDownline, useAffiliateLinks, useAffiliateStats, useCardTokenizer, useCartCheckoutFlow, useCartReconcile, useCatalog, useCatalogAvailability, useCatalogConversion, useCheckoutFlow, useDashboardData, useMedicationSelect, useMemberPortalData, useMessagesThread, useProductCatalogEditor, useProductDetail, useRegisterFlow, useSignupFlow, useSmsConsent, useSmsPreferences, useSubscribeFlow, useSurveyFlow, useSurveyV2Flow, useUpdatePaymentMethodFlow, validateAddress, visibleWarnings };
|
|
6560
|
-
//# sourceMappingURL=
|
|
6561
|
-
//# sourceMappingURL=
|
|
6560
|
+
//# sourceMappingURL=UOD5EQ6T.js.map
|
|
6561
|
+
//# sourceMappingURL=UOD5EQ6T.js.map
|