@minmaps-dev/mm-web-sdk 1.0.0-rc.1 → 1.0.0-rc.4
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 +177 -117
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +20 -19
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +1 -1
- package/dist/react.js.map +1 -1
- package/package.json +8 -3
- package/src/themes/alt3-hybrid-style.json +8 -8
package/README.md
CHANGED
|
@@ -1,167 +1,227 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# MinuteMaps Web SDK
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**Render indoor venues — floors, POIs, amenities, destinations, and wayfinding routes — on top of [MapLibre GL JS](https://maplibre.org/).**
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
- **Interactive Layers** - Amenities, destinations, and moving elements
|
|
11
|
-
- **Accessibility** - High-contrast themes and accessibility features
|
|
12
|
-
- **Custom Controls** - Floor selector, navigation controls, and more
|
|
7
|
+
[](https://www.npmjs.com/package/@minmaps-dev/mm-web-sdk)
|
|
8
|
+
[](./LICENSE)
|
|
9
|
+
[](./dist/index.d.ts)
|
|
13
10
|
|
|
14
|
-
|
|
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.
|
|
15
14
|
|
|
16
15
|
```bash
|
|
17
|
-
npm install
|
|
16
|
+
npm install @minmaps-dev/mm-web-sdk maplibre-gl @turf/turf
|
|
18
17
|
```
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
```ts
|
|
20
|
+
import { MinuteMaps } from '@minmaps-dev/mm-web-sdk'
|
|
21
|
+
import 'maplibre-gl/dist/maplibre-gl.css'
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
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
|
+
})
|
|
24
29
|
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
sdk.on('ready', ({ venue }) => console.log('venue ready', venue?.name))
|
|
31
|
+
await sdk.init()
|
|
32
|
+
```
|
|
27
33
|
|
|
28
|
-
|
|
29
|
-
await sdk.init({
|
|
30
|
-
container: 'map-container',
|
|
31
|
-
venueId: 'your-venue-id',
|
|
32
|
-
styleUrl: 'https://example.com/style.json',
|
|
33
|
-
onReady: () => {
|
|
34
|
-
console.log('SDK ready!');
|
|
35
|
-
}
|
|
36
|
-
});
|
|
34
|
+
---
|
|
37
35
|
|
|
38
|
-
|
|
39
|
-
sdk.switchTheme('modern-glassmorph');
|
|
40
|
-
```
|
|
36
|
+
## Status
|
|
41
37
|
|
|
42
|
-
|
|
38
|
+
This SDK is on a pre-1.0 release candidate (`1.0.0-rc.3`). The following capabilities are wired but **dormant pending backend support** — they are not yet functional in the published build:
|
|
43
39
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
+
| Venue-served stylesheets | 🚧 Roadmap | SDK currently uses its bundled style; `loadAndPatchVenueStyle()` is bypassed. |
|
|
45
|
+
| Polygon layers + 3D map templates | 🚧 Roadmap | `buildPolygonLayers` / `applyMapTemplate3d` imports are commented in `src/sdk.ts`. |
|
|
46
|
+
| Wayfinding | 🚧 Roadmap | Route renderer is fully built, but the runtime provider is a stub that throws *"Wayfinding is not yet implemented in the SDK"*. |
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
Track re-enable points by grepping `// TODO: Re-enable` in `src/sdk.ts` and `src/data/jacsDataProvider.ts`.
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
---
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
- `ThemeManager` - Theme switching and management
|
|
54
|
-
- `VenueManager` - Venue and building data management
|
|
55
|
-
- `JMapCoreWrapper` - JMap functionality integration
|
|
52
|
+
## What's in the box
|
|
56
53
|
|
|
57
|
-
|
|
58
|
-
-
|
|
59
|
-
-
|
|
60
|
-
- `
|
|
61
|
-
-
|
|
62
|
-
-
|
|
54
|
+
- **Venue + floors** — load a venue by `customerId` / `venueId`, switch active floor, let the SDK manage layer visibility.
|
|
55
|
+
- **POIs, amenities, destinations** — query by floor, run keyword searches, find the kiosk's "You are here" location.
|
|
56
|
+
- **View modes** — toggle 3D extrusion, flat (top-down), and 2D-units modes at runtime.
|
|
57
|
+
- **Camera control** — `setView` / `resetView` / `getCameraPosition`, plus a live `cameraChange` event for compass UIs.
|
|
58
|
+
- **React entrypoint** — drop-in `<MinuteMapsView />` for React 18/19.
|
|
59
|
+
- **JACS proxy or direct mode** — keep credentials server-side (recommended) or call JACS directly from trusted environments.
|
|
63
60
|
|
|
64
|
-
|
|
65
|
-
- `Wayfinding` - Navigation and routing
|
|
66
|
-
- `FeatureHighlighter` - Interactive feature highlighting
|
|
67
|
-
- `MarkerManager` - Custom marker management
|
|
68
|
-
- `AccessibilityFeatures` - Accessibility enhancements
|
|
61
|
+
---
|
|
69
62
|
|
|
70
|
-
|
|
71
|
-
- `FloorSelector` - Floor switching
|
|
72
|
-
- `NavigationControl` - Map navigation
|
|
73
|
-
- `RecenterControl` - Map recentering
|
|
74
|
-
- `MapInspector` - Debugging tools
|
|
63
|
+
## Documentation
|
|
75
64
|
|
|
76
|
-
|
|
77
|
-
- `ColorTokens` - Color system
|
|
78
|
-
- `PatternGenerator` - Visual patterns
|
|
79
|
-
- `IconSelector` - Icon mapping
|
|
80
|
-
- `TurfHelpers` - Geospatial utilities
|
|
81
|
-
- `GeoJSONFormatter` - Data formatting
|
|
65
|
+
The lean root README intentionally stops here. For depth, see:
|
|
82
66
|
|
|
83
|
-
|
|
67
|
+
- [`docs/ARCHITECTURE.md`](./docs/ARCHITECTURE.md) — module map, init flow, JACS data path, style patching, dormant 3D notes.
|
|
68
|
+
- [`docs/API.md`](./docs/API.md) — full public API surface grouped by lifecycle, floors, POIs, amenities, wayfinding, camera, events.
|
|
69
|
+
- [`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).
|
|
84
70
|
|
|
85
|
-
|
|
71
|
+
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.
|
|
86
72
|
|
|
87
|
-
|
|
73
|
+
---
|
|
88
74
|
|
|
89
|
-
|
|
90
|
-
# Navigate to the Next.js demo
|
|
91
|
-
cd demo-next
|
|
75
|
+
## Quick start (vanilla)
|
|
92
76
|
|
|
93
|
-
|
|
94
|
-
|
|
77
|
+
```ts
|
|
78
|
+
import { MinuteMaps } from '@minmaps-dev/mm-web-sdk'
|
|
79
|
+
import 'maplibre-gl/dist/maplibre-gl.css'
|
|
80
|
+
|
|
81
|
+
const sdk = new MinuteMaps({
|
|
82
|
+
container: 'map', // element or element id
|
|
83
|
+
jmap: {
|
|
84
|
+
host: '', // unused in proxy mode
|
|
85
|
+
customerId: 123,
|
|
86
|
+
venueId: 456,
|
|
87
|
+
},
|
|
88
|
+
jacs: {
|
|
89
|
+
mode: 'proxy', // recommended for browser apps
|
|
90
|
+
proxyBaseUrl: '/api/jacs',
|
|
91
|
+
},
|
|
92
|
+
options: {
|
|
93
|
+
customSprite: '/sprites/sprite', // your icon sprite (no extension)
|
|
94
|
+
minIndoorZoom: 16,
|
|
95
|
+
debug: true,
|
|
96
|
+
styleMode: 'sdkTemplate',
|
|
97
|
+
},
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
sdk.on('ready', ({ venue }) => console.log('venue ready', venue?.name))
|
|
101
|
+
sdk.on('floorChanged', ({ floor }) => console.log('now showing', floor?.name))
|
|
95
102
|
|
|
96
|
-
|
|
97
|
-
npm run dev
|
|
103
|
+
await sdk.init()
|
|
98
104
|
```
|
|
99
105
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
## Quick start (React)
|
|
107
|
+
|
|
108
|
+
```tsx
|
|
109
|
+
import { MinuteMapsView } from '@minmaps-dev/mm-web-sdk/react'
|
|
110
|
+
import 'maplibre-gl/dist/maplibre-gl.css'
|
|
111
|
+
|
|
112
|
+
export function Map() {
|
|
113
|
+
return (
|
|
114
|
+
<MinuteMapsView
|
|
115
|
+
className="h-screen w-screen"
|
|
116
|
+
config={{
|
|
117
|
+
container: '', // ignored — the component owns the element
|
|
118
|
+
jmap: { host: '', customerId: 123, venueId: 456 },
|
|
119
|
+
jacs: { mode: 'proxy', proxyBaseUrl: '/api/jacs' },
|
|
120
|
+
options: { styleMode: 'sdkTemplate' },
|
|
121
|
+
}}
|
|
122
|
+
/>
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
```
|
|
108
126
|
|
|
109
|
-
|
|
127
|
+
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.).
|
|
110
128
|
|
|
111
|
-
|
|
129
|
+
---
|
|
112
130
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
131
|
+
## Configuration at a glance
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
type SDKConfig = {
|
|
135
|
+
container: HTMLElement | string
|
|
136
|
+
jmap: {
|
|
137
|
+
host: string
|
|
138
|
+
customerId: number
|
|
139
|
+
venueId: number
|
|
140
|
+
locale?: string
|
|
141
|
+
auth?: { clientId: string; clientSecret: string }
|
|
142
|
+
}
|
|
143
|
+
jacs: {
|
|
144
|
+
mode: 'proxy' | 'direct'
|
|
145
|
+
host?: string // 'direct' only
|
|
146
|
+
auth?: { clientId: string; username: string; password: string } // 'direct' only
|
|
147
|
+
proxyBaseUrl?: string // default '/api/jacs'
|
|
148
|
+
}
|
|
149
|
+
options?: SDKOptions
|
|
150
|
+
}
|
|
116
151
|
```
|
|
117
152
|
|
|
118
|
-
|
|
119
|
-
1. Watches for SDK source changes and rebuilds automatically
|
|
120
|
-
2. Starts the React development server
|
|
121
|
-
3. Provides hot reloading for both SDK and React app
|
|
153
|
+
Full option reference and an annotated `SDKOptions` shape live in [`docs/API.md`](./docs/API.md#configuration).
|
|
122
154
|
|
|
123
|
-
|
|
155
|
+
### JACS proxy mode (recommended)
|
|
124
156
|
|
|
125
|
-
|
|
157
|
+
Browser apps should use `mode: 'proxy'` and forward requests through your own server so JACS credentials never reach the client. Your proxy should:
|
|
126
158
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
159
|
+
1. Read `JACS_HOST`, `JACS_CLIENT_ID`, `JACS_USERNAME`, `JACS_PASSWORD` from server env.
|
|
160
|
+
2. Exchange the password grant for a bearer token (cache until expiry).
|
|
161
|
+
3. Forward `GET /api/jacs/<path>` to `${JACS_HOST}/JACS/api/<path>` with the token attached.
|
|
162
|
+
|
|
163
|
+
A reference Next.js route handler ships in the example app at `mm-web-sdk-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.
|
|
130
164
|
|
|
131
|
-
|
|
132
|
-
npm run docs
|
|
165
|
+
### JACS direct mode
|
|
133
166
|
|
|
134
|
-
|
|
135
|
-
npm run docs:preview
|
|
167
|
+
For trusted environments — server-rendered pages, Electron kiosks, internal tools — call JACS directly:
|
|
136
168
|
|
|
137
|
-
|
|
138
|
-
|
|
169
|
+
```ts
|
|
170
|
+
jacs: {
|
|
171
|
+
mode: 'direct',
|
|
172
|
+
host: 'https://jacs.example.com',
|
|
173
|
+
auth: { clientId, username, password },
|
|
174
|
+
}
|
|
139
175
|
```
|
|
140
176
|
|
|
141
|
-
|
|
177
|
+
> ⚠ Never ship `direct` mode to a public browser bundle. Your JACS credentials would be visible to anyone with devtools.
|
|
142
178
|
|
|
143
|
-
|
|
179
|
+
---
|
|
144
180
|
|
|
145
|
-
|
|
146
|
-
# Build the SDK
|
|
147
|
-
npm run build
|
|
181
|
+
## Sprites
|
|
148
182
|
|
|
149
|
-
|
|
150
|
-
npm run build:watch
|
|
151
|
-
```
|
|
183
|
+
`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 `mm-web-sdk-example/public/sprites/`.
|
|
152
184
|
|
|
153
|
-
|
|
185
|
+
---
|
|
154
186
|
|
|
187
|
+
## Development
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
npm install
|
|
191
|
+
npm run dev:sdk # rollup --watch (rebuilds dist/ on change)
|
|
192
|
+
npm run build # rimraf dist + production rollup build
|
|
193
|
+
npm run typecheck # tsc --noEmit
|
|
194
|
+
npm test # vitest run
|
|
195
|
+
npm run test:watch # vitest in watch mode
|
|
196
|
+
npm run test:coverage # vitest run --coverage (v8 provider)
|
|
155
197
|
```
|
|
156
|
-
minutemaps-sdk/
|
|
157
|
-
├── src-sdk/ # SDK source code
|
|
158
|
-
├── dist/ # Built SDK files
|
|
159
|
-
├── demo-next/ # Next.js demo application
|
|
160
|
-
├── docs/ # Generated documentation
|
|
161
|
-
├── docs-assets/ # Documentation assets
|
|
162
|
-
└── package.json # Project configuration
|
|
163
|
-
```
|
|
164
198
|
|
|
165
|
-
|
|
199
|
+
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).
|
|
200
|
+
|
|
201
|
+
### Continuous integration
|
|
202
|
+
|
|
203
|
+
Two workflows in `.github/workflows/`:
|
|
204
|
+
|
|
205
|
+
- **`ci.yml`** — runs typecheck, vitest with coverage, and the production build on every push and pull request to `main` / `dev`. Coverage and `dist/` are uploaded as artifacts.
|
|
206
|
+
- **`publish.yml`** — runs on tags matching `v*` (or via manual dispatch). Verifies the tag matches `package.json` version, runs the full pipeline, and publishes to npm with provenance. Requires an `NPM_TOKEN` repo secret.
|
|
207
|
+
|
|
208
|
+
> **Internal note:** future Claude sessions get oriented from [`CLAUDE.md`](./CLAUDE.md). Repo-local subagents in [`.claude/agents/`](./.claude/agents/) cover API doc sync, release notes, and style/template edits.
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Browser + framework support
|
|
213
|
+
|
|
214
|
+
| Target | Version |
|
|
215
|
+
| --- | --- |
|
|
216
|
+
| Node (build/dev) | ≥ 18 |
|
|
217
|
+
| `maplibre-gl` | ^4 |
|
|
218
|
+
| `@turf/turf` | ^7 |
|
|
219
|
+
| `react` / `react-dom` | ^18 or ^19 (only required for `/react` entry) |
|
|
220
|
+
|
|
221
|
+
Modern evergreen browsers. Kiosk targets are typically pinned Chromium builds — if you need to support a specific minimum, open an issue.
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## License
|
|
166
226
|
|
|
167
|
-
|
|
227
|
+
MIT — see [LICENSE](./LICENSE).
|