@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
package/README.md ADDED
@@ -0,0 +1,1076 @@
1
+ # Capacitor Emarsys SDK
2
+
3
+ ![Maintenance](https://img.shields.io/maintenance/yes/2022)
4
+ [![npm](https://img.shields.io/npm/v/@rollershop/capacitor-emarsys-sdk)](https://www.npmjs.com/package/@rollershop/capacitor-emarsys-sdk)
5
+
6
+ This Plugin is used as a wrapper for the [Emarsys SDK](https://help.emarsys.com/hc/en-us).
7
+
8
+ It currently uses Version [`3.2.2`](https://github.com/emartech/ios-emarsys-sdk/releases/tag/3.2.2) of the SDK.
9
+
10
+ 👉🏼 **Note**: It only supports iOS at the moment
11
+
12
+ <!-- START doctoc generated TOC please keep comment here to allow auto update -->
13
+ <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
14
+ **Table of Content**
15
+
16
+ - [Install](#install)
17
+ - [Setup](#setup)
18
+ - [Initialize SDK](#initialize-sdk)
19
+ - [Examples](#examples)
20
+ - [iOS](#ios)
21
+ - [Android](#android)
22
+ - [Flow](#flow)
23
+ - [In-App](#in-app)
24
+ - [Predict](#predict)
25
+ - [DeepLink](#deeplink)
26
+ - [API](#api)
27
+ - [checkPermissions()](#checkpermissions)
28
+ - [requestPermissions()](#requestpermissions)
29
+ - [register()](#register)
30
+ - [setContact(...)](#setcontact)
31
+ - [setAuthenticatedContact(...)](#setauthenticatedcontact)
32
+ - [clearContact()](#clearcontact)
33
+ - [getPushToken()](#getpushtoken)
34
+ - [clearPushToken()](#clearpushtoken)
35
+ - [pauseInApp()](#pauseinapp)
36
+ - [isInAppPaused()](#isinapppaused)
37
+ - [resumeInApp()](#resumeinapp)
38
+ - [trackItem(...)](#trackitem)
39
+ - [trackCategory(...)](#trackcategory)
40
+ - [trackSearch(...)](#tracksearch)
41
+ - [trackTag(...)](#tracktag)
42
+ - [trackCard(...)](#trackcard)
43
+ - [trackPurchase(...)](#trackpurchase)
44
+ - [recommendProducts(...)](#recommendproducts)
45
+ - [trackRecommendationClick(...)](#trackrecommendationclick)
46
+ - [fetchMessages()](#fetchmessages)
47
+ - [addTag(...)](#addtag)
48
+ - [removeTag(...)](#removetag)
49
+ - [getApplicationCode()](#getapplicationcode)
50
+ - [setApplicationCode(...)](#setapplicationcode)
51
+ - [getMerchantId()](#getmerchantid)
52
+ - [setMerchantId(...)](#setmerchantid)
53
+ - [getContactFieldId()](#getcontactfieldid)
54
+ - [getHardwareId()](#gethardwareid)
55
+ - [getLanguageCode()](#getlanguagecode)
56
+ - [getSdkVersion()](#getsdkversion)
57
+ - [addListener('pushMessageEvent', ...)](#addlistenerpushmessageevent-)
58
+ - [addListener('silentPushMessageInformation', ...)](#addlistenersilentpushmessageinformation-)
59
+ - [removeAllListeners()](#removealllisteners)
60
+ - [Interfaces](#interfaces)
61
+ - [Type Aliases](#type-aliases)
62
+ - [Changelog](#changelog)
63
+
64
+ <!-- END doctoc generated TOC please keep comment here to allow auto update -->
65
+
66
+ ## Install
67
+
68
+ ```bash
69
+ npm install @rollershop/capacitor-emarsys-sdk
70
+ npx cap sync
71
+ ```
72
+
73
+ ## Setup
74
+
75
+ ### Initialize SDK
76
+
77
+ <docgen-config>
78
+ <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
79
+
80
+ The following options are available to initialize the SDK:
81
+
82
+ | Prop | Type | Description | Since |
83
+ | --------------------------------- | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
84
+ | **`mobileEngageApplicationCode`** | <code>string</code> | Emarsys App code, which is generated when the app is added to the account. | 1.0.0 |
85
+ | **`merchantId`** | <code>string</code> | Emarsys Predict Merchant ID (If the Predict feature is enabled on the Emarsys account). | 1.0.0 |
86
+ | **`consoleLogLevels`** | <code>ConsoleLogLevels[]</code> | The default console logging is only showing logs when you call an unallowed method. You are able to modify the allowed loglevels for console logging, by setting it during the setup. | 1.0.0 |
87
+
88
+ ### Examples
89
+
90
+ In `capacitor.config.json`:
91
+
92
+ ```json
93
+ {
94
+ "plugins": {
95
+ "Emarsys": {
96
+ "mobileEngageApplicationCode": 'yourApplicationCode',
97
+ "merchantId": 'yourMerchantId',
98
+ "consoleLogLevels": ['info', 'debug', '...']
99
+ }
100
+ }
101
+ }
102
+ ```
103
+
104
+ In `capacitor.config.ts`:
105
+
106
+ ```ts
107
+ /// <reference types="@capacitor/emarsys" />
108
+
109
+ import { CapacitorConfig } from '@capacitor/cli';
110
+
111
+ const config: CapacitorConfig = {
112
+ plugins: {
113
+ Emarsys: {
114
+ mobileEngageApplicationCode: 'yourApplicationCode',
115
+ merchantId: 'yourMerchantId',
116
+ consoleLogLevels: ['info', 'debug', '...'],
117
+ },
118
+ },
119
+ };
120
+
121
+ export default config;
122
+ ```
123
+
124
+ </docgen-config>
125
+
126
+ ### iOS
127
+
128
+ The following changes needs to be done in `AppDelegate.swift`:
129
+
130
+ 1. Add import: `import RollershopCapacitorEmarsysSdk`
131
+ 2. Extend the base class:
132
+
133
+ ```swift
134
+ class AppDelegate: EmarsysDelegate {
135
+ ...
136
+ ```
137
+
138
+ #### Rich Push Notifications
139
+
140
+ Push notification could show media content and action buttons besides the title and body. Push notifications with these types of contents are called Rich Notifications.
141
+
142
+ **Setup**:
143
+
144
+ 1. Add a new Notification Service Extension target to your project
145
+ - [Guide](https://developer.apple.com/documentation/usernotifications/modifying_content_in_newly_delivered_notifications)
146
+ - Name: `NotificationService`
147
+ - Language: `swift`
148
+ - If Xcode ask's you tu change the scheme, deny it
149
+ 2. Navigate to your App's main `Podfile` and add at the bottom of the file:
150
+ ```
151
+ target "NotificationService" do
152
+ pod 'EmarsysNotificationService'
153
+ end
154
+ ```
155
+ 3. You may need to run `pod install` after it
156
+ 4. Open the `NotificationService.swift` and replace the content with:
157
+ ```swift
158
+ import EmarsysNotificationService
159
+
160
+ class NotificationService: EMSNotificationService {
161
+ }
162
+ ```
163
+
164
+ ### Android
165
+
166
+ Android is not supported at the moment...
167
+
168
+ ## Flow
169
+
170
+ You need to call `register` on **every** app start! This is required, because it could be that the push token has changed and because of the implemented queue. Stacked Messages are send after the `register` completes to make sure we receive events that were emitted while the app was killed.
171
+
172
+ Before the `register` call the listeners should be added.
173
+
174
+ Example of a `PushService.ts`:
175
+
176
+ ```ts
177
+ import { Emarsys } from '@rollershop/capacitor-emarsys-sdk';
178
+
179
+ public init() {
180
+ Emarsys.addListener('pushMessageEvent', message => {
181
+ // do something
182
+ });
183
+ // add other listeners
184
+
185
+ Emarsys.register().then(response => {
186
+ // do something with the token (if required)
187
+ });
188
+ }
189
+ ```
190
+
191
+ This `init()` function needs to be called on every app start. Remember that `requestPermissions()` also needs to be called (if not granted yet), so call that in a good moment as well.
192
+
193
+ ## In-App
194
+
195
+ Because this Plugin is for Capacitor, Inline In-App Messages can't work.
196
+
197
+ They work by being loaded into a specific view by an id. Because Capacitor works by only having one view with the webview which contains the sources of the inner "website", there are no views where a Inline In-App message could be load into.
198
+
199
+ ## Predict
200
+
201
+ To use the Predict functionality, you have to setup your merchantId during the initialization of the SDK.
202
+
203
+ At the current time Predict does not support authenticating users with Open ID Connect, identifying a contact with setAuthenticatedContact will disable the usage of Predict features!
204
+
205
+ ## DeepLink
206
+
207
+ In order to track email link clicks that open the application directly with the Emarsys SDK, read [here](https://github.com/emartech/ios-emarsys-sdk/wiki#5-deeplink).
208
+
209
+ ## API
210
+
211
+ <docgen-index>
212
+
213
+ * [`checkPermissions()`](#checkpermissions)
214
+ * [`requestPermissions()`](#requestpermissions)
215
+ * [`register()`](#register)
216
+ * [`setContact(...)`](#setcontact)
217
+ * [`setAuthenticatedContact(...)`](#setauthenticatedcontact)
218
+ * [`clearContact()`](#clearcontact)
219
+ * [`getPushToken()`](#getpushtoken)
220
+ * [`clearPushToken()`](#clearpushtoken)
221
+ * [`pauseInApp()`](#pauseinapp)
222
+ * [`isInAppPaused()`](#isinapppaused)
223
+ * [`resumeInApp()`](#resumeinapp)
224
+ * [`trackItem(...)`](#trackitem)
225
+ * [`trackCategory(...)`](#trackcategory)
226
+ * [`trackSearch(...)`](#tracksearch)
227
+ * [`trackTag(...)`](#tracktag)
228
+ * [`trackCard(...)`](#trackcard)
229
+ * [`trackPurchase(...)`](#trackpurchase)
230
+ * [`recommendProducts(...)`](#recommendproducts)
231
+ * [`trackRecommendationClick(...)`](#trackrecommendationclick)
232
+ * [`fetchMessages()`](#fetchmessages)
233
+ * [`addTag(...)`](#addtag)
234
+ * [`removeTag(...)`](#removetag)
235
+ * [`getApplicationCode()`](#getapplicationcode)
236
+ * [`setApplicationCode(...)`](#setapplicationcode)
237
+ * [`getMerchantId()`](#getmerchantid)
238
+ * [`setMerchantId(...)`](#setmerchantid)
239
+ * [`getContactFieldId()`](#getcontactfieldid)
240
+ * [`getHardwareId()`](#gethardwareid)
241
+ * [`getLanguageCode()`](#getlanguagecode)
242
+ * [`getSdkVersion()`](#getsdkversion)
243
+ * [`addListener('pushMessageEvent', ...)`](#addlistenerpushmessageevent)
244
+ * [`addListener('silentPushMessageInformation', ...)`](#addlistenersilentpushmessageinformation)
245
+ * [`removeAllListeners()`](#removealllisteners)
246
+ * [Interfaces](#interfaces)
247
+ * [Type Aliases](#type-aliases)
248
+
249
+ </docgen-index>
250
+
251
+ <docgen-api>
252
+ <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
253
+
254
+ ### checkPermissions()
255
+
256
+ ```typescript
257
+ checkPermissions() => Promise<PermissionStatus>
258
+ ```
259
+
260
+ Check permission to receive push notifications.
261
+
262
+ **Returns:** <code>Promise&lt;<a href="#permissionstatus">PermissionStatus</a>&gt;</code>
263
+
264
+ **Since:** 1.0.0
265
+
266
+ --------------------
267
+
268
+
269
+ ### requestPermissions()
270
+
271
+ ```typescript
272
+ requestPermissions() => Promise<PermissionStatus>
273
+ ```
274
+
275
+ Request permission to receive push notifications.
276
+
277
+ **Returns:** <code>Promise&lt;<a href="#permissionstatus">PermissionStatus</a>&gt;</code>
278
+
279
+ **Since:** 1.0.0
280
+
281
+ --------------------
282
+
283
+
284
+ ### register()
285
+
286
+ ```typescript
287
+ register() => Promise<TokenResult>
288
+ ```
289
+
290
+ Register the app to receive push notifications.
291
+
292
+ This method will resolve with the push token or reject if there was a problem. It does not prompt the user for notification permissions, use `requestPermissions()` first.
293
+
294
+ **Returns:** <code>Promise&lt;<a href="#tokenresult">TokenResult</a>&gt;</code>
295
+
296
+ **Since:** 1.0.0
297
+
298
+ --------------------
299
+
300
+
301
+ ### setContact(...)
302
+
303
+ ```typescript
304
+ setContact(options: SetContactOptions) => Promise<void>
305
+ ```
306
+
307
+ After application setup is finished, you can use this method to identify the user with `contactFieldValue`.
308
+
309
+ Without contact identification all tracked events will be linked to an anonymous contact in Mobile Engage and will rely on visitor cookies in case of Predict.
310
+
311
+ | Param | Type |
312
+ | ------------- | --------------------------------------------------------------- |
313
+ | **`options`** | <code><a href="#setcontactoptions">SetContactOptions</a></code> |
314
+
315
+ **Since:** 1.0.0
316
+
317
+ --------------------
318
+
319
+
320
+ ### setAuthenticatedContact(...)
321
+
322
+ ```typescript
323
+ setAuthenticatedContact(options: SetAuthenticatedContactOptions) => Promise<void>
324
+ ```
325
+
326
+ After the application setup is finished, you can use this method to identify the user with an `openIdToken`.
327
+
328
+ Without contact identification all tracked events will be linked to an anonymous contact in Mobile Engage and will rely on visitor cookies in case of Predict.
329
+
330
+ | Param | Type |
331
+ | ------------- | ----------------------------------------------------------------------------------------- |
332
+ | **`options`** | <code><a href="#setauthenticatedcontactoptions">SetAuthenticatedContactOptions</a></code> |
333
+
334
+ **Since:** 1.0.0
335
+
336
+ --------------------
337
+
338
+
339
+ ### clearContact()
340
+
341
+ ```typescript
342
+ clearContact() => Promise<void>
343
+ ```
344
+
345
+ When the user signs out, this method should be used.
346
+
347
+ You only need to call `clearContact` when you explicitly want to sign out the contact from Emarsys even if the user isn’t logged in into your application.
348
+
349
+ **Since:** 1.0.0
350
+
351
+ --------------------
352
+
353
+
354
+ ### getPushToken()
355
+
356
+ ```typescript
357
+ getPushToken() => Promise<TokenResult>
358
+ ```
359
+
360
+ Use this method to get the current push token.
361
+
362
+ **Returns:** <code>Promise&lt;<a href="#tokenresult">TokenResult</a>&gt;</code>
363
+
364
+ **Since:** 1.0.0
365
+
366
+ --------------------
367
+
368
+
369
+ ### clearPushToken()
370
+
371
+ ```typescript
372
+ clearPushToken() => Promise<void>
373
+ ```
374
+
375
+ Use this method to remove the push token of the contact.
376
+
377
+ **Since:** 1.0.0
378
+
379
+ --------------------
380
+
381
+
382
+ ### pauseInApp()
383
+
384
+ ```typescript
385
+ pauseInApp() => Promise<void>
386
+ ```
387
+
388
+ When a critical activity starts and should not be interrupted by In-App, pause In-App messages.
389
+
390
+ **Since:** 1.0.0
391
+
392
+ --------------------
393
+
394
+
395
+ ### isInAppPaused()
396
+
397
+ ```typescript
398
+ isInAppPaused() => Promise<{ isPaused: boolean; }>
399
+ ```
400
+
401
+ Use this method to check if in app messages are paused.
402
+
403
+ **Returns:** <code>Promise&lt;{ isPaused: boolean; }&gt;</code>
404
+
405
+ **Since:** 1.0.0
406
+
407
+ --------------------
408
+
409
+
410
+ ### resumeInApp()
411
+
412
+ ```typescript
413
+ resumeInApp() => Promise<void>
414
+ ```
415
+
416
+ In order to show In-App messages after being paused, use the resume method.
417
+
418
+ **Since:** 1.0.0
419
+
420
+ --------------------
421
+
422
+
423
+ ### trackItem(...)
424
+
425
+ ```typescript
426
+ trackItem(options: { itemId: string; }) => Promise<void>
427
+ ```
428
+
429
+ If an item was viewed use the `trackItemView` method with an itemId.
430
+
431
+ | Param | Type |
432
+ | ------------- | -------------------------------- |
433
+ | **`options`** | <code>{ itemId: string; }</code> |
434
+
435
+ **Since:** 1.0.0
436
+
437
+ --------------------
438
+
439
+
440
+ ### trackCategory(...)
441
+
442
+ ```typescript
443
+ trackCategory(options: { categoryPath: string; }) => Promise<void>
444
+ ```
445
+
446
+ When the user navigates between the categories you should call `trackCategoryView` in every navigation. Be aware to send `categoryPath` in the required format. Please visit [Predict's documentation](https://dev.emarsys.com/v2/web-extend-command-reference) for more information.
447
+
448
+ | Param | Type |
449
+ | ------------- | -------------------------------------- |
450
+ | **`options`** | <code>{ categoryPath: string; }</code> |
451
+
452
+ **Since:** 1.0.0
453
+
454
+ --------------------
455
+
456
+
457
+ ### trackSearch(...)
458
+
459
+ ```typescript
460
+ trackSearch(options: { searchTerm: string; }) => Promise<void>
461
+ ```
462
+
463
+ To report search terms entered by the contact use `trackSearchTerm` method.
464
+
465
+ | Param | Type |
466
+ | ------------- | ------------------------------------ |
467
+ | **`options`** | <code>{ searchTerm: string; }</code> |
468
+
469
+ **Since:** 1.0.0
470
+
471
+ --------------------
472
+
473
+
474
+ ### trackTag(...)
475
+
476
+ ```typescript
477
+ trackTag(options: { tag: string; }) => Promise<void>
478
+ ```
479
+
480
+ To report search terms entered by the contact use `trackSearchTerm` method.
481
+
482
+ | Param | Type |
483
+ | ------------- | ----------------------------- |
484
+ | **`options`** | <code>{ tag: string; }</code> |
485
+
486
+ **Since:** 1.0.0
487
+
488
+ --------------------
489
+
490
+
491
+ ### trackCard(...)
492
+
493
+ ```typescript
494
+ trackCard(options: CardItems) => Promise<void>
495
+ ```
496
+
497
+ When you want to track the cart items in the basket you can call this method with a list of CartItems.
498
+
499
+ | Param | Type |
500
+ | ------------- | ----------------------------------------------- |
501
+ | **`options`** | <code><a href="#carditems">CardItems</a></code> |
502
+
503
+ **Since:** 1.0.0
504
+
505
+ --------------------
506
+
507
+
508
+ ### trackPurchase(...)
509
+
510
+ ```typescript
511
+ trackPurchase(options: Purchase) => Promise<void>
512
+ ```
513
+
514
+ To report a purchase event you should call this method with the items purchased and with an `orderId`.
515
+
516
+ | Param | Type |
517
+ | ------------- | --------------------------------------------- |
518
+ | **`options`** | <code><a href="#purchase">Purchase</a></code> |
519
+
520
+ **Since:** 1.0.0
521
+
522
+ --------------------
523
+
524
+
525
+ ### recommendProducts(...)
526
+
527
+ ```typescript
528
+ recommendProducts(options: RecommendedProductOptions) => Promise<RecommendedProducts>
529
+ ```
530
+
531
+ With the Emarsys SDK you can ask for product recommendations based on different recommendation logics.
532
+
533
+ This method is also going to track the value attached to the logic on the backend, so no additional tracking needed when using recommendations!
534
+
535
+ | Param | Type |
536
+ | ------------- | ------------------------------------------------------------------------------- |
537
+ | **`options`** | <code><a href="#recommendedproductoptions">RecommendedProductOptions</a></code> |
538
+
539
+ **Returns:** <code>Promise&lt;<a href="#recommendedproducts">RecommendedProducts</a>&gt;</code>
540
+
541
+ **Since:** 1.0.0
542
+
543
+ --------------------
544
+
545
+
546
+ ### trackRecommendationClick(...)
547
+
548
+ ```typescript
549
+ trackRecommendationClick(product: Product) => Promise<void>
550
+ ```
551
+
552
+ The Emarsys SDK doesn't track automatically recommendationClicks, so you have to call manually `trackRecommendationClick` when an interaction happens with any of the recommended `products`.
553
+
554
+ | Param | Type |
555
+ | ------------- | ------------------------------------------- |
556
+ | **`product`** | <code><a href="#product">Product</a></code> |
557
+
558
+ **Since:** 1.0.0
559
+
560
+ --------------------
561
+
562
+
563
+ ### fetchMessages()
564
+
565
+ ```typescript
566
+ fetchMessages() => Promise<any>
567
+ ```
568
+
569
+ In order to receive the messageInbox content, you can use this method.
570
+
571
+ **Returns:** <code>Promise&lt;any&gt;</code>
572
+
573
+ **Since:** 1.0.0
574
+
575
+ --------------------
576
+
577
+
578
+ ### addTag(...)
579
+
580
+ ```typescript
581
+ addTag(options: InboxTag) => Promise<void>
582
+ ```
583
+
584
+ To label a message with a tag, you can use this method. (for example: "READ", "SEEN" etc)
585
+
586
+ | Param | Type |
587
+ | ------------- | --------------------------------------------- |
588
+ | **`options`** | <code><a href="#inboxtag">InboxTag</a></code> |
589
+
590
+ **Since:** 1.0.0
591
+
592
+ --------------------
593
+
594
+
595
+ ### removeTag(...)
596
+
597
+ ```typescript
598
+ removeTag(options: InboxTag) => Promise<void>
599
+ ```
600
+
601
+ To remove a label from a message, you can use this method.
602
+
603
+ | Param | Type |
604
+ | ------------- | --------------------------------------------- |
605
+ | **`options`** | <code><a href="#inboxtag">InboxTag</a></code> |
606
+
607
+ **Since:** 1.0.0
608
+
609
+ --------------------
610
+
611
+
612
+ ### getApplicationCode()
613
+
614
+ ```typescript
615
+ getApplicationCode() => Promise<ApplicationCode>
616
+ ```
617
+
618
+ Provides what is the actual `applicationCode` set in the SDK.
619
+
620
+ **Returns:** <code>Promise&lt;<a href="#applicationcode">ApplicationCode</a>&gt;</code>
621
+
622
+ **Since:** 1.0.0
623
+
624
+ --------------------
625
+
626
+
627
+ ### setApplicationCode(...)
628
+
629
+ ```typescript
630
+ setApplicationCode(options: ApplicationCode) => Promise<void>
631
+ ```
632
+
633
+ If any error occurs during the change process, the Mobile Engage feature will be turned off.
634
+
635
+ | Param | Type |
636
+ | ------------- | ----------------------------------------------------------- |
637
+ | **`options`** | <code><a href="#applicationcode">ApplicationCode</a></code> |
638
+
639
+ **Since:** 1.0.0
640
+
641
+ --------------------
642
+
643
+
644
+ ### getMerchantId()
645
+
646
+ ```typescript
647
+ getMerchantId() => Promise<MerchantId>
648
+ ```
649
+
650
+ Provides what is the actual `merchantId` set in the SDK.
651
+
652
+ **Returns:** <code>Promise&lt;<a href="#merchantid">MerchantId</a>&gt;</code>
653
+
654
+ **Since:** 1.0.0
655
+
656
+ --------------------
657
+
658
+
659
+ ### setMerchantId(...)
660
+
661
+ ```typescript
662
+ setMerchantId(options: MerchantId) => Promise<void>
663
+ ```
664
+
665
+ Change the actual `merchantId` that is set in the SDK.
666
+
667
+ | Param | Type |
668
+ | ------------- | ------------------------------------------------- |
669
+ | **`options`** | <code><a href="#merchantid">MerchantId</a></code> |
670
+
671
+ **Since:** 1.0.0
672
+
673
+ --------------------
674
+
675
+
676
+ ### getContactFieldId()
677
+
678
+ ```typescript
679
+ getContactFieldId() => Promise<ContactFieldId>
680
+ ```
681
+
682
+ Provides what is the actual `contactFieldId` set in the SDK.
683
+
684
+ **Returns:** <code>Promise&lt;<a href="#contactfieldid">ContactFieldId</a>&gt;</code>
685
+
686
+ **Since:** 1.0.0
687
+
688
+ --------------------
689
+
690
+
691
+ ### getHardwareId()
692
+
693
+ ```typescript
694
+ getHardwareId() => Promise<{ hardwareId: string; }>
695
+ ```
696
+
697
+ Provides what is the actual `hardwareId` set in the SDK.
698
+
699
+ **Returns:** <code>Promise&lt;{ hardwareId: string; }&gt;</code>
700
+
701
+ **Since:** 1.0.0
702
+
703
+ --------------------
704
+
705
+
706
+ ### getLanguageCode()
707
+
708
+ ```typescript
709
+ getLanguageCode() => Promise<{ languageCode: string; }>
710
+ ```
711
+
712
+ Provides what is the actual language of the application.
713
+
714
+ **Returns:** <code>Promise&lt;{ languageCode: string; }&gt;</code>
715
+
716
+ **Since:** 1.0.0
717
+
718
+ --------------------
719
+
720
+
721
+ ### getSdkVersion()
722
+
723
+ ```typescript
724
+ getSdkVersion() => Promise<{ sdkVersion: string; }>
725
+ ```
726
+
727
+ Provides the actual `sdkVersion`
728
+
729
+ **Returns:** <code>Promise&lt;{ sdkVersion: string; }&gt;</code>
730
+
731
+ **Since:** 1.0.0
732
+
733
+ --------------------
734
+
735
+
736
+ ### addListener('pushMessageEvent', ...)
737
+
738
+ ```typescript
739
+ addListener(eventName: 'pushMessageEvent', listenerFunc: (event: PushMessageEvent) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
740
+ ```
741
+
742
+ Called when a event is received
743
+
744
+ | Param | Type |
745
+ | ------------------ | --------------------------------------------------------------------------------- |
746
+ | **`eventName`** | <code>'pushMessageEvent'</code> |
747
+ | **`listenerFunc`** | <code>(event: <a href="#pushmessageevent">PushMessageEvent</a>) =&gt; void</code> |
748
+
749
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
750
+
751
+ **Since:** 1.0.0
752
+
753
+ --------------------
754
+
755
+
756
+ ### addListener('silentPushMessageInformation', ...)
757
+
758
+ ```typescript
759
+ addListener(eventName: 'silentPushMessageInformation', listenerFunc: (information: SilentPushMessageInformation) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
760
+ ```
761
+
762
+ Called when a silent push message is received
763
+
764
+ | Param | Type |
765
+ | ------------------ | --------------------------------------------------------------------------------------------------------------- |
766
+ | **`eventName`** | <code>'silentPushMessageInformation'</code> |
767
+ | **`listenerFunc`** | <code>(information: <a href="#silentpushmessageinformation">SilentPushMessageInformation</a>) =&gt; void</code> |
768
+
769
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
770
+
771
+ **Since:** 1.0.0
772
+
773
+ --------------------
774
+
775
+
776
+ ### removeAllListeners()
777
+
778
+ ```typescript
779
+ removeAllListeners() => Promise<void>
780
+ ```
781
+
782
+ Remove all native listeners for this plugin.
783
+
784
+ **Since:** 1.0.0
785
+
786
+ --------------------
787
+
788
+
789
+ ### Interfaces
790
+
791
+
792
+ #### PermissionStatus
793
+
794
+ | Prop | Type | Since |
795
+ | ------------- | ----------------------------------------------------------- | ----- |
796
+ | **`receive`** | <code><a href="#permissionstate">PermissionState</a></code> | 1.0.0 |
797
+
798
+
799
+ #### TokenResult
800
+
801
+ | Prop | Type | Since |
802
+ | ----------- | ------------------- | ----- |
803
+ | **`token`** | <code>string</code> | 1.0.0 |
804
+
805
+
806
+ #### SetContactOptions
807
+
808
+ | Prop | Type | Since |
809
+ | ----------------------- | ------------------- | ----- |
810
+ | **`contactFieldValue`** | <code>string</code> | 1.0.0 |
811
+
812
+
813
+ #### SetAuthenticatedContactOptions
814
+
815
+ | Prop | Type | Since |
816
+ | ----------------- | ------------------- | ----- |
817
+ | **`openIdToken`** | <code>string</code> | 1.0.0 |
818
+
819
+
820
+ #### CardItems
821
+
822
+ | Prop | Type |
823
+ | ----------- | ----------------------- |
824
+ | **`items`** | <code>CardItem[]</code> |
825
+
826
+
827
+ #### CardItem
828
+
829
+ | Prop | Type | Since |
830
+ | -------------- | ------------------- | ----- |
831
+ | **`itemId`** | <code>string</code> | 1.0.0 |
832
+ | **`price`** | <code>number</code> | 1.0.0 |
833
+ | **`quantity`** | <code>number</code> | 1.0.0 |
834
+
835
+
836
+ #### Purchase
837
+
838
+ | Prop | Type | Since |
839
+ | ------------- | ------------------- | ----- |
840
+ | **`orderId`** | <code>string</code> | 1.0.0 |
841
+
842
+
843
+ #### RecommendedProducts
844
+
845
+ | Prop | Type | Since |
846
+ | -------------- | ---------------------- | ----- |
847
+ | **`products`** | <code>Product[]</code> | 1.0.0 |
848
+
849
+
850
+ #### Product
851
+
852
+ | Prop | Type | Since |
853
+ | ------------------------ | ------------------------------------ | ----- |
854
+ | **`productId`** | <code>string</code> | 1.0.0 |
855
+ | **`title`** | <code>string</code> | 1.0.0 |
856
+ | **`linkUrl`** | <code>string</code> | 1.0.0 |
857
+ | **`customFields`** | <code>{ [key: string]: any; }</code> | 1.0.0 |
858
+ | **`feature`** | <code>string</code> | 1.0.0 |
859
+ | **`cohort`** | <code>string</code> | 1.0.0 |
860
+ | **`imageUrl`** | <code>string</code> | 1.0.0 |
861
+ | **`zoomImageUrl`** | <code>string</code> | 1.0.0 |
862
+ | **`categoryPath`** | <code>string</code> | 1.0.0 |
863
+ | **`available`** | <code>number</code> | 1.0.0 |
864
+ | **`productDescription`** | <code>string</code> | 1.0.0 |
865
+ | **`price`** | <code>number</code> | 1.0.0 |
866
+ | **`msrp`** | <code>number</code> | 1.0.0 |
867
+ | **`album`** | <code>string</code> | 1.0.0 |
868
+ | **`actor`** | <code>string</code> | 1.0.0 |
869
+ | **`artist`** | <code>string</code> | 1.0.0 |
870
+ | **`author`** | <code>string</code> | 1.0.0 |
871
+ | **`brand`** | <code>string</code> | 1.0.0 |
872
+ | **`year`** | <code>number</code> | 1.0.0 |
873
+
874
+
875
+ #### RecommendedProductOptions
876
+
877
+ | Prop | Type | Description | Default | Since |
878
+ | ---------------------- | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------- | ----- |
879
+ | **`logic`** | <code><a href="#recommendedproductlogic">RecommendedProductLogic</a></code> | The logic that should be used. | | 1.0.0 |
880
+ | **`filter`** | <code>RecommendedProductFilter[]</code> | You can filter product recommendations with the SDK. There are two types of filters: `Exclude` or `Include`. In every case there are four types of comparators you can use to compare your chosen field to the `value`. This is an optional parameter. | | 1.0.0 |
881
+ | **`limit`** | <code>number</code> | You can limit the number of recommended products received by defining a `limit`. | <code>5</code> | 1.0.0 |
882
+ | **`availabilityZone`** | <code>string</code> | You can personalize the recommendation further by setting the `availabilityZones` parameter of the recommendation, to only recommend the locally available products. This is an optional parameter. | | 1.0.0 |
883
+
884
+
885
+ #### RecommendedProductSearchLogic
886
+
887
+ Based on `searchTerm`
888
+
889
+ | Prop | Type | Since |
890
+ | ----------- | --------------------- | ----- |
891
+ | **`type`** | <code>'search'</code> | 1.0.0 |
892
+ | **`value`** | <code>string</code> | 1.0.0 |
893
+
894
+
895
+ #### RecommendedProductCartLogic
896
+
897
+ Based on `cartItems`
898
+
899
+ | Prop | Type | Since |
900
+ | ----------- | ----------------------- | ----- |
901
+ | **`type`** | <code>'cart'</code> | 1.0.0 |
902
+ | **`value`** | <code>CardItem[]</code> | 1.0.0 |
903
+
904
+
905
+ #### RecommendedProductRelatedLogic
906
+
907
+ Based on `itemViewId`
908
+
909
+ | Prop | Type | Since |
910
+ | ----------- | ---------------------- | ----- |
911
+ | **`type`** | <code>'related'</code> | 1.0.0 |
912
+ | **`value`** | <code>string</code> | 1.0.0 |
913
+
914
+
915
+ #### RecommendedProductCategoryLogic
916
+
917
+ Based on `categoryPath`
918
+
919
+ | Prop | Type | Since |
920
+ | ----------- | ----------------------- | ----- |
921
+ | **`type`** | <code>'category'</code> | 1.0.0 |
922
+ | **`value`** | <code>string</code> | 1.0.0 |
923
+
924
+
925
+ #### RecommendedProductAlsoBoughtLogic
926
+
927
+ Based on `itemViewId`
928
+
929
+ | Prop | Type | Since |
930
+ | ----------- | -------------------------- | ----- |
931
+ | **`type`** | <code>'also_bought'</code> | 1.0.0 |
932
+ | **`value`** | <code>string</code> | 1.0.0 |
933
+
934
+
935
+ #### RecommendedProductPopularLogic
936
+
937
+ Based on `categoryPath`
938
+
939
+ | Prop | Type | Since |
940
+ | ----------- | ---------------------- | ----- |
941
+ | **`type`** | <code>'popular'</code> | 1.0.0 |
942
+ | **`value`** | <code>string</code> | 1.0.0 |
943
+
944
+
945
+ #### RecommendedProductPersonalLogic
946
+
947
+ Based on based on current browsing and activity
948
+
949
+ Optionally based on the variants
950
+
951
+ | Prop | Type | Since |
952
+ | ----------- | ----------------------- | ----- |
953
+ | **`type`** | <code>'personal'</code> | 1.0.0 |
954
+ | **`value`** | <code>string[]</code> | 1.0.0 |
955
+
956
+
957
+ #### RecommendedProductHomeLogic
958
+
959
+ Based on most recent browsing behaviour
960
+
961
+ Optionally based on the variants
962
+
963
+ | Prop | Type | Since |
964
+ | ----------- | --------------------- | ----- |
965
+ | **`type`** | <code>'home'</code> | 1.0.0 |
966
+ | **`value`** | <code>string[]</code> | 1.0.0 |
967
+
968
+
969
+ #### RecommendedProductValueFilter
970
+
971
+ | Prop | Type | Description | Since |
972
+ | -------------------- | ------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
973
+ | **`filterType`** | <code><a href="#recommendedproductfiltertype">RecommendedProductFilterType</a></code> | | 1.0.0 |
974
+ | **`comparatorType`** | <code><a href="#recommendedproductvaluefiltercomparatortype">RecommendedProductValueFilterComparatorType</a></code> | `isValue`: checking if the `field` is matching the `value`, `hasValue`: One of the `field` values is equal to `expectation value` (applicable only to fields containing multiple values) | 1.0.0 |
975
+ | **`field`** | <code>string</code> | | 1.0.0 |
976
+ | **`value`** | <code>string</code> | | 1.0.0 |
977
+
978
+
979
+ #### RecommendedProductArrayFilter
980
+
981
+ | Prop | Type | Description | Since |
982
+ | -------------------- | ------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
983
+ | **`filterType`** | <code><a href="#recommendedproductfiltertype">RecommendedProductFilterType</a></code> | | 1.0.0 |
984
+ | **`comparatorType`** | <code><a href="#recommendedproductarrayfiltercomparatortype">RecommendedProductArrayFilterComparatorType</a></code> | `inValues`: any of the `values` has a match with the `field`, `overlapsValues`: One or more of the `field` values are found in `expectation values` (applicable only to fields containing multiple values) | 1.0.0 |
985
+ | **`field`** | <code>string</code> | | 1.0.0 |
986
+ | **`value`** | <code>string[]</code> | | 1.0.0 |
987
+
988
+
989
+ #### InboxTag
990
+
991
+ | Prop | Type | Since |
992
+ | --------------- | ------------------- | ----- |
993
+ | **`tag`** | <code>string</code> | 1.0.0 |
994
+ | **`messageId`** | <code>string</code> | 1.0.0 |
995
+
996
+
997
+ #### ApplicationCode
998
+
999
+ | Prop | Type | Since |
1000
+ | --------------------- | ------------------- | ----- |
1001
+ | **`applicationCode`** | <code>string</code> | 1.0.0 |
1002
+
1003
+
1004
+ #### MerchantId
1005
+
1006
+ | Prop | Type | Since |
1007
+ | ---------------- | ------------------- | ----- |
1008
+ | **`merchantId`** | <code>string</code> | 1.0.0 |
1009
+
1010
+
1011
+ #### ContactFieldId
1012
+
1013
+ | Prop | Type | Since |
1014
+ | -------------------- | ------------------- | ----- |
1015
+ | **`contactFieldId`** | <code>number</code> | 1.0.0 |
1016
+
1017
+
1018
+ #### PluginListenerHandle
1019
+
1020
+ | Prop | Type |
1021
+ | ------------ | ----------------------------------------- |
1022
+ | **`remove`** | <code>() =&gt; Promise&lt;void&gt;</code> |
1023
+
1024
+
1025
+ #### PushMessageEvent
1026
+
1027
+ | Prop | Type | Since |
1028
+ | --------------- | ---------------------------------------------- | ----- |
1029
+ | **`eventName`** | <code>string</code> | 1.0.0 |
1030
+ | **`data`** | <code>{ key: string; value: string; }[]</code> | 1.0.0 |
1031
+
1032
+
1033
+ #### SilentPushMessageInformation
1034
+
1035
+ | Prop | Type | Since |
1036
+ | ---------------- | ------------------- | ----- |
1037
+ | **`campaignId`** | <code>string</code> | 1.0.0 |
1038
+
1039
+
1040
+ ### Type Aliases
1041
+
1042
+
1043
+ #### PermissionState
1044
+
1045
+ <code>'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'</code>
1046
+
1047
+
1048
+ #### RecommendedProductLogic
1049
+
1050
+ <code><a href="#recommendedproductsearchlogic">RecommendedProductSearchLogic</a> | <a href="#recommendedproductcartlogic">RecommendedProductCartLogic</a> | <a href="#recommendedproductrelatedlogic">RecommendedProductRelatedLogic</a> | <a href="#recommendedproductcategorylogic">RecommendedProductCategoryLogic</a> | <a href="#recommendedproductalsoboughtlogic">RecommendedProductAlsoBoughtLogic</a> | <a href="#recommendedproductpopularlogic">RecommendedProductPopularLogic</a> | <a href="#recommendedproductpersonallogic">RecommendedProductPersonalLogic</a> | <a href="#recommendedproducthomelogic">RecommendedProductHomeLogic</a></code>
1051
+
1052
+
1053
+ #### RecommendedProductFilter
1054
+
1055
+ <code><a href="#recommendedproductvaluefilter">RecommendedProductValueFilter</a> | <a href="#recommendedproductarrayfilter">RecommendedProductArrayFilter</a></code>
1056
+
1057
+
1058
+ #### RecommendedProductFilterType
1059
+
1060
+ <code>'include' | 'exclude'</code>
1061
+
1062
+
1063
+ #### RecommendedProductValueFilterComparatorType
1064
+
1065
+ <code>'isValue' | 'hasValue'</code>
1066
+
1067
+
1068
+ #### RecommendedProductArrayFilterComparatorType
1069
+
1070
+ <code>'inValues' | 'overlapsValues'</code>
1071
+
1072
+ </docgen-api>
1073
+
1074
+ ## Changelog
1075
+
1076
+ The full Changelog is available [here](CHANGELOG.md)