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