@apextelemed/partner-core 0.17.0-dev.49 → 0.17.0-dev.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.js +3 -3
- package/dist/api/index.jsx +5 -3
- package/dist/chunk/{IXT445LX.jsx → 3SPMZ7FK.jsx} +2 -2
- package/dist/chunk/{XEWZ4OIT.jsx → 545PPOE5.jsx} +2 -2
- package/dist/chunk/{EBREONQA.js → ANKLNWGB.js} +6 -6
- package/dist/chunk/{EBREONQA.js.map → ANKLNWGB.js.map} +1 -1
- package/dist/chunk/{ATSYHZSR.js → AXXQJC6M.js} +3 -3
- package/dist/chunk/{ATSYHZSR.js.map → AXXQJC6M.js.map} +1 -1
- package/dist/chunk/{4YJF3J74.jsx → HM5L6J62.jsx} +2 -2
- package/dist/chunk/{U426ASG4.js → ICGZXU3R.js} +26 -4
- package/dist/chunk/ICGZXU3R.js.map +1 -0
- package/dist/chunk/{XER7JXKW.js → L4DFQMYM.js} +2211 -1487
- package/dist/chunk/L4DFQMYM.js.map +1 -0
- package/dist/chunk/{3VSVNZH3.js → LFSDVMIY.js} +414 -6
- package/dist/chunk/LFSDVMIY.js.map +1 -0
- package/dist/chunk/{MBHIL2QL.jsx → OZZGMI6C.jsx} +2052 -1632
- package/dist/chunk/{FFZOIYPO.jsx → P4NWFY4T.jsx} +5 -5
- package/dist/chunk/{MH43RC7G.jsx → PHSZOZVK.jsx} +25 -2
- package/dist/chunk/{B5722F4T.js → TFA64PLK.js} +3 -3
- package/dist/chunk/{B5722F4T.js.map → TFA64PLK.js.map} +1 -1
- package/dist/chunk/{HHCDX47F.jsx → VE5ACNFB.jsx} +429 -5
- package/dist/chunk/{GYEK4TSP.js → Z6PDUPOU.js} +3 -3
- package/dist/chunk/{GYEK4TSP.js.map → Z6PDUPOU.js.map} +1 -1
- package/dist/{client-DoCsuJj3.d.ts → client-Baf1FSEp.d.ts} +128 -2
- package/dist/flows/index.d.ts +204 -2
- package/dist/flows/index.js +6 -6
- package/dist/flows/index.jsx +30 -8
- package/dist/index/index.d.ts +2 -2
- package/dist/index/index.js +7 -7
- package/dist/index/index.jsx +33 -9
- package/dist/pages/index.d.ts +1 -1
- package/dist/pages/index.js +5 -5
- package/dist/pages/index.jsx +5 -5
- package/dist/stores/index.d.ts +1 -1
- package/dist/stores/index.js +2 -2
- package/dist/stores/index.jsx +2 -2
- package/package.json +1 -1
- package/dist/chunk/3VSVNZH3.js.map +0 -1
- package/dist/chunk/U426ASG4.js.map +0 -1
- package/dist/chunk/XER7JXKW.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getTokens } from './
|
|
1
|
+
import { getTokens } from './ICGZXU3R.js';
|
|
2
2
|
import { getConfig } from './2IFPDU4D.js';
|
|
3
3
|
|
|
4
4
|
// src/api/funnel.ts
|
|
@@ -138,5 +138,5 @@ function stripResumeToken() {
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
export { adoptFunnelSessionId, captureAuthHeader, fetchFunnelConfig, fetchResumedDraft, funnelSessionId, peekFunnelSessionId, postFunnelEvent, readResumeToken, resetFunnelConfigCache, saveFunnelDraft, stripResumeToken };
|
|
141
|
-
//# sourceMappingURL=
|
|
142
|
-
//# sourceMappingURL=
|
|
141
|
+
//# sourceMappingURL=Z6PDUPOU.js.map
|
|
142
|
+
//# sourceMappingURL=Z6PDUPOU.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/funnel.ts"],"names":[],"mappings":";;;;AAmBA,IAAM,WAAyB,EAAE,SAAA,EAAW,OAAO,SAAA,EAAW,KAAA,EAAO,mBAAmB,KAAA,EAAM;AAE9F,IAAI,aAAA,GAA8C,IAAA;AAM3C,SAAS,iBAAA,GAA2C;AACzD,EAAA,IAAI,CAAC,aAAA,EAAe;AAClB,IAAA,aAAA,GAAA,CAAiB,YAAY;AAC3B,MAAA,IAAI;AACF,QA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C7B,IAAA,IAAI,CAAC,KAAK,OAAA,IAAW,CAAC,MAAM,OAAA,CAAQ,IAAA,CAAK,OAAO,CAAA,EAAG,OAAO,IAAA;AAC1D,IAAA,OAAO;AAAA,MACL,SAAA,EAAW,MAAA,CAAO,IAAA,CAAK,SAAA,IAAa,EAAE,CAAA;AAAA,MACtC,SAAS,IAAA,CAAK,OAAA;AAAA,MACd,SAAS,IAAA,CAAK,OAAA;AAAA,MACd,WAAW,OAAO,IAAA,CAAK,SAAA,KAAc,QAAA,GAAW,KAAK,SAAA,GAAY;AAAA,KACnE;AAAA,EACF,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAGO,SAAS,eAAA,GAAiC;AAC/C,EAAA,IAAI;AACF,IAAA,MAAM,KAAA,GAAQ,IAAI,eAAA,CAAgB,MAAA,CAAO,SAAS,MAAM,CAAA,CAAE,IAAI,QAAQ,CAAA;AACtE,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;AAYO,SAAS,gBAAA,GAAyB;AACvC,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,QAAQ,CAAA,EAAG;AACrC,IAAA,GAAA,CAAI,YAAA,CAAa,OAAO,QAAQ,CAAA;AAChC,IAAA,MAAA,CAAO,QAAQ,YAAA,CAAa,IAAI,EAAA,EAAI,GAAA,CAAI,UAAU,CAAA;AAAA,EACpD,CAAA,CAAA,MAAQ;AAAA,EAER;AACF","file":"GYEK4TSP.js","sourcesContent":["import { getConfig } from '../config';\nimport { getTokens } from './client';\n\n// ── Funnel telemetry transport ──────────────────────────────────────────────\n//\n// Thin client for the-backend's abandoned-funnel capture endpoints:\n// GET /config/funnel → which capture features this tenant enabled\n// POST /funnel/events → survey-session telemetry sink\n//\n// Everything here is fire-and-forget and fail-silent: funnel capture is\n// marketing instrumentation, and it must never break or slow the survey.\n\nexport interface FunnelConfig {\n telemetry: boolean;\n emailGate: boolean;\n /** When true (tenant features.funnelEmailGateRequired), the gate offers no skip. */\n emailGateRequired: boolean;\n}\n\nconst DISABLED: FunnelConfig = { telemetry: false, emailGate: false, emailGateRequired: false };\n\nlet configPromise: Promise<FunnelConfig> | null = null;\n\n/**\n * The tenant's funnel-capture posture, fetched once per page load and cached.\n * Fails closed: any error reads as \"both off\".\n */\nexport function fetchFunnelConfig(): Promise<FunnelConfig> {\n if (!configPromise) {\n configPromise = (async () => {\n try {\n const cfg = getConfig();\n const res = await fetch(`${cfg.apiBase}/config/funnel`, {\n headers: { 'X-Tenant-Key': cfg.tenantKey },\n });\n if (!res.ok) return DISABLED;\n const body = (await res.json()) as Partial<FunnelConfig>;\n return {\n telemetry: body.telemetry === true,\n emailGate: body.emailGate === true,\n emailGateRequired: body.emailGateRequired === true,\n };\n } catch {\n return DISABLED;\n }\n })();\n }\n return configPromise;\n}\n\n/**\n * Continue an existing funnel session (resume-from-email): the emailed link\n * identifies the session that already holds this person's email and reminder\n * history, so adopting its id keeps everything on one row instead of forking a\n * new one that looks like a brand-new visitor.\n */\nexport function adoptFunnelSessionId(id: string): void {\n if (!id) return;\n try {\n sessionStorage.setItem(sessionIdKey(), id);\n } catch {\n /* storage unavailable — the session stays ephemeral */\n }\n}\n\n/** Test seam: forget the cached config so the next fetch re-resolves. */\nexport function resetFunnelConfigCache(): void {\n configPromise = null;\n}\n\nconst sessionIdKey = () => `${getConfig().storagePrefix}-funnel-session`;\n\n/**\n * Stable id for this survey session, minted on first use and kept in\n * sessionStorage — a refresh continues the same session (matching the survey\n * draft's resume behavior); a new tab or browser session starts a new one.\n */\nexport function funnelSessionId(): string {\n let id: string | null = null;\n try {\n id = sessionStorage.getItem(sessionIdKey());\n } catch {\n /* storage unavailable (private mode) — fall through to 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 sessionStorage.setItem(sessionIdKey(), id);\n } catch {\n /* ephemeral it is */\n }\n }\n return id;\n}\n\n/**\n * The current survey session id, or null — WITHOUT minting one.\n *\n * `funnelSessionId()` creates an id on first read, which is right for the\n * survey (asking means a survey is starting) and wrong for anything else. Cart\n * capture uses this to say \"if this shopper also has a survey session, here it\n * is\" — letting the backend borrow the email the gate already collected —\n * without conjuring survey sessions on a storefront that never runs one.\n */\nexport function peekFunnelSessionId(): string | null {\n try {\n return sessionStorage.getItem(sessionIdKey());\n } catch {\n return null;\n }\n}\n\n/**\n * The member's access token, when this browser has one.\n *\n * Read raw and never refreshed: these are fire-and-forget telemetry posts, and\n * a token refresh is a real network round-trip on the unload path. An expired\n * token is not a failure either — the sinks take it with `optionalAuth`, so a\n * stale one simply reads as an anonymous visitor, which is what we had before.\n */\nexport function captureAuthHeader(): Record<string, string> {\n try {\n const token = getTokens()?.accessToken;\n return token ? { Authorization: `Bearer ${token}` } : {};\n } catch {\n return {};\n }\n}\n\n/**\n * Fire-and-forget event post. `keepalive` lets the request survive a page\n * unload — which is exactly when the `abandoned` event is sent. (This is why\n * it's `fetch` and not `navigator.sendBeacon`: beacons can't carry the\n * X-Tenant-Key header the tenant-scoped mount requires — nor the bearer token\n * below.)\n *\n * The token identifies a signed-in member to the sink. Without it a member's\n * session is stored anonymously, and the pre-survey email gate — the only\n * other writer of a session's identity — is deliberately never shown to\n * someone already signed in, so their drop-off could never be attributed to\n * them. That is the whole population of a site where the account is created\n * before the questionnaire (savings-program signups, returning members\n * starting a second intake).\n */\nexport function postFunnelEvent(type: string, data?: Record<string, unknown>): void {\n try {\n const cfg = getConfig();\n void fetch(`${cfg.apiBase}/funnel/events`, {\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({ sessionId: funnelSessionId(), type, data }),\n }).catch(() => {});\n } catch {\n /* not configured yet — drop */\n }\n}\n\n// ── Survey drafts (cross-device resume) ─────────────────────────────────────\n\nexport interface FunnelDraftPayload {\n answers: Array<{ questionId: string; value: unknown }>;\n stepIndex: number;\n}\n\n/**\n * Save in-progress answers to Apex (through the-backend's embed proxy) and\n * return the draft id, so the next save updates the same row.\n *\n * Answers travel to the CLINICAL system — the partner backend stores only the\n * returned pointer. Returns null on any failure: a draft is best-effort, and\n * losing one costs a retype, never correctness.\n */\nexport async function saveFunnelDraft(\n draft: FunnelDraftPayload & { draftId?: string; drugIds?: string[]; templateId?: string; mode?: string },\n): Promise<string | null> {\n try {\n const cfg = getConfig();\n if (!cfg.apexEmbedApiBase) return null;\n const res = await fetch(`${cfg.apexEmbedApiBase}/v2/embed/surveys/drafts`, {\n method: 'PUT',\n headers: { 'Content-Type': 'application/json', 'X-Tenant-Key': cfg.tenantKey },\n body: JSON.stringify(draft),\n });\n if (!res.ok) return null;\n const body = (await res.json()) as { draftId?: string };\n return body.draftId ?? null;\n } catch {\n return null;\n }\n}\n\nexport interface ResumedDraft extends FunnelDraftPayload {\n sessionId: string;\n draftId: string;\n}\n\n/**\n * Exchange an emailed resume token for the saved answers.\n *\n * The token is the ONLY thing authorizing this read — the-backend verifies its\n * HMAC before fetching from Apex with credentials the browser never sees. A\n * 404 (expired, already submitted, tampered) resolves to null so the caller\n * simply starts a fresh survey.\n */\nexport async function fetchResumedDraft(token: string): Promise<ResumedDraft | null> {\n try {\n const cfg = getConfig();\n const res = await fetch(`${cfg.apiBase}/funnel/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<ResumedDraft>;\n if (!body.draftId || !Array.isArray(body.answers)) return null;\n return {\n sessionId: String(body.sessionId ?? ''),\n draftId: body.draftId,\n answers: body.answers,\n stepIndex: typeof body.stepIndex === 'number' ? body.stepIndex : 0,\n };\n } catch {\n return null;\n }\n}\n\n/** Read the `?resume=` token from the current URL. */\nexport function readResumeToken(): string | null {\n try {\n const token = new URLSearchParams(window.location.search).get('resume');\n return token && token.length > 0 ? token : null;\n } catch {\n return null;\n }\n}\n\n/**\n * Drop `?resume=` from the address bar once it has been redeemed.\n *\n * This token authorizes a read of someone's clinical answers, so leaving it in\n * the address bar is worse than leaving the cart's there: it gets bookmarked,\n * pasted into a support chat, or captured by whatever the patient's browser\n * syncs. The answers are mirrored into local storage on redemption, so a\n * refresh resumes from this device without it. History is replaced, not\n * pushed — the token was never a page.\n */\nexport function stripResumeToken(): void {\n try {\n const url = new URL(window.location.href);\n if (!url.searchParams.has('resume')) return;\n url.searchParams.delete('resume');\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/funnel.ts"],"names":[],"mappings":";;;;AAmBA,IAAM,WAAyB,EAAE,SAAA,EAAW,OAAO,SAAA,EAAW,KAAA,EAAO,mBAAmB,KAAA,EAAM;AAE9F,IAAI,aAAA,GAA8C,IAAA;AAM3C,SAAS,iBAAA,GAA2C;AACzD,EAAA,IAAI,CAAC,aAAA,EAAe;AAClB,IAAA,aAAA,GAAA,CAAiB,YAAY;AAC3B,MAAA,IAAI;AACF,QAAA,MAAM,MAAM,SAAA,EAAU;AACtB,QAAA,MAAM,MAAM,MAAM,KAAA,CAAM,CAAA,EAAG,GAAA,CAAI,OAAO,CAAA,cAAA,CAAA,EAAkB;AAAA,UACtD,OAAA,EAAS,EAAE,cAAA,EAAgB,GAAA,CAAI,SAAA;AAAU,SAC1C,CAAA;AACD,QAAA,IAAI,CAAC,GAAA,CAAI,EAAA,EAAI,OAAO,QAAA;AACpB,QAAA,MAAM,IAAA,GAAQ,MAAM,GAAA,CAAI,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c,QAAA,GAAW,KAAK,SAAA,GAAY;AAAA,KACnE;AAAA,EACF,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAGO,SAAS,eAAA,GAAiC;AAC/C,EAAA,IAAI;AACF,IAAA,MAAM,KAAA,GAAQ,IAAI,eAAA,CAAgB,MAAA,CAAO,SAAS,MAAM,CAAA,CAAE,IAAI,QAAQ,CAAA;AACtE,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;AAYO,SAAS,gBAAA,GAAyB;AACvC,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,QAAQ,CAAA,EAAG;AACrC,IAAA,GAAA,CAAI,YAAA,CAAa,OAAO,QAAQ,CAAA;AAChC,IAAA,MAAA,CAAO,QAAQ,YAAA,CAAa,IAAI,EAAA,EAAI,GAAA,CAAI,UAAU,CAAA;AAAA,EACpD,CAAA,CAAA,MAAQ;AAAA,EAER;AACF","file":"Z6PDUPOU.js","sourcesContent":["import { getConfig } from '../config';\nimport { getTokens } from './client';\n\n// ── Funnel telemetry transport ──────────────────────────────────────────────\n//\n// Thin client for the-backend's abandoned-funnel capture endpoints:\n// GET /config/funnel → which capture features this tenant enabled\n// POST /funnel/events → survey-session telemetry sink\n//\n// Everything here is fire-and-forget and fail-silent: funnel capture is\n// marketing instrumentation, and it must never break or slow the survey.\n\nexport interface FunnelConfig {\n telemetry: boolean;\n emailGate: boolean;\n /** When true (tenant features.funnelEmailGateRequired), the gate offers no skip. */\n emailGateRequired: boolean;\n}\n\nconst DISABLED: FunnelConfig = { telemetry: false, emailGate: false, emailGateRequired: false };\n\nlet configPromise: Promise<FunnelConfig> | null = null;\n\n/**\n * The tenant's funnel-capture posture, fetched once per page load and cached.\n * Fails closed: any error reads as \"both off\".\n */\nexport function fetchFunnelConfig(): Promise<FunnelConfig> {\n if (!configPromise) {\n configPromise = (async () => {\n try {\n const cfg = getConfig();\n const res = await fetch(`${cfg.apiBase}/config/funnel`, {\n headers: { 'X-Tenant-Key': cfg.tenantKey },\n });\n if (!res.ok) return DISABLED;\n const body = (await res.json()) as Partial<FunnelConfig>;\n return {\n telemetry: body.telemetry === true,\n emailGate: body.emailGate === true,\n emailGateRequired: body.emailGateRequired === true,\n };\n } catch {\n return DISABLED;\n }\n })();\n }\n return configPromise;\n}\n\n/**\n * Continue an existing funnel session (resume-from-email): the emailed link\n * identifies the session that already holds this person's email and reminder\n * history, so adopting its id keeps everything on one row instead of forking a\n * new one that looks like a brand-new visitor.\n */\nexport function adoptFunnelSessionId(id: string): void {\n if (!id) return;\n try {\n sessionStorage.setItem(sessionIdKey(), id);\n } catch {\n /* storage unavailable — the session stays ephemeral */\n }\n}\n\n/** Test seam: forget the cached config so the next fetch re-resolves. */\nexport function resetFunnelConfigCache(): void {\n configPromise = null;\n}\n\nconst sessionIdKey = () => `${getConfig().storagePrefix}-funnel-session`;\n\n/**\n * Stable id for this survey session, minted on first use and kept in\n * sessionStorage — a refresh continues the same session (matching the survey\n * draft's resume behavior); a new tab or browser session starts a new one.\n */\nexport function funnelSessionId(): string {\n let id: string | null = null;\n try {\n id = sessionStorage.getItem(sessionIdKey());\n } catch {\n /* storage unavailable (private mode) — fall through to 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 sessionStorage.setItem(sessionIdKey(), id);\n } catch {\n /* ephemeral it is */\n }\n }\n return id;\n}\n\n/**\n * The current survey session id, or null — WITHOUT minting one.\n *\n * `funnelSessionId()` creates an id on first read, which is right for the\n * survey (asking means a survey is starting) and wrong for anything else. Cart\n * capture uses this to say \"if this shopper also has a survey session, here it\n * is\" — letting the backend borrow the email the gate already collected —\n * without conjuring survey sessions on a storefront that never runs one.\n */\nexport function peekFunnelSessionId(): string | null {\n try {\n return sessionStorage.getItem(sessionIdKey());\n } catch {\n return null;\n }\n}\n\n/**\n * The member's access token, when this browser has one.\n *\n * Read raw and never refreshed: these are fire-and-forget telemetry posts, and\n * a token refresh is a real network round-trip on the unload path. An expired\n * token is not a failure either — the sinks take it with `optionalAuth`, so a\n * stale one simply reads as an anonymous visitor, which is what we had before.\n */\nexport function captureAuthHeader(): Record<string, string> {\n try {\n const token = getTokens()?.accessToken;\n return token ? { Authorization: `Bearer ${token}` } : {};\n } catch {\n return {};\n }\n}\n\n/**\n * Fire-and-forget event post. `keepalive` lets the request survive a page\n * unload — which is exactly when the `abandoned` event is sent. (This is why\n * it's `fetch` and not `navigator.sendBeacon`: beacons can't carry the\n * X-Tenant-Key header the tenant-scoped mount requires — nor the bearer token\n * below.)\n *\n * The token identifies a signed-in member to the sink. Without it a member's\n * session is stored anonymously, and the pre-survey email gate — the only\n * other writer of a session's identity — is deliberately never shown to\n * someone already signed in, so their drop-off could never be attributed to\n * them. That is the whole population of a site where the account is created\n * before the questionnaire (savings-program signups, returning members\n * starting a second intake).\n */\nexport function postFunnelEvent(type: string, data?: Record<string, unknown>): void {\n try {\n const cfg = getConfig();\n void fetch(`${cfg.apiBase}/funnel/events`, {\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({ sessionId: funnelSessionId(), type, data }),\n }).catch(() => {});\n } catch {\n /* not configured yet — drop */\n }\n}\n\n// ── Survey drafts (cross-device resume) ─────────────────────────────────────\n\nexport interface FunnelDraftPayload {\n answers: Array<{ questionId: string; value: unknown }>;\n stepIndex: number;\n}\n\n/**\n * Save in-progress answers to Apex (through the-backend's embed proxy) and\n * return the draft id, so the next save updates the same row.\n *\n * Answers travel to the CLINICAL system — the partner backend stores only the\n * returned pointer. Returns null on any failure: a draft is best-effort, and\n * losing one costs a retype, never correctness.\n */\nexport async function saveFunnelDraft(\n draft: FunnelDraftPayload & { draftId?: string; drugIds?: string[]; templateId?: string; mode?: string },\n): Promise<string | null> {\n try {\n const cfg = getConfig();\n if (!cfg.apexEmbedApiBase) return null;\n const res = await fetch(`${cfg.apexEmbedApiBase}/v2/embed/surveys/drafts`, {\n method: 'PUT',\n headers: { 'Content-Type': 'application/json', 'X-Tenant-Key': cfg.tenantKey },\n body: JSON.stringify(draft),\n });\n if (!res.ok) return null;\n const body = (await res.json()) as { draftId?: string };\n return body.draftId ?? null;\n } catch {\n return null;\n }\n}\n\nexport interface ResumedDraft extends FunnelDraftPayload {\n sessionId: string;\n draftId: string;\n}\n\n/**\n * Exchange an emailed resume token for the saved answers.\n *\n * The token is the ONLY thing authorizing this read — the-backend verifies its\n * HMAC before fetching from Apex with credentials the browser never sees. A\n * 404 (expired, already submitted, tampered) resolves to null so the caller\n * simply starts a fresh survey.\n */\nexport async function fetchResumedDraft(token: string): Promise<ResumedDraft | null> {\n try {\n const cfg = getConfig();\n const res = await fetch(`${cfg.apiBase}/funnel/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<ResumedDraft>;\n if (!body.draftId || !Array.isArray(body.answers)) return null;\n return {\n sessionId: String(body.sessionId ?? ''),\n draftId: body.draftId,\n answers: body.answers,\n stepIndex: typeof body.stepIndex === 'number' ? body.stepIndex : 0,\n };\n } catch {\n return null;\n }\n}\n\n/** Read the `?resume=` token from the current URL. */\nexport function readResumeToken(): string | null {\n try {\n const token = new URLSearchParams(window.location.search).get('resume');\n return token && token.length > 0 ? token : null;\n } catch {\n return null;\n }\n}\n\n/**\n * Drop `?resume=` from the address bar once it has been redeemed.\n *\n * This token authorizes a read of someone's clinical answers, so leaving it in\n * the address bar is worse than leaving the cart's there: it gets bookmarked,\n * pasted into a support chat, or captured by whatever the patient's browser\n * syncs. The answers are mirrored into local storage on redemption, so a\n * refresh resumes from this device without it. History is replaced, not\n * pushed — the token was never a page.\n */\nexport function stripResumeToken(): void {\n try {\n const url = new URL(window.location.href);\n if (!url.searchParams.has('resume')) return;\n url.searchParams.delete('resume');\n window.history.replaceState({}, '', url.toString());\n } catch {\n /* no history API — leaving the param is harmless */\n }\n}\n"]}
|
|
@@ -523,11 +523,15 @@ declare class ApiError extends Error {
|
|
|
523
523
|
/** Machine-readable error code from the response body, when the endpoint
|
|
524
524
|
* sends one (e.g. `SUBSCRIPTION_EXISTS`). Branch on this, never on message. */
|
|
525
525
|
readonly code?: string;
|
|
526
|
+
/** The response body's `details`, untouched, for the few refusals whose
|
|
527
|
+
* specifics a caller acts on (e.g. which prices are missing). Never shown as prose. */
|
|
528
|
+
readonly details?: unknown;
|
|
526
529
|
constructor(message: string, opts?: {
|
|
527
530
|
status?: number;
|
|
528
531
|
ambiguous?: boolean;
|
|
529
532
|
cause?: unknown;
|
|
530
533
|
code?: string;
|
|
534
|
+
details?: unknown;
|
|
531
535
|
});
|
|
532
536
|
}
|
|
533
537
|
/**
|
|
@@ -1252,9 +1256,25 @@ interface AdminProduct {
|
|
|
1252
1256
|
orphanedDosePrices?: AdminOrphanedDosePrice[];
|
|
1253
1257
|
/** Something the product offers cannot be sold for want of a price. */
|
|
1254
1258
|
needsPrice?: boolean;
|
|
1259
|
+
/** The product is prescribed (filled by a pharmacy). Absent on an older backend. */
|
|
1260
|
+
prescribed?: boolean;
|
|
1261
|
+
/** The pharmacies that fill the product, ranked (1 = first). A product that
|
|
1262
|
+
* is not yet on several pharmacies has exactly one entry with a null
|
|
1263
|
+
* `fulfillmentId`. `null` = unknown (the prescribing platform couldn't be
|
|
1264
|
+
* asked) or the product isn't prescribed. */
|
|
1265
|
+
pharmacies?: AdminProductPharmacy[] | null;
|
|
1266
|
+
}
|
|
1267
|
+
interface AdminProductPharmacy {
|
|
1268
|
+
fulfillmentId: string | null;
|
|
1269
|
+
pharmacyId: string | null;
|
|
1270
|
+
pharmacyName: string | null;
|
|
1271
|
+
drugId: string;
|
|
1272
|
+
drugName: string | null;
|
|
1273
|
+
rank: number;
|
|
1274
|
+
enabled: boolean;
|
|
1255
1275
|
}
|
|
1256
1276
|
/** Read-only fields the backend derives from Apex; never sent on a write. */
|
|
1257
|
-
type AdminProductOverlayField = 'catalogOverlay' | 'apexItemStatus' | 'strengths' | 'orphanedDosePrices' | 'needsPrice';
|
|
1277
|
+
type AdminProductOverlayField = 'prescribed' | 'pharmacies' | 'catalogOverlay' | 'apexItemStatus' | 'strengths' | 'orphanedDosePrices' | 'needsPrice';
|
|
1258
1278
|
type AdminApexItemStatus = 'ok' | 'missing' | 'unavailable' | 'none';
|
|
1259
1279
|
interface AdminProductStrength {
|
|
1260
1280
|
dosage: string;
|
|
@@ -1970,6 +1990,112 @@ declare const adminCatalogConversionApi: {
|
|
|
1970
1990
|
/** Puts a converted product back as it was. Does not undo everything — read `notUndone`. */
|
|
1971
1991
|
undo(productId: string, options?: CatalogConversionUndoOptions): Promise<CatalogConversionUndoResult>;
|
|
1972
1992
|
};
|
|
1993
|
+
interface AddPharmacyFinding {
|
|
1994
|
+
code: string;
|
|
1995
|
+
check: string;
|
|
1996
|
+
message: string;
|
|
1997
|
+
rowCount: number;
|
|
1998
|
+
rows: unknown[];
|
|
1999
|
+
truncated: boolean;
|
|
2000
|
+
/** `ops` findings are for operators; the admin UI never shows them. */
|
|
2001
|
+
audience: 'admin' | 'ops';
|
|
2002
|
+
}
|
|
2003
|
+
interface AddPharmacyStrengthBefore {
|
|
2004
|
+
dosage: string;
|
|
2005
|
+
price: number | null;
|
|
2006
|
+
}
|
|
2007
|
+
interface AddPharmacyStrengthAfter {
|
|
2008
|
+
doseId: string | null;
|
|
2009
|
+
dosage: string;
|
|
2010
|
+
price: number | null;
|
|
2011
|
+
priceSource: 'dose' | 'base' | 'added' | null;
|
|
2012
|
+
needsPrice: boolean;
|
|
2013
|
+
}
|
|
2014
|
+
interface AddPharmacyPlan {
|
|
2015
|
+
productId: string;
|
|
2016
|
+
/** `convert`: this save also moves a single-pharmacy product onto a multi-pharmacy
|
|
2017
|
+
* item. The admin is never told; it only decides how long the save takes. */
|
|
2018
|
+
kind: 'add' | 'convert';
|
|
2019
|
+
pharmacy: {
|
|
2020
|
+
drugId: string;
|
|
2021
|
+
drugName: string;
|
|
2022
|
+
pharmacyId: string | null;
|
|
2023
|
+
pharmacyName: string | null;
|
|
2024
|
+
};
|
|
2025
|
+
/** The save can go ahead (once `pricesRequired` are supplied). */
|
|
2026
|
+
ready: boolean;
|
|
2027
|
+
blockers: AddPharmacyFinding[];
|
|
2028
|
+
warnings: AddPharmacyFinding[];
|
|
2029
|
+
strengthsBefore: AddPharmacyStrengthBefore[];
|
|
2030
|
+
strengthsAfter: AddPharmacyStrengthAfter[];
|
|
2031
|
+
/** The admin must enter a price for each. */
|
|
2032
|
+
pricesRequired: Array<{
|
|
2033
|
+
doseId: string;
|
|
2034
|
+
dosage: string;
|
|
2035
|
+
suggestedPrice: number | null;
|
|
2036
|
+
}>;
|
|
2037
|
+
/** Applied automatically; informational. */
|
|
2038
|
+
autoPrices: Array<{
|
|
2039
|
+
doseId: string;
|
|
2040
|
+
price: number;
|
|
2041
|
+
savingsPrice: number | null;
|
|
2042
|
+
}>;
|
|
2043
|
+
/** Sent back with the save. Null on `kind: 'add'`. */
|
|
2044
|
+
planHash: string | null;
|
|
2045
|
+
/**
|
|
2046
|
+
* Old strengths that subscribers are on and that matched no new strength by
|
|
2047
|
+
* themselves (typical for GLP-1 vials against mg doses). `doseId` echoes the
|
|
2048
|
+
* answer the plan was computed with; null = left for review.
|
|
2049
|
+
*/
|
|
2050
|
+
matchQuestions: AddPharmacyMatchQuestion[];
|
|
2051
|
+
/** The strengths a `matchQuestions` answer can pick. */
|
|
2052
|
+
doseOptions: AddPharmacyDoseOption[];
|
|
2053
|
+
}
|
|
2054
|
+
/** The old strength a subscriber is on: identifies a match question, and is echoed back in `doseMatches`. */
|
|
2055
|
+
interface AddPharmacyMatchSource {
|
|
2056
|
+
dosage: string | null;
|
|
2057
|
+
apexSkuId: string | null;
|
|
2058
|
+
}
|
|
2059
|
+
interface AddPharmacyMatchQuestion {
|
|
2060
|
+
source: AddPharmacyMatchSource;
|
|
2061
|
+
dosage: string | null;
|
|
2062
|
+
subscriberCount: number;
|
|
2063
|
+
price: number | null;
|
|
2064
|
+
doseId: string | null;
|
|
2065
|
+
}
|
|
2066
|
+
interface AddPharmacyDoseOption {
|
|
2067
|
+
doseId: string;
|
|
2068
|
+
label: string;
|
|
2069
|
+
}
|
|
2070
|
+
/** The admin's answer to one match question; `doseId: null` leaves those subscribers for review. */
|
|
2071
|
+
interface AddPharmacyDoseMatch {
|
|
2072
|
+
source: AddPharmacyMatchSource;
|
|
2073
|
+
doseId: string | null;
|
|
2074
|
+
}
|
|
2075
|
+
interface AddPharmacyPrice {
|
|
2076
|
+
doseId: string;
|
|
2077
|
+
price: number;
|
|
2078
|
+
savingsPrice?: number;
|
|
2079
|
+
}
|
|
2080
|
+
interface AddPharmacyBody {
|
|
2081
|
+
drugId: string;
|
|
2082
|
+
planHash?: string;
|
|
2083
|
+
prices?: AddPharmacyPrice[];
|
|
2084
|
+
/** Answers to the plan's `matchQuestions` (only the answered ones). */
|
|
2085
|
+
doseMatches?: AddPharmacyDoseMatch[];
|
|
2086
|
+
}
|
|
2087
|
+
interface AddPharmacyResult {
|
|
2088
|
+
status: 'added' | 'converted';
|
|
2089
|
+
productId: string;
|
|
2090
|
+
fulfillmentId: string | null;
|
|
2091
|
+
message: string;
|
|
2092
|
+
}
|
|
2093
|
+
declare const adminProductPharmaciesApi: {
|
|
2094
|
+
/** What adding this pharmacy drug would do. Read-only for the admin; safe to repeat. */
|
|
2095
|
+
plan(productId: string, drugId: string, doseMatches?: AddPharmacyDoseMatch[]): Promise<AddPharmacyPlan>;
|
|
2096
|
+
/** Adds it. Up to ~40 seconds on a single-pharmacy product; never retry blindly — re-read the product first. */
|
|
2097
|
+
add(productId: string, body: AddPharmacyBody): Promise<AddPharmacyResult>;
|
|
2098
|
+
};
|
|
1973
2099
|
declare const adminApi: {
|
|
1974
2100
|
getDashboard(): Promise<AdminDashboardStats>;
|
|
1975
2101
|
getRecurringRevenue(): Promise<AdminRecurringRevenue>;
|
|
@@ -2756,4 +2882,4 @@ declare const affiliatePortalApi: {
|
|
|
2756
2882
|
track(refCode: string, landingPage?: string): Promise<AffiliateTrackResponse>;
|
|
2757
2883
|
};
|
|
2758
2884
|
|
|
2759
|
-
export { type
|
|
2885
|
+
export { type AdminScheduledRefund as $, type AddPharmacyBody as A, type AdminCustomerSupportThread as B, type AdminDashboardStats as C, type AdminLifecycle as D, type AdminLifecycleBucket as E, type AdminListParams as F, type AdminOffer as G, type AdminOfferBase as H, type AdminOfferGrant as I, type AdminOfferGrantBase as J, type AdminOfferInput as K, type AdminOrderSummary as L, type AdminOrphanReason as M, type AdminOrphanedDosePrice as N, type AdminPayment as O, type AdminPaymentDetail as P, type AdminProduct as Q, type AdminProductOverlayField as R, type AdminProductPharmacy as S, type AdminProductStrength as T, type AdminPromoCode as U, type AdminPromoCodeInput as V, type AdminRecurringPricePoint as W, type AdminRecurringRevenue as X, type AdminRefundResult as Y, type AdminSale as Z, type AdminSaleInput as _, type AddPharmacyDoseMatch as a, type CategoryMetadata as a$, type AdminScheduledRefundProblem as a0, type AdminSubscription as a1, type AdminSubscriptionDetail as a2, type AdminSubscriptionPatch as a3, type AdminSubscriptionWriteResult as a4, type AdminSupportCustomer as a5, type AdminSupportStats as a6, type AdminSupportThread as a7, type AdminWebhookEvent as a8, type Affiliate as a9, type CatalogConversionCommitResult as aA, type CatalogConversionDose as aB, type CatalogConversionDoseMatch as aC, type CatalogConversionFinding as aD, type CatalogConversionPointers as aE, type CatalogConversionPrepareResult as aF, type CatalogConversionPreview as aG, type CatalogConversionRun as aH, type CatalogConversionSource as aI, type CatalogConversionStage as aJ, type CatalogConversionTarget as aK, type CatalogConversionUndoOptions as aL, type CatalogConversionUndoResult as aM, type CatalogDose as aN, type CatalogDoseInput as aO, type CatalogDoseModel as aP, type CatalogDoseSuggestion as aQ, type CatalogDoseSuggestions as aR, type CatalogEquivalentSuggestions as aS, type CatalogFulfillment as aT, type CatalogFulfillmentInput as aU, type CatalogItem as aV, type CatalogItemInput as aW, type CatalogMappableDrug as aX, type CatalogMatrixCell as aY, type CatalogProduct as aZ, type CatalogReadiness as a_, type AffiliateAuthTokens as aa, type AffiliateClickRecord as ab, type AffiliateConversion as ac, type AffiliateDashboardLinks as ad, type AffiliateDashboardProfile as ae, type AffiliateDashboardStats as af, type AffiliateDownlineMember as ag, type AffiliateEarningsBreakdown as ah, type AffiliatePaymentMethod as ai, type AffiliateProgram as aj, type AffiliateRegisterInput as ak, type AffiliateRegisterResponse as al, type AffiliateSession as am, type AffiliateStatsResponse as an, type AffiliateStatus as ao, type AffiliateTrackResponse as ap, ApiError as aq, type ApiResponse as ar, type AttributionMethod as as, type AuthTokens as at, type BillingReminderSettings as au, type CatalogAvailabilityItem as av, type CatalogAvailabilityReason as aw, type CatalogAvailabilityResult as ax, type CatalogClassification as ay, type CatalogConversionChoice as az, type AddPharmacyDoseOption as b, type TenantFeatureAccess as b$, type CheckoutAddress as b0, type CheckoutPayload as b1, type CheckoutResult as b2, type CommissionConfig as b3, type CommissionStatus as b4, type CompleteSurveyPayload as b5, type CreateAffiliatePayload as b6, type CreateAffiliateProgramPayload as b7, type CreateOrderPayload as b8, type CreateRequestPayload as b9, type PlaceholderKind as bA, type ProductSaleSummary as bB, type PromoValidationResponse as bC, type PublicCategory as bD, type RegisterAndSubscribePayload as bE, type RegisterPayload as bF, type RenewalStatus as bG, SUPPORT_ATTACHMENT_MAX_BYTES as bH, SUPPORT_ATTACHMENT_MIME_TYPES as bI, type SelectDrugPayload as bJ, type SendMessagePayload as bK, type SendToPharmacyPayload as bL, type SubscriptionPreview as bM, type SubscriptionPreviewLine as bN, type SubscriptionPreviewPayload as bO, type SupportAttachment as bP, type SupportChannel as bQ, type SupportChannelSettings as bR, type SupportMessage as bS, type SupportRealtimeToken as bT, type SupportThread as bU, type SupportThreadCategory as bV, type SupportThreadStatus as bW, type SurveySubmitPayload as bX, type TemplatePlaceholdersMap as bY, type TemplateText as bZ, type TenantFeature as b_, type CreateSubscriptionPayload as ba, type CustomTemplate as bb, type CustomTemplateInput as bc, type CustomerDiscountConfig as bd, type DeliveryInfo as be, type DiscountType as bf, type EmailNotificationSettings as bg, type EmailTemplatesMap as bh, type LoginPayload as bi, type MemberOffer as bj, type MemberPrescriptionRequest as bk, type MemberSurveyMode as bl, type MemberSurveyResponseSummary as bm, type MemberSurveyTranscript as bn, type MemberSurveyTranscriptItem as bo, type MemberSurveyTranscriptSection as bp, type MembersMeResponse as bq, type OfferGrantState as br, type Order as bs, type OrderItemInput as bt, type PaginationParams as bu, type PaymentCallbackPayload as bv, type PaymentInitiatePayload as bw, type PaymentType as bx, type PendingRenewalSurvey as by, type Placeholder as bz, type AddPharmacyFinding as c, type TokenTrackName as c0, type UpdateAffiliatePayload as c1, type UpdateAffiliateProgramPayload as c2, type UpdatePaymentMethodPayload as c3, type UpdateProfilePayload as c4, type User as c5, addressesApi as c6, adminAffiliatesApi as c7, adminApi as c8, adminCatalogApi as c9, usersApi as cA, adminCatalogConversionApi as ca, adminProductPharmaciesApi as cb, affiliateAuthStorageKey as cc, affiliatePortalApi as cd, apexApi as ce, apiFetch as cf, authApi as cg, authStorageKey as ch, catalogApi as ci, clearAffiliateTokens as cj, clearTokens as ck, getAffiliateTokens as cl, getTokens as cm, membersApi as cn, messagesApi as co, newIdempotencyKey as cp, offersApi as cq, onTokensCleared as cr, ordersApi as cs, paymentsApi as ct, productsApi as cu, promoCodesApi as cv, setAffiliateTokens as cw, setTokens as cx, subscriptionsApi as cy, supportApi as cz, type AddPharmacyMatchQuestion as d, type AddPharmacyMatchSource as e, type AddPharmacyPlan as f, type AddPharmacyPrice as g, type AddPharmacyResult as h, type AddPharmacyStrengthAfter as i, type AddPharmacyStrengthBefore as j, type AddressVerifyResult as k, type AdminApexDrug as l, type AdminApexItemStatus as m, type AdminBillingAttempt as n, type AdminCategory as o, type AdminCategoryInput as p, type AdminCategoryUpdate as q, type AdminCustomer as r, type AdminCustomerFacts as s, type AdminCustomerFunnel as t, type AdminCustomerListParams as u, type AdminCustomerOverview as v, type AdminCustomerProfile as w, type AdminCustomerRequest as x, type AdminCustomerRow as y, type AdminCustomerSupport as z };
|
package/dist/flows/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Accessor, Resource } from 'solid-js';
|
|
2
|
-
import {
|
|
2
|
+
import { k as AddressVerifyResult, b0 as CheckoutAddress, ax as CatalogAvailabilityResult, c5 as User, be as DeliveryInfo, bG as RenewalStatus, by as PendingRenewalSurvey, E as AdminLifecycleBucket, v as AdminCustomerOverview, a2 as AdminSubscriptionDetail, x as AdminCustomerRequest, bV as SupportThreadCategory, bQ as SupportChannel, aZ as CatalogProduct, ac as AffiliateConversion, ag as AffiliateDownlineMember, ad as AffiliateDashboardLinks, af as AffiliateDashboardStats, bC as PromoValidationResponse, bj as MemberOffer, ay as CatalogClassification, aP as CatalogDoseModel, N as AdminOrphanedDosePrice, Q as AdminProduct, aV as CatalogItem, aQ as CatalogDoseSuggestion, aX as CatalogMappableDrug, aS as CatalogEquivalentSuggestions, a_ as CatalogReadiness, aM as CatalogConversionUndoResult, aG as CatalogConversionPreview, aC as CatalogConversionDoseMatch, aI as CatalogConversionSource, aB as CatalogConversionDose, aL as CatalogConversionUndoOptions, aA as CatalogConversionCommitResult, aD as CatalogConversionFinding, az as CatalogConversionChoice, f as AddPharmacyPlan, h as AddPharmacyResult, e as AddPharmacyMatchSource, A as AddPharmacyBody, c as AddPharmacyFinding } from '../client-Baf1FSEp.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';
|
|
@@ -2391,6 +2391,208 @@ interface MatchRow {
|
|
|
2391
2391
|
}
|
|
2392
2392
|
declare function useCatalogConversion(opts: UseCatalogConversionOptions): CatalogConversion;
|
|
2393
2393
|
|
|
2394
|
+
/**
|
|
2395
|
+
* "Add pharmacy": the one way an admin gives a prescribed product another
|
|
2396
|
+
* pharmacy, whatever the product is today — the headless flow behind the
|
|
2397
|
+
* product editor's Pharmacies section.
|
|
2398
|
+
*
|
|
2399
|
+
* idle → picking → planning → reviewing → saving → done
|
|
2400
|
+
* ↘ failed ↙ ↖ (plan changed: planning again)
|
|
2401
|
+
*
|
|
2402
|
+
* The server decides what an add takes. On a product that fills at a single
|
|
2403
|
+
* pharmacy it also moves the product onto a multi-pharmacy item, behind the
|
|
2404
|
+
* scenes; the plan says so only as `kind: 'convert'`, and nothing here (or in
|
|
2405
|
+
* the screen) says it to the admin. What the admin sees is the pharmacy, the
|
|
2406
|
+
* strengths and prices before and after, and any decision they owe.
|
|
2407
|
+
*
|
|
2408
|
+
* Rules this flow keeps:
|
|
2409
|
+
*
|
|
2410
|
+
* - The server's plan is the only thing that decides what can be saved. The
|
|
2411
|
+
* save carries the plan's `planHash`; when the plan moved on (`plan_changed`,
|
|
2412
|
+
* `plan_first`) the flow plans again by itself and returns to review with a
|
|
2413
|
+
* notice. Prices typed for a strength that is still owed are kept.
|
|
2414
|
+
* - A save is never retried blindly. After a failure whose outcome is not
|
|
2415
|
+
* known (a dropped connection, a proxy timeout, a 5xx) the product is
|
|
2416
|
+
* re-read: if the pharmacy is on it now the add is done; if not, the admin
|
|
2417
|
+
* is offered a re-check, or to start again from a fresh plan.
|
|
2418
|
+
* - A plan that needs no decision (no blockers, no admin-facing warnings, no
|
|
2419
|
+
* price owed, strengths unchanged) is a single confirm step: `needsReview`.
|
|
2420
|
+
* - `ops` findings are for operators and never reach the screen.
|
|
2421
|
+
* - Subscribers on a strength that matched no new one ("match questions") are
|
|
2422
|
+
* the admin's to place. Each answer re-plans (debounced; only the latest
|
|
2423
|
+
* response is adopted; saving waits), because an answered strength carries
|
|
2424
|
+
* its price over and so changes what is owed. Typed prices are kept. The
|
|
2425
|
+
* answers ride along on the save, and on a `plan_changed` re-plan.
|
|
2426
|
+
*
|
|
2427
|
+
* The decision logic (what to show, what is missing, the save body, error
|
|
2428
|
+
* sorting) is exported as pure functions and tested without a component tree.
|
|
2429
|
+
*/
|
|
2430
|
+
|
|
2431
|
+
/** The admin's answers to match questions, by `matchKey`. A key is present once answered; null = leave for review. */
|
|
2432
|
+
type MatchAnswers = Readonly<Record<string, string | null>>;
|
|
2433
|
+
/** The warnings an admin should read. `ops` findings are for operators. */
|
|
2434
|
+
declare function visibleWarnings(plan: Pick<AddPharmacyPlan, 'warnings'>): AddPharmacyFinding[];
|
|
2435
|
+
/** A price as typed: a positive amount of at most two decimals. Null = blank or not valid. */
|
|
2436
|
+
declare function parseMoney(raw: string | undefined): number | null;
|
|
2437
|
+
/** The doses the plan asks a price for that have no valid one typed yet. */
|
|
2438
|
+
declare function missingPrices(plan: Pick<AddPharmacyPlan, 'pricesRequired'>, prices: Readonly<Record<string, string>>): string[];
|
|
2439
|
+
/** Whether the strengths a customer can buy differ after the save (by dosage, then price). */
|
|
2440
|
+
declare function strengthsChanged(plan: Pick<AddPharmacyPlan, 'strengthsBefore' | 'strengthsAfter'>): boolean;
|
|
2441
|
+
/**
|
|
2442
|
+
* True when the admin has something to read or decide: a blocker, an
|
|
2443
|
+
* admin-facing warning, a price owed, or strengths that change. False means one
|
|
2444
|
+
* confirm step is enough.
|
|
2445
|
+
*/
|
|
2446
|
+
declare function needsReview(plan: AddPharmacyPlan): boolean;
|
|
2447
|
+
interface StrengthComparison {
|
|
2448
|
+
dosage: string;
|
|
2449
|
+
/** What a customer pays now: a price, `null` for a strength with no price, `undefined` for one not sold yet. */
|
|
2450
|
+
before: number | null | undefined;
|
|
2451
|
+
/** What a customer pays after the save: a price, or `null` when it still needs one. */
|
|
2452
|
+
after: number | null;
|
|
2453
|
+
/** Not sold now, sold after. */
|
|
2454
|
+
isNew: boolean;
|
|
2455
|
+
}
|
|
2456
|
+
/** "Now" against "after saving", one row per strength: today's strengths first, then the new ones. */
|
|
2457
|
+
declare function compareStrengths(plan: Pick<AddPharmacyPlan, 'strengthsBefore' | 'strengthsAfter'>): StrengthComparison[];
|
|
2458
|
+
/** The name the admin knows the pharmacy by. */
|
|
2459
|
+
declare function pharmacyLabel(plan: Pick<AddPharmacyPlan, 'pharmacy'>): string;
|
|
2460
|
+
/**
|
|
2461
|
+
* The save body for a plan: the plan's hash (absent on a plain add) and a price
|
|
2462
|
+
* for every strength the plan asked for, with the optional member price only
|
|
2463
|
+
* when one was typed, and the admin's answers to the plan's match questions
|
|
2464
|
+
* (only those answered). `autoPrices` are the server's to apply and are not sent.
|
|
2465
|
+
*/
|
|
2466
|
+
declare function buildSaveBody(plan: AddPharmacyPlan, prices: Readonly<Record<string, string>>, savingsPrices?: Readonly<Record<string, string>>, matchAnswers?: MatchAnswers): AddPharmacyBody;
|
|
2467
|
+
/** Whether the product, as the server reports it now, already has the planned pharmacy drug. */
|
|
2468
|
+
declare function pharmacyIsOnProduct(product: Pick<AdminProduct, 'pharmacies'> | null | undefined, plan: Pick<AddPharmacyPlan, 'pharmacy'>): boolean;
|
|
2469
|
+
type AddPharmacyFailure =
|
|
2470
|
+
/** `plan_changed` / `plan_first`: what the admin reviewed is no longer the plan. */
|
|
2471
|
+
{
|
|
2472
|
+
kind: 'replan';
|
|
2473
|
+
message: string;
|
|
2474
|
+
code: string;
|
|
2475
|
+
}
|
|
2476
|
+
/** `prices_required`: `missing` are the dose ids the server says have no price. */
|
|
2477
|
+
| {
|
|
2478
|
+
kind: 'prices_required';
|
|
2479
|
+
message: string;
|
|
2480
|
+
missing: string[];
|
|
2481
|
+
}
|
|
2482
|
+
/** The server said no before doing anything. `retryable`: a fresh plan could get a different answer. */
|
|
2483
|
+
| {
|
|
2484
|
+
kind: 'refused';
|
|
2485
|
+
message: string;
|
|
2486
|
+
status: number;
|
|
2487
|
+
code?: string;
|
|
2488
|
+
retryable: boolean;
|
|
2489
|
+
}
|
|
2490
|
+
/** The request may or may not have landed. `serverFinished`: the backend answered with its own
|
|
2491
|
+
* `code`, so its attempt is over; without one the answer never reached us. */
|
|
2492
|
+
| {
|
|
2493
|
+
kind: 'ambiguous';
|
|
2494
|
+
message: string;
|
|
2495
|
+
serverFinished: boolean;
|
|
2496
|
+
code?: string;
|
|
2497
|
+
};
|
|
2498
|
+
/**
|
|
2499
|
+
* Sort a thrown error into what the flow can do about it. Duck-typed on
|
|
2500
|
+
* `status` / `code` / `ambiguous` / `details` (what `ApiError` carries);
|
|
2501
|
+
* branches on codes and statuses, never on message prose.
|
|
2502
|
+
*/
|
|
2503
|
+
declare function classifyAddPharmacyError(err: unknown): AddPharmacyFailure;
|
|
2504
|
+
interface AddedPharmacy {
|
|
2505
|
+
productId: string;
|
|
2506
|
+
pharmacyName: string;
|
|
2507
|
+
/** `recovered`: the answer was lost, and a re-read of the product showed the pharmacy on it. */
|
|
2508
|
+
origin: 'saved' | 'recovered';
|
|
2509
|
+
/** What the server did; the screen never says which. */
|
|
2510
|
+
status: AddPharmacyResult['status'];
|
|
2511
|
+
}
|
|
2512
|
+
interface AddPharmacyNotice {
|
|
2513
|
+
tone: 'info' | 'warn' | 'danger';
|
|
2514
|
+
code: string;
|
|
2515
|
+
message: string;
|
|
2516
|
+
}
|
|
2517
|
+
type AddPharmacyState = {
|
|
2518
|
+
kind: 'idle';
|
|
2519
|
+
}
|
|
2520
|
+
/** Choosing a pharmacy drug. */
|
|
2521
|
+
| {
|
|
2522
|
+
kind: 'picking';
|
|
2523
|
+
} | {
|
|
2524
|
+
kind: 'planning';
|
|
2525
|
+
drugId: string;
|
|
2526
|
+
} | {
|
|
2527
|
+
kind: 'reviewing';
|
|
2528
|
+
plan: AddPharmacyPlan;
|
|
2529
|
+
}
|
|
2530
|
+
/** The save is running (about 40 seconds on a single-pharmacy product): no way to interrupt it. */
|
|
2531
|
+
| {
|
|
2532
|
+
kind: 'saving';
|
|
2533
|
+
plan: AddPharmacyPlan;
|
|
2534
|
+
} | {
|
|
2535
|
+
kind: 'done';
|
|
2536
|
+
added: AddedPharmacy;
|
|
2537
|
+
} | {
|
|
2538
|
+
kind: 'failed';
|
|
2539
|
+
message: string;
|
|
2540
|
+
drugId: string;
|
|
2541
|
+
plan: AddPharmacyPlan | null;
|
|
2542
|
+
/** The outcome of the save is not known: re-check the product, don't save again. */
|
|
2543
|
+
unconfirmed: boolean;
|
|
2544
|
+
/** A fresh plan could get a different answer. */
|
|
2545
|
+
canRetry: boolean;
|
|
2546
|
+
};
|
|
2547
|
+
interface UseAddPharmacyOptions {
|
|
2548
|
+
/** The product being edited. */
|
|
2549
|
+
productId: Accessor<string>;
|
|
2550
|
+
/** The pharmacy is on the product (the host reloads it and its lists). */
|
|
2551
|
+
onAdded?: (added: AddedPharmacy) => void;
|
|
2552
|
+
}
|
|
2553
|
+
interface AddPharmacy {
|
|
2554
|
+
state: Accessor<AddPharmacyState>;
|
|
2555
|
+
/** True while a request is in flight (planning or saving). */
|
|
2556
|
+
busy: Accessor<boolean>;
|
|
2557
|
+
notice: Accessor<AddPharmacyNotice | null>;
|
|
2558
|
+
dismissNotice: () => void;
|
|
2559
|
+
/** Every pharmacy drug this site may map; the host filters out pharmacies already on the product. */
|
|
2560
|
+
drugs: Accessor<CatalogMappableDrug[]>;
|
|
2561
|
+
drugsStatus: Accessor<'idle' | 'loading' | 'ready' | 'failed'>;
|
|
2562
|
+
selected: Accessor<string>;
|
|
2563
|
+
select: (drugId: string) => void;
|
|
2564
|
+
/** Start choosing, optionally with a drug already chosen (a suggestion). */
|
|
2565
|
+
open: (drugId?: string) => void;
|
|
2566
|
+
cancel: () => void;
|
|
2567
|
+
/** Back to choosing a different pharmacy. */
|
|
2568
|
+
backToPicking: () => void;
|
|
2569
|
+
/** Plan adding the selected drug. */
|
|
2570
|
+
plan: () => Promise<void>;
|
|
2571
|
+
prices: Accessor<Readonly<Record<string, string>>>;
|
|
2572
|
+
savingsPrices: Accessor<Readonly<Record<string, string>>>;
|
|
2573
|
+
setPrice: (doseId: string, value: string) => void;
|
|
2574
|
+
setSavingsPrice: (doseId: string, value: string) => void;
|
|
2575
|
+
/** Doses owed a price that has none yet. */
|
|
2576
|
+
missing: Accessor<string[]>;
|
|
2577
|
+
/** Doses the server said were missing a price when the last save was refused. */
|
|
2578
|
+
flagged: Accessor<ReadonlySet<string>>;
|
|
2579
|
+
/** A member price was typed that is not an amount. */
|
|
2580
|
+
savingsInvalid: Accessor<string[]>;
|
|
2581
|
+
canSave: Accessor<boolean>;
|
|
2582
|
+
/** The answers the admin has given to the plan's match questions. */
|
|
2583
|
+
matchAnswers: Accessor<MatchAnswers>;
|
|
2584
|
+
/** Answer a match question: a dose id, or null to leave those subscribers for review. Re-plans after a short pause. */
|
|
2585
|
+
setMatchAnswer: (source: AddPharmacyMatchSource, doseId: string | null) => void;
|
|
2586
|
+
/** The plan is being recomputed for a changed answer; saving waits. */
|
|
2587
|
+
replanning: Accessor<boolean>;
|
|
2588
|
+
save: () => Promise<void>;
|
|
2589
|
+
/** Plan again (after a refusal a new plan can change), or re-check the product when the save's outcome is unknown. */
|
|
2590
|
+
retry: () => Promise<void>;
|
|
2591
|
+
/** Discard what is on screen and plan the same pharmacy again from scratch. */
|
|
2592
|
+
startOver: () => Promise<void>;
|
|
2593
|
+
}
|
|
2594
|
+
declare function useAddPharmacy(opts: UseAddPharmacyOptions): AddPharmacy;
|
|
2595
|
+
|
|
2394
2596
|
/**
|
|
2395
2597
|
* Shared vocabulary for reading a subscription's status.
|
|
2396
2598
|
*
|
|
@@ -2540,4 +2742,4 @@ declare function restoreCartFromLink(): Promise<ResumedCart | null>;
|
|
|
2540
2742
|
*/
|
|
2541
2743
|
declare function startCartCapture(opts?: CartCaptureOptions): () => void;
|
|
2542
2744
|
|
|
2543
|
-
export { type AccountSource, type AddStrengthInput, type AddStrengthOutcome, type AddressErrors, type AddressPair, type AddressValue, type AffiliateConversionsFlow, type AffiliateDownlineFlow, type AffiliateLinksFlow, type AffiliateStatsFlow, type AnswerValue, type ApexBlockCode, type AttentionAction, type AttentionActionKind, type AttentionItem, type CartCaptureOptions, type CartCheckoutFlow, type CartCheckoutOutcome, type CartCheckoutPricing, type CartDropReason, type CartReconcileState, type CartReconciliation, type CartSource, type CatalogAvailabilityDecision, type CatalogAvailabilityState, type CatalogConversion, type CatalogFailure, type CatalogFlow, CatalogProduct, type CategoryColorOpts, type CheckoutFlow, type CheckoutOutcome, type Conversation, type ConversionConverted, type ConversionFailure, type ConversionNotice, type ConversionState, type ConversionSummary, type CreateCatalogProductOutcome, DEFAULT_COLOR_PALETTE, type DashboardActivityItem, type DashboardData, type DashboardRxListItem, type DashboardRxStatus, type DashboardSubscription, type DroppedCartLine, type DrugResult, type FindingCopy, type FlatStep, type FulfillmentRow, type FulfillmentStage, type FunnelTelemetry, type JourneyState, type JourneyStep, type JourneyStepKey, LIFECYCLE_BUCKETS, LIFECYCLE_LABEL, LIFECYCLE_TONE, LIVE_SUBSCRIPTION_STATUSES, MATCH_DEPENDENT_WARNINGS, MATCH_HOW_LABEL, type MatchChoice, type MatchProblem, type MatchRecord, type MatchRow, type MatrixView, type MedicationPricing, type MedicationSelectFlow, type MemberPortalData, type MemberPortalRx, type MemberPortalSubscription, type MessagesChannel, type MessagesIntent, type MessagesThread, type NewCatalogProductInput, OFFER_BEATS_PROMO_NOTICE, ORPHAN_REASON, type OfferDiscount, type PricingBreakdown, type ProductCatalogEditor, type ProductDetailFlow, type PromoPricing, READINESS_LABEL, type ReadinessStatus, type ReconcileOptions, type RefillEvent, type RefillView, type RegisterFlow, type RegisterOutcome, type RequestStatus, type ResolvedStrength, type RxRequestStatus, SOURCE_FIELD_NOTE, type Severity, type ShipmentInfo, type SignupFlow, type SignupOutcome, type StageState, type StoredDosePrice, type StrengthRow, type StructureState, type SubscribeFlow, type SubscribeOutcome, type SubscriptionIntakeFlow, type SubscriptionIntakeOutcome, type SurveyFlow, type SurveyOption, type SurveyOutcome, type SurveyQuestion, type SurveyResult, TERMINAL_SUBSCRIPTION_STATUSES, type ThreadMessage, type TimelineEvent, type TimelineKind, type Tone, type TrackerRequest, type TrackerRequestStatus, type TrackerSubscription, type TrackerSubscriptionStatus, type TrackerView, type TrackingUrlCarrier, US_STATES, US_STATE_OPTIONS, type UpdatePaymentMethodFlow, type UseAddressPairOptions, type UseCatalogConversionOptions, type UseCheckoutFlowOptions, type UseMedicationSelectOptions, type UseMessagesThreadOptions, type UseProductCatalogEditorOptions, type UseSignupFlowOptions, type UseSubscribeFlowOptions, type UseSubscriptionIntakeFlowOptions, type UseSurveyFlowOptions, type ValidateAddressOptions, type ValidatedResumedPromo, type VisibilityCondition, accountSource, addCatalogItemAsProduct, applyPriceDrafts, availableStateOptions, availableStates, bestOfferDiscount, buildFulfillmentRows, buildMatrixView, buildRefillView, buildStrengthRows, buildTimeline, buildTrackerView, buildTrackingUrl, canLeaveUnmatched, canOfferConversion, captureFunnelEmail, catalogUnavailableMessage, categoryColor, classifyCatalogError, classifyConversionError, createCatalogProduct, createFunnelTelemetry, deriveAttention, deriveCatalogAvailabilityDecision, deriveJourney, describeConversion, emailGateAnswered, explainFinding, findStoredDosePrice, flaggedSubscribers, formatCardNumber, formatConversationTime, formatCvv, formatEventDate, formatExpiry, formatMessageTime, formatRelativeTime, formatStageDate, groupDrugsByPharmacy, hasBlockers, hasConversion, hasErrors, initialMatches, isCatalogItemId, isCssColorValue, isLive, isQuestionVisible, isReconcilable, lifecycleReason, liveDoses, lowestPrice, lowestSalePrice, markEmailGateAnswered, matchProblem, matchesComplete, moveInOrder, normalizeState, normalizeStates, offerBeatsPromo, offerDurationText, offerSummaryText, primarySubscription, readinessStatus, reconcileCartAgainstCatalog, reconcileCartLines, redeemResumeLink, removeStoredDosePrice, resetResumeRedemption, resolveCategoryColor, resolveStrengthPrices, restoreCartFromLink, salePriceForBase, skuBindingModeFor, sourceKey, sourceLabel, startCartCapture, stateAvailabilityNote, toChoices, toTrackerRequest, upsertDosePrice, useAddressPair, useAffiliateConversions, useAffiliateDownline, useAffiliateLinks, useAffiliateStats, useCartCheckoutFlow, useCartReconcile, useCatalog, useCatalogAvailability, useCatalogConversion, useCheckoutFlow, useDashboardData, useMedicationSelect, useMemberPortalData, useMessagesThread, useProductCatalogEditor, useProductDetail, useRegisterFlow, useSignupFlow, useSubscribeFlow, useSubscriptionIntakeFlow, useSurveyFlow, useUpdatePaymentMethodFlow, validateAddress, validateResumedPromo };
|
|
2745
|
+
export { type AccountSource, type AddPharmacy, type AddPharmacyFailure, type AddPharmacyNotice, type AddPharmacyState, type AddStrengthInput, type AddStrengthOutcome, type AddedPharmacy, type AddressErrors, type AddressPair, type AddressValue, type AffiliateConversionsFlow, type AffiliateDownlineFlow, type AffiliateLinksFlow, type AffiliateStatsFlow, type AnswerValue, type ApexBlockCode, type AttentionAction, type AttentionActionKind, type AttentionItem, type CartCaptureOptions, type CartCheckoutFlow, type CartCheckoutOutcome, type CartCheckoutPricing, type CartDropReason, type CartReconcileState, type CartReconciliation, type CartSource, type CatalogAvailabilityDecision, type CatalogAvailabilityState, type CatalogConversion, type CatalogFailure, type CatalogFlow, CatalogProduct, type CategoryColorOpts, type CheckoutFlow, type CheckoutOutcome, type Conversation, type ConversionConverted, type ConversionFailure, type ConversionNotice, type ConversionState, type ConversionSummary, type CreateCatalogProductOutcome, DEFAULT_COLOR_PALETTE, type DashboardActivityItem, type DashboardData, type DashboardRxListItem, type DashboardRxStatus, type DashboardSubscription, type DroppedCartLine, type DrugResult, type FindingCopy, type FlatStep, type FulfillmentRow, type FulfillmentStage, type FunnelTelemetry, type JourneyState, type JourneyStep, type JourneyStepKey, LIFECYCLE_BUCKETS, LIFECYCLE_LABEL, LIFECYCLE_TONE, LIVE_SUBSCRIPTION_STATUSES, MATCH_DEPENDENT_WARNINGS, MATCH_HOW_LABEL, type MatchChoice, type MatchProblem, type MatchRecord, type MatchRow, type MatrixView, type MedicationPricing, type MedicationSelectFlow, type MemberPortalData, type MemberPortalRx, type MemberPortalSubscription, type MessagesChannel, type MessagesIntent, type MessagesThread, type NewCatalogProductInput, OFFER_BEATS_PROMO_NOTICE, ORPHAN_REASON, type OfferDiscount, type PricingBreakdown, type ProductCatalogEditor, type ProductDetailFlow, type PromoPricing, READINESS_LABEL, type ReadinessStatus, type ReconcileOptions, type RefillEvent, type RefillView, type RegisterFlow, type RegisterOutcome, type RequestStatus, type ResolvedStrength, type RxRequestStatus, SOURCE_FIELD_NOTE, type Severity, type ShipmentInfo, type SignupFlow, type SignupOutcome, type StageState, type StoredDosePrice, type StrengthComparison, type StrengthRow, type StructureState, type SubscribeFlow, type SubscribeOutcome, type SubscriptionIntakeFlow, type SubscriptionIntakeOutcome, type SurveyFlow, type SurveyOption, type SurveyOutcome, type SurveyQuestion, type SurveyResult, TERMINAL_SUBSCRIPTION_STATUSES, type ThreadMessage, type TimelineEvent, type TimelineKind, type Tone, type TrackerRequest, type TrackerRequestStatus, type TrackerSubscription, type TrackerSubscriptionStatus, type TrackerView, type TrackingUrlCarrier, US_STATES, US_STATE_OPTIONS, type UpdatePaymentMethodFlow, type UseAddPharmacyOptions, type UseAddressPairOptions, type UseCatalogConversionOptions, type UseCheckoutFlowOptions, type UseMedicationSelectOptions, type UseMessagesThreadOptions, type UseProductCatalogEditorOptions, type UseSignupFlowOptions, type UseSubscribeFlowOptions, type UseSubscriptionIntakeFlowOptions, type UseSurveyFlowOptions, type ValidateAddressOptions, type ValidatedResumedPromo, type VisibilityCondition, accountSource, addCatalogItemAsProduct, applyPriceDrafts, availableStateOptions, availableStates, bestOfferDiscount, buildFulfillmentRows, buildMatrixView, buildRefillView, buildSaveBody, buildStrengthRows, buildTimeline, buildTrackerView, buildTrackingUrl, canLeaveUnmatched, canOfferConversion, captureFunnelEmail, catalogUnavailableMessage, categoryColor, classifyAddPharmacyError, classifyCatalogError, classifyConversionError, compareStrengths, createCatalogProduct, createFunnelTelemetry, deriveAttention, deriveCatalogAvailabilityDecision, deriveJourney, describeConversion, emailGateAnswered, explainFinding, findStoredDosePrice, flaggedSubscribers, formatCardNumber, formatConversationTime, formatCvv, formatEventDate, formatExpiry, formatMessageTime, formatRelativeTime, formatStageDate, groupDrugsByPharmacy, hasBlockers, hasConversion, hasErrors, initialMatches, isCatalogItemId, isCssColorValue, isLive, isQuestionVisible, isReconcilable, lifecycleReason, liveDoses, lowestPrice, lowestSalePrice, markEmailGateAnswered, matchProblem, matchesComplete, missingPrices, moveInOrder, needsReview, normalizeState, normalizeStates, offerBeatsPromo, offerDurationText, offerSummaryText, parseMoney, pharmacyIsOnProduct, pharmacyLabel, primarySubscription, readinessStatus, reconcileCartAgainstCatalog, reconcileCartLines, redeemResumeLink, removeStoredDosePrice, resetResumeRedemption, resolveCategoryColor, resolveStrengthPrices, restoreCartFromLink, salePriceForBase, skuBindingModeFor, sourceKey, sourceLabel, startCartCapture, stateAvailabilityNote, strengthsChanged, toChoices, toTrackerRequest, upsertDosePrice, useAddPharmacy, useAddressPair, useAffiliateConversions, useAffiliateDownline, useAffiliateLinks, useAffiliateStats, useCartCheckoutFlow, useCartReconcile, useCatalog, useCatalogAvailability, useCatalogConversion, useCheckoutFlow, useDashboardData, useMedicationSelect, useMemberPortalData, useMessagesThread, useProductCatalogEditor, useProductDetail, useRegisterFlow, useSignupFlow, useSubscribeFlow, useSubscriptionIntakeFlow, useSurveyFlow, useUpdatePaymentMethodFlow, validateAddress, validateResumedPromo, visibleWarnings };
|
package/dist/flows/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { OFFER_BEATS_PROMO_NOTICE, restoreCartFromLink, startCartCapture, useSubscriptionIntakeFlow, validateResumedPromo } from '../chunk/
|
|
2
|
-
import '../chunk/
|
|
3
|
-
export { 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, TERMINAL_SUBSCRIPTION_STATUSES, US_STATES, US_STATE_OPTIONS, accountSource, addCatalogItemAsProduct, applyPriceDrafts, availableStateOptions, availableStates, bestOfferDiscount, buildFulfillmentRows, buildMatrixView, buildRefillView, buildStrengthRows, buildTimeline, buildTrackerView, buildTrackingUrl, canLeaveUnmatched, canOfferConversion, captureFunnelEmail, catalogUnavailableMessage, categoryColor, classifyCatalogError, classifyConversionError, createCatalogProduct, createFunnelTelemetry, deriveAttention, deriveCatalogAvailabilityDecision, deriveJourney, describeConversion, emailGateAnswered, explainFinding, findStoredDosePrice, flaggedSubscribers, formatCardNumber, formatConversationTime, formatCvv, formatEventDate, formatExpiry, formatMessageTime, formatRelativeTime, formatStageDate, groupDrugsByPharmacy, hasBlockers, hasConversion, hasErrors, initialMatches, isCatalogItemId, isCssColorValue, isLive, isQuestionVisible, isReconcilable, lifecycleReason, liveDoses, lowestPrice, lowestSalePrice, markEmailGateAnswered, matchProblem, matchesComplete, moveInOrder, normalizeState, normalizeStates, offerBeatsPromo, offerDurationText, offerSummaryText, primarySubscription, readinessStatus, reconcileCartAgainstCatalog, reconcileCartLines, redeemResumeLink, removeStoredDosePrice, resetResumeRedemption, resolveCategoryColor, resolveStrengthPrices, salePriceForBase, skuBindingModeFor, sourceKey, sourceLabel, stateAvailabilityNote, toChoices, toTrackerRequest, upsertDosePrice, useAddressPair, useAffiliateConversions, useAffiliateDownline, useAffiliateLinks, useAffiliateStats, useCartCheckoutFlow, useCartReconcile, useCatalog, useCatalogAvailability, useCatalogConversion, useCheckoutFlow, useDashboardData, useMedicationSelect, useMemberPortalData, useMessagesThread, useProductCatalogEditor, useProductDetail, useRegisterFlow, useSignupFlow, useSubscribeFlow, useSurveyFlow, useSurveyV2Flow, useUpdatePaymentMethodFlow, validateAddress } from '../chunk/
|
|
4
|
-
import '../chunk/
|
|
5
|
-
import '../chunk/
|
|
6
|
-
import '../chunk/
|
|
1
|
+
export { OFFER_BEATS_PROMO_NOTICE, restoreCartFromLink, startCartCapture, useSubscriptionIntakeFlow, validateResumedPromo } from '../chunk/ANKLNWGB.js';
|
|
2
|
+
import '../chunk/TFA64PLK.js';
|
|
3
|
+
export { 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, 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, classifyAddPharmacyError, classifyCatalogError, classifyConversionError, compareStrengths, createCatalogProduct, createFunnelTelemetry, deriveAttention, deriveCatalogAvailabilityDecision, deriveJourney, describeConversion, emailGateAnswered, explainFinding, findStoredDosePrice, flaggedSubscribers, formatCardNumber, formatConversationTime, formatCvv, formatEventDate, formatExpiry, formatMessageTime, formatRelativeTime, formatStageDate, groupDrugsByPharmacy, hasBlockers, hasConversion, hasErrors, initialMatches, isCatalogItemId, isCssColorValue, isLive, isQuestionVisible, isReconcilable, lifecycleReason, liveDoses, lowestPrice, lowestSalePrice, markEmailGateAnswered, matchProblem, matchesComplete, missingPrices, moveInOrder, needsReview, normalizeState, normalizeStates, offerBeatsPromo, offerDurationText, offerSummaryText, parseMoney, pharmacyIsOnProduct, pharmacyLabel, primarySubscription, readinessStatus, reconcileCartAgainstCatalog, reconcileCartLines, redeemResumeLink, removeStoredDosePrice, resetResumeRedemption, resolveCategoryColor, resolveStrengthPrices, salePriceForBase, skuBindingModeFor, sourceKey, sourceLabel, stateAvailabilityNote, strengthsChanged, toChoices, toTrackerRequest, upsertDosePrice, useAddPharmacy, useAddressPair, useAffiliateConversions, useAffiliateDownline, useAffiliateLinks, useAffiliateStats, useCartCheckoutFlow, useCartReconcile, useCatalog, useCatalogAvailability, useCatalogConversion, useCheckoutFlow, useDashboardData, useMedicationSelect, useMemberPortalData, useMessagesThread, useProductCatalogEditor, useProductDetail, useRegisterFlow, useSignupFlow, useSubscribeFlow, useSurveyFlow, useSurveyV2Flow, useUpdatePaymentMethodFlow, validateAddress, visibleWarnings } from '../chunk/LFSDVMIY.js';
|
|
4
|
+
import '../chunk/Z6PDUPOU.js';
|
|
5
|
+
import '../chunk/AXXQJC6M.js';
|
|
6
|
+
import '../chunk/ICGZXU3R.js';
|
|
7
7
|
import '../chunk/2IFPDU4D.js';
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
|
9
9
|
//# sourceMappingURL=index.js.map
|