@wovvmap/contracts 0.0.0-stage → 1.2.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/dist/catalog.d.ts +427 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/catalog.js +21 -0
- package/dist/depthConfig.d.ts +112 -0
- package/dist/depthConfig.d.ts.map +1 -0
- package/dist/depthConfig.js +109 -0
- package/dist/discovery.d.ts +122 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +91 -0
- package/dist/endpoints.d.ts +63 -0
- package/dist/endpoints.d.ts.map +1 -0
- package/dist/endpoints.js +61 -0
- package/dist/events.d.ts +198 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +204 -0
- package/dist/geometry.d.ts +190 -0
- package/dist/geometry.d.ts.map +1 -0
- package/dist/geometry.js +6 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/interaction.d.ts +37 -0
- package/dist/interaction.d.ts.map +1 -0
- package/dist/interaction.js +32 -0
- package/dist/interactionScope.d.ts +15 -0
- package/dist/interactionScope.d.ts.map +1 -0
- package/dist/interactionScope.js +30 -0
- package/dist/metadata.d.ts +217 -0
- package/dist/metadata.d.ts.map +1 -0
- package/dist/metadata.js +102 -0
- package/dist/multiFloor.d.ts +102 -0
- package/dist/multiFloor.d.ts.map +1 -0
- package/dist/multiFloor.js +30 -0
- package/dist/navigation/index.d.ts +17 -0
- package/dist/navigation/index.d.ts.map +1 -0
- package/dist/navigation/index.js +14 -0
- package/dist/navigation/navigationConfig.d.ts +21 -0
- package/dist/navigation/navigationConfig.d.ts.map +1 -0
- package/dist/navigation/navigationConfig.js +18 -0
- package/dist/navigation/offlineRecovery.d.ts +29 -0
- package/dist/navigation/offlineRecovery.d.ts.map +1 -0
- package/dist/navigation/offlineRecovery.js +47 -0
- package/dist/navigation/offlineRouteConfig.d.ts +17 -0
- package/dist/navigation/offlineRouteConfig.d.ts.map +1 -0
- package/dist/navigation/offlineRouteConfig.js +53 -0
- package/dist/navigation/resolveNavigationConfig.d.ts +6 -0
- package/dist/navigation/resolveNavigationConfig.d.ts.map +1 -0
- package/dist/navigation/resolveNavigationConfig.js +50 -0
- package/dist/navigation/routeArtifacts.d.ts +130 -0
- package/dist/navigation/routeArtifacts.d.ts.map +1 -0
- package/dist/navigation/routeArtifacts.js +1 -0
- package/dist/navigation/routeDelivery.d.ts +83 -0
- package/dist/navigation/routeDelivery.d.ts.map +1 -0
- package/dist/navigation/routeDelivery.js +22 -0
- package/dist/navigation/routeJourneyValidation.d.ts +5 -0
- package/dist/navigation/routeJourneyValidation.d.ts.map +1 -0
- package/dist/navigation/routeJourneyValidation.js +65 -0
- package/dist/navigation/routeOperations.d.ts +70 -0
- package/dist/navigation/routeOperations.d.ts.map +1 -0
- package/dist/navigation/routeOperations.js +22 -0
- package/dist/navigation/routePlayback.d.ts +98 -0
- package/dist/navigation/routePlayback.d.ts.map +1 -0
- package/dist/navigation/routePlayback.js +44 -0
- package/dist/navigation/routeResponseValidation.d.ts +10 -0
- package/dist/navigation/routeResponseValidation.d.ts.map +1 -0
- package/dist/navigation/routeResponseValidation.js +280 -0
- package/dist/navigation/routeSnapshot.d.ts +5 -0
- package/dist/navigation/routeSnapshot.d.ts.map +1 -0
- package/dist/navigation/routeSnapshot.js +145 -0
- package/dist/navigation/routeState.d.ts +105 -0
- package/dist/navigation/routeState.d.ts.map +1 -0
- package/dist/navigation/routeState.js +1 -0
- package/dist/navigation/routeSteps.d.ts +27 -0
- package/dist/navigation/routeSteps.d.ts.map +1 -0
- package/dist/navigation/routeSteps.js +1 -0
- package/dist/navigation/savedRoute.d.ts +156 -0
- package/dist/navigation/savedRoute.d.ts.map +1 -0
- package/dist/navigation/savedRoute.js +68 -0
- package/dist/navigation/savedRouteValidation.d.ts +5 -0
- package/dist/navigation/savedRouteValidation.d.ts.map +1 -0
- package/dist/navigation/savedRouteValidation.js +298 -0
- package/dist/nodeLine.d.ts +45 -0
- package/dist/nodeLine.d.ts.map +1 -0
- package/dist/nodeLine.js +44 -0
- package/dist/nodePoint.d.ts +111 -0
- package/dist/nodePoint.d.ts.map +1 -0
- package/dist/nodePoint.js +152 -0
- package/dist/offerValidity.d.ts +11 -0
- package/dist/offerValidity.d.ts.map +1 -0
- package/dist/offerValidity.js +27 -0
- package/dist/offline.d.ts +60 -0
- package/dist/offline.d.ts.map +1 -0
- package/dist/offline.js +47 -0
- package/dist/preparedMap.d.ts +186 -0
- package/dist/preparedMap.d.ts.map +1 -0
- package/dist/preparedMap.js +6 -0
- package/dist/preparedMapIdentity.d.ts +3 -0
- package/dist/preparedMapIdentity.d.ts.map +1 -0
- package/dist/preparedMapIdentity.js +30 -0
- package/dist/publicAssets.d.ts +11 -0
- package/dist/publicAssets.d.ts.map +1 -0
- package/dist/publicAssets.js +5 -0
- package/dist/taxonomy.d.ts +50 -0
- package/dist/taxonomy.d.ts.map +1 -0
- package/dist/taxonomy.js +10 -0
- package/dist/theme.d.ts +143 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +141 -0
- package/dist/viewer.d.ts +333 -0
- package/dist/viewer.d.ts.map +1 -0
- package/dist/viewer.js +109 -0
- package/package.json +28 -3
- package/README.md +0 -3
package/dist/events.js
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { OfflineRouteEvents } from './navigation/savedRoute.js';
|
|
2
|
+
import { NodePoint, projectPublicNodeDetails, } from './nodePoint.js';
|
|
3
|
+
import { EndpointEvents } from './endpoints.js';
|
|
4
|
+
/** Canonical events across all SDKs. Hinglish: Sab SDK isi registry ke names use karte hain. */
|
|
5
|
+
export const ViewerEvents = {
|
|
6
|
+
offlineChanged: 'offlineChanged',
|
|
7
|
+
...OfflineRouteEvents,
|
|
8
|
+
...EndpointEvents,
|
|
9
|
+
routePlaybackProgress: 'routePlaybackProgress',
|
|
10
|
+
routeChanged: 'routeChanged',
|
|
11
|
+
loadStart: 'loadStart',
|
|
12
|
+
loaded: 'loaded',
|
|
13
|
+
loadCancel: 'loadCancel',
|
|
14
|
+
floorChange: 'floorChange',
|
|
15
|
+
viewModeChange: 'viewModeChange',
|
|
16
|
+
cameraViewChange: 'cameraViewChange',
|
|
17
|
+
nodeClick: 'nodeClick',
|
|
18
|
+
nodeSelected: 'nodeSelected',
|
|
19
|
+
nodeGroupSelected: 'nodeGroupSelected',
|
|
20
|
+
discoveryChanged: 'discoveryChanged',
|
|
21
|
+
catalogChanged: 'catalogChanged',
|
|
22
|
+
depthChange: 'depthChange',
|
|
23
|
+
textTypeChange: 'textTypeChange',
|
|
24
|
+
labelsToggled: 'labelsToggled',
|
|
25
|
+
themeChange: 'themeChange',
|
|
26
|
+
error: 'error',
|
|
27
|
+
destroy: 'destroy',
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Portable command error class preserving structured `code`, `details`, and `name` across transport boundaries.
|
|
31
|
+
*
|
|
32
|
+
* Hinglish: Transport boundary ke aar-paar `code`, `details` aur `name` preserve karne wala portable Error class.
|
|
33
|
+
*/
|
|
34
|
+
export class ViewerCommandError extends Error {
|
|
35
|
+
code;
|
|
36
|
+
details;
|
|
37
|
+
constructor(message, options) {
|
|
38
|
+
super(message);
|
|
39
|
+
this.name =
|
|
40
|
+
typeof options?.name === 'string' && options.name.trim() !== ''
|
|
41
|
+
? options.name
|
|
42
|
+
: 'ViewerCommandError';
|
|
43
|
+
if (typeof options?.code === 'string' && options.code.trim() !== '') {
|
|
44
|
+
this.code = options.code;
|
|
45
|
+
}
|
|
46
|
+
if (options?.details &&
|
|
47
|
+
typeof options.details === 'object' &&
|
|
48
|
+
!Array.isArray(options.details)) {
|
|
49
|
+
this.details = { ...options.details };
|
|
50
|
+
}
|
|
51
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/** Nullable delegation wrapper to canonical NodePoint public projection without hydrating geometry or graph.
|
|
55
|
+
* Hinglish: Nullable wrapper jo bina geometry/graph clone kiye canonical public projection ko delegate karta hai. */
|
|
56
|
+
export function toPublicNodeData(node) {
|
|
57
|
+
if (!node)
|
|
58
|
+
return null;
|
|
59
|
+
return node instanceof NodePoint ? node.toPublicDetails() : projectPublicNodeDetails(node);
|
|
60
|
+
}
|
|
61
|
+
/** Project once at the viewer boundary. Hinglish: Har SDK me click mapping dobara nahi hoti. */
|
|
62
|
+
export function toNodeClickEvent(event, publicNode) {
|
|
63
|
+
return {
|
|
64
|
+
key: event.key,
|
|
65
|
+
node: publicNode === undefined ? toPublicNodeData(event.node) : publicNode,
|
|
66
|
+
...(event.point ? { point: { ...event.point } } : {}),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/** Loaded callbacks expose floors/count, not parser indexes or geometry.
|
|
70
|
+
* Hinglish: Loaded callback me floor metadata milti hai, internal indexer nahi. */
|
|
71
|
+
export function toMapLoadedData(map) {
|
|
72
|
+
return {
|
|
73
|
+
mallId: map.mallId,
|
|
74
|
+
...(map.mallName ? { mallName: map.mallName } : {}),
|
|
75
|
+
version: map.version,
|
|
76
|
+
defaultFloor: map.defaultFloor ?? 0,
|
|
77
|
+
floors: map.floors.map((f) => ({ ...f })),
|
|
78
|
+
nodeCount: map.nodes.length,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export function toViewerError(error, code = 'VIEWER_ERROR') {
|
|
82
|
+
const resolvedCode = typeof error === 'object' &&
|
|
83
|
+
error !== null &&
|
|
84
|
+
typeof error.code === 'string' &&
|
|
85
|
+
error.code.trim() !== ''
|
|
86
|
+
? error.code
|
|
87
|
+
: code;
|
|
88
|
+
const rawDetails = typeof error === 'object' && error !== null
|
|
89
|
+
? error.details
|
|
90
|
+
: undefined;
|
|
91
|
+
const details = rawDetails && typeof rawDetails === 'object' && !Array.isArray(rawDetails)
|
|
92
|
+
? { ...rawDetails }
|
|
93
|
+
: undefined;
|
|
94
|
+
return {
|
|
95
|
+
code: resolvedCode,
|
|
96
|
+
message: error instanceof Error ? error.message : String(error),
|
|
97
|
+
...(details !== undefined ? { details } : {}),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Extracts JSON-safe structured error metadata (`name`, `code`, `message`, `details`) from an unknown error
|
|
102
|
+
* for transport across WebView ACK envelopes.
|
|
103
|
+
*
|
|
104
|
+
* Hinglish: Kisi bhi error se JSON-safe `name`, `code`, `message` aur `details` extract karta hai
|
|
105
|
+
* taaki WebView ACK ke zariye Native host tak safe bheja ja sake.
|
|
106
|
+
*/
|
|
107
|
+
export function serializeCommandError(error) {
|
|
108
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
109
|
+
if (!error || typeof error !== 'object') {
|
|
110
|
+
return { message };
|
|
111
|
+
}
|
|
112
|
+
const candidate = error;
|
|
113
|
+
const name = typeof candidate.name === 'string' && candidate.name.trim() !== ''
|
|
114
|
+
? candidate.name.trim()
|
|
115
|
+
: undefined;
|
|
116
|
+
const code = typeof candidate.code === 'string' && candidate.code.trim() !== ''
|
|
117
|
+
? candidate.code.trim()
|
|
118
|
+
: undefined;
|
|
119
|
+
let details;
|
|
120
|
+
if (candidate.details &&
|
|
121
|
+
typeof candidate.details === 'object' &&
|
|
122
|
+
!Array.isArray(candidate.details)) {
|
|
123
|
+
try {
|
|
124
|
+
const parsed = JSON.parse(JSON.stringify(candidate.details));
|
|
125
|
+
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
|
126
|
+
details = parsed;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
details = undefined;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
message,
|
|
135
|
+
...(name !== undefined ? { name } : {}),
|
|
136
|
+
...(code !== undefined ? { code } : {}),
|
|
137
|
+
...(details !== undefined ? { details } : {}),
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Reconstructs a `ViewerCommandError` on the host side from serialized ACK error fields,
|
|
142
|
+
* optionally marking it as a suppressed command error when an error event was already emitted.
|
|
143
|
+
*
|
|
144
|
+
* Hinglish: Serialized ACK error fields se host side par `ViewerCommandError` reconstruct karta hai
|
|
145
|
+
* (`code`, `details` aur duplicate-error suppression preserve karte hue).
|
|
146
|
+
*/
|
|
147
|
+
export function reconstructCommandError(structured, suppressDuplicateReport = false) {
|
|
148
|
+
const reconstructed = new ViewerCommandError(structured.message, {
|
|
149
|
+
name: structured.name,
|
|
150
|
+
code: structured.code,
|
|
151
|
+
details: structured.details,
|
|
152
|
+
});
|
|
153
|
+
return suppressDuplicateReport ? markSuppressedCommandError(reconstructed) : reconstructed;
|
|
154
|
+
}
|
|
155
|
+
/** Identify normal load cancellation/abort so loading state settles without emitting a domain error.
|
|
156
|
+
* Hinglish: Normal abort/cancel ko identify karein taaki bina error callback ke loading state false settle ho. */
|
|
157
|
+
export function isLoadCancelledError(error) {
|
|
158
|
+
if (!error)
|
|
159
|
+
return false;
|
|
160
|
+
if (typeof error === 'object' && error.isCancelled === true) {
|
|
161
|
+
return true;
|
|
162
|
+
}
|
|
163
|
+
const name = error instanceof Error ? error.name : error.name;
|
|
164
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
165
|
+
return (name === 'AbortError' ||
|
|
166
|
+
name === 'SupersededLoadError' ||
|
|
167
|
+
message.startsWith('Map load superseded'));
|
|
168
|
+
}
|
|
169
|
+
const SUPPRESSED_COMMAND_ERROR = Symbol.for('wovvmap.suppressedCommandError');
|
|
170
|
+
/** Marks a transport/lifecycle rejection whose error event was already emitted or whose session was intentionally reset/disposed.
|
|
171
|
+
* Hinglish: Jis command error ka event pehle hi emit ho chuka hai ya jo normal teardown/reset hai, use mark karein. */
|
|
172
|
+
export function markSuppressedCommandError(error) {
|
|
173
|
+
Object.defineProperty(error, SUPPRESSED_COMMAND_ERROR, {
|
|
174
|
+
value: true,
|
|
175
|
+
enumerable: false,
|
|
176
|
+
configurable: true,
|
|
177
|
+
});
|
|
178
|
+
return error;
|
|
179
|
+
}
|
|
180
|
+
/** Returns true when a command rejection is a normal load cancellation, lifecycle teardown, or an error already emitted by the SDK.
|
|
181
|
+
* Hinglish: Check karta hai ki command rejection normal cancel/teardown hai ya SDK error event pehle hi emit ho chuka hai. */
|
|
182
|
+
export function isSuppressedCommandError(error) {
|
|
183
|
+
if (!error)
|
|
184
|
+
return true;
|
|
185
|
+
if (isLoadCancelledError(error))
|
|
186
|
+
return true;
|
|
187
|
+
if (typeof error === 'object' &&
|
|
188
|
+
error[SUPPRESSED_COMMAND_ERROR] === true) {
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
/** Converts an unhandled command rejection into a public ViewerErrorData, or null if already reported/cancelled.
|
|
194
|
+
* Hinglish: Real command failure ko ViewerErrorData me convert karta hai; already-reported ya cancelled error ke liye null deta hai. */
|
|
195
|
+
export function toViewerCommandError(error, defaultCode = 'VIEWER_COMMAND_ERROR') {
|
|
196
|
+
if (isSuppressedCommandError(error))
|
|
197
|
+
return null;
|
|
198
|
+
const code = typeof error === 'object' &&
|
|
199
|
+
error !== null &&
|
|
200
|
+
typeof error.code === 'string'
|
|
201
|
+
? error.code
|
|
202
|
+
: defaultCode;
|
|
203
|
+
return toViewerError(error, code);
|
|
204
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file geometry.ts
|
|
3
|
+
* @description Core geometric coordinate, shape, and asset placement contracts.
|
|
4
|
+
* Is file me 2D/3D coordinates, shape boundary aur visual image positioning ke contracts hain.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* 2D coordinate on a planar map surface.
|
|
8
|
+
* Planar map surface par 2D coordinate (X aur Y sthiti).
|
|
9
|
+
*/
|
|
10
|
+
import type { PreparedShape } from './preparedMap.js';
|
|
11
|
+
export interface Point2D {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
}
|
|
15
|
+
/** Immutable polygon coordinates shared by node/viewer wrappers.
|
|
16
|
+
* Hinglish: Node/viewer ke alag wrappers me share hone wale read-only polygon points. */
|
|
17
|
+
export type ShapeVertices = readonly Readonly<Point2D>[];
|
|
18
|
+
/**
|
|
19
|
+
* 3D spatial coordinate.
|
|
20
|
+
* 3D space me sthiti (X, Y aur Z coordinates).
|
|
21
|
+
*/
|
|
22
|
+
export interface Point3D {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
z: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Geometric polygon boundary and visual 3D extrusion details for a unit or space.
|
|
29
|
+
* Unit ya dukan ki polygon boundary, 3D extrusion depth, floor bash flag aur color detail.
|
|
30
|
+
*/
|
|
31
|
+
export interface shapeDetail {
|
|
32
|
+
/** Validated render buffers; source polygons are processed on the private server.
|
|
33
|
+
* Hinglish: Client sirf ready buffers upload karta hai; raw polygon ka algorithm server par hai. */
|
|
34
|
+
prepared?: PreparedShape | null;
|
|
35
|
+
/**
|
|
36
|
+
* Polygon vertices defining the perimeter footprint.
|
|
37
|
+
* Canonical `NodePoint` instances treat this coordinate array and its `Point2D` elements as
|
|
38
|
+
* immutable geometry (`readonly Readonly<Point2D>[]`), allowing zero-copy vertex array reuse across
|
|
39
|
+
* viewers, caches, and snapshots while keeping the outer `shapeDetail` styling/depth container
|
|
40
|
+
* separate per node and viewer.
|
|
41
|
+
*
|
|
42
|
+
* Hinglish: Dukan ya space ke perimeter points ki list. Canonical `NodePoint` me ye vertex array
|
|
43
|
+
* read-only/immutable rehta hai taaki alag-alag viewers aur cache me bina repeat copy ke reuse ho sake,
|
|
44
|
+
* jabki outer `shapeDetail` object (depth, color, category) har node/viewer ke liye separate rehta hai.
|
|
45
|
+
*/
|
|
46
|
+
shape: ShapeVertices;
|
|
47
|
+
/**
|
|
48
|
+
* Vertical extrusion height / wall depth.
|
|
49
|
+
* Dukan ki deewar ki 3D extrusion height.
|
|
50
|
+
*/
|
|
51
|
+
depth: number;
|
|
52
|
+
/**
|
|
53
|
+
* Indicates if this shape acts as a floor base footprint.
|
|
54
|
+
* Kya ye shape floor ka base platform / footprint hai.
|
|
55
|
+
*/
|
|
56
|
+
floorBash: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Primary fill or tint color in hex or CSS format.
|
|
59
|
+
* Dukan ya shape ka primary color (hex code).
|
|
60
|
+
*/
|
|
61
|
+
color: string;
|
|
62
|
+
/**
|
|
63
|
+
* Optional retail/amenity category classification code.
|
|
64
|
+
*/
|
|
65
|
+
category?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Geometric nature of the shape:
|
|
68
|
+
* - 'extruded': solid enclosed unit with roof
|
|
69
|
+
* - 'hollow' / 'open': walled boundary with open/empty interior (courtyard, atrium, room without roof)
|
|
70
|
+
* - 'flat': flat floor footprint boundary
|
|
71
|
+
* Shape ka type (solid extruded, hollow deewar ya flat boundary).
|
|
72
|
+
*/
|
|
73
|
+
shapeType?: 'extruded' | 'flat' | 'hollow' | 'open' | string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Ownership options controlling whether incoming shape coordinate arrays (`Point2D[]`) can be
|
|
77
|
+
* claimed and reused in-place without a defensive boundary copy.
|
|
78
|
+
*
|
|
79
|
+
* Hinglish: Shape coordinate arrays (`Point2D[]`) ki ownership batane ke options; `ownShapeCoordinates: true`
|
|
80
|
+
* hone par existing vertex array ko bina copy kiye freeze/reuse kiya jata hai.
|
|
81
|
+
*/
|
|
82
|
+
export interface ShapeCoordinateOwnershipOptions {
|
|
83
|
+
/**
|
|
84
|
+
* When `true`, declares that the caller or boundary adapter exclusively owns the incoming
|
|
85
|
+
* `shapeDetail.shape` array (e.g., fresh HTTP JSON deserialization or snapshot restore) so it can
|
|
86
|
+
* be frozen and reused in place with zero vertex copies.
|
|
87
|
+
*
|
|
88
|
+
* Hinglish: Jab `true` ho, to iska matlab hai ki incoming `shape` array exclusively owned hai
|
|
89
|
+
* (jaise fresh network JSON ya snapshot restore) aur use bina vertex copy kiye freeze karke reuse kiya ja sakta hai.
|
|
90
|
+
*/
|
|
91
|
+
ownShapeCoordinates?: boolean;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Text label positioning, dimension, styling, and pinpoint attachment on a shape.
|
|
95
|
+
* 3D map par dukan ka naam ya text label dikhane ke liye positioning aur style options.
|
|
96
|
+
*/
|
|
97
|
+
export interface LocationName {
|
|
98
|
+
/**
|
|
99
|
+
* Visible label text.
|
|
100
|
+
* Dikhane yogya text label.
|
|
101
|
+
*/
|
|
102
|
+
text: string;
|
|
103
|
+
/**
|
|
104
|
+
* 2D center area offset for text placement.
|
|
105
|
+
* Text place karne ke liye center offset.
|
|
106
|
+
*/
|
|
107
|
+
area?: Point2D;
|
|
108
|
+
/**
|
|
109
|
+
* Rotation angle in degrees or radians.
|
|
110
|
+
* Label ka ghumav (rotation angle).
|
|
111
|
+
*/
|
|
112
|
+
rotate?: number;
|
|
113
|
+
/**
|
|
114
|
+
* Text foreground color.
|
|
115
|
+
* Text ka color code.
|
|
116
|
+
*/
|
|
117
|
+
textColor?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Font size descriptor.
|
|
120
|
+
* Font size ki detail.
|
|
121
|
+
*/
|
|
122
|
+
textSize?: string;
|
|
123
|
+
/**
|
|
124
|
+
* CSS font styling or weight (e.g. bold, normal).
|
|
125
|
+
* Font styling (bold, italic, etc.).
|
|
126
|
+
*/
|
|
127
|
+
textStyle?: string;
|
|
128
|
+
/**
|
|
129
|
+
* Bounding box width for text wrapping.
|
|
130
|
+
* Text wrap karne ke liye box width.
|
|
131
|
+
*/
|
|
132
|
+
width?: number;
|
|
133
|
+
/**
|
|
134
|
+
* Bounding box height.
|
|
135
|
+
* Text box ki height.
|
|
136
|
+
*/
|
|
137
|
+
height?: number;
|
|
138
|
+
/**
|
|
139
|
+
* Optional pinpoint target coordinate.
|
|
140
|
+
* Pin icon lagane ke liye pinpoint coordinate.
|
|
141
|
+
*/
|
|
142
|
+
pinpoint?: Point2D;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Planar logo or icon image placed onto a map node shape.
|
|
146
|
+
* Map shape par logo ya icon image place karne ka asset descriptor.
|
|
147
|
+
*/
|
|
148
|
+
export interface PointImage {
|
|
149
|
+
/**
|
|
150
|
+
* Remote image URL or asset source path.
|
|
151
|
+
* Image ka URL ya path.
|
|
152
|
+
*/
|
|
153
|
+
src: string;
|
|
154
|
+
/**
|
|
155
|
+
* Optional associated node point identifier.
|
|
156
|
+
* Node point ki ID jisse ye image judi hui hai.
|
|
157
|
+
*/
|
|
158
|
+
nodePointId?: string;
|
|
159
|
+
/**
|
|
160
|
+
* Horizontal offset position.
|
|
161
|
+
* X axis par offset position.
|
|
162
|
+
*/
|
|
163
|
+
x?: number;
|
|
164
|
+
/**
|
|
165
|
+
* Vertical offset position.
|
|
166
|
+
* Y axis par offset position.
|
|
167
|
+
*/
|
|
168
|
+
y?: number;
|
|
169
|
+
/**
|
|
170
|
+
* Render width of the image.
|
|
171
|
+
* Image ki display width.
|
|
172
|
+
*/
|
|
173
|
+
width?: number;
|
|
174
|
+
/**
|
|
175
|
+
* Render height of the image.
|
|
176
|
+
* Image ki display height.
|
|
177
|
+
*/
|
|
178
|
+
height?: number;
|
|
179
|
+
/**
|
|
180
|
+
* Rotation angle in degrees.
|
|
181
|
+
* Image ka rotation angle.
|
|
182
|
+
*/
|
|
183
|
+
rotation?: number;
|
|
184
|
+
/**
|
|
185
|
+
* Alpha transparency (0.0 to 1.0).
|
|
186
|
+
* Image ki transparency level (0 se 1 tak).
|
|
187
|
+
*/
|
|
188
|
+
opacity?: number;
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=geometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../src/geometry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAElD,MAAM,WAAW,OAAO;IACtB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAED;yFACyF;AACzF,MAAM,MAAM,aAAa,GAAG,SAAS,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAA;AAExD;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B;wGACoG;IACpG,QAAQ,CAAC,EAAE,aAAa,GAAG,IAAI,CAAA;IAC/B;;;;;;;;;;OAUG;IACH,KAAK,EAAE,aAAa,CAAA;IAEpB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAA;IAEb;;;OAGG;IACH,SAAS,EAAE,OAAO,CAAA;IAElB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAA;IAEb;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAA;CAC7D;AAED;;;;;;GAMG;AACH,MAAM,WAAW,+BAA+B;IAC9C;;;;;;;OAOG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;IAEd;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAA;IAEX;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB;;;OAGG;IACH,CAAC,CAAC,EAAE,MAAM,CAAA;IAEV;;;OAGG;IACH,CAAC,CAAC,EAAE,MAAM,CAAA;IAEV;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB"}
|
package/dist/geometry.js
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file index.ts
|
|
3
|
+
* @description Public exports facade for @wovvmap/contracts.
|
|
4
|
+
* @wovvmap/contracts package ka public export facade.
|
|
5
|
+
*/
|
|
6
|
+
export * from './geometry.js';
|
|
7
|
+
export * from './metadata.js';
|
|
8
|
+
export * from './nodePoint.js';
|
|
9
|
+
export * from './nodeLine.js';
|
|
10
|
+
export * from './depthConfig.js';
|
|
11
|
+
export * from './multiFloor.js';
|
|
12
|
+
export * from './theme.js';
|
|
13
|
+
export * from './discovery.js';
|
|
14
|
+
export * from './catalog.js';
|
|
15
|
+
export * from './events.js';
|
|
16
|
+
export * from './viewer.js';
|
|
17
|
+
export * from './interaction.js';
|
|
18
|
+
export * from './endpoints.js';
|
|
19
|
+
export * from './preparedMap.js';
|
|
20
|
+
export * from './offline.js';
|
|
21
|
+
export * from './publicAssets.js';
|
|
22
|
+
export * from './navigation/index.js';
|
|
23
|
+
export type { Category, SubCategory, Amenity } from './taxonomy.js';
|
|
24
|
+
export { getOfferWindow, hasActiveOffer } from './offerValidity.js';
|
|
25
|
+
export { samePreparedMapIdentity } from './preparedMapIdentity.js';
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAE5B,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEhE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file index.ts
|
|
3
|
+
* @description Public exports facade for @wovvmap/contracts.
|
|
4
|
+
* @wovvmap/contracts package ka public export facade.
|
|
5
|
+
*/
|
|
6
|
+
export * from './geometry.js';
|
|
7
|
+
export * from './metadata.js';
|
|
8
|
+
export * from './nodePoint.js';
|
|
9
|
+
export * from './nodeLine.js';
|
|
10
|
+
export * from './depthConfig.js';
|
|
11
|
+
export * from './multiFloor.js';
|
|
12
|
+
export * from './theme.js';
|
|
13
|
+
export * from './discovery.js';
|
|
14
|
+
export * from './catalog.js';
|
|
15
|
+
export * from './events.js';
|
|
16
|
+
export * from './viewer.js';
|
|
17
|
+
export * from './interaction.js';
|
|
18
|
+
export * from './endpoints.js';
|
|
19
|
+
export * from './preparedMap.js';
|
|
20
|
+
export * from './offline.js';
|
|
21
|
+
export * from './publicAssets.js';
|
|
22
|
+
export * from './navigation/index.js';
|
|
23
|
+
export { getOfferWindow, hasActiveOffer } from './offerValidity.js';
|
|
24
|
+
export { samePreparedMapIdentity } from './preparedMapIdentity.js';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { NodeGroupSelectionRequest } from './catalog.js';
|
|
2
|
+
import type { DiscoveryFilterRequest } from './discovery.js';
|
|
3
|
+
import { type EndpointReference } from './endpoints.js';
|
|
4
|
+
export { copyGroupSelectionRequest } from './interactionScope.js';
|
|
5
|
+
/** Compact same-revision interaction checkpoint; geometry and member arrays are excluded.
|
|
6
|
+
* Hinglish: History mein sirf IDs/filter/floor hain; raw nodes ya meshes nahi; endpoints bhi sirf refs hain. */
|
|
7
|
+
export interface ViewerInteractionState {
|
|
8
|
+
readonly mallId: string;
|
|
9
|
+
readonly revision: string | number;
|
|
10
|
+
readonly floorIndex: number;
|
|
11
|
+
readonly filter: DiscoveryFilterRequest | null;
|
|
12
|
+
/** Optional for older clients; omission preserves current endpoints on restore.
|
|
13
|
+
* Hinglish: Purane caller field na bheje to current endpoints safe rahenge. */
|
|
14
|
+
readonly endpoints?: EndpointReferences;
|
|
15
|
+
readonly selection: {
|
|
16
|
+
readonly kind: 'node';
|
|
17
|
+
readonly key: string;
|
|
18
|
+
} | {
|
|
19
|
+
readonly kind: 'group';
|
|
20
|
+
readonly request: NodeGroupSelectionRequest;
|
|
21
|
+
} | null;
|
|
22
|
+
}
|
|
23
|
+
/** Only endpoint intents belong in a history checkpoint, never resolved public details or member keys.
|
|
24
|
+
* Hinglish: History mein start/end ke chhote refs hi hon; full node/group ka copy nahi. */
|
|
25
|
+
export interface EndpointReferences {
|
|
26
|
+
readonly origin: EndpointReference | null;
|
|
27
|
+
readonly destination: EndpointReference | null;
|
|
28
|
+
}
|
|
29
|
+
/** Direction Back may retain the latest valid origin when it does not overlap the captured destination.
|
|
30
|
+
* Hinglish: Edited origin valid aur restored destination se alag ho tab hi preserve ho. */
|
|
31
|
+
export interface RestoreInteractionOptions {
|
|
32
|
+
readonly preserveOrigin?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/** Own/freeze the fixed-size public checkpoint without reading or cloning group members.
|
|
35
|
+
* Hinglish: Chhota checkpoint immutable rahe; group ke saare nodes ka loop nahi chale. */
|
|
36
|
+
export declare function freezeInteractionState(state: ViewerInteractionState): ViewerInteractionState;
|
|
37
|
+
//# sourceMappingURL=interaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interaction.d.ts","sourceRoot":"","sources":["../src/interaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAA;AAC1D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAEzD,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAA;AAE9D;gHACgH;AAChH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;IAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,MAAM,EAAE,sBAAsB,GAAG,IAAI,CAAA;IAC9C;mFAC+E;IAC/E,QAAQ,CAAC,SAAS,CAAC,EAAE,kBAAkB,CAAA;IACvC,QAAQ,CAAC,SAAS,EACd;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAC/C;QAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,yBAAyB,CAAA;KAAE,GACvE,IAAI,CAAA;CACT;AAED;2FAC2F;AAC3F,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAA;IACzC,QAAQ,CAAC,WAAW,EAAE,iBAAiB,GAAG,IAAI,CAAA;CAC/C;AAED;2FAC2F;AAC3F,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAA;CAClC;AAED;0FAC0F;AAC1F,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,sBAAsB,GAAG,sBAAsB,CA2B5F"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { copyGroupSelectionRequest, copyFilter } from './interactionScope.js';
|
|
2
|
+
import { freezeEndpointReference } from './endpoints.js';
|
|
3
|
+
export { copyGroupSelectionRequest } from './interactionScope.js';
|
|
4
|
+
/** Own/freeze the fixed-size public checkpoint without reading or cloning group members.
|
|
5
|
+
* Hinglish: Chhota checkpoint immutable rahe; group ke saare nodes ka loop nahi chale. */
|
|
6
|
+
export function freezeInteractionState(state) {
|
|
7
|
+
const selection = state.selection?.kind === 'group'
|
|
8
|
+
? {
|
|
9
|
+
kind: 'group',
|
|
10
|
+
request: Object.freeze(copyGroupSelectionRequest(state.selection.request)),
|
|
11
|
+
}
|
|
12
|
+
: state.selection
|
|
13
|
+
? { kind: 'node', key: state.selection.key }
|
|
14
|
+
: null;
|
|
15
|
+
return Object.freeze({
|
|
16
|
+
mallId: state.mallId,
|
|
17
|
+
revision: state.revision,
|
|
18
|
+
floorIndex: state.floorIndex,
|
|
19
|
+
...(state.endpoints !== undefined
|
|
20
|
+
? {
|
|
21
|
+
endpoints: Object.freeze({
|
|
22
|
+
origin: state.endpoints.origin ? freezeEndpointReference(state.endpoints.origin) : null,
|
|
23
|
+
destination: state.endpoints.destination
|
|
24
|
+
? freezeEndpointReference(state.endpoints.destination)
|
|
25
|
+
: null,
|
|
26
|
+
}),
|
|
27
|
+
}
|
|
28
|
+
: {}),
|
|
29
|
+
filter: state.filter ? copyFilter(state.filter) : null,
|
|
30
|
+
selection: selection ? Object.freeze(selection) : null,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { NodeGroupSelectionRequest } from './catalog.js';
|
|
2
|
+
import type { DiscoveryFilterRequest } from './discovery.js';
|
|
3
|
+
/** Copy only reviewed group scope fields; arbitrary caller data cannot enter public history.
|
|
4
|
+
* Hinglish: Group ka search/filter context hi copy ho; caller ka extra raw data history mein na aaye. */
|
|
5
|
+
export declare function copyGroupSelectionRequest(request: NodeGroupSelectionRequest): NodeGroupSelectionRequest;
|
|
6
|
+
export declare function copyFilter(filter: DiscoveryFilterRequest & {
|
|
7
|
+
floorIndex?: number;
|
|
8
|
+
}): Readonly<{
|
|
9
|
+
floorIndex?: number | undefined;
|
|
10
|
+
offersOnly?: boolean | undefined;
|
|
11
|
+
amenityId?: string | number | undefined;
|
|
12
|
+
subCategoryCode?: string | number | undefined;
|
|
13
|
+
categoryCode?: string | number | undefined;
|
|
14
|
+
}>;
|
|
15
|
+
//# sourceMappingURL=interactionScope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interactionScope.d.ts","sourceRoot":"","sources":["../src/interactionScope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAA;AAC1D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAEzD;yGACyG;AACzG,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,yBAAyB,GACjC,yBAAyB,CAkB3B;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,sBAAsB,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;GAQlF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Copy only reviewed group scope fields; arbitrary caller data cannot enter public history.
|
|
2
|
+
* Hinglish: Group ka search/filter context hi copy ho; caller ka extra raw data history mein na aaye. */
|
|
3
|
+
export function copyGroupSelectionRequest(request) {
|
|
4
|
+
return {
|
|
5
|
+
groupId: request.groupId,
|
|
6
|
+
...(request.mallId !== undefined ? { mallId: request.mallId } : {}),
|
|
7
|
+
...(request.expectedRevision !== undefined
|
|
8
|
+
? { expectedRevision: request.expectedRevision }
|
|
9
|
+
: {}),
|
|
10
|
+
...(request.activeFloorIndex !== undefined
|
|
11
|
+
? { activeFloorIndex: request.activeFloorIndex }
|
|
12
|
+
: {}),
|
|
13
|
+
...(request.query !== undefined ? { query: request.query } : {}),
|
|
14
|
+
...(request.mode !== undefined ? { mode: request.mode } : {}),
|
|
15
|
+
...(request.sortBy !== undefined ? { sortBy: request.sortBy } : {}),
|
|
16
|
+
...(request.floorSecondarySortBy !== undefined
|
|
17
|
+
? { floorSecondarySortBy: request.floorSecondarySortBy }
|
|
18
|
+
: {}),
|
|
19
|
+
...(request.filter ? { filter: copyFilter(request.filter) } : {}),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export function copyFilter(filter) {
|
|
23
|
+
return Object.freeze({
|
|
24
|
+
...(filter.categoryCode !== undefined ? { categoryCode: filter.categoryCode } : {}),
|
|
25
|
+
...(filter.subCategoryCode !== undefined ? { subCategoryCode: filter.subCategoryCode } : {}),
|
|
26
|
+
...(filter.amenityId !== undefined ? { amenityId: filter.amenityId } : {}),
|
|
27
|
+
...(filter.offersOnly !== undefined ? { offersOnly: filter.offersOnly } : {}),
|
|
28
|
+
...(filter.floorIndex !== undefined ? { floorIndex: filter.floorIndex } : {}),
|
|
29
|
+
});
|
|
30
|
+
}
|