@athome-solution/feedjet 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) [year] [fullname]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,279 @@
1
+ # Feedjet
2
+
3
+ ## Installation
4
+
5
+ Ajoutez la librairie à votre projet en utilisant **npm**, **yarn** ou **pnpm** :
6
+
7
+ ```bash
8
+ # npm
9
+ npm install @athome-solution/feedjet
10
+ # yarn
11
+ yarn add @athome-solution/feedjet
12
+ # pnpm
13
+ pnpm add @athome-solution/feedjet
14
+ ```
15
+
16
+ # Feedjet Feedback
17
+
18
+ Feedjet Feedback est une librairie JavaScript permettant d’intégrer un widget de feedback personnalisé à votre application. Elle permet aux utilisateurs de soumettre des problèmes, des suggestions ou des améliorations via un formulaire interactif.
19
+
20
+ ## Fonctionnalités
21
+ - Collecte de feedback utilisateur avec un formulaire personnalisable.
22
+ - Capture d’écran automatique incluse dans les feedbacks.
23
+ - Gestion des erreurs de validation.
24
+ - URL d'API configurable pour s'adapter à votre environnement.
25
+
26
+ ## Utilisation
27
+
28
+ ### Intégration dans un Framework JS
29
+ Ajoutez le widget dans votre projet en initialisant la classe `Feedback`.
30
+
31
+ ```js
32
+ import { Feedback } from '@athome-solution/feedjet'
33
+ import '@athome-solution/feedjet/css/feedback.css'
34
+
35
+ const feedback = new Feedback({
36
+ target: document.getElementById('feedback-widget'),
37
+ projectId: '12345',
38
+ apiUrl: 'https://api.example.com/api/import_feedback',
39
+ user: {
40
+ id: '1',
41
+ fullName: 'John Doe',
42
+ },
43
+ })
44
+ ```
45
+
46
+ Ajoutez le conteneur HTML dans votre page :
47
+
48
+ ```html
49
+ <div id="feedback-widget"></div>
50
+ ```
51
+
52
+ Le widget sera automatiquement rendu dans le conteneur avec l'ID `feedback-widget`.
53
+
54
+ ### Intégration Nuxt 3/4 (SSR)
55
+
56
+ ```js
57
+ import { Feedback } from '@athome-solution/feedjet'
58
+ import '@athome-solution/feedjet/css/feedback.css'
59
+
60
+ const { user } = useAuth()
61
+
62
+ const feedbackBtn = ref()
63
+
64
+ watch([feedbackBtn], () => {
65
+ if (!feedbackBtn.value)
66
+ return
67
+
68
+ const feedback = new Feedback({
69
+ target: { feedback: feedbackBtn.value.$el },
70
+ projectId: $config.public.feedjetProjectId,
71
+ apiUrl: $config.public.feedjetApiUrl,
72
+ user: () => ({
73
+ id: user.value.id,
74
+ fullName: `${user.value.firstName} ${user.value.lastName}`,
75
+ })
76
+ })
77
+ })
78
+ ```
79
+
80
+ ```html
81
+ <Button ref="feedbackBtn">
82
+ Retour
83
+ </Button>
84
+ ```
85
+
86
+ ### Exemple avec JavaScript Vanilla
87
+ Voici un exemple complétement fonctionnel utilisant uniquement du JavaScript Vanilla :
88
+
89
+ ```html
90
+ <!DOCTYPE html>
91
+ <html>
92
+ <head>
93
+ <meta charset="UTF-8">
94
+ <title>Feedjet Feedback</title>
95
+ <link rel="stylesheet" href="https://unpkg.com/@athome-solution/feedjet/dist/css/feedback.css">
96
+ <script src="https://unpkg.com/@athome-solution/feedjet"></script>
97
+ </head>
98
+ <body>
99
+ <div id="feedback-widget"></div>
100
+
101
+ <script>
102
+ const feedback = new Feedjet.Feedback({
103
+ target: document.getElementById('feedback-widget'),
104
+ projectId: '12345',
105
+ apiUrl: 'https://api.example.com/api/import_feedback',
106
+ user: {
107
+ id: '1',
108
+ fullName: 'John Doe',
109
+ },
110
+ });
111
+ </script>
112
+ </body>
113
+ </html>
114
+ ```
115
+ ## Options disponibles
116
+ ### Paramètres de `Feedback`
117
+
118
+ ```ts
119
+ interface FeedbackOptions {
120
+ target: HTMLElement | null | undefined | {
121
+ feedback?: HTMLElement | null | undefined
122
+ }
123
+ projectId?: string
124
+ apiUrl?: string
125
+ user?: {
126
+ id: string
127
+ fullName?: string
128
+ } | undefined | (() => ({ id: string, fullName?: string } | undefined))
129
+ }
130
+ ```
131
+
132
+ | Paramètre | Description | Obligatoire |
133
+ |-------------|----------------------------------------------------------------------------|-------------|
134
+ | `target` | L’élément HTML où le widget sera rendu. | Oui |
135
+ | `projectId` | L'identifiant du projet Feedjet. | Oui |
136
+ | `apiUrl` | L'URL de l'API pour envoyer les feedbacks. | Oui |
137
+ | `user` | Les informations de l'utilisateur qui envoie le feedback. | Non |
138
+
139
+ ## Customisation
140
+
141
+ Vous pouvez personnaliser le widget en modifiant les variables CSS suivantes :
142
+
143
+ ```css
144
+ .fj-feedback-modal.fj-feedback-issue {
145
+ --color: #ff0000; /* Couleur de la bordure haute de la modale */
146
+ --robot-color: #ff0000; /* Couleur du robot dans la modale */
147
+ }
148
+
149
+ .fj-feedback-modal.fj-feedback-amelioration {
150
+ --color: #00ff00; /* Couleur de la bordure haute de la modale */
151
+ --robot-color: #00ff00; /* Couleur du robot dans la modale */
152
+ }
153
+ ```
154
+
155
+ Toutes les classes CSS sont préfixées par `.fj-feedback-` pour éviter les conflits avec d'autres styles.
156
+
157
+ # Feedjet Feedbot
158
+
159
+ Feedjet Feedbot est une librairie JavaScript permettant d’intégrer un widget de questionnaire Feedbot à votre application. Il permet de collecter des feedbacks utilisateurs à l'aide de questions personnalisées.
160
+
161
+ ## Fonctionnalités
162
+
163
+ - Gestion des erreurs de validation.
164
+ - URL d'API configurable pour s'adapter à votre environnement.
165
+ - Gestion des questionnaires avec seuil (nombre d'utilisation d'une fonctionnalité avant affichage du questionnaire).
166
+
167
+ ## Utilisation
168
+
169
+ ### Intégration dans un Framework JS
170
+
171
+ Ajoutez le widget dans votre projet en initialisant la classe `Feedbot`.
172
+
173
+ ```js
174
+ import { Feedbot } from '@athome-solution/feedjet'
175
+ import '@athome-solution/feedjet/css/feedbot.css'
176
+
177
+ const feedbot = new Feedbot({
178
+ baseApiUrl: 'https://api.example.com',
179
+ surveyId: '12345',
180
+ user: {
181
+ id: '1',
182
+ fullName: 'John Doe',
183
+ },
184
+ })
185
+
186
+ // si votre questionnaire est déclenché via un seuil
187
+ document.getElementById('button').addEventListener('click', () => {
188
+ feedbot.increment()
189
+ })
190
+ ```
191
+
192
+ ```html
193
+ <button id="button">Click Me</button>
194
+ ```
195
+
196
+ ### Intégration Nuxt 3/4 (SSR)
197
+
198
+ ```vue
199
+ <script setup>
200
+ import { Feedback } from '@athome-solution/feedjet'
201
+ import '@athome-solution/feedjet/css/feedback.css'
202
+
203
+ const { user } = useAuth()
204
+
205
+ const feedbot = new Feedbot({
206
+ baseApiUrl: 'https://api.example.com',
207
+ surveyId: '12345',
208
+ user: () => ({
209
+ id: user.value.id,
210
+ fullName: `${user.value.firstName} ${user.value.lastName}`,
211
+ })
212
+ })
213
+ </script>
214
+
215
+ <template>
216
+ <Button @click="feedbot.increment()">
217
+ Anomalie
218
+ </Button>
219
+ </template>
220
+ ```
221
+
222
+ ### Exemple avec JavaScript Vanilla
223
+
224
+ ```html
225
+ <!DOCTYPE html>
226
+ <html>
227
+ <head>
228
+ <meta charset="UTF-8">
229
+ <title>Feedjet Feedbot</title>
230
+ <link rel="stylesheet" href="https://unpkg.com/@athome-solution/feedjet/dist/css/feedbot.css">
231
+ <script src="https://unpkg.com/@athome-solution/feedjet"></script>
232
+ </head>
233
+ <body>
234
+ <button id="button">Click Me</button>
235
+
236
+ <script>
237
+ const feedbot = new Feedjet.Feedbot({
238
+ baseApiUrl: 'https://api.example.com',
239
+ surveyId: '12345',
240
+ user: {
241
+ id: '1',
242
+ fullName: 'John Doe',
243
+ },
244
+ });
245
+
246
+ document.getElementById('button').addEventListener('click', () => {
247
+ feedbot.increment()
248
+ });
249
+ </script>
250
+ </body>
251
+ </html>
252
+ ```
253
+
254
+ ## Options disponibles
255
+
256
+ ```ts
257
+ interface FeedbotOptions {
258
+ baseApiUrl: string
259
+ surveyId: string
260
+ user?: {
261
+ id: string
262
+ fullName?: string
263
+ } | undefined | (() => ({ id: string, fullName?: string } | undefined))
264
+ }
265
+ ```
266
+
267
+ | Paramètre | Description | Obligatoire |
268
+ |---------------|----------------------------------------------------------------------------|-------------|
269
+ | `baseApiUrl` | L'URL de base de l'API Feedbot. | Oui |
270
+ | `surveyId` | L'identifiant du sondage Feedbot. | Oui |
271
+ | `user` | Les informations de l'utilisateur qui envoie le feedback. | Non |
272
+
273
+ ## Customisation
274
+
275
+ Toutes les classes CSS sont préfixées par `.fj-feedbot-` pour éviter les conflits avec d'autres styles.
276
+
277
+ # Licence
278
+
279
+ Cette librairie est sous licence MIT. Consultez le fichier [LICENSE](./LICENSE) pour plus d'informations.
@@ -0,0 +1,3 @@
1
+ :root{--fj-feedback-primary-color: #1565c0;--fj-feedback-secondary-color: #e3f2fd;--fj-feedback-label-color: #2f2f2f;--fj-feedback-input-border-color: #d7e1e5;--fj-feedback-error-color: #d80c2e;--fj-feedback-btn-color: var(--fj-feedback-primary-color)}.fj-feedback-feedback-buttons{display:flex;justify-content:center;align-items:center}button.fj-feedback-btn{background-color:#1565c0;color:#fff;border-radius:6px;cursor:pointer;font-weight:600;letter-spacing:.5px;height:32px;width:100%;transition:background-color .3s ease}button.fj-feedback-btn.fj-feedback-btn-submit{background-color:var(--fj-feedback-primary-color)}button.fj-feedback-btn.fj-feedback-btn-secondary{background-color:#fff;color:var(--fj-feedback-label-color);border-radius:6px;cursor:pointer;font-weight:600;letter-spacing:.5px;height:32px;width:100%;transition:background-color .3s ease}button.fj-feedback-btn.fj-feedback-btn-loading{pointer-events:none;cursor:not-allowed;background-color:var(--fj-feedback-input-border-color);color:#fff}button.fj-feedback-btn:focus{outline:none;border-color:var(--fj-feedback-secondary-color)}.fj-feedback-modal{font-family:"Roboto",sans-serif;background-color:rgba(0,0,0,.5);z-index:1000;position:fixed;top:0;left:0;width:100vw;height:100vh;display:flex;justify-content:center;align-items:center}.fj-feedback-modal label,.fj-feedback-modal label>p{font-size:14px;color:var(--fj-feedback-label-color);margin:0}.fj-feedback-modal label{display:grid}.fj-feedback-modal label>p>span{color:var(--fj-feedback-error-color)}.fj-feedback-modal label>input,.fj-feedback-modal label>textarea{padding:.5rem;border:1px solid var(--fj-feedback-input-border-color);border-radius:8px;margin-top:.5rem}.fj-feedback-modal label>input:focus,.fj-feedback-modal label>textarea:focus{outline:none;border-color:var(--fj-feedback-primary-color)}.fj-feedback-modal label textarea{resize:none}.fj-feedback-modal label.fj-feedback-consent{display:flex;align-items:center;gap:.5rem}.fj-feedback-modal label.fj-feedback-consent>p{color:var(--fj-feedback-label-color)}.fj-feedback-modal label.fj-feedback-consent>input{margin:0}.fj-feedback-modal label input[type=checkbox]{position:relative;width:1rem;height:1rem;appearance:none;border:1px solid var(--fj-feedback-input-border-color);border-radius:4px;background:#fff;cursor:pointer}.fj-feedback-modal label input[type=checkbox]::before{content:"✔";position:absolute;top:50%;left:50%;transform:translate(-50%, -45%);font-size:1rem;color:#fff;display:none}.fj-feedback-modal label input[type=checkbox]:checked{background-color:var(--fj-feedback-primary-color);border-color:var(--fj-feedback-primary-color)}.fj-feedback-modal label input[type=checkbox]:checked::before{display:inline-block}.fj-feedback-modal .fj-feedback-form{border:2px solid var(--fj-feedback-primary-color);border-radius:12px;border-top:12px solid var(--fj-feedback-primary-color)}.fj-feedback-modal .fj-feedback-form,.fj-feedback-modal .fj-feedback-content,.fj-feedback-modal .fj-feedback-thanks{display:grid;gap:1.25rem;padding:1.25rem;background-color:#fff;width:100%;max-width:565px}.fj-feedback-modal .fj-feedback-form .fj-feedback-error,.fj-feedback-modal .fj-feedback-content .fj-feedback-error,.fj-feedback-modal .fj-feedback-thanks .fj-feedback-error{font-size:16px;margin:0;color:var(--fj-feedback-error-color)}.fj-feedback-modal .fj-feedback-form .fj-feedback-header,.fj-feedback-modal .fj-feedback-content .fj-feedback-header,.fj-feedback-modal .fj-feedback-thanks .fj-feedback-header{position:relative}.fj-feedback-modal .fj-feedback-form .fj-feedback-header p,.fj-feedback-modal .fj-feedback-content .fj-feedback-header p,.fj-feedback-modal .fj-feedback-thanks .fj-feedback-header p{color:var(--fj-feedback-label-color);font-size:14px;font-weight:bold;margin-bottom:0}.fj-feedback-modal .fj-feedback-form .fj-feedback-header .fj-feedback-title,.fj-feedback-modal .fj-feedback-content .fj-feedback-header .fj-feedback-title,.fj-feedback-modal .fj-feedback-thanks .fj-feedback-header .fj-feedback-title{font-size:24px;font-weight:bold;color:var(--fj-feedback-primary-color);padding-right:12rem;margin:0}.fj-feedback-modal .fj-feedback-form .fj-feedback-header .fj-feedback-robot,.fj-feedback-modal .fj-feedback-content .fj-feedback-header .fj-feedback-robot,.fj-feedback-modal .fj-feedback-thanks .fj-feedback-header .fj-feedback-robot{transform:rotate(5deg);position:absolute;top:-13rem;right:-3.5rem;width:12rem;height:12rem;animation:bounce 3s infinite;color:var(--fj-feedback-primary-color);z-index:1}.fj-feedback-modal .fj-feedback-form .fj-feedback-header .fj-feedback-robot svg,.fj-feedback-modal .fj-feedback-content .fj-feedback-header .fj-feedback-robot svg,.fj-feedback-modal .fj-feedback-thanks .fj-feedback-header .fj-feedback-robot svg{width:100%;height:100%}.fj-feedback-modal .fj-feedback-form .fj-feedback-body,.fj-feedback-modal .fj-feedback-content .fj-feedback-body,.fj-feedback-modal .fj-feedback-thanks .fj-feedback-body{display:grid;gap:1rem}.fj-feedback-modal .fj-feedback-form .fj-feedback-footer-buttons,.fj-feedback-modal .fj-feedback-content .fj-feedback-footer-buttons,.fj-feedback-modal .fj-feedback-thanks .fj-feedback-footer-buttons{display:flex;justify-content:center;gap:.75rem;padding:0 1.25rem}.fj-feedback-modal .fj-feedback-form .fj-feedback-footer-buttons .fj-feedback-btn,.fj-feedback-modal .fj-feedback-content .fj-feedback-footer-buttons .fj-feedback-btn,.fj-feedback-modal .fj-feedback-thanks .fj-feedback-footer-buttons .fj-feedback-btn{font-size:16px;font-weight:normal;padding:0 1rem}@keyframes bounce{0%,100%{bottom:-3.5rem}50%{bottom:-3rem}}.container{display:flex;justify-content:center;align-items:center}.tabs{display:flex;width:400px;border-radius:99px;box-shadow:0 0 1px rgba(224,224,224,.33),0 6px 12px rgba(224,224,224,.33);z-index:2}.tabs input[type=radio][name=feedbackType]{display:none}.tabs input[type=radio][name=feedbackType]+label{color:var(--fj-feedback-label-color);z-index:2}.tabs input[type=radio][name=feedbackType]:checked+label{color:var(--fj-feedback-primary-color)}.tabs .tab{display:flex;align-items:center;justify-content:center;height:54px;width:200px;font-weight:500;cursor:pointer;transition:color .15s ease-in}.tabs .glider{position:absolute;height:54px;width:200px;background:linear-gradient(145deg, #ffffff, var(--fj-feedback-secondary-color));border-radius:99px;transition:transform .2s cubic-bezier(0.25, 0.8, 0.25, 1);z-index:1}.tabs input[id=radio-issue]:checked~.glider{transform:translateX(100%)}.tabs input[id=radio-amelioration]:checked~.glider{transform:translateX(0%)}.fj-feedback-thanks{border-radius:12px}
2
+
3
+ /*# sourceMappingURL=feedback.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/scss/feedback.scss"],"names":[],"mappings":"CAGA,MACE,qCACA,uCACA,mCACA,0CACA,mCACA,0DAeF,8BACE,aACA,uBACA,mBAGF,uBAjBE,iBAkBuB,QAjBvB,MAiBgC,KAhBhC,kBACA,eACA,gBACA,oBACA,YACA,WACA,qCAYA,8CACE,kDAGF,iDAxBA,iBAyByB,KAxBzB,MAwBgC,+BAvBhC,kBACA,eACA,gBACA,oBACA,YACA,WACA,qCAoBA,+CACE,oBACA,mBACA,uDACA,WAGF,6BACE,aACA,gDAIJ,mBACE,gCACA,gCACA,aACA,eACA,MACA,OACA,YACA,aACA,aACA,uBACA,mBAEA,oDAEE,eACA,qCACA,SAGF,yBACE,aAEA,gCACE,qCAGF,iEAEE,cACA,uDACA,kBACA,iBAEA,6EACE,aACA,8CAIJ,kCACE,YAGF,6CACE,aACA,mBACA,UAEA,+CACE,qCAGF,mDACE,SAIJ,8CACE,kBACA,WACA,YACA,gBACA,uDACA,kBACA,gBACA,eAEA,sDACE,YACA,kBACA,QACA,SACA,gCACA,eACA,WACA,aAGF,sDACE,kDACA,8CAEA,8DACE,qBAOR,qCACE,kDACA,mBACA,uDAGF,oHAGE,aACA,YACA,gBACA,sBACA,WACA,gBAGA,6KACE,eACA,SACA,qCAGF,gLACE,kBAEA,sLACE,qCACA,eACA,iBACA,gBAGF,yOACE,eACA,iBACA,uCACA,oBACA,SAGF,yOACE,uBACA,kBACA,WACA,cACA,YACA,aACA,6BACA,uCACA,UAEA,qPACE,WACA,YAKN,0KACE,aACA,SAGF,wMACE,aACA,uBACA,WACA,kBAEA,2PACE,eACA,mBACA,eAMR,kBACE,QACE,eAEF,IACE,cAIJ,WACE,aACA,uBACA,mBAGF,MACE,aACA,YACA,mBACA,0EACA,UAEA,2CACE,aAEA,iDACE,qCACA,UAGF,yDACE,uCAIJ,WACE,aACA,mBACA,uBACA,YACA,YACA,gBACA,eACA,8BAGF,cACE,kBACA,YACA,YACA,gFACA,mBACA,0DACA,UAGF,4CACE,2BAGF,mDACE,yBAIJ,oBACE","file":"feedback.css","sourceRoot":""}
@@ -0,0 +1,3 @@
1
+ .fj label,.fj label>p{font-size:14px;color:#5e5e5e;margin:0}.fj label{display:grid}.fj label>p>span{color:#d80c2e}.fj label>input,.fj label>textarea{padding:.5rem;border:1px solid #d7e1e5;border-radius:8px;margin-top:.5rem}.fj label>input:focus,.fj label>textarea:focus{outline:none;border-color:#2a3a7a}.fj label textarea{resize:none}.fj label.fj-checkbox-label{display:flex;align-items:center;gap:.5rem}.fj label.fj-checkbox-label>p{color:#000}.fj label.fj-checkbox-label>input{margin:0}.fj label input[type=checkbox]{position:relative}.fj label input[type=checkbox]::before{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);content:"";display:inline-block;width:1rem;height:1rem;border:1px solid #d7e1e5;border-radius:4px;margin-right:.5rem;background:#fff}.fj label input[type=checkbox]:checked::before{content:"✔";color:#fff;font-size:1rem;text-align:center;background-color:#2a3a7a;border-color:#2a3a7a;line-height:1rem}.fj .fj-error{font-size:16px;margin:0;color:#d80c2e}.fj button.fj-btn{padding:.3rem .75rem;margin:0;border:1px solid rgba(0,0,0,0);outline:none;font-weight:600;letter-spacing:.5px;border-radius:8px;transition-property:color,background-color,border-color;transition-duration:300ms;cursor:pointer;background:#2a3a7a;color:#fff}.fj button.fj-btn.fj-btn-secondary{background:#e2e4ee;color:#000}.fj button.fj-btn.fj-btn-loading{pointer-events:none;cursor:not-allowed;background:#d7e1e5;color:#fff}.fj button.fj-btn:focus{outline:none;border-color:#e2e4ee}.fj button.fj-btn:focus.fj-btn-secondary{border-color:#2a3a7a}.fj button.fj-btn:hover{background:hsl(228,48.7804878049%,45.7254901961%)}.fj button.fj-btn:hover.fj-btn-secondary{background:hsl(230,26.0869565217%,81.8823529412%)}.fj-feedbot-modal{font-family:"Roboto",sans-serif;z-index:10;position:fixed;right:4rem;bottom:4rem}.fj-feedbot-modal .fj-feedbot-title{font-size:1.5rem;font-weight:bold;margin:0 0 1rem;max-width:16rem}.fj-feedbot-modal .fj-feedbot-subtitle{max-width:16rem}.fj-feedbot-modal>.fj-feedbot-bubble{width:8rem;height:8rem;border-radius:10000px;background-color:#fff;display:flex;justify-content:center;cursor:pointer}.fj-feedbot-modal>.fj-feedbot-bubble>.fj-feedbot-text{position:absolute;bottom:100%;right:75%;background-color:#c5e5ee;padding:.6rem .75rem;width:max-content;border-radius:10000px;color:#d80c2e;font-weight:900;transform:rotate(-4deg);box-shadow:0 .2rem .4rem rgba(0,0,0,.1607843137)}.fj-feedbot-modal>.fj-feedbot-bubble>.fj-feedbot-text::before{content:"";position:absolute;height:0;width:0;border-top:1rem solid #c5e5ee;border-left:1rem solid rgba(0,0,0,0);bottom:-0.9rem;right:1.3rem}.fj-feedbot-modal>.fj-feedbot-bubble>.fj-feedbot-robot{position:absolute;width:5rem;bottom:1rem}.fj-feedbot-modal>.fj-feedbot-form,.fj-feedbot-modal>.fj-feedbot-thanks{padding:1rem;width:24rem;border-radius:.75rem;box-shadow:rgba(34,34,34,.3764705882) 1px 1px 5px;color:#000;background-color:#fff}.fj-feedbot-modal>.fj-feedbot-form>.fj-feedbot-robot,.fj-feedbot-modal>.fj-feedbot-thanks>.fj-feedbot-robot{position:absolute;width:5rem;right:2rem;animation:fj-feedbot-bounce 3s infinite}.fj-feedbot-modal>.fj-feedbot-form .fj-feedbot-header{min-height:8rem}.fj-feedbot-modal>.fj-feedbot-form .fj-feedbot-presentation{padding:1rem .5rem;background-color:#c5e5ee;border-radius:.25rem;box-shadow:0 .2rem .4rem rgba(0,0,0,.1607843137);margin:0 0 1.5rem}.fj-feedbot-modal>.fj-feedbot-form .fj-feedbot-stars{border:solid #c5e5ee 1px;border-radius:10000px;display:flex;justify-content:center;margin-top:.5rem;margin-bottom:1.5rem}.fj-feedbot-modal>.fj-feedbot-form .fj-feedbot-stars .fj-feedbot-stars-wrapper{display:flex;flex-direction:row-reverse;width:fit-content}.fj-feedbot-modal>.fj-feedbot-form .fj-feedbot-stars .fj-feedbot-stars-wrapper button{background:none;border:none;cursor:pointer;font-size:1.5rem;color:#ea9da1;transition:color 300ms;width:3rem;height:3rem;padding:.5rem;margin:0}.fj-feedbot-modal>.fj-feedbot-form .fj-feedbot-stars .fj-feedbot-stars-wrapper button[aria-checked=true]{color:#d80c2e}.fj-feedbot-modal>.fj-feedbot-form .fj-feedbot-stars .fj-feedbot-stars-wrapper button[aria-checked=true]~button{color:#d80c2e}.fj-feedbot-modal>.fj-feedbot-form .fj-feedbot-stars .fj-feedbot-stars-wrapper:hover button{color:#ea9da1 !important}.fj-feedbot-modal>.fj-feedbot-form .fj-feedbot-stars .fj-feedbot-stars-wrapper:hover button:hover{color:#d80c2e !important}.fj-feedbot-modal>.fj-feedbot-form .fj-feedbot-stars .fj-feedbot-stars-wrapper:hover button:hover~button{color:#d80c2e !important}.fj-feedbot-modal>.fj-feedbot-form .fj-feedbot-quality{margin-bottom:.5rem}.fj-feedbot-modal>.fj-feedbot-form .fj-feedbot-anonymous{margin-bottom:1.5rem;justify-content:flex-end}.fj-feedbot-modal>.fj-feedbot-form .fj-feedbot-footer-buttons{display:flex;justify-content:space-between}@keyframes fj-feedbot-bounce{0%{top:-0.5rem}50%{top:0rem}100%{top:-0.5rem}}
2
+
3
+ /*# sourceMappingURL=feedbot.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/scss/_main.scss","../../src/scss/feedbot.scss"],"names":[],"mappings":"CAWE,sBAEE,eACA,MAZI,QAaJ,SAGF,UACE,aAGE,iBACE,MAlBA,QAsBJ,mCAEE,cACA,yBACA,kBACA,iBAEA,+CACE,aAEA,aA9BE,QAkCN,mBACE,YAGF,4BACE,aACA,mBACA,UAEA,8BACE,WAGF,kCACE,SAIJ,+BACE,kBAEA,uCACE,kBACA,QACA,SACA,gCACA,WACA,qBACA,WACA,YACA,yBACA,kBACA,mBACA,gBAGF,+CACE,YACA,WACA,eACA,kBACA,iBA3EE,QA4EF,aA5EE,QA6EF,iBAKN,cACE,eACA,SACA,MAvFI,QA0FN,kBACE,qBACA,SAEA,+BACA,aAEA,gBACA,oBAEA,kBAEA,wDACA,0BAEA,eAEA,WAzGM,QA0GN,WAEA,mCACE,WA5GM,QA6GN,WAGF,iCACE,oBACA,mBACA,WAxHQ,QAyHR,WAGF,wBACE,aACA,aAzHM,QA2HN,yCACE,aA7HE,QAiIN,wBACE,kDAEA,yCACE,kDCjIR,kBACE,gCAEA,WAEA,eACA,WACA,YAEA,oCACE,iBACA,iBACA,gBACA,gBAGF,uCACE,gBAGF,qCACE,WACA,YACA,cAzBS,QA0BT,sBAEA,aACA,uBAEA,eAEA,sDACE,kBACA,YACA,UAEA,iBA5CU,QA6CV,qBACA,kBACA,cAzCO,QA0CP,MA5CQ,QA6CR,gBACA,wBAEA,iDAEA,8DACE,WACA,kBACA,SACA,QACA,8BACA,qCACA,eACA,aAIJ,uDACE,kBACA,WACA,YAIJ,wEAEE,aACA,YACA,qBACA,kDACA,WACA,sBAEA,4GACE,kBACA,WACA,WACA,wCAKF,sDACE,gBAGF,4DACE,mBACA,iBAjGU,QAkGV,qBACA,iDACA,kBAGF,qDACE,yBACA,cAnGO,QAoGP,aACA,uBACA,iBACA,qBAEA,+EACE,aACA,2BACA,kBAEA,sFACE,gBACA,YACA,eACA,iBACA,MAtHG,QAuHH,uBAEA,WACA,YACA,cACA,SAEA,yGACE,MA9HE,QAgIF,gHACE,MAjIA,QAuIJ,4FACE,yBAEA,kGACE,yBAEA,yGACE,yBAQZ,uDACE,oBAGF,yDACE,qBACA,yBAGF,8DACE,aACA,8BAKN,6BACE,GACE,YAEF,IACE,SAEF,KACE","file":"feedbot.css","sourceRoot":""}
@@ -0,0 +1,29 @@
1
+ import type { MaybeFunction, UserType } from './types';
2
+ type MaybeHTMLElement = HTMLElement | null | undefined;
3
+ type TargetType = MaybeHTMLElement | {
4
+ feedback?: MaybeHTMLElement;
5
+ };
6
+ interface FeedbackOptions {
7
+ target: TargetType;
8
+ projectId?: string;
9
+ apiUrl?: string;
10
+ user?: MaybeFunction<UserType | undefined>;
11
+ }
12
+ export declare class Feedback {
13
+ private readonly options;
14
+ private form;
15
+ private submitError;
16
+ constructor(options: FeedbackOptions);
17
+ init(target: TargetType): void;
18
+ private createFeedbackButton;
19
+ private startFeedback;
20
+ private render;
21
+ private renderForm;
22
+ private renderThanks;
23
+ private renderTabs;
24
+ private renderFields;
25
+ private renderConsent;
26
+ private attachFormEvents;
27
+ private submit;
28
+ }
29
+ export {};
@@ -0,0 +1,22 @@
1
+ import type { MaybeFunction, UserType } from './types';
2
+ interface FeedbotOptions {
3
+ baseApiUrl: string;
4
+ surveyId: string;
5
+ user?: MaybeFunction<UserType | undefined>;
6
+ }
7
+ export declare class Feedbot {
8
+ private options;
9
+ private form;
10
+ private ratingError;
11
+ private submitError;
12
+ private survey;
13
+ private baseApiUrl;
14
+ get user(): UserType | undefined;
15
+ constructor(options: FeedbotOptions);
16
+ private init;
17
+ private fetchSurvey;
18
+ private render;
19
+ increment(): Promise<void>;
20
+ submit(): Promise<void>;
21
+ }
22
+ export {};
package/dist/i18n.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function t(key: string): string;
@@ -0,0 +1,56 @@
1
+ type MaybeFunction<T> = T | (() => T);
2
+ interface UserType {
3
+ id: string;
4
+ fullName?: string;
5
+ }
6
+
7
+ type MaybeHTMLElement = HTMLElement | null | undefined;
8
+ type TargetType = MaybeHTMLElement | {
9
+ feedback?: MaybeHTMLElement;
10
+ };
11
+ interface FeedbackOptions {
12
+ target: TargetType;
13
+ projectId?: string;
14
+ apiUrl?: string;
15
+ user?: MaybeFunction<UserType | undefined>;
16
+ }
17
+ declare class Feedback {
18
+ private readonly options;
19
+ private form;
20
+ private submitError;
21
+ constructor(options: FeedbackOptions);
22
+ init(target: TargetType): void;
23
+ private createFeedbackButton;
24
+ private startFeedback;
25
+ private render;
26
+ private renderForm;
27
+ private renderThanks;
28
+ private renderTabs;
29
+ private renderFields;
30
+ private renderConsent;
31
+ private attachFormEvents;
32
+ private submit;
33
+ }
34
+
35
+ interface FeedbotOptions {
36
+ baseApiUrl: string;
37
+ surveyId: string;
38
+ user?: MaybeFunction<UserType | undefined>;
39
+ }
40
+ declare class Feedbot {
41
+ private options;
42
+ private form;
43
+ private ratingError;
44
+ private submitError;
45
+ private survey;
46
+ private baseApiUrl;
47
+ get user(): UserType | undefined;
48
+ constructor(options: FeedbotOptions);
49
+ private init;
50
+ private fetchSurvey;
51
+ private render;
52
+ increment(): Promise<void>;
53
+ submit(): Promise<void>;
54
+ }
55
+
56
+ export { Feedback, Feedbot };