@bpinternal/integration-hub 0.8.0 → 0.8.1

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,14 +1,14 @@
1
- import { jsx as I, jsxs as $ } from "react/jsx-runtime";
2
- import { Loader2 as Lt } from "lucide-react";
3
- import { useState as x, useRef as G, useEffect as Z, useMemo as F, useCallback as N } from "react";
4
- import { I as ue, c as bt, u as fe, a as ge, b as pe, d as he, e as be, f as ve, g as Ce, h as ye, i as Ie, j as we, k as Se, l as Ae } from "../chunks/index.js";
5
- import { StaticZuiForm as Me } from "@bpinternal/static-zui-form";
6
- import { useQueryClient as kt, useQuery as Et, useMutation as Q } from "@tanstack/react-query";
1
+ import { jsx as w, jsxs as _ } from "react/jsx-runtime";
2
+ import { Loader2 as Et } from "lucide-react";
3
+ import { useState as x, useRef as W, useEffect as Z, useMemo as V, useCallback as N } from "react";
4
+ import { I as ge, c as Ct, u as pe, a as he, b as be, d as ve, e as Ce, f as ye, g as we, h as Ie, i as Se, j as Ae, k as Me, l as Te } from "../chunks/index.js";
5
+ import { StaticZuiForm as Oe } from "@bpinternal/static-zui-form";
6
+ import { useQueryClient as Nt, useQuery as Vt, useMutation as q } from "@tanstack/react-query";
7
7
  import "framer-motion";
8
8
  import "clsx";
9
9
  import "tailwind-merge";
10
10
  import "@base-ui/react/menu";
11
- const Te = "width=650,height=800,popup=true", Oe = 500, Pe = 5 * 60 * 1e3, Be = (t) => {
11
+ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue = (t) => {
12
12
  if (!t)
13
13
  return null;
14
14
  try {
@@ -16,7 +16,7 @@ const Te = "width=650,height=800,popup=true", Oe = 500, Pe = 5 * 60 * 1e3, Be =
16
16
  } catch {
17
17
  return t.split("/").filter(Boolean).at(-1) ?? null;
18
18
  }
19
- }, Ue = async ({
19
+ }, ke = async ({
20
20
  client: t,
21
21
  linkTemplateScript: e,
22
22
  data: i
@@ -28,27 +28,27 @@ const Te = "width=650,height=800,popup=true", Oe = 500, Pe = 5 * 60 * 1e3, Be =
28
28
  if (typeof n != "string")
29
29
  throw new Error("Authorization URL is not a string");
30
30
  return n;
31
- }, xe = async ({
31
+ }, De = async ({
32
32
  authorizationUrl: t,
33
33
  onClose: e,
34
- popupFeatures: i = Te,
35
- pollIntervalMs: n = Oe,
36
- timeoutMs: o = Pe
34
+ popupFeatures: i = Pe,
35
+ pollIntervalMs: n = Be,
36
+ timeoutMs: o = xe
37
37
  }) => {
38
38
  const a = window.open(t, "OAuth", i);
39
39
  if (!a)
40
40
  return "blocked";
41
- if (!await new Promise((c) => {
42
- const r = window.setInterval(() => {
41
+ if (!await new Promise((r) => {
42
+ const c = window.setInterval(() => {
43
43
  try {
44
44
  if (!a.closed)
45
45
  return;
46
- window.clearInterval(r), window.clearTimeout(l), c(!0);
46
+ window.clearInterval(c), window.clearTimeout(g), r(!0);
47
47
  } catch {
48
- window.clearInterval(r), window.clearTimeout(l), c(!1);
48
+ window.clearInterval(c), window.clearTimeout(g), r(!1);
49
49
  }
50
- }, n), l = window.setTimeout(() => {
51
- window.clearInterval(r), a.closed || a.close(), c(!1);
50
+ }, n), g = window.setTimeout(() => {
51
+ window.clearInterval(c), a.closed || a.close(), r(!1);
52
52
  }, o);
53
53
  }))
54
54
  return "timeout";
@@ -57,23 +57,23 @@ const Te = "width=650,height=800,popup=true", Oe = 500, Pe = 5 * 60 * 1e3, Be =
57
57
  } catch {
58
58
  return "failed";
59
59
  }
60
- }, De = (t) => t instanceof Error ? t : new Error("OAuth authorization failed"), Le = ({
60
+ }, Le = (t) => t instanceof Error ? t : new Error("OAuth authorization failed"), Ee = ({
61
61
  client: t,
62
62
  integrationName: e,
63
63
  linkTemplateScript: i,
64
64
  webhookId: n,
65
65
  webhookUrl: o,
66
66
  oauthTemplateData: a,
67
- isAuthorized: d = !1,
68
- disabled: c = !1,
69
- onAuthorized: r,
70
- onError: l
67
+ isAuthorized: l = !1,
68
+ disabled: r = !1,
69
+ onAuthorized: c,
70
+ onError: g
71
71
  }) => {
72
- const [u, v] = x(null), [C, S] = x(!1), [T, O] = x(!1), B = n ?? Be(o), h = !!(n || o), g = G(l);
72
+ const [d, p] = x(null), [v, A] = x(!1), [P, T] = x(!1), U = n ?? Ue(o), b = !!(n || o), f = W(g);
73
73
  Z(() => {
74
- g.current = l;
75
- }, [l]);
76
- const M = F(() => {
74
+ f.current = g;
75
+ }, [g]);
76
+ const M = V(() => {
77
77
  try {
78
78
  return JSON.stringify(a ?? {});
79
79
  } catch {
@@ -81,112 +81,112 @@ const Te = "width=650,height=800,popup=true", Oe = 500, Pe = 5 * 60 * 1e3, Be =
81
81
  }
82
82
  }, [a]);
83
83
  Z(() => {
84
- if (!h) {
85
- v(null), S(!1);
84
+ if (!b) {
85
+ p(null), A(!1);
86
86
  return;
87
87
  }
88
- let p = !1;
88
+ let h = !1;
89
89
  return (async () => {
90
- var P;
91
- let k = {};
90
+ var O;
91
+ let L = {};
92
92
  try {
93
- k = JSON.parse(M);
93
+ L = JSON.parse(M);
94
94
  } catch {
95
- k = {};
95
+ L = {};
96
96
  }
97
97
  const y = {
98
98
  webhookUrl: o ?? null,
99
- webhookId: B,
100
- ...k
99
+ webhookId: U,
100
+ ...L
101
101
  };
102
- S(!0);
102
+ A(!0);
103
103
  try {
104
- const V = await Ue({
104
+ const j = await ke({
105
105
  client: t,
106
106
  linkTemplateScript: i,
107
107
  data: y
108
108
  });
109
- p || v(V);
110
- } catch (V) {
111
- p || (v(null), (P = g.current) == null || P.call(g, De(V)));
109
+ h || p(j);
110
+ } catch (j) {
111
+ h || (p(null), (O = f.current) == null || O.call(f, Le(j)));
112
112
  } finally {
113
- p || S(!1);
113
+ h || A(!1);
114
114
  }
115
115
  })(), () => {
116
- p = !0;
116
+ h = !0;
117
117
  };
118
- }, [t, h, i, M, o, B]);
119
- const j = h && !!u && !C && !c, _ = async () => {
120
- var p, A, k;
121
- if (!(!u || T)) {
122
- O(!0);
118
+ }, [t, b, i, M, o, U]);
119
+ const K = b && !!d && !v && !r, F = async () => {
120
+ var h, S, L;
121
+ if (!(!d || P)) {
122
+ T(!0);
123
123
  try {
124
- const y = await xe({
125
- authorizationUrl: u,
126
- onClose: r
124
+ const y = await De({
125
+ authorizationUrl: d,
126
+ onClose: c
127
127
  });
128
128
  if (y === "completed")
129
129
  return;
130
130
  if (y === "blocked") {
131
- (p = g.current) == null || p.call(g, new Error("Please allow browser popups to authorize this integration."));
131
+ (h = f.current) == null || h.call(f, new Error("Please allow browser popups to authorize this integration."));
132
132
  return;
133
133
  }
134
134
  if (y === "timeout") {
135
- (A = g.current) == null || A.call(g, new Error("OAuth popup did not close in time. Please close it and try again."));
135
+ (S = f.current) == null || S.call(f, new Error("OAuth popup did not close in time. Please close it and try again."));
136
136
  return;
137
137
  }
138
- (k = g.current) == null || k.call(g, new Error("OAuth authorization finished but refresh failed."));
138
+ (L = f.current) == null || L.call(f, new Error("OAuth authorization finished but refresh failed."));
139
139
  } finally {
140
- O(!1);
140
+ T(!1);
141
141
  }
142
142
  }
143
143
  };
144
- return /* @__PURE__ */ I(
145
- ue,
144
+ return /* @__PURE__ */ w(
145
+ ge,
146
146
  {
147
147
  integrationName: e,
148
- canAuthorize: j,
149
- isAuthorizing: T,
150
- isAuthorized: d,
151
- disabled: c,
152
- showInstallHint: !h,
148
+ canAuthorize: K,
149
+ isAuthorizing: P,
150
+ isAuthorized: l,
151
+ disabled: r,
152
+ showInstallHint: !b,
153
153
  onClick: () => {
154
- _();
154
+ F();
155
155
  }
156
156
  }
157
157
  );
158
- }, Nt = ({
158
+ }, Ft = ({
159
159
  definition: t,
160
160
  selectedConnectionMethod: e
161
161
  }) => {
162
162
  var n, o, a;
163
163
  const i = e != null ? (o = (n = t.configurations) == null ? void 0 : n[e]) == null ? void 0 : o.schema : (a = t.configuration) == null ? void 0 : a.schema;
164
164
  return !i || typeof i != "object" ? null : i;
165
- }, Vt = (t) => {
165
+ }, jt = (t) => {
166
166
  if (!t || typeof t != "object")
167
167
  return [];
168
168
  const e = t.properties;
169
169
  return !e || typeof e != "object" ? [] : Object.keys(e);
170
- }, gt = (t) => !t || typeof t != "object" || Array.isArray(t) ? {} : t, Ut = (t, e) => {
170
+ }, ht = (t) => !t || typeof t != "object" || Array.isArray(t) ? {} : t, kt = (t, e) => {
171
171
  if (e.length === 0)
172
172
  return {};
173
173
  const i = e.filter((n) => Object.prototype.hasOwnProperty.call(t, n)).map((n) => [n, t[n]]);
174
174
  return Object.fromEntries(i);
175
- }, it = (t) => !!t && typeof t == "object" && !Array.isArray(t), vt = (t, e) => {
175
+ }, it = (t) => !!t && typeof t == "object" && !Array.isArray(t), yt = (t, e) => {
176
176
  if (Object.is(t, e))
177
177
  return !0;
178
178
  if (Array.isArray(t) || Array.isArray(e))
179
- return !Array.isArray(t) || !Array.isArray(e) || t.length !== e.length ? !1 : t.every((i, n) => vt(i, e[n]));
179
+ return !Array.isArray(t) || !Array.isArray(e) || t.length !== e.length ? !1 : t.every((i, n) => yt(i, e[n]));
180
180
  if (it(t) || it(e)) {
181
181
  if (!it(t) || !it(e))
182
182
  return !1;
183
183
  const i = Object.keys(t), n = Object.keys(e);
184
184
  return i.length !== n.length ? !1 : i.every(
185
- (o) => Object.prototype.hasOwnProperty.call(e, o) && vt(t[o], e[o])
185
+ (o) => Object.prototype.hasOwnProperty.call(e, o) && yt(t[o], e[o])
186
186
  );
187
187
  }
188
188
  return !1;
189
- }, ke = ({
189
+ }, Ne = ({
190
190
  definition: t,
191
191
  installedState: e,
192
192
  selectedConnectionMethod: i,
@@ -194,70 +194,70 @@ const Te = "width=650,height=800,popup=true", Oe = 500, Pe = 5 * 60 * 1e3, Be =
194
194
  isSaving: o,
195
195
  disabled: a = !1
196
196
  }) => {
197
- const d = F(
198
- () => Nt({ definition: t, selectedConnectionMethod: i }),
197
+ const l = V(
198
+ () => Ft({ definition: t, selectedConnectionMethod: i }),
199
199
  [t, i]
200
- ), c = F(() => Vt(d), [d]), r = F(
201
- () => Ut(gt(e == null ? void 0 : e.configuration), c),
202
- [e == null ? void 0 : e.configuration, c]
203
- ), l = F(() => c.join("\0"), [c]), [u, v] = x({}), [C, S] = x(null), [T, O] = x(0), B = G(null);
200
+ ), r = V(() => jt(l), [l]), c = V(
201
+ () => kt(ht(e == null ? void 0 : e.configuration), r),
202
+ [e == null ? void 0 : e.configuration, r]
203
+ ), g = V(() => r.join("\0"), [r]), [d, p] = x({}), [v, A] = x(null), [P, T] = x(0), U = W(null);
204
204
  return Z(() => {
205
- const h = {
205
+ const b = {
206
206
  integrationAlias: (e == null ? void 0 : e.integrationAlias) ?? null,
207
207
  configurationType: (e == null ? void 0 : e.configurationType) ?? null,
208
- schemaKeySignature: l,
209
- configuration: r
210
- }, g = B.current;
211
- g && g.integrationAlias === h.integrationAlias && g.configurationType === h.configurationType && g.schemaKeySignature === h.schemaKeySignature && vt(g.configuration, h.configuration) || (B.current = h, v(r), S(null), O((M) => M + 1));
212
- }, [r, e == null ? void 0 : e.integrationAlias, e == null ? void 0 : e.configurationType, l]), !d || c.length === 0 ? null : /* @__PURE__ */ $("div", { className: "flex flex-col gap-3", children: [
213
- /* @__PURE__ */ I(
214
- Me,
208
+ schemaKeySignature: g,
209
+ configuration: c
210
+ }, f = U.current;
211
+ f && f.integrationAlias === b.integrationAlias && f.configurationType === b.configurationType && f.schemaKeySignature === b.schemaKeySignature && yt(f.configuration, b.configuration) || (U.current = b, p(c), A(null), T((M) => M + 1));
212
+ }, [c, e == null ? void 0 : e.integrationAlias, e == null ? void 0 : e.configurationType, g]), !l || r.length === 0 ? null : /* @__PURE__ */ _("div", { className: "flex flex-col gap-3", children: [
213
+ /* @__PURE__ */ w(
214
+ Oe,
215
215
  {
216
- schema: d,
217
- value: u,
218
- onChange: (h) => {
219
- const g = Ut(gt(h), c);
220
- v(g);
216
+ schema: l,
217
+ value: d,
218
+ onChange: (b) => {
219
+ const f = kt(ht(b), r);
220
+ p(f);
221
221
  },
222
- onValidation: ({ formValid: h }) => {
223
- S(h);
222
+ onValidation: ({ formValid: b }) => {
223
+ A(b);
224
224
  }
225
225
  },
226
- T
226
+ P
227
227
  ),
228
- /* @__PURE__ */ $(
228
+ /* @__PURE__ */ _(
229
229
  "button",
230
230
  {
231
231
  type: "button",
232
- disabled: a || o || C !== !0,
232
+ disabled: a || o || v !== !0,
233
233
  onClick: () => {
234
- const h = gt(e == null ? void 0 : e.configuration);
234
+ const b = ht(e == null ? void 0 : e.configuration);
235
235
  n({
236
- ...h,
237
- ...u
236
+ ...b,
237
+ ...d
238
238
  });
239
239
  },
240
- className: bt(
240
+ className: Ct(
241
241
  "relative self-end rounded-lg bg-[var(--gray-12)] px-6 py-2 text-sm text-[var(--gray-1)] hover:opacity-90 cursor-pointer",
242
242
  "disabled:opacity-50 disabled:cursor-not-allowed"
243
243
  ),
244
244
  children: [
245
- /* @__PURE__ */ I("span", { className: o ? "invisible" : "", children: "Save Configuration" }),
246
- o && /* @__PURE__ */ I(Lt, { className: "absolute inset-0 m-auto h-4 w-4 animate-spin" })
245
+ /* @__PURE__ */ w("span", { className: o ? "invisible" : "", children: "Save Configuration" }),
246
+ o && /* @__PURE__ */ w(Et, { className: "absolute inset-0 m-auto h-4 w-4 animate-spin" })
247
247
  ]
248
248
  }
249
249
  )
250
250
  ] });
251
- }, Ft = "Other", Ee = "team-cloud-services", pt = "sandbox", ht = (t) => t.replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/[_.:/-]+/g, " ").replace(/\s+/g, " ").trim().replace(/\b\w/g, (e) => e.toUpperCase()), Ne = (t) => t == null ? void 0 : t.replace(/\.$/, ""), jt = (t) => {
251
+ }, _t = "Other", Ve = "team-cloud-services", bt = "sandbox", vt = (t) => t.replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/[_.:/-]+/g, " ").replace(/\s+/g, " ").trim().replace(/\b\w/g, (e) => e.toUpperCase()), Fe = (t) => t == null ? void 0 : t.replace(/\.$/, ""), Kt = (t) => {
252
252
  var e;
253
253
  return t && "meta" in t ? ((e = t.meta) == null ? void 0 : e.installs) ?? null : null;
254
- }, Ct = (t) => t instanceof Error ? t : new Error("An unknown error occurred while loading integrations"), _t = (t) => t === Ee, Kt = (t, e) => {
254
+ }, wt = (t) => t instanceof Error ? t : new Error("An unknown error occurred while loading integrations"), Ht = (t) => t === Ve, zt = (t, e) => {
255
255
  var o;
256
256
  const i = e == null ? void 0 : e(t);
257
257
  if (i)
258
258
  return i;
259
259
  const n = (o = t.attributes) == null ? void 0 : o.category;
260
- return typeof n == "string" && n.length > 0 ? n : Ft;
260
+ return typeof n == "string" && n.length > 0 ? n : _t;
261
261
  }, ot = (t) => t ? Object.entries(t).map(([e, i]) => {
262
262
  const n = i;
263
263
  return {
@@ -266,17 +266,17 @@ const Te = "width=650,height=800,popup=true", Oe = 500, Pe = 5 * 60 * 1e3, Be =
266
266
  name: typeof n.name == "string" && n.name.length > 0 ? n.name : e,
267
267
  integrationAlias: e
268
268
  };
269
- }) : [], yt = ({
269
+ }) : [], It = ({
270
270
  installedIntegrations: t,
271
271
  integrationId: e,
272
272
  integrationName: i
273
- }) => t.find((n) => n.id === e) ?? t.find((n) => n.integrationAlias === e) ?? (i ? t.find((n) => n.name === i) : void 0), Ve = ({
273
+ }) => t.find((n) => n.id === e) ?? t.find((n) => n.integrationAlias === e) ?? (i ? t.find((n) => n.name === i) : void 0), je = ({
274
274
  summary: t,
275
275
  installedByName: e,
276
276
  categoryResolver: i
277
277
  }) => {
278
- var r, l, u;
279
- const n = e.get(t.name), o = _t((r = t.ownerWorkspace) == null ? void 0 : r.handle), a = (n == null ? void 0 : n.version) ?? null, d = t.version ?? null, c = a && d ? a !== d : !1;
278
+ var c, g, d;
279
+ const n = e.get(t.name), o = Ht((c = t.ownerWorkspace) == null ? void 0 : c.handle), a = (n == null ? void 0 : n.version) ?? null, l = t.version ?? null, r = a && l ? a !== l : !1;
280
280
  return {
281
281
  id: t.id,
282
282
  installedId: n == null ? void 0 : n.id,
@@ -284,15 +284,15 @@ const Te = "width=650,height=800,popup=true", Oe = 500, Pe = 5 * 60 * 1e3, Be =
284
284
  title: t.title,
285
285
  description: t.description,
286
286
  iconUrl: t.iconUrl,
287
- attributes: { category: Kt(t, i) },
287
+ attributes: { category: zt(t, i) },
288
288
  meta: {
289
- installs: jt(t)
289
+ installs: Kt(t)
290
290
  },
291
291
  installed: !!n,
292
292
  enabled: n == null ? void 0 : n.enabled,
293
- hasUpdate: c,
293
+ hasUpdate: r,
294
294
  deprecated: (n == null ? void 0 : n.lifecycleStatus) === "deprecated" || t.lifecycleStatus === "deprecated",
295
- author: ((l = t.ownerWorkspace) == null ? void 0 : l.handle) ?? ((u = t.ownerWorkspace) == null ? void 0 : u.name) ?? null,
295
+ author: ((g = t.ownerWorkspace) == null ? void 0 : g.handle) ?? ((d = t.ownerWorkspace) == null ? void 0 : d.name) ?? null,
296
296
  isOfficial: o,
297
297
  isVerified: t.verificationStatus === "approved",
298
298
  isPrivate: t.visibility === "private",
@@ -302,13 +302,13 @@ const Te = "width=650,height=800,popup=true", Oe = 500, Pe = 5 * 60 * 1e3, Be =
302
302
  version: t.version,
303
303
  updatedAt: t.updatedAt
304
304
  };
305
- }, Fe = ({
305
+ }, _e = ({
306
306
  installedIntegration: t,
307
307
  summary: e,
308
308
  categoryResolver: i
309
309
  }) => {
310
- var a, d, c;
311
- const n = _t((a = e == null ? void 0 : e.ownerWorkspace) == null ? void 0 : a.handle), o = t.version && (e != null && e.version) ? t.version !== (e == null ? void 0 : e.version) : !1;
310
+ var a, l, r;
311
+ const n = Ht((a = e == null ? void 0 : e.ownerWorkspace) == null ? void 0 : a.handle), o = t.version && (e != null && e.version) ? t.version !== (e == null ? void 0 : e.version) : !1;
312
312
  return {
313
313
  id: (e == null ? void 0 : e.id) ?? t.id,
314
314
  installedId: t.id,
@@ -317,16 +317,16 @@ const Te = "width=650,height=800,popup=true", Oe = 500, Pe = 5 * 60 * 1e3, Be =
317
317
  description: (e == null ? void 0 : e.description) ?? null,
318
318
  iconUrl: e == null ? void 0 : e.iconUrl,
319
319
  attributes: {
320
- category: e ? Kt(e, i) : Ft
320
+ category: e ? zt(e, i) : _t
321
321
  },
322
322
  meta: {
323
- installs: jt(e)
323
+ installs: Kt(e)
324
324
  },
325
325
  installed: !0,
326
326
  enabled: t.enabled,
327
327
  hasUpdate: o,
328
328
  deprecated: t.lifecycleStatus === "deprecated",
329
- author: ((d = e == null ? void 0 : e.ownerWorkspace) == null ? void 0 : d.handle) ?? ((c = e == null ? void 0 : e.ownerWorkspace) == null ? void 0 : c.name) ?? null,
329
+ author: ((l = e == null ? void 0 : e.ownerWorkspace) == null ? void 0 : l.handle) ?? ((r = e == null ? void 0 : e.ownerWorkspace) == null ? void 0 : r.name) ?? null,
330
330
  isOfficial: n,
331
331
  isVerified: (e == null ? void 0 : e.verificationStatus) === "approved",
332
332
  isPrivate: (e == null ? void 0 : e.visibility) === "private",
@@ -336,7 +336,7 @@ const Te = "width=650,height=800,popup=true", Oe = 500, Pe = 5 * 60 * 1e3, Be =
336
336
  version: (e == null ? void 0 : e.version) ?? t.version,
337
337
  updatedAt: e == null ? void 0 : e.updatedAt
338
338
  };
339
- }, je = (t) => {
339
+ }, Ke = (t) => {
340
340
  if (!t)
341
341
  return {
342
342
  actionCards: [],
@@ -347,23 +347,23 @@ const Te = "width=650,height=800,popup=true", Oe = 500, Pe = 5 * 60 * 1e3, Be =
347
347
  var a;
348
348
  return ((a = o.attributes) == null ? void 0 : a.bpActionHiddenInStudio) !== "true";
349
349
  }).map(([o, a]) => {
350
- var d;
350
+ var l;
351
351
  return {
352
352
  key: o,
353
- name: ht(o),
353
+ name: vt(o),
354
354
  description: a.description ?? "",
355
355
  type: "action",
356
- billable: ((d = a.attributes) == null ? void 0 : d.billable) === "true"
356
+ billable: ((l = a.attributes) == null ? void 0 : l.billable) === "true"
357
357
  };
358
358
  }), i = Object.entries(t.events ?? {}).map(([o, a]) => ({
359
359
  key: o,
360
- name: ht(o),
360
+ name: vt(o),
361
361
  description: a.description ?? "",
362
362
  type: "event",
363
363
  enabled: !0
364
364
  })), n = Object.keys(t.channels ?? {}).map((o) => ({
365
365
  key: o,
366
- name: ht(o),
366
+ name: vt(o),
367
367
  description: "Channel communication support",
368
368
  type: "channel",
369
369
  enabled: !0
@@ -373,101 +373,101 @@ const Te = "width=650,height=800,popup=true", Oe = 500, Pe = 5 * 60 * 1e3, Be =
373
373
  eventCards: i,
374
374
  channelCards: n
375
375
  };
376
- }, _e = (t) => {
377
- var a, d, c, r;
376
+ }, He = (t) => {
377
+ var a, l, r, c;
378
378
  if (!t)
379
379
  return [];
380
380
  const i = [
381
381
  {
382
382
  value: null,
383
- label: !!((d = (a = t.configuration) == null ? void 0 : a.identifier) != null && d.linkTemplateScript) ? "Connect with OAuth" : "Default configuration"
383
+ label: !!((l = (a = t.configuration) == null ? void 0 : a.identifier) != null && l.linkTemplateScript) ? "Connect with OAuth" : "Default configuration"
384
384
  }
385
385
  ];
386
- for (const [l, u] of Object.entries(t.configurations ?? {}))
387
- l !== pt && i.push({
388
- value: l,
389
- label: Ne(u.description) || u.title || l
386
+ for (const [g, d] of Object.entries(t.configurations ?? {}))
387
+ g !== bt && i.push({
388
+ value: g,
389
+ label: Fe(d.description) || d.title || g
390
390
  });
391
- return !!((c = t.sandbox) == null ? void 0 : c.identifierExtractScript) && !!((r = t.configurations) != null && r[pt]) && i.push({ value: pt, label: "Connect to a Playground" }), i;
392
- }, Ke = ({
391
+ return !!((r = t.sandbox) == null ? void 0 : r.identifierExtractScript) && !!((c = t.configurations) != null && c[bt]) && i.push({ value: bt, label: "Connect to a Playground" }), i;
392
+ }, ze = ({
393
393
  installedState: t,
394
394
  connectionMethods: e
395
395
  }) => {
396
396
  var n;
397
397
  const i = (t == null ? void 0 : t.configurationType) ?? null;
398
398
  return e.some((o) => o.value === i) ? i : ((n = e[0]) == null ? void 0 : n.value) ?? null;
399
- }, He = ({
399
+ }, Re = ({
400
400
  integrations: t,
401
401
  searchTerm: e,
402
402
  visibility: i,
403
403
  verification: n,
404
404
  sortMethod: o
405
405
  }) => {
406
- const a = e.trim().toLowerCase(), d = n ?? [];
407
- let c = t;
408
- if (a && (c = c.filter((u) => (u.title || u.name).toLowerCase().includes(a))), i && i !== "all" && (c = c.filter((u) => i === "private" ? u.isPrivate : !u.isPrivate)), d.length > 0 && (c = c.filter((u) => {
409
- const v = d.includes("official") && u.isOfficial, C = d.includes("verified") && u.isVerified;
410
- return v || C;
406
+ const a = e.trim().toLowerCase(), l = n ?? [];
407
+ let r = t;
408
+ if (a && (r = r.filter((d) => (d.title || d.name).toLowerCase().includes(a))), i && i !== "all" && (r = r.filter((d) => i === "private" ? d.isPrivate : !d.isPrivate)), l.length > 0 && (r = r.filter((d) => {
409
+ const p = l.includes("official") && d.isOfficial, v = l.includes("verified") && d.isVerified;
410
+ return p || v;
411
411
  })), !o)
412
- return c;
413
- const r = (u) => (u.title || u.name).toLowerCase(), l = (u) => u.updatedAt ? new Date(u.updatedAt).getTime() : 0;
414
- return [...c].sort((u, v) => o === "asc" ? r(u).localeCompare(r(v), void 0, { sensitivity: "base" }) : o === "desc" ? r(v).localeCompare(r(u), void 0, { sensitivity: "base" }) : o === "newest" ? l(v) - l(u) : l(u) - l(v));
415
- }, wn = (t) => {
412
+ return r;
413
+ const c = (d) => (d.title || d.name).toLowerCase(), g = (d) => d.updatedAt ? new Date(d.updatedAt).getTime() : 0;
414
+ return [...r].sort((d, p) => o === "asc" ? c(d).localeCompare(c(p), void 0, { sensitivity: "base" }) : o === "desc" ? c(p).localeCompare(c(d), void 0, { sensitivity: "base" }) : o === "newest" ? g(p) - g(d) : g(d) - g(p));
415
+ }, An = (t) => {
416
416
  const e = /* @__PURE__ */ new Map();
417
417
  for (const i of t)
418
418
  e.set(i.id, i);
419
419
  return [...e.values()];
420
- }, Ht = ({
420
+ }, Rt = ({
421
421
  client: t,
422
422
  botId: e,
423
423
  transformIntegrationPatch: i
424
424
  }) => async (n, o) => {
425
- const a = i == null ? void 0 : i[n], d = a ? await a(o) : o;
426
- await t.updateBot({ id: e, integrations: d });
427
- }, ze = (t, e) => ["integration-hub", t, e], Re = (t) => {
425
+ const a = i == null ? void 0 : i[n], l = a ? await a(o) : o;
426
+ await t.updateBot({ id: e, integrations: l });
427
+ }, qe = (t, e) => ["integration-hub", t, e], Qe = (t) => {
428
428
  var i;
429
429
  if (!t || typeof t != "object")
430
430
  return !1;
431
431
  const e = t;
432
432
  return e.status === 404 || e.statusCode === 404 || ((i = e.response) == null ? void 0 : i.status) === 404;
433
- }, qe = async ({
433
+ }, We = async ({
434
434
  client: t,
435
435
  integrationId: e
436
436
  }) => {
437
437
  try {
438
438
  return (await t.getPublicIntegrationById({ id: e })).integration;
439
439
  } catch (i) {
440
- if (!Re(i))
440
+ if (!Qe(i))
441
441
  throw i;
442
442
  return (await t.getIntegration({ id: e })).integration;
443
443
  }
444
- }, Qe = ({
444
+ }, $e = ({
445
445
  installedIntegrations: t,
446
446
  integrationId: e,
447
447
  integrationName: i
448
- }) => yt({
448
+ }) => It({
449
449
  installedIntegrations: t,
450
450
  integrationId: e,
451
451
  integrationName: i
452
- }) ?? null, We = async ({ client: t, botId: e, integrationId: i }) => {
452
+ }) ?? null, Ge = async ({ client: t, botId: e, integrationId: i }) => {
453
453
  if (!i)
454
454
  return null;
455
455
  const [n, o] = await Promise.all([
456
- qe({ client: t, integrationId: i }),
456
+ We({ client: t, integrationId: i }),
457
457
  t.getBot({ id: e })
458
- ]), a = ot(o.bot.integrations), d = Qe({
458
+ ]), a = ot(o.bot.integrations), l = $e({
459
459
  installedIntegrations: a,
460
460
  integrationId: i,
461
461
  integrationName: n.name
462
- }), c = _e(n);
462
+ }), r = He(n);
463
463
  return {
464
464
  definition: n,
465
- installedState: d,
466
- capabilities: je(n),
467
- connectionMethods: c,
468
- selectedConnectionMethod: Ke({ installedState: d, connectionMethods: c })
465
+ installedState: l,
466
+ capabilities: Ke(n),
467
+ connectionMethods: r,
468
+ selectedConnectionMethod: ze({ installedState: l, connectionMethods: r })
469
469
  };
470
- }, zt = ({
470
+ }, qt = ({
471
471
  client: t,
472
472
  workspaceId: e,
473
473
  botId: i,
@@ -475,71 +475,71 @@ const Te = "width=650,height=800,popup=true", Oe = 500, Pe = 5 * 60 * 1e3, Be =
475
475
  enabled: o = !0,
476
476
  transformIntegrationPatch: a
477
477
  }) => {
478
- const d = kt(), c = F(() => ze(e, i), [e, i]), { data: r, isLoading: l, error: u, refetch: v } = Et({
479
- queryKey: [...c, "details", n],
478
+ const l = Nt(), r = V(() => qe(e, i), [e, i]), { data: c, isLoading: g, error: d, refetch: p } = Vt({
479
+ queryKey: [...r, "details", n],
480
480
  enabled: o && !!n,
481
- queryFn: () => We({ client: t, workspaceId: e, botId: i, integrationId: n, enabled: o })
482
- }), C = N(async () => {
483
- await d.invalidateQueries({ queryKey: c });
484
- }, [d, c]), S = () => {
485
- if (!(r != null && r.installedState))
481
+ queryFn: () => Ge({ client: t, workspaceId: e, botId: i, integrationId: n, enabled: o })
482
+ }), v = N(async () => {
483
+ await l.invalidateQueries({ queryKey: r });
484
+ }, [l, r]), A = () => {
485
+ if (!(c != null && c.installedState))
486
486
  throw new Error("Integration is not installed on this bot");
487
- return r.installedState;
488
- }, T = Ht({ client: t, botId: i, transformIntegrationPatch: a }), O = Q({
489
- mutationFn: async (g) => {
490
- const M = S();
491
- await T("configure", {
487
+ return c.installedState;
488
+ }, P = Rt({ client: t, botId: i, transformIntegrationPatch: a }), T = q({
489
+ mutationFn: async (f) => {
490
+ const M = A();
491
+ await P("configure", {
492
492
  [M.integrationAlias]: {
493
- configuration: g,
493
+ configuration: f,
494
494
  configurationType: M.configurationType ?? null
495
495
  }
496
496
  });
497
497
  },
498
- onSuccess: C
499
- }), B = Q({
498
+ onSuccess: v
499
+ }), U = q({
500
500
  mutationFn: async () => {
501
- const g = S(), M = g.enabled ? "disable" : "enable";
502
- await T(M, {
503
- [g.integrationAlias]: {
504
- enabled: !g.enabled
501
+ const f = A(), M = f.enabled ? "disable" : "enable";
502
+ await P(M, {
503
+ [f.integrationAlias]: {
504
+ enabled: !f.enabled
505
505
  }
506
506
  });
507
507
  },
508
- onSuccess: C
509
- }), h = Q({
510
- mutationFn: async (g) => {
511
- const M = S();
512
- await T("configure", {
508
+ onSuccess: v
509
+ }), b = q({
510
+ mutationFn: async (f) => {
511
+ const M = A();
512
+ await P("configure", {
513
513
  [M.integrationAlias]: {
514
- configurationType: g
514
+ configurationType: f
515
515
  }
516
516
  });
517
517
  },
518
- onSuccess: C
518
+ onSuccess: v
519
519
  });
520
520
  return {
521
- definition: (r == null ? void 0 : r.definition) ?? null,
522
- installedState: (r == null ? void 0 : r.installedState) ?? null,
523
- selectedConnectionMethod: (r == null ? void 0 : r.selectedConnectionMethod) ?? null,
524
- capabilities: (r == null ? void 0 : r.capabilities) ?? {
521
+ definition: (c == null ? void 0 : c.definition) ?? null,
522
+ installedState: (c == null ? void 0 : c.installedState) ?? null,
523
+ selectedConnectionMethod: (c == null ? void 0 : c.selectedConnectionMethod) ?? null,
524
+ capabilities: (c == null ? void 0 : c.capabilities) ?? {
525
525
  actionCards: [],
526
526
  eventCards: [],
527
527
  channelCards: []
528
528
  },
529
- connectionMethods: (r == null ? void 0 : r.connectionMethods) ?? [],
530
- isLoading: l,
531
- error: u ? Ct(u) : null,
532
- saveConfig: O.mutateAsync,
533
- toggleEnabled: B.mutateAsync,
534
- setConnectionMethod: h.mutateAsync,
529
+ connectionMethods: (c == null ? void 0 : c.connectionMethods) ?? [],
530
+ isLoading: g,
531
+ error: d ? wt(d) : null,
532
+ saveConfig: T.mutateAsync,
533
+ toggleEnabled: U.mutateAsync,
534
+ setConnectionMethod: b.mutateAsync,
535
535
  refresh: () => {
536
- v();
536
+ p();
537
537
  },
538
- isSavingConfig: O.isPending,
539
- isTogglingEnabled: B.isPending,
540
- isSettingConnectionMethod: h.isPending
538
+ isSavingConfig: T.isPending,
539
+ isTogglingEnabled: U.isPending,
540
+ isSettingConnectionMethod: b.isPending
541
541
  };
542
- }, Sn = zt, Rt = 100, qt = 200, $e = (t, e) => ["integration-hub", t, e], Ge = ({
542
+ }, Mn = qt, Qt = 100, Wt = 200, Je = (t, e) => ["integration-hub", t, e], Ze = ({
543
543
  publicIntegrations: t,
544
544
  privateIntegrations: e
545
545
  }) => {
@@ -549,38 +549,38 @@ const Te = "width=650,height=800,popup=true", Oe = 500, Pe = 5 * 60 * 1e3, Be =
549
549
  for (const n of e)
550
550
  i.set(n.id, n);
551
551
  return [...i.values()];
552
- }, Je = async ({ client: t }) => {
552
+ }, Xe = async ({ client: t }) => {
553
553
  const e = [];
554
554
  let i, n = 0;
555
555
  do {
556
556
  const o = i, a = await t.listPublicIntegrations({
557
- limit: Rt,
557
+ limit: Qt,
558
558
  version: "latest",
559
559
  nextToken: i
560
560
  });
561
- if (e.push(...a.integrations), i = a.meta.nextToken, n += 1, n >= qt)
561
+ if (e.push(...a.integrations), i = a.meta.nextToken, n += 1, n >= Wt)
562
562
  throw new Error("Public integration pagination exceeded safety limit");
563
563
  if (i && i === o)
564
564
  break;
565
565
  } while (i);
566
566
  return e;
567
- }, Ze = async ({ client: t }) => {
567
+ }, Ye = async ({ client: t }) => {
568
568
  const e = [];
569
569
  let i, n = 0;
570
570
  do {
571
571
  const o = i, a = await t.listIntegrations({
572
- limit: Rt,
572
+ limit: Qt,
573
573
  version: "latest",
574
574
  visibility: "private",
575
575
  nextToken: i
576
576
  });
577
- if (e.push(...a.integrations), i = a.meta.nextToken, n += 1, n >= qt)
577
+ if (e.push(...a.integrations), i = a.meta.nextToken, n += 1, n >= Wt)
578
578
  throw new Error("Private integration pagination exceeded safety limit");
579
579
  if (i && i === o)
580
580
  break;
581
581
  } while (i);
582
582
  return e;
583
- }, Xe = async ({
583
+ }, me = async ({
584
584
  client: t,
585
585
  integrationId: e
586
586
  }) => {
@@ -593,35 +593,35 @@ const Te = "width=650,height=800,popup=true", Oe = 500, Pe = 5 * 60 * 1e3, Be =
593
593
  return;
594
594
  }
595
595
  }
596
- }, Ye = ({
596
+ }, tn = ({
597
597
  integrationId: t,
598
598
  installedIntegrations: e
599
599
  }) => {
600
- const i = yt({ installedIntegrations: e, integrationId: t });
600
+ const i = It({ installedIntegrations: e, integrationId: t });
601
601
  return (i == null ? void 0 : i.integrationAlias) ?? t;
602
- }, me = async ({ client: t, botId: e, categoryResolver: i }) => {
602
+ }, en = async ({ client: t, botId: e, categoryResolver: i }) => {
603
603
  const [n, o, a] = await Promise.all([
604
- Je({ client: t }),
605
- Ze({ client: t }),
604
+ Xe({ client: t }),
605
+ Ye({ client: t }),
606
606
  t.getBot({ id: e })
607
- ]), d = ot(a.bot.integrations), c = Ge({ publicIntegrations: n, privateIntegrations: o }), r = new Map(d.map((C) => [C.name, C])), l = new Map(c.map((C) => [C.name, C])), u = c.map(
608
- (C) => Ve({
609
- summary: C,
610
- installedByName: r,
607
+ ]), l = ot(a.bot.integrations), r = Ze({ publicIntegrations: n, privateIntegrations: o }), c = new Map(l.map((v) => [v.name, v])), g = new Map(r.map((v) => [v.name, v])), d = r.map(
608
+ (v) => je({
609
+ summary: v,
610
+ installedByName: c,
611
611
  categoryResolver: i
612
612
  })
613
- ), v = d.map(
614
- (C) => Fe({
615
- installedIntegration: C,
616
- summary: l.get(C.name),
613
+ ), p = l.map(
614
+ (v) => _e({
615
+ installedIntegration: v,
616
+ summary: g.get(v.name),
617
617
  categoryResolver: i
618
618
  })
619
619
  );
620
620
  return {
621
- integrations: u,
622
- installedIntegrations: v
621
+ integrations: d,
622
+ installedIntegrations: p
623
623
  };
624
- }, Qt = ({
624
+ }, $t = ({
625
625
  client: t,
626
626
  workspaceId: e,
627
627
  botId: i,
@@ -629,93 +629,93 @@ const Te = "width=650,height=800,popup=true", Oe = 500, Pe = 5 * 60 * 1e3, Be =
629
629
  enabled: o = !0,
630
630
  transformIntegrationPatch: a
631
631
  }) => {
632
- const d = kt(), c = F(() => $e(e, i), [e, i]), r = G(Promise.resolve()), { data: l, isLoading: u, error: v, refetch: C } = Et({
633
- queryKey: [...c, "catalog"],
632
+ const l = Nt(), r = V(() => Je(e, i), [e, i]), c = W(Promise.resolve()), { data: g, isLoading: d, error: p, refetch: v } = Vt({
633
+ queryKey: [...r, "catalog"],
634
634
  enabled: o,
635
- queryFn: () => me({ client: t, workspaceId: e, botId: i, categoryResolver: n })
636
- }), S = N(async () => {
637
- await d.invalidateQueries({ queryKey: c });
638
- }, [d, c]), T = N(async (p) => {
639
- const A = r.current.then(p, p);
640
- return r.current = A.then(
635
+ queryFn: () => en({ client: t, workspaceId: e, botId: i, categoryResolver: n })
636
+ }), A = N(async () => {
637
+ await l.invalidateQueries({ queryKey: r });
638
+ }, [l, r]), P = N(async (h) => {
639
+ const S = c.current.then(h, h);
640
+ return c.current = S.then(
641
641
  () => {
642
642
  },
643
643
  () => {
644
644
  }
645
- ), A;
646
- }, []), O = Ht({ client: t, botId: i, transformIntegrationPatch: a }), B = async (p) => {
647
- const { bot: A } = await t.getBot({ id: i }), k = ot(A.integrations);
648
- return Ye({ integrationId: p, installedIntegrations: k });
649
- }, h = Q({
650
- mutationFn: async (p) => {
651
- await T(async () => {
652
- await O("install", { [p]: { enabled: !0 } });
645
+ ), S;
646
+ }, []), T = Rt({ client: t, botId: i, transformIntegrationPatch: a }), U = async (h) => {
647
+ const { bot: S } = await t.getBot({ id: i }), L = ot(S.integrations);
648
+ return tn({ integrationId: h, installedIntegrations: L });
649
+ }, b = q({
650
+ mutationFn: async (h) => {
651
+ await P(async () => {
652
+ await T("install", { [h]: { enabled: !0 } });
653
653
  });
654
654
  },
655
- onSuccess: S
656
- }), g = Q({
657
- mutationFn: async (p) => {
658
- await T(async () => {
659
- const A = await B(p);
660
- await O("uninstall", { [A]: null });
655
+ onSuccess: A
656
+ }), f = q({
657
+ mutationFn: async (h) => {
658
+ await P(async () => {
659
+ const S = await U(h);
660
+ await T("uninstall", { [S]: null });
661
661
  });
662
662
  },
663
- onSuccess: S
664
- }), M = Q({
665
- mutationFn: async (p) => {
666
- await T(async () => {
667
- const A = await B(p);
668
- await O("enable", { [A]: { enabled: !0 } });
663
+ onSuccess: A
664
+ }), M = q({
665
+ mutationFn: async (h) => {
666
+ await P(async () => {
667
+ const S = await U(h);
668
+ await T("enable", { [S]: { enabled: !0 } });
669
669
  });
670
670
  },
671
- onSuccess: S
672
- }), j = Q({
673
- mutationFn: async (p) => {
674
- await T(async () => {
675
- const A = await B(p);
676
- await O("disable", { [A]: { enabled: !1 } });
671
+ onSuccess: A
672
+ }), K = q({
673
+ mutationFn: async (h) => {
674
+ await P(async () => {
675
+ const S = await U(h);
676
+ await T("disable", { [S]: { enabled: !1 } });
677
677
  });
678
678
  },
679
- onSuccess: S
680
- }), _ = Q({
681
- mutationFn: async (p) => {
682
- await T(async () => {
683
- const { bot: A } = await t.getBot({ id: i }), k = ot(A.integrations), y = await Xe({ client: t, integrationId: p }), P = yt({
684
- installedIntegrations: k,
685
- integrationId: p,
679
+ onSuccess: A
680
+ }), F = q({
681
+ mutationFn: async (h) => {
682
+ await P(async () => {
683
+ const { bot: S } = await t.getBot({ id: i }), L = ot(S.integrations), y = await me({ client: t, integrationId: h }), O = It({
684
+ installedIntegrations: L,
685
+ integrationId: h,
686
686
  integrationName: y
687
- }), V = {
688
- enabled: (P == null ? void 0 : P.enabled) ?? !0,
689
- configuration: (P == null ? void 0 : P.configuration) ?? {},
690
- configurationType: (P == null ? void 0 : P.configurationType) ?? null
691
- }, J = {
692
- [p]: V
687
+ }), j = {
688
+ enabled: (O == null ? void 0 : O.enabled) ?? !0,
689
+ configuration: (O == null ? void 0 : O.configuration) ?? {},
690
+ configurationType: (O == null ? void 0 : O.configurationType) ?? null
691
+ }, $ = {
692
+ [h]: j
693
693
  };
694
- P && P.integrationAlias !== p && (J[P.integrationAlias] = null), await O("upgrade", J);
694
+ O && O.integrationAlias !== h && ($[O.integrationAlias] = null), await T("upgrade", $);
695
695
  });
696
696
  },
697
- onSuccess: S
697
+ onSuccess: A
698
698
  });
699
699
  return {
700
- integrations: (l == null ? void 0 : l.integrations) ?? [],
701
- installedIntegrations: (l == null ? void 0 : l.installedIntegrations) ?? [],
702
- isLoading: u,
703
- error: v ? Ct(v) : null,
704
- install: h.mutateAsync,
705
- uninstall: g.mutateAsync,
700
+ integrations: (g == null ? void 0 : g.integrations) ?? [],
701
+ installedIntegrations: (g == null ? void 0 : g.installedIntegrations) ?? [],
702
+ isLoading: d,
703
+ error: p ? wt(p) : null,
704
+ install: b.mutateAsync,
705
+ uninstall: f.mutateAsync,
706
706
  enable: M.mutateAsync,
707
- disable: j.mutateAsync,
708
- upgrade: _.mutateAsync,
707
+ disable: K.mutateAsync,
708
+ upgrade: F.mutateAsync,
709
709
  refresh: () => {
710
- C();
710
+ v();
711
711
  },
712
- isInstalling: h.isPending,
713
- isUninstalling: g.isPending,
712
+ isInstalling: b.isPending,
713
+ isUninstalling: f.isPending,
714
714
  isEnabling: M.isPending,
715
- isDisabling: j.isPending,
716
- isUpgrading: _.isPending
715
+ isDisabling: K.isPending,
716
+ isUpgrading: F.isPending
717
717
  };
718
- }, An = Qt, tn = ["hub", "installed"], en = (t, e) => `integration-hub:nav:${t}:${e}`, xt = (t) => {
718
+ }, Tn = $t, nn = ["hub", "installed"], on = (t, e) => `integration-hub:nav:${t}:${e}`, Dt = (t) => {
719
719
  try {
720
720
  const e = sessionStorage.getItem(t);
721
721
  if (!e)
@@ -724,11 +724,11 @@ const Te = "width=650,height=800,popup=true", Oe = 500, Pe = 5 * 60 * 1e3, Be =
724
724
  if (typeof i != "object" || i === null)
725
725
  return null;
726
726
  const n = i, o = {};
727
- return typeof n.view == "string" && tn.includes(n.view) && (o.view = n.view), (typeof n.selectedIntegrationId == "string" || n.selectedIntegrationId === null) && (o.selectedIntegrationId = n.selectedIntegrationId), (typeof n.selectedDefinitionId == "string" || n.selectedDefinitionId === null) && (o.selectedDefinitionId = n.selectedDefinitionId), typeof n.searchInput == "string" && (o.searchInput = n.searchInput), typeof n.visibility == "string" ? o.visibility = n.visibility : "visibility" in n && (o.visibility = void 0), Array.isArray(n.verification) && n.verification.every((a) => typeof a == "string") ? o.verification = n.verification : "verification" in n && (o.verification = void 0), typeof n.sortMethod == "string" ? o.sortMethod = n.sortMethod : "sortMethod" in n && (o.sortMethod = void 0), typeof n.selectedCategory == "string" ? o.selectedCategory = n.selectedCategory : "selectedCategory" in n && (o.selectedCategory = void 0), o;
727
+ return typeof n.view == "string" && nn.includes(n.view) && (o.view = n.view), (typeof n.selectedIntegrationId == "string" || n.selectedIntegrationId === null) && (o.selectedIntegrationId = n.selectedIntegrationId), (typeof n.selectedDefinitionId == "string" || n.selectedDefinitionId === null) && (o.selectedDefinitionId = n.selectedDefinitionId), typeof n.searchInput == "string" && (o.searchInput = n.searchInput), typeof n.visibility == "string" ? o.visibility = n.visibility : "visibility" in n && (o.visibility = void 0), Array.isArray(n.verification) && n.verification.every((a) => typeof a == "string") ? o.verification = n.verification : "verification" in n && (o.verification = void 0), typeof n.sortMethod == "string" ? o.sortMethod = n.sortMethod : "sortMethod" in n && (o.sortMethod = void 0), typeof n.selectedCategory == "string" ? o.selectedCategory = n.selectedCategory : "selectedCategory" in n && (o.selectedCategory = void 0), o;
728
728
  } catch {
729
729
  return null;
730
730
  }
731
- }, nn = (t, e) => {
731
+ }, an = (t, e) => {
732
732
  try {
733
733
  sessionStorage.setItem(
734
734
  t,
@@ -736,7 +736,7 @@ const Te = "width=650,height=800,popup=true", Oe = 500, Pe = 5 * 60 * 1e3, Be =
736
736
  );
737
737
  } catch {
738
738
  }
739
- }, Dt = (t, e) => ({
739
+ }, Lt = (t, e) => ({
740
740
  view: (t == null ? void 0 : t.view) ?? e.initialView,
741
741
  selectedIntegrationId: (t == null ? void 0 : t.selectedIntegrationId) ?? null,
742
742
  selectedDefinitionId: (t == null ? void 0 : t.selectedDefinitionId) ?? null,
@@ -745,553 +745,561 @@ const Te = "width=650,height=800,popup=true", Oe = 500, Pe = 5 * 60 * 1e3, Be =
745
745
  verification: t && "verification" in t ? t.verification ? [...t.verification] : void 0 : e.defaultVerification,
746
746
  sortMethod: t && "sortMethod" in t ? t.sortMethod : e.defaultSortMethod,
747
747
  selectedCategory: t == null ? void 0 : t.selectedCategory
748
- }), on = ({
748
+ }), sn = ({
749
749
  workspaceId: t,
750
750
  botId: e,
751
751
  enabled: i,
752
752
  defaults: n
753
753
  }) => {
754
- const o = en(t, e), a = G(null);
754
+ const o = on(t, e), a = W(null);
755
755
  if (a.current === null) {
756
- const f = i ? xt(o) : null;
757
- a.current = Dt(f, n);
756
+ const u = i ? Dt(o) : null;
757
+ a.current = Lt(u, n);
758
758
  }
759
- const [d, c] = x(a.current.view), [r, l] = x(
759
+ const [l, r] = x(a.current.view), [c, g] = x(
760
760
  a.current.selectedIntegrationId
761
- ), [u, v] = x(
761
+ ), [d, p] = x(
762
762
  a.current.selectedDefinitionId
763
- ), [C, S] = x(a.current.searchInput), [T, O] = x(a.current.visibility), [B, h] = x(a.current.verification), [g, M] = x(a.current.sortMethod), [j, _] = x(
763
+ ), [v, A] = x(a.current.searchInput), [P, T] = x(a.current.visibility), [U, b] = x(a.current.verification), [f, M] = x(a.current.sortMethod), [K, F] = x(
764
764
  a.current.selectedCategory
765
- ), p = G(a.current), A = G(i);
766
- A.current = i;
767
- const k = G(o);
765
+ ), h = W(a.current), S = W(i);
766
+ S.current = i;
767
+ const L = W(o);
768
768
  Z(() => {
769
- if (o === k.current)
769
+ if (o === L.current)
770
770
  return;
771
- k.current = o;
772
- const f = i ? xt(o) : null, E = Dt(f, n);
773
- p.current = E, c(E.view), l(E.selectedIntegrationId), v(E.selectedDefinitionId), S(E.searchInput), O(E.visibility), h(E.verification), M(E.sortMethod), _(E.selectedCategory);
771
+ L.current = o;
772
+ const u = i ? Dt(o) : null, E = Lt(u, n);
773
+ h.current = E, r(E.view), g(E.selectedIntegrationId), p(E.selectedDefinitionId), A(E.searchInput), T(E.visibility), b(E.verification), M(E.sortMethod), F(E.selectedCategory);
774
774
  }, [o, i, n]);
775
- const y = N((f) => {
776
- f.verification !== void 0 && (f = { ...f, verification: f.verification ? [...f.verification] : void 0 }), Object.assign(p.current, f), A.current && nn(k.current, p.current);
777
- }, []), P = N(
778
- (f) => {
779
- c(f), y({ view: f });
775
+ const y = N((u) => {
776
+ u.verification !== void 0 && (u = { ...u, verification: u.verification ? [...u.verification] : void 0 }), Object.assign(h.current, u), S.current && an(L.current, h.current);
777
+ }, []), O = N(
778
+ (u) => {
779
+ r(u), y({ view: u });
780
780
  },
781
781
  [y]
782
- ), V = N(
783
- (f) => {
784
- l(f), y({ selectedIntegrationId: f });
782
+ ), j = N(
783
+ (u) => {
784
+ g(u), y({ selectedIntegrationId: u });
785
785
  },
786
786
  [y]
787
- ), J = N(
788
- (f) => {
789
- v(f), y({ selectedDefinitionId: f });
787
+ ), $ = N(
788
+ (u) => {
789
+ p(u), y({ selectedDefinitionId: u });
790
790
  },
791
791
  [y]
792
- ), at = N(
793
- (f) => {
794
- S(f), y({ searchInput: f });
792
+ ), G = N(
793
+ (u) => {
794
+ A(u), y({ searchInput: u });
795
795
  },
796
796
  [y]
797
- ), X = N(
798
- (f) => {
799
- O(f), y({ visibility: f });
797
+ ), at = N(
798
+ (u) => {
799
+ T(u), y({ visibility: u });
800
800
  },
801
801
  [y]
802
- ), Y = N(
803
- (f) => {
804
- h(f), y({ verification: f });
802
+ ), st = N(
803
+ (u) => {
804
+ b(u), y({ verification: u });
805
805
  },
806
806
  [y]
807
- ), K = N(
808
- (f) => {
809
- M(f), y({ sortMethod: f });
807
+ ), X = N(
808
+ (u) => {
809
+ M(u), y({ sortMethod: u });
810
810
  },
811
811
  [y]
812
- ), H = N(
813
- (f) => {
814
- _(f), y({ selectedCategory: f });
812
+ ), Y = N(
813
+ (u) => {
814
+ F(u), y({ selectedCategory: u });
815
815
  },
816
816
  [y]
817
817
  );
818
818
  return {
819
- view: d,
820
- setView: P,
821
- selectedIntegrationId: r,
822
- setSelectedIntegrationId: V,
823
- selectedDefinitionId: u,
824
- setSelectedDefinitionId: J,
825
- searchInput: C,
826
- setSearchInput: at,
827
- visibility: T,
828
- setVisibility: X,
829
- verification: B,
830
- setVerification: Y,
831
- sortMethod: g,
832
- setSortMethod: K,
833
- selectedCategory: j,
834
- setSelectedCategory: H
819
+ view: l,
820
+ setView: O,
821
+ selectedIntegrationId: c,
822
+ setSelectedIntegrationId: j,
823
+ selectedDefinitionId: d,
824
+ setSelectedDefinitionId: $,
825
+ searchInput: v,
826
+ setSearchInput: G,
827
+ visibility: P,
828
+ setVisibility: at,
829
+ verification: U,
830
+ setVerification: st,
831
+ sortMethod: f,
832
+ setSortMethod: X,
833
+ selectedCategory: K,
834
+ setSelectedCategory: Y
835
835
  };
836
- }, an = ["official", "verified"], sn = () => /* @__PURE__ */ I("div", { className: "flex items-center justify-center py-16", children: /* @__PURE__ */ I(Lt, { className: "h-6 w-6 animate-spin text-[var(--gray-9)]" }) }), rn = () => /* @__PURE__ */ I("div", { className: "flex items-center justify-center py-16 text-sm text-[var(--gray-11)]", children: "Integration details are unavailable for this selection." }), cn = (t) => t ? {
836
+ }, rn = ["official", "verified"], cn = () => /* @__PURE__ */ w("div", { className: "flex items-center justify-center py-16", children: /* @__PURE__ */ w(Et, { className: "h-6 w-6 animate-spin text-[var(--gray-9)]" }) }), ln = () => /* @__PURE__ */ w("div", { className: "flex items-center justify-center py-16 text-sm text-[var(--gray-11)]", children: "Integration details are unavailable for this selection." }), dn = (t) => t ? {
837
837
  key: t.key,
838
838
  type: t.type
839
- } : null, ln = ({
839
+ } : null, un = ({
840
840
  definition: t,
841
841
  selectedConnectionMethod: e
842
842
  }) => {
843
- var i, n, o, a, d;
844
- return e ? ((o = (n = (i = t.configurations) == null ? void 0 : i[e]) == null ? void 0 : n.identifier) == null ? void 0 : o.linkTemplateScript) ?? null : ((d = (a = t.configuration) == null ? void 0 : a.identifier) == null ? void 0 : d.linkTemplateScript) ?? null;
845
- }, dn = ({
843
+ var i, n, o, a, l;
844
+ return e ? ((o = (n = (i = t.configurations) == null ? void 0 : i[e]) == null ? void 0 : n.identifier) == null ? void 0 : o.linkTemplateScript) ?? null : ((l = (a = t.configuration) == null ? void 0 : a.identifier) == null ? void 0 : l.linkTemplateScript) ?? null;
845
+ }, fn = ({
846
846
  client: t,
847
847
  workspaceId: e,
848
848
  botId: i,
849
- initialView: n,
850
- categories: o,
851
- bannerSlides: a,
852
- bannerIconUrl: d,
853
- noResultsDocumentationLink: c,
854
- disableInstallation: r = !1,
855
- hasWriteAccess: l = !0,
856
- transformIntegrationPatch: u,
857
- categoryResolver: v,
858
- filterMenuLabels: C,
859
- defaultVisibility: S,
860
- defaultVerification: T,
861
- defaultSortMethod: O,
862
- renderConfigurationForm: B,
863
- renderConnectionsContent: h,
864
- oauthTemplateData: g,
865
- renderDetailPanel: M,
866
- renderNotifications: j,
867
- onShare: _,
868
- onInstall: p,
869
- onUninstall: A,
870
- onEnable: k,
871
- onDisable: y,
872
- onUpgrade: P,
873
- onError: V,
874
- persistNavigationState: J = !1
849
+ headerTitle: n,
850
+ headerIconUrl: o,
851
+ initialView: a,
852
+ categories: l,
853
+ bannerSlides: r,
854
+ bannerIconUrl: c,
855
+ noResultsDocumentationLink: g,
856
+ disableInstallation: d = !1,
857
+ hasWriteAccess: p = !0,
858
+ transformIntegrationPatch: v,
859
+ categoryResolver: A,
860
+ filterMenuLabels: P,
861
+ defaultVisibility: T,
862
+ defaultVerification: U,
863
+ defaultSortMethod: b,
864
+ renderConfigurationForm: f,
865
+ renderConnectionsContent: M,
866
+ oauthTemplateData: K,
867
+ renderDetailPanel: F,
868
+ renderNotifications: h,
869
+ onShare: S,
870
+ onInstall: L,
871
+ onUninstall: y,
872
+ onEnable: O,
873
+ onDisable: j,
874
+ onUpgrade: $,
875
+ onError: G,
876
+ persistNavigationState: at = !1
875
877
  }) => {
876
- var It;
877
- const at = F(
878
+ var St;
879
+ const st = V(
878
880
  () => ({
879
- initialView: n ?? "hub",
880
- defaultVisibility: S,
881
- defaultVerification: T ?? [...an],
882
- defaultSortMethod: O
881
+ initialView: a ?? "hub",
882
+ defaultVisibility: T,
883
+ defaultVerification: U ?? [...rn],
884
+ defaultSortMethod: b
883
885
  }),
884
- [n, S, T, O]
886
+ [a, T, U, b]
885
887
  ), {
886
888
  view: X,
887
889
  setView: Y,
888
- selectedIntegrationId: K,
889
- setSelectedIntegrationId: H,
890
- selectedDefinitionId: f,
891
- setSelectedDefinitionId: E,
890
+ selectedIntegrationId: u,
891
+ setSelectedIntegrationId: E,
892
+ selectedDefinitionId: rt,
893
+ setSelectedDefinitionId: J,
892
894
  searchInput: m,
893
- setSearchInput: Wt,
894
- visibility: st,
895
- setVisibility: $t,
896
- verification: rt,
897
- setVerification: Gt,
898
- sortMethod: ct,
899
- setSortMethod: Jt,
900
- selectedCategory: Zt,
901
- setSelectedCategory: Xt
902
- } = on({
895
+ setSearchInput: Gt,
896
+ visibility: ct,
897
+ setVisibility: Jt,
898
+ verification: lt,
899
+ setVerification: Zt,
900
+ sortMethod: dt,
901
+ setSortMethod: Xt,
902
+ selectedCategory: Yt,
903
+ setSelectedCategory: mt
904
+ } = sn({
903
905
  workspaceId: e,
904
906
  botId: i,
905
- enabled: J,
906
- defaults: at
907
- }), [lt, z] = x(null), [Yt, W] = x(!1), [mt, dt] = x("connections"), [te, ut] = x("connections"), w = Qt({
907
+ enabled: at,
908
+ defaults: st
909
+ }), [ut, H] = x(null), [te, Q] = x(!1), [ee, ft] = x("connections"), [ne, gt] = x("connections"), I = $t({
908
910
  client: t,
909
911
  workspaceId: e,
910
912
  botId: i,
911
- categoryResolver: v,
913
+ categoryResolver: A,
912
914
  enabled: !0,
913
- transformIntegrationPatch: u
914
- }), ee = F(
915
- () => He({
916
- integrations: w.integrations,
915
+ transformIntegrationPatch: v
916
+ }), ie = V(
917
+ () => Re({
918
+ integrations: I.integrations,
917
919
  searchTerm: m,
918
- visibility: st,
919
- verification: rt,
920
- sortMethod: ct
920
+ visibility: ct,
921
+ verification: lt,
922
+ sortMethod: dt
921
923
  }),
922
- [w.integrations, m, st, rt, ct]
923
- ), D = F(
924
- () => [...w.integrations, ...w.installedIntegrations].find(
925
- (b) => b.id === K
924
+ [I.integrations, m, ct, lt, dt]
925
+ ), k = V(
926
+ () => [...I.integrations, ...I.installedIntegrations].find(
927
+ (C) => C.id === u
926
928
  ) ?? null,
927
- [w.integrations, w.installedIntegrations, K]
929
+ [I.integrations, I.installedIntegrations, u]
928
930
  );
929
931
  Z(() => {
930
- K && !w.isLoading && !D && (H(null), E(null));
931
- }, [K, D, w.isLoading, H, E]);
932
- const s = zt({
932
+ u && !I.isLoading && !k && (E(null), J(null));
933
+ }, [u, k, I.isLoading, E, J]);
934
+ const s = qt({
933
935
  client: t,
934
936
  workspaceId: e,
935
937
  botId: i,
936
- integrationId: f,
937
- enabled: !!f,
938
- transformIntegrationPatch: u
939
- }), ne = F(
940
- () => (o == null ? void 0 : o.filter((b) => b.name !== "Popular").map((b) => b.name)) ?? [],
941
- [o]
942
- ), { readme: ie, isLoading: oe } = fe((It = s.definition) == null ? void 0 : It.readmeUrl);
938
+ integrationId: rt,
939
+ enabled: !!rt,
940
+ transformIntegrationPatch: v
941
+ }), oe = V(
942
+ () => (l == null ? void 0 : l.filter((C) => C.name !== "Popular").map((C) => C.name)) ?? [],
943
+ [l]
944
+ ), { readme: ae, isLoading: se } = pe((St = s.definition) == null ? void 0 : St.readmeUrl);
943
945
  Z(() => {
944
- W(!1), z(null);
945
- }, [f]);
946
+ Q(!1), H(null);
947
+ }, [rt]);
946
948
  const tt = N(
947
- (b) => {
948
- const U = Ct(b);
949
- V == null || V(U);
949
+ (C) => {
950
+ const B = wt(C);
951
+ G == null || G(B);
950
952
  },
951
- [V]
953
+ [G]
952
954
  ), et = async ({
953
- operation: b,
954
- onSuccess: U,
955
- integration: R
955
+ operation: C,
956
+ onSuccess: B,
957
+ integration: z
956
958
  }) => {
957
- const q = R ?? D;
958
- if (q)
959
+ const R = z ?? k;
960
+ if (R)
959
961
  try {
960
- await b(), U == null || U(q);
961
- } catch (ft) {
962
- tt(ft);
962
+ await C(), B == null || B(R);
963
+ } catch (pt) {
964
+ tt(pt);
963
965
  }
964
- }, ae = (b) => {
965
- var Tt, Ot, Pt, Bt;
966
- if (!K || b !== K)
966
+ }, re = (C) => {
967
+ var Pt, Bt, xt, Ut;
968
+ if (!u || C !== u)
967
969
  return null;
968
970
  if (s.isLoading)
969
- return sn();
970
- if (!s.definition || !D)
971
- return rn();
972
- const U = !!s.installedState, R = ln({
971
+ return cn();
972
+ if (!s.definition || !k)
973
+ return ln();
974
+ const B = !!s.installedState, z = un({
973
975
  definition: s.definition,
974
976
  selectedConnectionMethod: s.selectedConnectionMethod
975
- }), q = s.connectionMethods.length > 1 || !!R, ft = Nt({
977
+ }), R = s.connectionMethods.length > 1 || !!z, pt = Ft({
976
978
  definition: s.definition,
977
979
  selectedConnectionMethod: s.selectedConnectionMethod
978
- }), se = Vt(ft).length > 0, re = !!B || se, wt = !U || Yt, St = {
979
- integration: D,
980
+ }), ce = jt(pt).length > 0, le = !!f || ce, At = !B || te, Mt = {
981
+ integration: k,
980
982
  definition: s.definition,
981
983
  installedState: s.installedState,
982
984
  workspaceId: e,
983
985
  botId: i
984
- }, At = async (L) => {
986
+ }, Tt = async (D) => {
985
987
  try {
986
- await s.saveConfig(L);
988
+ await s.saveConfig(D);
987
989
  } catch (nt) {
988
990
  tt(nt);
989
991
  }
990
- }, ce = h ? h({
992
+ }, de = M ? M({
991
993
  definition: s.definition,
992
994
  installedState: s.installedState,
993
995
  connectionMethods: s.connectionMethods,
994
996
  selectedConnectionMethod: s.selectedConnectionMethod,
995
997
  onConnectionMethodChange: s.setConnectionMethod,
996
998
  isSettingConnectionMethod: s.isSettingConnectionMethod
997
- }) : /* @__PURE__ */ $("div", { className: "flex flex-col gap-4", children: [
998
- /* @__PURE__ */ I("div", { className: "self-end", children: /* @__PURE__ */ I(
999
- ve,
999
+ }) : /* @__PURE__ */ _("div", { className: "flex flex-col gap-4", children: [
1000
+ /* @__PURE__ */ w("div", { className: "self-end", children: /* @__PURE__ */ w(
1001
+ ye,
1000
1002
  {
1001
1003
  options: s.connectionMethods,
1002
1004
  value: s.selectedConnectionMethod,
1003
- disabled: !l,
1004
- onChange: (L) => {
1005
- l && s.setConnectionMethod(L).catch(tt);
1005
+ disabled: !p,
1006
+ onChange: (D) => {
1007
+ p && s.setConnectionMethod(D).catch(tt);
1006
1008
  }
1007
1009
  }
1008
1010
  ) }),
1009
- R ? /* @__PURE__ */ I(
1010
- Le,
1011
+ z ? /* @__PURE__ */ w(
1012
+ Ee,
1011
1013
  {
1012
1014
  client: t,
1013
1015
  integrationName: s.definition.title ?? s.definition.name,
1014
- linkTemplateScript: R,
1015
- webhookUrl: (Tt = s.installedState) == null ? void 0 : Tt.webhookUrl,
1016
- oauthTemplateData: g,
1017
- isAuthorized: !!((Ot = s.installedState) != null && Ot.identifier),
1018
- disabled: !l,
1016
+ linkTemplateScript: z,
1017
+ webhookUrl: (Pt = s.installedState) == null ? void 0 : Pt.webhookUrl,
1018
+ oauthTemplateData: K,
1019
+ isAuthorized: !!((Bt = s.installedState) != null && Bt.identifier),
1020
+ disabled: !p,
1019
1021
  onAuthorized: async () => {
1020
- s.refresh(), w.refresh();
1022
+ s.refresh(), I.refresh();
1021
1023
  },
1022
1024
  onError: tt
1023
1025
  }
1024
- ) : /* @__PURE__ */ $("p", { className: "text-sm text-[var(--gray-11)]", children: [
1026
+ ) : /* @__PURE__ */ _("p", { className: "text-sm text-[var(--gray-11)]", children: [
1025
1027
  "No custom connection UI was provided. Use ",
1026
- /* @__PURE__ */ I("code", { children: "renderConnectionsContent" }),
1028
+ /* @__PURE__ */ w("code", { children: "renderConnectionsContent" }),
1027
1029
  " to plug your OAuth/manual connection flow."
1028
1030
  ] })
1029
- ] }), le = /* @__PURE__ */ I(
1030
- Ce,
1031
+ ] }), ue = /* @__PURE__ */ w(
1032
+ we,
1031
1033
  {
1032
- webhookUrl: (Pt = s.installedState) == null ? void 0 : Pt.webhookUrl,
1034
+ webhookUrl: (xt = s.installedState) == null ? void 0 : xt.webhookUrl,
1033
1035
  isBlocked: !s.installedState,
1034
- children: B ? B({
1036
+ children: f ? f({
1035
1037
  definition: s.definition,
1036
1038
  installedState: s.installedState,
1037
1039
  selectedConnectionMethod: s.selectedConnectionMethod,
1038
- onSave: At,
1040
+ onSave: Tt,
1039
1041
  isSaving: s.isSavingConfig
1040
- }) : /* @__PURE__ */ I(
1041
- ke,
1042
+ }) : /* @__PURE__ */ w(
1043
+ Ne,
1042
1044
  {
1043
1045
  definition: s.definition,
1044
1046
  installedState: s.installedState,
1045
1047
  selectedConnectionMethod: s.selectedConnectionMethod,
1046
- onSave: At,
1048
+ onSave: Tt,
1047
1049
  isSaving: s.isSavingConfig,
1048
- disabled: !l || !s.installedState
1050
+ disabled: !p || !s.installedState
1049
1051
  }
1050
1052
  )
1051
1053
  }
1052
- ), Mt = /* @__PURE__ */ I(
1053
- ye,
1054
+ ), Ot = /* @__PURE__ */ w(
1055
+ Ie,
1054
1056
  {
1055
1057
  actionCards: s.capabilities.actionCards,
1056
1058
  eventCards: s.capabilities.eventCards,
1057
1059
  channelCards: s.capabilities.channelCards,
1058
- selectedCard: lt,
1059
- onCardSelect: (L) => {
1060
- z(
1061
- cn(
1062
- L ? {
1063
- key: L.key,
1064
- type: L.type
1060
+ selectedCard: ut,
1061
+ onCardSelect: (D) => {
1062
+ H(
1063
+ dn(
1064
+ D ? {
1065
+ key: D.key,
1066
+ type: D.type
1065
1067
  } : null
1066
1068
  )
1067
1069
  );
1068
1070
  }
1069
1071
  }
1070
- ), de = /* @__PURE__ */ I(
1071
- Ie,
1072
+ ), fe = /* @__PURE__ */ w(
1073
+ Se,
1072
1074
  {
1073
1075
  version: s.definition.version,
1074
1076
  githubUrl: s.definition.url,
1075
1077
  aboutLabel: "About Integration",
1076
- onAboutClick: U ? () => W(!0) : void 0
1078
+ onAboutClick: B ? () => Q(!0) : void 0
1077
1079
  }
1078
1080
  );
1079
- return /* @__PURE__ */ I(
1080
- we,
1081
+ return /* @__PURE__ */ w(
1082
+ Ae,
1081
1083
  {
1082
1084
  title: s.definition.title ?? s.definition.name,
1083
1085
  iconUrl: s.definition.iconUrl,
1084
- contributorName: D.author,
1085
- isOfficial: D.isOfficial,
1086
- isVerified: D.isVerified,
1087
- isPrivate: D.isPrivate,
1086
+ contributorName: k.author,
1087
+ isOfficial: k.isOfficial,
1088
+ isVerified: k.isVerified,
1089
+ isPrivate: k.isPrivate,
1088
1090
  onBack: () => {
1089
- H(null), E(null), z(null), W(!1);
1091
+ E(null), J(null), H(null), Q(!1);
1090
1092
  },
1091
- onInstall: U || r || !l ? void 0 : () => {
1093
+ onInstall: B || d || !p ? void 0 : () => {
1092
1094
  et({
1093
- operation: () => w.install(D.id),
1094
- onSuccess: p,
1095
- integration: D
1095
+ operation: () => I.install(k.id),
1096
+ onSuccess: L,
1097
+ integration: k
1096
1098
  });
1097
1099
  },
1098
- onToggleEnabled: !U || !l ? void 0 : () => {
1099
- const L = s.installedState, nt = !!(L != null && L.enabled);
1100
+ onToggleEnabled: !B || !p ? void 0 : () => {
1101
+ const D = s.installedState, nt = !!(D != null && D.enabled);
1100
1102
  et({
1101
1103
  operation: async () => {
1102
- if (!L)
1104
+ if (!D)
1103
1105
  throw new Error("Integration is not installed");
1104
1106
  if (nt) {
1105
- await w.disable(L.id);
1107
+ await I.disable(D.id);
1106
1108
  return;
1107
1109
  }
1108
- await w.enable(L.id);
1110
+ await I.enable(D.id);
1109
1111
  },
1110
- onSuccess: nt ? y : k,
1111
- integration: D
1112
+ onSuccess: nt ? j : O,
1113
+ integration: k
1112
1114
  });
1113
1115
  },
1114
- onUninstall: !U || !l ? void 0 : () => {
1115
- const L = s.installedState;
1116
+ onUninstall: !B || !p ? void 0 : () => {
1117
+ const D = s.installedState;
1116
1118
  et({
1117
1119
  operation: async () => {
1118
- if (!L)
1120
+ if (!D)
1119
1121
  throw new Error("Integration is not installed");
1120
- await w.uninstall(L.id);
1122
+ await I.uninstall(D.id);
1121
1123
  },
1122
- onSuccess: A,
1123
- integration: D
1124
+ onSuccess: y,
1125
+ integration: k
1124
1126
  });
1125
1127
  },
1126
- onUpgrade: !D.hasUpdate || !l ? void 0 : () => {
1128
+ onUpgrade: !k.hasUpdate || !p ? void 0 : () => {
1127
1129
  et({
1128
- operation: () => w.upgrade(D.id),
1129
- onSuccess: P,
1130
- integration: D
1130
+ operation: () => I.upgrade(k.id),
1131
+ onSuccess: $,
1132
+ integration: k
1131
1133
  });
1132
1134
  },
1133
- isInstalled: U,
1134
- disableInstallation: r,
1135
- hasWriteAccess: l,
1136
- isInstalling: w.isInstalling,
1137
- isUninstalling: w.isUninstalling,
1138
- isTogglingEnabled: w.isEnabling || w.isDisabling,
1139
- hasUpdate: D.hasUpdate,
1140
- isUpgrading: w.isUpgrading,
1141
- toggleButtonLabel: (Bt = s.installedState) != null && Bt.enabled ? "Disable" : "Enable",
1142
- onShare: _ ? () => _(St) : void 0,
1143
- showBackToSetup: U && wt,
1144
- onBackToSetup: () => W(!1),
1145
- notifications: j == null ? void 0 : j(St),
1146
- selectedDetailPanel: lt && M ? M({
1135
+ isInstalled: B,
1136
+ disableInstallation: d,
1137
+ hasWriteAccess: p,
1138
+ isInstalling: I.isInstalling,
1139
+ isUninstalling: I.isUninstalling,
1140
+ isTogglingEnabled: I.isEnabling || I.isDisabling,
1141
+ hasUpdate: k.hasUpdate,
1142
+ isUpgrading: I.isUpgrading,
1143
+ toggleButtonLabel: (Ut = s.installedState) != null && Ut.enabled ? "Disable" : "Enable",
1144
+ onShare: S ? () => S(Mt) : void 0,
1145
+ showBackToSetup: B && At,
1146
+ onBackToSetup: () => Q(!1),
1147
+ notifications: h == null ? void 0 : h(Mt),
1148
+ selectedDetailPanel: ut && F ? F({
1147
1149
  definition: s.definition,
1148
- selectedCard: lt,
1149
- onClose: () => z(null)
1150
+ selectedCard: ut,
1151
+ onClose: () => H(null)
1150
1152
  }) : void 0,
1151
- onDismissSelectedDetailPanel: () => z(null),
1152
- children: wt ? /* @__PURE__ */ $("div", { className: "flex flex-col gap-6 mt-6", children: [
1153
- /* @__PURE__ */ I(Se, { readme: ie, isLoading: oe }),
1154
- Mt
1155
- ] }) : /* @__PURE__ */ I(
1156
- Ae,
1153
+ onDismissSelectedDetailPanel: () => H(null),
1154
+ children: At ? /* @__PURE__ */ _("div", { className: "flex flex-col gap-6 mt-6", children: [
1155
+ /* @__PURE__ */ w(Me, { readme: ae, isLoading: se }),
1156
+ Ot
1157
+ ] }) : /* @__PURE__ */ w(
1158
+ Te,
1157
1159
  {
1158
1160
  integrationTitle: s.definition.title ?? s.definition.name,
1159
- isFullyConfigured: U,
1160
- hasConnectionStep: q,
1161
- hasConfigurationStep: re,
1162
- configuredTab: mt,
1163
- onConfiguredTabChange: dt,
1164
- setupTab: te,
1165
- onSetupTabChange: ut,
1161
+ isFullyConfigured: B,
1162
+ hasConnectionStep: R,
1163
+ hasConfigurationStep: le,
1164
+ configuredTab: ee,
1165
+ onConfiguredTabChange: ft,
1166
+ setupTab: ne,
1167
+ onSetupTabChange: gt,
1166
1168
  onCancelSetup: () => {
1167
- H(null), E(null), z(null), W(!1);
1169
+ E(null), J(null), H(null), Q(!1);
1168
1170
  },
1169
- metadata: de,
1170
- connectionsContent: ce,
1171
- configurationContent: le,
1172
- capabilitiesContent: Mt
1171
+ metadata: fe,
1172
+ connectionsContent: de,
1173
+ configurationContent: ue,
1174
+ capabilitiesContent: Ot
1173
1175
  }
1174
1176
  )
1175
1177
  }
1176
1178
  );
1177
1179
  };
1178
- return /* @__PURE__ */ $("div", { className: "flex h-full min-h-0 flex-col", children: [
1179
- !K && /* @__PURE__ */ I("div", { className: "flex justify-end px-6 pt-4", children: /* @__PURE__ */ $("div", { className: "flex rounded-lg bg-[var(--gray-a3)] p-1", children: [
1180
- /* @__PURE__ */ I(
1181
- "button",
1182
- {
1183
- type: "button",
1184
- onClick: () => Y("hub"),
1185
- className: bt(
1186
- "cursor-pointer rounded-md px-3 py-1.5 text-sm text-[var(--gray-11)] transition-colors",
1187
- X === "hub" && "bg-[var(--gray-1)] text-[var(--gray-12)] shadow-sm"
1188
- ),
1189
- children: "Integration Hub"
1190
- }
1191
- ),
1192
- /* @__PURE__ */ I(
1193
- "button",
1194
- {
1195
- type: "button",
1196
- onClick: () => Y("installed"),
1197
- className: bt(
1198
- "cursor-pointer rounded-md px-3 py-1.5 text-sm text-[var(--gray-11)] transition-colors",
1199
- X === "installed" && "bg-[var(--gray-1)] text-[var(--gray-12)] shadow-sm"
1200
- ),
1201
- children: "Installed Integrations"
1202
- }
1203
- )
1204
- ] }) }),
1205
- /* @__PURE__ */ I(
1206
- ge,
1180
+ return /* @__PURE__ */ _("div", { className: "flex h-full min-h-0 flex-col", children: [
1181
+ !u && /* @__PURE__ */ _("div", { className: "flex items-center justify-between px-6 pt-4", children: [
1182
+ (n || o) && /* @__PURE__ */ _("div", { className: "flex items-center gap-2", children: [
1183
+ o && /* @__PURE__ */ w("img", { src: o, alt: "", className: "h-6 w-6 shrink-0 rounded object-contain" }),
1184
+ n && /* @__PURE__ */ w("h2", { className: "text-lg font-semibold text-[var(--gray-12)]", children: n })
1185
+ ] }),
1186
+ /* @__PURE__ */ _("div", { className: "flex rounded-lg bg-[var(--gray-a3)] p-1 ml-auto", children: [
1187
+ /* @__PURE__ */ w(
1188
+ "button",
1189
+ {
1190
+ type: "button",
1191
+ onClick: () => Y("hub"),
1192
+ className: Ct(
1193
+ "cursor-pointer rounded-md px-3 py-1.5 text-sm text-[var(--gray-11)] transition-colors",
1194
+ X === "hub" && "bg-[var(--gray-1)] text-[var(--gray-12)] shadow-sm"
1195
+ ),
1196
+ children: "Integration Hub"
1197
+ }
1198
+ ),
1199
+ /* @__PURE__ */ w(
1200
+ "button",
1201
+ {
1202
+ type: "button",
1203
+ onClick: () => Y("installed"),
1204
+ className: Ct(
1205
+ "cursor-pointer rounded-md px-3 py-1.5 text-sm text-[var(--gray-11)] transition-colors",
1206
+ X === "installed" && "bg-[var(--gray-1)] text-[var(--gray-12)] shadow-sm"
1207
+ ),
1208
+ children: "Installed Integrations"
1209
+ }
1210
+ )
1211
+ ] })
1212
+ ] }),
1213
+ /* @__PURE__ */ w(
1214
+ he,
1207
1215
  {
1208
1216
  view: X,
1209
1217
  searchInput: m,
1210
1218
  searchTerm: m,
1211
- onSearchInputChange: Wt,
1212
- selectedCategory: Zt,
1213
- onSelectedCategoryChange: Xt,
1214
- selectedIntegrationId: K,
1215
- hubIntegrations: ee,
1216
- sidebarIntegrations: w.integrations,
1217
- installedIntegrations: w.installedIntegrations,
1218
- isHubLoading: w.isLoading,
1219
- isInstalledLoading: w.isLoading,
1220
- filterMenu: /* @__PURE__ */ I(
1221
- pe,
1219
+ onSearchInputChange: Gt,
1220
+ selectedCategory: Yt,
1221
+ onSelectedCategoryChange: mt,
1222
+ selectedIntegrationId: u,
1223
+ hubIntegrations: ie,
1224
+ sidebarIntegrations: I.integrations,
1225
+ installedIntegrations: I.installedIntegrations,
1226
+ isHubLoading: I.isLoading,
1227
+ isInstalledLoading: I.isLoading,
1228
+ filterMenu: /* @__PURE__ */ w(
1229
+ be,
1222
1230
  {
1223
- visibility: st,
1224
- verification: rt,
1225
- sortMethod: ct,
1226
- labels: C,
1227
- onVisibilityChange: $t,
1228
- onVerificationChange: Gt,
1229
- onSortMethodChange: Jt
1231
+ visibility: ct,
1232
+ verification: lt,
1233
+ sortMethod: dt,
1234
+ labels: P,
1235
+ onVisibilityChange: Jt,
1236
+ onVerificationChange: Zt,
1237
+ onSortMethodChange: Xt
1230
1238
  }
1231
1239
  ),
1232
- categories: o,
1233
- bannerSlides: a,
1234
- bannerIconUrl: d,
1235
- noResultsDocumentationLink: c,
1236
- renderIntegrationCard: (b, { onEscape: U }) => /* @__PURE__ */ I(
1237
- he,
1240
+ categories: l,
1241
+ bannerSlides: r,
1242
+ bannerIconUrl: c,
1243
+ noResultsDocumentationLink: g,
1244
+ renderIntegrationCard: (C, { onEscape: B }) => /* @__PURE__ */ w(
1245
+ ve,
1238
1246
  {
1239
- name: b.title ?? b.name,
1240
- description: b.description,
1241
- author: b.author,
1242
- installed: b.installed,
1243
- updateAvailable: b.hasUpdate,
1244
- verified: b.isVerified,
1245
- official: b.isOfficial,
1246
- private: b.isPrivate,
1247
- iconUrl: b.iconUrl,
1247
+ name: C.title ?? C.name,
1248
+ description: C.description,
1249
+ author: C.author,
1250
+ installed: C.installed,
1251
+ updateAvailable: C.hasUpdate,
1252
+ verified: C.isVerified,
1253
+ official: C.isOfficial,
1254
+ private: C.isPrivate,
1255
+ iconUrl: C.iconUrl,
1248
1256
  onClick: () => {
1249
- H(b.id), E(b.installedId ?? b.id), dt("connections"), ut("connections"), W(!1), z(null);
1257
+ E(C.id), J(C.installedId ?? C.id), ft("connections"), gt("connections"), Q(!1), H(null);
1250
1258
  },
1251
- onEscape: U
1259
+ onEscape: B
1252
1260
  }
1253
1261
  ),
1254
- renderInstalledIntegrations: ({ integrations: b, searchTerm: U, categoryOrder: R }) => /* @__PURE__ */ I(
1255
- be,
1262
+ renderInstalledIntegrations: ({ integrations: C, searchTerm: B, categoryOrder: z }) => /* @__PURE__ */ w(
1263
+ Ce,
1256
1264
  {
1257
- integrations: b,
1258
- searchTerm: U,
1259
- categoryOrder: R.length > 0 ? R : ne,
1260
- onSelectIntegration: (q) => {
1261
- H(q.id), E(q.installedId ?? q.id), dt("connections"), ut("connections"), W(!1), z(null);
1265
+ integrations: C,
1266
+ searchTerm: B,
1267
+ categoryOrder: z.length > 0 ? z : oe,
1268
+ onSelectIntegration: (R) => {
1269
+ E(R.id), J(R.installedId ?? R.id), ft("connections"), gt("connections"), Q(!1), H(null);
1262
1270
  }
1263
1271
  }
1264
1272
  ),
1265
- renderIntegrationDetails: ae
1273
+ renderIntegrationDetails: re
1266
1274
  }
1267
1275
  )
1268
1276
  ] });
1269
- }, Mn = dn;
1277
+ }, On = fn;
1270
1278
  export {
1271
- Mn as BotpressIntegrationHub,
1272
- dn as BotpressIntegrationHubScreen,
1273
- Le as IntegrationOAuthButton,
1274
- Se as IntegrationReadmeContent,
1275
- ke as IntegrationStaticZuiConfigurationForm,
1276
- wn as dedupeById,
1277
- Ue as fetchOAuthAuthorizationUrl,
1278
- He as filterAndSortIntegrations,
1279
- yt as findInstalledIntegration,
1279
+ On as BotpressIntegrationHub,
1280
+ fn as BotpressIntegrationHubScreen,
1281
+ Ee as IntegrationOAuthButton,
1282
+ Me as IntegrationReadmeContent,
1283
+ Ne as IntegrationStaticZuiConfigurationForm,
1284
+ An as dedupeById,
1285
+ ke as fetchOAuthAuthorizationUrl,
1286
+ Re as filterAndSortIntegrations,
1287
+ It as findInstalledIntegration,
1280
1288
  ot as getInstalledIntegrations,
1281
- Ke as getSelectedConnectionMethod,
1282
- Be as getWebhookIdFromUrl,
1283
- _t as isOfficialWorkspace,
1284
- xe as openOAuthPopup,
1285
- Kt as resolveCategory,
1286
- je as toCapabilityCards,
1287
- _e as toConnectionMethods,
1288
- Ct as toError,
1289
- Ve as toHubItem,
1290
- Fe as toInstalledItem,
1291
- zt as useBotpressIntegrationDetails,
1292
- Qt as useBotpressIntegrationHub,
1293
- Sn as useIntegrationDetails,
1294
- An as useIntegrationHub,
1295
- fe as useIntegrationReadme,
1296
- on as usePersistedNavigationState
1289
+ ze as getSelectedConnectionMethod,
1290
+ Ue as getWebhookIdFromUrl,
1291
+ Ht as isOfficialWorkspace,
1292
+ De as openOAuthPopup,
1293
+ zt as resolveCategory,
1294
+ Ke as toCapabilityCards,
1295
+ He as toConnectionMethods,
1296
+ wt as toError,
1297
+ je as toHubItem,
1298
+ _e as toInstalledItem,
1299
+ qt as useBotpressIntegrationDetails,
1300
+ $t as useBotpressIntegrationHub,
1301
+ Mn as useIntegrationDetails,
1302
+ Tn as useIntegrationHub,
1303
+ pe as useIntegrationReadme,
1304
+ sn as usePersistedNavigationState
1297
1305
  };