@ourroadmaps/web-sdk 0.3.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.
@@ -0,0 +1,537 @@
1
+ 'use strict';
2
+
3
+ var chunk4DE2IREA_cjs = require('./chunk-4DE2IREA.cjs');
4
+
5
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
6
+ // src/feedback/api.ts
7
+ var API_URL = (() => {
8
+ if (typeof ({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-KGQKTDB4.cjs', document.baseURI).href)) }) !== "undefined" && undefined?.VITE_API_URL) {
9
+ return undefined.VITE_API_URL;
10
+ }
11
+ return "https://api.ourroadmaps.com";
12
+ })();
13
+ async function submitFeedback(apiKey, content) {
14
+ const title = content.slice(0, 100).trim() || "Feedback";
15
+ const response = await fetch(`${API_URL}/v1/ideas`, {
16
+ method: "POST",
17
+ headers: {
18
+ Authorization: `Bearer ${apiKey}`,
19
+ "Content-Type": "application/json"
20
+ },
21
+ body: JSON.stringify({
22
+ title,
23
+ description: content,
24
+ source: "feedback-widget"
25
+ })
26
+ });
27
+ if (!response.ok) {
28
+ const error = await response.json().catch(() => ({
29
+ error: "Request failed"
30
+ }));
31
+ throw new Error(error.message || error.error || "Failed to submit feedback");
32
+ }
33
+ return response.json();
34
+ }
35
+
36
+ // src/feedback/icons.ts
37
+ var ICONS = {
38
+ lightbulb: `<svg viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
39
+ <path d="M9 21c0 .55.45 1 1 1h4c.55 0 1-.45 1-1v-1H9v1zm3-19C8.14 2 5 5.14 5 9c0 2.38 1.19 4.47 3 5.74V17c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2.26c1.81-1.27 3-3.36 3-5.74 0-3.86-3.14-7-7-7zm2.85 11.1l-.85.6V16h-4v-2.3l-.85-.6A4.997 4.997 0 0 1 7 9c0-2.76 2.24-5 5-5s5 2.24 5 5c0 1.63-.8 3.16-2.15 4.1z"/>
40
+ </svg>`,
41
+ close: `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" xmlns="http://www.w3.org/2000/svg">
42
+ <path d="M18 6L6 18M6 6l12 12"/>
43
+ </svg>`,
44
+ send: `<svg viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
45
+ <path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"/>
46
+ </svg>`,
47
+ check: `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" xmlns="http://www.w3.org/2000/svg">
48
+ <path d="M20 6L9 17l-5-5"/>
49
+ </svg>`
50
+ };
51
+
52
+ // src/feedback/styles.ts
53
+ var WIDGET_STYLES = `
54
+ :host {
55
+ --or-primary: #2563eb;
56
+ --or-primary-hover: #1d4ed8;
57
+ --or-success: #10b981;
58
+ --or-error: #ef4444;
59
+ --or-text: #1f2937;
60
+ --or-text-muted: #6b7280;
61
+ --or-bg: #ffffff;
62
+ --or-border: #e5e7eb;
63
+ --or-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
64
+
65
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
66
+ font-size: 14px;
67
+ line-height: 1.5;
68
+ color: var(--or-text);
69
+ }
70
+
71
+ * {
72
+ box-sizing: border-box;
73
+ margin: 0;
74
+ padding: 0;
75
+ }
76
+
77
+ .trigger {
78
+ position: fixed;
79
+ bottom: 20px;
80
+ right: 20px;
81
+ width: 48px;
82
+ height: 48px;
83
+ border-radius: 50%;
84
+ background: var(--or-primary);
85
+ border: none;
86
+ cursor: pointer;
87
+ display: flex;
88
+ align-items: center;
89
+ justify-content: center;
90
+ box-shadow: var(--or-shadow);
91
+ transition: transform 0.15s ease, background-color 0.15s ease;
92
+ z-index: 2147483647;
93
+ }
94
+
95
+ .trigger:hover {
96
+ background: var(--or-primary-hover);
97
+ transform: scale(1.05);
98
+ }
99
+
100
+ .trigger svg {
101
+ width: 24px;
102
+ height: 24px;
103
+ fill: white;
104
+ }
105
+
106
+ .trigger.hidden {
107
+ display: none;
108
+ }
109
+
110
+ .panel {
111
+ position: fixed;
112
+ bottom: 80px;
113
+ right: 20px;
114
+ width: 320px;
115
+ background: var(--or-bg);
116
+ border-radius: 12px;
117
+ box-shadow: var(--or-shadow);
118
+ display: none;
119
+ flex-direction: column;
120
+ overflow: hidden;
121
+ z-index: 2147483647;
122
+ animation: slideIn 0.15s ease;
123
+ }
124
+
125
+ .panel.open {
126
+ display: flex;
127
+ }
128
+
129
+ @keyframes slideIn {
130
+ from {
131
+ opacity: 0;
132
+ transform: translateY(10px) scale(0.95);
133
+ }
134
+ to {
135
+ opacity: 1;
136
+ transform: translateY(0) scale(1);
137
+ }
138
+ }
139
+
140
+ .panel-header {
141
+ display: flex;
142
+ align-items: center;
143
+ justify-content: space-between;
144
+ padding: 12px 16px;
145
+ border-bottom: 1px solid var(--or-border);
146
+ }
147
+
148
+ .panel-title {
149
+ font-weight: 600;
150
+ font-size: 14px;
151
+ }
152
+
153
+ .close-btn {
154
+ width: 28px;
155
+ height: 28px;
156
+ border: none;
157
+ background: transparent;
158
+ cursor: pointer;
159
+ border-radius: 6px;
160
+ display: flex;
161
+ align-items: center;
162
+ justify-content: center;
163
+ color: var(--or-text-muted);
164
+ transition: background-color 0.15s ease;
165
+ }
166
+
167
+ .close-btn:hover {
168
+ background: var(--or-border);
169
+ }
170
+
171
+ .panel-body {
172
+ padding: 16px;
173
+ display: flex;
174
+ flex-direction: column;
175
+ gap: 12px;
176
+ }
177
+
178
+ .error-banner {
179
+ background: #fef2f2;
180
+ border: 1px solid #fecaca;
181
+ border-radius: 8px;
182
+ padding: 12px;
183
+ display: none;
184
+ }
185
+
186
+ .error-banner.visible {
187
+ display: block;
188
+ }
189
+
190
+ .error-text {
191
+ color: var(--or-error);
192
+ font-size: 13px;
193
+ margin-bottom: 8px;
194
+ }
195
+
196
+ .retry-btn {
197
+ background: transparent;
198
+ border: 1px solid var(--or-error);
199
+ color: var(--or-error);
200
+ padding: 4px 12px;
201
+ border-radius: 6px;
202
+ font-size: 13px;
203
+ cursor: pointer;
204
+ transition: background-color 0.15s ease;
205
+ }
206
+
207
+ .retry-btn:hover {
208
+ background: #fef2f2;
209
+ }
210
+
211
+ textarea {
212
+ width: 100%;
213
+ min-height: 80px;
214
+ max-height: 200px;
215
+ padding: 12px;
216
+ border: 1px solid var(--or-border);
217
+ border-radius: 8px;
218
+ resize: none;
219
+ font-family: inherit;
220
+ font-size: 14px;
221
+ line-height: 1.5;
222
+ outline: none;
223
+ transition: border-color 0.15s ease;
224
+ }
225
+
226
+ textarea:focus {
227
+ border-color: var(--or-primary);
228
+ }
229
+
230
+ textarea:disabled {
231
+ background: #f9fafb;
232
+ cursor: not-allowed;
233
+ }
234
+
235
+ .panel-footer {
236
+ display: flex;
237
+ align-items: center;
238
+ justify-content: space-between;
239
+ padding: 12px 16px;
240
+ border-top: 1px solid var(--or-border);
241
+ }
242
+
243
+ .hint {
244
+ font-size: 12px;
245
+ color: var(--or-text-muted);
246
+ }
247
+
248
+ .hint kbd {
249
+ background: #f3f4f6;
250
+ padding: 2px 6px;
251
+ border-radius: 4px;
252
+ font-family: inherit;
253
+ font-size: 11px;
254
+ }
255
+
256
+ .submit-btn {
257
+ display: flex;
258
+ align-items: center;
259
+ gap: 6px;
260
+ padding: 8px 16px;
261
+ background: var(--or-primary);
262
+ color: white;
263
+ border: none;
264
+ border-radius: 8px;
265
+ font-size: 14px;
266
+ font-weight: 500;
267
+ cursor: pointer;
268
+ transition: background-color 0.15s ease;
269
+ }
270
+
271
+ .submit-btn:hover:not(:disabled) {
272
+ background: var(--or-primary-hover);
273
+ }
274
+
275
+ .submit-btn:disabled {
276
+ opacity: 0.6;
277
+ cursor: not-allowed;
278
+ }
279
+
280
+ .submit-btn svg {
281
+ width: 16px;
282
+ height: 16px;
283
+ fill: currentColor;
284
+ }
285
+
286
+ .spinner {
287
+ width: 16px;
288
+ height: 16px;
289
+ border: 2px solid transparent;
290
+ border-top-color: currentColor;
291
+ border-radius: 50%;
292
+ animation: spin 0.6s linear infinite;
293
+ }
294
+
295
+ @keyframes spin {
296
+ to { transform: rotate(360deg); }
297
+ }
298
+
299
+ .success-content {
300
+ display: none;
301
+ flex-direction: column;
302
+ align-items: center;
303
+ justify-content: center;
304
+ padding: 32px 16px;
305
+ text-align: center;
306
+ }
307
+
308
+ .success-content.visible {
309
+ display: flex;
310
+ }
311
+
312
+ .success-icon {
313
+ width: 48px;
314
+ height: 48px;
315
+ background: #d1fae5;
316
+ border-radius: 50%;
317
+ display: flex;
318
+ align-items: center;
319
+ justify-content: center;
320
+ margin-bottom: 12px;
321
+ }
322
+
323
+ .success-icon svg {
324
+ width: 24px;
325
+ height: 24px;
326
+ stroke: var(--or-success);
327
+ fill: none;
328
+ stroke-width: 3;
329
+ }
330
+
331
+ .success-title {
332
+ font-weight: 600;
333
+ font-size: 16px;
334
+ margin-bottom: 4px;
335
+ }
336
+
337
+ .success-subtitle {
338
+ color: var(--or-text-muted);
339
+ font-size: 13px;
340
+ }
341
+
342
+ .form-content {
343
+ display: flex;
344
+ flex-direction: column;
345
+ }
346
+
347
+ .form-content.hidden {
348
+ display: none;
349
+ }
350
+
351
+ /* Mobile bottom sheet */
352
+ @media (max-width: 640px) {
353
+ .panel {
354
+ bottom: 0;
355
+ right: 0;
356
+ left: 0;
357
+ width: 100%;
358
+ border-radius: 16px 16px 0 0;
359
+ animation: slideUp 0.2s ease;
360
+ }
361
+
362
+ @keyframes slideUp {
363
+ from {
364
+ opacity: 0;
365
+ transform: translateY(100%);
366
+ }
367
+ to {
368
+ opacity: 1;
369
+ transform: translateY(0);
370
+ }
371
+ }
372
+
373
+ .panel::before {
374
+ content: '';
375
+ display: block;
376
+ width: 36px;
377
+ height: 4px;
378
+ background: var(--or-border);
379
+ border-radius: 2px;
380
+ margin: 8px auto;
381
+ }
382
+
383
+ .trigger {
384
+ bottom: 16px;
385
+ right: 16px;
386
+ }
387
+ }
388
+ `;
389
+
390
+ // src/feedback/Feedback.ts
391
+ var Feedback = class {
392
+ constructor(config) {
393
+ chunk4DE2IREA_cjs.__publicField(this, "config");
394
+ chunk4DE2IREA_cjs.__publicField(this, "root", null);
395
+ chunk4DE2IREA_cjs.__publicField(this, "shadow", null);
396
+ chunk4DE2IREA_cjs.__publicField(this, "store", {
397
+ state: "closed",
398
+ content: "",
399
+ error: null
400
+ });
401
+ this.config = config;
402
+ }
403
+ mount() {
404
+ if (this.root) return;
405
+ this.root = document.createElement("div");
406
+ this.root.id = "ourroadmaps-widget-root";
407
+ document.body.appendChild(this.root);
408
+ this.shadow = this.root.attachShadow({ mode: "open" });
409
+ this.render();
410
+ this.attachEventListeners();
411
+ }
412
+ unmount() {
413
+ if (this.root) {
414
+ this.root.remove();
415
+ this.root = null;
416
+ this.shadow = null;
417
+ }
418
+ }
419
+ setState(partial) {
420
+ this.store = { ...this.store, ...partial };
421
+ this.render();
422
+ }
423
+ render() {
424
+ if (!this.shadow) return;
425
+ const { state, content, error } = this.store;
426
+ const isOpen = state !== "closed";
427
+ const isSubmitting = state === "submitting";
428
+ const isSuccess = state === "success";
429
+ const isError = state === "error";
430
+ this.shadow.innerHTML = `
431
+ <style>${WIDGET_STYLES}</style>
432
+
433
+ <button class="trigger ${isOpen ? "hidden" : ""}" aria-label="Open feedback">
434
+ ${ICONS.lightbulb}
435
+ </button>
436
+
437
+ <div class="panel ${isOpen ? "open" : ""}" role="dialog" aria-label="Share feedback">
438
+ <div class="panel-header">
439
+ <span class="panel-title">Share feedback</span>
440
+ <button class="close-btn" aria-label="Close">
441
+ ${ICONS.close}
442
+ </button>
443
+ </div>
444
+
445
+ <div class="success-content ${isSuccess ? "visible" : ""}">
446
+ <div class="success-icon">
447
+ ${ICONS.check}
448
+ </div>
449
+ <div class="success-title">Feedback sent!</div>
450
+ <div class="success-subtitle">Thanks for sharing your thoughts.</div>
451
+ </div>
452
+
453
+ <div class="form-content ${isSuccess ? "hidden" : ""}">
454
+ <div class="panel-body">
455
+ <div class="error-banner ${isError ? "visible" : ""}">
456
+ <div class="error-text">${error || "Couldn't save. Your note is preserved."}</div>
457
+ <button class="retry-btn">Try again</button>
458
+ </div>
459
+ <textarea
460
+ placeholder="What's on your mind?"
461
+ ${isSubmitting ? "disabled" : ""}
462
+ >${content}</textarea>
463
+ </div>
464
+
465
+ <div class="panel-footer">
466
+ <span class="hint"><kbd>\u2318</kbd> <kbd>\u21B5</kbd> to send</span>
467
+ <button class="submit-btn" ${isSubmitting || !content.trim() ? "disabled" : ""}>
468
+ ${isSubmitting ? '<span class="spinner"></span>' : ICONS.send}
469
+ ${isSubmitting ? "Sending..." : "Send"}
470
+ </button>
471
+ </div>
472
+ </div>
473
+ </div>
474
+ `;
475
+ }
476
+ attachEventListeners() {
477
+ if (!this.shadow) return;
478
+ this.shadow.addEventListener("click", (e) => {
479
+ const target = e.target;
480
+ if (target.closest(".trigger")) {
481
+ this.open();
482
+ } else if (target.closest(".close-btn")) {
483
+ this.close();
484
+ } else if (target.closest(".submit-btn")) {
485
+ this.submit();
486
+ } else if (target.closest(".retry-btn")) {
487
+ this.submit();
488
+ }
489
+ });
490
+ this.shadow.addEventListener("input", (e) => {
491
+ const target = e.target;
492
+ if (target.tagName === "TEXTAREA") {
493
+ this.setState({ content: target.value, error: null, state: "open" });
494
+ }
495
+ });
496
+ this.shadow.addEventListener("keydown", (e) => {
497
+ const ke = e;
498
+ if (ke.key === "Escape") {
499
+ this.close();
500
+ } else if ((ke.metaKey || ke.ctrlKey) && ke.key === "Enter") {
501
+ this.submit();
502
+ }
503
+ });
504
+ document.addEventListener("click", (e) => {
505
+ if (this.store.state !== "closed" && this.root && !this.root.contains(e.target)) {
506
+ this.close();
507
+ }
508
+ });
509
+ }
510
+ open() {
511
+ this.setState({ state: "open" });
512
+ setTimeout(() => {
513
+ const textarea = this.shadow?.querySelector("textarea");
514
+ textarea?.focus();
515
+ }, 50);
516
+ }
517
+ close() {
518
+ this.setState({ state: "closed", error: null });
519
+ }
520
+ async submit() {
521
+ const { content } = this.store;
522
+ if (!content.trim()) return;
523
+ this.setState({ state: "submitting", error: null });
524
+ try {
525
+ await submitFeedback(this.config.apiKey, content);
526
+ this.setState({ state: "success", content: "" });
527
+ setTimeout(() => this.close(), 1500);
528
+ } catch (err) {
529
+ const message = err instanceof Error ? err.message : "Failed to submit";
530
+ this.setState({ state: "error", error: message });
531
+ }
532
+ }
533
+ };
534
+
535
+ exports.Feedback = Feedback;
536
+ //# sourceMappingURL=chunk-KGQKTDB4.cjs.map
537
+ //# sourceMappingURL=chunk-KGQKTDB4.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/feedback/api.ts","../src/feedback/icons.ts","../src/feedback/styles.ts","../src/feedback/Feedback.ts"],"names":["__publicField"],"mappings":";;;;;;AAGA,IAAM,WAAW,MAAM;AAErB,EAAA,IAAI,OAAO,+QAAA,KAAgB,WAAA,IAAe,WAAiB,YAAA,EAAc;AACvE,IAAA,OAAO,SAAY,CAAI,YAAA;AAAA,EACzB;AACA,EAAA,OAAO,6BAAA;AACT,CAAA,GAAG;AAEH,eAAsB,cAAA,CAAe,QAAgB,OAAA,EAAuC;AAC1F,EAAA,MAAM,QAAQ,OAAA,CAAQ,KAAA,CAAM,GAAG,GAAG,CAAA,CAAE,MAAK,IAAK,UAAA;AAE9C,EAAA,MAAM,QAAA,GAAW,MAAM,KAAA,CAAM,CAAA,EAAG,OAAO,CAAA,SAAA,CAAA,EAAa;AAAA,IAClD,MAAA,EAAQ,MAAA;AAAA,IACR,OAAA,EAAS;AAAA,MACP,aAAA,EAAe,UAAU,MAAM,CAAA,CAAA;AAAA,MAC/B,cAAA,EAAgB;AAAA,KAClB;AAAA,IACA,IAAA,EAAM,KAAK,SAAA,CAAU;AAAA,MACnB,KAAA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,SAAA,EAAW,OAAA,EAAS,IAAI,CAAA;AAC/C,MAAA,UAAA,CAAW,MAAM,IAAA,CAAK,KAAA,EAAM,EAAG,IAAI,CAAA;AAAA,IACrC,SAAS,GAAA,EAAK;AACZ,MAAA,MAAM,OAAA,GAAU,GAAA,YAAe,KAAA,GAAQ,GAAA,CAAI,OAAA,GAAU,kBAAA;AACrD,MAAA,IAAA,CAAK,SAAS,EAAE,KAAA,EAAO,OAAA,EAAS,KAAA,EAAO,SAAS,CAAA;AAAA,IAClD;AAAA,EACF;AACF","file":"chunk-KGQKTDB4.cjs","sourcesContent":["import type { ApiError, ApiResponse } from './types'\n\n// Default to production, override with env var for local dev\nconst API_URL = (() => {\n // Vite dev mode\n if (typeof import.meta !== 'undefined' && import.meta.env?.VITE_API_URL) {\n return import.meta.env.VITE_API_URL\n }\n return 'https://api.ourroadmaps.com'\n})()\n\nexport async function submitFeedback(apiKey: string, content: string): Promise<ApiResponse> {\n const title = content.slice(0, 100).trim() || 'Feedback'\n\n const response = await fetch(`${API_URL}/v1/ideas`, {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${apiKey}`,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n title,\n description: content,\n source: 'feedback-widget',\n }),\n })\n\n if (!response.ok) {\n const error: ApiError = await response.json().catch(() => ({\n error: 'Request failed',\n }))\n throw new Error(error.message || error.error || 'Failed to submit feedback')\n }\n\n return response.json()\n}\n","export const ICONS = {\n lightbulb: `<svg viewBox=\"0 0 24 24\" fill=\"currentColor\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M9 21c0 .55.45 1 1 1h4c.55 0 1-.45 1-1v-1H9v1zm3-19C8.14 2 5 5.14 5 9c0 2.38 1.19 4.47 3 5.74V17c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2.26c1.81-1.27 3-3.36 3-5.74 0-3.86-3.14-7-7-7zm2.85 11.1l-.85.6V16h-4v-2.3l-.85-.6A4.997 4.997 0 0 1 7 9c0-2.76 2.24-5 5-5s5 2.24 5 5c0 1.63-.8 3.16-2.15 4.1z\"/>\n </svg>`,\n\n close: `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M18 6L6 18M6 6l12 12\"/>\n </svg>`,\n\n send: `<svg viewBox=\"0 0 24 24\" fill=\"currentColor\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M2.01 21L23 12 2.01 3 2 10l15 2-15 2z\"/>\n </svg>`,\n\n check: `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M20 6L9 17l-5-5\"/>\n </svg>`,\n}\n","export const WIDGET_STYLES = `\n :host {\n --or-primary: #2563eb;\n --or-primary-hover: #1d4ed8;\n --or-success: #10b981;\n --or-error: #ef4444;\n --or-text: #1f2937;\n --or-text-muted: #6b7280;\n --or-bg: #ffffff;\n --or-border: #e5e7eb;\n --or-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);\n\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n font-size: 14px;\n line-height: 1.5;\n color: var(--or-text);\n }\n\n * {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n }\n\n .trigger {\n position: fixed;\n bottom: 20px;\n right: 20px;\n width: 48px;\n height: 48px;\n border-radius: 50%;\n background: var(--or-primary);\n border: none;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n box-shadow: var(--or-shadow);\n transition: transform 0.15s ease, background-color 0.15s ease;\n z-index: 2147483647;\n }\n\n .trigger:hover {\n background: var(--or-primary-hover);\n transform: scale(1.05);\n }\n\n .trigger svg {\n width: 24px;\n height: 24px;\n fill: white;\n }\n\n .trigger.hidden {\n display: none;\n }\n\n .panel {\n position: fixed;\n bottom: 80px;\n right: 20px;\n width: 320px;\n background: var(--or-bg);\n border-radius: 12px;\n box-shadow: var(--or-shadow);\n display: none;\n flex-direction: column;\n overflow: hidden;\n z-index: 2147483647;\n animation: slideIn 0.15s ease;\n }\n\n .panel.open {\n display: flex;\n }\n\n @keyframes slideIn {\n from {\n opacity: 0;\n transform: translateY(10px) scale(0.95);\n }\n to {\n opacity: 1;\n transform: translateY(0) scale(1);\n }\n }\n\n .panel-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 12px 16px;\n border-bottom: 1px solid var(--or-border);\n }\n\n .panel-title {\n font-weight: 600;\n font-size: 14px;\n }\n\n .close-btn {\n width: 28px;\n height: 28px;\n border: none;\n background: transparent;\n cursor: pointer;\n border-radius: 6px;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--or-text-muted);\n transition: background-color 0.15s ease;\n }\n\n .close-btn:hover {\n background: var(--or-border);\n }\n\n .panel-body {\n padding: 16px;\n display: flex;\n flex-direction: column;\n gap: 12px;\n }\n\n .error-banner {\n background: #fef2f2;\n border: 1px solid #fecaca;\n border-radius: 8px;\n padding: 12px;\n display: none;\n }\n\n .error-banner.visible {\n display: block;\n }\n\n .error-text {\n color: var(--or-error);\n font-size: 13px;\n margin-bottom: 8px;\n }\n\n .retry-btn {\n background: transparent;\n border: 1px solid var(--or-error);\n color: var(--or-error);\n padding: 4px 12px;\n border-radius: 6px;\n font-size: 13px;\n cursor: pointer;\n transition: background-color 0.15s ease;\n }\n\n .retry-btn:hover {\n background: #fef2f2;\n }\n\n textarea {\n width: 100%;\n min-height: 80px;\n max-height: 200px;\n padding: 12px;\n border: 1px solid var(--or-border);\n border-radius: 8px;\n resize: none;\n font-family: inherit;\n font-size: 14px;\n line-height: 1.5;\n outline: none;\n transition: border-color 0.15s ease;\n }\n\n textarea:focus {\n border-color: var(--or-primary);\n }\n\n textarea:disabled {\n background: #f9fafb;\n cursor: not-allowed;\n }\n\n .panel-footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 12px 16px;\n border-top: 1px solid var(--or-border);\n }\n\n .hint {\n font-size: 12px;\n color: var(--or-text-muted);\n }\n\n .hint kbd {\n background: #f3f4f6;\n padding: 2px 6px;\n border-radius: 4px;\n font-family: inherit;\n font-size: 11px;\n }\n\n .submit-btn {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 8px 16px;\n background: var(--or-primary);\n color: white;\n border: none;\n border-radius: 8px;\n font-size: 14px;\n font-weight: 500;\n cursor: pointer;\n transition: background-color 0.15s ease;\n }\n\n .submit-btn:hover:not(:disabled) {\n background: var(--or-primary-hover);\n }\n\n .submit-btn:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n .submit-btn svg {\n width: 16px;\n height: 16px;\n fill: currentColor;\n }\n\n .spinner {\n width: 16px;\n height: 16px;\n border: 2px solid transparent;\n border-top-color: currentColor;\n border-radius: 50%;\n animation: spin 0.6s linear infinite;\n }\n\n @keyframes spin {\n to { transform: rotate(360deg); }\n }\n\n .success-content {\n display: none;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 32px 16px;\n text-align: center;\n }\n\n .success-content.visible {\n display: flex;\n }\n\n .success-icon {\n width: 48px;\n height: 48px;\n background: #d1fae5;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n margin-bottom: 12px;\n }\n\n .success-icon svg {\n width: 24px;\n height: 24px;\n stroke: var(--or-success);\n fill: none;\n stroke-width: 3;\n }\n\n .success-title {\n font-weight: 600;\n font-size: 16px;\n margin-bottom: 4px;\n }\n\n .success-subtitle {\n color: var(--or-text-muted);\n font-size: 13px;\n }\n\n .form-content {\n display: flex;\n flex-direction: column;\n }\n\n .form-content.hidden {\n display: none;\n }\n\n /* Mobile bottom sheet */\n @media (max-width: 640px) {\n .panel {\n bottom: 0;\n right: 0;\n left: 0;\n width: 100%;\n border-radius: 16px 16px 0 0;\n animation: slideUp 0.2s ease;\n }\n\n @keyframes slideUp {\n from {\n opacity: 0;\n transform: translateY(100%);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n\n .panel::before {\n content: '';\n display: block;\n width: 36px;\n height: 4px;\n background: var(--or-border);\n border-radius: 2px;\n margin: 8px auto;\n }\n\n .trigger {\n bottom: 16px;\n right: 16px;\n }\n }\n`\n","import { submitFeedback } from './api'\nimport { ICONS } from './icons'\nimport { WIDGET_STYLES } from './styles'\nimport type { WidgetConfig, WidgetStore } from './types'\n\nexport class Feedback {\n private config: WidgetConfig\n private root: HTMLElement | null = null\n private shadow: ShadowRoot | null = null\n private store: WidgetStore = {\n state: 'closed',\n content: '',\n error: null,\n }\n\n constructor(config: WidgetConfig) {\n this.config = config\n }\n\n mount(): void {\n if (this.root) return\n\n this.root = document.createElement('div')\n this.root.id = 'ourroadmaps-widget-root'\n document.body.appendChild(this.root)\n\n this.shadow = this.root.attachShadow({ mode: 'open' })\n this.render()\n this.attachEventListeners()\n }\n\n unmount(): void {\n if (this.root) {\n this.root.remove()\n this.root = null\n this.shadow = null\n }\n }\n\n private setState(partial: Partial<WidgetStore>): void {\n this.store = { ...this.store, ...partial }\n this.render()\n }\n\n private render(): void {\n if (!this.shadow) return\n\n const { state, content, error } = this.store\n const isOpen = state !== 'closed'\n const isSubmitting = state === 'submitting'\n const isSuccess = state === 'success'\n const isError = state === 'error'\n\n this.shadow.innerHTML = `\n <style>${WIDGET_STYLES}</style>\n\n <button class=\"trigger ${isOpen ? 'hidden' : ''}\" aria-label=\"Open feedback\">\n ${ICONS.lightbulb}\n </button>\n\n <div class=\"panel ${isOpen ? 'open' : ''}\" role=\"dialog\" aria-label=\"Share feedback\">\n <div class=\"panel-header\">\n <span class=\"panel-title\">Share feedback</span>\n <button class=\"close-btn\" aria-label=\"Close\">\n ${ICONS.close}\n </button>\n </div>\n\n <div class=\"success-content ${isSuccess ? 'visible' : ''}\">\n <div class=\"success-icon\">\n ${ICONS.check}\n </div>\n <div class=\"success-title\">Feedback sent!</div>\n <div class=\"success-subtitle\">Thanks for sharing your thoughts.</div>\n </div>\n\n <div class=\"form-content ${isSuccess ? 'hidden' : ''}\">\n <div class=\"panel-body\">\n <div class=\"error-banner ${isError ? 'visible' : ''}\">\n <div class=\"error-text\">${error || \"Couldn't save. Your note is preserved.\"}</div>\n <button class=\"retry-btn\">Try again</button>\n </div>\n <textarea\n placeholder=\"What's on your mind?\"\n ${isSubmitting ? 'disabled' : ''}\n >${content}</textarea>\n </div>\n\n <div class=\"panel-footer\">\n <span class=\"hint\"><kbd>⌘</kbd> <kbd>↵</kbd> to send</span>\n <button class=\"submit-btn\" ${isSubmitting || !content.trim() ? 'disabled' : ''}>\n ${isSubmitting ? '<span class=\"spinner\"></span>' : ICONS.send}\n ${isSubmitting ? 'Sending...' : 'Send'}\n </button>\n </div>\n </div>\n </div>\n `\n }\n\n private attachEventListeners(): void {\n if (!this.shadow) return\n\n this.shadow.addEventListener('click', (e) => {\n const target = e.target as HTMLElement\n\n if (target.closest('.trigger')) {\n this.open()\n } else if (target.closest('.close-btn')) {\n this.close()\n } else if (target.closest('.submit-btn')) {\n this.submit()\n } else if (target.closest('.retry-btn')) {\n this.submit()\n }\n })\n\n this.shadow.addEventListener('input', (e) => {\n const target = e.target as HTMLTextAreaElement\n if (target.tagName === 'TEXTAREA') {\n this.setState({ content: target.value, error: null, state: 'open' })\n }\n })\n\n this.shadow.addEventListener('keydown', (e) => {\n const ke = e as KeyboardEvent\n if (ke.key === 'Escape') {\n this.close()\n } else if ((ke.metaKey || ke.ctrlKey) && ke.key === 'Enter') {\n this.submit()\n }\n })\n\n document.addEventListener('click', (e) => {\n if (this.store.state !== 'closed' && this.root && !this.root.contains(e.target as Node)) {\n this.close()\n }\n })\n }\n\n private open(): void {\n this.setState({ state: 'open' })\n setTimeout(() => {\n const textarea = this.shadow?.querySelector('textarea')\n textarea?.focus()\n }, 50)\n }\n\n private close(): void {\n this.setState({ state: 'closed', error: null })\n }\n\n private async submit(): Promise<void> {\n const { content } = this.store\n if (!content.trim()) return\n\n this.setState({ state: 'submitting', error: null })\n\n try {\n await submitFeedback(this.config.apiKey, content)\n this.setState({ state: 'success', content: '' })\n setTimeout(() => this.close(), 1500)\n } catch (err) {\n const message = err instanceof Error ? err.message : 'Failed to submit'\n this.setState({ state: 'error', error: message })\n }\n }\n}\n"]}