@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
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
setAffiliateTokens,
|
|
13
13
|
setTokens,
|
|
14
14
|
usersApi
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./NTYUIUQO.jsx";
|
|
16
16
|
import {
|
|
17
17
|
getConfig,
|
|
18
18
|
onConfigured
|
|
@@ -414,4 +414,4 @@ export {
|
|
|
414
414
|
affiliateAuth_default,
|
|
415
415
|
medication_default
|
|
416
416
|
};
|
|
417
|
-
//# sourceMappingURL=
|
|
417
|
+
//# sourceMappingURL=MUEGVUP2.jsx.map
|
|
@@ -921,14 +921,16 @@ var adminApi = {
|
|
|
921
921
|
getWebhookEvents(params) {
|
|
922
922
|
return apiFetch(`/admin/webhook-events${qs(params)}`);
|
|
923
923
|
},
|
|
924
|
+
// The email-template calls use the backend's `format=body` shape: one HTML
|
|
925
|
+
// `body` per template rather than greeting / paragraphs / closing.
|
|
924
926
|
getEmailTemplates() {
|
|
925
|
-
return apiFetch("/admin/settings/email-templates");
|
|
927
|
+
return apiFetch("/admin/settings/email-templates?format=body");
|
|
926
928
|
},
|
|
927
929
|
createCustomTemplate(input) {
|
|
928
|
-
return post("/admin/settings/email-templates/custom", input);
|
|
930
|
+
return post("/admin/settings/email-templates/custom?format=body", input);
|
|
929
931
|
},
|
|
930
932
|
updateCustomTemplate(id, input) {
|
|
931
|
-
return put(`/admin/settings/email-templates/custom/${id}`, input);
|
|
933
|
+
return put(`/admin/settings/email-templates/custom/${id}?format=body`, input);
|
|
932
934
|
},
|
|
933
935
|
/** Rejects with the server's message (409) while a sequence still uses it. */
|
|
934
936
|
deleteCustomTemplate(id) {
|
|
@@ -941,11 +943,26 @@ var adminApi = {
|
|
|
941
943
|
return put("/admin/settings/email-templates", { templates });
|
|
942
944
|
},
|
|
943
945
|
resetEmailTemplate(templateKey) {
|
|
944
|
-
return post("/admin/settings/email-templates/reset", { templateKey });
|
|
946
|
+
return post("/admin/settings/email-templates/reset?format=body", { templateKey });
|
|
945
947
|
},
|
|
946
948
|
sendTestEmail(templateKey) {
|
|
947
949
|
return post("/admin/settings/email-templates/test", { templateKey });
|
|
948
950
|
},
|
|
951
|
+
/** Every optional feature of this tenant, with its state and any pending request. */
|
|
952
|
+
getFeatures() {
|
|
953
|
+
return apiFetch("/admin/features");
|
|
954
|
+
},
|
|
955
|
+
/** Switch a self-serve feature. Returns the whole list: dependents can change with it. */
|
|
956
|
+
setFeature(key, enabled) {
|
|
957
|
+
return put(`/admin/features/${encodeURIComponent(key)}`, { enabled });
|
|
958
|
+
},
|
|
959
|
+
/** Ask the platform team to turn a feature on. `emailed` is false when the ask was saved but no email went out. */
|
|
960
|
+
requestFeature(key, note) {
|
|
961
|
+
return post(
|
|
962
|
+
`/admin/features/${encodeURIComponent(key)}/request`,
|
|
963
|
+
note ? { note } : {}
|
|
964
|
+
);
|
|
965
|
+
},
|
|
949
966
|
getEmailNotifications() {
|
|
950
967
|
return apiFetch("/admin/settings/email-notifications");
|
|
951
968
|
},
|
|
@@ -1342,4 +1359,4 @@ export {
|
|
|
1342
1359
|
clearAffiliateTokens,
|
|
1343
1360
|
affiliatePortalApi
|
|
1344
1361
|
};
|
|
1345
|
-
//# sourceMappingURL=
|
|
1362
|
+
//# sourceMappingURL=NTYUIUQO.jsx.map
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
readResumeToken,
|
|
7
7
|
saveFunnelDraft,
|
|
8
8
|
stripResumeToken
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./33QXG46Z.jsx";
|
|
10
10
|
import {
|
|
11
11
|
affiliateAuth_default,
|
|
12
12
|
auth_default,
|
|
13
13
|
cart_default,
|
|
14
14
|
medication_default
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./MUEGVUP2.jsx";
|
|
16
16
|
import {
|
|
17
17
|
ApiError,
|
|
18
18
|
addressesApi,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
subscriptionsApi,
|
|
30
30
|
supportApi,
|
|
31
31
|
usersApi
|
|
32
|
-
} from "./
|
|
32
|
+
} from "./NTYUIUQO.jsx";
|
|
33
33
|
import {
|
|
34
34
|
getConfig
|
|
35
35
|
} from "./LDZIUFDM.jsx";
|
|
@@ -2983,6 +2983,13 @@ var JOURNEY_LABEL = {
|
|
|
2983
2983
|
function step(key, state, date = null, detail = null, label = JOURNEY_LABEL[key]) {
|
|
2984
2984
|
return { key, label, state, date, detail };
|
|
2985
2985
|
}
|
|
2986
|
+
function intakeEvidence(o) {
|
|
2987
|
+
if (o.funnel.captures.length > 0) return { kind: "capture" };
|
|
2988
|
+
if (o.requests.items.length > 0) return { kind: "inferred", from: "a prescription request" };
|
|
2989
|
+
if (o.subscriptions.length > 0) return { kind: "inferred", from: "a subscription" };
|
|
2990
|
+
if (o.lifecycle.facts?.hasFunnelCapture) return { kind: "inferred", from: "the account record" };
|
|
2991
|
+
return { kind: "none" };
|
|
2992
|
+
}
|
|
2986
2993
|
function deriveJourney(o) {
|
|
2987
2994
|
const steps = [];
|
|
2988
2995
|
const source = accountSource(o);
|
|
@@ -2998,7 +3005,7 @@ function deriveJourney(o) {
|
|
|
2998
3005
|
(p) => p.createdAt
|
|
2999
3006
|
)[0];
|
|
3000
3007
|
steps.push(step("account", "done", o.customer.createdAt, ACCOUNT_SOURCE_LABEL[source]));
|
|
3001
|
-
const intakeDone =
|
|
3008
|
+
const intakeDone = intakeEvidence(o).kind !== "none";
|
|
3002
3009
|
if (intakeDone) {
|
|
3003
3010
|
steps.push(
|
|
3004
3011
|
step(
|
|
@@ -4593,6 +4600,7 @@ export {
|
|
|
4593
4600
|
accountSource,
|
|
4594
4601
|
lifecycleReason,
|
|
4595
4602
|
deriveAttention,
|
|
4603
|
+
intakeEvidence,
|
|
4596
4604
|
deriveJourney,
|
|
4597
4605
|
toTrackerRequest,
|
|
4598
4606
|
buildTimeline,
|
|
@@ -4632,4 +4640,4 @@ export {
|
|
|
4632
4640
|
useSurveyV2Flow,
|
|
4633
4641
|
uploadPrescriptionPhoto
|
|
4634
4642
|
};
|
|
4635
|
-
//# sourceMappingURL=
|
|
4643
|
+
//# sourceMappingURL=VKSLQCMA.jsx.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { onTokensCleared, authStorageKey, getTokens, usersApi, ApiError, affiliateAuthStorageKey, getAffiliateTokens, affiliatePortalApi, clearTokens, authApi, clearAffiliateTokens, setTokens, setAffiliateTokens } from './
|
|
1
|
+
import { onTokensCleared, authStorageKey, getTokens, usersApi, ApiError, affiliateAuthStorageKey, getAffiliateTokens, affiliatePortalApi, clearTokens, authApi, clearAffiliateTokens, setTokens, setAffiliateTokens } from './75B7QHIN.js';
|
|
2
2
|
import { onConfigured, getConfig } from './5XGPFYIJ.js';
|
|
3
3
|
import { createRoot, createSignal, createMemo, batch } from 'solid-js';
|
|
4
4
|
|
|
@@ -382,5 +382,5 @@ var medicationStore = createRoot(createMedicationStore);
|
|
|
382
382
|
var medication_default = medicationStore;
|
|
383
383
|
|
|
384
384
|
export { affiliateAuth_default, auth_default, cart_default, medication_default };
|
|
385
|
-
//# sourceMappingURL=
|
|
386
|
-
//# sourceMappingURL=
|
|
385
|
+
//# sourceMappingURL=Y2VD7NYA.js.map
|
|
386
|
+
//# sourceMappingURL=Y2VD7NYA.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/stores/cart.ts","../../src/stores/auth.ts","../../src/stores/affiliateAuth.ts","../../src/stores/medication.ts"],"names":["createSignal","createRoot","batch"],"mappings":";;;;AAGA,IAAM,cAAA,GAAiB,MAAM,CAAA,EAAG,SAAA,GAAY,aAAa,CAAA,KAAA,CAAA;AACzD,IAAM,eAAA,GAAkB,MAAM,CAAA,EAAG,SAAA,GAAY,aAAa,CAAA,WAAA,CAAA;AA4C1D,SAAS,OAAA,CAAQ,WAAmB,MAAA,EAAwB;AAC1D,EAAA,OAAO,CAAA,EAAG,SAAS,CAAA,EAAA,EAAK,MAAM,CAAA,CAAA;AAChC;AAEA,SAAS,WAAA,GAA0B;AACjC,EAAA,IAAI;AACF,IAAA,MAAM,GAAA,GAAM,YAAA,CAAa,OAAA,CAAQ,cAAA,EAAgB,CAAA;AACjD,IAAA,IAAI,CAAC,GAAA,EAAK,OAAO,EAAC;AAClB,IAAA,MAAM,MAAA,GAAS,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA;AAC7B,IAAA,IAAI,CAAC,KAAA,CAAM,OAAA,CAAQ,MAAM,CAAA,SAAU,EAAC;AAGpC,IAAA,OAAO,MAAA,CAAO,GAAA,CAAI,CAAC,CAAA,MAAiB;AAAA,MAClC,GAAG,CAAA;AAAA,MACH,QAAA,EAAU,MAAA,CAAO,SAAA,CAAU,CAAA,CAAE,QAAQ,KAAK,CAAA,CAAE,QAAA,GAAW,CAAA,GAAI,CAAA,CAAE,QAAA,GAAW;AAAA,KAC1E,CAAE,CAAA;AAAA,EACJ,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,EAAC;AAAA,EACV;AACF;AAEA,SAAS,gBAAA,GAA4C;AACnD,EAAA,IAAI;AACF,IAAA,MAAM,GAAA,GAAM,YAAA,CAAa,OAAA,CAAQ,eAAA,EAAiB,CAAA;AAClD,IAAA,IAAI,CAAC,KAAK,OAAO,IAAA;AACjB,IAAA,OAAO,IAAA,CAAK,MAAM,GAAG,CAAA;AAAA,EACvB,CAAA,C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AAA;AAAA,IAClB;AAAA,EACF;AAEA,EAAA,eAAe,MAAA,GAAS;AACtB,IAAA,IAAI;AACF,MAAA,MAAM,mBAAmB,MAAA,EAAO;AAAA,IAClC,CAAA,SAAE;AACA,MAAA,UAAA,CAAW,IAAI,CAAA;AAAA,IACjB;AAAA,EACF;AAEA,EAAA,OAAO;AAAA,IACL,MAAA;AAAA,IACA,SAAA;AAAA,IACA,eAAA;AAAA,IACA,UAAA;AAAA,IACA,OAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA;AAAA,IACA;AAAA,GACF;AACF;AAEA,IAAM,kBAAA,GAAqBD,WAAW,wBAAwB,CAAA;AAC9D,IAAO,qBAAA,GAAQ;AC5Jf,SAAS,qBAAA,GAAwB;AAC/B,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAID,aAAyC,IAAI,CAAA;AAE7E,EAAA,SAAS,OAAO,UAAA,EAAiC;AAC/C,IAAA,WAAA,CAAY,UAAU,CAAA;AAAA,EACxB;AAEA,EAAA,SAAS,KAAA,GAAQ;AACf,IAAA,WAAA,CAAY,IAAI,CAAA;AAAA,EAClB;AAEA,EAAA,OAAO,EAAE,QAAA,EAAU,MAAA,EAAQ,KAAA,EAAM;AACnC;AAEA,IAAM,eAAA,GAAkBC,WAAW,qBAAqB,CAAA;AACxD,IAAO,kBAAA,GAAQ","file":"4HOG2LES.js","sourcesContent":["import { createSignal, createRoot } from 'solid-js';\nimport { getConfig } from '../config';\n\nconst cartStorageKey = () => `${getConfig().storagePrefix}-cart`;\nconst promoStorageKey = () => `${getConfig().storagePrefix}-cart-promo`;\n\nexport interface CartItem {\n productId: string;\n productName: string;\n dosage: string;\n /** Dose redesign (Phase 8): optional patient-requested intake hints, mirroring\n * Apex intake — `requestedSku` is the binding patient-bought SKU,\n * `requestedClinicalDose` is the advisory dose. Default undefined; carried\n * through to the /apex/requests medications payload. Nothing sets these yet. */\n requestedSku?: string;\n /** SKU identity S4: the stable, opaque `skus[].id` form of `requestedSku`\n * (from Apex's /v1/drugs catalog). Preferred over the label — survives a\n * relabel. Additive; carried through to the medications payload. */\n requestedSkuId?: string;\n requestedClinicalDose?: { value: number; unit: string };\n quantity: number;\n priceCents: number;\n drugId: string | null;\n /** The linked Apex drug id, copied from the catalog product. Matches the id\n * the survey qualification verdict (`drugResults[].drugId`) is keyed on, so\n * request creation can gate out drugs the survey marked ineligible. Null/\n * undefined for non-Apex products or carts saved before this field existed. */\n apexDrugId?: string | null;\n categories: string[];\n thumbnailUrl?: string;\n /** True when the product uses flat_fee pricing. The dosage is still set\n * (Apex needs it for the prescription) but consumer cart drawers should\n * skip rendering the dose suffix. */\n hideDoseLabel?: boolean;\n /** Copied from the catalog's `is_subscription` at add-time. The one-time\n * checkout flow excludes subscription items (the backend 400s a\n * /payments/checkout containing one, and stays the authority). Undefined —\n * legacy persisted carts, non-catalog adds — is treated as one-time-purchasable. */\n isSubscription?: boolean;\n}\n\nexport interface AppliedPromoCode {\n code: string;\n discountType: 'percent' | 'fixed';\n discountValueCents: number;\n discountCents: number;\n}\n\nfunction itemKey(productId: string, dosage: string): string {\n return `${productId}::${dosage}`;\n}\n\nfunction loadInitial(): CartItem[] {\n try {\n const raw = localStorage.getItem(cartStorageKey());\n if (!raw) return [];\n const parsed = JSON.parse(raw);\n if (!Array.isArray(parsed)) return [];\n // Preserve a sane persisted quantity (set via setQuantity); anything else\n // — legacy carts, tampered storage — normalizes back to 1.\n return parsed.map((i: CartItem) => ({\n ...i,\n quantity: Number.isInteger(i.quantity) && i.quantity > 0 ? i.quantity : 1,\n }));\n } catch {\n return [];\n }\n}\n\nfunction loadInitialPromo(): AppliedPromoCode | null {\n try {\n const raw = localStorage.getItem(promoStorageKey());\n if (!raw) return null;\n return JSON.parse(raw) as AppliedPromoCode;\n } catch {\n return null;\n }\n}\n\nfunction persist(items: CartItem[]) {\n try {\n localStorage.setItem(cartStorageKey(), JSON.stringify(items));\n } catch {\n // noop\n }\n}\n\nfunction persistPromo(promo: AppliedPromoCode | null) {\n try {\n if (promo) localStorage.setItem(promoStorageKey(), JSON.stringify(promo));\n else localStorage.removeItem(promoStorageKey());\n } catch {\n // noop\n }\n}\n\nfunction createCartStore() {\n const [items, setItems] = createSignal<CartItem[]>(loadInitial());\n const [isOpen, setIsOpen] = createSignal(false);\n const [appliedPromo, setAppliedPromo] = createSignal<AppliedPromoCode | null>(loadInitialPromo());\n\n function write(next: CartItem[]) {\n setItems(next);\n persist(next);\n }\n\n function count() {\n return items().length;\n }\n\n function subtotalCents() {\n return items().reduce((sum, i) => sum + i.priceCents * (i.quantity || 1), 0);\n }\n\n function add(item: CartItem) {\n const key = itemKey(item.productId, item.dosage);\n const current = items();\n if (current.some(i => itemKey(i.productId, i.dosage) === key)) return;\n write([...current, { ...item, quantity: 1 }]);\n }\n\n function remove(key: string) {\n write(items().filter(i => itemKey(i.productId, i.dosage) !== key));\n }\n\n /** Set an item's quantity (floored, clamped to ≥1 — removing is `remove`'s\n * job). Non-finite input and unknown keys are ignored. `add` still starts\n * every item at 1; this is the only quantity mutator. */\n function setQuantity(key: string, quantity: number) {\n if (!Number.isFinite(quantity)) return;\n const clamped = Math.max(1, Math.floor(quantity));\n const current = items();\n if (!current.some(i => itemKey(i.productId, i.dosage) === key)) return;\n write(current.map(i => (itemKey(i.productId, i.dosage) === key ? { ...i, quantity: clamped } : i)));\n }\n\n /**\n * Replace the whole cart in one write. For catalog reconciliation\n * (`flows/cartReconcile`), which drops lines the catalog no longer offers and\n * refreshes the snapshots of the ones it does — neither expressible as\n * add/remove, and both must land as a single persist so a half-written cart\n * can never be read back. Quantities are taken as given (unlike `add`, which\n * always starts at 1).\n */\n function replace(next: CartItem[]) {\n write(next);\n }\n\n function clear() {\n // Preserve the applied promo across cart resets — the survey submission\n // clears the cart but the customer still expects the code they entered to\n // apply to subsequent prescription purchases. Removing the promo is an\n // explicit action via the cart drawer's \"remove\" link.\n write([]);\n }\n\n function hasGlp1() {\n return items().some(i =>\n i.categories.some(c => c.toLowerCase().includes('weight') || c.toLowerCase().includes('glp')),\n );\n }\n\n function isMultiItem() {\n return items().length > 1;\n }\n\n function setPromo(promo: AppliedPromoCode | null) {\n setAppliedPromo(promo);\n persistPromo(promo);\n }\n\n return {\n items,\n count,\n subtotalCents,\n add,\n remove,\n setQuantity,\n replace,\n clear,\n hasGlp1,\n isMultiItem,\n itemKey,\n isOpen,\n open: () => setIsOpen(true),\n close: () => setIsOpen(false),\n toggle: () => setIsOpen(v => !v),\n appliedPromo,\n setPromo,\n };\n}\n\nconst cartStore = createRoot(createCartStore);\nexport default cartStore;\n","import { createSignal, createMemo, createRoot, batch } from 'solid-js';\nimport { onConfigured } from '../config';\nimport {\n authApi,\n getTokens,\n setTokens,\n clearTokens,\n usersApi,\n ApiError,\n onTokensCleared,\n authStorageKey,\n type User,\n type AuthTokens,\n type RegisterPayload,\n type RegisterAndSubscribePayload,\n} from '../api/client';\nimport cartStore from './cart';\n\nfunction createAuthStore() {\n // ── Signals ─────────────────────────────────────────────────────\n\n const [tokens, _setTokens] = createSignal<AuthTokens | null>(null);\n const [user, setUser] = createSignal<User | null>(null);\n const [isAuthenticated, setIsAuthenticated] = createSignal(false);\n const [loading, setLoading] = createSignal(false);\n\n // Derived, not a second signal: admin-ness must never be observable out of\n // step with the user it describes. As separate writes, Solid flushed\n // dependents between setUser and setIsAdmin, so an admin gate combining\n // \"hydrated\" (user() !== null) with isAdmin() saw \"hydrated but not admin\"\n // for one tick on every hard load of /admin and bounced to the fallback\n // route.\n const isAdmin = createMemo(() => user()?.role === 'admin');\n\n // ── Internal helpers ────────────────────────────────────────────\n\n /** Reset the in-memory session signals WITHOUT touching token storage.\n * Used by the token-cleared/storage listeners, where storage is already\n * gone (writing it back would re-notify and loop). */\n function dropSession() {\n batch(() => {\n _setTokens(null);\n setIsAuthenticated(false);\n setUser(null);\n });\n }\n\n function syncTokens(t: AuthTokens | null) {\n _setTokens(t);\n if (t) {\n setTokens(t);\n setIsAuthenticated(true);\n } else {\n clearTokens();\n dropSession();\n // Kiosk/shared-browser hygiene: ending the session must not hand the\n // next visitor the previous member's cart + promo (audit cart.ts:4).\n // Done HERE — not in dropSession — so an explicit logout or definitive\n // auth rejection wipes them, while an out-of-band token expiry in the\n // middle of an active shopper's visit leaves their cart alone.\n // Deliberately NOT userId-namespaced: the cart is populated anonymously\n // pre-signup and must survive the anonymous→signup transition.\n cartStore.clear();\n cartStore.setPromo(null);\n }\n }\n\n // The transport clears tokens out-of-band (refresh failure, post-refresh\n // 401). Without this subscription isAuthenticated() stayed true and the\n // chrome kept rendering an authenticated shell whose every request 401s\n // until a hard reload (audit auth.ts:26).\n onTokensCleared('patient', dropSession);\n\n // Cross-tab convergence: logout (or login) in another tab updates shared\n // localStorage but fires no event in-store — converge on the peer's state.\n // The `storage` event never fires in the acting tab, which is why the\n // same-tab path above is a separate, direct subscription.\n if (typeof window !== 'undefined') {\n window.addEventListener('storage', (e) => {\n let key: string;\n try {\n key = authStorageKey();\n } catch {\n return; // not configured yet — nothing to converge on\n }\n if (e.key !== null && e.key !== key) return; // null key = storage.clear()\n const stored = getTokens();\n if (stored?.accessToken) {\n const wasAuthenticated = isAuthenticated();\n batch(() => {\n _setTokens(stored);\n setIsAuthenticated(true);\n });\n if (!wasAuthenticated) void fetchProfile();\n } else {\n dropSession();\n }\n });\n }\n\n async function fetchProfile() {\n try {\n const res = await usersApi.getProfile();\n if (res.data) {\n setUser(res.data);\n }\n } catch (err) {\n // Only a definitive auth rejection ends the session. The transport has\n // already refreshed-and-retried before a 401 reaches here (and cleared\n // the stored tokens itself); a transient 5xx / network blip during a\n // reload must NOT destroy a valid refresh token and force-log-out a\n // returning member (audit auth.ts:46). The profile simply stays\n // unhydrated and can be fetched again later.\n if (err instanceof ApiError && (err.status === 401 || err.status === 403)) {\n syncTokens(null);\n }\n }\n }\n\n // ── Initialize ──────────────────────────────────────────────────\n\n // Hydrate from token storage AFTER `configure()` runs. The store is a\n // singleton created at import time (see `createRoot` below), which is before\n // the host site calls `configure()`; reading `getTokens()` then would route\n // through `getConfig()` and throw, leaving a returning member rendered\n // logged-out until their first live API call. `onConfigured` defers this.\n let hydrated = false;\n function hydrate() {\n if (hydrated) return;\n hydrated = true;\n const stored = getTokens();\n if (stored?.accessToken) {\n _setTokens(stored);\n setIsAuthenticated(true);\n // Fire-and-forget profile hydration\n fetchProfile();\n }\n }\n onConfigured(hydrate);\n\n // ── Public API ──────────────────────────────────────────────────\n\n async function login(email: string, password: string) {\n setLoading(true);\n try {\n const res = await authApi.login({ email, password });\n if (res.data) {\n syncTokens({\n accessToken: res.data.accessToken,\n refreshToken: res.data.refreshToken,\n userId: res.data.userId,\n });\n // Backend login doesn't return full user profile — fetch it\n await fetchProfile();\n }\n } finally {\n setLoading(false);\n }\n }\n\n async function signup(payload: RegisterPayload) {\n setLoading(true);\n try {\n const res = await authApi.register(payload);\n if (res.data) {\n syncTokens({\n accessToken: res.data.accessToken,\n refreshToken: res.data.refreshToken,\n userId: res.data.userId,\n });\n await fetchProfile();\n }\n } finally {\n setLoading(false);\n }\n }\n\n async function signupAndSubscribe(\n payload: RegisterAndSubscribePayload,\n opts?: { idempotencyKey?: string },\n ) {\n setLoading(true);\n try {\n const res = await authApi.registerAndSubscribe(payload, opts);\n if (res.data) {\n syncTokens({\n accessToken: res.data.accessToken,\n refreshToken: res.data.refreshToken,\n userId: res.data.userId,\n });\n await fetchProfile();\n return res.data;\n }\n } finally {\n setLoading(false);\n }\n }\n\n function logout() {\n syncTokens(null);\n }\n\n return {\n // Reactive getters\n tokens,\n user,\n isAuthenticated,\n isAdmin,\n loading,\n // Actions\n login,\n signup,\n signupAndSubscribe,\n logout,\n fetchProfile,\n };\n}\n\n// Singleton store created inside a reactive root\nconst authStore = createRoot(createAuthStore);\nexport default authStore;\n","import { createSignal, createRoot, batch } from 'solid-js';\nimport { onConfigured } from '../config';\nimport {\n affiliatePortalApi,\n getAffiliateTokens,\n setAffiliateTokens,\n clearAffiliateTokens,\n ApiError,\n onTokensCleared,\n affiliateAuthStorageKey,\n type Affiliate,\n type AffiliateAuthTokens,\n type AffiliateRegisterInput,\n} from '../api/client';\n\nfunction createAffiliateAuthStore() {\n const [tokens, _setTokens] = createSignal<AffiliateAuthTokens | null>(null);\n const [affiliate, setAffiliate] = createSignal<Affiliate | null>(null);\n const [isAuthenticated, setIsAuthenticated] = createSignal(false);\n const [isHydrated, setIsHydrated] = createSignal(false);\n const [loading, setLoading] = createSignal(false);\n\n /** Reset in-memory session signals WITHOUT touching token storage (see\n * stores/auth.ts dropSession — same loop-avoidance rationale). */\n function dropSession() {\n // Batched so a consumer combining these signals can never observe a\n // half-dropped session between flushes (same class of glitch as the\n // patient store's setUser→setIsAdmin admin-gate race).\n batch(() => {\n _setTokens(null);\n setIsAuthenticated(false);\n setAffiliate(null);\n });\n }\n\n function syncTokens(t: AffiliateAuthTokens | null) {\n _setTokens(t);\n if (t) {\n setAffiliateTokens(t);\n setIsAuthenticated(true);\n } else {\n clearAffiliateTokens();\n dropSession();\n }\n }\n\n // Same-tab: the transport's refresh-failure path clears affiliate tokens\n // out-of-band — flip the store immediately instead of rendering a stuck\n // authenticated-but-empty portal until a manual reload (audit client.ts:1682).\n onTokensCleared('affiliate', dropSession);\n\n // Cross-tab: converge on a peer tab's logout/login (audit affiliateAuth.ts:16).\n if (typeof window !== 'undefined') {\n window.addEventListener('storage', (e) => {\n let key: string;\n try {\n key = affiliateAuthStorageKey();\n } catch {\n return; // not configured yet\n }\n if (e.key !== null && e.key !== key) return; // null key = storage.clear()\n const stored = getAffiliateTokens();\n if (stored?.accessToken) {\n const wasAuthenticated = isAuthenticated();\n _setTokens(stored);\n setIsAuthenticated(true);\n if (!wasAuthenticated) void fetchProfile();\n } else {\n dropSession();\n }\n });\n }\n\n async function fetchProfile() {\n try {\n const res = await affiliatePortalApi.getProfile();\n setAffiliate(res.affiliate);\n } catch (err) {\n // Clear only on a definitive auth rejection (the transport has already\n // refreshed-and-retried before a 401 surfaces here). A transient\n // 5xx/network blip during hydration or right after login() must not\n // erase a valid refresh token — that logged out every affiliate loading\n // the app during a backend hiccup, and made login() resolve into an\n // instantly-dead session (audit affiliateAuth.ts:43 + :59). On a\n // transient failure the session stands; the profile stays null and can\n // be re-fetched.\n if (err instanceof ApiError && (err.status === 401 || err.status === 403)) {\n syncTokens(null);\n }\n } finally {\n setIsHydrated(true);\n }\n }\n\n // Hydrate from token storage after `configure()` (see stores/auth.ts for the\n // boot-ordering rationale). fetchProfile() flips isHydrated in its finally;\n // the no-session branch flips it here.\n let hydrated = false;\n function hydrate() {\n if (hydrated) return;\n hydrated = true;\n const stored = getAffiliateTokens();\n if (stored?.accessToken) {\n _setTokens(stored);\n setIsAuthenticated(true);\n fetchProfile();\n } else {\n setIsHydrated(true);\n }\n }\n onConfigured(hydrate);\n\n async function login(email: string, password: string) {\n setLoading(true);\n try {\n const session = await affiliatePortalApi.login(email, password);\n syncTokens({\n accessToken: session.idToken,\n refreshToken: session.refreshToken,\n affiliateId: session.affiliateId,\n });\n setIsHydrated(false);\n await fetchProfile();\n } finally {\n setLoading(false);\n }\n }\n\n async function register(input: AffiliateRegisterInput) {\n setLoading(true);\n try {\n await affiliatePortalApi.register(input);\n // Backend register does NOT return tokens — new affiliates start as\n // 'pending' and must be approved by an admin before they can log in.\n // We surface the affiliate ID via the resolved promise so the page\n // can show a \"pending approval\" success state without logging in.\n } finally {\n setLoading(false);\n }\n }\n\n async function logout() {\n try {\n await affiliatePortalApi.logout();\n } finally {\n syncTokens(null);\n }\n }\n\n return {\n tokens,\n affiliate,\n isAuthenticated,\n isHydrated,\n loading,\n login,\n register,\n logout,\n fetchProfile,\n };\n}\n\nconst affiliateAuthStore = createRoot(createAffiliateAuthStore);\nexport default affiliateAuthStore;\n","import { createSignal, createRoot } from 'solid-js';\n\nexport interface MedicationSelection {\n drugId: string | null; // null = general consultation\n drugName: string;\n}\n\nfunction createMedicationStore() {\n const [selected, setSelected] = createSignal<MedicationSelection | null>(null);\n\n function select(medication: MedicationSelection) {\n setSelected(medication);\n }\n\n function clear() {\n setSelected(null);\n }\n\n return { selected, select, clear };\n}\n\nconst medicationStore = createRoot(createMedicationStore);\nexport default medicationStore;\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/stores/cart.ts","../../src/stores/auth.ts","../../src/stores/affiliateAuth.ts","../../src/stores/medication.ts"],"names":["createSignal","createRoot","batch"],"mappings":";;;;AAGA,IAAM,cAAA,GAAiB,MAAM,CAAA,EAAG,SAAA,GAAY,aAAa,CAAA,KAAA,CAAA;AACzD,IAAM,eAAA,GAAkB,MAAM,CAAA,EAAG,SAAA,GAAY,aAAa,CAAA,WAAA,CAAA;AA4C1D,SAAS,OAAA,CAAQ,WAAmB,MAAA,EAAwB;AAC1D,EAAA,OAAO,CAAA,EAAG,SAAS,CAAA,EAAA,EAAK,MAAM,CAAA,CAAA;AAChC;AAEA,SAAS,WAAA,GAA0B;AACjC,EAAA,IAAI;AACF,IAAA,MAAM,GAAA,GAAM,YAAA,CAAa,OAAA,CAAQ,cAAA,EAAgB,CAAA;AACjD,IAAA,IAAI,CAAC,GAAA,EAAK,OAAO,EAAC;AAClB,IAAA,MAAM,MAAA,GAAS,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA;AAC7B,IAAA,IAAI,CAAC,KAAA,CAAM,OAAA,CAAQ,MAAM,CAAA,SAAU,EAAC;AAGpC,IAAA,OAAO,MAAA,CAAO,GAAA,CAAI,CAAC,CAAA,MAAiB;AAAA,MAClC,GAAG,CAAA;AAAA,MACH,QAAA,EAAU,MAAA,CAAO,SAAA,CAAU,CAAA,CAAE,QAAQ,KAAK,CAAA,CAAE,QAAA,GAAW,CAAA,GAAI,CAAA,CAAE,QAAA,GAAW;AAAA,KAC1E,CAAE,CAAA;AAAA,EACJ,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,EAAC;AAAA,EACV;AACF;AAEA,SAAS,gBAAA,GAA4C;AACnD,EAAA,IAAI;AACF,IAAA,MAAM,GAAA,GAAM,YAAA,CA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UAAA,CAAW,IAAI,CAAA;AACf,IAAA,IAAI;AACF,MAAA,MAAM,kBAAA,CAAmB,SAAS,KAAK,CAAA;AAAA,IAKzC,CAAA,SAAE;AACA,MAAA,UAAA,CAAW,KAAK,CAAA;AAAA,IAClB;AAAA,EACF;AAEA,EAAA,eAAe,MAAA,GAAS;AACtB,IAAA,IAAI;AACF,MAAA,MAAM,mBAAmB,MAAA,EAAO;AAAA,IAClC,CAAA,SAAE;AACA,MAAA,UAAA,CAAW,IAAI,CAAA;AAAA,IACjB;AAAA,EACF;AAEA,EAAA,OAAO;AAAA,IACL,MAAA;AAAA,IACA,SAAA;AAAA,IACA,eAAA;AAAA,IACA,UAAA;AAAA,IACA,OAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA;AAAA,IACA;AAAA,GACF;AACF;AAEA,IAAM,kBAAA,GAAqBD,WAAW,wBAAwB,CAAA;AAC9D,IAAO,qBAAA,GAAQ;AC5Jf,SAAS,qBAAA,GAAwB;AAC/B,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAID,aAAyC,IAAI,CAAA;AAE7E,EAAA,SAAS,OAAO,UAAA,EAAiC;AAC/C,IAAA,WAAA,CAAY,UAAU,CAAA;AAAA,EACxB;AAEA,EAAA,SAAS,KAAA,GAAQ;AACf,IAAA,WAAA,CAAY,IAAI,CAAA;AAAA,EAClB;AAEA,EAAA,OAAO,EAAE,QAAA,EAAU,MAAA,EAAQ,KAAA,EAAM;AACnC;AAEA,IAAM,eAAA,GAAkBC,WAAW,qBAAqB,CAAA;AACxD,IAAO,kBAAA,GAAQ","file":"Y2VD7NYA.js","sourcesContent":["import { createSignal, createRoot } from 'solid-js';\nimport { getConfig } from '../config';\n\nconst cartStorageKey = () => `${getConfig().storagePrefix}-cart`;\nconst promoStorageKey = () => `${getConfig().storagePrefix}-cart-promo`;\n\nexport interface CartItem {\n productId: string;\n productName: string;\n dosage: string;\n /** Dose redesign (Phase 8): optional patient-requested intake hints, mirroring\n * Apex intake — `requestedSku` is the binding patient-bought SKU,\n * `requestedClinicalDose` is the advisory dose. Default undefined; carried\n * through to the /apex/requests medications payload. Nothing sets these yet. */\n requestedSku?: string;\n /** SKU identity S4: the stable, opaque `skus[].id` form of `requestedSku`\n * (from Apex's /v1/drugs catalog). Preferred over the label — survives a\n * relabel. Additive; carried through to the medications payload. */\n requestedSkuId?: string;\n requestedClinicalDose?: { value: number; unit: string };\n quantity: number;\n priceCents: number;\n drugId: string | null;\n /** The linked Apex drug id, copied from the catalog product. Matches the id\n * the survey qualification verdict (`drugResults[].drugId`) is keyed on, so\n * request creation can gate out drugs the survey marked ineligible. Null/\n * undefined for non-Apex products or carts saved before this field existed. */\n apexDrugId?: string | null;\n categories: string[];\n thumbnailUrl?: string;\n /** True when the product uses flat_fee pricing. The dosage is still set\n * (Apex needs it for the prescription) but consumer cart drawers should\n * skip rendering the dose suffix. */\n hideDoseLabel?: boolean;\n /** Copied from the catalog's `is_subscription` at add-time. The one-time\n * checkout flow excludes subscription items (the backend 400s a\n * /payments/checkout containing one, and stays the authority). Undefined —\n * legacy persisted carts, non-catalog adds — is treated as one-time-purchasable. */\n isSubscription?: boolean;\n}\n\nexport interface AppliedPromoCode {\n code: string;\n discountType: 'percent' | 'fixed';\n discountValueCents: number;\n discountCents: number;\n}\n\nfunction itemKey(productId: string, dosage: string): string {\n return `${productId}::${dosage}`;\n}\n\nfunction loadInitial(): CartItem[] {\n try {\n const raw = localStorage.getItem(cartStorageKey());\n if (!raw) return [];\n const parsed = JSON.parse(raw);\n if (!Array.isArray(parsed)) return [];\n // Preserve a sane persisted quantity (set via setQuantity); anything else\n // — legacy carts, tampered storage — normalizes back to 1.\n return parsed.map((i: CartItem) => ({\n ...i,\n quantity: Number.isInteger(i.quantity) && i.quantity > 0 ? i.quantity : 1,\n }));\n } catch {\n return [];\n }\n}\n\nfunction loadInitialPromo(): AppliedPromoCode | null {\n try {\n const raw = localStorage.getItem(promoStorageKey());\n if (!raw) return null;\n return JSON.parse(raw) as AppliedPromoCode;\n } catch {\n return null;\n }\n}\n\nfunction persist(items: CartItem[]) {\n try {\n localStorage.setItem(cartStorageKey(), JSON.stringify(items));\n } catch {\n // noop\n }\n}\n\nfunction persistPromo(promo: AppliedPromoCode | null) {\n try {\n if (promo) localStorage.setItem(promoStorageKey(), JSON.stringify(promo));\n else localStorage.removeItem(promoStorageKey());\n } catch {\n // noop\n }\n}\n\nfunction createCartStore() {\n const [items, setItems] = createSignal<CartItem[]>(loadInitial());\n const [isOpen, setIsOpen] = createSignal(false);\n const [appliedPromo, setAppliedPromo] = createSignal<AppliedPromoCode | null>(loadInitialPromo());\n\n function write(next: CartItem[]) {\n setItems(next);\n persist(next);\n }\n\n function count() {\n return items().length;\n }\n\n function subtotalCents() {\n return items().reduce((sum, i) => sum + i.priceCents * (i.quantity || 1), 0);\n }\n\n function add(item: CartItem) {\n const key = itemKey(item.productId, item.dosage);\n const current = items();\n if (current.some(i => itemKey(i.productId, i.dosage) === key)) return;\n write([...current, { ...item, quantity: 1 }]);\n }\n\n function remove(key: string) {\n write(items().filter(i => itemKey(i.productId, i.dosage) !== key));\n }\n\n /** Set an item's quantity (floored, clamped to ≥1 — removing is `remove`'s\n * job). Non-finite input and unknown keys are ignored. `add` still starts\n * every item at 1; this is the only quantity mutator. */\n function setQuantity(key: string, quantity: number) {\n if (!Number.isFinite(quantity)) return;\n const clamped = Math.max(1, Math.floor(quantity));\n const current = items();\n if (!current.some(i => itemKey(i.productId, i.dosage) === key)) return;\n write(current.map(i => (itemKey(i.productId, i.dosage) === key ? { ...i, quantity: clamped } : i)));\n }\n\n /**\n * Replace the whole cart in one write. For catalog reconciliation\n * (`flows/cartReconcile`), which drops lines the catalog no longer offers and\n * refreshes the snapshots of the ones it does — neither expressible as\n * add/remove, and both must land as a single persist so a half-written cart\n * can never be read back. Quantities are taken as given (unlike `add`, which\n * always starts at 1).\n */\n function replace(next: CartItem[]) {\n write(next);\n }\n\n function clear() {\n // Preserve the applied promo across cart resets — the survey submission\n // clears the cart but the customer still expects the code they entered to\n // apply to subsequent prescription purchases. Removing the promo is an\n // explicit action via the cart drawer's \"remove\" link.\n write([]);\n }\n\n function hasGlp1() {\n return items().some(i =>\n i.categories.some(c => c.toLowerCase().includes('weight') || c.toLowerCase().includes('glp')),\n );\n }\n\n function isMultiItem() {\n return items().length > 1;\n }\n\n function setPromo(promo: AppliedPromoCode | null) {\n setAppliedPromo(promo);\n persistPromo(promo);\n }\n\n return {\n items,\n count,\n subtotalCents,\n add,\n remove,\n setQuantity,\n replace,\n clear,\n hasGlp1,\n isMultiItem,\n itemKey,\n isOpen,\n open: () => setIsOpen(true),\n close: () => setIsOpen(false),\n toggle: () => setIsOpen(v => !v),\n appliedPromo,\n setPromo,\n };\n}\n\nconst cartStore = createRoot(createCartStore);\nexport default cartStore;\n","import { createSignal, createMemo, createRoot, batch } from 'solid-js';\nimport { onConfigured } from '../config';\nimport {\n authApi,\n getTokens,\n setTokens,\n clearTokens,\n usersApi,\n ApiError,\n onTokensCleared,\n authStorageKey,\n type User,\n type AuthTokens,\n type RegisterPayload,\n type RegisterAndSubscribePayload,\n} from '../api/client';\nimport cartStore from './cart';\n\nfunction createAuthStore() {\n // ── Signals ─────────────────────────────────────────────────────\n\n const [tokens, _setTokens] = createSignal<AuthTokens | null>(null);\n const [user, setUser] = createSignal<User | null>(null);\n const [isAuthenticated, setIsAuthenticated] = createSignal(false);\n const [loading, setLoading] = createSignal(false);\n\n // Derived, not a second signal: admin-ness must never be observable out of\n // step with the user it describes. As separate writes, Solid flushed\n // dependents between setUser and setIsAdmin, so an admin gate combining\n // \"hydrated\" (user() !== null) with isAdmin() saw \"hydrated but not admin\"\n // for one tick on every hard load of /admin and bounced to the fallback\n // route.\n const isAdmin = createMemo(() => user()?.role === 'admin');\n\n // ── Internal helpers ────────────────────────────────────────────\n\n /** Reset the in-memory session signals WITHOUT touching token storage.\n * Used by the token-cleared/storage listeners, where storage is already\n * gone (writing it back would re-notify and loop). */\n function dropSession() {\n batch(() => {\n _setTokens(null);\n setIsAuthenticated(false);\n setUser(null);\n });\n }\n\n function syncTokens(t: AuthTokens | null) {\n _setTokens(t);\n if (t) {\n setTokens(t);\n setIsAuthenticated(true);\n } else {\n clearTokens();\n dropSession();\n // Kiosk/shared-browser hygiene: ending the session must not hand the\n // next visitor the previous member's cart + promo (audit cart.ts:4).\n // Done HERE — not in dropSession — so an explicit logout or definitive\n // auth rejection wipes them, while an out-of-band token expiry in the\n // middle of an active shopper's visit leaves their cart alone.\n // Deliberately NOT userId-namespaced: the cart is populated anonymously\n // pre-signup and must survive the anonymous→signup transition.\n cartStore.clear();\n cartStore.setPromo(null);\n }\n }\n\n // The transport clears tokens out-of-band (refresh failure, post-refresh\n // 401). Without this subscription isAuthenticated() stayed true and the\n // chrome kept rendering an authenticated shell whose every request 401s\n // until a hard reload (audit auth.ts:26).\n onTokensCleared('patient', dropSession);\n\n // Cross-tab convergence: logout (or login) in another tab updates shared\n // localStorage but fires no event in-store — converge on the peer's state.\n // The `storage` event never fires in the acting tab, which is why the\n // same-tab path above is a separate, direct subscription.\n if (typeof window !== 'undefined') {\n window.addEventListener('storage', (e) => {\n let key: string;\n try {\n key = authStorageKey();\n } catch {\n return; // not configured yet — nothing to converge on\n }\n if (e.key !== null && e.key !== key) return; // null key = storage.clear()\n const stored = getTokens();\n if (stored?.accessToken) {\n const wasAuthenticated = isAuthenticated();\n batch(() => {\n _setTokens(stored);\n setIsAuthenticated(true);\n });\n if (!wasAuthenticated) void fetchProfile();\n } else {\n dropSession();\n }\n });\n }\n\n async function fetchProfile() {\n try {\n const res = await usersApi.getProfile();\n if (res.data) {\n setUser(res.data);\n }\n } catch (err) {\n // Only a definitive auth rejection ends the session. The transport has\n // already refreshed-and-retried before a 401 reaches here (and cleared\n // the stored tokens itself); a transient 5xx / network blip during a\n // reload must NOT destroy a valid refresh token and force-log-out a\n // returning member (audit auth.ts:46). The profile simply stays\n // unhydrated and can be fetched again later.\n if (err instanceof ApiError && (err.status === 401 || err.status === 403)) {\n syncTokens(null);\n }\n }\n }\n\n // ── Initialize ──────────────────────────────────────────────────\n\n // Hydrate from token storage AFTER `configure()` runs. The store is a\n // singleton created at import time (see `createRoot` below), which is before\n // the host site calls `configure()`; reading `getTokens()` then would route\n // through `getConfig()` and throw, leaving a returning member rendered\n // logged-out until their first live API call. `onConfigured` defers this.\n let hydrated = false;\n function hydrate() {\n if (hydrated) return;\n hydrated = true;\n const stored = getTokens();\n if (stored?.accessToken) {\n _setTokens(stored);\n setIsAuthenticated(true);\n // Fire-and-forget profile hydration\n fetchProfile();\n }\n }\n onConfigured(hydrate);\n\n // ── Public API ──────────────────────────────────────────────────\n\n async function login(email: string, password: string) {\n setLoading(true);\n try {\n const res = await authApi.login({ email, password });\n if (res.data) {\n syncTokens({\n accessToken: res.data.accessToken,\n refreshToken: res.data.refreshToken,\n userId: res.data.userId,\n });\n // Backend login doesn't return full user profile — fetch it\n await fetchProfile();\n }\n } finally {\n setLoading(false);\n }\n }\n\n async function signup(payload: RegisterPayload) {\n setLoading(true);\n try {\n const res = await authApi.register(payload);\n if (res.data) {\n syncTokens({\n accessToken: res.data.accessToken,\n refreshToken: res.data.refreshToken,\n userId: res.data.userId,\n });\n await fetchProfile();\n }\n } finally {\n setLoading(false);\n }\n }\n\n async function signupAndSubscribe(\n payload: RegisterAndSubscribePayload,\n opts?: { idempotencyKey?: string },\n ) {\n setLoading(true);\n try {\n const res = await authApi.registerAndSubscribe(payload, opts);\n if (res.data) {\n syncTokens({\n accessToken: res.data.accessToken,\n refreshToken: res.data.refreshToken,\n userId: res.data.userId,\n });\n await fetchProfile();\n return res.data;\n }\n } finally {\n setLoading(false);\n }\n }\n\n function logout() {\n syncTokens(null);\n }\n\n return {\n // Reactive getters\n tokens,\n user,\n isAuthenticated,\n isAdmin,\n loading,\n // Actions\n login,\n signup,\n signupAndSubscribe,\n logout,\n fetchProfile,\n };\n}\n\n// Singleton store created inside a reactive root\nconst authStore = createRoot(createAuthStore);\nexport default authStore;\n","import { createSignal, createRoot, batch } from 'solid-js';\nimport { onConfigured } from '../config';\nimport {\n affiliatePortalApi,\n getAffiliateTokens,\n setAffiliateTokens,\n clearAffiliateTokens,\n ApiError,\n onTokensCleared,\n affiliateAuthStorageKey,\n type Affiliate,\n type AffiliateAuthTokens,\n type AffiliateRegisterInput,\n} from '../api/client';\n\nfunction createAffiliateAuthStore() {\n const [tokens, _setTokens] = createSignal<AffiliateAuthTokens | null>(null);\n const [affiliate, setAffiliate] = createSignal<Affiliate | null>(null);\n const [isAuthenticated, setIsAuthenticated] = createSignal(false);\n const [isHydrated, setIsHydrated] = createSignal(false);\n const [loading, setLoading] = createSignal(false);\n\n /** Reset in-memory session signals WITHOUT touching token storage (see\n * stores/auth.ts dropSession — same loop-avoidance rationale). */\n function dropSession() {\n // Batched so a consumer combining these signals can never observe a\n // half-dropped session between flushes (same class of glitch as the\n // patient store's setUser→setIsAdmin admin-gate race).\n batch(() => {\n _setTokens(null);\n setIsAuthenticated(false);\n setAffiliate(null);\n });\n }\n\n function syncTokens(t: AffiliateAuthTokens | null) {\n _setTokens(t);\n if (t) {\n setAffiliateTokens(t);\n setIsAuthenticated(true);\n } else {\n clearAffiliateTokens();\n dropSession();\n }\n }\n\n // Same-tab: the transport's refresh-failure path clears affiliate tokens\n // out-of-band — flip the store immediately instead of rendering a stuck\n // authenticated-but-empty portal until a manual reload (audit client.ts:1682).\n onTokensCleared('affiliate', dropSession);\n\n // Cross-tab: converge on a peer tab's logout/login (audit affiliateAuth.ts:16).\n if (typeof window !== 'undefined') {\n window.addEventListener('storage', (e) => {\n let key: string;\n try {\n key = affiliateAuthStorageKey();\n } catch {\n return; // not configured yet\n }\n if (e.key !== null && e.key !== key) return; // null key = storage.clear()\n const stored = getAffiliateTokens();\n if (stored?.accessToken) {\n const wasAuthenticated = isAuthenticated();\n _setTokens(stored);\n setIsAuthenticated(true);\n if (!wasAuthenticated) void fetchProfile();\n } else {\n dropSession();\n }\n });\n }\n\n async function fetchProfile() {\n try {\n const res = await affiliatePortalApi.getProfile();\n setAffiliate(res.affiliate);\n } catch (err) {\n // Clear only on a definitive auth rejection (the transport has already\n // refreshed-and-retried before a 401 surfaces here). A transient\n // 5xx/network blip during hydration or right after login() must not\n // erase a valid refresh token — that logged out every affiliate loading\n // the app during a backend hiccup, and made login() resolve into an\n // instantly-dead session (audit affiliateAuth.ts:43 + :59). On a\n // transient failure the session stands; the profile stays null and can\n // be re-fetched.\n if (err instanceof ApiError && (err.status === 401 || err.status === 403)) {\n syncTokens(null);\n }\n } finally {\n setIsHydrated(true);\n }\n }\n\n // Hydrate from token storage after `configure()` (see stores/auth.ts for the\n // boot-ordering rationale). fetchProfile() flips isHydrated in its finally;\n // the no-session branch flips it here.\n let hydrated = false;\n function hydrate() {\n if (hydrated) return;\n hydrated = true;\n const stored = getAffiliateTokens();\n if (stored?.accessToken) {\n _setTokens(stored);\n setIsAuthenticated(true);\n fetchProfile();\n } else {\n setIsHydrated(true);\n }\n }\n onConfigured(hydrate);\n\n async function login(email: string, password: string) {\n setLoading(true);\n try {\n const session = await affiliatePortalApi.login(email, password);\n syncTokens({\n accessToken: session.idToken,\n refreshToken: session.refreshToken,\n affiliateId: session.affiliateId,\n });\n setIsHydrated(false);\n await fetchProfile();\n } finally {\n setLoading(false);\n }\n }\n\n async function register(input: AffiliateRegisterInput) {\n setLoading(true);\n try {\n await affiliatePortalApi.register(input);\n // Backend register does NOT return tokens — new affiliates start as\n // 'pending' and must be approved by an admin before they can log in.\n // We surface the affiliate ID via the resolved promise so the page\n // can show a \"pending approval\" success state without logging in.\n } finally {\n setLoading(false);\n }\n }\n\n async function logout() {\n try {\n await affiliatePortalApi.logout();\n } finally {\n syncTokens(null);\n }\n }\n\n return {\n tokens,\n affiliate,\n isAuthenticated,\n isHydrated,\n loading,\n login,\n register,\n logout,\n fetchProfile,\n };\n}\n\nconst affiliateAuthStore = createRoot(createAffiliateAuthStore);\nexport default affiliateAuthStore;\n","import { createSignal, createRoot } from 'solid-js';\n\nexport interface MedicationSelection {\n drugId: string | null; // null = general consultation\n drugName: string;\n}\n\nfunction createMedicationStore() {\n const [selected, setSelected] = createSignal<MedicationSelection | null>(null);\n\n function select(medication: MedicationSelection) {\n setSelected(medication);\n }\n\n function clear() {\n setSelected(null);\n }\n\n return { selected, select, clear };\n}\n\nconst medicationStore = createRoot(createMedicationStore);\nexport default medicationStore;\n"]}
|
|
@@ -178,18 +178,30 @@ interface UpdatePaymentMethodPayload {
|
|
|
178
178
|
zip?: string;
|
|
179
179
|
};
|
|
180
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* An email's editable copy. `body` is HTML limited to what the backend's
|
|
183
|
+
* sanitizer keeps: `<p>`, `<h2>`, `<ul>`/`<ol>`/`<li>`, `<strong>`, `<em>`,
|
|
184
|
+
* `<u>`, `<br>`, `<a href>`, and a top-level `<a data-button href>` button.
|
|
185
|
+
* Placeholders are literal `{{name}}` text, or lead an `href`.
|
|
186
|
+
*/
|
|
181
187
|
interface TemplateText {
|
|
182
188
|
subject: string;
|
|
183
|
-
|
|
184
|
-
bodyParagraphs: string[];
|
|
185
|
-
closingText: string;
|
|
189
|
+
body: string;
|
|
186
190
|
}
|
|
187
191
|
interface EmailTemplatesMap {
|
|
188
192
|
[key: string]: TemplateText;
|
|
189
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* How a placeholder's value may be used. `text`: a plain value. `url`: a bare
|
|
196
|
+
* URL, meant as the target of a link or button. `html`: a ready-made link
|
|
197
|
+
* whose wording the backend fixes (e.g. `{{unsubscribeLink}}`).
|
|
198
|
+
*/
|
|
199
|
+
type PlaceholderKind = 'text' | 'url' | 'html';
|
|
190
200
|
interface Placeholder {
|
|
201
|
+
/** Including the braces: `{{firstName}}`. */
|
|
191
202
|
token: string;
|
|
192
203
|
description: string;
|
|
204
|
+
kind: PlaceholderKind;
|
|
193
205
|
}
|
|
194
206
|
/** Per-template placeholder tokens, keyed by template key. */
|
|
195
207
|
interface TemplatePlaceholdersMap {
|
|
@@ -221,6 +233,28 @@ interface EmailNotificationSettings {
|
|
|
221
233
|
/** Keyed by template key; the backend returns every event it knows. */
|
|
222
234
|
enabledEvents: Record<string, boolean>;
|
|
223
235
|
}
|
|
236
|
+
/** `self_serve`: the admin switches it. `request`: the platform team turns it on when asked. */
|
|
237
|
+
type TenantFeatureAccess = 'self_serve' | 'request';
|
|
238
|
+
/** One optional feature of the tenant, as the backend describes it. */
|
|
239
|
+
interface TenantFeature {
|
|
240
|
+
key: string;
|
|
241
|
+
label: string;
|
|
242
|
+
description: string;
|
|
243
|
+
access: TenantFeatureAccess;
|
|
244
|
+
enabled: boolean;
|
|
245
|
+
/** Self-serve only: the feature that has to be on before this one can be. */
|
|
246
|
+
requires?: {
|
|
247
|
+
key: string;
|
|
248
|
+
label: string;
|
|
249
|
+
enabled: boolean;
|
|
250
|
+
};
|
|
251
|
+
/** Request only: present while an ask is pending. */
|
|
252
|
+
request?: {
|
|
253
|
+
requestedAt: string;
|
|
254
|
+
requestedBy: string;
|
|
255
|
+
note?: string;
|
|
256
|
+
};
|
|
257
|
+
}
|
|
224
258
|
interface BillingReminderSettings {
|
|
225
259
|
renewalReminder: {
|
|
226
260
|
enabled: boolean;
|
|
@@ -1537,7 +1571,7 @@ declare const adminApi: {
|
|
|
1537
1571
|
}>;
|
|
1538
1572
|
getEmailTemplates(): Promise<{
|
|
1539
1573
|
templates: EmailTemplatesMap;
|
|
1540
|
-
placeholders
|
|
1574
|
+
placeholders: TemplatePlaceholdersMap;
|
|
1541
1575
|
customTemplates: CustomTemplate[];
|
|
1542
1576
|
/** Tokens every custom template may use (rendered through the sequence mailer). */
|
|
1543
1577
|
customPlaceholders: Placeholder[];
|
|
@@ -1564,6 +1598,20 @@ declare const adminApi: {
|
|
|
1564
1598
|
sentTo?: string;
|
|
1565
1599
|
error?: string;
|
|
1566
1600
|
}>;
|
|
1601
|
+
/** Every optional feature of this tenant, with its state and any pending request. */
|
|
1602
|
+
getFeatures(): Promise<{
|
|
1603
|
+
features: TenantFeature[];
|
|
1604
|
+
}>;
|
|
1605
|
+
/** Switch a self-serve feature. Returns the whole list: dependents can change with it. */
|
|
1606
|
+
setFeature(key: string, enabled: boolean): Promise<{
|
|
1607
|
+
features: TenantFeature[];
|
|
1608
|
+
}>;
|
|
1609
|
+
/** Ask the platform team to turn a feature on. `emailed` is false when the ask was saved but no email went out. */
|
|
1610
|
+
requestFeature(key: string, note?: string): Promise<{
|
|
1611
|
+
feature: TenantFeature;
|
|
1612
|
+
emailed: boolean;
|
|
1613
|
+
alreadyRequested: boolean;
|
|
1614
|
+
}>;
|
|
1567
1615
|
getEmailNotifications(): Promise<EmailNotificationSettings>;
|
|
1568
1616
|
saveEmailNotifications(settings: EmailNotificationSettings): Promise<{
|
|
1569
1617
|
success: boolean;
|
|
@@ -2082,4 +2130,4 @@ declare const affiliatePortalApi: {
|
|
|
2082
2130
|
track(refCode: string, landingPage?: string): Promise<AffiliateTrackResponse>;
|
|
2083
2131
|
};
|
|
2084
2132
|
|
|
2085
|
-
export { type AffiliateTrackResponse as $, type AddressVerifyResult as A, type AdminSale as B, type AdminSaleInput as C, type AdminSubscription as D, type AdminSubscriptionDetail as E, type AdminSubscriptionPatch as F, type AdminSubscriptionWriteResult as G, type AdminSupportCustomer as H, type AdminSupportStats as I, type AdminSupportThread as J, type AdminWebhookEvent as K, type Affiliate as L, type AffiliateAuthTokens as M, type AffiliateClickRecord as N, type AffiliateConversion as O, type AffiliateDashboardLinks as P, type AffiliateDashboardProfile as Q, type AffiliateDashboardStats as R, type AffiliateDownlineMember as S, type AffiliateEarningsBreakdown as T, type AffiliatePaymentMethod as U, type AffiliateProgram as V, type AffiliateRegisterInput as W, type AffiliateRegisterResponse as X, type AffiliateSession as Y, type AffiliateStatsResponse as Z, type AffiliateStatus as _, type AdminApexDrug as a, type
|
|
2133
|
+
export { type AffiliateTrackResponse as $, type AddressVerifyResult as A, type AdminSale as B, type AdminSaleInput as C, type AdminSubscription as D, type AdminSubscriptionDetail as E, type AdminSubscriptionPatch as F, type AdminSubscriptionWriteResult as G, type AdminSupportCustomer as H, type AdminSupportStats as I, type AdminSupportThread as J, type AdminWebhookEvent as K, type Affiliate as L, type AffiliateAuthTokens as M, type AffiliateClickRecord as N, type AffiliateConversion as O, type AffiliateDashboardLinks as P, type AffiliateDashboardProfile as Q, type AffiliateDashboardStats as R, type AffiliateDownlineMember as S, type AffiliateEarningsBreakdown as T, type AffiliatePaymentMethod as U, type AffiliateProgram as V, type AffiliateRegisterInput as W, type AffiliateRegisterResponse as X, type AffiliateSession as Y, type AffiliateStatsResponse as Z, type AffiliateStatus as _, type AdminApexDrug as a, type SupportThreadCategory as a$, ApiError as a0, type ApiResponse as a1, type AttributionMethod as a2, type AuthTokens as a3, type BillingReminderSettings as a4, type CatalogAvailabilityItem as a5, type CatalogAvailabilityReason as a6, type CatalogAvailabilityResult as a7, type CatalogProduct as a8, type CategoryMetadata as a9, type Order as aA, type OrderItemInput as aB, type PaginationParams as aC, type PaymentCallbackPayload as aD, type PaymentInitiatePayload as aE, type PaymentType as aF, type PendingRenewalSurvey as aG, type Placeholder as aH, type PlaceholderKind as aI, type ProductSaleSummary as aJ, type PromoValidationResponse as aK, type PublicCategory as aL, type RegisterAndSubscribePayload as aM, type RegisterPayload as aN, type RenewalStatus as aO, SUPPORT_ATTACHMENT_MAX_BYTES as aP, SUPPORT_ATTACHMENT_MIME_TYPES as aQ, type SelectDrugPayload as aR, type SendMessagePayload as aS, type SendToPharmacyPayload as aT, type SubscriptionPreview as aU, type SubscriptionPreviewLine as aV, type SubscriptionPreviewPayload as aW, type SupportAttachment as aX, type SupportMessage as aY, type SupportRealtimeToken as aZ, type SupportThread as a_, type CheckoutAddress as aa, type CheckoutPayload as ab, type CheckoutResult as ac, type CommissionConfig as ad, type CommissionStatus as ae, type CompleteSurveyPayload as af, type CreateAffiliatePayload as ag, type CreateAffiliateProgramPayload as ah, type CreateOrderPayload as ai, type CreateRequestPayload as aj, type CreateSubscriptionPayload as ak, type CustomTemplate as al, type CustomTemplateInput as am, type CustomerDiscountConfig as an, type DeliveryInfo as ao, type DiscountType as ap, type EmailNotificationSettings as aq, type EmailTemplatesMap as ar, type LoginPayload as as, type MemberPrescriptionRequest as at, type MemberSurveyMode as au, type MemberSurveyResponseSummary as av, type MemberSurveyTranscript as aw, type MemberSurveyTranscriptItem as ax, type MemberSurveyTranscriptSection as ay, type MembersMeResponse as az, type AdminBillingAttempt as b, type SupportThreadStatus as b0, type SurveySubmitPayload as b1, type TemplatePlaceholdersMap as b2, type TemplateText as b3, type TenantFeature as b4, type TenantFeatureAccess as b5, type TokenTrackName as b6, type UpdateAffiliatePayload as b7, type UpdateAffiliateProgramPayload as b8, type UpdatePaymentMethodPayload as b9, subscriptionsApi as bA, supportApi as bB, usersApi as bC, type UpdateProfilePayload as ba, type User as bb, addressesApi as bc, adminAffiliatesApi as bd, adminApi as be, affiliateAuthStorageKey as bf, affiliatePortalApi as bg, apexApi as bh, apiFetch as bi, authApi as bj, authStorageKey as bk, catalogApi as bl, clearAffiliateTokens as bm, clearTokens as bn, getAffiliateTokens as bo, getTokens as bp, membersApi as bq, messagesApi as br, newIdempotencyKey as bs, onTokensCleared as bt, ordersApi as bu, paymentsApi as bv, productsApi as bw, promoCodesApi as bx, setAffiliateTokens as by, setTokens as bz, type AdminCategory as c, type AdminCategoryInput as d, type AdminCategoryUpdate as e, type AdminCustomer as f, type AdminCustomerFacts as g, type AdminCustomerFunnel as h, type AdminCustomerListParams as i, type AdminCustomerOverview as j, type AdminCustomerProfile as k, type AdminCustomerRequest as l, type AdminCustomerRow as m, type AdminCustomerSupport as n, type AdminCustomerSupportThread as o, type AdminDashboardStats as p, type AdminLifecycle as q, type AdminLifecycleBucket as r, type AdminListParams as s, type AdminOrderSummary as t, type AdminPayment as u, type AdminPaymentDetail as v, type AdminProduct as w, type AdminPromoCode as x, type AdminPromoCodeInput as y, type AdminRefundResult as z };
|
package/dist/flows/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Accessor, Resource } from 'solid-js';
|
|
2
|
-
import { A as AddressVerifyResult, aa as CheckoutAddress, a7 as CatalogAvailabilityResult,
|
|
2
|
+
import { A as AddressVerifyResult, aa as CheckoutAddress, a7 as CatalogAvailabilityResult, bb as User, ao as DeliveryInfo, aO as RenewalStatus, aG as PendingRenewalSurvey, r as AdminLifecycleBucket, j as AdminCustomerOverview, E as AdminSubscriptionDetail, l as AdminCustomerRequest, a$ as SupportThreadCategory, a8 as CatalogProduct, O as AffiliateConversion, S as AffiliateDownlineMember, P as AffiliateDashboardLinks, R as AffiliateDashboardStats, aK as PromoValidationResponse } from '../client-RY9ghN5Q.js';
|
|
3
3
|
import { C as CartItem } from '../cart-o6DpAu5y.js';
|
|
4
4
|
export { U as UseSurveyV2FlowOptions, u as useSurveyV2Flow } from '../surveyV2-BgQHK0GE.js';
|
|
5
5
|
import { EmbedEvent } from '@apextelemed/survey-solid';
|
|
@@ -1020,11 +1020,6 @@ interface JourneyStep {
|
|
|
1020
1020
|
/** One short line under the label. */
|
|
1021
1021
|
detail: string | null;
|
|
1022
1022
|
}
|
|
1023
|
-
/**
|
|
1024
|
-
* Where the customer is on the account → renewing path. The first non-done
|
|
1025
|
-
* step is where they are; `blocked` says why they cannot move; `unknown`
|
|
1026
|
-
* says the site does not collect that signal. Only one step is `active`.
|
|
1027
|
-
*/
|
|
1028
1023
|
declare function deriveJourney(o: AdminCustomerOverview): JourneyStep[];
|
|
1029
1024
|
/** Adapt an overview request to the member-portal tracker input. */
|
|
1030
1025
|
declare function toTrackerRequest(r: AdminCustomerRequest): TrackerRequest;
|
package/dist/flows/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { restoreCartFromLink, startCartCapture, useSubscriptionIntakeFlow, validateResumedPromo } from '../chunk/
|
|
2
|
-
import '../chunk/
|
|
3
|
-
export { DEFAULT_COLOR_PALETTE, LIFECYCLE_BUCKETS, LIFECYCLE_LABEL, LIFECYCLE_TONE, LIVE_SUBSCRIPTION_STATUSES, TERMINAL_SUBSCRIPTION_STATUSES, US_STATES, US_STATE_OPTIONS, accountSource, availableStateOptions, availableStates, buildRefillView, buildTimeline, buildTrackerView, buildTrackingUrl, captureFunnelEmail, catalogUnavailableMessage, categoryColor, createFunnelTelemetry, deriveAttention, deriveCatalogAvailabilityDecision, deriveJourney, emailGateAnswered, formatCardNumber, formatConversationTime, formatCvv, formatEventDate, formatExpiry, formatMessageTime, formatRelativeTime, formatStageDate, hasErrors, isCssColorValue, isLive, isQuestionVisible, isReconcilable, lifecycleReason, lowestPrice, lowestSalePrice, markEmailGateAnswered, normalizeState, primarySubscription, reconcileCartAgainstCatalog, reconcileCartLines, redeemResumeLink, resetResumeRedemption, resolveCategoryColor, salePriceForBase, stateAvailabilityNote, toTrackerRequest, useAddressPair, useAffiliateConversions, useAffiliateDownline, useAffiliateLinks, useAffiliateStats, useCartCheckoutFlow, useCartReconcile, useCatalog, useCatalogAvailability, useCheckoutFlow, useDashboardData, useMedicationSelect, useMemberPortalData, useMessagesThread, useProductDetail, useRegisterFlow, useSignupFlow, useSubscribeFlow, useSurveyFlow, useSurveyV2Flow, useUpdatePaymentMethodFlow, validateAddress } from '../chunk/
|
|
4
|
-
import '../chunk/
|
|
5
|
-
import '../chunk/
|
|
6
|
-
import '../chunk/
|
|
1
|
+
export { restoreCartFromLink, startCartCapture, useSubscriptionIntakeFlow, validateResumedPromo } from '../chunk/JOX6EJMB.js';
|
|
2
|
+
import '../chunk/AJR7CBZ3.js';
|
|
3
|
+
export { DEFAULT_COLOR_PALETTE, LIFECYCLE_BUCKETS, LIFECYCLE_LABEL, LIFECYCLE_TONE, LIVE_SUBSCRIPTION_STATUSES, TERMINAL_SUBSCRIPTION_STATUSES, US_STATES, US_STATE_OPTIONS, accountSource, availableStateOptions, availableStates, buildRefillView, buildTimeline, buildTrackerView, buildTrackingUrl, captureFunnelEmail, catalogUnavailableMessage, categoryColor, createFunnelTelemetry, deriveAttention, deriveCatalogAvailabilityDecision, deriveJourney, emailGateAnswered, formatCardNumber, formatConversationTime, formatCvv, formatEventDate, formatExpiry, formatMessageTime, formatRelativeTime, formatStageDate, hasErrors, isCssColorValue, isLive, isQuestionVisible, isReconcilable, lifecycleReason, lowestPrice, lowestSalePrice, markEmailGateAnswered, normalizeState, primarySubscription, reconcileCartAgainstCatalog, reconcileCartLines, redeemResumeLink, resetResumeRedemption, resolveCategoryColor, salePriceForBase, stateAvailabilityNote, toTrackerRequest, useAddressPair, useAffiliateConversions, useAffiliateDownline, useAffiliateLinks, useAffiliateStats, useCartCheckoutFlow, useCartReconcile, useCatalog, useCatalogAvailability, useCheckoutFlow, useDashboardData, useMedicationSelect, useMemberPortalData, useMessagesThread, useProductDetail, useRegisterFlow, useSignupFlow, useSubscribeFlow, useSurveyFlow, useSurveyV2Flow, useUpdatePaymentMethodFlow, validateAddress } from '../chunk/35C2PAUI.js';
|
|
4
|
+
import '../chunk/65LD7XAZ.js';
|
|
5
|
+
import '../chunk/Y2VD7NYA.js';
|
|
6
|
+
import '../chunk/75B7QHIN.js';
|
|
7
7
|
import '../chunk/5XGPFYIJ.js';
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
package/dist/flows/index.jsx
CHANGED
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
startCartCapture,
|
|
4
4
|
useSubscriptionIntakeFlow,
|
|
5
5
|
validateResumedPromo
|
|
6
|
-
} from "../chunk/
|
|
7
|
-
import "../chunk/
|
|
6
|
+
} from "../chunk/C7RXQWXM.jsx";
|
|
7
|
+
import "../chunk/DEDIHIWD.jsx";
|
|
8
8
|
import {
|
|
9
9
|
DEFAULT_COLOR_PALETTE,
|
|
10
10
|
LIFECYCLE_BUCKETS,
|
|
@@ -78,10 +78,10 @@ import {
|
|
|
78
78
|
useSurveyV2Flow,
|
|
79
79
|
useUpdatePaymentMethodFlow,
|
|
80
80
|
validateAddress
|
|
81
|
-
} from "../chunk/
|
|
82
|
-
import "../chunk/
|
|
83
|
-
import "../chunk/
|
|
84
|
-
import "../chunk/
|
|
81
|
+
} from "../chunk/VKSLQCMA.jsx";
|
|
82
|
+
import "../chunk/33QXG46Z.jsx";
|
|
83
|
+
import "../chunk/MUEGVUP2.jsx";
|
|
84
|
+
import "../chunk/NTYUIUQO.jsx";
|
|
85
85
|
import "../chunk/LDZIUFDM.jsx";
|
|
86
86
|
export {
|
|
87
87
|
DEFAULT_COLOR_PALETTE,
|
package/dist/index/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { PortalConfig, configure, getConfig } from '../config/index.js';
|
|
2
2
|
export { BannerProps, BannerVariant, ButtonProps, ButtonSize, ButtonVariant, CardProps, CheckboxGroupProps, ChoiceOption, HeadingProps, Primitives, PrimitivesProvider, RadioGroupProps, SelectOption, SelectProps, SpinnerProps, Status, StatusPillProps, StepIndicatorProps, TextFieldProps, TextareaProps, usePrimitives } from '../primitives/index.js';
|
|
3
3
|
export { defaultPrimitives } from '../primitives/default/index.js';
|
|
4
|
-
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
|
|
4
|
+
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';
|
|
5
5
|
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';
|
|
6
6
|
export { captureAffiliateRef, capturePromoCode, clearAffiliateRef, clearPromoCode, readAffiliateRef, readPromoCode } from '../api/index.js';
|
|
7
7
|
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';
|
package/dist/index/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import '../chunk/JSHO46VZ.js';
|
|
2
|
-
export { restoreCartFromLink, startCartCapture, useSubscriptionIntakeFlow, validateResumedPromo } from '../chunk/
|
|
3
|
-
export { adoptCartId, capturePromoCode, cartId, clearPromoCode, fetchCartConfig, fetchResumedCart, postCartSnapshot, readCartToken, readPromoCode, resetCartConfigCache, resetCartId, stripCartToken } from '../chunk/
|
|
4
|
-
export { ADMIN_TAB_SEGMENTS, AFFILIATE_SUB_TAB_SEGMENTS, AddressFields, AdminDashboard, AffiliateForgotPassword, AffiliateLogin, AffiliatePortal, AffiliateRegister, AffiliateResetPassword, CartCheckoutPage, CheckoutPage, EmailTemplates, ForgotPasswordPage, MemberPortal, PatientDashboardPreview, RegisterPage, ResetPasswordPage, SignupPage, SubscribePage, SurveyPage, SurveyV2Page, UpdatePaymentMethod, adminTabFromPath, adminTabPath, affiliateSubTabFromPath, affiliateSubTabPath } from '../chunk/
|
|
2
|
+
export { restoreCartFromLink, startCartCapture, useSubscriptionIntakeFlow, validateResumedPromo } from '../chunk/JOX6EJMB.js';
|
|
3
|
+
export { adoptCartId, capturePromoCode, cartId, clearPromoCode, fetchCartConfig, fetchResumedCart, postCartSnapshot, readCartToken, readPromoCode, resetCartConfigCache, resetCartId, stripCartToken } from '../chunk/AJR7CBZ3.js';
|
|
4
|
+
export { ADMIN_TAB_SEGMENTS, AFFILIATE_SUB_TAB_SEGMENTS, AddressFields, AdminDashboard, AffiliateForgotPassword, AffiliateLogin, AffiliatePortal, AffiliateRegister, AffiliateResetPassword, CartCheckoutPage, CheckoutPage, EmailTemplates, ForgotPasswordPage, MemberPortal, PatientDashboardPreview, RegisterPage, ResetPasswordPage, SignupPage, SubscribePage, SurveyPage, SurveyV2Page, UpdatePaymentMethod, adminTabFromPath, adminTabPath, affiliateSubTabFromPath, affiliateSubTabPath } from '../chunk/MCSS436N.js';
|
|
5
5
|
export { EmbedApiError2 as ApexV2ApiError, EmbedApiError, createEmbedApiClient, disqualificationReasonText, disqualifiedDrugIds, qualifiedDrugIds } from '../chunk/LZWA44KD.js';
|
|
6
|
-
export { DEFAULT_COLOR_PALETTE, LIFECYCLE_BUCKETS, LIFECYCLE_LABEL, LIFECYCLE_TONE, LIVE_SUBSCRIPTION_STATUSES, TERMINAL_SUBSCRIPTION_STATUSES, US_STATES, US_STATE_OPTIONS, accountSource, availableStateOptions, availableStates, buildRefillView, buildTimeline, buildTrackerView, buildTrackingUrl, captureFunnelEmail, catalogUnavailableMessage, categoryColor, createFunnelTelemetry, deriveAttention, deriveCatalogAvailabilityDecision, deriveJourney, emailGateAnswered, formatCardNumber, formatConversationTime, formatCvv, formatEventDate, formatExpiry, formatMessageTime, formatRelativeTime, formatStageDate, hasErrors, isCssColorValue, isLive, isQuestionVisible, isReconcilable, lifecycleReason, lowestPrice, lowestSalePrice, markEmailGateAnswered, normalizeState, primarySubscription, reconcileCartAgainstCatalog, reconcileCartLines, redeemResumeLink, resetResumeRedemption, resolveCategoryColor, salePriceForBase, stateAvailabilityNote, toTrackerRequest, useAddressPair, useAffiliateConversions, useAffiliateDownline, useAffiliateLinks, useAffiliateStats, useCartCheckoutFlow, useCartReconcile, useCatalog, useCatalogAvailability, useCheckoutFlow, useDashboardData, useMedicationSelect, useMemberPortalData, useMessagesThread, useProductDetail, useRegisterFlow, useSignupFlow, useSubscribeFlow, useSurveyFlow, useSurveyV2Flow, useUpdatePaymentMethodFlow, validateAddress } from '../chunk/
|
|
7
|
-
export { adoptFunnelSessionId, captureAuthHeader, fetchFunnelConfig, fetchResumedDraft, funnelSessionId, peekFunnelSessionId, postFunnelEvent, readResumeToken, resetFunnelConfigCache, saveFunnelDraft, stripResumeToken } from '../chunk/
|
|
6
|
+
export { DEFAULT_COLOR_PALETTE, LIFECYCLE_BUCKETS, LIFECYCLE_LABEL, LIFECYCLE_TONE, LIVE_SUBSCRIPTION_STATUSES, TERMINAL_SUBSCRIPTION_STATUSES, US_STATES, US_STATE_OPTIONS, accountSource, availableStateOptions, availableStates, buildRefillView, buildTimeline, buildTrackerView, buildTrackingUrl, captureFunnelEmail, catalogUnavailableMessage, categoryColor, createFunnelTelemetry, deriveAttention, deriveCatalogAvailabilityDecision, deriveJourney, emailGateAnswered, formatCardNumber, formatConversationTime, formatCvv, formatEventDate, formatExpiry, formatMessageTime, formatRelativeTime, formatStageDate, hasErrors, isCssColorValue, isLive, isQuestionVisible, isReconcilable, lifecycleReason, lowestPrice, lowestSalePrice, markEmailGateAnswered, normalizeState, primarySubscription, reconcileCartAgainstCatalog, reconcileCartLines, redeemResumeLink, resetResumeRedemption, resolveCategoryColor, salePriceForBase, stateAvailabilityNote, toTrackerRequest, useAddressPair, useAffiliateConversions, useAffiliateDownline, useAffiliateLinks, useAffiliateStats, useCartCheckoutFlow, useCartReconcile, useCatalog, useCatalogAvailability, useCheckoutFlow, useDashboardData, useMedicationSelect, useMemberPortalData, useMessagesThread, useProductDetail, useRegisterFlow, useSignupFlow, useSubscribeFlow, useSurveyFlow, useSurveyV2Flow, useUpdatePaymentMethodFlow, validateAddress } from '../chunk/35C2PAUI.js';
|
|
7
|
+
export { adoptFunnelSessionId, captureAuthHeader, fetchFunnelConfig, fetchResumedDraft, funnelSessionId, peekFunnelSessionId, postFunnelEvent, readResumeToken, resetFunnelConfigCache, saveFunnelDraft, stripResumeToken } from '../chunk/65LD7XAZ.js';
|
|
8
8
|
export { PrimitivesProvider, usePrimitives } from '../chunk/67KHO66G.js';
|
|
9
9
|
export { defaultPrimitives } from '../chunk/EXXI5Y7I.js';
|
|
10
10
|
import '../chunk/NVRAOAVV.js';
|
|
11
|
-
export { affiliateAuth_default as affiliateAuthStore, auth_default as authStore, cart_default as cartStore, medication_default as medicationStore } from '../chunk/
|
|
12
|
-
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/
|
|
11
|
+
export { affiliateAuth_default as affiliateAuthStore, auth_default as authStore, cart_default as cartStore, medication_default as medicationStore } from '../chunk/Y2VD7NYA.js';
|
|
12
|
+
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';
|
|
13
13
|
export { configure, getConfig } from '../chunk/5XGPFYIJ.js';
|
|
14
14
|
//# sourceMappingURL=index.js.map
|
|
15
15
|
//# sourceMappingURL=index.js.map
|
package/dist/index/index.jsx
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
startCartCapture,
|
|
5
5
|
useSubscriptionIntakeFlow,
|
|
6
6
|
validateResumedPromo
|
|
7
|
-
} from "../chunk/
|
|
7
|
+
} from "../chunk/C7RXQWXM.jsx";
|
|
8
8
|
import {
|
|
9
9
|
adoptCartId,
|
|
10
10
|
capturePromoCode,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
resetCartConfigCache,
|
|
19
19
|
resetCartId,
|
|
20
20
|
stripCartToken
|
|
21
|
-
} from "../chunk/
|
|
21
|
+
} from "../chunk/DEDIHIWD.jsx";
|
|
22
22
|
import {
|
|
23
23
|
ADMIN_TAB_SEGMENTS,
|
|
24
24
|
AFFILIATE_SUB_TAB_SEGMENTS,
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
adminTabPath,
|
|
47
47
|
affiliateSubTabFromPath,
|
|
48
48
|
affiliateSubTabPath
|
|
49
|
-
} from "../chunk/
|
|
49
|
+
} from "../chunk/IYLVDYRI.jsx";
|
|
50
50
|
import {
|
|
51
51
|
EmbedApiError,
|
|
52
52
|
EmbedApiError2,
|
|
@@ -128,7 +128,7 @@ import {
|
|
|
128
128
|
useSurveyV2Flow,
|
|
129
129
|
useUpdatePaymentMethodFlow,
|
|
130
130
|
validateAddress
|
|
131
|
-
} from "../chunk/
|
|
131
|
+
} from "../chunk/VKSLQCMA.jsx";
|
|
132
132
|
import {
|
|
133
133
|
adoptFunnelSessionId,
|
|
134
134
|
captureAuthHeader,
|
|
@@ -141,7 +141,7 @@ import {
|
|
|
141
141
|
resetFunnelConfigCache,
|
|
142
142
|
saveFunnelDraft,
|
|
143
143
|
stripResumeToken
|
|
144
|
-
} from "../chunk/
|
|
144
|
+
} from "../chunk/33QXG46Z.jsx";
|
|
145
145
|
import {
|
|
146
146
|
PrimitivesProvider,
|
|
147
147
|
usePrimitives
|
|
@@ -155,7 +155,7 @@ import {
|
|
|
155
155
|
auth_default,
|
|
156
156
|
cart_default,
|
|
157
157
|
medication_default
|
|
158
|
-
} from "../chunk/
|
|
158
|
+
} from "../chunk/MUEGVUP2.jsx";
|
|
159
159
|
import {
|
|
160
160
|
ApiError,
|
|
161
161
|
SUPPORT_ATTACHMENT_MAX_BYTES,
|
|
@@ -190,7 +190,7 @@ import {
|
|
|
190
190
|
subscriptionsApi,
|
|
191
191
|
supportApi,
|
|
192
192
|
usersApi
|
|
193
|
-
} from "../chunk/
|
|
193
|
+
} from "../chunk/NTYUIUQO.jsx";
|
|
194
194
|
import {
|
|
195
195
|
configure,
|
|
196
196
|
getConfig
|