@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,259 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Box, Card, Flex, Spinner, Text } from "@radix-ui/themes";
|
|
5
|
+
import { ExternalLinkIcon, InfoCircledIcon } from "@radix-ui/react-icons";
|
|
6
|
+
import { Button, Skeleton } from "./elements.js";
|
|
7
|
+
import { GenericError } from "./generic-error.js";
|
|
8
|
+
import * as CardList from "./card-list.js";
|
|
9
|
+
import { IconPanel } from "./icon-panel.js";
|
|
10
|
+
import { ProviderIcon } from "./provider-icon.js";
|
|
11
|
+
import {
|
|
12
|
+
getDirectoryTypeIcon,
|
|
13
|
+
getDirectoryTypeName
|
|
14
|
+
} from "./identity-providers.js";
|
|
15
|
+
import { Status } from "./status.js";
|
|
16
|
+
import { Translation } from "./i18n/translation.js";
|
|
17
|
+
import {
|
|
18
|
+
getDomProps
|
|
19
|
+
} from "./utils.js";
|
|
20
|
+
import {
|
|
21
|
+
DirectoryState
|
|
22
|
+
} from "../api/endpoint.js";
|
|
23
|
+
const DirectorySyncContext = React.createContext(null);
|
|
24
|
+
DirectorySyncContext.displayName = "DirectorySyncContext";
|
|
25
|
+
function useDirectorySyncContext() {
|
|
26
|
+
const context = React.useContext(DirectorySyncContext);
|
|
27
|
+
if (!context) {
|
|
28
|
+
throw new Error(
|
|
29
|
+
"useDirectorySyncContext must be used within a DirectorySyncContext provider"
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
return context;
|
|
33
|
+
}
|
|
34
|
+
function DirectoryProviderInfo({
|
|
35
|
+
type,
|
|
36
|
+
subtitle
|
|
37
|
+
}) {
|
|
38
|
+
return /* @__PURE__ */ jsxs(Flex, { gap: "4", align: "center", children: [
|
|
39
|
+
/* @__PURE__ */ jsx(IconPanel, { color: "panel", children: /* @__PURE__ */ jsx(
|
|
40
|
+
ProviderIcon,
|
|
41
|
+
{
|
|
42
|
+
provider: getDirectoryTypeIcon(type) ?? "workos",
|
|
43
|
+
size: "2"
|
|
44
|
+
}
|
|
45
|
+
) }),
|
|
46
|
+
subtitle ? /* @__PURE__ */ jsxs(Flex, { direction: "column", children: [
|
|
47
|
+
/* @__PURE__ */ jsx(Text, { size: "2", weight: "bold", children: getDirectoryTypeName(type) }),
|
|
48
|
+
subtitle
|
|
49
|
+
] }) : /* @__PURE__ */ jsx(Text, { size: "2", weight: "bold", children: getDirectoryTypeName(type) })
|
|
50
|
+
] });
|
|
51
|
+
}
|
|
52
|
+
function SpinnerMessage({ children }) {
|
|
53
|
+
return /* @__PURE__ */ jsxs(Flex, { gap: "2", align: "center", children: [
|
|
54
|
+
/* @__PURE__ */ jsx(Spinner, {}),
|
|
55
|
+
/* @__PURE__ */ jsx(Text, { size: "2", color: "gray", children })
|
|
56
|
+
] });
|
|
57
|
+
}
|
|
58
|
+
function getStatusBadge(state) {
|
|
59
|
+
switch (state) {
|
|
60
|
+
case DirectoryState.requires_type:
|
|
61
|
+
case DirectoryState.invalid_credentials:
|
|
62
|
+
return /* @__PURE__ */ jsx(Status, { state: "error", children: /* @__PURE__ */ jsx(
|
|
63
|
+
Translation,
|
|
64
|
+
{
|
|
65
|
+
defaultMessage: "Requires action",
|
|
66
|
+
id: "uuuXIF",
|
|
67
|
+
description: "Status badge when directory requires user action"
|
|
68
|
+
}
|
|
69
|
+
) });
|
|
70
|
+
case DirectoryState.linked:
|
|
71
|
+
return /* @__PURE__ */ jsx(Status, { state: "success", children: /* @__PURE__ */ jsx(
|
|
72
|
+
Translation,
|
|
73
|
+
{
|
|
74
|
+
defaultMessage: "Connected",
|
|
75
|
+
id: "H/dAHq",
|
|
76
|
+
description: "Status badge when directory is active"
|
|
77
|
+
}
|
|
78
|
+
) });
|
|
79
|
+
default:
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function getSpinnerMessage(state, hasType) {
|
|
84
|
+
if (state === DirectoryState.unlinked && hasType)
|
|
85
|
+
return "Setup in progress...";
|
|
86
|
+
if (state === DirectoryState.validating)
|
|
87
|
+
return "Waiting for users and groups...";
|
|
88
|
+
if (state === DirectoryState.deleting) return "Deleting directory...";
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
const DirectorySync = ({
|
|
92
|
+
state,
|
|
93
|
+
className,
|
|
94
|
+
...rest
|
|
95
|
+
}) => {
|
|
96
|
+
const type = "type" in rest ? rest.type : void 0;
|
|
97
|
+
const errorMessage = "errorMessage" in rest ? rest.errorMessage : void 0;
|
|
98
|
+
const metadata = "metadata" in rest ? rest.metadata : void 0;
|
|
99
|
+
const link = "link" in rest ? rest.link : void 0;
|
|
100
|
+
const userCount = metadata?.users.active ?? 0;
|
|
101
|
+
const groupCount = metadata?.groups ?? 0;
|
|
102
|
+
const lastSyncAt = rest.lastSyncAt ? new Date(rest.lastSyncAt) : null;
|
|
103
|
+
const currentDate = "currentDate" in rest && rest.currentDate instanceof Date ? rest.currentDate : void 0;
|
|
104
|
+
const lastSyncString = lastSyncAt ? getRelativeTimeString(currentDate ?? /* @__PURE__ */ new Date(), lastSyncAt) : null;
|
|
105
|
+
const showCounts = state === DirectoryState.linked || state === DirectoryState.invalid_credentials || state === DirectoryState.deleting;
|
|
106
|
+
const statusBadge = getStatusBadge(state);
|
|
107
|
+
const spinnerMessage = getSpinnerMessage(state, !!type);
|
|
108
|
+
const showButton = state !== DirectoryState.deleting;
|
|
109
|
+
const domProps = { className };
|
|
110
|
+
const countsSubtitle = showCounts ? /* @__PURE__ */ jsxs(Text, { size: "2", color: "gray", children: [
|
|
111
|
+
/* @__PURE__ */ jsx(
|
|
112
|
+
Translation,
|
|
113
|
+
{
|
|
114
|
+
defaultMessage: "{userCount} {userLabel}",
|
|
115
|
+
id: "aZxx55",
|
|
116
|
+
description: "Directory sync user and group counts",
|
|
117
|
+
values: {
|
|
118
|
+
userCount,
|
|
119
|
+
userLabel: userCount !== 1 ? "users" : "user"
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
),
|
|
123
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, children: " \u2219 " }),
|
|
124
|
+
/* @__PURE__ */ jsx(
|
|
125
|
+
Translation,
|
|
126
|
+
{
|
|
127
|
+
defaultMessage: "{groupCount} {groupLabel}",
|
|
128
|
+
id: "SgiDio",
|
|
129
|
+
description: "Directory sync group count",
|
|
130
|
+
values: {
|
|
131
|
+
groupCount,
|
|
132
|
+
groupLabel: groupCount !== 1 ? "groups" : "group"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
),
|
|
136
|
+
lastSyncString && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
137
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, children: " \u2219 " }),
|
|
138
|
+
/* @__PURE__ */ jsx(
|
|
139
|
+
Translation,
|
|
140
|
+
{
|
|
141
|
+
defaultMessage: "Last sync {lastSync}",
|
|
142
|
+
id: "UUqjnE",
|
|
143
|
+
description: "Last sync timestamp for directory",
|
|
144
|
+
values: { lastSync: lastSyncString }
|
|
145
|
+
}
|
|
146
|
+
)
|
|
147
|
+
] })
|
|
148
|
+
] }) : null;
|
|
149
|
+
return /* @__PURE__ */ jsx(CardList.Root, { ...getWidgetRootDomProps("resolved", domProps), children: /* @__PURE__ */ jsxs(DirectorySyncContext.Provider, { value: { state, type }, children: [
|
|
150
|
+
/* @__PURE__ */ jsx(CardList.Item, { children: /* @__PURE__ */ jsx(Flex, { direction: "row", justify: "between", align: "center", gap: "2", children: !type ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
151
|
+
/* @__PURE__ */ jsx(Text, { size: "2", color: "gray", children: /* @__PURE__ */ jsx(
|
|
152
|
+
Translation,
|
|
153
|
+
{
|
|
154
|
+
defaultMessage: "You haven't set up a directory yet.",
|
|
155
|
+
id: "+ywYVl",
|
|
156
|
+
description: "Empty state message when no directory is configured"
|
|
157
|
+
}
|
|
158
|
+
) }),
|
|
159
|
+
/* @__PURE__ */ jsx(AdminPortalOpenButton, { href: link ?? null })
|
|
160
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
161
|
+
/* @__PURE__ */ jsx(DirectoryProviderInfo, { type, subtitle: countsSubtitle }),
|
|
162
|
+
/* @__PURE__ */ jsxs(Flex, { gap: "5", align: "center", children: [
|
|
163
|
+
statusBadge,
|
|
164
|
+
spinnerMessage && /* @__PURE__ */ jsx(SpinnerMessage, { children: spinnerMessage }),
|
|
165
|
+
showButton && /* @__PURE__ */ jsx(AdminPortalOpenButton, { href: link ?? null })
|
|
166
|
+
] })
|
|
167
|
+
] }) }) }),
|
|
168
|
+
errorMessage && /* @__PURE__ */ jsx(CardList.Item, { children: /* @__PURE__ */ jsxs(Flex, { align: "start", gap: "2", children: [
|
|
169
|
+
/* @__PURE__ */ jsx(Box, { asChild: true, mt: "2px", flexShrink: "0", children: /* @__PURE__ */ jsx(InfoCircledIcon, { color: "var(--gray-11)" }) }),
|
|
170
|
+
/* @__PURE__ */ jsx(Text, { size: "2", color: "gray", children: errorMessage })
|
|
171
|
+
] }) })
|
|
172
|
+
] }) });
|
|
173
|
+
};
|
|
174
|
+
function AdminPortalOpenButton({
|
|
175
|
+
href,
|
|
176
|
+
children
|
|
177
|
+
}) {
|
|
178
|
+
const { state, type } = useDirectorySyncContext();
|
|
179
|
+
const label = (() => {
|
|
180
|
+
switch (state) {
|
|
181
|
+
case DirectoryState.unlinked:
|
|
182
|
+
return type ? "Continue setup" : "Set up directory";
|
|
183
|
+
case DirectoryState.validating:
|
|
184
|
+
return "Manage";
|
|
185
|
+
default:
|
|
186
|
+
return "Manage";
|
|
187
|
+
}
|
|
188
|
+
})();
|
|
189
|
+
if (href) {
|
|
190
|
+
return /* @__PURE__ */ jsx(Button, { variant: "secondary", asChild: true, children: /* @__PURE__ */ jsxs("a", { href, target: "_blank", rel: "noopener noreferrer", children: [
|
|
191
|
+
children ?? label,
|
|
192
|
+
" ",
|
|
193
|
+
/* @__PURE__ */ jsx(ExternalLinkIcon, { "aria-hidden": true })
|
|
194
|
+
] }) });
|
|
195
|
+
}
|
|
196
|
+
return /* @__PURE__ */ jsxs(Button, { variant: "secondary", disabled: true, children: [
|
|
197
|
+
children ?? label,
|
|
198
|
+
" ",
|
|
199
|
+
/* @__PURE__ */ jsx(ExternalLinkIcon, { "aria-hidden": true })
|
|
200
|
+
] });
|
|
201
|
+
}
|
|
202
|
+
const DirectorySyncLoading = (props) => {
|
|
203
|
+
return /* @__PURE__ */ jsx(Card, { size: "2", ...getWidgetRootDomProps("loading", props), children: /* @__PURE__ */ jsxs(Flex, { direction: "row", justify: "between", align: "center", gap: "2", children: [
|
|
204
|
+
/* @__PURE__ */ jsx(Skeleton, { children: /* @__PURE__ */ jsx(Text, { size: "2", color: "gray", children: "You haven't set up a directory yet." }) }),
|
|
205
|
+
/* @__PURE__ */ jsx(Skeleton, { children: /* @__PURE__ */ jsxs(Button, { variant: "secondary", children: [
|
|
206
|
+
"Set up directory ",
|
|
207
|
+
/* @__PURE__ */ jsx(ExternalLinkIcon, { "aria-hidden": true })
|
|
208
|
+
] }) })
|
|
209
|
+
] }) });
|
|
210
|
+
};
|
|
211
|
+
const DirectorySyncError = ({
|
|
212
|
+
error,
|
|
213
|
+
...domProps
|
|
214
|
+
}) => {
|
|
215
|
+
return /* @__PURE__ */ jsx(Card, { size: "2", ...getWidgetRootDomProps("error", domProps), children: /* @__PURE__ */ jsx(GenericError, { error }) });
|
|
216
|
+
};
|
|
217
|
+
function getWidgetRootDomProps(state, domProps) {
|
|
218
|
+
return getDomProps({
|
|
219
|
+
...domProps,
|
|
220
|
+
isWidgetRoot: true,
|
|
221
|
+
widgetId: "directory-sync",
|
|
222
|
+
widgetState: state
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
function getRelativeTimeString(currentDate, lastSync) {
|
|
226
|
+
if (!currentDate || !lastSync) {
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
const rtf = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
|
|
230
|
+
const diff = lastSync.getTime() - currentDate.getTime();
|
|
231
|
+
const diffSeconds = Math.round(diff / 1e3);
|
|
232
|
+
const diffMinutes = Math.round(diffSeconds / 60);
|
|
233
|
+
const diffHours = Math.round(diffMinutes / 60);
|
|
234
|
+
const diffDays = Math.round(diffHours / 24);
|
|
235
|
+
const diffMonths = Math.round(diffDays / 30);
|
|
236
|
+
const diffYears = Math.round(diffMonths / 12);
|
|
237
|
+
if (Math.abs(diffSeconds) < 60) {
|
|
238
|
+
return "now";
|
|
239
|
+
}
|
|
240
|
+
if (Math.abs(diffMinutes) < 60) {
|
|
241
|
+
return rtf.format(diffMinutes, "minute");
|
|
242
|
+
}
|
|
243
|
+
if (Math.abs(diffHours) < 24) {
|
|
244
|
+
return rtf.format(diffHours, "hour");
|
|
245
|
+
}
|
|
246
|
+
if (Math.abs(diffDays) < 30) {
|
|
247
|
+
return rtf.format(diffDays, "day");
|
|
248
|
+
}
|
|
249
|
+
if (Math.abs(diffMonths) < 12) {
|
|
250
|
+
return rtf.format(diffMonths, "month");
|
|
251
|
+
}
|
|
252
|
+
return rtf.format(diffYears, "year");
|
|
253
|
+
}
|
|
254
|
+
export {
|
|
255
|
+
DirectorySync,
|
|
256
|
+
DirectorySyncError,
|
|
257
|
+
DirectorySyncLoading
|
|
258
|
+
};
|
|
259
|
+
//# sourceMappingURL=directory-sync.js.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":";AA+HQ,SAsIA,UAtIA,KAMA,YANA;AA7HR,YAAY,WAAW;AACvB,SAAS,KAAK,MAAM,MAAM,SAAS,YAAY;AAC/C,SAAS,kBAAkB,uBAAuB;AAClD,SAAS,QAAQ,gBAAgB;AACjC,SAAS,oBAAoB;AAC7B,YAAY,cAAc;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,oBAAoB;AAC7B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAc;AACvB,SAAS,mBAAmB;AAC5B;AAAA,EACE;AAAA,OAGK;AACP;AAAA,EAEE;AAAA,OAEK;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;AA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AAe,CAAC,UAAU;AAC7B,WAAO;AAAA,EACT;AAEA,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":[]}
|
|
@@ -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 };
|
|
@@ -34,7 +34,7 @@ const IDENTITY_PROVIDER_DICT = /* @__PURE__ */ new Map([
|
|
|
34
34
|
["google-drive", "Google Drive"],
|
|
35
35
|
["google-mail", "Google Mail"],
|
|
36
36
|
["google-cloud", "Google Cloud"],
|
|
37
|
-
["hibob", "
|
|
37
|
+
["hibob", "HiBob"],
|
|
38
38
|
["hubspot", "Hubspot"],
|
|
39
39
|
["intercom", "Intercom"],
|
|
40
40
|
["intuit", "Intuit"],
|
|
@@ -77,10 +77,64 @@ const IDENTITY_PROVIDER_DICT = /* @__PURE__ */ new Map([
|
|
|
77
77
|
function getIdentityProviderName(provider) {
|
|
78
78
|
return IDENTITY_PROVIDER_DICT.get(provider);
|
|
79
79
|
}
|
|
80
|
+
const DIRECTORY_TYPE_TO_ICON = {
|
|
81
|
+
"azure scim v2.0": "azure",
|
|
82
|
+
bamboohr: "bamboohr",
|
|
83
|
+
"breathe hr": "breathe-hr",
|
|
84
|
+
"cezanne hr": "cezanne-hr",
|
|
85
|
+
"cyberark scim v2.0": "cyberark",
|
|
86
|
+
"fourth hr": "fourth",
|
|
87
|
+
"generic scim v2.0": "workos",
|
|
88
|
+
"gsuite directory": "google",
|
|
89
|
+
hibob: "hibob",
|
|
90
|
+
"jump cloud scim v2.0": "jumpcloud",
|
|
91
|
+
"okta scim v2.0": "okta",
|
|
92
|
+
"onelogin scim v2.0": "onelogin",
|
|
93
|
+
"people hr": "access-people-hr",
|
|
94
|
+
personio: "personio",
|
|
95
|
+
"pingfederate scim v2.0": "ping-identity",
|
|
96
|
+
"rippling scim v2.0": "rippling",
|
|
97
|
+
s3: "aws",
|
|
98
|
+
sftp: "workos",
|
|
99
|
+
"sftp workday": "workday",
|
|
100
|
+
workday: "workday",
|
|
101
|
+
pending: "workos"
|
|
102
|
+
};
|
|
103
|
+
const DIRECTORY_TYPE_TO_NAME = {
|
|
104
|
+
"azure scim v2.0": "Microsoft Entra ID",
|
|
105
|
+
bamboohr: "BambooHR",
|
|
106
|
+
"breathe hr": "Breathe HR",
|
|
107
|
+
"cezanne hr": "Cezanne HR",
|
|
108
|
+
"cyberark scim v2.0": "CyberArk",
|
|
109
|
+
"fourth hr": "Fourth HR",
|
|
110
|
+
"generic scim v2.0": "Generic SCIM",
|
|
111
|
+
"gsuite directory": "Google Workspace",
|
|
112
|
+
hibob: "HiBob",
|
|
113
|
+
"jump cloud scim v2.0": "JumpCloud",
|
|
114
|
+
"okta scim v2.0": "Okta",
|
|
115
|
+
"onelogin scim v2.0": "OneLogin",
|
|
116
|
+
"people hr": "People HR",
|
|
117
|
+
personio: "Personio",
|
|
118
|
+
"pingfederate scim v2.0": "PingFederate",
|
|
119
|
+
"rippling scim v2.0": "Rippling",
|
|
120
|
+
s3: "Amazon S3",
|
|
121
|
+
sftp: "SFTP",
|
|
122
|
+
"sftp workday": "Workday (SFTP)",
|
|
123
|
+
workday: "Workday",
|
|
124
|
+
pending: "Pending"
|
|
125
|
+
};
|
|
126
|
+
function getDirectoryTypeIcon(directoryType) {
|
|
127
|
+
return DIRECTORY_TYPE_TO_ICON[directoryType] ?? null;
|
|
128
|
+
}
|
|
129
|
+
function getDirectoryTypeName(directoryType) {
|
|
130
|
+
return DIRECTORY_TYPE_TO_NAME[directoryType] ?? directoryType;
|
|
131
|
+
}
|
|
80
132
|
function isIdentityProvider(provider) {
|
|
81
133
|
return typeof provider === "string" && IDENTITY_PROVIDER_DICT.has(provider);
|
|
82
134
|
}
|
|
83
135
|
export {
|
|
136
|
+
getDirectoryTypeIcon,
|
|
137
|
+
getDirectoryTypeName,
|
|
84
138
|
getIdentityProviderName,
|
|
85
139
|
isIdentityProvider
|
|
86
140
|
};
|
|
@@ -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,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,EAC3B,CAAC,aAAa,WAAW;AAAA,EACzB,CAAC,SAAS,OAAO;AAAA,EACjB,CAAC,cAAc,YAAY;AAAA,EAC3B,CAAC,YAAY,UAAU;A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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":[]}
|
package/dist/esm/lib/pipes.js
CHANGED
|
@@ -24,7 +24,6 @@ import {
|
|
|
24
24
|
useDeleteDataInstallation,
|
|
25
25
|
useGetDataIntegrationAuthorizeUrlHook,
|
|
26
26
|
getMyDataIntegrationsQueryKey,
|
|
27
|
-
DataInstallationState,
|
|
28
27
|
useSettings
|
|
29
28
|
} from "../api/endpoint.js";
|
|
30
29
|
import { useQueryClient } from "@tanstack/react-query";
|
|
@@ -300,8 +299,8 @@ function ProviderStatus({ integration }) {
|
|
|
300
299
|
/* @__PURE__ */ jsx(
|
|
301
300
|
DisconnectAccountDialog,
|
|
302
301
|
{
|
|
303
|
-
integration,
|
|
304
|
-
|
|
302
|
+
integrationName: integration.name,
|
|
303
|
+
installationId: integration.installation.id,
|
|
305
304
|
open: disconnectOpen,
|
|
306
305
|
onOpenChange: setDisconnectOpen
|
|
307
306
|
}
|
|
@@ -310,8 +309,8 @@ function ProviderStatus({ integration }) {
|
|
|
310
309
|
/* @__PURE__ */ jsx(
|
|
311
310
|
Status,
|
|
312
311
|
{
|
|
313
|
-
state: integration.installation.state ===
|
|
314
|
-
children: integration.installation.state ===
|
|
312
|
+
state: integration.installation.state === "connected" ? "success" : "error",
|
|
313
|
+
children: integration.installation.state === "connected" ? /* @__PURE__ */ jsx(
|
|
315
314
|
Translation,
|
|
316
315
|
{
|
|
317
316
|
defaultMessage: "Connected",
|
|
@@ -331,7 +330,7 @@ function ProviderStatus({ integration }) {
|
|
|
331
330
|
/* @__PURE__ */ jsxs(DropdownMenu.Root, { children: [
|
|
332
331
|
/* @__PURE__ */ jsx(DropdownMenu.Trigger, { children: /* @__PURE__ */ jsx(IconButton, { title: pipeActionsTitle, children: /* @__PURE__ */ jsx(DotsHorizontalIcon, {}) }) }),
|
|
333
332
|
/* @__PURE__ */ jsxs(DropdownMenu.Content, { align: "end", children: [
|
|
334
|
-
integration.installation.state ===
|
|
333
|
+
integration.installation.state === "needs_reauthorization" && /* @__PURE__ */ jsx(
|
|
335
334
|
DropdownMenu.Item,
|
|
336
335
|
{
|
|
337
336
|
onClick: async () => {
|
|
@@ -380,8 +379,8 @@ function ProviderStatus({ integration }) {
|
|
|
380
379
|
return /* @__PURE__ */ jsx(ConnectIntegrationButton, { integration });
|
|
381
380
|
}
|
|
382
381
|
function DisconnectAccountDialog({
|
|
383
|
-
|
|
384
|
-
|
|
382
|
+
integrationName,
|
|
383
|
+
installationId,
|
|
385
384
|
open,
|
|
386
385
|
onOpenChange
|
|
387
386
|
}) {
|
|
@@ -430,7 +429,7 @@ function DisconnectAccountDialog({
|
|
|
430
429
|
id: "eEXeqP",
|
|
431
430
|
description: "Confirmation message for disconnecting an account",
|
|
432
431
|
values: {
|
|
433
|
-
integrationName: /* @__PURE__ */ jsx(Text, { as: "span", weight: "bold", children:
|
|
432
|
+
integrationName: /* @__PURE__ */ jsx(Text, { as: "span", weight: "bold", children: integrationName })
|
|
434
433
|
}
|
|
435
434
|
}
|
|
436
435
|
) }),
|
|
@@ -449,7 +448,7 @@ function DisconnectAccountDialog({
|
|
|
449
448
|
variant: "destructive",
|
|
450
449
|
disabled: isPending,
|
|
451
450
|
loading: isPending,
|
|
452
|
-
onClick: () => deleteDataInstallation({ installationId
|
|
451
|
+
onClick: () => deleteDataInstallation({ installationId }),
|
|
453
452
|
children: /* @__PURE__ */ jsx(
|
|
454
453
|
Translation,
|
|
455
454
|
{
|