@upstep/js 0.8.0 → 0.9.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 +20 -2
- package/dist/{api-ZTIiZxlg.mjs → api-CROQwfAo.mjs} +23 -9
- package/dist/api-j3GMTEE7.js +1 -0
- package/dist/api.d.ts +11 -2
- package/dist/api.d.ts.map +1 -1
- package/dist/index.cjs +51 -50
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +163 -135
- package/dist/react.cjs +1 -1
- package/dist/react.d.ts +14 -2
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +439 -423
- package/dist/theme.cjs +1 -0
- package/dist/theme.d.ts +76 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +177 -0
- package/dist/upstep.global.js +51 -50
- package/dist/widget.d.ts +11 -1
- package/dist/widget.d.ts.map +1 -1
- package/package.json +14 -9
- package/dist/api-BdOCiCLM.js +0 -1
package/dist/theme.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g="#C9481F",F="#FF7A50",L=g;function R(t){return t==="dark"?F:g}const A=12,$=32,U=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,d="(\\d{1,3}(?:\\.\\d+)?)",M="(\\d*\\.?\\d+%?)",H=new RegExp(`^rgba?\\(\\s*${d}\\s*(?:,\\s*${d}\\s*,\\s*${d}\\s*(?:,\\s*${M}\\s*)?|\\s+${d}\\s+${d}\\s*(?:\\/\\s*${M}\\s*)?)\\)$`,"i");function i(t){if(typeof t!="string"||t.length>64)return null;const r=t.trim();if(U.test(r)){let u=r.slice(1);u.length<=4&&(u=u.split("").map(f=>f+f).join(""));const b=f=>parseInt(u.slice(f,f+2),16);return[b(0),b(2),b(4),u.length===8?Math.round(b(6)/255*1e3)/1e3:1]}const e=H.exec(r);if(!e)return null;const[n,o,c,a]=[e[1],e[2]??e[5],e[3]??e[6],e[4]??e[7]],s=[n,o,c].map(Number);if(s.some(u=>!(u>=0&&u<=255)))return null;let l=1;return a!==void 0&&(l=a.endsWith("%")?Number(a.slice(0,-1))/100:Number(a),!(l>=0&&l<=1))?null:[s[0],s[1],s[2],l]}function D(t){return i(t)!==null}function T([t,r,e,n]){const o=c=>Math.round(Math.min(255,Math.max(0,c))).toString(16).padStart(2,"0");return`#${o(t)}${o(r)}${o(e)}${n<1?o(n*255):""}`}function N(t,r,e){const n=i(t),o=i(r);if(!n||!o)return null;const c=Math.min(1,Math.max(0,e));return T([n[0]+(o[0]-n[0])*c,n[1]+(o[1]-n[1])*c,n[2]+(o[2]-n[2])*c,n[3]+(o[3]-n[3])*c])}function p(t,r){const e=i(t);return e?T([e[0],e[1],e[2],e[3]*r]):null}function S([t,r,e]){const n=o=>{const c=o/255;return c<=.03928?c/12.92:((c+.055)/1.055)**2.4};return .2126*n(t)+.7152*n(r)+.0722*n(e)}function x(t,r){const e=i(t),n=i(r);if(!e||!n)return null;const[o,c]=[S(e),S(n)].sort((a,s)=>s-a);return(o+.05)/(c+.05)}const m="#ffffff",E="#1a1915";function v(t){const r=x(t,m);return r===null||r>=3?m:(x(t,E)??0)>r?E:m}function h(t){const r=typeof t=="number"?t:Number(t);return t==null||t===""||!Number.isFinite(r)?A:Math.round(Math.min($,Math.max(0,r)))}function k(t,r){return Math.round(t*r/A)}const y=["background","surface","border","text","textMuted","accentText"];function C(t,r){const e={};if(!t)return e;for(const n of[t,t[r]])if(n)for(const o of y){const c=n[o];typeof c=="string"&&c.trim()&&(e[o]=c.trim())}return e}const I={bg:"#ffffff",bgSoft:"#f5f5f5",bgHover:"#ededed",text:"#1a1915",textSoft:"#56544d",textFaint:"#9b9890",border:"#e8e6df",overlay:"rgba(26,25,21,.45)"},O={bg:"#000000",bgSoft:"#171717",bgHover:"#262626",text:"#f5f4f0",textSoft:"#b4b1a8",textFaint:"#7d7a72",border:"#33312c",overlay:"rgba(0,0,0,.6)"};function _(t,r,e){return N(t,r,e)??`color-mix(in srgb, ${t} ${Math.round((1-e)*100)}%, ${r})`}function P(t){var s;const r=t.mode==="dark"?O:I,e=C(t.colors,t.mode),n=((s=t.accentColor)==null?void 0:s.trim())||R(t.mode),o=e.background??r.bg,c=e.text??r.text,a=e.surface??r.bgSoft;return{dark:t.mode==="dark",bg:o,bgSoft:a,bgHover:e.surface||e.text?_(a,c,.06):r.bgHover,text:c,textSoft:e.textMuted??r.textSoft,textFaint:e.textMuted||e.background?_(e.textMuted??r.textSoft,o,.4):r.textFaint,border:e.border??r.border,overlay:r.overlay,accent:n,accentText:e.accentText??v(n),accentTint:p(n,.1)??`color-mix(in srgb, ${n} 10%, transparent)`,radius:h(t.radius)}}function G(t){var o;const r=C(t.colors,t.mode),e={},n={background:"bg",surface:"surface",border:"border",text:"text",textMuted:"muted",accentText:"accentText"};for(const c of y){const a=r[c];D(a)&&(e[n[c]]=a)}return t.radius!==void 0&&(e.radius=String(h(t.radius))),(o=t.fontFamily)!=null&&o.trim()&&(e.font=t.fontFamily.trim()),e}exports.DEFAULT_ACCENT=L;exports.DEFAULT_ACCENT_DARK=F;exports.DEFAULT_ACCENT_LIGHT=g;exports.DEFAULT_RADIUS=A;exports.MAX_RADIUS=$;exports.buildWidgetPalette=P;exports.clampRadius=h;exports.contrastRatio=x;exports.defaultAccent=R;exports.formatHex=T;exports.isSupportedColor=D;exports.mixColors=N;exports.parseColor=i;exports.readableTextOn=v;exports.resolveColorOverrides=C;exports.scaleRadius=k;exports.supportThemeParams=G;exports.withAlpha=p;
|
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { UpstepColorOverrides, UpstepThemeColors } from '@upstep/types';
|
|
2
|
+
/** Brand orange for light panels; white text reads on it. */
|
|
3
|
+
export declare const DEFAULT_ACCENT_LIGHT = "#C9481F";
|
|
4
|
+
/** Brighter brand orange for dark panels; dark text reads on it. */
|
|
5
|
+
export declare const DEFAULT_ACCENT_DARK = "#FF7A50";
|
|
6
|
+
/** The light-mode default, kept for callers that need a single color. */
|
|
7
|
+
export declare const DEFAULT_ACCENT = "#C9481F";
|
|
8
|
+
/** The accent to use: the host's own, or the brand default for the mode. */
|
|
9
|
+
export declare function defaultAccent(mode: "light" | "dark"): string;
|
|
10
|
+
/** Base corner radius in px. Every other corner in the widgets scales from it. */
|
|
11
|
+
export declare const DEFAULT_RADIUS = 12;
|
|
12
|
+
export declare const MAX_RADIUS = 32;
|
|
13
|
+
/** Red, green, blue in 0–255 and alpha in 0–1. */
|
|
14
|
+
export type Rgba = [number, number, number, number];
|
|
15
|
+
/** Parses hex (#rgb, #rgba, #rrggbb, #rrggbbaa) and rgb()/rgba() colors. Anything else is null. */
|
|
16
|
+
export declare function parseColor(input: unknown): Rgba | null;
|
|
17
|
+
/** Whether a value is a hex or rgb color, the only formats every SDK and the support chat accept. */
|
|
18
|
+
export declare function isSupportedColor(input: unknown): input is string;
|
|
19
|
+
export declare function formatHex([r, g, b, a]: Rgba): string;
|
|
20
|
+
/** Blends `amount` (0–1) of `toward` into `color`. Null if either color can't be parsed. */
|
|
21
|
+
export declare function mixColors(color: string, toward: string, amount: number): string | null;
|
|
22
|
+
/** The color at the given opacity. Null if it can't be parsed. */
|
|
23
|
+
export declare function withAlpha(color: string, alpha: number): string | null;
|
|
24
|
+
/** WCAG contrast ratio between two opaque colors (1–21). Null if either can't be parsed. */
|
|
25
|
+
export declare function contrastRatio(a: string, b: string): number | null;
|
|
26
|
+
/**
|
|
27
|
+
* Text color for a filled accent surface. White while it keeps at least 3:1
|
|
28
|
+
* contrast (WCAG's bar for bold UI text), otherwise whichever of white or
|
|
29
|
+
* near-black reads better. Unparseable accents get white, as before.
|
|
30
|
+
*/
|
|
31
|
+
export declare function readableTextOn(background: string): string;
|
|
32
|
+
/** Clamps a radius to 0–32 px. Missing or invalid values give the default. */
|
|
33
|
+
export declare function clampRadius(value: unknown): number;
|
|
34
|
+
/** Scales one of the widget's built-in radii (designed for the 12 px default) to the chosen radius. */
|
|
35
|
+
export declare function scaleRadius(designed: number, radius: number): number;
|
|
36
|
+
/**
|
|
37
|
+
* Flattens `colors` for one mode: top-level keys, then that mode's keys on top.
|
|
38
|
+
* Empty or non-string values are dropped so they fall back to the defaults.
|
|
39
|
+
*/
|
|
40
|
+
export declare function resolveColorOverrides(colors: UpstepColorOverrides | undefined, mode: "light" | "dark"): Partial<UpstepThemeColors>;
|
|
41
|
+
/** The web widget's palette. */
|
|
42
|
+
export interface WidgetPalette {
|
|
43
|
+
dark: boolean;
|
|
44
|
+
bg: string;
|
|
45
|
+
bgSoft: string;
|
|
46
|
+
bgHover: string;
|
|
47
|
+
text: string;
|
|
48
|
+
textSoft: string;
|
|
49
|
+
textFaint: string;
|
|
50
|
+
border: string;
|
|
51
|
+
overlay: string;
|
|
52
|
+
accent: string;
|
|
53
|
+
accentText: string;
|
|
54
|
+
/** Accent at low opacity, for selected/voted fills. */
|
|
55
|
+
accentTint: string;
|
|
56
|
+
radius: number;
|
|
57
|
+
}
|
|
58
|
+
/** Builds the web widget palette: defaults for the mode, then any overrides. */
|
|
59
|
+
export declare function buildWidgetPalette(options: {
|
|
60
|
+
mode: "light" | "dark";
|
|
61
|
+
accentColor?: string | undefined;
|
|
62
|
+
colors?: UpstepColorOverrides | undefined;
|
|
63
|
+
radius?: number | undefined;
|
|
64
|
+
}): WidgetPalette;
|
|
65
|
+
/**
|
|
66
|
+
* Query parameters for the hosted support chat. Only hex/rgb colors are
|
|
67
|
+
* sent, and only the keys that were overridden, so the chat keeps its own
|
|
68
|
+
* defaults for the rest.
|
|
69
|
+
*/
|
|
70
|
+
export declare function supportThemeParams(options: {
|
|
71
|
+
mode: "light" | "dark";
|
|
72
|
+
colors?: UpstepColorOverrides | undefined;
|
|
73
|
+
radius?: number | undefined;
|
|
74
|
+
fontFamily?: string | undefined;
|
|
75
|
+
}): Record<string, string>;
|
|
76
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"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"}
|
package/dist/theme.js
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
const M = "#C9481F", N = "#FF7A50", I = M;
|
|
2
|
+
function y(t) {
|
|
3
|
+
return t === "dark" ? N : M;
|
|
4
|
+
}
|
|
5
|
+
const C = 12, R = 32, _ = /^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i, d = "(\\d{1,3}(?:\\.\\d+)?)", m = "(\\d*\\.?\\d+%?)", k = new RegExp(
|
|
6
|
+
`^rgba?\\(\\s*${d}\\s*(?:,\\s*${d}\\s*,\\s*${d}\\s*(?:,\\s*${m}\\s*)?|\\s+${d}\\s+${d}\\s*(?:\\/\\s*${m}\\s*)?)\\)$`,
|
|
7
|
+
"i"
|
|
8
|
+
);
|
|
9
|
+
function f(t) {
|
|
10
|
+
if (typeof t != "string" || t.length > 64) return null;
|
|
11
|
+
const n = t.trim();
|
|
12
|
+
if (_.test(n)) {
|
|
13
|
+
let u = n.slice(1);
|
|
14
|
+
u.length <= 4 && (u = u.split("").map((i) => i + i).join(""));
|
|
15
|
+
const b = (i) => parseInt(u.slice(i, i + 2), 16);
|
|
16
|
+
return [
|
|
17
|
+
b(0),
|
|
18
|
+
b(2),
|
|
19
|
+
b(4),
|
|
20
|
+
u.length === 8 ? Math.round(b(6) / 255 * 1e3) / 1e3 : 1
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
const e = k.exec(n);
|
|
24
|
+
if (!e) return null;
|
|
25
|
+
const [r, o, c, s] = [
|
|
26
|
+
e[1],
|
|
27
|
+
e[2] ?? e[5],
|
|
28
|
+
e[3] ?? e[6],
|
|
29
|
+
e[4] ?? e[7]
|
|
30
|
+
], a = [r, o, c].map(Number);
|
|
31
|
+
if (a.some((u) => !(u >= 0 && u <= 255))) return null;
|
|
32
|
+
let l = 1;
|
|
33
|
+
return s !== void 0 && (l = s.endsWith("%") ? Number(s.slice(0, -1)) / 100 : Number(s), !(l >= 0 && l <= 1)) ? null : [a[0], a[1], a[2], l];
|
|
34
|
+
}
|
|
35
|
+
function v(t) {
|
|
36
|
+
return f(t) !== null;
|
|
37
|
+
}
|
|
38
|
+
function $([t, n, e, r]) {
|
|
39
|
+
const o = (c) => Math.round(Math.min(255, Math.max(0, c))).toString(16).padStart(2, "0");
|
|
40
|
+
return `#${o(t)}${o(n)}${o(e)}${r < 1 ? o(r * 255) : ""}`;
|
|
41
|
+
}
|
|
42
|
+
function H(t, n, e) {
|
|
43
|
+
const r = f(t), o = f(n);
|
|
44
|
+
if (!r || !o) return null;
|
|
45
|
+
const c = Math.min(1, Math.max(0, e));
|
|
46
|
+
return $([
|
|
47
|
+
r[0] + (o[0] - r[0]) * c,
|
|
48
|
+
r[1] + (o[1] - r[1]) * c,
|
|
49
|
+
r[2] + (o[2] - r[2]) * c,
|
|
50
|
+
r[3] + (o[3] - r[3]) * c
|
|
51
|
+
]);
|
|
52
|
+
}
|
|
53
|
+
function D(t, n) {
|
|
54
|
+
const e = f(t);
|
|
55
|
+
return e ? $([e[0], e[1], e[2], e[3] * n]) : null;
|
|
56
|
+
}
|
|
57
|
+
function g([t, n, e]) {
|
|
58
|
+
const r = (o) => {
|
|
59
|
+
const c = o / 255;
|
|
60
|
+
return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
61
|
+
};
|
|
62
|
+
return 0.2126 * r(t) + 0.7152 * r(n) + 0.0722 * r(e);
|
|
63
|
+
}
|
|
64
|
+
function h(t, n) {
|
|
65
|
+
const e = f(t), r = f(n);
|
|
66
|
+
if (!e || !r) return null;
|
|
67
|
+
const [o, c] = [g(e), g(r)].sort((s, a) => a - s);
|
|
68
|
+
return (o + 0.05) / (c + 0.05);
|
|
69
|
+
}
|
|
70
|
+
const x = "#ffffff", A = "#1a1915";
|
|
71
|
+
function L(t) {
|
|
72
|
+
const n = h(t, x);
|
|
73
|
+
return n === null || n >= 3 ? x : (h(t, A) ?? 0) > n ? A : x;
|
|
74
|
+
}
|
|
75
|
+
function S(t) {
|
|
76
|
+
const n = typeof t == "number" ? t : Number(t);
|
|
77
|
+
return t == null || t === "" || !Number.isFinite(n) ? C : Math.round(Math.min(R, Math.max(0, n)));
|
|
78
|
+
}
|
|
79
|
+
function O(t, n) {
|
|
80
|
+
return Math.round(t * n / C);
|
|
81
|
+
}
|
|
82
|
+
const F = [
|
|
83
|
+
"background",
|
|
84
|
+
"surface",
|
|
85
|
+
"border",
|
|
86
|
+
"text",
|
|
87
|
+
"textMuted",
|
|
88
|
+
"accentText"
|
|
89
|
+
];
|
|
90
|
+
function E(t, n) {
|
|
91
|
+
const e = {};
|
|
92
|
+
if (!t) return e;
|
|
93
|
+
for (const r of [t, t[n]])
|
|
94
|
+
if (r)
|
|
95
|
+
for (const o of F) {
|
|
96
|
+
const c = r[o];
|
|
97
|
+
typeof c == "string" && c.trim() && (e[o] = c.trim());
|
|
98
|
+
}
|
|
99
|
+
return e;
|
|
100
|
+
}
|
|
101
|
+
const p = {
|
|
102
|
+
bg: "#ffffff",
|
|
103
|
+
bgSoft: "#f5f5f5",
|
|
104
|
+
bgHover: "#ededed",
|
|
105
|
+
text: "#1a1915",
|
|
106
|
+
textSoft: "#56544d",
|
|
107
|
+
textFaint: "#9b9890",
|
|
108
|
+
border: "#e8e6df",
|
|
109
|
+
overlay: "rgba(26,25,21,.45)"
|
|
110
|
+
}, U = {
|
|
111
|
+
bg: "#000000",
|
|
112
|
+
bgSoft: "#171717",
|
|
113
|
+
bgHover: "#262626",
|
|
114
|
+
text: "#f5f4f0",
|
|
115
|
+
textSoft: "#b4b1a8",
|
|
116
|
+
textFaint: "#7d7a72",
|
|
117
|
+
border: "#33312c",
|
|
118
|
+
overlay: "rgba(0,0,0,.6)"
|
|
119
|
+
};
|
|
120
|
+
function T(t, n, e) {
|
|
121
|
+
return H(t, n, e) ?? `color-mix(in srgb, ${t} ${Math.round((1 - e) * 100)}%, ${n})`;
|
|
122
|
+
}
|
|
123
|
+
function G(t) {
|
|
124
|
+
var a;
|
|
125
|
+
const n = t.mode === "dark" ? U : p, e = E(t.colors, t.mode), r = ((a = t.accentColor) == null ? void 0 : a.trim()) || y(t.mode), o = e.background ?? n.bg, c = e.text ?? n.text, s = e.surface ?? n.bgSoft;
|
|
126
|
+
return {
|
|
127
|
+
dark: t.mode === "dark",
|
|
128
|
+
bg: o,
|
|
129
|
+
bgSoft: s,
|
|
130
|
+
bgHover: e.surface || e.text ? T(s, c, 0.06) : n.bgHover,
|
|
131
|
+
text: c,
|
|
132
|
+
textSoft: e.textMuted ?? n.textSoft,
|
|
133
|
+
textFaint: e.textMuted || e.background ? T(e.textMuted ?? n.textSoft, o, 0.4) : n.textFaint,
|
|
134
|
+
border: e.border ?? n.border,
|
|
135
|
+
overlay: n.overlay,
|
|
136
|
+
accent: r,
|
|
137
|
+
accentText: e.accentText ?? L(r),
|
|
138
|
+
accentTint: D(r, 0.1) ?? `color-mix(in srgb, ${r} 10%, transparent)`,
|
|
139
|
+
radius: S(t.radius)
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function K(t) {
|
|
143
|
+
var o;
|
|
144
|
+
const n = E(t.colors, t.mode), e = {}, r = {
|
|
145
|
+
background: "bg",
|
|
146
|
+
surface: "surface",
|
|
147
|
+
border: "border",
|
|
148
|
+
text: "text",
|
|
149
|
+
textMuted: "muted",
|
|
150
|
+
accentText: "accentText"
|
|
151
|
+
};
|
|
152
|
+
for (const c of F) {
|
|
153
|
+
const s = n[c];
|
|
154
|
+
v(s) && (e[r[c]] = s);
|
|
155
|
+
}
|
|
156
|
+
return t.radius !== void 0 && (e.radius = String(S(t.radius))), (o = t.fontFamily) != null && o.trim() && (e.font = t.fontFamily.trim()), e;
|
|
157
|
+
}
|
|
158
|
+
export {
|
|
159
|
+
I as DEFAULT_ACCENT,
|
|
160
|
+
N as DEFAULT_ACCENT_DARK,
|
|
161
|
+
M as DEFAULT_ACCENT_LIGHT,
|
|
162
|
+
C as DEFAULT_RADIUS,
|
|
163
|
+
R as MAX_RADIUS,
|
|
164
|
+
G as buildWidgetPalette,
|
|
165
|
+
S as clampRadius,
|
|
166
|
+
h as contrastRatio,
|
|
167
|
+
y as defaultAccent,
|
|
168
|
+
$ as formatHex,
|
|
169
|
+
v as isSupportedColor,
|
|
170
|
+
H as mixColors,
|
|
171
|
+
f as parseColor,
|
|
172
|
+
L as readableTextOn,
|
|
173
|
+
E as resolveColorOverrides,
|
|
174
|
+
O as scaleRadius,
|
|
175
|
+
K as supportThemeParams,
|
|
176
|
+
D as withAlpha
|
|
177
|
+
};
|
package/dist/upstep.global.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
(function(){"use strict";const u="upstep-anonymous-id";function
|
|
2
|
-
#upstep-root *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif}
|
|
3
|
-
#upstep-btn
|
|
1
|
+
(function(){"use strict";const L="#C9481F",A="#FF7A50";function g(e){return e==="dark"?A:L}const y=12,O=32,N=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,f="(\\d{1,3}(?:\\.\\d+)?)",k="(\\d*\\.?\\d+%?)",z=new RegExp(`^rgba?\\(\\s*${f}\\s*(?:,\\s*${f}\\s*,\\s*${f}\\s*(?:,\\s*${k}\\s*)?|\\s+${f}\\s+${f}\\s*(?:\\/\\s*${k}\\s*)?)\\)$`,"i");function b(e){if(typeof e!="string"||e.length>64)return null;const t=e.trim();if(N.test(t)){let u=t.slice(1);u.length<=4&&(u=u.split("").map(l=>l+l).join(""));const h=l=>parseInt(u.slice(l,l+2),16);return[h(0),h(2),h(4),u.length===8?Math.round(h(6)/255*1e3)/1e3:1]}const s=z.exec(t);if(!s)return null;const[o,i,n,a]=[s[1],s[2]??s[5],s[3]??s[6],s[4]??s[7]],r=[o,i,n].map(Number);if(r.some(u=>!(u>=0&&u<=255)))return null;let c=1;return a!==void 0&&(c=a.endsWith("%")?Number(a.slice(0,-1))/100:Number(a),!(c>=0&&c<=1))?null:[r[0],r[1],r[2],c]}function B(e){return b(e)!==null}function v([e,t,s,o]){const i=n=>Math.round(Math.min(255,Math.max(0,n))).toString(16).padStart(2,"0");return`#${i(e)}${i(t)}${i(s)}${o<1?i(o*255):""}`}function R(e,t,s){const o=b(e),i=b(t);if(!o||!i)return null;const n=Math.min(1,Math.max(0,s));return v([o[0]+(i[0]-o[0])*n,o[1]+(i[1]-o[1])*n,o[2]+(i[2]-o[2])*n,o[3]+(i[3]-o[3])*n])}function j(e,t){const s=b(e);return s?v([s[0],s[1],s[2],s[3]*t]):null}function $([e,t,s]){const o=i=>{const n=i/255;return n<=.03928?n/12.92:((n+.055)/1.055)**2.4};return .2126*o(e)+.7152*o(t)+.0722*o(s)}function w(e,t){const s=b(e),o=b(t);if(!s||!o)return null;const[i,n]=[$(s),$(o)].sort((a,r)=>r-a);return(i+.05)/(n+.05)}const m="#ffffff",S="#1a1915";function H(e){const t=w(e,m);return t===null||t>=3?m:(w(e,S)??0)>t?S:m}function I(e){const t=typeof e=="number"?e:Number(e);return e==null||e===""||!Number.isFinite(t)?y:Math.round(Math.min(O,Math.max(0,t)))}function V(e,t){return Math.round(e*t/y)}const U=["background","surface","border","text","textMuted","accentText"];function E(e,t){const s={};if(!e)return s;for(const o of[e,e[t]])if(o)for(const i of U){const n=o[i];typeof n=="string"&&n.trim()&&(s[i]=n.trim())}return s}const q={bg:"#ffffff",bgSoft:"#f5f5f5",bgHover:"#ededed",text:"#1a1915",textSoft:"#56544d",textFaint:"#9b9890",border:"#e8e6df",overlay:"rgba(26,25,21,.45)"},D={bg:"#000000",bgSoft:"#171717",bgHover:"#262626",text:"#f5f4f0",textSoft:"#b4b1a8",textFaint:"#7d7a72",border:"#33312c",overlay:"rgba(0,0,0,.6)"};function F(e,t,s){return R(e,t,s)??`color-mix(in srgb, ${e} ${Math.round((1-s)*100)}%, ${t})`}function P(e){var r;const t=e.mode==="dark"?D:q,s=E(e.colors,e.mode),o=((r=e.accentColor)==null?void 0:r.trim())||g(e.mode),i=s.background??t.bg,n=s.text??t.text,a=s.surface??t.bgSoft;return{dark:e.mode==="dark",bg:i,bgSoft:a,bgHover:s.surface||s.text?F(a,n,.06):t.bgHover,text:n,textSoft:s.textMuted??t.textSoft,textFaint:s.textMuted||s.background?F(s.textMuted??t.textSoft,i,.4):t.textFaint,border:s.border??t.border,overlay:t.overlay,accent:o,accentText:s.accentText??H(o),accentTint:j(o,.1)??`color-mix(in srgb, ${o} 10%, transparent)`,radius:I(e.radius)}}function G(e){var i;const t=E(e.colors,e.mode),s={},o={background:"bg",surface:"surface",border:"border",text:"text",textMuted:"muted",accentText:"accentText"};for(const n of U){const a=t[n];B(a)&&(s[o[n]]=a)}return e.radius!==void 0&&(s.radius=String(I(e.radius))),(i=e.fontFamily)!=null&&i.trim()&&(s.font=e.fontFamily.trim()),s}const M="upstep-anonymous-id";function K(){const e=typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;if(typeof window>"u")return e;try{const t=window.localStorage.getItem(M);return t||(window.localStorage.setItem(M,e),e)}catch{return e}}class W{constructor(t){this.baseUrl=(t.baseUrl??"https://upstep.dev").replace(/\/$/,""),this.apiKey=t.apiKey,this.supportIdentityToken=t.supportIdentityToken,this.chat=t.chat!==!1,t.userId!==void 0&&(this.userId=t.userId),this.anonymousId=K()}setUserId(t){this.userId=t}headers(){return{"Content-Type":"application/json","x-api-key":this.apiKey}}async supportEnabled(){if(!this.chat)return!1;try{const t=await fetch(`${this.baseUrl}/api/sdk/support`,{headers:this.headers()});return t.ok&&(await t.json()).enabled===!0}catch{return!1}}supportFrameUrl(t,s,o={}){const i=new URLSearchParams({theme:t,accent:s||g(t==="dark"?"dark":"light")}),n=G({mode:t==="dark"?"dark":"light",...o});for(const[a,r]of Object.entries(n))i.set(a,r);return`${this.baseUrl}/support/${encodeURIComponent(this.apiKey)}?${i}`}connectSupportFrame(t,s={}){const o=new URL(this.baseUrl).origin,i=()=>{var a;return(a=t.contentWindow)==null?void 0:a.postMessage({type:"upstep:support:identity",token:this.supportIdentityToken,accentColor:getComputedStyle(t).color,...s.isVisible?{visible:s.isVisible()}:{}},o)},n=a=>{if(a.origin!==o||a.source!==t.contentWindow)return;const r=a.data;if((r==null?void 0:r.type)==="upstep:support:ready")i();else if((r==null?void 0:r.type)==="upstep:support:unread"&&s.onUnread){const c=Number(r.count);s.onUnread({count:Number.isFinite(c)?Math.max(0,Math.floor(c)):0,newMessage:r.newMessage===!0,author:String(r.author??"").slice(0,80),preview:String(r.preview??"").slice(0,200),sound:r.sound!==!1})}};return t.addEventListener("load",i),window.addEventListener("message",n),()=>{t.removeEventListener("load",i),window.removeEventListener("message",n)}}notifySupportVisibility(t,s){var o;(o=t.contentWindow)==null||o.postMessage({type:"upstep:support:visible",visible:s},new URL(this.baseUrl).origin)}async listFeedback(t){const s=new URLSearchParams;t!=null&&t.cursor&&s.set("cursor",t.cursor),t!=null&&t.limit&&s.set("limit",String(t.limit)),t!=null&&t.type&&s.set("type",t.type),t!=null&&t.status&&s.set("status",t.status),t!=null&&t.sort&&s.set("sort",t.sort),this.userId&&s.set("endUserId",this.userId),this.anonymousId&&s.set("anonymousId",this.anonymousId);const o=await fetch(`${this.baseUrl}/api/sdk/feedback?${s}`,{headers:this.headers()});if(!o.ok)throw new Error(`Upstep: ${o.status}`);return o.json()}async submitFeedback(t){const s=await fetch(`${this.baseUrl}/api/sdk/feedback`,{method:"POST",headers:this.headers(),body:JSON.stringify({...t,endUserId:t.endUserId??this.userId,anonymousId:t.anonymousId??this.anonymousId})});if(!s.ok)throw new Error(`Upstep: ${s.status}`);return s.json()}async vote(t,s){const o=await fetch(`${this.baseUrl}/api/sdk/feedback/${t}/vote`,{method:"POST",headers:this.headers(),body:JSON.stringify({value:s,endUserId:this.userId,anonymousId:this.anonymousId})});if(!o.ok)throw new Error(`Upstep: ${o.status}`)}async getItem(t){const s=new URLSearchParams;this.userId&&s.set("endUserId",this.userId),this.anonymousId&&s.set("anonymousId",this.anonymousId);const o=await fetch(`${this.baseUrl}/api/sdk/feedback/${t}?${s}`,{headers:this.headers()});if(!o.ok)throw new Error(`Upstep: ${o.status}`);return o.json()}async removeVote(t){if(!this.userId&&!this.anonymousId)return;const s=new URLSearchParams;this.userId&&s.set("endUserId",this.userId),this.anonymousId&&s.set("anonymousId",this.anonymousId);const o=await fetch(`${this.baseUrl}/api/sdk/feedback/${t}/vote?${s}`,{method:"DELETE",headers:this.headers()});if(!o.ok)throw new Error(`Upstep: ${o.status}`)}}function _(e){const t=e==null?void 0:e.trim();return t&&/^[\w\s,"'.-]{1,200}$/.test(t)?t:""}function T(e){if(e==="light"||e==="dark")return e;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 Y(e,t){const s="right:24px;left:auto",o=e.accent,i=e.accentText,n=a=>`${V(a,e.radius)}px`;return`
|
|
2
|
+
#upstep-root *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif}${t?`
|
|
3
|
+
#upstep-btn,#upstep-btn *,#upstep-backdrop,#upstep-backdrop *,#upstep-toast,#upstep-toast *{font-family:${t}}`:""}
|
|
4
|
+
#upstep-btn{position:fixed;bottom:24px;${s};z-index:9998;display:inline-flex;align-items:center;gap:7px;background:${o};color:${i};border:none;border-radius:${n(9999)};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
5
|
#upstep-btn svg{width:16px;height:16px;flex-shrink:0}
|
|
5
6
|
#upstep-btn:hover{transform:translateY(-1px);box-shadow:0 8px 26px rgba(26,25,21,.24)}
|
|
6
7
|
@media(max-width:639px){#upstep-btn{padding:12px}#upstep-btn span{display:none}}
|
|
@@ -8,82 +9,82 @@
|
|
|
8
9
|
#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
10
|
@keyframes upstep-fade{from{opacity:0}to{opacity:1}}
|
|
10
11
|
@keyframes upstep-rise{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:translateY(0)}}
|
|
11
|
-
#upstep-modal{background:${
|
|
12
|
+
#upstep-modal{background:${e.bg};border:1px solid ${e.border};border-radius:${n(20)};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
13
|
#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:${
|
|
14
|
-
#upstep-header p{margin:2px 0 0;font-size:14px;color:${
|
|
15
|
-
#upstep-close{background:${
|
|
16
|
-
#upstep-close:hover{background:${
|
|
17
|
-
#upstep-tabs{display:flex;gap:4px;margin:16px 20px 0;padding:4px;background:${
|
|
18
|
-
.upstep-tab{flex:1;padding:8px;background:none;border:none;border-radius
|
|
19
|
-
.upstep-mode .upstep-tab.active{background:${
|
|
20
|
-
.upstep-tab.active{background:${
|
|
14
|
+
#upstep-header h2{margin:0;font-size:16px;font-weight:700;color:${e.text};letter-spacing:-.01em}
|
|
15
|
+
#upstep-header p{margin:2px 0 0;font-size:14px;color:${e.textFaint}}
|
|
16
|
+
#upstep-close{background:${e.bgSoft};border:none;width:28px;height:28px;border-radius:${n(8)};font-size:14px;cursor:pointer;color:${e.textSoft};line-height:1;display:flex;align-items:center;justify-content:center;transition:background .15s}
|
|
17
|
+
#upstep-close:hover{background:${e.bgHover};color:${e.text}}
|
|
18
|
+
#upstep-tabs{display:flex;gap:4px;margin:16px 20px 0;padding:4px;background:${e.bgSoft};border-radius:${n(11)}}
|
|
19
|
+
.upstep-tab{flex:1;padding:8px;background:none;border:none;border-radius:${n(8)};font-size:14px;font-weight:600;color:${e.textSoft};cursor:pointer;transition:all .15s}
|
|
20
|
+
.upstep-mode .upstep-tab.active{background:${e.bgSoft};box-shadow:none}
|
|
21
|
+
.upstep-tab.active{background:${e.bg};color:${e.text};box-shadow:0 1px 3px rgba(0,0,0,.08)}
|
|
21
22
|
#upstep-body{flex:1;overflow-y:auto;padding:18px 20px 22px}
|
|
22
|
-
.upstep-form textarea{width:100%;min-height:104px;border:1px solid ${
|
|
23
|
-
.upstep-form textarea::placeholder{color:${
|
|
24
|
-
.upstep-form textarea:focus{border-color:${
|
|
23
|
+
.upstep-form textarea{width:100%;min-height:104px;border:1px solid ${e.border};border-radius:${n(12)};padding:12px;font-size:16px;line-height:1.6;resize:vertical;outline:none;background:${e.bgSoft};color:${e.text};transition:border-color .15s}
|
|
24
|
+
.upstep-form textarea::placeholder{color:${e.textFaint}}
|
|
25
|
+
.upstep-form textarea:focus{border-color:${o};background:${e.bg}}
|
|
25
26
|
.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
|
|
27
|
+
.upstep-type-btn{flex:1;display:flex;align-items:center;justify-content:center;gap:5px;padding:8px 10px;border-radius:${n(9)};border:1px solid ${e.border};background:${e.bg};color:${e.textSoft};font-size:14px;font-weight:600;cursor:pointer;transition:all .15s}
|
|
27
28
|
.upstep-type-btn svg{width:12px;height:12px;flex-shrink:0}
|
|
28
|
-
.upstep-type-btn:hover{border-color:${
|
|
29
|
-
.upstep-type-btn.selected{background:${
|
|
30
|
-
.upstep-submit{width:100%;padding:12px;background:${
|
|
29
|
+
.upstep-type-btn:hover{border-color:${e.textFaint}}
|
|
30
|
+
.upstep-type-btn.selected{background:${o};color:${i};border-color:${o}}
|
|
31
|
+
.upstep-submit{width:100%;padding:12px;background:${o};color:${i};border:none;border-radius:${n(11)};font-size:14px;font-weight:600;cursor:pointer;margin-top:14px;transition:filter .15s}
|
|
31
32
|
.upstep-submit:hover{filter:brightness(.94)}
|
|
32
33
|
.upstep-submit:disabled{opacity:.5;cursor:not-allowed}
|
|
33
|
-
#upstep-form-msg{font-size:14px;text-align:center;margin-top:12px;color:${
|
|
34
|
-
.upstep-feedback-item{display:flex;gap:12px;padding:14px;border:1px solid ${
|
|
35
|
-
.upstep-feedback-item:hover{border-color:${
|
|
36
|
-
.upstep-vote{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;min-width:46px;padding:7px 0;border-radius
|
|
37
|
-
.upstep-vote:hover{border-color:${
|
|
38
|
-
.upstep-vote.voted{border-color:${
|
|
39
|
-
.upstep-vote-arrow{font-size:11px;line-height:1;color:${
|
|
40
|
-
.upstep-vote-count{font-size:14px;font-weight:700;color:${
|
|
34
|
+
#upstep-form-msg{font-size:14px;text-align:center;margin-top:12px;color:${o};font-weight:500}
|
|
35
|
+
.upstep-feedback-item{display:flex;gap:12px;padding:14px;border:1px solid ${e.border};border-radius:${n(14)};margin-bottom:10px;background:${e.bg};transition:border-color .15s}
|
|
36
|
+
.upstep-feedback-item:hover{border-color:${e.textFaint}}
|
|
37
|
+
.upstep-vote{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;min-width:46px;padding:7px 0;border-radius:${n(11)};border:1px solid ${e.border};background:${e.bgSoft};cursor:pointer;transition:all .15s}
|
|
38
|
+
.upstep-vote:hover{border-color:${o}}
|
|
39
|
+
.upstep-vote.voted{border-color:${o};background:${e.accentTint}}
|
|
40
|
+
.upstep-vote-arrow{font-size:11px;line-height:1;color:${o}}
|
|
41
|
+
.upstep-vote-count{font-size:14px;font-weight:700;color:${e.text};line-height:1.1}
|
|
41
42
|
.upstep-feedback-main{flex:1;min-width:0}
|
|
42
|
-
.upstep-feedback-content{font-size:16px;line-height:1.5;color:${
|
|
43
|
+
.upstep-feedback-content{font-size:16px;line-height:1.5;color:${e.text};margin:0 0 8px;word-break:break-word}
|
|
43
44
|
.upstep-feedback-meta{display:flex;align-items:center;gap:7px}
|
|
44
|
-
.upstep-badge{display:inline-flex;align-items:center;padding:2px 8px;border-radius
|
|
45
|
+
.upstep-badge{display:inline-flex;align-items:center;padding:2px 8px;border-radius:${n(9999)};font-size:10.5px;font-weight:700;letter-spacing:.02em}
|
|
45
46
|
.upstep-badge-bug{background:#fdecec;color:#d6453d}
|
|
46
47
|
.upstep-badge-feature{background:#e9f0fd;color:#3b76d6}
|
|
47
|
-
.upstep-badge-general{background:${
|
|
48
|
-
.upstep-feedback-date{font-size:11px;color:${
|
|
48
|
+
.upstep-badge-general{background:${e.bgSoft};color:${e.textSoft}}
|
|
49
|
+
.upstep-feedback-date{font-size:11px;color:${e.textFaint}}
|
|
49
50
|
#upstep-btn{position:fixed}
|
|
50
|
-
.upstep-unread{position:absolute;top:-7px;right:-5px;min-width:22px;height:22px;padding:0 6px;border-radius:11px;background:${
|
|
51
|
+
.upstep-unread{position:absolute;top:-7px;right:-5px;min-width:22px;height:22px;padding:0 6px;border-radius:11px;background:${e.text};color:${e.bg};border:2px solid ${e.bg};font-size:12px;font-weight:700;line-height:18px;text-align:center;font-variant-numeric:tabular-nums;animation:upstep-pop .45s cubic-bezier(.3,1.6,.5,1)}
|
|
51
52
|
@keyframes upstep-pop{from{transform:scale(.4)}to{transform:scale(1)}}
|
|
52
|
-
#upstep-toast{position:fixed;bottom:84px;right:24px;z-index:9998;max-width:min(300px,calc(100vw - 48px));display:grid;gap:2px;text-align:left;background:${
|
|
53
|
+
#upstep-toast{position:fixed;bottom:84px;right:24px;z-index:9998;max-width:min(300px,calc(100vw - 48px));display:grid;gap:2px;text-align:left;background:${e.bg};color:${e.text};border:1px solid ${e.border};border-radius:${n(14)} ${n(14)} ${n(4)} ${n(14)};padding:10px 12px;box-shadow:0 10px 32px rgba(0,0,0,.2);cursor:pointer;animation:upstep-rise .26s cubic-bezier(.16,1,.3,1)}
|
|
53
54
|
#upstep-toast b{font-size:12px}
|
|
54
|
-
#upstep-toast span{font-size:14px;line-height:1.4;color:${
|
|
55
|
-
#upstep-toast em{font-style:normal;font-size:11px;font-weight:600;color:${
|
|
55
|
+
#upstep-toast span{font-size:14px;line-height:1.4;color:${e.textSoft};display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
|
|
56
|
+
#upstep-toast em{font-style:normal;font-size:11px;font-weight:600;color:${o}}
|
|
56
57
|
@media(prefers-reduced-motion:reduce){.upstep-unread,#upstep-toast{animation:none}}
|
|
57
|
-
.upstep-empty{text-align:center;color:${
|
|
58
|
-
.upstep-empty strong{display:block;color:${
|
|
59
|
-
`}const
|
|
58
|
+
.upstep-empty{text-align:center;color:${e.textFaint};font-size:14px;padding:40px 0}
|
|
59
|
+
.upstep-empty strong{display:block;color:${e.textSoft};font-size:15px;margin-bottom:4px}
|
|
60
|
+
`}const J='<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 X{constructor(t,s={}){this.isOpen=!1,this.tab="submit",this.feedItems=[],this.selectedType="GENERAL",this.loading=!1,this.hasSupport=!1,this.disconnectSupport=null,this.unread=0,this.audio=null,this.frameTheme=null,this.unreadListeners=new Set,this.client=t,this.options=s,this.position="right",this.showLauncher=s.launcher!==!1,this.themeMode=s.theme??"auto",this.palette=this.buildPalette(T(this.themeMode))}buildPalette(t){return P({mode:t,accentColor:this.options.accentColor,colors:this.options.colors,radius:this.options.radius})}get accent(){return this.palette.accent}supportFrameSrc(){return this.client.supportFrameUrl(this.palette.dark?"dark":"light",this.accent,{colors:this.options.colors,radius:this.options.radius,fontFamily:this.options.fontFamily})}mount(){this.injectStyles(),this.showLauncher&&this.renderButton(),this.client.supportEnabled().then(t=>{if(this.hasSupport=t,t){const s=document.querySelector("#upstep-btn span");s&&(s.textContent="Help & feedback"),this.isOpen?this.renderModal():this.hasOpenedSupport()&&this.preloadSupport()}})}openWidget(){this.openModal()}closeWidget(){this.closeModal()}isChatVisible(){return this.isOpen}onUnread(t){return this.unreadListeners.add(t),t(this.unread),()=>{this.unreadListeners.delete(t)}}injectStyles(){var s;(s=document.getElementById("upstep-styles"))==null||s.remove();const t=document.createElement("style");t.id="upstep-styles",t.textContent=Y(this.palette,_(this.options.fontFamily)),document.head.appendChild(t)}renderButton(){const t=document.createElement("button");t.id="upstep-btn",t.setAttribute("aria-label","Open help and feedback"),t.innerHTML=`${J}<span>Feedback</span>`,t.addEventListener("click",()=>{this.openModal()}),document.body.appendChild(t)}supportFrame(){return document.querySelector("#upstep-support-frame")}get usedKey(){return`upstep:support-opened:${this.client.baseUrl}`}hasOpenedSupport(){try{return localStorage.getItem(this.usedKey)==="1"}catch{return!1}}preloadSupport(){this.tab="support",this.renderModal(!0)}openModal(){if(this.unlockAudio(),!this.isOpen&&this.hasSupport){this.tab="support";try{localStorage.setItem(this.usedKey,"1")}catch{}}const t=T(this.themeMode),s=document.getElementById("upstep-backdrop"),o=this.supportFrame();if(!this.isOpen&&s&&o&&s.style.display==="none"&&this.frameTheme===t){this.isOpen=!0,s.style.display="",this.client.notifySupportVisibility(o,!0),this.setUnread(0),this.fetchFeed();return}this.isOpen=!0,this.palette=this.buildPalette(t),this.injectStyles(),this.fetchFeed(),this.renderModal(),this.setUnread(0)}closeModal(){var t,s;if(this.isOpen=!1,this.hasSupport){const o=this.supportFrame(),i=document.getElementById("upstep-backdrop");o&&i?(i.style.display="none",this.client.notifySupportVisibility(o,!1)):this.preloadSupport();return}(t=this.disconnectSupport)==null||t.call(this),this.disconnectSupport=null,(s=document.getElementById("upstep-backdrop"))==null||s.remove()}setUnread(t){this.unread=t;const s=document.getElementById("upstep-btn"),o=s==null?void 0:s.querySelector(".upstep-unread");if(s){if(t>0){const n=o??document.createElement("span");n.className="upstep-unread",n.textContent=t>9?"9+":String(t),o||s.appendChild(n)}else o==null||o.remove();s.setAttribute("aria-label",t>0?`Open help and feedback, ${t} unread ${t===1?"message":"messages"}`:"Open help and feedback")}const i=document.title.replace(/^\(\d+\)\s/,"");document.title=t>0?`(${t}) ${i}`:i,t===0&&this.hideToast(),this.unreadListeners.forEach(n=>n(t))}onSupportUnread(t){if(this.isOpen)return this.setUnread(0);this.setUnread(t.count),t.newMessage&&t.count>0&&(this.showToast(t),t.sound&&this.chime())}showToast(t){this.hideToast();const s=document.createElement("button");s.id="upstep-toast",s.type="button",s.setAttribute("role","status");const o=document.createElement("b");o.textContent=t.author||"New message";const i=document.createElement("span");i.textContent=t.preview;const n=document.createElement("em");n.textContent=t.count>1?`${t.count} new messages`:"Tap to reply",s.append(o,i,n),s.addEventListener("click",()=>this.openModal()),document.body.appendChild(s),this.toastTimer=setTimeout(()=>this.hideToast(),9e3)}hideToast(){var t;clearTimeout(this.toastTimer),(t=document.getElementById("upstep-toast"))==null||t.remove()}unlockAudio(){try{const t=window.AudioContext||window.webkitAudioContext;if(!t)return;this.audio=this.audio??new t,this.audio.state==="suspended"&&this.audio.resume()}catch{}}chime(){const t=this.audio;if(!t||t.state!=="running")return;const s=t.currentTime;for(const[o,i]of[[880,0],[1318,.12]]){const n=t.createOscillator(),a=t.createGain();n.type="sine",n.frequency.value=o,a.gain.setValueAtTime(1e-4,s+i),a.gain.exponentialRampToValueAtTime(.14,s+i+.02),a.gain.exponentialRampToValueAtTime(1e-4,s+i+.5),n.connect(a),a.connect(t.destination),n.start(s+i),n.stop(s+i+.55)}}async fetchFeed(){try{const t=await this.client.listFeedback({sort:"votes",limit:20});this.feedItems=t.items,this.renderFeedList()}catch{}}renderModal(t=!1){var i,n,a;(i=this.disconnectSupport)==null||i.call(this),this.disconnectSupport=null;const s=document.createElement("div");s.id="upstep-backdrop",s.addEventListener("click",r=>{r.target===s&&this.closeModal()}),s.innerHTML=`
|
|
60
61
|
<div id="upstep-modal" style="max-width:${this.hasSupport?"460px":"440px"}">
|
|
61
62
|
${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>`}
|
|
62
63
|
<div id="upstep-body" style="${this.tab==="support"?"padding:0;overflow:hidden":""}">
|
|
63
|
-
${this.tab==="support"?`<iframe id="upstep-support-frame" title="Customer support" src="${this.
|
|
64
|
+
${this.tab==="support"?`<iframe id="upstep-support-frame" title="Customer support" src="${x(this.supportFrameSrc())}" style="width:100%;height:min(560px,calc(100dvh - 168px));min-height:300px;border:0;display:block"></iframe>`:this.tab==="submit"?this.renderSubmitForm():this.renderFeed()}
|
|
64
65
|
</div>
|
|
65
66
|
</div>
|
|
66
|
-
`,(n=document.getElementById("upstep-backdrop"))==null||n.remove(),
|
|
67
|
+
`,(n=document.getElementById("upstep-backdrop"))==null||n.remove(),t&&(s.style.display="none"),document.body.appendChild(s),(a=s.querySelector("#upstep-close"))==null||a.addEventListener("click",()=>this.closeModal()),s.querySelectorAll(".upstep-tab").forEach(r=>{r.addEventListener("click",()=>{this.tab=r.dataset.tab,this.renderModal()})});const o=s.querySelector("#upstep-support-frame");o&&(o.style.color=this.accent,this.frameTheme=this.palette.dark?"dark":"light",this.disconnectSupport=this.client.connectSupportFrame(o,{isVisible:()=>this.isOpen,onUnread:r=>this.onSupportUnread(r)})),this.bindSubmitForm(),this.bindVoteButtons()}renderSubmitForm(){const t=["BUG","FEATURE","GENERAL"],s={BUG:"Bug",FEATURE:"Feature",GENERAL:"General"},o={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`
|
|
67
68
|
<div class="upstep-form">
|
|
68
69
|
<textarea id="upstep-textarea" placeholder="What's on your mind?" maxlength="2000"></textarea>
|
|
69
70
|
<div class="upstep-type-row">
|
|
70
|
-
${
|
|
71
|
+
${t.map(i=>`<button class="upstep-type-btn${this.selectedType===i?" selected":""}" data-type="${i}">${o[i]}${s[i]}</button>`).join("")}
|
|
71
72
|
</div>
|
|
72
73
|
<button class="upstep-submit" id="upstep-submit-btn">Send feedback</button>
|
|
73
74
|
<div id="upstep-form-msg"></div>
|
|
74
75
|
</div>
|
|
75
|
-
`}renderFeed(){return this.feedItems.length?this.feedItems.map(
|
|
76
|
-
<div class="upstep-feedback-item" data-id="${
|
|
77
|
-
<button class="upstep-vote${
|
|
76
|
+
`}renderFeed(){return this.feedItems.length?this.feedItems.map(t=>{var s;return`
|
|
77
|
+
<div class="upstep-feedback-item" data-id="${t.id}">
|
|
78
|
+
<button class="upstep-vote${t.userVote==="UP"?" voted":""}" data-vote="UP" data-feedback="${t.id}">
|
|
78
79
|
<span class="upstep-vote-arrow">▲</span>
|
|
79
|
-
<span class="upstep-vote-count">${
|
|
80
|
+
<span class="upstep-vote-count">${t.upvotes}</span>
|
|
80
81
|
</button>
|
|
81
82
|
<div class="upstep-feedback-main">
|
|
82
|
-
<p class="upstep-feedback-content">${
|
|
83
|
+
<p class="upstep-feedback-content">${x(t.content)}</p>
|
|
83
84
|
<div class="upstep-feedback-meta">
|
|
84
|
-
<span class="upstep-badge upstep-badge-${
|
|
85
|
-
<span class="upstep-badge upstep-badge-general">${
|
|
86
|
-
<span class="upstep-feedback-date">${new Date(
|
|
85
|
+
<span class="upstep-badge upstep-badge-${t.type.toLowerCase()}">${t.type}</span>
|
|
86
|
+
<span class="upstep-badge upstep-badge-general">${x(((s=t.boardStatus)==null?void 0:s.name)??t.status.replace("_"," "))}</span>
|
|
87
|
+
<span class="upstep-feedback-date">${new Date(t.createdAt).toLocaleDateString()}</span>
|
|
87
88
|
</div>
|
|
88
89
|
</div>
|
|
89
|
-
</div>`}).join(""):'<div class="upstep-empty"><strong>No ideas yet</strong>Be the first to share one.</div>'}renderFeedList(){const
|
|
90
|
+
</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(s=>{s.addEventListener("click",()=>{this.selectedType=s.dataset.type,document.querySelectorAll(".upstep-type-btn").forEach(o=>o.classList.remove("selected")),s.classList.add("selected")})}),(t=document.getElementById("upstep-submit-btn"))==null||t.addEventListener("click",async()=>{const s=document.getElementById("upstep-textarea"),o=document.getElementById("upstep-form-msg"),i=document.getElementById("upstep-submit-btn");if(!s||this.loading)return;const n=s.value.trim();if(n){this.loading=!0,i&&(i.disabled=!0,i.textContent="Sending…");try{await this.client.submitFeedback({content:n,type:this.selectedType}),s.value="",o&&(o.textContent="Feedback received. Thank you."),await this.fetchFeed()}catch{o&&(o.textContent="Something went wrong. Please try again.")}finally{this.loading=!1,i&&(i.disabled=!1,i.textContent="Send feedback")}}})}bindVoteButtons(){document.querySelectorAll(".upstep-vote").forEach(t=>{t.addEventListener("click",async()=>{const s=t.dataset.feedback;try{await this.client.vote(s,"UP"),await this.fetchFeed()}catch{}})})}}function x(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}let p=null,d=null;const C={init(e){if(p=new W(e),typeof window<"u"){const t={};e.accentColor!==void 0&&(t.accentColor=e.accentColor),e.position!==void 0&&(t.position=e.position),e.theme!==void 0&&(t.theme=e.theme),e.launcher!==void 0&&(t.launcher=e.launcher),e.colors!==void 0&&(t.colors=e.colors),e.radius!==void 0&&(t.radius=e.radius),e.fontFamily!==void 0&&(t.fontFamily=e.fontFamily);const s=()=>{d=new X(p,t),d.mount()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",s):s()}return p},open(){d==null||d.openWidget()},close(){d==null||d.closeWidget()},identify(e){p==null||p.setUserId(e)},identifySupport(e){var s;p&&(p.supportIdentityToken=e);const t=document.querySelector("#upstep-support-frame");t&&p&&((s=t.contentWindow)==null||s.postMessage({type:"upstep:support:identity",token:e,visible:(d==null?void 0:d.isChatVisible())??!0},new URL(p.baseUrl).origin))},onUnread(e){return(d==null?void 0:d.onUnread(e))??(()=>{})},get client(){if(!p)throw new Error("Upstep.init() must be called first");return p}};if(typeof document<"u"){const e=document.currentScript,t=e==null?void 0:e.dataset.apiKey,s=e==null?void 0:e.dataset.userId,o=e==null?void 0:e.dataset.baseUrl,i=e==null?void 0:e.dataset.accentColor,n=e==null?void 0:e.dataset.position,a=e==null?void 0:e.dataset.theme;if(t){const r={apiKey:t};s&&(r.userId=s),(e==null?void 0:e.dataset.chat)!==void 0&&(r.chat=e.dataset.chat!=="false"),o&&(r.baseUrl=o),i&&(r.accentColor=i),(n==="left"||n==="right")&&(r.position=n),(a==="light"||a==="dark"||a==="auto")&&(r.theme=a);const c=e==null?void 0:e.dataset.colors;if(c)try{const l=JSON.parse(c);l&&typeof l=="object"&&(r.colors=l)}catch{console.warn("Upstep: data-colors must be JSON")}const u=e==null?void 0:e.dataset.radius;u&&Number.isFinite(Number(u))&&(r.radius=Number(u));const h=e==null?void 0:e.dataset.fontFamily;h&&(r.fontFamily=h),C.init(r)}}window.Upstep=C})();
|
package/dist/widget.d.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
import { UpstepColorOverrides } from '@upstep/types';
|
|
1
2
|
import { UpstepApiClient } from './api';
|
|
2
3
|
type ThemeMode = "light" | "dark" | "auto";
|
|
3
4
|
export interface WidgetOptions {
|
|
4
5
|
accentColor?: string;
|
|
6
|
+
/** Panel color overrides. Unset keys keep the default palette. */
|
|
7
|
+
colors?: UpstepColorOverrides;
|
|
8
|
+
/** Base corner radius in px. Defaults to 12. */
|
|
9
|
+
radius?: number;
|
|
10
|
+
/** CSS font-family for the widget. */
|
|
11
|
+
fontFamily?: string;
|
|
5
12
|
position?: "left" | "right";
|
|
6
13
|
/** Color theme. "auto" follows the OS preference. Defaults to "auto". */
|
|
7
14
|
theme?: ThemeMode;
|
|
@@ -15,10 +22,10 @@ export declare class UpstepWidget {
|
|
|
15
22
|
private feedItems;
|
|
16
23
|
private selectedType;
|
|
17
24
|
private loading;
|
|
18
|
-
private accent;
|
|
19
25
|
private position;
|
|
20
26
|
private showLauncher;
|
|
21
27
|
private themeMode;
|
|
28
|
+
private options;
|
|
22
29
|
private palette;
|
|
23
30
|
private hasSupport;
|
|
24
31
|
private disconnectSupport;
|
|
@@ -28,6 +35,9 @@ export declare class UpstepWidget {
|
|
|
28
35
|
private frameTheme;
|
|
29
36
|
private unreadListeners;
|
|
30
37
|
constructor(client: UpstepApiClient, options?: WidgetOptions);
|
|
38
|
+
private buildPalette;
|
|
39
|
+
private get accent();
|
|
40
|
+
private supportFrameSrc;
|
|
31
41
|
mount(): void;
|
|
32
42
|
/** Open the feedback modal programmatically (e.g. from your own button). */
|
|
33
43
|
openWidget(): void;
|
package/dist/widget.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget.d.ts","sourceRoot":"","sources":["../src/widget.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAsB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"widget.d.ts","sourceRoot":"","sources":["../src/widget.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAsB,MAAM,OAAO,CAAC;AAG5D,KAAK,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAwG3C,MAAM,WAAW,aAAa;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,yEAAyE;IACzE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,GAAG,CAAiB;IAC5B,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAmB;IACnC,OAAO,CAAC,YAAY,CAAU;IAC9B,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,iBAAiB,CAA6B;IACtD,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,UAAU,CAA4C;IAC9D,OAAO,CAAC,KAAK,CAA6B;IAC1C,OAAO,CAAC,UAAU,CAAiC;IACnD,OAAO,CAAC,eAAe,CAAsC;gBAEjD,MAAM,EAAE,eAAe,EAAE,OAAO,GAAE,aAAkB;IAShE,OAAO,CAAC,YAAY;IASpB,OAAO,KAAK,MAAM,GAEjB;IAED,OAAO,CAAC,eAAe;IAYvB,KAAK;IAgBL,4EAA4E;IAC5E,UAAU;IAIV,iDAAiD;IACjD,WAAW;IAIX,sDAAsD;IACtD,aAAa;IAIb,wFAAwF;IACxF,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI;IAQ1C,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,YAAY;IAIpB,OAAO,KAAK,OAAO,GAElB;IAED,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,SAAS;IAsCjB,OAAO,CAAC,UAAU;IAkBlB,OAAO,CAAC,SAAS;IAwBjB,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,SAAS;IAmBjB,OAAO,CAAC,SAAS;IAKjB,+FAA+F;IAC/F,OAAO,CAAC,WAAW;IAcnB,OAAO,CAAC,KAAK;YAsBC,SAAS;IAUvB,OAAO,CAAC,WAAW;IA+CnB,OAAO,CAAC,gBAAgB;IA0BxB,OAAO,CAAC,UAAU;IAyBlB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,cAAc;IAsDtB,OAAO,CAAC,eAAe;CAaxB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@upstep/js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "UpStep feedback, voting and AI support widgets for web apps",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://upstep.dev",
|
|
@@ -36,18 +36,18 @@
|
|
|
36
36
|
"types": "./dist/support.d.ts",
|
|
37
37
|
"import": "./dist/support.js",
|
|
38
38
|
"require": "./dist/support.cjs"
|
|
39
|
+
},
|
|
40
|
+
"./theme": {
|
|
41
|
+
"types": "./dist/theme.d.ts",
|
|
42
|
+
"import": "./dist/theme.js",
|
|
43
|
+
"require": "./dist/theme.cjs"
|
|
39
44
|
}
|
|
40
45
|
},
|
|
41
46
|
"files": [
|
|
42
47
|
"dist"
|
|
43
48
|
],
|
|
44
|
-
"scripts": {
|
|
45
|
-
"build": "vite build && vite build --config vite.embed.config.ts",
|
|
46
|
-
"dev": "vite build --watch",
|
|
47
|
-
"type-check": "tsc --noEmit"
|
|
48
|
-
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@upstep/types": "
|
|
50
|
+
"@upstep/types": "0.9.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"react": ">=18",
|
|
@@ -69,5 +69,10 @@
|
|
|
69
69
|
"vite-plugin-dts": "^4.4.0"
|
|
70
70
|
},
|
|
71
71
|
"unpkg": "./dist/upstep.global.js",
|
|
72
|
-
"jsdelivr": "./dist/upstep.global.js"
|
|
73
|
-
|
|
72
|
+
"jsdelivr": "./dist/upstep.global.js",
|
|
73
|
+
"scripts": {
|
|
74
|
+
"build": "vite build && vite build --config vite.embed.config.ts",
|
|
75
|
+
"dev": "vite build --watch",
|
|
76
|
+
"type-check": "tsc --noEmit"
|
|
77
|
+
}
|
|
78
|
+
}
|