@workos-inc/widgets 1.17.3 → 1.18.0-next.1788970242803
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/CHANGELOG.md +12 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +2 -2
- package/dist/cjs/lib/pipes-admin.cjs +589 -23
- package/dist/cjs/lib/pipes-admin.cjs.map +1 -1
- package/dist/cjs/lib/pipes-admin.d.cts +39 -3
- package/dist/cjs/lib/pipes.cjs +477 -38
- package/dist/cjs/lib/pipes.cjs.map +1 -1
- package/dist/cjs/lib/pipes.d.cts +114 -3
- package/dist/cjs/lib/status.cjs +2 -0
- package/dist/cjs/lib/status.cjs.map +1 -1
- package/dist/cjs/lib/status.d.cts +2 -2
- package/dist/cjs/pipes-admin.client.cjs +45 -3
- package/dist/cjs/pipes-admin.client.cjs.map +1 -1
- package/dist/cjs/pipes-admin.client.d.cts +13 -0
- package/dist/cjs/pipes.client.cjs +70 -9
- package/dist/cjs/pipes.client.cjs.map +1 -1
- package/dist/cjs/pipes.client.d.cts +84 -29
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/pipes-admin.d.ts +39 -3
- package/dist/esm/lib/pipes-admin.js +608 -25
- package/dist/esm/lib/pipes-admin.js.map +1 -1
- package/dist/esm/lib/pipes.d.ts +114 -3
- package/dist/esm/lib/pipes.js +474 -38
- package/dist/esm/lib/pipes.js.map +1 -1
- package/dist/esm/lib/status.d.ts +2 -2
- package/dist/esm/lib/status.js +2 -0
- package/dist/esm/lib/status.js.map +1 -1
- package/dist/esm/pipes-admin.client.d.ts +13 -0
- package/dist/esm/pipes-admin.client.js +48 -4
- package/dist/esm/pipes-admin.client.js.map +1 -1
- package/dist/esm/pipes.client.d.ts +84 -29
- package/dist/esm/pipes.client.js +76 -10
- package/dist/esm/pipes.client.js.map +1 -1
- package/package.json +1 -1
package/dist/esm/lib/pipes.js
CHANGED
|
@@ -26,11 +26,16 @@ import { IconPanel } from "./icon-panel.js";
|
|
|
26
26
|
import { Status } from "./status.js";
|
|
27
27
|
import {
|
|
28
28
|
getMyDataIntegrationsQueryKey,
|
|
29
|
+
getOrganizationDataIntegrationsQueryKey,
|
|
30
|
+
getSharedDataConnectionsQueryKey,
|
|
29
31
|
useAuthorizeDataIntegrationHook,
|
|
32
|
+
useAuthorizeOrganizationDataIntegrationHook,
|
|
30
33
|
useDeleteDataInstallation,
|
|
31
34
|
useSettings,
|
|
32
35
|
useUpsertDataIntegrationApiKey,
|
|
33
|
-
useUpsertDataIntegrationClientCredentials
|
|
36
|
+
useUpsertDataIntegrationClientCredentials,
|
|
37
|
+
useUpsertOrganizationDataIntegrationApiKey,
|
|
38
|
+
useUpsertOrganizationDataIntegrationClientCredentials
|
|
34
39
|
} from "../api/endpoint.js";
|
|
35
40
|
import { useQueryClient } from "@tanstack/react-query";
|
|
36
41
|
import { GenericError } from "./generic-error.js";
|
|
@@ -46,8 +51,16 @@ const CONNECT_AUTH_METHODS = [
|
|
|
46
51
|
"client_credentials",
|
|
47
52
|
"api_key"
|
|
48
53
|
];
|
|
49
|
-
const
|
|
54
|
+
const useAuthorizeConnection = (owner) => {
|
|
50
55
|
const authorizeDataIntegration = useAuthorizeDataIntegrationHook();
|
|
56
|
+
const authorizeOrganizationDataIntegration = useAuthorizeOrganizationDataIntegrationHook();
|
|
57
|
+
return useCallback(
|
|
58
|
+
(slug, config) => owner === "organization" ? authorizeOrganizationDataIntegration(slug, { config }) : authorizeDataIntegration(slug, { requireHandoff: true, config }),
|
|
59
|
+
[owner, authorizeDataIntegration, authorizeOrganizationDataIntegration]
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
const useOpenDataIntegrationAuthorizeUrl = (integration, owner = "user") => {
|
|
63
|
+
const authorizeDataIntegration = useAuthorizeConnection(owner);
|
|
51
64
|
const settings = useSettings();
|
|
52
65
|
const baseUrl = settings.data?.authkitOrigin ?? "";
|
|
53
66
|
const intervalRef = useRef(
|
|
@@ -82,10 +95,10 @@ const useOpenDataIntegrationAuthorizeUrl = (integration) => {
|
|
|
82
95
|
}
|
|
83
96
|
let authorization;
|
|
84
97
|
try {
|
|
85
|
-
authorization = await authorizeDataIntegration(
|
|
86
|
-
|
|
98
|
+
authorization = await authorizeDataIntegration(
|
|
99
|
+
integration.slug,
|
|
87
100
|
config
|
|
88
|
-
|
|
101
|
+
);
|
|
89
102
|
} catch (error) {
|
|
90
103
|
win.close();
|
|
91
104
|
throw error;
|
|
@@ -397,14 +410,15 @@ function ConnectDialog({
|
|
|
397
410
|
integration,
|
|
398
411
|
fields,
|
|
399
412
|
open,
|
|
400
|
-
onOpenChange
|
|
413
|
+
onOpenChange,
|
|
414
|
+
owner = "user"
|
|
401
415
|
}) {
|
|
402
416
|
const initialStep = fields.length > 0 ? "fields" : "review";
|
|
403
417
|
const [step, setStep] = useState(initialStep);
|
|
404
418
|
const [submitError, setSubmitError] = useState(null);
|
|
405
419
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
406
420
|
const configForm = useConfigFieldsForm(fields);
|
|
407
|
-
const eventHandler = useOpenDataIntegrationAuthorizeUrl(integration);
|
|
421
|
+
const eventHandler = useOpenDataIntegrationAuthorizeUrl(integration, owner);
|
|
408
422
|
const translate = useTranslation();
|
|
409
423
|
const genericConnectError = translate({
|
|
410
424
|
defaultMessage: "We couldn't start the connection. Please try again.",
|
|
@@ -564,13 +578,31 @@ function ConnectIntegrationButton({
|
|
|
564
578
|
] });
|
|
565
579
|
}
|
|
566
580
|
const API_KEY_REDACTED_PREFIX = "\u2022\u2022\u2022\u2022";
|
|
581
|
+
function useInvalidateConnections(owner) {
|
|
582
|
+
const queryClient = useQueryClient();
|
|
583
|
+
return useCallback(() => {
|
|
584
|
+
if (owner === "organization") {
|
|
585
|
+
queryClient.invalidateQueries({
|
|
586
|
+
queryKey: getOrganizationDataIntegrationsQueryKey()
|
|
587
|
+
});
|
|
588
|
+
queryClient.invalidateQueries({
|
|
589
|
+
queryKey: getSharedDataConnectionsQueryKey()
|
|
590
|
+
});
|
|
591
|
+
} else {
|
|
592
|
+
queryClient.invalidateQueries({
|
|
593
|
+
queryKey: getMyDataIntegrationsQueryKey()
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
}, [owner, queryClient]);
|
|
597
|
+
}
|
|
567
598
|
function ApiKeyDialog({
|
|
568
599
|
integration,
|
|
600
|
+
installation = integration.installation,
|
|
601
|
+
owner = "user",
|
|
569
602
|
open,
|
|
570
603
|
onOpenChange
|
|
571
604
|
}) {
|
|
572
|
-
const
|
|
573
|
-
const installation = integration.installation;
|
|
605
|
+
const invalidateConnections = useInvalidateConnections(owner);
|
|
574
606
|
const isRotation = installation?.auth_method === "api_key" && installation.state === "connected";
|
|
575
607
|
const last4 = installation?.api_key_last_4;
|
|
576
608
|
const maskedKey = last4 ? `${API_KEY_REDACTED_PREFIX}${last4}` : "";
|
|
@@ -581,21 +613,22 @@ function ApiKeyDialog({
|
|
|
581
613
|
id: "MzSxEF",
|
|
582
614
|
description: "Placeholder for the API key input field"
|
|
583
615
|
});
|
|
616
|
+
const onUpserted = () => {
|
|
617
|
+
onOpenChange(false);
|
|
618
|
+
invalidateConnections();
|
|
619
|
+
};
|
|
620
|
+
const userUpsert = useUpsertDataIntegrationApiKey({
|
|
621
|
+
mutation: { onSuccess: onUpserted }
|
|
622
|
+
});
|
|
623
|
+
const organizationUpsert = useUpsertOrganizationDataIntegrationApiKey({
|
|
624
|
+
mutation: { onSuccess: onUpserted }
|
|
625
|
+
});
|
|
584
626
|
const {
|
|
585
627
|
mutate: upsertApiKey,
|
|
586
628
|
error,
|
|
587
629
|
reset,
|
|
588
630
|
isPending
|
|
589
|
-
} =
|
|
590
|
-
mutation: {
|
|
591
|
-
onSuccess: () => {
|
|
592
|
-
onOpenChange(false);
|
|
593
|
-
queryClient.invalidateQueries({
|
|
594
|
-
queryKey: getMyDataIntegrationsQueryKey()
|
|
595
|
-
});
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
});
|
|
631
|
+
} = owner === "organization" ? organizationUpsert : userUpsert;
|
|
599
632
|
useEffect(() => {
|
|
600
633
|
reset();
|
|
601
634
|
}, [reset]);
|
|
@@ -736,12 +769,13 @@ function ApiKeyConnectButton({
|
|
|
736
769
|
}
|
|
737
770
|
function ClientCredentialsDialog({
|
|
738
771
|
integration,
|
|
772
|
+
installation = integration.installation,
|
|
773
|
+
owner = "user",
|
|
739
774
|
fields,
|
|
740
775
|
open,
|
|
741
776
|
onOpenChange
|
|
742
777
|
}) {
|
|
743
|
-
const
|
|
744
|
-
const installation = integration.installation;
|
|
778
|
+
const invalidateConnections = useInvalidateConnections(owner);
|
|
745
779
|
const isUpdate = installation?.auth_method === "client_credentials";
|
|
746
780
|
const storedConfig = useMemo(
|
|
747
781
|
() => isUpdate ? installation?.config ?? {} : {},
|
|
@@ -771,20 +805,21 @@ function ClientCredentialsDialog({
|
|
|
771
805
|
description: "Placeholder for the client credentials client secret input"
|
|
772
806
|
});
|
|
773
807
|
const secretMissing = !clientSecret.trim() || isRedactedSecret(clientSecret);
|
|
808
|
+
const onUpserted = () => {
|
|
809
|
+
onOpenChange(false);
|
|
810
|
+
invalidateConnections();
|
|
811
|
+
};
|
|
812
|
+
const userUpsert = useUpsertDataIntegrationClientCredentials({
|
|
813
|
+
mutation: { onSuccess: onUpserted }
|
|
814
|
+
});
|
|
815
|
+
const organizationUpsert = useUpsertOrganizationDataIntegrationClientCredentials({
|
|
816
|
+
mutation: { onSuccess: onUpserted }
|
|
817
|
+
});
|
|
774
818
|
const {
|
|
775
819
|
mutate: upsertClientCredentials,
|
|
776
820
|
error,
|
|
777
821
|
isPending
|
|
778
|
-
} =
|
|
779
|
-
mutation: {
|
|
780
|
-
onSuccess: () => {
|
|
781
|
-
onOpenChange(false);
|
|
782
|
-
queryClient.invalidateQueries({
|
|
783
|
-
queryKey: getMyDataIntegrationsQueryKey()
|
|
784
|
-
});
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
});
|
|
822
|
+
} = owner === "organization" ? organizationUpsert : userUpsert;
|
|
788
823
|
const errorMessage = error instanceof ApiError && error.message ? error.message : null;
|
|
789
824
|
const handleSubmit = () => {
|
|
790
825
|
if (!configForm.validate()) {
|
|
@@ -1358,8 +1393,8 @@ function DisconnectAccountDialog({
|
|
|
1358
1393
|
] })
|
|
1359
1394
|
] }) });
|
|
1360
1395
|
}
|
|
1361
|
-
|
|
1362
|
-
return
|
|
1396
|
+
function PipesSkeletonItems({ count }) {
|
|
1397
|
+
return Array.from({ length: count }).map((_, index) => /* @__PURE__ */ jsx(CardList.Item, { children: /* @__PURE__ */ jsxs(Flex, { direction: "row", justify: "between", align: "center", gap: "2", children: [
|
|
1363
1398
|
/* @__PURE__ */ jsxs(Flex, { gap: "4", align: "center", children: [
|
|
1364
1399
|
/* @__PURE__ */ jsx(Skeleton, { children: /* @__PURE__ */ jsx(IconPanel, { children: /* @__PURE__ */ jsx(ProviderIcon, { provider: "google", size: "2" }) }) }),
|
|
1365
1400
|
/* @__PURE__ */ jsx(Skeleton, { children: /* @__PURE__ */ jsx(Text, { size: "2", weight: "bold", children: /* @__PURE__ */ jsx(
|
|
@@ -1379,16 +1414,409 @@ const PipesLoading = ({ count, ...domProps }) => {
|
|
|
1379
1414
|
description: "Placeholder button text for loading state"
|
|
1380
1415
|
}
|
|
1381
1416
|
) }) })
|
|
1382
|
-
] }) }, index))
|
|
1417
|
+
] }) }, index));
|
|
1418
|
+
}
|
|
1419
|
+
const PipesLoading = ({ count, ...domProps }) => {
|
|
1420
|
+
return /* @__PURE__ */ jsx(CardList.Root, { ...getWidgetRootDomProps("loading", domProps), children: /* @__PURE__ */ jsx(PipesSkeletonItems, { count }) });
|
|
1383
1421
|
};
|
|
1384
|
-
|
|
1385
|
-
return
|
|
1422
|
+
function PipesItems({ integrations }) {
|
|
1423
|
+
return integrations.map((integration) => /* @__PURE__ */ jsx(CardList.Item, { children: /* @__PURE__ */ jsxs(Flex, { direction: "row", justify: "between", align: "center", gap: "2", children: [
|
|
1386
1424
|
/* @__PURE__ */ jsxs(Flex, { gap: "4", align: "center", children: [
|
|
1387
1425
|
/* @__PURE__ */ jsx(IconPanel, { color: "panel", children: /* @__PURE__ */ jsx(DataIntegrationIcon, { integration, size: "2" }) }),
|
|
1388
1426
|
/* @__PURE__ */ jsx(Text, { size: "2", weight: "bold", children: integration.name })
|
|
1389
1427
|
] }),
|
|
1390
1428
|
/* @__PURE__ */ jsx(ProviderStatus, { integration })
|
|
1391
|
-
] }) }, integration.id))
|
|
1429
|
+
] }) }, integration.id));
|
|
1430
|
+
}
|
|
1431
|
+
function PipesEmptyItem({ isFiltered }) {
|
|
1432
|
+
return /* @__PURE__ */ jsx(CardList.Item, { children: /* @__PURE__ */ jsx(Text, { size: "2", color: "gray", children: isFiltered ? /* @__PURE__ */ jsx(
|
|
1433
|
+
Translation,
|
|
1434
|
+
{
|
|
1435
|
+
defaultMessage: "No integrations to show.",
|
|
1436
|
+
id: "cAs7JC",
|
|
1437
|
+
description: "Empty state shown when the host's filter leaves no integrations to list"
|
|
1438
|
+
}
|
|
1439
|
+
) : /* @__PURE__ */ jsx(
|
|
1440
|
+
Translation,
|
|
1441
|
+
{
|
|
1442
|
+
defaultMessage: "No integrations are available yet.",
|
|
1443
|
+
id: "oK0Rjh",
|
|
1444
|
+
description: "Empty state shown when no integrations are enabled at all"
|
|
1445
|
+
}
|
|
1446
|
+
) }) });
|
|
1447
|
+
}
|
|
1448
|
+
const Pipes = ({
|
|
1449
|
+
integrations,
|
|
1450
|
+
hasUnfilteredIntegrations,
|
|
1451
|
+
...domProps
|
|
1452
|
+
}) => {
|
|
1453
|
+
return /* @__PURE__ */ jsx(CardList.Root, { ...getWidgetRootDomProps("resolved", domProps), children: integrations.length > 0 ? /* @__PURE__ */ jsx(PipesItems, { integrations }) : /* @__PURE__ */ jsx(PipesEmptyItem, { isFiltered: hasUnfilteredIntegrations ?? false }) });
|
|
1454
|
+
};
|
|
1455
|
+
function SharedConnectionStatus({
|
|
1456
|
+
connection
|
|
1457
|
+
}) {
|
|
1458
|
+
const isAvailable = connection.connected_accounts.some(
|
|
1459
|
+
(account) => account.availability === "available"
|
|
1460
|
+
);
|
|
1461
|
+
return isAvailable ? /* @__PURE__ */ jsx(Status, { state: "success", children: /* @__PURE__ */ jsx(
|
|
1462
|
+
Translation,
|
|
1463
|
+
{
|
|
1464
|
+
defaultMessage: "Available",
|
|
1465
|
+
id: "_jQjSu",
|
|
1466
|
+
description: "Status text for a shared connection the member can use"
|
|
1467
|
+
}
|
|
1468
|
+
) }) : /* @__PURE__ */ jsx(Status, { state: "warning", children: /* @__PURE__ */ jsx(
|
|
1469
|
+
Translation,
|
|
1470
|
+
{
|
|
1471
|
+
defaultMessage: "Needs admin attention",
|
|
1472
|
+
id: "K5YoFj",
|
|
1473
|
+
description: "Status text for a shared connection an administrator must repair"
|
|
1474
|
+
}
|
|
1475
|
+
) });
|
|
1476
|
+
}
|
|
1477
|
+
function SectionedItem({
|
|
1478
|
+
icon,
|
|
1479
|
+
name,
|
|
1480
|
+
status,
|
|
1481
|
+
description,
|
|
1482
|
+
actions
|
|
1483
|
+
}) {
|
|
1484
|
+
return /* @__PURE__ */ jsx(CardList.Item, { children: /* @__PURE__ */ jsxs(Flex, { direction: "row", justify: "between", align: "center", gap: "4", children: [
|
|
1485
|
+
/* @__PURE__ */ jsxs(Flex, { gap: "4", align: "center", children: [
|
|
1486
|
+
/* @__PURE__ */ jsx(IconPanel, { color: "panel", children: icon }),
|
|
1487
|
+
/* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "1", children: [
|
|
1488
|
+
/* @__PURE__ */ jsxs(Flex, { align: "center", gap: "2", wrap: "wrap", children: [
|
|
1489
|
+
/* @__PURE__ */ jsx(Text, { size: "2", weight: "bold", children: name }),
|
|
1490
|
+
status
|
|
1491
|
+
] }),
|
|
1492
|
+
description && /* @__PURE__ */ jsx(Text, { size: "2", color: "gray", children: description })
|
|
1493
|
+
] })
|
|
1494
|
+
] }),
|
|
1495
|
+
actions
|
|
1496
|
+
] }) });
|
|
1497
|
+
}
|
|
1498
|
+
function SharedConnectionItem({
|
|
1499
|
+
connection
|
|
1500
|
+
}) {
|
|
1501
|
+
return /* @__PURE__ */ jsx(
|
|
1502
|
+
SectionedItem,
|
|
1503
|
+
{
|
|
1504
|
+
icon: /* @__PURE__ */ jsx(
|
|
1505
|
+
DataIntegrationIcon,
|
|
1506
|
+
{
|
|
1507
|
+
integration: {
|
|
1508
|
+
integrationType: connection.slug,
|
|
1509
|
+
iconSlug: connection.iconSlug,
|
|
1510
|
+
iconUrl: connection.iconUrl,
|
|
1511
|
+
iconDarkUrl: connection.iconDarkUrl
|
|
1512
|
+
},
|
|
1513
|
+
size: "2"
|
|
1514
|
+
}
|
|
1515
|
+
),
|
|
1516
|
+
name: connection.name,
|
|
1517
|
+
status: /* @__PURE__ */ jsx(SharedConnectionStatus, { connection }),
|
|
1518
|
+
description: connection.description
|
|
1519
|
+
}
|
|
1520
|
+
);
|
|
1521
|
+
}
|
|
1522
|
+
function MemberConnectionStatus({
|
|
1523
|
+
integration
|
|
1524
|
+
}) {
|
|
1525
|
+
const installation = integration.installation;
|
|
1526
|
+
if (!installation) {
|
|
1527
|
+
return null;
|
|
1528
|
+
}
|
|
1529
|
+
if (installation.state === "connected") {
|
|
1530
|
+
return /* @__PURE__ */ jsx(Status, { state: "success", children: installation.auth_method === "api_key" ? /* @__PURE__ */ jsx(
|
|
1531
|
+
Translation,
|
|
1532
|
+
{
|
|
1533
|
+
defaultMessage: "Connected via API key",
|
|
1534
|
+
id: "jQLTNe",
|
|
1535
|
+
description: "Status text for a connection established with an API key"
|
|
1536
|
+
}
|
|
1537
|
+
) : installation.auth_method === "client_credentials" ? /* @__PURE__ */ jsx(
|
|
1538
|
+
Translation,
|
|
1539
|
+
{
|
|
1540
|
+
defaultMessage: "Connected via client credentials",
|
|
1541
|
+
id: "hQKIrx",
|
|
1542
|
+
description: "Status text for a connection established with client credentials"
|
|
1543
|
+
}
|
|
1544
|
+
) : /* @__PURE__ */ jsx(
|
|
1545
|
+
Translation,
|
|
1546
|
+
{
|
|
1547
|
+
defaultMessage: "Connected via OAuth",
|
|
1548
|
+
id: "pJcK_M",
|
|
1549
|
+
description: "Status text for a connection established with OAuth"
|
|
1550
|
+
}
|
|
1551
|
+
) });
|
|
1552
|
+
}
|
|
1553
|
+
return /* @__PURE__ */ jsx(Status, { state: "warning", children: installation.auth_method === "api_key" ? /* @__PURE__ */ jsx(
|
|
1554
|
+
Translation,
|
|
1555
|
+
{
|
|
1556
|
+
defaultMessage: "Update your API key",
|
|
1557
|
+
id: "-YLPTk",
|
|
1558
|
+
description: "Status text for a connection whose API key stopped working"
|
|
1559
|
+
}
|
|
1560
|
+
) : /* @__PURE__ */ jsx(
|
|
1561
|
+
Translation,
|
|
1562
|
+
{
|
|
1563
|
+
defaultMessage: "Requires reauthorization",
|
|
1564
|
+
id: "dqczQS",
|
|
1565
|
+
description: "Status text for integration needing reauthorization"
|
|
1566
|
+
}
|
|
1567
|
+
) });
|
|
1568
|
+
}
|
|
1569
|
+
function MemberConnectionActions({
|
|
1570
|
+
integration
|
|
1571
|
+
}) {
|
|
1572
|
+
const [disconnectOpen, setDisconnectOpen] = useState(false);
|
|
1573
|
+
const [apiKeyOpen, setApiKeyOpen] = useState(false);
|
|
1574
|
+
const [clientCredentialsOpen, setClientCredentialsOpen] = useState(false);
|
|
1575
|
+
const [reauthConfigOpen, setReauthConfigOpen] = useState(false);
|
|
1576
|
+
const authorizeEventHandler = useOpenDataIntegrationAuthorizeUrl(integration);
|
|
1577
|
+
const translate = useTranslation();
|
|
1578
|
+
const pipeActionsTitle = translate({
|
|
1579
|
+
defaultMessage: "Pipe actions",
|
|
1580
|
+
id: "1uF9ve",
|
|
1581
|
+
description: "Title for pipe actions dropdown button"
|
|
1582
|
+
});
|
|
1583
|
+
const unpinnedFields = getUnpinnedInstallationFields(integration);
|
|
1584
|
+
if (!integration.installation) {
|
|
1585
|
+
const authMethods = integration.authMethods ?? [];
|
|
1586
|
+
const methods = CONNECT_AUTH_METHODS.filter(
|
|
1587
|
+
(method) => authMethods.includes(method)
|
|
1588
|
+
);
|
|
1589
|
+
return methods.length > 1 ? /* @__PURE__ */ jsx(MultiMethodConnectButton, { integration, methods }) : methods.length === 1 && methods[0] === "api_key" ? /* @__PURE__ */ jsx(ApiKeyConnectButton, { integration }) : methods.length === 1 && methods[0] === "client_credentials" ? /* @__PURE__ */ jsx(ClientCredentialsConnectButton, { integration }) : /* @__PURE__ */ jsx(ConnectIntegrationButton, { integration });
|
|
1590
|
+
}
|
|
1591
|
+
const connected = integration.installation.state === "connected";
|
|
1592
|
+
const isApiKeyInstallation = integration.installation.auth_method === "api_key";
|
|
1593
|
+
const isClientCredentialsInstallation = integration.installation.auth_method === "client_credentials";
|
|
1594
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1595
|
+
/* @__PURE__ */ jsx(
|
|
1596
|
+
DisconnectAccountDialog,
|
|
1597
|
+
{
|
|
1598
|
+
integrationName: integration.name,
|
|
1599
|
+
installationId: integration.installation.id,
|
|
1600
|
+
open: disconnectOpen,
|
|
1601
|
+
onOpenChange: setDisconnectOpen
|
|
1602
|
+
}
|
|
1603
|
+
),
|
|
1604
|
+
apiKeyOpen && /* @__PURE__ */ jsx(
|
|
1605
|
+
ApiKeyDialog,
|
|
1606
|
+
{
|
|
1607
|
+
integration,
|
|
1608
|
+
open: apiKeyOpen,
|
|
1609
|
+
onOpenChange: setApiKeyOpen
|
|
1610
|
+
}
|
|
1611
|
+
),
|
|
1612
|
+
clientCredentialsOpen && /* @__PURE__ */ jsx(
|
|
1613
|
+
ClientCredentialsDialog,
|
|
1614
|
+
{
|
|
1615
|
+
integration,
|
|
1616
|
+
fields: unpinnedFields,
|
|
1617
|
+
open: clientCredentialsOpen,
|
|
1618
|
+
onOpenChange: setClientCredentialsOpen
|
|
1619
|
+
}
|
|
1620
|
+
),
|
|
1621
|
+
unpinnedFields.length > 0 && !isClientCredentialsInstallation && /* @__PURE__ */ jsx(
|
|
1622
|
+
ConnectDialog,
|
|
1623
|
+
{
|
|
1624
|
+
integration,
|
|
1625
|
+
fields: unpinnedFields,
|
|
1626
|
+
open: reauthConfigOpen,
|
|
1627
|
+
onOpenChange: setReauthConfigOpen
|
|
1628
|
+
}
|
|
1629
|
+
),
|
|
1630
|
+
/* @__PURE__ */ jsxs(Flex, { align: "center", gap: "4", children: [
|
|
1631
|
+
!connected && (isApiKeyInstallation ? /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => setApiKeyOpen(true), children: /* @__PURE__ */ jsx(
|
|
1632
|
+
Translation,
|
|
1633
|
+
{
|
|
1634
|
+
defaultMessage: "Update key",
|
|
1635
|
+
id: "MP-aOE",
|
|
1636
|
+
description: "Button to replace the API key of a connection that stopped working"
|
|
1637
|
+
}
|
|
1638
|
+
) }) : isClientCredentialsInstallation ? /* @__PURE__ */ jsx(
|
|
1639
|
+
Button,
|
|
1640
|
+
{
|
|
1641
|
+
variant: "secondary",
|
|
1642
|
+
onClick: () => setClientCredentialsOpen(true),
|
|
1643
|
+
children: /* @__PURE__ */ jsx(
|
|
1644
|
+
Translation,
|
|
1645
|
+
{
|
|
1646
|
+
defaultMessage: "Update credentials",
|
|
1647
|
+
id: "1inB3Y",
|
|
1648
|
+
description: "Button to update the client credentials of a connection that stopped working"
|
|
1649
|
+
}
|
|
1650
|
+
)
|
|
1651
|
+
}
|
|
1652
|
+
) : /* @__PURE__ */ jsx(
|
|
1653
|
+
Button,
|
|
1654
|
+
{
|
|
1655
|
+
variant: "secondary",
|
|
1656
|
+
onClick: async () => {
|
|
1657
|
+
if (unpinnedFields.length > 0) {
|
|
1658
|
+
setReauthConfigOpen(true);
|
|
1659
|
+
return;
|
|
1660
|
+
}
|
|
1661
|
+
try {
|
|
1662
|
+
await authorizeEventHandler();
|
|
1663
|
+
} catch {
|
|
1664
|
+
}
|
|
1665
|
+
},
|
|
1666
|
+
children: /* @__PURE__ */ jsx(
|
|
1667
|
+
Translation,
|
|
1668
|
+
{
|
|
1669
|
+
defaultMessage: "Reauthorize",
|
|
1670
|
+
id: "3IbiTG",
|
|
1671
|
+
description: "Button to reauthorize a connection that stopped working"
|
|
1672
|
+
}
|
|
1673
|
+
)
|
|
1674
|
+
}
|
|
1675
|
+
)),
|
|
1676
|
+
/* @__PURE__ */ jsxs(DropdownMenu.Root, { children: [
|
|
1677
|
+
/* @__PURE__ */ jsx(DropdownMenu.Trigger, { children: /* @__PURE__ */ jsx(IconButton, { title: pipeActionsTitle, children: /* @__PURE__ */ jsx(DotsHorizontalIcon, {}) }) }),
|
|
1678
|
+
/* @__PURE__ */ jsxs(DropdownMenu.Content, { align: "end", children: [
|
|
1679
|
+
connected && isApiKeyInstallation && /* @__PURE__ */ jsx(DropdownMenu.Item, { onClick: () => setApiKeyOpen(true), children: /* @__PURE__ */ jsx(
|
|
1680
|
+
Translation,
|
|
1681
|
+
{
|
|
1682
|
+
defaultMessage: "Rotate API key",
|
|
1683
|
+
id: "GML+c8",
|
|
1684
|
+
description: "Menu option to rotate the API key"
|
|
1685
|
+
}
|
|
1686
|
+
) }),
|
|
1687
|
+
connected && isClientCredentialsInstallation && /* @__PURE__ */ jsx(DropdownMenu.Item, { onClick: () => setClientCredentialsOpen(true), children: /* @__PURE__ */ jsx(
|
|
1688
|
+
Translation,
|
|
1689
|
+
{
|
|
1690
|
+
defaultMessage: "Update client credentials",
|
|
1691
|
+
id: "daHKWE",
|
|
1692
|
+
description: "Menu option to update stored client credentials"
|
|
1693
|
+
}
|
|
1694
|
+
) }),
|
|
1695
|
+
/* @__PURE__ */ jsx(
|
|
1696
|
+
DropdownMenu.Item,
|
|
1697
|
+
{
|
|
1698
|
+
variant: "destructive",
|
|
1699
|
+
onClick: () => setDisconnectOpen(true),
|
|
1700
|
+
children: /* @__PURE__ */ jsx(
|
|
1701
|
+
Translation,
|
|
1702
|
+
{
|
|
1703
|
+
defaultMessage: "Disconnect account",
|
|
1704
|
+
id: "esZQrd",
|
|
1705
|
+
description: "Menu option to disconnect an account"
|
|
1706
|
+
}
|
|
1707
|
+
)
|
|
1708
|
+
}
|
|
1709
|
+
)
|
|
1710
|
+
] })
|
|
1711
|
+
] })
|
|
1712
|
+
] })
|
|
1713
|
+
] });
|
|
1714
|
+
}
|
|
1715
|
+
function MemberConnectionItems({
|
|
1716
|
+
integrations
|
|
1717
|
+
}) {
|
|
1718
|
+
return integrations.map((integration) => /* @__PURE__ */ jsx(
|
|
1719
|
+
SectionedItem,
|
|
1720
|
+
{
|
|
1721
|
+
icon: /* @__PURE__ */ jsx(DataIntegrationIcon, { integration, size: "2" }),
|
|
1722
|
+
name: integration.name,
|
|
1723
|
+
status: /* @__PURE__ */ jsx(MemberConnectionStatus, { integration }),
|
|
1724
|
+
description: integration.description,
|
|
1725
|
+
actions: /* @__PURE__ */ jsx(MemberConnectionActions, { integration })
|
|
1726
|
+
},
|
|
1727
|
+
integration.id
|
|
1728
|
+
));
|
|
1729
|
+
}
|
|
1730
|
+
function PipesSection({
|
|
1731
|
+
title,
|
|
1732
|
+
description,
|
|
1733
|
+
children
|
|
1734
|
+
}) {
|
|
1735
|
+
return /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "3", children: [
|
|
1736
|
+
/* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "1", children: [
|
|
1737
|
+
/* @__PURE__ */ jsx(Text, { size: "3", weight: "bold", children: title }),
|
|
1738
|
+
/* @__PURE__ */ jsx(Text, { size: "2", color: "gray", children: description })
|
|
1739
|
+
] }),
|
|
1740
|
+
children
|
|
1741
|
+
] });
|
|
1742
|
+
}
|
|
1743
|
+
const PipesSections = ({
|
|
1744
|
+
integrations,
|
|
1745
|
+
hasUnfilteredIntegrations,
|
|
1746
|
+
sharedConnections,
|
|
1747
|
+
hasUnfilteredSharedConnections,
|
|
1748
|
+
isSharedLoading,
|
|
1749
|
+
organizationName,
|
|
1750
|
+
...domProps
|
|
1751
|
+
}) => {
|
|
1752
|
+
return /* @__PURE__ */ jsxs(
|
|
1753
|
+
Flex,
|
|
1754
|
+
{
|
|
1755
|
+
direction: "column",
|
|
1756
|
+
gap: "5",
|
|
1757
|
+
...getWidgetRootDomProps("resolved", domProps),
|
|
1758
|
+
children: [
|
|
1759
|
+
(isSharedLoading || sharedConnections.length > 0 || hasUnfilteredSharedConnections) && /* @__PURE__ */ jsx(
|
|
1760
|
+
PipesSection,
|
|
1761
|
+
{
|
|
1762
|
+
title: /* @__PURE__ */ jsx(
|
|
1763
|
+
Translation,
|
|
1764
|
+
{
|
|
1765
|
+
defaultMessage: "Shared connections",
|
|
1766
|
+
id: "Fcd-bK",
|
|
1767
|
+
description: "Heading for the section listing connections the organization owns"
|
|
1768
|
+
}
|
|
1769
|
+
),
|
|
1770
|
+
description: organizationName ? /* @__PURE__ */ jsx(
|
|
1771
|
+
Translation,
|
|
1772
|
+
{
|
|
1773
|
+
defaultMessage: "Accounts {organizationName} owns and shares with everyone.",
|
|
1774
|
+
id: "7U8P0v",
|
|
1775
|
+
description: "Description of the shared connections section, naming the organization",
|
|
1776
|
+
values: { organizationName }
|
|
1777
|
+
}
|
|
1778
|
+
) : /* @__PURE__ */ jsx(
|
|
1779
|
+
Translation,
|
|
1780
|
+
{
|
|
1781
|
+
defaultMessage: "Accounts your organization owns and shares with everyone.",
|
|
1782
|
+
id: "72FEZi",
|
|
1783
|
+
description: "Description of the shared connections section when the organization name is unknown"
|
|
1784
|
+
}
|
|
1785
|
+
),
|
|
1786
|
+
children: /* @__PURE__ */ jsx(CardList.Root, { children: isSharedLoading ? /* @__PURE__ */ jsx(PipesSkeletonItems, { count: 2 }) : sharedConnections.length > 0 ? sharedConnections.map((connection) => /* @__PURE__ */ jsx(
|
|
1787
|
+
SharedConnectionItem,
|
|
1788
|
+
{
|
|
1789
|
+
connection
|
|
1790
|
+
},
|
|
1791
|
+
connection.id
|
|
1792
|
+
)) : /* @__PURE__ */ jsx(PipesEmptyItem, { isFiltered: true }) })
|
|
1793
|
+
}
|
|
1794
|
+
),
|
|
1795
|
+
/* @__PURE__ */ jsx(
|
|
1796
|
+
PipesSection,
|
|
1797
|
+
{
|
|
1798
|
+
title: /* @__PURE__ */ jsx(
|
|
1799
|
+
Translation,
|
|
1800
|
+
{
|
|
1801
|
+
defaultMessage: "Your connections",
|
|
1802
|
+
id: "-VDI3G",
|
|
1803
|
+
description: "Heading for the section listing the member's own connections"
|
|
1804
|
+
}
|
|
1805
|
+
),
|
|
1806
|
+
description: /* @__PURE__ */ jsx(
|
|
1807
|
+
Translation,
|
|
1808
|
+
{
|
|
1809
|
+
defaultMessage: "Connect your account to access these connections.",
|
|
1810
|
+
id: "ObXqUu",
|
|
1811
|
+
description: "Description of the personal connections section"
|
|
1812
|
+
}
|
|
1813
|
+
),
|
|
1814
|
+
children: /* @__PURE__ */ jsx(CardList.Root, { children: integrations.length > 0 ? /* @__PURE__ */ jsx(MemberConnectionItems, { integrations }) : /* @__PURE__ */ jsx(PipesEmptyItem, { isFiltered: hasUnfilteredIntegrations ?? false }) })
|
|
1815
|
+
}
|
|
1816
|
+
)
|
|
1817
|
+
]
|
|
1818
|
+
}
|
|
1819
|
+
);
|
|
1392
1820
|
};
|
|
1393
1821
|
const PipesError = ({ error, ...domProps }) => {
|
|
1394
1822
|
return /* @__PURE__ */ jsx(Card, { size: "2", ...getWidgetRootDomProps("error", domProps), children: /* @__PURE__ */ jsx(GenericError, { error }) });
|
|
@@ -1402,8 +1830,16 @@ function getWidgetRootDomProps(state, domProps) {
|
|
|
1402
1830
|
});
|
|
1403
1831
|
}
|
|
1404
1832
|
export {
|
|
1833
|
+
ApiKeyDialog,
|
|
1834
|
+
ClientCredentialsDialog,
|
|
1835
|
+
ConnectDialog,
|
|
1405
1836
|
Pipes,
|
|
1837
|
+
PipesEmptyItem,
|
|
1406
1838
|
PipesError,
|
|
1407
|
-
PipesLoading
|
|
1839
|
+
PipesLoading,
|
|
1840
|
+
PipesSection,
|
|
1841
|
+
PipesSections,
|
|
1842
|
+
getUnpinnedInstallationFields,
|
|
1843
|
+
useOpenDataIntegrationAuthorizeUrl
|
|
1408
1844
|
};
|
|
1409
1845
|
//# sourceMappingURL=pipes.js.map
|