@bpinternal/integration-hub 0.2.0 → 0.4.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,9 +1,9 @@
1
- import { jsx as v, jsxs as _ } from "react/jsx-runtime";
2
- import { Loader2 as wt } from "lucide-react";
3
- import { useState as O, useRef as dt, useEffect as st, useMemo as E, useCallback as G } from "react";
4
- import { I as Wt, c as ct, a as Rt, b as $t, d as Gt, e as Zt, f as Jt, g as Xt, h as Yt, i as mt, j as tn, k as nn } from "../chunks/index.js";
1
+ import { jsx as w, jsxs as z } from "react/jsx-runtime";
2
+ import { Loader2 as It } from "lucide-react";
3
+ import { useState as x, useRef as ut, useEffect as ct, useMemo as L, useCallback as J } from "react";
4
+ import { I as Wt, c as lt, a as Rt, b as $t, d as Gt, e as Zt, f as Jt, g as Xt, h as Yt, i as mt, j as tn, k as nn } from "../chunks/index.js";
5
5
  import { StaticZuiForm as en } from "@bpinternal/static-zui-form";
6
- import { useQueryClient as It, useQuery as yt, useMutation as D } from "@tanstack/react-query";
6
+ import { useQueryClient as yt, useQuery as St, useMutation as D } from "@tanstack/react-query";
7
7
  import "framer-motion";
8
8
  import "clsx";
9
9
  import "tailwind-merge";
@@ -43,11 +43,11 @@ const on = "width=650,height=800,popup=true", an = 500, rn = 5 * 60 * 1e3, sn =
43
43
  try {
44
44
  if (!r.closed)
45
45
  return;
46
- window.clearInterval(u), window.clearTimeout(d), a(!0);
46
+ window.clearInterval(u), window.clearTimeout(c), a(!0);
47
47
  } catch {
48
- window.clearInterval(u), window.clearTimeout(d), a(!1);
48
+ window.clearInterval(u), window.clearTimeout(c), a(!1);
49
49
  }
50
- }, i), d = window.setTimeout(() => {
50
+ }, i), c = window.setTimeout(() => {
51
51
  window.clearInterval(u), r.closed || r.close(), a(!1);
52
52
  }, o);
53
53
  }))
@@ -64,125 +64,125 @@ const on = "width=650,height=800,popup=true", an = 500, rn = 5 * 60 * 1e3, sn =
64
64
  webhookId: i,
65
65
  webhookUrl: o,
66
66
  oauthTemplateData: r,
67
- isAuthorized: c = !1,
67
+ isAuthorized: l = !1,
68
68
  disabled: a = !1,
69
69
  onAuthorized: u,
70
- onError: d
70
+ onError: c
71
71
  }) => {
72
- const [l, b] = O(null), [p, S] = O(!1), [x, P] = O(!1), I = i ?? sn(o), g = !!(i || o), f = dt(d);
73
- st(() => {
74
- f.current = d;
75
- }, [d]);
76
- const C = E(() => {
72
+ const [d, b] = x(null), [C, T] = x(!1), [M, k] = x(!1), y = i ?? sn(o), p = !!(i || o), g = ut(c);
73
+ ct(() => {
74
+ g.current = c;
75
+ }, [c]);
76
+ const E = L(() => {
77
77
  try {
78
78
  return JSON.stringify(r ?? {});
79
79
  } catch {
80
80
  return "{}";
81
81
  }
82
82
  }, [r]);
83
- st(() => {
84
- if (!g) {
85
- b(null), S(!1);
83
+ ct(() => {
84
+ if (!p) {
85
+ b(null), T(!1);
86
86
  return;
87
87
  }
88
- let k = !1;
88
+ let U = !1;
89
89
  return (async () => {
90
- var K;
91
- let M = {};
90
+ var N;
91
+ let h = {};
92
92
  try {
93
- M = JSON.parse(C);
93
+ h = JSON.parse(E);
94
94
  } catch {
95
- M = {};
95
+ h = {};
96
96
  }
97
- const U = {
97
+ const S = {
98
98
  webhookUrl: o ?? null,
99
- webhookId: I,
100
- ...M
99
+ webhookId: y,
100
+ ...h
101
101
  };
102
- S(!0);
102
+ T(!0);
103
103
  try {
104
- const N = await cn({
104
+ const A = await cn({
105
105
  client: n,
106
106
  linkTemplateScript: e,
107
- data: U
107
+ data: S
108
108
  });
109
- k || b(N);
110
- } catch (N) {
111
- k || (b(null), (K = f.current) == null || K.call(f, dn(N)));
109
+ U || b(A);
110
+ } catch (A) {
111
+ U || (b(null), (N = g.current) == null || N.call(g, dn(A)));
112
112
  } finally {
113
- k || S(!1);
113
+ U || T(!1);
114
114
  }
115
115
  })(), () => {
116
- k = !0;
116
+ U = !0;
117
117
  };
118
- }, [n, g, e, C, o, I]);
119
- const L = g && !!l && !p && !a, H = async () => {
120
- var k, y, M;
121
- if (!(!l || x)) {
122
- P(!0);
118
+ }, [n, p, e, E, o, y]);
119
+ const V = p && !!d && !C && !a, _ = async () => {
120
+ var U, f, h;
121
+ if (!(!d || M)) {
122
+ k(!0);
123
123
  try {
124
- const U = await ln({
125
- authorizationUrl: l,
124
+ const S = await ln({
125
+ authorizationUrl: d,
126
126
  onClose: u
127
127
  });
128
- if (U === "completed")
128
+ if (S === "completed")
129
129
  return;
130
- if (U === "blocked") {
131
- (k = f.current) == null || k.call(f, new Error("Please allow browser popups to authorize this integration."));
130
+ if (S === "blocked") {
131
+ (U = g.current) == null || U.call(g, new Error("Please allow browser popups to authorize this integration."));
132
132
  return;
133
133
  }
134
- if (U === "timeout") {
135
- (y = f.current) == null || y.call(f, new Error("OAuth popup did not close in time. Please close it and try again."));
134
+ if (S === "timeout") {
135
+ (f = g.current) == null || f.call(g, new Error("OAuth popup did not close in time. Please close it and try again."));
136
136
  return;
137
137
  }
138
- (M = f.current) == null || M.call(f, new Error("OAuth authorization finished but refresh failed."));
138
+ (h = g.current) == null || h.call(g, new Error("OAuth authorization finished but refresh failed."));
139
139
  } finally {
140
- P(!1);
140
+ k(!1);
141
141
  }
142
142
  }
143
143
  };
144
- return /* @__PURE__ */ v(
144
+ return /* @__PURE__ */ w(
145
145
  Wt,
146
146
  {
147
147
  integrationName: t,
148
- canAuthorize: L,
149
- isAuthorizing: x,
150
- isAuthorized: c,
148
+ canAuthorize: V,
149
+ isAuthorizing: M,
150
+ isAuthorized: l,
151
151
  disabled: a,
152
- showInstallHint: !g,
152
+ showInstallHint: !p,
153
153
  onClick: () => {
154
- H();
154
+ _();
155
155
  }
156
156
  }
157
157
  );
158
- }, St = ({
158
+ }, At = ({
159
159
  definition: n,
160
160
  selectedConnectionMethod: t
161
161
  }) => {
162
162
  var i, o, r;
163
163
  const e = t != null ? (o = (i = n.configurations) == null ? void 0 : i[t]) == null ? void 0 : o.schema : (r = n.configuration) == null ? void 0 : r.schema;
164
164
  return !e || typeof e != "object" ? null : e;
165
- }, At = (n) => {
165
+ }, Tt = (n) => {
166
166
  if (!n || typeof n != "object")
167
167
  return [];
168
168
  const t = n.properties;
169
169
  return !t || typeof t != "object" ? [] : Object.keys(t);
170
- }, it = (n) => !n || typeof n != "object" || Array.isArray(n) ? {} : n, Ct = (n, t) => {
170
+ }, at = (n) => !n || typeof n != "object" || Array.isArray(n) ? {} : n, wt = (n, t) => {
171
171
  if (t.length === 0)
172
172
  return {};
173
173
  const e = t.filter((i) => Object.prototype.hasOwnProperty.call(n, i)).map((i) => [i, n[i]]);
174
174
  return Object.fromEntries(e);
175
- }, $ = (n) => !!n && typeof n == "object" && !Array.isArray(n), lt = (n, t) => {
175
+ }, Z = (n) => !!n && typeof n == "object" && !Array.isArray(n), dt = (n, t) => {
176
176
  if (Object.is(n, t))
177
177
  return !0;
178
178
  if (Array.isArray(n) || Array.isArray(t))
179
- return !Array.isArray(n) || !Array.isArray(t) || n.length !== t.length ? !1 : n.every((e, i) => lt(e, t[i]));
180
- if ($(n) || $(t)) {
181
- if (!$(n) || !$(t))
179
+ return !Array.isArray(n) || !Array.isArray(t) || n.length !== t.length ? !1 : n.every((e, i) => dt(e, t[i]));
180
+ if (Z(n) || Z(t)) {
181
+ if (!Z(n) || !Z(t))
182
182
  return !1;
183
183
  const e = Object.keys(n), i = Object.keys(t);
184
184
  return e.length !== i.length ? !1 : e.every(
185
- (o) => Object.prototype.hasOwnProperty.call(t, o) && lt(n[o], t[o])
185
+ (o) => Object.prototype.hasOwnProperty.call(t, o) && dt(n[o], t[o])
186
186
  );
187
187
  }
188
188
  return !1;
@@ -194,71 +194,71 @@ const on = "width=650,height=800,popup=true", an = 500, rn = 5 * 60 * 1e3, sn =
194
194
  isSaving: o,
195
195
  disabled: r = !1
196
196
  }) => {
197
- const c = E(
198
- () => St({ definition: n, selectedConnectionMethod: e }),
197
+ const l = L(
198
+ () => At({ definition: n, selectedConnectionMethod: e }),
199
199
  [n, e]
200
- ), a = E(() => At(c), [c]), u = E(
201
- () => Ct(it(t == null ? void 0 : t.configuration), a),
200
+ ), a = L(() => Tt(l), [l]), u = L(
201
+ () => wt(at(t == null ? void 0 : t.configuration), a),
202
202
  [t == null ? void 0 : t.configuration, a]
203
- ), d = E(() => a.join("\0"), [a]), [l, b] = O({}), [p, S] = O(null), [x, P] = O(0), I = dt(null);
204
- return st(() => {
205
- const g = {
203
+ ), c = L(() => a.join("\0"), [a]), [d, b] = x({}), [C, T] = x(null), [M, k] = x(0), y = ut(null);
204
+ return ct(() => {
205
+ const p = {
206
206
  botIntegrationId: (t == null ? void 0 : t.botIntegrationId) ?? null,
207
207
  configurationType: (t == null ? void 0 : t.configurationType) ?? null,
208
- schemaKeySignature: d,
208
+ schemaKeySignature: c,
209
209
  configuration: u
210
- }, f = I.current;
211
- f && f.botIntegrationId === g.botIntegrationId && f.configurationType === g.configurationType && f.schemaKeySignature === g.schemaKeySignature && lt(f.configuration, g.configuration) || (I.current = g, b(u), S(null), P((C) => C + 1));
212
- }, [u, t == null ? void 0 : t.botIntegrationId, t == null ? void 0 : t.configurationType, d]), !c || a.length === 0 ? null : /* @__PURE__ */ _("div", { className: "flex flex-col gap-3", children: [
213
- /* @__PURE__ */ v(
210
+ }, g = y.current;
211
+ g && g.botIntegrationId === p.botIntegrationId && g.configurationType === p.configurationType && g.schemaKeySignature === p.schemaKeySignature && dt(g.configuration, p.configuration) || (y.current = p, b(u), T(null), k((E) => E + 1));
212
+ }, [u, t == null ? void 0 : t.botIntegrationId, t == null ? void 0 : t.configurationType, c]), !l || a.length === 0 ? null : /* @__PURE__ */ z("div", { className: "flex flex-col gap-3", children: [
213
+ /* @__PURE__ */ w(
214
214
  en,
215
215
  {
216
- schema: c,
217
- value: l,
218
- onChange: (g) => {
219
- const f = Ct(it(g), a);
220
- b(f);
216
+ schema: l,
217
+ value: d,
218
+ onChange: (p) => {
219
+ const g = wt(at(p), a);
220
+ b(g);
221
221
  },
222
- onValidation: ({ formValid: g }) => {
223
- S(g);
222
+ onValidation: ({ formValid: p }) => {
223
+ T(p);
224
224
  }
225
225
  },
226
- x
226
+ M
227
227
  ),
228
- /* @__PURE__ */ _(
228
+ /* @__PURE__ */ z(
229
229
  "button",
230
230
  {
231
231
  type: "button",
232
- disabled: r || o || p !== !0,
232
+ disabled: r || o || C !== !0,
233
233
  onClick: () => {
234
- const g = it(t == null ? void 0 : t.configuration);
234
+ const p = at(t == null ? void 0 : t.configuration);
235
235
  i({
236
- ...g,
237
- ...l
236
+ ...p,
237
+ ...d
238
238
  });
239
239
  },
240
- className: ct(
240
+ className: lt(
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__ */ v("span", { className: o ? "invisible" : "", children: "Save Configuration" }),
246
- o && /* @__PURE__ */ v(wt, { 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(It, { className: "absolute inset-0 m-auto h-4 w-4 animate-spin" })
247
247
  ]
248
248
  }
249
249
  )
250
250
  ] });
251
- }, Tt = "Other", fn = "team-cloud-services", ot = "sandbox", at = (n) => n.replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/[_.:/-]+/g, " ").replace(/\s+/g, " ").trim().replace(/\b\w/g, (t) => t.toUpperCase()), gn = (n) => n == null ? void 0 : n.replace(/\.$/, ""), Ot = (n) => {
251
+ }, Ot = "Other", fn = "team-cloud-services", rt = "sandbox", st = (n) => n.replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/[_.:/-]+/g, " ").replace(/\s+/g, " ").trim().replace(/\b\w/g, (t) => t.toUpperCase()), gn = (n) => n == null ? void 0 : n.replace(/\.$/, ""), Mt = (n) => {
252
252
  var t;
253
253
  return n && "meta" in n ? ((t = n.meta) == null ? void 0 : t.installs) ?? null : null;
254
- }, ut = (n) => n instanceof Error ? n : new Error("An unknown error occurred while loading integrations"), Pt = (n) => n === fn, Bt = (n, t) => {
254
+ }, pt = (n) => n instanceof Error ? n : new Error("An unknown error occurred while loading integrations"), Pt = (n) => n === fn, xt = (n, t) => {
255
255
  var o;
256
256
  const e = t == null ? void 0 : t(n);
257
257
  if (e)
258
258
  return e;
259
259
  const i = (o = n.attributes) == null ? void 0 : o.category;
260
- return typeof i == "string" && i.length > 0 ? i : Tt;
261
- }, Z = (n) => n ? Object.entries(n).map(([t, e]) => {
260
+ return typeof i == "string" && i.length > 0 ? i : Ot;
261
+ }, X = (n) => n ? Object.entries(n).map(([t, e]) => {
262
262
  const i = e;
263
263
  return {
264
264
  ...i,
@@ -266,7 +266,7 @@ const on = "width=650,height=800,popup=true", an = 500, rn = 5 * 60 * 1e3, sn =
266
266
  name: typeof i.name == "string" && i.name.length > 0 ? i.name : t,
267
267
  botIntegrationId: t
268
268
  };
269
- }) : [], pt = ({
269
+ }) : [], ft = ({
270
270
  installedIntegrations: n,
271
271
  integrationId: t,
272
272
  integrationName: e
@@ -275,23 +275,23 @@ const on = "width=650,height=800,popup=true", an = 500, rn = 5 * 60 * 1e3, sn =
275
275
  installedByName: t,
276
276
  categoryResolver: e
277
277
  }) => {
278
- var u, d, l;
279
- const i = t.get(n.name), o = Pt((u = n.ownerWorkspace) == null ? void 0 : u.handle), r = (i == null ? void 0 : i.version) ?? null, c = n.version ?? null, a = r && c ? r !== c : !1;
278
+ var u, c, d;
279
+ const i = t.get(n.name), o = Pt((u = n.ownerWorkspace) == null ? void 0 : u.handle), r = (i == null ? void 0 : i.version) ?? null, l = n.version ?? null, a = r && l ? r !== l : !1;
280
280
  return {
281
281
  id: n.id,
282
282
  name: n.name,
283
283
  title: n.title,
284
284
  description: n.description,
285
285
  iconUrl: n.iconUrl,
286
- attributes: { category: Bt(n, e) },
286
+ attributes: { category: xt(n, e) },
287
287
  meta: {
288
- installs: Ot(n)
288
+ installs: Mt(n)
289
289
  },
290
290
  installed: !!i,
291
291
  enabled: i == null ? void 0 : i.enabled,
292
292
  hasUpdate: a,
293
293
  deprecated: (i == null ? void 0 : i.lifecycleStatus) === "deprecated" || n.lifecycleStatus === "deprecated",
294
- author: ((d = n.ownerWorkspace) == null ? void 0 : d.handle) ?? ((l = n.ownerWorkspace) == null ? void 0 : l.name) ?? null,
294
+ author: ((c = n.ownerWorkspace) == null ? void 0 : c.handle) ?? ((d = n.ownerWorkspace) == null ? void 0 : d.name) ?? null,
295
295
  isOfficial: o,
296
296
  isVerified: n.verificationStatus === "approved",
297
297
  isPrivate: n.visibility === "private",
@@ -306,7 +306,7 @@ const on = "width=650,height=800,popup=true", an = 500, rn = 5 * 60 * 1e3, sn =
306
306
  summary: t,
307
307
  categoryResolver: e
308
308
  }) => {
309
- var r, c, a;
309
+ var r, l, a;
310
310
  const i = Pt((r = t == null ? void 0 : t.ownerWorkspace) == null ? void 0 : r.handle), o = n.version && (t != null && t.version) ? n.version !== (t == null ? void 0 : t.version) : !1;
311
311
  return {
312
312
  id: (t == null ? void 0 : t.id) ?? n.id,
@@ -315,16 +315,16 @@ const on = "width=650,height=800,popup=true", an = 500, rn = 5 * 60 * 1e3, sn =
315
315
  description: (t == null ? void 0 : t.description) ?? null,
316
316
  iconUrl: t == null ? void 0 : t.iconUrl,
317
317
  attributes: {
318
- category: t ? Bt(t, e) : Tt
318
+ category: t ? xt(t, e) : Ot
319
319
  },
320
320
  meta: {
321
- installs: Ot(t)
321
+ installs: Mt(t)
322
322
  },
323
323
  installed: !0,
324
324
  enabled: n.enabled,
325
325
  hasUpdate: o,
326
326
  deprecated: n.lifecycleStatus === "deprecated",
327
- author: ((c = t == null ? void 0 : t.ownerWorkspace) == null ? void 0 : c.handle) ?? ((a = t == null ? void 0 : t.ownerWorkspace) == null ? void 0 : a.name) ?? null,
327
+ author: ((l = t == null ? void 0 : t.ownerWorkspace) == null ? void 0 : l.handle) ?? ((a = t == null ? void 0 : t.ownerWorkspace) == null ? void 0 : a.name) ?? null,
328
328
  isOfficial: i,
329
329
  isVerified: (t == null ? void 0 : t.verificationStatus) === "approved",
330
330
  isPrivate: (t == null ? void 0 : t.visibility) === "private",
@@ -345,23 +345,23 @@ const on = "width=650,height=800,popup=true", an = 500, rn = 5 * 60 * 1e3, sn =
345
345
  var r;
346
346
  return ((r = o.attributes) == null ? void 0 : r.bpActionHiddenInStudio) !== "true";
347
347
  }).map(([o, r]) => {
348
- var c;
348
+ var l;
349
349
  return {
350
350
  key: o,
351
- name: at(o),
351
+ name: st(o),
352
352
  description: r.description ?? "",
353
353
  type: "action",
354
- billable: ((c = r.attributes) == null ? void 0 : c.billable) === "true"
354
+ billable: ((l = r.attributes) == null ? void 0 : l.billable) === "true"
355
355
  };
356
356
  }), e = Object.entries(n.events ?? {}).map(([o, r]) => ({
357
357
  key: o,
358
- name: at(o),
358
+ name: st(o),
359
359
  description: r.description ?? "",
360
360
  type: "event",
361
361
  enabled: !0
362
362
  })), i = Object.keys(n.channels ?? {}).map((o) => ({
363
363
  key: o,
364
- name: at(o),
364
+ name: st(o),
365
365
  description: "Channel communication support",
366
366
  type: "channel",
367
367
  enabled: !0
@@ -372,21 +372,21 @@ const on = "width=650,height=800,popup=true", an = 500, rn = 5 * 60 * 1e3, sn =
372
372
  channelCards: i
373
373
  };
374
374
  }, Cn = (n) => {
375
- var r, c, a, u;
375
+ var r, l, a, u;
376
376
  if (!n)
377
377
  return [];
378
378
  const e = [
379
379
  {
380
380
  value: null,
381
- label: !!((c = (r = n.configuration) == null ? void 0 : r.identifier) != null && c.linkTemplateScript) ? "Connect with OAuth" : "Default configuration"
381
+ label: !!((l = (r = n.configuration) == null ? void 0 : r.identifier) != null && l.linkTemplateScript) ? "Connect with OAuth" : "Default configuration"
382
382
  }
383
383
  ];
384
- for (const [d, l] of Object.entries(n.configurations ?? {}))
385
- d !== ot && e.push({
386
- value: d,
387
- label: gn(l.description) || l.title || d
384
+ for (const [c, d] of Object.entries(n.configurations ?? {}))
385
+ c !== rt && e.push({
386
+ value: c,
387
+ label: gn(d.description) || d.title || c
388
388
  });
389
- return !!((a = n.sandbox) == null ? void 0 : a.identifierExtractScript) && !!((u = n.configurations) != null && u[ot]) && e.push({ value: ot, label: "Connect to a Playground" }), e;
389
+ return !!((a = n.sandbox) == null ? void 0 : a.identifierExtractScript) && !!((u = n.configurations) != null && u[rt]) && e.push({ value: rt, label: "Connect to a Playground" }), e;
390
390
  }, wn = ({
391
391
  installedState: n,
392
392
  connectionMethods: t
@@ -401,15 +401,15 @@ const on = "width=650,height=800,popup=true", an = 500, rn = 5 * 60 * 1e3, sn =
401
401
  verification: i,
402
402
  sortMethod: o
403
403
  }) => {
404
- const r = t.trim().toLowerCase(), c = i ?? [];
404
+ const r = t.trim().toLowerCase(), l = i ?? [];
405
405
  let a = n;
406
- if (r && (a = a.filter((l) => (l.title || l.name).toLowerCase().includes(r))), e && e !== "all" && (a = a.filter((l) => e === "private" ? l.isPrivate : !l.isPrivate)), c.length > 0 && (a = a.filter((l) => {
407
- const b = c.includes("official") && l.isOfficial, p = c.includes("verified") && l.isVerified;
408
- return b || p;
406
+ if (r && (a = a.filter((d) => (d.title || d.name).toLowerCase().includes(r))), e && e !== "all" && (a = a.filter((d) => e === "private" ? d.isPrivate : !d.isPrivate)), l.length > 0 && (a = a.filter((d) => {
407
+ const b = l.includes("official") && d.isOfficial, C = l.includes("verified") && d.isVerified;
408
+ return b || C;
409
409
  })), !o)
410
410
  return a;
411
- const u = (l) => (l.title || l.name).toLowerCase(), d = (l) => l.updatedAt ? new Date(l.updatedAt).getTime() : 0;
412
- return [...a].sort((l, b) => o === "asc" ? u(l).localeCompare(u(b), void 0, { sensitivity: "base" }) : o === "desc" ? u(b).localeCompare(u(l), void 0, { sensitivity: "base" }) : o === "newest" ? d(b) - d(l) : d(l) - d(b));
411
+ const u = (d) => (d.title || d.name).toLowerCase(), c = (d) => d.updatedAt ? new Date(d.updatedAt).getTime() : 0;
412
+ return [...a].sort((d, b) => o === "asc" ? u(d).localeCompare(u(b), void 0, { sensitivity: "base" }) : o === "desc" ? u(b).localeCompare(u(d), void 0, { sensitivity: "base" }) : o === "newest" ? c(b) - c(d) : c(d) - c(b));
413
413
  }, Zn = (n) => {
414
414
  const t = /* @__PURE__ */ new Map();
415
415
  for (const e of n)
@@ -436,7 +436,7 @@ const on = "width=650,height=800,popup=true", an = 500, rn = 5 * 60 * 1e3, sn =
436
436
  installedIntegrations: n,
437
437
  integrationId: t,
438
438
  integrationName: e
439
- }) => pt({
439
+ }) => ft({
440
440
  installedIntegrations: n,
441
441
  integrationId: t,
442
442
  integrationName: e
@@ -446,70 +446,70 @@ const on = "width=650,height=800,popup=true", an = 500, rn = 5 * 60 * 1e3, sn =
446
446
  const [i, o] = await Promise.all([
447
447
  An({ client: n, integrationId: e }),
448
448
  n.getBot({ id: t })
449
- ]), r = Z(o.bot.integrations), c = Tn({
449
+ ]), r = X(o.bot.integrations), l = Tn({
450
450
  installedIntegrations: r,
451
451
  integrationId: e,
452
452
  integrationName: i.name
453
453
  }), a = Cn(i);
454
454
  return {
455
455
  definition: i,
456
- installedState: c,
456
+ installedState: l,
457
457
  capabilities: vn(i),
458
458
  connectionMethods: a,
459
- selectedConnectionMethod: wn({ installedState: c, connectionMethods: a })
459
+ selectedConnectionMethod: wn({ installedState: l, connectionMethods: a })
460
460
  };
461
- }, Mt = ({
461
+ }, Bt = ({
462
462
  client: n,
463
463
  workspaceId: t,
464
464
  botId: e,
465
465
  integrationId: i,
466
466
  enabled: o = !0
467
467
  }) => {
468
- const r = It(), c = E(() => yn(t, e), [t, e]), { data: a, isLoading: u, error: d, refetch: l } = yt({
469
- queryKey: [...c, "details", i],
468
+ const r = yt(), l = L(() => yn(t, e), [t, e]), { data: a, isLoading: u, error: c, refetch: d } = St({
469
+ queryKey: [...l, "details", i],
470
470
  enabled: o && !!i,
471
471
  queryFn: () => On({ client: n, workspaceId: t, botId: e, integrationId: i, enabled: o })
472
- }), b = G(async () => {
473
- await r.invalidateQueries({ queryKey: c });
474
- }, [r, c]), p = () => {
472
+ }), b = J(async () => {
473
+ await r.invalidateQueries({ queryKey: l });
474
+ }, [r, l]), C = () => {
475
475
  if (!(a != null && a.installedState))
476
476
  throw new Error("Integration is not installed on this bot");
477
477
  return a.installedState;
478
- }, S = D({
479
- mutationFn: async (I) => {
480
- const g = p();
478
+ }, T = D({
479
+ mutationFn: async (y) => {
480
+ const p = C();
481
481
  await n.updateBot({
482
482
  id: e,
483
483
  integrations: {
484
- [g.botIntegrationId]: {
485
- configuration: I,
486
- configurationType: g.configurationType ?? null
484
+ [p.botIntegrationId]: {
485
+ configuration: y,
486
+ configurationType: p.configurationType ?? null
487
487
  }
488
488
  }
489
489
  });
490
490
  },
491
491
  onSuccess: b
492
- }), x = D({
492
+ }), M = D({
493
493
  mutationFn: async () => {
494
- const I = p();
494
+ const y = C();
495
495
  await n.updateBot({
496
496
  id: e,
497
497
  integrations: {
498
- [I.botIntegrationId]: {
499
- enabled: !I.enabled
498
+ [y.botIntegrationId]: {
499
+ enabled: !y.enabled
500
500
  }
501
501
  }
502
502
  });
503
503
  },
504
504
  onSuccess: b
505
- }), P = D({
506
- mutationFn: async (I) => {
507
- const g = p();
505
+ }), k = D({
506
+ mutationFn: async (y) => {
507
+ const p = C();
508
508
  await n.updateBot({
509
509
  id: e,
510
510
  integrations: {
511
- [g.botIntegrationId]: {
512
- configurationType: I
511
+ [p.botIntegrationId]: {
512
+ configurationType: y
513
513
  }
514
514
  }
515
515
  });
@@ -527,18 +527,18 @@ const on = "width=650,height=800,popup=true", an = 500, rn = 5 * 60 * 1e3, sn =
527
527
  },
528
528
  connectionMethods: (a == null ? void 0 : a.connectionMethods) ?? [],
529
529
  isLoading: u,
530
- error: d ? ut(d) : null,
531
- saveConfig: S.mutateAsync,
532
- toggleEnabled: x.mutateAsync,
533
- setConnectionMethod: P.mutateAsync,
530
+ error: c ? pt(c) : null,
531
+ saveConfig: T.mutateAsync,
532
+ toggleEnabled: M.mutateAsync,
533
+ setConnectionMethod: k.mutateAsync,
534
534
  refresh: () => {
535
- l();
535
+ d();
536
536
  },
537
- isSavingConfig: S.isPending,
538
- isTogglingEnabled: x.isPending,
539
- isSettingConnectionMethod: P.isPending
537
+ isSavingConfig: T.isPending,
538
+ isTogglingEnabled: M.isPending,
539
+ isSettingConnectionMethod: k.isPending
540
540
  };
541
- }, Jn = Mt, xt = 100, Ut = 200, Pn = (n, t) => ["integration-hub", n, t], Bn = ({
541
+ }, Jn = Bt, Ut = 100, kt = 200, Mn = (n, t) => ["integration-hub", n, t], Pn = ({
542
542
  publicIntegrations: n,
543
543
  privateIntegrations: t
544
544
  }) => {
@@ -548,32 +548,32 @@ const on = "width=650,height=800,popup=true", an = 500, rn = 5 * 60 * 1e3, sn =
548
548
  for (const i of t)
549
549
  e.set(i.id, i);
550
550
  return [...e.values()];
551
- }, Mn = async ({ client: n }) => {
551
+ }, xn = async ({ client: n }) => {
552
552
  const t = [];
553
553
  let e, i = 0;
554
554
  do {
555
555
  const o = e, r = await n.listPublicIntegrations({
556
- limit: xt,
556
+ limit: Ut,
557
557
  version: "latest",
558
558
  nextToken: e
559
559
  });
560
- if (t.push(...r.integrations), e = r.meta.nextToken, i += 1, i >= Ut)
560
+ if (t.push(...r.integrations), e = r.meta.nextToken, i += 1, i >= kt)
561
561
  throw new Error("Public integration pagination exceeded safety limit");
562
562
  if (e && e === o)
563
563
  break;
564
564
  } while (e);
565
565
  return t;
566
- }, xn = async ({ client: n }) => {
566
+ }, Bn = async ({ client: n }) => {
567
567
  const t = [];
568
568
  let e, i = 0;
569
569
  do {
570
570
  const o = e, r = await n.listIntegrations({
571
- limit: xt,
571
+ limit: Ut,
572
572
  version: "latest",
573
573
  visibility: "private",
574
574
  nextToken: e
575
575
  });
576
- if (t.push(...r.integrations), e = r.meta.nextToken, i += 1, i >= Ut)
576
+ if (t.push(...r.integrations), e = r.meta.nextToken, i += 1, i >= kt)
577
577
  throw new Error("Private integration pagination exceeded safety limit");
578
578
  if (e && e === o)
579
579
  break;
@@ -596,168 +596,139 @@ const on = "width=650,height=800,popup=true", an = 500, rn = 5 * 60 * 1e3, sn =
596
596
  integrationId: n,
597
597
  installedIntegrations: t
598
598
  }) => {
599
- const e = pt({ installedIntegrations: t, integrationId: n });
599
+ const e = ft({ installedIntegrations: t, integrationId: n });
600
600
  return (e == null ? void 0 : e.botIntegrationId) ?? n;
601
- }, rt = async ({
602
- client: n,
603
- botId: t,
604
- integrationId: e,
605
- patch: i
606
- }) => {
607
- const { bot: o } = await n.getBot({ id: t }), r = Z(o.integrations), c = kn({ integrationId: e, installedIntegrations: r });
608
- await n.updateBot({
609
- id: t,
610
- integrations: {
611
- [c]: i
612
- }
613
- });
614
601
  }, En = async ({ client: n, botId: t, categoryResolver: e }) => {
615
602
  const [i, o, r] = await Promise.all([
616
- Mn({ client: n }),
617
603
  xn({ client: n }),
604
+ Bn({ client: n }),
618
605
  n.getBot({ id: t })
619
- ]), c = Z(r.bot.integrations), a = Bn({ publicIntegrations: i, privateIntegrations: o }), u = new Map(c.map((p) => [p.name, p])), d = new Map(a.map((p) => [p.name, p])), l = a.map(
620
- (p) => hn({
621
- summary: p,
606
+ ]), l = X(r.bot.integrations), a = Pn({ publicIntegrations: i, privateIntegrations: o }), u = new Map(l.map((C) => [C.name, C])), c = new Map(a.map((C) => [C.name, C])), d = a.map(
607
+ (C) => hn({
608
+ summary: C,
622
609
  installedByName: u,
623
610
  categoryResolver: e
624
611
  })
625
- ), b = c.map(
626
- (p) => bn({
627
- installedIntegration: p,
628
- summary: d.get(p.name),
612
+ ), b = l.map(
613
+ (C) => bn({
614
+ installedIntegration: C,
615
+ summary: c.get(C.name),
629
616
  categoryResolver: e
630
617
  })
631
618
  );
632
619
  return {
633
- integrations: l,
620
+ integrations: d,
634
621
  installedIntegrations: b
635
622
  };
636
- }, kt = ({
623
+ }, Et = ({
637
624
  client: n,
638
625
  workspaceId: t,
639
626
  botId: e,
640
627
  categoryResolver: i,
641
- enabled: o = !0
628
+ enabled: o = !0,
629
+ transformIntegrationPatch: r
642
630
  }) => {
643
- const r = It(), c = E(() => Pn(t, e), [t, e]), a = dt(Promise.resolve()), { data: u, isLoading: d, error: l, refetch: b } = yt({
644
- queryKey: [...c, "catalog"],
631
+ const l = yt(), a = L(() => Mn(t, e), [t, e]), u = ut(Promise.resolve()), { data: c, isLoading: d, error: b, refetch: C } = St({
632
+ queryKey: [...a, "catalog"],
645
633
  enabled: o,
646
634
  queryFn: () => En({ client: n, workspaceId: t, botId: e, categoryResolver: i })
647
- }), p = G(async () => {
648
- await r.invalidateQueries({ queryKey: c });
649
- }, [r, c]), S = G(async (C) => {
650
- const L = a.current.then(C, C);
651
- return a.current = L.then(
635
+ }), T = J(async () => {
636
+ await l.invalidateQueries({ queryKey: a });
637
+ }, [l, a]), M = J(async (f) => {
638
+ const h = u.current.then(f, f);
639
+ return u.current = h.then(
652
640
  () => {
653
641
  },
654
642
  () => {
655
643
  }
656
- ), L;
657
- }, []), x = D({
658
- mutationFn: async (C) => {
659
- await S(async () => {
660
- await n.updateBot({
661
- id: e,
662
- integrations: {
663
- [C]: {
664
- enabled: !0
665
- }
666
- }
667
- });
644
+ ), h;
645
+ }, []), k = async (f, h) => {
646
+ const S = r == null ? void 0 : r[f];
647
+ return S ? await S(h) : h;
648
+ }, y = async (f) => {
649
+ const { bot: h } = await n.getBot({ id: e }), S = X(h.integrations);
650
+ return kn({ integrationId: f, installedIntegrations: S });
651
+ }, p = async (f, h) => {
652
+ const S = await k(f, h);
653
+ await n.updateBot({ id: e, integrations: S });
654
+ }, g = D({
655
+ mutationFn: async (f) => {
656
+ await M(async () => {
657
+ await p("install", { [f]: { enabled: !0 } });
668
658
  });
669
659
  },
670
- onSuccess: p
671
- }), P = D({
672
- mutationFn: async (C) => {
673
- await S(async () => {
674
- await rt({
675
- client: n,
676
- botId: e,
677
- integrationId: C,
678
- patch: null
679
- });
660
+ onSuccess: T
661
+ }), E = D({
662
+ mutationFn: async (f) => {
663
+ await M(async () => {
664
+ const h = await y(f);
665
+ await p("uninstall", { [h]: null });
680
666
  });
681
667
  },
682
- onSuccess: p
683
- }), I = D({
684
- mutationFn: async (C) => {
685
- await S(async () => {
686
- await rt({
687
- client: n,
688
- botId: e,
689
- integrationId: C,
690
- patch: {
691
- enabled: !0
692
- }
693
- });
668
+ onSuccess: T
669
+ }), V = D({
670
+ mutationFn: async (f) => {
671
+ await M(async () => {
672
+ const h = await y(f);
673
+ await p("enable", { [h]: { enabled: !0 } });
694
674
  });
695
675
  },
696
- onSuccess: p
697
- }), g = D({
698
- mutationFn: async (C) => {
699
- await S(async () => {
700
- await rt({
701
- client: n,
702
- botId: e,
703
- integrationId: C,
704
- patch: {
705
- enabled: !1
706
- }
707
- });
676
+ onSuccess: T
677
+ }), _ = D({
678
+ mutationFn: async (f) => {
679
+ await M(async () => {
680
+ const h = await y(f);
681
+ await p("disable", { [h]: { enabled: !1 } });
708
682
  });
709
683
  },
710
- onSuccess: p
711
- }), f = D({
712
- mutationFn: async (C) => {
713
- await S(async () => {
714
- const { bot: L } = await n.getBot({ id: e }), H = Z(L.integrations), k = await Un({ client: n, integrationId: C }), y = pt({
715
- installedIntegrations: H,
716
- integrationId: C,
717
- integrationName: k
718
- }), M = {
719
- enabled: (y == null ? void 0 : y.enabled) ?? !0,
720
- configuration: (y == null ? void 0 : y.configuration) ?? {},
721
- configurationType: (y == null ? void 0 : y.configurationType) ?? null
722
- }, U = {
723
- [C]: M
684
+ onSuccess: T
685
+ }), U = D({
686
+ mutationFn: async (f) => {
687
+ await M(async () => {
688
+ const { bot: h } = await n.getBot({ id: e }), S = X(h.integrations), N = await Un({ client: n, integrationId: f }), A = ft({
689
+ installedIntegrations: S,
690
+ integrationId: f,
691
+ integrationName: N
692
+ }), K = {
693
+ enabled: (A == null ? void 0 : A.enabled) ?? !0,
694
+ configuration: (A == null ? void 0 : A.configuration) ?? {},
695
+ configurationType: (A == null ? void 0 : A.configurationType) ?? null
696
+ }, Q = {
697
+ [f]: K
724
698
  };
725
- y && y.botIntegrationId !== C && (U[y.botIntegrationId] = null), await n.updateBot({
726
- id: e,
727
- integrations: U
728
- });
699
+ A && A.botIntegrationId !== f && (Q[A.botIntegrationId] = null), await p("upgrade", Q);
729
700
  });
730
701
  },
731
- onSuccess: p
702
+ onSuccess: T
732
703
  });
733
704
  return {
734
- integrations: (u == null ? void 0 : u.integrations) ?? [],
735
- installedIntegrations: (u == null ? void 0 : u.installedIntegrations) ?? [],
705
+ integrations: (c == null ? void 0 : c.integrations) ?? [],
706
+ installedIntegrations: (c == null ? void 0 : c.installedIntegrations) ?? [],
736
707
  isLoading: d,
737
- error: l ? ut(l) : null,
738
- install: x.mutateAsync,
739
- uninstall: P.mutateAsync,
740
- enable: I.mutateAsync,
741
- disable: g.mutateAsync,
742
- upgrade: f.mutateAsync,
708
+ error: b ? pt(b) : null,
709
+ install: g.mutateAsync,
710
+ uninstall: E.mutateAsync,
711
+ enable: V.mutateAsync,
712
+ disable: _.mutateAsync,
713
+ upgrade: U.mutateAsync,
743
714
  refresh: () => {
744
- b();
715
+ C();
745
716
  },
746
- isInstalling: x.isPending,
747
- isUninstalling: P.isPending,
748
- isEnabling: I.isPending,
749
- isDisabling: g.isPending,
750
- isUpgrading: f.isPending
717
+ isInstalling: g.isPending,
718
+ isUninstalling: E.isPending,
719
+ isEnabling: V.isPending,
720
+ isDisabling: _.isPending,
721
+ isUpgrading: U.isPending
751
722
  };
752
- }, Xn = kt, Ln = ["official", "verified"], Nn = () => /* @__PURE__ */ v("div", { className: "flex items-center justify-center py-16", children: /* @__PURE__ */ v(wt, { className: "h-6 w-6 animate-spin text-[var(--gray-9)]" }) }), Fn = () => /* @__PURE__ */ v("div", { className: "flex items-center justify-center py-16 text-sm text-[var(--gray-11)]", children: "Integration details are unavailable for this selection." }), jn = (n) => n ? {
723
+ }, Xn = Et, Ln = ["official", "verified"], Nn = () => /* @__PURE__ */ w("div", { className: "flex items-center justify-center py-16", children: /* @__PURE__ */ w(It, { className: "h-6 w-6 animate-spin text-[var(--gray-9)]" }) }), Fn = () => /* @__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." }), jn = (n) => n ? {
753
724
  key: n.key,
754
725
  type: n.type
755
726
  } : null, Dn = ({
756
727
  definition: n,
757
728
  selectedConnectionMethod: t
758
729
  }) => {
759
- var e, i, o, r, c;
760
- return t ? ((o = (i = (e = n.configurations) == null ? void 0 : e[t]) == null ? void 0 : i.identifier) == null ? void 0 : o.linkTemplateScript) ?? null : ((c = (r = n.configuration) == null ? void 0 : r.identifier) == null ? void 0 : c.linkTemplateScript) ?? null;
730
+ var e, i, o, r, l;
731
+ return t ? ((o = (i = (e = n.configurations) == null ? void 0 : e[t]) == null ? void 0 : i.identifier) == null ? void 0 : o.linkTemplateScript) ?? null : ((l = (r = n.configuration) == null ? void 0 : r.identifier) == null ? void 0 : l.linkTemplateScript) ?? null;
761
732
  }, Vn = ({
762
733
  client: n,
763
734
  workspaceId: t,
@@ -765,159 +736,161 @@ const on = "width=650,height=800,popup=true", an = 500, rn = 5 * 60 * 1e3, sn =
765
736
  initialView: i = "hub",
766
737
  categories: o,
767
738
  bannerSlides: r,
768
- bannerIconUrl: c,
739
+ bannerIconUrl: l,
769
740
  noResultsDocumentationLink: a,
770
741
  disableInstallation: u = !1,
771
- hasWriteAccess: d = !0,
772
- categoryResolver: l,
773
- filterMenuLabels: b,
774
- defaultVisibility: p,
775
- defaultVerification: S,
776
- defaultSortMethod: x,
777
- renderConfigurationForm: P,
778
- renderConnectionsContent: I,
742
+ hasWriteAccess: c = !0,
743
+ transformIntegrationPatch: d,
744
+ categoryResolver: b,
745
+ filterMenuLabels: C,
746
+ defaultVisibility: T,
747
+ defaultVerification: M,
748
+ defaultSortMethod: k,
749
+ renderConfigurationForm: y,
750
+ renderConnectionsContent: p,
779
751
  oauthTemplateData: g,
780
- renderDetailPanel: f,
781
- onInstall: C,
782
- onUninstall: L,
783
- onEnable: H,
784
- onDisable: k,
785
- onUpgrade: y,
786
- onError: M
752
+ renderDetailPanel: E,
753
+ onInstall: V,
754
+ onUninstall: _,
755
+ onEnable: U,
756
+ onDisable: f,
757
+ onUpgrade: h,
758
+ onError: S
787
759
  }) => {
788
- const [U, K] = O(i), [N, Et] = O(""), [F, q] = O(null), [J, z] = O(null), [X, Lt] = O(p), [Y, Nt] = O(
789
- S ?? [...Ln]
790
- ), [m, Ft] = O(x), [jt, tt] = O("connections"), [Dt, nt] = O("connections"), w = kt({
760
+ const [N, A] = x(i), [K, Q] = x(""), [F, W] = x(null), [Y, q] = x(null), [m, Lt] = x(T), [tt, Nt] = x(
761
+ M ?? [...Ln]
762
+ ), [nt, Ft] = x(k), [jt, et] = x("connections"), [Dt, it] = x("connections"), I = Et({
791
763
  client: n,
792
764
  workspaceId: t,
793
765
  botId: e,
794
- categoryResolver: l,
795
- enabled: !0
796
- }), Vt = E(
766
+ categoryResolver: b,
767
+ enabled: !0,
768
+ transformIntegrationPatch: d
769
+ }), Vt = L(
797
770
  () => In({
798
- integrations: w.integrations,
799
- searchTerm: N,
800
- visibility: X,
801
- verification: Y,
802
- sortMethod: m
771
+ integrations: I.integrations,
772
+ searchTerm: K,
773
+ visibility: m,
774
+ verification: tt,
775
+ sortMethod: nt
803
776
  }),
804
- [w.integrations, N, X, Y, m]
805
- ), B = E(
806
- () => [...w.integrations, ...w.installedIntegrations].find(
807
- (h) => h.id === F
777
+ [I.integrations, K, m, tt, nt]
778
+ ), B = L(
779
+ () => [...I.integrations, ...I.installedIntegrations].find(
780
+ (v) => v.id === F
808
781
  ) ?? null,
809
- [w.integrations, w.installedIntegrations, F]
810
- ), s = Mt({
782
+ [I.integrations, I.installedIntegrations, F]
783
+ ), s = Bt({
811
784
  client: n,
812
785
  workspaceId: t,
813
786
  botId: e,
814
787
  integrationId: F,
815
788
  enabled: !!F
816
- }), _t = E(
817
- () => (o == null ? void 0 : o.filter((h) => h.name !== "Popular").map((h) => h.name)) ?? [],
789
+ }), _t = L(
790
+ () => (o == null ? void 0 : o.filter((v) => v.name !== "Popular").map((v) => v.name)) ?? [],
818
791
  [o]
819
- ), Q = G(
820
- (h) => {
821
- const T = ut(h);
822
- M == null || M(T);
792
+ ), R = J(
793
+ (v) => {
794
+ const P = pt(v);
795
+ S == null || S(P);
823
796
  },
824
- [M]
825
- ), W = async ({
826
- operation: h,
827
- onSuccess: T,
797
+ [S]
798
+ ), $ = async ({
799
+ operation: v,
800
+ onSuccess: P,
828
801
  integration: j
829
802
  }) => {
830
- const V = j ?? B;
831
- if (V)
803
+ const H = j ?? B;
804
+ if (H)
832
805
  try {
833
- await h(), T == null || T(V);
834
- } catch (et) {
835
- Q(et);
806
+ await v(), P == null || P(H);
807
+ } catch (ot) {
808
+ R(ot);
836
809
  }
837
- }, Ht = (h) => {
838
- var gt, ht, bt, vt;
839
- if (!F || h !== F)
810
+ }, Kt = (v) => {
811
+ var ht, bt, vt, Ct;
812
+ if (!F || v !== F)
840
813
  return null;
841
814
  if (s.isLoading)
842
815
  return Nn();
843
816
  if (!s.definition || !B)
844
817
  return Fn();
845
- const T = !!s.installedState, j = Dn({
818
+ const P = !!s.installedState, j = Dn({
846
819
  definition: s.definition,
847
820
  selectedConnectionMethod: s.selectedConnectionMethod
848
- }), V = s.connectionMethods.length > 1 || !!j, et = St({
821
+ }), H = s.connectionMethods.length > 1 || !!j, ot = At({
849
822
  definition: s.definition,
850
823
  selectedConnectionMethod: s.selectedConnectionMethod
851
- }), Kt = At(et).length > 0, zt = !!P || Kt, ft = async (A) => {
824
+ }), Ht = Tt(ot).length > 0, zt = !!y || Ht, gt = async (O) => {
852
825
  try {
853
- await s.saveConfig(A);
854
- } catch (R) {
855
- Q(R);
826
+ await s.saveConfig(O);
827
+ } catch (G) {
828
+ R(G);
856
829
  }
857
- }, qt = I ? I({
830
+ }, qt = p ? p({
858
831
  definition: s.definition,
859
832
  installedState: s.installedState,
860
833
  connectionMethods: s.connectionMethods,
861
834
  selectedConnectionMethod: s.selectedConnectionMethod,
862
835
  onConnectionMethodChange: s.setConnectionMethod,
863
836
  isSettingConnectionMethod: s.isSettingConnectionMethod
864
- }) : /* @__PURE__ */ _("div", { className: "flex flex-col gap-4", children: [
865
- /* @__PURE__ */ v("div", { className: "self-end", children: /* @__PURE__ */ v(
837
+ }) : /* @__PURE__ */ z("div", { className: "flex flex-col gap-4", children: [
838
+ /* @__PURE__ */ w("div", { className: "self-end", children: /* @__PURE__ */ w(
866
839
  Jt,
867
840
  {
868
841
  options: s.connectionMethods,
869
842
  value: s.selectedConnectionMethod,
870
- disabled: !d,
871
- onChange: (A) => {
872
- d && s.setConnectionMethod(A).catch(Q);
843
+ disabled: !c,
844
+ onChange: (O) => {
845
+ c && s.setConnectionMethod(O).catch(R);
873
846
  }
874
847
  }
875
848
  ) }),
876
- j ? /* @__PURE__ */ v(
849
+ j ? /* @__PURE__ */ w(
877
850
  un,
878
851
  {
879
852
  client: n,
880
853
  integrationName: s.definition.title ?? s.definition.name,
881
854
  linkTemplateScript: j,
882
- webhookUrl: (gt = s.installedState) == null ? void 0 : gt.webhookUrl,
855
+ webhookUrl: (ht = s.installedState) == null ? void 0 : ht.webhookUrl,
883
856
  oauthTemplateData: g,
884
- isAuthorized: !!((ht = s.installedState) != null && ht.identifier),
885
- disabled: !d,
857
+ isAuthorized: !!((bt = s.installedState) != null && bt.identifier),
858
+ disabled: !c,
886
859
  onAuthorized: async () => {
887
- s.refresh(), w.refresh();
860
+ s.refresh(), I.refresh();
888
861
  },
889
- onError: Q
862
+ onError: R
890
863
  }
891
- ) : /* @__PURE__ */ _("p", { className: "text-sm text-[var(--gray-11)]", children: [
864
+ ) : /* @__PURE__ */ z("p", { className: "text-sm text-[var(--gray-11)]", children: [
892
865
  "No custom connection UI was provided. Use ",
893
- /* @__PURE__ */ v("code", { children: "renderConnectionsContent" }),
866
+ /* @__PURE__ */ w("code", { children: "renderConnectionsContent" }),
894
867
  " to plug your OAuth/manual connection flow."
895
868
  ] })
896
- ] }), Qt = /* @__PURE__ */ v(
869
+ ] }), Qt = /* @__PURE__ */ w(
897
870
  Xt,
898
871
  {
899
- webhookUrl: (bt = s.installedState) == null ? void 0 : bt.webhookUrl,
872
+ webhookUrl: (vt = s.installedState) == null ? void 0 : vt.webhookUrl,
900
873
  isBlocked: !s.installedState,
901
- children: P ? P({
874
+ children: y ? y({
902
875
  definition: s.definition,
903
876
  installedState: s.installedState,
904
877
  selectedConnectionMethod: s.selectedConnectionMethod,
905
- onSave: ft,
878
+ onSave: gt,
906
879
  isSaving: s.isSavingConfig
907
- }) : /* @__PURE__ */ v(
880
+ }) : /* @__PURE__ */ w(
908
881
  pn,
909
882
  {
910
883
  definition: s.definition,
911
884
  installedState: s.installedState,
912
885
  selectedConnectionMethod: s.selectedConnectionMethod,
913
- onSave: ft,
886
+ onSave: gt,
914
887
  isSaving: s.isSavingConfig,
915
- disabled: !d || !s.installedState
888
+ disabled: !c || !s.installedState
916
889
  }
917
890
  )
918
891
  }
919
892
  );
920
- return /* @__PURE__ */ v(
893
+ return /* @__PURE__ */ w(
921
894
  Yt,
922
895
  {
923
896
  title: s.definition.title ?? s.definition.name,
@@ -927,80 +900,80 @@ const on = "width=650,height=800,popup=true", an = 500, rn = 5 * 60 * 1e3, sn =
927
900
  isVerified: B.isVerified,
928
901
  isPrivate: B.isPrivate,
929
902
  onBack: () => {
930
- q(null), z(null);
903
+ W(null), q(null);
931
904
  },
932
- onInstall: T || u || !d ? void 0 : () => {
933
- W({
934
- operation: () => w.install(B.id),
935
- onSuccess: C,
905
+ onInstall: P || u || !c ? void 0 : () => {
906
+ $({
907
+ operation: () => I.install(B.id),
908
+ onSuccess: V,
936
909
  integration: B
937
910
  });
938
911
  },
939
- onToggleEnabled: !T || !d ? void 0 : () => {
940
- const A = s.installedState, R = !!(A != null && A.enabled);
941
- W({
912
+ onToggleEnabled: !P || !c ? void 0 : () => {
913
+ const O = s.installedState, G = !!(O != null && O.enabled);
914
+ $({
942
915
  operation: async () => {
943
- if (!A)
916
+ if (!O)
944
917
  throw new Error("Integration is not installed");
945
- if (R) {
946
- await w.disable(A.id);
918
+ if (G) {
919
+ await I.disable(O.id);
947
920
  return;
948
921
  }
949
- await w.enable(A.id);
922
+ await I.enable(O.id);
950
923
  },
951
- onSuccess: R ? k : H,
924
+ onSuccess: G ? f : U,
952
925
  integration: B
953
926
  });
954
927
  },
955
- onUninstall: !T || !d ? void 0 : () => {
956
- const A = s.installedState;
957
- W({
928
+ onUninstall: !P || !c ? void 0 : () => {
929
+ const O = s.installedState;
930
+ $({
958
931
  operation: async () => {
959
- if (!A)
932
+ if (!O)
960
933
  throw new Error("Integration is not installed");
961
- await w.uninstall(A.id);
934
+ await I.uninstall(O.id);
962
935
  },
963
- onSuccess: L,
936
+ onSuccess: _,
964
937
  integration: B
965
938
  });
966
939
  },
967
- onUpgrade: !B.hasUpdate || !d ? void 0 : () => {
968
- W({
969
- operation: () => w.upgrade(B.id),
970
- onSuccess: y,
940
+ onUpgrade: !B.hasUpdate || !c ? void 0 : () => {
941
+ $({
942
+ operation: () => I.upgrade(B.id),
943
+ onSuccess: h,
971
944
  integration: B
972
945
  });
973
946
  },
974
- isInstalled: T,
947
+ isInstalled: P,
975
948
  disableInstallation: u,
976
- hasWriteAccess: d,
977
- isInstalling: w.isInstalling,
978
- isUninstalling: w.isUninstalling,
979
- isTogglingEnabled: w.isEnabling || w.isDisabling,
949
+ hasWriteAccess: c,
950
+ isInstalling: I.isInstalling,
951
+ isUninstalling: I.isUninstalling,
952
+ isTogglingEnabled: I.isEnabling || I.isDisabling,
980
953
  hasUpdate: B.hasUpdate,
981
- isUpgrading: w.isUpgrading,
982
- toggleButtonLabel: (vt = s.installedState) != null && vt.enabled ? "Disable" : "Enable",
983
- selectedDetailPanel: J && f ? f({
954
+ isUpgrading: I.isUpgrading,
955
+ toggleButtonLabel: (Ct = s.installedState) != null && Ct.enabled ? "Disable" : "Enable",
956
+ selectedDetailPanel: Y && E ? E({
984
957
  definition: s.definition,
985
- selectedCard: J,
986
- onClose: () => z(null)
958
+ selectedCard: Y,
959
+ onClose: () => q(null)
987
960
  }) : void 0,
988
- onDismissSelectedDetailPanel: () => z(null),
989
- children: /* @__PURE__ */ v(
961
+ onDismissSelectedDetailPanel: () => q(null),
962
+ children: /* @__PURE__ */ w(
990
963
  mt,
991
964
  {
992
965
  integrationTitle: s.definition.title ?? s.definition.name,
993
- isFullyConfigured: T,
994
- hasConnectionStep: V,
966
+ isFullyConfigured: P,
967
+ hasConnectionStep: H,
995
968
  hasConfigurationStep: zt,
996
969
  configuredTab: jt,
997
- onConfiguredTabChange: tt,
970
+ onConfiguredTabChange: et,
998
971
  setupTab: Dt,
999
- onSetupTabChange: nt,
972
+ onSetupTabChange: it,
1000
973
  onCancelSetup: () => {
1001
- q(null), z(null);
974
+ W(null), q(null);
1002
975
  },
1003
- metadata: /* @__PURE__ */ v(
976
+ metadata: /* @__PURE__ */ w(
1004
977
  tn,
1005
978
  {
1006
979
  version: s.definition.version,
@@ -1010,19 +983,19 @@ const on = "width=650,height=800,popup=true", an = 500, rn = 5 * 60 * 1e3, sn =
1010
983
  ),
1011
984
  connectionsContent: qt,
1012
985
  configurationContent: Qt,
1013
- capabilitiesContent: /* @__PURE__ */ v(
986
+ capabilitiesContent: /* @__PURE__ */ w(
1014
987
  nn,
1015
988
  {
1016
989
  actionCards: s.capabilities.actionCards,
1017
990
  eventCards: s.capabilities.eventCards,
1018
991
  channelCards: s.capabilities.channelCards,
1019
- selectedCard: J,
1020
- onCardSelect: (A) => {
1021
- z(
992
+ selectedCard: Y,
993
+ onCardSelect: (O) => {
994
+ q(
1022
995
  jn(
1023
- A ? {
1024
- key: A.key,
1025
- type: A.type
996
+ O ? {
997
+ key: O.key,
998
+ type: O.type
1026
999
  } : null
1027
1000
  )
1028
1001
  );
@@ -1034,53 +1007,53 @@ const on = "width=650,height=800,popup=true", an = 500, rn = 5 * 60 * 1e3, sn =
1034
1007
  }
1035
1008
  );
1036
1009
  };
1037
- return /* @__PURE__ */ _("div", { className: "flex h-full min-h-0 flex-col", children: [
1038
- !F && /* @__PURE__ */ v("div", { className: "flex justify-end px-6 pt-4", children: /* @__PURE__ */ _("div", { className: "flex rounded-lg bg-[var(--gray-a3)] p-1", children: [
1039
- /* @__PURE__ */ v(
1010
+ return /* @__PURE__ */ z("div", { className: "flex h-full min-h-0 flex-col", children: [
1011
+ !F && /* @__PURE__ */ w("div", { className: "flex justify-end px-6 pt-4", children: /* @__PURE__ */ z("div", { className: "flex rounded-lg bg-[var(--gray-a3)] p-1", children: [
1012
+ /* @__PURE__ */ w(
1040
1013
  "button",
1041
1014
  {
1042
1015
  type: "button",
1043
- onClick: () => K("hub"),
1044
- className: ct(
1016
+ onClick: () => A("hub"),
1017
+ className: lt(
1045
1018
  "cursor-pointer rounded-md px-3 py-1.5 text-sm text-[var(--gray-11)] transition-colors",
1046
- U === "hub" && "bg-[var(--gray-1)] text-[var(--gray-12)] shadow-sm"
1019
+ N === "hub" && "bg-[var(--gray-1)] text-[var(--gray-12)] shadow-sm"
1047
1020
  ),
1048
1021
  children: "Integration Hub"
1049
1022
  }
1050
1023
  ),
1051
- /* @__PURE__ */ v(
1024
+ /* @__PURE__ */ w(
1052
1025
  "button",
1053
1026
  {
1054
1027
  type: "button",
1055
- onClick: () => K("installed"),
1056
- className: ct(
1028
+ onClick: () => A("installed"),
1029
+ className: lt(
1057
1030
  "cursor-pointer rounded-md px-3 py-1.5 text-sm text-[var(--gray-11)] transition-colors",
1058
- U === "installed" && "bg-[var(--gray-1)] text-[var(--gray-12)] shadow-sm"
1031
+ N === "installed" && "bg-[var(--gray-1)] text-[var(--gray-12)] shadow-sm"
1059
1032
  ),
1060
1033
  children: "Installed Integrations"
1061
1034
  }
1062
1035
  )
1063
1036
  ] }) }),
1064
- /* @__PURE__ */ v(
1037
+ /* @__PURE__ */ w(
1065
1038
  Rt,
1066
1039
  {
1067
- view: U,
1068
- searchInput: N,
1069
- searchTerm: N,
1070
- onSearchInputChange: Et,
1040
+ view: N,
1041
+ searchInput: K,
1042
+ searchTerm: K,
1043
+ onSearchInputChange: Q,
1071
1044
  selectedIntegrationId: F,
1072
1045
  hubIntegrations: Vt,
1073
- sidebarIntegrations: w.integrations,
1074
- installedIntegrations: w.installedIntegrations,
1075
- isHubLoading: w.isLoading,
1076
- isInstalledLoading: w.isLoading,
1077
- filterMenu: /* @__PURE__ */ v(
1046
+ sidebarIntegrations: I.integrations,
1047
+ installedIntegrations: I.installedIntegrations,
1048
+ isHubLoading: I.isLoading,
1049
+ isInstalledLoading: I.isLoading,
1050
+ filterMenu: /* @__PURE__ */ w(
1078
1051
  $t,
1079
1052
  {
1080
- visibility: X,
1081
- verification: Y,
1082
- sortMethod: m,
1083
- labels: b,
1053
+ visibility: m,
1054
+ verification: tt,
1055
+ sortMethod: nt,
1056
+ labels: C,
1084
1057
  onVisibilityChange: Lt,
1085
1058
  onVerificationChange: Nt,
1086
1059
  onSortMethodChange: Ft
@@ -1088,38 +1061,38 @@ const on = "width=650,height=800,popup=true", an = 500, rn = 5 * 60 * 1e3, sn =
1088
1061
  ),
1089
1062
  categories: o,
1090
1063
  bannerSlides: r,
1091
- bannerIconUrl: c,
1064
+ bannerIconUrl: l,
1092
1065
  noResultsDocumentationLink: a,
1093
- renderIntegrationCard: (h, { onEscape: T }) => /* @__PURE__ */ v(
1066
+ renderIntegrationCard: (v, { onEscape: P }) => /* @__PURE__ */ w(
1094
1067
  Gt,
1095
1068
  {
1096
- name: h.title ?? h.name,
1097
- description: h.description,
1098
- author: h.author,
1099
- installed: h.installed,
1100
- updateAvailable: h.hasUpdate,
1101
- verified: h.isVerified,
1102
- official: h.isOfficial,
1103
- private: h.isPrivate,
1104
- iconUrl: h.iconUrl,
1069
+ name: v.title ?? v.name,
1070
+ description: v.description,
1071
+ author: v.author,
1072
+ installed: v.installed,
1073
+ updateAvailable: v.hasUpdate,
1074
+ verified: v.isVerified,
1075
+ official: v.isOfficial,
1076
+ private: v.isPrivate,
1077
+ iconUrl: v.iconUrl,
1105
1078
  onClick: () => {
1106
- q(h.id), tt("connections"), nt("connections");
1079
+ W(v.id), et("connections"), it("connections");
1107
1080
  },
1108
- onEscape: T
1081
+ onEscape: P
1109
1082
  }
1110
1083
  ),
1111
- renderInstalledIntegrations: ({ integrations: h, searchTerm: T, categoryOrder: j }) => /* @__PURE__ */ v(
1084
+ renderInstalledIntegrations: ({ integrations: v, searchTerm: P, categoryOrder: j }) => /* @__PURE__ */ w(
1112
1085
  Zt,
1113
1086
  {
1114
- integrations: h,
1115
- searchTerm: T,
1087
+ integrations: v,
1088
+ searchTerm: P,
1116
1089
  categoryOrder: j.length > 0 ? j : _t,
1117
- onSelectIntegration: (V) => {
1118
- q(V.id), tt("connections"), nt("connections");
1090
+ onSelectIntegration: (H) => {
1091
+ W(H.id), et("connections"), it("connections");
1119
1092
  }
1120
1093
  }
1121
1094
  ),
1122
- renderIntegrationDetails: Ht
1095
+ renderIntegrationDetails: Kt
1123
1096
  }
1124
1097
  )
1125
1098
  ] });
@@ -1132,20 +1105,20 @@ export {
1132
1105
  Zn as dedupeById,
1133
1106
  cn as fetchOAuthAuthorizationUrl,
1134
1107
  In as filterAndSortIntegrations,
1135
- pt as findInstalledIntegration,
1136
- Z as getInstalledIntegrations,
1108
+ ft as findInstalledIntegration,
1109
+ X as getInstalledIntegrations,
1137
1110
  wn as getSelectedConnectionMethod,
1138
1111
  sn as getWebhookIdFromUrl,
1139
1112
  Pt as isOfficialWorkspace,
1140
1113
  ln as openOAuthPopup,
1141
- Bt as resolveCategory,
1114
+ xt as resolveCategory,
1142
1115
  vn as toCapabilityCards,
1143
1116
  Cn as toConnectionMethods,
1144
- ut as toError,
1117
+ pt as toError,
1145
1118
  hn as toHubItem,
1146
1119
  bn as toInstalledItem,
1147
- Mt as useBotpressIntegrationDetails,
1148
- kt as useBotpressIntegrationHub,
1120
+ Bt as useBotpressIntegrationDetails,
1121
+ Et as useBotpressIntegrationHub,
1149
1122
  Jn as useIntegrationDetails,
1150
1123
  Xn as useIntegrationHub
1151
1124
  };