@bodhiapp/bodhi-js-react 0.0.9 → 0.0.11

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.
@@ -5,4 +5,4 @@ export interface BodhiProviderProps extends Omit<CoreBodhiProviderProps, 'client
5
5
  clientConfig?: WebUIClientParams;
6
6
  client?: UIClient;
7
7
  }
8
- export declare function BodhiProvider({ children, authClientId, clientConfig, client: providedClient, ...restProps }: BodhiProviderProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function BodhiProvider({ children, authClientId, clientConfig, client: providedClient, basePath, ...restProps }: BodhiProviderProps): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),u=require("react"),o=require("@bodhiapp/bodhi-js"),e=require("@bodhiapp/bodhi-js-react-core");function b({children:a,authClientId:i,clientConfig:n,client:t,...l}){if(!t&&!i)throw new Error('BodhiProvider requires either "client" or "authClientId" prop');const r=u.useRef(null),s=u.useMemo(()=>t||(r.current||(r.current=new o.WebUIClient(i,n)),r.current),[t,i,n]);return c.jsx(e.BodhiProvider,{client:s,...l,children:a})}const d="production";Object.defineProperty(exports,"WebUIClient",{enumerable:!0,get:()=>o.WebUIClient});Object.defineProperty(exports,"BodhiReactContext",{enumerable:!0,get:()=>e.BodhiReactContext});Object.defineProperty(exports,"ClientCtxState",{enumerable:!0,get:()=>e.ClientCtxState});Object.defineProperty(exports,"INITIALIZING_CLIENT_CONTEXT_STATE",{enumerable:!0,get:()=>e.INITIALIZING_CLIENT_CONTEXT_STATE});Object.defineProperty(exports,"INITIAL_CLIENT_CONTEXT_STATE",{enumerable:!0,get:()=>e.INITIAL_CLIENT_CONTEXT_STATE});Object.defineProperty(exports,"clientStateToContextState",{enumerable:!0,get:()=>e.clientStateToContextState});Object.defineProperty(exports,"createApiError",{enumerable:!0,get:()=>e.createApiError});Object.defineProperty(exports,"createOperationError",{enumerable:!0,get:()=>e.createOperationError});Object.defineProperty(exports,"isApiResultError",{enumerable:!0,get:()=>e.isApiResultError});Object.defineProperty(exports,"isApiResultOperationError",{enumerable:!0,get:()=>e.isApiResultOperationError});Object.defineProperty(exports,"isApiResultSuccess",{enumerable:!0,get:()=>e.isApiResultSuccess});Object.defineProperty(exports,"isAuthError",{enumerable:!0,get:()=>e.isAuthError});Object.defineProperty(exports,"isAuthLoading",{enumerable:!0,get:()=>e.isAuthLoading});Object.defineProperty(exports,"isAuthenticated",{enumerable:!0,get:()=>e.isAuthenticated});Object.defineProperty(exports,"isClientCtxInitialized",{enumerable:!0,get:()=>e.isClientCtxInitialized});Object.defineProperty(exports,"isClientCtxInitializing",{enumerable:!0,get:()=>e.isClientCtxInitializing});Object.defineProperty(exports,"isClientCtxNotInitialized",{enumerable:!0,get:()=>e.isClientCtxNotInitialized});Object.defineProperty(exports,"isClientCtxReady",{enumerable:!0,get:()=>e.isClientCtxReady});Object.defineProperty(exports,"isClientReady",{enumerable:!0,get:()=>e.isClientReady});Object.defineProperty(exports,"isDirectState",{enumerable:!0,get:()=>e.isDirectState});Object.defineProperty(exports,"isExtensionState",{enumerable:!0,get:()=>e.isExtensionState});Object.defineProperty(exports,"isOperationError",{enumerable:!0,get:()=>e.isOperationError});Object.defineProperty(exports,"isOverallReady",{enumerable:!0,get:()=>e.isOverallReady});Object.defineProperty(exports,"isWebUIClient",{enumerable:!0,get:()=>e.isWebUIClient});Object.defineProperty(exports,"useBodhi",{enumerable:!0,get:()=>e.useBodhi});exports.BodhiProvider=b;exports.REACT_BUILD_MODE=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),o=require("react"),a=require("@bodhiapp/bodhi-js"),e=require("@bodhiapp/bodhi-js-react-core");function p({children:l,authClientId:i,clientConfig:n,client:t,basePath:u,...s}){if(!t&&!i)throw new Error('BodhiProvider requires either "client" or "authClientId" prop');const r=o.useRef(null),c=o.useMemo(()=>{if(t)return t;if(r.current)return r.current;const b={...n,basePath:n?.basePath??u};return r.current=new a.WebUIClient(i,b),r.current},[t,i,n,u]);return d.jsx(e.BodhiProvider,{client:c,basePath:u,...s,children:l})}const O="production";Object.defineProperty(exports,"WebUIClient",{enumerable:!0,get:()=>a.WebUIClient});Object.defineProperty(exports,"BodhiReactContext",{enumerable:!0,get:()=>e.BodhiReactContext});Object.defineProperty(exports,"ClientCtxState",{enumerable:!0,get:()=>e.ClientCtxState});Object.defineProperty(exports,"INITIALIZING_CLIENT_CONTEXT_STATE",{enumerable:!0,get:()=>e.INITIALIZING_CLIENT_CONTEXT_STATE});Object.defineProperty(exports,"INITIAL_CLIENT_CONTEXT_STATE",{enumerable:!0,get:()=>e.INITIAL_CLIENT_CONTEXT_STATE});Object.defineProperty(exports,"clientStateToContextState",{enumerable:!0,get:()=>e.clientStateToContextState});Object.defineProperty(exports,"createApiError",{enumerable:!0,get:()=>e.createApiError});Object.defineProperty(exports,"createOperationError",{enumerable:!0,get:()=>e.createOperationError});Object.defineProperty(exports,"isApiResultError",{enumerable:!0,get:()=>e.isApiResultError});Object.defineProperty(exports,"isApiResultOperationError",{enumerable:!0,get:()=>e.isApiResultOperationError});Object.defineProperty(exports,"isApiResultSuccess",{enumerable:!0,get:()=>e.isApiResultSuccess});Object.defineProperty(exports,"isAuthError",{enumerable:!0,get:()=>e.isAuthError});Object.defineProperty(exports,"isAuthLoading",{enumerable:!0,get:()=>e.isAuthLoading});Object.defineProperty(exports,"isAuthenticated",{enumerable:!0,get:()=>e.isAuthenticated});Object.defineProperty(exports,"isClientCtxInitialized",{enumerable:!0,get:()=>e.isClientCtxInitialized});Object.defineProperty(exports,"isClientCtxInitializing",{enumerable:!0,get:()=>e.isClientCtxInitializing});Object.defineProperty(exports,"isClientCtxNotInitialized",{enumerable:!0,get:()=>e.isClientCtxNotInitialized});Object.defineProperty(exports,"isClientCtxReady",{enumerable:!0,get:()=>e.isClientCtxReady});Object.defineProperty(exports,"isClientReady",{enumerable:!0,get:()=>e.isClientReady});Object.defineProperty(exports,"isDirectState",{enumerable:!0,get:()=>e.isDirectState});Object.defineProperty(exports,"isExtensionState",{enumerable:!0,get:()=>e.isExtensionState});Object.defineProperty(exports,"isOperationError",{enumerable:!0,get:()=>e.isOperationError});Object.defineProperty(exports,"isOverallReady",{enumerable:!0,get:()=>e.isOverallReady});Object.defineProperty(exports,"isWebUIClient",{enumerable:!0,get:()=>e.isWebUIClient});Object.defineProperty(exports,"useBodhi",{enumerable:!0,get:()=>e.useBodhi});exports.BodhiProvider=p;exports.REACT_BUILD_MODE=O;
@@ -1,42 +1,50 @@
1
- import { jsx as a } from "react/jsx-runtime";
2
- import { useRef as u, useMemo as c } from "react";
3
- import { WebUIClient as l } from "@bodhiapp/bodhi-js";
4
- import { WebUIClient as m } from "@bodhiapp/bodhi-js";
5
- import { BodhiProvider as E } from "@bodhiapp/bodhi-js-react-core";
6
- import { BodhiReactContext as R, ClientCtxState as _, INITIALIZING_CLIENT_CONTEXT_STATE as B, INITIAL_CLIENT_CONTEXT_STATE as N, clientStateToContextState as O, createApiError as S, createOperationError as L, isApiResultError as D, isApiResultOperationError as U, isApiResultSuccess as P, isAuthError as b, isAuthLoading as w, isAuthenticated as y, isClientCtxInitialized as z, isClientCtxInitializing as M, isClientCtxNotInitialized as W, isClientCtxReady as v, isClientReady as X, isDirectState as g, isExtensionState as j, isOperationError as q, isOverallReady as G, isWebUIClient as Z, useBodhi as $ } from "@bodhiapp/bodhi-js-react-core";
7
- function x({ children: o, authClientId: e, clientConfig: i, client: r, ...n }) {
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import { useRef as l, useMemo as E } from "react";
3
+ import { WebUIClient as I } from "@bodhiapp/bodhi-js";
4
+ import { WebUIClient as R } from "@bodhiapp/bodhi-js";
5
+ import { BodhiProvider as C } from "@bodhiapp/bodhi-js-react-core";
6
+ import { BodhiReactContext as B, ClientCtxState as N, INITIALIZING_CLIENT_CONTEXT_STATE as O, INITIAL_CLIENT_CONTEXT_STATE as S, clientStateToContextState as L, createApiError as D, createOperationError as U, isApiResultError as P, isApiResultOperationError as b, isApiResultSuccess as w, isAuthError as y, isAuthLoading as z, isAuthenticated as M, isClientCtxInitialized as W, isClientCtxInitializing as g, isClientCtxNotInitialized as v, isClientCtxReady as X, isClientReady as j, isDirectState as q, isExtensionState as G, isOperationError as Z, isOverallReady as $, isWebUIClient as k, useBodhi as F } from "@bodhiapp/bodhi-js-react-core";
7
+ function x({ children: n, authClientId: e, clientConfig: i, client: r, basePath: o, ...s }) {
8
8
  if (!r && !e)
9
9
  throw new Error('BodhiProvider requires either "client" or "authClientId" prop');
10
- const t = u(null), s = c(() => r || (t.current || (t.current = new l(e, i)), t.current), [r, e, i]);
11
- return /* @__PURE__ */ a(E, { client: s, ...n, children: o });
10
+ const t = l(null), a = E(() => {
11
+ if (r) return r;
12
+ if (t.current) return t.current;
13
+ const u = {
14
+ ...i,
15
+ basePath: i?.basePath ?? o
16
+ };
17
+ return t.current = new I(e, u), t.current;
18
+ }, [r, e, i, o]);
19
+ return /* @__PURE__ */ c(C, { client: a, basePath: o, ...s, children: n });
12
20
  }
13
21
  const A = "production";
14
22
  export {
15
23
  x as BodhiProvider,
16
- R as BodhiReactContext,
17
- _ as ClientCtxState,
18
- B as INITIALIZING_CLIENT_CONTEXT_STATE,
19
- N as INITIAL_CLIENT_CONTEXT_STATE,
24
+ B as BodhiReactContext,
25
+ N as ClientCtxState,
26
+ O as INITIALIZING_CLIENT_CONTEXT_STATE,
27
+ S as INITIAL_CLIENT_CONTEXT_STATE,
20
28
  A as REACT_BUILD_MODE,
21
- m as WebUIClient,
22
- O as clientStateToContextState,
23
- S as createApiError,
24
- L as createOperationError,
25
- D as isApiResultError,
26
- U as isApiResultOperationError,
27
- P as isApiResultSuccess,
28
- b as isAuthError,
29
- w as isAuthLoading,
30
- y as isAuthenticated,
31
- z as isClientCtxInitialized,
32
- M as isClientCtxInitializing,
33
- W as isClientCtxNotInitialized,
34
- v as isClientCtxReady,
35
- X as isClientReady,
36
- g as isDirectState,
37
- j as isExtensionState,
38
- q as isOperationError,
39
- G as isOverallReady,
40
- Z as isWebUIClient,
41
- $ as useBodhi
29
+ R as WebUIClient,
30
+ L as clientStateToContextState,
31
+ D as createApiError,
32
+ U as createOperationError,
33
+ P as isApiResultError,
34
+ b as isApiResultOperationError,
35
+ w as isApiResultSuccess,
36
+ y as isAuthError,
37
+ z as isAuthLoading,
38
+ M as isAuthenticated,
39
+ W as isClientCtxInitialized,
40
+ g as isClientCtxInitializing,
41
+ v as isClientCtxNotInitialized,
42
+ X as isClientCtxReady,
43
+ j as isClientReady,
44
+ q as isDirectState,
45
+ G as isExtensionState,
46
+ Z as isOperationError,
47
+ $ as isOverallReady,
48
+ k as isWebUIClient,
49
+ F as useBodhi
42
50
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bodhiapp/bodhi-js-react",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "React bindings for Bodhi Browser SDK with WebUIClient preset",
5
5
  "type": "module",
6
6
  "main": "dist/bodhi-react.cjs.js",
@@ -23,7 +23,7 @@
23
23
  ],
24
24
  "repository": {
25
25
  "type": "git",
26
- "url": "https://github.com/BodhiSearch/bodhi-browser.git",
26
+ "url": "https://github.com/BodhiSearch/bodhi-js.git",
27
27
  "directory": "bodhi-js-sdk/react"
28
28
  },
29
29
  "license": "MIT",
@@ -42,9 +42,9 @@
42
42
  "typecheck": "tsc --noEmit"
43
43
  },
44
44
  "dependencies": {
45
- "@bodhiapp/bodhi-js-react-core": "file:../react-core",
46
- "@bodhiapp/bodhi-js": "file:../web",
47
- "@bodhiapp/bodhi-js-core": "0.0.9"
45
+ "@bodhiapp/bodhi-js-react-core": "0.0.11",
46
+ "@bodhiapp/bodhi-js": "0.0.11",
47
+ "@bodhiapp/bodhi-js-core": "0.0.11"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "react": "^18.3.0 || ^19.0.0"