@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/cjs/lib/pipes.cjs
CHANGED
|
@@ -29,9 +29,17 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
29
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
30
|
var pipes_exports = {};
|
|
31
31
|
__export(pipes_exports, {
|
|
32
|
+
ApiKeyDialog: () => ApiKeyDialog,
|
|
33
|
+
ClientCredentialsDialog: () => ClientCredentialsDialog,
|
|
34
|
+
ConnectDialog: () => ConnectDialog,
|
|
32
35
|
Pipes: () => Pipes,
|
|
36
|
+
PipesEmptyItem: () => PipesEmptyItem,
|
|
33
37
|
PipesError: () => PipesError,
|
|
34
|
-
PipesLoading: () => PipesLoading
|
|
38
|
+
PipesLoading: () => PipesLoading,
|
|
39
|
+
PipesSection: () => PipesSection,
|
|
40
|
+
PipesSections: () => PipesSections,
|
|
41
|
+
getUnpinnedInstallationFields: () => getUnpinnedInstallationFields,
|
|
42
|
+
useOpenDataIntegrationAuthorizeUrl: () => useOpenDataIntegrationAuthorizeUrl
|
|
35
43
|
});
|
|
36
44
|
module.exports = __toCommonJS(pipes_exports);
|
|
37
45
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -59,8 +67,16 @@ const CONNECT_AUTH_METHODS = [
|
|
|
59
67
|
"client_credentials",
|
|
60
68
|
"api_key"
|
|
61
69
|
];
|
|
62
|
-
const
|
|
70
|
+
const useAuthorizeConnection = (owner) => {
|
|
63
71
|
const authorizeDataIntegration = (0, import_endpoint.useAuthorizeDataIntegrationHook)();
|
|
72
|
+
const authorizeOrganizationDataIntegration = (0, import_endpoint.useAuthorizeOrganizationDataIntegrationHook)();
|
|
73
|
+
return (0, import_react.useCallback)(
|
|
74
|
+
(slug, config) => owner === "organization" ? authorizeOrganizationDataIntegration(slug, { config }) : authorizeDataIntegration(slug, { requireHandoff: true, config }),
|
|
75
|
+
[owner, authorizeDataIntegration, authorizeOrganizationDataIntegration]
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
const useOpenDataIntegrationAuthorizeUrl = (integration, owner = "user") => {
|
|
79
|
+
const authorizeDataIntegration = useAuthorizeConnection(owner);
|
|
64
80
|
const settings = (0, import_endpoint.useSettings)();
|
|
65
81
|
const baseUrl = settings.data?.authkitOrigin ?? "";
|
|
66
82
|
const intervalRef = (0, import_react.useRef)(
|
|
@@ -95,10 +111,10 @@ const useOpenDataIntegrationAuthorizeUrl = (integration) => {
|
|
|
95
111
|
}
|
|
96
112
|
let authorization;
|
|
97
113
|
try {
|
|
98
|
-
authorization = await authorizeDataIntegration(
|
|
99
|
-
|
|
114
|
+
authorization = await authorizeDataIntegration(
|
|
115
|
+
integration.slug,
|
|
100
116
|
config
|
|
101
|
-
|
|
117
|
+
);
|
|
102
118
|
} catch (error) {
|
|
103
119
|
win.close();
|
|
104
120
|
throw error;
|
|
@@ -410,14 +426,15 @@ function ConnectDialog({
|
|
|
410
426
|
integration,
|
|
411
427
|
fields,
|
|
412
428
|
open,
|
|
413
|
-
onOpenChange
|
|
429
|
+
onOpenChange,
|
|
430
|
+
owner = "user"
|
|
414
431
|
}) {
|
|
415
432
|
const initialStep = fields.length > 0 ? "fields" : "review";
|
|
416
433
|
const [step, setStep] = (0, import_react.useState)(initialStep);
|
|
417
434
|
const [submitError, setSubmitError] = (0, import_react.useState)(null);
|
|
418
435
|
const [isSubmitting, setIsSubmitting] = (0, import_react.useState)(false);
|
|
419
436
|
const configForm = useConfigFieldsForm(fields);
|
|
420
|
-
const eventHandler = useOpenDataIntegrationAuthorizeUrl(integration);
|
|
437
|
+
const eventHandler = useOpenDataIntegrationAuthorizeUrl(integration, owner);
|
|
421
438
|
const translate = (0, import_use_translation.useTranslation)();
|
|
422
439
|
const genericConnectError = translate({
|
|
423
440
|
defaultMessage: "We couldn't start the connection. Please try again.",
|
|
@@ -577,13 +594,31 @@ function ConnectIntegrationButton({
|
|
|
577
594
|
] });
|
|
578
595
|
}
|
|
579
596
|
const API_KEY_REDACTED_PREFIX = "\u2022\u2022\u2022\u2022";
|
|
597
|
+
function useInvalidateConnections(owner) {
|
|
598
|
+
const queryClient = (0, import_react_query.useQueryClient)();
|
|
599
|
+
return (0, import_react.useCallback)(() => {
|
|
600
|
+
if (owner === "organization") {
|
|
601
|
+
queryClient.invalidateQueries({
|
|
602
|
+
queryKey: (0, import_endpoint.getOrganizationDataIntegrationsQueryKey)()
|
|
603
|
+
});
|
|
604
|
+
queryClient.invalidateQueries({
|
|
605
|
+
queryKey: (0, import_endpoint.getSharedDataConnectionsQueryKey)()
|
|
606
|
+
});
|
|
607
|
+
} else {
|
|
608
|
+
queryClient.invalidateQueries({
|
|
609
|
+
queryKey: (0, import_endpoint.getMyDataIntegrationsQueryKey)()
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
}, [owner, queryClient]);
|
|
613
|
+
}
|
|
580
614
|
function ApiKeyDialog({
|
|
581
615
|
integration,
|
|
616
|
+
installation = integration.installation,
|
|
617
|
+
owner = "user",
|
|
582
618
|
open,
|
|
583
619
|
onOpenChange
|
|
584
620
|
}) {
|
|
585
|
-
const
|
|
586
|
-
const installation = integration.installation;
|
|
621
|
+
const invalidateConnections = useInvalidateConnections(owner);
|
|
587
622
|
const isRotation = installation?.auth_method === "api_key" && installation.state === "connected";
|
|
588
623
|
const last4 = installation?.api_key_last_4;
|
|
589
624
|
const maskedKey = last4 ? `${API_KEY_REDACTED_PREFIX}${last4}` : "";
|
|
@@ -594,21 +629,22 @@ function ApiKeyDialog({
|
|
|
594
629
|
id: "MzSxEF",
|
|
595
630
|
description: "Placeholder for the API key input field"
|
|
596
631
|
});
|
|
632
|
+
const onUpserted = () => {
|
|
633
|
+
onOpenChange(false);
|
|
634
|
+
invalidateConnections();
|
|
635
|
+
};
|
|
636
|
+
const userUpsert = (0, import_endpoint.useUpsertDataIntegrationApiKey)({
|
|
637
|
+
mutation: { onSuccess: onUpserted }
|
|
638
|
+
});
|
|
639
|
+
const organizationUpsert = (0, import_endpoint.useUpsertOrganizationDataIntegrationApiKey)({
|
|
640
|
+
mutation: { onSuccess: onUpserted }
|
|
641
|
+
});
|
|
597
642
|
const {
|
|
598
643
|
mutate: upsertApiKey,
|
|
599
644
|
error,
|
|
600
645
|
reset,
|
|
601
646
|
isPending
|
|
602
|
-
} =
|
|
603
|
-
mutation: {
|
|
604
|
-
onSuccess: () => {
|
|
605
|
-
onOpenChange(false);
|
|
606
|
-
queryClient.invalidateQueries({
|
|
607
|
-
queryKey: (0, import_endpoint.getMyDataIntegrationsQueryKey)()
|
|
608
|
-
});
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
});
|
|
647
|
+
} = owner === "organization" ? organizationUpsert : userUpsert;
|
|
612
648
|
(0, import_react.useEffect)(() => {
|
|
613
649
|
reset();
|
|
614
650
|
}, [reset]);
|
|
@@ -749,12 +785,13 @@ function ApiKeyConnectButton({
|
|
|
749
785
|
}
|
|
750
786
|
function ClientCredentialsDialog({
|
|
751
787
|
integration,
|
|
788
|
+
installation = integration.installation,
|
|
789
|
+
owner = "user",
|
|
752
790
|
fields,
|
|
753
791
|
open,
|
|
754
792
|
onOpenChange
|
|
755
793
|
}) {
|
|
756
|
-
const
|
|
757
|
-
const installation = integration.installation;
|
|
794
|
+
const invalidateConnections = useInvalidateConnections(owner);
|
|
758
795
|
const isUpdate = installation?.auth_method === "client_credentials";
|
|
759
796
|
const storedConfig = (0, import_react.useMemo)(
|
|
760
797
|
() => isUpdate ? installation?.config ?? {} : {},
|
|
@@ -784,20 +821,21 @@ function ClientCredentialsDialog({
|
|
|
784
821
|
description: "Placeholder for the client credentials client secret input"
|
|
785
822
|
});
|
|
786
823
|
const secretMissing = !clientSecret.trim() || (0, import_redacted_secret.isRedactedSecret)(clientSecret);
|
|
824
|
+
const onUpserted = () => {
|
|
825
|
+
onOpenChange(false);
|
|
826
|
+
invalidateConnections();
|
|
827
|
+
};
|
|
828
|
+
const userUpsert = (0, import_endpoint.useUpsertDataIntegrationClientCredentials)({
|
|
829
|
+
mutation: { onSuccess: onUpserted }
|
|
830
|
+
});
|
|
831
|
+
const organizationUpsert = (0, import_endpoint.useUpsertOrganizationDataIntegrationClientCredentials)({
|
|
832
|
+
mutation: { onSuccess: onUpserted }
|
|
833
|
+
});
|
|
787
834
|
const {
|
|
788
835
|
mutate: upsertClientCredentials,
|
|
789
836
|
error,
|
|
790
837
|
isPending
|
|
791
|
-
} =
|
|
792
|
-
mutation: {
|
|
793
|
-
onSuccess: () => {
|
|
794
|
-
onOpenChange(false);
|
|
795
|
-
queryClient.invalidateQueries({
|
|
796
|
-
queryKey: (0, import_endpoint.getMyDataIntegrationsQueryKey)()
|
|
797
|
-
});
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
});
|
|
838
|
+
} = owner === "organization" ? organizationUpsert : userUpsert;
|
|
801
839
|
const errorMessage = error instanceof import_errors.ApiError && error.message ? error.message : null;
|
|
802
840
|
const handleSubmit = () => {
|
|
803
841
|
if (!configForm.validate()) {
|
|
@@ -1371,8 +1409,8 @@ function DisconnectAccountDialog({
|
|
|
1371
1409
|
] })
|
|
1372
1410
|
] }) });
|
|
1373
1411
|
}
|
|
1374
|
-
|
|
1375
|
-
return
|
|
1412
|
+
function PipesSkeletonItems({ count }) {
|
|
1413
|
+
return Array.from({ length: count }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CardList.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_themes.Flex, { direction: "row", justify: "between", align: "center", gap: "2", children: [
|
|
1376
1414
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_themes.Flex, { gap: "4", align: "center", children: [
|
|
1377
1415
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_elements.Skeleton, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon_panel.IconPanel, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_provider_icon.ProviderIcon, { provider: "google", size: "2" }) }) }),
|
|
1378
1416
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_elements.Skeleton, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_themes.Text, { size: "2", weight: "bold", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -1392,16 +1430,409 @@ const PipesLoading = ({ count, ...domProps }) => {
|
|
|
1392
1430
|
description: "Placeholder button text for loading state"
|
|
1393
1431
|
}
|
|
1394
1432
|
) }) })
|
|
1395
|
-
] }) }, index))
|
|
1433
|
+
] }) }, index));
|
|
1434
|
+
}
|
|
1435
|
+
const PipesLoading = ({ count, ...domProps }) => {
|
|
1436
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CardList.Root, { ...getWidgetRootDomProps("loading", domProps), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PipesSkeletonItems, { count }) });
|
|
1396
1437
|
};
|
|
1397
|
-
|
|
1398
|
-
return
|
|
1438
|
+
function PipesItems({ integrations }) {
|
|
1439
|
+
return integrations.map((integration) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CardList.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_themes.Flex, { direction: "row", justify: "between", align: "center", gap: "2", children: [
|
|
1399
1440
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_themes.Flex, { gap: "4", align: "center", children: [
|
|
1400
1441
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon_panel.IconPanel, { color: "panel", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_data_integration_icon.DataIntegrationIcon, { integration, size: "2" }) }),
|
|
1401
1442
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_themes.Text, { size: "2", weight: "bold", children: integration.name })
|
|
1402
1443
|
] }),
|
|
1403
1444
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProviderStatus, { integration })
|
|
1404
|
-
] }) }, integration.id))
|
|
1445
|
+
] }) }, integration.id));
|
|
1446
|
+
}
|
|
1447
|
+
function PipesEmptyItem({ isFiltered }) {
|
|
1448
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CardList.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_themes.Text, { size: "2", color: "gray", children: isFiltered ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1449
|
+
import_translation.Translation,
|
|
1450
|
+
{
|
|
1451
|
+
defaultMessage: "No integrations to show.",
|
|
1452
|
+
id: "cAs7JC",
|
|
1453
|
+
description: "Empty state shown when the host's filter leaves no integrations to list"
|
|
1454
|
+
}
|
|
1455
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1456
|
+
import_translation.Translation,
|
|
1457
|
+
{
|
|
1458
|
+
defaultMessage: "No integrations are available yet.",
|
|
1459
|
+
id: "oK0Rjh",
|
|
1460
|
+
description: "Empty state shown when no integrations are enabled at all"
|
|
1461
|
+
}
|
|
1462
|
+
) }) });
|
|
1463
|
+
}
|
|
1464
|
+
const Pipes = ({
|
|
1465
|
+
integrations,
|
|
1466
|
+
hasUnfilteredIntegrations,
|
|
1467
|
+
...domProps
|
|
1468
|
+
}) => {
|
|
1469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CardList.Root, { ...getWidgetRootDomProps("resolved", domProps), children: integrations.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PipesItems, { integrations }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PipesEmptyItem, { isFiltered: hasUnfilteredIntegrations ?? false }) });
|
|
1470
|
+
};
|
|
1471
|
+
function SharedConnectionStatus({
|
|
1472
|
+
connection
|
|
1473
|
+
}) {
|
|
1474
|
+
const isAvailable = connection.connected_accounts.some(
|
|
1475
|
+
(account) => account.availability === "available"
|
|
1476
|
+
);
|
|
1477
|
+
return isAvailable ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_status.Status, { state: "success", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1478
|
+
import_translation.Translation,
|
|
1479
|
+
{
|
|
1480
|
+
defaultMessage: "Available",
|
|
1481
|
+
id: "_jQjSu",
|
|
1482
|
+
description: "Status text for a shared connection the member can use"
|
|
1483
|
+
}
|
|
1484
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_status.Status, { state: "warning", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1485
|
+
import_translation.Translation,
|
|
1486
|
+
{
|
|
1487
|
+
defaultMessage: "Needs admin attention",
|
|
1488
|
+
id: "K5YoFj",
|
|
1489
|
+
description: "Status text for a shared connection an administrator must repair"
|
|
1490
|
+
}
|
|
1491
|
+
) });
|
|
1492
|
+
}
|
|
1493
|
+
function SectionedItem({
|
|
1494
|
+
icon,
|
|
1495
|
+
name,
|
|
1496
|
+
status,
|
|
1497
|
+
description,
|
|
1498
|
+
actions
|
|
1499
|
+
}) {
|
|
1500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CardList.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_themes.Flex, { direction: "row", justify: "between", align: "center", gap: "4", children: [
|
|
1501
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_themes.Flex, { gap: "4", align: "center", children: [
|
|
1502
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon_panel.IconPanel, { color: "panel", children: icon }),
|
|
1503
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_themes.Flex, { direction: "column", gap: "1", children: [
|
|
1504
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_themes.Flex, { align: "center", gap: "2", wrap: "wrap", children: [
|
|
1505
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_themes.Text, { size: "2", weight: "bold", children: name }),
|
|
1506
|
+
status
|
|
1507
|
+
] }),
|
|
1508
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_themes.Text, { size: "2", color: "gray", children: description })
|
|
1509
|
+
] })
|
|
1510
|
+
] }),
|
|
1511
|
+
actions
|
|
1512
|
+
] }) });
|
|
1513
|
+
}
|
|
1514
|
+
function SharedConnectionItem({
|
|
1515
|
+
connection
|
|
1516
|
+
}) {
|
|
1517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1518
|
+
SectionedItem,
|
|
1519
|
+
{
|
|
1520
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1521
|
+
import_data_integration_icon.DataIntegrationIcon,
|
|
1522
|
+
{
|
|
1523
|
+
integration: {
|
|
1524
|
+
integrationType: connection.slug,
|
|
1525
|
+
iconSlug: connection.iconSlug,
|
|
1526
|
+
iconUrl: connection.iconUrl,
|
|
1527
|
+
iconDarkUrl: connection.iconDarkUrl
|
|
1528
|
+
},
|
|
1529
|
+
size: "2"
|
|
1530
|
+
}
|
|
1531
|
+
),
|
|
1532
|
+
name: connection.name,
|
|
1533
|
+
status: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SharedConnectionStatus, { connection }),
|
|
1534
|
+
description: connection.description
|
|
1535
|
+
}
|
|
1536
|
+
);
|
|
1537
|
+
}
|
|
1538
|
+
function MemberConnectionStatus({
|
|
1539
|
+
integration
|
|
1540
|
+
}) {
|
|
1541
|
+
const installation = integration.installation;
|
|
1542
|
+
if (!installation) {
|
|
1543
|
+
return null;
|
|
1544
|
+
}
|
|
1545
|
+
if (installation.state === "connected") {
|
|
1546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_status.Status, { state: "success", children: installation.auth_method === "api_key" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1547
|
+
import_translation.Translation,
|
|
1548
|
+
{
|
|
1549
|
+
defaultMessage: "Connected via API key",
|
|
1550
|
+
id: "jQLTNe",
|
|
1551
|
+
description: "Status text for a connection established with an API key"
|
|
1552
|
+
}
|
|
1553
|
+
) : installation.auth_method === "client_credentials" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1554
|
+
import_translation.Translation,
|
|
1555
|
+
{
|
|
1556
|
+
defaultMessage: "Connected via client credentials",
|
|
1557
|
+
id: "hQKIrx",
|
|
1558
|
+
description: "Status text for a connection established with client credentials"
|
|
1559
|
+
}
|
|
1560
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1561
|
+
import_translation.Translation,
|
|
1562
|
+
{
|
|
1563
|
+
defaultMessage: "Connected via OAuth",
|
|
1564
|
+
id: "pJcK_M",
|
|
1565
|
+
description: "Status text for a connection established with OAuth"
|
|
1566
|
+
}
|
|
1567
|
+
) });
|
|
1568
|
+
}
|
|
1569
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_status.Status, { state: "warning", children: installation.auth_method === "api_key" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1570
|
+
import_translation.Translation,
|
|
1571
|
+
{
|
|
1572
|
+
defaultMessage: "Update your API key",
|
|
1573
|
+
id: "-YLPTk",
|
|
1574
|
+
description: "Status text for a connection whose API key stopped working"
|
|
1575
|
+
}
|
|
1576
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1577
|
+
import_translation.Translation,
|
|
1578
|
+
{
|
|
1579
|
+
defaultMessage: "Requires reauthorization",
|
|
1580
|
+
id: "dqczQS",
|
|
1581
|
+
description: "Status text for integration needing reauthorization"
|
|
1582
|
+
}
|
|
1583
|
+
) });
|
|
1584
|
+
}
|
|
1585
|
+
function MemberConnectionActions({
|
|
1586
|
+
integration
|
|
1587
|
+
}) {
|
|
1588
|
+
const [disconnectOpen, setDisconnectOpen] = (0, import_react.useState)(false);
|
|
1589
|
+
const [apiKeyOpen, setApiKeyOpen] = (0, import_react.useState)(false);
|
|
1590
|
+
const [clientCredentialsOpen, setClientCredentialsOpen] = (0, import_react.useState)(false);
|
|
1591
|
+
const [reauthConfigOpen, setReauthConfigOpen] = (0, import_react.useState)(false);
|
|
1592
|
+
const authorizeEventHandler = useOpenDataIntegrationAuthorizeUrl(integration);
|
|
1593
|
+
const translate = (0, import_use_translation.useTranslation)();
|
|
1594
|
+
const pipeActionsTitle = translate({
|
|
1595
|
+
defaultMessage: "Pipe actions",
|
|
1596
|
+
id: "1uF9ve",
|
|
1597
|
+
description: "Title for pipe actions dropdown button"
|
|
1598
|
+
});
|
|
1599
|
+
const unpinnedFields = getUnpinnedInstallationFields(integration);
|
|
1600
|
+
if (!integration.installation) {
|
|
1601
|
+
const authMethods = integration.authMethods ?? [];
|
|
1602
|
+
const methods = CONNECT_AUTH_METHODS.filter(
|
|
1603
|
+
(method) => authMethods.includes(method)
|
|
1604
|
+
);
|
|
1605
|
+
return methods.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MultiMethodConnectButton, { integration, methods }) : methods.length === 1 && methods[0] === "api_key" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ApiKeyConnectButton, { integration }) : methods.length === 1 && methods[0] === "client_credentials" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ClientCredentialsConnectButton, { integration }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConnectIntegrationButton, { integration });
|
|
1606
|
+
}
|
|
1607
|
+
const connected = integration.installation.state === "connected";
|
|
1608
|
+
const isApiKeyInstallation = integration.installation.auth_method === "api_key";
|
|
1609
|
+
const isClientCredentialsInstallation = integration.installation.auth_method === "client_credentials";
|
|
1610
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
1611
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1612
|
+
DisconnectAccountDialog,
|
|
1613
|
+
{
|
|
1614
|
+
integrationName: integration.name,
|
|
1615
|
+
installationId: integration.installation.id,
|
|
1616
|
+
open: disconnectOpen,
|
|
1617
|
+
onOpenChange: setDisconnectOpen
|
|
1618
|
+
}
|
|
1619
|
+
),
|
|
1620
|
+
apiKeyOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1621
|
+
ApiKeyDialog,
|
|
1622
|
+
{
|
|
1623
|
+
integration,
|
|
1624
|
+
open: apiKeyOpen,
|
|
1625
|
+
onOpenChange: setApiKeyOpen
|
|
1626
|
+
}
|
|
1627
|
+
),
|
|
1628
|
+
clientCredentialsOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1629
|
+
ClientCredentialsDialog,
|
|
1630
|
+
{
|
|
1631
|
+
integration,
|
|
1632
|
+
fields: unpinnedFields,
|
|
1633
|
+
open: clientCredentialsOpen,
|
|
1634
|
+
onOpenChange: setClientCredentialsOpen
|
|
1635
|
+
}
|
|
1636
|
+
),
|
|
1637
|
+
unpinnedFields.length > 0 && !isClientCredentialsInstallation && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1638
|
+
ConnectDialog,
|
|
1639
|
+
{
|
|
1640
|
+
integration,
|
|
1641
|
+
fields: unpinnedFields,
|
|
1642
|
+
open: reauthConfigOpen,
|
|
1643
|
+
onOpenChange: setReauthConfigOpen
|
|
1644
|
+
}
|
|
1645
|
+
),
|
|
1646
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_themes.Flex, { align: "center", gap: "4", children: [
|
|
1647
|
+
!connected && (isApiKeyInstallation ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_elements.Button, { variant: "secondary", onClick: () => setApiKeyOpen(true), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1648
|
+
import_translation.Translation,
|
|
1649
|
+
{
|
|
1650
|
+
defaultMessage: "Update key",
|
|
1651
|
+
id: "MP-aOE",
|
|
1652
|
+
description: "Button to replace the API key of a connection that stopped working"
|
|
1653
|
+
}
|
|
1654
|
+
) }) : isClientCredentialsInstallation ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1655
|
+
import_elements.Button,
|
|
1656
|
+
{
|
|
1657
|
+
variant: "secondary",
|
|
1658
|
+
onClick: () => setClientCredentialsOpen(true),
|
|
1659
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1660
|
+
import_translation.Translation,
|
|
1661
|
+
{
|
|
1662
|
+
defaultMessage: "Update credentials",
|
|
1663
|
+
id: "1inB3Y",
|
|
1664
|
+
description: "Button to update the client credentials of a connection that stopped working"
|
|
1665
|
+
}
|
|
1666
|
+
)
|
|
1667
|
+
}
|
|
1668
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1669
|
+
import_elements.Button,
|
|
1670
|
+
{
|
|
1671
|
+
variant: "secondary",
|
|
1672
|
+
onClick: async () => {
|
|
1673
|
+
if (unpinnedFields.length > 0) {
|
|
1674
|
+
setReauthConfigOpen(true);
|
|
1675
|
+
return;
|
|
1676
|
+
}
|
|
1677
|
+
try {
|
|
1678
|
+
await authorizeEventHandler();
|
|
1679
|
+
} catch {
|
|
1680
|
+
}
|
|
1681
|
+
},
|
|
1682
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1683
|
+
import_translation.Translation,
|
|
1684
|
+
{
|
|
1685
|
+
defaultMessage: "Reauthorize",
|
|
1686
|
+
id: "3IbiTG",
|
|
1687
|
+
description: "Button to reauthorize a connection that stopped working"
|
|
1688
|
+
}
|
|
1689
|
+
)
|
|
1690
|
+
}
|
|
1691
|
+
)),
|
|
1692
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_elements.DropdownMenu.Root, { children: [
|
|
1693
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_elements.DropdownMenu.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_elements.IconButton, { title: pipeActionsTitle, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_icons.DotsHorizontalIcon, {}) }) }),
|
|
1694
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_elements.DropdownMenu.Content, { align: "end", children: [
|
|
1695
|
+
connected && isApiKeyInstallation && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_elements.DropdownMenu.Item, { onClick: () => setApiKeyOpen(true), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1696
|
+
import_translation.Translation,
|
|
1697
|
+
{
|
|
1698
|
+
defaultMessage: "Rotate API key",
|
|
1699
|
+
id: "GML+c8",
|
|
1700
|
+
description: "Menu option to rotate the API key"
|
|
1701
|
+
}
|
|
1702
|
+
) }),
|
|
1703
|
+
connected && isClientCredentialsInstallation && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_elements.DropdownMenu.Item, { onClick: () => setClientCredentialsOpen(true), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1704
|
+
import_translation.Translation,
|
|
1705
|
+
{
|
|
1706
|
+
defaultMessage: "Update client credentials",
|
|
1707
|
+
id: "daHKWE",
|
|
1708
|
+
description: "Menu option to update stored client credentials"
|
|
1709
|
+
}
|
|
1710
|
+
) }),
|
|
1711
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1712
|
+
import_elements.DropdownMenu.Item,
|
|
1713
|
+
{
|
|
1714
|
+
variant: "destructive",
|
|
1715
|
+
onClick: () => setDisconnectOpen(true),
|
|
1716
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1717
|
+
import_translation.Translation,
|
|
1718
|
+
{
|
|
1719
|
+
defaultMessage: "Disconnect account",
|
|
1720
|
+
id: "esZQrd",
|
|
1721
|
+
description: "Menu option to disconnect an account"
|
|
1722
|
+
}
|
|
1723
|
+
)
|
|
1724
|
+
}
|
|
1725
|
+
)
|
|
1726
|
+
] })
|
|
1727
|
+
] })
|
|
1728
|
+
] })
|
|
1729
|
+
] });
|
|
1730
|
+
}
|
|
1731
|
+
function MemberConnectionItems({
|
|
1732
|
+
integrations
|
|
1733
|
+
}) {
|
|
1734
|
+
return integrations.map((integration) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1735
|
+
SectionedItem,
|
|
1736
|
+
{
|
|
1737
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_data_integration_icon.DataIntegrationIcon, { integration, size: "2" }),
|
|
1738
|
+
name: integration.name,
|
|
1739
|
+
status: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MemberConnectionStatus, { integration }),
|
|
1740
|
+
description: integration.description,
|
|
1741
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MemberConnectionActions, { integration })
|
|
1742
|
+
},
|
|
1743
|
+
integration.id
|
|
1744
|
+
));
|
|
1745
|
+
}
|
|
1746
|
+
function PipesSection({
|
|
1747
|
+
title,
|
|
1748
|
+
description,
|
|
1749
|
+
children
|
|
1750
|
+
}) {
|
|
1751
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_themes.Flex, { direction: "column", gap: "3", children: [
|
|
1752
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_themes.Flex, { direction: "column", gap: "1", children: [
|
|
1753
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_themes.Text, { size: "3", weight: "bold", children: title }),
|
|
1754
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_themes.Text, { size: "2", color: "gray", children: description })
|
|
1755
|
+
] }),
|
|
1756
|
+
children
|
|
1757
|
+
] });
|
|
1758
|
+
}
|
|
1759
|
+
const PipesSections = ({
|
|
1760
|
+
integrations,
|
|
1761
|
+
hasUnfilteredIntegrations,
|
|
1762
|
+
sharedConnections,
|
|
1763
|
+
hasUnfilteredSharedConnections,
|
|
1764
|
+
isSharedLoading,
|
|
1765
|
+
organizationName,
|
|
1766
|
+
...domProps
|
|
1767
|
+
}) => {
|
|
1768
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1769
|
+
import_themes.Flex,
|
|
1770
|
+
{
|
|
1771
|
+
direction: "column",
|
|
1772
|
+
gap: "5",
|
|
1773
|
+
...getWidgetRootDomProps("resolved", domProps),
|
|
1774
|
+
children: [
|
|
1775
|
+
(isSharedLoading || sharedConnections.length > 0 || hasUnfilteredSharedConnections) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1776
|
+
PipesSection,
|
|
1777
|
+
{
|
|
1778
|
+
title: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1779
|
+
import_translation.Translation,
|
|
1780
|
+
{
|
|
1781
|
+
defaultMessage: "Shared connections",
|
|
1782
|
+
id: "Fcd-bK",
|
|
1783
|
+
description: "Heading for the section listing connections the organization owns"
|
|
1784
|
+
}
|
|
1785
|
+
),
|
|
1786
|
+
description: organizationName ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1787
|
+
import_translation.Translation,
|
|
1788
|
+
{
|
|
1789
|
+
defaultMessage: "Accounts {organizationName} owns and shares with everyone.",
|
|
1790
|
+
id: "7U8P0v",
|
|
1791
|
+
description: "Description of the shared connections section, naming the organization",
|
|
1792
|
+
values: { organizationName }
|
|
1793
|
+
}
|
|
1794
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1795
|
+
import_translation.Translation,
|
|
1796
|
+
{
|
|
1797
|
+
defaultMessage: "Accounts your organization owns and shares with everyone.",
|
|
1798
|
+
id: "72FEZi",
|
|
1799
|
+
description: "Description of the shared connections section when the organization name is unknown"
|
|
1800
|
+
}
|
|
1801
|
+
),
|
|
1802
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CardList.Root, { children: isSharedLoading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PipesSkeletonItems, { count: 2 }) : sharedConnections.length > 0 ? sharedConnections.map((connection) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1803
|
+
SharedConnectionItem,
|
|
1804
|
+
{
|
|
1805
|
+
connection
|
|
1806
|
+
},
|
|
1807
|
+
connection.id
|
|
1808
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PipesEmptyItem, { isFiltered: true }) })
|
|
1809
|
+
}
|
|
1810
|
+
),
|
|
1811
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1812
|
+
PipesSection,
|
|
1813
|
+
{
|
|
1814
|
+
title: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1815
|
+
import_translation.Translation,
|
|
1816
|
+
{
|
|
1817
|
+
defaultMessage: "Your connections",
|
|
1818
|
+
id: "-VDI3G",
|
|
1819
|
+
description: "Heading for the section listing the member's own connections"
|
|
1820
|
+
}
|
|
1821
|
+
),
|
|
1822
|
+
description: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1823
|
+
import_translation.Translation,
|
|
1824
|
+
{
|
|
1825
|
+
defaultMessage: "Connect your account to access these connections.",
|
|
1826
|
+
id: "ObXqUu",
|
|
1827
|
+
description: "Description of the personal connections section"
|
|
1828
|
+
}
|
|
1829
|
+
),
|
|
1830
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CardList.Root, { children: integrations.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MemberConnectionItems, { integrations }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PipesEmptyItem, { isFiltered: hasUnfilteredIntegrations ?? false }) })
|
|
1831
|
+
}
|
|
1832
|
+
)
|
|
1833
|
+
]
|
|
1834
|
+
}
|
|
1835
|
+
);
|
|
1405
1836
|
};
|
|
1406
1837
|
const PipesError = ({ error, ...domProps }) => {
|
|
1407
1838
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_themes.Card, { size: "2", ...getWidgetRootDomProps("error", domProps), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_generic_error.GenericError, { error }) });
|
|
@@ -1416,8 +1847,16 @@ function getWidgetRootDomProps(state, domProps) {
|
|
|
1416
1847
|
}
|
|
1417
1848
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1418
1849
|
0 && (module.exports = {
|
|
1850
|
+
ApiKeyDialog,
|
|
1851
|
+
ClientCredentialsDialog,
|
|
1852
|
+
ConnectDialog,
|
|
1419
1853
|
Pipes,
|
|
1854
|
+
PipesEmptyItem,
|
|
1420
1855
|
PipesError,
|
|
1421
|
-
PipesLoading
|
|
1856
|
+
PipesLoading,
|
|
1857
|
+
PipesSection,
|
|
1858
|
+
PipesSections,
|
|
1859
|
+
getUnpinnedInstallationFields,
|
|
1860
|
+
useOpenDataIntegrationAuthorizeUrl
|
|
1422
1861
|
});
|
|
1423
1862
|
//# sourceMappingURL=pipes.cjs.map
|