@upstep/js 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -70,9 +70,9 @@ Every entry point (`Upstep.init`, `<UpstepProvider>`, and the script tag's `data
70
70
  | `apiKey` | `string` | — | **Required.** Your project's API key. |
71
71
  | `userId` | `string` | — | End-user id from your app, used to deduplicate votes per user. Call `identify(userId)` if it's only known after login. |
72
72
  | `baseUrl` | `string` | `https://upstep.dev` | Only needed for self-hosted or staging setups. |
73
- | `accentColor` | `string` | `#D97757` | Any CSS color, used for the launcher button and highlights. |
73
+ | `accentColor` | `string` | `#5B7168` | Any CSS color, used for the launcher button and highlights. |
74
74
  | `theme` | `"light" \| "dark" \| "auto"` | `"auto"` | `"auto"` follows the host page's `prefers-color-scheme`. |
75
- | `position` | `"left" \| "right"` | `"right"` | Which corner the launcher button docks to. |
75
+ | `position` | `"left" \| "right"` | `"right"` | Deprecated. Website launchers and panels stay bottom-right. |
76
76
  | `launcher` | `boolean` | `true` | Set `false` to hide the floating button and trigger the widget yourself via `Upstep.open()`. |
77
77
 
78
78
  ## API
@@ -100,7 +100,7 @@ Every entry point (`Upstep.init`, `<UpstepProvider>`, and the script tag's `data
100
100
 
101
101
  ### AI and live chat in the existing widget
102
102
 
103
- Version 0.6.0 adds a **Support** tab to the same widget that handles feedback and
103
+ Version 0.7.0 includes a **Support** tab to the same widget that handles feedback and
104
104
  voting. Enable customer support for your paid project in the UpStep dashboard,
105
105
  learn the business website, and confirm the business details and contact email.
106
106
  The project must be enabled on the server; `chat: true` never bypasses plan access.
@@ -121,14 +121,22 @@ import { UpstepProvider, FeedbackWidget } from '@upstep/js/react';
121
121
  ```
122
122
 
123
123
  ```html
124
- <script defer src="https://unpkg.com/@upstep/js@0.6.0/dist/upstep.global.js"
124
+ <script defer src="https://unpkg.com/@upstep/js@0.7.0/dist/upstep.global.js"
125
125
  data-api-key="YOUR_PROJECT_KEY" data-chat="true"></script>
126
126
  ```
127
127
 
128
128
  When no teammate is available, AI continues helping from the business's website
129
129
  and confirmed answers. Unresolved issues can become private tickets with stable
130
- references and the business's confirmed support email. Customer email is optional.
130
+ references and the business's confirmed support email. AI help needs no contact details. Before a team handoff, the customer confirms their name and email.
131
131
  For private cross-device customer history, pass a backend-signed JWT as
132
132
  `supportIdentityToken`, or call `Upstep.identifySupport(token)` after login and
133
133
  `Upstep.identifySupport(undefined)` on logout. Never put the identity signing
134
134
  secret in browser code. [Integration guide](https://upstep.dev/guides/customer-support).
135
+
136
+ ### Widget layout and support forms
137
+
138
+ The website launcher and its opened chat/feedback panel stay in the bottom-right corner. Position options and old drag positions no longer move website widgets. Text uses a readable size with softer surfaces, white light mode and black dark mode.
139
+
140
+ Support can show quick replies, issue details, resolution confirmations, and a contact card. The team action appears only after AI identifies an issue it cannot resolve. The server requires a name and valid email before queueing a private ticket. AI replies stay short, with separate paragraphs and no em dashes.
141
+
142
+ A DOM-free client is available from `@upstep/js/support` for custom native integrations. The React Native SDK uses this same client inside its existing feedback sheet.
package/dist/index.cjs CHANGED
@@ -1,91 +1,81 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const k=require("./api-BuSqdsZp.js"),S="#D97757",m={bg:"#ffffff",bgSoft:"#f6f5f2",bgHover:"#efede8",text:"#1a1915",textSoft:"#56544d",textFaint:"#9b9890",border:"#e8e6df",overlay:"rgba(26,25,21,.45)"},x={bg:"#000000",bgSoft:"#262522",bgHover:"#302e2a",text:"#f5f4f0",textSoft:"#b4b1a8",textFaint:"#7d7a72",border:"#33312c",overlay:"rgba(0,0,0,.6)"};function y(o){if(o==="light"||o==="dark")return o;if(typeof document<"u"){const e=document.documentElement;return e.classList.contains("dark")||e.getAttribute("data-theme")==="dark"?"dark":"light"}return typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function L(o,e,t){return`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("./api-BuSqdsZp.js"),x="#5B7168",l={bg:"#ffffff",bgSoft:"#f4f6f4",bgHover:"#eaf0eb",text:"#1a1915",textSoft:"#56544d",textFaint:"#9b9890",border:"#e8e6df",overlay:"rgba(26,25,21,.45)"},u={bg:"#000000",bgSoft:"#191d1b",bgHover:"#252d28",text:"#f5f4f0",textSoft:"#b4b1a8",textFaint:"#7d7a72",border:"#33312c",overlay:"rgba(0,0,0,.6)"};function c(o){if(o==="light"||o==="dark")return o;if(typeof document<"u"){const t=document.documentElement;return t.classList.contains("dark")||t.getAttribute("data-theme")==="dark"?"dark":"light"}return typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function m(o,t,e){return`
2
2
  #upstep-root *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif}
3
- #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}
3
+ #upstep-btn{position:fixed;bottom:24px;right:24px;left:auto;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:pointer;box-shadow:0 6px 20px rgba(26,25,21,.18);transition:transform .15s,box-shadow .15s}
4
4
  #upstep-btn svg{width:16px;height:16px;flex-shrink:0}
5
5
  #upstep-btn:hover{transform:translateY(-1px);box-shadow:0 8px 26px rgba(26,25,21,.24)}
6
- #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}
7
6
  @media(max-width:639px){#upstep-btn{padding:12px}#upstep-btn span{display:none}}
8
- #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}
7
+ @media(max-width:639px){#upstep-backdrop{padding:0 12px 80px!important}#upstep-modal{max-height:calc(100dvh - 104px)!important}}
8
+ #upstep-backdrop{position:fixed;inset:0;background:transparent;z-index:9999;display:flex;align-items:flex-end;justify-content:flex-end;padding:0 24px 88px;animation:upstep-fade .2s ease}
9
9
  @keyframes upstep-fade{from{opacity:0}to{opacity:1}}
10
10
  @keyframes upstep-rise{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:translateY(0)}}
11
- #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)}
11
+ #upstep-modal{background:${e.bg};border:1px solid ${e.border};border-radius:20px;width:100%;max-width:440px;max-height:calc(100dvh - 112px);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)}
12
12
  #upstep-header{display:flex;align-items:flex-start;justify-content:space-between;padding:20px 20px 0}
13
- #upstep-header h2{margin:0;font-size:16px;font-weight:700;color:${t.text};letter-spacing:-.01em}
14
- #upstep-header p{margin:2px 0 0;font-size:12.5px;color:${t.textFaint}}
15
- #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}
16
- #upstep-close:hover{background:${t.bgHover};color:${t.text}}
17
- #upstep-tabs{display:flex;gap:4px;margin:16px 20px 0;padding:4px;background:${t.bgSoft};border-radius:11px}
18
- .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}
19
- .upstep-tab.active{background:${t.bg};color:${t.text};box-shadow:0 1px 3px rgba(0,0,0,.08)}
13
+ #upstep-header h2{margin:0;font-size:16px;font-weight:700;color:${e.text};letter-spacing:-.01em}
14
+ #upstep-header p{margin:2px 0 0;font-size:14px;color:${e.textFaint}}
15
+ #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}
16
+ #upstep-close:hover{background:${e.bgHover};color:${e.text}}
17
+ #upstep-tabs{display:flex;gap:4px;margin:16px 20px 0;padding:4px;background:${e.bgSoft};border-radius:11px}
18
+ .upstep-tab{flex:1;padding:8px;background:none;border:none;border-radius:8px;font-size:14px;font-weight:600;color:${e.textSoft};cursor:pointer;transition:all .15s}
19
+ .upstep-mode .upstep-tab.active{background:${e.bgSoft};box-shadow:none}
20
+ .upstep-tab.active{background:${e.bg};color:${e.text};box-shadow:0 1px 3px rgba(0,0,0,.08)}
20
21
  #upstep-body{flex:1;overflow-y:auto;padding:18px 20px 22px}
21
- .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}
22
- .upstep-form textarea::placeholder{color:${t.textFaint}}
23
- .upstep-form textarea:focus{border-color:${o};background:${t.bg}}
22
+ .upstep-form textarea{width:100%;min-height:104px;border:1px solid ${e.border};border-radius:12px;padding:12px;font-size:16px;line-height:1.6;resize:vertical;outline:none;background:${e.bgSoft};color:${e.text};transition:border-color .15s}
23
+ .upstep-form textarea::placeholder{color:${e.textFaint}}
24
+ .upstep-form textarea:focus{border-color:${o};background:${e.bg}}
24
25
  .upstep-type-row{display:flex;gap:7px;margin:12px 0 4px}
25
- .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}
26
+ .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:14px;font-weight:600;cursor:pointer;transition:all .15s}
26
27
  .upstep-type-btn svg{width:12px;height:12px;flex-shrink:0}
27
- .upstep-type-btn:hover{border-color:${t.textFaint}}
28
+ .upstep-type-btn:hover{border-color:${e.textFaint}}
28
29
  .upstep-type-btn.selected{background:${o};color:#fff;border-color:${o}}
29
30
  .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}
30
31
  .upstep-submit:hover{filter:brightness(.94)}
31
32
  .upstep-submit:disabled{opacity:.5;cursor:not-allowed}
32
- #upstep-form-msg{font-size:13px;text-align:center;margin-top:12px;color:${o};font-weight:500}
33
- .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}
34
- .upstep-feedback-item:hover{border-color:${t.textFaint}}
35
- .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}
33
+ #upstep-form-msg{font-size:14px;text-align:center;margin-top:12px;color:${o};font-weight:500}
34
+ .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}
35
+ .upstep-feedback-item:hover{border-color:${e.textFaint}}
36
+ .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}
36
37
  .upstep-vote:hover{border-color:${o}}
37
38
  .upstep-vote.voted{border-color:${o};background:${o}1a}
38
39
  .upstep-vote-arrow{font-size:11px;line-height:1;color:${o}}
39
- .upstep-vote-count{font-size:14px;font-weight:700;color:${t.text};line-height:1.1}
40
+ .upstep-vote-count{font-size:14px;font-weight:700;color:${e.text};line-height:1.1}
40
41
  .upstep-feedback-main{flex:1;min-width:0}
41
- .upstep-feedback-content{font-size:13.5px;line-height:1.5;color:${t.text};margin:0 0 8px;word-break:break-word}
42
+ .upstep-feedback-content{font-size:16px;line-height:1.5;color:${e.text};margin:0 0 8px;word-break:break-word}
42
43
  .upstep-feedback-meta{display:flex;align-items:center;gap:7px}
43
44
  .upstep-badge{display:inline-flex;align-items:center;padding:2px 8px;border-radius:9999px;font-size:10.5px;font-weight:700;letter-spacing:.02em}
44
45
  .upstep-badge-bug{background:#fdecec;color:#d6453d}
45
46
  .upstep-badge-feature{background:#e9f0fd;color:#3b76d6}
46
- .upstep-badge-general{background:${t.bgSoft};color:${t.textSoft}}
47
- .upstep-feedback-date{font-size:11px;color:${t.textFaint}}
48
- .upstep-empty{text-align:center;color:${t.textFaint};font-size:14px;padding:40px 0}
49
- .upstep-empty strong{display:block;color:${t.textSoft};font-size:15px;margin-bottom:4px}
50
- `}const C='<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>';class F{constructor(e,t={}){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=e,this.accent=t.accentColor??S,this.position=t.position??"right",this.showLauncher=t.launcher!==!1,this.themeMode=t.theme??"auto",this.palette=y(this.themeMode)==="dark"?x:m}mount(){this.injectStyles(),this.showLauncher&&this.renderButton(),this.client.supportEnabled().then(e=>{if(this.hasSupport=e,e){const t=document.querySelector("#upstep-btn span");t&&(t.textContent="Help & feedback"),this.isOpen&&this.renderModal()}})}openWidget(){this.openModal()}closeWidget(){this.closeModal()}injectStyles(){var t;(t=document.getElementById("upstep-styles"))==null||t.remove();const e=document.createElement("style");e.id="upstep-styles",e.textContent=L(this.accent,this.position,this.palette),document.head.appendChild(e)}renderButton(){const e=document.createElement("button");e.id="upstep-btn",e.setAttribute("aria-label","Open help and feedback"),e.innerHTML=`${C}<span>Feedback</span>`,e.addEventListener("click",()=>{this.dragMoved||this.openModal()}),document.body.appendChild(e),this.makeDraggable(e)}makeDraggable(e){const s="upstep-btn-pos";try{const i=localStorage.getItem(s);if(i){const{side:d,bottom:u}=JSON.parse(i);e.style.left=d==="left"?"24px":"auto",e.style.right=d==="right"?"24px":"auto",e.style.top="auto",e.style.bottom=`${u}px`}}catch{}let a=0,r=0,l=0,b=0,h=!1;const $=()=>{const i=e.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;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=d==="left"?"24px":"auto",e.style.right=d==="right"?"24px":"auto",e.style.top="auto",e.style.bottom=`${g}px`;try{localStorage.setItem(s,JSON.stringify({side:d,bottom:g}))}catch{}},M=i=>{if(i.pointerType==="mouse"&&i.button!==0)return;this.dragMoved=!1,h=!0;const d=e.getBoundingClientRect();a=i.clientX,r=i.clientY,l=d.left,b=d.top,e.setPointerCapture(i.pointerId),e.style.transition="none"},E=i=>{if(!h)return;const d=i.clientX-a,u=i.clientY-r;!this.dragMoved&&Math.hypot(d,u)<6||(this.dragMoved||e.classList.add("upstep-dragging"),this.dragMoved=!0,e.style.left=`${l+d}px`,e.style.right="auto",e.style.top=`${b+u}px`,e.style.bottom="auto")},f=()=>{h&&(h=!1,e.classList.remove("upstep-dragging"),this.dragMoved&&$())};e.addEventListener("pointerdown",M),e.addEventListener("pointermove",E),e.addEventListener("pointerup",f),e.addEventListener("pointercancel",f)}openModal(){this.isOpen=!0,this.palette=y(this.themeMode)==="dark"?x:m,this.injectStyles(),this.fetchFeed(),this.renderModal()}closeModal(){var e,t;(e=this.disconnectSupport)==null||e.call(this),this.disconnectSupport=null,this.isOpen=!1,(t=document.getElementById("upstep-backdrop"))==null||t.remove()}async fetchFeed(){try{const e=await this.client.listFeedback({sort:"votes",limit:20});this.feedItems=e.items,this.renderFeedList()}catch{}}renderModal(){var n,s,a;(n=this.disconnectSupport)==null||n.call(this),this.disconnectSupport=null;const e=document.createElement("div");e.id="upstep-backdrop",e.addEventListener("click",r=>{r.target===e&&this.closeModal()}),e.innerHTML=`
51
- <div id="upstep-modal">
52
- <div id="upstep-header">
53
- <div>
54
- <h2>${this.tab==="support"?"Customer support":"Share your feedback"}</h2>
55
- <p>${this.tab==="support"?"Ask AI, or talk with the team.":"Tell us what to build next, or vote on ideas."}</p>
56
- </div>
57
- <button id="upstep-close" aria-label="Close">✕</button>
58
- </div>
59
- <div id="upstep-tabs">
60
- ${this.hasSupport?`<button class="upstep-tab ${this.tab==="support"?"active":""}" data-tab="support">Support</button>`:""}
61
- <button class="upstep-tab ${this.tab==="submit"?"active":""}" data-tab="submit">Give feedback</button>
62
- <button class="upstep-tab ${this.tab==="feed"?"active":""}" data-tab="feed">Vote on ideas</button>
63
- </div>
64
- <div id="upstep-body">
65
- ${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:480px;border:0;display:block;border-radius:12px"></iframe>`:this.tab==="submit"?this.renderSubmitForm():this.renderFeed()}
47
+ .upstep-badge-general{background:${e.bgSoft};color:${e.textSoft}}
48
+ .upstep-feedback-date{font-size:11px;color:${e.textFaint}}
49
+ .upstep-empty{text-align:center;color:${e.textFaint};font-size:14px;padding:40px 0}
50
+ .upstep-empty strong{display:block;color:${e.textSoft};font-size:15px;margin-bottom:4px}
51
+ `}const g='<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>';class y{constructor(t,e={}){this.isOpen=!1,this.tab="submit",this.feedItems=[],this.selectedType="GENERAL",this.loading=!1,this.hasSupport=!1,this.disconnectSupport=null,this.client=t,this.accent=e.accentColor??x,this.position="right",this.showLauncher=e.launcher!==!1,this.themeMode=e.theme??"auto",this.palette=c(this.themeMode)==="dark"?u:l}mount(){this.injectStyles(),this.showLauncher&&this.renderButton(),this.client.supportEnabled().then(t=>{if(this.hasSupport=t,t){const e=document.querySelector("#upstep-btn span");e&&(e.textContent="Help & feedback"),this.isOpen&&this.renderModal()}})}openWidget(){this.openModal()}closeWidget(){this.closeModal()}injectStyles(){var e;(e=document.getElementById("upstep-styles"))==null||e.remove();const t=document.createElement("style");t.id="upstep-styles",t.textContent=m(this.accent,this.position,this.palette),document.head.appendChild(t)}renderButton(){const t=document.createElement("button");t.id="upstep-btn",t.setAttribute("aria-label","Open help and feedback"),t.innerHTML=`${g}<span>Feedback</span>`,t.addEventListener("click",()=>{this.openModal()}),document.body.appendChild(t)}openModal(){!this.isOpen&&this.hasSupport&&(this.tab="support"),this.isOpen=!0,this.palette=c(this.themeMode)==="dark"?u:l,this.injectStyles(),this.fetchFeed(),this.renderModal()}closeModal(){var t,e;(t=this.disconnectSupport)==null||t.call(this),this.disconnectSupport=null,this.isOpen=!1,(e=document.getElementById("upstep-backdrop"))==null||e.remove()}async fetchFeed(){try{const t=await this.client.listFeedback({sort:"votes",limit:20});this.feedItems=t.items,this.renderFeedList()}catch{}}renderModal(){var i,s,n;(i=this.disconnectSupport)==null||i.call(this),this.disconnectSupport=null;const t=document.createElement("div");t.id="upstep-backdrop",t.addEventListener("click",d=>{d.target===t&&this.closeModal()}),t.innerHTML=`
52
+ <div id="upstep-modal" style="max-width:${this.hasSupport?"460px":"440px"}">
53
+ ${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>`}
54
+ <div id="upstep-body" style="${this.tab==="support"?"padding:0;overflow:hidden":""}">
55
+ ${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(100dvh - 168px));min-height:300px;border:0;display:block"></iframe>`:this.tab==="submit"?this.renderSubmitForm():this.renderFeed()}
66
56
  </div>
67
57
  </div>
68
- `,(s=document.getElementById("upstep-backdrop"))==null||s.remove(),document.body.appendChild(e),(a=e.querySelector("#upstep-close"))==null||a.addEventListener("click",()=>this.closeModal()),e.querySelectorAll(".upstep-tab").forEach(r=>{r.addEventListener("click",()=>{this.tab=r.dataset.tab,this.renderModal()})});const t=e.querySelector("#upstep-support-frame");t&&(this.disconnectSupport=this.client.connectSupportFrame(t)),this.bindSubmitForm(),this.bindVoteButtons()}renderSubmitForm(){const e=["BUG","FEATURE","GENERAL"],t={BUG:"Bug",FEATURE:"Feature",GENERAL:"General"},n={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>',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>',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>'};return`
58
+ `,(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(d=>{d.addEventListener("click",()=>{this.tab=d.dataset.tab,this.renderModal()})});const e=t.querySelector("#upstep-support-frame");e&&(this.disconnectSupport=this.client.connectSupportFrame(e)),this.bindSubmitForm(),this.bindVoteButtons()}renderSubmitForm(){const t=["BUG","FEATURE","GENERAL"],e={BUG:"Bug",FEATURE:"Feature",GENERAL:"General"},i={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>',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>',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>'};return`
69
59
  <div class="upstep-form">
70
60
  <textarea id="upstep-textarea" placeholder="What's on your mind?" maxlength="2000"></textarea>
71
61
  <div class="upstep-type-row">
72
- ${e.map(s=>`<button class="upstep-type-btn${this.selectedType===s?" selected":""}" data-type="${s}">${n[s]}${t[s]}</button>`).join("")}
62
+ ${t.map(s=>`<button class="upstep-type-btn${this.selectedType===s?" selected":""}" data-type="${s}">${i[s]}${e[s]}</button>`).join("")}
73
63
  </div>
74
64
  <button class="upstep-submit" id="upstep-submit-btn">Send feedback</button>
75
65
  <div id="upstep-form-msg"></div>
76
66
  </div>
77
- `}renderFeed(){return this.feedItems.length?this.feedItems.map(e=>{var t;return`
78
- <div class="upstep-feedback-item" data-id="${e.id}">
79
- <button class="upstep-vote${e.userVote==="UP"?" voted":""}" data-vote="UP" data-feedback="${e.id}">
67
+ `}renderFeed(){return this.feedItems.length?this.feedItems.map(t=>{var e;return`
68
+ <div class="upstep-feedback-item" data-id="${t.id}">
69
+ <button class="upstep-vote${t.userVote==="UP"?" voted":""}" data-vote="UP" data-feedback="${t.id}">
80
70
  <span class="upstep-vote-arrow">▲</span>
81
- <span class="upstep-vote-count">${e.upvotes}</span>
71
+ <span class="upstep-vote-count">${t.upvotes}</span>
82
72
  </button>
83
73
  <div class="upstep-feedback-main">
84
- <p class="upstep-feedback-content">${v(e.content)}</p>
74
+ <p class="upstep-feedback-content">${b(t.content)}</p>
85
75
  <div class="upstep-feedback-meta">
86
- <span class="upstep-badge upstep-badge-${e.type.toLowerCase()}">${e.type}</span>
87
- <span class="upstep-badge upstep-badge-general">${v(((t=e.boardStatus)==null?void 0:t.name)??e.status.replace("_"," "))}</span>
88
- <span class="upstep-feedback-date">${new Date(e.createdAt).toLocaleDateString()}</span>
76
+ <span class="upstep-badge upstep-badge-${t.type.toLowerCase()}">${t.type}</span>
77
+ <span class="upstep-badge upstep-badge-general">${b(((e=t.boardStatus)==null?void 0:e.name)??t.status.replace("_"," "))}</span>
78
+ <span class="upstep-feedback-date">${new Date(t.createdAt).toLocaleDateString()}</span>
89
79
  </div>
90
80
  </div>
91
- </div>`}).join(""):'<div class="upstep-empty"><strong>No ideas yet</strong>Be the first to share one.</div>'}renderFeedList(){const e=document.getElementById("upstep-body");!e||this.tab!=="feed"||(e.innerHTML=this.renderFeed(),this.bindVoteButtons())}bindSubmitForm(){var e;document.querySelectorAll(".upstep-type-btn").forEach(t=>{t.addEventListener("click",()=>{this.selectedType=t.dataset.type,document.querySelectorAll(".upstep-type-btn").forEach(n=>n.classList.remove("selected")),t.classList.add("selected")})}),(e=document.getElementById("upstep-submit-btn"))==null||e.addEventListener("click",async()=>{const t=document.getElementById("upstep-textarea"),n=document.getElementById("upstep-form-msg"),s=document.getElementById("upstep-submit-btn");if(!t||this.loading)return;const a=t.value.trim();if(a){this.loading=!0,s&&(s.disabled=!0,s.textContent="Sending…");try{await this.client.submitFeedback({content:a,type:this.selectedType}),t.value="",n&&(n.textContent="Feedback received. Thank you."),await this.fetchFeed()}catch{n&&(n.textContent="Something went wrong. Please try again.")}finally{this.loading=!1,s&&(s.disabled=!1,s.textContent="Send feedback")}}})}bindVoteButtons(){document.querySelectorAll(".upstep-vote").forEach(e=>{e.addEventListener("click",async()=>{const t=e.dataset.feedback;try{await this.client.vote(t,"UP"),await this.fetchFeed()}catch{}})})}}function v(o){return o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let p=null,c=null;const w={init(o){if(p=new k.UpstepApiClient(o),typeof window<"u"){const e={};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);const t=()=>{c=new F(p,e),c.mount()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):t()}return p},open(){c==null||c.openWidget()},close(){c==null||c.closeWidget()},identify(o){p==null||p.setUserId(o)},identifySupport(o){var t;p&&(p.supportIdentityToken=o);const e=document.querySelector("#upstep-support-frame");e&&p&&((t=e.contentWindow)==null||t.postMessage({type:"upstep:support:identity",token:o},new URL(p.baseUrl).origin))},get client(){if(!p)throw new Error("Upstep.init() must be called first");return p}};if(typeof document<"u"){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,a=o==null?void 0:o.dataset.position,r=o==null?void 0:o.dataset.theme;if(e){const l={apiKey:e};t&&(l.userId=t),(o==null?void 0:o.dataset.chat)!==void 0&&(l.chat=o.dataset.chat!=="false"),n&&(l.baseUrl=n),s&&(l.accentColor=s),(a==="left"||a==="right")&&(l.position=a),(r==="light"||r==="dark"||r==="auto")&&(l.theme=r),w.init(l)}}exports.UpstepApiClient=k.UpstepApiClient;exports.default=w;
81
+ </div>`}).join(""):'<div class="upstep-empty"><strong>No ideas yet</strong>Be the first to share one.</div>'}renderFeedList(){const t=document.getElementById("upstep-body");!t||this.tab!=="feed"||(t.innerHTML=this.renderFeed(),this.bindVoteButtons())}bindSubmitForm(){var t;document.querySelectorAll(".upstep-type-btn").forEach(e=>{e.addEventListener("click",()=>{this.selectedType=e.dataset.type,document.querySelectorAll(".upstep-type-btn").forEach(i=>i.classList.remove("selected")),e.classList.add("selected")})}),(t=document.getElementById("upstep-submit-btn"))==null||t.addEventListener("click",async()=>{const e=document.getElementById("upstep-textarea"),i=document.getElementById("upstep-form-msg"),s=document.getElementById("upstep-submit-btn");if(!e||this.loading)return;const n=e.value.trim();if(n){this.loading=!0,s&&(s.disabled=!0,s.textContent="Sending…");try{await this.client.submitFeedback({content:n,type:this.selectedType}),e.value="",i&&(i.textContent="Feedback received. Thank you."),await this.fetchFeed()}catch{i&&(i.textContent="Something went wrong. Please try again.")}finally{this.loading=!1,s&&(s.disabled=!1,s.textContent="Send feedback")}}})}bindVoteButtons(){document.querySelectorAll(".upstep-vote").forEach(t=>{t.addEventListener("click",async()=>{const e=t.dataset.feedback;try{await this.client.vote(e,"UP"),await this.fetchFeed()}catch{}})})}}function b(o){return o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let a=null,r=null;const f={init(o){if(a=new h.UpstepApiClient(o),typeof window<"u"){const t={};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);const e=()=>{r=new y(a,t),r.mount()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):e()}return a},open(){r==null||r.openWidget()},close(){r==null||r.closeWidget()},identify(o){a==null||a.setUserId(o)},identifySupport(o){var e;a&&(a.supportIdentityToken=o);const t=document.querySelector("#upstep-support-frame");t&&a&&((e=t.contentWindow)==null||e.postMessage({type:"upstep:support:identity",token:o},new URL(a.baseUrl).origin))},get client(){if(!a)throw new Error("Upstep.init() must be called first");return a}};if(typeof document<"u"){const o=document.currentScript,t=o==null?void 0:o.dataset.apiKey,e=o==null?void 0:o.dataset.userId,i=o==null?void 0:o.dataset.baseUrl,s=o==null?void 0:o.dataset.accentColor,n=o==null?void 0:o.dataset.position,d=o==null?void 0:o.dataset.theme;if(t){const p={apiKey:t};e&&(p.userId=e),(o==null?void 0:o.dataset.chat)!==void 0&&(p.chat=o.dataset.chat!=="false"),i&&(p.baseUrl=i),s&&(p.accentColor=s),(n==="left"||n==="right")&&(p.position=n),(d==="light"||d==="dark"||d==="auto")&&(p.theme=d),f.init(p)}}exports.UpstepApiClient=h.UpstepApiClient;exports.default=f;