@bpinternal/integration-hub 0.8.1 → 0.8.2

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.
@@ -3,7 +3,7 @@ import type { IntegrationCapabilityCardItem, IntegrationConnectionMethod, Integr
3
3
  import type { BotpressInstalledIntegration, BotpressIntegrationHubItem, CategoryResolver, IntegrationSummary } from './botpressTypes.js';
4
4
  type IntegrationCapabilitiesDefinition = Partial<Pick<Integration, 'actions' | 'events' | 'channels'>>;
5
5
  export declare const toError: (value: unknown) => Error;
6
- export declare const isOfficialWorkspace: (ownerWorkspaceHandle?: string | null) => ownerWorkspaceHandle is "team-cloud-services";
6
+ export declare const isOfficialWorkspace: (ownerWorkspaceId?: string | null) => boolean;
7
7
  export declare const resolveCategory: (integration: IntegrationSummary, categoryResolver?: CategoryResolver) => string;
8
8
  export declare const getInstalledIntegrations: (botIntegrations: Bot["integrations"] | null | undefined) => BotpressInstalledIntegration[];
9
9
  export declare const findInstalledIntegration: ({ installedIntegrations, integrationId, integrationName }: {
@@ -1,7 +1,7 @@
1
1
  import { jsx as w, jsxs as _ } from "react/jsx-runtime";
2
2
  import { Loader2 as Et } from "lucide-react";
3
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";
4
+ import { I as ge, c as yt, u as pe, a as he, b as be, d as ve, e as ye, f as Ce, g as we, h as Ie, i as Se, j as Ae, k as Me, l as Te } from "../chunks/index.js";
5
5
  import { StaticZuiForm as Oe } from "@bpinternal/static-zui-form";
6
6
  import { useQueryClient as Nt, useQuery as Vt, useMutation as q } from "@tanstack/react-query";
7
7
  import "framer-motion";
@@ -16,7 +16,7 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
16
16
  } catch {
17
17
  return t.split("/").filter(Boolean).at(-1) ?? null;
18
18
  }
19
- }, ke = async ({
19
+ }, De = async ({
20
20
  client: t,
21
21
  linkTemplateScript: e,
22
22
  data: i
@@ -28,7 +28,7 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
28
28
  if (typeof n != "string")
29
29
  throw new Error("Authorization URL is not a string");
30
30
  return n;
31
- }, De = async ({
31
+ }, ke = async ({
32
32
  authorizationUrl: t,
33
33
  onClose: e,
34
34
  popupFeatures: i = Pe,
@@ -94,17 +94,17 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
94
94
  } catch {
95
95
  L = {};
96
96
  }
97
- const y = {
97
+ const C = {
98
98
  webhookUrl: o ?? null,
99
99
  webhookId: U,
100
100
  ...L
101
101
  };
102
102
  A(!0);
103
103
  try {
104
- const j = await ke({
104
+ const j = await De({
105
105
  client: t,
106
106
  linkTemplateScript: i,
107
- data: y
107
+ data: C
108
108
  });
109
109
  h || p(j);
110
110
  } catch (j) {
@@ -121,17 +121,17 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
121
121
  if (!(!d || P)) {
122
122
  T(!0);
123
123
  try {
124
- const y = await De({
124
+ const C = await ke({
125
125
  authorizationUrl: d,
126
126
  onClose: c
127
127
  });
128
- if (y === "completed")
128
+ if (C === "completed")
129
129
  return;
130
- if (y === "blocked") {
130
+ if (C === "blocked") {
131
131
  (h = f.current) == null || h.call(f, new Error("Please allow browser popups to authorize this integration."));
132
132
  return;
133
133
  }
134
- if (y === "timeout") {
134
+ if (C === "timeout") {
135
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
  }
@@ -167,22 +167,22 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
167
167
  return [];
168
168
  const e = t.properties;
169
169
  return !e || typeof e != "object" ? [] : Object.keys(e);
170
- }, ht = (t) => !t || typeof t != "object" || Array.isArray(t) ? {} : t, kt = (t, e) => {
170
+ }, ht = (t) => !t || typeof t != "object" || Array.isArray(t) ? {} : t, Dt = (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), yt = (t, e) => {
175
+ }, it = (t) => !!t && typeof t == "object" && !Array.isArray(t), Ct = (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) => yt(i, e[n]));
179
+ return !Array.isArray(t) || !Array.isArray(e) || t.length !== e.length ? !1 : t.every((i, n) => Ct(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) && yt(t[o], e[o])
185
+ (o) => Object.prototype.hasOwnProperty.call(e, o) && Ct(t[o], e[o])
186
186
  );
187
187
  }
188
188
  return !1;
@@ -198,7 +198,7 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
198
198
  () => Ft({ definition: t, selectedConnectionMethod: i }),
199
199
  [t, i]
200
200
  ), r = V(() => jt(l), [l]), c = V(
201
- () => kt(ht(e == null ? void 0 : e.configuration), r),
201
+ () => Dt(ht(e == null ? void 0 : e.configuration), r),
202
202
  [e == null ? void 0 : e.configuration, r]
203
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(() => {
@@ -208,7 +208,7 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
208
208
  schemaKeySignature: g,
209
209
  configuration: c
210
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));
211
+ f && f.integrationAlias === b.integrationAlias && f.configurationType === b.configurationType && f.schemaKeySignature === b.schemaKeySignature && Ct(f.configuration, b.configuration) || (U.current = b, p(c), A(null), T((M) => M + 1));
212
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
213
  /* @__PURE__ */ w(
214
214
  Oe,
@@ -216,7 +216,7 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
216
216
  schema: l,
217
217
  value: d,
218
218
  onChange: (b) => {
219
- const f = kt(ht(b), r);
219
+ const f = Dt(ht(b), r);
220
220
  p(f);
221
221
  },
222
222
  onValidation: ({ formValid: b }) => {
@@ -237,7 +237,7 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
237
237
  ...d
238
238
  });
239
239
  },
240
- className: Ct(
240
+ className: yt(
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
  ),
@@ -248,10 +248,10 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
248
248
  }
249
249
  )
250
250
  ] });
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) => {
251
+ }, _t = "Other", Ve = ["95de33eb-1551-4af9-9088-e5dcb02efd09", "6a76fa10-e150-4ff6-8f59-a300feec06c1"], 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
- }, wt = (t) => t instanceof Error ? t : new Error("An unknown error occurred while loading integrations"), Ht = (t) => t === Ve, zt = (t, e) => {
254
+ }, wt = (t) => t instanceof Error ? t : new Error("An unknown error occurred while loading integrations"), zt = (t) => typeof t == "string" && Ve.includes(t), Ht = (t, e) => {
255
255
  var o;
256
256
  const i = e == null ? void 0 : e(t);
257
257
  if (i)
@@ -276,7 +276,7 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
276
276
  categoryResolver: i
277
277
  }) => {
278
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;
279
+ const n = e.get(t.name), o = zt((c = t.ownerWorkspace) == null ? void 0 : c.id), 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,7 +284,7 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
284
284
  title: t.title,
285
285
  description: t.description,
286
286
  iconUrl: t.iconUrl,
287
- attributes: { category: zt(t, i) },
287
+ attributes: { category: Ht(t, i) },
288
288
  meta: {
289
289
  installs: Kt(t)
290
290
  },
@@ -308,7 +308,7 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
308
308
  categoryResolver: i
309
309
  }) => {
310
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;
311
+ const n = zt((a = e == null ? void 0 : e.ownerWorkspace) == null ? void 0 : a.id), 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,7 +317,7 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
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 ? zt(e, i) : _t
320
+ category: e ? Ht(e, i) : _t
321
321
  },
322
322
  meta: {
323
323
  installs: Kt(e)
@@ -373,7 +373,7 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
373
373
  eventCards: i,
374
374
  channelCards: n
375
375
  };
376
- }, He = (t) => {
376
+ }, ze = (t) => {
377
377
  var a, l, r, c;
378
378
  if (!t)
379
379
  return [];
@@ -389,7 +389,7 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
389
389
  label: Fe(d.description) || d.title || g
390
390
  });
391
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 = ({
392
+ }, He = ({
393
393
  installedState: t,
394
394
  connectionMethods: e
395
395
  }) => {
@@ -459,13 +459,13 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
459
459
  installedIntegrations: a,
460
460
  integrationId: i,
461
461
  integrationName: n.name
462
- }), r = He(n);
462
+ }), r = ze(n);
463
463
  return {
464
464
  definition: n,
465
465
  installedState: l,
466
466
  capabilities: Ke(n),
467
467
  connectionMethods: r,
468
- selectedConnectionMethod: ze({ installedState: l, connectionMethods: r })
468
+ selectedConnectionMethod: He({ installedState: l, connectionMethods: r })
469
469
  };
470
470
  }, qt = ({
471
471
  client: t,
@@ -680,10 +680,10 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
680
680
  }), F = q({
681
681
  mutationFn: async (h) => {
682
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({
683
+ const { bot: S } = await t.getBot({ id: i }), L = ot(S.integrations), C = await me({ client: t, integrationId: h }), O = It({
684
684
  installedIntegrations: L,
685
685
  integrationId: h,
686
- integrationName: y
686
+ integrationName: C
687
687
  }), j = {
688
688
  enabled: (O == null ? void 0 : O.enabled) ?? !0,
689
689
  configuration: (O == null ? void 0 : O.configuration) ?? {},
@@ -715,7 +715,7 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
715
715
  isDisabling: K.isPending,
716
716
  isUpgrading: F.isPending
717
717
  };
718
- }, Tn = $t, nn = ["hub", "installed"], on = (t, e) => `integration-hub:nav:${t}:${e}`, Dt = (t) => {
718
+ }, Tn = $t, nn = ["hub", "installed"], on = (t, e) => `integration-hub:nav:${t}:${e}`, kt = (t) => {
719
719
  try {
720
720
  const e = sessionStorage.getItem(t);
721
721
  if (!e)
@@ -753,7 +753,7 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
753
753
  }) => {
754
754
  const o = on(t, e), a = W(null);
755
755
  if (a.current === null) {
756
- const u = i ? Dt(o) : null;
756
+ const u = i ? kt(o) : null;
757
757
  a.current = Lt(u, n);
758
758
  }
759
759
  const [l, r] = x(a.current.view), [c, g] = x(
@@ -769,51 +769,51 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
769
769
  if (o === L.current)
770
770
  return;
771
771
  L.current = o;
772
- const u = i ? Dt(o) : null, E = Lt(u, n);
772
+ const u = i ? kt(o) : null, E = Lt(u, n);
773
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((u) => {
775
+ const C = N((u) => {
776
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
777
  }, []), O = N(
778
778
  (u) => {
779
- r(u), y({ view: u });
779
+ r(u), C({ view: u });
780
780
  },
781
- [y]
781
+ [C]
782
782
  ), j = N(
783
783
  (u) => {
784
- g(u), y({ selectedIntegrationId: u });
784
+ g(u), C({ selectedIntegrationId: u });
785
785
  },
786
- [y]
786
+ [C]
787
787
  ), $ = N(
788
788
  (u) => {
789
- p(u), y({ selectedDefinitionId: u });
789
+ p(u), C({ selectedDefinitionId: u });
790
790
  },
791
- [y]
791
+ [C]
792
792
  ), G = N(
793
793
  (u) => {
794
- A(u), y({ searchInput: u });
794
+ A(u), C({ searchInput: u });
795
795
  },
796
- [y]
796
+ [C]
797
797
  ), at = N(
798
798
  (u) => {
799
- T(u), y({ visibility: u });
799
+ T(u), C({ visibility: u });
800
800
  },
801
- [y]
801
+ [C]
802
802
  ), st = N(
803
803
  (u) => {
804
- b(u), y({ verification: u });
804
+ b(u), C({ verification: u });
805
805
  },
806
- [y]
806
+ [C]
807
807
  ), X = N(
808
808
  (u) => {
809
- M(u), y({ sortMethod: u });
809
+ M(u), C({ sortMethod: u });
810
810
  },
811
- [y]
811
+ [C]
812
812
  ), Y = N(
813
813
  (u) => {
814
- F(u), y({ selectedCategory: u });
814
+ F(u), C({ selectedCategory: u });
815
815
  },
816
- [y]
816
+ [C]
817
817
  );
818
818
  return {
819
819
  view: l,
@@ -868,7 +868,7 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
868
868
  renderNotifications: h,
869
869
  onShare: S,
870
870
  onInstall: L,
871
- onUninstall: y,
871
+ onUninstall: C,
872
872
  onEnable: O,
873
873
  onDisable: j,
874
874
  onUpgrade: $,
@@ -906,7 +906,7 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
906
906
  botId: i,
907
907
  enabled: at,
908
908
  defaults: st
909
- }), [ut, H] = x(null), [te, Q] = x(!1), [ee, ft] = x("connections"), [ne, gt] = x("connections"), I = $t({
909
+ }), [ut, z] = x(null), [te, Q] = x(!1), [ee, ft] = x("connections"), [ne, gt] = x("connections"), I = $t({
910
910
  client: t,
911
911
  workspaceId: e,
912
912
  botId: i,
@@ -922,15 +922,15 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
922
922
  sortMethod: dt
923
923
  }),
924
924
  [I.integrations, m, ct, lt, dt]
925
- ), k = V(
925
+ ), D = V(
926
926
  () => [...I.integrations, ...I.installedIntegrations].find(
927
- (C) => C.id === u
927
+ (y) => y.id === u
928
928
  ) ?? null,
929
929
  [I.integrations, I.installedIntegrations, u]
930
930
  );
931
931
  Z(() => {
932
- u && !I.isLoading && !k && (E(null), J(null));
933
- }, [u, k, I.isLoading, E, J]);
932
+ u && !I.isLoading && !D && (E(null), J(null));
933
+ }, [u, D, I.isLoading, E, J]);
934
934
  const s = qt({
935
935
  client: t,
936
936
  workspaceId: e,
@@ -939,53 +939,53 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
939
939
  enabled: !!rt,
940
940
  transformIntegrationPatch: v
941
941
  }), oe = V(
942
- () => (l == null ? void 0 : l.filter((C) => C.name !== "Popular").map((C) => C.name)) ?? [],
942
+ () => (l == null ? void 0 : l.filter((y) => y.name !== "Popular").map((y) => y.name)) ?? [],
943
943
  [l]
944
944
  ), { readme: ae, isLoading: se } = pe((St = s.definition) == null ? void 0 : St.readmeUrl);
945
945
  Z(() => {
946
- Q(!1), H(null);
946
+ Q(!1), z(null);
947
947
  }, [rt]);
948
948
  const tt = N(
949
- (C) => {
950
- const B = wt(C);
949
+ (y) => {
950
+ const B = wt(y);
951
951
  G == null || G(B);
952
952
  },
953
953
  [G]
954
954
  ), et = async ({
955
- operation: C,
955
+ operation: y,
956
956
  onSuccess: B,
957
- integration: z
957
+ integration: H
958
958
  }) => {
959
- const R = z ?? k;
959
+ const R = H ?? D;
960
960
  if (R)
961
961
  try {
962
- await C(), B == null || B(R);
962
+ await y(), B == null || B(R);
963
963
  } catch (pt) {
964
964
  tt(pt);
965
965
  }
966
- }, re = (C) => {
966
+ }, re = (y) => {
967
967
  var Pt, Bt, xt, Ut;
968
- if (!u || C !== u)
968
+ if (!u || y !== u)
969
969
  return null;
970
970
  if (s.isLoading)
971
971
  return cn();
972
- if (!s.definition || !k)
972
+ if (!s.definition || !D)
973
973
  return ln();
974
- const B = !!s.installedState, z = un({
974
+ const B = !!s.installedState, H = un({
975
975
  definition: s.definition,
976
976
  selectedConnectionMethod: s.selectedConnectionMethod
977
- }), R = s.connectionMethods.length > 1 || !!z, pt = Ft({
977
+ }), R = s.connectionMethods.length > 1 || !!H, pt = Ft({
978
978
  definition: s.definition,
979
979
  selectedConnectionMethod: s.selectedConnectionMethod
980
980
  }), ce = jt(pt).length > 0, le = !!f || ce, At = !B || te, Mt = {
981
- integration: k,
981
+ integration: D,
982
982
  definition: s.definition,
983
983
  installedState: s.installedState,
984
984
  workspaceId: e,
985
985
  botId: i
986
- }, Tt = async (D) => {
986
+ }, Tt = async (k) => {
987
987
  try {
988
- await s.saveConfig(D);
988
+ await s.saveConfig(k);
989
989
  } catch (nt) {
990
990
  tt(nt);
991
991
  }
@@ -998,22 +998,22 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
998
998
  isSettingConnectionMethod: s.isSettingConnectionMethod
999
999
  }) : /* @__PURE__ */ _("div", { className: "flex flex-col gap-4", children: [
1000
1000
  /* @__PURE__ */ w("div", { className: "self-end", children: /* @__PURE__ */ w(
1001
- ye,
1001
+ Ce,
1002
1002
  {
1003
1003
  options: s.connectionMethods,
1004
1004
  value: s.selectedConnectionMethod,
1005
1005
  disabled: !p,
1006
- onChange: (D) => {
1007
- p && s.setConnectionMethod(D).catch(tt);
1006
+ onChange: (k) => {
1007
+ p && s.setConnectionMethod(k).catch(tt);
1008
1008
  }
1009
1009
  }
1010
1010
  ) }),
1011
- z ? /* @__PURE__ */ w(
1011
+ H ? /* @__PURE__ */ w(
1012
1012
  Ee,
1013
1013
  {
1014
1014
  client: t,
1015
1015
  integrationName: s.definition.title ?? s.definition.name,
1016
- linkTemplateScript: z,
1016
+ linkTemplateScript: H,
1017
1017
  webhookUrl: (Pt = s.installedState) == null ? void 0 : Pt.webhookUrl,
1018
1018
  oauthTemplateData: K,
1019
1019
  isAuthorized: !!((Bt = s.installedState) != null && Bt.identifier),
@@ -1058,12 +1058,12 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
1058
1058
  eventCards: s.capabilities.eventCards,
1059
1059
  channelCards: s.capabilities.channelCards,
1060
1060
  selectedCard: ut,
1061
- onCardSelect: (D) => {
1062
- H(
1061
+ onCardSelect: (k) => {
1062
+ z(
1063
1063
  dn(
1064
- D ? {
1065
- key: D.key,
1066
- type: D.type
1064
+ k ? {
1065
+ key: k.key,
1066
+ type: k.type
1067
1067
  } : null
1068
1068
  )
1069
1069
  );
@@ -1083,53 +1083,53 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
1083
1083
  {
1084
1084
  title: s.definition.title ?? s.definition.name,
1085
1085
  iconUrl: s.definition.iconUrl,
1086
- contributorName: k.author,
1087
- isOfficial: k.isOfficial,
1088
- isVerified: k.isVerified,
1089
- isPrivate: k.isPrivate,
1086
+ contributorName: D.author,
1087
+ isOfficial: D.isOfficial,
1088
+ isVerified: D.isVerified,
1089
+ isPrivate: D.isPrivate,
1090
1090
  onBack: () => {
1091
- E(null), J(null), H(null), Q(!1);
1091
+ E(null), J(null), z(null), Q(!1);
1092
1092
  },
1093
1093
  onInstall: B || d || !p ? void 0 : () => {
1094
1094
  et({
1095
- operation: () => I.install(k.id),
1095
+ operation: () => I.install(D.id),
1096
1096
  onSuccess: L,
1097
- integration: k
1097
+ integration: D
1098
1098
  });
1099
1099
  },
1100
1100
  onToggleEnabled: !B || !p ? void 0 : () => {
1101
- const D = s.installedState, nt = !!(D != null && D.enabled);
1101
+ const k = s.installedState, nt = !!(k != null && k.enabled);
1102
1102
  et({
1103
1103
  operation: async () => {
1104
- if (!D)
1104
+ if (!k)
1105
1105
  throw new Error("Integration is not installed");
1106
1106
  if (nt) {
1107
- await I.disable(D.id);
1107
+ await I.disable(k.id);
1108
1108
  return;
1109
1109
  }
1110
- await I.enable(D.id);
1110
+ await I.enable(k.id);
1111
1111
  },
1112
1112
  onSuccess: nt ? j : O,
1113
- integration: k
1113
+ integration: D
1114
1114
  });
1115
1115
  },
1116
1116
  onUninstall: !B || !p ? void 0 : () => {
1117
- const D = s.installedState;
1117
+ const k = s.installedState;
1118
1118
  et({
1119
1119
  operation: async () => {
1120
- if (!D)
1120
+ if (!k)
1121
1121
  throw new Error("Integration is not installed");
1122
- await I.uninstall(D.id);
1122
+ await I.uninstall(k.id);
1123
1123
  },
1124
- onSuccess: y,
1125
- integration: k
1124
+ onSuccess: C,
1125
+ integration: D
1126
1126
  });
1127
1127
  },
1128
- onUpgrade: !k.hasUpdate || !p ? void 0 : () => {
1128
+ onUpgrade: !D.hasUpdate || !p ? void 0 : () => {
1129
1129
  et({
1130
- operation: () => I.upgrade(k.id),
1130
+ operation: () => I.upgrade(D.id),
1131
1131
  onSuccess: $,
1132
- integration: k
1132
+ integration: D
1133
1133
  });
1134
1134
  },
1135
1135
  isInstalled: B,
@@ -1138,7 +1138,7 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
1138
1138
  isInstalling: I.isInstalling,
1139
1139
  isUninstalling: I.isUninstalling,
1140
1140
  isTogglingEnabled: I.isEnabling || I.isDisabling,
1141
- hasUpdate: k.hasUpdate,
1141
+ hasUpdate: D.hasUpdate,
1142
1142
  isUpgrading: I.isUpgrading,
1143
1143
  toggleButtonLabel: (Ut = s.installedState) != null && Ut.enabled ? "Disable" : "Enable",
1144
1144
  onShare: S ? () => S(Mt) : void 0,
@@ -1148,9 +1148,9 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
1148
1148
  selectedDetailPanel: ut && F ? F({
1149
1149
  definition: s.definition,
1150
1150
  selectedCard: ut,
1151
- onClose: () => H(null)
1151
+ onClose: () => z(null)
1152
1152
  }) : void 0,
1153
- onDismissSelectedDetailPanel: () => H(null),
1153
+ onDismissSelectedDetailPanel: () => z(null),
1154
1154
  children: At ? /* @__PURE__ */ _("div", { className: "flex flex-col gap-6 mt-6", children: [
1155
1155
  /* @__PURE__ */ w(Me, { readme: ae, isLoading: se }),
1156
1156
  Ot
@@ -1166,7 +1166,7 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
1166
1166
  setupTab: ne,
1167
1167
  onSetupTabChange: gt,
1168
1168
  onCancelSetup: () => {
1169
- E(null), J(null), H(null), Q(!1);
1169
+ E(null), J(null), z(null), Q(!1);
1170
1170
  },
1171
1171
  metadata: fe,
1172
1172
  connectionsContent: de,
@@ -1189,7 +1189,7 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
1189
1189
  {
1190
1190
  type: "button",
1191
1191
  onClick: () => Y("hub"),
1192
- className: Ct(
1192
+ className: yt(
1193
1193
  "cursor-pointer rounded-md px-3 py-1.5 text-sm text-[var(--gray-11)] transition-colors",
1194
1194
  X === "hub" && "bg-[var(--gray-1)] text-[var(--gray-12)] shadow-sm"
1195
1195
  ),
@@ -1201,7 +1201,7 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
1201
1201
  {
1202
1202
  type: "button",
1203
1203
  onClick: () => Y("installed"),
1204
- className: Ct(
1204
+ className: yt(
1205
1205
  "cursor-pointer rounded-md px-3 py-1.5 text-sm text-[var(--gray-11)] transition-colors",
1206
1206
  X === "installed" && "bg-[var(--gray-1)] text-[var(--gray-12)] shadow-sm"
1207
1207
  ),
@@ -1241,32 +1241,32 @@ const Pe = "width=650,height=800,popup=true", Be = 500, xe = 5 * 60 * 1e3, Ue =
1241
1241
  bannerSlides: r,
1242
1242
  bannerIconUrl: c,
1243
1243
  noResultsDocumentationLink: g,
1244
- renderIntegrationCard: (C, { onEscape: B }) => /* @__PURE__ */ w(
1244
+ renderIntegrationCard: (y, { onEscape: B }) => /* @__PURE__ */ w(
1245
1245
  ve,
1246
1246
  {
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,
1247
+ name: y.title ?? y.name,
1248
+ description: y.description,
1249
+ author: y.author,
1250
+ installed: y.installed,
1251
+ updateAvailable: y.hasUpdate,
1252
+ verified: y.isVerified,
1253
+ official: y.isOfficial,
1254
+ private: y.isPrivate,
1255
+ iconUrl: y.iconUrl,
1256
1256
  onClick: () => {
1257
- E(C.id), J(C.installedId ?? C.id), ft("connections"), gt("connections"), Q(!1), H(null);
1257
+ E(y.id), J(y.installedId ?? y.id), ft("connections"), gt("connections"), Q(!1), z(null);
1258
1258
  },
1259
1259
  onEscape: B
1260
1260
  }
1261
1261
  ),
1262
- renderInstalledIntegrations: ({ integrations: C, searchTerm: B, categoryOrder: z }) => /* @__PURE__ */ w(
1263
- Ce,
1262
+ renderInstalledIntegrations: ({ integrations: y, searchTerm: B, categoryOrder: H }) => /* @__PURE__ */ w(
1263
+ ye,
1264
1264
  {
1265
- integrations: C,
1265
+ integrations: y,
1266
1266
  searchTerm: B,
1267
- categoryOrder: z.length > 0 ? z : oe,
1267
+ categoryOrder: H.length > 0 ? H : oe,
1268
1268
  onSelectIntegration: (R) => {
1269
- E(R.id), J(R.installedId ?? R.id), ft("connections"), gt("connections"), Q(!1), H(null);
1269
+ E(R.id), J(R.installedId ?? R.id), ft("connections"), gt("connections"), Q(!1), z(null);
1270
1270
  }
1271
1271
  }
1272
1272
  ),
@@ -1282,17 +1282,17 @@ export {
1282
1282
  Me as IntegrationReadmeContent,
1283
1283
  Ne as IntegrationStaticZuiConfigurationForm,
1284
1284
  An as dedupeById,
1285
- ke as fetchOAuthAuthorizationUrl,
1285
+ De as fetchOAuthAuthorizationUrl,
1286
1286
  Re as filterAndSortIntegrations,
1287
1287
  It as findInstalledIntegration,
1288
1288
  ot as getInstalledIntegrations,
1289
- ze as getSelectedConnectionMethod,
1289
+ He as getSelectedConnectionMethod,
1290
1290
  Ue as getWebhookIdFromUrl,
1291
- Ht as isOfficialWorkspace,
1292
- De as openOAuthPopup,
1293
- zt as resolveCategory,
1291
+ zt as isOfficialWorkspace,
1292
+ ke as openOAuthPopup,
1293
+ Ht as resolveCategory,
1294
1294
  Ke as toCapabilityCards,
1295
- He as toConnectionMethods,
1295
+ ze as toConnectionMethods,
1296
1296
  wt as toError,
1297
1297
  je as toHubItem,
1298
1298
  _e as toInstalledItem,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bpinternal/integration-hub",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "Reusable Integration Hub for Botpress-style integration catalogs",
5
5
  "license": "AGPL-3.0",
6
6
  "type": "module",