@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
package/LICENSE
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
Apex Telemed Platform Integration License
|
|
2
|
+
Version 1.0, August 2026
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2026 Apex Telemed ("Licensor")
|
|
5
|
+
|
|
6
|
+
This license applies to the software package @apextelemed/partner-core
|
|
7
|
+
and its source code, documentation, and any modified or derivative versions
|
|
8
|
+
(together, the "Software").
|
|
9
|
+
|
|
10
|
+
This is not an open source license. It permits use of the Software only for
|
|
11
|
+
the purpose described below.
|
|
12
|
+
|
|
13
|
+
1. Permitted Purpose
|
|
14
|
+
|
|
15
|
+
"Permitted Purpose" means building, deploying, and operating a website,
|
|
16
|
+
application, or service that (a) integrates with the telehealth platform
|
|
17
|
+
and backend services operated by Licensor, through the interfaces Licensor
|
|
18
|
+
makes available to its customers for that purpose, and (b) is operated by,
|
|
19
|
+
or on behalf of, a current customer of Licensor for that customer's own
|
|
20
|
+
business.
|
|
21
|
+
|
|
22
|
+
2. Grant
|
|
23
|
+
|
|
24
|
+
Subject to the terms of this license, Licensor grants you a worldwide,
|
|
25
|
+
royalty-free, non-exclusive, non-transferable license to use, copy, modify,
|
|
26
|
+
create derivative works of, and distribute the Software, in source or
|
|
27
|
+
compiled form, solely for the Permitted Purpose.
|
|
28
|
+
|
|
29
|
+
3. Restrictions
|
|
30
|
+
|
|
31
|
+
Any use of the Software outside the Permitted Purpose is not licensed.
|
|
32
|
+
Without limiting that, you may not use the Software, or any part or
|
|
33
|
+
derivative of it, with any platform or backend service other than
|
|
34
|
+
Licensor's, or to build a product that competes with Licensor's platform.
|
|
35
|
+
Any such use requires a separate written license from Licensor.
|
|
36
|
+
|
|
37
|
+
4. Redistribution
|
|
38
|
+
|
|
39
|
+
Any copy of the Software, modified or unmodified, that you distribute must
|
|
40
|
+
include this license and retain all copyright, license, and attribution
|
|
41
|
+
notices present in the Software. If you receive the Software from a third
|
|
42
|
+
party, this license governs your use of it.
|
|
43
|
+
|
|
44
|
+
5. Termination
|
|
45
|
+
|
|
46
|
+
This license terminates automatically if you breach it. Upon termination
|
|
47
|
+
you must stop using and distributing the Software. Sections 6 and 7
|
|
48
|
+
survive termination.
|
|
49
|
+
|
|
50
|
+
6. Trademarks
|
|
51
|
+
|
|
52
|
+
This license does not grant any right to use the names, trademarks, or
|
|
53
|
+
logos of Licensor or its affiliates, except as required to reproduce the
|
|
54
|
+
notices in Section 4.
|
|
55
|
+
|
|
56
|
+
7. Disclaimer
|
|
57
|
+
|
|
58
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE SOFTWARE IS PROVIDED "AS
|
|
59
|
+
IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING WITHOUT
|
|
60
|
+
LIMITATION WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
|
61
|
+
PURPOSE, NON-INFRINGEMENT, AND TITLE. IN NO EVENT WILL LICENSOR BE LIABLE
|
|
62
|
+
FOR ANY DAMAGES ARISING FROM THE USE OF THE SOFTWARE.
|
|
63
|
+
|
|
64
|
+
For any other licensing arrangement, contact Apex Telemed.
|
package/README.md
ADDED
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
# @apextelemed/partner-core
|
|
2
|
+
|
|
3
|
+
Shared library for the telehealth patient-portal sites (perihelion, axiom-health, sculpted-sciences). Owns the API client, persistent stores, and — over time — headless flow hooks that let each site render its own UI on top of a shared state machine.
|
|
4
|
+
|
|
5
|
+
> The local checkout for this repo lives at `the-frontend/` for historical reasons; the published package name is `@apextelemed/partner-core`.
|
|
6
|
+
|
|
7
|
+
## What's in here
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
src/
|
|
11
|
+
config.ts configure({ apiBase, tenantKey, storagePrefix })
|
|
12
|
+
api/
|
|
13
|
+
client.ts apiFetch + namespaced API modules (auth, payments, subs, ...)
|
|
14
|
+
stores/
|
|
15
|
+
auth.ts authStore singleton (login, signup, logout, profile)
|
|
16
|
+
cart.ts cartStore singleton (items, promo, persistence)
|
|
17
|
+
medication.ts medicationStore singleton (selected drug)
|
|
18
|
+
flows/ headless hooks for survey/checkout/signup/dashboard/etc.
|
|
19
|
+
(empty for now — populated as pages are migrated)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Consumer setup
|
|
23
|
+
|
|
24
|
+
Sites must call `configure()` once at boot, before any store or API import is touched:
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
// src/index.tsx
|
|
28
|
+
import { configure } from '@apextelemed/partner-core/config';
|
|
29
|
+
|
|
30
|
+
configure({
|
|
31
|
+
apiBase: import.meta.env.VITE_API_BASE_URL ?? '/api',
|
|
32
|
+
tenantKey: import.meta.env.VITE_TENANT_KEY ?? 'perihelion-dev-key',
|
|
33
|
+
storagePrefix: 'perihelion', // unique per site
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// then mount the app
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Imports use subpath exports:
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { authStore, cartStore } from '@apextelemed/partner-core/stores';
|
|
43
|
+
import { paymentsApi, subscriptionsApi, type User } from '@apextelemed/partner-core/api';
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Distribution
|
|
47
|
+
|
|
48
|
+
Published to npm as a public package:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm install @apextelemed/partner-core
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Cut a release by bumping `version` in `package.json`, merging, then pushing a
|
|
55
|
+
matching tag: `git tag v0.1.0 && git push --tags`. `.github/workflows/release.yml`
|
|
56
|
+
builds, runs the guards, and publishes. A tag that is not on `main` is refused
|
|
57
|
+
before any build runs.
|
|
58
|
+
|
|
59
|
+
Two things are temporary, both for the first release only. Auth is an
|
|
60
|
+
`NPM_TOKEN`, because a trusted publisher cannot be configured for a package
|
|
61
|
+
that does not exist yet; it is marked for removal in the workflow, and is not
|
|
62
|
+
a fallback to leave in place — npm prefers a token whenever one is set and
|
|
63
|
+
never attempts the OIDC exchange. And `provenance` is off, because this repo
|
|
64
|
+
is still private; turn it back on in `publishConfig` once it is public.
|
|
65
|
+
|
|
66
|
+
### License
|
|
67
|
+
|
|
68
|
+
Source-available, not open source. The Apex Telemed Platform Integration
|
|
69
|
+
License in `LICENSE` lets you use, modify, and redistribute the package
|
|
70
|
+
however you like — as long as it is for building and operating a site that
|
|
71
|
+
integrates with Apex Telemed's platform on behalf of an Apex Telemed customer.
|
|
72
|
+
Any other use needs a separate license. There is no conversion to an open
|
|
73
|
+
source license. `package.json` declares `SEE LICENSE IN LICENSE`, so
|
|
74
|
+
dependency scanners will show it as a custom license; that is expected.
|
|
75
|
+
|
|
76
|
+
### What ships, and why the export map looks like that
|
|
77
|
+
|
|
78
|
+
Only `dist/` is published (`files: ["dist", "README.md", "LICENSE"]`), with
|
|
79
|
+
sourcemaps. `src/` is not in the tarball.
|
|
80
|
+
|
|
81
|
+
Each entry is exported under several conditions:
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
"./pages": {
|
|
85
|
+
"apex-src": "./src/pages/index.tsx",
|
|
86
|
+
"solid": "./dist/pages/index.jsx",
|
|
87
|
+
"import": { "types": "./dist/pages/index.d.ts", "default": "./dist/pages/index.js" }
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
- **`solid`** — JSX with types stripped but the JSX *not* compiled.
|
|
92
|
+
`vite-plugin-solid` enables this condition and compiles it in the consumer's
|
|
93
|
+
app, which is the best output: correct reactivity, real HMR, one Solid runtime.
|
|
94
|
+
- **`import`** — the same code compiled with `babel-preset-solid`, for anyone
|
|
95
|
+
resolving without that plugin (SSR, vitest, other bundlers).
|
|
96
|
+
- **`apex-src`** — a private condition used only inside this workspace; see
|
|
97
|
+
"Local development".
|
|
98
|
+
|
|
99
|
+
Shipping raw `.tsx` and letting consumers compile it — which is what the
|
|
100
|
+
`file:` symlinks in this workspace effectively do — is not an option for a real
|
|
101
|
+
install. Vite pre-bundles dependencies with esbuild, and esbuild cannot perform
|
|
102
|
+
Solid's compile-time JSX transform; components render once and never update.
|
|
103
|
+
|
|
104
|
+
**Every entry in `build.entries.mjs` must be `.tsx`, including the ones with no
|
|
105
|
+
JSX in them.** `tsup-preset-solid` emits the `solid` condition only for `.tsx`
|
|
106
|
+
entries and builds those in a separate tsup invocation, i.e. a separate chunk
|
|
107
|
+
graph. Mix the two and a consumer resolving through `solid` draws `pages` from
|
|
108
|
+
one graph and `config`/`stores` from the other — two copies of modules whose
|
|
109
|
+
whole design is that there is one: `configure()` writes a `current` the stores
|
|
110
|
+
never read, and the host app's chrome watches a different `authStore` than the
|
|
111
|
+
package's pages do. Nothing throws. `tests/published/singleton.test.mjs` guards it,
|
|
112
|
+
and `npm run smoke:pack` proves the real tarball resolves correctly by
|
|
113
|
+
installing it into a throwaway Vite app.
|
|
114
|
+
|
|
115
|
+
`package.json`'s `exports` is generated — edit `build.entries.mjs` and run
|
|
116
|
+
`npm run gen:exports`. CI fails if the two drift.
|
|
117
|
+
|
|
118
|
+
## Local development
|
|
119
|
+
|
|
120
|
+
Sites in this workspace still link the package by path
|
|
121
|
+
(`"@apextelemed/partner-core": "file:../the-frontend"`). Because the
|
|
122
|
+
export map now points at `dist/`, a link alone would mean editing core requires
|
|
123
|
+
a rebuild before the site sees it.
|
|
124
|
+
|
|
125
|
+
The `apex-src` condition restores instant HMR. In the consumer site's
|
|
126
|
+
`vite.config.ts`:
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
resolve: {
|
|
130
|
+
conditions: ['apex-src'],
|
|
131
|
+
dedupe: ['solid-js'],
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
That resolves every subpath to `the-frontend/src/*` instead of `dist/*`, so
|
|
136
|
+
Vite compiles core as app source exactly as it did before. Set it in the site's
|
|
137
|
+
`vitest` and Playwright configs too — miss one and that runner silently tests
|
|
138
|
+
`dist` while the dev server tests `src`.
|
|
139
|
+
|
|
140
|
+
Two things about the name. It is **not** called `development`: Vite defaults
|
|
141
|
+
`resolve.conditions` to `['module', 'browser', 'development|production']`, so a
|
|
142
|
+
`development` key would be enabled on every consumer's dev server — including
|
|
143
|
+
external clients, who would resolve into a `src/` this package does not
|
|
144
|
+
publish, breaking `vite dev` while `vite build` passes. And `./testing`
|
|
145
|
+
deliberately has no `apex-src` condition: Playwright refuses to strip types
|
|
146
|
+
from files under `node_modules`, so that entry stays prebuilt even in dev.
|
|
147
|
+
|
|
148
|
+
Alternatively, run `npx tsup --watch` in core and keep consuming `dist/`.
|
|
149
|
+
|
|
150
|
+
## Testing a consumer site (the seam suite)
|
|
151
|
+
|
|
152
|
+
This package ships the test suite consumer sites run against themselves, from
|
|
153
|
+
`@apextelemed/partner-core/testing`. A site supplies a ~40-line adapter
|
|
154
|
+
describing itself; the checks come from here.
|
|
155
|
+
|
|
156
|
+
The division is deliberate. **This repo already proves the funnel** — `npm run
|
|
157
|
+
test:e2e` drives these pages against a real backend across two tenant
|
|
158
|
+
archetypes. What no test here can prove is whether a *particular site* wired the
|
|
159
|
+
package up correctly, and that is a narrow, fast set of questions:
|
|
160
|
+
|
|
161
|
+
| check | catches |
|
|
162
|
+
| --- | --- |
|
|
163
|
+
| `routes` | a route that throws or renders nothing on boot |
|
|
164
|
+
| `boot` | a stored session dropped during a cold page load |
|
|
165
|
+
| `storage` | a key written without the site's prefix, so site and package read different storage |
|
|
166
|
+
| `singleton` | site chrome that never sees the package's auth state |
|
|
167
|
+
|
|
168
|
+
Everything is mocked — no backend, no credentials, no fixtures. That is a
|
|
169
|
+
requirement, not a convenience: a suite needing secrets cannot run on a fork PR,
|
|
170
|
+
cannot be a required check, and so will not be the thing that stops a broken
|
|
171
|
+
wiring from shipping.
|
|
172
|
+
|
|
173
|
+
### Wiring a site
|
|
174
|
+
|
|
175
|
+
Three files. See `perihelion` for a worked example.
|
|
176
|
+
|
|
177
|
+
**`e2e/seam.spec.ts`** — the only site-specific part:
|
|
178
|
+
|
|
179
|
+
```ts
|
|
180
|
+
import { test, expect } from '@playwright/test';
|
|
181
|
+
import { defineSeamSuite } from '@apextelemed/partner-core/testing';
|
|
182
|
+
|
|
183
|
+
defineSeamSuite(
|
|
184
|
+
{
|
|
185
|
+
siteName: 'acme',
|
|
186
|
+
storagePrefix: 'acme', // must match the site's configure()
|
|
187
|
+
apiBase: '/api',
|
|
188
|
+
routes: { home: '/', login: '/login', signup: '/signup', dashboard: '/dashboard' },
|
|
189
|
+
nav: { loggedOutText: 'Log In', loggedInText: 'Dashboard', logOutText: 'Log Out' },
|
|
190
|
+
patient: { email: 'user@test.com', password: 'test1234' },
|
|
191
|
+
allowStorageKeys: [], // any localStorage key the SITE writes
|
|
192
|
+
},
|
|
193
|
+
{ test, expect },
|
|
194
|
+
);
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
`test` and `expect` are passed in rather than imported inside the suite. Sites
|
|
198
|
+
link this package as `file:../the-frontend`, i.e. a symlink, and Node resolves a
|
|
199
|
+
symlinked module's imports from its *real* path — so an import there would load
|
|
200
|
+
a second copy of `@playwright/test`, which Playwright rejects outright.
|
|
201
|
+
|
|
202
|
+
**`playwright.seam.config.ts`** — call `assertSeamEnv()` at the top, then a
|
|
203
|
+
normal config whose `testMatch` is `seam.spec.ts`.
|
|
204
|
+
|
|
205
|
+
**`package.json`**:
|
|
206
|
+
|
|
207
|
+
```json
|
|
208
|
+
"test:seam": "NODE_OPTIONS=--preserve-symlinks playwright test --config playwright.seam.config.ts"
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
`--preserve-symlinks` is not optional, and cannot be applied from inside the
|
|
212
|
+
config — it has to be set before Node starts. Without it the package resolves
|
|
213
|
+
outside the site's project root and Playwright fails with "Test not found in the
|
|
214
|
+
worker process", which says nothing about symlinks. `assertSeamEnv()` exists to
|
|
215
|
+
turn that into a message that names the real problem. See `src/testing/env.ts`.
|
|
216
|
+
|
|
217
|
+
### The CI gate
|
|
218
|
+
|
|
219
|
+
Sites call the reusable workflow in `.github/workflows/site-seam-suite.yml`
|
|
220
|
+
rather than copying it:
|
|
221
|
+
|
|
222
|
+
```yaml
|
|
223
|
+
jobs:
|
|
224
|
+
seam:
|
|
225
|
+
uses: thefortifiedgrp/apex-partner-core/.github/workflows/site-seam-suite.yml@dev
|
|
226
|
+
secrets:
|
|
227
|
+
core-token: ${{ secrets.APEX_CORE_TOKEN }}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
It handles the sibling checkout of core (`../the-frontend`), builds the test
|
|
231
|
+
kit, and runs the site's `test:seam`. It no longer clones or builds
|
|
232
|
+
`apex-survey-helper` — core resolves the survey packages from the registry now.
|
|
233
|
+
|
|
234
|
+
### Changing the suite
|
|
235
|
+
|
|
236
|
+
The checks live in `src/testing/`. Changing one changes every site at once —
|
|
237
|
+
which is the point, and the reason to be careful:
|
|
238
|
+
|
|
239
|
+
- `src/testing/storage.ts` declares every localStorage key this package writes.
|
|
240
|
+
`storage.contract.test.ts` scans the source and fails if a key isn't declared,
|
|
241
|
+
so the downstream audit can't quietly narrow. Add the suffix in the same
|
|
242
|
+
commit that adds the key.
|
|
243
|
+
- `src/testing/fixtures.ts` is deliberately free of imports from `src/api/` —
|
|
244
|
+
its declarations ship, and a relative type import would resolve against a
|
|
245
|
+
`dist/api/` that is never built. `fixtures.contract.test.ts` keeps the shapes
|
|
246
|
+
honest instead.
|
|
247
|
+
- `npm run build:testing` compiles the entry point. Core's CI runs it, because a
|
|
248
|
+
broken emit here fails in every consumer site's PR rather than in this one.
|
|
249
|
+
|
|
250
|
+
## Three tiers, picked per page
|
|
251
|
+
|
|
252
|
+
Different pages have different ratios of (logic complexity) × (visual divergence). Pick the highest tier each page can support:
|
|
253
|
+
|
|
254
|
+
| Tier | Ships | Use when |
|
|
255
|
+
|---|---|---|
|
|
256
|
+
| 1. Logic | api client, stores, types | always |
|
|
257
|
+
| 2. Headless flow | hook returning `{ state, actions, derived }` | site wants full UI control |
|
|
258
|
+
| 3. Themed page | `<SurveyPage/>` etc. that consume `usePrimitives()` | site is happy to render through the package's structure with its own primitive components |
|
|
259
|
+
|
|
260
|
+
Sites that adopt Tier 3 must provide a primitive set via context (see below). Sites can mix per page: one site might use the themed `<SurveyPage>` but write its own dashboard JSX on top of `useDashboardData()`.
|
|
261
|
+
|
|
262
|
+
## Primitive set (Tier 3)
|
|
263
|
+
|
|
264
|
+
Sites consuming Tier 3 components must provide implementations of the `Primitives` interface and wrap the app in `<PrimitivesProvider>`:
|
|
265
|
+
|
|
266
|
+
```tsx
|
|
267
|
+
import { PrimitivesProvider, type Primitives } from '@apextelemed/partner-core';
|
|
268
|
+
import { Button, Card, TextField, /* ... */ } from './primitives';
|
|
269
|
+
|
|
270
|
+
const sitePrimitives: Primitives = {
|
|
271
|
+
Card,
|
|
272
|
+
TextField,
|
|
273
|
+
Textarea,
|
|
274
|
+
Select,
|
|
275
|
+
RadioGroup,
|
|
276
|
+
CheckboxGroup,
|
|
277
|
+
Button,
|
|
278
|
+
Banner,
|
|
279
|
+
StatusPill,
|
|
280
|
+
Spinner,
|
|
281
|
+
Heading,
|
|
282
|
+
StepIndicator,
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
render(() => (
|
|
286
|
+
<PrimitivesProvider value={sitePrimitives}>
|
|
287
|
+
<App />
|
|
288
|
+
</PrimitivesProvider>
|
|
289
|
+
), root);
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
The interface is defined in `src/primitives.tsx`. It is intentionally small — every prop on a primitive is a contract every consumer site must implement. Resist the urge to add prop variants; extend the interface only when a Tier 3 component genuinely needs the variant.
|
|
293
|
+
|
|
294
|
+
## What's shipped
|
|
295
|
+
|
|
296
|
+
| Surface | Subpath | Tier |
|
|
297
|
+
|---|---|---|
|
|
298
|
+
| API client + types | `/api` | 1 |
|
|
299
|
+
| Stores (auth, cart, medication) | `/stores` | 1 |
|
|
300
|
+
| Headless flow hooks | `/flows` | 2 |
|
|
301
|
+
| Tier 3 primitives contract | `/primitives` | 3 |
|
|
302
|
+
| Tier 3 page components | `/pages` | 3 |
|
|
303
|
+
| Admin theme (CSS variables + UnoCSS preset) | `/theme`, `/theme/admin.css` | — |
|
|
304
|
+
|
|
305
|
+
### Tier 3 pages
|
|
306
|
+
|
|
307
|
+
- `<SurveyPage>` — multi-step medical questionnaire
|
|
308
|
+
- `<CheckoutPage>` — prescription purchase with Authorize.Net Accept.js
|
|
309
|
+
- `<SignupPage>` — 4-step account creation with draft persistence
|
|
310
|
+
- `<SubscribePage>` — standalone subscription start for already-signed-in users
|
|
311
|
+
|
|
312
|
+
### Tier 2 flow hooks
|
|
313
|
+
|
|
314
|
+
- `useSurveyFlow` — backs `<SurveyPage>`
|
|
315
|
+
- `useCheckoutFlow` — backs `<CheckoutPage>`
|
|
316
|
+
- `useSignupFlow` — backs `<SignupPage>`
|
|
317
|
+
- `useSubscribeFlow` — backs `<SubscribePage>`
|
|
318
|
+
- `useDashboardData` — patient dashboard (Tier 2 only — no shared JSX)
|
|
319
|
+
- `useMessagesThread` — provider messaging with polling (Tier 2 only)
|
|
320
|
+
- `useCatalog`, `useProductDetail`, `useMedicationSelect` — product browsing (Tier 2 only)
|
|
321
|
+
|
|
322
|
+
### Admin
|
|
323
|
+
|
|
324
|
+
`<AdminDashboard>` is themed via CSS variables, not the Primitives interface — back-office UIs don't differentiate the brand. Sites import the default stylesheet once and override individual variables to match their look:
|
|
325
|
+
|
|
326
|
+
```ts
|
|
327
|
+
// src/index.tsx
|
|
328
|
+
import '@apextelemed/partner-core/theme/admin.css';
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
```css
|
|
332
|
+
/* site stylesheet — override any variables that need to match the brand */
|
|
333
|
+
:root {
|
|
334
|
+
--app-admin-bg: #f7f9fb;
|
|
335
|
+
--app-admin-fg: #0f172a;
|
|
336
|
+
--app-admin-radius: 0;
|
|
337
|
+
--app-admin-font-display: 'Orbitron', system-ui, sans-serif;
|
|
338
|
+
}
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
For sites that use UnoCSS, an optional preset adds shortcut classes (`bg-admin-bg`, `text-admin-fg`, etc.):
|
|
342
|
+
|
|
343
|
+
```ts
|
|
344
|
+
import { adminPreset } from '@apextelemed/partner-core/theme';
|
|
345
|
+
|
|
346
|
+
export default defineConfig({
|
|
347
|
+
theme: { ...adminPreset.theme },
|
|
348
|
+
shortcuts: { ...adminPreset.shortcuts },
|
|
349
|
+
});
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
The full variable list is exported as `ADMIN_CSS_VARIABLES` from `/theme` for sites that want to generate override stylesheets programmatically.
|
|
353
|
+
|
|
354
|
+
`<AdminDashboard>` includes Promotions as a tab — it is not a separate page.
|
|
355
|
+
|
|
356
|
+
## What stays out of this package
|
|
357
|
+
|
|
358
|
+
- Page-level JSX for customer-facing pages where visual divergence is too high (Dashboard, Catalog, Login, Home, ProductDetail, Messages)
|
|
359
|
+
- Branding components (OrbitField, MoleculeViz, hero illustrations)
|
|
360
|
+
- Route configuration (`App.tsx`)
|
|
361
|
+
- Per-site primitive implementations (each site builds its own Button/Card/TextField/etc. matching its design language)
|
|
362
|
+
- Theme tokens (`uno.config.ts`)
|
|
363
|
+
- Per-site product catalogs / seed data
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { A as AddressVerifyResult, a as AdminApexDrug, b as AdminCategory, c as AdminCategoryInput, d as AdminCustomer, e as AdminDashboardStats, f as AdminListParams, g as AdminPayment, h as AdminProduct, i as AdminPromoCode, j as AdminPromoCodeInput, k as AdminSale, l as AdminSaleInput, m as AdminSubscription, n as AdminSupportCustomer, o as AdminSupportStats, p as AdminSupportThread, q as AdminWebhookEvent, r as Affiliate, s as AffiliateAuthTokens, t as AffiliateClickRecord, u as AffiliateConversion, v as AffiliateDashboardLinks, w as AffiliateDashboardProfile, x as AffiliateDashboardStats, y as AffiliateDownlineMember, z as AffiliateEarningsBreakdown, B as AffiliatePaymentMethod, C as AffiliateProgram, D as AffiliateRegisterInput, E as AffiliateRegisterResponse, F as AffiliateSession, G as AffiliateStatsResponse, H as AffiliateStatus, I as AffiliateTrackResponse, J as ApiError, K as ApiResponse, L as AttributionMethod, M as AuthTokens, N as CatalogProduct, O as CheckoutAddress, P as CheckoutPayload, Q as CheckoutResult, R as CommissionConfig, S as CommissionStatus, T as CompleteSurveyPayload, U as CreateAffiliatePayload, V as CreateAffiliateProgramPayload, W as CreateOrderPayload, X as CreateRequestPayload, Y as CreateSubscriptionPayload, Z as CustomerDiscountConfig, _ as DeliveryInfo, $ as DiscountType, a0 as EmailTemplatesMap, a1 as LoginPayload, a2 as MemberPrescriptionRequest, a3 as MemberSurveyMode, a4 as MemberSurveyResponseSummary, a5 as MemberSurveyTranscript, a6 as MemberSurveyTranscriptItem, a7 as MemberSurveyTranscriptSection, a8 as MembersMeResponse, a9 as Order, aa as OrderItemInput, ab as PaginationParams, ac as PaymentCallbackPayload, ad as PaymentInitiatePayload, ae as PaymentType, af as PendingRenewalSurvey, ag as Placeholder, ah as ProductSaleSummary, ai as PromoValidationResponse, aj as PublicCategory, ak as RegisterAndSubscribePayload, al as RegisterPayload, am as RenewalStatus, an as SUPPORT_ATTACHMENT_MAX_BYTES, ao as SUPPORT_ATTACHMENT_MIME_TYPES, ap as SelectDrugPayload, aq as SendMessagePayload, ar as SendToPharmacyPayload, as as SupportAttachment, at as SupportMessage, au as SupportRealtimeToken, av as SupportThread, aw as SupportThreadStatus, ax as SurveySubmitPayload, ay as TemplatePlaceholdersMap, az as TemplateText, aA as TokenTrackName, aB as UpdateAffiliatePayload, aC as UpdateAffiliateProgramPayload, aD as UpdatePaymentMethodPayload, aE as UpdateProfilePayload, aF as User, aG as addressesApi, aH as adminAffiliatesApi, aI as adminApi, aJ as affiliateAuthStorageKey, aK as affiliatePortalApi, aL as apexApi, aM as apiFetch, aN as authApi, aO as authStorageKey, aP as clearAffiliateTokens, aQ as clearTokens, aR as getAffiliateTokens, aS as getTokens, aT as membersApi, aU as messagesApi, aV as newIdempotencyKey, aW as onTokensCleared, aX as ordersApi, aY as paymentsApi, aZ as productsApi, a_ as promoCodesApi, a$ as setAffiliateTokens, b0 as setTokens, b1 as subscriptionsApi, b2 as supportApi, b3 as usersApi } from '../client-BzSg2DEK.js';
|
|
2
|
+
export { EmbedApiError as ApexV2ApiError, EmbedApiClient, EmbedApiClientOptions, EmbedApiError, EmbedEvent, EmbedEventType, FetchLike, PatientInfo, V2Answer, V2ComposedSurvey, V2DrugResult, V2QualificationResult, V2Question, V2QuestionOption, V2Section, V2Step, V2SubmitResult, V2VisibilityCondition, createEmbedApiClient, disqualificationReasonText, disqualifiedDrugIds, qualifiedDrugIds } from '@apextelemed/survey-core';
|
|
3
|
+
export { C as CartCaptureConfig, a as CartSnapshotLine, F as FunnelConfig, b as FunnelDraftPayload, R as ResumedCart, c as ResumedCartLine, d as ResumedDraft, e as adoptCartId, f as adoptFunnelSessionId, g as cartId, h as fetchCartConfig, i as fetchFunnelConfig, j as fetchResumedCart, k as fetchResumedDraft, l as funnelSessionId, p as peekFunnelSessionId, m as postCartSnapshot, n as postFunnelEvent, r as readCartToken, o as readResumeToken, q as resetCartConfigCache, s as resetCartId, t as resetFunnelConfigCache, u as saveFunnelDraft, v as stripCartToken, w as stripResumeToken } from '../cart-CBH8Em8f.js';
|
|
4
|
+
|
|
5
|
+
/** Persist a referral code from a `?ref=` landing. No-op for empty input. */
|
|
6
|
+
declare function captureAffiliateRef(code: string): void;
|
|
7
|
+
/** Read the stored referral code, or null if absent/expired. */
|
|
8
|
+
declare function readAffiliateRef(): string | null;
|
|
9
|
+
/** Drop the stored referral code. */
|
|
10
|
+
declare function clearAffiliateRef(): void;
|
|
11
|
+
|
|
12
|
+
export { captureAffiliateRef, clearAffiliateRef, readAffiliateRef };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import '../chunk/AN3WPMEP.js';
|
|
2
|
+
export { adoptCartId, cartId, fetchCartConfig, fetchResumedCart, postCartSnapshot, readCartToken, resetCartConfigCache, resetCartId, stripCartToken } from '../chunk/J6KNY37T.js';
|
|
3
|
+
export { EmbedApiError2 as ApexV2ApiError, EmbedApiError, createEmbedApiClient, disqualificationReasonText, disqualifiedDrugIds, qualifiedDrugIds } from '../chunk/LZWA44KD.js';
|
|
4
|
+
export { adoptFunnelSessionId, fetchFunnelConfig, fetchResumedDraft, funnelSessionId, peekFunnelSessionId, postFunnelEvent, readResumeToken, resetFunnelConfigCache, saveFunnelDraft, stripResumeToken } from '../chunk/DS4E7FAI.js';
|
|
5
|
+
export { ApiError, SUPPORT_ATTACHMENT_MAX_BYTES, SUPPORT_ATTACHMENT_MIME_TYPES, addressesApi, adminAffiliatesApi, adminApi, affiliateAuthStorageKey, affiliatePortalApi, apexApi, apiFetch, authApi, authStorageKey, captureAffiliateRef, clearAffiliateRef, clearAffiliateTokens, clearTokens, getAffiliateTokens, getTokens, membersApi, messagesApi, newIdempotencyKey, onTokensCleared, ordersApi, paymentsApi, productsApi, promoCodesApi, readAffiliateRef, setAffiliateTokens, setTokens, subscriptionsApi, supportApi, usersApi } from '../chunk/DY5BJ6UG.js';
|
|
6
|
+
import '../chunk/5XGPFYIJ.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import "../chunk/O3QK7YZR.jsx";
|
|
2
|
+
import {
|
|
3
|
+
adoptCartId,
|
|
4
|
+
cartId,
|
|
5
|
+
fetchCartConfig,
|
|
6
|
+
fetchResumedCart,
|
|
7
|
+
postCartSnapshot,
|
|
8
|
+
readCartToken,
|
|
9
|
+
resetCartConfigCache,
|
|
10
|
+
resetCartId,
|
|
11
|
+
stripCartToken
|
|
12
|
+
} from "../chunk/6TFBQECC.jsx";
|
|
13
|
+
import {
|
|
14
|
+
EmbedApiError,
|
|
15
|
+
EmbedApiError2,
|
|
16
|
+
createEmbedApiClient,
|
|
17
|
+
disqualificationReasonText,
|
|
18
|
+
disqualifiedDrugIds,
|
|
19
|
+
qualifiedDrugIds
|
|
20
|
+
} from "../chunk/UZCST66N.jsx";
|
|
21
|
+
import {
|
|
22
|
+
adoptFunnelSessionId,
|
|
23
|
+
fetchFunnelConfig,
|
|
24
|
+
fetchResumedDraft,
|
|
25
|
+
funnelSessionId,
|
|
26
|
+
peekFunnelSessionId,
|
|
27
|
+
postFunnelEvent,
|
|
28
|
+
readResumeToken,
|
|
29
|
+
resetFunnelConfigCache,
|
|
30
|
+
saveFunnelDraft,
|
|
31
|
+
stripResumeToken
|
|
32
|
+
} from "../chunk/I46Y2J5W.jsx";
|
|
33
|
+
import {
|
|
34
|
+
ApiError,
|
|
35
|
+
SUPPORT_ATTACHMENT_MAX_BYTES,
|
|
36
|
+
SUPPORT_ATTACHMENT_MIME_TYPES,
|
|
37
|
+
addressesApi,
|
|
38
|
+
adminAffiliatesApi,
|
|
39
|
+
adminApi,
|
|
40
|
+
affiliateAuthStorageKey,
|
|
41
|
+
affiliatePortalApi,
|
|
42
|
+
apexApi,
|
|
43
|
+
apiFetch,
|
|
44
|
+
authApi,
|
|
45
|
+
authStorageKey,
|
|
46
|
+
captureAffiliateRef,
|
|
47
|
+
clearAffiliateRef,
|
|
48
|
+
clearAffiliateTokens,
|
|
49
|
+
clearTokens,
|
|
50
|
+
getAffiliateTokens,
|
|
51
|
+
getTokens,
|
|
52
|
+
membersApi,
|
|
53
|
+
messagesApi,
|
|
54
|
+
newIdempotencyKey,
|
|
55
|
+
onTokensCleared,
|
|
56
|
+
ordersApi,
|
|
57
|
+
paymentsApi,
|
|
58
|
+
productsApi,
|
|
59
|
+
promoCodesApi,
|
|
60
|
+
readAffiliateRef,
|
|
61
|
+
setAffiliateTokens,
|
|
62
|
+
setTokens,
|
|
63
|
+
subscriptionsApi,
|
|
64
|
+
supportApi,
|
|
65
|
+
usersApi
|
|
66
|
+
} from "../chunk/V42CGY2S.jsx";
|
|
67
|
+
import "../chunk/LDZIUFDM.jsx";
|
|
68
|
+
export {
|
|
69
|
+
EmbedApiError2 as ApexV2ApiError,
|
|
70
|
+
ApiError,
|
|
71
|
+
EmbedApiError,
|
|
72
|
+
SUPPORT_ATTACHMENT_MAX_BYTES,
|
|
73
|
+
SUPPORT_ATTACHMENT_MIME_TYPES,
|
|
74
|
+
addressesApi,
|
|
75
|
+
adminAffiliatesApi,
|
|
76
|
+
adminApi,
|
|
77
|
+
adoptCartId,
|
|
78
|
+
adoptFunnelSessionId,
|
|
79
|
+
affiliateAuthStorageKey,
|
|
80
|
+
affiliatePortalApi,
|
|
81
|
+
apexApi,
|
|
82
|
+
apiFetch,
|
|
83
|
+
authApi,
|
|
84
|
+
authStorageKey,
|
|
85
|
+
captureAffiliateRef,
|
|
86
|
+
cartId,
|
|
87
|
+
clearAffiliateRef,
|
|
88
|
+
clearAffiliateTokens,
|
|
89
|
+
clearTokens,
|
|
90
|
+
createEmbedApiClient,
|
|
91
|
+
disqualificationReasonText,
|
|
92
|
+
disqualifiedDrugIds,
|
|
93
|
+
fetchCartConfig,
|
|
94
|
+
fetchFunnelConfig,
|
|
95
|
+
fetchResumedCart,
|
|
96
|
+
fetchResumedDraft,
|
|
97
|
+
funnelSessionId,
|
|
98
|
+
getAffiliateTokens,
|
|
99
|
+
getTokens,
|
|
100
|
+
membersApi,
|
|
101
|
+
messagesApi,
|
|
102
|
+
newIdempotencyKey,
|
|
103
|
+
onTokensCleared,
|
|
104
|
+
ordersApi,
|
|
105
|
+
paymentsApi,
|
|
106
|
+
peekFunnelSessionId,
|
|
107
|
+
postCartSnapshot,
|
|
108
|
+
postFunnelEvent,
|
|
109
|
+
productsApi,
|
|
110
|
+
promoCodesApi,
|
|
111
|
+
qualifiedDrugIds,
|
|
112
|
+
readAffiliateRef,
|
|
113
|
+
readCartToken,
|
|
114
|
+
readResumeToken,
|
|
115
|
+
resetCartConfigCache,
|
|
116
|
+
resetCartId,
|
|
117
|
+
resetFunnelConfigCache,
|
|
118
|
+
saveFunnelDraft,
|
|
119
|
+
setAffiliateTokens,
|
|
120
|
+
setTokens,
|
|
121
|
+
stripCartToken,
|
|
122
|
+
stripResumeToken,
|
|
123
|
+
subscriptionsApi,
|
|
124
|
+
supportApi,
|
|
125
|
+
usersApi
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=index.jsx.map
|