@workos-inc/widgets 1.9.1 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/cjs/admin-portal-audit-log-streaming.client.cjs +167 -0
  3. package/dist/cjs/admin-portal-audit-log-streaming.client.cjs.map +1 -0
  4. package/dist/cjs/admin-portal-audit-log-streaming.client.d.cts +26 -0
  5. package/dist/cjs/api/api-provider.cjs.map +1 -1
  6. package/dist/cjs/api/api-provider.d.cts +1 -1
  7. package/dist/cjs/index.cjs +11 -0
  8. package/dist/cjs/index.cjs.map +1 -1
  9. package/dist/cjs/index.d.cts +2 -0
  10. package/dist/cjs/lib/admin-portal-audit-log-streaming.cjs +321 -0
  11. package/dist/cjs/lib/admin-portal-audit-log-streaming.cjs.map +1 -0
  12. package/dist/cjs/lib/admin-portal-audit-log-streaming.d.cts +54 -0
  13. package/dist/cjs/lib/audit-log-stream-icons.cjs +63 -0
  14. package/dist/cjs/lib/audit-log-stream-icons.cjs.map +1 -0
  15. package/dist/cjs/lib/audit-log-stream-icons.d.cts +5 -0
  16. package/dist/cjs/lib/identity-providers.d.cts +2 -2
  17. package/dist/esm/admin-portal-audit-log-streaming.client.d.ts +26 -0
  18. package/dist/esm/admin-portal-audit-log-streaming.client.js +153 -0
  19. package/dist/esm/admin-portal-audit-log-streaming.client.js.map +1 -0
  20. package/dist/esm/api/api-provider.d.ts +1 -1
  21. package/dist/esm/api/api-provider.js.map +1 -1
  22. package/dist/esm/index.d.ts +2 -0
  23. package/dist/esm/index.js +12 -0
  24. package/dist/esm/index.js.map +1 -1
  25. package/dist/esm/lib/admin-portal-audit-log-streaming.d.ts +54 -0
  26. package/dist/esm/lib/admin-portal-audit-log-streaming.js +290 -0
  27. package/dist/esm/lib/admin-portal-audit-log-streaming.js.map +1 -0
  28. package/dist/esm/lib/audit-log-stream-icons.d.ts +5 -0
  29. package/dist/esm/lib/audit-log-stream-icons.js +39 -0
  30. package/dist/esm/lib/audit-log-stream-icons.js.map +1 -0
  31. package/dist/esm/lib/identity-providers.d.ts +2 -2
  32. package/package.json +3 -3
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/admin-portal-audit-log-streaming.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Box, Card, Flex, Text } from \"@radix-ui/themes\";\nimport * as CardList from \"./card-list.js\";\nimport { Button, Skeleton } from \"./elements.js\";\nimport {\n ExternalLinkIcon,\n Cross2Icon,\n InfoCircledIcon,\n} from \"@radix-ui/react-icons\";\nimport { ProviderIcon } from \"./provider-icon.js\";\nimport { IconPanel } from \"./icon-panel.js\";\nimport { GenericHttpsIcon } from \"./audit-log-stream-icons.js\";\nimport { Status } from \"./status.js\";\nimport {\n getDomProps,\n type WidgetRootState,\n type WidgetRootDomProps,\n} from \"./utils.js\";\nimport { Translation } from \"./i18n/translation.js\";\nimport { useTranslation } from \"./i18n/use-translation.js\";\nimport { getErrorMessage } from \"./generic-error.js\";\nimport type { AuditLogStreamType } from \"../api/endpoint.js\";\n\n// ============================================================================\n// TYPE DEFINITIONS\n// ============================================================================\n\ninterface NotConfiguredProps {\n connectionStatus: \"NotConfigured\";\n}\n\ninterface InactiveProps {\n connectionStatus: \"Inactive\";\n destinationType: AuditLogStreamType;\n}\n\ninterface ActiveProps {\n connectionStatus: \"Active\";\n destinationType: AuditLogStreamType;\n lastSyncedEventId?: string | null;\n}\n\ninterface ErrorProps {\n connectionStatus: \"Error\";\n destinationType: AuditLogStreamType;\n lastSyncedEventId?: string | null;\n}\n\nconst AdminPortalAuditLogStreamingContext = React.createContext<{\n connectionStatus: AdminPortalAuditLogStreamingStatusProps[\"connectionStatus\"];\n} | null>(null);\n\nfunction useAdminPortalAuditLogStreamingContext() {\n const context = React.useContext(AdminPortalAuditLogStreamingContext);\n if (!context) {\n throw new Error(\n \"useAdminPortalAuditLogStreamingContext must be used within a AdminPortalAuditLogStreamingContext provider\",\n );\n }\n return context;\n}\n\nexport type AdminPortalAuditLogStreamingStatusProps =\n | NotConfiguredProps\n | InactiveProps\n | ActiveProps\n | ErrorProps;\n\ntype AdminPortalAuditLogStreamingProps = WidgetRootDomProps &\n AdminPortalAuditLogStreamingStatusProps & {\n adminPortalOpenButton: React.ReactNode;\n };\n\n// ============================================================================\n// HELPER FUNCTIONS\n// ============================================================================\n\n/**\n * Maps AuditLogStreamType to display name\n */\nfunction getDestinationName(type: AuditLogStreamType): string {\n switch (type) {\n case \"Datadog\":\n return \"Datadog\";\n case \"Splunk\":\n return \"Splunk\";\n case \"S3\":\n return \"AWS S3\";\n case \"GoogleCloudStorage\":\n return \"Google Cloud Storage\";\n case \"AzureSentinel\":\n return \"Azure Sentinel\";\n case \"GenericHttps\":\n return \"Generic HTTPS\";\n default:\n return type;\n }\n}\n\n/**\n * Maps AuditLogStreamType to ProviderIcon provider name\n */\nfunction getDestinationIcon(\n type: AuditLogStreamType,\n): \"datadog\" | \"splunk\" | \"aws\" | \"google-cloud\" | \"azure\" | undefined {\n switch (type) {\n case \"Datadog\":\n return \"datadog\";\n case \"Splunk\":\n return \"splunk\";\n case \"S3\":\n return \"aws\";\n case \"GoogleCloudStorage\":\n return \"google-cloud\";\n case \"AzureSentinel\":\n return \"azure\";\n default:\n return undefined;\n }\n}\n\n/**\n * Helper to get the correct WidgetRootDomProps based on state\n */\nfunction getWidgetRootDomProps(\n state: WidgetRootState,\n domProps: WidgetRootDomProps,\n) {\n return getDomProps({\n ...domProps,\n isWidgetRoot: true,\n widgetId: \"admin-portal-audit-log-streaming\",\n widgetState: state,\n });\n}\n\nconst CROCKFORD_BASE32 = \"0123456789ABCDEFGHJKMNPQRSTVWXYZ\";\n\nfunction decodeUlidTimestamp(ulid: string): Date | null {\n if (!ulid || ulid.length < 10) return null;\n let timestamp = 0;\n for (let i = 0; i < 10; i++) {\n const charIndex = CROCKFORD_BASE32.indexOf(ulid.charAt(i).toUpperCase());\n if (charIndex === -1) return null;\n timestamp = timestamp * 32 + charIndex;\n }\n return new Date(timestamp);\n}\n\nfunction getRelativeTimeString(currentDate: Date, pastDate: Date): string {\n const rtf = new Intl.RelativeTimeFormat(\"en\", { numeric: \"auto\" });\n const diff = pastDate.getTime() - currentDate.getTime();\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) return \"now\";\n if (Math.abs(diffMinutes) < 60) return rtf.format(diffMinutes, \"minute\");\n if (Math.abs(diffHours) < 24) return rtf.format(diffHours, \"hour\");\n if (Math.abs(diffDays) < 30) return rtf.format(diffDays, \"day\");\n if (Math.abs(diffMonths) < 12) return rtf.format(diffMonths, \"month\");\n return rtf.format(diffYears, \"year\");\n}\n\nfunction AdminPortalAuditLogStreamingButton({\n isPending,\n href,\n initConfig,\n}: {\n isPending: boolean;\n href: string | null;\n initConfig: () => void;\n}) {\n const { connectionStatus } = useAdminPortalAuditLogStreamingContext();\n const label = (() => {\n switch (connectionStatus) {\n case \"NotConfigured\":\n return (\n <Translation\n defaultMessage=\"Set up Log Streams\"\n id=\"s3Wu7U\"\n description=\"Button label to start log stream setup\"\n />\n );\n case \"Inactive\":\n return (\n <Translation\n defaultMessage=\"Continue setup\"\n id=\"/oM/HY\"\n description=\"Button label to continue incomplete log stream setup\"\n />\n );\n case \"Active\":\n case \"Error\":\n return (\n <Translation\n defaultMessage=\"Manage\"\n id=\"+k5uUi\"\n description=\"Button label to manage log stream settings\"\n />\n );\n }\n })();\n\n if (href) {\n return (\n <Button variant=\"secondary\" asChild>\n <a href={href} target=\"_blank\" rel=\"noopener noreferrer\">\n {label} <ExternalLinkIcon aria-hidden />\n </a>\n </Button>\n );\n }\n\n return (\n <Button\n variant=\"secondary\"\n loading={isPending}\n disabled={isPending}\n onClick={initConfig}\n >\n {label} <ExternalLinkIcon aria-hidden />\n </Button>\n );\n}\n\n// ============================================================================\n// MAIN COMPONENT\n// ============================================================================\n\nconst AdminPortalAuditLogStreaming: React.FC<\n AdminPortalAuditLogStreamingProps\n> = (props) => {\n const { connectionStatus, adminPortalOpenButton, className } = props;\n\n const destinationType =\n connectionStatus !== \"NotConfigured\"\n ? (props as InactiveProps | ActiveProps | ErrorProps).destinationType\n : null;\n const lastSyncedEventId =\n connectionStatus === \"Active\" || connectionStatus === \"Error\"\n ? (props as ActiveProps | ErrorProps).lastSyncedEventId\n : undefined;\n const lastSyncedAt = lastSyncedEventId\n ? decodeUlidTimestamp(lastSyncedEventId)\n : null;\n\n const icon = destinationType ? getDestinationIcon(destinationType) : null;\n\n return (\n <AdminPortalAuditLogStreamingContext.Provider value={{ connectionStatus }}>\n <CardList.Root {...getWidgetRootDomProps(\"resolved\", { className })}>\n <CardList.Item>\n <Flex direction=\"row\" justify=\"between\" align=\"center\" gap=\"2\">\n <Flex gap=\"4\" align=\"center\">\n {connectionStatus === \"NotConfigured\" ? (\n <Text size=\"2\" color=\"gray\">\n <Translation\n defaultMessage=\"You haven't set up Log Streams yet.\"\n id=\"n4mruE\"\n description=\"Empty state message when log streaming is not configured\"\n />\n </Text>\n ) : (\n <>\n <IconPanel color=\"panel\">\n {icon ? (\n <ProviderIcon provider={icon} size=\"2\" />\n ) : (\n <GenericHttpsIcon />\n )}\n </IconPanel>\n {lastSyncedAt ? (\n <Flex direction=\"column\">\n <Text size=\"2\" weight=\"bold\">\n {getDestinationName(destinationType!)}\n </Text>\n <Text size=\"2\" color=\"gray\">\n <Translation\n defaultMessage=\"Last sync {relativeTime}\"\n id=\"fT9f0p\"\n description=\"Label showing when the last log stream sync occurred\"\n values={{\n relativeTime: getRelativeTimeString(\n new Date(),\n lastSyncedAt,\n ),\n }}\n />\n </Text>\n </Flex>\n ) : (\n <Text size=\"2\" weight=\"bold\">\n {getDestinationName(destinationType!)}\n </Text>\n )}\n </>\n )}\n </Flex>\n\n <Flex gap=\"5\" align=\"center\">\n {connectionStatus === \"NotConfigured\" ? (\n adminPortalOpenButton\n ) : (\n <>\n {connectionStatus === \"Inactive\" && (\n <Status state=\"waiting\">\n <Translation\n defaultMessage=\"Setup in progress\"\n id=\"M6iKLG\"\n description=\"Status when log stream setup is incomplete\"\n />\n </Status>\n )}\n {connectionStatus === \"Active\" && (\n <Status state=\"success\">\n <Translation\n defaultMessage=\"Streaming\"\n id=\"25L0J+\"\n description=\"Status when log stream is active\"\n />\n </Status>\n )}\n {connectionStatus === \"Error\" && (\n <Status state=\"error\">\n <Translation\n defaultMessage=\"Not streaming\"\n id=\"7fAKZo\"\n description=\"Status when log stream has an error\"\n />\n </Status>\n )}\n {adminPortalOpenButton}\n </>\n )}\n </Flex>\n </Flex>\n </CardList.Item>\n\n {connectionStatus === \"Error\" && (\n <CardList.Item>\n <Flex align=\"start\" gap=\"2\">\n <Box asChild mt=\"2px\" flexShrink=\"0\">\n <InfoCircledIcon color=\"gray\" />\n </Box>\n <Text size=\"2\" color=\"gray\">\n <Translation\n defaultMessage=\"The credentials provided are incorrect or missing. Please review and update your log stream configuration.\"\n id=\"23tmgn\"\n description=\"Error message shown when audit log stream has a configuration or delivery error\"\n />\n </Text>\n </Flex>\n </CardList.Item>\n )}\n </CardList.Root>\n </AdminPortalAuditLogStreamingContext.Provider>\n );\n};\n\n// ============================================================================\n// LOADING COMPONENT\n// ============================================================================\n\ninterface AdminPortalAuditLogStreamingLoadingProps extends WidgetRootDomProps {}\n\nconst AdminPortalAuditLogStreamingLoading: React.FC<\n AdminPortalAuditLogStreamingLoadingProps\n> = (props) => {\n return (\n <Card size=\"2\" {...getWidgetRootDomProps(\"loading\", props)}>\n <Flex direction=\"row\" justify=\"between\" align=\"center\" gap=\"2\">\n <Flex gap=\"4\" align=\"center\">\n <Skeleton>\n <IconPanel color=\"panel\">\n <ProviderIcon provider=\"datadog\" size=\"2\" />\n </IconPanel>\n </Skeleton>\n <Flex direction=\"column\" gap=\"1\" my=\"-4px\">\n <Skeleton>\n {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}\n <Text size=\"1\">Datadog</Text>\n </Skeleton>\n <Skeleton>\n {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}\n <Text size=\"1\">Last sync 10 minutes ago</Text>\n </Skeleton>\n </Flex>\n </Flex>\n\n <Flex gap=\"5\" align=\"center\">\n <Skeleton>\n {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}\n <Status state=\"success\">Streaming</Status>\n </Skeleton>\n <Skeleton>\n {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}\n <Button variant=\"secondary\">\n Manage <ExternalLinkIcon aria-hidden />\n </Button>\n </Skeleton>\n </Flex>\n </Flex>\n </Card>\n );\n};\n\n// ============================================================================\n// ERROR COMPONENT\n// ============================================================================\n\ninterface AdminPortalAuditLogStreamingErrorProps extends WidgetRootDomProps {\n error: unknown;\n}\n\nconst AdminPortalAuditLogStreamingError: React.FC<\n AdminPortalAuditLogStreamingErrorProps\n> = ({ error, ...domProps }) => {\n React.useEffect(() => {\n console.error(error);\n }, [error]);\n\n const translate = useTranslation();\n const { heading, message } = getErrorMessage(error, translate);\n\n return (\n <Card size=\"2\" {...getWidgetRootDomProps(\"error\", domProps)}>\n <Flex direction=\"row\" justify=\"between\" align=\"center\" gap=\"2\">\n <Flex gap=\"4\" align=\"center\">\n {/* Error icon circle */}\n <Flex\n align=\"center\"\n justify=\"center\"\n width=\"24px\"\n height=\"24px\"\n style={{\n borderRadius: \"9999px\",\n backgroundColor: \"var(--red-a4)\",\n color: \"var(--red-a11)\",\n flexShrink: 0,\n }}\n >\n <Cross2Icon width=\"18px\" height=\"18px\" />\n </Flex>\n {/* Error text */}\n <Flex direction=\"column\">\n <Text size=\"2\" weight=\"bold\">\n {heading}\n </Text>\n <Text size=\"2\" color=\"gray\">\n {message}\n </Text>\n </Flex>\n </Flex>\n </Flex>\n </Card>\n );\n};\n\n// ============================================================================\n// EXPORTS\n// ============================================================================\n\nexport type {\n AdminPortalAuditLogStreamingProps,\n AdminPortalAuditLogStreamingLoadingProps,\n AdminPortalAuditLogStreamingErrorProps,\n};\n\nexport {\n AdminPortalAuditLogStreaming,\n AdminPortalAuditLogStreamingLoading,\n AdminPortalAuditLogStreamingError,\n /** @internal */\n AdminPortalAuditLogStreamingButton,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuLU;AArLV,YAAuB;AACvB,oBAAsC;AACtC,eAA0B;AAC1B,sBAAiC;AACjC,yBAIO;AACP,2BAA6B;AAC7B,wBAA0B;AAC1B,oCAAiC;AACjC,oBAAuB;AACvB,mBAIO;AACP,yBAA4B;AAC5B,6BAA+B;AAC/B,2BAAgC;AA4BhC,MAAM,sCAAsC,MAAM,cAExC,IAAI;AAEd,SAAS,yCAAyC;AAChD,QAAM,UAAU,MAAM,WAAW,mCAAmC;AACpE,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAoBA,SAAS,mBAAmB,MAAkC;AAC5D,UAAQ,MAAM;AAAA,IACZ,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAKA,SAAS,mBACP,MACqE;AACrE,UAAQ,MAAM;AAAA,IACZ,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAKA,SAAS,sBACP,OACA,UACA;AACA,aAAO,0BAAY;A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,wBAAO,OAAM,WAAU,uBAAS,GACnC;AAAA,MACA,4CAAC,4BAEC,uDAAC,0BAAO,SAAQ,aAAY;AAAA;AAAA,QACnB,4CAAC,uCAAiB,eAAW,MAAC;AAAA,SACvC,GACF;AAAA,OACF;AAAA,KACF,GACF;AAEJ;AAUA,MAAM,oCAEF,CAAC,EAAE,OAAO,GAAG,SAAS,MAAM;AAC9B,QAAM,UAAU,MAAM;AACpB,YAAQ,MAAM,KAAK;AAAA,EACrB,GAAG,CAAC,KAAK,CAAC;AAEV,QAAM,gBAAY,uCAAe;AACjC,QAAM,EAAE,SAAS,QAAQ,QAAI,sCAAgB,OAAO,SAAS;AAE7D,SACE,4CAAC,sBAAK,MAAK,KAAK,GAAG,sBAAsB,SAAS,QAAQ,GACxD,sDAAC,sBAAK,WAAU,OAAM,SAAQ,WAAU,OAAM,UAAS,KAAI,KACzD,uDAAC,sBAAK,KAAI,KAAI,OAAM,UAElB;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,OAAM;AAAA,QACN,SAAQ;AAAA,QACR,OAAM;AAAA,QACN,QAAO;AAAA,QACP,OAAO;AAAA,UACL,cAAc;AAAA,UACd,iBAAiB;AAAA,UACjB,OAAO;AAAA,UACP,YAAY;AAAA,QACd;AAAA,QAEA,sDAAC,iCAAW,OAAM,QAAO,QAAO,QAAO;AAAA;AAAA,IACzC;AAAA,IAEA,6CAAC,sBAAK,WAAU,UACd;AAAA,kDAAC,sBAAK,MAAK,KAAI,QAAO,QACnB,mBACH;AAAA,MACA,4CAAC,sBAAK,MAAK,KAAI,OAAM,QAClB,mBACH;AAAA,OACF;AAAA,KACF,GACF,GACF;AAEJ;","names":[]}
@@ -0,0 +1,54 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+ import { WidgetRootDomProps } from './utils.cjs';
4
+ import { AuditLogStreamType } from '../api/endpoint.cjs';
5
+ import './elements.cjs';
6
+ import '@radix-ui/themes';
7
+ import '@radix-ui/themes/props';
8
+ import '../dialog-C15qCLN3.cjs';
9
+ import '@radix-ui/themes/components/dialog';
10
+ import '../alert-dialog-BlG3_awx.cjs';
11
+ import '@radix-ui/themes/components/alert-dialog';
12
+ import '../dropdown-menu-BQ5LtvdR.cjs';
13
+ import '@radix-ui/themes/components/dropdown-menu';
14
+ import '../select-KR89Qnvm.cjs';
15
+ import '@radix-ui/themes/components/select';
16
+ import '@tanstack/react-query';
17
+ import '../api/widgets-api-client.cjs';
18
+
19
+ interface NotConfiguredProps {
20
+ connectionStatus: "NotConfigured";
21
+ }
22
+ interface InactiveProps {
23
+ connectionStatus: "Inactive";
24
+ destinationType: AuditLogStreamType;
25
+ }
26
+ interface ActiveProps {
27
+ connectionStatus: "Active";
28
+ destinationType: AuditLogStreamType;
29
+ lastSyncedEventId?: string | null;
30
+ }
31
+ interface ErrorProps {
32
+ connectionStatus: "Error";
33
+ destinationType: AuditLogStreamType;
34
+ lastSyncedEventId?: string | null;
35
+ }
36
+ type AdminPortalAuditLogStreamingStatusProps = NotConfiguredProps | InactiveProps | ActiveProps | ErrorProps;
37
+ type AdminPortalAuditLogStreamingProps = WidgetRootDomProps & AdminPortalAuditLogStreamingStatusProps & {
38
+ adminPortalOpenButton: React.ReactNode;
39
+ };
40
+ declare function AdminPortalAuditLogStreamingButton({ isPending, href, initConfig, }: {
41
+ isPending: boolean;
42
+ href: string | null;
43
+ initConfig: () => void;
44
+ }): react_jsx_runtime.JSX.Element;
45
+ declare const AdminPortalAuditLogStreaming: React.FC<AdminPortalAuditLogStreamingProps>;
46
+ interface AdminPortalAuditLogStreamingLoadingProps extends WidgetRootDomProps {
47
+ }
48
+ declare const AdminPortalAuditLogStreamingLoading: React.FC<AdminPortalAuditLogStreamingLoadingProps>;
49
+ interface AdminPortalAuditLogStreamingErrorProps extends WidgetRootDomProps {
50
+ error: unknown;
51
+ }
52
+ declare const AdminPortalAuditLogStreamingError: React.FC<AdminPortalAuditLogStreamingErrorProps>;
53
+
54
+ export { AdminPortalAuditLogStreaming, AdminPortalAuditLogStreamingButton, AdminPortalAuditLogStreamingError, type AdminPortalAuditLogStreamingErrorProps, AdminPortalAuditLogStreamingLoading, type AdminPortalAuditLogStreamingLoadingProps, type AdminPortalAuditLogStreamingProps, type AdminPortalAuditLogStreamingStatusProps };
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var audit_log_stream_icons_exports = {};
20
+ __export(audit_log_stream_icons_exports, {
21
+ GenericHttpsIcon: () => GenericHttpsIcon
22
+ });
23
+ module.exports = __toCommonJS(audit_log_stream_icons_exports);
24
+ var import_jsx_runtime = require("react/jsx-runtime");
25
+ function GenericHttpsIcon() {
26
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
27
+ "svg",
28
+ {
29
+ width: 16,
30
+ height: 16,
31
+ viewBox: "0 0 373.71 200",
32
+ xmlns: "http://www.w3.org/2000/svg",
33
+ children: [
34
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
35
+ "path",
36
+ {
37
+ d: "M326 0H47.73L0 100l47.73 100H326l47.73-100Zm-15.95 183.36H58.22L18.43 100l39.79-83.36h251.83L349.84 100Z",
38
+ fill: "#008ec7"
39
+ }
40
+ ),
41
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
42
+ "path",
43
+ {
44
+ d: "m349.84 100.01-39.79 83.36H58.22l-39.79-83.36 39.79-83.37h251.83l39.79 83.37z",
45
+ fill: "#005b9b"
46
+ }
47
+ ),
48
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
49
+ "path",
50
+ {
51
+ d: "M128.05 71.89v59.53h-13.78V107h-27v24.41H73.46V71.89h13.77v23.47h27V71.89ZM154.5 83.12h-19.05V71.89h51.87v11.23h-19v48.3H154.5ZM207.9 83.12h-19.05V71.89h51.87v11.23h-19.05v48.3H207.9ZM287.62 74.53a20.45 20.45 0 0 1 9 7.48 20.67 20.67 0 0 1 3.14 11.48 20.73 20.73 0 0 1-3.14 11.44 20.06 20.06 0 0 1-9 7.48 33.55 33.55 0 0 1-13.74 2.59h-12v16.42h-13.76V71.89h25.76a33.05 33.05 0 0 1 13.74 2.64Zm-5.06 26.57a9.33 9.33 0 0 0 3.23-7.61c0-3.34-1.08-5.91-3.23-7.69s-5.3-2.68-9.44-2.68h-11.23v20.66h11.23q6.21 0 9.44-2.68Z",
52
+ fill: "#fff"
53
+ }
54
+ )
55
+ ]
56
+ }
57
+ );
58
+ }
59
+ // Annotate the CommonJS export names for ESM import in node:
60
+ 0 && (module.exports = {
61
+ GenericHttpsIcon
62
+ });
63
+ //# sourceMappingURL=audit-log-stream-icons.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/audit-log-stream-icons.tsx"],"sourcesContent":["export function GenericHttpsIcon() {\n return (\n <svg\n width={16}\n height={16}\n viewBox=\"0 0 373.71 200\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M326 0H47.73L0 100l47.73 100H326l47.73-100Zm-15.95 183.36H58.22L18.43 100l39.79-83.36h251.83L349.84 100Z\"\n fill=\"#008ec7\"\n />\n <path\n d=\"m349.84 100.01-39.79 83.36H58.22l-39.79-83.36 39.79-83.37h251.83l39.79 83.37z\"\n fill=\"#005b9b\"\n />\n <path\n d=\"M128.05 71.89v59.53h-13.78V107h-27v24.41H73.46V71.89h13.77v23.47h27V71.89ZM154.5 83.12h-19.05V71.89h51.87v11.23h-19v48.3H154.5ZM207.9 83.12h-19.05V71.89h51.87v11.23h-19.05v48.3H207.9ZM287.62 74.53a20.45 20.45 0 0 1 9 7.48 20.67 20.67 0 0 1 3.14 11.48 20.73 20.73 0 0 1-3.14 11.44 20.06 20.06 0 0 1-9 7.48 33.55 33.55 0 0 1-13.74 2.59h-12v16.42h-13.76V71.89h25.76a33.05 33.05 0 0 1 13.74 2.64Zm-5.06 26.57a9.33 9.33 0 0 0 3.23-7.61c0-3.34-1.08-5.91-3.23-7.69s-5.3-2.68-9.44-2.68h-11.23v20.66h11.23q6.21 0 9.44-2.68Z\"\n fill=\"#fff\"\n />\n </svg>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEI;AAFG,SAAS,mBAAmB;AACjC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,SAAQ;AAAA,MACR,OAAM;AAAA,MAEN;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,GAAE;AAAA,YACF,MAAK;AAAA;AAAA,QACP;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,GAAE;AAAA,YACF,MAAK;AAAA;AAAA,QACP;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,GAAE;AAAA,YACF,MAAK;AAAA;AAAA,QACP;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -0,0 +1,5 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ declare function GenericHttpsIcon(): react_jsx_runtime.JSX.Element;
4
+
5
+ export { GenericHttpsIcon };
@@ -1,7 +1,7 @@
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">;
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", "Datadog" | "Splunk" | "GoDaddy" | "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" | "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;
4
+ declare function getIdentityProviderName(provider: IdentityProvider): "Datadog" | "Splunk" | "GoDaddy" | "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
5
  declare function getDirectoryTypeIcon(directoryType: string): IdentityProvider | null;
6
6
  declare function getDirectoryTypeName(directoryType: string): string;
7
7
  declare function isIdentityProvider(provider: unknown): boolean;
@@ -0,0 +1,26 @@
1
+ import * as React from 'react';
2
+ import { AuthToken } from './api/api-provider.js';
3
+ import { WidgetRootDomProps } from './lib/utils.js';
4
+ export { AdminPortalAuditLogStreamingButton, AdminPortalAuditLogStreamingError, AdminPortalAuditLogStreamingLoading, AdminPortalAuditLogStreaming as AdminPortalAuditLogStreamingPresentational, AdminPortalAuditLogStreamingStatusProps } from './lib/admin-portal-audit-log-streaming.js';
5
+ import 'react/jsx-runtime';
6
+ import './api/endpoint.js';
7
+ import '@tanstack/react-query';
8
+ import './api/widgets-api-client.js';
9
+ import './lib/elements.js';
10
+ import '@radix-ui/themes';
11
+ import '@radix-ui/themes/props';
12
+ import './dialog-C15qCLN3.js';
13
+ import '@radix-ui/themes/components/dialog';
14
+ import './alert-dialog-BlG3_awx.js';
15
+ import '@radix-ui/themes/components/alert-dialog';
16
+ import './dropdown-menu-BQ5LtvdR.js';
17
+ import '@radix-ui/themes/components/dropdown-menu';
18
+ import './select-KR89Qnvm.js';
19
+ import '@radix-ui/themes/components/select';
20
+
21
+ interface AdminPortalAuditLogStreamingProps extends WidgetRootDomProps {
22
+ authToken: AuthToken;
23
+ }
24
+ declare const AdminPortalAuditLogStreaming: React.FC<AdminPortalAuditLogStreamingProps>;
25
+
26
+ export { AdminPortalAuditLogStreaming, type AdminPortalAuditLogStreamingProps };
@@ -0,0 +1,153 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import {
4
+ AdminPortalAuditLogStreamingError,
5
+ AdminPortalAuditLogStreamingLoading,
6
+ AdminPortalAuditLogStreaming as AdminPortalAuditLogStreamingPresentational,
7
+ AdminPortalAuditLogStreamingButton
8
+ } from "./lib/admin-portal-audit-log-streaming.js";
9
+ import { ApiProvider, useApiReady } from "./api/api-provider.js";
10
+ import {
11
+ useGenerateAdminPortalLink,
12
+ useGetAuditLogStream
13
+ } from "./api/endpoint.js";
14
+ import { useWorkOsApiUrl } from "./lib/widgets-context.js";
15
+ import { ErrorBoundary } from "./lib/error-boundary.js";
16
+ const AdminPortalAuditLogStreaming = ({ authToken, ...domProps }) => {
17
+ const baseUrl = useWorkOsApiUrl();
18
+ return /* @__PURE__ */ jsx(
19
+ ErrorBoundary,
20
+ {
21
+ fallbackRender: ({ error }) => /* @__PURE__ */ jsx(AdminPortalAuditLogStreamingError, { error, ...domProps }),
22
+ children: /* @__PURE__ */ jsx(
23
+ ApiProvider,
24
+ {
25
+ widgetType: "admin-portal-audit-log-streaming",
26
+ authToken,
27
+ baseUrl,
28
+ children: /* @__PURE__ */ jsx(AdminPortalAuditLogStreamingImpl, { ...domProps })
29
+ }
30
+ )
31
+ }
32
+ );
33
+ };
34
+ const AdminPortalAuditLogStreamingImpl = (props) => {
35
+ const isApiReady = useApiReady();
36
+ const { mutate: generateAdminPortalLink, ...mutation } = useGenerateAdminPortalLink({
37
+ mutation: {
38
+ onSuccess: (data) => {
39
+ window.open(data.link, "_blank", "noopener,noreferrer");
40
+ }
41
+ }
42
+ });
43
+ const adminPortalLink = mutation.data?.link ?? null;
44
+ const query = useGetAuditLogStream({
45
+ query: {
46
+ enabled: isApiReady
47
+ }
48
+ });
49
+ const initConfig = () => {
50
+ generateAdminPortalLink({
51
+ params: {
52
+ intent: "log_streams"
53
+ }
54
+ });
55
+ };
56
+ if (query.isLoading) {
57
+ return /* @__PURE__ */ jsx(AdminPortalAuditLogStreamingLoading, { ...props });
58
+ }
59
+ if (query.isError) {
60
+ return /* @__PURE__ */ jsx(AdminPortalAuditLogStreamingError, { error: query.error, ...props });
61
+ }
62
+ if (query.data) {
63
+ const stream = query.data;
64
+ if (!Object.hasOwn(stream, "id")) {
65
+ return /* @__PURE__ */ jsx(
66
+ AdminPortalAuditLogStreamingPresentational,
67
+ {
68
+ ...props,
69
+ connectionStatus: "NotConfigured",
70
+ adminPortalOpenButton: /* @__PURE__ */ jsx(
71
+ AdminPortalAuditLogStreamingButton,
72
+ {
73
+ isPending: mutation.isPending,
74
+ href: adminPortalLink,
75
+ initConfig
76
+ }
77
+ )
78
+ }
79
+ );
80
+ }
81
+ const configuredStream = stream;
82
+ const statusProps = (() => {
83
+ switch (configuredStream.state) {
84
+ case "Inactive":
85
+ return {
86
+ connectionStatus: "Inactive",
87
+ destinationType: configuredStream.type
88
+ };
89
+ case "Active":
90
+ return {
91
+ connectionStatus: "Active",
92
+ destinationType: configuredStream.type,
93
+ lastSyncedEventId: configuredStream.lastSyncedEventId
94
+ };
95
+ case "Error":
96
+ return {
97
+ connectionStatus: "Error",
98
+ destinationType: configuredStream.type,
99
+ lastSyncedEventId: configuredStream.lastSyncedEventId
100
+ };
101
+ case "Invalid":
102
+ return {
103
+ connectionStatus: "Error",
104
+ destinationType: configuredStream.type,
105
+ lastSyncedEventId: configuredStream.lastSyncedEventId
106
+ };
107
+ default:
108
+ return {
109
+ connectionStatus: "Inactive",
110
+ destinationType: configuredStream.type
111
+ };
112
+ }
113
+ })();
114
+ return /* @__PURE__ */ jsx(
115
+ ErrorBoundary,
116
+ {
117
+ fallbackRender: ({ error }) => /* @__PURE__ */ jsx(AdminPortalAuditLogStreamingError, { error, ...props }),
118
+ children: /* @__PURE__ */ jsx(
119
+ AdminPortalAuditLogStreamingPresentational,
120
+ {
121
+ ...props,
122
+ ...statusProps,
123
+ adminPortalOpenButton: /* @__PURE__ */ jsx(
124
+ AdminPortalAuditLogStreamingButton,
125
+ {
126
+ isPending: mutation.isPending,
127
+ href: adminPortalLink,
128
+ initConfig
129
+ }
130
+ )
131
+ }
132
+ )
133
+ }
134
+ );
135
+ }
136
+ return /* @__PURE__ */ jsx(AdminPortalAuditLogStreamingLoading, { ...props });
137
+ };
138
+ import {
139
+ AdminPortalAuditLogStreamingLoading as AdminPortalAuditLogStreamingLoading2,
140
+ AdminPortalAuditLogStreamingError as AdminPortalAuditLogStreamingError2
141
+ } from "./lib/admin-portal-audit-log-streaming.js";
142
+ import {
143
+ AdminPortalAuditLogStreaming as AdminPortalAuditLogStreaming2,
144
+ AdminPortalAuditLogStreamingButton as AdminPortalAuditLogStreamingButton2
145
+ } from "./lib/admin-portal-audit-log-streaming.js";
146
+ export {
147
+ AdminPortalAuditLogStreaming,
148
+ AdminPortalAuditLogStreamingButton2 as AdminPortalAuditLogStreamingButton,
149
+ AdminPortalAuditLogStreamingError2 as AdminPortalAuditLogStreamingError,
150
+ AdminPortalAuditLogStreamingLoading2 as AdminPortalAuditLogStreamingLoading,
151
+ AdminPortalAuditLogStreaming2 as AdminPortalAuditLogStreamingPresentational
152
+ };
153
+ //# sourceMappingURL=admin-portal-audit-log-streaming.client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/admin-portal-audit-log-streaming.client.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport {\n AdminPortalAuditLogStreamingError,\n AdminPortalAuditLogStreamingLoading,\n AdminPortalAuditLogStreaming as AdminPortalAuditLogStreamingPresentational,\n AdminPortalAuditLogStreamingButton,\n} from \"./lib/admin-portal-audit-log-streaming.js\";\nimport type { AdminPortalAuditLogStreamingStatusProps } from \"./lib/admin-portal-audit-log-streaming.js\";\nimport { ApiProvider, AuthToken, useApiReady } from \"./api/api-provider.js\";\nimport {\n useGenerateAdminPortalLink,\n useGetAuditLogStream,\n type AuditLogStreamJSON,\n} from \"./api/endpoint.js\";\nimport { useWorkOsApiUrl } from \"./lib/widgets-context.js\";\nimport { ErrorBoundary } from \"./lib/error-boundary.js\";\nimport { WidgetRootDomProps } from \"./lib/utils.js\";\n\ninterface AdminPortalAuditLogStreamingProps extends WidgetRootDomProps {\n authToken: AuthToken;\n}\n\nconst AdminPortalAuditLogStreaming: React.FC<\n AdminPortalAuditLogStreamingProps\n> = ({ authToken, ...domProps }) => {\n const baseUrl = useWorkOsApiUrl();\n return (\n <ErrorBoundary\n fallbackRender={({ error }) => (\n <AdminPortalAuditLogStreamingError error={error} {...domProps} />\n )}\n >\n <ApiProvider\n widgetType=\"admin-portal-audit-log-streaming\"\n authToken={authToken}\n baseUrl={baseUrl}\n >\n <AdminPortalAuditLogStreamingImpl {...domProps} />\n </ApiProvider>\n </ErrorBoundary>\n );\n};\n\nconst AdminPortalAuditLogStreamingImpl = (props: WidgetRootDomProps) => {\n const isApiReady = useApiReady();\n\n const { mutate: generateAdminPortalLink, ...mutation } =\n useGenerateAdminPortalLink({\n mutation: {\n onSuccess: (data) => {\n window.open(data.link, \"_blank\", \"noopener,noreferrer\");\n },\n },\n });\n\n const adminPortalLink = mutation.data?.link ?? null;\n\n const query = useGetAuditLogStream({\n query: {\n enabled: isApiReady,\n },\n });\n\n const initConfig = () => {\n generateAdminPortalLink({\n params: {\n intent: \"log_streams\",\n },\n });\n };\n\n if (query.isLoading) {\n return <AdminPortalAuditLogStreamingLoading {...props} />;\n }\n\n if (query.isError) {\n return <AdminPortalAuditLogStreamingError error={query.error} {...props} />;\n }\n\n if (query.data) {\n const stream = query.data;\n\n // Check if stream is configured (has id property)\n // API returns empty object {} when no stream is configured\n if (!Object.hasOwn(stream, \"id\")) {\n return (\n <AdminPortalAuditLogStreamingPresentational\n {...props}\n connectionStatus=\"NotConfigured\"\n adminPortalOpenButton={\n <AdminPortalAuditLogStreamingButton\n isPending={mutation.isPending}\n href={adminPortalLink}\n initConfig={initConfig}\n />\n }\n />\n );\n }\n\n // Type assertion: we've confirmed stream has id, so it's AuditLogStreamJSON\n const configuredStream = stream as AuditLogStreamJSON;\n\n // Map API state to widget status\n const statusProps: AdminPortalAuditLogStreamingStatusProps = (() => {\n switch (configuredStream.state) {\n case \"Inactive\":\n return {\n connectionStatus: \"Inactive\",\n destinationType: configuredStream.type,\n };\n case \"Active\":\n return {\n connectionStatus: \"Active\",\n destinationType: configuredStream.type,\n lastSyncedEventId: configuredStream.lastSyncedEventId,\n };\n case \"Error\":\n return {\n connectionStatus: \"Error\",\n destinationType: configuredStream.type,\n lastSyncedEventId: configuredStream.lastSyncedEventId,\n };\n case \"Invalid\":\n return {\n connectionStatus: \"Error\",\n destinationType: configuredStream.type,\n lastSyncedEventId: configuredStream.lastSyncedEventId,\n };\n default:\n // Fallback\n return {\n connectionStatus: \"Inactive\",\n destinationType: configuredStream.type,\n };\n }\n })();\n\n return (\n <ErrorBoundary\n fallbackRender={({ error }) => (\n <AdminPortalAuditLogStreamingError error={error} {...props} />\n )}\n >\n <AdminPortalAuditLogStreamingPresentational\n {...props}\n {...statusProps}\n adminPortalOpenButton={\n <AdminPortalAuditLogStreamingButton\n isPending={mutation.isPending}\n href={adminPortalLink}\n initConfig={initConfig}\n />\n }\n />\n </ErrorBoundary>\n );\n }\n\n return <AdminPortalAuditLogStreamingLoading {...props} />;\n};\n\nexport { AdminPortalAuditLogStreaming };\nexport type { AdminPortalAuditLogStreamingProps };\nexport {\n AdminPortalAuditLogStreamingLoading,\n AdminPortalAuditLogStreamingError,\n} from \"./lib/admin-portal-audit-log-streaming.js\";\nexport {\n AdminPortalAuditLogStreaming as AdminPortalAuditLogStreamingPresentational,\n AdminPortalAuditLogStreamingButton,\n type AdminPortalAuditLogStreamingStatusProps,\n} from \"./lib/admin-portal-audit-log-streaming.js\";\n"],"mappings":";AA+BQ;AA5BR;AAAA,EACE;AAAA,EACA;AAAA,EACA,gCAAgC;AAAA,EAChC;AAAA,OACK;AAEP,SAAS,aAAwB,mBAAmB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP,SAAS,uBAAuB;AAChC,SAAS,qBAAqB;AAO9B,MAAM,+BAEF,CAAC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Streaming","AdminPortalAuditLogStreamingButton"]}
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
 
4
- type WidgetType = "admin-portal-domain-verification" | "user-management" | "organization-switcher" | "user-sessions" | "user-security" | "user-profile" | "admin-portal-sso-connection" | "api-keys" | "pipes" | "directory-sync";
4
+ type WidgetType = "admin-portal-audit-log-streaming" | "admin-portal-domain-verification" | "user-management" | "organization-switcher" | "user-sessions" | "user-security" | "user-profile" | "admin-portal-sso-connection" | "api-keys" | "pipes" | "directory-sync";
5
5
  type AuthToken = string | (() => Promise<string>);
6
6
  interface ElevatedAccess {
7
7
  token: string;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/api/api-provider.tsx"],"sourcesContent":["import { useQuery } from \"@tanstack/react-query\";\nimport * as React from \"react\";\nimport { useIsHydrated } from \"../lib/use-is-hydrated.js\";\nimport { getClaims } from \"./utils.js\";\n\nexport type WidgetType =\n | \"admin-portal-domain-verification\"\n | \"user-management\"\n | \"organization-switcher\"\n | \"user-sessions\"\n | \"user-security\"\n | \"user-profile\"\n | \"admin-portal-sso-connection\"\n | \"api-keys\"\n | \"pipes\"\n | \"directory-sync\";\n\nexport type AuthToken = string | (() => Promise<string>);\n\ninterface ElevatedAccess {\n token: string;\n expiresAt: string;\n}\n\ninterface ApiConfig {\n authToken: string | undefined;\n permissions: string[] | undefined;\n baseUrl: string;\n widgetType: WidgetType;\n elevatedAccess?: ElevatedAccess;\n setElevatedAccess: (elevatedAccess?: ElevatedAccess) => void;\n}\n\nconst ApiContext = React.createContext<ApiConfig | undefined>(undefined);\n\ninterface ApiProviderProps {\n authToken: AuthToken;\n baseUrl: string;\n children: React.ReactNode;\n widgetType: WidgetType;\n}\n\nexport const ApiProvider = ({\n authToken,\n baseUrl,\n children,\n widgetType,\n}: ApiProviderProps) => {\n const authTokenQuery = useQuery({\n initialData:\n typeof authToken === \"string\"\n ? {\n authToken,\n permissions: getClaims(authToken).permissions,\n }\n : undefined,\n queryFn: async () => {\n const resolvedToken =\n typeof authToken === \"string\" ? authToken : await authToken();\n\n return {\n authToken: resolvedToken,\n permissions: getClaims(resolvedToken).permissions,\n };\n },\n queryKey: [\"authToken\", widgetType],\n });\n\n const [elevatedAccess, setElevatedAccess] = React.useState<ElevatedAccess>();\n const elevatedAccessTimeout = React.useRef<number | undefined>(undefined);\n\n // This effect manages the expiration of elevated access tokens\n // When an elevated access token is present, it checks every 30 seconds if the token has expired\n // If the token has expired (current time > expiration time), it clears the elevated access\n React.useEffect(() => {\n if (elevatedAccessTimeout.current) {\n window.clearInterval(elevatedAccessTimeout.current);\n }\n\n if (elevatedAccess) {\n elevatedAccessTimeout.current = window.setInterval(() => {\n const now = new Date();\n const expiresAtDate = new Date(elevatedAccess.expiresAt);\n\n // Reset the elevated access if it has expired\n if (now > expiresAtDate) {\n setElevatedAccess(undefined);\n }\n }, 30_000); // every 30 seconds\n }\n\n return () => {\n if (elevatedAccessTimeout.current) {\n window.clearInterval(elevatedAccessTimeout.current);\n }\n };\n }, [elevatedAccess]);\n\n const value = React.useMemo(\n () => ({\n authToken: authTokenQuery.data?.authToken,\n permissions: authTokenQuery.data?.permissions,\n baseUrl,\n elevatedAccess,\n setElevatedAccess,\n widgetType,\n }),\n [\n authTokenQuery.data,\n baseUrl,\n elevatedAccess,\n setElevatedAccess,\n widgetType,\n ],\n );\n\n return <ApiContext.Provider value={value}>{children}</ApiContext.Provider>;\n};\n\nexport const useApi = () => {\n const context = React.useContext(ApiContext);\n\n if (context === undefined) {\n throw new Error(\"useApi must be used within an ApiProvider\");\n }\n\n return context;\n};\n\nexport const useElevatedAccessToken = () => {\n const { elevatedAccess, setElevatedAccess } = useApi();\n\n return { elevatedAccess, setElevatedAccess };\n};\n\nexport const useApiReady = () => {\n const { authToken } = useApi();\n const isHydrated = useIsHydrated();\n\n return isHydrated && authToken !== undefined;\n};\n"],"mappings":"AAoHS;AApHT,SAAS,gBAAgB;AACzB,YAA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IACA;AAAA,MACE,eAAe;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO,oBAAC,WAAW,UAAX,EAAoB,OAAe,UAAS;AACtD;AAEO,MAAM,SAAS,MAAM;AAC1B,QAAM,UAAU,MAAM,WAAW,UAAU;AAE3C,MAAI,YAAY,QAAW;AACzB,UAAM,IAAI,MAAM,2CAA2C;AAAA,EAC7D;AAEA,SAAO;AACT;AAEO,MAAM,yBAAyB,MAAM;AAC1C,QAAM,EAAE,gBAAgB,kBAAkB,IAAI,OAAO;AAErD,SAAO,EAAE,gBAAgB,kBAAkB;AAC7C;AAEO,MAAM,cAAc,MAAM;AAC/B,QAAM,EAAE,UAAU,IAAI,OAAO;AAC7B,QAAM,aAAa,cAAc;AAEjC,SAAO,cAAc,cAAc;AACrC;","names":[]}
1
+ {"version":3,"sources":["../../../src/api/api-provider.tsx"],"sourcesContent":["import { useQuery } from \"@tanstack/react-query\";\nimport * as React from \"react\";\nimport { useIsHydrated } from \"../lib/use-is-hydrated.js\";\nimport { getClaims } from \"./utils.js\";\n\nexport type WidgetType =\n | \"admin-portal-audit-log-streaming\"\n | \"admin-portal-domain-verification\"\n | \"user-management\"\n | \"organization-switcher\"\n | \"user-sessions\"\n | \"user-security\"\n | \"user-profile\"\n | \"admin-portal-sso-connection\"\n | \"api-keys\"\n | \"pipes\"\n | \"directory-sync\";\n\nexport type AuthToken = string | (() => Promise<string>);\n\ninterface ElevatedAccess {\n token: string;\n expiresAt: string;\n}\n\ninterface ApiConfig {\n authToken: string | undefined;\n permissions: string[] | undefined;\n baseUrl: string;\n widgetType: WidgetType;\n elevatedAccess?: ElevatedAccess;\n setElevatedAccess: (elevatedAccess?: ElevatedAccess) => void;\n}\n\nconst ApiContext = React.createContext<ApiConfig | undefined>(undefined);\n\ninterface ApiProviderProps {\n authToken: AuthToken;\n baseUrl: string;\n children: React.ReactNode;\n widgetType: WidgetType;\n}\n\nexport const ApiProvider = ({\n authToken,\n baseUrl,\n children,\n widgetType,\n}: ApiProviderProps) => {\n const authTokenQuery = useQuery({\n initialData:\n typeof authToken === \"string\"\n ? {\n authToken,\n permissions: getClaims(authToken).permissions,\n }\n : undefined,\n queryFn: async () => {\n const resolvedToken =\n typeof authToken === \"string\" ? authToken : await authToken();\n\n return {\n authToken: resolvedToken,\n permissions: getClaims(resolvedToken).permissions,\n };\n },\n queryKey: [\"authToken\", widgetType],\n });\n\n const [elevatedAccess, setElevatedAccess] = React.useState<ElevatedAccess>();\n const elevatedAccessTimeout = React.useRef<number | undefined>(undefined);\n\n // This effect manages the expiration of elevated access tokens\n // When an elevated access token is present, it checks every 30 seconds if the token has expired\n // If the token has expired (current time > expiration time), it clears the elevated access\n React.useEffect(() => {\n if (elevatedAccessTimeout.current) {\n window.clearInterval(elevatedAccessTimeout.current);\n }\n\n if (elevatedAccess) {\n elevatedAccessTimeout.current = window.setInterval(() => {\n const now = new Date();\n const expiresAtDate = new Date(elevatedAccess.expiresAt);\n\n // Reset the elevated access if it has expired\n if (now > expiresAtDate) {\n setElevatedAccess(undefined);\n }\n }, 30_000); // every 30 seconds\n }\n\n return () => {\n if (elevatedAccessTimeout.current) {\n window.clearInterval(elevatedAccessTimeout.current);\n }\n };\n }, [elevatedAccess]);\n\n const value = React.useMemo(\n () => ({\n authToken: authTokenQuery.data?.authToken,\n permissions: authTokenQuery.data?.permissions,\n baseUrl,\n elevatedAccess,\n setElevatedAccess,\n widgetType,\n }),\n [\n authTokenQuery.data,\n baseUrl,\n elevatedAccess,\n setElevatedAccess,\n widgetType,\n ],\n );\n\n return <ApiContext.Provider value={value}>{children}</ApiContext.Provider>;\n};\n\nexport const useApi = () => {\n const context = React.useContext(ApiContext);\n\n if (context === undefined) {\n throw new Error(\"useApi must be used within an ApiProvider\");\n }\n\n return context;\n};\n\nexport const useElevatedAccessToken = () => {\n const { elevatedAccess, setElevatedAccess } = useApi();\n\n return { elevatedAccess, setElevatedAccess };\n};\n\nexport const useApiReady = () => {\n const { authToken } = useApi();\n const isHydrated = useIsHydrated();\n\n return isHydrated && authToken !== undefined;\n};\n"],"mappings":"AAqHS;AArHT,SAAS,gBAAgB;AACzB,YAAY,WAAW;AACvB,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB;AA+B1B,MAAM,aAAa,MAAM,cAAqC,MAAS;AAShE,MAAM,cAAc,CAAC;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAwB;AACtB,QAAM,iBAAiB,SAAS;AAAA,IAC9B,aACE,OAAO,cAAc,WACjB;AAAA,MACE;AAAA,MACA,aAAa,UAAU,SAAS,EAAE;AAAA,IACpC,IACA;AAAA,IACN,SAAS,YAAY;AACnB,YAAM,gBACJ,OAAO,cAAc,WAAW,YAAY,MAAM,UAAU;AAE9D,aAAO;AAAA,QACL,WAAW;AAAA,QACX,aAAa,UAAU,aAAa,EAAE;AAAA,MACxC;AAAA,IACF;AAAA,IACA,UAAU,CAAC,aAAa,UAAU;AAAA,EACpC,CAAC;AAED,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,MAAM,SAAyB;AAC3E,QAAM,wBAAwB,MAAM,OAA2B,MAAS;AAKxE,QAAM,UAAU,MAAM;AACpB,QAAI,sBAAsB,SAAS;AACjC,aAAO,cAAc,sBAAsB,OAAO;AAAA,IACpD;AAEA,QAAI,gBAAgB;AAClB,4BAAsB,UAAU,OAAO,YAAY,MAAM;AACvD,cAAM,MAAM,oBAAI,KAAK;AACrB,cAAM,gBAAgB,IAAI,KAAK,eAAe,SAAS;AAGvD,YAAI,MAAM,eAAe;AACvB,4BAAkB,MAAS;AAAA,QAC7B;AAAA,MACF,GAAG,GAAM;AAAA,IACX;AAEA,WAAO,MAAM;AACX,UAAI,sBAAsB,SAAS;AACjC,eAAO,cAAc,sBAAsB,OAAO;AAAA,MACpD;AAAA,IACF;AAAA,EACF,GAAG,CAAC,cAAc,CAAC;AAEnB,QAAM,QAAQ,MAAM;AAAA,IAClB,OAAO;AAAA,MACL,WAAW,eAAe,MAAM;AAAA,MAChC,aAAa,eAAe,MAAM;AAAA,MAClC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE,eAAe;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO,oBAAC,WAAW,UAAX,EAAoB,OAAe,UAAS;AACtD;AAEO,MAAM,SAAS,MAAM;AAC1B,QAAM,UAAU,MAAM,WAAW,UAAU;AAE3C,MAAI,YAAY,QAAW;AACzB,UAAM,IAAI,MAAM,2CAA2C;AAAA,EAC7D;AAEA,SAAO;AACT;AAEO,MAAM,yBAAyB,MAAM;AAC1C,QAAM,EAAE,gBAAgB,kBAAkB,IAAI,OAAO;AAErD,SAAO,EAAE,gBAAgB,kBAAkB;AAC7C;AAEO,MAAM,cAAc,MAAM;AAC/B,QAAM,EAAE,UAAU,IAAI,OAAO;AAC7B,QAAM,aAAa,cAAc;AAEjC,SAAO,cAAc,cAAc;AACrC;","names":[]}
@@ -6,6 +6,7 @@ export { UserSecurity, UserSecurityProps } from './user-security.client.js';
6
6
  export { UserSessions, UserSessionsProps } from './user-sessions.client.js';
7
7
  export { UsersManagement, UsersManagementProps } from './users-management.client.js';
8
8
  export { AdminPortalDomainVerification, AdminPortalDomainVerificationProps } from './admin-portal-domain-verification.client.js';
9
+ export { AdminPortalAuditLogStreaming, AdminPortalAuditLogStreamingProps } from './admin-portal-audit-log-streaming.client.js';
9
10
  export { ApiKeys, ApiKeysProps } from './api-keys.client.js';
10
11
  export { Pipes, PipesProps } from './pipes.client.js';
11
12
  export { DirectorySync, DirectorySyncProps } from './directory-sync.client.js';
@@ -17,6 +18,7 @@ export { UserSecurityLoading } from './lib/user-security.js';
17
18
  export { UserSessionsLoading } from './lib/user-sessions.js';
18
19
  export { UsersManagementLoading } from './lib/users-management.js';
19
20
  export { AdminPortalDomainVerificationLoading } from './lib/admin-portal-domain-verification.js';
21
+ export { AdminPortalAuditLogStreamingError, AdminPortalAuditLogStreamingLoading, AdminPortalAuditLogStreamingButton as AdminPortalAuditLogStreamingOpenButton, AdminPortalAuditLogStreaming as AdminPortalAuditLogStreamingPresentational, AdminPortalAuditLogStreamingStatusProps } from './lib/admin-portal-audit-log-streaming.js';
20
22
  export { ApiKeysLoading } from './lib/api-keys/api-keys.js';
21
23
  export { PipesLoading } from './lib/pipes.js';
22
24
  export { DirectorySyncLoading } from './lib/directory-sync.js';
package/dist/esm/index.js CHANGED
@@ -29,6 +29,13 @@ import {
29
29
  AdminPortalDomainVerification,
30
30
  AdminPortalDomainVerificationLoading
31
31
  } from "./admin-portal-domain-verification.client.js";
32
+ import {
33
+ AdminPortalAuditLogStreaming,
34
+ AdminPortalAuditLogStreamingLoading,
35
+ AdminPortalAuditLogStreamingError,
36
+ AdminPortalAuditLogStreamingPresentational,
37
+ AdminPortalAuditLogStreamingButton
38
+ } from "./admin-portal-audit-log-streaming.client.js";
32
39
  import {
33
40
  ApiKeys,
34
41
  ApiKeysLoading
@@ -40,6 +47,11 @@ import {
40
47
  } from "./directory-sync.client.js";
41
48
  import { IntlContext } from "./lib/i18n/intl-context.js";
42
49
  export {
50
+ AdminPortalAuditLogStreaming,
51
+ AdminPortalAuditLogStreamingError,
52
+ AdminPortalAuditLogStreamingLoading,
53
+ AdminPortalAuditLogStreamingButton as AdminPortalAuditLogStreamingOpenButton,
54
+ AdminPortalAuditLogStreamingPresentational,
43
55
  AdminPortalDomainVerification,
44
56
  AdminPortalDomainVerificationLoading,
45
57
  AdminPortalSsoConnection,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export {\n WorkOsWidgets,\n type WorkOsWidgetsProps,\n} from \"./workos-widgets.client.js\";\nexport {\n OrganizationSwitcher,\n OrganizationSwitcherLoading,\n type OrganizationSwitcherProps,\n} from \"./organization-switcher.client.js\";\nexport {\n AdminPortalSsoConnection,\n AdminPortalSsoConnectionLoading,\n type AdminPortalSsoConnectionProps,\n} from \"./admin-portal-sso-connection.client.js\";\nexport {\n UserProfile,\n UserProfileLoading,\n type UserProfileProps,\n} from \"./user-profile.client.js\";\nexport {\n UserSecurity,\n UserSecurityLoading,\n type UserSecurityProps,\n} from \"./user-security.client.js\";\nexport {\n UserSessions,\n UserSessionsLoading,\n type UserSessionsProps,\n} from \"./user-sessions.client.js\";\nexport {\n UsersManagement,\n UsersManagementLoading,\n type UsersManagementProps,\n} from \"./users-management.client.js\";\nexport {\n AdminPortalDomainVerification,\n AdminPortalDomainVerificationLoading,\n type AdminPortalDomainVerificationProps,\n} from \"./admin-portal-domain-verification.client.js\";\nexport {\n ApiKeys,\n ApiKeysLoading,\n type ApiKeysProps,\n} from \"./api-keys.client.js\";\nexport { Pipes, PipesLoading, type PipesProps } from \"./pipes.client.js\";\nexport {\n DirectorySync,\n DirectorySyncLoading,\n type DirectorySyncProps,\n} from \"./directory-sync.client.js\";\nexport { IntlContext as internal_IntlContext } from \"./lib/i18n/intl-context.js\";\n"],"mappings":"AAAA;AAAA,EACE;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP,SAAS,OAAO,oBAAqC;AACrD;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP,SAAwB,mBAA4B;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export {\n WorkOsWidgets,\n type WorkOsWidgetsProps,\n} from \"./workos-widgets.client.js\";\nexport {\n OrganizationSwitcher,\n OrganizationSwitcherLoading,\n type OrganizationSwitcherProps,\n} from \"./organization-switcher.client.js\";\nexport {\n AdminPortalSsoConnection,\n AdminPortalSsoConnectionLoading,\n type AdminPortalSsoConnectionProps,\n} from \"./admin-portal-sso-connection.client.js\";\nexport {\n UserProfile,\n UserProfileLoading,\n type UserProfileProps,\n} from \"./user-profile.client.js\";\nexport {\n UserSecurity,\n UserSecurityLoading,\n type UserSecurityProps,\n} from \"./user-security.client.js\";\nexport {\n UserSessions,\n UserSessionsLoading,\n type UserSessionsProps,\n} from \"./user-sessions.client.js\";\nexport {\n UsersManagement,\n UsersManagementLoading,\n type UsersManagementProps,\n} from \"./users-management.client.js\";\nexport {\n AdminPortalDomainVerification,\n AdminPortalDomainVerificationLoading,\n type AdminPortalDomainVerificationProps,\n} from \"./admin-portal-domain-verification.client.js\";\nexport {\n AdminPortalAuditLogStreaming,\n AdminPortalAuditLogStreamingLoading,\n AdminPortalAuditLogStreamingError,\n type AdminPortalAuditLogStreamingProps,\n AdminPortalAuditLogStreamingPresentational,\n AdminPortalAuditLogStreamingButton as AdminPortalAuditLogStreamingOpenButton,\n type AdminPortalAuditLogStreamingStatusProps,\n} from \"./admin-portal-audit-log-streaming.client.js\";\nexport {\n ApiKeys,\n ApiKeysLoading,\n type ApiKeysProps,\n} from \"./api-keys.client.js\";\nexport { Pipes, PipesLoading, type PipesProps } from \"./pipes.client.js\";\nexport {\n DirectorySync,\n DirectorySyncLoading,\n type DirectorySyncProps,\n} from \"./directory-sync.client.js\";\nexport { IntlContext as internal_IntlContext } from \"./lib/i18n/intl-context.js\";\n"],"mappings":"AAAA;AAAA,EACE;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACsC;AAAA,OAEjC;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP,SAAS,OAAO,oBAAqC;AACrD;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP,SAAwB,mBAA4B;","names":[]}
@@ -0,0 +1,54 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+ import { WidgetRootDomProps } from './utils.js';
4
+ import { AuditLogStreamType } from '../api/endpoint.js';
5
+ import './elements.js';
6
+ import '@radix-ui/themes';
7
+ import '@radix-ui/themes/props';
8
+ import '../dialog-C15qCLN3.js';
9
+ import '@radix-ui/themes/components/dialog';
10
+ import '../alert-dialog-BlG3_awx.js';
11
+ import '@radix-ui/themes/components/alert-dialog';
12
+ import '../dropdown-menu-BQ5LtvdR.js';
13
+ import '@radix-ui/themes/components/dropdown-menu';
14
+ import '../select-KR89Qnvm.js';
15
+ import '@radix-ui/themes/components/select';
16
+ import '@tanstack/react-query';
17
+ import '../api/widgets-api-client.js';
18
+
19
+ interface NotConfiguredProps {
20
+ connectionStatus: "NotConfigured";
21
+ }
22
+ interface InactiveProps {
23
+ connectionStatus: "Inactive";
24
+ destinationType: AuditLogStreamType;
25
+ }
26
+ interface ActiveProps {
27
+ connectionStatus: "Active";
28
+ destinationType: AuditLogStreamType;
29
+ lastSyncedEventId?: string | null;
30
+ }
31
+ interface ErrorProps {
32
+ connectionStatus: "Error";
33
+ destinationType: AuditLogStreamType;
34
+ lastSyncedEventId?: string | null;
35
+ }
36
+ type AdminPortalAuditLogStreamingStatusProps = NotConfiguredProps | InactiveProps | ActiveProps | ErrorProps;
37
+ type AdminPortalAuditLogStreamingProps = WidgetRootDomProps & AdminPortalAuditLogStreamingStatusProps & {
38
+ adminPortalOpenButton: React.ReactNode;
39
+ };
40
+ declare function AdminPortalAuditLogStreamingButton({ isPending, href, initConfig, }: {
41
+ isPending: boolean;
42
+ href: string | null;
43
+ initConfig: () => void;
44
+ }): react_jsx_runtime.JSX.Element;
45
+ declare const AdminPortalAuditLogStreaming: React.FC<AdminPortalAuditLogStreamingProps>;
46
+ interface AdminPortalAuditLogStreamingLoadingProps extends WidgetRootDomProps {
47
+ }
48
+ declare const AdminPortalAuditLogStreamingLoading: React.FC<AdminPortalAuditLogStreamingLoadingProps>;
49
+ interface AdminPortalAuditLogStreamingErrorProps extends WidgetRootDomProps {
50
+ error: unknown;
51
+ }
52
+ declare const AdminPortalAuditLogStreamingError: React.FC<AdminPortalAuditLogStreamingErrorProps>;
53
+
54
+ export { AdminPortalAuditLogStreaming, AdminPortalAuditLogStreamingButton, AdminPortalAuditLogStreamingError, type AdminPortalAuditLogStreamingErrorProps, AdminPortalAuditLogStreamingLoading, type AdminPortalAuditLogStreamingLoadingProps, type AdminPortalAuditLogStreamingProps, type AdminPortalAuditLogStreamingStatusProps };