@workos-inc/widgets 1.20.0-next.1791237372282 → 1.20.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/README.md +44 -0
- package/dist/cjs/api/claims.cjs +4 -0
- package/dist/cjs/api/claims.cjs.map +1 -1
- package/dist/cjs/api/claims.d.cts +6 -1
- package/dist/cjs/lib/pipes-credential-attribution.cjs +33 -0
- package/dist/cjs/lib/pipes-credential-attribution.cjs.map +1 -0
- package/dist/cjs/lib/pipes-credential-attribution.d.cts +8 -0
- package/dist/cjs/lib/pipes.cjs +26 -10
- package/dist/cjs/lib/pipes.cjs.map +1 -1
- package/dist/cjs/pipes-admin.client.cjs +8 -4
- package/dist/cjs/pipes-admin.client.cjs.map +1 -1
- package/dist/cjs/pipes-admin.client.d.cts +8 -0
- package/dist/esm/api/claims.d.ts +6 -1
- package/dist/esm/api/claims.js +4 -1
- package/dist/esm/api/claims.js.map +1 -1
- package/dist/esm/lib/pipes-credential-attribution.d.ts +8 -0
- package/dist/esm/lib/pipes-credential-attribution.js +31 -0
- package/dist/esm/lib/pipes-credential-attribution.js.map +1 -0
- package/dist/esm/lib/pipes.js +26 -10
- package/dist/esm/lib/pipes.js.map +1 -1
- package/dist/esm/pipes-admin.client.d.ts +8 -0
- package/dist/esm/pipes-admin.client.js +8 -4
- package/dist/esm/pipes-admin.client.js.map +1 -1
- package/package.json +1 -1
|
@@ -4,6 +4,14 @@ import { PipesAdminError, PipesAdminErrorProps, PipesAdminLoading, PipesAdminLoa
|
|
|
4
4
|
//#region src/pipes-admin.client.d.ts
|
|
5
5
|
interface PipesAdminProps extends WidgetRootDomProps {
|
|
6
6
|
authToken: AuthToken;
|
|
7
|
+
/**
|
|
8
|
+
* The acting person's WorkOS user ID for shared API-key and client-credentials
|
|
9
|
+
* writes with an application credential token. Required for those writes only.
|
|
10
|
+
* User-backed sessions use the authenticated user; a different ID is rejected.
|
|
11
|
+
* This prop is not rendered and does not grant authorization. The API validates
|
|
12
|
+
* identity and organization membership.
|
|
13
|
+
*/
|
|
14
|
+
userId?: string;
|
|
7
15
|
/**
|
|
8
16
|
* Opt in to the sectioned administrator experience: the connections the
|
|
9
17
|
* organization owns and shares with everyone (which the administrator can
|
|
@@ -4,10 +4,11 @@ import { useIsHydrated } from "./lib/use-is-hydrated.js";
|
|
|
4
4
|
import { ApiProvider } from "./api/api-provider.js";
|
|
5
5
|
import { clientGraphqlQueryKey, useClientGraphqlQuery } from "./api/client-graphql/hooks.js";
|
|
6
6
|
import { ErrorBoundary } from "./lib/error-boundary.js";
|
|
7
|
+
import { PipesCredentialUserIdContext } from "./lib/pipes-credential-attribution.js";
|
|
7
8
|
import { PipesAdmin as PipesAdmin$1, PipesAdminError, PipesAdminLoading, PipesAdminSections, useManageableIntegrations, useOrganizationOwnedIntegrations } from "./lib/pipes-admin.js";
|
|
8
9
|
import { jsx } from "react/jsx-runtime";
|
|
9
10
|
//#region src/pipes-admin.client.tsx
|
|
10
|
-
const PipesAdmin = ({ authToken, enableSharedConnections, ...domProps }) => {
|
|
11
|
+
const PipesAdmin = ({ authToken, userId, enableSharedConnections, ...domProps }) => {
|
|
11
12
|
const baseUrl = useWorkOsApiUrl();
|
|
12
13
|
return /* @__PURE__ */ jsx(ErrorBoundary, {
|
|
13
14
|
fallbackRender: ({ error }) => /* @__PURE__ */ jsx(PipesAdminError, {
|
|
@@ -18,9 +19,12 @@ const PipesAdmin = ({ authToken, enableSharedConnections, ...domProps }) => {
|
|
|
18
19
|
widgetType: "pipes-admin",
|
|
19
20
|
authToken,
|
|
20
21
|
baseUrl,
|
|
21
|
-
children: /* @__PURE__ */ jsx(
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
children: /* @__PURE__ */ jsx(PipesCredentialUserIdContext.Provider, {
|
|
23
|
+
value: userId,
|
|
24
|
+
children: /* @__PURE__ */ jsx(PipesAdminImpl, {
|
|
25
|
+
enableSharedConnections,
|
|
26
|
+
...domProps
|
|
27
|
+
})
|
|
24
28
|
})
|
|
25
29
|
})
|
|
26
30
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipes-admin.client.js","names":["PipesAdminPresentational","PipesAdminSectionsPresentational"],"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 {\n clientGraphqlQueryKey,\n useClientGraphqlQuery,\n} from \"./api/client-graphql/hooks.js\";\nimport { useIsHydrated } from \"./lib/use-is-hydrated.js\";\nimport { ErrorBoundary } from \"./lib/error-boundary.js\";\nimport { WidgetRootDomProps } from \"./lib/widget-types.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
|
|
1
|
+
{"version":3,"file":"pipes-admin.client.js","names":["PipesAdminPresentational","PipesAdminSectionsPresentational"],"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 {\n clientGraphqlQueryKey,\n useClientGraphqlQuery,\n} from \"./api/client-graphql/hooks.js\";\nimport { useIsHydrated } from \"./lib/use-is-hydrated.js\";\nimport { ErrorBoundary } from \"./lib/error-boundary.js\";\nimport { WidgetRootDomProps } from \"./lib/widget-types.js\";\nimport { PipesCredentialUserIdContext } from \"./lib/pipes-credential-attribution.js\";\n\ninterface PipesAdminProps extends WidgetRootDomProps {\n authToken: AuthToken;\n /**\n * The acting person's WorkOS user ID for shared API-key and client-credentials\n * writes with an application credential token. Required for those writes only.\n * User-backed sessions use the authenticated user; a different ID is rejected.\n * This prop is not rendered and does not grant authorization. The API validates\n * identity and organization membership.\n */\n userId?: string;\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 userId,\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 <PipesCredentialUserIdContext.Provider value={userId}>\n <PipesAdminImpl\n enableSharedConnections={enableSharedConnections}\n {...domProps}\n />\n </PipesCredentialUserIdContext.Provider>\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\" | \"userId\">) => {\n return enableSharedConnections ? (\n <PipesAdminSectionsImpl {...props} />\n ) : (\n <PipesAdminProviderSettingsImpl {...props} />\n );\n};\n\ntype PipesAdminImplProps = Omit<\n PipesAdminProps,\n \"authToken\" | \"enableSharedConnections\" | \"userId\"\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 = useClientGraphqlQuery({\n queryKey: clientGraphqlQueryKey(\"ListUserOrganizations\"),\n queryFn: (sdk) => sdk.ListUserOrganizations(),\n });\n const organizationName = organizations.data?.organizations.find(\n (organization) => organization.isCurrent,\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":";;;;;;;;;;AAiDA,MAAM,cAAyC,EAC7C,WACA,QACA,yBACA,GAAG,eACC;CACJ,MAAM,UAAU,gBAAgB;CAEhC,OACE,oBAAC,eAAD;EACE,iBAAiB,EAAE,YACjB,oBAAC,iBAAD;GAAiB,GAAI;GAAiB;EAAQ,CAAA;EAGhD,UAAA,oBAAC,aAAD;GACE,YAAW;GACA;GACF;GAET,UAAA,oBAAC,6BAA6B,UAA9B;IAAuC,OAAO;IAC5C,UAAA,oBAAC,gBAAD;KAC2B;KACzB,GAAI;IACL,CAAA;GACoC,CAAA;EAC5B,CAAA;CACA,CAAA;AAEnB;AAKA,MAAM,kBAAkB,EACtB,yBACA,GAAG,YACgD;CACnD,OAAO,0BACL,oBAAC,wBAAD,EAAwB,GAAI,MAAQ,CAAA,IAEpC,oBAAC,gCAAD,EAAgC,GAAI,MAAQ,CAAA;AAEhD;AAOA,MAAM,kCAAkC,UAA+B;CACrE,MAAM,aAAa,cAAc;CACjC,MAAM,eAAe,0BAA0B;CAE/C,IAAI,CAAC,cAAc,aAAa,WAC9B,OAAO,oBAAC,mBAAD;EAAmB,OAAO;EAAG,GAAI;CAAQ,CAAA;CAGlD,IAAI,aAAa,SACf,OAAO,oBAAC,iBAAD;EAAiB,OAAO,aAAa;EAAO,GAAI;CAAQ,CAAA;CAGjE,OACE,oBAACA,cAAD;EAA0B,cAAc,aAAa;EAAM,GAAI;CAAQ,CAAA;AAE3E;AAEA,MAAM,0BAA0B,UAA+B;CAC7D,MAAM,aAAa,cAAc;CACjC,MAAM,eAAe,0BAA0B;CAI/C,MAAM,SAAS,iCAAiC;CAKhD,MAAM,mBAJgB,sBAAsB;EAC1C,UAAU,sBAAsB,uBAAuB;EACvD,UAAU,QAAQ,IAAI,sBAAsB;CAC9C,CACyB,CAAA,CAAc,MAAM,cAAc,MACxD,iBAAiB,aAAa,SACjC,CAAC,EAAE;CAEH,IAAI,CAAC,cAAc,aAAa,WAC9B,OAAO,oBAAC,mBAAD;EAAmB,OAAO;EAAG,GAAI;CAAQ,CAAA;CAGlD,IAAI,aAAa,SACf,OAAO,oBAAC,iBAAD;EAAiB,OAAO,aAAa;EAAO,GAAI;CAAQ,CAAA;CAGjE,OACE,oBAACC,oBAAD;EACE,cAAc,aAAa;EAC3B,oBAAoB,OAAO;EAC3B,iBAAiB,OAAO;EACN;EAClB,GAAI;CACL,CAAA;AAEL"}
|