@workos-inc/widgets 1.18.0-next.1788904392369 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -1
- package/dist/cjs/lib/pipes-admin.cjs +589 -23
- package/dist/cjs/lib/pipes-admin.cjs.map +1 -1
- package/dist/cjs/lib/pipes-admin.d.cts +39 -3
- package/dist/cjs/lib/pipes.cjs +76 -32
- package/dist/cjs/lib/pipes.cjs.map +1 -1
- package/dist/cjs/lib/pipes.d.cts +79 -3
- package/dist/cjs/pipes-admin.client.cjs +45 -3
- package/dist/cjs/pipes-admin.client.cjs.map +1 -1
- package/dist/cjs/pipes-admin.client.d.cts +13 -0
- package/dist/esm/lib/pipes-admin.d.ts +39 -3
- package/dist/esm/lib/pipes-admin.js +608 -25
- package/dist/esm/lib/pipes-admin.js.map +1 -1
- package/dist/esm/lib/pipes.d.ts +79 -3
- package/dist/esm/lib/pipes.js +74 -32
- package/dist/esm/lib/pipes.js.map +1 -1
- package/dist/esm/pipes-admin.client.d.ts +13 -0
- package/dist/esm/pipes-admin.client.js +48 -4
- package/dist/esm/pipes-admin.client.js.map +1 -1
- package/package.json +1 -1
|
@@ -4,13 +4,20 @@ import { ApiProvider } from "./api/api-provider.js";
|
|
|
4
4
|
import { useWorkOsApiUrl } from "./lib/widgets-context.js";
|
|
5
5
|
import {
|
|
6
6
|
PipesAdmin as PipesAdminPresentational,
|
|
7
|
+
PipesAdminSections as PipesAdminSectionsPresentational,
|
|
7
8
|
PipesAdminError,
|
|
8
9
|
PipesAdminLoading,
|
|
9
|
-
useManageableIntegrations
|
|
10
|
+
useManageableIntegrations,
|
|
11
|
+
useOrganizationOwnedIntegrations
|
|
10
12
|
} from "./lib/pipes-admin.js";
|
|
13
|
+
import { useOrganizations } from "./api/endpoint.js";
|
|
11
14
|
import { useIsHydrated } from "./lib/use-is-hydrated.js";
|
|
12
15
|
import { ErrorBoundary } from "./lib/error-boundary.js";
|
|
13
|
-
const PipesAdmin = ({
|
|
16
|
+
const PipesAdmin = ({
|
|
17
|
+
authToken,
|
|
18
|
+
enableSharedConnections,
|
|
19
|
+
...domProps
|
|
20
|
+
}) => {
|
|
14
21
|
const baseUrl = useWorkOsApiUrl();
|
|
15
22
|
return /* @__PURE__ */ jsx(
|
|
16
23
|
ErrorBoundary,
|
|
@@ -22,13 +29,25 @@ const PipesAdmin = ({ authToken, ...domProps }) => {
|
|
|
22
29
|
widgetType: "pipes-admin",
|
|
23
30
|
authToken,
|
|
24
31
|
baseUrl,
|
|
25
|
-
children: /* @__PURE__ */ jsx(
|
|
32
|
+
children: /* @__PURE__ */ jsx(
|
|
33
|
+
PipesAdminImpl,
|
|
34
|
+
{
|
|
35
|
+
enableSharedConnections,
|
|
36
|
+
...domProps
|
|
37
|
+
}
|
|
38
|
+
)
|
|
26
39
|
}
|
|
27
40
|
)
|
|
28
41
|
}
|
|
29
42
|
);
|
|
30
43
|
};
|
|
31
|
-
const PipesAdminImpl = (
|
|
44
|
+
const PipesAdminImpl = ({
|
|
45
|
+
enableSharedConnections,
|
|
46
|
+
...props
|
|
47
|
+
}) => {
|
|
48
|
+
return enableSharedConnections ? /* @__PURE__ */ jsx(PipesAdminSectionsImpl, { ...props }) : /* @__PURE__ */ jsx(PipesAdminProviderSettingsImpl, { ...props });
|
|
49
|
+
};
|
|
50
|
+
const PipesAdminProviderSettingsImpl = (props) => {
|
|
32
51
|
const isHydrated = useIsHydrated();
|
|
33
52
|
const integrations = useManageableIntegrations();
|
|
34
53
|
if (!isHydrated || integrations.isLoading) {
|
|
@@ -39,6 +58,31 @@ const PipesAdminImpl = (props) => {
|
|
|
39
58
|
}
|
|
40
59
|
return /* @__PURE__ */ jsx(PipesAdminPresentational, { integrations: integrations.data, ...props });
|
|
41
60
|
};
|
|
61
|
+
const PipesAdminSectionsImpl = (props) => {
|
|
62
|
+
const isHydrated = useIsHydrated();
|
|
63
|
+
const integrations = useManageableIntegrations();
|
|
64
|
+
const shared = useOrganizationOwnedIntegrations();
|
|
65
|
+
const organizations = useOrganizations();
|
|
66
|
+
const organizationName = organizations.data?.data.find(
|
|
67
|
+
(organization) => organization.current
|
|
68
|
+
)?.name;
|
|
69
|
+
if (!isHydrated || integrations.isLoading) {
|
|
70
|
+
return /* @__PURE__ */ jsx(PipesAdminLoading, { count: 6, ...props });
|
|
71
|
+
}
|
|
72
|
+
if (integrations.isError) {
|
|
73
|
+
return /* @__PURE__ */ jsx(PipesAdminError, { error: integrations.error, ...props });
|
|
74
|
+
}
|
|
75
|
+
return /* @__PURE__ */ jsx(
|
|
76
|
+
PipesAdminSectionsPresentational,
|
|
77
|
+
{
|
|
78
|
+
integrations: integrations.data,
|
|
79
|
+
sharedIntegrations: shared.data,
|
|
80
|
+
isSharedLoading: shared.isLoading,
|
|
81
|
+
organizationName,
|
|
82
|
+
...props
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
};
|
|
42
86
|
export {
|
|
43
87
|
PipesAdmin,
|
|
44
88
|
PipesAdminError,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/pipes-admin.client.tsx"],"sourcesContent":["\"use client\";\nimport { ApiProvider, AuthToken } from \"./api/api-provider.js\";\nimport { useWorkOsApiUrl } from \"./lib/widgets-context.js\";\nimport {\n PipesAdmin as PipesAdminPresentational,\n PipesAdminError,\n PipesAdminLoading,\n useManageableIntegrations,\n} from \"./lib/pipes-admin.js\";\nimport type {\n PipesAdminErrorProps,\n PipesAdminLoadingProps,\n} from \"./lib/pipes-admin.js\";\nimport { useIsHydrated } from \"./lib/use-is-hydrated.js\";\nimport { ErrorBoundary } from \"./lib/error-boundary.js\";\nimport { WidgetRootDomProps } from \"./lib/utils.js\";\n\ninterface PipesAdminProps extends WidgetRootDomProps {\n authToken: AuthToken;\n}\n\nconst PipesAdmin: React.FC<PipesAdminProps> = ({
|
|
1
|
+
{"version":3,"sources":["../../src/pipes-admin.client.tsx"],"sourcesContent":["\"use client\";\nimport { ApiProvider, AuthToken } from \"./api/api-provider.js\";\nimport { useWorkOsApiUrl } from \"./lib/widgets-context.js\";\nimport {\n PipesAdmin as PipesAdminPresentational,\n PipesAdminSections as PipesAdminSectionsPresentational,\n PipesAdminError,\n PipesAdminLoading,\n useManageableIntegrations,\n useOrganizationOwnedIntegrations,\n} from \"./lib/pipes-admin.js\";\nimport type {\n PipesAdminErrorProps,\n PipesAdminLoadingProps,\n} from \"./lib/pipes-admin.js\";\nimport { useOrganizations } from \"./api/endpoint.js\";\nimport { useIsHydrated } from \"./lib/use-is-hydrated.js\";\nimport { ErrorBoundary } from \"./lib/error-boundary.js\";\nimport { WidgetRootDomProps } from \"./lib/utils.js\";\n\ninterface PipesAdminProps extends WidgetRootDomProps {\n authToken: AuthToken;\n /**\n * Opt in to the sectioned administrator experience: the connections the\n * organization owns and shares with everyone (which the administrator can\n * configure, connect, reauthorize and disconnect), followed by the provider\n * settings that govern what members may connect to on their own.\n *\n * The two sections are fetched separately, so provider settings render as\n * soon as they resolve regardless of the shared section.\n *\n * Defaults to `false`, which renders the single unsectioned provider\n * settings list and never requests organization-owned connections.\n */\n enableSharedConnections?: boolean;\n}\n\nconst PipesAdmin: React.FC<PipesAdminProps> = ({\n authToken,\n enableSharedConnections,\n ...domProps\n}) => {\n const baseUrl = useWorkOsApiUrl();\n\n return (\n <ErrorBoundary\n fallbackRender={({ error }) => (\n <PipesAdminError {...domProps} error={error} />\n )}\n >\n <ApiProvider\n widgetType=\"pipes-admin\"\n authToken={authToken}\n baseUrl={baseUrl}\n >\n <PipesAdminImpl\n enableSharedConnections={enableSharedConnections}\n {...domProps}\n />\n </ApiProvider>\n </ErrorBoundary>\n );\n};\n\n// The two experiences are separate components so the opt-out path mounts no\n// organization-owned hook at all, and therefore issues exactly the requests it\n// always has.\nconst PipesAdminImpl = ({\n enableSharedConnections,\n ...props\n}: Omit<PipesAdminProps, \"authToken\">) => {\n return enableSharedConnections ? (\n <PipesAdminSectionsImpl {...props} />\n ) : (\n <PipesAdminProviderSettingsImpl {...props} />\n );\n};\n\ntype PipesAdminImplProps = Omit<\n PipesAdminProps,\n \"authToken\" | \"enableSharedConnections\"\n>;\n\nconst PipesAdminProviderSettingsImpl = (props: PipesAdminImplProps) => {\n const isHydrated = useIsHydrated();\n const integrations = useManageableIntegrations();\n\n if (!isHydrated || integrations.isLoading) {\n return <PipesAdminLoading count={6} {...props} />;\n }\n\n if (integrations.isError) {\n return <PipesAdminError error={integrations.error} {...props} />;\n }\n\n return (\n <PipesAdminPresentational integrations={integrations.data} {...props} />\n );\n};\n\nconst PipesAdminSectionsImpl = (props: PipesAdminImplProps) => {\n const isHydrated = useIsHydrated();\n const integrations = useManageableIntegrations();\n // Both sections have their own cache entry and resolve independently:\n // provider settings render as soon as they arrive, and a slow or failing\n // organization request only affects the shared section.\n const shared = useOrganizationOwnedIntegrations();\n const organizations = useOrganizations();\n const organizationName = organizations.data?.data.find(\n (organization) => organization.current,\n )?.name;\n\n if (!isHydrated || integrations.isLoading) {\n return <PipesAdminLoading count={6} {...props} />;\n }\n\n if (integrations.isError) {\n return <PipesAdminError error={integrations.error} {...props} />;\n }\n\n return (\n <PipesAdminSectionsPresentational\n integrations={integrations.data}\n sharedIntegrations={shared.data}\n isSharedLoading={shared.isLoading}\n organizationName={organizationName}\n {...props}\n />\n );\n};\n\nexport type { PipesAdminProps, PipesAdminLoadingProps, PipesAdminErrorProps };\nexport { PipesAdmin, PipesAdminLoading, PipesAdminError };\n"],"mappings":";AA+CQ;AA9CR,SAAS,mBAA8B;AACvC,SAAS,uBAAuB;AAChC;AAAA,EACE,cAAc;AAAA,EACd,sBAAsB;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAKP,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAoB9B,MAAM,aAAwC,CAAC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,UA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