@sesamy/sesamy-js 1.0.2 → 1.0.4

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
@@ -14,11 +14,25 @@ The following events are tracked:
14
14
 
15
15
  ## API
16
16
 
17
+ The following methods are available on the `sesamy` object:
18
+
19
+ - `init` - Initializes the sesamy-js library
20
+ - `getEntitlement` - Fetches a single entitlement by id
21
+ - `getEntitlements` - Fetches the user's entitlements
22
+ - `getProfile` - Fetches the user's profile
23
+
24
+ ## Events
25
+
26
+ The following events are emitted by the sesamy-js library:
27
+
28
+ - `sesamyReady` - Emitted when the `sesamy-js` library is ready to be used
29
+ - `sesamyAuthenticated` - Emitted when the user is authenticated
30
+
17
31
  ## Usage
18
32
 
19
33
  The script can either be initiated with a JSON object in a script tag or by calling the init method.
20
34
 
21
- The script will look for a script tag with the id `sesamy-js`, and if it isn't found it will wait for a call to the init function before initializing.
35
+ The script will look for a script tag with the id `sesamy-js`, and if it isn't found it will wait for a call to the init function before initializing. The only required part is the `clientId` attribute.
22
36
 
23
37
  ```html
24
38
  <script type="application/json" id="sesamy-js">
@@ -28,7 +42,15 @@ The script will look for a script tag with the id `sesamy-js`, and if it isn't f
28
42
  </script>
29
43
  ```
30
44
 
31
- ## TODO
45
+ These are the available configuration options, with their default values:
32
46
 
33
- - We should consider replacing the saturated library as it keeps the messages in memory. We should maybe replace it with a library that stores the messages in local storage in case the user is offline.
34
- - Ensure that the client-id is fetched from the page or config
47
+ ```javascript
48
+ {
49
+ clientId: null,
50
+ namespace: 'sesamy',
51
+ analytics: {
52
+ enabled: true,
53
+ endpoint: 'https://logs.sesamy.com/events'
54
+ }
55
+ }
56
+ ```