@_solaris/messenger-widget 0.6.24 → 0.6.26
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/dist/iframe/iframe.css +1 -1
- package/dist/iframe/iframe.js +5 -5
- package/dist/messenger.cjs +1 -1
- package/dist/messenger.js +50 -48
- package/dist/snippet.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/messenger.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { reactive as We, openBlock as c, createElementBlock as d, normalizeStyle as N, normalizeClass as R, toDisplayString as y, resolveComponent as P, createVNode as
|
|
1
|
+
import { reactive as We, openBlock as c, createElementBlock as d, normalizeStyle as N, normalizeClass as R, toDisplayString as y, resolveComponent as P, createVNode as W, Transition as Ae, withCtx as Se, Fragment as B, renderList as D, withKeys as _e, withModifiers as K, createElementVNode as l, createCommentVNode as b, createBlock as E, resolveDynamicComponent as Te, mergeProps as je, withDirectives as G, vModelText as ee, createTextVNode as Me, renderSlot as $e, vModelCheckbox as Ge, vModelSelect as Ye, markRaw as Ie } from "vue";
|
|
2
2
|
const Je = [
|
|
3
3
|
"connected",
|
|
4
4
|
"message",
|
|
@@ -112,10 +112,10 @@ function tt(e) {
|
|
|
112
112
|
}
|
|
113
113
|
);
|
|
114
114
|
if (!g.ok) {
|
|
115
|
-
const
|
|
116
|
-
`Session bootstrap failed: HTTP ${g.status} :: ${(
|
|
115
|
+
const $ = await o(g), ne = new Error(
|
|
116
|
+
`Session bootstrap failed: HTTP ${g.status} :: ${($ == null ? void 0 : $.error) || g.statusText}`
|
|
117
117
|
);
|
|
118
|
-
throw ne.status = g.status, ne.body =
|
|
118
|
+
throw ne.status = g.status, ne.body = $, ne;
|
|
119
119
|
}
|
|
120
120
|
const p = await g.json();
|
|
121
121
|
t.userId = p.external_id;
|
|
@@ -123,14 +123,14 @@ function tt(e) {
|
|
|
123
123
|
fetch(
|
|
124
124
|
`${t.baseUrl}/widgets/${encodeURIComponent(t.widgetId)}/config`,
|
|
125
125
|
{ credentials: "include" }
|
|
126
|
-
).then(async (
|
|
127
|
-
if (
|
|
128
|
-
const ne = await o(
|
|
126
|
+
).then(async ($) => {
|
|
127
|
+
if (!$.ok) {
|
|
128
|
+
const ne = await o($);
|
|
129
129
|
throw new Error(
|
|
130
|
-
`HTTP ${
|
|
130
|
+
`HTTP ${$.status} GET /widgets/:id/config :: ${(ne == null ? void 0 : ne.error) || $.statusText}`
|
|
131
131
|
);
|
|
132
132
|
}
|
|
133
|
-
return
|
|
133
|
+
return $.json();
|
|
134
134
|
}),
|
|
135
135
|
a("GET", "/customers/me")
|
|
136
136
|
]), V = { config: L, customer: (O == null ? void 0 : O.customer) ?? null };
|
|
@@ -1894,7 +1894,7 @@ function zt(e, t, s, r, i, n) {
|
|
|
1894
1894
|
onFocusin: t[3] || (t[3] = (o) => e.$emit("hover", !0)),
|
|
1895
1895
|
onFocusout: t[4] || (t[4] = (o) => e.$emit("hover", !1))
|
|
1896
1896
|
}, [
|
|
1897
|
-
|
|
1897
|
+
W(Ae, { name: "wm-peek" }, {
|
|
1898
1898
|
default: Se(() => [
|
|
1899
1899
|
n.visiblePeeks.length ? (c(), d("div", {
|
|
1900
1900
|
key: 0,
|
|
@@ -1914,15 +1914,15 @@ function zt(e, t, s, r, i, n) {
|
|
|
1914
1914
|
}),
|
|
1915
1915
|
onClick: (k) => e.$emit("open", o.convId),
|
|
1916
1916
|
onKeydown: [
|
|
1917
|
-
_e(
|
|
1918
|
-
_e(
|
|
1917
|
+
_e(K((k) => e.$emit("open", o.convId), ["prevent"]), ["enter"]),
|
|
1918
|
+
_e(K((k) => e.$emit("open", o.convId), ["prevent"]), ["space"])
|
|
1919
1919
|
]
|
|
1920
1920
|
}, [
|
|
1921
1921
|
l("button", {
|
|
1922
1922
|
type: "button",
|
|
1923
1923
|
class: "wm-peek__close",
|
|
1924
1924
|
"aria-label": n.t("launcher.dismiss"),
|
|
1925
|
-
onClick:
|
|
1925
|
+
onClick: K((k) => e.$emit("dismiss", o.convId), ["stop"])
|
|
1926
1926
|
}, [...t[5] || (t[5] = [
|
|
1927
1927
|
l("svg", {
|
|
1928
1928
|
width: "9",
|
|
@@ -1939,7 +1939,7 @@ function zt(e, t, s, r, i, n) {
|
|
|
1939
1939
|
], -1)
|
|
1940
1940
|
])], 8, Lt),
|
|
1941
1941
|
l("div", It, [
|
|
1942
|
-
|
|
1942
|
+
W(a, {
|
|
1943
1943
|
name: o.senderName,
|
|
1944
1944
|
"avatar-url": o.senderAvatarUrl,
|
|
1945
1945
|
size: 34
|
|
@@ -1960,7 +1960,7 @@ function zt(e, t, s, r, i, n) {
|
|
|
1960
1960
|
l("button", {
|
|
1961
1961
|
type: "button",
|
|
1962
1962
|
class: "wm-peek__open",
|
|
1963
|
-
onClick:
|
|
1963
|
+
onClick: K((k) => e.$emit("open", o.convId), ["stop"])
|
|
1964
1964
|
}, y(n.t("common.open")), 9, Nt)
|
|
1965
1965
|
], 44, Rt))), 128))
|
|
1966
1966
|
], 2)) : b("", !0)
|
|
@@ -2215,7 +2215,7 @@ function fn(e, t, s, r, i, n) {
|
|
|
2215
2215
|
])], 8, rn)) : (c(), d("div", an)),
|
|
2216
2216
|
s.showIdentity ? (c(), d(B, { key: 2 }, [
|
|
2217
2217
|
l("div", on, [
|
|
2218
|
-
|
|
2218
|
+
W(a, {
|
|
2219
2219
|
size: 30,
|
|
2220
2220
|
name: s.agentName,
|
|
2221
2221
|
"image-url": s.agentAvatarUrl
|
|
@@ -2651,7 +2651,7 @@ function Zn(e, t, s, r, i, n) {
|
|
|
2651
2651
|
opacity: "0.65"
|
|
2652
2652
|
}, null, -1)
|
|
2653
2653
|
])])),
|
|
2654
|
-
|
|
2654
|
+
W(a, {
|
|
2655
2655
|
size: 52,
|
|
2656
2656
|
"image-url": s.defaultIconUrl
|
|
2657
2657
|
}, null, 8, ["image-url"]),
|
|
@@ -2773,9 +2773,9 @@ function Zn(e, t, s, r, i, n) {
|
|
|
2773
2773
|
"is-expanded": i.inputFocused,
|
|
2774
2774
|
"wm-onb__starter--toBottom": i.launchPhase === "slide"
|
|
2775
2775
|
}]),
|
|
2776
|
-
onSubmit: t[6] || (t[6] =
|
|
2776
|
+
onSubmit: t[6] || (t[6] = K((...o) => n.submitStarter && n.submitStarter(...o), ["prevent"]))
|
|
2777
2777
|
}, [
|
|
2778
|
-
|
|
2778
|
+
G(l("textarea", {
|
|
2779
2779
|
ref: "starterInput",
|
|
2780
2780
|
"onUpdate:modelValue": t[1] || (t[1] = (o) => i.starterText = o),
|
|
2781
2781
|
class: "wm-onb__starter-input",
|
|
@@ -2805,7 +2805,7 @@ function Zn(e, t, s, r, i, n) {
|
|
|
2805
2805
|
])
|
|
2806
2806
|
], 2);
|
|
2807
2807
|
}
|
|
2808
|
-
const es = /* @__PURE__ */ F(gn, [["render", Zn], ["__scopeId", "data-v-
|
|
2808
|
+
const es = /* @__PURE__ */ F(gn, [["render", Zn], ["__scopeId", "data-v-cfaffcfa"]]), ts = {
|
|
2809
2809
|
name: "WmHistory",
|
|
2810
2810
|
components: { AIAvatar: me, HumanAvatar: ye },
|
|
2811
2811
|
inject: {
|
|
@@ -2902,7 +2902,7 @@ function _s(e, t, s, r, i, n) {
|
|
|
2902
2902
|
l("path", { d: "M21 21l-4.35-4.35M11 17a6 6 0 100-12 6 6 0 000 12z" })
|
|
2903
2903
|
])
|
|
2904
2904
|
], -1)),
|
|
2905
|
-
|
|
2905
|
+
G(l("input", {
|
|
2906
2906
|
"onUpdate:modelValue": t[0] || (t[0] = (a) => i.query = a),
|
|
2907
2907
|
type: "text",
|
|
2908
2908
|
placeholder: n.t("onboarding.search"),
|
|
@@ -4295,7 +4295,7 @@ function oi(e, t, s, r, i, n) {
|
|
|
4295
4295
|
onPointerup: t[0] || (t[0] = (x) => n.onPressEnd()),
|
|
4296
4296
|
onPointercancel: t[1] || (t[1] = (x) => n.onPressEnd()),
|
|
4297
4297
|
onPointerleave: t[2] || (t[2] = (x) => n.onPressEnd()),
|
|
4298
|
-
onContextmenu: t[3] || (t[3] =
|
|
4298
|
+
onContextmenu: t[3] || (t[3] = K(() => {
|
|
4299
4299
|
}, ["prevent"]))
|
|
4300
4300
|
}, [
|
|
4301
4301
|
S.role !== "user" ? (c(), d("div", Xr, [
|
|
@@ -4392,17 +4392,17 @@ function oi(e, t, s, r, i, n) {
|
|
|
4392
4392
|
], 64))), 128)),
|
|
4393
4393
|
s.streamingActive ? (c(), d("div", ri, [
|
|
4394
4394
|
l("div", ii, [
|
|
4395
|
-
|
|
4395
|
+
W(a, {
|
|
4396
4396
|
size: 26,
|
|
4397
4397
|
tail: !0,
|
|
4398
4398
|
name: s.aiAgentName,
|
|
4399
4399
|
"image-url": s.aiAgentAvatarUrl
|
|
4400
4400
|
}, null, 8, ["name", "image-url"])
|
|
4401
4401
|
]),
|
|
4402
|
-
|
|
4402
|
+
W(I)
|
|
4403
4403
|
])) : b("", !0)
|
|
4404
4404
|
], 34),
|
|
4405
|
-
|
|
4405
|
+
W(Ae, { name: "wm-scrollDown" }, {
|
|
4406
4406
|
default: Se(() => [
|
|
4407
4407
|
i.showScrollDown ? (c(), d("button", {
|
|
4408
4408
|
key: 0,
|
|
@@ -4765,7 +4765,7 @@ function Ti(e, t, s, r, i, n) {
|
|
|
4765
4765
|
style: N(i.kbOffset ? { transform: `translateY(-${i.kbOffset}px)` } : null)
|
|
4766
4766
|
}, [
|
|
4767
4767
|
i.recording ? (c(), d("div", _i, [
|
|
4768
|
-
t[
|
|
4768
|
+
t[11] || (t[11] = l("span", {
|
|
4769
4769
|
class: "wm-rec__dot",
|
|
4770
4770
|
"aria-hidden": "true"
|
|
4771
4771
|
}, null, -1)),
|
|
@@ -4778,7 +4778,7 @@ function Ti(e, t, s, r, i, n) {
|
|
|
4778
4778
|
])) : b("", !0),
|
|
4779
4779
|
l("form", {
|
|
4780
4780
|
class: R(["wm-compose", { "has-attach": i.attachOpen, "is-expanded": n.expanded }]),
|
|
4781
|
-
onSubmit: t[
|
|
4781
|
+
onSubmit: t[10] || (t[10] = K((...a) => n.onSubmit && n.onSubmit(...a), ["prevent"]))
|
|
4782
4782
|
}, [
|
|
4783
4783
|
l("input", {
|
|
4784
4784
|
ref: "fileEl",
|
|
@@ -4815,7 +4815,7 @@ function Ti(e, t, s, r, i, n) {
|
|
|
4815
4815
|
l("span", null, y(a.label), 1)
|
|
4816
4816
|
], 8, vi))), 128))
|
|
4817
4817
|
])) : b("", !0),
|
|
4818
|
-
|
|
4818
|
+
G(l("textarea", {
|
|
4819
4819
|
ref: "inputEl",
|
|
4820
4820
|
"onUpdate:modelValue": t[3] || (t[3] = (a) => i.local = a),
|
|
4821
4821
|
class: "wm-compose__input",
|
|
@@ -4836,8 +4836,10 @@ function Ti(e, t, s, r, i, n) {
|
|
|
4836
4836
|
title: s.attachLabel,
|
|
4837
4837
|
"aria-label": s.attachLabel,
|
|
4838
4838
|
disabled: i.recording,
|
|
4839
|
-
|
|
4840
|
-
|
|
4839
|
+
onMousedown: t[8] || (t[8] = K(() => {
|
|
4840
|
+
}, ["prevent"])),
|
|
4841
|
+
onClick: t[9] || (t[9] = (a) => i.attachOpen = !i.attachOpen)
|
|
4842
|
+
}, [...t[12] || (t[12] = [
|
|
4841
4843
|
l("svg", {
|
|
4842
4844
|
width: "13",
|
|
4843
4845
|
height: "13",
|
|
@@ -4851,13 +4853,13 @@ function Ti(e, t, s, r, i, n) {
|
|
|
4851
4853
|
}, [
|
|
4852
4854
|
l("path", { d: "M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48" })
|
|
4853
4855
|
], -1)
|
|
4854
|
-
])],
|
|
4856
|
+
])], 42, Ai),
|
|
4855
4857
|
l("button", {
|
|
4856
4858
|
type: "submit",
|
|
4857
4859
|
class: R(["wm-compose__send", { "is-empty": !n.canSend }]),
|
|
4858
4860
|
disabled: !n.canSend,
|
|
4859
4861
|
"aria-label": n.t("composer.send")
|
|
4860
|
-
}, [...t[
|
|
4862
|
+
}, [...t[13] || (t[13] = [
|
|
4861
4863
|
l("svg", {
|
|
4862
4864
|
width: "16",
|
|
4863
4865
|
height: "16",
|
|
@@ -4876,7 +4878,7 @@ function Ti(e, t, s, r, i, n) {
|
|
|
4876
4878
|
], 34)
|
|
4877
4879
|
], 6);
|
|
4878
4880
|
}
|
|
4879
|
-
const Mi = /* @__PURE__ */ F(fi, [["render", Ti], ["__scopeId", "data-v-
|
|
4881
|
+
const Mi = /* @__PURE__ */ F(fi, [["render", Ti], ["__scopeId", "data-v-a9738520"]]), xi = {
|
|
4880
4882
|
name: "WmInlineCallbacks",
|
|
4881
4883
|
props: {
|
|
4882
4884
|
// Array d'items `{ id?, label, style?, ... }`. Pour les suggestions,
|
|
@@ -5067,7 +5069,7 @@ function aa(e, t, s, r, i, n) {
|
|
|
5067
5069
|
return c(), d("div", Ui, [
|
|
5068
5070
|
l("div", Di, [
|
|
5069
5071
|
l("div", Ni, [
|
|
5070
|
-
|
|
5072
|
+
W(a, {
|
|
5071
5073
|
size: 24,
|
|
5072
5074
|
name: s.agentName,
|
|
5073
5075
|
"image-url": s.agentAvatarUrl
|
|
@@ -5080,7 +5082,7 @@ function aa(e, t, s, r, i, n) {
|
|
|
5080
5082
|
]),
|
|
5081
5083
|
l("form", {
|
|
5082
5084
|
class: "wm-form__body",
|
|
5083
|
-
onSubmit: t[0] || (t[0] =
|
|
5085
|
+
onSubmit: t[0] || (t[0] = K((...o) => n.onSubmit && n.onSubmit(...o), ["prevent"]))
|
|
5084
5086
|
}, [
|
|
5085
5087
|
(c(!0), d(B, null, D(n.normalizedFields, (o) => (c(), d("div", {
|
|
5086
5088
|
key: o.key,
|
|
@@ -5093,7 +5095,7 @@ function aa(e, t, s, r, i, n) {
|
|
|
5093
5095
|
Me(y(o.label), 1),
|
|
5094
5096
|
o.required ? (c(), d("span", Vi, "*")) : b("", !0)
|
|
5095
5097
|
], 8, qi),
|
|
5096
|
-
o.type === "text" ?
|
|
5098
|
+
o.type === "text" ? G((c(), d("input", {
|
|
5097
5099
|
key: 0,
|
|
5098
5100
|
id: `wm-f-${i._uid}-${o.key}`,
|
|
5099
5101
|
"onUpdate:modelValue": (f) => i.values[o.key] = f,
|
|
@@ -5104,7 +5106,7 @@ function aa(e, t, s, r, i, n) {
|
|
|
5104
5106
|
disabled: s.readOnly || i.busy
|
|
5105
5107
|
}, null, 8, Ki)), [
|
|
5106
5108
|
[ee, i.values[o.key]]
|
|
5107
|
-
]) : o.type === "textarea" ?
|
|
5109
|
+
]) : o.type === "textarea" ? G((c(), d("textarea", {
|
|
5108
5110
|
key: 1,
|
|
5109
5111
|
id: `wm-f-${i._uid}-${o.key}`,
|
|
5110
5112
|
"onUpdate:modelValue": (f) => i.values[o.key] = f,
|
|
@@ -5115,7 +5117,7 @@ function aa(e, t, s, r, i, n) {
|
|
|
5115
5117
|
disabled: s.readOnly || i.busy
|
|
5116
5118
|
}, null, 8, Wi)), [
|
|
5117
5119
|
[ee, i.values[o.key]]
|
|
5118
|
-
]) : o.type === "number" ?
|
|
5120
|
+
]) : o.type === "number" ? G((c(), d("input", {
|
|
5119
5121
|
key: 2,
|
|
5120
5122
|
id: `wm-f-${i._uid}-${o.key}`,
|
|
5121
5123
|
"onUpdate:modelValue": (f) => i.values[o.key] = f,
|
|
@@ -5131,7 +5133,7 @@ function aa(e, t, s, r, i, n) {
|
|
|
5131
5133
|
void 0,
|
|
5132
5134
|
{ number: !0 }
|
|
5133
5135
|
]
|
|
5134
|
-
]) : o.type === "date" ?
|
|
5136
|
+
]) : o.type === "date" ? G((c(), d("input", {
|
|
5135
5137
|
key: 3,
|
|
5136
5138
|
id: `wm-f-${i._uid}-${o.key}`,
|
|
5137
5139
|
"onUpdate:modelValue": (f) => i.values[o.key] = f,
|
|
@@ -5142,7 +5144,7 @@ function aa(e, t, s, r, i, n) {
|
|
|
5142
5144
|
}, null, 8, Gi)), [
|
|
5143
5145
|
[ee, i.values[o.key]]
|
|
5144
5146
|
]) : o.type === "boolean" ? (c(), d("label", Yi, [
|
|
5145
|
-
|
|
5147
|
+
G(l("input", {
|
|
5146
5148
|
id: `wm-f-${i._uid}-${o.key}`,
|
|
5147
5149
|
"onUpdate:modelValue": (f) => i.values[o.key] = f,
|
|
5148
5150
|
type: "checkbox",
|
|
@@ -5151,7 +5153,7 @@ function aa(e, t, s, r, i, n) {
|
|
|
5151
5153
|
[Ge, i.values[o.key]]
|
|
5152
5154
|
]),
|
|
5153
5155
|
l("span", null, y(o.placeholder || n.t("common.yes")), 1)
|
|
5154
|
-
])) : o.type === "select" ?
|
|
5156
|
+
])) : o.type === "select" ? G((c(), d("select", {
|
|
5155
5157
|
key: 5,
|
|
5156
5158
|
id: `wm-f-${i._uid}-${o.key}`,
|
|
5157
5159
|
"onUpdate:modelValue": (f) => i.values[o.key] = f,
|
|
@@ -5543,7 +5545,7 @@ function Wa(e, t, s, r, i, n) {
|
|
|
5543
5545
|
])], 8, ja)
|
|
5544
5546
|
]),
|
|
5545
5547
|
l("div", za, [
|
|
5546
|
-
|
|
5548
|
+
G(l("input", {
|
|
5547
5549
|
ref: "input",
|
|
5548
5550
|
"onUpdate:modelValue": t[2] || (t[2] = (a) => i.value = a),
|
|
5549
5551
|
type: "text",
|
|
@@ -5551,8 +5553,8 @@ function Wa(e, t, s, r, i, n) {
|
|
|
5551
5553
|
placeholder: s.placeholder || n.t("rename.placeholder"),
|
|
5552
5554
|
maxlength: 120,
|
|
5553
5555
|
onKeydown: [
|
|
5554
|
-
t[3] || (t[3] = _e(
|
|
5555
|
-
t[4] || (t[4] = _e(
|
|
5556
|
+
t[3] || (t[3] = _e(K((...a) => n.onSubmit && n.onSubmit(...a), ["prevent"]), ["enter"])),
|
|
5557
|
+
t[4] || (t[4] = _e(K((a) => e.$emit("close"), ["prevent"]), ["esc"]))
|
|
5556
5558
|
]
|
|
5557
5559
|
}, null, 40, qa), [
|
|
5558
5560
|
[ee, i.value]
|
|
@@ -6983,7 +6985,7 @@ function yo(e, t, s, r, i, n) {
|
|
|
6983
6985
|
"aria-hidden": "true"
|
|
6984
6986
|
}, null, -1))
|
|
6985
6987
|
])) : (c(), d(B, { key: 1 }, [
|
|
6986
|
-
|
|
6988
|
+
W(o, {
|
|
6987
6989
|
title: n.headerTitle,
|
|
6988
6990
|
"team-members": n.teamMembers,
|
|
6989
6991
|
"response-label": n.responseLabel,
|
|
@@ -6998,7 +7000,7 @@ function yo(e, t, s, r, i, n) {
|
|
|
6998
7000
|
onClose: n.close
|
|
6999
7001
|
}, null, 8, ["title", "team-members", "response-label", "show-identity", "show-back", "show-close", "more-active", "agent-name", "agent-avatar-url", "onBack", "onMore", "onClose"]),
|
|
7000
7002
|
l("div", Xa, [
|
|
7001
|
-
|
|
7003
|
+
W(Ae, { name: "wm-none" }, {
|
|
7002
7004
|
default: Se(() => [
|
|
7003
7005
|
n.error ? (c(), d("div", Qa, [
|
|
7004
7006
|
l("div", Za, [
|
|
@@ -7028,7 +7030,7 @@ function yo(e, t, s, r, i, n) {
|
|
|
7028
7030
|
threads: n.openThreads,
|
|
7029
7031
|
onResume: n.onDrawerPick
|
|
7030
7032
|
}, null, 8, ["threads", "onResume"])) : n.currentConv ? (c(), d("div", no, [
|
|
7031
|
-
|
|
7033
|
+
W(v, {
|
|
7032
7034
|
ref: "messageList",
|
|
7033
7035
|
messages: n.displayedMessages,
|
|
7034
7036
|
"streaming-active": n.streamingActive,
|
|
@@ -7211,7 +7213,7 @@ function yo(e, t, s, r, i, n) {
|
|
|
7211
7213
|
], 6)) : b("", !0)
|
|
7212
7214
|
], 6);
|
|
7213
7215
|
}
|
|
7214
|
-
const wo = /* @__PURE__ */ F(Ga, [["render", yo], ["__scopeId", "data-v-801581ca"]]), bo = "0.6.
|
|
7216
|
+
const wo = /* @__PURE__ */ F(Ga, [["render", yo], ["__scopeId", "data-v-801581ca"]]), bo = "0.6.26";
|
|
7215
7217
|
export {
|
|
7216
7218
|
me as AIAvatar,
|
|
7217
7219
|
be as AVATAR_COLORS,
|
package/dist/snippet.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var Messenger=function(u){"use strict";let t=null,a=null,d=null,l="",p=null,w=null,g=null;function M(e){t&&b();const n=e.widgetId||"",c=e.baseUrl||"";l=e.widgetOrigin||c;const r=e.token||"";let h=null;e.variables&&typeof e.variables=="object"?h=e.variables:e.context&&typeof e.context=="object"&&(h=e.context);const s=e.displayMode||"floating",o=e.language||"",f=e.allowUnauthenticated===!0;if(!n||!l){console.warn("[messenger] init skipped — missing widgetId or widgetOrigin");return}!f&&!r&&console.warn("[messenger] init: allowUnauthenticated=false but no token provided. In app mode you must pass a `token` (JWT linked) at every init() call. See messenger-back /auth/jwt to generate one server-side. Without a token, /session will return 403.");const m=new URL(`${U(l)}/widget/${encodeURIComponent(n)}`);s!=="floating"&&m.searchParams.set("display_mode",s),o&&m.searchParams.set("language",o),t=document.createElement("iframe"),t.src=m.toString(),t.title="Messenger",t.setAttribute("aria-label","Messenger"),t.setAttribute("allow","clipboard-write; microphone; notifications; display-capture"),t.setAttribute("data-messenger-widget",""),y(t,s,"closed"),document.body.appendChild(t),window.visualViewport&&(g=()=>{t&&w&&w.state!=="closed"&&y(t,w.displayMode,w.state,w.dims)},window.visualViewport.addEventListener("resize",g),window.visualViewport.addEventListener("scroll",g)),a=document.createElement("div"),a.setAttribute("data-messenger-shadow",""),v(a,{hidden:!0}),document.body.appendChild(a),d=document.createElement("div"),d.setAttribute("data-messenger-peek-shadow",""),x(d,{hidden:!0}),document.body.appendChild(d);let E=!1;const O=()=>{E||!t||(E=!0,t.contentWindow.postMessage({type:"INIT",origin:window.location.origin,token:r||null,variables:h||null,allowUnauthenticated:f},l))};p=I=>{if(I.origin!==l)return;const i=I.data;!i||typeof i!="object"||(i.type==="READY"?O():i.type==="RESIZE"&&t&&(y(t,i.displayMode||s,i.state,{width:i.width,height:i.height}),a&&(i.state==="closed"&&i.launcherWidth&&i.launcherHeight?v(a,{width:i.launcherWidth,height:i.launcherHeight,hovered:!!i.launcherHovered}):v(a,{hidden:!0})),d&&(i.state==="closed"&&i.peek?x(d,{...i.peek,hovered:!!i.peekHovered}):x(d,{hidden:!0}))))},window.addEventListener("message",p),t.addEventListener("load",O),setTimeout(()=>{E||console.warn("[messenger] iframe did not boot after",1e4,"ms — check CSP frame-ancestors and network")},1e4)}function b(){p&&(window.removeEventListener("message",p),p=null),g&&window.visualViewport&&(window.visualViewport.removeEventListener("resize",g),window.visualViewport.removeEventListener("scroll",g),g=null),w=null,t&&(t.remove(),t=null),a&&(a.remove(),a=null),d&&(d.remove(),d=null),l=""}function S(e){!t||!l||!e||typeof e!="object"||t.contentWindow.postMessage({type:"UPDATE",payload:e},l)}function k(e){!t||!l||!e||typeof e!="object"||t.contentWindow.postMessage({type:"CONTEXT",payload:e},l)}function v(e,n){if(n.hidden){e.style.cssText="display:none";return}const c=n.width||50,r=n.height||50,h=Math.max(20,c-6),s=Math.max(20,r-6),o=8+(c-h)/2,f=8+(r-s)/2,m=n.hovered?"0 8px 22px rgba(0, 0, 0, 0.26)":"0 4px 14px rgba(0, 0, 0, 0.18)";e.style.cssText=["position:fixed","pointer-events:none",`bottom:${f}px`,`right:${o}px`,`width:${h}px`,`height:${s}px`,"border-radius:50%","background:transparent",`box-shadow:${m}`,"transition:box-shadow 100ms ease","z-index:2147483646"].join(";")}function x(e,n){if(n.hidden){e.style.cssText="display:none";return}const c=n.width||286,r=n.height||80,h=8+(n.rightOffset||0),s=8+(n.bottomOffset||0),o=n.hovered?"0 6px 18px rgba(0, 0, 0, 0.16)":"0 3px 10px rgba(0, 0, 0, 0.10)";e.style.cssText=["position:fixed","pointer-events:none",`bottom:${s}px`,`right:${h}px`,`width:${c}px`,`height:${r}px`,"border-radius:16px 16px 8px 16px","background:transparent",`box-shadow:${o}`,"transition:box-shadow 100ms ease, width 100ms ease, height 100ms ease, right 100ms ease, bottom 100ms ease","z-index:2147483646"].join(";")}function U(e){return e.endsWith("/")?e.slice(0,-1):e}function y(e,n,c,r){w={displayMode:n,state:c,dims:r};const h=["position:fixed","border:0","z-index:2147483647","color-scheme:normal","background:transparent"];let s;if(n==="embedded")s=["inset:0","width:100%","height:100%"];else if(c==="closed"){const o=r&&r.width>0?r.width:80,f=r&&r.height>0?r.height:80;s=["bottom:0","right:0",`width:${o}px`,`height:${f}px`]}else if(n==="sheet"){const o=T();o?s=[`top:${o.top}px`,"right:0","width:min(470px, 100vw)",`height:${o.height}px`]:s=["top:0","bottom:0","right:0","width:min(470px, 100vw)","height:100dvh"]}else{const o=T();s=[`bottom:${o?o.bottom:0}px`,"right:0","width:460px","height:720px","max-width:100vw",`max-height:${o?`${o.height}px`:"100vh"}`]}e.style.cssText=h.concat(s).join(";")}function T(){const e=window.visualViewport;if(!e)return null;const n=Math.max(0,Math.round(window.innerHeight-e.height-e.offsetTop));return n<80?null:{top:Math.round(e.offsetTop),height:Math.round(e.height),bottom:n}}const $="0.6.
|
|
1
|
+
var Messenger=function(u){"use strict";let t=null,a=null,d=null,l="",p=null,w=null,g=null;function M(e){t&&b();const n=e.widgetId||"",c=e.baseUrl||"";l=e.widgetOrigin||c;const r=e.token||"";let h=null;e.variables&&typeof e.variables=="object"?h=e.variables:e.context&&typeof e.context=="object"&&(h=e.context);const s=e.displayMode||"floating",o=e.language||"",f=e.allowUnauthenticated===!0;if(!n||!l){console.warn("[messenger] init skipped — missing widgetId or widgetOrigin");return}!f&&!r&&console.warn("[messenger] init: allowUnauthenticated=false but no token provided. In app mode you must pass a `token` (JWT linked) at every init() call. See messenger-back /auth/jwt to generate one server-side. Without a token, /session will return 403.");const m=new URL(`${U(l)}/widget/${encodeURIComponent(n)}`);s!=="floating"&&m.searchParams.set("display_mode",s),o&&m.searchParams.set("language",o),t=document.createElement("iframe"),t.src=m.toString(),t.title="Messenger",t.setAttribute("aria-label","Messenger"),t.setAttribute("allow","clipboard-write; microphone; notifications; display-capture"),t.setAttribute("data-messenger-widget",""),y(t,s,"closed"),document.body.appendChild(t),window.visualViewport&&(g=()=>{t&&w&&w.state!=="closed"&&y(t,w.displayMode,w.state,w.dims)},window.visualViewport.addEventListener("resize",g),window.visualViewport.addEventListener("scroll",g)),a=document.createElement("div"),a.setAttribute("data-messenger-shadow",""),v(a,{hidden:!0}),document.body.appendChild(a),d=document.createElement("div"),d.setAttribute("data-messenger-peek-shadow",""),x(d,{hidden:!0}),document.body.appendChild(d);let E=!1;const O=()=>{E||!t||(E=!0,t.contentWindow.postMessage({type:"INIT",origin:window.location.origin,token:r||null,variables:h||null,allowUnauthenticated:f},l))};p=I=>{if(I.origin!==l)return;const i=I.data;!i||typeof i!="object"||(i.type==="READY"?O():i.type==="RESIZE"&&t&&(y(t,i.displayMode||s,i.state,{width:i.width,height:i.height}),a&&(i.state==="closed"&&i.launcherWidth&&i.launcherHeight?v(a,{width:i.launcherWidth,height:i.launcherHeight,hovered:!!i.launcherHovered}):v(a,{hidden:!0})),d&&(i.state==="closed"&&i.peek?x(d,{...i.peek,hovered:!!i.peekHovered}):x(d,{hidden:!0}))))},window.addEventListener("message",p),t.addEventListener("load",O),setTimeout(()=>{E||console.warn("[messenger] iframe did not boot after",1e4,"ms — check CSP frame-ancestors and network")},1e4)}function b(){p&&(window.removeEventListener("message",p),p=null),g&&window.visualViewport&&(window.visualViewport.removeEventListener("resize",g),window.visualViewport.removeEventListener("scroll",g),g=null),w=null,t&&(t.remove(),t=null),a&&(a.remove(),a=null),d&&(d.remove(),d=null),l=""}function S(e){!t||!l||!e||typeof e!="object"||t.contentWindow.postMessage({type:"UPDATE",payload:e},l)}function k(e){!t||!l||!e||typeof e!="object"||t.contentWindow.postMessage({type:"CONTEXT",payload:e},l)}function v(e,n){if(n.hidden){e.style.cssText="display:none";return}const c=n.width||50,r=n.height||50,h=Math.max(20,c-6),s=Math.max(20,r-6),o=8+(c-h)/2,f=8+(r-s)/2,m=n.hovered?"0 8px 22px rgba(0, 0, 0, 0.26)":"0 4px 14px rgba(0, 0, 0, 0.18)";e.style.cssText=["position:fixed","pointer-events:none",`bottom:${f}px`,`right:${o}px`,`width:${h}px`,`height:${s}px`,"border-radius:50%","background:transparent",`box-shadow:${m}`,"transition:box-shadow 100ms ease","z-index:2147483646"].join(";")}function x(e,n){if(n.hidden){e.style.cssText="display:none";return}const c=n.width||286,r=n.height||80,h=8+(n.rightOffset||0),s=8+(n.bottomOffset||0),o=n.hovered?"0 6px 18px rgba(0, 0, 0, 0.16)":"0 3px 10px rgba(0, 0, 0, 0.10)";e.style.cssText=["position:fixed","pointer-events:none",`bottom:${s}px`,`right:${h}px`,`width:${c}px`,`height:${r}px`,"border-radius:16px 16px 8px 16px","background:transparent",`box-shadow:${o}`,"transition:box-shadow 100ms ease, width 100ms ease, height 100ms ease, right 100ms ease, bottom 100ms ease","z-index:2147483646"].join(";")}function U(e){return e.endsWith("/")?e.slice(0,-1):e}function y(e,n,c,r){w={displayMode:n,state:c,dims:r};const h=["position:fixed","border:0","z-index:2147483647","color-scheme:normal","background:transparent"];let s;if(n==="embedded")s=["inset:0","width:100%","height:100%"];else if(c==="closed"){const o=r&&r.width>0?r.width:80,f=r&&r.height>0?r.height:80;s=["bottom:0","right:0",`width:${o}px`,`height:${f}px`]}else if(n==="sheet"){const o=T();o?s=[`top:${o.top}px`,"right:0","width:min(470px, 100vw)",`height:${o.height}px`]:s=["top:0","bottom:0","right:0","width:min(470px, 100vw)","height:100dvh"]}else{const o=T();s=[`bottom:${o?o.bottom:0}px`,"right:0","width:460px","height:720px","max-width:100vw",`max-height:${o?`${o.height}px`:"100vh"}`]}e.style.cssText=h.concat(s).join(";")}function T(){const e=window.visualViewport;if(!e)return null;const n=Math.max(0,Math.round(window.innerHeight-e.height-e.offsetTop));return n<80?null:{top:Math.round(e.offsetTop),height:Math.round(e.height),bottom:n}}const $="0.6.26",j={init:M,destroy:b,update:S,context:k,version:$};return u.context=k,u.default=j,u.destroy=b,u.init=M,u.update=S,u.version=$,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),u}({});
|