@apextelemed/partner-core 0.17.0-dev.54 → 0.17.0-dev.55

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.
Files changed (41) hide show
  1. package/README.md +4 -5
  2. package/dist/api/index.d.ts +1 -1
  3. package/dist/api/index.js +3 -3
  4. package/dist/api/index.jsx +3 -3
  5. package/dist/chunk/{VUDLDIMS.jsx → 2LZ4RMMO.jsx} +541 -554
  6. package/dist/chunk/{MUNFWRXF.js → 54ICTHZX.js} +6 -3
  7. package/dist/chunk/54ICTHZX.js.map +1 -0
  8. package/dist/chunk/{WTQ63KR4.js → 5DNJWMSW.js} +3 -3
  9. package/dist/chunk/{WTQ63KR4.js.map → 5DNJWMSW.js.map} +1 -1
  10. package/dist/chunk/{Z5QDFCLZ.js → ERW2WNI6.js} +330 -343
  11. package/dist/chunk/ERW2WNI6.js.map +1 -0
  12. package/dist/chunk/{BI7NBPCA.jsx → FAKJL3AD.jsx} +5 -2
  13. package/dist/chunk/{P3TJ6ALH.jsx → KI3RUQTI.jsx} +2 -2
  14. package/dist/chunk/{CAG35QKZ.jsx → KSWWT576.jsx} +5 -5
  15. package/dist/chunk/{XDRP4X2N.js → L6ZE7Q7C.js} +3 -3
  16. package/dist/chunk/{XDRP4X2N.js.map → L6ZE7Q7C.js.map} +1 -1
  17. package/dist/chunk/{Q2L3CZPR.jsx → LON6ZV4S.jsx} +2 -2
  18. package/dist/chunk/{MQRPGAH7.js → Q7VYJUQC.js} +5 -5
  19. package/dist/chunk/{MQRPGAH7.js.map → Q7VYJUQC.js.map} +1 -1
  20. package/dist/chunk/{XI4OZ4SZ.js → QJAMR6MG.js} +3 -3
  21. package/dist/chunk/{XI4OZ4SZ.js.map → QJAMR6MG.js.map} +1 -1
  22. package/dist/chunk/{HXBRBHFR.jsx → TFELHUFX.jsx} +2 -2
  23. package/dist/chunk/{F5PDIE2J.js → TKN2GOKS.js} +6 -6
  24. package/dist/chunk/{F5PDIE2J.js.map → TKN2GOKS.js.map} +1 -1
  25. package/dist/chunk/{DC24EAWT.jsx → YGKENMTV.jsx} +4 -4
  26. package/dist/{client-BH1wq2Pp.d.ts → client-CEt_6guF.d.ts} +5 -2
  27. package/dist/flows/index.d.ts +1 -1
  28. package/dist/flows/index.js +6 -6
  29. package/dist/flows/index.jsx +6 -6
  30. package/dist/index/index.d.ts +1 -1
  31. package/dist/index/index.js +7 -7
  32. package/dist/index/index.jsx +7 -7
  33. package/dist/pages/index.d.ts +8 -6
  34. package/dist/pages/index.js +5 -5
  35. package/dist/pages/index.jsx +5 -5
  36. package/dist/stores/index.d.ts +1 -1
  37. package/dist/stores/index.js +2 -2
  38. package/dist/stores/index.jsx +2 -2
  39. package/package.json +1 -1
  40. package/dist/chunk/MUNFWRXF.js.map +0 -1
  41. package/dist/chunk/Z5QDFCLZ.js.map +0 -1
@@ -1155,7 +1155,10 @@ var adminApi = {
1155
1155
  listAdminTeam() {
1156
1156
  return apiFetch("/admin/admins");
1157
1157
  },
1158
- /** `acceptUrl` is the page that accepts the invite; the backend adds `?token=…&email=…`. */
1158
+ /**
1159
+ * The invite links to the backend's own accept page unless `acceptUrl` names
1160
+ * a site's page (the backend adds `?token=…&email=…`).
1161
+ */
1159
1162
  inviteAdmin(params) {
1160
1163
  return post("/admin/admins/invite", params);
1161
1164
  },
@@ -1605,4 +1608,4 @@ export {
1605
1608
  clearAffiliateTokens,
1606
1609
  affiliatePortalApi
1607
1610
  };
1608
- //# sourceMappingURL=BI7NBPCA.jsx.map
1611
+ //# sourceMappingURL=FAKJL3AD.jsx.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  captureAuthHeader,
3
3
  peekFunnelSessionId
4
- } from "./HXBRBHFR.jsx";
4
+ } from "./TFELHUFX.jsx";
5
5
  import {
6
6
  getConfig
7
7
  } from "./QVZ7BRNO.jsx";
@@ -174,4 +174,4 @@ export {
174
174
  readCartToken,
175
175
  stripCartToken
176
176
  };
177
- //# sourceMappingURL=P3TJ6ALH.jsx.map
177
+ //# sourceMappingURL=KI3RUQTI.jsx.map
@@ -8,7 +8,7 @@ import {
8
8
  readPromoCode,
9
9
  resetCartId,
10
10
  stripCartToken
11
- } from "./P3TJ6ALH.jsx";
11
+ } from "./KI3RUQTI.jsx";
12
12
  import {
13
13
  bestOfferDiscount,
14
14
  catalogUnavailableMessage,
@@ -22,11 +22,11 @@ import {
22
22
  useCardTokenizer,
23
23
  useCatalogAvailability,
24
24
  validateAddress
25
- } from "./DC24EAWT.jsx";
25
+ } from "./YGKENMTV.jsx";
26
26
  import {
27
27
  auth_default,
28
28
  cart_default
29
- } from "./Q2L3CZPR.jsx";
29
+ } from "./LON6ZV4S.jsx";
30
30
  import {
31
31
  ApiError,
32
32
  newIdempotencyKey,
@@ -34,7 +34,7 @@ import {
34
34
  promoCodesApi,
35
35
  subscriptionsApi,
36
36
  usersApi
37
- } from "./BI7NBPCA.jsx";
37
+ } from "./FAKJL3AD.jsx";
38
38
  import {
39
39
  getConfig
40
40
  } from "./QVZ7BRNO.jsx";
@@ -648,4 +648,4 @@ export {
648
648
  restoreCartFromLink,
649
649
  startCartCapture
650
650
  };
651
- //# sourceMappingURL=CAG35QKZ.jsx.map
651
+ //# sourceMappingURL=KSWWT576.jsx.map
@@ -1,4 +1,4 @@
1
- import { peekFunnelSessionId, captureAuthHeader } from './WTQ63KR4.js';
1
+ import { peekFunnelSessionId, captureAuthHeader } from './5DNJWMSW.js';
2
2
  import { getConfig } from './2IFPDU4D.js';
3
3
 
4
4
  // src/api/promoRef.ts
@@ -156,5 +156,5 @@ function stripCartToken() {
156
156
  }
157
157
 
158
158
  export { adoptCartId, capturePromoCode, cartId, clearPromoCode, fetchCartConfig, fetchResumedCart, postCartSnapshot, readCartToken, readPromoCode, resetCartConfigCache, resetCartId, stripCartToken };
159
- //# sourceMappingURL=XDRP4X2N.js.map
160
- //# sourceMappingURL=XDRP4X2N.js.map
159
+ //# sourceMappingURL=L6ZE7Q7C.js.map
160
+ //# sourceMapp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EAAC;AAAA,MACnE,SAAA,EAAW,KAAK,SAAA,IAAa,IAAA;AAAA,MAC7B,eAAe,OAAO,IAAA,CAAK,aAAA,KAAkB,QAAA,GAAW,KAAK,aAAA,GAAgB;AAAA,KAC/E;AAAA,EACF,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAGO,SAAS,aAAA,GAA+B;AAC7C,EAAA,IAAI;AACF,IAAA,MAAM,KAAA,GAAQ,IAAI,eAAA,CAAgB,MAAA,CAAO,SAAS,MAAM,CAAA,CAAE,IAAI,MAAM,CAAA;AACpE,IAAA,OAAO,KAAA,IAAS,KAAA,CAAM,MAAA,GAAS,CAAA,GAAI,KAAA,GAAQ,IAAA;AAAA,EAC7C,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAOO,SAAS,cAAA,GAAuB;AACrC,EAAA,IAAI;AACF,IAAA,MAAM,GAAA,GAAM,IAAI,GAAA,CAAI,MAAA,CAAO,SAAS,IAAI,CAAA;AACxC,IAAA,IAAI,CAAC,GAAA,CAAI,YAAA,CAAa,GAAA,CAAI,MAAM,CAAA,EAAG;AACnC,IAAA,GAAA,CAAI,YAAA,CAAa,OAAO,MAAM,CAAA;AAC9B,IAAA,MAAA,CAAO,QAAQ,YAAA,CAAa,IAAI,EAAA,EAAI,GAAA,CAAI,UAAU,CAAA;AAAA,EACpD,CAAA,CAAA,MAAQ;AAAA,EAER;AACF","file":"XDRP4X2N.js","sourcesContent":["// ── First-party promo-code capture from a `?promo=` landing ──────────\n//\n// A campaign link can carry its own code (`/?promo=TRUE10`) so the member does\n// not have to type it. Stashed in the storefront's own localStorage and read\n// back when the intake reaches the promo field.\n//\n// Mirrors `affiliateRef` deliberately — same storage shape, same 30-day window —\n// but is a SEPARATE concern: an affiliate ref attributes a sale to a partner and\n// is validated server-side at checkout, while this only pre-fills an input the\n// member still has to submit.\n\nimport { getConfig } from '../config';\n\n// Matches the affiliate-ref window. A stash that outlives the promo it carries\n// is not a correctness problem — the code is re-validated before it is used,\n// and silently dropped if it has expired — but there is no reason to keep one\n// around longer than a campaign plausibly runs.\nconst TTL_MS = 30 * 24 * 60 * 60 * 1000;\n\nconst storageKey = () => `${getConfig().storagePrefix}-promo-code`;\n\ninterface StoredPromo {\n code: string;\n ts: number;\n}\n\n/** Persist a promo code from a `?promo=` landing. No-op for empty input. */\nexport function capturePromoCode(code: string): void {\n if (typeof localStorage === 'undefined') return;\n const trimmed = code.trim();\n if (!trimmed) return;\n try {\n const entry: StoredPromo = { code: trimmed, ts: Date.now() };\n localStorage.setItem(storageKey(), JSON.stringify(entry));\n } catch {\n // storage unavailable (private mode / quota) — non-fatal\n }\n}\n\n/**\n * Read the stored promo code, or null if absent or past the storage window.\n *\n * Being within the window says nothing about whether the CODE is still valid —\n * a campaign can end while the stash is fresh. The caller re-validates against\n * the server before showing it to anyone.\n */\nexport function readPromoCode(): string | null {\n if (typeof localStorage === 'undefined') return null;\n try {\n const raw = localStorage.getItem(storageKey());\n if (!raw) return null;\n const parsed = JSON.parse(raw) as Partial<StoredPromo>;\n if (!parsed.code || typeof parsed.ts !== 'number') return null;\n if (Date.now() - parsed.ts > TTL_MS) {\n localStorage.removeItem(storageKey());\n return null;\n }\n return parsed.code;\n } catch {\n return null;\n }\n}\n\n/** Drop the stored promo code. */\nexport function clearPromoCode(): void {\n if (typeof localStorage === 'undefined') return;\n try {\n localStorage.removeItem(storageKey());\n } catch {\n // non-fatal\n }\n}\n","import { getConfig } from '../config';\nimport { captureAuthHeader, peekFunnelSessionId } from './funnel';\n\n// ── Abandoned-cart transport ────────────────────────────────────────────────\n//\n// Thin client for the-backend's cart-capture endpoints:\n// GET /config/cart → whether this tenant mirrors carts at all\n// POST /cart/snapshot → server-side mirror of the browser's cart\n// GET /cart/resume → trade an emailed token for the saved cart\n//\n// Sibling of ./funnel, and the same posture: fire-and-forget, fail-silent.\n// Cart capture is marketing instrumentation and must never break, block or\n// slow down shopping.\n\nexport interface CartCaptureConfig {\n /** Tenant opted in (features.cartRecovery); false = never send anything. */\n snapshot: boolean;\n}\n\nconst DISABLED: CartCaptureConfig = { snapshot: false };\n\nlet configPromise: Promise<CartCaptureConfig> | null = null;\n\n/**\n * The tenant's cart-capture posture, fetched once per page load and cached.\n * Fails closed: any error reads as \"off\".\n */\nexport function fetchCartConfig(): Promise<CartCaptureConfig> {\n if (!configPromise) {\n configPromise = (async () => {\n try {\n const cfg = getConfig();\n const res = await fetch(`${cfg.apiBase}/config/cart`, {\n headers: { 'X-Tenant-Key': cfg.tenantKey },\n });\n if (!res.ok) return DISABLED;\n const body = (await res.json()) as Partial<CartCaptureConfig>;\n return { snapshot: body.snapshot === true };\n } catch {\n return DISABLED;\n }\n })();\n }\n return configPromise;\n}\n\n/** Test seam: forget the cached config so the next fetch re-resolves. */\nexport function resetCartConfigCache(): void {\n configPromise = null;\n}\n\nconst cartIdKey = () => `${getConfig().storagePrefix}-cart-id`;\n\n/**\n * Stable id for this shopper's cart, minted on first use and kept in\n * localStorage — NOT sessionStorage like the survey session.\n *\n * A cart outlives the tab it was filled in: someone adds items, closes the\n * browser, comes back tomorrow and finds the cart still there (the cart store\n * itself persists the same way). The id has to survive with it, or every visit\n * would look like a brand-new abandoned cart and one shopper would accumulate\n * a row — and a reminder track — per session.\n */\nexport function cartId(): string {\n let id: string | null = null;\n try {\n id = localStorage.getItem(cartIdKey());\n } catch {\n /* storage unavailable (private mode) — fall through to an ephemeral id */\n }\n if (!id) {\n id =\n typeof crypto !== 'undefined' && 'randomUUID' in crypto\n ? crypto.randomUUID()\n : `${Date.now()}-${Math.random().toString(36).slice(2)}`;\n try {\n localStorage.setItem(cartIdKey(), id);\n } catch {\n /* ephemeral it is */\n }\n }\n return id;\n}\n\n/**\n * Continue the cart a recovery email points at, instead of the one this browser\n * happens to hold. Adopting the emailed id keeps the reminder history, the\n * email address and the eventual conversion on ONE row.\n */\nexport function adoptCartId(id: string): void {\n if (!id) return;\n try {\n localStorage.setItem(cartIdKey(), id);\n } catch {\n /* storage unavailable — the adoption is ephemeral */\n }\n}\n\n/**\n * Start a fresh cart id. Called after a purchase: the old id is stamped\n * converted server-side and must never be written to again, or a new cart\n * would inherit a bought cart's row (and its silence — converted rows are\n * never nudged).\n */\nexport function resetCartId(): void {\n try {\n localStorage.removeItem(cartIdKey());\n } catch {\n /* nothing to clear */\n }\n}\n\nexport interface CartSnapshotLine {\n productId: string;\n dosage?: string;\n quantity: number;\n}\n\n/**\n * Mirror the cart server-side. Identity only — the backend re-prices from the\n * catalog and ignores anything else we send, so there is no point shipping\n * names or prices.\n *\n * `keepalive` lets the request survive the page unload that so often IS the\n * abandonment.\n *\n * The bearer token, when there is one, is how a signed-in shopper's cart gets\n * their user id: the endpoint takes identity from the token and never from the\n * body (`optionalAuth`), so omitting it left every logged-in cart anonymous —\n * joinable only by whatever email happened to be attached.\n */\nexport function postCartSnapshot(params: {\n items: CartSnapshotLine[];\n promoCode?: string | null;\n email?: string | null;\n}): void {\n try {\n const cfg = getConfig();\n void fetch(`${cfg.apiBase}/cart/snapshot`, {\n method: 'POST',\n keepalive: true,\n headers: {\n 'Content-Type': 'application/json',\n 'X-Tenant-Key': cfg.tenantKey,\n ...captureAuthHeader(),\n },\n body: JSON.stringify({\n cartId: cartId(),\n items: params.items,\n promoCode: params.promoCode ?? null,\n ...(params.email ? { email: params.email } : {}),\n // Only when a survey session already exists: it lets the backend reuse\n // the address the pre-survey email gate collected, which is often the\n // only handle we have on an anonymous shopper.\n ...(peekFunnelSessionId() ? { sessionId: peekFunnelSessionId() } : {}),\n }),\n }).catch(() => {});\n } catch {\n /* not configured yet — drop */\n }\n}\n\n/** A resumed cart line, already re-priced against today's catalog. */\nexport interface ResumedCartLine {\n productId: string;\n dosage?: string;\n quantity: number;\n name: string;\n priceCents: number;\n salePriceCents: number | null;\n thumbnailUrl: string | null;\n isSubscription: boolean;\n apexDrugId: string | null;\n categories: string[];\n hideDoseLabel: boolean;\n}\n\nexport interface ResumedCart {\n cartId: string;\n items: ResumedCartLine[];\n /** Lines whose product has since been discontinued or deactivated. */\n unavailable: Array<{ productId: string; dosage?: string; quantity: number }>;\n promoCode: string | null;\n subtotalCents: number;\n}\n\n/**\n * Exchange an emailed recovery token for the saved cart.\n *\n * The token is the ONLY thing authorizing this read — the-backend verifies its\n * HMAC before returning anything. A 404 (expired, already bought, tampered, or\n * every product gone) resolves to null so the caller simply keeps whatever cart\n * this browser already had.\n */\nexport async function fetchResumedCart(token: string): Promise<ResumedCart | null> {\n try {\n const cfg = getConfig();\n const res = await fetch(`${cfg.apiBase}/cart/resume?token=${encodeURIComponent(token)}`, {\n headers: { 'X-Tenant-Key': cfg.tenantKey },\n });\n if (!res.ok) return null;\n const body = (await res.json()) as Partial<ResumedCart>;\n if (!body.cartId || !Array.isArray(body.items) || body.items.length === 0) return null;\n return {\n cartId: body.cartId,\n items: body.items,\n unavailable: Array.isArray(body.unavailable) ? body.unavailable : [],\n promoCode: body.promoCode ?? null,\n subtotalCents: typeof body.subtotalCents === 'number' ? body.subtotalCents : 0,\n };\n } catch {\n return null;\n }\n}\n\n/** Read the `?cart=` token from the current URL. */\nexport function readCartToken(): string | null {\n try {\n const token = new URLSearchParams(window.location.search).get('cart');\n return token && token.length > 0 ? token : null;\n } catch {\n return null;\n }\n}\n\n/**\n * Drop `?cart=` from the address bar once it's been redeemed, so a refresh (or\n * a shared URL) doesn't re-run the restore over a cart the shopper has since\n * edited. History is replaced, not pushed — the token was never a page.\n */\nexport function stripCartToken(): void {\n try {\n const url = new URL(window.location.href);\n if (!url.searchParams.has('cart')) return;\n url.searchParams.delete('cart');\n window.history.replaceState({}, '', url.toString());\n } catch {\n /* no history API — leaving the param is harmless */\n }\n}\n"]}
1
+ {"version":3,"sources":["../../src/api/promoRef.ts","../../src/api/cart.ts"],"names":[],"mappings":";;;;AAiBA,IAAM,MAAA,GAAS,EAAA,GAAK,EAAA,GAAK,EAAA,GAAK,EAAA,GAAK,GAAA;AAEnC,IAAM,UAAA,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AAAA,EACT;AACF;AAGO,SAAS,aAAA,GAA+B;AAC7C,EAAA,IAAI;AACF,IAAA,MAAM,KAAA,GAAQ,IAAI,eAAA,CAAgB,MAAA,CAAO,SAAS,MAAM,CAAA,CAAE,IAAI,MAAM,CAAA;AACpE,IAAA,OAAO,KAAA,IAAS,KAAA,CAAM,MAAA,GAAS,CAAA,GAAI,KAAA,GAAQ,IAAA;AAAA,EAC7C,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAOO,SAAS,cAAA,GAAuB;AACrC,EAAA,IAAI;AACF,IAAA,MAAM,GAAA,GAAM,IAAI,GAAA,CAAI,MAAA,CAAO,SAAS,IAAI,CAAA;AACxC,IAAA,IAAI,CAAC,GAAA,CAAI,YAAA,CAAa,GAAA,CAAI,MAAM,CAAA,EAAG;AACnC,IAAA,GAAA,CAAI,YAAA,CAAa,OAAO,MAAM,CAAA;AAC9B,IAAA,MAAA,CAAO,QAAQ,YAAA,CAAa,IAAI,EAAA,EAAI,GAAA,CAAI,UAAU,CAAA;AAAA,EACpD,CAAA,CAAA,MAAQ;AAAA,EAER;AACF","file":"L6ZE7Q7C.js","sourcesContent":["// ── First-party promo-code capture from a `?promo=` landing ──────────\n//\n// A campaign link can carry its own code (`/?promo=TRUE10`) so the member does\n// not have to type it. Stashed in the storefront's own localStorage and read\n// back when the intake reaches the promo field.\n//\n// Mirrors `affiliateRef` deliberately — same storage shape, same 30-day window —\n// but is a SEPARATE concern: an affiliate ref attributes a sale to a partner and\n// is validated server-side at checkout, while this only pre-fills an input the\n// member still has to submit.\n\nimport { getConfig } from '../config';\n\n// Matches the affiliate-ref window. A stash that outlives the promo it carries\n// is not a correctness problem — the code is re-validated before it is used,\n// and silently dropped if it has expired — but there is no reason to keep one\n// around longer than a campaign plausibly runs.\nconst TTL_MS = 30 * 24 * 60 * 60 * 1000;\n\nconst storageKey = () => `${getConfig().storagePrefix}-promo-code`;\n\ninterface StoredPromo {\n code: string;\n ts: number;\n}\n\n/** Persist a promo code from a `?promo=` landing. No-op for empty input. */\nexport function capturePromoCode(code: string): void {\n if (typeof localStorage === 'undefined') return;\n const trimmed = code.trim();\n if (!trimmed) return;\n try {\n const entry: StoredPromo = { code: trimmed, ts: Date.now() };\n localStorage.setItem(storageKey(), JSON.stringify(entry));\n } catch {\n // storage unavailable (private mode / quota) — non-fatal\n }\n}\n\n/**\n * Read the stored promo code, or null if absent or past the storage window.\n *\n * Being within the window says nothing about whether the CODE is still valid —\n * a campaign can end while the stash is fresh. The caller re-validates against\n * the server before showing it to anyone.\n */\nexport function readPromoCode(): string | null {\n if (typeof localStorage === 'undefined') return null;\n try {\n const raw = localStorage.getItem(storageKey());\n if (!raw) return null;\n const parsed = JSON.parse(raw) as Partial<StoredPromo>;\n if (!parsed.code || typeof parsed.ts !== 'number') return null;\n if (Date.now() - parsed.ts > TTL_MS) {\n localStorage.removeItem(storageKey());\n return null;\n }\n return parsed.code;\n } catch {\n return null;\n }\n}\n\n/** Drop the stored promo code. */\nexport function clearPromoCode(): void {\n if (typeof localStorage === 'undefined') return;\n try {\n localStorage.removeItem(storageKey());\n } catch {\n // non-fatal\n }\n}\n","import { getConfig } from '../config';\nimport { captureAuthHeader, peekFunnelSessionId } from './funnel';\n\n// ── Abandoned-cart transport ────────────────────────────────────────────────\n//\n// Thin client for the-backend's cart-capture endpoints:\n// GET /config/cart → whether this tenant mirrors carts at all\n// POST /cart/snapshot → server-side mirror of the browser's cart\n// GET /cart/resume → trade an emailed token for the saved cart\n//\n// Sibling of ./funnel, and the same posture: fire-and-forget, fail-silent.\n// Cart capture is marketing instrumentation and must never break, block or\n// slow down shopping.\n\nexport interface CartCaptureConfig {\n /** Tenant opted in (features.cartRecovery); false = never send anything. */\n snapshot: boolean;\n}\n\nconst DISABLED: CartCaptureConfig = { snapshot: false };\n\nlet configPromise: Promise<CartCaptureConfig> | null = null;\n\n/**\n * The tenant's cart-capture posture, fetched once per page load and cached.\n * Fails closed: any error reads as \"off\".\n */\nexport function fetchCartConfig(): Promise<CartCaptureConfig> {\n if (!configPromise) {\n configPromise = (async () => {\n try {\n const cfg = getConfig();\n const res = await fetch(`${cfg.apiBase}/config/cart`, {\n headers: { 'X-Tenant-Key': cfg.tenantKey },\n });\n if (!res.ok) return DISABLED;\n const body = (await res.json()) as Partial<CartCaptureConfig>;\n return { snapshot: body.snapshot === true };\n } catch {\n return DISABLED;\n }\n })();\n }\n return configPromise;\n}\n\n/** Test seam: forget the cached config so the next fetch re-resolves. */\nexport function resetCartConfigCache(): void {\n configPromise = null;\n}\n\nconst cartIdKey = () => `${getConfig().storagePrefix}-cart-id`;\n\n/**\n * Stable id for this shopper's cart, minted on first use and kept in\n * localStorage — NOT sessionStorage like the survey session.\n *\n * A cart outlives the tab it was filled in: someone adds items, closes the\n * browser, comes back tomorrow and finds the cart still there (the cart store\n * itself persists the same way). The id has to survive with it, or every visit\n * would look like a brand-new abandoned cart and one shopper would accumulate\n * a row — and a reminder track — per session.\n */\nexport function cartId(): string {\n let id: string | null = null;\n try {\n id = localStorage.getItem(cartIdKey());\n } catch {\n /* storage unavailable (private mode) — fall through to an ephemeral id */\n }\n if (!id) {\n id =\n typeof crypto !== 'undefined' && 'randomUUID' in crypto\n ? crypto.randomUUID()\n : `${Date.now()}-${Math.random().toString(36).slice(2)}`;\n try {\n localStorage.setItem(cartIdKey(), id);\n } catch {\n /* ephemeral it is */\n }\n }\n return id;\n}\n\n/**\n * Continue the cart a recovery email points at, instead of the one this browser\n * happens to hold. Adopting the emailed id keeps the reminder history, the\n * email address and the eventual conversion on ONE row.\n */\nexport function adoptCartId(id: string): void {\n if (!id) return;\n try {\n localStorage.setItem(cartIdKey(), id);\n } catch {\n /* storage unavailable — the adoption is ephemeral */\n }\n}\n\n/**\n * Start a fresh cart id. Called after a purchase: the old id is stamped\n * converted server-side and must never be written to again, or a new cart\n * would inherit a bought cart's row (and its silence — converted rows are\n * never nudged).\n */\nexport function resetCartId(): void {\n try {\n localStorage.removeItem(cartIdKey());\n } catch {\n /* nothing to clear */\n }\n}\n\nexport interface CartSnapshotLine {\n productId: string;\n dosage?: string;\n quantity: number;\n}\n\n/**\n * Mirror the cart server-side. Identity only — the backend re-prices from the\n * catalog and ignores anything else we send, so there is no point shipping\n * names or prices.\n *\n * `keepalive` lets the request survive the page unload that so often IS the\n * abandonment.\n *\n * The bearer token, when there is one, is how a signed-in shopper's cart gets\n * their user id: the endpoint takes identity from the token and never from the\n * body (`optionalAuth`), so omitting it left every logged-in cart anonymous —\n * joinable only by whatever email happened to be attached.\n */\nexport function postCartSnapshot(params: {\n items: CartSnapshotLine[];\n promoCode?: string | null;\n email?: string | null;\n}): void {\n try {\n const cfg = getConfig();\n void fetch(`${cfg.apiBase}/cart/snapshot`, {\n method: 'POST',\n keepalive: true,\n headers: {\n 'Content-Type': 'application/json',\n 'X-Tenant-Key': cfg.tenantKey,\n ...captureAuthHeader(),\n },\n body: JSON.stringify({\n cartId: cartId(),\n items: params.items,\n promoCode: params.promoCode ?? null,\n ...(params.email ? { email: params.email } : {}),\n // Only when a survey session already exists: it lets the backend reuse\n // the address the pre-survey email gate collected, which is often the\n // only handle we have on an anonymous shopper.\n ...(peekFunnelSessionId() ? { sessionId: peekFunnelSessionId() } : {}),\n }),\n }).catch(() => {});\n } catch {\n /* not configured yet — drop */\n }\n}\n\n/** A resumed cart line, already re-priced against today's catalog. */\nexport interface ResumedCartLine {\n productId: string;\n dosage?: string;\n quantity: number;\n name: string;\n priceCents: number;\n salePriceCents: number | null;\n thumbnailUrl: string | null;\n isSubscription: boolean;\n apexDrugId: string | null;\n categories: string[];\n hideDoseLabel: boolean;\n}\n\nexport interface ResumedCart {\n cartId: string;\n items: ResumedCartLine[];\n /** Lines whose product has since been discontinued or deactivated. */\n unavailable: Array<{ productId: string; dosage?: string; quantity: number }>;\n promoCode: string | null;\n subtotalCents: number;\n}\n\n/**\n * Exchange an emailed recovery token for the saved cart.\n *\n * The token is the ONLY thing authorizing this read — the-backend verifies its\n * HMAC before returning anything. A 404 (expired, already bought, tampered, or\n * every product gone) resolves to null so the caller simply keeps whatever cart\n * this browser already had.\n */\nexport async function fetchResumedCart(token: string): Promise<ResumedCart | null> {\n try {\n const cfg = getConfig();\n const res = await fetch(`${cfg.apiBase}/cart/resume?token=${encodeURIComponent(token)}`, {\n headers: { 'X-Tenant-Key': cfg.tenantKey },\n });\n if (!res.ok) return null;\n const body = (await res.json()) as Partial<ResumedCart>;\n if (!body.cartId || !Array.isArray(body.items) || body.items.length === 0) return null;\n return {\n cartId: body.cartId,\n items: body.items,\n unavailable: Array.isArray(body.unavailable) ? body.unavailable : [],\n promoCode: body.promoCode ?? null,\n subtotalCents: typeof body.subtotalCents === 'number' ? body.subtotalCents : 0,\n };\n } catch {\n return null;\n }\n}\n\n/** Read the `?cart=` token from the current URL. */\nexport function readCartToken(): string | null {\n try {\n const token = new URLSearchParams(window.location.search).get('cart');\n return token && token.length > 0 ? token : null;\n } catch {\n return null;\n }\n}\n\n/**\n * Drop `?cart=` from the address bar once it's been redeemed, so a refresh (or\n * a shared URL) doesn't re-run the restore over a cart the shopper has since\n * edited. History is replaced, not pushed — the token was never a page.\n */\nexport function stripCartToken(): void {\n try {\n const url = new URL(window.location.href);\n if (!url.searchParams.has('cart')) return;\n url.searchParams.delete('cart');\n window.history.replaceState({}, '', url.toString());\n } catch {\n /* no history API — leaving the param is harmless */\n }\n}\n"]}
@@ -12,7 +12,7 @@ import {
12
12
  setAffiliateTokens,
13
13
  setTokens,
14
14
  usersApi
15
- } from "./BI7NBPCA.jsx";
15
+ } from "./FAKJL3AD.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=Q2L3CZPR.jsx.map
417
+ //# sourceMappingURL=LON6ZV4S.jsx.map
@@ -1,6 +1,6 @@
1
- import { fetchFunnelConfig, postFunnelEvent, readResumeToken, fetchResumedDraft, stripResumeToken, adoptFunnelSessionId, saveFunnelDraft } from './WTQ63KR4.js';
2
- import { cart_default, medication_default, auth_default, affiliateAuth_default } from './XI4OZ4SZ.js';
3
- import { newIdempotencyKey, apexApi, usersApi, addressesApi, catalogApi, paymentsApi, subscriptionsApi, membersApi, supportApi, productsApi, affiliatePortalApi, adminApi, adminCatalogApi, adminProductPharmaciesApi, ApiError, ordersApi, adminCatalogConversionApi, messagesApi, authApi, adminProductStrengthMatchesApi } from './MUNFWRXF.js';
1
+ import { fetchFunnelConfig, postFunnelEvent, readResumeToken, fetchResumedDraft, stripResumeToken, adoptFunnelSessionId, saveFunnelDraft } from './5DNJWMSW.js';
2
+ import { cart_default, medication_default, auth_default, affiliateAuth_default } from './QJAMR6MG.js';
3
+ import { newIdempotencyKey, apexApi, usersApi, addressesApi, catalogApi, paymentsApi, subscriptionsApi, membersApi, supportApi, productsApi, affiliatePortalApi, adminApi, adminCatalogApi, adminProductPharmaciesApi, ApiError, ordersApi, adminCatalogConversionApi, messagesApi, authApi, adminProductStrengthMatchesApi } from './54ICTHZX.js';
4
4
  import { getConfig } from './2IFPDU4D.js';
5
5
  import { createSignal, onMount, createEffect, on, onCleanup, createResource, createMemo } from 'solid-js';
6
6
  import { useSurveyV2Flow as useSurveyV2Flow$1 } from '@apextelemed/survey-solid';
@@ -6485,5 +6485,5 @@ function useStrengthMatches(opts) {
6485
6485
  }
6486
6486
 
6487
6487
  export { ACCOUNT_SOURCE_LABEL, DEFAULT_COLOR_PALETTE, LIFECYCLE_BUCKETS, LIFECYCLE_LABEL, LIFECYCLE_TONE, LIVE_SUBSCRIPTION_STATUSES, MATCH_DEPENDENT_WARNINGS, MATCH_HOW_LABEL, ORPHAN_REASON, READINESS_LABEL, SOURCE_FIELD_NOTE, SUPPORT_CATEGORIES, TERMINAL_SUBSCRIPTION_STATUSES, US_STATES, US_STATE_OPTIONS, accountSource, addCatalogItemAsProduct, applyPriceDrafts, availableStateOptions, availableStates, bestOfferDiscount, buildFulfillmentRows, buildMatrixView, buildRefillView, buildSaveBody, buildStrengthRows, buildTimeline, buildTrackerView, buildTrackingUrl, canLeaveUnmatched, canOfferConversion, captureFunnelEmail, catalogUnavailableMessage, categoryColor, categoryLabel, classifyAddPharmacyError, classifyCatalogError, classifyConversionError, classifyStrengthMatchError, compareStrengths, createCatalogProduct, createFunnelTelemetry, decisionFromDetails, deriveAttention, deriveCatalogAvailabilityDecision, deriveJourney, describeConversion, doseIdOf, emailGateAnswered, explainFinding, findStoredDosePrice, firstAddressError, flaggedSubscribers, fmtDay, formatCalendarDate, formatCardNumber, formatConversationTime, formatCvv, formatEventDate, formatExpiry, formatMessageTime, formatRelativeTime, formatStageDate, groupDrugsByPharmacy, hasBlockers, hasConversion, hasErrors, hasStateRestrictions, initialMatches, intakeEvidence, invalidDraftKeys, isCatalogItemId, isCssColorValue, isImageAttachment, isLeftForReview, isLive, isQuestionVisible, isReconcilable, lifecycleReason, liveDoses, lowestPrice, lowestSalePrice, markEmailGateAnswered, matchBody, matchKey, matchProblem, matchValue, matchesComplete, missingPrices, moveInOrder, needsReview, normalizeMatches, normalizeState, normalizeStates, offerBeatsPromo, offerDurationText, offerSummaryText, orphanKey, parseMoney, pharmacyIsOnProduct, pharmacyLabel, primarySubscription, readinessStatus, reconcileCartAgainstCatalog, reconcileCartLines, redeemResumeLink, removeStoredDosePrice, resetResumeRedemption, resolveCategoryColor, resolveStrengthPrices, resolveSurveyV2DrugIntent, salePriceForBase, skuBindingModeFor, sourceKey, sourceLabel, stateAvailabilityNote, strengthsChanged, subscribeToSupportTopic, toChoices, toTrackerRequest, uploadPrescriptionPhoto, upsertDosePrice, useAddPharmacy, useAddressPair, useAffiliateConversions, useAffiliateDownline, useAffiliateLinks, useAffiliateStats, useCardTokenizer, useCartCheckoutFlow, useCartReconcile, useCatalog, useCatalogAvailability, useCatalogConversion, useCheckoutFlow, useDashboardData, useMedicationSelect, useMemberPortalData, useMessagesThread, useProductCatalogEditor, useProductDetail, useRegisterFlow, useSignupFlow, useStrengthMatches, useSubscribeFlow, useSurveyFlow, useSurveyV2Flow, useUpdatePaymentMethodFlow, validateAddress, visibleWarnings, wantsStrengthMatches };
6488
- //# sourceMappingURL=MQRPGAH7.js.map
6489
- //# sourceMappingURL=MQRPGAH7.js.map
6488
+ //# sourceMappingURL=Q7VYJUQC.js.map
6489
+ //# sourceMappingURL=Q7VYJUQC.js.map