@blueconic/blueconic-react-native 3.0.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
10
10
  s.license = { :type => 'Commercial' }
11
11
 
12
12
  s.authors = { 'BlueConic' => 'info@blueconic.com' }
13
- s.platform = :ios, "9.0"
13
+ s.platform = :ios, "12.0"
14
14
  s.homepage = "https://blueconic.com"
15
15
  s.source = { :http => "https://registry.npmjs.org/@blueconic/blueconic-react-native/-/blueconic-react-native-"+ package['version'] + ".tgz" }
16
16
 
package/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  `@blueconic/blueconic-react-native` adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
4
4
 
5
+ ## [3.2.0] 2024-06-14
6
+
7
+ ### Added
8
+ - Added support for timeline events in the SDK.
9
+
10
+ ## [3.1.0] 2024-03-12
11
+
12
+ ### Added
13
+ - Privacy Manifest as required by Apple Privacy Guidelines.
14
+ - SDK Code signing.
15
+
5
16
  ## [3.0.0] - 2024-02-29
6
17
 
7
18
  ### Changed
package/README.md CHANGED
@@ -1,484 +1,11 @@
1
+ ## BlueConic SDK for React Native
1
2
 
2
- # BlueConic SDK for React Native
3
+ The BlueConic SDK for React Native makes it easy for developers to collect profile data from their apps.
3
4
 
4
- ## Getting started
5
+ ## Documentation
5
6
 
6
- `$ npm install @blueconic/blueconic-react-native --save`
7
+ For the latest documentation, please visit the [BlueConic SDK for React Native documentation](https://support.blueconic.com/hc/en-us/articles/360033450654-BlueConic-SDK-for-React-Native).
7
8
 
8
- `$ react-native link @blueconic/blueconic-react-native`
9
-
10
-
11
- ## Usage
12
- Before you start implementing the SDK, use the following steps to set up your environment:
13
-
14
- #### React Native
15
- Run the following command in your React Native project's root folder
16
-
17
- `$ npm install @blueconic/blueconic-react-native`
18
-
19
- Or include it to your React Native project's package.json 
20
-
21
- ```
22
- {
23
- "react": "16.8.6",
24
- "react-native": "0.60.4",
25
- "@blueconic/blueconic-react-native": "^2.0.0"
26
- }
27
- ```
28
-  
29
-  
30
- ## iOS implementation of the React Native App
31
-
32
- #### 1. Add the .xcodeproj file of the BlueConicClient library
33
- - In Xcode, add the `.xcodeproj` file of the BlueConicClient library to the Libraries group of the project, you can find the `BlueConicClient.xcodeproj` in your app's node_modules in. To do this, drag and drop the `.xcodeproj` file to the Libraries group in Xcode.
34
- ```
35
- node_modules/@blueconic/blueconic-react-native/ios
36
- ```
37
-
38
- -  The `.xcodeproj` will include a Product folder, make sure the `libBlueConicClient.a` library is added to the Link Binary with Libraries section of the Build Phases of the app's target
39
- - The package is dependent on react-native. It searches for the react-native headers both in your project’s node `modules/react-native/React` directory, as well as in `./ios/Pods/Headers/Public` in case react-native is used through CocoaPods. If the react-native headers are saved elsewhere, add the correct path to the Header Search Paths Build Setting of the BlueConicClient target.
40
-
41
- #### 2. Add the configuration key for BlueConic:
42
-  Locate your app's Information Property List file under "Supporting Files".
43
-  Select <project>-Info.plist and add a new row by right clicking the top row and selecting "Add row". Set the following key name:
44
- ```
45
- bc_server_url
46
- ```
47
-  Double-click the value field and enter the URL for the hostname of your BlueConic server. For example:
48
- ```
49
-  http://example.blueconic.net
50
- ```
51
- #### 3. Locate your app's Information Property List file under "Supporting Files".
52
-  Select `<project>-Info.plist` and add a new row by right clicking the top row and selecting "Add row". Set the following key name:
53
- ```
54
-  URL types
55
- ```
56
-  This creates an array which contains more property rows. Open "URL types" by clicking the triangle icon in front of the name to display the rows. Right click "Item 0" and select "Add row". You can also add a new item, and add the new row within that item. Set the following key name:
57
- ```
58
-  URL Schemes
59
- ```
60
-  This creates another array. Add a new row to this array's "Item 0" and enter your apps "Bundle Identifier", for example:
61
- ```
62
-  com.blueconic.testApp
63
- ```
64
-  
65
- #### 4. Optionally, add a debug key for BlueConic:
66
-  Locate your app's Information Property List file under "Supporting Files".
67
-  Select <project>-Info.plist and add a new row by right clicking the top row and selecting "Add row". Set the following key name:
68
- ```
69
- bc_debug
70
- ```
71
-  Click the type and select 'Boolean'. Set the value to "YES" if you want to receive debug logs from the BlueConic SDK. Adding a debug key is optional; if you do not want to receive debug logs from the SDK, you do not need to add it.
72
-
73
- #### 5. Import BlueConic:
74
-  The BlueConic SDK for iOS enables you to set and retrieve profile property values for a BlueConic profile and enables interactions specific to this BlueConic profile. These methods can be used anywhere in the app. Make sure that you import the framework and get the instance before using the BlueConicClient methods:
75
- ```
76
- // Swift:
77
-  import BlueConicClient
78
-  
79
-  let client = BlueConicClient.getInstance(self)
80
-  
81
-  // Objective C:
82
-  #import <BlueConicClient/BlueConicClient-swift.h>
83
- ```
84
- ``` 
85
-  BlueConicClient *client = [BlueConicClient getInstance:self];
86
-  ** Make sure that you provide the current ViewController as argument when invoking getInstance. If no ViewController is available, pass an empty ViewController.
87
-  After you have added the URL Scheme value, select the AppDelegate class and add the following method to enable simulator functionality:
88
-  
89
-  // Swift: in the AppDelegate.swift file
90
-  func application(_ application: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] ) -> Bool { BlueConicClient.getInstance(nil).setURL(url)
91
-  return true
92
-  }
93
-  
94
-  // Objective-C: in the AppDelegate.m file
95
-  - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
96
-  [[BlueConicClient getInstance:nil] setURL:url];
97
-  return YES;
98
-  }
99
- ```
100
-  
101
- ##  Android implementation of the React Native App
102
-
103
- #### 1. Add the Android SDK blueconic-lib-<version>.aar to your app project as gradle module
104
- * Create `blueconic` directory in your projects' in the `android` root directory
105
- * Add `build.gradle` file with these contents:
106
-
107
- ```
108
- configurations.maybeCreate("default")
109
- artifacts.add("default", file('blueconic-lib-<version>.aar'))
110
- ```
111
-
112
- Add the .aar file to the 'blueconic' directory, alongside the `build.gradle`.
113
- You now have a gradle module called 'blueconic' which can be used in your app as well as in the BlueConic react-native NPM module.
114
-
115
- #### 2. Include the React Native project in the settings.gradle
116
- Append the following lines to the `android/settings.gradle` file.
117
-  
118
- ``` 
119
- include ':blueconic'
120
- include ':blueconic_blueconic-react-native'
121
- project(':blueconic_blueconic-react-native').projectDir = new File(rootProject.projectDir,
122
- '../node_modules/@blueconic/blueconic-react-native/android')
123
- ```
124
-
125
- This loads both the BlueConic React Native library as the BlueConic Android SDK.
126
-
127
- #### 3. (Optionally) Set "allow backup"-option to true in the AndroidManifest.xml
128
- It could be that the IDE requires to override the "allowBackup" options in order to build
129
- Add/ change this option in the AndroidManifest.xml
130
-
131
- ```
132
- android:allowBackup="true"
133
- ```
134
-  
135
- #### 4. Add permissions to the AndroidManifest.xml:
136
-
137
- ```
138
-  <uses-permission android:name="android.permission.INTERNET" />
139
-  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
140
- ```
141
-  
142
- #### 5. Add intent filters to the AndroidManifest.xml for connecting to the simulator:
143
- Configure your appId at the android:scheme attribute in the code fragment below. For example `"com.test.testapp"`.
144
-
145
- ```
146
-  <activity android:name=".MainActivity" android:label="@string/app_name">
147
-  <intent-filter>
148
-  <action android:name="android.intent.action.MAIN"/>
149
-  <category android:name="android.intent.category.LAUNCHER"/>
150
-  </intent-filter>
151
-  <!-- Filter added for connecting to the simulator through mail .-->
152
-  <intent-filter>
153
-  <action android:name="android.intent.action.SEND"/>
154
-  <category android:name="android.intent.category.DEFAULT"/>
155
-  <data android:mimeType="text/plain"/>
156
-  </intent-filter>
157
-  <!-- Filter added for connecting to the simulator through a QR scan. -->
158
-  <intent-filter>
159
-  <action android:name="android.intent.action.VIEW"/>
160
-  <category android:name="android.intent.category.DEFAULT"/>
161
-  <category android:name="android.intent.category.BROWSABLE"/>
162
-  <data android:scheme="<Your appId>"/>
163
-  </intent-filter>
164
-  </activity>
165
- ```
166
-
167
- #### 6. Add the configuration file for BlueConic:
168
-  Create a file named `blueconic_configuration.xml` in `/res/values/`:
169
- ```
170
- <?xml version="1.0" encoding="utf-8"?>
171
-  <resources>
172
-  <string name="bc_server_url">[BlueConic server url]</string>
173
-  </resources>
174
- ```
175
-  Replace `[BlueConic server url]` with the protocol and hostname of the BlueConic server. For example `"http://example.blueconic.net"`:
176
- ```
177
-  <?xml version="1.0" encoding="utf-8"?>
178
-  <resources>
179
-  <string name="bc_server_url">http://example.blueconic.net</string>
180
-  </resources>
181
- ```
182
-
183
- #### 7. Optionally, enable debug mode:
184
-  Add the following node to the configuration file
185
-  ```
186
- <bool name="bc_debug">true</bool>
187
- ```
188
-  
189
-  Example configuration file:
190
-  ```
191
- <?xml version="1.0" encoding="utf-8"?>
192
-  <resources>
193
-  <string name="bc_server_url">http://example.blueconic.net</string>
194
-  <bool name="bc_debug">true</bool>
195
-  </resources>
196
- ```
197
-  
198
- ## Using the BlueConicClient SDK in React Native apps:
199
- #### 1. Import NativeModules in the app
200
-  Import the BlueConicClient module within your app
201
- ```
202
- // React Native: in the Example.js file
203
-  import {
204
-  NativeModules
205
-  } from "react-native";
206
-
207
-  const {BlueConicClient} = NativeModules;
208
- ```
209
-
210
- #### 2. Create a page view event each time the user switches screens 
211
-  To keep track of every page viewed in the app, you are able to do so by creating a page view event. Make sure that a unique screen name is passed in the call. The screen name can be used in listener rules or to restrict interactions to specific screens. 
212
- ```
213
-  // React Native: in the Example.js file
214
-  // Simple screen names, like 'main' pages
215
-  BlueConicClient.registerPageView("main");
216
-  
217
-  // Unique screen names, e.g. per article
218
-  BlueConicClient.registerPageView("news/article/" + UID);
219
- ```
220
- #### 3. Retrieving and storing profile properties:
221
-  The BlueConic SDK for React native enables you to set and retrieve profile property values for a BlueConic profile. These methods can be used anywhere in the app. The following example counts the number of times a page has been opened and stores this number in the BlueConic profile:
222
- ```
223
-  // React native: in the ExampleScreen.js file
224
-  import React, { Component } from 'react';
225
-  import {
226
-   Text,
227
-   View,
228
-   NativeModules
229
-  } from 'react-native';
230
-  const {BlueConicClient} = NativeModules;
231
-  const PROPERTY_ID = "pageCount";
232
-  
233
-  export default class ExampleScreen extends Component {
234
-   constructor() {
235
-   super();
236
-   this.state {
237
-   pageCount: 0
238
-   };
239
-   this.updatePageCount();
240
-   }
241
-   updatePageCount = async() => {
242
-   const getProfileValueResult = await BlueConicClient.getProfileValue(PROPERTY_ID);
243
-   let pageCountValue = parseInt(getProfileResult) ?? 0;
244
-   BlueConicClient.setProfileValue(PROPERTY_ID, ++pageCountValue);
245
-  
246
-   this.setState({
247
-   pageCount: pageCountValue
248
-   });
249
-   }
250
-  }
251
- ```
252
- #### 4. Register events:
253
-  Calls to register an event can be done in the onLoad of a custom developed mobile Plugin. The code fragment shows how to trigger a click event. Possible events are: "VIEW", "CLICK" and "CONVERSION"
254
- ```
255
-  // React native: in the ExamplePlugin.js file
256
-  
257
-  // Register Dialogue events
258
-  BlueConicClient.registerDialogueEvent("VIEW", this.interactionId);
259
-  BlueConicClient.registerDialogueEvent("CLICK", this.interactionId);
260
-  BlueConicClient.registerDialogueEvent("CONVERSION", this.interactionId);
261
-  
262
-  // Register events through 'createEvent'
263
-  BlueConicClient.createEvent("VIEW", {
264
-  "interactionId": this.interactionId
265
-  }
266
- ```
267
-  
268
- ## Configuring BlueConic
269
-  This section describes how to add the channel for your mobile application to your BlueConic universe as well as how to define your custom profile properties so that you can use them in BlueConic segments.
270
-  
271
- ### Add the mobile channel to your universe
272
-  Before you can start measuring activity in your mobile applications and maintain values in visitor profile properties, the channel for your mobile application must be added to a domain in your BlueConic universe. The very first time that you start your application, BlueConic will detect it. It must then be added as a channel of the type "Mobile App" in a domain. See Managing channels for complete information.
273
-  
274
- ### Custom profile properties
275
-  If you want your mobile application to be able to add custom properties to visitor profiles and use them in BlueConic segments, those custom profile properties must be added to your plugin. For complete information on writing a custom plugin, see Plugin Types. For information about adding custom profile properties, see profile properties.
276
-  
277
- ## BlueConicClient Methods
278
-  Implementation of the BlueConic client, handling profile retrieval and storage. This may be from cache, persistent storage on the client or direct requests to the BlueConic server.
279
- ```
280
-  import {
281
-  NativeModules
282
-  } from "react-native";
283
-  const {BlueConicClient} = NativeModules;
284
- ```
285
- ###  getProfileId() -> String
286
-  Returns the ID of the BlueConic Profile.
287
- ```
288
-  // with promise:
289
-  const profileId = await BlueConicClient.getProfileId();
290
-  
291
-  // with callback:
292
-  BlueConicClient.getProfileIdWithCallback(profileId => {
293
-  
294
-  });
295
- ```
296
-  `Return Value` The ID of the BlueConic profile
297
-
298
- ###   getProfileValue(property: String) -> String
299
-
300
-  Returns the first value for a given profile property.
301
- ```
302
-  // with promise:
303
-  const hobby = await BlueConicClient.getProfileValue("hobby");
304
-  
305
-  // with callback:
306
-  BlueConicClient.getProfileValueWithCallback("hobby", hobby => {
307
-  
308
-  });
309
- ```
310
-  Parameter `property` The profile property to get the values for.
311
-  
312
-
313
-  `Return Value`  The first value
314
-  
315
-
316
- ### getProfileValues(property: String) -> String[]
317
-  
318
-  Return the values for a given profile property.
319
-  
320
- ```
321
-  // with promise:
322
-  const hobbies = await BlueConicClient.getProfileValues("hobbies");
323
-  
324
-  // with callback:
325
-  BlueConicClient.getProfileValuesWithCallback("hobbies", hobbies => {
326
-  
327
-  });
328
- ```
329
-  Parameter `property`  The profile property to get the values for.
330
-  
331
-
332
-  `Return Value` A collection containing the values.
333
-  
334
-  
335
-  
336
- ### addProfileValue(property: String, value: String)
337
-  Adds a single property value to the profile. If there are already values for a property the new value will be added. Values for a property need to be unique; passing the same value multiple times will have no effect.
338
-  
339
- ```
340
-  BlueConicClient.addProfileValue("hobbies", "tennis");
341
- ```
342
- Parameter `property` The profile property to add the values for.
343
-
344
- Parameter `value` The property value to add to the profile.
345
-
346
-  
347
-  
348
- ###  addProfileValues(property: String, values: String[]) 
349
-  Adds property values to the profile. The values from the collection are added to the profile. If there are already values for a property the new values will be added. Values for a property need to be unique; passing the same values multiple times will have no effect.
350
-  
351
- ```
352
-  BlueConicClient.addProfileValues("hobbies", ["tennis", "soccer"]);
353
- ```
354
-
355
- Parameter `property` The profile property to add the values for.
356
-
357
- Parameter `values` The property values to add to the profile.
358
-
359
-  
360
-  
361
- ###  setProfileValue(name: String, value: String) 
362
-  It sets values on the profile. Passing a property that was already set with values will cause the old values to be removed.
363
-  
364
- ```
365
-  BlueConicClient.setProfileValue("hobby", "tennis");
366
- ```
367
-
368
- Parameter `property` The profile property to add the values for.
369
-
370
- Parameter `values` The profile values to store.
371
-
372
-  
373
-  
374
- ###  setProfileValues(name: String, values: String[]) 
375
-  It sets values on the profile. Passing a property that was already set with values will cause the old values to be removed.
376
-  
377
- ```
378
-  BlueConicClient.setProfileValues("hobbies", ["tennis", "soccer"]);
379
- ```
380
- Parameter `property`  The profile property to add the values for.
381
-
382
- Parameter `values` The profile values to store.
383
-
384
-  
385
-  
386
- ###  setLocale(locale: String)
387
-  Setter for the locale to get the parameters for. By default, the default locale configured in BlueConic is used.
388
-
389
- Note: the only valid locales currently are `'en_US'` and `'nl_NL'`.
390
-  
391
- ```
392
-  BlueConicClient.setLocale("en_US");
393
- ```
394
- Parameter `locale`  The locale, e.g.‘en_US’.
395
-
396
- ### createEvent(eventType: String, properties: Object)
397
-  Registers an event of the specified type with the given properties. For a `“PAGEVIEW"` event a screen name can be passed, so interactions can be restricted on the where tab in BlueConic. For a `“VIEW"`, `“CLICK"` or `“CONVERSION"` event an interactionId should be passed to register the event for.
398
-  
399
- ```
400
-  BlueConicClient.createEvent("PAGEVIEW", {
401
-  "screenName": "Main/HOMETAB"
402
-  });
403
-  BlueConicCLient.createEvent("VIEW", {
404
-  "interactionId": this.interactionId
405
-  }):
406
- ```
407
-
408
-  Parameter `eventType` The event type. (e.g:`"PAGEVIEW"`,`"VIEW"`,`“CLICK"`,`“CONVERSION"`)
409
-
410
-  
411
-  Parameter `properties` A map with properties for the event.
412
-
413
-  
414
-  
415
- ##  Register Methods
416
-  Methods to register events and page views
417
-  
418
-
419
- ###  registerPageView(screenName: String)
420
-  Registers a page event. For a “PAGEVIEW" event a screen name can be passed, so interactions can be restricted on the where tab in BlueConic.
421
-  
422
- ```
423
-  BlueConicClient.registerPageView("Main/HOMETAB");
424
- ```
425
-  Parameter `screenName` The screen name for this page view
426
-  
427
- ### registerDialogueEvent(eventType: String, interactionId: String)
428
- Registers a dialogue event of the specified type with the given properties. For a “VIEW", “CLICK" or “CONVERSION" event an interactionId should be passed to register the event for.
429
-
430
- ```
431
- BlueConicClient.registerDialogueEvent("VIEW", this.interactionId):
432
- ```
433
- Parameter `eventType` The event type. (e.g:“VIEW",“CLICK",“CONVERSION")
434
-
435
- Parameter `properties` A map with properties for the event.
436
-
437
-  
438
- ## Register user event Methods
439
-  Methods to register events and page views
440
-
441
- ###  registerClickEvent(selector: String)
442
-
443
-
444
-  Register a user click. For the event, a selector can be passed to trigger BlueConic Listeners, to execute their logic.
445
-  
446
- ```
447
-  BlueConicClient.registerClickEvent("#homeButton");
448
- ```
449
-  Parameter `selector`  The selector, which can be used in the listener rules, to listen on
450
-  
451
-     
452
-
453
- ### registerClickEventWithContext(selector: String, values: String[])
454
- Register a user click. For the event, a selector can be passed to trigger BlueConic Listeners, to execute their logic.
455
-
456
- ```
457
- BlueConicClient.registerClickEventWithContext("#homeButton", ["contextA","contextB"]);
458
- ```
459
-
460
- Parameter `selector` The selector, which can be used in the listener rules, to listen on
461
- Parameter `values` context of the click event 
462
-   
463
- ### registerUpdateValuesEvent(selector: String, values: String[])
464
-   Register a user update values event. For the event, a selector can be passed to trigger BlueConic Listeners, to execute their logic.
465
-
466
- ```
467
-   BlueConicClient.registerUpdateValuesEvent("#updateHobby", ["tennis","soccer"]);
468
- ```
469
-
470
-   Parameter `selector` The selector, which can be used in the listener rules, to listen on
471
-   
472
- Parameter `values` context of the update values event 
473
-     
474
- ### registerAdvancedEvent(name: String, values: String[])
475
-     Register a user update values event. For the event, a selector can be passed to trigger BlueConic Listeners, to execute their logic.
476
-     
477
- ```
478
-     BlueConicClient.registerAdvancedEvent("facebookLike", ["+1"]);
479
- ```
480
-
481
-     Parameter `name` The name of the advanced even, which can be used in the listener rules, to listen on
482
-
483
- Parameter `values` context of the advanced event
9
+ ## License
484
10
 
11
+ The SDK is available under the commercial license. See the LICENSE file for more info.
@@ -19,10 +19,10 @@ android {
19
19
  defaultConfig {
20
20
  minSdkVersion 21
21
21
  targetSdkVersion 33
22
- versionCode 300
23
- versionName "3.0.0"
22
+ versionCode 320
23
+ versionName "3.2.0"
24
24
  buildConfigField 'String', 'PLATFORM_NAME', "\"React Native\""
25
- buildConfigField 'String', 'PLATFORM_VERSION', "\"3.0.0\""
25
+ buildConfigField 'String', 'PLATFORM_VERSION', "\"3.2.0\""
26
26
  }
27
27
  lintOptions {
28
28
  abortOnError false
@@ -36,5 +36,5 @@ repositories {
36
36
 
37
37
  dependencies {
38
38
  compileOnly 'com.facebook.react:react-android:+'
39
- implementation 'com.blueconic:blueconic-android-lib:5.1.0'
39
+ implementation 'com.blueconic:blueconic-android-lib:5.2.1'
40
40
  }
@@ -22,12 +22,7 @@ import com.facebook.react.bridge.WritableNativeArray;
22
22
  import com.facebook.react.bridge.WritableNativeMap;
23
23
  import com.facebook.react.modules.core.DeviceEventManagerModule;
24
24
 
25
- import java.util.Map;
26
- import java.util.HashMap;
27
- import java.util.Collections;
28
- import java.util.Collection;
29
- import java.util.List;
30
- import java.util.ArrayList;
25
+ import java.util.*;
31
26
 
32
27
  import javax.annotation.Nonnull;
33
28
 
@@ -610,7 +605,6 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
610
605
  callback.invoke(Arguments.createArray());
611
606
  }
612
607
 
613
-
614
608
  /**
615
609
  * Update sync the BlueConic Profile
616
610
  */
@@ -750,6 +744,142 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
750
744
  }
751
745
  }
752
746
 
747
+ /**
748
+ * Create Timeline Event.
749
+ * @param eventType The type of event
750
+ * @param eventDate The date of the event
751
+ * @param readableMap The readable map retrieved from React native
752
+ */
753
+ @ReactMethod
754
+ public void registerTimelineEvent(@Nonnull String eventType, double eventDate, ReadableMap readableMap) {
755
+ final BlueConicClient blueConicClient = getBlueConicClientInstance();
756
+ final Map<String, Object> properties = readableMap.toHashMap();
757
+
758
+ if (blueConicClient != null) {
759
+ blueConicClient.createTimelineEvent(eventType, new Date((long) eventDate), properties, null);
760
+ }
761
+ }
762
+
763
+ /**
764
+ * Create Timeline Event.
765
+ * @param eventType The type of event
766
+ * @param eventDate The date of the event
767
+ * @param readableMap The readable map retrieved from React native
768
+ * @param promise The promise to handle the obtained value. Promises are necessary in Native Modules
769
+ * Native Modules to pass values back to the JavaScript.
770
+ */
771
+ @ReactMethod
772
+ public void registerTimelineEventSync(@Nonnull String eventType, double eventDate, ReadableMap readableMap, @Nonnull final Promise promise) {
773
+ final BlueConicClient blueConicClient = getBlueConicClientInstance();
774
+ final Map<String, Object> properties = readableMap.toHashMap();
775
+
776
+ if (blueConicClient != null) {
777
+ blueConicClient.createTimelineEvent(eventType, new Date((long) eventDate), properties, new Runnable() {
778
+ @Override
779
+ public void run() {
780
+ promise.resolve(Arguments.createArray());
781
+ }
782
+ });
783
+ return;
784
+ }
785
+
786
+ promise.resolve(Arguments.createArray());
787
+ }
788
+
789
+ /**
790
+ * Create Timeline Event.
791
+ * @param eventType The type of event
792
+ * @param eventDate The date of the event
793
+ * @param readableMap The readable map retrieved from React native
794
+ * @param callback The Callback function to handle the obtained values. Callbacks are necessary in Native Modules
795
+ * to pass values back to the JavaScript.
796
+ */
797
+ @ReactMethod
798
+ public void registerTimelineEventSyncWithCallback(@Nonnull String eventType, double eventDate, ReadableMap readableMap, @Nonnull final Callback callback) {
799
+ final BlueConicClient blueConicClient = getBlueConicClientInstance();
800
+ final Map<String, Object> properties = readableMap.toHashMap();
801
+
802
+ if (blueConicClient != null) {
803
+ blueConicClient.createTimelineEvent(eventType, new Date((long) eventDate), properties, new Runnable() {
804
+ @Override
805
+ public void run() {
806
+ callback.invoke(Arguments.createArray());
807
+ }
808
+ });
809
+ return;
810
+ }
811
+
812
+ callback.invoke(Arguments.createArray());
813
+ }
814
+
815
+ /**
816
+ * Create Timeline Event.
817
+ * @param eventType The type of event
818
+ * @param eventDate The date of the event
819
+ * @param readableMap The readable map retrieved from React native
820
+ */
821
+ @ReactMethod
822
+ public void registerTimelineEventById(@Nonnull String eventId, @Nonnull String eventType, double eventDate, ReadableMap readableMap) {
823
+ final BlueConicClient blueConicClient = getBlueConicClientInstance();
824
+ final Map<String, Object> properties = readableMap.toHashMap();
825
+
826
+ if (blueConicClient != null) {
827
+ blueConicClient.createTimelineEventById(eventId, eventType, new Date((long) eventDate), properties, null);
828
+ }
829
+ }
830
+
831
+ /**
832
+ * Create Timeline Event.
833
+ * @param eventType The type of event
834
+ * @param eventDate The date of the event
835
+ * @param readableMap The readable map retrieved from React native
836
+ * @param promise The promise to handle the obtained value. Promises are necessary in Native Modules
837
+ * Native Modules to pass values back to the JavaScript.
838
+ */
839
+ @ReactMethod
840
+ public void registerTimelineEventByIdSync(@Nonnull String eventId, @Nonnull String eventType, double eventDate, ReadableMap readableMap, @Nonnull final Promise promise) {
841
+ final BlueConicClient blueConicClient = getBlueConicClientInstance();
842
+ final Map<String, Object> properties = readableMap.toHashMap();
843
+
844
+ if (blueConicClient != null) {
845
+ blueConicClient.createTimelineEventById(eventId, eventType, new Date((long) eventDate), properties, new Runnable() {
846
+ @Override
847
+ public void run() {
848
+ promise.resolve(Arguments.createArray());
849
+ }
850
+ });
851
+ return;
852
+ }
853
+
854
+ promise.resolve(Arguments.createArray());
855
+ }
856
+
857
+ /**
858
+ * Create Timeline Event.
859
+ * @param eventType The type of event
860
+ * @param eventDate The date of the event
861
+ * @param readableMap The readable map retrieved from React native
862
+ * @param callback The Callback function to handle the obtained values. Callbacks are necessary in Native Modules
863
+ * to pass values back to the JavaScript.
864
+ */
865
+ @ReactMethod
866
+ public void registerTimelineEventByIdSyncWithCallback(@Nonnull String eventId, @Nonnull String eventType, double eventDate, ReadableMap readableMap, @Nonnull final Callback callback) {
867
+ final BlueConicClient blueConicClient = getBlueConicClientInstance();
868
+ final Map<String, Object> properties = readableMap.toHashMap();
869
+
870
+ if (blueConicClient != null) {
871
+ blueConicClient.createTimelineEventById(eventId, eventType, new Date((long) eventDate), properties, new Runnable() {
872
+ @Override
873
+ public void run() {
874
+ callback.invoke(Arguments.createArray());
875
+ }
876
+ });
877
+ return;
878
+ }
879
+
880
+ callback.invoke(Arguments.createArray());
881
+ }
882
+
753
883
  /**
754
884
  * Creates a ClickEvent for the given selector and publishes the event to BlueConic using the EventManager.
755
885
  * @param selector The selector to identify the clicked component.
@@ -865,7 +995,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
865
995
  BlueConicClient instance = BlueConicClientFactory.INSTANCE.getInstance(currentActivity);
866
996
  //Set platform information
867
997
  BlueConicClientImpl implInstance = (BlueConicClientImpl) instance;
868
- //implInstance.setPlatformInformation(BuildConfig.PLATFORM_NAME, BuildConfig.PLATFORM_VERSION);
998
+ implInstance.setPlatformInformation(BuildConfig.PLATFORM_NAME, BuildConfig.PLATFORM_VERSION);
869
999
  return instance;
870
1000
  }
871
1001
 
@@ -55,7 +55,7 @@ RCT_EXTERN_METHOD(hasSegmentWithCallback:(NSString *)segmentId withCallback:(RCT
55
55
 
56
56
  RCT_EXTERN_METHOD(createEvent:(NSString *)eventName withProperties:(NSDictionary *)properties)
57
57
  RCT_EXTERN_METHOD(createEventSync:(NSString *)eventName withProperties:(NSDictionary *)properties withResolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
58
- RCT_EXTERN_METHOD(createEventSyncWithCallback:eventName withProperties:(NSDictionary *)properties withCallback:(RCTResponseSenderBlock)callback)
58
+ RCT_EXTERN_METHOD(createEventSyncWithCallback:(NSString *)eventName withProperties:(NSDictionary *)properties withCallback:(RCTResponseSenderBlock)callback)
59
59
 
60
60
  RCT_EXTERN_METHOD(updateProfile)
61
61
  RCT_EXTERN_METHOD(updateProfileSync:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
@@ -65,6 +65,14 @@ RCT_EXTERN_METHOD(registerPageView:(NSString *)screenName)
65
65
  RCT_EXTERN_METHOD(registerPageViewSync:(NSString *)screenName withResolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
66
66
  RCT_EXTERN_METHOD(registerPageViewSyncWithCallback:(NSString *)screenName withCallback:(RCTResponseSenderBlock)callback)
67
67
 
68
+ RCT_EXTERN_METHOD(registerTimelineEvent:(NSString *)eventType withDate:(NSDate *)eventDate withProperties:(NSDictionary *)properties)
69
+ RCT_EXTERN_METHOD(registerTimelineEventSync:(NSString *)eventType withDate:(NSDate *)eventDate withProperties:(NSDictionary *)properties withResolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
70
+ RCT_EXTERN_METHOD(registerTimelineEventSyncWithCallback:(NSString *)eventType withDate:(NSDate *)eventDate withProperties:(NSDictionary *)properties withCallback:(RCTResponseSenderBlock)callback)
71
+
72
+ RCT_EXTERN_METHOD(registerTimelineEventById:(NSString *)eventId withType:(NSString *)eventType withDate:(NSDate *)eventDate withProperties:(NSDictionary *)properties)
73
+ RCT_EXTERN_METHOD(registerTimelineEventByIdSync:(NSString *)eventId withType:(NSString *)eventType withDate:(NSDate *)eventDate withProperties:(NSDictionary *)properties withResolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
74
+ RCT_EXTERN_METHOD(registerTimelineEventByIdSyncWithCallback:(NSString *)eventId withType:(NSString *)eventType withDate:(NSDate *)eventDate withProperties:(NSDictionary *)properties withCallback:(RCTResponseSenderBlock)callback)
75
+
68
76
  RCT_EXTERN_METHOD(registerClickEvent:(NSString *)selector)
69
77
  RCT_EXTERN_METHOD(registerClickEventWithContext:(NSString *)selector withValues:(NSArray *)values)
70
78
  RCT_EXTERN_METHOD(registerFormSubmitEvent:(NSString *)selector)
@@ -1,4 +1,5 @@
1
1
  import UIKit
2
+ import Foundation
2
3
  import BlueConicClient
3
4
 
4
5
  /**
@@ -8,7 +9,7 @@ import BlueConicClient
8
9
  @objc(BlueConicClientModule)
9
10
  class BlueConicClientModule: RCTEventEmitter {
10
11
  private static var platformName: String = "React Native"
11
- private static var platformVersion: String = "3.0.0"
12
+ private static var platformVersion: String = "3.2.0"
12
13
  private static var moduleInstance: BlueConicClientModule?
13
14
  private static var hasListeners: Bool?
14
15
 
@@ -381,6 +382,40 @@ class BlueConicClientModule: RCTEventEmitter {
381
382
  })
382
383
  }
383
384
 
385
+ /**
386
+ Calls the createTimelineEvent method of the BlueConicClient.
387
+ */
388
+ @objc func registerTimelineEvent(_ eventType: String, withDate eventDate: Date, withProperties properties: [String: Any]) -> Void {
389
+ self.getBlueConicClientInstance().createTimelineEvent(eventType, eventDate: eventDate, properties: properties)
390
+ }
391
+ @objc func registerTimelineEventSync(_ eventType: String, withDate eventDate: Date, withProperties properties: [String: Any], withResolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
392
+ self.getBlueConicClientInstance().createTimelineEvent(eventType, eventDate: eventDate, properties: properties, completion: {
393
+ resolve([])
394
+ })
395
+ }
396
+ @objc func registerTimelineEventSyncWithCallback(_ eventType: String, withDate eventDate: Date, withProperties properties: [String: Any], withCallback callback: @escaping RCTResponseSenderBlock) -> Void {
397
+ self.getBlueConicClientInstance().createTimelineEvent(eventType, eventDate: eventDate, properties: properties, completion: {
398
+ callback([])
399
+ })
400
+ }
401
+
402
+ /**
403
+ Calls the createTimelineEventById method of the BlueConicClient.
404
+ */
405
+ @objc func registerTimelineEventById(_ eventId: String, withType eventType: String, withDate eventDate: Date, withProperties properties: [String: Any]) -> Void {
406
+ self.getBlueConicClientInstance().createTimelineEventById(eventId, eventType: eventType, eventDate: eventDate, properties: properties)
407
+ }
408
+ @objc func registerTimelineEventByIdSync(_ eventId: String, withType eventType: String, withDate eventDate: Date, withProperties properties: [String: Any], withResolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
409
+ self.getBlueConicClientInstance().createTimelineEventById(eventId, eventType: eventType, eventDate: eventDate, properties: properties, completion: {
410
+ resolve([])
411
+ })
412
+ }
413
+ @objc func registerTimelineEventByIdSyncWithCallback(_ eventId: String, withType eventType: String, withDate eventDate: Date, withProperties properties: [String: Any], withCallback callback: @escaping RCTResponseSenderBlock) -> Void {
414
+ self.getBlueConicClientInstance().createTimelineEventById(eventId, eventType: eventType, eventDate: eventDate, properties: properties, completion: {
415
+ callback([])
416
+ })
417
+ }
418
+
384
419
  /**
385
420
  Creates a ClickEvent for the given selector and publishes the event to BlueConic using the EventManager.
386
421
  - parameter selector: The selector to identify the clicked component.
@@ -466,7 +501,7 @@ class BlueConicClientModule: RCTEventEmitter {
466
501
  */
467
502
  private func getBlueConicClientInstance() -> BlueConic {
468
503
  let instance = BlueConic.getInstance()
469
- //BlueConic.setPlatformInformation(platformName: BlueConicClientModule.platformName, platformVersion: BlueConicClientModule.platformVersion)
504
+ BlueConic.setPlatformInformation(platformName: BlueConicClientModule.platformName, platformVersion: BlueConicClientModule.platformVersion)
470
505
  return instance
471
506
  }
472
507
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueconic/blueconic-react-native",
3
- "version": "3.0.0",
3
+ "version": "3.2.0",
4
4
  "description": "The BlueConicClient Framework provides the basis for communicating with BlueConic.",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -26,8 +26,8 @@
26
26
  "author": "BlueConic (info@blueconic.com)",
27
27
  "license": "SEE LICENSE IN LICENSE",
28
28
  "nativeDependencies": {
29
- "android": "5.1.0",
30
- "ios": "3.1.0"
29
+ "android": "5.2.1",
30
+ "ios": "3.3.0"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "react-native": "<1.0.0"