@selligent-marketing-cloud/selligent-react-native 4.3.0 → 4.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/RNSelligentMapper.podspec +1 -1
- package/android/build.gradle +6 -6
- package/android/src/main/java/com/selligent/RNSelligent.java +36 -31
- package/documentation/README.md +28 -28
- package/helpers.js +1 -1
- package/index.js +4 -4
- package/ios/RNSelligentMapper.m +2 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Selligent by Zeta-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 Selligent Mobile SDKs in React Native.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Selligent by Zeta-ReactNative Integration
|
|
6
6
|
|
|
7
7
|
This module supports the following SDK and tools:
|
|
8
8
|
|
|
@@ -189,7 +189,7 @@ This module supports the following SDK and tools:
|
|
|
189
189
|
// OR
|
|
190
190
|
// #import <RNSelligentMobileSDK/RNSelligentMobileSDK-Swift.h>
|
|
191
191
|
|
|
192
|
-
// You can alternatively specify a different file name (without the extension) from where to load the
|
|
192
|
+
// You can alternatively specify a different file name (without the extension) from where to load the Selligent configs (defaults to 'selligent')
|
|
193
193
|
// if (!launchOptions) {
|
|
194
194
|
// launchOptions = [NSMutableDictionary new];
|
|
195
195
|
// }
|
|
@@ -218,7 +218,7 @@ This module supports the following SDK and tools:
|
|
|
218
218
|
// OR
|
|
219
219
|
// #import <RNSelligentMobileSDK/RNSelligentMobileSDK-Swift.h>
|
|
220
220
|
|
|
221
|
-
// You can alternatively specify a different file name (without the extension) from where to load the
|
|
221
|
+
// You can alternatively specify a different file name (without the extension) from where to load the Selligent configs (defaults to 'selligent')
|
|
222
222
|
// if (!launchOptions) {
|
|
223
223
|
// launchOptions = [NSMutableDictionary new];
|
|
224
224
|
// }
|
|
@@ -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 Selligent by Zeta Android and iOS SDKs"
|
|
11
11
|
s.homepage = package['homepage']
|
|
12
12
|
s.license = "MIT"
|
|
13
13
|
s.platform = :ios, "13.4"
|
package/android/build.gradle
CHANGED
|
@@ -16,11 +16,11 @@ apply plugin: 'com.android.library'
|
|
|
16
16
|
|
|
17
17
|
android {
|
|
18
18
|
namespace 'com.selligent'
|
|
19
|
-
compileSdk
|
|
19
|
+
compileSdk 36
|
|
20
20
|
|
|
21
21
|
defaultConfig {
|
|
22
22
|
minSdkVersion 23
|
|
23
|
-
targetSdkVersion
|
|
23
|
+
targetSdkVersion 36
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
buildFeatures {
|
|
@@ -64,7 +64,7 @@ dependencies {
|
|
|
64
64
|
implementation 'androidx.cardview:cardview:1.0.0'
|
|
65
65
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1'
|
|
66
66
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'
|
|
67
|
-
implementation 'com.selligent.sdk:selligent_mobile_reactnative_sdk:3.9.
|
|
67
|
+
implementation 'com.selligent.sdk:selligent_mobile_reactnative_sdk:3.9.1'
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
def loadSelligentSettings(variant) {
|
|
@@ -78,7 +78,7 @@ def loadSelligentSettings(variant) {
|
|
|
78
78
|
File flavorFile = getFile("$currentFlavor/$defaultFileName")
|
|
79
79
|
|
|
80
80
|
if (variantFile.exists()) {
|
|
81
|
-
println("Reading
|
|
81
|
+
println("Reading Selligent by Zeta properties for variant ${variant.getName()} from $variantFile.path")
|
|
82
82
|
resultingSettings = ""
|
|
83
83
|
|
|
84
84
|
variantFile.eachLine { String line ->
|
|
@@ -86,7 +86,7 @@ def loadSelligentSettings(variant) {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
else if (currentFlavor != "" && flavorFile.exists()) {
|
|
89
|
-
println("Reading
|
|
89
|
+
println("Reading Selligent by Zeta properties for flavor $currentFlavor using $flavorFile.path")
|
|
90
90
|
resultingSettings = ""
|
|
91
91
|
|
|
92
92
|
flavorFile.eachLine { String line ->
|
|
@@ -94,7 +94,7 @@ def loadSelligentSettings(variant) {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
else if (defaultFile.exists()) {
|
|
97
|
-
println("Reading default
|
|
97
|
+
println("Reading default Selligent by Zeta properties from ${defaultFile.path} (no variant specific nor flavor $defaultFileName were found)")
|
|
98
98
|
resultingSettings = ""
|
|
99
99
|
|
|
100
100
|
defaultFile.eachLine { String line ->
|
|
@@ -5,6 +5,7 @@ import android.app.Activity;
|
|
|
5
5
|
import android.app.Application;
|
|
6
6
|
import android.content.Context;
|
|
7
7
|
import android.content.Intent;
|
|
8
|
+
import android.util.Log;
|
|
8
9
|
|
|
9
10
|
import androidx.annotation.NonNull;
|
|
10
11
|
import androidx.appcompat.app.AppCompatActivity;
|
|
@@ -29,7 +30,6 @@ import java.util.Map;
|
|
|
29
30
|
|
|
30
31
|
public class RNSelligent extends ReactContextBaseJavaModule implements LifecycleEventListener, ActivityEventListener {
|
|
31
32
|
private final ReactApplicationContext reactContext;
|
|
32
|
-
private final Manager manager;
|
|
33
33
|
EventReceiver eventReceiver;
|
|
34
34
|
SMForegroundGcmBroadcastReceiver receiver;
|
|
35
35
|
|
|
@@ -52,7 +52,6 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
|
|
|
52
52
|
this.reactContext = reactContext;
|
|
53
53
|
reactContext.addLifecycleEventListener(this);
|
|
54
54
|
reactContext.addActivityEventListener(this);
|
|
55
|
-
this.manager = RNSelligent.getManager();
|
|
56
55
|
}
|
|
57
56
|
|
|
58
57
|
@NonNull
|
|
@@ -67,7 +66,7 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
|
|
|
67
66
|
|
|
68
67
|
@ReactMethod
|
|
69
68
|
public void getVersionLib(Callback successCallback) {
|
|
70
|
-
successCallback.invoke(
|
|
69
|
+
successCallback.invoke(RNSelligent.getManager().getVersionLib());
|
|
71
70
|
}
|
|
72
71
|
|
|
73
72
|
@ReactMethod
|
|
@@ -76,54 +75,54 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
|
|
|
76
75
|
ReadableType enabledType = enabled.getType(enabledProperty);
|
|
77
76
|
|
|
78
77
|
if (enabledType == ReadableType.Boolean) {
|
|
79
|
-
|
|
78
|
+
RNSelligent.getManager().enableInAppMessages(enabled.getBoolean(enabledProperty));
|
|
80
79
|
}
|
|
81
80
|
else if (enabledType == ReadableType.Number) {
|
|
82
|
-
|
|
81
|
+
RNSelligent.getManager().enableInAppMessages(enabled.getInt(enabledProperty));
|
|
83
82
|
}
|
|
84
83
|
}
|
|
85
84
|
|
|
86
85
|
@ReactMethod
|
|
87
86
|
public void areInAppMessagesEnabled(Callback successCallback) {
|
|
88
|
-
successCallback.invoke(
|
|
87
|
+
successCallback.invoke(RNSelligent.getManager().areInAppMessagesEnabled());
|
|
89
88
|
}
|
|
90
89
|
|
|
91
90
|
@ReactMethod
|
|
92
91
|
public void displayMessage(String messageId) {
|
|
93
|
-
|
|
92
|
+
RNSelligent.getManager().displayMessage(messageId, this.getCurrentActivity());
|
|
94
93
|
}
|
|
95
94
|
|
|
96
95
|
@ReactMethod
|
|
97
96
|
public void getInAppMessages(Callback successCallback) {
|
|
98
|
-
|
|
97
|
+
RNSelligent.getManager().getInAppMessages(list ->
|
|
99
98
|
successCallback.invoke(RNHelpers.convertListToWritableArray(list))
|
|
100
99
|
);
|
|
101
100
|
}
|
|
102
101
|
|
|
103
102
|
@ReactMethod
|
|
104
103
|
public void setInAppMessageAsSeen(String messageId, Callback successCallback, Callback errorCallback) {
|
|
105
|
-
|
|
104
|
+
RNSelligent.getManager().setInAppMessageAsSeen(messageId, error ->
|
|
106
105
|
processErrorStringToCallback(error, successCallback, errorCallback)
|
|
107
106
|
);
|
|
108
107
|
}
|
|
109
108
|
|
|
110
109
|
@ReactMethod
|
|
111
110
|
public void setInAppMessageAsUnseen(String messageId, Callback successCallback, Callback errorCallback) {
|
|
112
|
-
|
|
111
|
+
RNSelligent.getManager().setInAppMessageAsUnseen(messageId, error ->
|
|
113
112
|
processErrorStringToCallback(error, successCallback, errorCallback)
|
|
114
113
|
);
|
|
115
114
|
}
|
|
116
115
|
|
|
117
116
|
@ReactMethod
|
|
118
117
|
public void setInAppMessageAsDeleted(String messageId, Callback successCallback, Callback errorCallback) {
|
|
119
|
-
|
|
118
|
+
RNSelligent.getManager().setInAppMessageAsDeleted(messageId, error ->
|
|
120
119
|
processErrorStringToCallback(error, successCallback, errorCallback)
|
|
121
120
|
);
|
|
122
121
|
}
|
|
123
122
|
|
|
124
123
|
@ReactMethod
|
|
125
124
|
public void executeButtonAction(String buttonId, String messageId, Callback successCallback, Callback errorCallback) {
|
|
126
|
-
|
|
125
|
+
RNSelligent.getManager().executeButtonAction(this.getCurrentActivity(), buttonId, messageId, error ->
|
|
127
126
|
processErrorStringToCallback(error, successCallback, errorCallback)
|
|
128
127
|
);
|
|
129
128
|
}
|
|
@@ -135,17 +134,17 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
|
|
|
135
134
|
|
|
136
135
|
@ReactMethod
|
|
137
136
|
public void sendEvent(ReadableMap eventMap, Callback successCallback, Callback errorCallback) {
|
|
138
|
-
|
|
137
|
+
RNSelligent.getManager().sendEvent(eventMap.toHashMap(), successCallback::invoke, errorCallback::invoke);
|
|
139
138
|
}
|
|
140
139
|
|
|
141
140
|
@ReactMethod
|
|
142
141
|
public void getDeviceId(Callback successCallback) {
|
|
143
|
-
successCallback.invoke(
|
|
142
|
+
successCallback.invoke(RNSelligent.getManager().getDeviceId());
|
|
144
143
|
}
|
|
145
144
|
|
|
146
145
|
@ReactMethod
|
|
147
146
|
public void enableNotifications(Boolean enable) {
|
|
148
|
-
|
|
147
|
+
RNSelligent.getManager().enableNotifications(enable);
|
|
149
148
|
}
|
|
150
149
|
|
|
151
150
|
public static void enableNotifications() {
|
|
@@ -155,35 +154,35 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
|
|
|
155
154
|
@ReactMethod
|
|
156
155
|
@SuppressWarnings("unused")
|
|
157
156
|
public void displayLastReceivedRemotePushNotification(String templateId) {
|
|
158
|
-
|
|
157
|
+
RNSelligent.getManager().displayLastReceivedRemotePushNotification(this.getCurrentActivity());
|
|
159
158
|
}
|
|
160
159
|
|
|
161
160
|
@ReactMethod
|
|
162
161
|
public void displayLastReceivedNotification() {
|
|
163
|
-
|
|
162
|
+
RNSelligent.getManager().displayLastReceivedNotification();
|
|
164
163
|
}
|
|
165
164
|
|
|
166
165
|
@ReactMethod
|
|
167
166
|
public void getLastRemotePushNotification(Callback successCallback) {
|
|
168
167
|
successCallback.invoke(
|
|
169
|
-
RNHelpers.convertMapToWritableMap(
|
|
168
|
+
RNHelpers.convertMapToWritableMap(RNSelligent.getManager().getLastRemotePushNotification())
|
|
170
169
|
);
|
|
171
170
|
}
|
|
172
171
|
|
|
173
172
|
@ReactMethod
|
|
174
173
|
public void setNotificationSmallIcon(String iconName) {
|
|
175
|
-
|
|
174
|
+
RNSelligent.getManager().setNotificationSmallIcon(this.reactContext, iconName);
|
|
176
175
|
}
|
|
177
176
|
|
|
178
177
|
@ReactMethod
|
|
179
178
|
public void setNotificationLargeIcon(String iconName) {
|
|
180
|
-
|
|
179
|
+
RNSelligent.getManager().setNotificationLargeIcon(this.reactContext, iconName);
|
|
181
180
|
}
|
|
182
181
|
|
|
183
182
|
@ReactMethod
|
|
184
183
|
public void setNotificationIconColor(String colorString, Callback successCallback, Callback errorCallback) {
|
|
185
184
|
processErrorStringToCallback(
|
|
186
|
-
|
|
185
|
+
RNSelligent.getManager().setNotificationIconColor(colorString),
|
|
187
186
|
successCallback,
|
|
188
187
|
errorCallback
|
|
189
188
|
);
|
|
@@ -200,17 +199,17 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
|
|
|
200
199
|
|
|
201
200
|
@ReactMethod
|
|
202
201
|
public void getGCMToken(Callback callback) {
|
|
203
|
-
callback.invoke(
|
|
202
|
+
callback.invoke(RNSelligent.getManager().getGCMToken());
|
|
204
203
|
}
|
|
205
204
|
|
|
206
205
|
@ReactMethod
|
|
207
206
|
public void getRemoteMessagesDisplayType(Callback successCallback) {
|
|
208
|
-
successCallback.invoke(
|
|
207
|
+
successCallback.invoke(RNSelligent.getManager().getRemoteMessagesDisplayType());
|
|
209
208
|
}
|
|
210
209
|
|
|
211
210
|
@ReactMethod
|
|
212
211
|
public void areNotificationsEnabled(Callback successCallback) {
|
|
213
|
-
successCallback.invoke(
|
|
212
|
+
successCallback.invoke(RNSelligent.getManager().areNotificationsEnabled());
|
|
214
213
|
}
|
|
215
214
|
|
|
216
215
|
@ReactMethod
|
|
@@ -223,7 +222,7 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
|
|
|
223
222
|
AppCompatActivity activity = (AppCompatActivity)currentActivity;
|
|
224
223
|
|
|
225
224
|
activity.runOnUiThread(() ->
|
|
226
|
-
|
|
225
|
+
RNSelligent.getManager().initializeObservers(activity, this::broadcastEvent)
|
|
227
226
|
);
|
|
228
227
|
|
|
229
228
|
return;
|
|
@@ -254,12 +253,12 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
|
|
|
254
253
|
|
|
255
254
|
if (currentActivity == null) { return; }
|
|
256
255
|
|
|
257
|
-
|
|
256
|
+
RNSelligent.getManager().executePushAction(currentActivity);
|
|
258
257
|
}
|
|
259
258
|
|
|
260
259
|
void emitDelayedEvents()
|
|
261
260
|
{
|
|
262
|
-
ArrayList<DelayedEvent> delayedEvents =
|
|
261
|
+
ArrayList<DelayedEvent> delayedEvents = RNSelligent.getManager().getStoredEvents();
|
|
263
262
|
|
|
264
263
|
if (delayedEvents.size() > 0)
|
|
265
264
|
{
|
|
@@ -276,7 +275,7 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
|
|
|
276
275
|
|
|
277
276
|
@ReactMethod
|
|
278
277
|
public void setFirebaseToken(String token) {
|
|
279
|
-
|
|
278
|
+
RNSelligent.getManager().setFirebaseToken(token);
|
|
280
279
|
}
|
|
281
280
|
|
|
282
281
|
@SuppressLint("UnspecifiedRegisterReceiverFlag")
|
|
@@ -297,14 +296,20 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
|
|
|
297
296
|
currentActivity.registerReceiver(this.receiver, this.receiver.getIntentFilter());
|
|
298
297
|
}
|
|
299
298
|
|
|
300
|
-
|
|
299
|
+
if (RNSelligent.getManager() == null)
|
|
300
|
+
{
|
|
301
|
+
Log.d(Manager.RN_SELLIGENT_NAME, "onHostResume: RNSelligent.getManager is null.");
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
RNSelligent.getManager().checkAndDisplayMessage(currentActivity.getIntent(), currentActivity, this::broadcastEvent);
|
|
301
306
|
}
|
|
302
307
|
|
|
303
308
|
@Override
|
|
304
309
|
public void onHostPause() {
|
|
305
310
|
Activity currentActivity = this.getCurrentActivity();
|
|
306
311
|
|
|
307
|
-
if (currentActivity == null) { return; }
|
|
312
|
+
if (currentActivity == null || this.receiver == null) { return; }
|
|
308
313
|
|
|
309
314
|
currentActivity.unregisterReceiver(this.receiver);
|
|
310
315
|
}
|
|
@@ -319,7 +324,7 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
|
|
|
319
324
|
if (currentActivity == null) { return; }
|
|
320
325
|
|
|
321
326
|
currentActivity.setIntent(intent);
|
|
322
|
-
|
|
327
|
+
RNSelligent.getManager().checkAndDisplayMessage(intent, currentActivity, this::broadcastEvent);
|
|
323
328
|
}
|
|
324
329
|
|
|
325
330
|
@Override
|
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 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.
|
|
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 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.
|
|
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 Selligent.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Selligent 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
|
+
Selligent 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 @@ Marigold welcomes any recommendations or suggestions regarding the manual, as it
|
|
|
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 Selligent Push Notifications](#disable-selligent-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
|
|
67
|
-
| clientId | string | The
|
|
68
|
-
| privateKey | string | The
|
|
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 |
|
|
69
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 |
|
|
70
70
|
| delayedPushAction | boolean| 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 |
|
|
71
71
|
| interceptSelligentUniversalLinks | boolean| (iOS Only) Optin to customly handle the execution of universal links coming from a Push/IAM [more information](#universal-linking---ios) |
|
|
@@ -241,7 +241,7 @@ Follow the [iOS](https://github.com/SelligentMarketingCloud/MobileSDK-iOS/tree/m
|
|
|
241
241
|
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.
|
|
242
242
|
|
|
243
243
|
```javascript
|
|
244
|
-
import Selligent from "@selligent-marketing-cloud/selligent-react-native"; // Add
|
|
244
|
+
import Selligent from "@selligent-marketing-cloud/selligent-react-native"; // Add Selligent import
|
|
245
245
|
|
|
246
246
|
if (Platform.OS === "ios") {
|
|
247
247
|
Selligent.registerForProvisionalRemoteNotification(() => {
|
|
@@ -277,13 +277,13 @@ This is because the JS layer is loaded **after** the native SDK executes the dee
|
|
|
277
277
|
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)
|
|
278
278
|
|
|
279
279
|
```javascript
|
|
280
|
-
import Selligent from "@selligent-marketing-cloud/selligent-react-native" // Add
|
|
280
|
+
import Selligent from "@selligent-marketing-cloud/selligent-react-native" // Add Selligent import
|
|
281
281
|
|
|
282
282
|
const App = () => {
|
|
283
283
|
// Deeplinking handling library (i.e Linking.getInitialURL() & Linking.addEventListener...)
|
|
284
284
|
// useHandleDeepLink()
|
|
285
285
|
|
|
286
|
-
/* Tells the
|
|
286
|
+
/* Tells the Selligent SDK to execute the action associated to the last push clicked, when using `delayedPushAction` feature.
|
|
287
287
|
If you are having problems with deeplinks or 'Push + InApp Message' where the splash screen gets stuck or the push action not visible,
|
|
288
288
|
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)
|
|
289
289
|
*/
|
|
@@ -326,7 +326,7 @@ static BOOL launchedFromBackground = false;
|
|
|
326
326
|
|
|
327
327
|
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.
|
|
328
328
|
|
|
329
|
-
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
|
|
329
|
+
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 (whose URL scheme is `http` or `https`).
|
|
330
330
|
The response of the success callback is an object which contains information on the type of broadcast event and the data attached to it.
|
|
331
331
|
|
|
332
332
|
| Property | Type | Description |
|
|
@@ -356,9 +356,9 @@ Selligent.subscribeToEvents(
|
|
|
356
356
|
|
|
357
357
|
### Notification helper methods
|
|
358
358
|
|
|
359
|
-
#### Disable
|
|
359
|
+
#### Disable Selligent Push Notifications
|
|
360
360
|
|
|
361
|
-
You can enable or disable
|
|
361
|
+
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).
|
|
362
362
|
|
|
363
363
|
```javascript
|
|
364
364
|
Selligent.enableNotifications(
|
|
@@ -632,9 +632,9 @@ In the other hand, you can also use the native methods `RNSelligent/willPresentN
|
|
|
632
632
|
|
|
633
633
|
### IAM Helper methods
|
|
634
634
|
|
|
635
|
-
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
|
|
635
|
+
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 Selligent platform:
|
|
636
636
|
|
|
637
|
-
- setInAppMessageAsSeen: sets an IAM as seen and sends the corresponding `Opened` event to the
|
|
637
|
+
- setInAppMessageAsSeen: sets an IAM as seen and sends the corresponding `Opened` event to the Selligent platform
|
|
638
638
|
|
|
639
639
|
```javascript
|
|
640
640
|
Selligent.setInAppMessageAsSeen(
|
|
@@ -670,7 +670,7 @@ If you decide to display the IAM on your own (without `Selligent.displayMessage`
|
|
|
670
670
|
)
|
|
671
671
|
```
|
|
672
672
|
|
|
673
|
-
- executeButtonAction: executes the action linked to an IAM button and sends the corresponding `Clicked` event to the
|
|
673
|
+
- executeButtonAction: executes the action linked to an IAM button and sends the corresponding `Clicked` event to the Selligent platform
|
|
674
674
|
|
|
675
675
|
```javascript
|
|
676
676
|
Selligent.executeButtonAction(
|
|
@@ -692,7 +692,7 @@ The method accepts an `event` object which requires certain properties, dependin
|
|
|
692
692
|
| ----------- | ------------------------------------- | ---------------- |
|
|
693
693
|
| type | [enum](#eventtype) | The type of event to send |
|
|
694
694
|
| email | string | The custom profile identifier (`mail` in our v1 platform) of the user as a String. |
|
|
695
|
-
| data | object | Additional data you want to provide to
|
|
695
|
+
| data | object | Additional data you want to provide to Selligent (you can specify here a key/value pair to use as an alternative lookup for your device identification process) |
|
|
696
696
|
|
|
697
697
|
For events of type `SelligentConstants.EventType.CUSTOM` the `data` property is mandatory.
|
|
698
698
|
|
|
@@ -728,7 +728,7 @@ Selligent.sendEvent(
|
|
|
728
728
|
|
|
729
729
|
### Get lib version
|
|
730
730
|
|
|
731
|
-
Returns the version of the installed native
|
|
731
|
+
Returns the version of the installed native Selligent SDK (string).
|
|
732
732
|
|
|
733
733
|
```javascript
|
|
734
734
|
Selligent.getVersionLib((versionLib) => {
|
|
@@ -737,7 +737,7 @@ Selligent.getVersionLib((versionLib) => {
|
|
|
737
737
|
|
|
738
738
|
### Get device id
|
|
739
739
|
|
|
740
|
-
Returns the currently known
|
|
740
|
+
Returns the currently known Selligent device Id (string).
|
|
741
741
|
|
|
742
742
|
```javascript
|
|
743
743
|
Selligent.getDeviceId((deviceId) => {
|
|
@@ -758,7 +758,7 @@ The `data` property is an object itself containing more information specific to
|
|
|
758
758
|
|
|
759
759
|
| Property | Type | Description |
|
|
760
760
|
| -------- | ------ | ------------------------------- |
|
|
761
|
-
| deviceId | string | The
|
|
761
|
+
| deviceId | string | The Selligent id of the device |
|
|
762
762
|
|
|
763
763
|
### Logging
|
|
764
764
|
|
|
@@ -902,11 +902,11 @@ Defines the type of an event.
|
|
|
902
902
|
|
|
903
903
|
| Name | Type | Value | Description |
|
|
904
904
|
| --------------- | ------ | ----- | ----------------- |
|
|
905
|
-
| 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
|
|
906
|
-
| 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
|
|
907
|
-
| 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
|
|
908
|
-
| 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
|
|
909
|
-
| CUSTOM | number | 94 | Used to send a custom event to the server, with the purpose of keeping track of storing some data at
|
|
905
|
+
| 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). |
|
|
906
|
+
| 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). |
|
|
907
|
+
| 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. |
|
|
908
|
+
| 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). |
|
|
909
|
+
| 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. |
|
|
910
910
|
|
|
911
911
|
### NotificationButtonType
|
|
912
912
|
|
|
@@ -924,7 +924,7 @@ Defines the type of buttons for notifications or inapp messages.
|
|
|
924
924
|
| CUSTOM_ACTION_BROADCAST_EVENT | number | 107 | Sends a custom broadcast to the App |
|
|
925
925
|
| PASSBOOK | number | 111 | Opens a passbook URL |
|
|
926
926
|
| DEEPLINK | number | 112 | Executes a deeplink |
|
|
927
|
-
| SIMPLE | number | 113 | Nothing done except forwarding the corresponding `Clicked` event to the
|
|
927
|
+
| SIMPLE | number | 113 | Nothing done except forwarding the corresponding `Clicked` event to the Selligent platform |
|
|
928
928
|
|
|
929
929
|
### BroadcastEventType
|
|
930
930
|
|
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 Selligent SDK is found
|
|
12
12
|
*
|
|
13
13
|
* @param RNSelligent
|
|
14
14
|
*/
|
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 Selligent 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 Selligent 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 Selligent native SDK.
|
|
32
32
|
*
|
|
33
33
|
* @param {function} successCallback Callback function on success.
|
|
34
34
|
*/
|
|
@@ -185,7 +185,7 @@ export default Object.assign(
|
|
|
185
185
|
},
|
|
186
186
|
|
|
187
187
|
/**
|
|
188
|
-
* Tells the
|
|
188
|
+
* Tells the Selligent SDK to execute the action associated to the last push clicked, when using `delayedPushAction` feature
|
|
189
189
|
*/
|
|
190
190
|
executePushAction: function () {
|
|
191
191
|
RNSelligent.executePushAction()
|
package/ios/RNSelligentMapper.m
CHANGED
|
@@ -126,11 +126,11 @@ RCT_EXPORT_METHOD(displayNotification:(NSString *)notificationId templateId:(NSS
|
|
|
126
126
|
RCT_EXPORT_METHOD(sendEvent:(NSDictionary *)data successCallback:(RCTResponseSenderBlock)successCallback errorCallback:(RCTResponseSenderBlock)errorCallback) {
|
|
127
127
|
[RNSelligent sendEvent:data completion:^(BOOL status, NSString *message) {
|
|
128
128
|
if (status) {
|
|
129
|
-
successCallback(@[message, [NSNull null]]);
|
|
129
|
+
successCallback(@[message ?: @"", [NSNull null]]);
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
errorCallback(@[message, [NSNull null]]);
|
|
133
|
+
errorCallback(@[message ?: @"Unknown error", [NSNull null]]);
|
|
134
134
|
}];
|
|
135
135
|
}
|
|
136
136
|
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": {
|
|
3
|
-
"name": "
|
|
3
|
+
"name": "Selligent by Zeta <mobile@selligent.com>"
|
|
4
4
|
},
|
|
5
5
|
"name": "@selligent-marketing-cloud/selligent-react-native",
|
|
6
|
-
"title": "
|
|
7
|
-
"version": "4.3.
|
|
8
|
-
"description": "React Native wrapper for the
|
|
6
|
+
"title": "Selligent by Zeta React Native",
|
|
7
|
+
"version": "4.3.2",
|
|
8
|
+
"description": "React Native wrapper for the Selligent by Zeta Android and iOS SDKs",
|
|
9
9
|
"main": "index.js",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|