cobrowse-agent-ui 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,146 +1,457 @@
1
- var U = Object.defineProperty;
2
- var y = Object.getOwnPropertySymbols;
3
- var F = Object.prototype.hasOwnProperty, M = Object.prototype.propertyIsEnumerable;
4
- var D = (t, e, r) => e in t ? U(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, g = (t, e) => {
5
- for (var r in e || (e = {}))
6
- F.call(e, r) && D(t, r, e[r]);
7
- if (y)
8
- for (var r of y(e))
9
- M.call(e, r) && D(t, r, e[r]);
1
+ var ve = Object.defineProperty, Ee = Object.defineProperties;
2
+ var Re = Object.getOwnPropertyDescriptors;
3
+ var M = Object.getOwnPropertySymbols;
4
+ var X = Object.prototype.hasOwnProperty, K = Object.prototype.propertyIsEnumerable;
5
+ var G = (e, n, t) => n in e ? ve(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t, $ = (e, n) => {
6
+ for (var t in n || (n = {}))
7
+ X.call(n, t) && G(e, t, n[t]);
8
+ if (M)
9
+ for (var t of M(n))
10
+ K.call(n, t) && G(e, t, n[t]);
11
+ return e;
12
+ }, H = (e, n) => Ee(e, Re(n));
13
+ var U = (e, n) => {
14
+ var t = {};
15
+ for (var o in e)
16
+ X.call(e, o) && n.indexOf(o) < 0 && (t[o] = e[o]);
17
+ if (e != null && M)
18
+ for (var o of M(e))
19
+ n.indexOf(o) < 0 && K.call(e, o) && (t[o] = e[o]);
10
20
  return t;
11
21
  };
12
- var N = (t, e) => {
13
- var r = {};
14
- for (var n in t)
15
- F.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]);
16
- if (t != null && y)
17
- for (var n of y(t))
18
- e.indexOf(n) < 0 && M.call(t, n) && (r[n] = t[n]);
19
- return r;
20
- };
21
- var P = (t, e, r) => new Promise((n, i) => {
22
- var m = (o) => {
22
+ var k = (e, n, t) => new Promise((o, s) => {
23
+ var r = (a) => {
23
24
  try {
24
- h(r.next(o));
25
- } catch (p) {
26
- i(p);
25
+ f(t.next(a));
26
+ } catch (i) {
27
+ s(i);
27
28
  }
28
- }, f = (o) => {
29
+ }, c = (a) => {
29
30
  try {
30
- h(r.throw(o));
31
- } catch (p) {
32
- i(p);
31
+ f(t.throw(a));
32
+ } catch (i) {
33
+ s(i);
33
34
  }
34
- }, h = (o) => o.done ? n(o.value) : Promise.resolve(o.value).then(m, f);
35
- h((r = r.apply(t, e)).next());
35
+ }, f = (a) => a.done ? o(a.value) : Promise.resolve(a.value).then(r, c);
36
+ f((t = t.apply(e, n)).next());
36
37
  });
37
- import { C as V, P as Y, D as q, S as z, a as G, R as J, L as K, i as O } from "./index-BmaoQ4Rn.js";
38
- import { jsxs as Q, jsx as L } from "react/jsx-runtime";
39
- import * as _ from "react";
40
- import { useRef as u, useEffect as W } from "react";
41
- import T from "clsx";
42
- const X = (t) => /* @__PURE__ */ _.createElement("svg", g({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", width: 14, height: 14, "aria-hidden": "true" }, t), /* @__PURE__ */ _.createElement("path", { d: "M15 3h6v6" }), /* @__PURE__ */ _.createElement("path", { d: "M10 14 21 3" }), /* @__PURE__ */ _.createElement("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })), Z = "ExternalLink-module__root__7-WiY", R = {
43
- root: Z
44
- }, S = ({ href: t, children: e }) => /* @__PURE__ */ Q("a", { className: R.root, href: t, target: "_blank", rel: "noopener noreferrer", children: [
45
- e,
46
- /* @__PURE__ */ L(X, {})
47
- ] }), tt = "UserIcon-module__root__-NL30", rt = {
48
- root: tt
49
- }, et = ({ user: t, className: e }) => {
50
- const r = () => !(t != null && t.name) || t.picture ? "" : t.name.trim().split(/\s+/).map((n) => n.toUpperCase().charAt(0)).join("").slice(0, 2);
51
- return t ? /* @__PURE__ */ L(
38
+ import { i as W, u as T, B as re, L as ce, C as be, D as pe, P as Se, R as we, S as $e, a as xe } from "./index-fBWDR3rY.js";
39
+ import { jsxs as D, jsx as C } from "react/jsx-runtime";
40
+ import * as v from "react";
41
+ import { createContext as ae, use as ie, useState as I, useEffect as x, useRef as S, useCallback as R, useMemo as ye } from "react";
42
+ import j from "clsx";
43
+ import { RemoteContext as Le } from "cobrowse-agent-sdk";
44
+ import "react-i18next";
45
+ const Q = ({ resolvedLanguage: e, language: n }) => e != null ? e : n, ke = (e) => {
46
+ const n = (o) => {
47
+ !o || Q(W) === o || W.changeLanguage(o);
48
+ }, t = (o) => {
49
+ n(o);
50
+ };
51
+ return n(Q(e)), e.on("languageChanged", t), () => {
52
+ e.off("languageChanged", t);
53
+ };
54
+ }, Pe = (e) => /* @__PURE__ */ v.createElement("svg", $({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", width: 14, height: 14, "aria-hidden": "true" }, e), /* @__PURE__ */ v.createElement("path", { d: "M15 3h6v6" }), /* @__PURE__ */ v.createElement("path", { d: "M10 14 21 3" }), /* @__PURE__ */ v.createElement("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })), Be = "ExternalLink-module__root__7-WiY focus-module__focusRing__rvgPB", Oe = {
55
+ root: Be
56
+ }, Ne = ({ href: e, children: n }) => /* @__PURE__ */ D("a", { className: Oe.root, href: e, target: "_blank", rel: "noopener noreferrer", children: [
57
+ n,
58
+ /* @__PURE__ */ C(Pe, {})
59
+ ] }), Me = "UserIcon-module__root__-NL30", Ue = {
60
+ root: Me
61
+ }, Te = ({ user: e, className: n }) => {
62
+ const t = () => !(e != null && e.name) || e.picture ? "" : e.name.trim().split(/\s+/).map((o) => o.toUpperCase().charAt(0)).join("").slice(0, 2);
63
+ return e ? /* @__PURE__ */ C(
52
64
  "div",
53
65
  {
54
- className: T(rt.root, e),
55
- title: t.name,
66
+ className: j(Ue.root, n),
67
+ title: e.name,
56
68
  style: {
57
- backgroundImage: t.picture ? `url(${t.picture || ""})` : void 0,
58
- backgroundColor: t.colour
69
+ backgroundImage: e.picture ? `url(${e.picture || ""})` : void 0,
70
+ backgroundColor: e.colour
59
71
  },
60
- children: /* @__PURE__ */ L("span", { children: r() })
72
+ children: /* @__PURE__ */ C("span", { children: t() })
61
73
  }
62
74
  ) : null;
63
- }, nt = (ct) => {
64
- var B = ct, {
65
- cobrowse: t,
75
+ }, De = (e) => /* @__PURE__ */ v.createElement("svg", $({ width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, e), /* @__PURE__ */ v.createElement("g", { clipPath: "url(#clip0_60797_8824)" }, /* @__PURE__ */ v.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M20.9964 12.5895C21.1528 12.4331 21.2406 12.2211 21.2406 12C21.2406 11.7872 21.1593 11.5829 21.0138 11.4285C18.518 9.23023 15.3059 8.01707 11.9793 8.01707C8.65261 8.01707 5.44055 9.23023 2.94474 11.4285C2.7993 11.5829 2.71797 11.7872 2.71797 12C2.71797 12.2211 2.8058 12.4331 2.96214 12.5895L5.07653 14.7039L8.20945 13.3612L7.76772 11.5943C7.6415 11.0894 7.92363 10.5721 8.41645 10.4048C10.7269 9.62055 13.2316 9.62055 15.5421 10.4048C16.0349 10.5721 16.3171 11.0894 16.1908 11.5943L15.7491 13.3612L18.882 14.7039L20.9964 12.5895ZM23.2406 12C23.2406 12.7515 22.942 13.4723 22.4106 14.0037L19.8175 16.5968C19.5284 16.8859 19.0923 16.9699 18.7165 16.8088L14.1785 14.864C13.7274 14.6707 13.4832 14.1785 13.6023 13.7023L14.0159 12.0478C12.6758 11.7395 11.2828 11.7395 9.94266 12.0478L10.3563 13.7023C10.4753 14.1785 10.2312 14.6707 9.78006 14.864L5.24208 16.8088C4.86624 16.9699 4.43019 16.8859 4.14106 16.5968L1.54792 14.0037C1.01651 13.4723 0.717975 12.7515 0.717976 12C0.717975 11.2485 1.01651 10.5277 1.54792 9.99633C1.56223 9.98202 1.57697 9.96815 1.59212 9.95474C4.45744 7.41772 8.1522 6.01707 11.9793 6.01707C15.8064 6.01707 19.5011 7.41772 22.3664 9.95474C22.3816 9.96815 22.3963 9.98202 22.4106 9.99633C22.942 10.5277 23.2406 11.2485 23.2406 12Z", fill: "currentColor" })), /* @__PURE__ */ v.createElement("defs", null, /* @__PURE__ */ v.createElement("clipPath", { id: "clip0_60797_8824" }, /* @__PURE__ */ v.createElement("rect", { width: 24, height: 24, fill: "white" })))), Ie = "CancelButton-module__root__CbF-w", je = {
76
+ root: Ie
77
+ }, le = (s) => {
78
+ var r = s, { type: e = "button", className: n, children: t } = r, o = U(r, ["type", "className", "children"]);
79
+ const { t: c } = T();
80
+ return /* @__PURE__ */ C(
81
+ re,
82
+ H($({
83
+ type: e,
84
+ "aria-label": c("Cancel"),
85
+ className: j(je.root, n)
86
+ }, o), {
87
+ children: t != null ? t : /* @__PURE__ */ C(De, {})
88
+ })
89
+ );
90
+ }, Ae = "BlockingError-module__root__myw6b", Fe = "BlockingError-module__heading__FzjhY", He = "BlockingError-module__message__7jJ2T", q = {
91
+ root: Ae,
92
+ heading: Fe,
93
+ message: He
94
+ }, qe = ({ heading: e, message: n, children: t }) => {
95
+ const { t: o } = T();
96
+ return /* @__PURE__ */ D("div", { className: q.root, children: [
97
+ /* @__PURE__ */ C("p", { className: q.heading, children: e != null ? e : o("Sorry, something went wrong.") }),
98
+ n && /* @__PURE__ */ C("p", { className: q.message, children: n }),
99
+ t
100
+ ] });
101
+ }, de = ae(null), We = ({ cobrowse: e, children: n }) => /* @__PURE__ */ C(de.Provider, { value: e, children: n }), ue = () => ie(de), Y = () => {
102
+ const e = ue();
103
+ if (!e)
104
+ throw new Error("CobrowseProvider is required to use this component.");
105
+ return e;
106
+ }, fe = ae(null);
107
+ function A(e) {
108
+ const n = ie(fe), t = ue(), [o, s] = I(null);
109
+ return x(() => {
110
+ if (e === void 0 || !e || !t)
111
+ return;
112
+ let r = !1, c = null;
113
+ return k(null, null, function* () {
114
+ if (c = yield t.attachContext(e), r) {
115
+ c.destroy(), c = null;
116
+ return;
117
+ }
118
+ s(c);
119
+ }), () => {
120
+ r = !0, s(null), c && (c.destroy(), c = null);
121
+ };
122
+ }, [t, e]), e === void 0 ? n : !e || !t ? null : o;
123
+ }
124
+ const E = (e) => {
125
+ const n = S(e);
126
+ return x(() => {
127
+ n.current = e;
128
+ }, [e]), R((...t) => {
129
+ var o;
130
+ return (o = n.current) == null ? void 0 : o.call(n, ...t);
131
+ }, []);
132
+ }, me = (a) => {
133
+ var i = a, {
66
134
  src: e,
67
- onSessionLoaded: r,
68
- onSessionUpdated: n,
69
- onSessionActivated: i,
70
- onSessionEnded: m,
71
- onError: f,
72
- title: h = "Frame",
135
+ onError: n,
136
+ title: t = "Frame",
73
137
  width: o = "100%",
74
- height: p = "100%",
75
- style: A
76
- } = B, H = N(B, [
77
- "cobrowse",
138
+ height: s = "100%",
139
+ style: r,
140
+ children: c
141
+ } = i, f = U(i, [
78
142
  "src",
79
- "onSessionLoaded",
80
- "onSessionUpdated",
81
- "onSessionActivated",
82
- "onSessionEnded",
83
143
  "onError",
84
144
  "title",
85
145
  "width",
86
146
  "height",
87
- "style"
147
+ "style",
148
+ "children"
149
+ ]);
150
+ const [u, _] = I(null), m = E(n), d = A(u), b = R((g) => {
151
+ _(g);
152
+ }, []);
153
+ return x(() => {
154
+ if (!d)
155
+ return;
156
+ const g = (w) => {
157
+ m(w);
158
+ };
159
+ return d.on("error", g), () => {
160
+ d.off("error", g);
161
+ };
162
+ }, [d, m]), /* @__PURE__ */ D(fe.Provider, { value: d, children: [
163
+ /* @__PURE__ */ C(
164
+ "iframe",
165
+ $({
166
+ ref: b,
167
+ title: t,
168
+ width: o,
169
+ height: s,
170
+ src: e,
171
+ style: $({ border: 0 }, r)
172
+ }, f)
173
+ ),
174
+ c
175
+ ] });
176
+ }, ee = (e) => e instanceof Le, Ye = (e, n) => n in e, ne = (e) => e ? new Proxy(e, {
177
+ get: (n, t) => Ye(n, t) ? n[t] : void 0
178
+ }) : null, Ce = (e) => {
179
+ const n = e && ee(e) ? e : null, t = e && !ee(e) ? e : null, [o, s] = I(t);
180
+ return x(() => {
181
+ if (!n)
182
+ return;
183
+ const r = (c) => {
184
+ s(ne(c));
185
+ };
186
+ return n.on("session.loaded", r), n.on("session.updated", r), () => {
187
+ n.off("session.loaded", r), n.off("session.updated", r), s(null);
188
+ };
189
+ }, [n]), x(() => {
190
+ if (!t)
191
+ return;
192
+ const r = () => {
193
+ s(ne(t));
194
+ };
195
+ return t.on("updated", r), t.on("ended", r), () => {
196
+ t.off("updated", r), t.off("ended", r), s(null);
197
+ };
198
+ }, [t]), o != null ? o : t;
199
+ }, Je = "Overlay-module__root__qqUZs", Ve = "Overlay-module__content__5FwWj", te = {
200
+ root: Je,
201
+ content: Ve
202
+ }, Ze = ({ state: e, children: n }) => {
203
+ const t = A(), o = Ce(t), s = o == null ? void 0 : o.state;
204
+ return (e === "loading" ? s === void 0 : s === e) ? /* @__PURE__ */ C("div", { className: te.root, children: /* @__PURE__ */ C("div", { className: te.content, children: n }) }) : null;
205
+ }, ze = ({
206
+ id: e,
207
+ endAction: n,
208
+ popout: t,
209
+ agentTools: o,
210
+ deviceControls: s,
211
+ sessionDetails: r,
212
+ messages: c
213
+ }) => {
214
+ const f = Y(), { i18n: { language: a } } = T();
215
+ return ye(() => {
216
+ const i = Object.entries({
217
+ end_action: n,
218
+ popout: t,
219
+ agent_tools: o,
220
+ device_controls: s,
221
+ session_details: r,
222
+ messages: c,
223
+ token_source: "postMessage",
224
+ lng: a
225
+ }).flatMap(([_, m]) => m === void 0 ? [] : [[_, m]]), u = new URLSearchParams(i);
226
+ return `${f.api}/session/${encodeURIComponent(e)}?${u.toString()}`;
227
+ }, [
228
+ f.api,
229
+ e,
230
+ n,
231
+ t,
232
+ o,
233
+ s,
234
+ r,
235
+ c,
236
+ a
237
+ ]);
238
+ }, Ge = "SessionEmbed-module__root__Y9AHn", Xe = {
239
+ root: Ge
240
+ }, Ke = ({ onLoaded: e, onUpdated: n, onActivated: t, onEnded: o }) => {
241
+ const s = A(), r = E(e), c = E(n), f = E(t), a = E(o), i = S(!1), u = S(!1);
242
+ return x(() => {
243
+ if (!s) {
244
+ i.current = !1, u.current = !1;
245
+ return;
246
+ }
247
+ const _ = (d) => {
248
+ i.current = d.isActive(), u.current = !1, r(d);
249
+ }, m = (d) => {
250
+ c(d), d.isActive() && !i.current && (i.current = !0, f(d)), d.isEnded() && !u.current && (u.current = !0, a(d));
251
+ };
252
+ return s.on("session.loaded", _), s.on("session.updated", m), () => {
253
+ s.off("session.loaded", _), s.off("session.updated", m), i.current = !1, u.current = !1;
254
+ };
255
+ }, [f, a, r, c, s]), null;
256
+ }, Qe = (g) => {
257
+ var w = g, {
258
+ id: e,
259
+ endAction: n,
260
+ popout: t,
261
+ agentTools: o,
262
+ deviceControls: s,
263
+ sessionDetails: r,
264
+ messages: c,
265
+ onError: f,
266
+ onLoaded: a,
267
+ onUpdated: i,
268
+ onActivated: u,
269
+ onEnded: _,
270
+ className: m,
271
+ children: d
272
+ } = w, b = U(w, [
273
+ "id",
274
+ "endAction",
275
+ "popout",
276
+ "agentTools",
277
+ "deviceControls",
278
+ "sessionDetails",
279
+ "messages",
280
+ "onError",
281
+ "onLoaded",
282
+ "onUpdated",
283
+ "onActivated",
284
+ "onEnded",
285
+ "className",
286
+ "children"
88
287
  ]);
89
- const w = u(null), d = u(r), x = u(n), $ = u(i), k = u(m), s = u(f);
90
- return W(() => {
91
- d.current = r, x.current = n, $.current = i, k.current = m, s.current = f;
92
- }, [r, n, i, m, f]), W(() => {
93
- let I = !1, a = null, v = !1, C = !1;
94
- return P(null, null, function* () {
95
- var E;
96
- if (w.current) {
97
- try {
98
- a = yield t.attachContext(w.current);
99
- } catch (c) {
100
- I || (E = s.current) == null || E.call(s, c);
101
- return;
102
- }
103
- if (I) {
104
- a.destroy(), a = null;
105
- return;
106
- }
107
- a.on("session.loaded", (c) => {
108
- var l;
109
- v = c.isActive(), C = !1, (l = d.current) == null || l.call(d, c);
110
- }), a.on("session.updated", (c) => {
111
- var l, j, b;
112
- (l = x.current) == null || l.call(x, c), c.isActive() && !v && (v = !0, (j = $.current) == null || j.call($, c)), c.isEnded() && !C && (C = !0, (b = k.current) == null || b.call(k, c));
113
- }), a.on("error", (c) => {
114
- var l;
115
- (l = s.current) == null || l.call(s, c);
116
- });
288
+ const B = ze({
289
+ id: e,
290
+ endAction: n,
291
+ popout: t,
292
+ agentTools: o,
293
+ deviceControls: s,
294
+ sessionDetails: r,
295
+ messages: c
296
+ });
297
+ return /* @__PURE__ */ C("div", { className: Xe.root, children: /* @__PURE__ */ D(
298
+ me,
299
+ H($({
300
+ src: B,
301
+ className: m,
302
+ onError: f
303
+ }, b), {
304
+ children: [
305
+ /* @__PURE__ */ C(
306
+ Ke,
307
+ {
308
+ onLoaded: a,
309
+ onUpdated: i,
310
+ onActivated: u,
311
+ onEnded: _
312
+ }
313
+ ),
314
+ d
315
+ ]
316
+ })
317
+ ) });
318
+ }, en = Object.assign(Qe, {
319
+ Overlay: Ze
320
+ }), F = 5, _e = 4e3, nn = "push_error", tn = "push_attempt_limit_reached", on = "device_not_found", sn = "session_not_found", oe = "session_error", se = (e) => e instanceof Error ? e.name === "AbortError" : !1, rn = ({
321
+ deviceId: e,
322
+ onConnectAttempt: n,
323
+ onConnected: t,
324
+ onCancelled: o,
325
+ onEnded: s,
326
+ onError: r,
327
+ maxPushAttempts: c = F,
328
+ pushRetryMs: f = _e
329
+ }) => {
330
+ const a = Y(), i = S(null), u = S(null), _ = S(!1), m = S(!1), d = S(0), b = E(n), g = E(t), w = E(o), B = E(s), y = E(r), L = R(() => {
331
+ clearTimeout(d.current);
332
+ }, []), J = R((l) => {
333
+ !["pending", "ended"].includes(l.state) && !_.current && (L(), g(l), _.current = !0);
334
+ }, [g, L]), V = R((l) => {
335
+ var h;
336
+ m.current || (B(l), m.current = !0, (h = u.current) == null || h.end());
337
+ }, [B]), P = R((l) => {
338
+ se(l) || (l instanceof Error ? y({ id: nn, message: l.message }) : y(l));
339
+ }, [y]), Z = R(function l(h = 1, p) {
340
+ return k(this, null, function* () {
341
+ if (b(h), h >= c) {
342
+ P({ id: tn, message: "Push attempt limit reached." });
343
+ return;
117
344
  }
345
+ if (!i.current) {
346
+ P({ id: on, message: "Device not found." });
347
+ return;
348
+ }
349
+ if (!u.current) {
350
+ P({ id: sn, message: "Session not found." });
351
+ return;
352
+ }
353
+ try {
354
+ yield i.current.notify({ session: u.current, attempt: h }, void 0, { signal: p.signal });
355
+ } catch (O) {
356
+ P(O);
357
+ }
358
+ d.current = setTimeout(() => {
359
+ l(h + 1, p);
360
+ }, f);
361
+ });
362
+ }, [c, b, f, P]), z = R((l) => k(null, null, function* () {
363
+ const { signal: h } = l;
364
+ try {
365
+ i.current = null, u.current = null, _.current = !1, m.current = !1;
366
+ const [p, O] = yield Promise.all([
367
+ a.regions.closest(void 0, { signal: h }),
368
+ a.devices.get(e, void 0, { signal: h })
369
+ ]);
370
+ i.current = O;
371
+ const N = yield a.sessions.create({
372
+ custom_data: O.custom_data,
373
+ region: p.id,
374
+ agent: "me"
375
+ }, void 0, { signal: h });
376
+ u.current = N, N.on("updated", J), N.on("ended", V), yield N.subscribe();
377
+ } catch (p) {
378
+ if (se(p))
379
+ return;
380
+ p instanceof Error ? y({ id: oe, message: p.message }) : y({ id: oe, message: "The session could not be created." });
381
+ }
382
+ }), [a, e, V, J, y]), ge = R(() => k(null, null, function* () {
383
+ L();
384
+ const l = u.current;
385
+ l && (yield l.end(), w(l));
386
+ }), [w, L]);
387
+ return x(() => {
388
+ const l = new AbortController();
389
+ return k(null, null, function* () {
390
+ yield z(l), !l.signal.aborted && (yield Z(1, l));
118
391
  }), () => {
119
- I = !0, v = !1, C = !1, a && (a.destroy(), a = null);
392
+ l.abort(), L();
120
393
  };
121
- }, [t]), /* @__PURE__ */ L(
122
- "iframe",
123
- g({
124
- ref: w,
125
- title: h,
126
- width: o,
127
- height: p,
128
- src: e,
129
- style: g({ border: 0 }, A)
130
- }, H)
131
- );
132
- }, mt = V, ft = S, ht = Y, pt = q, dt = z, xt = G, $t = et, kt = J, vt = K, Ct = nt, yt = O;
394
+ }, [z, Z, L]), { cancel: ge };
395
+ }, cn = "ConnectDevice-module__root__JnmG1", an = "ConnectDevice-module__statusMessage__JWNqk", he = {
396
+ root: cn,
397
+ statusMessage: an
398
+ }, ln = ({ attempt: e, maxPushAttempts: n = F, className: t }) => {
399
+ const { t: o } = T();
400
+ let s = o("Contacting device");
401
+ return e >= n ? s = o("Device not responding") : e >= n - 1 ? s = o("Trying once more") : e > 2 && (s = o("Retrying connection")), /* @__PURE__ */ C("div", { className: j(he.statusMessage, t), children: s });
402
+ }, dn = ({ attempt: e, maxPushAttempts: n = F }) => e >= n ? null : /* @__PURE__ */ C(ce, {}), un = ({
403
+ deviceId: e,
404
+ onConnectAttempt: n,
405
+ onConnected: t,
406
+ onCancelled: o,
407
+ onEnded: s,
408
+ onError: r,
409
+ maxPushAttempts: c = F,
410
+ pushRetryMs: f = _e,
411
+ className: a,
412
+ children: i
413
+ }) => {
414
+ const [u, _] = I(1), m = (g) => {
415
+ _(g), n == null || n(g);
416
+ }, { cancel: d } = rn({
417
+ deviceId: e,
418
+ onConnectAttempt: m,
419
+ onConnected: t,
420
+ onCancelled: o,
421
+ onEnded: s,
422
+ onError: r,
423
+ maxPushAttempts: c,
424
+ pushRetryMs: f
425
+ }), b = () => {
426
+ d();
427
+ };
428
+ return /* @__PURE__ */ C("div", { className: j(he.root, a), children: i(u, b) });
429
+ }, fn = Object.assign(un, {
430
+ StatusMessage: ln,
431
+ Loader: dn,
432
+ CancelButton: le
433
+ }), Rn = be, bn = re, pn = Ne, Sn = Se, wn = pe, $n = $e, xn = xe, yn = Te, Ln = we, kn = le, Pn = qe, Bn = ce, On = me, Nn = en, Mn = fn, Un = We, Tn = Y, Dn = A, In = Ce, jn = ke, An = W;
133
434
  export {
134
- mt as CodeEntry,
135
- pt as Device,
136
- ft as ExternalLink,
137
- Ct as Frame,
138
- vt as Loader,
139
- ht as PlatformIcon,
140
- kt as RefreshButton,
141
- dt as Session,
142
- xt as SmartConnectButton,
143
- $t as UserIcon,
144
- yt as i18n
435
+ Pn as BlockingError,
436
+ bn as Button,
437
+ kn as CancelButton,
438
+ Un as CobrowseProvider,
439
+ Rn as CodeEntry,
440
+ Mn as ConnectDevice,
441
+ wn as Device,
442
+ pn as ExternalLink,
443
+ On as Frame,
444
+ Bn as Loader,
445
+ Sn as PlatformIcon,
446
+ Ln as RefreshButton,
447
+ $n as Session,
448
+ Nn as SessionEmbed,
449
+ xn as SmartConnectButton,
450
+ yn as UserIcon,
451
+ jn as bindI18n,
452
+ An as i18n,
453
+ Tn as useCobrowse,
454
+ Dn as useRemoteContext,
455
+ In as useSession
145
456
  };
146
457
  //# sourceMappingURL=cobrowse-agent-ui.js.map