@apextelemed/partner-core 0.7.0 → 0.8.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 +5 -3
- package/dist/chunk/{CBOGAYTL.jsx → 2OOCTPLG.jsx} +2 -2
- package/dist/chunk/{GODF2NJN.js → 4HOG2LES.js} +3 -3
- package/dist/chunk/{GODF2NJN.js.map → 4HOG2LES.js.map} +1 -1
- package/dist/chunk/{SHXH72AC.jsx → 6UXFHBE2.jsx} +24 -5
- package/dist/chunk/{PA66KUAU.jsx → AW6DQGQR.jsx} +242 -109
- package/dist/chunk/{KXO4U2C6.js → EHKYRS2R.js} +23 -6
- package/dist/chunk/EHKYRS2R.js.map +1 -0
- package/dist/chunk/{4S4MTN2K.jsx → GL3OY7W5.jsx} +2 -2
- package/dist/chunk/{7AMVRNYX.jsx → GNPMRN6O.jsx} +92 -35
- package/dist/chunk/{J3OK2PQA.js → HEQMD3X4.js} +3 -3
- package/dist/chunk/{J3OK2PQA.js.map → HEQMD3X4.js.map} +1 -1
- package/dist/chunk/{J3IRPONP.js → HKXDH266.js} +135 -9
- package/dist/chunk/HKXDH266.js.map +1 -0
- package/dist/chunk/{F34QLV7Z.js → HYLIHVIE.js} +251 -191
- package/dist/chunk/HYLIHVIE.js.map +1 -0
- package/dist/chunk/{7AFUT5S3.jsx → JF2KCOOX.jsx} +10 -1
- package/dist/chunk/{4SFB2SS2.jsx → QAFLR3EN.jsx} +2 -2
- package/dist/chunk/{UPZPR5TU.js → RUA3XYFO.js} +11 -3
- package/dist/chunk/RUA3XYFO.js.map +1 -0
- package/dist/chunk/{64RJJFEH.js → ZOZBYBNI.js} +3 -3
- package/dist/chunk/{64RJJFEH.js.map → ZOZBYBNI.js.map} +1 -1
- package/dist/{client-CiHb-dIf.d.ts → client-ZnA3JEbd.d.ts} +28 -1
- package/dist/flows/index.d.ts +91 -2
- package/dist/flows/index.js +6 -6
- package/dist/flows/index.jsx +12 -6
- package/dist/index/index.d.ts +2 -2
- package/dist/index/index.js +7 -7
- package/dist/index/index.jsx +15 -7
- package/dist/pages/index.d.ts +1 -1
- package/dist/pages/index.js +5 -5
- package/dist/pages/index.jsx +5 -5
- package/dist/stores/index.d.ts +1 -1
- package/dist/stores/index.js +2 -2
- package/dist/stores/index.jsx +2 -2
- package/package.json +1 -1
- package/dist/chunk/F34QLV7Z.js.map +0 -1
- package/dist/chunk/J3IRPONP.js.map +0 -1
- package/dist/chunk/KXO4U2C6.js.map +0 -1
- package/dist/chunk/UPZPR5TU.js.map +0 -1
|
@@ -6,19 +6,20 @@ import {
|
|
|
6
6
|
readResumeToken,
|
|
7
7
|
saveFunnelDraft,
|
|
8
8
|
stripResumeToken
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./QAFLR3EN.jsx";
|
|
10
10
|
import {
|
|
11
11
|
affiliateAuth_default,
|
|
12
12
|
auth_default,
|
|
13
13
|
cart_default,
|
|
14
14
|
medication_default
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./GL3OY7W5.jsx";
|
|
16
16
|
import {
|
|
17
17
|
ApiError,
|
|
18
18
|
addressesApi,
|
|
19
19
|
affiliatePortalApi,
|
|
20
20
|
apexApi,
|
|
21
21
|
authApi,
|
|
22
|
+
catalogApi,
|
|
22
23
|
membersApi,
|
|
23
24
|
messagesApi,
|
|
24
25
|
newIdempotencyKey,
|
|
@@ -28,7 +29,7 @@ import {
|
|
|
28
29
|
subscriptionsApi,
|
|
29
30
|
supportApi,
|
|
30
31
|
usersApi
|
|
31
|
-
} from "./
|
|
32
|
+
} from "./JF2KCOOX.jsx";
|
|
32
33
|
import {
|
|
33
34
|
getConfig
|
|
34
35
|
} from "./LDZIUFDM.jsx";
|
|
@@ -758,15 +759,97 @@ function useAddressPair(options = {}) {
|
|
|
758
759
|
};
|
|
759
760
|
}
|
|
760
761
|
|
|
762
|
+
// src/flows/catalogAvailability.ts
|
|
763
|
+
import { createEffect as createEffect2, createSignal as createSignal3, on, onCleanup } from "solid-js";
|
|
764
|
+
var DEBOUNCE_MS = 300;
|
|
765
|
+
var STATE_RE = /^[A-Za-z]{2}$/;
|
|
766
|
+
var INERT_DECISION = {
|
|
767
|
+
unavailableIds: [],
|
|
768
|
+
blocking: false,
|
|
769
|
+
degraded: false
|
|
770
|
+
};
|
|
771
|
+
function deriveCatalogAvailabilityDecision(result) {
|
|
772
|
+
if (!result) return INERT_DECISION;
|
|
773
|
+
if (result.degraded === true) return { ...INERT_DECISION, degraded: true };
|
|
774
|
+
const unavailableIds = result.items.filter((item) => item.checked && item.available === false).map((item) => item.id);
|
|
775
|
+
return { unavailableIds, blocking: unavailableIds.length > 0, degraded: false };
|
|
776
|
+
}
|
|
777
|
+
function useCatalogAvailability(ids, state) {
|
|
778
|
+
const [loading, setLoading] = createSignal3(false);
|
|
779
|
+
const [unavailableIds, setUnavailableIds] = createSignal3([]);
|
|
780
|
+
const [degraded, setDegraded] = createSignal3(false);
|
|
781
|
+
let generation = 0;
|
|
782
|
+
let timer;
|
|
783
|
+
let pending = null;
|
|
784
|
+
function markPending() {
|
|
785
|
+
if (pending) return;
|
|
786
|
+
let resolve;
|
|
787
|
+
const promise = new Promise((r) => resolve = r);
|
|
788
|
+
pending = { promise, resolve };
|
|
789
|
+
}
|
|
790
|
+
function markSettled() {
|
|
791
|
+
pending?.resolve();
|
|
792
|
+
pending = null;
|
|
793
|
+
}
|
|
794
|
+
function settleInert() {
|
|
795
|
+
setLoading(false);
|
|
796
|
+
setUnavailableIds([]);
|
|
797
|
+
setDegraded(false);
|
|
798
|
+
markSettled();
|
|
799
|
+
}
|
|
800
|
+
createEffect2(
|
|
801
|
+
on([ids, state], ([currentIds, currentState]) => {
|
|
802
|
+
if (timer) clearTimeout(timer);
|
|
803
|
+
const requestedIds = [...new Set(currentIds.map((id) => id.trim()).filter(Boolean))];
|
|
804
|
+
const normalizedState = (currentState ?? "").trim().toUpperCase();
|
|
805
|
+
const gen = ++generation;
|
|
806
|
+
if (requestedIds.length === 0 || !STATE_RE.test(normalizedState)) {
|
|
807
|
+
settleInert();
|
|
808
|
+
return;
|
|
809
|
+
}
|
|
810
|
+
setLoading(true);
|
|
811
|
+
markPending();
|
|
812
|
+
timer = setTimeout(() => {
|
|
813
|
+
catalogApi.availability(requestedIds, normalizedState).then((result) => {
|
|
814
|
+
if (gen !== generation) return;
|
|
815
|
+
const decision = deriveCatalogAvailabilityDecision(result);
|
|
816
|
+
setUnavailableIds(decision.unavailableIds);
|
|
817
|
+
setDegraded(decision.degraded);
|
|
818
|
+
}).catch(() => {
|
|
819
|
+
if (gen !== generation) return;
|
|
820
|
+
setUnavailableIds([]);
|
|
821
|
+
setDegraded(false);
|
|
822
|
+
}).finally(() => {
|
|
823
|
+
if (gen !== generation) return;
|
|
824
|
+
setLoading(false);
|
|
825
|
+
markSettled();
|
|
826
|
+
});
|
|
827
|
+
}, DEBOUNCE_MS);
|
|
828
|
+
})
|
|
829
|
+
);
|
|
830
|
+
onCleanup(() => {
|
|
831
|
+
if (timer) clearTimeout(timer);
|
|
832
|
+
generation++;
|
|
833
|
+
markSettled();
|
|
834
|
+
});
|
|
835
|
+
const blocking = () => !degraded() && unavailableIds().length > 0;
|
|
836
|
+
const isUnavailable = (id) => unavailableIds().includes(id);
|
|
837
|
+
const settled = () => pending?.promise ?? Promise.resolve();
|
|
838
|
+
return { loading, blocking, degraded, unavailableIds, isUnavailable, settled };
|
|
839
|
+
}
|
|
840
|
+
function catalogUnavailableMessage(itemName, state) {
|
|
841
|
+
return `${itemName} isn\u2019t available for delivery to ${stateLabel(state)}.`;
|
|
842
|
+
}
|
|
843
|
+
|
|
761
844
|
// src/flows/checkout.ts
|
|
762
|
-
import { createSignal as
|
|
845
|
+
import { createSignal as createSignal5, createEffect as createEffect3, onMount as onMount3 } from "solid-js";
|
|
763
846
|
|
|
764
847
|
// src/flows/_internal/cardTokenizer.ts
|
|
765
|
-
import { createSignal as
|
|
848
|
+
import { createSignal as createSignal4, onMount as onMount2, onCleanup as onCleanup2 } from "solid-js";
|
|
766
849
|
function useCardTokenizer() {
|
|
767
|
-
const [config, setConfig] =
|
|
768
|
-
const [scriptLoaded, setScriptLoaded] =
|
|
769
|
-
const [error, setError] =
|
|
850
|
+
const [config, setConfig] = createSignal4(null);
|
|
851
|
+
const [scriptLoaded, setScriptLoaded] = createSignal4(false);
|
|
852
|
+
const [error, setError] = createSignal4(null);
|
|
770
853
|
const ready = () => {
|
|
771
854
|
const cfg = config();
|
|
772
855
|
if (!cfg) return false;
|
|
@@ -819,7 +902,7 @@ function useCardTokenizer() {
|
|
|
819
902
|
"The secure payment library could not load. Check your connection (or ad blocker) and refresh the page."
|
|
820
903
|
);
|
|
821
904
|
document.head.appendChild(script);
|
|
822
|
-
|
|
905
|
+
onCleanup2(() => {
|
|
823
906
|
script.onload = null;
|
|
824
907
|
script.onerror = null;
|
|
825
908
|
});
|
|
@@ -918,17 +1001,17 @@ function formatCvv(raw) {
|
|
|
918
1001
|
function useCheckoutFlow(options = {}) {
|
|
919
1002
|
const accept = useCardTokenizer();
|
|
920
1003
|
const address = useAddressPair();
|
|
921
|
-
const [outcome, setOutcome] =
|
|
922
|
-
const [profile, setProfile] =
|
|
923
|
-
const [prescription, setPrescription] =
|
|
924
|
-
const [hasPaymentMethod, setHasPaymentMethod] =
|
|
925
|
-
const [cardNumberRaw, setCardNumberRaw] =
|
|
926
|
-
const [expiryRaw, setExpiryRaw] =
|
|
927
|
-
const [cvvRaw, setCvvRaw] =
|
|
928
|
-
const [paymentError, setPaymentError] =
|
|
929
|
-
const [processing, setProcessing] =
|
|
930
|
-
const [correctionAcknowledged, setCorrectionAcknowledged] =
|
|
931
|
-
|
|
1004
|
+
const [outcome, setOutcome] = createSignal5({ kind: "loading" });
|
|
1005
|
+
const [profile, setProfile] = createSignal5(null);
|
|
1006
|
+
const [prescription, setPrescription] = createSignal5(null);
|
|
1007
|
+
const [hasPaymentMethod, setHasPaymentMethod] = createSignal5(false);
|
|
1008
|
+
const [cardNumberRaw, setCardNumberRaw] = createSignal5("", { equals: false });
|
|
1009
|
+
const [expiryRaw, setExpiryRaw] = createSignal5("", { equals: false });
|
|
1010
|
+
const [cvvRaw, setCvvRaw] = createSignal5("", { equals: false });
|
|
1011
|
+
const [paymentError, setPaymentError] = createSignal5(null);
|
|
1012
|
+
const [processing, setProcessing] = createSignal5(false);
|
|
1013
|
+
const [correctionAcknowledged, setCorrectionAcknowledged] = createSignal5(false);
|
|
1014
|
+
createEffect3(() => {
|
|
932
1015
|
address.shipping();
|
|
933
1016
|
setCorrectionAcknowledged(false);
|
|
934
1017
|
});
|
|
@@ -965,7 +1048,14 @@ function useCheckoutFlow(options = {}) {
|
|
|
965
1048
|
promoCode: cart_default.appliedPromo()?.code
|
|
966
1049
|
};
|
|
967
1050
|
};
|
|
968
|
-
const
|
|
1051
|
+
const availability = useCatalogAvailability(
|
|
1052
|
+
() => {
|
|
1053
|
+
const drugId = prescription()?.drugId;
|
|
1054
|
+
return drugId ? [drugId] : [];
|
|
1055
|
+
},
|
|
1056
|
+
() => address.shipping().state
|
|
1057
|
+
);
|
|
1058
|
+
const canSubmit = () => (hasPaymentMethod() || accept.ready()) && !availability.blocking();
|
|
969
1059
|
onMount3(async () => {
|
|
970
1060
|
try {
|
|
971
1061
|
const [profileRes, subsRes] = await Promise.all([
|
|
@@ -1040,6 +1130,11 @@ function useCheckoutFlow(options = {}) {
|
|
|
1040
1130
|
setPaymentError("Missing medication details.");
|
|
1041
1131
|
return;
|
|
1042
1132
|
}
|
|
1133
|
+
await availability.settled();
|
|
1134
|
+
if (availability.blocking()) {
|
|
1135
|
+
setPaymentError(catalogUnavailableMessage(rx.drugName || "This medication", address.shipping().state));
|
|
1136
|
+
return;
|
|
1137
|
+
}
|
|
1043
1138
|
if (!address.validate()) {
|
|
1044
1139
|
const badShipping = hasErrors(address.shippingErrors());
|
|
1045
1140
|
const badBilling = hasErrors(address.billingErrors());
|
|
@@ -1119,6 +1214,7 @@ function useCheckoutFlow(options = {}) {
|
|
|
1119
1214
|
outcome,
|
|
1120
1215
|
profile,
|
|
1121
1216
|
address,
|
|
1217
|
+
availability,
|
|
1122
1218
|
pricing,
|
|
1123
1219
|
hasPaymentMethod,
|
|
1124
1220
|
tokenizerReady: accept.ready,
|
|
@@ -1139,7 +1235,7 @@ function useCheckoutFlow(options = {}) {
|
|
|
1139
1235
|
}
|
|
1140
1236
|
|
|
1141
1237
|
// src/flows/cartCheckout.ts
|
|
1142
|
-
import { createSignal as
|
|
1238
|
+
import { createSignal as createSignal6, createEffect as createEffect4, onMount as onMount4 } from "solid-js";
|
|
1143
1239
|
var memoryKeys = /* @__PURE__ */ new Map();
|
|
1144
1240
|
var ATTEMPT_SCOPE = "cart";
|
|
1145
1241
|
function keyStorageKey(scope) {
|
|
@@ -1169,20 +1265,24 @@ function clearAttemptKey(scope) {
|
|
|
1169
1265
|
function useCartCheckoutFlow() {
|
|
1170
1266
|
const accept = useCardTokenizer();
|
|
1171
1267
|
const address = useAddressPair();
|
|
1172
|
-
const [outcome, setOutcome] =
|
|
1173
|
-
const [profile, setProfile] =
|
|
1174
|
-
const [cardNumberRaw, setCardNumberRaw] =
|
|
1175
|
-
const [expiryRaw, setExpiryRaw] =
|
|
1176
|
-
const [cvvRaw, setCvvRaw] =
|
|
1177
|
-
const [paymentError, setPaymentError] =
|
|
1178
|
-
const [processing, setProcessing] =
|
|
1179
|
-
const [correctionAcknowledged, setCorrectionAcknowledged] =
|
|
1180
|
-
|
|
1268
|
+
const [outcome, setOutcome] = createSignal6({ kind: "loading" });
|
|
1269
|
+
const [profile, setProfile] = createSignal6(null);
|
|
1270
|
+
const [cardNumberRaw, setCardNumberRaw] = createSignal6("", { equals: false });
|
|
1271
|
+
const [expiryRaw, setExpiryRaw] = createSignal6("", { equals: false });
|
|
1272
|
+
const [cvvRaw, setCvvRaw] = createSignal6("", { equals: false });
|
|
1273
|
+
const [paymentError, setPaymentError] = createSignal6(null);
|
|
1274
|
+
const [processing, setProcessing] = createSignal6(false);
|
|
1275
|
+
const [correctionAcknowledged, setCorrectionAcknowledged] = createSignal6(false);
|
|
1276
|
+
createEffect4(() => {
|
|
1181
1277
|
address.shipping();
|
|
1182
1278
|
setCorrectionAcknowledged(false);
|
|
1183
1279
|
});
|
|
1184
1280
|
const items = () => cart_default.items().filter((i) => i.isSubscription !== true);
|
|
1185
1281
|
const skippedSubscriptionItems = () => cart_default.items().filter((i) => i.isSubscription === true);
|
|
1282
|
+
const availability = useCatalogAvailability(
|
|
1283
|
+
() => items().map((i) => i.productId),
|
|
1284
|
+
() => address.shipping().state
|
|
1285
|
+
);
|
|
1186
1286
|
const pricing = () => {
|
|
1187
1287
|
const subtotalCents = items().reduce((sum, i) => sum + i.priceCents * (i.quantity || 1), 0);
|
|
1188
1288
|
const promo = cart_default.appliedPromo();
|
|
@@ -1200,7 +1300,7 @@ function useCartCheckoutFlow() {
|
|
|
1200
1300
|
promoCode: promo?.code
|
|
1201
1301
|
};
|
|
1202
1302
|
};
|
|
1203
|
-
const canSubmit = () => accept.ready();
|
|
1303
|
+
const canSubmit = () => accept.ready() && !availability.blocking();
|
|
1204
1304
|
onMount4(async () => {
|
|
1205
1305
|
if (!auth_default.isAuthenticated()) {
|
|
1206
1306
|
setOutcome({ kind: "needs_auth" });
|
|
@@ -1269,6 +1369,13 @@ function useCartCheckoutFlow() {
|
|
|
1269
1369
|
setOutcome({ kind: "needs_cart" });
|
|
1270
1370
|
return;
|
|
1271
1371
|
}
|
|
1372
|
+
await availability.settled();
|
|
1373
|
+
if (availability.blocking()) {
|
|
1374
|
+
setPaymentError(
|
|
1375
|
+
"One or more items in your cart aren\u2019t available for delivery to your address. Please remove them or update your shipping state."
|
|
1376
|
+
);
|
|
1377
|
+
return;
|
|
1378
|
+
}
|
|
1272
1379
|
if (!address.validate()) {
|
|
1273
1380
|
const badShipping = hasErrors(address.shippingErrors());
|
|
1274
1381
|
const badBilling = hasErrors(address.billingErrors());
|
|
@@ -1367,6 +1474,7 @@ function useCartCheckoutFlow() {
|
|
|
1367
1474
|
address,
|
|
1368
1475
|
items,
|
|
1369
1476
|
skippedSubscriptionItems,
|
|
1477
|
+
availability,
|
|
1370
1478
|
pricing,
|
|
1371
1479
|
tokenizerReady: accept.ready,
|
|
1372
1480
|
acceptJsLoaded: accept.ready,
|
|
@@ -1386,7 +1494,7 @@ function useCartCheckoutFlow() {
|
|
|
1386
1494
|
}
|
|
1387
1495
|
|
|
1388
1496
|
// src/flows/signup.ts
|
|
1389
|
-
import { createEffect as
|
|
1497
|
+
import { createEffect as createEffect5, createSignal as createSignal7, onMount as onMount5 } from "solid-js";
|
|
1390
1498
|
var DRAFT_TTL_MS = 7 * 24 * 3600 * 1e3;
|
|
1391
1499
|
var MAX_RESTORABLE_STEP = 2;
|
|
1392
1500
|
function draftKey() {
|
|
@@ -1422,33 +1530,33 @@ function useSignupFlow(options) {
|
|
|
1422
1530
|
const accept = useCardTokenizer();
|
|
1423
1531
|
let restored = {};
|
|
1424
1532
|
if (typeof window !== "undefined") restored = loadDraft();
|
|
1425
|
-
const [step2, setStep] =
|
|
1426
|
-
const [error, setError] =
|
|
1427
|
-
const [tokenizing, setTokenizing] =
|
|
1428
|
-
const [submitting, setSubmitting] =
|
|
1429
|
-
const [outcome, setOutcome] =
|
|
1430
|
-
const [firstName, setFirstName] =
|
|
1431
|
-
const [lastName, setLastName] =
|
|
1432
|
-
const [email, setEmail] =
|
|
1433
|
-
const [password, setPassword] =
|
|
1434
|
-
const [dateOfBirth, setDateOfBirth] =
|
|
1435
|
-
const [phone, setPhone] =
|
|
1436
|
-
const [street, setStreet] =
|
|
1437
|
-
const [city, setCity] =
|
|
1438
|
-
const [state, setState] =
|
|
1439
|
-
const [zip, setZip] =
|
|
1440
|
-
const [cardNumberRaw, setCardNumberRaw] =
|
|
1441
|
-
const [expiryRaw, setExpiryRaw] =
|
|
1442
|
-
const [cvvRaw, setCvvRaw] =
|
|
1443
|
-
const [tokenizedData, setTokenizedData] =
|
|
1444
|
-
const [promoCode, setPromoCode] =
|
|
1445
|
-
const [idempotencyKey, setIdempotencyKey] =
|
|
1533
|
+
const [step2, setStep] = createSignal7(Math.min(restored.step ?? 0, MAX_RESTORABLE_STEP));
|
|
1534
|
+
const [error, setError] = createSignal7(null);
|
|
1535
|
+
const [tokenizing, setTokenizing] = createSignal7(false);
|
|
1536
|
+
const [submitting, setSubmitting] = createSignal7(false);
|
|
1537
|
+
const [outcome, setOutcome] = createSignal7({ kind: "in_progress" });
|
|
1538
|
+
const [firstName, setFirstName] = createSignal7(restored.firstName ?? "");
|
|
1539
|
+
const [lastName, setLastName] = createSignal7(restored.lastName ?? "");
|
|
1540
|
+
const [email, setEmail] = createSignal7(restored.email ?? "");
|
|
1541
|
+
const [password, setPassword] = createSignal7("");
|
|
1542
|
+
const [dateOfBirth, setDateOfBirth] = createSignal7(restored.dateOfBirth ?? "");
|
|
1543
|
+
const [phone, setPhone] = createSignal7(restored.phone ?? "");
|
|
1544
|
+
const [street, setStreet] = createSignal7(restored.street ?? "");
|
|
1545
|
+
const [city, setCity] = createSignal7(restored.city ?? "");
|
|
1546
|
+
const [state, setState] = createSignal7(restored.state ?? "");
|
|
1547
|
+
const [zip, setZip] = createSignal7(restored.zip ?? "");
|
|
1548
|
+
const [cardNumberRaw, setCardNumberRaw] = createSignal7("", { equals: false });
|
|
1549
|
+
const [expiryRaw, setExpiryRaw] = createSignal7("", { equals: false });
|
|
1550
|
+
const [cvvRaw, setCvvRaw] = createSignal7("", { equals: false });
|
|
1551
|
+
const [tokenizedData, setTokenizedData] = createSignal7(null);
|
|
1552
|
+
const [promoCode, setPromoCode] = createSignal7("");
|
|
1553
|
+
const [idempotencyKey, setIdempotencyKey] = createSignal7(newIdempotencyKey());
|
|
1446
1554
|
const cartIsEmpty = () => cart_default.items().length === 0;
|
|
1447
1555
|
onMount5(() => {
|
|
1448
1556
|
if (options.requireCart && cartIsEmpty()) setOutcome({ kind: "needs_cart" });
|
|
1449
1557
|
});
|
|
1450
1558
|
onMount5(() => {
|
|
1451
|
-
|
|
1559
|
+
createEffect5(() => {
|
|
1452
1560
|
saveDraft({
|
|
1453
1561
|
step: step2(),
|
|
1454
1562
|
firstName: firstName(),
|
|
@@ -1680,7 +1788,7 @@ function useSignupFlow(options) {
|
|
|
1680
1788
|
}
|
|
1681
1789
|
|
|
1682
1790
|
// src/flows/register.ts
|
|
1683
|
-
import { createEffect as
|
|
1791
|
+
import { createEffect as createEffect6, createSignal as createSignal8, onMount as onMount6 } from "solid-js";
|
|
1684
1792
|
var DRAFT_TTL_MS2 = 7 * 24 * 3600 * 1e3;
|
|
1685
1793
|
var MAX_RESTORABLE_STEP2 = 1;
|
|
1686
1794
|
function draftKey2() {
|
|
@@ -1715,26 +1823,26 @@ function clearDraft2() {
|
|
|
1715
1823
|
function useRegisterFlow() {
|
|
1716
1824
|
let restored = {};
|
|
1717
1825
|
if (typeof window !== "undefined") restored = loadDraft2();
|
|
1718
|
-
const [step2, setStep] =
|
|
1719
|
-
const [error, setError] =
|
|
1720
|
-
const [submitting, setSubmitting] =
|
|
1721
|
-
const [outcome, setOutcome] =
|
|
1722
|
-
const [firstName, setFirstName] =
|
|
1723
|
-
const [lastName, setLastName] =
|
|
1724
|
-
const [email, setEmail] =
|
|
1725
|
-
const [password, setPassword] =
|
|
1726
|
-
const [dateOfBirth, setDateOfBirth] =
|
|
1727
|
-
const [phone, setPhone] =
|
|
1728
|
-
const [street, setStreet] =
|
|
1729
|
-
const [city, setCity] =
|
|
1730
|
-
const [state, setState] =
|
|
1731
|
-
const [zip, setZip] =
|
|
1826
|
+
const [step2, setStep] = createSignal8(Math.min(restored.step ?? 0, MAX_RESTORABLE_STEP2));
|
|
1827
|
+
const [error, setError] = createSignal8(null);
|
|
1828
|
+
const [submitting, setSubmitting] = createSignal8(false);
|
|
1829
|
+
const [outcome, setOutcome] = createSignal8({ kind: "in_progress" });
|
|
1830
|
+
const [firstName, setFirstName] = createSignal8(restored.firstName ?? "");
|
|
1831
|
+
const [lastName, setLastName] = createSignal8(restored.lastName ?? "");
|
|
1832
|
+
const [email, setEmail] = createSignal8(restored.email ?? "");
|
|
1833
|
+
const [password, setPassword] = createSignal8("");
|
|
1834
|
+
const [dateOfBirth, setDateOfBirth] = createSignal8(restored.dateOfBirth ?? "");
|
|
1835
|
+
const [phone, setPhone] = createSignal8(restored.phone ?? "");
|
|
1836
|
+
const [street, setStreet] = createSignal8(restored.street ?? "");
|
|
1837
|
+
const [city, setCity] = createSignal8(restored.city ?? "");
|
|
1838
|
+
const [state, setState] = createSignal8(restored.state ?? "");
|
|
1839
|
+
const [zip, setZip] = createSignal8(restored.zip ?? "");
|
|
1732
1840
|
onMount6(() => {
|
|
1733
1841
|
if (auth_default.isAuthenticated()) {
|
|
1734
1842
|
setOutcome({ kind: "already_authenticated" });
|
|
1735
1843
|
return;
|
|
1736
1844
|
}
|
|
1737
|
-
|
|
1845
|
+
createEffect6(() => {
|
|
1738
1846
|
saveDraft2({
|
|
1739
1847
|
step: step2(),
|
|
1740
1848
|
firstName: firstName(),
|
|
@@ -1927,7 +2035,7 @@ function isLive(status) {
|
|
|
1927
2035
|
}
|
|
1928
2036
|
|
|
1929
2037
|
// src/flows/subscribe.ts
|
|
1930
|
-
import { createEffect as
|
|
2038
|
+
import { createEffect as createEffect7, createSignal as createSignal9, on as on2, onMount as onMount7 } from "solid-js";
|
|
1931
2039
|
async function hasActiveSubscription() {
|
|
1932
2040
|
const subsRes = await subscriptionsApi.list();
|
|
1933
2041
|
return (subsRes?.subscriptions ?? []).some((s) => s.status === "active");
|
|
@@ -1938,19 +2046,25 @@ async function hasReconcilableSubscription() {
|
|
|
1938
2046
|
}
|
|
1939
2047
|
function useSubscribeFlow(options) {
|
|
1940
2048
|
const accept = useCardTokenizer();
|
|
1941
|
-
const [outcome, setOutcome] =
|
|
1942
|
-
const [error, setError] =
|
|
1943
|
-
const [submitting, setSubmitting] =
|
|
1944
|
-
const [quote, setQuote] =
|
|
1945
|
-
const [quoteError, setQuoteError] =
|
|
1946
|
-
const [street, setStreet] =
|
|
1947
|
-
const [city, setCity] =
|
|
1948
|
-
const [state, setState] =
|
|
1949
|
-
const [zip, setZip] =
|
|
1950
|
-
const [
|
|
1951
|
-
const
|
|
1952
|
-
const
|
|
1953
|
-
|
|
2049
|
+
const [outcome, setOutcome] = createSignal9({ kind: "loading" });
|
|
2050
|
+
const [error, setError] = createSignal9(null);
|
|
2051
|
+
const [submitting, setSubmitting] = createSignal9(false);
|
|
2052
|
+
const [quote, setQuote] = createSignal9(null);
|
|
2053
|
+
const [quoteError, setQuoteError] = createSignal9(null);
|
|
2054
|
+
const [street, setStreet] = createSignal9("");
|
|
2055
|
+
const [city, setCity] = createSignal9("");
|
|
2056
|
+
const [state, setState] = createSignal9("");
|
|
2057
|
+
const [zip, setZip] = createSignal9("");
|
|
2058
|
+
const [profileState, setProfileState] = createSignal9("");
|
|
2059
|
+
const shipState = () => profileState() || state();
|
|
2060
|
+
const availability = useCatalogAvailability(
|
|
2061
|
+
() => cart_default.items().map((i) => i.productId),
|
|
2062
|
+
shipState
|
|
2063
|
+
);
|
|
2064
|
+
const [cardNumberRaw, setCardNumberRaw] = createSignal9("", { equals: false });
|
|
2065
|
+
const [expiryRaw, setExpiryRaw] = createSignal9("", { equals: false });
|
|
2066
|
+
const [cvvRaw, setCvvRaw] = createSignal9("", { equals: false });
|
|
2067
|
+
const [idempotencyKey, setIdempotencyKey] = createSignal9(newIdempotencyKey());
|
|
1954
2068
|
onMount7(async () => {
|
|
1955
2069
|
if (!auth_default.isAuthenticated()) {
|
|
1956
2070
|
setOutcome({ kind: "needs_auth" });
|
|
@@ -1974,6 +2088,7 @@ function useSubscribeFlow(options) {
|
|
|
1974
2088
|
setStreet(p.address1 || p.street || "");
|
|
1975
2089
|
setCity(p.city || "");
|
|
1976
2090
|
setState(normalizeState(p.state || ""));
|
|
2091
|
+
setProfileState(normalizeState(p.state || ""));
|
|
1977
2092
|
setZip(p.zip || "");
|
|
1978
2093
|
}
|
|
1979
2094
|
} catch {
|
|
@@ -2049,8 +2164,8 @@ function useSubscribeFlow(options) {
|
|
|
2049
2164
|
setQuote(estimateFromCart());
|
|
2050
2165
|
}
|
|
2051
2166
|
}
|
|
2052
|
-
|
|
2053
|
-
|
|
2167
|
+
createEffect7(
|
|
2168
|
+
on2(
|
|
2054
2169
|
() => [outcome().kind, cart_default.items(), cart_default.appliedPromo()],
|
|
2055
2170
|
([kind]) => {
|
|
2056
2171
|
if (kind === "in_progress") void refreshQuote();
|
|
@@ -2070,6 +2185,7 @@ function useSubscribeFlow(options) {
|
|
|
2070
2185
|
if (!cvvRaw().trim()) return "CVV is required.";
|
|
2071
2186
|
return null;
|
|
2072
2187
|
}
|
|
2188
|
+
let awaitingAvailability = false;
|
|
2073
2189
|
async function submit() {
|
|
2074
2190
|
if (submitting()) return;
|
|
2075
2191
|
if (!auth_default.isAuthenticated()) {
|
|
@@ -2084,6 +2200,18 @@ function useSubscribeFlow(options) {
|
|
|
2084
2200
|
setError(quoteError());
|
|
2085
2201
|
return;
|
|
2086
2202
|
}
|
|
2203
|
+
if (awaitingAvailability) return;
|
|
2204
|
+
awaitingAvailability = true;
|
|
2205
|
+
try {
|
|
2206
|
+
await availability.settled();
|
|
2207
|
+
} finally {
|
|
2208
|
+
awaitingAvailability = false;
|
|
2209
|
+
}
|
|
2210
|
+
if (availability.blocking()) {
|
|
2211
|
+
const unavailableItem = cart_default.items().find((i) => availability.isUnavailable(i.productId));
|
|
2212
|
+
setError(catalogUnavailableMessage(unavailableItem?.productName ?? "One of your items", shipState()));
|
|
2213
|
+
return;
|
|
2214
|
+
}
|
|
2087
2215
|
const err = validate();
|
|
2088
2216
|
if (err) {
|
|
2089
2217
|
setError(err);
|
|
@@ -2167,6 +2295,8 @@ function useSubscribeFlow(options) {
|
|
|
2167
2295
|
setState,
|
|
2168
2296
|
zip,
|
|
2169
2297
|
setZip,
|
|
2298
|
+
availability,
|
|
2299
|
+
shipState,
|
|
2170
2300
|
cardNumber: cardNumberRaw,
|
|
2171
2301
|
setCardNumber: (v) => setCardNumberRaw(formatCardNumber(v)),
|
|
2172
2302
|
expiry: expiryRaw,
|
|
@@ -3283,17 +3413,17 @@ function useMemberPortalData() {
|
|
|
3283
3413
|
}
|
|
3284
3414
|
|
|
3285
3415
|
// src/flows/updatePaymentMethod.ts
|
|
3286
|
-
import { createEffect as
|
|
3416
|
+
import { createEffect as createEffect8, createSignal as createSignal10 } from "solid-js";
|
|
3287
3417
|
function useUpdatePaymentMethodFlow(subscriptionId) {
|
|
3288
3418
|
const accept = useCardTokenizer();
|
|
3289
|
-
const [cardNumber, setCardNumberRaw] =
|
|
3290
|
-
const [expiry, setExpiryRaw] =
|
|
3291
|
-
const [cvv, setCvvRaw] =
|
|
3292
|
-
const [submitting, setSubmitting] =
|
|
3293
|
-
const [error, setError] =
|
|
3419
|
+
const [cardNumber, setCardNumberRaw] = createSignal10("");
|
|
3420
|
+
const [expiry, setExpiryRaw] = createSignal10("");
|
|
3421
|
+
const [cvv, setCvvRaw] = createSignal10("");
|
|
3422
|
+
const [submitting, setSubmitting] = createSignal10(false);
|
|
3423
|
+
const [error, setError] = createSignal10(null);
|
|
3294
3424
|
const billing = useAddressPair();
|
|
3295
|
-
const [billingLoaded, setBillingLoaded] =
|
|
3296
|
-
|
|
3425
|
+
const [billingLoaded, setBillingLoaded] = createSignal10(false);
|
|
3426
|
+
createEffect8(() => {
|
|
3297
3427
|
const id = subscriptionId();
|
|
3298
3428
|
if (!id || billingLoaded()) return;
|
|
3299
3429
|
void (async () => {
|
|
@@ -3368,7 +3498,7 @@ function useUpdatePaymentMethodFlow(subscriptionId) {
|
|
|
3368
3498
|
}
|
|
3369
3499
|
|
|
3370
3500
|
// src/flows/messages.ts
|
|
3371
|
-
import { createSignal as
|
|
3501
|
+
import { createSignal as createSignal11, onMount as onMount8, onCleanup as onCleanup3 } from "solid-js";
|
|
3372
3502
|
|
|
3373
3503
|
// src/flows/supportRealtime.ts
|
|
3374
3504
|
var TOKEN_REFRESH_MS = 4 * 60 * 1e3;
|
|
@@ -3539,15 +3669,15 @@ function useMessagesThread(options = {}) {
|
|
|
3539
3669
|
const conversationPollMs = options.pollIntervalMs?.conversations ?? DEFAULT_CONVERSATION_POLL_MS;
|
|
3540
3670
|
const messagePollMs = options.pollIntervalMs?.messages ?? DEFAULT_MESSAGE_POLL_MS;
|
|
3541
3671
|
const autoPoll = options.autoPoll !== false;
|
|
3542
|
-
const [conversations, setConversations] =
|
|
3543
|
-
const [selectedId, setSelectedId] =
|
|
3544
|
-
const [messages, setMessages] =
|
|
3545
|
-
const [draft, setDraft] =
|
|
3546
|
-
const [loadingConversations, setLoadingConversations] =
|
|
3547
|
-
const [loadingMessages, setLoadingMessages] =
|
|
3548
|
-
const [sending, setSending] =
|
|
3549
|
-
const [startingThread, setStartingThread] =
|
|
3550
|
-
const [startingCareTeamThread, setStartingCareTeamThread] =
|
|
3672
|
+
const [conversations, setConversations] = createSignal11([]);
|
|
3673
|
+
const [selectedId, setSelectedId] = createSignal11(null);
|
|
3674
|
+
const [messages, setMessages] = createSignal11([]);
|
|
3675
|
+
const [draft, setDraft] = createSignal11("");
|
|
3676
|
+
const [loadingConversations, setLoadingConversations] = createSignal11(true);
|
|
3677
|
+
const [loadingMessages, setLoadingMessages] = createSignal11(false);
|
|
3678
|
+
const [sending, setSending] = createSignal11(false);
|
|
3679
|
+
const [startingThread, setStartingThread] = createSignal11(false);
|
|
3680
|
+
const [startingCareTeamThread, setStartingCareTeamThread] = createSignal11(false);
|
|
3551
3681
|
let pendingDeepLinkId = readDeepLinkedConversationId();
|
|
3552
3682
|
let convoPollTimer;
|
|
3553
3683
|
let msgPollTimer;
|
|
@@ -3847,7 +3977,7 @@ function useMessagesThread(options = {}) {
|
|
|
3847
3977
|
}, conversationPollMs);
|
|
3848
3978
|
}
|
|
3849
3979
|
});
|
|
3850
|
-
|
|
3980
|
+
onCleanup3(() => {
|
|
3851
3981
|
if (convoPollTimer) clearInterval(convoPollTimer);
|
|
3852
3982
|
if (msgPollTimer) clearInterval(msgPollTimer);
|
|
3853
3983
|
void stopRealtime();
|
|
@@ -3879,7 +4009,7 @@ function useMessagesThread(options = {}) {
|
|
|
3879
4009
|
}
|
|
3880
4010
|
|
|
3881
4011
|
// src/flows/products.ts
|
|
3882
|
-
import { createMemo, createResource as createResource3, createSignal as
|
|
4012
|
+
import { createMemo, createResource as createResource3, createSignal as createSignal12 } from "solid-js";
|
|
3883
4013
|
function priceForDosage(product, dosage) {
|
|
3884
4014
|
const overlay = (product.dosage_prices ?? []).find((d) => d.dosage === dosage);
|
|
3885
4015
|
if (overlay && overlay.price != null) return overlay.price;
|
|
@@ -3952,7 +4082,7 @@ function useProductDetail(productId) {
|
|
|
3952
4082
|
const chosen = override && all.find((d) => d.dosage === override) || all[0];
|
|
3953
4083
|
return [chosen];
|
|
3954
4084
|
});
|
|
3955
|
-
const [selectedDosage, setSelectedDosage] =
|
|
4085
|
+
const [selectedDosage, setSelectedDosage] = createSignal12("");
|
|
3956
4086
|
createMemo(() => {
|
|
3957
4087
|
const opts = dosageOptions();
|
|
3958
4088
|
if (opts.length > 0 && !selectedDosage()) setSelectedDosage(opts[0].dosage);
|
|
@@ -4431,6 +4561,9 @@ export {
|
|
|
4431
4561
|
hasErrors,
|
|
4432
4562
|
firstAddressError,
|
|
4433
4563
|
useAddressPair,
|
|
4564
|
+
deriveCatalogAvailabilityDecision,
|
|
4565
|
+
useCatalogAvailability,
|
|
4566
|
+
catalogUnavailableMessage,
|
|
4434
4567
|
formatCardNumber,
|
|
4435
4568
|
formatExpiry,
|
|
4436
4569
|
formatCvv,
|
|
@@ -4499,4 +4632,4 @@ export {
|
|
|
4499
4632
|
useSurveyV2Flow,
|
|
4500
4633
|
uploadPrescriptionPhoto
|
|
4501
4634
|
};
|
|
4502
|
-
//# sourceMappingURL=
|
|
4635
|
+
//# sourceMappingURL=AW6DQGQR.jsx.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { readPromoCode, clearPromoCode, readCartToken, fetchResumedCart, stripCartToken, adoptCartId, fetchCartConfig, postCartSnapshot, resetCartId } from './
|
|
2
|
-
import { useCardTokenizer, useAddressPair, isLive, formatCvv, formatExpiry, formatCardNumber, firstAddressError, validateAddress } from './
|
|
3
|
-
import { auth_default, cart_default } from './
|
|
4
|
-
import { promoCodesApi, subscriptionsApi, newIdempotencyKey, usersApi, ApiError } from './
|
|
1
|
+
import { readPromoCode, clearPromoCode, readCartToken, fetchResumedCart, stripCartToken, adoptCartId, fetchCartConfig, postCartSnapshot, resetCartId } from './ZOZBYBNI.js';
|
|
2
|
+
import { useCardTokenizer, useAddressPair, useCatalogAvailability, isLive, formatCvv, formatExpiry, formatCardNumber, catalogUnavailableMessage, firstAddressError, validateAddress } from './HKXDH266.js';
|
|
3
|
+
import { auth_default, cart_default } from './4HOG2LES.js';
|
|
4
|
+
import { promoCodesApi, subscriptionsApi, newIdempotencyKey, usersApi, ApiError } from './RUA3XYFO.js';
|
|
5
5
|
import { getConfig } from './5XGPFYIJ.js';
|
|
6
6
|
import { createSignal, onMount, createEffect, createRoot, on } from 'solid-js';
|
|
7
7
|
|
|
@@ -67,6 +67,10 @@ function useSubscriptionIntakeFlow(options) {
|
|
|
67
67
|
const b = addr.effectiveBilling();
|
|
68
68
|
return { street: b.street.trim(), city: b.city.trim(), state: b.state, zip: b.zip.trim() };
|
|
69
69
|
};
|
|
70
|
+
const availability = useCatalogAvailability(
|
|
71
|
+
() => [options.pricing.productId],
|
|
72
|
+
() => state()
|
|
73
|
+
);
|
|
70
74
|
const [cardNumberRaw, setCardNumberRaw] = createSignal("", { equals: false });
|
|
71
75
|
const [expiryRaw, setExpiryRaw] = createSignal("", { equals: false });
|
|
72
76
|
const [cvvRaw, setCvvRaw] = createSignal("", { equals: false });
|
|
@@ -218,7 +222,19 @@ function useSubscriptionIntakeFlow(options) {
|
|
|
218
222
|
setError(null);
|
|
219
223
|
if (step() > 0) setStep((s) => s - 1);
|
|
220
224
|
}
|
|
225
|
+
let awaitingAvailability = false;
|
|
221
226
|
async function submit() {
|
|
227
|
+
if (awaitingAvailability) return;
|
|
228
|
+
awaitingAvailability = true;
|
|
229
|
+
try {
|
|
230
|
+
await availability.settled();
|
|
231
|
+
} finally {
|
|
232
|
+
awaitingAvailability = false;
|
|
233
|
+
}
|
|
234
|
+
if (availability.blocking()) {
|
|
235
|
+
setError(catalogUnavailableMessage(options.pricing.productName, state()));
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
222
238
|
const finalPricing = pricing();
|
|
223
239
|
const isFree = finalPricing.finalCents === 0;
|
|
224
240
|
if (!isFree) {
|
|
@@ -372,6 +388,7 @@ function useSubscriptionIntakeFlow(options) {
|
|
|
372
388
|
phone,
|
|
373
389
|
setPhone,
|
|
374
390
|
address: addr,
|
|
391
|
+
availability,
|
|
375
392
|
cardNumber: cardNumberRaw,
|
|
376
393
|
setCardNumber: (v) => setCardNumberRaw(formatCardNumber(v)),
|
|
377
394
|
expiry: expiryRaw,
|
|
@@ -542,5 +559,5 @@ function startCartCapture(opts = {}) {
|
|
|
542
559
|
}
|
|
543
560
|
|
|
544
561
|
export { restoreCartFromLink, startCartCapture, useSubscriptionIntakeFlow, validateResumedPromo };
|
|
545
|
-
//# sourceMappingURL=
|
|
546
|
-
//# sourceMappingURL=
|
|
562
|
+
//# sourceMappingURL=EHKYRS2R.js.map
|
|
563
|
+
//# sourceMappingURL=EHKYRS2R.js.map
|