@tellyouai/plugin 0.1.7 → 0.1.9

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 `bar` popup follows configured launcher placement; without an override it
110
+ keeps its centered layout. The modal-style `overlay` popup retains its preset
111
+ layout. `style.zIndex` takes precedence over `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,96 @@ 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 === null ? void 0 : {
68562
+ ...w,
68563
+ ...oe.position
68564
+ }, me = oe.style === void 0 ? T : oe.style === null ? void 0 : {
68565
+ ...T,
68566
+ ...oe.style
68567
+ }, 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) => {
68568
+ de(e), le({ isOpen: e }), c?.(e);
68569
+ }, [le, c]), ye = (0, Pq.useCallback)((e) => {
68570
+ le({ isMaximized: e });
68571
+ }, [le]);
68568
68572
  (0, Pq.useEffect)(() => {
68569
68573
  let e = (e) => {
68570
68574
  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));
68575
+ t && t !== I || n !== void 0 && (console.log("tellyouai open event", t, n), ve(n));
68572
68576
  };
68573
68577
  return window.addEventListener("tellyouai-plugin", e), () => {
68574
68578
  window.removeEventListener("tellyouai-plugin", e);
68575
68579
  };
68576
68580
  }, [
68577
68581
  t,
68578
- ae,
68579
- me
68582
+ I,
68583
+ ve
68580
68584
  ]), (0, Pq.useEffect)(() => {
68581
- if (ue && !L.current) {
68582
- pe.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
68585
+ if (fe && !R.current) {
68586
+ _e.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
68583
68587
  let e = requestAnimationFrame(() => {
68584
- (fe.current?.querySelector("textarea, input:not([type=\"hidden\"]), select, button, a[href], [tabindex]:not([tabindex=\"-1\"])") ?? fe.current)?.focus();
68588
+ (ge.current?.querySelector("textarea, input:not([type=\"hidden\"]), select, button, a[href], [tabindex]:not([tabindex=\"-1\"])") ?? ge.current)?.focus();
68585
68589
  });
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;
68590
+ return R.current = !0, () => cancelAnimationFrame(e);
68591
+ }
68592
+ !fe && R.current && (_e.current?.focus(), _e.current = null, R.current = !1);
68593
+ }, [fe]);
68594
+ let be = (e, t) => {
68595
+ ve(!0), r(e, t);
68596
+ }, 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 = {
68597
+ left: Me ? ke?.left : Ae === "left" ? N : Ae === "center" ? "50%" : void 0,
68598
+ right: Me ? ke?.right : Ae === "right" ? N : void 0,
68599
+ top: Ne ? ke?.top : je === "top" ? P : je === "center" ? "50%" : void 0,
68600
+ bottom: Ne ? ke?.bottom : je === "bottom" ? P : void 0,
68601
+ transform: `translate(${!Me && Ae === "center" ? "-50%" : "0"}, ${!Ne && je === "center" ? "-50%" : "0"})`
68602
+ }, Fe = Pe.top !== void 0 && Pe.top !== "auto", Ie = Oe === "input" ? "64px" : `calc(${F} + ${M})`, Le = Fe ? `calc(${Pe.top} + ${Ie})` : void 0, Re = Fe ? void 0 : Pe.bottom !== void 0 && Pe.bottom !== "auto" ? `calc(${Pe.bottom} + ${Ie})` : Ee, ze = {
68603
+ top: Le,
68604
+ bottom: Re,
68605
+ left: Pe.left,
68606
+ right: Pe.right,
68607
+ transform: `translate(${!Me && Ae === "center" ? "-50%" : "0"}, 0)`
68608
+ }, Be = !xe && !Se || Oe === "input" && (L?.x !== void 0 || L?.y !== void 0 || Me || Ne), Ve = Be ? Le ?? Re ?? Ee : Ee, He = dH(ee, ae, "bottom"), Ue = uH(t, d, ee), We = d === "text" && S !== !0;
68593
68609
  return /* @__PURE__ */ (0, Fq.jsxs)(Fq.Fragment, { children: [/* @__PURE__ */ (0, Fq.jsxs)("div", {
68594
- ref: fe,
68610
+ ref: ge,
68595
68611
  role: "dialog",
68596
68612
  "aria-label": g({ id: "chat-with-me" }),
68597
68613
  tabIndex: -1,
68598
68614
  onKeyDown: (e) => {
68599
- e.key === "Escape" && (e.stopPropagation(), me(!1));
68615
+ e.key === "Escape" && (e.stopPropagation(), ve(!1));
68600
68616
  },
68601
68617
  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,
68618
+ position: se ? "absolute" : "fixed",
68619
+ zIndex: he + 1,
68620
+ transform: `translate(${xe ? "50%" : "0"}, ${Se ? "50%" : "0"})`,
68621
+ bottom: Ee,
68622
+ right: Te,
68623
+ ...Be ? ze : {},
68624
+ backgroundColor: A,
68608
68625
  backdropFilter: "blur(48px)",
68609
68626
  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})`,
68627
+ width: `min(calc(100% - ${N} - ${N}), ${Ce})`,
68628
+ height: Se ? "80dvh" : `min(calc(100dvh - ${P} - ${Ve}), ${we})`,
68629
+ maxWidth: xe ? "1000px" : void 0,
68630
+ maxHeight: Se ? "1000px" : `calc(100dvh - ${Ve} - ${M})`,
68614
68631
  display: "flex",
68615
- visibility: ue ? "visible" : "hidden",
68616
- opacity: ue ? "1" : "0",
68617
- translate: ue ? "0 0" : "0 100%",
68632
+ visibility: fe ? "visible" : "hidden",
68633
+ opacity: fe ? "1" : "0",
68634
+ translate: fe ? "0 0" : "0 100%",
68618
68635
  flexDirection: "column",
68619
68636
  alignItems: "center",
68620
- border: `0.5px solid ${ee}`,
68621
- borderRadius: Se,
68622
- boxShadow: ne,
68623
- transition: "all " + P,
68624
- color: O,
68637
+ border: `0.5px solid ${te}`,
68638
+ borderRadius: De,
68639
+ boxShadow: ie,
68640
+ transition: "all " + ne,
68641
+ color: k,
68625
68642
  fontSize: `${14 + (n - 1)}px`,
68626
68643
  lineHeight: `${(14 + (n - 1)) * 1.7}px`
68627
68644
  },
68628
68645
  children: [/* @__PURE__ */ (0, Fq.jsx)(jq.Provider, {
68629
68646
  value: {
68630
68647
  onClickDisplaySize: i,
68631
- onChangeDisplayMode: () => he(!de),
68632
- maximized: de,
68633
- onClose: () => me(!ue),
68648
+ onChangeDisplayMode: () => ye(!pe),
68649
+ maximized: pe,
68650
+ onClose: () => ve(!fe),
68634
68651
  onClickNewChat: f,
68635
68652
  withLocale: x
68636
68653
  },
@@ -68639,16 +68656,16 @@ var rV, iV, Bpe = o((() => {
68639
68656
  style: {
68640
68657
  opacity: "0.5",
68641
68658
  flexShrink: 0,
68642
- color: Te ? we : void 0,
68643
- paddingBottom: te,
68659
+ color: Ue ? He : void 0,
68660
+ paddingBottom: j,
68644
68661
  width: "100%",
68645
68662
  textAlign: "center",
68646
- borderBottomLeftRadius: Se,
68647
- borderBottomRightRadius: Se
68663
+ borderBottomLeftRadius: De,
68664
+ borderBottomRightRadius: De
68648
68665
  },
68649
68666
  children: /* @__PURE__ */ (0, Fq.jsx)("span", {
68650
68667
  style: { fontSize: "0.7em" },
68651
- children: Ee ? g({ id: "chat-privacy-notice" }, { 0: C ? /* @__PURE__ */ (0, Fq.jsx)(mH, {
68668
+ children: We ? g({ id: "chat-privacy-notice" }, { 0: C ? /* @__PURE__ */ (0, Fq.jsx)(mH, {
68652
68669
  href: C,
68653
68670
  target: "_blank",
68654
68671
  rel: "noopener noreferrer",
@@ -68670,25 +68687,27 @@ var rV, iV, Bpe = o((() => {
68670
68687
  })
68671
68688
  })]
68672
68689
  }), /* @__PURE__ */ (0, Fq.jsx)(YV, {
68673
- type: Ce,
68674
- isLoading: w,
68675
- isOpen: ue,
68690
+ type: Oe,
68691
+ isLoading: E,
68692
+ isOpen: fe,
68676
68693
  onClickButton: () => {
68677
- me(!ue);
68694
+ ve(!fe);
68678
68695
  },
68679
68696
  hasChatUserMessages: l,
68680
68697
  userMessages: u,
68681
- isCustomTarget: oe,
68682
- quickActions: E ? b : [],
68683
- onClickQuickAction: ge,
68698
+ isCustomTarget: se,
68699
+ zIndex: he,
68700
+ placement: Pe,
68701
+ quickActions: O ? b : [],
68702
+ onClickQuickAction: be,
68684
68703
  onMessages: (e) => {
68685
- a(e), me(!0);
68704
+ a(e), ve(!0);
68686
68705
  },
68687
68706
  sendMessage: (e) => {
68688
- o(e), me(!0);
68707
+ o(e), ve(!0);
68689
68708
  },
68690
68709
  onClickCall: () => {
68691
- m || me(!0), p();
68710
+ m || ve(!0), p();
68692
68711
  },
68693
68712
  callIsConnected: m,
68694
68713
  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.9",
4
4
  "description": "Framework-agnostic browser SDK for the Tellyou AI plugin",
5
5
  "repository": {
6
6
  "type": "git",