@workos-inc/widgets 1.8.2 → 1.9.1
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 +11 -0
- package/dist/cjs/admin-portal-domain-verification.client.cjs.map +1 -1
- package/dist/cjs/admin-portal-sso-connection.client.cjs +4 -7
- package/dist/cjs/admin-portal-sso-connection.client.cjs.map +1 -1
- package/dist/cjs/api/api-provider.cjs.map +1 -1
- package/dist/cjs/api/api-provider.d.cts +1 -1
- package/dist/cjs/api/endpoint.cjs +741 -771
- package/dist/cjs/api/endpoint.cjs.map +1 -1
- package/dist/cjs/api/endpoint.d.cts +860 -813
- package/dist/cjs/directory-sync.client.cjs +156 -0
- package/dist/cjs/directory-sync.client.cjs.map +1 -0
- package/dist/cjs/directory-sync.client.d.cts +26 -0
- package/dist/cjs/experimental/api/fetch.cjs +327 -411
- package/dist/cjs/experimental/api/fetch.cjs.map +1 -1
- package/dist/cjs/experimental/api/fetch.d.cts +832 -798
- package/dist/cjs/experimental/api/react-query.cjs +747 -777
- package/dist/cjs/experimental/api/react-query.cjs.map +1 -1
- package/dist/cjs/experimental/api/react-query.d.cts +1378 -1263
- package/dist/cjs/experimental/api/swr.cjs +720 -742
- package/dist/cjs/experimental/api/swr.cjs.map +1 -1
- package/dist/cjs/experimental/api/swr.d.cts +1218 -1175
- package/dist/cjs/index.cjs +5 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +2 -0
- package/dist/cjs/lib/add-mfa-dialog.cjs +18 -16
- package/dist/cjs/lib/add-mfa-dialog.cjs.map +1 -1
- package/dist/cjs/lib/admin-portal-sso-connection.cjs +0 -8
- package/dist/cjs/lib/admin-portal-sso-connection.cjs.map +1 -1
- package/dist/cjs/lib/admin-portal-sso-connection.d.cts +1 -2
- package/dist/cjs/lib/api-keys/api-keys-context.cjs +1 -1
- package/dist/cjs/lib/api-keys/api-keys-context.cjs.map +1 -1
- package/dist/cjs/lib/api-keys/api-keys-table.cjs +7 -5
- package/dist/cjs/lib/api-keys/api-keys-table.cjs.map +1 -1
- package/dist/cjs/lib/directory-sync.cjs +288 -0
- package/dist/cjs/lib/directory-sync.cjs.map +1 -0
- package/dist/cjs/lib/directory-sync.d.cts +72 -0
- package/dist/cjs/lib/identity-providers.cjs +57 -1
- package/dist/cjs/lib/identity-providers.cjs.map +1 -1
- package/dist/cjs/lib/identity-providers.d.cts +5 -3
- package/dist/cjs/lib/pipes.cjs +9 -9
- package/dist/cjs/lib/pipes.cjs.map +1 -1
- package/dist/cjs/lib/provider-icon.cjs.map +1 -1
- package/dist/cjs/lib/provider-icon.d.cts +2 -2
- package/dist/cjs/lib/reset-mfa-dialog.cjs +2 -1
- package/dist/cjs/lib/reset-mfa-dialog.cjs.map +1 -1
- package/dist/cjs/lib/use-permissions.cjs.map +1 -1
- package/dist/cjs/lib/use-permissions.d.cts +1 -1
- package/dist/cjs/lib/users-management-context.cjs +1 -1
- package/dist/cjs/lib/users-management-context.cjs.map +1 -1
- package/dist/cjs/lib/users-management.cjs +3 -3
- package/dist/cjs/lib/users-management.cjs.map +1 -1
- package/dist/cjs/lib/utils.cjs +9 -0
- package/dist/cjs/lib/utils.cjs.map +1 -1
- package/dist/cjs/lib/utils.d.cts +16 -2
- package/dist/cjs/workos-widgets.client.cjs +13 -1
- package/dist/cjs/workos-widgets.client.cjs.map +1 -1
- package/dist/esm/admin-portal-domain-verification.client.js +2 -2
- package/dist/esm/admin-portal-domain-verification.client.js.map +1 -1
- package/dist/esm/admin-portal-sso-connection.client.js +6 -9
- package/dist/esm/admin-portal-sso-connection.client.js.map +1 -1
- package/dist/esm/api/api-provider.d.ts +1 -1
- package/dist/esm/api/api-provider.js.map +1 -1
- package/dist/esm/api/endpoint.d.ts +860 -813
- package/dist/esm/api/endpoint.js +727 -751
- package/dist/esm/api/endpoint.js.map +1 -1
- package/dist/esm/directory-sync.client.d.ts +26 -0
- package/dist/esm/directory-sync.client.js +134 -0
- package/dist/esm/directory-sync.client.js.map +1 -0
- package/dist/esm/experimental/api/fetch.d.ts +832 -798
- package/dist/esm/experimental/api/fetch.js +319 -391
- package/dist/esm/experimental/api/fetch.js.map +1 -1
- package/dist/esm/experimental/api/react-query.d.ts +1378 -1263
- package/dist/esm/experimental/api/react-query.js +730 -757
- package/dist/esm/experimental/api/react-query.js.map +1 -1
- package/dist/esm/experimental/api/swr.d.ts +1218 -1175
- package/dist/esm/experimental/api/swr.js +706 -722
- package/dist/esm/experimental/api/swr.js.map +1 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/add-mfa-dialog.js +18 -16
- package/dist/esm/lib/add-mfa-dialog.js.map +1 -1
- package/dist/esm/lib/admin-portal-sso-connection.d.ts +1 -2
- package/dist/esm/lib/admin-portal-sso-connection.js +0 -8
- package/dist/esm/lib/admin-portal-sso-connection.js.map +1 -1
- package/dist/esm/lib/api-keys/api-keys-context.js +1 -1
- package/dist/esm/lib/api-keys/api-keys-context.js.map +1 -1
- package/dist/esm/lib/api-keys/api-keys-table.js +7 -5
- package/dist/esm/lib/api-keys/api-keys-table.js.map +1 -1
- package/dist/esm/lib/directory-sync.d.ts +72 -0
- package/dist/esm/lib/directory-sync.js +259 -0
- package/dist/esm/lib/directory-sync.js.map +1 -0
- package/dist/esm/lib/identity-providers.d.ts +5 -3
- package/dist/esm/lib/identity-providers.js +55 -1
- package/dist/esm/lib/identity-providers.js.map +1 -1
- package/dist/esm/lib/pipes.js +9 -10
- package/dist/esm/lib/pipes.js.map +1 -1
- package/dist/esm/lib/provider-icon.d.ts +2 -2
- package/dist/esm/lib/provider-icon.js.map +1 -1
- package/dist/esm/lib/reset-mfa-dialog.js +2 -1
- package/dist/esm/lib/reset-mfa-dialog.js.map +1 -1
- package/dist/esm/lib/use-permissions.d.ts +1 -1
- package/dist/esm/lib/use-permissions.js.map +1 -1
- package/dist/esm/lib/users-management-context.js +1 -1
- package/dist/esm/lib/users-management-context.js.map +1 -1
- package/dist/esm/lib/users-management.js +5 -4
- package/dist/esm/lib/users-management.js.map +1 -1
- package/dist/esm/lib/utils.d.ts +16 -2
- package/dist/esm/lib/utils.js +8 -0
- package/dist/esm/lib/utils.js.map +1 -1
- package/dist/esm/workos-widgets.client.js +13 -1
- package/dist/esm/workos-widgets.client.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var directory_sync_exports = {};
|
|
31
|
+
__export(directory_sync_exports, {
|
|
32
|
+
DirectorySync: () => DirectorySync,
|
|
33
|
+
DirectorySyncError: () => DirectorySyncError,
|
|
34
|
+
DirectorySyncLoading: () => DirectorySyncLoading
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(directory_sync_exports);
|
|
37
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
38
|
+
var React = __toESM(require("react"), 1);
|
|
39
|
+
var import_themes = require("@radix-ui/themes");
|
|
40
|
+
var import_react_icons = require("@radix-ui/react-icons");
|
|
41
|
+
var import_elements = require("./elements.js");
|
|
42
|
+
var import_generic_error = require("./generic-error.js");
|
|
43
|
+
var CardList = __toESM(require("./card-list.js"), 1);
|
|
44
|
+
var import_icon_panel = require("./icon-panel.js");
|
|
45
|
+
var import_provider_icon = require("./provider-icon.js");
|
|
46
|
+
var import_identity_providers = require("./identity-providers.js");
|
|
47
|
+
var import_status = require("./status.js");
|
|
48
|
+
var import_translation = require("./i18n/translation.js");
|
|
49
|
+
var import_utils = require("./utils.js");
|
|
50
|
+
var import_endpoint = require("../api/endpoint.js");
|
|
51
|
+
const DirectorySyncContext = React.createContext(null);
|
|
52
|
+
DirectorySyncContext.displayName = "DirectorySyncContext";
|
|
53
|
+
function useDirectorySyncContext() {
|
|
54
|
+
const context = React.useContext(DirectorySyncContext);
|
|
55
|
+
if (!context) {
|
|
56
|
+
throw new Error(
|
|
57
|
+
"useDirectorySyncContext must be used within a DirectorySyncContext provider"
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
return context;
|
|
61
|
+
}
|
|
62
|
+
function DirectoryProviderInfo({
|
|
63
|
+
type,
|
|
64
|
+
subtitle
|
|
65
|
+
}) {
|
|
66
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_themes.Flex, { gap: "4", align: "center", children: [
|
|
67
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon_panel.IconPanel, { color: "panel", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
68
|
+
import_provider_icon.ProviderIcon,
|
|
69
|
+
{
|
|
70
|
+
provider: (0, import_identity_providers.getDirectoryTypeIcon)(type) ?? "workos",
|
|
71
|
+
size: "2"
|
|
72
|
+
}
|
|
73
|
+
) }),
|
|
74
|
+
subtitle ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_themes.Flex, { direction: "column", children: [
|
|
75
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_themes.Text, { size: "2", weight: "bold", children: (0, import_identity_providers.getDirectoryTypeName)(type) }),
|
|
76
|
+
subtitle
|
|
77
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_themes.Text, { size: "2", weight: "bold", children: (0, import_identity_providers.getDirectoryTypeName)(type) })
|
|
78
|
+
] });
|
|
79
|
+
}
|
|
80
|
+
function SpinnerMessage({ children }) {
|
|
81
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_themes.Flex, { gap: "2", align: "center", children: [
|
|
82
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_themes.Spinner, {}),
|
|
83
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_themes.Text, { size: "2", color: "gray", children })
|
|
84
|
+
] });
|
|
85
|
+
}
|
|
86
|
+
function getStatusBadge(state) {
|
|
87
|
+
switch (state) {
|
|
88
|
+
case import_endpoint.DirectoryState.requires_type:
|
|
89
|
+
case import_endpoint.DirectoryState.invalid_credentials:
|
|
90
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_status.Status, { state: "error", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
91
|
+
import_translation.Translation,
|
|
92
|
+
{
|
|
93
|
+
defaultMessage: "Requires action",
|
|
94
|
+
id: "uuuXIF",
|
|
95
|
+
description: "Status badge when directory requires user action"
|
|
96
|
+
}
|
|
97
|
+
) });
|
|
98
|
+
case import_endpoint.DirectoryState.linked:
|
|
99
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_status.Status, { state: "success", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
100
|
+
import_translation.Translation,
|
|
101
|
+
{
|
|
102
|
+
defaultMessage: "Connected",
|
|
103
|
+
id: "H/dAHq",
|
|
104
|
+
description: "Status badge when directory is active"
|
|
105
|
+
}
|
|
106
|
+
) });
|
|
107
|
+
default:
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function getSpinnerMessage(state, hasType) {
|
|
112
|
+
if (state === import_endpoint.DirectoryState.unlinked && hasType)
|
|
113
|
+
return "Setup in progress...";
|
|
114
|
+
if (state === import_endpoint.DirectoryState.validating)
|
|
115
|
+
return "Waiting for users and groups...";
|
|
116
|
+
if (state === import_endpoint.DirectoryState.deleting) return "Deleting directory...";
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
const DirectorySync = ({
|
|
120
|
+
state,
|
|
121
|
+
className,
|
|
122
|
+
...rest
|
|
123
|
+
}) => {
|
|
124
|
+
const type = "type" in rest ? rest.type : void 0;
|
|
125
|
+
const errorMessage = "errorMessage" in rest ? rest.errorMessage : void 0;
|
|
126
|
+
const metadata = "metadata" in rest ? rest.metadata : void 0;
|
|
127
|
+
const link = "link" in rest ? rest.link : void 0;
|
|
128
|
+
const userCount = metadata?.users.active ?? 0;
|
|
129
|
+
const groupCount = metadata?.groups ?? 0;
|
|
130
|
+
const lastSyncAt = rest.lastSyncAt ? new Date(rest.lastSyncAt) : null;
|
|
131
|
+
const currentDate = "currentDate" in rest && rest.currentDate instanceof Date ? rest.currentDate : void 0;
|
|
132
|
+
const lastSyncString = lastSyncAt ? getRelativeTimeString(currentDate ?? /* @__PURE__ */ new Date(), lastSyncAt) : null;
|
|
133
|
+
const showCounts = state === import_endpoint.DirectoryState.linked || state === import_endpoint.DirectoryState.invalid_credentials || state === import_endpoint.DirectoryState.deleting;
|
|
134
|
+
const statusBadge = getStatusBadge(state);
|
|
135
|
+
const spinnerMessage = getSpinnerMessage(state, !!type);
|
|
136
|
+
const showButton = state !== import_endpoint.DirectoryState.deleting;
|
|
137
|
+
const domProps = { className };
|
|
138
|
+
const countsSubtitle = showCounts ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_themes.Text, { size: "2", color: "gray", children: [
|
|
139
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
140
|
+
import_translation.Translation,
|
|
141
|
+
{
|
|
142
|
+
defaultMessage: "{userCount} {userLabel}",
|
|
143
|
+
id: "aZxx55",
|
|
144
|
+
description: "Directory sync user and group counts",
|
|
145
|
+
values: {
|
|
146
|
+
userCount,
|
|
147
|
+
userLabel: userCount !== 1 ? "users" : "user"
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
),
|
|
151
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { "aria-hidden": true, children: " \u2219 " }),
|
|
152
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
153
|
+
import_translation.Translation,
|
|
154
|
+
{
|
|
155
|
+
defaultMessage: "{groupCount} {groupLabel}",
|
|
156
|
+
id: "SgiDio",
|
|
157
|
+
description: "Directory sync group count",
|
|
158
|
+
values: {
|
|
159
|
+
groupCount,
|
|
160
|
+
groupLabel: groupCount !== 1 ? "groups" : "group"
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
),
|
|
164
|
+
lastSyncString && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
165
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { "aria-hidden": true, children: " \u2219 " }),
|
|
166
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
167
|
+
import_translation.Translation,
|
|
168
|
+
{
|
|
169
|
+
defaultMessage: "Last sync {lastSync}",
|
|
170
|
+
id: "UUqjnE",
|
|
171
|
+
description: "Last sync timestamp for directory",
|
|
172
|
+
values: { lastSync: lastSyncString }
|
|
173
|
+
}
|
|
174
|
+
)
|
|
175
|
+
] })
|
|
176
|
+
] }) : null;
|
|
177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CardList.Root, { ...getWidgetRootDomProps("resolved", domProps), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DirectorySyncContext.Provider, { value: { state, type }, children: [
|
|
178
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CardList.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_themes.Flex, { direction: "row", justify: "between", align: "center", gap: "2", children: !type ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
179
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_themes.Text, { size: "2", color: "gray", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
180
|
+
import_translation.Translation,
|
|
181
|
+
{
|
|
182
|
+
defaultMessage: "You haven't set up a directory yet.",
|
|
183
|
+
id: "+ywYVl",
|
|
184
|
+
description: "Empty state message when no directory is configured"
|
|
185
|
+
}
|
|
186
|
+
) }),
|
|
187
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdminPortalOpenButton, { href: link ?? null })
|
|
188
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
189
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DirectoryProviderInfo, { type, subtitle: countsSubtitle }),
|
|
190
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_themes.Flex, { gap: "5", align: "center", children: [
|
|
191
|
+
statusBadge,
|
|
192
|
+
spinnerMessage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SpinnerMessage, { children: spinnerMessage }),
|
|
193
|
+
showButton && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdminPortalOpenButton, { href: link ?? null })
|
|
194
|
+
] })
|
|
195
|
+
] }) }) }),
|
|
196
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CardList.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_themes.Flex, { align: "start", gap: "2", children: [
|
|
197
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_themes.Box, { asChild: true, mt: "2px", flexShrink: "0", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_icons.InfoCircledIcon, { color: "var(--gray-11)" }) }),
|
|
198
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_themes.Text, { size: "2", color: "gray", children: errorMessage })
|
|
199
|
+
] }) })
|
|
200
|
+
] }) });
|
|
201
|
+
};
|
|
202
|
+
function AdminPortalOpenButton({
|
|
203
|
+
href,
|
|
204
|
+
children
|
|
205
|
+
}) {
|
|
206
|
+
const { state, type } = useDirectorySyncContext();
|
|
207
|
+
const label = (() => {
|
|
208
|
+
switch (state) {
|
|
209
|
+
case import_endpoint.DirectoryState.unlinked:
|
|
210
|
+
return type ? "Continue setup" : "Set up directory";
|
|
211
|
+
case import_endpoint.DirectoryState.validating:
|
|
212
|
+
return "Manage";
|
|
213
|
+
default:
|
|
214
|
+
return "Manage";
|
|
215
|
+
}
|
|
216
|
+
})();
|
|
217
|
+
if (href) {
|
|
218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_elements.Button, { variant: "secondary", asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("a", { href, target: "_blank", rel: "noopener noreferrer", children: [
|
|
219
|
+
children ?? label,
|
|
220
|
+
" ",
|
|
221
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_icons.ExternalLinkIcon, { "aria-hidden": true })
|
|
222
|
+
] }) });
|
|
223
|
+
}
|
|
224
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_elements.Button, { variant: "secondary", disabled: true, children: [
|
|
225
|
+
children ?? label,
|
|
226
|
+
" ",
|
|
227
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_icons.ExternalLinkIcon, { "aria-hidden": true })
|
|
228
|
+
] });
|
|
229
|
+
}
|
|
230
|
+
const DirectorySyncLoading = (props) => {
|
|
231
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_themes.Card, { size: "2", ...getWidgetRootDomProps("loading", props), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_themes.Flex, { direction: "row", justify: "between", align: "center", gap: "2", children: [
|
|
232
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_elements.Skeleton, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_themes.Text, { size: "2", color: "gray", children: "You haven't set up a directory yet." }) }),
|
|
233
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_elements.Skeleton, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_elements.Button, { variant: "secondary", children: [
|
|
234
|
+
"Set up directory ",
|
|
235
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_icons.ExternalLinkIcon, { "aria-hidden": true })
|
|
236
|
+
] }) })
|
|
237
|
+
] }) });
|
|
238
|
+
};
|
|
239
|
+
const DirectorySyncError = ({
|
|
240
|
+
error,
|
|
241
|
+
...domProps
|
|
242
|
+
}) => {
|
|
243
|
+
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 }) });
|
|
244
|
+
};
|
|
245
|
+
function getWidgetRootDomProps(state, domProps) {
|
|
246
|
+
return (0, import_utils.getDomProps)({
|
|
247
|
+
...domProps,
|
|
248
|
+
isWidgetRoot: true,
|
|
249
|
+
widgetId: "directory-sync",
|
|
250
|
+
widgetState: state
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
function getRelativeTimeString(currentDate, lastSync) {
|
|
254
|
+
if (!currentDate || !lastSync) {
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
257
|
+
const rtf = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
|
|
258
|
+
const diff = lastSync.getTime() - currentDate.getTime();
|
|
259
|
+
const diffSeconds = Math.round(diff / 1e3);
|
|
260
|
+
const diffMinutes = Math.round(diffSeconds / 60);
|
|
261
|
+
const diffHours = Math.round(diffMinutes / 60);
|
|
262
|
+
const diffDays = Math.round(diffHours / 24);
|
|
263
|
+
const diffMonths = Math.round(diffDays / 30);
|
|
264
|
+
const diffYears = Math.round(diffMonths / 12);
|
|
265
|
+
if (Math.abs(diffSeconds) < 60) {
|
|
266
|
+
return "now";
|
|
267
|
+
}
|
|
268
|
+
if (Math.abs(diffMinutes) < 60) {
|
|
269
|
+
return rtf.format(diffMinutes, "minute");
|
|
270
|
+
}
|
|
271
|
+
if (Math.abs(diffHours) < 24) {
|
|
272
|
+
return rtf.format(diffHours, "hour");
|
|
273
|
+
}
|
|
274
|
+
if (Math.abs(diffDays) < 30) {
|
|
275
|
+
return rtf.format(diffDays, "day");
|
|
276
|
+
}
|
|
277
|
+
if (Math.abs(diffMonths) < 12) {
|
|
278
|
+
return rtf.format(diffMonths, "month");
|
|
279
|
+
}
|
|
280
|
+
return rtf.format(diffYears, "year");
|
|
281
|
+
}
|
|
282
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
283
|
+
0 && (module.exports = {
|
|
284
|
+
DirectorySync,
|
|
285
|
+
DirectorySyncError,
|
|
286
|
+
DirectorySyncLoading
|
|
287
|
+
});
|
|
288
|
+
//# sourceMappingURL=directory-sync.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/directory-sync.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Box, Card, Flex, Spinner, Text } from \"@radix-ui/themes\";\nimport { ExternalLinkIcon, InfoCircledIcon } from \"@radix-ui/react-icons\";\nimport { Button, Skeleton } from \"./elements.js\";\nimport { GenericError } from \"./generic-error.js\";\nimport * as CardList from \"./card-list.js\";\nimport { IconPanel } from \"./icon-panel.js\";\nimport { ProviderIcon } from \"./provider-icon.js\";\nimport {\n getDirectoryTypeIcon,\n getDirectoryTypeName,\n} from \"./identity-providers.js\";\nimport { Status } from \"./status.js\";\nimport { Translation } from \"./i18n/translation.js\";\nimport {\n getDomProps,\n type WidgetRootState,\n type WidgetRootDomProps,\n} from \"./utils.js\";\nimport {\n DirectoryMetadata,\n DirectoryState,\n type DirectoryType,\n} from \"../api/endpoint.js\";\n\ninterface BaseDirectorySyncProps {\n type?: DirectoryType;\n metadata?: DirectoryMetadata;\n lastSyncAt?: string | null;\n link?: string | null;\n errorMessage?: never;\n userCount?: never;\n groupCount?: never;\n currentDate?: never;\n state: DirectoryState;\n}\n\ninterface NotConfiguredProps extends BaseDirectorySyncProps {\n state: (typeof DirectoryState)[\"unlinked\"];\n}\n\ninterface SetupInProgressProps extends Omit<BaseDirectorySyncProps, \"type\"> {\n state: (typeof DirectoryState)[\"validating\"];\n type: DirectoryType;\n}\n\ninterface ErrorBeforeConfigProps extends Omit<\n BaseDirectorySyncProps,\n \"type\" | \"errorMessage\"\n> {\n state: DirectoryState;\n type: DirectoryType;\n errorMessage: React.ReactNode;\n}\n\ninterface ValidatingProps extends Omit<BaseDirectorySyncProps, \"type\"> {\n state: (typeof DirectoryState)[\"validating\"];\n type: DirectoryType;\n}\n\ninterface ActiveProps extends Omit<\n BaseDirectorySyncProps,\n \"type\" | \"lastSyncAt\" | \"currentDate\" | \"errorMessage\"\n> {\n state: (typeof DirectoryState)[\"linked\"];\n type: DirectoryType;\n lastSyncAt: string | null;\n currentDate?: Date | null;\n errorMessage?: React.ReactNode;\n}\n\ninterface InvalidCredentialsProps extends Omit<\n BaseDirectorySyncProps,\n \"type\" | \"errorMessage\"\n> {\n state: (typeof DirectoryState)[\"invalid_credentials\"];\n type: DirectoryType;\n errorMessage: React.ReactNode;\n}\n\ninterface DeletingProps extends Omit<BaseDirectorySyncProps, \"type\"> {\n state: (typeof DirectoryState)[\"deleting\"];\n type: DirectoryType;\n}\n\ntype DirectorySyncStatusProps =\n | NotConfiguredProps\n | SetupInProgressProps\n | ErrorBeforeConfigProps\n | ValidatingProps\n | ActiveProps\n | InvalidCredentialsProps\n | DeletingProps;\n\ntype DirectorySyncProps = WidgetRootDomProps & DirectorySyncStatusProps;\n\ninterface DirectorySyncContextValue {\n state: DirectorySyncStatusProps[\"state\"];\n type?: DirectoryType;\n}\n\nconst DirectorySyncContext =\n React.createContext<DirectorySyncContextValue | null>(null);\nDirectorySyncContext.displayName = \"DirectorySyncContext\";\n\nfunction useDirectorySyncContext() {\n const context = React.useContext(DirectorySyncContext);\n if (!context) {\n throw new Error(\n \"useDirectorySyncContext must be used within a DirectorySyncContext provider\",\n );\n }\n return context;\n}\n\nfunction DirectoryProviderInfo({\n type,\n subtitle,\n}: {\n type: DirectoryType;\n subtitle?: React.ReactNode;\n}) {\n return (\n <Flex gap=\"4\" align=\"center\">\n <IconPanel color=\"panel\">\n <ProviderIcon\n provider={getDirectoryTypeIcon(type) ?? \"workos\"}\n size=\"2\"\n />\n </IconPanel>\n {subtitle ? (\n <Flex direction=\"column\">\n <Text size=\"2\" weight=\"bold\">\n {getDirectoryTypeName(type)}\n </Text>\n {subtitle}\n </Flex>\n ) : (\n <Text size=\"2\" weight=\"bold\">\n {getDirectoryTypeName(type)}\n </Text>\n )}\n </Flex>\n );\n}\n\nfunction SpinnerMessage({ children }: { children: React.ReactNode }) {\n return (\n <Flex gap=\"2\" align=\"center\">\n <Spinner />\n <Text size=\"2\" color=\"gray\">\n {children}\n </Text>\n </Flex>\n );\n}\n\nfunction getStatusBadge(state: DirectoryState) {\n switch (state) {\n case DirectoryState.requires_type:\n case DirectoryState.invalid_credentials:\n return (\n <Status state=\"error\">\n <Translation\n defaultMessage=\"Requires action\"\n id=\"uuuXIF\"\n description=\"Status badge when directory requires user action\"\n />\n </Status>\n );\n case DirectoryState.linked:\n return (\n <Status state=\"success\">\n <Translation\n defaultMessage=\"Connected\"\n id=\"H/dAHq\"\n description=\"Status badge when directory is active\"\n />\n </Status>\n );\n default:\n return null;\n }\n}\n\nfunction getSpinnerMessage(\n state: DirectoryState,\n hasType: boolean,\n): string | null {\n if (state === DirectoryState.unlinked && hasType)\n return \"Setup in progress...\";\n if (state === DirectoryState.validating)\n return \"Waiting for users and groups...\";\n if (state === DirectoryState.deleting) return \"Deleting directory...\";\n return null;\n}\n\nconst DirectorySync: React.FC<DirectorySyncProps> = ({\n state,\n className,\n ...rest\n}) => {\n const type =\n \"type\" in rest ? (rest as { type: DirectoryType }).type : undefined;\n const errorMessage =\n \"errorMessage\" in rest\n ? (rest as { errorMessage: React.ReactNode }).errorMessage\n : undefined;\n const metadata =\n \"metadata\" in rest\n ? (rest as { metadata: DirectoryMetadata }).metadata\n : undefined;\n const link =\n \"link\" in rest ? (rest as { link: string | null }).link : undefined;\n const userCount = metadata?.users.active ?? 0;\n const groupCount = metadata?.groups ?? 0;\n const lastSyncAt = rest.lastSyncAt ? new Date(rest.lastSyncAt) : null;\n\n const currentDate =\n \"currentDate\" in rest && rest.currentDate instanceof Date\n ? rest.currentDate\n : undefined;\n\n const lastSyncString = lastSyncAt\n ? getRelativeTimeString(currentDate ?? new Date(), lastSyncAt)\n : null;\n\n const showCounts =\n state === DirectoryState.linked ||\n state === DirectoryState.invalid_credentials ||\n state === DirectoryState.deleting;\n const statusBadge = getStatusBadge(state);\n const spinnerMessage = getSpinnerMessage(state, !!type);\n const showButton = state !== DirectoryState.deleting;\n const domProps: WidgetRootDomProps = { className };\n\n const countsSubtitle = showCounts ? (\n <Text size=\"2\" color=\"gray\">\n <Translation\n defaultMessage=\"{userCount} {userLabel}\"\n id=\"aZxx55\"\n description=\"Directory sync user and group counts\"\n values={{\n userCount,\n userLabel: userCount !== 1 ? \"users\" : \"user\",\n }}\n />\n {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}\n <span aria-hidden> ∙ </span>\n <Translation\n defaultMessage=\"{groupCount} {groupLabel}\"\n id=\"SgiDio\"\n description=\"Directory sync group count\"\n values={{\n groupCount,\n groupLabel: groupCount !== 1 ? \"groups\" : \"group\",\n }}\n />\n {lastSyncString && (\n <>\n {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}\n <span aria-hidden> ∙ </span>\n <Translation\n defaultMessage=\"Last sync {lastSync}\"\n id=\"UUqjnE\"\n description=\"Last sync timestamp for directory\"\n values={{ lastSync: lastSyncString }}\n />\n </>\n )}\n </Text>\n ) : null;\n\n return (\n <CardList.Root {...getWidgetRootDomProps(\"resolved\", domProps)}>\n <DirectorySyncContext.Provider value={{ state, type }}>\n <CardList.Item>\n <Flex direction=\"row\" justify=\"between\" align=\"center\" gap=\"2\">\n {!type ? (\n <>\n <Text size=\"2\" color=\"gray\">\n <Translation\n defaultMessage=\"You haven't set up a directory yet.\"\n id=\"+ywYVl\"\n description=\"Empty state message when no directory is configured\"\n />\n </Text>\n <AdminPortalOpenButton href={link ?? null} />\n </>\n ) : (\n <>\n <DirectoryProviderInfo type={type} subtitle={countsSubtitle} />\n <Flex gap=\"5\" align=\"center\">\n {statusBadge}\n {spinnerMessage && (\n <SpinnerMessage>{spinnerMessage}</SpinnerMessage>\n )}\n {showButton && <AdminPortalOpenButton href={link ?? null} />}\n </Flex>\n </>\n )}\n </Flex>\n </CardList.Item>\n\n {errorMessage && (\n <CardList.Item>\n <Flex align=\"start\" gap=\"2\">\n <Box asChild mt=\"2px\" flexShrink=\"0\">\n <InfoCircledIcon color=\"var(--gray-11)\" />\n </Box>\n <Text size=\"2\" color=\"gray\">\n {errorMessage}\n </Text>\n </Flex>\n </CardList.Item>\n )}\n </DirectorySyncContext.Provider>\n </CardList.Root>\n );\n};\n\nfunction AdminPortalOpenButton({\n href,\n children,\n}: {\n href: string | null;\n children?: React.ReactNode;\n}) {\n const { state, type } = useDirectorySyncContext();\n\n const label = (() => {\n switch (state) {\n case DirectoryState.unlinked:\n return type ? \"Continue setup\" : \"Set up directory\";\n case DirectoryState.validating:\n return \"Manage\";\n default:\n return \"Manage\";\n }\n })();\n\n if (href) {\n return (\n <Button variant=\"secondary\" asChild>\n <a href={href} target=\"_blank\" rel=\"noopener noreferrer\">\n {children ?? label} <ExternalLinkIcon aria-hidden />\n </a>\n </Button>\n );\n }\n\n return (\n <Button variant=\"secondary\" disabled>\n {children ?? label} <ExternalLinkIcon aria-hidden />\n </Button>\n );\n}\n\ninterface DirectorySyncLoadingProps extends WidgetRootDomProps {}\n\nconst DirectorySyncLoading: React.FC<DirectorySyncLoadingProps> = (props) => {\n return (\n <Card size=\"2\" {...getWidgetRootDomProps(\"loading\", props)}>\n <Flex direction=\"row\" justify=\"between\" align=\"center\" gap=\"2\">\n <Skeleton>\n {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}\n <Text size=\"2\" color=\"gray\">\n You haven't set up a directory yet.\n </Text>\n </Skeleton>\n <Skeleton>\n {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}\n <Button variant=\"secondary\">\n Set up directory <ExternalLinkIcon aria-hidden />\n </Button>\n </Skeleton>\n </Flex>\n </Card>\n );\n};\n\ninterface DirectorySyncErrorProps extends WidgetRootDomProps {\n error: unknown;\n}\n\nconst DirectorySyncError: React.FC<DirectorySyncErrorProps> = ({\n error,\n ...domProps\n}) => {\n return (\n <Card size=\"2\" {...getWidgetRootDomProps(\"error\", domProps)}>\n <GenericError error={error} />\n </Card>\n );\n};\n\nfunction getWidgetRootDomProps(\n state: WidgetRootState,\n domProps: WidgetRootDomProps,\n) {\n return getDomProps({\n ...domProps,\n isWidgetRoot: true,\n widgetId: \"directory-sync\",\n widgetState: state,\n });\n}\n\nfunction getRelativeTimeString(\n currentDate: Date | null,\n lastSync: Date | null,\n) {\n if (!currentDate || !lastSync) {\n return null;\n }\n\n const rtf = new Intl.RelativeTimeFormat(\"en\", { numeric: \"auto\" });\n const diff = lastSync.getTime() - currentDate.getTime();\n\n const diffSeconds = Math.round(diff / 1000);\n const diffMinutes = Math.round(diffSeconds / 60);\n const diffHours = Math.round(diffMinutes / 60);\n const diffDays = Math.round(diffHours / 24);\n const diffMonths = Math.round(diffDays / 30);\n const diffYears = Math.round(diffMonths / 12);\n\n if (Math.abs(diffSeconds) < 60) {\n return \"now\";\n }\n\n if (Math.abs(diffMinutes) < 60) {\n return rtf.format(diffMinutes, \"minute\");\n }\n\n if (Math.abs(diffHours) < 24) {\n return rtf.format(diffHours, \"hour\");\n }\n\n if (Math.abs(diffDays) < 30) {\n return rtf.format(diffDays, \"day\");\n }\n\n if (Math.abs(diffMonths) < 12) {\n return rtf.format(diffMonths, \"month\");\n }\n\n return rtf.format(diffYears, \"year\");\n}\n\nexport type {\n DirectorySyncProps,\n DirectorySyncLoadingProps,\n DirectorySyncErrorProps,\n DirectorySyncStatusProps,\n};\nexport { DirectorySync, DirectorySyncLoading, DirectorySyncError };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA+HQ;AA7HR,YAAuB;AACvB,oBAA+C;AAC/C,yBAAkD;AAClD,sBAAiC;AACjC,2BAA6B;AAC7B,eAA0B;AAC1B,wBAA0B;AAC1B,2BAA6B;AAC7B,gCAGO;AACP,oBAAuB;AACvB,yBAA4B;AAC5B,mBAIO;AACP,sBAIO;AA8EP,MAAM,uBACJ,MAAM,cAAgD,IAAI;AAC5D,qBAAqB,cAAc;AAEnC,SAAS,0BAA0B;AACjC,QAAM,UAAU,MAAM,WAAW,oBAAoB;AACrD,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAEA,SAAS,sBAAsB;AAAA,EAC7B;AAAA,EACA;AACF,GAGG;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EA,QAAM,MAAM,IAAI,KAAK,mBAAmB,MAAM,EAAE,SAAS,OAAO,CAAC;AACjE,QAAM,OAAO,SAAS,QAAQ,IAAI,YAAY,QAAQ;AAEtD,QAAM,cAAc,KAAK,MAAM,OAAO,GAAI;AAC1C,QAAM,cAAc,KAAK,MAAM,cAAc,EAAE;AAC/C,QAAM,YAAY,KAAK,MAAM,cAAc,EAAE;AAC7C,QAAM,WAAW,KAAK,MAAM,YAAY,EAAE;AAC1C,QAAM,aAAa,KAAK,MAAM,WAAW,EAAE;AAC3C,QAAM,YAAY,KAAK,MAAM,aAAa,EAAE;AAE5C,MAAI,KAAK,IAAI,WAAW,IAAI,IAAI;AAC9B,WAAO;AAAA,EACT;AAEA,MAAI,KAAK,IAAI,WAAW,IAAI,IAAI;AAC9B,WAAO,IAAI,OAAO,aAAa,QAAQ;AAAA,EACzC;AAEA,MAAI,KAAK,IAAI,SAAS,IAAI,IAAI;AAC5B,WAAO,IAAI,OAAO,WAAW,MAAM;AAAA,EACrC;AAEA,MAAI,KAAK,IAAI,QAAQ,IAAI,IAAI;AAC3B,WAAO,IAAI,OAAO,UAAU,KAAK;AAAA,EACnC;AAEA,MAAI,KAAK,IAAI,UAAU,IAAI,IAAI;AAC7B,WAAO,IAAI,OAAO,YAAY,OAAO;AAAA,EACvC;AAEA,SAAO,IAAI,OAAO,WAAW,MAAM;AACrC;","names":[]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { WidgetRootDomProps } from './utils.cjs';
|
|
3
|
+
import { DirectoryType, DirectoryMetadata, DirectoryState } from '../api/endpoint.cjs';
|
|
4
|
+
import './elements.cjs';
|
|
5
|
+
import '@radix-ui/themes';
|
|
6
|
+
import '@radix-ui/themes/props';
|
|
7
|
+
import '../dialog-C15qCLN3.cjs';
|
|
8
|
+
import '@radix-ui/themes/components/dialog';
|
|
9
|
+
import '../alert-dialog-BlG3_awx.cjs';
|
|
10
|
+
import '@radix-ui/themes/components/alert-dialog';
|
|
11
|
+
import '../dropdown-menu-BQ5LtvdR.cjs';
|
|
12
|
+
import '@radix-ui/themes/components/dropdown-menu';
|
|
13
|
+
import '../select-KR89Qnvm.cjs';
|
|
14
|
+
import '@radix-ui/themes/components/select';
|
|
15
|
+
import '@tanstack/react-query';
|
|
16
|
+
import '../api/widgets-api-client.cjs';
|
|
17
|
+
|
|
18
|
+
interface BaseDirectorySyncProps {
|
|
19
|
+
type?: DirectoryType;
|
|
20
|
+
metadata?: DirectoryMetadata;
|
|
21
|
+
lastSyncAt?: string | null;
|
|
22
|
+
link?: string | null;
|
|
23
|
+
errorMessage?: never;
|
|
24
|
+
userCount?: never;
|
|
25
|
+
groupCount?: never;
|
|
26
|
+
currentDate?: never;
|
|
27
|
+
state: DirectoryState;
|
|
28
|
+
}
|
|
29
|
+
interface NotConfiguredProps extends BaseDirectorySyncProps {
|
|
30
|
+
state: (typeof DirectoryState)["unlinked"];
|
|
31
|
+
}
|
|
32
|
+
interface SetupInProgressProps extends Omit<BaseDirectorySyncProps, "type"> {
|
|
33
|
+
state: (typeof DirectoryState)["validating"];
|
|
34
|
+
type: DirectoryType;
|
|
35
|
+
}
|
|
36
|
+
interface ErrorBeforeConfigProps extends Omit<BaseDirectorySyncProps, "type" | "errorMessage"> {
|
|
37
|
+
state: DirectoryState;
|
|
38
|
+
type: DirectoryType;
|
|
39
|
+
errorMessage: React.ReactNode;
|
|
40
|
+
}
|
|
41
|
+
interface ValidatingProps extends Omit<BaseDirectorySyncProps, "type"> {
|
|
42
|
+
state: (typeof DirectoryState)["validating"];
|
|
43
|
+
type: DirectoryType;
|
|
44
|
+
}
|
|
45
|
+
interface ActiveProps extends Omit<BaseDirectorySyncProps, "type" | "lastSyncAt" | "currentDate" | "errorMessage"> {
|
|
46
|
+
state: (typeof DirectoryState)["linked"];
|
|
47
|
+
type: DirectoryType;
|
|
48
|
+
lastSyncAt: string | null;
|
|
49
|
+
currentDate?: Date | null;
|
|
50
|
+
errorMessage?: React.ReactNode;
|
|
51
|
+
}
|
|
52
|
+
interface InvalidCredentialsProps extends Omit<BaseDirectorySyncProps, "type" | "errorMessage"> {
|
|
53
|
+
state: (typeof DirectoryState)["invalid_credentials"];
|
|
54
|
+
type: DirectoryType;
|
|
55
|
+
errorMessage: React.ReactNode;
|
|
56
|
+
}
|
|
57
|
+
interface DeletingProps extends Omit<BaseDirectorySyncProps, "type"> {
|
|
58
|
+
state: (typeof DirectoryState)["deleting"];
|
|
59
|
+
type: DirectoryType;
|
|
60
|
+
}
|
|
61
|
+
type DirectorySyncStatusProps = NotConfiguredProps | SetupInProgressProps | ErrorBeforeConfigProps | ValidatingProps | ActiveProps | InvalidCredentialsProps | DeletingProps;
|
|
62
|
+
type DirectorySyncProps = WidgetRootDomProps & DirectorySyncStatusProps;
|
|
63
|
+
declare const DirectorySync: React.FC<DirectorySyncProps>;
|
|
64
|
+
interface DirectorySyncLoadingProps extends WidgetRootDomProps {
|
|
65
|
+
}
|
|
66
|
+
declare const DirectorySyncLoading: React.FC<DirectorySyncLoadingProps>;
|
|
67
|
+
interface DirectorySyncErrorProps extends WidgetRootDomProps {
|
|
68
|
+
error: unknown;
|
|
69
|
+
}
|
|
70
|
+
declare const DirectorySyncError: React.FC<DirectorySyncErrorProps>;
|
|
71
|
+
|
|
72
|
+
export { DirectorySync, DirectorySyncError, type DirectorySyncErrorProps, DirectorySyncLoading, type DirectorySyncLoadingProps, type DirectorySyncProps, type DirectorySyncStatusProps };
|
|
@@ -18,6 +18,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var identity_providers_exports = {};
|
|
20
20
|
__export(identity_providers_exports, {
|
|
21
|
+
getDirectoryTypeIcon: () => getDirectoryTypeIcon,
|
|
22
|
+
getDirectoryTypeName: () => getDirectoryTypeName,
|
|
21
23
|
getIdentityProviderName: () => getIdentityProviderName,
|
|
22
24
|
isIdentityProvider: () => isIdentityProvider
|
|
23
25
|
});
|
|
@@ -58,7 +60,7 @@ const IDENTITY_PROVIDER_DICT = /* @__PURE__ */ new Map([
|
|
|
58
60
|
["google-drive", "Google Drive"],
|
|
59
61
|
["google-mail", "Google Mail"],
|
|
60
62
|
["google-cloud", "Google Cloud"],
|
|
61
|
-
["hibob", "
|
|
63
|
+
["hibob", "HiBob"],
|
|
62
64
|
["hubspot", "Hubspot"],
|
|
63
65
|
["intercom", "Intercom"],
|
|
64
66
|
["intuit", "Intuit"],
|
|
@@ -101,11 +103,65 @@ const IDENTITY_PROVIDER_DICT = /* @__PURE__ */ new Map([
|
|
|
101
103
|
function getIdentityProviderName(provider) {
|
|
102
104
|
return IDENTITY_PROVIDER_DICT.get(provider);
|
|
103
105
|
}
|
|
106
|
+
const DIRECTORY_TYPE_TO_ICON = {
|
|
107
|
+
"azure scim v2.0": "azure",
|
|
108
|
+
bamboohr: "bamboohr",
|
|
109
|
+
"breathe hr": "breathe-hr",
|
|
110
|
+
"cezanne hr": "cezanne-hr",
|
|
111
|
+
"cyberark scim v2.0": "cyberark",
|
|
112
|
+
"fourth hr": "fourth",
|
|
113
|
+
"generic scim v2.0": "workos",
|
|
114
|
+
"gsuite directory": "google",
|
|
115
|
+
hibob: "hibob",
|
|
116
|
+
"jump cloud scim v2.0": "jumpcloud",
|
|
117
|
+
"okta scim v2.0": "okta",
|
|
118
|
+
"onelogin scim v2.0": "onelogin",
|
|
119
|
+
"people hr": "access-people-hr",
|
|
120
|
+
personio: "personio",
|
|
121
|
+
"pingfederate scim v2.0": "ping-identity",
|
|
122
|
+
"rippling scim v2.0": "rippling",
|
|
123
|
+
s3: "aws",
|
|
124
|
+
sftp: "workos",
|
|
125
|
+
"sftp workday": "workday",
|
|
126
|
+
workday: "workday",
|
|
127
|
+
pending: "workos"
|
|
128
|
+
};
|
|
129
|
+
const DIRECTORY_TYPE_TO_NAME = {
|
|
130
|
+
"azure scim v2.0": "Microsoft Entra ID",
|
|
131
|
+
bamboohr: "BambooHR",
|
|
132
|
+
"breathe hr": "Breathe HR",
|
|
133
|
+
"cezanne hr": "Cezanne HR",
|
|
134
|
+
"cyberark scim v2.0": "CyberArk",
|
|
135
|
+
"fourth hr": "Fourth HR",
|
|
136
|
+
"generic scim v2.0": "Generic SCIM",
|
|
137
|
+
"gsuite directory": "Google Workspace",
|
|
138
|
+
hibob: "HiBob",
|
|
139
|
+
"jump cloud scim v2.0": "JumpCloud",
|
|
140
|
+
"okta scim v2.0": "Okta",
|
|
141
|
+
"onelogin scim v2.0": "OneLogin",
|
|
142
|
+
"people hr": "People HR",
|
|
143
|
+
personio: "Personio",
|
|
144
|
+
"pingfederate scim v2.0": "PingFederate",
|
|
145
|
+
"rippling scim v2.0": "Rippling",
|
|
146
|
+
s3: "Amazon S3",
|
|
147
|
+
sftp: "SFTP",
|
|
148
|
+
"sftp workday": "Workday (SFTP)",
|
|
149
|
+
workday: "Workday",
|
|
150
|
+
pending: "Pending"
|
|
151
|
+
};
|
|
152
|
+
function getDirectoryTypeIcon(directoryType) {
|
|
153
|
+
return DIRECTORY_TYPE_TO_ICON[directoryType] ?? null;
|
|
154
|
+
}
|
|
155
|
+
function getDirectoryTypeName(directoryType) {
|
|
156
|
+
return DIRECTORY_TYPE_TO_NAME[directoryType] ?? directoryType;
|
|
157
|
+
}
|
|
104
158
|
function isIdentityProvider(provider) {
|
|
105
159
|
return typeof provider === "string" && IDENTITY_PROVIDER_DICT.has(provider);
|
|
106
160
|
}
|
|
107
161
|
// Annotate the CommonJS export names for ESM import in node:
|
|
108
162
|
0 && (module.exports = {
|
|
163
|
+
getDirectoryTypeIcon,
|
|
164
|
+
getDirectoryTypeName,
|
|
109
165
|
getIdentityProviderName,
|
|
110
166
|
isIdentityProvider
|
|
111
167
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/identity-providers.ts"],"sourcesContent":["const IDENTITY_PROVIDER_DICT = new Map([\n [\"access-people-hr\", \"Access People HR\"],\n [\"adp\", \"ADP\"],\n [\"apple\", \"Apple\"],\n [\"asana\", \"Asana\"],\n [\"auth0\", \"Auth0\"],\n [\"azure\", \"Azure\"],\n [\"aws\", \"AWS\"],\n [\"bamboohr\", \"BambooHR\"],\n [\"bamboo-hr\", \"BambooHR\"],\n [\"bitbucket\", \"Bitbucket\"],\n [\"box\", \"Box\"],\n [\"breathe-hr\", \"BreatheHR\"],\n [\"bubble\", \"Bubble\"],\n [\"cas\", \"CAS\"],\n [\"cezanne-hr\", \"Cezanne HR\"],\n [\"classlink\", \"Classlink\"],\n [\"clerk\", \"Clerk\"],\n [\"cloudflare\", \"Cloudflare\"],\n [\"cyberark\", \"CyberArk\"],\n [\"datadog\", \"Datadog\"],\n [\"dropbox\", \"Dropbox\"],\n [\"duo\", \"Duo\"],\n [\"firebase\", \"Firebase\"],\n [\"fourth\", \"Fourth\"],\n [\"generic-saml\", \"Generic SAML\"],\n [\"generic-oidc\", \"Generic OIDC\"],\n [\"github\", \"GitHub\"],\n [\"gitlab\", \"GitLab\"],\n [\"godaddy\", \"GoDaddy\"],\n [\"google\", \"Google\"],\n [\"google-analytics\", \"Google Analytics\"],\n [\"google-calendar\", \"Google Calendar\"],\n [\"google-drive\", \"Google Drive\"],\n [\"google-mail\", \"Google Mail\"],\n [\"google-cloud\", \"Google Cloud\"],\n [\"hibob\", \"
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/identity-providers.ts"],"sourcesContent":["const IDENTITY_PROVIDER_DICT = new Map([\n [\"access-people-hr\", \"Access People HR\"],\n [\"adp\", \"ADP\"],\n [\"apple\", \"Apple\"],\n [\"asana\", \"Asana\"],\n [\"auth0\", \"Auth0\"],\n [\"azure\", \"Azure\"],\n [\"aws\", \"AWS\"],\n [\"bamboohr\", \"BambooHR\"],\n [\"bamboo-hr\", \"BambooHR\"],\n [\"bitbucket\", \"Bitbucket\"],\n [\"box\", \"Box\"],\n [\"breathe-hr\", \"BreatheHR\"],\n [\"bubble\", \"Bubble\"],\n [\"cas\", \"CAS\"],\n [\"cezanne-hr\", \"Cezanne HR\"],\n [\"classlink\", \"Classlink\"],\n [\"clerk\", \"Clerk\"],\n [\"cloudflare\", \"Cloudflare\"],\n [\"cyberark\", \"CyberArk\"],\n [\"datadog\", \"Datadog\"],\n [\"dropbox\", \"Dropbox\"],\n [\"duo\", \"Duo\"],\n [\"firebase\", \"Firebase\"],\n [\"fourth\", \"Fourth\"],\n [\"generic-saml\", \"Generic SAML\"],\n [\"generic-oidc\", \"Generic OIDC\"],\n [\"github\", \"GitHub\"],\n [\"gitlab\", \"GitLab\"],\n [\"godaddy\", \"GoDaddy\"],\n [\"google\", \"Google\"],\n [\"google-analytics\", \"Google Analytics\"],\n [\"google-calendar\", \"Google Calendar\"],\n [\"google-drive\", \"Google Drive\"],\n [\"google-mail\", \"Google Mail\"],\n [\"google-cloud\", \"Google Cloud\"],\n [\"hibob\", \"HiBob\"],\n [\"hubspot\", \"Hubspot\"],\n [\"intercom\", \"Intercom\"],\n [\"intuit\", \"Intuit\"],\n [\"jumpcloud\", \"JumpCloud\"],\n [\"keycloak\", \"Keycloak\"],\n [\"lastpass\", \"LastPass\"],\n [\"linear\", \"Linear\"],\n [\"linkedin\", \"LinkedIn\"],\n [\"login-gov\", \"Login.gov\"],\n [\"microsoft\", \"Microsoft\"],\n [\"miniorange\", \"Miniorange\"],\n [\"net-iq\", \"NetIQ\"],\n [\"next-auth\", \"NextAuth\"],\n [\"notion\", \"Notion\"],\n [\"okta\", \"Okta\"],\n [\"onelogin\", \"OneLogin\"],\n [\"oracle\", \"Oracle\"],\n [\"personio\", \"Personio\"],\n [\"ping-identity\", \"Ping Identity\"],\n [\"react-native-expo\", \"React Native Expo\"],\n [\"rippling\", \"Rippling\"],\n [\"salesforce\", \"Salesforce\"],\n [\"segment\", \"Segment\"],\n [\"shibboleth\", \"Shibboleth\"],\n [\"simple-saml-php\", \"Simple SAML PHP\"],\n [\"slack\", \"Slack\"],\n [\"splunk\", \"Splunk\"],\n [\"stripe\", \"Stripe\"],\n [\"supabase\", \"Supabase\"],\n [\"vercel\", \"Vercel\"],\n [\"vmware\", \"VMware\"],\n [\"workday\", \"Workday\"],\n [\"workos\", \"WorkOS\"],\n [\"xero\", \"Xero\"],\n [\"zendesk\", \"Zendesk\"],\n [\"test-idp\", \"Test IDP\"],\n [\"discord\", \"Discord\"],\n [\"clever\", \"Clever\"],\n] as const);\n\ntype MapKey<T extends Map<unknown, unknown>> =\n T extends Map<infer K, unknown> ? K : never;\n\nexport type IdentityProvider = MapKey<typeof IDENTITY_PROVIDER_DICT>;\n\nexport function getIdentityProviderName(provider: IdentityProvider) {\n return IDENTITY_PROVIDER_DICT.get(provider);\n}\n\n/**\n * Maps DirectoryType values to their corresponding IdentityProvider icon.\n * Used by ProviderIcon to display the correct icon via the data-provider CSS attribute.\n */\nconst DIRECTORY_TYPE_TO_ICON: Record<string, IdentityProvider> = {\n \"azure scim v2.0\": \"azure\",\n bamboohr: \"bamboohr\",\n \"breathe hr\": \"breathe-hr\",\n \"cezanne hr\": \"cezanne-hr\",\n \"cyberark scim v2.0\": \"cyberark\",\n \"fourth hr\": \"fourth\",\n \"generic scim v2.0\": \"workos\",\n \"gsuite directory\": \"google\",\n hibob: \"hibob\",\n \"jump cloud scim v2.0\": \"jumpcloud\",\n \"okta scim v2.0\": \"okta\",\n \"onelogin scim v2.0\": \"onelogin\",\n \"people hr\": \"access-people-hr\",\n personio: \"personio\",\n \"pingfederate scim v2.0\": \"ping-identity\",\n \"rippling scim v2.0\": \"rippling\",\n s3: \"aws\",\n sftp: \"workos\",\n \"sftp workday\": \"workday\",\n workday: \"workday\",\n pending: \"workos\",\n};\n\n/**\n * Maps DirectoryType values to their display names.\n */\nconst DIRECTORY_TYPE_TO_NAME: Record<string, string> = {\n \"azure scim v2.0\": \"Microsoft Entra ID\",\n bamboohr: \"BambooHR\",\n \"breathe hr\": \"Breathe HR\",\n \"cezanne hr\": \"Cezanne HR\",\n \"cyberark scim v2.0\": \"CyberArk\",\n \"fourth hr\": \"Fourth HR\",\n \"generic scim v2.0\": \"Generic SCIM\",\n \"gsuite directory\": \"Google Workspace\",\n hibob: \"HiBob\",\n \"jump cloud scim v2.0\": \"JumpCloud\",\n \"okta scim v2.0\": \"Okta\",\n \"onelogin scim v2.0\": \"OneLogin\",\n \"people hr\": \"People HR\",\n personio: \"Personio\",\n \"pingfederate scim v2.0\": \"PingFederate\",\n \"rippling scim v2.0\": \"Rippling\",\n s3: \"Amazon S3\",\n sftp: \"SFTP\",\n \"sftp workday\": \"Workday (SFTP)\",\n workday: \"Workday\",\n pending: \"Pending\",\n};\n\nexport function getDirectoryTypeIcon(\n directoryType: string,\n): IdentityProvider | null {\n return DIRECTORY_TYPE_TO_ICON[directoryType] ?? null;\n}\n\nexport function getDirectoryTypeName(directoryType: string): string {\n return DIRECTORY_TYPE_TO_NAME[directoryType] ?? directoryType;\n}\n\nexport function isIdentityProvider(provider: unknown) {\n return (\n typeof provider === \"string\" &&\n IDENTITY_PROVIDER_DICT.has(provider as IdentityProvider)\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAAM,yBAAyB,oBAAI,IAAI;AAAA,EACrC,CAAC,oBAAoB,kBAAkB;AAAA,EACvC,CAAC,OAAO,KAAK;AAAA,EACb,CAAC,SAAS,OAAO;AAAA,EACjB,CAAC,SAAS,OAAO;AAAA,EACjB,CAAC,SAAS,OAAO;AAAA,EACjB,CAAC,SAAS,OAAO;AAAA,EACjB,CAAC,OAAO,KAAK;AAAA,EACb,CAAC,YAAY,UAAU;AAAA,EACvB,CAAC,aAAa,UAAU;AAAA,EACxB,CAAC,aAAa,WAAW;AAAA,EACzB,CAAC,OAAO,KAAK;AAAA,EACb,CAAC,cAAc,WAAW;AAAA,EAC1B,CAAC,UAAU,QAAQ;AAAA,EACnB,CAAC,OAAO,KAAK;AAAA,EACb,CAAC,cAAc,YAAY;AAAA,EA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b,qBAAqB;AAAA,EACrB,oBAAoB;AAAA,EACpB,OAAO;AAAA,EACP,wBAAwB;AAAA,EACxB,kBAAkB;AAAA,EAClB,sBAAsB;AAAA,EACtB,aAAa;AAAA,EACb,UAAU;AAAA,EACV,0BAA0B;AAAA,EAC1B,sBAAsB;AAAA,EACtB,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,gBAAgB;AAAA,EAChB,SAAS;AAAA,EACT,SAAS;AACX;AAEO,SAAS,qBACd,eACyB;AACzB,SAAO,uBAAuB,aAAa,KAAK;AAClD;AAEO,SAAS,qBAAqB,eAA+B;AAClE,SAAO,uBAAuB,aAAa,KAAK;AAClD;AAEO,SAAS,mBAAmB,UAAmB;AACpD,SACE,OAAO,aAAa,YACpB,uBAAuB,IAAI,QAA4B;AAE3D;","names":[]}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
declare const IDENTITY_PROVIDER_DICT: Map<"asana" | "box" | "dropbox" | "github" | "gitlab" | "google" | "google-calendar" | "google-drive" | "hubspot" | "intercom" | "linear" | "microsoft" | "notion" | "salesforce" | "slack" | "stripe" | "xero" | "zendesk" | "azure" | "access-people-hr" | "adp" | "apple" | "auth0" | "aws" | "
|
|
1
|
+
declare const IDENTITY_PROVIDER_DICT: Map<"asana" | "box" | "dropbox" | "github" | "gitlab" | "google" | "google-calendar" | "google-drive" | "hubspot" | "intercom" | "linear" | "microsoft" | "notion" | "salesforce" | "slack" | "stripe" | "xero" | "zendesk" | "bamboohr" | "hibob" | "personio" | "rippling" | "workday" | "azure" | "access-people-hr" | "adp" | "apple" | "auth0" | "aws" | "bamboo-hr" | "bitbucket" | "breathe-hr" | "bubble" | "cas" | "cezanne-hr" | "classlink" | "clerk" | "cloudflare" | "cyberark" | "datadog" | "duo" | "firebase" | "fourth" | "generic-saml" | "generic-oidc" | "godaddy" | "google-analytics" | "google-mail" | "google-cloud" | "intuit" | "jumpcloud" | "keycloak" | "lastpass" | "linkedin" | "login-gov" | "miniorange" | "net-iq" | "next-auth" | "okta" | "onelogin" | "oracle" | "ping-identity" | "react-native-expo" | "segment" | "shibboleth" | "simple-saml-php" | "splunk" | "supabase" | "vercel" | "vmware" | "workos" | "test-idp" | "discord" | "clever", "GoDaddy" | "Datadog" | "Splunk" | "Access People HR" | "ADP" | "Apple" | "Asana" | "Auth0" | "Azure" | "AWS" | "BambooHR" | "Bitbucket" | "Box" | "BreatheHR" | "Bubble" | "CAS" | "Cezanne HR" | "Classlink" | "Clerk" | "Cloudflare" | "CyberArk" | "Dropbox" | "Duo" | "Firebase" | "Fourth" | "Generic SAML" | "Generic OIDC" | "GitHub" | "GitLab" | "Google" | "Google Analytics" | "Google Calendar" | "Google Drive" | "Google Mail" | "Google Cloud" | "HiBob" | "Hubspot" | "Intercom" | "Intuit" | "JumpCloud" | "Keycloak" | "LastPass" | "Linear" | "LinkedIn" | "Login.gov" | "Microsoft" | "Miniorange" | "NetIQ" | "NextAuth" | "Notion" | "Okta" | "OneLogin" | "Oracle" | "Personio" | "Ping Identity" | "React Native Expo" | "Rippling" | "Salesforce" | "Segment" | "Shibboleth" | "Simple SAML PHP" | "Slack" | "Stripe" | "Supabase" | "Vercel" | "VMware" | "Workday" | "WorkOS" | "Xero" | "Zendesk" | "Test IDP" | "Discord" | "Clever">;
|
|
2
2
|
type MapKey<T extends Map<unknown, unknown>> = T extends Map<infer K, unknown> ? K : never;
|
|
3
3
|
type IdentityProvider = MapKey<typeof IDENTITY_PROVIDER_DICT>;
|
|
4
|
-
declare function getIdentityProviderName(provider: IdentityProvider): "GoDaddy" | "Access People HR" | "ADP" | "Apple" | "Asana" | "Auth0" | "Azure" | "AWS" | "BambooHR" | "Bitbucket" | "Box" | "BreatheHR" | "Bubble" | "CAS" | "Cezanne HR" | "Classlink" | "Clerk" | "Cloudflare" | "CyberArk" | "
|
|
4
|
+
declare function getIdentityProviderName(provider: IdentityProvider): "GoDaddy" | "Datadog" | "Splunk" | "Access People HR" | "ADP" | "Apple" | "Asana" | "Auth0" | "Azure" | "AWS" | "BambooHR" | "Bitbucket" | "Box" | "BreatheHR" | "Bubble" | "CAS" | "Cezanne HR" | "Classlink" | "Clerk" | "Cloudflare" | "CyberArk" | "Dropbox" | "Duo" | "Firebase" | "Fourth" | "Generic SAML" | "Generic OIDC" | "GitHub" | "GitLab" | "Google" | "Google Analytics" | "Google Calendar" | "Google Drive" | "Google Mail" | "Google Cloud" | "HiBob" | "Hubspot" | "Intercom" | "Intuit" | "JumpCloud" | "Keycloak" | "LastPass" | "Linear" | "LinkedIn" | "Login.gov" | "Microsoft" | "Miniorange" | "NetIQ" | "NextAuth" | "Notion" | "Okta" | "OneLogin" | "Oracle" | "Personio" | "Ping Identity" | "React Native Expo" | "Rippling" | "Salesforce" | "Segment" | "Shibboleth" | "Simple SAML PHP" | "Slack" | "Stripe" | "Supabase" | "Vercel" | "VMware" | "Workday" | "WorkOS" | "Xero" | "Zendesk" | "Test IDP" | "Discord" | "Clever" | undefined;
|
|
5
|
+
declare function getDirectoryTypeIcon(directoryType: string): IdentityProvider | null;
|
|
6
|
+
declare function getDirectoryTypeName(directoryType: string): string;
|
|
5
7
|
declare function isIdentityProvider(provider: unknown): boolean;
|
|
6
8
|
|
|
7
|
-
export { type IdentityProvider, getIdentityProviderName, isIdentityProvider };
|
|
9
|
+
export { type IdentityProvider, getDirectoryTypeIcon, getDirectoryTypeName, getIdentityProviderName, isIdentityProvider };
|
package/dist/cjs/lib/pipes.cjs
CHANGED
|
@@ -317,8 +317,8 @@ function ProviderStatus({ integration }) {
|
|
|
317
317
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
318
318
|
DisconnectAccountDialog,
|
|
319
319
|
{
|
|
320
|
-
integration,
|
|
321
|
-
|
|
320
|
+
integrationName: integration.name,
|
|
321
|
+
installationId: integration.installation.id,
|
|
322
322
|
open: disconnectOpen,
|
|
323
323
|
onOpenChange: setDisconnectOpen
|
|
324
324
|
}
|
|
@@ -327,8 +327,8 @@ function ProviderStatus({ integration }) {
|
|
|
327
327
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
328
328
|
import_status.Status,
|
|
329
329
|
{
|
|
330
|
-
state: integration.installation.state ===
|
|
331
|
-
children: integration.installation.state ===
|
|
330
|
+
state: integration.installation.state === "connected" ? "success" : "error",
|
|
331
|
+
children: integration.installation.state === "connected" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
332
332
|
import_translation.Translation,
|
|
333
333
|
{
|
|
334
334
|
defaultMessage: "Connected",
|
|
@@ -348,7 +348,7 @@ function ProviderStatus({ integration }) {
|
|
|
348
348
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_elements.DropdownMenu.Root, { children: [
|
|
349
349
|
/* @__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, {}) }) }),
|
|
350
350
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_elements.DropdownMenu.Content, { align: "end", children: [
|
|
351
|
-
integration.installation.state ===
|
|
351
|
+
integration.installation.state === "needs_reauthorization" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
352
352
|
import_elements.DropdownMenu.Item,
|
|
353
353
|
{
|
|
354
354
|
onClick: async () => {
|
|
@@ -397,8 +397,8 @@ function ProviderStatus({ integration }) {
|
|
|
397
397
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConnectIntegrationButton, { integration });
|
|
398
398
|
}
|
|
399
399
|
function DisconnectAccountDialog({
|
|
400
|
-
|
|
401
|
-
|
|
400
|
+
integrationName,
|
|
401
|
+
installationId,
|
|
402
402
|
open,
|
|
403
403
|
onOpenChange
|
|
404
404
|
}) {
|
|
@@ -447,7 +447,7 @@ function DisconnectAccountDialog({
|
|
|
447
447
|
id: "eEXeqP",
|
|
448
448
|
description: "Confirmation message for disconnecting an account",
|
|
449
449
|
values: {
|
|
450
|
-
integrationName: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_themes.Text, { as: "span", weight: "bold", children:
|
|
450
|
+
integrationName: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_themes.Text, { as: "span", weight: "bold", children: integrationName })
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
453
|
) }),
|
|
@@ -466,7 +466,7 @@ function DisconnectAccountDialog({
|
|
|
466
466
|
variant: "destructive",
|
|
467
467
|
disabled: isPending,
|
|
468
468
|
loading: isPending,
|
|
469
|
-
onClick: () => deleteDataInstallation({ installationId
|
|
469
|
+
onClick: () => deleteDataInstallation({ installationId }),
|
|
470
470
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
471
471
|
import_translation.Translation,
|
|
472
472
|
{
|