@apextelemed/partner-core 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/{QAFLR3EN.jsx → 33QXG46Z.jsx} +2 -2
- package/dist/chunk/{HKXDH266.js → 35C2PAUI.js} +14 -7
- package/dist/chunk/{HKXDH266.js.map → 35C2PAUI.js.map} +1 -1
- package/dist/chunk/{HEQMD3X4.js → 65LD7XAZ.js} +3 -3
- package/dist/chunk/{HEQMD3X4.js.map → 65LD7XAZ.js.map} +1 -1
- package/dist/chunk/{RUA3XYFO.js → 75B7QHIN.js} +23 -6
- package/dist/chunk/75B7QHIN.js.map +1 -0
- package/dist/chunk/{ZOZBYBNI.js → AJR7CBZ3.js} +3 -3
- package/dist/chunk/{ZOZBYBNI.js.map → AJR7CBZ3.js.map} +1 -1
- package/dist/chunk/{6UXFHBE2.jsx → C7RXQWXM.jsx} +5 -5
- package/dist/chunk/{2OOCTPLG.jsx → DEDIHIWD.jsx} +2 -2
- package/dist/chunk/{GNPMRN6O.jsx → IYLVDYRI.jsx} +1504 -789
- package/dist/chunk/{EHKYRS2R.js → JOX6EJMB.js} +6 -6
- package/dist/chunk/{EHKYRS2R.js.map → JOX6EJMB.js.map} +1 -1
- package/dist/chunk/{HYLIHVIE.js → MCSS436N.js} +1592 -590
- package/dist/chunk/MCSS436N.js.map +1 -0
- package/dist/chunk/{GL3OY7W5.jsx → MUEGVUP2.jsx} +2 -2
- package/dist/chunk/{JF2KCOOX.jsx → NTYUIUQO.jsx} +22 -5
- package/dist/chunk/{AW6DQGQR.jsx → VKSLQCMA.jsx} +13 -5
- package/dist/chunk/{4HOG2LES.js → Y2VD7NYA.js} +3 -3
- package/dist/chunk/{4HOG2LES.js.map → Y2VD7NYA.js.map} +1 -1
- package/dist/{client-ZnA3JEbd.d.ts → client-RY9ghN5Q.d.ts} +53 -5
- package/dist/flows/index.d.ts +1 -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 +2 -2
- 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/admin.css +262 -0
- package/package.json +4 -1
- package/dist/chunk/HYLIHVIE.js.map +0 -1
- package/dist/chunk/RUA3XYFO.js.map +0 -1
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
formatMessageTime,
|
|
29
29
|
formatStageDate,
|
|
30
30
|
hasStateRestrictions,
|
|
31
|
+
intakeEvidence,
|
|
31
32
|
isCssColorValue,
|
|
32
33
|
isImageAttachment,
|
|
33
34
|
lifecycleReason,
|
|
@@ -54,10 +55,10 @@ import {
|
|
|
54
55
|
useSurveyFlow,
|
|
55
56
|
useSurveyV2Flow,
|
|
56
57
|
useUpdatePaymentMethodFlow
|
|
57
|
-
} from "./
|
|
58
|
+
} from "./VKSLQCMA.jsx";
|
|
58
59
|
import {
|
|
59
60
|
fetchFunnelConfig
|
|
60
|
-
} from "./
|
|
61
|
+
} from "./33QXG46Z.jsx";
|
|
61
62
|
import {
|
|
62
63
|
usePrimitives
|
|
63
64
|
} from "./J63XPQP4.jsx";
|
|
@@ -65,7 +66,7 @@ import {
|
|
|
65
66
|
affiliateAuth_default,
|
|
66
67
|
auth_default,
|
|
67
68
|
cart_default
|
|
68
|
-
} from "./
|
|
69
|
+
} from "./MUEGVUP2.jsx";
|
|
69
70
|
import {
|
|
70
71
|
ApiError,
|
|
71
72
|
SUPPORT_ATTACHMENT_MAX_BYTES,
|
|
@@ -79,7 +80,7 @@ import {
|
|
|
79
80
|
membersApi,
|
|
80
81
|
subscriptionsApi,
|
|
81
82
|
usersApi
|
|
82
|
-
} from "./
|
|
83
|
+
} from "./NTYUIUQO.jsx";
|
|
83
84
|
|
|
84
85
|
// src/pages/Survey.tsx
|
|
85
86
|
import { Show, For, createEffect, on } from "solid-js";
|
|
@@ -271,7 +272,7 @@ function SurveyContent(props) {
|
|
|
271
272
|
</>;
|
|
272
273
|
}
|
|
273
274
|
function SurveyForm(props) {
|
|
274
|
-
const { Heading, Banner, Button, Card:
|
|
275
|
+
const { Heading, Banner, Button, Card: Card3 } = usePrimitives();
|
|
275
276
|
const flow = props.flow;
|
|
276
277
|
const progressPct = () => (flow.currentStep() + 1) / flow.totalSteps() * 100;
|
|
277
278
|
return <div>
|
|
@@ -321,7 +322,7 @@ function SurveyForm(props) {
|
|
|
321
322
|
</div>
|
|
322
323
|
</div>
|
|
323
324
|
|
|
324
|
-
<
|
|
325
|
+
<Card3 variant="primary" padding="lg">
|
|
325
326
|
<Show when={flow.step()?.stepTitle}>
|
|
326
327
|
<Heading level={2}>{flow.step().stepTitle}</Heading>
|
|
327
328
|
</Show>
|
|
@@ -363,7 +364,7 @@ function SurveyForm(props) {
|
|
|
363
364
|
{flow.submitting() ? "Processing\u2026" : flow.isLastStep() ? "Submit Questionnaire" : "Continue"}
|
|
364
365
|
</Button>
|
|
365
366
|
</div>
|
|
366
|
-
</
|
|
367
|
+
</Card3>
|
|
367
368
|
</div>;
|
|
368
369
|
}
|
|
369
370
|
function QuestionField(props) {
|
|
@@ -574,9 +575,9 @@ function QuestionField(props) {
|
|
|
574
575
|
</div>;
|
|
575
576
|
}
|
|
576
577
|
function DrugOption(props) {
|
|
577
|
-
const { Card:
|
|
578
|
+
const { Card: Card3 } = usePrimitives();
|
|
578
579
|
return <div style={{ "margin-bottom": "0.75rem" }} onClick={() => props.onSelect()}>
|
|
579
|
-
<
|
|
580
|
+
<Card3 variant={props.selected ? "primary" : "inset"} padding="md">
|
|
580
581
|
<div style={{ display: "flex", "align-items": "center", gap: "0.75rem", cursor: "pointer" }}>
|
|
581
582
|
<input
|
|
582
583
|
type="radio"
|
|
@@ -607,7 +608,7 @@ function DrugOption(props) {
|
|
|
607
608
|
</Show>
|
|
608
609
|
</div>
|
|
609
610
|
</div>
|
|
610
|
-
</
|
|
611
|
+
</Card3>
|
|
611
612
|
</div>;
|
|
612
613
|
}
|
|
613
614
|
|
|
@@ -838,9 +839,9 @@ var DROP_REASON_TEXT = {
|
|
|
838
839
|
not_prescribable: "not available by prescription"
|
|
839
840
|
};
|
|
840
841
|
function CartLinesDroppedPanel(props) {
|
|
841
|
-
const { Heading, Button, Card:
|
|
842
|
+
const { Heading, Button, Card: Card3 } = usePrimitives();
|
|
842
843
|
return <div style={{ "max-width": "32rem", margin: "3rem auto" }}>
|
|
843
|
-
<
|
|
844
|
+
<Card3>
|
|
844
845
|
<Heading level={2}>
|
|
845
846
|
{props.dropped.length === 1 ? "One item is no longer available" : `${props.dropped.length} items are no longer available`}
|
|
846
847
|
</Heading>
|
|
@@ -871,11 +872,11 @@ function CartLinesDroppedPanel(props) {
|
|
|
871
872
|
Continue
|
|
872
873
|
</Button>
|
|
873
874
|
</Show3>
|
|
874
|
-
</
|
|
875
|
+
</Card3>
|
|
875
876
|
</div>;
|
|
876
877
|
}
|
|
877
878
|
function EmailGateView(props) {
|
|
878
|
-
const { Heading, Button, Card:
|
|
879
|
+
const { Heading, Button, Card: Card3, TextField } = usePrimitives();
|
|
879
880
|
const [email, setEmail] = createSignal("");
|
|
880
881
|
const [error, setError] = createSignal(null);
|
|
881
882
|
const submit = () => {
|
|
@@ -893,7 +894,7 @@ function EmailGateView(props) {
|
|
|
893
894
|
props.onDone();
|
|
894
895
|
};
|
|
895
896
|
return <div style={{ "max-width": "28rem", margin: "3rem auto", padding: "0 1rem" }}>
|
|
896
|
-
<
|
|
897
|
+
<Card3>
|
|
897
898
|
<div style={{ padding: "1.5rem", "text-align": "center" }}>
|
|
898
899
|
<Heading level={2}>Save your progress</Heading>
|
|
899
900
|
<p style={{ margin: "0.75rem 0 1.25rem", opacity: 0.7 }}>
|
|
@@ -937,7 +938,7 @@ function EmailGateView(props) {
|
|
|
937
938
|
</button>
|
|
938
939
|
</Show3>
|
|
939
940
|
</div>
|
|
940
|
-
</
|
|
941
|
+
</Card3>
|
|
941
942
|
</div>;
|
|
942
943
|
}
|
|
943
944
|
function profileToPatientInfo(profile) {
|
|
@@ -1242,7 +1243,7 @@ function SurveyV2Content(props) {
|
|
|
1242
1243
|
</>;
|
|
1243
1244
|
}
|
|
1244
1245
|
function QuestionsView(props) {
|
|
1245
|
-
const { Heading, Banner, Button, Card:
|
|
1246
|
+
const { Heading, Banner, Button, Card: Card3 } = usePrimitives();
|
|
1246
1247
|
const flow = props.flow;
|
|
1247
1248
|
const totalForProgress = () => flow.totalSteps() + 1;
|
|
1248
1249
|
const progressPct = () => (flow.stepIndex() + 1) / Math.max(1, totalForProgress()) * 100;
|
|
@@ -1388,7 +1389,7 @@ function QuestionsView(props) {
|
|
|
1388
1389
|
</div>
|
|
1389
1390
|
</div>
|
|
1390
1391
|
|
|
1391
|
-
<
|
|
1392
|
+
<Card3 variant="primary" padding="lg">
|
|
1392
1393
|
<Show3 when={flow.currentStep()?.stepTitle}>
|
|
1393
1394
|
<Heading level={2}>{flow.currentStep().stepTitle}</Heading>
|
|
1394
1395
|
</Show3>
|
|
@@ -1529,11 +1530,11 @@ function QuestionsView(props) {
|
|
|
1529
1530
|
{flow.submitting() ? "Processing\u2026" : isLast() ? "Continue" : "Next"}
|
|
1530
1531
|
</Button>
|
|
1531
1532
|
</div>
|
|
1532
|
-
</
|
|
1533
|
+
</Card3>
|
|
1533
1534
|
</div>;
|
|
1534
1535
|
}
|
|
1535
1536
|
function PatientInfoView(props) {
|
|
1536
|
-
const { Heading, Banner, Button, Card:
|
|
1537
|
+
const { Heading, Banner, Button, Card: Card3, TextField, Select } = usePrimitives();
|
|
1537
1538
|
const flow = props.flow;
|
|
1538
1539
|
const pi = () => flow.patientInfo();
|
|
1539
1540
|
const set = (patch) => flow.setPatientInfo(patch);
|
|
@@ -1548,7 +1549,7 @@ function PatientInfoView(props) {
|
|
|
1548
1549
|
</p>
|
|
1549
1550
|
</div>
|
|
1550
1551
|
|
|
1551
|
-
<
|
|
1552
|
+
<Card3 variant="primary" padding="lg">
|
|
1552
1553
|
<Show3 when={flow.validationError()}>
|
|
1553
1554
|
<div style={{ "margin-bottom": "1rem" }}>
|
|
1554
1555
|
<Banner variant="error">{flow.validationError()}</Banner>
|
|
@@ -1664,7 +1665,7 @@ function PatientInfoView(props) {
|
|
|
1664
1665
|
Submit
|
|
1665
1666
|
</Button>
|
|
1666
1667
|
</div>
|
|
1667
|
-
</
|
|
1668
|
+
</Card3>
|
|
1668
1669
|
</div>;
|
|
1669
1670
|
}
|
|
1670
1671
|
function DrugResultsList(props) {
|
|
@@ -2566,7 +2567,7 @@ function CompletedScreen(props) {
|
|
|
2566
2567
|
</div>;
|
|
2567
2568
|
}
|
|
2568
2569
|
function PurchaseForm(props) {
|
|
2569
|
-
const { Heading, Banner, Button, Card:
|
|
2570
|
+
const { Heading, Banner, Button, Card: Card3, TextField, StatusPill } = usePrimitives();
|
|
2570
2571
|
const flow = props.flow;
|
|
2571
2572
|
const rx = () => props.prescription;
|
|
2572
2573
|
const fmt = (cents) => `$${(cents / 100).toFixed(2)}`;
|
|
@@ -2591,7 +2592,7 @@ function PurchaseForm(props) {
|
|
|
2591
2592
|
/* Medication / pricing summary */
|
|
2592
2593
|
}
|
|
2593
2594
|
<div style={{ "margin-bottom": "1.5rem" }}>
|
|
2594
|
-
<
|
|
2595
|
+
<Card3 variant="primary" padding="md">
|
|
2595
2596
|
<div style={{ display: "flex", "align-items": "center", gap: "0.5rem", "margin-bottom": "0.75rem" }}>
|
|
2596
2597
|
<StatusPill status={isApproved() ? "approved" : "pending"} />
|
|
2597
2598
|
</div>
|
|
@@ -2636,13 +2637,13 @@ function PurchaseForm(props) {
|
|
|
2636
2637
|
Promo {flow.pricing().promoCode} applied — −{fmt(flow.pricing().promoDiscountCents)}
|
|
2637
2638
|
</p>
|
|
2638
2639
|
</Show5>
|
|
2639
|
-
</
|
|
2640
|
+
</Card3>
|
|
2640
2641
|
</div>
|
|
2641
2642
|
|
|
2642
2643
|
{
|
|
2643
2644
|
/* Payment card */
|
|
2644
2645
|
}
|
|
2645
|
-
<
|
|
2646
|
+
<Card3 variant="primary" padding="lg">
|
|
2646
2647
|
<Show5 when={flow.paymentError()}>
|
|
2647
2648
|
<div
|
|
2648
2649
|
ref={errorRef}
|
|
@@ -2687,7 +2688,7 @@ function PurchaseForm(props) {
|
|
|
2687
2688
|
|
|
2688
2689
|
<Show5 when={flow.hasPaymentMethod()}>
|
|
2689
2690
|
<div style={{ "margin-bottom": "1.5rem" }}>
|
|
2690
|
-
<
|
|
2691
|
+
<Card3 variant="inset" padding="md">
|
|
2691
2692
|
<div style={{ display: "flex", "align-items": "center", gap: "0.75rem" }}>
|
|
2692
2693
|
<div
|
|
2693
2694
|
style={{
|
|
@@ -2712,7 +2713,7 @@ function PurchaseForm(props) {
|
|
|
2712
2713
|
<p style={{ "font-size": "0.75rem", opacity: 0.7 }}>From your subscription</p>
|
|
2713
2714
|
</div>
|
|
2714
2715
|
</div>
|
|
2715
|
-
</
|
|
2716
|
+
</Card3>
|
|
2716
2717
|
</div>
|
|
2717
2718
|
</Show5>
|
|
2718
2719
|
|
|
@@ -2819,7 +2820,7 @@ function PurchaseForm(props) {
|
|
|
2819
2820
|
{flow.hasPaymentMethod() ? "Your card on file will be charged securely." : "Your payment is processed securely."}{" "}
|
|
2820
2821
|
Medication will be shipped directly from our licensed pharmacy.
|
|
2821
2822
|
</p>
|
|
2822
|
-
</
|
|
2823
|
+
</Card3>
|
|
2823
2824
|
</div>;
|
|
2824
2825
|
}
|
|
2825
2826
|
function SummaryRow(props) {
|
|
@@ -2909,7 +2910,7 @@ function CartCheckoutContent(props) {
|
|
|
2909
2910
|
</>;
|
|
2910
2911
|
}
|
|
2911
2912
|
function PurchaseForm2(props) {
|
|
2912
|
-
const { Heading, Banner, Button, Card:
|
|
2913
|
+
const { Heading, Banner, Button, Card: Card3, TextField } = usePrimitives();
|
|
2913
2914
|
const flow = props.flow;
|
|
2914
2915
|
const pricing = flow.pricing;
|
|
2915
2916
|
const availability = flow.availability;
|
|
@@ -2921,7 +2922,7 @@ function PurchaseForm2(props) {
|
|
|
2921
2922
|
</p>
|
|
2922
2923
|
</div>
|
|
2923
2924
|
|
|
2924
|
-
<
|
|
2925
|
+
<Card3 variant="primary" padding="lg">
|
|
2925
2926
|
<div style={{ display: "flex", "flex-direction": "column", gap: "1.5rem" }}>
|
|
2926
2927
|
{
|
|
2927
2928
|
/* Order summary */
|
|
@@ -3078,7 +3079,7 @@ function PurchaseForm2(props) {
|
|
|
3078
3079
|
{flow.processing() ? "Processing\u2026" : availability.blocking() ? "Unavailable in Your State" : !flow.canSubmit() ? "Loading\u2026" : `Pay ${formatUsd(pricing().estimatedTotalCents)}`}
|
|
3079
3080
|
</Button>
|
|
3080
3081
|
</div>
|
|
3081
|
-
</
|
|
3082
|
+
</Card3>
|
|
3082
3083
|
</div>;
|
|
3083
3084
|
}
|
|
3084
3085
|
|
|
@@ -3118,7 +3119,7 @@ function SignupPage(props) {
|
|
|
3118
3119
|
);
|
|
3119
3120
|
}
|
|
3120
3121
|
function SignupContent(props) {
|
|
3121
|
-
const { Heading, Banner, Button, Card:
|
|
3122
|
+
const { Heading, Banner, Button, Card: Card3, StepIndicator } = usePrimitives();
|
|
3122
3123
|
const flow = props.flow;
|
|
3123
3124
|
const stepLabels = ["Account", "Address", "Payment", "Confirm"];
|
|
3124
3125
|
return <div>
|
|
@@ -3131,7 +3132,7 @@ function SignupContent(props) {
|
|
|
3131
3132
|
<StepIndicator current={flow.step()} total={4} labels={stepLabels} />
|
|
3132
3133
|
</div>
|
|
3133
3134
|
|
|
3134
|
-
<
|
|
3135
|
+
<Card3 variant="primary" padding="lg">
|
|
3135
3136
|
<Show7 when={flow.error()}>
|
|
3136
3137
|
<div style={{ "margin-bottom": "1.5rem" }}>
|
|
3137
3138
|
<Banner variant="error">{flow.error()}</Banner>
|
|
@@ -3198,7 +3199,7 @@ function SignupContent(props) {
|
|
|
3198
3199
|
</Button>
|
|
3199
3200
|
</Show7>
|
|
3200
3201
|
</div>
|
|
3201
|
-
</
|
|
3202
|
+
</Card3>
|
|
3202
3203
|
|
|
3203
3204
|
<div style={{ "text-align": "center", "margin-top": "1.5rem", "font-size": "0.875rem", opacity: 0.7 }}>
|
|
3204
3205
|
Already have an account?{" "}
|
|
@@ -3321,14 +3322,14 @@ function AddressStep(props) {
|
|
|
3321
3322
|
</div>;
|
|
3322
3323
|
}
|
|
3323
3324
|
function PaymentStep(props) {
|
|
3324
|
-
const { Heading, TextField, Card:
|
|
3325
|
+
const { Heading, TextField, Card: Card3 } = usePrimitives();
|
|
3325
3326
|
const flow = props.flow;
|
|
3326
3327
|
return <div style={{ display: "flex", "flex-direction": "column", gap: "1rem" }}>
|
|
3327
3328
|
<Heading level={2}>Payment Information</Heading>
|
|
3328
3329
|
|
|
3329
3330
|
<Show7 when={props.paymentBanner}>{props.paymentBanner()}</Show7>
|
|
3330
3331
|
|
|
3331
|
-
<
|
|
3332
|
+
<Card3 variant="inset" padding="md">
|
|
3332
3333
|
<div
|
|
3333
3334
|
style={{
|
|
3334
3335
|
display: "flex",
|
|
@@ -3341,7 +3342,7 @@ function PaymentStep(props) {
|
|
|
3341
3342
|
${props.membershipDollars}/{props.membershipInterval}
|
|
3342
3343
|
</span>
|
|
3343
3344
|
</div>
|
|
3344
|
-
</
|
|
3345
|
+
</Card3>
|
|
3345
3346
|
|
|
3346
3347
|
<TextField
|
|
3347
3348
|
label="Card Number"
|
|
@@ -3503,7 +3504,7 @@ function RegisterPage(props) {
|
|
|
3503
3504
|
</Show8>;
|
|
3504
3505
|
}
|
|
3505
3506
|
function RegisterContent(props) {
|
|
3506
|
-
const { Heading, Banner, Button, Card:
|
|
3507
|
+
const { Heading, Banner, Button, Card: Card3, StepIndicator } = usePrimitives();
|
|
3507
3508
|
const flow = props.flow;
|
|
3508
3509
|
const stepLabels = ["Account", "Address", "Confirm"];
|
|
3509
3510
|
return <div>
|
|
@@ -3518,7 +3519,7 @@ function RegisterContent(props) {
|
|
|
3518
3519
|
<StepIndicator current={flow.step()} total={3} labels={stepLabels} />
|
|
3519
3520
|
</div>
|
|
3520
3521
|
|
|
3521
|
-
<
|
|
3522
|
+
<Card3 variant="primary" padding="lg">
|
|
3522
3523
|
<Show8 when={flow.error()}>
|
|
3523
3524
|
<div style={{ "margin-bottom": "1.5rem" }}>
|
|
3524
3525
|
<Banner variant="error">{flow.error()}</Banner>
|
|
@@ -3560,7 +3561,7 @@ function RegisterContent(props) {
|
|
|
3560
3561
|
</Button>
|
|
3561
3562
|
</Show8>
|
|
3562
3563
|
</div>
|
|
3563
|
-
</
|
|
3564
|
+
</Card3>
|
|
3564
3565
|
|
|
3565
3566
|
<div style={{ "text-align": "center", "margin-top": "1.5rem", "font-size": "0.875rem", opacity: 0.7 }}>
|
|
3566
3567
|
Already have an account?{" "}
|
|
@@ -3768,7 +3769,7 @@ function SubscribePage(props) {
|
|
|
3768
3769
|
/>;
|
|
3769
3770
|
}
|
|
3770
3771
|
function SubscribeContent(props) {
|
|
3771
|
-
const { Spinner, Heading, Banner, Button, Card:
|
|
3772
|
+
const { Spinner, Heading, Banner, Button, Card: Card3, TextField, Select } = usePrimitives();
|
|
3772
3773
|
const flow = props.flow;
|
|
3773
3774
|
const fmt = (cents) => `$${(cents / 100).toFixed(2)}`;
|
|
3774
3775
|
const quote = () => flow.quote();
|
|
@@ -3801,7 +3802,7 @@ function SubscribeContent(props) {
|
|
|
3801
3802
|
/* Cart preview */
|
|
3802
3803
|
}
|
|
3803
3804
|
<div style={{ "margin-bottom": "1.5rem" }}>
|
|
3804
|
-
<
|
|
3805
|
+
<Card3 variant="primary" padding="md">
|
|
3805
3806
|
<div
|
|
3806
3807
|
style={{
|
|
3807
3808
|
"font-size": "0.7rem",
|
|
@@ -3881,13 +3882,13 @@ function SubscribeContent(props) {
|
|
|
3881
3882
|
Estimated from your cart; the exact amount is confirmed when you subscribe.
|
|
3882
3883
|
</p>
|
|
3883
3884
|
</Show9>
|
|
3884
|
-
</
|
|
3885
|
+
</Card3>
|
|
3885
3886
|
</div>
|
|
3886
3887
|
|
|
3887
3888
|
{
|
|
3888
3889
|
/* Form */
|
|
3889
3890
|
}
|
|
3890
|
-
<
|
|
3891
|
+
<Card3 variant="primary" padding="lg">
|
|
3891
3892
|
{
|
|
3892
3893
|
/* The backend refused to quote — the charge would refuse for the
|
|
3893
3894
|
same reason, so say it here, before the card details. */
|
|
@@ -4002,7 +4003,7 @@ function SubscribeContent(props) {
|
|
|
4002
4003
|
{flow.submitting() ? "Processing\u2026" : flow.availability.blocking() ? "Unavailable in Your State" : props.buttonAmount() ? `Subscribe \u2014 ${props.buttonAmount()}` : flow.quoteError() ? "Subscribe" : "Calculating your total\u2026"}
|
|
4003
4004
|
</Button>
|
|
4004
4005
|
</div>
|
|
4005
|
-
</
|
|
4006
|
+
</Card3>
|
|
4006
4007
|
</div>
|
|
4007
4008
|
</Show9>
|
|
4008
4009
|
</>;
|
|
@@ -4075,7 +4076,7 @@ var US_STATES3 = [
|
|
|
4075
4076
|
var US_STATE_OPTIONS3 = US_STATES3.map((s) => ({ value: s, label: s }));
|
|
4076
4077
|
|
|
4077
4078
|
// src/pages/AdminDashboard.tsx
|
|
4078
|
-
import { createEffect as
|
|
4079
|
+
import { createEffect as createEffect13, createSignal as createSignal35, ErrorBoundary, Match as Match3, Show as Show52, Switch as Switch3, For as For40 } from "solid-js";
|
|
4079
4080
|
|
|
4080
4081
|
// src/pages/admin/Affiliates.tsx
|
|
4081
4082
|
import { createSignal as createSignal10, For as For14, Match, Switch } from "solid-js";
|
|
@@ -10189,10 +10190,19 @@ function RefundModal(props) {
|
|
|
10189
10190
|
import { For as For17, Show as Show25 } from "solid-js";
|
|
10190
10191
|
function FunnelActivity(props) {
|
|
10191
10192
|
const f = () => props.funnel;
|
|
10193
|
+
const inferredFrom = () => props.intake?.kind === "inferred" ? props.intake.from : null;
|
|
10192
10194
|
const nothing = () => f().captures.length === 0 && f().sessions.length === 0 && f().carts.length === 0;
|
|
10193
10195
|
return <div class="app-admin-section-stack">
|
|
10194
10196
|
<Block title="Intake survey">
|
|
10195
|
-
<Show25
|
|
10197
|
+
<Show25
|
|
10198
|
+
when={f().captures.length > 0}
|
|
10199
|
+
fallback={<Show25 when={inferredFrom()} fallback={<Muted>No completed intake survey on record.</Muted>}>
|
|
10200
|
+
{(from) => <Muted>
|
|
10201
|
+
Completed — inferred from {from()}. This site holds no survey answers for it: the survey was
|
|
10202
|
+
taken before intake records were kept here, or through a path that does not record them.
|
|
10203
|
+
</Muted>}
|
|
10204
|
+
</Show25>}
|
|
10205
|
+
>
|
|
10196
10206
|
<ul style={{ margin: 0, "padding-left": "1.1rem", "font-size": "0.8125rem" }}>
|
|
10197
10207
|
<For17 each={f().captures}>
|
|
10198
10208
|
{(c) => <li>
|
|
@@ -10241,7 +10251,8 @@ function FunnelActivity(props) {
|
|
|
10241
10251
|
|
|
10242
10252
|
<Show25 when={nothing() && !f().telemetryEnabled && !f().cartRecoveryEnabled}>
|
|
10243
10253
|
<Muted>
|
|
10244
|
-
|
|
10254
|
+
Funnel telemetry is off for this site, so only completed surveys are recorded. With it on, this box
|
|
10255
|
+
also shows which survey step people stop at.
|
|
10245
10256
|
</Muted>
|
|
10246
10257
|
</Show25>
|
|
10247
10258
|
</div>;
|
|
@@ -11194,7 +11205,7 @@ function CustomerDetail(props) {
|
|
|
11194
11205
|
<SupportSummary support={ov().support} onOpenThread={nav ? (id) => nav.openSupportThread(id) : void 0} />
|
|
11195
11206
|
</Section>
|
|
11196
11207
|
<Section title="Before they signed up">
|
|
11197
|
-
<FunnelActivity funnel={ov().funnel} />
|
|
11208
|
+
<FunnelActivity funnel={ov().funnel} intake={intakeEvidence(ov())} />
|
|
11198
11209
|
</Section>
|
|
11199
11210
|
<Section
|
|
11200
11211
|
title="Timeline"
|
|
@@ -13049,9 +13060,9 @@ function Products(props) {
|
|
|
13049
13060
|
const [editingProduct, setEditingProduct] = createSignal23(null);
|
|
13050
13061
|
const [saving, setSaving] = createSignal23(false);
|
|
13051
13062
|
const [pending, setPending] = createSignal23(/* @__PURE__ */ new Set());
|
|
13052
|
-
const setRowPending = (id,
|
|
13063
|
+
const setRowPending = (id, on9) => setPending((prev) => {
|
|
13053
13064
|
const next = new Set(prev);
|
|
13054
|
-
if (
|
|
13065
|
+
if (on9) next.add(id);
|
|
13055
13066
|
else next.delete(id);
|
|
13056
13067
|
return next;
|
|
13057
13068
|
});
|
|
@@ -13158,9 +13169,9 @@ function Products(props) {
|
|
|
13158
13169
|
};
|
|
13159
13170
|
const [checked, setChecked] = createSignal23(/* @__PURE__ */ new Set());
|
|
13160
13171
|
const isChecked = (entry) => checked().has(entry.drugId);
|
|
13161
|
-
const setCheckedFor = (ids,
|
|
13172
|
+
const setCheckedFor = (ids, on9) => setChecked((prev) => {
|
|
13162
13173
|
const next = new Set(prev);
|
|
13163
|
-
for (const id of ids)
|
|
13174
|
+
for (const id of ids) on9 ? next.add(id) : next.delete(id);
|
|
13164
13175
|
return next;
|
|
13165
13176
|
});
|
|
13166
13177
|
createEffect9(() => {
|
|
@@ -15428,44 +15439,598 @@ function Webhooks() {
|
|
|
15428
15439
|
}
|
|
15429
15440
|
|
|
15430
15441
|
// src/pages/admin/EmailTemplates.tsx
|
|
15431
|
-
import { createEffect as
|
|
15442
|
+
import { createEffect as createEffect12, createSignal as createSignal30, createResource as createResource21, For as For35, Show as Show47 } from "solid-js";
|
|
15432
15443
|
|
|
15433
15444
|
// src/pages/admin/EmailTextEditor.tsx
|
|
15434
|
-
import { createSignal as
|
|
15435
|
-
|
|
15436
|
-
|
|
15437
|
-
|
|
15438
|
-
|
|
15439
|
-
|
|
15440
|
-
|
|
15441
|
-
|
|
15442
|
-
|
|
15445
|
+
import { createSignal as createSignal29, For as For34, Show as Show46 } from "solid-js";
|
|
15446
|
+
|
|
15447
|
+
// src/pages/admin/EmailBodyEditor.tsx
|
|
15448
|
+
import { createEffect as createEffect11, createSignal as createSignal28, For as For33, on as on7, onCleanup as onCleanup4, onMount as onMount4, Show as Show45 } from "solid-js";
|
|
15449
|
+
import { Editor } from "@tiptap/core";
|
|
15450
|
+
|
|
15451
|
+
// src/pages/admin/emailBodyExtensions.ts
|
|
15452
|
+
import { Node } from "@tiptap/core";
|
|
15453
|
+
import StarterKit from "@tiptap/starter-kit";
|
|
15454
|
+
|
|
15455
|
+
// src/pages/admin/emailBodyHtml.ts
|
|
15456
|
+
var TOKEN_SOURCE = "\\{\\{[A-Za-z_][A-Za-z0-9_]*\\}\\}";
|
|
15457
|
+
var tokenPattern = () => new RegExp(TOKEN_SOURCE, "g");
|
|
15458
|
+
var LEADING_TOKEN = new RegExp(`^${TOKEN_SOURCE}`);
|
|
15459
|
+
var CHIP_ATTR = "data-placeholder";
|
|
15460
|
+
var ALLOWED_TAGS = /* @__PURE__ */ new Set(["p", "h2", "ul", "ol", "li", "strong", "em", "u", "br", "a"]);
|
|
15461
|
+
function isAllowedHref(href) {
|
|
15462
|
+
if (!href) return false;
|
|
15463
|
+
const value = href.trim();
|
|
15464
|
+
return /^(https?:|mailto:|tel:)/i.test(value) || LEADING_TOKEN.test(value);
|
|
15465
|
+
}
|
|
15466
|
+
function normalizeTypedHref(input) {
|
|
15467
|
+
const value = input.trim();
|
|
15468
|
+
if (!value) return "";
|
|
15469
|
+
if (isAllowedHref(value)) return value;
|
|
15470
|
+
if (/^[a-z][a-z0-9+.-]*:(?!\d)/i.test(value)) return value;
|
|
15471
|
+
if (/^[^\s@/]+@[^\s@/]+\.[^\s@/]+$/.test(value)) return `mailto:${value}`;
|
|
15472
|
+
return `https://${value}`;
|
|
15473
|
+
}
|
|
15474
|
+
function parseFragment(html) {
|
|
15475
|
+
return new DOMParser().parseFromString(`<!doctype html><body>${html}`, "text/html").body;
|
|
15476
|
+
}
|
|
15477
|
+
function textNodesOf(root) {
|
|
15478
|
+
const walker = root.ownerDocument.createTreeWalker(root, NodeFilter.SHOW_TEXT);
|
|
15479
|
+
const out = [];
|
|
15480
|
+
for (let n = walker.nextNode(); n; n = walker.nextNode()) out.push(n);
|
|
15481
|
+
return out;
|
|
15482
|
+
}
|
|
15483
|
+
function tokensToChips(html) {
|
|
15484
|
+
const body = parseFragment(html);
|
|
15485
|
+
const doc = body.ownerDocument;
|
|
15486
|
+
for (const text of textNodesOf(body)) {
|
|
15487
|
+
const value = text.data;
|
|
15488
|
+
const matches = [...value.matchAll(tokenPattern())];
|
|
15489
|
+
if (matches.length === 0) continue;
|
|
15490
|
+
const frag = doc.createDocumentFragment();
|
|
15491
|
+
let cursor = 0;
|
|
15492
|
+
for (const m of matches) {
|
|
15493
|
+
const at = m.index;
|
|
15494
|
+
if (at > cursor) frag.append(value.slice(cursor, at));
|
|
15495
|
+
const chip = doc.createElement("span");
|
|
15496
|
+
chip.setAttribute(CHIP_ATTR, m[0]);
|
|
15497
|
+
chip.textContent = m[0];
|
|
15498
|
+
frag.append(chip);
|
|
15499
|
+
cursor = at + m[0].length;
|
|
15500
|
+
}
|
|
15501
|
+
if (cursor < value.length) frag.append(value.slice(cursor));
|
|
15502
|
+
text.replaceWith(frag);
|
|
15503
|
+
}
|
|
15504
|
+
return body.innerHTML;
|
|
15505
|
+
}
|
|
15506
|
+
function unwrap(el) {
|
|
15507
|
+
el.replaceWith(...Array.from(el.childNodes));
|
|
15508
|
+
}
|
|
15509
|
+
function canonicalizeBodyHtml(html) {
|
|
15510
|
+
const body = parseFragment(html);
|
|
15511
|
+
for (const chip of Array.from(body.querySelectorAll(`[${CHIP_ATTR}]`))) {
|
|
15512
|
+
chip.replaceWith(chip.getAttribute(CHIP_ATTR) ?? "");
|
|
15513
|
+
}
|
|
15514
|
+
for (const el of Array.from(body.querySelectorAll("*")).reverse()) {
|
|
15515
|
+
const tag = el.tagName.toLowerCase();
|
|
15516
|
+
if (!ALLOWED_TAGS.has(tag)) {
|
|
15517
|
+
unwrap(el);
|
|
15518
|
+
continue;
|
|
15519
|
+
}
|
|
15520
|
+
const href = tag === "a" ? el.getAttribute("href")?.trim() : void 0;
|
|
15521
|
+
const isButton = tag === "a" && el.hasAttribute("data-button") && el.parentElement === body;
|
|
15522
|
+
for (const attr of Array.from(el.attributes)) el.removeAttribute(attr.name);
|
|
15523
|
+
if (tag !== "a") continue;
|
|
15524
|
+
if (!isAllowedHref(href)) {
|
|
15525
|
+
if (isButton) {
|
|
15526
|
+
const p = body.ownerDocument.createElement("p");
|
|
15527
|
+
p.append(...Array.from(el.childNodes));
|
|
15528
|
+
el.replaceWith(p);
|
|
15529
|
+
} else {
|
|
15530
|
+
unwrap(el);
|
|
15531
|
+
}
|
|
15532
|
+
continue;
|
|
15533
|
+
}
|
|
15534
|
+
if (isButton) el.setAttribute("data-button", "");
|
|
15535
|
+
el.setAttribute("href", href);
|
|
15536
|
+
}
|
|
15537
|
+
for (const li of Array.from(body.querySelectorAll("li"))) {
|
|
15538
|
+
const paragraphs = Array.from(li.children).filter((c) => c.tagName === "P");
|
|
15539
|
+
if (paragraphs.length === 1 && li.firstChild === paragraphs[0]) unwrap(paragraphs[0]);
|
|
15540
|
+
}
|
|
15541
|
+
body.normalize();
|
|
15542
|
+
const out = body.innerHTML.replace(/<a data-button=""/g, "<a data-button");
|
|
15543
|
+
return out === "<p></p>" ? "" : out;
|
|
15544
|
+
}
|
|
15545
|
+
|
|
15546
|
+
// src/pages/admin/emailBodyExtensions.ts
|
|
15547
|
+
var PLACEHOLDER_NODE = "placeholder";
|
|
15548
|
+
var BUTTON_NODE = "emailButton";
|
|
15549
|
+
var UNKNOWN_PLACEHOLDER_TITLE = "Unknown placeholder \u2014 this template has no such value, so it would be sent as-is. Delete it.";
|
|
15550
|
+
var PlaceholderNode = Node.create({
|
|
15551
|
+
name: PLACEHOLDER_NODE,
|
|
15552
|
+
group: "inline",
|
|
15553
|
+
inline: true,
|
|
15554
|
+
atom: true,
|
|
15555
|
+
selectable: true,
|
|
15556
|
+
addOptions() {
|
|
15557
|
+
return { lookup: () => void 0 };
|
|
15558
|
+
},
|
|
15559
|
+
addAttributes() {
|
|
15560
|
+
return {
|
|
15561
|
+
token: {
|
|
15562
|
+
default: "",
|
|
15563
|
+
rendered: false,
|
|
15564
|
+
parseHTML: (el) => el.getAttribute(CHIP_ATTR) ?? ""
|
|
15565
|
+
}
|
|
15566
|
+
};
|
|
15567
|
+
},
|
|
15568
|
+
parseHTML() {
|
|
15569
|
+
return [{ tag: `span[${CHIP_ATTR}]` }];
|
|
15570
|
+
},
|
|
15571
|
+
renderHTML({ node }) {
|
|
15572
|
+
const token = node.attrs.token;
|
|
15573
|
+
const known = this.options.lookup(token);
|
|
15574
|
+
return [
|
|
15575
|
+
"span",
|
|
15576
|
+
{
|
|
15577
|
+
[CHIP_ATTR]: token,
|
|
15578
|
+
class: known ? "app-admin-email-chip" : "app-admin-email-chip app-admin-email-chip--unknown",
|
|
15579
|
+
title: known ? known.description : UNKNOWN_PLACEHOLDER_TITLE,
|
|
15580
|
+
contenteditable: "false"
|
|
15581
|
+
},
|
|
15582
|
+
token
|
|
15583
|
+
];
|
|
15584
|
+
},
|
|
15585
|
+
renderText({ node }) {
|
|
15586
|
+
return node.attrs.token;
|
|
15587
|
+
}
|
|
15588
|
+
});
|
|
15589
|
+
var ButtonBlock = Node.create({
|
|
15590
|
+
name: BUTTON_NODE,
|
|
15591
|
+
group: "block",
|
|
15592
|
+
content: `(text | ${PLACEHOLDER_NODE})*`,
|
|
15593
|
+
marks: "",
|
|
15594
|
+
defining: true,
|
|
15595
|
+
addAttributes() {
|
|
15596
|
+
return {
|
|
15597
|
+
href: {
|
|
15598
|
+
default: "",
|
|
15599
|
+
rendered: false,
|
|
15600
|
+
parseHTML: (el) => el.getAttribute("href") ?? ""
|
|
15601
|
+
}
|
|
15602
|
+
};
|
|
15603
|
+
},
|
|
15604
|
+
parseHTML() {
|
|
15605
|
+
return [{ tag: "a[data-button]", priority: 1100 }];
|
|
15606
|
+
},
|
|
15607
|
+
renderHTML({ node }) {
|
|
15608
|
+
return ["a", { "data-button": "", href: node.attrs.href, class: "app-admin-email-button" }, 0];
|
|
15609
|
+
},
|
|
15610
|
+
addKeyboardShortcuts() {
|
|
15611
|
+
return {
|
|
15612
|
+
// Enter in a button starts a paragraph below it instead of splitting the
|
|
15613
|
+
// button in two.
|
|
15614
|
+
Enter: ({ editor }) => {
|
|
15615
|
+
const { $from } = editor.state.selection;
|
|
15616
|
+
if ($from.parent.type.name !== this.name) return false;
|
|
15617
|
+
const after = $from.after();
|
|
15618
|
+
return editor.chain().insertContentAt(after, { type: "paragraph" }).setTextSelection(after + 1).run();
|
|
15619
|
+
}
|
|
15620
|
+
};
|
|
15621
|
+
}
|
|
15622
|
+
});
|
|
15623
|
+
function buildEmailBodyExtensions(lookup) {
|
|
15624
|
+
return [
|
|
15625
|
+
StarterKit.configure({
|
|
15626
|
+
// Not in the allowlist.
|
|
15627
|
+
blockquote: false,
|
|
15628
|
+
code: false,
|
|
15629
|
+
codeBlock: false,
|
|
15630
|
+
strike: false,
|
|
15631
|
+
horizontalRule: false,
|
|
15632
|
+
// It appends an empty paragraph after a trailing list/heading/button,
|
|
15633
|
+
// which would make every such body serialize differently from how it loaded.
|
|
15634
|
+
trailingNode: false,
|
|
15635
|
+
heading: { levels: [2] },
|
|
15636
|
+
link: {
|
|
15637
|
+
openOnClick: false,
|
|
15638
|
+
defaultProtocol: "https",
|
|
15639
|
+
// Tiptap's defaults add target/rel to every link; the stored form is href only.
|
|
15640
|
+
HTMLAttributes: { target: null, rel: null, class: null },
|
|
15641
|
+
isAllowedUri: (url) => isAllowedHref(url)
|
|
15642
|
+
}
|
|
15643
|
+
}),
|
|
15644
|
+
PlaceholderNode.configure({ lookup }),
|
|
15645
|
+
ButtonBlock
|
|
15646
|
+
];
|
|
15647
|
+
}
|
|
15648
|
+
|
|
15649
|
+
// src/pages/admin/EmailBodyEditor.tsx
|
|
15650
|
+
var CUSTOM_TARGET = "__custom__";
|
|
15651
|
+
var placeholderKey = (list) => list.map((p) => p.token).join("|");
|
|
15652
|
+
function EmailBodyEditor(props) {
|
|
15653
|
+
let surface;
|
|
15654
|
+
const [editor, setEditor] = createSignal28(null);
|
|
15655
|
+
const [tick, setTick] = createSignal28(0);
|
|
15656
|
+
const [dialog, setDialog] = createSignal28(null);
|
|
15657
|
+
const [menuOpen, setMenuOpen] = createSignal28(false);
|
|
15658
|
+
let shown = null;
|
|
15659
|
+
let shownPlaceholders = "";
|
|
15660
|
+
const lookup = (token) => props.placeholders.find((p) => p.token === token);
|
|
15661
|
+
const urlPlaceholders = () => props.placeholders.filter((p) => p.kind === "url");
|
|
15662
|
+
const load = (value) => {
|
|
15663
|
+
editor()?.destroy();
|
|
15664
|
+
shown = value;
|
|
15665
|
+
shownPlaceholders = placeholderKey(props.placeholders);
|
|
15666
|
+
setDialog(null);
|
|
15667
|
+
setMenuOpen(false);
|
|
15668
|
+
setEditor(
|
|
15669
|
+
new Editor({
|
|
15670
|
+
element: surface,
|
|
15671
|
+
extensions: buildEmailBodyExtensions(lookup),
|
|
15672
|
+
content: tokensToChips(value),
|
|
15673
|
+
editorProps: {
|
|
15674
|
+
attributes: {
|
|
15675
|
+
class: "app-admin-email-surface",
|
|
15676
|
+
role: "textbox",
|
|
15677
|
+
"aria-multiline": "true",
|
|
15678
|
+
"aria-label": "Email body"
|
|
15679
|
+
}
|
|
15680
|
+
},
|
|
15681
|
+
onUpdate: ({ editor: ed }) => {
|
|
15682
|
+
const html = canonicalizeBodyHtml(ed.getHTML());
|
|
15683
|
+
shown = html;
|
|
15684
|
+
props.onChange(html);
|
|
15685
|
+
},
|
|
15686
|
+
onTransaction: () => setTick((t) => t + 1),
|
|
15687
|
+
onFocus: () => props.onFocus?.()
|
|
15688
|
+
})
|
|
15689
|
+
);
|
|
15690
|
+
};
|
|
15691
|
+
onMount4(() => {
|
|
15692
|
+
load(props.value);
|
|
15693
|
+
props.ref?.({
|
|
15694
|
+
insertPlaceholder,
|
|
15695
|
+
focus: () => editor()?.commands.focus()
|
|
15696
|
+
});
|
|
15697
|
+
});
|
|
15698
|
+
createEffect11(
|
|
15699
|
+
on7(
|
|
15700
|
+
() => [props.value, placeholderKey(props.placeholders)],
|
|
15701
|
+
([value, key]) => {
|
|
15702
|
+
if (!editor()) return;
|
|
15703
|
+
if (value !== shown || key !== shownPlaceholders) load(value);
|
|
15704
|
+
},
|
|
15705
|
+
{ defer: true }
|
|
15706
|
+
)
|
|
15707
|
+
);
|
|
15708
|
+
onCleanup4(() => editor()?.destroy());
|
|
15709
|
+
const isActive = (name, attrs) => {
|
|
15710
|
+
tick();
|
|
15711
|
+
return editor()?.isActive(name, attrs) ?? false;
|
|
15712
|
+
};
|
|
15713
|
+
const run = (fn) => {
|
|
15714
|
+
const ed = editor();
|
|
15715
|
+
if (ed) fn(ed);
|
|
15716
|
+
};
|
|
15717
|
+
function insertPlaceholder(token) {
|
|
15718
|
+
run((ed) => ed.chain().focus().insertContent({ type: PLACEHOLDER_NODE, attrs: { token } }).run());
|
|
15719
|
+
}
|
|
15720
|
+
const splitHref = (href) => urlPlaceholders().some((p) => p.token === href) ? { target: href, url: "" } : { target: CUSTOM_TARGET, url: href };
|
|
15721
|
+
const openLinkDialog = () => run((ed) => {
|
|
15722
|
+
setMenuOpen(false);
|
|
15723
|
+
const existing = ed.getAttributes("link").href ?? "";
|
|
15724
|
+
const { empty } = ed.state.selection;
|
|
15725
|
+
setDialog({
|
|
15726
|
+
mode: "link",
|
|
15727
|
+
editing: !!existing,
|
|
15728
|
+
needsText: empty && !existing,
|
|
15729
|
+
...splitHref(existing),
|
|
15730
|
+
text: "",
|
|
15731
|
+
error: ""
|
|
15732
|
+
});
|
|
15733
|
+
});
|
|
15734
|
+
const openButtonDialog = () => run((ed) => {
|
|
15735
|
+
setMenuOpen(false);
|
|
15736
|
+
const inButton = ed.isActive(BUTTON_NODE);
|
|
15737
|
+
const { from, to } = ed.state.selection;
|
|
15738
|
+
setDialog({
|
|
15739
|
+
mode: "button",
|
|
15740
|
+
editing: inButton,
|
|
15741
|
+
needsText: !inButton,
|
|
15742
|
+
...splitHref(inButton ? ed.getAttributes(BUTTON_NODE).href ?? "" : ""),
|
|
15743
|
+
// Selected text becomes the suggested label.
|
|
15744
|
+
text: inButton ? "" : ed.state.doc.textBetween(from, to, " ").trim(),
|
|
15745
|
+
error: ""
|
|
15746
|
+
});
|
|
15747
|
+
});
|
|
15748
|
+
const patchDialog = (patch) => {
|
|
15749
|
+
const d = dialog();
|
|
15750
|
+
if (d) setDialog({ ...d, ...patch, error: patch.error ?? "" });
|
|
15751
|
+
};
|
|
15752
|
+
const closeDialog = () => {
|
|
15753
|
+
setDialog(null);
|
|
15754
|
+
editor()?.commands.focus();
|
|
15755
|
+
};
|
|
15756
|
+
const applyDialog = () => {
|
|
15757
|
+
const d = dialog();
|
|
15758
|
+
const ed = editor();
|
|
15759
|
+
if (!d || !ed) return;
|
|
15760
|
+
const href = d.target === CUSTOM_TARGET ? normalizeTypedHref(d.url) : d.target;
|
|
15761
|
+
if (!href) return patchDialog({ error: "Enter a web address, or pick a placeholder to link to." });
|
|
15762
|
+
if (!isAllowedHref(href)) {
|
|
15763
|
+
return patchDialog({ error: "Links must start with https://, http://, mailto: or tel: \u2014 or use a placeholder." });
|
|
15764
|
+
}
|
|
15765
|
+
const text = d.text.trim();
|
|
15766
|
+
if (d.needsText && !text) {
|
|
15767
|
+
return patchDialog({ error: d.mode === "button" ? "Enter the button label." : "Enter the text to show for the link." });
|
|
15768
|
+
}
|
|
15769
|
+
if (d.mode === "link") {
|
|
15770
|
+
if (d.needsText) {
|
|
15771
|
+
ed.chain().focus().insertContent({ type: "text", text, marks: [{ type: "link", attrs: { href } }] }).run();
|
|
15772
|
+
} else {
|
|
15773
|
+
ed.chain().focus().extendMarkRange("link").setLink({ href }).run();
|
|
15774
|
+
}
|
|
15775
|
+
} else if (d.editing) {
|
|
15776
|
+
ed.chain().focus().updateAttributes(BUTTON_NODE, { href }).run();
|
|
15777
|
+
} else {
|
|
15778
|
+
const { $from } = ed.state.selection;
|
|
15779
|
+
const node = { type: BUTTON_NODE, attrs: { href }, content: [{ type: "text", text }] };
|
|
15780
|
+
const top = $from.depth >= 1 ? $from.node(1) : null;
|
|
15781
|
+
const replaceEmpty = top?.type.name === "paragraph" && top.content.size === 0;
|
|
15782
|
+
const at = $from.depth >= 1 ? $from.after(1) : ed.state.doc.content.size;
|
|
15783
|
+
ed.chain().focus().insertContentAt(replaceEmpty ? { from: $from.before(1), to: at } : at, node).run();
|
|
15784
|
+
}
|
|
15785
|
+
setDialog(null);
|
|
15786
|
+
};
|
|
15787
|
+
const removeTarget = () => {
|
|
15788
|
+
const d = dialog();
|
|
15789
|
+
const ed = editor();
|
|
15790
|
+
if (!d || !ed) return;
|
|
15791
|
+
if (d.mode === "link") ed.chain().focus().extendMarkRange("link").unsetLink().run();
|
|
15792
|
+
else ed.chain().focus().setParagraph().run();
|
|
15793
|
+
setDialog(null);
|
|
15794
|
+
};
|
|
15795
|
+
const onDialogKeyDown = (e) => {
|
|
15796
|
+
if (e.key === "Escape") {
|
|
15797
|
+
e.preventDefault();
|
|
15798
|
+
closeDialog();
|
|
15799
|
+
} else if (e.key === "Enter" && e.target.tagName === "INPUT") {
|
|
15800
|
+
e.preventDefault();
|
|
15801
|
+
applyDialog();
|
|
15802
|
+
}
|
|
15803
|
+
};
|
|
15804
|
+
let menuButton;
|
|
15805
|
+
let menuEl;
|
|
15806
|
+
const closeMenu = (refocus = false) => {
|
|
15807
|
+
setMenuOpen(false);
|
|
15808
|
+
if (refocus) menuButton.focus();
|
|
15809
|
+
};
|
|
15810
|
+
const onDocPointerDown = (e) => {
|
|
15811
|
+
if (!menuOpen()) return;
|
|
15812
|
+
const t = e.target;
|
|
15813
|
+
if (!menuEl?.contains(t) && !menuButton.contains(t)) closeMenu();
|
|
15814
|
+
};
|
|
15815
|
+
onMount4(() => document.addEventListener("mousedown", onDocPointerDown));
|
|
15816
|
+
onCleanup4(() => document.removeEventListener("mousedown", onDocPointerDown));
|
|
15817
|
+
const moveFocus = (items, current2, delta) => {
|
|
15818
|
+
if (items.length === 0) return;
|
|
15819
|
+
const i = items.indexOf(current2);
|
|
15820
|
+
items[(i + delta + items.length) % items.length].focus();
|
|
15821
|
+
};
|
|
15822
|
+
const onMenuKeyDown = (e) => {
|
|
15823
|
+
const items = Array.from(menuEl?.querySelectorAll('[role="menuitem"]') ?? []);
|
|
15824
|
+
if (e.key === "Escape") {
|
|
15825
|
+
e.preventDefault();
|
|
15826
|
+
e.stopPropagation();
|
|
15827
|
+
closeMenu(true);
|
|
15828
|
+
} else if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
15829
|
+
e.preventDefault();
|
|
15830
|
+
e.stopPropagation();
|
|
15831
|
+
moveFocus(items, document.activeElement, e.key === "ArrowDown" ? 1 : -1);
|
|
15832
|
+
} else if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
|
|
15833
|
+
e.stopPropagation();
|
|
15834
|
+
}
|
|
15443
15835
|
};
|
|
15444
|
-
const
|
|
15445
|
-
|
|
15446
|
-
|
|
15836
|
+
const toggleMenu = () => {
|
|
15837
|
+
const next = !menuOpen();
|
|
15838
|
+
setMenuOpen(next);
|
|
15839
|
+
if (next) {
|
|
15840
|
+
setDialog(null);
|
|
15841
|
+
queueMicrotask(() => menuEl?.querySelector('[role="menuitem"]')?.focus());
|
|
15842
|
+
}
|
|
15447
15843
|
};
|
|
15448
|
-
const
|
|
15449
|
-
if (
|
|
15450
|
-
|
|
15844
|
+
const onToolbarKeyDown = (e) => {
|
|
15845
|
+
if (e.key !== "ArrowLeft" && e.key !== "ArrowRight") return;
|
|
15846
|
+
const bar = e.currentTarget;
|
|
15847
|
+
const items = Array.from(bar.querySelectorAll(":scope > button, :scope > .app-admin-email-menu-wrap > button"));
|
|
15848
|
+
if (!items.includes(document.activeElement)) return;
|
|
15849
|
+
e.preventDefault();
|
|
15850
|
+
moveFocus(items, document.activeElement, e.key === "ArrowRight" ? 1 : -1);
|
|
15451
15851
|
};
|
|
15452
|
-
const
|
|
15453
|
-
|
|
15454
|
-
|
|
15455
|
-
|
|
15852
|
+
const ToolButton = (p) => <button
|
|
15853
|
+
type="button"
|
|
15854
|
+
class={`app-admin-email-tool${p.class ? ` ${p.class}` : ""}`}
|
|
15855
|
+
aria-label={p.label}
|
|
15856
|
+
title={p.label}
|
|
15857
|
+
aria-pressed={p.pressed ? p.pressed() ? "true" : "false" : void 0}
|
|
15858
|
+
onMouseDown={(e) => e.preventDefault()}
|
|
15859
|
+
onClick={p.onClick}
|
|
15860
|
+
>
|
|
15861
|
+
{p.children}
|
|
15862
|
+
</button>;
|
|
15863
|
+
return <div class="app-admin-email-editor">
|
|
15864
|
+
<div class="app-admin-email-toolbar" role="toolbar" aria-label="Formatting" onKeyDown={onToolbarKeyDown}>
|
|
15865
|
+
<ToolButton label="Bold" pressed={() => isActive("bold")} onClick={() => run((ed) => ed.chain().focus().toggleBold().run())}>
|
|
15866
|
+
<strong>B</strong>
|
|
15867
|
+
</ToolButton>
|
|
15868
|
+
<ToolButton label="Italic" pressed={() => isActive("italic")} onClick={() => run((ed) => ed.chain().focus().toggleItalic().run())}>
|
|
15869
|
+
<em>I</em>
|
|
15870
|
+
</ToolButton>
|
|
15871
|
+
<ToolButton label="Underline" pressed={() => isActive("underline")} onClick={() => run((ed) => ed.chain().focus().toggleUnderline().run())}>
|
|
15872
|
+
<u>U</u>
|
|
15873
|
+
</ToolButton>
|
|
15874
|
+
<span class="app-admin-email-tool-sep" aria-hidden="true" />
|
|
15875
|
+
<ToolButton
|
|
15876
|
+
label="Heading"
|
|
15877
|
+
pressed={() => isActive("heading", { level: 2 })}
|
|
15878
|
+
onClick={() => run((ed) => ed.chain().focus().toggleHeading({ level: 2 }).run())}
|
|
15879
|
+
>
|
|
15880
|
+
Heading
|
|
15881
|
+
</ToolButton>
|
|
15882
|
+
<ToolButton label="Bullet list" pressed={() => isActive("bulletList")} onClick={() => run((ed) => ed.chain().focus().toggleBulletList().run())}>
|
|
15883
|
+
• List
|
|
15884
|
+
</ToolButton>
|
|
15885
|
+
<ToolButton label="Numbered list" pressed={() => isActive("orderedList")} onClick={() => run((ed) => ed.chain().focus().toggleOrderedList().run())}>
|
|
15886
|
+
1. List
|
|
15887
|
+
</ToolButton>
|
|
15888
|
+
<span class="app-admin-email-tool-sep" aria-hidden="true" />
|
|
15889
|
+
<ToolButton label="Link" pressed={() => isActive("link")} onClick={openLinkDialog}>
|
|
15890
|
+
Link
|
|
15891
|
+
</ToolButton>
|
|
15892
|
+
<ToolButton label="Button" pressed={() => isActive(BUTTON_NODE)} onClick={openButtonDialog}>
|
|
15893
|
+
Button
|
|
15894
|
+
</ToolButton>
|
|
15895
|
+
<span class="app-admin-email-tool-sep" aria-hidden="true" />
|
|
15896
|
+
<div class="app-admin-email-menu-wrap">
|
|
15897
|
+
<button
|
|
15898
|
+
type="button"
|
|
15899
|
+
ref={menuButton}
|
|
15900
|
+
class="app-admin-email-tool"
|
|
15901
|
+
aria-haspopup="menu"
|
|
15902
|
+
aria-expanded={menuOpen() ? "true" : "false"}
|
|
15903
|
+
disabled={props.placeholders.length === 0}
|
|
15904
|
+
onMouseDown={(e) => e.preventDefault()}
|
|
15905
|
+
onClick={toggleMenu}
|
|
15906
|
+
>
|
|
15907
|
+
Insert placeholder ▾
|
|
15908
|
+
</button>
|
|
15909
|
+
<Show45 when={menuOpen()}>
|
|
15910
|
+
<div class="app-admin-email-menu" role="menu" aria-label="Placeholders" ref={menuEl} onKeyDown={onMenuKeyDown}>
|
|
15911
|
+
<For33 each={props.placeholders}>
|
|
15912
|
+
{(p) => <button
|
|
15913
|
+
type="button"
|
|
15914
|
+
role="menuitem"
|
|
15915
|
+
class="app-admin-email-menu-item"
|
|
15916
|
+
onClick={() => {
|
|
15917
|
+
closeMenu();
|
|
15918
|
+
insertPlaceholder(p.token);
|
|
15919
|
+
}}
|
|
15920
|
+
>
|
|
15921
|
+
<span class="app-admin-email-menu-token">{p.token}</span>
|
|
15922
|
+
<span class="app-admin-email-menu-desc">{p.description}</span>
|
|
15923
|
+
</button>}
|
|
15924
|
+
</For33>
|
|
15925
|
+
</div>
|
|
15926
|
+
</Show45>
|
|
15927
|
+
</div>
|
|
15928
|
+
</div>
|
|
15929
|
+
|
|
15930
|
+
<Show45 when={dialog()}>
|
|
15931
|
+
{(d) => <div
|
|
15932
|
+
class="app-admin-email-dialog"
|
|
15933
|
+
role="group"
|
|
15934
|
+
aria-label={d().mode === "button" ? "Button" : "Link"}
|
|
15935
|
+
onKeyDown={onDialogKeyDown}
|
|
15936
|
+
>
|
|
15937
|
+
<Show45 when={d().needsText}>
|
|
15938
|
+
<label class="app-admin-email-dialog-field">
|
|
15939
|
+
<span>{d().mode === "button" ? "Button label" : "Link text"}</span>
|
|
15940
|
+
<input
|
|
15941
|
+
type="text"
|
|
15942
|
+
class="app-admin-input"
|
|
15943
|
+
value={d().text}
|
|
15944
|
+
ref={(el) => queueMicrotask(() => el.focus())}
|
|
15945
|
+
onInput={(e) => patchDialog({ text: e.currentTarget.value })}
|
|
15946
|
+
/>
|
|
15947
|
+
</label>
|
|
15948
|
+
</Show45>
|
|
15949
|
+
<label class="app-admin-email-dialog-field">
|
|
15950
|
+
<span>Link to</span>
|
|
15951
|
+
<select
|
|
15952
|
+
class="app-admin-input"
|
|
15953
|
+
ref={(el) => {
|
|
15954
|
+
if (!d().needsText && d().target !== CUSTOM_TARGET) queueMicrotask(() => el.focus());
|
|
15955
|
+
}}
|
|
15956
|
+
onChange={(e) => patchDialog({ target: e.currentTarget.value })}
|
|
15957
|
+
>
|
|
15958
|
+
<option value={CUSTOM_TARGET} selected={d().target === CUSTOM_TARGET}>A web address</option>
|
|
15959
|
+
<For33 each={urlPlaceholders()}>
|
|
15960
|
+
{(p) => <option value={p.token} selected={d().target === p.token}>
|
|
15961
|
+
{p.description} ({p.token})
|
|
15962
|
+
</option>}
|
|
15963
|
+
</For33>
|
|
15964
|
+
</select>
|
|
15965
|
+
</label>
|
|
15966
|
+
<Show45 when={d().target === CUSTOM_TARGET}>
|
|
15967
|
+
<label class="app-admin-email-dialog-field">
|
|
15968
|
+
<span>Web address</span>
|
|
15969
|
+
<input
|
|
15970
|
+
type="text"
|
|
15971
|
+
inputMode="url"
|
|
15972
|
+
class="app-admin-input"
|
|
15973
|
+
placeholder="https://"
|
|
15974
|
+
value={d().url}
|
|
15975
|
+
ref={(el) => {
|
|
15976
|
+
if (!d().needsText) queueMicrotask(() => el.focus());
|
|
15977
|
+
}}
|
|
15978
|
+
onInput={(e) => patchDialog({ url: e.currentTarget.value })}
|
|
15979
|
+
/>
|
|
15980
|
+
</label>
|
|
15981
|
+
</Show45>
|
|
15982
|
+
<Show45 when={d().error}>
|
|
15983
|
+
<p class="app-admin-field-error" role="alert">{d().error}</p>
|
|
15984
|
+
</Show45>
|
|
15985
|
+
<div class="app-admin-email-dialog-actions">
|
|
15986
|
+
<button type="button" class="app-admin-btn app-admin-btn-primary" onClick={applyDialog}>
|
|
15987
|
+
{d().editing ? "Update" : d().mode === "button" ? "Insert button" : "Add link"}
|
|
15988
|
+
</button>
|
|
15989
|
+
<Show45 when={d().editing}>
|
|
15990
|
+
<button type="button" class="app-admin-btn app-admin-btn-ghost" onClick={removeTarget}>
|
|
15991
|
+
{d().mode === "button" ? "Remove button" : "Remove link"}
|
|
15992
|
+
</button>
|
|
15993
|
+
</Show45>
|
|
15994
|
+
<button type="button" class="app-admin-btn app-admin-btn-ghost" onClick={closeDialog}>
|
|
15995
|
+
Cancel
|
|
15996
|
+
</button>
|
|
15997
|
+
</div>
|
|
15998
|
+
</div>}
|
|
15999
|
+
</Show45>
|
|
16000
|
+
|
|
16001
|
+
<div class="app-admin-email-canvas">
|
|
16002
|
+
<div class="app-admin-email-page" ref={surface} />
|
|
16003
|
+
</div>
|
|
16004
|
+
</div>;
|
|
16005
|
+
}
|
|
16006
|
+
|
|
16007
|
+
// src/pages/admin/EmailTextEditor.tsx
|
|
16008
|
+
var TEMPLATE_LIMITS = { subject: 200, body: 2e4 };
|
|
16009
|
+
function TemplateTextEditor(props) {
|
|
16010
|
+
const [target, setTarget] = createSignal29("body");
|
|
16011
|
+
let subjectEl;
|
|
16012
|
+
let body;
|
|
16013
|
+
const fitsSubject = (p) => (p.kind ?? "text") === "text";
|
|
16014
|
+
const insertToken = (p) => {
|
|
16015
|
+
if (target() === "body") {
|
|
16016
|
+
body?.insertPlaceholder(p.token);
|
|
16017
|
+
return;
|
|
16018
|
+
}
|
|
16019
|
+
if (!fitsSubject(p)) return;
|
|
16020
|
+
const el = subjectEl;
|
|
15456
16021
|
const start = el.selectionStart ?? el.value.length;
|
|
15457
16022
|
const end = el.selectionEnd ?? start;
|
|
15458
|
-
const next = el.value.slice(0, start) + token + el.value.slice(end);
|
|
15459
|
-
|
|
15460
|
-
|
|
15461
|
-
const caret = start + token.length;
|
|
16023
|
+
const next = (el.value.slice(0, start) + p.token + el.value.slice(end)).slice(0, TEMPLATE_LIMITS.subject);
|
|
16024
|
+
props.onChange({ ...props.value, subject: next });
|
|
16025
|
+
const caret = Math.min(start + p.token.length, next.length);
|
|
15462
16026
|
queueMicrotask(() => {
|
|
15463
16027
|
el.focus();
|
|
15464
16028
|
el.setSelectionRange(caret, caret);
|
|
15465
16029
|
});
|
|
15466
16030
|
};
|
|
16031
|
+
const bodyTooLong = () => props.value.body.length > TEMPLATE_LIMITS.body;
|
|
15467
16032
|
return <div style={{ display: "flex", "flex-direction": "column", gap: "1.25rem" }}>
|
|
15468
|
-
<
|
|
16033
|
+
<Show46 when={props.placeholders.length > 0}>
|
|
15469
16034
|
<div
|
|
15470
16035
|
style={{
|
|
15471
16036
|
padding: "0.75rem 0.875rem",
|
|
@@ -15475,48 +16040,46 @@ function TemplateTextEditor(props) {
|
|
|
15475
16040
|
}}
|
|
15476
16041
|
>
|
|
15477
16042
|
<p style={{ "font-size": "0.75rem", "font-weight": "600", "margin-bottom": "0.5rem" }}>
|
|
15478
|
-
|
|
16043
|
+
Placeholders
|
|
15479
16044
|
<span style={{ "font-weight": "400", color: "var(--app-admin-fg-muted)" }}>
|
|
15480
|
-
{" "}—
|
|
16045
|
+
{" "}— replaced with the real value when the email is sent. Click the subject or the body, then a
|
|
16046
|
+
placeholder to insert it.
|
|
15481
16047
|
</span>
|
|
15482
16048
|
</p>
|
|
15483
16049
|
<div style={{ display: "flex", "flex-wrap": "wrap", gap: "0.375rem" }}>
|
|
15484
|
-
<
|
|
15485
|
-
{(p) =>
|
|
15486
|
-
|
|
15487
|
-
|
|
15488
|
-
|
|
15489
|
-
|
|
15490
|
-
|
|
15491
|
-
|
|
15492
|
-
|
|
15493
|
-
|
|
15494
|
-
|
|
15495
|
-
|
|
15496
|
-
|
|
15497
|
-
|
|
15498
|
-
|
|
15499
|
-
|
|
15500
|
-
>
|
|
15501
|
-
{p.token}
|
|
15502
|
-
</button>}
|
|
15503
|
-
</For33>
|
|
16050
|
+
<For34 each={props.placeholders}>
|
|
16051
|
+
{(p) => {
|
|
16052
|
+
const blocked = () => target() === "subject" && !fitsSubject(p);
|
|
16053
|
+
return <button
|
|
16054
|
+
type="button"
|
|
16055
|
+
aria-label={p.token}
|
|
16056
|
+
title={blocked() ? `${p.description} \u2014 a link, so it can only go in the body` : p.description}
|
|
16057
|
+
disabled={blocked()}
|
|
16058
|
+
onMouseDown={(e) => e.preventDefault()}
|
|
16059
|
+
onClick={() => insertToken(p)}
|
|
16060
|
+
class="app-admin-email-token-btn"
|
|
16061
|
+
>
|
|
16062
|
+
{p.token}
|
|
16063
|
+
</button>;
|
|
16064
|
+
}}
|
|
16065
|
+
</For34>
|
|
15504
16066
|
</div>
|
|
15505
|
-
<
|
|
16067
|
+
<Show46 when={props.note}>
|
|
15506
16068
|
<p style={{ "font-size": "0.75rem", color: "var(--app-admin-fg-muted)", margin: "0.5rem 0 0" }}>{props.note}</p>
|
|
15507
|
-
</
|
|
16069
|
+
</Show46>
|
|
15508
16070
|
</div>
|
|
15509
|
-
</
|
|
16071
|
+
</Show46>
|
|
15510
16072
|
|
|
15511
16073
|
<div>
|
|
15512
16074
|
<label class="app-admin-label">Subject</label>
|
|
15513
16075
|
<input
|
|
15514
16076
|
type="text"
|
|
15515
16077
|
aria-label="Subject"
|
|
16078
|
+
ref={subjectEl}
|
|
15516
16079
|
maxLength={TEMPLATE_LIMITS.subject}
|
|
15517
16080
|
value={props.value.subject}
|
|
15518
|
-
onFocus={(
|
|
15519
|
-
onInput={(e) =>
|
|
16081
|
+
onFocus={() => setTarget("subject")}
|
|
16082
|
+
onInput={(e) => props.onChange({ ...props.value, subject: e.currentTarget.value })}
|
|
15520
16083
|
class="app-admin-input"
|
|
15521
16084
|
/>
|
|
15522
16085
|
<p style={{ "font-size": "0.75rem", color: "var(--app-admin-fg-subtle)", "margin-top": "0.25rem" }}>
|
|
@@ -15525,88 +16088,20 @@ function TemplateTextEditor(props) {
|
|
|
15525
16088
|
</div>
|
|
15526
16089
|
|
|
15527
16090
|
<div>
|
|
15528
|
-
<
|
|
15529
|
-
<
|
|
15530
|
-
|
|
15531
|
-
|
|
15532
|
-
|
|
15533
|
-
onFocus={(
|
|
15534
|
-
|
|
15535
|
-
|
|
15536
|
-
|
|
15537
|
-
|
|
15538
|
-
|
|
15539
|
-
|
|
15540
|
-
|
|
15541
|
-
|
|
15542
|
-
</label>
|
|
15543
|
-
<div style={{ display: "flex", "flex-direction": "column", gap: "0.75rem" }}>
|
|
15544
|
-
<Index each={props.value.bodyParagraphs}>
|
|
15545
|
-
{(para, i) => <div style={{ display: "flex", gap: "0.5rem" }}>
|
|
15546
|
-
<textarea
|
|
15547
|
-
value={para()}
|
|
15548
|
-
aria-label={`Paragraph ${i + 1}`}
|
|
15549
|
-
onFocus={(e) => setLastFocused({ field: "paragraph", index: i, el: e.currentTarget })}
|
|
15550
|
-
onInput={(e) => setParagraph(i, e.currentTarget.value)}
|
|
15551
|
-
rows={3}
|
|
15552
|
-
class="app-admin-input"
|
|
15553
|
-
style={{ flex: 1, resize: "vertical" }}
|
|
15554
|
-
/>
|
|
15555
|
-
<Show45 when={props.value.bodyParagraphs.length > 1}>
|
|
15556
|
-
<button
|
|
15557
|
-
type="button"
|
|
15558
|
-
onClick={() => removeParagraph(i)}
|
|
15559
|
-
title="Remove paragraph"
|
|
15560
|
-
style={{
|
|
15561
|
-
"align-self": "flex-start",
|
|
15562
|
-
background: "none",
|
|
15563
|
-
border: "none",
|
|
15564
|
-
color: "var(--app-admin-danger-fg)",
|
|
15565
|
-
cursor: "pointer",
|
|
15566
|
-
"font-size": "1.125rem",
|
|
15567
|
-
padding: "0.375rem"
|
|
15568
|
-
}}
|
|
15569
|
-
>
|
|
15570
|
-
×
|
|
15571
|
-
</button>
|
|
15572
|
-
</Show45>
|
|
15573
|
-
</div>}
|
|
15574
|
-
</Index>
|
|
15575
|
-
</div>
|
|
15576
|
-
<Show45 when={props.value.bodyParagraphs.length < TEMPLATE_LIMITS.paragraphs}>
|
|
15577
|
-
<button
|
|
15578
|
-
type="button"
|
|
15579
|
-
onClick={addParagraph}
|
|
15580
|
-
style={{
|
|
15581
|
-
"margin-top": "0.5rem",
|
|
15582
|
-
background: "none",
|
|
15583
|
-
border: "none",
|
|
15584
|
-
color: "var(--app-admin-primary-soft-fg)",
|
|
15585
|
-
cursor: "pointer",
|
|
15586
|
-
"font-size": "0.8rem",
|
|
15587
|
-
"font-weight": "500"
|
|
15588
|
-
}}
|
|
15589
|
-
>
|
|
15590
|
-
+ Add Paragraph
|
|
15591
|
-
</button>
|
|
15592
|
-
</Show45>
|
|
15593
|
-
</div>
|
|
15594
|
-
|
|
15595
|
-
<div>
|
|
15596
|
-
<label class="app-admin-label">Closing Text</label>
|
|
15597
|
-
<textarea
|
|
15598
|
-
aria-label="Closing Text"
|
|
15599
|
-
maxLength={TEMPLATE_LIMITS.closing}
|
|
15600
|
-
value={props.value.closingText}
|
|
15601
|
-
onFocus={(e) => setLastFocused({ field: "closingText", el: e.currentTarget })}
|
|
15602
|
-
onInput={(e) => set("closingText", e.currentTarget.value)}
|
|
15603
|
-
rows={3}
|
|
15604
|
-
class="app-admin-input"
|
|
15605
|
-
style={{ resize: "vertical" }}
|
|
15606
|
-
/>
|
|
15607
|
-
<p style={{ "font-size": "0.75rem", color: "var(--app-admin-fg-subtle)", "margin-top": "0.25rem" }}>
|
|
15608
|
-
{props.value.closingText.length}/{TEMPLATE_LIMITS.closing}
|
|
15609
|
-
</p>
|
|
16091
|
+
<span class="app-admin-label">Body</span>
|
|
16092
|
+
<EmailBodyEditor
|
|
16093
|
+
value={props.value.body}
|
|
16094
|
+
placeholders={props.placeholders}
|
|
16095
|
+
onChange={(html) => props.onChange({ ...props.value, body: html })}
|
|
16096
|
+
onFocus={() => setTarget("body")}
|
|
16097
|
+
ref={(h) => body = h}
|
|
16098
|
+
/>
|
|
16099
|
+
<Show46 when={bodyTooLong()}>
|
|
16100
|
+
<p class="app-admin-field-error" role="alert">
|
|
16101
|
+
This email is too long to save ({props.value.body.length.toLocaleString()} of{" "}
|
|
16102
|
+
{TEMPLATE_LIMITS.body.toLocaleString()} characters, formatting included). Shorten it.
|
|
16103
|
+
</p>
|
|
16104
|
+
</Show46>
|
|
15610
16105
|
</div>
|
|
15611
16106
|
</div>;
|
|
15612
16107
|
}
|
|
@@ -15650,35 +16145,37 @@ var isSameSelection = (a, b) => a.kind === b.kind && (a.kind === "fixed" ? a.key
|
|
|
15650
16145
|
function humanize(key) {
|
|
15651
16146
|
return key.replace(/([A-Z])/g, " $1").replace(/[_-]/g, " ").replace(/^\w/, (c) => c.toUpperCase()).trim();
|
|
15652
16147
|
}
|
|
16148
|
+
var BLANK_CUSTOM_BODY = "<p>Hi {{firstName}},</p><p>If you would rather not hear from us about this, {{unsubscribeLink}}.</p>";
|
|
15653
16149
|
function blankCustom() {
|
|
15654
16150
|
return {
|
|
15655
16151
|
name: "",
|
|
15656
16152
|
subject: "",
|
|
15657
|
-
|
|
15658
|
-
bodyParagraphs: [""],
|
|
15659
|
-
closingText: "If you would rather not hear from us about this, {{unsubscribeLink}}."
|
|
16153
|
+
body: BLANK_CUSTOM_BODY
|
|
15660
16154
|
};
|
|
15661
16155
|
}
|
|
15662
16156
|
function toInput(t) {
|
|
15663
16157
|
return {
|
|
15664
16158
|
name: t.name,
|
|
15665
16159
|
subject: t.subject,
|
|
15666
|
-
|
|
15667
|
-
bodyParagraphs: [...t.bodyParagraphs],
|
|
15668
|
-
closingText: t.closingText
|
|
16160
|
+
body: t.body
|
|
15669
16161
|
};
|
|
15670
16162
|
}
|
|
15671
16163
|
function EmailTemplates(props = {}) {
|
|
15672
|
-
const [refreshKey, setRefreshKey] =
|
|
15673
|
-
const [placeholders, setPlaceholders] =
|
|
15674
|
-
const [customTemplates, setCustomTemplates] =
|
|
15675
|
-
const [customPlaceholders, setCustomPlaceholders] =
|
|
16164
|
+
const [refreshKey, setRefreshKey] = createSignal30(0);
|
|
16165
|
+
const [placeholders, setPlaceholders] = createSignal30({});
|
|
16166
|
+
const [customTemplates, setCustomTemplates] = createSignal30([]);
|
|
16167
|
+
const [customPlaceholders, setCustomPlaceholders] = createSignal30([]);
|
|
16168
|
+
let adoptServerCopy = false;
|
|
15676
16169
|
const [templates] = createResource21(refreshKey, async () => {
|
|
15677
16170
|
try {
|
|
15678
16171
|
const res = await adminApi.getEmailTemplates();
|
|
15679
16172
|
setPlaceholders(res.placeholders ?? {});
|
|
15680
16173
|
setCustomTemplates(res.customTemplates ?? []);
|
|
15681
16174
|
setCustomPlaceholders(res.customPlaceholders ?? []);
|
|
16175
|
+
if (adoptServerCopy) {
|
|
16176
|
+
adoptServerCopy = false;
|
|
16177
|
+
setDraft(structuredClone(res.templates));
|
|
16178
|
+
}
|
|
15682
16179
|
return res.templates;
|
|
15683
16180
|
} catch (err) {
|
|
15684
16181
|
toastError(err instanceof Error ? err.message : "Failed to load email templates");
|
|
@@ -15700,16 +16197,16 @@ function EmailTemplates(props = {}) {
|
|
|
15700
16197
|
if (other.length > 0) groups.push({ label: "Other", keys: other });
|
|
15701
16198
|
return groups;
|
|
15702
16199
|
};
|
|
15703
|
-
const [selection, setSelection] =
|
|
16200
|
+
const [selection, setSelection] = createSignal30(
|
|
15704
16201
|
props.initialCustomTemplateId ? { kind: "custom", id: props.initialCustomTemplateId } : { kind: "fixed", key: "" }
|
|
15705
16202
|
);
|
|
15706
|
-
const [draft, setDraft] =
|
|
15707
|
-
const [customDraft, setCustomDraft] =
|
|
15708
|
-
const [saving, setSaving] =
|
|
15709
|
-
const [resetting, setResetting] =
|
|
15710
|
-
const [deleting, setDeleting] =
|
|
15711
|
-
const [sendingTest, setSendingTest] =
|
|
15712
|
-
const [collapsed, setCollapsed] =
|
|
16203
|
+
const [draft, setDraft] = createSignal30(null);
|
|
16204
|
+
const [customDraft, setCustomDraft] = createSignal30(null);
|
|
16205
|
+
const [saving, setSaving] = createSignal30(false);
|
|
16206
|
+
const [resetting, setResetting] = createSignal30(false);
|
|
16207
|
+
const [deleting, setDeleting] = createSignal30(false);
|
|
16208
|
+
const [sendingTest, setSendingTest] = createSignal30(false);
|
|
16209
|
+
const [collapsed, setCollapsed] = createSignal30({});
|
|
15713
16210
|
const toggleCategory = (label3) => setCollapsed((c) => ({ ...c, [label3]: !c[label3] }));
|
|
15714
16211
|
const activeKey = () => {
|
|
15715
16212
|
const s = selection();
|
|
@@ -15730,7 +16227,7 @@ function EmailTemplates(props = {}) {
|
|
|
15730
16227
|
if (keys.length > 0 && s.kind === "fixed" && !s.key) setSelection({ kind: "fixed", key: keys[0] });
|
|
15731
16228
|
}
|
|
15732
16229
|
};
|
|
15733
|
-
|
|
16230
|
+
createEffect12(() => {
|
|
15734
16231
|
const s = selection();
|
|
15735
16232
|
const list = customTemplates();
|
|
15736
16233
|
if (s.kind === "custom" && s.id && !customDraft()) {
|
|
@@ -15800,7 +16297,7 @@ function EmailTemplates(props = {}) {
|
|
|
15800
16297
|
try {
|
|
15801
16298
|
await adminApi.saveEmailTemplates(d);
|
|
15802
16299
|
toastSuccess("Templates saved");
|
|
15803
|
-
|
|
16300
|
+
adoptServerCopy = true;
|
|
15804
16301
|
setRefreshKey((k) => k + 1);
|
|
15805
16302
|
} catch (err) {
|
|
15806
16303
|
toastError(err instanceof Error ? err.message : "Failed to save templates");
|
|
@@ -15845,7 +16342,7 @@ function EmailTemplates(props = {}) {
|
|
|
15845
16342
|
const customPayload = () => {
|
|
15846
16343
|
const cd = customDraft();
|
|
15847
16344
|
if (!cd) return null;
|
|
15848
|
-
return { ...cd, name: cd.name.trim()
|
|
16345
|
+
return { ...cd, name: cd.name.trim() };
|
|
15849
16346
|
};
|
|
15850
16347
|
const handleSaveCustom = async () => {
|
|
15851
16348
|
const body = customPayload();
|
|
@@ -15956,8 +16453,8 @@ function EmailTemplates(props = {}) {
|
|
|
15956
16453
|
Email Templates
|
|
15957
16454
|
</PageTitle>
|
|
15958
16455
|
|
|
15959
|
-
<
|
|
15960
|
-
<
|
|
16456
|
+
<Show47 when={!templates.loading} fallback={<LoadingSpinner />}>
|
|
16457
|
+
<Show47 when={templateKeys().length > 0} fallback={<div class="app-admin-empty">No email templates configured.</div>}>
|
|
15961
16458
|
<div style={{ display: "flex", gap: "1.5rem", "align-items": "flex-start" }}>
|
|
15962
16459
|
{
|
|
15963
16460
|
/* Vertical template nav, grouped by category */
|
|
@@ -15975,20 +16472,20 @@ function EmailTemplates(props = {}) {
|
|
|
15975
16472
|
top: "1rem"
|
|
15976
16473
|
}}
|
|
15977
16474
|
>
|
|
15978
|
-
<
|
|
16475
|
+
<For35 each={categorizedKeys()}>
|
|
15979
16476
|
{(group) => <div style={{ "margin-bottom": "0.25rem" }}>
|
|
15980
16477
|
{groupHeader(group.label)}
|
|
15981
|
-
<
|
|
15982
|
-
<
|
|
16478
|
+
<Show47 when={!collapsed()[group.label]}>
|
|
16479
|
+
<For35 each={group.keys}>
|
|
15983
16480
|
{(key) => navButton({
|
|
15984
16481
|
label: humanize(key),
|
|
15985
16482
|
active: () => activeKey() === key,
|
|
15986
16483
|
onClick: () => handleTabSwitch(key)
|
|
15987
16484
|
})}
|
|
15988
|
-
</
|
|
15989
|
-
</
|
|
16485
|
+
</For35>
|
|
16486
|
+
</Show47>
|
|
15990
16487
|
</div>}
|
|
15991
|
-
</
|
|
16488
|
+
</For35>
|
|
15992
16489
|
|
|
15993
16490
|
{
|
|
15994
16491
|
/* Custom templates: always shown, even when empty, so the way to
|
|
@@ -15996,28 +16493,28 @@ function EmailTemplates(props = {}) {
|
|
|
15996
16493
|
}
|
|
15997
16494
|
<div style={{ "margin-bottom": "0.25rem" }}>
|
|
15998
16495
|
{groupHeader(MARKETING_LABEL)}
|
|
15999
|
-
<
|
|
16000
|
-
<
|
|
16496
|
+
<Show47 when={!collapsed()[MARKETING_LABEL]}>
|
|
16497
|
+
<For35 each={customTemplates()}>
|
|
16001
16498
|
{(t) => navButton({
|
|
16002
16499
|
label: t.name,
|
|
16003
16500
|
active: () => activeCustomId() === t.id,
|
|
16004
16501
|
onClick: () => select({ kind: "custom", id: t.id })
|
|
16005
16502
|
})}
|
|
16006
|
-
</
|
|
16503
|
+
</For35>
|
|
16007
16504
|
{navButton({
|
|
16008
16505
|
label: "+ New marketing template",
|
|
16009
16506
|
active: () => isCustomSelected() && activeCustomId() === null,
|
|
16010
16507
|
muted: true,
|
|
16011
16508
|
onClick: () => select({ kind: "custom", id: null })
|
|
16012
16509
|
})}
|
|
16013
|
-
</
|
|
16510
|
+
</Show47>
|
|
16014
16511
|
</div>
|
|
16015
16512
|
</div>
|
|
16016
16513
|
|
|
16017
16514
|
{
|
|
16018
16515
|
/* Edit form: fixed template */
|
|
16019
16516
|
}
|
|
16020
|
-
<
|
|
16517
|
+
<Show47 when={!isCustomSelected() && currentDraft()}>
|
|
16021
16518
|
{(cur) => <div class="app-admin-card" style={{ padding: "1.25rem", flex: 1, "min-width": 0 }}>
|
|
16022
16519
|
<div style={{ display: "flex", "flex-direction": "column", gap: "1.25rem" }}>
|
|
16023
16520
|
<TemplateTextEditor
|
|
@@ -16064,12 +16561,12 @@ function EmailTemplates(props = {}) {
|
|
|
16064
16561
|
</div>
|
|
16065
16562
|
</div>
|
|
16066
16563
|
</div>}
|
|
16067
|
-
</
|
|
16564
|
+
</Show47>
|
|
16068
16565
|
|
|
16069
16566
|
{
|
|
16070
16567
|
/* Edit form: custom template (new or existing) */
|
|
16071
16568
|
}
|
|
16072
|
-
<
|
|
16569
|
+
<Show47 when={isCustomSelected() && customDraft()}>
|
|
16073
16570
|
{(cd) => <div class="app-admin-card" style={{ padding: "1.25rem", flex: 1, "min-width": 0 }}>
|
|
16074
16571
|
<div style={{ display: "flex", "flex-direction": "column", gap: "1.25rem" }}>
|
|
16075
16572
|
<div>
|
|
@@ -16086,11 +16583,11 @@ function EmailTemplates(props = {}) {
|
|
|
16086
16583
|
<p style={{ "font-size": "0.75rem", color: "var(--app-admin-fg-subtle)", "margin-top": "0.25rem" }}>
|
|
16087
16584
|
How it appears when picking a template for a sequence step.
|
|
16088
16585
|
</p>
|
|
16089
|
-
<
|
|
16586
|
+
<Show47 when={(activeCustom()?.usedBy.length ?? 0) > 0}>
|
|
16090
16587
|
<p style={{ "font-size": "0.75rem", color: "var(--app-admin-fg-muted)", "margin-top": "0.25rem" }}>
|
|
16091
16588
|
Used by: {activeCustom().usedBy.map((u) => u.sequenceName).join(", ")}
|
|
16092
16589
|
</p>
|
|
16093
|
-
</
|
|
16590
|
+
</Show47>
|
|
16094
16591
|
</div>
|
|
16095
16592
|
<TemplateTextEditor
|
|
16096
16593
|
value={cd()}
|
|
@@ -16126,7 +16623,7 @@ function EmailTemplates(props = {}) {
|
|
|
16126
16623
|
>
|
|
16127
16624
|
{sendingTest() ? "Sending\u2026" : "Send Test Email"}
|
|
16128
16625
|
</button>
|
|
16129
|
-
<
|
|
16626
|
+
<Show47 when={activeCustomId()}>
|
|
16130
16627
|
<button
|
|
16131
16628
|
type="button"
|
|
16132
16629
|
onClick={() => void handleDeleteCustom()}
|
|
@@ -16135,22 +16632,22 @@ function EmailTemplates(props = {}) {
|
|
|
16135
16632
|
>
|
|
16136
16633
|
{deleting() ? "Deleting\u2026" : "Delete"}
|
|
16137
16634
|
</button>
|
|
16138
|
-
</
|
|
16635
|
+
</Show47>
|
|
16139
16636
|
</div>
|
|
16140
16637
|
</div>
|
|
16141
16638
|
</div>}
|
|
16142
|
-
</
|
|
16639
|
+
</Show47>
|
|
16143
16640
|
</div>
|
|
16144
|
-
</
|
|
16145
|
-
</
|
|
16641
|
+
</Show47>
|
|
16642
|
+
</Show47>
|
|
16146
16643
|
</div>;
|
|
16147
16644
|
}
|
|
16148
16645
|
|
|
16149
16646
|
// src/pages/admin/Funnel.tsx
|
|
16150
|
-
import { createResource as createResource23, createSignal as
|
|
16647
|
+
import { createResource as createResource23, createSignal as createSignal32, For as For37, Show as Show49 } from "solid-js";
|
|
16151
16648
|
|
|
16152
16649
|
// src/pages/admin/Sequences.tsx
|
|
16153
|
-
import { createResource as createResource22, createSignal as
|
|
16650
|
+
import { createResource as createResource22, createSignal as createSignal31, For as For36, Index, Match as Match2, Show as Show48, Switch as Switch2 } from "solid-js";
|
|
16154
16651
|
|
|
16155
16652
|
// src/pages/admin/funnelShared.ts
|
|
16156
16653
|
var SEGMENT_KEYS = {
|
|
@@ -16221,7 +16718,7 @@ var label = { "font-size": "0.8125rem", color: "var(--app-admin-fg-muted)" };
|
|
|
16221
16718
|
var field = { display: "grid", gap: "0.25rem" };
|
|
16222
16719
|
function SequenceQueue(props) {
|
|
16223
16720
|
const nav = useAdminNav();
|
|
16224
|
-
const [busy, setBusy] =
|
|
16721
|
+
const [busy, setBusy] = createSignal31(null);
|
|
16225
16722
|
const rows = () => props.rows ?? [];
|
|
16226
16723
|
const refetch = () => props.refetch();
|
|
16227
16724
|
const act = async (row, action) => {
|
|
@@ -16262,19 +16759,19 @@ function SequenceQueue(props) {
|
|
|
16262
16759
|
title="Waiting to send"
|
|
16263
16760
|
count={rows().length}
|
|
16264
16761
|
flush
|
|
16265
|
-
action={<
|
|
16762
|
+
action={<Show48 when={rows().length > 0}>
|
|
16266
16763
|
<button type="button" class="app-admin-btn app-admin-btn-primary app-admin-btn-sm" disabled={busy() === "all"} onClick={() => void sendAll()}>
|
|
16267
16764
|
Send all due
|
|
16268
16765
|
</button>
|
|
16269
|
-
</
|
|
16766
|
+
</Show48>}
|
|
16270
16767
|
>
|
|
16271
|
-
<
|
|
16768
|
+
<Show48 when={!props.sequence.autoSend}>
|
|
16272
16769
|
<p class="app-admin-text-muted" style={{ "font-size": "0.75rem", margin: 0, padding: "0.625rem 1.25rem 0" }}>
|
|
16273
16770
|
Nothing here has been emailed, and nothing will be until you send it or turn automatic sending on.
|
|
16274
16771
|
</p>
|
|
16275
|
-
</
|
|
16276
|
-
<
|
|
16277
|
-
<
|
|
16772
|
+
</Show48>
|
|
16773
|
+
<Show48 when={props.rows} fallback={<LoadingSpinner />}>
|
|
16774
|
+
<Show48
|
|
16278
16775
|
when={rows().length > 0}
|
|
16279
16776
|
fallback={<EmptyState
|
|
16280
16777
|
message={props.sequence.autoSend ? "Nothing due \u2014 the hourly check sends these itself." : "Nobody is due right now."}
|
|
@@ -16285,12 +16782,12 @@ function SequenceQueue(props) {
|
|
|
16285
16782
|
<tr><th>Person</th><th>Came from</th><th>Waiting</th><th>Step</th><th /></tr>
|
|
16286
16783
|
</thead>
|
|
16287
16784
|
<tbody>
|
|
16288
|
-
<
|
|
16785
|
+
<For36 each={rows()}>
|
|
16289
16786
|
{(row) => <tr>
|
|
16290
16787
|
<td data-label="Person">
|
|
16291
|
-
<
|
|
16788
|
+
<Show48 when={row.userId && nav} fallback={row.email}>
|
|
16292
16789
|
<button type="button" class="app-admin-link-btn" style={{ "font-size": "inherit" }} onClick={() => nav.openCustomer(row.userId)}>{row.email}</button>
|
|
16293
|
-
</
|
|
16790
|
+
</Show48>
|
|
16294
16791
|
</td>
|
|
16295
16792
|
<td data-label="Came from">{segmentLongLabel(row.segmentAtAdd)}</td>
|
|
16296
16793
|
<td data-label="Waiting">{daysAgo(row.anchoredAt)}</td>
|
|
@@ -16306,11 +16803,11 @@ function SequenceQueue(props) {
|
|
|
16306
16803
|
</div>
|
|
16307
16804
|
</td>
|
|
16308
16805
|
</tr>}
|
|
16309
|
-
</
|
|
16806
|
+
</For36>
|
|
16310
16807
|
</tbody>
|
|
16311
16808
|
</table>
|
|
16312
|
-
</
|
|
16313
|
-
</
|
|
16809
|
+
</Show48>
|
|
16810
|
+
</Show48>
|
|
16314
16811
|
</Section>;
|
|
16315
16812
|
}
|
|
16316
16813
|
var OUTCOME_LABEL = {
|
|
@@ -16324,8 +16821,8 @@ var OUTCOME_LABEL = {
|
|
|
16324
16821
|
};
|
|
16325
16822
|
function AddToSequence(props) {
|
|
16326
16823
|
const [sequences] = createResource22(() => apiFetch("/admin/funnel/sequences"));
|
|
16327
|
-
const [target, setTarget] =
|
|
16328
|
-
const [busy, setBusy] =
|
|
16824
|
+
const [target, setTarget] = createSignal31("");
|
|
16825
|
+
const [busy, setBusy] = createSignal31(false);
|
|
16329
16826
|
const add = async () => {
|
|
16330
16827
|
if (!target() || props.people.length === 0) return;
|
|
16331
16828
|
setBusy(true);
|
|
@@ -16348,14 +16845,14 @@ function AddToSequence(props) {
|
|
|
16348
16845
|
return <div style={{ display: "flex", gap: "0.5rem", "align-items": "center", "flex-wrap": "wrap" }}>
|
|
16349
16846
|
<select class="app-admin-input" style={{ width: "auto" }} value={target()} onChange={(e) => setTarget(e.currentTarget.value)} aria-label="Sequence">
|
|
16350
16847
|
<option value="">Add to sequence…</option>
|
|
16351
|
-
<
|
|
16848
|
+
<For36 each={sequences()?.sequences ?? []}>{(s) => <option value={s.id}>{s.name}</option>}</For36>
|
|
16352
16849
|
</select>
|
|
16353
16850
|
<button type="button" class="app-admin-btn app-admin-btn-primary app-admin-btn-sm" disabled={busy() || !target() || props.people.length === 0} onClick={() => void add()}>
|
|
16354
16851
|
{busy() ? "Adding\u2026" : `Add ${props.people.length}`}
|
|
16355
16852
|
</button>
|
|
16356
|
-
<
|
|
16853
|
+
<Show48 when={sequences() && sequences().sequences.length === 0}>
|
|
16357
16854
|
<span class="app-admin-text-muted" style={{ "font-size": "0.75rem" }}>No sequences yet — create one in the Sequences tab.</span>
|
|
16358
|
-
</
|
|
16855
|
+
</Show48>
|
|
16359
16856
|
</div>;
|
|
16360
16857
|
}
|
|
16361
16858
|
function StepRow(props) {
|
|
@@ -16381,10 +16878,10 @@ function StepRow(props) {
|
|
|
16381
16878
|
</label>
|
|
16382
16879
|
<select class="app-admin-input" aria-label={`Step ${props.index + 1} template`} value={props.step.templateId} onChange={(e) => set("templateId", e.currentTarget.value)}>
|
|
16383
16880
|
<option value="">Choose a template…</option>
|
|
16384
|
-
<
|
|
16881
|
+
<Show48 when={missingTemplate()}>
|
|
16385
16882
|
<option value={props.step.templateId}>(deleted template)</option>
|
|
16386
|
-
</
|
|
16387
|
-
<
|
|
16883
|
+
</Show48>
|
|
16884
|
+
<For36 each={props.templates}>{(t) => <option value={t.id}>{t.name}</option>}</For36>
|
|
16388
16885
|
</select>
|
|
16389
16886
|
{
|
|
16390
16887
|
/* Straight to the copy: the template opens in Email › Templates. */
|
|
@@ -16403,10 +16900,10 @@ function StepRow(props) {
|
|
|
16403
16900
|
/* A saved step can name a destination this site no longer offers (its
|
|
16404
16901
|
cart was removed); keep it visible so the rep sees what to fix. */
|
|
16405
16902
|
}
|
|
16406
|
-
<
|
|
16903
|
+
<Show48 when={props.step.link && !props.links.includes(props.step.link)}>
|
|
16407
16904
|
<option value={props.step.link}>{LINK_LABEL[props.step.link]} (unavailable)</option>
|
|
16408
|
-
</
|
|
16409
|
-
<
|
|
16905
|
+
</Show48>
|
|
16906
|
+
<For36 each={props.links}>{(l) => <option value={l}>{LINK_LABEL[l]}</option>}</For36>
|
|
16410
16907
|
</select>
|
|
16411
16908
|
<div style={{ display: "flex", gap: "0.25rem" }}>
|
|
16412
16909
|
<button type="button" class="app-admin-btn app-admin-btn-ghost app-admin-btn-sm" disabled={!props.canTest} title={props.canTest ? "Email this step to me" : "Save first"} onClick={() => props.onTest()}>Test</button>
|
|
@@ -16417,9 +16914,9 @@ function StepRow(props) {
|
|
|
16417
16914
|
var checkboxRow = { "font-size": "0.8125rem", display: "flex", gap: "0.5rem", "align-items": "flex-start" };
|
|
16418
16915
|
function SequenceEditor(props) {
|
|
16419
16916
|
const nav = useAdminNav();
|
|
16420
|
-
const [draft, setDraft] =
|
|
16421
|
-
const [saving, setSaving] =
|
|
16422
|
-
const [error, setError] =
|
|
16917
|
+
const [draft, setDraft] = createSignal31(JSON.parse(JSON.stringify(props.initial)));
|
|
16918
|
+
const [saving, setSaving] = createSignal31(false);
|
|
16919
|
+
const [error, setError] = createSignal31(null);
|
|
16423
16920
|
const isNew = () => !draft().id;
|
|
16424
16921
|
const dirty = () => JSON.stringify(draft()) !== JSON.stringify(props.initial);
|
|
16425
16922
|
const [enrollments, { refetch: refetchEnrollments }] = createResource22(
|
|
@@ -16431,7 +16928,7 @@ function SequenceEditor(props) {
|
|
|
16431
16928
|
() => apiFetch("/admin/funnel/queue")
|
|
16432
16929
|
);
|
|
16433
16930
|
const dueRows = () => queue() ? queue().due.filter((r) => r.sequenceId === props.initial.id) : void 0;
|
|
16434
|
-
const [tab, setTab] =
|
|
16931
|
+
const [tab, setTab] = createSignal31(isNew() ? "settings" : "queue");
|
|
16435
16932
|
const tabKeys = () => isNew() ? ["steps", "settings"] : ["queue", "steps", "people", "settings"];
|
|
16436
16933
|
const TAB_LABEL = { queue: "Queue", steps: "Steps", people: "People", settings: "Settings" };
|
|
16437
16934
|
const tabCount = (key) => key === "queue" ? dueRows()?.length : key === "steps" ? draft().steps.length : key === "people" ? enrollments()?.enrollments.length : void 0;
|
|
@@ -16504,30 +17001,30 @@ function SequenceEditor(props) {
|
|
|
16504
17001
|
badges={<>
|
|
16505
17002
|
<span class={`app-admin-badge app-admin-badge--${draft().autoSend ? "success" : "info"}`} style={{ "text-transform": "none" }}>{draft().autoSend ? "Sends automatically" : "Sends on review"}</span>
|
|
16506
17003
|
<span class="app-admin-badge app-admin-badge--neutral" style={{ "text-transform": "none" }}>{feedSummary()}</span>
|
|
16507
|
-
<
|
|
17004
|
+
<Show48 when={!isNew() && enrollments()}>
|
|
16508
17005
|
<span class="app-admin-badge app-admin-badge--neutral" style={{ "text-transform": "none" }}>{enrollments().enrollments.length} in it</span>
|
|
16509
|
-
</
|
|
17006
|
+
</Show48>
|
|
16510
17007
|
</>}
|
|
16511
17008
|
actions={<>
|
|
16512
|
-
<
|
|
17009
|
+
<Show48 when={!isNew()}>
|
|
16513
17010
|
<button type="button" class="app-admin-btn app-admin-btn-ghost app-admin-btn-sm" onClick={() => void archive()}>Archive</button>
|
|
16514
|
-
</
|
|
17011
|
+
</Show48>
|
|
16515
17012
|
<button type="button" class="app-admin-btn app-admin-btn-primary" disabled={saving() || !isNew() && !dirty()} onClick={() => void save()}>
|
|
16516
17013
|
{saving() ? "Saving\u2026" : isNew() ? "Create sequence" : "Save changes"}
|
|
16517
17014
|
</button>
|
|
16518
17015
|
</>}
|
|
16519
17016
|
/>
|
|
16520
17017
|
|
|
16521
|
-
<
|
|
17018
|
+
<Show48 when={error()}>
|
|
16522
17019
|
<AlertItem severity="danger" title="Could not save" detail={error()} />
|
|
16523
|
-
</
|
|
17020
|
+
</Show48>
|
|
16524
17021
|
|
|
16525
17022
|
<nav
|
|
16526
17023
|
role="tablist"
|
|
16527
17024
|
aria-label="Sequence sections"
|
|
16528
17025
|
style={{ display: "flex", gap: "0.25rem", "border-bottom": "1px solid var(--app-admin-border)", margin: "1rem 0 1.25rem" }}
|
|
16529
17026
|
>
|
|
16530
|
-
<
|
|
17027
|
+
<For36 each={tabKeys()}>
|
|
16531
17028
|
{(key) => <button
|
|
16532
17029
|
type="button"
|
|
16533
17030
|
role="tab"
|
|
@@ -16551,11 +17048,11 @@ function SequenceEditor(props) {
|
|
|
16551
17048
|
}}
|
|
16552
17049
|
>
|
|
16553
17050
|
{TAB_LABEL[key]}
|
|
16554
|
-
<
|
|
17051
|
+
<Show48 when={tabCount(key) !== void 0}>
|
|
16555
17052
|
<span style={{ "margin-left": "0.375rem", opacity: 0.7 }}>{tabCount(key)}</span>
|
|
16556
|
-
</
|
|
17053
|
+
</Show48>
|
|
16557
17054
|
</button>}
|
|
16558
|
-
</
|
|
17055
|
+
</For36>
|
|
16559
17056
|
</nav>
|
|
16560
17057
|
|
|
16561
17058
|
<Switch2>
|
|
@@ -16571,19 +17068,19 @@ function SequenceEditor(props) {
|
|
|
16571
17068
|
Add step
|
|
16572
17069
|
</button>}
|
|
16573
17070
|
>
|
|
16574
|
-
<
|
|
17071
|
+
<Show48
|
|
16575
17072
|
when={props.templates.length > 0}
|
|
16576
17073
|
fallback={<div style={{ padding: "1rem 1.25rem", display: "flex", gap: "0.75rem", "align-items": "center", "flex-wrap": "wrap" }}>
|
|
16577
17074
|
<span class="app-admin-text-muted" style={{ "font-size": "0.8125rem" }}>A step sends a marketing template. Create one under Email › Templates first.</span>
|
|
16578
|
-
<
|
|
17075
|
+
<Show48 when={nav}>
|
|
16579
17076
|
<button type="button" class="app-admin-btn app-admin-btn-sm" onClick={() => nav.selectTab("email-templates")}>Open Email › Templates</button>
|
|
16580
|
-
</
|
|
17077
|
+
</Show48>
|
|
16581
17078
|
</div>}
|
|
16582
17079
|
>
|
|
16583
17080
|
<p class="app-admin-text-muted" style={{ "font-size": "0.75rem", margin: 0, padding: "0.625rem 1.25rem 0" }}>
|
|
16584
17081
|
Each step waits the given hours after the previous one (the first, after enrollment), then sends its template with the chosen link.
|
|
16585
17082
|
</p>
|
|
16586
|
-
<
|
|
17083
|
+
<Index each={draft().steps}>
|
|
16587
17084
|
{(step, i) => <StepRow
|
|
16588
17085
|
index={i}
|
|
16589
17086
|
step={step()}
|
|
@@ -16595,25 +17092,25 @@ function SequenceEditor(props) {
|
|
|
16595
17092
|
onRemove={() => update({ steps: draft().steps.filter((_, j) => j !== i) })}
|
|
16596
17093
|
onTest={() => void test(i)}
|
|
16597
17094
|
/>}
|
|
16598
|
-
</
|
|
16599
|
-
</
|
|
17095
|
+
</Index>
|
|
17096
|
+
</Show48>
|
|
16600
17097
|
</Section>
|
|
16601
17098
|
</Match2>
|
|
16602
17099
|
<Match2 when={tab() === "people"}>
|
|
16603
17100
|
<Section title="People in this sequence" count={enrollments()?.enrollments.length} flush>
|
|
16604
|
-
<
|
|
16605
|
-
<
|
|
17101
|
+
<Show48 when={enrollments()} fallback={<LoadingSpinner />}>
|
|
17102
|
+
<Show48 when={enrollments().enrollments.length > 0} fallback={<EmptyState message="Nobody yet. Add people from the Funnel tab, or feed the sequence from a segment." />}>
|
|
16606
17103
|
<table class="app-admin-table">
|
|
16607
17104
|
<thead>
|
|
16608
17105
|
<tr><th>Person</th><th>Came from</th><th>Step</th><th>Next due</th><th /></tr>
|
|
16609
17106
|
</thead>
|
|
16610
17107
|
<tbody>
|
|
16611
|
-
<
|
|
17108
|
+
<For36 each={enrollments().enrollments}>
|
|
16612
17109
|
{(e) => <tr>
|
|
16613
17110
|
<td data-label="Person">
|
|
16614
|
-
<
|
|
17111
|
+
<Show48 when={e.userId && nav} fallback={e.email}>
|
|
16615
17112
|
<button type="button" class="app-admin-link-btn" style={{ "font-size": "inherit" }} onClick={() => nav.openCustomer(e.userId)}>{e.email}</button>
|
|
16616
|
-
</
|
|
17113
|
+
</Show48>
|
|
16617
17114
|
<div class="app-admin-text-muted" style={{ "font-size": "0.75rem" }}>{e.source === "feed" ? "enrolled by the feed" : "added by hand"} · {formatDate(e.addedAt)}</div>
|
|
16618
17115
|
</td>
|
|
16619
17116
|
<td data-label="Came from">{segmentLongLabel(e.segmentAtAdd)}</td>
|
|
@@ -16621,11 +17118,11 @@ function SequenceEditor(props) {
|
|
|
16621
17118
|
<td data-label="Next due" class="app-admin-text-muted">{e.nextDueAt ? formatDate(e.nextDueAt) : "\u2014"}</td>
|
|
16622
17119
|
<td class="app-admin-table-cell--end"><button type="button" class="app-admin-btn app-admin-btn-ghost app-admin-btn-sm" onClick={() => void remove(e)}>Remove</button></td>
|
|
16623
17120
|
</tr>}
|
|
16624
|
-
</
|
|
17121
|
+
</For36>
|
|
16625
17122
|
</tbody>
|
|
16626
17123
|
</table>
|
|
16627
|
-
</
|
|
16628
|
-
</
|
|
17124
|
+
</Show48>
|
|
17125
|
+
</Show48>
|
|
16629
17126
|
</Section>
|
|
16630
17127
|
</Match2>
|
|
16631
17128
|
<Match2 when={tab() === "settings"}>
|
|
@@ -16660,20 +17157,20 @@ function SequenceEditor(props) {
|
|
|
16660
17157
|
<p class="app-admin-text-muted" style={{ "font-size": "0.75rem", margin: 0 }}>
|
|
16661
17158
|
Anyone you add from the Funnel tab. Tick segments to also enroll whoever enters them (the hourly check adds and removes them; their clock starts at their own entry).
|
|
16662
17159
|
</p>
|
|
16663
|
-
<
|
|
17160
|
+
<For36 each={["a", "b"]}>
|
|
16664
17161
|
{(g) => <div>
|
|
16665
17162
|
<div style={{ ...label, "font-size": "0.75rem", "margin-bottom": "0.25rem" }}>{GROUP_LABEL[g]}</div>
|
|
16666
17163
|
<div style={{ display: "grid", gap: "0.25rem" }}>
|
|
16667
|
-
<
|
|
17164
|
+
<For36 each={SEGMENT_KEYS[g]}>
|
|
16668
17165
|
{(key) => <label style={{ "font-size": "0.8125rem", display: "flex", gap: "0.375rem", "align-items": "center" }}>
|
|
16669
17166
|
<input type="checkbox" checked={draft().feedSegments.includes(key)} onChange={() => toggleSegment(key)} />
|
|
16670
17167
|
{SEGMENT_LABEL[key]}
|
|
16671
17168
|
</label>}
|
|
16672
|
-
</
|
|
17169
|
+
</For36>
|
|
16673
17170
|
</div>
|
|
16674
17171
|
</div>}
|
|
16675
|
-
</
|
|
16676
|
-
<
|
|
17172
|
+
</For36>
|
|
17173
|
+
<Show48 when={draft().feedSegments.length > 0}>
|
|
16677
17174
|
<label style={field}>
|
|
16678
17175
|
<span style={label}>Only enroll people who entered in the last (days)</span>
|
|
16679
17176
|
<input class="app-admin-input" type="number" min="1" max="365" value={draft().feedMaxAgeDays ?? 30} onInput={(e) => update({ feedMaxAgeDays: Number(e.currentTarget.value) })} />
|
|
@@ -16683,7 +17180,7 @@ function SequenceEditor(props) {
|
|
|
16683
17180
|
<input type="checkbox" checked={draft().feedQualifiedOnly} onChange={(e) => update({ feedQualifiedOnly: e.currentTarget.checked })} />
|
|
16684
17181
|
Skip people whose questionnaire did not qualify
|
|
16685
17182
|
</label>
|
|
16686
|
-
</
|
|
17183
|
+
</Show48>
|
|
16687
17184
|
</div>
|
|
16688
17185
|
</Section>
|
|
16689
17186
|
</div>
|
|
@@ -16692,11 +17189,11 @@ function SequenceEditor(props) {
|
|
|
16692
17189
|
</div>;
|
|
16693
17190
|
}
|
|
16694
17191
|
function Sequences() {
|
|
16695
|
-
const [reload, setReload] =
|
|
17192
|
+
const [reload, setReload] = createSignal31(0);
|
|
16696
17193
|
const [list, { refetch }] = createResource22(reload, () => apiFetch("/admin/funnel/sequences"));
|
|
16697
17194
|
const [emailTemplates] = createResource22(() => adminApi.getEmailTemplates());
|
|
16698
17195
|
const customTemplates = () => emailTemplates()?.customTemplates ?? [];
|
|
16699
|
-
const [editing, setEditing] =
|
|
17196
|
+
const [editing, setEditing] = createSignal31(null);
|
|
16700
17197
|
const [queue, { refetch: refetchQueue }] = createResource22(reload, () => apiFetch("/admin/funnel/queue").catch(() => ({ due: [] })));
|
|
16701
17198
|
const dueFor = (id) => (queue()?.due ?? []).filter((d) => d.sequenceId === id).length;
|
|
16702
17199
|
const changed = () => {
|
|
@@ -16704,29 +17201,29 @@ function Sequences() {
|
|
|
16704
17201
|
void refetchQueue();
|
|
16705
17202
|
};
|
|
16706
17203
|
return <div>
|
|
16707
|
-
<
|
|
17204
|
+
<Show48 when={!editing()}>
|
|
16708
17205
|
<PageTitle subtitle="Timed emails for people who stopped short of a subscription">Sequences</PageTitle>
|
|
16709
|
-
</
|
|
17206
|
+
</Show48>
|
|
16710
17207
|
|
|
16711
|
-
<
|
|
17208
|
+
<Show48
|
|
16712
17209
|
when={editing()}
|
|
16713
17210
|
fallback={<div class="app-admin-card" style={{ "margin-top": "1.25rem", overflow: "hidden" }}>
|
|
16714
17211
|
<div style={{ padding: "1rem 1.25rem", "border-bottom": "1px solid var(--app-admin-border-soft)", display: "flex", "justify-content": "space-between", "align-items": "center" }}>
|
|
16715
17212
|
<h2 class="app-admin-heading" style={{ "font-size": "0.9375rem", "font-weight": "600", margin: 0 }}>Sequences</h2>
|
|
16716
17213
|
<button type="button" class="app-admin-btn app-admin-btn-primary app-admin-btn-sm" onClick={() => setEditing(blankSequence())}>New sequence</button>
|
|
16717
17214
|
</div>
|
|
16718
|
-
<
|
|
16719
|
-
<
|
|
17215
|
+
<Show48 when={list()} fallback={<LoadingSpinner />}>
|
|
17216
|
+
<Show48 when={list().sequences.length > 0} fallback={<EmptyState message="No sequences yet. Create one, then add people from the Funnel tab." />}>
|
|
16720
17217
|
<table class="app-admin-table">
|
|
16721
17218
|
<thead>
|
|
16722
17219
|
<tr><th>Name</th><th>Steps</th><th>Fed by</th><th>Sending</th><th>In it</th><th>Due now</th><th>Sent</th><th>Bought</th><th>Unsubscribed</th></tr>
|
|
16723
17220
|
</thead>
|
|
16724
17221
|
<tbody>
|
|
16725
|
-
<
|
|
17222
|
+
<For36 each={list().sequences}>
|
|
16726
17223
|
{(s) => <tr>
|
|
16727
17224
|
<td data-label="Name">
|
|
16728
17225
|
<button type="button" class="app-admin-link-btn" style={{ "font-size": "inherit", "font-weight": "600" }} onClick={() => setEditing(s)}>{s.name}</button>
|
|
16729
|
-
<
|
|
17226
|
+
<Show48 when={s.description}><div class="app-admin-text-muted" style={{ "font-size": "0.75rem" }}>{s.description}</div></Show48>
|
|
16730
17227
|
</td>
|
|
16731
17228
|
<td data-label="Steps">{s.steps.length}</td>
|
|
16732
17229
|
<td data-label="Fed by">{s.feedSegments.length > 0 ? `${s.feedSegments.length} segment${s.feedSegments.length === 1 ? "" : "s"}, \u2264${s.feedMaxAgeDays}d` : <span class="app-admin-text-muted">by hand</span>}</td>
|
|
@@ -16737,11 +17234,11 @@ function Sequences() {
|
|
|
16737
17234
|
<td data-label="Bought">{s.stats.boughtAfterEnroll}</td>
|
|
16738
17235
|
<td data-label="Unsubscribed">{s.stats.unsubscribed}</td>
|
|
16739
17236
|
</tr>}
|
|
16740
|
-
</
|
|
17237
|
+
</For36>
|
|
16741
17238
|
</tbody>
|
|
16742
17239
|
</table>
|
|
16743
|
-
</
|
|
16744
|
-
</
|
|
17240
|
+
</Show48>
|
|
17241
|
+
</Show48>
|
|
16745
17242
|
</div>}
|
|
16746
17243
|
>
|
|
16747
17244
|
{(seq) => <SequenceEditor
|
|
@@ -16755,7 +17252,7 @@ function Sequences() {
|
|
|
16755
17252
|
onClose={() => setEditing(null)}
|
|
16756
17253
|
onChanged={changed}
|
|
16757
17254
|
/>}
|
|
16758
|
-
</
|
|
17255
|
+
</Show48>
|
|
16759
17256
|
</div>;
|
|
16760
17257
|
}
|
|
16761
17258
|
|
|
@@ -16763,11 +17260,11 @@ function Sequences() {
|
|
|
16763
17260
|
function CardHeader(props) {
|
|
16764
17261
|
return <div style={{ padding: "1rem 1.25rem", "border-bottom": "1px solid var(--app-admin-border-soft)" }}>
|
|
16765
17262
|
<h2 class="app-admin-heading" style={{ "font-size": "0.9375rem", "font-weight": "600", margin: 0 }}>{props.title}</h2>
|
|
16766
|
-
<
|
|
17263
|
+
<Show49 when={props.note}>
|
|
16767
17264
|
<p style={{ "font-size": "0.75rem", color: "var(--app-admin-fg-muted)", margin: "0.25rem 0 0" }}>
|
|
16768
17265
|
{props.note}
|
|
16769
17266
|
</p>
|
|
16770
|
-
</
|
|
17267
|
+
</Show49>
|
|
16771
17268
|
</div>;
|
|
16772
17269
|
}
|
|
16773
17270
|
function stoppedAt(p) {
|
|
@@ -16780,9 +17277,9 @@ function stoppedAt(p) {
|
|
|
16780
17277
|
}
|
|
16781
17278
|
function SegmentSection(props) {
|
|
16782
17279
|
const nav = useAdminNav();
|
|
16783
|
-
const [filter, setFilter] =
|
|
16784
|
-
const [savingsOnly, setSavingsOnly] =
|
|
16785
|
-
const [selected, setSelected] =
|
|
17280
|
+
const [filter, setFilter] = createSignal32("all");
|
|
17281
|
+
const [savingsOnly, setSavingsOnly] = createSignal32(false);
|
|
17282
|
+
const [selected, setSelected] = createSignal32({});
|
|
16786
17283
|
const [people, { refetch }] = createResource23(
|
|
16787
17284
|
() => ({ days: props.days, filter: filter(), savings: savingsOnly() }),
|
|
16788
17285
|
(q) => apiFetch(
|
|
@@ -16799,7 +17296,7 @@ function SegmentSection(props) {
|
|
|
16799
17296
|
<CardHeader title={`${props.title} \u2014 ${props.summary.total}`} note={props.note} />
|
|
16800
17297
|
|
|
16801
17298
|
<div style={{ padding: "1rem 1.25rem", display: "grid", gap: "0.5rem" }}>
|
|
16802
|
-
<
|
|
17299
|
+
<For37 each={props.summary.segments}>
|
|
16803
17300
|
{(seg) => <button
|
|
16804
17301
|
type="button"
|
|
16805
17302
|
onClick={() => setFilter(filter() === seg.key ? "all" : seg.key)}
|
|
@@ -16837,20 +17334,20 @@ function SegmentSection(props) {
|
|
|
16837
17334
|
</span>
|
|
16838
17335
|
<span style={{ "font-size": "0.8125rem", "text-align": "right" }}>
|
|
16839
17336
|
{seg.count}
|
|
16840
|
-
<
|
|
17337
|
+
<Show49 when={hasSavings()}>
|
|
16841
17338
|
<span style={{ color: "var(--app-admin-fg-subtle)", "margin-left": "0.375rem" }}>
|
|
16842
17339
|
{seg.savingsMembers} savings
|
|
16843
17340
|
</span>
|
|
16844
|
-
</
|
|
17341
|
+
</Show49>
|
|
16845
17342
|
</span>
|
|
16846
17343
|
</button>}
|
|
16847
|
-
</
|
|
16848
|
-
<
|
|
17344
|
+
</For37>
|
|
17345
|
+
<Show49 when={hasSavings()}>
|
|
16849
17346
|
<label style={{ "font-size": "0.8125rem", display: "flex", gap: "0.375rem", "align-items": "center", "margin-top": "0.25rem" }}>
|
|
16850
17347
|
<input type="checkbox" checked={savingsOnly()} onChange={(e) => setSavingsOnly(e.currentTarget.checked)} />
|
|
16851
17348
|
Savings program only ({props.summary.savingsMembers})
|
|
16852
17349
|
</label>
|
|
16853
|
-
</
|
|
17350
|
+
</Show49>
|
|
16854
17351
|
</div>
|
|
16855
17352
|
|
|
16856
17353
|
<div style={{ padding: "0.5rem 1.25rem 0.75rem", "border-top": "1px solid var(--app-admin-border-soft)" }}>
|
|
@@ -16872,16 +17369,16 @@ function SegmentSection(props) {
|
|
|
16872
17369
|
<th>Person</th>
|
|
16873
17370
|
<th>Where they stopped</th>
|
|
16874
17371
|
<th>Since</th>
|
|
16875
|
-
<
|
|
17372
|
+
<Show49 when={props.group === "b"}><th>Account</th></Show49>
|
|
16876
17373
|
</tr>
|
|
16877
17374
|
</thead>
|
|
16878
17375
|
<tbody>
|
|
16879
|
-
<
|
|
16880
|
-
{(page) => <
|
|
17376
|
+
<Show49 when={people()} fallback={<tr><td colSpan={5}><LoadingSpinner /></td></tr>}>
|
|
17377
|
+
{(page) => <Show49
|
|
16881
17378
|
when={page().people.length > 0}
|
|
16882
17379
|
fallback={<tr><td colSpan={5}><EmptyState message="Nobody here in this window" /></td></tr>}
|
|
16883
17380
|
>
|
|
16884
|
-
<
|
|
17381
|
+
<For37 each={page().people}>
|
|
16885
17382
|
{(p) => <tr>
|
|
16886
17383
|
<td>
|
|
16887
17384
|
<input
|
|
@@ -16894,7 +17391,7 @@ function SegmentSection(props) {
|
|
|
16894
17391
|
</td>
|
|
16895
17392
|
<td data-label="Person">
|
|
16896
17393
|
<div>
|
|
16897
|
-
<
|
|
17394
|
+
<Show49
|
|
16898
17395
|
when={p.userId && nav}
|
|
16899
17396
|
fallback={p.name || p.email}
|
|
16900
17397
|
>
|
|
@@ -16906,44 +17403,44 @@ function SegmentSection(props) {
|
|
|
16906
17403
|
>
|
|
16907
17404
|
{p.name || p.email}
|
|
16908
17405
|
</button>
|
|
16909
|
-
</
|
|
16910
|
-
<
|
|
17406
|
+
</Show49>
|
|
17407
|
+
<Show49 when={p.optedOut}>
|
|
16911
17408
|
<span class="app-admin-badge app-admin-badge--neutral" style={{ "margin-left": "0.5rem" }}>
|
|
16912
17409
|
Opted out
|
|
16913
17410
|
</span>
|
|
16914
|
-
</
|
|
17411
|
+
</Show49>
|
|
16915
17412
|
</div>
|
|
16916
|
-
<
|
|
17413
|
+
<Show49 when={p.name}>
|
|
16917
17414
|
<div class="app-admin-text-muted" style={{ "font-size": "0.75rem" }}>{p.email}</div>
|
|
16918
|
-
</
|
|
17415
|
+
</Show49>
|
|
16919
17416
|
</td>
|
|
16920
17417
|
<td data-label="Where they stopped">{stoppedAt(p)}</td>
|
|
16921
17418
|
<td data-label="Since" class="app-admin-text-muted">{formatDate(p.enteredAt)}</td>
|
|
16922
|
-
<
|
|
17419
|
+
<Show49 when={props.group === "b"}>
|
|
16923
17420
|
<td data-label="Account">
|
|
16924
17421
|
<span class="app-admin-text-muted">{p.accountCreatedAt ? formatDate(p.accountCreatedAt) : "\u2014"}</span>
|
|
16925
|
-
<
|
|
17422
|
+
<Show49 when={p.savingsMember}>
|
|
16926
17423
|
<span class="app-admin-badge app-admin-badge--info" style={{ "margin-left": "0.5rem" }}>
|
|
16927
17424
|
Savings
|
|
16928
17425
|
</span>
|
|
16929
|
-
</
|
|
17426
|
+
</Show49>
|
|
16930
17427
|
</td>
|
|
16931
|
-
</
|
|
17428
|
+
</Show49>
|
|
16932
17429
|
</tr>}
|
|
16933
|
-
</
|
|
16934
|
-
</
|
|
16935
|
-
</
|
|
17430
|
+
</For37>
|
|
17431
|
+
</Show49>}
|
|
17432
|
+
</Show49>
|
|
16936
17433
|
</tbody>
|
|
16937
17434
|
</table>
|
|
16938
|
-
<
|
|
17435
|
+
<Show49 when={people()?.hasMore}>
|
|
16939
17436
|
<p class="app-admin-text-muted" style={{ "font-size": "0.75rem", padding: "0.625rem 1.25rem", margin: 0 }}>
|
|
16940
17437
|
Showing the 50 most recent of {people().total}.
|
|
16941
17438
|
</p>
|
|
16942
|
-
</
|
|
17439
|
+
</Show49>
|
|
16943
17440
|
</div>;
|
|
16944
17441
|
}
|
|
16945
17442
|
function Funnel() {
|
|
16946
|
-
const [days, setDays] =
|
|
17443
|
+
const [days, setDays] = createSignal32(30);
|
|
16947
17444
|
const [summary] = createResource23(
|
|
16948
17445
|
days,
|
|
16949
17446
|
(d) => apiFetch(`/admin/funnel/summary?days=${d}`)
|
|
@@ -16969,7 +17466,7 @@ function Funnel() {
|
|
|
16969
17466
|
</select>
|
|
16970
17467
|
</div>
|
|
16971
17468
|
|
|
16972
|
-
<
|
|
17469
|
+
<Show49 when={segments()} fallback={<LoadingSpinner />}>
|
|
16973
17470
|
{(seg) => <>
|
|
16974
17471
|
<SegmentSection
|
|
16975
17472
|
group="a"
|
|
@@ -16986,16 +17483,16 @@ function Funnel() {
|
|
|
16986
17483
|
days={days()}
|
|
16987
17484
|
/>
|
|
16988
17485
|
</>}
|
|
16989
|
-
</
|
|
17486
|
+
</Show49>
|
|
16990
17487
|
|
|
16991
|
-
<
|
|
17488
|
+
<Show49 when={summary()}>
|
|
16992
17489
|
{(s) => <div class="app-admin-card" style={{ "margin-top": "1.25rem" }}>
|
|
16993
17490
|
<CardHeader
|
|
16994
17491
|
title="Where abandons quit"
|
|
16995
17492
|
note={"Survey progress at last activity \u2014 the final bucket is the contact-info step. Leaving the page counts immediately; a silently-dropped session counts after 4 quiet hours." + (s().sessions.active > 0 ? ` ${s().sessions.active} session${s().sessions.active === 1 ? "" : "s"} still in progress \u2014 not counted yet.` : "")}
|
|
16996
17493
|
/>
|
|
16997
17494
|
<div style={{ padding: "1.25rem", display: "flex", "align-items": "flex-end", gap: "0.375rem", height: "9rem" }}>
|
|
16998
|
-
<
|
|
17495
|
+
<For37 each={s().stepDropoff}>
|
|
16999
17496
|
{(b) => <div
|
|
17000
17497
|
style={{
|
|
17001
17498
|
flex: 1,
|
|
@@ -17008,9 +17505,9 @@ function Funnel() {
|
|
|
17008
17505
|
}}
|
|
17009
17506
|
title={`${b.bucket * 10}% through: ${b.count} abandon${b.count === 1 ? "" : "s"}`}
|
|
17010
17507
|
>
|
|
17011
|
-
<
|
|
17508
|
+
<Show49 when={b.count > 0}>
|
|
17012
17509
|
<span style={{ "font-size": "0.6875rem", color: "var(--app-admin-fg-muted)" }}>{b.count}</span>
|
|
17013
|
-
</
|
|
17510
|
+
</Show49>
|
|
17014
17511
|
<div
|
|
17015
17512
|
style={{
|
|
17016
17513
|
width: "100%",
|
|
@@ -17024,15 +17521,15 @@ function Funnel() {
|
|
|
17024
17521
|
{b.bucket === 0 ? "Start" : b.bucket === 10 ? "Info" : b.bucket === 5 ? "50%" : ""}
|
|
17025
17522
|
</span>
|
|
17026
17523
|
</div>}
|
|
17027
|
-
</
|
|
17524
|
+
</For37>
|
|
17028
17525
|
</div>
|
|
17029
17526
|
</div>}
|
|
17030
|
-
</
|
|
17527
|
+
</Show49>
|
|
17031
17528
|
</div>;
|
|
17032
17529
|
}
|
|
17033
17530
|
|
|
17034
17531
|
// src/pages/admin/EmailNotifications.tsx
|
|
17035
|
-
import { createResource as createResource24, createSignal as
|
|
17532
|
+
import { createResource as createResource24, createSignal as createSignal33, For as For38, Show as Show50 } from "solid-js";
|
|
17036
17533
|
function humanize2(key) {
|
|
17037
17534
|
return key.replace(/([A-Z])/g, " $1").replace(/[_-]/g, " ").replace(/^\w/, (c) => c.toUpperCase()).trim();
|
|
17038
17535
|
}
|
|
@@ -17051,9 +17548,9 @@ function Card(props) {
|
|
|
17051
17548
|
>
|
|
17052
17549
|
<div>
|
|
17053
17550
|
<h2 class="app-admin-heading" style={{ "font-size": "0.9375rem", "font-weight": "600", margin: 0 }}>{props.title}</h2>
|
|
17054
|
-
<
|
|
17551
|
+
<Show50 when={props.note}>
|
|
17055
17552
|
<p style={{ ...label2, "font-size": "0.75rem", margin: "0.25rem 0 0" }}>{props.note}</p>
|
|
17056
|
-
</
|
|
17553
|
+
</Show50>
|
|
17057
17554
|
</div>
|
|
17058
17555
|
{props.aside}
|
|
17059
17556
|
</div>
|
|
@@ -17068,9 +17565,9 @@ function Toggle(props) {
|
|
|
17068
17565
|
}
|
|
17069
17566
|
function NotificationsCard() {
|
|
17070
17567
|
const [saved, { mutate }] = createResource24(() => adminApi.getEmailNotifications());
|
|
17071
|
-
const [draft, setDraft] =
|
|
17072
|
-
const [newEmail, setNewEmail] =
|
|
17073
|
-
const [saving, setSaving] =
|
|
17568
|
+
const [draft, setDraft] = createSignal33(null);
|
|
17569
|
+
const [newEmail, setNewEmail] = createSignal33("");
|
|
17570
|
+
const [saving, setSaving] = createSignal33(false);
|
|
17074
17571
|
const current2 = () => draft() ?? saved() ?? null;
|
|
17075
17572
|
const update = (patch) => setDraft({ ...current2(), ...patch });
|
|
17076
17573
|
const dirty = () => !!draft() && JSON.stringify(draft()) !== JSON.stringify(saved());
|
|
@@ -17103,12 +17600,12 @@ function NotificationsCard() {
|
|
|
17103
17600
|
{saving() ? "Saving\u2026" : "Save"}
|
|
17104
17601
|
</button>}
|
|
17105
17602
|
>
|
|
17106
|
-
<
|
|
17603
|
+
<Show50 when={current2()} fallback={<LoadingSpinner />}>
|
|
17107
17604
|
{(s) => <>
|
|
17108
17605
|
<div>
|
|
17109
17606
|
<div style={{ ...label2, "margin-bottom": "0.375rem" }}>Recipients</div>
|
|
17110
17607
|
<div style={{ display: "flex", "flex-wrap": "wrap", gap: "0.375rem", "margin-bottom": "0.5rem" }}>
|
|
17111
|
-
<
|
|
17608
|
+
<For38 each={s().recipientEmails} fallback={<span class="app-admin-text-muted" style={{ "font-size": "0.8125rem" }}>Nobody — admin copies go nowhere until someone is added.</span>}>
|
|
17112
17609
|
{(email) => <span class="app-admin-badge app-admin-badge--neutral" style={{ "text-transform": "none", display: "inline-flex", gap: "0.375rem", "align-items": "center" }}>
|
|
17113
17610
|
{email}
|
|
17114
17611
|
<button
|
|
@@ -17120,7 +17617,7 @@ function NotificationsCard() {
|
|
|
17120
17617
|
×
|
|
17121
17618
|
</button>
|
|
17122
17619
|
</span>}
|
|
17123
|
-
</
|
|
17620
|
+
</For38>
|
|
17124
17621
|
</div>
|
|
17125
17622
|
<div style={{ display: "flex", gap: "0.5rem", "max-width": "28rem" }}>
|
|
17126
17623
|
<input
|
|
@@ -17138,24 +17635,24 @@ function NotificationsCard() {
|
|
|
17138
17635
|
<div>
|
|
17139
17636
|
<div style={{ ...label2, "margin-bottom": "0.375rem" }}>Send a copy for</div>
|
|
17140
17637
|
<div style={{ display: "grid", "grid-template-columns": "repeat(auto-fill, minmax(14rem, 1fr))", gap: "0.375rem 1rem" }}>
|
|
17141
|
-
<
|
|
17638
|
+
<For38 each={Object.keys(s().enabledEvents)}>
|
|
17142
17639
|
{(key) => <Toggle
|
|
17143
17640
|
label={humanize2(key)}
|
|
17144
17641
|
checked={!!s().enabledEvents[key]}
|
|
17145
17642
|
onChange={(v) => update({ enabledEvents: { ...s().enabledEvents, [key]: v } })}
|
|
17146
17643
|
/>}
|
|
17147
|
-
</
|
|
17644
|
+
</For38>
|
|
17148
17645
|
</div>
|
|
17149
17646
|
</div>
|
|
17150
17647
|
</>}
|
|
17151
|
-
</
|
|
17648
|
+
</Show50>
|
|
17152
17649
|
</Card>;
|
|
17153
17650
|
}
|
|
17154
17651
|
function BillingRemindersCard() {
|
|
17155
17652
|
const [saved, { mutate }] = createResource24(() => adminApi.getBillingReminders());
|
|
17156
|
-
const [draft, setDraft] =
|
|
17157
|
-
const [newDay, setNewDay] =
|
|
17158
|
-
const [saving, setSaving] =
|
|
17653
|
+
const [draft, setDraft] = createSignal33(null);
|
|
17654
|
+
const [newDay, setNewDay] = createSignal33("");
|
|
17655
|
+
const [saving, setSaving] = createSignal33(false);
|
|
17159
17656
|
const current2 = () => draft() ?? saved() ?? null;
|
|
17160
17657
|
const update = (patch) => setDraft({ ...current2(), ...patch });
|
|
17161
17658
|
const dirty = () => !!draft() && JSON.stringify(draft()) !== JSON.stringify(saved());
|
|
@@ -17192,20 +17689,20 @@ function BillingRemindersCard() {
|
|
|
17192
17689
|
{saving() ? "Saving\u2026" : "Save"}
|
|
17193
17690
|
</button>}
|
|
17194
17691
|
>
|
|
17195
|
-
<
|
|
17692
|
+
<Show50 when={current2()} fallback={<LoadingSpinner />}>
|
|
17196
17693
|
{(s) => <div style={{ display: "grid", "grid-template-columns": "repeat(auto-fit, minmax(15rem, 1fr))", gap: "1rem" }}>
|
|
17197
17694
|
<div class="app-admin-card-soft" style={{ padding: "0.875rem", display: "grid", gap: "0.5rem" }}>
|
|
17198
17695
|
<Toggle label="Renewal reminder" checked={s().renewalReminder.enabled} onChange={(v) => update({ renewalReminder: { ...s().renewalReminder, enabled: v } })} />
|
|
17199
17696
|
<div style={label2}>Days before renewal</div>
|
|
17200
17697
|
<div style={{ display: "flex", "flex-wrap": "wrap", gap: "0.375rem" }}>
|
|
17201
|
-
<
|
|
17698
|
+
<For38 each={s().renewalReminder.daysBefore}>
|
|
17202
17699
|
{(d) => <span class="app-admin-badge app-admin-badge--neutral" style={{ "text-transform": "none", display: "inline-flex", gap: "0.375rem" }}>
|
|
17203
17700
|
{d}d
|
|
17204
|
-
<
|
|
17701
|
+
<Show50 when={s().renewalReminder.daysBefore.length > 1}>
|
|
17205
17702
|
<button type="button" aria-label={`Remove ${d} days`} onClick={() => update({ renewalReminder: { ...s().renewalReminder, daysBefore: s().renewalReminder.daysBefore.filter((x) => x !== d) } })} style={{ background: "none", border: "none", cursor: "pointer", color: "inherit", padding: 0 }}>×</button>
|
|
17206
|
-
</
|
|
17703
|
+
</Show50>
|
|
17207
17704
|
</span>}
|
|
17208
|
-
</
|
|
17705
|
+
</For38>
|
|
17209
17706
|
</div>
|
|
17210
17707
|
<div style={{ display: "flex", gap: "0.5rem" }}>
|
|
17211
17708
|
<input type="number" class="app-admin-input" style={{ width: "6rem" }} min="1" max="90" placeholder="e.g. 7" aria-label="Add days before" value={newDay()} onInput={(e) => setNewDay(e.currentTarget.value)} onKeyDown={(e) => e.key === "Enter" && (e.preventDefault(), addDay())} />
|
|
@@ -17231,7 +17728,7 @@ function BillingRemindersCard() {
|
|
|
17231
17728
|
</label>
|
|
17232
17729
|
</div>
|
|
17233
17730
|
</div>}
|
|
17234
|
-
</
|
|
17731
|
+
</Show50>
|
|
17235
17732
|
</Card>;
|
|
17236
17733
|
}
|
|
17237
17734
|
function EmailNotifications() {
|
|
@@ -17242,6 +17739,217 @@ function EmailNotifications() {
|
|
|
17242
17739
|
</div>;
|
|
17243
17740
|
}
|
|
17244
17741
|
|
|
17742
|
+
// src/pages/admin/Features.tsx
|
|
17743
|
+
import { createResource as createResource25, createSignal as createSignal34, For as For39, Show as Show51 } from "solid-js";
|
|
17744
|
+
var muted = { "font-size": "0.8125rem", color: "var(--app-admin-fg-muted)" };
|
|
17745
|
+
var MAX_NOTE_LENGTH = 1e3;
|
|
17746
|
+
function formatDate2(iso) {
|
|
17747
|
+
const d = new Date(iso);
|
|
17748
|
+
return Number.isNaN(d.getTime()) ? "" : d.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" });
|
|
17749
|
+
}
|
|
17750
|
+
function Card2(props) {
|
|
17751
|
+
return <div class="app-admin-card" style={{ "margin-top": "1.25rem" }}>
|
|
17752
|
+
<div style={{ padding: "1rem 1.25rem", "border-bottom": "1px solid var(--app-admin-border-soft)" }}>
|
|
17753
|
+
<h2 class="app-admin-heading" style={{ "font-size": "0.9375rem", "font-weight": "600", margin: 0 }}>
|
|
17754
|
+
{props.title}
|
|
17755
|
+
</h2>
|
|
17756
|
+
<p style={{ ...muted, "font-size": "0.75rem", margin: "0.25rem 0 0" }}>{props.note}</p>
|
|
17757
|
+
</div>
|
|
17758
|
+
<div>{props.children}</div>
|
|
17759
|
+
</div>;
|
|
17760
|
+
}
|
|
17761
|
+
function Row(props) {
|
|
17762
|
+
return <div
|
|
17763
|
+
data-feature={props.feature.key}
|
|
17764
|
+
style={{
|
|
17765
|
+
display: "flex",
|
|
17766
|
+
"align-items": "center",
|
|
17767
|
+
"justify-content": "space-between",
|
|
17768
|
+
gap: "1rem",
|
|
17769
|
+
padding: "0.875rem 1.25rem",
|
|
17770
|
+
"border-bottom": "1px solid var(--app-admin-border-soft)"
|
|
17771
|
+
}}
|
|
17772
|
+
>
|
|
17773
|
+
<div style={{ "min-width": 0 }}>
|
|
17774
|
+
<div style={{ "font-size": "0.875rem", "font-weight": "600" }}>{props.feature.label}</div>
|
|
17775
|
+
<div style={{ ...muted, "margin-top": "0.125rem" }}>{props.feature.description}</div>
|
|
17776
|
+
<Show51 when={props.note}>
|
|
17777
|
+
<div style={{ ...muted, "font-size": "0.75rem", "margin-top": "0.25rem" }}>{props.note}</div>
|
|
17778
|
+
</Show51>
|
|
17779
|
+
</div>
|
|
17780
|
+
<div style={{ "flex-shrink": 0 }}>{props.children}</div>
|
|
17781
|
+
</div>;
|
|
17782
|
+
}
|
|
17783
|
+
function Features() {
|
|
17784
|
+
const [data, { mutate }] = createResource25(() => adminApi.getFeatures());
|
|
17785
|
+
const [busyKey, setBusyKey] = createSignal34(null);
|
|
17786
|
+
const [requesting, setRequesting] = createSignal34(null);
|
|
17787
|
+
const [note, setNote] = createSignal34("");
|
|
17788
|
+
const [sending, setSending] = createSignal34(false);
|
|
17789
|
+
const features = () => data.error ? [] : data()?.features ?? [];
|
|
17790
|
+
const selfServe = () => features().filter((f) => f.access === "self_serve");
|
|
17791
|
+
const onRequest = () => features().filter((f) => f.access === "request");
|
|
17792
|
+
const blockedBy = (f) => !f.enabled && f.requires && !f.requires.enabled ? f.requires : null;
|
|
17793
|
+
const toggle = async (f) => {
|
|
17794
|
+
if (busyKey() || blockedBy(f)) return;
|
|
17795
|
+
const turnOn = !f.enabled;
|
|
17796
|
+
setBusyKey(f.key);
|
|
17797
|
+
try {
|
|
17798
|
+
const before = features();
|
|
17799
|
+
const res = await adminApi.setFeature(f.key, turnOn);
|
|
17800
|
+
mutate(res);
|
|
17801
|
+
const alsoOff = res.features.filter(
|
|
17802
|
+
(n) => n.key !== f.key && !n.enabled && before.find((b) => b.key === n.key)?.enabled
|
|
17803
|
+
);
|
|
17804
|
+
const state = `${f.label} is ${turnOn ? "on" : "off"}`;
|
|
17805
|
+
toastSuccess(
|
|
17806
|
+
alsoOff.length > 0 ? `${state}. Also turned off: ${alsoOff.map((n) => n.label).join(", ")}` : state
|
|
17807
|
+
);
|
|
17808
|
+
} catch (e) {
|
|
17809
|
+
toastError(e.message);
|
|
17810
|
+
} finally {
|
|
17811
|
+
setBusyKey(null);
|
|
17812
|
+
}
|
|
17813
|
+
};
|
|
17814
|
+
const openRequest = (f) => {
|
|
17815
|
+
setNote("");
|
|
17816
|
+
setRequesting(f);
|
|
17817
|
+
};
|
|
17818
|
+
const sendRequest = async () => {
|
|
17819
|
+
const f = requesting();
|
|
17820
|
+
if (!f || sending()) return;
|
|
17821
|
+
setSending(true);
|
|
17822
|
+
try {
|
|
17823
|
+
const res = await adminApi.requestFeature(f.key, note().trim() || void 0);
|
|
17824
|
+
const current2 = data();
|
|
17825
|
+
if (current2) {
|
|
17826
|
+
mutate({ features: current2.features.map((x) => x.key === f.key ? res.feature : x) });
|
|
17827
|
+
}
|
|
17828
|
+
setRequesting(null);
|
|
17829
|
+
if (res.alreadyRequested) {
|
|
17830
|
+
toastSuccess(`${f.label} was already requested`);
|
|
17831
|
+
} else if (res.emailed) {
|
|
17832
|
+
toastSuccess(`Request sent for ${f.label}`);
|
|
17833
|
+
} else {
|
|
17834
|
+
toastSuccess(`Request saved for ${f.label}. The email could not be sent, so let your Apex contact know.`);
|
|
17835
|
+
}
|
|
17836
|
+
} catch (e) {
|
|
17837
|
+
toastError(e.message);
|
|
17838
|
+
} finally {
|
|
17839
|
+
setSending(false);
|
|
17840
|
+
}
|
|
17841
|
+
};
|
|
17842
|
+
return <div>
|
|
17843
|
+
<PageTitle subtitle="What this site has switched on, and what you can ask for">Features</PageTitle>
|
|
17844
|
+
|
|
17845
|
+
<Show51 when={data.error}>
|
|
17846
|
+
<div class="app-admin-notice" role="alert" style={{ "margin-top": "1.25rem" }}>
|
|
17847
|
+
Features could not be loaded. {data.error?.message}
|
|
17848
|
+
</div>
|
|
17849
|
+
</Show51>
|
|
17850
|
+
|
|
17851
|
+
<Show51 when={!data.error && data.loading}>
|
|
17852
|
+
<LoadingSpinner />
|
|
17853
|
+
</Show51>
|
|
17854
|
+
|
|
17855
|
+
<Show51 when={!data.error && data()}>
|
|
17856
|
+
<Show51 when={selfServe().length > 0}>
|
|
17857
|
+
<Card2 title="Switch on yourself" note="These take effect on your site right away.">
|
|
17858
|
+
<For39 each={selfServe()}>
|
|
17859
|
+
{(f) => <Row feature={f} note={blockedBy(f) ? `Turn on "${blockedBy(f).label}" first.` : void 0}>
|
|
17860
|
+
<button
|
|
17861
|
+
type="button"
|
|
17862
|
+
role="switch"
|
|
17863
|
+
aria-checked={f.enabled}
|
|
17864
|
+
aria-label={f.label}
|
|
17865
|
+
class="app-admin-toggle"
|
|
17866
|
+
classList={{ "is-on": f.enabled, "is-loading": busyKey() === f.key }}
|
|
17867
|
+
disabled={!!busyKey() || !!blockedBy(f)}
|
|
17868
|
+
style={blockedBy(f) ? { opacity: 0.4, cursor: "not-allowed" } : void 0}
|
|
17869
|
+
onClick={() => void toggle(f)}
|
|
17870
|
+
>
|
|
17871
|
+
<span class="app-admin-toggle__knob" />
|
|
17872
|
+
</button>
|
|
17873
|
+
</Row>}
|
|
17874
|
+
</For39>
|
|
17875
|
+
</Card2>
|
|
17876
|
+
</Show51>
|
|
17877
|
+
|
|
17878
|
+
<Show51 when={onRequest().length > 0}>
|
|
17879
|
+
<Card2
|
|
17880
|
+
title="Available on request"
|
|
17881
|
+
note="These change billing or need setup on our side, so we turn them on for you."
|
|
17882
|
+
>
|
|
17883
|
+
<For39 each={onRequest()}>
|
|
17884
|
+
{(f) => <Row feature={f}>
|
|
17885
|
+
<Show51
|
|
17886
|
+
when={!f.enabled}
|
|
17887
|
+
fallback={<span class="app-admin-badge app-admin-badge--success">On</span>}
|
|
17888
|
+
>
|
|
17889
|
+
<Show51
|
|
17890
|
+
when={f.request}
|
|
17891
|
+
fallback={<button
|
|
17892
|
+
type="button"
|
|
17893
|
+
class="app-admin-btn app-admin-btn-sm"
|
|
17894
|
+
aria-label={`Request ${f.label}`}
|
|
17895
|
+
onClick={() => openRequest(f)}
|
|
17896
|
+
>
|
|
17897
|
+
Request
|
|
17898
|
+
</button>}
|
|
17899
|
+
>
|
|
17900
|
+
{(r) => <span
|
|
17901
|
+
class="app-admin-badge app-admin-badge--info"
|
|
17902
|
+
style={{ "text-transform": "none" }}
|
|
17903
|
+
title={`Requested by ${r().requestedBy}`}
|
|
17904
|
+
>
|
|
17905
|
+
Requested {formatDate2(r().requestedAt)}
|
|
17906
|
+
</span>}
|
|
17907
|
+
</Show51>
|
|
17908
|
+
</Show51>
|
|
17909
|
+
</Row>}
|
|
17910
|
+
</For39>
|
|
17911
|
+
</Card2>
|
|
17912
|
+
</Show51>
|
|
17913
|
+
</Show51>
|
|
17914
|
+
|
|
17915
|
+
<Show51 when={requesting()}>
|
|
17916
|
+
{(f) => <Modal
|
|
17917
|
+
title={`Request ${f().label}`}
|
|
17918
|
+
width="32rem"
|
|
17919
|
+
onClose={() => !sending() && setRequesting(null)}
|
|
17920
|
+
footer={<div class="app-admin-btn-row">
|
|
17921
|
+
<button type="button" class="app-admin-btn" disabled={sending()} onClick={() => setRequesting(null)}>
|
|
17922
|
+
Cancel
|
|
17923
|
+
</button>
|
|
17924
|
+
<button
|
|
17925
|
+
type="button"
|
|
17926
|
+
class="app-admin-btn app-admin-btn-primary"
|
|
17927
|
+
disabled={sending()}
|
|
17928
|
+
onClick={() => void sendRequest()}
|
|
17929
|
+
>
|
|
17930
|
+
{sending() ? "Sending\u2026" : "Send request"}
|
|
17931
|
+
</button>
|
|
17932
|
+
</div>}
|
|
17933
|
+
>
|
|
17934
|
+
<p style={{ ...muted, margin: "0 0 0.875rem" }}>{f().description}</p>
|
|
17935
|
+
<label style={{ display: "grid", gap: "0.25rem" }}>
|
|
17936
|
+
<span style={muted}>Anything we should know? (optional)</span>
|
|
17937
|
+
<textarea
|
|
17938
|
+
class="app-admin-input"
|
|
17939
|
+
rows={4}
|
|
17940
|
+
maxLength={MAX_NOTE_LENGTH}
|
|
17941
|
+
value={note()}
|
|
17942
|
+
onInput={(e) => setNote(e.currentTarget.value)}
|
|
17943
|
+
/>
|
|
17944
|
+
</label>
|
|
17945
|
+
<p style={{ ...muted, "font-size": "0.75rem", margin: "0.75rem 0 0" }}>
|
|
17946
|
+
We'll email our team and reply to you. Nothing changes on your site until we turn it on.
|
|
17947
|
+
</p>
|
|
17948
|
+
</Modal>}
|
|
17949
|
+
</Show51>
|
|
17950
|
+
</div>;
|
|
17951
|
+
}
|
|
17952
|
+
|
|
17245
17953
|
// src/pages/AdminDashboard.tsx
|
|
17246
17954
|
var TAB_LABELS = {
|
|
17247
17955
|
dashboard: "Dashboard",
|
|
@@ -17258,7 +17966,8 @@ var TAB_LABELS = {
|
|
|
17258
17966
|
"email-templates": "Templates",
|
|
17259
17967
|
"email-notifications": "Notifications",
|
|
17260
17968
|
funnel: "Funnel",
|
|
17261
|
-
sequences: "Sequences"
|
|
17969
|
+
sequences: "Sequences",
|
|
17970
|
+
features: "Features"
|
|
17262
17971
|
};
|
|
17263
17972
|
var DEFAULT_TOP_TABS = ["dashboard"];
|
|
17264
17973
|
var DEFAULT_TAB_GROUPS = [
|
|
@@ -17269,7 +17978,9 @@ var DEFAULT_TAB_GROUPS = [
|
|
|
17269
17978
|
// transactional email, who gets admin copies and the reminder schedule, and
|
|
17270
17979
|
// the drip sequences the Funnel tab feeds.
|
|
17271
17980
|
{ label: "Email", tabs: ["email-templates", "email-notifications", "sequences"] },
|
|
17272
|
-
{ label: "Integrations", tabs: ["webhooks"] }
|
|
17981
|
+
{ label: "Integrations", tabs: ["webhooks"] },
|
|
17982
|
+
// What this site has switched on, and what it can ask for.
|
|
17983
|
+
{ label: "Settings", tabs: ["features"] }
|
|
17273
17984
|
];
|
|
17274
17985
|
var filterEnabled = (tabs, enabled) => enabled ? tabs.filter((t) => enabled.includes(t)) : tabs;
|
|
17275
17986
|
function AdminDashboard(props) {
|
|
@@ -17282,13 +17993,13 @@ function AdminDashboard(props) {
|
|
|
17282
17993
|
const isTabEnabled = (tab) => orderedTabs().includes(tab);
|
|
17283
17994
|
const affiliatesEnabled = () => props.enabledTabs ? props.enabledTabs.includes("affiliates") : true;
|
|
17284
17995
|
const fallbackTab = () => props.defaultTab ?? orderedTabs()[0] ?? "dashboard";
|
|
17285
|
-
const [internalTab, setInternalTab] =
|
|
17996
|
+
const [internalTab, setInternalTab] = createSignal35(fallbackTab());
|
|
17286
17997
|
const currentTab = () => props.activeTab ?? internalTab();
|
|
17287
|
-
const [drawerOpen, setDrawerOpen] =
|
|
17288
|
-
|
|
17998
|
+
const [drawerOpen, setDrawerOpen] = createSignal35(false);
|
|
17999
|
+
createEffect13(() => {
|
|
17289
18000
|
setAdminToast(props.toast);
|
|
17290
18001
|
});
|
|
17291
|
-
|
|
18002
|
+
createEffect13(() => {
|
|
17292
18003
|
const auth = props.auth;
|
|
17293
18004
|
if (!auth) return;
|
|
17294
18005
|
if (!auth.isAuthenticated()) {
|
|
@@ -17304,9 +18015,9 @@ function AdminDashboard(props) {
|
|
|
17304
18015
|
if (!auth) return true;
|
|
17305
18016
|
return auth.isAuthenticated() && auth.isHydrated() && auth.isAdmin();
|
|
17306
18017
|
};
|
|
17307
|
-
const [pendingCustomerUid, setPendingCustomerUid] =
|
|
17308
|
-
const [pendingThreadId, setPendingThreadId] =
|
|
17309
|
-
const [pendingTemplateId, setPendingTemplateId] =
|
|
18018
|
+
const [pendingCustomerUid, setPendingCustomerUid] = createSignal35(null);
|
|
18019
|
+
const [pendingThreadId, setPendingThreadId] = createSignal35(null);
|
|
18020
|
+
const [pendingTemplateId, setPendingTemplateId] = createSignal35(null);
|
|
17310
18021
|
const handleTabClick = (tab, opts) => {
|
|
17311
18022
|
if (!opts?.keepPending) {
|
|
17312
18023
|
setPendingCustomerUid(null);
|
|
@@ -17355,15 +18066,15 @@ function AdminDashboard(props) {
|
|
|
17355
18066
|
color: currentTab() === btnProps.tab ? "var(--app-admin-primary-soft-fg)" : "var(--app-admin-fg-muted)"
|
|
17356
18067
|
}}
|
|
17357
18068
|
>
|
|
17358
|
-
<
|
|
18069
|
+
<Show52 when={props.tabIcons?.[btnProps.tab]}>
|
|
17359
18070
|
<span
|
|
17360
18071
|
class={props.tabIcons[btnProps.tab]}
|
|
17361
18072
|
style={{ "font-size": "1rem", opacity: 0.7, "flex-shrink": 0 }}
|
|
17362
18073
|
/>
|
|
17363
|
-
</
|
|
18074
|
+
</Show52>
|
|
17364
18075
|
{TAB_LABELS[btnProps.tab]}
|
|
17365
18076
|
</button>;
|
|
17366
|
-
return <
|
|
18077
|
+
return <Show52 when={adminAllowed()} fallback={<AdminGateSpinner topOffset={props.topOffset ?? "0px"} />}>
|
|
17367
18078
|
<AdminNavContext.Provider value={adminNav}>
|
|
17368
18079
|
<div
|
|
17369
18080
|
class="app-admin-root app-admin-shell"
|
|
@@ -17411,8 +18122,8 @@ function AdminDashboard(props) {
|
|
|
17411
18122
|
Admin Panel
|
|
17412
18123
|
</h2>
|
|
17413
18124
|
<nav style={{ display: "flex", "flex-direction": "column", gap: "0.25rem" }}>
|
|
17414
|
-
<
|
|
17415
|
-
<
|
|
18125
|
+
<For40 each={visibleTopTabs()}>{(tab) => <TabButton tab={tab} />}</For40>
|
|
18126
|
+
<For40 each={visibleGroups()}>
|
|
17416
18127
|
{(group) => <>
|
|
17417
18128
|
<h3
|
|
17418
18129
|
style={{
|
|
@@ -17427,9 +18138,9 @@ function AdminDashboard(props) {
|
|
|
17427
18138
|
>
|
|
17428
18139
|
{group.label}
|
|
17429
18140
|
</h3>
|
|
17430
|
-
<
|
|
18141
|
+
<For40 each={group.tabs}>{(tab) => <TabButton tab={tab} />}</For40>
|
|
17431
18142
|
</>}
|
|
17432
|
-
</
|
|
18143
|
+
</For40>
|
|
17433
18144
|
</nav>
|
|
17434
18145
|
</div>
|
|
17435
18146
|
</aside>
|
|
@@ -17441,7 +18152,7 @@ function AdminDashboard(props) {
|
|
|
17441
18152
|
(which would wedge the sidebar nav), and switching tabs mounts a fresh
|
|
17442
18153
|
boundary that clears a prior tab's error. */
|
|
17443
18154
|
}
|
|
17444
|
-
<
|
|
18155
|
+
<Show52 when={currentTab()} keyed>
|
|
17445
18156
|
<ErrorBoundary fallback={(err, reset) => <AdminTabError error={err} reset={reset} />}>
|
|
17446
18157
|
<Switch3 fallback={<Dashboard onSelectTab={handleTabClick} isTabEnabled={isTabEnabled} />}>
|
|
17447
18158
|
<Match3 when={currentTab() === "dashboard"}>
|
|
@@ -17502,13 +18213,16 @@ function AdminDashboard(props) {
|
|
|
17502
18213
|
<Match3 when={currentTab() === "email-notifications"}>
|
|
17503
18214
|
<EmailNotifications />
|
|
17504
18215
|
</Match3>
|
|
18216
|
+
<Match3 when={currentTab() === "features"}>
|
|
18217
|
+
<Features />
|
|
18218
|
+
</Match3>
|
|
17505
18219
|
</Switch3>
|
|
17506
18220
|
</ErrorBoundary>
|
|
17507
|
-
</
|
|
18221
|
+
</Show52>
|
|
17508
18222
|
</div>
|
|
17509
18223
|
</div>
|
|
17510
18224
|
</AdminNavContext.Provider>
|
|
17511
|
-
</
|
|
18225
|
+
</Show52>;
|
|
17512
18226
|
}
|
|
17513
18227
|
function AdminTabError(props) {
|
|
17514
18228
|
console.error("[AdminDashboard] tab failed to render:", props.error);
|
|
@@ -17600,7 +18314,8 @@ var ADMIN_TAB_SEGMENTS = {
|
|
|
17600
18314
|
"email-templates": "email-templates",
|
|
17601
18315
|
funnel: "funnel",
|
|
17602
18316
|
sequences: "sequences",
|
|
17603
|
-
"email-notifications": "email-notifications"
|
|
18317
|
+
"email-notifications": "email-notifications",
|
|
18318
|
+
features: "features"
|
|
17604
18319
|
};
|
|
17605
18320
|
var AFFILIATE_SUB_TAB_SEGMENTS = {
|
|
17606
18321
|
overview: "",
|
|
@@ -17648,7 +18363,7 @@ function affiliateSubTabFromPath(pathname, base = "/admin") {
|
|
|
17648
18363
|
}
|
|
17649
18364
|
|
|
17650
18365
|
// src/pages/admin/PatientDashboardPreview.tsx
|
|
17651
|
-
import { Show as
|
|
18366
|
+
import { Show as Show53, For as For41 } from "solid-js";
|
|
17652
18367
|
function PatientDashboardPreview(props) {
|
|
17653
18368
|
const data = useDashboardData({ authToken: () => props.token });
|
|
17654
18369
|
return <div
|
|
@@ -17690,7 +18405,7 @@ function PatientDashboardPreview(props) {
|
|
|
17690
18405
|
/* A failed read is an error with a retry — never presented as an
|
|
17691
18406
|
empty dashboard (the customer may have plenty of data). */
|
|
17692
18407
|
}
|
|
17693
|
-
<
|
|
18408
|
+
<Show53 when={data.error()} keyed>
|
|
17694
18409
|
{(msg) => <div
|
|
17695
18410
|
style={{
|
|
17696
18411
|
display: "flex",
|
|
@@ -17715,10 +18430,10 @@ function PatientDashboardPreview(props) {
|
|
|
17715
18430
|
Retry
|
|
17716
18431
|
</button>
|
|
17717
18432
|
</div>}
|
|
17718
|
-
</
|
|
18433
|
+
</Show53>
|
|
17719
18434
|
|
|
17720
|
-
<
|
|
17721
|
-
<
|
|
18435
|
+
<Show53 when={!data.profile.loading} fallback={<LoadingSpinner />}>
|
|
18436
|
+
<Show53
|
|
17722
18437
|
when={data.profile()}
|
|
17723
18438
|
fallback={<p style={{ color: "var(--app-admin-fg-muted)", "font-size": "0.875rem" }}>
|
|
17724
18439
|
Could not load this customer's dashboard.
|
|
@@ -17751,7 +18466,7 @@ function PatientDashboardPreview(props) {
|
|
|
17751
18466
|
}
|
|
17752
18467
|
<div>
|
|
17753
18468
|
<h3 style={panelSectionHeader}>Subscription</h3>
|
|
17754
|
-
<
|
|
18469
|
+
<Show53
|
|
17755
18470
|
when={data.subscription()}
|
|
17756
18471
|
fallback={<p
|
|
17757
18472
|
style={{
|
|
@@ -17771,13 +18486,13 @@ function PatientDashboardPreview(props) {
|
|
|
17771
18486
|
}}
|
|
17772
18487
|
>
|
|
17773
18488
|
<span style={{ "font-size": "0.875rem", "font-weight": "500" }}>
|
|
17774
|
-
<
|
|
18489
|
+
<Show53 when={sub().amount != null} fallback="Subscription">
|
|
17775
18490
|
{centsToUsd(sub().amount)}/mo
|
|
17776
|
-
</
|
|
18491
|
+
</Show53>
|
|
17777
18492
|
</span>
|
|
17778
18493
|
<StatusBadge status={sub().status} />
|
|
17779
18494
|
</div>
|
|
17780
|
-
<
|
|
18495
|
+
<Show53 when={sub().nextBillingDate}>
|
|
17781
18496
|
<p
|
|
17782
18497
|
style={{
|
|
17783
18498
|
"font-size": "0.75rem",
|
|
@@ -17787,15 +18502,15 @@ function PatientDashboardPreview(props) {
|
|
|
17787
18502
|
>
|
|
17788
18503
|
Next charge {fmtDate(sub().nextBillingDate)}
|
|
17789
18504
|
</p>
|
|
17790
|
-
</
|
|
18505
|
+
</Show53>
|
|
17791
18506
|
</div>}
|
|
17792
|
-
</
|
|
18507
|
+
</Show53>
|
|
17793
18508
|
</div>
|
|
17794
18509
|
|
|
17795
18510
|
{
|
|
17796
18511
|
/* Prescription status */
|
|
17797
18512
|
}
|
|
17798
|
-
<
|
|
18513
|
+
<Show53 when={data.rxStatus()}>
|
|
17799
18514
|
{(rx) => <div>
|
|
17800
18515
|
<h3 style={panelSectionHeader}>Prescription status</h3>
|
|
17801
18516
|
<div class="app-admin-card-soft" style={{ padding: "0.75rem" }}>
|
|
@@ -17811,7 +18526,7 @@ function PatientDashboardPreview(props) {
|
|
|
17811
18526
|
</span>
|
|
17812
18527
|
<StatusBadge status={rx().status} />
|
|
17813
18528
|
</div>
|
|
17814
|
-
<
|
|
18529
|
+
<Show53 when={rx().reason}>
|
|
17815
18530
|
<p
|
|
17816
18531
|
style={{
|
|
17817
18532
|
"font-size": "0.75rem",
|
|
@@ -17821,17 +18536,17 @@ function PatientDashboardPreview(props) {
|
|
|
17821
18536
|
>
|
|
17822
18537
|
{rx().reason}
|
|
17823
18538
|
</p>
|
|
17824
|
-
</
|
|
18539
|
+
</Show53>
|
|
17825
18540
|
</div>
|
|
17826
18541
|
</div>}
|
|
17827
|
-
</
|
|
18542
|
+
</Show53>
|
|
17828
18543
|
|
|
17829
18544
|
{
|
|
17830
18545
|
/* Prescription requests */
|
|
17831
18546
|
}
|
|
17832
18547
|
<div>
|
|
17833
18548
|
<h3 style={panelSectionHeader}>Prescription requests</h3>
|
|
17834
|
-
<
|
|
18549
|
+
<Show53
|
|
17835
18550
|
when={(data.rxList() ?? []).length > 0}
|
|
17836
18551
|
fallback={<p
|
|
17837
18552
|
style={{
|
|
@@ -17843,7 +18558,7 @@ function PatientDashboardPreview(props) {
|
|
|
17843
18558
|
</p>}
|
|
17844
18559
|
>
|
|
17845
18560
|
<div style={{ display: "flex", "flex-direction": "column", gap: "0.5rem" }}>
|
|
17846
|
-
<
|
|
18561
|
+
<For41 each={data.rxList()}>
|
|
17847
18562
|
{(req) => <div class="app-admin-card-soft" style={{ padding: "0.75rem" }}>
|
|
17848
18563
|
<div
|
|
17849
18564
|
style={{
|
|
@@ -17858,7 +18573,7 @@ function PatientDashboardPreview(props) {
|
|
|
17858
18573
|
>
|
|
17859
18574
|
{req.drugName || req.drugId || "Prescription"}
|
|
17860
18575
|
</span>
|
|
17861
|
-
<
|
|
18576
|
+
<Show53 when={req.dosage}>
|
|
17862
18577
|
<span
|
|
17863
18578
|
style={{
|
|
17864
18579
|
"font-size": "0.75rem",
|
|
@@ -17868,7 +18583,7 @@ function PatientDashboardPreview(props) {
|
|
|
17868
18583
|
>
|
|
17869
18584
|
{req.dosage}
|
|
17870
18585
|
</span>
|
|
17871
|
-
</
|
|
18586
|
+
</Show53>
|
|
17872
18587
|
</div>
|
|
17873
18588
|
<StatusBadge status={req.status} />
|
|
17874
18589
|
</div>
|
|
@@ -17879,15 +18594,15 @@ function PatientDashboardPreview(props) {
|
|
|
17879
18594
|
"margin-top": "0.25rem"
|
|
17880
18595
|
}}
|
|
17881
18596
|
>
|
|
17882
|
-
<
|
|
18597
|
+
<Show53 when={req.priceCents != null}>
|
|
17883
18598
|
<span>{centsToUsd(req.priceCents)} · </span>
|
|
17884
|
-
</
|
|
18599
|
+
</Show53>
|
|
17885
18600
|
{fmtDate(req.createdAt)}
|
|
17886
18601
|
</div>
|
|
17887
18602
|
</div>}
|
|
17888
|
-
</
|
|
18603
|
+
</For41>
|
|
17889
18604
|
</div>
|
|
17890
|
-
</
|
|
18605
|
+
</Show53>
|
|
17891
18606
|
</div>
|
|
17892
18607
|
|
|
17893
18608
|
{
|
|
@@ -17895,7 +18610,7 @@ function PatientDashboardPreview(props) {
|
|
|
17895
18610
|
}
|
|
17896
18611
|
<div>
|
|
17897
18612
|
<h3 style={panelSectionHeader}>Pending surveys</h3>
|
|
17898
|
-
<
|
|
18613
|
+
<Show53
|
|
17899
18614
|
when={(data.pendingSurveys() ?? []).length > 0}
|
|
17900
18615
|
fallback={<p
|
|
17901
18616
|
style={{
|
|
@@ -17907,7 +18622,7 @@ function PatientDashboardPreview(props) {
|
|
|
17907
18622
|
</p>}
|
|
17908
18623
|
>
|
|
17909
18624
|
<div style={{ display: "flex", "flex-direction": "column", gap: "0.5rem" }}>
|
|
17910
|
-
<
|
|
18625
|
+
<For41 each={data.pendingSurveys()}>
|
|
17911
18626
|
{(survey) => <div class="app-admin-card-soft" style={{ padding: "0.75rem" }}>
|
|
17912
18627
|
<span style={{ "font-size": "0.875rem", "font-weight": "500" }}>
|
|
17913
18628
|
{survey.drugName || survey.drugId || "Renewal survey"}
|
|
@@ -17922,24 +18637,24 @@ function PatientDashboardPreview(props) {
|
|
|
17922
18637
|
Cycle {survey.cycleNumber}
|
|
17923
18638
|
</span>
|
|
17924
18639
|
</div>}
|
|
17925
|
-
</
|
|
18640
|
+
</For41>
|
|
17926
18641
|
</div>
|
|
17927
|
-
</
|
|
18642
|
+
</Show53>
|
|
17928
18643
|
</div>
|
|
17929
18644
|
</>}
|
|
17930
|
-
</
|
|
17931
|
-
</
|
|
18645
|
+
</Show53>
|
|
18646
|
+
</Show53>
|
|
17932
18647
|
</div>
|
|
17933
18648
|
</div>
|
|
17934
18649
|
</div>;
|
|
17935
18650
|
}
|
|
17936
18651
|
|
|
17937
18652
|
// src/pages/UpdatePaymentMethod.tsx
|
|
17938
|
-
import { Show as
|
|
18653
|
+
import { Show as Show54, createResource as createResource26 } from "solid-js";
|
|
17939
18654
|
var LIVE = /* @__PURE__ */ new Set(["active", "paused", "past_due"]);
|
|
17940
18655
|
function UpdatePaymentMethod(props) {
|
|
17941
18656
|
const { Heading, TextField, Button, Banner, Spinner } = usePrimitives();
|
|
17942
|
-
const [resolved] =
|
|
18657
|
+
const [resolved] = createResource26(
|
|
17943
18658
|
() => props.subscriptionId ? null : "fetch",
|
|
17944
18659
|
async () => {
|
|
17945
18660
|
try {
|
|
@@ -17967,21 +18682,21 @@ function UpdatePaymentMethod(props) {
|
|
|
17967
18682
|
Enter a new card for your subscription. Your current card stays active until this succeeds.
|
|
17968
18683
|
</p>
|
|
17969
18684
|
|
|
17970
|
-
<
|
|
18685
|
+
<Show54 when={resolving()}>
|
|
17971
18686
|
<Spinner />
|
|
17972
|
-
</
|
|
18687
|
+
</Show54>
|
|
17973
18688
|
|
|
17974
|
-
<
|
|
18689
|
+
<Show54 when={noSubscription()}>
|
|
17975
18690
|
<Banner variant="error">We couldn’t find an active subscription to update.</Banner>
|
|
17976
|
-
</
|
|
18691
|
+
</Show54>
|
|
17977
18692
|
|
|
17978
|
-
<
|
|
18693
|
+
<Show54 when={!resolving() && !noSubscription()}>
|
|
17979
18694
|
<form onSubmit={handleSubmit}>
|
|
17980
|
-
<
|
|
18695
|
+
<Show54 when={flow.error()}>
|
|
17981
18696
|
<div style={{ "margin-bottom": "1rem" }}>
|
|
17982
18697
|
<Banner variant="error">{flow.error()}</Banner>
|
|
17983
18698
|
</div>
|
|
17984
|
-
</
|
|
18699
|
+
</Show54>
|
|
17985
18700
|
|
|
17986
18701
|
<div style={{ display: "grid", gap: "1rem", "margin-bottom": "1.5rem" }}>
|
|
17987
18702
|
<TextField
|
|
@@ -18037,18 +18752,18 @@ function UpdatePaymentMethod(props) {
|
|
|
18037
18752
|
</Button>
|
|
18038
18753
|
</div>
|
|
18039
18754
|
</form>
|
|
18040
|
-
</
|
|
18755
|
+
</Show54>
|
|
18041
18756
|
</div>;
|
|
18042
18757
|
}
|
|
18043
18758
|
|
|
18044
18759
|
// src/pages/MemberPortal.tsx
|
|
18045
|
-
import { Show as
|
|
18760
|
+
import { Show as Show62, Switch as Switch5, Match as Match5, For as For47, createSignal as createSignal42, onMount as onMount5 } from "solid-js";
|
|
18046
18761
|
|
|
18047
18762
|
// src/pages/member/OrderTracker.tsx
|
|
18048
|
-
import { Show as
|
|
18763
|
+
import { Show as Show55, For as For42, createSignal as createSignal36 } from "solid-js";
|
|
18049
18764
|
function TrackingChip(props) {
|
|
18050
18765
|
let copied;
|
|
18051
|
-
const [announce, setAnnounce] =
|
|
18766
|
+
const [announce, setAnnounce] = createSignal36("");
|
|
18052
18767
|
const copy = async () => {
|
|
18053
18768
|
try {
|
|
18054
18769
|
await navigator.clipboard.writeText(props.number);
|
|
@@ -18074,18 +18789,18 @@ function TrackingChip(props) {
|
|
|
18074
18789
|
<i class="ph ph-copy ship__copy-icon" aria-hidden="true" />
|
|
18075
18790
|
<span class="ship__copied" ref={copied}>Copied ✓</span>
|
|
18076
18791
|
</button>
|
|
18077
|
-
<
|
|
18792
|
+
<Show55 when={props.url}>
|
|
18078
18793
|
<a class="ship__track" href={props.url} target="_blank" rel="noopener noreferrer">
|
|
18079
18794
|
Track{props.carrier ? ` with ${props.carrier}` : ""} ↗
|
|
18080
18795
|
</a>
|
|
18081
|
-
</
|
|
18796
|
+
</Show55>
|
|
18082
18797
|
</div>
|
|
18083
18798
|
<span class="portal-sr-only" role="status" aria-live="polite">{announce()}</span>
|
|
18084
18799
|
</div>;
|
|
18085
18800
|
}
|
|
18086
18801
|
function OrderTracker(props) {
|
|
18087
18802
|
const refill = () => buildRefillView(props.subscription);
|
|
18088
|
-
const RefillStrip = () => <
|
|
18803
|
+
const RefillStrip = () => <Show55 when={refill()}>
|
|
18089
18804
|
{(r) => <div class="refill" data-testid="refill-strip">
|
|
18090
18805
|
<div class="refill__head">
|
|
18091
18806
|
<span class="lab-label">Your plan</span>
|
|
@@ -18094,15 +18809,15 @@ function OrderTracker(props) {
|
|
|
18094
18809
|
awaiting the pharmacy there isn't one, so say what we're waiting
|
|
18095
18810
|
on instead of counting days against a date we don't have. */
|
|
18096
18811
|
}
|
|
18097
|
-
<
|
|
18812
|
+
<Show55
|
|
18098
18813
|
when={!r().pendingFill}
|
|
18099
18814
|
fallback={<span class="refill__cycle">Preparing your next fill</span>}
|
|
18100
18815
|
>
|
|
18101
18816
|
<span class="refill__cycle">Day {r().cycleDay} of {r().cycleLength}</span>
|
|
18102
|
-
</
|
|
18817
|
+
</Show55>
|
|
18103
18818
|
</div>
|
|
18104
18819
|
<div class="refill__rail" style={{ "--p": String(r().progress) }}>
|
|
18105
|
-
<
|
|
18820
|
+
<For42 each={r().events}>
|
|
18106
18821
|
{(e) => <div class={`refill__stone${e.nearest ? " is-near" : ""}`}>
|
|
18107
18822
|
<span class="refill__dot" aria-hidden="true" />
|
|
18108
18823
|
<span class="lab-label refill__label">{e.label}</span>
|
|
@@ -18114,16 +18829,16 @@ function OrderTracker(props) {
|
|
|
18114
18829
|
<span class="refill__rel">
|
|
18115
18830
|
{!r().precise && e.date ? `around ${e.relative}` : e.relative}
|
|
18116
18831
|
</span>
|
|
18117
|
-
<
|
|
18832
|
+
<Show55 when={e.key === "survey" ? props.pendingRenewalId : null} keyed>
|
|
18118
18833
|
{(rid) => <a href={props.renewHref(rid)} class="refill__action">
|
|
18119
18834
|
Complete check-in →
|
|
18120
18835
|
</a>}
|
|
18121
|
-
</
|
|
18836
|
+
</Show55>
|
|
18122
18837
|
</div>}
|
|
18123
|
-
</
|
|
18838
|
+
</For42>
|
|
18124
18839
|
</div>
|
|
18125
18840
|
</div>}
|
|
18126
|
-
</
|
|
18841
|
+
</Show55>;
|
|
18127
18842
|
const EmptyState2 = () => <div class="tracker">
|
|
18128
18843
|
<span class="lab-label">Your order</span>
|
|
18129
18844
|
<RefillStrip />
|
|
@@ -18132,11 +18847,11 @@ function OrderTracker(props) {
|
|
|
18132
18847
|
<span class="tracker__empty-bead" />
|
|
18133
18848
|
</div>
|
|
18134
18849
|
<h2 class="tracker__empty-title">Your journey starts here</h2>
|
|
18135
|
-
<
|
|
18850
|
+
<Show55 when={props.savingsMember}>
|
|
18136
18851
|
<p class="tracker__empty-text" data-testid="tracker-savings-note">
|
|
18137
18852
|
<strong>Member pricing is active on your account.</strong> It applies automatically when you check out.
|
|
18138
18853
|
</p>
|
|
18139
|
-
</
|
|
18854
|
+
</Show55>
|
|
18140
18855
|
<p class="tracker__empty-text">
|
|
18141
18856
|
{props.savingsMember ? "Complete a short intake \u2014 about ten minutes \u2014 and a clinician reviews it from there. You\u2019ll watch every step come together right here, from review to delivery." : "Once you complete your intake, you\u2019ll watch every step of your prescription come together right here \u2014 from review to delivery."}
|
|
18142
18857
|
</p>
|
|
@@ -18154,30 +18869,30 @@ function OrderTracker(props) {
|
|
|
18154
18869
|
>
|
|
18155
18870
|
<div class="thread__rail">
|
|
18156
18871
|
<span class="thread__bead">
|
|
18157
|
-
<
|
|
18872
|
+
<Show55 when={isActive}><span class="thread__halo" aria-hidden="true" /></Show55>
|
|
18158
18873
|
</span>
|
|
18159
18874
|
</div>
|
|
18160
18875
|
<div class={`thread__content${isActive ? " thread__content--active" : ""}`}>
|
|
18161
18876
|
<div class="thread__top">
|
|
18162
18877
|
<span class="lab-label thread__label">{s.label}</span>
|
|
18163
|
-
<
|
|
18878
|
+
<Show55 when={s.timestamp}>
|
|
18164
18879
|
<time class="thread__time">{formatStageDate(s.timestamp)}</time>
|
|
18165
|
-
</
|
|
18880
|
+
</Show55>
|
|
18166
18881
|
</div>
|
|
18167
|
-
<
|
|
18882
|
+
<Show55 when={s.heroWord}>
|
|
18168
18883
|
<h2 class="thread__hero">{s.heroWord}</h2>
|
|
18169
|
-
</
|
|
18170
|
-
<
|
|
18884
|
+
</Show55>
|
|
18885
|
+
<Show55 when={s.subCaption}>
|
|
18171
18886
|
<p class="thread__caption">{s.subCaption}</p>
|
|
18172
|
-
</
|
|
18173
|
-
<
|
|
18887
|
+
</Show55>
|
|
18888
|
+
<Show55 when={s.state === "active" && s.key === "shipped" && sp.view.shipment}>
|
|
18174
18889
|
<TrackingChip
|
|
18175
18890
|
number={sp.view.shipment.trackingNumber}
|
|
18176
18891
|
carrier={sp.view.shipment.carrier}
|
|
18177
18892
|
url={sp.view.shipment.trackingUrl}
|
|
18178
18893
|
eta={sp.view.shipment.etaLabel}
|
|
18179
18894
|
/>
|
|
18180
|
-
<
|
|
18895
|
+
<Show55 when={props.messagingEnabled}>
|
|
18181
18896
|
<button
|
|
18182
18897
|
type="button"
|
|
18183
18898
|
class="portal-btn portal-btn--ghost thread__action"
|
|
@@ -18185,10 +18900,10 @@ function OrderTracker(props) {
|
|
|
18185
18900
|
>
|
|
18186
18901
|
Where's my order?
|
|
18187
18902
|
</button>
|
|
18188
|
-
</
|
|
18189
|
-
</
|
|
18190
|
-
<
|
|
18191
|
-
<
|
|
18903
|
+
</Show55>
|
|
18904
|
+
</Show55>
|
|
18905
|
+
<Show55 when={s.state === "consult"}>
|
|
18906
|
+
<Show55
|
|
18192
18907
|
when={props.messagingEnabled}
|
|
18193
18908
|
fallback={<p class="thread__caption thread__await" data-testid="await-messaging">
|
|
18194
18909
|
Your care team is reviewing your request. You’ll be able to message them here once your consult begins.
|
|
@@ -18201,10 +18916,10 @@ function OrderTracker(props) {
|
|
|
18201
18916
|
>
|
|
18202
18917
|
Message your care team
|
|
18203
18918
|
</button>
|
|
18204
|
-
</
|
|
18205
|
-
</
|
|
18206
|
-
<
|
|
18207
|
-
<
|
|
18919
|
+
</Show55>
|
|
18920
|
+
</Show55>
|
|
18921
|
+
<Show55 when={s.state === "denied"}>
|
|
18922
|
+
<Show55
|
|
18208
18923
|
when={props.messagingEnabled}
|
|
18209
18924
|
fallback={<p class="thread__caption thread__await" data-testid="await-messaging">
|
|
18210
18925
|
Your provider will follow up with you about next steps.
|
|
@@ -18217,12 +18932,12 @@ function OrderTracker(props) {
|
|
|
18217
18932
|
>
|
|
18218
18933
|
Talk to your provider
|
|
18219
18934
|
</button>
|
|
18220
|
-
</
|
|
18221
|
-
</
|
|
18935
|
+
</Show55>
|
|
18936
|
+
</Show55>
|
|
18222
18937
|
</div>
|
|
18223
18938
|
</li>;
|
|
18224
18939
|
};
|
|
18225
|
-
return <
|
|
18940
|
+
return <Show55 when={props.request} fallback={<EmptyState2 />}>
|
|
18226
18941
|
{(rx) => {
|
|
18227
18942
|
const view = buildTrackerView(rx());
|
|
18228
18943
|
return <div class="tracker" data-testid="order-tracker">
|
|
@@ -18230,7 +18945,7 @@ function OrderTracker(props) {
|
|
|
18230
18945
|
<span class="lab-label">Your order</span>
|
|
18231
18946
|
<p class="tracker__med">
|
|
18232
18947
|
{props.medicationName}
|
|
18233
|
-
<
|
|
18948
|
+
<Show55 when={rx().dosage}><span class="tracker__dose"> · {rx().dosage}</span></Show55>
|
|
18234
18949
|
</p>
|
|
18235
18950
|
</div>
|
|
18236
18951
|
|
|
@@ -18240,17 +18955,17 @@ function OrderTracker(props) {
|
|
|
18240
18955
|
class={`thread${view.branch ? ` thread--${view.branch}` : ""}`}
|
|
18241
18956
|
style={{ "--active": String(view.activeIndex), "--count": String(view.stages.length) }}
|
|
18242
18957
|
>
|
|
18243
|
-
<
|
|
18958
|
+
<For42 each={view.stages}>
|
|
18244
18959
|
{(stage, i) => <Stage stage={stage} index={i()} view={view} />}
|
|
18245
|
-
</
|
|
18960
|
+
</For42>
|
|
18246
18961
|
</ol>
|
|
18247
18962
|
</div>;
|
|
18248
18963
|
}}
|
|
18249
|
-
</
|
|
18964
|
+
</Show55>;
|
|
18250
18965
|
}
|
|
18251
18966
|
|
|
18252
18967
|
// src/pages/member/RxRow.tsx
|
|
18253
|
-
import { Show as
|
|
18968
|
+
import { Show as Show56, createSignal as createSignal37 } from "solid-js";
|
|
18254
18969
|
var STATUS_LABEL = {
|
|
18255
18970
|
pending: "Under review",
|
|
18256
18971
|
approved: "Approved",
|
|
@@ -18261,7 +18976,7 @@ var STATUS_LABEL = {
|
|
|
18261
18976
|
denied: "Not approved"
|
|
18262
18977
|
};
|
|
18263
18978
|
function RxRow(props) {
|
|
18264
|
-
const [open, setOpen] =
|
|
18979
|
+
const [open, setOpen] = createSignal37(false);
|
|
18265
18980
|
const label3 = () => {
|
|
18266
18981
|
if (props.rx.status === "approved" && props.rx.delivery?.trackingNumber) return "On its way";
|
|
18267
18982
|
return STATUS_LABEL[props.rx.status] ?? props.rx.status;
|
|
@@ -18275,14 +18990,14 @@ function RxRow(props) {
|
|
|
18275
18990
|
>
|
|
18276
18991
|
<span class="rx-row__med">
|
|
18277
18992
|
{props.rx.drugName ?? "Medication"}
|
|
18278
|
-
<
|
|
18993
|
+
<Show56 when={props.rx.dosage}>
|
|
18279
18994
|
<span class="rx-row__dose"> · {props.rx.dosage}</span>
|
|
18280
|
-
</
|
|
18995
|
+
</Show56>
|
|
18281
18996
|
</span>
|
|
18282
18997
|
<span class="rx-row__status">{label3()}</span>
|
|
18283
18998
|
<i class={`ph ph-caret-${open() ? "up" : "down"} rx-row__chevron`} aria-hidden="true" />
|
|
18284
18999
|
</button>
|
|
18285
|
-
<
|
|
19000
|
+
<Show56 when={open()}>
|
|
18286
19001
|
<div class="rx-row__body">
|
|
18287
19002
|
<OrderTracker
|
|
18288
19003
|
request={props.request}
|
|
@@ -18295,12 +19010,12 @@ function RxRow(props) {
|
|
|
18295
19010
|
renewHref={props.renewHref}
|
|
18296
19011
|
/>
|
|
18297
19012
|
</div>
|
|
18298
|
-
</
|
|
19013
|
+
</Show56>
|
|
18299
19014
|
</div>;
|
|
18300
19015
|
}
|
|
18301
19016
|
|
|
18302
19017
|
// src/pages/member/PlanBilling.tsx
|
|
18303
|
-
import { Show as
|
|
19018
|
+
import { Show as Show57, createSignal as createSignal38 } from "solid-js";
|
|
18304
19019
|
function formatCents(cents) {
|
|
18305
19020
|
if (cents == null || Number.isNaN(cents)) return "\u2014";
|
|
18306
19021
|
return `$${(cents / 100).toFixed(2)}`;
|
|
@@ -18321,9 +19036,9 @@ var STATUS_COPY = {
|
|
|
18321
19036
|
};
|
|
18322
19037
|
var LIVE_STATUSES = /* @__PURE__ */ new Set(["active", "paused", "past_due"]);
|
|
18323
19038
|
function PlanBilling(props) {
|
|
18324
|
-
const [action, setAction] =
|
|
18325
|
-
const [confirmCancel, setConfirmCancel] =
|
|
18326
|
-
const [error, setError] =
|
|
19039
|
+
const [action, setAction] = createSignal38(null);
|
|
19040
|
+
const [confirmCancel, setConfirmCancel] = createSignal38(false);
|
|
19041
|
+
const [error, setError] = createSignal38(null);
|
|
18327
19042
|
const primary = () => {
|
|
18328
19043
|
const subs = props.subscriptions;
|
|
18329
19044
|
return subs.find((s) => LIVE_STATUSES.has(s.status)) ?? subs[0] ?? null;
|
|
@@ -18343,7 +19058,7 @@ function PlanBilling(props) {
|
|
|
18343
19058
|
return <div class="plan" data-testid="plan-billing">
|
|
18344
19059
|
<span class="lab-label">Plan & billing</span>
|
|
18345
19060
|
|
|
18346
|
-
<
|
|
19061
|
+
<Show57
|
|
18347
19062
|
when={primary()}
|
|
18348
19063
|
fallback={<div class="plan__empty">
|
|
18349
19064
|
<h2 class="plan__empty-title">No active plan</h2>
|
|
@@ -18359,7 +19074,7 @@ function PlanBilling(props) {
|
|
|
18359
19074
|
<span class="membership__brand">{props.brandName}</span>
|
|
18360
19075
|
</div>
|
|
18361
19076
|
<h2 class="membership__med">{sub().medicationName ?? sub().medication}</h2>
|
|
18362
|
-
<
|
|
19077
|
+
<Show57 when={sub().dosage}><p class="membership__dose">{sub().dosage}</p></Show57>
|
|
18363
19078
|
<div class="membership__bottom">
|
|
18364
19079
|
<span class="membership__price">
|
|
18365
19080
|
{formatCents(sub().amountCents)}<span class="membership__per">/mo</span>
|
|
@@ -18385,7 +19100,7 @@ function PlanBilling(props) {
|
|
|
18385
19100
|
</div>
|
|
18386
19101
|
</dl>
|
|
18387
19102
|
|
|
18388
|
-
<
|
|
19103
|
+
<Show57 when={props.messagingEnabled}>
|
|
18389
19104
|
<p class="plan__note">
|
|
18390
19105
|
Question about billing?{" "}
|
|
18391
19106
|
<button
|
|
@@ -18396,14 +19111,14 @@ function PlanBilling(props) {
|
|
|
18396
19111
|
Message support
|
|
18397
19112
|
</button>
|
|
18398
19113
|
</p>
|
|
18399
|
-
</
|
|
19114
|
+
</Show57>
|
|
18400
19115
|
|
|
18401
|
-
<
|
|
19116
|
+
<Show57 when={error()}>
|
|
18402
19117
|
<p class="plan__error" role="alert">{error()}</p>
|
|
18403
|
-
</
|
|
19118
|
+
</Show57>
|
|
18404
19119
|
|
|
18405
19120
|
<div class="plan__actions">
|
|
18406
|
-
<
|
|
19121
|
+
<Show57 when={sub().status === "active"}>
|
|
18407
19122
|
<button
|
|
18408
19123
|
type="button"
|
|
18409
19124
|
class="plan__link-btn"
|
|
@@ -18412,8 +19127,8 @@ function PlanBilling(props) {
|
|
|
18412
19127
|
>
|
|
18413
19128
|
{action() === "pause" ? "Pausing\u2026" : "Pause subscription"}
|
|
18414
19129
|
</button>
|
|
18415
|
-
</
|
|
18416
|
-
<
|
|
19130
|
+
</Show57>
|
|
19131
|
+
<Show57 when={sub().status === "paused"}>
|
|
18417
19132
|
<button
|
|
18418
19133
|
type="button"
|
|
18419
19134
|
class="plan__link-btn"
|
|
@@ -18422,11 +19137,11 @@ function PlanBilling(props) {
|
|
|
18422
19137
|
>
|
|
18423
19138
|
{action() === "resume" ? "Resuming\u2026" : "Resume subscription"}
|
|
18424
19139
|
</button>
|
|
18425
|
-
</
|
|
19140
|
+
</Show57>
|
|
18426
19141
|
|
|
18427
19142
|
<a href={props.paymentMethodHref} class="plan__link-btn">Update payment method</a>
|
|
18428
19143
|
|
|
18429
|
-
<
|
|
19144
|
+
<Show57 when={sub().status !== "cancelled" && sub().status !== "expired"}>
|
|
18430
19145
|
<button
|
|
18431
19146
|
type="button"
|
|
18432
19147
|
class="plan__link-btn plan__link-btn--quiet"
|
|
@@ -18435,10 +19150,10 @@ function PlanBilling(props) {
|
|
|
18435
19150
|
>
|
|
18436
19151
|
Cancel subscription
|
|
18437
19152
|
</button>
|
|
18438
|
-
</
|
|
19153
|
+
</Show57>
|
|
18439
19154
|
</div>
|
|
18440
19155
|
|
|
18441
|
-
<
|
|
19156
|
+
<Show57 when={confirmCancel()}>
|
|
18442
19157
|
<div class="confirm" data-testid="cancel-confirm">
|
|
18443
19158
|
<p class="confirm__text">
|
|
18444
19159
|
Cancel your subscription? You’ll keep access until the end of your current billing period
|
|
@@ -18463,14 +19178,14 @@ function PlanBilling(props) {
|
|
|
18463
19178
|
</button>
|
|
18464
19179
|
</div>
|
|
18465
19180
|
</div>
|
|
18466
|
-
</
|
|
19181
|
+
</Show57>
|
|
18467
19182
|
</>}
|
|
18468
|
-
</
|
|
19183
|
+
</Show57>
|
|
18469
19184
|
</div>;
|
|
18470
19185
|
}
|
|
18471
19186
|
|
|
18472
19187
|
// src/pages/member/AccountPanel.tsx
|
|
18473
|
-
import { Show as
|
|
19188
|
+
import { Show as Show58, For as For43 } from "solid-js";
|
|
18474
19189
|
function pick(member, ...keys) {
|
|
18475
19190
|
if (!member) return "";
|
|
18476
19191
|
for (const k of keys) {
|
|
@@ -18506,19 +19221,19 @@ function AccountPanel(props) {
|
|
|
18506
19221
|
<h1 class="account__title">Your details</h1>
|
|
18507
19222
|
|
|
18508
19223
|
<dl class="account__fields">
|
|
18509
|
-
<
|
|
19224
|
+
<For43 each={fields()}>
|
|
18510
19225
|
{(f) => <div class="account__field">
|
|
18511
19226
|
<dt class="lab-label">{f.label}</dt>
|
|
18512
19227
|
<dd>{f.value}</dd>
|
|
18513
19228
|
</div>}
|
|
18514
|
-
</
|
|
19229
|
+
</For43>
|
|
18515
19230
|
</dl>
|
|
18516
19231
|
|
|
18517
|
-
<
|
|
19232
|
+
<Show58 when={fields().length === 0}>
|
|
18518
19233
|
<p class="account__empty">We don’t have your details on file yet.</p>
|
|
18519
|
-
</
|
|
19234
|
+
</Show58>
|
|
18520
19235
|
|
|
18521
|
-
<
|
|
19236
|
+
<Show58 when={props.messagingEnabled}>
|
|
18522
19237
|
<p class="account__note">
|
|
18523
19238
|
Need to update something?{" "}
|
|
18524
19239
|
<button
|
|
@@ -18530,17 +19245,17 @@ function AccountPanel(props) {
|
|
|
18530
19245
|
</button>{" "}
|
|
18531
19246
|
and we’ll take care of it.
|
|
18532
19247
|
</p>
|
|
18533
|
-
</
|
|
19248
|
+
</Show58>
|
|
18534
19249
|
|
|
18535
19250
|
<div class="account__support">
|
|
18536
|
-
<
|
|
19251
|
+
<Show58 when={props.messagingEnabled}>
|
|
18537
19252
|
<button type="button" class="account__support-link account__support-btn" onClick={() => props.onOpenMessages()}>
|
|
18538
19253
|
Messages
|
|
18539
19254
|
</button>
|
|
18540
|
-
</
|
|
18541
|
-
<
|
|
19255
|
+
</Show58>
|
|
19256
|
+
<For43 each={props.legalLinks ?? []}>
|
|
18542
19257
|
{(link) => <a href={link.href} class="account__support-link">{link.label}</a>}
|
|
18543
|
-
</
|
|
19258
|
+
</For43>
|
|
18544
19259
|
</div>
|
|
18545
19260
|
|
|
18546
19261
|
<button type="button" class="portal-btn portal-btn--ghost account__signout" onClick={props.onSignOut}>
|
|
@@ -18550,13 +19265,13 @@ function AccountPanel(props) {
|
|
|
18550
19265
|
}
|
|
18551
19266
|
|
|
18552
19267
|
// src/pages/member/MedicationGuide.tsx
|
|
18553
|
-
import { Show as
|
|
19268
|
+
import { Show as Show59, For as For44, createSignal as createSignal39 } from "solid-js";
|
|
18554
19269
|
function firstNumber(s) {
|
|
18555
19270
|
const m = (s || "").match(/\d+(\.\d+)?/);
|
|
18556
19271
|
return m ? m[0] : null;
|
|
18557
19272
|
}
|
|
18558
19273
|
function MedicationGuide(props) {
|
|
18559
|
-
const [showDisclaimers, setShowDisclaimers] =
|
|
19274
|
+
const [showDisclaimers, setShowDisclaimers] = createSignal39(false);
|
|
18560
19275
|
const activeTitrationIndex = () => {
|
|
18561
19276
|
const dose = firstNumber(props.currentDose);
|
|
18562
19277
|
if (!dose) return -1;
|
|
@@ -18593,7 +19308,7 @@ function MedicationGuide(props) {
|
|
|
18593
19308
|
<section class="leaflet__section leaflet__section--caution">
|
|
18594
19309
|
<h2 class="leaflet__h2">Do not use this medicine if…</h2>
|
|
18595
19310
|
<ul class="leaflet__list leaflet__list--caution">
|
|
18596
|
-
<
|
|
19311
|
+
<For44 each={props.guide.doNotUseIf}>{(item) => <li>{item}</li>}</For44>
|
|
18597
19312
|
</ul>
|
|
18598
19313
|
</section>
|
|
18599
19314
|
|
|
@@ -18604,7 +19319,7 @@ function MedicationGuide(props) {
|
|
|
18604
19319
|
<h2 class="leaflet__h2">Your dose over time</h2>
|
|
18605
19320
|
<p class="leaflet__note">A typical step-up. Your prescriber sets your exact doses and timing.</p>
|
|
18606
19321
|
<ol class="titration">
|
|
18607
|
-
<
|
|
19322
|
+
<For44 each={props.guide.titration}>
|
|
18608
19323
|
{(step, i) => <li class={`titration__step titration__step--${titrationState(i())}`}>
|
|
18609
19324
|
<span class="titration__bead" aria-hidden="true" />
|
|
18610
19325
|
<div class="titration__body">
|
|
@@ -18616,14 +19331,14 @@ function MedicationGuide(props) {
|
|
|
18616
19331
|
<p class="titration__note">{step.note}</p>
|
|
18617
19332
|
</div>
|
|
18618
19333
|
</li>}
|
|
18619
|
-
</
|
|
19334
|
+
</For44>
|
|
18620
19335
|
</ol>
|
|
18621
19336
|
</section>
|
|
18622
19337
|
|
|
18623
19338
|
<section class="leaflet__section">
|
|
18624
19339
|
<h2 class="leaflet__h2">Giving your injection</h2>
|
|
18625
19340
|
<ol class="steps">
|
|
18626
|
-
<
|
|
19341
|
+
<For44 each={props.guide.injectionSteps}>
|
|
18627
19342
|
{(step) => <li class="steps__item">
|
|
18628
19343
|
<span class="steps__num">{step.n}</span>
|
|
18629
19344
|
<div class="steps__body">
|
|
@@ -18631,7 +19346,7 @@ function MedicationGuide(props) {
|
|
|
18631
19346
|
<p class="steps__detail">{step.detail}</p>
|
|
18632
19347
|
</div>
|
|
18633
19348
|
</li>}
|
|
18634
|
-
</
|
|
19349
|
+
</For44>
|
|
18635
19350
|
</ol>
|
|
18636
19351
|
</section>
|
|
18637
19352
|
|
|
@@ -18639,7 +19354,7 @@ function MedicationGuide(props) {
|
|
|
18639
19354
|
<section class="leaflet__section">
|
|
18640
19355
|
<h2 class="leaflet__h2">Storing your medicine</h2>
|
|
18641
19356
|
<ul class="leaflet__list">
|
|
18642
|
-
<
|
|
19357
|
+
<For44 each={props.guide.storage}>{(item) => <li>{item}</li>}</For44>
|
|
18643
19358
|
</ul>
|
|
18644
19359
|
</section>
|
|
18645
19360
|
|
|
@@ -18649,25 +19364,25 @@ function MedicationGuide(props) {
|
|
|
18649
19364
|
</section>
|
|
18650
19365
|
</div>
|
|
18651
19366
|
|
|
18652
|
-
<
|
|
19367
|
+
<Show59 when={props.guide.contraception}>
|
|
18653
19368
|
<section class="leaflet__section leaflet__section--caution">
|
|
18654
19369
|
<h2 class="leaflet__h2">Birth control</h2>
|
|
18655
19370
|
<p class="leaflet__body">{props.guide.contraception}</p>
|
|
18656
19371
|
</section>
|
|
18657
|
-
</
|
|
19372
|
+
</Show59>
|
|
18658
19373
|
|
|
18659
19374
|
<div class="leaflet__grid">
|
|
18660
19375
|
<section class="leaflet__section">
|
|
18661
19376
|
<h2 class="leaflet__h2">Common side effects</h2>
|
|
18662
19377
|
<ul class="leaflet__list leaflet__list--check">
|
|
18663
|
-
<
|
|
19378
|
+
<For44 each={props.guide.sideEffectsCommon}>{(item) => <li>{item}</li>}</For44>
|
|
18664
19379
|
</ul>
|
|
18665
19380
|
</section>
|
|
18666
19381
|
|
|
18667
19382
|
<section class="leaflet__section leaflet__section--alert">
|
|
18668
19383
|
<h2 class="leaflet__h2">Call right away if you notice…</h2>
|
|
18669
19384
|
<ul class="leaflet__list leaflet__list--alert">
|
|
18670
|
-
<
|
|
19385
|
+
<For44 each={props.guide.sideEffectsSerious}>{(item) => <li>{item}</li>}</For44>
|
|
18671
19386
|
</ul>
|
|
18672
19387
|
</section>
|
|
18673
19388
|
</div>
|
|
@@ -18675,14 +19390,14 @@ function MedicationGuide(props) {
|
|
|
18675
19390
|
<section class="leaflet__section">
|
|
18676
19391
|
<h2 class="leaflet__h2">When to contact your care team</h2>
|
|
18677
19392
|
<ul class="leaflet__list">
|
|
18678
|
-
<
|
|
19393
|
+
<For44 each={props.guide.whenToCall}>{(item) => <li>{item}</li>}</For44>
|
|
18679
19394
|
</ul>
|
|
18680
19395
|
</section>
|
|
18681
19396
|
|
|
18682
19397
|
<section class="leaflet__section">
|
|
18683
19398
|
<h2 class="leaflet__h2">Tips for feeling your best</h2>
|
|
18684
19399
|
<ul class="leaflet__list leaflet__list--check">
|
|
18685
|
-
<
|
|
19400
|
+
<For44 each={props.guide.tips}>{(item) => <li>{item}</li>}</For44>
|
|
18686
19401
|
</ul>
|
|
18687
19402
|
</section>
|
|
18688
19403
|
|
|
@@ -18697,17 +19412,17 @@ function MedicationGuide(props) {
|
|
|
18697
19412
|
{showDisclaimers() ? "Hide" : "Read"} the important details
|
|
18698
19413
|
<i class={`ph ph-caret-${showDisclaimers() ? "up" : "down"}`} aria-hidden="true" />
|
|
18699
19414
|
</button>
|
|
18700
|
-
<
|
|
19415
|
+
<Show59 when={showDisclaimers()}>
|
|
18701
19416
|
<ul class="leaflet__disclaimers" id="leaflet-disclaimers">
|
|
18702
|
-
<
|
|
19417
|
+
<For44 each={props.guide.disclaimers}>{(item) => <li>{item}</li>}</For44>
|
|
18703
19418
|
</ul>
|
|
18704
|
-
</
|
|
19419
|
+
</Show59>
|
|
18705
19420
|
</section>
|
|
18706
19421
|
</div>;
|
|
18707
19422
|
}
|
|
18708
19423
|
|
|
18709
19424
|
// src/pages/member/MessagesPanel.tsx
|
|
18710
|
-
import { Show as
|
|
19425
|
+
import { Show as Show60, For as For45, Switch as Switch4, Match as Match4, createEffect as createEffect14, createSignal as createSignal40, on as on8 } from "solid-js";
|
|
18711
19426
|
import DOMPurify from "dompurify";
|
|
18712
19427
|
function sanitizeMessageHtml(html) {
|
|
18713
19428
|
return DOMPurify.sanitize(html, {
|
|
@@ -18762,9 +19477,9 @@ function rejectionReason(file) {
|
|
|
18762
19477
|
}
|
|
18763
19478
|
function MessagesPanel(props) {
|
|
18764
19479
|
const thread = () => props.thread;
|
|
18765
|
-
const [channel, setChannel] =
|
|
18766
|
-
const [threadNotFound, setThreadNotFound] =
|
|
18767
|
-
const [pendingThreadIntentId, setPendingThreadIntentId] =
|
|
19480
|
+
const [channel, setChannel] = createSignal40("gate");
|
|
19481
|
+
const [threadNotFound, setThreadNotFound] = createSignal40(false);
|
|
19482
|
+
const [pendingThreadIntentId, setPendingThreadIntentId] = createSignal40(null);
|
|
18768
19483
|
function switchChannel(next) {
|
|
18769
19484
|
thread().clearSelection();
|
|
18770
19485
|
setChannel(next);
|
|
@@ -18775,17 +19490,17 @@ function MessagesPanel(props) {
|
|
|
18775
19490
|
setThreadNotFound(false);
|
|
18776
19491
|
setPendingThreadIntentId(null);
|
|
18777
19492
|
}
|
|
18778
|
-
const [composing, setComposing] =
|
|
18779
|
-
const [composeStep, setComposeStep] =
|
|
19493
|
+
const [composing, setComposing] = createSignal40(false);
|
|
19494
|
+
const [composeStep, setComposeStep] = createSignal40(
|
|
18780
19495
|
"support"
|
|
18781
19496
|
);
|
|
18782
|
-
const [newSubject, setNewSubject] =
|
|
18783
|
-
const [newBody, setNewBody] =
|
|
18784
|
-
const [newCategory, setNewCategory] =
|
|
18785
|
-
const [composeError, setComposeError] =
|
|
18786
|
-
const [pendingFile, setPendingFile] =
|
|
18787
|
-
const [newFile, setNewFile] =
|
|
18788
|
-
const [attachError, setAttachError] =
|
|
19497
|
+
const [newSubject, setNewSubject] = createSignal40("");
|
|
19498
|
+
const [newBody, setNewBody] = createSignal40("");
|
|
19499
|
+
const [newCategory, setNewCategory] = createSignal40(null);
|
|
19500
|
+
const [composeError, setComposeError] = createSignal40(null);
|
|
19501
|
+
const [pendingFile, setPendingFile] = createSignal40(null);
|
|
19502
|
+
const [newFile, setNewFile] = createSignal40(null);
|
|
19503
|
+
const [attachError, setAttachError] = createSignal40(null);
|
|
18789
19504
|
function stageFile(input, set) {
|
|
18790
19505
|
const file = input.files?.[0];
|
|
18791
19506
|
input.value = "";
|
|
@@ -18821,8 +19536,8 @@ function MessagesPanel(props) {
|
|
|
18821
19536
|
setComposing(true);
|
|
18822
19537
|
}
|
|
18823
19538
|
let composerRef;
|
|
18824
|
-
|
|
18825
|
-
|
|
19539
|
+
createEffect14(
|
|
19540
|
+
on8(
|
|
18826
19541
|
() => props.intent,
|
|
18827
19542
|
(current2) => {
|
|
18828
19543
|
if (!current2) return;
|
|
@@ -18853,7 +19568,7 @@ function MessagesPanel(props) {
|
|
|
18853
19568
|
}
|
|
18854
19569
|
)
|
|
18855
19570
|
);
|
|
18856
|
-
|
|
19571
|
+
createEffect14(() => {
|
|
18857
19572
|
const id = pendingThreadIntentId();
|
|
18858
19573
|
if (!id) return;
|
|
18859
19574
|
if (thread().loadingConversations()) return;
|
|
@@ -18924,7 +19639,7 @@ function MessagesPanel(props) {
|
|
|
18924
19639
|
}
|
|
18925
19640
|
const selectedConvo = () => thread().conversations().find((c) => c.id === thread().selectedId());
|
|
18926
19641
|
let endRef;
|
|
18927
|
-
|
|
19642
|
+
createEffect14(() => {
|
|
18928
19643
|
void thread().messages();
|
|
18929
19644
|
requestAnimationFrame(() => endRef?.scrollIntoView?.({ behavior: "smooth", block: "end" }));
|
|
18930
19645
|
});
|
|
@@ -18940,9 +19655,9 @@ function MessagesPanel(props) {
|
|
|
18940
19655
|
data-channel={p.source}
|
|
18941
19656
|
>
|
|
18942
19657
|
{p.source === "clinical" ? "Care team" : "Support"}
|
|
18943
|
-
<
|
|
19658
|
+
<Show60 when={p.source === "support" && categoryLabel(p.category)}>
|
|
18944
19659
|
{(label3) => <span class="channel-chip__category">{label3()}</span>}
|
|
18945
|
-
</
|
|
19660
|
+
</Show60>
|
|
18946
19661
|
</span>;
|
|
18947
19662
|
const channelConversations = () => thread().conversations().filter((c) => c.source === (channel() === "care" ? "clinical" : "support"));
|
|
18948
19663
|
const ConversationList = () => <>
|
|
@@ -18971,29 +19686,29 @@ function MessagesPanel(props) {
|
|
|
18971
19686
|
</div>
|
|
18972
19687
|
|
|
18973
19688
|
<div class="msg-list__scroll" data-scrollable>
|
|
18974
|
-
<
|
|
19689
|
+
<Show60 when={thread().loadingConversations()}>
|
|
18975
19690
|
<div class="msg-list__state">
|
|
18976
19691
|
<div class="request-status__spinner" />
|
|
18977
19692
|
</div>
|
|
18978
|
-
</
|
|
19693
|
+
</Show60>
|
|
18979
19694
|
|
|
18980
|
-
<
|
|
19695
|
+
<Show60 when={!thread().loadingConversations() && channelConversations().length === 0}>
|
|
18981
19696
|
<div class="msg-list__state msg-list__state--empty" data-testid="messages-empty">
|
|
18982
19697
|
<i class="ph-thin ph-chat-circle msg-list__empty-icon" aria-hidden="true" />
|
|
18983
19698
|
<p class="msg-list__empty-title">No conversations yet.</p>
|
|
18984
19699
|
<p class="msg-list__empty-hint">
|
|
18985
|
-
<
|
|
19700
|
+
<Show60
|
|
18986
19701
|
when={channel() === "care"}
|
|
18987
19702
|
fallback="Message support about your account, an order, billing or the site."
|
|
18988
19703
|
>
|
|
18989
19704
|
Your care team reviews and responds to anything about your treatment, medication
|
|
18990
19705
|
or side effects.
|
|
18991
|
-
</
|
|
19706
|
+
</Show60>
|
|
18992
19707
|
</p>
|
|
18993
19708
|
</div>
|
|
18994
|
-
</
|
|
19709
|
+
</Show60>
|
|
18995
19710
|
|
|
18996
|
-
<
|
|
19711
|
+
<For45 each={channelConversations()}>
|
|
18997
19712
|
{(convo) => <button
|
|
18998
19713
|
type="button"
|
|
18999
19714
|
class={`msg-list__item${thread().selectedId() === convo.id ? " is-active" : ""}`}
|
|
@@ -19009,17 +19724,17 @@ function MessagesPanel(props) {
|
|
|
19009
19724
|
</div>
|
|
19010
19725
|
<div class="msg-list__row">
|
|
19011
19726
|
<span class="msg-list__preview">{convo.lastMessage ?? "No messages yet"}</span>
|
|
19012
|
-
<
|
|
19727
|
+
<Show60 when={(convo.unreadCount ?? 0) > 0}>
|
|
19013
19728
|
<span class="msg-list__pip">{convo.unreadCount}</span>
|
|
19014
|
-
</
|
|
19729
|
+
</Show60>
|
|
19015
19730
|
</div>
|
|
19016
19731
|
</button>}
|
|
19017
|
-
</
|
|
19732
|
+
</For45>
|
|
19018
19733
|
</div>
|
|
19019
19734
|
</>;
|
|
19020
19735
|
const Attachment = (p) => {
|
|
19021
|
-
const [url, setUrl] =
|
|
19022
|
-
const [failed, setFailed] =
|
|
19736
|
+
const [url, setUrl] = createSignal40(p.attachment.url ?? null);
|
|
19737
|
+
const [failed, setFailed] = createSignal40(false);
|
|
19023
19738
|
let retried = false;
|
|
19024
19739
|
const resolve = async (force = false) => {
|
|
19025
19740
|
const next = await thread().resolveAttachmentUrl(p.attachment.id, force);
|
|
@@ -19027,14 +19742,14 @@ function MessagesPanel(props) {
|
|
|
19027
19742
|
else setFailed(true);
|
|
19028
19743
|
return next;
|
|
19029
19744
|
};
|
|
19030
|
-
|
|
19745
|
+
createEffect14(() => {
|
|
19031
19746
|
if (isImageAttachment(p.attachment) && !url()) void resolve();
|
|
19032
19747
|
});
|
|
19033
19748
|
const openDocument = async () => {
|
|
19034
19749
|
const href = url() ?? await resolve();
|
|
19035
19750
|
if (href) window.open(href, "_blank", "noopener");
|
|
19036
19751
|
};
|
|
19037
|
-
return <
|
|
19752
|
+
return <Show60
|
|
19038
19753
|
when={isImageAttachment(p.attachment)}
|
|
19039
19754
|
fallback={<button
|
|
19040
19755
|
type="button"
|
|
@@ -19053,7 +19768,7 @@ function MessagesPanel(props) {
|
|
|
19053
19768
|
</span>
|
|
19054
19769
|
</button>}
|
|
19055
19770
|
>
|
|
19056
|
-
<
|
|
19771
|
+
<Show60
|
|
19057
19772
|
when={url() && !failed()}
|
|
19058
19773
|
fallback={<span class="msg-attachment__fallback">
|
|
19059
19774
|
{failed() ? "Attachment unavailable" : "Loading\u2026"}
|
|
@@ -19075,13 +19790,13 @@ function MessagesPanel(props) {
|
|
|
19075
19790
|
}}
|
|
19076
19791
|
/>
|
|
19077
19792
|
</button>
|
|
19078
|
-
</
|
|
19079
|
-
</
|
|
19793
|
+
</Show60>
|
|
19794
|
+
</Show60>;
|
|
19080
19795
|
};
|
|
19081
19796
|
const Bubble = (p) => {
|
|
19082
19797
|
const isOwn = () => p.msg.senderRole === "patient";
|
|
19083
19798
|
const body = () => p.msg.text || p.msg.content || "";
|
|
19084
|
-
return <
|
|
19799
|
+
return <Show60
|
|
19085
19800
|
when={p.msg.type !== "system"}
|
|
19086
19801
|
fallback={<p class="msg-thread__system" data-testid="system-message">
|
|
19087
19802
|
{body()}
|
|
@@ -19089,15 +19804,15 @@ function MessagesPanel(props) {
|
|
|
19089
19804
|
>
|
|
19090
19805
|
<div class={`msg-thread__line${isOwn() ? " msg-thread__line--own" : ""}`}>
|
|
19091
19806
|
<div class={`msg-thread__bubble${isOwn() ? " msg-thread__bubble--own" : ""}`}>
|
|
19092
|
-
<
|
|
19807
|
+
<Show60 when={!isOwn() && p.msg.senderName}>
|
|
19093
19808
|
<p class="msg-thread__sender">{p.msg.senderName}</p>
|
|
19094
|
-
</
|
|
19809
|
+
</Show60>
|
|
19095
19810
|
{
|
|
19096
19811
|
/* An attachment may arrive with no caption, so don't render an
|
|
19097
19812
|
empty paragraph in that case. */
|
|
19098
19813
|
}
|
|
19099
|
-
<
|
|
19100
|
-
<
|
|
19814
|
+
<Show60 when={body()}>
|
|
19815
|
+
<Show60
|
|
19101
19816
|
when={p.msg.type === "html"}
|
|
19102
19817
|
fallback={<p class="msg-thread__text">{body()}</p>}
|
|
19103
19818
|
>
|
|
@@ -19108,17 +19823,17 @@ function MessagesPanel(props) {
|
|
|
19108
19823
|
stored XSS in every one of them. */
|
|
19109
19824
|
}
|
|
19110
19825
|
<div class="msg-thread__text" innerHTML={sanitizeMessageHtml(body())} />
|
|
19111
|
-
</
|
|
19112
|
-
</
|
|
19113
|
-
<
|
|
19826
|
+
</Show60>
|
|
19827
|
+
</Show60>
|
|
19828
|
+
<Show60 when={p.msg.attachments?.length}>
|
|
19114
19829
|
<div class="msg-attachment">
|
|
19115
|
-
<
|
|
19830
|
+
<For45 each={p.msg.attachments}>{(a) => <Attachment attachment={a} />}</For45>
|
|
19116
19831
|
</div>
|
|
19117
|
-
</
|
|
19832
|
+
</Show60>
|
|
19118
19833
|
<p class="msg-thread__meta">{formatMessageTime(p.msg.createdAt)}</p>
|
|
19119
19834
|
</div>
|
|
19120
19835
|
</div>
|
|
19121
|
-
</
|
|
19836
|
+
</Show60>;
|
|
19122
19837
|
};
|
|
19123
19838
|
const NewSupportThread = () => <form class="msg-thread msg-thread--compose" onSubmit={submitCompose} data-testid="support-compose">
|
|
19124
19839
|
<div class="msg-thread__header">
|
|
@@ -19142,7 +19857,7 @@ function MessagesPanel(props) {
|
|
|
19142
19857
|
What's this about? <span class="msg-compose__label-optional">(optional)</span>
|
|
19143
19858
|
</label>
|
|
19144
19859
|
<div class="msg-compose__categories" role="group" aria-labelledby="support-category-label">
|
|
19145
|
-
<
|
|
19860
|
+
<For45 each={SUPPORT_CATEGORIES}>
|
|
19146
19861
|
{(c) => <button
|
|
19147
19862
|
type="button"
|
|
19148
19863
|
class={`msg-compose__category-chip${newCategory() === c.key ? " is-selected" : ""}`}
|
|
@@ -19152,7 +19867,7 @@ function MessagesPanel(props) {
|
|
|
19152
19867
|
>
|
|
19153
19868
|
{c.label}
|
|
19154
19869
|
</button>}
|
|
19155
|
-
</
|
|
19870
|
+
</For45>
|
|
19156
19871
|
</div>
|
|
19157
19872
|
|
|
19158
19873
|
<label class="msg-compose__label" for="support-subject">
|
|
@@ -19196,7 +19911,7 @@ function MessagesPanel(props) {
|
|
|
19196
19911
|
onChange={(e) => stageFile(e.currentTarget, setNewFile)}
|
|
19197
19912
|
/>
|
|
19198
19913
|
</label>
|
|
19199
|
-
<
|
|
19914
|
+
<Show60 when={newFile()}>
|
|
19200
19915
|
<button
|
|
19201
19916
|
type="button"
|
|
19202
19917
|
class="msg-compose__staged-remove msg-compose__staged-remove--inline"
|
|
@@ -19204,13 +19919,13 @@ function MessagesPanel(props) {
|
|
|
19204
19919
|
>
|
|
19205
19920
|
Remove file
|
|
19206
19921
|
</button>
|
|
19207
|
-
</
|
|
19922
|
+
</Show60>
|
|
19208
19923
|
|
|
19209
|
-
<
|
|
19924
|
+
<Show60 when={attachError() || composeError()}>
|
|
19210
19925
|
<p class="msg-compose__error" role="alert">
|
|
19211
19926
|
{attachError() ?? composeError()}
|
|
19212
19927
|
</p>
|
|
19213
|
-
</
|
|
19928
|
+
</Show60>
|
|
19214
19929
|
|
|
19215
19930
|
<button
|
|
19216
19931
|
type="submit"
|
|
@@ -19267,7 +19982,7 @@ function MessagesPanel(props) {
|
|
|
19267
19982
|
onChange={(e) => stageFile(e.currentTarget, setNewFile)}
|
|
19268
19983
|
/>
|
|
19269
19984
|
</label>
|
|
19270
|
-
<
|
|
19985
|
+
<Show60 when={newFile()}>
|
|
19271
19986
|
<button
|
|
19272
19987
|
type="button"
|
|
19273
19988
|
class="msg-compose__staged-remove msg-compose__staged-remove--inline"
|
|
@@ -19275,13 +19990,13 @@ function MessagesPanel(props) {
|
|
|
19275
19990
|
>
|
|
19276
19991
|
Remove file
|
|
19277
19992
|
</button>
|
|
19278
|
-
</
|
|
19993
|
+
</Show60>
|
|
19279
19994
|
|
|
19280
|
-
<
|
|
19995
|
+
<Show60 when={attachError() || composeError()}>
|
|
19281
19996
|
<p class="msg-compose__error" role="alert">
|
|
19282
19997
|
{attachError() ?? composeError()}
|
|
19283
19998
|
</p>
|
|
19284
|
-
</
|
|
19999
|
+
</Show60>
|
|
19285
20000
|
|
|
19286
20001
|
<button
|
|
19287
20002
|
type="submit"
|
|
@@ -19313,19 +20028,19 @@ function MessagesPanel(props) {
|
|
|
19313
20028
|
<i class="ph-thin ph-heartbeat msg-choice__option-icon" aria-hidden="true" />
|
|
19314
20029
|
<span class="msg-choice__option-title">My care team</span>
|
|
19315
20030
|
<span class="msg-choice__option-sub">Treatment, medication or side effects</span>
|
|
19316
|
-
<
|
|
20031
|
+
<Show60
|
|
19317
20032
|
when={!thread().loadingConversations()}
|
|
19318
20033
|
fallback={<span
|
|
19319
20034
|
class="msg-choice__option-spinner request-status__spinner"
|
|
19320
20035
|
data-testid="gate-care-loading"
|
|
19321
20036
|
/>}
|
|
19322
20037
|
>
|
|
19323
|
-
<
|
|
20038
|
+
<Show60 when={careUnreadCount() > 0}>
|
|
19324
20039
|
<span class="msg-choice__option-badge" data-testid="gate-care-badge">
|
|
19325
20040
|
{careUnreadCount()}
|
|
19326
20041
|
</span>
|
|
19327
|
-
</
|
|
19328
|
-
</
|
|
20042
|
+
</Show60>
|
|
20043
|
+
</Show60>
|
|
19329
20044
|
</button>
|
|
19330
20045
|
<button
|
|
19331
20046
|
type="button"
|
|
@@ -19336,27 +20051,27 @@ function MessagesPanel(props) {
|
|
|
19336
20051
|
<i class="ph-thin ph-lifebuoy msg-choice__option-icon" aria-hidden="true" />
|
|
19337
20052
|
<span class="msg-choice__option-title">Support</span>
|
|
19338
20053
|
<span class="msg-choice__option-sub">Account, orders, billing or the website</span>
|
|
19339
|
-
<
|
|
20054
|
+
<Show60
|
|
19340
20055
|
when={!thread().loadingConversations()}
|
|
19341
20056
|
fallback={<span
|
|
19342
20057
|
class="msg-choice__option-spinner request-status__spinner"
|
|
19343
20058
|
data-testid="gate-support-loading"
|
|
19344
20059
|
/>}
|
|
19345
20060
|
>
|
|
19346
|
-
<
|
|
20061
|
+
<Show60 when={supportUnreadCount() > 0}>
|
|
19347
20062
|
<span class="msg-choice__option-badge" data-testid="gate-support-badge">
|
|
19348
20063
|
{supportUnreadCount()}
|
|
19349
20064
|
</span>
|
|
19350
|
-
</
|
|
19351
|
-
</
|
|
20065
|
+
</Show60>
|
|
20066
|
+
</Show60>
|
|
19352
20067
|
</button>
|
|
19353
20068
|
</div>
|
|
19354
20069
|
|
|
19355
|
-
<
|
|
20070
|
+
<Show60 when={threadNotFound()}>
|
|
19356
20071
|
<p class="msg-choice__notice-text" data-testid="messages-gate-note">
|
|
19357
20072
|
That conversation isn't available.
|
|
19358
20073
|
</p>
|
|
19359
|
-
</
|
|
20074
|
+
</Show60>
|
|
19360
20075
|
</div>;
|
|
19361
20076
|
const CareTeamNotice = () => <div class="msg-thread msg-choice" data-testid="care-team-notice">
|
|
19362
20077
|
<div class="msg-thread__header">
|
|
@@ -19406,9 +20121,9 @@ function MessagesPanel(props) {
|
|
|
19406
20121
|
<div>
|
|
19407
20122
|
<div class="msg-thread__title-row">
|
|
19408
20123
|
<h3 class="msg-thread__name">{selectedConvo()?.participantName ?? "Provider"}</h3>
|
|
19409
|
-
<
|
|
20124
|
+
<Show60 when={selectedConvo()}>
|
|
19410
20125
|
{(convo) => <ChannelChip source={convo().source} category={convo().category} />}
|
|
19411
|
-
</
|
|
20126
|
+
</Show60>
|
|
19412
20127
|
</div>
|
|
19413
20128
|
<p class="msg-thread__role">{selectedConvo()?.participantRole ?? "Prescriber"}</p>
|
|
19414
20129
|
</div>
|
|
@@ -19417,23 +20132,23 @@ function MessagesPanel(props) {
|
|
|
19417
20132
|
it — so this is a status cue, not a lock. A transferred one is
|
|
19418
20133
|
different: its content now lives with the care team, so it's read-only. */
|
|
19419
20134
|
}
|
|
19420
|
-
<
|
|
20135
|
+
<Show60 when={selectedConvo()?.source === "support" && selectedConvo()?.status === "closed"}>
|
|
19421
20136
|
<span class="msg-thread__status" data-testid="thread-status-closed">
|
|
19422
20137
|
Resolved
|
|
19423
20138
|
</span>
|
|
19424
|
-
</
|
|
19425
|
-
<
|
|
20139
|
+
</Show60>
|
|
20140
|
+
<Show60 when={selectedConvo()?.source === "support" && selectedConvo()?.status === "transferred"}>
|
|
19426
20141
|
<span class="msg-thread__status" data-testid="thread-status-transferred">
|
|
19427
20142
|
Moved to care team
|
|
19428
20143
|
</span>
|
|
19429
|
-
</
|
|
20144
|
+
</Show60>
|
|
19430
20145
|
</div>
|
|
19431
20146
|
|
|
19432
20147
|
{
|
|
19433
20148
|
/* A closed (often transferred-back) support thread offers a jump straight
|
|
19434
20149
|
to the care team, rather than making the customer find the gate. */
|
|
19435
20150
|
}
|
|
19436
|
-
<
|
|
20151
|
+
<Show60
|
|
19437
20152
|
when={selectedConvo()?.source === "support" && (selectedConvo()?.status === "closed" || selectedConvo()?.status === "transferred")}
|
|
19438
20153
|
>
|
|
19439
20154
|
<div class="msg-thread__banner">
|
|
@@ -19446,21 +20161,21 @@ function MessagesPanel(props) {
|
|
|
19446
20161
|
Continue with your care team
|
|
19447
20162
|
</button>
|
|
19448
20163
|
</div>
|
|
19449
|
-
</
|
|
20164
|
+
</Show60>
|
|
19450
20165
|
|
|
19451
20166
|
<div class="msg-thread__messages" data-scrollable>
|
|
19452
|
-
<
|
|
20167
|
+
<Show60 when={thread().loadingMessages()}>
|
|
19453
20168
|
<div class="msg-list__state">
|
|
19454
20169
|
<div class="request-status__spinner" />
|
|
19455
20170
|
</div>
|
|
19456
|
-
</
|
|
19457
|
-
<
|
|
20171
|
+
</Show60>
|
|
20172
|
+
<For45 each={thread().messages()}>{(msg) => <Bubble msg={msg} />}</For45>
|
|
19458
20173
|
<div ref={endRef} />
|
|
19459
20174
|
</div>
|
|
19460
20175
|
|
|
19461
|
-
<
|
|
20176
|
+
<Show60 when={pendingFile() || attachError()}>
|
|
19462
20177
|
<div class="msg-compose__staged">
|
|
19463
|
-
<
|
|
20178
|
+
<Show60 when={pendingFile()}>
|
|
19464
20179
|
{(file) => <span class="msg-compose__staged-file" data-testid="staged-file">
|
|
19465
20180
|
<i class="ph-thin ph-paperclip" aria-hidden="true" />
|
|
19466
20181
|
{file().name}
|
|
@@ -19474,27 +20189,27 @@ function MessagesPanel(props) {
|
|
|
19474
20189
|
×
|
|
19475
20190
|
</button>
|
|
19476
20191
|
</span>}
|
|
19477
|
-
</
|
|
19478
|
-
<
|
|
20192
|
+
</Show60>
|
|
20193
|
+
<Show60 when={attachError()}>
|
|
19479
20194
|
<span class="msg-compose__error" role="alert">
|
|
19480
20195
|
{attachError()}
|
|
19481
20196
|
</span>
|
|
19482
|
-
</
|
|
20197
|
+
</Show60>
|
|
19483
20198
|
</div>
|
|
19484
|
-
</
|
|
20199
|
+
</Show60>
|
|
19485
20200
|
|
|
19486
20201
|
{
|
|
19487
20202
|
/* A transferred support thread is read-only: the customer's messages were
|
|
19488
20203
|
moved to their care team, so the place to continue is that conversation
|
|
19489
20204
|
(the banner above), not a reply that would reopen this one. */
|
|
19490
20205
|
}
|
|
19491
|
-
<
|
|
20206
|
+
<Show60 when={!(selectedConvo()?.source === "support" && selectedConvo()?.status === "transferred")}>
|
|
19492
20207
|
<div class="msg-compose">
|
|
19493
20208
|
{
|
|
19494
20209
|
/* Support threads only: clinical conversations are an Apex proxy and
|
|
19495
20210
|
their attachment path isn't wired up here yet. */
|
|
19496
20211
|
}
|
|
19497
|
-
<
|
|
20212
|
+
<Show60 when={thread().selectedSource() === "support"}>
|
|
19498
20213
|
<label class="msg-compose__attach" title="Attach a file">
|
|
19499
20214
|
<i class="ph-thin ph-paperclip" aria-hidden="true" />
|
|
19500
20215
|
<span class="msg-compose__attach-label">Attach a file</span>
|
|
@@ -19506,7 +20221,7 @@ function MessagesPanel(props) {
|
|
|
19506
20221
|
onChange={(e) => stageFile(e.currentTarget, setPendingFile)}
|
|
19507
20222
|
/>
|
|
19508
20223
|
</label>
|
|
19509
|
-
</
|
|
20224
|
+
</Show60>
|
|
19510
20225
|
<textarea
|
|
19511
20226
|
ref={composerRef}
|
|
19512
20227
|
class="msg-compose__input"
|
|
@@ -19527,10 +20242,10 @@ function MessagesPanel(props) {
|
|
|
19527
20242
|
{thread().sending() ? "Sending\u2026" : "Send"}
|
|
19528
20243
|
</button>
|
|
19529
20244
|
</div>
|
|
19530
|
-
</
|
|
20245
|
+
</Show60>
|
|
19531
20246
|
</>;
|
|
19532
20247
|
return <div class="msg-panel" data-testid="messages-panel">
|
|
19533
|
-
<
|
|
20248
|
+
<Show60
|
|
19534
20249
|
when={channel() !== "gate"}
|
|
19535
20250
|
fallback={<div class="msg-panel__layout msg-panel__layout--gate">
|
|
19536
20251
|
<ChannelGate />
|
|
@@ -19541,7 +20256,7 @@ function MessagesPanel(props) {
|
|
|
19541
20256
|
<ConversationList />
|
|
19542
20257
|
</div>
|
|
19543
20258
|
<div class={`msg-panel__main${threadOpen() ? "" : " msg-panel__main--hidden-mobile"}`}>
|
|
19544
|
-
<
|
|
20259
|
+
<Show60 when={composing()}>
|
|
19545
20260
|
<Switch4>
|
|
19546
20261
|
<Match4 when={composeStep() === "care"}>
|
|
19547
20262
|
<NewCareTeamThread />
|
|
@@ -19553,30 +20268,30 @@ function MessagesPanel(props) {
|
|
|
19553
20268
|
<NewSupportThread />
|
|
19554
20269
|
</Match4>
|
|
19555
20270
|
</Switch4>
|
|
19556
|
-
</
|
|
19557
|
-
<
|
|
19558
|
-
<
|
|
20271
|
+
</Show60>
|
|
20272
|
+
<Show60 when={!composing()}>
|
|
20273
|
+
<Show60
|
|
19559
20274
|
when={thread().selectedId() != null}
|
|
19560
20275
|
fallback={<div class="msg-panel__placeholder" data-testid="messages-placeholder">
|
|
19561
20276
|
<p>Select a conversation to read and reply.</p>
|
|
19562
20277
|
</div>}
|
|
19563
20278
|
>
|
|
19564
20279
|
<Thread />
|
|
19565
|
-
</
|
|
19566
|
-
</
|
|
20280
|
+
</Show60>
|
|
20281
|
+
</Show60>
|
|
19567
20282
|
</div>
|
|
19568
20283
|
</div>
|
|
19569
|
-
</
|
|
20284
|
+
</Show60>
|
|
19570
20285
|
</div>;
|
|
19571
20286
|
}
|
|
19572
20287
|
|
|
19573
20288
|
// src/pages/member/SurveyHistory.tsx
|
|
19574
|
-
import { createSignal as
|
|
20289
|
+
import { createSignal as createSignal41, createResource as createResource27, For as For46, Show as Show61 } from "solid-js";
|
|
19575
20290
|
var MODE_LABELS = {
|
|
19576
20291
|
initial: "Intake questionnaire",
|
|
19577
20292
|
refill: "Refill check-in"
|
|
19578
20293
|
};
|
|
19579
|
-
function
|
|
20294
|
+
function formatDate3(iso) {
|
|
19580
20295
|
if (!iso) return null;
|
|
19581
20296
|
const d = new Date(iso);
|
|
19582
20297
|
if (Number.isNaN(d.getTime())) return null;
|
|
@@ -19587,21 +20302,21 @@ var asEmptyOn404 = (value) => (err) => {
|
|
|
19587
20302
|
throw err;
|
|
19588
20303
|
};
|
|
19589
20304
|
function SurveyHistory() {
|
|
19590
|
-
const [list] =
|
|
20305
|
+
const [list] = createResource27(
|
|
19591
20306
|
() => membersApi.getSurveyResponses().then((r) => r.responses).catch(asEmptyOn404([]))
|
|
19592
20307
|
);
|
|
19593
|
-
const [selectedId, setSelectedId] =
|
|
19594
|
-
const [detail] =
|
|
20308
|
+
const [selectedId, setSelectedId] = createSignal41(null);
|
|
20309
|
+
const [detail] = createResource27(
|
|
19595
20310
|
selectedId,
|
|
19596
20311
|
(id) => membersApi.getSurveyResponse(id).catch(asEmptyOn404(null))
|
|
19597
20312
|
);
|
|
19598
|
-
const ListView = () => <
|
|
20313
|
+
const ListView = () => <Show61
|
|
19599
20314
|
when={!list.error}
|
|
19600
20315
|
fallback={<div class="portal-state" data-testid="history-error">
|
|
19601
20316
|
<p>We couldn't load your submitted surveys. Please try again in a moment.</p>
|
|
19602
20317
|
</div>}
|
|
19603
20318
|
>
|
|
19604
|
-
<
|
|
20319
|
+
<Show61
|
|
19605
20320
|
when={(list() ?? []).length > 0}
|
|
19606
20321
|
fallback={<div class="portal-state" data-testid="history-empty">
|
|
19607
20322
|
<p>No submitted questionnaires yet.</p>
|
|
@@ -19611,20 +20326,20 @@ function SurveyHistory() {
|
|
|
19611
20326
|
</div>}
|
|
19612
20327
|
>
|
|
19613
20328
|
<ul class="history-list" data-testid="history-list">
|
|
19614
|
-
<
|
|
20329
|
+
<For46 each={list()}>
|
|
19615
20330
|
{(item) => <li>
|
|
19616
20331
|
<button type="button" class="history-row" onClick={() => setSelectedId(item.id)}>
|
|
19617
20332
|
<span class="history-row__mode">{MODE_LABELS[item.mode] ?? "Questionnaire"}</span>
|
|
19618
20333
|
<span class="history-row__date">
|
|
19619
|
-
{
|
|
20334
|
+
{formatDate3(item.submittedAt) ?? "Date unavailable"}
|
|
19620
20335
|
</span>
|
|
19621
20336
|
<i class="ph-thin ph-caret-right portal-icon" aria-hidden="true" />
|
|
19622
20337
|
</button>
|
|
19623
20338
|
</li>}
|
|
19624
|
-
</
|
|
20339
|
+
</For46>
|
|
19625
20340
|
</ul>
|
|
19626
|
-
</
|
|
19627
|
-
</
|
|
20341
|
+
</Show61>
|
|
20342
|
+
</Show61>;
|
|
19628
20343
|
const DetailView = () => <div data-testid="history-detail">
|
|
19629
20344
|
<button
|
|
19630
20345
|
type="button"
|
|
@@ -19633,14 +20348,14 @@ function SurveyHistory() {
|
|
|
19633
20348
|
>
|
|
19634
20349
|
<i class="ph-thin ph-caret-left portal-icon" aria-hidden="true" /> All questionnaires
|
|
19635
20350
|
</button>
|
|
19636
|
-
<
|
|
20351
|
+
<Show61
|
|
19637
20352
|
when={!detail.loading}
|
|
19638
20353
|
fallback={<div class="portal-state">
|
|
19639
20354
|
<div class="request-status__spinner" />
|
|
19640
20355
|
<p>Loading your answers…</p>
|
|
19641
20356
|
</div>}
|
|
19642
20357
|
>
|
|
19643
|
-
<
|
|
20358
|
+
<Show61
|
|
19644
20359
|
when={!detail.error && detail()}
|
|
19645
20360
|
fallback={<div class="portal-state" data-testid="history-detail-error">
|
|
19646
20361
|
<p>We couldn't load this questionnaire. Please try again in a moment.</p>
|
|
@@ -19650,37 +20365,37 @@ function SurveyHistory() {
|
|
|
19650
20365
|
<header class="history-transcript__head">
|
|
19651
20366
|
<h2>{MODE_LABELS[t().mode] ?? "Questionnaire"}</h2>
|
|
19652
20367
|
<p class="history-transcript__meta">
|
|
19653
|
-
Submitted {
|
|
20368
|
+
Submitted {formatDate3(t().completedAt ?? t().createdAt) ?? "\u2014"}. Your answers are
|
|
19654
20369
|
shown exactly as they were at the time — they aren't updated afterwards.
|
|
19655
20370
|
</p>
|
|
19656
20371
|
</header>
|
|
19657
|
-
<
|
|
20372
|
+
<For46 each={t().sections}>
|
|
19658
20373
|
{(section) => <section class="history-section">
|
|
19659
20374
|
<h3 class="lab-label">{section.title}</h3>
|
|
19660
|
-
<
|
|
20375
|
+
<For46 each={section.items}>
|
|
19661
20376
|
{(item) => <div class="history-qa">
|
|
19662
20377
|
<p class="history-qa__q">{item.question}</p>
|
|
19663
20378
|
<p class="history-qa__a">{item.answer}</p>
|
|
19664
20379
|
</div>}
|
|
19665
|
-
</
|
|
20380
|
+
</For46>
|
|
19666
20381
|
</section>}
|
|
19667
|
-
</
|
|
20382
|
+
</For46>
|
|
19668
20383
|
</article>}
|
|
19669
|
-
</
|
|
19670
|
-
</
|
|
20384
|
+
</Show61>
|
|
20385
|
+
</Show61>
|
|
19671
20386
|
</div>;
|
|
19672
20387
|
return <div class="survey-history" data-testid="survey-history">
|
|
19673
|
-
<
|
|
20388
|
+
<Show61
|
|
19674
20389
|
when={!list.loading || selectedId()}
|
|
19675
20390
|
fallback={<div class="portal-state">
|
|
19676
20391
|
<div class="request-status__spinner" />
|
|
19677
20392
|
<p>Loading your submitted surveys…</p>
|
|
19678
20393
|
</div>}
|
|
19679
20394
|
>
|
|
19680
|
-
<
|
|
20395
|
+
<Show61 when={selectedId()} fallback={<ListView />}>
|
|
19681
20396
|
<DetailView />
|
|
19682
|
-
</
|
|
19683
|
-
</
|
|
20397
|
+
</Show61>
|
|
20398
|
+
</Show61>
|
|
19684
20399
|
</div>;
|
|
19685
20400
|
}
|
|
19686
20401
|
|
|
@@ -19743,9 +20458,9 @@ function MemberPortal(props) {
|
|
|
19743
20458
|
}
|
|
19744
20459
|
return null;
|
|
19745
20460
|
};
|
|
19746
|
-
const [tab, setTab] =
|
|
19747
|
-
const [intent, setIntent] =
|
|
19748
|
-
|
|
20461
|
+
const [tab, setTab] = createSignal42(resolveTabFromUrl() ?? "tracker");
|
|
20462
|
+
const [intent, setIntent] = createSignal42(resolveIntentFromUrl());
|
|
20463
|
+
onMount5(() => {
|
|
19749
20464
|
const resolved = resolveTabFromUrl();
|
|
19750
20465
|
if (resolved && resolved !== tab()) setTab(resolved);
|
|
19751
20466
|
const resolvedIntent = resolveIntentFromUrl();
|
|
@@ -19776,7 +20491,7 @@ function MemberPortal(props) {
|
|
|
19776
20491
|
} catch {
|
|
19777
20492
|
}
|
|
19778
20493
|
};
|
|
19779
|
-
const RailNav = (p) => <
|
|
20494
|
+
const RailNav = (p) => <For47 each={tabs()}>
|
|
19780
20495
|
{(item) => <button
|
|
19781
20496
|
type="button"
|
|
19782
20497
|
class={`portal-${p.variant}__item${tab() === item.key ? " is-active" : ""}`}
|
|
@@ -19786,17 +20501,17 @@ function MemberPortal(props) {
|
|
|
19786
20501
|
>
|
|
19787
20502
|
<i class={`${item.icon} portal-icon`} aria-hidden="true" />
|
|
19788
20503
|
<span class="portal-item__label">{item.label}</span>
|
|
19789
|
-
<
|
|
20504
|
+
<Show62 when={item.key === "tracker" && inMotion()}>
|
|
19790
20505
|
<span class="portal-item__live" aria-label="In progress" />
|
|
19791
|
-
</
|
|
19792
|
-
<
|
|
20506
|
+
</Show62>
|
|
20507
|
+
<Show62 when={item.key === "messages" && unreadTotal() > 0}>
|
|
19793
20508
|
<span class={`portal-item__badge${p.variant === "tabs" ? " portal-item__badge--tab" : ""}`}>
|
|
19794
20509
|
{unreadTotal() > 99 ? "99+" : unreadTotal()}
|
|
19795
20510
|
</span>
|
|
19796
|
-
</
|
|
20511
|
+
</Show62>
|
|
19797
20512
|
</button>}
|
|
19798
|
-
</
|
|
19799
|
-
const TrackerTab = () => <
|
|
20513
|
+
</For47>;
|
|
20514
|
+
const TrackerTab = () => <Show62
|
|
19800
20515
|
when={data.primaryRx()}
|
|
19801
20516
|
fallback={<OrderTracker
|
|
19802
20517
|
request={null}
|
|
@@ -19821,10 +20536,10 @@ function MemberPortal(props) {
|
|
|
19821
20536
|
intakeHref={props.routes.intake}
|
|
19822
20537
|
renewHref={props.routes.renew}
|
|
19823
20538
|
/>
|
|
19824
|
-
<
|
|
20539
|
+
<Show62 when={data.otherRx().length > 0}>
|
|
19825
20540
|
<div class="rx-others" data-testid="rx-others">
|
|
19826
20541
|
<span class="lab-label">Other orders</span>
|
|
19827
|
-
<
|
|
20542
|
+
<For47 each={data.otherRx()}>
|
|
19828
20543
|
{(rx) => <RxRow
|
|
19829
20544
|
rx={rx}
|
|
19830
20545
|
request={data.toTrackerRequest(rx)}
|
|
@@ -19834,19 +20549,19 @@ function MemberPortal(props) {
|
|
|
19834
20549
|
intakeHref={props.routes.intake}
|
|
19835
20550
|
renewHref={props.routes.renew}
|
|
19836
20551
|
/>}
|
|
19837
|
-
</
|
|
20552
|
+
</For47>
|
|
19838
20553
|
</div>
|
|
19839
|
-
</
|
|
20554
|
+
</Show62>
|
|
19840
20555
|
</div>}
|
|
19841
|
-
</
|
|
19842
|
-
const Content = () => <
|
|
20556
|
+
</Show62>;
|
|
20557
|
+
const Content = () => <Show62
|
|
19843
20558
|
when={!data.loading()}
|
|
19844
20559
|
fallback={<div class="portal-state">
|
|
19845
20560
|
<div class="request-status__spinner" />
|
|
19846
20561
|
<p>Loading your portal…</p>
|
|
19847
20562
|
</div>}
|
|
19848
20563
|
>
|
|
19849
|
-
<
|
|
20564
|
+
<Show62
|
|
19850
20565
|
when={!data.error()}
|
|
19851
20566
|
fallback={<div class="request-status__error portal-state">
|
|
19852
20567
|
<p class="request-status__error-text">{data.error()}</p>
|
|
@@ -19886,8 +20601,8 @@ function MemberPortal(props) {
|
|
|
19886
20601
|
<MessagesPanel thread={messages} intent={intent()} />
|
|
19887
20602
|
</Match5>
|
|
19888
20603
|
</Switch5>
|
|
19889
|
-
</
|
|
19890
|
-
</
|
|
20604
|
+
</Show62>
|
|
20605
|
+
</Show62>;
|
|
19891
20606
|
return <main
|
|
19892
20607
|
class="portal"
|
|
19893
20608
|
data-testid="member-portal"
|
|
@@ -19899,30 +20614,30 @@ function MemberPortal(props) {
|
|
|
19899
20614
|
<aside class="portal-rail">
|
|
19900
20615
|
<div class="portal-rail__brand">
|
|
19901
20616
|
<a href={props.brand.homeHref} class="portal-rail__logo">
|
|
19902
|
-
<
|
|
20617
|
+
<Show62
|
|
19903
20618
|
when={props.brand.logoSrc}
|
|
19904
20619
|
fallback={<span class="portal-rail__wordmark">{props.brand.name}</span>}
|
|
19905
20620
|
>
|
|
19906
20621
|
{(src) => <img src={src()} alt={props.brand.name} />}
|
|
19907
|
-
</
|
|
20622
|
+
</Show62>
|
|
19908
20623
|
</a>
|
|
19909
20624
|
<span class="portal-rail__dot" aria-hidden="true" />
|
|
19910
20625
|
</div>
|
|
19911
20626
|
|
|
19912
|
-
<
|
|
20627
|
+
<Show62 when={data.firstName() !== "Member"}>
|
|
19913
20628
|
<p class="portal-rail__hi">Hi, {data.firstName()}</p>
|
|
19914
|
-
</
|
|
20629
|
+
</Show62>
|
|
19915
20630
|
|
|
19916
20631
|
<nav class="portal-rail__nav" aria-label="Portal sections">
|
|
19917
20632
|
<RailNav variant="rail" />
|
|
19918
20633
|
</nav>
|
|
19919
20634
|
|
|
19920
20635
|
<div class="portal-rail__foot">
|
|
19921
|
-
<
|
|
20636
|
+
<Show62 when={showBackLink()}>
|
|
19922
20637
|
<a href={catalogHref()} class="portal-rail__back" data-testid="rail-back">
|
|
19923
20638
|
← Back to shop
|
|
19924
20639
|
</a>
|
|
19925
|
-
</
|
|
20640
|
+
</Show62>
|
|
19926
20641
|
<button type="button" class="portal-rail__signout" onClick={props.auth.onSignOut}>
|
|
19927
20642
|
— Sign out
|
|
19928
20643
|
</button>
|
|
@@ -19932,11 +20647,11 @@ function MemberPortal(props) {
|
|
|
19932
20647
|
{
|
|
19933
20648
|
/* ── Mobile back bar (the rail is hidden ≤900px, so nothing else links home) ── */
|
|
19934
20649
|
}
|
|
19935
|
-
<
|
|
20650
|
+
<Show62 when={showBackLink()}>
|
|
19936
20651
|
<a href={catalogHref()} class="portal-topbar-back" data-testid="mobile-back">
|
|
19937
20652
|
<span aria-hidden="true">←</span> Back to shop
|
|
19938
20653
|
</a>
|
|
19939
|
-
</
|
|
20654
|
+
</Show62>
|
|
19940
20655
|
|
|
19941
20656
|
{
|
|
19942
20657
|
/* ── Content ── */
|
|
@@ -19957,10 +20672,10 @@ function MemberPortal(props) {
|
|
|
19957
20672
|
}
|
|
19958
20673
|
|
|
19959
20674
|
// src/pages/AffiliatePortal.tsx
|
|
19960
|
-
import { createEffect as
|
|
20675
|
+
import { createEffect as createEffect15, createSignal as createSignal44, Match as Match6, Show as Show68, Switch as Switch6, For as For52 } from "solid-js";
|
|
19961
20676
|
|
|
19962
20677
|
// src/pages/affiliate/Overview.tsx
|
|
19963
|
-
import { Show as
|
|
20678
|
+
import { Show as Show63, For as For48 } from "solid-js";
|
|
19964
20679
|
function formatMoney(cents) {
|
|
19965
20680
|
return `$${(cents / 100).toFixed(2)}`;
|
|
19966
20681
|
}
|
|
@@ -19994,7 +20709,7 @@ function AffiliateOverview() {
|
|
|
19994
20709
|
Overview
|
|
19995
20710
|
</h1>
|
|
19996
20711
|
|
|
19997
|
-
<
|
|
20712
|
+
<Show63 when={isPending()}>
|
|
19998
20713
|
<div
|
|
19999
20714
|
style={{
|
|
20000
20715
|
padding: "1rem 1.25rem",
|
|
@@ -20007,9 +20722,9 @@ function AffiliateOverview() {
|
|
|
20007
20722
|
Your affiliate account is awaiting approval. Once an admin
|
|
20008
20723
|
activates it, your referral link will start earning commissions.
|
|
20009
20724
|
</div>
|
|
20010
|
-
</
|
|
20725
|
+
</Show63>
|
|
20011
20726
|
|
|
20012
|
-
<
|
|
20727
|
+
<Show63
|
|
20013
20728
|
when={stats()}
|
|
20014
20729
|
fallback={<div style={{ color: "var(--app-affiliate-fg-muted)" }}>Loading stats…</div>}
|
|
20015
20730
|
>
|
|
@@ -20020,7 +20735,7 @@ function AffiliateOverview() {
|
|
|
20020
20735
|
gap: "1rem"
|
|
20021
20736
|
}}
|
|
20022
20737
|
>
|
|
20023
|
-
<
|
|
20738
|
+
<For48 each={cards(s())}>
|
|
20024
20739
|
{(card) => <div
|
|
20025
20740
|
style={{
|
|
20026
20741
|
padding: "1.25rem",
|
|
@@ -20050,18 +20765,18 @@ function AffiliateOverview() {
|
|
|
20050
20765
|
{card.value}
|
|
20051
20766
|
</div>
|
|
20052
20767
|
</div>}
|
|
20053
|
-
</
|
|
20768
|
+
</For48>
|
|
20054
20769
|
</div>}
|
|
20055
|
-
</
|
|
20770
|
+
</Show63>
|
|
20056
20771
|
</div>;
|
|
20057
20772
|
}
|
|
20058
20773
|
|
|
20059
20774
|
// src/pages/affiliate/Conversions.tsx
|
|
20060
|
-
import { Show as
|
|
20775
|
+
import { Show as Show64, For as For49 } from "solid-js";
|
|
20061
20776
|
function formatMoney2(cents) {
|
|
20062
20777
|
return `$${(cents / 100).toFixed(2)}`;
|
|
20063
20778
|
}
|
|
20064
|
-
function
|
|
20779
|
+
function formatDate4(iso) {
|
|
20065
20780
|
const d = new Date(iso);
|
|
20066
20781
|
if (Number.isNaN(d.getTime())) return iso;
|
|
20067
20782
|
return d.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" });
|
|
@@ -20086,7 +20801,7 @@ function AffiliateConversions() {
|
|
|
20086
20801
|
Conversions
|
|
20087
20802
|
</h1>
|
|
20088
20803
|
|
|
20089
|
-
<
|
|
20804
|
+
<Show64
|
|
20090
20805
|
when={(conversions() ?? []).length > 0}
|
|
20091
20806
|
fallback={<div
|
|
20092
20807
|
style={{
|
|
@@ -20120,12 +20835,12 @@ function AffiliateConversions() {
|
|
|
20120
20835
|
</tr>
|
|
20121
20836
|
</thead>
|
|
20122
20837
|
<tbody>
|
|
20123
|
-
<
|
|
20838
|
+
<For49 each={conversions()}>
|
|
20124
20839
|
{(c) => <tr style={{ "border-top": "1px solid var(--app-affiliate-border)" }}>
|
|
20125
|
-
<td data-label="Date" style={td()}>{
|
|
20840
|
+
<td data-label="Date" style={td()}>{formatDate4(c.createdAt)}</td>
|
|
20126
20841
|
<td data-label="Type" style={td()}>
|
|
20127
20842
|
{c.paymentType}
|
|
20128
|
-
<
|
|
20843
|
+
<Show64 when={c.tier === 2}>
|
|
20129
20844
|
<span
|
|
20130
20845
|
style={{
|
|
20131
20846
|
"margin-left": "0.4rem",
|
|
@@ -20140,7 +20855,7 @@ function AffiliateConversions() {
|
|
|
20140
20855
|
>
|
|
20141
20856
|
Override
|
|
20142
20857
|
</span>
|
|
20143
|
-
</
|
|
20858
|
+
</Show64>
|
|
20144
20859
|
</td>
|
|
20145
20860
|
<td data-label="Order total" style={td()}>{formatMoney2(c.orderTotalCents)}</td>
|
|
20146
20861
|
<td data-label="Commission" style={{ ...td(), color: "var(--app-affiliate-fg)", "font-weight": "600" }}>
|
|
@@ -20161,11 +20876,11 @@ function AffiliateConversions() {
|
|
|
20161
20876
|
</span>
|
|
20162
20877
|
</td>
|
|
20163
20878
|
</tr>}
|
|
20164
|
-
</
|
|
20879
|
+
</For49>
|
|
20165
20880
|
</tbody>
|
|
20166
20881
|
</table>
|
|
20167
20882
|
</div>
|
|
20168
|
-
</
|
|
20883
|
+
</Show64>
|
|
20169
20884
|
</div>;
|
|
20170
20885
|
}
|
|
20171
20886
|
function th() {
|
|
@@ -20187,8 +20902,8 @@ function td() {
|
|
|
20187
20902
|
}
|
|
20188
20903
|
|
|
20189
20904
|
// src/pages/affiliate/Downline.tsx
|
|
20190
|
-
import { Show as
|
|
20191
|
-
function
|
|
20905
|
+
import { Show as Show65, For as For50 } from "solid-js";
|
|
20906
|
+
function formatDate5(iso) {
|
|
20192
20907
|
const d = new Date(iso);
|
|
20193
20908
|
if (Number.isNaN(d.getTime())) return iso;
|
|
20194
20909
|
return d.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" });
|
|
@@ -20218,7 +20933,7 @@ function AffiliateDownline() {
|
|
|
20218
20933
|
make — those show up as “Override” rows on your Conversions.
|
|
20219
20934
|
</p>
|
|
20220
20935
|
|
|
20221
|
-
<
|
|
20936
|
+
<Show65
|
|
20222
20937
|
when={(downline() ?? []).length > 0}
|
|
20223
20938
|
fallback={<div
|
|
20224
20939
|
style={{
|
|
@@ -20254,7 +20969,7 @@ function AffiliateDownline() {
|
|
|
20254
20969
|
</tr>
|
|
20255
20970
|
</thead>
|
|
20256
20971
|
<tbody>
|
|
20257
|
-
<
|
|
20972
|
+
<For50 each={downline()}>
|
|
20258
20973
|
{(d) => <tr style={{ "border-top": "1px solid var(--app-affiliate-border)" }}>
|
|
20259
20974
|
<td
|
|
20260
20975
|
data-label="Code"
|
|
@@ -20280,14 +20995,14 @@ function AffiliateDownline() {
|
|
|
20280
20995
|
</span>
|
|
20281
20996
|
</td>
|
|
20282
20997
|
<td data-label="Joined" style={td2()}>
|
|
20283
|
-
{
|
|
20998
|
+
{formatDate5(d.createdAt)}
|
|
20284
20999
|
</td>
|
|
20285
21000
|
</tr>}
|
|
20286
|
-
</
|
|
21001
|
+
</For50>
|
|
20287
21002
|
</tbody>
|
|
20288
21003
|
</table>
|
|
20289
21004
|
</div>
|
|
20290
|
-
</
|
|
21005
|
+
</Show65>
|
|
20291
21006
|
</div>;
|
|
20292
21007
|
}
|
|
20293
21008
|
function th2() {
|
|
@@ -20309,10 +21024,10 @@ function td2() {
|
|
|
20309
21024
|
}
|
|
20310
21025
|
|
|
20311
21026
|
// src/pages/affiliate/ReferralLink.tsx
|
|
20312
|
-
import { Show as
|
|
21027
|
+
import { Show as Show66, createSignal as createSignal43, createMemo as createMemo14 } from "solid-js";
|
|
20313
21028
|
function AffiliateReferralLink() {
|
|
20314
21029
|
const { links } = useAffiliateLinks();
|
|
20315
|
-
const [copied, setCopied] =
|
|
21030
|
+
const [copied, setCopied] = createSignal43(false);
|
|
20316
21031
|
const homepageLink = createMemo14(() => {
|
|
20317
21032
|
const l = links();
|
|
20318
21033
|
const affiliate = affiliateAuth_default.affiliate();
|
|
@@ -20343,7 +21058,7 @@ function AffiliateReferralLink() {
|
|
|
20343
21058
|
Referral link
|
|
20344
21059
|
</h1>
|
|
20345
21060
|
|
|
20346
|
-
<
|
|
21061
|
+
<Show66
|
|
20347
21062
|
when={homepageLink()}
|
|
20348
21063
|
fallback={<div style={{ color: "var(--app-affiliate-fg-muted)" }}>
|
|
20349
21064
|
Your referral link will appear here once your account is approved.
|
|
@@ -20419,12 +21134,12 @@ function AffiliateReferralLink() {
|
|
|
20419
21134
|
the cookie window, you earn commission on the conversion.
|
|
20420
21135
|
</div>
|
|
20421
21136
|
</div>
|
|
20422
|
-
</
|
|
21137
|
+
</Show66>
|
|
20423
21138
|
</div>;
|
|
20424
21139
|
}
|
|
20425
21140
|
|
|
20426
21141
|
// src/pages/affiliate/Settings.tsx
|
|
20427
|
-
import { Show as
|
|
21142
|
+
import { Show as Show67, For as For51 } from "solid-js";
|
|
20428
21143
|
var STATUS_LABEL2 = {
|
|
20429
21144
|
pending: "Pending approval",
|
|
20430
21145
|
active: "Active",
|
|
@@ -20454,7 +21169,7 @@ function AffiliateSettings() {
|
|
|
20454
21169
|
Account
|
|
20455
21170
|
</h1>
|
|
20456
21171
|
|
|
20457
|
-
<
|
|
21172
|
+
<Show67
|
|
20458
21173
|
when={affiliate()}
|
|
20459
21174
|
fallback={<div style={{ color: "var(--app-affiliate-fg-muted)" }}>Loading…</div>}
|
|
20460
21175
|
>
|
|
@@ -20466,7 +21181,7 @@ function AffiliateSettings() {
|
|
|
20466
21181
|
overflow: "hidden"
|
|
20467
21182
|
}}
|
|
20468
21183
|
>
|
|
20469
|
-
<
|
|
21184
|
+
<For51 each={rows(a())}>
|
|
20470
21185
|
{(row) => <div
|
|
20471
21186
|
style={{
|
|
20472
21187
|
display: "flex",
|
|
@@ -20488,9 +21203,9 @@ function AffiliateSettings() {
|
|
|
20488
21203
|
</div>
|
|
20489
21204
|
<div style={{ color: "var(--app-affiliate-fg)" }}>{row.value}</div>
|
|
20490
21205
|
</div>}
|
|
20491
|
-
</
|
|
21206
|
+
</For51>
|
|
20492
21207
|
</div>}
|
|
20493
|
-
</
|
|
21208
|
+
</Show67>
|
|
20494
21209
|
|
|
20495
21210
|
<div>
|
|
20496
21211
|
<button
|
|
@@ -20540,10 +21255,10 @@ var TAB_ORDER = [
|
|
|
20540
21255
|
function AffiliatePortal(props) {
|
|
20541
21256
|
const orderedTabs = () => props.enabledTabs ? TAB_ORDER.filter((t) => props.enabledTabs.includes(t)) : TAB_ORDER;
|
|
20542
21257
|
const fallbackTab = () => props.defaultTab ?? orderedTabs()[0] ?? "overview";
|
|
20543
|
-
const [internalTab, setInternalTab] =
|
|
21258
|
+
const [internalTab, setInternalTab] = createSignal44(fallbackTab());
|
|
20544
21259
|
const currentTab = () => props.activeTab ?? internalTab();
|
|
20545
|
-
const [drawerOpen, setDrawerOpen] =
|
|
20546
|
-
|
|
21260
|
+
const [drawerOpen, setDrawerOpen] = createSignal44(false);
|
|
21261
|
+
createEffect15(() => {
|
|
20547
21262
|
const auth = props.auth;
|
|
20548
21263
|
if (!auth) return;
|
|
20549
21264
|
if (!auth.isAuthenticated()) {
|
|
@@ -20561,7 +21276,7 @@ function AffiliatePortal(props) {
|
|
|
20561
21276
|
props.onTabChange?.(tab);
|
|
20562
21277
|
};
|
|
20563
21278
|
const topOffset = () => props.topOffset ?? "0px";
|
|
20564
|
-
return <
|
|
21279
|
+
return <Show68 when={allowed()} fallback={<AffiliateGateSpinner topOffset={topOffset()} />}>
|
|
20565
21280
|
<div
|
|
20566
21281
|
class="app-affiliate-root app-affiliate-shell"
|
|
20567
21282
|
classList={{ "is-drawer-open": drawerOpen() }}
|
|
@@ -20610,7 +21325,7 @@ function AffiliatePortal(props) {
|
|
|
20610
21325
|
Affiliate Portal
|
|
20611
21326
|
</h2>
|
|
20612
21327
|
<nav style={{ display: "flex", "flex-direction": "column", gap: "0.25rem" }}>
|
|
20613
|
-
<
|
|
21328
|
+
<For52 each={orderedTabs()}>
|
|
20614
21329
|
{(tab) => <button
|
|
20615
21330
|
type="button"
|
|
20616
21331
|
onClick={() => handleTabClick(tab)}
|
|
@@ -20629,15 +21344,15 @@ function AffiliatePortal(props) {
|
|
|
20629
21344
|
color: currentTab() === tab ? "var(--app-affiliate-primary-soft-fg)" : "var(--app-affiliate-fg-muted)"
|
|
20630
21345
|
}}
|
|
20631
21346
|
>
|
|
20632
|
-
<
|
|
21347
|
+
<Show68 when={props.tabIcons?.[tab]}>
|
|
20633
21348
|
<span
|
|
20634
21349
|
class={props.tabIcons[tab]}
|
|
20635
21350
|
style={{ "font-size": "1rem", opacity: 0.7, "flex-shrink": 0 }}
|
|
20636
21351
|
/>
|
|
20637
|
-
</
|
|
21352
|
+
</Show68>
|
|
20638
21353
|
{TAB_LABELS2[tab]}
|
|
20639
21354
|
</button>}
|
|
20640
|
-
</
|
|
21355
|
+
</For52>
|
|
20641
21356
|
</nav>
|
|
20642
21357
|
</div>
|
|
20643
21358
|
</aside>
|
|
@@ -20662,7 +21377,7 @@ function AffiliatePortal(props) {
|
|
|
20662
21377
|
</Switch6>
|
|
20663
21378
|
</div>
|
|
20664
21379
|
</div>
|
|
20665
|
-
</
|
|
21380
|
+
</Show68>;
|
|
20666
21381
|
}
|
|
20667
21382
|
function AffiliateGateSpinner(props) {
|
|
20668
21383
|
return <div
|
|
@@ -20694,12 +21409,12 @@ function AffiliateGateSpinner(props) {
|
|
|
20694
21409
|
}
|
|
20695
21410
|
|
|
20696
21411
|
// src/pages/AffiliateRegister.tsx
|
|
20697
|
-
import { createSignal as
|
|
21412
|
+
import { createSignal as createSignal46, Show as Show69 } from "solid-js";
|
|
20698
21413
|
|
|
20699
21414
|
// src/pages/AffiliatePasswordInput.tsx
|
|
20700
|
-
import { createSignal as
|
|
21415
|
+
import { createSignal as createSignal45 } from "solid-js";
|
|
20701
21416
|
function AffiliatePasswordInput(props) {
|
|
20702
|
-
const [visible, setVisible] =
|
|
21417
|
+
const [visible, setVisible] = createSignal45(false);
|
|
20703
21418
|
return <div style={{ position: "relative" }}>
|
|
20704
21419
|
<input
|
|
20705
21420
|
type={visible() ? "text" : "password"}
|
|
@@ -20752,14 +21467,14 @@ function inputStyle() {
|
|
|
20752
21467
|
|
|
20753
21468
|
// src/pages/AffiliateRegister.tsx
|
|
20754
21469
|
function AffiliateRegister(props) {
|
|
20755
|
-
const [firstName, setFirstName] =
|
|
20756
|
-
const [lastName, setLastName] =
|
|
20757
|
-
const [email, setEmail] =
|
|
20758
|
-
const [password, setPassword] =
|
|
20759
|
-
const [affiliateCode, setAffiliateCode] =
|
|
20760
|
-
const [submitting, setSubmitting] =
|
|
20761
|
-
const [submitted, setSubmitted] =
|
|
20762
|
-
const [error, setError] =
|
|
21470
|
+
const [firstName, setFirstName] = createSignal46("");
|
|
21471
|
+
const [lastName, setLastName] = createSignal46("");
|
|
21472
|
+
const [email, setEmail] = createSignal46("");
|
|
21473
|
+
const [password, setPassword] = createSignal46("");
|
|
21474
|
+
const [affiliateCode, setAffiliateCode] = createSignal46("");
|
|
21475
|
+
const [submitting, setSubmitting] = createSignal46(false);
|
|
21476
|
+
const [submitted, setSubmitted] = createSignal46(false);
|
|
21477
|
+
const [error, setError] = createSignal46(null);
|
|
20763
21478
|
async function handleSubmit(e) {
|
|
20764
21479
|
e.preventDefault();
|
|
20765
21480
|
setError(null);
|
|
@@ -20826,7 +21541,7 @@ function AffiliateRegister(props) {
|
|
|
20826
21541
|
</p>
|
|
20827
21542
|
</div>
|
|
20828
21543
|
|
|
20829
|
-
<
|
|
21544
|
+
<Show69
|
|
20830
21545
|
when={!submitted()}
|
|
20831
21546
|
fallback={<div
|
|
20832
21547
|
style={{
|
|
@@ -20845,7 +21560,7 @@ function AffiliateRegister(props) {
|
|
|
20845
21560
|
onSubmit={handleSubmit}
|
|
20846
21561
|
style={{ display: "flex", "flex-direction": "column", gap: "0.875rem" }}
|
|
20847
21562
|
>
|
|
20848
|
-
<
|
|
21563
|
+
<Row2 label="First name">
|
|
20849
21564
|
<input
|
|
20850
21565
|
type="text"
|
|
20851
21566
|
required
|
|
@@ -20854,8 +21569,8 @@ function AffiliateRegister(props) {
|
|
|
20854
21569
|
autocomplete="given-name"
|
|
20855
21570
|
style={inputStyle2()}
|
|
20856
21571
|
/>
|
|
20857
|
-
</
|
|
20858
|
-
<
|
|
21572
|
+
</Row2>
|
|
21573
|
+
<Row2 label="Last name">
|
|
20859
21574
|
<input
|
|
20860
21575
|
type="text"
|
|
20861
21576
|
required
|
|
@@ -20864,8 +21579,8 @@ function AffiliateRegister(props) {
|
|
|
20864
21579
|
autocomplete="family-name"
|
|
20865
21580
|
style={inputStyle2()}
|
|
20866
21581
|
/>
|
|
20867
|
-
</
|
|
20868
|
-
<
|
|
21582
|
+
</Row2>
|
|
21583
|
+
<Row2 label="Email">
|
|
20869
21584
|
<input
|
|
20870
21585
|
type="email"
|
|
20871
21586
|
required
|
|
@@ -20874,8 +21589,8 @@ function AffiliateRegister(props) {
|
|
|
20874
21589
|
autocomplete="email"
|
|
20875
21590
|
style={inputStyle2()}
|
|
20876
21591
|
/>
|
|
20877
|
-
</
|
|
20878
|
-
<
|
|
21592
|
+
</Row2>
|
|
21593
|
+
<Row2 label="Password" hint="At least 8 characters">
|
|
20879
21594
|
<AffiliatePasswordInput
|
|
20880
21595
|
required
|
|
20881
21596
|
minLength={8}
|
|
@@ -20883,8 +21598,8 @@ function AffiliateRegister(props) {
|
|
|
20883
21598
|
onInput={setPassword}
|
|
20884
21599
|
autocomplete="new-password"
|
|
20885
21600
|
/>
|
|
20886
|
-
</
|
|
20887
|
-
<
|
|
21601
|
+
</Row2>
|
|
21602
|
+
<Row2 label="Affiliate code" hint="The handle in your referral URL (4+ characters)">
|
|
20888
21603
|
<input
|
|
20889
21604
|
type="text"
|
|
20890
21605
|
required
|
|
@@ -20893,7 +21608,7 @@ function AffiliateRegister(props) {
|
|
|
20893
21608
|
onInput={(e) => setAffiliateCode(e.currentTarget.value)}
|
|
20894
21609
|
style={inputStyle2()}
|
|
20895
21610
|
/>
|
|
20896
|
-
</
|
|
21611
|
+
</Row2>
|
|
20897
21612
|
<div
|
|
20898
21613
|
style={{
|
|
20899
21614
|
padding: "0.625rem 0.875rem",
|
|
@@ -20922,7 +21637,7 @@ function AffiliateRegister(props) {
|
|
|
20922
21637
|
the website address itself.
|
|
20923
21638
|
</div>
|
|
20924
21639
|
|
|
20925
|
-
<
|
|
21640
|
+
<Show69 when={error()}>
|
|
20926
21641
|
<div
|
|
20927
21642
|
style={{
|
|
20928
21643
|
padding: "0.625rem 0.875rem",
|
|
@@ -20934,7 +21649,7 @@ function AffiliateRegister(props) {
|
|
|
20934
21649
|
>
|
|
20935
21650
|
{error()}
|
|
20936
21651
|
</div>
|
|
20937
|
-
</
|
|
21652
|
+
</Show69>
|
|
20938
21653
|
|
|
20939
21654
|
<button
|
|
20940
21655
|
type="submit"
|
|
@@ -20953,7 +21668,7 @@ function AffiliateRegister(props) {
|
|
|
20953
21668
|
{submitting() ? "Submitting\u2026" : "Apply"}
|
|
20954
21669
|
</button>
|
|
20955
21670
|
|
|
20956
|
-
<
|
|
21671
|
+
<Show69 when={props.onNavigateLogin}>
|
|
20957
21672
|
<button
|
|
20958
21673
|
type="button"
|
|
20959
21674
|
onClick={() => props.onNavigateLogin?.()}
|
|
@@ -20961,13 +21676,13 @@ function AffiliateRegister(props) {
|
|
|
20961
21676
|
>
|
|
20962
21677
|
Already have an account? Log in
|
|
20963
21678
|
</button>
|
|
20964
|
-
</
|
|
21679
|
+
</Show69>
|
|
20965
21680
|
</form>
|
|
20966
|
-
</
|
|
21681
|
+
</Show69>
|
|
20967
21682
|
</div>
|
|
20968
21683
|
</div>;
|
|
20969
21684
|
}
|
|
20970
|
-
function
|
|
21685
|
+
function Row2(props) {
|
|
20971
21686
|
return <label style={{ display: "flex", "flex-direction": "column", gap: "0.35rem" }}>
|
|
20972
21687
|
<span
|
|
20973
21688
|
style={{
|
|
@@ -20980,11 +21695,11 @@ function Row(props) {
|
|
|
20980
21695
|
{props.label}
|
|
20981
21696
|
</span>
|
|
20982
21697
|
{props.children}
|
|
20983
|
-
<
|
|
21698
|
+
<Show69 when={props.hint}>
|
|
20984
21699
|
<span style={{ "font-size": "0.75rem", color: "var(--app-affiliate-fg-subtle)" }}>
|
|
20985
21700
|
{props.hint}
|
|
20986
21701
|
</span>
|
|
20987
|
-
</
|
|
21702
|
+
</Show69>
|
|
20988
21703
|
</label>;
|
|
20989
21704
|
}
|
|
20990
21705
|
function inputStyle2() {
|
|
@@ -21014,12 +21729,12 @@ function linkStyle() {
|
|
|
21014
21729
|
}
|
|
21015
21730
|
|
|
21016
21731
|
// src/pages/AffiliateLogin.tsx
|
|
21017
|
-
import { createSignal as
|
|
21732
|
+
import { createSignal as createSignal47, Show as Show70 } from "solid-js";
|
|
21018
21733
|
function AffiliateLogin(props) {
|
|
21019
|
-
const [email, setEmail] =
|
|
21020
|
-
const [password, setPassword] =
|
|
21021
|
-
const [submitting, setSubmitting] =
|
|
21022
|
-
const [error, setError] =
|
|
21734
|
+
const [email, setEmail] = createSignal47("");
|
|
21735
|
+
const [password, setPassword] = createSignal47("");
|
|
21736
|
+
const [submitting, setSubmitting] = createSignal47(false);
|
|
21737
|
+
const [error, setError] = createSignal47(null);
|
|
21023
21738
|
async function handleSubmit(e) {
|
|
21024
21739
|
e.preventDefault();
|
|
21025
21740
|
setError(null);
|
|
@@ -21094,7 +21809,7 @@ function AffiliateLogin(props) {
|
|
|
21094
21809
|
/>
|
|
21095
21810
|
</label>
|
|
21096
21811
|
|
|
21097
|
-
<
|
|
21812
|
+
<Show70 when={error()}>
|
|
21098
21813
|
<div
|
|
21099
21814
|
style={{
|
|
21100
21815
|
padding: "0.625rem 0.875rem",
|
|
@@ -21106,7 +21821,7 @@ function AffiliateLogin(props) {
|
|
|
21106
21821
|
>
|
|
21107
21822
|
{error()}
|
|
21108
21823
|
</div>
|
|
21109
|
-
</
|
|
21824
|
+
</Show70>
|
|
21110
21825
|
|
|
21111
21826
|
<button
|
|
21112
21827
|
type="submit"
|
|
@@ -21125,7 +21840,7 @@ function AffiliateLogin(props) {
|
|
|
21125
21840
|
{submitting() ? "Logging in\u2026" : "Log in"}
|
|
21126
21841
|
</button>
|
|
21127
21842
|
|
|
21128
|
-
<
|
|
21843
|
+
<Show70 when={props.onNavigateForgotPassword}>
|
|
21129
21844
|
<button
|
|
21130
21845
|
type="button"
|
|
21131
21846
|
onClick={() => props.onNavigateForgotPassword?.()}
|
|
@@ -21142,9 +21857,9 @@ function AffiliateLogin(props) {
|
|
|
21142
21857
|
>
|
|
21143
21858
|
Forgot your password?
|
|
21144
21859
|
</button>
|
|
21145
|
-
</
|
|
21860
|
+
</Show70>
|
|
21146
21861
|
|
|
21147
|
-
<
|
|
21862
|
+
<Show70 when={props.onNavigateRegister}>
|
|
21148
21863
|
<button
|
|
21149
21864
|
type="button"
|
|
21150
21865
|
onClick={() => props.onNavigateRegister?.()}
|
|
@@ -21161,7 +21876,7 @@ function AffiliateLogin(props) {
|
|
|
21161
21876
|
>
|
|
21162
21877
|
New affiliate? Apply
|
|
21163
21878
|
</button>
|
|
21164
|
-
</
|
|
21879
|
+
</Show70>
|
|
21165
21880
|
</form>
|
|
21166
21881
|
</div>
|
|
21167
21882
|
</div>;
|
|
@@ -21189,12 +21904,12 @@ function inputStyle3() {
|
|
|
21189
21904
|
}
|
|
21190
21905
|
|
|
21191
21906
|
// src/pages/ForgotPassword.tsx
|
|
21192
|
-
import { createSignal as
|
|
21907
|
+
import { createSignal as createSignal48, Show as Show71 } from "solid-js";
|
|
21193
21908
|
function ForgotPasswordPage(props) {
|
|
21194
|
-
const [email, setEmail] =
|
|
21195
|
-
const [submitting, setSubmitting] =
|
|
21196
|
-
const [error, setError] =
|
|
21197
|
-
const [message, setMessage] =
|
|
21909
|
+
const [email, setEmail] = createSignal48("");
|
|
21910
|
+
const [submitting, setSubmitting] = createSignal48(false);
|
|
21911
|
+
const [error, setError] = createSignal48(null);
|
|
21912
|
+
const [message, setMessage] = createSignal48(null);
|
|
21198
21913
|
async function handleSubmit(e) {
|
|
21199
21914
|
e.preventDefault();
|
|
21200
21915
|
setError(null);
|
|
@@ -21246,7 +21961,7 @@ function ForgotPasswordPage(props) {
|
|
|
21246
21961
|
Reset your password
|
|
21247
21962
|
</h1>
|
|
21248
21963
|
|
|
21249
|
-
<
|
|
21964
|
+
<Show71
|
|
21250
21965
|
when={!message()}
|
|
21251
21966
|
fallback={<>
|
|
21252
21967
|
<div
|
|
@@ -21263,7 +21978,7 @@ function ForgotPasswordPage(props) {
|
|
|
21263
21978
|
The link is good for one hour. If nothing arrives, check your spam folder — and make sure this is the
|
|
21264
21979
|
address you signed up with.
|
|
21265
21980
|
</p>
|
|
21266
|
-
<
|
|
21981
|
+
<Show71 when={props.onDone}>
|
|
21267
21982
|
<button
|
|
21268
21983
|
type="button"
|
|
21269
21984
|
onClick={() => props.onDone?.()}
|
|
@@ -21279,7 +21994,7 @@ function ForgotPasswordPage(props) {
|
|
|
21279
21994
|
>
|
|
21280
21995
|
Back to sign in
|
|
21281
21996
|
</button>
|
|
21282
|
-
</
|
|
21997
|
+
</Show71>
|
|
21283
21998
|
</>}
|
|
21284
21999
|
>
|
|
21285
22000
|
<form
|
|
@@ -21297,7 +22012,7 @@ function ForgotPasswordPage(props) {
|
|
|
21297
22012
|
/>
|
|
21298
22013
|
</label>
|
|
21299
22014
|
|
|
21300
|
-
<
|
|
22015
|
+
<Show71 when={error()}>
|
|
21301
22016
|
<div
|
|
21302
22017
|
style={{
|
|
21303
22018
|
padding: "0.625rem 0.875rem",
|
|
@@ -21309,7 +22024,7 @@ function ForgotPasswordPage(props) {
|
|
|
21309
22024
|
>
|
|
21310
22025
|
{error()}
|
|
21311
22026
|
</div>
|
|
21312
|
-
</
|
|
22027
|
+
</Show71>
|
|
21313
22028
|
|
|
21314
22029
|
<button
|
|
21315
22030
|
type="submit"
|
|
@@ -21328,7 +22043,7 @@ function ForgotPasswordPage(props) {
|
|
|
21328
22043
|
{submitting() ? "Sending\u2026" : "Send reset link"}
|
|
21329
22044
|
</button>
|
|
21330
22045
|
</form>
|
|
21331
|
-
</
|
|
22046
|
+
</Show71>
|
|
21332
22047
|
</div>
|
|
21333
22048
|
</div>;
|
|
21334
22049
|
}
|
|
@@ -21355,7 +22070,7 @@ function inputStyle4() {
|
|
|
21355
22070
|
}
|
|
21356
22071
|
|
|
21357
22072
|
// src/pages/ResetPassword.tsx
|
|
21358
|
-
import { createSignal as
|
|
22073
|
+
import { createSignal as createSignal49, Show as Show72 } from "solid-js";
|
|
21359
22074
|
function queryParam(name) {
|
|
21360
22075
|
if (typeof window === "undefined") return "";
|
|
21361
22076
|
return new URLSearchParams(window.location.search).get(name) ?? "";
|
|
@@ -21363,11 +22078,11 @@ function queryParam(name) {
|
|
|
21363
22078
|
function ResetPasswordPage(props) {
|
|
21364
22079
|
const token = () => props.token ?? queryParam("token");
|
|
21365
22080
|
const email = () => props.email ?? queryParam("email");
|
|
21366
|
-
const [password, setPassword] =
|
|
21367
|
-
const [confirm2, setConfirm] =
|
|
21368
|
-
const [submitting, setSubmitting] =
|
|
21369
|
-
const [error, setError] =
|
|
21370
|
-
const [message, setMessage] =
|
|
22081
|
+
const [password, setPassword] = createSignal49("");
|
|
22082
|
+
const [confirm2, setConfirm] = createSignal49("");
|
|
22083
|
+
const [submitting, setSubmitting] = createSignal49(false);
|
|
22084
|
+
const [error, setError] = createSignal49(null);
|
|
22085
|
+
const [message, setMessage] = createSignal49(null);
|
|
21371
22086
|
async function handleSubmit(e) {
|
|
21372
22087
|
e.preventDefault();
|
|
21373
22088
|
setError(null);
|
|
@@ -21429,7 +22144,7 @@ function ResetPasswordPage(props) {
|
|
|
21429
22144
|
Choose a new password
|
|
21430
22145
|
</h1>
|
|
21431
22146
|
|
|
21432
|
-
<
|
|
22147
|
+
<Show72
|
|
21433
22148
|
when={!message()}
|
|
21434
22149
|
fallback={<div
|
|
21435
22150
|
style={{
|
|
@@ -21470,7 +22185,7 @@ function ResetPasswordPage(props) {
|
|
|
21470
22185
|
/>
|
|
21471
22186
|
</label>
|
|
21472
22187
|
|
|
21473
|
-
<
|
|
22188
|
+
<Show72 when={error()}>
|
|
21474
22189
|
<div
|
|
21475
22190
|
style={{
|
|
21476
22191
|
padding: "0.625rem 0.875rem",
|
|
@@ -21482,7 +22197,7 @@ function ResetPasswordPage(props) {
|
|
|
21482
22197
|
>
|
|
21483
22198
|
{error()}
|
|
21484
22199
|
</div>
|
|
21485
|
-
</
|
|
22200
|
+
</Show72>
|
|
21486
22201
|
|
|
21487
22202
|
<button
|
|
21488
22203
|
type="submit"
|
|
@@ -21501,7 +22216,7 @@ function ResetPasswordPage(props) {
|
|
|
21501
22216
|
{submitting() ? "Resetting\u2026" : "Reset password"}
|
|
21502
22217
|
</button>
|
|
21503
22218
|
</form>
|
|
21504
|
-
</
|
|
22219
|
+
</Show72>
|
|
21505
22220
|
</div>
|
|
21506
22221
|
</div>;
|
|
21507
22222
|
}
|
|
@@ -21528,12 +22243,12 @@ function inputStyle5() {
|
|
|
21528
22243
|
}
|
|
21529
22244
|
|
|
21530
22245
|
// src/pages/AffiliateForgotPassword.tsx
|
|
21531
|
-
import { createSignal as
|
|
22246
|
+
import { createSignal as createSignal50, Show as Show73 } from "solid-js";
|
|
21532
22247
|
function AffiliateForgotPassword(props) {
|
|
21533
|
-
const [email, setEmail] =
|
|
21534
|
-
const [submitting, setSubmitting] =
|
|
21535
|
-
const [error, setError] =
|
|
21536
|
-
const [message, setMessage] =
|
|
22248
|
+
const [email, setEmail] = createSignal50("");
|
|
22249
|
+
const [submitting, setSubmitting] = createSignal50(false);
|
|
22250
|
+
const [error, setError] = createSignal50(null);
|
|
22251
|
+
const [message, setMessage] = createSignal50(null);
|
|
21537
22252
|
async function handleSubmit(e) {
|
|
21538
22253
|
e.preventDefault();
|
|
21539
22254
|
setError(null);
|
|
@@ -21554,7 +22269,7 @@ function AffiliateForgotPassword(props) {
|
|
|
21554
22269
|
<div style={cardStyle()}>
|
|
21555
22270
|
<h1 style={headingStyle()}>Reset your password</h1>
|
|
21556
22271
|
|
|
21557
|
-
<
|
|
22272
|
+
<Show73
|
|
21558
22273
|
when={!message()}
|
|
21559
22274
|
fallback={<p style={{ margin: 0, "font-size": "0.9rem" }}>{message()}</p>}
|
|
21560
22275
|
>
|
|
@@ -21574,21 +22289,21 @@ function AffiliateForgotPassword(props) {
|
|
|
21574
22289
|
/>
|
|
21575
22290
|
</label>
|
|
21576
22291
|
|
|
21577
|
-
<
|
|
22292
|
+
<Show73 when={error()}>
|
|
21578
22293
|
<div style={errorStyle()}>{error()}</div>
|
|
21579
|
-
</
|
|
22294
|
+
</Show73>
|
|
21580
22295
|
|
|
21581
22296
|
<button type="submit" disabled={submitting()} style={primaryButtonStyle(submitting())}>
|
|
21582
22297
|
{submitting() ? "Sending\u2026" : "Send reset link"}
|
|
21583
22298
|
</button>
|
|
21584
22299
|
</form>
|
|
21585
|
-
</
|
|
22300
|
+
</Show73>
|
|
21586
22301
|
|
|
21587
|
-
<
|
|
22302
|
+
<Show73 when={props.onNavigateLogin}>
|
|
21588
22303
|
<button type="button" onClick={() => props.onNavigateLogin?.()} style={linkStyle2()}>
|
|
21589
22304
|
Back to login
|
|
21590
22305
|
</button>
|
|
21591
|
-
</
|
|
22306
|
+
</Show73>
|
|
21592
22307
|
</div>
|
|
21593
22308
|
</div>;
|
|
21594
22309
|
}
|
|
@@ -21679,7 +22394,7 @@ function linkStyle2() {
|
|
|
21679
22394
|
}
|
|
21680
22395
|
|
|
21681
22396
|
// src/pages/AffiliateResetPassword.tsx
|
|
21682
|
-
import { createSignal as
|
|
22397
|
+
import { createSignal as createSignal51, Show as Show74 } from "solid-js";
|
|
21683
22398
|
function queryParam2(name) {
|
|
21684
22399
|
if (typeof window === "undefined") return "";
|
|
21685
22400
|
return new URLSearchParams(window.location.search).get(name) ?? "";
|
|
@@ -21687,11 +22402,11 @@ function queryParam2(name) {
|
|
|
21687
22402
|
function AffiliateResetPassword(props) {
|
|
21688
22403
|
const token = () => props.token ?? queryParam2("token");
|
|
21689
22404
|
const email = () => props.email ?? queryParam2("email");
|
|
21690
|
-
const [password, setPassword] =
|
|
21691
|
-
const [confirm2, setConfirm] =
|
|
21692
|
-
const [submitting, setSubmitting] =
|
|
21693
|
-
const [error, setError] =
|
|
21694
|
-
const [done, setDone] =
|
|
22405
|
+
const [password, setPassword] = createSignal51("");
|
|
22406
|
+
const [confirm2, setConfirm] = createSignal51("");
|
|
22407
|
+
const [submitting, setSubmitting] = createSignal51(false);
|
|
22408
|
+
const [error, setError] = createSignal51(null);
|
|
22409
|
+
const [done, setDone] = createSignal51(false);
|
|
21695
22410
|
async function handleSubmit(e) {
|
|
21696
22411
|
e.preventDefault();
|
|
21697
22412
|
setError(null);
|
|
@@ -21726,7 +22441,7 @@ function AffiliateResetPassword(props) {
|
|
|
21726
22441
|
<div style={cardStyle2()}>
|
|
21727
22442
|
<h1 style={headingStyle2()}>Choose a new password</h1>
|
|
21728
22443
|
|
|
21729
|
-
<
|
|
22444
|
+
<Show74
|
|
21730
22445
|
when={!done()}
|
|
21731
22446
|
fallback={<p style={{ margin: 0, "font-size": "0.9rem" }}>
|
|
21732
22447
|
Your password has been reset. You can now log in with your new password.
|
|
@@ -21758,15 +22473,15 @@ function AffiliateResetPassword(props) {
|
|
|
21758
22473
|
/>
|
|
21759
22474
|
</label>
|
|
21760
22475
|
|
|
21761
|
-
<
|
|
22476
|
+
<Show74 when={error()}>
|
|
21762
22477
|
<div style={errorStyle2()}>{error()}</div>
|
|
21763
|
-
</
|
|
22478
|
+
</Show74>
|
|
21764
22479
|
|
|
21765
22480
|
<button type="submit" disabled={submitting()} style={primaryButtonStyle2(submitting())}>
|
|
21766
22481
|
{submitting() ? "Saving\u2026" : "Set new password"}
|
|
21767
22482
|
</button>
|
|
21768
22483
|
</form>
|
|
21769
|
-
</
|
|
22484
|
+
</Show74>
|
|
21770
22485
|
</div>
|
|
21771
22486
|
</div>;
|
|
21772
22487
|
}
|
|
@@ -21859,4 +22574,4 @@ export {
|
|
|
21859
22574
|
AffiliateForgotPassword,
|
|
21860
22575
|
AffiliateResetPassword
|
|
21861
22576
|
};
|
|
21862
|
-
//# sourceMappingURL=
|
|
22577
|
+
//# sourceMappingURL=IYLVDYRI.jsx.map
|