@woosmap/react-native-plugin-geofencing 0.1.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.
Files changed (90) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +340 -0
  3. package/android/.gradle/7.1.1/dependencies-accessors/dependencies-accessors.lock +0 -0
  4. package/android/.gradle/7.1.1/dependencies-accessors/gc.properties +0 -0
  5. package/android/.gradle/7.1.1/executionHistory/executionHistory.lock +0 -0
  6. package/android/.gradle/7.1.1/fileChanges/last-build.bin +0 -0
  7. package/android/.gradle/7.1.1/fileHashes/fileHashes.lock +0 -0
  8. package/android/.gradle/7.1.1/gc.properties +0 -0
  9. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  10. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  11. package/android/.gradle/checksums/checksums.lock +0 -0
  12. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  13. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  14. package/android/.gradle/vcs-1/gc.properties +0 -0
  15. package/android/build.gradle +60 -0
  16. package/android/src/main/AndroidManifest.xml +4 -0
  17. package/android/src/main/java/com/reactnativeplugingeofencing/PluginGeofencingModule.java +365 -0
  18. package/android/src/main/java/com/reactnativeplugingeofencing/PluginGeofencingPackage.java +28 -0
  19. package/android/src/main/java/com/reactnativeplugingeofencing/WoosLocationReadyListener.java +38 -0
  20. package/android/src/main/java/com/reactnativeplugingeofencing/WoosmapMessageAndKey.java +36 -0
  21. package/android/src/main/java/com/reactnativeplugingeofencing/WoosmapUtil.java +34 -0
  22. package/ios/AirshipEvents.swift +73 -0
  23. package/ios/DataDistance.swift +61 -0
  24. package/ios/DataLocation.swift +36 -0
  25. package/ios/DataPOI.swift +38 -0
  26. package/ios/DataRegion.swift +78 -0
  27. package/ios/DataVisit.swift +30 -0
  28. package/ios/DataZOI.swift +22 -0
  29. package/ios/MarketingCloudEvents.swift +64 -0
  30. package/ios/MockDataVisit.swift +167 -0
  31. package/ios/PluginGeofencing-Bridging-Header.h +3 -0
  32. package/ios/PluginGeofencing.m +62 -0
  33. package/ios/PluginGeofencing.swift +688 -0
  34. package/ios/PluginGeofencing.xcodeproj/project.pbxproj +293 -0
  35. package/ios/WoosmapGeofenceMessage.swift +40 -0
  36. package/ios/WoosmapGeofenceService.swift +474 -0
  37. package/ios/WoosmapGeofencingPlugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata +4 -0
  38. package/ios/WoosmapGeofencingPlugin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  39. package/ios/WoosmapGeofencingPlugin.xcodeproj/project.xcworkspace/xcuserdata/saturn.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  40. package/ios/WoosmapGeofencingPlugin.xcodeproj/xcuserdata/saturn.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  41. package/lib/commonjs/Airship.js +35 -0
  42. package/lib/commonjs/Airship.js.map +1 -0
  43. package/lib/commonjs/Location.js +54 -0
  44. package/lib/commonjs/Location.js.map +1 -0
  45. package/lib/commonjs/MarketingCloud.js +35 -0
  46. package/lib/commonjs/MarketingCloud.js.map +1 -0
  47. package/lib/commonjs/Poi.js +96 -0
  48. package/lib/commonjs/Poi.js.map +1 -0
  49. package/lib/commonjs/Region.js +62 -0
  50. package/lib/commonjs/Region.js.map +1 -0
  51. package/lib/commonjs/Visit.js +50 -0
  52. package/lib/commonjs/Visit.js.map +1 -0
  53. package/lib/commonjs/Zoi.js +97 -0
  54. package/lib/commonjs/Zoi.js.map +1 -0
  55. package/lib/commonjs/index.js +276 -0
  56. package/lib/commonjs/index.js.map +1 -0
  57. package/lib/module/Airship.js +33 -0
  58. package/lib/module/Airship.js.map +1 -0
  59. package/lib/module/Location.js +46 -0
  60. package/lib/module/Location.js.map +1 -0
  61. package/lib/module/MarketingCloud.js +33 -0
  62. package/lib/module/MarketingCloud.js.map +1 -0
  63. package/lib/module/Poi.js +94 -0
  64. package/lib/module/Poi.js.map +1 -0
  65. package/lib/module/Region.js +54 -0
  66. package/lib/module/Region.js.map +1 -0
  67. package/lib/module/Visit.js +48 -0
  68. package/lib/module/Visit.js.map +1 -0
  69. package/lib/module/Zoi.js +95 -0
  70. package/lib/module/Zoi.js.map +1 -0
  71. package/lib/module/index.js +261 -0
  72. package/lib/module/index.js.map +1 -0
  73. package/lib/typescript/Airship.d.ts +18 -0
  74. package/lib/typescript/Location.d.ts +26 -0
  75. package/lib/typescript/MarketingCloud.d.ts +18 -0
  76. package/lib/typescript/Poi.d.ts +48 -0
  77. package/lib/typescript/Region.d.ts +30 -0
  78. package/lib/typescript/Visit.d.ts +25 -0
  79. package/lib/typescript/Zoi.d.ts +49 -0
  80. package/lib/typescript/index.d.ts +97 -0
  81. package/package.json +150 -0
  82. package/react-native-plugin-geofencing.podspec +20 -0
  83. package/src/Airship.tsx +24 -0
  84. package/src/Location.tsx +46 -0
  85. package/src/MarketingCloud.tsx +24 -0
  86. package/src/Poi.tsx +106 -0
  87. package/src/Region.tsx +56 -0
  88. package/src/Visit.tsx +49 -0
  89. package/src/Zoi.tsx +107 -0
  90. package/src/index.tsx +255 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 WGS Indoor
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,340 @@
1
+ ![woosmap](https://avatars.githubusercontent.com/u/1203240?s=200&v=4)
2
+
3
+ # react-native-plugin-geofencing
4
+
5
+ This react-native plugin extends the functionality offered by the Woosmap Geofencing Mobile SDKs. Find more about the Woosmap Geofencing SDK
6
+
7
+ ## Installation
8
+
9
+ ```sh
10
+ npm install @woosmap/react-native-plugin-geofencing
11
+ ```
12
+
13
+ **Adding the platform**
14
+
15
+ For iOS
16
+
17
+ - **info.plist**: Please check info.plist updated with following keys
18
+ - NSLocationAlwaysAndWhenInUseUsageDescription
19
+ - NSLocationAlwaysUsageDescription
20
+ - NSLocationWhenInUseUsageDescription
21
+ - UIBackgroundModes
22
+
23
+ ```
24
+ <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
25
+ <string>Used to test the library</string>
26
+ <key>NSLocationAlwaysUsageDescription</key>
27
+ <string>Used to test the library</string>
28
+ <key>NSLocationWhenInUseUsageDescription</key>
29
+ <string>Used to test the library</string>
30
+ <key>UIBackgroundModes</key>
31
+ <array>
32
+ <string>location</string>
33
+ </array>
34
+
35
+ ```
36
+ - **Podfile**: configure to use ```use_frameworks!``` and ```platform :ios, '12.0'```
37
+ if you are using **M1 Mac** Update pod post installation like
38
+ ```
39
+ post_install do |installer|
40
+ installer.pods_project.targets.each do |target|
41
+ target.build_configurations.each do |config|
42
+ config.build_settings["ONLY_ACTIVE_ARCH"] = "NO"
43
+ config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
44
+ end
45
+ end
46
+ end
47
+ ```
48
+
49
+ For Android
50
+ - ToDo: Please update for Android
51
+
52
+ ### Supported Platforms ###
53
+ ---
54
+ - iOS
55
+ - Android
56
+
57
+ ### Modules
58
+ ---
59
+ * **WoosmapGeofencing**: Woosmap contains methods to monitor location, regions.
60
+
61
+ ### Objects(Read Only)
62
+ ---
63
+ * **Location**: Represents the location object
64
+ * **POI**: Represents Point of Interest
65
+ * **Region**: Represents a geographical region/geofence
66
+ * **Visit**: Represents a visit to a location/POI
67
+ * **ZOI**: Represents Zone of Interest
68
+ * **Airship**: Contains custom data related to Airship implementation
69
+ * **MarketingCloud**: Contains custom data related to third party marketing cloud implementation
70
+
71
+ ## Usage
72
+
73
+ ``` javascript
74
+ import WoosmapGeofencing from 'react-native-plugin-geofencing';
75
+
76
+ // ...
77
+
78
+ ```
79
+
80
+ ### Check and request permissions
81
+ ---
82
+ Before initializing the SDK it is required that you request for required location permissions.
83
+
84
+ To check if the location permissions are granted by the user call `getPermissionsStatus` method.
85
+
86
+ ``` javascript
87
+ WoosmapGeofencing.getPermissionsStatus()
88
+ .then((status: string) => {
89
+ console.log(status);
90
+ })
91
+ .catch((error: any) => {
92
+ alert('message: ' + error.message);
93
+ });
94
+ ```
95
+
96
+ Parameter status will be a string, one of:
97
+ * `GRANTED_BACKGROUND` : User has granted location access even when app is not running in the foreground
98
+ * `GRANTED_FOREGROUND` : Location access is granted only while user is using the app
99
+ * `DENIED`: Location access is denied
100
+
101
+ **_Please note_**: Plugin will not work as expected if location access is denied.
102
+
103
+ **Requesting location access**
104
+ To request location access call `requestPermissions` method of the plugin. This will result in displaying location access permission dialog. This method accepts a boolean parameter `isBackground`. If this parameter is set to true, then plugin will ask for background location access. Code snippet below asks for background location access.
105
+
106
+ ``` javascript
107
+ WoosmapGeofencing.requestPermissions(props.background)
108
+ .then((status: string) => {
109
+ console.log(status);
110
+ })
111
+ .catch((error: any) => {
112
+ alert('message: ' + error.message);
113
+ });
114
+
115
+ ```
116
+
117
+ ### Initializing the plugin
118
+ ---
119
+
120
+ Plugin can be initialized by simply calling `initialize` method.
121
+
122
+ ``` javascript
123
+ var woosmapSettings = {
124
+ privateKeyWoosmapAPI: "<<WOOSMAP_KEY>>",
125
+ trackingProfile: "liveTracking"
126
+ };
127
+ WoosmapGeofencing.initialize(woosmapSettings)
128
+ .then((value: string) => {
129
+ console.log(value);
130
+ })
131
+ .catch((error: any) => {
132
+ alert('message: ' + error.message);
133
+ });
134
+ ```
135
+
136
+ Both configuration options `privateKeyWoosmapAPI` and `trackingProfile` are optional. You can also initialize the plugin by passing null configuration.
137
+
138
+ ```
139
+ await WoosmapGeofencing.initialize();
140
+ ```
141
+
142
+ You can also set the Woosmap API key later by calling `setWoosmapApiKey` method.
143
+
144
+ ``` javascript
145
+ WoosmapGeofencing.setWoosmapApiKey(<privateKeyWoosmapAPI>)
146
+ .then((value: string) => {
147
+ console.log(value);
148
+ })
149
+ .catch((error: any) => {
150
+ alert('message: ' + error.message);
151
+ });
152
+ ```
153
+
154
+ ### Tracking
155
+ ---
156
+
157
+ Once you have initialized the plugin and the user has authorized location permissions, you can start tracking the user’s location.
158
+
159
+ To start tracking, call:
160
+ ``` javascript
161
+ WoosmapGeofencing.startTracking('liveTracking')
162
+ .then((result: string) => {
163
+ console.log(value);
164
+ })
165
+ .catch((error: any) => {
166
+ alert('message: ' + error.message);
167
+ });
168
+
169
+ ```
170
+
171
+ To stop tracking, call:
172
+ ``` javascript
173
+ WoosmapGeofencing.stopTracking()
174
+ .then((value: any) => {
175
+ console.log(value);
176
+ })
177
+ .catch((error: any) => {
178
+ alert('message: ' + error.message);
179
+ });
180
+ ```
181
+
182
+ Method `startTracking` accepts only following tracking profiles
183
+
184
+ * **liveTracking**
185
+ * **passiveTracking**
186
+ * **visitsTracking**
187
+
188
+ ### Tracking profile properties
189
+ ---
190
+
191
+ | Property | liveTracking | passiveTracking | visitsTracking
192
+ | ----------- | ----------- | ----------- | ----------- |
193
+ | trackingEnable | true | true | true
194
+ | foregroundLocationServiceEnable | true | false | false
195
+ | modeHighFrequencyLocation | true | false | false
196
+ | visitEnable | false | false | true
197
+ | classificationEnable | false | false | true
198
+ | minDurationVisitDisplay | null | null | 300
199
+ | radiusDetectionClassifiedZOI | null | null | 50
200
+ | distanceDetectionThresholdVisits | null | null | 25
201
+ | currentLocationTimeFilter | 0 | 0 | 0
202
+ | currentLocationDistanceFilter | 0 | 0 | 0
203
+ | accuracyFilter | 100 | 100 | 100
204
+ | searchAPIEnable | false | true | false
205
+ | searchAPICreationRegionEnable | false | true | false
206
+ | searchAPITimeFilter | 0 | 0 | 0
207
+ | searchAPIDistanceFilter | 0 | 0 | 0
208
+ | distanceAPIEnable | false | false | false
209
+ | modeDistance | null | null | null
210
+ | outOfTimeDelay | 300 | 300 | 300
211
+ | DOUBLEOfDayDataDuration | 30 | 30 | 30
212
+
213
+ ### Listening to events
214
+ ---
215
+
216
+ **Location**
217
+
218
+ To listen to location, call `watchLocation` method. Method will invoke callback and pass a location object as a parameter. Method will return a watchId . This id can be used to remove a callback.
219
+
220
+ ``` javascript
221
+ const callback = (value: Location) => {
222
+ alert('message: ' + JSON.stringify(value));
223
+ };
224
+
225
+ WoosmapGeofencing.watchLocation(callback)
226
+ .then((watchRef: string) => {
227
+ //Keep watchRef, it requires when you wish to remove location watch.
228
+ console.log('Watch added');
229
+ })
230
+ .catch((error: any) => {
231
+ alert('message: ' + error.message);
232
+ });
233
+ ```
234
+
235
+ To stop getting location updates:
236
+
237
+ ``` javascript
238
+ WoosmapGeofencing.clearLocationWatch(watchID)
239
+ .then((watchRef: string) => {
240
+ console.log(watchRef);
241
+ })
242
+ .catch((error: any) => {
243
+ alert('message: ' + error.message);
244
+ });
245
+ ```
246
+
247
+ **Define the radius value**
248
+
249
+ When you create a Geofence around a POI (previously imported from Woosmap), manually define the radius value:
250
+ ```javascript
251
+ WoosmapGeofencing.setPoiRadius("100")
252
+ .then((value: string) => {
253
+ console.log(value);
254
+ })
255
+ .catch((error: any) => {
256
+ alert('message: ' + error.message);
257
+ });
258
+ ```
259
+ or choose the user_properties subfield that corresponds to radius value of the Geofence:
260
+ ```javascript
261
+ WoosmapGeofencing.setPoiRadius("radiusPOI")
262
+ .then((value: string) => {
263
+ console.log(value);
264
+ })
265
+ .catch((error: any) => {
266
+ alert('message: ' + error.message);
267
+ });
268
+ ```
269
+
270
+ **Regions**
271
+
272
+ Call `watchRegions` method to track Regions. Method will invoke a callback with Region object. Method will return a watch id which can be used later to remove the callback.
273
+
274
+ ``` javascript
275
+ WoosmapGeofencing.watchRegions(callback)
276
+ .then((watchRef: string) => {
277
+ //Keep watchRef, it requires when you wish to remove region watch.
278
+ console.log('Watch added');
279
+ })
280
+ .catch((error: any) => {
281
+ alert('message: ' + error.message);
282
+ });
283
+ ```
284
+
285
+ To remove watch:
286
+
287
+ ``` javascript
288
+ WoosmapGeofencing.clearRegionsWatch(watchID)
289
+ .then((watchRef: string) => {
290
+ console.log(watchRef);
291
+ })
292
+ .catch((error: any) => {
293
+ alert('message: ' + error.message);
294
+ });
295
+ ```
296
+ ### Initialize Salesforce MarketingCloud Connector
297
+ ---
298
+
299
+ The SDK needs some input like credentials and object key to perform the API call to Salesforce Marketing Cloud API.
300
+
301
+ **Input to initialize the SFMC connector**<br/>
302
+
303
+ | Parameters | Description | Required |
304
+ | -------------------------------------- | --------------------------------------------------------------------------------------------------------- | -------- |
305
+ | authenticationBaseURI | Authentication Base URI | Required |
306
+ | restBaseURI | REST Base URI | Required |
307
+ | client\_id | client\_id (journey\_read and list\_and\_subscribers\_read rights are required) | Required |
308
+ | client\_secret | client\_secret (journey\_read and list\_and\_subscribers\_read rights are required) | Required |
309
+ | contactKey | The ID that uniquely identifies a subscriber/contact | Required |
310
+ | regionEnteredEventDefinitionKey | Set the EventDefinitionKey that you want to use for the Woosmap event `woos_geofence_entered_event` | |
311
+ | regionExitedEventDefinitionKey | Set the EventDefinitionKey that you want to use for the Woosmap event `woos_geofence_exited_event` | |
312
+ | poiEventDefinitionKey | Set the EventDefinitionKey that you want to use for the Woosmap event `woos_POI_event` | |
313
+ | zoiClassifiedEnteredEventDefinitionKey | Set the EventDefinitionKey that you want to use for the Woosmap event `woos_zoi_classified_entered_event` | |
314
+ | zoiClassifiedExitedEventDefinitionKey | Set the EventDefinitionKey that you want to use for the Woosmap event `woos_zoi_classified_exited_event` | |
315
+ | visitEventDefinitionKey | Set the EventDefinitionKey that you want to use for the Woosmap event `woos_Visit_event` |
316
+
317
+ **Initialize the connector implementation**
318
+ ``` javascript
319
+ var sfmcCredentials = {
320
+ authenticationBaseURI: "https://xxxxxxxxxx.auth.marketingcloudapis.com",
321
+ restBaseURI: "https://xxxxxxxxxx.rest.marketingcloudapis.com",
322
+ client_id: "xxxxxxxxxxxxxxx",
323
+ client_secret: "xxxxxxxxxxxxxxx",
324
+ contactKey: "ID001",
325
+ regionEnteredEventDefinitionKey: "APIEvent-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
326
+ regionExitedEventDefinitionKey: "APIEvent-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
327
+ };
328
+ WoosmapGeofencing.setSFMCCredentials(sfmcCredentials)
329
+ .then((value: any) => {
330
+ console.log(value);
331
+ })
332
+ .catch((error: any) => {
333
+ alert('message: ' + error.message);
334
+ });
335
+ ```
336
+
337
+
338
+ ## License
339
+
340
+ MIT
File without changes
@@ -0,0 +1,2 @@
1
+ #Sun Apr 10 13:29:32 IST 2022
2
+ gradle.version=7.1.1
File without changes
@@ -0,0 +1,60 @@
1
+ buildscript {
2
+ if (project == rootProject) {
3
+ repositories {
4
+ google()
5
+ mavenCentral()
6
+ jcenter()
7
+ }
8
+
9
+ dependencies {
10
+ classpath 'com.android.tools.build:gradle:3.5.4'
11
+ }
12
+ }
13
+ }
14
+
15
+ apply plugin: 'com.android.library'
16
+
17
+ def safeExtGet(prop, fallback) {
18
+ rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
19
+ }
20
+
21
+ android {
22
+ compileSdkVersion safeExtGet('PluginGeofencing_compileSdkVersion', 29)
23
+ defaultConfig {
24
+ minSdkVersion safeExtGet('PluginGeofencing_minSdkVersion', 21)
25
+ targetSdkVersion safeExtGet('PluginGeofencing_targetSdkVersion', 29)
26
+ versionCode 1
27
+ versionName "1.0"
28
+
29
+ }
30
+
31
+ buildTypes {
32
+ release {
33
+ minifyEnabled false
34
+ }
35
+ }
36
+ lintOptions {
37
+ disable 'GradleCompatible'
38
+ }
39
+ compileOptions {
40
+ sourceCompatibility JavaVersion.VERSION_1_8
41
+ targetCompatibility JavaVersion.VERSION_1_8
42
+ }
43
+ }
44
+
45
+ repositories {
46
+ mavenLocal()
47
+ maven {
48
+ // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
49
+ url("$rootDir/../node_modules/react-native/android")
50
+ }
51
+ google()
52
+ mavenCentral()
53
+ jcenter()
54
+ }
55
+
56
+ dependencies {
57
+ //noinspection GradleDynamicVersion
58
+ implementation "com.facebook.react:react-native:+" // From node_modules
59
+ implementation("com.webgeoservices.woosmapgeofencing:woosmap-mobile-sdk:1.2.1")
60
+ }
@@ -0,0 +1,4 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+ package="com.reactnativeplugingeofencing">
3
+
4
+ </manifest>