@situm/react-native 3.0.1 → 3.0.3-beta.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.
Files changed (111) hide show
  1. package/ReactNativeSitumPlugin.podspec +13 -10
  2. package/lib/commonjs/index.js +10 -22
  3. package/lib/commonjs/index.js.map +1 -1
  4. package/lib/commonjs/sdk/index.js +13 -0
  5. package/lib/commonjs/sdk/index.js.map +1 -1
  6. package/lib/commonjs/sdk/types/constants.js +30 -0
  7. package/lib/commonjs/sdk/types/constants.js.map +1 -0
  8. package/lib/commonjs/{wayfinding/types/index.d.js → sdk/types/index.js} +1 -1
  9. package/lib/commonjs/{wayfinding/types/index.d.js.map → sdk/types/index.js.map} +1 -1
  10. package/lib/commonjs/utils/index.js +28 -0
  11. package/lib/commonjs/utils/index.js.map +1 -0
  12. package/lib/commonjs/utils/requestPermission.js +15 -14
  13. package/lib/commonjs/utils/requestPermission.js.map +1 -1
  14. package/lib/commonjs/wayfinding/components/MapView.js +11 -17
  15. package/lib/commonjs/wayfinding/components/MapView.js.map +1 -1
  16. package/lib/commonjs/wayfinding/hooks/index.js +44 -44
  17. package/lib/commonjs/wayfinding/hooks/index.js.map +1 -1
  18. package/lib/commonjs/wayfinding/index.js +4 -4
  19. package/lib/commonjs/wayfinding/index.js.map +1 -1
  20. package/lib/commonjs/wayfinding/store/index.js +3 -5
  21. package/lib/commonjs/wayfinding/store/index.js.map +1 -1
  22. package/lib/commonjs/wayfinding/types/constants.js +14 -0
  23. package/lib/commonjs/wayfinding/types/constants.js.map +1 -0
  24. package/lib/commonjs/wayfinding/types/index.js +6 -0
  25. package/lib/{module/wayfinding/types/index.d.js.map → commonjs/wayfinding/types/index.js.map} +1 -1
  26. package/lib/commonjs/wayfinding/utils/mapper.js +1 -0
  27. package/lib/commonjs/wayfinding/utils/mapper.js.map +1 -1
  28. package/lib/module/index.js +2 -3
  29. package/lib/module/index.js.map +1 -1
  30. package/lib/module/sdk/index.js +1 -0
  31. package/lib/module/sdk/index.js.map +1 -1
  32. package/lib/module/sdk/types/constants.js +21 -0
  33. package/lib/module/sdk/types/constants.js.map +1 -0
  34. package/lib/module/sdk/types/index.js +2 -0
  35. package/lib/module/sdk/types/index.js.map +1 -0
  36. package/lib/module/utils/index.js +3 -0
  37. package/lib/module/utils/index.js.map +1 -0
  38. package/lib/module/utils/requestPermission.js +14 -14
  39. package/lib/module/utils/requestPermission.js.map +1 -1
  40. package/lib/module/wayfinding/components/MapView.js +6 -11
  41. package/lib/module/wayfinding/components/MapView.js.map +1 -1
  42. package/lib/module/wayfinding/hooks/index.js +2 -2
  43. package/lib/module/wayfinding/hooks/index.js.map +1 -1
  44. package/lib/module/wayfinding/index.js +2 -1
  45. package/lib/module/wayfinding/index.js.map +1 -1
  46. package/lib/module/wayfinding/store/index.js +1 -4
  47. package/lib/module/wayfinding/store/index.js.map +1 -1
  48. package/lib/module/wayfinding/store/utils.js.map +1 -1
  49. package/lib/module/wayfinding/types/constants.js +7 -0
  50. package/lib/module/wayfinding/types/constants.js.map +1 -0
  51. package/lib/module/wayfinding/types/index.js +2 -0
  52. package/lib/module/wayfinding/types/index.js.map +1 -0
  53. package/lib/module/wayfinding/utils/mapper.js +1 -0
  54. package/lib/module/wayfinding/utils/mapper.js.map +1 -1
  55. package/lib/typescript/src/index.d.ts +4 -3
  56. package/lib/typescript/src/index.d.ts.map +1 -1
  57. package/lib/typescript/src/sdk/index.d.ts +4 -2
  58. package/lib/typescript/src/sdk/index.d.ts.map +1 -1
  59. package/lib/typescript/src/sdk/types/constants.d.ts +18 -0
  60. package/lib/typescript/src/sdk/types/constants.d.ts.map +1 -0
  61. package/lib/{commonjs/sdk/types/index.d.js → typescript/src/sdk/types/index.d.ts} +266 -32
  62. package/lib/typescript/src/sdk/types/index.d.ts.map +1 -0
  63. package/lib/typescript/src/utils/index.d.ts +3 -0
  64. package/lib/typescript/src/utils/index.d.ts.map +1 -0
  65. package/lib/typescript/src/utils/requestPermission.d.ts +1 -1
  66. package/lib/typescript/src/utils/requestPermission.d.ts.map +1 -1
  67. package/lib/typescript/src/wayfinding/components/MapView.d.ts +2 -5
  68. package/lib/typescript/src/wayfinding/components/MapView.d.ts.map +1 -1
  69. package/lib/typescript/src/wayfinding/hooks/index.d.ts +1 -1
  70. package/lib/typescript/src/wayfinding/hooks/index.d.ts.map +1 -1
  71. package/lib/typescript/src/wayfinding/index.d.ts +2 -1
  72. package/lib/typescript/src/wayfinding/index.d.ts.map +1 -1
  73. package/lib/typescript/src/wayfinding/store/index.d.ts +3 -3
  74. package/lib/typescript/src/wayfinding/store/index.d.ts.map +1 -1
  75. package/lib/typescript/src/wayfinding/store/utils.d.ts +1 -1
  76. package/lib/typescript/src/wayfinding/store/utils.d.ts.map +1 -1
  77. package/lib/typescript/src/wayfinding/types/constants.d.ts +5 -0
  78. package/lib/typescript/src/wayfinding/types/constants.d.ts.map +1 -0
  79. package/lib/typescript/src/wayfinding/types/index.d.ts +57 -0
  80. package/lib/typescript/src/wayfinding/types/index.d.ts.map +1 -0
  81. package/lib/typescript/src/wayfinding/utils/mapper.d.ts +3 -3
  82. package/lib/typescript/src/wayfinding/utils/mapper.d.ts.map +1 -1
  83. package/package.json +57 -15
  84. package/src/index.ts +5 -3
  85. package/src/sdk/index.ts +6 -2
  86. package/src/sdk/types/constants.ts +21 -0
  87. package/src/sdk/types/{index.d.ts → index.ts} +20 -158
  88. package/src/utils/index.ts +2 -0
  89. package/src/utils/requestPermission.ts +14 -15
  90. package/src/wayfinding/components/MapView.tsx +23 -21
  91. package/src/wayfinding/hooks/index.ts +10 -8
  92. package/src/wayfinding/index.ts +2 -1
  93. package/src/wayfinding/store/index.tsx +10 -10
  94. package/src/wayfinding/store/utils.ts +1 -1
  95. package/src/wayfinding/types/constants.ts +5 -0
  96. package/src/wayfinding/types/{index.d.ts → index.ts} +7 -3
  97. package/src/wayfinding/utils/mapper.ts +5 -5
  98. package/android/.idea/.name +0 -1
  99. package/android/.idea/codeStyles/Project.xml +0 -116
  100. package/android/.idea/encodings.xml +0 -6
  101. package/android/.idea/misc.xml +0 -31
  102. package/android/.idea/sonarlint/issuestore/index.pb +0 -15
  103. package/android/.project +0 -34
  104. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  105. package/android/gradle/wrapper/gradle-wrapper.properties +0 -6
  106. package/android/gradlew +0 -172
  107. package/android/gradlew.bat +0 -84
  108. package/lib/commonjs/sdk/types/index.d.js.map +0 -1
  109. package/lib/module/sdk/types/index.d.js +0 -347
  110. package/lib/module/sdk/types/index.d.js.map +0 -1
  111. package/lib/module/wayfinding/types/index.d.js +0 -2
@@ -0,0 +1,57 @@
1
+ import type { DirectionPoint, Poi } from "../../sdk/types";
2
+ import { ErrorName } from "./constants";
3
+ export interface MapViewError {
4
+ name: ErrorName;
5
+ description: string;
6
+ }
7
+ export interface MapViewRef {
8
+ selectPoi: (poiId: number) => void;
9
+ navigateToPoi: ({ poi, poiId }: {
10
+ poi?: Poi;
11
+ poiId?: number;
12
+ }) => void;
13
+ cancelNavigation: () => void;
14
+ }
15
+ export interface WayfindingResult {
16
+ status: string;
17
+ message: string;
18
+ }
19
+ export interface OnPoiSelectedResult {
20
+ buildingId: string;
21
+ buildingName: string;
22
+ floorId: string;
23
+ floorName: string;
24
+ poiId: string;
25
+ poiName: string;
26
+ }
27
+ export interface OnPoiDeselectedResult {
28
+ buildingId: string;
29
+ buildingName: string;
30
+ }
31
+ export interface OnFloorChangedResult {
32
+ buildingId: string;
33
+ buildingName: string;
34
+ fromFloorId: string;
35
+ toFloorId: string;
36
+ fromFloorName: string;
37
+ toFloorName: string;
38
+ }
39
+ export interface Destination {
40
+ category: string;
41
+ identifier?: string;
42
+ name?: string;
43
+ point: DirectionPoint;
44
+ }
45
+ export interface Navigation {
46
+ status: string;
47
+ destination?: Destination;
48
+ }
49
+ export interface OnNavigationResult {
50
+ navigation: Navigation;
51
+ error?: Error;
52
+ }
53
+ export type NavigateToPoiType = {
54
+ navigationTo: number;
55
+ type?: string;
56
+ };
57
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/wayfinding/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,SAAS,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,aAAa,EAAE,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;QAAE,GAAG,CAAC,EAAE,GAAG,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACvE,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,cAAc,CAAC;CACvB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC"}
@@ -1,6 +1,5 @@
1
- import { Location, NavigateToPoiType, SDKNavigation } from "../../sdk/types/index.d";
2
- import { Navigation } from "..";
3
- import { Directions } from "../store/index";
1
+ import type { Directions, Location, SDKNavigation } from "../../sdk/types";
2
+ import type { NavigateToPoiType, Navigation } from "../types";
4
3
  declare const Mapper: {
5
4
  location: (location: Location) => string;
6
5
  locationStatus: (locationStatus: Location["status"]) => string;
@@ -10,6 +9,7 @@ declare const Mapper: {
10
9
  cancelNavigation: () => string;
11
10
  selectPoi: (poiId: number | null) => string;
12
11
  followUser: (follow: boolean) => string;
12
+ setLanguage: (lang: string) => string;
13
13
  initialConfiguration: (style: any, enablePoiClustering: any, showPoiNames: any, minZoom: any, maxZoom: any, initialZoom: any, useDashboardTheme: any) => string;
14
14
  routeToResult: (navigation: any) => Navigation;
15
15
  navigationToResult: (navigation: SDKNavigation) => Navigation;
@@ -1 +1 @@
1
- {"version":3,"file":"mapper.d.ts","sourceRoot":"","sources":["../../../../../src/wayfinding/utils/mapper.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,QAAQ,EACR,iBAAiB,EACjB,aAAa,EACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAe,UAAU,EAAE,MAAM,IAAI,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAK5C,QAAA,MAAM,MAAM;yBACW,QAAQ;qCAiBI,QAAQ,CAAC,QAAQ,CAAC;wBAG/B,UAAU;6BAGL,UAAU;8BAGT,iBAAiB;;uBAKxB,MAAM,GAAG,IAAI;yBAGX,OAAO;kCAGnB,GAAG,uBACW,GAAG,gBACV,GAAG,WACR,GAAG,WACH,GAAG,eACC,GAAG,qBACG,GAAG;gCA0BI,GAAG,KAAG,UAAU;qCA2BX,aAAa,KAAG,UAAU;CAmB5D,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"mapper.d.ts","sourceRoot":"","sources":["../../../../../src/wayfinding/utils/mapper.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,UAAU,EACV,QAAQ,EACR,aAAa,EACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAe,iBAAiB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAK3E,QAAA,MAAM,MAAM;yBACW,QAAQ;qCAiBI,QAAQ,CAAC,QAAQ,CAAC;wBAG/B,UAAU;6BAGL,UAAU;8BAGT,iBAAiB;;uBAKxB,MAAM,GAAG,IAAI;yBAGX,OAAO;wBACR,MAAM;kCAGjB,GAAG,uBACW,GAAG,gBACV,GAAG,WACR,GAAG,WACH,GAAG,eACC,GAAG,qBACG,GAAG;gCA0BI,GAAG,KAAG,UAAU;qCA2BX,aAAa,KAAG,UAAU;CAmB5D,CAAC;AAEF,eAAe,MAAM,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@situm/react-native",
3
- "version": "3.0.1",
3
+ "version": "3.0.3-beta.0",
4
4
  "description": "Set of utilities that allow any developer to build React Native location based apps using Situm's indoor positioning system.",
5
5
  "private": false,
6
6
  "repository": "https://github.com/situmtech/react-native",
@@ -24,17 +24,22 @@
24
24
  "android",
25
25
  "ios",
26
26
  "cpp",
27
- "ReactNativeSitumPlugin.podspec",
27
+ "*.podspec",
28
28
  "README.md",
29
29
  "LICENSE",
30
30
  "SECURITY-POLICY.md",
31
31
  "security.txt",
32
32
  "!lib/typescript/example",
33
- "!android/build",
34
33
  "!ios/build",
34
+ "!android/build",
35
+ "!android/gradle",
36
+ "!android/gradlew",
37
+ "!android/gradlew.bat",
38
+ "!android/local.properties",
35
39
  "!**/__tests__",
36
40
  "!**/__fixtures__",
37
- "!**/__mocks__"
41
+ "!**/__mocks__",
42
+ "!**/.*"
38
43
  ],
39
44
  "scripts": {
40
45
  "android": "react-native run-android",
@@ -45,9 +50,13 @@
45
50
  "lint:fix": "eslint \"src/**/*.{js,ts,tsx}\" --fix",
46
51
  "lint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"",
47
52
  "prepare": "bob build",
53
+ "release": "release-it",
48
54
  "example": "yarn --cwd example",
55
+ "build:android": "cd example/android && ./gradlew assembleDebug --no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a",
56
+ "build:ios": "cd example/ios && xcodebuild -workspace AwesomeLibraryExample.xcworkspace -scheme AwesomeLibraryExample -configuration Debug -sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO",
49
57
  "bootstrap": "yarn example && yarn && yarn example pods",
50
- "doc": "typedoc --out ./docs/types ./src --tsconfig ./tsconfig.json"
58
+ "doc": "typedoc --out ./docs/types ./src --tsconfig ./tsconfig.json",
59
+ "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build"
51
60
  },
52
61
  "keywords": [
53
62
  "react-native",
@@ -57,36 +66,36 @@
57
66
  "ios",
58
67
  "android"
59
68
  ],
60
- "peerDependencies": {
61
- "react": "*",
62
- "react-native": "*"
63
- },
64
69
  "devDependencies": {
65
- "@arkweid/lefthook": "^0.7.7",
66
70
  "@babel/core": "^7.22.5",
67
71
  "@babel/eslint-parser": "^7.22.5",
68
72
  "@babel/preset-env": "^7.22.5",
69
73
  "@babel/runtime": "^7.22.5",
74
+ "@commitlint/config-conventional": "^17.6.7",
75
+ "@evilmartians/lefthook": "^1.2.20.7.7",
70
76
  "@react-native-community/eslint-config": "^3.2.0",
71
77
  "@types/jest": "^29.5.2",
78
+ "@types/react": "^18.2.7",
72
79
  "@types/react-native": "0.72.2",
73
80
  "@types/react-test-renderer": "^18.0.0",
74
- "@types/react": "^18.2.7",
75
81
  "babel-plugin-module-resolver": "^5.0.0",
76
82
  "commitlint": "^17.6.6",
83
+ "del-cli": "^5.0.0",
84
+ "eslint": "^8.44.0",
77
85
  "eslint-config-prettier": "^8.8.0",
78
86
  "eslint-plugin-functional": "^5.0.8",
79
87
  "eslint-plugin-import": "^2.27.5",
80
88
  "eslint-plugin-prettier": "^4.2.1",
81
89
  "eslint-plugin-simple-import-sort": "^10.0.0",
82
- "eslint": "^8.44.0",
83
90
  "jest": "^29.5.0",
91
+ "jest-mock-extended": "^3.0.5",
84
92
  "metro-react-native-babel-preset": "0.73.7",
85
93
  "prettier": "^2.8.8",
86
- "react-native-builder-bob": "^0.20.4",
94
+ "react": "^18.2.0",
87
95
  "react-native": "^0.72.1",
96
+ "react-native-builder-bob": "^0.21.3",
88
97
  "react-test-renderer": "18.2.0",
89
- "react": "^18.2.0",
98
+ "release-it": "^16.1.3",
90
99
  "typedoc": "^0.24.8",
91
100
  "typescript": "^5.0.4"
92
101
  },
@@ -95,6 +104,17 @@
95
104
  "react-native-permissions": "*",
96
105
  "react-native-webview": "*"
97
106
  },
107
+ "resolutions": {
108
+ "@types/react": "17.0.21"
109
+ },
110
+ "peerDependencies": {
111
+ "react": "*",
112
+ "react-native": "*"
113
+ },
114
+ "engines": {
115
+ "node": ">= 16.0.0"
116
+ },
117
+ "packageManager": "^yarn@1.22.15",
98
118
  "jest": {
99
119
  "preset": "react-native",
100
120
  "setupFilesAfterEnv": [
@@ -125,8 +145,30 @@
125
145
  ]
126
146
  ]
127
147
  },
148
+ "release-it": {
149
+ "git": {
150
+ "commitMessage": "chore: release ${version}",
151
+ "tagName": "v${version}"
152
+ },
153
+ "npm": {
154
+ "publish": true
155
+ },
156
+ "github": {
157
+ "release": true
158
+ },
159
+ "plugins": {
160
+ "@release-it/conventional-changelog": {
161
+ "preset": "angular"
162
+ }
163
+ }
164
+ },
165
+ "eslintIgnore": [
166
+ "node_modules/",
167
+ "lib/"
168
+ ],
169
+ "prettier": {},
128
170
  "sdkVersions": {
129
171
  "android": "3.1.0@aar",
130
- "ios": "2.61.1"
172
+ "ios": "2.62.0"
131
173
  }
132
174
  }
package/src/index.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  import SitumPlugin from "./sdk";
2
2
 
3
3
  // Definitions
4
- export * from "./sdk/types/index.d";
5
- export * from "./wayfinding/types/index.d";
4
+ export type * from "./sdk/types";
5
+ export type * from "./wayfinding/types";
6
6
 
7
7
  // APIs
8
- export * from "./utils/requestPermission";
8
+ export * from "./sdk";
9
+ export * from "./utils";
9
10
  export * from "./wayfinding";
11
+
10
12
  export default SitumPlugin;
package/src/sdk/index.ts CHANGED
@@ -3,6 +3,9 @@
3
3
  import invariant from "invariant";
4
4
  import { NativeEventEmitter, NativeModules, Platform } from "react-native";
5
5
 
6
+ export type * from "./types";
7
+ export * from "./types/constants";
8
+
6
9
  import packageJson from "../../package.json";
7
10
  import { logError } from "../utils/logError";
8
11
  import type {
@@ -11,7 +14,8 @@ import type {
11
14
  DirectionsOptions,
12
15
  Floor,
13
16
  LocationRequestOptions,
14
- } from "./types/index.d.ts";
17
+ NavigationRequest,
18
+ } from "./types";
15
19
 
16
20
  const LINKING_ERROR =
17
21
  `The package 'situm-react-native-plugin' doesn't seem to be linked. Make sure: \n\n` +
@@ -524,7 +528,7 @@ export default {
524
528
  requestNavigationUpdates: function (
525
529
  navigationUpdates: (event: any) => void,
526
530
  error?: (event: any) => void,
527
- options?: LocationRequestOptions
531
+ options?: NavigationRequest
528
532
  ) {
529
533
  RNCSitumPlugin.requestNavigationUpdates(options || {});
530
534
  navigationSubscriptions.push(
@@ -0,0 +1,21 @@
1
+ export enum NavigationStatus {
2
+ START = "start",
3
+ STOP = "stop",
4
+ UPDATE = "update",
5
+ }
6
+
7
+ export enum NavigationUpdateType {
8
+ progress = "PROGRESS",
9
+ userOutsideRoute = "OUT_OF_ROUTE",
10
+ destinationReached = "DESTINATION_REACHED",
11
+ }
12
+
13
+ export enum LocationStatusName {
14
+ STARTING = "STARTING",
15
+ CALCULATING = "CALCULATING",
16
+ // This status will always be sent to mapviewer-web, in case we recieve
17
+ // a location from SDK.
18
+ POSITIONING = "POSITIONING",
19
+ USER_NOT_IN_BUILDING = "USER_NOT_IN_BUILDING",
20
+ STOPPED = "STOPPED",
21
+ }
@@ -1,5 +1,10 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
- /* eslint-disable @typescript-eslint/ban-types */
2
+
3
+ import type {
4
+ LocationStatusName,
5
+ NavigationStatus,
6
+ NavigationUpdateType,
7
+ } from "src/sdk";
3
8
 
4
9
  /**
5
10
  * @name Building
@@ -406,7 +411,7 @@ export type Circle = {
406
411
  * @property {boolean} autoEnableBleDuringPositioning - Set if the BLE should be re-enabled during positioning if the ble is used. Android only
407
412
  */
408
413
  export type LocationRequestOptions = {
409
- buildingIdentifier: number;
414
+ buildingIdentifier?: number;
410
415
  interval?: number;
411
416
  indoorProvider?: string;
412
417
  useBle?: boolean;
@@ -451,16 +456,16 @@ export type LocationRequest = {
451
456
  * @property {number} timeToIgnoreUnexpectedFloorChanges - Time (in millis) to ignore the locations received during navigation, when the next indication is a floor change, if the locations are in a wrong floor (not in origin or destination floors).
452
457
  */
453
458
  export type NavigationRequest = {
454
- distanceToIgnoreFirstIndication: number;
455
- ignoreLowQualityLocations: number;
456
- distanceToGoalThreshold: number;
457
- outsideRouteThreshold: number;
458
- distanceToFloorChangeThreshold: number;
459
- distanceToChangeIndicationThreshold: number;
460
- indicationsInterval: number;
461
- timeToFirstIndication: number;
462
- roundIndicationsStep: number;
463
- timeToIgnoreUnexpectedFloorChanges: number;
459
+ distanceToIgnoreFirstIndication?: number;
460
+ ignoreLowQualityLocations?: number;
461
+ distanceToGoalThreshold?: number;
462
+ outsideRouteThreshold?: number;
463
+ distanceToFloorChangeThreshold?: number;
464
+ distanceToChangeIndicationThreshold?: number;
465
+ indicationsInterval?: number;
466
+ timeToFirstIndication?: number;
467
+ roundIndicationsStep?: number;
468
+ timeToIgnoreUnexpectedFloorChanges?: number;
464
469
  };
465
470
 
466
471
  /**
@@ -575,21 +580,14 @@ export interface LocationStatus {
575
580
  statusCode: number;
576
581
  }
577
582
 
578
- export enum LocationStatusName {
579
- STARTING = "STARTING",
580
- CALCULATING = "CALCULATING",
581
- // This status will always be sent to mapviewer-web, in case we recieve
582
- // a location from SDK.
583
- POSITIONING = "POSITIONING",
584
- USER_NOT_IN_BUILDING = "USER_NOT_IN_BUILDING",
585
- STOPPED = "STOPPED",
586
- }
587
-
588
583
  export interface SDKError {
589
584
  code?: number;
590
585
  message: string;
591
586
  }
592
587
 
588
+ // TODO: add types
589
+ export type Directions = any;
590
+
593
591
  export interface SDKNavigation {
594
592
  //closestPositionInRoute: any;
595
593
  currentIndication?: any;
@@ -606,139 +604,3 @@ export interface SDKNavigation {
606
604
  type?: NavigationUpdateType;
607
605
  status: NavigationStatus;
608
606
  }
609
-
610
- export enum NavigationStatus {
611
- START = "start",
612
- STOP = "stop",
613
- UPDATE = "update",
614
- }
615
-
616
- export enum NavigationUpdateType {
617
- progress = "PROGRESS",
618
- userOutsideRoute = "OUT_OF_ROUTE",
619
- destinationReached = "DESTINATION_REACHED",
620
- }
621
-
622
- export type NavigateToPoiType = {
623
- navigationTo: number;
624
- type?: string;
625
- };
626
-
627
- export interface SitumPluginStatic {
628
- initSitumSDK(): void;
629
-
630
- setApiKey(
631
- email: string,
632
- apiKey: string,
633
- callback?: (success: boolean) => void
634
- ): void;
635
-
636
- setUserPass(
637
- email: string,
638
- password: string,
639
- callback?: (success: boolean) => void
640
- ): void;
641
-
642
- setCacheMaxAge(cacheAge: number, callback?: (success: boolean) => void): void;
643
-
644
- fetchBuildings(
645
- success: (buildings: Array<Building>) => void,
646
- error?: (error: string) => void
647
- ): void;
648
-
649
- fetchBuildingInfo(
650
- building: Building,
651
- success: (building: Building) => void,
652
- error?: (error: string) => void
653
- ): void;
654
-
655
- fetchFloorsFromBuilding(
656
- building: Building,
657
- success: (floors: Array<Floor>) => void,
658
- error?: (error: string) => void
659
- ): void;
660
-
661
- fetchMapFromFloor(floor: Floor, success: Function, error: Function): void;
662
-
663
- fetchGeofencesFromBuilding(
664
- building: Building,
665
- success: (geofence: Array<Geofence>) => void,
666
- error?: (error: string) => void
667
- ): void;
668
-
669
- startPositioning(
670
- location: (location: Location) => void,
671
- status: Function,
672
- error?: Function,
673
- locationOptions: LocationRequestOptions
674
- ): void;
675
-
676
- stopPositioning(success: Function, error?: Function): void;
677
-
678
- requestDirections(
679
- directionParams: Array<any>,
680
- success: (route: Route) => void,
681
- error?: Function
682
- ): void;
683
-
684
- fetchPoiCategories(success: Function, error?: Function): void;
685
-
686
- fetchPoiCategoryIconNormal(
687
- category: PoiCategory,
688
- success: Function,
689
- error?: Function
690
- ): void;
691
-
692
- fetchPoiCategoryIconSelected(
693
- category: PoiCategory,
694
- success: Function,
695
- error?: Function
696
- ): void;
697
-
698
- requestNavigationUpdates(
699
- navigationUpdates: Function,
700
- error?: Function,
701
- options?: LocationOptions
702
- ): void;
703
-
704
- updateNavigationWithLocation(
705
- location,
706
- success: Function,
707
- error?: Function
708
- ): void;
709
-
710
- removeNavigationUpdates(callback?: Function): void;
711
-
712
- fetchIndoorPOIsFromBuilding(
713
- building: Building,
714
- success: Function,
715
- error?: Function
716
- ): void;
717
-
718
- fetchOutdoorPOIsFromBuilding(
719
- building: Building,
720
- success: Function,
721
- error?: Function
722
- ): void;
723
-
724
- fetchEventsFromBuilding(
725
- building: Building,
726
- success: Function,
727
- error?: Function
728
- ): void;
729
-
730
- requestRealTimeUpdates(
731
- navigationUpdates: Function,
732
- error?: Function,
733
- request?: RealTimeRequest
734
- ): void;
735
-
736
- removeRealTimeUpdates(callback?: Function): void;
737
-
738
- checkIfPointInsideGeofence(request: any, callback?: Function): void;
739
-
740
- invalidateCache(callback: Function): void;
741
- }
742
-
743
- declare let SitumPlugin: SitumPluginStatic;
744
- export default SitumPlugin;
@@ -0,0 +1,2 @@
1
+ export * from "./logError";
2
+ export * from "./requestPermission";
@@ -12,11 +12,11 @@ const checkIOSPermissions = async () => {
12
12
 
13
13
  // Check if already denied
14
14
  if (granted !== RESULTS.GRANTED) {
15
- throw "Situm > permissionns > ACCESS_FINE_LOCATION denied";
15
+ throw "Situm > permissions > ACCESS_FINE_LOCATION denied";
16
16
  }
17
17
 
18
18
  console.debug(
19
- "Situm > permissionns > LOCATION_WHEN_IN_USE permission granted"
19
+ "Situm > permissions > LOCATION_WHEN_IN_USE permission granted"
20
20
  );
21
21
 
22
22
  //@ts-ignore
@@ -25,15 +25,15 @@ const checkIOSPermissions = async () => {
25
25
 
26
26
  if (granted === RESULTS.GRANTED) {
27
27
  console.debug(
28
- "Situm > permissionns > BLUETOOTH_PERIPHERAL permission granted"
28
+ "Situm > permissions > BLUETOOTH_PERIPHERAL permission granted"
29
29
  );
30
30
  return true;
31
31
  } else {
32
- throw "Situm > permissionns > BLUETOOTH_PERIPHERAL permission not granted";
32
+ throw "Situm > permissions > BLUETOOTH_PERIPHERAL permission not granted";
33
33
  }
34
34
  } else {
35
35
  console.debug(
36
- "Situm > permissionns > BLUETOOTH_PERIPHERAL permissions not required"
36
+ "Situm > permissions > BLUETOOTH_PERIPHERAL permissions not required"
37
37
  );
38
38
  return true;
39
39
  }
@@ -44,19 +44,19 @@ const checkAndroidPermissions = async () => {
44
44
 
45
45
  //@ts-ignore
46
46
  if (Platform.Version <= 30) {
47
- console.debug("Situm > permissionns > ANDROID VERSION < 30");
47
+ console.debug("Situm > permissions > ANDROID VERSION < 30");
48
48
 
49
49
  granted = await request(PERMISSIONS.ANDROID.ACCESS_FINE_LOCATION);
50
50
 
51
51
  if (granted === RESULTS.GRANTED) {
52
- console.debug("Situm > permissionns > ACCESS_FINE_LOCATION granted");
52
+ console.debug("Situm > permissions > ACCESS_FINE_LOCATION granted");
53
53
  return true;
54
54
  } else {
55
- throw "Situm > permissionns > ACCESS_FINE_LOCATION permission not granted";
55
+ throw "Situm > permissions > ACCESS_FINE_LOCATION permission not granted";
56
56
  }
57
57
  }
58
58
 
59
- console.debug("Situm > permissionns > ANDROID VERSION > 30");
59
+ console.debug("Situm > permissions > ANDROID VERSION > 30");
60
60
  granted = await requestMultiple([
61
61
  PERMISSIONS.ANDROID.ACCESS_FINE_LOCATION,
62
62
  PERMISSIONS.ANDROID.BLUETOOTH_CONNECT,
@@ -69,20 +69,19 @@ const checkAndroidPermissions = async () => {
69
69
  granted["android.permission.BLUETOOTH_SCAN"] === RESULTS.GRANTED
70
70
  ) {
71
71
  console.debug(
72
- "Situm > permissionns > ACCESS_FINE_LOCATION, BLUETOOTH_CONNECT and BLUETOOTH_SCAN permissions granted"
72
+ "Situm > permissions > ACCESS_FINE_LOCATION, BLUETOOTH_CONNECT and BLUETOOTH_SCAN permissions granted"
73
73
  );
74
74
  return true;
75
75
  }
76
76
 
77
- throw "Situm > permissionns > ACCESS_FINE_LOCATION, BLUETOOTH_CONNECT or BLUETOOTH_SCAN permissions not granted";
77
+ throw "Situm > permissions > ACCESS_FINE_LOCATION, BLUETOOTH_CONNECT or BLUETOOTH_SCAN permissions not granted";
78
78
  };
79
79
 
80
- const requestPermission = () =>
80
+ export const requestPermission = () =>
81
81
  // eslint-disable-next-line no-async-promise-executor
82
82
  new Promise<void>(async (resolve, reject) => {
83
83
  console.log(
84
- "Situm > permissionns > Retrieving permissions for platform " +
85
- Platform.OS
84
+ "Situm > permissions > Retrieving permissions for platform " + Platform.OS
86
85
  );
87
86
  if (Platform.OS === "ios") {
88
87
  await checkIOSPermissions()
@@ -100,7 +99,7 @@ const requestPermission = () =>
100
99
  });
101
100
  }
102
101
 
103
- reject(`Situm > permissionns > Platform '${Platform.OS}' not supported`);
102
+ reject(`Situm > permissions > Platform '${Platform.OS}' not supported`);
104
103
  });
105
104
 
106
105
  export default requestPermission;
@@ -3,42 +3,35 @@
3
3
  import React, { useEffect, useImperativeHandle, useRef, useState } from "react";
4
4
  import { Platform, StyleSheet } from "react-native";
5
5
  import WebView from "react-native-webview";
6
- import {
6
+ import type {
7
7
  WebViewErrorEvent,
8
8
  WebViewMessageEvent,
9
9
  } from "react-native-webview/lib/WebViewTypes";
10
10
 
11
11
  import {
12
- NavigateToPoiType,
12
+ ErrorName,
13
13
  NavigationStatus,
14
14
  NavigationUpdateType,
15
- Poi,
16
- } from "../../sdk/types/index.d";
17
- //This icon should either be inside plugin or not be used rat all
18
- import useSitum from "../hooks";
19
- import { useCallbackRef } from "../hooks";
15
+ type Poi,
16
+ } from "../../";
17
+ import useSitum, { useCallbackRef } from "../hooks";
20
18
  import { setWebViewRef } from "../store";
21
19
  import { useDispatch } from "../store/utils";
22
20
  import {
23
- MapViewError,
24
- MapViewRef,
25
- OnFloorChangedResult,
26
- OnNavigationResult,
27
- OnPoiDeselectedResult,
28
- OnPoiSelectedResult,
29
- WayfindingResult,
30
- } from "../types/index.d";
21
+ type MapViewError,
22
+ type MapViewRef,
23
+ type NavigateToPoiType,
24
+ type OnFloorChangedResult,
25
+ type OnNavigationResult,
26
+ type OnPoiDeselectedResult,
27
+ type OnPoiSelectedResult,
28
+ type WayfindingResult,
29
+ } from "../types";
31
30
  import { sendMessageToViewer } from "../utils";
32
31
  import Mapper from "../utils/mapper";
33
32
 
34
33
  const SITUM_BASE_DOMAIN = "https://map-viewer.situm.com";
35
34
 
36
- // Define class that handles errors
37
- export enum ErrorName {
38
- ERR_INTERNET_DISCONNECTED = "ERR_INTERNET_DISCONNECTED",
39
- ERR_INTERNAL_SERVER_ERROR = "ERR_INTERNAL_SERVER_ERROR",
40
- }
41
-
42
35
  const NETWORK_ERROR_CODE = {
43
36
  android: -2,
44
37
  ios: -1009,
@@ -64,6 +57,7 @@ export interface MapViewProps {
64
57
  maxZoom?: number;
65
58
  initialZoom?: number;
66
59
  useDashboardTheme?: boolean;
60
+ language?: string;
67
61
  };
68
62
  googleApikey?: string;
69
63
  onLoadError?: (event: MapViewError) => void;
@@ -278,6 +272,14 @@ const MapView = React.forwardRef<MapViewRef, MapViewProps>(
278
272
  sendMessageToViewer(webViewRef.current, Mapper.route(directions));
279
273
  }, [directions]);
280
274
 
275
+ useEffect(() => {
276
+ if (!webViewRef.current || !configuration.language || !mapLoaded) return;
277
+ sendMessageToViewer(
278
+ webViewRef.current,
279
+ Mapper.setLanguage(configuration.language)
280
+ );
281
+ }, [configuration.language, mapLoaded]);
282
+
281
283
  useEffect(() => {
282
284
  if (webViewRef.current && mapLoaded) {
283
285
  sendMessageToViewer(