@bpinternal/integration-hub 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/runtime/botpressTypes.d.ts +1 -1
- package/dist/runtime/index.js +112 -112
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -447,3 +447,5 @@ pnpm --filter @bpinternal/integration-hub exec npm publish --access public
|
|
|
447
447
|
```
|
|
448
448
|
|
|
449
449
|
`prepack` runs `clean && build` automatically before publish.
|
|
450
|
+
|
|
451
|
+
**Note:** Depending on options passed to the botpress client (x-multiple-integrations = true), the integrations from Botpress Cloud are keyed by their ALIAS, not their ID. For edits that intend to use the integration ID, make sure to explicitly use the .id parameter.
|
|
@@ -13,7 +13,7 @@ export type IntegrationPatchTransformers = Partial<Record<'install' | 'uninstall
|
|
|
13
13
|
export interface BotpressInstalledIntegration extends BotIntegrationEntry {
|
|
14
14
|
id: string;
|
|
15
15
|
name: string;
|
|
16
|
-
|
|
16
|
+
integrationAlias: string;
|
|
17
17
|
}
|
|
18
18
|
export interface BotpressIntegrationHubItem {
|
|
19
19
|
id: string;
|
package/dist/runtime/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as v, jsxs as
|
|
2
|
-
import { Loader2 as
|
|
1
|
+
import { jsx as v, jsxs as K } from "react/jsx-runtime";
|
|
2
|
+
import { Loader2 as It } from "lucide-react";
|
|
3
3
|
import { useState as P, useRef as ut, useEffect as ct, useMemo as L, useCallback as J } from "react";
|
|
4
4
|
import { I as Gt, c as lt, a as Zt, b as Jt, d as Xt, e as Yt, f as mt, g as tn, h as nn, i as en, j as on, k as an } from "../chunks/index.js";
|
|
5
5
|
import { StaticZuiForm as sn } from "@bpinternal/static-zui-form";
|
|
6
|
-
import { useQueryClient as
|
|
6
|
+
import { useQueryClient as At, useQuery as St, useMutation as j } from "@tanstack/react-query";
|
|
7
7
|
import "framer-motion";
|
|
8
8
|
import "clsx";
|
|
9
9
|
import "tailwind-merge";
|
|
@@ -69,11 +69,11 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
69
69
|
onAuthorized: s,
|
|
70
70
|
onError: d
|
|
71
71
|
}) => {
|
|
72
|
-
const [u, C] = P(null), [b,
|
|
72
|
+
const [u, C] = P(null), [b, I] = P(!1), [O, x] = P(!1), M = i ?? dn(o), h = !!(i || o), p = ut(d);
|
|
73
73
|
ct(() => {
|
|
74
74
|
p.current = d;
|
|
75
75
|
}, [d]);
|
|
76
|
-
const
|
|
76
|
+
const S = L(() => {
|
|
77
77
|
try {
|
|
78
78
|
return JSON.stringify(a ?? {});
|
|
79
79
|
} catch {
|
|
@@ -82,15 +82,15 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
82
82
|
}, [a]);
|
|
83
83
|
ct(() => {
|
|
84
84
|
if (!h) {
|
|
85
|
-
C(null),
|
|
85
|
+
C(null), I(!1);
|
|
86
86
|
return;
|
|
87
87
|
}
|
|
88
88
|
let f = !1;
|
|
89
89
|
return (async () => {
|
|
90
|
-
var
|
|
90
|
+
var y;
|
|
91
91
|
let k = {};
|
|
92
92
|
try {
|
|
93
|
-
k = JSON.parse(
|
|
93
|
+
k = JSON.parse(S);
|
|
94
94
|
} catch {
|
|
95
95
|
k = {};
|
|
96
96
|
}
|
|
@@ -99,7 +99,7 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
99
99
|
webhookId: M,
|
|
100
100
|
...k
|
|
101
101
|
};
|
|
102
|
-
|
|
102
|
+
I(!0);
|
|
103
103
|
try {
|
|
104
104
|
const N = await un({
|
|
105
105
|
client: n,
|
|
@@ -108,16 +108,16 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
108
108
|
});
|
|
109
109
|
f || C(N);
|
|
110
110
|
} catch (N) {
|
|
111
|
-
f || (C(null), (
|
|
111
|
+
f || (C(null), (y = p.current) == null || y.call(p, fn(N)));
|
|
112
112
|
} finally {
|
|
113
|
-
f ||
|
|
113
|
+
f || I(!1);
|
|
114
114
|
}
|
|
115
115
|
})(), () => {
|
|
116
116
|
f = !0;
|
|
117
117
|
};
|
|
118
|
-
}, [n, h, e,
|
|
119
|
-
const _ = h && !!u && !b && !c,
|
|
120
|
-
var f,
|
|
118
|
+
}, [n, h, e, S, o, M]);
|
|
119
|
+
const _ = h && !!u && !b && !c, H = async () => {
|
|
120
|
+
var f, A, k;
|
|
121
121
|
if (!(!u || O)) {
|
|
122
122
|
x(!0);
|
|
123
123
|
try {
|
|
@@ -132,7 +132,7 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
132
132
|
return;
|
|
133
133
|
}
|
|
134
134
|
if (E === "timeout") {
|
|
135
|
-
(
|
|
135
|
+
(A = p.current) == null || A.call(p, new Error("OAuth popup did not close in time. Please close it and try again."));
|
|
136
136
|
return;
|
|
137
137
|
}
|
|
138
138
|
(k = p.current) == null || k.call(p, new Error("OAuth authorization finished but refresh failed."));
|
|
@@ -151,7 +151,7 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
151
151
|
disabled: c,
|
|
152
152
|
showInstallHint: !h,
|
|
153
153
|
onClick: () => {
|
|
154
|
-
|
|
154
|
+
H();
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
);
|
|
@@ -167,7 +167,7 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
167
167
|
return [];
|
|
168
168
|
const t = n.properties;
|
|
169
169
|
return !t || typeof t != "object" ? [] : Object.keys(t);
|
|
170
|
-
}, at = (n) => !n || typeof n != "object" || Array.isArray(n) ? {} : n,
|
|
170
|
+
}, at = (n) => !n || typeof n != "object" || Array.isArray(n) ? {} : n, yt = (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]]);
|
|
@@ -198,34 +198,34 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
198
198
|
() => Tt({ definition: n, selectedConnectionMethod: e }),
|
|
199
199
|
[n, e]
|
|
200
200
|
), c = L(() => Ot(l), [l]), s = L(
|
|
201
|
-
() =>
|
|
201
|
+
() => yt(at(t == null ? void 0 : t.configuration), c),
|
|
202
202
|
[t == null ? void 0 : t.configuration, c]
|
|
203
|
-
), d = L(() => c.join("\0"), [c]), [u, C] = P({}), [b,
|
|
203
|
+
), d = L(() => c.join("\0"), [c]), [u, C] = P({}), [b, I] = P(null), [O, x] = P(0), M = ut(null);
|
|
204
204
|
return ct(() => {
|
|
205
205
|
const h = {
|
|
206
|
-
|
|
206
|
+
integrationAlias: (t == null ? void 0 : t.integrationAlias) ?? null,
|
|
207
207
|
configurationType: (t == null ? void 0 : t.configurationType) ?? null,
|
|
208
208
|
schemaKeySignature: d,
|
|
209
209
|
configuration: s
|
|
210
210
|
}, p = M.current;
|
|
211
|
-
p && p.
|
|
212
|
-
}, [s, t == null ? void 0 : t.
|
|
211
|
+
p && p.integrationAlias === h.integrationAlias && p.configurationType === h.configurationType && p.schemaKeySignature === h.schemaKeySignature && dt(p.configuration, h.configuration) || (M.current = h, C(s), I(null), x((S) => S + 1));
|
|
212
|
+
}, [s, t == null ? void 0 : t.integrationAlias, t == null ? void 0 : t.configurationType, d]), !l || c.length === 0 ? null : /* @__PURE__ */ K("div", { className: "flex flex-col gap-3", children: [
|
|
213
213
|
/* @__PURE__ */ v(
|
|
214
214
|
sn,
|
|
215
215
|
{
|
|
216
216
|
schema: l,
|
|
217
217
|
value: u,
|
|
218
218
|
onChange: (h) => {
|
|
219
|
-
const p =
|
|
219
|
+
const p = yt(at(h), c);
|
|
220
220
|
C(p);
|
|
221
221
|
},
|
|
222
222
|
onValidation: ({ formValid: h }) => {
|
|
223
|
-
|
|
223
|
+
I(h);
|
|
224
224
|
}
|
|
225
225
|
},
|
|
226
226
|
O
|
|
227
227
|
),
|
|
228
|
-
/* @__PURE__ */
|
|
228
|
+
/* @__PURE__ */ K(
|
|
229
229
|
"button",
|
|
230
230
|
{
|
|
231
231
|
type: "button",
|
|
@@ -243,7 +243,7 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
243
243
|
),
|
|
244
244
|
children: [
|
|
245
245
|
/* @__PURE__ */ v("span", { className: o ? "invisible" : "", children: "Save Configuration" }),
|
|
246
|
-
o && /* @__PURE__ */ v(
|
|
246
|
+
o && /* @__PURE__ */ v(It, { className: "absolute inset-0 m-auto h-4 w-4 animate-spin" })
|
|
247
247
|
]
|
|
248
248
|
}
|
|
249
249
|
)
|
|
@@ -264,13 +264,13 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
264
264
|
...i,
|
|
265
265
|
id: typeof i.id == "string" && i.id.length > 0 ? i.id : t,
|
|
266
266
|
name: typeof i.name == "string" && i.name.length > 0 ? i.name : t,
|
|
267
|
-
|
|
267
|
+
integrationAlias: t
|
|
268
268
|
};
|
|
269
269
|
}) : [], ft = ({
|
|
270
270
|
installedIntegrations: n,
|
|
271
271
|
integrationId: t,
|
|
272
272
|
integrationName: e
|
|
273
|
-
}) => n.find((i) => i.id === t) ?? n.find((i) => i.
|
|
273
|
+
}) => n.find((i) => i.id === t) ?? n.find((i) => i.integrationAlias === t) ?? (e ? n.find((i) => i.name === e) : void 0), Cn = ({
|
|
274
274
|
summary: n,
|
|
275
275
|
installedByName: t,
|
|
276
276
|
categoryResolver: e
|
|
@@ -279,7 +279,7 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
279
279
|
const i = t.get(n.name), o = xt((s = n.ownerWorkspace) == null ? void 0 : s.handle), a = (i == null ? void 0 : i.version) ?? null, l = n.version ?? null, c = a && l ? a !== l : !1;
|
|
280
280
|
return {
|
|
281
281
|
id: n.id,
|
|
282
|
-
installedId: i == null ? void 0 : i.
|
|
282
|
+
installedId: i == null ? void 0 : i.id,
|
|
283
283
|
name: n.name,
|
|
284
284
|
title: n.title,
|
|
285
285
|
description: n.description,
|
|
@@ -311,7 +311,7 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
311
311
|
const i = xt((a = t == null ? void 0 : t.ownerWorkspace) == null ? void 0 : a.handle), o = n.version && (t != null && t.version) ? n.version !== (t == null ? void 0 : t.version) : !1;
|
|
312
312
|
return {
|
|
313
313
|
id: (t == null ? void 0 : t.id) ?? n.id,
|
|
314
|
-
installedId: n.
|
|
314
|
+
installedId: n.id,
|
|
315
315
|
name: (t == null ? void 0 : t.name) ?? n.name,
|
|
316
316
|
title: (t == null ? void 0 : t.title) ?? n.name,
|
|
317
317
|
description: (t == null ? void 0 : t.description) ?? null,
|
|
@@ -336,7 +336,7 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
336
336
|
version: (t == null ? void 0 : t.version) ?? n.version,
|
|
337
337
|
updatedAt: t == null ? void 0 : t.updatedAt
|
|
338
338
|
};
|
|
339
|
-
},
|
|
339
|
+
}, yn = (n) => {
|
|
340
340
|
if (!n)
|
|
341
341
|
return {
|
|
342
342
|
actionCards: [],
|
|
@@ -373,7 +373,7 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
373
373
|
eventCards: e,
|
|
374
374
|
channelCards: i
|
|
375
375
|
};
|
|
376
|
-
},
|
|
376
|
+
}, In = (n) => {
|
|
377
377
|
var a, l, c, s;
|
|
378
378
|
if (!n)
|
|
379
379
|
return [];
|
|
@@ -389,14 +389,14 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
389
389
|
label: vn(u.description) || u.title || d
|
|
390
390
|
});
|
|
391
391
|
return !!((c = n.sandbox) == null ? void 0 : c.identifierExtractScript) && !!((s = n.configurations) != null && s[st]) && e.push({ value: st, label: "Connect to a Playground" }), e;
|
|
392
|
-
},
|
|
392
|
+
}, An = ({
|
|
393
393
|
installedState: n,
|
|
394
394
|
connectionMethods: t
|
|
395
395
|
}) => {
|
|
396
396
|
var i;
|
|
397
397
|
const e = (n == null ? void 0 : n.configurationType) ?? null;
|
|
398
398
|
return t.some((o) => o.value === e) ? e : ((i = t[0]) == null ? void 0 : i.value) ?? null;
|
|
399
|
-
},
|
|
399
|
+
}, Sn = ({
|
|
400
400
|
integrations: n,
|
|
401
401
|
searchTerm: t,
|
|
402
402
|
visibility: e,
|
|
@@ -459,13 +459,13 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
459
459
|
installedIntegrations: a,
|
|
460
460
|
integrationId: e,
|
|
461
461
|
integrationName: i.name
|
|
462
|
-
}), c =
|
|
462
|
+
}), c = In(i);
|
|
463
463
|
return {
|
|
464
464
|
definition: i,
|
|
465
465
|
installedState: l,
|
|
466
|
-
capabilities:
|
|
466
|
+
capabilities: yn(i),
|
|
467
467
|
connectionMethods: c,
|
|
468
|
-
selectedConnectionMethod:
|
|
468
|
+
selectedConnectionMethod: An({ installedState: l, connectionMethods: c })
|
|
469
469
|
};
|
|
470
470
|
}, kt = ({
|
|
471
471
|
client: n,
|
|
@@ -475,32 +475,32 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
475
475
|
enabled: o = !0,
|
|
476
476
|
transformIntegrationPatch: a
|
|
477
477
|
}) => {
|
|
478
|
-
const l =
|
|
478
|
+
const l = At(), c = L(() => Tn(t, e), [t, e]), { data: s, isLoading: d, error: u, refetch: C } = St({
|
|
479
479
|
queryKey: [...c, "details", i],
|
|
480
480
|
enabled: o && !!i,
|
|
481
481
|
queryFn: () => xn({ client: n, workspaceId: t, botId: e, integrationId: i, enabled: o })
|
|
482
482
|
}), b = J(async () => {
|
|
483
483
|
await l.invalidateQueries({ queryKey: c });
|
|
484
|
-
}, [l, c]),
|
|
484
|
+
}, [l, c]), I = () => {
|
|
485
485
|
if (!(s != null && s.installedState))
|
|
486
486
|
throw new Error("Integration is not installed on this bot");
|
|
487
487
|
return s.installedState;
|
|
488
488
|
}, O = Ut({ client: n, botId: e, transformIntegrationPatch: a }), x = j({
|
|
489
489
|
mutationFn: async (p) => {
|
|
490
|
-
const
|
|
490
|
+
const S = I();
|
|
491
491
|
await O("configure", {
|
|
492
|
-
[
|
|
492
|
+
[S.integrationAlias]: {
|
|
493
493
|
configuration: p,
|
|
494
|
-
configurationType:
|
|
494
|
+
configurationType: S.configurationType ?? null
|
|
495
495
|
}
|
|
496
496
|
});
|
|
497
497
|
},
|
|
498
498
|
onSuccess: b
|
|
499
499
|
}), M = j({
|
|
500
500
|
mutationFn: async () => {
|
|
501
|
-
const p =
|
|
502
|
-
await O(
|
|
503
|
-
[p.
|
|
501
|
+
const p = I(), S = p.enabled ? "disable" : "enable";
|
|
502
|
+
await O(S, {
|
|
503
|
+
[p.integrationAlias]: {
|
|
504
504
|
enabled: !p.enabled
|
|
505
505
|
}
|
|
506
506
|
});
|
|
@@ -508,9 +508,9 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
508
508
|
onSuccess: b
|
|
509
509
|
}), h = j({
|
|
510
510
|
mutationFn: async (p) => {
|
|
511
|
-
const
|
|
511
|
+
const S = I();
|
|
512
512
|
await O("configure", {
|
|
513
|
-
[
|
|
513
|
+
[S.integrationAlias]: {
|
|
514
514
|
configurationType: p
|
|
515
515
|
}
|
|
516
516
|
});
|
|
@@ -598,7 +598,7 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
598
598
|
installedIntegrations: t
|
|
599
599
|
}) => {
|
|
600
600
|
const e = ft({ installedIntegrations: t, integrationId: n });
|
|
601
|
-
return (e == null ? void 0 : e.
|
|
601
|
+
return (e == null ? void 0 : e.integrationAlias) ?? n;
|
|
602
602
|
}, Fn = async ({ client: n, botId: t, categoryResolver: e }) => {
|
|
603
603
|
const [i, o, a] = await Promise.all([
|
|
604
604
|
kn({ client: n }),
|
|
@@ -629,22 +629,22 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
629
629
|
enabled: o = !0,
|
|
630
630
|
transformIntegrationPatch: a
|
|
631
631
|
}) => {
|
|
632
|
-
const l =
|
|
632
|
+
const l = At(), c = L(() => Bn(t, e), [t, e]), s = ut(Promise.resolve()), { data: d, isLoading: u, error: C, refetch: b } = St({
|
|
633
633
|
queryKey: [...c, "catalog"],
|
|
634
634
|
enabled: o,
|
|
635
635
|
queryFn: () => Fn({ client: n, workspaceId: t, botId: e, categoryResolver: i })
|
|
636
|
-
}),
|
|
636
|
+
}), I = J(async () => {
|
|
637
637
|
await l.invalidateQueries({ queryKey: c });
|
|
638
638
|
}, [l, c]), O = J(async (f) => {
|
|
639
|
-
const
|
|
640
|
-
return s.current =
|
|
639
|
+
const A = s.current.then(f, f);
|
|
640
|
+
return s.current = A.then(
|
|
641
641
|
() => {
|
|
642
642
|
},
|
|
643
643
|
() => {
|
|
644
644
|
}
|
|
645
|
-
),
|
|
645
|
+
), A;
|
|
646
646
|
}, []), x = Ut({ client: n, botId: e, transformIntegrationPatch: a }), M = async (f) => {
|
|
647
|
-
const { bot:
|
|
647
|
+
const { bot: A } = await n.getBot({ id: e }), k = X(A.integrations);
|
|
648
648
|
return Nn({ integrationId: f, installedIntegrations: k });
|
|
649
649
|
}, h = j({
|
|
650
650
|
mutationFn: async (f) => {
|
|
@@ -652,49 +652,49 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
652
652
|
await x("install", { [f]: { enabled: !0 } });
|
|
653
653
|
});
|
|
654
654
|
},
|
|
655
|
-
onSuccess:
|
|
655
|
+
onSuccess: I
|
|
656
656
|
}), p = j({
|
|
657
657
|
mutationFn: async (f) => {
|
|
658
658
|
await O(async () => {
|
|
659
|
-
const
|
|
660
|
-
await x("uninstall", { [
|
|
659
|
+
const A = await M(f);
|
|
660
|
+
await x("uninstall", { [A]: null });
|
|
661
661
|
});
|
|
662
662
|
},
|
|
663
|
-
onSuccess:
|
|
664
|
-
}),
|
|
663
|
+
onSuccess: I
|
|
664
|
+
}), S = j({
|
|
665
665
|
mutationFn: async (f) => {
|
|
666
666
|
await O(async () => {
|
|
667
|
-
const
|
|
668
|
-
await x("enable", { [
|
|
667
|
+
const A = await M(f);
|
|
668
|
+
await x("enable", { [A]: { enabled: !0 } });
|
|
669
669
|
});
|
|
670
670
|
},
|
|
671
|
-
onSuccess:
|
|
671
|
+
onSuccess: I
|
|
672
672
|
}), _ = j({
|
|
673
673
|
mutationFn: async (f) => {
|
|
674
674
|
await O(async () => {
|
|
675
|
-
const
|
|
676
|
-
await x("disable", { [
|
|
675
|
+
const A = await M(f);
|
|
676
|
+
await x("disable", { [A]: { enabled: !1 } });
|
|
677
677
|
});
|
|
678
678
|
},
|
|
679
|
-
onSuccess:
|
|
680
|
-
}),
|
|
679
|
+
onSuccess: I
|
|
680
|
+
}), H = j({
|
|
681
681
|
mutationFn: async (f) => {
|
|
682
682
|
await O(async () => {
|
|
683
|
-
const { bot:
|
|
683
|
+
const { bot: A } = await n.getBot({ id: e }), k = X(A.integrations), E = await Ln({ client: n, integrationId: f }), y = ft({
|
|
684
684
|
installedIntegrations: k,
|
|
685
685
|
integrationId: f,
|
|
686
686
|
integrationName: E
|
|
687
687
|
}), N = {
|
|
688
|
-
enabled: (
|
|
689
|
-
configuration: (
|
|
690
|
-
configurationType: (
|
|
688
|
+
enabled: (y == null ? void 0 : y.enabled) ?? !0,
|
|
689
|
+
configuration: (y == null ? void 0 : y.configuration) ?? {},
|
|
690
|
+
configurationType: (y == null ? void 0 : y.configurationType) ?? null
|
|
691
691
|
}, V = {
|
|
692
692
|
[f]: N
|
|
693
693
|
};
|
|
694
|
-
|
|
694
|
+
y && y.integrationAlias !== f && (V[y.integrationAlias] = null), await x("upgrade", V);
|
|
695
695
|
});
|
|
696
696
|
},
|
|
697
|
-
onSuccess:
|
|
697
|
+
onSuccess: I
|
|
698
698
|
});
|
|
699
699
|
return {
|
|
700
700
|
integrations: (d == null ? void 0 : d.integrations) ?? [],
|
|
@@ -703,28 +703,28 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
703
703
|
error: C ? pt(C) : null,
|
|
704
704
|
install: h.mutateAsync,
|
|
705
705
|
uninstall: p.mutateAsync,
|
|
706
|
-
enable:
|
|
706
|
+
enable: S.mutateAsync,
|
|
707
707
|
disable: _.mutateAsync,
|
|
708
|
-
upgrade:
|
|
708
|
+
upgrade: H.mutateAsync,
|
|
709
709
|
refresh: () => {
|
|
710
710
|
b();
|
|
711
711
|
},
|
|
712
712
|
isInstalling: h.isPending,
|
|
713
713
|
isUninstalling: p.isPending,
|
|
714
|
-
isEnabling:
|
|
714
|
+
isEnabling: S.isPending,
|
|
715
715
|
isDisabling: _.isPending,
|
|
716
|
-
isUpgrading:
|
|
716
|
+
isUpgrading: H.isPending
|
|
717
717
|
};
|
|
718
|
-
}, te = Nt, Dn = ["official", "verified"], jn = () => /* @__PURE__ */ v("div", { className: "flex items-center justify-center py-16", children: /* @__PURE__ */ v(
|
|
718
|
+
}, te = Nt, Dn = ["official", "verified"], jn = () => /* @__PURE__ */ v("div", { className: "flex items-center justify-center py-16", children: /* @__PURE__ */ v(It, { className: "h-6 w-6 animate-spin text-[var(--gray-9)]" }) }), Vn = () => /* @__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." }), _n = (n) => n ? {
|
|
719
719
|
key: n.key,
|
|
720
720
|
type: n.type
|
|
721
|
-
} : null,
|
|
721
|
+
} : null, Hn = ({
|
|
722
722
|
definition: n,
|
|
723
723
|
selectedConnectionMethod: t
|
|
724
724
|
}) => {
|
|
725
725
|
var e, i, o, a, l;
|
|
726
726
|
return t ? ((o = (i = (e = n.configurations) == null ? void 0 : e[t]) == null ? void 0 : i.identifier) == null ? void 0 : o.linkTemplateScript) ?? null : ((l = (a = n.configuration) == null ? void 0 : a.identifier) == null ? void 0 : l.linkTemplateScript) ?? null;
|
|
727
|
-
},
|
|
727
|
+
}, zn = ({
|
|
728
728
|
client: n,
|
|
729
729
|
workspaceId: t,
|
|
730
730
|
botId: e,
|
|
@@ -738,31 +738,31 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
738
738
|
transformIntegrationPatch: u,
|
|
739
739
|
categoryResolver: C,
|
|
740
740
|
filterMenuLabels: b,
|
|
741
|
-
defaultVisibility:
|
|
741
|
+
defaultVisibility: I,
|
|
742
742
|
defaultVerification: O,
|
|
743
743
|
defaultSortMethod: x,
|
|
744
744
|
renderConfigurationForm: M,
|
|
745
745
|
renderConnectionsContent: h,
|
|
746
746
|
oauthTemplateData: p,
|
|
747
|
-
renderDetailPanel:
|
|
747
|
+
renderDetailPanel: S,
|
|
748
748
|
onInstall: _,
|
|
749
|
-
onUninstall:
|
|
749
|
+
onUninstall: H,
|
|
750
750
|
onEnable: f,
|
|
751
|
-
onDisable:
|
|
751
|
+
onDisable: A,
|
|
752
752
|
onUpgrade: k,
|
|
753
753
|
onError: E
|
|
754
754
|
}) => {
|
|
755
|
-
const [
|
|
755
|
+
const [y, N] = P(i), [V, Ft] = P(""), [z, Q] = P(null), [gt, W] = P(null), [Y, q] = P(null), [m, Dt] = P(I), [tt, jt] = P(
|
|
756
756
|
O ?? [...Dn]
|
|
757
|
-
), [nt, Vt] = P(x), [_t, et] = P("connections"), [
|
|
757
|
+
), [nt, Vt] = P(x), [_t, et] = P("connections"), [Ht, it] = P("connections"), w = Nt({
|
|
758
758
|
client: n,
|
|
759
759
|
workspaceId: t,
|
|
760
760
|
botId: e,
|
|
761
761
|
categoryResolver: C,
|
|
762
762
|
enabled: !0,
|
|
763
763
|
transformIntegrationPatch: u
|
|
764
|
-
}),
|
|
765
|
-
() =>
|
|
764
|
+
}), zt = L(
|
|
765
|
+
() => Sn({
|
|
766
766
|
integrations: w.integrations,
|
|
767
767
|
searchTerm: V,
|
|
768
768
|
visibility: m,
|
|
@@ -772,9 +772,9 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
772
772
|
[w.integrations, V, m, tt, nt]
|
|
773
773
|
), U = L(
|
|
774
774
|
() => [...w.integrations, ...w.installedIntegrations].find(
|
|
775
|
-
(g) => g.id ===
|
|
775
|
+
(g) => g.id === z
|
|
776
776
|
) ?? null,
|
|
777
|
-
[w.integrations, w.installedIntegrations,
|
|
777
|
+
[w.integrations, w.installedIntegrations, z]
|
|
778
778
|
), r = kt({
|
|
779
779
|
client: n,
|
|
780
780
|
workspaceId: t,
|
|
@@ -782,7 +782,7 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
782
782
|
integrationId: gt,
|
|
783
783
|
enabled: !!gt,
|
|
784
784
|
transformIntegrationPatch: u
|
|
785
|
-
}),
|
|
785
|
+
}), Kt = L(
|
|
786
786
|
() => (o == null ? void 0 : o.filter((g) => g.name !== "Popular").map((g) => g.name)) ?? [],
|
|
787
787
|
[o]
|
|
788
788
|
), R = J(
|
|
@@ -805,13 +805,13 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
805
805
|
}
|
|
806
806
|
}, qt = (g) => {
|
|
807
807
|
var bt, vt, Ct, wt;
|
|
808
|
-
if (!
|
|
808
|
+
if (!z || g !== z)
|
|
809
809
|
return null;
|
|
810
810
|
if (r.isLoading)
|
|
811
811
|
return jn();
|
|
812
812
|
if (!r.definition || !U)
|
|
813
813
|
return Vn();
|
|
814
|
-
const B = !!r.installedState, F =
|
|
814
|
+
const B = !!r.installedState, F = Hn({
|
|
815
815
|
definition: r.definition,
|
|
816
816
|
selectedConnectionMethod: r.selectedConnectionMethod
|
|
817
817
|
}), D = r.connectionMethods.length > 1 || !!F, ot = Tt({
|
|
@@ -830,7 +830,7 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
830
830
|
selectedConnectionMethod: r.selectedConnectionMethod,
|
|
831
831
|
onConnectionMethodChange: r.setConnectionMethod,
|
|
832
832
|
isSettingConnectionMethod: r.isSettingConnectionMethod
|
|
833
|
-
}) : /* @__PURE__ */
|
|
833
|
+
}) : /* @__PURE__ */ K("div", { className: "flex flex-col gap-4", children: [
|
|
834
834
|
/* @__PURE__ */ v("div", { className: "self-end", children: /* @__PURE__ */ v(
|
|
835
835
|
mt,
|
|
836
836
|
{
|
|
@@ -857,7 +857,7 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
857
857
|
},
|
|
858
858
|
onError: R
|
|
859
859
|
}
|
|
860
|
-
) : /* @__PURE__ */
|
|
860
|
+
) : /* @__PURE__ */ K("p", { className: "text-sm text-[var(--gray-11)]", children: [
|
|
861
861
|
"No custom connection UI was provided. Use ",
|
|
862
862
|
/* @__PURE__ */ v("code", { children: "renderConnectionsContent" }),
|
|
863
863
|
" to plug your OAuth/manual connection flow."
|
|
@@ -917,7 +917,7 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
917
917
|
}
|
|
918
918
|
await w.enable(T.id);
|
|
919
919
|
},
|
|
920
|
-
onSuccess: G ?
|
|
920
|
+
onSuccess: G ? A : f,
|
|
921
921
|
integration: U
|
|
922
922
|
});
|
|
923
923
|
},
|
|
@@ -929,7 +929,7 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
929
929
|
throw new Error("Integration is not installed");
|
|
930
930
|
await w.uninstall(T.id);
|
|
931
931
|
},
|
|
932
|
-
onSuccess:
|
|
932
|
+
onSuccess: H,
|
|
933
933
|
integration: U
|
|
934
934
|
});
|
|
935
935
|
},
|
|
@@ -949,7 +949,7 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
949
949
|
hasUpdate: U.hasUpdate,
|
|
950
950
|
isUpgrading: w.isUpgrading,
|
|
951
951
|
toggleButtonLabel: (wt = r.installedState) != null && wt.enabled ? "Disable" : "Enable",
|
|
952
|
-
selectedDetailPanel: Y &&
|
|
952
|
+
selectedDetailPanel: Y && S ? S({
|
|
953
953
|
definition: r.definition,
|
|
954
954
|
selectedCard: Y,
|
|
955
955
|
onClose: () => q(null)
|
|
@@ -964,7 +964,7 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
964
964
|
hasConfigurationStep: Wt,
|
|
965
965
|
configuredTab: _t,
|
|
966
966
|
onConfiguredTabChange: et,
|
|
967
|
-
setupTab:
|
|
967
|
+
setupTab: Ht,
|
|
968
968
|
onSetupTabChange: it,
|
|
969
969
|
onCancelSetup: () => {
|
|
970
970
|
Q(null), W(null), q(null);
|
|
@@ -1003,8 +1003,8 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
1003
1003
|
}
|
|
1004
1004
|
);
|
|
1005
1005
|
};
|
|
1006
|
-
return /* @__PURE__ */
|
|
1007
|
-
!
|
|
1006
|
+
return /* @__PURE__ */ K("div", { className: "flex h-full min-h-0 flex-col", children: [
|
|
1007
|
+
!z && /* @__PURE__ */ v("div", { className: "flex justify-end px-6 pt-4", children: /* @__PURE__ */ K("div", { className: "flex rounded-lg bg-[var(--gray-a3)] p-1", children: [
|
|
1008
1008
|
/* @__PURE__ */ v(
|
|
1009
1009
|
"button",
|
|
1010
1010
|
{
|
|
@@ -1012,7 +1012,7 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
1012
1012
|
onClick: () => N("hub"),
|
|
1013
1013
|
className: lt(
|
|
1014
1014
|
"cursor-pointer rounded-md px-3 py-1.5 text-sm text-[var(--gray-11)] transition-colors",
|
|
1015
|
-
|
|
1015
|
+
y === "hub" && "bg-[var(--gray-1)] text-[var(--gray-12)] shadow-sm"
|
|
1016
1016
|
),
|
|
1017
1017
|
children: "Integration Hub"
|
|
1018
1018
|
}
|
|
@@ -1024,7 +1024,7 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
1024
1024
|
onClick: () => N("installed"),
|
|
1025
1025
|
className: lt(
|
|
1026
1026
|
"cursor-pointer rounded-md px-3 py-1.5 text-sm text-[var(--gray-11)] transition-colors",
|
|
1027
|
-
|
|
1027
|
+
y === "installed" && "bg-[var(--gray-1)] text-[var(--gray-12)] shadow-sm"
|
|
1028
1028
|
),
|
|
1029
1029
|
children: "Installed Integrations"
|
|
1030
1030
|
}
|
|
@@ -1033,12 +1033,12 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
1033
1033
|
/* @__PURE__ */ v(
|
|
1034
1034
|
Zt,
|
|
1035
1035
|
{
|
|
1036
|
-
view:
|
|
1036
|
+
view: y,
|
|
1037
1037
|
searchInput: V,
|
|
1038
1038
|
searchTerm: V,
|
|
1039
1039
|
onSearchInputChange: Ft,
|
|
1040
|
-
selectedIntegrationId:
|
|
1041
|
-
hubIntegrations:
|
|
1040
|
+
selectedIntegrationId: z,
|
|
1041
|
+
hubIntegrations: zt,
|
|
1042
1042
|
sidebarIntegrations: w.integrations,
|
|
1043
1043
|
installedIntegrations: w.installedIntegrations,
|
|
1044
1044
|
isHubLoading: w.isLoading,
|
|
@@ -1082,7 +1082,7 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
1082
1082
|
{
|
|
1083
1083
|
integrations: g,
|
|
1084
1084
|
searchTerm: B,
|
|
1085
|
-
categoryOrder: F.length > 0 ? F :
|
|
1085
|
+
categoryOrder: F.length > 0 ? F : Kt,
|
|
1086
1086
|
onSelectIntegration: (D) => {
|
|
1087
1087
|
Q(D.id), W(D.installedId ?? D.id), et("connections"), it("connections");
|
|
1088
1088
|
}
|
|
@@ -1092,24 +1092,24 @@ const rn = "width=650,height=800,popup=true", cn = 500, ln = 5 * 60 * 1e3, dn =
|
|
|
1092
1092
|
}
|
|
1093
1093
|
)
|
|
1094
1094
|
] });
|
|
1095
|
-
}, ne =
|
|
1095
|
+
}, ne = zn;
|
|
1096
1096
|
export {
|
|
1097
1097
|
ne as BotpressIntegrationHub,
|
|
1098
|
-
|
|
1098
|
+
zn as BotpressIntegrationHubScreen,
|
|
1099
1099
|
gn as IntegrationOAuthButton,
|
|
1100
1100
|
hn as IntegrationStaticZuiConfigurationForm,
|
|
1101
1101
|
Yn as dedupeById,
|
|
1102
1102
|
un as fetchOAuthAuthorizationUrl,
|
|
1103
|
-
|
|
1103
|
+
Sn as filterAndSortIntegrations,
|
|
1104
1104
|
ft as findInstalledIntegration,
|
|
1105
1105
|
X as getInstalledIntegrations,
|
|
1106
|
-
|
|
1106
|
+
An as getSelectedConnectionMethod,
|
|
1107
1107
|
dn as getWebhookIdFromUrl,
|
|
1108
1108
|
xt as isOfficialWorkspace,
|
|
1109
1109
|
pn as openOAuthPopup,
|
|
1110
1110
|
Bt as resolveCategory,
|
|
1111
|
-
|
|
1112
|
-
|
|
1111
|
+
yn as toCapabilityCards,
|
|
1112
|
+
In as toConnectionMethods,
|
|
1113
1113
|
pt as toError,
|
|
1114
1114
|
Cn as toHubItem,
|
|
1115
1115
|
wn as toInstalledItem,
|