@urun-sh/react 0.1.18 → 0.1.19

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/README.md CHANGED
@@ -13,6 +13,7 @@ npm install @urun-sh/react @urun-sh/core
13
13
  ```tsx
14
14
  import '@urun-sh/react/styles.css'
15
15
  import { UrunProvider, useApp } from '@urun-sh/react'
16
+ import { UrunWorkOSProvider } from '@urun-sh/react/workos'
16
17
  import { useEffect, useRef } from 'react'
17
18
 
18
19
  function VideoPlayer() {
@@ -36,14 +37,16 @@ function VideoPlayer() {
36
37
 
37
38
  export default function App() {
38
39
  return (
39
- <UrunProvider
40
- baseUrl="https://urun.sh"
41
- orgId="your-org-id"
42
- authProvider="workos"
43
- appId="my-app"
44
- >
45
- <VideoPlayer />
46
- </UrunProvider>
40
+ <UrunWorkOSProvider clientId="client_...">
41
+ <UrunProvider
42
+ baseUrl="https://urun.sh"
43
+ orgId="your-org-id"
44
+ authProvider="workos"
45
+ appId="my-app"
46
+ >
47
+ <VideoPlayer />
48
+ </UrunProvider>
49
+ </UrunWorkOSProvider>
47
50
  )
48
51
  }
49
52
  ```
@@ -54,9 +57,9 @@ export default function App() {
54
57
 
55
58
  Browser clients authenticate with an organization ID plus a user/session JWT. During urun setup, the organization is provisioned with an auth provider configuration, such as a WorkOS client ID mapped to a JWKS URL.
56
59
 
57
- When `authProvider="workos"`, `UrunProvider` reads the WorkOS AuthKit React context and forwards refreshed access tokens with `orgId` and provider metadata. urun validates those JWTs server-side against the JWKS configured for that organization.
60
+ When `authProvider="workos"`, wrap `UrunProvider` in an auth bridge that supplies short-lived access tokens. For pure React WorkOS apps, import `UrunWorkOSProvider` from `@urun-sh/react/workos`. For Next.js WorkOS apps, import `UrunWorkOSProvider` from `@urun-sh/react/next-workos`.
58
61
 
59
- Do not pass server API keys or long-lived secrets to `UrunProvider`. Prefer `authProvider="workos"` inside your WorkOS/AuthKit provider instead of manually wiring JWT refresh. The lower-level `jwt` prop remains available for advanced/non-WorkOS integrations.
62
+ For other auth providers, use `UrunAuthProvider` with a `getAccessToken` function, or `UrunJwtProvider` for a static JWT in tests. urun validates JWTs server-side against the JWKS configured for the organization. Do not pass server API keys or long-lived secrets to browser clients.
60
63
 
61
64
  ## API
62
65
 
@@ -77,4 +80,4 @@ import '@urun-sh/react/styles.css'
77
80
 
78
81
  ## Peer dependencies
79
82
 
80
- `@urun-sh/react` supports React 18 and 19 and expects `@urun-sh/core` of the same release line.
83
+ `@urun-sh/react` supports React 18 and 19 and expects `@urun-sh/core` of the same release line. WorkOS React and Next.js integrations are optional peers used only by `@urun-sh/react/workos` and `@urun-sh/react/next-workos`.
@@ -0,0 +1,8 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ComponentProps } from 'react';
3
+ import { AuthKitProvider } from '@workos-inc/authkit-nextjs/components';
4
+
5
+ type WorkOSAuthKitProviderProps = ComponentProps<typeof AuthKitProvider>;
6
+ declare function UrunWorkOSProvider({ children, ...props }: WorkOSAuthKitProviderProps): react_jsx_runtime.JSX.Element;
7
+
8
+ export { UrunWorkOSProvider };
@@ -0,0 +1,8 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ComponentProps } from 'react';
3
+ import { AuthKitProvider } from '@workos-inc/authkit-nextjs/components';
4
+
5
+ type WorkOSAuthKitProviderProps = ComponentProps<typeof AuthKitProvider>;
6
+ declare function UrunWorkOSProvider({ children, ...props }: WorkOSAuthKitProviderProps): react_jsx_runtime.JSX.Element;
7
+
8
+ export { UrunWorkOSProvider };
@@ -0,0 +1 @@
1
+ "use strict";var s=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var k=(r,e)=>{for(var o in e)s(r,o,{get:e[o],enumerable:!0})},U=(r,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of v(e))!h.call(r,t)&&t!==o&&s(r,t,{get:()=>e[t],enumerable:!(i=P(e,t))||i.enumerable});return r};var l=r=>U(s({},"__esModule",{value:!0}),r);var f={};k(f,{UrunWorkOSProvider:()=>T});module.exports=l(f);var p=require("react"),c=require("@workos-inc/authkit-nextjs/components");var n=require("react"),d=require("react/jsx-runtime"),a=(0,n.createContext)(null);function A({getAccessToken:r,children:e}){let o=(0,n.useMemo)(()=>({getAccessToken:r}),[r]);return(0,d.jsx)(a.Provider,{value:o,children:e})}var u=require("react/jsx-runtime");function x({children:r}){let e=(0,c.useAccessToken)(),o=(0,p.useCallback)(()=>e.getAccessToken(),[e]);return(0,u.jsx)(A,{getAccessToken:o,children:r})}function T({children:r,...e}){return(0,u.jsx)(c.AuthKitProvider,{...e,children:(0,u.jsx)(x,{children:r})})}0&&(module.exports={UrunWorkOSProvider});
@@ -0,0 +1 @@
1
+ import{a as t}from"./chunk-OAFPMVUO.mjs";import{useCallback as i}from"react";import{AuthKitProvider as c,useAccessToken as s}from"@workos-inc/authkit-nextjs/components";import{jsx as e}from"react/jsx-runtime";function u({children:r}){let o=s(),n=i(()=>o.getAccessToken(),[o]);return e(t,{getAccessToken:n,children:r})}function A({children:r,...o}){return e(c,{...o,children:e(u,{children:r})})}export{A as UrunWorkOSProvider};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@urun-sh/react",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "description": "React bindings for the urun TypeScript SDK",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,6 +30,11 @@
30
30
  "import": "./dist/workos.mjs",
31
31
  "require": "./dist/workos.js"
32
32
  },
33
+ "./next-workos": {
34
+ "types": "./dist/next-workos.d.ts",
35
+ "import": "./dist/next-workos.mjs",
36
+ "require": "./dist/next-workos.js"
37
+ },
33
38
  "./styles.css": "./dist/styles.css",
34
39
  "./package.json": "./package.json"
35
40
  },
@@ -41,8 +46,10 @@
41
46
  },
42
47
  "peerDependencies": {
43
48
  "react": "^18.2.0 || ^19.0.0",
44
- "@urun-sh/core": "^0.1.18",
45
- "@workos-inc/authkit-react": "^0.15.0 || ^0.16.0"
49
+ "@urun-sh/core": "^0.1.19",
50
+ "@workos-inc/authkit-react": "^0.15.0 || ^0.16.0",
51
+ "@workos-inc/authkit-nextjs": "^3.0.0",
52
+ "next": "^15.0.0 || ^16.0.0"
46
53
  },
47
54
  "dependencies": {
48
55
  "zustand": "^5.0.0",
@@ -60,7 +67,9 @@
60
67
  "react": "^19.2.6",
61
68
  "react-dom": "^19.2.6",
62
69
  "@urun-sh/core": "workspace:*",
63
- "@workos-inc/authkit-react": "^0.16.1"
70
+ "@workos-inc/authkit-react": "^0.16.1",
71
+ "@workos-inc/authkit-nextjs": "^3.0.0",
72
+ "next": "16.2.6"
64
73
  },
65
74
  "files": [
66
75
  "dist",
@@ -88,6 +97,12 @@
88
97
  "peerDependenciesMeta": {
89
98
  "@workos-inc/authkit-react": {
90
99
  "optional": true
100
+ },
101
+ "@workos-inc/authkit-nextjs": {
102
+ "optional": true
103
+ },
104
+ "next": {
105
+ "optional": true
91
106
  }
92
107
  }
93
108
  }