@tellyouai/plugin 0.1.7 → 0.1.8

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
@@ -86,6 +86,30 @@ Existing script integrations remain supported:
86
86
  Query-string configuration belongs to the CDN entry. npm consumers pass all
87
87
  configuration to `initialize` directly.
88
88
 
89
+ ## Placement
90
+
91
+ Position the launcher with named anchors, or supply exact CSS offsets per
92
+ instance. The popup uses the same horizontal anchor and opens above a bottom
93
+ launcher or below a top launcher. The popup's z-index is always one greater
94
+ than the configured launcher z-index (8 and 9 by default).
95
+
96
+ ```ts
97
+ await initialize({
98
+ entityId: "YOUR_ENTITY_ID",
99
+ position: { x: "left", y: "top", z: 123 },
100
+ });
101
+
102
+ // Exact offsets override the corresponding named axis when both are supplied.
103
+ await initialize({
104
+ entityId: "YOUR_ENTITY_ID",
105
+ style: { top: "22rem", left: "auto", right: "12px", zIndex: 99 },
106
+ });
107
+ ```
108
+
109
+ The modal-style `overlay` and `bar` popups retain their preset layout; placement
110
+ offsets apply to their launcher. `style.zIndex` takes precedence over
111
+ `position.z`.
112
+
89
113
  ## User identity
90
114
 
91
115
  Pass the host application's stable user ID to reuse and update the same
@@ -67019,26 +67019,26 @@ var rV, iV, Bpe = o((() => {
67019
67019
  deleteDelay: 18,
67020
67020
  betweenDelay: 120
67021
67021
  }
67022
- }, YV = ({ type: e, isLoading: t, isOpen: n, onClickButton: r, isCustomTarget: i, quickActions: a, onClickQuickAction: o, onMessages: s, sendMessage: c, hasChatUserMessages: l, userMessages: u, onClickCall: d, callIsConnected: f, callIsConnecting: p }) => {
67023
- let [m, h] = (0, KV.useState)(!1), { locale: g, formatMessage: _ } = cA(), v = g.split("-")[0].trim(), { styles: { themeColors: y, openerDimensions: b, marginRight: x, marginBottom: S, transitionSpeed: C, color: w, colorBright: T, colorDark: E, backgroundColor: D, shadowOuter: O, borderColor: ee, borderRadiusLg: k } } = gA(), te = y?.[0], A = dn(te), [j, M] = (0, KV.useState)(!1), { config: { greeting: N, mediaUrl: P, mediaUrls: F, quickActionsSpeed: ne, withVoice: re } } = Kl(), { widgetId: ie } = ql(), ae = !ie && e === "button" ? P : void 0, oe = F?.[2]?.url || ae, I = t ? "" : N?._ || N?.[v] || N?.en || _({ id: "ask-us-anything" }), se = (0, KV.useMemo)(() => {
67024
- let e = a?.map((e) => e.strings._ || e.strings[v] || e.strings.en).filter((e) => !!e) ?? [];
67025
- return [I, ...e].filter((e, t, n) => !!e && n.indexOf(e) === t);
67022
+ }, YV = ({ type: e, isLoading: t, isOpen: n, onClickButton: r, isCustomTarget: i, zIndex: a, placement: o, quickActions: s, onClickQuickAction: c, onMessages: l, sendMessage: u, hasChatUserMessages: d, userMessages: f, onClickCall: p, callIsConnected: m, callIsConnecting: h }) => {
67023
+ let [g, _] = (0, KV.useState)(!1), { locale: v, formatMessage: y } = cA(), b = v.split("-")[0].trim(), { styles: { themeColors: x, openerDimensions: S, marginRight: C, transitionSpeed: w, color: T, colorBright: E, colorDark: D, backgroundColor: O, shadowOuter: ee, borderColor: k, borderRadiusLg: te } } = gA(), A = x?.[0], j = dn(A), [M, N] = (0, KV.useState)(!1), { config: { greeting: P, mediaUrl: F, mediaUrls: ne, quickActionsSpeed: re, withVoice: ie } } = Kl(), { widgetId: ae } = ql(), oe = !ae && e === "button" ? F : void 0, I = ne?.[2]?.url || oe, se = t ? "" : P?._ || P?.[b] || P?.en || y({ id: "ask-us-anything" }), ce = (0, KV.useMemo)(() => {
67024
+ let e = s?.map((e) => e.strings._ || e.strings[b] || e.strings.en).filter((e) => !!e) ?? [];
67025
+ return [se, ...e].filter((e, t, n) => !!e && n.indexOf(e) === t);
67026
67026
  }, [
67027
- I,
67028
- v,
67029
- a
67030
- ]), [ce, le] = (0, KV.useState)(""), [ue, de] = (0, KV.useState)(!1);
67027
+ se,
67028
+ b,
67029
+ s
67030
+ ]), [le, ue] = (0, KV.useState)(""), [de, fe] = (0, KV.useState)(!1);
67031
67031
  (0, KV.useEffect)(() => {
67032
- let e = window.matchMedia("(prefers-reduced-motion: reduce)"), t = () => de(e.matches);
67032
+ let e = window.matchMedia("(prefers-reduced-motion: reduce)"), t = () => fe(e.matches);
67033
67033
  return t(), e.addEventListener("change", t), () => e.removeEventListener("change", t);
67034
67034
  }, []), (0, KV.useEffect)(() => {
67035
- if (se.length <= 1 || ue) {
67036
- le("");
67035
+ if (ce.length <= 1 || de) {
67036
+ ue("");
67037
67037
  return;
67038
67038
  }
67039
- let e = JV[ne || "normal"], t = 0, n = 0, r = !1, i, a = () => {
67040
- let o = se[t] ?? "";
67041
- if (le(o.slice(0, n)), !r && n < o.length) {
67039
+ let e = JV[re || "normal"], t = 0, n = 0, r = !1, i, a = () => {
67040
+ let o = ce[t] ?? "";
67041
+ if (ue(o.slice(0, n)), !r && n < o.length) {
67042
67042
  n += 1, i = setTimeout(a, e.typeDelay);
67043
67043
  return;
67044
67044
  }
@@ -67050,137 +67050,135 @@ var rV, iV, Bpe = o((() => {
67050
67050
  --n, i = setTimeout(a, e.deleteDelay);
67051
67051
  return;
67052
67052
  }
67053
- r = !1, t = (t + 1) % se.length, i = setTimeout(a, e.betweenDelay);
67053
+ r = !1, t = (t + 1) % ce.length, i = setTimeout(a, e.betweenDelay);
67054
67054
  };
67055
67055
  return i = setTimeout(a, 0), () => {
67056
67056
  clearTimeout(i);
67057
67057
  };
67058
67058
  }, [
67059
- se,
67060
- ue,
67061
- ne
67059
+ ce,
67060
+ de,
67061
+ re
67062
67062
  ]);
67063
- let fe = se.length <= 1 || ue ? se[0] ?? "" : ce;
67063
+ let pe = ce.length <= 1 || de ? ce[0] ?? "" : le;
67064
67064
  return /* @__PURE__ */ (0, qV.jsxs)("div", {
67065
67065
  style: {
67066
- zIndex: 8,
67067
- bottom: S,
67068
- right: e === "input" ? "50%" : x,
67069
- transform: e === "input" ? "translateX(50%)" : void 0,
67066
+ zIndex: a,
67067
+ ...o,
67070
67068
  position: i ? "absolute" : "fixed",
67071
- maxWidth: `calc(${i ? "100%" : "100dvw"} - ${x} - ${x})`,
67069
+ maxWidth: `calc(${i ? "100%" : "100dvw"} - ${C} - ${C})`,
67072
67070
  lineHeight: "initial",
67073
67071
  fontSize: "initial"
67074
67072
  },
67075
- children: [e === "input" && /* @__PURE__ */ (0, qV.jsxs)(qV.Fragment, { children: [!n && a?.map((e, t) => {
67076
- let n = e.strings._ || e.strings[v] || e.strings.en;
67073
+ children: [e === "input" && /* @__PURE__ */ (0, qV.jsxs)(qV.Fragment, { children: [!n && s?.map((e, t) => {
67074
+ let n = e.strings._ || e.strings[b] || e.strings.en;
67077
67075
  return /* @__PURE__ */ (0, qV.jsx)(xV, {
67078
67076
  size: "sm",
67079
- onClick: () => o?.(n, e.context),
67077
+ onClick: () => c?.(n, e.context),
67080
67078
  style: {
67081
- position: j ? "static" : "absolute",
67079
+ position: M ? "static" : "absolute",
67082
67080
  bottom: `${t * 40 + 2}px`,
67083
67081
  left: 0,
67084
- zIndex: 8,
67082
+ zIndex: a,
67085
67083
  whiteSpace: "nowrap",
67086
67084
  height: "36px",
67087
- borderRadius: k,
67085
+ borderRadius: te,
67088
67086
  fontWeight: "inherit",
67089
67087
  fontSize: 14,
67090
67088
  padding: "12px 12px",
67091
67089
  marginBottom: "8px",
67092
- opacity: +!!j,
67093
- visibility: j ? "visible" : "hidden",
67094
- pointerEvents: j ? void 0 : "none",
67095
- transform: j ? "translateY(0)" : "translateY(40px)",
67096
- transition: "all " + C,
67097
- boxShadow: O
67090
+ opacity: +!!M,
67091
+ visibility: M ? "visible" : "hidden",
67092
+ pointerEvents: M ? void 0 : "none",
67093
+ transform: M ? "translateY(0)" : "translateY(40px)",
67094
+ transition: "all " + w,
67095
+ boxShadow: ee
67098
67096
  },
67099
67097
  className: "tellyouai-quick-action-button",
67100
67098
  children: n
67101
67099
  }, n);
67102
67100
  }), /* @__PURE__ */ (0, qV.jsx)(WV, {
67103
- placeholder: fe,
67104
- onMessages: s,
67105
- sendMessage: c,
67106
- userMessages: u,
67101
+ placeholder: pe,
67102
+ onMessages: l,
67103
+ sendMessage: u,
67104
+ userMessages: f,
67107
67105
  onClick: () => {
67108
- l && !n && r?.();
67106
+ d && !n && r?.();
67109
67107
  },
67110
67108
  style: {
67111
- borderRadius: k,
67109
+ borderRadius: te,
67112
67110
  padding: "1px",
67113
- backgroundImage: y ? "linear-gradient(45deg, " + y.join(", ") + ") " : void 0,
67114
- boxShadow: O + ", 0 0 12px -4px " + (te || "transparent")
67111
+ backgroundImage: x ? "linear-gradient(45deg, " + x.join(", ") + ") " : void 0,
67112
+ boxShadow: ee + ", 0 0 12px -4px " + (A || "transparent")
67115
67113
  },
67116
67114
  containerStyle: {
67117
- background: D,
67118
- borderRadius: k
67115
+ background: O,
67116
+ borderRadius: te
67119
67117
  },
67120
67118
  inputStyle: {
67121
- width: e === "input" ? j || n ? "calc(560px)" : "calc(400px)" : void 0,
67119
+ width: e === "input" ? M || n ? "calc(560px)" : "calc(400px)" : void 0,
67122
67120
  maxWidth: "100%",
67123
- transition: "width " + C,
67124
- borderRadius: k,
67121
+ transition: "width " + w,
67122
+ borderRadius: te,
67125
67123
  whiteSpace: "nowrap",
67126
67124
  fontSize: "initial",
67127
67125
  borderWidth: 0,
67128
67126
  background: "none"
67129
67127
  },
67130
67128
  onFocus: () => {
67131
- M(!0);
67129
+ N(!0);
67132
67130
  },
67133
67131
  onBlur: (e) => {
67134
- e.relatedTarget?.classList?.contains("tellyouai-quick-action-button") || M(!1);
67132
+ e.relatedTarget?.classList?.contains("tellyouai-quick-action-button") || N(!1);
67135
67133
  },
67136
67134
  withEmoji: !1,
67137
- withFiles: n || l ? void 0 : !1,
67138
- withVoice: re,
67139
- onClickCall: d,
67140
- callIsConnected: f,
67141
- callIsConnecting: p
67142
- })] }), e === "button" && /* @__PURE__ */ (0, qV.jsxs)(qV.Fragment, { children: [!n && a?.map((e, t) => {
67143
- let n = e.strings._ || e.strings[v] || e.strings.en, r = t === 0 ? -10 : t === 1 ? -5 : t === 2 ? 40 : 0;
67135
+ withFiles: n || d ? void 0 : !1,
67136
+ withVoice: ie,
67137
+ onClickCall: p,
67138
+ callIsConnected: m,
67139
+ callIsConnecting: h
67140
+ })] }), e === "button" && /* @__PURE__ */ (0, qV.jsxs)(qV.Fragment, { children: [!n && s?.map((e, t) => {
67141
+ let n = e.strings._ || e.strings[b] || e.strings.en, r = t === 0 ? -10 : t === 1 ? -5 : t === 2 ? 40 : 0;
67144
67142
  return /* @__PURE__ */ (0, qV.jsx)(xV, {
67145
67143
  size: "sm",
67146
- onClick: () => o?.(n, e.context),
67144
+ onClick: () => c?.(n, e.context),
67147
67145
  style: {
67148
67146
  position: "absolute",
67149
67147
  bottom: `${t * 40 + 2}px`,
67150
- right: `calc(${b} - ${r}px)`,
67151
- zIndex: 8,
67148
+ right: `calc(${S} - ${r}px)`,
67149
+ zIndex: a,
67152
67150
  whiteSpace: "nowrap",
67153
67151
  height: "32px",
67154
67152
  borderRadius: "16px",
67155
67153
  fontSize: 14,
67156
67154
  padding: "10px 12px",
67157
- boxShadow: O
67155
+ boxShadow: ee
67158
67156
  },
67159
67157
  children: n
67160
67158
  }, n);
67161
67159
  }), /* @__PURE__ */ (0, qV.jsxs)("button", {
67162
67160
  "aria-expanded": n,
67163
- onPointerEnter: () => h(!0),
67164
- onPointerLeave: () => h(!1),
67165
- onFocus: () => h(!0),
67166
- onBlur: () => h(!1),
67161
+ onPointerEnter: () => _(!0),
67162
+ onPointerLeave: () => _(!1),
67163
+ onFocus: () => _(!0),
67164
+ onBlur: () => _(!1),
67167
67165
  style: {
67168
67166
  display: "flex",
67169
67167
  alignItems: "center",
67170
67168
  justifyContent: "center",
67171
- width: b,
67172
- height: b,
67169
+ width: S,
67170
+ height: S,
67173
67171
  boxSizing: "border-box",
67174
- padding: oe ? "" : 11.9,
67175
- border: `0.5px solid ${ee}`,
67172
+ padding: I ? "" : 11.9,
67173
+ border: `0.5px solid ${k}`,
67176
67174
  borderRadius: "100%",
67177
- backgroundColor: t ? "transparent" : n || oe ? D : te,
67178
- color: n ? w : A === !0 ? E : A === !1 ? T : void 0,
67175
+ backgroundColor: t ? "transparent" : n || I ? O : A,
67176
+ color: n ? T : j === !0 ? D : j === !1 ? E : void 0,
67179
67177
  cursor: "pointer",
67180
- boxShadow: O,
67181
- transition: "all " + C,
67178
+ boxShadow: ee,
67179
+ transition: "all " + w,
67182
67180
  opacity: +!t,
67183
- scale: m ? 1.1 : 1,
67181
+ scale: g ? 1.1 : 1,
67184
67182
  overflow: "hidden"
67185
67183
  },
67186
67184
  disabled: t,
@@ -67188,7 +67186,7 @@ var rV, iV, Bpe = o((() => {
67188
67186
  children: [!t && /* @__PURE__ */ (0, qV.jsx)(qV.Fragment, { children: n ? /* @__PURE__ */ (0, qV.jsx)(TV, {
67189
67187
  id: "down",
67190
67188
  size: "md"
67191
- }) : oe ? /* @__PURE__ */ (0, qV.jsx)("img", {
67189
+ }) : I ? /* @__PURE__ */ (0, qV.jsx)("img", {
67192
67190
  alt: "",
67193
67191
  style: {
67194
67192
  width: "100%",
@@ -67196,13 +67194,13 @@ var rV, iV, Bpe = o((() => {
67196
67194
  objectFit: "cover",
67197
67195
  objectPosition: "center"
67198
67196
  },
67199
- src: oe
67197
+ src: I
67200
67198
  }) : /* @__PURE__ */ (0, qV.jsx)(hV, {
67201
67199
  animation: "appear",
67202
67200
  size: "80%"
67203
67201
  }) }), /* @__PURE__ */ (0, qV.jsx)("span", {
67204
67202
  className: "tellyouai-sr-only",
67205
- children: _(n ? { id: "close" } : { id: "chat-with-me" })
67203
+ children: y(n ? { id: "close" } : { id: "chat-with-me" })
67206
67204
  })]
67207
67205
  })] })]
67208
67206
  });
@@ -68560,77 +68558,90 @@ var rV, iV, Bpe = o((() => {
68560
68558
  };
68561
68559
  })), Pq, Fq, Iq, eye = o((() => {
68562
68560
  Pq = /* @__PURE__ */ u(m(), 1), yA(), Gpe(), fH(), hH(), Nq(), Fq = nn(), Iq = ({ canStore: e, displayMode: t, displaySize: n, onClickQuickAction: r, onClickDisplaySize: i, onMessages: a, sendMessage: o, children: s, onOpenChange: c, hasChatUserMessages: l, userMessages: u, mode: d, onClickNewChat: f, onClickCall: p, callIsConnected: m, callIsConnecting: h }) => {
68563
- let { formatMessage: g } = cA(), { isMobile: _ } = Tu(), { config: { entityId: v, withQuickActions: y, quickActions: b, withLocale: x, withConsent: S, privacyUrl: C }, isLoading: w } = Kl(), { entityId: T } = xu(), E = y === "visible" || y === "visible-desktop" && !_, { background: D, styles: { color: O, borderColor: ee, backgroundColor70: k, spacingXS: te, spacingMD: A, marginRight: j, marginBottom: M, openerDimensions: N, transitionSpeed: P, borderRadiusLg: F, shadowOuter: ne, themeColors: re } } = gA(), { config: ie, target: ae, isCustomTarget: oe } = ql(), { session: I, setSession: se } = Yl(v, T, ae, ie.widgetId, e), [ce, le] = (0, Pq.useState)(), ue = ce ?? ie.isOpen ?? I.isOpen ?? !1, de = I.isMaximized ?? ie.isMaximized ?? !1, fe = (0, Pq.useRef)(null), pe = (0, Pq.useRef)(null), L = (0, Pq.useRef)(!1), me = (0, Pq.useCallback)((e) => {
68564
- le(e), se({ isOpen: e }), c?.(e);
68565
- }, [se, c]), he = (0, Pq.useCallback)((e) => {
68566
- se({ isMaximized: e });
68567
- }, [se]);
68561
+ let { formatMessage: g } = cA(), { isMobile: _ } = Tu(), { config: { entityId: v, withQuickActions: y, quickActions: b, withLocale: x, withConsent: S, privacyUrl: C, position: w, style: T }, isLoading: E } = Kl(), { entityId: D } = xu(), O = y === "visible" || y === "visible-desktop" && !_, { background: ee, styles: { color: k, borderColor: te, backgroundColor70: A, spacingXS: j, spacingMD: M, marginRight: N, marginBottom: P, openerDimensions: F, transitionSpeed: ne, borderRadiusLg: re, shadowOuter: ie, themeColors: ae } } = gA(), { config: oe, target: I, isCustomTarget: se } = ql(), { session: ce, setSession: le } = Yl(v, D, I, oe.widgetId, e), [ue, de] = (0, Pq.useState)(), fe = ue ?? oe.isOpen ?? ce.isOpen ?? !1, pe = ce.isMaximized ?? oe.isMaximized ?? !1, L = oe.position === void 0 ? w : oe.position, me = oe.style === void 0 ? T : oe.style, he = me?.zIndex ?? L?.z ?? 8, ge = (0, Pq.useRef)(null), _e = (0, Pq.useRef)(null), R = (0, Pq.useRef)(!1), ve = (0, Pq.useCallback)((e) => {
68562
+ de(e), le({ isOpen: e }), c?.(e);
68563
+ }, [le, c]), ye = (0, Pq.useCallback)((e) => {
68564
+ le({ isMaximized: e });
68565
+ }, [le]);
68568
68566
  (0, Pq.useEffect)(() => {
68569
68567
  let e = (e) => {
68570
68568
  let t = e.detail?.id, n = e.detail?.open;
68571
- t && t !== ae || n !== void 0 && (console.log("tellyouai open event", t, n), me(n));
68569
+ t && t !== I || n !== void 0 && (console.log("tellyouai open event", t, n), ve(n));
68572
68570
  };
68573
68571
  return window.addEventListener("tellyouai-plugin", e), () => {
68574
68572
  window.removeEventListener("tellyouai-plugin", e);
68575
68573
  };
68576
68574
  }, [
68577
68575
  t,
68578
- ae,
68579
- me
68576
+ I,
68577
+ ve
68580
68578
  ]), (0, Pq.useEffect)(() => {
68581
- if (ue && !L.current) {
68582
- pe.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
68579
+ if (fe && !R.current) {
68580
+ _e.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
68583
68581
  let e = requestAnimationFrame(() => {
68584
- (fe.current?.querySelector("textarea, input:not([type=\"hidden\"]), select, button, a[href], [tabindex]:not([tabindex=\"-1\"])") ?? fe.current)?.focus();
68582
+ (ge.current?.querySelector("textarea, input:not([type=\"hidden\"]), select, button, a[href], [tabindex]:not([tabindex=\"-1\"])") ?? ge.current)?.focus();
68585
68583
  });
68586
- return L.current = !0, () => cancelAnimationFrame(e);
68587
- }
68588
- !ue && L.current && (pe.current?.focus(), pe.current = null, L.current = !1);
68589
- }, [ue]);
68590
- let ge = (e, t) => {
68591
- me(!0), r(e, t);
68592
- }, _e = t === "overlay" || t === "overlay-maximized" || t === "bar" || t === "bar-maximized", R = t === "overlay" || t === "overlay-maximized", ve = _e ? de ? "90dvw" : "560px" : de ? "700px" : "400px", ye = R ? "90dvh" : de || _ ? "100dvh" : t === "bar" ? "500px" : "700px", be = _e ? "50%" : j, xe = R ? "53%" : t === "bar" ? `calc(${M} + 64px)` : _ ? `calc(${M})` : `calc(${M} + ${N} + ${A})`, Se = F, Ce = t !== "bar" && t !== "bar-maximized" ? "button" : "input", we = dH(D, re, "bottom"), Te = uH(t, d, D), Ee = d === "text" && S !== !0;
68584
+ return R.current = !0, () => cancelAnimationFrame(e);
68585
+ }
68586
+ !fe && R.current && (_e.current?.focus(), _e.current = null, R.current = !1);
68587
+ }, [fe]);
68588
+ let be = (e, t) => {
68589
+ ve(!0), r(e, t);
68590
+ }, xe = t === "overlay" || t === "overlay-maximized" || t === "bar" || t === "bar-maximized", Se = t === "overlay" || t === "overlay-maximized", Ce = xe ? pe ? "90dvw" : "560px" : pe ? "700px" : "400px", we = Se ? "90dvh" : pe || _ ? "100dvh" : t === "bar" ? "500px" : "700px", Te = xe ? "50%" : N, Ee = Se ? "53%" : t === "bar" ? `calc(${P} + 64px)` : _ ? `calc(${P})` : `calc(${P} + ${F} + ${M})`, De = re, Oe = t !== "bar" && t !== "bar-maximized" ? "button" : "input", ke = me, Ae = L?.x ?? (Oe === "input" ? "center" : "right"), je = L?.y ?? "bottom", Me = ke?.left !== void 0 || ke?.right !== void 0, Ne = ke?.top !== void 0 || ke?.bottom !== void 0, Pe = {
68591
+ left: Me ? ke?.left : Ae === "left" ? N : Ae === "center" ? "50%" : void 0,
68592
+ right: Me ? ke?.right : Ae === "right" ? N : void 0,
68593
+ top: Ne ? ke?.top : je === "top" ? P : je === "center" ? "50%" : void 0,
68594
+ bottom: Ne ? ke?.bottom : je === "bottom" ? P : void 0,
68595
+ transform: `translate(${!Me && Ae === "center" ? "-50%" : "0"}, ${!Ne && je === "center" ? "-50%" : "0"})`
68596
+ }, Fe = Pe.top !== void 0 && Pe.top !== "auto", Ie = Fe ? `calc(${Pe.top} + ${F} + ${M})` : void 0, Le = Fe ? void 0 : Pe.bottom !== void 0 && Pe.bottom !== "auto" ? `calc(${Pe.bottom} + ${F} + ${M})` : Ee, Re = {
68597
+ top: Ie,
68598
+ bottom: Le,
68599
+ left: Pe.left,
68600
+ right: Pe.right,
68601
+ transform: `translate(${!Me && Ae === "center" ? "-50%" : "0"}, 0)`
68602
+ }, ze = !xe && !Se, Be = ze ? Ie ?? Le ?? Ee : Ee, Ve = dH(ee, ae, "bottom"), He = uH(t, d, ee), Ue = d === "text" && S !== !0;
68593
68603
  return /* @__PURE__ */ (0, Fq.jsxs)(Fq.Fragment, { children: [/* @__PURE__ */ (0, Fq.jsxs)("div", {
68594
- ref: fe,
68604
+ ref: ge,
68595
68605
  role: "dialog",
68596
68606
  "aria-label": g({ id: "chat-with-me" }),
68597
68607
  tabIndex: -1,
68598
68608
  onKeyDown: (e) => {
68599
- e.key === "Escape" && (e.stopPropagation(), me(!1));
68609
+ e.key === "Escape" && (e.stopPropagation(), ve(!1));
68600
68610
  },
68601
68611
  style: {
68602
- position: oe ? "absolute" : "fixed",
68603
- zIndex: 9,
68604
- transform: `translate(${_e ? "50%" : "0"}, ${R ? "50%" : "0"})`,
68605
- bottom: xe,
68606
- right: be,
68607
- backgroundColor: k,
68612
+ position: se ? "absolute" : "fixed",
68613
+ zIndex: he + 1,
68614
+ transform: `translate(${xe ? "50%" : "0"}, ${Se ? "50%" : "0"})`,
68615
+ bottom: Ee,
68616
+ right: Te,
68617
+ ...ze ? Re : {},
68618
+ backgroundColor: A,
68608
68619
  backdropFilter: "blur(48px)",
68609
68620
  boxSizing: "border-box",
68610
- width: `min(calc(100% - ${j} - ${j}), ${ve})`,
68611
- height: R ? "80dvh" : `min(calc(100dvh - ${M} - ${xe}), ${ye})`,
68612
- maxWidth: _e ? "1000px" : void 0,
68613
- maxHeight: R ? "1000px" : `calc(100dvh - ${xe} - ${A})`,
68621
+ width: `min(calc(100% - ${N} - ${N}), ${Ce})`,
68622
+ height: Se ? "80dvh" : `min(calc(100dvh - ${P} - ${Be}), ${we})`,
68623
+ maxWidth: xe ? "1000px" : void 0,
68624
+ maxHeight: Se ? "1000px" : `calc(100dvh - ${Be} - ${M})`,
68614
68625
  display: "flex",
68615
- visibility: ue ? "visible" : "hidden",
68616
- opacity: ue ? "1" : "0",
68617
- translate: ue ? "0 0" : "0 100%",
68626
+ visibility: fe ? "visible" : "hidden",
68627
+ opacity: fe ? "1" : "0",
68628
+ translate: fe ? "0 0" : "0 100%",
68618
68629
  flexDirection: "column",
68619
68630
  alignItems: "center",
68620
- border: `0.5px solid ${ee}`,
68621
- borderRadius: Se,
68622
- boxShadow: ne,
68623
- transition: "all " + P,
68624
- color: O,
68631
+ border: `0.5px solid ${te}`,
68632
+ borderRadius: De,
68633
+ boxShadow: ie,
68634
+ transition: "all " + ne,
68635
+ color: k,
68625
68636
  fontSize: `${14 + (n - 1)}px`,
68626
68637
  lineHeight: `${(14 + (n - 1)) * 1.7}px`
68627
68638
  },
68628
68639
  children: [/* @__PURE__ */ (0, Fq.jsx)(jq.Provider, {
68629
68640
  value: {
68630
68641
  onClickDisplaySize: i,
68631
- onChangeDisplayMode: () => he(!de),
68632
- maximized: de,
68633
- onClose: () => me(!ue),
68642
+ onChangeDisplayMode: () => ye(!pe),
68643
+ maximized: pe,
68644
+ onClose: () => ve(!fe),
68634
68645
  onClickNewChat: f,
68635
68646
  withLocale: x
68636
68647
  },
@@ -68639,16 +68650,16 @@ var rV, iV, Bpe = o((() => {
68639
68650
  style: {
68640
68651
  opacity: "0.5",
68641
68652
  flexShrink: 0,
68642
- color: Te ? we : void 0,
68643
- paddingBottom: te,
68653
+ color: He ? Ve : void 0,
68654
+ paddingBottom: j,
68644
68655
  width: "100%",
68645
68656
  textAlign: "center",
68646
- borderBottomLeftRadius: Se,
68647
- borderBottomRightRadius: Se
68657
+ borderBottomLeftRadius: De,
68658
+ borderBottomRightRadius: De
68648
68659
  },
68649
68660
  children: /* @__PURE__ */ (0, Fq.jsx)("span", {
68650
68661
  style: { fontSize: "0.7em" },
68651
- children: Ee ? g({ id: "chat-privacy-notice" }, { 0: C ? /* @__PURE__ */ (0, Fq.jsx)(mH, {
68662
+ children: Ue ? g({ id: "chat-privacy-notice" }, { 0: C ? /* @__PURE__ */ (0, Fq.jsx)(mH, {
68652
68663
  href: C,
68653
68664
  target: "_blank",
68654
68665
  rel: "noopener noreferrer",
@@ -68670,25 +68681,27 @@ var rV, iV, Bpe = o((() => {
68670
68681
  })
68671
68682
  })]
68672
68683
  }), /* @__PURE__ */ (0, Fq.jsx)(YV, {
68673
- type: Ce,
68674
- isLoading: w,
68675
- isOpen: ue,
68684
+ type: Oe,
68685
+ isLoading: E,
68686
+ isOpen: fe,
68676
68687
  onClickButton: () => {
68677
- me(!ue);
68688
+ ve(!fe);
68678
68689
  },
68679
68690
  hasChatUserMessages: l,
68680
68691
  userMessages: u,
68681
- isCustomTarget: oe,
68682
- quickActions: E ? b : [],
68683
- onClickQuickAction: ge,
68692
+ isCustomTarget: se,
68693
+ zIndex: he,
68694
+ placement: Pe,
68695
+ quickActions: O ? b : [],
68696
+ onClickQuickAction: be,
68684
68697
  onMessages: (e) => {
68685
- a(e), me(!0);
68698
+ a(e), ve(!0);
68686
68699
  },
68687
68700
  sendMessage: (e) => {
68688
- o(e), me(!0);
68701
+ o(e), ve(!0);
68689
68702
  },
68690
68703
  onClickCall: () => {
68691
- m || me(!0), p();
68704
+ m || ve(!0), p();
68692
68705
  },
68693
68706
  callIsConnected: m,
68694
68707
  callIsConnecting: h
@@ -93,6 +93,18 @@ export type InstanceOptions = {
93
93
  export type InstanceConfig = {
94
94
  target?: string;
95
95
  displayMode?: DisplayMode;
96
+ position?: {
97
+ x?: "left" | "center" | "right";
98
+ y?: "top" | "center" | "bottom";
99
+ z?: number;
100
+ };
101
+ style?: {
102
+ top?: string;
103
+ right?: string;
104
+ bottom?: string;
105
+ left?: string;
106
+ zIndex?: number;
107
+ };
96
108
  isOpen?: boolean;
97
109
  options?: InstanceOptions;
98
110
  isMaximized?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tellyouai/plugin",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Framework-agnostic browser SDK for the Tellyou AI plugin",
5
5
  "repository": {
6
6
  "type": "git",