easea-app-widget 1.0.7 → 1.1.0
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 +121 -66
- package/dist/widget.es.js +1151 -1151
- package/dist/widget.iife.js +1 -1
- package/dist/widget.umd.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,69 +1,124 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// Remove tseslint.configs.recommended and replace with this
|
|
23
|
-
...tseslint.configs.recommendedTypeChecked,
|
|
24
|
-
// Alternatively, use this for stricter rules
|
|
25
|
-
...tseslint.configs.strictTypeChecked,
|
|
26
|
-
// Optionally, add this for stylistic rules
|
|
27
|
-
...tseslint.configs.stylisticTypeChecked,
|
|
28
|
-
|
|
29
|
-
// Other configs...
|
|
30
|
-
],
|
|
31
|
-
languageOptions: {
|
|
32
|
-
parserOptions: {
|
|
33
|
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
34
|
-
tsconfigRootDir: import.meta.dirname,
|
|
35
|
-
},
|
|
36
|
-
// other options...
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
])
|
|
1
|
+
## Easea App Widget
|
|
2
|
+
|
|
3
|
+
Official documentation to integrate the Easea App booking widget into your website.
|
|
4
|
+
|
|
5
|
+
Important note: this widget is available only to Easea App customers who have been granted access beforehand.
|
|
6
|
+
|
|
7
|
+
### What the widget does
|
|
8
|
+
|
|
9
|
+
- Dynamically injects a host (`div#easea-widget-root`) into the page, creates a Shadow DOM, and renders the widget UI inside it, isolating styles.
|
|
10
|
+
- Exposes a global API `window.EaseaWidget.init(config)` so you can initialize the widget whenever you prefer.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
### Installation
|
|
15
|
+
|
|
16
|
+
You can integrate the widget in two ways.
|
|
17
|
+
|
|
18
|
+
1. NPM (recommended for build/bundler setups)
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install easea-app-widget
|
|
40
22
|
```
|
|
41
23
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
24
|
+
Then import the bundle in your app (the import registers `window.EaseaWidget`).
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import 'easea-app-widget'
|
|
28
|
+
|
|
29
|
+
// anywhere after the DOM is ready
|
|
30
|
+
window.EaseaWidget?.init({
|
|
31
|
+
key: 'YOUR_WIDGET_KEY',
|
|
32
|
+
})
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
2. CDN (script tag directly in the page)
|
|
36
|
+
|
|
37
|
+
```html
|
|
38
|
+
<!-- Use any public CDN; example with jsDelivr -->
|
|
39
|
+
<script src="https://cdn.jsdelivr.net/npm/easea-app-widget/dist/widget.umd.js" defer></script>
|
|
40
|
+
<script>
|
|
41
|
+
window.addEventListener('DOMContentLoaded', function () {
|
|
42
|
+
window.EaseaWidget && window.EaseaWidget.init({
|
|
43
|
+
key: 'YOUR_WIDGET_KEY',
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
// Alternatively, load as ES module:
|
|
47
|
+
// <script type="module" src="https://cdn.jsdelivr.net/npm/easea-app-widget/dist/widget.es.js"></script>
|
|
48
|
+
// and then call window.EaseaWidget.init(...)
|
|
49
|
+
</script>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
### Minimal quick start (HTML)
|
|
55
|
+
|
|
56
|
+
```html
|
|
57
|
+
<!doctype html>
|
|
58
|
+
<html>
|
|
59
|
+
<head>
|
|
60
|
+
<meta charset="utf-8" />
|
|
61
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
62
|
+
<title>Easea App Widget</title>
|
|
63
|
+
<script src="https://cdn.jsdelivr.net/npm/easea-app-widget/dist/widget.umd.js" defer></script>
|
|
64
|
+
</head>
|
|
65
|
+
<body>
|
|
66
|
+
<!-- The widget creates its own host and Shadow DOM -->
|
|
67
|
+
|
|
68
|
+
<script>
|
|
69
|
+
window.addEventListener('DOMContentLoaded', function () {
|
|
70
|
+
window.EaseaWidget &&
|
|
71
|
+
window.EaseaWidget.init({
|
|
72
|
+
key: 'YOUR_WIDGET_KEY',
|
|
73
|
+
lang: 'en',
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
|
+
</script>
|
|
77
|
+
</body>
|
|
78
|
+
</html>
|
|
69
79
|
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
### API
|
|
84
|
+
|
|
85
|
+
`window.EaseaWidget.init(config)`
|
|
86
|
+
|
|
87
|
+
`config` parameters:
|
|
88
|
+
|
|
89
|
+
- `key` (string, required): widget key provided by Easea App.
|
|
90
|
+
- `lang` (string, optional): UI language. Examples: `it`, `en`. If omitted, the widget will use the default language.
|
|
91
|
+
- `targetElementId` (string, optional): id of an element present in the DOM to be used as a reference/anchor for parts of the UI (where supported). If not provided, the widget uses the default behavior.
|
|
92
|
+
|
|
93
|
+
Technical notes:
|
|
94
|
+
|
|
95
|
+
- The created host has id `easea-widget-root` and is appended to `document.body`.
|
|
96
|
+
- Widget styles are isolated via Shadow DOM; no additional CSS imports are required.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
### Integration best practices
|
|
101
|
+
|
|
102
|
+
- Initialize the widget after the DOM has loaded.
|
|
103
|
+
- Keep your `key` safe: since this is a client widget, the key can be exposed; contact Easea App for any usage limits/policies.
|
|
104
|
+
- If you use optimization/lazy-loading tools, make sure the script is available before calling `init`.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
### Troubleshooting
|
|
109
|
+
|
|
110
|
+
- `window.EaseaWidget is undefined`: ensure the script (NPM or CDN) is loaded before calling `init`.
|
|
111
|
+
- No visible content: verify your `key` and check the browser console for network or console errors.
|
|
112
|
+
- Style conflicts: the widget uses Shadow DOM and its own stylesheets to minimize conflicts.
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
### Changelog
|
|
117
|
+
|
|
118
|
+
See the NPM registry for published versions of the `easea-app-widget` package.
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
### Support
|
|
123
|
+
|
|
124
|
+
Need help with the integration? Contact the Easea App team.
|