@selligent-marketing-cloud/selligent-react-native 4.2.0 → 4.3.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.
- package/README.md +6 -7
- package/RNSelligentMapper.podspec +1 -1
- package/android/build.gradle +5 -5
- package/android/src/main/java/com/selligent/RNSelligent.java +28 -30
- package/documentation/README.md +28 -28
- package/helpers.js +1 -1
- package/index.js +4 -4
- 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
|
|
|
@@ -10,7 +10,7 @@ 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.7.
|
|
13
|
+
| [Android SDK](https://github.com/SelligentMarketingCloud/MobileSDK-Android) | 4.7.1 |
|
|
14
14
|
| [iOS SDK](https://github.com/SelligentMarketingCloud/MobileSDK-iOS) | 3.8.7 |
|
|
15
15
|
| ReactNative | 0.81.4 |
|
|
16
16
|
| Expo SDK | 54 |
|
|
@@ -189,13 +189,12 @@ 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
|
// }
|
|
196
196
|
// [launchOptions setValue:@"alternativeFileName" forKey:@"RN_SELLIGENT_JSON"];
|
|
197
197
|
// [launchOptions setValue:@"selligent/alternativeFileName" forKey:@"RN_SELLIGENT_JSON"];
|
|
198
|
-
// [launchOptions setValue:@"alternativeFolder/alternativeFileName" forKey:@"RN_SELLIGENT_JSON"];
|
|
199
198
|
|
|
200
199
|
// At the end of application:didFinishLaunchingWithOptions:
|
|
201
200
|
[RNSelligent configureWithLaunchOptions:launchOptions];
|
|
@@ -219,7 +218,7 @@ This module supports the following SDK and tools:
|
|
|
219
218
|
// OR
|
|
220
219
|
// #import <RNSelligentMobileSDK/RNSelligentMobileSDK-Swift.h>
|
|
221
220
|
|
|
222
|
-
// 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')
|
|
223
222
|
// if (!launchOptions) {
|
|
224
223
|
// launchOptions = [NSMutableDictionary new];
|
|
225
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
|
@@ -56,7 +56,7 @@ dependencies {
|
|
|
56
56
|
exclude group:'com.facebook.fbjni'
|
|
57
57
|
exclude group:'com.facebook.yoga'
|
|
58
58
|
}
|
|
59
|
-
implementation 'com.selligent.sdk:selligent_mobile_sdk:4.7.
|
|
59
|
+
implementation 'com.selligent.sdk:selligent_mobile_sdk:4.7.1'
|
|
60
60
|
implementation 'com.google.code.gson:gson:2.10.1'
|
|
61
61
|
implementation 'com.google.firebase:firebase-messaging:23.4.1'
|
|
62
62
|
implementation 'androidx.work:work-runtime:2.9.0'
|
|
@@ -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.
|
|
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 ->
|
|
@@ -29,7 +29,6 @@ import java.util.Map;
|
|
|
29
29
|
|
|
30
30
|
public class RNSelligent extends ReactContextBaseJavaModule implements LifecycleEventListener, ActivityEventListener {
|
|
31
31
|
private final ReactApplicationContext reactContext;
|
|
32
|
-
private final Manager manager;
|
|
33
32
|
EventReceiver eventReceiver;
|
|
34
33
|
SMForegroundGcmBroadcastReceiver receiver;
|
|
35
34
|
|
|
@@ -52,7 +51,6 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
|
|
|
52
51
|
this.reactContext = reactContext;
|
|
53
52
|
reactContext.addLifecycleEventListener(this);
|
|
54
53
|
reactContext.addActivityEventListener(this);
|
|
55
|
-
this.manager = RNSelligent.getManager();
|
|
56
54
|
}
|
|
57
55
|
|
|
58
56
|
@NonNull
|
|
@@ -67,7 +65,7 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
|
|
|
67
65
|
|
|
68
66
|
@ReactMethod
|
|
69
67
|
public void getVersionLib(Callback successCallback) {
|
|
70
|
-
successCallback.invoke(
|
|
68
|
+
successCallback.invoke(RNSelligent.getManager().getVersionLib());
|
|
71
69
|
}
|
|
72
70
|
|
|
73
71
|
@ReactMethod
|
|
@@ -76,54 +74,54 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
|
|
|
76
74
|
ReadableType enabledType = enabled.getType(enabledProperty);
|
|
77
75
|
|
|
78
76
|
if (enabledType == ReadableType.Boolean) {
|
|
79
|
-
|
|
77
|
+
RNSelligent.getManager().enableInAppMessages(enabled.getBoolean(enabledProperty));
|
|
80
78
|
}
|
|
81
79
|
else if (enabledType == ReadableType.Number) {
|
|
82
|
-
|
|
80
|
+
RNSelligent.getManager().enableInAppMessages(enabled.getInt(enabledProperty));
|
|
83
81
|
}
|
|
84
82
|
}
|
|
85
83
|
|
|
86
84
|
@ReactMethod
|
|
87
85
|
public void areInAppMessagesEnabled(Callback successCallback) {
|
|
88
|
-
successCallback.invoke(
|
|
86
|
+
successCallback.invoke(RNSelligent.getManager().areInAppMessagesEnabled());
|
|
89
87
|
}
|
|
90
88
|
|
|
91
89
|
@ReactMethod
|
|
92
90
|
public void displayMessage(String messageId) {
|
|
93
|
-
|
|
91
|
+
RNSelligent.getManager().displayMessage(messageId, this.getCurrentActivity());
|
|
94
92
|
}
|
|
95
93
|
|
|
96
94
|
@ReactMethod
|
|
97
95
|
public void getInAppMessages(Callback successCallback) {
|
|
98
|
-
|
|
96
|
+
RNSelligent.getManager().getInAppMessages(list ->
|
|
99
97
|
successCallback.invoke(RNHelpers.convertListToWritableArray(list))
|
|
100
98
|
);
|
|
101
99
|
}
|
|
102
100
|
|
|
103
101
|
@ReactMethod
|
|
104
102
|
public void setInAppMessageAsSeen(String messageId, Callback successCallback, Callback errorCallback) {
|
|
105
|
-
|
|
103
|
+
RNSelligent.getManager().setInAppMessageAsSeen(messageId, error ->
|
|
106
104
|
processErrorStringToCallback(error, successCallback, errorCallback)
|
|
107
105
|
);
|
|
108
106
|
}
|
|
109
107
|
|
|
110
108
|
@ReactMethod
|
|
111
109
|
public void setInAppMessageAsUnseen(String messageId, Callback successCallback, Callback errorCallback) {
|
|
112
|
-
|
|
110
|
+
RNSelligent.getManager().setInAppMessageAsUnseen(messageId, error ->
|
|
113
111
|
processErrorStringToCallback(error, successCallback, errorCallback)
|
|
114
112
|
);
|
|
115
113
|
}
|
|
116
114
|
|
|
117
115
|
@ReactMethod
|
|
118
116
|
public void setInAppMessageAsDeleted(String messageId, Callback successCallback, Callback errorCallback) {
|
|
119
|
-
|
|
117
|
+
RNSelligent.getManager().setInAppMessageAsDeleted(messageId, error ->
|
|
120
118
|
processErrorStringToCallback(error, successCallback, errorCallback)
|
|
121
119
|
);
|
|
122
120
|
}
|
|
123
121
|
|
|
124
122
|
@ReactMethod
|
|
125
123
|
public void executeButtonAction(String buttonId, String messageId, Callback successCallback, Callback errorCallback) {
|
|
126
|
-
|
|
124
|
+
RNSelligent.getManager().executeButtonAction(this.getCurrentActivity(), buttonId, messageId, error ->
|
|
127
125
|
processErrorStringToCallback(error, successCallback, errorCallback)
|
|
128
126
|
);
|
|
129
127
|
}
|
|
@@ -135,17 +133,17 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
|
|
|
135
133
|
|
|
136
134
|
@ReactMethod
|
|
137
135
|
public void sendEvent(ReadableMap eventMap, Callback successCallback, Callback errorCallback) {
|
|
138
|
-
|
|
136
|
+
RNSelligent.getManager().sendEvent(eventMap.toHashMap(), successCallback::invoke, errorCallback::invoke);
|
|
139
137
|
}
|
|
140
138
|
|
|
141
139
|
@ReactMethod
|
|
142
140
|
public void getDeviceId(Callback successCallback) {
|
|
143
|
-
successCallback.invoke(
|
|
141
|
+
successCallback.invoke(RNSelligent.getManager().getDeviceId());
|
|
144
142
|
}
|
|
145
143
|
|
|
146
144
|
@ReactMethod
|
|
147
145
|
public void enableNotifications(Boolean enable) {
|
|
148
|
-
|
|
146
|
+
RNSelligent.getManager().enableNotifications(enable);
|
|
149
147
|
}
|
|
150
148
|
|
|
151
149
|
public static void enableNotifications() {
|
|
@@ -155,35 +153,35 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
|
|
|
155
153
|
@ReactMethod
|
|
156
154
|
@SuppressWarnings("unused")
|
|
157
155
|
public void displayLastReceivedRemotePushNotification(String templateId) {
|
|
158
|
-
|
|
156
|
+
RNSelligent.getManager().displayLastReceivedRemotePushNotification(this.getCurrentActivity());
|
|
159
157
|
}
|
|
160
158
|
|
|
161
159
|
@ReactMethod
|
|
162
160
|
public void displayLastReceivedNotification() {
|
|
163
|
-
|
|
161
|
+
RNSelligent.getManager().displayLastReceivedNotification();
|
|
164
162
|
}
|
|
165
163
|
|
|
166
164
|
@ReactMethod
|
|
167
165
|
public void getLastRemotePushNotification(Callback successCallback) {
|
|
168
166
|
successCallback.invoke(
|
|
169
|
-
RNHelpers.convertMapToWritableMap(
|
|
167
|
+
RNHelpers.convertMapToWritableMap(RNSelligent.getManager().getLastRemotePushNotification())
|
|
170
168
|
);
|
|
171
169
|
}
|
|
172
170
|
|
|
173
171
|
@ReactMethod
|
|
174
172
|
public void setNotificationSmallIcon(String iconName) {
|
|
175
|
-
|
|
173
|
+
RNSelligent.getManager().setNotificationSmallIcon(this.reactContext, iconName);
|
|
176
174
|
}
|
|
177
175
|
|
|
178
176
|
@ReactMethod
|
|
179
177
|
public void setNotificationLargeIcon(String iconName) {
|
|
180
|
-
|
|
178
|
+
RNSelligent.getManager().setNotificationLargeIcon(this.reactContext, iconName);
|
|
181
179
|
}
|
|
182
180
|
|
|
183
181
|
@ReactMethod
|
|
184
182
|
public void setNotificationIconColor(String colorString, Callback successCallback, Callback errorCallback) {
|
|
185
183
|
processErrorStringToCallback(
|
|
186
|
-
|
|
184
|
+
RNSelligent.getManager().setNotificationIconColor(colorString),
|
|
187
185
|
successCallback,
|
|
188
186
|
errorCallback
|
|
189
187
|
);
|
|
@@ -200,17 +198,17 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
|
|
|
200
198
|
|
|
201
199
|
@ReactMethod
|
|
202
200
|
public void getGCMToken(Callback callback) {
|
|
203
|
-
callback.invoke(
|
|
201
|
+
callback.invoke(RNSelligent.getManager().getGCMToken());
|
|
204
202
|
}
|
|
205
203
|
|
|
206
204
|
@ReactMethod
|
|
207
205
|
public void getRemoteMessagesDisplayType(Callback successCallback) {
|
|
208
|
-
successCallback.invoke(
|
|
206
|
+
successCallback.invoke(RNSelligent.getManager().getRemoteMessagesDisplayType());
|
|
209
207
|
}
|
|
210
208
|
|
|
211
209
|
@ReactMethod
|
|
212
210
|
public void areNotificationsEnabled(Callback successCallback) {
|
|
213
|
-
successCallback.invoke(
|
|
211
|
+
successCallback.invoke(RNSelligent.getManager().areNotificationsEnabled());
|
|
214
212
|
}
|
|
215
213
|
|
|
216
214
|
@ReactMethod
|
|
@@ -223,7 +221,7 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
|
|
|
223
221
|
AppCompatActivity activity = (AppCompatActivity)currentActivity;
|
|
224
222
|
|
|
225
223
|
activity.runOnUiThread(() ->
|
|
226
|
-
|
|
224
|
+
RNSelligent.getManager().initializeObservers(activity, this::broadcastEvent)
|
|
227
225
|
);
|
|
228
226
|
|
|
229
227
|
return;
|
|
@@ -254,12 +252,12 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
|
|
|
254
252
|
|
|
255
253
|
if (currentActivity == null) { return; }
|
|
256
254
|
|
|
257
|
-
|
|
255
|
+
RNSelligent.getManager().executePushAction(currentActivity);
|
|
258
256
|
}
|
|
259
257
|
|
|
260
258
|
void emitDelayedEvents()
|
|
261
259
|
{
|
|
262
|
-
ArrayList<DelayedEvent> delayedEvents =
|
|
260
|
+
ArrayList<DelayedEvent> delayedEvents = RNSelligent.getManager().getStoredEvents();
|
|
263
261
|
|
|
264
262
|
if (delayedEvents.size() > 0)
|
|
265
263
|
{
|
|
@@ -276,7 +274,7 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
|
|
|
276
274
|
|
|
277
275
|
@ReactMethod
|
|
278
276
|
public void setFirebaseToken(String token) {
|
|
279
|
-
|
|
277
|
+
RNSelligent.getManager().setFirebaseToken(token);
|
|
280
278
|
}
|
|
281
279
|
|
|
282
280
|
@SuppressLint("UnspecifiedRegisterReceiverFlag")
|
|
@@ -297,7 +295,7 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
|
|
|
297
295
|
currentActivity.registerReceiver(this.receiver, this.receiver.getIntentFilter());
|
|
298
296
|
}
|
|
299
297
|
|
|
300
|
-
|
|
298
|
+
RNSelligent.getManager().checkAndDisplayMessage(currentActivity.getIntent(), currentActivity, this::broadcastEvent);
|
|
301
299
|
}
|
|
302
300
|
|
|
303
301
|
@Override
|
|
@@ -319,7 +317,7 @@ public class RNSelligent extends ReactContextBaseJavaModule implements Lifecycle
|
|
|
319
317
|
if (currentActivity == null) { return; }
|
|
320
318
|
|
|
321
319
|
currentActivity.setIntent(intent);
|
|
322
|
-
|
|
320
|
+
RNSelligent.getManager().checkAndDisplayMessage(intent, currentActivity, this::broadcastEvent);
|
|
323
321
|
}
|
|
324
322
|
|
|
325
323
|
@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/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.
|
|
8
|
-
"description": "React Native wrapper for the
|
|
6
|
+
"title": "Selligent by Zeta React Native",
|
|
7
|
+
"version": "4.3.1",
|
|
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",
|