@rollershop/capacitor-emarsys-sdk 1.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +1076 -0
  2. package/RollershopCapacitorEmarsysSdk.podspec +18 -0
  3. package/android/build.gradle +58 -0
  4. package/android/src/main/AndroidManifest.xml +3 -0
  5. package/android/src/main/java/de/roller/emarsys/Emarsys.java +8 -0
  6. package/android/src/main/java/de/roller/emarsys/EmarsysPlugin.java +22 -0
  7. package/android/src/main/res/.gitkeep +0 -0
  8. package/dist/docs.json +1912 -0
  9. package/dist/esm/definitions.d.ts +266 -0
  10. package/dist/esm/definitions.js +3 -0
  11. package/dist/esm/definitions.js.map +1 -0
  12. package/dist/esm/index.d.ts +4 -0
  13. package/dist/esm/index.js +5 -0
  14. package/dist/esm/index.js.map +1 -0
  15. package/dist/esm/interfaces/base.d.ts +25 -0
  16. package/dist/esm/interfaces/base.js +2 -0
  17. package/dist/esm/interfaces/base.js.map +1 -0
  18. package/dist/esm/interfaces/config.d.ts +12 -0
  19. package/dist/esm/interfaces/config.js +2 -0
  20. package/dist/esm/interfaces/config.js.map +1 -0
  21. package/dist/esm/interfaces/inbox.d.ts +108 -0
  22. package/dist/esm/interfaces/inbox.js +2 -0
  23. package/dist/esm/interfaces/inbox.js.map +1 -0
  24. package/dist/esm/interfaces/predict.d.ts +297 -0
  25. package/dist/esm/interfaces/predict.js +2 -0
  26. package/dist/esm/interfaces/predict.js.map +1 -0
  27. package/dist/esm/interfaces/push.d.ts +25 -0
  28. package/dist/esm/interfaces/push.js +2 -0
  29. package/dist/esm/interfaces/push.js.map +1 -0
  30. package/dist/plugin.cjs.js +10 -0
  31. package/dist/plugin.cjs.js.map +1 -0
  32. package/dist/plugin.js +13 -0
  33. package/dist/plugin.js.map +1 -0
  34. package/ios/Plugin/EmarsysConfig.swift +51 -0
  35. package/ios/Plugin/EmarsysDelegate.swift +16 -0
  36. package/ios/Plugin/EmarsysInbox.swift +110 -0
  37. package/ios/Plugin/EmarsysPlugin.h +10 -0
  38. package/ios/Plugin/EmarsysPlugin.m +36 -0
  39. package/ios/Plugin/EmarsysPlugin.swift +335 -0
  40. package/ios/Plugin/EmarsysPredict.swift +195 -0
  41. package/ios/Plugin/EmarsysTypes.swift +18 -0
  42. package/ios/Plugin/Info.plist +24 -0
  43. package/package.json +102 -0
@@ -0,0 +1,335 @@
1
+ import Foundation
2
+ import Capacitor
3
+ import EmarsysSDK
4
+
5
+ @objc(EmarsysPlugin)
6
+ public class EmarsysPlugin: CAPPlugin {
7
+ private var predictHandler = EmarsysPredict();
8
+ private var inboxHandler = EmarsysInbox();
9
+ private var configHandler = EmarsysConfig();
10
+
11
+ private var savedRegisterCall: CAPPluginCall? = nil;
12
+ public var registered: Bool = false;
13
+ private var messageStack = [StackedMessage]();
14
+
15
+ override public func load() {
16
+ NotificationCenter.default.addObserver(self, selector: #selector(self.didRegisterWithToken(notification:)), name: .emarsysRegisterWithToken, object: nil)
17
+
18
+ NotificationCenter.default.addObserver(self, selector: #selector(self.didFailedToRegister(notification:)), name: .emarsysRegisterFailed, object: nil)
19
+
20
+ NotificationCenter.default.addObserver(self, selector: #selector(self.didReceiveRemoteNotification(notification:)), name: .emarsysReceivedRemoteNotification, object: nil)
21
+
22
+ let mobileEngageApplicationCode = self.getConfigValue("mobileEngageApplicationCode") as? String;
23
+ let merchantId = self.getConfigValue("merchantId") as? String;
24
+ let consoleLogLevels = self.getConfigValue("consoleLogLevels") as? [String];
25
+
26
+ let config = EMSConfig.make { builder in
27
+ if(mobileEngageApplicationCode != nil) {
28
+ builder.setMobileEngageApplicationCode(mobileEngageApplicationCode!)
29
+ }
30
+ if(merchantId != nil) {
31
+ builder.setMerchantId(merchantId!)
32
+ }
33
+ if(consoleLogLevels != nil && consoleLogLevels!.count > 0) {
34
+ var logs = [EMSLogLevelProtocol]();
35
+ consoleLogLevels?.forEach { log in
36
+ switch log {
37
+ case "trace":
38
+ logs.append(EMSLogLevel.trace);
39
+ case "debug":
40
+ logs.append(EMSLogLevel.debug);
41
+ case "info":
42
+ logs.append(EMSLogLevel.info);
43
+ case "warn":
44
+ logs.append(EMSLogLevel.warn);
45
+ case "error":
46
+ logs.append(EMSLogLevel.error);
47
+ case "basic":
48
+ logs.append(EMSLogLevel.basic);
49
+ default:
50
+ print("Unknown LogLevel: " + log)
51
+ }
52
+ }
53
+ builder.enableConsoleLogLevels(logs);
54
+ }
55
+ }
56
+
57
+ Emarsys.setup(config: config);
58
+
59
+ // Handle push
60
+ UNUserNotificationCenter.current().delegate = Emarsys.push
61
+
62
+ let eventHandler = { eventName, payload in
63
+ self.sendMessage(eventName: eventName, payload: payload);
64
+ };
65
+
66
+ Emarsys.push.notificationEventHandler = eventHandler;
67
+ Emarsys.push.silentMessageEventHandler = eventHandler;
68
+ Emarsys.inApp.eventHandler = eventHandler;
69
+ Emarsys.onEventAction.eventHandler = eventHandler;
70
+
71
+ Emarsys.push.silentMessageInformationBlock = {notificationInformation in
72
+ self.sendSilentMessageInformation(block: notificationInformation);
73
+ }
74
+ }
75
+
76
+ @objc func didRegisterWithToken(notification: NSNotification) {
77
+ Emarsys.push.setPushToken(notification.object as! Data)
78
+ if(self.savedRegisterCall != nil) {
79
+ let deviceToken = (notification.object as! Data).reduce("", {$0 + String(format: "%02X", $1)})
80
+ self.savedRegisterCall!.resolve(["token": deviceToken])
81
+ self.savedRegisterCall = nil;
82
+ }
83
+ self.registered = true;
84
+ self.sendStacked();
85
+ }
86
+
87
+ @objc public func didFailedToRegister(notification: NSNotification) {
88
+ if(self.savedRegisterCall == nil) {
89
+ return;
90
+ }
91
+ let error = notification.object as! Error
92
+ self.savedRegisterCall!.reject(error.localizedDescription)
93
+ self.savedRegisterCall = nil
94
+ }
95
+
96
+ @objc public func didReceiveRemoteNotification(notification: NSNotification) {
97
+ let userInfo = notification.userInfo!
98
+ let completionHandler = notification.object as! (UIBackgroundFetchResult) -> Void
99
+ Emarsys.push.trackMessageOpen(userInfo: userInfo);
100
+ Emarsys.push.handleMessage(userInfo: userInfo);
101
+ completionHandler(.newData);
102
+ }
103
+
104
+ @objc override public func requestPermissions(_ call: CAPPluginCall) {
105
+ UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { granted, error in
106
+ guard error == nil else {
107
+ call.reject(error!.localizedDescription)
108
+ return
109
+ }
110
+
111
+ var result: PushNotificationsPermissions = .denied
112
+
113
+ if granted {
114
+ result = .granted
115
+ }
116
+
117
+ call.resolve(["receive": result.rawValue])
118
+ }
119
+ }
120
+
121
+ @objc override public func checkPermissions(_ call: CAPPluginCall) {
122
+ UNUserNotificationCenter.current().getNotificationSettings { settings in
123
+ var result: PushNotificationsPermissions = .prompt
124
+
125
+ switch settings.authorizationStatus {
126
+ case .notDetermined:
127
+ result = .prompt
128
+ case .denied:
129
+ result = .denied
130
+ case .ephemeral, .authorized, .provisional:
131
+ result = .granted
132
+ @unknown default:
133
+ result = .prompt
134
+ }
135
+
136
+ call.resolve(["receive": result.rawValue])
137
+ }
138
+ }
139
+
140
+ @objc func register(_ call: CAPPluginCall) {
141
+ if(self.savedRegisterCall != nil) {
142
+ return
143
+ }
144
+ self.savedRegisterCall = call;
145
+ DispatchQueue.main.async {
146
+ UIApplication.shared.registerForRemoteNotifications()
147
+ }
148
+ }
149
+
150
+ @objc func setContact(_ call: CAPPluginCall) {
151
+ Emarsys.setContact(contactFieldId: call.getInt("contactFieldId")! as NSNumber, contactFieldValue: call.getString("contactFieldValue")!) { error in
152
+ guard error == nil else {
153
+ call.reject(error!.localizedDescription)
154
+ return
155
+ }
156
+
157
+ call.resolve();
158
+ }
159
+ }
160
+
161
+ @objc func setAuthenticatedContact(_ call: CAPPluginCall) {
162
+ Emarsys.setAuthenticatedContact(contactFieldId: call.getInt("contactFieldId")! as NSNumber, openIdToken: call.getString("openIdToken")!) { error in
163
+ guard error == nil else {
164
+ call.reject(error!.localizedDescription)
165
+ return
166
+ }
167
+
168
+ call.resolve();
169
+ }
170
+ }
171
+
172
+ @objc func clearContact(_ call: CAPPluginCall) {
173
+ Emarsys.clearContact { error in
174
+ guard error == nil else {
175
+ call.reject(error!.localizedDescription)
176
+ return
177
+ }
178
+
179
+ call.resolve();
180
+ }
181
+ }
182
+
183
+ @objc func getPushToken(_ call: CAPPluginCall) {
184
+ let deviceToken = Emarsys.push.pushToken()?.reduce("", {$0 + String(format: "%02X", $1)})
185
+ if(deviceToken != nil) {
186
+ self.registered = false;
187
+ call.resolve(["token": deviceToken!])
188
+ } else {
189
+ call.reject("PushToken not exists")
190
+ }
191
+ }
192
+
193
+ @objc func clearPushToken(_ call: CAPPluginCall) {
194
+ Emarsys.push.clearPushToken { error in
195
+ guard error == nil else {
196
+ call.reject(error!.localizedDescription)
197
+ return
198
+ }
199
+
200
+ call.resolve();
201
+ }
202
+ }
203
+
204
+ // In-App
205
+
206
+ @objc func pauseInApp(_ call: CAPPluginCall) {
207
+ Emarsys.inApp.pause();
208
+ call.resolve();
209
+ }
210
+
211
+ @objc func isInAppPaused(_ call: CAPPluginCall) {
212
+ call.resolve(["isPaused": Emarsys.inApp.isPaused()]);
213
+ }
214
+
215
+ @objc func resumeInApp(_ call: CAPPluginCall) {
216
+ Emarsys.inApp.resume();
217
+ call.resolve();
218
+ }
219
+
220
+ // Predict
221
+
222
+ @objc func trackItem(_ call: CAPPluginCall) {
223
+ predictHandler.trackItem(call);
224
+ }
225
+
226
+ @objc func trackCategory(_ call: CAPPluginCall) {
227
+ predictHandler.trackCategory(call);
228
+ }
229
+
230
+ @objc func trackSearch(_ call: CAPPluginCall) {
231
+ predictHandler.trackSearch(call);
232
+ }
233
+
234
+ @objc func trackTag(_ call: CAPPluginCall) {
235
+ predictHandler.trackTag(call);
236
+ }
237
+
238
+ @objc func trackCard(_ call: CAPPluginCall) {
239
+ predictHandler.trackCard(call);
240
+ }
241
+
242
+ @objc func trackPurchase(_ call: CAPPluginCall) {
243
+ predictHandler.trackPurchase(call);
244
+ }
245
+
246
+ @objc func recommendProducts(_ call: CAPPluginCall) {
247
+ predictHandler.recommendProducts(call);
248
+ }
249
+
250
+ @objc func trackRecommendationClick(_ call: CAPPluginCall) {
251
+ predictHandler.trackRecommendationClick(call);
252
+ }
253
+
254
+ // Inbox
255
+
256
+ @objc func fetchMessages(_ call: CAPPluginCall) {
257
+ inboxHandler.fetchMessages(call);
258
+ }
259
+
260
+ @objc func addTag(_ call: CAPPluginCall) {
261
+ inboxHandler.addTag(call);
262
+ }
263
+
264
+ @objc func removeTag(_ call: CAPPluginCall) {
265
+ inboxHandler.removeTag(call);
266
+ }
267
+
268
+ // Config
269
+
270
+ @objc func getApplicationCode(_ call: CAPPluginCall) {
271
+ configHandler.getApplicationCode(call);
272
+ }
273
+
274
+ @objc func setApplicationCode(_ call: CAPPluginCall) {
275
+ configHandler.setApplicationCode(call);
276
+ }
277
+
278
+ @objc func getMerchantId(_ call: CAPPluginCall) {
279
+ configHandler.getMerchantId(call);
280
+ }
281
+
282
+ @objc func setMerchantId(_ call: CAPPluginCall) {
283
+ configHandler.setMerchantId(call);
284
+ }
285
+
286
+ @objc func getContactFieldId(_ call: CAPPluginCall) {
287
+ configHandler.getContactFieldId(call);
288
+ }
289
+
290
+ @objc func getHardwareId(_ call: CAPPluginCall) {
291
+ configHandler.getHardwareId(call);
292
+ }
293
+
294
+ @objc func getLanguageCode(_ call: CAPPluginCall) {
295
+ configHandler.getLanguageCode(call);
296
+ }
297
+
298
+ @objc func getSdkVersion(_ call: CAPPluginCall) {
299
+ configHandler.getSdkVersion(call);
300
+ }
301
+
302
+ // Helper
303
+
304
+ private func sendMessage(eventName: String, payload: [String: Any]?) {
305
+ let data: [String: Any] = ["eventName": eventName, "data": payload ?? []];
306
+ self.send(eventName: "event", data: data);
307
+ }
308
+
309
+ private func sendSilentMessageInformation(block: EMSNotificationInformation) {
310
+ let data: [String: Any] = ["campaignId": block.campaignId];
311
+ self.send(eventName: "silentMessageInformation", data: data);
312
+ }
313
+
314
+ private func send(eventName: String, data: [String : Any]) {
315
+ if(self.registered) {
316
+ self.notifyListeners(eventName, data: data);
317
+ } else {
318
+ self.messageStack.append(StackedMessage(eventName: eventName, data: data));
319
+ }
320
+ }
321
+
322
+ private func sendStacked() {
323
+ if(self.messageStack.count > 0) {
324
+ for message in self.messageStack {
325
+ self.send(eventName: message.eventName, data: message.data);
326
+ }
327
+ self.messageStack.removeAll(); }
328
+ }
329
+ }
330
+
331
+ enum PushNotificationsPermissions: String {
332
+ case prompt
333
+ case denied
334
+ case granted
335
+ }
@@ -0,0 +1,195 @@
1
+ import Foundation
2
+ import Capacitor
3
+ import EmarsysSDK
4
+
5
+ public class EmarsysPredict {
6
+ public func trackItem(_ call: CAPPluginCall) {
7
+ Emarsys.predict.trackItem(itemId: call.getString("itemId")!)
8
+ call.resolve();
9
+ }
10
+
11
+ public func trackCategory(_ call: CAPPluginCall) {
12
+ Emarsys.predict.trackCategory(categoryPath: call.getString("categoryPath")!)
13
+ call.resolve();
14
+ }
15
+
16
+ public func trackSearch(_ call: CAPPluginCall) {
17
+ Emarsys.predict.trackSearch(searchTerm: call.getString("searchTerm")!)
18
+ call.resolve();
19
+ }
20
+
21
+ public func trackTag(_ call: CAPPluginCall) {
22
+ Emarsys.predict.trackTag(tag: call.getString("tag")!)
23
+ call.resolve();
24
+ }
25
+
26
+ public func trackCard(_ call: CAPPluginCall) {
27
+ Emarsys.predict.trackCart(items: self.formatCardItems(items: call.getArray("items", JSObject.self) ?? []));
28
+ call.resolve();
29
+ }
30
+
31
+ public func trackPurchase(_ call: CAPPluginCall) {
32
+ Emarsys.predict.trackPurchase(orderId: call.getString("orderId")!, items: self.formatCardItems(items: call.getArray("items", JSObject.self) ?? []));
33
+ call.resolve();
34
+ }
35
+
36
+ public func recommendProducts(_ call: CAPPluginCall) {
37
+ let emsLogic: EMSLogicProtocol;
38
+ let logic = call.getObject("logic")!;
39
+ let logicType = logic["type"] as! String;
40
+
41
+ switch logicType {
42
+ case "search":
43
+ emsLogic = EMSLogic.search(searchTerm: logic["value"] as? String);
44
+ case "cart":
45
+ emsLogic = EMSLogic.cart(cartItems: self.formatCardItems(items: logic["value"] as? [JSObject]));
46
+ case "related":
47
+ emsLogic = EMSLogic.related(itemId: logic["value"] as? String);
48
+ case "category":
49
+ emsLogic = EMSLogic.category(categoryPath: logic["value"] as? String);
50
+ case "also_bought":
51
+ emsLogic = EMSLogic.alsoBought(itemId: logic["value"] as? String);
52
+ case "popular":
53
+ emsLogic = EMSLogic.popular(categoryPath: logic["value"] as? String);
54
+ case "personal":
55
+ emsLogic = EMSLogic.personal(variants: logic["value"] as? [String]);
56
+ case "home":
57
+ emsLogic = EMSLogic.home(variants: logic["value"] as? [String]);
58
+ default:
59
+ call.reject("Unknwon logicType: " + logicType);
60
+ return;
61
+ }
62
+
63
+ var emsFiter: [EMSRecommendationFilterProtocol]?;
64
+ let filters = call.getArray("filter", JSObject.self) ?? [];
65
+ if(filters.count > 0) {
66
+ emsFiter = [EMSRecommendationFilterProtocol]();
67
+
68
+ filters.forEach { filter in
69
+ let filterType = filter["filterType"] as! String;
70
+ let comparatorType = filter["comparatorType"] as! String;
71
+ let field = filter["field"] as! String;
72
+ if(filterType == "include") {
73
+ switch comparatorType {
74
+ case "isValue":
75
+ emsFiter!.append(EMSRecommendationFilter.include(withField: field, isValue: filter["value"] as! String));
76
+ case "inValues":
77
+ emsFiter!.append(EMSRecommendationFilter.include(withField: field, inValues: filter["value"] as! [String]));
78
+ case "hasValue":
79
+ emsFiter!.append(EMSRecommendationFilter.include(withField: field, hasValue: filter["value"] as! String));
80
+ case "overlapsValues":
81
+ emsFiter!.append(EMSRecommendationFilter.include(withField: field, overlapsValues: filter["value"] as! [String]));
82
+ default:
83
+ call.reject("Unkown comparatorType: " + comparatorType);
84
+ return;
85
+ }
86
+ } else {
87
+ switch comparatorType {
88
+ case "isValue":
89
+ emsFiter!.append(EMSRecommendationFilter.excludeFilter(withField: field, isValue: filter["value"] as! String));
90
+ case "inValues":
91
+ emsFiter!.append(EMSRecommendationFilter.excludeFilter(withField: field, inValues: filter["value"] as! [String]));
92
+ case "hasValue":
93
+ emsFiter!.append(EMSRecommendationFilter.excludeFilter(withField: field, hasValue: filter["value"] as! String));
94
+ case "overlapsValues":
95
+ emsFiter!.append(EMSRecommendationFilter.excludeFilter(withField: field, overlapsValues: filter["value"] as! [String]));
96
+ default:
97
+ call.reject("Unkown comparatorType: " + comparatorType);
98
+ return;
99
+ }
100
+ }
101
+ }
102
+ }
103
+
104
+ let emsLimit = call.getInt("limit") as NSNumber?;
105
+
106
+ let emsAvailabilityZone = call.getString("availabilityZone");
107
+
108
+ Emarsys.predict.recommendProducts(logic: emsLogic, filters: emsFiter, limit: emsLimit, availabilityZone: emsAvailabilityZone) { products, error in
109
+ guard error == nil else {
110
+ call.reject(error!.localizedDescription)
111
+ return
112
+ }
113
+ call.resolve(self.formatProduct(products: products));
114
+ }
115
+ }
116
+
117
+ public func trackRecommendationClick(_ call: CAPPluginCall) {
118
+ let product: EMSProduct = EMSProduct();
119
+ // Having a look into the SDK itself only productId, feature and cohort are used here
120
+ product.setValue(call.getString("productId")!, forKey: "productId");
121
+ product.setValue(call.getString("feature")!, forKey: "feature");
122
+ product.setValue(call.getString("cohort")!, forKey: "cohort");
123
+
124
+ Emarsys.predict.trackRecommendationClick(product: product);
125
+ call.resolve();
126
+ }
127
+
128
+ private func formatCardItems(items: [JSObject]?) -> [EMSCartItem] {
129
+ var cardItems = [EMSCartItem]();
130
+ items?.forEach { item in
131
+ cardItems.append(EMSCartItem(itemId: item["itemId"] as? String, price: item["price"] as! Double, quantity: item["quantity"] as! Double))
132
+ }
133
+ return cardItems;
134
+ }
135
+
136
+ private func formatProduct(products: [EMSProductProtocol]?) -> PluginCallResultData {
137
+ var jsProducts = [JSObject]();
138
+
139
+ products?.forEach { product in
140
+ var jsProduct = JSObject.init(dictionaryLiteral:
141
+ ("productId", product.productId),
142
+ ("title", product.title),
143
+ ("linkUrl", product.linkUrl.absoluteString),
144
+ ("customFields", JSTypes.coerceDictionaryToJSObject(product.customFields )!
145
+ ),
146
+ ("feature", product.feature),
147
+ ("cohort", product.cohort)
148
+ );
149
+
150
+ if(product.imageUrl != nil) {
151
+ jsProduct["imageUrl"] = product.imageUrl!.absoluteString;
152
+ }
153
+ if(product.zoomImageUrl != nil) {
154
+ jsProduct["zoomImageUrl"] = product.zoomImageUrl!.absoluteString;
155
+ }
156
+ if(product.categoryPath != nil) {
157
+ jsProduct["categoryPath"] = product.categoryPath!;
158
+ }
159
+ if(product.available != nil) {
160
+ jsProduct["available"] = product.available!.intValue;
161
+ }
162
+ if(product.productDescription != nil) {
163
+ jsProduct["productDescription"] = product.productDescription!;
164
+ }
165
+ if(product.price != nil) {
166
+ jsProduct["price"] = product.price!.doubleValue;
167
+ }
168
+ if(product.msrp != nil) {
169
+ jsProduct["msrp"] = product.price!.intValue;
170
+ }
171
+ if(product.album != nil) {
172
+ jsProduct["album"] = product.album!;
173
+ }
174
+ if(product.actor != nil) {
175
+ jsProduct["actor"] = product.actor!;
176
+ }
177
+ if(product.artist != nil) {
178
+ jsProduct["artist"] = product.artist!;
179
+ }
180
+ if(product.author != nil) {
181
+ jsProduct["author"] = product.author!;
182
+ }
183
+ if(product.brand != nil) {
184
+ jsProduct["brand"] = product.brand!;
185
+ }
186
+ if(product.year != nil) {
187
+ jsProduct["year"] = product.year!.intValue;
188
+ }
189
+
190
+ jsProducts.append(jsProduct);
191
+ }
192
+
193
+ return ["products": jsProducts];
194
+ }
195
+ }
@@ -0,0 +1,18 @@
1
+ import Foundation
2
+
3
+ // swiftlint:disable identifier_name
4
+ extension Notification.Name {
5
+ public static let emarsysRegisterWithToken = Notification.Name(rawValue: "EmarsysRegisterWithToken")
6
+ public static let emarsysRegisterFailed = Notification.Name(rawValue: "EmarsysRegisterFailed")
7
+ public static let emarsysReceivedRemoteNotification = Notification.Name(rawValue: "EmarsysReceivedRemoteNotification")
8
+ }
9
+
10
+ class StackedMessage {
11
+ var eventName: String
12
+ var data: [String : Any]
13
+
14
+ init (eventName: String, data: [String : Any]) {
15
+ self.eventName = eventName;
16
+ self.data = data;
17
+ }
18
+ }
@@ -0,0 +1,24 @@
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>CFBundleDevelopmentRegion</key>
6
+ <string>$(DEVELOPMENT_LANGUAGE)</string>
7
+ <key>CFBundleExecutable</key>
8
+ <string>$(EXECUTABLE_NAME)</string>
9
+ <key>CFBundleIdentifier</key>
10
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11
+ <key>CFBundleInfoDictionaryVersion</key>
12
+ <string>6.0</string>
13
+ <key>CFBundleName</key>
14
+ <string>$(PRODUCT_NAME)</string>
15
+ <key>CFBundlePackageType</key>
16
+ <string>FMWK</string>
17
+ <key>CFBundleShortVersionString</key>
18
+ <string>1.0</string>
19
+ <key>CFBundleVersion</key>
20
+ <string>$(CURRENT_PROJECT_VERSION)</string>
21
+ <key>NSPrincipalClass</key>
22
+ <string></string>
23
+ </dict>
24
+ </plist>
package/package.json ADDED
@@ -0,0 +1,102 @@
1
+ {
2
+ "name": "@rollershop/capacitor-emarsys-sdk",
3
+ "version": "1.0.0-beta.1",
4
+ "description": "Capacitor Plugin that wraps the Emarsys SDK",
5
+ "main": "dist/plugin.cjs.js",
6
+ "module": "dist/esm/index.js",
7
+ "types": "dist/esm/index.d.ts",
8
+ "unpkg": "dist/plugin.js",
9
+ "files": [
10
+ "android/src/main/",
11
+ "android/build.gradle",
12
+ "dist/",
13
+ "ios/Plugin/",
14
+ "RollershopCapacitorEmarsysSdk.podspec"
15
+ ],
16
+ "author": "SimplifySolutions",
17
+ "license": "MIT",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/EinfachHans/capacitor-emarsys-sdk.git"
21
+ },
22
+ "bugs": {
23
+ "url": "https://github.com/EinfachHans/capacitor-emarsys-sdk/issues"
24
+ },
25
+ "keywords": [
26
+ "capacitor",
27
+ "plugin",
28
+ "native",
29
+ "push",
30
+ "notifications",
31
+ "emarsys",
32
+ "sdk"
33
+ ],
34
+ "scripts": {
35
+ "check:updates": "npm-check --skip-unused -u -E",
36
+ "verify": "npm run verify:ios && npm run verify:web",
37
+ "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin && cd ..",
38
+ "verify:android": "cd android && ./gradlew clean build test && cd ..",
39
+ "verify:web": "npm run build:without:docgen",
40
+ "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
41
+ "fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- autocorrect --format",
42
+ "eslint": "eslint . --ext ts",
43
+ "prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
44
+ "swiftlint": "node-swiftlint",
45
+ "docgen": "docgen --api EmarsysPlugin --output-readme README.md --output-json dist/docs.json && doctoc README.md --github --title '**Table of Content**' --maxlevel 3",
46
+ "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.js",
47
+ "build:without:docgen": "npm run clean && tsc && rollup -c rollup.config.js",
48
+ "clean": "rimraf ./dist",
49
+ "watch": "tsc --watch",
50
+ "prepublishOnly": "npm run build"
51
+ },
52
+ "devDependencies": {
53
+ "@capacitor/android": "^3.0.0",
54
+ "@capacitor/core": "^3.0.0",
55
+ "@capacitor/cli": "^3.0.0",
56
+ "@capacitor/docgen": "0.2.0",
57
+ "@capacitor/ios": "^3.0.0",
58
+ "@commitlint/config-conventional": "17.0.0",
59
+ "@ionic/eslint-config": "0.3.0",
60
+ "@ionic/prettier-config": "2.0.0",
61
+ "@ionic/swiftlint-config": "1.1.2",
62
+ "@saithodev/semantic-release-backmerge": "2.1.2",
63
+ "@semantic-release/changelog": "6.0.1",
64
+ "@semantic-release/exec": "6.0.3",
65
+ "@semantic-release/git": "10.0.1",
66
+ "@semantic-release/npm": "9.0.1",
67
+ "doctoc": "2.2.0",
68
+ "eslint": "8.15.0",
69
+ "@typescript-eslint/eslint-plugin": "5.25.0",
70
+ "@typescript-eslint/parser": "5.25.0",
71
+ "npm-check": "5.9.2",
72
+ "prettier": "2.6.2",
73
+ "prettier-plugin-java": "1.6.1",
74
+ "rimraf": "3.0.2",
75
+ "rollup": "2.73.0",
76
+ "semantic-release": "19.0.2",
77
+ "swiftlint": "1.0.1",
78
+ "typescript": "4.5.5"
79
+ },
80
+ "peerDependencies": {
81
+ "@capacitor/core": "3.0.0"
82
+ },
83
+ "prettier": "@ionic/prettier-config",
84
+ "swiftlint": "@ionic/swiftlint-config",
85
+ "eslintConfig": {
86
+ "env": {
87
+ "node": true
88
+ },
89
+ "extends": "@ionic/eslint-config/recommended"
90
+ },
91
+ "capacitor": {
92
+ "ios": {
93
+ "src": "ios"
94
+ },
95
+ "android": {
96
+ "src": "android"
97
+ }
98
+ },
99
+ "publishConfig": {
100
+ "access": "public"
101
+ }
102
+ }