becomap 1.5.5 → 1.5.8

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/lib/index.d.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  // Generated by dts-bundle-generator v9.5.1
2
2
 
3
+ export interface BCMapLanguage {
4
+ name: string;
5
+ code: string;
6
+ }
3
7
  /**
4
8
  * Represents a coordinate:
5
9
  * - A tuple containing latitude and longitude as [latitude, longitude]
@@ -59,6 +63,11 @@ export interface BCMapFloor {
59
63
  * @returns {string} - The name of the map.
60
64
  */
61
65
  get name(): string;
66
+ /**
67
+ * defauilt view port for the floor.
68
+ * @returns {BCMapViewOptions} - The viewPort of the map.
69
+ */
70
+ get viewPort(): BCMapViewOptions;
62
71
  /**
63
72
  * Elevation value.
64
73
  * @returns {number} - The elevation of floor on the map.
@@ -190,6 +199,12 @@ export interface BCMapSite {
190
199
  * @returns The map as BCMapFloor.
191
200
  */
192
201
  getDefaultMap(): BCMapFloor;
202
+ /**
203
+ * list of language options available for the site.
204
+ *
205
+ * @returns The site languages as BCMapLanguage[].
206
+ */
207
+ get otherLanguages(): BCMapLanguage[];
193
208
  }
194
209
  export interface BCColor {
195
210
  rgba: string;
@@ -225,7 +240,10 @@ declare enum BCLocationType {
225
240
  SHUTTLE = "SHUTTLE",
226
241
  /** Represents a kiosk, such as an information booth or ticket counter. */
227
242
  KIOSK = "KIOSK",
228
- MAP_OBJECT = "MAP_OBJECT"
243
+ /** Represents a 3D Object in map. */
244
+ MAP_OBJECT = "MAP_OBJECT",
245
+ /** Represents a Floor connection, like Lift, Escalator, Ramp etc. */
246
+ CONNECTION = "CONNECTION"
229
247
  }
230
248
  /**
231
249
  * Enum representing various amenities available at a site.
@@ -283,6 +301,8 @@ export declare enum BCSiteAmenity {
283
301
  HELP_DESK = "HELP_DESK",
284
302
  /** Billing or payment counter */
285
303
  BILLING_COUNTER = "BILLING_COUNTER",
304
+ /** Vending mechine facilities */
305
+ VENDING_MACHINE = "VENDING_MACHINE",
286
306
  /** Points that can connect Floors */
287
307
  ESCALATOR = "ESCALATOR",
288
308
  ELEVATOR = "ELEVATOR",
@@ -377,6 +397,12 @@ export interface BCLocation {
377
397
  */
378
398
  get amenity(): BCSiteAmenity;
379
399
  /**
400
+ * The area of the location.
401
+ *
402
+ * @returns The area of the location as a string.
403
+ */
404
+ get area(): string | null;
405
+ /**
380
406
  * Stores phone numbers associated with the location, where the key represents the type of phone number.
381
407
  *
382
408
  * @returns A record of phone numbers keyed by type (e.g., {"main": "123-456-7890"}).
@@ -608,6 +634,11 @@ export interface BCRouteController {
608
634
  * this.showStep(routeStep);
609
635
  */
610
636
  showStep(step: BCRouteStep): void;
637
+ /**
638
+ * Shows the route step by its orderIndex.
639
+ * @param orderIndex - The order index of the step to display.
640
+ */
641
+ showStepByOrderIndex(orderIndex: number): void;
611
642
  /**
612
643
  * Clears the current route from the map by removing the route layer or data from the map view.
613
644
  * It relies on the routeController to manage route layers or data.
@@ -629,6 +660,16 @@ export interface BCRouteOptions {
629
660
  * @returns An array of BCRouteSegment objects representing each segment of the route, or `null` if a route cannot be generated.
630
661
  */
631
662
  export declare function getRoute(start: BCRoutable, goal: BCRoutable, waypoints?: BCRoutable[], routeOptions?: BCRouteOptions): BCRouteSegment[] | null;
663
+ /**
664
+ * Retrieves the route using location IDs for start, goal, and waypoints.
665
+ *
666
+ * @param startId - The starting location's ID.
667
+ * @param goalId - The goal location's ID.
668
+ * @param waypointIds - Optional array of waypoint location IDs.
669
+ * @param routeOptions - Optional routing options.
670
+ * @returns An array of BCRouteSegment objects or null if not found.
671
+ */
672
+ export declare function getRouteById(startId: string, goalId: string, waypointIds?: string[], routeOptions?: BCRouteOptions): BCRouteSegment[] | null;
632
673
  /**
633
674
  * Defines the events supported by the BCMapView and their corresponding arguments.
634
675
  */
@@ -779,52 +820,15 @@ export interface BCHappenings {
779
820
  */
780
821
  customFields: Record<string, any>;
781
822
  }
782
- declare enum BCQuestionType {
783
- /** Represents a multiple-choice question with a single answer. */
784
- MCQ_SINGLE_ANSWER = "MCQ_SINGLE_ANSWER",
785
- /** Represents an open-ended text response. */
786
- TEXT = "TEXT",
787
- /** Represents a numerical response. */
788
- NUMBER = "NUMBER",
789
- /** Represents a boolean (true/false) response. */
790
- BOOLEAN = "BOOLEAN"
791
- }
792
- /**
793
- * Interface representing a single survey question.
794
- */
795
- export interface BCQuestion {
796
- /**
797
- * Unique identifier for the question.
798
- */
799
- id: string;
800
- /**
801
- * The text of the question.
802
- */
803
- question: string;
804
- /**
805
- * The type of the question, as defined in BCQuestionType.
806
- */
807
- type: BCQuestionType;
808
- /**
809
- * The list of possible options for multiple-choice questions.
810
- * Should be empty or undefined for non-MCQ question types.
811
- */
812
- options?: string[];
813
- }
814
823
  /**
815
- * Interface representing an answer to a survey question.
824
+ * Constructs a new MapView instance.
825
+ *
826
+ * @param container - The HTML element that will contain the map.
827
+ * @param site - The BCMapSite object that provides context and data for the map.
828
+ * @param options - Optional configuration settings for the initial map view.
829
+ * @param language - Optional configuration for settings the language.
816
830
  */
817
- export interface BCAnswer {
818
- /**
819
- * Unique identifier for the question being answered.
820
- */
821
- questionId: string;
822
- /**
823
- * The answers provided by the user.
824
- * This can be a list to accommodate multiple responses for certain question types.
825
- */
826
- answers: string[];
827
- }
831
+ export declare function getMapView(container: HTMLElement, site: BCMapSite, options?: BCMapViewOptions, language?: BCMapLanguage): Promise<BCMapView>;
828
832
  /**
829
833
  * Options for configuring the initial view of the map.
830
834
  *
@@ -858,194 +862,156 @@ export interface BCMapViewOptions {
858
862
  * Default bearing can be defined in the implementation.
859
863
  */
860
864
  bearing?: number;
865
+ /**
866
+ * Whether to hide layers outside the defined map boundaries.
867
+ * If set to `true`, layers outside the map's visible area will
868
+ * be hidden. This can improve performance and focus on the
869
+ * relevant map content.
870
+ */
871
+ hideOutsideLayers?: boolean;
872
+ /**
873
+ * The background color of the map container.
874
+ * This property allows setting a custom background color for
875
+ * the map container, which is visible when no map tiles are
876
+ * rendered or when the map is loading.
877
+ */
878
+ background?: string;
879
+ /**
880
+ * Optional bounds for the map view, as [minLng, minLat, maxLng, maxLat].
881
+ * minLng: southwest longitude, minLat: southwest latitude,
882
+ * maxLng: northeast longitude, maxLat: northeast latitude
883
+ */
884
+ bounds?: [
885
+ number,
886
+ number,
887
+ number,
888
+ number
889
+ ];
861
890
  }
862
891
  /**
863
- * Class representing a map view, providing methods to manipulate and interact
864
- * with the map interface.
892
+ * Interface representing the public API of the BCMapView class.
893
+ * This interface defines all the public methods and properties
894
+ * available for interacting with the map view.
865
895
  */
866
- export declare class BCMapView {
867
- #private;
868
- readonly mapSite: BCMapSite;
869
- readonly eventsHandler: BCEventEmitter<BCMapViewEvents>;
870
- get currentFloor(): BCMapFloor;
896
+ export interface BCMapView {
871
897
  /**
872
- * Constructs a new MapView instance.
873
- *
874
- * @param container - The HTML element that will contain the map.
875
- * @param site - The BCMapSite object that provides context and data for the map.
876
- * @param options - Optional configuration settings for the initial map view.
898
+ * The site associated with the map view.
877
899
  */
878
- constructor(container: HTMLElement, site: BCMapSite, options?: BCMapViewOptions);
900
+ readonly mapSite: BCMapSite;
879
901
  /**
880
- * Gets the HTML element that contains the map.
881
- *
882
- * @returns The HTMLElement representing the map container.
902
+ * The currently selected floor in the map view.
883
903
  */
884
- get container(): HTMLElement;
904
+ readonly currentFloor: BCMapFloor;
885
905
  /**
886
- * Provides access to the route controller, which manages routing operations
887
- * within the map view, such as route rendering.
888
- * @returns An instance of BCRouteController for managing route operations.
906
+ * Event handler for managing map-related events.
889
907
  */
908
+ readonly eventsHandler: BCEventEmitter<BCMapViewEvents>;
909
+ /**
910
+ * Provides access to the route controller, which manages routing operations
911
+ * within the map view, such as route rendering.
912
+ * @returns An instance of BCRouteController for managing route operations.
913
+ */
890
914
  get routeController(): BCRouteController;
891
915
  /**
892
- * Focuses the map on a specified location, optionally adjusting
893
- * the zoom level, bearing, and pitch.
894
- *
895
- * @param location - The location as BCLocation to focus on.
896
- * @param zoomLevel - Optional zoom level to apply when focusing on
897
- * the point. Defaults to the current zoom level if not specified.
898
- * @param bearing - Optional bearing to apply when focusing on the
899
- * point. Defaults to the current bearing if not specified.
900
- * @param pitch - Optional pitch to apply when focusing on the point.
901
- * Defaults to the current pitch if not specified.
916
+ * Focuses the map on a specific location.
917
+ * @param location - The location to focus on.
918
+ * @param zoomLevel - Optional zoom level for the map.
919
+ * @param bearing - Optional bearing (rotation) for the map.
920
+ * @param pitch - Optional pitch (tilt) for the map.
902
921
  */
903
922
  focusTo(location: BCLocation, zoomLevel?: number, bearing?: number | null, pitch?: number | null): void;
904
923
  /**
905
- * Updates the zoom level of the map view.
906
- * If the provided zoom level is invalid (not a number or out of range), retains the current zoom level.
907
- *
908
- * @param {number} zoomLevel - The desired zoom level. Must be within the map's minZoom and maxZoom range.
924
+ * Updates the zoom level of the map.
925
+ * @param zoomLevel - The desired zoom level.
909
926
  */
910
927
  updateZoom(zoomLevel: number): void;
911
928
  /**
912
- * Updates the pitch (tilt angle) of the map view.
913
- * If the provided pitch is invalid (not a number or out of range), retains the current pitch.
914
- *
915
- * @param {number} pitch - The desired pitch angle in degrees. Must be between 0 and 60.
916
- * Values outside this range will be clamped.
929
+ * Updates the pitch (tilt angle) of the map.
930
+ * @param pitch - The desired pitch angle in degrees.
917
931
  */
918
932
  updatePitch(pitch: number): void;
919
933
  /**
920
- * Updates the bearing (rotation angle) of the map view.
921
- * If the provided bearing is invalid (not a number), retains the current bearing.
922
- *
923
- * @param {number} bearing - The desired bearing angle in degrees.
924
- * The value is normalized to a range of 0 to 360 degrees.
934
+ * Updates the bearing (rotation angle) of the map.
935
+ * @param bearing - The desired bearing angle in degrees.
925
936
  */
926
937
  updateBearing(bearing: number): void;
927
938
  /**
928
939
  * Selects and displays the specified floor on the map.
929
- *
930
- * @param floor - The BCMapFloor object representing the floor to be selected.
931
- *
932
- * Preconditions:
933
- * - The `floor` parameter must be a valid BCMapFloor instance.
934
- *
935
- * Example:
936
- * selectFloor(groundFloorMap);
940
+ * @param floor - The floor to be selected.
937
941
  */
938
942
  selectFloor(floor: BCMapFloor): void;
943
+ selectFloorWithId(floorId: string): void;
944
+ /**
945
+ * Retrieves the currently selected floor.
946
+ * @returns The currently selected floor.
947
+ */
939
948
  get floor(): BCMapFloor;
940
949
  /**
941
950
  * Retrieves all available categories.
942
- * @returns An array of `BCCategory` objects representing all stored categories.
951
+ * @returns An array of categories.
943
952
  */
944
953
  getCategories(): BCCategory[];
945
954
  /**
946
955
  * Retrieves all available locations.
947
- * @returns An array of `BCLocation` objects representing all stored locations.
956
+ * @returns An array of locations.
948
957
  */
949
958
  getLocations(): BCLocation[];
959
+ /**
960
+ * Retrieves all amenity locations.
961
+ * @returns An array of amenity locations.
962
+ */
950
963
  getAllAminityLocations(): BCLocation[];
951
964
  /**
952
- * Searches for locations that match the provided search string.
953
- *
954
- * @param searchString - The string input used to match against location names or tags.
955
- * @param callback - A function to execute once the matching process is complete,
956
- * receiving an array of matched `BCLocation` objects.
965
+ * Searches for locations matching the provided search string.
966
+ * @param searchString - The string to search for.
967
+ * @param callback - A callback function to handle the search results.
957
968
  */
958
969
  searchForLocations(searchString: string, callback: (matches: BCLocation[]) => void): void;
959
970
  /**
960
- * Searches for categories that match the provided search string.
961
- *
962
- * @param searchString - The string input used to match against location names or tags.
963
- * @param callback - A function to execute once the matching process is complete,
964
- * receiving an array of matched `BCCategory` objects.
971
+ * Searches for categories matching the provided search string.
972
+ * @param searchString - The string to search for.
973
+ * @param callback - A callback function to handle the search results.
965
974
  */
966
975
  searchForCategories(searchString: string, callback: (matches: BCCategory[]) => void): void;
967
976
  /**
968
- * Selects the specified location on the map.
969
- *
970
- * @param location - The BCLocation object representing the POI to be selected.
971
- *
972
- * Preconditions:
973
- * - The `floor` parameter must be a valid BCLocation instance.
974
- *
975
- * Example:
976
- * selectLocation(location);
977
+ * Selects a specific location on the map.
978
+ * @param location - The location to select.
977
979
  */
978
980
  selectLocation(location: BCLocation): void;
981
+ selectLocationWithId(locationId: string): void;
979
982
  /**
980
- * Retrieves all available happenings.
981
- * @returns An array of `BCHappenings` objects.
983
+ * Retrieves all available happenings of a specific type.
984
+ * @param type - The type of happenings to retrieve.
985
+ * @returns An array of happenings.
982
986
  */
983
987
  getHappenings(type: BCHappeningType): BCHappenings[];
984
- /**
985
- * Retrieves the session ID.
986
- * @returns A promise that resolves to a string session ID.
987
- */
988
- getSessionId(): Promise<string>;
989
- /**
990
- * Retrieves the suggestions based on user answers.
991
- * @returns A promise that returns a list of event IDs.
992
- */
993
- getEventSuggestions(sessionId: string, answers: BCAnswer[]): Promise<string[]>;
994
- /**
995
- * Retrieves all available questions.
996
- * @returns An array of `BCQuestion` objects.
997
- */
998
- getQuestions(): BCQuestion[];
999
988
  /**
1000
989
  * Retrieves all available amenities.
1001
- * @returns An array of `BCSiteAmenity` objects representing all map amenities.
990
+ * @returns An array of amenities.
1002
991
  */
1003
992
  getAmenities(): BCSiteAmenity[];
1004
993
  /**
1005
- * Selects the specified amenities on the map.
1006
- *
1007
- * @param amenityType - The BCSiteAmenity representing type of POI to be selected.
1008
- *
1009
- * Example:
1010
- * selectAmenities(BCSiteAmenity.RESTROOM);
994
+ * Selects a specific amenity type on the map.
995
+ * @param amenityType - The type of amenity to select.
1011
996
  */
1012
997
  selectAmenities(amenityType: BCSiteAmenity): void;
1013
998
  /**
1014
999
  * Enables or disables multi-selection mode for locations.
1015
- *
1016
- * When multi-selection is enabled, multiple locations can be selected at the same time.
1017
- * When disabled, only the most recently selected location is kept in the selection.
1018
- *
1019
- * @param {boolean} [enable=true] - Whether to enable or disable multi-selection.
1020
- * Defaults to `true` (enable).
1000
+ * @param enable - Whether to enable or disable multi-selection.
1021
1001
  */
1022
1002
  enableMultiSelection(enable?: boolean): void;
1023
1003
  /**
1024
- * Clears any current selections in the map or application.
1025
- * This method resets the selection state, removing highlights
1026
- * or selected features and ensuring a clean slate for new selections.
1004
+ * Clears all current selections on the map.
1027
1005
  */
1028
1006
  clearSelection(): void;
1029
1007
  /**
1030
- * @hidden
1031
- * @internal
1032
- * Retrieves the step node.
1033
- */
1034
- setBounds(sw: [
1035
- number,
1036
- number
1037
- ], ne: [
1038
- number,
1039
- number
1040
- ]): void;
1041
- /**
1042
- * Reset Default Viewport with the provided options.
1043
- * @param newOptions Partial BCMapViewOptions to update the viewport.
1008
+ * Resets the default viewport with the provided options.
1009
+ * @param newOptions - Partial options to update the viewport.
1044
1010
  */
1045
1011
  resetDefaultViewport(newOptions?: Partial<BCMapViewOptions>): void;
1046
1012
  /**
1047
- * Sets the viewport with the provided options without changing the defaulf values.
1048
- * @param newOptions Partial BCMapViewOptions to update the viewport.
1013
+ * Sets the viewport with the provided options without changing the default values.
1014
+ * @param newOptions - Partial options to update the viewport.
1049
1015
  */
1050
1016
  setViewport(newOptions: Partial<BCMapViewOptions>): void;
1051
1017
  }
package/package.json CHANGED
@@ -1,70 +1,71 @@
1
- {
2
- "name": "becomap",
3
- "version": "1.5.5",
4
- "description": "we lib to display becomap",
5
- "main": "lib/becomap.js",
6
- "module": "lib/becomap.js",
7
- "types": "lib/index.d.ts",
8
- "scripts": {
9
- "test": "jest --config jestconfig.json",
10
- "start": "npm run build && npm run serve && npm run watch",
11
- "serve": "node scripts/serve.js",
12
- "build": "cross-env APP_ENV=production node scripts/build.js",
13
- "watch": "webpack --watch",
14
- "format": "prettier --write \"src/**/*.ts\"",
15
- "lint": "tslint -p tsconfig.json",
16
- "proto": "./scripts/generate-proto.sh",
17
- "readproto": "cd ./proto/sample && tsc readbin.ts && node ./readbin.js && cd .. && cd .."
18
- },
19
- "keywords": [],
20
- "author": "",
21
- "license": "ISC",
22
- "devDependencies": {
23
- "@babel/core": "^7.24.7",
24
- "@babel/preset-env": "^7.24.7",
25
- "@babel/preset-typescript": "^7.24.7",
26
- "@types/jest": "^29.5.12",
27
- "@types/node": "^20.14.5",
28
- "@types/rbush": "^4.0.0",
29
- "@types/three": "^0.172.0",
30
- "@types/webpack": "^5.28.5",
31
- "babel-loader": "^9.1.3",
32
- "cross-env": "^7.0.3",
33
- "css-loader": "^7.1.2",
34
- "dotenv": "^16.4.5",
35
- "dotenv-webpack": "^8.1.0",
36
- "dts-bundle-generator": "^9.5.1",
37
- "fs-extra": "^11.2.0",
38
- "install": "^0.13.0",
39
- "javascript-obfuscator": "^4.1.1",
40
- "jest": "^29.7.0",
41
- "npm": "^10.8.1",
42
- "prettier": "^3.3.2",
43
- "rimraf": "^6.0.1",
44
- "style-loader": "^4.0.0",
45
- "terser-webpack-plugin": "^5.3.10",
46
- "ts-jest": "^29.1.5",
47
- "ts-loader": "^9.5.1",
48
- "ts-proto": "^2.2.3",
49
- "tslint": "^6.1.3",
50
- "tslint-config-prettier": "^1.18.0",
51
- "typescript": "^5.5.3",
52
- "webpack": "^5.92.1",
53
- "webpack-cli": "^5.1.4",
54
- "webpack-dev-server": "^5.0.4",
55
- "webpack-obfuscator": "^3.5.1"
56
- },
57
- "dependencies": {
58
- "@turf/turf": "^7.1.0",
59
- "@types/polylabel": "^1.1.3",
60
- "axios": "^1.7.5",
61
- "maplibre-gl": "^4.4.1",
62
- "polished": "^4.3.1",
63
- "polylabel": "^2.0.1",
64
- "protobufjs": "^7.4.0",
65
- "rbush": "^4.0.1",
66
- "three": "^0.172.0",
67
- "troika-three-text": "^0.52.3",
68
- "word-wrap": "^1.2.5"
69
- }
1
+ {
2
+ "name": "becomap",
3
+ "version": "1.5.8",
4
+ "description": "we lib to display becomap",
5
+ "main": "lib/becomap.js",
6
+ "module": "lib/becomap.js",
7
+ "types": "lib/index.d.ts",
8
+ "scripts": {
9
+ "test": "jest --config jestconfig.json",
10
+ "start": "npm run build && npm run serve && npm run watch",
11
+ "serve": "node scripts/serve.js",
12
+ "build": "cross-env APP_ENV=production node scripts/build.js",
13
+ "watch": "webpack --watch",
14
+ "format": "prettier --write \"src/**/*.ts\"",
15
+ "lint": "tslint -p tsconfig.json",
16
+ "proto": "./scripts/generate-proto.sh",
17
+ "readproto": "cd ./proto/sample && tsc readbin.ts && node ./readbin.js && cd .. && cd .."
18
+ },
19
+ "keywords": [],
20
+ "author": "",
21
+ "license": "ISC",
22
+ "devDependencies": {
23
+ "@babel/core": "^7.24.7",
24
+ "@babel/preset-env": "^7.24.7",
25
+ "@babel/preset-typescript": "^7.24.7",
26
+ "@types/jest": "^29.5.12",
27
+ "@types/node": "^20.14.5",
28
+ "@types/rbush": "^4.0.0",
29
+ "@types/three": "^0.172.0",
30
+ "@types/webpack": "^5.28.5",
31
+ "babel-loader": "^9.1.3",
32
+ "cross-env": "^7.0.3",
33
+ "css-loader": "^7.1.2",
34
+ "dotenv": "^16.4.5",
35
+ "dotenv-webpack": "^8.1.0",
36
+ "dts-bundle-generator": "^9.5.1",
37
+ "fs-extra": "^11.2.0",
38
+ "install": "^0.13.0",
39
+ "javascript-obfuscator": "^4.1.1",
40
+ "jest": "^29.7.0",
41
+ "npm": "^10.8.1",
42
+ "prettier": "^3.3.2",
43
+ "rimraf": "^6.0.1",
44
+ "style-loader": "^4.0.0",
45
+ "terser-webpack-plugin": "^5.3.10",
46
+ "ts-jest": "^29.1.5",
47
+ "ts-loader": "^9.5.1",
48
+ "ts-proto": "^2.2.3",
49
+ "tslint": "^6.1.3",
50
+ "tslint-config-prettier": "^1.18.0",
51
+ "typescript": "^5.5.3",
52
+ "webpack": "^5.92.1",
53
+ "webpack-cli": "^5.1.4",
54
+ "webpack-dev-server": "^5.0.4",
55
+ "webpack-obfuscator": "^3.5.1"
56
+ },
57
+ "dependencies": {
58
+ "@turf/turf": "^7.1.0",
59
+ "@types/polylabel": "^1.1.3",
60
+ "axios": "^1.7.5",
61
+ "html-webpack-plugin": "^5.6.3",
62
+ "maplibre-gl": "^4.4.1",
63
+ "polished": "^4.3.1",
64
+ "polylabel": "^2.0.1",
65
+ "protobufjs": "^7.4.0",
66
+ "rbush": "^4.0.1",
67
+ "three": "^0.172.0",
68
+ "troika-three-text": "^0.52.3",
69
+ "word-wrap": "^1.2.5"
70
+ }
70
71
  }