@attentive-mobile/attentive-react-native-sdk 0.4.2 → 1.0.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 +8 -1
- package/android/build.gradle +2 -2
- package/android/gradle.properties +2 -2
- package/android/src/main/java/com/attentivereactnativesdk/AttentiveReactNativeSdkModule.java +46 -5
- package/attentive-react-native-sdk.podspec +4 -2
- package/ios/AttentiveReactNativeSdk.mm +23 -30
- package/ios/AttentiveReactNativeSdk.xcodeproj/project.pbxproj +59 -4
- package/ios/Bridging/ATTNNativeSDK.swift +108 -0
- package/ios/Bridging/AttentiveReactNativeSdk-Bridging-Header.h +7 -0
- package/ios/Podfile +58 -0
- package/lib/commonjs/index.js +5 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +5 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/eventTypes.d.ts +2 -0
- package/lib/typescript/eventTypes.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +3 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +10 -4
- package/src/eventTypes.tsx +2 -0
- package/src/index.tsx +7 -2
- package/android/github.properties +0 -2
- package/ios/AttentiveReactNativeSdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/ios/AttentiveReactNativeSdk.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/AttentiveReactNativeSdk.xcodeproj/project.xcworkspace/xcuserdata/twaltze.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/AttentiveReactNativeSdk.xcodeproj/xcuserdata/twaltze.xcuserdatad/xcschemes/xcschememanagement.plist +0 -22
- package/ios/attentive-sdk-umbrella.h +0 -23
package/README.md
CHANGED
|
@@ -44,6 +44,13 @@ const config : AttentiveConfiguration = {
|
|
|
44
44
|
Attentive.initialize(config);
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
+
### Destroy the creative
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
// This will remove the creative along with its web view
|
|
51
|
+
Attentive.destroyCreative();
|
|
52
|
+
```
|
|
53
|
+
|
|
47
54
|
|
|
48
55
|
### Identify the current user
|
|
49
56
|
```typescript
|
|
@@ -66,7 +73,7 @@ The more identifiers that are passed to `identify`, the better the SDK will func
|
|
|
66
73
|
| Phone | String | The users's phone number in E.164 format |
|
|
67
74
|
| Email | String | The users's email |
|
|
68
75
|
| Shopify ID | String | The users's Shopify ID |
|
|
69
|
-
| Klaviyo ID | String | The users's Klaviyo ID |
|
|
76
|
+
| Klaviyo ID | String | The users's Klaviyo ID |
|
|
70
77
|
| Custom Identifiers | Map<String,String> | Key-value pairs of custom identifier names and values. The values should be unique to this user. |
|
|
71
78
|
|
|
72
79
|
### Load the Creative
|
package/android/build.gradle
CHANGED
|
@@ -5,7 +5,7 @@ buildscript {
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
dependencies {
|
|
8
|
-
classpath "com.android.tools.build:gradle:7.
|
|
8
|
+
classpath "com.android.tools.build:gradle:7.3.1"
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -80,7 +80,7 @@ dependencies {
|
|
|
80
80
|
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
81
81
|
//noinspection GradleDynamicVersion
|
|
82
82
|
implementation "com.facebook.react:react-native:+"
|
|
83
|
-
implementation 'com.attentive:attentive-android-sdk:0.
|
|
83
|
+
implementation 'com.attentive:attentive-android-sdk:1.0.1'
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
if (isNewArchitectureEnabled()) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
AttentiveReactNativeSdk_kotlinVersion=1.7.0
|
|
2
2
|
AttentiveReactNativeSdk_minSdkVersion=21
|
|
3
|
-
AttentiveReactNativeSdk_targetSdkVersion=
|
|
4
|
-
AttentiveReactNativeSdk_compileSdkVersion=
|
|
3
|
+
AttentiveReactNativeSdk_targetSdkVersion=34
|
|
4
|
+
AttentiveReactNativeSdk_compileSdkVersion=34
|
|
5
5
|
AttentiveReactNativeSdk_ndkversion=21.4.7075529
|
package/android/src/main/java/com/attentivereactnativesdk/AttentiveReactNativeSdkModule.java
CHANGED
|
@@ -4,6 +4,7 @@ import android.app.Activity;
|
|
|
4
4
|
import android.util.Log;
|
|
5
5
|
import android.view.ViewGroup;
|
|
6
6
|
import androidx.annotation.NonNull;
|
|
7
|
+
import androidx.annotation.Nullable;
|
|
7
8
|
|
|
8
9
|
import com.attentive.androidsdk.AttentiveConfig;
|
|
9
10
|
import com.attentive.androidsdk.AttentiveEventTracker;
|
|
@@ -57,13 +58,27 @@ public class AttentiveReactNativeSdkModule extends ReactContextBaseJavaModule {
|
|
|
57
58
|
if (rawMode == null) {
|
|
58
59
|
throw new IllegalArgumentException("The 'mode' parameter cannot be null.");
|
|
59
60
|
}
|
|
61
|
+
|
|
60
62
|
final String domain = config.getString("attentiveDomain");
|
|
61
|
-
|
|
63
|
+
final Boolean skipFatigue = config.hasKey("skipFatigueOnCreatives") ?
|
|
64
|
+
config.getBoolean("skipFatigueOnCreatives") : false;
|
|
65
|
+
|
|
66
|
+
attentiveConfig = new AttentiveConfig.Builder()
|
|
67
|
+
.context(this.getReactApplicationContext())
|
|
68
|
+
.domain(domain)
|
|
69
|
+
.mode(AttentiveConfig.Mode.valueOf(rawMode.toUpperCase(Locale.ROOT)))
|
|
70
|
+
.skipFatigueOnCreatives(skipFatigue)
|
|
71
|
+
.build();
|
|
62
72
|
AttentiveEventTracker.getInstance().initialize(attentiveConfig);
|
|
63
73
|
}
|
|
64
74
|
|
|
65
75
|
@ReactMethod
|
|
66
76
|
public void triggerCreative() {
|
|
77
|
+
this.triggerCreative(null);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@ReactMethod
|
|
81
|
+
public void triggerCreative(@Nullable String creativeId) {
|
|
67
82
|
Log.i(TAG, "Native Attentive module was called to trigger the creative.");
|
|
68
83
|
try {
|
|
69
84
|
Activity currentActivity = getReactApplicationContext().getCurrentActivity();
|
|
@@ -73,7 +88,7 @@ public class AttentiveReactNativeSdkModule extends ReactContextBaseJavaModule {
|
|
|
73
88
|
// The following calls edit the view hierarchy so they must run on the UI thread
|
|
74
89
|
UiThreadUtil.runOnUiThread(() -> {
|
|
75
90
|
creative = new Creative(attentiveConfig, rootView);
|
|
76
|
-
creative.trigger();
|
|
91
|
+
creative.trigger(null, creativeId);
|
|
77
92
|
});
|
|
78
93
|
} else {
|
|
79
94
|
Log.w(TAG, "Could not trigger the Attentive Creative because the current Activity was null");
|
|
@@ -93,6 +108,11 @@ public class AttentiveReactNativeSdkModule extends ReactContextBaseJavaModule {
|
|
|
93
108
|
}
|
|
94
109
|
}
|
|
95
110
|
|
|
111
|
+
@ReactMethod
|
|
112
|
+
public void updateDomain(String domain) {
|
|
113
|
+
attentiveConfig.changeDomain(domain);
|
|
114
|
+
}
|
|
115
|
+
|
|
96
116
|
@ReactMethod
|
|
97
117
|
public void clearUser() {
|
|
98
118
|
attentiveConfig.clearUser();
|
|
@@ -135,7 +155,8 @@ public class AttentiveReactNativeSdkModule extends ReactContextBaseJavaModule {
|
|
|
135
155
|
Log.i(TAG, "Sending product viewed event");
|
|
136
156
|
|
|
137
157
|
List<Item> items = buildItems(productViewAttrs.getArray("items"));
|
|
138
|
-
|
|
158
|
+
String deeplink = productViewAttrs.getString("deeplink");
|
|
159
|
+
ProductViewEvent productViewEvent = new ProductViewEvent.Builder(items).deeplink(deeplink).build();
|
|
139
160
|
|
|
140
161
|
AttentiveEventTracker.getInstance().recordEvent(productViewEvent);
|
|
141
162
|
}
|
|
@@ -156,7 +177,8 @@ public class AttentiveReactNativeSdkModule extends ReactContextBaseJavaModule {
|
|
|
156
177
|
Log.i(TAG, "Sending add to cart event");
|
|
157
178
|
|
|
158
179
|
List<Item> items = buildItems(addToCartAttrs.getArray("items"));
|
|
159
|
-
|
|
180
|
+
String deeplink = addToCartAttrs.getString("deeplink");
|
|
181
|
+
AddToCartEvent addToCartEvent = new AddToCartEvent.Builder(items).deeplink(deeplink).build();
|
|
160
182
|
|
|
161
183
|
AttentiveEventTracker.getInstance().recordEvent(addToCartEvent);
|
|
162
184
|
}
|
|
@@ -190,6 +212,7 @@ public class AttentiveReactNativeSdkModule extends ReactContextBaseJavaModule {
|
|
|
190
212
|
}
|
|
191
213
|
|
|
192
214
|
private List<Item> buildItems(ReadableArray rawItems) {
|
|
215
|
+
Log.i(TAG, "buildItems method called with rawItems: " + rawItems.toString());
|
|
193
216
|
List<Item> items = new ArrayList<>();
|
|
194
217
|
for (int i = 0; i < rawItems.size(); i++) {
|
|
195
218
|
ReadableMap rawItem = rawItems.getMap(i);
|
|
@@ -197,7 +220,25 @@ public class AttentiveReactNativeSdkModule extends ReactContextBaseJavaModule {
|
|
|
197
220
|
ReadableMap priceMap = rawItem.getMap("price");
|
|
198
221
|
Price price = new Price.Builder(new BigDecimal(priceMap.getString("price")), Currency.getInstance(priceMap.getString("currency"))).build();
|
|
199
222
|
|
|
200
|
-
Item
|
|
223
|
+
Item.Builder builder = new Item.Builder(rawItem.getString("productId"), rawItem.getString("productVariantId"), price);
|
|
224
|
+
|
|
225
|
+
if (rawItem.hasKey("productImage")) {
|
|
226
|
+
builder.productImage(rawItem.getString("productImage"));
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (rawItem.hasKey("name")) {
|
|
230
|
+
builder.name(rawItem.getString("name"));
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (rawItem.hasKey("quantity")) {
|
|
234
|
+
builder.quantity(rawItem.getInt("quantity"));
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (rawItem.hasKey("category")) {
|
|
238
|
+
builder.category(rawItem.getString("category"));
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
Item item = builder.build();
|
|
201
242
|
items.add(item);
|
|
202
243
|
}
|
|
203
244
|
|
|
@@ -14,9 +14,11 @@ Pod::Spec.new do |s|
|
|
|
14
14
|
s.platforms = { :ios => "11.0" }
|
|
15
15
|
s.source = { :git => "https://github.com/attentive-mobile/attentive-react-native-sdk.git", :tag => "#{s.version}" }
|
|
16
16
|
|
|
17
|
-
s.source_files = "ios/**/*.{h,m,mm}"
|
|
17
|
+
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
18
|
|
|
19
|
-
s.dependency 'attentive-ios-sdk', '0.
|
|
19
|
+
s.dependency 'attentive-ios-sdk', '1.0.0'
|
|
20
|
+
s.ios.deployment_target = '14.0'
|
|
21
|
+
s.swift_versions = ['5']
|
|
20
22
|
s.dependency "React-Core"
|
|
21
23
|
|
|
22
24
|
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
@@ -6,24 +6,33 @@
|
|
|
6
6
|
//
|
|
7
7
|
|
|
8
8
|
#import "AttentiveReactNativeSdk.h"
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
#if __has_include(<AttentiveReactNativeSdk-Swift.h>)
|
|
11
|
+
#import "AttentiveReactNativeSdk-Swift.h"
|
|
12
|
+
#else
|
|
13
|
+
// Load the headers from the attentive-ios-sdk Pod
|
|
14
|
+
#import "attentive_react_native_sdk-Swift.h"
|
|
15
|
+
#endif
|
|
10
16
|
|
|
11
17
|
@implementation AttentiveReactNativeSdk {
|
|
12
|
-
|
|
18
|
+
ATTNNativeSDK* _sdk;
|
|
13
19
|
}
|
|
14
20
|
|
|
15
21
|
RCT_EXPORT_MODULE()
|
|
16
22
|
|
|
17
23
|
RCT_EXPORT_METHOD(initialize:(NSDictionary*)configuration) {
|
|
18
|
-
_sdk = [[
|
|
19
|
-
[ATTNEventTracker setupWithSdk:_sdk];
|
|
24
|
+
_sdk = [[ATTNNativeSDK alloc] initWithDomain:configuration[@"attentiveDomain"] mode:configuration[@"mode"] skipFatigueOnCreatives:configuration[@"skipFatigueOnCreatives"]];
|
|
20
25
|
}
|
|
21
26
|
|
|
22
27
|
RCT_EXPORT_METHOD(triggerCreative) {
|
|
28
|
+
[self triggerCreative:nil];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
RCT_EXPORT_METHOD(triggerCreative:(NSString *)creativeId) {
|
|
23
32
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
24
33
|
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
|
|
25
34
|
UIView *topView = window.rootViewController.view;
|
|
26
|
-
[self->_sdk trigger:topView];
|
|
35
|
+
[self->_sdk trigger:topView creativeId:creativeId];
|
|
27
36
|
});
|
|
28
37
|
}
|
|
29
38
|
|
|
@@ -33,6 +42,10 @@ RCT_EXPORT_METHOD(destroyCreative) {
|
|
|
33
42
|
});
|
|
34
43
|
}
|
|
35
44
|
|
|
45
|
+
RCT_EXPORT_METHOD(updateDomain:(NSString *)domain) {
|
|
46
|
+
[_sdk updateDomain:domain];
|
|
47
|
+
}
|
|
48
|
+
|
|
36
49
|
RCT_EXPORT_METHOD(identify:(NSDictionary*)identifiers) {
|
|
37
50
|
// The dictionary already has the correct keys from the React code, so no translating necessary
|
|
38
51
|
[_sdk identify:identifiers];
|
|
@@ -43,40 +56,19 @@ RCT_EXPORT_METHOD(clearUser) {
|
|
|
43
56
|
}
|
|
44
57
|
|
|
45
58
|
RCT_EXPORT_METHOD(recordAddToCartEvent:(NSDictionary*)attrs) {
|
|
46
|
-
|
|
47
|
-
ATTNAddToCartEvent* event = [[ATTNAddToCartEvent alloc] initWithItems:items];
|
|
48
|
-
[[ATTNEventTracker sharedInstance] recordEvent:event];
|
|
59
|
+
[_sdk recordAddToCartEvent:attrs];
|
|
49
60
|
}
|
|
50
61
|
|
|
51
62
|
RCT_EXPORT_METHOD(recordProductViewEvent:(NSDictionary*)attrs) {
|
|
52
|
-
|
|
53
|
-
ATTNProductViewEvent* event = [[ATTNProductViewEvent alloc] initWithItems:items];
|
|
54
|
-
[[ATTNEventTracker sharedInstance] recordEvent:event];
|
|
63
|
+
[_sdk recordProductViewEvent:attrs];
|
|
55
64
|
}
|
|
56
65
|
|
|
57
66
|
RCT_EXPORT_METHOD(recordPurchaseEvent:(NSDictionary*)attrs) {
|
|
58
|
-
|
|
59
|
-
ATTNOrder* order = [[ATTNOrder alloc] initWithOrderId:attrs[@"order"][@"id"]];
|
|
60
|
-
ATTNPurchaseEvent* event = [[ATTNPurchaseEvent alloc] initWithItems:items order:order];
|
|
61
|
-
[[ATTNEventTracker sharedInstance] recordEvent:event];
|
|
67
|
+
[_sdk recordPurchaseEvent:attrs];
|
|
62
68
|
}
|
|
63
69
|
|
|
64
70
|
RCT_EXPORT_METHOD(recordCustomEvent:(NSDictionary*)attrs) {
|
|
65
|
-
|
|
66
|
-
[[ATTNEventTracker sharedInstance] recordEvent:customEvent];
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
- (NSArray*)parseItems:(NSArray*)rawItems {
|
|
70
|
-
NSMutableArray* itemsToReturn = [[NSMutableArray alloc] init];
|
|
71
|
-
for (NSDictionary* rawItem in rawItems) {
|
|
72
|
-
NSDictionary* rawPrice = rawItem[@"price"];
|
|
73
|
-
ATTNPrice* price = [[ATTNPrice alloc] initWithPrice:[[NSDecimalNumber alloc] initWithString:rawPrice[@"price"]] currency:rawPrice[@"currency"]];
|
|
74
|
-
|
|
75
|
-
ATTNItem* item = [[ATTNItem alloc] initWithProductId:rawItem[@"productId"] productVariantId:rawItem[@"productVariantId"] price:price];
|
|
76
|
-
|
|
77
|
-
[itemsToReturn addObject:item];
|
|
78
|
-
}
|
|
79
|
-
return itemsToReturn;
|
|
71
|
+
[_sdk recordCustomEvent:attrs];
|
|
80
72
|
}
|
|
81
73
|
|
|
82
74
|
// Don't compile this code when we build for the old architecture.
|
|
@@ -89,3 +81,4 @@ RCT_EXPORT_METHOD(recordCustomEvent:(NSDictionary*)attrs) {
|
|
|
89
81
|
#endif
|
|
90
82
|
|
|
91
83
|
@end
|
|
84
|
+
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
/* Begin PBXBuildFile section */
|
|
10
10
|
58F287A429D7860100C7DF09 /* AttentiveReactNativeSdk.mm in Sources */ = {isa = PBXBuildFile; fileRef = 58F2879D29D7860000C7DF09 /* AttentiveReactNativeSdk.mm */; };
|
|
11
|
+
FBED3EEA2C2F3F3900E7D5EB /* ATTNNativeSDK.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBED3EE92C2F3F3900E7D5EB /* ATTNNativeSDK.swift */; };
|
|
11
12
|
/* End PBXBuildFile section */
|
|
12
13
|
|
|
13
14
|
/* Begin PBXCopyFilesBuildPhase section */
|
|
@@ -27,6 +28,9 @@
|
|
|
27
28
|
58F2879C29D7860000C7DF09 /* attentive-sdk-umbrella.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "attentive-sdk-umbrella.h"; sourceTree = "<group>"; };
|
|
28
29
|
58F2879D29D7860000C7DF09 /* AttentiveReactNativeSdk.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AttentiveReactNativeSdk.mm; sourceTree = "<group>"; };
|
|
29
30
|
B3E7B5881CC2AC0600A0062D /* AttentiveReactNativeSdk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AttentiveReactNativeSdk.h; sourceTree = "<group>"; };
|
|
31
|
+
FBED3EE82C2F3F3900E7D5EB /* AttentiveReactNativeSdk-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AttentiveReactNativeSdk-Bridging-Header.h"; sourceTree = "<group>"; };
|
|
32
|
+
FBED3EE92C2F3F3900E7D5EB /* ATTNNativeSDK.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ATTNNativeSDK.swift; sourceTree = "<group>"; };
|
|
33
|
+
FBED3EEB2C2F413D00E7D5EB /* attentive-react-native-sdk.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; name = "attentive-react-native-sdk.podspec"; path = "../attentive-react-native-sdk.podspec"; sourceTree = "<group>"; };
|
|
30
34
|
/* End PBXFileReference section */
|
|
31
35
|
|
|
32
36
|
/* Begin PBXFrameworksBuildPhase section */
|
|
@@ -51,13 +55,32 @@
|
|
|
51
55
|
58B511D21A9E6C8500147676 = {
|
|
52
56
|
isa = PBXGroup;
|
|
53
57
|
children = (
|
|
58
|
+
FBED3EEB2C2F413D00E7D5EB /* attentive-react-native-sdk.podspec */,
|
|
59
|
+
FBED3EE72C2F3F1100E7D5EB /* Bridging */,
|
|
54
60
|
58F2879C29D7860000C7DF09 /* attentive-sdk-umbrella.h */,
|
|
55
61
|
B3E7B5881CC2AC0600A0062D /* AttentiveReactNativeSdk.h */,
|
|
56
62
|
58F2879D29D7860000C7DF09 /* AttentiveReactNativeSdk.mm */,
|
|
57
63
|
134814211AA4EA7D00B7C361 /* Products */,
|
|
64
|
+
5F65DBE5DB1751003CF3E431 /* Pods */,
|
|
58
65
|
);
|
|
59
66
|
sourceTree = "<group>";
|
|
60
67
|
};
|
|
68
|
+
5F65DBE5DB1751003CF3E431 /* Pods */ = {
|
|
69
|
+
isa = PBXGroup;
|
|
70
|
+
children = (
|
|
71
|
+
);
|
|
72
|
+
path = Pods;
|
|
73
|
+
sourceTree = "<group>";
|
|
74
|
+
};
|
|
75
|
+
FBED3EE72C2F3F1100E7D5EB /* Bridging */ = {
|
|
76
|
+
isa = PBXGroup;
|
|
77
|
+
children = (
|
|
78
|
+
FBED3EE92C2F3F3900E7D5EB /* ATTNNativeSDK.swift */,
|
|
79
|
+
FBED3EE82C2F3F3900E7D5EB /* AttentiveReactNativeSdk-Bridging-Header.h */,
|
|
80
|
+
);
|
|
81
|
+
path = Bridging;
|
|
82
|
+
sourceTree = "<group>";
|
|
83
|
+
};
|
|
61
84
|
/* End PBXGroup section */
|
|
62
85
|
|
|
63
86
|
/* Begin PBXNativeTarget section */
|
|
@@ -89,6 +112,7 @@
|
|
|
89
112
|
TargetAttributes = {
|
|
90
113
|
58B511DA1A9E6C8500147676 = {
|
|
91
114
|
CreatedOnToolsVersion = 6.1.1;
|
|
115
|
+
LastSwiftMigration = 1540;
|
|
92
116
|
};
|
|
93
117
|
};
|
|
94
118
|
};
|
|
@@ -115,6 +139,7 @@
|
|
|
115
139
|
isa = PBXSourcesBuildPhase;
|
|
116
140
|
buildActionMask = 2147483647;
|
|
117
141
|
files = (
|
|
142
|
+
FBED3EEA2C2F3F3900E7D5EB /* ATTNNativeSDK.swift in Sources */,
|
|
118
143
|
58F287A429D7860100C7DF09 /* AttentiveReactNativeSdk.mm in Sources */,
|
|
119
144
|
);
|
|
120
145
|
runOnlyForDeploymentPostprocessing = 0;
|
|
@@ -126,7 +151,7 @@
|
|
|
126
151
|
isa = XCBuildConfiguration;
|
|
127
152
|
buildSettings = {
|
|
128
153
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
129
|
-
CLANG_CXX_LANGUAGE_STANDARD = "
|
|
154
|
+
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
|
130
155
|
CLANG_CXX_LIBRARY = "libc++";
|
|
131
156
|
CLANG_ENABLE_MODULES = YES;
|
|
132
157
|
CLANG_ENABLE_OBJC_ARC = YES;
|
|
@@ -151,6 +176,7 @@
|
|
|
151
176
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
152
177
|
ENABLE_TESTABILITY = YES;
|
|
153
178
|
"EXCLUDED_ARCHS[sdk=*]" = arm64;
|
|
179
|
+
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
|
|
154
180
|
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
155
181
|
GCC_DYNAMIC_NO_PIC = NO;
|
|
156
182
|
GCC_NO_COMMON_BLOCKS = YES;
|
|
@@ -158,6 +184,7 @@
|
|
|
158
184
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
|
159
185
|
"DEBUG=1",
|
|
160
186
|
"$(inherited)",
|
|
187
|
+
_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION,
|
|
161
188
|
);
|
|
162
189
|
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
|
163
190
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
@@ -169,6 +196,11 @@
|
|
|
169
196
|
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
|
170
197
|
MTL_ENABLE_DEBUG_INFO = YES;
|
|
171
198
|
ONLY_ACTIVE_ARCH = YES;
|
|
199
|
+
OTHER_LDFLAGS = (
|
|
200
|
+
"$(inherited)",
|
|
201
|
+
" ",
|
|
202
|
+
);
|
|
203
|
+
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
|
|
172
204
|
SDKROOT = iphoneos;
|
|
173
205
|
};
|
|
174
206
|
name = Debug;
|
|
@@ -177,7 +209,7 @@
|
|
|
177
209
|
isa = XCBuildConfiguration;
|
|
178
210
|
buildSettings = {
|
|
179
211
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
180
|
-
CLANG_CXX_LANGUAGE_STANDARD = "
|
|
212
|
+
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
|
181
213
|
CLANG_CXX_LIBRARY = "libc++";
|
|
182
214
|
CLANG_ENABLE_MODULES = YES;
|
|
183
215
|
CLANG_ENABLE_OBJC_ARC = YES;
|
|
@@ -202,8 +234,13 @@
|
|
|
202
234
|
ENABLE_NS_ASSERTIONS = NO;
|
|
203
235
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
204
236
|
"EXCLUDED_ARCHS[sdk=*]" = arm64;
|
|
237
|
+
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
|
|
205
238
|
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
206
239
|
GCC_NO_COMMON_BLOCKS = YES;
|
|
240
|
+
GCC_PREPROCESSOR_DEFINITIONS = (
|
|
241
|
+
"$(inherited)",
|
|
242
|
+
_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION,
|
|
243
|
+
);
|
|
207
244
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
208
245
|
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
209
246
|
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
@@ -212,6 +249,11 @@
|
|
|
212
249
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
213
250
|
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
|
214
251
|
MTL_ENABLE_DEBUG_INFO = NO;
|
|
252
|
+
OTHER_LDFLAGS = (
|
|
253
|
+
"$(inherited)",
|
|
254
|
+
" ",
|
|
255
|
+
);
|
|
256
|
+
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
|
|
215
257
|
SDKROOT = iphoneos;
|
|
216
258
|
VALIDATE_PRODUCT = YES;
|
|
217
259
|
};
|
|
@@ -220,32 +262,45 @@
|
|
|
220
262
|
58B511F01A9E6C8500147676 /* Debug */ = {
|
|
221
263
|
isa = XCBuildConfiguration;
|
|
222
264
|
buildSettings = {
|
|
265
|
+
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
|
266
|
+
CLANG_ENABLE_MODULES = YES;
|
|
267
|
+
DEFINES_MODULE = YES;
|
|
223
268
|
HEADER_SEARCH_PATHS = (
|
|
224
269
|
"$(inherited)",
|
|
225
270
|
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
226
271
|
"$(SRCROOT)/../../../React/**",
|
|
227
272
|
"$(SRCROOT)/../../react-native/React/**",
|
|
228
273
|
);
|
|
229
|
-
|
|
274
|
+
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
|
275
|
+
LIBRARY_SEARCH_PATHS = "$(SDKROOT)/usr/lib/swift$(inherited)";
|
|
230
276
|
OTHER_LDFLAGS = "-ObjC";
|
|
231
277
|
PRODUCT_NAME = AttentiveReactNativeSdk;
|
|
232
278
|
SKIP_INSTALL = YES;
|
|
279
|
+
SWIFT_OBJC_BRIDGING_HEADER = "Bridging/AttentiveReactNativeSdk-Bridging-Header.h";
|
|
280
|
+
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
|
281
|
+
SWIFT_VERSION = 5.0;
|
|
233
282
|
};
|
|
234
283
|
name = Debug;
|
|
235
284
|
};
|
|
236
285
|
58B511F11A9E6C8500147676 /* Release */ = {
|
|
237
286
|
isa = XCBuildConfiguration;
|
|
238
287
|
buildSettings = {
|
|
288
|
+
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
|
289
|
+
CLANG_ENABLE_MODULES = YES;
|
|
290
|
+
DEFINES_MODULE = YES;
|
|
239
291
|
HEADER_SEARCH_PATHS = (
|
|
240
292
|
"$(inherited)",
|
|
241
293
|
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
242
294
|
"$(SRCROOT)/../../../React/**",
|
|
243
295
|
"$(SRCROOT)/../../react-native/React/**",
|
|
244
296
|
);
|
|
245
|
-
|
|
297
|
+
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
|
298
|
+
LIBRARY_SEARCH_PATHS = "$(SDKROOT)/usr/lib/swift$(inherited)";
|
|
246
299
|
OTHER_LDFLAGS = "-ObjC";
|
|
247
300
|
PRODUCT_NAME = AttentiveReactNativeSdk;
|
|
248
301
|
SKIP_INSTALL = YES;
|
|
302
|
+
SWIFT_OBJC_BRIDGING_HEADER = "Bridging/AttentiveReactNativeSdk-Bridging-Header.h";
|
|
303
|
+
SWIFT_VERSION = 5.0;
|
|
249
304
|
};
|
|
250
305
|
name = Release;
|
|
251
306
|
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
//
|
|
2
|
+
// ATTNNativeSDK.swift
|
|
3
|
+
// AttentiveReactNativeSdk
|
|
4
|
+
//
|
|
5
|
+
// Created by Vladimir - Work on 2024-06-28.
|
|
6
|
+
// Copyright © 2024 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
import Foundation
|
|
10
|
+
import attentive_ios_sdk
|
|
11
|
+
|
|
12
|
+
@objc public class ATTNNativeSDK: NSObject {
|
|
13
|
+
private let sdk: ATTNSDK
|
|
14
|
+
|
|
15
|
+
@objc(initWithDomain:mode:skipFatigueOnCreatives:)
|
|
16
|
+
public init(domain: String, mode: String, skipFatigueOnCreatives: Bool) {
|
|
17
|
+
self.sdk = ATTNSDK(domain: domain, mode: ATTNSDKMode(rawValue: mode) ?? .production)
|
|
18
|
+
self.sdk.skipFatigueOnCreative = skipFatigueOnCreatives ?? false
|
|
19
|
+
ATTNEventTracker.setup(with: sdk)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@objc(trigger:)
|
|
23
|
+
public func trigger(_ view: UIView) {
|
|
24
|
+
sdk.trigger(view)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@objc(trigger:creativeId:)
|
|
28
|
+
public func trigger(_ view: UIView, creativeId: String) {
|
|
29
|
+
sdk.trigger(view, creativeId:creativeId)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@objc(updateDomain:)
|
|
33
|
+
public func updateDomain(domain: String) {
|
|
34
|
+
sdk.update(domain:domain)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@objc(identify:)
|
|
38
|
+
public func identify(_ identifiers: [String: Any]) {
|
|
39
|
+
sdk.identify(identifiers)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@objc
|
|
43
|
+
public func clearUser() {
|
|
44
|
+
sdk.clearUser()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public extension ATTNNativeSDK {
|
|
49
|
+
@objc
|
|
50
|
+
func recordAddToCartEvent(_ attributes: [String: Any]) {
|
|
51
|
+
let items = parseItems(attributes["items"] as? [[String : Any]] ?? [])
|
|
52
|
+
let deeplink = attributes["deeplink"] as? String ?? ""
|
|
53
|
+
let event = ATTNAddToCartEvent(items: items, deeplink: deeplink)
|
|
54
|
+
ATTNEventTracker.sharedInstance()?.record(event: event)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@objc
|
|
58
|
+
func recordProductViewEvent(_ attributes: [String: Any]) {
|
|
59
|
+
let items = parseItems(attributes["items"] as? [[String : Any]] ?? [])
|
|
60
|
+
let deeplink = attributes["deeplink"] as? String ?? ""
|
|
61
|
+
let event = ATTNProductViewEvent(items: items, deeplink: deeplink)
|
|
62
|
+
ATTNEventTracker.sharedInstance()?.record(event: event)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@objc
|
|
66
|
+
func recordPurchaseEvent(_ attributes: [String: Any]) {
|
|
67
|
+
let attrOrder = attributes["order"] as? [String: String] ?? [:]
|
|
68
|
+
guard let orderId = attrOrder["id"] else { return }
|
|
69
|
+
let order = ATTNOrder(orderId: orderId)
|
|
70
|
+
let items = parseItems(attributes["items"] as? [[String : Any]] ?? [])
|
|
71
|
+
let event = ATTNPurchaseEvent(items: items, order: order)
|
|
72
|
+
ATTNEventTracker.sharedInstance()?.record(event: event)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@objc
|
|
76
|
+
func recordCustomEvent(_ attributes: [String: Any]) {
|
|
77
|
+
let type = attributes["type"] as? String ?? ""
|
|
78
|
+
let properties = attributes["properties"] as? [String: String] ?? [:]
|
|
79
|
+
guard let customEvent = ATTNCustomEvent(type: type, properties: properties) else { return }
|
|
80
|
+
ATTNEventTracker.sharedInstance()?.record(event: customEvent)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
private extension ATTNNativeSDK {
|
|
85
|
+
func parseItems(_ rawItems: [[String: Any]]) -> [ATTNItem] {
|
|
86
|
+
var itemsToReturn: [ATTNItem] = []
|
|
87
|
+
|
|
88
|
+
for rawItem in rawItems {
|
|
89
|
+
if let rawPrice = rawItem["price"] as? [String: Any],
|
|
90
|
+
let priceString = rawPrice["price"] as? String,
|
|
91
|
+
let currency = rawPrice["currency"] as? String {
|
|
92
|
+
|
|
93
|
+
let price = NSDecimalNumber(string: priceString)
|
|
94
|
+
|
|
95
|
+
let attnPrice = ATTNPrice(price: price, currency: currency)
|
|
96
|
+
|
|
97
|
+
if let productId = rawItem["productId"] as? String,
|
|
98
|
+
let productVariantId = rawItem["productVariantId"] as? String {
|
|
99
|
+
|
|
100
|
+
let item = ATTNItem(productId: productId, productVariantId: productVariantId, price: attnPrice)
|
|
101
|
+
itemsToReturn.append(item)
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return itemsToReturn
|
|
107
|
+
}
|
|
108
|
+
}
|
package/ios/Podfile
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
require_relative '../node_modules/react-native/scripts/react_native_pods'
|
|
2
|
+
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
|
|
3
|
+
|
|
4
|
+
platform :ios, min_ios_version_supported
|
|
5
|
+
prepare_react_native_project!
|
|
6
|
+
|
|
7
|
+
# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
|
|
8
|
+
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
|
|
9
|
+
#
|
|
10
|
+
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
|
|
11
|
+
# ```js
|
|
12
|
+
# module.exports = {
|
|
13
|
+
# dependencies: {
|
|
14
|
+
# ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
|
|
15
|
+
# ```
|
|
16
|
+
flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
|
|
17
|
+
|
|
18
|
+
linkage = ENV['USE_FRAMEWORKS']
|
|
19
|
+
if linkage != nil
|
|
20
|
+
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
|
|
21
|
+
use_frameworks! :linkage => linkage.to_sym
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
target 'AttentiveReactNativeSdk' do
|
|
25
|
+
config = use_native_modules!
|
|
26
|
+
|
|
27
|
+
# Flags change depending on the env values.
|
|
28
|
+
flags = get_default_flags()
|
|
29
|
+
|
|
30
|
+
# Ensure Swift support
|
|
31
|
+
pod 'attentive-ios-sdk', '0.6.0'
|
|
32
|
+
|
|
33
|
+
use_react_native!(
|
|
34
|
+
:path => config[:reactNativePath],
|
|
35
|
+
# Hermes is now enabled by default. Disable by setting this flag to false.
|
|
36
|
+
# Upcoming versions of React Native may rely on get_default_flags(), but
|
|
37
|
+
# we make it explicit here to aid in the React Native upgrade process.
|
|
38
|
+
:hermes_enabled => flags[:hermes_enabled],
|
|
39
|
+
:fabric_enabled => flags[:fabric_enabled],
|
|
40
|
+
# Enables Flipper.
|
|
41
|
+
#
|
|
42
|
+
# Note that if you have use_frameworks! enabled, Flipper will not work and
|
|
43
|
+
# you should disable the next line.
|
|
44
|
+
:flipper_configuration => flipper_config,
|
|
45
|
+
# An absolute path to your application root.
|
|
46
|
+
:app_path => "#{Pod::Config.instance.installation_root}/.."
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
post_install do |installer|
|
|
50
|
+
react_native_post_install(
|
|
51
|
+
installer,
|
|
52
|
+
# Set `mac_catalyst_enabled` to `true` in order to apply patches
|
|
53
|
+
# necessary for Mac Catalyst builds
|
|
54
|
+
:mac_catalyst_enabled => false
|
|
55
|
+
)
|
|
56
|
+
__apply_Xcode_12_5_M1_post_install_workaround(installer)
|
|
57
|
+
end
|
|
58
|
+
end
|
package/lib/commonjs/index.js
CHANGED
|
@@ -31,11 +31,15 @@ class Attentive {
|
|
|
31
31
|
AttentiveReactNativeSdk.clearUser();
|
|
32
32
|
}
|
|
33
33
|
static triggerCreative() {
|
|
34
|
-
|
|
34
|
+
let creativeId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
35
|
+
AttentiveReactNativeSdk.triggerCreative(creativeId);
|
|
35
36
|
}
|
|
36
37
|
static destroyCreative() {
|
|
37
38
|
AttentiveReactNativeSdk.destroyCreative();
|
|
38
39
|
}
|
|
40
|
+
static updateDomain(domain) {
|
|
41
|
+
AttentiveReactNativeSdk.updateDomain(domain);
|
|
42
|
+
}
|
|
39
43
|
static recordProductViewEvent(productViewEvent) {
|
|
40
44
|
AttentiveReactNativeSdk.recordProductViewEvent(productViewEvent);
|
|
41
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","AttentiveReactNativeSdk","NativeModules","Proxy","get","Error","Mode","exports","Attentive","initialize","configuration","identify","userIdentifiers","clearUser","triggerCreative","destroyCreative","recordProductViewEvent","productViewEvent","recordAddToCartEvent","addToCartEvent","recordPurchaseEvent","purchaseEvent","recordCustomEvent","customEvent"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAQA,MAAMC,aAAa,GAChB,qFAAoF,GACrFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,uBAAuB,GAAGC,0BAAa,CAACD,uBAAuB,GACjEC,0BAAa,CAACD,uBAAuB,GACrC,IAAIE,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CAAC,CACF;AAAC,IAEMU,IAAI,0BAAJA,IAAI;EAAJA,IAAI;EAAJA,IAAI;EAAA,OAAJA,IAAI;AAAA;AAAAC,OAAA,CAAAD,IAAA,GAAAA,IAAA;
|
|
1
|
+
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","AttentiveReactNativeSdk","NativeModules","Proxy","get","Error","Mode","exports","Attentive","initialize","configuration","identify","userIdentifiers","clearUser","triggerCreative","creativeId","arguments","length","undefined","destroyCreative","updateDomain","domain","recordProductViewEvent","productViewEvent","recordAddToCartEvent","addToCartEvent","recordPurchaseEvent","purchaseEvent","recordCustomEvent","customEvent"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAQA,MAAMC,aAAa,GAChB,qFAAoF,GACrFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,uBAAuB,GAAGC,0BAAa,CAACD,uBAAuB,GACjEC,0BAAa,CAACD,uBAAuB,GACrC,IAAIE,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CAAC,CACF;AAAC,IAEMU,IAAI,0BAAJA,IAAI;EAAJA,IAAI;EAAJA,IAAI;EAAA,OAAJA,IAAI;AAAA;AAAAC,OAAA,CAAAD,IAAA,GAAAA,IAAA;AAoBT,MAAME,SAAS,CAAC;EACrB,OAAOC,UAAUA,CAACC,aAAqC,EAAQ;IAC7DT,uBAAuB,CAACQ,UAAU,CAACC,aAAa,CAAC;EACnD;EAEA,OAAOC,QAAQA,CAACC,eAAgC,EAAQ;IACtDX,uBAAuB,CAACU,QAAQ,CAACC,eAAe,CAAC;EACnD;EAEA,OAAOC,SAASA,CAAA,EAAS;IACvBZ,uBAAuB,CAACY,SAAS,EAAE;EACrC;EAEA,OAAOC,eAAeA,CAAA,EAAyC;IAAA,IAAxCC,UAAyB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;IACrDf,uBAAuB,CAACa,eAAe,CAACC,UAAU,CAAC;EACrD;EAEA,OAAOI,eAAeA,CAAA,EAAS;IAC7BlB,uBAAuB,CAACkB,eAAe,EAAE;EAC3C;EAEA,OAAOC,YAAYA,CAACC,MAAc,EAAQ;IACxCpB,uBAAuB,CAACmB,YAAY,CAACC,MAAM,CAAC;EAC9C;EAEA,OAAOC,sBAAsBA,CAACC,gBAAkC,EAAQ;IACtEtB,uBAAuB,CAACqB,sBAAsB,CAACC,gBAAgB,CAAC;EAClE;EAEA,OAAOC,oBAAoBA,CAACC,cAA8B,EAAQ;IAChExB,uBAAuB,CAACuB,oBAAoB,CAACC,cAAc,CAAC;EAC9D;EAEA,OAAOC,mBAAmBA,CAACC,aAA4B,EAAQ;IAC7D1B,uBAAuB,CAACyB,mBAAmB,CAACC,aAAa,CAAC;EAC5D;EAEA,OAAOC,iBAAiBA,CAACC,WAAwB,EAAQ;IACvD5B,uBAAuB,CAAC2B,iBAAiB,CAACC,WAAW,CAAC;EACxD;AACF;AAACtB,OAAA,CAAAC,SAAA,GAAAA,SAAA"}
|
package/lib/module/index.js
CHANGED
|
@@ -24,11 +24,15 @@ export class Attentive {
|
|
|
24
24
|
AttentiveReactNativeSdk.clearUser();
|
|
25
25
|
}
|
|
26
26
|
static triggerCreative() {
|
|
27
|
-
|
|
27
|
+
let creativeId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
28
|
+
AttentiveReactNativeSdk.triggerCreative(creativeId);
|
|
28
29
|
}
|
|
29
30
|
static destroyCreative() {
|
|
30
31
|
AttentiveReactNativeSdk.destroyCreative();
|
|
31
32
|
}
|
|
33
|
+
static updateDomain(domain) {
|
|
34
|
+
AttentiveReactNativeSdk.updateDomain(domain);
|
|
35
|
+
}
|
|
32
36
|
static recordProductViewEvent(productViewEvent) {
|
|
33
37
|
AttentiveReactNativeSdk.recordProductViewEvent(productViewEvent);
|
|
34
38
|
}
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","AttentiveReactNativeSdk","Proxy","get","Error","Mode","Attentive","initialize","configuration","identify","userIdentifiers","clearUser","triggerCreative","destroyCreative","recordProductViewEvent","productViewEvent","recordAddToCartEvent","addToCartEvent","recordPurchaseEvent","purchaseEvent","recordCustomEvent","customEvent"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAQtD,MAAMC,aAAa,GAChB,qFAAoF,GACrFD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,uBAAuB,GAAGN,aAAa,CAACM,uBAAuB,GACjEN,aAAa,CAACM,uBAAuB,GACrC,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CAAC,CACF;AAEL,WAAYQ,IAAI,0BAAJA,IAAI;EAAJA,IAAI;EAAJA,IAAI;EAAA,OAAJA,IAAI;AAAA;
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","AttentiveReactNativeSdk","Proxy","get","Error","Mode","Attentive","initialize","configuration","identify","userIdentifiers","clearUser","triggerCreative","creativeId","arguments","length","undefined","destroyCreative","updateDomain","domain","recordProductViewEvent","productViewEvent","recordAddToCartEvent","addToCartEvent","recordPurchaseEvent","purchaseEvent","recordCustomEvent","customEvent"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAQtD,MAAMC,aAAa,GAChB,qFAAoF,GACrFD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,uBAAuB,GAAGN,aAAa,CAACM,uBAAuB,GACjEN,aAAa,CAACM,uBAAuB,GACrC,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CAAC,CACF;AAEL,WAAYQ,IAAI,0BAAJA,IAAI;EAAJA,IAAI;EAAJA,IAAI;EAAA,OAAJA,IAAI;AAAA;AAoBhB,OAAO,MAAMC,SAAS,CAAC;EACrB,OAAOC,UAAUA,CAACC,aAAqC,EAAQ;IAC7DP,uBAAuB,CAACM,UAAU,CAACC,aAAa,CAAC;EACnD;EAEA,OAAOC,QAAQA,CAACC,eAAgC,EAAQ;IACtDT,uBAAuB,CAACQ,QAAQ,CAACC,eAAe,CAAC;EACnD;EAEA,OAAOC,SAASA,CAAA,EAAS;IACvBV,uBAAuB,CAACU,SAAS,EAAE;EACrC;EAEA,OAAOC,eAAeA,CAAA,EAAyC;IAAA,IAAxCC,UAAyB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;IACrDb,uBAAuB,CAACW,eAAe,CAACC,UAAU,CAAC;EACrD;EAEA,OAAOI,eAAeA,CAAA,EAAS;IAC7BhB,uBAAuB,CAACgB,eAAe,EAAE;EAC3C;EAEA,OAAOC,YAAYA,CAACC,MAAc,EAAQ;IACxClB,uBAAuB,CAACiB,YAAY,CAACC,MAAM,CAAC;EAC9C;EAEA,OAAOC,sBAAsBA,CAACC,gBAAkC,EAAQ;IACtEpB,uBAAuB,CAACmB,sBAAsB,CAACC,gBAAgB,CAAC;EAClE;EAEA,OAAOC,oBAAoBA,CAACC,cAA8B,EAAQ;IAChEtB,uBAAuB,CAACqB,oBAAoB,CAACC,cAAc,CAAC;EAC9D;EAEA,OAAOC,mBAAmBA,CAACC,aAA4B,EAAQ;IAC7DxB,uBAAuB,CAACuB,mBAAmB,CAACC,aAAa,CAAC;EAC5D;EAEA,OAAOC,iBAAiBA,CAACC,WAAwB,EAAQ;IACvD1B,uBAAuB,CAACyB,iBAAiB,CAACC,WAAW,CAAC;EACxD;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventTypes.d.ts","sourceRoot":"","sources":["../../src/eventTypes.tsx"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,IAAI,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"eventTypes.d.ts","sourceRoot":"","sources":["../../src/eventTypes.tsx"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,CAAC,EAAE,IAAI,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC,CAAC"}
|
|
@@ -6,6 +6,7 @@ export declare enum Mode {
|
|
|
6
6
|
export type AttentiveConfiguration = {
|
|
7
7
|
attentiveDomain: string;
|
|
8
8
|
mode: Mode;
|
|
9
|
+
skipFatigueOnCreatives?: boolean;
|
|
9
10
|
};
|
|
10
11
|
export type UserIdentifiers = {
|
|
11
12
|
phone?: string;
|
|
@@ -21,8 +22,9 @@ export declare class Attentive {
|
|
|
21
22
|
static initialize(configuration: AttentiveConfiguration): void;
|
|
22
23
|
static identify(userIdentifiers: UserIdentifiers): void;
|
|
23
24
|
static clearUser(): void;
|
|
24
|
-
static triggerCreative(): void;
|
|
25
|
+
static triggerCreative(creativeId?: string | null): void;
|
|
25
26
|
static destroyCreative(): void;
|
|
27
|
+
static updateDomain(domain: string): void;
|
|
26
28
|
static recordProductViewEvent(productViewEvent: ProductViewEvent): void;
|
|
27
29
|
static recordAddToCartEvent(addToCartEvent: AddToCartEvent): void;
|
|
28
30
|
static recordPurchaseEvent(purchaseEvent: PurchaseEvent): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,WAAW,EACZ,MAAM,cAAc,CAAC;AAmBtB,oBAAY,IAAI;IACd,UAAU,eAAe;IACzB,KAAK,UAAU;CAChB;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,WAAW,EACZ,MAAM,cAAc,CAAC;AAmBtB,oBAAY,IAAI;IACd,UAAU,eAAe;IACzB,KAAK,UAAU;CAChB;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,IAAI,CAAC;IACX,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CAC/C,CAAC;AAEF,qBAAa,SAAS;IACpB,MAAM,CAAC,UAAU,CAAC,aAAa,EAAE,sBAAsB,GAAG,IAAI;IAI9D,MAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,eAAe,GAAG,IAAI;IAIvD,MAAM,CAAC,SAAS,IAAI,IAAI;IAIxB,MAAM,CAAC,eAAe,CAAC,UAAU,GAAE,MAAM,GAAG,IAAW,GAAG,IAAI;IAI9D,MAAM,CAAC,eAAe,IAAI,IAAI;IAI9B,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAIzC,MAAM,CAAC,sBAAsB,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,IAAI;IAIvE,MAAM,CAAC,oBAAoB,CAAC,cAAc,EAAE,cAAc,GAAG,IAAI;IAIjE,MAAM,CAAC,mBAAmB,CAAC,aAAa,EAAE,aAAa,GAAG,IAAI;IAI9D,MAAM,CAAC,iBAAiB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;CAGzD;AAED,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@attentive-mobile/attentive-react-native-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "React Native Module for the Attentive SDK",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"!android/gradlew",
|
|
22
22
|
"!android/gradlew.bat",
|
|
23
23
|
"!android/local.properties",
|
|
24
|
+
"!android/github.properties",
|
|
24
25
|
"!**/__tests__",
|
|
25
26
|
"!**/__fixtures__",
|
|
26
27
|
"!**/__mocks__",
|
|
@@ -44,7 +45,9 @@
|
|
|
44
45
|
],
|
|
45
46
|
"repository": "https://github.com/attentive-mobile/attentive-react-native-sdk",
|
|
46
47
|
"author": "Attentive <epd-accounts+npm@attentivemobile.com> (https://www.attentive.com)",
|
|
47
|
-
"contributors": [
|
|
48
|
+
"contributors": [
|
|
49
|
+
"Wyatt Davis"
|
|
50
|
+
],
|
|
48
51
|
"license": "MIT",
|
|
49
52
|
"bugs": {
|
|
50
53
|
"url": "https://github.com/attentive-mobile/attentive-react-native-sdk/issues"
|
|
@@ -54,8 +57,8 @@
|
|
|
54
57
|
"registry": "https://registry.npmjs.org/"
|
|
55
58
|
},
|
|
56
59
|
"devDependencies": {
|
|
57
|
-
"@evilmartians/lefthook": "^1.2.2",
|
|
58
60
|
"@commitlint/config-conventional": "^17.0.2",
|
|
61
|
+
"@evilmartians/lefthook": "^1.2.2",
|
|
59
62
|
"@react-native-community/eslint-config": "^3.0.2",
|
|
60
63
|
"@release-it/conventional-changelog": "^5.0.0",
|
|
61
64
|
"@types/jest": "^28.1.2",
|
|
@@ -70,7 +73,7 @@
|
|
|
70
73
|
"pod-install": "^0.1.0",
|
|
71
74
|
"prettier": "^2.0.5",
|
|
72
75
|
"react": "18.2.0",
|
|
73
|
-
"react-native": "0.71.
|
|
76
|
+
"react-native": "0.71.19",
|
|
74
77
|
"react-native-builder-bob": "^0.20.4",
|
|
75
78
|
"release-it": "^15.0.0",
|
|
76
79
|
"typescript": "^4.5.2"
|
|
@@ -157,5 +160,8 @@
|
|
|
157
160
|
}
|
|
158
161
|
]
|
|
159
162
|
]
|
|
163
|
+
},
|
|
164
|
+
"dependencies": {
|
|
165
|
+
"@babel/runtime": "^7.27.0"
|
|
160
166
|
}
|
|
161
167
|
}
|
package/src/eventTypes.tsx
CHANGED
package/src/index.tsx
CHANGED
|
@@ -31,6 +31,7 @@ export enum Mode {
|
|
|
31
31
|
export type AttentiveConfiguration = {
|
|
32
32
|
attentiveDomain: string;
|
|
33
33
|
mode: Mode;
|
|
34
|
+
skipFatigueOnCreatives?: boolean;
|
|
34
35
|
};
|
|
35
36
|
|
|
36
37
|
export type UserIdentifiers = {
|
|
@@ -55,14 +56,18 @@ export class Attentive {
|
|
|
55
56
|
AttentiveReactNativeSdk.clearUser();
|
|
56
57
|
}
|
|
57
58
|
|
|
58
|
-
static triggerCreative(): void {
|
|
59
|
-
AttentiveReactNativeSdk.triggerCreative();
|
|
59
|
+
static triggerCreative(creativeId: string | null = null): void {
|
|
60
|
+
AttentiveReactNativeSdk.triggerCreative(creativeId);
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
static destroyCreative(): void {
|
|
63
64
|
AttentiveReactNativeSdk.destroyCreative();
|
|
64
65
|
}
|
|
65
66
|
|
|
67
|
+
static updateDomain(domain: string): void {
|
|
68
|
+
AttentiveReactNativeSdk.updateDomain(domain);
|
|
69
|
+
}
|
|
70
|
+
|
|
66
71
|
static recordProductViewEvent(productViewEvent: ProductViewEvent): void {
|
|
67
72
|
AttentiveReactNativeSdk.recordProductViewEvent(productViewEvent);
|
|
68
73
|
}
|
|
Binary file
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
-
<plist version="1.0">
|
|
4
|
-
<dict>
|
|
5
|
-
<key>SchemeUserState</key>
|
|
6
|
-
<dict>
|
|
7
|
-
<key>AttentiveReactNativeSdk.xcscheme_^#shared#^_</key>
|
|
8
|
-
<dict>
|
|
9
|
-
<key>orderHint</key>
|
|
10
|
-
<integer>0</integer>
|
|
11
|
-
</dict>
|
|
12
|
-
</dict>
|
|
13
|
-
<key>SuppressBuildableAutocreation</key>
|
|
14
|
-
<dict>
|
|
15
|
-
<key>58B511DA1A9E6C8500147676</key>
|
|
16
|
-
<dict>
|
|
17
|
-
<key>primary</key>
|
|
18
|
-
<true/>
|
|
19
|
-
</dict>
|
|
20
|
-
</dict>
|
|
21
|
-
</dict>
|
|
22
|
-
</plist>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// attentive-sdk-umbrella.h
|
|
3
|
-
// AttentiveReactNativeSdk
|
|
4
|
-
//
|
|
5
|
-
// Created by Wyatt Davis on 2/13/23.
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
#ifndef attentive_sdk_umbrella_h
|
|
9
|
-
#define attentive_sdk_umbrella_h
|
|
10
|
-
|
|
11
|
-
#import "ATTNSDK.h"
|
|
12
|
-
#import "ATTNUserIdentity.h"
|
|
13
|
-
#import "ATTNEventTracker.h"
|
|
14
|
-
#import "ATTNPurchaseEvent.h"
|
|
15
|
-
#import "ATTNAddToCartEvent.h"
|
|
16
|
-
#import "ATTNProductViewEvent.h"
|
|
17
|
-
#import "ATTNItem.h"
|
|
18
|
-
#import "ATTNPrice.h"
|
|
19
|
-
#import "ATTNOrder.h"
|
|
20
|
-
#import "ATTNCart.h"
|
|
21
|
-
#import "ATTNCustomEvent.h"
|
|
22
|
-
|
|
23
|
-
#endif /* attentive_sdk_umbrella_h */
|