@multisetai/vps 1.0.4 → 1.0.6
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 +55 -17
- package/dist/core/index.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
#
|
|
1
|
+
# MultiSet VPS WebXR
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
MultiSet VPS WebXR is a TypeScript SDK that enables developers to integrate MultiSet's Visual Positioning System (VPS) capabilities into WebXR applications. It provides precise 6-DOF (6 degrees of freedom) localization by matching camera frames against cloud-hosted maps, allowing AR applications to understand their position and orientation in physical space.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- **Core Client** (`@multisetai/vps/core`) - Authentication and API client for
|
|
7
|
+
- **Core Client** (`@multisetai/vps/core`) - Authentication and API client for MultiSet VPS services
|
|
8
8
|
- **WebXR Controller** (`@multisetai/vps/webxr`) - Three.js WebXR session management and frame capture
|
|
9
9
|
- **Framework-agnostic** - Works with React, Vue, Angular, or vanilla JavaScript
|
|
10
10
|
- **TypeScript support** - Full type definitions included
|
|
11
11
|
- **Event-driven architecture** - Comprehensive callbacks for all operations
|
|
12
12
|
- **Precise localization** - 6-DOF pose estimation with position and rotation
|
|
13
|
-
- **Cloud-based mapping** - Leverages
|
|
13
|
+
- **Cloud-based mapping** - Leverages MultiSet's cloud infrastructure for map storage and matching
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
16
16
|
|
|
@@ -34,6 +34,38 @@ npm install @multisetai/vps three
|
|
|
34
34
|
- Node.js 16+ and npm
|
|
35
35
|
- TypeScript 5.8+ (for TypeScript projects)
|
|
36
36
|
|
|
37
|
+
## Configuration
|
|
38
|
+
|
|
39
|
+
### CORS Domain Whitelisting
|
|
40
|
+
|
|
41
|
+
Since this SDK makes direct API calls to MultiSet servers from browser-based applications, you **must** configure Cross-Origin Resource Sharing (CORS) by whitelisting your application's domain in the MultiSet dashboard.
|
|
42
|
+
|
|
43
|
+
**Why is this required?** Browsers restrict cross-origin HTTP requests for security. By adding your domain to the MultiSet whitelist, you allow your web application to make API requests to MultiSet services.
|
|
44
|
+
|
|
45
|
+
#### How to Whitelist Your Domain
|
|
46
|
+
|
|
47
|
+
1. Navigate to the [MultiSet Dashboard](https://docs.multiset.ai/basics/credentials/configuring-allowed-domains-cors)
|
|
48
|
+
2. Go to **Credentials → Settings** tab
|
|
49
|
+
3. Locate the **Domains** section
|
|
50
|
+
4. Click the purple **Add +** button
|
|
51
|
+
5. Enter your application's full origin (protocol + domain + port if applicable)
|
|
52
|
+
|
|
53
|
+
#### Recommended Setup
|
|
54
|
+
|
|
55
|
+
Add entries for both your local development and production environments:
|
|
56
|
+
|
|
57
|
+
**Local Development:**
|
|
58
|
+
- **Format:** `http://localhost:PORT` (e.g., `http://localhost:3000`, `http://localhost:5173`)
|
|
59
|
+
- **Note:** Use the exact port your development server runs on
|
|
60
|
+
|
|
61
|
+
**Production:**
|
|
62
|
+
- **Format:** `https://your-domain.com` (e.g., `https://www.myapp.com`)
|
|
63
|
+
- **Note:** Do not include trailing slashes
|
|
64
|
+
|
|
65
|
+
> **Important:** Without whitelisting your domain, API requests will be blocked by the browser's CORS policy, and you'll see errors in the browser console.
|
|
66
|
+
|
|
67
|
+
For more details, see the [MultiSet CORS Configuration Documentation](https://docs.multiset.ai/basics/credentials/configuring-allowed-domains-cors).
|
|
68
|
+
|
|
37
69
|
## Quick Start
|
|
38
70
|
|
|
39
71
|
### 1. Import the SDK
|
|
@@ -47,9 +79,9 @@ import { WebxrController } from '@multisetai/vps/webxr';
|
|
|
47
79
|
|
|
48
80
|
```typescript
|
|
49
81
|
const client = new MultisetClient({
|
|
50
|
-
clientId: '
|
|
51
|
-
clientSecret: '
|
|
52
|
-
code: '
|
|
82
|
+
clientId: 'CLIENT_ID',
|
|
83
|
+
clientSecret: 'CLIENT_SECRET',
|
|
84
|
+
code: 'MAP_OUR_MAPSET_CODE',
|
|
53
85
|
mapType: 'map', // or 'map-set'
|
|
54
86
|
endpoints: DEFAULT_ENDPOINTS,
|
|
55
87
|
onAuthorize: (token) => console.log('Authorized:', token),
|
|
@@ -87,7 +119,7 @@ if (result?.localizeData?.poseFound) {
|
|
|
87
119
|
|
|
88
120
|
### `MultisetClient`
|
|
89
121
|
|
|
90
|
-
The core client handles authentication and API interactions with
|
|
122
|
+
The core client handles authentication and API interactions with MultiSet services.
|
|
91
123
|
|
|
92
124
|
#### Constructor
|
|
93
125
|
|
|
@@ -99,8 +131,8 @@ new MultisetClient(config: IMultisetSdkConfig)
|
|
|
99
131
|
|
|
100
132
|
```typescript
|
|
101
133
|
interface IMultisetSdkConfig {
|
|
102
|
-
clientId: string; // Your
|
|
103
|
-
clientSecret: string; // Your
|
|
134
|
+
clientId: string; // Your MultiSet client ID
|
|
135
|
+
clientSecret: string; // Your MultiSet client secret
|
|
104
136
|
code: string; // Map code (e.g., 'MAP_XXXXX')
|
|
105
137
|
mapType: 'map' | 'map-set'; // Type of map to use
|
|
106
138
|
endpoints?: Partial<IMultisetSdkEndpoints>; // Optional custom endpoints
|
|
@@ -116,7 +148,7 @@ interface IMultisetSdkConfig {
|
|
|
116
148
|
|
|
117
149
|
##### `authorize(): Promise<string>`
|
|
118
150
|
|
|
119
|
-
Authenticates with
|
|
151
|
+
Authenticates with MultiSet services and obtains an access token. Must be called before making any API requests.
|
|
120
152
|
|
|
121
153
|
```typescript
|
|
122
154
|
const token = await client.authorize();
|
|
@@ -257,6 +289,12 @@ import type {
|
|
|
257
289
|
|
|
258
290
|
## Examples
|
|
259
291
|
|
|
292
|
+
> **Full working examples**: This repository includes complete, runnable example applications in the [`examples/`](./examples) directory:
|
|
293
|
+
> - **[React Example](./examples/react)** - Full React implementation with TypeScript
|
|
294
|
+
> - **[Vanilla JavaScript Example](./examples/vanilla)** - Vanilla JavaScript implementation
|
|
295
|
+
>
|
|
296
|
+
> Each example includes setup instructions, configuration, and demonstrates the complete SDK integration workflow.
|
|
297
|
+
|
|
260
298
|
### Vanilla JavaScript
|
|
261
299
|
|
|
262
300
|
```javascript
|
|
@@ -265,9 +303,9 @@ import { MultisetClient, DEFAULT_ENDPOINTS } from '@multisetai/vps/core';
|
|
|
265
303
|
import { WebxrController } from '@multisetai/vps/webxr';
|
|
266
304
|
|
|
267
305
|
const client = new MultisetClient({
|
|
268
|
-
clientId: '
|
|
269
|
-
clientSecret: '
|
|
270
|
-
code: '
|
|
306
|
+
clientId: 'CLIENT_ID',
|
|
307
|
+
clientSecret: 'CLIENT_SECRET',
|
|
308
|
+
code: 'MAP_OR_MAPSET_CODE',
|
|
271
309
|
mapType: 'map',
|
|
272
310
|
endpoints: DEFAULT_ENDPOINTS,
|
|
273
311
|
onAuthorize: (token) => console.log('Authorized:', token),
|
|
@@ -318,9 +356,9 @@ export default function App() {
|
|
|
318
356
|
|
|
319
357
|
useEffect(() => {
|
|
320
358
|
clientRef.current = new MultisetClient({
|
|
321
|
-
clientId: '
|
|
322
|
-
clientSecret: '
|
|
323
|
-
code: '
|
|
359
|
+
clientId: 'CLIENT_ID',
|
|
360
|
+
clientSecret: 'CLIENT_SECRET',
|
|
361
|
+
code: 'MAP_OR_MAPSET_CODE',
|
|
324
362
|
mapType: 'map',
|
|
325
363
|
endpoints: DEFAULT_ENDPOINTS,
|
|
326
364
|
});
|
package/dist/core/index.d.ts
CHANGED