@burdenoff/microfe-buildmyiq 2026.1107.3 → 2026.1107.4
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/dist/buildmyiq/hooks/useHrisDirectorySync.d.ts +21 -0
- package/dist/buildmyiq/hooks/useHrisDirectorySync.d.ts.map +1 -0
- package/dist/buildmyiq/hooks/useHrisDirectorySync.js +141 -0
- package/dist/buildmyiq/hooks/useHrisDirectorySync.js.map +1 -0
- package/dist/buildmyiq/pages/provisioning/HrisConnectorsCard.d.ts +3 -0
- package/dist/buildmyiq/pages/provisioning/HrisConnectorsCard.d.ts.map +1 -0
- package/dist/buildmyiq/pages/provisioning/HrisConnectorsCard.js +428 -0
- package/dist/buildmyiq/pages/provisioning/HrisConnectorsCard.js.map +1 -0
- package/dist/buildmyiq/pages/provisioning/ProvisioningPage.d.ts.map +1 -1
- package/dist/buildmyiq/pages/provisioning/ProvisioningPage.js +110 -108
- package/dist/buildmyiq/pages/provisioning/ProvisioningPage.js.map +1 -1
- package/dist/buildmyiq/pages/provisioning/hrisModel.d.ts +100 -0
- package/dist/buildmyiq/pages/provisioning/hrisModel.d.ts.map +1 -0
- package/dist/buildmyiq/pages/provisioning/hrisModel.js +193 -0
- package/dist/buildmyiq/pages/provisioning/hrisModel.js.map +1 -0
- package/dist/buildmyiq/pages/provisioning/provisioningModel.d.ts.map +1 -1
- package/dist/buildmyiq/pages/provisioning/provisioningModel.js +4 -0
- package/dist/buildmyiq/pages/provisioning/provisioningModel.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { HrisConnectionSummary, HrisDirectorySyncStatus, HrisProviderKey, HrisSyncRun } from '../pages/provisioning/hrisModel';
|
|
2
|
+
/** The workspace's connections for one HR system (null when the provider is not available). */
|
|
3
|
+
export declare function useHrisConnections(key: HrisProviderKey): import('@tanstack/react-query').UseQueryResult<HrisConnectionSummary[] | null, unknown>;
|
|
4
|
+
export declare function useHrisStatus(connectionId: string): import('@tanstack/react-query').UseQueryResult<HrisDirectorySyncStatus, unknown>;
|
|
5
|
+
/** Creates the connection and saves its credentials; removes the connection again if they are refused. */
|
|
6
|
+
export declare function useConnectHris(key: HrisProviderKey): import('@tanstack/react-query').UseMutationResult<string, Error, {
|
|
7
|
+
name: string;
|
|
8
|
+
values: Record<string, string>;
|
|
9
|
+
}, unknown>;
|
|
10
|
+
/** Replaces the credentials of an existing connection. A new preview is needed afterwards. */
|
|
11
|
+
export declare function useUpdateHrisCredentials(connectionId: string): import('@tanstack/react-query').UseMutationResult<void, Error, Record<string, string>, unknown>;
|
|
12
|
+
export declare function useDeleteHrisConnection(key: HrisProviderKey): import('@tanstack/react-query').UseMutationResult<void, Error, string, unknown>;
|
|
13
|
+
export declare function useStartHrisSync(connectionId: string): import('@tanstack/react-query').UseMutationResult<HrisSyncRun, Error, {
|
|
14
|
+
mode: "PREVIEW" | "APPLY";
|
|
15
|
+
allowMassDeactivation?: boolean;
|
|
16
|
+
}, unknown>;
|
|
17
|
+
export declare function useSetHrisSchedule(connectionId: string): import('@tanstack/react-query').UseMutationResult<void, Error, {
|
|
18
|
+
enabled: boolean;
|
|
19
|
+
intervalHours: number;
|
|
20
|
+
}, unknown>;
|
|
21
|
+
//# sourceMappingURL=useHrisDirectorySync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHrisDirectorySync.d.ts","sourceRoot":"","sources":["../../../src/buildmyiq/hooks/useHrisDirectorySync.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAQH,OAAO,KAAK,EACV,qBAAqB,EACrB,uBAAuB,EACvB,eAAe,EACf,WAAW,EACZ,MAAM,iCAAiC,CAAC;AAgDzC,+FAA+F;AAC/F,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,eAAe,2FAsBtD;AAED,wBAAgB,aAAa,CAAC,YAAY,EAAE,MAAM,oFAgBjD;AAED,0GAA0G;AAC1G,wBAAgB,cAAc,CAAC,GAAG,EAAE,eAAe;UAIZ,MAAM;YAAU,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;YAyB5E;AAED,8FAA8F;AAC9F,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,MAAM,mGAc5D;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,eAAe,mFAa3D;AAED,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM;UAId,SAAS,GAAG,OAAO;4BAA0B,OAAO;YAiB1F;AAED,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM;aAIb,OAAO;mBAAiB,MAAM;YAYvE"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { useBuildmyiq as e } from "../context/BuildmyiqContext.js";
|
|
2
|
+
import "../context/index.js";
|
|
3
|
+
import { clearGraphqlReadCaches as t } from "./useBuildmyiqApi.js";
|
|
4
|
+
import { ProvisioningApiError as n, isPermissionError as r } from "../pages/provisioning/provisioningModel.js";
|
|
5
|
+
import { useMutation as i, useQuery as a, useQueryClient as o } from "@tanstack/react-query";
|
|
6
|
+
import { graphqlFetch as s } from "@burdenoff/fe-libs/shared/graphql";
|
|
7
|
+
//#region src/buildmyiq/hooks/useHrisDirectorySync.ts
|
|
8
|
+
var c = "id connectionId mode trigger status workersFetched created updated deactivated reactivated\n unchanged skipped conflicts errors errorCode errorMessage startedBy startedAt finishedAt\n items { externalId email action userId detail }", l = `connectionId providerKey connectionStatus credentialsUpdatedAt scheduleEnabled intervalHours
|
|
9
|
+
nextRunAt canApply lastPreview { ${c} } lastApply { ${c} } running { ${c} }`, u = async (e, r) => {
|
|
10
|
+
let i = await s({
|
|
11
|
+
gateway: "workspace",
|
|
12
|
+
query: e,
|
|
13
|
+
variables: r,
|
|
14
|
+
suppressGlobalErrorEvent: !0
|
|
15
|
+
});
|
|
16
|
+
if (i.errors?.length) {
|
|
17
|
+
let e = i.errors[0], t = e?.extensions?.code;
|
|
18
|
+
throw new n(e?.message ?? "GraphQL request failed", typeof t == "string" ? t : void 0);
|
|
19
|
+
}
|
|
20
|
+
if (!i.data) throw new n("GraphQL response did not include data");
|
|
21
|
+
return /^\s*mutation\b/.test(e) && t(), i.data;
|
|
22
|
+
}, d = (e, t) => [
|
|
23
|
+
"buildmyiq",
|
|
24
|
+
"hrisConnections",
|
|
25
|
+
e,
|
|
26
|
+
t
|
|
27
|
+
], f = (e, t) => [
|
|
28
|
+
"buildmyiq",
|
|
29
|
+
"hrisStatus",
|
|
30
|
+
e,
|
|
31
|
+
t
|
|
32
|
+
], p = (e, t) => !r(t) && e < 2;
|
|
33
|
+
async function m(e) {
|
|
34
|
+
let t = await u("query BuiHrisProvider($key: String!) { getProviderByKey(key: $key) { id isEnabled } }", { key: e });
|
|
35
|
+
return t.getProviderByKey?.isEnabled ? t.getProviderByKey.id : null;
|
|
36
|
+
}
|
|
37
|
+
function h(t) {
|
|
38
|
+
let { workspaceId: n } = e();
|
|
39
|
+
return a({
|
|
40
|
+
queryKey: d(n ?? "", t),
|
|
41
|
+
enabled: !!n,
|
|
42
|
+
retry: p,
|
|
43
|
+
queryFn: async () => {
|
|
44
|
+
let e = await m(t);
|
|
45
|
+
return e ? (await u("query BuiHrisConnections($providerId: ID!) {\n getConnectionsByProvider(providerId: $providerId, pagination: { limit: 20 }) {\n items { id name status createdAt }\n }\n }", { providerId: e })).getConnectionsByProvider.items : null;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function g(t) {
|
|
50
|
+
let { workspaceId: n } = e();
|
|
51
|
+
return a({
|
|
52
|
+
queryKey: f(n ?? "", t),
|
|
53
|
+
enabled: !!n,
|
|
54
|
+
retry: p,
|
|
55
|
+
refetchInterval: (e) => e.state.data?.running ? 3e3 : !1,
|
|
56
|
+
queryFn: async () => (await u(`query BuiHrisStatus($connectionId: ID!) { hrisDirectorySync(connectionId: $connectionId) { ${l} } }`, { connectionId: t })).hrisDirectorySync
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function _(t) {
|
|
60
|
+
let { workspaceId: r } = e(), a = o();
|
|
61
|
+
return i({
|
|
62
|
+
mutationFn: async (e) => {
|
|
63
|
+
let r = await m(t);
|
|
64
|
+
if (!r) throw new n("This HR system is not available in this workspace.");
|
|
65
|
+
let i = (await u("mutation BuiHrisCreate($input: CreateConnectionInput!) { createConnection(input: $input) { id } }", { input: {
|
|
66
|
+
name: e.name,
|
|
67
|
+
providerId: r,
|
|
68
|
+
visibility: "WORKSPACE"
|
|
69
|
+
} })).createConnection.id;
|
|
70
|
+
try {
|
|
71
|
+
await u("mutation BuiHrisAuth($input: AuthenticateConnectionInput!) { authenticateConnection(input: $input) { id status } }", { input: {
|
|
72
|
+
connectionId: i,
|
|
73
|
+
values: e.values
|
|
74
|
+
} });
|
|
75
|
+
} catch (e) {
|
|
76
|
+
throw await u("mutation BuiHrisUndo($id: ID!) { deleteConnection(id: $id) }", { id: i }).catch(() => void 0), e;
|
|
77
|
+
}
|
|
78
|
+
return i;
|
|
79
|
+
},
|
|
80
|
+
onSuccess: () => {
|
|
81
|
+
a.invalidateQueries({ queryKey: d(r ?? "", t) });
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function v(t) {
|
|
86
|
+
let { workspaceId: n } = e(), r = o();
|
|
87
|
+
return i({
|
|
88
|
+
mutationFn: async (e) => {
|
|
89
|
+
await u("mutation BuiHrisReauth($input: AuthenticateConnectionInput!) { authenticateConnection(input: $input) { id status } }", { input: {
|
|
90
|
+
connectionId: t,
|
|
91
|
+
values: e
|
|
92
|
+
} });
|
|
93
|
+
},
|
|
94
|
+
onSuccess: () => {
|
|
95
|
+
r.invalidateQueries({ queryKey: f(n ?? "", t) });
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function y(t) {
|
|
100
|
+
let { workspaceId: n } = e(), r = o();
|
|
101
|
+
return i({
|
|
102
|
+
mutationFn: async (e) => {
|
|
103
|
+
await u("mutation BuiHrisDelete($id: ID!) { deleteConnection(id: $id) }", { id: e });
|
|
104
|
+
},
|
|
105
|
+
onSuccess: () => {
|
|
106
|
+
r.invalidateQueries({ queryKey: d(n ?? "", t) });
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function b(t) {
|
|
111
|
+
let { workspaceId: n } = e(), r = o();
|
|
112
|
+
return i({
|
|
113
|
+
mutationFn: async (e) => (await u(`mutation BuiHrisStart($input: StartHrisSyncInput!) { startHrisSync(input: $input) { ${c} } }`, { input: {
|
|
114
|
+
connectionId: t,
|
|
115
|
+
mode: e.mode,
|
|
116
|
+
allowMassDeactivation: e.allowMassDeactivation ?? !1
|
|
117
|
+
} })).startHrisSync,
|
|
118
|
+
onSuccess: () => {
|
|
119
|
+
r.invalidateQueries({ queryKey: f(n ?? "", t) });
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function x(t) {
|
|
124
|
+
let { workspaceId: n } = e(), r = o();
|
|
125
|
+
return i({
|
|
126
|
+
mutationFn: async (e) => {
|
|
127
|
+
await u("mutation BuiHrisSchedule($input: SetHrisSyncScheduleInput!) {\n setHrisSyncSchedule(input: $input) { connectionId scheduleEnabled intervalHours nextRunAt }\n }", { input: {
|
|
128
|
+
connectionId: t,
|
|
129
|
+
enabled: e.enabled,
|
|
130
|
+
intervalHours: e.intervalHours
|
|
131
|
+
} });
|
|
132
|
+
},
|
|
133
|
+
onSuccess: () => {
|
|
134
|
+
r.invalidateQueries({ queryKey: f(n ?? "", t) });
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
//#endregion
|
|
139
|
+
export { _ as useConnectHris, y as useDeleteHrisConnection, h as useHrisConnections, g as useHrisStatus, x as useSetHrisSchedule, b as useStartHrisSync, v as useUpdateHrisCredentials };
|
|
140
|
+
|
|
141
|
+
//# sourceMappingURL=useHrisDirectorySync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHrisDirectorySync.js","names":[],"sources":["../../../src/buildmyiq/hooks/useHrisDirectorySync.ts"],"sourcesContent":["/**\n * Direct HR-system connector hooks (BOFF-10564)\n * @module buildmyiq/hooks\n *\n * Workday and SAP SuccessFactors connections live in wspace-integrations-svc\n * (workspace gateway). Credentials are submitted once with\n * `authenticateConnection` and encrypted server side; this page never reads\n * them back. Preview, sync and schedule are `hrisDirectorySync`,\n * `startHrisSync` and `setHrisSyncSchedule`, all gated to workspace\n * administrators by `@rbac(action: \"administer\", resource: \"integration-connection\")`.\n */\n\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\nimport { graphqlFetch } from '@burdenoff/fe-libs/shared/graphql';\n\nimport { useBuildmyiq } from '../context';\nimport { clearGraphqlReadCaches } from './useBuildmyiqApi';\nimport { ProvisioningApiError, isPermissionError } from '../pages/provisioning/provisioningModel';\nimport type {\n HrisConnectionSummary,\n HrisDirectorySyncStatus,\n HrisProviderKey,\n HrisSyncRun,\n} from '../pages/provisioning/hrisModel';\n\nconst RUN_FIELDS = `id connectionId mode trigger status workersFetched created updated deactivated reactivated\n unchanged skipped conflicts errors errorCode errorMessage startedBy startedAt finishedAt\n items { externalId email action userId detail }`;\n\nconst STATUS_FIELDS = `connectionId providerKey connectionStatus credentialsUpdatedAt scheduleEnabled intervalHours\n nextRunAt canApply lastPreview { ${RUN_FIELDS} } lastApply { ${RUN_FIELDS} } running { ${RUN_FIELDS} }`;\n\nconst wspaceRequest = async <TData>(\n query: string,\n variables: Record<string, unknown>\n): Promise<TData> => {\n const response = await graphqlFetch<TData>({\n gateway: 'workspace',\n query,\n variables,\n suppressGlobalErrorEvent: true,\n });\n if (response.errors?.length) {\n const first = response.errors[0];\n const code = first?.extensions?.code;\n throw new ProvisioningApiError(\n first?.message ?? 'GraphQL request failed',\n typeof code === 'string' ? code : undefined\n );\n }\n if (!response.data) throw new ProvisioningApiError('GraphQL response did not include data');\n if (/^\\s*mutation\\b/.test(query)) clearGraphqlReadCaches();\n return response.data;\n};\n\nconst connectionsKey = (workspaceId: string, key: HrisProviderKey) =>\n ['buildmyiq', 'hrisConnections', workspaceId, key] as const;\nconst statusKey = (workspaceId: string, connectionId: string) =>\n ['buildmyiq', 'hrisStatus', workspaceId, connectionId] as const;\n\nconst retry = (failureCount: number, error: unknown) =>\n !isPermissionError(error) && failureCount < 2;\n\nasync function providerId(key: HrisProviderKey): Promise<string | null> {\n const data = await wspaceRequest<{ getProviderByKey: { id: string; isEnabled: boolean } | null }>(\n `query BuiHrisProvider($key: String!) { getProviderByKey(key: $key) { id isEnabled } }`,\n { key }\n );\n return data.getProviderByKey?.isEnabled ? data.getProviderByKey.id : null;\n}\n\n/** The workspace's connections for one HR system (null when the provider is not available). */\nexport function useHrisConnections(key: HrisProviderKey) {\n const { workspaceId } = useBuildmyiq();\n return useQuery({\n queryKey: connectionsKey(workspaceId ?? '', key),\n enabled: !!workspaceId,\n retry,\n queryFn: async (): Promise<HrisConnectionSummary[] | null> => {\n const id = await providerId(key);\n if (!id) return null;\n const data = await wspaceRequest<{\n getConnectionsByProvider: { items: HrisConnectionSummary[] };\n }>(\n `query BuiHrisConnections($providerId: ID!) {\n getConnectionsByProvider(providerId: $providerId, pagination: { limit: 20 }) {\n items { id name status createdAt }\n }\n }`,\n { providerId: id }\n );\n return data.getConnectionsByProvider.items;\n },\n });\n}\n\nexport function useHrisStatus(connectionId: string) {\n const { workspaceId } = useBuildmyiq();\n return useQuery({\n queryKey: statusKey(workspaceId ?? '', connectionId),\n enabled: !!workspaceId,\n retry,\n // Poll while a preview or sync runs in the background.\n refetchInterval: (query) => (query.state.data?.running ? 3_000 : false),\n queryFn: async () => {\n const data = await wspaceRequest<{ hrisDirectorySync: HrisDirectorySyncStatus }>(\n `query BuiHrisStatus($connectionId: ID!) { hrisDirectorySync(connectionId: $connectionId) { ${STATUS_FIELDS} } }`,\n { connectionId }\n );\n return data.hrisDirectorySync;\n },\n });\n}\n\n/** Creates the connection and saves its credentials; removes the connection again if they are refused. */\nexport function useConnectHris(key: HrisProviderKey) {\n const { workspaceId } = useBuildmyiq();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (params: { name: string; values: Record<string, string> }) => {\n const id = await providerId(key);\n if (!id) throw new ProvisioningApiError('This HR system is not available in this workspace.');\n const created = await wspaceRequest<{ createConnection: { id: string } }>(\n `mutation BuiHrisCreate($input: CreateConnectionInput!) { createConnection(input: $input) { id } }`,\n { input: { name: params.name, providerId: id, visibility: 'WORKSPACE' } }\n );\n const connectionId = created.createConnection.id;\n try {\n await wspaceRequest(\n `mutation BuiHrisAuth($input: AuthenticateConnectionInput!) { authenticateConnection(input: $input) { id status } }`,\n { input: { connectionId, values: params.values } }\n );\n } catch (error) {\n await wspaceRequest(`mutation BuiHrisUndo($id: ID!) { deleteConnection(id: $id) }`, {\n id: connectionId,\n }).catch(() => undefined);\n throw error;\n }\n return connectionId;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: connectionsKey(workspaceId ?? '', key) });\n },\n });\n}\n\n/** Replaces the credentials of an existing connection. A new preview is needed afterwards. */\nexport function useUpdateHrisCredentials(connectionId: string) {\n const { workspaceId } = useBuildmyiq();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (values: Record<string, string>) => {\n await wspaceRequest(\n `mutation BuiHrisReauth($input: AuthenticateConnectionInput!) { authenticateConnection(input: $input) { id status } }`,\n { input: { connectionId, values } }\n );\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: statusKey(workspaceId ?? '', connectionId) });\n },\n });\n}\n\nexport function useDeleteHrisConnection(key: HrisProviderKey) {\n const { workspaceId } = useBuildmyiq();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (connectionId: string) => {\n await wspaceRequest(`mutation BuiHrisDelete($id: ID!) { deleteConnection(id: $id) }`, {\n id: connectionId,\n });\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: connectionsKey(workspaceId ?? '', key) });\n },\n });\n}\n\nexport function useStartHrisSync(connectionId: string) {\n const { workspaceId } = useBuildmyiq();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (params: { mode: 'PREVIEW' | 'APPLY'; allowMassDeactivation?: boolean }) => {\n const data = await wspaceRequest<{ startHrisSync: HrisSyncRun }>(\n `mutation BuiHrisStart($input: StartHrisSyncInput!) { startHrisSync(input: $input) { ${RUN_FIELDS} } }`,\n {\n input: {\n connectionId,\n mode: params.mode,\n allowMassDeactivation: params.allowMassDeactivation ?? false,\n },\n }\n );\n return data.startHrisSync;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: statusKey(workspaceId ?? '', connectionId) });\n },\n });\n}\n\nexport function useSetHrisSchedule(connectionId: string) {\n const { workspaceId } = useBuildmyiq();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (params: { enabled: boolean; intervalHours: number }) => {\n await wspaceRequest(\n `mutation BuiHrisSchedule($input: SetHrisSyncScheduleInput!) {\n setHrisSyncSchedule(input: $input) { connectionId scheduleEnabled intervalHours nextRunAt }\n }`,\n { input: { connectionId, enabled: params.enabled, intervalHours: params.intervalHours } }\n );\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: statusKey(workspaceId ?? '', connectionId) });\n },\n });\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HrisConnectorsCard.d.ts","sourceRoot":"","sources":["../../../../src/buildmyiq/pages/provisioning/HrisConnectorsCard.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAkkBhC,eAAO,MAAM,kBAAkB,EAAE,EAmChC,CAAC"}
|
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
import { useTr as e } from "../../shared/hooks/useTr.js";
|
|
2
|
+
import { formatDateTime as t } from "../../utils/formatters.js";
|
|
3
|
+
import { EmptyState as n } from "../../components/EmptyState.js";
|
|
4
|
+
import "../../components/index.js";
|
|
5
|
+
import { Switch as r } from "../../components/Switch.js";
|
|
6
|
+
import { Field as i, Modal as a, SelectField as o } from "../authoring/_forms.js";
|
|
7
|
+
import { useConnectHris as s, useDeleteHrisConnection as c, useHrisConnections as l, useHrisStatus as u, useSetHrisSchedule as d, useStartHrisSync as f, useUpdateHrisCredentials as p } from "../../hooks/useHrisDirectorySync.js";
|
|
8
|
+
import { HRIS_INTERVAL_OPTIONS as m, HRIS_VENDORS as h, HRIS_VENDOR_ORDER as g, actionTone as _, blockedByMassDeactivation as v, hrisCredentialValues as y, runSummary as b, validateHrisForm as x } from "./hrisModel.js";
|
|
9
|
+
import { useState as S } from "react";
|
|
10
|
+
import { Building2 as C, Eye as w, Play as T, Plus as E, RefreshCw as D, Trash2 as O } from "lucide-react";
|
|
11
|
+
import { Fragment as k, jsx as A, jsxs as j } from "react/jsx-runtime";
|
|
12
|
+
import { Button as M, GlassCard as N, Input as P, Textarea as F } from "@burdenoff/fe-libs/ui";
|
|
13
|
+
//#region src/buildmyiq/pages/provisioning/HrisConnectorsCard.tsx
|
|
14
|
+
var I = {
|
|
15
|
+
success: "bg-status-success-bg-subtle text-status-success-text",
|
|
16
|
+
warning: "bg-status-warning-bg-subtle text-status-warning-text",
|
|
17
|
+
error: "bg-status-error-bg-subtle text-status-error-text",
|
|
18
|
+
neutral: "border border-border-seam text-text-primary"
|
|
19
|
+
}, L = {
|
|
20
|
+
created: "New: {{count}}",
|
|
21
|
+
updated: "Updated: {{count}}",
|
|
22
|
+
reactivated: "Reactivated: {{count}}",
|
|
23
|
+
deactivated: "Deactivated: {{count}}",
|
|
24
|
+
unchanged: "Unchanged: {{count}}",
|
|
25
|
+
skipped: "Skipped: {{count}}",
|
|
26
|
+
conflicts: "Conflicts: {{count}}",
|
|
27
|
+
errors: "Errors: {{count}}"
|
|
28
|
+
}, R = {
|
|
29
|
+
CREATE: "Add",
|
|
30
|
+
UPDATE: "Update",
|
|
31
|
+
DEACTIVATE: "Deactivate",
|
|
32
|
+
REACTIVATE: "Reactivate",
|
|
33
|
+
UNCHANGED: "Unchanged",
|
|
34
|
+
SKIP: "Skipped",
|
|
35
|
+
CONFLICT: "Conflict",
|
|
36
|
+
ERROR: "Error"
|
|
37
|
+
}, z = (e, t) => e instanceof Error ? e.message : t, B = ({ vendor: t, connectionId: n, onClose: r }) => {
|
|
38
|
+
let o = e(), c = h[t], l = s(t), u = p(n ?? ""), d = l.isPending || u.isPending, [f, m] = S(c.name), [g, _] = S({}), [v, b] = S(!1), [C, w] = S(null), T = x(t, g), E = Object.keys(T).length > 0 || !n && !f.trim();
|
|
39
|
+
return /* @__PURE__ */ A(a, {
|
|
40
|
+
open: !0,
|
|
41
|
+
onClose: () => {
|
|
42
|
+
d || r();
|
|
43
|
+
},
|
|
44
|
+
title: n ? o("buildmyiq.provisioning.hris.updateTitle", "Update {{name}} credentials", { name: c.name }) : o("buildmyiq.provisioning.hris.connectTitle", "Connect {{name}}", { name: c.name }),
|
|
45
|
+
description: o("buildmyiq.provisioning.hris.connectDescription", "Credentials are encrypted when saved and are never shown again. After saving, preview the sync before running it."),
|
|
46
|
+
footer: /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ A(M, {
|
|
47
|
+
variant: "ghost",
|
|
48
|
+
onClick: r,
|
|
49
|
+
disabled: d,
|
|
50
|
+
children: o("buildmyiq.provisioning.cancel", "Cancel")
|
|
51
|
+
}), /* @__PURE__ */ A(M, {
|
|
52
|
+
onClick: async () => {
|
|
53
|
+
if (b(!0), !(E || d)) {
|
|
54
|
+
w(null);
|
|
55
|
+
try {
|
|
56
|
+
let e = y(t, g);
|
|
57
|
+
n ? await u.mutateAsync(e) : await l.mutateAsync({
|
|
58
|
+
name: f.trim(),
|
|
59
|
+
values: e
|
|
60
|
+
}), r();
|
|
61
|
+
} catch (e) {
|
|
62
|
+
w(z(e, o("buildmyiq.provisioning.hris.saveError", "Could not save the connection.")));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
disabled: d,
|
|
67
|
+
"data-testid": "hris-save",
|
|
68
|
+
children: d ? o("buildmyiq.provisioning.hris.saving", "Saving…") : o("buildmyiq.provisioning.hris.save", "Save connection")
|
|
69
|
+
})] }),
|
|
70
|
+
children: /* @__PURE__ */ j("div", {
|
|
71
|
+
className: "grid gap-4",
|
|
72
|
+
children: [
|
|
73
|
+
/* @__PURE__ */ A("ol", {
|
|
74
|
+
className: "list-decimal space-y-1 ps-5 text-xs text-text-secondary",
|
|
75
|
+
children: c.steps.map((e) => /* @__PURE__ */ A("li", { children: o(e.key, e.fallback) }, e.key))
|
|
76
|
+
}),
|
|
77
|
+
!n && /* @__PURE__ */ A(i, {
|
|
78
|
+
label: o("buildmyiq.provisioning.hris.field.name", "Connection name"),
|
|
79
|
+
htmlFor: "hris-name",
|
|
80
|
+
required: !0,
|
|
81
|
+
error: v && !f.trim() ? o("buildmyiq.provisioning.hris.required", "Required") : void 0,
|
|
82
|
+
children: /* @__PURE__ */ A(P, {
|
|
83
|
+
id: "hris-name",
|
|
84
|
+
value: f,
|
|
85
|
+
maxLength: 100,
|
|
86
|
+
onChange: (e) => m(e.target.value)
|
|
87
|
+
})
|
|
88
|
+
}),
|
|
89
|
+
c.fields.map((e) => {
|
|
90
|
+
let t = `hris-${e.name}`, n = v ? T[e.name] : void 0;
|
|
91
|
+
return /* @__PURE__ */ A(i, {
|
|
92
|
+
label: o(e.labelKey, e.label),
|
|
93
|
+
htmlFor: t,
|
|
94
|
+
required: !0,
|
|
95
|
+
hint: e.hint && e.hintKey ? o(e.hintKey, e.hint) : void 0,
|
|
96
|
+
error: n === "required" ? o("buildmyiq.provisioning.hris.required", "Required") : n === "https" ? o("buildmyiq.provisioning.hris.httpsError", "{{name}} is only reached over HTTPS. Enter the hostname without http://.", { name: c.name }) : n === "host" ? o("buildmyiq.provisioning.hris.hostError", "Enter a {{name}} hostname, for example {{example}}.", {
|
|
97
|
+
name: c.name,
|
|
98
|
+
example: e.placeholder ?? ""
|
|
99
|
+
}) : void 0,
|
|
100
|
+
children: e.multiline ? /* @__PURE__ */ A(F, {
|
|
101
|
+
id: t,
|
|
102
|
+
rows: 5,
|
|
103
|
+
autoComplete: "off",
|
|
104
|
+
spellCheck: !1,
|
|
105
|
+
className: "font-mono text-xs",
|
|
106
|
+
value: g[e.name] ?? "",
|
|
107
|
+
onChange: (t) => _((n) => ({
|
|
108
|
+
...n,
|
|
109
|
+
[e.name]: t.target.value
|
|
110
|
+
}))
|
|
111
|
+
}) : /* @__PURE__ */ A(P, {
|
|
112
|
+
id: t,
|
|
113
|
+
type: e.secret ? "password" : "text",
|
|
114
|
+
autoComplete: "off",
|
|
115
|
+
placeholder: e.placeholder,
|
|
116
|
+
value: g[e.name] ?? "",
|
|
117
|
+
onChange: (t) => _((n) => ({
|
|
118
|
+
...n,
|
|
119
|
+
[e.name]: t.target.value
|
|
120
|
+
}))
|
|
121
|
+
})
|
|
122
|
+
}, e.name);
|
|
123
|
+
}),
|
|
124
|
+
C && /* @__PURE__ */ A("p", {
|
|
125
|
+
role: "alert",
|
|
126
|
+
className: "text-sm text-status-error-text",
|
|
127
|
+
children: C
|
|
128
|
+
})
|
|
129
|
+
]
|
|
130
|
+
})
|
|
131
|
+
});
|
|
132
|
+
}, V = 50, H = ({ run: n, title: r }) => {
|
|
133
|
+
let i = e(), a = b(n), o = n.items.slice(0, V);
|
|
134
|
+
return /* @__PURE__ */ j("div", {
|
|
135
|
+
className: "flex flex-col gap-2 rounded-lg border border-border-seam p-3",
|
|
136
|
+
"data-testid": `hris-run-${n.mode.toLowerCase()}`,
|
|
137
|
+
children: [
|
|
138
|
+
/* @__PURE__ */ j("div", {
|
|
139
|
+
className: "flex flex-wrap items-center justify-between gap-2",
|
|
140
|
+
children: [/* @__PURE__ */ A("h4", {
|
|
141
|
+
className: "text-sm font-medium text-text-primary",
|
|
142
|
+
children: r
|
|
143
|
+
}), /* @__PURE__ */ j("span", {
|
|
144
|
+
className: "text-xs text-text-tertiary",
|
|
145
|
+
children: [t(n.finishedAt ?? n.startedAt), n.trigger === "SCHEDULED" ? ` · ${i("buildmyiq.provisioning.hris.scheduled", "scheduled")}` : ""]
|
|
146
|
+
})]
|
|
147
|
+
}),
|
|
148
|
+
n.status === "FAILED" ? /* @__PURE__ */ A("p", {
|
|
149
|
+
role: "alert",
|
|
150
|
+
className: "text-sm text-status-error-text",
|
|
151
|
+
"data-testid": "hris-run-error",
|
|
152
|
+
children: n.errorMessage ?? i("buildmyiq.provisioning.hris.failed", "The sync failed.")
|
|
153
|
+
}) : /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ A("p", {
|
|
154
|
+
className: "text-xs text-text-secondary",
|
|
155
|
+
children: i("buildmyiq.provisioning.hris.fetched", "{{count}} workers read from the HR system.", { count: n.workersFetched })
|
|
156
|
+
}), /* @__PURE__ */ A("ul", {
|
|
157
|
+
className: "flex flex-wrap gap-2",
|
|
158
|
+
"data-testid": "hris-run-summary",
|
|
159
|
+
children: a.map(({ key: e, count: t }) => /* @__PURE__ */ A("li", {
|
|
160
|
+
className: "rounded-full border border-border-seam px-2.5 py-0.5 text-xs text-text-primary",
|
|
161
|
+
children: i(`buildmyiq.provisioning.hris.count.${e}`, L[e] ?? `${e}: {{count}}`, { count: t })
|
|
162
|
+
}, e))
|
|
163
|
+
})] }),
|
|
164
|
+
o.length > 0 && /* @__PURE__ */ A("div", {
|
|
165
|
+
className: "max-h-64 overflow-auto",
|
|
166
|
+
children: /* @__PURE__ */ j("table", {
|
|
167
|
+
className: "w-full text-start text-xs",
|
|
168
|
+
children: [/* @__PURE__ */ A("thead", {
|
|
169
|
+
className: "text-text-tertiary",
|
|
170
|
+
children: /* @__PURE__ */ j("tr", { children: [
|
|
171
|
+
/* @__PURE__ */ A("th", {
|
|
172
|
+
className: "py-1 pe-2 text-start font-medium",
|
|
173
|
+
children: i("buildmyiq.provisioning.hris.col.worker", "Worker")
|
|
174
|
+
}),
|
|
175
|
+
/* @__PURE__ */ A("th", {
|
|
176
|
+
className: "py-1 pe-2 text-start font-medium",
|
|
177
|
+
children: i("buildmyiq.provisioning.hris.col.email", "Email")
|
|
178
|
+
}),
|
|
179
|
+
/* @__PURE__ */ A("th", {
|
|
180
|
+
className: "py-1 pe-2 text-start font-medium",
|
|
181
|
+
children: i("buildmyiq.provisioning.hris.col.outcome", "Outcome")
|
|
182
|
+
})
|
|
183
|
+
] })
|
|
184
|
+
}), /* @__PURE__ */ A("tbody", { children: o.map((e, t) => /* @__PURE__ */ j("tr", {
|
|
185
|
+
className: "border-t border-border-seam align-top",
|
|
186
|
+
children: [
|
|
187
|
+
/* @__PURE__ */ A("td", {
|
|
188
|
+
className: "py-1 pe-2 font-mono text-text-primary",
|
|
189
|
+
children: e.externalId || "—"
|
|
190
|
+
}),
|
|
191
|
+
/* @__PURE__ */ A("td", {
|
|
192
|
+
className: "py-1 pe-2 text-text-secondary",
|
|
193
|
+
children: e.email ?? "—"
|
|
194
|
+
}),
|
|
195
|
+
/* @__PURE__ */ j("td", {
|
|
196
|
+
className: "py-1 pe-2",
|
|
197
|
+
children: [/* @__PURE__ */ A("span", {
|
|
198
|
+
className: `inline-flex rounded-full px-2 py-0.5 font-medium ${I[_(e.action)]}`,
|
|
199
|
+
children: i(`buildmyiq.provisioning.hris.action.${e.action}`, R[e.action] ?? e.action)
|
|
200
|
+
}), e.detail && /* @__PURE__ */ A("span", {
|
|
201
|
+
className: "ms-2 text-text-secondary",
|
|
202
|
+
children: e.detail
|
|
203
|
+
})]
|
|
204
|
+
})
|
|
205
|
+
]
|
|
206
|
+
}, `${e.externalId}-${t}`)) })]
|
|
207
|
+
})
|
|
208
|
+
}),
|
|
209
|
+
n.items.length > o.length && /* @__PURE__ */ A("p", {
|
|
210
|
+
className: "text-xs text-text-tertiary",
|
|
211
|
+
"data-testid": "hris-run-truncated",
|
|
212
|
+
children: i("buildmyiq.provisioning.hris.truncated", "Showing {{shown}} of {{total}} people who need attention.", {
|
|
213
|
+
shown: o.length,
|
|
214
|
+
total: n.items.length
|
|
215
|
+
})
|
|
216
|
+
})
|
|
217
|
+
]
|
|
218
|
+
});
|
|
219
|
+
}, U = ({ vendor: n, connection: i }) => {
|
|
220
|
+
let a = e(), s = u(i.id), l = f(i.id), p = d(i.id), h = c(n), [g, _] = S(!1), [y, b] = S(!1), [x, C] = S(null), E = s.data, k = !!E?.running || l.isPending, N = async (e, t = !1) => {
|
|
221
|
+
C(null);
|
|
222
|
+
try {
|
|
223
|
+
await l.mutateAsync({
|
|
224
|
+
mode: e,
|
|
225
|
+
allowMassDeactivation: t
|
|
226
|
+
});
|
|
227
|
+
} catch (e) {
|
|
228
|
+
C(z(e, a("buildmyiq.provisioning.hris.startError", "Could not start the sync.")));
|
|
229
|
+
}
|
|
230
|
+
}, P = async (e, t) => {
|
|
231
|
+
C(null);
|
|
232
|
+
try {
|
|
233
|
+
await p.mutateAsync({
|
|
234
|
+
enabled: e,
|
|
235
|
+
intervalHours: t
|
|
236
|
+
});
|
|
237
|
+
} catch (e) {
|
|
238
|
+
C(z(e, a("buildmyiq.provisioning.hris.scheduleError", "Could not change the schedule.")));
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
return /* @__PURE__ */ j("li", {
|
|
242
|
+
className: "flex flex-col gap-3 border-b border-border-seam py-3 last:border-b-0",
|
|
243
|
+
"data-testid": "hris-connection",
|
|
244
|
+
children: [
|
|
245
|
+
/* @__PURE__ */ j("div", {
|
|
246
|
+
className: "flex flex-wrap items-start justify-between gap-2",
|
|
247
|
+
children: [/* @__PURE__ */ j("div", {
|
|
248
|
+
className: "min-w-0",
|
|
249
|
+
children: [/* @__PURE__ */ A("h3", {
|
|
250
|
+
className: "truncate font-medium text-text-primary",
|
|
251
|
+
children: i.name
|
|
252
|
+
}), /* @__PURE__ */ A("p", {
|
|
253
|
+
className: "text-xs text-text-tertiary",
|
|
254
|
+
children: E?.credentialsUpdatedAt ? a("buildmyiq.provisioning.hris.credentialsSaved", "Credentials saved {{date}}", { date: t(E.credentialsUpdatedAt) }) : a("buildmyiq.provisioning.hris.noCredentials", "No credentials saved")
|
|
255
|
+
})]
|
|
256
|
+
}), /* @__PURE__ */ j("div", {
|
|
257
|
+
className: "flex flex-wrap items-center gap-2",
|
|
258
|
+
children: [
|
|
259
|
+
/* @__PURE__ */ j(M, {
|
|
260
|
+
variant: "outline",
|
|
261
|
+
size: "sm",
|
|
262
|
+
onClick: () => N("PREVIEW"),
|
|
263
|
+
disabled: k,
|
|
264
|
+
"data-testid": "hris-preview",
|
|
265
|
+
children: [/* @__PURE__ */ A(w, { className: "me-1.5 h-3.5 w-3.5" }), a("buildmyiq.provisioning.hris.preview", "Preview sync")]
|
|
266
|
+
}),
|
|
267
|
+
/* @__PURE__ */ j(M, {
|
|
268
|
+
size: "sm",
|
|
269
|
+
onClick: () => N("APPLY"),
|
|
270
|
+
disabled: k || !E?.canApply,
|
|
271
|
+
"data-testid": "hris-apply",
|
|
272
|
+
children: [/* @__PURE__ */ A(T, { className: "me-1.5 h-3.5 w-3.5" }), a("buildmyiq.provisioning.hris.apply", "Sync now")]
|
|
273
|
+
}),
|
|
274
|
+
/* @__PURE__ */ j(M, {
|
|
275
|
+
variant: "ghost",
|
|
276
|
+
size: "sm",
|
|
277
|
+
onClick: () => _(!0),
|
|
278
|
+
children: [/* @__PURE__ */ A(D, { className: "me-1.5 h-3.5 w-3.5" }), a("buildmyiq.provisioning.hris.updateCredentials", "Update credentials")]
|
|
279
|
+
}),
|
|
280
|
+
y ? /* @__PURE__ */ A(M, {
|
|
281
|
+
variant: "destructive",
|
|
282
|
+
size: "sm",
|
|
283
|
+
disabled: h.isPending,
|
|
284
|
+
onClick: () => h.mutateAsync(i.id).catch((e) => C(z(e, a("buildmyiq.provisioning.hris.deleteError", "Could not remove the connection.")))),
|
|
285
|
+
children: a("buildmyiq.provisioning.hris.confirmDelete", "Remove connection")
|
|
286
|
+
}) : /* @__PURE__ */ A(M, {
|
|
287
|
+
variant: "ghost",
|
|
288
|
+
size: "sm",
|
|
289
|
+
onClick: () => b(!0),
|
|
290
|
+
"aria-label": a("buildmyiq.provisioning.hris.delete", "Remove"),
|
|
291
|
+
children: /* @__PURE__ */ A(O, { className: "h-3.5 w-3.5" })
|
|
292
|
+
})
|
|
293
|
+
]
|
|
294
|
+
})]
|
|
295
|
+
}),
|
|
296
|
+
E && !E.canApply && !k && /* @__PURE__ */ A("p", {
|
|
297
|
+
className: "text-xs text-text-secondary",
|
|
298
|
+
"data-testid": "hris-preview-first",
|
|
299
|
+
children: a("buildmyiq.provisioning.hris.previewFirst", "Preview the sync first. Nothing changes in the workspace until you run a sync after a successful preview.")
|
|
300
|
+
}),
|
|
301
|
+
k && /* @__PURE__ */ A("p", {
|
|
302
|
+
className: "text-xs text-text-secondary",
|
|
303
|
+
role: "status",
|
|
304
|
+
"data-testid": "hris-running",
|
|
305
|
+
children: a("buildmyiq.provisioning.hris.running", "Reading workers from the HR system…")
|
|
306
|
+
}),
|
|
307
|
+
E && /* @__PURE__ */ j("div", {
|
|
308
|
+
className: "flex flex-wrap items-center gap-3",
|
|
309
|
+
children: [
|
|
310
|
+
/* @__PURE__ */ j("label", {
|
|
311
|
+
className: "flex items-center gap-2 text-sm text-text-primary",
|
|
312
|
+
htmlFor: `hris-schedule-${i.id}`,
|
|
313
|
+
children: [/* @__PURE__ */ A(r, {
|
|
314
|
+
id: `hris-schedule-${i.id}`,
|
|
315
|
+
checked: E.scheduleEnabled,
|
|
316
|
+
disabled: p.isPending || !E.scheduleEnabled && !E.canApply,
|
|
317
|
+
onCheckedChange: (e) => void P(e, E.intervalHours)
|
|
318
|
+
}), a("buildmyiq.provisioning.hris.schedule", "Sync automatically")]
|
|
319
|
+
}),
|
|
320
|
+
/* @__PURE__ */ A("div", {
|
|
321
|
+
className: "w-40",
|
|
322
|
+
children: /* @__PURE__ */ A(o, {
|
|
323
|
+
id: `hris-interval-${i.id}`,
|
|
324
|
+
"aria-label": a("buildmyiq.provisioning.hris.interval", "Sync interval"),
|
|
325
|
+
value: String(E.intervalHours),
|
|
326
|
+
disabled: p.isPending || !E.scheduleEnabled,
|
|
327
|
+
onChange: (e) => void P(E.scheduleEnabled, Number(e)),
|
|
328
|
+
options: m.map((e) => ({
|
|
329
|
+
value: String(e),
|
|
330
|
+
label: e === 168 ? a("buildmyiq.provisioning.hris.weekly", "Weekly") : a("buildmyiq.provisioning.hris.everyHours", "Every {{hours}} hours", { hours: e })
|
|
331
|
+
}))
|
|
332
|
+
})
|
|
333
|
+
}),
|
|
334
|
+
E.scheduleEnabled && E.nextRunAt && /* @__PURE__ */ A("span", {
|
|
335
|
+
className: "text-xs text-text-tertiary",
|
|
336
|
+
children: a("buildmyiq.provisioning.hris.nextRun", "Next sync {{date}}", { date: t(E.nextRunAt) })
|
|
337
|
+
})
|
|
338
|
+
]
|
|
339
|
+
}),
|
|
340
|
+
E?.lastPreview && /* @__PURE__ */ A(H, {
|
|
341
|
+
run: E.lastPreview,
|
|
342
|
+
title: a("buildmyiq.provisioning.hris.lastPreview", "Last preview")
|
|
343
|
+
}),
|
|
344
|
+
E?.lastApply && /* @__PURE__ */ A(H, {
|
|
345
|
+
run: E.lastApply,
|
|
346
|
+
title: a("buildmyiq.provisioning.hris.lastApply", "Last sync")
|
|
347
|
+
}),
|
|
348
|
+
v(E?.lastApply ?? null) && !k && /* @__PURE__ */ A("div", {
|
|
349
|
+
className: "flex flex-wrap items-center gap-2",
|
|
350
|
+
children: /* @__PURE__ */ A(M, {
|
|
351
|
+
variant: "destructive",
|
|
352
|
+
size: "sm",
|
|
353
|
+
onClick: () => N("APPLY", !0),
|
|
354
|
+
children: a("buildmyiq.provisioning.hris.allowMass", "Sync anyway and deactivate them")
|
|
355
|
+
})
|
|
356
|
+
}),
|
|
357
|
+
!!(x || s.error) && /* @__PURE__ */ A("p", {
|
|
358
|
+
role: "alert",
|
|
359
|
+
className: "text-xs text-status-error-text",
|
|
360
|
+
children: x ?? z(s.error, a("buildmyiq.provisioning.hris.loadError", "Could not load the sync status."))
|
|
361
|
+
}),
|
|
362
|
+
g && /* @__PURE__ */ A(B, {
|
|
363
|
+
vendor: n,
|
|
364
|
+
connectionId: i.id,
|
|
365
|
+
onClose: () => _(!1)
|
|
366
|
+
})
|
|
367
|
+
]
|
|
368
|
+
});
|
|
369
|
+
}, W = ({ vendor: t }) => {
|
|
370
|
+
let n = e(), r = h[t], i = l(t), [a, o] = S(!1);
|
|
371
|
+
return i.data === null ? null : /* @__PURE__ */ j("section", {
|
|
372
|
+
className: "flex flex-col gap-2",
|
|
373
|
+
"data-testid": `hris-vendor-${t}`,
|
|
374
|
+
children: [
|
|
375
|
+
/* @__PURE__ */ j("div", {
|
|
376
|
+
className: "flex flex-wrap items-start justify-between gap-2",
|
|
377
|
+
children: [/* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("h3", {
|
|
378
|
+
className: "font-medium text-text-primary",
|
|
379
|
+
children: r.name
|
|
380
|
+
}), /* @__PURE__ */ A("p", {
|
|
381
|
+
className: "text-xs text-text-secondary",
|
|
382
|
+
children: n(r.descriptionKey, r.description)
|
|
383
|
+
})] }), /* @__PURE__ */ j(M, {
|
|
384
|
+
variant: "outline",
|
|
385
|
+
size: "sm",
|
|
386
|
+
onClick: () => o(!0),
|
|
387
|
+
"data-testid": `hris-connect-${t}`,
|
|
388
|
+
children: [/* @__PURE__ */ A(E, { className: "me-1.5 h-3.5 w-3.5" }), n("buildmyiq.provisioning.hris.connect", "Connect {{name}}", { name: r.name })]
|
|
389
|
+
})]
|
|
390
|
+
}),
|
|
391
|
+
i.isError && /* @__PURE__ */ A("p", {
|
|
392
|
+
role: "alert",
|
|
393
|
+
className: "text-xs text-status-error-text",
|
|
394
|
+
children: z(i.error, n("buildmyiq.provisioning.hris.loadError", "Could not load the sync status."))
|
|
395
|
+
}),
|
|
396
|
+
i.data && i.data.length > 0 && /* @__PURE__ */ A("ul", { children: i.data.map((e) => /* @__PURE__ */ A(U, {
|
|
397
|
+
vendor: t,
|
|
398
|
+
connection: e
|
|
399
|
+
}, e.id)) }),
|
|
400
|
+
a && /* @__PURE__ */ A(B, {
|
|
401
|
+
vendor: t,
|
|
402
|
+
onClose: () => o(!1)
|
|
403
|
+
})
|
|
404
|
+
]
|
|
405
|
+
});
|
|
406
|
+
}, G = () => {
|
|
407
|
+
let t = e(), r = l("workday"), i = l("sap-successfactors"), a = r.data === null && i.data === null;
|
|
408
|
+
return /* @__PURE__ */ j(N, {
|
|
409
|
+
treatment: "plain",
|
|
410
|
+
className: "flex flex-col gap-4 p-4",
|
|
411
|
+
"data-testid": "hris-connectors",
|
|
412
|
+
children: [/* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("h2", {
|
|
413
|
+
className: "font-semibold text-text-primary",
|
|
414
|
+
children: t("buildmyiq.provisioning.hris.title", "Direct HR system connectors")
|
|
415
|
+
}), /* @__PURE__ */ A("p", {
|
|
416
|
+
className: "text-sm text-text-secondary",
|
|
417
|
+
children: t("buildmyiq.provisioning.hris.description", "No Okta or Entra ID tenant? Connect Workday or SAP SuccessFactors directly. Hires are added, changes are applied and leavers are deactivated, exactly as SCIM provisioning would.")
|
|
418
|
+
})] }), a ? /* @__PURE__ */ A(n, {
|
|
419
|
+
icon: /* @__PURE__ */ A(C, { className: "h-8 w-8" }),
|
|
420
|
+
title: t("buildmyiq.provisioning.hris.unavailableTitle", "HR connectors are not available"),
|
|
421
|
+
description: t("buildmyiq.provisioning.hris.unavailable", "The Workday and SAP SuccessFactors connectors are not enabled for this workspace yet.")
|
|
422
|
+
}) : g.map((e) => /* @__PURE__ */ A(W, { vendor: e }, e))]
|
|
423
|
+
});
|
|
424
|
+
};
|
|
425
|
+
//#endregion
|
|
426
|
+
export { G as HrisConnectorsCard };
|
|
427
|
+
|
|
428
|
+
//# sourceMappingURL=HrisConnectorsCard.js.map
|