@workos-inc/widgets 1.20.0-next.1791237372282 → 1.20.0-next.1791398947580

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 CHANGED
@@ -1,11 +1,13 @@
1
1
  # Changelog
2
2
 
3
- ## 1.20.0-next.1791237372282
3
+ ## 1.20.0-next.1791398947580
4
4
 
5
5
  ### Minor Changes
6
6
 
7
7
  - Prepare the sectioned `<Pipes>` and `<PipesAdmin>` experiences (`enableSharedConnections`) for multiple connections per provider. Nothing changes until multiple connections are enabled for your environment; until then each provider keeps its single connection and looks as it did before. Once enabled, a provider with several connections renders as a group with one row per connection, oldest first, each with its own status and actions. "Add connection" and "Connect another account" add one (asking for an optional name) when the API reports it available, and connections can be renamed. Repairs target the exact connection, and adds are retry-safe.
8
8
 
9
+ - Add the optional PipesAdmin `userId` prop for attributing shared API-key and client-credentials writes with application credential tokens. User sessions send their authenticated user automatically. Block missing actors and mismatched session actors with configuration guidance instead of actor-entry UI. Application-token hosts must supply an acting WorkOS user before upgrading; publish only after the API accepts attribution.
10
+
9
11
  - Surface data integration connection failures in the Pipes widget
10
12
 
11
13
  When an OAuth handoff popup fails or closes without completing, the widget now
package/README.md CHANGED
@@ -3,3 +3,47 @@
3
3
  A suite of React components providing functionality for enterprise app workflows.
4
4
 
5
5
  [Read the documentation](https://workos.com/docs/widgets)
6
+
7
+ ## Shared Pipes credentials
8
+
9
+ `PipesAdmin` defaults to provider settings only. Opt in to shared connections
10
+ with `enableSharedConnections`. User-backed widget sessions and AuthKit user
11
+ access tokens attribute shared API-key and client-credentials writes to the
12
+ signed-in user without any new host prop.
13
+
14
+ Hosts using an application credential token must pass the acting person's
15
+ WorkOS user ID programmatically when connecting, rotating, or repairing shared
16
+ credentials:
17
+
18
+ ```tsx
19
+ <PipesAdmin
20
+ authToken={applicationCredentialToken}
21
+ enableSharedConnections
22
+ userId={authenticatedWorkOsUser.id}
23
+ />
24
+ ```
25
+
26
+ Source `authenticatedWorkOsUser.id` from the host's authenticated user context
27
+ or an existing mapping to that WorkOS user (`user_...`), not an arbitrary
28
+ application-local ID or the credential token's subject. `userId` is an optional
29
+ React prop, never a rendered field or member picker. A missing actor blocks
30
+ these shared credential writes with configuration guidance, while reads,
31
+ provider configuration, and OAuth flows remain available. User-session hosts
32
+ should omit the prop; a different ID is rejected. Standalone widget sessions
33
+ cannot supply an actor through this prop.
34
+
35
+ An authorized application caller asserts whom it acts on behalf of. Passing
36
+ `userId` does not authenticate that person or grant write access: the API still
37
+ validates permissions, identity, and active membership of the token-scoped
38
+ organization. If there is no acting person, do not fabricate one; machine-managed
39
+ credentials require separate policy support.
40
+
41
+ ### Upgrade and rollout
42
+
43
+ Before upgrading application-token hosts, supply `userId` from their authenticated
44
+ user context for shared credential actions. User-session hosts require no changes.
45
+ Publish this widget change only after the deployed Widgets GraphQL API accepts
46
+ `userId` on both organization credential inputs (PVIT-1079). Subsequent server-side
47
+ required-actor enforcement (PVIT-1081) also requires operator confirmation of the
48
+ affected hosts' upgrade and communication plan; publication alone does not prove
49
+ adoption.
@@ -1,9 +1,13 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  //#region src/api/claims.ts
3
+ function getAuthenticatedUserId(claims) {
4
+ return (claims.sub_profile === void 0 || claims.sub_profile === "user") && (claims.sub_type === "authkit" || claims.sub_type === void 0 && !!claims.sid && typeof claims.auth_time === "number") && claims.sub?.startsWith("user_") ? claims.sub : void 0;
5
+ }
3
6
  function getClaims(accessToken) {
4
7
  return JSON.parse(atob(accessToken.split(".")[1]));
5
8
  }
6
9
  //#endregion
10
+ exports.getAuthenticatedUserId = getAuthenticatedUserId;
7
11
  exports.getClaims = getClaims;
8
12
 
9
13
  //# sourceMappingURL=claims.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"claims.cjs","names":[],"sources":["../../../src/api/claims.ts"],"sourcesContent":["interface Claims {\n sid: string;\n permissions?: string[];\n exp?: number;\n}\n\nexport function getClaims(accessToken: string): Claims {\n return JSON.parse(atob(accessToken.split(\".\")[1]));\n}\n"],"mappings":";;AAMA,SAAgB,UAAU,aAA6B;CACrD,OAAO,KAAK,MAAM,KAAK,YAAY,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC;AACnD"}
1
+ {"version":3,"file":"claims.cjs","names":[],"sources":["../../../src/api/claims.ts"],"sourcesContent":["interface Claims {\n sid?: string;\n sub?: string;\n sub_type?: string;\n sub_profile?: string;\n auth_time?: number;\n permissions?: string[];\n exp?: number;\n}\n\nexport function getAuthenticatedUserId(claims: Claims): string | undefined {\n const isUserSession =\n (claims.sub_profile === undefined || claims.sub_profile === \"user\") &&\n (claims.sub_type === \"authkit\" ||\n (claims.sub_type === undefined &&\n !!claims.sid &&\n typeof claims.auth_time === \"number\"));\n\n return isUserSession && claims.sub?.startsWith(\"user_\")\n ? claims.sub\n : undefined;\n}\n\nexport function getClaims(accessToken: string): Claims {\n return JSON.parse(atob(accessToken.split(\".\")[1]));\n}\n"],"mappings":";;AAUA,SAAgB,uBAAuB,QAAoC;CAQzE,QANG,OAAO,gBAAgB,UAAa,OAAO,gBAAgB,YAC3D,OAAO,aAAa,aAClB,OAAO,aAAa,UACnB,CAAC,CAAC,OAAO,OACT,OAAO,OAAO,cAAc,aAEV,OAAO,KAAK,WAAW,OAAO,IAClD,OAAO,MACP;AACN;AAEA,SAAgB,UAAU,aAA6B;CACrD,OAAO,KAAK,MAAM,KAAK,YAAY,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC;AACnD"}
@@ -1,9 +1,14 @@
1
1
  //#region src/api/claims.d.ts
2
2
  interface Claims {
3
- sid: string;
3
+ sid?: string;
4
+ sub?: string;
5
+ sub_type?: string;
6
+ sub_profile?: string;
7
+ auth_time?: number;
4
8
  permissions?: string[];
5
9
  exp?: number;
6
10
  }
11
+ export declare function getAuthenticatedUserId(claims: Claims): string | undefined;
7
12
  export declare function getClaims(accessToken: string): Claims;
8
13
  //#endregion
9
14
  //# sourceMappingURL=claims.d.cts.map