@rollershop/capacitor-emarsys-sdk 1.0.0-beta.2 → 1.0.0-beta.3

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 CHANGED
@@ -39,6 +39,7 @@ This Plugin is used as a wrapper for the [Emarsys SDK](https://help.emarsys.com/
39
39
  - [trackTag(...)](#tracktag)
40
40
  - [trackCard(...)](#trackcard)
41
41
  - [trackPurchase(...)](#trackpurchase)
42
+ - [trackCustomEvent(...)](#trackcustomevent)
42
43
  - [recommendProducts(...)](#recommendproducts)
43
44
  - [trackRecommendationClick(...)](#trackrecommendationclick)
44
45
  - [fetchMessages()](#fetchmessages)
@@ -235,6 +236,7 @@ In order to track email link clicks that open the application directly with the
235
236
  * [`trackTag(...)`](#tracktag)
236
237
  * [`trackCard(...)`](#trackcard)
237
238
  * [`trackPurchase(...)`](#trackpurchase)
239
+ * [`trackCustomEvent(...)`](#trackcustomevent)
238
240
  * [`recommendProducts(...)`](#recommendproducts)
239
241
  * [`trackRecommendationClick(...)`](#trackrecommendationclick)
240
242
  * [`fetchMessages()`](#fetchmessages)
@@ -530,6 +532,19 @@ To report a purchase event you should call this method with the items purchased
530
532
  --------------------
531
533
 
532
534
 
535
+ ### trackCustomEvent(...)
536
+
537
+ ```typescript
538
+ trackCustomEvent(event: CustomEvent) => Promise<void>
539
+ ```
540
+
541
+ | Param | Type |
542
+ | ----------- | --------------------------------------------------- |
543
+ | **`event`** | <code><a href="#customevent">CustomEvent</a></code> |
544
+
545
+ --------------------
546
+
547
+
533
548
  ### recommendProducts(...)
534
549
 
535
550
  ```typescript
@@ -848,6 +863,14 @@ Remove all native listeners for this plugin.
848
863
  | **`orderId`** | <code>string</code> | 1.0.0 |
849
864
 
850
865
 
866
+ #### CustomEvent
867
+
868
+ | Prop | Type | Description | Since |
869
+ | ---------------- | --------------------------------------- | -------------------- | ----- |
870
+ | **`name`** | <code>string</code> | The eventName | 1.0.0 |
871
+ | **`attributes`** | <code>{ [key: string]: string; }</code> | The event attributes | 1.0.0 |
872
+
873
+
851
874
  #### RecommendedProducts
852
875
 
853
876
  | Prop | Type | Since |
package/dist/docs.json CHANGED
@@ -328,6 +328,24 @@
328
328
  ],
329
329
  "slug": "trackpurchase"
330
330
  },
331
+ {
332
+ "name": "trackCustomEvent",
333
+ "signature": "(event: CustomEvent) => Promise<void>",
334
+ "parameters": [
335
+ {
336
+ "name": "event",
337
+ "docs": "",
338
+ "type": "CustomEvent"
339
+ }
340
+ ],
341
+ "returns": "Promise<void>",
342
+ "tags": [],
343
+ "docs": "",
344
+ "complexTypes": [
345
+ "CustomEvent"
346
+ ],
347
+ "slug": "trackcustomevent"
348
+ },
331
349
  {
332
350
  "name": "recommendProducts",
333
351
  "signature": "(options: RecommendedProductOptions) => Promise<RecommendedProducts>",
@@ -825,6 +843,39 @@
825
843
  }
826
844
  ]
827
845
  },
846
+ {
847
+ "name": "CustomEvent",
848
+ "slug": "customevent",
849
+ "docs": "",
850
+ "tags": [],
851
+ "methods": [],
852
+ "properties": [
853
+ {
854
+ "name": "name",
855
+ "tags": [
856
+ {
857
+ "text": "1.0.0",
858
+ "name": "since"
859
+ }
860
+ ],
861
+ "docs": "The eventName",
862
+ "complexTypes": [],
863
+ "type": "string"
864
+ },
865
+ {
866
+ "name": "attributes",
867
+ "tags": [
868
+ {
869
+ "text": "1.0.0",
870
+ "name": "since"
871
+ }
872
+ ],
873
+ "docs": "The event attributes",
874
+ "complexTypes": [],
875
+ "type": "{ [key: string]: string; } | undefined"
876
+ }
877
+ ]
878
+ },
828
879
  {
829
880
  "name": "RecommendedProducts",
830
881
  "slug": "recommendedproducts",
@@ -2,7 +2,7 @@ import type { PluginListenerHandle } from '@capacitor/core';
2
2
  import type { ContactFieldId, PermissionStatus, SetAuthenticatedContactOptions, SetContactOptions } from './interfaces/base';
3
3
  import type { ApplicationCode, MerchantId } from './interfaces/config';
4
4
  import type { InboxTag } from './interfaces/inbox';
5
- import type { CardItems, Product, Purchase, RecommendedProductOptions, RecommendedProducts } from './interfaces/predict';
5
+ import type { CardItems, CustomEvent, Product, Purchase, RecommendedProductOptions, RecommendedProducts } from './interfaces/predict';
6
6
  import type { PushMessageEvent, SilentPushMessageInformation, TokenResult } from './interfaces/push';
7
7
  declare type ConsoleLogLevels = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'basic';
8
8
  declare module '@capacitor/cli' {
@@ -158,6 +158,7 @@ export interface EmarsysPlugin {
158
158
  * @since 1.0.0
159
159
  */
160
160
  trackPurchase(options: Purchase): Promise<void>;
161
+ trackCustomEvent(event: CustomEvent): Promise<void>;
161
162
  /**
162
163
  * With the Emarsys SDK you can ask for product recommendations based on different recommendation logics.
163
164
  *
@@ -21,6 +21,22 @@ export interface Purchase extends CardItems {
21
21
  */
22
22
  orderId: string;
23
23
  }
24
+ export interface CustomEvent {
25
+ /**
26
+ * The eventName
27
+ *
28
+ * @since 1.0.0
29
+ */
30
+ name: string;
31
+ /**
32
+ * The event attributes
33
+ *
34
+ * @since 1.0.0
35
+ */
36
+ attributes?: {
37
+ [key: string]: string;
38
+ };
39
+ }
24
40
  /**
25
41
  * Based on `searchTerm`
26
42
  */
@@ -21,6 +21,7 @@ CAP_PLUGIN(EmarsysPlugin, "Emarsys",
21
21
  CAP_PLUGIN_METHOD(trackTag, CAPPluginReturnPromise);
22
22
  CAP_PLUGIN_METHOD(trackCard, CAPPluginReturnPromise);
23
23
  CAP_PLUGIN_METHOD(trackPurchase, CAPPluginReturnPromise);
24
+ CAP_PLUGIN_METHOD(trackCustomEvent, CAPPluginReturnPromise);
24
25
  CAP_PLUGIN_METHOD(recommendProducts, CAPPluginReturnPromise);
25
26
  CAP_PLUGIN_METHOD(trackRecommendationClick, CAPPluginReturnPromise);
26
27
  CAP_PLUGIN_METHOD(fetchMessages, CAPPluginReturnPromise);
@@ -243,6 +243,24 @@ public class EmarsysPlugin: CAPPlugin {
243
243
  predictHandler.trackPurchase(call);
244
244
  }
245
245
 
246
+ // Custom Events
247
+
248
+ @objc func trackCustomEvent(_ call: CAPPluginCall) {
249
+ let eventAttributes = call.options["attributes"];
250
+
251
+ Emarsys.trackCustomEvent(eventName: call.getString("name")!, eventAttributes: eventAttributes as? [String : String]) {
252
+ error in
253
+ guard error == nil else {
254
+ call.reject(error!.localizedDescription)
255
+ return
256
+ }
257
+
258
+ call.resolve();
259
+ }
260
+ }
261
+
262
+ // Recommended Products
263
+
246
264
  @objc func recommendProducts(_ call: CAPPluginCall) {
247
265
  predictHandler.recommendProducts(call);
248
266
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rollershop/capacitor-emarsys-sdk",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.3",
4
4
  "description": "Capacitor Plugin that wraps the Emarsys SDK",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",