@selligent-marketing-cloud/selligent-react-native 3.4.1 → 3.5.1

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 (29) hide show
  1. package/README.md +11 -48
  2. package/RNSelligentMapper.podspec +1 -1
  3. package/android/build.gradle +27 -16
  4. package/android/libs/RNSelligentMobileSDK.aar +0 -0
  5. package/android/src/main/AndroidManifest.xml +1 -1
  6. package/android/src/main/java/com/selligent/EventReceiver.java +1 -0
  7. package/android/src/main/java/com/selligent/RNSelligent.java +12 -0
  8. package/documentation/README.md +31 -32
  9. package/helpers.js +1 -1
  10. package/index.ios.js +1 -1
  11. package/index.js +10 -21
  12. package/package.json +10 -6
  13. package/android/src/main/java/com/selligent/BroadcastDataFactory.java +0 -47
  14. package/android/src/main/java/com/selligent/BroadcastEventDataParser.java +0 -9
  15. package/android/src/main/java/com/selligent/BroadcastEventType.java +0 -37
  16. package/android/src/main/java/com/selligent/ButtonAction.java +0 -82
  17. package/android/src/main/java/com/selligent/ButtonBroadcastEventDataParser.java +0 -50
  18. package/android/src/main/java/com/selligent/ClearCacheIntervalValue.java +0 -36
  19. package/android/src/main/java/com/selligent/DeviceIdBroadcastEventDataParser.java +0 -15
  20. package/android/src/main/java/com/selligent/Event.java +0 -51
  21. package/android/src/main/java/com/selligent/EventType.java +0 -27
  22. package/android/src/main/java/com/selligent/GCMTokenBroadcastEventDataParser.java +0 -24
  23. package/android/src/main/java/com/selligent/InAppMessageBroadcastEventDataParser.java +0 -43
  24. package/android/src/main/java/com/selligent/InAppMessageRefreshType.java +0 -34
  25. package/android/src/main/java/com/selligent/NotificationMessageBroadcastEventDataParser.java +0 -19
  26. package/android/src/main/java/com/selligent/RemoteMessageDisplayType.java +0 -50
  27. package/android/src/main/java/com/selligent/SMEventFactory.java +0 -37
  28. package/android/src/main/java/com/selligent/SMSettingsFactory.java +0 -38
  29. package/android/src/main/java/com/selligent/Settings.java +0 -160
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # SelligentMobileSDK-ReactNative (selligent-react-native)
1
+ # Marigold Engage-ReactNative (selligent-react-native)
2
2
 
3
- This module provides an API for the usage of the Selligent Mobile SDKs in React Native.
3
+ This module provides an API for the usage of the Marigold Engage Mobile SDKs in React Native.
4
4
 
5
- ## SelligentMobileSDK-ReactNative Integration
5
+ ## Marigold Engage-ReactNative Integration
6
6
 
7
7
  This module supports the following SDK and tools:
8
8
 
@@ -11,7 +11,7 @@ This module supports the following SDK and tools:
11
11
  | SDK | Version |
12
12
  | ------------------------------------------------------------------------------ | ------- |
13
13
  | [Android SDK](https://github.com/SelligentMarketingCloud/MobileSDK-Android) | 4.4.0 |
14
- | [iOS SDK](https://github.com/SelligentMarketingCloud/MobileSDK-iOS) | 3.7.0 |
14
+ | [iOS SDK](https://github.com/SelligentMarketingCloud/MobileSDK-iOS) | 3.8.1 |
15
15
  | ReactNative | 0.72.4 |
16
16
  | Expo SDK | 49 |
17
17
 
@@ -43,45 +43,6 @@ This module supports the following SDK and tools:
43
43
 
44
44
  > **IMPORTANT:** Since version 2.6.0 of this module we require your app to use the Android Gradle Plugin version 7.0.0 or higher in order to build on Android.
45
45
 
46
- > ### **Attention for Huawei developers!**
47
- >
48
- > In order to use this module on Huawei devices (without Goggle Play services), you should add the following dependencies in the `build.gradle` files of the Android project in your React Native project:
49
- >
50
- > In your Android project's root `build.gradle` file:
51
- >
52
- > ```gradle
53
- >
54
- > buildscript {
55
- > repositories {
56
- > maven { url 'https://developer.huawei.com/repo/' }
57
- > }
58
- > dependencies {
59
- > classpath 'com.huawei.agconnect:agcp:1.6.0.300'
60
- > }
61
- > }
62
- >
63
- > allProjects: {
64
- > repositories: {
65
- > maven { url 'https://developer.huawei.com/repo/' }
66
- > }
67
- > }
68
- >
69
- > ```
70
- >
71
- > In your app module's `build.gradle` file:
72
- >
73
- > ```gradle
74
- >
75
- > apply plugin: 'com.huawei.agconnect'
76
- >
77
- > dependencies {
78
- > api 'com.huawei.hms:base:6.2.0.300'
79
- > api 'com.huawei.hms:push:6.1.0.300'
80
- > api 'com.huawei.hms:maps:6.2.0.301'
81
- > }
82
- >
83
- > ```
84
-
85
46
  <details>
86
47
  <summary>Without autolinking (RN 0.59 and below)</summary>
87
48
 
@@ -213,18 +174,20 @@ This module supports the following SDK and tools:
213
174
 
214
175
  > Do not check the "copy if needed" option to make sure you only have to manage one selligent.json file
215
176
 
216
- 3. Add the native iOS SDK dependency in your Podfile: `s.dependency "SelligentMobileSDK/Framework", "3.7.0"` or download it manually from [here](https://github.com/SelligentMarketingCloud/MobileSDK-iOS/tree/master/Framework) and drag and drop it into you **Xcode project**.
177
+ 3. Add the native iOS SDK dependency in your Podfile: `s.dependency "SelligentMobileSDK/Framework", "3.8.1"` or download it manually from [here](https://github.com/SelligentMarketingCloud/MobileSDK-iOS/tree/master/Framework) and drag and drop it into you **Xcode project**.
178
+
179
+ 4. Add the RNSelligentMapper pod in your Podfile: `pod 'RNSelligentMapper', :path => '../node_modules/@selligent-marketing-cloud/selligent-react-native/RNSelligentMapper.podspec'`.
217
180
 
218
- 4. Execute `pod install` in the `/ios` folder
181
+ 5. Execute `pod install` in the `/ios` folder
219
182
 
220
- 5. From now on, open the `.xcworkspace` file to make changes in Xcode
183
+ 6. From now on, open the `.xcworkspace` file to make changes in Xcode
221
184
 
222
- 6. Bootstrap the SDK in the `application:didFinishLaunchingWithOptions:` of the `AppDelegate.mm`
185
+ 7. Bootstrap the SDK in the `application:didFinishLaunchingWithOptions:` of the `AppDelegate.mm`
223
186
 
224
187
  ```objective-c
225
188
  @import RNSelligentMobileSDK;
226
189
 
227
- // You can alternatively specify a different file name (without the extension) from where to load the Selligent configs (defaults to 'selligent')
190
+ // You can alternatively specify a different file name (without the extension) from where to load the Marigold Engage configs (defaults to 'selligent')
228
191
  // if (!launchOptions) {
229
192
  // launchOptions = [NSMutableDictionary new];
230
193
  // }
@@ -7,7 +7,7 @@ Pod::Spec.new do |s|
7
7
  s.authors = package['author']
8
8
  s.version = package["version"]
9
9
  s.summary = package["description"]
10
- s.description = "React Native wrapper mapper for the Selligent Marketing Cloud Android and iOS SDKs"
10
+ s.description = "React Native wrapper mapper for the Marigold Engage Android and iOS SDKs"
11
11
  s.homepage = package['homepage']
12
12
  s.license = "MIT"
13
13
  s.platform = :ios, "12.0"
@@ -8,7 +8,7 @@ buildscript {
8
8
  }
9
9
 
10
10
  dependencies {
11
- classpath 'com.android.tools.build:gradle:7.0.0'
11
+ classpath 'com.android.tools.build:gradle:8.1.2'
12
12
  }
13
13
  }
14
14
 
@@ -16,16 +16,22 @@ apply plugin: 'com.android.library'
16
16
 
17
17
  android {
18
18
  namespace 'com.selligent'
19
- compileSdk 33
19
+ compileSdk 34
20
20
 
21
21
  defaultConfig {
22
22
  minSdkVersion 21
23
- targetSdkVersion 33
23
+ targetSdkVersion 34
24
24
  }
25
25
 
26
26
  buildFeatures {
27
27
  buildConfig true
28
28
  }
29
+
30
+ sourceSets {
31
+ main {
32
+ jniLibs.srcDirs = ['libs']
33
+ }
34
+ }
29
35
  }
30
36
 
31
37
  androidComponents {
@@ -37,7 +43,7 @@ androidComponents {
37
43
  variant.buildConfigFields.put("SELLIGENT_SETTINGS", new BuildConfigField("String", "\"" + selligentSettings + "\"", "Selligent settings"))
38
44
  }
39
45
  catch (Exception ignored) {
40
- throw new Exception("Selligent requires Android Gradle plugin version 7.0.0 or higher.")
46
+ throw new Exception("Selligent requires Android Gradle plugin version 8.1.0 or higher.")
41
47
  }
42
48
  }
43
49
  })
@@ -65,32 +71,37 @@ dependencies {
65
71
  implementation 'androidx.cardview:cardview:1.0.0'
66
72
  implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1'
67
73
  implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1'
74
+ implementation files("libs/RNSelligentMobileSDK.aar")
68
75
  }
69
76
 
70
77
  def loadSelligentSettings(variant) {
71
78
  def currentFlavor = getCurrentFlavor()
72
- def defaultSelligentFileName = "selligent.json"
73
- File defaultFile = new File("$project.rootDir/../$defaultSelligentFileName")
74
-
75
- if (currentFlavor != "") {
76
- defaultFile = new File("$project.rootDir/../$currentFlavor/$defaultSelligentFileName")
77
- }
78
-
79
- def variantSelligentFileName = "selligent.${variant.getName()}.json"
80
- File variantFile = new File("$project.rootDir/../$variantSelligentFileName")
81
-
79
+ def defaultFileName = "selligent.json"
80
+ def variantFileName = "selligent.${variant.getName()}.json"
82
81
  def resultingSettings = null
83
82
 
83
+ File variantFile = new File("$project.rootDir/../$variantFileName")
84
+ File defaultFile = new File("$project.rootDir/../$defaultFileName")
85
+ File flavorFile = new File("$project.rootDir/../$currentFlavor/$defaultFileName")
86
+
84
87
  if (variantFile.exists()) {
85
- println("Reading Selligent properties for variant ${variant.getName()} using $variantSelligentFileName")
88
+ println("Reading Marigold Engage properties for variant ${variant.getName()} from $variantFile.path")
86
89
  resultingSettings = ""
87
90
 
88
91
  variantFile.eachLine { String line ->
89
92
  resultingSettings += line.replace("\"", "\\\"").replaceAll("\\s", "")
90
93
  }
91
94
  }
95
+ else if (currentFlavor != "" && flavorFile.exists()) {
96
+ println("Reading Marigold Engage properties for flavor $currentFlavor using $flavorFile.path")
97
+ resultingSettings = ""
98
+
99
+ flavorFile.eachLine { String line ->
100
+ resultingSettings += line.replace("\"", "\\\"").replaceAll("\\s", "")
101
+ }
102
+ }
92
103
  else if (defaultFile.exists()) {
93
- println("Reading Selligent properties from default ${defaultFile.name} (no variant specific $variantSelligentFileName was found)")
104
+ println("Reading default Marigold Engage properties from ${defaultFile.path} (no variant specific nor flavor $defaultFileName were found)")
94
105
  resultingSettings = ""
95
106
 
96
107
  defaultFile.eachLine { String line ->
@@ -1 +1 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android" />
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.selligent" />
@@ -7,6 +7,7 @@ import android.text.TextUtils;
7
7
 
8
8
  import com.facebook.react.bridge.WritableMap;
9
9
  import com.facebook.react.modules.core.DeviceEventManagerModule.RCTDeviceEventEmitter;
10
+ import com.selligent.rnmobilesdk.BroadcastDataFactory;
10
11
 
11
12
 
12
13
  class EventReceiver extends BroadcastReceiver {
@@ -30,6 +30,18 @@ import com.facebook.react.bridge.WritableNativeMap;
30
30
  import com.facebook.react.modules.core.DeviceEventManagerModule;
31
31
  import com.google.gson.Gson;
32
32
  import com.google.gson.reflect.TypeToken;
33
+ import com.selligent.rnmobilesdk.BroadcastEventType;
34
+ import com.selligent.rnmobilesdk.ButtonBroadcastEventDataParser;
35
+ import com.selligent.rnmobilesdk.DeviceIdBroadcastEventDataParser;
36
+ import com.selligent.rnmobilesdk.Event;
37
+ import com.selligent.rnmobilesdk.GCMTokenBroadcastEventDataParser;
38
+ import com.selligent.rnmobilesdk.InAppMessageBroadcastEventDataParser;
39
+ import com.selligent.rnmobilesdk.InAppMessageRefreshType;
40
+ import com.selligent.rnmobilesdk.NotificationMessageBroadcastEventDataParser;
41
+ import com.selligent.rnmobilesdk.RemoteMessageDisplayType;
42
+ import com.selligent.rnmobilesdk.SMEventFactory;
43
+ import com.selligent.rnmobilesdk.SMSettingsFactory;
44
+ import com.selligent.rnmobilesdk.Settings;
33
45
  import com.selligent.sdk.SMCallback;
34
46
  import com.selligent.sdk.SMEvent;
35
47
  import com.selligent.sdk.SMForegroundGcmBroadcastReceiver;
@@ -4,17 +4,17 @@
4
4
 
5
5
  Copyright
6
6
 
7
- The contents of this manual cover material copyrighted by Selligent. Selligent reserves all intellectual property rights on the manual, which should be treated as confidential information as defined under the agreed upon software licence/lease terms and conditions.
7
+ The contents of this manual cover material copyrighted by Marigold. Marigold reserves all intellectual property rights on the manual, which should be treated as confidential information as defined under the agreed upon software licence/lease terms and conditions.
8
8
 
9
- The use and distribution of this manual is strictly limited to authorised users of the Selligent Interactive Marketing Software (hereafter the "Software") and can only be used for the purpose of using the Software under the agreed upon software licence/lease terms and conditions. Upon termination of the right to use the Software, this manual and any copies made must either be returned to Selligent or be destroyed, at the latest two weeks after the right to use the Software has ended.
9
+ The use and distribution of this manual is strictly limited to authorised users of the Marigold Interactive Marketing Software (hereafter the "Software") and can only be used for the purpose of using the Software under the agreed upon software licence/lease terms and conditions. Upon termination of the right to use the Software, this manual and any copies made must either be returned to Marigold or be destroyed, at the latest two weeks after the right to use the Software has ended.
10
10
 
11
- With the exception of the first sentence of the previous paragraph, no part of this manual may be reprinted or reproduced or distributed or utilised in any form or by any electronic, mechanical or other means, not known or hereafter invented, included photocopying and recording, or in any information storage or retrieval or distribution system, without the prior permission in writing from Selligent.
11
+ With the exception of the first sentence of the previous paragraph, no part of this manual may be reprinted or reproduced or distributed or utilised in any form or by any electronic, mechanical or other means, not known or hereafter invented, included photocopying and recording, or in any information storage or retrieval or distribution system, without the prior permission in writing from Marigold.
12
12
 
13
- Selligent will not be responsible or liable for any accidental or inevitable damage that may result from unauthorised access or modifications.
13
+ Marigold will not be responsible or liable for any accidental or inevitable damage that may result from unauthorised access or modifications.
14
14
 
15
15
  User is aware that this manual may contain errors or inaccuracies and that it may be revised without advance notice. This manual is updated frequently.
16
16
 
17
- Selligent welcomes any recommendations or suggestions regarding the manual, as it helps to continuously improve the quality of our products and manuals.
17
+ Marigold welcomes any recommendations or suggestions regarding the manual, as it helps to continuously improve the quality of our products and manuals.
18
18
 
19
19
  ## Table of Contents
20
20
 
@@ -28,7 +28,7 @@ Selligent welcomes any recommendations or suggestions regarding the manual, as i
28
28
  - [Background Modes](#background-modes)
29
29
  - [Universal Linking - iOS](#universal-linking---ios)
30
30
  - [Notification helper methods](#notification-helper-methods)
31
- - [Disable Selligent Push Notifications](#disable-selligent-push-notifications)
31
+ - [Disable Marigold Engage Push Notifications](#disable-marigold-engage-push-notifications)
32
32
  - [Display last remote notification](#display-last-remote-notification)
33
33
  - [Display last remote notification content](#display-last-remote-notification-content)
34
34
  - [Retrieve last remote notification](#retrieve-last-remote-notification)
@@ -63,9 +63,9 @@ The following properties can be used in the `selligent.json` to further configur
63
63
 
64
64
  | Property | Type | Description |
65
65
  | ------------------------------------------- | ------ | ------- |
66
- | url | string | The Selligent webservice url to be used to integrate with your Selligent platform |
67
- | clientId | string | The Selligent client id to be used to integrate with your Selligent platform |
68
- | privateKey | string | The Selligent private key to be used to integrate with your Selligent platform |
66
+ | url | string | The Marigold Engage webservice url to be used to integrate with your Marigold Engage platform |
67
+ | clientId | string | The Marigold Engage client id to be used to integrate with your Marigold Engage platform |
68
+ | privateKey | string | The Marigold Engage private key to be used to integrate with your Marigold Engage platform |
69
69
  | delayedPushAction | boolean| (iOS Only) Optin for a specific push action handling (wait for React UI to be ready) when coming from a push message and having the app killed |
70
70
  | interceptSelligentUniversalLinks | boolean| (iOS Only) Optin to customly handle the execution of universal links coming from a Push/IAM [more information](#universal-linking---ios) |
71
71
  | clearCacheIntervalValue | [enum](#clearcacheintervalvalue) | How much time the SDK will keep things in cache |
@@ -204,7 +204,7 @@ Follow the [iOS](https://github.com/SelligentMarketingCloud/MobileSDK-iOS/tree/m
204
204
  3. Somewhere in your ReactNative app (normally done as soon as possible but can also be done when certain page is reached), you will need to call `Selligent.enableNotifications` to prompt the user for the push notification permission or the `Selligent.registerForProvisionalRemoteNotification` (This option is only available for iOS 12+) if you want to get a provisional permission before asking the user for the normal one.
205
205
 
206
206
  ```javascript
207
- import Selligent from "@selligent-marketing-cloud/selligent-react-native"; // Add Selligent import
207
+ import Selligent from "@selligent-marketing-cloud/selligent-react-native"; // Add Marigold Engage import
208
208
 
209
209
  if (Platform.OS === 'ios') {
210
210
  Selligent.enableNotifications(
@@ -272,14 +272,14 @@ This is because the JS layer is loaded **after** the native iOS SDK executes the
272
272
  3. Add a call to `Selligent.executePushAction()` in your main `App.js` file, after adding the ReactNative linking handler (and after calling `Selligent.subscribeToEvents`, if being used)
273
273
 
274
274
  ```javascript
275
- import Selligent from "@selligent-marketing-cloud/selligent-react-native" // Add Selligent import
275
+ import Selligent from "@selligent-marketing-cloud/selligent-react-native" // Add Marigold Engage import
276
276
 
277
277
  const App = () => {
278
278
  // Deeplinking handling library (i.e Linking.getInitialURL() & Linking.addEventListener...)
279
279
  useHandleDeepLink()
280
280
 
281
281
  if (Platform.OS === 'ios') {
282
- /* Tells the Selligent SDK to execute the action associated to the last push clicked, when using `delayedPushAction` feature.
282
+ /* Tells the Marigold Engage SDK to execute the action associated to the last push clicked, when using `delayedPushAction` feature.
283
283
  If you are having problems with deeplinks or 'Push + InApp Message' where the splash screen gets stuck or the push action not visible,
284
284
  make sure you control when the splash screen is dismissed (i.e https://docs.expo.dev/versions/latest/sdk/splash-screen/) and call this method afterwards (if the dismiss is async, call this method once the async process is completely finished)
285
285
  */
@@ -323,7 +323,7 @@ static BOOL launchedFromBackground = false;
323
323
 
324
324
  By default, universal links in a button from a Push/IAM will open the default browser, to avoid this and catch them on the App and apply any logic you want, you will need to add a property `interceptSelligentUniversalLinks` in the `selligent.json` with `true` as value.
325
325
 
326
- You can then subscribe to `SelligentConstants.BroadcastEventType.UNIVERSAL_LINK_EXECUTED` event through the `Selligent.subscribeToEvents` whose execution callback will get triggered when a `deeplink` button type is defined in Selligent Marketing Cloud (whose URL scheme is `http` or `https`).
326
+ You can then subscribe to `SelligentConstants.BroadcastEventType.UNIVERSAL_LINK_EXECUTED` event through the `Selligent.subscribeToEvents` whose execution callback will get triggered when a `deeplink` button type is defined in Marigold Engage (whose URL scheme is `http` or `https`).
327
327
  The response of the success callback is an object which contains information on the type of broadcast event and the data attached to it.
328
328
 
329
329
  | Property | Type | Description |
@@ -353,9 +353,9 @@ Selligent.subscribeToEvents(
353
353
 
354
354
  ### Notification helper methods
355
355
 
356
- #### Disable Selligent Push Notifications
356
+ #### Disable Marigold Engage Push Notifications
357
357
 
358
- You can enable or disable Selligent push notifications (not all push notifications for your app) by calling `Selligent.enableNotifications` anytime you want (do note that for iOS, the first call to this method will prompt the user for the push permission).
358
+ You can enable or disable Marigold Engage push notifications (not all push notifications for your app) by calling `Selligent.enableNotifications` anytime you want (do note that for iOS, the first call to this method will prompt the user for the push permission).
359
359
 
360
360
  ```javascript
361
361
  Selligent.enableNotifications(
@@ -596,9 +596,9 @@ In the other hand, you can also use the native methods `RNSelligent/willPresentN
596
596
 
597
597
  ### IAM Helper methods
598
598
 
599
- If you decide to display the AIM on your own (without `Selligent.displayMessage` and `Selligent.displayNotification`), listening for new messages with the `Selligent.subscribeToEvents` and/or getting the full list with `Selligent.getInAppMessages`. You will be able to build your own layout with the object provided from the mentioned functions and then you can use the helper methods described here to still push KPI statistics to the Selligent platform:
599
+ If you decide to display the AIM on your own (without `Selligent.displayMessage` and `Selligent.displayNotification`), listening for new messages with the `Selligent.subscribeToEvents` and/or getting the full list with `Selligent.getInAppMessages`. You will be able to build your own layout with the object provided from the mentioned functions and then you can use the helper methods described here to still push KPI statistics to the Marigold Engage platform:
600
600
 
601
- - setInAppMessageAsSeen: sets an IAM as seen and sends the corresponding `Opened` event to the Selligent platform
601
+ - setInAppMessageAsSeen: sets an IAM as seen and sends the corresponding `Opened` event to the Marigold Engage platform
602
602
 
603
603
  ```javascript
604
604
  Selligent.setInAppMessageAsSeen(
@@ -634,7 +634,7 @@ If you decide to display the AIM on your own (without `Selligent.displayMessage`
634
634
  )
635
635
  ```
636
636
 
637
- - executeButtonAction: executes the action linked to an IAM button and sends the corresponding `Clicked` event to the Selligent platform
637
+ - executeButtonAction: executes the action linked to an IAM button and sends the corresponding `Clicked` event to the Marigold Engage platform
638
638
 
639
639
  ```javascript
640
640
  Selligent.executeButtonAction(
@@ -655,11 +655,10 @@ The method accepts an `event` object which requires certain properties, dependin
655
655
  | Property | Type | Description |
656
656
  | ----------- | ------------------------------------- | ---------------- |
657
657
  | type | [enum](#eventtype) | The type of event to send |
658
- | email | string | The email/profile identifier to associated the event to |
659
- | data | object | Additional data to be passed together with the event |
658
+ | email | string | The custom profile identifier (`mail` in our v1 platform) of the user as a String. |
659
+ | data | object | Additional data you want to provide to Marigold Engage (you can specify here a key/value pair to use as an alternative lookup for your device identification process) |
660
660
 
661
- For events of type `SelligentConstants.EventType.CUSTOM` the `data` property is mandatory and the `email` one is not used.
662
- For the rest of event types, the `email` property is mandatory.
661
+ For events of type `SelligentConstants.EventType.CUSTOM` the `data` property is mandatory.
663
662
 
664
663
  ```javascript
665
664
  Selligent.sendEvent(
@@ -672,7 +671,7 @@ Selligent.sendEvent(
672
671
  data: { // optional
673
672
  description: "this is some extra information concerning this event"
674
673
  },
675
- email: "someone@somedomain.com" // required
674
+ email: "someone@somedomain.com"
676
675
  }
677
676
  )
678
677
  Selligent.sendEvent(
@@ -693,7 +692,7 @@ Selligent.sendEvent(
693
692
 
694
693
  ### Get lib version
695
694
 
696
- Returns the version of the installed native Selligent SDK (string).
695
+ Returns the version of the installed native Marigold Engage SDK (string).
697
696
 
698
697
  ```javascript
699
698
  Selligent.getVersionLib((versionLib) => {
@@ -702,7 +701,7 @@ Selligent.getVersionLib((versionLib) => {
702
701
 
703
702
  ### Get device id
704
703
 
705
- Returns the currently known Selligent device Id (string).
704
+ Returns the currently known Marigold Engage device Id (string).
706
705
 
707
706
  ```javascript
708
707
  Selligent.getDeviceId((deviceId) => {
@@ -723,7 +722,7 @@ The `data` property is an object itself containing more information specific to
723
722
 
724
723
  | Property | Type | Description |
725
724
  | -------- | ------ | ------------------------------- |
726
- | deviceId | string | The Selligent id of the device |
725
+ | deviceId | string | The Marigold Engage id of the device |
727
726
 
728
727
  ### Logging
729
728
 
@@ -867,11 +866,11 @@ Defines the type of an event.
867
866
 
868
867
  | Name | Type | Value | Description |
869
868
  | --------------- | ------ | ----- | ----------------- |
870
- | USER_REGISTER | number | 90 | Used to send a register event to the server with the custom email/profile identifier of the user, with the purpose of linking the device to an user and optionally storing some data at Selligent platform side. This event will create a new user in your Selligent database, if none was found (you can use an alternate key/value field to search for the user, in the data object, since by default the `email` one will use the `MAIL` column in your Selligent database). |
871
- | USER_UNREGISTER | number | 91 | Used to send an unregister event to the server with the custom email/profile identifier of the user, with the purpose of keeping track of a REGISTERED flag and optionally storing some data at Selligent platform side (this event is not unlinking the user from the device (automatically), at the moment). |
872
- | USER_LOGIN | number | 92 | Used to send a login event to the server with the custom email/profile identifier of the user, with the purpose of linking the device to an user and optionally storing some data at Selligent platform side. This event will **NOT** create a new user in your Selligent database, if none found. |
873
- | USER_LOGOUT | number | 93 | Used to send a logout event to the server with the custom email/profile identifier of the user, with the purpose of keeping track of a LOGGED flag and optionally storing some data at Selligent platform side (this event is not unlinking the user from the device (automatically), at the moment). |
874
- | CUSTOM | number | 94 | Used to send a custom event to the server, with the purpose of keeping track of storing some data at Selligent platform side. |
869
+ | USER_REGISTER | number | 90 | Used to send a register event to the server with the custom email/profile identifier of the user, with the purpose of linking the device to an user and optionally storing some data at Marigold Engage platform side. This event will create a new user in your Marigold Engage database, if none was found (you can use an alternate key/value field to search for the user, in the data object, since by default the `email` one will use the `MAIL` column in your Marigold Engage database). |
870
+ | USER_UNREGISTER | number | 91 | Used to send an unregister event to the server with the custom email/profile identifier of the user, with the purpose of keeping track of a REGISTERED flag and optionally storing some data at Marigold Engage platform side (this event is not unlinking the user from the device (automatically), at the moment). |
871
+ | USER_LOGIN | number | 92 | Used to send a login event to the server with the custom email/profile identifier of the user, with the purpose of linking the device to an user and optionally storing some data at Marigold Engage platform side. This event will **NOT** create a new user in your Marigold Engage database, if none found. |
872
+ | USER_LOGOUT | number | 93 | Used to send a logout event to the server with the custom email/profile identifier of the user, with the purpose of keeping track of a LOGGED flag and optionally storing some data at Marigold Engage platform side (this event is not unlinking the user from the device (automatically), at the moment). |
873
+ | CUSTOM | number | 94 | Used to send a custom event to the server, with the purpose of keeping track of storing some data at Marigold Engage platform side. |
875
874
 
876
875
  ### NotificationButtonType
877
876
 
@@ -889,7 +888,7 @@ Defines the type of buttons for notifications or inapp messages.
889
888
  | CUSTOM_ACTION_BROADCAST_EVENT | number | 107 | Sends a custom broadcast to the App |
890
889
  | PASSBOOK | number | 111 | Opens a passbook URL |
891
890
  | DEEPLINK | number | 112 | Executes a deeplink |
892
- | SIMPLE | number | 113 | Nothing done except forwarding the corresponding `Clicked` event to the Selligent platform |
891
+ | SIMPLE | number | 113 | Nothing done except forwarding the corresponding `Clicked` event to the Marigold Engage platform |
893
892
 
894
893
  ### BroadcastEventType
895
894
 
package/helpers.js CHANGED
@@ -8,7 +8,7 @@ SelligentHelpers.WRONG_ARGUMENTS = "Insufficient/incorrect argument(s) passed to
8
8
  SelligentHelpers.MORE_INFORMATION = "For more information view the documentation of this method.";
9
9
 
10
10
  /**
11
- * Function to check if the Native Selligent is found
11
+ * Function to check if the Native Marigold Engage SDK is found
12
12
  *
13
13
  * @param RNSelligent
14
14
  */
package/index.ios.js CHANGED
@@ -86,7 +86,7 @@ export default {
86
86
  },
87
87
 
88
88
  /**
89
- * Tells the Selligent SDK to execute the action associated to the last push clicked, when using `delayedPushAction` feature
89
+ * Tells the Marigold Engage SDK to execute the action associated to the last push clicked, when using `delayedPushAction` feature
90
90
  */
91
91
  executePushAction: function () {
92
92
  RNSelligent.executePushAction()
package/index.js CHANGED
@@ -5,7 +5,7 @@ import SelligentHelpers from './helpers'
5
5
  const { RNSelligent } = NativeModules
6
6
  export const RNSEventEmitter = new NativeEventEmitter(RNSelligent)
7
7
 
8
- // Check if Native version of Selligent found
8
+ // Check if Native version of Marigold Engage found
9
9
  SelligentHelpers.isNativeSelligentFound(RNSelligent)
10
10
 
11
11
  // to export the android methods without syntax sugar and/or javascript manipulation, use this line:
@@ -23,12 +23,12 @@ if (Platform.OS === 'android') {
23
23
  // or export with syntax sugar and/or javascript manipulation:
24
24
  export default Object.assign(
25
25
  {
26
- // Check if the Selligent Module is loaded
26
+ // Check if the Marigold Engage Module is loaded
27
27
  _selligentLoaded: Boolean(RNSelligent),
28
28
  // Basic SMManager
29
29
 
30
30
  /**
31
- * Returns the version of the underlying Selligent native SDK.
31
+ * Returns the version of the underlying Marigold Engage native SDK.
32
32
  *
33
33
  * @param {function} successCallback Callback function on success.
34
34
  */
@@ -200,26 +200,15 @@ export default Object.assign(
200
200
  return
201
201
  }
202
202
 
203
- // check which type is send
204
- // When type is `CUSTOM`
205
- if (event.type === SelligentConstants.EventType.CUSTOM) {
206
- // check if required options are valid
207
- if (!SelligentHelpers.hasRequiredParameterAndMatchesType(event, 'data', 'object')) {
208
- errorCallback(SelligentHelpers.wrongArgumentError('Expected an object with the key "data".'))
209
- return
210
- }
211
-
212
- // check if required options are valid
213
- if (event.hasOwnProperty('email')) {
214
- console.warn("Email prop is not used with \"custom\" event type and will be ignored.");
215
- }
216
- }
217
- else if (!SelligentHelpers.hasRequiredParameterAndMatchesType(event, 'email', 'string')) {
218
- errorCallback(SelligentHelpers.wrongArgumentError('Expected an object with the key "email".'))
203
+ if (!SelligentHelpers.hasOptionalParameterAndMatchesType(event, 'data', 'object')) {
204
+ errorCallback(SelligentHelpers.createTypeErrorMessage('data', event.data, 'object'))
219
205
  return
220
206
  }
221
-
222
- if (!SelligentHelpers.hasOptionalParameterAndMatchesType(event, 'shouldCache', 'boolean')) {
207
+ else if (!SelligentHelpers.hasOptionalParameterAndMatchesType(event, 'email', 'string')) {
208
+ errorCallback(SelligentHelpers.createTypeErrorMessage('email', event.email, 'string'))
209
+ return
210
+ }
211
+ else if (!SelligentHelpers.hasOptionalParameterAndMatchesType(event, 'shouldCache', 'boolean')) {
223
212
  errorCallback(SelligentHelpers.createTypeErrorMessage('shouldCache', event.shouldCache, 'boolean'))
224
213
  return
225
214
  }
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "author": {
3
- "name": "SelligentMarketingCloud <mobile@selligent.com>"
3
+ "name": "Marigold Engage <mobile@selligent.com>"
4
4
  },
5
5
  "name": "@selligent-marketing-cloud/selligent-react-native",
6
- "title": "Selligent React Native",
7
- "version": "3.4.1",
8
- "description": "React Native wrapper for the Selligent Marketing Cloud Android and iOS SDKs",
6
+ "title": "Marigold Engage React Native",
7
+ "version": "3.5.1",
8
+ "description": "React Native wrapper for the Marigold Engage Android and iOS SDKs",
9
9
  "main": "index.js",
10
10
  "repository": {
11
11
  "type": "git",
@@ -32,10 +32,12 @@
32
32
  "metro-react-native-babel-preset": "^0.76.4",
33
33
  "react": "18.0.0",
34
34
  "react-native": "^0.69.10",
35
- "ts-jest": "^29.1.0"
35
+ "ts-jest": "^29.1.0",
36
+ "jest-junit": "^16.0.0"
36
37
  },
37
38
  "scripts": {
38
- "test": "jest"
39
+ "test": "jest --coverage --reporters=jest-junit",
40
+ "local-test": "jest --coverage"
39
41
  },
40
42
  "files": [
41
43
  "/RNSelligentMapper.podspec",
@@ -43,8 +45,10 @@
43
45
  "/*.ts",
44
46
  "/ios/*.h",
45
47
  "/ios/*.m",
48
+ "/android/libs",
46
49
  "/android/src/main",
47
50
  "/android/build.gradle",
51
+ "/android/settings.gradle",
48
52
  "/documentation/README.md"
49
53
  ]
50
54
  }
@@ -1,47 +0,0 @@
1
- package com.selligent;
2
-
3
- import android.content.Intent;
4
-
5
- import com.facebook.react.bridge.WritableMap;
6
- import com.facebook.react.bridge.WritableNativeMap;
7
- import com.selligent.sdk.SMManager;
8
-
9
- import java.util.HashMap;
10
- import java.util.Map;
11
-
12
- class BroadcastDataFactory {
13
- private BroadcastDataFactory(){}
14
-
15
- private static Map<String, BroadcastEventDataParser> getBroadcastDataParserMap()
16
- {
17
- HashMap<String, BroadcastEventDataParser> parser = new HashMap<>();
18
-
19
- parser.put(SMManager.BROADCAST_EVENT_RECEIVED_IN_APP_MESSAGE, new InAppMessageBroadcastEventDataParser());
20
- parser.put(SMManager.BROADCAST_EVENT_BUTTON_CLICKED, new ButtonBroadcastEventDataParser());
21
- parser.put(SMManager.BROADCAST_EVENT_RECEIVED_GCM_TOKEN, new GCMTokenBroadcastEventDataParser());
22
-
23
- return parser;
24
- }
25
-
26
- public static WritableMap getBroadcastData(String smBroadcastEventType, Intent intent) {
27
- final WritableMap broadcastData = new WritableNativeMap();
28
-
29
- final BroadcastEventType broadcastEventType = BroadcastEventType.fromSMBroadcastEventType(smBroadcastEventType);
30
- String resultingBroadcastEventType = smBroadcastEventType;
31
- if (broadcastEventType != null) {
32
- resultingBroadcastEventType = broadcastEventType.getBroadcastEventType();
33
- }
34
- broadcastData.putString("broadcastEventType", resultingBroadcastEventType);
35
-
36
- final BroadcastEventDataParser broadcastEventDataParser = getBroadcastDataParserMap().get(smBroadcastEventType);
37
-
38
- if (broadcastEventDataParser != null) {
39
- final WritableMap resultingData = broadcastEventDataParser.parse(intent);
40
- broadcastData.putMap("data", resultingData);
41
- } else {
42
- broadcastData.putMap("data", null);
43
- }
44
-
45
- return broadcastData;
46
- }
47
- }
@@ -1,9 +0,0 @@
1
- package com.selligent;
2
-
3
- import android.content.Intent;
4
-
5
- import com.facebook.react.bridge.WritableMap;
6
-
7
- interface BroadcastEventDataParser {
8
- WritableMap parse(Intent intent);
9
- }
@@ -1,37 +0,0 @@
1
- package com.selligent;
2
-
3
- import com.selligent.sdk.SMManager;
4
-
5
- enum BroadcastEventType {
6
- ButtonClicked("ButtonClicked", SMManager.BROADCAST_EVENT_BUTTON_CLICKED),
7
- ReceivedInAppMessage("ReceivedInAppMessage", SMManager.BROADCAST_EVENT_RECEIVED_IN_APP_MESSAGE),
8
- WillDisplayNotification("WillDisplayNotification", SMManager.BROADCAST_EVENT_WILL_DISPLAY_NOTIFICATION),
9
- WillDismissNotification("WillDismissNotification", SMManager.BROADCAST_EVENT_WILL_DISMISS_NOTIFICATION),
10
- ReceivedGCMToken("ReceivedGCMToken", SMManager.BROADCAST_EVENT_RECEIVED_GCM_TOKEN),
11
- ReceivedNotification("ReceivedRemoteNotification", null),
12
- ReceivedDeviceId("ReceivedDeviceId", null),
13
- TriggeredCustomEvent("TriggeredCustomEvent", null);
14
-
15
- private String broadcastEventType;
16
- private String smBroadcastEventType;
17
-
18
- public String getBroadcastEventType() {
19
- return broadcastEventType;
20
- }
21
-
22
- BroadcastEventType(String broadcastEventType, String smBroadcastEventType) {
23
- this.broadcastEventType = broadcastEventType;
24
- this.smBroadcastEventType = smBroadcastEventType;
25
- }
26
-
27
- public static BroadcastEventType fromSMBroadcastEventType(String smEventType) {
28
- BroadcastEventType result = null;
29
- for (BroadcastEventType broadcastEventType: values()) {
30
- if(smEventType.equals(broadcastEventType.smBroadcastEventType)) {
31
- result = broadcastEventType;
32
- }
33
- }
34
-
35
- return result;
36
- }
37
- }