@woosmap/react-native-plugin-geofencing 0.1.5 → 0.1.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/README.md +219 -19
- package/android/build.gradle +7 -0
- package/android/src/main/java/com/reactnativeplugingeofencing/PluginGeofencingModule.java +328 -35
- package/android/src/main/java/com/reactnativeplugingeofencing/WoosmapMessageAndKey.java +17 -0
- package/android/src/main/java/com/reactnativeplugingeofencing/WoosmapTask.java +299 -0
- package/android/src/main/java/com/reactnativeplugingeofencing/WoosmapUtil.java +118 -2
- package/ios/DataLocation.swift +4 -0
- package/ios/DataPOI.swift +11 -0
- package/ios/DataRegion.swift +33 -3
- package/ios/PluginGeofencing.m +43 -0
- package/ios/PluginGeofencing.swift +377 -22
- package/ios/WoosmapGeofenceMessage.swift +12 -0
- package/ios/WoosmapGeofenceService.swift +203 -30
- package/lib/commonjs/index.js +171 -68
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/{Airship.js → internal/Airship.js} +0 -0
- package/lib/commonjs/{Airship.js.map → internal/Airship.js.map} +0 -0
- package/lib/commonjs/{Location.js → internal/Location.js} +0 -0
- package/lib/commonjs/{Location.js.map → internal/Location.js.map} +0 -0
- package/lib/commonjs/{MarketingCloud.js → internal/MarketingCloud.js} +0 -0
- package/lib/commonjs/{MarketingCloud.js.map → internal/MarketingCloud.js.map} +0 -0
- package/lib/{module → commonjs/internal}/Poi.js +10 -1
- package/lib/commonjs/internal/Poi.js.map +1 -0
- package/lib/commonjs/{Region.js → internal/Region.js} +0 -0
- package/lib/commonjs/{Region.js.map → internal/Region.js.map} +0 -0
- package/lib/commonjs/{Visit.js → internal/Visit.js} +0 -0
- package/lib/commonjs/{Visit.js.map → internal/Visit.js.map} +0 -0
- package/lib/commonjs/{Zoi.js → internal/Zoi.js} +0 -0
- package/lib/commonjs/{Zoi.js.map → internal/Zoi.js.map} +0 -0
- package/lib/commonjs/internal/nativeInterface.js +18 -0
- package/lib/commonjs/internal/nativeInterface.js.map +1 -0
- package/lib/commonjs/internal/types.js +2 -0
- package/lib/commonjs/internal/types.js.map +1 -0
- package/lib/module/index.js +155 -53
- package/lib/module/index.js.map +1 -1
- package/lib/module/{Airship.js → internal/Airship.js} +0 -0
- package/lib/module/{Airship.js.map → internal/Airship.js.map} +0 -0
- package/lib/module/{Location.js → internal/Location.js} +0 -0
- package/lib/module/{Location.js.map → internal/Location.js.map} +0 -0
- package/lib/module/{MarketingCloud.js → internal/MarketingCloud.js} +0 -0
- package/lib/module/{MarketingCloud.js.map → internal/MarketingCloud.js.map} +0 -0
- package/lib/{commonjs → module/internal}/Poi.js +2 -3
- package/lib/module/internal/Poi.js.map +1 -0
- package/lib/module/{Region.js → internal/Region.js} +0 -0
- package/lib/module/{Region.js.map → internal/Region.js.map} +0 -0
- package/lib/module/{Visit.js → internal/Visit.js} +0 -0
- package/lib/module/{Visit.js.map → internal/Visit.js.map} +0 -0
- package/lib/module/{Zoi.js → internal/Zoi.js} +0 -0
- package/lib/module/{Zoi.js.map → internal/Zoi.js.map} +0 -0
- package/lib/module/internal/nativeInterface.js +9 -0
- package/lib/module/internal/nativeInterface.js.map +1 -0
- package/lib/module/internal/types.js +2 -0
- package/lib/module/internal/types.js.map +1 -0
- package/lib/typescript/index.d.ts +63 -4
- package/lib/typescript/{Airship.d.ts → internal/Airship.d.ts} +0 -0
- package/lib/typescript/{Location.d.ts → internal/Location.d.ts} +0 -0
- package/lib/typescript/{MarketingCloud.d.ts → internal/MarketingCloud.d.ts} +0 -0
- package/lib/typescript/{Poi.d.ts → internal/Poi.d.ts} +4 -2
- package/lib/typescript/{Region.d.ts → internal/Region.d.ts} +0 -0
- package/lib/typescript/{Visit.d.ts → internal/Visit.d.ts} +0 -0
- package/lib/typescript/{Zoi.d.ts → internal/Zoi.d.ts} +0 -0
- package/lib/typescript/internal/nativeInterface.d.ts +2 -0
- package/lib/typescript/internal/types.d.ts +18 -0
- package/package.json +1 -1
- package/src/index.tsx +173 -53
- package/src/{Airship.tsx → internal/Airship.tsx} +0 -0
- package/src/{Location.tsx → internal/Location.tsx} +0 -0
- package/src/{MarketingCloud.tsx → internal/MarketingCloud.tsx} +0 -0
- package/src/{Poi.tsx → internal/Poi.tsx} +4 -3
- package/src/{Region.tsx → internal/Region.tsx} +0 -0
- package/src/{Visit.tsx → internal/Visit.tsx} +0 -0
- package/src/{Zoi.tsx → internal/Zoi.tsx} +0 -0
- package/src/internal/nativeInterface.tsx +8 -0
- package/src/internal/types.tsx +20 -0
- package/lib/commonjs/Poi.js.map +0 -1
- package/lib/module/Poi.js.map +0 -1
package/lib/module/index.js
CHANGED
|
@@ -1,43 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NativeEventEmitter } from 'react-native';
|
|
2
2
|
import uuid from 'react-native-uuid';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// '- You rebuilt the app after installing the package\n' +
|
|
8
|
-
// '- You are not using Expo managed workflow\n';
|
|
9
|
-
// const PluginGeofencing = NativeModules.PluginGeofencing
|
|
10
|
-
// ? NativeModules.PluginGeofencing
|
|
11
|
-
// : new Proxy(
|
|
12
|
-
// {},
|
|
13
|
-
// {
|
|
14
|
-
// get() {
|
|
15
|
-
// throw new Error(LINKING_ERROR);
|
|
16
|
-
// },
|
|
17
|
-
// }
|
|
18
|
-
// );
|
|
19
|
-
|
|
20
|
-
if (!NativeModules.PluginGeofencing) {
|
|
21
|
-
throw new Error('NativeModules.PluginGeofencing is undefined');
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const PluginGeofencing = NativeModules.PluginGeofencing; // ? NativeModules.PluginGeofencing
|
|
25
|
-
// : new Proxy(
|
|
26
|
-
// {},
|
|
27
|
-
// {
|
|
28
|
-
// get() {
|
|
29
|
-
// throw new Error(LINKING_ERROR);
|
|
30
|
-
// },
|
|
31
|
-
// }
|
|
32
|
-
// );
|
|
33
|
-
|
|
3
|
+
import PluginGeofencing from './internal/nativeInterface';
|
|
4
|
+
import Location from './internal/Location';
|
|
5
|
+
import Region from './internal/Region';
|
|
6
|
+
import Poi from './internal/Poi';
|
|
34
7
|
const eventEmitter = new NativeEventEmitter(PluginGeofencing);
|
|
35
8
|
let subscriptionsLocation = {};
|
|
36
9
|
let subscriptionsRegion = {};
|
|
37
|
-
|
|
38
|
-
function multiply(a, b) {
|
|
39
|
-
return PluginGeofencing.multiply(a, b);
|
|
40
|
-
}
|
|
41
10
|
/**
|
|
42
11
|
* Initializes the Woosmap object
|
|
43
12
|
* @param arg0 A JSON object with Woosmap Key (optional) and tracking profile (`liveTracking`,`passiveTracking`,`visitsTracking`).
|
|
@@ -45,7 +14,6 @@ function multiply(a, b) {
|
|
|
45
14
|
error - A callback function that will be called on error.
|
|
46
15
|
*/
|
|
47
16
|
|
|
48
|
-
|
|
49
17
|
function initialize(arg0) {
|
|
50
18
|
if (arg0 == null) {
|
|
51
19
|
arg0 = {};
|
|
@@ -228,9 +196,148 @@ function setSFMCCredentials(arg0) {
|
|
|
228
196
|
function setPoiRadius(radius) {
|
|
229
197
|
return PluginGeofencing.setPoiRadius(radius);
|
|
230
198
|
}
|
|
199
|
+
/**
|
|
200
|
+
* Adds a custom region that you want to monitor.
|
|
201
|
+
* @param region A GeofenceRegion object with latitude, longitude, radius and type.
|
|
202
|
+
* @returns promise with A callback that will be called on success or error.
|
|
203
|
+
*/
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
function addRegion(region) {
|
|
207
|
+
return PluginGeofencing.addRegion(region);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Retrieve saved region info
|
|
211
|
+
* @param regionID If it pass return info for given region or return all region info
|
|
212
|
+
* @returns promise with A callback that will be called on success or error.
|
|
213
|
+
*/
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
function getRegions(regionID) {
|
|
217
|
+
if (regionID == null) {
|
|
218
|
+
return PluginGeofencing.getAllRegions().then(result => {
|
|
219
|
+
var formatted = [];
|
|
220
|
+
result.forEach(item => {
|
|
221
|
+
formatted.push(Region.jsonToObj(item));
|
|
222
|
+
});
|
|
223
|
+
return Promise.resolve(formatted);
|
|
224
|
+
}).catch(e => {
|
|
225
|
+
return Promise.reject(e);
|
|
226
|
+
});
|
|
227
|
+
} else {
|
|
228
|
+
return PluginGeofencing.getRegions(regionID).then(result => {
|
|
229
|
+
var formatted = [];
|
|
230
|
+
formatted.push(Region.jsonToObj(result));
|
|
231
|
+
return Promise.resolve(formatted);
|
|
232
|
+
}).catch(e => {
|
|
233
|
+
return Promise.reject(e);
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Retrieve saved location info
|
|
239
|
+
* @param locationID - Optional in case of location id pass it return only that location info
|
|
240
|
+
* @returns promise with A callback that will be called on success or error.
|
|
241
|
+
*/
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
function getLocations(locationID) {
|
|
245
|
+
if (locationID == null) {
|
|
246
|
+
return PluginGeofencing.getAllLocations().then(result => {
|
|
247
|
+
var formatted = [];
|
|
248
|
+
result.forEach(item => {
|
|
249
|
+
formatted.push(Location.jsonToObj(item));
|
|
250
|
+
});
|
|
251
|
+
return Promise.resolve(formatted);
|
|
252
|
+
}).catch(e => {
|
|
253
|
+
return Promise.reject(e);
|
|
254
|
+
});
|
|
255
|
+
} else {
|
|
256
|
+
return PluginGeofencing.getLocation(locationID).then(result => {
|
|
257
|
+
var formatted = [];
|
|
258
|
+
formatted.push(Location.jsonToObj(result));
|
|
259
|
+
return Promise.resolve(formatted);
|
|
260
|
+
}).catch(e => {
|
|
261
|
+
return Promise.reject(e);
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Retrieve saved POI info
|
|
267
|
+
* @param poiID - Optional in case of poi id (LocationID or StoreID) pass it return only that POI info
|
|
268
|
+
* @returns promise with A callback that will be called on success or error.
|
|
269
|
+
*/
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
function getPois(poiID) {
|
|
273
|
+
if (poiID == null) {
|
|
274
|
+
return PluginGeofencing.getAllPois().then(result => {
|
|
275
|
+
var formatted = [];
|
|
276
|
+
result.forEach(item => {
|
|
277
|
+
formatted.push(Poi.jsonToObj(item));
|
|
278
|
+
});
|
|
279
|
+
return Promise.resolve(formatted);
|
|
280
|
+
}).catch(e => {
|
|
281
|
+
return Promise.reject(e);
|
|
282
|
+
});
|
|
283
|
+
} else {
|
|
284
|
+
return PluginGeofencing.getPoi(poiID).then(result => {
|
|
285
|
+
var formatted = [];
|
|
286
|
+
formatted.push(Poi.jsonToObj(result));
|
|
287
|
+
return Promise.resolve(formatted);
|
|
288
|
+
}).catch(e => {
|
|
289
|
+
return Promise.reject(e);
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Remove saved region info
|
|
295
|
+
* @param regionID If it pass remove info for given region or removes all region info
|
|
296
|
+
* @returns promise with A callback that will be called on success or error.
|
|
297
|
+
*/
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
function removeRegions(regionID) {
|
|
301
|
+
if (regionID == null) {
|
|
302
|
+
return PluginGeofencing.removeAllRegions();
|
|
303
|
+
} else {
|
|
304
|
+
return PluginGeofencing.removeRegion(regionID);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Remove saved location info
|
|
309
|
+
* @returns promise with A callback that will be called on success or error.
|
|
310
|
+
*/
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
function removeLocations() {
|
|
314
|
+
return PluginGeofencing.removeAllLocations();
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Remove saved POI info
|
|
318
|
+
* @returns promise with A callback that will be called on success or error.
|
|
319
|
+
*/
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
function removePois() {
|
|
323
|
+
return PluginGeofencing.removeAllPois();
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* if preset tracking profiles don’t fit with your use cases, you can build your own profile and uses the startCustomTracking() method.
|
|
327
|
+
* There are two way to host the json file:
|
|
328
|
+
* - included in the client application (local)
|
|
329
|
+
* - hosted externally in a file folder in your information system (external)
|
|
330
|
+
* @param sourceType local/external
|
|
331
|
+
* @param source location of profile to be fetch
|
|
332
|
+
* @returns promise with A callback that will be called on success or error.
|
|
333
|
+
*/
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
function startCustomTracking(sourceType, source) {
|
|
337
|
+
return PluginGeofencing.startCustomTracking(sourceType, source);
|
|
338
|
+
}
|
|
231
339
|
|
|
232
340
|
const WoosmapGeofencing = {
|
|
233
|
-
multiply,
|
|
234
341
|
initialize,
|
|
235
342
|
setWoosmapApiKey,
|
|
236
343
|
startTracking,
|
|
@@ -242,20 +349,15 @@ const WoosmapGeofencing = {
|
|
|
242
349
|
watchRegions,
|
|
243
350
|
clearRegionsWatch,
|
|
244
351
|
setSFMCCredentials,
|
|
245
|
-
setPoiRadius
|
|
352
|
+
setPoiRadius,
|
|
353
|
+
addRegion,
|
|
354
|
+
getRegions,
|
|
355
|
+
removeRegions,
|
|
356
|
+
getLocations,
|
|
357
|
+
removeLocations,
|
|
358
|
+
getPois,
|
|
359
|
+
removePois,
|
|
360
|
+
startCustomTracking
|
|
246
361
|
};
|
|
247
|
-
|
|
248
|
-
* JavaScript code and the tests
|
|
249
|
-
*/
|
|
250
|
-
//let nativeEventEmitter: NativeEventEmitter | null = null;
|
|
251
|
-
|
|
252
|
-
export default WoosmapGeofencing; // module.exports = {
|
|
253
|
-
// WoosmapGeofencing,
|
|
254
|
-
// get GeolocationEventEmitter() {
|
|
255
|
-
// if (!nativeEventEmitter) {
|
|
256
|
-
// nativeEventEmitter = new NativeEventEmitter(PluginGeofencing);
|
|
257
|
-
// }
|
|
258
|
-
// return nativeEventEmitter;
|
|
259
|
-
// },
|
|
260
|
-
// };
|
|
362
|
+
export default WoosmapGeofencing;
|
|
261
363
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.tsx"],"names":["NativeModules","NativeEventEmitter","uuid","Location","Region","PluginGeofencing","Error","eventEmitter","subscriptionsLocation","subscriptionsRegion","multiply","a","b","initialize","arg0","setWoosmapApiKey","apiKey","startTracking","trackingProfile","stopTracking","requestPermissions","background","getPermissionsStatus","watchLocation","success","error","watchID","v1","toString","successCallback","result","jsonToObj","addListener","clearLocationWatch","removeAllListeners","clearAllLocationWatch","saved","removeListener","arg1","undefined","watchRegions","clearRegionsWatch","clearAllRegionsWatch","setSFMCCredentials","setPoiRadius","radius","WoosmapGeofencing"],"mappings":"AAAA,SAASA,aAAT,EAAwBC,kBAAxB,QAAkD,cAAlD;AACA,OAAOC,IAAP,MAAiB,mBAAjB;AACA,OAAOC,QAAP,MAAqB,YAArB;AACA,OAAOC,MAAP,MAAmB,UAAnB,C,CAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAI,CAACJ,aAAa,CAACK,gBAAnB,EAAqC;AACnC,QAAM,IAAIC,KAAJ,CAAU,6CAAV,CAAN;AACD;;AACD,MAAMD,gBAAgB,GAAGL,aAAa,CAACK,gBAAvC,C,CACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAME,YAAY,GAAG,IAAIN,kBAAJ,CAAuBI,gBAAvB,CAArB;AAEA,IAAIG,qBAA0B,GAAG,EAAjC;AACA,IAAIC,mBAAwB,GAAG,EAA/B;;AAEA,SAASC,QAAT,CAAkBC,CAAlB,EAA6BC,CAA7B,EAAyD;AACvD,SAAOP,gBAAgB,CAACK,QAAjB,CAA0BC,CAA1B,EAA6BC,CAA7B,CAAP;AACD;AACD;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,UAAT,CAAoBC,IAApB,EAAiD;AAC/C,MAAIA,IAAI,IAAI,IAA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B,YAAT,CAAsBC,MAAtB,EAAuD;AACrD,SAAOxC,gBAAgB,CAACuC,YAAjB,CAA8BC,MAA9B,CAAP;AACD;;AAED,MAAMC,iBAAiB,GAAG;AACxBpC,EAAAA,QADwB;AAExBG,EAAAA,UAFwB;AAGxBE,EAAAA,gBAHwB;AAIxBE,EAAAA,aAJwB;AAKxBG,EAAAA,kBALwB;AAMxBE,EAAAA,oBANwB;AAOxBH,EAAAA,YAPwB;AAQxBI,EAAAA,aARwB;AASxBU,EAAAA,kBATwB;AAUxBO,EAAAA,YAVwB;AAWxBC,EAAAA,iBAXwB;AAYxBE,EAAAA,kBAZwB;AAaxBC,EAAAA;AAbwB,CAA1B;AAgBA;AACA;AACA;AACA;;AAEA,eAAeE,iBAAf,C,CACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sourcesContent":["import { NativeModules, NativeEventEmitter } from 'react-native';\nimport uuid from 'react-native-uuid';\nimport Location from './Location';\nimport Region from './Region';\n\n// const LINKING_ERROR =\n// `The package 'react-native-plugin-geofencing' doesn't seem to be linked. Make sure: \\n\\n` +\n// Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n// '- You rebuilt the app after installing the package\\n' +\n// '- You are not using Expo managed workflow\\n';\n\n// const PluginGeofencing = NativeModules.PluginGeofencing\n// ? NativeModules.PluginGeofencing\n// : new Proxy(\n// {},\n// {\n// get() {\n// throw new Error(LINKING_ERROR);\n// },\n// }\n// );\n\nif (!NativeModules.PluginGeofencing) {\n throw new Error('NativeModules.PluginGeofencing is undefined');\n}\nconst PluginGeofencing = NativeModules.PluginGeofencing;\n// ? NativeModules.PluginGeofencing\n// : new Proxy(\n// {},\n// {\n// get() {\n// throw new Error(LINKING_ERROR);\n// },\n// }\n// );\nconst eventEmitter = new NativeEventEmitter(PluginGeofencing);\n\nlet subscriptionsLocation: any = {};\nlet subscriptionsRegion: any = {};\n\nfunction multiply(a: number, b: number): Promise<number> {\n return PluginGeofencing.multiply(a, b);\n}\n/**\n * Initializes the Woosmap object\n * @param arg0 A JSON object with Woosmap Key (optional) and tracking profile (`liveTracking`,`passiveTracking`,`visitsTracking`).\n * @returns promise:success - A callback function that will be called on success.\n error - A callback function that will be called on error.\n */\nfunction initialize(arg0?: any): Promise<string> {\n if (arg0 == null) {\n arg0 = {};\n }\n return PluginGeofencing.initialize(arg0);\n}\n\n/**\n * A method that sets Woosmap private API key\n * @param apiKey new API key.\n * @returns promise:success - A callback function that will be called on success.\n error - A callback function that will be called on error.\n */\nfunction setWoosmapApiKey(apiKey: string): Promise<string> {\n return PluginGeofencing.setWoosmapApiKey([apiKey]);\n}\n\n/**\n * A method to start tracking the user's location.\n * @param trackingProfile The configuration profile to use. Values could be anyone of the following: liveTracking, passiveTracking and visitsTracking.\n * @returns promise:success - A callback function that will be called on success.\n error - A callback function that will be called on error.\n */\nfunction startTracking(trackingProfile: string): Promise<string> {\n return PluginGeofencing.startTracking([trackingProfile]);\n}\n\n/**\n * Stops tracking the user's location.\n * @returns promise:success - A callback function that will be called on success.\n error - A callback function that will be called on error.\n */\nfunction stopTracking(): Promise<string> {\n return PluginGeofencing.stopTracking();\n}\n\n/**\n * A method to request the required permissions to collect locations.\n * @param background - A boolean value indicating whether the permissions to request is for background or foreground permission.\n * @returns A callback that will be called on successful authorization by the app. A callback that will be called when the app denies permission. The plugin will return an object with a message - 'Permission Denied'.\n */\nfunction requestPermissions(background?: boolean): Promise<string> {\n if (background == null) {\n background = false;\n }\n return PluginGeofencing.requestPermissions([background]);\n}\n\n/**\n * A method to check if the app has granted required permissions to track location.\n * @returns A callback that will be called with the following status - GRANTED_BACKGROUND, GRANTED_FOREGROUND, DENIED\n */\nfunction getPermissionsStatus(): Promise<string> {\n return PluginGeofencing.getPermissionsStatus();\n}\n\n/**\n * Method will\ninvoke callback and pass a location object as a parameter. Method will return a watchId . This id can be used to remove a callback.\n * @param success new location found callback\n * @param error error status callback\n * @returns watchid\n */\nfunction watchLocation(\n success: (result: Location) => any,\n error?: any\n): Promise<string> {\n const watchID = uuid.v1().toString();\n\n const successCallback = (result: any) => {\n success(Location.jsonToObj(result));\n };\n\n subscriptionsLocation[watchID] = [\n eventEmitter.addListener('geolocationDidChange', successCallback),\n error ? eventEmitter.addListener('geolocationError', error) : null,\n ];\n return PluginGeofencing.watchLocation(watchID);\n}\n\n/**\n * A method to stop tracking location for a specified watch. If watchId is null or undefined the plugin will clear all watches.\n * @param watchID Reference ID.\n * @returns return promise with same id back in case of success otherwise error info\n */\nfunction clearLocationWatch(watchID?: string): Promise<string> {\n if (watchID == null) {\n eventEmitter.removeAllListeners('geolocationDidChange');\n eventEmitter.removeAllListeners('geolocationError');\n subscriptionsLocation = {};\n return PluginGeofencing.clearAllLocationWatch();\n } else {\n const saved = subscriptionsLocation[watchID];\n if (saved) {\n const arg0 = saved[0];\n eventEmitter.removeListener('geolocationDidChange', arg0);\n const arg1 = saved[1];\n if (arg1) {\n eventEmitter.removeListener('geolocationError', arg1);\n }\n subscriptionsLocation[watchID] = undefined;\n }\n return PluginGeofencing.clearLocationWatch(watchID);\n }\n}\n\n/**\n * A method to to track Regions. Method will invoke a callback with Region object. Method will return\na watch id which can be used later to remove the callback.\n * @param success new location found callback\n * @param error error status callback\n * @returns watchid\n */\nfunction watchRegions(\n success: (result: Region) => any,\n error?: any\n): Promise<string> {\n const watchID = uuid.v1().toString();\n\n const successCallback = (result: any) => {\n success(Region.jsonToObj(result));\n };\n\n subscriptionsRegion[watchID] = [\n eventEmitter.addListener('woosmapgeofenceRegionDidChange', successCallback),\n error\n ? eventEmitter.addListener('woosmapgeofenceRegionError', error)\n : null,\n ];\n return PluginGeofencing.watchRegions(watchID);\n}\n\n/**\n * A method to clear the specified watch tracing the regions. If the watchId is null or undefined then it will clear all the watches tracking the regions.\n * @param watchID Reference ID.\n * @returns return promise with same id back in case of success otherwise error info\n */\nfunction clearRegionsWatch(watchID: string): Promise<string> {\n if (watchID == null) {\n eventEmitter.removeAllListeners('woosmapgeofenceRegionDidChange');\n eventEmitter.removeAllListeners('woosmapgeofenceRegionError');\n subscriptionsRegion = {};\n return PluginGeofencing.clearAllRegionsWatch();\n } else {\n const saved = subscriptionsRegion[watchID];\n if (saved) {\n const arg0 = saved[0];\n eventEmitter.removeListener('woosmapgeofenceRegionDidChange', arg0);\n const arg1 = saved[1];\n if (arg1) {\n eventEmitter.removeListener('woosmapgeofenceRegionError', arg1);\n }\n subscriptionsRegion[watchID] = undefined;\n }\n return PluginGeofencing.clearRegionsWatch(watchID);\n }\n}\n/**\n * Sets Sales Force Marketing Cloud (SFMC) credentials\n * @param arg0 A JSON object with SFMC credentials. Keys authenticationBaseURI, restBaseURI, client_id, client_secret and contactKey are required.\n * @returns promise with A callback that will be called on success or error.\n */\nfunction setSFMCCredentials(arg0: Object): Promise<string> {\n return PluginGeofencing.setSFMCCredentials(arg0);\n}\n\n/**\n * When you create a geofence around a POI, manually define the radius value (100.0) or choose the user_properties subfield that corresponds to radius value of the geofence (\"radiusPOI\").\n * @param radius can be integer or string.\n * @returns promise with A callback that will be called on success or error.\n */\nfunction setPoiRadius(radius: string): Promise<string> {\n return PluginGeofencing.setPoiRadius(radius);\n}\n\nconst WoosmapGeofencing = {\n multiply,\n initialize,\n setWoosmapApiKey,\n startTracking,\n requestPermissions,\n getPermissionsStatus,\n stopTracking,\n watchLocation,\n clearLocationWatch,\n watchRegions,\n clearRegionsWatch,\n setSFMCCredentials,\n setPoiRadius,\n};\n\n/* We export the native interface in this way to give easy shared access to it between the\n * JavaScript code and the tests\n */\n//let nativeEventEmitter: NativeEventEmitter | null = null;\n\nexport default WoosmapGeofencing;\n// module.exports = {\n// WoosmapGeofencing,\n// get GeolocationEventEmitter() {\n// if (!nativeEventEmitter) {\n// nativeEventEmitter = new NativeEventEmitter(PluginGeofencing);\n// }\n// return nativeEventEmitter;\n// },\n// };\n"]}
|
|
1
|
+
{"version":3,"sources":["index.tsx"],"names":["NativeEventEmitter","uuid","PluginGeofencing","Location","Region","Poi","eventEmitter","subscriptionsLocation","subscriptionsRegion","initialize","arg0","setWoosmapApiKey","apiKey","startTracking","trackingProfile","stopTracking","requestPermissions","background","getPermissionsStatus","watchLocation","success","error","watchID","v1","toString","successCallback","result","jsonToObj","addListener","clearLocationWatch","removeAllListeners","clearAllLocationWatch","saved","removeListener","arg1","undefined","watchRegions","clearRegionsWatch","clearAllRegionsWatch","setSFMCCredentials","setPoiRadius","radius","addRegion","region","getRegions","regionID","getAllRegions","then","formatted","forEach","item","push","Promise","resolve","catch","e","reject","getLocations","locationID","getAllLocations","getLocation","getPois","poiID","getAllPois","getPoi","removeRegions","removeAllRegions","removeRegion","removeLocations","removeAllLocations","removePois","removeAllPois","startCustomTracking","sourceType","source","WoosmapGeofencing"],"mappings":"AAAA,SAASA,kBAAT,QAAmC,cAAnC;AACA,OAAOC,IAAP,MAAiB,mBAAjB;AACA,OAAOC,gBAAP,MAA6B,4BAA7B;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,OAAOC,GAAP,MAAgB,gBAAhB;AAOA,MAAMC,YAAY,GAAG,IAAIN,kBAAJ,CAAuBE,gBAAvB,CAArB;AAEA,IAAIK,qBAA0B,GAAG,EAAjC;AACA,IAAIC,mBAAwB,GAAG,EAA/B;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,UAAT,CAAoBC,IAApB,EAAiD;AAC/C,MAAIA,IAAI,IAAI,IAAZ,EAAkB;AAChBA,IAAAA,IAAI,GAAG,EAAP;AACD;;AACD,SAAOR,gBAAgB,CAACO,UAAjB,CAA4BC,IAA5B,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,gBAAT,CAA0BC,MAA1B,EAA2D;AACzD,SAAOV,gBAAgB,CAACS,gBAAjB,CAAkC,CAACC,MAAD,CAAlC,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,aAAT,CAAuBC,eAAvB,EAAiE;AAC/D,SAAOZ,gBAAgB,C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iBAAf","sourcesContent":["import { NativeEventEmitter } from 'react-native';\nimport uuid from 'react-native-uuid';\nimport PluginGeofencing from './internal/nativeInterface';\nimport Location from './internal/Location';\nimport Region from './internal/Region';\nimport Poi from './internal/Poi';\nimport type {\n GeofenceRegion,\n RegionType,\n ProfileSource,\n} from './internal/types';\n\nconst eventEmitter = new NativeEventEmitter(PluginGeofencing);\n\nlet subscriptionsLocation: any = {};\nlet subscriptionsRegion: any = {};\n/**\n * Initializes the Woosmap object\n * @param arg0 A JSON object with Woosmap Key (optional) and tracking profile (`liveTracking`,`passiveTracking`,`visitsTracking`).\n * @returns promise:success - A callback function that will be called on success.\n error - A callback function that will be called on error.\n */\nfunction initialize(arg0?: any): Promise<string> {\n if (arg0 == null) {\n arg0 = {};\n }\n return PluginGeofencing.initialize(arg0);\n}\n\n/**\n * A method that sets Woosmap private API key\n * @param apiKey new API key.\n * @returns promise:success - A callback function that will be called on success.\n error - A callback function that will be called on error.\n */\nfunction setWoosmapApiKey(apiKey: string): Promise<string> {\n return PluginGeofencing.setWoosmapApiKey([apiKey]);\n}\n\n/**\n * A method to start tracking the user's location.\n * @param trackingProfile The configuration profile to use. Values could be anyone of the following: liveTracking, passiveTracking and visitsTracking.\n * @returns promise:success - A callback function that will be called on success.\n error - A callback function that will be called on error.\n */\nfunction startTracking(trackingProfile: string): Promise<string> {\n return PluginGeofencing.startTracking([trackingProfile]);\n}\n\n/**\n * Stops tracking the user's location.\n * @returns promise:success - A callback function that will be called on success.\n error - A callback function that will be called on error.\n */\nfunction stopTracking(): Promise<string> {\n return PluginGeofencing.stopTracking();\n}\n\n/**\n * A method to request the required permissions to collect locations.\n * @param background - A boolean value indicating whether the permissions to request is for background or foreground permission.\n * @returns A callback that will be called on successful authorization by the app. A callback that will be called when the app denies permission. The plugin will return an object with a message - 'Permission Denied'.\n */\nfunction requestPermissions(background?: boolean): Promise<string> {\n if (background == null) {\n background = false;\n }\n return PluginGeofencing.requestPermissions([background]);\n}\n\n/**\n * A method to check if the app has granted required permissions to track location.\n * @returns A callback that will be called with the following status - GRANTED_BACKGROUND, GRANTED_FOREGROUND, DENIED\n */\nfunction getPermissionsStatus(): Promise<string> {\n return PluginGeofencing.getPermissionsStatus();\n}\n\n/**\n * Method will\ninvoke callback and pass a location object as a parameter. Method will return a watchId . This id can be used to remove a callback.\n * @param success new location found callback\n * @param error error status callback\n * @returns watchid\n */\nfunction watchLocation(\n success: (result: Location) => any,\n error?: any\n): Promise<string> {\n const watchID = uuid.v1().toString();\n\n const successCallback = (result: any) => {\n success(Location.jsonToObj(result));\n };\n\n subscriptionsLocation[watchID] = [\n eventEmitter.addListener('geolocationDidChange', successCallback),\n error ? eventEmitter.addListener('geolocationError', error) : null,\n ];\n return PluginGeofencing.watchLocation(watchID);\n}\n\n/**\n * A method to stop tracking location for a specified watch. If watchId is null or undefined the plugin will clear all watches.\n * @param watchID Reference ID.\n * @returns return promise with same id back in case of success otherwise error info\n */\nfunction clearLocationWatch(watchID?: string): Promise<string> {\n if (watchID == null) {\n eventEmitter.removeAllListeners('geolocationDidChange');\n eventEmitter.removeAllListeners('geolocationError');\n subscriptionsLocation = {};\n return PluginGeofencing.clearAllLocationWatch();\n } else {\n const saved = subscriptionsLocation[watchID];\n if (saved) {\n const arg0 = saved[0];\n eventEmitter.removeListener('geolocationDidChange', arg0);\n const arg1 = saved[1];\n if (arg1) {\n eventEmitter.removeListener('geolocationError', arg1);\n }\n subscriptionsLocation[watchID] = undefined;\n }\n return PluginGeofencing.clearLocationWatch(watchID);\n }\n}\n\n/**\n * A method to to track Regions. Method will invoke a callback with Region object. Method will return\na watch id which can be used later to remove the callback.\n * @param success new location found callback\n * @param error error status callback\n * @returns watchid\n */\nfunction watchRegions(\n success: (result: Region) => any,\n error?: any\n): Promise<string> {\n const watchID = uuid.v1().toString();\n\n const successCallback = (result: any) => {\n success(Region.jsonToObj(result));\n };\n\n subscriptionsRegion[watchID] = [\n eventEmitter.addListener('woosmapgeofenceRegionDidChange', successCallback),\n error\n ? eventEmitter.addListener('woosmapgeofenceRegionError', error)\n : null,\n ];\n return PluginGeofencing.watchRegions(watchID);\n}\n\n/**\n * A method to clear the specified watch tracing the regions. If the watchId is null or undefined then it will clear all the watches tracking the regions.\n * @param watchID Reference ID.\n * @returns return promise with same id back in case of success otherwise error info\n */\nfunction clearRegionsWatch(watchID: string): Promise<string> {\n if (watchID == null) {\n eventEmitter.removeAllListeners('woosmapgeofenceRegionDidChange');\n eventEmitter.removeAllListeners('woosmapgeofenceRegionError');\n subscriptionsRegion = {};\n return PluginGeofencing.clearAllRegionsWatch();\n } else {\n const saved = subscriptionsRegion[watchID];\n if (saved) {\n const arg0 = saved[0];\n eventEmitter.removeListener('woosmapgeofenceRegionDidChange', arg0);\n const arg1 = saved[1];\n if (arg1) {\n eventEmitter.removeListener('woosmapgeofenceRegionError', arg1);\n }\n subscriptionsRegion[watchID] = undefined;\n }\n return PluginGeofencing.clearRegionsWatch(watchID);\n }\n}\n/**\n * Sets Sales Force Marketing Cloud (SFMC) credentials\n * @param arg0 A JSON object with SFMC credentials. Keys authenticationBaseURI, restBaseURI, client_id, client_secret and contactKey are required.\n * @returns promise with A callback that will be called on success or error.\n */\nfunction setSFMCCredentials(arg0: Object): Promise<string> {\n return PluginGeofencing.setSFMCCredentials(arg0);\n}\n\n/**\n * When you create a geofence around a POI, manually define the radius value (100.0) or choose the user_properties subfield that corresponds to radius value of the geofence (\"radiusPOI\").\n * @param radius can be integer or string.\n * @returns promise with A callback that will be called on success or error.\n */\nfunction setPoiRadius(radius: string): Promise<string> {\n return PluginGeofencing.setPoiRadius(radius);\n}\n/**\n * Adds a custom region that you want to monitor.\n * @param region A GeofenceRegion object with latitude, longitude, radius and type.\n * @returns promise with A callback that will be called on success or error.\n */\n\nfunction addRegion(region: GeofenceRegion): Promise<string> {\n return PluginGeofencing.addRegion(region);\n}\n/**\n * Retrieve saved region info\n * @param regionID If it pass return info for given region or return all region info\n * @returns promise with A callback that will be called on success or error.\n */\nfunction getRegions(regionID?: string): Promise<Region[]> {\n if (regionID == null) {\n return PluginGeofencing.getAllRegions()\n .then((result: any[]) => {\n var formatted: Region[] = [];\n result.forEach((item) => {\n formatted.push(Region.jsonToObj(item));\n });\n return Promise.resolve(formatted);\n })\n .catch((e: any) => {\n return Promise.reject(e);\n });\n } else {\n return PluginGeofencing.getRegions(regionID)\n .then((result: any) => {\n var formatted: Region[] = [];\n formatted.push(Region.jsonToObj(result));\n return Promise.resolve(formatted);\n })\n .catch((e: any) => {\n return Promise.reject(e);\n });\n }\n}\n\n/**\n * Retrieve saved location info\n * @param locationID - Optional in case of location id pass it return only that location info\n * @returns promise with A callback that will be called on success or error.\n */\nfunction getLocations(locationID?: string): Promise<Location[]> {\n if (locationID == null) {\n return PluginGeofencing.getAllLocations()\n .then((result: any[]) => {\n var formatted: Location[] = [];\n result.forEach((item) => {\n formatted.push(Location.jsonToObj(item));\n });\n return Promise.resolve(formatted);\n })\n .catch((e: any) => {\n return Promise.reject(e);\n });\n } else {\n return PluginGeofencing.getLocation(locationID)\n .then((result: any) => {\n var formatted: Location[] = [];\n formatted.push(Location.jsonToObj(result));\n return Promise.resolve(formatted);\n })\n .catch((e: any) => {\n return Promise.reject(e);\n });\n }\n}\n\n/**\n * Retrieve saved POI info\n * @param poiID - Optional in case of poi id (LocationID or StoreID) pass it return only that POI info\n * @returns promise with A callback that will be called on success or error.\n */\nfunction getPois(poiID?: string): Promise<Poi[]> {\n if (poiID == null) {\n return PluginGeofencing.getAllPois()\n .then((result: any[]) => {\n var formatted: Poi[] = [];\n result.forEach((item) => {\n formatted.push(Poi.jsonToObj(item));\n });\n return Promise.resolve(formatted);\n })\n .catch((e: any) => {\n return Promise.reject(e);\n });\n } else {\n return PluginGeofencing.getPoi(poiID)\n .then((result: any) => {\n var formatted: Poi[] = [];\n formatted.push(Poi.jsonToObj(result));\n return Promise.resolve(formatted);\n })\n .catch((e: any) => {\n return Promise.reject(e);\n });\n }\n}\n\n/**\n * Remove saved region info\n * @param regionID If it pass remove info for given region or removes all region info\n * @returns promise with A callback that will be called on success or error.\n */\nfunction removeRegions(regionID?: string): Promise<string> {\n if (regionID == null) {\n return PluginGeofencing.removeAllRegions();\n } else {\n return PluginGeofencing.removeRegion(regionID);\n }\n}\n\n/**\n * Remove saved location info\n * @returns promise with A callback that will be called on success or error.\n */\nfunction removeLocations(): Promise<string> {\n return PluginGeofencing.removeAllLocations();\n}\n\n/**\n * Remove saved POI info\n * @returns promise with A callback that will be called on success or error.\n */\nfunction removePois(): Promise<string> {\n return PluginGeofencing.removeAllPois();\n}\n/**\n * if preset tracking profiles don’t fit with your use cases, you can build your own profile and uses the startCustomTracking() method. \n * There are two way to host the json file:\n * - included in the client application (local)\n * - hosted externally in a file folder in your information system (external)\n * @param sourceType local/external\n * @param source location of profile to be fetch\n * @returns promise with A callback that will be called on success or error.\n */\nfunction startCustomTracking(\n sourceType: ProfileSource,\n source: string\n): Promise<string> {\n return PluginGeofencing.startCustomTracking(sourceType, source);\n}\n\nexport type {\n RegionType,\n GeofenceRegion,\n Region,\n Location,\n Poi,\n ProfileSource,\n};\n\nconst WoosmapGeofencing = {\n initialize,\n setWoosmapApiKey,\n startTracking,\n requestPermissions,\n getPermissionsStatus,\n stopTracking,\n watchLocation,\n clearLocationWatch,\n watchRegions,\n clearRegionsWatch,\n setSFMCCredentials,\n setPoiRadius,\n addRegion,\n getRegions,\n removeRegions,\n getLocations,\n removeLocations,\n getPois,\n removePois,\n startCustomTracking,\n};\n\nexport default WoosmapGeofencing;\n"]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
2
|
|
|
5
3
|
/**
|
|
@@ -14,6 +12,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
14
12
|
* @param {number} distance The distance between the POI and the user's location.
|
|
15
13
|
* @param {number} duration The duration to travel to the POI from the user's location.
|
|
16
14
|
* @param {number} latitude The latitude of the POI.
|
|
15
|
+
* @param {string} locationid Location id of the POI.
|
|
17
16
|
* @param {number} longitude The longitude of the POI.
|
|
18
17
|
* @param {string} zipcode The zip code of the POI.
|
|
19
18
|
* @param {number} radius The radius of the POI.
|
|
@@ -92,5 +91,5 @@ class Poi {
|
|
|
92
91
|
|
|
93
92
|
}
|
|
94
93
|
|
|
95
|
-
|
|
94
|
+
export default Poi;
|
|
96
95
|
//# sourceMappingURL=Poi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Poi.tsx"],"names":["Poi","constructor","jsondata","city","idstore","name","date","distance","duration","latitude","locationid","longitude","zipcode","radius","address","countrycode","tags","types","contact","Jsondata","City","Idstore","Name","Date","Distance","Duration","Latitude","Locationid","Longitude","Zipcode","Radius","Countrycode","Tags","Types","Contact","Address","jsonToObj","json"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,GAAN,CAAU;AAkBRC,EAAAA,WAAW,CACTC,QADS,EAETC,IAFS,EAGTC,OAHS,EAITC,IAJS,EAKTC,IALS,EAMTC,QANS,EAOTC,QAPS,EAQTC,QARS,EASTC,UATS,EAUTC,SAVS,EAWTC,OAXS,EAYTC,MAZS,EAaTC,OAbS,EAcTC,WAdS,EAeTC,IAfS,EAgBTC,KAhBS,EAiBTC,OAjBS,EAkBT;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AACA,SAAKC,QAAL,GAAgBjB,QAAhB;AACA,SAAKkB,IAAL,GAAYjB,IAAZ;AACA,SAAKkB,OAAL,GAAejB,OAAf;AACA,SAAKkB,IAAL,GAAYjB,IAAZ;AACA,SAAKkB,IAAL,GAAYjB,IAAZ;AACA,SAAKkB,QAAL,GAAgBjB,QAAhB;AACA,SAAKkB,QAAL,GAAgBjB,QAAhB;AACA,SAAKkB,QAAL,GAAgBjB,QAAhB;AACA,SAAKkB,UAAL,GAAkBjB,UAAlB;AACA,SAAKkB,SAAL,GAAiBjB,SAAjB;AACA,SAAKkB,OAAL,GAAejB,OAAf;AACA,SAAKkB,MAAL,GAAcjB,MAAd;AACA,SAAKQ,OAAL,GAAejB,OAAf;AACA,SAAK2B,WAAL,GAAmBhB,WAAnB;AACA,SAAKiB,IAAL,GAAYhB,IAAZ;AACA,SAAKiB,KAAL,GAAahB,KAAb;AACA,SAAKiB,OAAL,GAAehB,OAAf;AACA,SAAKiB,OAAL,GAAerB,OAAf;AACD;AACD;AACF;AACA;AACA;AACA;AACA;;;AACkB,SAATsB,SAAS,CAACC,IAAD,EAAY;AAC1B,WAAO,IAAIrC,GAAJ,CACLqC,IAAI,CAACnC,QADA,EAELmC,IAAI,CAAClC,IAFA,EAGLkC,IAAI,CAACjC,OAHA,EAILiC,IAAI,CAAChC,IAJA,EAKLgC,IAAI,CAAC/B,IALA,EAML+B,IAAI,CAAC9B,QANA,EAOL8B,IAAI,CAAC7B,QAPA,EAQL6B,IAAI,CAAC5B,QARA,EASL4B,IAAI,CAAC3B,UATA,EAUL2B,IAAI,CAAC1B,SAVA,EAWL0B,IAAI,CAACzB,OAXA,EAYLyB,IAAI,CAACxB,MAZA,EAaLwB,IAAI,CAACvB,OAbA,EAcLuB,IAAI,CAACtB,WAdA,EAeLsB,IAAI,CAACrB,IAfA,EAgBLqB,IAAI,CAACpB,KAhBA,EAiBLoB,IAAI,CAACnB,OAjBA,CAAP;AAmBD;;AAlFO;;AAoFV,eAAelB,GAAf","sourcesContent":["/**\n * A class that represents the POI object.\n * @classdesc A class that represents the POI object.\n * @constructs Poi\n * @param {Object} jsonData A json object representing the POI.\n * @param {string} city The name of the city the POI belongs to.\n * @param {string} idstore A unique identifier for the POI.\n * @param {name} name The name of the POI.\n * @param {number} date The datetime stamp.\n * @param {number} distance The distance between the POI and the user's location.\n * @param {number} duration The duration to travel to the POI from the user's location.\n * @param {number} latitude The latitude of the POI.\n * @param {string} locationid Location id of the POI.\n * @param {number} longitude The longitude of the POI.\n * @param {string} zipcode The zip code of the POI.\n * @param {number} radius The radius of the POI.\n * @param {string} address The address of the POI.\n * @param {string} countrycode The countrycode of the POI.\n * @param {string} tags The tags for the POI.\n * @param {string} types The types of the POI.\n * @param {string} contact The contact for the POI.\n */\nclass Poi {\n Jsondata: object;\n City: string;\n Idstore: string;\n Name: string;\n Date: number;\n Distance: number;\n Duration: number;\n Latitude: number;\n Locationid: string;\n Longitude: number;\n Zipcode: string;\n Radius: number;\n Countrycode: string;\n Tags: string;\n Types: string;\n Contact: string;\n Address: string;\n constructor(\n jsondata: object,\n city: string,\n idstore: string,\n name: string,\n date: number,\n distance: number,\n duration: number,\n latitude: number,\n locationid: string,\n longitude: number,\n zipcode: string,\n radius: number,\n address: string,\n countrycode: string,\n tags: string,\n types: string,\n contact: string\n ) {\n this.Jsondata = jsondata;\n this.City = city;\n this.Idstore = idstore;\n this.Name = name;\n this.Date = date;\n this.Distance = distance;\n this.Duration = duration;\n this.Latitude = latitude;\n this.Locationid = locationid;\n this.Longitude = longitude;\n this.Zipcode = zipcode;\n this.Radius = radius;\n this.Idstore = idstore;\n this.Countrycode = countrycode;\n this.Tags = tags;\n this.Types = types;\n this.Contact = contact;\n this.Address = address;\n }\n /**\n * Converts json object to an object of type Poi.\n * @param {Object} json The json representation of the Poi.\n * @returns Object\n * @memberof Poi\n */\n static jsonToObj(json: any) {\n return new Poi(\n json.jsondata,\n json.city,\n json.idstore,\n json.name,\n json.date,\n json.distance,\n json.duration,\n json.latitude,\n json.locationid,\n json.longitude,\n json.zipcode,\n json.radius,\n json.address,\n json.countrycode,\n json.tags,\n json.types,\n json.contact\n );\n }\n}\nexport default Poi;\n"]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NativeModules } from 'react-native';
|
|
2
|
+
let PluginGeofencing = NativeModules.PluginGeofencing;
|
|
3
|
+
|
|
4
|
+
if (!PluginGeofencing) {
|
|
5
|
+
throw new Error('NativeModules.PluginGeofencing is undefined');
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export default PluginGeofencing;
|
|
9
|
+
//# sourceMappingURL=nativeInterface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["nativeInterface.tsx"],"names":["NativeModules","PluginGeofencing","Error"],"mappings":"AAAA,SAASA,aAAT,QAA8B,cAA9B;AACA,IAAIC,gBAAgB,GAAGD,aAAa,CAACC,gBAArC;;AAEA,IAAI,CAACA,gBAAL,EAAuB;AACrB,QAAM,IAAIC,KAAJ,CAAU,6CAAV,CAAN;AACD;;AAED,eAAeD,gBAAf","sourcesContent":["import { NativeModules } from 'react-native';\nlet PluginGeofencing = NativeModules.PluginGeofencing;\n\nif (!PluginGeofencing) {\n throw new Error('NativeModules.PluginGeofencing is undefined');\n}\n\nexport default PluginGeofencing;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import Location from './Location';
|
|
2
|
-
import Region from './Region';
|
|
3
|
-
|
|
1
|
+
import Location from './internal/Location';
|
|
2
|
+
import Region from './internal/Region';
|
|
3
|
+
import Poi from './internal/Poi';
|
|
4
|
+
import type { GeofenceRegion, RegionType, ProfileSource } from './internal/types';
|
|
4
5
|
/**
|
|
5
6
|
* Initializes the Woosmap object
|
|
6
7
|
* @param arg0 A JSON object with Woosmap Key (optional) and tracking profile (`liveTracking`,`passiveTracking`,`visitsTracking`).
|
|
@@ -79,8 +80,58 @@ declare function setSFMCCredentials(arg0: Object): Promise<string>;
|
|
|
79
80
|
* @returns promise with A callback that will be called on success or error.
|
|
80
81
|
*/
|
|
81
82
|
declare function setPoiRadius(radius: string): Promise<string>;
|
|
83
|
+
/**
|
|
84
|
+
* Adds a custom region that you want to monitor.
|
|
85
|
+
* @param region A GeofenceRegion object with latitude, longitude, radius and type.
|
|
86
|
+
* @returns promise with A callback that will be called on success or error.
|
|
87
|
+
*/
|
|
88
|
+
declare function addRegion(region: GeofenceRegion): Promise<string>;
|
|
89
|
+
/**
|
|
90
|
+
* Retrieve saved region info
|
|
91
|
+
* @param regionID If it pass return info for given region or return all region info
|
|
92
|
+
* @returns promise with A callback that will be called on success or error.
|
|
93
|
+
*/
|
|
94
|
+
declare function getRegions(regionID?: string): Promise<Region[]>;
|
|
95
|
+
/**
|
|
96
|
+
* Retrieve saved location info
|
|
97
|
+
* @param locationID - Optional in case of location id pass it return only that location info
|
|
98
|
+
* @returns promise with A callback that will be called on success or error.
|
|
99
|
+
*/
|
|
100
|
+
declare function getLocations(locationID?: string): Promise<Location[]>;
|
|
101
|
+
/**
|
|
102
|
+
* Retrieve saved POI info
|
|
103
|
+
* @param poiID - Optional in case of poi id (LocationID or StoreID) pass it return only that POI info
|
|
104
|
+
* @returns promise with A callback that will be called on success or error.
|
|
105
|
+
*/
|
|
106
|
+
declare function getPois(poiID?: string): Promise<Poi[]>;
|
|
107
|
+
/**
|
|
108
|
+
* Remove saved region info
|
|
109
|
+
* @param regionID If it pass remove info for given region or removes all region info
|
|
110
|
+
* @returns promise with A callback that will be called on success or error.
|
|
111
|
+
*/
|
|
112
|
+
declare function removeRegions(regionID?: string): Promise<string>;
|
|
113
|
+
/**
|
|
114
|
+
* Remove saved location info
|
|
115
|
+
* @returns promise with A callback that will be called on success or error.
|
|
116
|
+
*/
|
|
117
|
+
declare function removeLocations(): Promise<string>;
|
|
118
|
+
/**
|
|
119
|
+
* Remove saved POI info
|
|
120
|
+
* @returns promise with A callback that will be called on success or error.
|
|
121
|
+
*/
|
|
122
|
+
declare function removePois(): Promise<string>;
|
|
123
|
+
/**
|
|
124
|
+
* if preset tracking profiles don’t fit with your use cases, you can build your own profile and uses the startCustomTracking() method.
|
|
125
|
+
* There are two way to host the json file:
|
|
126
|
+
* - included in the client application (local)
|
|
127
|
+
* - hosted externally in a file folder in your information system (external)
|
|
128
|
+
* @param sourceType local/external
|
|
129
|
+
* @param source location of profile to be fetch
|
|
130
|
+
* @returns promise with A callback that will be called on success or error.
|
|
131
|
+
*/
|
|
132
|
+
declare function startCustomTracking(sourceType: ProfileSource, source: string): Promise<string>;
|
|
133
|
+
export type { RegionType, GeofenceRegion, Region, Location, Poi, ProfileSource, };
|
|
82
134
|
declare const WoosmapGeofencing: {
|
|
83
|
-
multiply: typeof multiply;
|
|
84
135
|
initialize: typeof initialize;
|
|
85
136
|
setWoosmapApiKey: typeof setWoosmapApiKey;
|
|
86
137
|
startTracking: typeof startTracking;
|
|
@@ -93,5 +144,13 @@ declare const WoosmapGeofencing: {
|
|
|
93
144
|
clearRegionsWatch: typeof clearRegionsWatch;
|
|
94
145
|
setSFMCCredentials: typeof setSFMCCredentials;
|
|
95
146
|
setPoiRadius: typeof setPoiRadius;
|
|
147
|
+
addRegion: typeof addRegion;
|
|
148
|
+
getRegions: typeof getRegions;
|
|
149
|
+
removeRegions: typeof removeRegions;
|
|
150
|
+
getLocations: typeof getLocations;
|
|
151
|
+
removeLocations: typeof removeLocations;
|
|
152
|
+
getPois: typeof getPois;
|
|
153
|
+
removePois: typeof removePois;
|
|
154
|
+
startCustomTracking: typeof startCustomTracking;
|
|
96
155
|
};
|
|
97
156
|
export default WoosmapGeofencing;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* @param {number} distance The distance between the POI and the user's location.
|
|
11
11
|
* @param {number} duration The duration to travel to the POI from the user's location.
|
|
12
12
|
* @param {number} latitude The latitude of the POI.
|
|
13
|
+
* @param {string} locationid Location id of the POI.
|
|
13
14
|
* @param {number} longitude The longitude of the POI.
|
|
14
15
|
* @param {string} zipcode The zip code of the POI.
|
|
15
16
|
* @param {number} radius The radius of the POI.
|
|
@@ -28,7 +29,7 @@ declare class Poi {
|
|
|
28
29
|
Distance: number;
|
|
29
30
|
Duration: number;
|
|
30
31
|
Latitude: number;
|
|
31
|
-
Locationid:
|
|
32
|
+
Locationid: string;
|
|
32
33
|
Longitude: number;
|
|
33
34
|
Zipcode: string;
|
|
34
35
|
Radius: number;
|
|
@@ -37,7 +38,7 @@ declare class Poi {
|
|
|
37
38
|
Types: string;
|
|
38
39
|
Contact: string;
|
|
39
40
|
Address: string;
|
|
40
|
-
constructor(jsondata: object, city: string, idstore: string, name: string, date: number, distance: number, duration: number, latitude: number, locationid:
|
|
41
|
+
constructor(jsondata: object, city: string, idstore: string, name: string, date: number, distance: number, duration: number, latitude: number, locationid: string, longitude: number, zipcode: string, radius: number, address: string, countrycode: string, tags: string, types: string, contact: string);
|
|
41
42
|
/**
|
|
42
43
|
* Converts json object to an object of type Poi.
|
|
43
44
|
* @param {Object} json The json representation of the Poi.
|
|
@@ -46,3 +47,4 @@ declare class Poi {
|
|
|
46
47
|
*/
|
|
47
48
|
static jsonToObj(json: any): Poi;
|
|
48
49
|
}
|
|
50
|
+
export default Poi;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Geofence region types
|
|
3
|
+
*/
|
|
4
|
+
export declare type RegionType = 'circle' | 'isochrone';
|
|
5
|
+
/**
|
|
6
|
+
* Location of custom profile to fetch
|
|
7
|
+
*/
|
|
8
|
+
export declare type ProfileSource = 'local' | 'external';
|
|
9
|
+
/**
|
|
10
|
+
* GeofenceRegion structure
|
|
11
|
+
*/
|
|
12
|
+
export interface GeofenceRegion {
|
|
13
|
+
regionId: string;
|
|
14
|
+
lat: number;
|
|
15
|
+
lng: number;
|
|
16
|
+
radius: number;
|
|
17
|
+
type: RegionType;
|
|
18
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@woosmap/react-native-plugin-geofencing",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "This react-native plugin extends the functionality offered by the Woosmap Geofencing Mobile SDKs. Find more about the Woosmap Geofencing SDK",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|