@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
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file depthConfig.ts
|
|
3
|
+
* @description Dynamic 3D extrusion depth configuration and height resolution helpers.
|
|
4
|
+
* Is file me 3D map ki deewaron ki unchai aur floor base thickness ko dynamically control karne ke contracts hain.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Standard default depth profiles for 2D and 3D modes.
|
|
8
|
+
* Default 2D aur 3D depth profiles.
|
|
9
|
+
*/
|
|
10
|
+
export const DEFAULT_MODE_DEPTHS = {
|
|
11
|
+
'2D': {
|
|
12
|
+
unitDepth: 0.1,
|
|
13
|
+
extraDepthPlane: 0.5,
|
|
14
|
+
extraDepthSprite: 3.0,
|
|
15
|
+
},
|
|
16
|
+
'3D': {
|
|
17
|
+
unitDepth: 6.0,
|
|
18
|
+
extraDepthPlane: 1.5,
|
|
19
|
+
extraDepthSprite: 3.0,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Standard default extrusion depth configuration.
|
|
24
|
+
* Default standard extrusion depth values.
|
|
25
|
+
*/
|
|
26
|
+
export const DEFAULT_DYNAMIC_DEPTH_CONFIG = Object.freeze({
|
|
27
|
+
floorBaseDepth: 0,
|
|
28
|
+
defaultUnitDepth: 6,
|
|
29
|
+
depthMultiplier: 1.0,
|
|
30
|
+
modeDepths: DEFAULT_MODE_DEPTHS,
|
|
31
|
+
});
|
|
32
|
+
/**
|
|
33
|
+
* Resolves mode-specific depth and offset configuration.
|
|
34
|
+
* Extensible for any custom view modes without hardcoded if-else logic.
|
|
35
|
+
*
|
|
36
|
+
* View mode ke aadhar par depth configuration resolve karein.
|
|
37
|
+
*/
|
|
38
|
+
export function resolveModeDepth(mode = '3D', config) {
|
|
39
|
+
if (config?.modeDepths && config.modeDepths[mode]) {
|
|
40
|
+
return config.modeDepths[mode];
|
|
41
|
+
}
|
|
42
|
+
return DEFAULT_MODE_DEPTHS[mode] ?? DEFAULT_MODE_DEPTHS['3D'];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Resolves the surface elevation where logos or icons should be positioned.
|
|
46
|
+
* Distinguishes between solid extruded units (sits on roof), flat platforms (sits on floor),
|
|
47
|
+
* and hollow/walled rooms (sits on floor inside the walls so it does not float in mid-air).
|
|
48
|
+
*
|
|
49
|
+
* Shape ke nature (solid ya hollow) ke aadhar par surface elevation resolve karein.
|
|
50
|
+
*
|
|
51
|
+
* @param node Node geometric attributes (shapeDetail).
|
|
52
|
+
* @param mode Active map view mode (2D, 3D, etc.).
|
|
53
|
+
* @param config Optional dynamic depth configuration.
|
|
54
|
+
* @returns Vertical surface Y coordinate for image/label placement.
|
|
55
|
+
*/
|
|
56
|
+
export function resolveSurfaceElevation(node, mode = '3D', config) {
|
|
57
|
+
const modeConfig = resolveModeDepth(mode, config);
|
|
58
|
+
// 1. In 2D mode, all shapes are uniformly flattened to modeConfig.unitDepth
|
|
59
|
+
if (mode === '2D') {
|
|
60
|
+
return modeConfig.unitDepth;
|
|
61
|
+
}
|
|
62
|
+
const shapeDetail = node.shapeDetail;
|
|
63
|
+
if (!shapeDetail) {
|
|
64
|
+
return config?.floorBaseDepth ?? 0;
|
|
65
|
+
}
|
|
66
|
+
// 2. Base platform / floor boundary sits on the floor
|
|
67
|
+
if (shapeDetail.floorBash) {
|
|
68
|
+
return config?.floorBaseDepth ?? 0;
|
|
69
|
+
}
|
|
70
|
+
// 3. Hollow shapes, open rooms, courtyards (walls around, empty in center) sit on the floor
|
|
71
|
+
const shapeType = shapeDetail.shapeType?.toLowerCase();
|
|
72
|
+
if (shapeType === 'hollow' ||
|
|
73
|
+
shapeType === 'open' ||
|
|
74
|
+
shapeType === 'flat' ||
|
|
75
|
+
shapeType === 'hollow-box' ||
|
|
76
|
+
shapeType === 'courtyard') {
|
|
77
|
+
return config?.floorBaseDepth ?? 0;
|
|
78
|
+
}
|
|
79
|
+
// 4. Solid extruded unit sits on the actual extruded roof
|
|
80
|
+
const depth = shapeDetail.depth;
|
|
81
|
+
if (typeof depth === 'number' && depth > 0) {
|
|
82
|
+
return depth;
|
|
83
|
+
}
|
|
84
|
+
return modeConfig.unitDepth;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Resolves the final 3D extrusion depth for a given node geometry.
|
|
88
|
+
* Node geometry aur configuration ke aadhar par final 3D extrusion unchai calculate karein.
|
|
89
|
+
*
|
|
90
|
+
* @param node Node geometric attributes (floorBash, depth, type).
|
|
91
|
+
* @param config Optional dynamic depth configuration.
|
|
92
|
+
* @returns Calculated 3D extrusion height.
|
|
93
|
+
*/
|
|
94
|
+
export function resolveExtrusionDepth(node, config = DEFAULT_DYNAMIC_DEPTH_CONFIG) {
|
|
95
|
+
if (node.floorBash) {
|
|
96
|
+
return config.floorBaseDepth;
|
|
97
|
+
}
|
|
98
|
+
const multiplier = config.depthMultiplier ?? 1.0;
|
|
99
|
+
if (node.type && config.customDepths) {
|
|
100
|
+
const customDepth = config.customDepths[node.type];
|
|
101
|
+
if (typeof customDepth === 'number') {
|
|
102
|
+
return customDepth * multiplier;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (typeof node.depth === 'number' && node.depth > 0) {
|
|
106
|
+
return (node.depth + config.defaultUnitDepth) * multiplier;
|
|
107
|
+
}
|
|
108
|
+
return config.defaultUnitDepth * multiplier;
|
|
109
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file discovery.ts
|
|
3
|
+
* @description Canonical selection references, discovery filter dimensions, and sort/target identifiers.
|
|
4
|
+
* Single node, multi-location group selection references, discovery filter aur sort modes ke common contracts.
|
|
5
|
+
*/
|
|
6
|
+
import type { PublicAmenityData } from './catalog.js';
|
|
7
|
+
/**
|
|
8
|
+
* Supported catalog and discovery read targets.
|
|
9
|
+
* Catalog aur search read requests ke supported targets.
|
|
10
|
+
*/
|
|
11
|
+
export type CatalogTarget = 'stores' | 'categories' | 'subcategories' | 'amenities' | 'offers';
|
|
12
|
+
/**
|
|
13
|
+
* Canonical sort modes shared across catalog browsing and text search.
|
|
14
|
+
* Catalog browse aur search dono me use hone wale canonical sort modes.
|
|
15
|
+
*/
|
|
16
|
+
export type CatalogSortMode = 'default' | 'relevance' | 'asc' | 'desc' | 'floor_proximity' | 'paid_promotion_asc' | 'paid_promotion_desc' | 'paid_promotion_weight' | 'paid_promotion_floor';
|
|
17
|
+
/**
|
|
18
|
+
* Independent query scheduling channels so general search and route-endpoint inputs do not cancel each other.
|
|
19
|
+
* General search, origin input aur destination input ke alag query channels taaki ek dusre ki request cancel na karein.
|
|
20
|
+
*/
|
|
21
|
+
export type SearchQueryChannel = 'general' | 'origin' | 'destination';
|
|
22
|
+
/**
|
|
23
|
+
* Active discovery filter dimensions.
|
|
24
|
+
* Discovery filter ke dimensions (category, subcategory, amenity, offers).
|
|
25
|
+
*/
|
|
26
|
+
export type DiscoveryFilterDimension = 'category' | 'subcategory' | 'amenity' | 'offers';
|
|
27
|
+
/**
|
|
28
|
+
* Explicit filter criteria applied before grouping, sorting, and pagination.
|
|
29
|
+
* Grouping, sorting aur pagination se pehle lagne wale explicit filter criteria.
|
|
30
|
+
*/
|
|
31
|
+
export interface CatalogFilterInput {
|
|
32
|
+
categoryCode?: string | number;
|
|
33
|
+
subCategoryCode?: string | number;
|
|
34
|
+
amenityId?: string | number;
|
|
35
|
+
floorIndex?: number;
|
|
36
|
+
offersOnly?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Single concrete node selection or endpoint reference.
|
|
40
|
+
* Preserves `floorIndex: 0` when provided on the ground floor.
|
|
41
|
+
*
|
|
42
|
+
* Hinglish: Ek concrete store ya point ka selection/endpoint reference;
|
|
43
|
+
* ground floor `0` hone par bhi `floorIndex` preserve rehta hai.
|
|
44
|
+
*/
|
|
45
|
+
export interface SingleNodeSelectionRef {
|
|
46
|
+
kind: 'node';
|
|
47
|
+
key: string;
|
|
48
|
+
floorIndex?: number;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Multi-location group selection or endpoint candidate reference.
|
|
52
|
+
* Holds an explicit string array of member keys (`memberKeys`) rather than a delimiter-joined string.
|
|
53
|
+
*
|
|
54
|
+
* Hinglish: Multiple locations wale store ya amenity group ka selection/endpoint reference;
|
|
55
|
+
* `<->` joined string ke bajay `memberKeys` ka explicit array rakhta hai.
|
|
56
|
+
*/
|
|
57
|
+
export interface GroupNodeSelectionRef {
|
|
58
|
+
kind: 'group';
|
|
59
|
+
groupId: string;
|
|
60
|
+
memberKeys: string[];
|
|
61
|
+
representativeKey?: string;
|
|
62
|
+
floorIndex?: number;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Discriminated union representing either a single concrete node or a multi-location group.
|
|
66
|
+
* Can be used uniformly for store selection, group selection, and origin/destination endpoint candidates.
|
|
67
|
+
*
|
|
68
|
+
* Hinglish: Single node ya multi-location group ko darshane wala discriminated union
|
|
69
|
+
* jo selection aur start/end point candidates dono me same tarike se kaam karta hai.
|
|
70
|
+
*/
|
|
71
|
+
export type NodeSelectionRef = SingleNodeSelectionRef | GroupNodeSelectionRef;
|
|
72
|
+
/**
|
|
73
|
+
* Type guard checking whether a value is a valid SingleNodeSelectionRef.
|
|
74
|
+
* Check karta hai ki value valid SingleNodeSelectionRef hai ya nahi.
|
|
75
|
+
*/
|
|
76
|
+
export declare function isSingleNodeSelectionRef(ref: unknown): ref is SingleNodeSelectionRef;
|
|
77
|
+
/**
|
|
78
|
+
* Type guard checking whether a value is a valid GroupNodeSelectionRef with non-empty member keys.
|
|
79
|
+
* Check karta hai ki value valid GroupNodeSelectionRef hai aur usme valid memberKeys array hai.
|
|
80
|
+
*/
|
|
81
|
+
export declare function isGroupNodeSelectionRef(ref: unknown): ref is GroupNodeSelectionRef;
|
|
82
|
+
/**
|
|
83
|
+
* Type guard checking whether a value is a valid NodeSelectionRef (single node or group).
|
|
84
|
+
* Check karta hai ki value valid single ya group NodeSelectionRef hai ya nahi.
|
|
85
|
+
*/
|
|
86
|
+
export declare function isValidNodeSelectionRef(ref: unknown): ref is NodeSelectionRef;
|
|
87
|
+
/**
|
|
88
|
+
* Returns a defensive, JSON-safe clone of a NodeSelectionRef with deduplicated group member keys.
|
|
89
|
+
* NodeSelectionRef ki fresh JSON-safe copy banata hai taaki caller mutation internal state ko affect na kare.
|
|
90
|
+
*/
|
|
91
|
+
export declare function cloneNodeSelectionRef(ref: NodeSelectionRef): NodeSelectionRef;
|
|
92
|
+
/** Explicit persistent filter. Amenity replaces store dimensions; omitted dimensions are cleared.
|
|
93
|
+
* Hinglish: Naya filter purane ko replace karega; omitted subcategory apne-aap carry nahi hogi. */
|
|
94
|
+
export interface DiscoveryFilterRequest extends Pick<CatalogFilterInput, 'categoryCode' | 'subCategoryCode' | 'amenityId' | 'offersOnly'> {
|
|
95
|
+
mallId?: string;
|
|
96
|
+
expectedRevision?: string | number;
|
|
97
|
+
}
|
|
98
|
+
/** Compact authoritative filter projection; complete matching keys remain inside the Web runtime.
|
|
99
|
+
* Hinglish: Host ko filter/names/count milte hain; saare matching node keys bridge par nahi jaate. */
|
|
100
|
+
export interface DiscoveryState {
|
|
101
|
+
readonly mallId: string;
|
|
102
|
+
readonly revision: string | number;
|
|
103
|
+
readonly filter: Readonly<Pick<CatalogFilterInput, 'categoryCode' | 'subCategoryCode' | 'amenityId' | 'offersOnly'>>;
|
|
104
|
+
readonly memberCount: number;
|
|
105
|
+
readonly category: Readonly<{
|
|
106
|
+
code: string | number;
|
|
107
|
+
name: string;
|
|
108
|
+
image?: string | null;
|
|
109
|
+
}> | null;
|
|
110
|
+
readonly subcategory: Readonly<{
|
|
111
|
+
code: string | number;
|
|
112
|
+
name: string;
|
|
113
|
+
categoryCode: string | number;
|
|
114
|
+
}> | null;
|
|
115
|
+
/** Compact amenity context, without member keys/nodes. Optional for older custom transports.
|
|
116
|
+
* Hinglish: Sirf amenity ki details/count/floors milte hain; purane transport records bhi compatible hain. */
|
|
117
|
+
readonly amenity?: Readonly<Pick<PublicAmenityData, 'id' | 'fieldCode' | 'name' | 'image' | 'status' | 'wayfindingId' | 'memberCount' | 'availableFloors'>> | null;
|
|
118
|
+
}
|
|
119
|
+
/** Freeze only the fixed-size public projection, without expanding matching members.
|
|
120
|
+
* Hinglish: Sirf chhota public state freeze ho; member arrays ka loop ya clone nahi. */
|
|
121
|
+
export declare function freezeDiscoveryState(state: DiscoveryState): DiscoveryState;
|
|
122
|
+
//# sourceMappingURL=discovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KA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CAAA;IACT;kHAC8G;IAC9G,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CACzB,IAAI,CACF,iBAAiB,EACf,IAAI,GACJ,WAAW,GACX,MAAM,GACN,OAAO,GACP,QAAQ,GACR,cAAc,GACd,aAAa,GACb,iBAAiB,CACpB,CACF,GAAG,IAAI,CAAA;CACT;AACD;wFACwF;AACxF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,cAAc,GAAG,cAAc,CAS1E"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file discovery.ts
|
|
3
|
+
* @description Canonical selection references, discovery filter dimensions, and sort/target identifiers.
|
|
4
|
+
* Single node, multi-location group selection references, discovery filter aur sort modes ke common contracts.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Legacy delimiter forbidden inside canonical node keys and group key arrays.
|
|
8
|
+
* Purane code ka `<->` delimiter jo canonical keys me allowed nahi hai.
|
|
9
|
+
*/
|
|
10
|
+
const LEGACY_GROUP_DELIMITER = '<->';
|
|
11
|
+
function isNonEmptyKey(value) {
|
|
12
|
+
return (typeof value === 'string' && value.trim().length > 0 && !value.includes(LEGACY_GROUP_DELIMITER));
|
|
13
|
+
}
|
|
14
|
+
function isValidOptionalFloorIndex(value) {
|
|
15
|
+
return value === undefined || (typeof value === 'number' && Number.isInteger(value));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Type guard checking whether a value is a valid SingleNodeSelectionRef.
|
|
19
|
+
* Check karta hai ki value valid SingleNodeSelectionRef hai ya nahi.
|
|
20
|
+
*/
|
|
21
|
+
export function isSingleNodeSelectionRef(ref) {
|
|
22
|
+
if (!ref || typeof ref !== 'object' || Array.isArray(ref))
|
|
23
|
+
return false;
|
|
24
|
+
const candidate = ref;
|
|
25
|
+
return (candidate.kind === 'node' &&
|
|
26
|
+
isNonEmptyKey(candidate.key) &&
|
|
27
|
+
isValidOptionalFloorIndex(candidate.floorIndex));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Type guard checking whether a value is a valid GroupNodeSelectionRef with non-empty member keys.
|
|
31
|
+
* Check karta hai ki value valid GroupNodeSelectionRef hai aur usme valid memberKeys array hai.
|
|
32
|
+
*/
|
|
33
|
+
export function isGroupNodeSelectionRef(ref) {
|
|
34
|
+
if (!ref || typeof ref !== 'object' || Array.isArray(ref))
|
|
35
|
+
return false;
|
|
36
|
+
const candidate = ref;
|
|
37
|
+
if (candidate.kind !== 'group' || !isNonEmptyKey(candidate.groupId))
|
|
38
|
+
return false;
|
|
39
|
+
if (!Array.isArray(candidate.memberKeys) || candidate.memberKeys.length === 0)
|
|
40
|
+
return false;
|
|
41
|
+
if (!candidate.memberKeys.every(isNonEmptyKey))
|
|
42
|
+
return false;
|
|
43
|
+
if (candidate.representativeKey !== undefined &&
|
|
44
|
+
(!isNonEmptyKey(candidate.representativeKey) ||
|
|
45
|
+
!candidate.memberKeys.includes(candidate.representativeKey))) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
return isValidOptionalFloorIndex(candidate.floorIndex);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Type guard checking whether a value is a valid NodeSelectionRef (single node or group).
|
|
52
|
+
* Check karta hai ki value valid single ya group NodeSelectionRef hai ya nahi.
|
|
53
|
+
*/
|
|
54
|
+
export function isValidNodeSelectionRef(ref) {
|
|
55
|
+
return isSingleNodeSelectionRef(ref) || isGroupNodeSelectionRef(ref);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Returns a defensive, JSON-safe clone of a NodeSelectionRef with deduplicated group member keys.
|
|
59
|
+
* NodeSelectionRef ki fresh JSON-safe copy banata hai taaki caller mutation internal state ko affect na kare.
|
|
60
|
+
*/
|
|
61
|
+
export function cloneNodeSelectionRef(ref) {
|
|
62
|
+
if (ref.kind === 'node') {
|
|
63
|
+
return {
|
|
64
|
+
kind: 'node',
|
|
65
|
+
key: ref.key,
|
|
66
|
+
...(ref.floorIndex !== undefined ? { floorIndex: ref.floorIndex } : {}),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
const uniqueKeys = Array.from(new Set(ref.memberKeys));
|
|
70
|
+
return {
|
|
71
|
+
kind: 'group',
|
|
72
|
+
groupId: ref.groupId,
|
|
73
|
+
memberKeys: uniqueKeys,
|
|
74
|
+
...(ref.representativeKey !== undefined ? { representativeKey: ref.representativeKey } : {}),
|
|
75
|
+
...(ref.floorIndex !== undefined ? { floorIndex: ref.floorIndex } : {}),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/** Freeze only the fixed-size public projection, without expanding matching members.
|
|
79
|
+
* Hinglish: Sirf chhota public state freeze ho; member arrays ka loop ya clone nahi. */
|
|
80
|
+
export function freezeDiscoveryState(state) {
|
|
81
|
+
Object.freeze(state.filter);
|
|
82
|
+
if (state.category)
|
|
83
|
+
Object.freeze(state.category);
|
|
84
|
+
if (state.subcategory)
|
|
85
|
+
Object.freeze(state.subcategory);
|
|
86
|
+
if (state.amenity) {
|
|
87
|
+
Object.freeze(state.amenity.availableFloors);
|
|
88
|
+
Object.freeze(state.amenity);
|
|
89
|
+
}
|
|
90
|
+
return Object.freeze(state);
|
|
91
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { CatalogGroupReadOptions, PublicNodeGroupMemberSummary } from './catalog.js';
|
|
2
|
+
import type { ViewerInteractionState } from './interaction.js';
|
|
3
|
+
/** One endpoint role, shared by state, renderer adapters and explicit focus.
|
|
4
|
+
* Hinglish: Start/end ka wahi naam har adapter aur focus action mein rahe. */
|
|
5
|
+
export type EndpointRole = 'origin' | 'destination';
|
|
6
|
+
/** Compact endpoint intent; resolved group membership stays in the authoritative runtime.
|
|
7
|
+
* Hinglish: Host sirf node/group/amenity ka ref bheje; saari member keys wapas na bheje. */
|
|
8
|
+
export type EndpointReference = NonNullable<ViewerInteractionState['selection']> | {
|
|
9
|
+
readonly kind: 'amenity';
|
|
10
|
+
readonly amenityId: string | number;
|
|
11
|
+
};
|
|
12
|
+
/** Reuse the catalog identity guard instead of inventing another revision convention.
|
|
13
|
+
* Hinglish: Wahi mallId/expectedRevision use hon jo catalog commands mein hain. */
|
|
14
|
+
export type EndpointContext = Pick<CatalogGroupReadOptions, 'mallId' | 'expectedRevision'>;
|
|
15
|
+
/** Identity of the currently committed map, never a pending load.
|
|
16
|
+
* Hinglish: Ye loaded map ki identity hai; pending request ki nahi. */
|
|
17
|
+
export interface EndpointMapIdentity {
|
|
18
|
+
readonly mallId: string;
|
|
19
|
+
readonly revision: string | number;
|
|
20
|
+
}
|
|
21
|
+
/** Small public endpoint label; the representative is not a calculated nearest location.
|
|
22
|
+
* Hinglish: Label ke liye chhota summary; representative ko nearest route endpoint na maano. */
|
|
23
|
+
export interface EndpointSummary {
|
|
24
|
+
readonly reference: EndpointReference;
|
|
25
|
+
readonly name: string;
|
|
26
|
+
readonly representative: Readonly<PublicNodeGroupMemberSummary>;
|
|
27
|
+
readonly logoUrl?: string;
|
|
28
|
+
readonly memberCount: number;
|
|
29
|
+
readonly availableFloors: readonly number[];
|
|
30
|
+
}
|
|
31
|
+
/** Conflicting valid selections remain visible; route submission must wait for correction.
|
|
32
|
+
* Hinglish: Dono refs valid rehte hain; same/overlapping location par route submit nahi hoga. */
|
|
33
|
+
export type EndpointConflict = 'SAME_LOCATION' | 'OVERLAPPING_LOCATIONS' | null;
|
|
34
|
+
/** Read-only public projection, with no geometry, graph or full member arrays.
|
|
35
|
+
* Hinglish: Store/event mein chhoti public state hi aaye; raw NodePoint ya graph nahi. */
|
|
36
|
+
export interface EndpointState extends EndpointMapIdentity {
|
|
37
|
+
readonly origin: EndpointSummary | null;
|
|
38
|
+
readonly destination: EndpointSummary | null;
|
|
39
|
+
readonly conflict: EndpointConflict;
|
|
40
|
+
}
|
|
41
|
+
/** Domain operation names shared by the direct and WebView command adapters.
|
|
42
|
+
* Hinglish: Direct aur WebView dono isi contract ke methods/arguments use karte hain. */
|
|
43
|
+
export interface EndpointOperations {
|
|
44
|
+
setOrigin(reference: EndpointReference | null, context?: EndpointContext): EndpointState;
|
|
45
|
+
setDestination(reference: EndpointReference | null, context?: EndpointContext): EndpointState;
|
|
46
|
+
swapEndpoints(context?: EndpointContext): EndpointState;
|
|
47
|
+
clearEndpoints(context?: EndpointContext): EndpointState;
|
|
48
|
+
}
|
|
49
|
+
/** Canonical event name and compact payload shared by direct and WebView delivery.
|
|
50
|
+
* Hinglish: Web aur Native mein endpointsChanged ka naam/payload same rahega. */
|
|
51
|
+
export declare const EndpointEvents: {
|
|
52
|
+
readonly endpointsChanged: "endpointsChanged";
|
|
53
|
+
};
|
|
54
|
+
export interface EndpointEventPayloadMap {
|
|
55
|
+
endpointsChanged: EndpointState | null;
|
|
56
|
+
}
|
|
57
|
+
/** Own only approved intent fields; caller mutation or raw extras cannot change saved state.
|
|
58
|
+
* Hinglish: Caller ka object badalne ya extra raw field bhejne se saved ref na badle. */
|
|
59
|
+
export declare function freezeEndpointReference(reference: EndpointReference): EndpointReference;
|
|
60
|
+
/** Own the compact event projection after JSON transport; never retain arbitrary source fields.
|
|
61
|
+
* Hinglish: Native/direct event ka approved chhota state copy/freeze ho; extra raw fields nahi. */
|
|
62
|
+
export declare function freezeEndpointState(state: EndpointState, previous?: EndpointState | null): EndpointState;
|
|
63
|
+
//# sourceMappingURL=endpoints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../src/endpoints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,MAAM,WAAW,CAAA;AACtF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAG3D;8EAC8E;AAC9E,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,aAAa,CAAA;AAEnD;4FAC4F;AAC5F,MAAM,MAAM,iBAAiB,GACzB,WAAW,CAAC,sBAAsB,CAAC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,OAAO,CAAC,EAAE,eAAe,GAAG,aAAa,CAAA;IAC7F,aAAa,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,aAAa,CAAA;IACvD,cAAc,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,aAAa,CAAA;CACzD;AAED;iFACiF;AACjF,eAAO,MAAM,cAAc;;CAAoD,CAAA;AAC/E,MAAM,WAAW,uBAAuB;IACtC,gBAAgB,EAAE,aAAa,GAAG,IAAI,CAAA;CACvC;AAED;yFACyF;AACzF,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,iBAAiB,GAAG,iBAAiB,CAUvF;AAED;mGACmG;AACnG,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,aAAa,EACpB,QAAQ,CAAC,EAAE,aAAa,GAAG,IAAI,GAC9B,aAAa,CAmBf"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { copyGroupSelectionRequest } from './interactionScope.js';
|
|
2
|
+
/** Canonical event name and compact payload shared by direct and WebView delivery.
|
|
3
|
+
* Hinglish: Web aur Native mein endpointsChanged ka naam/payload same rahega. */
|
|
4
|
+
export const EndpointEvents = { endpointsChanged: 'endpointsChanged' };
|
|
5
|
+
/** Own only approved intent fields; caller mutation or raw extras cannot change saved state.
|
|
6
|
+
* Hinglish: Caller ka object badalne ya extra raw field bhejne se saved ref na badle. */
|
|
7
|
+
export function freezeEndpointReference(reference) {
|
|
8
|
+
if (reference.kind === 'group') {
|
|
9
|
+
return Object.freeze({
|
|
10
|
+
kind: 'group',
|
|
11
|
+
request: Object.freeze(copyGroupSelectionRequest(reference.request)),
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
return reference.kind === 'node'
|
|
15
|
+
? Object.freeze({ kind: 'node', key: reference.key })
|
|
16
|
+
: Object.freeze({ kind: 'amenity', amenityId: reference.amenityId });
|
|
17
|
+
}
|
|
18
|
+
/** Own the compact event projection after JSON transport; never retain arbitrary source fields.
|
|
19
|
+
* Hinglish: Native/direct event ka approved chhota state copy/freeze ho; extra raw fields nahi. */
|
|
20
|
+
export function freezeEndpointState(state, previous) {
|
|
21
|
+
const sameMap = previous?.mallId === state.mallId && previous?.revision === state.revision;
|
|
22
|
+
const origin = reuseSummary(state.origin, sameMap ? previous?.origin : null);
|
|
23
|
+
const destination = reuseSummary(state.destination, sameMap ? previous?.destination : null);
|
|
24
|
+
if (previous &&
|
|
25
|
+
sameMap &&
|
|
26
|
+
origin === previous.origin &&
|
|
27
|
+
destination === previous.destination &&
|
|
28
|
+
state.conflict === previous.conflict)
|
|
29
|
+
return previous;
|
|
30
|
+
return Object.freeze({
|
|
31
|
+
mallId: state.mallId,
|
|
32
|
+
revision: state.revision,
|
|
33
|
+
origin,
|
|
34
|
+
destination,
|
|
35
|
+
conflict: state.conflict,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
// JSON delivery changes object identity; compare only the compact allowlisted summary, never member/node arrays.
|
|
39
|
+
// Hinglish: JSON se naya object aata hai; chhota public summary same ho to role ka ref rakho, extra rerender nahi.
|
|
40
|
+
function reuseSummary(source, previous) {
|
|
41
|
+
if (!source)
|
|
42
|
+
return null;
|
|
43
|
+
const owned = freezeSummary(source);
|
|
44
|
+
return previous && JSON.stringify(previous) === JSON.stringify(owned) ? previous : owned;
|
|
45
|
+
}
|
|
46
|
+
function freezeSummary(summary) {
|
|
47
|
+
const member = summary.representative;
|
|
48
|
+
return Object.freeze({
|
|
49
|
+
reference: freezeEndpointReference(summary.reference),
|
|
50
|
+
name: summary.name,
|
|
51
|
+
representative: Object.freeze({
|
|
52
|
+
key: member.key,
|
|
53
|
+
floorIndex: member.floorIndex,
|
|
54
|
+
floorName: member.floorName,
|
|
55
|
+
type: member.type,
|
|
56
|
+
}),
|
|
57
|
+
...(summary.logoUrl !== undefined ? { logoUrl: summary.logoUrl } : {}),
|
|
58
|
+
memberCount: summary.memberCount,
|
|
59
|
+
availableFloors: Object.freeze([...summary.availableFloors]),
|
|
60
|
+
});
|
|
61
|
+
}
|
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import type { RouteEventPayloadMap } from './navigation/routeState.js';
|
|
2
|
+
import type { OfflineState } from './offline.js';
|
|
3
|
+
import { type OfflineRouteEventPayloadMap } from './navigation/savedRoute.js';
|
|
4
|
+
import { NodePoint, type PublicNodeAssets, type PublicNodeData } from './nodePoint.js';
|
|
5
|
+
import type { MapViewMode } from './depthConfig.js';
|
|
6
|
+
import type { MapTheme } from './theme.js';
|
|
7
|
+
import type { DiscoveryState } from './discovery.js';
|
|
8
|
+
import { type EndpointEventPayloadMap } from './endpoints.js';
|
|
9
|
+
import type { NodeGroupSelectionData } from './catalog.js';
|
|
10
|
+
export type { PublicNodeAssets, PublicNodeData };
|
|
11
|
+
/** Canonical events across all SDKs. Hinglish: Sab SDK isi registry ke names use karte hain. */
|
|
12
|
+
export declare const ViewerEvents: {
|
|
13
|
+
readonly routePlaybackProgress: "routePlaybackProgress";
|
|
14
|
+
readonly routeChanged: "routeChanged";
|
|
15
|
+
readonly loadStart: "loadStart";
|
|
16
|
+
readonly loaded: "loaded";
|
|
17
|
+
readonly loadCancel: "loadCancel";
|
|
18
|
+
readonly floorChange: "floorChange";
|
|
19
|
+
readonly viewModeChange: "viewModeChange";
|
|
20
|
+
readonly cameraViewChange: "cameraViewChange";
|
|
21
|
+
readonly nodeClick: "nodeClick";
|
|
22
|
+
readonly nodeSelected: "nodeSelected";
|
|
23
|
+
readonly nodeGroupSelected: "nodeGroupSelected";
|
|
24
|
+
readonly discoveryChanged: "discoveryChanged";
|
|
25
|
+
readonly catalogChanged: "catalogChanged";
|
|
26
|
+
readonly depthChange: "depthChange";
|
|
27
|
+
readonly textTypeChange: "textTypeChange";
|
|
28
|
+
readonly labelsToggled: "labelsToggled";
|
|
29
|
+
readonly themeChange: "themeChange";
|
|
30
|
+
readonly error: "error";
|
|
31
|
+
readonly destroy: "destroy";
|
|
32
|
+
readonly endpointsChanged: "endpointsChanged";
|
|
33
|
+
readonly offlineRouteChanged: "offlineRouteChanged";
|
|
34
|
+
readonly offlineChanged: "offlineChanged";
|
|
35
|
+
};
|
|
36
|
+
export interface NodeClickEvent {
|
|
37
|
+
key: string | null;
|
|
38
|
+
node: PublicNodeData | null;
|
|
39
|
+
point?: {
|
|
40
|
+
x: number;
|
|
41
|
+
y: number;
|
|
42
|
+
z: number;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export interface PublicFloorData {
|
|
46
|
+
FloorName: string;
|
|
47
|
+
FloorUrl: string;
|
|
48
|
+
ShortName: string;
|
|
49
|
+
FloorNumber: number;
|
|
50
|
+
SubFloor?: boolean;
|
|
51
|
+
index?: number;
|
|
52
|
+
id?: string;
|
|
53
|
+
}
|
|
54
|
+
export interface MapLoadedData {
|
|
55
|
+
/** True only after a validated saved package and local resources commit; not navigator.onLine.
|
|
56
|
+
* Hinglish: Actual saved-copy load ka signal hai; browser connectivity ka guess nahi. */
|
|
57
|
+
offline?: boolean;
|
|
58
|
+
mallId: string;
|
|
59
|
+
/** Existing public mall name for host headers; not a raw source record.
|
|
60
|
+
* Hinglish: Header ka naam same loaded response se mile; doosri API call nahi. */
|
|
61
|
+
mallName?: string;
|
|
62
|
+
version: string;
|
|
63
|
+
defaultFloor: number;
|
|
64
|
+
floors: PublicFloorData[];
|
|
65
|
+
nodeCount: number;
|
|
66
|
+
}
|
|
67
|
+
export interface ViewerErrorData {
|
|
68
|
+
code: string;
|
|
69
|
+
message: string;
|
|
70
|
+
details?: Record<string, unknown>;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* JSON-safe structured error metadata preserved across direct and WebView ACK boundaries.
|
|
74
|
+
* Allows Native and Web consumers to inspect `code` (e.g. `STALE_REVISION`, `MALL_MISMATCH`,
|
|
75
|
+
* `UNSUPPORTED_SORT_MODE`) and `details` identically without importing `@wovvmap/map-data`.
|
|
76
|
+
*
|
|
77
|
+
* Hinglish: Direct aur WebView ACK boundary par error ka `code`, `name` aur JSON-safe `details`
|
|
78
|
+
* preserve karne wala common contract.
|
|
79
|
+
*/
|
|
80
|
+
export interface StructuredCommandErrorData {
|
|
81
|
+
readonly name?: string;
|
|
82
|
+
readonly code?: string;
|
|
83
|
+
readonly message: string;
|
|
84
|
+
readonly details?: Record<string, unknown>;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Portable command error class preserving structured `code`, `details`, and `name` across transport boundaries.
|
|
88
|
+
*
|
|
89
|
+
* Hinglish: Transport boundary ke aar-paar `code`, `details` aur `name` preserve karne wala portable Error class.
|
|
90
|
+
*/
|
|
91
|
+
export declare class ViewerCommandError extends Error {
|
|
92
|
+
readonly code?: string;
|
|
93
|
+
readonly details?: Record<string, unknown>;
|
|
94
|
+
constructor(message: string, options?: {
|
|
95
|
+
name?: string;
|
|
96
|
+
code?: string;
|
|
97
|
+
details?: Record<string, unknown>;
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
export interface ViewerEventPayloadMap extends EndpointEventPayloadMap, RouteEventPayloadMap, OfflineRouteEventPayloadMap {
|
|
101
|
+
offlineChanged: OfflineState;
|
|
102
|
+
loadStart: string;
|
|
103
|
+
loaded: MapLoadedData;
|
|
104
|
+
loadCancel: string;
|
|
105
|
+
floorChange: number;
|
|
106
|
+
viewModeChange: MapViewMode;
|
|
107
|
+
cameraViewChange: string;
|
|
108
|
+
nodeClick: NodeClickEvent;
|
|
109
|
+
/** Map provenance lets UI handle the following nodeClick once instead of closing the old panel early.
|
|
110
|
+
* Hinglish: Map selection ke baad nodeClick flow sambhale; same click do baar process na ho. */
|
|
111
|
+
nodeSelected: {
|
|
112
|
+
key: string | null;
|
|
113
|
+
node: PublicNodeData | null;
|
|
114
|
+
source?: 'map';
|
|
115
|
+
};
|
|
116
|
+
nodeGroupSelected: {
|
|
117
|
+
selection: NodeGroupSelectionData | null;
|
|
118
|
+
};
|
|
119
|
+
discoveryChanged: DiscoveryState | null;
|
|
120
|
+
/** Offer validity changed within the same map revision; geometry and floor remain unchanged.
|
|
121
|
+
* Hinglish: Same map ke offer dates badle; geometry/floor reload ka signal nahi. */
|
|
122
|
+
catalogChanged: {
|
|
123
|
+
mallId: string;
|
|
124
|
+
revision: string | number;
|
|
125
|
+
reason: 'offers';
|
|
126
|
+
discoveryFilter: DiscoveryState | null;
|
|
127
|
+
selectedNode: PublicNodeData | null;
|
|
128
|
+
selectedNodeGroup: NodeGroupSelectionData | null;
|
|
129
|
+
};
|
|
130
|
+
depthChange: {
|
|
131
|
+
depth3D: number;
|
|
132
|
+
depth2D: number;
|
|
133
|
+
};
|
|
134
|
+
textTypeChange: '2D' | '3D';
|
|
135
|
+
labelsToggled: {
|
|
136
|
+
visible: boolean;
|
|
137
|
+
};
|
|
138
|
+
themeChange: MapTheme;
|
|
139
|
+
error: ViewerErrorData;
|
|
140
|
+
destroy: null;
|
|
141
|
+
}
|
|
142
|
+
export type ViewerEventName = keyof ViewerEventPayloadMap;
|
|
143
|
+
export type ViewerEventMap = {
|
|
144
|
+
[K in ViewerEventName]: (data: ViewerEventPayloadMap[K]) => void;
|
|
145
|
+
};
|
|
146
|
+
/** Nullable delegation wrapper to canonical NodePoint public projection without hydrating geometry or graph.
|
|
147
|
+
* Hinglish: Nullable wrapper jo bina geometry/graph clone kiye canonical public projection ko delegate karta hai. */
|
|
148
|
+
export declare function toPublicNodeData(node: NodePoint | Partial<NodePoint> | null | undefined): PublicNodeData | null;
|
|
149
|
+
/** Project once at the viewer boundary. Hinglish: Har SDK me click mapping dobara nahi hoti. */
|
|
150
|
+
export declare function toNodeClickEvent(event: {
|
|
151
|
+
key: string | null;
|
|
152
|
+
node: NodePoint | null;
|
|
153
|
+
point?: {
|
|
154
|
+
x: number;
|
|
155
|
+
y: number;
|
|
156
|
+
z: number;
|
|
157
|
+
};
|
|
158
|
+
}, publicNode?: PublicNodeData | null): NodeClickEvent;
|
|
159
|
+
/** Loaded callbacks expose floors/count, not parser indexes or geometry.
|
|
160
|
+
* Hinglish: Loaded callback me floor metadata milti hai, internal indexer nahi. */
|
|
161
|
+
export declare function toMapLoadedData(map: {
|
|
162
|
+
mallId: string;
|
|
163
|
+
mallName?: string;
|
|
164
|
+
version: string;
|
|
165
|
+
defaultFloor?: number;
|
|
166
|
+
floors: readonly PublicFloorData[];
|
|
167
|
+
nodes: readonly unknown[];
|
|
168
|
+
}): MapLoadedData;
|
|
169
|
+
export declare function toViewerError(error: unknown, code?: string): ViewerErrorData;
|
|
170
|
+
/**
|
|
171
|
+
* Extracts JSON-safe structured error metadata (`name`, `code`, `message`, `details`) from an unknown error
|
|
172
|
+
* for transport across WebView ACK envelopes.
|
|
173
|
+
*
|
|
174
|
+
* Hinglish: Kisi bhi error se JSON-safe `name`, `code`, `message` aur `details` extract karta hai
|
|
175
|
+
* taaki WebView ACK ke zariye Native host tak safe bheja ja sake.
|
|
176
|
+
*/
|
|
177
|
+
export declare function serializeCommandError(error: unknown): StructuredCommandErrorData;
|
|
178
|
+
/**
|
|
179
|
+
* Reconstructs a `ViewerCommandError` on the host side from serialized ACK error fields,
|
|
180
|
+
* optionally marking it as a suppressed command error when an error event was already emitted.
|
|
181
|
+
*
|
|
182
|
+
* Hinglish: Serialized ACK error fields se host side par `ViewerCommandError` reconstruct karta hai
|
|
183
|
+
* (`code`, `details` aur duplicate-error suppression preserve karte hue).
|
|
184
|
+
*/
|
|
185
|
+
export declare function reconstructCommandError(structured: StructuredCommandErrorData, suppressDuplicateReport?: boolean): ViewerCommandError;
|
|
186
|
+
/** Identify normal load cancellation/abort so loading state settles without emitting a domain error.
|
|
187
|
+
* Hinglish: Normal abort/cancel ko identify karein taaki bina error callback ke loading state false settle ho. */
|
|
188
|
+
export declare function isLoadCancelledError(error: unknown): boolean;
|
|
189
|
+
/** Marks a transport/lifecycle rejection whose error event was already emitted or whose session was intentionally reset/disposed.
|
|
190
|
+
* Hinglish: Jis command error ka event pehle hi emit ho chuka hai ya jo normal teardown/reset hai, use mark karein. */
|
|
191
|
+
export declare function markSuppressedCommandError<T extends Error>(error: T): T;
|
|
192
|
+
/** Returns true when a command rejection is a normal load cancellation, lifecycle teardown, or an error already emitted by the SDK.
|
|
193
|
+
* Hinglish: Check karta hai ki command rejection normal cancel/teardown hai ya SDK error event pehle hi emit ho chuka hai. */
|
|
194
|
+
export declare function isSuppressedCommandError(error: unknown): boolean;
|
|
195
|
+
/** Converts an unhandled command rejection into a public ViewerErrorData, or null if already reported/cancelled.
|
|
196
|
+
* Hinglish: Real command failure ko ViewerErrorData me convert karta hai; already-reported ya cancelled error ke liye null deta hai. */
|
|
197
|
+
export declare function toViewerCommandError(error: unknown, defaultCode?: string): ViewerErrorData | null;
|
|
198
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAsB,KAAK,2BAA2B,EAAE,MAAM,yBAAyB,CAAA;AAC9F,OAAO,EACL,SAAS,EAET,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACpB,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAkB,KAAK,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAC1E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA;AAEvD,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,CAAA;AAEhD,gGAAgG;AAChG,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;CAuBf,CAAA;AAEV,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,M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