becomap 1.6.0 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -15
- package/lib/becomap.js +1 -1
- package/lib/index.d.ts +83 -75
- package/package.json +72 -70
- package/public/index.html +500 -0
- package/webpack.umd.config.js +91 -0
package/lib/index.d.ts
CHANGED
|
@@ -397,6 +397,12 @@ export interface BCLocation {
|
|
|
397
397
|
*/
|
|
398
398
|
get amenity(): BCSiteAmenity;
|
|
399
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
|
+
/**
|
|
400
406
|
* Stores phone numbers associated with the location, where the key represents the type of phone number.
|
|
401
407
|
*
|
|
402
408
|
* @returns A record of phone numbers keyed by type (e.g., {"main": "123-456-7890"}).
|
|
@@ -628,6 +634,11 @@ export interface BCRouteController {
|
|
|
628
634
|
* this.showStep(routeStep);
|
|
629
635
|
*/
|
|
630
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;
|
|
631
642
|
/**
|
|
632
643
|
* Clears the current route from the map by removing the route layer or data from the map view.
|
|
633
644
|
* It relies on the routeController to manage route layers or data.
|
|
@@ -649,6 +660,16 @@ export interface BCRouteOptions {
|
|
|
649
660
|
* @returns An array of BCRouteSegment objects representing each segment of the route, or `null` if a route cannot be generated.
|
|
650
661
|
*/
|
|
651
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;
|
|
652
673
|
/**
|
|
653
674
|
* Defines the events supported by the BCMapView and their corresponding arguments.
|
|
654
675
|
*/
|
|
@@ -799,52 +820,6 @@ export interface BCHappenings {
|
|
|
799
820
|
*/
|
|
800
821
|
customFields: Record<string, any>;
|
|
801
822
|
}
|
|
802
|
-
declare enum BCQuestionType {
|
|
803
|
-
/** Represents a multiple-choice question with a single answer. */
|
|
804
|
-
MCQ_SINGLE_ANSWER = "MCQ_SINGLE_ANSWER",
|
|
805
|
-
/** Represents an open-ended text response. */
|
|
806
|
-
TEXT = "TEXT",
|
|
807
|
-
/** Represents a numerical response. */
|
|
808
|
-
NUMBER = "NUMBER",
|
|
809
|
-
/** Represents a boolean (true/false) response. */
|
|
810
|
-
BOOLEAN = "BOOLEAN"
|
|
811
|
-
}
|
|
812
|
-
/**
|
|
813
|
-
* Interface representing a single survey question.
|
|
814
|
-
*/
|
|
815
|
-
export interface BCQuestion {
|
|
816
|
-
/**
|
|
817
|
-
* Unique identifier for the question.
|
|
818
|
-
*/
|
|
819
|
-
id: string;
|
|
820
|
-
/**
|
|
821
|
-
* The text of the question.
|
|
822
|
-
*/
|
|
823
|
-
question: string;
|
|
824
|
-
/**
|
|
825
|
-
* The type of the question, as defined in BCQuestionType.
|
|
826
|
-
*/
|
|
827
|
-
type: BCQuestionType;
|
|
828
|
-
/**
|
|
829
|
-
* The list of possible options for multiple-choice questions.
|
|
830
|
-
* Should be empty or undefined for non-MCQ question types.
|
|
831
|
-
*/
|
|
832
|
-
options?: string[];
|
|
833
|
-
}
|
|
834
|
-
/**
|
|
835
|
-
* Interface representing an answer to a survey question.
|
|
836
|
-
*/
|
|
837
|
-
export interface BCAnswer {
|
|
838
|
-
/**
|
|
839
|
-
* Unique identifier for the question being answered.
|
|
840
|
-
*/
|
|
841
|
-
questionId: string;
|
|
842
|
-
/**
|
|
843
|
-
* The answers provided by the user.
|
|
844
|
-
* This can be a list to accommodate multiple responses for certain question types.
|
|
845
|
-
*/
|
|
846
|
-
answers: string[];
|
|
847
|
-
}
|
|
848
823
|
/**
|
|
849
824
|
* Constructs a new MapView instance.
|
|
850
825
|
*
|
|
@@ -887,6 +862,31 @@ export interface BCMapViewOptions {
|
|
|
887
862
|
* Default bearing can be defined in the implementation.
|
|
888
863
|
*/
|
|
889
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
|
+
];
|
|
890
890
|
}
|
|
891
891
|
/**
|
|
892
892
|
* Interface representing the public API of the BCMapView class.
|
|
@@ -940,6 +940,7 @@ export interface BCMapView {
|
|
|
940
940
|
* @param floor - The floor to be selected.
|
|
941
941
|
*/
|
|
942
942
|
selectFloor(floor: BCMapFloor): void;
|
|
943
|
+
selectFloorWithId(floorId: string): void;
|
|
943
944
|
/**
|
|
944
945
|
* Retrieves the currently selected floor.
|
|
945
946
|
* @returns The currently selected floor.
|
|
@@ -960,6 +961,24 @@ export interface BCMapView {
|
|
|
960
961
|
* @returns An array of amenity locations.
|
|
961
962
|
*/
|
|
962
963
|
getAllAminityLocations(): BCLocation[];
|
|
964
|
+
/**
|
|
965
|
+
* Sets the current custom location for the map view.eg: Kiosk Location
|
|
966
|
+
* @param customLocationId - The ID of the custom location to set as current.
|
|
967
|
+
*/
|
|
968
|
+
setCurrentCustomLocation(customLocationId: string): void;
|
|
969
|
+
/**
|
|
970
|
+
* Gets the current custom location ID.
|
|
971
|
+
* @returns The current custom location ID, or null if not set.
|
|
972
|
+
*/
|
|
973
|
+
getCurrentCustomLocationId(): string | null;
|
|
974
|
+
/**
|
|
975
|
+
* Retrieves amenity locations of a specific type, sorted by floor priority and distance from kiosk location.
|
|
976
|
+
* @param amenityType - The type of amenity to retrieve.
|
|
977
|
+
* @param customLocationId - Optional. The ID of the kiosk location to calculate distances from. If not provided, uses the current kiosk location.
|
|
978
|
+
* @param floorId - The preferred floor ID to prioritize in results.
|
|
979
|
+
* @returns An array of sorted amenity locations.
|
|
980
|
+
*/
|
|
981
|
+
getAminityLocations(amenityType: BCSiteAmenity, customLocationId?: string, floorId?: string): BCLocation[];
|
|
963
982
|
/**
|
|
964
983
|
* Searches for locations matching the provided search string.
|
|
965
984
|
* @param searchString - The string to search for.
|
|
@@ -977,29 +996,18 @@ export interface BCMapView {
|
|
|
977
996
|
* @param location - The location to select.
|
|
978
997
|
*/
|
|
979
998
|
selectLocation(location: BCLocation): void;
|
|
999
|
+
selectLocationWithId(locationId: string): void;
|
|
1000
|
+
/**
|
|
1001
|
+
* Selects multiple locations on the map.
|
|
1002
|
+
* @param locations - The array of locations to select.
|
|
1003
|
+
*/
|
|
1004
|
+
selectLocations(locations: BCLocation[]): void;
|
|
980
1005
|
/**
|
|
981
1006
|
* Retrieves all available happenings of a specific type.
|
|
982
1007
|
* @param type - The type of happenings to retrieve.
|
|
983
1008
|
* @returns An array of happenings.
|
|
984
1009
|
*/
|
|
985
1010
|
getHappenings(type: BCHappeningType): BCHappenings[];
|
|
986
|
-
/**
|
|
987
|
-
* Retrieves the session ID for the current map view.
|
|
988
|
-
* @returns A promise that resolves to the session ID.
|
|
989
|
-
*/
|
|
990
|
-
getSessionId(): Promise<string>;
|
|
991
|
-
/**
|
|
992
|
-
* Retrieves event suggestions based on user answers.
|
|
993
|
-
* @param sessionId - The session ID.
|
|
994
|
-
* @param answers - The user's answers.
|
|
995
|
-
* @returns A promise that resolves to a list of event IDs.
|
|
996
|
-
*/
|
|
997
|
-
getEventSuggestions(sessionId: string, answers: BCAnswer[]): Promise<string[]>;
|
|
998
|
-
/**
|
|
999
|
-
* Retrieves all available questions.
|
|
1000
|
-
* @returns An array of questions.
|
|
1001
|
-
*/
|
|
1002
|
-
getQuestions(): BCQuestion[];
|
|
1003
1011
|
/**
|
|
1004
1012
|
* Retrieves all available amenities.
|
|
1005
1013
|
* @returns An array of amenities.
|
|
@@ -1019,18 +1027,6 @@ export interface BCMapView {
|
|
|
1019
1027
|
* Clears all current selections on the map.
|
|
1020
1028
|
*/
|
|
1021
1029
|
clearSelection(): void;
|
|
1022
|
-
/**
|
|
1023
|
-
* Sets the map bounds to the specified southwest and northeast coordinates.
|
|
1024
|
-
* @param sw - The southwest coordinates.
|
|
1025
|
-
* @param ne - The northeast coordinates.
|
|
1026
|
-
*/
|
|
1027
|
-
setBounds(sw: [
|
|
1028
|
-
number,
|
|
1029
|
-
number
|
|
1030
|
-
], ne: [
|
|
1031
|
-
number,
|
|
1032
|
-
number
|
|
1033
|
-
]): void;
|
|
1034
1030
|
/**
|
|
1035
1031
|
* Resets the default viewport with the provided options.
|
|
1036
1032
|
* @param newOptions - Partial options to update the viewport.
|
|
@@ -1041,6 +1037,18 @@ export interface BCMapView {
|
|
|
1041
1037
|
* @param newOptions - Partial options to update the viewport.
|
|
1042
1038
|
*/
|
|
1043
1039
|
setViewport(newOptions: Partial<BCMapViewOptions>): void;
|
|
1040
|
+
/**
|
|
1041
|
+
* Submits user feedback to the server.
|
|
1042
|
+
* @param feedbackData - The feedback data containing name, message, siteId, phoneNumber, and rating.
|
|
1043
|
+
* @returns Promise that resolves with the server response.
|
|
1044
|
+
*/
|
|
1045
|
+
submitFeedback(feedbackData: {
|
|
1046
|
+
name: string;
|
|
1047
|
+
message: string;
|
|
1048
|
+
siteId: string;
|
|
1049
|
+
phoneNumber: string;
|
|
1050
|
+
rating: number;
|
|
1051
|
+
}): Promise<any>;
|
|
1044
1052
|
}
|
|
1045
1053
|
/**
|
|
1046
1054
|
* Options for retrieving a specific site.
|
package/package.json
CHANGED
|
@@ -1,70 +1,72 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "becomap",
|
|
3
|
-
"version": "1.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
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
|
|
70
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "becomap",
|
|
3
|
+
"version": "1.6.2",
|
|
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
|
+
"becomap": "^1.5.72",
|
|
62
|
+
"html-webpack-plugin": "^5.6.3",
|
|
63
|
+
"maplibre-gl": "^4.4.1",
|
|
64
|
+
"polished": "^4.3.1",
|
|
65
|
+
"polylabel": "^2.0.1",
|
|
66
|
+
"protobufjs": "^7.4.0",
|
|
67
|
+
"rbush": "^4.0.1",
|
|
68
|
+
"three": "^0.172.0",
|
|
69
|
+
"troika-three-text": "^0.52.3",
|
|
70
|
+
"word-wrap": "^1.2.5"
|
|
71
|
+
}
|
|
72
|
+
}
|