@woosmap/react-native-plugin-geofencing 0.4.4 → 0.4.5-beta.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 (87) hide show
  1. package/android/build.gradle +80 -53
  2. package/android/gradle.properties +5 -0
  3. package/android/src/main/AndroidManifest.xml +0 -1
  4. package/android/src/main/AndroidManifestNew.xml +2 -0
  5. package/android/src/main/java/com/reactnativeplugingeofencing/AirshipPushHelper.java +0 -1
  6. package/android/src/main/java/com/reactnativeplugingeofencing/PluginGeofencingModule.java +23 -25
  7. package/android/src/main/java/com/reactnativeplugingeofencing/PluginGeofencingPackage.java +12 -12
  8. package/android/src/main/java/com/reactnativeplugingeofencing/WoosmapMessageAndKey.java +0 -10
  9. package/android/src/main/java/com/reactnativeplugingeofencing/WoosmapTask.java +2 -2
  10. package/ios/PluginGeofencing-Bridging-Header.h +0 -1
  11. package/ios/{PluginGeofencing.m → PluginGeofencing.mm} +6 -1
  12. package/ios/PluginGeofencing.swift +2 -2
  13. package/lib/commonjs/index.js.map +1 -1
  14. package/lib/commonjs/internal/Airship.js +0 -5
  15. package/lib/commonjs/internal/Airship.js.map +1 -1
  16. package/lib/commonjs/internal/IndoorBeacon.js +18 -21
  17. package/lib/commonjs/internal/IndoorBeacon.js.map +1 -1
  18. package/lib/commonjs/internal/Location.js +0 -8
  19. package/lib/commonjs/internal/Location.js.map +1 -1
  20. package/lib/commonjs/internal/MarketingCloud.js +0 -5
  21. package/lib/commonjs/internal/MarketingCloud.js.map +1 -1
  22. package/lib/commonjs/internal/Poi.js +0 -21
  23. package/lib/commonjs/internal/Poi.js.map +1 -1
  24. package/lib/commonjs/internal/Region.js +0 -12
  25. package/lib/commonjs/internal/Region.js.map +1 -1
  26. package/lib/commonjs/internal/Visit.js +0 -9
  27. package/lib/commonjs/internal/Visit.js.map +1 -1
  28. package/lib/commonjs/internal/Zoi.js +0 -20
  29. package/lib/commonjs/internal/Zoi.js.map +1 -1
  30. package/lib/commonjs/internal/nativeInterface.js.map +1 -1
  31. package/lib/commonjs/internal/types.js.map +1 -1
  32. package/lib/module/index.js.map +1 -1
  33. package/lib/module/internal/Airship.js +0 -5
  34. package/lib/module/internal/Airship.js.map +1 -1
  35. package/lib/module/internal/IndoorBeacon.js +18 -21
  36. package/lib/module/internal/IndoorBeacon.js.map +1 -1
  37. package/lib/module/internal/Location.js +0 -8
  38. package/lib/module/internal/Location.js.map +1 -1
  39. package/lib/module/internal/MarketingCloud.js +0 -5
  40. package/lib/module/internal/MarketingCloud.js.map +1 -1
  41. package/lib/module/internal/Poi.js +0 -21
  42. package/lib/module/internal/Poi.js.map +1 -1
  43. package/lib/module/internal/Region.js +0 -12
  44. package/lib/module/internal/Region.js.map +1 -1
  45. package/lib/module/internal/Visit.js +0 -9
  46. package/lib/module/internal/Visit.js.map +1 -1
  47. package/lib/module/internal/Zoi.js +0 -20
  48. package/lib/module/internal/Zoi.js.map +1 -1
  49. package/lib/module/internal/nativeInterface.js.map +1 -1
  50. package/lib/module/internal/types.js.map +1 -1
  51. package/lib/typescript/{index.d.ts → src/index.d.ts} +1 -0
  52. package/lib/typescript/src/index.d.ts.map +1 -0
  53. package/lib/typescript/{internal → src/internal}/Airship.d.ts +1 -0
  54. package/lib/typescript/src/internal/Airship.d.ts.map +1 -0
  55. package/lib/typescript/{internal → src/internal}/IndoorBeacon.d.ts +1 -0
  56. package/lib/typescript/src/internal/IndoorBeacon.d.ts.map +1 -0
  57. package/lib/typescript/{internal → src/internal}/Location.d.ts +1 -0
  58. package/lib/typescript/src/internal/Location.d.ts.map +1 -0
  59. package/lib/typescript/{internal → src/internal}/MarketingCloud.d.ts +1 -0
  60. package/lib/typescript/src/internal/MarketingCloud.d.ts.map +1 -0
  61. package/lib/typescript/{internal → src/internal}/Poi.d.ts +1 -0
  62. package/lib/typescript/src/internal/Poi.d.ts.map +1 -0
  63. package/lib/typescript/{internal → src/internal}/Region.d.ts +1 -0
  64. package/lib/typescript/src/internal/Region.d.ts.map +1 -0
  65. package/lib/typescript/{internal → src/internal}/Visit.d.ts +1 -0
  66. package/lib/typescript/src/internal/Visit.d.ts.map +1 -0
  67. package/lib/typescript/{internal → src/internal}/Zoi.d.ts +1 -0
  68. package/lib/typescript/src/internal/Zoi.d.ts.map +1 -0
  69. package/lib/typescript/{internal → src/internal}/nativeInterface.d.ts +1 -0
  70. package/lib/typescript/src/internal/nativeInterface.d.ts.map +1 -0
  71. package/lib/typescript/{internal → src/internal}/types.d.ts +1 -0
  72. package/lib/typescript/src/internal/types.d.ts.map +1 -0
  73. package/package.json +57 -34
  74. package/react-native-plugin-geofencing.podspec +24 -2
  75. package/src/index.tsx +471 -0
  76. package/src/internal/Airship.tsx +24 -0
  77. package/src/internal/IndoorBeacon.tsx +95 -0
  78. package/src/internal/Location.tsx +46 -0
  79. package/src/internal/MarketingCloud.tsx +24 -0
  80. package/src/internal/Poi.tsx +111 -0
  81. package/src/internal/Region.tsx +66 -0
  82. package/src/internal/Visit.tsx +49 -0
  83. package/src/internal/Zoi.tsx +107 -0
  84. package/src/internal/nativeInterface.tsx +8 -0
  85. package/src/internal/types.tsx +20 -0
  86. package/ios/PluginGeofencing.xcodeproj/project.pbxproj +0 -293
  87. package/lib/typescript/__tests__/index.test.d.ts +0 -0
package/src/index.tsx ADDED
@@ -0,0 +1,471 @@
1
+ import { NativeEventEmitter, Platform } from 'react-native';
2
+ import uuid from 'react-native-uuid';
3
+ import PluginGeofencing from './internal/nativeInterface';
4
+ import Location from './internal/Location';
5
+ import Region from './internal/Region';
6
+ import Poi from './internal/Poi';
7
+ import IndoorBeacon from './internal/IndoorBeacon';
8
+ import type {
9
+ GeofenceRegion,
10
+ RegionType,
11
+ ProfileSource,
12
+ } from './internal/types';
13
+
14
+ const eventEmitter = new NativeEventEmitter(PluginGeofencing);
15
+
16
+ let subscriptionsLocation: any = {};
17
+ let subscriptionsRegion: any = {};
18
+ /**
19
+ * Initializes the Woosmap object
20
+ * @param arg0 A JSON object with Woosmap Key (optional) and tracking profile (`liveTracking`,`passiveTracking`,`visitsTracking`).
21
+ * @returns promise:success - A callback function that will be called on success.
22
+ error - A callback function that will be called on error.
23
+ */
24
+ function initialize(arg0?: any): Promise<string> {
25
+ if (arg0 == null) {
26
+ arg0 = {};
27
+ }
28
+ return PluginGeofencing.initialize(arg0);
29
+ }
30
+
31
+ /**
32
+ * A method that sets Woosmap private API key
33
+ * @param apiKey new API key.
34
+ * @returns promise:success - A callback function that will be called on success.
35
+ error - A callback function that will be called on error.
36
+ */
37
+ function setWoosmapApiKey(apiKey: string): Promise<string> {
38
+ return PluginGeofencing.setWoosmapApiKey([apiKey]);
39
+ }
40
+
41
+ /**
42
+ * A method to start tracking the user's location.
43
+ * @param trackingProfile The configuration profile to use. Values could be anyone of the following: liveTracking, passiveTracking and visitsTracking.
44
+ * @returns promise:success - A callback function that will be called on success.
45
+ error - A callback function that will be called on error.
46
+ */
47
+ function startTracking(trackingProfile: string): Promise<string> {
48
+ return PluginGeofencing.startTracking([trackingProfile]);
49
+ }
50
+
51
+ /**
52
+ * Stops tracking the user's location.
53
+ * @returns promise:success - A callback function that will be called on success.
54
+ error - A callback function that will be called on error.
55
+ */
56
+ function stopTracking(): Promise<string> {
57
+ return PluginGeofencing.stopTracking();
58
+ }
59
+
60
+ /**
61
+ * A method to request the required permissions to collect locations.
62
+ * @param background - A boolean value indicating whether the permissions to request is for background or foreground permission.
63
+ * @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'.
64
+ */
65
+ function requestPermissions(background?: boolean): Promise<string> {
66
+ if (background == null) {
67
+ background = false;
68
+ }
69
+ return PluginGeofencing.requestPermissions([background]);
70
+ }
71
+
72
+ /**
73
+ * A method to request the required permissions to collect locations.
74
+ * @returns A callback that will be called on successful authorization by the app. A callback that will be called when the app denies permission.
75
+ * The plugin will return an object with either one of the messages - BACKGROUND_LOCATION_DENIED, GRANTED, DENIED
76
+ */
77
+ function requestBLEPermissions(): Promise<string> {
78
+ if (Platform.OS === 'android') {
79
+ return PluginGeofencing.requestBLEPermissions();
80
+ } else {
81
+ return new Promise((resolve) => {
82
+ resolve('GRANTED');
83
+ });
84
+ }
85
+ }
86
+
87
+ /**
88
+ * A method to check if the app has granted required permissions to track location.
89
+ * @returns A callback that will be called with the following status - GRANTED_BACKGROUND, GRANTED_FOREGROUND, DENIED
90
+ */
91
+ function getPermissionsStatus(): Promise<string> {
92
+ return PluginGeofencing.getPermissionsStatus();
93
+ }
94
+
95
+ /**
96
+ * A method to check if the app has granted required permissions to track location.
97
+ * @returns A callback that will be called with the following status - BACKGROUND_LOCATION_DENIED, GRANTED, DENIED
98
+ */
99
+ function getBLEPermissionsStatus(): Promise<string> {
100
+ if (Platform.OS == 'android') {
101
+ return PluginGeofencing.getBLEPermissionsStatus();
102
+ } else {
103
+ return new Promise((resolve) => {
104
+ resolve('GRANTED');
105
+ });
106
+ }
107
+ }
108
+
109
+ /**
110
+ * Method will
111
+ invoke callback and pass a location object as a parameter. Method will return a watchId . This id can be used to remove a callback.
112
+ * @param success new location found callback
113
+ * @param error error status callback
114
+ * @returns watchid
115
+ */
116
+ function watchLocation(
117
+ success: (result: Location) => any,
118
+ error?: any
119
+ ): Promise<string> {
120
+ const watchID = uuid.v1().toString();
121
+
122
+ const successCallback = (result: any) => {
123
+ success(Location.jsonToObj(result));
124
+ };
125
+
126
+ subscriptionsLocation[watchID] = [
127
+ eventEmitter.addListener('geolocationDidChange', successCallback),
128
+ error ? eventEmitter.addListener('geolocationError', error) : null,
129
+ ];
130
+ return PluginGeofencing.watchLocation(watchID);
131
+ }
132
+
133
+ /**
134
+ * A method to stop tracking location for a specified watch. If watchId is null or undefined the plugin will clear all watches.
135
+ * @param watchID Reference ID.
136
+ * @returns return promise with same id back in case of success otherwise error info
137
+ */
138
+ function clearLocationWatch(watchID?: string): Promise<string> {
139
+ if (watchID == null) {
140
+ eventEmitter.removeAllListeners('geolocationDidChange');
141
+ eventEmitter.removeAllListeners('geolocationError');
142
+ subscriptionsLocation = {};
143
+ return PluginGeofencing.clearAllLocationWatch();
144
+ } else {
145
+ const saved = subscriptionsLocation[watchID];
146
+ if (saved) {
147
+ const arg0 = saved[0];
148
+ arg0.remove();
149
+ //eventEmitter.removeListener('geolocationDidChange', arg0);
150
+ const arg1 = saved[1];
151
+ if (arg1) {
152
+ arg1.remove();
153
+ //eventEmitter.removeListener('geolocationError', arg1);
154
+ }
155
+ subscriptionsLocation[watchID] = undefined;
156
+ }
157
+ return PluginGeofencing.clearLocationWatch(watchID);
158
+ }
159
+ }
160
+
161
+ /**
162
+ * A method to to track Regions. Method will invoke a callback with Region object. Method will return
163
+ a watch id which can be used later to remove the callback.
164
+ * @param success new location found callback
165
+ * @param error error status callback
166
+ * @returns watchid
167
+ */
168
+ function watchRegions(
169
+ success: (result: Region) => any,
170
+ error?: any
171
+ ): Promise<string> {
172
+ const watchID = uuid.v1().toString();
173
+
174
+ const successCallback = (result: any) => {
175
+ success(Region.jsonToObj(result));
176
+ };
177
+
178
+ subscriptionsRegion[watchID] = [
179
+ eventEmitter.addListener('woosmapgeofenceRegionDidChange', successCallback),
180
+ error
181
+ ? eventEmitter.addListener('woosmapgeofenceRegionError', error)
182
+ : null,
183
+ ];
184
+ return PluginGeofencing.watchRegions(watchID);
185
+ }
186
+
187
+ /**
188
+ * 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.
189
+ * @param watchID Reference ID.
190
+ * @returns return promise with same id back in case of success otherwise error info
191
+ */
192
+ function clearRegionsWatch(watchID: string): Promise<string> {
193
+ if (watchID == null) {
194
+ eventEmitter.removeAllListeners('woosmapgeofenceRegionDidChange');
195
+ eventEmitter.removeAllListeners('woosmapgeofenceRegionError');
196
+ subscriptionsRegion = {};
197
+ return PluginGeofencing.clearAllRegionsWatch();
198
+ } else {
199
+ const saved = subscriptionsRegion[watchID];
200
+ if (saved) {
201
+ const arg0 = saved[0];
202
+ arg0.remove();
203
+ //eventEmitter.removeListener('woosmapgeofenceRegionDidChange', arg0);
204
+ const arg1 = saved[1];
205
+ if (arg1) {
206
+ arg1.remove();
207
+ //eventEmitter.removeListener('woosmapgeofenceRegionError', arg1);
208
+ }
209
+ subscriptionsRegion[watchID] = undefined;
210
+ }
211
+ return PluginGeofencing.clearRegionsWatch(watchID);
212
+ }
213
+ }
214
+ /**
215
+ * Sets Sales Force Marketing Cloud (SFMC) credentials
216
+ * @param arg0 A JSON object with SFMC credentials. Keys authenticationBaseURI, restBaseURI, client_id, client_secret and contactKey are required.
217
+ * @returns promise with A callback that will be called on success or error.
218
+ */
219
+ function setSFMCCredentials(arg0: Object): Promise<string> {
220
+ return PluginGeofencing.setSFMCCredentials(arg0);
221
+ }
222
+
223
+ /**
224
+ * 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").
225
+ * @param radius can be integer or string.
226
+ * @returns promise with A callback that will be called on success or error.
227
+ */
228
+ function setPoiRadius(radius: string): Promise<string> {
229
+ return PluginGeofencing.setPoiRadius(radius);
230
+ }
231
+ /**
232
+ * Adds a custom region that you want to monitor.
233
+ * @param region A GeofenceRegion object with latitude, longitude, radius and type.
234
+ * @returns promise with A callback that will be called on success or error.
235
+ */
236
+
237
+ function addRegion(region: GeofenceRegion): Promise<string> {
238
+ return PluginGeofencing.addRegion(region);
239
+ }
240
+ /**
241
+ * Retrieve saved region info
242
+ * @param regionID If it pass return info for given region or return all region info
243
+ * @returns promise with A callback that will be called on success or error.
244
+ */
245
+ function getRegions(regionID?: string): Promise<Region[]> {
246
+ if (regionID == null) {
247
+ return PluginGeofencing.getAllRegions()
248
+ .then((result: any[]) => {
249
+ var formatted: Region[] = [];
250
+ result.forEach((item) => {
251
+ formatted.push(Region.jsonToObj(item));
252
+ });
253
+ return Promise.resolve(formatted);
254
+ })
255
+ .catch((e: any) => {
256
+ return Promise.reject(e);
257
+ });
258
+ } else {
259
+ return PluginGeofencing.getRegions(regionID)
260
+ .then((result: any) => {
261
+ var formatted: Region[] = [];
262
+ formatted.push(Region.jsonToObj(result));
263
+ return Promise.resolve(formatted);
264
+ })
265
+ .catch((e: any) => {
266
+ return Promise.reject(e);
267
+ });
268
+ }
269
+ }
270
+
271
+ /**
272
+ * Retrieve saved location info
273
+ * @param locationID - Optional in case of location id pass it return only that location info
274
+ * @returns promise with A callback that will be called on success or error.
275
+ */
276
+ function getLocations(locationID?: string): Promise<Location[]> {
277
+ if (locationID == null) {
278
+ return PluginGeofencing.getAllLocations()
279
+ .then((result: any[]) => {
280
+ var formatted: Location[] = [];
281
+ result.forEach((item) => {
282
+ formatted.push(Location.jsonToObj(item));
283
+ });
284
+ return Promise.resolve(formatted);
285
+ })
286
+ .catch((e: any) => {
287
+ return Promise.reject(e);
288
+ });
289
+ } else {
290
+ return PluginGeofencing.getLocation(locationID)
291
+ .then((result: any) => {
292
+ var formatted: Location[] = [];
293
+ formatted.push(Location.jsonToObj(result));
294
+ return Promise.resolve(formatted);
295
+ })
296
+ .catch((e: any) => {
297
+ return Promise.reject(e);
298
+ });
299
+ }
300
+ }
301
+
302
+ /**
303
+ * Retrieve saved POI info
304
+ * @param poiID - Optional in case of poi id (LocationID or StoreID) pass it return only that POI info
305
+ * @returns promise with A callback that will be called on success or error.
306
+ */
307
+ function getPois(poiID?: string): Promise<Poi[]> {
308
+ if (poiID == null) {
309
+ return PluginGeofencing.getAllPois()
310
+ .then((result: any[]) => {
311
+ var formatted: Poi[] = [];
312
+ result.forEach((item) => {
313
+ formatted.push(Poi.jsonToObj(item));
314
+ });
315
+ return Promise.resolve(formatted);
316
+ })
317
+ .catch((e: any) => {
318
+ return Promise.reject(e);
319
+ });
320
+ } else {
321
+ return PluginGeofencing.getPoi(poiID)
322
+ .then((result: any) => {
323
+ var formatted: Poi[] = [];
324
+ formatted.push(Poi.jsonToObj(result));
325
+ return Promise.resolve(formatted);
326
+ })
327
+ .catch((e: any) => {
328
+ return Promise.reject(e);
329
+ });
330
+ }
331
+ }
332
+
333
+ /**
334
+ * Remove saved region info
335
+ * @param regionID If it pass remove info for given region or removes all region info
336
+ * @returns promise with A callback that will be called on success or error.
337
+ */
338
+ function removeRegions(regionID?: string): Promise<string> {
339
+ if (regionID == null) {
340
+ return PluginGeofencing.removeAllRegions();
341
+ } else {
342
+ return PluginGeofencing.removeRegion(regionID);
343
+ }
344
+ }
345
+
346
+ /**
347
+ * Remove saved location info
348
+ * @returns promise with A callback that will be called on success or error.
349
+ */
350
+ function removeLocations(): Promise<string> {
351
+ return PluginGeofencing.removeAllLocations();
352
+ }
353
+
354
+ /**
355
+ * Remove saved POI info
356
+ * @returns promise with A callback that will be called on success or error.
357
+ */
358
+ function removePois(): Promise<string> {
359
+ return PluginGeofencing.removeAllPois();
360
+ }
361
+ /**
362
+ * if preset tracking profiles don’t fit with your use cases, you can build your own profile and uses the startCustomTracking() method.
363
+ * There are two way to host the json file:
364
+ * - included in the client application (local)
365
+ * - hosted externally in a file folder in your information system (external)
366
+ * @param sourceType local/external
367
+ * @param source location of profile to be fetch
368
+ * @returns promise with A callback that will be called on success or error.
369
+ */
370
+ function startCustomTracking(
371
+ sourceType: ProfileSource,
372
+ source: string
373
+ ): Promise<string> {
374
+ return PluginGeofencing.startCustomTracking(sourceType, source);
375
+ }
376
+
377
+ /**
378
+ * Retrieve Beacon info for venue
379
+ * @param venueID - Optional venue id
380
+ * @param ref - Optional beacon id return by region event
381
+ * @returns promise with A callback that will be called on success or error.
382
+ */
383
+ function getIndoorBeacons(
384
+ venueID?: string,
385
+ ref?: string
386
+ ): Promise<IndoorBeacon[]> {
387
+ if (venueID == null) {
388
+ return PluginGeofencing.getAllIndoorBeacons()
389
+ .then((result: any[]) => {
390
+ var formatted: IndoorBeacon[] = [];
391
+ result.forEach((item) => {
392
+ if (ref !== undefined) {
393
+ if (item.identifier === ref) {
394
+ formatted.push(IndoorBeacon.jsonToObj(item));
395
+ }
396
+ } else {
397
+ formatted.push(IndoorBeacon.jsonToObj(item));
398
+ }
399
+ });
400
+ return Promise.resolve(formatted);
401
+ })
402
+ .catch((e: any) => {
403
+ return Promise.reject(e);
404
+ });
405
+ } else {
406
+ return PluginGeofencing.getIndoorBeacons(venueID)
407
+ .then((result: any[]) => {
408
+ var formatted: IndoorBeacon[] = [];
409
+ result.forEach((item) => {
410
+ if (ref !== undefined) {
411
+ if (item.identifier === ref) {
412
+ formatted.push(IndoorBeacon.jsonToObj(item));
413
+ }
414
+ } else {
415
+ formatted.push(IndoorBeacon.jsonToObj(item));
416
+ }
417
+ });
418
+ return Promise.resolve(formatted);
419
+ })
420
+ .catch((e: any) => {
421
+ return Promise.reject(e);
422
+ });
423
+ }
424
+ }
425
+
426
+ /**
427
+ * Remove saved POI info
428
+ * @returns promise with A callback that will be called on success or error.
429
+ */
430
+ function removeIndoorBeacons(): Promise<string> {
431
+ return PluginGeofencing.removeIndoorBeacons();
432
+ }
433
+
434
+ export type {
435
+ RegionType,
436
+ GeofenceRegion,
437
+ Region,
438
+ Location,
439
+ Poi,
440
+ ProfileSource,
441
+ IndoorBeacon,
442
+ };
443
+
444
+ const WoosmapGeofencing = {
445
+ initialize,
446
+ setWoosmapApiKey,
447
+ startTracking,
448
+ requestPermissions,
449
+ requestBLEPermissions,
450
+ getPermissionsStatus,
451
+ getBLEPermissionsStatus,
452
+ stopTracking,
453
+ watchLocation,
454
+ clearLocationWatch,
455
+ watchRegions,
456
+ clearRegionsWatch,
457
+ setSFMCCredentials,
458
+ setPoiRadius,
459
+ addRegion,
460
+ getRegions,
461
+ removeRegions,
462
+ getLocations,
463
+ removeLocations,
464
+ getPois,
465
+ removePois,
466
+ startCustomTracking,
467
+ getIndoorBeacons,
468
+ removeIndoorBeacons,
469
+ };
470
+
471
+ export default WoosmapGeofencing;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @classdesc A class that represents the Airship object.
3
+ * @constructs Airship
4
+ * @param {string} name The name of the custom event.
5
+ * @param {string} properties The attributes of the POI such as `name`, `address`, `zipCode` etc.
6
+ */
7
+ class Airship {
8
+ Name: String;
9
+ Properties: String;
10
+ constructor(name: String, properties: String) {
11
+ this.Name = name;
12
+ this.Properties = properties;
13
+ }
14
+ /**
15
+ * Converts json object to an object of type Airship.
16
+ * @param {Object} json The json representation of Airship.
17
+ * @returns Object
18
+ * @memberof Airship
19
+ */
20
+ static jsonToObj(json: any) {
21
+ return new Airship(json.name, json.properties);
22
+ }
23
+ }
24
+ module.exports = Airship;
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Represents an indoor beacon.
3
+ * @class
4
+ * @param {string} beaconId - The ID of the beacon.
5
+ * @param {number} major - The major version number of the beacon.
6
+ * @param {number} minor - The minor version number of the beacon.
7
+ * @param {string} venueId - The ID of the venue where the beacon is located.
8
+ * @param {string} identifier - The identifier of the beacon.
9
+ * @param {number} latitude - The latitude coordinate of the beacon's location.
10
+ * @param {number} longitude - The longitude coordinate of the beacon's location.
11
+ * @param {number} date - The date when the beacon was created.
12
+ * @param {Object} properties - custom property share with beacon
13
+ */
14
+ class IndoorBeacon {
15
+ /// The UUID of the beacon.
16
+ beaconId: string;
17
+
18
+ /// The Major version of the beacon.
19
+ major: number;
20
+
21
+ /// The Minor version of the beacon.
22
+ minor: number;
23
+
24
+ /// The ID of the venue to which this beacon belongs to.
25
+ venueId: string;
26
+
27
+ /// Woosmap identifier of the beacon.
28
+ identifier: string;
29
+
30
+ /// Latitude of the beacon.
31
+ latitude: number;
32
+
33
+ /// Longitude of the beacon.
34
+ longitude: number;
35
+
36
+ /// The date when the beacon was added/updated.
37
+ date: number;
38
+
39
+ /// Custom properties associated to the beacon.
40
+ properties: { [key: string]: any };
41
+
42
+ /**
43
+ * Creates a new instance of the Beacon class.
44
+ * @param {string} beaconId - The ID of the beacon.
45
+ * @param {number} major - The major version number of the beacon.
46
+ * @param {number} minor - The minor version number of the beacon.
47
+ * @param {string} venueId - The ID of the venue where the beacon is located.
48
+ * @param {string} identifier - The identifier of the beacon.
49
+ * @param {number} latitude - The latitude coordinate of the beacon's location.
50
+ * @param {number} longitude - The longitude coordinate of the beacon's location.
51
+ * @param {number} date - The date when the beacon was created.
52
+ * @param {Object} properties - custom property share with beacon
53
+ */
54
+ constructor(
55
+ beaconId: string,
56
+ major: number,
57
+ minor: number,
58
+ venueId: string,
59
+ identifier: string,
60
+ latitude: number,
61
+ longitude: number,
62
+ date: number,
63
+ properties: { [key: string]: any }
64
+ ) {
65
+ this.beaconId = beaconId;
66
+ this.major = major;
67
+ this.minor = minor;
68
+ this.venueId = venueId;
69
+ this.identifier = identifier;
70
+ this.latitude = latitude;
71
+ this.longitude = longitude;
72
+ this.date = date;
73
+ this.properties = properties;
74
+ }
75
+ /**
76
+ * Converts json object to an object of type IndoorBeacon.
77
+ * @param {Object} json The json representation of the IndoorBeacon.
78
+ * @returns Object
79
+ * @memberof Poi
80
+ */
81
+ static jsonToObj(json: any) {
82
+ return new IndoorBeacon(
83
+ json.beaconId,
84
+ json.major,
85
+ json.minor,
86
+ json.venueId,
87
+ json.identifier,
88
+ json.latitude,
89
+ json.longitude,
90
+ json.date,
91
+ json.properties
92
+ );
93
+ }
94
+ }
95
+ export default IndoorBeacon;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * @classdesc A class that represents the location object.
3
+ * @constructs Location
4
+ * @param {number} date The datetime stamp.
5
+ * @param {number} latitude The latitude of the location.
6
+
7
+ * @param {string} Locationdescription The description of the location.
8
+ * @param {string} Locationid A unique identifier for the location.
9
+ * @param {number} longitude The longitude of the location.
10
+ */
11
+ class Location {
12
+ Date: number;
13
+ Latitude: number;
14
+ Locationdescription: string;
15
+ Locationid: string;
16
+ Longitude: number;
17
+ constructor(
18
+ date: number,
19
+ latitude: number,
20
+ locationdescription: string,
21
+ locationid: string,
22
+ longitude: number
23
+ ) {
24
+ this.Date = date;
25
+ this.Latitude = latitude;
26
+ this.Locationdescription = locationdescription;
27
+ this.Locationid = locationid;
28
+ this.Longitude = longitude;
29
+ }
30
+ /**
31
+ * Converts json object to an object of type Location.
32
+ * @param {Object} json The json representation of the Location.
33
+ * @returns Object
34
+ * @memberof Location
35
+ */
36
+ static jsonToObj(json: any) {
37
+ return new Location(
38
+ json.date,
39
+ json.latitude,
40
+ json.locationdescription,
41
+ json.locationid,
42
+ json.longitude
43
+ );
44
+ }
45
+ }
46
+ export default Location;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @classdesc A class that represents the Marketing Cloud object.
3
+ * @constructs MarketingCloud
4
+ * @param {string} name The name of the custom event.
5
+ * @param {string} properties The attributes of the POI such as `name`, `address`, `zipCode` etc.
6
+ */
7
+ class MarketingCloud {
8
+ Name: string;
9
+ Properties: string;
10
+ constructor(name: string, properties: string) {
11
+ this.Name = name;
12
+ this.Properties = properties;
13
+ }
14
+ /**
15
+ * Converts json object to an object of type MarketingCloud.
16
+ * @param {Object} json The json representation of MarketingCloud.
17
+ * @returns Object
18
+ * @memberof MarketingCloud
19
+ */
20
+ static jsonToObj(json: any) {
21
+ return new MarketingCloud(json.name, json.properties);
22
+ }
23
+ }
24
+ module.exports = MarketingCloud;