@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.
Files changed (36) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs/index.d.cts +2 -2
  4. package/dist/cjs/lib/pipes-admin.cjs +589 -23
  5. package/dist/cjs/lib/pipes-admin.cjs.map +1 -1
  6. package/dist/cjs/lib/pipes-admin.d.cts +39 -3
  7. package/dist/cjs/lib/pipes.cjs +477 -38
  8. package/dist/cjs/lib/pipes.cjs.map +1 -1
  9. package/dist/cjs/lib/pipes.d.cts +114 -3
  10. package/dist/cjs/lib/status.cjs +2 -0
  11. package/dist/cjs/lib/status.cjs.map +1 -1
  12. package/dist/cjs/lib/status.d.cts +2 -2
  13. package/dist/cjs/pipes-admin.client.cjs +45 -3
  14. package/dist/cjs/pipes-admin.client.cjs.map +1 -1
  15. package/dist/cjs/pipes-admin.client.d.cts +13 -0
  16. package/dist/cjs/pipes.client.cjs +70 -9
  17. package/dist/cjs/pipes.client.cjs.map +1 -1
  18. package/dist/cjs/pipes.client.d.cts +84 -29
  19. package/dist/esm/index.d.ts +2 -2
  20. package/dist/esm/index.js.map +1 -1
  21. package/dist/esm/lib/pipes-admin.d.ts +39 -3
  22. package/dist/esm/lib/pipes-admin.js +608 -25
  23. package/dist/esm/lib/pipes-admin.js.map +1 -1
  24. package/dist/esm/lib/pipes.d.ts +114 -3
  25. package/dist/esm/lib/pipes.js +474 -38
  26. package/dist/esm/lib/pipes.js.map +1 -1
  27. package/dist/esm/lib/status.d.ts +2 -2
  28. package/dist/esm/lib/status.js +2 -0
  29. package/dist/esm/lib/status.js.map +1 -1
  30. package/dist/esm/pipes-admin.client.d.ts +13 -0
  31. package/dist/esm/pipes-admin.client.js +48 -4
  32. package/dist/esm/pipes-admin.client.js.map +1 -1
  33. package/dist/esm/pipes.client.d.ts +84 -29
  34. package/dist/esm/pipes.client.js +76 -10
  35. package/dist/esm/pipes.client.js.map +1 -1
  36. package/package.json +1 -1
@@ -1,15 +1,22 @@
1
1
  "use client";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import { Callout, Card, Flex, Switch, Text, Tooltip } from "@radix-ui/themes";
4
- import { useState } from "react";
5
- import { InfoCircledIcon } from "@radix-ui/react-icons";
4
+ import { useEffect, useState } from "react";
5
+ import {
6
+ DotsHorizontalIcon,
7
+ ExternalLinkIcon,
8
+ InfoCircledIcon
9
+ } from "@radix-ui/react-icons";
6
10
  import * as CardList from "./card-list.js";
7
11
  import { CopyText } from "./copy-text.js";
8
12
  import { DataIntegrationIcon } from "./data-integration-icon.js";
9
13
  import { ProviderIcon } from "./provider-icon.js";
10
14
  import {
15
+ AlertDialog,
11
16
  Button,
12
17
  Dialog,
18
+ DropdownMenu,
19
+ IconButton,
13
20
  Label,
14
21
  PasswordField,
15
22
  Skeleton,
@@ -21,11 +28,24 @@ import { Status } from "./status.js";
21
28
  import {
22
29
  getListDataIntegrationConfigurationsQueryKey,
23
30
  getMyDataIntegrationsQueryKey,
31
+ getOrganizationDataIntegrationsQueryKey,
32
+ getSharedDataConnectionsQueryKey,
33
+ useDeleteOrganizationDataInstallation,
24
34
  useListDataIntegrationConfigurations,
25
- useUpsertDataIntegrationConfiguration
35
+ useOrganizationDataIntegrations,
36
+ useUpsertDataIntegrationConfiguration,
37
+ useUpsertOrganizationDataIntegrationConfiguration
26
38
  } from "../api/endpoint.js";
27
39
  import { useQueryClient } from "@tanstack/react-query";
28
40
  import { GenericError } from "./generic-error.js";
41
+ import {
42
+ ApiKeyDialog,
43
+ ClientCredentialsDialog,
44
+ ConnectDialog,
45
+ PipesEmptyItem,
46
+ PipesSection,
47
+ getUnpinnedInstallationFields
48
+ } from "./pipes.js";
29
49
  import { usePermissions } from "./use-permissions.js";
30
50
  import { getDomProps } from "./utils.js";
31
51
  import { Translation } from "./i18n/translation.js";
@@ -50,12 +70,42 @@ function RedirectUriField({ value }) {
50
70
  /* @__PURE__ */ jsx(CopyText, { value, label: copyLabel })
51
71
  ] });
52
72
  }
73
+ function useUpsertConfiguration(owner, onSuccess) {
74
+ const queryClient = useQueryClient();
75
+ const user = useUpsertDataIntegrationConfiguration({
76
+ mutation: {
77
+ onSuccess: () => {
78
+ queryClient.invalidateQueries({
79
+ queryKey: getListDataIntegrationConfigurationsQueryKey()
80
+ });
81
+ queryClient.invalidateQueries({
82
+ queryKey: getMyDataIntegrationsQueryKey()
83
+ });
84
+ onSuccess();
85
+ }
86
+ }
87
+ });
88
+ const organization = useUpsertOrganizationDataIntegrationConfiguration({
89
+ mutation: {
90
+ onSuccess: () => {
91
+ queryClient.invalidateQueries({
92
+ queryKey: getOrganizationDataIntegrationsQueryKey()
93
+ });
94
+ queryClient.invalidateQueries({
95
+ queryKey: getSharedDataConnectionsQueryKey()
96
+ });
97
+ onSuccess();
98
+ }
99
+ }
100
+ });
101
+ return owner === "organization" ? organization : user;
102
+ }
53
103
  function OrgCredentialsDialog({
54
104
  integration,
55
105
  open,
56
- onOpenChange
106
+ onOpenChange,
107
+ owner = "user"
57
108
  }) {
58
- const queryClient = useQueryClient();
59
109
  const credentials = integration.credentials;
60
110
  const hasCredentials = credentials.hasCredentials;
61
111
  const isOrgCredentials = credentials.credentialsType === "organization";
@@ -89,19 +139,7 @@ function OrgCredentialsDialog({
89
139
  mutate: upsertOverride,
90
140
  error,
91
141
  isPending
92
- } = useUpsertDataIntegrationConfiguration({
93
- mutation: {
94
- onSuccess: () => {
95
- queryClient.invalidateQueries({
96
- queryKey: getListDataIntegrationConfigurationsQueryKey()
97
- });
98
- queryClient.invalidateQueries({
99
- queryKey: getMyDataIntegrationsQueryKey()
100
- });
101
- onOpenChange(false);
102
- }
103
- }
104
- });
142
+ } = useUpsertConfiguration(owner, () => onOpenChange(false));
105
143
  const translate = useTranslation();
106
144
  const defaultScopes = integration.defaultScopes;
107
145
  const effectiveScopes = integration.scopes ?? [];
@@ -621,6 +659,459 @@ function useManageableIntegrations() {
621
659
  error: null
622
660
  };
623
661
  }
662
+ function useOrganizationOwnedIntegrations() {
663
+ const permission = usePermissions("widgets:pipes:manage");
664
+ const organization = useOrganizationDataIntegrations({
665
+ query: { enabled: permission.isSuccess }
666
+ });
667
+ if (organization.isSuccess) {
668
+ return { data: organization.data.data, isLoading: false };
669
+ }
670
+ return {
671
+ data: [],
672
+ isLoading: permission.isLoading || permission.isSuccess && organization.isPending && organization.failureCount === 0
673
+ };
674
+ }
675
+ function toConfigurableIntegration(integration) {
676
+ const { configuration } = integration;
677
+ return {
678
+ name: integration.name,
679
+ description: integration.description,
680
+ slug: integration.slug,
681
+ authMethods: integration.authMethods ?? ["oauth"],
682
+ enabled: configuration.enabled,
683
+ scopes: configuration.scopes,
684
+ defaultScopes: configuration.defaultScopes,
685
+ availableScopes: configuration.availableScopes,
686
+ credentials: configuration.credentials,
687
+ configFields: configuration.configFields,
688
+ config: configuration.config
689
+ };
690
+ }
691
+ function DisconnectSharedConnectionDialog({
692
+ integrationName,
693
+ installationId,
694
+ open,
695
+ onOpenChange
696
+ }) {
697
+ const queryClient = useQueryClient();
698
+ const {
699
+ mutate: deleteInstallation,
700
+ error,
701
+ reset,
702
+ isPending
703
+ } = useDeleteOrganizationDataInstallation({
704
+ mutation: {
705
+ onSuccess: () => {
706
+ onOpenChange(false);
707
+ queryClient.invalidateQueries({
708
+ queryKey: getOrganizationDataIntegrationsQueryKey()
709
+ });
710
+ queryClient.invalidateQueries({
711
+ queryKey: getSharedDataConnectionsQueryKey()
712
+ });
713
+ }
714
+ }
715
+ });
716
+ useEffect(() => {
717
+ if (open) {
718
+ reset();
719
+ }
720
+ }, [open, reset]);
721
+ return /* @__PURE__ */ jsx(AlertDialog.Root, { open, onOpenChange, children: /* @__PURE__ */ jsxs(AlertDialog.Content, { style: { width: "80vw", maxWidth: "520px" }, children: [
722
+ /* @__PURE__ */ jsx(AlertDialog.Title, { children: /* @__PURE__ */ jsx(
723
+ Translation,
724
+ {
725
+ defaultMessage: "Disconnect shared connection",
726
+ id: "Xy5Xq1",
727
+ description: "Dialog title for disconnecting an organization-owned connection"
728
+ }
729
+ ) }),
730
+ error && /* @__PURE__ */ jsx(Callout.Root, { my: "5", color: "red", role: "alert", children: /* @__PURE__ */ jsx(Callout.Text, { children: /* @__PURE__ */ jsx(
731
+ Translation,
732
+ {
733
+ defaultMessage: "An error occurred while disconnecting this connection. Please refresh the page and try again.",
734
+ id: "q0Yb2E",
735
+ description: "Error message when disconnecting an organization-owned connection fails"
736
+ }
737
+ ) }) }),
738
+ /* @__PURE__ */ jsx(AlertDialog.Description, { children: /* @__PURE__ */ jsx(
739
+ Translation,
740
+ {
741
+ defaultMessage: "Are you sure you want to disconnect the {integrationName} account your organization shares with everyone? Members will lose access to it.",
742
+ id: "mS2v8L",
743
+ description: "Confirmation message for disconnecting an organization-owned connection",
744
+ values: {
745
+ integrationName: /* @__PURE__ */ jsx(Text, { as: "span", weight: "bold", children: integrationName })
746
+ }
747
+ }
748
+ ) }),
749
+ /* @__PURE__ */ jsxs(Flex, { gap: "3", justify: "end", mt: "5", children: [
750
+ /* @__PURE__ */ jsx(AlertDialog.Cancel, { children: /* @__PURE__ */ jsx(Button, { variant: "secondary", children: /* @__PURE__ */ jsx(
751
+ Translation,
752
+ {
753
+ defaultMessage: "Cancel",
754
+ id: "hHNj31",
755
+ description: "Cancel button text"
756
+ }
757
+ ) }) }),
758
+ /* @__PURE__ */ jsx(
759
+ Button,
760
+ {
761
+ variant: "destructive",
762
+ disabled: isPending,
763
+ loading: isPending,
764
+ onClick: () => deleteInstallation({ installationId }),
765
+ children: /* @__PURE__ */ jsx(
766
+ Translation,
767
+ {
768
+ defaultMessage: "Disconnect",
769
+ id: "vMVXQh",
770
+ description: "Button to disconnect an account"
771
+ }
772
+ )
773
+ }
774
+ )
775
+ ] })
776
+ ] }) });
777
+ }
778
+ function AdminRow({
779
+ integration,
780
+ status,
781
+ description = integration.description,
782
+ dimmed = false,
783
+ actions
784
+ }) {
785
+ const translate = useTranslation();
786
+ const actionsTitle = translate({
787
+ defaultMessage: "More actions",
788
+ id: "eR4kYp",
789
+ description: "Accessible title for a provider row's overflow actions menu"
790
+ });
791
+ const promoted = actions.find((action) => action.promoted);
792
+ const overflow = actions.filter((action) => action !== promoted);
793
+ return /* @__PURE__ */ jsx(CardList.Item, { children: /* @__PURE__ */ jsxs(Flex, { direction: "row", justify: "between", align: "center", gap: "4", children: [
794
+ /* @__PURE__ */ jsxs(Flex, { gap: "4", align: "center", style: dimmed ? { opacity: 0.6 } : {}, children: [
795
+ /* @__PURE__ */ jsx(IconPanel, { color: "panel", children: /* @__PURE__ */ jsx(DataIntegrationIcon, { integration, size: "2" }) }),
796
+ /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "1", children: [
797
+ /* @__PURE__ */ jsxs(Flex, { align: "center", gap: "2", wrap: "wrap", children: [
798
+ /* @__PURE__ */ jsx(Text, { size: "2", weight: "bold", color: dimmed ? "gray" : void 0, children: integration.name }),
799
+ status
800
+ ] }),
801
+ description && /* @__PURE__ */ jsx(Text, { size: "2", color: "gray", children: description })
802
+ ] })
803
+ ] }),
804
+ (promoted || overflow.length > 0) && /* @__PURE__ */ jsxs(Flex, { align: "center", gap: "2", flexShrink: "0", children: [
805
+ promoted && /* @__PURE__ */ jsx(
806
+ Button,
807
+ {
808
+ variant: promoted.destructive ? "destructive" : "secondary",
809
+ onClick: promoted.onSelect,
810
+ children: promoted.label
811
+ }
812
+ ),
813
+ overflow.length > 0 && /* @__PURE__ */ jsxs(DropdownMenu.Root, { children: [
814
+ /* @__PURE__ */ jsx(DropdownMenu.Trigger, { children: /* @__PURE__ */ jsx(IconButton, { title: actionsTitle, children: /* @__PURE__ */ jsx(DotsHorizontalIcon, {}) }) }),
815
+ /* @__PURE__ */ jsx(DropdownMenu.Content, { align: "end", children: overflow.map((action) => /* @__PURE__ */ jsx(
816
+ DropdownMenu.Item,
817
+ {
818
+ variant: action.destructive ? "destructive" : void 0,
819
+ onClick: action.onSelect,
820
+ children: action.external ? /* @__PURE__ */ jsxs(
821
+ Flex,
822
+ {
823
+ gap: "4",
824
+ width: "100%",
825
+ justify: "between",
826
+ align: "center",
827
+ children: [
828
+ action.label,
829
+ /* @__PURE__ */ jsx(ExternalLinkIcon, { "aria-hidden": true })
830
+ ]
831
+ }
832
+ ) : action.label
833
+ },
834
+ action.key
835
+ )) })
836
+ ] })
837
+ ] })
838
+ ] }) });
839
+ }
840
+ function ConnectedViaStatus({
841
+ method
842
+ }) {
843
+ return /* @__PURE__ */ jsx(Status, { state: "success", children: method === "api_key" ? /* @__PURE__ */ jsx(
844
+ Translation,
845
+ {
846
+ defaultMessage: "Connected via API key",
847
+ id: "jQLTNe",
848
+ description: "Status text for a connection established with an API key"
849
+ }
850
+ ) : method === "client_credentials" ? /* @__PURE__ */ jsx(
851
+ Translation,
852
+ {
853
+ defaultMessage: "Connected via client credentials",
854
+ id: "hQKIrx",
855
+ description: "Status text for a connection established with client credentials"
856
+ }
857
+ ) : /* @__PURE__ */ jsx(
858
+ Translation,
859
+ {
860
+ defaultMessage: "Connected via OAuth",
861
+ id: "pJcK_M",
862
+ description: "Status text for a connection established with OAuth"
863
+ }
864
+ ) });
865
+ }
866
+ function DisabledForOrganizationStatus() {
867
+ return /* @__PURE__ */ jsx(Status, { state: "neutral", children: /* @__PURE__ */ jsx(
868
+ Translation,
869
+ {
870
+ defaultMessage: "Disabled for your organization",
871
+ id: "uH2sNc",
872
+ description: "Status for a provider the organization has disabled"
873
+ }
874
+ ) });
875
+ }
876
+ function SharedConnectionAdminStatus({
877
+ integration,
878
+ method
879
+ }) {
880
+ const { configuration } = integration;
881
+ const account = integration.connected_accounts[0];
882
+ if (!configuration.enabled) {
883
+ return configuration.disabledSource === "developer" ? /* @__PURE__ */ jsx(Status, { state: "neutral", children: /* @__PURE__ */ jsx(
884
+ Translation,
885
+ {
886
+ defaultMessage: "Disabled by developer",
887
+ id: "k2Jd9W",
888
+ description: "Status text for a shared connection the developer has disabled"
889
+ }
890
+ ) }) : /* @__PURE__ */ jsx(DisabledForOrganizationStatus, {});
891
+ }
892
+ if (!account) {
893
+ return null;
894
+ }
895
+ return account.state === "connected" ? /* @__PURE__ */ jsx(ConnectedViaStatus, { method }) : /* @__PURE__ */ jsx(Status, { state: "warning", children: /* @__PURE__ */ jsx(
896
+ Translation,
897
+ {
898
+ defaultMessage: "Needs attention",
899
+ id: "pL5wGd",
900
+ description: "Status for a shared connection that stopped working and needs the admin to fix it"
901
+ }
902
+ ) });
903
+ }
904
+ function SharedConnectionAdminItem({
905
+ integration
906
+ }) {
907
+ const [configureOpen, setConfigureOpen] = useState(false);
908
+ const [connectOpen, setConnectOpen] = useState(false);
909
+ const [disconnectOpen, setDisconnectOpen] = useState(false);
910
+ const { capabilities, configuration } = integration;
911
+ const account = integration.connected_accounts[0];
912
+ const authMethods = integration.authMethods ?? [];
913
+ const method = account?.auth_method ?? (authMethods.includes("oauth") && configuration.configured ? "oauth" : authMethods.includes("client_credentials") ? "client_credentials" : authMethods.includes("api_key") ? "api_key" : "oauth");
914
+ const needsAttention = account !== void 0 && account.state !== "connected";
915
+ const showConnect = account ? method === "oauth" ? capabilities.canReauthorize : capabilities.canUpdateCredentials : capabilities.canConnect;
916
+ const showDisconnect = account !== void 0 && capabilities.canDisconnect;
917
+ const connectLabel = !account ? /* @__PURE__ */ jsx(
918
+ Translation,
919
+ {
920
+ defaultMessage: "Connect",
921
+ id: "quvdFp",
922
+ description: "Button to connect an integration"
923
+ }
924
+ ) : method === "api_key" ? needsAttention ? /* @__PURE__ */ jsx(
925
+ Translation,
926
+ {
927
+ defaultMessage: "Update API key",
928
+ id: "E7pMj/",
929
+ description: "Menu option to update the API key for a needs-reauthorization installation"
930
+ }
931
+ ) : /* @__PURE__ */ jsx(
932
+ Translation,
933
+ {
934
+ defaultMessage: "Rotate API key",
935
+ id: "kR7pQz",
936
+ description: "Menu option to rotate an organization-owned API key"
937
+ }
938
+ ) : method === "client_credentials" ? /* @__PURE__ */ jsx(
939
+ Translation,
940
+ {
941
+ defaultMessage: "Update client credentials",
942
+ id: "vB8dLq",
943
+ description: "Menu option to update an organization-owned integration's client credentials"
944
+ }
945
+ ) : /* @__PURE__ */ jsx(
946
+ Translation,
947
+ {
948
+ defaultMessage: "Reauthorize",
949
+ id: "0E29F1",
950
+ description: "Menu option to reauthorize an integration",
951
+ trailingSpace: true
952
+ }
953
+ );
954
+ const actions = [];
955
+ if (showConnect) {
956
+ actions.push({
957
+ key: "connect",
958
+ label: connectLabel,
959
+ onSelect: () => setConnectOpen(true),
960
+ promoted: !account || needsAttention,
961
+ external: method === "oauth"
962
+ });
963
+ }
964
+ if (capabilities.canConfigure) {
965
+ actions.push({
966
+ key: "configure",
967
+ label: /* @__PURE__ */ jsx(
968
+ Translation,
969
+ {
970
+ defaultMessage: "Configure",
971
+ id: "ADidi3",
972
+ description: "Button to configure organization credentials"
973
+ }
974
+ ),
975
+ onSelect: () => setConfigureOpen(true),
976
+ promoted: !account && !showConnect && configuration.enabled
977
+ });
978
+ }
979
+ if (showDisconnect) {
980
+ actions.push({
981
+ key: "disconnect",
982
+ label: /* @__PURE__ */ jsx(
983
+ Translation,
984
+ {
985
+ defaultMessage: "Disconnect",
986
+ id: "vMVXQh",
987
+ description: "Button to disconnect an account"
988
+ }
989
+ ),
990
+ onSelect: () => setDisconnectOpen(true),
991
+ destructive: true
992
+ });
993
+ }
994
+ const needsOrganizationCredentials = configuration.enabled && !account && configuration.credentials.credentialsType === "organization" && !configuration.configured;
995
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
996
+ configureOpen && /* @__PURE__ */ jsx(
997
+ OrgCredentialsDialog,
998
+ {
999
+ integration: toConfigurableIntegration(integration),
1000
+ owner: "organization",
1001
+ open: configureOpen,
1002
+ onOpenChange: setConfigureOpen
1003
+ }
1004
+ ),
1005
+ method === "api_key" ? connectOpen && /* @__PURE__ */ jsx(
1006
+ ApiKeyDialog,
1007
+ {
1008
+ integration,
1009
+ installation: account,
1010
+ owner: "organization",
1011
+ open: connectOpen,
1012
+ onOpenChange: setConnectOpen
1013
+ }
1014
+ ) : method === "client_credentials" ? connectOpen && /* @__PURE__ */ jsx(
1015
+ ClientCredentialsDialog,
1016
+ {
1017
+ integration,
1018
+ installation: account,
1019
+ fields: getUnpinnedInstallationFields(integration),
1020
+ owner: "organization",
1021
+ open: connectOpen,
1022
+ onOpenChange: setConnectOpen
1023
+ }
1024
+ ) : /* @__PURE__ */ jsx(
1025
+ ConnectDialog,
1026
+ {
1027
+ integration,
1028
+ fields: getUnpinnedInstallationFields(integration),
1029
+ owner: "organization",
1030
+ open: connectOpen,
1031
+ onOpenChange: setConnectOpen
1032
+ }
1033
+ ),
1034
+ account && /* @__PURE__ */ jsx(
1035
+ DisconnectSharedConnectionDialog,
1036
+ {
1037
+ integrationName: integration.name,
1038
+ installationId: account.id,
1039
+ open: disconnectOpen,
1040
+ onOpenChange: setDisconnectOpen
1041
+ }
1042
+ ),
1043
+ /* @__PURE__ */ jsx(
1044
+ AdminRow,
1045
+ {
1046
+ integration,
1047
+ status: /* @__PURE__ */ jsx(
1048
+ SharedConnectionAdminStatus,
1049
+ {
1050
+ integration,
1051
+ method
1052
+ }
1053
+ ),
1054
+ description: needsOrganizationCredentials ? /* @__PURE__ */ jsx(
1055
+ Translation,
1056
+ {
1057
+ defaultMessage: "Enter your organization's OAuth client to make this connectable.",
1058
+ id: "rQ8mVz",
1059
+ description: "Second line of a shared connection row whose organization OAuth credentials have not been entered yet"
1060
+ }
1061
+ ) : integration.description,
1062
+ dimmed: !configuration.enabled,
1063
+ actions
1064
+ }
1065
+ )
1066
+ ] });
1067
+ }
1068
+ function ProviderSettingsItem({
1069
+ integration
1070
+ }) {
1071
+ const [configureOpen, setConfigureOpen] = useState(false);
1072
+ const available = isIntegrationAvailable(integration);
1073
+ const dimmed = !integration.enabled;
1074
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1075
+ configureOpen && /* @__PURE__ */ jsx(
1076
+ OrgCredentialsDialog,
1077
+ {
1078
+ integration,
1079
+ open: configureOpen,
1080
+ onOpenChange: setConfigureOpen
1081
+ }
1082
+ ),
1083
+ /* @__PURE__ */ jsx(
1084
+ AdminRow,
1085
+ {
1086
+ integration,
1087
+ status: !integration.enabled ? /* @__PURE__ */ jsx(DisabledForOrganizationStatus, {}) : !available ? /* @__PURE__ */ jsx(Status, { state: "neutral", children: /* @__PURE__ */ jsx(
1088
+ Translation,
1089
+ {
1090
+ defaultMessage: "Not configured",
1091
+ id: "gV7bXe",
1092
+ description: "Status for a provider whose organization credentials have not been entered yet"
1093
+ }
1094
+ ) }) : null,
1095
+ dimmed,
1096
+ actions: [
1097
+ {
1098
+ key: "configure",
1099
+ label: /* @__PURE__ */ jsx(
1100
+ Translation,
1101
+ {
1102
+ defaultMessage: "Configure",
1103
+ id: "ADidi3",
1104
+ description: "Button to configure organization credentials"
1105
+ }
1106
+ ),
1107
+ onSelect: () => setConfigureOpen(true),
1108
+ promoted: true
1109
+ }
1110
+ ]
1111
+ }
1112
+ )
1113
+ ] });
1114
+ }
624
1115
  function isIntegrationAvailable(integration) {
625
1116
  if (!(integration.authMethods ?? ["oauth"]).includes("oauth")) {
626
1117
  return integration.enabled;
@@ -643,7 +1134,12 @@ const PipesAdmin = ({
643
1134
  integrations,
644
1135
  ...domProps
645
1136
  }) => {
646
- return /* @__PURE__ */ jsx(CardList.Root, { ...getWidgetRootDomProps("resolved", domProps), children: integrations.map((integration) => {
1137
+ return /* @__PURE__ */ jsx(CardList.Root, { ...getWidgetRootDomProps("resolved", domProps), children: /* @__PURE__ */ jsx(PipesAdminItems, { integrations }) });
1138
+ };
1139
+ function PipesAdminItems({
1140
+ integrations
1141
+ }) {
1142
+ return /* @__PURE__ */ jsx(Fragment, { children: integrations.map((integration) => {
647
1143
  const available = isIntegrationAvailable(integration);
648
1144
  return /* @__PURE__ */ jsx(CardList.Item, { children: /* @__PURE__ */ jsxs(Flex, { direction: "row", justify: "between", align: "center", gap: "2", children: [
649
1145
  /* @__PURE__ */ jsxs(Flex, { gap: "4", align: "center", children: [
@@ -670,12 +1166,91 @@ const PipesAdmin = ({
670
1166
  ] })
671
1167
  ] }) }, integration.id);
672
1168
  }) });
673
- };
674
- const PipesAdminLoading = ({
675
- count,
1169
+ }
1170
+ const PipesAdminSections = ({
1171
+ integrations,
1172
+ sharedIntegrations,
1173
+ isSharedLoading,
1174
+ organizationName,
676
1175
  ...domProps
677
1176
  }) => {
678
- return /* @__PURE__ */ jsx(CardList.Root, { ...getWidgetRootDomProps("loading", domProps), children: Array.from({ length: count }).map((_, index) => /* @__PURE__ */ jsx(CardList.Item, { children: /* @__PURE__ */ jsxs(Flex, { direction: "row", justify: "between", align: "center", gap: "2", children: [
1177
+ return /* @__PURE__ */ jsxs(
1178
+ Flex,
1179
+ {
1180
+ direction: "column",
1181
+ gap: "5",
1182
+ ...getWidgetRootDomProps("resolved", domProps),
1183
+ children: [
1184
+ (isSharedLoading || sharedIntegrations.length > 0) && /* @__PURE__ */ jsx(
1185
+ PipesSection,
1186
+ {
1187
+ title: /* @__PURE__ */ jsx(
1188
+ Translation,
1189
+ {
1190
+ defaultMessage: "Shared connections",
1191
+ id: "Fcd-bK",
1192
+ description: "Heading for the section listing connections the organization owns"
1193
+ }
1194
+ ),
1195
+ description: organizationName ? /* @__PURE__ */ jsx(
1196
+ Translation,
1197
+ {
1198
+ defaultMessage: "Accounts {organizationName} owns and shares with everyone.",
1199
+ id: "7U8P0v",
1200
+ description: "Description of the shared connections section, naming the organization",
1201
+ values: { organizationName }
1202
+ }
1203
+ ) : /* @__PURE__ */ jsx(
1204
+ Translation,
1205
+ {
1206
+ defaultMessage: "Accounts your organization owns and shares with everyone.",
1207
+ id: "72FEZi",
1208
+ description: "Description of the shared connections section when the organization name is unknown"
1209
+ }
1210
+ ),
1211
+ children: /* @__PURE__ */ jsx(CardList.Root, { children: isSharedLoading ? /* @__PURE__ */ jsx(PipesAdminSkeletonItems, { count: 2 }) : sharedIntegrations.map((integration) => /* @__PURE__ */ jsx(
1212
+ SharedConnectionAdminItem,
1213
+ {
1214
+ integration
1215
+ },
1216
+ integration.id
1217
+ )) })
1218
+ }
1219
+ ),
1220
+ /* @__PURE__ */ jsx(
1221
+ PipesSection,
1222
+ {
1223
+ title: /* @__PURE__ */ jsx(
1224
+ Translation,
1225
+ {
1226
+ defaultMessage: "Provider settings",
1227
+ id: "Zq7Lr3",
1228
+ description: "Heading for the section of provider settings governing members' own connections"
1229
+ }
1230
+ ),
1231
+ description: /* @__PURE__ */ jsx(
1232
+ Translation,
1233
+ {
1234
+ defaultMessage: "What members of this organization can connect to, and with which scopes.",
1235
+ id: "c3Vb8N",
1236
+ description: "Description of the provider settings section"
1237
+ }
1238
+ ),
1239
+ children: /* @__PURE__ */ jsx(CardList.Root, { children: integrations.length > 0 ? integrations.map((integration) => /* @__PURE__ */ jsx(
1240
+ ProviderSettingsItem,
1241
+ {
1242
+ integration
1243
+ },
1244
+ integration.id
1245
+ )) : /* @__PURE__ */ jsx(PipesEmptyItem, { isFiltered: false }) })
1246
+ }
1247
+ )
1248
+ ]
1249
+ }
1250
+ );
1251
+ };
1252
+ function PipesAdminSkeletonItems({ count }) {
1253
+ return Array.from({ length: count }).map((_, index) => /* @__PURE__ */ jsx(CardList.Item, { children: /* @__PURE__ */ jsxs(Flex, { direction: "row", justify: "between", align: "center", gap: "2", children: [
679
1254
  /* @__PURE__ */ jsxs(Flex, { gap: "4", align: "center", children: [
680
1255
  /* @__PURE__ */ jsx(Skeleton, { children: /* @__PURE__ */ jsx(IconPanel, { children: /* @__PURE__ */ jsx(ProviderIcon, { provider: "google", size: "2" }) }) }),
681
1256
  /* @__PURE__ */ jsx(Skeleton, { children: /* @__PURE__ */ jsx(Text, { size: "2", weight: "bold", children: /* @__PURE__ */ jsx(
@@ -695,7 +1270,13 @@ const PipesAdminLoading = ({
695
1270
  description: "Button to configure organization credentials"
696
1271
  }
697
1272
  ) }) })
698
- ] }) }, index)) });
1273
+ ] }) }, index));
1274
+ }
1275
+ const PipesAdminLoading = ({
1276
+ count,
1277
+ ...domProps
1278
+ }) => {
1279
+ return /* @__PURE__ */ jsx(CardList.Root, { ...getWidgetRootDomProps("loading", domProps), children: /* @__PURE__ */ jsx(PipesAdminSkeletonItems, { count }) });
699
1280
  };
700
1281
  const PipesAdminError = ({
701
1282
  error,
@@ -707,6 +1288,8 @@ export {
707
1288
  PipesAdmin,
708
1289
  PipesAdminError,
709
1290
  PipesAdminLoading,
710
- useManageableIntegrations
1291
+ PipesAdminSections,
1292
+ useManageableIntegrations,
1293
+ useOrganizationOwnedIntegrations
711
1294
  };
712
1295
  //# sourceMappingURL=pipes-admin.js.map