@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 +24 -0
- package/dist/package/index.js +147 -134
- package/dist/package/public.d.ts +12 -0
- package/package.json +1 -1
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
|
package/dist/package/index.js
CHANGED
|
@@ -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,
|
|
67023
|
-
let [
|
|
67024
|
-
let e =
|
|
67025
|
-
return [
|
|
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
|
-
|
|
67028
|
-
|
|
67029
|
-
|
|
67030
|
-
]), [
|
|
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 = () =>
|
|
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 (
|
|
67036
|
-
|
|
67035
|
+
if (ce.length <= 1 || de) {
|
|
67036
|
+
ue("");
|
|
67037
67037
|
return;
|
|
67038
67038
|
}
|
|
67039
|
-
let e = JV[
|
|
67040
|
-
let o =
|
|
67041
|
-
if (
|
|
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) %
|
|
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
|
-
|
|
67060
|
-
|
|
67061
|
-
|
|
67059
|
+
ce,
|
|
67060
|
+
de,
|
|
67061
|
+
re
|
|
67062
67062
|
]);
|
|
67063
|
-
let
|
|
67063
|
+
let pe = ce.length <= 1 || de ? ce[0] ?? "" : le;
|
|
67064
67064
|
return /* @__PURE__ */ (0, qV.jsxs)("div", {
|
|
67065
67065
|
style: {
|
|
67066
|
-
zIndex:
|
|
67067
|
-
|
|
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"} - ${
|
|
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 &&
|
|
67076
|
-
let n = e.strings._ || e.strings[
|
|
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: () =>
|
|
67077
|
+
onClick: () => c?.(n, e.context),
|
|
67080
67078
|
style: {
|
|
67081
|
-
position:
|
|
67079
|
+
position: M ? "static" : "absolute",
|
|
67082
67080
|
bottom: `${t * 40 + 2}px`,
|
|
67083
67081
|
left: 0,
|
|
67084
|
-
zIndex:
|
|
67082
|
+
zIndex: a,
|
|
67085
67083
|
whiteSpace: "nowrap",
|
|
67086
67084
|
height: "36px",
|
|
67087
|
-
borderRadius:
|
|
67085
|
+
borderRadius: te,
|
|
67088
67086
|
fontWeight: "inherit",
|
|
67089
67087
|
fontSize: 14,
|
|
67090
67088
|
padding: "12px 12px",
|
|
67091
67089
|
marginBottom: "8px",
|
|
67092
|
-
opacity: +!!
|
|
67093
|
-
visibility:
|
|
67094
|
-
pointerEvents:
|
|
67095
|
-
transform:
|
|
67096
|
-
transition: "all " +
|
|
67097
|
-
boxShadow:
|
|
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:
|
|
67104
|
-
onMessages:
|
|
67105
|
-
sendMessage:
|
|
67106
|
-
userMessages:
|
|
67101
|
+
placeholder: pe,
|
|
67102
|
+
onMessages: l,
|
|
67103
|
+
sendMessage: u,
|
|
67104
|
+
userMessages: f,
|
|
67107
67105
|
onClick: () => {
|
|
67108
|
-
|
|
67106
|
+
d && !n && r?.();
|
|
67109
67107
|
},
|
|
67110
67108
|
style: {
|
|
67111
|
-
borderRadius:
|
|
67109
|
+
borderRadius: te,
|
|
67112
67110
|
padding: "1px",
|
|
67113
|
-
backgroundImage:
|
|
67114
|
-
boxShadow:
|
|
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:
|
|
67118
|
-
borderRadius:
|
|
67115
|
+
background: O,
|
|
67116
|
+
borderRadius: te
|
|
67119
67117
|
},
|
|
67120
67118
|
inputStyle: {
|
|
67121
|
-
width: e === "input" ?
|
|
67119
|
+
width: e === "input" ? M || n ? "calc(560px)" : "calc(400px)" : void 0,
|
|
67122
67120
|
maxWidth: "100%",
|
|
67123
|
-
transition: "width " +
|
|
67124
|
-
borderRadius:
|
|
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
|
-
|
|
67129
|
+
N(!0);
|
|
67132
67130
|
},
|
|
67133
67131
|
onBlur: (e) => {
|
|
67134
|
-
e.relatedTarget?.classList?.contains("tellyouai-quick-action-button") ||
|
|
67132
|
+
e.relatedTarget?.classList?.contains("tellyouai-quick-action-button") || N(!1);
|
|
67135
67133
|
},
|
|
67136
67134
|
withEmoji: !1,
|
|
67137
|
-
withFiles: n ||
|
|
67138
|
-
withVoice:
|
|
67139
|
-
onClickCall:
|
|
67140
|
-
callIsConnected:
|
|
67141
|
-
callIsConnecting:
|
|
67142
|
-
})] }), e === "button" && /* @__PURE__ */ (0, qV.jsxs)(qV.Fragment, { children: [!n &&
|
|
67143
|
-
let n = e.strings._ || e.strings[
|
|
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: () =>
|
|
67144
|
+
onClick: () => c?.(n, e.context),
|
|
67147
67145
|
style: {
|
|
67148
67146
|
position: "absolute",
|
|
67149
67147
|
bottom: `${t * 40 + 2}px`,
|
|
67150
|
-
right: `calc(${
|
|
67151
|
-
zIndex:
|
|
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:
|
|
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: () =>
|
|
67164
|
-
onPointerLeave: () =>
|
|
67165
|
-
onFocus: () =>
|
|
67166
|
-
onBlur: () =>
|
|
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:
|
|
67172
|
-
height:
|
|
67169
|
+
width: S,
|
|
67170
|
+
height: S,
|
|
67173
67171
|
boxSizing: "border-box",
|
|
67174
|
-
padding:
|
|
67175
|
-
border: `0.5px solid ${
|
|
67172
|
+
padding: I ? "" : 11.9,
|
|
67173
|
+
border: `0.5px solid ${k}`,
|
|
67176
67174
|
borderRadius: "100%",
|
|
67177
|
-
backgroundColor: t ? "transparent" : n ||
|
|
67178
|
-
color: n ?
|
|
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:
|
|
67181
|
-
transition: "all " +
|
|
67178
|
+
boxShadow: ee,
|
|
67179
|
+
transition: "all " + w,
|
|
67182
67180
|
opacity: +!t,
|
|
67183
|
-
scale:
|
|
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
|
-
}) :
|
|
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:
|
|
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:
|
|
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:
|
|
68564
|
-
|
|
68565
|
-
}, [
|
|
68566
|
-
|
|
68567
|
-
}, [
|
|
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 !==
|
|
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
|
-
|
|
68579
|
-
|
|
68576
|
+
I,
|
|
68577
|
+
ve
|
|
68580
68578
|
]), (0, Pq.useEffect)(() => {
|
|
68581
|
-
if (
|
|
68582
|
-
|
|
68579
|
+
if (fe && !R.current) {
|
|
68580
|
+
_e.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
68583
68581
|
let e = requestAnimationFrame(() => {
|
|
68584
|
-
(
|
|
68582
|
+
(ge.current?.querySelector("textarea, input:not([type=\"hidden\"]), select, button, a[href], [tabindex]:not([tabindex=\"-1\"])") ?? ge.current)?.focus();
|
|
68585
68583
|
});
|
|
68586
|
-
return
|
|
68587
|
-
}
|
|
68588
|
-
!
|
|
68589
|
-
}, [
|
|
68590
|
-
let
|
|
68591
|
-
|
|
68592
|
-
},
|
|
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:
|
|
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(),
|
|
68609
|
+
e.key === "Escape" && (e.stopPropagation(), ve(!1));
|
|
68600
68610
|
},
|
|
68601
68611
|
style: {
|
|
68602
|
-
position:
|
|
68603
|
-
zIndex:
|
|
68604
|
-
transform: `translate(${
|
|
68605
|
-
bottom:
|
|
68606
|
-
right:
|
|
68607
|
-
|
|
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% - ${
|
|
68611
|
-
height:
|
|
68612
|
-
maxWidth:
|
|
68613
|
-
maxHeight:
|
|
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:
|
|
68616
|
-
opacity:
|
|
68617
|
-
translate:
|
|
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 ${
|
|
68621
|
-
borderRadius:
|
|
68622
|
-
boxShadow:
|
|
68623
|
-
transition: "all " +
|
|
68624
|
-
color:
|
|
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: () =>
|
|
68632
|
-
maximized:
|
|
68633
|
-
onClose: () =>
|
|
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:
|
|
68643
|
-
paddingBottom:
|
|
68653
|
+
color: He ? Ve : void 0,
|
|
68654
|
+
paddingBottom: j,
|
|
68644
68655
|
width: "100%",
|
|
68645
68656
|
textAlign: "center",
|
|
68646
|
-
borderBottomLeftRadius:
|
|
68647
|
-
borderBottomRightRadius:
|
|
68657
|
+
borderBottomLeftRadius: De,
|
|
68658
|
+
borderBottomRightRadius: De
|
|
68648
68659
|
},
|
|
68649
68660
|
children: /* @__PURE__ */ (0, Fq.jsx)("span", {
|
|
68650
68661
|
style: { fontSize: "0.7em" },
|
|
68651
|
-
children:
|
|
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:
|
|
68674
|
-
isLoading:
|
|
68675
|
-
isOpen:
|
|
68684
|
+
type: Oe,
|
|
68685
|
+
isLoading: E,
|
|
68686
|
+
isOpen: fe,
|
|
68676
68687
|
onClickButton: () => {
|
|
68677
|
-
|
|
68688
|
+
ve(!fe);
|
|
68678
68689
|
},
|
|
68679
68690
|
hasChatUserMessages: l,
|
|
68680
68691
|
userMessages: u,
|
|
68681
|
-
isCustomTarget:
|
|
68682
|
-
|
|
68683
|
-
|
|
68692
|
+
isCustomTarget: se,
|
|
68693
|
+
zIndex: he,
|
|
68694
|
+
placement: Pe,
|
|
68695
|
+
quickActions: O ? b : [],
|
|
68696
|
+
onClickQuickAction: be,
|
|
68684
68697
|
onMessages: (e) => {
|
|
68685
|
-
a(e),
|
|
68698
|
+
a(e), ve(!0);
|
|
68686
68699
|
},
|
|
68687
68700
|
sendMessage: (e) => {
|
|
68688
|
-
o(e),
|
|
68701
|
+
o(e), ve(!0);
|
|
68689
68702
|
},
|
|
68690
68703
|
onClickCall: () => {
|
|
68691
|
-
m ||
|
|
68704
|
+
m || ve(!0), p();
|
|
68692
68705
|
},
|
|
68693
68706
|
callIsConnected: m,
|
|
68694
68707
|
callIsConnecting: h
|
package/dist/package/public.d.ts
CHANGED
|
@@ -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;
|