@upstep/js 0.5.12 → 0.6.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/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { U as M } from "./api-DIQt-yuC.mjs";
1
+ import { U as M } from "./api-C1UV7Szw.mjs";
2
2
  const E = "#D97757", x = {
3
3
  bg: "#ffffff",
4
4
  bgSoft: "#f6f5f2",
@@ -9,7 +9,7 @@ const E = "#D97757", x = {
9
9
  border: "#e8e6df",
10
10
  overlay: "rgba(26,25,21,.45)"
11
11
  }, m = {
12
- bg: "#1c1b19",
12
+ bg: "#000000",
13
13
  bgSoft: "#262522",
14
14
  bgHover: "#302e2a",
15
15
  text: "#f5f4f0",
@@ -21,70 +21,76 @@ const E = "#D97757", x = {
21
21
  function y(o) {
22
22
  if (o === "light" || o === "dark") return o;
23
23
  if (typeof document < "u") {
24
- const e = document.documentElement;
25
- return e.classList.contains("dark") || e.getAttribute("data-theme") === "dark" ? "dark" : "light";
24
+ const t = document.documentElement;
25
+ return t.classList.contains("dark") || t.getAttribute("data-theme") === "dark" ? "dark" : "light";
26
26
  }
27
27
  return typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
28
28
  }
29
- function L(o, e, t) {
29
+ function S(o, t, e) {
30
30
  return `
31
31
  #upstep-root *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif}
32
- #upstep-btn{position:fixed;bottom:24px;${e === "left" ? "left:24px" : "right:24px"};z-index:9998;display:inline-flex;align-items:center;gap:7px;background:${o};color:#fff;border:none;border-radius:9999px;padding:12px 18px;font-size:14px;font-weight:600;cursor:grab;touch-action:none;box-shadow:0 6px 20px rgba(26,25,21,.18);transition:transform .15s,box-shadow .15s}
32
+ #upstep-btn{position:fixed;bottom:24px;${t === "left" ? "left:24px" : "right:24px"};z-index:9998;display:inline-flex;align-items:center;gap:7px;background:${o};color:#fff;border:none;border-radius:9999px;padding:12px 18px;font-size:14px;font-weight:600;cursor:grab;touch-action:none;box-shadow:0 6px 20px rgba(26,25,21,.18);transition:transform .15s,box-shadow .15s}
33
33
  #upstep-btn svg{width:16px;height:16px;flex-shrink:0}
34
34
  #upstep-btn:hover{transform:translateY(-1px);box-shadow:0 8px 26px rgba(26,25,21,.24)}
35
35
  #upstep-btn.upstep-dragging{cursor:grabbing;transform:scale(1.06);box-shadow:0 10px 32px rgba(26,25,21,.28);transition:transform .08s,box-shadow .08s}
36
36
  @media(max-width:639px){#upstep-btn{padding:12px}#upstep-btn span{display:none}}
37
- #upstep-backdrop{position:fixed;inset:0;background:${t.overlay};backdrop-filter:blur(3px);z-index:9999;display:flex;align-items:center;justify-content:center;padding:16px;animation:upstep-fade .2s ease}
37
+ #upstep-backdrop{position:fixed;inset:0;background:${e.overlay};backdrop-filter:blur(3px);z-index:9999;display:flex;align-items:center;justify-content:center;padding:16px;animation:upstep-fade .2s ease}
38
38
  @keyframes upstep-fade{from{opacity:0}to{opacity:1}}
39
39
  @keyframes upstep-rise{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:translateY(0)}}
40
- #upstep-modal{background:${t.bg};border:1px solid ${t.border};border-radius:20px;width:100%;max-width:440px;max-height:88vh;display:flex;flex-direction:column;overflow:hidden;box-shadow:0 24px 64px rgba(0,0,0,.28);animation:upstep-rise .26s cubic-bezier(.16,1,.3,1)}
40
+ #upstep-modal{background:${e.bg};border:1px solid ${e.border};border-radius:20px;width:100%;max-width:440px;max-height:88vh;display:flex;flex-direction:column;overflow:hidden;box-shadow:0 24px 64px rgba(0,0,0,.28);animation:upstep-rise .26s cubic-bezier(.16,1,.3,1)}
41
41
  #upstep-header{display:flex;align-items:flex-start;justify-content:space-between;padding:20px 20px 0}
42
- #upstep-header h2{margin:0;font-size:16px;font-weight:700;color:${t.text};letter-spacing:-.01em}
43
- #upstep-header p{margin:2px 0 0;font-size:12.5px;color:${t.textFaint}}
44
- #upstep-close{background:${t.bgSoft};border:none;width:28px;height:28px;border-radius:8px;font-size:14px;cursor:pointer;color:${t.textSoft};line-height:1;display:flex;align-items:center;justify-content:center;transition:background .15s}
45
- #upstep-close:hover{background:${t.bgHover};color:${t.text}}
46
- #upstep-tabs{display:flex;gap:4px;margin:16px 20px 0;padding:4px;background:${t.bgSoft};border-radius:11px}
47
- .upstep-tab{flex:1;padding:8px;background:none;border:none;border-radius:8px;font-size:13px;font-weight:600;color:${t.textSoft};cursor:pointer;transition:all .15s}
48
- .upstep-tab.active{background:${t.bg};color:${t.text};box-shadow:0 1px 3px rgba(0,0,0,.08)}
42
+ #upstep-header h2{margin:0;font-size:16px;font-weight:700;color:${e.text};letter-spacing:-.01em}
43
+ #upstep-header p{margin:2px 0 0;font-size:12.5px;color:${e.textFaint}}
44
+ #upstep-close{background:${e.bgSoft};border:none;width:28px;height:28px;border-radius:8px;font-size:14px;cursor:pointer;color:${e.textSoft};line-height:1;display:flex;align-items:center;justify-content:center;transition:background .15s}
45
+ #upstep-close:hover{background:${e.bgHover};color:${e.text}}
46
+ #upstep-tabs{display:flex;gap:4px;margin:16px 20px 0;padding:4px;background:${e.bgSoft};border-radius:11px}
47
+ .upstep-tab{flex:1;padding:8px;background:none;border:none;border-radius:8px;font-size:13px;font-weight:600;color:${e.textSoft};cursor:pointer;transition:all .15s}
48
+ .upstep-mode .upstep-tab.active{background:${e.bgSoft};box-shadow:none}
49
+ .upstep-tab.active{background:${e.bg};color:${e.text};box-shadow:0 1px 3px rgba(0,0,0,.08)}
49
50
  #upstep-body{flex:1;overflow-y:auto;padding:18px 20px 22px}
50
- .upstep-form textarea{width:100%;min-height:104px;border:1px solid ${t.border};border-radius:12px;padding:12px;font-size:14px;line-height:1.5;resize:vertical;outline:none;background:${t.bgSoft};color:${t.text};transition:border-color .15s}
51
- .upstep-form textarea::placeholder{color:${t.textFaint}}
52
- .upstep-form textarea:focus{border-color:${o};background:${t.bg}}
51
+ .upstep-form textarea{width:100%;min-height:104px;border:1px solid ${e.border};border-radius:12px;padding:12px;font-size:14px;line-height:1.5;resize:vertical;outline:none;background:${e.bgSoft};color:${e.text};transition:border-color .15s}
52
+ .upstep-form textarea::placeholder{color:${e.textFaint}}
53
+ .upstep-form textarea:focus{border-color:${o};background:${e.bg}}
53
54
  .upstep-type-row{display:flex;gap:7px;margin:12px 0 4px}
54
- .upstep-type-btn{flex:1;display:flex;align-items:center;justify-content:center;gap:5px;padding:8px 10px;border-radius:9px;border:1px solid ${t.border};background:${t.bg};color:${t.textSoft};font-size:12.5px;font-weight:600;cursor:pointer;transition:all .15s}
55
+ .upstep-type-btn{flex:1;display:flex;align-items:center;justify-content:center;gap:5px;padding:8px 10px;border-radius:9px;border:1px solid ${e.border};background:${e.bg};color:${e.textSoft};font-size:12.5px;font-weight:600;cursor:pointer;transition:all .15s}
55
56
  .upstep-type-btn svg{width:12px;height:12px;flex-shrink:0}
56
- .upstep-type-btn:hover{border-color:${t.textFaint}}
57
+ .upstep-type-btn:hover{border-color:${e.textFaint}}
57
58
  .upstep-type-btn.selected{background:${o};color:#fff;border-color:${o}}
58
59
  .upstep-submit{width:100%;padding:12px;background:${o};color:#fff;border:none;border-radius:11px;font-size:14px;font-weight:600;cursor:pointer;margin-top:14px;transition:filter .15s}
59
60
  .upstep-submit:hover{filter:brightness(.94)}
60
61
  .upstep-submit:disabled{opacity:.5;cursor:not-allowed}
61
62
  #upstep-form-msg{font-size:13px;text-align:center;margin-top:12px;color:${o};font-weight:500}
62
- .upstep-feedback-item{display:flex;gap:12px;padding:14px;border:1px solid ${t.border};border-radius:14px;margin-bottom:10px;background:${t.bg};transition:border-color .15s}
63
- .upstep-feedback-item:hover{border-color:${t.textFaint}}
64
- .upstep-vote{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;min-width:46px;padding:7px 0;border-radius:11px;border:1px solid ${t.border};background:${t.bgSoft};cursor:pointer;transition:all .15s}
63
+ .upstep-feedback-item{display:flex;gap:12px;padding:14px;border:1px solid ${e.border};border-radius:14px;margin-bottom:10px;background:${e.bg};transition:border-color .15s}
64
+ .upstep-feedback-item:hover{border-color:${e.textFaint}}
65
+ .upstep-vote{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;min-width:46px;padding:7px 0;border-radius:11px;border:1px solid ${e.border};background:${e.bgSoft};cursor:pointer;transition:all .15s}
65
66
  .upstep-vote:hover{border-color:${o}}
66
67
  .upstep-vote.voted{border-color:${o};background:${o}1a}
67
68
  .upstep-vote-arrow{font-size:11px;line-height:1;color:${o}}
68
- .upstep-vote-count{font-size:14px;font-weight:700;color:${t.text};line-height:1.1}
69
+ .upstep-vote-count{font-size:14px;font-weight:700;color:${e.text};line-height:1.1}
69
70
  .upstep-feedback-main{flex:1;min-width:0}
70
- .upstep-feedback-content{font-size:13.5px;line-height:1.5;color:${t.text};margin:0 0 8px;word-break:break-word}
71
+ .upstep-feedback-content{font-size:13.5px;line-height:1.5;color:${e.text};margin:0 0 8px;word-break:break-word}
71
72
  .upstep-feedback-meta{display:flex;align-items:center;gap:7px}
72
73
  .upstep-badge{display:inline-flex;align-items:center;padding:2px 8px;border-radius:9999px;font-size:10.5px;font-weight:700;letter-spacing:.02em}
73
74
  .upstep-badge-bug{background:#fdecec;color:#d6453d}
74
75
  .upstep-badge-feature{background:#e9f0fd;color:#3b76d6}
75
- .upstep-badge-general{background:${t.bgSoft};color:${t.textSoft}}
76
- .upstep-feedback-date{font-size:11px;color:${t.textFaint}}
77
- .upstep-empty{text-align:center;color:${t.textFaint};font-size:14px;padding:40px 0}
78
- .upstep-empty strong{display:block;color:${t.textSoft};font-size:15px;margin-bottom:4px}
76
+ .upstep-badge-general{background:${e.bgSoft};color:${e.textSoft}}
77
+ .upstep-feedback-date{font-size:11px;color:${e.textFaint}}
78
+ .upstep-empty{text-align:center;color:${e.textFaint};font-size:14px;padding:40px 0}
79
+ .upstep-empty strong{display:block;color:${e.textSoft};font-size:15px;margin-bottom:4px}
79
80
  `;
80
81
  }
81
- const S = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>';
82
+ const L = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>';
82
83
  class F {
83
- constructor(e, t = {}) {
84
- this.isOpen = !1, this.tab = "submit", this.feedItems = [], this.selectedType = "GENERAL", this.loading = !1, this.dragMoved = !1, this.client = e, this.accent = t.accentColor ?? E, this.position = t.position ?? "right", this.showLauncher = t.launcher !== !1, this.themeMode = t.theme ?? "auto", this.palette = y(this.themeMode) === "dark" ? m : x;
84
+ constructor(t, e = {}) {
85
+ this.isOpen = !1, this.tab = "submit", this.feedItems = [], this.selectedType = "GENERAL", this.loading = !1, this.dragMoved = !1, this.hasSupport = !1, this.disconnectSupport = null, this.client = t, this.accent = e.accentColor ?? E, this.position = e.position ?? "right", this.showLauncher = e.launcher !== !1, this.themeMode = e.theme ?? "auto", this.palette = y(this.themeMode) === "dark" ? m : x;
85
86
  }
86
87
  mount() {
87
- this.injectStyles(), this.showLauncher && this.renderButton();
88
+ this.injectStyles(), this.showLauncher && this.renderButton(), this.client.supportEnabled().then((t) => {
89
+ if (this.hasSupport = t, t) {
90
+ const e = document.querySelector("#upstep-btn span");
91
+ e && (e.textContent = "Help & feedback"), this.isOpen && this.renderModal();
92
+ }
93
+ });
88
94
  }
89
95
  /** Open the feedback modal programmatically (e.g. from your own button). */
90
96
  openWidget() {
@@ -95,93 +101,86 @@ class F {
95
101
  this.closeModal();
96
102
  }
97
103
  injectStyles() {
98
- var t;
99
- (t = document.getElementById("upstep-styles")) == null || t.remove();
100
- const e = document.createElement("style");
101
- e.id = "upstep-styles", e.textContent = L(this.accent, this.position, this.palette), document.head.appendChild(e);
104
+ var e;
105
+ (e = document.getElementById("upstep-styles")) == null || e.remove();
106
+ const t = document.createElement("style");
107
+ t.id = "upstep-styles", t.textContent = S(this.accent, this.position, this.palette), document.head.appendChild(t);
102
108
  }
103
109
  renderButton() {
104
- const e = document.createElement("button");
105
- e.id = "upstep-btn", e.innerHTML = `${S}<span>Feedback</span>`, e.addEventListener("click", () => {
110
+ const t = document.createElement("button");
111
+ t.id = "upstep-btn", t.setAttribute("aria-label", "Open help and feedback"), t.innerHTML = `${L}<span>Feedback</span>`, t.addEventListener("click", () => {
106
112
  this.dragMoved || this.openModal();
107
- }), document.body.appendChild(e), this.makeDraggable(e);
113
+ }), document.body.appendChild(t), this.makeDraggable(t);
108
114
  }
109
- makeDraggable(e) {
115
+ makeDraggable(t) {
110
116
  const s = "upstep-btn-pos";
111
117
  try {
112
118
  const i = localStorage.getItem(s);
113
119
  if (i) {
114
- const { side: a, bottom: u } = JSON.parse(i);
115
- e.style.left = a === "left" ? "24px" : "auto", e.style.right = a === "right" ? "24px" : "auto", e.style.top = "auto", e.style.bottom = `${u}px`;
120
+ const { side: d, bottom: u } = JSON.parse(i);
121
+ t.style.left = d === "left" ? "24px" : "auto", t.style.right = d === "right" ? "24px" : "auto", t.style.top = "auto", t.style.bottom = `${u}px`;
116
122
  }
117
123
  } catch {
118
124
  }
119
- let r = 0, c = 0, d = 0, h = 0, b = !1;
125
+ let n = 0, r = 0, l = 0, h = 0, b = !1;
120
126
  const k = () => {
121
- const i = e.getBoundingClientRect(), a = i.left + i.width / 2 < window.innerWidth / 2 ? "left" : "right", u = Math.max(24, Math.min(window.innerHeight - i.height - 24, i.top)), g = window.innerHeight - u - i.height;
122
- e.style.transition = "left .25s cubic-bezier(.16,1,.3,1),right .25s cubic-bezier(.16,1,.3,1),top .25s cubic-bezier(.16,1,.3,1),bottom .25s cubic-bezier(.16,1,.3,1),transform .15s,box-shadow .15s", e.style.left = a === "left" ? "24px" : "auto", e.style.right = a === "right" ? "24px" : "auto", e.style.top = "auto", e.style.bottom = `${g}px`;
127
+ const i = t.getBoundingClientRect(), d = i.left + i.width / 2 < window.innerWidth / 2 ? "left" : "right", u = Math.max(24, Math.min(window.innerHeight - i.height - 24, i.top)), g = window.innerHeight - u - i.height;
128
+ t.style.transition = "left .25s cubic-bezier(.16,1,.3,1),right .25s cubic-bezier(.16,1,.3,1),top .25s cubic-bezier(.16,1,.3,1),bottom .25s cubic-bezier(.16,1,.3,1),transform .15s,box-shadow .15s", t.style.left = d === "left" ? "24px" : "auto", t.style.right = d === "right" ? "24px" : "auto", t.style.top = "auto", t.style.bottom = `${g}px`;
123
129
  try {
124
- localStorage.setItem(s, JSON.stringify({ side: a, bottom: g }));
130
+ localStorage.setItem(s, JSON.stringify({ side: d, bottom: g }));
125
131
  } catch {
126
132
  }
127
133
  }, w = (i) => {
128
134
  if (i.pointerType === "mouse" && i.button !== 0) return;
129
135
  this.dragMoved = !1, b = !0;
130
- const a = e.getBoundingClientRect();
131
- r = i.clientX, c = i.clientY, d = a.left, h = a.top, e.setPointerCapture(i.pointerId), e.style.transition = "none";
136
+ const d = t.getBoundingClientRect();
137
+ n = i.clientX, r = i.clientY, l = d.left, h = d.top, t.setPointerCapture(i.pointerId), t.style.transition = "none";
132
138
  }, $ = (i) => {
133
139
  if (!b) return;
134
- const a = i.clientX - r, u = i.clientY - c;
135
- !this.dragMoved && Math.hypot(a, u) < 6 || (this.dragMoved || e.classList.add("upstep-dragging"), this.dragMoved = !0, e.style.left = `${d + a}px`, e.style.right = "auto", e.style.top = `${h + u}px`, e.style.bottom = "auto");
140
+ const d = i.clientX - n, u = i.clientY - r;
141
+ !this.dragMoved && Math.hypot(d, u) < 6 || (this.dragMoved || t.classList.add("upstep-dragging"), this.dragMoved = !0, t.style.left = `${l + d}px`, t.style.right = "auto", t.style.top = `${h + u}px`, t.style.bottom = "auto");
136
142
  }, f = () => {
137
- b && (b = !1, e.classList.remove("upstep-dragging"), this.dragMoved && k());
143
+ b && (b = !1, t.classList.remove("upstep-dragging"), this.dragMoved && k());
138
144
  };
139
- e.addEventListener("pointerdown", w), e.addEventListener("pointermove", $), e.addEventListener("pointerup", f), e.addEventListener("pointercancel", f);
145
+ t.addEventListener("pointerdown", w), t.addEventListener("pointermove", $), t.addEventListener("pointerup", f), t.addEventListener("pointercancel", f);
140
146
  }
141
147
  openModal() {
142
148
  this.isOpen = !0, this.palette = y(this.themeMode) === "dark" ? m : x, this.injectStyles(), this.fetchFeed(), this.renderModal();
143
149
  }
144
150
  closeModal() {
145
- var e;
146
- this.isOpen = !1, (e = document.getElementById("upstep-backdrop")) == null || e.remove();
151
+ var t, e;
152
+ (t = this.disconnectSupport) == null || t.call(this), this.disconnectSupport = null, this.isOpen = !1, (e = document.getElementById("upstep-backdrop")) == null || e.remove();
147
153
  }
148
154
  async fetchFeed() {
149
155
  try {
150
- const e = await this.client.listFeedback({ sort: "votes", limit: 20 });
151
- this.feedItems = e.items, this.renderFeedList();
156
+ const t = await this.client.listFeedback({ sort: "votes", limit: 20 });
157
+ this.feedItems = t.items, this.renderFeedList();
152
158
  } catch {
153
159
  }
154
160
  }
155
161
  renderModal() {
156
- var t, n;
157
- const e = document.createElement("div");
158
- e.id = "upstep-backdrop", e.addEventListener("click", (s) => {
159
- s.target === e && this.closeModal();
160
- }), e.innerHTML = `
161
- <div id="upstep-modal">
162
- <div id="upstep-header">
163
- <div>
164
- <h2>Share your feedback</h2>
165
- <p>Tell us what to build next, or vote on ideas.</p>
166
- </div>
167
- <button id="upstep-close" aria-label="Close">✕</button>
168
- </div>
169
- <div id="upstep-tabs">
170
- <button class="upstep-tab ${this.tab === "submit" ? "active" : ""}" data-tab="submit">Give feedback</button>
171
- <button class="upstep-tab ${this.tab === "feed" ? "active" : ""}" data-tab="feed">Vote on ideas</button>
172
- </div>
173
- <div id="upstep-body">
174
- ${this.tab === "submit" ? this.renderSubmitForm() : this.renderFeed()}
162
+ var a, s, n;
163
+ (a = this.disconnectSupport) == null || a.call(this), this.disconnectSupport = null;
164
+ const t = document.createElement("div");
165
+ t.id = "upstep-backdrop", t.addEventListener("click", (r) => {
166
+ r.target === t && this.closeModal();
167
+ }), t.innerHTML = `
168
+ <div id="upstep-modal" style="max-width:${this.hasSupport ? "460px" : "440px"}">
169
+ ${this.hasSupport ? `<div class="upstep-mode" style="display:flex;align-items:center;gap:14px;padding:10px 14px;border-bottom:1px solid ${this.palette.border}"><div id="upstep-tabs" style="margin:0;padding:0;background:transparent;flex:1"><button class="upstep-tab ${this.tab === "support" ? "active" : ""}" data-tab="support">Support</button><button class="upstep-tab ${this.tab === "submit" ? "active" : ""}" data-tab="submit">Feedback</button><button class="upstep-tab ${this.tab === "feed" ? "active" : ""}" data-tab="feed">Ideas</button></div><button id="upstep-close" aria-label="Close" style="flex-shrink:0;background:transparent">✕</button></div>` : `<div id="upstep-header"><div><h2>Share your feedback</h2><p>Tell us what to build next, or vote on ideas.</p></div><button id="upstep-close" aria-label="Close">✕</button></div><div id="upstep-tabs"><button class="upstep-tab ${this.tab === "submit" ? "active" : ""}" data-tab="submit">Give feedback</button><button class="upstep-tab ${this.tab === "feed" ? "active" : ""}" data-tab="feed">Vote on ideas</button></div>`}
170
+ <div id="upstep-body" style="${this.tab === "support" ? "padding:0;overflow:hidden" : ""}">
171
+ ${this.tab === "support" ? `<iframe id="upstep-support-frame" title="Customer support" src="${this.client.supportFrameUrl(this.palette.bg === "#000000" ? "dark" : "light")}" style="width:100%;height:min(560px,calc(88dvh - 56px));min-height:300px;border:0;display:block"></iframe>` : this.tab === "submit" ? this.renderSubmitForm() : this.renderFeed()}
175
172
  </div>
176
173
  </div>
177
- `, (t = document.getElementById("upstep-backdrop")) == null || t.remove(), document.body.appendChild(e), (n = e.querySelector("#upstep-close")) == null || n.addEventListener("click", () => this.closeModal()), e.querySelectorAll(".upstep-tab").forEach((s) => {
178
- s.addEventListener("click", () => {
179
- this.tab = s.dataset.tab, this.renderModal();
174
+ `, (s = document.getElementById("upstep-backdrop")) == null || s.remove(), document.body.appendChild(t), (n = t.querySelector("#upstep-close")) == null || n.addEventListener("click", () => this.closeModal()), t.querySelectorAll(".upstep-tab").forEach((r) => {
175
+ r.addEventListener("click", () => {
176
+ this.tab = r.dataset.tab, this.renderModal();
180
177
  });
181
- }), this.bindSubmitForm(), this.bindVoteButtons();
178
+ });
179
+ const e = t.querySelector("#upstep-support-frame");
180
+ e && (this.disconnectSupport = this.client.connectSupportFrame(e)), this.bindSubmitForm(), this.bindVoteButtons();
182
181
  }
183
182
  renderSubmitForm() {
184
- const e = ["BUG", "FEATURE", "GENERAL"], t = { BUG: "Bug", FEATURE: "Feature", GENERAL: "General" }, n = {
183
+ const t = ["BUG", "FEATURE", "GENERAL"], e = { BUG: "Bug", FEATURE: "Feature", GENERAL: "General" }, a = {
185
184
  BUG: '<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><ellipse cx="8" cy="10" rx="3.5" ry="4.5"/><path d="M8 5.5V4M5.5 6.5 3.5 5M10.5 6.5 12.5 5M4.5 10.5 2.5 10M11.5 10.5 13.5 10"/></svg>',
186
185
  FEATURE: '<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M8 2v1.5M8 12.5V14M2 8h1.5M12.5 8H14M4.1 4.1l1 1M10.9 10.9l1 1M11.9 4.1l-1 1M5.1 10.9l-1 1"/><circle cx="8" cy="8" r="2.5"/></svg>',
187
186
  GENERAL: '<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M14 9a2 2 0 0 1-2 2H5L2 14V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v5z"/></svg>'
@@ -190,7 +189,7 @@ class F {
190
189
  <div class="upstep-form">
191
190
  <textarea id="upstep-textarea" placeholder="What's on your mind?" maxlength="2000"></textarea>
192
191
  <div class="upstep-type-row">
193
- ${e.map((s) => `<button class="upstep-type-btn${this.selectedType === s ? " selected" : ""}" data-type="${s}">${n[s]}${t[s]}</button>`).join("")}
192
+ ${t.map((s) => `<button class="upstep-type-btn${this.selectedType === s ? " selected" : ""}" data-type="${s}">${a[s]}${e[s]}</button>`).join("")}
194
193
  </div>
195
194
  <button class="upstep-submit" id="upstep-submit-btn">Send feedback</button>
196
195
  <div id="upstep-form-msg"></div>
@@ -199,20 +198,20 @@ class F {
199
198
  }
200
199
  renderFeed() {
201
200
  return this.feedItems.length ? this.feedItems.map(
202
- (e) => {
203
- var t;
201
+ (t) => {
202
+ var e;
204
203
  return `
205
- <div class="upstep-feedback-item" data-id="${e.id}">
206
- <button class="upstep-vote${e.userVote === "UP" ? " voted" : ""}" data-vote="UP" data-feedback="${e.id}">
204
+ <div class="upstep-feedback-item" data-id="${t.id}">
205
+ <button class="upstep-vote${t.userVote === "UP" ? " voted" : ""}" data-vote="UP" data-feedback="${t.id}">
207
206
  <span class="upstep-vote-arrow">▲</span>
208
- <span class="upstep-vote-count">${e.upvotes}</span>
207
+ <span class="upstep-vote-count">${t.upvotes}</span>
209
208
  </button>
210
209
  <div class="upstep-feedback-main">
211
- <p class="upstep-feedback-content">${v(e.content)}</p>
210
+ <p class="upstep-feedback-content">${v(t.content)}</p>
212
211
  <div class="upstep-feedback-meta">
213
- <span class="upstep-badge upstep-badge-${e.type.toLowerCase()}">${e.type}</span>
214
- <span class="upstep-badge upstep-badge-general">${v(((t = e.boardStatus) == null ? void 0 : t.name) ?? e.status.replace("_", " "))}</span>
215
- <span class="upstep-feedback-date">${new Date(e.createdAt).toLocaleDateString()}</span>
212
+ <span class="upstep-badge upstep-badge-${t.type.toLowerCase()}">${t.type}</span>
213
+ <span class="upstep-badge upstep-badge-general">${v(((e = t.boardStatus) == null ? void 0 : e.name) ?? t.status.replace("_", " "))}</span>
214
+ <span class="upstep-feedback-date">${new Date(t.createdAt).toLocaleDateString()}</span>
216
215
  </div>
217
216
  </div>
218
217
  </div>`;
@@ -220,25 +219,25 @@ class F {
220
219
  ).join("") : '<div class="upstep-empty"><strong>No ideas yet</strong>Be the first to share one.</div>';
221
220
  }
222
221
  renderFeedList() {
223
- const e = document.getElementById("upstep-body");
224
- !e || this.tab !== "feed" || (e.innerHTML = this.renderFeed(), this.bindVoteButtons());
222
+ const t = document.getElementById("upstep-body");
223
+ !t || this.tab !== "feed" || (t.innerHTML = this.renderFeed(), this.bindVoteButtons());
225
224
  }
226
225
  bindSubmitForm() {
227
- var e;
228
- document.querySelectorAll(".upstep-type-btn").forEach((t) => {
229
- t.addEventListener("click", () => {
230
- this.selectedType = t.dataset.type, document.querySelectorAll(".upstep-type-btn").forEach((n) => n.classList.remove("selected")), t.classList.add("selected");
226
+ var t;
227
+ document.querySelectorAll(".upstep-type-btn").forEach((e) => {
228
+ e.addEventListener("click", () => {
229
+ this.selectedType = e.dataset.type, document.querySelectorAll(".upstep-type-btn").forEach((a) => a.classList.remove("selected")), e.classList.add("selected");
231
230
  });
232
- }), (e = document.getElementById("upstep-submit-btn")) == null || e.addEventListener("click", async () => {
233
- const t = document.getElementById("upstep-textarea"), n = document.getElementById("upstep-form-msg"), s = document.getElementById("upstep-submit-btn");
234
- if (!t || this.loading) return;
235
- const r = t.value.trim();
236
- if (r) {
231
+ }), (t = document.getElementById("upstep-submit-btn")) == null || t.addEventListener("click", async () => {
232
+ const e = document.getElementById("upstep-textarea"), a = document.getElementById("upstep-form-msg"), s = document.getElementById("upstep-submit-btn");
233
+ if (!e || this.loading) return;
234
+ const n = e.value.trim();
235
+ if (n) {
237
236
  this.loading = !0, s && (s.disabled = !0, s.textContent = "Sending…");
238
237
  try {
239
- await this.client.submitFeedback({ content: r, type: this.selectedType }), t.value = "", n && (n.textContent = "Feedback received. Thank you."), await this.fetchFeed();
238
+ await this.client.submitFeedback({ content: n, type: this.selectedType }), e.value = "", a && (a.textContent = "Feedback received. Thank you."), await this.fetchFeed();
240
239
  } catch {
241
- n && (n.textContent = "Something went wrong. Please try again.");
240
+ a && (a.textContent = "Something went wrong. Please try again.");
242
241
  } finally {
243
242
  this.loading = !1, s && (s.disabled = !1, s.textContent = "Send feedback");
244
243
  }
@@ -246,11 +245,11 @@ class F {
246
245
  });
247
246
  }
248
247
  bindVoteButtons() {
249
- document.querySelectorAll(".upstep-vote").forEach((e) => {
250
- e.addEventListener("click", async () => {
251
- const t = e.dataset.feedback;
248
+ document.querySelectorAll(".upstep-vote").forEach((t) => {
249
+ t.addEventListener("click", async () => {
250
+ const e = t.dataset.feedback;
252
251
  try {
253
- await this.client.vote(t, "UP"), await this.fetchFeed();
252
+ await this.client.vote(e, "UP"), await this.fetchFeed();
254
253
  } catch {
255
254
  }
256
255
  });
@@ -260,41 +259,48 @@ class F {
260
259
  function v(o) {
261
260
  return o.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
262
261
  }
263
- let p = null, l = null;
262
+ let p = null, c = null;
264
263
  const C = {
265
264
  init(o) {
266
265
  if (p = new M(o), typeof window < "u") {
267
- const e = {};
268
- o.accentColor !== void 0 && (e.accentColor = o.accentColor), o.position !== void 0 && (e.position = o.position), o.theme !== void 0 && (e.theme = o.theme), o.launcher !== void 0 && (e.launcher = o.launcher);
269
- const t = () => {
270
- l = new F(p, e), l.mount();
266
+ const t = {};
267
+ o.accentColor !== void 0 && (t.accentColor = o.accentColor), o.position !== void 0 && (t.position = o.position), o.theme !== void 0 && (t.theme = o.theme), o.launcher !== void 0 && (t.launcher = o.launcher);
268
+ const e = () => {
269
+ c = new F(p, t), c.mount();
271
270
  };
272
- document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", t) : t();
271
+ document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", e) : e();
273
272
  }
274
273
  return p;
275
274
  },
276
275
  /** Open the feedback widget — use this to trigger it from your own UI. */
277
276
  open() {
278
- l == null || l.openWidget();
277
+ c == null || c.openWidget();
279
278
  },
280
279
  /** Close the feedback widget. */
281
280
  close() {
282
- l == null || l.closeWidget();
281
+ c == null || c.closeWidget();
283
282
  },
284
283
  /** Set / update the end-user id at runtime (e.g. after the user logs in). */
285
284
  identify(o) {
286
285
  p == null || p.setUserId(o);
287
286
  },
287
+ /** Change or clear verified support identity after login/logout. */
288
+ identifySupport(o) {
289
+ var e;
290
+ p && (p.supportIdentityToken = o);
291
+ const t = document.querySelector("#upstep-support-frame");
292
+ t && p && ((e = t.contentWindow) == null || e.postMessage({ type: "upstep:support:identity", token: o }, new URL(p.baseUrl).origin));
293
+ },
288
294
  get client() {
289
295
  if (!p) throw new Error("Upstep.init() must be called first");
290
296
  return p;
291
297
  }
292
298
  };
293
299
  if (typeof document < "u") {
294
- const o = document.currentScript, e = o == null ? void 0 : o.dataset.apiKey, t = o == null ? void 0 : o.dataset.userId, n = o == null ? void 0 : o.dataset.baseUrl, s = o == null ? void 0 : o.dataset.accentColor, r = o == null ? void 0 : o.dataset.position, c = o == null ? void 0 : o.dataset.theme;
295
- if (e) {
296
- const d = { apiKey: e };
297
- t && (d.userId = t), n && (d.baseUrl = n), s && (d.accentColor = s), (r === "left" || r === "right") && (d.position = r), (c === "light" || c === "dark" || c === "auto") && (d.theme = c), C.init(d);
300
+ const o = document.currentScript, t = o == null ? void 0 : o.dataset.apiKey, e = o == null ? void 0 : o.dataset.userId, a = o == null ? void 0 : o.dataset.baseUrl, s = o == null ? void 0 : o.dataset.accentColor, n = o == null ? void 0 : o.dataset.position, r = o == null ? void 0 : o.dataset.theme;
301
+ if (t) {
302
+ const l = { apiKey: t };
303
+ e && (l.userId = e), (o == null ? void 0 : o.dataset.chat) !== void 0 && (l.chat = o.dataset.chat !== "false"), a && (l.baseUrl = a), s && (l.accentColor = s), (n === "left" || n === "right") && (l.position = n), (r === "light" || r === "dark" || r === "auto") && (l.theme = r), C.init(l);
298
304
  }
299
305
  }
300
306
  export {
package/dist/react.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),L=require("./api-DLrEC5_l.js"),D="#D97757",M={bg:"#ffffff",bgSoft:"#f6f5f2",bgHover:"#efede8",text:"#1a1915",textSoft:"#56544d",textFaint:"#9b9890",border:"#e8e6df",overlay:"rgba(26,25,21,.45)"},P={bg:"#1c1b19",bgSoft:"#262522",bgHover:"#302e2a",text:"#f5f4f0",textSoft:"#b4b1a8",textFaint:"#7d7a72",border:"#33312c",overlay:"rgba(0,0,0,.6)"};function C(){if(typeof document>"u")return!1;const i=document.documentElement;return i.classList.contains("dark")||i.getAttribute("data-theme")==="dark"}function A(i){const[n,t]=r.useState(()=>i==="dark");return r.useEffect(()=>{if(i!=="auto"){t(i==="dark");return}if(t(C()),typeof MutationObserver>"u")return;const u=new MutationObserver(()=>t(C()));return u.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme"]}),()=>u.disconnect()},[i]),n?P:M}const z=r.createContext(null);function H({children:i,...n}){const[t]=r.useState(()=>new L.UpstepApiClient(n)),[u,g]=r.useState([]),[s,o]=r.useState(!1),[f,p]=r.useState(!0);r.useEffect(()=>{t.setUserId(n.userId)},[t,n.userId]);const l=r.useCallback(async()=>{try{const x=await t.listFeedback({sort:"votes",limit:20});g(x.items),p(x.showBranding??!0)}catch{}},[t]);r.useEffect(()=>{l()},[l]);const y=r.useCallback(async(x,j,h)=>{const d={content:j};x.trim()&&(d.title=x.trim()),h!==void 0&&(d.type=h),await t.submitFeedback(d),await l()},[t,l]),c=r.useCallback(async(x,j)=>{try{await t.vote(x,j),await l()}catch{}},[t,l]),a=r.useCallback(x=>t.getItem(x),[t]),b=r.useCallback(()=>o(!0),[]),k=r.useCallback(()=>o(!1),[]),S=r.useCallback(x=>t.setUserId(x),[t]);return e.jsx(z.Provider,{value:{client:t,feedItems:u,loadFeed:l,submit:y,vote:c,getItem:a,isOpen:s,open:b,close:k,identify:S,accentColor:n.accentColor??D,theme:n.theme??"auto",showBranding:f},children:i})}function v(){const i=r.useContext(z);if(!i)throw new Error("useUpstep must be used inside <UpstepProvider>");return i}function G({position:i="bottom-right",accentColor:n,theme:t,hideLauncher:u=!1}){const g=v(),s=n??g.accentColor,o=A(t??g.theme),{isOpen:f,open:p,close:l,showBranding:y}=g,[c,a]=r.useState("list"),[b,k]=r.useState(null),[S,x]=r.useState(!1);r.useEffect(()=>{const m=window.matchMedia("(max-width: 639px)");x(m.matches);const w=R=>x(R.matches);return m.addEventListener("change",w),()=>m.removeEventListener("change",w)},[]);const j=i==="bottom-left"?{position:"fixed",bottom:24,left:24}:{position:"fixed",bottom:24,right:24},h='-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif';function d(){l(),setTimeout(()=>{a("list"),k(null)},300)}function U(m){k(m),a("detail")}return e.jsxs(e.Fragment,{children:[!u&&e.jsxs("button",{onClick:p,style:{...j,zIndex:9998,display:"inline-flex",alignItems:"center",gap:7,background:s,color:"#fff",border:"none",borderRadius:9999,padding:S?"12px":"12px 18px",fontSize:14,fontWeight:600,cursor:"pointer",fontFamily:h,boxShadow:"0 6px 20px rgba(26,25,21,.18)"},children:[e.jsx(K,{size:16}),!S&&"Feedback"]}),f&&e.jsx("div",{onClick:m=>m.target===m.currentTarget&&d(),style:{position:"fixed",inset:0,background:o.overlay,backdropFilter:"blur(3px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",padding:16,fontFamily:h},children:e.jsxs("div",{style:{background:o.bg,border:`1px solid ${o.border}`,borderRadius:20,width:"100%",maxWidth:440,maxHeight:"88vh",display:"flex",flexDirection:"column",overflow:"hidden",boxShadow:"0 24px 64px rgba(0,0,0,.28)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:`1px solid ${o.border}`,flexShrink:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c!=="list"&&e.jsx("button",{onClick:()=>a("list"),style:{background:"none",border:"none",cursor:"pointer",color:s,fontSize:13,fontWeight:600,padding:0},children:"← Back"}),c==="list"&&e.jsx("span",{style:{fontWeight:700,fontSize:16,color:o.text,letterSpacing:"-.01em"},children:"Feedback"}),c==="create"&&e.jsx("span",{style:{fontWeight:700,fontSize:16,color:o.text,letterSpacing:"-.01em"},children:"New feedback"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c==="list"&&e.jsx("button",{onClick:()=>a("create"),style:{background:s,color:"#fff",border:"none",borderRadius:20,padding:"6px 14px",fontSize:13,fontWeight:700,cursor:"pointer"},children:"+ New"}),e.jsx("button",{onClick:d,style:{background:o.bgSoft,border:"none",width:28,height:28,borderRadius:8,fontSize:14,cursor:"pointer",color:o.textSoft,display:"flex",alignItems:"center",justifyContent:"center"},children:"✕"})]})]}),e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"16px 20px 24px"},children:[c==="list"&&e.jsx(N,{onSelect:U,accent:s,p:o}),c==="detail"&&b&&e.jsx(O,{feedbackId:b,accent:s,p:o,font:h}),c==="create"&&e.jsx(V,{accent:s,p:o,font:h,onDone:()=>a("list")})]}),y&&e.jsxs("a",{href:"https://upstep.dev",target:"_blank",rel:"noopener noreferrer",style:{display:"block",textAlign:"center",padding:"8px 0",borderTop:`1px solid ${o.border}`,fontSize:11,color:o.textFaint,textDecoration:"none",flexShrink:0},children:["Powered by ",e.jsx("strong",{style:{fontWeight:700},children:"Upstep.dev"})]})]})})]})}function N({onSelect:i,accent:n,p:t}){const{feedItems:u,vote:g}=v(),s=u.filter(o=>o.status!=="CLOSED");return s.length?e.jsx(e.Fragment,{children:s.map(o=>{const f=o.userVote==="UP",p=o.title??o.content;return e.jsxs("div",{onClick:()=>i(o.id),style:{display:"flex",gap:12,padding:14,border:`1px solid ${t.border}`,borderRadius:14,marginBottom:10,background:t.bg,cursor:"pointer"},children:[e.jsxs("button",{onClick:l=>{l.stopPropagation(),g(o.id,"UP")},style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,minWidth:46,padding:"7px 0",borderRadius:11,cursor:"pointer",flexShrink:0,border:`1px solid ${f?n:t.border}`,background:f?`${n}1a`:t.bgSoft},children:[e.jsx(I,{color:n}),e.jsx("span",{style:{fontSize:14,fontWeight:700,color:t.text,lineHeight:1.1},children:o.upvotes})]}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("p",{style:{fontSize:13.5,fontWeight:600,lineHeight:1.4,color:t.text,margin:"0 0 6px",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:p}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[e.jsx(B,{type:o.type,p:t}),o.status==="PENDING"?e.jsx(W,{}):e.jsx(E,{status:o.status,boardStatus:o.boardStatus,p:t}),e.jsx("span",{style:{fontSize:11,color:t.textFaint},children:T(o.createdAt)})]})]}),e.jsx("span",{style:{color:t.textFaint,fontSize:18,alignSelf:"center",flexShrink:0},children:"›"})]},o.id)})}):e.jsxs("div",{style:{textAlign:"center",padding:"40px 0"},children:[e.jsx("div",{style:{color:t.textSoft,fontSize:15,fontWeight:600,marginBottom:4},children:"No open feedback yet"}),e.jsx("div",{style:{color:t.textFaint,fontSize:14},children:"Be the first to share one."})]})}function O({feedbackId:i,accent:n,p:t,font:u}){const{vote:g,getItem:s}=v(),[o,f]=r.useState(null),[p,l]=r.useState(!1);r.useEffect(()=>{let a=!1;return s(i).then(b=>{a||f(b)}).catch(()=>{}),()=>{a=!0}},[i,s]);async function y(){if(!(!o||p)){l(!0);try{await g(o.id,"UP");const a=await s(i);f(a)}catch{}finally{l(!1)}}}if(!o)return e.jsx("div",{style:{textAlign:"center",padding:"40px 0",color:t.textFaint,fontSize:14},children:"Loading…"});const c=o.title;return e.jsxs("div",{children:[c&&e.jsx("div",{style:{fontSize:20,fontWeight:700,color:t.text,letterSpacing:"-.02em",marginBottom:10,lineHeight:1.3},children:c}),e.jsxs("div",{style:{display:"flex",gap:6,marginBottom:14,flexWrap:"wrap"},children:[e.jsx(B,{type:o.type,p:t}),o.status==="PENDING"?e.jsx(W,{}):e.jsx(E,{status:o.status,boardStatus:o.boardStatus,p:t})]}),e.jsx("p",{style:{fontSize:15,lineHeight:1.6,color:t.textSoft,marginBottom:20},children:o.content}),e.jsxs("button",{onClick:y,disabled:p,style:{display:"inline-flex",alignItems:"center",gap:8,border:`1px solid ${o.userVote==="UP"?n:t.border}`,background:o.userVote==="UP"?`${n}15`:t.bgSoft,borderRadius:12,padding:"10px 16px",cursor:"pointer",fontFamily:u},children:[e.jsx(I,{color:n,size:13}),e.jsx("span",{style:{fontSize:18,fontWeight:700,color:t.text},children:o.upvotes}),e.jsx("span",{style:{fontSize:13,color:t.textFaint},children:o.userVote==="UP"?"Upvoted":"Upvote"})]}),o.comments.length>0&&e.jsxs("div",{style:{marginTop:28,borderTop:`1px solid ${t.border}`,paddingTop:20},children:[e.jsx("div",{style:{fontSize:10,fontWeight:700,letterSpacing:".08em",color:t.textFaint,marginBottom:12,textTransform:"uppercase"},children:"Developer response"}),o.comments.map(a=>e.jsx($,{comment:a,p:t,accent:n},a.id))]})]})}function $({comment:i,p:n,accent:t}){return e.jsxs("div",{style:{background:n.bgSoft,border:`1px solid ${n.border}`,borderRadius:12,padding:14,marginBottom:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[e.jsx("span",{style:{background:`${t}20`,color:t,fontSize:11,fontWeight:700,borderRadius:20,padding:"2px 8px"},children:"Developer"}),e.jsx("span",{style:{fontSize:11,color:n.textFaint},children:T(i.createdAt)})]}),e.jsx("p",{style:{fontSize:14,lineHeight:1.5,color:n.textSoft,margin:0},children:i.content})]})}function V({accent:i,p:n,font:t,onDone:u}){const{submit:g}=v(),[s,o]=r.useState(""),[f,p]=r.useState(""),[l,y]=r.useState("GENERAL"),[c,a]=r.useState(!1),[b,k]=r.useState(!1),[S,x]=r.useState("");async function j(){if(!(!s.trim()||c)){a(!0),x("");try{await g(s.trim(),f.trim()||s.trim(),l),k(!0),setTimeout(u,1200)}catch{x("Something went wrong. Please try again.")}finally{a(!1)}}}if(b)return e.jsxs("div",{style:{textAlign:"center",paddingTop:40},children:[e.jsx("div",{style:{fontSize:18,fontWeight:700,color:n.text,marginBottom:6},children:"Submitted"}),e.jsx("div",{style:{fontSize:14,color:n.textFaint},children:"Feedback received. Thank you."})]});const h={width:"100%",border:`1px solid ${n.border}`,borderRadius:12,padding:"10px 12px",fontSize:14,lineHeight:1.5,outline:"none",background:n.bgSoft,color:n.text,fontFamily:t,boxSizing:"border-box"};return e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:10,fontWeight:700,letterSpacing:".08em",color:n.textFaint,marginBottom:8,textTransform:"uppercase"},children:"Type"}),e.jsx("div",{style:{display:"flex",gap:7,marginBottom:16},children:["BUG","FEATURE","GENERAL"].map(d=>e.jsxs("button",{onClick:()=>y(d),style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",gap:5,padding:"8px 10px",borderRadius:9,fontSize:12.5,fontWeight:600,cursor:"pointer",background:l===d?i:n.bg,color:l===d?"#fff":n.textSoft,border:`1px solid ${l===d?i:n.border}`,fontFamily:t},children:[F[d].icon,F[d].label]},d))}),e.jsx("div",{style:{fontSize:10,fontWeight:700,letterSpacing:".08em",color:n.textFaint,marginBottom:8,textTransform:"uppercase"},children:"Title"}),e.jsx("input",{value:s,onChange:d=>o(d.target.value),placeholder:"Short summary of the issue or idea",maxLength:200,style:{...h,marginBottom:16,display:"block"}}),e.jsxs("div",{style:{fontSize:10,fontWeight:700,letterSpacing:".08em",color:n.textFaint,marginBottom:8,textTransform:"uppercase"},children:["Description ",e.jsx("span",{style:{fontWeight:400,textTransform:"none",letterSpacing:0},children:"(optional)"})]}),e.jsx("textarea",{value:f,onChange:d=>p(d.target.value),placeholder:"Steps to reproduce, expected behaviour, or more context",maxLength:2e3,rows:4,style:{...h,resize:"vertical",marginBottom:16}}),S&&e.jsx("p",{style:{fontSize:13,color:"#d6453d",marginBottom:12},children:S}),e.jsx("button",{onClick:j,disabled:c||!s.trim(),style:{width:"100%",padding:12,background:i,color:"#fff",border:"none",borderRadius:11,fontSize:14,fontWeight:600,cursor:"pointer",opacity:c||!s.trim()?.5:1,fontFamily:t},children:c?"Submitting…":"Submit feedback"})]})}const F={BUG:{label:"Bug",icon:e.jsxs("svg",{width:12,height:12,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("ellipse",{cx:"8",cy:"10",rx:"3.5",ry:"4.5"}),e.jsx("path",{d:"M8 5.5V4M5.5 6.5 3.5 5M10.5 6.5 12.5 5M4.5 10.5 2.5 10M11.5 10.5 13.5 10"})]})},FEATURE:{label:"Feature",icon:e.jsxs("svg",{width:12,height:12,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M8 2v1.5M8 12.5V14M2 8h1.5M12.5 8H14M4.1 4.1l1 1M10.9 10.9l1 1M11.9 4.1l-1 1M5.1 10.9l-1 1"}),e.jsx("circle",{cx:"8",cy:"8",r:"2.5"})]})},GENERAL:{label:"General",icon:e.jsx("svg",{width:12,height:12,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M14 9a2 2 0 0 1-2 2H5L2 14V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v5z"})})}},_={BUG:"#fdecec",FEATURE:"#e9f0fd"},q={BUG:"#d6453d",FEATURE:"#3b76d6"};function B({type:i,p:n}){return e.jsx("span",{style:{padding:"2px 8px",borderRadius:9999,fontSize:10.5,fontWeight:700,letterSpacing:".02em",background:_[i]??n.bgSoft,color:q[i]??n.textSoft},children:i})}const Y={OPEN:"#b45309",IN_PROGRESS:"#1d4ed8",DONE:"#15803d",CLOSED:"#6b7280"};function W(){return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,background:"#fff7ed",border:"1px solid #fed7aa",borderRadius:6,padding:"1px 6px",fontSize:10,fontWeight:700,color:"#ea580c"},children:[e.jsx("span",{style:{width:5,height:5,borderRadius:"50%",background:"#ea580c",display:"inline-block"}}),"Pending review"]})}function E({status:i,boardStatus:n,p:t}){const u=(n==null?void 0:n.color)??Y[i]??"#9ca3af";return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,background:t.bgSoft,border:`1px solid ${t.border}`,borderRadius:6,padding:"2px 8px",fontSize:10,fontWeight:600,color:t.textSoft},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}}),(n==null?void 0:n.name)??i.replace("_"," ")]})}function K({size:i=16,color:n="currentColor"}){return e.jsx("svg",{width:i,height:i,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function I({color:i="currentColor",size:n=11}){return e.jsx("svg",{width:n,height:n,viewBox:"0 0 16 16",fill:"none",stroke:i,strokeWidth:2.2,strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M8 13V3M3 8l5-5 5 5"})})}function T(i){return new Date(i).toLocaleDateString(void 0,{month:"short",day:"numeric"})}exports.FeedbackWidget=G;exports.UpstepProvider=H;exports.useUpstep=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),A=require("./api-BuSqdsZp.js"),D="#D97757",H={bg:"#ffffff",bgSoft:"#f6f5f2",bgHover:"#efede8",text:"#1a1915",textSoft:"#56544d",textFaint:"#9b9890",border:"#e8e6df",overlay:"rgba(26,25,21,.45)"},N={bg:"#000000",bgSoft:"#262522",bgHover:"#302e2a",text:"#f5f4f0",textSoft:"#b4b1a8",textFaint:"#7d7a72",border:"#33312c",overlay:"rgba(0,0,0,.6)"};function z(){if(typeof document>"u")return!1;const o=document.documentElement;return o.classList.contains("dark")||o.getAttribute("data-theme")==="dark"}function $(o){const[n,t]=i.useState(()=>o==="dark");return i.useEffect(()=>{if(o!=="auto"){t(o==="dark");return}if(t(z()),typeof MutationObserver>"u")return;const x=new MutationObserver(()=>t(z()));return x.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme"]}),()=>x.disconnect()},[o]),n?N:H}const B=i.createContext(null);function G({children:o,...n}){const[t]=i.useState(()=>new A.UpstepApiClient(n)),[x,f]=i.useState([]),[s,r]=i.useState(!1),[l,m]=i.useState(!0);i.useEffect(()=>{t.setUserId(n.userId)},[t,n.userId]),i.useEffect(()=>{t.supportIdentityToken=n.supportIdentityToken,document.querySelectorAll("iframe[data-upstep-support]").forEach(c=>{var b;return(b=c.contentWindow)==null?void 0:b.postMessage({type:"upstep:support:identity",token:n.supportIdentityToken},new URL(t.baseUrl).origin)})},[t,n.supportIdentityToken]);const d=i.useCallback(async()=>{try{const c=await t.listFeedback({sort:"votes",limit:20});f(c.items),m(c.showBranding??!0)}catch{}},[t]);i.useEffect(()=>{d()},[d]);const j=i.useCallback(async(c,b,S)=>{const p={content:b};c.trim()&&(p.title=c.trim()),S!==void 0&&(p.type=S),await t.submitFeedback(p),await d()},[t,d]),h=i.useCallback(async(c,b)=>{try{await t.vote(c,b),await d()}catch{}},[t,d]),a=i.useCallback(c=>t.getItem(c),[t]),g=i.useCallback(()=>r(!0),[]),y=i.useCallback(()=>r(!1),[]),k=i.useCallback(c=>t.setUserId(c),[t]);return e.jsx(B.Provider,{value:{client:t,feedItems:x,loadFeed:d,submit:j,vote:h,getItem:a,isOpen:s,open:g,close:y,identify:k,accentColor:n.accentColor??D,theme:n.theme??"auto",showBranding:l,chat:n.chat!==!1},children:o})}function w(){const o=i.useContext(B);if(!o)throw new Error("useUpstep must be used inside <UpstepProvider>");return o}function O({position:o="bottom-right",accentColor:n,theme:t,hideLauncher:x=!1,chat:f=!0}){const s=w(),r=n??s.accentColor,l=$(t??s.theme),{isOpen:m,open:d,close:j,showBranding:h}=s,[a,g]=i.useState("list"),[y,k]=i.useState(!1);i.useEffect(()=>{let u=!0;if(s.client.chat=s.chat,!s.chat||!f){k(!1);return}return s.client.supportEnabled().then(v=>{u&&k(v)}),()=>{u=!1}},[s.client,s.chat,f]),i.useEffect(()=>{(!s.chat||!f)&&a==="support"&&g("list")},[s.chat,f,a]);const[c,b]=i.useState(null),[S,p]=i.useState(!1);i.useEffect(()=>{const u=window.matchMedia("(max-width: 639px)");p(u.matches);const v=P=>p(P.matches);return u.addEventListener("change",v),()=>u.removeEventListener("change",v)},[]);const L=o==="bottom-left"?{position:"fixed",bottom:24,left:24}:{position:"fixed",bottom:24,right:24},C='-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif';function F(){j(),setTimeout(()=>{g("list"),b(null)},300)}function M(u){b(u),g("detail")}return e.jsxs(e.Fragment,{children:[!x&&e.jsxs("button",{onClick:d,style:{...L,zIndex:9998,display:"inline-flex",alignItems:"center",gap:7,background:r,color:"#fff",border:"none",borderRadius:9999,padding:S?"12px":"12px 18px",fontSize:14,fontWeight:600,cursor:"pointer",fontFamily:C,boxShadow:"0 6px 20px rgba(26,25,21,.18)"},children:[e.jsx(Z,{size:16}),!S&&(y&&f&&s.chat?"Help & feedback":"Feedback")]}),m&&e.jsx("div",{onClick:u=>u.target===u.currentTarget&&F(),style:{position:"fixed",inset:0,background:l.overlay,backdropFilter:"blur(3px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",padding:16,fontFamily:C},children:e.jsxs("div",{style:{background:l.bg,border:`1px solid ${l.border}`,borderRadius:20,width:"100%",maxWidth:y&&f&&s.chat?460:440,maxHeight:"88vh",display:"flex",flexDirection:"column",overflow:"hidden",boxShadow:"0 24px 64px rgba(0,0,0,.28)"},children:[y&&f&&s.chat?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,padding:"10px 14px",borderBottom:`1px solid ${l.border}`,flexShrink:0},children:[e.jsx("div",{style:{display:"flex",flex:1,gap:4},children:[["support","Support"],["list","Feedback"]].map(([u,v])=>e.jsx("button",{onClick:()=>g(u),style:{flex:1,border:0,borderRadius:8,padding:"9px 12px",background:(a==="support"?u==="support":u==="list")?l.bgSoft:"transparent",color:(a==="support"?u==="support":u==="list")?l.text:l.textSoft,fontSize:12,fontWeight:600,cursor:"pointer"},children:v},u))}),e.jsx("button",{"aria-label":"Close",onClick:F,style:{border:0,background:"transparent",color:l.textSoft,padding:6,cursor:"pointer",fontSize:14},children:"✕"})]}):e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:`1px solid ${l.border}`,flexShrink:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a!=="list"&&e.jsx("button",{onClick:()=>g("list"),style:{background:"none",border:"none",cursor:"pointer",color:r,fontSize:13,fontWeight:600,padding:0},children:"← Back"}),a==="list"&&e.jsx("span",{style:{fontWeight:700,fontSize:16,color:l.text,letterSpacing:"-.01em"},children:"Feedback"}),a==="create"&&e.jsx("span",{style:{fontWeight:700,fontSize:16,color:l.text,letterSpacing:"-.01em"},children:"New feedback"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a==="list"&&e.jsx("button",{onClick:()=>g("create"),style:{background:r,color:"#fff",border:"none",borderRadius:20,padding:"6px 14px",fontSize:13,fontWeight:700,cursor:"pointer"},children:"+ New"}),e.jsx("button",{onClick:F,style:{background:l.bgSoft,border:"none",width:28,height:28,borderRadius:8,fontSize:14,cursor:"pointer",color:l.textSoft,display:"flex",alignItems:"center",justifyContent:"center"},children:"✕"})]})]}),e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:a==="support"?0:"16px 20px 24px"},children:[a==="support"&&f&&s.chat&&e.jsx(V,{client:s.client,theme:l.bg==="#000000"?"dark":"light"}),y&&f&&s.chat&&a!=="support"&&e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:16},children:a==="list"?e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{fontSize:14,fontWeight:600,color:l.text},children:"Feedback & ideas"}),e.jsx("button",{onClick:()=>g("create"),style:{border:0,borderRadius:8,background:r,color:"white",fontSize:12,padding:"7px 10px",cursor:"pointer"},children:"+ New"})]}):e.jsx("button",{onClick:()=>g("list"),style:{border:0,background:"none",padding:0,color:l.textSoft,fontSize:12,cursor:"pointer"},children:"← Back to feedback"})}),a==="list"&&e.jsx(_,{onSelect:M,accent:r,p:l}),a==="detail"&&c&&e.jsx(q,{feedbackId:c,accent:r,p:l,font:C}),a==="create"&&e.jsx(K,{accent:r,p:l,font:C,onDone:()=>g("list")})]}),h&&a!=="support"&&e.jsxs("a",{href:"https://upstep.dev",target:"_blank",rel:"noopener noreferrer",style:{display:"block",textAlign:"center",padding:"8px 0",borderTop:`1px solid ${l.border}`,fontSize:11,color:l.textFaint,textDecoration:"none",flexShrink:0},children:["Powered by ",e.jsx("strong",{style:{fontWeight:700},children:"Upstep.dev"})]})]})})]})}function V({client:o,theme:n}){const t=i.useRef(null);return i.useEffect(()=>{if(t.current)return o.connectSupportFrame(t.current)},[o]),e.jsx("iframe",{ref:t,"data-upstep-support":!0,title:"Customer support",src:o.supportFrameUrl(n),style:{width:"100%",height:"min(560px, calc(88dvh - 56px))",minHeight:300,border:0,display:"block"}})}function _({onSelect:o,accent:n,p:t}){const{feedItems:x,vote:f}=w(),s=x.filter(r=>r.status!=="CLOSED");return s.length?e.jsx(e.Fragment,{children:s.map(r=>{const l=r.userVote==="UP",m=r.title??r.content;return e.jsxs("div",{onClick:()=>o(r.id),style:{display:"flex",gap:12,padding:14,border:`1px solid ${t.border}`,borderRadius:14,marginBottom:10,background:t.bg,cursor:"pointer"},children:[e.jsxs("button",{onClick:d=>{d.stopPropagation(),f(r.id,"UP")},style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,minWidth:46,padding:"7px 0",borderRadius:11,cursor:"pointer",flexShrink:0,border:`1px solid ${l?n:t.border}`,background:l?`${n}1a`:t.bgSoft},children:[e.jsx(U,{color:n}),e.jsx("span",{style:{fontSize:14,fontWeight:700,color:t.text,lineHeight:1.1},children:r.upvotes})]}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("p",{style:{fontSize:13.5,fontWeight:600,lineHeight:1.4,color:t.text,margin:"0 0 6px",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:m}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[e.jsx(I,{type:r.type,p:t}),r.status==="PENDING"?e.jsx(W,{}):e.jsx(T,{status:r.status,boardStatus:r.boardStatus,p:t}),e.jsx("span",{style:{fontSize:11,color:t.textFaint},children:R(r.createdAt)})]})]}),e.jsx("span",{style:{color:t.textFaint,fontSize:18,alignSelf:"center",flexShrink:0},children:"›"})]},r.id)})}):e.jsxs("div",{style:{textAlign:"center",padding:"40px 0"},children:[e.jsx("div",{style:{color:t.textSoft,fontSize:15,fontWeight:600,marginBottom:4},children:"No open feedback yet"}),e.jsx("div",{style:{color:t.textFaint,fontSize:14},children:"Be the first to share one."})]})}function q({feedbackId:o,accent:n,p:t,font:x}){const{vote:f,getItem:s}=w(),[r,l]=i.useState(null),[m,d]=i.useState(!1);i.useEffect(()=>{let a=!1;return s(o).then(g=>{a||l(g)}).catch(()=>{}),()=>{a=!0}},[o,s]);async function j(){if(!(!r||m)){d(!0);try{await f(r.id,"UP");const a=await s(o);l(a)}catch{}finally{d(!1)}}}if(!r)return e.jsx("div",{style:{textAlign:"center",padding:"40px 0",color:t.textFaint,fontSize:14},children:"Loading…"});const h=r.title;return e.jsxs("div",{children:[h&&e.jsx("div",{style:{fontSize:20,fontWeight:700,color:t.text,letterSpacing:"-.02em",marginBottom:10,lineHeight:1.3},children:h}),e.jsxs("div",{style:{display:"flex",gap:6,marginBottom:14,flexWrap:"wrap"},children:[e.jsx(I,{type:r.type,p:t}),r.status==="PENDING"?e.jsx(W,{}):e.jsx(T,{status:r.status,boardStatus:r.boardStatus,p:t})]}),e.jsx("p",{style:{fontSize:15,lineHeight:1.6,color:t.textSoft,marginBottom:20},children:r.content}),e.jsxs("button",{onClick:j,disabled:m,style:{display:"inline-flex",alignItems:"center",gap:8,border:`1px solid ${r.userVote==="UP"?n:t.border}`,background:r.userVote==="UP"?`${n}15`:t.bgSoft,borderRadius:12,padding:"10px 16px",cursor:"pointer",fontFamily:x},children:[e.jsx(U,{color:n,size:13}),e.jsx("span",{style:{fontSize:18,fontWeight:700,color:t.text},children:r.upvotes}),e.jsx("span",{style:{fontSize:13,color:t.textFaint},children:r.userVote==="UP"?"Upvoted":"Upvote"})]}),r.comments.length>0&&e.jsxs("div",{style:{marginTop:28,borderTop:`1px solid ${t.border}`,paddingTop:20},children:[e.jsx("div",{style:{fontSize:10,fontWeight:700,letterSpacing:".08em",color:t.textFaint,marginBottom:12,textTransform:"uppercase"},children:"Comments"}),r.comments.map(a=>e.jsx(Y,{comment:a,p:t,accent:n},a.id))]})]})}function Y({comment:o,p:n,accent:t}){var x;return e.jsxs("div",{style:{background:n.bgSoft,border:`1px solid ${n.border}`,borderRadius:12,padding:14,marginBottom:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[e.jsx("span",{style:{background:`${t}20`,color:t,fontSize:11,fontWeight:700,borderRadius:20,padding:"2px 8px"},children:((x=o.authorName)==null?void 0:x.trim())||"UpStep Team"}),e.jsx("span",{style:{fontSize:11,color:n.textFaint},children:R(o.createdAt)})]}),e.jsx("p",{style:{fontSize:14,lineHeight:1.5,color:n.textSoft,margin:0},children:o.content})]})}function K({accent:o,p:n,font:t,onDone:x}){const{submit:f}=w(),[s,r]=i.useState(""),[l,m]=i.useState(""),[d,j]=i.useState("GENERAL"),[h,a]=i.useState(!1),[g,y]=i.useState(!1),[k,c]=i.useState("");async function b(){if(!(!s.trim()||h)){a(!0),c("");try{await f(s.trim(),l.trim()||s.trim(),d),y(!0),setTimeout(x,1200)}catch{c("Something went wrong. Please try again.")}finally{a(!1)}}}if(g)return e.jsxs("div",{style:{textAlign:"center",paddingTop:40},children:[e.jsx("div",{style:{fontSize:18,fontWeight:700,color:n.text,marginBottom:6},children:"Submitted"}),e.jsx("div",{style:{fontSize:14,color:n.textFaint},children:"Feedback received. Thank you."})]});const S={width:"100%",border:`1px solid ${n.border}`,borderRadius:12,padding:"10px 12px",fontSize:14,lineHeight:1.5,outline:"none",background:n.bgSoft,color:n.text,fontFamily:t,boxSizing:"border-box"};return e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:10,fontWeight:700,letterSpacing:".08em",color:n.textFaint,marginBottom:8,textTransform:"uppercase"},children:"Type"}),e.jsx("div",{style:{display:"flex",gap:7,marginBottom:16},children:["BUG","FEATURE","GENERAL"].map(p=>e.jsxs("button",{onClick:()=>j(p),style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",gap:5,padding:"8px 10px",borderRadius:9,fontSize:12.5,fontWeight:600,cursor:"pointer",background:d===p?o:n.bg,color:d===p?"#fff":n.textSoft,border:`1px solid ${d===p?o:n.border}`,fontFamily:t},children:[E[p].icon,E[p].label]},p))}),e.jsx("div",{style:{fontSize:10,fontWeight:700,letterSpacing:".08em",color:n.textFaint,marginBottom:8,textTransform:"uppercase"},children:"Title"}),e.jsx("input",{value:s,onChange:p=>r(p.target.value),placeholder:"Short summary of the issue or idea",maxLength:200,style:{...S,marginBottom:16,display:"block"}}),e.jsxs("div",{style:{fontSize:10,fontWeight:700,letterSpacing:".08em",color:n.textFaint,marginBottom:8,textTransform:"uppercase"},children:["Description ",e.jsx("span",{style:{fontWeight:400,textTransform:"none",letterSpacing:0},children:"(optional)"})]}),e.jsx("textarea",{value:l,onChange:p=>m(p.target.value),placeholder:"Steps to reproduce, expected behaviour, or more context",maxLength:2e3,rows:4,style:{...S,resize:"vertical",marginBottom:16}}),k&&e.jsx("p",{style:{fontSize:13,color:"#d6453d",marginBottom:12},children:k}),e.jsx("button",{onClick:b,disabled:h||!s.trim(),style:{width:"100%",padding:12,background:o,color:"#fff",border:"none",borderRadius:11,fontSize:14,fontWeight:600,cursor:"pointer",opacity:h||!s.trim()?.5:1,fontFamily:t},children:h?"Submitting…":"Submit feedback"})]})}const E={BUG:{label:"Bug",icon:e.jsxs("svg",{width:12,height:12,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("ellipse",{cx:"8",cy:"10",rx:"3.5",ry:"4.5"}),e.jsx("path",{d:"M8 5.5V4M5.5 6.5 3.5 5M10.5 6.5 12.5 5M4.5 10.5 2.5 10M11.5 10.5 13.5 10"})]})},FEATURE:{label:"Feature",icon:e.jsxs("svg",{width:12,height:12,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M8 2v1.5M8 12.5V14M2 8h1.5M12.5 8H14M4.1 4.1l1 1M10.9 10.9l1 1M11.9 4.1l-1 1M5.1 10.9l-1 1"}),e.jsx("circle",{cx:"8",cy:"8",r:"2.5"})]})},GENERAL:{label:"General",icon:e.jsx("svg",{width:12,height:12,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M14 9a2 2 0 0 1-2 2H5L2 14V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v5z"})})}},J={BUG:"#fdecec",FEATURE:"#e9f0fd"},Q={BUG:"#d6453d",FEATURE:"#3b76d6"};function I({type:o,p:n}){return e.jsx("span",{style:{padding:"2px 8px",borderRadius:9999,fontSize:10.5,fontWeight:700,letterSpacing:".02em",background:J[o]??n.bgSoft,color:Q[o]??n.textSoft},children:o})}const X={OPEN:"#b45309",IN_PROGRESS:"#1d4ed8",DONE:"#15803d",CLOSED:"#6b7280"};function W(){return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,background:"#fff7ed",border:"1px solid #fed7aa",borderRadius:6,padding:"1px 6px",fontSize:10,fontWeight:700,color:"#ea580c"},children:[e.jsx("span",{style:{width:5,height:5,borderRadius:"50%",background:"#ea580c",display:"inline-block"}}),"Pending review"]})}function T({status:o,boardStatus:n,p:t}){const x=(n==null?void 0:n.color)??X[o]??"#9ca3af";return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,background:t.bgSoft,border:`1px solid ${t.border}`,borderRadius:6,padding:"2px 8px",fontSize:10,fontWeight:600,color:t.textSoft},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:x,display:"inline-block",flexShrink:0}}),(n==null?void 0:n.name)??o.replace("_"," ")]})}function Z({size:o=16,color:n="currentColor"}){return e.jsx("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:n,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function U({color:o="currentColor",size:n=11}){return e.jsx("svg",{width:n,height:n,viewBox:"0 0 16 16",fill:"none",stroke:o,strokeWidth:2.2,strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M8 13V3M3 8l5-5 5 5"})})}function R(o){return new Date(o).toLocaleDateString(void 0,{month:"short",day:"numeric"})}exports.FeedbackWidget=O;exports.UpstepProvider=G;exports.useUpstep=w;
package/dist/react.d.ts CHANGED
@@ -16,6 +16,7 @@ interface UpstepContextValue {
16
16
  accentColor: string;
17
17
  theme: ThemeMode;
18
18
  showBranding: boolean;
19
+ chat: boolean;
19
20
  }
20
21
  export declare function UpstepProvider({ children, ...config }: UpstepConfig & {
21
22
  children: ReactNode;
@@ -26,7 +27,9 @@ interface FeedbackWidgetProps {
26
27
  accentColor?: string;
27
28
  theme?: ThemeMode;
28
29
  hideLauncher?: boolean;
30
+ /** Override chat visibility for this widget. Project/plan access still applies. */
31
+ chat?: boolean;
29
32
  }
30
- export declare function FeedbackWidget({ position, accentColor, theme, hideLauncher, }: FeedbackWidgetProps): React.JSX.Element;
33
+ export declare function FeedbackWidget({ position, accentColor, theme, hideLauncher, chat, }: FeedbackWidgetProps): React.JSX.Element;
31
34
  export {};
32
35
  //# sourceMappingURL=react.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAMZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAW,QAAQ,EAAE,YAAY,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACzG,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAMxC,KAAK,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAsE3C,UAAU,kBAAkB;IAC1B,MAAM,EAAE,eAAe,CAAC;IACxB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/E,IAAI,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,GAAG,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE,OAAO,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC/D,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAC/C,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,SAAS,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;CACvB;AAID,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,GAAG,MAAM,EACV,EAAE,YAAY,GAAG;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,qBA6DxC;AAED,wBAAgB,SAAS,IAAI,kBAAkB,CAI9C;AAID,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,EAAE,cAAc,GAAG,aAAa,CAAC;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAID,wBAAgB,cAAc,CAAC,EAC7B,QAAyB,EACzB,WAAW,EACX,KAAK,EACL,YAAoB,GACrB,EAAE,mBAAmB,qBAoJrB"}
1
+ {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAOZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAW,QAAQ,EAAE,YAAY,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACzG,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAMxC,KAAK,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAsE3C,UAAU,kBAAkB;IAC1B,MAAM,EAAE,eAAe,CAAC;IACxB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/E,IAAI,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,GAAG,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE,OAAO,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC/D,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAC/C,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,SAAS,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,IAAI,EAAE,OAAO,CAAC;CACf;AAID,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,GAAG,MAAM,EACV,EAAE,YAAY,GAAG;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,qBAmExC;AAED,wBAAgB,SAAS,IAAI,kBAAkB,CAI9C;AAID,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,EAAE,cAAc,GAAG,aAAa,CAAC;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,mFAAmF;IACnF,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAID,wBAAgB,cAAc,CAAC,EAC7B,QAAyB,EACzB,WAAW,EACX,KAAK,EACL,YAAoB,EACpB,IAAW,GACZ,EAAE,mBAAmB,qBAyJrB"}