@selligent-marketing-cloud/selligent-react-native 3.5.0 → 3.6.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.
- package/README.md +7 -7
- package/RNSelligentMapper.podspec +1 -1
- package/android/build.gradle +4 -4
- package/android/libs/RNSelligentMobileSDK.aar +0 -0
- package/android/src/main/java/com/selligent/RNSelligent.java +24 -5
- package/constants.d.ts +1 -0
- package/constants.js +3 -1
- package/documentation/README.md +65 -34
- package/helpers.js +1 -1
- package/index.ios.js +1 -1
- package/index.js +11 -21
- package/ios/RNSelligentMapper.m +2 -1
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Marigold Engage-ReactNative (selligent-react-native)
|
|
2
2
|
|
|
3
|
-
This module provides an API for the usage of the
|
|
3
|
+
This module provides an API for the usage of the Marigold Engage Mobile SDKs in React Native.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Marigold Engage-ReactNative Integration
|
|
6
6
|
|
|
7
7
|
This module supports the following SDK and tools:
|
|
8
8
|
|
|
@@ -10,8 +10,8 @@ This module supports the following SDK and tools:
|
|
|
10
10
|
|
|
11
11
|
| SDK | Version |
|
|
12
12
|
| ------------------------------------------------------------------------------ | ------- |
|
|
13
|
-
| [Android SDK](https://github.com/SelligentMarketingCloud/MobileSDK-Android) | 4.4.
|
|
14
|
-
| [iOS SDK](https://github.com/SelligentMarketingCloud/MobileSDK-iOS) | 3.8.
|
|
13
|
+
| [Android SDK](https://github.com/SelligentMarketingCloud/MobileSDK-Android) | 4.4.1 |
|
|
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
|
|
|
@@ -174,7 +174,7 @@ This module supports the following SDK and tools:
|
|
|
174
174
|
|
|
175
175
|
> Do not check the "copy if needed" option to make sure you only have to manage one selligent.json file
|
|
176
176
|
|
|
177
|
-
3. Add the native iOS SDK dependency in your Podfile: `s.dependency "SelligentMobileSDK/Framework", "3.8.
|
|
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
178
|
|
|
179
179
|
4. Add the RNSelligentMapper pod in your Podfile: `pod 'RNSelligentMapper', :path => '../node_modules/@selligent-marketing-cloud/selligent-react-native/RNSelligentMapper.podspec'`.
|
|
180
180
|
|
|
@@ -187,7 +187,7 @@ This module supports the following SDK and tools:
|
|
|
187
187
|
```objective-c
|
|
188
188
|
@import RNSelligentMobileSDK;
|
|
189
189
|
|
|
190
|
-
// You can alternatively specify a different file name (without the extension) from where to load the
|
|
190
|
+
// You can alternatively specify a different file name (without the extension) from where to load the Marigold Engage configs (defaults to 'selligent')
|
|
191
191
|
// if (!launchOptions) {
|
|
192
192
|
// launchOptions = [NSMutableDictionary new];
|
|
193
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
|
|
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"
|
package/android/build.gradle
CHANGED
|
@@ -63,7 +63,7 @@ dependencies {
|
|
|
63
63
|
exclude group:'com.facebook.fbjni'
|
|
64
64
|
exclude group:'com.facebook.yoga'
|
|
65
65
|
}
|
|
66
|
-
implementation 'com.selligent.sdk:selligent_mobile_sdk:4.4.
|
|
66
|
+
implementation 'com.selligent.sdk:selligent_mobile_sdk:4.4.1'
|
|
67
67
|
implementation 'com.google.code.gson:gson:2.9.0'
|
|
68
68
|
implementation 'com.google.firebase:firebase-messaging:23.2.1'
|
|
69
69
|
implementation 'androidx.work:work-runtime:2.8.1'
|
|
@@ -85,7 +85,7 @@ def loadSelligentSettings(variant) {
|
|
|
85
85
|
File flavorFile = new File("$project.rootDir/../$currentFlavor/$defaultFileName")
|
|
86
86
|
|
|
87
87
|
if (variantFile.exists()) {
|
|
88
|
-
println("Reading
|
|
88
|
+
println("Reading Marigold Engage properties for variant ${variant.getName()} from $variantFile.path")
|
|
89
89
|
resultingSettings = ""
|
|
90
90
|
|
|
91
91
|
variantFile.eachLine { String line ->
|
|
@@ -93,7 +93,7 @@ def loadSelligentSettings(variant) {
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
else if (currentFlavor != "" && flavorFile.exists()) {
|
|
96
|
-
println("Reading
|
|
96
|
+
println("Reading Marigold Engage properties for flavor $currentFlavor using $flavorFile.path")
|
|
97
97
|
resultingSettings = ""
|
|
98
98
|
|
|
99
99
|
flavorFile.eachLine { String line ->
|
|
@@ -101,7 +101,7 @@ def loadSelligentSettings(variant) {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
else if (defaultFile.exists()) {
|
|
104
|
-
println("Reading default
|
|
104
|
+
println("Reading default Marigold Engage properties from ${defaultFile.path} (no variant specific nor flavor $defaultFileName were found)")
|
|
105
105
|
resultingSettings = ""
|
|
106
106
|
|
|
107
107
|
defaultFile.eachLine { String line ->
|
|
Binary file
|
|
@@ -31,6 +31,7 @@ import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
|
31
31
|
import com.google.gson.Gson;
|
|
32
32
|
import com.google.gson.reflect.TypeToken;
|
|
33
33
|
import com.selligent.rnmobilesdk.BroadcastEventType;
|
|
34
|
+
import com.selligent.rnmobilesdk.ButtonAction;
|
|
34
35
|
import com.selligent.rnmobilesdk.ButtonBroadcastEventDataParser;
|
|
35
36
|
import com.selligent.rnmobilesdk.DeviceIdBroadcastEventDataParser;
|
|
36
37
|
import com.selligent.rnmobilesdk.Event;
|
|
@@ -64,6 +65,7 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
|
|
|
64
65
|
EventReceiver eventReceiver;
|
|
65
66
|
SMForegroundGcmBroadcastReceiver receiver;
|
|
66
67
|
private static SMInAppRefreshType inAppMessageRefreshType;
|
|
68
|
+
private static boolean inAppMessageCustomUi;
|
|
67
69
|
|
|
68
70
|
public static final String REACT_CLASS = "SelligentReactNative"; // for logging purposes
|
|
69
71
|
|
|
@@ -108,9 +110,10 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
|
|
|
108
110
|
final Settings settings = Settings.fromHashMap(settingsHashMap);
|
|
109
111
|
final SMSettings smSettings = SMSettingsFactory.getSMSettings(settings);
|
|
110
112
|
final String notificationActivityName = settings.getActivityName();
|
|
111
|
-
|
|
113
|
+
|
|
112
114
|
SMManager.NOTIFICATION_ACTIVITY = getActivityClass(notificationActivityName);
|
|
113
115
|
inAppMessageRefreshType = settings.getInAppMessageRefreshType().getSmInAppRefreshType();
|
|
116
|
+
inAppMessageCustomUi = settings.getCustomInAppUi();
|
|
114
117
|
|
|
115
118
|
final SMManager smManager = getSMManager();
|
|
116
119
|
SMManager.DEBUG = BuildConfig.BUILD_TYPE.equals("debug") || settings.getEnableAndroidLogging();
|
|
@@ -225,7 +228,7 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
|
|
|
225
228
|
buttonMap.putString("id", button.id);
|
|
226
229
|
buttonMap.putString("value", button.value);
|
|
227
230
|
buttonMap.putString("label", button.label);
|
|
228
|
-
buttonMap.putInt("type", button.
|
|
231
|
+
buttonMap.putInt("type", ButtonAction.valueOf(button.action).getValue());
|
|
229
232
|
|
|
230
233
|
buttonsArray.pushMap(buttonMap);
|
|
231
234
|
}
|
|
@@ -605,9 +608,9 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
|
|
|
605
608
|
{
|
|
606
609
|
receiver = new SMForegroundGcmBroadcastReceiver(currentActivity);
|
|
607
610
|
}
|
|
608
|
-
currentActivity.registerReceiver(receiver, receiver.getIntentFilter());
|
|
609
611
|
|
|
610
|
-
|
|
612
|
+
currentActivity.registerReceiver(receiver, receiver.getIntentFilter());
|
|
613
|
+
this.DisplayInAppMessage(currentActivity.getIntent(), currentActivity);
|
|
611
614
|
}
|
|
612
615
|
}
|
|
613
616
|
|
|
@@ -629,10 +632,26 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
|
|
|
629
632
|
|
|
630
633
|
if (currentActivity != null) {
|
|
631
634
|
currentActivity.setIntent(intent);
|
|
632
|
-
|
|
635
|
+
this.DisplayInAppMessage(intent, currentActivity);
|
|
633
636
|
}
|
|
634
637
|
}
|
|
635
638
|
|
|
636
639
|
@Override
|
|
637
640
|
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) { }
|
|
641
|
+
|
|
642
|
+
private void DisplayInAppMessage(Intent intent, Activity currentActivity) {
|
|
643
|
+
smManager.checkAndDisplayMessage(intent, currentActivity, message -> {
|
|
644
|
+
if (!inAppMessageCustomUi) {
|
|
645
|
+
return true;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
DeviceEventManagerModule.RCTDeviceEventEmitter rctDeviceEventEmitter = reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class);
|
|
649
|
+
InAppMessageBroadcastEventDataParser inAppDataParser = new InAppMessageBroadcastEventDataParser();
|
|
650
|
+
String eventName = BroadcastEventType.DisplayingInAppMessage.getBroadcastEventType();
|
|
651
|
+
WritableMap data = inAppDataParser.wrap(message);
|
|
652
|
+
rctDeviceEventEmitter.emit(eventName, getBroadcastData(eventName, data));
|
|
653
|
+
|
|
654
|
+
return false;
|
|
655
|
+
});
|
|
656
|
+
}
|
|
638
657
|
}
|
package/constants.d.ts
CHANGED
|
@@ -74,4 +74,5 @@ export namespace BroadcastEventType {
|
|
|
74
74
|
const RECEIVED_REMOTE_NOTIFICATION = "ReceivedRemoteNotification";
|
|
75
75
|
const UNIVERSAL_LINK_EXECUTED = "UniversalLinkExecuted";
|
|
76
76
|
const TRIGGERED_CUSTOM_EVENT = "TriggeredCustomEvent";
|
|
77
|
+
const DISPLAYING_IN_APP_MESSAGE = "DisplayingInAppMessage";
|
|
77
78
|
}
|
package/constants.js
CHANGED
|
@@ -174,7 +174,9 @@ const SelligentConstants = {
|
|
|
174
174
|
/** Received an universal link execution */
|
|
175
175
|
UNIVERSAL_LINK_EXECUTED: "UniversalLinkExecuted",
|
|
176
176
|
/** A custom event has been triggered */
|
|
177
|
-
TRIGGERED_CUSTOM_EVENT: "TriggeredCustomEvent"
|
|
177
|
+
TRIGGERED_CUSTOM_EVENT: "TriggeredCustomEvent",
|
|
178
|
+
/** An IAM is about to be displayed (when `customInAppUi` is set to `true` in `selligent.json`) */
|
|
179
|
+
DISPLAYING_IN_APP_MESSAGE: "DisplayingInAppMessage"
|
|
178
180
|
},
|
|
179
181
|
|
|
180
182
|
};
|
package/documentation/README.md
CHANGED
|
@@ -4,17 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
Copyright
|
|
6
6
|
|
|
7
|
-
The contents of this manual cover material copyrighted by
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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,10 @@ 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
|
|
67
|
-
| clientId | string | The
|
|
68
|
-
| privateKey | string | The
|
|
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
|
+
| customInAppUi | boolean| When this is enabled and a "push + inapp" notification is clicked, the SDK will NOT display the inApp message and instead a `SelligentConstants.BroadcastEventType.DISPLAYING_IN_APP_MESSAGE` event will be sent |
|
|
69
70
|
| 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
71
|
| interceptSelligentUniversalLinks | boolean| (iOS Only) Optin to customly handle the execution of universal links coming from a Push/IAM [more information](#universal-linking---ios) |
|
|
71
72
|
| clearCacheIntervalValue | [enum](#clearcacheintervalvalue) | How much time the SDK will keep things in cache |
|
|
@@ -204,7 +205,7 @@ Follow the [iOS](https://github.com/SelligentMarketingCloud/MobileSDK-iOS/tree/m
|
|
|
204
205
|
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
206
|
|
|
206
207
|
```javascript
|
|
207
|
-
import Selligent from "@selligent-marketing-cloud/selligent-react-native"; // Add
|
|
208
|
+
import Selligent from "@selligent-marketing-cloud/selligent-react-native"; // Add Marigold Engage import
|
|
208
209
|
|
|
209
210
|
if (Platform.OS === 'ios') {
|
|
210
211
|
Selligent.enableNotifications(
|
|
@@ -272,14 +273,14 @@ This is because the JS layer is loaded **after** the native iOS SDK executes the
|
|
|
272
273
|
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
274
|
|
|
274
275
|
```javascript
|
|
275
|
-
import Selligent from "@selligent-marketing-cloud/selligent-react-native" // Add
|
|
276
|
+
import Selligent from "@selligent-marketing-cloud/selligent-react-native" // Add Marigold Engage import
|
|
276
277
|
|
|
277
278
|
const App = () => {
|
|
278
279
|
// Deeplinking handling library (i.e Linking.getInitialURL() & Linking.addEventListener...)
|
|
279
280
|
useHandleDeepLink()
|
|
280
281
|
|
|
281
282
|
if (Platform.OS === 'ios') {
|
|
282
|
-
/* Tells the
|
|
283
|
+
/* Tells the Marigold Engage SDK to execute the action associated to the last push clicked, when using `delayedPushAction` feature.
|
|
283
284
|
If you are having problems with deeplinks or 'Push + InApp Message' where the splash screen gets stuck or the push action not visible,
|
|
284
285
|
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
286
|
*/
|
|
@@ -323,7 +324,7 @@ static BOOL launchedFromBackground = false;
|
|
|
323
324
|
|
|
324
325
|
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
326
|
|
|
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
|
|
327
|
+
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
328
|
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
329
|
|
|
329
330
|
| Property | Type | Description |
|
|
@@ -353,9 +354,9 @@ Selligent.subscribeToEvents(
|
|
|
353
354
|
|
|
354
355
|
### Notification helper methods
|
|
355
356
|
|
|
356
|
-
#### Disable
|
|
357
|
+
#### Disable Marigold Engage Push Notifications
|
|
357
358
|
|
|
358
|
-
You can enable or disable
|
|
359
|
+
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
360
|
|
|
360
361
|
```javascript
|
|
361
362
|
Selligent.enableNotifications(
|
|
@@ -482,7 +483,7 @@ The `data` property is an object itself containing more information specific to
|
|
|
482
483
|
|
|
483
484
|
| Property | Type | Description |
|
|
484
485
|
| -------- | ------ | ------------------ |
|
|
485
|
-
| id | string | Internal id of the message
|
|
486
|
+
| id | string | Internal id of the message |
|
|
486
487
|
| title | string | Title of the message |
|
|
487
488
|
|
|
488
489
|
```javascript
|
|
@@ -512,7 +513,7 @@ The response of the success callback is an array of objects which contain the in
|
|
|
512
513
|
| -------------- | ------------------------------------------------------------------------------- | ---------------------------------------------------------- |
|
|
513
514
|
| id | string | Internal id of the IAM |
|
|
514
515
|
| title | string | Title of the IAM |
|
|
515
|
-
| body | string | Body of the IAM |
|
|
516
|
+
| body | string | Body of the IAM. For message of type `ALERT` it will be the text corresponding to the body of the Alert, for type `HTML` it will be the html code, for type `URL`, `IMAGE` and `PASSBOOK` it will be an URL. |
|
|
516
517
|
| type | [enum](#inappmessagetype) | Type of the IAM |
|
|
517
518
|
| creationDate | number | Creation date of the IAM in unix time |
|
|
518
519
|
| expirationDate | number | Expiration date of the IAM in unix time |
|
|
@@ -529,6 +530,36 @@ The `buttons` property is an array of button-objects which contain the informati
|
|
|
529
530
|
| value | string | Value of the button of the in app message | Both |
|
|
530
531
|
| type | number | Type of the button of the in app message | Both |
|
|
531
532
|
|
|
533
|
+
- When the IAM is linked to a push notification, you can set `customInAppUi` to `true` in `selligent.json` and subscribe to `SelligentConstants.BroadcastEventType.DISPLAYING_IN_APP_MESSAGE` events through the `Selligent.subscribeToEvents`, to know when messages are about to be displayed.
|
|
534
|
+
You will also need to set `addInAppMessageFromPushToInAppMessageList` to `true` in `selligent.json` to be able to retrieve the full object calling `Selligent.getInAppMessages` and do not forget to use the [IAM Helper methods](#iam-helper-methods) to properly track Open and Click interactions.
|
|
535
|
+
For Android, to avoid the SDK directly displaying the IAM if the App is in foreground, do also set `remoteMessageDisplayType` to `22` (NOTIFICATION) in `selligent.json`.
|
|
536
|
+
The response of the success callback is an object which contains information on the type of broadcast event and the data attached to it.
|
|
537
|
+
|
|
538
|
+
| Property | Type | Description |
|
|
539
|
+
| ------------------ | ------------------------------------------------------- | ----------------------------------------------------------------- |
|
|
540
|
+
| broadcastEventType | [enum](#broadcasteventtype) | The type of broadcast event |
|
|
541
|
+
| data | object | Contains more information specific to the type of broadcast event |
|
|
542
|
+
|
|
543
|
+
The `data` property is an object itself containing more information specific to the type of the broadcast event:
|
|
544
|
+
|
|
545
|
+
- DISPLAYING_IN_APP_MESSAGE
|
|
546
|
+
|
|
547
|
+
| Property | Type | Description |
|
|
548
|
+
| -------- | ------ | ------------------ |
|
|
549
|
+
| id | string | Internal id of the message |
|
|
550
|
+
| title | string | Title of the message |
|
|
551
|
+
|
|
552
|
+
```javascript
|
|
553
|
+
Selligent.subscribeToEvents(
|
|
554
|
+
() => {},
|
|
555
|
+
() => {},
|
|
556
|
+
(response) => {
|
|
557
|
+
if (response?.broadcastEventType === SelligentConstants.BroadcastEventType.DISPLAYING_IN_APP_MESSAGE) {
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
)
|
|
561
|
+
```
|
|
562
|
+
|
|
532
563
|
To display any of these messages, you can call `Selligent.displayMessage`:
|
|
533
564
|
|
|
534
565
|
### Selligent.displayMessage
|
|
@@ -596,9 +627,9 @@ In the other hand, you can also use the native methods `RNSelligent/willPresentN
|
|
|
596
627
|
|
|
597
628
|
### IAM Helper methods
|
|
598
629
|
|
|
599
|
-
If you decide to display the
|
|
630
|
+
If you decide to display the IAM 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
631
|
|
|
601
|
-
- setInAppMessageAsSeen: sets an IAM as seen and sends the corresponding `Opened` event to the
|
|
632
|
+
- setInAppMessageAsSeen: sets an IAM as seen and sends the corresponding `Opened` event to the Marigold Engage platform
|
|
602
633
|
|
|
603
634
|
```javascript
|
|
604
635
|
Selligent.setInAppMessageAsSeen(
|
|
@@ -634,7 +665,7 @@ If you decide to display the AIM on your own (without `Selligent.displayMessage`
|
|
|
634
665
|
)
|
|
635
666
|
```
|
|
636
667
|
|
|
637
|
-
- executeButtonAction: executes the action linked to an IAM button and sends the corresponding `Clicked` event to the
|
|
668
|
+
- executeButtonAction: executes the action linked to an IAM button and sends the corresponding `Clicked` event to the Marigold Engage platform
|
|
638
669
|
|
|
639
670
|
```javascript
|
|
640
671
|
Selligent.executeButtonAction(
|
|
@@ -655,11 +686,10 @@ The method accepts an `event` object which requires certain properties, dependin
|
|
|
655
686
|
| Property | Type | Description |
|
|
656
687
|
| ----------- | ------------------------------------- | ---------------- |
|
|
657
688
|
| type | [enum](#eventtype) | The type of event to send |
|
|
658
|
-
| email | string | The
|
|
659
|
-
| data | object | Additional data to
|
|
689
|
+
| email | string | The custom profile identifier (`mail` in our v1 platform) of the user as a String. |
|
|
690
|
+
| 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
691
|
|
|
661
|
-
For events of type `SelligentConstants.EventType.CUSTOM` the `data` property is mandatory
|
|
662
|
-
For the rest of event types, the `email` property is mandatory.
|
|
692
|
+
For events of type `SelligentConstants.EventType.CUSTOM` the `data` property is mandatory.
|
|
663
693
|
|
|
664
694
|
```javascript
|
|
665
695
|
Selligent.sendEvent(
|
|
@@ -672,7 +702,7 @@ Selligent.sendEvent(
|
|
|
672
702
|
data: { // optional
|
|
673
703
|
description: "this is some extra information concerning this event"
|
|
674
704
|
},
|
|
675
|
-
email: "someone@somedomain.com"
|
|
705
|
+
email: "someone@somedomain.com"
|
|
676
706
|
}
|
|
677
707
|
)
|
|
678
708
|
Selligent.sendEvent(
|
|
@@ -693,7 +723,7 @@ Selligent.sendEvent(
|
|
|
693
723
|
|
|
694
724
|
### Get lib version
|
|
695
725
|
|
|
696
|
-
Returns the version of the installed native
|
|
726
|
+
Returns the version of the installed native Marigold Engage SDK (string).
|
|
697
727
|
|
|
698
728
|
```javascript
|
|
699
729
|
Selligent.getVersionLib((versionLib) => {
|
|
@@ -702,7 +732,7 @@ Selligent.getVersionLib((versionLib) => {
|
|
|
702
732
|
|
|
703
733
|
### Get device id
|
|
704
734
|
|
|
705
|
-
Returns the currently known
|
|
735
|
+
Returns the currently known Marigold Engage device Id (string).
|
|
706
736
|
|
|
707
737
|
```javascript
|
|
708
738
|
Selligent.getDeviceId((deviceId) => {
|
|
@@ -723,7 +753,7 @@ The `data` property is an object itself containing more information specific to
|
|
|
723
753
|
|
|
724
754
|
| Property | Type | Description |
|
|
725
755
|
| -------- | ------ | ------------------------------- |
|
|
726
|
-
| deviceId | string | The
|
|
756
|
+
| deviceId | string | The Marigold Engage id of the device |
|
|
727
757
|
|
|
728
758
|
### Logging
|
|
729
759
|
|
|
@@ -867,11 +897,11 @@ Defines the type of an event.
|
|
|
867
897
|
|
|
868
898
|
| Name | Type | Value | Description |
|
|
869
899
|
| --------------- | ------ | ----- | ----------------- |
|
|
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
|
|
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
|
|
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
|
|
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
|
|
874
|
-
| CUSTOM | number | 94 | Used to send a custom event to the server, with the purpose of keeping track of storing some data at
|
|
900
|
+
| 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). |
|
|
901
|
+
| 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). |
|
|
902
|
+
| 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. |
|
|
903
|
+
| 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). |
|
|
904
|
+
| 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
905
|
|
|
876
906
|
### NotificationButtonType
|
|
877
907
|
|
|
@@ -889,7 +919,7 @@ Defines the type of buttons for notifications or inapp messages.
|
|
|
889
919
|
| CUSTOM_ACTION_BROADCAST_EVENT | number | 107 | Sends a custom broadcast to the App |
|
|
890
920
|
| PASSBOOK | number | 111 | Opens a passbook URL |
|
|
891
921
|
| DEEPLINK | number | 112 | Executes a deeplink |
|
|
892
|
-
| SIMPLE | number | 113 | Nothing done except forwarding the corresponding `Clicked` event to the
|
|
922
|
+
| SIMPLE | number | 113 | Nothing done except forwarding the corresponding `Clicked` event to the Marigold Engage platform |
|
|
893
923
|
|
|
894
924
|
### BroadcastEventType
|
|
895
925
|
|
|
@@ -906,3 +936,4 @@ Defines the type of a broadcast event.
|
|
|
906
936
|
| RECEIVED_REMOTE_NOTIFICATION | string | ReceivedRemoteNotification | A remote notification has been received |
|
|
907
937
|
| iOS.UNIVERSAL_LINK_EXECUTED | string | UniversalLinkExecuted | An universal link has been executed |
|
|
908
938
|
| TRIGGERED_CUSTOM_EVENT | string | TriggeredCustomEvent | A custom event has been triggered |
|
|
939
|
+
| DISPLAYING_IN_APP_MESSAGE | string | DisplayingInAppMessage | An IAM is about to be displayed (when `customInAppUi` is set to `true` in `selligent.json`) |
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
204
|
-
|
|
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
|
-
|
|
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
|
}
|
|
@@ -317,6 +306,7 @@ export default Object.assign(
|
|
|
317
306
|
RNSEventEmitter.addListener(SelligentConstants.BroadcastEventType.RECEIVED_DEVICE_ID, eventCallback);
|
|
318
307
|
RNSEventEmitter.addListener(SelligentConstants.BroadcastEventType.RECEIVED_REMOTE_NOTIFICATION, eventCallback);
|
|
319
308
|
RNSEventEmitter.addListener(SelligentConstants.BroadcastEventType.TRIGGERED_CUSTOM_EVENT, eventCallback);
|
|
309
|
+
RNSEventEmitter.addListener(SelligentConstants.BroadcastEventType.DISPLAYING_IN_APP_MESSAGE, eventCallback);
|
|
320
310
|
|
|
321
311
|
if (Platform.OS === "ios") {
|
|
322
312
|
RNSEventEmitter.addListener(SelligentConstants.BroadcastEventType.UNIVERSAL_LINK_EXECUTED, eventCallback);
|
package/ios/RNSelligentMapper.m
CHANGED
|
@@ -148,7 +148,8 @@ RCT_EXPORT_METHOD(subscribeToEvents:(NSArray<NSString *> *)events) {
|
|
|
148
148
|
@"ReceivedRemoteNotification",
|
|
149
149
|
@"ReceivedDeviceId",
|
|
150
150
|
@"UniversalLinkExecuted",
|
|
151
|
-
@"TriggeredCustomEvent"
|
|
151
|
+
@"TriggeredCustomEvent",
|
|
152
|
+
@"DisplayingInAppMessage"
|
|
152
153
|
];
|
|
153
154
|
}
|
|
154
155
|
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": {
|
|
3
|
-
"name": "
|
|
3
|
+
"name": "Marigold Engage <mobile@selligent.com>"
|
|
4
4
|
},
|
|
5
5
|
"name": "@selligent-marketing-cloud/selligent-react-native",
|
|
6
|
-
"title": "
|
|
7
|
-
"version": "3.
|
|
8
|
-
"description": "React Native wrapper for the
|
|
6
|
+
"title": "Marigold Engage React Native",
|
|
7
|
+
"version": "3.6.0",
|
|
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",
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
"jest-junit": "^16.0.0"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
|
-
"test": "jest --coverage --reporters=jest-junit"
|
|
39
|
+
"test": "jest --coverage --reporters=jest-junit",
|
|
40
|
+
"local-test": "jest --coverage"
|
|
40
41
|
},
|
|
41
42
|
"files": [
|
|
42
43
|
"/RNSelligentMapper.podspec",
|