becomap 1.5.6 → 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.
@@ -379,6 +397,12 @@ export interface BCLocation {
379
397
  */
380
398
  get amenity(): BCSiteAmenity;
381
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
+ /**
382
406
  * Stores phone numbers associated with the location, where the key represents the type of phone number.
383
407
  *
384
408
  * @returns A record of phone numbers keyed by type (e.g., {"main": "123-456-7890"}).
@@ -610,6 +634,11 @@ export interface BCRouteController {
610
634
  * this.showStep(routeStep);
611
635
  */
612
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;
613
642
  /**
614
643
  * Clears the current route from the map by removing the route layer or data from the map view.
615
644
  * It relies on the routeController to manage route layers or data.
@@ -631,6 +660,16 @@ export interface BCRouteOptions {
631
660
  * @returns An array of BCRouteSegment objects representing each segment of the route, or `null` if a route cannot be generated.
632
661
  */
633
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;
634
673
  /**
635
674
  * Defines the events supported by the BCMapView and their corresponding arguments.
636
675
  */
@@ -781,52 +820,15 @@ export interface BCHappenings {
781
820
  */
782
821
  customFields: Record<string, any>;
783
822
  }
784
- declare enum BCQuestionType {
785
- /** Represents a multiple-choice question with a single answer. */
786
- MCQ_SINGLE_ANSWER = "MCQ_SINGLE_ANSWER",
787
- /** Represents an open-ended text response. */
788
- TEXT = "TEXT",
789
- /** Represents a numerical response. */
790
- NUMBER = "NUMBER",
791
- /** Represents a boolean (true/false) response. */
792
- BOOLEAN = "BOOLEAN"
793
- }
794
- /**
795
- * Interface representing a single survey question.
796
- */
797
- export interface BCQuestion {
798
- /**
799
- * Unique identifier for the question.
800
- */
801
- id: string;
802
- /**
803
- * The text of the question.
804
- */
805
- question: string;
806
- /**
807
- * The type of the question, as defined in BCQuestionType.
808
- */
809
- type: BCQuestionType;
810
- /**
811
- * The list of possible options for multiple-choice questions.
812
- * Should be empty or undefined for non-MCQ question types.
813
- */
814
- options?: string[];
815
- }
816
823
  /**
817
- * 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.
818
830
  */
819
- export interface BCAnswer {
820
- /**
821
- * Unique identifier for the question being answered.
822
- */
823
- questionId: string;
824
- /**
825
- * The answers provided by the user.
826
- * This can be a list to accommodate multiple responses for certain question types.
827
- */
828
- answers: string[];
829
- }
831
+ export declare function getMapView(container: HTMLElement, site: BCMapSite, options?: BCMapViewOptions, language?: BCMapLanguage): Promise<BCMapView>;
830
832
  /**
831
833
  * Options for configuring the initial view of the map.
832
834
  *
@@ -860,194 +862,156 @@ export interface BCMapViewOptions {
860
862
  * Default bearing can be defined in the implementation.
861
863
  */
862
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
+ ];
863
890
  }
864
891
  /**
865
- * Class representing a map view, providing methods to manipulate and interact
866
- * 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.
867
895
  */
868
- export declare class BCMapView {
869
- #private;
870
- readonly mapSite: BCMapSite;
871
- readonly eventsHandler: BCEventEmitter<BCMapViewEvents>;
872
- get currentFloor(): BCMapFloor;
896
+ export interface BCMapView {
873
897
  /**
874
- * Constructs a new MapView instance.
875
- *
876
- * @param container - The HTML element that will contain the map.
877
- * @param site - The BCMapSite object that provides context and data for the map.
878
- * @param options - Optional configuration settings for the initial map view.
898
+ * The site associated with the map view.
879
899
  */
880
- constructor(container: HTMLElement, site: BCMapSite, options?: BCMapViewOptions);
900
+ readonly mapSite: BCMapSite;
881
901
  /**
882
- * Gets the HTML element that contains the map.
883
- *
884
- * @returns The HTMLElement representing the map container.
902
+ * The currently selected floor in the map view.
885
903
  */
886
- get container(): HTMLElement;
904
+ readonly currentFloor: BCMapFloor;
887
905
  /**
888
- * Provides access to the route controller, which manages routing operations
889
- * within the map view, such as route rendering.
890
- * @returns An instance of BCRouteController for managing route operations.
906
+ * Event handler for managing map-related events.
891
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
+ */
892
914
  get routeController(): BCRouteController;
893
915
  /**
894
- * Focuses the map on a specified location, optionally adjusting
895
- * the zoom level, bearing, and pitch.
896
- *
897
- * @param location - The location as BCLocation to focus on.
898
- * @param zoomLevel - Optional zoom level to apply when focusing on
899
- * the point. Defaults to the current zoom level if not specified.
900
- * @param bearing - Optional bearing to apply when focusing on the
901
- * point. Defaults to the current bearing if not specified.
902
- * @param pitch - Optional pitch to apply when focusing on the point.
903
- * 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.
904
921
  */
905
922
  focusTo(location: BCLocation, zoomLevel?: number, bearing?: number | null, pitch?: number | null): void;
906
923
  /**
907
- * Updates the zoom level of the map view.
908
- * If the provided zoom level is invalid (not a number or out of range), retains the current zoom level.
909
- *
910
- * @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.
911
926
  */
912
927
  updateZoom(zoomLevel: number): void;
913
928
  /**
914
- * Updates the pitch (tilt angle) of the map view.
915
- * If the provided pitch is invalid (not a number or out of range), retains the current pitch.
916
- *
917
- * @param {number} pitch - The desired pitch angle in degrees. Must be between 0 and 60.
918
- * 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.
919
931
  */
920
932
  updatePitch(pitch: number): void;
921
933
  /**
922
- * Updates the bearing (rotation angle) of the map view.
923
- * If the provided bearing is invalid (not a number), retains the current bearing.
924
- *
925
- * @param {number} bearing - The desired bearing angle in degrees.
926
- * 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.
927
936
  */
928
937
  updateBearing(bearing: number): void;
929
938
  /**
930
939
  * Selects and displays the specified floor on the map.
931
- *
932
- * @param floor - The BCMapFloor object representing the floor to be selected.
933
- *
934
- * Preconditions:
935
- * - The `floor` parameter must be a valid BCMapFloor instance.
936
- *
937
- * Example:
938
- * selectFloor(groundFloorMap);
940
+ * @param floor - The floor to be selected.
939
941
  */
940
942
  selectFloor(floor: BCMapFloor): void;
943
+ selectFloorWithId(floorId: string): void;
944
+ /**
945
+ * Retrieves the currently selected floor.
946
+ * @returns The currently selected floor.
947
+ */
941
948
  get floor(): BCMapFloor;
942
949
  /**
943
950
  * Retrieves all available categories.
944
- * @returns An array of `BCCategory` objects representing all stored categories.
951
+ * @returns An array of categories.
945
952
  */
946
953
  getCategories(): BCCategory[];
947
954
  /**
948
955
  * Retrieves all available locations.
949
- * @returns An array of `BCLocation` objects representing all stored locations.
956
+ * @returns An array of locations.
950
957
  */
951
958
  getLocations(): BCLocation[];
959
+ /**
960
+ * Retrieves all amenity locations.
961
+ * @returns An array of amenity locations.
962
+ */
952
963
  getAllAminityLocations(): BCLocation[];
953
964
  /**
954
- * Searches for locations that match the provided search string.
955
- *
956
- * @param searchString - The string input used to match against location names or tags.
957
- * @param callback - A function to execute once the matching process is complete,
958
- * 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.
959
968
  */
960
969
  searchForLocations(searchString: string, callback: (matches: BCLocation[]) => void): void;
961
970
  /**
962
- * Searches for categories that match the provided search string.
963
- *
964
- * @param searchString - The string input used to match against location names or tags.
965
- * @param callback - A function to execute once the matching process is complete,
966
- * 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.
967
974
  */
968
975
  searchForCategories(searchString: string, callback: (matches: BCCategory[]) => void): void;
969
976
  /**
970
- * Selects the specified location on the map.
971
- *
972
- * @param location - The BCLocation object representing the POI to be selected.
973
- *
974
- * Preconditions:
975
- * - The `floor` parameter must be a valid BCLocation instance.
976
- *
977
- * Example:
978
- * selectLocation(location);
977
+ * Selects a specific location on the map.
978
+ * @param location - The location to select.
979
979
  */
980
980
  selectLocation(location: BCLocation): void;
981
+ selectLocationWithId(locationId: string): void;
981
982
  /**
982
- * Retrieves all available happenings.
983
- * @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.
984
986
  */
985
987
  getHappenings(type: BCHappeningType): BCHappenings[];
986
- /**
987
- * Retrieves the session ID.
988
- * @returns A promise that resolves to a string session ID.
989
- */
990
- getSessionId(): Promise<string>;
991
- /**
992
- * Retrieves the suggestions based on user answers.
993
- * @returns A promise that returns a list of event IDs.
994
- */
995
- getEventSuggestions(sessionId: string, answers: BCAnswer[]): Promise<string[]>;
996
- /**
997
- * Retrieves all available questions.
998
- * @returns An array of `BCQuestion` objects.
999
- */
1000
- getQuestions(): BCQuestion[];
1001
988
  /**
1002
989
  * Retrieves all available amenities.
1003
- * @returns An array of `BCSiteAmenity` objects representing all map amenities.
990
+ * @returns An array of amenities.
1004
991
  */
1005
992
  getAmenities(): BCSiteAmenity[];
1006
993
  /**
1007
- * Selects the specified amenities on the map.
1008
- *
1009
- * @param amenityType - The BCSiteAmenity representing type of POI to be selected.
1010
- *
1011
- * Example:
1012
- * selectAmenities(BCSiteAmenity.RESTROOM);
994
+ * Selects a specific amenity type on the map.
995
+ * @param amenityType - The type of amenity to select.
1013
996
  */
1014
997
  selectAmenities(amenityType: BCSiteAmenity): void;
1015
998
  /**
1016
999
  * Enables or disables multi-selection mode for locations.
1017
- *
1018
- * When multi-selection is enabled, multiple locations can be selected at the same time.
1019
- * When disabled, only the most recently selected location is kept in the selection.
1020
- *
1021
- * @param {boolean} [enable=true] - Whether to enable or disable multi-selection.
1022
- * Defaults to `true` (enable).
1000
+ * @param enable - Whether to enable or disable multi-selection.
1023
1001
  */
1024
1002
  enableMultiSelection(enable?: boolean): void;
1025
1003
  /**
1026
- * Clears any current selections in the map or application.
1027
- * This method resets the selection state, removing highlights
1028
- * or selected features and ensuring a clean slate for new selections.
1004
+ * Clears all current selections on the map.
1029
1005
  */
1030
1006
  clearSelection(): void;
1031
1007
  /**
1032
- * @hidden
1033
- * @internal
1034
- * Retrieves the step node.
1035
- */
1036
- setBounds(sw: [
1037
- number,
1038
- number
1039
- ], ne: [
1040
- number,
1041
- number
1042
- ]): void;
1043
- /**
1044
- * Reset Default Viewport with the provided options.
1045
- * @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.
1046
1010
  */
1047
1011
  resetDefaultViewport(newOptions?: Partial<BCMapViewOptions>): void;
1048
1012
  /**
1049
- * Sets the viewport with the provided options without changing the defaulf values.
1050
- * @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.
1051
1015
  */
1052
1016
  setViewport(newOptions: Partial<BCMapViewOptions>): void;
1053
1017
  }
package/package.json CHANGED
@@ -1,70 +1,71 @@
1
- {
2
- "name": "becomap",
3
- "version": "1.5.6",
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
  }