gain-io-widget 0.1.0-rc.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.
package/README.md ADDED
@@ -0,0 +1,91 @@
1
+ # Gain.io Widget
2
+
3
+ An embeddable booking widget that lets your customers schedule meetings directly from your website. Supports both React (npm) and plain HTML (CDN) integration.
4
+
5
+ ---
6
+
7
+ ## NPM
8
+
9
+ ### Installation
10
+
11
+ ```bash
12
+ npm install gain-io-widget
13
+ # or
14
+ pnpm add gain-io-widget
15
+ ```
16
+
17
+ ### Usage
18
+
19
+ ```jsx
20
+ import { GainIoWidget } from 'gain-io-widget';
21
+
22
+ export default function App() {
23
+ return <GainIoWidget apiKey="YOUR_API_KEY" />;
24
+ }
25
+ ```
26
+
27
+ The widget renders a floating trigger button fixed to the bottom-right of the page. Clicking it opens the booking flow inline.
28
+
29
+ ### Props
30
+
31
+ | Prop | Type | Required | Description |
32
+ | -------- | -------- | -------- | ----------------------------------- |
33
+ | `apiKey` | `string` | Yes | Your organization's booking API key |
34
+
35
+ ### Peer Dependencies
36
+
37
+ React 18+ and ReactDOM must be installed in your project.
38
+
39
+ ```bash
40
+ npm install react react-dom
41
+ ```
42
+
43
+ ---
44
+
45
+ ## CDN
46
+
47
+ Add the script tag anywhere in your HTML. The widget initializes itself automatically.
48
+
49
+ ### Auto-init (recommended)
50
+
51
+ ```html
52
+ <script
53
+ src="https://cdn.jsdelivr.net/npm/gain-io-widget/dist/gain-io-widget.js"
54
+ data-gain-auto-init
55
+ data-api-key="YOUR_API_KEY"
56
+ ></script>
57
+ ```
58
+
59
+ The widget reads `data-api-key` from the script tag and mounts itself on page load.
60
+
61
+ ### Manual init
62
+
63
+ ```html
64
+ <script src="https://cdn.jsdelivr.net/npm/gain-io-widget/dist/gain-io-widget.js"></script>
65
+ <script>
66
+ GainIoWidget.init({ apiKey: 'YOUR_API_KEY' });
67
+ </script>
68
+ ```
69
+
70
+ ### Destroy
71
+
72
+ ```js
73
+ GainIoWidget.destroy();
74
+ ```
75
+
76
+ Removes the widget container from the DOM entirely.
77
+
78
+ ---
79
+
80
+ ## How It Works
81
+
82
+ 1. The widget authenticates using your `apiKey` against the Gain.io booking API.
83
+ 2. Once authenticated, a floating button appears at the bottom-right of the page.
84
+ 3. Clicking the button opens a booking flow — date picker → time slot → booking form → confirmation.
85
+ 4. All scheduling is handled by Gain.io's backend. No additional setup required on your end.
86
+
87
+ ---
88
+
89
+ ## License
90
+
91
+ MIT — © Gain Solutions AS