@apextelemed/partner-core 0.7.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 +5 -3
- package/dist/chunk/{4SFB2SS2.jsx → 33QXG46Z.jsx} +2 -2
- package/dist/chunk/{J3IRPONP.js → 35C2PAUI.js} +143 -10
- package/dist/chunk/35C2PAUI.js.map +1 -0
- package/dist/chunk/{J3OK2PQA.js → 65LD7XAZ.js} +3 -3
- package/dist/chunk/{J3OK2PQA.js.map → 65LD7XAZ.js.map} +1 -1
- package/dist/chunk/{UPZPR5TU.js → 75B7QHIN.js} +32 -7
- package/dist/chunk/75B7QHIN.js.map +1 -0
- package/dist/chunk/{64RJJFEH.js → AJR7CBZ3.js} +3 -3
- package/dist/chunk/{64RJJFEH.js.map → AJR7CBZ3.js.map} +1 -1
- package/dist/chunk/{SHXH72AC.jsx → C7RXQWXM.jsx} +24 -5
- package/dist/chunk/{CBOGAYTL.jsx → DEDIHIWD.jsx} +2 -2
- package/dist/chunk/{7AMVRNYX.jsx → IYLVDYRI.jsx} +1591 -819
- package/dist/chunk/{KXO4U2C6.js → JOX6EJMB.js} +23 -6
- package/dist/chunk/JOX6EJMB.js.map +1 -0
- package/dist/chunk/{F34QLV7Z.js → MCSS436N.js} +1816 -754
- package/dist/chunk/MCSS436N.js.map +1 -0
- package/dist/chunk/{4S4MTN2K.jsx → MUEGVUP2.jsx} +2 -2
- package/dist/chunk/{7AFUT5S3.jsx → NTYUIUQO.jsx} +31 -5
- package/dist/chunk/{PA66KUAU.jsx → VKSLQCMA.jsx} +251 -110
- package/dist/chunk/{GODF2NJN.js → Y2VD7NYA.js} +3 -3
- package/dist/chunk/{GODF2NJN.js.map → Y2VD7NYA.js.map} +1 -1
- package/dist/{client-CiHb-dIf.d.ts → client-RY9ghN5Q.d.ts} +80 -5
- package/dist/flows/index.d.ts +91 -7
- 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 +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/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
package/dist/api/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AddressVerifyResult, a as AdminApexDrug, b as AdminBillingAttempt, c as AdminCategory, d as AdminCategoryInput, e as AdminCategoryUpdate, f as AdminCustomer, g as AdminCustomerFacts, h as AdminCustomerFunnel, i as AdminCustomerListParams, j as AdminCustomerOverview, k as AdminCustomerProfile, l as AdminCustomerRequest, m as AdminCustomerRow, n as AdminCustomerSupport, o as AdminCustomerSupportThread, p as AdminDashboardStats, q as AdminLifecycle, r as AdminLifecycleBucket, s as AdminListParams, t as AdminOrderSummary, u as AdminPayment, v as AdminPaymentDetail, w as AdminProduct, x as AdminPromoCode, y as AdminPromoCodeInput, z as AdminRefundResult, B as AdminSale, C as AdminSaleInput, D as AdminSubscription, E as AdminSubscriptionDetail, F as AdminSubscriptionPatch, G as AdminSubscriptionWriteResult, H as AdminSupportCustomer, I as AdminSupportStats, J as AdminSupportThread, K as AdminWebhookEvent, L as Affiliate, M as AffiliateAuthTokens, N as AffiliateClickRecord, O as AffiliateConversion, P as AffiliateDashboardLinks, Q as AffiliateDashboardProfile, R as AffiliateDashboardStats, S as AffiliateDownlineMember, T as AffiliateEarningsBreakdown, U as AffiliatePaymentMethod, V as AffiliateProgram, W as AffiliateRegisterInput, X as AffiliateRegisterResponse, Y as AffiliateSession, Z as AffiliateStatsResponse, _ as AffiliateStatus, $ as AffiliateTrackResponse, a0 as ApiError, a1 as ApiResponse, a2 as AttributionMethod, a3 as AuthTokens, a4 as BillingReminderSettings, a5 as
|
|
1
|
+
export { A as AddressVerifyResult, a as AdminApexDrug, b as AdminBillingAttempt, c as AdminCategory, d as AdminCategoryInput, e as AdminCategoryUpdate, f as AdminCustomer, g as AdminCustomerFacts, h as AdminCustomerFunnel, i as AdminCustomerListParams, j as AdminCustomerOverview, k as AdminCustomerProfile, l as AdminCustomerRequest, m as AdminCustomerRow, n as AdminCustomerSupport, o as AdminCustomerSupportThread, p as AdminDashboardStats, q as AdminLifecycle, r as AdminLifecycleBucket, s as AdminListParams, t as AdminOrderSummary, u as AdminPayment, v as AdminPaymentDetail, w as AdminProduct, x as AdminPromoCode, y as AdminPromoCodeInput, z as AdminRefundResult, B as AdminSale, C as AdminSaleInput, D as AdminSubscription, E as AdminSubscriptionDetail, F as AdminSubscriptionPatch, G as AdminSubscriptionWriteResult, H as AdminSupportCustomer, I as AdminSupportStats, J as AdminSupportThread, K as AdminWebhookEvent, L as Affiliate, M as AffiliateAuthTokens, N as AffiliateClickRecord, O as AffiliateConversion, P as AffiliateDashboardLinks, Q as AffiliateDashboardProfile, R as AffiliateDashboardStats, S as AffiliateDownlineMember, T as AffiliateEarningsBreakdown, U as AffiliatePaymentMethod, V as AffiliateProgram, W as AffiliateRegisterInput, X as AffiliateRegisterResponse, Y as AffiliateSession, Z as AffiliateStatsResponse, _ as AffiliateStatus, $ as AffiliateTrackResponse, a0 as ApiError, a1 as ApiResponse, a2 as AttributionMethod, a3 as AuthTokens, a4 as BillingReminderSettings, a5 as CatalogAvailabilityItem, a6 as CatalogAvailabilityReason, a7 as CatalogAvailabilityResult, a8 as CatalogProduct, a9 as CategoryMetadata, aa as CheckoutAddress, ab as CheckoutPayload, ac as CheckoutResult, ad as CommissionConfig, ae as CommissionStatus, af as CompleteSurveyPayload, ag as CreateAffiliatePayload, ah as CreateAffiliateProgramPayload, ai as CreateOrderPayload, aj as CreateRequestPayload, ak as CreateSubscriptionPayload, al as CustomTemplate, am as CustomTemplateInput, an as CustomerDiscountConfig, ao as DeliveryInfo, ap as DiscountType, aq as EmailNotificationSettings, ar as EmailTemplatesMap, as as LoginPayload, at as MemberPrescriptionRequest, au as MemberSurveyMode, av as MemberSurveyResponseSummary, aw as MemberSurveyTranscript, ax as MemberSurveyTranscriptItem, ay as MemberSurveyTranscriptSection, az as MembersMeResponse, aA as Order, aB as OrderItemInput, aC as PaginationParams, aD as PaymentCallbackPayload, aE as PaymentInitiatePayload, aF as PaymentType, aG as PendingRenewalSurvey, aH as Placeholder, aI as PlaceholderKind, aJ as ProductSaleSummary, aK as PromoValidationResponse, aL as PublicCategory, aM as RegisterAndSubscribePayload, aN as RegisterPayload, aO as RenewalStatus, aP as SUPPORT_ATTACHMENT_MAX_BYTES, aQ as SUPPORT_ATTACHMENT_MIME_TYPES, aR as SelectDrugPayload, aS as SendMessagePayload, aT as SendToPharmacyPayload, aU as SubscriptionPreview, aV as SubscriptionPreviewLine, aW as SubscriptionPreviewPayload, aX as SupportAttachment, aY as SupportMessage, aZ as SupportRealtimeToken, a_ as SupportThread, a$ as SupportThreadCategory, b0 as SupportThreadStatus, b1 as SurveySubmitPayload, b2 as TemplatePlaceholdersMap, b3 as TemplateText, b4 as TenantFeature, b5 as TenantFeatureAccess, b6 as TokenTrackName, b7 as UpdateAffiliatePayload, b8 as UpdateAffiliateProgramPayload, b9 as UpdatePaymentMethodPayload, ba as UpdateProfilePayload, bb as User, bc as addressesApi, bd as adminAffiliatesApi, be as adminApi, bf as affiliateAuthStorageKey, bg as affiliatePortalApi, bh as apexApi, bi as apiFetch, bj as authApi, bk as authStorageKey, bl as catalogApi, bm as clearAffiliateTokens, bn as clearTokens, bo as getAffiliateTokens, bp as getTokens, bq as membersApi, br as messagesApi, bs as newIdempotencyKey, bt as onTokensCleared, bu as ordersApi, bv as paymentsApi, bw as productsApi, bx as promoCodesApi, by as setAffiliateTokens, bz as setTokens, bA as subscriptionsApi, bB as supportApi, bC as usersApi } from '../client-RY9ghN5Q.js';
|
|
2
2
|
export { EmbedApiError as ApexV2ApiError, EmbedApiClient, EmbedApiClientOptions, EmbedApiError, EmbedEvent, EmbedEventType, FetchLike, PatientInfo, V2Answer, V2ComposedSurvey, V2DrugResult, V2QualificationResult, V2Question, V2QuestionOption, V2Section, V2Step, V2SubmitResult, V2VisibilityCondition, createEmbedApiClient, disqualificationReasonText, disqualifiedDrugIds, qualifiedDrugIds } from '@apextelemed/survey-core';
|
|
3
3
|
export { C as CartCaptureConfig, a as CartSnapshotLine, F as FunnelConfig, b as FunnelDraftPayload, R as ResumedCart, c as ResumedCartLine, d as ResumedDraft, e as adoptCartId, f as adoptFunnelSessionId, g as captureAuthHeader, h as cartId, i as fetchCartConfig, j as fetchFunnelConfig, k as fetchResumedCart, l as fetchResumedDraft, m as funnelSessionId, p as peekFunnelSessionId, n as postCartSnapshot, o as postFunnelEvent, r as readCartToken, q as readResumeToken, s as resetCartConfigCache, t as resetCartId, u as resetFunnelConfigCache, v as saveFunnelDraft, w as stripCartToken, x as stripResumeToken } from '../cart-BwUwSzWh.js';
|
|
4
4
|
|
package/dist/api/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import '../chunk/JSHO46VZ.js';
|
|
2
|
-
export { adoptCartId, capturePromoCode, cartId, clearPromoCode, fetchCartConfig, fetchResumedCart, postCartSnapshot, readCartToken, readPromoCode, resetCartConfigCache, resetCartId, stripCartToken } from '../chunk/
|
|
2
|
+
export { adoptCartId, capturePromoCode, cartId, clearPromoCode, fetchCartConfig, fetchResumedCart, postCartSnapshot, readCartToken, readPromoCode, resetCartConfigCache, resetCartId, stripCartToken } from '../chunk/AJR7CBZ3.js';
|
|
3
3
|
export { EmbedApiError2 as ApexV2ApiError, EmbedApiError, createEmbedApiClient, disqualificationReasonText, disqualifiedDrugIds, qualifiedDrugIds } from '../chunk/LZWA44KD.js';
|
|
4
|
-
export { adoptFunnelSessionId, captureAuthHeader, fetchFunnelConfig, fetchResumedDraft, funnelSessionId, peekFunnelSessionId, postFunnelEvent, readResumeToken, resetFunnelConfigCache, saveFunnelDraft, stripResumeToken } from '../chunk/
|
|
5
|
-
export { ApiError, SUPPORT_ATTACHMENT_MAX_BYTES, SUPPORT_ATTACHMENT_MIME_TYPES, addressesApi, adminAffiliatesApi, adminApi, affiliateAuthStorageKey, affiliatePortalApi, apexApi, apiFetch, authApi, authStorageKey, captureAffiliateRef, clearAffiliateRef, clearAffiliateTokens, clearTokens, getAffiliateTokens, getTokens, membersApi, messagesApi, newIdempotencyKey, onTokensCleared, ordersApi, paymentsApi, productsApi, promoCodesApi, readAffiliateRef, setAffiliateTokens, setTokens, subscriptionsApi, supportApi, usersApi } from '../chunk/
|
|
4
|
+
export { adoptFunnelSessionId, captureAuthHeader, fetchFunnelConfig, fetchResumedDraft, funnelSessionId, peekFunnelSessionId, postFunnelEvent, readResumeToken, resetFunnelConfigCache, saveFunnelDraft, stripResumeToken } from '../chunk/65LD7XAZ.js';
|
|
5
|
+
export { ApiError, SUPPORT_ATTACHMENT_MAX_BYTES, SUPPORT_ATTACHMENT_MIME_TYPES, addressesApi, adminAffiliatesApi, adminApi, affiliateAuthStorageKey, affiliatePortalApi, apexApi, apiFetch, authApi, authStorageKey, captureAffiliateRef, catalogApi, clearAffiliateRef, clearAffiliateTokens, clearTokens, getAffiliateTokens, getTokens, membersApi, messagesApi, newIdempotencyKey, onTokensCleared, ordersApi, paymentsApi, productsApi, promoCodesApi, readAffiliateRef, setAffiliateTokens, setTokens, subscriptionsApi, supportApi, usersApi } from '../chunk/75B7QHIN.js';
|
|
6
6
|
import '../chunk/5XGPFYIJ.js';
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
package/dist/api/index.jsx
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
resetCartConfigCache,
|
|
13
13
|
resetCartId,
|
|
14
14
|
stripCartToken
|
|
15
|
-
} from "../chunk/
|
|
15
|
+
} from "../chunk/DEDIHIWD.jsx";
|
|
16
16
|
import {
|
|
17
17
|
EmbedApiError,
|
|
18
18
|
EmbedApiError2,
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
resetFunnelConfigCache,
|
|
34
34
|
saveFunnelDraft,
|
|
35
35
|
stripResumeToken
|
|
36
|
-
} from "../chunk/
|
|
36
|
+
} from "../chunk/33QXG46Z.jsx";
|
|
37
37
|
import {
|
|
38
38
|
ApiError,
|
|
39
39
|
SUPPORT_ATTACHMENT_MAX_BYTES,
|
|
@@ -48,6 +48,7 @@ import {
|
|
|
48
48
|
authApi,
|
|
49
49
|
authStorageKey,
|
|
50
50
|
captureAffiliateRef,
|
|
51
|
+
catalogApi,
|
|
51
52
|
clearAffiliateRef,
|
|
52
53
|
clearAffiliateTokens,
|
|
53
54
|
clearTokens,
|
|
@@ -67,7 +68,7 @@ import {
|
|
|
67
68
|
subscriptionsApi,
|
|
68
69
|
supportApi,
|
|
69
70
|
usersApi
|
|
70
|
-
} from "../chunk/
|
|
71
|
+
} from "../chunk/NTYUIUQO.jsx";
|
|
71
72
|
import "../chunk/LDZIUFDM.jsx";
|
|
72
73
|
export {
|
|
73
74
|
EmbedApiError2 as ApexV2ApiError,
|
|
@@ -90,6 +91,7 @@ export {
|
|
|
90
91
|
captureAuthHeader,
|
|
91
92
|
capturePromoCode,
|
|
92
93
|
cartId,
|
|
94
|
+
catalogApi,
|
|
93
95
|
clearAffiliateRef,
|
|
94
96
|
clearAffiliateTokens,
|
|
95
97
|
clearPromoCode,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getTokens
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./NTYUIUQO.jsx";
|
|
4
4
|
import {
|
|
5
5
|
getConfig
|
|
6
6
|
} from "./LDZIUFDM.jsx";
|
|
@@ -154,4 +154,4 @@ export {
|
|
|
154
154
|
readResumeToken,
|
|
155
155
|
stripResumeToken
|
|
156
156
|
};
|
|
157
|
-
//# sourceMappingURL=
|
|
157
|
+
//# sourceMappingURL=33QXG46Z.jsx.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { fetchFunnelConfig, postFunnelEvent, readResumeToken, fetchResumedDraft, stripResumeToken, adoptFunnelSessionId, saveFunnelDraft } from './
|
|
2
|
-
import { cart_default, medication_default, auth_default, affiliateAuth_default } from './
|
|
3
|
-
import { newIdempotencyKey, apexApi, usersApi, addressesApi, paymentsApi, subscriptionsApi, membersApi, supportApi, productsApi, affiliatePortalApi, ApiError, ordersApi, messagesApi, authApi } from './
|
|
1
|
+
import { fetchFunnelConfig, postFunnelEvent, readResumeToken, fetchResumedDraft, stripResumeToken, adoptFunnelSessionId, saveFunnelDraft } from './65LD7XAZ.js';
|
|
2
|
+
import { cart_default, medication_default, auth_default, affiliateAuth_default } from './Y2VD7NYA.js';
|
|
3
|
+
import { newIdempotencyKey, apexApi, usersApi, addressesApi, catalogApi, paymentsApi, subscriptionsApi, membersApi, supportApi, productsApi, affiliatePortalApi, ApiError, ordersApi, messagesApi, authApi } from './75B7QHIN.js';
|
|
4
4
|
import { getConfig } from './5XGPFYIJ.js';
|
|
5
|
-
import { createSignal, onMount, createEffect,
|
|
5
|
+
import { createSignal, onMount, createEffect, on, onCleanup, createResource, createMemo } from 'solid-js';
|
|
6
6
|
import { useSurveyV2Flow as useSurveyV2Flow$1 } from '@apextelemed/survey-solid';
|
|
7
7
|
import { createLocalDraftStore, draftKey as draftKey$1 } from '@apextelemed/survey-core';
|
|
8
8
|
|
|
@@ -725,6 +725,85 @@ function useAddressPair(options = {}) {
|
|
|
725
725
|
applyNormalized
|
|
726
726
|
};
|
|
727
727
|
}
|
|
728
|
+
var DEBOUNCE_MS = 300;
|
|
729
|
+
var STATE_RE = /^[A-Za-z]{2}$/;
|
|
730
|
+
var INERT_DECISION = {
|
|
731
|
+
unavailableIds: [],
|
|
732
|
+
blocking: false,
|
|
733
|
+
degraded: false
|
|
734
|
+
};
|
|
735
|
+
function deriveCatalogAvailabilityDecision(result) {
|
|
736
|
+
if (!result) return INERT_DECISION;
|
|
737
|
+
if (result.degraded === true) return { ...INERT_DECISION, degraded: true };
|
|
738
|
+
const unavailableIds = result.items.filter((item) => item.checked && item.available === false).map((item) => item.id);
|
|
739
|
+
return { unavailableIds, blocking: unavailableIds.length > 0, degraded: false };
|
|
740
|
+
}
|
|
741
|
+
function useCatalogAvailability(ids, state) {
|
|
742
|
+
const [loading, setLoading] = createSignal(false);
|
|
743
|
+
const [unavailableIds, setUnavailableIds] = createSignal([]);
|
|
744
|
+
const [degraded, setDegraded] = createSignal(false);
|
|
745
|
+
let generation = 0;
|
|
746
|
+
let timer;
|
|
747
|
+
let pending = null;
|
|
748
|
+
function markPending() {
|
|
749
|
+
if (pending) return;
|
|
750
|
+
let resolve;
|
|
751
|
+
const promise = new Promise((r) => resolve = r);
|
|
752
|
+
pending = { promise, resolve };
|
|
753
|
+
}
|
|
754
|
+
function markSettled() {
|
|
755
|
+
pending?.resolve();
|
|
756
|
+
pending = null;
|
|
757
|
+
}
|
|
758
|
+
function settleInert() {
|
|
759
|
+
setLoading(false);
|
|
760
|
+
setUnavailableIds([]);
|
|
761
|
+
setDegraded(false);
|
|
762
|
+
markSettled();
|
|
763
|
+
}
|
|
764
|
+
createEffect(
|
|
765
|
+
on([ids, state], ([currentIds, currentState]) => {
|
|
766
|
+
if (timer) clearTimeout(timer);
|
|
767
|
+
const requestedIds = [...new Set(currentIds.map((id) => id.trim()).filter(Boolean))];
|
|
768
|
+
const normalizedState = (currentState ?? "").trim().toUpperCase();
|
|
769
|
+
const gen = ++generation;
|
|
770
|
+
if (requestedIds.length === 0 || !STATE_RE.test(normalizedState)) {
|
|
771
|
+
settleInert();
|
|
772
|
+
return;
|
|
773
|
+
}
|
|
774
|
+
setLoading(true);
|
|
775
|
+
markPending();
|
|
776
|
+
timer = setTimeout(() => {
|
|
777
|
+
catalogApi.availability(requestedIds, normalizedState).then((result) => {
|
|
778
|
+
if (gen !== generation) return;
|
|
779
|
+
const decision = deriveCatalogAvailabilityDecision(result);
|
|
780
|
+
setUnavailableIds(decision.unavailableIds);
|
|
781
|
+
setDegraded(decision.degraded);
|
|
782
|
+
}).catch(() => {
|
|
783
|
+
if (gen !== generation) return;
|
|
784
|
+
setUnavailableIds([]);
|
|
785
|
+
setDegraded(false);
|
|
786
|
+
}).finally(() => {
|
|
787
|
+
if (gen !== generation) return;
|
|
788
|
+
setLoading(false);
|
|
789
|
+
markSettled();
|
|
790
|
+
});
|
|
791
|
+
}, DEBOUNCE_MS);
|
|
792
|
+
})
|
|
793
|
+
);
|
|
794
|
+
onCleanup(() => {
|
|
795
|
+
if (timer) clearTimeout(timer);
|
|
796
|
+
generation++;
|
|
797
|
+
markSettled();
|
|
798
|
+
});
|
|
799
|
+
const blocking = () => !degraded() && unavailableIds().length > 0;
|
|
800
|
+
const isUnavailable = (id) => unavailableIds().includes(id);
|
|
801
|
+
const settled = () => pending?.promise ?? Promise.resolve();
|
|
802
|
+
return { loading, blocking, degraded, unavailableIds, isUnavailable, settled };
|
|
803
|
+
}
|
|
804
|
+
function catalogUnavailableMessage(itemName, state) {
|
|
805
|
+
return `${itemName} isn\u2019t available for delivery to ${stateLabel(state)}.`;
|
|
806
|
+
}
|
|
728
807
|
function useCardTokenizer() {
|
|
729
808
|
const [config, setConfig] = createSignal(null);
|
|
730
809
|
const [scriptLoaded, setScriptLoaded] = createSignal(false);
|
|
@@ -927,7 +1006,14 @@ function useCheckoutFlow(options = {}) {
|
|
|
927
1006
|
promoCode: cart_default.appliedPromo()?.code
|
|
928
1007
|
};
|
|
929
1008
|
};
|
|
930
|
-
const
|
|
1009
|
+
const availability = useCatalogAvailability(
|
|
1010
|
+
() => {
|
|
1011
|
+
const drugId = prescription()?.drugId;
|
|
1012
|
+
return drugId ? [drugId] : [];
|
|
1013
|
+
},
|
|
1014
|
+
() => address.shipping().state
|
|
1015
|
+
);
|
|
1016
|
+
const canSubmit = () => (hasPaymentMethod() || accept.ready()) && !availability.blocking();
|
|
931
1017
|
onMount(async () => {
|
|
932
1018
|
try {
|
|
933
1019
|
const [profileRes, subsRes] = await Promise.all([
|
|
@@ -1002,6 +1088,11 @@ function useCheckoutFlow(options = {}) {
|
|
|
1002
1088
|
setPaymentError("Missing medication details.");
|
|
1003
1089
|
return;
|
|
1004
1090
|
}
|
|
1091
|
+
await availability.settled();
|
|
1092
|
+
if (availability.blocking()) {
|
|
1093
|
+
setPaymentError(catalogUnavailableMessage(rx.drugName || "This medication", address.shipping().state));
|
|
1094
|
+
return;
|
|
1095
|
+
}
|
|
1005
1096
|
if (!address.validate()) {
|
|
1006
1097
|
const badShipping = hasErrors(address.shippingErrors());
|
|
1007
1098
|
const badBilling = hasErrors(address.billingErrors());
|
|
@@ -1081,6 +1172,7 @@ function useCheckoutFlow(options = {}) {
|
|
|
1081
1172
|
outcome,
|
|
1082
1173
|
profile,
|
|
1083
1174
|
address,
|
|
1175
|
+
availability,
|
|
1084
1176
|
pricing,
|
|
1085
1177
|
hasPaymentMethod,
|
|
1086
1178
|
tokenizerReady: accept.ready,
|
|
@@ -1142,6 +1234,10 @@ function useCartCheckoutFlow() {
|
|
|
1142
1234
|
});
|
|
1143
1235
|
const items = () => cart_default.items().filter((i) => i.isSubscription !== true);
|
|
1144
1236
|
const skippedSubscriptionItems = () => cart_default.items().filter((i) => i.isSubscription === true);
|
|
1237
|
+
const availability = useCatalogAvailability(
|
|
1238
|
+
() => items().map((i) => i.productId),
|
|
1239
|
+
() => address.shipping().state
|
|
1240
|
+
);
|
|
1145
1241
|
const pricing = () => {
|
|
1146
1242
|
const subtotalCents = items().reduce((sum, i) => sum + i.priceCents * (i.quantity || 1), 0);
|
|
1147
1243
|
const promo = cart_default.appliedPromo();
|
|
@@ -1159,7 +1255,7 @@ function useCartCheckoutFlow() {
|
|
|
1159
1255
|
promoCode: promo?.code
|
|
1160
1256
|
};
|
|
1161
1257
|
};
|
|
1162
|
-
const canSubmit = () => accept.ready();
|
|
1258
|
+
const canSubmit = () => accept.ready() && !availability.blocking();
|
|
1163
1259
|
onMount(async () => {
|
|
1164
1260
|
if (!auth_default.isAuthenticated()) {
|
|
1165
1261
|
setOutcome({ kind: "needs_auth" });
|
|
@@ -1228,6 +1324,13 @@ function useCartCheckoutFlow() {
|
|
|
1228
1324
|
setOutcome({ kind: "needs_cart" });
|
|
1229
1325
|
return;
|
|
1230
1326
|
}
|
|
1327
|
+
await availability.settled();
|
|
1328
|
+
if (availability.blocking()) {
|
|
1329
|
+
setPaymentError(
|
|
1330
|
+
"One or more items in your cart aren\u2019t available for delivery to your address. Please remove them or update your shipping state."
|
|
1331
|
+
);
|
|
1332
|
+
return;
|
|
1333
|
+
}
|
|
1231
1334
|
if (!address.validate()) {
|
|
1232
1335
|
const badShipping = hasErrors(address.shippingErrors());
|
|
1233
1336
|
const badBilling = hasErrors(address.billingErrors());
|
|
@@ -1326,6 +1429,7 @@ function useCartCheckoutFlow() {
|
|
|
1326
1429
|
address,
|
|
1327
1430
|
items,
|
|
1328
1431
|
skippedSubscriptionItems,
|
|
1432
|
+
availability,
|
|
1329
1433
|
pricing,
|
|
1330
1434
|
tokenizerReady: accept.ready,
|
|
1331
1435
|
acceptJsLoaded: accept.ready,
|
|
@@ -1897,6 +2001,12 @@ function useSubscribeFlow(options) {
|
|
|
1897
2001
|
const [city, setCity] = createSignal("");
|
|
1898
2002
|
const [state, setState] = createSignal("");
|
|
1899
2003
|
const [zip, setZip] = createSignal("");
|
|
2004
|
+
const [profileState, setProfileState] = createSignal("");
|
|
2005
|
+
const shipState = () => profileState() || state();
|
|
2006
|
+
const availability = useCatalogAvailability(
|
|
2007
|
+
() => cart_default.items().map((i) => i.productId),
|
|
2008
|
+
shipState
|
|
2009
|
+
);
|
|
1900
2010
|
const [cardNumberRaw, setCardNumberRaw] = createSignal("", { equals: false });
|
|
1901
2011
|
const [expiryRaw, setExpiryRaw] = createSignal("", { equals: false });
|
|
1902
2012
|
const [cvvRaw, setCvvRaw] = createSignal("", { equals: false });
|
|
@@ -1924,6 +2034,7 @@ function useSubscribeFlow(options) {
|
|
|
1924
2034
|
setStreet(p.address1 || p.street || "");
|
|
1925
2035
|
setCity(p.city || "");
|
|
1926
2036
|
setState(normalizeState(p.state || ""));
|
|
2037
|
+
setProfileState(normalizeState(p.state || ""));
|
|
1927
2038
|
setZip(p.zip || "");
|
|
1928
2039
|
}
|
|
1929
2040
|
} catch {
|
|
@@ -2020,6 +2131,7 @@ function useSubscribeFlow(options) {
|
|
|
2020
2131
|
if (!cvvRaw().trim()) return "CVV is required.";
|
|
2021
2132
|
return null;
|
|
2022
2133
|
}
|
|
2134
|
+
let awaitingAvailability = false;
|
|
2023
2135
|
async function submit() {
|
|
2024
2136
|
if (submitting()) return;
|
|
2025
2137
|
if (!auth_default.isAuthenticated()) {
|
|
@@ -2034,6 +2146,18 @@ function useSubscribeFlow(options) {
|
|
|
2034
2146
|
setError(quoteError());
|
|
2035
2147
|
return;
|
|
2036
2148
|
}
|
|
2149
|
+
if (awaitingAvailability) return;
|
|
2150
|
+
awaitingAvailability = true;
|
|
2151
|
+
try {
|
|
2152
|
+
await availability.settled();
|
|
2153
|
+
} finally {
|
|
2154
|
+
awaitingAvailability = false;
|
|
2155
|
+
}
|
|
2156
|
+
if (availability.blocking()) {
|
|
2157
|
+
const unavailableItem = cart_default.items().find((i) => availability.isUnavailable(i.productId));
|
|
2158
|
+
setError(catalogUnavailableMessage(unavailableItem?.productName ?? "One of your items", shipState()));
|
|
2159
|
+
return;
|
|
2160
|
+
}
|
|
2037
2161
|
const err = validate();
|
|
2038
2162
|
if (err) {
|
|
2039
2163
|
setError(err);
|
|
@@ -2117,6 +2241,8 @@ function useSubscribeFlow(options) {
|
|
|
2117
2241
|
setState,
|
|
2118
2242
|
zip,
|
|
2119
2243
|
setZip,
|
|
2244
|
+
availability,
|
|
2245
|
+
shipState,
|
|
2120
2246
|
cardNumber: cardNumberRaw,
|
|
2121
2247
|
setCardNumber: (v) => setCardNumberRaw(formatCardNumber(v)),
|
|
2122
2248
|
expiry: expiryRaw,
|
|
@@ -2800,6 +2926,13 @@ var JOURNEY_LABEL = {
|
|
|
2800
2926
|
function step(key, state, date = null, detail = null, label = JOURNEY_LABEL[key]) {
|
|
2801
2927
|
return { key, label, state, date, detail };
|
|
2802
2928
|
}
|
|
2929
|
+
function intakeEvidence(o) {
|
|
2930
|
+
if (o.funnel.captures.length > 0) return { kind: "capture" };
|
|
2931
|
+
if (o.requests.items.length > 0) return { kind: "inferred", from: "a prescription request" };
|
|
2932
|
+
if (o.subscriptions.length > 0) return { kind: "inferred", from: "a subscription" };
|
|
2933
|
+
if (o.lifecycle.facts?.hasFunnelCapture) return { kind: "inferred", from: "the account record" };
|
|
2934
|
+
return { kind: "none" };
|
|
2935
|
+
}
|
|
2803
2936
|
function deriveJourney(o) {
|
|
2804
2937
|
const steps = [];
|
|
2805
2938
|
const source = accountSource(o);
|
|
@@ -2815,7 +2948,7 @@ function deriveJourney(o) {
|
|
|
2815
2948
|
(p) => p.createdAt
|
|
2816
2949
|
)[0];
|
|
2817
2950
|
steps.push(step("account", "done", o.customer.createdAt, ACCOUNT_SOURCE_LABEL[source]));
|
|
2818
|
-
const intakeDone =
|
|
2951
|
+
const intakeDone = intakeEvidence(o).kind !== "none";
|
|
2819
2952
|
if (intakeDone) {
|
|
2820
2953
|
steps.push(
|
|
2821
2954
|
step(
|
|
@@ -4339,6 +4472,6 @@ async function uploadPrescriptionPhoto(file) {
|
|
|
4339
4472
|
return { photoId: parsed.photoId };
|
|
4340
4473
|
}
|
|
4341
4474
|
|
|
4342
|
-
export { ACCOUNT_SOURCE_LABEL, DEFAULT_COLOR_PALETTE, LIFECYCLE_BUCKETS, LIFECYCLE_LABEL, LIFECYCLE_TONE, LIVE_SUBSCRIPTION_STATUSES, SUPPORT_CATEGORIES, TERMINAL_SUBSCRIPTION_STATUSES, US_STATES, US_STATE_OPTIONS, accountSource, availableStateOptions, availableStates, buildRefillView, buildTimeline, buildTrackerView, buildTrackingUrl, captureFunnelEmail, categoryColor, categoryLabel, createFunnelTelemetry, deriveAttention, deriveJourney, emailGateAnswered, firstAddressError, fmtDay, formatCalendarDate, formatCardNumber, formatConversationTime, formatCvv, formatEventDate, formatExpiry, formatMessageTime, formatRelativeTime, formatStageDate, hasErrors, hasStateRestrictions, isCssColorValue, isImageAttachment, isLive, isQuestionVisible, isReconcilable, lifecycleReason, lowestPrice, lowestSalePrice, markEmailGateAnswered, normalizeState, primarySubscription, reconcileCartAgainstCatalog, reconcileCartLines, redeemResumeLink, resetResumeRedemption, resolveCategoryColor, resolveSurveyV2DrugIntent, salePriceForBase, stateAvailabilityNote, subscribeToSupportTopic, toTrackerRequest, uploadPrescriptionPhoto, useAddressPair, useAffiliateConversions, useAffiliateDownline, useAffiliateLinks, useAffiliateStats, useCardTokenizer, useCartCheckoutFlow, useCartReconcile, useCatalog, useCheckoutFlow, useDashboardData, useMedicationSelect, useMemberPortalData, useMessagesThread, useProductDetail, useRegisterFlow, useSignupFlow, useSubscribeFlow, useSurveyFlow, useSurveyV2Flow, useUpdatePaymentMethodFlow, validateAddress };
|
|
4343
|
-
//# sourceMappingURL=
|
|
4344
|
-
//# sourceMappingURL=
|
|
4475
|
+
export { ACCOUNT_SOURCE_LABEL, DEFAULT_COLOR_PALETTE, LIFECYCLE_BUCKETS, LIFECYCLE_LABEL, LIFECYCLE_TONE, LIVE_SUBSCRIPTION_STATUSES, SUPPORT_CATEGORIES, TERMINAL_SUBSCRIPTION_STATUSES, US_STATES, US_STATE_OPTIONS, accountSource, availableStateOptions, availableStates, buildRefillView, buildTimeline, buildTrackerView, buildTrackingUrl, captureFunnelEmail, catalogUnavailableMessage, categoryColor, categoryLabel, createFunnelTelemetry, deriveAttention, deriveCatalogAvailabilityDecision, deriveJourney, emailGateAnswered, firstAddressError, fmtDay, formatCalendarDate, formatCardNumber, formatConversationTime, formatCvv, formatEventDate, formatExpiry, formatMessageTime, formatRelativeTime, formatStageDate, hasErrors, hasStateRestrictions, intakeEvidence, isCssColorValue, isImageAttachment, isLive, isQuestionVisible, isReconcilable, lifecycleReason, lowestPrice, lowestSalePrice, markEmailGateAnswered, normalizeState, primarySubscription, reconcileCartAgainstCatalog, reconcileCartLines, redeemResumeLink, resetResumeRedemption, resolveCategoryColor, resolveSurveyV2DrugIntent, salePriceForBase, stateAvailabilityNote, subscribeToSupportTopic, toTrackerRequest, uploadPrescriptionPhoto, useAddressPair, useAffiliateConversions, useAffiliateDownline, useAffiliateLinks, useAffiliateStats, useCardTokenizer, useCartCheckoutFlow, useCartReconcile, useCatalog, useCatalogAvailability, useCheckoutFlow, useDashboardData, useMedicationSelect, useMemberPortalData, useMessagesThread, useProductDetail, useRegisterFlow, useSignupFlow, useSubscribeFlow, useSurveyFlow, useSurveyV2Flow, useUpdatePaymentMethodFlow, validateAddress };
|
|
4476
|
+
//# sourceMappingURL=35C2PAUI.js.map
|
|
4477
|
+
//# sourceMappingURL=35C2PAUI.js.map
|