@apextelemed/partner-core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +64 -0
- package/README.md +363 -0
- package/dist/api/index.d.ts +12 -0
- package/dist/api/index.js +8 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/index.jsx +127 -0
- package/dist/cart-CBH8Em8f.d.ts +189 -0
- package/dist/cart-D4mVX_zx.d.ts +66 -0
- package/dist/chunk/2OXI5TKO.jsx +249 -0
- package/dist/chunk/3A3MF7R2.jsx +1 -0
- package/dist/chunk/3VEOP7TZ.jsx +16679 -0
- package/dist/chunk/5XGPFYIJ.js +26 -0
- package/dist/chunk/5XGPFYIJ.js.map +1 -0
- package/dist/chunk/67KHO66G.js +26 -0
- package/dist/chunk/67KHO66G.js.map +1 -0
- package/dist/chunk/6TFBQECC.jsx +135 -0
- package/dist/chunk/AN3WPMEP.js +3 -0
- package/dist/chunk/AN3WPMEP.js.map +1 -0
- package/dist/chunk/DHII7L5Y.js +686 -0
- package/dist/chunk/DHII7L5Y.js.map +1 -0
- package/dist/chunk/DS4E7FAI.js +132 -0
- package/dist/chunk/DS4E7FAI.js.map +1 -0
- package/dist/chunk/DY5BJ6UG.js +1195 -0
- package/dist/chunk/DY5BJ6UG.js.map +1 -0
- package/dist/chunk/E7722UPF.js +378 -0
- package/dist/chunk/E7722UPF.js.map +1 -0
- package/dist/chunk/HLXKWRRW.js +16774 -0
- package/dist/chunk/HLXKWRRW.js.map +1 -0
- package/dist/chunk/I46Y2J5W.jsx +144 -0
- package/dist/chunk/J63XPQP4.jsx +21 -0
- package/dist/chunk/J6KNY37T.js +122 -0
- package/dist/chunk/J6KNY37T.js.map +1 -0
- package/dist/chunk/KNTZTYXE.jsx +3315 -0
- package/dist/chunk/KZZSQ7LP.jsx +409 -0
- package/dist/chunk/L46OKCKG.jsx +733 -0
- package/dist/chunk/LDZIUFDM.jsx +31 -0
- package/dist/chunk/LZWA44KD.js +3 -0
- package/dist/chunk/LZWA44KD.js.map +1 -0
- package/dist/chunk/NVRAOAVV.js +3 -0
- package/dist/chunk/NVRAOAVV.js.map +1 -0
- package/dist/chunk/O3QK7YZR.jsx +1 -0
- package/dist/chunk/UZCST66N.jsx +21 -0
- package/dist/chunk/V42CGY2S.jsx +1229 -0
- package/dist/chunk/YJEHCCLY.js +467 -0
- package/dist/chunk/YJEHCCLY.js.map +1 -0
- package/dist/chunk/ZMOG2IIC.js +3194 -0
- package/dist/chunk/ZMOG2IIC.js.map +1 -0
- package/dist/client-BzSg2DEK.d.ts +1539 -0
- package/dist/config/index.d.ts +55 -0
- package/dist/config/index.js +3 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/index.jsx +11 -0
- package/dist/flows/index.d.ts +1322 -0
- package/dist/flows/index.js +9 -0
- package/dist/flows/index.js.map +1 -0
- package/dist/flows/index.jsx +124 -0
- package/dist/index/index.d.ts +71 -0
- package/dist/index/index.js +15 -0
- package/dist/index/index.js.map +1 -0
- package/dist/index/index.jsx +311 -0
- package/dist/pages/index.d.ts +617 -0
- package/dist/pages/index.js +10 -0
- package/dist/pages/index.js.map +1 -0
- package/dist/pages/index.jsx +50 -0
- package/dist/primitives/default/index.d.ts +6 -0
- package/dist/primitives/default/index.js +3 -0
- package/dist/primitives/default/index.js.map +1 -0
- package/dist/primitives/default/index.jsx +7 -0
- package/dist/primitives/index.d.ts +122 -0
- package/dist/primitives/index.js +3 -0
- package/dist/primitives/index.js.map +1 -0
- package/dist/primitives/index.jsx +9 -0
- package/dist/stores/index.d.ts +48 -0
- package/dist/stores/index.js +6 -0
- package/dist/stores/index.js.map +1 -0
- package/dist/stores/index.jsx +16 -0
- package/dist/surveyV2-BgQHK0GE.d.ts +48 -0
- package/dist/testing/adapter.d.ts +104 -0
- package/dist/testing/adapter.d.ts.map +1 -0
- package/dist/testing/adapter.js +14 -0
- package/dist/testing/adapter.js.map +1 -0
- package/dist/testing/env.d.ts +29 -0
- package/dist/testing/env.d.ts.map +1 -0
- package/dist/testing/env.js +42 -0
- package/dist/testing/env.js.map +1 -0
- package/dist/testing/fixtures.d.ts +70 -0
- package/dist/testing/fixtures.d.ts.map +1 -0
- package/dist/testing/fixtures.js +74 -0
- package/dist/testing/fixtures.js.map +1 -0
- package/dist/testing/index.d.ts +15 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +14 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/mocks.d.ts +53 -0
- package/dist/testing/mocks.d.ts.map +1 -0
- package/dist/testing/mocks.js +90 -0
- package/dist/testing/mocks.js.map +1 -0
- package/dist/testing/seam-suite.d.ts +39 -0
- package/dist/testing/seam-suite.d.ts.map +1 -0
- package/dist/testing/seam-suite.js +196 -0
- package/dist/testing/seam-suite.js.map +1 -0
- package/dist/testing/storage.d.ts +40 -0
- package/dist/testing/storage.d.ts.map +1 -0
- package/dist/testing/storage.js +71 -0
- package/dist/testing/storage.js.map +1 -0
- package/dist/theme/admin.css +579 -0
- package/dist/theme/affiliate.css +191 -0
- package/dist/theme/flow.css +497 -0
- package/dist/theme/index.d.ts +84 -0
- package/dist/theme/index.js +94 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme/index.jsx +97 -0
- package/dist/theme/member-portal.css +1762 -0
- package/package.json +199 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// src/config.tsx
|
|
2
|
+
var current = null;
|
|
3
|
+
var configuredListeners = /* @__PURE__ */ new Set();
|
|
4
|
+
function configure(c) {
|
|
5
|
+
current = c;
|
|
6
|
+
for (const cb of configuredListeners) {
|
|
7
|
+
try {
|
|
8
|
+
cb();
|
|
9
|
+
} catch {
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function onConfigured(cb) {
|
|
14
|
+
if (current) cb();
|
|
15
|
+
else configuredListeners.add(cb);
|
|
16
|
+
}
|
|
17
|
+
function getConfig() {
|
|
18
|
+
if (!current) {
|
|
19
|
+
throw new Error("the-frontend: configure({ apiBase, tenantKey, storagePrefix }) must be called before any API or store is used.");
|
|
20
|
+
}
|
|
21
|
+
return current;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { configure, getConfig, onConfigured };
|
|
25
|
+
//# sourceMappingURL=5XGPFYIJ.js.map
|
|
26
|
+
//# sourceMappingURL=5XGPFYIJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/config.tsx"],"names":["current","configuredListeners","Set","configure","c","cb","onConfigured","add","getConfig","Error"],"mappings":";AA4CA,IAAIA,OAAAA,GAA+B,IAAA;AACnC,IAAMC,mBAAAA,uBAA0BC,GAAAA,EAAgB;AAEzC,SAASC,UAAUC,CAAAA,EAAuB;AAC/CJ,EAAAA,OAAAA,GAAUI,CAAAA;AAGV,EAAA,KAAA,MAAWC,MAAMJ,mBAAAA,EAAqB;AACpC,IAAA,IAAI;AACFI,MAAAA,EAAAA,EAAG;IACL,CAAA,CAAA,MAAQ;AACN,IAAA;AAEJ,EAAA;AACF;AASO,SAASC,aAAaD,EAAAA,EAAsB;AACjD,EAAA,IAAIL,SAASK,EAAAA,EAAG;AACXJ,OAAAA,mBAAAA,CAAoBM,IAAIF,EAAE,CAAA;AACjC;AAEO,SAASG,SAAAA,GAA0B;AACxC,EAAA,IAAI,CAACR,OAAAA,EAAS;AACZ,IAAA,MAAM,IAAIS,MACR,gHACF,CAAA;AACF,EAAA;AACA,EAAA,OAAOT,OAAAA;AACT","file":"5XGPFYIJ.js","sourcesContent":["export interface PortalConfig {\n /** Base URL for backend API requests, e.g. `/api` or `https://api.example.com`. */\n apiBase: string;\n /** Value sent in the `X-Tenant-Key` header to identify this site to the multi-tenant backend. */\n tenantKey: string;\n /** Prefix for localStorage keys (auth tokens, cart, etc.). Pick something unique per site to avoid collisions when multiple sites share an origin in dev. */\n storagePrefix: string;\n /**\n * Base URL for the Apex Telemed v2 embedded survey API. The browser hits this\n * directly (no proxy) using `apexPublishableKey` + the partner's allowed-origin\n * allowlist on the Apex side. Required to use `apexV2Api` / `useSurveyV2Flow`\n * / `SurveyV2Page`. Example: `https://apextelemed.com/api` in prod,\n * `http://localhost:8080/api` in dev.\n */\n apexEmbedApiBase?: string;\n /** Partner's publishable key (pk_*). Safe to ship in client JS. */\n apexPublishableKey?: string;\n /**\n * USPS codes (e.g. `['DE']`) of states this tenant cannot serve. They are\n * omitted from every state dropdown fed by `stateOptions()` /\n * `availableStates()`, and shipping-address validation rejects them (so a\n * previously saved address in one of these states can't slip through\n * prefill). Billing addresses are NOT restricted — the restriction is about\n * where medications ship. Omit for the default: all 50 states + DC.\n */\n unavailableStates?: string[];\n /**\n * Short user-facing note rendered near state dropdowns when\n * `unavailableStates` is set, e.g. \"Acme cannot provide medications to\n * customers in Delaware.\" Also used as the validation message when a saved\n * address falls in an unavailable state.\n */\n unavailableStatesNote?: string;\n /**\n * Send an `Idempotency-Key` header on charge/create requests so the backend\n * can dedupe a retried-after-network-drop or double-clicked mutation instead\n * of double-charging / double-creating. Default OFF: leave disabled until the\n * backend both (a) CORS-allow-lists the `Idempotency-Key` request header —\n * otherwise the preflight fails and the request is blocked — and (b) actually\n * honors the key for dedup. Flip to `true` per tenant once both are live.\n */\n idempotencyKeys?: boolean;\n}\n\nlet current: PortalConfig | null = null;\nconst configuredListeners = new Set<() => void>();\n\nexport function configure(c: PortalConfig): void {\n current = c;\n // Notify anything that deferred work until config was available (e.g. auth\n // stores that must not read token storage before `storagePrefix` is known).\n for (const cb of configuredListeners) {\n try {\n cb();\n } catch {\n // A listener must never break configure().\n }\n }\n}\n\n/**\n * Run `cb` once configuration is available: immediately if `configure()` has\n * already been called, otherwise on the next `configure()`. Module-internal —\n * intentionally not re-exported from the package entrypoint. Lets the singleton\n * stores hydrate after boot instead of snapshotting storage at import time\n * (which runs before the host site calls `configure()`).\n */\nexport function onConfigured(cb: () => void): void {\n if (current) cb();\n else configuredListeners.add(cb);\n}\n\nexport function getConfig(): PortalConfig {\n if (!current) {\n throw new Error(\n 'the-frontend: configure({ apiBase, tenantKey, storagePrefix }) must be called before any API or store is used.',\n );\n }\n return current;\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createComponent } from 'solid-js/web';
|
|
2
|
+
import { createContext, useContext } from 'solid-js';
|
|
3
|
+
|
|
4
|
+
// src/primitives.tsx
|
|
5
|
+
var PrimitivesContext = createContext();
|
|
6
|
+
function PrimitivesProvider(props) {
|
|
7
|
+
return createComponent(PrimitivesContext.Provider, {
|
|
8
|
+
get value() {
|
|
9
|
+
return props.value;
|
|
10
|
+
},
|
|
11
|
+
get children() {
|
|
12
|
+
return props.children;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function usePrimitives() {
|
|
17
|
+
const ctx = useContext(PrimitivesContext);
|
|
18
|
+
if (!ctx) {
|
|
19
|
+
throw new Error("usePrimitives() called outside <PrimitivesProvider>. Wrap your app at the root.");
|
|
20
|
+
}
|
|
21
|
+
return ctx;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { PrimitivesProvider, usePrimitives };
|
|
25
|
+
//# sourceMappingURL=67KHO66G.js.map
|
|
26
|
+
//# sourceMappingURL=67KHO66G.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/primitives.tsx"],"names":["PrimitivesContext","createContext","PrimitivesProvider","props","_$createComponent","Provider","value","children","usePrimitives","ctx","useContext","Error"],"mappings":";;;;AA+JA,IAAMA,oBAAoBC,aAAAA,EAA0B;AAE7C,SAASC,mBAAmBC,KAAAA,EAAqD;AACtF,EAAA,OAAAC,eAAAA,CACGJ,kBAAkBK,QAAAA,EAAQ;AAAA,IAAA,IAACC,KAAAA,GAAK;AAAA,MAAA,OAAEH,KAAAA,CAAMG,KAAAA;AAAK,IAAA,CAAA;AAAA,IAAA,IAAAC,QAAAA,GAAA;AAAA,MAAA,OAAGJ,KAAAA,CAAMI,QAAAA;AAAQ,IAAA;GAAA,CAAA;AAEnE;AAEO,SAASC,aAAAA,GAA4B;AAC1C,EAAA,MAAMC,GAAAA,GAAMC,WAAWV,iBAAiB,CAAA;AACxC,EAAA,IAAI,CAACS,GAAAA,EAAK;AACR,IAAA,MAAM,IAAIE,MACR,iFACF,CAAA;AACF,EAAA;AACA,EAAA,OAAOF,GAAAA;AACT","file":"67KHO66G.js","sourcesContent":["import { createContext, useContext, type Component, type JSX } from 'solid-js';\n\n// ── Primitive prop interfaces ───────────────────────────────────────\n//\n// Each primitive defines the contract a consumer site must implement to\n// render shared flows (Survey, Checkout, Signup, etc.) in its own design\n// language. Keep this surface small — every prop added here must be\n// implemented by every consumer site.\n\nexport type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'danger';\nexport type ButtonSize = 'sm' | 'md' | 'lg';\n\nexport interface ButtonProps {\n variant?: ButtonVariant;\n size?: ButtonSize;\n type?: 'button' | 'submit';\n disabled?: boolean;\n loading?: boolean;\n fullWidth?: boolean;\n onClick?: (e: MouseEvent) => void;\n children: JSX.Element;\n}\n\nexport interface TextFieldProps {\n value: string;\n onInput: (v: string) => void;\n type?: 'text' | 'email' | 'password' | 'tel' | 'date' | 'number';\n label?: string;\n placeholder?: string;\n error?: string;\n required?: boolean;\n disabled?: boolean;\n autocomplete?: string;\n inputmode?: 'text' | 'numeric' | 'tel' | 'email' | 'decimal';\n}\n\nexport interface TextareaProps {\n value: string;\n onInput: (v: string) => void;\n label?: string;\n placeholder?: string;\n rows?: number;\n error?: string;\n required?: boolean;\n}\n\nexport interface SelectOption {\n value: string;\n label: string;\n}\n\nexport interface SelectProps {\n value: string;\n onChange: (v: string) => void;\n options: SelectOption[];\n label?: string;\n placeholder?: string;\n error?: string;\n required?: boolean;\n /** Parity with TextFieldProps — lets a Select sit in a read-only group\n * (e.g. billing fields mirrored from shipping) instead of being unmounted. */\n disabled?: boolean;\n}\n\nexport interface ChoiceOption {\n value: string;\n label: string;\n description?: string;\n}\n\nexport interface RadioGroupProps {\n value: string;\n onChange: (v: string) => void;\n options: ChoiceOption[];\n label?: string;\n error?: string;\n}\n\nexport interface CheckboxGroupProps {\n values: string[];\n onChange: (vs: string[]) => void;\n options: ChoiceOption[];\n label?: string;\n error?: string;\n}\n\nexport interface CardProps {\n children: JSX.Element;\n /** Visual emphasis. `primary` is the page-level container; `inset` is for nested content. */\n variant?: 'primary' | 'inset';\n padding?: 'sm' | 'md' | 'lg' | 'none';\n class?: string;\n}\n\nexport type BannerVariant = 'error' | 'success' | 'warning' | 'info';\n\nexport interface BannerProps {\n variant: BannerVariant;\n children: JSX.Element;\n}\n\nexport type Status =\n | 'active'\n | 'pending'\n | 'processing'\n | 'completed'\n | 'approved'\n | 'denied'\n | 'paused'\n | 'cancelled'\n | 'new';\n\nexport interface StatusPillProps {\n status: Status;\n /** Override the default label derived from `status`. */\n label?: string;\n}\n\nexport interface SpinnerProps {\n size?: 'sm' | 'md' | 'lg';\n}\n\nexport interface HeadingProps {\n level: 1 | 2 | 3;\n children: JSX.Element;\n class?: string;\n}\n\nexport interface StepIndicatorProps {\n current: number;\n total: number;\n labels?: string[];\n}\n\n// ── Primitives container ────────────────────────────────────────────\n\nexport interface Primitives {\n // Layout\n Card: Component<CardProps>;\n // Form fields\n TextField: Component<TextFieldProps>;\n Textarea: Component<TextareaProps>;\n Select: Component<SelectProps>;\n RadioGroup: Component<RadioGroupProps>;\n CheckboxGroup: Component<CheckboxGroupProps>;\n // Buttons\n Button: Component<ButtonProps>;\n // Feedback\n Banner: Component<BannerProps>;\n StatusPill: Component<StatusPillProps>;\n Spinner: Component<SpinnerProps>;\n // Typography\n Heading: Component<HeadingProps>;\n // Multi-step\n StepIndicator: Component<StepIndicatorProps>;\n}\n\n// ── Provider + hook ─────────────────────────────────────────────────\n\nconst PrimitivesContext = createContext<Primitives>();\n\nexport function PrimitivesProvider(props: { value: Primitives; children: JSX.Element }) {\n return (\n <PrimitivesContext.Provider value={props.value}>{props.children}</PrimitivesContext.Provider>\n );\n}\n\nexport function usePrimitives(): Primitives {\n const ctx = useContext(PrimitivesContext);\n if (!ctx) {\n throw new Error(\n 'usePrimitives() called outside <PrimitivesProvider>. Wrap your app at the root.',\n );\n }\n return ctx;\n}\n"]}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import {
|
|
2
|
+
peekFunnelSessionId
|
|
3
|
+
} from "./I46Y2J5W.jsx";
|
|
4
|
+
import {
|
|
5
|
+
getConfig
|
|
6
|
+
} from "./LDZIUFDM.jsx";
|
|
7
|
+
|
|
8
|
+
// src/api/cart.ts
|
|
9
|
+
var DISABLED = { snapshot: false };
|
|
10
|
+
var configPromise = null;
|
|
11
|
+
function fetchCartConfig() {
|
|
12
|
+
if (!configPromise) {
|
|
13
|
+
configPromise = (async () => {
|
|
14
|
+
try {
|
|
15
|
+
const cfg = getConfig();
|
|
16
|
+
const res = await fetch(`${cfg.apiBase}/config/cart`, {
|
|
17
|
+
headers: { "X-Tenant-Key": cfg.tenantKey }
|
|
18
|
+
});
|
|
19
|
+
if (!res.ok) return DISABLED;
|
|
20
|
+
const body = await res.json();
|
|
21
|
+
return { snapshot: body.snapshot === true };
|
|
22
|
+
} catch {
|
|
23
|
+
return DISABLED;
|
|
24
|
+
}
|
|
25
|
+
})();
|
|
26
|
+
}
|
|
27
|
+
return configPromise;
|
|
28
|
+
}
|
|
29
|
+
function resetCartConfigCache() {
|
|
30
|
+
configPromise = null;
|
|
31
|
+
}
|
|
32
|
+
var cartIdKey = () => `${getConfig().storagePrefix}-cart-id`;
|
|
33
|
+
function cartId() {
|
|
34
|
+
let id = null;
|
|
35
|
+
try {
|
|
36
|
+
id = localStorage.getItem(cartIdKey());
|
|
37
|
+
} catch {
|
|
38
|
+
}
|
|
39
|
+
if (!id) {
|
|
40
|
+
id = typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
41
|
+
try {
|
|
42
|
+
localStorage.setItem(cartIdKey(), id);
|
|
43
|
+
} catch {
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return id;
|
|
47
|
+
}
|
|
48
|
+
function adoptCartId(id) {
|
|
49
|
+
if (!id) return;
|
|
50
|
+
try {
|
|
51
|
+
localStorage.setItem(cartIdKey(), id);
|
|
52
|
+
} catch {
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function resetCartId() {
|
|
56
|
+
try {
|
|
57
|
+
localStorage.removeItem(cartIdKey());
|
|
58
|
+
} catch {
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function postCartSnapshot(params) {
|
|
62
|
+
try {
|
|
63
|
+
const cfg = getConfig();
|
|
64
|
+
void fetch(`${cfg.apiBase}/cart/snapshot`, {
|
|
65
|
+
method: "POST",
|
|
66
|
+
keepalive: true,
|
|
67
|
+
headers: {
|
|
68
|
+
"Content-Type": "application/json",
|
|
69
|
+
"X-Tenant-Key": cfg.tenantKey
|
|
70
|
+
},
|
|
71
|
+
body: JSON.stringify({
|
|
72
|
+
cartId: cartId(),
|
|
73
|
+
items: params.items,
|
|
74
|
+
promoCode: params.promoCode ?? null,
|
|
75
|
+
...params.email ? { email: params.email } : {},
|
|
76
|
+
// Only when a survey session already exists: it lets the backend reuse
|
|
77
|
+
// the address the pre-survey email gate collected, which is often the
|
|
78
|
+
// only handle we have on an anonymous shopper.
|
|
79
|
+
...peekFunnelSessionId() ? { sessionId: peekFunnelSessionId() } : {}
|
|
80
|
+
})
|
|
81
|
+
}).catch(() => {
|
|
82
|
+
});
|
|
83
|
+
} catch {
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
async function fetchResumedCart(token) {
|
|
87
|
+
try {
|
|
88
|
+
const cfg = getConfig();
|
|
89
|
+
const res = await fetch(`${cfg.apiBase}/cart/resume?token=${encodeURIComponent(token)}`, {
|
|
90
|
+
headers: { "X-Tenant-Key": cfg.tenantKey }
|
|
91
|
+
});
|
|
92
|
+
if (!res.ok) return null;
|
|
93
|
+
const body = await res.json();
|
|
94
|
+
if (!body.cartId || !Array.isArray(body.items) || body.items.length === 0) return null;
|
|
95
|
+
return {
|
|
96
|
+
cartId: body.cartId,
|
|
97
|
+
items: body.items,
|
|
98
|
+
unavailable: Array.isArray(body.unavailable) ? body.unavailable : [],
|
|
99
|
+
promoCode: body.promoCode ?? null,
|
|
100
|
+
subtotalCents: typeof body.subtotalCents === "number" ? body.subtotalCents : 0
|
|
101
|
+
};
|
|
102
|
+
} catch {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function readCartToken() {
|
|
107
|
+
try {
|
|
108
|
+
const token = new URLSearchParams(window.location.search).get("cart");
|
|
109
|
+
return token && token.length > 0 ? token : null;
|
|
110
|
+
} catch {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function stripCartToken() {
|
|
115
|
+
try {
|
|
116
|
+
const url = new URL(window.location.href);
|
|
117
|
+
if (!url.searchParams.has("cart")) return;
|
|
118
|
+
url.searchParams.delete("cart");
|
|
119
|
+
window.history.replaceState({}, "", url.toString());
|
|
120
|
+
} catch {
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export {
|
|
125
|
+
fetchCartConfig,
|
|
126
|
+
resetCartConfigCache,
|
|
127
|
+
cartId,
|
|
128
|
+
adoptCartId,
|
|
129
|
+
resetCartId,
|
|
130
|
+
postCartSnapshot,
|
|
131
|
+
fetchResumedCart,
|
|
132
|
+
readCartToken,
|
|
133
|
+
stripCartToken
|
|
134
|
+
};
|
|
135
|
+
//# sourceMappingURL=6TFBQECC.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"AN3WPMEP.js"}
|