@upstep/js 0.6.1 → 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.1/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,81 +1,81 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const k=require("./api-BuSqdsZp.js"),E="#D97757",x={bg:"#ffffff",bgSoft:"#f6f5f2",bgHover:"#efede8",text:"#1a1915",textSoft:"#56544d",textFaint:"#9b9890",border:"#e8e6df",overlay:"rgba(26,25,21,.45)"},m={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-mode .upstep-tab.active{background:${t.bgSoft};box-shadow:none}
20
- .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)}
21
21
  #upstep-body{flex:1;overflow-y:auto;padding:18px 20px 22px}
22
- .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}
23
- .upstep-form textarea::placeholder{color:${t.textFaint}}
24
- .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}}
25
25
  .upstep-type-row{display:flex;gap:7px;margin:12px 0 4px}
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 ${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}
27
27
  .upstep-type-btn svg{width:12px;height:12px;flex-shrink:0}
28
- .upstep-type-btn:hover{border-color:${t.textFaint}}
28
+ .upstep-type-btn:hover{border-color:${e.textFaint}}
29
29
  .upstep-type-btn.selected{background:${o};color:#fff;border-color:${o}}
30
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}
31
31
  .upstep-submit:hover{filter:brightness(.94)}
32
32
  .upstep-submit:disabled{opacity:.5;cursor:not-allowed}
33
- #upstep-form-msg{font-size:13px;text-align:center;margin-top:12px;color:${o};font-weight:500}
34
- .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}
35
- .upstep-feedback-item:hover{border-color:${t.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 ${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}
37
37
  .upstep-vote:hover{border-color:${o}}
38
38
  .upstep-vote.voted{border-color:${o};background:${o}1a}
39
39
  .upstep-vote-arrow{font-size:11px;line-height:1;color:${o}}
40
- .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}
41
41
  .upstep-feedback-main{flex:1;min-width:0}
42
- .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}
43
43
  .upstep-feedback-meta{display:flex;align-items:center;gap:7px}
44
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}
45
45
  .upstep-badge-bug{background:#fdecec;color:#d6453d}
46
46
  .upstep-badge-feature{background:#e9f0fd;color:#3b76d6}
47
- .upstep-badge-general{background:${t.bgSoft};color:${t.textSoft}}
48
- .upstep-feedback-date{font-size:11px;color:${t.textFaint}}
49
- .upstep-empty{text-align:center;color:${t.textFaint};font-size:14px;padding:40px 0}
50
- .upstep-empty strong{display:block;color:${t.textSoft};font-size:15px;margin-bottom:4px}
51
- `}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??E,this.position=t.position??"right",this.showLauncher=t.launcher!==!1,this.themeMode=t.theme??"auto",this.palette=y(this.themeMode)==="dark"?m:x}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 n=0,r=0,l=0,h=0,b=!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,b=!0;const d=e.getBoundingClientRect();n=i.clientX,r=i.clientY,l=d.left,h=d.top,e.setPointerCapture(i.pointerId),e.style.transition="none"},S=i=>{if(!b)return;const d=i.clientX-n,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=`${h+u}px`,e.style.bottom="auto")},f=()=>{b&&(b=!1,e.classList.remove("upstep-dragging"),this.dragMoved&&$())};e.addEventListener("pointerdown",M),e.addEventListener("pointermove",S),e.addEventListener("pointerup",f),e.addEventListener("pointercancel",f)}openModal(){this.isOpen=!0,this.palette=y(this.themeMode)==="dark"?m:x,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 a,s,n;(a=this.disconnectSupport)==null||a.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=`
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
52
  <div id="upstep-modal" style="max-width:${this.hasSupport?"460px":"440px"}">
53
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
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(88dvh - 56px));min-height:300px;border:0;display:block"></iframe>`:this.tab==="submit"?this.renderSubmitForm():this.renderFeed()}
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()}
56
56
  </div>
57
57
  </div>
58
- `,(s=document.getElementById("upstep-backdrop"))==null||s.remove(),document.body.appendChild(e),(n=e.querySelector("#upstep-close"))==null||n.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"},a={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`
59
59
  <div class="upstep-form">
60
60
  <textarea id="upstep-textarea" placeholder="What's on your mind?" maxlength="2000"></textarea>
61
61
  <div class="upstep-type-row">
62
- ${e.map(s=>`<button class="upstep-type-btn${this.selectedType===s?" selected":""}" data-type="${s}">${a[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("")}
63
63
  </div>
64
64
  <button class="upstep-submit" id="upstep-submit-btn">Send feedback</button>
65
65
  <div id="upstep-form-msg"></div>
66
66
  </div>
67
- `}renderFeed(){return this.feedItems.length?this.feedItems.map(e=>{var t;return`
68
- <div class="upstep-feedback-item" data-id="${e.id}">
69
- <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}">
70
70
  <span class="upstep-vote-arrow">▲</span>
71
- <span class="upstep-vote-count">${e.upvotes}</span>
71
+ <span class="upstep-vote-count">${t.upvotes}</span>
72
72
  </button>
73
73
  <div class="upstep-feedback-main">
74
- <p class="upstep-feedback-content">${v(e.content)}</p>
74
+ <p class="upstep-feedback-content">${b(t.content)}</p>
75
75
  <div class="upstep-feedback-meta">
76
- <span class="upstep-badge upstep-badge-${e.type.toLowerCase()}">${e.type}</span>
77
- <span class="upstep-badge upstep-badge-general">${v(((t=e.boardStatus)==null?void 0:t.name)??e.status.replace("_"," "))}</span>
78
- <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>
79
79
  </div>
80
80
  </div>
81
- </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(a=>a.classList.remove("selected")),t.classList.add("selected")})}),(e=document.getElementById("upstep-submit-btn"))==null||e.addEventListener("click",async()=>{const t=document.getElementById("upstep-textarea"),a=document.getElementById("upstep-form-msg"),s=document.getElementById("upstep-submit-btn");if(!t||this.loading)return;const n=t.value.trim();if(n){this.loading=!0,s&&(s.disabled=!0,s.textContent="Sending…");try{await this.client.submitFeedback({content:n,type:this.selectedType}),t.value="",a&&(a.textContent="Feedback received. Thank you."),await this.fetchFeed()}catch{a&&(a.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,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;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"),a&&(l.baseUrl=a),s&&(l.accentColor=s),(n==="left"||n==="right")&&(l.position=n),(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;
package/dist/index.js CHANGED
@@ -1,24 +1,24 @@
1
- import { U as M } from "./api-C1UV7Szw.mjs";
2
- const E = "#D97757", x = {
1
+ import { U as h } from "./api-C1UV7Szw.mjs";
2
+ const f = "#5B7168", l = {
3
3
  bg: "#ffffff",
4
- bgSoft: "#f6f5f2",
5
- bgHover: "#efede8",
4
+ bgSoft: "#f4f6f4",
5
+ bgHover: "#eaf0eb",
6
6
  text: "#1a1915",
7
7
  textSoft: "#56544d",
8
8
  textFaint: "#9b9890",
9
9
  border: "#e8e6df",
10
10
  overlay: "rgba(26,25,21,.45)"
11
- }, m = {
11
+ }, c = {
12
12
  bg: "#000000",
13
- bgSoft: "#262522",
14
- bgHover: "#302e2a",
13
+ bgSoft: "#191d1b",
14
+ bgHover: "#252d28",
15
15
  text: "#f5f4f0",
16
16
  textSoft: "#b4b1a8",
17
17
  textFaint: "#7d7a72",
18
18
  border: "#33312c",
19
19
  overlay: "rgba(0,0,0,.6)"
20
20
  };
21
- function y(o) {
21
+ function u(o) {
22
22
  if (o === "light" || o === "dark") return o;
23
23
  if (typeof document < "u") {
24
24
  const t = document.documentElement;
@@ -26,40 +26,40 @@ function y(o) {
26
26
  }
27
27
  return typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
28
28
  }
29
- function S(o, t, e) {
29
+ function x(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;${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}
32
+ #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}
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
- #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
35
  @media(max-width:639px){#upstep-btn{padding:12px}#upstep-btn span{display:none}}
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}
36
+ @media(max-width:639px){#upstep-backdrop{padding:0 12px 80px!important}#upstep-modal{max-height:calc(100dvh - 104px)!important}}
37
+ #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}
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:${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)}
40
+ #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)}
41
41
  #upstep-header{display:flex;align-items:flex-start;justify-content:space-between;padding:20px 20px 0}
42
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}}
43
+ #upstep-header p{margin:2px 0 0;font-size:14px;color:${e.textFaint}}
44
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
45
  #upstep-close:hover{background:${e.bgHover};color:${e.text}}
46
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}
47
+ .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}
48
48
  .upstep-mode .upstep-tab.active{background:${e.bgSoft};box-shadow:none}
49
49
  .upstep-tab.active{background:${e.bg};color:${e.text};box-shadow:0 1px 3px rgba(0,0,0,.08)}
50
50
  #upstep-body{flex:1;overflow-y:auto;padding:18px 20px 22px}
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}
51
+ .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}
52
52
  .upstep-form textarea::placeholder{color:${e.textFaint}}
53
53
  .upstep-form textarea:focus{border-color:${o};background:${e.bg}}
54
54
  .upstep-type-row{display:flex;gap:7px;margin:12px 0 4px}
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
+ .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}
56
56
  .upstep-type-btn svg{width:12px;height:12px;flex-shrink:0}
57
57
  .upstep-type-btn:hover{border-color:${e.textFaint}}
58
58
  .upstep-type-btn.selected{background:${o};color:#fff;border-color:${o}}
59
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}
60
60
  .upstep-submit:hover{filter:brightness(.94)}
61
61
  .upstep-submit:disabled{opacity:.5;cursor:not-allowed}
62
- #upstep-form-msg{font-size:13px;text-align:center;margin-top:12px;color:${o};font-weight:500}
62
+ #upstep-form-msg{font-size:14px;text-align:center;margin-top:12px;color:${o};font-weight:500}
63
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
64
  .upstep-feedback-item:hover{border-color:${e.textFaint}}
65
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}
@@ -68,7 +68,7 @@ function S(o, t, e) {
68
68
  .upstep-vote-arrow{font-size:11px;line-height:1;color:${o}}
69
69
  .upstep-vote-count{font-size:14px;font-weight:700;color:${e.text};line-height:1.1}
70
70
  .upstep-feedback-main{flex:1;min-width:0}
71
- .upstep-feedback-content{font-size:13.5px;line-height:1.5;color:${e.text};margin:0 0 8px;word-break:break-word}
71
+ .upstep-feedback-content{font-size:16px;line-height:1.5;color:${e.text};margin:0 0 8px;word-break:break-word}
72
72
  .upstep-feedback-meta{display:flex;align-items:center;gap:7px}
73
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}
74
74
  .upstep-badge-bug{background:#fdecec;color:#d6453d}
@@ -79,10 +79,10 @@ function S(o, t, e) {
79
79
  .upstep-empty strong{display:block;color:${e.textSoft};font-size:15px;margin-bottom:4px}
80
80
  `;
81
81
  }
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>';
83
- class F {
82
+ const m = '<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>';
83
+ class g {
84
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
+ 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 ?? f, this.position = "right", this.showLauncher = e.launcher !== !1, this.themeMode = e.theme ?? "auto", this.palette = u(this.themeMode) === "dark" ? c : l;
86
86
  }
87
87
  mount() {
88
88
  this.injectStyles(), this.showLauncher && this.renderButton(), this.client.supportEnabled().then((t) => {
@@ -104,48 +104,16 @@ class F {
104
104
  var e;
105
105
  (e = document.getElementById("upstep-styles")) == null || e.remove();
106
106
  const t = document.createElement("style");
107
- t.id = "upstep-styles", t.textContent = S(this.accent, this.position, this.palette), document.head.appendChild(t);
107
+ t.id = "upstep-styles", t.textContent = x(this.accent, this.position, this.palette), document.head.appendChild(t);
108
108
  }
109
109
  renderButton() {
110
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", () => {
112
- this.dragMoved || this.openModal();
113
- }), document.body.appendChild(t), this.makeDraggable(t);
114
- }
115
- makeDraggable(t) {
116
- const s = "upstep-btn-pos";
117
- try {
118
- const i = localStorage.getItem(s);
119
- if (i) {
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`;
122
- }
123
- } catch {
124
- }
125
- let n = 0, r = 0, l = 0, h = 0, b = !1;
126
- const k = () => {
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`;
129
- try {
130
- localStorage.setItem(s, JSON.stringify({ side: d, bottom: g }));
131
- } catch {
132
- }
133
- }, w = (i) => {
134
- if (i.pointerType === "mouse" && i.button !== 0) return;
135
- this.dragMoved = !1, b = !0;
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";
138
- }, $ = (i) => {
139
- if (!b) return;
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");
142
- }, f = () => {
143
- b && (b = !1, t.classList.remove("upstep-dragging"), this.dragMoved && k());
144
- };
145
- t.addEventListener("pointerdown", w), t.addEventListener("pointermove", $), t.addEventListener("pointerup", f), t.addEventListener("pointercancel", f);
111
+ t.id = "upstep-btn", t.setAttribute("aria-label", "Open help and feedback"), t.innerHTML = `${m}<span>Feedback</span>`, t.addEventListener("click", () => {
112
+ this.openModal();
113
+ }), document.body.appendChild(t);
146
114
  }
147
115
  openModal() {
148
- this.isOpen = !0, this.palette = y(this.themeMode) === "dark" ? m : x, this.injectStyles(), this.fetchFeed(), this.renderModal();
116
+ !this.isOpen && this.hasSupport && (this.tab = "support"), this.isOpen = !0, this.palette = u(this.themeMode) === "dark" ? c : l, this.injectStyles(), this.fetchFeed(), this.renderModal();
149
117
  }
150
118
  closeModal() {
151
119
  var t, e;
@@ -159,28 +127,34 @@ class F {
159
127
  }
160
128
  }
161
129
  renderModal() {
162
- var a, s, n;
163
- (a = this.disconnectSupport) == null || a.call(this), this.disconnectSupport = null;
130
+ var i, s, n;
131
+ (i = this.disconnectSupport) == null || i.call(this), this.disconnectSupport = null;
164
132
  const t = document.createElement("div");
165
- t.id = "upstep-backdrop", t.addEventListener("click", (r) => {
166
- r.target === t && this.closeModal();
133
+ t.id = "upstep-backdrop", t.addEventListener("click", (d) => {
134
+ d.target === t && this.closeModal();
167
135
  }), t.innerHTML = `
168
136
  <div id="upstep-modal" style="max-width:${this.hasSupport ? "460px" : "440px"}">
169
137
  ${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
138
  <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()}
139
+ ${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()}
172
140
  </div>
173
141
  </div>
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();
142
+ `, (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) => {
143
+ d.addEventListener("click", () => {
144
+ this.tab = d.dataset.tab, this.renderModal();
177
145
  });
178
146
  });
179
- const e = t.querySelector("#upstep-support-frame");
147
+ const e = t.querySelector(
148
+ "#upstep-support-frame"
149
+ );
180
150
  e && (this.disconnectSupport = this.client.connectSupportFrame(e)), this.bindSubmitForm(), this.bindVoteButtons();
181
151
  }
182
152
  renderSubmitForm() {
183
- const t = ["BUG", "FEATURE", "GENERAL"], e = { BUG: "Bug", FEATURE: "Feature", GENERAL: "General" }, a = {
153
+ const t = ["BUG", "FEATURE", "GENERAL"], e = {
154
+ BUG: "Bug",
155
+ FEATURE: "Feature",
156
+ GENERAL: "General"
157
+ }, i = {
184
158
  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>',
185
159
  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>',
186
160
  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>'
@@ -189,7 +163,7 @@ class F {
189
163
  <div class="upstep-form">
190
164
  <textarea id="upstep-textarea" placeholder="What's on your mind?" maxlength="2000"></textarea>
191
165
  <div class="upstep-type-row">
192
- ${t.map((s) => `<button class="upstep-type-btn${this.selectedType === s ? " selected" : ""}" data-type="${s}">${a[s]}${e[s]}</button>`).join("")}
166
+ ${t.map((s) => `<button class="upstep-type-btn${this.selectedType === s ? " selected" : ""}" data-type="${s}">${i[s]}${e[s]}</button>`).join("")}
193
167
  </div>
194
168
  <button class="upstep-submit" id="upstep-submit-btn">Send feedback</button>
195
169
  <div id="upstep-form-msg"></div>
@@ -207,10 +181,10 @@ class F {
207
181
  <span class="upstep-vote-count">${t.upvotes}</span>
208
182
  </button>
209
183
  <div class="upstep-feedback-main">
210
- <p class="upstep-feedback-content">${v(t.content)}</p>
184
+ <p class="upstep-feedback-content">${b(t.content)}</p>
211
185
  <div class="upstep-feedback-meta">
212
186
  <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>
187
+ <span class="upstep-badge upstep-badge-general">${b(((e = t.boardStatus) == null ? void 0 : e.name) ?? t.status.replace("_", " "))}</span>
214
188
  <span class="upstep-feedback-date">${new Date(t.createdAt).toLocaleDateString()}</span>
215
189
  </div>
216
190
  </div>
@@ -226,18 +200,25 @@ class F {
226
200
  var t;
227
201
  document.querySelectorAll(".upstep-type-btn").forEach((e) => {
228
202
  e.addEventListener("click", () => {
229
- this.selectedType = e.dataset.type, document.querySelectorAll(".upstep-type-btn").forEach((a) => a.classList.remove("selected")), e.classList.add("selected");
203
+ this.selectedType = e.dataset.type, document.querySelectorAll(".upstep-type-btn").forEach((i) => i.classList.remove("selected")), e.classList.add("selected");
230
204
  });
231
205
  }), (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");
206
+ const e = document.getElementById(
207
+ "upstep-textarea"
208
+ ), i = document.getElementById("upstep-form-msg"), s = document.getElementById(
209
+ "upstep-submit-btn"
210
+ );
233
211
  if (!e || this.loading) return;
234
212
  const n = e.value.trim();
235
213
  if (n) {
236
214
  this.loading = !0, s && (s.disabled = !0, s.textContent = "Sending…");
237
215
  try {
238
- await this.client.submitFeedback({ content: n, type: this.selectedType }), e.value = "", a && (a.textContent = "Feedback received. Thank you."), await this.fetchFeed();
216
+ await this.client.submitFeedback({
217
+ content: n,
218
+ type: this.selectedType
219
+ }), e.value = "", i && (i.textContent = "Feedback received. Thank you."), await this.fetchFeed();
239
220
  } catch {
240
- a && (a.textContent = "Something went wrong. Please try again.");
221
+ i && (i.textContent = "Something went wrong. Please try again.");
241
222
  } finally {
242
223
  this.loading = !1, s && (s.disabled = !1, s.textContent = "Send feedback");
243
224
  }
@@ -256,54 +237,54 @@ class F {
256
237
  });
257
238
  }
258
239
  }
259
- function v(o) {
240
+ function b(o) {
260
241
  return o.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
261
242
  }
262
- let p = null, c = null;
263
- const C = {
243
+ let a = null, r = null;
244
+ const y = {
264
245
  init(o) {
265
- if (p = new M(o), typeof window < "u") {
246
+ if (a = new h(o), typeof window < "u") {
266
247
  const t = {};
267
248
  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
249
  const e = () => {
269
- c = new F(p, t), c.mount();
250
+ r = new g(a, t), r.mount();
270
251
  };
271
252
  document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", e) : e();
272
253
  }
273
- return p;
254
+ return a;
274
255
  },
275
256
  /** Open the feedback widget — use this to trigger it from your own UI. */
276
257
  open() {
277
- c == null || c.openWidget();
258
+ r == null || r.openWidget();
278
259
  },
279
260
  /** Close the feedback widget. */
280
261
  close() {
281
- c == null || c.closeWidget();
262
+ r == null || r.closeWidget();
282
263
  },
283
264
  /** Set / update the end-user id at runtime (e.g. after the user logs in). */
284
265
  identify(o) {
285
- p == null || p.setUserId(o);
266
+ a == null || a.setUserId(o);
286
267
  },
287
268
  /** Change or clear verified support identity after login/logout. */
288
269
  identifySupport(o) {
289
270
  var e;
290
- p && (p.supportIdentityToken = o);
271
+ a && (a.supportIdentityToken = o);
291
272
  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));
273
+ t && a && ((e = t.contentWindow) == null || e.postMessage({ type: "upstep:support:identity", token: o }, new URL(a.baseUrl).origin));
293
274
  },
294
275
  get client() {
295
- if (!p) throw new Error("Upstep.init() must be called first");
296
- return p;
276
+ if (!a) throw new Error("Upstep.init() must be called first");
277
+ return a;
297
278
  }
298
279
  };
299
280
  if (typeof document < "u") {
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;
281
+ 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;
301
282
  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);
283
+ const p = { apiKey: t };
284
+ 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), y.init(p);
304
285
  }
305
286
  }
306
287
  export {
307
- M as UpstepApiClient,
308
- C as default
288
+ h as UpstepApiClient,
289
+ y as default
309
290
  };