@sesamy/sesamy-js 1.18.0 → 1.18.2
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 +19 -2
- package/dist/sesamy-js.cjs +5 -5
- package/dist/sesamy-js.d.ts +1 -0
- package/dist/sesamy-js.iife.js +5 -5
- package/dist/sesamy-js.mjs +3985 -2385
- package/package.json +9 -3
package/README.md
CHANGED
|
@@ -11,6 +11,8 @@ The analytics module is used to track events and page views. It is using the [Ge
|
|
|
11
11
|
The following events are tracked:
|
|
12
12
|
|
|
13
13
|
- Page views, with events triggered on router updates
|
|
14
|
+
- Scroll events, with events triggered on scroll at 25%, 50%, 75%, and 100%
|
|
15
|
+
- Active and idle duration
|
|
14
16
|
|
|
15
17
|
## API
|
|
16
18
|
|
|
@@ -74,7 +76,9 @@ The following events are emitted by the sesamy-js library:
|
|
|
74
76
|
- `sesamyJsLogout` - Emitted when the user logs out
|
|
75
77
|
- `sesamyJsPurchase` - Emitted after a purchase is completed and passes an itemSrc property with the source of the purchase
|
|
76
78
|
|
|
77
|
-
#
|
|
79
|
+
# Url triggers
|
|
80
|
+
|
|
81
|
+
## Query parameters
|
|
78
82
|
|
|
79
83
|
The library can trigger actions based on query parameters. The following query parameters are supported:
|
|
80
84
|
|
|
@@ -83,6 +87,10 @@ The library can trigger actions based on query parameters. The following query p
|
|
|
83
87
|
- `sesamy-login`. If present, the library will validate that the user is authenticated. If not, the user will be logged out and a new login with be initiated.
|
|
84
88
|
- `sesamy-purchase`. Triggers a sesamyJsPurchase event.
|
|
85
89
|
|
|
90
|
+
# Hash triggers
|
|
91
|
+
|
|
92
|
+
The library can read the access token from the hash. It is not the preferred way of logging in a user but can be used when redirecting the user across domains where a cookie-based solution is not possible. The hash is not sent to the server so the is no risk of leaking the token. The token hash is passed like this: `#access_token=<token>`
|
|
93
|
+
|
|
86
94
|
## Usage
|
|
87
95
|
|
|
88
96
|
The script can either be initiated with a JSON object in a script tag or by calling the init method.
|
|
@@ -262,7 +270,7 @@ setToken(accessToken, expiresIn)
|
|
|
262
270
|
|
|
263
271
|
## `generateLink(params: GenerateAccountLink | GenerateConsumeLink)`
|
|
264
272
|
|
|
265
|
-
Generates a link to a Sesamy
|
|
273
|
+
Generates a link to a Sesamy-hosted service such as account or consume. If the user is authenticated, the link will be signed so that the user can access the service without logging in again.
|
|
266
274
|
|
|
267
275
|
### Parameters
|
|
268
276
|
|
|
@@ -273,6 +281,7 @@ Generates a link to a Sesamy hosted service such as account or consume. If the u
|
|
|
273
281
|
- shorten (boolean, optional): If true, the link will be shortened.
|
|
274
282
|
- ttl (number, optional): The time-to-live for the shortened link in seconds.
|
|
275
283
|
- redirectUrl (string, optional): The URL to redirect to after the link is accessed.
|
|
284
|
+
- language (string, optional): The language for the link. If not provided the language will be fetched from the HTML element's `lang` attribute.
|
|
276
285
|
|
|
277
286
|
### Returns
|
|
278
287
|
|
|
@@ -652,6 +661,14 @@ To use the transform module, include the configuration in your initialization sc
|
|
|
652
661
|
|
|
653
662
|
This configuration will replace the content of the element with the ID `example`, remove elements with the class `ad-banner`, insert the content of the element with the ID `source-element` into elements with the class `insert-content`, and load content from a URL into elements with the class `load-from-url`.
|
|
654
663
|
|
|
664
|
+
### Polyfils
|
|
665
|
+
|
|
666
|
+
The library polyfills the following methods for compatibility with older browsers:
|
|
667
|
+
|
|
668
|
+
- URL
|
|
669
|
+
- URLSearchParams
|
|
670
|
+
- fetch
|
|
671
|
+
|
|
655
672
|
### Notes
|
|
656
673
|
|
|
657
674
|
- The `content` property is required for 'insert' and 'replace' transforms.
|