@apextelemed/partner-core 0.3.1 → 0.4.1
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/README.md +47 -0
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.js +1 -1
- package/dist/api/index.jsx +1 -1
- package/dist/chunk/{UNAI6NBV.js → 2XJBOTK5.js} +50 -7
- package/dist/chunk/2XJBOTK5.js.map +1 -0
- package/dist/chunk/{D6GCJFQD.js → EIXZJX6R.js} +5 -5
- package/dist/chunk/{D6GCJFQD.js.map → EIXZJX6R.js.map} +1 -1
- package/dist/chunk/{AC7FFU4J.jsx → LPERM6T7.jsx} +2996 -1756
- package/dist/chunk/{DUVW24DM.jsx → MEF3FUQB.jsx} +49 -6
- package/dist/chunk/{J4G52ET6.js → MN4GWQC4.js} +4434 -1987
- package/dist/chunk/MN4GWQC4.js.map +1 -0
- package/dist/chunk/{M6DZVPYZ.jsx → NYLIUR7O.jsx} +688 -36
- package/dist/chunk/{5RQ4ZIYB.js → OJSQZEB3.js} +678 -38
- package/dist/chunk/OJSQZEB3.js.map +1 -0
- package/dist/chunk/{KMHMT6YP.jsx → STEVQZ6U.jsx} +19 -15
- package/dist/chunk/{2EVGOW2Z.jsx → T6IKS76T.jsx} +4 -4
- package/dist/chunk/{FWUBNK42.js → YHWX4NMV.js} +19 -15
- package/dist/chunk/YHWX4NMV.js.map +1 -0
- package/dist/{client-CWYoMmla.d.ts → client-DUrhrzOG.d.ts} +318 -9
- package/dist/flows/index.d.ts +99 -2
- package/dist/flows/index.js +4 -4
- package/dist/flows/index.jsx +24 -4
- package/dist/index/index.d.ts +2 -2
- package/dist/index/index.js +5 -5
- package/dist/index/index.jsx +25 -5
- package/dist/pages/index.d.ts +35 -2
- package/dist/pages/index.js +4 -4
- package/dist/pages/index.jsx +4 -4
- package/dist/stores/index.d.ts +1 -1
- package/dist/stores/index.js +2 -2
- package/dist/stores/index.jsx +2 -2
- package/dist/theme/admin.css +434 -0
- package/package.json +1 -1
- package/dist/chunk/5RQ4ZIYB.js.map +0 -1
- package/dist/chunk/FWUBNK42.js.map +0 -1
- package/dist/chunk/J4G52ET6.js.map +0 -1
- package/dist/chunk/UNAI6NBV.js.map +0 -1
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
setAffiliateTokens,
|
|
13
13
|
setTokens,
|
|
14
14
|
usersApi
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./MEF3FUQB.jsx";
|
|
16
16
|
import {
|
|
17
17
|
getConfig,
|
|
18
18
|
onConfigured
|
|
@@ -129,18 +129,19 @@ var cartStore = createRoot(createCartStore);
|
|
|
129
129
|
var cart_default = cartStore;
|
|
130
130
|
|
|
131
131
|
// src/stores/auth.ts
|
|
132
|
-
import { createSignal as createSignal2, createRoot as createRoot2 } from "solid-js";
|
|
132
|
+
import { createSignal as createSignal2, createMemo, createRoot as createRoot2, batch } from "solid-js";
|
|
133
133
|
function createAuthStore() {
|
|
134
134
|
const [tokens, _setTokens] = createSignal2(null);
|
|
135
135
|
const [user, setUser] = createSignal2(null);
|
|
136
136
|
const [isAuthenticated, setIsAuthenticated] = createSignal2(false);
|
|
137
|
-
const [isAdmin, setIsAdmin] = createSignal2(false);
|
|
138
137
|
const [loading, setLoading] = createSignal2(false);
|
|
138
|
+
const isAdmin = createMemo(() => user()?.role === "admin");
|
|
139
139
|
function dropSession() {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
140
|
+
batch(() => {
|
|
141
|
+
_setTokens(null);
|
|
142
|
+
setIsAuthenticated(false);
|
|
143
|
+
setUser(null);
|
|
144
|
+
});
|
|
144
145
|
}
|
|
145
146
|
function syncTokens(t) {
|
|
146
147
|
_setTokens(t);
|
|
@@ -167,8 +168,10 @@ function createAuthStore() {
|
|
|
167
168
|
const stored = getTokens();
|
|
168
169
|
if (stored?.accessToken) {
|
|
169
170
|
const wasAuthenticated = isAuthenticated();
|
|
170
|
-
|
|
171
|
-
|
|
171
|
+
batch(() => {
|
|
172
|
+
_setTokens(stored);
|
|
173
|
+
setIsAuthenticated(true);
|
|
174
|
+
});
|
|
172
175
|
if (!wasAuthenticated) void fetchProfile();
|
|
173
176
|
} else {
|
|
174
177
|
dropSession();
|
|
@@ -180,7 +183,6 @@ function createAuthStore() {
|
|
|
180
183
|
const res = await usersApi.getProfile();
|
|
181
184
|
if (res.data) {
|
|
182
185
|
setUser(res.data);
|
|
183
|
-
setIsAdmin(res.data.role === "admin");
|
|
184
186
|
}
|
|
185
187
|
} catch (err) {
|
|
186
188
|
if (err instanceof ApiError && (err.status === 401 || err.status === 403)) {
|
|
@@ -271,7 +273,7 @@ var authStore = createRoot2(createAuthStore);
|
|
|
271
273
|
var auth_default = authStore;
|
|
272
274
|
|
|
273
275
|
// src/stores/affiliateAuth.ts
|
|
274
|
-
import { createSignal as createSignal3, createRoot as createRoot3 } from "solid-js";
|
|
276
|
+
import { createSignal as createSignal3, createRoot as createRoot3, batch as batch2 } from "solid-js";
|
|
275
277
|
function createAffiliateAuthStore() {
|
|
276
278
|
const [tokens, _setTokens] = createSignal3(null);
|
|
277
279
|
const [affiliate, setAffiliate] = createSignal3(null);
|
|
@@ -279,9 +281,11 @@ function createAffiliateAuthStore() {
|
|
|
279
281
|
const [isHydrated, setIsHydrated] = createSignal3(false);
|
|
280
282
|
const [loading, setLoading] = createSignal3(false);
|
|
281
283
|
function dropSession() {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
284
|
+
batch2(() => {
|
|
285
|
+
_setTokens(null);
|
|
286
|
+
setIsAuthenticated(false);
|
|
287
|
+
setAffiliate(null);
|
|
288
|
+
});
|
|
285
289
|
}
|
|
286
290
|
function syncTokens(t) {
|
|
287
291
|
_setTokens(t);
|
|
@@ -406,4 +410,4 @@ export {
|
|
|
406
410
|
affiliateAuth_default,
|
|
407
411
|
medication_default
|
|
408
412
|
};
|
|
409
|
-
//# sourceMappingURL=
|
|
413
|
+
//# sourceMappingURL=STEVQZ6U.jsx.map
|
|
@@ -18,12 +18,12 @@ import {
|
|
|
18
18
|
useAddressPair,
|
|
19
19
|
useCardTokenizer,
|
|
20
20
|
validateAddress
|
|
21
|
-
} from "./
|
|
21
|
+
} from "./NYLIUR7O.jsx";
|
|
22
22
|
import {
|
|
23
23
|
auth_default,
|
|
24
24
|
cart_default,
|
|
25
25
|
medication_default
|
|
26
|
-
} from "./
|
|
26
|
+
} from "./STEVQZ6U.jsx";
|
|
27
27
|
import {
|
|
28
28
|
ApiError,
|
|
29
29
|
newIdempotencyKey,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
promoCodesApi,
|
|
32
32
|
subscriptionsApi,
|
|
33
33
|
usersApi
|
|
34
|
-
} from "./
|
|
34
|
+
} from "./MEF3FUQB.jsx";
|
|
35
35
|
import {
|
|
36
36
|
getConfig
|
|
37
37
|
} from "./LDZIUFDM.jsx";
|
|
@@ -752,4 +752,4 @@ export {
|
|
|
752
752
|
restoreCartFromLink,
|
|
753
753
|
startCartCapture
|
|
754
754
|
};
|
|
755
|
-
//# sourceMappingURL=
|
|
755
|
+
//# sourceMappingURL=T6IKS76T.jsx.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { onTokensCleared, authStorageKey, getTokens, usersApi, ApiError, affiliateAuthStorageKey, getAffiliateTokens, affiliatePortalApi, clearTokens, authApi, clearAffiliateTokens, setTokens, setAffiliateTokens } from './
|
|
1
|
+
import { onTokensCleared, authStorageKey, getTokens, usersApi, ApiError, affiliateAuthStorageKey, getAffiliateTokens, affiliatePortalApi, clearTokens, authApi, clearAffiliateTokens, setTokens, setAffiliateTokens } from './2XJBOTK5.js';
|
|
2
2
|
import { onConfigured, getConfig } from './5XGPFYIJ.js';
|
|
3
|
-
import { createRoot, createSignal } from 'solid-js';
|
|
3
|
+
import { createRoot, createSignal, createMemo, batch } from 'solid-js';
|
|
4
4
|
|
|
5
5
|
var cartStorageKey = () => `${getConfig().storagePrefix}-cart`;
|
|
6
6
|
var promoStorageKey = () => `${getConfig().storagePrefix}-cart-promo`;
|
|
@@ -113,13 +113,14 @@ function createAuthStore() {
|
|
|
113
113
|
const [tokens, _setTokens] = createSignal(null);
|
|
114
114
|
const [user, setUser] = createSignal(null);
|
|
115
115
|
const [isAuthenticated, setIsAuthenticated] = createSignal(false);
|
|
116
|
-
const [isAdmin, setIsAdmin] = createSignal(false);
|
|
117
116
|
const [loading, setLoading] = createSignal(false);
|
|
117
|
+
const isAdmin = createMemo(() => user()?.role === "admin");
|
|
118
118
|
function dropSession() {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
119
|
+
batch(() => {
|
|
120
|
+
_setTokens(null);
|
|
121
|
+
setIsAuthenticated(false);
|
|
122
|
+
setUser(null);
|
|
123
|
+
});
|
|
123
124
|
}
|
|
124
125
|
function syncTokens(t) {
|
|
125
126
|
_setTokens(t);
|
|
@@ -146,8 +147,10 @@ function createAuthStore() {
|
|
|
146
147
|
const stored = getTokens();
|
|
147
148
|
if (stored?.accessToken) {
|
|
148
149
|
const wasAuthenticated = isAuthenticated();
|
|
149
|
-
|
|
150
|
-
|
|
150
|
+
batch(() => {
|
|
151
|
+
_setTokens(stored);
|
|
152
|
+
setIsAuthenticated(true);
|
|
153
|
+
});
|
|
151
154
|
if (!wasAuthenticated) void fetchProfile();
|
|
152
155
|
} else {
|
|
153
156
|
dropSession();
|
|
@@ -159,7 +162,6 @@ function createAuthStore() {
|
|
|
159
162
|
const res = await usersApi.getProfile();
|
|
160
163
|
if (res.data) {
|
|
161
164
|
setUser(res.data);
|
|
162
|
-
setIsAdmin(res.data.role === "admin");
|
|
163
165
|
}
|
|
164
166
|
} catch (err) {
|
|
165
167
|
if (err instanceof ApiError && (err.status === 401 || err.status === 403)) {
|
|
@@ -255,9 +257,11 @@ function createAffiliateAuthStore() {
|
|
|
255
257
|
const [isHydrated, setIsHydrated] = createSignal(false);
|
|
256
258
|
const [loading, setLoading] = createSignal(false);
|
|
257
259
|
function dropSession() {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
260
|
+
batch(() => {
|
|
261
|
+
_setTokens(null);
|
|
262
|
+
setIsAuthenticated(false);
|
|
263
|
+
setAffiliate(null);
|
|
264
|
+
});
|
|
261
265
|
}
|
|
262
266
|
function syncTokens(t) {
|
|
263
267
|
_setTokens(t);
|
|
@@ -374,5 +378,5 @@ var medicationStore = createRoot(createMedicationStore);
|
|
|
374
378
|
var medication_default = medicationStore;
|
|
375
379
|
|
|
376
380
|
export { affiliateAuth_default, auth_default, cart_default, medication_default };
|
|
377
|
-
//# sourceMappingURL=
|
|
378
|
-
//# sourceMappingURL=
|
|
381
|
+
//# sourceMappingURL=YHWX4NMV.js.map
|
|
382
|
+
//# sourceMappingURL=YHWX4NMV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/stores/cart.ts","../../src/stores/auth.ts","../../src/stores/affiliateAuth.ts","../../src/stores/medication.ts"],"names":["createSignal","createRoot","batch"],"mappings":";;;;AAGA,IAAM,cAAA,GAAiB,MAAM,CAAA,EAAG,SAAA,GAAY,aAAa,CAAA,KAAA,CAAA;AACzD,IAAM,eAAA,GAAkB,MAAM,CAAA,EAAG,SAAA,GAAY,aAAa,CAAA,WAAA,CAAA;AA4C1D,SAAS,OAAA,CAAQ,WAAmB,MAAA,EAAwB;AAC1D,EAAA,OAAO,CAAA,EAAG,SAAS,CAAA,EAAA,EAAK,MAAM,CAAA,CAAA;AAChC;AAEA,SAAS,WAAA,GAA0B;AACjC,EAAA,IAAI;AACF,IAAA,MAAM,GAAA,GAAM,YAAA,CAAa,OAAA,CAAQ,cAAA,EAAgB,CAAA;AACjD,IAAA,IAAI,CAAC,GAAA,EAAK,OAAO,EAAC;AAClB,IAAA,MAAM,MAAA,GAAS,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA;AAC7B,IAAA,IAAI,CAAC,KAAA,CAAM,OAAA,CAAQ,MAAM,CAAA,SAAU,EAAC;A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,eAAA,GAAkBC,WAAW,qBAAqB,CAAA;AACxD,IAAO,kBAAA,GAAQ","file":"YHWX4NMV.js","sourcesContent":["import { createSignal, createRoot } from 'solid-js';\nimport { getConfig } from '../config';\n\nconst cartStorageKey = () => `${getConfig().storagePrefix}-cart`;\nconst promoStorageKey = () => `${getConfig().storagePrefix}-cart-promo`;\n\nexport interface CartItem {\n productId: string;\n productName: string;\n dosage: string;\n /** Dose redesign (Phase 8): optional patient-requested intake hints, mirroring\n * Apex intake — `requestedSku` is the binding patient-bought SKU,\n * `requestedClinicalDose` is the advisory dose. Default undefined; carried\n * through to the /apex/requests medications payload. Nothing sets these yet. */\n requestedSku?: string;\n /** SKU identity S4: the stable, opaque `skus[].id` form of `requestedSku`\n * (from Apex's /v1/drugs catalog). Preferred over the label — survives a\n * relabel. Additive; carried through to the medications payload. */\n requestedSkuId?: string;\n requestedClinicalDose?: { value: number; unit: string };\n quantity: number;\n priceCents: number;\n drugId: string | null;\n /** The linked Apex drug id, copied from the catalog product. Matches the id\n * the survey qualification verdict (`drugResults[].drugId`) is keyed on, so\n * request creation can gate out drugs the survey marked ineligible. Null/\n * undefined for non-Apex products or carts saved before this field existed. */\n apexDrugId?: string | null;\n categories: string[];\n thumbnailUrl?: string;\n /** True when the product uses flat_fee pricing. The dosage is still set\n * (Apex needs it for the prescription) but consumer cart drawers should\n * skip rendering the dose suffix. */\n hideDoseLabel?: boolean;\n /** Copied from the catalog's `is_subscription` at add-time. The one-time\n * checkout flow excludes subscription items (the backend 400s a\n * /payments/checkout containing one, and stays the authority). Undefined —\n * legacy persisted carts, non-catalog adds — is treated as one-time-purchasable. */\n isSubscription?: boolean;\n}\n\nexport interface AppliedPromoCode {\n code: string;\n discountType: 'percent' | 'fixed';\n discountValueCents: number;\n discountCents: number;\n}\n\nfunction itemKey(productId: string, dosage: string): string {\n return `${productId}::${dosage}`;\n}\n\nfunction loadInitial(): CartItem[] {\n try {\n const raw = localStorage.getItem(cartStorageKey());\n if (!raw) return [];\n const parsed = JSON.parse(raw);\n if (!Array.isArray(parsed)) return [];\n // Preserve a sane persisted quantity (set via setQuantity); anything else\n // — legacy carts, tampered storage — normalizes back to 1.\n return parsed.map((i: CartItem) => ({\n ...i,\n quantity: Number.isInteger(i.quantity) && i.quantity > 0 ? i.quantity : 1,\n }));\n } catch {\n return [];\n }\n}\n\nfunction loadInitialPromo(): AppliedPromoCode | null {\n try {\n const raw = localStorage.getItem(promoStorageKey());\n if (!raw) return null;\n return JSON.parse(raw) as AppliedPromoCode;\n } catch {\n return null;\n }\n}\n\nfunction persist(items: CartItem[]) {\n try {\n localStorage.setItem(cartStorageKey(), JSON.stringify(items));\n } catch {\n // noop\n }\n}\n\nfunction persistPromo(promo: AppliedPromoCode | null) {\n try {\n if (promo) localStorage.setItem(promoStorageKey(), JSON.stringify(promo));\n else localStorage.removeItem(promoStorageKey());\n } catch {\n // noop\n }\n}\n\nfunction createCartStore() {\n const [items, setItems] = createSignal<CartItem[]>(loadInitial());\n const [isOpen, setIsOpen] = createSignal(false);\n const [appliedPromo, setAppliedPromo] = createSignal<AppliedPromoCode | null>(loadInitialPromo());\n\n function write(next: CartItem[]) {\n setItems(next);\n persist(next);\n }\n\n function count() {\n return items().length;\n }\n\n function subtotalCents() {\n return items().reduce((sum, i) => sum + i.priceCents * (i.quantity || 1), 0);\n }\n\n function add(item: CartItem) {\n const key = itemKey(item.productId, item.dosage);\n const current = items();\n if (current.some(i => itemKey(i.productId, i.dosage) === key)) return;\n write([...current, { ...item, quantity: 1 }]);\n }\n\n function remove(key: string) {\n write(items().filter(i => itemKey(i.productId, i.dosage) !== key));\n }\n\n /** Set an item's quantity (floored, clamped to ≥1 — removing is `remove`'s\n * job). Non-finite input and unknown keys are ignored. `add` still starts\n * every item at 1; this is the only quantity mutator. */\n function setQuantity(key: string, quantity: number) {\n if (!Number.isFinite(quantity)) return;\n const clamped = Math.max(1, Math.floor(quantity));\n const current = items();\n if (!current.some(i => itemKey(i.productId, i.dosage) === key)) return;\n write(current.map(i => (itemKey(i.productId, i.dosage) === key ? { ...i, quantity: clamped } : i)));\n }\n\n function clear() {\n // Preserve the applied promo across cart resets — the survey submission\n // clears the cart but the customer still expects the code they entered to\n // apply to subsequent prescription purchases. Removing the promo is an\n // explicit action via the cart drawer's \"remove\" link.\n write([]);\n }\n\n function hasGlp1() {\n return items().some(i =>\n i.categories.some(c => c.toLowerCase().includes('weight') || c.toLowerCase().includes('glp')),\n );\n }\n\n function isMultiItem() {\n return items().length > 1;\n }\n\n function setPromo(promo: AppliedPromoCode | null) {\n setAppliedPromo(promo);\n persistPromo(promo);\n }\n\n return {\n items,\n count,\n subtotalCents,\n add,\n remove,\n setQuantity,\n clear,\n hasGlp1,\n isMultiItem,\n itemKey,\n isOpen,\n open: () => setIsOpen(true),\n close: () => setIsOpen(false),\n toggle: () => setIsOpen(v => !v),\n appliedPromo,\n setPromo,\n };\n}\n\nconst cartStore = createRoot(createCartStore);\nexport default cartStore;\n","import { createSignal, createMemo, createRoot, batch } from 'solid-js';\nimport { onConfigured } from '../config';\nimport {\n authApi,\n getTokens,\n setTokens,\n clearTokens,\n usersApi,\n ApiError,\n onTokensCleared,\n authStorageKey,\n type User,\n type AuthTokens,\n type RegisterPayload,\n type RegisterAndSubscribePayload,\n} from '../api/client';\nimport cartStore from './cart';\n\nfunction createAuthStore() {\n // ── Signals ─────────────────────────────────────────────────────\n\n const [tokens, _setTokens] = createSignal<AuthTokens | null>(null);\n const [user, setUser] = createSignal<User | null>(null);\n const [isAuthenticated, setIsAuthenticated] = createSignal(false);\n const [loading, setLoading] = createSignal(false);\n\n // Derived, not a second signal: admin-ness must never be observable out of\n // step with the user it describes. As separate writes, Solid flushed\n // dependents between setUser and setIsAdmin, so an admin gate combining\n // \"hydrated\" (user() !== null) with isAdmin() saw \"hydrated but not admin\"\n // for one tick on every hard load of /admin and bounced to the fallback\n // route.\n const isAdmin = createMemo(() => user()?.role === 'admin');\n\n // ── Internal helpers ────────────────────────────────────────────\n\n /** Reset the in-memory session signals WITHOUT touching token storage.\n * Used by the token-cleared/storage listeners, where storage is already\n * gone (writing it back would re-notify and loop). */\n function dropSession() {\n batch(() => {\n _setTokens(null);\n setIsAuthenticated(false);\n setUser(null);\n });\n }\n\n function syncTokens(t: AuthTokens | null) {\n _setTokens(t);\n if (t) {\n setTokens(t);\n setIsAuthenticated(true);\n } else {\n clearTokens();\n dropSession();\n // Kiosk/shared-browser hygiene: ending the session must not hand the\n // next visitor the previous member's cart + promo (audit cart.ts:4).\n // Done HERE — not in dropSession — so an explicit logout or definitive\n // auth rejection wipes them, while an out-of-band token expiry in the\n // middle of an active shopper's visit leaves their cart alone.\n // Deliberately NOT userId-namespaced: the cart is populated anonymously\n // pre-signup and must survive the anonymous→signup transition.\n cartStore.clear();\n cartStore.setPromo(null);\n }\n }\n\n // The transport clears tokens out-of-band (refresh failure, post-refresh\n // 401). Without this subscription isAuthenticated() stayed true and the\n // chrome kept rendering an authenticated shell whose every request 401s\n // until a hard reload (audit auth.ts:26).\n onTokensCleared('patient', dropSession);\n\n // Cross-tab convergence: logout (or login) in another tab updates shared\n // localStorage but fires no event in-store — converge on the peer's state.\n // The `storage` event never fires in the acting tab, which is why the\n // same-tab path above is a separate, direct subscription.\n if (typeof window !== 'undefined') {\n window.addEventListener('storage', (e) => {\n let key: string;\n try {\n key = authStorageKey();\n } catch {\n return; // not configured yet — nothing to converge on\n }\n if (e.key !== null && e.key !== key) return; // null key = storage.clear()\n const stored = getTokens();\n if (stored?.accessToken) {\n const wasAuthenticated = isAuthenticated();\n batch(() => {\n _setTokens(stored);\n setIsAuthenticated(true);\n });\n if (!wasAuthenticated) void fetchProfile();\n } else {\n dropSession();\n }\n });\n }\n\n async function fetchProfile() {\n try {\n const res = await usersApi.getProfile();\n if (res.data) {\n setUser(res.data);\n }\n } catch (err) {\n // Only a definitive auth rejection ends the session. The transport has\n // already refreshed-and-retried before a 401 reaches here (and cleared\n // the stored tokens itself); a transient 5xx / network blip during a\n // reload must NOT destroy a valid refresh token and force-log-out a\n // returning member (audit auth.ts:46). The profile simply stays\n // unhydrated and can be fetched again later.\n if (err instanceof ApiError && (err.status === 401 || err.status === 403)) {\n syncTokens(null);\n }\n }\n }\n\n // ── Initialize ──────────────────────────────────────────────────\n\n // Hydrate from token storage AFTER `configure()` runs. The store is a\n // singleton created at import time (see `createRoot` below), which is before\n // the host site calls `configure()`; reading `getTokens()` then would route\n // through `getConfig()` and throw, leaving a returning member rendered\n // logged-out until their first live API call. `onConfigured` defers this.\n let hydrated = false;\n function hydrate() {\n if (hydrated) return;\n hydrated = true;\n const stored = getTokens();\n if (stored?.accessToken) {\n _setTokens(stored);\n setIsAuthenticated(true);\n // Fire-and-forget profile hydration\n fetchProfile();\n }\n }\n onConfigured(hydrate);\n\n // ── Public API ──────────────────────────────────────────────────\n\n async function login(email: string, password: string) {\n setLoading(true);\n try {\n const res = await authApi.login({ email, password });\n if (res.data) {\n syncTokens({\n accessToken: res.data.accessToken,\n refreshToken: res.data.refreshToken,\n userId: res.data.userId,\n });\n // Backend login doesn't return full user profile — fetch it\n await fetchProfile();\n }\n } finally {\n setLoading(false);\n }\n }\n\n async function signup(payload: RegisterPayload) {\n setLoading(true);\n try {\n const res = await authApi.register(payload);\n if (res.data) {\n syncTokens({\n accessToken: res.data.accessToken,\n refreshToken: res.data.refreshToken,\n userId: res.data.userId,\n });\n await fetchProfile();\n }\n } finally {\n setLoading(false);\n }\n }\n\n async function signupAndSubscribe(\n payload: RegisterAndSubscribePayload,\n opts?: { idempotencyKey?: string },\n ) {\n setLoading(true);\n try {\n const res = await authApi.registerAndSubscribe(payload, opts);\n if (res.data) {\n syncTokens({\n accessToken: res.data.accessToken,\n refreshToken: res.data.refreshToken,\n userId: res.data.userId,\n });\n await fetchProfile();\n return res.data;\n }\n } finally {\n setLoading(false);\n }\n }\n\n function logout() {\n syncTokens(null);\n }\n\n return {\n // Reactive getters\n tokens,\n user,\n isAuthenticated,\n isAdmin,\n loading,\n // Actions\n login,\n signup,\n signupAndSubscribe,\n logout,\n fetchProfile,\n };\n}\n\n// Singleton store created inside a reactive root\nconst authStore = createRoot(createAuthStore);\nexport default authStore;\n","import { createSignal, createRoot, batch } from 'solid-js';\nimport { onConfigured } from '../config';\nimport {\n affiliatePortalApi,\n getAffiliateTokens,\n setAffiliateTokens,\n clearAffiliateTokens,\n ApiError,\n onTokensCleared,\n affiliateAuthStorageKey,\n type Affiliate,\n type AffiliateAuthTokens,\n type AffiliateRegisterInput,\n} from '../api/client';\n\nfunction createAffiliateAuthStore() {\n const [tokens, _setTokens] = createSignal<AffiliateAuthTokens | null>(null);\n const [affiliate, setAffiliate] = createSignal<Affiliate | null>(null);\n const [isAuthenticated, setIsAuthenticated] = createSignal(false);\n const [isHydrated, setIsHydrated] = createSignal(false);\n const [loading, setLoading] = createSignal(false);\n\n /** Reset in-memory session signals WITHOUT touching token storage (see\n * stores/auth.ts dropSession — same loop-avoidance rationale). */\n function dropSession() {\n // Batched so a consumer combining these signals can never observe a\n // half-dropped session between flushes (same class of glitch as the\n // patient store's setUser→setIsAdmin admin-gate race).\n batch(() => {\n _setTokens(null);\n setIsAuthenticated(false);\n setAffiliate(null);\n });\n }\n\n function syncTokens(t: AffiliateAuthTokens | null) {\n _setTokens(t);\n if (t) {\n setAffiliateTokens(t);\n setIsAuthenticated(true);\n } else {\n clearAffiliateTokens();\n dropSession();\n }\n }\n\n // Same-tab: the transport's refresh-failure path clears affiliate tokens\n // out-of-band — flip the store immediately instead of rendering a stuck\n // authenticated-but-empty portal until a manual reload (audit client.ts:1682).\n onTokensCleared('affiliate', dropSession);\n\n // Cross-tab: converge on a peer tab's logout/login (audit affiliateAuth.ts:16).\n if (typeof window !== 'undefined') {\n window.addEventListener('storage', (e) => {\n let key: string;\n try {\n key = affiliateAuthStorageKey();\n } catch {\n return; // not configured yet\n }\n if (e.key !== null && e.key !== key) return; // null key = storage.clear()\n const stored = getAffiliateTokens();\n if (stored?.accessToken) {\n const wasAuthenticated = isAuthenticated();\n _setTokens(stored);\n setIsAuthenticated(true);\n if (!wasAuthenticated) void fetchProfile();\n } else {\n dropSession();\n }\n });\n }\n\n async function fetchProfile() {\n try {\n const res = await affiliatePortalApi.getProfile();\n setAffiliate(res.affiliate);\n } catch (err) {\n // Clear only on a definitive auth rejection (the transport has already\n // refreshed-and-retried before a 401 surfaces here). A transient\n // 5xx/network blip during hydration or right after login() must not\n // erase a valid refresh token — that logged out every affiliate loading\n // the app during a backend hiccup, and made login() resolve into an\n // instantly-dead session (audit affiliateAuth.ts:43 + :59). On a\n // transient failure the session stands; the profile stays null and can\n // be re-fetched.\n if (err instanceof ApiError && (err.status === 401 || err.status === 403)) {\n syncTokens(null);\n }\n } finally {\n setIsHydrated(true);\n }\n }\n\n // Hydrate from token storage after `configure()` (see stores/auth.ts for the\n // boot-ordering rationale). fetchProfile() flips isHydrated in its finally;\n // the no-session branch flips it here.\n let hydrated = false;\n function hydrate() {\n if (hydrated) return;\n hydrated = true;\n const stored = getAffiliateTokens();\n if (stored?.accessToken) {\n _setTokens(stored);\n setIsAuthenticated(true);\n fetchProfile();\n } else {\n setIsHydrated(true);\n }\n }\n onConfigured(hydrate);\n\n async function login(email: string, password: string) {\n setLoading(true);\n try {\n const session = await affiliatePortalApi.login(email, password);\n syncTokens({\n accessToken: session.idToken,\n refreshToken: session.refreshToken,\n affiliateId: session.affiliateId,\n });\n setIsHydrated(false);\n await fetchProfile();\n } finally {\n setLoading(false);\n }\n }\n\n async function register(input: AffiliateRegisterInput) {\n setLoading(true);\n try {\n await affiliatePortalApi.register(input);\n // Backend register does NOT return tokens — new affiliates start as\n // 'pending' and must be approved by an admin before they can log in.\n // We surface the affiliate ID via the resolved promise so the page\n // can show a \"pending approval\" success state without logging in.\n } finally {\n setLoading(false);\n }\n }\n\n async function logout() {\n try {\n await affiliatePortalApi.logout();\n } finally {\n syncTokens(null);\n }\n }\n\n return {\n tokens,\n affiliate,\n isAuthenticated,\n isHydrated,\n loading,\n login,\n register,\n logout,\n fetchProfile,\n };\n}\n\nconst affiliateAuthStore = createRoot(createAffiliateAuthStore);\nexport default affiliateAuthStore;\n","import { createSignal, createRoot } from 'solid-js';\n\nexport interface MedicationSelection {\n drugId: string | null; // null = general consultation\n drugName: string;\n}\n\nfunction createMedicationStore() {\n const [selected, setSelected] = createSignal<MedicationSelection | null>(null);\n\n function select(medication: MedicationSelection) {\n setSelected(medication);\n }\n\n function clear() {\n setSelected(null);\n }\n\n return { selected, select, clear };\n}\n\nconst medicationStore = createRoot(createMedicationStore);\nexport default medicationStore;\n"]}
|
|
@@ -865,6 +865,12 @@ interface AdminPayment {
|
|
|
865
865
|
customerEmail: string;
|
|
866
866
|
customerUid: string;
|
|
867
867
|
transactionId: string;
|
|
868
|
+
/** Additive fields from the partial-refund ledger; absent on older backends. */
|
|
869
|
+
refundedAmountCents?: number;
|
|
870
|
+
failureReason?: string | null;
|
|
871
|
+
type?: string | null;
|
|
872
|
+
customerFirstName?: string;
|
|
873
|
+
customerLastName?: string;
|
|
868
874
|
}
|
|
869
875
|
interface AdminSubscription {
|
|
870
876
|
id: string;
|
|
@@ -964,17 +970,309 @@ interface AdminListParams {
|
|
|
964
970
|
search?: string;
|
|
965
971
|
[key: string]: unknown;
|
|
966
972
|
}
|
|
973
|
+
type AdminLifecycleBucket = 'active' | 'past_due' | 'paused' | 'incomplete' | 'cancelled' | 'card_declined' | 'awaiting_prescriber' | 'never_subscribed';
|
|
974
|
+
interface AdminLifecycle {
|
|
975
|
+
bucket: AdminLifecycleBucket;
|
|
976
|
+
label: string;
|
|
977
|
+
}
|
|
978
|
+
/** Raw per-customer facts from the summary view (the inputs to the bucket). */
|
|
979
|
+
interface AdminCustomerFacts {
|
|
980
|
+
subscriptionCount: number;
|
|
981
|
+
liveSubscriptionCount: number;
|
|
982
|
+
latestSubscriptionStatus: string | null;
|
|
983
|
+
nextChargeAt: string | null;
|
|
984
|
+
lastPaymentAt: string | null;
|
|
985
|
+
lastPaymentStatus: string | null;
|
|
986
|
+
/** True when the most recent payment is a rolled-back checkout decline; null with no payments. */
|
|
987
|
+
lastPaymentDetached: boolean | null;
|
|
988
|
+
pendingRequestCount: number;
|
|
989
|
+
latestRequestApexStatus: string | null;
|
|
990
|
+
isSavingsMember: boolean;
|
|
991
|
+
/** An Apex survey.completed capture exists for this email. */
|
|
992
|
+
hasFunnelCapture: boolean;
|
|
993
|
+
hasOpenCart: boolean;
|
|
994
|
+
}
|
|
995
|
+
/** A customer list row: the legacy keys plus lifecycle + facts. */
|
|
996
|
+
interface AdminCustomerRow extends AdminCustomer {
|
|
997
|
+
lifecycle?: AdminLifecycle;
|
|
998
|
+
facts?: AdminCustomerFacts;
|
|
999
|
+
}
|
|
1000
|
+
interface AdminCustomerListParams {
|
|
1001
|
+
limit?: number;
|
|
1002
|
+
offset?: number;
|
|
1003
|
+
/** Matches email OR name (single escaped ilike server-side). */
|
|
1004
|
+
search?: string;
|
|
1005
|
+
lifecycle?: AdminLifecycleBucket;
|
|
1006
|
+
savingsMember?: boolean;
|
|
1007
|
+
hasFunnelCapture?: boolean;
|
|
1008
|
+
sort?: 'createdAt' | 'email' | 'lastPaymentAt';
|
|
1009
|
+
/** Ask for per-bucket counts. Costs one count query per bucket — request once per visit, not per keystroke. */
|
|
1010
|
+
facets?: boolean;
|
|
1011
|
+
}
|
|
1012
|
+
interface AdminCustomerProfile {
|
|
1013
|
+
uid: string;
|
|
1014
|
+
email: string;
|
|
1015
|
+
firstName: string;
|
|
1016
|
+
lastName: string;
|
|
1017
|
+
phone: string;
|
|
1018
|
+
createdAt: string;
|
|
1019
|
+
/** Account status (`users.status`: active / disabled), not the legacy conflated value. */
|
|
1020
|
+
status: string | null;
|
|
1021
|
+
paymentStatus: string | null;
|
|
1022
|
+
apexMemberId: string | null;
|
|
1023
|
+
savingsMemberId: string | null;
|
|
1024
|
+
address: {
|
|
1025
|
+
address1: string | null;
|
|
1026
|
+
address2: string | null;
|
|
1027
|
+
city: string | null;
|
|
1028
|
+
state: string | null;
|
|
1029
|
+
zip: string | null;
|
|
1030
|
+
};
|
|
1031
|
+
}
|
|
1032
|
+
interface AdminBillingAttempt {
|
|
1033
|
+
id: string;
|
|
1034
|
+
subscriptionId?: string | null;
|
|
1035
|
+
billingPeriod: number | null;
|
|
1036
|
+
attemptNo: number | null;
|
|
1037
|
+
status: 'pending' | 'indeterminate' | 'succeeded' | 'failed' | string;
|
|
1038
|
+
amountCents: number | null;
|
|
1039
|
+
transactionId: string | null;
|
|
1040
|
+
errorCode: string | null;
|
|
1041
|
+
errorMessage: string | null;
|
|
1042
|
+
createdAt: string | null;
|
|
1043
|
+
updatedAt?: string | null;
|
|
1044
|
+
}
|
|
1045
|
+
interface AdminSubscriptionDetail {
|
|
1046
|
+
id: string;
|
|
1047
|
+
memberUid: string | null;
|
|
1048
|
+
customerEmail?: string;
|
|
1049
|
+
status: string;
|
|
1050
|
+
medication: string | null;
|
|
1051
|
+
dosage: string | null;
|
|
1052
|
+
productId: string | null;
|
|
1053
|
+
amountCents: number | null;
|
|
1054
|
+
baseAmountCents: number | null;
|
|
1055
|
+
intervalDays: number | null;
|
|
1056
|
+
currentPeriodStart: string | null;
|
|
1057
|
+
currentPeriodEnd: string | null;
|
|
1058
|
+
/** 'gateway' (schedule lives at Authorize.Net) or 'platform' (billing engine). */
|
|
1059
|
+
billingMode: 'gateway' | 'platform' | string | null;
|
|
1060
|
+
nextChargeAt: string | null;
|
|
1061
|
+
billingPeriod: number | null;
|
|
1062
|
+
retryCount: number;
|
|
1063
|
+
lastAttemptAt: string | null;
|
|
1064
|
+
discountRecurringRemaining: number | null;
|
|
1065
|
+
discountRecurringIndefinite: boolean;
|
|
1066
|
+
gatewaySubscriptionId: string | null;
|
|
1067
|
+
provider?: string | null;
|
|
1068
|
+
promoCodeId?: string | null;
|
|
1069
|
+
saleId?: string | null;
|
|
1070
|
+
affiliateId?: string | null;
|
|
1071
|
+
cancelledAt: string | null;
|
|
1072
|
+
pausedAt: string | null;
|
|
1073
|
+
createdAt: string | null;
|
|
1074
|
+
updatedAt?: string | null;
|
|
1075
|
+
billingAttempts: AdminBillingAttempt[];
|
|
1076
|
+
}
|
|
1077
|
+
interface AdminPaymentDetail {
|
|
1078
|
+
id: string;
|
|
1079
|
+
memberUid?: string | null;
|
|
1080
|
+
createdAt: string | null;
|
|
1081
|
+
amountCents: number | null;
|
|
1082
|
+
currency?: string | null;
|
|
1083
|
+
status: string;
|
|
1084
|
+
type: string | null;
|
|
1085
|
+
transactionId: string | null;
|
|
1086
|
+
failureReason: string | null;
|
|
1087
|
+
responseCode?: number | null;
|
|
1088
|
+
provider?: string | null;
|
|
1089
|
+
refundedAmountCents: number;
|
|
1090
|
+
refundTransactionId?: string | null;
|
|
1091
|
+
refundReason?: string | null;
|
|
1092
|
+
refundedAt: string | null;
|
|
1093
|
+
voidedAt: string | null;
|
|
1094
|
+
source?: string | null;
|
|
1095
|
+
subscriptionId: string | null;
|
|
1096
|
+
orderId: string | null;
|
|
1097
|
+
/** True for a checkout decline whose subscription was rolled back. */
|
|
1098
|
+
detached: boolean;
|
|
1099
|
+
rolledBackFrom: {
|
|
1100
|
+
subscriptionId: string | null;
|
|
1101
|
+
productId: string | null;
|
|
1102
|
+
email: string | null;
|
|
1103
|
+
} | null;
|
|
1104
|
+
}
|
|
1105
|
+
/** `items` is the order's raw JSONB; the fields below are what checkout writes. */
|
|
1106
|
+
interface AdminOrderSummary {
|
|
1107
|
+
id: string;
|
|
1108
|
+
status: string;
|
|
1109
|
+
totalCents: number;
|
|
1110
|
+
items: Array<{
|
|
1111
|
+
productId?: string;
|
|
1112
|
+
name?: string;
|
|
1113
|
+
quantity?: number;
|
|
1114
|
+
priceAtPurchase?: number;
|
|
1115
|
+
dosage?: string;
|
|
1116
|
+
}>;
|
|
1117
|
+
shippingAddress?: unknown;
|
|
1118
|
+
subscriptionId: string | null;
|
|
1119
|
+
prescriptionRequestId: string | null;
|
|
1120
|
+
paymentId: string | null;
|
|
1121
|
+
createdAt: string | null;
|
|
1122
|
+
}
|
|
1123
|
+
interface AdminCustomerRequest {
|
|
1124
|
+
requestId: string;
|
|
1125
|
+
productId: string | null;
|
|
1126
|
+
drugId: string | null;
|
|
1127
|
+
drugName: string | null;
|
|
1128
|
+
/** Dashboard status: pending | approved | denied | call_requested | pharmacy | processing | completed | shipped */
|
|
1129
|
+
status: string;
|
|
1130
|
+
apexStatusLocal: string | null;
|
|
1131
|
+
paymentConfirmed: boolean;
|
|
1132
|
+
pharmacySent: boolean;
|
|
1133
|
+
dosage: string | null;
|
|
1134
|
+
createdAt: string | null;
|
|
1135
|
+
updatedAt: string | null;
|
|
1136
|
+
delivery: DeliveryInfo | null;
|
|
1137
|
+
/** The row's own shipping columns; always present, fields null until shipped. */
|
|
1138
|
+
tracking: {
|
|
1139
|
+
trackingNumber: string | null;
|
|
1140
|
+
shipCarrier: string | null;
|
|
1141
|
+
deliveryStatus: string | null;
|
|
1142
|
+
shippedAt: string | null;
|
|
1143
|
+
} | null;
|
|
1144
|
+
renewal: {
|
|
1145
|
+
id: string;
|
|
1146
|
+
status: string;
|
|
1147
|
+
cycleNumber: number | null;
|
|
1148
|
+
pharmacyFillDate: string | null;
|
|
1149
|
+
triggerAt: string | null;
|
|
1150
|
+
needsReviewAt?: string | null;
|
|
1151
|
+
reviewReason?: string | null;
|
|
1152
|
+
} | null;
|
|
1153
|
+
/** False when Apex could not be reached (or the row is past the live cap) and it was built from local columns. */
|
|
1154
|
+
live: boolean;
|
|
1155
|
+
}
|
|
1156
|
+
interface AdminCustomerSupportThread {
|
|
1157
|
+
id: string;
|
|
1158
|
+
subject: string | null;
|
|
1159
|
+
status: SupportThreadStatus | string;
|
|
1160
|
+
lastMessageAt: string | null;
|
|
1161
|
+
lastSender: 'customer' | 'support' | string | null;
|
|
1162
|
+
adminUnread: boolean;
|
|
1163
|
+
}
|
|
1164
|
+
interface AdminCustomerSupport {
|
|
1165
|
+
threadCount: number;
|
|
1166
|
+
openCount: number;
|
|
1167
|
+
adminUnreadCount: number;
|
|
1168
|
+
lastMessageAt: string | null;
|
|
1169
|
+
threads: AdminCustomerSupportThread[];
|
|
1170
|
+
}
|
|
1171
|
+
interface AdminCustomerFunnel {
|
|
1172
|
+
telemetryEnabled: boolean;
|
|
1173
|
+
cartRecoveryEnabled: boolean;
|
|
1174
|
+
/** Each list holds the 20 most recent rows. */
|
|
1175
|
+
captures: Array<{
|
|
1176
|
+
responseId: string;
|
|
1177
|
+
qualified: boolean;
|
|
1178
|
+
mode: string | null;
|
|
1179
|
+
drugIds: string[];
|
|
1180
|
+
capturedAt: string | null;
|
|
1181
|
+
convertedAt: string | null;
|
|
1182
|
+
remindersSent: number;
|
|
1183
|
+
}>;
|
|
1184
|
+
sessions: Array<{
|
|
1185
|
+
sessionId: string;
|
|
1186
|
+
lastStep: number | null;
|
|
1187
|
+
stepCount: number | null;
|
|
1188
|
+
phase: string | null;
|
|
1189
|
+
startedAt: string | null;
|
|
1190
|
+
lastSeenAt: string | null;
|
|
1191
|
+
convertedAt: string | null;
|
|
1192
|
+
remindersSent: number;
|
|
1193
|
+
}>;
|
|
1194
|
+
carts: Array<{
|
|
1195
|
+
cartId: string;
|
|
1196
|
+
itemCount: number;
|
|
1197
|
+
subtotalCents: number;
|
|
1198
|
+
promoCode: string | null;
|
|
1199
|
+
updatedAt: string | null;
|
|
1200
|
+
convertedAt: string | null;
|
|
1201
|
+
recoveredAt: string | null;
|
|
1202
|
+
remindersSent: number;
|
|
1203
|
+
}>;
|
|
1204
|
+
}
|
|
1205
|
+
interface AdminCustomerOverview {
|
|
1206
|
+
customer: AdminCustomerProfile;
|
|
1207
|
+
lifecycle: AdminLifecycle & {
|
|
1208
|
+
facts: AdminCustomerFacts;
|
|
1209
|
+
};
|
|
1210
|
+
subscriptions: AdminSubscriptionDetail[];
|
|
1211
|
+
payments: AdminPaymentDetail[];
|
|
1212
|
+
orders: AdminOrderSummary[];
|
|
1213
|
+
requests: {
|
|
1214
|
+
capped: boolean;
|
|
1215
|
+
items: AdminCustomerRequest[];
|
|
1216
|
+
};
|
|
1217
|
+
support: AdminCustomerSupport;
|
|
1218
|
+
funnel: AdminCustomerFunnel;
|
|
1219
|
+
tenant: {
|
|
1220
|
+
requirePaidSubscription: boolean;
|
|
1221
|
+
fulfillmentMode: 'auto' | 'deferred' | null;
|
|
1222
|
+
singleSubscription: boolean;
|
|
1223
|
+
savingsProgram: boolean;
|
|
1224
|
+
/** The backend can build a reset link itself (tenant domains configured). */
|
|
1225
|
+
passwordResetAvailable: boolean;
|
|
1226
|
+
};
|
|
1227
|
+
/** Sections that failed to load and came back empty (e.g. 'support', 'funnel'). */
|
|
1228
|
+
partial: string[];
|
|
1229
|
+
}
|
|
1230
|
+
interface AdminSubscriptionPatch {
|
|
1231
|
+
amountCents?: number;
|
|
1232
|
+
nextChargeAt?: string | null;
|
|
1233
|
+
currentPeriodStart?: string;
|
|
1234
|
+
currentPeriodEnd?: string;
|
|
1235
|
+
}
|
|
1236
|
+
interface AdminSubscriptionWriteResult {
|
|
1237
|
+
subscription: AdminSubscriptionDetail;
|
|
1238
|
+
before: AdminSubscriptionDetail;
|
|
1239
|
+
warnings?: string[];
|
|
1240
|
+
}
|
|
1241
|
+
interface AdminRefundResult {
|
|
1242
|
+
success: boolean;
|
|
1243
|
+
refundId?: string;
|
|
1244
|
+
refundedAmountCents?: number;
|
|
1245
|
+
remainingCents?: number;
|
|
1246
|
+
status?: string;
|
|
1247
|
+
error?: string;
|
|
1248
|
+
code?: string;
|
|
1249
|
+
}
|
|
967
1250
|
declare const adminApi: {
|
|
968
1251
|
getDashboard(): Promise<AdminDashboardStats>;
|
|
969
|
-
getCustomers(params?: AdminListParams): Promise<{
|
|
970
|
-
customers:
|
|
1252
|
+
getCustomers(params?: AdminCustomerListParams & AdminListParams): Promise<{
|
|
1253
|
+
customers: AdminCustomerRow[];
|
|
971
1254
|
hasMore: boolean;
|
|
1255
|
+
facets?: Partial<Record<AdminLifecycleBucket, number>>;
|
|
972
1256
|
}>;
|
|
973
1257
|
getCustomer(id: string): Promise<{
|
|
974
1258
|
customer: AdminCustomer;
|
|
975
1259
|
subscriptions: AdminSubscription[];
|
|
976
1260
|
recentPayments: AdminPayment[];
|
|
977
1261
|
}>;
|
|
1262
|
+
/** The customer 360: every per-customer record the support view renders, in one call. */
|
|
1263
|
+
getCustomerOverview(uid: string): Promise<AdminCustomerOverview>;
|
|
1264
|
+
/**
|
|
1265
|
+
* Edit a subscription's price and/or schedule. Amount edits are refused (409)
|
|
1266
|
+
* for gateway-billed subscriptions — their schedule lives at Authorize.Net.
|
|
1267
|
+
*/
|
|
1268
|
+
updateSubscription(id: string, body: AdminSubscriptionPatch): Promise<AdminSubscriptionWriteResult>;
|
|
1269
|
+
pauseSubscription(id: string): Promise<AdminSubscriptionWriteResult>;
|
|
1270
|
+
resumeSubscription(id: string): Promise<AdminSubscriptionWriteResult>;
|
|
1271
|
+
/** Close a pending/indeterminate billing attempt so the engine can move on. */
|
|
1272
|
+
resolveBillingAttempt(subscriptionId: string, attemptId: string, resolution: "failed" | "succeeded"): Promise<{
|
|
1273
|
+
before: AdminBillingAttempt;
|
|
1274
|
+
after: AdminBillingAttempt;
|
|
1275
|
+
}>;
|
|
978
1276
|
/**
|
|
979
1277
|
* Mint a short-lived (15-min) impersonation token to preview the patient
|
|
980
1278
|
* dashboard as this customer, read-only. The returned token authenticates
|
|
@@ -988,18 +1286,29 @@ declare const adminApi: {
|
|
|
988
1286
|
updateCustomerEmail(uid: string, email: string): Promise<{
|
|
989
1287
|
customer: AdminCustomer;
|
|
990
1288
|
}>;
|
|
991
|
-
|
|
1289
|
+
/** Edit the name on the account. Email has its own endpoint (it notifies both addresses). */
|
|
1290
|
+
updateCustomerName(uid: string, name: {
|
|
1291
|
+
firstName: string;
|
|
1292
|
+
lastName: string;
|
|
1293
|
+
}): Promise<{
|
|
1294
|
+
customer: AdminCustomer;
|
|
1295
|
+
}>;
|
|
1296
|
+
sendPasswordReset(uid: string, redirectUrl?: string): Promise<{
|
|
992
1297
|
ok: true;
|
|
993
1298
|
}>;
|
|
994
1299
|
getPayments(params?: AdminListParams): Promise<{
|
|
995
1300
|
payments: AdminPayment[];
|
|
996
1301
|
hasMore: boolean;
|
|
997
1302
|
}>;
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1303
|
+
/**
|
|
1304
|
+
* Refund a payment, in full (no amount) or in part. Partial refunds
|
|
1305
|
+
* accumulate on the row; the backend answers 409 `unsettled_requires_void`
|
|
1306
|
+
* when a partial is requested against a charge the gateway has not settled.
|
|
1307
|
+
*/
|
|
1308
|
+
refundPayment(id: string, opts?: number | {
|
|
1309
|
+
amountCents?: number;
|
|
1310
|
+
reason?: string;
|
|
1311
|
+
}): Promise<AdminRefundResult>;
|
|
1003
1312
|
quickbooksStatus(): Promise<{
|
|
1004
1313
|
provider: string | null;
|
|
1005
1314
|
connected: boolean;
|
|
@@ -1547,4 +1856,4 @@ declare const affiliatePortalApi: {
|
|
|
1547
1856
|
track(refCode: string, landingPage?: string): Promise<AffiliateTrackResponse>;
|
|
1548
1857
|
};
|
|
1549
1858
|
|
|
1550
|
-
export {
|
|
1859
|
+
export { ApiError as $, type AddressVerifyResult as A, type AdminSaleInput as B, type AdminSubscription as C, type AdminSubscriptionDetail as D, type AdminSubscriptionPatch as E, type AdminSubscriptionWriteResult as F, type AdminSupportCustomer as G, type AdminSupportStats as H, type AdminSupportThread as I, type AdminWebhookEvent as J, type Affiliate as K, type AffiliateAuthTokens as L, type AffiliateClickRecord as M, type AffiliateConversion as N, type AffiliateDashboardLinks as O, type AffiliateDashboardProfile as P, type AffiliateDashboardStats as Q, type AffiliateDownlineMember as R, type AffiliateEarningsBreakdown as S, type AffiliatePaymentMethod as T, type AffiliateProgram as U, type AffiliateRegisterInput as V, type AffiliateRegisterResponse as W, type AffiliateSession as X, type AffiliateStatsResponse as Y, type AffiliateStatus as Z, type AffiliateTrackResponse as _, type AdminApexDrug as a, affiliateAuthStorageKey as a$, type ApiResponse as a0, type AttributionMethod as a1, type AuthTokens as a2, type CatalogProduct as a3, type CheckoutAddress as a4, type CheckoutPayload as a5, type CheckoutResult as a6, type CommissionConfig as a7, type CommissionStatus as a8, type CompleteSurveyPayload as a9, type PromoValidationResponse as aA, type PublicCategory as aB, type RegisterAndSubscribePayload as aC, type RegisterPayload as aD, type RenewalStatus as aE, SUPPORT_ATTACHMENT_MAX_BYTES as aF, SUPPORT_ATTACHMENT_MIME_TYPES as aG, type SelectDrugPayload as aH, type SendMessagePayload as aI, type SendToPharmacyPayload as aJ, type SupportAttachment as aK, type SupportMessage as aL, type SupportRealtimeToken as aM, type SupportThread as aN, type SupportThreadStatus as aO, type SurveySubmitPayload as aP, type TemplatePlaceholdersMap as aQ, type TemplateText as aR, type TokenTrackName as aS, type UpdateAffiliatePayload as aT, type UpdateAffiliateProgramPayload as aU, type UpdatePaymentMethodPayload as aV, type UpdateProfilePayload as aW, type User as aX, addressesApi as aY, adminAffiliatesApi as aZ, adminApi as a_, type CreateAffiliatePayload as aa, type CreateAffiliateProgramPayload as ab, type CreateOrderPayload as ac, type CreateRequestPayload as ad, type CreateSubscriptionPayload as ae, type CustomerDiscountConfig as af, type DeliveryInfo as ag, type DiscountType as ah, type EmailTemplatesMap as ai, type LoginPayload as aj, type MemberPrescriptionRequest as ak, type MemberSurveyMode as al, type MemberSurveyResponseSummary as am, type MemberSurveyTranscript as an, type MemberSurveyTranscriptItem as ao, type MemberSurveyTranscriptSection as ap, type MembersMeResponse as aq, type Order as ar, type OrderItemInput as as, type PaginationParams as at, type PaymentCallbackPayload as au, type PaymentInitiatePayload as av, type PaymentType as aw, type PendingRenewalSurvey as ax, type Placeholder as ay, type ProductSaleSummary as az, type AdminBillingAttempt as b, affiliatePortalApi as b0, apexApi as b1, apiFetch as b2, authApi as b3, authStorageKey as b4, clearAffiliateTokens as b5, clearTokens as b6, getAffiliateTokens as b7, getTokens as b8, membersApi as b9, messagesApi as ba, newIdempotencyKey as bb, onTokensCleared as bc, ordersApi as bd, paymentsApi as be, productsApi as bf, promoCodesApi as bg, setAffiliateTokens as bh, setTokens as bi, subscriptionsApi as bj, supportApi as bk, usersApi as bl, type AdminCategory as c, type AdminCategoryInput as d, type AdminCustomer as e, type AdminCustomerFacts as f, type AdminCustomerFunnel as g, type AdminCustomerListParams as h, type AdminCustomerOverview as i, type AdminCustomerProfile as j, type AdminCustomerRequest as k, type AdminCustomerRow as l, type AdminCustomerSupport as m, type AdminCustomerSupportThread as n, type AdminDashboardStats as o, type AdminLifecycle as p, type AdminLifecycleBucket as q, type AdminListParams as r, type AdminOrderSummary as s, type AdminPayment as t, type AdminPaymentDetail as u, type AdminProduct as v, type AdminPromoCode as w, type AdminPromoCodeInput as x, type AdminRefundResult as y, type AdminSale as z };
|