easea-app-widget 1.0.8 → 1.1.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 (2) hide show
  1. package/README.md +129 -66
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,69 +1,132 @@
1
- # React + TypeScript + Vite
2
-
3
- This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4
-
5
- Currently, two official plugins are available:
6
-
7
- - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
8
- - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9
-
10
- ## Expanding the ESLint configuration
11
-
12
- If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
13
-
14
- ```js
15
- export default tseslint.config([
16
- globalIgnores(['dist']),
17
- {
18
- files: ['**/*.{ts,tsx}'],
19
- extends: [
20
- // Other configs...
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 and receive bookings directly from your own site.
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
22
+ ```
23
+
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>
40
50
  ```
41
51
 
42
- You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
43
-
44
- ```js
45
- // eslint.config.js
46
- import reactX from 'eslint-plugin-react-x'
47
- import reactDom from 'eslint-plugin-react-dom'
48
-
49
- export default tseslint.config([
50
- globalIgnores(['dist']),
51
- {
52
- files: ['**/*.{ts,tsx}'],
53
- extends: [
54
- // Other configs...
55
- // Enable lint rules for React
56
- reactX.configs['recommended-typescript'],
57
- // Enable lint rules for React DOM
58
- reactDom.configs.recommended,
59
- ],
60
- languageOptions: {
61
- parserOptions: {
62
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
63
- tsconfigRootDir: import.meta.dirname,
64
- },
65
- // other options...
66
- },
67
- },
68
- ])
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
+ })
74
+ })
75
+ </script>
76
+ </body>
77
+ </html>
69
78
  ```
79
+
80
+ ---
81
+
82
+ ### API
83
+
84
+ `window.EaseaWidget.init(config)`
85
+
86
+ `config` parameters:
87
+
88
+ - `key` (string, required): widget key provided by Easea App.
89
+ - `lang` (string, optional): UI language. Examples: `it`, `en`. If omitted, the widget will use the default language.
90
+ - `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.
91
+
92
+ Technical notes:
93
+
94
+ - The created host has id `easea-widget-root` and is appended to `document.body`.
95
+ - Widget styles are isolated via Shadow DOM; no additional CSS imports are required.
96
+
97
+ ---
98
+
99
+ ### Integration best practices
100
+
101
+ - Initialize the widget after the DOM has loaded.
102
+ - Keep your `key` safe: since this is a client widget, the key can be exposed; contact Easea App for any usage limits/policies.
103
+ - If you use optimization/lazy-loading tools, make sure the script is available before calling `init`.
104
+
105
+ ---
106
+
107
+ ### Troubleshooting
108
+
109
+ - `window.EaseaWidget is undefined`: ensure the script (NPM or CDN) is loaded before calling `init`.
110
+ - No visible content: verify your `key` and check the browser console for network or console errors.
111
+ - Style conflicts: the widget uses Shadow DOM and its own stylesheets to minimize conflicts.
112
+
113
+ ---
114
+
115
+ ### Changelog
116
+
117
+ See the NPM registry for published versions of the `easea-app-widget` package.
118
+
119
+ ---
120
+
121
+ ### Support
122
+
123
+ Need help with the integration? Contact the Easea App team.
124
+
125
+ ### Keywords
126
+
127
+ - booking widget
128
+ - online reservations
129
+ - website booking box
130
+ - embed widget
131
+ - CDN and NPM integration
132
+ - React / TypeScript
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "easea-app-widget",
3
3
  "private": false,
4
- "version": "1.0.8",
4
+ "version": "1.1.1",
5
5
  "type": "module",
6
6
  "description": "Easea App widget allow you to get a booking box into yor website",
7
7
  "main": "dist/widget-bundle.umd.js",