You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* adds more display options to getMessages
* adds tests and example app integration with new display setting
* adds documentation
* updates readme
* updates readme
* updates readme
|[`getInAppMessages`](#getInAppMessages)| Either return in-app messages as a Promise or automatically paint them to the DOM if the second argument is passed `true`|
51
+
|[`getInAppMessages`](#getInAppMessages)| Either return in-app messages as a Promise or automatically paint them to the DOM if the second argument is passed `DisplayOptions`|
52
52
|[`initialize`](#initialize)| Method for identifying users and setting a JWT |
53
53
|[`track`](#track)| Track custom events |
54
54
|[`trackInAppClick`](#trackInAppClick)| Track when a user clicks on a button or link within a message |
@@ -60,7 +60,7 @@ Below are the methods this SDK exposes. See [Iterable's API Docs](https://api.it
60
60
|[`updateCart`](#updateCart)| Update _shoppingCartItems_ field on user profile |
|[`updateUser`](#updateUser)| Change data on a user's profile or create a user if none exists |
63
-
|[`updateUserEmail`](#updateUserEmail)| Change a user's email address |
63
+
|[`updateUserEmail`](#updateUserEmail)| Change a user's email and reauthenticate user with the new email address (in other words, we will call `setEmail` for you)|
64
64
65
65
# Usage
66
66
@@ -69,7 +69,7 @@ Below are the methods this SDK exposes. See [Iterable's API Docs](https://api.it
69
69
API [(see required API payload here)](https://api.iterable.com/api/docs#In-app_getMessages):
:rotating_light:*PLEASE NOTE*: If you choose the `deferred` option, we will _not_ do any filtering or sorting on the messages internally. You will get the messages exactly as they come down from the API, untouched. This means you may (for example) show in-app messages marked `read` or show the messages in the wrong order based on `priority`.
194
+
195
+
If you want to keep the default sorting and filtering, please take advantage of the `sortInAppMessages` and `filterHiddenInAppMessages` methods we provide.
:rotating_light:*PLEASE NOTE*: When you call `updateUserEmail`, we will invoke `yourAsyncJWTGenerationMethod` with the new email address even if you originally authenticated with a user ID, so if you chose to first call `setUserID`, you will need to ensure your backend can also handle JWT generation with email addresses. In other words, you need to make sure both invocations of your async JWT generation method work:
226
+
227
+
```ts
228
+
/*
229
+
the key "email" can be whatever. You just need to make sure your method can be passed an
230
+
email somehow when originally calling "initialize"
API [(see required API payload here)](https://api.iterable.com/api/docs#events_track):
@@ -529,7 +598,7 @@ import { baseAxiosRequest } from '@iterable/web-sdk/dist/request';
529
598
530
599
## I want to automatically show my in-app messages with a delay between each
531
600
532
-
This SDK allows that. Simply call the `getMessages` method but pass `true` as the second parameter. This will expose some methods used to make the request to show the messages and pause and resume the queue.
601
+
This SDK allows that. Simply call the `getMessages` method but pass `{ display: 'immediate' }` as the second parameter. This will expose some methods used to make the request to show the messages and pause and resume the queue.
533
602
534
603
Normally to request a list of in-app messages, you'd make a request like this:
535
604
@@ -579,7 +648,7 @@ import { getInAppMessages } from '@iterable/web-sdk/dist/inapp';
579
648
count: 20,
580
649
packageName: 'my-website'
581
650
},
582
-
true
651
+
{ display: 'immediate' }
583
652
);
584
653
585
654
/* trigger the start of message presentation */
@@ -621,7 +690,7 @@ import { getInAppMessages } from '@iterable/web-sdk/dist/inapp';
621
690
animationDuration: 400,
622
691
handleLinks: 'external-new-tab'
623
692
},
624
-
true
693
+
{ display: 'immediate' }
625
694
);
626
695
627
696
/* trigger the start of message presentation */
@@ -658,7 +727,7 @@ import { getInAppMessages } from '@iterable/web-sdk/dist/inapp';
658
727
count: 20,
659
728
packageName: 'my-website'
660
729
},
661
-
true
730
+
{ display: 'immediate' }
662
731
);
663
732
664
733
/* trigger the start of message presentation */
@@ -679,6 +748,61 @@ import { getInAppMessages } from '@iterable/web-sdk/dist/inapp';
679
748
})();
680
749
```
681
750
751
+
Finally, you can also choose to do your own manipulation to the messages before choosing to display them:
## I want my messages to look good on every device and be responsive
683
807
684
808
This SDK already handles that for you. The rules for the in-app message presentation varies based on which display type you've selected. Here's a table to explain how it works:
0 commit comments