@minmaps-dev/mm-web-sdk 0.0.0-rc-20260623204551

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MTS LLC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,231 @@
1
+ <div align="center">
2
+
3
+ # MinuteMaps Web SDK
4
+
5
+ **Render indoor venues — floors, POIs, amenities, destinations, and wayfinding routes — on top of [MapLibre GL JS](https://maplibre.org/).**
6
+
7
+ [![npm](https://img.shields.io/npm/v/@minmaps-dev/mm-web-sdk?label=npm)](https://www.npmjs.com/package/@minmaps-dev/mm-web-sdk)
8
+ [![license](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
9
+ [![types](https://img.shields.io/badge/types-included-blue)](./dist/index.d.ts)
10
+
11
+ </div>
12
+
13
+ `@minmaps-dev/mm-web-sdk` is the official MinuteMaps SDK for the web. It loads venues from JACS, manages floors, POIs, amenities, destinations, and the camera, and gives you a small, well-typed surface for building modern kiosks and indoor mapping web apps.
14
+
15
+ ```bash
16
+ npm install @minmaps-dev/mm-web-sdk maplibre-gl @turf/turf
17
+ ```
18
+
19
+ ```ts
20
+ import { MinuteMaps } from '@minmaps-dev/mm-web-sdk'
21
+ import 'maplibre-gl/dist/maplibre-gl.css'
22
+
23
+ const sdk = new MinuteMaps({
24
+ container: 'map',
25
+ jmap: { host: '', customerId: 123, venueId: 456 },
26
+ jacs: { mode: 'proxy', proxyBaseUrl: '/api/jacs' },
27
+ options: { styleMode: 'sdkTemplate' },
28
+ })
29
+
30
+ sdk.on('ready', ({ venue }) => console.log('venue ready', venue?.name))
31
+ await sdk.init()
32
+ ```
33
+
34
+ ---
35
+
36
+ ## Status
37
+
38
+ This SDK is on a pre-1.0 release candidate (`1.0.0-rc.24`). A few capabilities remain **dormant pending backend support** — they are not yet functional in the published build:
39
+
40
+ | Area | Status | Notes |
41
+ | --- | --- | --- |
42
+ | Floors, POIs, amenities, destinations | ✅ Shipped | Loads via JACS `building/full` + `venue/full`. |
43
+ | Camera + view modes (3D/2D/flat) | ✅ Shipped | Style toggles work against the bundled `alt3-hybrid-style.json`. |
44
+ | Wayfinding | ✅ Shipped | Built-in JACS path-graph routing (rc.18). `JacsWayfindingProvider` is wired by default; route computation runs inside the SDK (`src/data/wayfinding/`). No provider injection needed. |
45
+ | Contextual map APIs | ✅ Shipped | `highlightPOI`/`highlightAmenity`/`clearHighlight`, `setPOIFilter`/`clearPOIFilter`, `amenities.getDistinct`, `findClosestWaypoint`, `searchAllPOIs`, `navigateFromKioskToPOI`, `refit`. See `docs/API.md#contextual-map`. |
46
+ | Venue-served stylesheets | 🚧 Roadmap | SDK currently uses its bundled style; `loadAndPatchVenueStyle()` is bypassed. |
47
+ | Polygon layers + 3D map templates | 🚧 Roadmap | `buildPolygonLayers` / `applyMapTemplate3d` imports are commented in `src/sdk.ts`. |
48
+
49
+ Track re-enable points by grepping `// TODO: Re-enable` in `src/sdk.ts` and `src/data/jacsDataProvider.ts`.
50
+
51
+ ---
52
+
53
+ ## What's in the box
54
+
55
+ - **Venue + floors** — load a venue by `customerId` / `venueId`, switch active floor, let the SDK manage layer visibility.
56
+ - **POIs, amenities, destinations** — query by floor, run keyword searches, find the kiosk's "You are here" location.
57
+ - **View modes** — toggle 3D extrusion, flat (top-down), and 2D-units modes at runtime.
58
+ - **Camera control** — `setView` / `resetView` / `getCameraPosition`, plus a live `cameraChange` event for compass UIs.
59
+ - **React entrypoint** — drop-in `<MinuteMapsView />` for React 18/19.
60
+ - **JACS proxy or direct mode** — keep credentials server-side (recommended) or call JACS directly from trusted environments.
61
+
62
+ ---
63
+
64
+ ## Documentation
65
+
66
+ The lean root README intentionally stops here. For depth, see:
67
+
68
+ - [`docs/ARCHITECTURE.md`](./docs/ARCHITECTURE.md) — module map, init flow, JACS data path, style patching, dormant 3D notes.
69
+ - [`docs/API.md`](./docs/API.md) — full public API surface grouped by lifecycle, floors, POIs, amenities, wayfinding, camera, events.
70
+ - [`docs/KIOSK.md`](./docs/KIOSK.md) — kiosk integration patterns (You-Are-Here, kiosk-to-destination wayfinding once enabled, view-mode UX, sprite hosting, idle reset).
71
+
72
+ External integrators will usually only need the [API](./docs/API.md) and [Kiosk](./docs/KIOSK.md) docs. Internal MTS engineers should also read [Architecture](./docs/ARCHITECTURE.md) before touching `src/sdk.ts` or the JACS provider.
73
+
74
+ ---
75
+
76
+ ## Quick start (vanilla)
77
+
78
+ ```ts
79
+ import { MinuteMaps } from '@minmaps-dev/mm-web-sdk'
80
+ import 'maplibre-gl/dist/maplibre-gl.css'
81
+
82
+ const sdk = new MinuteMaps({
83
+ container: 'map', // element or element id
84
+ jmap: {
85
+ host: '', // unused in proxy mode
86
+ customerId: 123,
87
+ venueId: 456,
88
+ },
89
+ jacs: {
90
+ mode: 'proxy', // recommended for browser apps
91
+ proxyBaseUrl: '/api/jacs',
92
+ },
93
+ options: {
94
+ customSprite: '/sprites/sprite', // your icon sprite (no extension)
95
+ minIndoorZoom: 16,
96
+ debug: true,
97
+ styleMode: 'sdkTemplate',
98
+ },
99
+ })
100
+
101
+ sdk.on('ready', ({ venue }) => console.log('venue ready', venue?.name))
102
+ sdk.on('floorChanged', ({ floor }) => console.log('now showing', floor?.name))
103
+
104
+ await sdk.init()
105
+ ```
106
+
107
+ ## Quick start (React)
108
+
109
+ ```tsx
110
+ import { MinuteMapsView } from '@minmaps-dev/mm-web-sdk/react'
111
+ import 'maplibre-gl/dist/maplibre-gl.css'
112
+
113
+ export function Map() {
114
+ return (
115
+ <MinuteMapsView
116
+ className="h-screen w-screen"
117
+ config={{
118
+ container: '', // ignored — the component owns the element
119
+ jmap: { host: '', customerId: 123, venueId: 456 },
120
+ jacs: { mode: 'proxy', proxyBaseUrl: '/api/jacs' },
121
+ options: { styleMode: 'sdkTemplate' },
122
+ }}
123
+ />
124
+ )
125
+ }
126
+ ```
127
+
128
+ The React entry is intentionally minimal: it owns its own `<div>`, calls `init()` on mount, and `destroy()` on unmount. Reach for the vanilla `MinuteMaps` class when you need imperative control (floor switching from a side panel, camera animations driven by Redux, etc.).
129
+
130
+ ---
131
+
132
+ ## Configuration at a glance
133
+
134
+ ```ts
135
+ type SDKConfig = {
136
+ container: HTMLElement | string
137
+ jmap: {
138
+ host: string
139
+ customerId: number
140
+ venueId: number
141
+ locale?: string
142
+ auth?: { clientId: string; clientSecret: string }
143
+ }
144
+ jacs: {
145
+ mode: 'proxy' | 'direct'
146
+ host?: string // 'direct' only
147
+ auth?: { clientId: string; username: string; password: string } // 'direct' only
148
+ proxyBaseUrl?: string // default '/api/jacs'
149
+ }
150
+ options?: SDKOptions
151
+ }
152
+ ```
153
+
154
+ Full option reference and an annotated `SDKOptions` shape live in [`docs/API.md`](./docs/API.md#configuration).
155
+
156
+ ### JACS proxy mode (recommended)
157
+
158
+ Browser apps should use `mode: 'proxy'` and forward requests through your own server so JACS credentials never reach the client. Your proxy should:
159
+
160
+ 1. Read `JACS_HOST`, `JACS_CLIENT_ID`, `JACS_USERNAME`, `JACS_PASSWORD` from server env.
161
+ 2. Exchange the password grant for a bearer token (cache until expiry).
162
+ 3. Forward `GET /api/jacs/<path>` to `${JACS_HOST}/JACS/api/<path>` with the token attached.
163
+
164
+ A reference Next.js route handler ships in the example app at `apps/example/app/api/jacs/[...path]/route.ts`. Copy it into your own backend or adapt it to your framework, then point `jacs.proxyBaseUrl` at it.
165
+
166
+ ### JACS direct mode
167
+
168
+ For trusted environments — server-rendered pages, Electron kiosks, internal tools — call JACS directly:
169
+
170
+ ```ts
171
+ jacs: {
172
+ mode: 'direct',
173
+ host: 'https://jacs.example.com',
174
+ auth: { clientId, username, password },
175
+ }
176
+ ```
177
+
178
+ > ⚠ Never ship `direct` mode to a public browser bundle. Your JACS credentials would be visible to anyone with devtools.
179
+
180
+ ---
181
+
182
+ ## Sprites
183
+
184
+ `options.customSprite` is a sprite URL **prefix without extension** — MapLibre appends `.json` and `.png` (and `@2x` variants) automatically. The example app serves its sprite from `apps/example/public/sprites/`.
185
+
186
+ ---
187
+
188
+ ## Development
189
+
190
+ Run commands from the **monorepo root** through pnpm/turbo (install pnpm via npm, not corepack):
191
+
192
+ ```bash
193
+ pnpm install # once, at the root — one lockfile for the whole monorepo
194
+ pnpm dev # turbo: SDK rollup --watch + example next dev together
195
+ pnpm build # turbo: production build of all packages
196
+ pnpm typecheck # turbo: tsc --noEmit
197
+ pnpm test # turbo: vitest run
198
+ ```
199
+
200
+ SDK-only build: `pnpm --filter @minmaps-dev/mm-web-sdk build`. Per-package scripts (`dev:sdk`, `test:watch`, `test:coverage`) still exist and can be run with `pnpm --filter @minmaps-dev/mm-web-sdk <script>`.
201
+
202
+ The build emits ESM, CJS, and types under `dist/` for both the root entry and the `/react` entry. Tests live in `tests/` and target the three highest-leverage modules: `JacsProvider`, `WayfindingManager`, and `ViewModeController`. Coverage thresholds are gated in `vitest.config.ts` (currently 60% lines/funcs/stmts, 50% branches).
203
+
204
+ ### Continuous integration
205
+
206
+ CI lives at the **monorepo root** in `.github/workflows/`:
207
+
208
+ - **`ci.yml`** — runs typecheck, vitest with coverage, and the production build on every push and pull request to `main` / `dev`.
209
+ - **`release.yml`** — Changesets-driven releases. Write a changeset, merge to `main`, and a "Version Packages" PR is opened; merging it runs `changeset publish` to npm (access `public`). There is no tag-based publish workflow and no provenance flag.
210
+ - **`deploy-example.yml`** — deploys the example app.
211
+
212
+ > **Internal note:** future Claude sessions get oriented from [`CLAUDE.md`](./CLAUDE.md). Subagents at the monorepo-root `.claude/agents/` cover API doc sync, release notes, and style/template edits.
213
+
214
+ ---
215
+
216
+ ## Browser + framework support
217
+
218
+ | Target | Version |
219
+ | --- | --- |
220
+ | Node (build/dev) | ≥ 18 |
221
+ | `maplibre-gl` | ^4 |
222
+ | `@turf/turf` | ^7 |
223
+ | `react` / `react-dom` | ^18 or ^19 (only required for `/react` entry) |
224
+
225
+ Modern evergreen browsers. Kiosk targets are typically pinned Chromium builds — if you need to support a specific minimum, open an issue.
226
+
227
+ ---
228
+
229
+ ## License
230
+
231
+ MIT — see [LICENSE](./LICENSE).